win32u: Use RtlGetLastWin32Error() instead of GetLastError().

This commit is contained in:
Alexandre Julliard 2022-11-12 17:02:57 +01:00
parent cc0ac7b430
commit 1d6b3e1434
4 changed files with 15 additions and 7 deletions

View file

@ -2391,6 +2391,14 @@ ULONG WINAPI RtlNtStatusToDosError( NTSTATUS status )
return map_status( status );
}
/**********************************************************************
* RtlGetLastWin32Error (ntdll.so)
*/
DWORD WINAPI RtlGetLastWin32Error(void)
{
return NtCurrentTeb()->LastErrorValue;
}
/**********************************************************************
* RtlSetLastWin32Error (ntdll.so)
*/

View file

@ -56,7 +56,7 @@ static struct list formats_to_free = LIST_INIT( formats_to_free );
static const char *debugstr_format( UINT id )
{
WCHAR buffer[256];
DWORD le = GetLastError();
DWORD le = RtlGetLastWin32Error();
BOOL r = NtUserGetClipboardFormatName( id, buffer, ARRAYSIZE(buffer) );
RtlSetLastWin32Error(le);

View file

@ -2213,7 +2213,7 @@ static void SPY_GetWndName( SPY_INSTANCE *sp_e )
const char *debugstr_msg_name( UINT msg, HWND hWnd )
{
SPY_INSTANCE ext_sp_e;
DWORD save_error = GetLastError();
DWORD save_error = RtlGetLastWin32Error();
ext_sp_e.msgnum = msg;
ext_sp_e.msg_hwnd = hWnd;
@ -2504,7 +2504,7 @@ static void SPY_DumpStructure(const SPY_INSTANCE *sp_e, BOOL enter)
/* for CUSTOMDRAW, dump all the data for TOOLBARs */
if (pnmh->code == NM_CUSTOMDRAW) {
/* save and restore error code over the next call */
save_error = GetLastError();
save_error = RtlGetLastWin32Error();
NtUserGetClassName( pnmh->hwndFrom, FALSE, &str );
RtlSetLastWin32Error(save_error);
if (wcscmp(TOOLBARCLASSNAMEW, from_class) == 0)
@ -2597,7 +2597,7 @@ void spy_enter_message( INT iFlag, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
{
SPY_INSTANCE sp_e;
int indent;
DWORD save_error = GetLastError();
DWORD save_error = RtlGetLastWin32Error();
if (!spy_init() || exclude_msg(msg)) return;
@ -2652,7 +2652,7 @@ void spy_exit_message( INT iFlag, HWND hWnd, UINT msg, LRESULT lReturn,
{
SPY_INSTANCE sp_e;
int indent;
DWORD save_error = GetLastError();
DWORD save_error = RtlGetLastWin32Error();
if (!TRACE_ON(message) || exclude_msg(msg) ||
(exclude_dwp() && iFlag == SPY_RESULT_DEFWND))

View file

@ -852,7 +852,7 @@ BOOL is_window_enabled( HWND hwnd )
RtlSetLastWin32Error( NO_ERROR );
ret = get_window_long( hwnd, GWL_STYLE );
if (!ret && GetLastError() != NO_ERROR) return FALSE;
if (!ret && RtlGetLastWin32Error() != NO_ERROR) return FALSE;
return !(ret & WS_DISABLED);
}
@ -4879,7 +4879,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name,
if (!handle)
{
WARN( "error %d creating window\n", GetLastError() );
WARN( "error %d creating window\n", RtlGetLastWin32Error() );
return NULL;
}