Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3930 lines
163 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. smb.h
  5. Abstract:
  6. This file contains request and response structure definitions
  7. for the specific parameters of each SMB command, as well as codes
  8. for SMB commands and errors.
  9. Author:
  10. David R. Treadwell (davidtr) 27-Sept-1989 (from LanMan 1.2 code)
  11. Revision History:
  12. --*/
  13. #ifndef _SMB_
  14. #define _SMB_
  15. //#include <nt.h>
  16. //#include <smbtypes.h>
  17. /*
  18. Inclusion of SMB request/response structures in this file is
  19. conditionalized in the following way:
  20. If INCLUDE_SMB_ALL is defined, all of the structures are defined.
  21. Otherwise, the following names, if defined, cause inclusion of the
  22. corresponding SMB categories:
  23. INCLUDE_SMB_ADMIN Administrative requests:
  24. PROCESS_EXIT
  25. NEGOTIATE
  26. SESSION_SETUP_ANDX
  27. LOGOFF_ANDX
  28. INCLUDE_SMB_TREE Tree connect requests:
  29. TREE_CONNECT
  30. TREE_DISCONNECT
  31. TREE_CONNECT_ANDX
  32. INCLUDE_SMB_DIRECTORY Directory-related requests:
  33. CREATE_DIRECTORY
  34. DELETE_DIRECTORY
  35. CHECK_DIRECTORY
  36. INCLUDE_SMB_OPEN_CLOSE File open and close requests:
  37. OPEN
  38. CREATE
  39. CLOSE
  40. CREATE_TEMPORARY
  41. CREATE_NEW
  42. OPEN_ANDX
  43. CLOSE_AND_TREE_DISC
  44. INCLUDE_SMB_READ_WRITE Read and write requests:
  45. READ
  46. WRITE
  47. SEEK
  48. LOCK_AND_READ
  49. WRITE_AND_UNLOCK
  50. WRITE_AND_CLOSE
  51. READ_ANDX
  52. WRITE_ANDX
  53. INCLUDE_SMB_FILE_CONTROL File control requests:
  54. FLUSH
  55. DELETE
  56. RENAME
  57. COPY
  58. MOVE
  59. INCLUDE_SMB_QUERY_SET File query/set requests:
  60. QUERY_INFORMATION
  61. SET_INFORMATION
  62. QUERY_INFORMATION2
  63. SET_INFORMATION2
  64. QUERY_PATH_INFORMATION
  65. SET_PATH_INFORMATION
  66. QUERY_FILE_INFORMATION
  67. SET_FILE_INFORMATION
  68. INCLUDE_SMB_LOCK Lock requests (not LOCK_AND_READ)
  69. LOCK_BYTE_RANGE
  70. UNLOCK_BYTE_RANGE
  71. LOCKING_ANDX
  72. INCLUDE_SMB_RAW Raw read/write requests:
  73. READ_RAW
  74. WRITE_RAW
  75. INCLUDE_SMB_MPX Multiplexed requests:
  76. READ_MPX
  77. WRITE_MPX
  78. INCLUDE_SMB_SEARCH Search requests:
  79. FIND_CLOSE2
  80. FIND_NOTIFY_CLOSE
  81. SEARCH
  82. FIND
  83. FIND_UNIQUE
  84. FIND_CLOSE
  85. INCLUDE_SMB_TRANSACTION Transaction and IOCTL requests:
  86. TRANSACTION
  87. IOCTL
  88. TRANSACTION2
  89. NTTRANSACTION
  90. INCLUDE_SMB_PRINT Printer requests:
  91. OPEN_PRINT_FILE
  92. WRITE_PRINT_FILE
  93. CLOSE_PRINT_FILE
  94. GET_PRINT_QUEUE
  95. INCLUDE_SMB_MESSAGE Message requests:
  96. SEND_MESSAGE
  97. SEND_BROADCAST_MESSAGE
  98. FORWARD_USER_NAME
  99. CANCEL_FORWARD
  100. GET_MACHINE_NAME
  101. SEND_START_MB_MESSAGE
  102. SEND_END_MB_MESSAGE
  103. SEND_TEXT_MB_MESSAGE
  104. INCLUDE_SMB_MISC Miscellaneous requests:
  105. QUERY_INFORMATION_SRV
  106. ECHO
  107. QUERY_INFORMATION_DISK
  108. */
  109. #ifdef INCLUDE_SMB_ALL
  110. #define INCLUDE_SMB_ADMIN
  111. #define INCLUDE_SMB_TREE
  112. #define INCLUDE_SMB_DIRECTORY
  113. #define INCLUDE_SMB_OPEN_CLOSE
  114. #define INCLUDE_SMB_FILE_CONTROL
  115. #define INCLUDE_SMB_READ_WRITE
  116. #define INCLUDE_SMB_LOCK
  117. #define INCLUDE_SMB_RAW
  118. #define INCLUDE_SMB_MPX
  119. #define INCLUDE_SMB_QUERY_SET
  120. #define INCLUDE_SMB_SEARCH
  121. #define INCLUDE_SMB_TRANSACTION
  122. #define INCLUDE_SMB_PRINT
  123. #define INCLUDE_SMB_MESSAGE
  124. #define INCLUDE_SMB_MISC
  125. #endif // def INCLUDE_SMB_ALL
  126. //
  127. // Force misalignment of the following structures
  128. //
  129. #ifndef NO_PACKING
  130. #include <packon.h>
  131. #endif // ndef NO_PACKING
  132. //
  133. // SMB servers listen on two NETBIOS addresses to facilitate connections. The
  134. // first one is a name formulated from the computer name by padding it with
  135. // a number of blanks ( upto NETBIOS_NAME_LEN ). This name is registered and
  136. // resolved using the NETBIOS name registration/resolution mechanism. They also
  137. // register under a second name *SMBSERVER which is not a valuid netbios name
  138. // but provides a name which can be used in NETBT session setup. This eliminates
  139. // the need for querying the remote adapter status to obtain the name.
  140. //
  141. #define SMBSERVER_LOCAL_ENDPOINT_NAME "*SMBSERVER "
  142. #define SMBSERVER_LOCAL_ENDPOINT_NAME_UNICODE L"*SMBSERVER "
  143. //
  144. // SMB Command code definitions:
  145. //
  146. // *** Start of SMB commands
  147. #define SMB_COM_CREATE_DIRECTORY (UCHAR)0x00
  148. #define SMB_COM_DELETE_DIRECTORY (UCHAR)0x01
  149. #define SMB_COM_OPEN (UCHAR)0x02
  150. #define SMB_COM_CREATE (UCHAR)0x03
  151. #define SMB_COM_CLOSE (UCHAR)0x04
  152. #define SMB_COM_FLUSH (UCHAR)0x05
  153. #define SMB_COM_DELETE (UCHAR)0x06
  154. #define SMB_COM_RENAME (UCHAR)0x07
  155. #define SMB_COM_QUERY_INFORMATION (UCHAR)0x08
  156. #define SMB_COM_SET_INFORMATION (UCHAR)0x09
  157. #define SMB_COM_READ (UCHAR)0x0A
  158. #define SMB_COM_WRITE (UCHAR)0x0B
  159. #define SMB_COM_LOCK_BYTE_RANGE (UCHAR)0x0C
  160. #define SMB_COM_UNLOCK_BYTE_RANGE (UCHAR)0x0D
  161. #define SMB_COM_CREATE_TEMPORARY (UCHAR)0x0E
  162. #define SMB_COM_CREATE_NEW (UCHAR)0x0F
  163. #define SMB_COM_CHECK_DIRECTORY (UCHAR)0x10
  164. #define SMB_COM_PROCESS_EXIT (UCHAR)0x11
  165. #define SMB_COM_SEEK (UCHAR)0x12
  166. #define SMB_COM_LOCK_AND_READ (UCHAR)0x13
  167. #define SMB_COM_WRITE_AND_UNLOCK (UCHAR)0x14
  168. #define SMB_COM_READ_RAW (UCHAR)0x1A
  169. #define SMB_COM_READ_MPX (UCHAR)0x1B
  170. #define SMB_COM_READ_MPX_SECONDARY (UCHAR)0x1C // server to redir only
  171. #define SMB_COM_WRITE_RAW (UCHAR)0x1D
  172. #define SMB_COM_WRITE_MPX (UCHAR)0x1E
  173. #define SMB_COM_WRITE_MPX_SECONDARY (UCHAR)0x1F
  174. #define SMB_COM_WRITE_COMPLETE (UCHAR)0x20 // server to redir only
  175. #define SMB_COM_QUERY_INFORMATION_SRV (UCHAR)0x21
  176. #define SMB_COM_SET_INFORMATION2 (UCHAR)0x22
  177. #define SMB_COM_QUERY_INFORMATION2 (UCHAR)0x23
  178. #define SMB_COM_LOCKING_ANDX (UCHAR)0x24
  179. #define SMB_COM_TRANSACTION (UCHAR)0x25
  180. #define SMB_COM_TRANSACTION_SECONDARY (UCHAR)0x26
  181. #define SMB_COM_IOCTL (UCHAR)0x27
  182. #define SMB_COM_IOCTL_SECONDARY (UCHAR)0x28
  183. #define SMB_COM_COPY (UCHAR)0x29
  184. #define SMB_COM_MOVE (UCHAR)0x2A
  185. #define SMB_COM_ECHO (UCHAR)0x2B
  186. #define SMB_COM_WRITE_AND_CLOSE (UCHAR)0x2C
  187. #define SMB_COM_OPEN_ANDX (UCHAR)0x2D
  188. #define SMB_COM_READ_ANDX (UCHAR)0x2E
  189. #define SMB_COM_WRITE_ANDX (UCHAR)0x2F
  190. #define SMB_COM_CLOSE_AND_TREE_DISC (UCHAR)0x31
  191. #define SMB_COM_TRANSACTION2 (UCHAR)0x32
  192. #define SMB_COM_TRANSACTION2_SECONDARY (UCHAR)0x33
  193. #define SMB_COM_FIND_CLOSE2 (UCHAR)0x34
  194. #define SMB_COM_FIND_NOTIFY_CLOSE (UCHAR)0x35
  195. #define SMB_COM_TREE_CONNECT (UCHAR)0x70
  196. #define SMB_COM_TREE_DISCONNECT (UCHAR)0x71
  197. #define SMB_COM_NEGOTIATE (UCHAR)0x72
  198. #define SMB_COM_SESSION_SETUP_ANDX (UCHAR)0x73
  199. #define SMB_COM_LOGOFF_ANDX (UCHAR)0x74
  200. #define SMB_COM_TREE_CONNECT_ANDX (UCHAR)0x75
  201. #define SMB_COM_QUERY_INFORMATION_DISK (UCHAR)0x80
  202. #define SMB_COM_SEARCH (UCHAR)0x81
  203. #define SMB_COM_FIND (UCHAR)0x82
  204. #define SMB_COM_FIND_UNIQUE (UCHAR)0x83
  205. #define SMB_COM_FIND_CLOSE (UCHAR)0x84
  206. #define SMB_COM_NT_TRANSACT (UCHAR)0xA0
  207. #define SMB_COM_NT_TRANSACT_SECONDARY (UCHAR)0xA1
  208. #define SMB_COM_NT_CREATE_ANDX (UCHAR)0xA2
  209. #define SMB_COM_NT_CANCEL (UCHAR)0xA4
  210. #define SMB_COM_NT_RENAME (UCHAR)0xA5
  211. #define SMB_COM_OPEN_PRINT_FILE (UCHAR)0xC0
  212. #define SMB_COM_WRITE_PRINT_FILE (UCHAR)0xC1
  213. #define SMB_COM_CLOSE_PRINT_FILE (UCHAR)0xC2
  214. #define SMB_COM_GET_PRINT_QUEUE (UCHAR)0xC3
  215. #define SMB_COM_SEND_MESSAGE (UCHAR)0xD0
  216. #define SMB_COM_SEND_BROADCAST_MESSAGE (UCHAR)0xD1
  217. #define SMB_COM_FORWARD_USER_NAME (UCHAR)0xD2
  218. #define SMB_COM_CANCEL_FORWARD (UCHAR)0xD3
  219. #define SMB_COM_GET_MACHINE_NAME (UCHAR)0xD4
  220. #define SMB_COM_SEND_START_MB_MESSAGE (UCHAR)0xD5
  221. #define SMB_COM_SEND_END_MB_MESSAGE (UCHAR)0xD6
  222. #define SMB_COM_SEND_TEXT_MB_MESSAGE (UCHAR)0xD7
  223. // *** End of SMB commands
  224. #define SMB_COM_NO_ANDX_COMMAND (UCHAR)0xFF
  225. //
  226. // Header for SMBs, see #4 page 10
  227. //
  228. // *** Note that we do NOT define PSMB_HEADER as SMB_UNALIGNED! This is
  229. // done on the assumption that the SMB header, at least, will always
  230. // be properly aligned. If you need to access an unaligned header,
  231. // declare the pointer as SMB_UNALIGNED *SMB_HEADER.
  232. //
  233. #define SMB_SECURITY_SIGNATURE_LENGTH 8
  234. typedef struct _SMB_HEADER {
  235. UCHAR Protocol[4]; // Contains 0xFF,'SMB'
  236. UCHAR Command; // Command code
  237. UCHAR ErrorClass; // Error class
  238. UCHAR Reserved; // Reserved for future use
  239. _USHORT( Error ); // Error code
  240. UCHAR Flags; // Flags
  241. _USHORT( Flags2 ); // More flags
  242. union {
  243. _USHORT( Reserved2 )[6]; // Reserved for future use
  244. struct {
  245. _USHORT( PidHigh ); // High part of PID (NT Create And X)
  246. union {
  247. struct {
  248. _ULONG( Key ); // Encryption key (IPX)
  249. _USHORT( Sid ); // Session ID (IPX)
  250. _USHORT( SequenceNumber ); // Sequence number (IPX)
  251. _USHORT( Gid ); // Group ID (unused?)
  252. };
  253. UCHAR SecuritySignature[SMB_SECURITY_SIGNATURE_LENGTH];
  254. // Client must send the correct Signature
  255. // for this SMB to be accepted.
  256. };
  257. };
  258. };
  259. _USHORT( Tid ); // Authenticated user/group
  260. _USHORT( Pid ); // Caller's process id
  261. _USHORT( Uid ); // Unauthenticated user id
  262. _USHORT( Mid ); // multiplex id
  263. #ifdef NO_PACKING // ***
  264. _USHORT( Kludge ); // *** make sure parameter structs
  265. #endif // *** are longword aligned
  266. } SMB_HEADER;
  267. typedef SMB_HEADER *PSMB_HEADER;
  268. typedef struct _NT_SMB_HEADER {
  269. UCHAR Protocol[4]; // Contains 0xFF,'SMB'
  270. UCHAR Command; // Command code
  271. union {
  272. struct {
  273. UCHAR ErrorClass; // Error class
  274. UCHAR Reserved; // Reserved for future use
  275. _USHORT( Error ); // Error code
  276. } DosError;
  277. ULONG NtStatus; // NT-style 32-bit error code
  278. } Status;
  279. UCHAR Flags; // Flags
  280. _USHORT( Flags2 ); // More flags
  281. union {
  282. _USHORT( Reserved2 )[6]; // Reserved for future use
  283. struct {
  284. _USHORT( PidHigh ); // High part of PID (NT Create And X)
  285. union {
  286. struct {
  287. _ULONG( Key ); // Encryption key (IPX)
  288. _USHORT( Sid ); // Session ID (IPX)
  289. _USHORT( SequenceNumber ); // Sequence number (IPX)
  290. _USHORT( Gid ); // Group ID (unused?)
  291. };
  292. UCHAR SecuritySignature[SMB_SECURITY_SIGNATURE_LENGTH];
  293. // Client must send the correct Signature
  294. // for this SMB to be accepted.
  295. };
  296. };
  297. };
  298. _USHORT( Tid ); // Authenticated user/group
  299. _USHORT( Pid ); // Caller's process id
  300. _USHORT( Uid ); // Unauthenticated user id
  301. _USHORT( Mid ); // multiplex id
  302. #ifdef NO_PACKING // ***
  303. _USHORT( Kludge ); // *** make sure parameter structs
  304. #endif // *** are longword aligned
  305. } NT_SMB_HEADER;
  306. typedef NT_SMB_HEADER *PNT_SMB_HEADER;
  307. //
  308. // The SMB header, protocol field, as a long.
  309. //
  310. #define SMB_HEADER_PROTOCOL (0xFF + ('S' << 8) + ('M' << 16) + ('B' << 24))
  311. //
  312. // Minimum parameter structure that can be returned. Used in returning
  313. // error SMBs.
  314. //
  315. // *** Note that this structure does NOT have a Buffer field!
  316. //
  317. typedef struct _SMB_PARAMS {
  318. UCHAR WordCount; // Count of parameter words = 0
  319. _USHORT( ByteCount ); // Count of bytes that follow; min = 0
  320. } SMB_PARAMS;
  321. typedef SMB_PARAMS SMB_UNALIGNED *PSMB_PARAMS;
  322. //
  323. // Generic header for AndX commands.
  324. //
  325. typedef struct _GENERIC_ANDX {
  326. UCHAR WordCount; // Count of parameter words
  327. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  328. UCHAR AndXReserved; // Reserved
  329. _USHORT( AndXOffset ); // Offset (from SMB header start)
  330. } GENERIC_ANDX;
  331. typedef GENERIC_ANDX SMB_UNALIGNED *PGENERIC_ANDX;
  332. #ifdef INCLUDE_SMB_MESSAGE
  333. //
  334. // Cancel Forward SMB, see #1 page 35
  335. // Function is SrvSmbCancelForward()
  336. // SMB_COM_CANCEL_FORWARD 0xD3
  337. //
  338. typedef struct _REQ_CANCEL_FORWARD {
  339. UCHAR WordCount; // Count of parameter words = 0
  340. _USHORT( ByteCount ); // Count of data bytes; min = 2
  341. UCHAR Buffer[1]; // Buffer containing:
  342. //UCHAR BufferFormat; // 0x04 -- ASCII
  343. //UCHAR ForwardedName[]; // Forwarded name
  344. } REQ_CANCEL_FORWARD;
  345. typedef REQ_CANCEL_FORWARD SMB_UNALIGNED *PREQ_CANCEL_FORWARD;
  346. typedef struct _RESP_CANCEL_FORWARD {
  347. UCHAR WordCount; // Count of parameter words = 0
  348. _USHORT( ByteCount ); // Count of data bytes = 0
  349. UCHAR Buffer[1]; // empty
  350. } RESP_CANCEL_FORWARD;
  351. typedef RESP_CANCEL_FORWARD SMB_UNALIGNED *PRESP_CANCEL_FORWARD;
  352. #endif // def INCLUDE_SMB_MESSAGE
  353. #ifdef INCLUDE_SMB_DIRECTORY
  354. //
  355. // Check Directory SMB, see #1 page 23
  356. // Function is SrvSmbCheckDirectory()
  357. // SMB_COM_CHECK_DIRECTORY 0x10
  358. //
  359. typedef struct _REQ_CHECK_DIRECTORY {
  360. UCHAR WordCount; // Count of parameter words = 0
  361. _USHORT( ByteCount ); // Count of data bytes; min = 2
  362. UCHAR Buffer[1]; // Buffer containing:
  363. //UCHAR BufferFormat; // 0x04 -- ASCII
  364. //UCHAR DirectoryPath[]; // Directory path
  365. } REQ_CHECK_DIRECTORY;
  366. typedef REQ_CHECK_DIRECTORY SMB_UNALIGNED *PREQ_CHECK_DIRECTORY;
  367. typedef struct _RESP_CHECK_DIRECTORY {
  368. UCHAR WordCount; // Count of parameter words = 0
  369. _USHORT( ByteCount ); // Count of data bytes = 0
  370. UCHAR Buffer[1]; // empty
  371. } RESP_CHECK_DIRECTORY;
  372. typedef RESP_CHECK_DIRECTORY SMB_UNALIGNED *PRESP_CHECK_DIRECTORY;
  373. #endif // def INCLUDE_SMB_DIRECTORY
  374. #ifdef INCLUDE_SMB_OPEN_CLOSE
  375. //
  376. // Close SMB, see #1 page 10
  377. // Function is SrvSmbClose()
  378. // SMB_COM_CLOSE 0x04
  379. //
  380. typedef struct _REQ_CLOSE {
  381. UCHAR WordCount; // Count of parameter words = 3
  382. _USHORT( Fid ); // File handle
  383. _ULONG( LastWriteTimeInSeconds ); // Time of last write, low and high
  384. _USHORT( ByteCount ); // Count of data bytes = 0
  385. UCHAR Buffer[1]; // empty
  386. } REQ_CLOSE;
  387. typedef REQ_CLOSE SMB_UNALIGNED *PREQ_CLOSE;
  388. typedef struct _RESP_CLOSE {
  389. UCHAR WordCount; // Count of parameter words = 0
  390. _USHORT( ByteCount ); // Count of data bytes = 0
  391. UCHAR Buffer[1]; // empty
  392. } RESP_CLOSE;
  393. typedef RESP_CLOSE SMB_UNALIGNED *PRESP_CLOSE;
  394. #ifdef INCLUDE_SMB_IFMODIFIED
  395. typedef struct _REQ_EXTENDED_CLOSE {
  396. UCHAR WordCount; // Count of parameter words = 5
  397. _USHORT( Fid ); // File handle
  398. _ULONG( LastWriteTimeInSeconds ); // Time of last write, low and high
  399. _ULONG( Flags ); // NT_CREATE_xxx
  400. _USHORT( ByteCount ); // Count of data bytes = 0
  401. UCHAR Buffer[1]; // empty
  402. } REQ_EXTENDED_CLOSE;
  403. typedef REQ_EXTENDED_CLOSE SMB_UNALIGNED *PREQ_EXTENDED_CLOSE;
  404. #define SMB_RESP_EXTENDED_CLOSE_WORK_COUNT 32
  405. typedef struct _RESP_EXTENDED_CLOSE {
  406. UCHAR WordCount; // Count of parameter words = 32
  407. _ULONG( FileAttributes ); // File attributes for creation
  408. _ULONG( Flags ); // NT_CREATE_xxx
  409. TIME CreationTime; // The time the file was created
  410. TIME LastWriteTime; // The time the file was last written
  411. TIME ChangeTime; // The time the file was last changed
  412. LARGE_INTEGER AllocationSize; // Initial allocation size
  413. LARGE_INTEGER EndOfFile; // The end of file offset
  414. LARGE_INTEGER UsnValue; // The file's USN # in NTFS
  415. LARGE_INTEGER FileReferenceNumber; //
  416. _USHORT( ByteCount ); // Count of data bytes = 0
  417. UCHAR Buffer[1]; // empty
  418. } RESP_EXTENDED_CLOSE;
  419. typedef RESP_EXTENDED_CLOSE SMB_UNALIGNED *PRESP_EXTENDED_CLOSE;
  420. #endif // def INCLUDE_SMB_IFMODIFIED
  421. #endif // def INCLUDE_SMB_OPEN_CLOSE
  422. #ifdef INCLUDE_SMB_OPEN_CLOSE
  423. //
  424. // Close and Tree Disconnect SMB, see #? page ??
  425. // Function is SrvSmbCloseAndTreeDisc
  426. // SMB_COM_CLOSE_AND_TREE_DISC 0x31
  427. //
  428. typedef struct _REQ_CLOSE_AND_TREE_DISC {
  429. UCHAR WordCount; // Count of parameter words
  430. _USHORT( Fid ); // File handle
  431. _ULONG( LastWriteTimeInSeconds );
  432. _USHORT( ByteCount ); // Count of data bytes = 0
  433. UCHAR Buffer[1]; // empty
  434. } REQ_CLOSE_AND_TREE_DISC;
  435. typedef REQ_CLOSE_AND_TREE_DISC SMB_UNALIGNED *PREQ_CLOSE_AND_TREE_DISC;
  436. typedef struct _RESP_CLOSE_AND_TREE_DISC {
  437. UCHAR WordCount; // Count of parameter words = 0
  438. _USHORT( ByteCount ); // Count of data bytes = 0
  439. UCHAR Buffer[1]; // empty
  440. } RESP_CLOSE_AND_TREE_DISC;
  441. typedef RESP_CLOSE_AND_TREE_DISC SMB_UNALIGNED *PRESP_CLOSE_AND_TREE_DISC;
  442. #endif // def INCLUDE_SMB_OPEN_CLOSE
  443. #ifdef INCLUDE_SMB_PRINT
  444. //
  445. // Close Print Spool File SMB, see #1 page 29
  446. // Function is SrvSmbClosePrintSpoolFile()
  447. // SMB_COM_CLOSE_PRINT_FILE 0xC2
  448. //
  449. typedef struct _REQ_CLOSE_PRINT_FILE {
  450. UCHAR WordCount; // Count of parameter words = 1
  451. _USHORT( Fid ); // File handle
  452. _USHORT( ByteCount ); // Count of data bytes = 0
  453. UCHAR Buffer[1]; // empty
  454. } REQ_CLOSE_PRINT_FILE;
  455. typedef REQ_CLOSE_PRINT_FILE SMB_UNALIGNED *PREQ_CLOSE_PRINT_FILE;
  456. typedef struct _RESP_CLOSE_PRINT_FILE {
  457. UCHAR WordCount; // Count of parameter words = 0
  458. _USHORT( ByteCount ); // Count of data bytes = 0
  459. UCHAR Buffer[1]; // empty
  460. } RESP_CLOSE_PRINT_FILE;
  461. typedef RESP_CLOSE_PRINT_FILE SMB_UNALIGNED *PRESP_CLOSE_PRINT_FILE;
  462. #endif // def INCLUDE_SMB_PRINT
  463. #ifdef INCLUDE_SMB_FILE_CONTROL
  464. //
  465. // Copy SMB, see #2 page 23
  466. // Function is SrvSmbCopy()
  467. // SMB_COM_COPY 0x29
  468. //
  469. typedef struct _REQ_COPY {
  470. UCHAR WordCount; // Count of parameter words = 3
  471. _USHORT( Tid2 ); // Second (target) path TID
  472. _USHORT( OpenFunction ); // What to do if target file exists
  473. _USHORT( Flags ); // Flags to control copy operation:
  474. // bit 0 - target must be a file
  475. // bit 1 - target must ba a dir.
  476. // bit 2 - copy target mode:
  477. // 0 = binary, 1 = ASCII
  478. // bit 3 - copy source mode:
  479. // 0 = binary, 1 = ASCII
  480. // bit 4 - verify all writes
  481. // bit 5 - tree copy
  482. _USHORT( ByteCount ); // Count of data bytes; min = 2
  483. UCHAR Buffer[1]; // Buffer containing:
  484. //UCHAR SourceFileName[]; // pathname of source file
  485. //UCHAR TargetFileName[]; // pathname of target file
  486. } REQ_COPY;
  487. typedef REQ_COPY SMB_UNALIGNED *PREQ_COPY;
  488. typedef struct _RESP_COPY {
  489. UCHAR WordCount; // Count of parameter words = 1
  490. _USHORT( Count ); // Number of files copied
  491. _USHORT( ByteCount ); // Count of data bytes; min = 0
  492. UCHAR Buffer[1]; // ASCIIZ pathname of file with error
  493. } RESP_COPY;
  494. typedef RESP_COPY SMB_UNALIGNED *PRESP_COPY;
  495. #endif // def INCLUDE_SMB_FILE_CONTROL
  496. #ifdef INCLUDE_SMB_OPEN_CLOSE
  497. //
  498. // Create SMB, see #1 page 9
  499. // Create New SMB, see #1 page 23
  500. // Function is SrvSmbCreate()
  501. // SMB_COM_CREATE 0x03
  502. // SMB_COM_CREATE_NEW 0x0F
  503. //
  504. typedef struct _REQ_CREATE {
  505. UCHAR WordCount; // Count of parameter words = 3
  506. _USHORT( FileAttributes ); // New file attributes
  507. _ULONG( CreationTimeInSeconds ); // Creation time
  508. _USHORT( ByteCount ); // Count of data bytes; min = 2
  509. UCHAR Buffer[1]; // Buffer containing:
  510. //UCHAR BufferFormat; // 0x04 -- ASCII
  511. //UCHAR FileName[]; // File name
  512. } REQ_CREATE;
  513. typedef REQ_CREATE SMB_UNALIGNED *PREQ_CREATE;
  514. typedef struct _RESP_CREATE {
  515. UCHAR WordCount; // Count of parameter words = 1
  516. _USHORT( Fid ); // File handle
  517. _USHORT( ByteCount ); // Count of data bytes = 0
  518. UCHAR Buffer[1]; // empty
  519. } RESP_CREATE;
  520. typedef RESP_CREATE SMB_UNALIGNED *PRESP_CREATE;
  521. #endif // def INCLUDE_SMB_OPEN_CLOSE
  522. #ifdef INCLUDE_SMB_DIRECTORY
  523. //
  524. // Create Directory SMB, see #1 page 14
  525. // Function is SrvSmbCreateDirectory
  526. // SMB_COM_CREATE_DIRECTORY 0x00
  527. //
  528. typedef struct _REQ_CREATE_DIRECTORY {
  529. UCHAR WordCount; // Count of parameter words = 0
  530. _USHORT( ByteCount ); // Count of data bytes; min = 2
  531. UCHAR Buffer[1]; // Buffer containing:
  532. //UCHAR BufferFormat; // 0x04 -- ASCII
  533. //UCHAR DirectoryName[]; // Directory name
  534. } REQ_CREATE_DIRECTORY;
  535. typedef REQ_CREATE_DIRECTORY SMB_UNALIGNED *PREQ_CREATE_DIRECTORY;
  536. typedef struct _RESP_CREATE_DIRECTORY {
  537. UCHAR WordCount; // Count of parameter words = 0
  538. _USHORT( ByteCount ); // Count of data bytes = 0
  539. UCHAR Buffer[1]; // empty
  540. } RESP_CREATE_DIRECTORY;
  541. typedef RESP_CREATE_DIRECTORY SMB_UNALIGNED *PRESP_CREATE_DIRECTORY;
  542. #endif // def INCLUDE_SMB_DIRECTORY
  543. #ifdef INCLUDE_SMB_OPEN_CLOSE
  544. //
  545. // Create Temporary SMB, see #1 page 21
  546. // Function is SrvSmbCreateTemporary()
  547. // SMB_COM_CREATE_TEMPORARY 0x0E
  548. //
  549. typedef struct _REQ_CREATE_TEMPORARY {
  550. UCHAR WordCount; // Count of parameter words = 3
  551. _USHORT( FileAttributes );
  552. _ULONG( CreationTimeInSeconds );
  553. _USHORT( ByteCount ); // Count of data bytes; min = 2
  554. UCHAR Buffer[1]; // Buffer containing:
  555. //UCHAR BufferFormat; // 0x04 -- ASCII
  556. //UCHAR DirectoryName[]; // Directory name
  557. } REQ_CREATE_TEMPORARY;
  558. typedef REQ_CREATE_TEMPORARY SMB_UNALIGNED *PREQ_CREATE_TEMPORARY;
  559. typedef struct _RESP_CREATE_TEMPORARY {
  560. UCHAR WordCount; // Count of parameter words = 1
  561. _USHORT( Fid ); // File handle
  562. _USHORT( ByteCount ); // Count of data bytes; min = 2
  563. UCHAR Buffer[1]; // Buffer containing:
  564. //UCHAR BufferFormat; // 0x04 -- ASCII
  565. //UCHAR FileName[]; // File name
  566. } RESP_CREATE_TEMPORARY;
  567. typedef RESP_CREATE_TEMPORARY SMB_UNALIGNED *PRESP_CREATE_TEMPORARY;
  568. #endif // def INCLUDE_SMB_OPEN_CLOSE
  569. #ifdef INCLUDE_SMB_FILE_CONTROL
  570. //
  571. // Delete SMB, see #1 page 16
  572. // Function is SrvSmbDelete()
  573. // SMB_COM_DELETE 0x06
  574. //
  575. typedef struct _REQ_DELETE {
  576. UCHAR WordCount; // Count of parameter words = 1
  577. _USHORT( SearchAttributes );
  578. _USHORT( ByteCount ); // Count of data bytes; min = 2
  579. UCHAR Buffer[1]; // Buffer containing:
  580. //UCHAR BufferFormat; // 0x04 -- ASCII
  581. //UCHAR FileName[]; // File name
  582. } REQ_DELETE;
  583. typedef REQ_DELETE SMB_UNALIGNED *PREQ_DELETE;
  584. typedef struct _RESP_DELETE {
  585. UCHAR WordCount; // Count of parameter words = 0
  586. _USHORT( ByteCount ); // Count of data bytes = 0
  587. UCHAR Buffer[1]; // empty
  588. } RESP_DELETE;
  589. typedef RESP_DELETE SMB_UNALIGNED *PRESP_DELETE;
  590. #endif // def INCLUDE_SMB_FILE_CONTROL
  591. #ifdef INCLUDE_SMB_DIRECTORY
  592. //
  593. // Delete Directory SMB, see #1 page 15
  594. // Function is SrvSmbDeleteDirectory()
  595. // SMB_COM_DELETE_DIRECTORY 0x01
  596. //
  597. typedef struct _REQ_DELETE_DIRECTORY {
  598. UCHAR WordCount; // Count of parameter words = 0
  599. _USHORT( ByteCount ); // Count of data bytes; min = 2
  600. UCHAR Buffer[1]; // Buffer containing:
  601. //UCHAR BufferFormat; // 0x04 -- ASCII
  602. //UCHAR DirectoryName[]; // Directory name
  603. } REQ_DELETE_DIRECTORY;
  604. typedef REQ_DELETE_DIRECTORY SMB_UNALIGNED *PREQ_DELETE_DIRECTORY;
  605. typedef struct _RESP_DELETE_DIRECTORY {
  606. UCHAR WordCount; // Count of parameter words = 0
  607. _USHORT( ByteCount ); // Count of data bytes = 0
  608. UCHAR Buffer[1]; // empty
  609. } RESP_DELETE_DIRECTORY;
  610. typedef RESP_DELETE_DIRECTORY SMB_UNALIGNED *PRESP_DELETE_DIRECTORY;
  611. #endif // def INCLUDE_SMB_DIRECTORY
  612. #ifdef INCLUDE_SMB_MISC
  613. //
  614. // Echo SMB, see #2 page 25
  615. // Function is SrvSmbEcho()
  616. // SMB_COM_ECHO 0x2B
  617. //
  618. typedef struct _REQ_ECHO {
  619. UCHAR WordCount; // Count of parameter words = 1
  620. _USHORT( EchoCount ); // Number of times to echo data back
  621. _USHORT( ByteCount ); // Count of data bytes; min = 4
  622. UCHAR Buffer[1]; // Data to echo
  623. } REQ_ECHO;
  624. typedef REQ_ECHO SMB_UNALIGNED *PREQ_ECHO;
  625. typedef struct _RESP_ECHO {
  626. UCHAR WordCount; // Count of parameter words = 1
  627. _USHORT( SequenceNumber ); // Sequence number of this echo
  628. _USHORT( ByteCount ); // Count of data bytes; min = 4
  629. UCHAR Buffer[1]; // Echoed data
  630. } RESP_ECHO;
  631. typedef RESP_ECHO SMB_UNALIGNED *PRESP_ECHO;
  632. #endif // def INCLUDE_SMB_MISC
  633. #ifdef INCLUDE_SMB_SEARCH
  634. //
  635. // Find Close2 SMB, see #3 page 54
  636. // Function is SrvFindClose2()
  637. // SMB_COM_FIND_CLOSE2 0x34
  638. //
  639. typedef struct _REQ_FIND_CLOSE2 {
  640. UCHAR WordCount; // Count of parameter words = 1
  641. _USHORT( Sid ); // Find handle
  642. _USHORT( ByteCount ); // Count of data bytes = 0
  643. UCHAR Buffer[1]; // empty
  644. } REQ_FIND_CLOSE2;
  645. typedef REQ_FIND_CLOSE2 SMB_UNALIGNED *PREQ_FIND_CLOSE2;
  646. typedef struct _RESP_FIND_CLOSE2 {
  647. UCHAR WordCount; // Count of parameter words = 0
  648. _USHORT( ByteCount ); // Count of data bytes = 0
  649. UCHAR Buffer[1]; // empty
  650. } RESP_FIND_CLOSE2;
  651. typedef RESP_FIND_CLOSE2 SMB_UNALIGNED *PRESP_FIND_CLOSE2;
  652. #endif // def INCLUDE_SMB_SEARCH
  653. #ifdef INCLUDE_SMB_SEARCH
  654. //
  655. // Find Notify Close SMB, see #3 page 53
  656. // Function is SrvSmbFindNotifyClose()
  657. // SMB_COM_FIND_NOTIFY_CLOSE 0x35
  658. //
  659. typedef struct _REQ_FIND_NOTIFY_CLOSE {
  660. UCHAR WordCount; // Count of parameter words = 1
  661. _USHORT( Handle ); // Find notify handle
  662. _USHORT( ByteCount ); // Count of data bytes = 0
  663. UCHAR Buffer[1]; // empty
  664. } REQ_FIND_NOTIFY_CLOSE;
  665. typedef REQ_FIND_NOTIFY_CLOSE SMB_UNALIGNED *PREQ_FIND_NOTIFY_CLOSE;
  666. typedef struct _RESP_FIND_NOTIFY_CLOSE {
  667. UCHAR WordCount; // Count of parameter words = 0
  668. _USHORT( ByteCount ); // Count of data bytes = 0
  669. UCHAR Buffer[1]; // empty
  670. } RESP_FIND_NOTIFY_CLOSE;
  671. typedef RESP_FIND_NOTIFY_CLOSE SMB_UNALIGNED *PRESP_FIND_NOTIFY_CLOSE;
  672. #endif // def INCLUDE_SMB_SEARCH
  673. #ifdef INCLUDE_SMB_FILE_CONTROL
  674. //
  675. // Flush SMB, see #1 page 11
  676. // Function is SrvSmbFlush()
  677. // SMB_COM_FLUSH 0x05
  678. //
  679. typedef struct _REQ_FLUSH {
  680. UCHAR WordCount; // Count of parameter words = 1
  681. _USHORT( Fid ); // File handle
  682. _USHORT( ByteCount ); // Count of data bytes = 0
  683. UCHAR Buffer[1]; // empty
  684. } REQ_FLUSH;
  685. typedef REQ_FLUSH SMB_UNALIGNED *PREQ_FLUSH;
  686. typedef struct _RESP_FLUSH {
  687. UCHAR WordCount; // Count of parameter words = 0
  688. _USHORT( ByteCount ); // Count of data bytes = 0
  689. UCHAR Buffer[1]; // empty
  690. } RESP_FLUSH;
  691. typedef RESP_FLUSH SMB_UNALIGNED *PRESP_FLUSH;
  692. #endif // def INCLUDE_SMB_FILE_CONTROL
  693. #ifdef INCLUDE_SMB_MESSAGE
  694. //
  695. // Forward User Name SMB, see #1 page 34
  696. // Function is SrvSmbForwardUserName()
  697. // SMB_COM_FORWARD_USER_NAME 0xD2
  698. //
  699. typedef struct _REQ_FORWARD_USER_NAME {
  700. UCHAR WordCount; // Count of parameter words = 0
  701. _USHORT( ByteCount ); // Count of data bytes; min = 2
  702. UCHAR Buffer[1]; // Buffer containing:
  703. //UCHAR BufferFormat; // 0x04 -- ASCII
  704. //UCHAR ForwardedName[]; // Forwarded name
  705. } REQ_FORWARD_USER_NAME;
  706. typedef REQ_FORWARD_USER_NAME SMB_UNALIGNED *PREQ_FORWARD_USER_NAME;
  707. typedef struct _RESP_FORWARD_USER_NAME {
  708. UCHAR WordCount; // Count of parameter words = 0
  709. _USHORT( ByteCount ); // Count of data bytes = 0
  710. UCHAR Buffer[1]; // empty
  711. } RESP_FORWARD_USER_NAME;
  712. typedef RESP_FORWARD_USER_NAME SMB_UNALIGNED *PRESP_FORWARD_USER_NAME;
  713. #endif // def INCLUDE_SMB_MESSAGE
  714. #ifdef INCLUDE_SMB_MESSAGE
  715. //
  716. // Get Machine Name SMB, see #1 page 35
  717. // Function is SrvSmbGetMachineName()
  718. // SMB_COM_GET_MACHINE_NAME 0xD4
  719. //
  720. typedef struct _REQ_GET_MACHINE_NAME {
  721. UCHAR WordCount; // Count of parameter words = 0
  722. _USHORT( ByteCount ); // Count of data bytes = 0
  723. UCHAR Buffer[1]; // empty
  724. } REQ_GET_MACHINE_NAME;
  725. typedef REQ_GET_MACHINE_NAME SMB_UNALIGNED *PREQ_GET_MACHINE_NAME;
  726. typedef struct _RESP_GET_MACHINE_NAME {
  727. UCHAR WordCount; // Count of parameter words = 0
  728. _USHORT( ByteCount ); // Count of data bytes; min = 2
  729. UCHAR Buffer[1]; // Buffer containing:
  730. //UCHAR BufferFormat; // 0x04 -- ASCII
  731. //UCHAR MachineName[]; // Machine name
  732. } RESP_GET_MACHINE_NAME;
  733. typedef RESP_GET_MACHINE_NAME SMB_UNALIGNED *PRESP_GET_MACHINE_NAME;
  734. #endif // def INCLUDE_SMB_MESSAGE
  735. #ifdef INCLUDE_SMB_PRINT
  736. //
  737. // Get Print Queue SMB, see #1 page 29
  738. // Function is SrvSmbGetPrintQueue()
  739. // SMB_COM_GET_PRINT_QUEUE 0xC3
  740. //
  741. typedef struct _REQ_GET_PRINT_QUEUE {
  742. UCHAR WordCount; // Count of parameter words = 2
  743. _USHORT( MaxCount ); // Max number of entries to return
  744. _USHORT( StartIndex ); // First queue entry to return
  745. _USHORT( ByteCount ); // Count of data bytes = 0
  746. UCHAR Buffer[1]; // empty
  747. } REQ_GET_PRINT_QUEUE;
  748. typedef REQ_GET_PRINT_QUEUE SMB_UNALIGNED *PREQ_GET_PRINT_QUEUE;
  749. typedef struct _RESP_GET_PRINT_QUEUE {
  750. UCHAR WordCount; // Count of parameter words = 2
  751. _USHORT( Count ); // Number of entries returned
  752. _USHORT( RestartIndex ); // Index of entry after last returned
  753. _USHORT( ByteCount ); // Count of data bytes; min = 3
  754. UCHAR Buffer[1]; // Buffer containing:
  755. //UCHAR BufferFormat; // 0x01 -- Data block
  756. //USHORT DataLength; // Length of data
  757. //UCHAR Data[]; // Queue elements
  758. } RESP_GET_PRINT_QUEUE;
  759. typedef RESP_GET_PRINT_QUEUE SMB_UNALIGNED *PRESP_GET_PRINT_QUEUE;
  760. #endif // def INCLUDE_SMB_PRINT
  761. #ifdef INCLUDE_SMB_TRANSACTION
  762. //
  763. // Ioctl SMB, see #2 page 39
  764. // Function is SrvSmbIoctl()
  765. // SMB_COM_IOCTL 0x27
  766. // SMB_COM_IOCTL_SECONDARY 0x28
  767. //
  768. typedef struct _REQ_IOCTL {
  769. UCHAR WordCount; // Count of parameter words = 14
  770. _USHORT( Fid ); // File handle
  771. _USHORT( Category ); // Device category
  772. _USHORT( Function ); // Device function
  773. _USHORT( TotalParameterCount ); // Total parameter bytes being sent
  774. _USHORT( TotalDataCount ); // Total data bytes being sent
  775. _USHORT( MaxParameterCount ); // Max parameter bytes to return
  776. _USHORT( MaxDataCount ); // Max data bytes to return
  777. _ULONG( Timeout );
  778. _USHORT( Reserved );
  779. _USHORT( ParameterCount ); // Parameter bytes sent this buffer
  780. _USHORT( ParameterOffset ); // Offset (from header start) to params
  781. _USHORT( DataCount ); // Data bytes sent this buffer
  782. _USHORT( DataOffset ); // Offset (from header start) to data
  783. _USHORT( ByteCount ); // Count of data bytes
  784. UCHAR Buffer[1]; // Buffer containing:
  785. //UCHAR Pad[]; // Pad to SHORT or LONG
  786. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  787. //UCHAR Pad1[]; // Pad to SHORT or LONG
  788. //UCHAR Data[]; // Data bytes (# = DataCount)
  789. } REQ_IOCTL;
  790. typedef REQ_IOCTL SMB_UNALIGNED *PREQ_IOCTL;
  791. typedef struct _RESP_IOCTL_INTERIM {
  792. UCHAR WordCount; // Count of parameter words = 0
  793. _USHORT( ByteCount ); // Count of data bytes = 0
  794. UCHAR Buffer[1]; // empty
  795. } RESP_IOCTL_INTERIM;
  796. typedef RESP_IOCTL_INTERIM SMB_UNALIGNED *PRESP_IOCTL_INTERIM;
  797. typedef struct _REQ_IOCTL_SECONDARY {
  798. UCHAR WordCount; // Count of parameter words = 8
  799. _USHORT( TotalParameterCount ); // Total parameter bytes being sent
  800. _USHORT( TotalDataCount ); // Total data bytes being sent
  801. _USHORT( ParameterCount ); // Parameter bytes sent this buffer
  802. _USHORT( ParameterOffset ); // Offset (from header start) to params
  803. _USHORT( ParameterDisplacement ); // Displacement of these param bytes
  804. _USHORT( DataCount ); // Data bytes sent this buffer
  805. _USHORT( DataOffset ); // Offset (from header start) to data
  806. _USHORT( DataDisplacement ); // Displacement of these data bytes
  807. _USHORT( ByteCount ); // Count of data bytes
  808. UCHAR Buffer[1]; // Buffer containing:
  809. //UCHAR Pad[]; // Pad to SHORT or LONG
  810. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  811. //UCHAR Pad1[]; // Pad to SHORT or LONG
  812. //UCHAR Data[]; // Data bytes (# = DataCount)
  813. } REQ_IOCTL_SECONDARY;
  814. typedef REQ_IOCTL_SECONDARY SMB_UNALIGNED *PREQ_IOCTL_SECONDARY;
  815. typedef struct _RESP_IOCTL {
  816. UCHAR WordCount; // Count of parameter words = 8
  817. _USHORT( TotalParameterCount ); // Total parameter bytes being sent
  818. _USHORT( TotalDataCount ); // Total data bytes being sent
  819. _USHORT( ParameterCount ); // Parameter bytes sent this buffer
  820. _USHORT( ParameterOffset ); // Offset (from header start) to params
  821. _USHORT( ParameterDisplacement ); // Displacement of these param bytes
  822. _USHORT( DataCount ); // Data bytes sent this buffer
  823. _USHORT( DataOffset ); // Offset (from header start) to data
  824. _USHORT( DataDisplacement ); // Displacement of these data bytes
  825. _USHORT( ByteCount ); // Count of data bytes
  826. UCHAR Buffer[1]; // Buffer containing:
  827. //UCHAR Pad[]; // Pad to SHORT or LONG
  828. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  829. //UCHAR Pad1[]; // Pad to SHORT or LONG
  830. //UCHAR Data[]; // Data bytes (# = DataCount)
  831. } RESP_IOCTL;
  832. typedef RESP_IOCTL SMB_UNALIGNED *PRESP_IOCTL;
  833. #endif // def INCLUDE_SMB_TRANSACTION
  834. #ifdef INCLUDE_SMB_LOCK
  835. //
  836. // Lock Byte Range SMB, see #1 page 20
  837. // Function is SrvSmbLockByteRange()
  838. // SMB_COM_LOCK_BYTE_RANGE 0x0C
  839. //
  840. typedef struct _REQ_LOCK_BYTE_RANGE {
  841. UCHAR WordCount; // Count of parameter words = 5
  842. _USHORT( Fid ); // File handle
  843. _ULONG( Count ); // Count of bytes to lock
  844. _ULONG( Offset ); // Offset from start of file
  845. _USHORT( ByteCount ); // Count of data bytes = 0
  846. UCHAR Buffer[1]; // empty
  847. } REQ_LOCK_BYTE_RANGE;
  848. typedef REQ_LOCK_BYTE_RANGE SMB_UNALIGNED *PREQ_LOCK_BYTE_RANGE;
  849. typedef struct _RESP_LOCK_BYTE_RANGE {
  850. UCHAR WordCount; // Count of parameter words = 0
  851. _USHORT( ByteCount ); // Count of data bytes = 0
  852. UCHAR Buffer[1]; // empty
  853. } RESP_LOCK_BYTE_RANGE;
  854. typedef RESP_LOCK_BYTE_RANGE SMB_UNALIGNED *PRESP_LOCK_BYTE_RANGE;
  855. #endif // def INCLUDE_SMB_LOCK
  856. #ifdef INCLUDE_SMB_LOCK
  857. //
  858. // Locking and X SMB, see #2 page 46
  859. // Function is SrvLockingAndX()
  860. // SMB_COM_LOCKING_ANDX 0x24
  861. //
  862. typedef struct _REQ_LOCKING_ANDX {
  863. UCHAR WordCount; // Count of parameter words = 8
  864. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  865. UCHAR AndXReserved; // Reserved (must be 0)
  866. _USHORT( AndXOffset ); // Offset to next command WordCount
  867. _USHORT( Fid ); // File handle
  868. //
  869. // When NT protocol is not negotiated the OplockLevel field is
  870. // omitted, and LockType field is a full word. Since the upper
  871. // bits of LockType are never used, this definition works for
  872. // all protocols.
  873. //
  874. UCHAR( LockType ); // Locking mode:
  875. // bit 0: 0 = lock out all access
  876. // 1 = read OK while locked
  877. // bit 1: 1 = 1 user total file unlock
  878. UCHAR( OplockLevel ); // The new oplock level
  879. _ULONG( Timeout );
  880. _USHORT( NumberOfUnlocks ); // Num. unlock range structs following
  881. _USHORT( NumberOfLocks ); // Num. lock range structs following
  882. _USHORT( ByteCount ); // Count of data bytes
  883. UCHAR Buffer[1]; // Buffer containing:
  884. //LOCKING_ANDX_RANGE Unlocks[]; // Unlock ranges
  885. //LOCKING_ANDX_RANGE Locks[]; // Lock ranges
  886. } REQ_LOCKING_ANDX;
  887. typedef REQ_LOCKING_ANDX SMB_UNALIGNED *PREQ_LOCKING_ANDX;
  888. #define LOCKING_ANDX_SHARED_LOCK 0x01
  889. #define LOCKING_ANDX_OPLOCK_RELEASE 0x02
  890. #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
  891. #define LOCKING_ANDX_CANCEL_LOCK 0x08
  892. #define LOCKING_ANDX_LARGE_FILES 0x10
  893. #define OPLOCK_BROKEN_TO_NONE 0
  894. #define OPLOCK_BROKEN_TO_II 1
  895. typedef struct _LOCKING_ANDX_RANGE {
  896. _USHORT( Pid ); // PID of process "owning" lock
  897. _ULONG( Offset ); // Ofset to bytes to [un]lock
  898. _ULONG( Length ); // Number of bytes to [un]lock
  899. } LOCKING_ANDX_RANGE;
  900. typedef LOCKING_ANDX_RANGE SMB_UNALIGNED *PLOCKING_ANDX_RANGE;
  901. typedef struct _NT_LOCKING_ANDX_RANGE {
  902. _USHORT( Pid ); // PID of process "owning" lock
  903. _USHORT( Pad ); // Pad to DWORD align (mbz)
  904. _ULONG( OffsetHigh ); // Ofset to bytes to [un]lock (high)
  905. _ULONG( OffsetLow ); // Ofset to bytes to [un]lock (low)
  906. _ULONG( LengthHigh ); // Number of bytes to [un]lock (high)
  907. _ULONG( LengthLow ); // Number of bytes to [un]lock (low)
  908. } NTLOCKING_ANDX_RANGE;
  909. typedef NTLOCKING_ANDX_RANGE SMB_UNALIGNED *PNTLOCKING_ANDX_RANGE;
  910. //
  911. typedef struct _RESP_LOCKING_ANDX {
  912. UCHAR WordCount; // Count of parameter words = 2
  913. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  914. UCHAR AndXReserved; // Reserved (must be 0)
  915. _USHORT( AndXOffset ); // Offset to next command WordCount
  916. _USHORT( ByteCount ); // Count of data bytes = 0
  917. UCHAR Buffer[1]; // empty
  918. } RESP_LOCKING_ANDX;
  919. typedef RESP_LOCKING_ANDX SMB_UNALIGNED *PRESP_LOCKING_ANDX;
  920. #define LOCK_BROKEN_SIZE 51 // # of bytes in lock broken notify
  921. #endif // def INCLUDE_SMB_LOCK
  922. #ifdef INCLUDE_SMB_ADMIN
  923. //
  924. // Logoff and X SMB, see #3, page 55
  925. // SMB_COM_LOGOFF_ANDX 0x74
  926. //
  927. typedef struct _REQ_LOGOFF_ANDX {
  928. UCHAR WordCount; // Count of parameter words = 2
  929. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  930. UCHAR AndXReserved; // Reserved (must be 0)
  931. _USHORT( AndXOffset ); // Offset to next command WordCount
  932. _USHORT( ByteCount ); // Count of data bytes = 0
  933. UCHAR Buffer[1]; // empty
  934. } REQ_LOGOFF_ANDX;
  935. typedef REQ_LOGOFF_ANDX SMB_UNALIGNED *PREQ_LOGOFF_ANDX;
  936. typedef struct _RESP_LOGOFF_ANDX {
  937. UCHAR WordCount; // Count of parameter words = 2
  938. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  939. UCHAR AndXReserved; // Reserved (must be 0)
  940. _USHORT( AndXOffset ); // Offset to next command WordCount
  941. _USHORT( ByteCount ); // Count of data bytes = 0
  942. UCHAR Buffer[1]; // empty
  943. } RESP_LOGOFF_ANDX;
  944. typedef RESP_LOGOFF_ANDX SMB_UNALIGNED *PRESP_LOGOFF_ANDX;
  945. #endif // def INCLUDE_SMB_ADMIN
  946. #ifdef INCLUDE_SMB_FILE_CONTROL
  947. //
  948. // Move SMB, see #2 page 49
  949. // Funcion is SrvSmbMove()
  950. // SMB_COM_MOVE 0x2A
  951. //
  952. typedef struct _REQ_MOVE {
  953. UCHAR WordCount; // Count of parameter words = 3
  954. _USHORT( Tid2 ); // Second (target) file id
  955. _USHORT( OpenFunction ); // what to do if target file exists
  956. _USHORT( Flags ); // Flags to control move operations:
  957. // 0 - target must be a file
  958. // 1 - target must be a directory
  959. // 2 - reserved (must be 0)
  960. // 3 - reserved (must be 0)
  961. // 4 - verify all writes
  962. _USHORT( ByteCount ); // Count of data bytes; min = 2
  963. UCHAR Buffer[1]; // Buffer containing:
  964. //UCHAR OldFileName[]; // Old file name
  965. //UCHAR NewFileName[]; // New file name
  966. } REQ_MOVE;
  967. typedef REQ_MOVE SMB_UNALIGNED *PREQ_MOVE;
  968. typedef struct _RESP_MOVE {
  969. UCHAR WordCount; // Count of parameter words = 1
  970. _USHORT( Count ); // Number of files moved
  971. _USHORT( ByteCount ); // Count of data bytes; min = 0
  972. UCHAR Buffer[1]; // Pathname of file where error occurred
  973. } RESP_MOVE;
  974. typedef RESP_MOVE SMB_UNALIGNED *PRESP_MOVE;
  975. #endif // def INCLUDE_SMB_FILE_CONTROL
  976. #ifdef INCLUDE_SMB_ADMIN
  977. //
  978. // Negotiate SMB's for Net 1 and Net 3, see #1 page 25 and #2 page 20
  979. // Function is SrvSmbNegotiate()
  980. // SMB_COM_NEGOTIATE 0x72
  981. //
  982. typedef struct _REQ_NEGOTIATE {
  983. UCHAR WordCount; // Count of parameter words = 0
  984. _USHORT( ByteCount ); // Count of data bytes; min = 2
  985. UCHAR Buffer[1]; // Buffer containing:
  986. //struct {
  987. // UCHAR BufferFormat; // 0x02 -- Dialect
  988. // UCHAR DialectName[]; // ASCIIZ
  989. //} Dialects[];
  990. } REQ_NEGOTIATE;
  991. typedef REQ_NEGOTIATE *PREQ_NEGOTIATE; // *** NOT SMB_UNALIGNED!
  992. typedef struct _RESP_NEGOTIATE {
  993. UCHAR WordCount; // Count of parameter words = 13
  994. _USHORT( DialectIndex ); // Index of selected dialect
  995. _USHORT( SecurityMode ); // Security mode:
  996. // bit 0: 0 = share, 1 = user
  997. // bit 1: 1 = encrypt passwords
  998. // bit 2: 1 = SMB security signatures enabled
  999. // bit 3: 1 = SMB security signatures required
  1000. _USHORT( MaxBufferSize ); // Max transmit buffer size
  1001. _USHORT( MaxMpxCount ); // Max pending multiplexed requests
  1002. _USHORT( MaxNumberVcs ); // Max VCs between client and server
  1003. _USHORT( RawMode ); // Raw modes supported:
  1004. // bit 0: 1 = Read Raw supported
  1005. // bit 1: 1 = Write Raw supported
  1006. _ULONG( SessionKey );
  1007. SMB_TIME ServerTime; // Current time at server
  1008. SMB_DATE ServerDate; // Current date at server
  1009. _USHORT( ServerTimeZone ); // Current time zone at server
  1010. _USHORT( EncryptionKeyLength ); // MBZ if this is not LM2.1
  1011. _USHORT( Reserved ); // MBZ
  1012. _USHORT( ByteCount ); // Count of data bytes
  1013. UCHAR Buffer[1]; // Password encryption key
  1014. //UCHAR EncryptionKey[]; // The challenge encryption key
  1015. //UCHAR PrimaryDomain[]; // The server's primary domain (2.1 only)
  1016. } RESP_NEGOTIATE;
  1017. typedef RESP_NEGOTIATE *PRESP_NEGOTIATE; // *** NOT SMB_UNALIGNED!
  1018. // Macros for SecurityMode field, above
  1019. #define NEGOTIATE_USER_SECURITY 0x01
  1020. #define NEGOTIATE_ENCRYPT_PASSWORDS 0x02
  1021. #define NEGOTIATE_SECURITY_SIGNATURES_ENABLED 0x04
  1022. #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED 0x08
  1023. // Macros for RawMode field, above
  1024. #define NEGOTIATE_READ_RAW_SUPPORTED 1
  1025. #define NEGOTIATE_WRITE_RAW_SUPPORTED 2
  1026. typedef struct _RESP_OLD_NEGOTIATE {
  1027. UCHAR WordCount; // Count of parameter words = 1
  1028. _USHORT( DialectIndex ); // Index of selected dialect
  1029. _USHORT( ByteCount ); // Count of data bytes = 0
  1030. UCHAR Buffer[1]; // empty
  1031. } RESP_OLD_NEGOTIATE;
  1032. typedef RESP_OLD_NEGOTIATE *PRESP_OLD_NEGOTIATE; // *** NOT SMB_UNALIGNED!
  1033. typedef struct _RESP_NT_NEGOTIATE {
  1034. UCHAR WordCount; // Count of parameter words = 17
  1035. _USHORT( DialectIndex ); // Index of selected dialect
  1036. UCHAR( SecurityMode ); // Security mode:
  1037. // bit 0: 0 = share, 1 = user
  1038. // bit 1: 1 = encrypt passwords
  1039. // bit 2: 1 = SMB sequence numbers enabled
  1040. // bit 3: 1 = SMB sequence numbers required
  1041. _USHORT( MaxMpxCount ); // Max pending multiplexed requests
  1042. _USHORT( MaxNumberVcs ); // Max VCs between client and server
  1043. _ULONG( MaxBufferSize ); // Max transmit buffer size
  1044. _ULONG( MaxRawSize ); // Maximum raw buffer size
  1045. _ULONG( SessionKey );
  1046. _ULONG( Capabilities ); // Server capabilities
  1047. _ULONG( SystemTimeLow ); // System (UTC) time of the server (low).
  1048. _ULONG( SystemTimeHigh ); // System (UTC) time of the server (high).
  1049. _USHORT( ServerTimeZone ); // Time zone of server (min from UTC)
  1050. UCHAR( EncryptionKeyLength ); // Length of encryption key.
  1051. _USHORT( ByteCount ); // Count of data bytes
  1052. UCHAR Buffer[1]; // Password encryption key
  1053. //for nonExtendedSecurity...
  1054. //UCHAR EncryptionKey[]; // The challenge encryption key
  1055. //UCHAR OemDomainName[]; // The name of the domain (in OEM chars)
  1056. //for ExtendedSecurity...
  1057. //UCHAR GUID[16]; // The server's GUID
  1058. //UCHAR SecurityBlob[]; // The blob
  1059. } RESP_NT_NEGOTIATE;
  1060. typedef RESP_NT_NEGOTIATE *PRESP_NT_NEGOTIATE; // *** NOT SMB_UNALIGNED!
  1061. #endif // def INCLUDE_SMB_ADMIN
  1062. //
  1063. // Server / workstation capabilities
  1064. // N.B. Most messages use a ULONG for this, so there are many more
  1065. // bits available.
  1066. //
  1067. #define CAP_RAW_MODE 0x0001
  1068. #define CAP_MPX_MODE 0x0002
  1069. #define CAP_UNICODE 0x0004
  1070. #define CAP_LARGE_FILES 0x0008
  1071. #define CAP_NT_SMBS 0x0010
  1072. #define CAP_RPC_REMOTE_APIS 0x0020
  1073. #define CAP_NT_STATUS 0x0040
  1074. #define CAP_LEVEL_II_OPLOCKS 0x0080
  1075. #define CAP_LOCK_AND_READ 0x0100
  1076. #define CAP_NT_FIND 0x0200
  1077. #define CAP_DFS 0x1000 // This server is DFS aware
  1078. #define CAP_INFOLEVEL_PASSTHRU 0x2000 // NT information level requests can pass through
  1079. #define CAP_LARGE_READX 0x4000 // Server supports oversized READ&X on files
  1080. #define CAP_LARGE_WRITEX 0x8000
  1081. #define CAP_LWIO 0x10000 // This is a LWIO aware server
  1082. #define CAP_RESERVED1 0x00100000 // Reserved for third party SMB server
  1083. #define CAP_RESERVED2 0x00200000 // Reserved for third party SMB server
  1084. #define CAP_RESERVED3 0x00400000 // Reserved for third party SMB server
  1085. #define CAP_UNIX 0x00800000 // This is a Unix SMB server
  1086. #define CAP_COMPRESSED_DATA 0x02000000
  1087. #define CAP_DYNAMIC_REAUTH 0x20000000
  1088. #ifdef INCLUDE_SMB_PERSISTENT
  1089. #define CAP_PERSISTENT_HANDLES 0x40000000 // Server supports persistent handles
  1090. #endif
  1091. #define CAP_EXTENDED_SECURITY 0x80000000 // Server supports extended
  1092. // validation.
  1093. #ifdef INCLUDE_SMB_OPEN_CLOSE
  1094. //
  1095. // Open SMB, see #1, page 7
  1096. // Function is SrvSmbOpen()
  1097. // SMB_COM_OPEN 0x02
  1098. //
  1099. typedef struct _REQ_OPEN {
  1100. UCHAR WordCount; // Count of parameter words = 2
  1101. _USHORT( DesiredAccess ); // Mode - read/write/share
  1102. _USHORT( SearchAttributes );
  1103. _USHORT( ByteCount ); // Count of data bytes; min = 2
  1104. UCHAR Buffer[1]; // Buffer containing:
  1105. //UCHAR BufferFormat; // 0x04 -- ASCII
  1106. //UCHAR FileName[]; // File name
  1107. } REQ_OPEN;
  1108. typedef REQ_OPEN SMB_UNALIGNED *PREQ_OPEN;
  1109. typedef struct _RESP_OPEN {
  1110. UCHAR WordCount; // Count of parameter words = 7
  1111. _USHORT( Fid ); // File handle
  1112. _USHORT( FileAttributes );
  1113. _ULONG( LastWriteTimeInSeconds );
  1114. _ULONG( DataSize ); // File size
  1115. _USHORT( GrantedAccess ); // Access allowed
  1116. _USHORT( ByteCount ); // Count of data bytes = 0
  1117. UCHAR Buffer[1]; // empty
  1118. } RESP_OPEN;
  1119. typedef RESP_OPEN SMB_UNALIGNED *PRESP_OPEN;
  1120. #endif // def INCLUDE_SMB_OPEN_CLOSE
  1121. #ifdef INCLUDE_SMB_OPEN_CLOSE
  1122. //
  1123. // Open and X SMB, see #2 page 51
  1124. // Function is SrvOpenAndX()
  1125. // SMB_COM_OPEN_ANDX 0x2D
  1126. //
  1127. typedef struct _REQ_OPEN_ANDX {
  1128. UCHAR WordCount; // Count of parameter words = 15
  1129. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1130. UCHAR AndXReserved; // Reserved (must be 0)
  1131. _USHORT( AndXOffset ); // Offset to next command WordCount
  1132. _USHORT( Flags ); // Additional information: bit set-
  1133. // 0 - return additional info
  1134. // 1 - set single user total file lock
  1135. // 2 - server notifies consumer of
  1136. // actions which may change file
  1137. // 4 - return extended response
  1138. _USHORT( DesiredAccess ); // File open mode
  1139. _USHORT( SearchAttributes );
  1140. _USHORT( FileAttributes );
  1141. _ULONG( CreationTimeInSeconds );
  1142. _USHORT( OpenFunction );
  1143. _ULONG( AllocationSize ); // Bytes to reserve on create or truncate
  1144. _ULONG( Timeout ); // Max milliseconds to wait for resource
  1145. _ULONG( Reserved ); // Reserved (must be 0)
  1146. _USHORT( ByteCount ); // Count of data bytes; min = 1
  1147. UCHAR Buffer[1]; // File name
  1148. } REQ_OPEN_ANDX;
  1149. typedef REQ_OPEN_ANDX SMB_UNALIGNED *PREQ_OPEN_ANDX;
  1150. typedef struct _RESP_OPEN_ANDX {
  1151. UCHAR WordCount; // Count of parameter words = 15
  1152. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1153. UCHAR AndXReserved; // Reserved (must be 0)
  1154. _USHORT( AndXOffset ); // Offset to next command WordCount
  1155. _USHORT( Fid ); // File handle
  1156. _USHORT( FileAttributes );
  1157. _ULONG( LastWriteTimeInSeconds );
  1158. _ULONG( DataSize ); // Current file size
  1159. _USHORT( GrantedAccess ); // Access permissions actually allowed
  1160. _USHORT( FileType );
  1161. _USHORT( DeviceState ); // state of IPC device (e.g. pipe)
  1162. _USHORT( Action ); // Action taken
  1163. _ULONG( ServerFid ); // Server unique file id
  1164. _USHORT( Reserved ); // Reserved (must be 0)
  1165. _USHORT( ByteCount ); // Count of data bytes = 0
  1166. UCHAR Buffer[1]; // empty
  1167. } RESP_OPEN_ANDX;
  1168. typedef RESP_OPEN_ANDX SMB_UNALIGNED *PRESP_OPEN_ANDX;
  1169. typedef struct _RESP_EXTENDED_OPEN_ANDX {
  1170. UCHAR WordCount; // Count of parameter words = 15
  1171. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1172. UCHAR AndXReserved; // Reserved (must be 0)
  1173. _USHORT( AndXOffset ); // Offset to next command WordCount
  1174. _USHORT( Fid ); // File handle
  1175. _USHORT( FileAttributes );
  1176. _ULONG( LastWriteTimeInSeconds );
  1177. _ULONG( DataSize ); // Current file size
  1178. _USHORT( GrantedAccess ); // Access permissions actually allowed
  1179. _USHORT( FileType );
  1180. _USHORT( DeviceState ); // state of IPC device (e.g. pipe)
  1181. _USHORT( Action ); // Action taken
  1182. _ULONG( ServerFid ); // Server unique file id
  1183. _USHORT( Reserved ); // Reserved (must be 0)
  1184. _ULONG( MaximalAccessRights ); // maximal access rights for user
  1185. _ULONG( GuestMaximalAccessRights ); // maximal access rights for guest
  1186. _USHORT( ByteCount ); // Count of data bytes = 0
  1187. UCHAR Buffer[1]; // empty
  1188. } RESP_EXTENDED_OPEN_ANDX;
  1189. typedef RESP_EXTENDED_OPEN_ANDX SMB_UNALIGNED *PRESP_EXTENDED_OPEN_ANDX;
  1190. typedef struct _REQ_NT_CREATE_ANDX {
  1191. UCHAR WordCount; // Count of parameter words = 24
  1192. UCHAR AndXCommand; // Secondary command; 0xFF = None
  1193. UCHAR AndXReserved; // MBZ
  1194. _USHORT( AndXOffset ); // Offset to next command wordcount
  1195. UCHAR Reserved; // MBZ
  1196. _USHORT( NameLength ); // Length of Name[] in bytes
  1197. _ULONG( Flags ); // Create flags NT_CREATE_xxx
  1198. _ULONG( RootDirectoryFid ); // If non-zero, open is relative to this directory
  1199. ACCESS_MASK DesiredAccess; // NT access desired
  1200. LARGE_INTEGER AllocationSize; // Initial allocation size
  1201. _ULONG( FileAttributes ); // File attributes for creation
  1202. _ULONG( ShareAccess ); // Type of share access
  1203. _ULONG( CreateDisposition ); // Action to take if file exists or not
  1204. _ULONG( CreateOptions ); // Options to use if creating a file
  1205. _ULONG( ImpersonationLevel ); // Security QOS information
  1206. UCHAR SecurityFlags; // Security QOS information
  1207. _USHORT( ByteCount ); // Length of byte parameters
  1208. UCHAR Buffer[1];
  1209. //UCHAR Name[]; // File to open or create
  1210. } REQ_NT_CREATE_ANDX;
  1211. typedef REQ_NT_CREATE_ANDX SMB_UNALIGNED *PREQ_NT_CREATE_ANDX;
  1212. // Flag bit for Security flags
  1213. #define SMB_SECURITY_DYNAMIC_TRACKING 0x01
  1214. #define SMB_SECURITY_EFFECTIVE_ONLY 0x02
  1215. typedef struct _RESP_NT_CREATE_ANDX {
  1216. UCHAR WordCount; // Count of parameter words = 26
  1217. UCHAR AndXCommand; // Secondary command; 0xFF = None
  1218. UCHAR AndXReserved; // MBZ
  1219. _USHORT( AndXOffset ); // Offset to next command wordcount
  1220. UCHAR OplockLevel; // The oplock level granted
  1221. _USHORT( Fid ); // The file ID
  1222. _ULONG( CreateAction ); // The action taken
  1223. TIME CreationTime; // The time the file was created
  1224. TIME LastAccessTime; // The time the file was accessed
  1225. TIME LastWriteTime; // The time the file was last written
  1226. TIME ChangeTime; // The time the file was last changed
  1227. _ULONG( FileAttributes ); // The file attributes
  1228. LARGE_INTEGER AllocationSize; // The number of byes allocated
  1229. LARGE_INTEGER EndOfFile; // The end of file offset
  1230. _USHORT( FileType );
  1231. union {
  1232. _USHORT( DeviceState ); // state of IPC device (e.g. pipe)
  1233. _USHORT( FileStatusFlags ); // if a file or directory. See below.
  1234. };
  1235. BOOLEAN Directory; // TRUE if this is a directory
  1236. _USHORT( ByteCount ); // = 0
  1237. UCHAR Buffer[1];
  1238. } RESP_NT_CREATE_ANDX;
  1239. typedef RESP_NT_CREATE_ANDX SMB_UNALIGNED *PRESP_NT_CREATE_ANDX;
  1240. typedef struct _RESP_EXTENDED_NT_CREATE_ANDX {
  1241. UCHAR WordCount; // Count of parameter words = 42
  1242. UCHAR AndXCommand; // Secondary command; 0xFF = None
  1243. UCHAR AndXReserved; // MBZ
  1244. _USHORT( AndXOffset ); // Offset to next command wordcount
  1245. UCHAR OplockLevel; // The oplock level granted
  1246. _USHORT( Fid ); // The file ID
  1247. _ULONG( CreateAction ); // The action taken
  1248. TIME CreationTime; // The time the file was created
  1249. TIME LastAccessTime; // The time the file was accessed
  1250. TIME LastWriteTime; // The time the file was last written
  1251. TIME ChangeTime; // The time the file was last changed
  1252. _ULONG( FileAttributes ); // The file attributes
  1253. LARGE_INTEGER AllocationSize; // The number of byes allocated
  1254. LARGE_INTEGER EndOfFile; // The end of file offset
  1255. _USHORT( FileType );
  1256. union {
  1257. _USHORT( DeviceState ); // state of the pipe
  1258. _USHORT( FileStatusFlags ); // if a file or directory. See below.
  1259. };
  1260. BOOLEAN Directory; // TRUE if this is a directory
  1261. UCHAR VolumeGuid[16]; // the volume GUID
  1262. UCHAR FileId[8]; // the file id
  1263. _ULONG ( MaximalAccessRights ); // the access rights for the session owner
  1264. _ULONG ( GuestMaximalAccessRights ); // the maximal access rights for guest
  1265. _USHORT( ByteCount ); // = 0
  1266. UCHAR Buffer[1];
  1267. } RESP_EXTENDED_NT_CREATE_ANDX;
  1268. typedef RESP_EXTENDED_NT_CREATE_ANDX SMB_UNALIGNED *PRESP_EXTENDED_NT_CREATE_ANDX;
  1269. //
  1270. // This request is identical to REQ_NT_CREATE_ANDX up to CreationTime.
  1271. // The SMB command code is the same, Flags has NT_CREATE_IFMODIFIED_REQUEST
  1272. // ORed in.
  1273. //
  1274. #ifdef INCLUDE_SMB_IFMODIFIED
  1275. #define SMB_REQ_EXTENDED_NT_CREATE_ANDX2_WORK_COUNT 48
  1276. typedef struct _REQ_NT_CREATE_IF_MODIFIED_ANDX {
  1277. UCHAR WordCount; // Count of parameter words = 48
  1278. UCHAR AndXCommand; // Secondary command; 0xFF = None
  1279. UCHAR AndXReserved; // MBZ
  1280. _USHORT( AndXOffset ); // Offset to next command wordcount
  1281. UCHAR Reserved; // MBZ
  1282. _USHORT( NameLength ); // Length of Name[] in bytes
  1283. _ULONG( Flags ); // Create flags NT_CREATE_xxx
  1284. _ULONG( RootDirectoryFid ); // If non-zero, open is relative to this directory
  1285. ACCESS_MASK DesiredAccess; // NT access desired
  1286. LARGE_INTEGER AllocationSize; // Initial allocation size
  1287. _ULONG( FileAttributes ); // File attributes for creation
  1288. _ULONG( ShareAccess ); // Type of share access
  1289. _ULONG( CreateDisposition ); // Action to take if file exists or not
  1290. _ULONG( CreateOptions ); // Options to use if creating a file
  1291. _ULONG( ImpersonationLevel ); // Security QOS information
  1292. UCHAR SecurityFlags; // Security QOS information
  1293. // the following fields are filled in by the client, if they all match the
  1294. // current file (and attributes also matches), the file is closed
  1295. // automatically and returns with status code of STATUS_FILE_CLOSED.
  1296. TIME CreationTime; // The time the file was created
  1297. TIME LastWriteTime; // The time the file was last written
  1298. TIME ChangeTime; // The time the file was last changed
  1299. LARGE_INTEGER EndOfFile; // The end of file offset
  1300. LARGE_INTEGER UsnValue; // The file's USN # in NTFS
  1301. LARGE_INTEGER FileReferenceNumber; //
  1302. _USHORT( ByteCount ); // Length of byte parameters
  1303. UCHAR Buffer[1];
  1304. //UCHAR Name[]; // File to open or create
  1305. } REQ_NT_CREATE_IF_MODIFIED_ANDX;
  1306. typedef REQ_NT_CREATE_IF_MODIFIED_ANDX SMB_UNALIGNED *PREQ_NT_CREATE_IF_MODIFIED_ANDX;
  1307. #define SMB_SHORT_NAME_LENGTH 13
  1308. #define SMB_RESP_EXTENDED_NT_CREATE_ANDX2_WORK_COUNT 71
  1309. typedef struct _RESP_EXTENDED_NT_CREATE_ANDX2 {
  1310. UCHAR WordCount; // Count of parameter words = 71
  1311. UCHAR AndXCommand; // Secondary command; 0xFF = None
  1312. UCHAR AndXReserved; // MBZ
  1313. _USHORT( AndXOffset ); // Offset to next command wordcount
  1314. UCHAR OplockLevel; // The oplock level granted
  1315. _USHORT( Fid ); // The file ID
  1316. _ULONG( CreateAction ); // The action taken
  1317. TIME CreationTime; // The time the file was created
  1318. TIME LastAccessTime; // The time the file was accessed
  1319. TIME LastWriteTime; // The time the file was last written
  1320. TIME ChangeTime; // The time the file was last changed
  1321. _ULONG( FileAttributes ); // The file attributes
  1322. LARGE_INTEGER AllocationSize; // The number of byes allocated
  1323. LARGE_INTEGER EndOfFile; // The end of file offset
  1324. _USHORT( FileType );
  1325. union {
  1326. _USHORT( DeviceState ); // state of the pipe
  1327. _USHORT( FileStatusFlags ); // if a file or directory. See below.
  1328. };
  1329. BOOLEAN Directory; // TRUE if this is a directory
  1330. UCHAR VolumeGuid[16]; // the volume GUID
  1331. UCHAR FileId[8]; // the file id
  1332. _ULONG ( MaximalAccessRights ); // the access rights for the session owner
  1333. _ULONG ( GuestMaximalAccessRights ); // the maximal access rights for guest
  1334. // below here is where it differs from RESP_EXTENDED_NT_CREATE_ANDX
  1335. LARGE_INTEGER UsnValue; // The file's USN # in NTFS
  1336. LARGE_INTEGER FileReferenceNumber; //
  1337. WCHAR ShortName[SMB_SHORT_NAME_LENGTH]; // null terminated. if not present, empty string.
  1338. _USHORT( ByteCount ); // length of long name
  1339. WCHAR Buffer[1]; // long name goes here in unicode
  1340. } RESP_EXTENDED_NT_CREATE_ANDX2;
  1341. typedef RESP_EXTENDED_NT_CREATE_ANDX2 SMB_UNALIGNED *PRESP_EXTENDED_NT_CREATE_ANDX2;
  1342. #endif // def INCLUDE_SMB_IFMODIFIED
  1343. //
  1344. // Values for FileStatusFlags, if the opened resource is a file or directory
  1345. //
  1346. #define SMB_FSF_NO_EAS 0x0001 // file/dir has no extended attributes
  1347. #define SMB_FSF_NO_SUBSTREAMS 0x0002 // file/dir has no substreams
  1348. #define SMB_FSF_NO_REPARSETAG 0x0004 // file/dir is not a reparse point
  1349. #define SMB_OPLOCK_LEVEL_NONE 0
  1350. #define SMB_OPLOCK_LEVEL_EXCLUSIVE 1
  1351. #define SMB_OPLOCK_LEVEL_BATCH 2
  1352. #define SMB_OPLOCK_LEVEL_II 3
  1353. #endif // def INCLUDE_SMB_OPEN_CLOSE
  1354. #ifdef INCLUDE_SMB_PRINT
  1355. //
  1356. // Open Print File SMB, see #1 page 27
  1357. // Function is SrvSmbOpenPrintFile()
  1358. // SMB_COM_OPEN_PRINT_FILE 0xC0
  1359. //
  1360. typedef struct _REQ_OPEN_PRINT_FILE {
  1361. UCHAR WordCount; // Count of parameter words = 2
  1362. _USHORT( SetupLength ); // Length of printer setup data
  1363. _USHORT( Mode ); // 0 = Text mode (DOS expands TABs)
  1364. // 1 = Graphics mode
  1365. _USHORT( ByteCount ); // Count of data bytes; min = 2
  1366. UCHAR Buffer[1]; // Buffer containing:
  1367. //UCHAR BufferFormat; // 0x04 -- ASCII
  1368. //UCHAR IdentifierString[]; // Identifier string
  1369. } REQ_OPEN_PRINT_FILE;
  1370. typedef REQ_OPEN_PRINT_FILE SMB_UNALIGNED *PREQ_OPEN_PRINT_FILE;
  1371. typedef struct _RESP_OPEN_PRINT_FILE {
  1372. UCHAR WordCount; // Count of parameter words = 1
  1373. _USHORT( Fid ); // File handle
  1374. _USHORT( ByteCount ); // Count of data bytes = 0
  1375. UCHAR Buffer[1]; // empty
  1376. } RESP_OPEN_PRINT_FILE;
  1377. typedef RESP_OPEN_PRINT_FILE SMB_UNALIGNED *PRESP_OPEN_PRINT_FILE;
  1378. #endif // def INCLUDE_SMB_PRINT
  1379. #ifdef INCLUDE_SMB_ADMIN
  1380. //
  1381. // Process Exit SMB, see #1 page 22
  1382. // Function is SrvSmbProcessExit()
  1383. // SMB_COM_PROCESS_EXIT 0x11
  1384. //
  1385. typedef struct _REQ_PROCESS_EXIT {
  1386. UCHAR WordCount; // Count of parameter words = 0
  1387. _USHORT( ByteCount ); // Count of data bytes = 0
  1388. UCHAR Buffer[1]; // empty
  1389. } REQ_PROCESS_EXIT;
  1390. typedef REQ_PROCESS_EXIT SMB_UNALIGNED *PREQ_PROCESS_EXIT;
  1391. typedef struct _RESP_PROCESS_EXIT {
  1392. UCHAR WordCount; // Count of parameter words = 0
  1393. _USHORT( ByteCount ); // Count of data bytes = 0
  1394. UCHAR Buffer[1]; // empty
  1395. } RESP_PROCESS_EXIT;
  1396. typedef RESP_PROCESS_EXIT SMB_UNALIGNED *PRESP_PROCESS_EXIT;
  1397. #endif // def INCLUDE_SMB_ADMIN
  1398. #ifdef INCLUDE_SMB_QUERY_SET
  1399. //
  1400. // Query Information SMB, see #1 page 18
  1401. // Function is SrvSmbQueryInformation()
  1402. // SMB_COM_QUERY_INFORMATION 0x08
  1403. //
  1404. typedef struct _REQ_QUERY_INFORMATION {
  1405. UCHAR WordCount; // Count of parameter words = 0
  1406. _USHORT( ByteCount ); // Count of data bytes; min = 2
  1407. UCHAR Buffer[1]; // Buffer containing:
  1408. //UCHAR BufferFormat; // 0x04 -- ASCII
  1409. //UCHAR FileName[]; // File name
  1410. } REQ_QUERY_INFORMATION;
  1411. typedef REQ_QUERY_INFORMATION SMB_UNALIGNED *PREQ_QUERY_INFORMATION;
  1412. typedef struct _RESP_QUERY_INFORMATION {
  1413. UCHAR WordCount; // Count of parameter words = 10
  1414. _USHORT( FileAttributes );
  1415. _ULONG( LastWriteTimeInSeconds );
  1416. _ULONG( FileSize ); // File size
  1417. _USHORT( Reserved )[5]; // Reserved (must be 0)
  1418. _USHORT( ByteCount ); // Count of data bytes = 0
  1419. UCHAR Buffer[1]; // empty
  1420. } RESP_QUERY_INFORMATION;
  1421. typedef RESP_QUERY_INFORMATION SMB_UNALIGNED *PRESP_QUERY_INFORMATION;
  1422. #endif // def INCLUDE_SMB_QUERY_SET
  1423. #ifdef INCLUDE_SMB_QUERY_SET
  1424. //
  1425. // Query Information2 SMB, see #2 page 37
  1426. // Function is SrvSmbQueryInformation2()
  1427. // SMB_COM_QUERY_INFORMATION2 0x23
  1428. //
  1429. typedef struct _REQ_QUERY_INFORMATION2 {
  1430. UCHAR WordCount; // Count of parameter words = 2
  1431. _USHORT( Fid ); // File handle
  1432. _USHORT( ByteCount ); // Count of data bytes = 0
  1433. UCHAR Buffer[1]; // empty
  1434. } REQ_QUERY_INFORMATION2;
  1435. typedef REQ_QUERY_INFORMATION2 SMB_UNALIGNED *PREQ_QUERY_INFORMATION2;
  1436. typedef struct _RESP_QUERY_INFORMATION2 {
  1437. UCHAR WordCount; // Count of parameter words = 11
  1438. SMB_DATE CreationDate;
  1439. SMB_TIME CreationTime;
  1440. SMB_DATE LastAccessDate;
  1441. SMB_TIME LastAccessTime;
  1442. SMB_DATE LastWriteDate;
  1443. SMB_TIME LastWriteTime;
  1444. _ULONG( FileDataSize ); // File end of data
  1445. _ULONG( FileAllocationSize ); // File allocation size
  1446. _USHORT( FileAttributes );
  1447. _USHORT( ByteCount ); // Count of data bytes; min = 0
  1448. UCHAR Buffer[1]; // Reserved buffer
  1449. } RESP_QUERY_INFORMATION2;
  1450. typedef RESP_QUERY_INFORMATION2 SMB_UNALIGNED *PRESP_QUERY_INFORMATION2;
  1451. #endif // def INCLUDE_SMB_QUERY_SET
  1452. #ifdef INCLUDE_SMB_MISC
  1453. //
  1454. // Query Information Disk SMB, see #1 page 24
  1455. // Function is SrvSmbQueryInformationDisk()
  1456. // SMB_COM_QUERY_INFORMATION_DISK 0x80
  1457. //
  1458. typedef struct _REQ_QUERY_INFORMATION_DISK {
  1459. UCHAR WordCount; // Count of parameter words = 0
  1460. _USHORT( ByteCount ); // Count of data bytes = 0
  1461. UCHAR Buffer[1]; // empty
  1462. } REQ_QUERY_INFORMATION_DISK;
  1463. typedef REQ_QUERY_INFORMATION_DISK SMB_UNALIGNED *PREQ_QUERY_INFORMATION_DISK;
  1464. typedef struct _RESP_QUERY_INFORMATION_DISK {
  1465. UCHAR WordCount; // Count of parameter words = 5
  1466. _USHORT( TotalUnits ); // Total allocation units per server
  1467. _USHORT( BlocksPerUnit ); // Blocks per allocation unit
  1468. _USHORT( BlockSize ); // Block size (in bytes)
  1469. _USHORT( FreeUnits ); // Number of free units
  1470. _USHORT( Reserved ); // Reserved (media identification code)
  1471. _USHORT( ByteCount ); // Count of data bytes = 0
  1472. UCHAR Buffer[1]; // empty
  1473. } RESP_QUERY_INFORMATION_DISK;
  1474. typedef RESP_QUERY_INFORMATION_DISK SMB_UNALIGNED *PRESP_QUERY_INFORMATION_DISK;
  1475. #endif // def INCLUDE_SMB_MISC
  1476. #ifdef INCLUDE_SMB_MISC
  1477. //
  1478. // Query Server Information SMB, see #? page ??
  1479. // Function is SrvSmbQueryInformationServer
  1480. // SMB_COM_QUERY_INFORMATION_SRV 0x21
  1481. //
  1482. typedef struct _REQ_QUERY_INFORMATION_SRV {
  1483. UCHAR WordCount; // Count of parameter words = 1
  1484. _USHORT( Mode );
  1485. _USHORT( ByteCount ); // Count of data bytes; min =
  1486. UCHAR Buffer[1]; //
  1487. } REQ_QUERY_INFORMATION_SRV;
  1488. typedef REQ_QUERY_INFORMATION_SRV SMB_UNALIGNED *PREQ_QUERY_INFORMATION_SRV;
  1489. typedef struct _RESP_QUERY_INFORMATION_SRV {
  1490. UCHAR WordCount; // Count of parameter words = 20
  1491. _ULONG( smb_fsid );
  1492. _ULONG( BlocksPerUnit );
  1493. _ULONG( smb_aunits );
  1494. _ULONG( smb_fau );
  1495. _USHORT( BlockSize );
  1496. SMB_DATE smb_vldate;
  1497. SMB_TIME smb_vltime;
  1498. UCHAR smb_vllen;
  1499. UCHAR Reserved; // Reserved (must be 0)
  1500. _USHORT( SecurityMode );
  1501. _USHORT( BlockMode );
  1502. _ULONG( Services );
  1503. _USHORT( MaxTransmitSize );
  1504. _USHORT( MaxMpxCount );
  1505. _USHORT( MaxNumberVcs );
  1506. SMB_TIME ServerTime;
  1507. SMB_DATE ServerDate;
  1508. _USHORT( ServerTimeZone );
  1509. _ULONG( Reserved2 );
  1510. _USHORT( ByteCount ); // Count of data bytes; min =
  1511. UCHAR Buffer[1]; //
  1512. } RESP_QUERY_INFORMATION_SRV;
  1513. typedef RESP_QUERY_INFORMATION_SRV SMB_UNALIGNED *PRESP_QUERY_INFORMATION_SRV;
  1514. #endif // def INCLUDE_SMB_MISC
  1515. #ifdef INCLUDE_SMB_READ_WRITE
  1516. //
  1517. // Read SMB, see #1 page 12
  1518. // Lock and Read SMB, see #2 page 44
  1519. // SMB_COM_READ 0x0A, Function is SrvSmbRead
  1520. // SMB_COM_LOCK_AND_READ 0x13, Function is SrvSmbLockAndRead
  1521. //
  1522. typedef struct _REQ_READ {
  1523. UCHAR WordCount; // Count of parameter words = 5
  1524. _USHORT( Fid ); // File handle
  1525. _USHORT( Count ); // Count of bytes being requested
  1526. _ULONG( Offset ); // Offset in file of first byte to read
  1527. _USHORT( Remaining ); // Estimate of bytes to read if nonzero
  1528. _USHORT( ByteCount ); // Count of data bytes = 0
  1529. UCHAR Buffer[1]; // empty
  1530. } REQ_READ;
  1531. typedef REQ_READ SMB_UNALIGNED *PREQ_READ;
  1532. //
  1533. // *** Warning: the following structure is defined the way it is to
  1534. // ensure longword alignment of the data buffer. (This only matters
  1535. // when packing is disabled; when packing is turned on, the right
  1536. // thing happens no matter what.)
  1537. //
  1538. typedef struct _RESP_READ {
  1539. UCHAR WordCount; // Count of parameter words = 5
  1540. _USHORT( Count ); // Count of bytes actually returned
  1541. _USHORT( Reserved )[4]; // Reserved (must be 0)
  1542. _USHORT( ByteCount ); // Count of data bytes
  1543. //UCHAR Buffer[1]; // Buffer containing:
  1544. UCHAR BufferFormat; // 0x01 -- Data block
  1545. _USHORT( DataLength ); // Length of data
  1546. ULONG Buffer[1]; // Data
  1547. } RESP_READ;
  1548. typedef RESP_READ SMB_UNALIGNED *PRESP_READ;
  1549. #endif // def INCLUDE_SMB_READ_WRITE
  1550. #ifdef INCLUDE_SMB_READ_WRITE
  1551. //
  1552. // Read and X SMB, see #2 page 56
  1553. // Function is SrvSmbReadAndX()
  1554. // SMB_COM_READ_ANDX 0x2E
  1555. //
  1556. typedef struct _REQ_READ_ANDX {
  1557. UCHAR WordCount; // Count of parameter words = 10
  1558. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1559. UCHAR AndXReserved; // Reserved (must be 0)
  1560. _USHORT( AndXOffset ); // Offset to next command WordCount
  1561. _USHORT( Fid ); // File handle
  1562. _ULONG( Offset ); // Offset in file to begin read
  1563. _USHORT( MaxCount ); // Max number of bytes to return
  1564. _USHORT( MinCount ); // Min number of bytes to return
  1565. _ULONG( Timeout );
  1566. _USHORT( Remaining ); // Bytes remaining to satisfy request
  1567. _USHORT( ByteCount ); // Count of data bytes = 0
  1568. UCHAR Buffer[1]; // empty
  1569. } REQ_READ_ANDX;
  1570. typedef REQ_READ_ANDX SMB_UNALIGNED *PREQ_READ_ANDX;
  1571. typedef struct _REQ_NT_READ_ANDX {
  1572. UCHAR WordCount; // Count of parameter words = 12
  1573. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1574. UCHAR AndXReserved; // Reserved (must be 0)
  1575. _USHORT( AndXOffset ); // Offset to next command WordCount
  1576. _USHORT( Fid ); // File handle
  1577. _ULONG( Offset ); // Offset in file to begin read
  1578. _USHORT( MaxCount ); // Max number of bytes to return
  1579. _USHORT( MinCount ); // Min number of bytes to return
  1580. union {
  1581. _ULONG( Timeout );
  1582. _USHORT( MaxCountHigh ); // upper 16 bits of MaxCount if NT request
  1583. };
  1584. _USHORT( Remaining ); // Bytes remaining to satisfy request
  1585. _ULONG( OffsetHigh ); // Used for NT Protocol only
  1586. // Upper 32 bits of offset
  1587. _USHORT( ByteCount ); // Count of data bytes = 0
  1588. UCHAR Buffer[1]; // empty
  1589. } REQ_NT_READ_ANDX;
  1590. typedef REQ_NT_READ_ANDX SMB_UNALIGNED *PREQ_NT_READ_ANDX;
  1591. typedef struct _RESP_READ_ANDX {
  1592. UCHAR WordCount; // Count of parameter words = 12
  1593. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1594. UCHAR AndXReserved; // Reserved (must be 0)
  1595. _USHORT( AndXOffset ); // Offset to next command WordCount
  1596. _USHORT( Remaining ); // Bytes remaining to be read
  1597. _USHORT( DataCompactionMode );
  1598. union {
  1599. _USHORT(CdiLength); // COMPRESSED_DATA_INFO length
  1600. _USHORT( Reserved ); // Reserved (must be 0)
  1601. };
  1602. _USHORT( DataLength ); // Number of data bytes (min = 0)
  1603. _USHORT( DataOffset ); // Offset (from header start) to data
  1604. union {
  1605. _USHORT( Reserved2 ); // Reserved (must be 0)
  1606. _USHORT( DataLengthHigh ); // upper 16 bits of DataLength if NT request
  1607. };
  1608. _ULONG( Reserved3 )[2]; // Reserved (must be 0)
  1609. _USHORT( ByteCount ); // Count of data bytes. Inaccurate if we
  1610. // are doing large Read&X's!
  1611. UCHAR Buffer[1]; // Buffer containing:
  1612. //UCHAR Pad[]; // Pad to SHORT or LONG
  1613. //UCHAR Data[]; // Data (size = DataLength)
  1614. } RESP_READ_ANDX;
  1615. typedef RESP_READ_ANDX SMB_UNALIGNED *PRESP_READ_ANDX;
  1616. #endif // def INCLUDE_SMB_READ_WRITE
  1617. #ifdef INCLUDE_SMB_MPX
  1618. //
  1619. // Read Block Multiplexed SMB, see #2 page 58
  1620. // Function is SrvSmbReadMpx()
  1621. // SMB_COM_READ_MPX 0x1B
  1622. // SMB_COM_READ_MPX_SECONDARY 0x1C
  1623. //
  1624. typedef struct _REQ_READ_MPX {
  1625. UCHAR WordCount; // Count of parameter words = 8
  1626. _USHORT( Fid ); // File handle
  1627. _ULONG( Offset ); // Offset in file to begin read
  1628. _USHORT( MaxCount ); // Max bytes to return (max 65535)
  1629. _USHORT( MinCount ); // Min bytes to return (normally 0)
  1630. _ULONG( Timeout );
  1631. _USHORT( Reserved );
  1632. _USHORT( ByteCount ); // Count of data bytes = 0
  1633. UCHAR Buffer[1]; // empty
  1634. } REQ_READ_MPX;
  1635. typedef REQ_READ_MPX SMB_UNALIGNED *PREQ_READ_MPX;
  1636. typedef struct _RESP_READ_MPX {
  1637. UCHAR WordCount; // Count of parameter words = 8
  1638. _ULONG( Offset ); // Offset in file where data read
  1639. _USHORT( Count ); // Total bytes being returned
  1640. _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev)
  1641. _USHORT( DataCompactionMode );
  1642. _USHORT( Reserved );
  1643. _USHORT( DataLength ); // Number of data bytes this buffer
  1644. _USHORT( DataOffset ); // Offset (from header start) to data
  1645. _USHORT( ByteCount ); // Count of data bytes
  1646. UCHAR Buffer[1]; // Buffer containing:
  1647. //UCHAR Pad[]; // Pad to SHORT or LONG
  1648. //UCHAR Data[]; // Data (size = DataLength)
  1649. } RESP_READ_MPX;
  1650. typedef RESP_READ_MPX SMB_UNALIGNED *PRESP_READ_MPX;
  1651. #endif // def INCLUDE_SMB_MPX
  1652. #ifdef INCLUDE_SMB_RAW
  1653. //
  1654. // Read Block Raw SMB, see #2 page 61
  1655. // Function is SrvSmbReadRaw()
  1656. // SMB_COM_READ_RAW 0x1A
  1657. //
  1658. typedef struct _REQ_READ_RAW {
  1659. UCHAR WordCount; // Count of parameter words = 8
  1660. _USHORT( Fid ); // File handle
  1661. _ULONG( Offset ); // Offset in file to begin read
  1662. _USHORT( MaxCount ); // Max bytes to return (max 65535)
  1663. _USHORT( MinCount ); // Min bytes to return (normally 0)
  1664. _ULONG( Timeout );
  1665. _USHORT( Reserved );
  1666. _USHORT( ByteCount ); // Count of data bytes = 0
  1667. UCHAR Buffer[1]; // empty
  1668. } REQ_READ_RAW;
  1669. typedef REQ_READ_RAW SMB_UNALIGNED *PREQ_READ_RAW;
  1670. typedef struct _REQ_NT_READ_RAW {
  1671. UCHAR WordCount; // Count of parameter words = 10
  1672. _USHORT( Fid ); // File handle
  1673. _ULONG( Offset ); // Offset in file to begin read
  1674. _USHORT( MaxCount ); // Max bytes to return (max 65535)
  1675. _USHORT( MinCount ); // Min bytes to return (normally 0)
  1676. _ULONG( Timeout );
  1677. _USHORT( Reserved );
  1678. _ULONG( OffsetHigh ); // Used for NT Protocol only
  1679. // Upper 32 bits of offset
  1680. _USHORT( ByteCount ); // Count of data bytes = 0
  1681. UCHAR Buffer[1]; // empty
  1682. } REQ_NT_READ_RAW;
  1683. typedef REQ_NT_READ_RAW SMB_UNALIGNED *PREQ_NT_READ_RAW;
  1684. // No response params for raw read--the response is the raw data.
  1685. #endif // def INCLUDE_SMB_RAW
  1686. #ifdef INCLUDE_SMB_FILE_CONTROL
  1687. //
  1688. // Rename SMB, see #1 page 17
  1689. // Function is SrvSmbRename()
  1690. // SMB_COM_RENAME 0x07
  1691. //
  1692. typedef struct _REQ_RENAME {
  1693. UCHAR WordCount; // Count of parameter words = 1
  1694. _USHORT( SearchAttributes );
  1695. _USHORT( ByteCount ); // Count of data bytes; min = 4
  1696. UCHAR Buffer[1]; // Buffer containing:
  1697. //UCHAR BufferFormat1; // 0x04 -- ASCII
  1698. //UCHAR OldFileName[]; // Old file name
  1699. //UCHAR BufferFormat2; // 0x04 -- ASCII
  1700. //UCHAR NewFileName[]; // New file name
  1701. } REQ_RENAME;
  1702. typedef REQ_RENAME SMB_UNALIGNED *PREQ_RENAME;
  1703. //
  1704. // Extended NT rename SMB
  1705. // Function is SrvSmbRename()
  1706. // SMB_COM_NT_RENAME 0xA5
  1707. //
  1708. typedef struct _REQ_NTRENAME {
  1709. UCHAR WordCount; // Count of parameter words = 4
  1710. _USHORT( SearchAttributes );
  1711. _USHORT( InformationLevel );
  1712. _ULONG( ClusterCount );
  1713. _USHORT( ByteCount ); // Count of data bytes; min = 4
  1714. UCHAR Buffer[1]; // Buffer containing:
  1715. //UCHAR BufferFormat1; // 0x04 -- ASCII
  1716. //UCHAR OldFileName[]; // Old file name
  1717. //UCHAR BufferFormat2; // 0x04 -- ASCII
  1718. //UCHAR NewFileName[]; // New file name
  1719. } REQ_NTRENAME;
  1720. typedef REQ_NTRENAME SMB_UNALIGNED *PREQ_NTRENAME;
  1721. typedef struct _RESP_RENAME {
  1722. UCHAR WordCount; // Count of parameter words = 0
  1723. _USHORT( ByteCount ); // Count of data bytes = 0
  1724. UCHAR Buffer[1]; // empty
  1725. } RESP_RENAME;
  1726. typedef RESP_RENAME SMB_UNALIGNED *PRESP_RENAME;
  1727. #endif // def INCLUDE_SMB_FILE_CONTROL
  1728. #ifdef INCLUDE_SMB_SEARCH
  1729. //
  1730. // Search SMBs. One structure is common for both the core Search and the
  1731. // LAN Manager 1.0 Find First/Next/Close.
  1732. //
  1733. // Function is SrvSmbSearch()
  1734. //
  1735. // Search, see #1 page 26
  1736. // SMB_COM_SEARCH 0x81
  1737. // FindFirst and FindNext, see #2 page 27
  1738. // SMB_COM_FIND 0x82
  1739. // FindUnique, see #2 page 33
  1740. // SMB_COM_FIND_UNIQUE 0x83
  1741. // FindClose, see #2 page 31
  1742. // SMB_COM_FIND_CLOSE 0x84
  1743. //
  1744. typedef struct _REQ_SEARCH {
  1745. UCHAR WordCount; // Count of parameter words = 2
  1746. _USHORT( MaxCount ); // Number of dir. entries to return
  1747. _USHORT( SearchAttributes );
  1748. _USHORT( ByteCount ); // Count of data bytes; min = 5
  1749. UCHAR Buffer[1]; // Buffer containing:
  1750. //UCHAR BufferFormat1; // 0x04 -- ASCII
  1751. //UCHAR FileName[]; // File name, may be null
  1752. //UCHAR BufferFormat2; // 0x05 -- Variable block
  1753. //USHORT ResumeKeyLength; // Length of resume key, may be 0
  1754. //UCHAR SearchStatus[]; // Resume key
  1755. } REQ_SEARCH;
  1756. typedef REQ_SEARCH SMB_UNALIGNED *PREQ_SEARCH;
  1757. typedef struct _RESP_SEARCH {
  1758. UCHAR WordCount; // Count of parameter words = 1
  1759. _USHORT( Count ); // Number of entries returned
  1760. _USHORT( ByteCount ); // Count of data bytes; min = 3
  1761. UCHAR Buffer[1]; // Buffer containing:
  1762. //UCHAR BufferFormat; // 0x05 -- Variable block
  1763. //USHORT DataLength; // Length of data
  1764. //UCHAR Data[]; // Data
  1765. } RESP_SEARCH;
  1766. typedef RESP_SEARCH SMB_UNALIGNED *PRESP_SEARCH;
  1767. //
  1768. // These two structures are use to return information in the Search SMBs.
  1769. // SMB_DIRECTORY_INFORMATION is used to return information about a file
  1770. // that was found. In addition to the usual information about the file,
  1771. // each of these structures contains an SMB_RESUME_KEY, which is used to
  1772. // continue or rewind a search.
  1773. //
  1774. // These structures must be packed, so turn on packing if it isn't
  1775. // already on.
  1776. //
  1777. #ifdef NO_PACKING
  1778. #include <packon.h>
  1779. #endif // def NO_PACKING
  1780. typedef struct _SMB_RESUME_KEY {
  1781. UCHAR Reserved; // bit 7 - comsumer use
  1782. // bits 5,6 - system use (must preserve)
  1783. // bits 0-4 - server use (must preserve)
  1784. UCHAR FileName[11];
  1785. UCHAR Sid; // Uniquely identifies Find through Close
  1786. _ULONG( FileIndex ); // Reserved for server use
  1787. UCHAR Consumer[4]; // Reserved for comsumer use
  1788. } SMB_RESUME_KEY;
  1789. typedef SMB_RESUME_KEY SMB_UNALIGNED *PSMB_RESUME_KEY;
  1790. typedef struct _SMB_DIRECTORY_INFORMATION {
  1791. SMB_RESUME_KEY ResumeKey;
  1792. UCHAR FileAttributes;
  1793. SMB_TIME LastWriteTime;
  1794. SMB_DATE LastWriteDate;
  1795. _ULONG( FileSize );
  1796. UCHAR FileName[13]; // ASCII, space-filled null terminated
  1797. } SMB_DIRECTORY_INFORMATION;
  1798. typedef SMB_DIRECTORY_INFORMATION SMB_UNALIGNED *PSMB_DIRECTORY_INFORMATION;
  1799. #ifdef NO_PACKING
  1800. #include <packoff.h>
  1801. #endif // def NO_PACKING
  1802. #endif // def INCLUDE_SMB_SEARCH
  1803. #ifdef INCLUDE_SMB_READ_WRITE
  1804. //
  1805. // Seek SMB, see #1 page 14
  1806. // Function is SrvSmbSeek
  1807. // SMB_COM_SEEK 0x12
  1808. //
  1809. typedef struct _REQ_SEEK {
  1810. UCHAR WordCount; // Count of parameter words = 4
  1811. _USHORT( Fid ); // File handle
  1812. _USHORT( Mode ); // Seek mode:
  1813. // 0 = from start of file
  1814. // 1 = from current position
  1815. // 2 = from end of file
  1816. _ULONG( Offset ); // Relative offset
  1817. _USHORT( ByteCount ); // Count of data bytes = 0
  1818. UCHAR Buffer[1]; // empty
  1819. } REQ_SEEK;
  1820. typedef REQ_SEEK SMB_UNALIGNED *PREQ_SEEK;
  1821. typedef struct _RESP_SEEK {
  1822. UCHAR WordCount; // Count of parameter words = 2
  1823. _ULONG( Offset ); // Offset from start of file
  1824. _USHORT( ByteCount ); // Count of data bytes = 0
  1825. UCHAR Buffer[1]; // empty
  1826. } RESP_SEEK;
  1827. typedef RESP_SEEK SMB_UNALIGNED *PRESP_SEEK;
  1828. #endif // def INCLUDE_SMB_READ_WRITE
  1829. #ifdef INCLUDE_SMB_MESSAGE
  1830. //
  1831. // Send Broadcast Message SMB, see #1 page 32
  1832. // Function is SrvSmbSendBroadcastMessage()
  1833. // SMB_COM_SEND_BROADCAST_MESSAGE 0xD1
  1834. //
  1835. typedef struct _REQ_SEND_BROADCAST_MESSAGE {
  1836. UCHAR WordCount; // Count of parameter words = 0
  1837. _USHORT( ByteCount ); // Count of data bytes; min = 8
  1838. UCHAR Buffer[1]; // Buffer containing:
  1839. //UCHAR BufferFormat1; // 0x04 -- ASCII
  1840. //UCHAR OriginatorName[]; // Originator name (max = 15)
  1841. //UCHAR BufferFormat2; // 0x04 -- ASCII
  1842. //UCHAR DestinationName[]; // "*"
  1843. //UCHAR BufferFormat3; // 0x01 -- Data block
  1844. //USHORT DataLength; // Length of message; max = 128
  1845. //UCHAR Data[]; // Message
  1846. } REQ_SEND_BROADCAST_MESSAGE;
  1847. typedef REQ_SEND_BROADCAST_MESSAGE SMB_UNALIGNED *PREQ_SEND_BROADCAST_MESSAGE;
  1848. // No response for Send Broadcast Message
  1849. #endif // def INCLUDE_SMB_MESSAGE
  1850. #ifdef INCLUDE_SMB_MESSAGE
  1851. //
  1852. // Send End of Multi-block Message SMB, see #1 page 33
  1853. // Function is SrvSmbSendEndMbMessage()
  1854. // SMB_COM_SEND_END_MB_MESSAGE 0xD6
  1855. //
  1856. typedef struct _REQ_SEND_END_MB_MESSAGE {
  1857. UCHAR WordCount; // Count of parameter words = 1
  1858. _USHORT( MessageGroupId );
  1859. _USHORT( ByteCount ); // Count of data bytes = 0
  1860. UCHAR Buffer[1]; // empty
  1861. } REQ_SEND_END_MB_MESSAGE;
  1862. typedef REQ_SEND_END_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_END_MB_MESSAGE;
  1863. typedef struct _RESP_SEND_END_MB_MESSAGE {
  1864. UCHAR WordCount; // Count of parameter words = 0
  1865. _USHORT( ByteCount ); // Count of data bytes = 0
  1866. UCHAR Buffer[1]; // empty
  1867. } RESP_SEND_END_MB_MESSAGE;
  1868. typedef RESP_SEND_END_MB_MESSAGE SMB_UNALIGNED *PRESP_SEND_END_MB_MESSAGE;
  1869. #endif // def INCLUDE_SMB_MESSAGE
  1870. #ifdef INCLUDE_SMB_MESSAGE
  1871. //
  1872. // Send Single Block Message SMB, see #1 page 31
  1873. // Function is SrvSmbSendMessage()
  1874. // SMB_COM_SEND_MESSAGE 0xD0
  1875. //
  1876. typedef struct _REQ_SEND_MESSAGE {
  1877. UCHAR WordCount; // Count of parameter words = 0
  1878. _USHORT( ByteCount ); // Count of data bytes; min = 7
  1879. UCHAR Buffer[1]; // Buffer containing:
  1880. //UCHAR BufferFormat1; // 0x04 -- ASCII
  1881. //UCHAR OriginatorName[]; // Originator name (max = 15)
  1882. //UCHAR BufferFormat2; // 0x04 -- ASCII
  1883. //UCHAR DestinationName[]; // Destination name (max = 15)
  1884. //UCHAR BufferFormat3; // 0x01 -- Data block
  1885. //USHORT DataLength; // Length of message; max = 128
  1886. //UCHAR Data[]; // Message
  1887. } REQ_SEND_MESSAGE;
  1888. typedef REQ_SEND_MESSAGE SMB_UNALIGNED *PREQ_SEND_MESSAGE;
  1889. typedef struct _RESP_SEND_MESSAGE {
  1890. UCHAR WordCount; // Count of parameter words = 0
  1891. _USHORT( ByteCount ); // Count of data bytes = 0
  1892. UCHAR Buffer[1]; // empty
  1893. } RESP_SEND_MESSAGE;
  1894. typedef RESP_SEND_MESSAGE SMB_UNALIGNED *PRESP_SEND_MESSAGE;
  1895. #endif // def INCLUDE_SMB_MESSAGE
  1896. #ifdef INCLUDE_SMB_MESSAGE
  1897. //
  1898. // Send Start of Multi-block Message SMB, see #1 page 32
  1899. // Function is SrvSmbSendStartMbMessage()
  1900. // SMB_COM_SEND_START_MB_MESSAGE 0xD5
  1901. //
  1902. typedef struct _REQ_SEND_START_MB_MESSAGE {
  1903. UCHAR WordCount; // Count of parameter words = 0
  1904. _USHORT( ByteCount ); // Count of data bytes; min = 0
  1905. UCHAR Buffer[1]; // Buffer containing:
  1906. //UCHAR BufferFormat1; // 0x04 -- ASCII
  1907. //UCHAR OriginatorName[]; // Originator name (max = 15)
  1908. //UCHAR BufferFormat2; // 0x04 -- ASCII
  1909. //UCHAR DestinationName[]; // Destination name (max = 15)
  1910. } REQ_SEND_START_MB_MESSAGE;
  1911. typedef REQ_SEND_START_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_START_MB_MESSAGE;
  1912. typedef struct _RESP_SEND_START_MB_MESSAGE {
  1913. UCHAR WordCount; // Count of parameter words = 1
  1914. _USHORT( MessageGroupId );
  1915. _USHORT( ByteCount ); // Count of data bytes = 0
  1916. UCHAR Buffer[1]; // empty
  1917. } RESP_SEND_START_MB_MESSAGE;
  1918. typedef RESP_SEND_START_MB_MESSAGE SMB_UNALIGNED *PSEND_START_MB_MESSAGE;
  1919. #endif // def INCLUDE_SMB_MESSAGE
  1920. #ifdef INCLUDE_SMB_MESSAGE
  1921. //
  1922. // Send Text of Multi-block Message SMB, see #1 page 33
  1923. // Function is SrvSmbSendTextMbMessage()
  1924. // SMB_COM_SEND_TEXT_MB_MESSAGE 0xD7
  1925. //
  1926. typedef struct _REQ_SEND_TEXT_MB_MESSAGE {
  1927. UCHAR WordCount; // Count of parameter words = 1
  1928. _USHORT( MessageGroupId );
  1929. _USHORT( ByteCount ); // Count of data bytes; min = 3
  1930. UCHAR Buffer[1]; // Buffer containing:
  1931. //UCHAR BufferFormat; // 0x01 -- Data block
  1932. //USHORT DataLength; // Length of message; max = 128
  1933. //UCHAR Data[]; // Message
  1934. } REQ_SEND_TEXT_MB_MESSAGE;
  1935. typedef REQ_SEND_TEXT_MB_MESSAGE SMB_UNALIGNED *PREQ_SEND_TEXT_MB_MESSAGE;
  1936. typedef struct _RESP_SEND_TEXT_MB_MESSAGE {
  1937. UCHAR WordCount; // Count of aprameter words = 0
  1938. _USHORT( ByteCount ); // Count of data bytes = 0
  1939. UCHAR Buffer[1]; // empty
  1940. } RESP_SEND_TEXT_MB_MESSAGE;
  1941. typedef RESP_SEND_TEXT_MB_MESSAGE SMB_UNALIGNED *PRESP_SEND_TEXT_MB_MESSAGE;
  1942. #endif // def INCLUDE_SMB_MESSAGE
  1943. #ifdef INCLUDE_SMB_ADMIN
  1944. //
  1945. // Session Setup and X SMB, see #2 page 63 and #3 page 10
  1946. // Function is SrvSmbSessionSetupAndX()
  1947. // SMB_COM_SESSION_SETUP_ANDX 0x73
  1948. //
  1949. typedef struct _REQ_SESSION_SETUP_ANDX {
  1950. UCHAR WordCount; // Count of parameter words = 10
  1951. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1952. UCHAR AndXReserved; // Reserved (must be 0)
  1953. _USHORT( AndXOffset ); // Offset to next command WordCount
  1954. _USHORT( MaxBufferSize ); // Consumer's maximum buffer size
  1955. _USHORT( MaxMpxCount ); // Actual maximum multiplexed pending requests
  1956. _USHORT( VcNumber ); // 0 = first (only), nonzero=additional VC number
  1957. _ULONG( SessionKey ); // Session key (valid iff VcNumber != 0)
  1958. _USHORT( PasswordLength ); // Account password size
  1959. _ULONG( Reserved );
  1960. _USHORT( ByteCount ); // Count of data bytes; min = 0
  1961. UCHAR Buffer[1]; // Buffer containing:
  1962. //UCHAR AccountPassword[]; // Account Password
  1963. //UCHAR AccountName[]; // Account Name
  1964. //UCHAR PrimaryDomain[]; // Client's primary domain
  1965. //UCHAR NativeOS[]; // Client's native operating system
  1966. //UCHAR NativeLanMan[]; // Client's native LAN Manager type
  1967. } REQ_SESSION_SETUP_ANDX;
  1968. typedef REQ_SESSION_SETUP_ANDX SMB_UNALIGNED *PREQ_SESSION_SETUP_ANDX;
  1969. typedef struct _REQ_NT_SESSION_SETUP_ANDX {
  1970. UCHAR WordCount; // Count of parameter words = 13
  1971. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  1972. UCHAR AndXReserved; // Reserved (must be 0)
  1973. _USHORT( AndXOffset ); // Offset to next command WordCount
  1974. _USHORT( MaxBufferSize ); // Consumer's maximum buffer size
  1975. _USHORT( MaxMpxCount ); // Actual maximum multiplexed pending requests
  1976. _USHORT( VcNumber ); // 0 = first (only), nonzero=additional VC number
  1977. _ULONG( SessionKey ); // Session key (valid iff VcNumber != 0)
  1978. _USHORT( CaseInsensitivePasswordLength ); // Account password size, ANSI
  1979. _USHORT( CaseSensitivePasswordLength ); // Account password size, Unicode
  1980. _ULONG( Reserved);
  1981. _ULONG( Capabilities ); // Client capabilities
  1982. _USHORT( ByteCount ); // Count of data bytes; min = 0
  1983. UCHAR Buffer[1]; // Buffer containing:
  1984. //UCHAR CaseInsensitivePassword[]; // Account Password, ANSI
  1985. //UCHAR CaseSensitivePassword[]; // Account Password, Unicode
  1986. //UCHAR AccountName[]; // Account Name
  1987. //UCHAR PrimaryDomain[]; // Client's primary domain
  1988. //UCHAR NativeOS[]; // Client's native operating system
  1989. //UCHAR NativeLanMan[]; // Client's native LAN Manager type
  1990. } REQ_NT_SESSION_SETUP_ANDX;
  1991. typedef REQ_NT_SESSION_SETUP_ANDX SMB_UNALIGNED *PREQ_NT_SESSION_SETUP_ANDX;
  1992. //
  1993. // Action flags in the response
  1994. //
  1995. #define SMB_SETUP_GUEST 0x0001 // Session setup as a guest
  1996. #define SMB_SETUP_USE_LANMAN_KEY 0x0002 // Use the Lan Manager setup key.
  1997. typedef struct _REQ_NT_EXTENDED_SESSION_SETUP_ANDX {
  1998. UCHAR WordCount; // Count of parameter words = 12
  1999. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2000. UCHAR AndXReserved; // Reserved (must be 0)
  2001. _USHORT( AndXOffset ); // Offset to next command WordCount
  2002. _USHORT( MaxBufferSize ); // Consumer's maximum buffer size
  2003. _USHORT( MaxMpxCount ); // Actual maximum multiplexed pending requests
  2004. _USHORT( VcNumber ); // 0 = first (only), nonzero=additional VC number
  2005. _ULONG( SessionKey ); // Session key (valid iff VcNumber != 0)
  2006. _USHORT( SecurityBlobLength ); // Account password size, Unicode
  2007. _ULONG( Reserved);
  2008. _ULONG( Capabilities ); // Client capabilities
  2009. _USHORT( ByteCount ); // Count of data bytes; min = 0
  2010. UCHAR Buffer[1]; // Buffer containing:
  2011. //UCHAR SecurityBlob[]; // opaque security byte array.
  2012. //UCHAR NativeOS[]; // Client's native operating system
  2013. //UCHAR NativeLanMan[]; // Client's native LAN Manager type
  2014. } REQ_NT_EXTENDED_SESSION_SETUP_ANDX;
  2015. typedef REQ_NT_EXTENDED_SESSION_SETUP_ANDX SMB_UNALIGNED *PREQ_NT_EXTENDED_SESSION_SETUP_ANDX;
  2016. typedef struct _RESP_SESSION_SETUP_ANDX {
  2017. UCHAR WordCount; // Count of parameter words = 3
  2018. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2019. UCHAR AndXReserved; // Reserved (must be 0)
  2020. _USHORT( AndXOffset ); // Offset to next command WordCount
  2021. _USHORT( Action ); // Request mode:
  2022. // bit0 = logged in as GUEST
  2023. _USHORT( ByteCount ); // Count of data bytes
  2024. UCHAR Buffer[1]; // Buffer containing:
  2025. //UCHAR NativeOS[]; // Server's native operating system
  2026. //UCHAR NativeLanMan[]; // Server's native LAN Manager type
  2027. //UCHAR PrimaryDomain[]; // Server's primary domain
  2028. } RESP_SESSION_SETUP_ANDX;
  2029. typedef RESP_SESSION_SETUP_ANDX SMB_UNALIGNED *PRESP_SESSION_SETUP_ANDX;
  2030. typedef struct _RESP_NT_EXTENDED_SESSION_SETUP_ANDX {
  2031. UCHAR WordCount; // Count of parameter words = 4
  2032. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2033. UCHAR AndXReserved; // Reserved (must be 0)
  2034. _USHORT( AndXOffset ); // Offset to next command WordCount
  2035. _USHORT( Action ); // Request mode:
  2036. // bit0 = logged in as GUEST
  2037. _USHORT( SecurityBlobLength ); // Length of opaque security blob.
  2038. _USHORT( ByteCount ); // Count of data bytes
  2039. UCHAR Buffer[1]; // Buffer containing:
  2040. //UCHAR SecurityBlob[]; // SecurityBlob length message
  2041. //UCHAR NativeOS[]; // Server's native operating system
  2042. //UCHAR NativeLanMan[]; // Server's native LAN Manager type
  2043. //UCHAR PrimaryDomain[]; // Server's primary domain
  2044. } RESP_NT_EXTENDED_SESSION_SETUP_ANDX;
  2045. typedef RESP_NT_EXTENDED_SESSION_SETUP_ANDX SMB_UNALIGNED *PRESP_NT_EXTENDED_SESSION_SETUP_ANDX;
  2046. #endif // def INCLUDE_SMB_ADMIN
  2047. #ifdef INCLUDE_SMB_QUERY_SET
  2048. //
  2049. // Set Information SMB, see #1 page 19
  2050. // Function is SrvSmbSetInformation()
  2051. // SMB_COM_SET_INFORMATION 0x09
  2052. //
  2053. typedef struct _REQ_SET_INFORMATION {
  2054. UCHAR WordCount; // Count of parameter words = 8
  2055. _USHORT( FileAttributes );
  2056. _ULONG( LastWriteTimeInSeconds );
  2057. _USHORT( Reserved )[5]; // Reserved (must be 0)
  2058. _USHORT( ByteCount ); // Count of data bytes; min = 2
  2059. UCHAR Buffer[1]; // Buffer containing:
  2060. //UCHAR BufferFormat; // 0x04 -- ASCII
  2061. //UCHAR FileName[]; // File name
  2062. } REQ_SET_INFORMATION;
  2063. typedef REQ_SET_INFORMATION SMB_UNALIGNED *PREQ_SET_INFORMATION;
  2064. typedef struct _RESP_SET_INFORMATION {
  2065. UCHAR WordCount; // Count of parameter words = 0
  2066. _USHORT( ByteCount ); // Count of data bytes = 0
  2067. UCHAR Buffer[1]; // empty
  2068. } RESP_SET_INFORMATION;
  2069. typedef RESP_SET_INFORMATION SMB_UNALIGNED *PRESP_SET_INFORMATION;
  2070. #endif // def INCLUDE_SMB_QUERY_SET
  2071. #ifdef INCLUDE_SMB_QUERY_SET
  2072. //
  2073. // Set Information2 SMB, see #2 page 66
  2074. // Function is SrvSmbSetInformation2
  2075. // SMB_COM_SET_INFORMATION2 0x22
  2076. //
  2077. typedef struct _REQ_SET_INFORMATION2 {
  2078. UCHAR WordCount; // Count of parameter words = 7
  2079. _USHORT( Fid ); // File handle
  2080. SMB_DATE CreationDate;
  2081. SMB_TIME CreationTime;
  2082. SMB_DATE LastAccessDate;
  2083. SMB_TIME LastAccessTime;
  2084. SMB_DATE LastWriteDate;
  2085. SMB_TIME LastWriteTime;
  2086. _USHORT( ByteCount ); // Count of data bytes; min = 0
  2087. UCHAR Buffer[1]; // Reserved buffer
  2088. } REQ_SET_INFORMATION2;
  2089. typedef REQ_SET_INFORMATION2 SMB_UNALIGNED *PREQ_SET_INFORMATION2;
  2090. typedef struct _RESP_SET_INFORMATION2 {
  2091. UCHAR WordCount; // Count of parameter words = 0
  2092. _USHORT( ByteCount ); // Count of data bytes = 0
  2093. UCHAR Buffer[1]; // empty
  2094. } RESP_SET_INFORMATION2;
  2095. typedef RESP_SET_INFORMATION2 SMB_UNALIGNED *PRESP_SET_INFORMATION2;
  2096. #endif // def INCLUDE_SMB_QUERY_SET
  2097. #ifdef INCLUDE_SMB_TRANSACTION
  2098. //
  2099. // Transaction and Transaction2 SMBs, see #2 page 68 and #3 page 13
  2100. // Function is SrvSmbTransaction()
  2101. // SMB_COM_TRANSACTION 0x25
  2102. // SMB_COM_TRANSACTION_SECONDARY 0x26
  2103. // SMB_COM_TRANSACTION2 0x32
  2104. // SMB_COM_TRANSACTION2_SECONDARY 0x33
  2105. //
  2106. // Structures for specific transaction types are defined in smbtrans.h.
  2107. //
  2108. // *** The Transaction2 secondary request format includes a USHORT Fid
  2109. // field that we ignore. We can do this because the Fid field
  2110. // occurs at the end of the word parameters part of the request, and
  2111. // because the rest of the request (parameter and data bytes) is
  2112. // pointed by offset fields occurring prior to the Fid field. (The
  2113. // Fid field was added to speed up dispatching in the OS/2 server,
  2114. // in which different worker processes handle each Fid. The NT
  2115. // server has only one process.)
  2116. //
  2117. typedef struct _REQ_TRANSACTION {
  2118. UCHAR WordCount; // Count of parameter words; value = (14 + SetupCount)
  2119. _USHORT( TotalParameterCount ); // Total parameter bytes being sent
  2120. _USHORT( TotalDataCount ); // Total data bytes being sent
  2121. _USHORT( MaxParameterCount ); // Max parameter bytes to return
  2122. _USHORT( MaxDataCount ); // Max data bytes to return
  2123. UCHAR MaxSetupCount; // Max setup words to return
  2124. UCHAR Reserved;
  2125. _USHORT( Flags ); // Additional information:
  2126. // bit 0 - also disconnect TID in Tid
  2127. // bit 1 - one-way transacion (no resp)
  2128. _ULONG( Timeout );
  2129. _USHORT( Reserved2 );
  2130. _USHORT( ParameterCount ); // Parameter bytes sent this buffer
  2131. _USHORT( ParameterOffset ); // Offset (from header start) to params
  2132. _USHORT( DataCount ); // Data bytes sent this buffer
  2133. _USHORT( DataOffset ); // Offset (from header start) to data
  2134. UCHAR SetupCount; // Count of setup words
  2135. UCHAR Reserved3; // Reserved (pad above to word)
  2136. UCHAR Buffer[1]; // Buffer containing:
  2137. //USHORT Setup[]; // Setup words (# = SetupWordCount)
  2138. //USHORT ByteCount; // Count of data bytes
  2139. //UCHAR Name[]; // Name of transaction (NULL if Transact2)
  2140. //UCHAR Pad[]; // Pad to SHORT or LONG
  2141. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  2142. //UCHAR Pad1[]; // Pad to SHORT or LONG
  2143. //UCHAR Data[]; // Data bytes (# = DataCount)
  2144. } REQ_TRANSACTION;
  2145. typedef REQ_TRANSACTION SMB_UNALIGNED *PREQ_TRANSACTION;
  2146. #define SMB_TRANSACTION_DISCONNECT 1
  2147. #define SMB_TRANSACTION_NO_RESPONSE 2
  2148. #define SMB_TRANSACTION_RECONNECTING 4
  2149. #define SMB_TRANSACTION_DFSFILE 8
  2150. typedef struct _RESP_TRANSACTION_INTERIM {
  2151. UCHAR WordCount; // Count of parameter words = 0
  2152. _USHORT( ByteCount ); // Count of data bytes = 0
  2153. UCHAR Buffer[1]; // empty
  2154. } RESP_TRANSACTION_INTERIM;
  2155. typedef RESP_TRANSACTION_INTERIM SMB_UNALIGNED *PRESP_TRANSACTION_INTERIM;
  2156. typedef struct _REQ_TRANSACTION_SECONDARY {
  2157. UCHAR WordCount; // Count of parameter words = 8
  2158. _USHORT( TotalParameterCount ); // Total parameter bytes being sent
  2159. _USHORT( TotalDataCount ); // Total data bytes being sent
  2160. _USHORT( ParameterCount ); // Parameter bytes sent this buffer
  2161. _USHORT( ParameterOffset ); // Offset (from header start) to params
  2162. _USHORT( ParameterDisplacement ); // Displacement of these param bytes
  2163. _USHORT( DataCount ); // Data bytes sent this buffer
  2164. _USHORT( DataOffset ); // Offset (from header start) to data
  2165. _USHORT( DataDisplacement ); // Displacement of these data bytes
  2166. _USHORT( ByteCount ); // Count of data bytes
  2167. UCHAR Buffer[1]; // Buffer containing:
  2168. //UCHAR Pad[]; // Pad to SHORT or LONG
  2169. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  2170. //UCHAR Pad1[]; // Pad to SHORT or LONG
  2171. //UCHAR Data[]; // Data bytes (# = DataCount)
  2172. } REQ_TRANSACTION_SECONDARY;
  2173. typedef REQ_TRANSACTION_SECONDARY SMB_UNALIGNED *PREQ_TRANSACTION_SECONDARY;
  2174. typedef struct _RESP_TRANSACTION {
  2175. UCHAR WordCount; // Count of data bytes; value = 10 + SetupCount
  2176. _USHORT( TotalParameterCount ); // Total parameter bytes being sent
  2177. _USHORT( TotalDataCount ); // Total data bytes being sent
  2178. _USHORT( Reserved );
  2179. _USHORT( ParameterCount ); // Parameter bytes sent this buffer
  2180. _USHORT( ParameterOffset ); // Offset (from header start) to params
  2181. _USHORT( ParameterDisplacement ); // Displacement of these param bytes
  2182. _USHORT( DataCount ); // Data bytes sent this buffer
  2183. _USHORT( DataOffset ); // Offset (from header start) to data
  2184. _USHORT( DataDisplacement ); // Displacement of these data bytes
  2185. UCHAR SetupCount; // Count of setup words
  2186. UCHAR Reserved2; // Reserved (pad above to word)
  2187. UCHAR Buffer[1]; // Buffer containing:
  2188. //USHORT Setup[]; // Setup words (# = SetupWordCount)
  2189. //USHORT ByteCount; // Count of data bytes
  2190. //UCHAR Pad[]; // Pad to SHORT or LONG
  2191. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  2192. //UCHAR Pad1[]; // Pad to SHORT or LONG
  2193. //UCHAR Data[]; // Data bytes (# = DataCount)
  2194. } RESP_TRANSACTION;
  2195. typedef RESP_TRANSACTION SMB_UNALIGNED *PRESP_TRANSACTION;
  2196. typedef struct _REQ_NT_TRANSACTION {
  2197. UCHAR WordCount; // Count of parameter words; value = (19 + SetupCount)
  2198. UCHAR MaxSetupCount; // Max setup words to return
  2199. _USHORT( Flags ); // Currently unused
  2200. _ULONG( TotalParameterCount ); // Total parameter bytes being sent
  2201. _ULONG( TotalDataCount ); // Total data bytes being sent
  2202. _ULONG( MaxParameterCount ); // Max parameter bytes to return
  2203. _ULONG( MaxDataCount ); // Max data bytes to return
  2204. _ULONG( ParameterCount ); // Parameter bytes sent this buffer
  2205. _ULONG( ParameterOffset ); // Offset (from header start) to params
  2206. _ULONG( DataCount ); // Data bytes sent this buffer
  2207. _ULONG( DataOffset ); // Offset (from header start) to data
  2208. UCHAR SetupCount; // Count of setup words
  2209. _USHORT( Function ); // The transaction function code
  2210. UCHAR Buffer[1];
  2211. //USHORT Setup[]; // Setup words (# = SetupWordCount)
  2212. //USHORT ByteCount; // Count of data bytes
  2213. //UCHAR Pad1[]; // Pad to LONG
  2214. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  2215. //UCHAR Pad2[]; // Pad to LONG
  2216. //UCHAR Data[]; // Data bytes (# = DataCount)
  2217. } REQ_NT_TRANSACTION;
  2218. typedef REQ_NT_TRANSACTION SMB_UNALIGNED *PREQ_NT_TRANSACTION;
  2219. #define SMB_TRANSACTION_DISCONNECT 1
  2220. #define SMB_TRANSACTION_NO_RESPONSE 2
  2221. typedef struct _RESP_NT_TRANSACTION_INTERIM {
  2222. UCHAR WordCount; // Count of parameter words = 0
  2223. _USHORT( ByteCount ); // Count of data bytes = 0
  2224. UCHAR Buffer[1];
  2225. } RESP_NT_TRANSACTION_INTERIM;
  2226. typedef RESP_NT_TRANSACTION_INTERIM SMB_UNALIGNED *PRESP_NT_TRANSACTION_INTERIM;
  2227. typedef struct _REQ_NT_TRANSACTION_SECONDARY {
  2228. UCHAR WordCount; // Count of parameter words = 18
  2229. UCHAR Reserved1; // MBZ
  2230. _USHORT( Reserved2 ); // MBZ
  2231. _ULONG( TotalParameterCount ); // Total parameter bytes being sent
  2232. _ULONG( TotalDataCount ); // Total data bytes being sent
  2233. _ULONG( ParameterCount ); // Parameter bytes sent this buffer
  2234. _ULONG( ParameterOffset ); // Offset (from header start) to params
  2235. _ULONG( ParameterDisplacement ); // Displacement of these param bytes
  2236. _ULONG( DataCount ); // Data bytes sent this buffer
  2237. _ULONG( DataOffset ); // Offset (from header start) to data
  2238. _ULONG( DataDisplacement ); // Displacement of these data bytes
  2239. UCHAR Reserved3;
  2240. _USHORT( ByteCount ); // Count of data bytes
  2241. UCHAR Buffer[1];
  2242. //UCHAR Pad1[]; // Pad to LONG
  2243. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  2244. //UCHAR Pad2[]; // Pad to LONG
  2245. //UCHAR Data[]; // Data bytes (# = DataCount)
  2246. } REQ_NT_TRANSACTION_SECONDARY;
  2247. typedef REQ_NT_TRANSACTION_SECONDARY SMB_UNALIGNED *PREQ_NT_TRANSACTION_SECONDARY;
  2248. typedef struct _RESP_NT_TRANSACTION {
  2249. UCHAR WordCount; // Count of data bytes; value = 18 + SetupCount
  2250. UCHAR Reserved1;
  2251. _USHORT( Reserved2 );
  2252. _ULONG( TotalParameterCount ); // Total parameter bytes being sent
  2253. _ULONG( TotalDataCount ); // Total data bytes being sent
  2254. _ULONG( ParameterCount ); // Parameter bytes sent this buffer
  2255. _ULONG( ParameterOffset ); // Offset (from header start) to params
  2256. _ULONG( ParameterDisplacement ); // Displacement of these param bytes
  2257. _ULONG( DataCount ); // Data bytes sent this buffer
  2258. _ULONG( DataOffset ); // Offset (from header start) to data
  2259. _ULONG( DataDisplacement ); // Displacement of these data bytes
  2260. UCHAR SetupCount; // Count of setup words
  2261. UCHAR Buffer[1];
  2262. //USHORT Setup[]; // Setup words (# = SetupWordCount)
  2263. //USHORT ByteCount; // Count of data bytes
  2264. //UCHAR Pad1[]; // Pad to LONG
  2265. //UCHAR Parameters[]; // Parameter bytes (# = ParameterCount)
  2266. //UCHAR Pad2[]; // Pad to SHORT or LONG
  2267. //UCHAR Data[]; // Data bytes (# = DataCount)
  2268. } RESP_NT_TRANSACTION;
  2269. typedef RESP_NT_TRANSACTION SMB_UNALIGNED *PRESP_NT_TRANSACTION;
  2270. #endif // def INCLUDE_SMB_TRANSACTION
  2271. #ifdef INCLUDE_SMB_TREE
  2272. //
  2273. // Tree Connect SMB, see #1, page 6
  2274. // Function is SrvSmbTreeConnect()
  2275. // SMB_COM_TREE_CONNECT 0x70
  2276. //
  2277. typedef struct _REQ_TREE_CONNECT {
  2278. UCHAR WordCount; // Count of parameter words = 0
  2279. _USHORT( ByteCount ); // Count of data bytes; min = 4
  2280. UCHAR Buffer[1]; // Buffer containing:
  2281. //UCHAR BufferFormat1; // 0x04 -- ASCII
  2282. //UCHAR Path[]; // Server name and share name
  2283. //UCHAR BufferFormat2; // 0x04 -- ASCII
  2284. //UCHAR Password[]; // Password
  2285. //UCHAR BufferFormat3; // 0x04 -- ASCII
  2286. //UCHAR Service[]; // Service name
  2287. } REQ_TREE_CONNECT;
  2288. typedef REQ_TREE_CONNECT SMB_UNALIGNED *PREQ_TREE_CONNECT;
  2289. typedef struct _RESP_TREE_CONNECT {
  2290. UCHAR WordCount; // Count of parameter words = 2
  2291. _USHORT( MaxBufferSize ); // Max size message the server handles
  2292. _USHORT( Tid ); // Tree ID
  2293. _USHORT( ByteCount ); // Count of data bytes = 0
  2294. UCHAR Buffer[1]; // empty
  2295. } RESP_TREE_CONNECT;
  2296. typedef RESP_TREE_CONNECT SMB_UNALIGNED *PRESP_TREE_CONNECT;
  2297. #endif // def INCLUDE_SMB_TREE
  2298. #ifdef INCLUDE_SMB_TREE
  2299. //
  2300. // Tree Connect and X SMB, see #2, page 88
  2301. // Function is SrvSmbTreeConnectAndX()
  2302. // SMB_COM_TREE_CONNECT_ANDX 0x75
  2303. //
  2304. // TREE_CONNECT_ANDX flags
  2305. #define TREE_CONNECT_ANDX_DISCONNECT_TID (0x1)
  2306. // #define TREE_CONNECT_ANDX_W95 (0x2) -- W95 sets this flag. Don't know why.
  2307. #define TREE_CONNECT_ANDX_EXTENDED_SIGNATURES (0x4)
  2308. #define TREE_CONNECT_ANDX_EXTENDED_RESPONSE (0x8)
  2309. typedef struct _REQ_TREE_CONNECT_ANDX {
  2310. UCHAR WordCount; // Count of parameter words = 4
  2311. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2312. UCHAR AndXReserved; // Reserved (must be 0)
  2313. _USHORT( AndXOffset ); // Offset to next command WordCount
  2314. _USHORT( Flags ); // Additional information
  2315. // bit 0 set = disconnect Tid
  2316. // bit 7 set = extended response
  2317. _USHORT( PasswordLength ); // Length of Password[]
  2318. _USHORT( ByteCount ); // Count of data bytes; min = 3
  2319. UCHAR Buffer[1]; // Buffer containing:
  2320. //UCHAR Password[]; // Password
  2321. //UCHAR Path[]; // Server name and share name
  2322. //UCHAR Service[]; // Service name
  2323. } REQ_TREE_CONNECT_ANDX;
  2324. typedef REQ_TREE_CONNECT_ANDX SMB_UNALIGNED *PREQ_TREE_CONNECT_ANDX;
  2325. typedef struct _RESP_TREE_CONNECT_ANDX {
  2326. UCHAR WordCount; // Count of parameter words = 2
  2327. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2328. UCHAR AndXReserved; // Reserved (must be 0)
  2329. _USHORT( AndXOffset ); // Offset to next command WordCount
  2330. _USHORT( ByteCount ); // Count of data bytes; min = 3
  2331. UCHAR Buffer[1]; // Service type connected to
  2332. } RESP_TREE_CONNECT_ANDX;
  2333. typedef RESP_TREE_CONNECT_ANDX SMB_UNALIGNED *PRESP_TREE_CONNECT_ANDX;
  2334. //
  2335. // The response for clients that are LAN Manager 2.1 or better.
  2336. //
  2337. typedef struct _RESP_21_TREE_CONNECT_ANDX {
  2338. UCHAR WordCount; // Count of parameter words = 3
  2339. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2340. UCHAR AndXReserved; // Reserved (must be 0)
  2341. _USHORT( AndXOffset ); // Offset to next command WordCount
  2342. _USHORT( OptionalSupport ); // Optional support bits
  2343. _USHORT( ByteCount ); // Count of data bytes; min = 3
  2344. UCHAR Buffer[1]; // Buffer containing:
  2345. //UCHAR Service[]; // Service type connected to
  2346. //UCHAR NativeFileSystem[]; // Native file system for this tree
  2347. } RESP_21_TREE_CONNECT_ANDX;
  2348. typedef RESP_21_TREE_CONNECT_ANDX SMB_UNALIGNED *PRESP_21_TREE_CONNECT_ANDX;
  2349. typedef struct _RESP_EXTENDED_TREE_CONNECT_ANDX {
  2350. UCHAR WordCount; // Count of parameter words = 7
  2351. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2352. UCHAR AndXReserved; // Reserved (must be 0)
  2353. _USHORT( AndXOffset ); // Offset to next command WordCount
  2354. _USHORT( OptionalSupport); // optional support bits
  2355. _ULONG( MaximalShareAccessRights ); // maximal share access rights
  2356. _ULONG( GuestMaximalShareAccessRights); // maximal guest access rights
  2357. _USHORT( ByteCount ); // Count of data bytes; min = 3
  2358. UCHAR Buffer[1]; // Service type connected to
  2359. } RESP_EXTENDED_TREE_CONNECT_ANDX;
  2360. typedef RESP_EXTENDED_TREE_CONNECT_ANDX SMB_UNALIGNED *PRESP_EXTENDED_TREE_CONNECT_ANDX;
  2361. //
  2362. // Optional Support bit definitions
  2363. //
  2364. #define SMB_SUPPORT_SEARCH_BITS 0x0001
  2365. #define SMB_SHARE_IS_IN_DFS 0x0002
  2366. #define SMB_UNIQUE_FILE_NAME 0x0010
  2367. #define SMB_EXTENDED_SIGNATURES 0x0020
  2368. #define SMB_CSC_MASK 0x000C // see below
  2369. //
  2370. // Bits under SMB_CSC_MASK decode like this:
  2371. //
  2372. #define SMB_CSC_CACHE_MANUAL_REINT 0x0000 // No automatic file by file reint
  2373. #define SMB_CSC_CACHE_AUTO_REINT 0x0004 // File by file reint is OK
  2374. #define SMB_CSC_CACHE_VDO 0x0008 // no need to flow opens
  2375. #define SMB_CSC_NO_CACHING 0x000C // client should not cache this share
  2376. #endif // def INCLUDE_SMB_TREE
  2377. #ifdef INCLUDE_SMB_TREE
  2378. //
  2379. // Tree Disconnect SMB, see #1 page 7
  2380. // Function is SrvSmbTreeDisconnect()
  2381. // SMB_COM_TREE_DISCONNECT 0x71
  2382. //
  2383. typedef struct _REQ_TREE_DISCONNECT {
  2384. UCHAR WordCount; // Count of parameter words = 0
  2385. _USHORT( ByteCount ); // Count of data bytes = 0
  2386. UCHAR Buffer[1]; // empty
  2387. } REQ_TREE_DISCONNECT;
  2388. typedef REQ_TREE_DISCONNECT SMB_UNALIGNED *PREQ_TREE_DISCONNECT;
  2389. typedef struct _RESP_TREE_DISCONNECT {
  2390. UCHAR WordCount; // Count of parameter words = 0
  2391. _USHORT( ByteCount ); // Count of data bytes = 0
  2392. UCHAR Buffer[1]; // empty
  2393. } RESP_TREE_DISCONNECT;
  2394. typedef RESP_TREE_DISCONNECT SMB_UNALIGNED *PRESP_TREE_DISCONNECT;
  2395. #endif // def INCLUDE_SMB_TREE
  2396. #ifdef INCLUDE_SMB_LOCK
  2397. //
  2398. // Unlock Byte Range SMB, see #1 page 20
  2399. // Function is SrvSmbUnlockByteRange()
  2400. // SMB_COM_UNLOCK_BYTE_RANGE 0x0D
  2401. //
  2402. typedef struct _REQ_UNLOCK_BYTE_RANGE {
  2403. UCHAR WordCount; // Count of parameter words = 5
  2404. _USHORT( Fid ); // File handle
  2405. _ULONG( Count ); // Count of bytes to unlock
  2406. _ULONG( Offset ); // Offset from start of file
  2407. _USHORT( ByteCount ); // Count of data bytes = 0
  2408. UCHAR Buffer[1]; // empty
  2409. } REQ_UNLOCK_BYTE_RANGE;
  2410. typedef REQ_UNLOCK_BYTE_RANGE SMB_UNALIGNED *PREQ_UNLOCK_BYTE_RANGE;
  2411. typedef struct _RESP_UNLOCK_BYTE_RANGE {
  2412. UCHAR WordCount; // Count of parameter words = 0
  2413. _USHORT( ByteCount ); // Count of data bytes = 0
  2414. UCHAR Buffer[1]; // empty
  2415. } RESP_UNLOCK_BYTE_RANGE;
  2416. typedef RESP_UNLOCK_BYTE_RANGE SMB_UNALIGNED *PRESP_UNLOCK_BYTE_RANGE;
  2417. #endif // def INCLUDE_SMB_LOCK
  2418. #ifdef INCLUDE_SMB_READ_WRITE
  2419. //
  2420. // Write SMB, see #1 page 12
  2421. // Write and Unlock SMB, see #2 page 92
  2422. // Function is SrvSmbWrite()
  2423. // SMB_COM_WRITE 0x0B
  2424. // SMB_COM_WRITE_AND_UNLOCK 0x14
  2425. //
  2426. //
  2427. // *** Warning: the following structure is defined the way it is to
  2428. // ensure longword alignment of the data buffer. (This only matters
  2429. // when packing is disabled; when packing is turned on, the right
  2430. // thing happens no matter what.)
  2431. //
  2432. typedef struct _REQ_WRITE {
  2433. UCHAR WordCount; // Count of parameter words = 5
  2434. _USHORT( Fid ); // File handle
  2435. _USHORT( Count ); // Number of bytes to be written
  2436. _ULONG( Offset ); // Offset in file to begin write
  2437. _USHORT( Remaining ); // Bytes remaining to satisfy request
  2438. _USHORT( ByteCount ); // Count of data bytes
  2439. //UCHAR Buffer[1]; // Buffer containing:
  2440. UCHAR BufferFormat; // 0x01 -- Data block
  2441. _USHORT( DataLength ); // Length of data
  2442. ULONG Buffer[1]; // Data
  2443. } REQ_WRITE;
  2444. typedef REQ_WRITE SMB_UNALIGNED *PREQ_WRITE;
  2445. typedef struct _RESP_WRITE {
  2446. UCHAR WordCount; // Count of parameter words = 1
  2447. _USHORT( Count ); // Count of bytes actually written
  2448. _USHORT( ByteCount ); // Count of data bytes = 0
  2449. UCHAR Buffer[1]; // empty
  2450. } RESP_WRITE;
  2451. typedef RESP_WRITE SMB_UNALIGNED *PRESP_WRITE;
  2452. #endif // def INCLUDE_SMB_READ_WRITE
  2453. #ifdef INCLUDE_SMB_READ_WRITE
  2454. //
  2455. // Write and Close SMB, see #2 page 90
  2456. // Function is SrvSmbWriteAndClose()
  2457. // SMB_COM_WRITE_AND_CLOSE 0x2C
  2458. //
  2459. //
  2460. // The Write and Close parameters can be 6 words long or 12 words long,
  2461. // depending on whether it's supposed to look like a Write SMB or a
  2462. // Write and X SMB. So we define two different structures here.
  2463. //
  2464. // *** Warning: the following structures are defined the way they are to
  2465. // ensure longword alignment of the data buffer. (This only matters
  2466. // when packing is disabled; when packing is turned on, the right
  2467. // thing happens no matter what.)
  2468. //
  2469. typedef struct _REQ_WRITE_AND_CLOSE {
  2470. UCHAR WordCount; // Count of parameter words = 6
  2471. _USHORT( Fid ); // File handle
  2472. _USHORT( Count ); // Number of bytes to write
  2473. _ULONG( Offset ); // Offset in file of first byte to write
  2474. _ULONG( LastWriteTimeInSeconds ); // Time of last write
  2475. _USHORT( ByteCount ); // 1 (for pad) + value of Count
  2476. UCHAR Pad; // To force to doubleword boundary
  2477. ULONG Buffer[1]; // Data
  2478. } REQ_WRITE_AND_CLOSE;
  2479. typedef REQ_WRITE_AND_CLOSE SMB_UNALIGNED *PREQ_WRITE_AND_CLOSE;
  2480. typedef struct _REQ_WRITE_AND_CLOSE_LONG {
  2481. UCHAR WordCount; // Count of parameter words = 12
  2482. _USHORT( Fid ); // File handle
  2483. _USHORT( Count ); // Number of bytes to write
  2484. _ULONG( Offset ); // Offset in file of first byte to write
  2485. _ULONG( LastWriteTimeInSeconds ); // Time of last write
  2486. _ULONG( Reserved )[3]; // Reserved, must be 0
  2487. _USHORT( ByteCount ); // 1 (for pad) + value of Count
  2488. UCHAR Pad; // To force to doubleword boundary
  2489. ULONG Buffer[1]; // Data
  2490. } REQ_WRITE_AND_CLOSE_LONG;
  2491. typedef REQ_WRITE_AND_CLOSE_LONG SMB_UNALIGNED *PREQ_WRITE_AND_CLOSE_LONG;
  2492. typedef struct _RESP_WRITE_AND_CLOSE {
  2493. UCHAR WordCount; // Count of parameter words = 1
  2494. _USHORT( Count ); // Count of bytes actually written
  2495. _USHORT( ByteCount ); // Count of data bytes = 0
  2496. UCHAR Buffer[1]; // empty
  2497. } RESP_WRITE_AND_CLOSE;
  2498. typedef RESP_WRITE_AND_CLOSE SMB_UNALIGNED *PRESP_WRITE_AND_CLOSE;
  2499. #endif // def INCLUDE_SMB_READ_WRITE
  2500. #ifdef INCLUDE_SMB_READ_WRITE
  2501. //
  2502. // Write and X SMB, see #2 page 94
  2503. // Function is SrvSmbWriteAndX()
  2504. // SMB_COM_WRITE_ANDX 0x2F
  2505. //
  2506. typedef struct _REQ_WRITE_ANDX {
  2507. UCHAR WordCount; // Count of parameter words = 12
  2508. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2509. UCHAR AndXReserved; // Reserved (must be 0)
  2510. _USHORT( AndXOffset ); // Offset to next command WordCount
  2511. _USHORT( Fid ); // File handle
  2512. _ULONG( Offset ); // Offset in file to begin write
  2513. _ULONG( Timeout );
  2514. _USHORT( WriteMode ); // Write mode:
  2515. // 0 - write through
  2516. // 1 - return Remaining
  2517. // 2 - use WriteRawNamedPipe (n. pipes)
  2518. // 3 - "this is the start of the msg"
  2519. _USHORT( Remaining ); // Bytes remaining to satisfy request
  2520. _USHORT( Reserved );
  2521. _USHORT( DataLength ); // Number of data bytes in buffer (>=0)
  2522. _USHORT( DataOffset ); // Offset to data bytes
  2523. _USHORT( ByteCount ); // Count of data bytes
  2524. UCHAR Buffer[1]; // Buffer containing:
  2525. //UCHAR Pad[]; // Pad to SHORT or LONG
  2526. //UCHAR Data[]; // Data (# = DataLength)
  2527. } REQ_WRITE_ANDX;
  2528. typedef REQ_WRITE_ANDX SMB_UNALIGNED *PREQ_WRITE_ANDX;
  2529. typedef struct _REQ_NT_WRITE_ANDX {
  2530. UCHAR WordCount; // Count of parameter words = 14
  2531. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2532. UCHAR AndXReserved; // Reserved (must be 0)
  2533. _USHORT( AndXOffset ); // Offset to next command WordCount
  2534. _USHORT( Fid ); // File handle
  2535. _ULONG( Offset ); // Offset in file to begin write
  2536. _ULONG( Timeout );
  2537. _USHORT( WriteMode ); // Write mode:
  2538. // 0 - write through
  2539. // 1 - return Remaining
  2540. // 2 - use WriteRawNamedPipe (n. pipes)
  2541. // 3 - "this is the start of the msg"
  2542. union {
  2543. _USHORT( Remaining ); // Bytes remaining to satisfy request
  2544. _USHORT( CdiLength ); // if SMB_FLAGS2_COMPRESSED
  2545. };
  2546. _USHORT( DataLengthHigh );
  2547. _USHORT( DataLength ); // Number of data bytes in buffer (>=0)
  2548. _USHORT( DataOffset ); // Offset to data bytes
  2549. _ULONG( OffsetHigh ); // Used for NT Protocol only
  2550. // Upper 32 bits of offset
  2551. _USHORT( ByteCount ); // Count of data bytes
  2552. UCHAR Buffer[1]; // Buffer containing:
  2553. //UCHAR Pad[]; // Pad to SHORT or LONG
  2554. //UCHAR Data[]; // Data (# = DataLength)
  2555. } REQ_NT_WRITE_ANDX;
  2556. typedef REQ_NT_WRITE_ANDX SMB_UNALIGNED *PREQ_NT_WRITE_ANDX;
  2557. typedef struct _RESP_WRITE_ANDX {
  2558. UCHAR WordCount; // Count of parameter words = 6
  2559. UCHAR AndXCommand; // Secondary (X) command; 0xFF = none
  2560. UCHAR AndXReserved; // Reserved (must be 0)
  2561. _USHORT( AndXOffset ); // Offset to next command WordCount
  2562. _USHORT( Count ); // Number of bytes written
  2563. _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev)
  2564. union {
  2565. _ULONG( Reserved );
  2566. _USHORT( CountHigh ); // if large write&x
  2567. };
  2568. _USHORT( ByteCount ); // Count of data bytes. Inaccurate if
  2569. // large writes
  2570. UCHAR Buffer[1]; // empty
  2571. } RESP_WRITE_ANDX;
  2572. typedef RESP_WRITE_ANDX SMB_UNALIGNED *PRESP_WRITE_ANDX;
  2573. #endif // def INCLUDE_SMB_READ_WRITE
  2574. #ifdef INCLUDE_SMB_MPX
  2575. //
  2576. // Write Block Multiplexed SMB, see #2 page 97
  2577. // Function is SrvSmbWriteMpx()
  2578. // SMB_COM_WRITE_MPX 0x1E
  2579. // SMB_COM_WRITE_MPX_SECONDARY 0x1F
  2580. // SMB_COM_WRITE_MPX_COMPLETE 0x20
  2581. //
  2582. typedef struct _REQ_WRITE_MPX {
  2583. UCHAR WordCount; // Count of parameter words = 12
  2584. _USHORT( Fid ); // File handle
  2585. _USHORT( Count ); // Total bytes, including this buffer
  2586. _USHORT( Reserved );
  2587. _ULONG( Offset ); // Offset in file to begin write
  2588. _ULONG( Timeout );
  2589. _USHORT( WriteMode ); // Write mode:
  2590. // bit 0 - complete write to disk and
  2591. // send final result response
  2592. // bit 1 - return Remaining (pipe/dev)
  2593. // bit 7 - IPX datagram mode
  2594. union {
  2595. struct {
  2596. _USHORT( DataCompactionMode );
  2597. _USHORT( Reserved2 );
  2598. } ;
  2599. _ULONG( Mask ); // IPX datagram mode mask
  2600. } ;
  2601. _USHORT( DataLength ); // Number of data bytes this buffer
  2602. _USHORT( DataOffset ); // Offset (from header start) to data
  2603. _USHORT( ByteCount ); // Count of data bytes
  2604. UCHAR Buffer[1]; // Buffer containing:
  2605. //UCHAR Pad[]; // Pad to SHORT or LONG
  2606. //UCHAR Data[]; // Data (# = DataLength)
  2607. } REQ_WRITE_MPX;
  2608. typedef REQ_WRITE_MPX SMB_UNALIGNED *PREQ_WRITE_MPX;
  2609. typedef struct _RESP_WRITE_MPX_INTERIM { // First response
  2610. UCHAR WordCount; // Count of parameter words = 1
  2611. _USHORT( Remaining ); // Bytes ramaining to be read (pipe/dev)
  2612. _USHORT( ByteCount ); // Count of data bytes = 0
  2613. UCHAR Buffer[1]; // empty
  2614. } RESP_WRITE_MPX_INTERIM;
  2615. typedef RESP_WRITE_MPX_INTERIM SMB_UNALIGNED *PRESP_WRITE_MPX_INTERIM;
  2616. typedef struct _RESP_WRITE_MPX_DATAGRAM { // Response to sequenced request
  2617. UCHAR WordCount; // Count of parameter words = 2
  2618. _ULONG( Mask ); // OR of all masks received
  2619. _USHORT( ByteCount ); // Count of data bytes = 0
  2620. UCHAR Buffer[1]; // empty
  2621. } RESP_WRITE_MPX_DATAGRAM;
  2622. typedef RESP_WRITE_MPX_DATAGRAM SMB_UNALIGNED *PRESP_WRITE_MPX_DATAGRAM;
  2623. // Secondary request format, 0 to N of these.
  2624. typedef struct _REQ_WRITE_MPX_SECONDARY {
  2625. UCHAR WordCount; // Count of parameter words = 8
  2626. _USHORT( Fid ); // File handle
  2627. _USHORT( Count ); // Total bytes to be sent
  2628. _ULONG( Offset ); // Offset in file to begin write
  2629. _ULONG( Reserved );
  2630. _USHORT( DataLength ); // Number of data bytes this buffer
  2631. _USHORT( DataOffset ); // Offset (from header start) to data
  2632. _USHORT( ByteCount ); // Count of data bytes
  2633. UCHAR Buffer[1]; // Buffer containing:
  2634. //UCHAR Pad[]; // Pad to SHORT or LONG
  2635. //UCHAR Data[]; // Data (# = DataLength)
  2636. } REQ_WRITE_MPX_SECONDARY;
  2637. typedef REQ_WRITE_MPX_SECONDARY SMB_UNALIGNED *PREQ_WRITE_MPX_SECONDARY;
  2638. #endif // def INCLUDE_SMB_MPX
  2639. #ifndef INCLUDE_SMB_WRITE_COMPLETE
  2640. #ifdef INCLUDE_SMB_MPX
  2641. #define INCLUDE_SMB_WRITE_COMPLETE
  2642. #else
  2643. #ifdef INCLUDE_SMB_RAW
  2644. #define INCLUDE_SMB_WRITE_COMPLETE
  2645. #endif
  2646. #endif
  2647. #endif
  2648. #ifdef INCLUDE_SMB_WRITE_COMPLETE
  2649. //
  2650. // The following structure is used as the final response to both Write
  2651. // Block Multiplexed and Write Block Raw.
  2652. //
  2653. typedef struct _RESP_WRITE_COMPLETE { // Final response; command is
  2654. // SMB_COM_WRITE_COMPLETE
  2655. UCHAR WordCount; // Count of parameter words = 1
  2656. _USHORT( Count ); // Total number of bytes written
  2657. _USHORT( ByteCount ); // Count of data bytes = 0
  2658. UCHAR Buffer[1]; // empty
  2659. } RESP_WRITE_COMPLETE;
  2660. typedef RESP_WRITE_COMPLETE SMB_UNALIGNED *PRESP_WRITE_COMPLETE;
  2661. #endif // def INCLUDE_SMB_WRITE_COMPLETE
  2662. #ifdef INCLUDE_SMB_READ_WRITE
  2663. //
  2664. // Write Print File SMB, see #1 page 29
  2665. // Function is SrvSmbWritePrintFile()
  2666. // SMB_COM_WRITE_PRINT_FILE 0xC1
  2667. //
  2668. typedef struct _REQ_WRITE_PRINT_FILE {
  2669. UCHAR WordCount; // Count of parameter words = 1
  2670. _USHORT( Fid ); // File handle
  2671. _USHORT( ByteCount ); // Count of data bytes; min = 4
  2672. UCHAR Buffer[1]; // Buffer containing:
  2673. //UCHAR BufferFormat; // 0x01 -- Data block
  2674. //USHORT DataLength; // Length of data
  2675. //UCHAR Data[]; // Data
  2676. } REQ_WRITE_PRINT_FILE;
  2677. typedef REQ_WRITE_PRINT_FILE SMB_UNALIGNED *PREQ_WRITE_PRINT_FILE;
  2678. typedef struct _RESP_WRITE_PRINT_FILE {
  2679. UCHAR WordCount; // Count of parameter words = 0
  2680. _USHORT( ByteCount ); // Count of data bytes = 0
  2681. UCHAR Buffer[1]; // empty
  2682. } RESP_WRITE_PRINT_FILE;
  2683. typedef RESP_WRITE_PRINT_FILE SMB_UNALIGNED *PRESP_WRITE_PRINT_FILE;
  2684. #endif // def INCLUDE_SMB_READ_WRITE
  2685. #ifdef INCLUDE_SMB_RAW
  2686. //
  2687. // Write Block Raw SMB, see #2 page 100
  2688. // Function is SrvSmbWriteRaw()
  2689. // SMB_COM_WRITE_RAW 0x1D
  2690. //
  2691. typedef struct _REQ_WRITE_RAW {
  2692. UCHAR WordCount; // Count of parameter words = 12
  2693. _USHORT( Fid ); // File handle
  2694. _USHORT( Count ); // Total bytes, including this buffer
  2695. _USHORT( Reserved );
  2696. _ULONG( Offset ); // Offset in file to begin write
  2697. _ULONG( Timeout );
  2698. _USHORT( WriteMode ); // Write mode:
  2699. // bit 0 - complete write to disk and
  2700. // send final result response
  2701. // bit 1 - return Remaining (pipe/dev)
  2702. // (see WriteAndX for #defines)
  2703. _ULONG( Reserved2 );
  2704. _USHORT( DataLength ); // Number of data bytes this buffer
  2705. _USHORT( DataOffset ); // Offset (from header start) to data
  2706. _USHORT( ByteCount ); // Count of data bytes
  2707. UCHAR Buffer[1]; // Buffer containing:
  2708. //UCHAR Pad[]; // Pad to SHORT or LONG
  2709. //UCHAR Data[]; // Data (# = DataLength)
  2710. } REQ_WRITE_RAW;
  2711. typedef REQ_WRITE_RAW SMB_UNALIGNED *PREQ_WRITE_RAW;
  2712. typedef struct _REQ_NT_WRITE_RAW {
  2713. UCHAR WordCount; // Count of parameter words = 14
  2714. _USHORT( Fid ); // File handle
  2715. _USHORT( Count ); // Total bytes, including this buffer
  2716. _USHORT( Reserved );
  2717. _ULONG( Offset ); // Offset in file to begin write
  2718. _ULONG( Timeout );
  2719. _USHORT( WriteMode ); // Write mode:
  2720. // bit 0 - complete write to disk and
  2721. // send final result response
  2722. // bit 1 - return Remaining (pipe/dev)
  2723. // (see WriteAndX for #defines)
  2724. _ULONG( Reserved2 );
  2725. _USHORT( DataLength ); // Number of data bytes this buffer
  2726. _USHORT( DataOffset ); // Offset (from header start) to data
  2727. _ULONG( OffsetHigh ); // Used for NT Protocol only
  2728. // Upper 32 bits of offset
  2729. _USHORT( ByteCount ); // Count of data bytes
  2730. UCHAR Buffer[1]; // Buffer containing:
  2731. //UCHAR Pad[]; // Pad to SHORT or LONG
  2732. //UCHAR Data[]; // Data (# = DataLength)
  2733. } REQ_NT_WRITE_RAW;
  2734. typedef REQ_NT_WRITE_RAW SMB_UNALIGNED *PREQ_NT_WRITE_RAW;
  2735. typedef struct _RESP_WRITE_RAW_INTERIM { // First response
  2736. UCHAR WordCount; // Count of parameter words = 1
  2737. _USHORT( Remaining ); // Bytes remaining to be read (pipe/dev)
  2738. _USHORT( ByteCount ); // Count of data bytes = 0
  2739. UCHAR Buffer[1]; // empty
  2740. } RESP_WRITE_RAW_INTERIM;
  2741. typedef RESP_WRITE_RAW_INTERIM SMB_UNALIGNED *PRESP_WRITE_RAW_INTERIM;
  2742. typedef struct _RESP_WRITE_RAW_SECONDARY { // Second (final) response
  2743. UCHAR WordCount; // Count of parameter words = 1
  2744. _USHORT( Count ); // Total number of bytes written
  2745. _USHORT( ByteCount ); // Count of data bytes = 0
  2746. UCHAR Buffer[1]; // empty
  2747. } RESP_WRITE_RAW_SECONDARY;
  2748. typedef RESP_WRITE_RAW_SECONDARY SMB_UNALIGNED *PRESP_WRITE_RAW_SECONDARY;
  2749. typedef struct _REQ_103_WRITE_RAW {
  2750. UCHAR WordCount; // Count of parameter words
  2751. _USHORT( Fid ); // File handle
  2752. _USHORT( Count );
  2753. _USHORT( Reserved );
  2754. _ULONG( Offset );
  2755. _ULONG( Timeout );
  2756. _USHORT( WriteMode );
  2757. _ULONG( Reserved2 );
  2758. _USHORT( ByteCount ); // Count of data bytes; min =
  2759. UCHAR Buffer[1]; //
  2760. } REQ_103_WRITE_RAW;
  2761. typedef REQ_103_WRITE_RAW SMB_UNALIGNED *PREQ_103_WRITE_RAW;
  2762. typedef struct _RESP_103_WRITE_RAW {
  2763. UCHAR WordCount; // Count of parameter words
  2764. _USHORT( ByteCount ); // Count of data bytes; min =
  2765. UCHAR Buffer[1]; //
  2766. } RESP_103_WRITE_RAW;
  2767. typedef RESP_103_WRITE_RAW SMB_UNALIGNED *PRESP_103_WRITE_RAW;
  2768. #endif // def INCLUDE_SMB_RAW
  2769. typedef struct _REQ_NT_CANCEL {
  2770. UCHAR WordCount; // = 0
  2771. _USHORT( ByteCount ); // = 0
  2772. UCHAR Buffer[1];
  2773. } REQ_NT_CANCEL;
  2774. typedef REQ_NT_CANCEL SMB_UNALIGNED *PREQ_NT_CANCEL;
  2775. typedef struct _RESP_NT_CANCEL {
  2776. UCHAR WordCount; // = 0
  2777. _USHORT( ByteCount ); // = 0
  2778. UCHAR Buffer[1];
  2779. } RESP_NT_CANCEL;
  2780. typedef RESP_NT_CANCEL SMB_UNALIGNED *PRESP_NT_CANCEL;
  2781. //
  2782. // File open modes
  2783. //
  2784. #define SMB_ACCESS_READ_ONLY 0
  2785. #define SMB_ACCESS_WRITE_ONLY 1
  2786. #define SMB_ACCESS_READ_WRITE 2
  2787. #define SMB_ACCESS_EXECUTE 3
  2788. //
  2789. // Open flags
  2790. //
  2791. #define SMB_OPEN_QUERY_INFORMATION 0x01
  2792. #define SMB_OPEN_OPLOCK 0x02
  2793. #define SMB_OPEN_OPBATCH 0x04
  2794. #define SMB_OPEN_QUERY_EA_LENGTH 0x08
  2795. #define SMB_OPEN_EXTENDED_RESPONSE 0x10
  2796. //
  2797. // NT open manifests
  2798. //
  2799. #define NT_CREATE_REQUEST_OPLOCK 0x02
  2800. #define NT_CREATE_REQUEST_OPBATCH 0x04
  2801. #define NT_CREATE_OPEN_TARGET_DIR 0x08
  2802. #define NT_CREATE_REQUEST_EXTENDED_RESPONSE 0x10
  2803. // these options are post NT 5
  2804. #ifdef INCLUDE_SMB_IFMODIFIED
  2805. #define NT_CREATE_IFMODIFIED_REQUEST 0x20
  2806. #define NT_CREATE_REQUEST_EXTENDED_RESPONSE2 0x80
  2807. #endif
  2808. #ifdef INCLUDE_SMB_PERSISTENT
  2809. #define NT_CREATE_PERSISTANT_HANDLE 0x100
  2810. #endif
  2811. #define Added 0
  2812. #define Removed 1
  2813. #define Modified 2
  2814. #define RenamedOldName 3
  2815. #define RenamedNewName 4
  2816. //
  2817. // Lockrange for use with OS/2 DosFileLocks call
  2818. //
  2819. // *** Where is this used?
  2820. //typedef struct lockrange {
  2821. // ULONG offset;
  2822. // ULONG range;
  2823. // };
  2824. //#define LOCK 0x1
  2825. //#define UNLOCK 0x2
  2826. //
  2827. // Data buffer format codes, from the core protocol.
  2828. //
  2829. #define SMB_FORMAT_DATA 1
  2830. #define SMB_FORMAT_DIALECT 2
  2831. #define SMB_FORMAT_PATHNAME 3
  2832. #define SMB_FORMAT_ASCII 4
  2833. #define SMB_FORMAT_VARIABLE 5
  2834. //
  2835. // WriteMode flags
  2836. //
  2837. #define SMB_WMODE_WRITE_THROUGH 0x0001 // complete write before responding
  2838. #define SMB_WMODE_SET_REMAINING 0x0002 // returning amt remaining in pipe
  2839. #define SMB_WMODE_WRITE_RAW_NAMED_PIPE 0x0004 // write named pipe in raw mode
  2840. #define SMB_WMODE_START_OF_MESSAGE 0x0008 // start of pipe message
  2841. #define SMB_WMODE_DATAGRAM 0x0080 // start of pipe message
  2842. //
  2843. // Various SMB flags:
  2844. //
  2845. //
  2846. // If the server supports LockAndRead and WriteAndUnlock, it sets this
  2847. // bit the Negotiate response.
  2848. //
  2849. #define SMB_FLAGS_LOCK_AND_READ_OK 0x01
  2850. //
  2851. // When on, the consumer guarantees that there is a receive buffer posted
  2852. // such that a "Send.No.Ack" can be used by the server to respond to
  2853. // the consumer's request.
  2854. //
  2855. #define SMB_FLAGS_SEND_NO_ACK 0x2
  2856. //
  2857. // This is part of the Flags field of every SMB header. If this bit
  2858. // is set, then all pathnames in the SMB should be treated as case-
  2859. // insensitive.
  2860. //
  2861. #define SMB_FLAGS_CASE_INSENSITIVE 0x8
  2862. //
  2863. // When on in session setup, this bit indicates that all paths sent to
  2864. // the server are already in OS/2 canonicalized format.
  2865. //
  2866. #define SMB_FLAGS_CANONICALIZED_PATHS 0x10
  2867. //
  2868. // When on in a open file request SMBs (open, create, openX, etc.) this
  2869. // bit indicates a request for an oplock on the file. When on in the
  2870. // response, this bit indicates that the oplock was granted.
  2871. //
  2872. #define SMB_FLAGS_OPLOCK 0x20
  2873. //
  2874. // When on, this bit indicates that the server should notify the client
  2875. // on any request that could cause the file to be changed. If not set,
  2876. // the server only notifies the client on other open requests on the
  2877. // file.
  2878. //
  2879. #define SMB_FLAGS_OPLOCK_NOTIFY_ANY 0x40
  2880. //
  2881. // This bit indicates that the SMB is being sent from server to redir.
  2882. //
  2883. #define SMB_FLAGS_SERVER_TO_REDIR 0x80
  2884. //
  2885. // Valid bits for Flags on an incoming SMB
  2886. //
  2887. #define INCOMING_SMB_FLAGS \
  2888. (SMB_FLAGS_LOCK_AND_READ_OK | \
  2889. SMB_FLAGS_SEND_NO_ACK | \
  2890. SMB_FLAGS_CASE_INSENSITIVE | \
  2891. SMB_FLAGS_CANONICALIZED_PATHS | \
  2892. SMB_FLAGS_OPLOCK_NOTIFY_ANY | \
  2893. SMB_FLAGS_OPLOCK)
  2894. //
  2895. // Names for bits in Flags2 field of SMB header that indicate what the
  2896. // client app is aware of.
  2897. //
  2898. #define SMB_FLAGS2_KNOWS_LONG_NAMES 0x0001
  2899. #define SMB_FLAGS2_KNOWS_EAS 0x0002
  2900. #define SMB_FLAGS2_SMB_SECURITY_SIGNATURE 0x0004
  2901. #define SMB_FLAGS2_COMPRESSED 0x0008
  2902. // Unused 0x0010
  2903. // Unused 0x0020
  2904. #define SMB_FLAGS2_IS_LONG_NAME 0x0040
  2905. // Unused 0x0080
  2906. // Unused 0x0100
  2907. // Unused 0x0200
  2908. #define SMB_FLAGS2_REPARSE_PATH 0x0400
  2909. #define SMB_FLAGS2_EXTENDED_SECURITY 0x0800
  2910. #define SMB_FLAGS2_DFS 0x1000
  2911. #define SMB_FLAGS2_PAGING_IO 0x2000
  2912. #define SMB_FLAGS2_NT_STATUS 0x4000
  2913. #define SMB_FLAGS2_UNICODE 0x8000
  2914. //
  2915. // Valid bits for Flags2 on an incoming SMB
  2916. //
  2917. #define INCOMING_SMB_FLAGS2 \
  2918. (SMB_FLAGS2_KNOWS_LONG_NAMES | \
  2919. SMB_FLAGS2_KNOWS_EAS | \
  2920. SMB_FLAGS2_SMB_SECURITY_SIGNATURE | \
  2921. SMB_FLAGS2_EXTENDED_SECURITY| \
  2922. SMB_FLAGS2_DFS | \
  2923. SMB_FLAGS2_PAGING_IO | \
  2924. SMB_FLAGS2_IS_LONG_NAME | \
  2925. SMB_FLAGS2_NT_STATUS | \
  2926. SMB_FLAGS2_COMPRESSED | \
  2927. SMB_FLAGS2_UNICODE | \
  2928. SMB_FLAGS2_REPARSE_PATH)
  2929. //
  2930. // The SMB open function determines what action should be taken depending
  2931. // on the existence or lack thereof of files used in the operation. It
  2932. // has the following mapping:
  2933. //
  2934. // 1111 1
  2935. // 5432 1098 7654 3210
  2936. // rrrr rrrr rrrC rrOO
  2937. //
  2938. // where:
  2939. //
  2940. // O - Open (action to be taken if the target file exists)
  2941. // 0 - Fail
  2942. // 1 - Open or Append file
  2943. // 2 - Truncate file
  2944. //
  2945. // C - Create (action to be taken if the target file does not exist)
  2946. // 0 - Fail
  2947. // 1 - Create file
  2948. //
  2949. #define SMB_OFUN_OPEN_MASK 0x3
  2950. #define SMB_OFUN_CREATE_MASK 0x10
  2951. #define SMB_OFUN_OPEN_FAIL 0
  2952. #define SMB_OFUN_OPEN_APPEND 1
  2953. #define SMB_OFUN_OPEN_OPEN 1
  2954. #define SMB_OFUN_OPEN_TRUNCATE 2
  2955. #define SMB_OFUN_CREATE_FAIL 0x00
  2956. #define SMB_OFUN_CREATE_CREATE 0x10
  2957. //++
  2958. //
  2959. // BOOLEAN
  2960. // SmbOfunCreate(
  2961. // IN USHORT SmbOpenFunction
  2962. // )
  2963. //
  2964. //--
  2965. #define SmbOfunCreate(SmbOpenFunction) \
  2966. (BOOLEAN)((SmbOpenFunction & SMB_OFUN_CREATE_MASK) == SMB_OFUN_CREATE_CREATE)
  2967. //++
  2968. //
  2969. // BOOLEAN
  2970. // SmbOfunAppend(
  2971. // IN USHORT SmbOpenFunction
  2972. // )
  2973. //
  2974. //--
  2975. #define SmbOfunAppend(SmbOpenFunction) \
  2976. (BOOLEAN)((SmbOpenFunction & SMB_OFUN_OPEN_MASK) == SMB_OFUN_OPEN_APPEND)
  2977. //++
  2978. //
  2979. // BOOLEAN
  2980. // SmbOfunTruncate(
  2981. // IN USHORT SmbOpenFunction
  2982. // )
  2983. //
  2984. //--
  2985. #define SmbOfunTruncate(SmbOpenFunction) \
  2986. (BOOLEAN)((SmbOpenFunction & SMB_OFUN_OPEN_MASK) == SMB_OFUN_OPEN_TRUNCATE)
  2987. //
  2988. // The desired access mode passed in Open and Open and X has the following
  2989. // mapping:
  2990. //
  2991. // 1111 11
  2992. // 5432 1098 7654 3210
  2993. // rWrC rLLL rSSS rAAA
  2994. //
  2995. // where:
  2996. //
  2997. // W - Write through mode. No read ahead or write behind allowed on
  2998. // this file or device. When protocol is returned, data is expected
  2999. // to be on the disk or device.
  3000. //
  3001. // S - Sharing mode:
  3002. // 0 - Compatibility mode (as in core open)
  3003. // 1 - Deny read/write/execute (exclusive)
  3004. // 2 - Deny write
  3005. // 3 - Deny read/execute
  3006. // 4 - Deny none
  3007. //
  3008. // A - Access mode
  3009. // 0 - Open for reading
  3010. // 1 - Open for writing
  3011. // 2 - Open for reading and writing
  3012. // 3 - Open for execute
  3013. //
  3014. // rSSSrAAA = 11111111 (hex FF) indicates FCB open (as in core protocol)
  3015. //
  3016. // C - Cache mode
  3017. // 0 - Normal file
  3018. // 1 - Do not cache this file
  3019. //
  3020. // L - Locality of reference
  3021. // 0 - Locality of reference is unknown
  3022. // 1 - Mainly sequential access
  3023. // 2 - Mainly random access
  3024. // 3 - Random access with some locality
  3025. // 4 to 7 - Currently undefined
  3026. //
  3027. #define SMB_DA_SHARE_MASK 0x70
  3028. #define SMB_DA_ACCESS_MASK 0x07
  3029. #define SMB_DA_FCB_MASK (UCHAR)0xFF
  3030. #define SMB_DA_ACCESS_READ 0x00
  3031. #define SMB_DA_ACCESS_WRITE 0x01
  3032. #define SMB_DA_ACCESS_READ_WRITE 0x02
  3033. #define SMB_DA_ACCESS_EXECUTE 0x03
  3034. #define SMB_DA_SHARE_COMPATIBILITY 0x00
  3035. #define SMB_DA_SHARE_EXCLUSIVE 0x10
  3036. #define SMB_DA_SHARE_DENY_WRITE 0x20
  3037. #define SMB_DA_SHARE_DENY_READ 0x30
  3038. #define SMB_DA_SHARE_DENY_NONE 0x40
  3039. #define SMB_DA_FCB (UCHAR)0xFF
  3040. #define SMB_CACHE_NORMAL 0x0000
  3041. #define SMB_DO_NOT_CACHE 0x1000
  3042. #define SMB_LR_UNKNOWN 0x0000
  3043. #define SMB_LR_SEQUENTIAL 0x0100
  3044. #define SMB_LR_RANDOM 0x0200
  3045. #define SMB_LR_RANDOM_WITH_LOCALITY 0x0300
  3046. #define SMB_LR_MASK 0x0F00
  3047. #define SMB_DA_WRITE_THROUGH 0x4000
  3048. //
  3049. // The Action field of OpenAndX has the following format:
  3050. //
  3051. // 1111 11
  3052. // 5432 1098 7654 3210
  3053. // Lrrr rrrr rrrr rrOO
  3054. //
  3055. // where:
  3056. //
  3057. // L - Opportunistic lock. 1 if lock granted, else 0.
  3058. //
  3059. // O - Open action:
  3060. // 1 - The file existed and was opened
  3061. // 2 - The file did not exist but was created
  3062. // 3 - The file existed and was truncated
  3063. //
  3064. #define SMB_OACT_OPENED 0x01
  3065. #define SMB_OACT_CREATED 0x02
  3066. #define SMB_OACT_TRUNCATED 0x03
  3067. #define SMB_OACT_OPLOCK 0x8000
  3068. //
  3069. // These flags are passed in the Flags field of the copy and extended rename
  3070. // SMBs.
  3071. //
  3072. //
  3073. // If set, the target must be a file or directory.
  3074. //
  3075. #define SMB_TARGET_IS_FILE 0x1
  3076. #define SMB_TARGET_IS_DIRECTORY 0x2
  3077. //
  3078. // The copy mode--if set, ASCII copying should be done, otherwise binary.
  3079. //
  3080. #define SMB_COPY_TARGET_ASCII 0x4
  3081. #define SMB_COPY_SOURCE_ASCII 0x8
  3082. #define SMB_COPY_TREE 0x20
  3083. //
  3084. // If set, verify all writes.
  3085. //
  3086. #define SMB_VERIFY_WRITES
  3087. //
  3088. // Define file attribute bits as used in the SMB protocol. The specific
  3089. // bit positions are, for the most part, identical to those used in NT.
  3090. // However, NT does not define Volume and Directory bits. It also has
  3091. // an explicit Normal bit; this bit is implied in SMB attributes by
  3092. // Hidden, System, and Directory being off.
  3093. //
  3094. #define SMB_FILE_ATTRIBUTE_READONLY 0x01
  3095. #define SMB_FILE_ATTRIBUTE_HIDDEN 0x02
  3096. #define SMB_FILE_ATTRIBUTE_SYSTEM 0x04
  3097. #define SMB_FILE_ATTRIBUTE_VOLUME 0x08
  3098. #define SMB_FILE_ATTRIBUTE_DIRECTORY 0x10
  3099. #define SMB_FILE_ATTRIBUTE_ARCHIVE 0x20
  3100. //
  3101. // Share type strings are passed in SMBs to indicate what type of shared
  3102. // resource is being or has been connected to.
  3103. //
  3104. #define SHARE_TYPE_NAME_DISK "A:"
  3105. #define SHARE_TYPE_NAME_PIPE "IPC"
  3106. #define SHARE_TYPE_NAME_COMM "COMM"
  3107. #define SHARE_TYPE_NAME_PRINT "LPT1:"
  3108. #define SHARE_TYPE_NAME_WILD "?????"
  3109. //
  3110. // SMB Error codes:
  3111. //
  3112. //
  3113. // Success Class:
  3114. //
  3115. #define SMB_ERR_SUCCESS (UCHAR)0x00
  3116. //
  3117. // DOS Error Class:
  3118. //
  3119. #define SMB_ERR_CLASS_DOS (UCHAR)0x01
  3120. #define SMB_ERR_BAD_FUNCTION 1 // Invalid function
  3121. #define SMB_ERR_BAD_FILE 2 // File not found
  3122. #define SMB_ERR_BAD_PATH 3 // Invalid directory
  3123. #define SMB_ERR_NO_FIDS 4 // Too many open files
  3124. #define SMB_ERR_ACCESS_DENIED 5 // Access not allowed for req. func.
  3125. #define SMB_ERR_BAD_FID 6 // Invalid file handle
  3126. #define SMB_ERR_BAD_MCB 7 // Memory control blocks destroyed
  3127. #define SMB_ERR_INSUFFICIENT_MEMORY 8 // For the desired function
  3128. #define SMB_ERR_BAD_MEMORY 9 // Invalid memory block address
  3129. #define SMB_ERR_BAD_ENVIRONMENT 10 // Invalid environment
  3130. #define SMB_ERR_BAD_FORMAT 11 // Invalid format
  3131. #define SMB_ERR_BAD_ACCESS 12 // Invalid open mode
  3132. #define SMB_ERR_BAD_DATA 13 // Invalid data (only from IOCTL)
  3133. #define SMB_ERR_RESERVED 14
  3134. #define SMB_ERR_BAD_DRIVE 15 // Invalid drive specified
  3135. #define SMB_ERR_CURRENT_DIRECTORY 16 // Attempted to remove currect directory
  3136. #define SMB_ERR_DIFFERENT_DEVICE 17 // Not the same device
  3137. #define SMB_ERR_NO_FILES 18 // File search can't find more files
  3138. #define SMB_ERR_BAD_SHARE 32 // An open conflicts with FIDs on file
  3139. #define SMB_ERR_LOCK 33 // Conflict with existing lock
  3140. #define SMB_ERR_FILE_EXISTS 80 // Tried to overwrite existing file
  3141. #define SMB_ERR_BAD_PIPE 230 // Invalie pipe
  3142. #define SMB_ERR_PIPE_BUSY 231 // All instances of the pipe are busy
  3143. #define SMB_ERR_PIPE_CLOSING 232 // Pipe close in progress
  3144. #define SMB_ERR_PIPE_NOT_CONNECTED 233 // No process on other end of pipe
  3145. #define SMB_ERR_MORE_DATA 234 // There is more data to return
  3146. //
  3147. // SERVER Error Class:
  3148. //
  3149. #define SMB_ERR_CLASS_SERVER (UCHAR)0x02
  3150. #define SMB_ERR_ERROR 1 // Non-specific error code
  3151. #define SMB_ERR_BAD_PASSWORD 2 // Bad name/password pair
  3152. #define SMB_ERR_BAD_TYPE 3 // Reserved
  3153. #define SMB_ERR_ACCESS 4 // Requester lacks necessary access
  3154. #define SMB_ERR_BAD_TID 5 // Invalid TID
  3155. #define SMB_ERR_BAD_NET_NAME 6 // Invalid network name in tree connect
  3156. #define SMB_ERR_BAD_DEVICE 7 // Invalid device request
  3157. #define SMB_ERR_QUEUE_FULL 49 // Print queue full--returned print file
  3158. #define SMB_ERR_QUEUE_TOO_BIG 50 // Print queue full--no space
  3159. #define SMB_ERR_QUEUE_EOF 51 // EOF on print queue dump
  3160. #define SMB_ERR_BAD_PRINT_FID 52 // Invalid print file FID
  3161. #define SMB_ERR_BAD_SMB_COMMAND 64 // SMB command not recognized
  3162. #define SMB_ERR_SERVER_ERROR 65 // Internal server error
  3163. #define SMB_ERR_FILE_SPECS 67 // FID and pathname were incompatible
  3164. #define SMB_ERR_RESERVED2 68
  3165. #define SMB_ERR_BAD_PERMITS 69 // Access permissions invalid
  3166. #define SMB_ERR_RESERVED3 70
  3167. #define SMB_ERR_BAD_ATTRIBUTE_MODE 71 // Invalid attribute mode specified
  3168. #define SMB_ERR_SERVER_PAUSED 81 // Server is paused
  3169. #define SMB_ERR_MESSAGE_OFF 82 // Server not receiving messages
  3170. #define SMB_ERR_NO_ROOM 83 // No room for buffer message
  3171. #define SMB_ERR_TOO_MANY_NAMES 87 // Too many remote user names
  3172. #define SMB_ERR_TIMEOUT 88 // Operation was timed out
  3173. #define SMB_ERR_NO_RESOURCE 89 // No resources available for request
  3174. #define SMB_ERR_TOO_MANY_UIDS 90 // Too many UIDs active in session
  3175. #define SMB_ERR_BAD_UID 91 // UID not known as a valid UID
  3176. #define SMB_ERR_INVALID_NAME 123 // Invalid name returned from FAT.
  3177. #define SMB_ERR_INVALID_NAME_RANGE 206 // Non 8.3 name passed to FAT (or non 255 name to HPFS)
  3178. #define SMB_ERR_USE_MPX 250 // Can't support Raw; use MPX
  3179. #define SMB_ERR_USE_STANDARD 251 // Can't support Raw, use standard r/w
  3180. #define SMB_ERR_CONTINUE_MPX 252 // Reserved
  3181. #define SMB_ERR_RESERVED4 253
  3182. #define SMB_ERR_RESERVED5 254
  3183. #define SMB_ERR_NO_SUPPORT_INTERNAL 255 // Internal code for NO_SUPPORT--
  3184. // allows codes to be stored in a byte
  3185. #define SMB_ERR_NO_SUPPORT (USHORT)0xFFFF // Function not supported
  3186. //
  3187. // HARDWARE Error Class:
  3188. //
  3189. #define SMB_ERR_CLASS_HARDWARE (UCHAR)0x03
  3190. #define SMB_ERR_NO_WRITE 19 // Write attempted to write-prot. disk
  3191. #define SMB_ERR_BAD_UNIT 20 // Unknown unit
  3192. #define SMB_ERR_DRIVE_NOT_READY 21 // Disk drive not ready
  3193. #define SMB_ERR_BAD_COMMAND 22 // Unknown command
  3194. #define SMB_ERR_DATA 23 // Data error (CRC)
  3195. #define SMB_ERR_BAD_REQUEST 24 // Bad request structure length
  3196. #define SMB_ERR_SEEK 25 // Seek error
  3197. #define SMB_ERR_BAD_MEDIA 26 // Unknown media type
  3198. #define SMB_ERR_BAD_SECTOR 27 // Sector not found
  3199. #define SMB_ERR_NO_PAPER 28 // Printer out of paper
  3200. #define SMB_ERR_WRITE_FAULT 29 // Write fault
  3201. #define SMB_ERR_READ_FAULT 30 // Read fault
  3202. #define SMB_ERR_GENERAL 31 // General failure
  3203. #define SMB_ERR_LOCK_CONFLICT 33 // Lock conflicts with existing lock
  3204. #define SMB_ERR_WRONG_DISK 34 // Wrong disk was found in a drive
  3205. #define SMB_ERR_FCB_UNAVAILABLE 35 // No FCBs available to process request
  3206. #define SMB_ERR_SHARE_BUFFER_EXCEEDED 36
  3207. #define SMB_ERR_DISK_FULL 39 // !!! Undocumented, but in LM2.0
  3208. //
  3209. // Other Error Classes:
  3210. //
  3211. #define SMB_ERR_CLASS_XOS (UCHAR)0x04 // Reserved for XENIX
  3212. #define SMB_ERR_CLASS_RMX1 (UCHAR)0xE1 // Reserved for iRMX
  3213. #define SMB_ERR_CLASS_RMX2 (UCHAR)0xE2 // Reserved for iRMX
  3214. #define SMB_ERR_CLASS_RMX3 (UCHAR)0xE3 // Reserved for iRMX
  3215. #define SMB_ERR_CLASS_COMMAND (UCHAR)0xFF // Command was not in the SMB format
  3216. //
  3217. // Turn structure packing back off
  3218. //
  3219. #ifndef NO_PACKING
  3220. #include <packoff.h>
  3221. #endif // ndef NO_PACKING
  3222. #endif // _SMB_
  3223. // Old (LanMan 1.2) and new (NT) field names:
  3224. // (Undocumented fields have corresponding structure in parenthesis)
  3225. // smb_access Access
  3226. // smb_action Action
  3227. // smb_adate AccessDate
  3228. // smb_allocsize AllocationSize
  3229. // smb_aname AccountName
  3230. // smb_apasslen PasswordSize
  3231. // smb_apasswd AccountPassword
  3232. // smb_atime AccessTime
  3233. // smb_attr Attribute
  3234. // smb_attribute Attribute
  3235. // smb_aunits (RESP_QUERY_INFORMATION_SERVER)
  3236. // smb_bcc BufferSize
  3237. // smb_blkmode BlockMode
  3238. // smb_blksize BlockSize
  3239. // smb_blksperunit BlocksPerUnit
  3240. // smb_bpu BlocksPerUnit
  3241. // smb_bs BlockSize
  3242. // smb_bufsize MaxBufferSize
  3243. // smb_buf[1] Buffer[1]
  3244. // smb_bytes[*] Bytes[*]
  3245. // smb_cat Category
  3246. // smb_cct FilesCopied
  3247. // smb_cdate CreateDate
  3248. // smb_cert CertificateOffset
  3249. // smb_com Command
  3250. // smb_com2 AndXCommand
  3251. // smb_count Count
  3252. // smb_count_left Remaining
  3253. // smb_cryptkey[*] CryptKey
  3254. // smb_ctime CreateTime
  3255. // smb_datablock DataBlock
  3256. // smb_datalen DataSize
  3257. // smb_datasize DataSize
  3258. // smb_data[*] Data[*]
  3259. // smb_dcmode DataCompactMode
  3260. // smb_dev DeviceName
  3261. // smb_doff DataOffset
  3262. // smb_drcnt DataCount
  3263. // smb_drdisp DataDisplacement
  3264. // smb_droff DataOffset
  3265. // smb_dscnt DataCount
  3266. // smb_dsdisp DataDisplacement
  3267. // smb_dsize DataSize
  3268. // smb_dsoff DataOffset
  3269. // smb_encrypt EncryptKey
  3270. // smb_encryptlen EncryptKeySize
  3271. // smb_encryptoff EncryptKeyOffset
  3272. // smb_eos EndOfSearch
  3273. // smb_err Error
  3274. // smb_errmsg[1] ErrorMessage[1]
  3275. // smb_fau (RESP_QUERY_INFORMATION_SERVER)
  3276. // smb_fid Fid
  3277. // smb_fileid ServerFid
  3278. // smb_flag Flag
  3279. // smb_flag2 Flag2
  3280. // smb_flags Flag
  3281. // smb_flg Flag
  3282. // smb_freeunits FreeUnits
  3283. // smb_fsid (RESP_QUERY_INFORMATION_SERVER)
  3284. // smb_fsize FileSize
  3285. // smb_fun Function
  3286. // smb_gid Gid
  3287. // smb_handle Handle
  3288. // smb_ident1 Identifier
  3289. // smb_idf[4] Protocol[4]
  3290. // smb_index Index
  3291. // smb_info Info
  3292. // smb_left Remaining
  3293. // smb_len SetupLength
  3294. // smb_locknum NumberOfLocks
  3295. // smb_lockrng[*] LockRange
  3296. // smb_locktype LockType
  3297. // smb_lpid OwnerPid
  3298. // smb_maxbytes MaxBytes
  3299. // smb_maxcnt MaxCount
  3300. // smb_maxcount MaxCount
  3301. // smb_maxmux (RESP_NEGOTIATE)
  3302. // smb_maxvcs MaxNumberVcs
  3303. // smb_maxxmitsz MaxTransmitSize
  3304. // smb_maxxmt MaxTransmitSize
  3305. // smb_mdate ModificationDate
  3306. // smb_mdrcnt MaxDataCount
  3307. // smb_mid Mid
  3308. // smb_mincnt MinCount
  3309. // smb_mode Mode
  3310. // smb_mprcnt MaxParameterCount
  3311. // smb_mpxmax MaxMpxCount
  3312. // smb_msrcnt MaxSetupCount
  3313. // smb_mtime ModificationTime
  3314. // smb_name[*] Name[*]
  3315. // smb_off2 AndXOffset
  3316. // smb_offset Offset
  3317. // smb_ofun OpenFunction
  3318. // smb_pad Pad
  3319. // smb_pad1[] Pad1
  3320. // smb_pad[] Pad[]
  3321. // smb_param[*] Parameter[*]
  3322. // smb_path ServerName
  3323. // smb_pathname PathName
  3324. // smb_pid Pid
  3325. // smb_prcnt ParameterCount
  3326. // smb_prdisp ParameterDisplacement
  3327. // smb_proff ParameterCount
  3328. // smb_pscnt ParameterCount
  3329. // smb_psdisp ParameterDisplacement
  3330. // smb_psoff ParameterOffset
  3331. // smb_range LockLength or UnlockLength
  3332. // smb_rcls ErrorClass
  3333. // smb_reh ReservedH
  3334. // smb_reh2 ReservedH2
  3335. // smb_remaining Remaining
  3336. // smb_remcnt Remaining
  3337. // smb_res1 Reserved
  3338. // smb_res2 Reserved2
  3339. // smb_res3 Reserved3
  3340. // smb_res4 Reserved4
  3341. // smb_res5 Reserved5
  3342. // smb_reserved Reserved
  3343. // smb_restart Restart
  3344. // smb_resumekey ResumeKey
  3345. // smb_res[5] Reserved[]
  3346. // smb_reverb ReverbCount
  3347. // smb_rsvd Reserved
  3348. // smb_rsvd1 Reserved
  3349. // smb_rsvd2 Reserved2
  3350. // smb_rsvd3 Reserved3
  3351. // smb_rsvd4 Reserved4
  3352. // smb_sattr SearchAttribute
  3353. // smb_secmode SecurityMode
  3354. // smb_seq SequenceNumber
  3355. // smb_services Services
  3356. // smb_sesskey SessionKey
  3357. // smb_setup[*] Setup[*]
  3358. // smb_size Size
  3359. // smb_spasslen ServerPasswordSize
  3360. // smb_spasswd ServerPassword
  3361. // smb_srv_date ServerDate
  3362. // smb_srv_time ServerTime
  3363. // smb_srv_tzone ServerTimeZone
  3364. // smb_start StartIndex
  3365. // smb_state DeviceState
  3366. // smb_suwcnt SetupWordCount
  3367. // smb_su_class SetupClass
  3368. // smb_su_com SetupCommand
  3369. // smb_su_handle SetupFid
  3370. // smb_su_opcode SetupOpcode
  3371. // smb_su_priority SetupPriority
  3372. // smb_tcount Count
  3373. // smb_tdis TreeDisconnect
  3374. // smb_tdrcnt TotalDataCount
  3375. // smb_tdscnt TotalDataCount
  3376. // smb_tid Tid
  3377. // smb_tid2 Tid2
  3378. // smb_time Time
  3379. // smb_timeout Timeout
  3380. // smb_totalunits TotalUnits
  3381. // smb_tprcnt TotalParameterCount
  3382. // smb_tpscnt TotalParameterCount
  3383. // smb_type FileType
  3384. // smb_uid Uid
  3385. // smb_unlkrng[*] UnlockRange
  3386. // smb_unlocknum NumberOfUnlocks
  3387. // smb_vblen DataLength
  3388. // smb_vcnum VcNumber
  3389. // smb_vldate (RESP_QUERY_INFORMATION_SERVER)
  3390. // smb_vllen (RESP_QUERY_INFORMATION_SERVER)
  3391. // smb_vltime (RESP_QUERY_INFORMATION_SERVER)
  3392. // smb_vwv[1] Param
  3393. // smb_wct WordCount
  3394. // smb_wmode WriteMode
  3395. // smb_xchain EncryptChainOffset