Author: rharabien
Date: Sat Mar 26 15:24:05 2011
New Revision: 51161
URL:
http://svn.reactos.org/svn/reactos?rev=51161&view=rev
Log:
[GDI32]
Fix gdi32:CreatePen apitest
Modified:
trunk/reactos/dll/win32/gdi32/misc/misc.c
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 [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/misc/misc.c [iso-8859-1] Sat Mar 26 15:24:05 2011
@@ -124,38 +124,24 @@
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) == ObjectType &&
- ( (Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK
) ==
- GDI_HANDLE_GET_TYPE(hGdiObj))
- {
- HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
- if(pid == NULL || pid == CurrentProcessId)
- {
- //
- // Need to test if we have Read & Write access to the VM address space.
- //
- 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; // Can not be zero.
- if (Result) *UserData = Entry->UserData;
- return Result;
- }
- }
- SetLastError(ERROR_INVALID_PARAMETER);
- return FALSE;
+
+ /* Check if twe have the correct type */
+ if (GDI_HANDLE_GET_TYPE(hGdiObj) != ObjectType ||
+ ((Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK) !=
ObjectType ||
+ (Entry->Type & GDI_ENTRY_BASETYPE_MASK) != (ObjectType &
GDI_ENTRY_BASETYPE_MASK))
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ /* Check if we are the owner */
+ if ((HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1) != CurrentProcessId)
+ {
+ return FALSE;
+ }
+
+ *UserData = Entry->UserData;
+ return TRUE;
}
PLDC