Commit 1dfedae9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Use RtlSetLastWin32Error.

parent 2f0c2684
......@@ -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)
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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 )))
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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 );
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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( &params, msg->hwnd, msg->message, msg->wParam, msg->lParam,
&retval, FALSE, WMCHAR_MAP_DISPATCHMESSAGE ))
dispatch_win_proc_params( &params, 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:
......
......@@ -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++)
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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 );
}
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment