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

Function Storage_EnumFiles

src/External/CascLib/test/CascTest.cpp:740–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

738}
739
740static DWORD Storage_EnumFiles(TLogHelper & LogHelper, TEST_PARAMS & Params)
741{
742 PCASC_FIND_DATA_ARRAY pFiles;
743 PCASC_FIND_DATA pFindData;
744 CASC_FIND_DATA cf;
745 MD5_CTX NameHashCtx;
746 MD5_CTX DataHashCtx;
747 LPCTSTR szListFile = GetTheProperListfile(Params.hStorage, Params.szListFile);
748 LPCSTR szNameHash;
749 LPCSTR szDataHash;
750 HANDLE hStorage = Params.hStorage;
751 HANDLE hFind;
752 size_t cbToAllocate = 0;
753 DWORD dwTotalFileCount = 0;
754 DWORD dwFileIndex = 0;
755 DWORD dwErrCode = ERROR_SUCCESS;
756 char szHashString[MD5_STRING_SIZE+1];
757 char szTotalBytes[0x20];
758// char szShortName[SHORT_NAME_SIZE];
759 bool bFileFound = true;
760
761 // Create the output file for dumping all file names
762 //Params.fp1 = OpenOutputTextFile(hStorage, "\\list-%s-%u-001.txt");
763
764 // Dump the storage
765// LogHelper.PrintProgress("Dumping storage ...");
766// CascDumpStorage(hStorage, "E:\\storage-dump.txt");
767
768 // Retrieve the total number of files
769 CascGetStorageInfo(hStorage, CascStorageTotalFileCount, &dwTotalFileCount, sizeof(dwTotalFileCount), NULL);
770 LogHelper.TotalFiles = dwTotalFileCount;
771
772 // Retrieve the tags
773 TestStorageGetTagInfo(hStorage);
774 TestStorageGetName(hStorage);
775
776 // Init both hashers
777 MD5_Init(&NameHashCtx);
778 MD5_Init(&DataHashCtx);
779
780#ifdef CASCLIB_WRITE_VERIFIED_FILENAMES
781 Params.bCheckFileData = 0;
782#endif
783
784 // Allocate the structure holding all file information
785 cbToAllocate = sizeof(CASC_FIND_DATA_ARRAY) + (dwTotalFileCount * sizeof(CASC_FIND_DATA));
786 if((pFiles = (PCASC_FIND_DATA_ARRAY)(CASC_ALLOC<BYTE>(cbToAllocate))) != NULL)
787 {
788 // Init the structure
789 pFiles->pTestParams = &Params;
790 pFiles->pLogHelper = &LogHelper;
791 pFiles->hStorage = hStorage;
792 pFiles->ItemIndex = 0;
793 pFiles->ItemCount = 0;
794
795 // Iterate over the storage
796 LogHelper.PrintProgress("Searching storage ...");
797 hFind = CascFindFirstFile(hStorage, "*", &pFiles->cf[dwFileIndex], szListFile);

Callers 1

Storage_ReadFilesFunction · 0.85

Calls 15

GetTheProperListfileFunction · 0.85
CascGetStorageInfoFunction · 0.85
TestStorageGetTagInfoFunction · 0.85
TestStorageGetNameFunction · 0.85
MD5_InitFunction · 0.85
CascFindFirstFileFunction · 0.85
CascFindNextFileFunction · 0.85
CascFindCloseFunction · 0.85
RunExtractWorkersFunction · 0.85
MD5_UpdateFunction · 0.85
GetHashFunction · 0.85
GetHashResultFunction · 0.85

Tested by

no test coverage detected