kernel32: LOADPARAMS16->showCmd can be NULL, to not crash in that case

Dmitry Timoshkov dmitry at codeweavers.com
Thu Jan 31 00:08:08 CST 2008


Hello,

this patch fixes a crash in a 16-bit application reported in the bug 3766.

Changelog:
    kernel32: LOADPARAMS16->showCmd can be NULL, to not crash in that case.

diff --git a/dlls/kernel32/ne_module.c b/dlls/kernel32/ne_module.c
index e41ced9..09e3175 100644
--- a/dlls/kernel32/ne_module.c
+++ b/dlls/kernel32/ne_module.c
@@ -1193,7 +1193,7 @@ HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock )
     HMODULE16 hModule;
     NE_MODULE *pModule;
     LPSTR cmdline;
-    WORD cmdShow;
+    WORD cmdShow = 1; /* SW_SHOWNORMAL but we don't want to include winuser.h here */
 
     if (name == NULL) return 0;
 
@@ -1235,7 +1235,8 @@ HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock )
      *  information.
      */
     params = (LOADPARAMS16 *)paramBlock;
-    cmdShow = ((WORD *)MapSL(params->showCmd))[1];
+    if (params->showCmd)
+        cmdShow = ((WORD *)MapSL( params->showCmd ))[1];
     cmdline = MapSL( params->cmdLine );
     return NE_CreateThread( pModule, cmdShow, cmdline );
 }





More information about the wine-patches mailing list