From: Piotr Caban piotr@codeweavers.com
--- dlls/msvcrt/dir.c | 54 +++++++++++--------------------------- dlls/ucrtbase/tests/file.c | 6 +++++ 2 files changed, 21 insertions(+), 39 deletions(-)
diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c index 8e4549ab306..7a36b74ee6b 100644 --- a/dlls/msvcrt/dir.c +++ b/dlls/msvcrt/dir.c @@ -157,26 +157,6 @@ static void msvcrt_wfttofd64( const WIN32_FIND_DATAW *fd, struct _wfinddata64_t* wcscpy(ft->name, fd->cFileName); }
-/* INTERNAL: Translate WIN32_FIND_DATAA to finddata64i32_t */ -static void msvcrt_fttofd64i32( const WIN32_FIND_DATAA *fd, struct _finddata64i32_t* ft) -{ - DWORD dw; - - if (fd->dwFileAttributes == FILE_ATTRIBUTE_NORMAL) - ft->attrib = 0; - else - ft->attrib = fd->dwFileAttributes; - - RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftCreationTime, &dw ); - ft->time_create = dw; - RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastAccessTime, &dw ); - ft->time_access = dw; - RtlTimeToSecondsSince1970( (const LARGE_INTEGER *)&fd->ftLastWriteTime, &dw ); - ft->time_write = dw; - ft->size = fd->nFileSizeLow; - strcpy(ft->name, fd->cFileName); -} - /* INTERNAL: Translate WIN32_FIND_DATAW to wfinddatai64_t */ static void msvcrt_wfttofdi64( const WIN32_FIND_DATAW *fd, struct _wfinddatai64_t* ft) { @@ -687,25 +667,6 @@ int CDECL _findnext64(intptr_t hand, struct _finddata64_t * ft) return ret; }
-/********************************************************************* - * _findnext64i32 (MSVCRT.@) - * - * 64-bit/32-bit version of _findnext. - */ -int CDECL _findnext64i32(intptr_t hand, struct _finddata64i32_t * ft) -{ - WIN32_FIND_DATAA find_data; - - if (!FindNextFileA((HANDLE)hand, &find_data)) - { - *_errno() = ENOENT; - return -1; - } - - msvcrt_fttofd64i32(&find_data,ft); - return 0; -} - /********************************************************************* * _wfindnexti64 (MSVCRT.@) * @@ -744,6 +705,21 @@ int CDECL _wfindnext64i32(intptr_t hand, struct _wfinddata64i32_t * ft) return 0; }
+/********************************************************************* + * _findnext64i32 (MSVCRT.@) + * + * 64-bit/32-bit version of _findnext. + */ +int CDECL _findnext64i32(intptr_t hand, struct _finddata64i32_t *ft) +{ + struct _wfinddata64i32_t wft; + int ret; + + ret = _wfindnext64i32(hand, &wft); + if (!ret && !finddata64i32_wtoa(&wft, ft)) ret = -1; + return ret; +} + /********************************************************************* * _getcwd (MSVCRT.@) * diff --git a/dlls/ucrtbase/tests/file.c b/dlls/ucrtbase/tests/file.c index 7b7604480bf..5246a3723d9 100644 --- a/dlls/ucrtbase/tests/file.c +++ b/dlls/ucrtbase/tests/file.c @@ -359,6 +359,12 @@ static void test_utf8(void) fdata64i32.name[0] = 'x'; hfind = _findfirst64i32(buf, &fdata64i32); ok(hfind != -1, "_findfirst64i32 returned %Id, errno %d\n", hfind, errno); + todo_wine_if(!is_lossless_convertion(dir)) + ok(!memcmp(file, fdata64i32.name, sizeof(file) - 1), "fdata64i32.name = %s\n", debugstr_a(fdata64i32.name)); + + fdata64i32.name[0] = 'x'; + ret = _findnext64i32(hfind, &fdata64i32); + ok(!ret, "_findnext64i32 returned %d, errno %d\n", ret, errno); todo_wine_if(!is_lossless_convertion(dir)) ok(!memcmp(file, fdata64i32.name, sizeof(file) - 1), "fdata64i32.name = %s\n", debugstr_a(fdata64i32.name)); ret = _findclose(hfind);