Changeset 1653 in vbox for trunk/src/VBox
- Timestamp:
- Mar 23, 2007 10:14:23 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
r1652 r1653 80 80 RTFILE NamedPipe; 81 81 /* Dummy overlapped structure. */ 82 OVERLAPPED Overlapped; 82 OVERLAPPED OverlappedWrite; 83 /* Overlapped structure for reads. */ 84 OVERLAPPED OverlappedRead; 83 85 #else /* !__WIN__ */ 84 86 /** Socket handle of the local socket for server. */ … … 112 114 { 113 115 unsigned cbReallyRead; 114 rc = RTFileRead(pData->NamedPipe, pvBuf, *cbRead, &cbReallyRead); 116 pData->OverlappedRead.Offset = 0; 117 pData->OverlappedRead.OffsetHigh = 0; 118 if (!ReadFile((HANDLE)pData->NamedPipe, pvBuf, *cbRead, NULL, &pData->OverlappedRead)) 119 { 120 DWORD uError = GetLastError(); 121 122 if (uError == ERROR_IO_PENDING) 123 { 124 /* Wait for incoming bytes. */ 125 if (GetOverlappedResult((HANDLE)pData->NamedPipe, &pData->OverlappedRead, (DWORD *)&cbReallyRead, TRUE) == FALSE) 126 { 127 uError = GetLastError(); 128 } 129 } 130 131 rc = RTErrConvertFromWin32(uError); 132 133 Log(("drvNamedPipeRead: WriteFile returned %d (%Vrc)\n", uError, rc)); 134 } 135 115 136 if (VBOX_FAILURE(rc)) 116 137 { … … 174 195 { 175 196 unsigned cbWritten; 176 pData->Overlapped .Offset = 0;177 pData->Overlapped .OffsetHigh = 0;178 if (!WriteFile((HANDLE)pData->NamedPipe, pvBuf, *cbWrite, NULL, &pData->Overlapped ))197 pData->OverlappedWrite.Offset = 0; 198 pData->OverlappedWrite.OffsetHigh = 0; 199 if (!WriteFile((HANDLE)pData->NamedPipe, pvBuf, *cbWrite, NULL, &pData->OverlappedWrite)) 179 200 { 180 201 DWORD uError = GetLastError(); … … 395 416 } 396 417 397 memset(&pData->Overlapped, 0, sizeof(pData->Overlapped)); 398 pData->Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); 418 memset(&pData->OverlappedWrite, 0, sizeof(pData->OverlappedWrite)); 419 memset(&pData->OverlappedRead, 0, sizeof(pData->OverlappedRead)); 420 pData->OverlappedWrite.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); 421 pData->OverlappedRead.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); 399 422 400 423 #else /* !__WIN__ */ … … 465 488 466 489 RTFileClose(pData->NamedPipe); 467 CloseHandle(pData->Overlapped.hEvent); 490 CloseHandle(pData->OverlappedRead.hEvent); 491 CloseHandle(pData->OverlappedWrite.hEvent); 468 492 } 469 493 #else /* !__WIN__ */
Note:
See TracChangeset
for help on using the changeset viewer.