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