windows: use consistent format when showing error codes

For `GetLastError()` and `SECURITY_STATUS`:
0x-prefixed, 8-digit, lowercase, hex: 0x1234abcd

Also: say `GetLastError()` instead of `errno` in one message.

Closes #18877
This commit is contained in:
Viktor Szakats 2025-10-06 03:02:24 +02:00
parent 0d68f48205
commit 51b85bdc6c
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
7 changed files with 17 additions and 16 deletions

View file

@ -871,7 +871,7 @@ curl_socket_t win32_stdin_read_thread(void)
0, FALSE, DUPLICATE_SAME_ACCESS);
if(!r) {
errorf("DuplicateHandle error: %08lx", GetLastError());
errorf("DuplicateHandle error: 0x%08lx", GetLastError());
break;
}
@ -882,7 +882,7 @@ curl_socket_t win32_stdin_read_thread(void)
stdin_thread = CreateThread(NULL, 0, win_stdin_thread_func,
tdata, 0, NULL);
if(!stdin_thread) {
errorf("CreateThread error: %08lx", GetLastError());
errorf("CreateThread error: 0x%08lx", GetLastError());
break;
}
@ -908,7 +908,7 @@ curl_socket_t win32_stdin_read_thread(void)
/* Set the stdin handle to read from the socket. */
if(SetStdHandle(STD_INPUT_HANDLE, (HANDLE)socket_r) == 0) {
errorf("SetStdHandle error: %08lx", GetLastError());
errorf("SetStdHandle error: 0x%08lx", GetLastError());
break;
}

View file

@ -62,13 +62,13 @@ int getfiletime(const char *filename, curl_off_t *stamp)
}
}
else {
warnf("Failed to get filetime: GetFileTime failed: GetLastError %lu",
warnf("Failed to get filetime: GetFileTime failed: GetLastError 0x%08lx",
GetLastError());
}
CloseHandle(hfile);
}
else if(GetLastError() != ERROR_FILE_NOT_FOUND) {
warnf("Failed to get filetime: CreateFile failed: GetLastError %lu",
warnf("Failed to get filetime: CreateFile failed: GetLastError 0x%08lx",
GetLastError());
}
#else
@ -118,14 +118,14 @@ void setfiletime(curl_off_t filetime, const char *filename)
ft.dwHighDateTime = (DWORD)(converted >> 32);
if(!SetFileTime(hfile, NULL, &ft, &ft)) {
warnf("Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on outfile: SetFileTime failed: GetLastError %lu",
" on outfile: SetFileTime failed: GetLastError 0x%08lx",
filetime, GetLastError());
}
CloseHandle(hfile);
}
else {
warnf("Failed to set filetime %" CURL_FORMAT_CURL_OFF_T
" on outfile: CreateFile failed: GetLastError %lu",
" on outfile: CreateFile failed: GetLastError 0x%08lx",
filetime, GetLastError());
}