Changeset 86412 in vbox for trunk/src/VBox/Runtime/r3/win/pipe-win.cpp
- Timestamp:
- Oct 2, 2020 11:39:26 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/pipe-win.cpp
r82968 r86412 67 67 /** Set if this is the read end, clear if it's the write end. */ 68 68 bool fRead; 69 /** RTPipeFromNative: Leave native handle open on RTPipeClose. */ 70 bool fLeaveOpen; 69 71 /** Set if there is already pending I/O. */ 70 72 bool fIOPending; … … 284 286 pThisR->fRead = true; 285 287 pThisW->fRead = false; 288 pThisR->fLeaveOpen = false; 289 pThisW->fLeaveOpen = false; 286 290 //pThisR->fIOPending = false; 287 291 //pThisW->fIOPending = false; … … 400 404 401 405 402 RTDECL(int) RTPipeClose (RTPIPE hPipe)406 RTDECL(int) RTPipeCloseEx(RTPIPE hPipe, bool fLeaveOpen) 403 407 { 404 408 RTPIPEINTERNAL *pThis = hPipe; … … 418 422 rtPipeWriteCheckCompletion(pThis); 419 423 420 CloseHandle(pThis->hPipe); 424 if (!fLeaveOpen && !pThis->fLeaveOpen) 425 CloseHandle(pThis->hPipe); 421 426 pThis->hPipe = INVALID_HANDLE_VALUE; 422 427 … … 436 441 437 442 443 RTDECL(int) RTPipeClose(RTPIPE hPipe) 444 { 445 return RTPipeCloseEx(hPipe, false /*fLeaveOpen*/); 446 } 447 448 438 449 RTDECL(int) RTPipeFromNative(PRTPIPE phPipe, RTHCINTPTR hNativePipe, uint32_t fFlags) 439 450 { 440 451 AssertPtrReturn(phPipe, VERR_INVALID_POINTER); 441 AssertReturn(!(fFlags & ~RTPIPE_N_VALID_MASK ), VERR_INVALID_PARAMETER);452 AssertReturn(!(fFlags & ~RTPIPE_N_VALID_MASK_FN), VERR_INVALID_PARAMETER); 442 453 AssertReturn(!!(fFlags & RTPIPE_N_READ) != !!(fFlags & RTPIPE_N_WRITE), VERR_INVALID_PARAMETER); 443 454 … … 482 493 pThis->u32Magic = RTPIPE_MAGIC; 483 494 pThis->hPipe = hNative; 484 pThis->fRead = !!(fFlags & RTPIPE_N_READ); 495 pThis->fRead = RT_BOOL(fFlags & RTPIPE_N_READ); 496 pThis->fLeaveOpen = RT_BOOL(fFlags & RTPIPE_N_LEAVE_OPEN); 485 497 //pThis->fIOPending = false; 486 498 //pThis->fZeroByteRead = false; … … 510 522 pThis->hPipe = hNative2; 511 523 if (rtPipeQueryNtInfo(pThis, &Info)) 524 { 525 pThis->fLeaveOpen = false; 512 526 rc = VINF_SUCCESS; 527 } 513 528 else 514 529 { … … 552 567 if (hNative2 != INVALID_HANDLE_VALUE) 553 568 { 554 if ( hNative != GetStdHandle(STD_INPUT_HANDLE) 569 if ( !(fFlags & RTPIPE_N_LEAVE_OPEN) 570 && hNative != GetStdHandle(STD_INPUT_HANDLE) 555 571 && hNative != GetStdHandle(STD_OUTPUT_HANDLE) 556 && hNative != GetStdHandle(STD_ERROR_HANDLE) )572 && hNative != GetStdHandle(STD_ERROR_HANDLE) ) 557 573 CloseHandle(hNative); 558 574 }
Note:
See TracChangeset
for help on using the changeset viewer.