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

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2021-11-04 14:55:42 +03:00 committed by Alexandre Julliard
parent b1ae6fd3f4
commit 1722615b06
1 changed files with 3 additions and 2 deletions

View File

@ -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 )))