Changeset 14064 in vbox for trunk/src/VBox/Runtime/r3/win
- Timestamp:
- Nov 10, 2008 11:27:40 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r13837 r14064 357 357 if (cbToRead <= 0) 358 358 return VINF_SUCCESS; 359 ULONG cbToReadAdj = (ULONG)cbToRead; 360 AssertReturn(cbToReadAdj == cbToRead, VERR_NUMBER_TOO_BIG); 359 361 360 362 ULONG cbRead = 0; 361 if (ReadFile((HANDLE)File, pvBuf, cbToRead , &cbRead, NULL))363 if (ReadFile((HANDLE)File, pvBuf, cbToReadAdj, &cbRead, NULL)) 362 364 { 363 365 if (pcbRead) … … 367 369 { 368 370 /* Caller expects everything to be read. */ 369 while (cbToRead > cbRead)371 while (cbToReadAdj > cbRead) 370 372 { 371 373 ULONG cbReadPart = 0; 372 if (!ReadFile((HANDLE)File, (char*)pvBuf + cbRead, cbToRead - cbRead, &cbReadPart, NULL))374 if (!ReadFile((HANDLE)File, (char*)pvBuf + cbRead, cbToReadAdj - cbRead, &cbReadPart, NULL)) 373 375 return RTErrConvertFromWin32(GetLastError()); 374 376 if (cbReadPart == 0) … … 387 389 if (cbToWrite <= 0) 388 390 return VINF_SUCCESS; 391 ULONG cbToWriteAdj = (ULONG)cbToWrite; 392 AssertReturn(cbToWriteAdj == cbToWrite, VERR_NUMBER_TOO_BIG); 389 393 390 394 ULONG cbWritten = 0; 391 if (WriteFile((HANDLE)File, pvBuf, cbToWrite , &cbWritten, NULL))395 if (WriteFile((HANDLE)File, pvBuf, cbToWriteAdj, &cbWritten, NULL)) 392 396 { 393 397 if (pcbWritten) … … 397 401 { 398 402 /* Caller expects everything to be written. */ 399 while (cbToWrite > cbWritten)403 while (cbToWriteAdj > cbWritten) 400 404 { 401 405 ULONG cbWrittenPart = 0; 402 if (!WriteFile((HANDLE)File, (char*)pvBuf + cbWritten, cbToWrite - cbWritten, &cbWrittenPart, NULL))406 if (!WriteFile((HANDLE)File, (char*)pvBuf + cbWritten, cbToWriteAdj - cbWritten, &cbWrittenPart, NULL)) 403 407 { 404 408 int rc = RTErrConvertFromWin32(GetLastError()); 405 409 if ( rc == VERR_DISK_FULL 406 && IsBeyondLimit(File, cbToWrite - cbWritten, FILE_CURRENT)410 && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT) 407 411 ) 408 412 rc = VERR_FILE_TOO_BIG; … … 418 422 int rc = RTErrConvertFromWin32(GetLastError()); 419 423 if ( rc == VERR_DISK_FULL 420 && IsBeyondLimit(File, cbToWrite - cbWritten, FILE_CURRENT) 421 ) 424 && IsBeyondLimit(File, cbToWriteAdj - cbWritten, FILE_CURRENT)) 422 425 rc = VERR_FILE_TOO_BIG; 423 426 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.