diff options
Diffstat (limited to 'dep/CascLib/src/CascMndxRoot.cpp')
-rw-r--r-- | dep/CascLib/src/CascMndxRoot.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/dep/CascLib/src/CascMndxRoot.cpp b/dep/CascLib/src/CascMndxRoot.cpp index db29fba1662..328afee8ba5 100644 --- a/dep/CascLib/src/CascMndxRoot.cpp +++ b/dep/CascLib/src/CascMndxRoot.cpp @@ -2872,6 +2872,14 @@ PCASC_PACKAGE FindMndxPackage(TCascStorage * hs, const char * szFileName) assert(hs->pPackages != NULL); pPackage = hs->pPackages->Packages; + //FILE * fp = fopen("E:\\packages.txt", "wt"); + //for(size_t i = 0; i < hs->pPackages->NameEntries; i++, pPackage++) + //{ + // if(pPackage->szFileName != NULL) + // fprintf(fp, "%s\n", pPackage->szFileName); + //} + //fclose(fp); + // Find the longest matching name for(size_t i = 0; i < hs->pPackages->NameEntries; i++, pPackage++) { @@ -2895,7 +2903,8 @@ static bool FillFindData(TCascSearch * pSearch, PCASC_FIND_DATA pFindData, TMndx PCASC_ROOT_ENTRY_MNDX pRootEntry = NULL; TCascStorage * hs = pSearch->hs; PCASC_PACKAGE pPackage; - char * szStrippedName; + char * szStrippedPtr; + char szStrippedName[MAX_PATH+1]; int nError; // Sanity check @@ -2912,10 +2921,14 @@ static bool FillFindData(TCascSearch * pSearch, PCASC_FIND_DATA pFindData, TMndx if(pPackage != NULL) { // Cut the package name off the full path - szStrippedName = pFindData->szFileName + pPackage->nLength; - while(szStrippedName[0] == '/') - szStrippedName++; + szStrippedPtr = pFindData->szFileName + pPackage->nLength; + while(szStrippedPtr[0] == '/') + szStrippedPtr++; + + // We need to convert the stripped name to lowercase, replacing backslashes with slashes + NormalizeFileName_LowerSlash(szStrippedName, szStrippedPtr, MAX_PATH); + // Search the package nError = SearchMndxInfo(hs->pMndxInfo, szStrippedName, (DWORD)(pPackage - hs->pPackages->Packages), &pRootEntry); if(nError == ERROR_SUCCESS) { @@ -3471,7 +3484,7 @@ void TestMndxRootFile(PCASC_MNDX_INFO pMndxInfo) while((nLength = ListFile_GetNext(pvListFile, "*", szFileName, MAX_PATH)) != 0) { // Normalize the file name: ToLower + BackSlashToSlash - NormalizeFileName_LowerSlash(szFileName); + NormalizeFileName_LowerSlash(szFileName, szFileName, MAX_PATH); // Check the file with all three MAR files TestMarFile(pMndxInfo->pMarFile1, szFileName, nLength); |