msvcrt: Add _findfirst32() implementation.

This commit is contained in:
Nikolay Sivov 2011-03-15 03:01:43 +03:00 committed by Alexandre Julliard
parent 78dc7af9ce
commit cd7f096210
5 changed files with 43 additions and 3 deletions

View File

@ -617,7 +617,7 @@
@ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64
@ cdecl _fileno(ptr) msvcrt._fileno
@ cdecl _findclose(long) msvcrt._findclose
@ stub _findfirst32
@ cdecl _findfirst32(str ptr) msvcrt._findfirst32
@ stub _findfirst32i64
@ cdecl _findfirst64(str ptr) msvcrt._findfirst64
@ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32

View File

@ -458,7 +458,7 @@
@ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64
@ cdecl _fileno(ptr) msvcrt._fileno
@ cdecl _findclose(long) msvcrt._findclose
@ stub _findfirst32
@ cdecl _findfirst32(str ptr) msvcrt._findfirst32
@ stub _findfirst32i64
@ cdecl _findfirst64(str ptr) msvcrt._findfirst64
@ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32

View File

@ -450,7 +450,7 @@
@ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64
@ cdecl _fileno(ptr) msvcrt._fileno
@ cdecl _findclose(long) msvcrt._findclose
@ stub _findfirst32
@ cdecl _findfirst32(str ptr) msvcrt._findfirst32
@ stub _findfirst32i64
@ cdecl _findfirst64(str ptr) msvcrt._findfirst64
@ cdecl _findfirst64i32(str ptr) msvcrt._findfirst64i32

View File

@ -56,6 +56,26 @@ static void msvcrt_fttofd( const WIN32_FIND_DATAA *fd, struct MSVCRT__finddata_t
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 */
static void msvcrt_wfttofd( const WIN32_FIND_DATAW *fd, struct MSVCRT__wfinddata_t* ft)
{
@ -325,6 +345,25 @@ MSVCRT_intptr_t CDECL MSVCRT__findfirst(const char * fspec, struct MSVCRT__findd
return (MSVCRT_intptr_t)hfind;
}
/*********************************************************************
* _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.@)
*

View File

@ -411,6 +411,7 @@
@ cdecl _fileno(ptr) MSVCRT__fileno
@ cdecl _findclose(long) MSVCRT__findclose
@ cdecl _findfirst(str ptr) MSVCRT__findfirst
@ cdecl _findfirst32(str ptr) MSVCRT__findfirst32
@ cdecl _findfirst64(str ptr) MSVCRT__findfirst64
@ cdecl _findfirst64i32(str ptr) MSVCRT__findfirst64i32
@ cdecl _findfirsti64(str ptr) MSVCRT__findfirsti64