Repair SetLastError in FindNextFileA.
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 0602170..0ed17de 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -1802,6 +1802,7 @@
{
FIND_FIRST_INFO *info;
BOOL ret = FALSE;
+ DWORD gle = ERROR_NO_MORE_FILES;
if ((handle == INVALID_HANDLE_VALUE) ||
!(info = (FIND_FIRST_INFO *)GlobalLock( handle )))
@@ -1816,25 +1817,24 @@
{
SMB_CloseDir( info->u.smb_dir );
HeapFree( GetProcessHeap(), 0, info->path );
- SetLastError( ERROR_NO_MORE_FILES );
}
goto done;
}
else if (!info->path || !info->u.dos_dir)
{
- SetLastError( ERROR_NO_MORE_FILES );
+ goto done;
}
else if (!DOSFS_FindNextEx( info, data ))
{
DOSFS_CloseDir( info->u.dos_dir ); info->u.dos_dir = NULL;
HeapFree( GetProcessHeap(), 0, info->path );
info->path = info->long_mask = NULL;
- SetLastError( ERROR_NO_MORE_FILES );
}
else
ret = TRUE;
done:
GlobalUnlock( handle );
+ if( !ret ) SetLastError( gle );
return ret;
}