Save the error code before doing any other operation
SDL_ClearError() resets the Win32 error code to 0main
parent
6e7769cde1
commit
17c397f7ec
|
@ -255,6 +255,9 @@ static void free_hid_device(hid_device *dev)
|
|||
|
||||
static void register_winapi_error_to_buffer(wchar_t **error_buffer, const WCHAR *op)
|
||||
{
|
||||
WCHAR system_err_buf[1024];
|
||||
DWORD error_code = GetLastError();
|
||||
|
||||
free(*error_buffer);
|
||||
*error_buffer = NULL;
|
||||
|
||||
|
@ -268,9 +271,6 @@ static void register_winapi_error_to_buffer(wchar_t **error_buffer, const WCHAR
|
|||
return;
|
||||
}
|
||||
|
||||
WCHAR system_err_buf[1024];
|
||||
DWORD error_code = GetLastError();
|
||||
|
||||
DWORD system_err_len = FormatMessageW(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
|
|
Loading…
Reference in New Issue