Source code of Windows XP (NT5)
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.

513 lines
11 KiB

  1. /*++
  2. Copyright (c) 1987-1996 Microsoft Corporation
  3. Module Name:
  4. lsrvdata.h
  5. Abstract:
  6. Netlogon service global variable external and definitions
  7. Author:
  8. Ported from Lan Man 2.0
  9. Revision History:
  10. 21-May-1991 (cliffv)
  11. Ported to NT. Converted to NT style.
  12. 02-Jan-1992 (madana)
  13. added support for builtin/multidomain replication.
  14. 07-May-1992 JohnRo
  15. Use net config helpers for NetLogon.
  16. --*/
  17. //
  18. // netlogon.c will #include this file with LSRVDATA_ALLOCATE defined.
  19. // That will cause each of these variables to be allocated.
  20. //
  21. // If we need to allocate data (i.e. LSRVDATA_ALLOCATE is defined) we
  22. // also want to allocate Guids, so define INITGUID. Also, reinclude
  23. // guiddef.h. Without guiddef.h reincluded, DEFINE_GUID will be resolved
  24. // from precompiled logonsrv.h that included this file with LSRVDATA_ALLOCATE
  25. // not defined causing only external definition of Guids. Reincluding
  26. // guiddef.h here forces definition of INITGUID to take effect.
  27. //
  28. #ifdef LSRVDATA_ALLOCATE
  29. #define EXTERN
  30. #define INITGUID
  31. #include <guiddef.h>
  32. #else
  33. #define EXTERN extern
  34. #ifdef INITGUID
  35. #undef INITGUID
  36. #endif
  37. #endif
  38. ///////////////////////////////////////////////////////////////////////////
  39. //
  40. // Modifiable Variables: these variables change over time.
  41. //
  42. ///////////////////////////////////////////////////////////////////////////
  43. //
  44. // Global NetStatus of the Netlogon service
  45. //
  46. EXTERN SERVICE_STATUS NlGlobalServiceStatus;
  47. #ifdef _DC_NETLOGON
  48. EXTERN SERVICE_STATUS_HANDLE NlGlobalServiceHandle;
  49. #endif // _DC_NETLOGON
  50. ///////////////////////////////////////////////////////////////////////////
  51. //
  52. // Read-only variables after initialization.
  53. //
  54. ///////////////////////////////////////////////////////////////////////////
  55. //
  56. // Computername of this computer.
  57. //
  58. EXTERN LPWSTR NlGlobalUnicodeComputerName;
  59. //
  60. // True if this is a workstation or member server.
  61. //
  62. EXTERN BOOL NlGlobalMemberWorkstation;
  63. #ifdef _DC_NETLOGON
  64. //
  65. // Handle to wait on for mailslot reads
  66. //
  67. EXTERN HANDLE NlGlobalMailslotHandle;
  68. #endif // _DC_NETLOGON
  69. //
  70. // Flag to indicate when RPC has been started
  71. //
  72. EXTERN BOOL NlGlobalRpcServerStarted;
  73. EXTERN BOOL NlGlobalTcpIpRpcServerStarted;
  74. EXTERN BOOL NlGlobalServerSupportsAuthRpc;
  75. //
  76. // Service Termination event.
  77. //
  78. EXTERN HANDLE NlGlobalTerminateEvent;
  79. EXTERN BOOL NlGlobalTerminate;
  80. EXTERN BOOL NlGlobalUnloadNetlogon;
  81. //
  82. // Flags indicating if netlogon.dll was unloaded.
  83. //
  84. EXTERN BOOL NlGlobalNetlogonUnloaded; // Used for one run of netlogon service
  85. EXTERN BOOL NlGlobalChangeLogDllUnloaded; // Used for life of netlogon.dll
  86. //
  87. // Service Started Event
  88. //
  89. EXTERN HANDLE NlGlobalStartedEvent;
  90. //
  91. // Timers need attention event.
  92. //
  93. EXTERN HANDLE NlGlobalTimerEvent;
  94. //
  95. // Command line arguments.
  96. //
  97. EXTERN NETLOGON_PARAMETERS NlGlobalParameters;
  98. EXTERN CRITICAL_SECTION NlGlobalParametersCritSect;
  99. EXTERN ULONG NlGlobalMaxConcurrentApi;
  100. //
  101. // Boolean to indicate weather the DC info left by
  102. // join has been read. If the info exists, the first
  103. // DC discovery for the primary domain will use the
  104. // info to return the DC that was used by join. That
  105. // DC is guaranteed to have the right machine pwd.
  106. EXTERN BOOL NlGlobalJoinLogicDone;
  107. //
  108. // Global Flag used to partially pause the netlogon service until RPCSS is started.
  109. //
  110. EXTERN BOOL NlGlobalPartialDisable;
  111. //
  112. // TRUE if the DS is being back synced
  113. //
  114. EXTERN BOOL NlGlobalDsPaused;
  115. EXTERN HANDLE NlGlobalDsPausedEvent;
  116. EXTERN HANDLE NlGlobalDsPausedWaitHandle;
  117. //
  118. // Global variables required for scavenger thread.
  119. //
  120. EXTERN TIMER NlGlobalScavengerTimer;
  121. EXTERN CRITICAL_SECTION NlGlobalScavengerCritSect;
  122. #ifdef _DC_NETLOGON
  123. EXTERN BOOL NlGlobalDcScavengerIsRunning;
  124. EXTERN WORKER_ITEM NlGlobalDcScavengerWorkItem;
  125. #endif // _DC_NETLOGON
  126. //
  127. // Global list of outstanding challenge request/responses
  128. //
  129. EXTERN CRITICAL_SECTION NlGlobalChallengeCritSect;
  130. EXTERN LIST_ENTRY NlGlobalChallengeList;
  131. EXTERN ULONG NlGlobalChallengeCount;
  132. //
  133. // Variables for cordinating MSV threads running in netlogon.dll
  134. //
  135. EXTERN CRITICAL_SECTION NlGlobalMsvCritSect;
  136. EXTERN HANDLE NlGlobalMsvTerminateEvent;
  137. EXTERN BOOL NlGlobalMsvEnabled;
  138. EXTERN ULONG NlGlobalMsvThreadCount;
  139. //
  140. // For workstations and non-DC servers,
  141. // maintain a list of domains trusted by our primary domain.
  142. //
  143. // Access serialized by NlGlobalDcDiscoveryCritSect
  144. //
  145. EXTERN PTRUSTED_DOMAIN NlGlobalTrustedDomainList;
  146. EXTERN DWORD NlGlobalTrustedDomainCount;
  147. EXTERN LARGE_INTEGER NlGlobalTrustedDomainListTime;
  148. //
  149. // Serialize DC Discovery activities
  150. //
  151. EXTERN CRITICAL_SECTION NlGlobalDcDiscoveryCritSect;
  152. //
  153. // Timer for timing out API calls to trusted domains
  154. //
  155. // Serialized using DomainInfo->DomTrustListCritSect.
  156. //
  157. EXTERN TIMER NlGlobalApiTimer;
  158. EXTERN DWORD NlGlobalBindingHandleCount;
  159. //
  160. // For BDC, this is the session used to communicate with the PDC.
  161. // For a workstation, this is the session used to communicate with a DC.
  162. //
  163. EXTERN PCLIENT_SESSION NlGlobalClientSession;
  164. //
  165. // This is a pointer to the DomainInfo structure for the primary domain.
  166. //
  167. EXTERN PDOMAIN_INFO NlGlobalDomainInfo;
  168. EXTERN ULONG NlGlobalServicedDomainCount; // This includes non-domain NCs
  169. EXTERN CRITICAL_SECTION NlGlobalDomainCritSect;
  170. //
  171. // Global DB Info array
  172. //
  173. EXTERN DB_INFO NlGlobalDBInfoArray[NUM_DBS];
  174. //
  175. // Critical section serializing startup and stopping of the replicator thread.
  176. //
  177. EXTERN CRITICAL_SECTION NlGlobalReplicatorCritSect;
  178. //
  179. // List of all BDC's the PDC has sent a pulse to.
  180. //
  181. EXTERN LIST_ENTRY NlGlobalBdcServerSessionList;
  182. EXTERN ULONG NlGlobalBdcServerSessionCount;
  183. EXTERN LIST_ENTRY NlGlobalPendingBdcList;
  184. EXTERN ULONG NlGlobalPendingBdcCount;
  185. EXTERN TIMER NlGlobalPendingBdcTimer;
  186. EXTERN LIST_ENTRY NlGlobalBdcServerSessionList;
  187. EXTERN ULONG NlGlobalBdcServerSessionCount;
  188. //
  189. // Flag indicating that this is a PDC that's enabled to do replication to
  190. // a NT 3.X/4 BDC.
  191. // (Serialized by NlGlobalReplicatorCritSect)
  192. //
  193. BOOL NlGlobalPdcDoReplication;
  194. //
  195. // List of transports clients might connect to
  196. //
  197. EXTERN ULONG NlGlobalIpTransportCount;
  198. EXTERN LIST_ENTRY NlGlobalTransportList;
  199. EXTERN CRITICAL_SECTION NlGlobalTransportCritSect;
  200. //
  201. // List of IP addresses from Winsock.
  202. //
  203. EXTERN SOCKET NlGlobalWinsockPnpSocket;
  204. EXTERN HANDLE NlGlobalWinsockPnpEvent;
  205. EXTERN LPSOCKET_ADDRESS_LIST NlGlobalWinsockPnpAddresses;
  206. EXTERN ULONG NlGlobalWinsockPnpAddressSize;
  207. //
  208. // List of all DNS names registered.
  209. //
  210. EXTERN LIST_ENTRY NlGlobalDnsList;
  211. EXTERN CRITICAL_SECTION NlGlobalDnsCritSect;
  212. EXTERN BOOLEAN NlGlobalWinSockInitialized;
  213. EXTERN TIMER NlGlobalDnsScavengerTimer;
  214. EXTERN BOOL NlGlobalDnsScavengerIsRunning;
  215. EXTERN WORKER_ITEM NlGlobalDnsScavengerWorkItem;
  216. //
  217. // Name of the tree this machine is in.
  218. //
  219. // Access serialized by NlGlobalDnsForestNameCritSect.
  220. //
  221. EXTERN CRITICAL_SECTION NlGlobalDnsForestNameCritSect;
  222. EXTERN LPWSTR NlGlobalUnicodeDnsForestName;
  223. EXTERN UNICODE_STRING NlGlobalUnicodeDnsForestNameString;
  224. EXTERN ULONG NlGlobalUnicodeDnsForestNameLen;
  225. EXTERN LPSTR NlGlobalUtf8DnsForestName;
  226. EXTERN LPSTR NlGlobalUtf8DnsForestNameAlias;
  227. //
  228. // Critical section to protect access to covered site lists
  229. //
  230. EXTERN CRITICAL_SECTION NlGlobalSiteCritSect;
  231. ///////////////////////////////////////////////////////////////////////////
  232. //
  233. // Changelog Variables
  234. //
  235. ///////////////////////////////////////////////////////////////////////////
  236. //
  237. // To serialize change log access
  238. //
  239. EXTERN CRITICAL_SECTION NlGlobalChangeLogCritSect;
  240. //
  241. // Amount SAM/LSA increments serial number by on promotion.
  242. //
  243. EXTERN LARGE_INTEGER NlGlobalChangeLogPromotionIncrement;
  244. EXTERN LONG NlGlobalChangeLogPromotionMask;
  245. //
  246. // Netlogon started flag, used by the changelog to determine the
  247. // netlogon service is successfully started and initialization
  248. // completed.
  249. //
  250. EXTERN _CHANGELOG_NETLOGON_STATE NlGlobalChangeLogNetlogonState;
  251. //
  252. // Event to indicate that something interesting is being logged to the
  253. // change log. The booleans below (protected by NlGlobalChangeLogCritSect)
  254. // indicate the actual interesting event.
  255. //
  256. EXTERN HANDLE NlGlobalChangeLogEvent;
  257. //
  258. // Indicates that a "replicate immediately" event has happened.
  259. //
  260. EXTERN BOOL NlGlobalChangeLogReplicateImmediately;
  261. //
  262. // Event to indicate that the trust data object has been updated.
  263. //
  264. EXTERN HANDLE NlGlobalTrustInfoUpToDateEvent;
  265. //
  266. // List of MachineAccount changes
  267. //
  268. EXTERN LIST_ENTRY NlGlobalChangeLogNotifications;
  269. //
  270. // Sid of the Builtin domain
  271. //
  272. EXTERN PSID NlGlobalChangeLogBuiltinDomainSid;
  273. //
  274. // A Zero GUID.
  275. //
  276. EXTERN GUID NlGlobalZeroGuid;
  277. //
  278. // The change log is a log of ALL changes made to the SAM/LSA databases. The
  279. // change log is maintained in serial number order.
  280. //
  281. EXTERN CHANGELOG_DESCRIPTOR NlGlobalChangeLogDesc;
  282. EXTERN CHANGELOG_DESCRIPTOR NlGlobalTempChangeLogDesc;
  283. EXTERN WCHAR NlGlobalChangeLogFilePrefix[MAX_PATH+1]; // Changelog file name. (w/o postfix)
  284. //
  285. // Bits describing services whether the DS, KDC, or time service are actually
  286. // running.
  287. //
  288. EXTERN DWORD NlGlobalChangeLogServiceBits;
  289. EXTERN BOOLEAN NlGlobalDsRunningUnknown;
  290. //
  291. // Role of the machine from the change log's perspective.
  292. //
  293. EXTERN CHANGELOG_ROLE NlGlobalChangeLogRole;
  294. //
  295. // The name of the site this machine is in
  296. //
  297. EXTERN LPWSTR NlGlobalUnicodeSiteName;
  298. EXTERN LPSTR NlGlobalUtf8SiteName;
  299. //
  300. // The time when the site name was set last time
  301. //
  302. EXTERN LARGE_INTEGER NlGlobalSiteNameSetTime;
  303. //
  304. // The last time the event log for clients with
  305. // no site was output. Access serialized by
  306. // NlGlobalSiteCritSect
  307. //
  308. EXTERN LARGE_INTEGER NlGlobalNoClientSiteEventTime;
  309. //
  310. // The number of times a client with no site was
  311. // detected during the last event log timeout period.
  312. // Access serialized by NlGlobalSiteCritSect
  313. //
  314. EXTERN ULONG NlGlobalNoClientSiteCount;
  315. //
  316. // The GUID of the DSA on this machine.
  317. //
  318. EXTERN GUID NlGlobalDsaGuid;
  319. //
  320. // Boolean indicating whether the DC demotion is in progress
  321. //
  322. EXTERN BOOLEAN NlGlobalDcDemotionInProgress;
  323. //
  324. // Handle to Cryptographic Service Provider
  325. //
  326. EXTERN HCRYPTPROV NlGlobalCryptProvider;
  327. //
  328. // Netlogon security package variables
  329. //
  330. CRITICAL_SECTION NlGlobalSecPkgCritSect;
  331. //
  332. // Handle to duplicate event log routines
  333. //
  334. HANDLE NlGlobalEventlogHandle;
  335. //
  336. // Handle to dynamically loaded ntdsa.dll
  337. //
  338. HANDLE NlGlobalNtDsaHandle;
  339. HANDLE NlGlobalIsmDllHandle;
  340. HANDLE NlGlobalDsApiDllHandle;
  341. //
  342. // Pointers to dynamically linked ntdsa.dll routines
  343. //
  344. PCrackSingleName NlGlobalpCrackSingleName;
  345. PGetConfigurationName NlGlobalpGetConfigurationName;
  346. PGetConfigurationNamesList NlGlobalpGetConfigurationNamesList;
  347. PGetDnsRootAlias NlGlobalpGetDnsRootAlias;
  348. PDsGetServersAndSitesForNetLogon NlGlobalpDsGetServersAndSitesForNetLogon;
  349. PDsFreeServersAndSitesForNetLogon NlGlobalpDsFreeServersAndSitesForNetLogon;
  350. PDsBindW NlGlobalpDsBindW;
  351. PDsUnBindW NlGlobalpDsUnBindW;
  352. //
  353. // WMI tracing handles and GUIDs
  354. //
  355. EXTERN ULONG NlpEventTraceFlag;
  356. EXTERN TRACEHANDLE NlpTraceRegistrationHandle;
  357. EXTERN TRACEHANDLE NlpTraceLoggerHandle;
  358. // This is the control Guid for the group of Guids traced below
  359. DEFINE_GUID ( /* f33959b4-dbec-11d2-895b-00c04f79ab69 */
  360. NlpControlGuid,
  361. 0xf33959b4,
  362. 0xdbec,
  363. 0x11d2,
  364. 0x89, 0x5b, 0x00, 0xc0, 0x4f, 0x79, 0xab, 0x69
  365. );
  366. DEFINE_GUID ( /* 393da8c0-dbed-11d2-895b-00c04f79ab69 */
  367. NlpServerAuthGuid,
  368. 0x393da8c0,
  369. 0xdbed,
  370. 0x11d2,
  371. 0x89, 0x5b, 0x00, 0xc0, 0x4f, 0x79, 0xab, 0x69
  372. );
  373. DEFINE_GUID ( /* 63dbb180-dbed-11d2-895b-00c04f79ab69 */
  374. NlpSecureChannelSetupGuid,
  375. 0x63dbb180,
  376. 0xdbed,
  377. 0x11d2,
  378. 0x89, 0x5b, 0x00, 0xc0, 0x4f, 0x79, 0xab, 0x69
  379. );
  380. #undef EXTERN