ntdll: Initialize version and session id on the Unix side.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-04-13 12:09:53 +02:00
parent 4904d90870
commit 8ffb9b31d0
3 changed files with 24 additions and 5 deletions

View File

@ -3455,6 +3455,18 @@ static void test_SuspendProcessState(void)
"wrong entry point %p/%p\n", entry_ptr,
(char *)exe_base + nt_header.OptionalHeader.AddressOfEntryPoint );
ok( !child_peb.LdrData, "LdrData set %p\n", child_peb.LdrData );
ok( !child_peb.FastPebLock, "FastPebLock set %p\n", child_peb.FastPebLock );
ok( !child_peb.TlsBitmap, "TlsBitmap set %p\n", child_peb.TlsBitmap );
ok( !child_peb.TlsExpansionBitmap, "TlsExpansionBitmap set %p\n", child_peb.TlsExpansionBitmap );
ok( !child_peb.LoaderLock, "LoaderLock set %p\n", child_peb.LoaderLock );
ok( !child_peb.ProcessHeap, "ProcessHeap set %p\n", child_peb.ProcessHeap );
ok( !child_peb.CSDVersion.Buffer, "CSDVersion set %s\n", debugstr_w(child_peb.CSDVersion.Buffer) );
ok( child_peb.OSMajorVersion, "OSMajorVersion not set %u\n", child_peb.OSMajorVersion );
ok( child_peb.OSPlatformId == VER_PLATFORM_WIN32_NT, "OSPlatformId not set %u\n", child_peb.OSPlatformId );
ok( child_peb.SessionId == 1, "SessionId not set %u\n", child_peb.SessionId );
ret = SetThreadContext(pi.hThread, &ctx);
ok(ret, "Failed to set remote thread context (%d)\n", GetLastError());

View File

@ -3636,11 +3636,6 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
peb->TlsBitmap = &tls_bitmap;
peb->TlsExpansionBitmap = &tls_expansion_bitmap;
peb->LoaderLock = &loader_section;
peb->OSMajorVersion = 5;
peb->OSMinorVersion = 1;
peb->OSBuildNumber = 0xA28;
peb->OSPlatformId = VER_PLATFORM_WIN32_NT;
peb->SessionId = 1;
peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL );
RtlInitializeBitMap( &tls_bitmap, peb->TlsBitmapBits, sizeof(peb->TlsBitmapBits) * 8 );

View File

@ -2805,6 +2805,17 @@ NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_nam
}
/* set some initial values in the new PEB */
static void init_peb( PEB *peb )
{
peb->OSMajorVersion = 6;
peb->OSMinorVersion = 1;
peb->OSBuildNumber = 0x1db1;
peb->OSPlatformId = VER_PLATFORM_WIN32_NT;
peb->SessionId = 1;
}
/* set some initial values in a new TEB */
static void init_teb( TEB *teb, PEB *peb )
{
@ -2870,6 +2881,7 @@ TEB *virtual_alloc_first_teb(void)
peb = (PEB *)((char *)teb_block + 32 * block_size - peb_size);
NtAllocateVirtualMemory( NtCurrentProcess(), (void **)&ptr, 0, &block_size, MEM_COMMIT, PAGE_READWRITE );
NtAllocateVirtualMemory( NtCurrentProcess(), (void **)&peb, 0, &peb_size, MEM_COMMIT, PAGE_READWRITE );
init_peb( peb );
init_teb( teb, peb );
*(ULONG_PTR *)&peb->CloudFileFlags = get_image_address();
return teb;