From 6a07a4ffc0ba29add5a8e0645752619dc797d728 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 1 Mar 2024 10:14:08 +0000 Subject: [PATCH 1/2] Revert "[compiler-rt][fuzzer] windows build unbreak proposal. (#83538)" This reverts commit 062d78ef58ac26e1c6f82201151428d0b89cca21. --- compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp index 39ab9e241b591..13f9a67a2f0fe 100644 --- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp @@ -18,18 +18,15 @@ #include #include #include +#include #include #include +#include #include -// clang-format off #include -// These must be included after windows.h. -// archicture need to be set before including -// libloaderapi -#include -#include + +// This must be included after windows.h. #include -// clang-format on namespace fuzzer { From c522d4882740b449079bc6dec9c5400aa745d132 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 1 Mar 2024 10:14:45 +0000 Subject: [PATCH 2/2] Revert "[compiler-rt][Fuzzer] SetThreadName windows implementation new try. (#76761)" This reverts commit 2cdf611c02392112860e661e8251efa8b1335cc2. --- compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp index 13f9a67a2f0fe..71770166805f7 100644 --- a/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp @@ -18,10 +18,8 @@ #include #include #include -#include #include #include -#include #include #include @@ -236,20 +234,8 @@ size_t PageSize() { } void SetThreadName(std::thread &thread, const std::string &name) { - typedef HRESULT(WINAPI * proc)(HANDLE, PCWSTR); - HMODULE kbase = GetModuleHandleA("KernelBase.dll"); - proc ThreadNameProc = - reinterpret_cast(GetProcAddress, "SetThreadDescription"); - if (proc) { - std::wstring buf; - auto sz = MultiByteToWideChar(CP_UTF8, 0, name.data(), -1, nullptr, 0); - if (sz > 0) { - buf.resize(sz); - if (MultyByteToWideChar(CP_UTF8, 0, name.data(), -1, &buf[0], sz) > 0) { - (void)ThreadNameProc(thread.native_handle(), buf.c_str()); - } - } - } + // TODO ? + // to UTF-8 then SetThreadDescription ? } } // namespace fuzzer