libwinpr-file: get FindFirstFile, FindNextFile working
This commit is contained in:
parent
9f5917682f
commit
cd52a5b0b2
@ -34,7 +34,7 @@ set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SO
|
||||
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
||||
MONOLITHIC ${MONOLITHIC_BUILD} INTERNAL
|
||||
MODULE winpr
|
||||
MODULES winpr-handle)
|
||||
MODULES winpr-crt winpr-handle)
|
||||
|
||||
if(MONOLITHIC_BUILD)
|
||||
|
||||
|
@ -731,6 +731,19 @@ HANDLE FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPV
|
||||
|
||||
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
WIN32_FILE_SEARCH* pFileSearch;
|
||||
|
||||
pFileSearch = (WIN32_FILE_SEARCH*) hFindFile;
|
||||
|
||||
while ((pFileSearch->pDirent = readdir(pFileSearch->pDir)) != NULL)
|
||||
{
|
||||
if (FilePatternMatchA(pFileSearch->pDirent->d_name, pFileSearch->lpPattern))
|
||||
{
|
||||
strcpy(lpFindFileData->cFileName, pFileSearch->pDirent->d_name);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -741,7 +754,17 @@ BOOL FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData)
|
||||
|
||||
BOOL FindClose(HANDLE hFindFile)
|
||||
{
|
||||
return FALSE;
|
||||
WIN32_FILE_SEARCH* pFileSearch;
|
||||
|
||||
pFileSearch = (WIN32_FILE_SEARCH*) hFindFile;
|
||||
|
||||
free(pFileSearch->lpPath);
|
||||
free(pFileSearch->lpPattern);
|
||||
closedir(pFileSearch->pDir);
|
||||
|
||||
free(pFileSearch);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,11 @@ int TestFileFindNextFile(int argc, char* argv[])
|
||||
|
||||
_tprintf(_T("FindFirstFile: %s"), FindData.cFileName);
|
||||
|
||||
if (_tcscmp(FindData.cFileName, testDirectory2File1) != 0)
|
||||
/**
|
||||
* The current implementation does not enforce a particular order
|
||||
*/
|
||||
|
||||
if ((_tcscmp(FindData.cFileName, testDirectory2File1) != 0) && (_tcscmp(FindData.cFileName, testDirectory2File2) != 0))
|
||||
{
|
||||
_tprintf(_T("FindFirstFile failure: Expected: %s, Actual: %s\n"),
|
||||
testDirectory2File1, FindData.cFileName);
|
||||
@ -67,7 +71,7 @@ int TestFileFindNextFile(int argc, char* argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_tcscmp(FindData.cFileName, testDirectory2File2) != 0)
|
||||
if ((_tcscmp(FindData.cFileName, testDirectory2File1) != 0) && (_tcscmp(FindData.cFileName, testDirectory2File2) != 0))
|
||||
{
|
||||
_tprintf(_T("FindNextFile failure: Expected: %d, Actual: %s\n"),
|
||||
testDirectory2File2, FindData.cFileName);
|
||||
|
Loading…
Reference in New Issue
Block a user