From 77ec614ac4630eed384d24895503372817007720 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 22 Dec 2015 11:11:03 +0100 Subject: [PATCH] msvcp110: Always return empty string in _Read_dir on end of enumeration or error. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcp90/ios.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 7440affc60d..6a754762191 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -14483,18 +14483,16 @@ void* __cdecl tr2_sys__Open_dir(char* target, char const* dest, int* err_code, e char* __cdecl tr2_sys__Read_dir(char* target, void* handle, enum file_type* type) { WIN32_FIND_DATAA data; + TRACE("(%p %p %p)\n", target, handle, type); - if(!FindNextFileA(handle, &data)) { - *type = status_unknown; - *target = '\0'; - return target; - } - while(!strcmp(data.cFileName, ".") || !strcmp(data.cFileName, "..")) { + + do { if(!FindNextFileA(handle, &data)) { *type = status_unknown; - return NULL; + *target = '\0'; + return target; } - } + } while(!strcmp(data.cFileName, ".") || !strcmp(data.cFileName, "..")); strcpy(target, data.cFileName); if(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)