gdi32: Make SetDCHook 64-bit safe.

This commit is contained in:
Dmitry Timoshkov 2007-05-30 12:50:35 +09:00 committed by Alexandre Julliard
parent a1e8343e2e
commit ab2934781c
4 changed files with 16 additions and 17 deletions

View File

@ -166,9 +166,9 @@ DC *DC_GetDCUpdate( HDC hdc )
dc->flags &= ~DC_DIRTY;
if (proc)
{
DWORD data = dc->dwHookData;
DWORD_PTR data = dc->dwHookData;
GDI_ReleaseObj( hdc );
proc( HDC_16(hdc), DCHC_INVALIDVISRGN, data, 0 );
proc( hdc, DCHC_INVALIDVISRGN, data, 0 );
if (!(dc = DC_GetDCPtr( hdc ))) break;
/* otherwise restart the loop in case it became dirty again in the meantime */
}
@ -791,9 +791,9 @@ BOOL WINAPI DeleteDC( HDC hdc )
if (dc->hookThunk)
{
DCHOOKPROC proc = dc->hookThunk;
DWORD data = dc->dwHookData;
DWORD_PTR data = dc->dwHookData;
GDI_ReleaseObj( hdc );
if (!proc( HDC_16(hdc), DCHC_DELETEDC, data, 0 )) return FALSE;
if (!proc( hdc, DCHC_DELETEDC, data, 0 )) return FALSE;
if (!(dc = DC_GetDCPtr( hdc ))) return TRUE; /* deleted by the hook */
}
@ -1328,7 +1328,7 @@ BOOL WINAPI CombineTransform( LPXFORM xformResult, const XFORM *xform1,
*
* Note: this doesn't exist in Win32, we add it here because user32 needs it.
*/
BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD_PTR dwHookData )
{
DC *dc = GDI_GetObjPtr( hdc, DC_MAGIC );
@ -1345,19 +1345,18 @@ BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD dwHookData )
/* relay function to call the 16-bit DC hook proc */
static BOOL16 WINAPI call_dc_hook16( HDC16 hdc16, WORD code, DWORD data, LPARAM lParam )
static BOOL WINAPI call_dc_hook16( HDC hdc, WORD code, DWORD_PTR data, LPARAM lParam )
{
WORD args[6];
DWORD ret;
FARPROC16 proc = NULL;
HDC hdc = HDC_32( hdc16 );
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE;
proc = dc->hookProc;
GDI_ReleaseObj( hdc );
if (!proc) return FALSE;
args[5] = hdc16;
args[5] = HDC_16(hdc);
args[4] = code;
args[3] = HIWORD(data);
args[2] = LOWORD(data);

View File

@ -271,7 +271,7 @@ typedef struct tagDC
PHYSDEV physDev; /* Physical device (driver-specific) */
INT saveLevel;
HDC saved_dc;
DWORD dwHookData;
DWORD_PTR dwHookData;
FARPROC16 hookProc; /* the original SEGPTR ... */
DCHOOKPROC hookThunk; /* ... and the thunk to call it */

View File

@ -51,7 +51,7 @@ struct dce
static struct list dce_list = LIST_INIT(dce_list);
static BOOL16 CALLBACK dc_hook( HDC16 hDC, WORD code, DWORD data, LPARAM lParam );
static BOOL CALLBACK dc_hook( HDC hDC, WORD code, DWORD_PTR data, LPARAM lParam );
static CRITICAL_SECTION dce_section;
static CRITICAL_SECTION_DEBUG critsect_debug =
@ -224,7 +224,7 @@ static struct dce *alloc_cache_dce(void)
SaveDC( dce->hdc );
/* store DCE handle in DC hook data field */
SetDCHook( dce->hdc, dc_hook, (DWORD)dce );
SetDCHook( dce->hdc, dc_hook, (DWORD_PTR)dce );
dce->hwnd = 0;
dce->clip_rgn = 0;
@ -290,7 +290,7 @@ void alloc_window_dce( struct x11drv_win_data *data )
/* store DCE handle in DC hook data field */
SetDCHook( dce->hdc, dc_hook, (DWORD)dce );
SetDCHook( dce->hdc, dc_hook, (DWORD_PTR)dce );
dce->hwnd = data->hwnd;
dce->clip_rgn = 0;
@ -593,15 +593,15 @@ INT X11DRV_ReleaseDC( HWND hwnd, HDC hdc, BOOL end_paint )
*
* See "Undoc. Windows" for hints (DC, SetDCHook, SetHookFlags)..
*/
static BOOL16 CALLBACK dc_hook( HDC16 hDC, WORD code, DWORD data, LPARAM lParam )
static BOOL CALLBACK dc_hook( HDC hDC, WORD code, DWORD_PTR data, LPARAM lParam )
{
BOOL retv = TRUE;
struct dce *dce = (struct dce *)data;
TRACE("hDC = %04x, %i\n", hDC, code);
TRACE("hDC = %p, %u\n", hDC, code);
if (!dce) return 0;
assert( HDC_16(dce->hdc) == hDC );
assert( dce->hdc == hDC );
switch( code )
{

View File

@ -269,7 +269,7 @@ typedef struct
FONTSIGNATURE ntmFontSig;
} NEWTEXTMETRICEX16,*LPNEWTEXTMETRICEX16;
typedef BOOL16 (CALLBACK *DCHOOKPROC)(HDC16,WORD,DWORD,LPARAM);
typedef BOOL (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
typedef INT16 (CALLBACK *FONTENUMPROC16)(SEGPTR,SEGPTR,UINT16,LPARAM);
typedef VOID (CALLBACK *LINEDDAPROC16)(INT16,INT16,LPARAM);
typedef INT16 (CALLBACK *GOBJENUMPROC16)(SEGPTR,LPARAM);
@ -577,7 +577,7 @@ COLORREF WINAPI SetBkColor16(HDC16,COLORREF);
INT16 WINAPI SetBkMode16(HDC16,INT16);
UINT16 WINAPI SetBoundsRect16(HDC16,const RECT16*,UINT16);
DWORD WINAPI SetBrushOrg16(HDC16,INT16,INT16);
BOOL WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD);
BOOL WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD_PTR);
BOOL16 WINAPI SetDCHook16(HDC16,FARPROC16,DWORD);
DWORD WINAPI SetDCOrg16(HDC16,INT16,INT16);
VOID WINAPI SetDCState16(HDC16,HDC16);