mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 12:23:25 +00:00
Add a test for VM address space when accessing user data.
svn path=/trunk/; revision=30573
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
<library>kernel32</library>
|
||||
<library>advapi32</library>
|
||||
<library>win32ksys</library>
|
||||
<library>pseh</library>
|
||||
|
||||
<directory name="include">
|
||||
<pch>precomp.h</pch>
|
||||
|
||||
@@ -124,8 +124,25 @@ BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, PVOID *UserData)
|
||||
HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
|
||||
if(pid == NULL || pid == CurrentProcessId)
|
||||
{
|
||||
*UserData = Entry->UserData;
|
||||
return TRUE;
|
||||
//
|
||||
// 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;
|
||||
_SEH_TRY
|
||||
{
|
||||
*Current = *Current;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Result = FALSE;
|
||||
}
|
||||
_SEH_END
|
||||
}
|
||||
if (Result) *UserData = Entry->UserData;
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
||||
Reference in New Issue
Block a user