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.

476 lines
20 KiB

  1. /*++ BUILD Version: 0009 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddnfs.h
  5. Abstract:
  6. This is the include file that defines all constants and types for
  7. accessing the redirector file system device.
  8. Author:
  9. Steve Wood (stevewo) 27-May-1990
  10. Revision History:
  11. Larry Osterman (larryo)
  12. Rita Wong (ritaw) 19-Feb-1991
  13. John Rogers (JohnRo) 08-Mar-1991
  14. --*/
  15. #ifndef _NTDDNFS_
  16. #define _NTDDNFS_
  17. #if _MSC_VER > 1000
  18. #pragma once
  19. #endif
  20. #include <windef.h>
  21. #include <lmcons.h>
  22. #include <lmwksta.h>
  23. #include <ntmsv1_0.h>
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. //
  28. // Device Name - this string is the name of the device. It is the name
  29. // that should be passed to NtOpenFile when accessing the device.
  30. //
  31. // Note: For devices that support multiple units, it should be suffixed
  32. // with the Ascii representation of the unit number.
  33. //
  34. //
  35. // Device Name - this string is the name of the device. It is the name
  36. // that should be passed to NtOpenFile when accessing the device.
  37. //
  38. // Note: For devices that support multiple units, it should be suffixed
  39. // with the Ascii representation of the unit number.
  40. //
  41. #define DD_NFS2_DEVICE_NAME "\\Device\\FsWrap"
  42. #define DD_NFS2_DEVICE_NAME_U L"\\Device\\FsWrap"
  43. #define DD_NFS_DEVICE_NAME "\\Device\\LanmanRedirector"
  44. #define DD_NFS_DEVICE_NAME_U L"\\Device\\LanmanRedirector"
  45. //
  46. // The file system name as returned by
  47. // NtQueryInformationVolume(FileFsAttributeInformation)
  48. //
  49. #define DD_NFS_FILESYS_NAME "LMRDR"
  50. #define DD_NFS_FILESYS_NAME_U L"LMRDR"
  51. //
  52. // EA Names for creating a tree connection
  53. //
  54. #define EA_NAME_CONNECT "NoConnect"
  55. #define EA_NAME_DOMAIN "Domain"
  56. #define EA_NAME_USERNAME "UserName"
  57. #define EA_NAME_PASSWORD "Password"
  58. #define EA_NAME_TYPE "Type"
  59. #define EA_NAME_TRANSPORT "Transport"
  60. #define EA_NAME_PRINCIPAL "Principal"
  61. #define EA_NAME_MRXCONTEXT "MinirdrContext"
  62. #define EA_NAME_CSCAGENT "CscAgent"
  63. #define EA_NAME_DOMAIN_U L"Domain"
  64. #define EA_NAME_USERNAME_U L"UserName"
  65. #define EA_NAME_PASSWORD_U L"Password"
  66. #define EA_NAME_TYPE_U L"Type"
  67. #define EA_NAME_TRANSPORT_U L"Transport"
  68. #define EA_NAME_PRINCIPAL_U L"Principal"
  69. #define EA_NAME_MRXCONTEXT_U L"MinirdrContext"
  70. #define EA_NAME_CSCAGENT_U L"CscAgent"
  71. #define TRANSACTION_REQUEST 0x00000003
  72. //
  73. // Redirector specific configuration options (separate from workstation
  74. // service configuration options)
  75. //
  76. #define RDR_CONFIG_PARAMETERS L"Parameters"
  77. #define RDR_CONFIG_USE_WRITEBHND L"UseWriteBehind"
  78. #define RDR_CONFIG_USE_ASYNC_WRITEBHND L"UseAsyncWriteBehind"
  79. #define RDR_CONFIG_LOWER_SEARCH_THRESHOLD L"LowerSearchThreshold"
  80. #define RDR_CONFIG_LOWER_SEARCH_BUFFSIZE L"LowerSearchBufferSize"
  81. #define RDR_CONFIG_UPPER_SEARCH_BUFFSIZE L"UpperSearchBufferSize"
  82. #define RDR_CONFIG_STACK_SIZE L"StackSize"
  83. #define RDR_CONFIG_CONNECT_TIMEOUT L"ConnectMaxTimeout"
  84. #define RDR_CONFIG_RAW_TIME_LIMIT L"RawIoTimeLimit"
  85. #define RDR_CONFIG_OS2_SESSION_LIMIT L"Os2SessionLimit"
  86. #define RDR_CONFIG_TURBO_MODE L"TurboMode"
  87. #define RDR_CONFIG_CURRENT_WINDOWS_VERSION L"\\REGISTRY\\Machine\\Software\\Microsoft\\Windows Nt\\CurrentVersion"
  88. #define RDR_CONFIG_OPERATING_SYSTEM L"CurrentBuildNumber"
  89. #define RDR_CONFIG_OPERATING_SYSTEM_VERSION L"CurrentVersion"
  90. #define RDR_CONFIG_OPERATING_SYSTEM_NAME L"ProductName"
  91. //
  92. // NtDeviceIoControlFile/NtFsControlFile IoControlCode values for this device.
  93. //
  94. // Warning: Remember that the low two bits of the code specify how the
  95. // buffers are passed to the driver!
  96. //
  97. //
  98. // Method = 00 - Buffer both input and output buffers for the request
  99. // Method = 01 - Buffer input, map output buffer to an MDL as an IN buff
  100. // Method = 10 - Buffer input, map output buffer to an MDL as an OUT buff
  101. // Method = 11 - Do not buffer either the input or output
  102. //
  103. #define IOCTL_RDR_BASE FILE_DEVICE_NETWORK_FILE_SYSTEM
  104. #define _RDR_CONTROL_CODE(request, method, access) \
  105. CTL_CODE(IOCTL_RDR_BASE, request, method, access)
  106. #define FSCTL_LMR_START _RDR_CONTROL_CODE(100, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
  107. #define FSCTL_LMR_STOP _RDR_CONTROL_CODE(101, METHOD_BUFFERED, FILE_ANY_ACCESS)
  108. #define FSCTL_LMR_SET_CONFIG_INFO _RDR_CONTROL_CODE(102, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
  109. #define FSCTL_LMR_GET_CONFIG_INFO _RDR_CONTROL_CODE(103, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
  110. #define FSCTL_LMR_GET_CONNECTION_INFO _RDR_CONTROL_CODE(104, METHOD_NEITHER, FILE_ANY_ACCESS)
  111. #define FSCTL_LMR_ENUMERATE_CONNECTIONS _RDR_CONTROL_CODE(105, METHOD_NEITHER, FILE_ANY_ACCESS)
  112. #define FSCTL_LMR_GET_VERSIONS _RDR_CONTROL_CODE(106, METHOD_BUFFERED, FILE_ANY_ACCESS)
  113. #define FSCTL_LMR_DELETE_CONNECTION _RDR_CONTROL_CODE(107, METHOD_BUFFERED, FILE_ANY_ACCESS)
  114. #define FSCTL_LMR_BIND_TO_TRANSPORT _RDR_CONTROL_CODE(108, METHOD_BUFFERED, FILE_ANY_ACCESS)
  115. #define FSCTL_LMR_UNBIND_FROM_TRANSPORT _RDR_CONTROL_CODE(109, METHOD_BUFFERED, FILE_ANY_ACCESS)
  116. #define FSCTL_LMR_ENUMERATE_TRANSPORTS _RDR_CONTROL_CODE(110, METHOD_NEITHER, FILE_ANY_ACCESS)
  117. #define FSCTL_LMR_GET_HINT_SIZE _RDR_CONTROL_CODE(113, METHOD_BUFFERED, FILE_ANY_ACCESS)
  118. #define FSCTL_LMR_TRANSACT _RDR_CONTROL_CODE(114, METHOD_BUFFERED, FILE_ANY_ACCESS)
  119. #define FSCTL_LMR_ENUMERATE_PRINT_INFO _RDR_CONTROL_CODE(115, METHOD_BUFFERED, FILE_ANY_ACCESS)
  120. #define FSCTL_LMR_GET_STATISTICS _RDR_CONTROL_CODE(116, METHOD_BUFFERED, FILE_ANY_ACCESS)
  121. #define FSCTL_LMR_START_SMBTRACE _RDR_CONTROL_CODE(117, METHOD_BUFFERED, FILE_ANY_ACCESS)
  122. #define FSCTL_LMR_END_SMBTRACE _RDR_CONTROL_CODE(118, METHOD_BUFFERED, FILE_ANY_ACCESS)
  123. #define FSCTL_LMR_START_RBR _RDR_CONTROL_CODE(119, METHOD_BUFFERED, FILE_ANY_ACCESS)
  124. #define FSCTL_LMR_SET_DOMAIN_NAME _RDR_CONTROL_CODE(120, METHOD_BUFFERED, FILE_ANY_ACCESS)
  125. #define FSCTL_LMR_SET_SERVER_GUID _RDR_CONTROL_CODE(121, METHOD_BUFFERED, FILE_ANY_ACCESS)
  126. #define FSCTL_LMR_QUERY_TARGET_INFO _RDR_CONTROL_CODE(122, METHOD_BUFFERED, FILE_ANY_ACCESS)
  127. //
  128. // the following fsctl controlcodes are reserved for the fswrap device and minirdrs
  129. //
  130. #define FSCTL_FSWRAP_RESERVED_LOW _RDR_CONTROL_CODE(200, METHOD_BUFFERED, FILE_ANY_ACCESS)
  131. #define FSCTL_FSWRAP_RESERVED_HIGH _RDR_CONTROL_CODE(219, METHOD_BUFFERED, FILE_ANY_ACCESS)
  132. #define FSCTL_MINIRDR_RESERVED_LOW _RDR_CONTROL_CODE(220, METHOD_BUFFERED, FILE_ANY_ACCESS)
  133. #define FSCTL_MINIRDR_RESERVED_HIGH _RDR_CONTROL_CODE(239, METHOD_BUFFERED, FILE_ANY_ACCESS)
  134. //
  135. // WARNING: codes from 240-255 are reserved, do not use them.
  136. //
  137. //
  138. // Identifies the data structure type for Buffer 2 of each FSCtl
  139. //
  140. typedef enum {
  141. ConfigInformation, // FSCTL_LMR_START,
  142. // FSCTL_LMR_SET_CONFIG_INFO,
  143. // FSCTL_LMR_GET_CONFIG_INFO
  144. // (structure found in wksta.h)
  145. GetConnectionInfo, // FSCTL_LMR_ENUMERATE_CONNECTIONS,
  146. // FSCTL_LMR_GET_CONNECTION_INFO
  147. EnumerateTransports // FSCTL_LMR_ENUMERATE_TRANSPORTS
  148. // (structure found in wksta.h)
  149. } FSCTL_LMR_STRUCTURES;
  150. //
  151. // LAN Man Redirector Request Packet used by the Workstation service
  152. // to pass parameters to the Redirector through Buffer 1 of
  153. // NtFsControlFile.
  154. //
  155. // Additional input or output of each FSCtl is found in Buffer 2.
  156. //
  157. #define REQUEST_PACKET_VERSION 0x00000006L // Structure version.
  158. typedef struct _LMR_REQUEST_PACKET {
  159. FSCTL_LMR_STRUCTURES Type; // Type of structure in Buffer 2
  160. ULONG Version; // Version of structure in Buffer 2
  161. ULONG Level; // Level of information of force level
  162. LUID LogonId; // User logon session identifier
  163. union {
  164. struct {
  165. ULONG RedirectorNameLength; // Length of computer name.
  166. ULONG DomainNameLength; // Length of primary domain name.
  167. WCHAR RedirectorName[1]; // Computer name (NOT null terminated)
  168. // WCHAR DomainName[1]; // Domain name - After computer name.
  169. } Start; // IN
  170. struct {
  171. ULONG EntriesRead; // Number of entries returned
  172. ULONG TotalEntries; // Total entries available
  173. ULONG TotalBytesNeeded; // Total bytes needed to read all entries
  174. ULONG ResumeHandle; // Resume handle.
  175. } Get; // OUT
  176. struct {
  177. ULONG WkstaParameter; // Specifies the entire structure or a
  178. // field to set on input; if any
  179. // field is invalid, specifies the
  180. // one at fault on output.
  181. } Set; // IN OUT
  182. struct {
  183. ULONG RedirectorVersion; // Version of the Redirector
  184. ULONG RedirectorPlatform; // Redirector platform base number
  185. ULONG MajorVersion; // LAN Man major version number
  186. ULONG MinorVersion; // LAN Man minor version number
  187. } GetVersion; // OUT
  188. struct {
  189. ULONG WkstaParameter; // Specifies the parameter at fault
  190. // if a parameter is invalid OUT
  191. ULONG QualityOfService; // Quality of service indicator IN
  192. ULONG TransportNameLength; // not including terminator IN
  193. WCHAR TransportName[1]; // Name of transport provider IN
  194. } Bind;
  195. struct {
  196. ULONG TransportNameLength; // not including terminator
  197. WCHAR TransportName[1]; // Name of transport provider
  198. } Unbind; // IN
  199. struct {
  200. ULONG ConnectionsHint; // Number of bytes needed for buffer
  201. // to enumerate tree connections
  202. ULONG TransportsHint; // Number of bytes needed for buffer
  203. // to enumerate transports
  204. } GetHintSize; // OUT
  205. struct {
  206. ULONG Index; // Entry in the queue to return, 0 on
  207. // first call, value of RestartIndex on
  208. // subsequent calls.
  209. } GetPrintQueue; // IN
  210. } Parameters;
  211. } LMR_REQUEST_PACKET, *PLMR_REQUEST_PACKET;
  212. //
  213. // Mask bits for use with Parameters.GetConnectionInfo.Capabilities:
  214. //
  215. #define CAPABILITY_CASE_SENSITIVE_PASSWDS 0x00000001L
  216. #define CAPABILITY_REMOTE_ADMIN_PROTOCOL 0x00000002L
  217. #define CAPABILITY_RPC 0x00000004L
  218. #define CAPABILITY_SAM_PROTOCOL 0x00000008L
  219. #define CAPABILITY_UNICODE 0x00000010L
  220. //
  221. // Output buffer structure of FSCTL_LMR_ENUMERATE_CONNECTIONS used
  222. // to implement NetUseEnum. The returned data is actually an array
  223. // of this structure.
  224. //
  225. typedef struct _LMR_CONNECTION_INFO_0 {
  226. UNICODE_STRING UNCName; // Name of UNC connection
  227. ULONG ResumeKey; // Resume key for this entry.
  228. } LMR_CONNECTION_INFO_0, *PLMR_CONNECTION_INFO_0;
  229. typedef struct _LMR_CONNECTION_INFO_1 {
  230. UNICODE_STRING UNCName; // Name of UNC connection
  231. ULONG ResumeKey; // Resume key for this entry.
  232. DEVICE_TYPE SharedResourceType; // Type of shared resource
  233. ULONG ConnectionStatus; // Status of the connection
  234. ULONG NumberFilesOpen; // Number of opened files
  235. } LMR_CONNECTION_INFO_1, *PLMR_CONNECTION_INFO_1;
  236. typedef struct _LMR_CONNECTION_INFO_2 {
  237. UNICODE_STRING UNCName; // Name of UNC connection
  238. ULONG ResumeKey; // Resume key for this entry.
  239. DEVICE_TYPE SharedResourceType; // Type of shared resource
  240. ULONG ConnectionStatus; // Status of the connection
  241. ULONG NumberFilesOpen; // Number of opened files
  242. UNICODE_STRING UserName; // User who created connection.
  243. UNICODE_STRING DomainName; // Domain of user who created connection.
  244. ULONG Capabilities; // Bit mask of remote abilities.
  245. UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH]; // User session key
  246. UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH]; // Lanman session key
  247. } LMR_CONNECTION_INFO_2, *PLMR_CONNECTION_INFO_2;
  248. typedef struct _LMR_CONNECTION_INFO_3 {
  249. UNICODE_STRING UNCName; // Name of UNC connection
  250. ULONG ResumeKey; // Resume key for this entry.
  251. DEVICE_TYPE SharedResourceType; // Type of shared resource
  252. ULONG ConnectionStatus; // Status of the connection
  253. ULONG NumberFilesOpen; // Number of opened files
  254. UNICODE_STRING UserName; // User who created connection.
  255. UNICODE_STRING DomainName; // Domain of user who created connection.
  256. ULONG Capabilities; // Bit mask of remote abilities.
  257. UCHAR UserSessionKey[MSV1_0_USER_SESSION_KEY_LENGTH]; // User session key
  258. UCHAR LanmanSessionKey[MSV1_0_LANMAN_SESSION_KEY_LENGTH]; // Lanman session key
  259. UNICODE_STRING TransportName; // Transport connection is active on
  260. ULONG Throughput; // Throughput of connection.
  261. ULONG Delay; // Small packet overhead.
  262. LARGE_INTEGER TimeZoneBias; // Time zone delta in 100ns units.
  263. BOOL IsSpecialIpcConnection; // True IFF there is a special IPC connection active.
  264. BOOL Reliable; // True iff the connection is reliable
  265. BOOL ReadAhead; // True iff readahead is active on connection.
  266. BOOL Core;
  267. BOOL MsNet103;
  268. BOOL Lanman10;
  269. BOOL WindowsForWorkgroups;
  270. BOOL Lanman20;
  271. BOOL Lanman21;
  272. BOOL WindowsNt;
  273. BOOL MixedCasePasswords;
  274. BOOL MixedCaseFiles;
  275. BOOL LongNames;
  276. BOOL ExtendedNegotiateResponse;
  277. BOOL LockAndRead;
  278. BOOL NtSecurity;
  279. BOOL SupportsEa;
  280. BOOL NtNegotiateResponse;
  281. BOOL CancelSupport;
  282. BOOL UnicodeStrings;
  283. BOOL LargeFiles;
  284. BOOL NtSmbs;
  285. BOOL RpcRemoteAdmin;
  286. BOOL NtStatusCodes;
  287. BOOL LevelIIOplock;
  288. BOOL UtcTime;
  289. BOOL UserSecurity;
  290. BOOL EncryptsPasswords;
  291. } LMR_CONNECTION_INFO_3, *PLMR_CONNECTION_INFO_3;
  292. #define TRANSACTION_VERSION 0x00000002L // Structure version.
  293. typedef struct _LMR_TRANSACTION {
  294. ULONG Type; // Type of structure
  295. ULONG Size; // Size of fixed portion of structure
  296. ULONG Version; // Structure version.
  297. ULONG NameLength; // Number of bytes in name (in path
  298. // format, e.g., \server\pipe\netapi\4)
  299. ULONG NameOffset; // Offset of name in buffer.
  300. BOOLEAN ResponseExpected; // Should remote system respond?
  301. ULONG Timeout; // Timeout time in milliseconds.
  302. ULONG SetupWords; // Number of trans setup words (may be
  303. // 0). (setup words are input/output.)
  304. ULONG SetupOffset; // Offset of setup (may be 0 for none).
  305. ULONG MaxSetup; // Size of setup word array (may be 0).
  306. ULONG ParmLength; // Input param area length (may be 0).
  307. PVOID ParmPtr; // Input parameter area (may be NULL).
  308. ULONG MaxRetParmLength; // Output param. area length (may be 0).
  309. ULONG DataLength; // Input data area length (may be 0).
  310. PVOID DataPtr; // Input data area (may be NULL).
  311. ULONG MaxRetDataLength; // Output data area length (may be 0).
  312. PVOID RetDataPtr; // Output data area (may be NULL).
  313. } LMR_TRANSACTION, *PLMR_TRANSACTION;
  314. //
  315. // Output buffer structure of FSCTL_LMR_ENUMERATE_PRINT_INFO used
  316. // to implement DosPrintQEnum to down level servers. Caller must supply
  317. // a buffer at least sizeof( LMR_GET_PRINT_QUEUE ) + UNLEN
  318. //
  319. typedef struct _LMR_GET_PRINT_QUEUE {
  320. ANSI_STRING OriginatorName; // Name of user that did print
  321. LARGE_INTEGER CreateTime; // When file was created
  322. ULONG EntryStatus; // Held/Printing etc.
  323. ULONG FileNumber; // Spool file number from create
  324. // print request.
  325. ULONG FileSize;
  326. ULONG RestartIndex; // Index of the next entry in queue
  327. // note this is not last index+1
  328. // either a value of 0 or an error
  329. // indicates end-of-queue
  330. } LMR_GET_PRINT_QUEUE, *PLMR_GET_PRINT_QUEUE;
  331. //
  332. // NB: The following structure is STAT_WORKSTATION_0 in sdk\inc\lmstats.h. If
  333. // you change the structure, change it in both places
  334. //
  335. typedef struct _REDIR_STATISTICS {
  336. LARGE_INTEGER StatisticsStartTime;
  337. LARGE_INTEGER BytesReceived;
  338. LARGE_INTEGER SmbsReceived;
  339. LARGE_INTEGER PagingReadBytesRequested;
  340. LARGE_INTEGER NonPagingReadBytesRequested;
  341. LARGE_INTEGER CacheReadBytesRequested;
  342. LARGE_INTEGER NetworkReadBytesRequested;
  343. LARGE_INTEGER BytesTransmitted;
  344. LARGE_INTEGER SmbsTransmitted;
  345. LARGE_INTEGER PagingWriteBytesRequested;
  346. LARGE_INTEGER NonPagingWriteBytesRequested;
  347. LARGE_INTEGER CacheWriteBytesRequested;
  348. LARGE_INTEGER NetworkWriteBytesRequested;
  349. ULONG InitiallyFailedOperations;
  350. ULONG FailedCompletionOperations;
  351. ULONG ReadOperations;
  352. ULONG RandomReadOperations;
  353. ULONG ReadSmbs;
  354. ULONG LargeReadSmbs;
  355. ULONG SmallReadSmbs;
  356. ULONG WriteOperations;
  357. ULONG RandomWriteOperations;
  358. ULONG WriteSmbs;
  359. ULONG LargeWriteSmbs;
  360. ULONG SmallWriteSmbs;
  361. ULONG RawReadsDenied;
  362. ULONG RawWritesDenied;
  363. ULONG NetworkErrors;
  364. // Connection/Session counts
  365. ULONG Sessions;
  366. ULONG FailedSessions;
  367. ULONG Reconnects;
  368. ULONG CoreConnects;
  369. ULONG Lanman20Connects;
  370. ULONG Lanman21Connects;
  371. ULONG LanmanNtConnects;
  372. ULONG ServerDisconnects;
  373. ULONG HungSessions;
  374. ULONG UseCount;
  375. ULONG FailedUseCount;
  376. //
  377. // Queue Lengths (updates protected by RdrMpxTableSpinLock NOT
  378. // RdrStatisticsSpinlock)
  379. //
  380. ULONG CurrentCommands;
  381. } REDIR_STATISTICS, *PREDIR_STATISTICS;
  382. //
  383. // FSCTL_LMR_QUERY_TARGET_INFO
  384. //
  385. typedef struct _LMR_QUERY_TARGET_INFO {
  386. // The allocation size of the entire LMR_QUERY_TARGET_INFO. RDR will update it with the
  387. // actual size used.
  388. ULONG BufferLength;
  389. // The Buffer contains the marshelled TargetInfo
  390. USHORT TargetInfoMarshalled[1];
  391. } LMR_QUERY_TARGET_INFO, *PLMR_QUERY_TARGET_INFO;
  392. #ifdef __cplusplus
  393. }
  394. #endif
  395. #endif // ifndef _NTDDNFS_