[llvm] [llvm][Support][Windows] Avoid crash calling remove_directories() (PR #118677)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 15:55:27 PST 2024
================
@@ -1387,14 +1388,33 @@ std::error_code remove_directories(const Twine &path, bool IgnoreErrors) {
Path16.push_back(0);
Path16.push_back(0);
- SHFILEOPSTRUCTW shfos = {};
- shfos.wFunc = FO_DELETE;
- shfos.pFrom = Path16.data();
- shfos.fFlags = FOF_NO_UI;
-
- int result = ::SHFileOperationW(&shfos);
- if (result != 0 && !IgnoreErrors)
- return mapWindowsError(result);
+ HRESULT HR;
+ do {
+ HR =
+ CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
----------------
rnk wrote:
I did click through to the article, and I figured that shell32.dll is layered on top of COM, which is pretty low-level, so this isn't surprising. Let's do this then, it's equivalent, but disables shell hooks.
https://github.com/llvm/llvm-project/pull/118677
More information about the llvm-commits
mailing list