| 1315 | } |
| 1316 | |
| 1317 | static bool CreatePipe(HANDLE& parentHandle, HANDLE& childHandle, bool parentInputs) |
| 1318 | { |
| 1319 | SECURITY_ATTRIBUTES securityAttributesParent = { 0 }; |
| 1320 | securityAttributesParent.bInheritHandle = 1; |
| 1321 | |
| 1322 | HANDLE hTmp = INVALID_HANDLE_VALUE; |
| 1323 | if (parentInputs) |
| 1324 | CreatePipeWithSecurityAttributes(childHandle, hTmp, &securityAttributesParent, 0); |
| 1325 | else |
| 1326 | CreatePipeWithSecurityAttributes(hTmp, childHandle, &securityAttributesParent, 0); |
| 1327 | |
| 1328 | HANDLE dupHandle = 0; |
| 1329 | |
| 1330 | // Duplicate the parent handle to be non-inheritable so that the child process |
| 1331 | // doesn't have access. This is done for correctness sake, exact reason is unclear. |
| 1332 | // One potential theory is that child process can do something brain dead like |
| 1333 | // closing the parent end of the pipe and there by getting into a blocking situation |
| 1334 | // as parent will not be draining the pipe at the other end anymore. |
| 1335 | if (!::DuplicateHandle(GetCurrentProcess(), hTmp, |
| 1336 | GetCurrentProcess(), &dupHandle, |
| 1337 | 0, false, DUPLICATE_SAME_ACCESS)) |
| 1338 | { |
| 1339 | return false; |
| 1340 | } |
| 1341 | |
| 1342 | parentHandle = dupHandle; |
| 1343 | |
| 1344 | if (hTmp != INVALID_HANDLE_VALUE) |
| 1345 | ::CloseHandle(hTmp); |
| 1346 | |
| 1347 | return true; |
| 1348 | } |
| 1349 | |
| 1350 | bool WinDebugger::DoOpenFile(const StringImpl& fileName, const StringImpl& args, const StringImpl& workingDir, const Array<uint8>& envBlock, DbgOpenFileFlags openFileFlags) |
| 1351 | { |
no test coverage detected