Changeset 8773 for trunk/src/kernel32/wprocess.cpp
- Timestamp:
- Jun 26, 2002, 9:13:00 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/wprocess.cpp
r8694 r8773 1 /* $Id: wprocess.cpp,v 1.15 5 2002-06-16 08:20:36sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.156 2002-06-26 07:13:00 sandervl Exp $ */ 2 2 3 3 /* … … 41 41 42 42 #include "console.h" 43 #include "wincon.h" 43 44 #include "cio.h" 44 45 #include "versionos2.h" /*PLF Wed 98-03-18 02:36:51*/ … … 72 73 //Process database 73 74 PDB ProcessPDB = {0}; 75 ENVDB ProcessENVDB = {0}; 76 CONCTRLDATA ProcessConCtrlData = {0}; 74 77 STARTUPINFOA StartupInfo = {0}; 75 78 CHAR unknownPDBData[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ,0 ,0}; … … 193 196 } 194 197 //****************************************************************************** 195 // Set up the TIB selector and memory for the main thread 198 // Set up the TIB selector and memory for the main thread 196 199 //****************************************************************************** 197 200 TEB *WIN32API InitializeMainThread() … … 240 243 ProcessPDB.tls_bits[1] = 0; 241 244 242 GetSystemTime(&ProcessPDB.creationTime) 245 GetSystemTime(&ProcessPDB.creationTime); 243 246 244 247 /* Initialize the critical section */ 245 InitializeCriticalSection( &ProcessPDB.crit_section ); 248 InitializeCriticalSection(&ProcessPDB.crit_section ); 249 250 //initialize the environment db entry. 251 ProcessPDB.env_db = &ProcessENVDB; 252 ProcessENVDB.startup_info = &StartupInfo; 253 ProcessENVDB.environ = GetEnvironmentStringsA(); 254 ProcessENVDB.cmd_line = (CHAR*)(void*)pszCmdLineA; 255 ProcessENVDB.cmd_lineW = (WCHAR*)(void*)pszCmdLineW; 256 ProcessENVDB.break_handlers = &ProcessConCtrlData; 257 ProcessConCtrlData.fIgnoreCtrlC = FALSE; /* TODO! Should be inherited from parent. */ 258 ProcessConCtrlData.pHead = ProcessConCtrlData.pTail = (PCONCTRL)malloc(sizeof(CONCTRL)); 259 ProcessConCtrlData.pHead->pfnHandler = (void*)DefaultConsoleCtrlHandler; 260 ProcessConCtrlData.pHead->pNext = ProcessConCtrlData.pHead->pPrev = NULL; 261 ProcessConCtrlData.pHead->flFlags = ODIN32_CONCTRL_FLAGS_INIT; 262 InitializeCriticalSection(&ProcessENVDB.section); 246 263 247 264 // ProcessPDB.startup_info = &StartupInfo; 248 265 ProcessPDB.unknown10 = (PVOID)&unknownPDBData[0]; 249 266 StartupInfo.cb = sizeof(StartupInfo); 250 StartupInfo.hStdInput= GetStdHandle(STD_INPUT_HANDLE);251 StartupInfo.hStdOutput= GetStdHandle(STD_OUTPUT_HANDLE);252 StartupInfo.hStdError= GetStdHandle(STD_ERROR_HANDLE);267 ProcessENVDB.hStdin = StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); 268 ProcessENVDB.hStdout = StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); 269 ProcessENVDB.hStderr = StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); 253 270 254 271 return teb; … … 295 312 SID_IDENTIFIER_AUTHORITY sidIdAuth = {0}; 296 313 winteb->o.odin.threadinfo.dwType = SECTYPE_PROCESS | SECTYPE_INITIALIZED; 297 314 298 315 if (NULL != RtlAllocateAndInitializeSid) { 299 316 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &winteb->o.odin.threadinfo.SidUser.User.Sid); … … 305 322 winteb->o.odin.threadinfo.pTokenGroups = (TOKEN_GROUPS*)malloc(sizeof(TOKEN_GROUPS)); 306 323 winteb->o.odin.threadinfo.pTokenGroups->GroupCount = 1; 307 324 308 325 if (NULL != RtlAllocateAndInitializeSid) { 309 326 RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &winteb->o.odin.threadinfo.PrimaryGroup.PrimaryGroup); 310 327 } 311 328 else DebugInt3(); 312 329 313 330 winteb->o.odin.threadinfo.pTokenGroups->Groups[0].Sid = winteb->o.odin.threadinfo.PrimaryGroup.PrimaryGroup; 314 331 winteb->o.odin.threadinfo.pTokenGroups->Groups[0].Attributes = 0; //???? … … 475 492 } 476 493 threadListMutex.leave(); 477 478 494 495 479 496 #ifdef PROFILE 480 497 // Note: after this point we do not expect any more Win32-API calls, … … 485 502 ProfilerTerminate(); 486 503 #endif /* PROFILE */ 487 504 488 505 //Restore original OS/2 TIB selector 489 506 teb = GetThreadTEB(); … … 1223 1240 */ 1224 1241 cch = strlen(pszPeExe)+1; 1225 1242 1226 1243 // PH 2002-04-11 1227 1244 // Note: intentional memory leak, pszCmdLineW will not be freed … … 1466 1483 Win32ImageBase * pMod; /* Pointer to the module object. */ 1467 1484 DWORD cch = 0; /* Length of the */ 1468 1485 1469 1486 // PH 2002-04-24 Note: 1470 1487 // WIN2k just crashes in NTDLL if lpszPath is invalid! … … 1490 1507 // write it additionally, uncounted 1491 1508 lpszPath[cch] = '\0'; 1492 1509 1493 1510 memcpy(lpszPath, pszFn, cch); 1494 1511 } … … 1612 1629 if(WinExe) 1613 1630 hMod = WinExe->getInstanceHandle(); 1614 else 1631 else 1615 1632 { 1616 1633 // // Just fail this API … … 1659 1676 if (NULL != lpwszModuleName) 1660 1677 astring = UnicodeToAsciiString((LPWSTR)lpwszModuleName); 1661 1678 1662 1679 rc = GetModuleHandleA(astring); 1663 1680 dprintf(("KERNEL32: OS2GetModuleHandleW %s returned %X\n", astring, rc)); 1664 1681 1665 1682 if (NULL != astring) 1666 1683 FreeAsciiString(astring); 1667 1684 1668 1685 return(rc); 1669 1686 } … … 1844 1861 // calculate base length for the new command line 1845 1862 iNewCommandLineLength = strlen(szAppName) + strlen(lpCommandLine); 1846 1863 1847 1864 if(SubSystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) 1848 1865 lpszExecutable = "PEC.EXE"; 1849 1866 else 1850 1867 lpszExecutable = "PE.EXE"; 1851 1868 1852 1869 lpszPE = lpszExecutable; 1853 1870 1854 1871 // 2002-04-24 PH 1855 1872 // set the ODIN32.DEBUG_CHILD environment variable to start new PE processes … … 1864 1881 strcat(debug_szPE, " "); 1865 1882 strcat(debug_szPE, lpszExecutable); 1866 1883 1867 1884 // we require more space in the new command line 1868 1885 iNewCommandLineLength += strlen( debug_szPE ); 1869 1886 1870 1887 // only launch the specified executable (ICSDEBUG.EXE) 1871 1888 lpszPE = debug_szPE; … … 1873 1890 } 1874 1891 #endif 1875 1892 1876 1893 //SvL: Allright. Before we call O32_CreateProcess, we must take care of 1877 1894 // lpCurrentDirectory ourselves. (Open32 ignores it!) … … 1892 1909 cmdline = newcmdline; 1893 1910 } 1894 1911 1895 1912 dprintf(("KERNEL32: CreateProcess starting [%s],[%s]", 1896 1913 lpszExecutable, 1897 1914 cmdline)); 1898 1915 1899 1916 rc = O32_CreateProcess(lpszExecutable, (LPCSTR)cmdline,lpProcessAttributes, 1900 1917 lpThreadAttributes, bInheritHandles, dwCreationFlags, … … 1944 1961 free(cmdline); 1945 1962 1946 if(lpProcessInfo) 1963 if(lpProcessInfo) 1947 1964 { 1948 1965 lpProcessInfo->dwThreadId = MAKE_THREADID(lpProcessInfo->dwProcessId, lpProcessInfo->dwThreadId); … … 2042 2059 if(fVersionWarp3) { 2043 2060 Sleep(1000); 2044 return 0; 2061 return 0; 2045 2062 } 2046 2063 else return O32_WaitForInputIdle(hProcess, dwTimeOut);
Note:
See TracChangeset
for help on using the changeset viewer.