MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / CascFindFirstFile

Function CascFindFirstFile

src/External/CascLib/src/CascFindFile.cpp:196–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194// Public functions
195
196HANDLE WINAPI CascFindFirstFile(
197 HANDLE hStorage,
198 LPCSTR szMask,
199 PCASC_FIND_DATA pFindData,
200 LPCTSTR szListFile)
201{
202 TCascStorage * hs;
203 TCascSearch * pSearch = NULL;
204 DWORD dwErrCode = ERROR_SUCCESS;
205
206 // Check parameters
207 if((hs = TCascStorage::IsValid(hStorage)) == NULL)
208 dwErrCode = ERROR_INVALID_HANDLE;
209 if(pFindData == NULL)
210 dwErrCode = ERROR_INVALID_PARAMETER;
211
212 // Supply default mask, if needed
213 if(szMask == NULL || szMask[0] == 0)
214 szMask = "*";
215
216 // Init the search structure and search handle
217 if(dwErrCode == ERROR_SUCCESS)
218 {
219 // Allocate the search handle
220 pSearch = new TCascSearch(hs, szListFile, szMask);
221 if(pSearch == NULL)
222 dwErrCode = ERROR_NOT_ENOUGH_MEMORY;
223 }
224
225 // Perform search
226 if(dwErrCode == ERROR_SUCCESS)
227 {
228 if(!DoStorageSearch(pSearch, pFindData))
229 dwErrCode = ERROR_NO_MORE_FILES;
230 }
231
232 if(dwErrCode != ERROR_SUCCESS)
233 {
234 delete pSearch;
235 pSearch = (TCascSearch *)INVALID_HANDLE_VALUE;
236 }
237
238 return (HANDLE)pSearch;
239}
240
241bool WINAPI CascFindNextFile(
242 HANDLE hFind,

Callers 3

Storage_EnumFilesFunction · 0.85
ExistsMethod · 0.85
EnumerateFilesMethod · 0.85

Calls 1

DoStorageSearchFunction · 0.85

Tested by 1

Storage_EnumFilesFunction · 0.68