Fixed a number of -DSTRICT issues.

This commit is contained in:
Alexandre Julliard 2002-11-22 21:58:03 +00:00
parent aff7ddaeeb
commit 6c428e5c07
5 changed files with 99 additions and 55 deletions

View File

@ -43,6 +43,7 @@
#include "winspool.h" #include "winspool.h"
#include "winerror.h" #include "winerror.h"
#include "winreg.h" #include "winreg.h"
#include "wownt32.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "gdi.h" #include "gdi.h"
#include "heap.h" #include "heap.h"
@ -153,13 +154,15 @@ INT WINAPI StartPage(HDC hdc)
*/ */
INT WINAPI EndPage(HDC hdc) INT WINAPI EndPage(HDC hdc)
{ {
ABORTPROC abort_proc;
INT ret = 0; INT ret = 0;
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if(!dc) return SP_ERROR; if(!dc) return SP_ERROR;
if (dc->funcs->pEndPage) ret = dc->funcs->pEndPage( dc->physDev ); if (dc->funcs->pEndPage) ret = dc->funcs->pEndPage( dc->physDev );
abort_proc = dc->pAbortProc;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
if (!QueryAbort16( hdc, 0 )) if (abort_proc && !abort_proc( hdc, 0 ))
{ {
EndDoc( hdc ); EndDoc( hdc );
ret = 0; ret = 0;
@ -191,9 +194,10 @@ INT WINAPI AbortDoc(HDC hdc)
* TRUE if no AbortProc avail or AbortProc wants to continue printing. * TRUE if no AbortProc avail or AbortProc wants to continue printing.
* FALSE if AbortProc wants to abort printing. * FALSE if AbortProc wants to abort printing.
*/ */
BOOL16 WINAPI QueryAbort16(HDC16 hdc, INT16 reserved) BOOL16 WINAPI QueryAbort16(HDC16 hdc16, INT16 reserved)
{ {
BOOL ret = TRUE; BOOL ret = TRUE;
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
ABORTPROC abproc; ABORTPROC abproc;
@ -225,7 +229,7 @@ static BOOL CALLBACK call_abort_proc16( HDC hdc, INT code )
if (!dc) return FALSE; if (!dc) return FALSE;
proc16 = dc->pAbortProc16; proc16 = dc->pAbortProc16;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
if (proc16) return PRTDRV_CallTo16_word_ww( (FARPROC16)proc16, hdc, code ); if (proc16) return PRTDRV_CallTo16_word_ww( (FARPROC16)proc16, HDC_16(hdc), code );
return TRUE; return TRUE;
} }
@ -233,8 +237,9 @@ static BOOL CALLBACK call_abort_proc16( HDC hdc, INT code )
/********************************************************************** /**********************************************************************
* SetAbortProc (GDI.381) * SetAbortProc (GDI.381)
*/ */
INT16 WINAPI SetAbortProc16(HDC16 hdc, ABORTPROC16 abrtprc) INT16 WINAPI SetAbortProc16(HDC16 hdc16, ABORTPROC16 abrtprc)
{ {
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;

View File

@ -120,9 +120,10 @@ INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode )
/*********************************************************************** /***********************************************************************
* SelectVisRgn (GDI.105) * SelectVisRgn (GDI.105)
*/ */
INT16 WINAPI SelectVisRgn16( HDC16 hdc, HRGN16 hrgn ) INT16 WINAPI SelectVisRgn16( HDC16 hdc16, HRGN16 hrgn )
{ {
int retval; int retval;
HDC hdc = HDC_32( hdc16 );
DC * dc; DC * dc;
if (!hrgn) return ERROR; if (!hrgn) return ERROR;
@ -164,9 +165,10 @@ INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
/*********************************************************************** /***********************************************************************
* OffsetVisRgn (GDI.102) * OffsetVisRgn (GDI.102)
*/ */
INT16 WINAPI OffsetVisRgn16( HDC16 hdc, INT16 x, INT16 y ) INT16 WINAPI OffsetVisRgn16( HDC16 hdc16, INT16 x, INT16 y )
{ {
INT16 retval; INT16 retval;
HDC hdc = HDC_32( hdc16 );
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
TRACE("%04x %d,%d\n", hdc, x, y ); TRACE("%04x %d,%d\n", hdc, x, y );
@ -269,12 +271,12 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom
/*********************************************************************** /***********************************************************************
* ExcludeVisRect (GDI.73) * ExcludeVisRect (GDI.73)
*/ */
INT16 WINAPI ExcludeVisRect16( HDC16 hdc, INT16 left, INT16 top, INT16 WINAPI ExcludeVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom )
INT16 right, INT16 bottom )
{ {
HRGN tempRgn; HRGN tempRgn;
INT16 ret; INT16 ret;
POINT pt[2]; POINT pt[2];
HDC hdc = HDC_32( hdc16 );
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
@ -302,12 +304,12 @@ INT16 WINAPI ExcludeVisRect16( HDC16 hdc, INT16 left, INT16 top,
/*********************************************************************** /***********************************************************************
* IntersectVisRect (GDI.98) * IntersectVisRect (GDI.98)
*/ */
INT16 WINAPI IntersectVisRect16( HDC16 hdc, INT16 left, INT16 top, INT16 WINAPI IntersectVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom )
INT16 right, INT16 bottom )
{ {
HRGN tempRgn; HRGN tempRgn;
INT16 ret; INT16 ret;
POINT pt[2]; POINT pt[2];
HDC hdc = HDC_32( hdc16 );
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
@ -425,10 +427,11 @@ INT WINAPI GetClipRgn( HDC hdc, HRGN hRgn )
/*********************************************************************** /***********************************************************************
* SaveVisRgn (GDI.129) * SaveVisRgn (GDI.129)
*/ */
HRGN16 WINAPI SaveVisRgn16( HDC16 hdc ) HRGN16 WINAPI SaveVisRgn16( HDC16 hdc16 )
{ {
HRGN copy; HRGN copy;
GDIOBJHDR *obj, *copyObj; GDIOBJHDR *obj, *copyObj;
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCUpdate( hdc ); DC *dc = DC_GetDCUpdate( hdc );
if (!dc) return 0; if (!dc) return 0;
@ -454,21 +457,22 @@ HRGN16 WINAPI SaveVisRgn16( HDC16 hdc )
return 0; return 0;
} }
copyObj->hNext = obj->hNext; copyObj->hNext = obj->hNext;
obj->hNext = copy; obj->hNext = HRGN_16(copy);
GDI_ReleaseObj( copy ); GDI_ReleaseObj( copy );
GDI_ReleaseObj( dc->hVisRgn ); GDI_ReleaseObj( dc->hVisRgn );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return copy; return HRGN_16(copy);
} }
/*********************************************************************** /***********************************************************************
* RestoreVisRgn (GDI.130) * RestoreVisRgn (GDI.130)
*/ */
INT16 WINAPI RestoreVisRgn16( HDC16 hdc ) INT16 WINAPI RestoreVisRgn16( HDC16 hdc16 )
{ {
HRGN saved; HRGN saved;
GDIOBJHDR *obj, *savedObj; GDIOBJHDR *obj, *savedObj;
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
INT16 ret = ERROR; INT16 ret = ERROR;
@ -477,7 +481,7 @@ INT16 WINAPI RestoreVisRgn16( HDC16 hdc )
TRACE("%04x\n", hdc ); TRACE("%04x\n", hdc );
if (!(obj = GDI_GetObjPtr( dc->hVisRgn, REGION_MAGIC ))) goto done; if (!(obj = GDI_GetObjPtr( dc->hVisRgn, REGION_MAGIC ))) goto done;
saved = obj->hNext; saved = HRGN_32(obj->hNext);
if ((savedObj = GDI_GetObjPtr( saved, REGION_MAGIC ))) if ((savedObj = GDI_GetObjPtr( saved, REGION_MAGIC )))
{ {

View File

@ -22,14 +22,15 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "gdi.h"
#include "heap.h"
#include "wine/debug.h"
#include "font.h"
#include "winerror.h"
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "winerror.h"
#include "wownt32.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "gdi.h"
#include "heap.h"
#include "font.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dc); WINE_DEFAULT_DEBUG_CHANNEL(dc);
@ -57,7 +58,7 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs )
HDC hdc; HDC hdc;
DC *dc; DC *dc;
if (!(dc = GDI_AllocObject( sizeof(*dc), DC_MAGIC, &hdc, &dc_funcs ))) return NULL; if (!(dc = GDI_AllocObject( sizeof(*dc), DC_MAGIC, (HGDIOBJ*)&hdc, &dc_funcs ))) return NULL;
dc->hSelf = hdc; dc->hSelf = hdc;
dc->funcs = funcs; dc->funcs = funcs;
@ -163,7 +164,7 @@ DC *DC_GetDCUpdate( HDC hdc )
{ {
DWORD data = dc->dwHookData; DWORD data = dc->dwHookData;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
proc( hdc, DCHC_INVALIDVISRGN, data, 0 ); proc( HDC_16(hdc), DCHC_INVALIDVISRGN, data, 0 );
if (!(dc = DC_GetDCPtr( hdc ))) break; if (!(dc = DC_GetDCPtr( hdc ))) break;
/* otherwise restart the loop in case it became dirty again in the meantime */ /* otherwise restart the loop in case it became dirty again in the meantime */
} }
@ -190,7 +191,7 @@ static BOOL DC_DeleteObject( HGDIOBJ handle, void *obj )
*/ */
void DC_InitDC( DC* dc ) void DC_InitDC( DC* dc )
{ {
RealizeDefaultPalette16( dc->hSelf ); if (dc->funcs->pRealizeDefaultPalette) dc->funcs->pRealizeDefaultPalette( dc->physDev );
SetTextColor( dc->hSelf, dc->textColor ); SetTextColor( dc->hSelf, dc->textColor );
SetBkColor( dc->hSelf, dc->backgroundColor ); SetBkColor( dc->hSelf, dc->backgroundColor );
SelectObject( dc->hSelf, dc->hPen ); SelectObject( dc->hSelf, dc->hPen );
@ -267,9 +268,9 @@ void DC_UpdateXforms( DC *dc )
/*********************************************************************** /***********************************************************************
* GetDCState (GDI.179) * GetDCState (Not a Windows API)
*/ */
HDC16 WINAPI GetDCState16( HDC16 hdc ) HDC WINAPI GetDCState( HDC hdc )
{ {
DC * newdc, * dc; DC * newdc, * dc;
HGDIOBJ handle; HGDIOBJ handle;
@ -356,9 +357,9 @@ HDC16 WINAPI GetDCState16( HDC16 hdc )
/*********************************************************************** /***********************************************************************
* SetDCState (GDI.180) * SetDCState (Not a Windows API)
*/ */
void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs ) void WINAPI SetDCState( HDC hdc, HDC hdcs )
{ {
DC *dc, *dcs; DC *dc, *dcs;
@ -439,6 +440,24 @@ void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
} }
/***********************************************************************
* GetDCState (GDI.179)
*/
HDC16 WINAPI GetDCState16( HDC16 hdc )
{
return HDC_16( GetDCState( HDC_32(hdc) ));
}
/***********************************************************************
* SetDCState (GDI.180)
*/
void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
{
SetDCState( HDC_32(hdc), HDC_32(hdcs) );
}
/*********************************************************************** /***********************************************************************
* SaveDC (GDI32.@) * SaveDC (GDI32.@)
*/ */
@ -458,7 +477,7 @@ INT WINAPI SaveDC( HDC hdc )
return ret; return ret;
} }
if (!(hdcs = GetDCState16( hdc ))) if (!(hdcs = GetDCState( hdc )))
{ {
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return 0; return 0;
@ -480,7 +499,7 @@ INT WINAPI SaveDC( HDC hdc )
} }
dcs->header.hNext = dc->header.hNext; dcs->header.hNext = dc->header.hNext;
dc->header.hNext = hdcs; dc->header.hNext = HDC_16(hdcs);
TRACE("(%04x): returning %d\n", hdc, dc->saveLevel+1 ); TRACE("(%04x): returning %d\n", hdc, dc->saveLevel+1 );
ret = ++dc->saveLevel; ret = ++dc->saveLevel;
GDI_ReleaseObj( hdcs ); GDI_ReleaseObj( hdcs );
@ -523,7 +542,7 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
success=TRUE; success=TRUE;
while (dc->saveLevel >= level) while (dc->saveLevel >= level)
{ {
HDC16 hdcs = dc->header.hNext; HDC hdcs = HDC_32(dc->header.hNext);
if (!(dcs = DC_GetDCPtr( hdcs ))) if (!(dcs = DC_GetDCPtr( hdcs )))
{ {
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
@ -532,7 +551,7 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
dc->header.hNext = dcs->header.hNext; dc->header.hNext = dcs->header.hNext;
if (--dc->saveLevel < level) if (--dc->saveLevel < level)
{ {
SetDCState16( hdc, hdcs ); SetDCState( hdc, hdcs );
if (!PATH_AssignGdiPath( &dc->path, &dcs->path )) if (!PATH_AssignGdiPath( &dc->path, &dcs->path ))
/* FIXME: This might not be quite right, since we're /* FIXME: This might not be quite right, since we're
* returning FALSE but still destroying the saved DC state */ * returning FALSE but still destroying the saved DC state */
@ -728,7 +747,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
{ {
DWORD data = dc->dwHookData; DWORD data = dc->dwHookData;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
if (!proc( hdc, DCHC_DELETEDC, data, 0 )) return FALSE; if (!proc( HDC_16(hdc), DCHC_DELETEDC, data, 0 )) return FALSE;
if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */ if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */
} }
} }
@ -736,7 +755,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
while (dc->saveLevel) while (dc->saveLevel)
{ {
DC * dcs; DC * dcs;
HDC16 hdcs = dc->header.hNext; HDC hdcs = HDC_32(dc->header.hNext);
if (!(dcs = DC_GetDCPtr( hdcs ))) break; if (!(dcs = DC_GetDCPtr( hdcs ))) break;
dc->header.hNext = dcs->header.hNext; dc->header.hNext = dcs->header.hNext;
dc->saveLevel--; dc->saveLevel--;
@ -900,9 +919,10 @@ BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
/*********************************************************************** /***********************************************************************
* SetDCOrg (GDI.117) * SetDCOrg (GDI.117)
*/ */
DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y ) DWORD WINAPI SetDCOrg16( HDC16 hdc16, INT16 x, INT16 y )
{ {
DWORD prevOrg = 0; DWORD prevOrg = 0;
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) return 0; if (!dc) return 0;
if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y ); if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y );
@ -1126,22 +1146,24 @@ BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
/* relay function to call the 16-bit DC hook proc */ /* relay function to call the 16-bit DC hook proc */
static BOOL16 WINAPI call_dc_hook16( HDC16 hdc, WORD code, DWORD data, LPARAM lParam ) static BOOL16 WINAPI call_dc_hook16( HDC16 hdc16, WORD code, DWORD data, LPARAM lParam )
{ {
FARPROC16 proc = NULL; FARPROC16 proc = NULL;
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
proc = dc->hookProc; proc = dc->hookProc;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
if (!proc) return FALSE; if (!proc) return FALSE;
return GDI_CallTo16_word_wwll( proc, hdc, code, data, lParam ); return GDI_CallTo16_word_wwll( proc, hdc16, code, data, lParam );
} }
/*********************************************************************** /***********************************************************************
* SetDCHook (GDI.190) * SetDCHook (GDI.190)
*/ */
BOOL16 WINAPI SetDCHook16( HDC16 hdc, FARPROC16 hookProc, DWORD dwHookData ) BOOL16 WINAPI SetDCHook16( HDC16 hdc16, FARPROC16 hookProc, DWORD dwHookData )
{ {
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
@ -1154,22 +1176,27 @@ BOOL16 WINAPI SetDCHook16( HDC16 hdc, FARPROC16 hookProc, DWORD dwHookData )
/*********************************************************************** /***********************************************************************
* GetDCHook (GDI.191) * GetDCHook (GDI.191)
*/ */
DWORD WINAPI GetDCHook16( HDC16 hdc, FARPROC16 *phookProc ) DWORD WINAPI GetDCHook16( HDC16 hdc16, FARPROC16 *phookProc )
{ {
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
DWORD ret;
if (!dc) return 0; if (!dc) return 0;
*phookProc = dc->hookProc; *phookProc = dc->hookProc;
ret = dc->dwHookData;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return dc->dwHookData; return ret;
} }
/*********************************************************************** /***********************************************************************
* SetHookFlags (GDI.192) * SetHookFlags (GDI.192)
*/ */
WORD WINAPI SetHookFlags16(HDC16 hDC, WORD flags) WORD WINAPI SetHookFlags16(HDC16 hdc16, WORD flags)
{ {
DC *dc = DC_GetDCPtr( hDC ); HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc );
if( dc ) if( dc )
{ {
@ -1178,13 +1205,13 @@ WORD WINAPI SetHookFlags16(HDC16 hDC, WORD flags)
/* "Undocumented Windows" info is slightly confusing. /* "Undocumented Windows" info is slightly confusing.
*/ */
TRACE("hDC %04x, flags %04x\n",hDC,flags); TRACE("hDC %04x, flags %04x\n",hdc,flags);
if( flags & DCHF_INVALIDATEVISRGN ) if( flags & DCHF_INVALIDATEVISRGN )
dc->flags |= DC_DIRTY; dc->flags |= DC_DIRTY;
else if( flags & DCHF_VALIDATEVISRGN || !flags ) else if( flags & DCHF_VALIDATEVISRGN || !flags )
dc->flags &= ~DC_DIRTY; dc->flags &= ~DC_DIRTY;
GDI_ReleaseObj( hDC ); GDI_ReleaseObj( hdc );
return wRet; return wRet;
} }
return 0; return 0;

View File

@ -38,6 +38,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdi); WINE_DEFAULT_DEBUG_CHANNEL(gdi);
#define HGDIOBJ_32(h16) ((HGDIOBJ)(ULONG_PTR)(h16))
/*********************************************************************** /***********************************************************************
* GDI stock objects * GDI stock objects
@ -724,11 +725,12 @@ void *GDI_ReallocObject( WORD size, HGDIOBJ handle, void *object )
if ((UINT_PTR)handle & 2) /* GDI heap handle */ if ((UINT_PTR)handle & 2) /* GDI heap handle */
{ {
LOCAL_Unlock( GDI_HeapSel, handle ); HLOCAL16 h = LOWORD(handle);
if ((new_handle = LOCAL_ReAlloc( GDI_HeapSel, handle, size, LMEM_MOVEABLE ))) LOCAL_Unlock( GDI_HeapSel, h );
if ((new_handle = (HGDIOBJ)(ULONG_PTR)LOCAL_ReAlloc( GDI_HeapSel, h, size, LMEM_MOVEABLE )))
{ {
assert( new_handle == handle ); /* moveable handle cannot change */ assert( new_handle == handle ); /* moveable handle cannot change */
return LOCAL_Lock( GDI_HeapSel, handle ); return LOCAL_Lock( GDI_HeapSel, h );
} }
} }
else else
@ -762,8 +764,9 @@ BOOL GDI_FreeObject( HGDIOBJ handle, void *ptr )
object->funcs = NULL; object->funcs = NULL;
if ((UINT_PTR)handle & 2) /* GDI heap handle */ if ((UINT_PTR)handle & 2) /* GDI heap handle */
{ {
LOCAL_Unlock( GDI_HeapSel, handle ); HLOCAL16 h = LOWORD(handle);
LOCAL_Free( GDI_HeapSel, handle ); LOCAL_Unlock( GDI_HeapSel, h );
LOCAL_Free( GDI_HeapSel, h );
} }
else /* large heap handle */ else /* large heap handle */
{ {
@ -796,14 +799,15 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
if ((UINT_PTR)handle & 2) /* GDI heap handle */ if ((UINT_PTR)handle & 2) /* GDI heap handle */
{ {
ptr = (GDIOBJHDR *)LOCAL_Lock( GDI_HeapSel, handle ); HLOCAL16 h = LOWORD(handle);
ptr = (GDIOBJHDR *)LOCAL_Lock( GDI_HeapSel, h );
if (ptr) if (ptr)
{ {
if (((magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) || if (((magic != MAGIC_DONTCARE) && (GDIMAGIC(ptr->wMagic) != magic)) ||
(GDIMAGIC(ptr->wMagic) < FIRST_MAGIC) || (GDIMAGIC(ptr->wMagic) < FIRST_MAGIC) ||
(GDIMAGIC(ptr->wMagic) > LAST_MAGIC)) (GDIMAGIC(ptr->wMagic) > LAST_MAGIC))
{ {
LOCAL_Unlock( GDI_HeapSel, handle ); LOCAL_Unlock( GDI_HeapSel, h );
ptr = NULL; ptr = NULL;
} }
} }
@ -836,7 +840,7 @@ void *GDI_GetObjPtr( HGDIOBJ handle, WORD magic )
*/ */
void GDI_ReleaseObj( HGDIOBJ handle ) void GDI_ReleaseObj( HGDIOBJ handle )
{ {
if ((UINT_PTR)handle & 2) LOCAL_Unlock( GDI_HeapSel, handle ); if ((UINT_PTR)handle & 2) LOCAL_Unlock( GDI_HeapSel, LOWORD(handle) );
TRACE_SEC( handle, "leave" ); TRACE_SEC( handle, "leave" );
_LeaveSysLevel( &GDI_level ); _LeaveSysLevel( &GDI_level );
} }
@ -907,10 +911,12 @@ HGDIOBJ WINAPI GetStockObject( INT obj )
/*********************************************************************** /***********************************************************************
* GetObject (GDI.82) * GetObject (GDI.82)
*/ */
INT16 WINAPI GetObject16( HANDLE16 handle, INT16 count, LPVOID buffer ) INT16 WINAPI GetObject16( HANDLE16 handle16, INT16 count, LPVOID buffer )
{ {
GDIOBJHDR * ptr; GDIOBJHDR * ptr;
HGDIOBJ handle = HGDIOBJ_32( handle16 );
INT16 result = 0; INT16 result = 0;
TRACE("%04x %d %p\n", handle, count, buffer ); TRACE("%04x %d %p\n", handle, count, buffer );
if (!count) return 0; if (!count) return 0;
@ -1182,9 +1188,10 @@ INT WINAPI EnumObjects( HDC hdc, INT nObjType,
* *
* returns type of object if valid (W95 system programming secrets p. 264-5) * returns type of object if valid (W95 system programming secrets p. 264-5)
*/ */
BOOL16 WINAPI IsGDIObject16( HGDIOBJ16 handle ) BOOL16 WINAPI IsGDIObject16( HGDIOBJ16 handle16 )
{ {
UINT16 magic = 0; UINT16 magic = 0;
HGDIOBJ handle = HGDIOBJ_32( handle16 );
GDIOBJHDR *object = GDI_GetObjPtr( handle, MAGIC_DONTCARE ); GDIOBJHDR *object = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
if (object) if (object)
@ -1215,8 +1222,9 @@ void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner )
* with 0x2000 (OBJECT_PRIVATE), so we just do it. * with 0x2000 (OBJECT_PRIVATE), so we just do it.
* But Wine doesn't react on that yet. * But Wine doesn't react on that yet.
*/ */
void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle, BOOL16 private ) void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private )
{ {
HGDIOBJ handle = HGDIOBJ_32( handle16 );
GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ); GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
if (!ptr) if (!ptr)
{ {

View File

@ -688,7 +688,7 @@ BOOL16 WINAPI EnumMetaFile16( HDC16 hdc16, HMETAFILE16 hmf,
/* free objects in handle table */ /* free objects in handle table */
for(i = 0; i < mh->mtNoObjects; i++) for(i = 0; i < mh->mtNoObjects; i++)
if(*(ht->objectHandle + i) != 0) if(*(ht->objectHandle + i) != 0)
DeleteObject(*(ht->objectHandle + i)); DeleteObject( (HGDIOBJ)(ULONG_PTR)(*(ht->objectHandle + i) ));
/* free handle table */ /* free handle table */
GlobalFree16(hHT); GlobalFree16(hHT);