1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 |
|
---|
4 | SMB parameters and setup, plus a whole lot more.
|
---|
5 |
|
---|
6 | Copyright (C) Andrew Tridgell 2011
|
---|
7 |
|
---|
8 | This program is free software; you can redistribute it and/or modify
|
---|
9 | it under the terms of the GNU General Public License as published by
|
---|
10 | the Free Software Foundation; either version 3 of the License, or
|
---|
11 | (at your option) any later version.
|
---|
12 |
|
---|
13 | This program is distributed in the hope that it will be useful,
|
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | GNU General Public License for more details.
|
---|
17 |
|
---|
18 | You should have received a copy of the GNU General Public License
|
---|
19 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef _SMB_CONSTANTS_H
|
---|
23 | #define _SMB_CONSTANTS_H
|
---|
24 |
|
---|
25 | /*
|
---|
26 | * Netbios over TCP (rfc 1002)
|
---|
27 | */
|
---|
28 | #define NBSSmessage 0x00 /* session message */
|
---|
29 | #define NBSSrequest 0x81 /* session request */
|
---|
30 | #define NBSSpositive 0x82 /* positiv session response */
|
---|
31 | #define NBSSnegative 0x83 /* negativ session response */
|
---|
32 | #define NBSSretarget 0x84 /* retarget session response */
|
---|
33 | #define NBSSkeepalive 0x85 /* keepalive */
|
---|
34 |
|
---|
35 | #define SMB_MAGIC 0x424D53FF /* 0xFF 'S' 'M' 'B' */
|
---|
36 |
|
---|
37 | /* the basic packet size, assuming no words or bytes. Does not include the NBT header */
|
---|
38 | #define MIN_SMB_SIZE 35
|
---|
39 |
|
---|
40 | /* when using NBT encapsulation every packet has a 4 byte header */
|
---|
41 | #define NBT_HDR_SIZE 4
|
---|
42 |
|
---|
43 | /* offsets into message header for common items - NOTE: These have
|
---|
44 | changed from being offsets from the base of the NBT packet to the base of the SMB packet.
|
---|
45 | this has reduced all these values by 4
|
---|
46 | */
|
---|
47 | #define HDR_COM 4
|
---|
48 | #define HDR_RCLS 5
|
---|
49 | #define HDR_REH 6
|
---|
50 | #define HDR_ERR 7
|
---|
51 | #define HDR_FLG 9
|
---|
52 | #define HDR_FLG2 10
|
---|
53 | #define HDR_PIDHIGH 12
|
---|
54 | #define HDR_SS_FIELD 14
|
---|
55 | #define HDR_TID 24
|
---|
56 | #define HDR_PID 26
|
---|
57 | #define HDR_UID 28
|
---|
58 | #define HDR_MID 30
|
---|
59 | #define HDR_WCT 32
|
---|
60 | #define HDR_VWV 33
|
---|
61 |
|
---|
62 | #define smb_len_nbt(buf) (RIVAL(buf, 0) & 0x1FFFF)
|
---|
63 | #define _smb_setlen_nbt(buf,len) RSIVAL(buf, 0, (len) & 0x1FFFF)
|
---|
64 | #define smb_setlen_nbt(buf, len) do { \
|
---|
65 | _smb_setlen_nbt(buf, len); \
|
---|
66 | SIVAL(buf, 4, SMB_MAGIC); \
|
---|
67 | } while (0)
|
---|
68 |
|
---|
69 | #define smb_len_tcp(buf) (RIVAL(buf, 0) & 0xFFFFFF)
|
---|
70 | #define _smb_setlen_tcp(buf,len) RSIVAL(buf, 0, (len) & 0xFFFFFF)
|
---|
71 | #define smb_setlen_tcp(buf, len) do { \
|
---|
72 | _smb_setlen_tcp(buf, len); \
|
---|
73 | SIVAL(buf, 4, SMB_MAGIC); \
|
---|
74 | } while (0)
|
---|
75 |
|
---|
76 | /* protocol types. It assumes that higher protocols include lower protocols
|
---|
77 | as subsets. */
|
---|
78 | enum protocol_types {
|
---|
79 | PROTOCOL_DEFAULT=-1,
|
---|
80 | PROTOCOL_NONE=0,
|
---|
81 | PROTOCOL_CORE,
|
---|
82 | PROTOCOL_COREPLUS,
|
---|
83 | PROTOCOL_LANMAN1,
|
---|
84 | PROTOCOL_LANMAN2,
|
---|
85 | PROTOCOL_NT1,
|
---|
86 | PROTOCOL_SMB2_02,
|
---|
87 | PROTOCOL_SMB2_10,
|
---|
88 | PROTOCOL_SMB2_22,
|
---|
89 | PROTOCOL_SMB2_24,
|
---|
90 | PROTOCOL_SMB3_00,
|
---|
91 | PROTOCOL_SMB3_02,
|
---|
92 | PROTOCOL_SMB3_10,
|
---|
93 | PROTOCOL_SMB3_11
|
---|
94 | };
|
---|
95 | #define PROTOCOL_LATEST PROTOCOL_SMB3_11
|
---|
96 |
|
---|
97 | enum smb_signing_setting {
|
---|
98 | SMB_SIGNING_IPC_DEFAULT = -2, /* Only used in C code */
|
---|
99 | SMB_SIGNING_DEFAULT = -1,
|
---|
100 | SMB_SIGNING_OFF = 0,
|
---|
101 | SMB_SIGNING_IF_REQUIRED = 1,
|
---|
102 | SMB_SIGNING_DESIRED = 2,
|
---|
103 | SMB_SIGNING_REQUIRED = 3,
|
---|
104 | };
|
---|
105 |
|
---|
106 | /* types of buffers in core SMB protocol */
|
---|
107 | #define SMB_DATA_BLOCK 0x1
|
---|
108 | #define SMB_ASCII4 0x4
|
---|
109 |
|
---|
110 | /* flag defines. CIFS spec 3.1.1 */
|
---|
111 | #define FLAG_SUPPORT_LOCKREAD 0x01
|
---|
112 | #define FLAG_CLIENT_BUF_AVAIL 0x02
|
---|
113 | #define FLAG_RESERVED 0x04
|
---|
114 | #define FLAG_CASELESS_PATHNAMES 0x08
|
---|
115 | #define FLAG_CANONICAL_PATHNAMES 0x10
|
---|
116 | #define FLAG_REQUEST_OPLOCK 0x20
|
---|
117 | #define FLAG_REQUEST_BATCH_OPLOCK 0x40
|
---|
118 | #define FLAG_REPLY 0x80
|
---|
119 |
|
---|
120 | /* the complete */
|
---|
121 | #define SMBmkdir 0x00 /* create directory */
|
---|
122 | #define SMBrmdir 0x01 /* delete directory */
|
---|
123 | #define SMBopen 0x02 /* open file */
|
---|
124 | #define SMBcreate 0x03 /* create file */
|
---|
125 | #define SMBclose 0x04 /* close file */
|
---|
126 | #define SMBflush 0x05 /* flush file */
|
---|
127 | #define SMBunlink 0x06 /* delete file */
|
---|
128 | #define SMBmv 0x07 /* rename file */
|
---|
129 | #define SMBgetatr 0x08 /* get file attributes */
|
---|
130 | #define SMBsetatr 0x09 /* set file attributes */
|
---|
131 | #define SMBread 0x0A /* read from file */
|
---|
132 | #define SMBwrite 0x0B /* write to file */
|
---|
133 | #define SMBlock 0x0C /* lock byte range */
|
---|
134 | #define SMBunlock 0x0D /* unlock byte range */
|
---|
135 | #define SMBctemp 0x0E /* create temporary file */
|
---|
136 | #define SMBmknew 0x0F /* make new file */
|
---|
137 | #define SMBcheckpath 0x10 /* check directory path */
|
---|
138 | #define SMBexit 0x11 /* process exit */
|
---|
139 | #define SMBlseek 0x12 /* seek */
|
---|
140 | #define SMBtcon 0x70 /* tree connect */
|
---|
141 | #define SMBtconX 0x75 /* tree connect and X*/
|
---|
142 | #define SMBtdis 0x71 /* tree disconnect */
|
---|
143 | #define SMBnegprot 0x72 /* negotiate protocol */
|
---|
144 | #define SMBdskattr 0x80 /* get disk attributes */
|
---|
145 | #define SMBsearch 0x81 /* search directory */
|
---|
146 | #define SMBsplopen 0xC0 /* open print spool file */
|
---|
147 | #define SMBsplwr 0xC1 /* write to print spool file */
|
---|
148 | #define SMBsplclose 0xC2 /* close print spool file */
|
---|
149 | #define SMBsplretq 0xC3 /* return print queue */
|
---|
150 | #define SMBsends 0xD0 /* send single block message */
|
---|
151 | #define SMBsendb 0xD1 /* send broadcast message */
|
---|
152 | #define SMBfwdname 0xD2 /* forward user name */
|
---|
153 | #define SMBcancelf 0xD3 /* cancel forward */
|
---|
154 | #define SMBgetmac 0xD4 /* get machine name */
|
---|
155 | #define SMBsendstrt 0xD5 /* send start of multi-block message */
|
---|
156 | #define SMBsendend 0xD6 /* send end of multi-block message */
|
---|
157 | #define SMBsendtxt 0xD7 /* send text of multi-block message */
|
---|
158 |
|
---|
159 | /* Core+ protocol */
|
---|
160 | #define SMBlockread 0x13 /* Lock a range and read */
|
---|
161 | #define SMBwriteunlock 0x14 /* Unlock a range then write */
|
---|
162 | #define SMBreadbraw 0x1a /* read a block of data with no smb header */
|
---|
163 | #define SMBwritebraw 0x1d /* write a block of data with no smb header */
|
---|
164 | #define SMBwritec 0x20 /* secondary write request */
|
---|
165 | #define SMBwriteclose 0x2c /* write a file then close it */
|
---|
166 |
|
---|
167 | /* dos extended protocol */
|
---|
168 | #define SMBreadBraw 0x1A /* read block raw */
|
---|
169 | #define SMBreadBmpx 0x1B /* read block multiplexed */
|
---|
170 | #define SMBreadBs 0x1C /* read block (secondary response) */
|
---|
171 | #define SMBwriteBraw 0x1D /* write block raw */
|
---|
172 | #define SMBwriteBmpx 0x1E /* write block multiplexed */
|
---|
173 | #define SMBwriteBs 0x1F /* write block (secondary request) */
|
---|
174 | #define SMBwriteC 0x20 /* write complete response */
|
---|
175 | #define SMBsetattrE 0x22 /* set file attributes expanded */
|
---|
176 | #define SMBgetattrE 0x23 /* get file attributes expanded */
|
---|
177 | #define SMBlockingX 0x24 /* lock/unlock byte ranges and X */
|
---|
178 | #define SMBtrans 0x25 /* transaction - name, bytes in/out */
|
---|
179 | #define SMBtranss 0x26 /* transaction (secondary request/response) */
|
---|
180 | #define SMBioctl 0x27 /* IOCTL */
|
---|
181 | #define SMBioctls 0x28 /* IOCTL (secondary request/response) */
|
---|
182 | #define SMBcopy 0x29 /* copy */
|
---|
183 | #define SMBmove 0x2A /* move */
|
---|
184 | #define SMBecho 0x2B /* echo */
|
---|
185 | #define SMBopenX 0x2D /* open and X */
|
---|
186 | #define SMBreadX 0x2E /* read and X */
|
---|
187 | #define SMBwriteX 0x2F /* write and X */
|
---|
188 | #define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */
|
---|
189 | #define SMBffirst 0x82 /* find first */
|
---|
190 | #define SMBfunique 0x83 /* find unique */
|
---|
191 | #define SMBfclose 0x84 /* find close */
|
---|
192 | #define SMBinvalid 0xFE /* invalid command */
|
---|
193 |
|
---|
194 | /* Extended 2.0 protocol */
|
---|
195 | #define SMBtrans2 0x32 /* TRANS2 protocol set */
|
---|
196 | #define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */
|
---|
197 | #define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */
|
---|
198 | #define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
|
---|
199 | #define SMBulogoffX 0x74 /* user logoff */
|
---|
200 |
|
---|
201 | /* NT SMB extensions. */
|
---|
202 | #define SMBnttrans 0xA0 /* NT transact */
|
---|
203 | #define SMBnttranss 0xA1 /* NT transact secondary */
|
---|
204 | #define SMBntcreateX 0xA2 /* NT create and X */
|
---|
205 | #define SMBntcancel 0xA4 /* NT cancel */
|
---|
206 | #define SMBntrename 0xA5 /* NT rename */
|
---|
207 |
|
---|
208 | /* used to indicate end of chain */
|
---|
209 | #define SMB_CHAIN_NONE 0xFF
|
---|
210 |
|
---|
211 | /* Sercurity mode bits. */
|
---|
212 | #define NEGOTIATE_SECURITY_USER_LEVEL 0x01
|
---|
213 | #define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE 0x02
|
---|
214 | #define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04
|
---|
215 | #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08
|
---|
216 |
|
---|
217 | /*
|
---|
218 | * The negotiated buffer size for non LARGE_READX/WRITEX
|
---|
219 | * should be limited to uint16_t and has to be at least
|
---|
220 | * 500, which is the default for MinClientBufferSize on Windows.
|
---|
221 | */
|
---|
222 | #define SMB_BUFFER_SIZE_MIN 500
|
---|
223 | #define SMB_BUFFER_SIZE_MAX 65535
|
---|
224 |
|
---|
225 | /* Capabilities. see ftp.microsoft.com/developr/drg/cifs/cifs/cifs4.txt */
|
---|
226 |
|
---|
227 | #define CAP_RAW_MODE 0x00000001
|
---|
228 | #define CAP_MPX_MODE 0x00000002
|
---|
229 | #define CAP_UNICODE 0x00000004
|
---|
230 | #define CAP_LARGE_FILES 0x00000008
|
---|
231 | #define CAP_NT_SMBS 0x00000010
|
---|
232 | #define CAP_RPC_REMOTE_APIS 0x00000020
|
---|
233 | #define CAP_STATUS32 0x00000040
|
---|
234 | #define CAP_LEVEL_II_OPLOCKS 0x00000080
|
---|
235 | #define CAP_LOCK_AND_READ 0x00000100
|
---|
236 | #define CAP_NT_FIND 0x00000200
|
---|
237 | #define CAP_DFS 0x00001000
|
---|
238 | #define CAP_W2K_SMBS 0x00002000
|
---|
239 | #define CAP_LARGE_READX 0x00004000
|
---|
240 | #define CAP_LARGE_WRITEX 0x00008000
|
---|
241 | #define CAP_LWIO 0x00010000
|
---|
242 | #define CAP_UNIX 0x00800000 /* Capabilities for UNIX extensions. Created by HP. */
|
---|
243 | #define CAP_DYNAMIC_REAUTH 0x20000000
|
---|
244 | #define CAP_EXTENDED_SECURITY 0x80000000
|
---|
245 |
|
---|
246 | #define SMB_CAP_BOTH_MASK ( \
|
---|
247 | CAP_UNICODE | \
|
---|
248 | CAP_NT_SMBS | \
|
---|
249 | CAP_STATUS32 | \
|
---|
250 | CAP_LEVEL_II_OPLOCKS | \
|
---|
251 | CAP_EXTENDED_SECURITY | \
|
---|
252 | 0)
|
---|
253 | #define SMB_CAP_SERVER_MASK ( \
|
---|
254 | CAP_RAW_MODE | \
|
---|
255 | CAP_MPX_MODE | \
|
---|
256 | CAP_LARGE_FILES | \
|
---|
257 | CAP_RPC_REMOTE_APIS | \
|
---|
258 | CAP_LOCK_AND_READ | \
|
---|
259 | CAP_NT_FIND | \
|
---|
260 | CAP_DFS | \
|
---|
261 | CAP_W2K_SMBS | \
|
---|
262 | CAP_LARGE_READX | \
|
---|
263 | CAP_LARGE_WRITEX | \
|
---|
264 | CAP_LWIO | \
|
---|
265 | CAP_UNIX | \
|
---|
266 | 0)
|
---|
267 | #define SMB_CAP_CLIENT_MASK ( \
|
---|
268 | CAP_DYNAMIC_REAUTH | \
|
---|
269 | 0)
|
---|
270 | /*
|
---|
271 | * Older Samba releases (<= 3.6.x)
|
---|
272 | * expect the client to send CAP_LARGE_READX
|
---|
273 | * in order to let the client use large reads.
|
---|
274 | */
|
---|
275 | #define SMB_CAP_LEGACY_CLIENT_MASK ( \
|
---|
276 | SMB_CAP_CLIENT_MASK | \
|
---|
277 | CAP_LARGE_READX | \
|
---|
278 | CAP_LARGE_WRITEX | \
|
---|
279 | 0)
|
---|
280 |
|
---|
281 | /*
|
---|
282 | * The action flags in the SMB session setup response
|
---|
283 | */
|
---|
284 | #define SMB_SETUP_GUEST 0x0001
|
---|
285 | #define SMB_SETUP_USE_LANMAN_KEY 0x0002
|
---|
286 |
|
---|
287 | /* Client-side offline caching policy types */
|
---|
288 | enum csc_policy {
|
---|
289 | CSC_POLICY_MANUAL=0,
|
---|
290 | CSC_POLICY_DOCUMENTS=1,
|
---|
291 | CSC_POLICY_PROGRAMS=2,
|
---|
292 | CSC_POLICY_DISABLE=3
|
---|
293 | };
|
---|
294 |
|
---|
295 | /* TCONX Flag (smb_vwv2). [MS-SMB] 2.2.4.7.1 */
|
---|
296 | #define TCONX_FLAG_DISCONNECT_TID 0x0001
|
---|
297 | #define TCONX_FLAG_EXTENDED_SIGNATURES 0x0004
|
---|
298 | #define TCONX_FLAG_EXTENDED_RESPONSE 0x0008
|
---|
299 |
|
---|
300 | /* this is used on a TConX. [MS-SMB] 2.2.4.7.2 */
|
---|
301 | #define SMB_SUPPORT_SEARCH_BITS 0x0001
|
---|
302 | #define SMB_SHARE_IN_DFS 0x0002
|
---|
303 | #define SMB_CSC_MASK 0x000C
|
---|
304 | #define SMB_CSC_POLICY_SHIFT 2
|
---|
305 | #define SMB_UNIQUE_FILE_NAME 0x0010
|
---|
306 | #define SMB_EXTENDED_SIGNATURES 0x0020
|
---|
307 |
|
---|
308 | /* NT Flags2 bits - cifs6.txt section 3.1.2 */
|
---|
309 | #define FLAGS2_LONG_PATH_COMPONENTS 0x0001
|
---|
310 | #define FLAGS2_EXTENDED_ATTRIBUTES 0x0002
|
---|
311 | #define FLAGS2_SMB_SECURITY_SIGNATURES 0x0004
|
---|
312 | #define FLAGS2_SMB_SECURITY_SIGNATURES_REQUIRED 0x0010
|
---|
313 | #define FLAGS2_IS_LONG_NAME 0x0040
|
---|
314 | #define FLAGS2_EXTENDED_SECURITY 0x0800
|
---|
315 | #define FLAGS2_DFS_PATHNAMES 0x1000
|
---|
316 | #define FLAGS2_READ_PERMIT_EXECUTE 0x2000
|
---|
317 | #define FLAGS2_32_BIT_ERROR_CODES 0x4000
|
---|
318 | #define FLAGS2_UNICODE_STRINGS 0x8000
|
---|
319 |
|
---|
320 | /* FileAttributes (search attributes) field */
|
---|
321 | #define FILE_ATTRIBUTE_READONLY 0x0001L
|
---|
322 | #define FILE_ATTRIBUTE_HIDDEN 0x0002L
|
---|
323 | #define FILE_ATTRIBUTE_SYSTEM 0x0004L
|
---|
324 | #define FILE_ATTRIBUTE_VOLUME 0x0008L
|
---|
325 | #define FILE_ATTRIBUTE_DIRECTORY 0x0010L
|
---|
326 | #define FILE_ATTRIBUTE_ARCHIVE 0x0020L
|
---|
327 | #define FILE_ATTRIBUTE_DEVICE 0x0040L
|
---|
328 | #define FILE_ATTRIBUTE_NORMAL 0x0080L
|
---|
329 | #define FILE_ATTRIBUTE_TEMPORARY 0x0100L
|
---|
330 | #define FILE_ATTRIBUTE_SPARSE 0x0200L
|
---|
331 | #define FILE_ATTRIBUTE_REPARSE_POINT 0x0400L
|
---|
332 | #define FILE_ATTRIBUTE_COMPRESSED 0x0800L
|
---|
333 | #define FILE_ATTRIBUTE_OFFLINE 0x1000L
|
---|
334 | #define FILE_ATTRIBUTE_NONINDEXED 0x2000L
|
---|
335 | #define FILE_ATTRIBUTE_ENCRYPTED 0x4000L
|
---|
336 | #define FILE_ATTRIBUTE_ALL_MASK 0x7FFFL
|
---|
337 |
|
---|
338 | #define SAMBA_ATTRIBUTES_MASK (FILE_ATTRIBUTE_READONLY|\
|
---|
339 | FILE_ATTRIBUTE_HIDDEN|\
|
---|
340 | FILE_ATTRIBUTE_SYSTEM|\
|
---|
341 | FILE_ATTRIBUTE_DIRECTORY|\
|
---|
342 | FILE_ATTRIBUTE_ARCHIVE)
|
---|
343 |
|
---|
344 | /* File type flags */
|
---|
345 | #define FILE_TYPE_DISK 0
|
---|
346 | #define FILE_TYPE_BYTE_MODE_PIPE 1
|
---|
347 | #define FILE_TYPE_MESSAGE_MODE_PIPE 2
|
---|
348 | #define FILE_TYPE_PRINTER 3
|
---|
349 | #define FILE_TYPE_COMM_DEVICE 4
|
---|
350 | #define FILE_TYPE_UNKNOWN 0xFFFF
|
---|
351 |
|
---|
352 | /* Lock types. */
|
---|
353 | #define LOCKING_ANDX_EXCLUSIVE_LOCK 0x00
|
---|
354 | #define LOCKING_ANDX_SHARED_LOCK 0x01
|
---|
355 | #define LOCKING_ANDX_OPLOCK_RELEASE 0x02
|
---|
356 | #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
|
---|
357 | #define LOCKING_ANDX_CANCEL_LOCK 0x08
|
---|
358 | #define LOCKING_ANDX_LARGE_FILES 0x10
|
---|
359 |
|
---|
360 | /*
|
---|
361 | * Bits we test with.
|
---|
362 | */
|
---|
363 |
|
---|
364 | #define OPLOCK_NONE 0
|
---|
365 | #define OPLOCK_EXCLUSIVE 1
|
---|
366 | #define OPLOCK_BATCH 2
|
---|
367 | #define OPLOCK_LEVEL_II 4
|
---|
368 |
|
---|
369 | #define CORE_OPLOCK_GRANTED (1<<5)
|
---|
370 | #define EXTENDED_OPLOCK_GRANTED (1<<15)
|
---|
371 |
|
---|
372 | /*
|
---|
373 | * Return values for oplock types.
|
---|
374 | */
|
---|
375 |
|
---|
376 | #define NO_OPLOCK_RETURN 0
|
---|
377 | #define EXCLUSIVE_OPLOCK_RETURN 1
|
---|
378 | #define BATCH_OPLOCK_RETURN 2
|
---|
379 | #define LEVEL_II_OPLOCK_RETURN 3
|
---|
380 |
|
---|
381 | /* oplock levels sent in oplock break */
|
---|
382 | #define OPLOCK_BREAK_TO_NONE 0
|
---|
383 | #define OPLOCK_BREAK_TO_LEVEL_II 1
|
---|
384 |
|
---|
385 | /* Filesystem Attributes. */
|
---|
386 | #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
|
---|
387 | #define FILE_CASE_PRESERVED_NAMES 0x00000002
|
---|
388 | #define FILE_UNICODE_ON_DISK 0x00000004
|
---|
389 | /* According to cifs9f, this is 4, not 8 */
|
---|
390 | /* Acconding to testing, this actually sets the security attribute! */
|
---|
391 | #define FILE_PERSISTENT_ACLS 0x00000008
|
---|
392 | #define FILE_FILE_COMPRESSION 0x00000010
|
---|
393 | #define FILE_VOLUME_QUOTAS 0x00000020
|
---|
394 | #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
|
---|
395 | #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
|
---|
396 | #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
|
---|
397 | #define FS_LFN_APIS 0x00004000
|
---|
398 | #define FILE_VOLUME_IS_COMPRESSED 0x00008000
|
---|
399 | #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
|
---|
400 | #define FILE_SUPPORTS_ENCRYPTION 0x00020000
|
---|
401 | #define FILE_NAMED_STREAMS 0x00040000
|
---|
402 | #define FILE_READ_ONLY_VOLUME 0x00080000
|
---|
403 |
|
---|
404 | /* ShareAccess field. */
|
---|
405 | #define FILE_SHARE_NONE 0 /* Cannot be used in bitmask. */
|
---|
406 | #define FILE_SHARE_READ 1
|
---|
407 | #define FILE_SHARE_WRITE 2
|
---|
408 | #define FILE_SHARE_DELETE 4
|
---|
409 |
|
---|
410 | /* Flags - combined with attributes. */
|
---|
411 | #define FILE_FLAG_WRITE_THROUGH 0x80000000L
|
---|
412 | #define FILE_FLAG_NO_BUFFERING 0x20000000L
|
---|
413 | #define FILE_FLAG_RANDOM_ACCESS 0x10000000L
|
---|
414 | #define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000L
|
---|
415 | #define FILE_FLAG_DELETE_ON_CLOSE 0x04000000L
|
---|
416 | #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000L
|
---|
417 | #define FILE_FLAG_POSIX_SEMANTICS 0x01000000L
|
---|
418 |
|
---|
419 | /* CreateDisposition field. */
|
---|
420 | #define FILE_SUPERSEDE 0 /* File exists overwrite/supersede. File not exist create. */
|
---|
421 | #define FILE_OPEN 1 /* File exists open. File not exist fail. */
|
---|
422 | #define FILE_CREATE 2 /* File exists fail. File not exist create. */
|
---|
423 | #define FILE_OPEN_IF 3 /* File exists open. File not exist create. */
|
---|
424 | #define FILE_OVERWRITE 4 /* File exists overwrite. File not exist fail. */
|
---|
425 | #define FILE_OVERWRITE_IF 5 /* File exists overwrite. File not exist create. */
|
---|
426 |
|
---|
427 | /* CreateOptions field. */
|
---|
428 | #define FILE_DIRECTORY_FILE 0x0001
|
---|
429 | #define FILE_WRITE_THROUGH 0x0002
|
---|
430 | #define FILE_SEQUENTIAL_ONLY 0x0004
|
---|
431 | #define FILE_NO_INTERMEDIATE_BUFFERING 0x0008
|
---|
432 | #define FILE_SYNCHRONOUS_IO_ALERT 0x0010 /* may be ignored */
|
---|
433 | #define FILE_SYNCHRONOUS_IO_NONALERT 0x0020 /* may be ignored */
|
---|
434 | #define FILE_NON_DIRECTORY_FILE 0x0040
|
---|
435 | #define FILE_CREATE_TREE_CONNECTION 0x0080 /* ignore, should be zero */
|
---|
436 | #define FILE_COMPLETE_IF_OPLOCKED 0x0100 /* ignore, should be zero */
|
---|
437 | #define FILE_NO_EA_KNOWLEDGE 0x0200
|
---|
438 | #define FILE_EIGHT_DOT_THREE_ONLY 0x0400 /* aka OPEN_FOR_RECOVERY: ignore, should be zero */
|
---|
439 | #define FILE_RANDOM_ACCESS 0x0800
|
---|
440 | #define FILE_DELETE_ON_CLOSE 0x1000
|
---|
441 | #define FILE_OPEN_BY_FILE_ID 0x2000
|
---|
442 | #define FILE_OPEN_FOR_BACKUP_INTENT 0x4000
|
---|
443 | #define FILE_NO_COMPRESSION 0x8000
|
---|
444 | #define FILE_RESERVER_OPFILTER 0x00100000 /* ignore, should be zero */
|
---|
445 | #define FILE_OPEN_REPARSE_POINT 0x00200000
|
---|
446 | #define FILE_OPEN_NO_RECALL 0x00400000
|
---|
447 | #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 /* ignore should be zero */
|
---|
448 |
|
---|
449 | /* Responses when opening a file. */
|
---|
450 | #define FILE_WAS_SUPERSEDED 0
|
---|
451 | #define FILE_WAS_OPENED 1
|
---|
452 | #define FILE_WAS_CREATED 2
|
---|
453 | #define FILE_WAS_OVERWRITTEN 3
|
---|
454 |
|
---|
455 | /* These are the trans subcommands */
|
---|
456 | #define TRANSACT_SETNAMEDPIPEHANDLESTATE 0x01
|
---|
457 | #define TRANSACT_DCERPCCMD 0x26
|
---|
458 | #define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53
|
---|
459 |
|
---|
460 | /* These are the TRANS2 sub commands */
|
---|
461 | #define TRANSACT2_OPEN 0
|
---|
462 | #define TRANSACT2_FINDFIRST 1
|
---|
463 | #define TRANSACT2_FINDNEXT 2
|
---|
464 | #define TRANSACT2_QFSINFO 3
|
---|
465 | #define TRANSACT2_SETFSINFO 4
|
---|
466 | #define TRANSACT2_QPATHINFO 5
|
---|
467 | #define TRANSACT2_SETPATHINFO 6
|
---|
468 | #define TRANSACT2_QFILEINFO 7
|
---|
469 | #define TRANSACT2_SETFILEINFO 8
|
---|
470 | #define TRANSACT2_FSCTL 9
|
---|
471 | #define TRANSACT2_IOCTL 0xA
|
---|
472 | #define TRANSACT2_FINDNOTIFYFIRST 0xB
|
---|
473 | #define TRANSACT2_FINDNOTIFYNEXT 0xC
|
---|
474 | #define TRANSACT2_MKDIR 0xD
|
---|
475 | #define TRANSACT2_SESSION_SETUP 0xE
|
---|
476 | #define TRANSACT2_GET_DFS_REFERRAL 0x10
|
---|
477 | #define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11
|
---|
478 |
|
---|
479 | /* These are the NT transact sub commands. */
|
---|
480 | #define NT_TRANSACT_CREATE 1
|
---|
481 | #define NT_TRANSACT_IOCTL 2
|
---|
482 | #define NT_TRANSACT_SET_SECURITY_DESC 3
|
---|
483 | #define NT_TRANSACT_NOTIFY_CHANGE 4
|
---|
484 | #define NT_TRANSACT_RENAME 5
|
---|
485 | #define NT_TRANSACT_QUERY_SECURITY_DESC 6
|
---|
486 | #define NT_TRANSACT_GET_USER_QUOTA 7
|
---|
487 | #define NT_TRANSACT_SET_USER_QUOTA 8
|
---|
488 |
|
---|
489 | /* ioctl codes */
|
---|
490 | #define IOCTL_QUERY_JOB_INFO 0x530060
|
---|
491 |
|
---|
492 | /* filesystem control codes */
|
---|
493 | #define FSCTL_METHOD_BUFFERED 0x00000000
|
---|
494 | #define FSCTL_METHOD_IN_DIRECT 0x00000001
|
---|
495 | #define FSCTL_METHOD_OUT_DIRECT 0x00000002
|
---|
496 | #define FSCTL_METHOD_NEITHER 0x00000003
|
---|
497 |
|
---|
498 | #define FSCTL_ACCESS_ANY 0x00000000
|
---|
499 | #define FSCTL_ACCESS_READ 0x00004000
|
---|
500 | #define FSCTL_ACCESS_WRITE 0x00008000
|
---|
501 |
|
---|
502 | #define IOCTL_DEV_TYPE_MASK 0xFFFF0000
|
---|
503 |
|
---|
504 | #define FSCTL_DFS 0x00060000
|
---|
505 | #define FSCTL_DFS_GET_REFERRALS (FSCTL_DFS | FSCTL_ACCESS_ANY | 0x0194 | FSCTL_METHOD_BUFFERED)
|
---|
506 | #define FSCTL_DFS_GET_REFERRALS_EX (FSCTL_DFS | FSCTL_ACCESS_ANY | 0x01B0 | FSCTL_METHOD_BUFFERED)
|
---|
507 |
|
---|
508 | #define FSCTL_FILESYSTEM 0x00090000
|
---|
509 | #define FSCTL_REQUEST_OPLOCK_LEVEL_1 (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0000 | FSCTL_METHOD_BUFFERED)
|
---|
510 | #define FSCTL_REQUEST_OPLOCK_LEVEL_2 (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0004 | FSCTL_METHOD_BUFFERED)
|
---|
511 | #define FSCTL_REQUEST_BATCH_OPLOCK (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0008 | FSCTL_METHOD_BUFFERED)
|
---|
512 | #define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x000C | FSCTL_METHOD_BUFFERED)
|
---|
513 | #define FSCTL_OPBATCH_ACK_CLOSE_PENDING (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0010 | FSCTL_METHOD_BUFFERED)
|
---|
514 | #define FSCTL_OPLOCK_BREAK_NOTIFY (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0014 | FSCTL_METHOD_BUFFERED)
|
---|
515 | #define FSCTL_GET_COMPRESSION (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x003C | FSCTL_METHOD_BUFFERED)
|
---|
516 | #define FSCTL_SET_COMPRESSION (FSCTL_FILESYSTEM | FSCTL_ACCESS_READ \
|
---|
517 | | FSCTL_ACCESS_WRITE | 0x0040 | FSCTL_METHOD_BUFFERED)
|
---|
518 | #define FSCTL_FILESYS_GET_STATISTICS (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0060 | FSCTL_METHOD_BUFFERED)
|
---|
519 | #define FSCTL_GET_NTFS_VOLUME_DATA (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0064 | FSCTL_METHOD_BUFFERED)
|
---|
520 | #define FSCTL_IS_VOLUME_DIRTY (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0078 | FSCTL_METHOD_BUFFERED)
|
---|
521 | #define FSCTL_FIND_FILES_BY_SID (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x008C | FSCTL_METHOD_NEITHER)
|
---|
522 | #define FSCTL_SET_OBJECT_ID (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0098 | FSCTL_METHOD_BUFFERED)
|
---|
523 | #define FSCTL_GET_OBJECT_ID (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x009C | FSCTL_METHOD_BUFFERED)
|
---|
524 | #define FSCTL_DELETE_OBJECT_ID (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00A0 | FSCTL_METHOD_BUFFERED)
|
---|
525 | #define FSCTL_SET_REPARSE_POINT (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00A4 | FSCTL_METHOD_BUFFERED)
|
---|
526 | #define FSCTL_GET_REPARSE_POINT (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00A8 | FSCTL_METHOD_BUFFERED)
|
---|
527 | #define FSCTL_DELETE_REPARSE_POINT (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00AC | FSCTL_METHOD_BUFFERED)
|
---|
528 | #define FSCTL_CREATE_OR_GET_OBJECT_ID (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00C0 | FSCTL_METHOD_BUFFERED)
|
---|
529 | #define FSCTL_SET_SPARSE (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00C4 | FSCTL_METHOD_BUFFERED)
|
---|
530 | #define FSCTL_SET_ZERO_DATA (FSCTL_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x00C8 | FSCTL_METHOD_BUFFERED)
|
---|
531 | #define FSCTL_SET_ZERO_ON_DEALLOCATION (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0194 | FSCTL_METHOD_BUFFERED)
|
---|
532 | #define FSCTL_QUERY_ALLOCATED_RANGES (FSCTL_FILESYSTEM | FSCTL_ACCESS_READ | 0x00CC | FSCTL_METHOD_NEITHER)
|
---|
533 | #define FSCTL_FILE_LEVEL_TRIM (FSCTL_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x0208 | FSCTL_METHOD_BUFFERED)
|
---|
534 | #define FSCTL_OFFLOAD_READ (FSCTL_FILESYSTEM | FSCTL_ACCESS_READ | 0x0264 | FSCTL_METHOD_BUFFERED)
|
---|
535 | #define FSCTL_OFFLOAD_WRITE (FSCTL_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x0268 | FSCTL_METHOD_BUFFERED)
|
---|
536 | #define FSCTL_SET_INTEGRITY_INFORMATION (FSCTL_FILESYSTEM | FSCTL_ACCESS_READ \
|
---|
537 | | FSCTL_ACCESS_WRITE | 0x0280 | FSCTL_METHOD_BUFFERED)
|
---|
538 | #define FSCTL_DUP_EXTENTS_TO_FILE (FSCTL_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x0344 | FSCTL_METHOD_BUFFERED)
|
---|
539 | #define FSCTL_SVHDX_SYNC_TUNNEL_REQUEST (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0304 | FSCTL_METHOD_BUFFERED)
|
---|
540 | #define FSCTL_QUERY_SHARED_VIRTUAL_DISK_SUPPORT (FSCTL_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0300 | FSCTL_METHOD_BUFFERED)
|
---|
541 |
|
---|
542 | #define FSCTL_NAMED_PIPE 0x00110000
|
---|
543 | #define FSCTL_PIPE_PEEK (FSCTL_NAMED_PIPE | FSCTL_ACCESS_READ | 0x000C | FSCTL_METHOD_BUFFERED)
|
---|
544 | #define FSCTL_NAMED_PIPE_READ_WRITE (FSCTL_NAMED_PIPE | FSCTL_ACCESS_READ \
|
---|
545 | | FSCTL_ACCESS_WRITE | 0x0014 | FSCTL_METHOD_NEITHER)
|
---|
546 | #define FSCTL_PIPE_TRANSCEIVE FSCTL_NAMED_PIPE_READ_WRITE /* SMB2 function name */
|
---|
547 | #define FSCTL_PIPE_WAIT (FSCTL_NAMED_PIPE | FSCTL_ACCESS_ANY | 0x0018 | FSCTL_METHOD_BUFFERED)
|
---|
548 |
|
---|
549 | #define FSCTL_NETWORK_FILESYSTEM 0x00140000
|
---|
550 | #define FSCTL_GET_SHADOW_COPY_DATA (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_READ | 0x0064 | FSCTL_METHOD_BUFFERED)
|
---|
551 | #define FSCTL_SRV_ENUM_SNAPS FSCTL_GET_SHADOW_COPY_DATA /* SMB2 function name */
|
---|
552 | #define FSCTL_SRV_REQUEST_RESUME_KEY (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0078 | FSCTL_METHOD_BUFFERED)
|
---|
553 | #define FSCTL_SRV_COPYCHUNK (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_READ | 0x00F0 | FSCTL_METHOD_OUT_DIRECT)
|
---|
554 | #define FSCTL_SRV_COPYCHUNK_WRITE (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_WRITE | 0x00F0 | FSCTL_METHOD_OUT_DIRECT)
|
---|
555 | #define FSCTL_SRV_READ_HASH (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_READ| 0x01B8 | FSCTL_METHOD_NEITHER)
|
---|
556 | #define FSCTL_LMR_REQ_RESILIENCY (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x01D4 | FSCTL_METHOD_BUFFERED)
|
---|
557 | #define FSCTL_LMR_SET_LINK_TRACKING_INFORMATION \
|
---|
558 | (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x00EC | FSCTL_METHOD_BUFFERED)
|
---|
559 | #define FSCTL_QUERY_NETWORK_INTERFACE_INFO \
|
---|
560 | (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x01FC | FSCTL_METHOD_BUFFERED)
|
---|
561 |
|
---|
562 | /*
|
---|
563 | * FSCTL_VALIDATE_NEGOTIATE_INFO_224 was used used in
|
---|
564 | * Windows 8 server beta with SMB 2.24
|
---|
565 | */
|
---|
566 | #define FSCTL_VALIDATE_NEGOTIATE_INFO_224 \
|
---|
567 | (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0200 | FSCTL_METHOD_BUFFERED)
|
---|
568 | #define FSCTL_VALIDATE_NEGOTIATE_INFO (FSCTL_NETWORK_FILESYSTEM | FSCTL_ACCESS_ANY | 0x0204 | FSCTL_METHOD_BUFFERED)
|
---|
569 |
|
---|
570 | #endif /* _SMB_CONSTANTS_H */
|
---|