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.

523 lines
12 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. // This #define allows netlogon instrumentation for rogue authorization info
  96. // WE MUST NOT UNDER ANY CIRCUMSTANCES SHIP WITH THIS ACTIVE
  97. //
  98. // #define ROGUE_DC
  99. #ifdef ROGUE_DC
  100. EXTERN HKEY NlGlobalRogueKey;
  101. #endif
  102. //
  103. // Command line arguments.
  104. //
  105. EXTERN NETLOGON_PARAMETERS NlGlobalParameters;
  106. EXTERN CRITICAL_SECTION NlGlobalParametersCritSect;
  107. EXTERN ULONG NlGlobalMaxConcurrentApi;
  108. //
  109. // Boolean to indicate weather the DC info left by
  110. // join has been read. If the info exists, the first
  111. // DC discovery for the primary domain will use the
  112. // info to return the DC that was used by join. That
  113. // DC is guaranteed to have the right machine pwd.
  114. EXTERN BOOL NlGlobalJoinLogicDone;
  115. //
  116. // Global Flag used to partially pause the netlogon service until RPCSS is started.
  117. //
  118. EXTERN BOOL NlGlobalPartialDisable;
  119. //
  120. // TRUE if the DS is being back synced
  121. //
  122. EXTERN BOOL NlGlobalDsPaused;
  123. EXTERN HANDLE NlGlobalDsPausedEvent;
  124. EXTERN HANDLE NlGlobalDsPausedWaitHandle;
  125. //
  126. // Global variables required for scavenger thread.
  127. //
  128. EXTERN TIMER NlGlobalScavengerTimer;
  129. EXTERN CRITICAL_SECTION NlGlobalScavengerCritSect;
  130. #ifdef _DC_NETLOGON
  131. EXTERN BOOL NlGlobalDcScavengerIsRunning;
  132. EXTERN WORKER_ITEM NlGlobalDcScavengerWorkItem;
  133. #endif // _DC_NETLOGON
  134. //
  135. // Global list of outstanding challenge request/responses
  136. //
  137. EXTERN CRITICAL_SECTION NlGlobalChallengeCritSect;
  138. EXTERN LIST_ENTRY NlGlobalChallengeList;
  139. EXTERN ULONG NlGlobalChallengeCount;
  140. //
  141. // Variables for cordinating MSV threads running in netlogon.dll
  142. //
  143. EXTERN CRITICAL_SECTION NlGlobalMsvCritSect;
  144. EXTERN HANDLE NlGlobalMsvTerminateEvent;
  145. EXTERN BOOL NlGlobalMsvEnabled;
  146. EXTERN ULONG NlGlobalMsvThreadCount;
  147. //
  148. // For workstations and non-DC servers,
  149. // maintain a list of domains trusted by our primary domain.
  150. //
  151. // Access serialized by NlGlobalDcDiscoveryCritSect
  152. //
  153. EXTERN PTRUSTED_DOMAIN NlGlobalTrustedDomainList;
  154. EXTERN DWORD NlGlobalTrustedDomainCount;
  155. EXTERN LARGE_INTEGER NlGlobalTrustedDomainListTime;
  156. //
  157. // Serialize DC Discovery activities
  158. //
  159. EXTERN CRITICAL_SECTION NlGlobalDcDiscoveryCritSect;
  160. //
  161. // Timer for timing out API calls to trusted domains
  162. //
  163. // Serialized using DomainInfo->DomTrustListCritSect.
  164. //
  165. EXTERN TIMER NlGlobalApiTimer;
  166. EXTERN DWORD NlGlobalBindingHandleCount;
  167. //
  168. // For BDC, this is the session used to communicate with the PDC.
  169. // For a workstation, this is the session used to communicate with a DC.
  170. //
  171. EXTERN PCLIENT_SESSION NlGlobalClientSession;
  172. //
  173. // This is a pointer to the DomainInfo structure for the primary domain.
  174. //
  175. EXTERN PDOMAIN_INFO NlGlobalDomainInfo;
  176. EXTERN ULONG NlGlobalServicedDomainCount; // This includes non-domain NCs
  177. EXTERN CRITICAL_SECTION NlGlobalDomainCritSect;
  178. //
  179. // Global DB Info array
  180. //
  181. EXTERN DB_INFO NlGlobalDBInfoArray[NUM_DBS];
  182. //
  183. // Critical section serializing startup and stopping of the replicator thread.
  184. //
  185. EXTERN CRITICAL_SECTION NlGlobalReplicatorCritSect;
  186. //
  187. // List of all BDC's the PDC has sent a pulse to.
  188. //
  189. EXTERN LIST_ENTRY NlGlobalBdcServerSessionList;
  190. EXTERN ULONG NlGlobalBdcServerSessionCount;
  191. EXTERN LIST_ENTRY NlGlobalPendingBdcList;
  192. EXTERN ULONG NlGlobalPendingBdcCount;
  193. EXTERN TIMER NlGlobalPendingBdcTimer;
  194. EXTERN LIST_ENTRY NlGlobalBdcServerSessionList;
  195. EXTERN ULONG NlGlobalBdcServerSessionCount;
  196. EXTERN BOOL NlGlobalPrimaryAnnouncementIsRunning;
  197. //
  198. // Flag indicating that this is a PDC that's enabled to do replication to
  199. // a NT 3.X/4 BDC.
  200. // (Serialized by NlGlobalReplicatorCritSect)
  201. //
  202. BOOL NlGlobalPdcDoReplication;
  203. //
  204. // List of transports clients might connect to
  205. //
  206. EXTERN ULONG NlGlobalIpTransportCount;
  207. EXTERN LIST_ENTRY NlGlobalTransportList;
  208. EXTERN CRITICAL_SECTION NlGlobalTransportCritSect;
  209. //
  210. // List of IP addresses from Winsock.
  211. //
  212. EXTERN SOCKET NlGlobalWinsockPnpSocket;
  213. EXTERN HANDLE NlGlobalWinsockPnpEvent;
  214. EXTERN LPSOCKET_ADDRESS_LIST NlGlobalWinsockPnpAddresses;
  215. EXTERN ULONG NlGlobalWinsockPnpAddressSize;
  216. //
  217. // List of all DNS names registered.
  218. //
  219. EXTERN LIST_ENTRY NlGlobalDnsList;
  220. EXTERN CRITICAL_SECTION NlGlobalDnsCritSect;
  221. EXTERN BOOLEAN NlGlobalWinSockInitialized;
  222. EXTERN TIMER NlGlobalDnsScavengerTimer;
  223. //
  224. // Name of the tree this machine is in.
  225. //
  226. // Access serialized by NlGlobalDnsForestNameCritSect.
  227. //
  228. EXTERN CRITICAL_SECTION NlGlobalDnsForestNameCritSect;
  229. EXTERN LPWSTR NlGlobalUnicodeDnsForestName;
  230. EXTERN UNICODE_STRING NlGlobalUnicodeDnsForestNameString;
  231. EXTERN ULONG NlGlobalUnicodeDnsForestNameLen;
  232. EXTERN LPSTR NlGlobalUtf8DnsForestName;
  233. EXTERN LPSTR NlGlobalUtf8DnsForestNameAlias;
  234. //
  235. // Critical section to protect access to covered site lists
  236. //
  237. EXTERN CRITICAL_SECTION NlGlobalSiteCritSect;
  238. ///////////////////////////////////////////////////////////////////////////
  239. //
  240. // Changelog Variables
  241. //
  242. ///////////////////////////////////////////////////////////////////////////
  243. //
  244. // To serialize change log access
  245. //
  246. EXTERN CRITICAL_SECTION NlGlobalChangeLogCritSect;
  247. //
  248. // Amount SAM/LSA increments serial number by on promotion.
  249. //
  250. EXTERN LARGE_INTEGER NlGlobalChangeLogPromotionIncrement;
  251. EXTERN LONG NlGlobalChangeLogPromotionMask;
  252. //
  253. // Netlogon started flag, used by the changelog to determine the
  254. // netlogon service is successfully started and initialization
  255. // completed.
  256. //
  257. EXTERN _CHANGELOG_NETLOGON_STATE NlGlobalChangeLogNetlogonState;
  258. //
  259. // Event to indicate that something interesting is being logged to the
  260. // change log. The booleans below (protected by NlGlobalChangeLogCritSect)
  261. // indicate the actual interesting event.
  262. //
  263. EXTERN HANDLE NlGlobalChangeLogEvent;
  264. //
  265. // Indicates that a "replicate immediately" event has happened.
  266. //
  267. EXTERN BOOL NlGlobalChangeLogReplicateImmediately;
  268. //
  269. // Event to indicate that the trust data object has been updated.
  270. //
  271. EXTERN HANDLE NlGlobalTrustInfoUpToDateEvent;
  272. //
  273. // List of MachineAccount changes
  274. //
  275. EXTERN LIST_ENTRY NlGlobalChangeLogNotifications;
  276. //
  277. // Sid of the Builtin domain
  278. //
  279. EXTERN PSID NlGlobalChangeLogBuiltinDomainSid;
  280. //
  281. // A Zero GUID.
  282. //
  283. EXTERN GUID NlGlobalZeroGuid;
  284. //
  285. // The change log is a log of ALL changes made to the SAM/LSA databases. The
  286. // change log is maintained in serial number order.
  287. //
  288. EXTERN CHANGELOG_DESCRIPTOR NlGlobalChangeLogDesc;
  289. EXTERN CHANGELOG_DESCRIPTOR NlGlobalTempChangeLogDesc;
  290. EXTERN WCHAR NlGlobalChangeLogFilePrefix[MAX_PATH+1]; // Changelog file name. (w/o postfix)
  291. //
  292. // Bits describing services whether the DS, KDC, or time service are actually
  293. // running.
  294. //
  295. EXTERN DWORD NlGlobalChangeLogServiceBits;
  296. EXTERN BOOLEAN NlGlobalDsRunningUnknown;
  297. //
  298. // Role of the machine from the change log's perspective.
  299. //
  300. EXTERN CHANGELOG_ROLE NlGlobalChangeLogRole;
  301. //
  302. // The name of the site this machine is in
  303. //
  304. EXTERN LPWSTR NlGlobalUnicodeSiteName;
  305. EXTERN LPSTR NlGlobalUtf8SiteName;
  306. //
  307. // The time when the site name was set last time
  308. //
  309. EXTERN LARGE_INTEGER NlGlobalSiteNameSetTime;
  310. //
  311. // The last time the event log for clients with
  312. // no site was output. Access serialized by
  313. // NlGlobalSiteCritSect
  314. //
  315. EXTERN LARGE_INTEGER NlGlobalNoClientSiteEventTime;
  316. //
  317. // The number of times a client with no site was
  318. // detected during the last event log timeout period.
  319. // Access serialized by NlGlobalSiteCritSect
  320. //
  321. EXTERN ULONG NlGlobalNoClientSiteCount;
  322. //
  323. // The GUID of the DSA on this machine.
  324. //
  325. EXTERN GUID NlGlobalDsaGuid;
  326. //
  327. // Boolean indicating whether the DC demotion is in progress
  328. //
  329. EXTERN BOOLEAN NlGlobalDcDemotionInProgress;
  330. //
  331. // Handle to Cryptographic Service Provider
  332. //
  333. EXTERN HCRYPTPROV NlGlobalCryptProvider;
  334. //
  335. // Netlogon security package variables
  336. //
  337. CRITICAL_SECTION NlGlobalSecPkgCritSect;
  338. //
  339. // Handle to duplicate event log routines
  340. //
  341. HANDLE NlGlobalEventlogHandle;
  342. //
  343. // Handle to dynamically loaded ntdsa.dll
  344. //
  345. HANDLE NlGlobalNtDsaHandle;
  346. HANDLE NlGlobalIsmDllHandle;
  347. HANDLE NlGlobalDsApiDllHandle;
  348. //
  349. // Pointers to dynamically linked ntdsa.dll routines
  350. //
  351. PCrackSingleName NlGlobalpCrackSingleName;
  352. PGetConfigurationName NlGlobalpGetConfigurationName;
  353. PGetConfigurationNamesList NlGlobalpGetConfigurationNamesList;
  354. PGetDnsRootAlias NlGlobalpGetDnsRootAlias;
  355. PDsGetServersAndSitesForNetLogon NlGlobalpDsGetServersAndSitesForNetLogon;
  356. PDsFreeServersAndSitesForNetLogon NlGlobalpDsFreeServersAndSitesForNetLogon;
  357. PDsBindW NlGlobalpDsBindW;
  358. PDsUnBindW NlGlobalpDsUnBindW;
  359. PIsMangledRDNExternal NlGlobalpIsMangledRDNExternal;
  360. //
  361. // WMI tracing handles and GUIDs
  362. //
  363. EXTERN ULONG NlpEventTraceFlag;
  364. EXTERN TRACEHANDLE NlpTraceRegistrationHandle;
  365. EXTERN TRACEHANDLE NlpTraceLoggerHandle;
  366. // This is the control Guid for the group of Guids traced below
  367. DEFINE_GUID ( /* f33959b4-dbec-11d2-895b-00c04f79ab69 */
  368. NlpControlGuid,
  369. 0xf33959b4,
  370. 0xdbec,
  371. 0x11d2,
  372. 0x89, 0x5b, 0x00, 0xc0, 0x4f, 0x79, 0xab, 0x69
  373. );
  374. DEFINE_GUID ( /* 393da8c0-dbed-11d2-895b-00c04f79ab69 */
  375. NlpServerAuthGuid,
  376. 0x393da8c0,
  377. 0xdbed,
  378. 0x11d2,
  379. 0x89, 0x5b, 0x00, 0xc0, 0x4f, 0x79, 0xab, 0x69
  380. );
  381. DEFINE_GUID ( /* 63dbb180-dbed-11d2-895b-00c04f79ab69 */
  382. NlpSecureChannelSetupGuid,
  383. 0x63dbb180,
  384. 0xdbed,
  385. 0x11d2,
  386. 0x89, 0x5b, 0x00, 0xc0, 0x4f, 0x79, 0xab, 0x69
  387. );
  388. #undef EXTERN