Save the error code before doing any other operation
SDL_ClearError() resets the Win32 error code to 0
This commit is contained in:
@@ -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)
|
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);
|
free(*error_buffer);
|
||||||
*error_buffer = NULL;
|
*error_buffer = NULL;
|
||||||
|
|
||||||
@@ -268,9 +271,6 @@ static void register_winapi_error_to_buffer(wchar_t **error_buffer, const WCHAR
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WCHAR system_err_buf[1024];
|
|
||||||
DWORD error_code = GetLastError();
|
|
||||||
|
|
||||||
DWORD system_err_len = FormatMessageW(
|
DWORD system_err_len = FormatMessageW(
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
Reference in New Issue
Block a user