Changeset 8773 for trunk/src/kernel32/hmstd.cpp
- Timestamp:
- Jun 26, 2002, 9:13:00 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.