Skip to content

Commit bfb68de

Browse files
staticfloatvtjnash
andcommitted
Apply suggestions from code review
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
1 parent 84402dd commit bfb68de

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ AM_CONDITIONAL([OS400], [AS_CASE([$host_os],[os400], [true], [false])
7474
AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
7575
AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
7676
AS_CASE([$host_os],[mingw*], [
77-
LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -lshell32 -lsecur32 -luserenv -luser32 -lwer -ldbghelp"
77+
LIBS="$LIBS -lws2_32 -lpsapi -liphlpapi -lshell32 -lsecur32 -luserenv -luser32 -ldbghelp -lole32 -luuid"
7878
])
7979
AS_CASE([$host_os], [netbsd*], [AC_CHECK_LIB([kvm], [kvm_open])])
8080
AS_CASE([$host_os], [kfreebsd*], [

src/win/process.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,20 +1252,22 @@ static int uv__kill(HANDLE process_handle, int signum) {
12521252
return UV_EINVAL;
12531253
}
12541254

1255-
// Create a dump file for the targeted process, if the registry key
1256-
// `HKLM:Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\DumpFolder`
1257-
// points to a valid folder. The default value if the registry key does not
1258-
// exist is `%LOCALAPPDATA%\CrashDumps`, see [0] for more detail.
1259-
// [0]: https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
1255+
/*
1256+
* Create a dump file for the targeted process, if the registry key
1257+
* `HKLM:Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\DumpFolder`
1258+
* points to a valid folder. The default value if the registry key does not
1259+
* exist is `%LOCALAPPDATA%\CrashDumps`, see [0] for more detail.
1260+
* [0]: https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps
1261+
*/
12601262
if (signum == SIGQUIT) {
1261-
// Get process name
1263+
/* Get target process name. */
12621264
WCHAR basename[MAX_PATH];
12631265
GetModuleBaseNameW(process_handle, NULL, &basename[0], sizeof(basename));
12641266

1265-
// Get PID
1267+
/* Get PID of target process. */
12661268
DWORD pid = GetProcessId(process_handle);
12671269

1268-
// Get LocalDumps directory path:
1270+
/* Get LocalDumps directory path. */
12691271
HKEY registry_key;
12701272
WCHAR dump_folder[MAX_PATH];
12711273
DWORD ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
@@ -1284,22 +1286,21 @@ static int uv__kill(HANDLE process_handle, int signum) {
12841286
(PVOID) dump_folder,
12851287
&dump_folder_len);
12861288
if (ret != ERROR_SUCCESS) {
1287-
// Default value for `dump_folder` is `%LOCALAPPDATA%\CrashDumps`
1289+
/* Default value for `dump_folder` is `%LOCALAPPDATA%\CrashDumps`. */
12881290
WCHAR * localappdata;
12891291
SHGetKnownFolderPath(&FOLDERID_LocalAppData, 0, NULL, &localappdata);
1290-
swprintf_s(dump_folder, sizeof(dump_folder), L"%ls\\CrashDumps", localappdata);
1292+
_snwprintf(dump_folder, sizeof(dump_folder), L"%ls\\CrashDumps", localappdata);
12911293
CoTaskMemFree(localappdata);
12921294
}
12931295
RegCloseKey(registry_key);
1294-
}
12951296

1296-
// Construct dump filename
1297+
/* Construct dump filename. */
12971298
WCHAR dump_name[MAX_PATH];
12981299
swprintf_s(dump_name, sizeof(dump_name), L"%ls\\%ls.%d.dmp", dump_folder, basename, pid);
12991300

13001301
HANDLE hDumpFile = CreateFileW(dump_name, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
13011302
if (hDumpFile != INVALID_HANDLE_VALUE) {
1302-
// Tell wine to dump ELF modules as well
1303+
/* Tell wine to dump ELF modules as well */
13031304
DWORD sym_options = SymGetOptions();
13041305
SymSetOptions(sym_options | 0x40000000);
13051306
MiniDumpWriteDump(

0 commit comments

Comments
 (0)