Author: fireball
Date: Sat Mar 28 20:06:17 2009
New Revision: 40269
URL:
http://svn.reactos.org/svn/reactos?rev=40269&view=rev
Log:
- Remove a header structure from memory regions allocated with EngAllocUserMem. Modern
versions of Windows (at least XP and higher) don't do this and instead save this
information elsewhere. Confirmed by Alexandre Julliard's test case for calling
WriteFile with the DIB section bits as buffer (5 less failures now) and by arguing with
Evgeniy Boltik.
Modified:
trunk/reactos/subsystems/win32/win32k/eng/mem.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/mem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/mem.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/mem.c [iso-8859-1] Sat Mar 28 20:06:17 2009
@@ -31,13 +31,6 @@
#define NDEBUG
#include <debug.h>
-
-typedef struct _USERMEMHEADER
- {
- ULONG Tag;
- ULONG MemSize;
- }
-USERMEMHEADER, *PUSERMEMHEADER;
/*
* @implemented
@@ -76,8 +69,7 @@
{
PVOID NewMem = NULL;
NTSTATUS Status;
- SIZE_T MemSize = sizeof(USERMEMHEADER) + cj;
- PUSERMEMHEADER Header;
+ SIZE_T MemSize = cj;
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &NewMem, 0, &MemSize,
MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
@@ -86,11 +78,9 @@
return NULL;
}
- Header = (PUSERMEMHEADER) NewMem;
- Header->Tag = Tag;
- Header->MemSize = cj;
+ /* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */
- return (PVOID)(Header + 1);
+ return NewMem;
}
/*
@@ -99,10 +89,12 @@
VOID APIENTRY
EngFreeUserMem(PVOID pv)
{
- PUSERMEMHEADER Header = ((PUSERMEMHEADER) pv) - 1;
+ PVOID BaseAddress = pv;
SIZE_T MemSize = 0;
- ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &Header, &MemSize,
MEM_RELEASE);
+ ZwFreeVirtualMemory(NtCurrentProcess(), &BaseAddress, &MemSize, MEM_RELEASE);
+
+ /* TODO: Remove allocation info from AVL tree */
}