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

Function GetFileFullInfo

src/External/CascLib/src/CascReadFile.cpp:662–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660}
661
662static bool GetFileFullInfo(TCascFile * hf, void * pvFileInfo, size_t cbFileInfo, size_t * pcbLengthNeeded)
663{
664 PCASC_FILE_FULL_INFO pFileInfo;
665 PCASC_CKEY_ENTRY pCKeyEntry = hf->pCKeyEntry;
666 TCascStorage * hs = hf->hs;
667 DWORD dwErrCode;
668
669 // Make sure that the file spans are loaded
670 dwErrCode = EnsureFileSpanFramesLoaded(hf);
671 if(dwErrCode != ERROR_SUCCESS)
672 {
673 SetCascError(dwErrCode);
674 return false;
675 }
676
677 // Verify whether we have enough space in the buffer
678 pFileInfo = (PCASC_FILE_FULL_INFO)ProbeOutputBuffer(pvFileInfo, cbFileInfo, sizeof(CASC_FILE_FULL_INFO), pcbLengthNeeded);
679 if(pFileInfo != NULL)
680 {
681 // Reset the entire structure
682 CopyMemory16(pFileInfo->CKey, pCKeyEntry->CKey);
683 CopyMemory16(pFileInfo->EKey, pCKeyEntry->EKey);
684 pFileInfo->FileDataId = CASC_INVALID_ID;
685 pFileInfo->LocaleFlags = CASC_INVALID_ID;
686 pFileInfo->ContentFlags = CASC_INVALID_ID;
687
688 // Supply information not depending on root
689 CascStrPrintf(pFileInfo->DataFileName, _countof(pFileInfo->DataFileName), "data.%03u", hf->pFileSpan->ArchiveIndex);
690 pFileInfo->StorageOffset = pCKeyEntry->StorageOffset;
691 pFileInfo->SegmentOffset = hf->pFileSpan->ArchiveOffs;
692 pFileInfo->FileNameHash = 0;
693 pFileInfo->TagBitMask = pCKeyEntry->TagBitMask;
694 pFileInfo->ContentSize = hf->ContentSize;
695 pFileInfo->EncodedSize = hf->EncodedSize;
696 pFileInfo->SegmentIndex = hf->pFileSpan->ArchiveIndex;
697 pFileInfo->SpanCount = hf->SpanCount;
698
699 // Supply the root-specific information
700 hs->pRootHandler->GetInfo(pCKeyEntry, pFileInfo);
701 }
702
703 return (pFileInfo != NULL);
704}
705
706static bool GetFileSpanInfo(TCascFile * hf, void * pvFileInfo, size_t cbFileInfo, size_t * pcbLengthNeeded)
707{

Callers 1

CascGetFileInfoFunction · 0.85

Calls 6

SetCascErrorFunction · 0.85
ProbeOutputBufferFunction · 0.85
CopyMemory16Function · 0.85
CascStrPrintfFunction · 0.85
GetInfoMethod · 0.45

Tested by

no test coverage detected