gdi32: Reimplement GetObjectA on top of GetObjectW.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
14a39fcfe7
commit
3dcb5db47f
|
@ -37,7 +37,6 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs bitmap_funcs =
|
static const struct gdi_obj_funcs bitmap_funcs =
|
||||||
{
|
{
|
||||||
BITMAP_GetObject, /* pGetObjectA */
|
|
||||||
BITMAP_GetObject, /* pGetObjectW */
|
BITMAP_GetObject, /* pGetObjectW */
|
||||||
NULL, /* pUnrealizeObject */
|
NULL, /* pUnrealizeObject */
|
||||||
BITMAP_DeleteObject /* pDeleteObject */
|
BITMAP_DeleteObject /* pDeleteObject */
|
||||||
|
|
|
@ -44,7 +44,6 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs brush_funcs =
|
static const struct gdi_obj_funcs brush_funcs =
|
||||||
{
|
{
|
||||||
BRUSH_GetObject, /* pGetObjectA */
|
|
||||||
BRUSH_GetObject, /* pGetObjectW */
|
BRUSH_GetObject, /* pGetObjectW */
|
||||||
NULL, /* pUnrealizeObject */
|
NULL, /* pUnrealizeObject */
|
||||||
BRUSH_DeleteObject /* pDeleteObject */
|
BRUSH_DeleteObject /* pDeleteObject */
|
||||||
|
|
|
@ -38,7 +38,6 @@ static BOOL DC_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs dc_funcs =
|
static const struct gdi_obj_funcs dc_funcs =
|
||||||
{
|
{
|
||||||
NULL, /* pGetObjectA */
|
|
||||||
NULL, /* pGetObjectW */
|
NULL, /* pGetObjectW */
|
||||||
NULL, /* pUnrealizeObject */
|
NULL, /* pUnrealizeObject */
|
||||||
DC_DeleteObject /* pDeleteObject */
|
DC_DeleteObject /* pDeleteObject */
|
||||||
|
|
|
@ -83,7 +83,6 @@ static BOOL DIB_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs dib_funcs =
|
static const struct gdi_obj_funcs dib_funcs =
|
||||||
{
|
{
|
||||||
DIB_GetObject, /* pGetObjectA */
|
|
||||||
DIB_GetObject, /* pGetObjectW */
|
DIB_GetObject, /* pGetObjectW */
|
||||||
NULL, /* pUnrealizeObject */
|
NULL, /* pUnrealizeObject */
|
||||||
DIB_DeleteObject /* pDeleteObject */
|
DIB_DeleteObject /* pDeleteObject */
|
||||||
|
|
|
@ -180,13 +180,11 @@ static inline WCHAR *strdupW( const WCHAR *p )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer );
|
|
||||||
static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer );
|
static INT FONT_GetObjectW( HGDIOBJ handle, INT count, LPVOID buffer );
|
||||||
static BOOL FONT_DeleteObject( HGDIOBJ handle );
|
static BOOL FONT_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs fontobj_funcs =
|
static const struct gdi_obj_funcs fontobj_funcs =
|
||||||
{
|
{
|
||||||
FONT_GetObjectA, /* pGetObjectA */
|
|
||||||
FONT_GetObjectW, /* pGetObjectW */
|
FONT_GetObjectW, /* pGetObjectW */
|
||||||
NULL, /* pUnrealizeObject */
|
NULL, /* pUnrealizeObject */
|
||||||
FONT_DeleteObject /* pDeleteObject */
|
FONT_DeleteObject /* pDeleteObject */
|
||||||
|
@ -4567,26 +4565,6 @@ HGDIOBJ WINAPI NtGdiSelectFont( HDC hdc, HGDIOBJ handle )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* FONT_GetObjectA
|
|
||||||
*/
|
|
||||||
static INT FONT_GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
|
|
||||||
{
|
|
||||||
FONTOBJ *font = GDI_GetObjPtr( handle, OBJ_FONT );
|
|
||||||
LOGFONTA lfA;
|
|
||||||
|
|
||||||
if (!font) return 0;
|
|
||||||
if (buffer)
|
|
||||||
{
|
|
||||||
FONT_LogFontWToA( &font->logfont, &lfA );
|
|
||||||
if (count > sizeof(lfA)) count = sizeof(lfA);
|
|
||||||
memcpy( buffer, &lfA, count );
|
|
||||||
}
|
|
||||||
else count = sizeof(lfA);
|
|
||||||
GDI_ReleaseObj( handle );
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FONT_GetObjectW
|
* FONT_GetObjectW
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -50,7 +50,6 @@ typedef struct {
|
||||||
|
|
||||||
struct gdi_obj_funcs
|
struct gdi_obj_funcs
|
||||||
{
|
{
|
||||||
INT (*pGetObjectA)( HGDIOBJ handle, INT count, LPVOID buffer );
|
|
||||||
INT (*pGetObjectW)( HGDIOBJ handle, INT count, LPVOID buffer );
|
INT (*pGetObjectW)( HGDIOBJ handle, INT count, LPVOID buffer );
|
||||||
BOOL (*pUnrealizeObject)( HGDIOBJ handle );
|
BOOL (*pUnrealizeObject)( HGDIOBJ handle );
|
||||||
BOOL (*pDeleteObject)( HGDIOBJ handle );
|
BOOL (*pDeleteObject)( HGDIOBJ handle );
|
||||||
|
|
|
@ -1028,37 +1028,6 @@ HGDIOBJ WINAPI GetStockObject( INT obj )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GetObjectA (GDI32.@)
|
|
||||||
*/
|
|
||||||
INT WINAPI GetObjectA( HGDIOBJ handle, INT count, LPVOID buffer )
|
|
||||||
{
|
|
||||||
GDI_HANDLE_ENTRY *entry;
|
|
||||||
const struct gdi_obj_funcs *funcs = NULL;
|
|
||||||
INT result = 0;
|
|
||||||
|
|
||||||
TRACE("%p %d %p\n", handle, count, buffer );
|
|
||||||
|
|
||||||
EnterCriticalSection( &gdi_section );
|
|
||||||
if ((entry = handle_entry( handle )))
|
|
||||||
{
|
|
||||||
funcs = entry_obj( entry )->funcs;
|
|
||||||
handle = entry_to_handle( entry ); /* make it a full handle */
|
|
||||||
}
|
|
||||||
LeaveCriticalSection( &gdi_section );
|
|
||||||
|
|
||||||
if (funcs)
|
|
||||||
{
|
|
||||||
if (!funcs->pGetObjectA)
|
|
||||||
SetLastError( ERROR_INVALID_HANDLE );
|
|
||||||
else if (buffer && ((ULONG_PTR)buffer >> 16) == 0) /* catch apps getting argument order wrong */
|
|
||||||
SetLastError( ERROR_NOACCESS );
|
|
||||||
else
|
|
||||||
result = funcs->pGetObjectA( handle, count, buffer );
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* NtGdiExtGetObjectW (win32u.@)
|
* NtGdiExtGetObjectW (win32u.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
|
#include "winnls.h"
|
||||||
#include "ntgdi.h"
|
#include "ntgdi.h"
|
||||||
#include "winternl.h"
|
#include "winternl.h"
|
||||||
|
|
||||||
|
@ -140,3 +141,31 @@ INT WINAPI GetObjectW( HGDIOBJ handle, INT count, void *buffer )
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* GetObjectA (GDI32.@)
|
||||||
|
*/
|
||||||
|
INT WINAPI GetObjectA( HGDIOBJ handle, INT count, void *buffer )
|
||||||
|
{
|
||||||
|
TRACE("%p %d %p\n", handle, count, buffer );
|
||||||
|
|
||||||
|
if (get_object_type( handle ) == OBJ_FONT)
|
||||||
|
{
|
||||||
|
LOGFONTA *lfA = buffer;
|
||||||
|
LOGFONTW lf;
|
||||||
|
|
||||||
|
if (!buffer) return sizeof(*lfA);
|
||||||
|
if (!GetObjectW( handle, sizeof(lf), &lf )) return 0;
|
||||||
|
if (count > sizeof(*lfA)) count = sizeof(*lfA);
|
||||||
|
memcpy( lfA, &lf, min( count, FIELD_OFFSET(LOGFONTA, lfFaceName) ));
|
||||||
|
if (count > FIELD_OFFSET(LOGFONTA, lfFaceName))
|
||||||
|
{
|
||||||
|
WideCharToMultiByte( CP_ACP, 0, lf.lfFaceName, -1, lfA->lfFaceName,
|
||||||
|
count - FIELD_OFFSET(LOGFONTA, lfFaceName), NULL, NULL );
|
||||||
|
if (count == sizeof(*lfA)) lfA->lfFaceName[LF_FACESIZE - 1] = 0;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetObjectW( handle, count, buffer );
|
||||||
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs palette_funcs =
|
static const struct gdi_obj_funcs palette_funcs =
|
||||||
{
|
{
|
||||||
PALETTE_GetObject, /* pGetObjectA */
|
|
||||||
PALETTE_GetObject, /* pGetObjectW */
|
PALETTE_GetObject, /* pGetObjectW */
|
||||||
PALETTE_UnrealizeObject, /* pUnrealizeObject */
|
PALETTE_UnrealizeObject, /* pUnrealizeObject */
|
||||||
PALETTE_DeleteObject /* pDeleteObject */
|
PALETTE_DeleteObject /* pDeleteObject */
|
||||||
|
|
|
@ -45,7 +45,6 @@ static BOOL PEN_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs pen_funcs =
|
static const struct gdi_obj_funcs pen_funcs =
|
||||||
{
|
{
|
||||||
PEN_GetObject, /* pGetObjectA */
|
|
||||||
PEN_GetObject, /* pGetObjectW */
|
PEN_GetObject, /* pGetObjectW */
|
||||||
NULL, /* pUnrealizeObject */
|
NULL, /* pUnrealizeObject */
|
||||||
PEN_DeleteObject /* pDeleteObject */
|
PEN_DeleteObject /* pDeleteObject */
|
||||||
|
|
|
@ -111,7 +111,6 @@ static BOOL REGION_DeleteObject( HGDIOBJ handle );
|
||||||
|
|
||||||
static const struct gdi_obj_funcs region_funcs =
|
static const struct gdi_obj_funcs region_funcs =
|
||||||
{
|
{
|
||||||
NULL, /* pGetObjectA */
|
|
||||||
NULL, /* pGetObjectW */
|
NULL, /* pGetObjectW */
|
||||||
NULL, /* pUnrealizeObject */
|
NULL, /* pUnrealizeObject */
|
||||||
REGION_DeleteObject /* pDeleteObject */
|
REGION_DeleteObject /* pDeleteObject */
|
||||||
|
|
Loading…
Reference in New Issue