ReactOS  0.4.14-dev-342-gdc047f9
findgen.c
Go to the documentation of this file.
1 
2 /*
3  * @implemented
4  */
6 {
7  WIN32_FIND_DATA FindFileData;
8  HANDLE hFindFile;
9 
10  hFindFile = FindFirstFile(_name, &FindFileData);
11  if (hFindFile == INVALID_HANDLE_VALUE) {
13  return -1;
14  }
15 
16  result->attrib = FindFileData.dwFileAttributes;
17  result->time_create = (time_t)FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL);
18  result->time_access = (time_t)FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL);
19  result->time_write = (time_t)FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL);
20  result->size = (((__int64)FindFileData.nFileSizeHigh)<<32) + FindFileData.nFileSizeLow;
21  _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH);
22 
23  return (intptr_t)hFindFile;
24 }
25 
26 /*
27  * @implemented
28  */
30 {
31  WIN32_FIND_DATA FindFileData;
32 
33  if (!FindNextFile((HANDLE)handle, &FindFileData)) {
35  return -1;
36  }
37 
38  result->attrib = FindFileData.dwFileAttributes;
39  result->time_create = (time_t)FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL);
40  result->time_access = (time_t)FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL);
41  result->time_write = (time_t)FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL);
42  result->size = (((__int64)FindFileData.nFileSizeHigh)<<32) + FindFileData.nFileSizeLow;
43  _tcsncpy(result->name,FindFileData.cFileName, MAX_PATH);
44 
45  return 0;
46 }
_TCHAR * _tcsncpy(_TCHAR *dst, const _TCHAR *src, size_t n)
Definition: tcsncpy.h:9
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static __inline __time64_t FileTimeToUnixTime(const FILETIME *FileTime, USHORT *millitm)
Definition: time.h:14
smooth NULL
Definition: ftsmooth.c:416
#define FindFirstFile
Definition: winbase.h:3606
char _TCHAR
Definition: tchar.h:1392
#define _tfinddata_t
Definition: tchar.h:731
int intptr_t
Definition: crtdefs.h:283
#define FindNextFile
Definition: winbase.h:3612
intptr_t _tfindfirst(const _TCHAR *_name, struct _tfinddata_t *result)
Definition: findgen.c:5
#define MAX_PATH
Definition: compat.h:26
void _dosmaperr(unsigned long oserrcode)
Definition: errno.c:81
__kernel_time_t time_t
Definition: linux.h:252
int _tfindnext(intptr_t handle, struct _tfinddata_t *result)
Definition: findgen.c:29
GLuint64EXT * result
Definition: glext.h:11304
#define __int64
Definition: basetyps.h:16