Index: trunk/src/kernel32/winimagebase.cpp
===================================================================
--- trunk/src/kernel32/winimagebase.cpp	(revision 5956)
+++ trunk/src/kernel32/winimagebase.cpp	(revision 5959)
@@ -1,3 +1,3 @@
-/* $Id: winimagebase.cpp,v 1.31 2001-04-02 22:51:58 sandervl Exp $ */
+/* $Id: winimagebase.cpp,v 1.32 2001-06-10 22:32:17 sandervl Exp $ */
 
 /*
@@ -204,5 +204,6 @@
 //the Characteristics member of the file header structure)
 //******************************************************************************
-ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem)
+ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics, 
+                                DWORD *subsystem, DWORD *fNEExe)
 {
  char   filename[CCHMAXPATH];
@@ -219,4 +220,7 @@
  int    nSections, i;
 
+  if(fNEExe) 
+      *fNEExe = FALSE;
+
   if (!findDll(szFileName, filename, sizeof(filename)))
   {
@@ -279,5 +283,10 @@
   }
 
-  if(GetPEFileHeader (win32file, &fh) == FALSE) {
+  if(GetPEFileHeader (win32file, &fh) == FALSE) 
+  {
+        if(*(WORD *)PE_HEADER(win32file) == IMAGE_OS2_SIGNATURE) {
+            if(fNEExe) 
+                *fNEExe = TRUE;
+        }
         goto failure;
   }
Index: trunk/src/kernel32/winimagebase.h
===================================================================
--- trunk/src/kernel32/winimagebase.h	(revision 5956)
+++ trunk/src/kernel32/winimagebase.h	(revision 5959)
@@ -1,3 +1,3 @@
-/* $Id: winimagebase.h,v 1.18 2001-04-02 22:51:58 sandervl Exp $ */
+/* $Id: winimagebase.h,v 1.19 2001-06-10 22:32:17 sandervl Exp $ */
 
 /*
@@ -97,5 +97,5 @@
 //returns ERROR_SUCCESS or error code (Characteristics will contain
 //the Characteristics member of the file header structure)
-static  ULONG isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem = NULL);
+static  ULONG isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem, DWORD *fNEExe = NULL);
 static  BOOL  findDll(const char *pszFileName, char *pszFullName,
                       int cchFullName, const char *pszAltPath = NULL);
Index: trunk/src/kernel32/winimagepeldr.cpp
===================================================================
--- trunk/src/kernel32/winimagepeldr.cpp	(revision 5956)
+++ trunk/src/kernel32/winimagepeldr.cpp	(revision 5959)
@@ -1,3 +1,3 @@
-/* $Id: winimagepeldr.cpp,v 1.86 2001-06-08 11:04:25 sandervl Exp $ */
+/* $Id: winimagepeldr.cpp,v 1.87 2001-06-10 22:32:17 sandervl Exp $ */
 
 /*
@@ -1524,5 +1524,5 @@
     }
 
-    if(isPEImage(modname, NULL) != ERROR_SUCCESS_W)
+    if(isPEImage(modname, NULL, NULL) != ERROR_SUCCESS_W)
     {//LX image, so let OS/2 do all the work for us
         APIRET rc;
Index: trunk/src/kernel32/wprocess.cpp
===================================================================
--- trunk/src/kernel32/wprocess.cpp	(revision 5956)
+++ trunk/src/kernel32/wprocess.cpp	(revision 5959)
@@ -1,3 +1,3 @@
-/* $Id: wprocess.cpp,v 1.122 2001-06-09 19:46:01 sandervl Exp $ */
+/* $Id: wprocess.cpp,v 1.123 2001-06-10 22:32:18 sandervl Exp $ */
 
 /*
@@ -786,5 +786,5 @@
 
     //test if dll is in PE or LX format
-    fPE = Win32ImageBase::isPEImage(szModname, &Characteristics);
+    fPE = Win32ImageBase::isPEImage(szModname, &Characteristics, NULL);
 
     /** @sketch
@@ -1695,6 +1695,6 @@
     dprintf(("KERNEL32: CreateProcess %s\n", cmdline));
     
-    DWORD Characteristics, SubSystem;
-    if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem) == 0) {
+    DWORD Characteristics, SubSystem, fNEExe;
+    if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem, &fNEExe) == 0) {
         char *lpszPE;
         if(SubSystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) {
@@ -1726,5 +1726,20 @@
                                lpProcessInfo);
     }
-    else {//16 bits windows app
+    else 
+    if(fNEExe) {//16 bits windows app
+        char *newcmdline;
+        
+        newcmdline = (char *)malloc(strlen(cmdline) + 16);
+        sprintf(newcmdline, "w16odin.exe %s", cmdline);
+        free(cmdline);
+        cmdline = newcmdline;
+        //Force Open32 to use DosStartSession (DosExecPgm won't do)
+        dwCreationFlags |= CREATE_NEW_PROCESS_GROUP;
+        rc = O32_CreateProcess("w16odin.exe", (LPCSTR)cmdline, lpProcessAttributes,
+                               lpThreadAttributes, bInheritHandles, dwCreationFlags,
+                               lpEnvironment, lpCurrentDirectory, lpStartupInfo,
+                               lpProcessInfo);
+    }
+    else {//os/2 app??
         rc = O32_CreateProcess(NULL, (LPCSTR)cmdline,lpProcessAttributes,
                                lpThreadAttributes, bInheritHandles, dwCreationFlags,
