| 69 | } |
| 70 | |
| 71 | static bool OpenLocalFile(const char * szFileName, HANDLE * PtrFile) |
| 72 | { |
| 73 | TFileStream * pStream; |
| 74 | TMPQFile * hf = NULL; |
| 75 | TCHAR szFileNameT[MAX_PATH]; |
| 76 | |
| 77 | // Convert the file name to UNICODE (if needed) |
| 78 | StringCopy(szFileNameT, _countof(szFileNameT), szFileName); |
| 79 | |
| 80 | // Open the file and create the TMPQFile structure |
| 81 | pStream = FileStream_OpenFile(szFileNameT, STREAM_FLAG_READ_ONLY); |
| 82 | if(pStream != NULL) |
| 83 | { |
| 84 | // Allocate and initialize file handle |
| 85 | hf = CreateFileHandle(NULL, NULL); |
| 86 | if(hf != NULL) |
| 87 | { |
| 88 | hf->pStream = pStream; |
| 89 | *PtrFile = hf; |
| 90 | return true; |
| 91 | } |
| 92 | else |
| 93 | { |
| 94 | FileStream_Close(pStream); |
| 95 | SetLastError(ERROR_NOT_ENOUGH_MEMORY); |
| 96 | } |
| 97 | } |
| 98 | *PtrFile = NULL; |
| 99 | return false; |
| 100 | } |
| 101 | |
| 102 | bool OpenPatchedFile(HANDLE hMpq, const char * szFileName, HANDLE * PtrFile) |
| 103 | { |
no test coverage detected