xref: /reactos/sdk/lib/crt/stdio/access.c (revision c2c66aff)
1 #include <precomp.h>
2 #include <tchar.h>
3 
4 #ifdef _UNICODE
5  #define _TS S
6  #define sT "S"
7  #define access_dirT access_dirW
8 #else
9  #define _TS s
10  #define sT "s"
11  #define access_dirT access_dirA
12 #endif
13 
14 #define MK_STR(s) #s
15 
16 /*
17  * INTERNAL
18  */
access_dirT(const _TCHAR * _path)19 int access_dirT(const _TCHAR *_path)
20 {
21     DWORD Attributes = GetFileAttributes(_path);
22     TRACE(MK_STR(is_dirT)"('%"sT"')\n", _path);
23 
24     if (Attributes == (DWORD)-1) {
25          _dosmaperr(GetLastError());
26         return -1;
27     }
28 
29     if ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
30     {
31       _set_errno(EACCES);
32       return -1;
33     }
34 
35    return 0;
36 }
37 
38 
39