Author: weiden
Date: Thu Nov 29 08:21:19 2007
New Revision: 30852
URL:
http://svn.reactos.org/svn/reactos?rev=30852&view=rev
Log:
Check the GDI object type in GdiGetHandleUserData()
Modified:
trunk/reactos/dll/win32/gdi32/include/gdi32p.h
trunk/reactos/dll/win32/gdi32/misc/misc.c
trunk/reactos/dll/win32/gdi32/objects/brush.c
trunk/reactos/dll/win32/gdi32/objects/coord.c
trunk/reactos/dll/win32/gdi32/objects/dc.c
trunk/reactos/dll/win32/gdi32/objects/painting.c
trunk/reactos/dll/win32/gdi32/objects/text.c
Modified: trunk/reactos/dll/win32/gdi32/include/gdi32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/include/gd…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/include/gdi32p.h (original)
+++ trunk/reactos/dll/win32/gdi32/include/gdi32p.h Thu Nov 29 08:21:19 2007
@@ -122,6 +122,7 @@
BOOL
GdiGetHandleUserData(
HGDIOBJ hGdiObj,
+ DWORD ObjectType,
PVOID *UserData
);
Modified: trunk/reactos/dll/win32/gdi32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/misc.…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/misc.c (original)
+++ trunk/reactos/dll/win32/gdi32/misc/misc.c Thu Nov 29 08:21:19 2007
@@ -115,10 +115,10 @@
return FALSE;
}
-BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData)
+BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, DWORD ObjectType, PVOID *UserData)
{
PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj);
- if((Entry->Type & GDI_ENTRY_BASETYPE_MASK) != 0 &&
+ if((Entry->Type & GDI_ENTRY_BASETYPE_MASK) == ObjectType &&
(Entry->Type << GDI_ENTRY_UPPER_SHIFT) == GDI_HANDLE_GET_UPPER(hGdiObj))
{
HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
@@ -152,7 +152,7 @@
PLDC GdiGetLDC(HDC hDC)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr))
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return NULL;
return Dc_Attr->pvLDC;
}
Modified: trunk/reactos/dll/win32/gdi32/objects/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/br…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/brush.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/brush.c Thu Nov 29 08:21:19 2007
@@ -213,7 +213,7 @@
GetROP2(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->jROP2;
}
@@ -250,7 +250,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG) hdc)
{
@@ -277,7 +277,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (pt)
{
pt->x = Dc_Attr->ptlBrushOrigin.x;
@@ -314,7 +314,7 @@
return FALSE;
}
#endif
- if (GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr))
+ if (GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
{
PTEB pTeb = NtCurrentTeb();
if (lppt)
Modified: trunk/reactos/dll/win32/gdi32/objects/coord.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/co…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/coord.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/coord.c Thu Nov 29 08:21:19 2007
@@ -98,8 +98,7 @@
INT i;
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (Dc_Attr->flXform & ( DEVICE_TO_WORLD_INVALID | // Force a full
recalibration!
PAGE_XLATE_CHANGED | // Changes or Updates have been
made,
@@ -126,8 +125,7 @@
INT i;
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (Dc_Attr->flXform & ( PAGE_XLATE_CHANGED | // Check for Changes and
Updates
PAGE_EXTENTS_CHANGED |
@@ -155,8 +153,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if ( lpPoint )
{
@@ -237,8 +234,7 @@
#endif
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
/* Check that graphics mode is GM_ADVANCED */
if ( Dc_Attr->iGraphicsMode != GM_ADVANCED ) return FALSE;
@@ -255,8 +251,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if ((Dc_Attr->flXform & PAGE_EXTENTS_CHANGED) && (Dc_Attr->iMapMode
== MM_ISOTROPIC))
// Something was updated, go to kernel.
@@ -279,8 +274,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
lpPoint->x = Dc_Attr->ptlViewportOrg.x;
lpPoint->y = Dc_Attr->ptlViewportOrg.y;
if (Dc_Attr->dwLayout & LAYOUT_RTL) lpPoint->x = -lpPoint->x;
@@ -298,8 +292,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
lpSize->cx = Dc_Attr->szlWindowExt.cx;
lpSize->cy = Dc_Attr->szlWindowExt.cy;
if (Dc_Attr->dwLayout & LAYOUT_RTL) lpSize->cx = -lpSize->cx;
@@ -317,8 +310,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
lpPoint->x = Dc_Attr->ptlWindowOrg.x;
lpPoint->y = Dc_Attr->ptlWindowOrg.y;
return TRUE;
@@ -357,8 +349,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (lpSize)
{
@@ -421,8 +412,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (lpPoint)
{
@@ -484,8 +474,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (lpSize)
{
@@ -556,8 +545,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (lpPoint)
{
@@ -583,8 +571,7 @@
)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return GDI_ERROR;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return GDI_ERROR;
return Dc_Attr->dwLayout;
}
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/dc.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/dc.c Thu Nov 29 08:21:19 2007
@@ -65,7 +65,7 @@
PDC_ATTR Dc_Attr;
PLDC pLDC;
- GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr);
+ GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr);
pLDC = LocalAlloc(LMEM_ZEROINIT, sizeof(LDC));
@@ -258,7 +258,7 @@
PDC_ATTR Dc_Attr;
PLDC pLDC;
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if ( Dc_Attr )
{
@@ -330,7 +330,7 @@
PBRUSH_ATTR Brh_Attr;
PTEB pTeb;
- if ((!GdiGetHandleUserData(hObject, (PVOID) &Brh_Attr)) ||
+ if ((!GdiGetHandleUserData(hObject, (DWORD)Type, (PVOID) &Brh_Attr)) ||
(Brh_Attr == NULL) ) break;
pTeb = NtCurrentTeb();
@@ -387,7 +387,7 @@
HGDIOBJ hGO = NULL;
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return NULL;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return NULL;
switch (iType)
{
@@ -750,7 +750,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return CLR_INVALID;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return CLR_INVALID;
return (COLORREF) Dc_Attr->ulPenClr;
}
@@ -765,7 +765,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return CLR_INVALID;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return CLR_INVALID;
return (COLORREF) Dc_Attr->ulPenClr;
}
@@ -782,7 +782,7 @@
PDC_ATTR Dc_Attr;
COLORREF OldColor = CLR_INVALID;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return OldColor;
else
{
OldColor = (COLORREF) Dc_Attr->ulBrushClr;
@@ -810,7 +810,7 @@
PDC_ATTR Dc_Attr;
COLORREF OldColor = CLR_INVALID;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return OldColor;
else
{
OldColor = (COLORREF) Dc_Attr->ulPenClr;
@@ -834,7 +834,7 @@
GetBkColor(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->ulBackgroundClr;
}
@@ -851,7 +851,7 @@
PDC_ATTR Dc_Attr;
COLORREF OldColor = CLR_INVALID;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return OldColor;
#if 0
if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
{
@@ -892,7 +892,7 @@
GetBkMode(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->lBkMode;
}
@@ -908,7 +908,7 @@
PDC_ATTR Dc_Attr;
INT OldMode = 0;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldMode;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return OldMode;
#if 0
if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)
{
@@ -944,7 +944,7 @@
GetPolyFillMode(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->lFillMode;
}
@@ -978,7 +978,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc)
{
@@ -1004,7 +1004,7 @@
GetGraphicsMode(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->iGraphicsMode;
}
@@ -1023,7 +1023,7 @@
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
if (iMode == Dc_Attr->iGraphicsMode) return iMode;
@@ -1234,7 +1234,7 @@
GetMapMode(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->iMapMode;
}
@@ -1249,7 +1249,7 @@
)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
#if 0
if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)
{
@@ -1274,7 +1274,7 @@
GetStretchBltMode(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->lStretchBltMode;
}
@@ -1307,7 +1307,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
oSMode = Dc_Attr->lStretchBltMode;
Dc_Attr->lStretchBltMode = iStretchMode;
@@ -1328,7 +1328,7 @@
GetHFONT(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return NULL;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return NULL;
return Dc_Attr->hlfntNew;
}
Modified: trunk/reactos/dll/win32/gdi32/objects/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/pa…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/painting.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/painting.c Thu Nov 29 08:21:19 2007
@@ -59,7 +59,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if ( Point )
{
Modified: trunk/reactos/dll/win32/gdi32/objects/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/te…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/text.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/text.c Thu Nov 29 08:21:19 2007
@@ -55,8 +55,7 @@
GdiGetCodePage(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
if (Dc_Attr->ulDirty_ & DIRTY_CHARSET) return LOWORD(NtGdiGetCharSet(hdc));
return LOWORD(Dc_Attr->iCS_CP);
}
@@ -73,8 +72,7 @@
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hDc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hDc) != GDI_OBJECT_TYPE_DC)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->lTextExtra;
// return GetDCDWord( hDc, GdiGetTextCharExtra, 0);
}
@@ -444,8 +442,7 @@
return MFDRV_SetTextCharacterExtra( hDC, CharExtra ); // Wine port.
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC)) return cExtra;
+ if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return cExtra;
if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hDC)
{
@@ -470,8 +467,7 @@
GetTextAlign(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->lTextAlign;
}
@@ -485,8 +481,7 @@
GetTextColor(HDC hdc)
{
PDC_ATTR Dc_Attr;
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return 0;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return 0;
return Dc_Attr->ulForegroundClr;
}
@@ -522,8 +517,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return OldMode;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return OldMode;
OldMode = Dc_Attr->lTextAlign;
Dc_Attr->lTextAlign = fMode; // Raw
@@ -569,8 +563,7 @@
}
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return OldColor;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return OldColor;
OldColor = (COLORREF) Dc_Attr->ulForegroundClr;
Dc_Attr->ulForegroundClr = (ULONG) crColor;
@@ -606,8 +599,7 @@
return FALSE;
}
#endif
- if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr) ||
- (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return FALSE;
+ if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr))
return FALSE;
if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc)
{