Changeset 69536 in vbox for trunk/src/VBox
- Timestamp:
- Oct 31, 2017 9:18:24 AM (7 years ago)
- Location:
- trunk/src/VBox/Runtime/r3/win
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r69111 r69536 496 496 if (cbToWrite <= 0) 497 497 return VINF_SUCCESS; 498 ULONG c bToWriteAdj = (ULONG)cbToWrite;498 ULONG const cbToWriteAdj = (ULONG)cbToWrite; 499 499 AssertReturn(cbToWriteAdj == cbToWrite, VERR_NUMBER_TOO_BIG); 500 500 … … 504 504 if (pcbWritten) 505 505 /* Caller can handle partial writes. */ 506 *pcbWritten = cbWritten;506 *pcbWritten = RT_MIN(cbWritten, cbToWriteAdj); /* paranoia^3 */ 507 507 else 508 508 { 509 509 /* Caller expects everything to be written. */ 510 while (cb ToWriteAdj > cbWritten)510 while (cbWritten < cbToWriteAdj) 511 511 { 512 512 ULONG cbWrittenPart = 0; … … 543 543 544 544 cbWritten = 0; 545 while (cb ToWriteAdj > cbWritten)545 while (cbWritten < cbToWriteAdj) 546 546 { 547 547 ULONG cbToWrite = RT_MIN(cbChunk, cbToWriteAdj - cbWritten); … … 570 570 if (pcbWritten) 571 571 { 572 *pcbWritten = cbWritten;572 *pcbWritten = RT_MIN(cbWritten, cbToWriteAdj); /* paranoia^3 */ 573 573 break; 574 574 } -
trunk/src/VBox/Runtime/r3/win/localipc-win.cpp
r69111 r69536 1392 1392 RTCritSectLeave(&pThis->CritSect); 1393 1393 1394 fRc = WriteFile(pThis->hNmPipe, pvBuf, 1395 cbToWrite <= ~(DWORD)0 ? (DWORD)cbToWrite : ~(DWORD)0, 1396 &cbWritten, &pThis->Write.OverlappedIO); 1394 DWORD const cbToWriteInThisIteration = cbToWrite <= ~(DWORD)0 ? (DWORD)cbToWrite : ~(DWORD)0; 1395 fRc = WriteFile(pThis->hNmPipe, pvBuf, cbToWriteInThisIteration, &cbWritten, &pThis->Write.OverlappedIO); 1397 1396 if (fRc) 1398 1397 rc = VINF_SUCCESS; … … 1423 1422 } 1424 1423 1424 if (cbWritten > cbToWriteInThisIteration) /* paranoia^3 */ 1425 cbWritten = cbToWriteInThisIteration; 1426 1425 1427 RTCritSectEnter(&pThis->CritSect); 1426 1428 if (RT_FAILURE(rc)) -
trunk/src/VBox/Runtime/r3/win/pipe-win.cpp
r69111 r69536 797 797 &cbWritten, &pThis->Overlapped)) 798 798 { 799 *pcbWritten = cbWritten;799 *pcbWritten = RT_MIN(cbWritten, cbToWrite); /* paranoia^3 */ 800 800 rc = VINF_SUCCESS; 801 801 } … … 879 879 880 880 DWORD cbWritten = 0; 881 if (WriteFile(pThis->hPipe, pvBuf, 882 cbToWrite <= ~(DWORD)0 ? (DWORD)cbToWrite : ~(DWORD)0, 883 &cbWritten, &pThis->Overlapped)) 881 DWORD const cbToWriteInThisIteration = cbToWrite <= ~(DWORD)0 ? (DWORD)cbToWrite : ~(DWORD)0; 882 if (WriteFile(pThis->hPipe, pvBuf, cbToWriteInThisIteration, &cbWritten, &pThis->Overlapped)) 884 883 rc = VINF_SUCCESS; 885 884 else if (GetLastError() == ERROR_IO_PENDING) … … 902 901 903 902 /* advance */ 903 if (cbWritten > cbToWriteInThisIteration) /* paranoia^3 */ 904 cbWritten = cbToWriteInThisIteration; 904 905 pvBuf = (char const *)pvBuf + cbWritten; 905 906 cbTotalWritten += cbWritten;
Note:
See TracChangeset
for help on using the changeset viewer.