| 1846 | } |
| 1847 | |
| 1848 | TFileEntry * GetFileEntryExact(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex) |
| 1849 | { |
| 1850 | TMPQHash * pHash; |
| 1851 | DWORD dwFileIndex; |
| 1852 | |
| 1853 | // If the hash table is present, find the entry from hash table |
| 1854 | if(ha->pHashTable != NULL) |
| 1855 | { |
| 1856 | pHash = GetHashEntryExact(ha, szFileName, lcLocale); |
| 1857 | if(pHash != NULL && MPQ_BLOCK_INDEX(pHash) < ha->dwFileTableSize) |
| 1858 | { |
| 1859 | if(PtrHashIndex != NULL) |
| 1860 | PtrHashIndex[0] = (DWORD)(pHash - ha->pHashTable); |
| 1861 | return ha->pFileTable + MPQ_BLOCK_INDEX(pHash); |
| 1862 | } |
| 1863 | } |
| 1864 | |
| 1865 | #ifdef FULL |
| 1866 | // If we have HET table in the MPQ, try to find the file in HET table |
| 1867 | if(ha->pHetTable != NULL) |
| 1868 | { |
| 1869 | dwFileIndex = GetFileIndex_Het(ha, szFileName); |
| 1870 | if(dwFileIndex != HASH_ENTRY_FREE) |
| 1871 | { |
| 1872 | if(PtrHashIndex != NULL) |
| 1873 | PtrHashIndex[0] = HASH_ENTRY_FREE; |
| 1874 | return ha->pFileTable + dwFileIndex; |
| 1875 | } |
| 1876 | } |
| 1877 | #endif |
| 1878 | |
| 1879 | // Not found |
| 1880 | return NULL; |
| 1881 | } |
| 1882 | |
| 1883 | void AllocateFileName(TMPQArchive * ha, TFileEntry * pFileEntry, const char * szFileName) |
| 1884 | { |
no test coverage detected