Commit 149e7502 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Support wow64 in NtAllocateVirtualMemory calls.

parent 2b6647cd
...@@ -112,8 +112,8 @@ static DC_ATTR *alloc_dc_attr(void) ...@@ -112,8 +112,8 @@ static DC_ATTR *alloc_dc_attr(void)
{ {
SIZE_T size = system_info.AllocationGranularity; SIZE_T size = system_info.AllocationGranularity;
bucket->entries = NULL; bucket->entries = NULL;
if (!NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&bucket->entries, 0, &size, if (!NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&bucket->entries, zero_bits(),
MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE )) &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE ))
{ {
bucket->next_free = NULL; bucket->next_free = NULL;
bucket->next_unused = bucket->entries + 1; bucket->next_unused = bucket->entries + 1;
......
...@@ -1548,8 +1548,8 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con ...@@ -1548,8 +1548,8 @@ HBITMAP WINAPI NtGdiCreateDIBSection( HDC hdc, HANDLE section, DWORD offset, con
{ {
SIZE_T size = bmp->dib.dsBmih.biSizeImage; SIZE_T size = bmp->dib.dsBmih.biSizeImage;
offset = 0; offset = 0;
if (NtAllocateVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, 0, &size, if (NtAllocateVirtualMemory( GetCurrentProcess(), &bmp->dib.dsBm.bmBits, zero_bits(),
MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE )) &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE ))
goto error; goto error;
} }
bmp->dib.dshSection = section; bmp->dib.dshSection = section;
......
...@@ -566,8 +566,8 @@ static void init_gdi_shared(void) ...@@ -566,8 +566,8 @@ static void init_gdi_shared(void)
{ {
SIZE_T size = sizeof(*gdi_shared); SIZE_T size = sizeof(*gdi_shared);
if (NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&gdi_shared, 0, &size, if (NtAllocateVirtualMemory( GetCurrentProcess(), (void **)&gdi_shared, zero_bits(),
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE )) &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE ))
return; return;
next_unused = gdi_shared->Handles + FIRST_GDI_HANDLE; next_unused = gdi_shared->Handles + FIRST_GDI_HANDLE;
......
...@@ -494,6 +494,15 @@ static inline BOOL is_win9x(void) ...@@ -494,6 +494,15 @@ static inline BOOL is_win9x(void)
return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s; return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s;
} }
static inline ULONG_PTR zero_bits(void)
{
#ifdef _WIN64
return !NtCurrentTeb()->WowTebOffset ? 0 : 0x7fffffff;
#else
return 0;
#endif
}
static inline const char *debugstr_us( const UNICODE_STRING *us ) static inline const char *debugstr_us( const UNICODE_STRING *us )
{ {
if (!us) return "<null>"; if (!us) return "<null>";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment