acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
aaa_cross_win_file.h
1#pragma once
2
3#ifndef CROSS_WINDOWS_NT_FILE_H
4#define CROSS_WINDOWS_NT_FILE_H
5#define WINPR_FILE_H
6
7
8#define INVALID_HANDLE_VALUE ((HANDLE)(long_ptr)-1)
9#define INVALID_FILE_SIZE ((::u32)0xFFFFFFFF)
10#define INVALID_SET_FILE_POINTER ((::u32)-1)
11#define INVALID_FILE_ATTRIBUTES ((::u32)-1)
12
13#define FILE_BEGIN 0
14#define FILE_CURRENT 1
15#define FILE_END 2
16
17
18
19//
20// File creation flags must start at the high end since they
21// are combined with the attributes
22//
23
24#define FILE_FLAG_WRITE_THROUGH I32_MINIMUM
25#define FILE_FLAG_OVERLAPPED 0x40000000
26#define FILE_FLAG_NO_BUFFERING 0x20000000
27#define FILE_FLAG_RANDOM_ACCESS 0x10000000
28#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
29#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000
30#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000
31#define FILE_FLAG_POSIX_SEMANTICS 0x01000000
32#define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
33#define FILE_FLAG_OPEN_NO_RECALL 0x00100000
34#define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
35
36#define CREATE_NEW 1
37#define CREATE_ALWAYS 2
38#define OPEN_EXISTING 3
39#define OPEN_ALWAYS 4
40#define TRUNCATE_EXISTING 5
41
42
43//
44// Define access rights to files and directories
45//
46
47//
48// The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in
49// devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these
50// constants *MUST* always be in synchronization.
51// The values are redefined in devioctl.h because they must be available to
52// both DOS and NT.
53//
54
55
56
57#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ |\
58 FILE_READ_DATA |\
59 FILE_READ_ATTRIBUTES |\
60 FILE_READ_EA |\
61 SYNCHRONIZE)
62
63
64#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\
65 FILE_WRITE_DATA |\
66 FILE_WRITE_ATTRIBUTES |\
67 FILE_WRITE_EA |\
68 FILE_APPEND_DATA |\
69 SYNCHRONIZE)
70
71
72#define FILE_ATTRIBUTE_READONLY 0x00000001
73#define FILE_ATTRIBUTE_HIDDEN 0x00000002
74#define FILE_ATTRIBUTE_SYSTEM 0x00000004
75#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
76#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
77#define FILE_ATTRIBUTE_DEVICE 0x00000040
78#define FILE_ATTRIBUTE_NORMAL 0x00000080
79#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
80#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
81#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
82#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
83#define FILE_ATTRIBUTE_OFFLINE 0x00001000
84#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
85#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
86#define FILE_ATTRIBUTE_VIRTUAL 0x00010000
87#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
88#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
89#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
90#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
91#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
92#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
93#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
94#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
95#define FILE_ACTION_ADDED 0x00000001
96#define FILE_ACTION_REMOVED 0x00000002
97#define FILE_ACTION_MODIFIED 0x00000003
98#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
99#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
100#define MAILSLOT_NO_MESSAGE ((::u32)-1)
101#define MAILSLOT_WAIT_FOREVER ((::u32)-1)
102#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
103#define FILE_CASE_PRESERVED_NAMES 0x00000002
104#define FILE_UNICODE_ON_DISK 0x00000004
105#define FILE_PERSISTENT_ACLS 0x00000008
106#define FILE_FILE_COMPRESSION 0x00000010
107#define FILE_VOLUME_QUOTAS 0x00000020
108#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
109#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
110#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
111#define FILE_VOLUME_IS_COMPRESSED 0x00008000
112#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
113#define FILE_SUPPORTS_ENCRYPTION 0x00020000
114#define FILE_NAMED_STREAMS 0x00040000
115#define FILE_READ_ONLY_VOLUME 0x00080000
116#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
117#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
118#define FILE_SUPPORTS_HARD_LINKS 0x00400000
119#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
120#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
121#define FILE_SUPPORTS_USN_JOURNAL 0x02000000
122
123
125// //
126// ACCESS MASK //
127// //
129
130//
131// Define the access mask as a longword ::f64_size structure divided up as
132// follows:
133//
134// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
135// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
136// +---------------+---------------+-------------------------------+
137// |G|G|G|G|Res'd|A| StandardRights| SpecificRights |
138// |R|W|E|A| |S| | |
139// +-+-------------+---------------+-------------------------------+
140//
141// typedef struct _ACCESS_MASK {
142// ::u16 SpecificRights;
143// ::u8 StandardRights;
144// ::u8 AccessSystemAcl : 1;
145// ::u8 Reserved : 3;
146// ::u8 GenericAll : 1;
147// ::u8 GenericExecute : 1;
148// ::u8 GenericWrite : 1;
149// ::u8 GenericRead : 1;
150// } ACCESS_MASK;
151// typedef ACCESS_MASK *PACCESS_MASK;
152//
153// but to make life simple for programmer's we'hi allow them to specify
154// a desired access mask by simply OR'ing together mulitple single rights
155// and treat an access mask as a ::u32. For example
156//
157// DesiredAccess = DELETE | READ_CONTROL
158//
159// So we'hi declare ACCESS_MASK as ::u32
160//
161
162// begin_wdm
163typedef ::u32 ACCESS_MASK;
164typedef ACCESS_MASK *PACCESS_MASK;
165
167// //
168// ACCESS TYPES //
169// //
171
172
173// begin_wdm
174//
175// The following are masks for the predefined standard access types
176//
177
178
179
180
181
182//
183// Define the matter mapping array. This is used to denote the
184// mapping of each matter access right to a specific access mask.
185//
186
187/*typedef struct _GENERIC_MAPPING {
188 ACCESS_MASK GenericRead;
189 ACCESS_MASK GenericWrite;
190 ACCESS_MASK GenericExecute;
191 ACCESS_MASK GenericAll;
192} GENERIC_MAPPING;
193typedef GENERIC_MAPPING *PGENERIC_MAPPING;*/
194
195
196
197
198#endif // CROSS_WINDOWS_NT_FILE_H