| 2034 | } |
| 2035 | |
| 2036 | int DeleteFileEntry(TMPQArchive * ha, TMPQFile * hf) |
| 2037 | { |
| 2038 | TFileEntry * pFileEntry = hf->pFileEntry; |
| 2039 | TMPQHash * pHashEntry = hf->pHashEntry; |
| 2040 | |
| 2041 | // If the archive hash hash table, we need to free the hash table entry |
| 2042 | if(ha->pHashTable != NULL) |
| 2043 | { |
| 2044 | // The file must have hash table entry assigned |
| 2045 | // Will exit if there are multiple HASH entries pointing to the same file entry |
| 2046 | if(pHashEntry == NULL) |
| 2047 | return ERROR_NOT_SUPPORTED; |
| 2048 | |
| 2049 | // Mark the hash table entry as deleted |
| 2050 | pHashEntry->dwName1 = 0xFFFFFFFF; |
| 2051 | pHashEntry->dwName2 = 0xFFFFFFFF; |
| 2052 | pHashEntry->lcLocale = 0xFFFF; |
| 2053 | pHashEntry->Platform = 0xFF; |
| 2054 | pHashEntry->Reserved = 0xFF; |
| 2055 | pHashEntry->dwBlockIndex = HASH_ENTRY_DELETED; |
| 2056 | } |
| 2057 | |
| 2058 | // Free the file name, and set the file entry as deleted |
| 2059 | if(pFileEntry->szFileName != NULL) |
| 2060 | STORM_FREE(pFileEntry->szFileName); |
| 2061 | pFileEntry->szFileName = NULL; |
| 2062 | |
| 2063 | // |
| 2064 | // Don't modify the HET table, because it gets recreated by the caller |
| 2065 | // Don't decrement the number of entries in the file table |
| 2066 | // Keep Byte Offset, file size, compressed size, CRC32 and MD5 |
| 2067 | // Clear the file name hash and the MPQ_FILE_EXISTS bit |
| 2068 | // |
| 2069 | |
| 2070 | pFileEntry->dwFlags &= ~MPQ_FILE_EXISTS; |
| 2071 | pFileEntry->FileNameHash = 0; |
| 2072 | return ERROR_SUCCESS; |
| 2073 | } |
| 2074 | |
| 2075 | DWORD InvalidateInternalFile(TMPQArchive * ha, const char * szFileName, DWORD dwFlagNone, DWORD dwFlagNew) |
| 2076 | { |
no outgoing calls
no test coverage detected