Commit 1722615b authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Don't constraint TEB address to 2GB for native x64 process.

parent b1ae6fd3
......@@ -3021,6 +3021,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
void *ptr = NULL;
NTSTATUS status = STATUS_SUCCESS;
SIZE_T block_size = signal_stack_mask + 1;
BOOL is_wow = !!NtCurrentTeb()->WowTebOffset;
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
if (next_free_teb)
......@@ -3035,7 +3036,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
{
SIZE_T total = 32 * block_size;
if ((status = NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, is_win64 ? 0x7fffffff : 0,
if ((status = NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, is_win64 && is_wow ? 0x7fffffff : 0,
&total, MEM_RESERVE, PAGE_READWRITE )))
{
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
......@@ -3048,7 +3049,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
NtAllocateVirtualMemory( NtCurrentProcess(), (void **)&ptr, 0, &block_size,
MEM_COMMIT, PAGE_READWRITE );
}
*ret_teb = teb = init_teb( ptr, !!NtCurrentTeb()->WowTebOffset );
*ret_teb = teb = init_teb( ptr, is_wow );
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
if ((status = signal_alloc_thread( teb )))
......
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