Author: tkreuzer
Date: Tue Oct 28 00:16:18 2014
New Revision: 65058
URL:
http://svn.reactos.org/svn/reactos?rev=65058&view=rev
Log:
[GDI32]
- Handle GDILoObjType_LO_ALTDC_TYPE in GdiGetDcAttr
- Rewrite GdiGetLDC using GdiGetDcAttr
- Implement GdiSetLDC
Modified:
trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h
trunk/reactos/win32ss/gdi/gdi32/misc/misc.c
Modified: trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/include/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/include/gdi32p.h [iso-8859-1] Tue Oct 28 00:16:18
2014
@@ -213,6 +213,10 @@
FASTCALL
GdiGetLDC(HDC hDC);
+BOOL
+FASTCALL
+GdiSetLDC(HDC hdc, PVOID pvLDC);
+
HGDIOBJ
WINAPI
GdiFixUpHandle(HGDIOBJ hGO);
@@ -369,9 +373,23 @@
PDC_ATTR
GdiGetDcAttr(HDC hdc)
{
+ GDILOOBJTYPE eDcObjType;
PDC_ATTR pdcattr;
- if (!GdiGetHandleUserData((HGDIOBJ)hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr))
return NULL;
+ /* Check DC object type */
+ eDcObjType = GDI_HANDLE_GET_TYPE(hdc);
+ if ((eDcObjType != GDILoObjType_LO_DC_TYPE) &&
+ (eDcObjType != GDILoObjType_LO_ALTDC_TYPE))
+ {
+ return NULL;
+ }
+
+ /* Get the DC attribute */
+ if (!GdiGetHandleUserData((HGDIOBJ)hdc, eDcObjType, (PVOID*)&pdcattr))
+ {
+ return NULL;
+ }
+
return pdcattr;
}
Modified: trunk/reactos/win32ss/gdi/gdi32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/misc/mis…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/misc/misc.c [iso-8859-1] Tue Oct 28 00:16:18 2014
@@ -145,40 +145,39 @@
PLDC
FASTCALL
-GdiGetLDC(HDC hDC)
-{
- PDC_ATTR Dc_Attr;
- PGDI_TABLE_ENTRY Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX((HGDIOBJ) hDC);
- HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
- // Don't check the mask, just the object type.
- if ( Entry->ObjectType == GDIObjType_DC_TYPE &&
- (pid == NULL || pid == CurrentProcessId) )
- {
- BOOL Result = TRUE;
- if (Entry->UserData)
- {
- volatile CHAR *Current = (volatile CHAR*)Entry->UserData;
- _SEH2_TRY
- {
- *Current = *Current;
- }
- _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- Result = FALSE;
- }
- _SEH2_END
- }
- else
- Result = FALSE;
-
- if (Result)
- {
- Dc_Attr = (PDC_ATTR)Entry->UserData;
- return Dc_Attr->pvLDC;
- }
- }
- return NULL;
-}
+GdiGetLDC(HDC hdc)
+{
+ PDC_ATTR pdcattr;
+
+ /* Get the DC attribute */
+ pdcattr = GdiGetDcAttr(hdc);
+ if (pdcattr == NULL)
+ {
+ return NULL;
+ }
+
+ /* Return the LDC pointer */
+ return pdcattr->pvLDC;
+}
+
+BOOL
+FASTCALL
+GdiSetLDC(HDC hdc, PVOID pvLDC)
+{
+ PDC_ATTR pdcattr;
+
+ /* Get the DC attribute */
+ pdcattr = GdiGetDcAttr(hdc);
+ if (pdcattr == NULL)
+ {
+ return FALSE;
+ }
+
+ /* Set the LDC pointer */
+ pdcattr->pvLDC = pvLDC;
+ return TRUE;
+}
+
VOID GdiSAPCallback(PLDC pldc)
{