This changes unixlib code to set last error in both TEBs on wow64. We could potentially try to sync them in wow64win thunks instead, but changing error setters seems more reliable.
-- v2: wow64win: Set last error in 32-bit TEB in wow64 thunks. winemac: Use RtlSetLastWin32Error. wineandroid: Use RtlSetLastWin32Error. winex11: Use RtlSetLastWin32Error. win32u: Use RtlSetLastWin32Error. include: Use RtlSetLastWin32Error in server.h. ntdll: Introduce RtlSetLastWin32Error for unixlibs that additionally sets 32-bit error on wow64.
From: Jacek Caban jacek@codeweavers.com
--- dlls/ntdll/unix/env.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 17450b5ab4c..105038a34cb 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -2390,3 +2390,19 @@ ULONG WINAPI RtlNtStatusToDosError( NTSTATUS status )
return map_status( status ); } + +/********************************************************************** + * RtlSetLastWin32Error (ntdll.so) + */ +void WINAPI RtlSetLastWin32Error( DWORD err ) +{ + TEB *teb = NtCurrentTeb(); +#ifdef _WIN64 + if (teb->WowTebOffset) + { + TEB32 *teb32 = (TEB32 *)((char *)teb + teb->WowTebOffset); + teb32->LastErrorValue = err; + } +#endif + teb->LastErrorValue = err; +}
From: Jacek Caban jacek@codeweavers.com
--- include/wine/server.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/wine/server.h b/include/wine/server.h index b05271b7522..228682dc914 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -57,7 +57,7 @@ extern NTSTATUS CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int acce static inline unsigned int wine_server_call_err( void *req_ptr ) { unsigned int res = wine_server_call( req_ptr ); - if (res) SetLastError( RtlNtStatusToDosError(res) ); + if (res) RtlSetLastWin32Error( RtlNtStatusToDosError(res) ); return res; }
From: Jacek Caban jacek@codeweavers.com
--- dlls/win32u/bitblt.c | 8 +-- dlls/win32u/bitmap.c | 12 ++--- dlls/win32u/class.c | 24 ++++----- dlls/win32u/clipboard.c | 14 ++--- dlls/win32u/cursoricon.c | 6 +-- dlls/win32u/dc.c | 6 +-- dlls/win32u/dce.c | 6 +-- dlls/win32u/defwnd.c | 4 +- dlls/win32u/dib.c | 10 ++-- dlls/win32u/driver.c | 4 +- dlls/win32u/font.c | 16 +++--- dlls/win32u/gdiobj.c | 2 +- dlls/win32u/hook.c | 16 +++--- dlls/win32u/imm.c | 4 +- dlls/win32u/input.c | 32 +++++------ dlls/win32u/menu.c | 38 ++++++------- dlls/win32u/message.c | 32 +++++------ dlls/win32u/painting.c | 2 +- dlls/win32u/path.c | 28 +++++----- dlls/win32u/pen.c | 4 +- dlls/win32u/rawinput.c | 44 +++++++-------- dlls/win32u/spy.c | 8 +-- dlls/win32u/sysparams.c | 16 +++--- dlls/win32u/win32u_private.h | 2 +- dlls/win32u/window.c | 100 +++++++++++++++++------------------ dlls/win32u/winstation.c | 18 +++---- 26 files changed, 228 insertions(+), 228 deletions(-)
diff --git a/dlls/win32u/bitblt.c b/dlls/win32u/bitblt.c index 302a3ef77eb..84e1c4eb059 100644 --- a/dlls/win32u/bitblt.c +++ b/dlls/win32u/bitblt.c @@ -360,7 +360,7 @@ BOOL CDECL nulldrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst,
if (bits.free) bits.free( &bits ); done: - if (err) SetLastError( err ); + if (err) RtlSetLastWin32Error( err ); return !err; }
@@ -997,14 +997,14 @@ BOOL WINAPI NtGdiAlphaBlend( HDC hdcDst, int xDst, int yDst, int widthDst, int h src.height > dcSrc->device_rect.bottom - dcSrc->attr->vis_rect.top - src.y))) { WARN( "Invalid src coords: (%d,%d), size %dx%d\n", src.x, src.y, src.width, src.height ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); ret = FALSE; } else if (dst.log_width < 0 || dst.log_height < 0) { WARN( "Invalid dst coords: (%d,%d), size %dx%d\n", dst.log_x, dst.log_y, dst.log_width, dst.log_height ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); ret = FALSE; } else if (dcSrc == dcDst && src.x + src.width > dst.x && src.x < dst.x + dst.width && @@ -1012,7 +1012,7 @@ BOOL WINAPI NtGdiAlphaBlend( HDC hdcDst, int xDst, int yDst, int widthDst, int h { WARN( "Overlapping coords: (%d,%d), %dx%d and (%d,%d), %dx%d\n", src.x, src.y, src.width, src.height, dst.x, dst.y, dst.width, dst.height ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); ret = FALSE; } else if (!ret) diff --git a/dlls/win32u/bitmap.c b/dlls/win32u/bitmap.c index 5d93ee69ee0..a02708dc8de 100644 --- a/dlls/win32u/bitmap.c +++ b/dlls/win32u/bitmap.c @@ -104,7 +104,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes,
if (width > 0x7ffffff || height > 0x7ffffff) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
@@ -119,7 +119,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, if (planes != 1) { FIXME("planes = %d\n", planes); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return NULL; }
@@ -133,7 +133,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, else { WARN("Invalid bmBitsPixel %d, returning ERROR_INVALID_PARAMETER\n", bpp); - SetLastError(ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); return NULL; }
@@ -142,14 +142,14 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, /* Check for overflow (dib_stride itself must be ok because of the constraint on bm.bmWidth above). */ if (dib_stride != size / height) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
/* Create the BITMAPOBJ */ if (!(bmpobj = calloc( 1, sizeof(*bmpobj) ))) { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return 0; }
@@ -163,7 +163,7 @@ HBITMAP WINAPI NtGdiCreateBitmap( INT width, INT height, UINT planes, if (!bmpobj->dib.dsBm.bmBits) { free( bmpobj ); - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return 0; }
diff --git a/dlls/win32u/class.c b/dlls/win32u/class.c index 19009fc5c0a..f8a7e67ddd1 100644 --- a/dlls/win32u/class.c +++ b/dlls/win32u/class.c @@ -321,11 +321,11 @@ static CLASS *get_class_ptr( HWND hwnd, BOOL write_access ) /* modifying classes in other processes is not allowed */ if (ptr == WND_DESKTOP || is_window( hwnd )) { - SetLastError( ERROR_ACCESS_DENIED ); + RtlSetLastWin32Error( ERROR_ACCESS_DENIED ); return NULL; } } - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return NULL; }
@@ -411,7 +411,7 @@ ATOM WINAPI NtUserRegisterClassExWOW( const WNDCLASSEXW *wc, UNICODE_STRING *nam if (wc->cbSize != sizeof(*wc) || wc->cbClsExtra < 0 || wc->cbWndExtra < 0 || (!is_builtin && wc->hInstance == user32_module)) /* we can't register a class for user32 */ { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } if (!(instance = wc->hInstance)) instance = NtCurrentTeb()->Peb->ImageBaseAddress; @@ -586,7 +586,7 @@ ULONG WINAPI NtUserGetAtomName( ATOM atom, UNICODE_STRING *name )
if (name->MaximumLength < sizeof(WCHAR)) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); return 0; }
@@ -608,7 +608,7 @@ INT WINAPI NtUserGetClassName( HWND hwnd, BOOL real, UNICODE_STRING *name )
if (name->MaximumLength <= sizeof(WCHAR)) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); return 0; }
@@ -823,10 +823,10 @@ static ULONG_PTR set_class_long( HWND hwnd, INT offset, LONG_PTR newval, UINT si } break; case GCL_CBCLSEXTRA: /* cannot change this one */ - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); break; default: - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); break; } release_class_ptr( class ); @@ -906,7 +906,7 @@ static ULONG_PTR get_class_long_size( HWND hwnd, INT offset, UINT size, BOOL ans case GCLP_WNDPROC: case GCLP_MENUNAME: FIXME( "offset %d not supported on other process window %p\n", offset, hwnd ); - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); break; case GCL_STYLE: retvalue = reply->old_style; @@ -936,7 +936,7 @@ static ULONG_PTR get_class_long_size( HWND hwnd, INT offset, UINT size, BOOL ans memcpy( &retvalue, &reply->old_extra_value, sizeof(ULONG_PTR) ); } - else SetLastError( ERROR_INVALID_INDEX ); + else RtlSetLastWin32Error( ERROR_INVALID_INDEX ); break; } } @@ -959,7 +959,7 @@ static ULONG_PTR get_class_long_size( HWND hwnd, INT offset, UINT size, BOOL ans memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(ULONG_PTR) ); } else - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); release_class_ptr( class ); return retvalue; } @@ -1000,7 +1000,7 @@ static ULONG_PTR get_class_long_size( HWND hwnd, INT offset, UINT size, BOOL ans retvalue = class->atomName; break; default: - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); break; } release_class_ptr( class ); @@ -1044,7 +1044,7 @@ WORD get_class_word( HWND hwnd, INT offset ) if (offset <= class->cbClsExtra - sizeof(WORD)) memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) ); else - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); release_class_ptr( class ); return retvalue; } diff --git a/dlls/win32u/clipboard.c b/dlls/win32u/clipboard.c index 0ddbc62f444..d91d4339493 100644 --- a/dlls/win32u/clipboard.c +++ b/dlls/win32u/clipboard.c @@ -58,7 +58,7 @@ static const char *debugstr_format( UINT id ) WCHAR buffer[256]; DWORD le = GetLastError(); BOOL r = NtUserGetClipboardFormatName( id, buffer, ARRAYSIZE(buffer) ); - SetLastError(le); + RtlSetLastWin32Error(le);
if (r) return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) ); @@ -304,7 +304,7 @@ BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *ou
if (!out_size) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return FALSE; }
@@ -319,7 +319,7 @@ BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *ou SERVER_END_REQ;
TRACE( "%p %u returning %u formats, ret %u\n", formats, size, *out_size, ret ); - if (!ret && !formats && *out_size) SetLastError( ERROR_NOACCESS ); + if (!ret && !formats && *out_size) RtlSetLastWin32Error( ERROR_NOACCESS ); return ret; }
@@ -354,7 +354,7 @@ INT WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen if (format < MAXINTATOM || format > 0xffff) return 0; if (maxlen <= 0) { - SetLastError( ERROR_MORE_DATA ); + RtlSetLastWin32Error( ERROR_MORE_DATA ); return 0; } if (!set_ntstatus( NtQueryInformationAtom( format, AtomBasicInformation, @@ -449,7 +449,7 @@ BOOL WINAPI NtUserChangeClipboardChain( HWND hwnd, HWND next ) if (status == STATUS_PENDING) return !send_message( viewer, WM_CHANGECBCHAIN, (WPARAM)hwnd, (LPARAM)next );
- if (status) SetLastError( RtlNtStatusToDosError( status )); + if (status) RtlSetLastWin32Error( RtlNtStatusToDosError( status )); return !status; }
@@ -498,7 +498,7 @@ UINT enum_clipboard_formats( UINT format ) if (!wine_server_call_err( req )) { ret = reply->format; - SetLastError( ERROR_SUCCESS ); + RtlSetLastWin32Error( ERROR_SUCCESS ); } } SERVER_END_REQ; @@ -721,7 +721,7 @@ HANDLE WINAPI NtUserGetClipboardData( UINT format, struct get_clipboard_params * if (status == STATUS_OBJECT_NAME_NOT_FOUND) return 0; /* no such format */ if (status) { - SetLastError( RtlNtStatusToDosError( status )); + RtlSetLastWin32Error( RtlNtStatusToDosError( status )); TRACE( "%s error %08x\n", debugstr_format( format ), status ); return 0; } diff --git a/dlls/win32u/cursoricon.c b/dlls/win32u/cursoricon.c index eaafd07e190..31fc97bc7cd 100644 --- a/dlls/win32u/cursoricon.c +++ b/dlls/win32u/cursoricon.c @@ -334,7 +334,7 @@ BOOL WINAPI NtUserSetCursorIconData( HCURSOR cursor, UNICODE_STRING *module, UNI { /* already initialized */ release_user_handle_ptr( obj ); - SetLastError( ERROR_INVALID_CURSOR_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_CURSOR_HANDLE ); return FALSE; }
@@ -454,7 +454,7 @@ BOOL WINAPI NtUserGetIconSize( HICON handle, UINT step, LONG *width, LONG *heigh
if (!(obj = get_icon_frame_ptr( handle, step ))) { - SetLastError( ERROR_INVALID_CURSOR_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_CURSOR_HANDLE ); return FALSE; }
@@ -559,7 +559,7 @@ BOOL WINAPI NtUserGetIconInfo( HICON icon, ICONINFO *info, UNICODE_STRING *modul
if (!(obj = get_icon_ptr( icon ))) { - SetLastError( ERROR_INVALID_CURSOR_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_CURSOR_HANDLE ); return FALSE; } if (!(frame_obj = get_icon_frame_ptr( icon, 0 ))) diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index a8c651dd28f..60229bb2f89 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -79,7 +79,7 @@ static inline DC *get_dc_obj( HDC hdc ) return dc; default: GDI_ReleaseObj( hdc ); - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return NULL; } } @@ -1246,7 +1246,7 @@ BOOL WINAPI NtGdiGetDeviceGammaRamp( HDC hdc, void *ptr ) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetDeviceGammaRamp ); ret = physdev->funcs->pGetDeviceGammaRamp( physdev, ptr ); } - else SetLastError( ERROR_INVALID_PARAMETER ); + else RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); release_dc_ptr( dc ); } return ret; @@ -1348,7 +1348,7 @@ BOOL WINAPI NtGdiSetDeviceGammaRamp( HDC hdc, void *ptr ) if (check_gamma_ramps(ptr)) ret = physdev->funcs->pSetDeviceGammaRamp( physdev, ptr ); } - else SetLastError( ERROR_INVALID_PARAMETER ); + else RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); release_dc_ptr( dc ); } return ret; diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 9041b5bbaaf..0c25fdcf61b 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1060,7 +1060,7 @@ static HRGN get_update_region( HWND hwnd, UINT *flags, HWND *child ) { if (!(data = malloc( sizeof(*data) + size - 1 ))) { - SetLastError( ERROR_OUTOFMEMORY ); + RtlSetLastWin32Error( ERROR_OUTOFMEMORY ); return 0; }
@@ -1087,7 +1087,7 @@ static HRGN get_update_region( HWND hwnd, UINT *flags, HWND *child ) free( data ); } while (status == STATUS_BUFFER_OVERFLOW);
- if (status) SetLastError( RtlNtStatusToDosError(status) ); + if (status) RtlSetLastWin32Error( RtlNtStatusToDosError(status) ); return hrgn; }
@@ -1582,7 +1582,7 @@ BOOL WINAPI NtUserInvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase ) { if (!hwnd) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; }
diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index a409ad4a1e0..3d3a40ac9e4 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2973,14 +2973,14 @@ BOOL WINAPI NtUserGetTitleBarInfo( HWND hwnd, TITLEBARINFO *info )
if (!info) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return FALSE; }
if (info->cbSize != sizeof(TITLEBARINFO)) { TRACE( "Invalid TITLEBARINFO size: %d\n", info->cbSize ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
diff --git a/dlls/win32u/dib.c b/dlls/win32u/dib.c index e7a5a50e201..b2d7cacf137 100644 --- a/dlls/win32u/dib.c +++ b/dlls/win32u/dib.c @@ -625,7 +625,7 @@ INT WINAPI NtGdiStretchDIBitsInternal( HDC hdc, INT xDst, INT yDst, INT widthDst if (!bits) return 0; if (!bitmapinfo_from_user_bitmapinfo( info, bmi, coloruse, TRUE )) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
@@ -677,7 +677,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
if (!bitmapinfo_from_user_bitmapinfo( src_info, info, coloruse, TRUE ) || coloruse > DIB_PAL_COLORS) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } if (src_info->bmiHeader.biCompression == BI_BITFIELDS) @@ -685,7 +685,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan, DWORD *masks = (DWORD *)src_info->bmiColors; if (!masks[0] || !masks[1] || !masks[2]) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } } @@ -900,7 +900,7 @@ INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT xDest, INT yDest, DWORD if (!bits) return 0; if (!bitmapinfo_from_user_bitmapinfo( info, bmi, coloruse, TRUE )) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
@@ -1227,7 +1227,7 @@ INT WINAPI NtGdiGetDIBitsInternal( HDC hdc, HBITMAP hbitmap, UINT startscan, UIN
if (!(dc = get_dc_ptr( hdc ))) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } update_dc( dc ); diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index f70d4a7b455..36d08afff8a 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -312,7 +312,7 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
static BOOL CDECL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp ) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -516,7 +516,7 @@ static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
static BOOL CDECL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp ) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 5bf59903308..5ea89c9220e 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -1914,7 +1914,7 @@ static struct gdi_font *get_font_from_handle( DWORD handle ) struct font_handle_entry *entry = handle_entry( handle );
if (entry) return entry->font; - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return NULL; }
@@ -4524,7 +4524,7 @@ HFONT WINAPI NtGdiHfontCreate( const void *logfont, ULONG size, ULONG type, } else if (size != sizeof(LOGFONTW)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } else plf = logfont; @@ -5870,7 +5870,7 @@ BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTME
done: if (font) free_gdi_font( font ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -5887,7 +5887,7 @@ DWORD WINAPI NtGdiGetKerningPairs( HDC hdc, DWORD count, KERNINGPAIR *kern_pair
if (!count && kern_pair) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
@@ -5912,7 +5912,7 @@ DWORD WINAPI NtGdiGetKerningPairs( HDC hdc, DWORD count, KERNINGPAIR *kern_pair * * NOTES * - * Calls SetLastError() + * Calls RtlSetLastWin32Error() * */ DWORD WINAPI NtGdiGetFontData( HDC hdc, DWORD table, DWORD offset, void *buffer, DWORD length ) @@ -6382,7 +6382,7 @@ HANDLE WINAPI NtGdiAddFontMemResourceEx( void *ptr, DWORD size, void *dv, ULONG
if (!ptr || !size || !count) { - SetLastError(ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); return NULL; } if (!font_funcs) return NULL; @@ -6537,7 +6537,7 @@ BOOL WINAPI NtGdiGetFontFileData( DWORD instance_id, DWORD file_index, UINT64 *o if (size != GDI_ERROR && size >= buff_size && *offset <= size - buff_size) ret = font_funcs->get_font_data( font, tag, *offset, buff, buff_size ) != GDI_ERROR; else - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); } pthread_mutex_unlock( &font_lock ); return ret; @@ -6565,7 +6565,7 @@ BOOL WINAPI NtGdiGetFontFileInfo( DWORD instance_id, DWORD file_index, struct fo lstrcpyW( info->path, font->file ); ret = TRUE; } - else SetLastError( ERROR_INSUFFICIENT_BUFFER ); + else RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); }
pthread_mutex_unlock( &font_lock ); diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index e42d076bc5b..881c76ee165 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -943,7 +943,7 @@ INT WINAPI NtGdiExtGetObjectW( HGDIOBJ handle, INT count, void *buffer ) if (funcs && funcs->pGetObjectW) { if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */ - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); else result = funcs->pGetObjectW( handle, count, buffer ); } diff --git a/dlls/win32u/hook.c b/dlls/win32u/hook.c index dcf2bb9f865..0f4ec338b77 100644 --- a/dlls/win32u/hook.c +++ b/dlls/win32u/hook.c @@ -78,7 +78,7 @@ HHOOK WINAPI NtUserSetWindowsHookEx( HINSTANCE inst, UNICODE_STRING *module, DWO
if (!proc) { - SetLastError( ERROR_INVALID_FILTER_PROC ); + RtlSetLastWin32Error( ERROR_INVALID_FILTER_PROC ); return 0; }
@@ -91,7 +91,7 @@ HHOOK WINAPI NtUserSetWindowsHookEx( HINSTANCE inst, UNICODE_STRING *module, DWO id == WH_SYSMSGFILTER) { /* these can only be global */ - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } } @@ -100,7 +100,7 @@ HHOOK WINAPI NtUserSetWindowsHookEx( HINSTANCE inst, UNICODE_STRING *module, DWO if (id == WH_KEYBOARD_LL || id == WH_MOUSE_LL) inst = 0; else if (!inst) { - SetLastError( ERROR_HOOK_NEEDS_HMOD ); + RtlSetLastWin32Error( ERROR_HOOK_NEEDS_HMOD ); return 0; } } @@ -148,7 +148,7 @@ BOOL WINAPI NtUserUnhookWindowsHookEx( HHOOK handle ) if (!status) get_user_thread_info()->active_hooks = reply->active_hooks; } SERVER_END_REQ; - if (status == STATUS_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE ); + if (status == STATUS_INVALID_HANDLE) RtlSetLastWin32Error( ERROR_INVALID_HOOK_HANDLE ); return !status; }
@@ -168,7 +168,7 @@ BOOL unhook_windows_hook( INT id, HOOKPROC proc ) if (!status) get_user_thread_info()->active_hooks = reply->active_hooks; } SERVER_END_REQ; - if (status == STATUS_INVALID_HANDLE) SetLastError( ERROR_INVALID_HOOK_HANDLE ); + if (status == STATUS_INVALID_HANDLE) RtlSetLastWin32Error( ERROR_INVALID_HOOK_HANDLE ); return !status; }
@@ -395,13 +395,13 @@ HWINEVENTHOOK WINAPI NtUserSetWinEventHook( DWORD event_min, DWORD event_max, HM
if ((flags & WINEVENT_INCONTEXT) && !inst) { - SetLastError(ERROR_HOOK_NEEDS_HMOD); + RtlSetLastWin32Error(ERROR_HOOK_NEEDS_HMOD); return 0; }
if (event_min > event_max) { - SetLastError(ERROR_INVALID_HOOK_FILTER); + RtlSetLastWin32Error(ERROR_INVALID_HOOK_FILTER); return 0; }
@@ -471,7 +471,7 @@ void WINAPI NtUserNotifyWinEvent( DWORD event, HWND hwnd, LONG object_id, LONG c
if (!hwnd) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return; }
diff --git a/dlls/win32u/imm.c b/dlls/win32u/imm.c index 1b78a12a803..9e22385731f 100644 --- a/dlls/win32u/imm.c +++ b/dlls/win32u/imm.c @@ -58,7 +58,7 @@ static struct imc *get_imc_ptr( HIMC handle ) struct imc *imc = get_user_handle_ptr( handle, NTUSER_OBJ_IMC ); if (imc && imc != OBJ_OTHER_PROCESS) return imc; WARN( "invalid handle %p\n", handle ); - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return NULL; }
@@ -224,7 +224,7 @@ HIMC get_window_input_context( HWND hwnd )
if (!(win = get_win_ptr( hwnd )) || win == WND_OTHER_PROCESS || win == WND_DESKTOP) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; }
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index c41a41c605a..19233af4418 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -134,19 +134,19 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size )
if (size != sizeof(INPUT)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
if (!count) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
if (!inputs) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return 0; }
@@ -163,13 +163,13 @@ UINT WINAPI NtUserSendInput( UINT count, INPUT *inputs, int size ) status = send_hardware_message( 0, &input, NULL, SEND_HWMSG_INJECTED ); break; case INPUT_HARDWARE: - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); return 0; }
if (status) { - SetLastError( RtlNtStatusToDosError(status) ); + RtlSetLastWin32Error( RtlNtStatusToDosError(status) ); break; } } @@ -340,7 +340,7 @@ DWORD WINAPI NtUserGetQueueStatus( UINT flags )
if (flags & ~(QS_ALLINPUT | QS_ALLPOSTMESSAGE | QS_SMRESULT)) { - SetLastError( ERROR_INVALID_FLAGS ); + RtlSetLastWin32Error( ERROR_INVALID_FLAGS ); return 0; }
@@ -908,7 +908,7 @@ HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags )
if (layout == (HKL)HKL_NEXT || layout == (HKL)HKL_PREV) { - SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); FIXME_(keyboard)( "HKL_NEXT and HKL_PREV not supported\n" ); return 0; } @@ -1002,7 +1002,7 @@ BOOL WINAPI NtUserGetKeyboardLayoutName( WCHAR *name )
if (!name) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return FALSE; }
@@ -1127,20 +1127,20 @@ int WINAPI NtUserGetMouseMovePointsEx( UINT size, MOUSEMOVEPOINT *ptin, MOUSEMOV
if ((size != sizeof(MOUSEMOVEPOINT)) || (count < 0) || (count > ARRAY_SIZE( positions ))) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return -1; }
if (!ptin || (!ptout && count)) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return -1; }
if (resolution != GMMP_USE_DISPLAY_POINTS) { FIXME( "only GMMP_USE_DISPLAY_POINTS is supported for now\n" ); - SetLastError( ERROR_POINT_NOT_FOUND ); + RtlSetLastWin32Error( ERROR_POINT_NOT_FOUND ); return -1; }
@@ -1160,7 +1160,7 @@ int WINAPI NtUserGetMouseMovePointsEx( UINT size, MOUSEMOVEPOINT *ptin, MOUSEMOV
if (i == ARRAY_SIZE( positions )) { - SetLastError( ERROR_POINT_NOT_FOUND ); + RtlSetLastWin32Error( ERROR_POINT_NOT_FOUND ); return -1; }
@@ -1320,7 +1320,7 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info ) if (info->cbSize != sizeof(TRACKMOUSEEVENT)) { WARN( "wrong size %u\n", info->cbSize ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -1333,7 +1333,7 @@ BOOL WINAPI NtUserTrackMouseEvent( TRACKMOUSEEVENT *info )
if (!is_window( info->hwndTrack )) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; }
@@ -1713,7 +1713,7 @@ HWND WINAPI NtUserSetActiveWindow( HWND hwnd ) hwnd = get_full_window_handle( hwnd ); if (!is_window( hwnd )) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; }
@@ -1742,7 +1742,7 @@ HWND WINAPI NtUserSetFocus( HWND hwnd ) hwnd = get_full_window_handle( hwnd ); if (!is_window( hwnd )) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } if (hwnd == previous) return previous; /* nothing to do */ diff --git a/dlls/win32u/menu.c b/dlls/win32u/menu.c index 53dcf3ced8e..ff11fbb804a 100644 --- a/dlls/win32u/menu.c +++ b/dlls/win32u/menu.c @@ -200,7 +200,7 @@ HACCEL WINAPI NtUserCreateAcceleratorTable( ACCEL *table, INT count )
if (count < 1) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } accel = malloc( FIELD_OFFSET( struct accelerator, table[count] )); @@ -344,7 +344,7 @@ BOOL is_menu( HMENU handle ) is_menu = menu != NULL; release_menu_ptr( menu );
- if (!is_menu) SetLastError( ERROR_INVALID_MENU_HANDLE ); + if (!is_menu) RtlSetLastWin32Error( ERROR_INVALID_MENU_HANDLE ); return is_menu; }
@@ -861,13 +861,13 @@ BOOL WINAPI NtUserThunkedMenuInfo( HMENU menu, const MENUINFO *info )
if (!info) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return FALSE; }
if (!set_menu_info( menu, info )) { - SetLastError( ERROR_INVALID_MENU_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_MENU_HANDLE ); return FALSE; }
@@ -889,7 +889,7 @@ BOOL get_menu_info( HMENU handle, MENUINFO *info )
if (!info || info->cbSize != sizeof(MENUINFO) || !(menu = grab_menu_ptr( handle ))) { - SetLastError( ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER); return FALSE; }
@@ -970,7 +970,7 @@ static BOOL set_menu_item_info( struct menu_item *menu, const MENUITEMINFOW *inf struct menu *submenu = grab_menu_ptr( menu->hSubMenu ); if (!submenu) { - SetLastError( ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER); return FALSE; } if (menu_depth( submenu, 0 ) > MAXMENUDEPTH) @@ -1045,7 +1045,7 @@ static BOOL get_menu_item_info( HMENU handle, UINT id, UINT flags, MENUITEMINFOW
if (!info || info->cbSize != sizeof(*info)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -1054,7 +1054,7 @@ static BOOL get_menu_item_info( HMENU handle, UINT id, UINT flags, MENUITEMINFOW TRACE( "%s\n", debugstr_menuitem( item )); if (!menu) { - SetLastError( ERROR_MENU_ITEM_NOT_FOUND); + RtlSetLastWin32Error( ERROR_MENU_ITEM_NOT_FOUND); return FALSE; }
@@ -1065,7 +1065,7 @@ static BOOL get_menu_item_info( HMENU handle, UINT id, UINT flags, MENUITEMINFOW release_menu_ptr( menu ); WARN( "invalid combination of fMask bits used\n" ); /* this does not happen on Win9x/ME */ - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -1290,7 +1290,7 @@ UINT WINAPI NtUserThunkedMenuItemInfo( HMENU handle, UINT pos, UINT flags, UINT case NtUserInsertMenuItem: if (!info || info->cbSize != sizeof(*info)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -1309,7 +1309,7 @@ UINT WINAPI NtUserThunkedMenuItemInfo( HMENU handle, UINT pos, UINT flags, UINT case NtUserSetMenuItemInfo: if (!info || info->cbSize != sizeof(*info)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -3315,7 +3315,7 @@ static BOOL init_popup( HWND owner, HMENU hmenu, UINT flags ) /* store the owner for DrawItem */ if (!is_window( owner )) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; } menu->hwndOwner = owner; @@ -4087,7 +4087,7 @@ static BOOL track_menu( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, const if (!(menu = unsafe_menu_ptr( hmenu ))) { WARN( "Invalid menu handle %p\n", hmenu ); - SetLastError( ERROR_INVALID_MENU_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_MENU_HANDLE ); return FALSE; }
@@ -4338,7 +4338,7 @@ static BOOL track_menu( HMENU hmenu, UINT flags, int x, int y, HWND hwnd, const } }
- SetLastError( ERROR_SUCCESS ); + RtlSetLastWin32Error( ERROR_SUCCESS ); /* The return value is only used by NtUserTrackPopupMenuEx */ if (!(flags & TPM_RETURNCMD)) return TRUE; if (executed_menu_id == -1) executed_menu_id = 0; @@ -4486,13 +4486,13 @@ BOOL WINAPI NtUserTrackPopupMenuEx( HMENU handle, UINT flags, INT x, INT y, HWND
if (!(menu = unsafe_menu_ptr( handle ))) { - SetLastError( ERROR_INVALID_MENU_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_MENU_HANDLE ); return FALSE; }
if (is_window(menu->hWnd)) { - SetLastError( ERROR_POPUP_ALREADY_ACTIVE ); + RtlSetLastWin32Error( ERROR_POPUP_ALREADY_ACTIVE ); return FALSE; }
@@ -4522,7 +4522,7 @@ BOOL WINAPI NtUserTrackPopupMenuEx( HMENU handle, UINT flags, INT x, INT y, HWND send_message( hwnd, WM_UNINITMENUPOPUP, (WPARAM)handle, MAKELPARAM( 0, IS_SYSTEM_MENU( menu ))); } - SetLastError( 0 ); + RtlSetLastWin32Error( 0 ); }
return ret; @@ -4574,7 +4574,7 @@ BOOL WINAPI NtUserGetMenuBarInfo( HWND hwnd, LONG id, LONG item, MENUBARINFO *in if (class_atom != POPUPMENU_CLASS_ATOM) { WARN("called on invalid window: %d\n", class_atom); - SetLastError(ERROR_INVALID_MENU_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_MENU_HANDLE); return FALSE; }
@@ -4595,7 +4595,7 @@ BOOL WINAPI NtUserGetMenuBarInfo( HWND hwnd, LONG id, LONG item, MENUBARINFO *in
if (info->cbSize != sizeof(MENUBARINFO)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index 33170147aa9..746238bfc5c 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -1147,7 +1147,7 @@ BOOL WINAPI NtUserGetGUIThreadInfo( DWORD id, GUITHREADINFO *info )
if (info->cbSize != sizeof(*info)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -1692,7 +1692,7 @@ static int peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags, } if (res != STATUS_BUFFER_OVERFLOW) { - SetLastError( RtlNtStatusToDosError(res) ); + RtlSetLastWin32Error( RtlNtStatusToDosError(res) ); return -1; } if (!(buffer = malloc( buffer_size ))) return -1; @@ -1959,7 +1959,7 @@ static DWORD wait_message( DWORD count, const HANDLE *handles, DWORD timeout, DW mask, flags ); if (HIWORD(ret)) /* is it an error code? */ { - SetLastError( RtlNtStatusToDosError(ret) ); + RtlSetLastWin32Error( RtlNtStatusToDosError(ret) ); ret = WAIT_FAILED; } if (ret == WAIT_TIMEOUT && !count && !timeout) NtYieldExecution(); @@ -2029,7 +2029,7 @@ DWORD WINAPI NtUserMsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handl
if (count > MAXIMUM_WAIT_OBJECTS-1) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return WAIT_FAILED; }
@@ -2123,7 +2123,7 @@ BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, U * (back to the program) inside the message handling itself. */ if (!msg_out) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return FALSE; } *msg_out = msg; @@ -2242,9 +2242,9 @@ static BOOL put_message_in_queue( const struct send_message_info *info, size_t * { if (res == STATUS_INVALID_PARAMETER) /* FIXME: find a STATUS_ value for this one */ - SetLastError( ERROR_INVALID_THREAD_ID ); + RtlSetLastWin32Error( ERROR_INVALID_THREAD_ID ); else - SetLastError( RtlNtStatusToDosError(res) ); + RtlSetLastWin32Error( RtlNtStatusToDosError(res) ); } } SERVER_END_REQ; @@ -2326,7 +2326,7 @@ static LRESULT retrieve_reply( const struct send_message_info *info, info->lparam, *result, status );
/* MSDN states that last error is 0 on timeout, but at least NT4 returns ERROR_TIMEOUT */ - if (status) SetLastError( RtlNtStatusToDosError(status) ); + if (status) RtlSetLastWin32Error( RtlNtStatusToDosError(status) ); return !status; }
@@ -2547,8 +2547,8 @@ LRESULT WINAPI NtUserDispatchMessage( const MSG *msg ) if (init_window_call_params( ¶ms, msg->hwnd, msg->message, msg->wParam, msg->lParam, &retval, FALSE, WMCHAR_MAP_DISPATCHMESSAGE )) dispatch_win_proc_params( ¶ms, sizeof(params) ); - else if (!is_window( msg->hwnd )) SetLastError( ERROR_INVALID_WINDOW_HANDLE ); - else SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + else if (!is_window( msg->hwnd )) RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); + else RtlSetLastWin32Error( ERROR_MESSAGE_SYNC_ONLY );
spy_exit_message( SPY_RESULT_OK, msg->hwnd, msg->message, retval, msg->wParam, msg->lParam );
@@ -2821,7 +2821,7 @@ static BOOL send_notify_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpar
if (is_pointer_message( msg, wparam )) { - SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + RtlSetLastWin32Error( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; }
@@ -2845,7 +2845,7 @@ static BOOL send_message_callback( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lp
if (is_pointer_message( msg, wparam )) { - SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + RtlSetLastWin32Error( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; }
@@ -2872,7 +2872,7 @@ BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam
if (is_pointer_message( msg, wparam )) { - SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + RtlSetLastWin32Error( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; }
@@ -2907,7 +2907,7 @@ BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPAR
if (is_pointer_message( msg, wparam )) { - SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + RtlSetLastWin32Error( ERROR_MESSAGE_SYNC_ONLY ); return FALSE; } if (is_exiting_thread( thread )) return TRUE; @@ -2970,8 +2970,8 @@ LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpa if (init_window_call_params( result_info, hwnd, msg, wparam, lparam, NULL, ansi, WMCHAR_MAP_DISPATCHMESSAGE )) return TRUE; - if (!is_window( hwnd )) SetLastError( ERROR_INVALID_WINDOW_HANDLE ); - else SetLastError( ERROR_MESSAGE_SYNC_ONLY ); + if (!is_window( hwnd )) RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); + else RtlSetLastWin32Error( ERROR_MESSAGE_SYNC_ONLY ); return FALSE;
case NtUserSpyEnter: diff --git a/dlls/win32u/painting.c b/dlls/win32u/painting.c index 9b973eeb757..e274561d546 100644 --- a/dlls/win32u/painting.c +++ b/dlls/win32u/painting.c @@ -891,7 +891,7 @@ BOOL WINAPI NtGdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
if (!vert_array || !nvert || !grad_array || !ngrad || mode > GRADIENT_FILL_TRIANGLE) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; } for (i = 0; i < ngrad * (mode == GRADIENT_FILL_TRIANGLE ? 3 : 2); i++) diff --git a/dlls/win32u/path.c b/dlls/win32u/path.c index 0032ee1a5ab..e4b6f82cf95 100644 --- a/dlls/win32u/path.c +++ b/dlls/win32u/path.c @@ -116,7 +116,7 @@ static struct gdi_path *alloc_gdi_path( int count )
if (!path) { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return NULL; } count = max( NUM_ENTRIES_INITIAL, count ); @@ -126,7 +126,7 @@ static struct gdi_path *alloc_gdi_path( int count ) if (!path->points) { free( path ); - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return NULL; } path->flags = (BYTE *)(path->points + count); @@ -542,7 +542,7 @@ struct gdi_path *get_gdi_flat_path( DC *dc, HRGN *rgn ) dc->path = NULL; if (ret && rgn) *rgn = path_to_region( ret, dc->attr->poly_fill_mode ); } - else SetLastError( ERROR_CAN_NOT_COMPLETE ); + else RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE );
return ret; } @@ -638,7 +638,7 @@ INT WINAPI NtGdiGetPath( HDC hdc, POINT *points, BYTE *types, INT size )
if (!dc->path) { - SetLastError( ERROR_CAN_NOT_COMPLETE ); + RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE ); } else if (size == 0) { @@ -646,7 +646,7 @@ INT WINAPI NtGdiGetPath( HDC hdc, POINT *points, BYTE *types, INT size ) } else if (size < dc->path->count) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); } else { @@ -658,7 +658,7 @@ INT WINAPI NtGdiGetPath( HDC hdc, POINT *points, BYTE *types, INT size ) ret = dc->path->count; else /* FIXME: Is this the correct value? */ - SetLastError( ERROR_CAN_NOT_COMPLETE ); + RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE ); }
release_dc_ptr( dc ); @@ -688,7 +688,7 @@ HRGN WINAPI NtGdiPathToRegion( HDC hdc ) free_gdi_path( path ); } } - else SetLastError( ERROR_CAN_NOT_COMPLETE ); + else RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE );
release_dc_ptr( dc ); return ret; @@ -1598,7 +1598,7 @@ BOOL WINAPI NtGdiFlattenPath( HDC hdc )
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
- if (!dc->path) SetLastError( ERROR_CAN_NOT_COMPLETE ); + if (!dc->path) RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE ); else if ((path = PATH_FlattenPath( dc->path ))) { free_gdi_path( dc->path ); @@ -1623,7 +1623,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
size = NtGdiExtGetObjectW( dc->hPen, 0, NULL ); if (!size) { - SetLastError(ERROR_CAN_NOT_COMPLETE); + RtlSetLastWin32Error(ERROR_CAN_NOT_COMPLETE); return NULL; }
@@ -1640,7 +1640,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc) penStyle = elp->elpPenStyle; break; default: - SetLastError(ERROR_CAN_NOT_COMPLETE); + RtlSetLastWin32Error(ERROR_CAN_NOT_COMPLETE); free( elp ); return NULL; } @@ -1654,7 +1654,7 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
/* The function cannot apply to cosmetic pens */ if(obj_type == OBJ_EXTPEN && penType == PS_COSMETIC) { - SetLastError(ERROR_CAN_NOT_COMPLETE); + RtlSetLastWin32Error(ERROR_CAN_NOT_COMPLETE); return NULL; }
@@ -1948,7 +1948,7 @@ BOOL WINAPI NtGdiWidenPath( HDC hdc )
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
- if (!dc->path) SetLastError( ERROR_CAN_NOT_COMPLETE ); + if (!dc->path) RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE ); else if ((path = PATH_WidenPath( dc ))) { free_gdi_path( dc->path ); @@ -1988,7 +1988,7 @@ BOOL CDECL nulldrv_BeginPath( PHYSDEV dev )
BOOL CDECL nulldrv_EndPath( PHYSDEV dev ) { - SetLastError( ERROR_CAN_NOT_COMPLETE ); + RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE ); return FALSE; }
@@ -2003,7 +2003,7 @@ BOOL CDECL nulldrv_AbortPath( PHYSDEV dev )
BOOL CDECL nulldrv_CloseFigure( PHYSDEV dev ) { - SetLastError( ERROR_CAN_NOT_COMPLETE ); + RtlSetLastWin32Error( ERROR_CAN_NOT_COMPLETE ); return FALSE; }
diff --git a/dlls/win32u/pen.c b/dlls/win32u/pen.c index af371108c46..551c4438f3c 100644 --- a/dlls/win32u/pen.c +++ b/dlls/win32u/pen.c @@ -156,7 +156,7 @@ HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULON break;
default: - SetLastError(ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); return 0; }
@@ -196,7 +196,7 @@ HPEN WINAPI NtGdiExtCreatePen( DWORD style, DWORD width, ULONG brush_style, ULON
invalid: free( penPtr ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
diff --git a/dlls/win32u/rawinput.c b/dlls/win32u/rawinput.c index cf150b60a8c..8795ebbba00 100644 --- a/dlls/win32u/rawinput.c +++ b/dlls/win32u/rawinput.c @@ -485,13 +485,13 @@ UINT WINAPI NtUserGetRawInputDeviceList( RAWINPUTDEVICELIST *device_list, UINT *
if (size != sizeof(*device_list)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ~0u; }
if (!device_count) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return ~0u; }
@@ -521,7 +521,7 @@ UINT WINAPI NtUserGetRawInputDeviceList( RAWINPUTDEVICELIST *device_list, UINT *
if (*device_count < count) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); *device_count = count; return ~0u; } @@ -543,13 +543,13 @@ UINT WINAPI NtUserGetRawInputDeviceInfo( HANDLE handle, UINT command, void *data
if (!data_size) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return ~0u; } if (command != RIDI_DEVICENAME && command != RIDI_DEVICEINFO && command != RIDI_PREPARSEDDATA) { FIXME( "Command %#x not implemented!\n", command ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -558,7 +558,7 @@ UINT WINAPI NtUserGetRawInputDeviceInfo( HANDLE handle, UINT command, void *data if (!(device = find_device_from_handle( handle ))) { pthread_mutex_unlock( &rawinput_mutex ); - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return ~0u; }
@@ -597,7 +597,7 @@ UINT WINAPI NtUserGetRawInputDeviceInfo( HANDLE handle, UINT command, void *data
if (data_len < len) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); return ~0u; }
@@ -624,13 +624,13 @@ UINT WINAPI NtUserGetRawInputBuffer( RAWINPUT *data, UINT *data_size, UINT heade if (header_size != sizeof(RAWINPUTHEADER)) { WARN( "Invalid structure size %u.\n", header_size ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ~0u; }
if (!data_size) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -690,7 +690,7 @@ UINT WINAPI NtUserGetRawInputBuffer( RAWINPUT *data, UINT *data_size, UINT heade
if (next_size && *data_size <= next_size) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); *data_size = next_size; count = ~0u; } @@ -713,20 +713,20 @@ UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data,
if (!(thread_data = get_rawinput_thread_data())) { - SetLastError( ERROR_OUTOFMEMORY ); + RtlSetLastWin32Error( ERROR_OUTOFMEMORY ); return ~0u; }
if (!rawinput || thread_data->hw_id != (UINT_PTR)rawinput) { - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return ~0u; }
if (header_size != sizeof(RAWINPUTHEADER)) { WARN( "Invalid structure size %u.\n", header_size ); - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -741,7 +741,7 @@ UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data, break;
default: - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -753,7 +753,7 @@ UINT WINAPI NtUserGetRawInputData( HRAWINPUT rawinput, UINT command, void *data,
if (*data_size < size) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); return ~0u; } memcpy( data, thread_data->buffer, size ); @@ -830,7 +830,7 @@ BOOL WINAPI NtUserRegisterRawInputDevices( const RAWINPUTDEVICE *devices, UINT d
if (device_size != sizeof(RAWINPUTDEVICE)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -841,13 +841,13 @@ BOOL WINAPI NtUserRegisterRawInputDevices( const RAWINPUTDEVICE *devices, UINT d
if ((devices[i].dwFlags & RIDEV_INPUTSINK) && !devices[i].hwndTarget) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
if ((devices[i].dwFlags & RIDEV_REMOVE) && devices[i].hwndTarget) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -867,7 +867,7 @@ BOOL WINAPI NtUserRegisterRawInputDevices( const RAWINPUTDEVICE *devices, UINT d if (!(new_registered_devices = realloc( registered_devices, size ))) { pthread_mutex_unlock( &rawinput_mutex ); - SetLastError( ERROR_OUTOFMEMORY ); + RtlSetLastWin32Error( ERROR_OUTOFMEMORY ); return FALSE; }
@@ -878,7 +878,7 @@ BOOL WINAPI NtUserRegisterRawInputDevices( const RAWINPUTDEVICE *devices, UINT d else if (!(server_devices = malloc( device_count * sizeof(*server_devices) ))) { pthread_mutex_unlock( &rawinput_mutex ); - SetLastError( ERROR_OUTOFMEMORY ); + RtlSetLastWin32Error( ERROR_OUTOFMEMORY ); return FALSE; }
@@ -915,7 +915,7 @@ UINT WINAPI NtUserGetRegisteredRawInputDevices( RAWINPUTDEVICE *devices, UINT *d
if (device_size != sizeof(RAWINPUTDEVICE) || !device_count || (devices && !*device_count)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -932,7 +932,7 @@ UINT WINAPI NtUserGetRegisteredRawInputDevices( RAWINPUTDEVICE *devices, UINT *d
if (capacity < size) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); return ~0u; }
diff --git a/dlls/win32u/spy.c b/dlls/win32u/spy.c index ce05dfa1bff..05d740eb883 100644 --- a/dlls/win32u/spy.c +++ b/dlls/win32u/spy.c @@ -2221,7 +2221,7 @@ const char *debugstr_msg_name( UINT msg, HWND hWnd ) ext_sp_e.wParam = 0; ext_sp_e.wnd_class[0] = 0; SPY_GetMsgStuff(&ext_sp_e); - SetLastError( save_error ); + RtlSetLastWin32Error( save_error ); return wine_dbg_sprintf("%s", ext_sp_e.msg_name); }
@@ -2506,7 +2506,7 @@ static void SPY_DumpStructure(const SPY_INSTANCE *sp_e, BOOL enter) /* save and restore error code over the next call */ save_error = GetLastError(); NtUserGetClassName( pnmh->hwndFrom, FALSE, &str ); - SetLastError(save_error); + RtlSetLastWin32Error(save_error); if (wcscmp(TOOLBARCLASSNAMEW, from_class) == 0) dumplen = sizeof(NMTBCUSTOMDRAW)-sizeof(NMHDR); } else if ( pnmh->code >= HDN_ENDDRAG @@ -2640,7 +2640,7 @@ void spy_enter_message( INT iFlag, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP break; } set_indent_level( indent + SPY_INDENT_UNIT ); - SetLastError( save_error ); + RtlSetLastWin32Error( save_error ); }
@@ -2685,5 +2685,5 @@ void spy_exit_message( INT iFlag, HWND hWnd, UINT msg, LRESULT lReturn, SPY_DumpStructure(&sp_e, FALSE); break; } - SetLastError( save_error ); + RtlSetLastWin32Error( save_error ); } diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index ef2462e6540..33ff35eb21a 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1682,7 +1682,7 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT
if (val == DPI_AWARENESS_INVALID) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } if (!(prev = info->dpi_awareness)) @@ -2303,7 +2303,7 @@ BOOL get_monitor_info( HMONITOR handle, MONITORINFO *info )
unlock_display_devices(); WARN( "invalid handle %p\n", handle ); - SetLastError( ERROR_INVALID_MONITOR_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_MONITOR_HANDLE ); return FALSE; }
@@ -2422,12 +2422,12 @@ BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT * { if (type > 2) { - SetLastError( ERROR_BAD_ARGUMENTS ); + RtlSetLastWin32Error( ERROR_BAD_ARGUMENTS ); return FALSE; } if (!x || !y) { - SetLastError( ERROR_INVALID_ADDRESS ); + RtlSetLastWin32Error( ERROR_INVALID_ADDRESS ); return FALSE; } switch (get_thread_dpi_awareness()) @@ -3538,7 +3538,7 @@ BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, break; } default: - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); break; } return ret; @@ -3580,7 +3580,7 @@ BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT w FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \ } \ } \ - SetLastError( ERROR_INVALID_SPI_VALUE ); \ + RtlSetLastWin32Error( ERROR_INVALID_SPI_VALUE ); \ ret = FALSE; \ break #define WINE_SPI_WARN(x) \ @@ -4387,7 +4387,7 @@ BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT w } default: FIXME( "Unknown action: %u\n", action ); - SetLastError( ERROR_INVALID_SPI_VALUE ); + RtlSetLastWin32Error( ERROR_INVALID_SPI_VALUE ); ret = FALSE; break; } @@ -4863,7 +4863,7 @@ BOOL WINAPI NtUserSetProcessDpiAwarenessContext( ULONG awareness, ULONG unknown case NTUSER_DPI_PER_UNAWARE_GDISCALED: break; default: - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index eb215519643..fbd6c4fccad 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -436,7 +436,7 @@ extern const struct user_driver_funcs *user_driver DECLSPEC_HIDDEN;
static inline BOOL set_ntstatus( NTSTATUS status ) { - if (status) SetLastError( RtlNtStatusToDosError( status )); + if (status) RtlSetLastWin32Error( RtlNtStatusToDosError( status )); return !status; }
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 2a4edeee656..6e41bc8d27f 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -320,7 +320,7 @@ DWORD get_window_thread( HWND hwnd, DWORD *process )
if (!(ptr = get_win_ptr( hwnd ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE); return 0; }
@@ -355,7 +355,7 @@ HWND get_parent( HWND hwnd )
if (!(win = get_win_ptr( hwnd ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } if (win == WND_DESKTOP) return 0; @@ -403,7 +403,7 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent )
if (is_broadcast(hwnd) || is_broadcast(parent)) { - SetLastError(ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); return 0; }
@@ -413,14 +413,14 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent )
if (!is_window( parent )) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; }
/* Some applications try to set a child as a parent */ if (is_child( hwnd, parent )) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
@@ -429,7 +429,7 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent )
if (full_handle == parent) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; }
@@ -492,7 +492,7 @@ HWND get_window_relative( HWND hwnd, UINT rel ) WND *win = get_win_ptr( hwnd ); if (!win) { - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return 0; } if (win == WND_DESKTOP) return 0; @@ -666,7 +666,7 @@ HWND WINAPI NtUserGetAncestor( HWND hwnd, UINT type ) case GA_PARENT: if (!(win = get_win_ptr( hwnd ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } if (win == WND_DESKTOP) return 0; @@ -818,7 +818,7 @@ BOOL enable_window( HWND hwnd, BOOL enable )
if (is_broadcast(hwnd)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -850,7 +850,7 @@ BOOL is_window_enabled( HWND hwnd ) { LONG ret;
- SetLastError( NO_ERROR ); + RtlSetLastWin32Error( NO_ERROR ); ret = get_window_long( hwnd, GWL_STYLE ); if (!ret && GetLastError() != NO_ERROR) return FALSE; return !(ret & WS_DISABLED); @@ -864,7 +864,7 @@ DPI_AWARENESS_CONTEXT get_window_dpi_awareness_context( HWND hwnd )
if (!(win = get_win_ptr( hwnd ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } if (win == WND_DESKTOP) return DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE; @@ -893,7 +893,7 @@ UINT get_dpi_for_window( HWND hwnd )
if (!(win = get_win_ptr( hwnd ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } if (win == WND_DESKTOP) @@ -985,7 +985,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans
if (!(win = get_win_ptr( hwnd ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; }
@@ -1004,10 +1004,10 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans case GWLP_HINSTANCE: return 0; case GWLP_WNDPROC: - SetLastError( ERROR_ACCESS_DENIED ); + RtlSetLastWin32Error( ERROR_ACCESS_DENIED ); return 0; } - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); return 0; }
@@ -1015,7 +1015,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans { if (offset == GWLP_WNDPROC) { - SetLastError( ERROR_ACCESS_DENIED ); + RtlSetLastWin32Error( ERROR_ACCESS_DENIED ); return 0; } SERVER_START_REQ( set_window_info ) @@ -1035,7 +1035,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans case GWLP_USERDATA: retval = reply->old_user_data; break; default: if (offset >= 0) retval = get_win_data( &reply->old_extra_value, size ); - else SetLastError( ERROR_INVALID_INDEX ); + else RtlSetLastWin32Error( ERROR_INVALID_INDEX ); break; } } @@ -1052,7 +1052,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans { WARN("Invalid offset %d\n", offset ); release_win_ptr( win ); - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); return 0; } retval = get_win_data( (char *)win->wExtra + offset, size ); @@ -1083,7 +1083,7 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans break; default: WARN("Unknown offset %d\n", offset ); - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); break; } release_win_ptr( win ); @@ -1115,7 +1115,7 @@ static WORD get_window_word( HWND hwnd, INT offset ) if (offset < 0) { WARN("Invalid offset %d\n", offset ); - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); return 0; } break; @@ -1226,31 +1226,31 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO
if (is_broadcast(hwnd)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
if (!(win = get_win_ptr( hwnd ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } if (win == WND_DESKTOP) { /* can't change anything on the desktop window */ - SetLastError( ERROR_ACCESS_DENIED ); + RtlSetLastWin32Error( ERROR_ACCESS_DENIED ); return 0; } if (win == WND_OTHER_PROCESS) { if (offset == GWLP_WNDPROC) { - SetLastError( ERROR_ACCESS_DENIED ); + RtlSetLastWin32Error( ERROR_ACCESS_DENIED ); return 0; } if (offset > 32767 || offset < -32767) { - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); return 0; } return send_message( hwnd, WM_WINE_SETWINDOWLONG, MAKEWPARAM( offset, size ), newval ); @@ -1329,7 +1329,7 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO { WARN("Invalid offset %d\n", offset ); release_win_ptr( win ); - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); return 0; } else if (get_win_data( (char *)win->wExtra + offset, size ) == newval) @@ -1451,7 +1451,7 @@ WORD WINAPI NtUserSetWindowWord( HWND hwnd, INT offset, WORD newval ) if (offset < 0) { WARN("Invalid offset %d\n", offset ); - SetLastError( ERROR_INVALID_INDEX ); + RtlSetLastWin32Error( ERROR_INVALID_INDEX ); return 0; } break; @@ -1578,7 +1578,7 @@ BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_re
if (!win) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; } if (win == WND_DESKTOP) @@ -1971,7 +1971,7 @@ int WINAPI NtUserGetWindowRgnEx( HWND hwnd, HRGN hrgn, UINT unk ) { if (!(data = malloc( sizeof(*data) + size - 1 ))) { - SetLastError( ERROR_OUTOFMEMORY ); + RtlSetLastWin32Error( ERROR_OUTOFMEMORY ); return ERROR; } SERVER_START_REQ( get_window_region ) @@ -2137,7 +2137,7 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ !(get_window_long( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) || NtUserGetLayeredWindowAttributes( hwnd, NULL, NULL, NULL )) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -2157,12 +2157,12 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ offset.cy = size->cy - (window_rect.bottom - window_rect.top); if (size->cx <= 0 || size->cy <= 0) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; } if ((flags & ULW_EX_NORESIZE) && (offset.cx || offset.cy)) { - SetLastError( ERROR_INCORRECT_SIZE ); + RtlSetLastWin32Error( ERROR_INCORRECT_SIZE ); return FALSE; } client_rect.right += offset.cx; @@ -2747,7 +2747,7 @@ static BOOL get_windows_offset( HWND hwnd_from, HWND hwnd_to, UINT dpi, BOOL *mi { if (!(win = get_win_ptr( hwnd_from ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; } if (win == WND_OTHER_PROCESS) goto other_process; @@ -2783,7 +2783,7 @@ static BOOL get_windows_offset( HWND hwnd_from, HWND hwnd_to, UINT dpi, BOOL *mi { if (!(win = get_win_ptr( hwnd_to ))) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; } if (win == WND_OTHER_PROCESS) goto other_process; @@ -2847,7 +2847,7 @@ BOOL client_to_screen( HWND hwnd, POINT *pt )
if (!hwnd) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; }
@@ -2866,7 +2866,7 @@ BOOL screen_to_client( HWND hwnd, POINT *pt )
if (!hwnd) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; } if (!get_windows_offset( 0, hwnd, get_thread_dpi(), &mirrored, &offset )) return FALSE; @@ -3195,7 +3195,7 @@ static BOOL fixup_swp_flags( WINDOWPOS *winpos, const RECT *old_window_rect, int
if (!win || win == WND_OTHER_PROCESS) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; } winpos->hwnd = win->obj.handle; /* make it a full handle */ @@ -3496,7 +3496,7 @@ BOOL WINAPI NtUserSetWindowPos( HWND hwnd, HWND after, INT x, INT y, INT cx, INT
if (is_broadcast( hwnd )) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -3539,7 +3539,7 @@ HDWP begin_defer_window_pos( INT count )
if (count < 0) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } /* Windows allows zero count, in which case it allocates context for 8 moves */ @@ -3580,7 +3580,7 @@ HDWP WINAPI NtUserDeferWindowPosAndBand( HDWP hdwp, HWND hwnd, HWND after, winpos.hwnd = get_full_window_handle( hwnd ); if (is_desktop_window( winpos.hwnd ) || !is_window( winpos.hwnd )) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; }
@@ -4393,7 +4393,7 @@ BOOL WINAPI NtUserShowWindowAsync( HWND hwnd, INT cmd )
if (is_broadcast(hwnd)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -4413,7 +4413,7 @@ BOOL WINAPI NtUserShowWindow( HWND hwnd, INT cmd )
if (is_broadcast(hwnd)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; } if ((full_handle = is_current_thread_window( hwnd ))) @@ -4475,13 +4475,13 @@ BOOL WINAPI NtUserFlashWindowEx( FLASHWINFO *info )
if (!info) { - SetLastError( ERROR_NOACCESS ); + RtlSetLastWin32Error( ERROR_NOACCESS ); return FALSE; }
if (!info->hwnd || info->cbSize != sizeof(FLASHWINFO) || !is_window( info->hwnd )) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; } FIXME( "%p - semi-stub\n", info ); @@ -4566,7 +4566,7 @@ HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type )
if (!win) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return 0; } if (win == WND_OTHER_PROCESS || win == WND_DESKTOP) @@ -4590,7 +4590,7 @@ HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type ) break;
default: - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); release_win_ptr( win ); return 0; } @@ -4746,7 +4746,7 @@ BOOL WINAPI NtUserDestroyWindow( HWND hwnd )
if (!(hwnd = is_current_thread_window( hwnd )) || is_desktop_window( hwnd )) { - SetLastError( ERROR_ACCESS_DENIED ); + RtlSetLastWin32Error( ERROR_ACCESS_DENIED ); return FALSE; }
@@ -4920,7 +4920,7 @@ static WND *create_window_handle( HWND parent, HWND owner, UNICODE_STRING *name, wine_server_call( req ); } SERVER_END_REQ; - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return NULL; }
@@ -5114,7 +5114,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, if ((cs.style & (WS_CHILD|WS_POPUP)) == WS_CHILD) { WARN( "No parent for child window\n" ); - SetLastError( ERROR_TLW_WITH_WSCHILD ); + RtlSetLastWin32Error( ERROR_TLW_WITH_WSCHILD ); return 0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */ }
@@ -5369,7 +5369,7 @@ static void *get_dialog_info( HWND hwnd )
if (!(win = get_win_ptr( hwnd )) || win == WND_OTHER_PROCESS || win == WND_DESKTOP) { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_WINDOW_HANDLE ); return NULL; }
diff --git a/dlls/win32u/winstation.c b/dlls/win32u/winstation.c index d3eb145b7c5..e606047a79c 100644 --- a/dlls/win32u/winstation.c +++ b/dlls/win32u/winstation.c @@ -50,7 +50,7 @@ HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK a
if (attr->ObjectName->Length >= MAX_PATH * sizeof(WCHAR)) { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); + RtlSetLastWin32Error( ERROR_FILENAME_EXCED_RANGE ); return 0; }
@@ -145,12 +145,12 @@ HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *dev
if ((device && device->Length) || devmode) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return 0; } if (attr->ObjectName->Length >= MAX_PATH * sizeof(WCHAR)) { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); + RtlSetLastWin32Error( ERROR_FILENAME_EXCED_RANGE ); return 0; } SERVER_START_REQ( create_desktop ) @@ -174,7 +174,7 @@ HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MAS HANDLE ret = 0; if (attr->ObjectName->Length >= MAX_PATH * sizeof(WCHAR)) { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); + RtlSetLastWin32Error( ERROR_FILENAME_EXCED_RANGE ); return 0; } SERVER_START_REQ( open_desktop ) @@ -289,7 +289,7 @@ BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, if (needed) *needed = sizeof(*obj_flags); if (len < sizeof(*obj_flags)) { - SetLastError( ERROR_BUFFER_OVERFLOW ); + RtlSetLastWin32Error( ERROR_BUFFER_OVERFLOW ); return FALSE; } SERVER_START_REQ( set_user_object_info ) @@ -319,7 +319,7 @@ BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, if (needed) *needed = size; if (len < size) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); ret = FALSE; } else memcpy( info, reply->is_desktop ? desktopW : window_stationW, size ); @@ -345,7 +345,7 @@ BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, if (needed) *needed = size; if (len < size) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); ret = FALSE; } else memcpy( info, buffer, size ); @@ -359,7 +359,7 @@ BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, FIXME( "not supported index %d\n", index ); /* fall through */ default: - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; } } @@ -374,7 +374,7 @@ BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DW
if (index != UOI_FLAGS || !info || len < sizeof(*obj_flags)) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; } /* FIXME: inherit flag */
From: Jacek Caban jacek@codeweavers.com
--- dlls/winex11.drv/desktop.c | 2 +- dlls/winex11.drv/display.c | 4 +-- dlls/winex11.drv/graphics.c | 2 +- dlls/winex11.drv/keyboard.c | 4 +-- dlls/winex11.drv/opengl.c | 50 ++++++++++++++++++------------------- dlls/winex11.drv/xrandr.c | 2 +- dlls/winex11.drv/xrender.c | 2 +- dlls/winex11.drv/xvidmode.c | 2 +- 8 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index 84457582a7c..88bc40f7dfd 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -162,7 +162,7 @@ static BOOL X11DRV_desktop_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_ /* Allocate memory for modes in different color depths */ if (!(modes = calloc( (ARRAY_SIZE(screen_sizes) + 2) * DEPTH_COUNT, sizeof(*modes))) ) { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; }
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 77f71b73b77..32ed1bf3032 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -91,7 +91,7 @@ static BOOL nores_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UIN modes = calloc(1, sizeof(*modes)); if (!modes) { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; }
@@ -350,7 +350,7 @@ BOOL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, DW { pthread_mutex_unlock( &settings_mutex ); WARN("handler:%s device:%s mode index:%#x not found.\n", settings_handler.name, wine_dbgstr_w(name), n); - SetLastError(ERROR_NO_MORE_FILES); + RtlSetLastWin32Error( ERROR_NO_MORE_FILES ); return FALSE; }
diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index b833fe0c629..22e1987b9fa 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -1736,7 +1736,7 @@ BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, BOOL allow_default, LPDWORD size, if (*size < required) { *size = required; - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + RtlSetLastWin32Error( ERROR_INSUFFICIENT_BUFFER ); return FALSE; } if (filename) diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 7b4ad9acd8d..adf00b052c0 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1857,14 +1857,14 @@ BOOL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags)
if (flags & KLF_SETFORPROCESS) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); FIXME("KLF_SETFORPROCESS not supported\n"); return FALSE; }
if (!match_x11_keyboard_layout(hkl)) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + RtlSetLastWin32Error( ERROR_CALL_NOT_IMPLEMENTED ); FIXME("setting keyboard of different locales not supported\n"); return FALSE; } diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 7ceaeb7c2df..2acf9db5372 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -1739,7 +1739,7 @@ static struct wgl_context * WINAPI glxdrv_wglCreateContext( HDC hdc )
if (!(gl = get_gl_drawable( NtUserWindowFromDC( hdc ), hdc ))) { - SetLastError( ERROR_INVALID_PIXEL_FORMAT ); + RtlSetLastWin32Error( ERROR_INVALID_PIXEL_FORMAT ); return NULL; }
@@ -1833,7 +1833,7 @@ static BOOL WINAPI glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) if (ctx->fmt != gl->format) { WARN( "mismatched pixel format hdc %p %p ctx %p %p\n", hdc, gl->format, ctx, ctx->fmt ); - SetLastError( ERROR_INVALID_PIXEL_FORMAT ); + RtlSetLastWin32Error( ERROR_INVALID_PIXEL_FORMAT ); goto done; }
@@ -1854,7 +1854,7 @@ static BOOL WINAPI glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx) } pthread_mutex_unlock( &context_mutex ); } - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE );
done: release_gl_drawable( gl ); @@ -1900,7 +1900,7 @@ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct } pthread_mutex_unlock( &context_mutex ); } - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); done: release_gl_drawable( read_gl ); release_gl_drawable( draw_gl ); @@ -2027,7 +2027,7 @@ static struct wgl_context *X11DRV_wglCreateContextAttribsARB( HDC hdc, struct wg
if (!(gl = get_gl_drawable( NtUserWindowFromDC( hdc ), hdc ))) { - SetLastError( ERROR_INVALID_PIXEL_FORMAT ); + RtlSetLastWin32Error( ERROR_INVALID_PIXEL_FORMAT ); return NULL; }
@@ -2143,13 +2143,13 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat fmt = get_pixel_format(gdi_display, iPixelFormat, TRUE /* Offscreen */); if(!fmt) { ERR("(%p): invalid pixel format %d\n", hdc, iPixelFormat); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); + RtlSetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT); return NULL; }
object = calloc( 1, sizeof(*object) ); if (NULL == object) { - SetLastError(ERROR_NO_SYSTEM_RESOURCES); + RtlSetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); return NULL; } object->width = iWidth; @@ -2177,7 +2177,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat object->use_render_texture = 0; } else { if (!use_render_texture_emulation) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto create_failed; } switch (attr_v) { @@ -2221,7 +2221,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat break; default: ERR("Unknown texture format: %x\n", attr_v); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto create_failed; } } @@ -2236,13 +2236,13 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat object->texture_target = 0; } else { if (!use_render_texture_emulation) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto create_failed; } switch (attr_v) { case WGL_TEXTURE_CUBE_MAP_ARB: { if (iWidth != iHeight) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto create_failed; } object->texture_target = GL_TEXTURE_CUBE_MAP; @@ -2251,7 +2251,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat } case WGL_TEXTURE_1D_ARB: { if (1 != iHeight) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto create_failed; } object->texture_target = GL_TEXTURE_1D; @@ -2270,7 +2270,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat } default: ERR("Unknown texture target: %x\n", attr_v); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto create_failed; } } @@ -2282,7 +2282,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat attr_v = *piAttribList; TRACE("WGL_render_texture Attribute: WGL_MIPMAP_TEXTURE_ARB as %x\n", attr_v); if (!use_render_texture_emulation) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto create_failed; } break; @@ -2294,7 +2294,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat PUSH1(attribs, None); if (!(object->gl = calloc( 1, sizeof(*object->gl) ))) { - SetLastError(ERROR_NO_SYSTEM_RESOURCES); + RtlSetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); goto create_failed; } object->gl->type = DC_GL_PBUFFER; @@ -2305,7 +2305,7 @@ static struct wgl_pbuffer *X11DRV_wglCreatePbufferARB( HDC hdc, int iPixelFormat TRACE("new Pbuffer drawable as %p (%lx)\n", object->gl, object->gl->drawable); if (!object->gl->drawable) { free( object->gl ); - SetLastError(ERROR_NO_SYSTEM_RESOURCES); + RtlSetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); goto create_failed; /* unexpected error */ } pthread_mutex_lock( &context_mutex ); @@ -2400,7 +2400,7 @@ static BOOL X11DRV_wglQueryPbufferARB( struct wgl_pbuffer *object, int iAttribut *piValue = WGL_NO_TEXTURE_ARB; } else { if (!use_render_texture_emulation) { - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return GL_FALSE; } switch(object->use_render_texture) { @@ -2434,7 +2434,7 @@ static BOOL X11DRV_wglQueryPbufferARB( struct wgl_pbuffer *object, int iAttribut *piValue = WGL_NO_TEXTURE_ARB; } else { if (!use_render_texture_emulation) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return GL_FALSE; } switch (object->texture_target) { @@ -2496,7 +2496,7 @@ static BOOL X11DRV_wglSetPbufferAttribARB( struct wgl_pbuffer *object, const int WARN("(%p, %p): alpha-testing, report any problem\n", object, piAttribList);
if (!object->use_render_texture) { - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return GL_FALSE; } if (use_render_texture_emulation) { @@ -2976,7 +2976,7 @@ static BOOL X11DRV_wglBindTexImageARB( struct wgl_pbuffer *object, int iBuffer ) TRACE("(%p, %d)\n", object, iBuffer);
if (!object->use_render_texture) { - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return GL_FALSE; }
@@ -3036,7 +3036,7 @@ static BOOL X11DRV_wglReleaseTexImageARB( struct wgl_pbuffer *object, int iBuffe TRACE("(%p, %d)\n", object, iBuffer);
if (!object->use_render_texture) { - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return GL_FALSE; } if (use_render_texture_emulation) { @@ -3102,13 +3102,13 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval) */ if (interval < 0 && !has_swap_control_tear) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return FALSE; }
if (!(gl = get_gl_drawable( NtUserWindowFromDC( ctx->hdc ), ctx->hdc ))) { - SetLastError(ERROR_DC_NOT_FOUND); + RtlSetLastWin32Error(ERROR_DC_NOT_FOUND); return FALSE; }
@@ -3118,7 +3118,7 @@ static BOOL X11DRV_wglSwapIntervalEXT(int interval) if (ret) gl->swap_interval = interval; else - SetLastError(ERROR_DC_NOT_FOUND); + RtlSetLastWin32Error(ERROR_DC_NOT_FOUND);
pthread_mutex_unlock( &context_mutex ); release_gl_drawable(gl); @@ -3334,7 +3334,7 @@ static BOOL WINAPI glxdrv_wglSwapBuffers( HDC hdc )
if (!(gl = get_gl_drawable( NtUserWindowFromDC( hdc ), hdc ))) { - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE ); return FALSE; }
diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 5b81fb07709..2fb71cff9ef 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -204,7 +204,7 @@ static BOOL xrandr10_get_modes( ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, modes = calloc( mode_count * DEPTH_COUNT, sizeof(*modes) + sizeof(SizeID) ); if (!modes) { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; }
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 585299cba9e..f35f4f52000 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -1941,7 +1941,7 @@ static BOOL CDECL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *
if ((blendfn.AlphaFormat & AC_SRC_ALPHA) && physdev_src->format != WXR_FORMAT_A8R8G8B8) { - SetLastError( ERROR_INVALID_PARAMETER ); + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); return FALSE; }
diff --git a/dlls/winex11.drv/xvidmode.c b/dlls/winex11.drv/xvidmode.c index 27831cabd3b..95342a84223 100644 --- a/dlls/winex11.drv/xvidmode.c +++ b/dlls/winex11.drv/xvidmode.c @@ -140,7 +140,7 @@ static BOOL xf86vm_get_modes(ULONG_PTR id, DWORD flags, DEVMODEW **new_modes, UI ptr = calloc(1, size); if (!ptr) { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); + RtlSetLastWin32Error( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; }
From: Jacek Caban jacek@codeweavers.com
--- dlls/wineandroid.drv/init.c | 2 +- dlls/wineandroid.drv/opengl.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 4ddc66e73e8..738b8943175 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -312,7 +312,7 @@ BOOL ANDROID_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmode, D if (n > 0) { TRACE( "mode %d -- not present\n", n ); - SetLastError( ERROR_NO_MORE_FILES ); + RtlSetLastWin32Error( ERROR_NO_MORE_FILES ); return FALSE; }
diff --git a/dlls/wineandroid.drv/opengl.c b/dlls/wineandroid.drv/opengl.c index 911f6e3f3d1..337486ba6be 100644 --- a/dlls/wineandroid.drv/opengl.c +++ b/dlls/wineandroid.drv/opengl.c @@ -363,7 +363,7 @@ static BOOL android_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct goto done; } } - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE );
done: release_gl_drawable( read_gl ); @@ -382,7 +382,7 @@ static BOOL android_wglSwapIntervalEXT( int interval )
if (interval < 0) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error( ERROR_INVALID_DATA ); return FALSE; }
@@ -391,7 +391,7 @@ static BOOL android_wglSwapIntervalEXT( int interval ) if (ret) swap_interval = interval; else - SetLastError( ERROR_DC_NOT_FOUND ); + RtlSetLastWin32Error( ERROR_DC_NOT_FOUND );
return ret; } @@ -553,7 +553,7 @@ static BOOL WINAPI android_wglMakeCurrent( HDC hdc, struct wgl_context *ctx ) goto done; } } - SetLastError( ERROR_INVALID_HANDLE ); + RtlSetLastWin32Error( ERROR_INVALID_HANDLE );
done: release_gl_drawable( gl );
From: Jacek Caban jacek@codeweavers.com
--- dlls/winemac.drv/display.c | 2 +- dlls/winemac.drv/keyboard.c | 4 +- dlls/winemac.drv/opengl.c | 86 ++++++++++++++++++------------------- 3 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c index 8baa4b6df83..2d7b9656103 100644 --- a/dlls/winemac.drv/display.c +++ b/dlls/winemac.drv/display.c @@ -1133,7 +1133,7 @@ BOOL macdrv_EnumDisplaySettingsEx(LPCWSTR devname, DWORD mode, LPDEVMODEW devmod failed: TRACE("mode %d -- not present\n", mode); if (displays) macdrv_free_displays(displays); - SetLastError(ERROR_NO_MORE_FILES); + RtlSetLastWin32Error(ERROR_NO_MORE_FILES); return FALSE; }
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index 824addad78b..b43ea0b5dc7 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -1573,9 +1573,9 @@ BOOL macdrv_RegisterHotKey(HWND hwnd, UINT mod_flags, UINT vkey) TRACE_(key)("keyc 0x%04x modifiers 0x%08x -> %d\n", keyc, modifiers, ret);
if (ret == MACDRV_HOTKEY_ALREADY_REGISTERED) - SetLastError(ERROR_HOTKEY_ALREADY_REGISTERED); + RtlSetLastWin32Error(ERROR_HOTKEY_ALREADY_REGISTERED); else if (ret != MACDRV_HOTKEY_SUCCESS) - SetLastError(ERROR_GEN_FAILURE); + RtlSetLastWin32Error(ERROR_GEN_FAILURE);
return ret == MACDRV_HOTKEY_SUCCESS; } diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c index 63b24ee991d..70b366def56 100644 --- a/dlls/winemac.drv/opengl.c +++ b/dlls/winemac.drv/opengl.c @@ -1384,7 +1384,7 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns if (!pf) { ERR("Invalid pixel format %d, expect problems!\n", context->format); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); + RtlSetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT); return FALSE; }
@@ -1474,7 +1474,7 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns if (err != kCGLNoError || !pix) { WARN("CGLChoosePixelFormat() failed with error %d %s\n", err, CGLErrorString(err)); - SetLastError(ERROR_INVALID_OPERATION); + RtlSetLastWin32Error(ERROR_INVALID_OPERATION); return FALSE; }
@@ -1484,7 +1484,7 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns { context->cglcontext = NULL; WARN("CGLCreateContext() failed with error %d %s\n", err, CGLErrorString(err)); - SetLastError(ERROR_INVALID_OPERATION); + RtlSetLastWin32Error(ERROR_INVALID_OPERATION); return FALSE; }
@@ -1508,7 +1508,7 @@ static BOOL create_context(struct wgl_context *context, CGLContextObj share, uns if (!context->context) { WARN("macdrv_create_opengl_context() failed\n"); - SetLastError(ERROR_INVALID_OPERATION); + RtlSetLastWin32Error(ERROR_INVALID_OPERATION); return FALSE; } context->major = major; @@ -2319,7 +2319,7 @@ static BOOL macdrv_wglBindTexImageARB(struct wgl_pbuffer *pbuffer, int iBuffer)
if (pbuffer->no_texture) { - SetLastError(ERROR_INVALID_OPERATION); + RtlSetLastWin32Error(ERROR_INVALID_OPERATION); return GL_FALSE; }
@@ -2358,12 +2358,12 @@ static BOOL macdrv_wglBindTexImageARB(struct wgl_pbuffer *pbuffer, int iBuffer) case WGL_AUX8_ARB: case WGL_AUX9_ARB: FIXME("unsupported source buffer 0x%x\n", iBuffer); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return GL_FALSE;
default: WARN("unknown source buffer 0x%x\n", iBuffer); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return GL_FALSE; }
@@ -2371,7 +2371,7 @@ static BOOL macdrv_wglBindTexImageARB(struct wgl_pbuffer *pbuffer, int iBuffer) if (err != kCGLNoError) { WARN("CGLTexImagePBuffer failed with err %d %s\n", err, CGLErrorString(err)); - SetLastError(ERROR_INVALID_OPERATION); + RtlSetLastWin32Error(ERROR_INVALID_OPERATION); return GL_FALSE; }
@@ -2724,7 +2724,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, if (!is_valid_pixel_format(format)) { ERR("Invalid pixel format %d, expect problems!\n", format); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); + RtlSetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT); return NULL; }
@@ -2761,7 +2761,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, value != WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) { WARN("WGL_CONTEXT_PROFILE_MASK_ARB bits %#x invalid\n", value); - SetLastError(ERROR_INVALID_PROFILE_ARB); + RtlSetLastWin32Error(ERROR_INVALID_PROFILE_ARB); return NULL; } profile = value; @@ -2777,7 +2777,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, if (err != kCGLNoError) { WARN("CGLQueryRendererInfo failed: %d %s\n", err, CGLErrorString(err)); - SetLastError(ERROR_GEN_FAILURE); + RtlSetLastWin32Error(ERROR_GEN_FAILURE); return NULL; }
@@ -2787,7 +2787,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, { WARN("WGL_RENDERER_ID_WINE renderer %d exceeds count (%d)\n", value, renderer_count); CGLDestroyRendererInfo(renderer_info); - SetLastError(ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); return NULL; }
@@ -2795,7 +2795,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, { WARN("WGL_RENDERER_ID_WINE failed to get ID of renderer %d\n", value); CGLDestroyRendererInfo(renderer_info); - SetLastError(ERROR_GEN_FAILURE); + RtlSetLastWin32Error(ERROR_GEN_FAILURE); return NULL; }
@@ -2804,7 +2804,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, if (renderer_id && temp != renderer_id) { WARN("WGL_RENDERER_ID_WINE requested two different renderers (0x%08x vs. 0x%08x)\n", renderer_id, temp); - SetLastError(ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); return NULL; } renderer_id = temp; @@ -2813,7 +2813,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc,
default: WARN("Unknown attribute %s.\n", debugstr_attrib(attr, value)); - SetLastError(ERROR_INVALID_PARAMETER); + RtlSetLastWin32Error(ERROR_INVALID_PARAMETER); return NULL; } } @@ -2824,13 +2824,13 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, if (!(flags & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)) { WARN("OS X only supports forward-compatible 3.2+ contexts\n"); - SetLastError(ERROR_INVALID_VERSION_ARB); + RtlSetLastWin32Error(ERROR_INVALID_VERSION_ARB); return NULL; } if (profile != WGL_CONTEXT_CORE_PROFILE_BIT_ARB) { WARN("Compatibility profiles for GL version >= 3.2 not supported\n"); - SetLastError(ERROR_INVALID_PROFILE_ARB); + RtlSetLastWin32Error(ERROR_INVALID_PROFILE_ARB); return NULL; } if (major > gl_info.max_major || @@ -2838,7 +2838,7 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, { WARN("This GL implementation does not support the requested GL version %u.%u\n", major, minor); - SetLastError(ERROR_INVALID_PROFILE_ARB); + RtlSetLastWin32Error(ERROR_INVALID_PROFILE_ARB); return NULL; } core = TRUE; @@ -2846,20 +2846,20 @@ static struct wgl_context *macdrv_wglCreateContextAttribsARB(HDC hdc, else if (major >= 3) { WARN("Profile version %u.%u not supported\n", major, minor); - SetLastError(ERROR_INVALID_VERSION_ARB); + RtlSetLastWin32Error(ERROR_INVALID_VERSION_ARB); return NULL; } else if (major < 1 || (major == 1 && (minor < 0 || minor > 5)) || (major == 2 && (minor < 0 || minor > 1))) { WARN("Invalid GL version requested\n"); - SetLastError(ERROR_INVALID_VERSION_ARB); + RtlSetLastWin32Error(ERROR_INVALID_VERSION_ARB); return NULL; } if (!core && flags & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) { WARN("Forward compatible context requested for GL version < 3\n"); - SetLastError(ERROR_INVALID_VERSION_ARB); + RtlSetLastWin32Error(ERROR_INVALID_VERSION_ARB); return NULL; }
@@ -2900,7 +2900,7 @@ static struct wgl_pbuffer *macdrv_wglCreatePbufferARB(HDC hdc, int iPixelFormat, if (!is_valid_pixel_format(iPixelFormat) || !pixel_formats[iPixelFormat - 1].pbuffer) { WARN("invalid pixel format %d\n", iPixelFormat); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); + RtlSetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT); return NULL; }
@@ -2935,7 +2935,7 @@ static struct wgl_pbuffer *macdrv_wglCreatePbufferARB(HDC hdc, int iPixelFormat, break; default: WARN("unknown WGL_TEXTURE_FORMAT_ARB value 0x%x\n", value); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto done; } break; @@ -2955,7 +2955,7 @@ static struct wgl_pbuffer *macdrv_wglCreatePbufferARB(HDC hdc, int iPixelFormat, break; case WGL_TEXTURE_1D_ARB: FIXME("WGL_TEXTURE_TARGET_ARB: WGL_TEXTURE_1D_ARB; not supported\n"); - SetLastError(ERROR_NO_SYSTEM_RESOURCES); + RtlSetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); goto done; case WGL_TEXTURE_2D_ARB: TRACE("WGL_TEXTURE_TARGET_ARB: WGL_TEXTURE_2D_ARB\n"); @@ -2967,7 +2967,7 @@ static struct wgl_pbuffer *macdrv_wglCreatePbufferARB(HDC hdc, int iPixelFormat, break; default: WARN("unknown WGL_TEXTURE_TARGET_ARB value 0x%x\n", value); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto done; } break; @@ -2988,7 +2988,7 @@ static struct wgl_pbuffer *macdrv_wglCreatePbufferARB(HDC hdc, int iPixelFormat,
default: WARN("unknown attribute 0x%x\n", attr); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); goto done; } } @@ -3007,9 +3007,9 @@ static struct wgl_pbuffer *macdrv_wglCreatePbufferARB(HDC hdc, int iPixelFormat, WARN("CGLCreatePBuffer failed; err %d %s\n", err, CGLErrorString(err)); pbuffer->pbuffer = NULL; if (err == kCGLBadAlloc) - SetLastError(ERROR_NO_SYSTEM_RESOURCES); + RtlSetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); else - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); }
done: @@ -3120,7 +3120,7 @@ static BOOL macdrv_wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int i if (!pf) { WARN("invalid pixel format %d\n", iPixelFormat); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); + RtlSetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT); return GL_FALSE; }
@@ -3501,14 +3501,14 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w { WARN("no pixel format set\n"); release_win_data(data); - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; } if (context->format != data->pixel_format) { WARN("mismatched pixel format draw_hdc %p %u context %p %u\n", draw_hdc, data->pixel_format, context, context->format); release_win_data(data); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); + RtlSetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT); return FALSE; }
@@ -3534,7 +3534,7 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w { WARN("mismatched pixel format draw_hdc %p %u context %p %u\n", draw_hdc, pbuffer->format, context, context->format); pthread_mutex_unlock(&dc_pbuffers_mutex); - SetLastError(ERROR_INVALID_PIXEL_FORMAT); + RtlSetLastWin32Error(ERROR_INVALID_PIXEL_FORMAT); return FALSE; }
@@ -3545,7 +3545,7 @@ static BOOL macdrv_wglMakeContextCurrentARB(HDC draw_hdc, HDC read_hdc, struct w { WARN("no window or pbuffer for DC\n"); pthread_mutex_unlock(&dc_pbuffers_mutex); - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; }
@@ -3730,7 +3730,7 @@ static BOOL macdrv_wglQueryPbufferARB(struct wgl_pbuffer *pbuffer, int iAttribut if (err != kCGLNoError) { WARN("CGLDescribePBuffer failed; error %d %s\n", err, CGLErrorString(err)); - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return GL_FALSE; }
@@ -3809,7 +3809,7 @@ static BOOL macdrv_wglQueryPbufferARB(struct wgl_pbuffer *pbuffer, int iAttribut break; default: WARN("invalid attribute 0x%x\n", iAttribute); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return GL_FALSE; }
@@ -3954,7 +3954,7 @@ static BOOL macdrv_wglReleaseTexImageARB(struct wgl_pbuffer *pbuffer, int iBuffe
if (pbuffer->no_texture) { - SetLastError(ERROR_INVALID_OPERATION); + RtlSetLastWin32Error(ERROR_INVALID_OPERATION); return GL_FALSE; }
@@ -3962,7 +3962,7 @@ static BOOL macdrv_wglReleaseTexImageARB(struct wgl_pbuffer *pbuffer, int iBuffe if (err != kCGLNoError) { WARN("CGLTexImagePBuffer failed with err %d %s\n", err, CGLErrorString(err)); - SetLastError(ERROR_INVALID_OPERATION); + RtlSetLastWin32Error(ERROR_INVALID_OPERATION); return GL_FALSE; }
@@ -4020,13 +4020,13 @@ static BOOL macdrv_wglSetPbufferAttribARB(struct wgl_pbuffer *pbuffer, const int break; default: WARN("unknown WGL_CUBE_MAP_FACE_ARB value 0x%x\n", value); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return GL_FALSE; } break; default: WARN("invalid attribute 0x%x\n", attr); - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return GL_FALSE; } } @@ -4063,7 +4063,7 @@ static BOOL macdrv_wglSwapIntervalEXT(int interval)
if (interval < 0) { - SetLastError(ERROR_INVALID_DATA); + RtlSetLastWin32Error(ERROR_INVALID_DATA); return FALSE; } if (interval > 1) @@ -4089,7 +4089,7 @@ static BOOL macdrv_wglSwapIntervalEXT(int interval) InterlockedExchange(&context->update_swap_interval, FALSE); if (!set_swap_interval(context, interval)) { - SetLastError(ERROR_GEN_FAILURE); + RtlSetLastWin32Error(ERROR_GEN_FAILURE); return FALSE; }
@@ -4554,7 +4554,7 @@ static BOOL WINAPI macdrv_wglSwapBuffers(HDC hdc)
if (!(data = get_win_data(hwnd))) { - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; }
@@ -4573,7 +4573,7 @@ static BOOL WINAPI macdrv_wglSwapBuffers(HDC hdc)
if (!pbuffer) { - SetLastError(ERROR_INVALID_HANDLE); + RtlSetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; }
From: Jacek Caban jacek@codeweavers.com
--- dlls/wow64win/user.c | 40 ++++++++++++++++---------------- dlls/wow64win/wow64win_private.h | 7 ++++++ 2 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 4f54921ff02..c69c8fd6d6c 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -722,13 +722,13 @@ NTSTATUS WINAPI wow64_NtUserFlashWindowEx( UINT *args )
if (!info32) { - SetLastError( ERROR_NOACCESS ); + set_last_error32( ERROR_NOACCESS ); return FALSE; }
if (info32->cbSize != sizeof(*info32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -962,7 +962,7 @@ NTSTATUS WINAPI wow64_NtUserGetGUIThreadInfo( UINT *args )
if (info32->cbSize != sizeof(*info32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -1104,7 +1104,7 @@ NTSTATUS WINAPI wow64_NtUserGetMenuBarInfo( UINT *args )
if (info32->cbSize != sizeof(*info32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return FALSE; }
@@ -1210,7 +1210,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputBuffer( UINT *args )
if (header_size != sizeof(RAWINPUTHEADER32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -1230,7 +1230,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args )
if (header_size != sizeof(RAWINPUTHEADER32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -1246,7 +1246,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args ) data_size64 = *data_size + sizeof(RAWINPUTHEADER); if (!(data64 = Wow64AllocateTemp( data_size64 ))) { - SetLastError( STATUS_NO_MEMORY ); + set_last_error32( STATUS_NO_MEMORY ); return ~0u; }
@@ -1256,7 +1256,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args ) body_size = ret - sizeof(RAWINPUTHEADER); if (*data_size < sizeof(RAWINPUTHEADER32) + body_size) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + set_last_error32( ERROR_INSUFFICIENT_BUFFER ); return ~0u; }
@@ -1292,7 +1292,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args )
if (*data_size < sizeof(RAWINPUTHEADER32)) { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + set_last_error32( ERROR_INSUFFICIENT_BUFFER ); return ~0u; }
@@ -1306,7 +1306,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputData( UINT *args ) }
default: - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return ~0u; } } @@ -1329,7 +1329,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputDeviceList( UINT *args )
if (size != sizeof(RAWINPUTDEVICELIST32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -1340,7 +1340,7 @@ NTSTATUS WINAPI wow64_NtUserGetRawInputDeviceList( UINT *args )
if (!(devices64 = Wow64AllocateTemp( (*count) * sizeof(*devices64) ))) { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + set_last_error32( ERROR_NOT_ENOUGH_MEMORY ); return ~0u; }
@@ -1376,7 +1376,7 @@ NTSTATUS WINAPI wow64_NtUserRegisterClassExWOW( UINT *args )
if (wc32->cbSize != sizeof(*wc32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return 0; }
@@ -1408,7 +1408,7 @@ NTSTATUS WINAPI wow64_NtUserGetRegisteredRawInputDevices( UINT *args )
if (size != sizeof(RAWINPUTDEVICE32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return ~0u; }
@@ -1419,7 +1419,7 @@ NTSTATUS WINAPI wow64_NtUserGetRegisteredRawInputDevices( UINT *args )
if (!(devices64 = Wow64AllocateTemp( (*count) * sizeof(*devices64) ))) { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + set_last_error32( ERROR_NOT_ENOUGH_MEMORY ); return ~0u; }
@@ -1662,7 +1662,7 @@ NTSTATUS WINAPI wow64_NtUserMsgWaitForMultipleObjectsEx( UINT *args )
if (count > ARRAYSIZE(handles)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return WAIT_FAILED; } for (i = 0; i < count; i++) handles[i] = UlongToHandle( handles32[i] ); @@ -1794,13 +1794,13 @@ NTSTATUS WINAPI wow64_NtUserRegisterRawInputDevices( UINT *args )
if (size != sizeof(RAWINPUTDEVICE32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return FALSE; }
if (!(devices64 = Wow64AllocateTemp( count * sizeof(*devices64) ))) { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + set_last_error32( ERROR_NOT_ENOUGH_MEMORY ); return FALSE; }
@@ -1864,7 +1864,7 @@ NTSTATUS WINAPI wow64_NtUserSendInput( UINT *args )
if (size != sizeof(*inputs32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return 0; }
@@ -2489,7 +2489,7 @@ NTSTATUS WINAPI wow64_NtUserTrackMouseEvent( UINT *args )
if (info32->cbSize != sizeof(*info32)) { - SetLastError( ERROR_INVALID_PARAMETER ); + set_last_error32( ERROR_INVALID_PARAMETER ); return FALSE; }
diff --git a/dlls/wow64win/wow64win_private.h b/dlls/wow64win/wow64win_private.h index 9127085b7b4..cf0b2b62e5f 100644 --- a/dlls/wow64win/wow64win_private.h +++ b/dlls/wow64win/wow64win_private.h @@ -124,4 +124,11 @@ static inline OBJECT_ATTRIBUTES *objattr_32to64( struct object_attr64 *out, cons return &out->attr; }
+static inline void set_last_error32( DWORD err ) +{ + TEB *teb = NtCurrentTeb(); + TEB32 *teb32 = (TEB32 *)((char *)teb + teb->WowTebOffset); + teb32->LastErrorValue = err; +} + #endif /* __WOW64WIN_PRIVATE_H */
This merge request was approved by Huw Davies.