Skip to content

Commit

Permalink
gdi32: Introduce NtGdiExtGetObjectW.
Browse files Browse the repository at this point in the history
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
  • Loading branch information
cjacek authored and julliard committed Jul 5, 2021
1 parent 5d9586a commit 14a39fc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
10 changes: 4 additions & 6 deletions dlls/gdi32/gdiobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,9 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
}

/***********************************************************************
* GetObjectW (GDI32.@)
* NtGdiExtGetObjectW (win32u.@)
*/
INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
INT WINAPI NtGdiExtGetObjectW( HGDIOBJ handle, INT count, void *buffer )
{
GDI_HANDLE_ENTRY *entry;
const struct gdi_obj_funcs *funcs = NULL;
Expand All @@ -1078,11 +1078,9 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer )
}
LeaveCriticalSection( &gdi_section );

if (funcs)
if (funcs && funcs->pGetObjectW)
{
if (!funcs->pGetObjectW)
SetLastError( ERROR_INVALID_HANDLE );
else if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */
if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */
SetLastError( ERROR_NOACCESS );
else
result = funcs->pGetObjectW( handle, count, buffer );
Expand Down
29 changes: 29 additions & 0 deletions dlls/gdi32/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,32 @@ HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ obj )
if (!ret) SetLastError( ERROR_INVALID_HANDLE );
return ret;
}

/***********************************************************************
* GetObjectW (GDI32.@)
*/
INT WINAPI GetObjectW( HGDIOBJ handle, INT count, void *buffer )
{
int result;

TRACE( "%p %d %p\n", handle, count, buffer );

result = NtGdiExtGetObjectW( handle, count, buffer );
if (!result && count)
{
switch(get_object_type( handle ))
{
case 0:
case OBJ_BITMAP:
case OBJ_BRUSH:
case OBJ_FONT:
case OBJ_PAL:
case OBJ_PEN:
case OBJ_EXTPEN:
break;
default:
SetLastError( ERROR_INVALID_HANDLE );
}
}
return result;
}

0 comments on commit 14a39fc

Please sign in to comment.