- Timestamp:
- Jun 26, 2002, 9:13:00 AM (23 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/console.cpp
r7476 r8773 1 /* $Id: console.cpp,v 1. 29 2001-11-29 00:20:46 phallerExp $ */1 /* $Id: console.cpp,v 1.30 2002-06-26 07:13:00 sandervl Exp $ */ 2 2 3 3 /* … … 416 416 dprintf(("KERNEL32:ConsoleDevicesRegister: registering CONOUT$ failed with %u.\n", 417 417 rc)); 418 418 419 419 // add standard symbolic links 420 420 HandleNamesAddSymbolicLink("CON", "CONOUT$"); 421 421 HandleNamesAddSymbolicLink("CON:", "CONOUT$"); 422 422 HandleNamesAddSymbolicLink("\\\\.\\CON", "CONOUT$"); 423 423 424 424 if(flVioConsole == TRUE) 425 425 { … … 2593 2593 *****************************************************************************/ 2594 2594 2595 BOOL WIN32API GenerateConsoleCtrlEvent(DWORD dwCtrlEvent,2596 DWORD dwProcessGroupId)2597 {2598 #ifdef DEBUG_LOCAL22599 WriteLog("KERNEL32/CONSOLE: OS2GenerateConsoleCtrlEvent(%08x,%08x) not implemented.\n",2600 dwCtrlEvent,2601 dwProcessGroupId);2602 #endif2603 2604 return TRUE;2605 }2606 2607 2608 /*****************************************************************************2609 * Name :2610 * Purpose :2611 * Parameters:2612 * Variables :2613 * Result :2614 * Remark :2615 * Status :2616 *2617 * Author : Patrick Haller [Tue, 1998/02/10 01:55]2618 *****************************************************************************/2619 2620 2595 UINT WIN32API GetConsoleCP(VOID) 2621 2596 { … … 3503 3478 *****************************************************************************/ 3504 3479 3505 BOOL WIN32API SetConsoleCtrlHandler(PHANDLER_ROUTINE pHandlerRoutine,3506 BOOL fAdd)3507 {3508 #ifdef DEBUG_LOCAL23509 WriteLog("KERNEL32/CONSOLE: OS2SetConsoleCtrlHandler(%08x,%08x) not implemented.\n",3510 pHandlerRoutine,3511 fAdd);3512 #endif3513 3514 return TRUE;3515 }3516 3517 3518 /*****************************************************************************3519 * Name :3520 * Purpose :3521 * Parameters:3522 * Variables :3523 * Result :3524 * Remark :3525 * Status :3526 *3527 * Author : Patrick Haller [Tue, 1998/02/10 01:55]3528 *****************************************************************************/3529 3530 3480 BOOL WIN32API SetConsoleCursorInfo(HANDLE hConsoleOutput, 3531 3481 PCONSOLE_CURSOR_INFO lpConsoleCursorInfo) -
trunk/src/kernel32/console.h
r4502 r8773 1 /* $Id: console.h,v 1. 4 2000-10-20 11:46:46sandervl Exp $ */1 /* $Id: console.h,v 1.5 2002-06-26 07:13:00 sandervl Exp $ */ 2 2 3 3 /* … … 39 39 ULONG iConsoleTerminate(void);/* termination of the console subsystem */ 40 40 41 BOOL InternalGenerateConsoleCtrlEvent(DWORD dwCtrlEvent, DWORD dwProcessGroupID); 42 BOOL WIN32API DefaultConsoleCtrlHandler(DWORD dwEvent); 43 41 44 #ifdef __cplusplus 42 45 } -
trunk/src/kernel32/hmstd.cpp
r8464 r8773 1 /* $Id: hmstd.cpp,v 1. 8 2002-05-22 12:57:23sandervl Exp $ */1 /* $Id: hmstd.cpp,v 1.9 2002-06-26 07:13:00 sandervl Exp $ */ 2 2 3 3 /* … … 120 120 LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) 121 121 { 122 DWORD byteswritten;123 LPVOID lpLowMemBuffer;122 DWORD byteswritten; 123 LPVOID lpLowMemBuffer; 124 124 125 dprintf(("KERNEL32: HMDeviceStandardClass::WriteFile %s(%08x,%08x,%08x,%08x,%08x)",126 lpHMDeviceName,127 pHMHandleData,128 lpBuffer,129 nNumberOfBytesToWrite,130 lpNumberOfBytesWritten,131 lpOverlapped));132 if(lpNumberOfBytesWritten == NULL) {133 lpNumberOfBytesWritten = &byteswritten;134 }135 if(lpCompletionRoutine){136 dprintf(("!WARNING!: lpCompletionRoutine not supported -> fall back to sync IO"));137 }125 dprintf(("KERNEL32: HMDeviceStandardClass::WriteFile %s(%08x,%08x,%08x,%08x,%08x)", 126 lpHMDeviceName, 127 pHMHandleData, 128 lpBuffer, 129 nNumberOfBytesToWrite, 130 lpNumberOfBytesWritten, 131 lpOverlapped)); 132 if (lpNumberOfBytesWritten == NULL) 133 lpNumberOfBytesWritten = &byteswritten; 134 if (lpCompletionRoutine) 135 { 136 dprintf(("!WARNING!: lpCompletionRoutine not supported -> fall back to sync IO")); 137 } 138 138 139 if(pHMHandleData->dwUserData == STD_INPUT_HANDLE) { 140 return FALSE; 141 } 142 lpLowMemBuffer = alloca(nNumberOfBytesToWrite); 143 if(lpLowMemBuffer == NULL) { 144 DebugInt3(); 145 return FALSE; 146 } 147 memcpy(lpLowMemBuffer, lpBuffer, nNumberOfBytesToWrite); 148 if(pHMHandleData->dwUserData == STD_ERROR_HANDLE) { 149 dprintf(("STDERR: %s", lpLowMemBuffer)); 150 return TRUE; 151 } 152 if(WinExe && !WinExe->isConsoleApp()) { 153 //DosWrite returns error 436 when PM apps try to write to std out 154 dprintf(("STDOUT (GUI): %s", lpLowMemBuffer)); 155 return TRUE; 156 } 157 dprintf(("STDOUT: %*s", nNumberOfBytesToWrite, lpLowMemBuffer)); 158 return O32_WriteFile(pHMHandleData->hHMHandle, lpLowMemBuffer, nNumberOfBytesToWrite, 159 lpNumberOfBytesWritten, lpOverlapped); 139 if (pHMHandleData->dwUserData == STD_INPUT_HANDLE) 140 return FALSE; 141 lpLowMemBuffer = alloca(nNumberOfBytesToWrite); 142 if (lpLowMemBuffer == NULL) 143 { 144 DebugInt3(); 145 return FALSE; 146 } 147 memcpy(lpLowMemBuffer, lpBuffer, nNumberOfBytesToWrite); 148 149 if ( WinExe 150 && !WinExe->isConsoleApp() 151 && O32_GetFileType(pHMHandleData->hHMHandle) == FILE_TYPE_UNKNOWN) /* kso */ 152 { 153 //DosWrite returns error 436 when PM apps try to write to std out 154 //kso - Jun 23 2002 2:54am: 155 //Yeah, cause PM programs doesn't have working STD* handles unless you redirect them! 156 //So, we should rather check if valid handle than !console. 157 dprintf(("%s (GUI): %*s", pHMHandleData->dwUserData == STD_ERROR_HANDLE ? "STDERR" : "STDOUT", 158 nNumberOfBytesToWrite, lpLowMemBuffer)); 159 return TRUE; 160 } 161 162 dprintf(("%s: %*s", pHMHandleData->dwUserData == STD_ERROR_HANDLE ? "STDERR" : "STDOUT", 163 nNumberOfBytesToWrite, lpLowMemBuffer)); 164 if (!O32_WriteFile(pHMHandleData->hHMHandle, lpLowMemBuffer, nNumberOfBytesToWrite, 165 lpNumberOfBytesWritten, lpOverlapped)) 166 { 167 /* Open32 wasn't made for console apps... */ 168 dprintf(("STD*: failed with lasterror=%d\n", GetLastError())); 169 return FALSE; 170 } 171 return TRUE; 160 172 } 161 173 … … 178 190 lpHMDeviceName, 179 191 pHMHandleData)); 180 192 #if 0 181 193 return FILE_TYPE_CHAR; 194 #else 195 return O32_GetFileType(pHMHandleData->hHMHandle); 196 #endif 182 197 } -
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.