Loads all file spans to memory
| 474 | |
| 475 | // Loads all file spans to memory |
| 476 | static DWORD LoadFileSpanFrames(TCascFile * hf) |
| 477 | { |
| 478 | PCASC_CKEY_ENTRY pCKeyEntry = hf->pCKeyEntry; |
| 479 | PCASC_FILE_SPAN pFileSpan = hf->pFileSpan; |
| 480 | DWORD dwErrCode = ERROR_SUCCESS; |
| 481 | |
| 482 | // If the ContentSize/EncodedSize is still unknown, we need to get it from the file frames |
| 483 | if(hf->ContentSize == CASC_INVALID_SIZE64 || hf->EncodedSize == CASC_INVALID_SIZE64) |
| 484 | { |
| 485 | // Set initially to zero |
| 486 | hf->ContentSize = 0; |
| 487 | hf->EncodedSize = 0; |
| 488 | |
| 489 | // Load file frames for all spans |
| 490 | for(DWORD i = 0; i < hf->SpanCount; i++, pCKeyEntry++, pFileSpan++) |
| 491 | { |
| 492 | // Init the range of the file span |
| 493 | pFileSpan->StartOffset = hf->ContentSize; |
| 494 | pFileSpan->EndOffset = hf->ContentSize; |
| 495 | |
| 496 | // Load the frames of the file span |
| 497 | dwErrCode = LoadSpanFrames(hf, pFileSpan, pCKeyEntry); |
| 498 | if(dwErrCode != ERROR_SUCCESS) |
| 499 | break; |
| 500 | |
| 501 | hf->ContentSize += pCKeyEntry->ContentSize; |
| 502 | hf->EncodedSize += pCKeyEntry->EncodedSize; |
| 503 | pFileSpan->EndOffset = hf->ContentSize; |
| 504 | } |
| 505 | } |
| 506 | else |
| 507 | { |
| 508 | // Load file frames for all spans |
| 509 | for(DWORD i = 0; i < hf->SpanCount; i++, pCKeyEntry++, pFileSpan++) |
| 510 | { |
| 511 | // Load the frames of the file span |
| 512 | dwErrCode = LoadSpanFrames(hf, pFileSpan, pCKeyEntry); |
| 513 | if(dwErrCode != ERROR_SUCCESS) |
| 514 | break; |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | return dwErrCode; |
| 519 | } |
| 520 | |
| 521 | static DWORD EnsureFileSpanFramesLoaded(TCascFile * hf) |
| 522 | { |
no test coverage detected