Windows NT 4.0 source code leak
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.

525 lines
12 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. srvdata.h
  5. Abstract:
  6. This module defines global data for the LAN Manager server.
  7. Author:
  8. Chuck Lenzmeier (chuckl) 22-Sep-1989
  9. Revision History:
  10. --*/
  11. #ifndef _SRVDATA_
  12. #define _SRVDATA_
  13. //#include <ntos.h>
  14. //#include "lock.h"
  15. //#include "srvconst.h"
  16. //#include "smbtypes.h"
  17. //
  18. // All global variables referenced in this module are defined in
  19. // srvdata.c. See that module for complete descriptions.
  20. //
  21. // The variables referenced herein, because they are part of the driver
  22. // image, are not pageable. However, some of the things pointed to by
  23. // these variables are in the FSP's address space and are pageable.
  24. // These variables are only accessed by the FSP, and only at low IRQL.
  25. // Any data referenced by the FSP at elevated IRQL or by the FSD must
  26. // be nonpageable.
  27. //
  28. //
  29. // Routine to initialize data structures contained herein that cannot
  30. // be statically initialized.
  31. //
  32. VOID
  33. SrvInitializeData (
  34. VOID
  35. );
  36. //
  37. // Routine to clean up global server data when the driver is unloaded.
  38. //
  39. VOID
  40. SrvTerminateData (
  41. VOID
  42. );
  43. //
  44. // Address of the server device object.
  45. //
  46. extern PDEVICE_OBJECT SrvDeviceObject;
  47. //
  48. // Fields describing the state of the FSP.
  49. //
  50. extern BOOLEAN SrvFspActive; // Indicates whether the FSP is running
  51. extern BOOLEAN SrvFspTransitioning; // Indicates that the server is in the
  52. // process of starting up or
  53. // shutting down
  54. extern BOOLEAN RegisteredForShutdown; // Indicates whether the server has
  55. // registered for shutdown notification.
  56. extern PEPROCESS SrvServerProcess; // Pointer to the initial system process
  57. #ifdef SRV_PNP_POWER
  58. extern BOOLEAN SrvCompletedPNPRegistration; // Indicates whether the FSP has completed
  59. // registering for PNP notifications
  60. #endif
  61. //
  62. // Endpoint variables. SrvEndpointCount is used to count the number of
  63. // active endpoints. When the last endpoint is closed, SrvEndpointEvent
  64. // is set so that the thread processing the shutdown request continues
  65. // server termination.
  66. //
  67. extern CLONG SrvEndpointCount; // Number of transport endpoints
  68. extern KEVENT SrvEndpointEvent; // Signaled when no active endpoints
  69. //
  70. // DMA alignment size
  71. //
  72. extern ULONG SrvCacheLineSize;
  73. //
  74. // Global spin locks.
  75. //
  76. extern SRV_GLOBAL_SPIN_LOCKS SrvGlobalSpinLocks;
  77. #if SRVDBG || SRVDBG_HANDLES
  78. //
  79. // Lock used to protect debugging structures.
  80. //
  81. extern SRV_LOCK SrvDebugLock;
  82. #endif
  83. //
  84. // SrvConfigurationLock is used to synchronize configuration requests.
  85. //
  86. extern SRV_LOCK SrvConfigurationLock;
  87. //
  88. // SrvStartupShutdownLock is used to synchronize driver starting and stopping
  89. //
  90. extern SRV_LOCK SrvStartupShutdownLock;
  91. #if SRV_COMM_DEVICES
  92. //
  93. // SvrCommDeviceLock is used to serialize access to comm devices.
  94. //
  95. extern SRV_LOCK SrvCommDeviceLock;
  96. #endif
  97. //
  98. // SrvEndpointLock serializes access to the global endpoint list and
  99. // all endpoints. Note that the list of connections in each endpoint
  100. // is also protected by this lock.
  101. //
  102. extern SRV_LOCK SrvEndpointLock;
  103. //
  104. // SrvShareLock protects all shares.
  105. //
  106. extern SRV_LOCK SrvShareLock;
  107. //
  108. // The number of processors in the system
  109. //
  110. extern ULONG SrvNumberOfProcessors;
  111. //
  112. // Work queues -- nonblocking, blocking, and critical.
  113. //
  114. #if MULTIPROCESSOR
  115. extern PBYTE SrvWorkQueuesBase;
  116. extern PWORK_QUEUE SrvWorkQueues;
  117. #else
  118. extern WORK_QUEUE SrvWorkQueues[1];
  119. #endif
  120. extern PWORK_QUEUE eSrvWorkQueues; // used to terminate 'for' loops
  121. extern WORK_QUEUE SrvBlockingWorkQueue;
  122. extern ULONG SrvReBalanced; // how often we've picked another CPU
  123. extern ULONG SrvNextBalanceProcessor; // Which processor we'll look for next
  124. extern CLONG SrvBlockingOpsInProgress;
  125. //
  126. // Various list heads.
  127. //
  128. extern LIST_ENTRY SrvNeedResourceQueue; // The need resource queue
  129. extern LIST_ENTRY SrvDisconnectQueue; // The disconnect queue
  130. //
  131. // Queue of connections that needs to be dereferenced.
  132. //
  133. extern SLIST_HEADER SrvBlockOrphanage;
  134. //
  135. // FSP configuration queue. The FSD puts configuration request IRPs
  136. // (from NtDeviceIoControlFile) on this queue, and it is serviced by an
  137. // EX worker thread.
  138. //
  139. extern LIST_ENTRY SrvConfigurationWorkQueue;
  140. //
  141. // This is the number of configuration IRPs which have been queued but not
  142. // yet completed.
  143. //
  144. extern ULONG SrvConfigurationIrpsInProgress;
  145. //
  146. // Work item for running the configuration thread in the context of an
  147. // EX worker thread.
  148. extern WORK_QUEUE_ITEM SrvConfigurationThreadWorkItem[ MAX_CONFIG_WORK_ITEMS ];
  149. //
  150. // Base address of the large block allocated to hold initial normal
  151. // work items (see blkwork.c\SrvAllocateInitialWorkItems).
  152. //
  153. extern PVOID SrvInitialWorkItemBlock;
  154. //
  155. // Work item used to run the resource thread. Booleans used to inform
  156. // the resource thread to continue running.
  157. //
  158. extern WORK_QUEUE_ITEM SrvResourceThreadWorkItem;
  159. extern BOOLEAN SrvResourceThreadRunning;
  160. extern BOOLEAN SrvResourceDisconnectPending;
  161. extern BOOLEAN SrvResourceFreeConnection;
  162. extern LONG SrvResourceOrphanedBlocks;
  163. //
  164. // Generic security mapping for connecting to shares
  165. //
  166. extern GENERIC_MAPPING SrvShareConnectMapping;
  167. //
  168. // What's the minumum # of free work items each processor should have?
  169. //
  170. extern ULONG SrvMinPerProcessorFreeWorkItems;
  171. //
  172. // The server has callouts to enable a smart card to accelerate its direct
  173. // host IPX performance. This is the vector of entry points.
  174. //
  175. extern SRV_IPX_SMART_CARD SrvIpxSmartCard;
  176. //
  177. // The master file table contains one entry for each named file that has
  178. // at least one open instance.
  179. //
  180. extern MFCBHASH SrvMfcbHashTable[ NMFCB_HASH_TABLE ];
  181. //
  182. // The share table contains one entry for each share
  183. //
  184. extern LIST_ENTRY SrvShareHashTable[ NSHARE_HASH_TABLE ];
  185. //
  186. // Hex digits array used by the dump routines and SrvSmbCreateTemporary.
  187. //
  188. extern CHAR SrvHexChars[];
  189. //
  190. // SMB dispatch table
  191. //
  192. extern UCHAR SrvSmbIndexTable[];
  193. typedef struct {
  194. PSMB_PROCESSOR Func;
  195. #if DBG
  196. LPSTR Name;
  197. #endif
  198. } SRV_SMB_DISPATCH_TABLE;
  199. extern SRV_SMB_DISPATCH_TABLE SrvSmbDispatchTable[];
  200. //
  201. // SMB word count table.
  202. //
  203. extern SCHAR SrvSmbWordCount[];
  204. //
  205. // Device prefix strings.
  206. //
  207. extern UNICODE_STRING SrvCanonicalNamedPipePrefix;
  208. extern UNICODE_STRING SrvNamedPipeRootDirectory;
  209. extern UNICODE_STRING SrvMailslotRootDirectory;
  210. //
  211. // Transaction2 dispatch table
  212. //
  213. extern PSMB_TRANSACTION_PROCESSOR SrvTransaction2DispatchTable[];
  214. extern PSMB_TRANSACTION_PROCESSOR SrvNtTransactionDispatchTable[];
  215. extern SRV_STATISTICS SrvStatistics;
  216. #if SRVDBG_STATS || SRVDBG_STATS2
  217. extern SRV_STATISTICS_DEBUG SrvDbgStatistics;
  218. #endif
  219. //
  220. // Server environment information strings.
  221. //
  222. extern UNICODE_STRING SrvNativeOS;
  223. extern OEM_STRING SrvOemNativeOS;
  224. extern UNICODE_STRING SrvNativeLanMan;
  225. extern OEM_STRING SrvOemNativeLanMan;
  226. //
  227. // The following will be a permanent handle and device object pointer
  228. // to NPFS.
  229. //
  230. extern HANDLE SrvNamedPipeHandle;
  231. extern PDEVICE_OBJECT SrvNamedPipeDeviceObject;
  232. extern PFILE_OBJECT SrvNamedPipeFileObject;
  233. //
  234. // The following are used to converse with the Dfs driver
  235. //
  236. extern PFAST_IO_DEVICE_CONTROL SrvDfsFastIoDeviceControl;
  237. extern PDEVICE_OBJECT SrvDfsDeviceObject;
  238. extern PFILE_OBJECT SrvDfsFileObject;
  239. //
  240. // The following will be a permanent handle and device object pointer
  241. // to MSFS.
  242. //
  243. extern HANDLE SrvMailslotHandle;
  244. extern PDEVICE_OBJECT SrvMailslotDeviceObject;
  245. extern PFILE_OBJECT SrvMailslotFileObject;
  246. //
  247. // Flag indicating XACTSRV whether is active, and resource synchronizing
  248. // access to XACTSRV-related variabled.
  249. //
  250. extern BOOLEAN SrvXsActive;
  251. extern ERESOURCE SrvXsResource;
  252. //
  253. // Handle to the unnamed shared memory and communication port used for
  254. // communication between the server and XACTSRV.
  255. //
  256. extern HANDLE SrvXsSectionHandle;
  257. extern HANDLE SrvXsPortHandle;
  258. //
  259. // Pointers to control the unnamed shared memory for the XACTSRV LPC port.
  260. //
  261. extern PVOID SrvXsPortMemoryBase;
  262. extern LONG SrvXsPortMemoryDelta;
  263. extern PVOID SrvXsPortMemoryHeap;
  264. //
  265. // Pointer to heap header for the special XACTSRV shared-memory heap.
  266. //
  267. extern PVOID SrvXsHeap;
  268. //
  269. // Dispatch table for handling server API requests.
  270. //
  271. extern PAPI_PROCESSOR SrvApiDispatchTable[];
  272. //
  273. // Names for the various types of clients.
  274. //
  275. extern UNICODE_STRING SrvClientTypes[];
  276. //
  277. // All the resumable Enum APIs use ordered lists for context-free
  278. // resume. All data blocks in the server that correspond to return
  279. // information for Enum APIs are maintained in ordered lists.
  280. //
  281. extern SRV_LOCK SrvOrderedListLock;
  282. #if SRV_COMM_DEVICES
  283. extern ORDERED_LIST_HEAD SrvCommDeviceList;
  284. #endif
  285. extern ORDERED_LIST_HEAD SrvEndpointList;
  286. extern ORDERED_LIST_HEAD SrvRfcbList;
  287. extern ORDERED_LIST_HEAD SrvSessionList;
  288. extern ORDERED_LIST_HEAD SrvShareList;
  289. extern ORDERED_LIST_HEAD SrvTreeConnectList;
  290. //
  291. // To synchronize server shutdown with API requests handled in the
  292. // server FSD, we track the number of outstanding API requests. The
  293. // shutdown code waits until all APIs have been completed to start
  294. // termination.
  295. //
  296. // SrvApiRequestCount tracks the active APIs in the FSD.
  297. // SrvApiCompletionEvent is set by the last API to complete, and the
  298. // shutdown code waits on it if there are outstanding APIs.
  299. //
  300. extern ULONG SrvApiRequestCount;
  301. extern KEVENT SrvApiCompletionEvent;
  302. //
  303. // Security contexts required for mutual authentication.
  304. // SrvKerberosLsaHandle and SrvLmLsaHandle are credentials of the server
  305. // principal. They are used to validate incoming kerberos tickets.
  306. // SrvNullSessionToken is a cached token handle representing the null session.
  307. //
  308. extern CtxtHandle SrvLmLsaHandle;
  309. extern CtxtHandle SrvNullSessionToken;
  310. extern CtxtHandle SrvKerberosLsaHandle;
  311. extern BOOLEAN SrvHaveKerberos;
  312. //
  313. // Oplock break information.
  314. //
  315. extern LIST_ENTRY SrvWaitForOplockBreakList;
  316. extern SRV_LOCK SrvOplockBreakListLock;
  317. extern LIST_ENTRY SrvOplockBreaksInProgressList;
  318. //
  319. // The default server security quality of service.
  320. //
  321. extern SECURITY_QUALITY_OF_SERVICE SrvSecurityQOS;
  322. //
  323. // A BOOLEAN to indicate whether the server is paused. If paused, the
  324. // server will not accept new tree connections from non-admin users.
  325. //
  326. extern BOOLEAN SrvPaused;
  327. //
  328. // Alerting information.
  329. //
  330. extern SRV_ERROR_RECORD SrvErrorRecord;
  331. extern SRV_ERROR_RECORD SrvNetworkErrorRecord;
  332. extern BOOLEAN SrvDiskAlertRaised[26];
  333. //
  334. // Counts of the number of times pool allocations have failed because
  335. // the server was at its configured pool limit.
  336. //
  337. extern ULONG SrvNonPagedPoolLimitHitCount;
  338. extern ULONG SrvPagedPoolLimitHitCount;
  339. //
  340. // SrvOpenCount counts the number of active opens of the server device.
  341. // This is used at server shutdown time to determine whether the server
  342. // service should unload the driver.
  343. //
  344. extern ULONG SrvOpenCount;
  345. //
  346. // Counters for logging resource shortage events during a scavenger pass.
  347. //
  348. extern ULONG SrvOutOfFreeConnectionCount;
  349. extern ULONG SrvOutOfRawWorkItemCount;
  350. extern ULONG SrvFailedBlockingIoCount;
  351. //
  352. // Token source name passed to authentication package.
  353. //
  354. extern TOKEN_SOURCE SrvTokenSource;
  355. //
  356. // Current core search timeout time in seconds
  357. //
  358. extern ULONG SrvCoreSearchTimeout;
  359. //
  360. // SrvTimerList is a pool of timer/DPC structures available for use by
  361. // code that needs to start a timer.
  362. //
  363. extern SLIST_HEADER SrvTimerList;
  364. //
  365. // Name that should be displayed when doing a server alert.
  366. //
  367. extern PWSTR SrvAlertServiceName;
  368. //
  369. // Variable to store the number of tick counts for 5 seconds
  370. //
  371. extern ULONG SrvFiveSecondTickCount;
  372. #ifdef SRV_PNP_POWER
  373. //
  374. // Holds the notification handle which TDI gives us from TdiRegisterNotificationHandler()
  375. //
  376. extern HANDLE SrvTdiNotificationHandle;
  377. #endif
  378. //
  379. // Security descriptor granting Administrator READ access.
  380. // Used to see if a client has administrative privileges
  381. //
  382. extern SECURITY_DESCRIPTOR SrvAdminSecurityDescriptor;
  383. //
  384. // Flag indicating whether or not we need to filter extended characters
  385. // out of 8.3 names ourselves.
  386. //
  387. extern BOOLEAN SrvFilterExtendedCharsInPath;
  388. #endif // ndef _SRVDATA_