Alexandre Julliard : krnl386: Fetch version from the PEB to avoid potentially using GetVersionEx before it 's initialized.

Alexandre Julliard julliard at winehq.org
Thu Apr 7 07:36:45 CDT 2011


Module: wine
Branch: stable
Commit: a62026f05fa210f34f5d55c1536df1be2774a4f0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a62026f05fa210f34f5d55c1536df1be2774a4f0

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec 15 13:17:41 2010 +0100

krnl386: Fetch version from the PEB to avoid potentially using GetVersionEx before it's initialized.
(cherry picked from commit 5ce81a9dc2f727dfb8d3fb5db5ea8d0c79459faf)

---

 dlls/krnl386.exe16/ne_module.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/dlls/krnl386.exe16/ne_module.c b/dlls/krnl386.exe16/ne_module.c
index 9f777cc..0bf4bd5 100644
--- a/dlls/krnl386.exe16/ne_module.c
+++ b/dlls/krnl386.exe16/ne_module.c
@@ -917,7 +917,6 @@ static HMODULE16 NE_DoLoadBuiltinModule( const IMAGE_DOS_HEADER *mz_header, cons
     NE_MODULE *pModule;
     HMODULE16 hModule;
     HINSTANCE16 hInstance;
-    OSVERSIONINFOW versionInfo;
     SIZE_T mapping_size = ~0UL;  /* assume builtins don't contain invalid offsets... */
 
     hModule = build_module( mz_header, mapping_size, file_name );
@@ -927,9 +926,8 @@ static HMODULE16 NE_DoLoadBuiltinModule( const IMAGE_DOS_HEADER *mz_header, cons
     pModule->owner32 = owner32;
 
     /* fake the expected version the module should have according to the current Windows version */
-    versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
-    if (GetVersionExW( &versionInfo ))
-        pModule->ne_expver = MAKEWORD( versionInfo.dwMinorVersion, versionInfo.dwMajorVersion );
+    pModule->ne_expver = MAKEWORD( NtCurrentTeb()->Peb->OSMajorVersion,
+                                   NtCurrentTeb()->Peb->OSMinorVersion );
 
     hInstance = NE_DoLoadModule( pModule );
     if (hInstance < 32) NE_FreeModule( hModule, 0 );




More information about the wine-cvs mailing list