Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/ntdll/unix/virtual.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 756a7388a22..3dc06d520dd 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2985,6 +2985,7 @@ static TEB *init_teb( void *ptr, BOOL is_wow ) */ TEB *virtual_alloc_first_teb(void) { + static const BOOL is_wow = FALSE; void *ptr; NTSTATUS status; SIZE_T data_size = page_size; @@ -3000,14 +3001,14 @@ TEB *virtual_alloc_first_teb(void) exit(1); }
- NtAllocateVirtualMemory( NtCurrentProcess(), &teb_block, is_win64 ? 0x7fffffff : 0, &total, + NtAllocateVirtualMemory( NtCurrentProcess(), &teb_block, is_win64 && is_wow ? 0x7fffffff : 0, &total, MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE ); teb_block_pos = 30; ptr = (char *)teb_block + 30 * block_size; data_size = 2 * block_size; NtAllocateVirtualMemory( NtCurrentProcess(), (void **)&ptr, 0, &data_size, MEM_COMMIT, PAGE_READWRITE ); peb = (PEB *)((char *)teb_block + 31 * block_size + (is_win64 ? 0 : page_size)); - return init_teb( ptr, FALSE ); + return init_teb( ptr, is_wow ); }
@@ -3021,6 +3022,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 +3037,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 +3050,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 )))
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=101286
Your paranoid android.
=== debiant2 (64 bit WoW report) ===
ntdll: env.c:461: Test failed: wrong end ptr 000000000024195C/0000000000241960