1 /*
2  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3  *  Copyright (C) 2009-2013 Sourcefire, Inc.
4  *
5  *  Authors: aCaB <acab@clamav.net>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *  MA 02110-1301, USA.
20  */
21 
22 #ifndef __DIRENT_H
23 #define __DIRENT_H
24 
25 #if HAVE_CONFIG_H
26 #include "clamav-config.h"
27 #endif
28 
29 #include <Windows.h>
30 
31 #ifndef PATH_MAX
32 #define PATH_MAX 1024
33 #endif
34 
35 #define _DIRENT_HAVE_D_TYPE
36 typedef unsigned short ino_t; /* WTF?!? */
37 
38 struct dirent {
39     ino_t d_ino;           /* inode number */
40     unsigned char d_type;  /* type of file */
41     char d_name[MAX_PATH]; /* filename */
42 };
43 
44 typedef struct {
45     HANDLE dh;
46     WIN32_FIND_DATAW wfd;
47     struct dirent ent;
48     wchar_t entry[PATH_MAX];
49 } DIR;
50 
51 enum {
52     DT_BLOCK,
53     DT_CHR,
54     DT_DIR,
55     DT_FIFO,
56     DT_LNK,
57     DT_REG,
58     DT_SOCK,
59     DT_UNKNOWN
60 };
61 
62 DIR *opendir(const char *name);
63 struct dirent *readdir(DIR *dirp);
64 void rewinddir(DIR *dirp);
65 int closedir(DIR *dirp);
66 
67 #endif /* __DIRENT_H */
68