| 671 | } |
| 672 | |
| 673 | static DWORD LoadArchiveIndexFile(TCascStorage * hs, LPBYTE pbIndexFile, size_t cbIndexFile, size_t nArchive) |
| 674 | { |
| 675 | CASC_ARCINDEX_FOOTER InFooter; |
| 676 | LPBYTE pbIndexEnd = NULL; |
| 677 | DWORD dwErrCode; |
| 678 | |
| 679 | // Validate and capture the footer |
| 680 | dwErrCode = CaptureArchiveIndexFooter(InFooter, pbIndexFile, cbIndexFile); |
| 681 | if(dwErrCode != ERROR_SUCCESS) |
| 682 | return dwErrCode; |
| 683 | |
| 684 | // Remember the file offset and EKey length |
| 685 | SaveFileOffsetBitsAndEKeyLength(hs, InFooter.OffsetBytes * 8, InFooter.EKeyLength); |
| 686 | |
| 687 | // Verify the size of the index file |
| 688 | dwErrCode = VerifyIndexSize(InFooter, pbIndexFile, cbIndexFile, &pbIndexEnd); |
| 689 | if(dwErrCode != ERROR_SUCCESS) |
| 690 | return dwErrCode; |
| 691 | |
| 692 | // Parse all pages |
| 693 | while (pbIndexFile < pbIndexEnd) |
| 694 | { |
| 695 | // Load the entire page |
| 696 | dwErrCode = LoadArchiveIndexPage(hs, InFooter, pbIndexFile, pbIndexFile + InFooter.PageLength, nArchive); |
| 697 | if(dwErrCode != ERROR_SUCCESS) |
| 698 | break; |
| 699 | |
| 700 | // Move to the next page |
| 701 | pbIndexFile += InFooter.PageLength; |
| 702 | } |
| 703 | |
| 704 | return ERROR_SUCCESS; |
| 705 | } |
| 706 | |
| 707 | static DWORD BuildMapOfArchiveIndices(TCascStorage * hs) |
| 708 | { |
no test coverage detected