MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / VerifyIndexSize

Function VerifyIndexSize

src/External/CascLib/src/CascIndexFiles.cpp:632–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632static 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
650static DWORD LoadArchiveIndexPage(TCascStorage * hs, CASC_ARCINDEX_FOOTER & InFooter, LPBYTE pbIndexPage, LPBYTE pbIndexPageEnd, size_t nArchive)
651{

Callers 1

LoadArchiveIndexFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected