| 124 | // Functions for parsing an external listfile |
| 125 | |
| 126 | void * ListFile_OpenExternal(LPCTSTR szListFile) |
| 127 | { |
| 128 | PLISTFILE_CACHE pCache = NULL; |
| 129 | TFileStream * pStream; |
| 130 | ULONGLONG FileSize = 0; |
| 131 | |
| 132 | // Open the external listfile |
| 133 | pStream = FileStream_OpenFile(szListFile, STREAM_FLAG_READ_ONLY); |
| 134 | if(pStream != NULL) |
| 135 | { |
| 136 | // Retrieve the size of the external listfile |
| 137 | FileStream_GetSize(pStream, &FileSize); |
| 138 | if(0 < FileSize && FileSize <= 0x30000000) |
| 139 | { |
| 140 | // Create the in-memory cache for the entire listfile |
| 141 | // The listfile does not have any data loaded yet |
| 142 | pCache = ListFile_CreateCache((DWORD)FileSize); |
| 143 | if(pCache != NULL) |
| 144 | { |
| 145 | if(FileStream_Read(pStream, NULL, pCache->pBegin, (DWORD)FileSize)) |
| 146 | { |
| 147 | ListFile_CheckFormat(pCache); |
| 148 | } |
| 149 | else |
| 150 | { |
| 151 | CASC_FREE(pCache); |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | // Close the file stream |
| 157 | FileStream_Close(pStream); |
| 158 | } |
| 159 | |
| 160 | return pCache; |
| 161 | } |
| 162 | |
| 163 | void * ListFile_FromBuffer(LPBYTE pbBuffer, DWORD cbBuffer) |
| 164 | { |
no test coverage detected