-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfileattr.c
55 lines (40 loc) · 989 Bytes
/
fileattr.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// fileattr.c
//
// Time-stamp: <04/01/01 11:35:20 keuchel@lightning>
#include "celib.h"
DWORD
XCEGetFileAttributesA(const char *fname)
{
wchar_t wfname[MAX_PATH];
DWORD dwRes;
MultiByteToWideChar(CP_ACP, 0, fname, -1, wfname, COUNTOF(wfname));
dwRes = XCEGetFileAttributesW(wfname);
return dwRes;
}
BOOL
XCESetFileAttributesA(const char *fname, DWORD dwAttr)
{
wchar_t wfname[MAX_PATH];
BOOL res;
MultiByteToWideChar(CP_ACP, 0, fname, -1, wfname, COUNTOF(wfname));
res = XCESetFileAttributesW(wfname, dwAttr);
return res;
}
DWORD
XCEGetFileAttributesW(const wchar_t *wfname)
{
wchar_t wpath[MAX_PATH];
DWORD dwRes;
XCEFixPathW(wfname, wpath);
dwRes = GetFileAttributesW(wpath);
return dwRes;
}
BOOL
XCESetFileAttributesW(const wchar_t *wfname, DWORD dwAttr)
{
wchar_t wpath[MAX_PATH];
BOOL res;
XCEFixPathW(wfname, wpath);
res = SetFileAttributesW(wpath, dwAttr);
return res;
}