mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 08:25:53 +00:00
- 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.
svn path=/trunk/; revision=40269
This commit is contained in:
parent
b5ceb7733a
commit
02258e7e39
|
@ -32,13 +32,6 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
typedef struct _USERMEMHEADER
|
|
||||||
{
|
|
||||||
ULONG Tag;
|
|
||||||
ULONG MemSize;
|
|
||||||
}
|
|
||||||
USERMEMHEADER, *PUSERMEMHEADER;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -76,8 +69,7 @@ EngAllocUserMem(SIZE_T cj, ULONG Tag)
|
||||||
{
|
{
|
||||||
PVOID NewMem = NULL;
|
PVOID NewMem = NULL;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
SIZE_T MemSize = sizeof(USERMEMHEADER) + cj;
|
SIZE_T MemSize = cj;
|
||||||
PUSERMEMHEADER Header;
|
|
||||||
|
|
||||||
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &NewMem, 0, &MemSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
Status = ZwAllocateVirtualMemory(NtCurrentProcess(), &NewMem, 0, &MemSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||||
|
|
||||||
|
@ -86,11 +78,9 @@ EngAllocUserMem(SIZE_T cj, ULONG Tag)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Header = (PUSERMEMHEADER) NewMem;
|
/* TODO: Add allocation info to AVL tree (stored inside W32PROCESS structure) */
|
||||||
Header->Tag = Tag;
|
|
||||||
Header->MemSize = cj;
|
|
||||||
|
|
||||||
return (PVOID)(Header + 1);
|
return NewMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -99,10 +89,12 @@ EngAllocUserMem(SIZE_T cj, ULONG Tag)
|
||||||
VOID APIENTRY
|
VOID APIENTRY
|
||||||
EngFreeUserMem(PVOID pv)
|
EngFreeUserMem(PVOID pv)
|
||||||
{
|
{
|
||||||
PUSERMEMHEADER Header = ((PUSERMEMHEADER) pv) - 1;
|
PVOID BaseAddress = pv;
|
||||||
SIZE_T MemSize = 0;
|
SIZE_T MemSize = 0;
|
||||||
|
|
||||||
ZwFreeVirtualMemory(NtCurrentProcess(), (PVOID *) &Header, &MemSize, MEM_RELEASE);
|
ZwFreeVirtualMemory(NtCurrentProcess(), &BaseAddress, &MemSize, MEM_RELEASE);
|
||||||
|
|
||||||
|
/* TODO: Remove allocation info from AVL tree */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue