- Timestamp:
- Apr 3, 2001, 12:51:58 AM (24 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagebase.cpp
r4523 r5448 1 /* $Id: winimagebase.cpp,v 1.3 0 2000-10-23 13:42:44sandervl Exp $ */1 /* $Id: winimagebase.cpp,v 1.31 2001-04-02 22:51:58 sandervl Exp $ */ 2 2 3 3 /* … … 204 204 //the Characteristics member of the file header structure) 205 205 //****************************************************************************** 206 ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics )206 ULONG Win32ImageBase::isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem) 207 207 { 208 208 char filename[CCHMAXPATH]; … … 210 210 HFILE dllfile; 211 211 IMAGE_FILE_HEADER fh; 212 IMAGE_OPTIONAL_HEADER oh; 212 213 HFILE win32handle; 213 214 ULONG ulAction = 0; /* Action taken by DosOpen */ … … 262 263 return ERROR_INVALID_EXE_SIGNATURE_W; 263 264 } 264 ULONG hdrsize = pdoshdr->e_lfanew + SIZE_OF_NT_SIGNATURE + sizeof(IMAGE_FILE_HEADER) ;265 ULONG hdrsize = pdoshdr->e_lfanew + SIZE_OF_NT_SIGNATURE + sizeof(IMAGE_FILE_HEADER) + sizeof(IMAGE_OPTIONAL_HEADER); 265 266 free(pdoshdr); 266 267 … … 281 282 goto failure; 282 283 } 284 if(GetPEOptionalHeader (win32file, &oh) == FALSE) { 285 goto failure; 286 } 283 287 284 288 if(!(fh.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE)) {//not valid … … 294 298 if(Characteristics) { 295 299 *Characteristics = fh.Characteristics; 300 } 301 if(subsystem) { 302 *subsystem = oh.Subsystem; 296 303 } 297 304 DosClose(win32handle); -
trunk/src/kernel32/winimagebase.h
r4474 r5448 1 /* $Id: winimagebase.h,v 1.1 7 2000-10-10 17:14:07sandervl Exp $ */1 /* $Id: winimagebase.h,v 1.18 2001-04-02 22:51:58 sandervl Exp $ */ 2 2 3 3 /* … … 97 97 //returns ERROR_SUCCESS or error code (Characteristics will contain 98 98 //the Characteristics member of the file header structure) 99 static ULONG isPEImage(char *szFileName, DWORD *Characteristics = NULL);99 static ULONG isPEImage(char *szFileName, DWORD *Characteristics, DWORD *subsystem = NULL); 100 100 static BOOL findDll(const char *pszFileName, char *pszFullName, 101 101 int cchFullName, const char *pszAltPath = NULL); -
trunk/src/kernel32/winimagepeldr.cpp
r5436 r5448 1 /* $Id: winimagepeldr.cpp,v 1.7 2 2001-04-02 09:52:26sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.73 2001-04-02 22:51:58 sandervl Exp $ */ 2 2 3 3 /* … … 1469 1469 } 1470 1470 1471 if(isPEImage(modname ) != ERROR_SUCCESS_W)1471 if(isPEImage(modname, NULL) != ERROR_SUCCESS_W) 1472 1472 {//LX image, so let OS/2 do all the work for us 1473 1473 APIRET rc; -
trunk/src/kernel32/wprocess.cpp
r5354 r5448 1 /* $Id: wprocess.cpp,v 1.11 6 2001-03-22 18:16:41sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.117 2001-04-02 22:51:58 sandervl Exp $ */ 2 2 3 3 /* … … 1651 1651 } 1652 1652 1653 dprintf(("KERNEL32: CreateProcess %s\n", cmdline)); 1653 dprintf(("KERNEL32: CreateProcess %s\n", cmdline)); 1654 1655 DWORD Characteristics, SubSystem; 1656 if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem)) { 1657 dprintf(("CreateProcess: not a PE executable!!")); 1658 SetLastError(ERROR_BAD_EXE_FORMAT); 1659 return FALSE; 1660 } 1661 1662 char *lpszPE; 1663 if(SubSystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) { 1664 lpszPE = "PEC.EXE"; 1665 } 1666 else lpszPE = "PE.EXE"; 1654 1667 1655 1668 //SvL: Allright. Before we call O32_CreateProcess, we must take care of … … 1659 1672 1660 1673 newcmdline = (char *)malloc(strlen(lpCurrentDirectory) + strlen(cmdline) + 32); 1661 sprintf(newcmdline, " PE.EXE /OPT:[CURDIR=%s] %s", lpCurrentDirectory, cmdline);1674 sprintf(newcmdline, "%s /OPT:[CURDIR=%s] %s", lpszPE, lpCurrentDirectory, cmdline); 1662 1675 free(cmdline); 1663 1676 cmdline = newcmdline; … … 1667 1680 1668 1681 newcmdline = (char *)malloc(strlen(cmdline) + 16); 1669 sprintf(newcmdline, " PE.EXE %s", cmdline);1682 sprintf(newcmdline, "%s %s", lpszPE, cmdline); 1670 1683 free(cmdline); 1671 1684 cmdline = newcmdline; 1672 1685 } 1673 rc = O32_CreateProcess( "PE.EXE", (LPCSTR)cmdline,lpProcessAttributes,1686 rc = O32_CreateProcess(lpszPE, (LPCSTR)cmdline,lpProcessAttributes, 1674 1687 lpThreadAttributes, bInheritHandles, dwCreationFlags, 1675 1688 lpEnvironment, lpCurrentDirectory, lpStartupInfo,
Note:
See TracChangeset
for help on using the changeset viewer.