Changeset 5959 for trunk/src


Ignore:
Timestamp:
Jun 11, 2001, 12:32:18 AM (24 years ago)
Author:
sandervl
Message:

CreateProcess: launch win16 loader for NE executables

Location:
trunk/src/kernel32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winimagebase.cpp

    r5448 r5959  
    1 /* $Id: winimagebase.cpp,v 1.31 2001-04-02 22:51:58 sandervl Exp $ */
     1/* $Id: winimagebase.cpp,v 1.32 2001-06-10 22:32:17 sandervl Exp $ */
    22
    33/*
     
    204204//the Characteristics member of the file header structure)
    205205//******************************************************************************
    206 ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem)
     206ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics,
     207                                DWORD *subsystem, DWORD *fNEExe)
    207208{
    208209 char   filename[CCHMAXPATH];
     
    219220 int    nSections, i;
    220221
     222  if(fNEExe)
     223      *fNEExe = FALSE;
     224
    221225  if (!findDll(szFileName, filename, sizeof(filename)))
    222226  {
     
    279283  }
    280284
    281   if(GetPEFileHeader (win32file, &fh) == FALSE) {
     285  if(GetPEFileHeader (win32file, &fh) == FALSE)
     286  {
     287        if(*(WORD *)PE_HEADER(win32file) == IMAGE_OS2_SIGNATURE) {
     288            if(fNEExe)
     289                *fNEExe = TRUE;
     290        }
    282291        goto failure;
    283292  }
  • trunk/src/kernel32/winimagebase.h

    r5448 r5959  
    1 /* $Id: winimagebase.h,v 1.18 2001-04-02 22:51:58 sandervl Exp $ */
     1/* $Id: winimagebase.h,v 1.19 2001-06-10 22:32:17 sandervl Exp $ */
    22
    33/*
     
    9797//returns ERROR_SUCCESS or error code (Characteristics will contain
    9898//the Characteristics member of the file header structure)
    99 static  ULONG isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem = NULL);
     99static  ULONG isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem, DWORD *fNEExe = NULL);
    100100static  BOOL  findDll(const char *pszFileName, char *pszFullName,
    101101                      int cchFullName, const char *pszAltPath = NULL);
  • trunk/src/kernel32/winimagepeldr.cpp

    r5932 r5959  
    1 /* $Id: winimagepeldr.cpp,v 1.86 2001-06-08 11:04:25 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.87 2001-06-10 22:32:17 sandervl Exp $ */
    22
    33/*
     
    15241524    }
    15251525
    1526     if(isPEImage(modname, NULL) != ERROR_SUCCESS_W)
     1526    if(isPEImage(modname, NULL, NULL) != ERROR_SUCCESS_W)
    15271527    {//LX image, so let OS/2 do all the work for us
    15281528        APIRET rc;
  • trunk/src/kernel32/wprocess.cpp

    r5939 r5959  
    1 /* $Id: wprocess.cpp,v 1.122 2001-06-09 19:46:01 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.123 2001-06-10 22:32:18 sandervl Exp $ */
    22
    33/*
     
    786786
    787787    //test if dll is in PE or LX format
    788     fPE = Win32ImageBase::isPEImage(szModname, &Characteristics);
     788    fPE = Win32ImageBase::isPEImage(szModname, &Characteristics, NULL);
    789789
    790790    /** @sketch
     
    16951695    dprintf(("KERNEL32: CreateProcess %s\n", cmdline));
    16961696   
    1697     DWORD Characteristics, SubSystem;
    1698     if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem) == 0) {
     1697    DWORD Characteristics, SubSystem, fNEExe;
     1698    if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem, &fNEExe) == 0) {
    16991699        char *lpszPE;
    17001700        if(SubSystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) {
     
    17261726                               lpProcessInfo);
    17271727    }
    1728     else {//16 bits windows app
     1728    else
     1729    if(fNEExe) {//16 bits windows app
     1730        char *newcmdline;
     1731       
     1732        newcmdline = (char *)malloc(strlen(cmdline) + 16);
     1733        sprintf(newcmdline, "w16odin.exe %s", cmdline);
     1734        free(cmdline);
     1735        cmdline = newcmdline;
     1736        //Force Open32 to use DosStartSession (DosExecPgm won't do)
     1737        dwCreationFlags |= CREATE_NEW_PROCESS_GROUP;
     1738        rc = O32_CreateProcess("w16odin.exe", (LPCSTR)cmdline, lpProcessAttributes,
     1739                               lpThreadAttributes, bInheritHandles, dwCreationFlags,
     1740                               lpEnvironment, lpCurrentDirectory, lpStartupInfo,
     1741                               lpProcessInfo);
     1742    }
     1743    else {//os/2 app??
    17291744        rc = O32_CreateProcess(NULL, (LPCSTR)cmdline,lpProcessAttributes,
    17301745                               lpThreadAttributes, bInheritHandles, dwCreationFlags,
Note: See TracChangeset for help on using the changeset viewer.