mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:15:59 +00:00
Add a test for VM address space when accessing user data.
svn path=/trunk/; revision=30573
This commit is contained in:
parent
effad19afc
commit
daffd42203
2 changed files with 20 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue