Commit cd7f0962 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msvcrt: Add _findfirst32() implementation.

parent 78dc7af9
...@@ -617,7 +617,7 @@ ...@@ -617,7 +617,7 @@
@ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64 @ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64
@ cdecl _fileno(ptr) msvcrt._fileno @ cdecl _fileno(ptr) msvcrt._fileno
@ cdecl _findclose(long) msvcrt._findclose @ cdecl _findclose(long) msvcrt._findclose
@ stub _findfirst32 @ cdecl _findfirst32(str ptr) msvcrt._findfirst32
@ stub _findfirst32i64 @ stub _findfirst32i64
@ cdecl _findfirst64(str ptr) msvcrt._findfirst64 @ cdecl _findfirst64(str ptr) msvcrt._findfirst64
@ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32 @ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32
......
...@@ -458,7 +458,7 @@ ...@@ -458,7 +458,7 @@
@ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64 @ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64
@ cdecl _fileno(ptr) msvcrt._fileno @ cdecl _fileno(ptr) msvcrt._fileno
@ cdecl _findclose(long) msvcrt._findclose @ cdecl _findclose(long) msvcrt._findclose
@ stub _findfirst32 @ cdecl _findfirst32(str ptr) msvcrt._findfirst32
@ stub _findfirst32i64 @ stub _findfirst32i64
@ cdecl _findfirst64(str ptr) msvcrt._findfirst64 @ cdecl _findfirst64(str ptr) msvcrt._findfirst64
@ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32 @ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32
......
...@@ -450,7 +450,7 @@ ...@@ -450,7 +450,7 @@
@ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64 @ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64
@ cdecl _fileno(ptr) msvcrt._fileno @ cdecl _fileno(ptr) msvcrt._fileno
@ cdecl _findclose(long) msvcrt._findclose @ cdecl _findclose(long) msvcrt._findclose
@ stub _findfirst32 @ cdecl _findfirst32(str ptr) msvcrt._findfirst32
@ stub _findfirst32i64 @ stub _findfirst32i64
@ cdecl _findfirst64(str ptr) msvcrt._findfirst64 @ cdecl _findfirst64(str ptr) msvcrt._findfirst64
@ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32 @ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32
......
...@@ -56,6 +56,26 @@ static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddata_t ...@@ -56,6 +56,26 @@ static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddata_t
strcpy(ft->name, fd->cFileName); strcpy(ft->name, fd->cFileName);
} }
/* INTERNAL: Translate WIN32_FIND_DATAA to finddata32_t */
static void msvcrt_fttofd32( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddata32_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 wfinddata_t */ /* INTERNAL: Translate WIN32_FIND_DATAW to wfinddata_t */
static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata_t* ft) static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata_t* ft)
{ {
...@@ -326,6 +346,25 @@ MSVCRT_intptr_t CDECL MSVCRT__findfirst(const char * fspec, struct MSVCRT__findd ...@@ -326,6 +346,25 @@ MSVCRT_intptr_t CDECL MSVCRT__findfirst(const char * fspec, struct MSVCRT__findd
} }
/********************************************************************* /*********************************************************************
* _findfirst32 (MSVCRT.@)
*/
MSVCRT_intptr_t CDECL MSVCRT__findfirst32(const char * fspec, struct MSVCRT__finddata32_t* ft)
{
WIN32_FIND_DATAA find_data;
HANDLE hfind;
hfind = FindFirstFileA(fspec, &find_data);
if (hfind == INVALID_HANDLE_VALUE)
{
msvcrt_set_errno(GetLastError());
return -1;
}
msvcrt_fttofd32(&find_data, ft);
TRACE(":got handle %p\n", hfind);
return (MSVCRT_intptr_t)hfind;
}
/*********************************************************************
* _wfindfirst (MSVCRT.@) * _wfindfirst (MSVCRT.@)
* *
* Unicode version of _findfirst. * Unicode version of _findfirst.
......
...@@ -411,6 +411,7 @@ ...@@ -411,6 +411,7 @@
@ cdecl _fileno(ptr) MSVCRT__fileno @ cdecl _fileno(ptr) MSVCRT__fileno
@ cdecl _findclose(long) MSVCRT__findclose @ cdecl _findclose(long) MSVCRT__findclose
@ cdecl _findfirst(str ptr) MSVCRT__findfirst @ cdecl _findfirst(str ptr) MSVCRT__findfirst
@ cdecl _findfirst32(str ptr) MSVCRT__findfirst32
@ cdecl _findfirst64(str ptr) MSVCRT__findfirst64 @ cdecl _findfirst64(str ptr) MSVCRT__findfirst64
@ cdecl _findfirst64i32(str ptr) MSVCRT__findfirst64i32 @ cdecl _findfirst64i32(str ptr) MSVCRT__findfirst64i32
@ cdecl _findfirsti64(str ptr) MSVCRT__findfirsti64 @ cdecl _findfirsti64(str ptr) MSVCRT__findfirsti64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment