| 630 | } |
| 631 | |
| 632 | static DWORD VerifyIndexSize(CASC_ARCINDEX_FOOTER & InFooter, LPBYTE pbIndexFile, size_t cbIndexFile, LPBYTE * PtrIndexEnd) |
| 633 | { |
| 634 | size_t nPageCount; |
| 635 | |
| 636 | // Set the new length (without the footer) |
| 637 | cbIndexFile = cbIndexFile - InFooter.FooterLength; |
| 638 | nPageCount = cbIndexFile / (InFooter.PageLength + MD5_HASH_SIZE); |
| 639 | |
| 640 | // There must be equal or more pages |
| 641 | if(((InFooter.PageLength + MD5_HASH_SIZE) * nPageCount) > cbIndexFile) |
| 642 | return ERROR_BAD_FORMAT; |
| 643 | |
| 644 | // Return the end-of-index |
| 645 | nPageCount = cbIndexFile / (InFooter.PageLength + MD5_HASH_SIZE); |
| 646 | PtrIndexEnd[0] = pbIndexFile + (nPageCount * InFooter.PageLength); |
| 647 | return ERROR_SUCCESS; |
| 648 | } |
| 649 | |
| 650 | static DWORD LoadArchiveIndexPage(TCascStorage * hs, CASC_ARCINDEX_FOOTER & InFooter, LPBYTE pbIndexPage, LPBYTE pbIndexPageEnd, size_t nArchive) |
| 651 | { |
no outgoing calls
no test coverage detected