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

Alexandre Julliard julliard at winehq.org
Tue Apr 13 16:31:20 CDT 2021


Module: wine
Branch: master
Commit: 8ffb9b31d0863ec95688ebda7fe05ba952eb8a42
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8ffb9b31d0863ec95688ebda7fe05ba952eb8a42

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr 13 12:09:53 2021 +0200

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

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/process.c | 12 ++++++++++++
 dlls/ntdll/loader.c           |  5 -----
 dlls/ntdll/unix/virtual.c     | 12 ++++++++++++
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 433c12ff1fb..b932a3c2a15 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -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());
 
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 160a16daff8..153b4a02769 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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 );
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 659ad2421d4..b0ff26ade53 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -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;




More information about the wine-cvs mailing list