Changeset 70479 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jan 7, 2018 6:43:29 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/pipe-win.cpp
r69536 r70479 46 46 #include "internal/pipe.h" 47 47 #include "internal/magics.h" 48 #include "internal-r3-win.h" 48 49 49 50 … … 74 75 /** Set if we've promised that the handle is writable. */ 75 76 bool fPromisedWritable; 77 /** Set if created inheritable. */ 78 bool fCreatedInheritable; 76 79 /** Usage counter. */ 77 80 uint32_t cUsers; … … 275 278 if (pThisW->Overlapped.hEvent != NULL) 276 279 { 277 pThisR->u32Magic = RTPIPE_MAGIC; 278 pThisW->u32Magic = RTPIPE_MAGIC; 279 pThisR->hPipe = hPipeR; 280 pThisW->hPipe = hPipeW; 281 pThisR->fRead = true; 282 pThisW->fRead = false; 283 //pThisR->fIOPending = false; 284 //pThisW->fIOPending = false; 285 //pThisR->fZeroByteRead = false; 286 //pThisW->fZeroByteRead = false; 287 //pThisR->fBrokenPipe = false; 288 //pThisW->fBrokenPipe = false; 289 //pThisW->fPromisedWritable= false; 290 //pThisR->fPromisedWritable= false; 291 //pThisR->cUsers = 0; 292 //pThisW->cUsers = 0; 293 //pThisR->pbBounceBuf = NULL; 294 //pThisW->pbBounceBuf = NULL; 295 //pThisR->cbBounceBufUsed = 0; 296 //pThisW->cbBounceBufUsed = 0; 297 //pThisR->cbBounceBufAlloc= 0; 298 //pThisW->cbBounceBufAlloc= 0; 299 pThisR->hPollSet = NIL_RTPOLLSET; 300 pThisW->hPollSet = NIL_RTPOLLSET; 280 pThisR->u32Magic = RTPIPE_MAGIC; 281 pThisW->u32Magic = RTPIPE_MAGIC; 282 pThisR->hPipe = hPipeR; 283 pThisW->hPipe = hPipeW; 284 pThisR->fRead = true; 285 pThisW->fRead = false; 286 //pThisR->fIOPending = false; 287 //pThisW->fIOPending = false; 288 //pThisR->fZeroByteRead = false; 289 //pThisW->fZeroByteRead = false; 290 //pThisR->fBrokenPipe = false; 291 //pThisW->fBrokenPipe = false; 292 //pThisW->fPromisedWritable = false; 293 //pThisR->fPromisedWritable = false; 294 pThisW->fCreatedInheritable = RT_BOOL(fFlags & RTPIPE_C_INHERIT_WRITE); 295 pThisR->fCreatedInheritable = RT_BOOL(fFlags & RTPIPE_C_INHERIT_READ); 296 //pThisR->cUsers = 0; 297 //pThisW->cUsers = 0; 298 //pThisR->pbBounceBuf = NULL; 299 //pThisW->pbBounceBuf = NULL; 300 //pThisR->cbBounceBufUsed = 0; 301 //pThisW->cbBounceBufUsed = 0; 302 //pThisR->cbBounceBufAlloc = 0; 303 //pThisW->cbBounceBufAlloc = 0; 304 pThisR->hPollSet = NIL_RTPOLLSET; 305 pThisW->hPollSet = NIL_RTPOLLSET; 301 306 302 307 *phPipeRead = pThisR; … … 472 477 if (pThis->Overlapped.hEvent != NULL) 473 478 { 474 pThis->u32Magic = RTPIPE_MAGIC; 475 pThis->hPipe = hNative; 476 pThis->fRead = !!(fFlags & RTPIPE_N_READ); 477 //pThis->fIOPending = false; 478 //pThis->fZeroByteRead = false; 479 //pThis->fBrokenPipe = false; 480 //pThisR->fPromisedWritable= false; 481 //pThis->cUsers = 0; 482 //pThis->pbBounceBuf = NULL; 483 //pThis->cbBounceBufUsed = 0; 484 //pThis->cbBounceBufAlloc= 0; 485 pThis->hPollSet = NIL_RTPOLLSET; 486 487 HANDLE hNative2 = INVALID_HANDLE_VALUE; 479 pThis->u32Magic = RTPIPE_MAGIC; 480 pThis->hPipe = hNative; 481 pThis->fRead = !!(fFlags & RTPIPE_N_READ); 482 //pThis->fIOPending = false; 483 //pThis->fZeroByteRead = false; 484 //pThis->fBrokenPipe = false; 485 //pThis->fPromisedWritable = false; 486 pThis->fCreatedInheritable = RT_BOOL(fFlags & RTPIPE_N_INHERIT); 487 //pThis->cUsers = 0; 488 //pThis->pbBounceBuf = NULL; 489 //pThis->cbBounceBufUsed = 0; 490 //pThis->cbBounceBufAlloc = 0; 491 pThis->hPollSet = NIL_RTPOLLSET; 492 493 HANDLE hNative2 = INVALID_HANDLE_VALUE; 488 494 FILE_PIPE_LOCAL_INFORMATION Info; 489 if (rtPipeQueryNtInfo(pThis, &Info)) 495 RT_ZERO(Info); 496 if ( g_enmWinVer != kRTWinOSType_NT310 497 && rtPipeQueryNtInfo(pThis, &Info)) 490 498 rc = VINF_SUCCESS; 491 499 else … … 536 544 { 537 545 /* 538 * Ok, we're good! 546 * Ok, we're good! If we replaced the handle, make sure it's not a standard 547 * handle if we think we need to close it. 539 548 */ 540 /** @todo This is bogus for standard handles! */541 549 if (hNative2 != INVALID_HANDLE_VALUE) 542 CloseHandle(hNative); 550 { 551 if ( hNative != GetStdHandle(STD_INPUT_HANDLE) 552 && hNative != GetStdHandle(STD_OUTPUT_HANDLE) 553 && hNative != GetStdHandle(STD_ERROR_HANDLE)) 554 CloseHandle(hNative); 555 } 543 556 *phPipe = pThis; 544 557 return VINF_SUCCESS; … … 565 578 566 579 return (RTHCINTPTR)pThis->hPipe; 580 } 581 582 583 RTDECL(int) RTPipeGetCreationInheritability(RTPIPE hPipe) 584 { 585 RTPIPEINTERNAL *pThis = hPipe; 586 AssertPtrReturn(pThis, false); 587 AssertReturn(pThis->u32Magic == RTPIPE_MAGIC, false); 588 589 return pThis->fCreatedInheritable; 567 590 } 568 591
Note:
See TracChangeset
for help on using the changeset viewer.