| 2073 | } |
| 2074 | |
| 2075 | DWORD InvalidateInternalFile(TMPQArchive * ha, const char * szFileName, DWORD dwFlagNone, DWORD dwFlagNew) |
| 2076 | { |
| 2077 | TMPQFile * hf = NULL; |
| 2078 | DWORD dwFileFlags = 0; |
| 2079 | int nError = ERROR_FILE_NOT_FOUND; |
| 2080 | |
| 2081 | // Open the file from the MPQ |
| 2082 | if(SFileOpenFileEx((HANDLE)ha, szFileName, SFILE_OPEN_BASE_FILE, (HANDLE *)&hf)) |
| 2083 | { |
| 2084 | // Remember the file flags |
| 2085 | dwFileFlags = hf->pFileEntry->dwFlags; |
| 2086 | |
| 2087 | // Delete the file entry |
| 2088 | nError = DeleteFileEntry(ha, hf); |
| 2089 | if(nError == ERROR_SUCCESS) |
| 2090 | { |
| 2091 | ha->dwFlags |= dwFlagNew; |
| 2092 | ha->dwReservedFiles++; |
| 2093 | } |
| 2094 | |
| 2095 | // Free the file entry |
| 2096 | FreeFileHandle(hf); |
| 2097 | } |
| 2098 | |
| 2099 | // If the deletion failed, set the "none" flag |
| 2100 | ha->dwFlags |= (nError != ERROR_SUCCESS) ? dwFlagNone : 0; |
| 2101 | return dwFileFlags; |
| 2102 | } |
| 2103 | |
| 2104 | void InvalidateInternalFiles(TMPQArchive * ha) |
| 2105 | { |
no test coverage detected