mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 23:32:59 +00:00
[GDI32]
Fix gdi32:CreatePen apitest svn path=/trunk/; revision=51161
This commit is contained in:
parent
68af0e9cd1
commit
291012914d
1 changed files with 16 additions and 30 deletions
|
@ -124,38 +124,24 @@ BOOL GdiIsHandleValid(HGDIOBJ hGdiObj)
|
|||
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))
|
||||
|
||||
/* 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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue