diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index de346c409ec..197a414f5f1 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1534,7 +1534,7 @@ @ cdecl _wexecvp(wstr ptr) msvcrt._wexecvp @ cdecl _wexecvpe(wstr ptr ptr) msvcrt._wexecvpe @ cdecl _wfdopen(long wstr) msvcrt._wfdopen -@ stub _wfindfirst32 +@ cdecl _wfindfirst32(wstr ptr) msvcrt._wfindfirst32 @ stub _wfindfirst32i64 @ cdecl _wfindfirst64(wstr ptr) msvcrt._wfindfirst64 @ cdecl _wfindfirst64i32(wstr ptr) msvcrt._wfindfirst64i32 diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 40f14702e4e..d00f1a9d74d 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1897,7 +1897,7 @@ @ cdecl _wexecvp(wstr ptr) msvcrt._wexecvp @ cdecl _wexecvpe(wstr ptr ptr) msvcrt._wexecvpe @ cdecl _wfdopen(long wstr) msvcrt._wfdopen -@ stub _wfindfirst32 +@ cdecl _wfindfirst32(wstr ptr) msvcrt._wfindfirst32 @ stub _wfindfirst32i64 @ cdecl _wfindfirst64(wstr ptr) msvcrt._wfindfirst64 @ cdecl _wfindfirst64i32(wstr ptr) msvcrt._wfindfirst64i32 diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 30e3fa5280d..006204a3421 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1194,7 +1194,7 @@ @ cdecl _wexecvp(wstr ptr) msvcrt._wexecvp @ cdecl _wexecvpe(wstr ptr ptr) msvcrt._wexecvpe @ cdecl _wfdopen(long wstr) msvcrt._wfdopen -@ stub _wfindfirst32 +@ cdecl _wfindfirst32(wstr ptr) msvcrt._wfindfirst32 @ stub _wfindfirst32i64 @ cdecl _wfindfirst64(wstr ptr) msvcrt._wfindfirst64 @ cdecl _wfindfirst64i32(wstr ptr) msvcrt._wfindfirst64i32 diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 2db3042ca4c..ab9cea6115b 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1188,7 +1188,7 @@ @ cdecl _wexecvp(wstr ptr) msvcrt._wexecvp @ cdecl _wexecvpe(wstr ptr ptr) msvcrt._wexecvpe @ cdecl _wfdopen(long wstr) msvcrt._wfdopen -@ stub _wfindfirst32 +@ cdecl _wfindfirst32(wstr ptr) msvcrt._wfindfirst32 @ stub _wfindfirst32i64 @ cdecl _wfindfirst64(wstr ptr) msvcrt._wfindfirst64 @ cdecl _wfindfirst64i32(wstr ptr) msvcrt._wfindfirst64i32 diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c index 82824e97999..fa87ac13a36 100644 --- a/dlls/msvcrt/dir.c +++ b/dlls/msvcrt/dir.c @@ -95,6 +95,26 @@ static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata strcpyW(ft->name, fd->cFileName); } +/* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata32_t */ +static void msvcrt_wfttofd32(const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata32_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; + strcpyW(ft->name, fd->cFileName); +} + /* INTERNAL: Translate WIN32_FIND_DATAA to finddatai64_t */ static void msvcrt_fttofdi64( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddatai64_t* ft) { @@ -384,6 +404,27 @@ MSVCRT_intptr_t CDECL MSVCRT__wfindfirst(const MSVCRT_wchar_t * fspec, struct MS return (MSVCRT_intptr_t)hfind; } +/********************************************************************* + * _wfindfirst32 (MSVCRT.@) + * + * Unicode version of _findfirst32. + */ +MSVCRT_intptr_t CDECL MSVCRT__wfindfirst32(const MSVCRT_wchar_t * fspec, struct MSVCRT__wfinddata32_t* ft) +{ + WIN32_FIND_DATAW find_data; + HANDLE hfind; + + hfind = FindFirstFileW(fspec, &find_data); + if (hfind == INVALID_HANDLE_VALUE) + { + msvcrt_set_errno(GetLastError()); + return -1; + } + msvcrt_wfttofd32(&find_data, ft); + TRACE(":got handle %p\n", hfind); + return (MSVCRT_intptr_t)hfind; +} + /********************************************************************* * _findfirsti64 (MSVCRT.@) * diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index ff96b36cb6b..725e191b0d9 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1153,6 +1153,7 @@ @ cdecl _wexecvpe(wstr ptr ptr) @ cdecl _wfdopen(long wstr) MSVCRT__wfdopen @ cdecl _wfindfirst(wstr ptr) MSVCRT__wfindfirst +@ cdecl _wfindfirst32(wstr ptr) MSVCRT__wfindfirst32 @ cdecl _wfindfirst64(wstr ptr) MSVCRT__wfindfirst64 @ cdecl _wfindfirsti64(wstr ptr) MSVCRT__wfindfirsti64 @ cdecl _wfindfirst64i32(wstr ptr) MSVCRT__wfindfirst64i32