Author: jimtabor
Date: Mon Nov 19 10:41:11 2007
New Revision: 30573
URL:
http://svn.reactos.org/svn/reactos?rev=30573&view=rev
Log:
Add a test for VM address space when accessing user data.
Modified:
trunk/reactos/dll/win32/gdi32/gdi32.rbuild
trunk/reactos/dll/win32/gdi32/misc/misc.c
Modified: trunk/reactos/dll/win32/gdi32/gdi32.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/gdi32.rbui…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/gdi32.rbuild (original)
+++ trunk/reactos/dll/win32/gdi32/gdi32.rbuild Mon Nov 19 10:41:11 2007
@@ -9,6 +9,7 @@
<library>kernel32</library>
<library>advapi32</library>
<library>win32ksys</library>
+ <library>pseh</library>
<directory name="include">
<pch>precomp.h</pch>
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 (original)
+++ trunk/reactos/dll/win32/gdi32/misc/misc.c Mon Nov 19 10:41:11 2007
@@ -124,8 +124,25 @@
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);