Changeset 5932 for trunk/src/kernel32/wprocess.cpp
- Timestamp:
- Jun 8, 2001, 1:04:26 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/wprocess.cpp
r5666 r5932 1 /* $Id: wprocess.cpp,v 1.12 0 2001-05-07 10:07:40 phallerExp $ */1 /* $Id: wprocess.cpp,v 1.121 2001-06-08 11:04:26 sandervl Exp $ */ 2 2 3 3 /* … … 1696 1696 1697 1697 DWORD Characteristics, SubSystem; 1698 if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem)) { 1699 dprintf(("CreateProcess: not a PE executable!!")); 1700 SetLastError(ERROR_BAD_EXE_FORMAT); 1701 return FALSE; 1702 } 1703 1704 char *lpszPE; 1705 if(SubSystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) { 1706 lpszPE = "PEC.EXE"; 1707 } 1708 else lpszPE = "PE.EXE"; 1709 1710 //SvL: Allright. Before we call O32_CreateProcess, we must take care of 1711 // lpCurrentDirectory ourselves. (Open32 ignores it!) 1712 if(lpCurrentDirectory) { 1713 char *newcmdline; 1714 1715 newcmdline = (char *)malloc(strlen(lpCurrentDirectory) + strlen(cmdline) + 32); 1716 sprintf(newcmdline, "%s /OPT:[CURDIR=%s] %s", lpszPE, lpCurrentDirectory, cmdline); 1717 free(cmdline); 1718 cmdline = newcmdline; 1719 } 1720 else { 1721 char *newcmdline; 1722 1723 newcmdline = (char *)malloc(strlen(cmdline) + 16); 1724 sprintf(newcmdline, "%s %s", lpszPE, cmdline); 1725 free(cmdline); 1726 cmdline = newcmdline; 1727 } 1728 rc = O32_CreateProcess(lpszPE, (LPCSTR)cmdline,lpProcessAttributes, 1729 lpThreadAttributes, bInheritHandles, dwCreationFlags, 1730 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 1731 lpProcessInfo); 1698 if(Win32ImageBase::isPEImage(exename, &Characteristics, &SubSystem) == 0) { 1699 char *lpszPE; 1700 if(SubSystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) { 1701 lpszPE = "PEC.EXE"; 1702 } 1703 else lpszPE = "PE.EXE"; 1704 1705 //SvL: Allright. Before we call O32_CreateProcess, we must take care of 1706 // lpCurrentDirectory ourselves. (Open32 ignores it!) 1707 if(lpCurrentDirectory) { 1708 char *newcmdline; 1709 1710 newcmdline = (char *)malloc(strlen(lpCurrentDirectory) + strlen(cmdline) + 32); 1711 sprintf(newcmdline, "%s /OPT:[CURDIR=%s] %s", lpszPE, lpCurrentDirectory, cmdline); 1712 free(cmdline); 1713 cmdline = newcmdline; 1714 } 1715 else { 1716 char *newcmdline; 1717 1718 newcmdline = (char *)malloc(strlen(cmdline) + 16); 1719 sprintf(newcmdline, "%s %s", lpszPE, cmdline); 1720 free(cmdline); 1721 cmdline = newcmdline; 1722 } 1723 rc = O32_CreateProcess(lpszPE, (LPCSTR)cmdline,lpProcessAttributes, 1724 lpThreadAttributes, bInheritHandles, dwCreationFlags, 1725 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 1726 lpProcessInfo); 1727 } 1728 else {//16 bits windows app 1729 rc = O32_CreateProcess(NULL, (LPCSTR)cmdline,lpProcessAttributes, 1730 lpThreadAttributes, bInheritHandles, dwCreationFlags, 1731 lpEnvironment, lpCurrentDirectory, lpStartupInfo, 1732 lpProcessInfo); 1733 } 1732 1734 if(rc == TRUE) 1733 1735 { … … 1795 1797 PROCESS_INFORMATION procinfo; 1796 1798 DWORD rc; 1799 HINSTANCE hInstance; 1797 1800 1798 1801 dprintf(("KERNEL32: WinExec %s\n", lpCmdLine)); … … 1801 1804 &startinfo, &procinfo) == FALSE) 1802 1805 { 1803 return 0; 1806 hInstance = (HINSTANCE)GetLastError(); 1807 if(hInstance >= 32) { 1808 hInstance = 11; 1809 } 1810 dprintf(("KERNEL32: WinExec failed with rc %d", hInstance)); 1811 return hInstance; 1804 1812 } 1805 1813 //block until the launched app waits for input (or a timeout of 15 seconds) … … 1809 1817 dprintf(("WinExec: WaitForInputIdle %x returned %x", procinfo.hProcess, rc)); 1810 1818 } 1811 return procinfo.hProcess; //correct? 1819 CloseHandle(procinfo.hThread); 1820 CloseHandle(procinfo.hProcess); 1821 return 33; 1812 1822 } 1813 1823 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.