From 34db4c21b1f3182a74091d927b10bb9830ef6717 Mon Sep 17 00:00:00 2001 From: Anton Bachin Date: Wed, 20 Dec 2023 16:27:13 +0300 Subject: [PATCH] build,win: work around missing uuid.dll on MinGW (#4261) --- CMakeLists.txt | 1 - configure.ac | 2 +- src/win/process.c | 11 ++++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7f42773..f3d1642b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,7 +186,6 @@ if(WIN32) ws2_32 dbghelp ole32 - uuid shell32) list(APPEND uv_sources src/win/async.c diff --git a/configure.ac b/configure.ac index e556bcc8..f9b5aa53 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ AM_CONDITIONAL([OS400], [AS_CASE([$host_os],[os400], [true], [false]) AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])]) AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])]) AS_CASE([$host_os],[mingw*], [ - LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -luserenv -luser32 -ldbghelp -lole32 -luuid -lshell32" + LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -luserenv -luser32 -ldbghelp -lole32 -lshell32" ]) AS_CASE([$host_os], [solaris2.10], [ CFLAGS="$CFLAGS -DSUNOS_NO_IFADDRS" diff --git a/src/win/process.c b/src/win/process.c index 117054d4..6123ea26 100644 --- a/src/win/process.c +++ b/src/win/process.c @@ -1212,9 +1212,18 @@ static int uv__kill(HANDLE process_handle, int signum) { (PVOID) dump_folder, &dump_folder_len); if (ret != ERROR_SUCCESS) { + /* Workaround for missing uuid.dll on MinGW. */ + static const GUID FOLDERID_LocalAppData_libuv = { + 0xf1b32785, 0x6fba, 0x4fcf, + {0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91} + }; + /* Default value for `dump_folder` is `%LOCALAPPDATA%\CrashDumps`. */ WCHAR* localappdata; - SHGetKnownFolderPath(&FOLDERID_LocalAppData, 0, NULL, &localappdata); + SHGetKnownFolderPath(&FOLDERID_LocalAppData_libuv, + 0, + NULL, + &localappdata); _snwprintf_s(dump_folder, sizeof(dump_folder), _TRUNCATE,