xref: /PHP-8.1/win32/readdir.h (revision 767a77ac)
1 #ifndef READDIR_H
2 #define READDIR_H
3 
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /*
10  * Structures and types used to implement opendir/readdir/closedir
11  * on Windows.
12  */
13 
14 #include <config.w32.h>
15 
16 #include "ioutil.h"
17 
18 /* struct dirent - same as Unix */
19 struct dirent {
20 	long d_ino;					/* inode (always 1 in WIN32) */
21 	off_t d_off;					/* offset to this dirent */
22 	unsigned short d_reclen;			/* length of d_name */
23 	char d_name[1];	/* null terminated filename in the current encoding, glyph number <= 255 wchar_t's + \0 byte */
24 };
25 
26 /* typedef DIR - not the same as Unix */
27 struct DIR_W32 {
28 	HANDLE handle;			/* _findfirst/_findnext handle */
29 	uint32_t offset;		/* offset into directory */
30 	uint8_t finished;		/* 1 if there are not more files */
31 	WIN32_FIND_DATAW fileinfo;	/* from _findfirst/_findnext */
32 	wchar_t *dirw;			/* the dir we are reading */
33 	struct dirent dent;		/* the dirent to return */
34 };
35 typedef struct DIR_W32 DIR;
36 
37 /* Function prototypes */
38 DIR *opendir(const char *);
39 struct dirent *readdir(DIR *);
40 int closedir(DIR *);
41 int rewinddir(DIR *);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif /* READDIR_H */
48