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.

929 lines
28 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. registry.h
  5. Abstract:
  6. Domain Name System (DNS) API
  7. Registry routines header.
  8. Author:
  9. Jim Gilroy (jamesg) March, 2000
  10. Revision History:
  11. --*/
  12. #ifndef _DNSREGISTRY_INCLUDED_
  13. #define _DNSREGISTRY_INCLUDED_
  14. //
  15. // Registry keys
  16. //
  17. #define TCPIP_PARAMETERS_KEY L"System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
  18. #define TCPIP_RAS_KEY L"System\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Transient"
  19. #define TCPIP_INTERFACES_KEY L"System\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"
  20. #define DNS_POLICY_KEY L"Software\\Policies\\Microsoft\\Windows NT\\DnsClient"
  21. #define DNS_POLICY_WIN2K_KEY L"Software\\Policies\\Microsoft\\System\\DNSClient"
  22. //#define DNS_POLICY_INTERFACES_KEY L"Software\\Policies\\Microsoft\\Windows NT\\DNS Client\\Interfaces"
  23. #define POLICY_INTERFACES_SUBKEY L"Interfaces"
  24. #define DNS_CLIENT_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\DNSClient"
  25. #define DNS_CACHE_KEY L"System\\CurrentControlSet\\Services\\DnsCache\\Parameters"
  26. #define DNS_SERVER_KEY L"System\\CurrentControlSet\\Services\\DNS"
  27. #define NT_SETUP_MODE_KEY L"System\\Setup"
  28. //
  29. // Registry values
  30. //
  31. // note: _KEY appended on SEARCH_LIST_KEY to avoid conflicting
  32. // with structure name -- don't remove
  33. //
  34. #define HOST_NAME L"Hostname"
  35. #define DOMAIN_NAME L"Domain"
  36. #define DHCP_DOMAIN_NAME L"DhcpDomain"
  37. #define ADAPTER_DOMAIN_NAME L"AdapterDomainName"
  38. #define PRIMARY_DOMAIN_NAME L"PrimaryDomainName"
  39. #define PRIMARY_SUFFIX L"PrimaryDNSSuffix"
  40. #define ALTERNATE_NAMES L"AlternateComputerNames"
  41. #define DNS_SERVERS L"NameServer"
  42. #define SEARCH_LIST_KEY L"SearchList"
  43. #define UPDATE_ZONE_EXCLUSIONS L"UpdateZoneExclusions"
  44. // Query
  45. #define QUERY_ADAPTER_NAME L"QueryAdapterName"
  46. #define USE_DOMAIN_NAME_DEVOLUTION L"UseDomainNameDevolution"
  47. #define PRIORITIZE_RECORD_DATA L"PrioritizeRecordData"
  48. #define ALLOW_UNQUALIFIED_QUERY L"AllowUnqualifiedQuery"
  49. #define APPEND_TO_MULTI_LABEL_NAME L"AppendToMultiLabelName"
  50. #define SCREEN_BAD_TLDS L"ScreenBadTlds"
  51. #define SCREEN_UNREACHABLE_SERVERS L"ScreenUnreachableServers"
  52. #define FILTER_CLUSTER_IP L"FilterClusterIp"
  53. #define WAIT_FOR_NAME_ERROR_ON_ALL L"WaitForNameErrorOnAll"
  54. #define USE_EDNS L"UseEdns"
  55. #define QUERY_IP_MATCHING L"QueryIpMatching"
  56. // Update
  57. #define REGISTRATION_ENABLED L"RegistrationEnabled"
  58. #define REGISTER_PRIMARY_NAME L"RegisterPrimaryName"
  59. #define REGISTER_ADAPTER_NAME L"RegisterAdapterName"
  60. #define REGISTER_REVERSE_LOOKUP L"RegisterReverseLookup"
  61. #define REGISTER_WAN_ADAPTERS L"RegisterWanAdapters"
  62. #define REGISTRATION_OVERWRITES_IN_CONFLICT L"RegistrationOverwritesInConflict"
  63. #define REGISTRATION_TTL L"RegistrationTtl"
  64. #define REGISTRATION_REFRESH_INTERVAL L"RegistrationRefreshInterval"
  65. #define REGISTRATION_MAX_ADDRESS_COUNT L"RegistrationMaxAddressCount"
  66. #define UPDATE_SECURITY_LEVEL L"UpdateSecurityLevel"
  67. #define UPDATE_ZONE_EXCLUDE_FILE L"UpdateZoneExcludeFile"
  68. #define UPDATE_TOP_LEVEL_DOMAINS L"UpdateTopLevelDomainZones"
  69. // Backcompat
  70. #define DISABLE_ADAPTER_DOMAIN_NAME L"DisableAdapterDomainName"
  71. #define DISABLE_DYNAMIC_UPDATE L"DisableDynamicUpdate"
  72. #define ENABLE_ADAPTER_DOMAIN_NAME_REGISTRATION L"EnableAdapterDomainNameRegistration"
  73. #define DISABLE_REVERSE_ADDRESS_REGISTRATIONS L"DisableReverseAddressRegistrations"
  74. #define DISABLE_WAN_DYNAMIC_UPDATE L"DisableWanDynamicUpdate"
  75. #define ENABLE_WAN_UPDATE_EVENT_LOG L"EnableWanDynamicUpdateEventLog"
  76. #define DISABLE_REPLACE_ADDRESSES_IN_CONFLICTS L"DisableReplaceAddressesInConflicts"
  77. #define DEFAULT_REGISTRATION_TTL L"DefaultRegistrationTTL"
  78. #define DEFAULT_REGISTRATION_REFRESH_INTERVAL L"DefaultRegistrationRefreshInterval"
  79. #define MAX_NUMBER_OF_ADDRESSES_TO_REGISTER L"MaxNumberOfAddressesToRegister"
  80. // Micellaneous
  81. #define NT_SETUP_MODE L"SystemSetupInProgress"
  82. #define DNS_TEST_MODE L"DnsTest"
  83. #define REMOTE_DNS_RESOLVER L"RemoteDnsResolver"
  84. // Cache
  85. #define MAX_CACHE_SIZE L"MaxCacheSize"
  86. #define MAX_CACHE_TTL L"MaxCacheTtl"
  87. #define MAX_NEGATIVE_CACHE_TTL L"MaxNegativeCacheTtl"
  88. #define ADAPTER_TIMEOUT_LIMIT L"AdapterTimeoutLimit"
  89. #define SERVER_PRIORITY_TIME_LIMIT L"ServerPriorityTimeLimit"
  90. #define MAX_CACHED_SOCKETS L"MaxCachedSockets"
  91. #define MULTICAST_LISTEN_LEVEL L"MulticastListenLevel"
  92. #define MULTICAST_SEND_LEVEL L"MulticastSendLevel"
  93. // DHCP client registrations
  94. #define DHCP_REGISTERED_HOST_NAME L"HostName"
  95. #define DHCP_REGISTERED_DOMAIN_NAME L"DomainName"
  96. #define DHCP_SENT_UPDATE_TO_IP L"SentUpdateToIp"
  97. #define DHCP_SENT_PRI_UPDATE_TO_IP L"SentPriUpdateToIp"
  98. #define DHCP_REGISTERED_TTL L"RegisteredTTL"
  99. #define DHCP_REGISTERED_FLAGS L"RegisteredFlags"
  100. #define DHCP_REGISTERED_SINCE_BOOT L"RegisteredSinceBoot"
  101. #define DHCP_DNS_SERVER_ADDRS L"DNSServerAddresses"
  102. #define DHCP_DNS_SERVER_ADDRS_COUNT L"DNSServerAddressCount"
  103. #define DHCP_REGISTERED_ADDRS L"RegisteredAddresses"
  104. #define DHCP_REGISTERED_ADDRS_COUNT L"RegisteredAddressCount"
  105. //
  106. // ANSI keys and values
  107. //
  108. #if 0
  109. #define STATIC_NAME_SERVER_VALUE_A "NameServer"
  110. #define PRIMARY_DOMAIN_NAME_A "PrimaryDomainName"
  111. // Value
  112. #define USE_DOMAIN_NAME_DEVOLUTION_A "UseDomainNameDevolution"
  113. // More
  114. #define DHCP_NAME_SERVER_VALUE_A "DhcpNameServer"
  115. #define SEARCH_LIST_VALUE_A "SearchList"
  116. #define DHCP_DOMAIN_NAME_VALUE_A "DhcpDomain"
  117. #define DOMAIN_NAME_VALUE_A "Domain"
  118. #define STATIC_DOMAIN_NAME_VALUE_A "Domain"
  119. #define DHCP_IP_ADDRESS_VALUE_WIN95_A "DhcpIPAddress"
  120. #define DHCP_INFO_VALUE_A "DhcpInfo"
  121. #define DHCP_OPTION_INFO_VALUE_A "OptionInfo"
  122. #endif
  123. //
  124. // Reg types of keys
  125. //
  126. #define REGTYPE_BIND REG_MULTI_SZ
  127. #define REGTYPE_EXPORT REG_MULTI_SZ
  128. #define REGTYPE_STATIC_IP_ADDRESS REG_MULTI_SZ
  129. #define REGTYPE_STATIC_SUBNET_MASK REG_MULTI_SZ
  130. #define REGTYPE_UPDATE_ZONE_EXCLUSIONS REG_MULTI_SZ
  131. #define REGTYPE_ALTERNATE_NAMES REG_MULTI_SZ
  132. #define REGTYPE_DNS_NAME REG_SZ
  133. #define REGTYPE_SEARCH_LIST REG_SZ
  134. #define REGTYPE_DNS_SERVER REG_SZ
  135. #define REGTYPE_DHCP_IP_ADDRESS REG_SZ
  136. #define REGTYPE_DHCP_SUBNET_MASK REG_SZ
  137. #define REGTYPE_DHCP_INFO REG_BINARY
  138. #define REGTYPE_DHCP_OPTION_INFO REG_BINARY
  139. #define REGTYPE_DHCP_IP_ADDRESS_WIN95 REG_DWORD
  140. //
  141. // Registry key dummy ptrs
  142. //
  143. // Use these when we want to access registry at
  144. // EITHER adapter name
  145. // OR one of these default locations
  146. //
  147. #define REGKEY_TCPIP_PARAMETERS ((PWSTR)(UINT_PTR)(0x1))
  148. #define REGKEY_DNS_CACHE ((PWSTR)(UINT_PTR)(0x2))
  149. #define REGKEY_DNS_POLICY ((PWSTR)(UINT_PTR)(0x3))
  150. #define REGKEY_SETUP_MODE_LOCATION ((PWSTR)(UINT_PTR)(0x4))
  151. #define REGKEY_DNS_MAX REGKEY_SETUP_MODE_LOCATION
  152. //
  153. // Registry value IDs
  154. //
  155. typedef enum
  156. {
  157. // basic
  158. RegIdHostName = 0,
  159. RegIdDomainName,
  160. RegIdDhcpDomainName,
  161. RegIdAdapterDomainName,
  162. RegIdPrimaryDomainName,
  163. RegIdPrimaryDnsSuffix,
  164. RegIdAlternateNames,
  165. RegIdDnsServers,
  166. RegIdSearchList,
  167. RegIdUpdateZoneExclusions,
  168. // query
  169. RegIdQueryAdapterName,
  170. RegIdUseNameDevolution,
  171. RegIdPrioritizeRecordData,
  172. RegIdAllowUnqualifiedQuery,
  173. RegIdAppendToMultiLabelName,
  174. RegIdScreenBadTlds,
  175. RegIdScreenUnreachableServers,
  176. RegIdFilterClusterIp,
  177. RegIdWaitForNameErrorOnAll,
  178. RegIdUseEdns,
  179. RegIdQueryIpMatching,
  180. // update
  181. RegIdRegistrationEnabled,
  182. RegIdRegisterPrimaryName,
  183. RegIdRegisterAdapterName,
  184. RegIdRegisterReverseLookup,
  185. RegIdRegisterWanAdapters,
  186. RegIdRegistrationTtl,
  187. RegIdRegistrationRefreshInterval,
  188. RegIdRegistrationMaxAddressCount,
  189. RegIdUpdateSecurityLevel,
  190. RegIdUpdateZoneExcludeFile,
  191. RegIdUpdateTopLevelDomains,
  192. // backcompat
  193. RegIdDisableAdapterDomainName,
  194. RegIdDisableDynamicUpdate,
  195. RegIdEnableAdapterDomainNameRegistration,
  196. RegIdDisableReverseAddressRegistrations,
  197. RegIdDisableWanDynamicUpdate,
  198. RegIdEnableWanDynamicUpdateEventLog,
  199. RegIdDefaultRegistrationTTL,
  200. RegIdDefaultRegistrationRefreshInterval,
  201. RegIdMaxNumberOfAddressesToRegister,
  202. // micellaneous
  203. RegIdSetupMode,
  204. RegIdTestMode,
  205. RegIdRemoteResolver,
  206. // resolver
  207. RegIdMaxCacheSize,
  208. RegIdMaxCacheTtl,
  209. RegIdMaxNegativeCacheTtl,
  210. RegIdAdapterTimeoutLimit,
  211. RegIdServerPriorityTimeLimit,
  212. RegIdMaxCachedSockets,
  213. // multicast resolver
  214. RegIdMulticastListen,
  215. RegIdMulticastSend,
  216. // DHCP registration info
  217. //
  218. // these are not properties to read
  219. //RegIdDhcpRegisteredHostName, // use RegIdHostname
  220. RegIdDhcpRegisteredDomainName,
  221. RegIdDhcpSentUpdateToIp,
  222. RegIdDhcpSentPriUpdateToIp,
  223. RegIdDhcpRegisteredTtl,
  224. RegIdDhcpRegisteredFlags,
  225. RegIdDhcpRegisteredSinceBoot,
  226. RegIdDhcpDnsServerAddresses,
  227. RegIdDhcpDnsServerAddressCount,
  228. RegIdDhcpRegisteredAddresses,
  229. RegIdDhcpRegisteredAddressCount
  230. }
  231. DNS_REGID;
  232. //
  233. // ID validity mark -- keep in sync
  234. //
  235. #define RegIdValueGlobalMax RegIdMulticastSend
  236. #define RegIdValueCount (RegIdValueGlobalMax+1)
  237. #define RegIdMax RegIdDhcpRegisteredAddressCount
  238. //
  239. // Duplicates -- lots reads are just for "Domain"
  240. //
  241. // Note: can make separate entries for these if the
  242. // flags need to be different
  243. //
  244. #define RegIdStaticDomainName RegIdDomainName
  245. #define RegIdRasDomainName RegIdDomainName
  246. //
  247. // Default values
  248. //
  249. // Note, put here as non-fixed default like refresh interval
  250. // is reset in config.c
  251. //
  252. #define REGDEF_REGISTRATION_TTL (1200) // 20 minutes
  253. #define REGDEF_REGISTRATION_REFRESH_INTERVAL (86400) // 1 day
  254. #define REGDEF_REGISTRATION_REFRESH_INTERVAL_DC (86400) // 1 day
  255. //
  256. // EDNS values
  257. //
  258. #define REG_EDNS_OFF (0)
  259. #define REG_EDNS_TRY (1)
  260. #define REG_EDNS_ALWAYS (2)
  261. //
  262. // TLD screening values
  263. // - these are bit flags
  264. //
  265. #define DNS_TLD_SCREEN_NUMERIC (0x00000001)
  266. #define DNS_TLD_SCREEN_REPEATED (0x00000010)
  267. #define DNS_TLD_SCREEN_BAD_MSDC (0x00000100)
  268. #define DNS_TLD_SCREEN_TOO_LONG (0x10000000)
  269. #define DNS_TLD_SCREEN_WORKGROUP (0x00100000)
  270. #define DNS_TLD_SCREEN_DOMAIN (0x00200000)
  271. #define DNS_TLD_SCREEN_HOME (0x00400000)
  272. #define DNS_TLD_SCREEN_OFFICE (0x00800000)
  273. #define DNS_TLD_SCREEN_LOCAL (0x01000000)
  274. #define DNS_TLD_SCREEN_BOGUS_ALL (0xfff00000)
  275. #define DNS_TLD_SCREEN_DEFAULT \
  276. ( DNS_TLD_SCREEN_NUMERIC | \
  277. DNS_TLD_SCREEN_REPEATED )
  278. //
  279. // Multicast values
  280. //
  281. #define MCAST_SEND_OFF (0)
  282. #define MCAST_SEND_IP4 (0x00000001)
  283. #define MCAST_SEND_NO_DNS (0x00000010)
  284. #define MCAST_SEND_INTERFACE_NO_DNS (0x00000020)
  285. #define MCAST_SEND_NEGATIVE_RESPONSE (0x00000100)
  286. #define MCAST_SEND_FULL (0xffffffff)
  287. #define MCAST_SEND_FULL_IP6_ONLY (0xfffffff0)
  288. #define MCAST_LISTEN_OFF (0)
  289. #define MCAST_LISTEN_IP4 (0x00000001)
  290. #define MCAST_LISTEN_NO_DNS (0x00000010)
  291. #define MCAST_LISTEN_ALWAYS (0x00000100)
  292. #define MCAST_LISTEN_FULL (0xffffffff)
  293. #define MCAST_LISTEN_FULL_IP6_ONLY (0xfffffff0)
  294. //
  295. // Test mode flags
  296. //
  297. #define TEST_MODE_READ_REG (0x00000001)
  298. #define TEST_MODE_SOCK_FAIL (0x00100000)
  299. //
  300. // Access to registry property table (registry.c)
  301. //
  302. typedef struct _RegProperty
  303. {
  304. PWSTR pwsName;
  305. DWORD dwDefault;
  306. BOOLEAN bPolicy;
  307. BOOLEAN bClient;
  308. BOOLEAN bTcpip;
  309. BOOLEAN bCache;
  310. }
  311. REG_PROPERTY;
  312. extern REG_PROPERTY RegPropertyTable[];
  313. #define REGPROP_NAME(index) (RegPropertyTable[index].pwsName)
  314. #define REGPROP_DEFAULT(index) (RegPropertyTable[index].dwDefault)
  315. #define REGPROP_POLICY(index) (RegPropertyTable[index].bPolicy)
  316. #define REGPROP_CLIENT(index) (RegPropertyTable[index].bClient)
  317. #define REGPROP_CACHE(index) (RegPropertyTable[index].bCache)
  318. #define REGPROP_TCPIP(index) (RegPropertyTable[index].bTcpip)
  319. //
  320. // Config globals as structure for RPC
  321. //
  322. typedef struct _DnsGlobals
  323. {
  324. DWORD ConfigCookie;
  325. DWORD TimeStamp;
  326. BOOL InResolver;
  327. BOOL IsWin2000;
  328. BOOL IsWorkstation;
  329. BOOL IsServer;
  330. BOOL IsDnsServer;
  331. BOOL IsDomainController;
  332. BOOL InNTSetupMode;
  333. DWORD DnsTestMode;
  334. BOOL QueryAdapterName;
  335. BOOL UseNameDevolution;
  336. BOOL PrioritizeRecordData;
  337. BOOL AllowUnqualifiedQuery;
  338. BOOL AppendToMultiLabelName;
  339. BOOL ScreenBadTlds;
  340. BOOL ScreenUnreachableServers;
  341. BOOL FilterClusterIp;
  342. BOOL WaitForNameErrorOnAll;
  343. DWORD UseEdns;
  344. BOOL QueryIpMatching;
  345. BOOL RegistrationEnabled;
  346. BOOL RegisterPrimaryName;
  347. BOOL RegisterAdapterName;
  348. BOOL RegisterReverseLookup;
  349. BOOL RegisterWanAdapters;
  350. BOOL RegistrationOverwritesInConflict;
  351. DWORD RegistrationMaxAddressCount;
  352. DWORD RegistrationTtl;
  353. DWORD RegistrationRefreshInterval;
  354. DWORD UpdateSecurityLevel;
  355. BOOL UpdateZoneExcludeFile;
  356. BOOL UpdateTopLevelDomains;
  357. //
  358. // Cache stuff
  359. //
  360. // Not needed unless switch to this for actual registry read,
  361. // but convient to just export one global rather than several.
  362. // This way it's all the same.
  363. //
  364. DWORD MaxCacheSize;
  365. DWORD MaxCacheTtl;
  366. DWORD MaxNegativeCacheTtl;
  367. DWORD AdapterTimeoutLimit;
  368. DWORD ServerPriorityTimeLimit;
  369. DWORD MaxCachedSockets;
  370. DWORD MulticastListenLevel;
  371. DWORD MulticastSendLevel;
  372. }
  373. DNS_GLOBALS_BLOB, *PDNS_GLOBALS_BLOB;
  374. //
  375. // no MIDL pass on rest of file
  376. //
  377. // This file is included in MIDL pass for resolver
  378. // in order to pick up the DNS_GLOBALS_BLOB defintion
  379. // on the theory that it is better to have it right
  380. // here with the other registry config. But all the
  381. // function definitions and other struct defs are
  382. // of no interest during the pass.
  383. //
  384. #ifndef MIDL_PASS
  385. //
  386. // Config globals -- macros for globals
  387. //
  388. // There are two basic approaches here:
  389. //
  390. // 1) Single config blob -- but no fixed memory.
  391. // All callers must drop down blob to receive config blob.
  392. // Note, that this still requires macros for each individual global
  393. // but the form can be the same inside and outside the dll, and
  394. // nothing need be exported.
  395. //
  396. // 2) Create a single config blob and export that.
  397. // Individual globals then become macros into the blob. Still the
  398. // form of the macro will be different inside and outside the
  399. // dll.
  400. //
  401. // 3) Use macros to expose each individual global.
  402. // Form of macro will be different inside versus outside the dll.
  403. // Advantage here is that globals are preserved and available for
  404. // symbolic debugging.
  405. //
  406. #ifdef DNSAPI_INTERNAL
  407. //
  408. // Internal to dnsapi.dll
  409. //
  410. extern DNS_GLOBALS_BLOB DnsGlobals;
  411. #else
  412. //
  413. // External to dnsapi.dll
  414. //
  415. __declspec(dllimport) DNS_GLOBALS_BLOB DnsGlobals;
  416. #endif
  417. //
  418. // Macros to globals
  419. //
  420. #define g_ConfigCookie (DnsGlobals.ConfigCookie)
  421. #define g_InResolver (DnsGlobals.InResolver)
  422. #define g_IsWin2000 (DnsGlobals.IsWin2000)
  423. #define g_IsWin9X (DnsGlobals.IsWin9X)
  424. #define g_IsNT4 (DnsGlobals.IsNT4)
  425. #define g_IsWorkstation (DnsGlobals.IsWorkstation)
  426. #define g_IsServer (DnsGlobals.IsServer)
  427. #define g_IsDnsServer (DnsGlobals.IsDnsServer)
  428. #define g_IsDomainController (DnsGlobals.IsDomainController)
  429. #define g_InNTSetupMode (DnsGlobals.InNTSetupMode)
  430. #define g_DnsTestMode (DnsGlobals.DnsTestMode)
  431. #define g_QueryAdapterName (DnsGlobals.QueryAdapterName)
  432. #define g_UseNameDevolution (DnsGlobals.UseNameDevolution)
  433. #define g_PrioritizeRecordData (DnsGlobals.PrioritizeRecordData)
  434. #define g_AllowUnqualifiedQuery (DnsGlobals.AllowUnqualifiedQuery)
  435. #define g_AppendToMultiLabelName (DnsGlobals.AppendToMultiLabelName)
  436. #define g_ScreenBadTlds (DnsGlobals.ScreenBadTlds)
  437. #define g_ScreenUnreachableServers (DnsGlobals.ScreenUnreachableServers)
  438. #define g_FilterClusterIp (DnsGlobals.FilterClusterIp)
  439. #define g_WaitForNameErrorOnAll (DnsGlobals.WaitForNameErrorOnAll)
  440. #define g_UseEdns (DnsGlobals.UseEdns)
  441. #define g_QueryIpMatching (DnsGlobals.QueryIpMatching)
  442. #define g_RegistrationEnabled (DnsGlobals.RegistrationEnabled)
  443. #define g_RegisterPrimaryName (DnsGlobals.RegisterPrimaryName)
  444. #define g_RegisterAdapterName (DnsGlobals.RegisterAdapterName)
  445. #define g_RegisterReverseLookup (DnsGlobals.RegisterReverseLookup)
  446. #define g_RegisterWanAdapters (DnsGlobals.RegisterWanAdapters)
  447. #define g_RegistrationOverwritesInConflict (DnsGlobals.RegistrationOverwritesInConflict)
  448. #define g_RegistrationMaxAddressCount (DnsGlobals.RegistrationMaxAddressCount)
  449. #define g_RegistrationTtl (DnsGlobals.RegistrationTtl)
  450. #define g_RegistrationRefreshInterval (DnsGlobals.RegistrationRefreshInterval)
  451. #define g_UpdateSecurityLevel (DnsGlobals.UpdateSecurityLevel)
  452. #define g_UpdateZoneExcludeFile (DnsGlobals.UpdateZoneExcludeFile)
  453. #define g_UpdateTopLevelDomains (DnsGlobals.UpdateTopLevelDomains)
  454. #define g_MaxCacheSize (DnsGlobals.MaxCacheSize)
  455. #define g_MaxCacheTtl (DnsGlobals.MaxCacheTtl)
  456. #define g_MaxNegativeCacheTtl (DnsGlobals.MaxNegativeCacheTtl)
  457. #define g_AdapterTimeoutLimit (DnsGlobals.AdapterTimeoutLimit)
  458. #define g_ServerPriorityTimeLimit (DnsGlobals.ServerPriorityTimeLimit)
  459. #define g_MaxCachedSockets (DnsGlobals.MaxCachedSockets)
  460. #define g_MulticastListenLevel (DnsGlobals.MulticastListenLevel)
  461. #define g_MulticastSendLevel (DnsGlobals.MulticastSendLevel)
  462. //
  463. // Non-exported config globals
  464. //
  465. extern PWSTR g_pwsRemoteResolver;
  466. //
  467. // Registry call flags
  468. //
  469. #define DNSREG_FLAG_GET_UTF8 (0x0001) // return string in UTF8
  470. #define DNSREG_FLAG_DUMP_EMPTY (0x0010) // dump empty data\strings -- return NULL
  471. //
  472. // Registry Session
  473. //
  474. typedef struct _RegSession
  475. {
  476. HKEY hPolicy;
  477. HKEY hClient;
  478. HKEY hTcpip;
  479. HKEY hCache;
  480. }
  481. REG_SESSION, *PREG_SESSION;
  482. //
  483. // Policy adapter info read
  484. //
  485. // DCR: might be better to just include in config and
  486. // bring the whole baby across
  487. //
  488. // DCR: get to global\per adapter reads with reg_blob
  489. // then build global blob (flat) and network info(allocated)
  490. //
  491. // DCR: exposed config info should provide levels
  492. // - all
  493. // - adapter info (given domain name)
  494. // - global info
  495. //
  496. typedef struct _RegGlobalInfo
  497. {
  498. // Global data
  499. PWSTR pszPrimaryDomainName;
  500. PWSTR pszHostName;
  501. // Global flags needed to build network info
  502. BOOL fUseNameDevolution;
  503. // Adapter policy overrides
  504. PIP4_ARRAY pDnsServerArray;
  505. PVOID pDnsServerIp6Array;
  506. PWSTR pszAdapterDomainName;
  507. BOOL fRegisterAdapterName;
  508. // Read\not-read from policy
  509. BOOL fPolicyRegisterAdapterName;
  510. // DCR: DWORD blob read here
  511. }
  512. REG_GLOBAL_INFO, *PREG_GLOBAL_INFO;
  513. //
  514. // Registry adapter info read
  515. //
  516. typedef struct _RegAdapterInfo
  517. {
  518. PWSTR pszAdapterDomainName;
  519. BOOL fQueryAdapterName;
  520. BOOL fRegistrationEnabled;
  521. BOOL fRegisterAdapterName;
  522. DWORD RegistrationMaxAddressCount;
  523. }
  524. REG_ADAPTER_INFO, *PREG_ADAPTER_INFO;
  525. //
  526. // Registry update info
  527. //
  528. // DCR: should be able to get from global read
  529. //
  530. typedef struct _RegUpdateInfo
  531. {
  532. PWSTR pszPrimaryDomainName;
  533. PWSTR pmszAlternateNames;
  534. // policy overrides
  535. PWSTR pszAdapterDomainName;
  536. PIP4_ARRAY pDnsServerArray;
  537. PVOID pDnsServerIp6Array;
  538. // update flags (policy, global or adapter)
  539. BOOL fRegistrationEnabled;
  540. BOOL fRegisterAdapterName;
  541. DWORD RegistrationMaxAddressCount;
  542. }
  543. REG_UPDATE_INFO, *PREG_UPDATE_INFO;
  544. //
  545. // Registry routines
  546. //
  547. VOID
  548. Reg_Init(
  549. VOID
  550. );
  551. //
  552. // Query routines
  553. //
  554. DNS_STATUS
  555. WINAPI
  556. Reg_OpenSession(
  557. OUT PREG_SESSION pRegSession,
  558. IN DWORD Level,
  559. IN DWORD ValueId
  560. );
  561. VOID
  562. WINAPI
  563. Reg_CloseSession(
  564. IN OUT PREG_SESSION pRegSession
  565. );
  566. DNS_STATUS
  567. Reg_GetDword(
  568. IN PREG_SESSION pRegSession, OPTIONAL
  569. IN HKEY hRegKey, OPTIONAL
  570. IN PWSTR pwsKeyName, OPTIONAL
  571. IN DWORD ValueId,
  572. OUT PDWORD pResult
  573. );
  574. DNS_STATUS
  575. Reg_GetValueEx(
  576. IN PREG_SESSION pRegSession, OPTIONAL
  577. IN HKEY hRegKey, OPTIONAL
  578. IN PWSTR pwsAdapter, OPTIONAL
  579. IN DWORD ValueId,
  580. IN DWORD ValueType,
  581. IN DWORD Flag,
  582. OUT PBYTE * ppBuffer
  583. );
  584. #define Reg_GetValue(s, k, id, t, pb ) \
  585. Reg_GetValueEx(s, k, NULL, id, t, 0, pb )
  586. DNS_STATUS
  587. Reg_GetIpArray(
  588. IN PREG_SESSION pRegSession, OPTIONAL
  589. IN HKEY hRegKey, OPTIONAL
  590. IN PWSTR pwsAdapter, OPTIONAL
  591. IN DWORD ValueId,
  592. IN DWORD ValueType,
  593. OUT PIP4_ARRAY * ppIpArray
  594. );
  595. //
  596. // Set routines
  597. //
  598. HKEY
  599. WINAPI
  600. Reg_CreateKey(
  601. IN PWSTR pwsKeyName,
  602. IN BOOL bWrite
  603. );
  604. DNS_STATUS
  605. WINAPI
  606. Reg_SetDwordValueByName(
  607. IN PVOID pReserved,
  608. IN HKEY hKey,
  609. IN PWSTR pwsNameKey, OPTIONAL
  610. IN PWSTR pwsNameValue, OPTIONAL
  611. IN DWORD dwValue
  612. );
  613. DNS_STATUS
  614. WINAPI
  615. Reg_SetDwordValue(
  616. IN PVOID pReserved,
  617. IN HKEY hRegKey,
  618. IN PWSTR pwsNameKey, OPTIONAL
  619. IN DWORD ValueId,
  620. IN DWORD dwValue
  621. );
  622. //
  623. // Special type routines (regfig.c)
  624. //
  625. DNS_STATUS
  626. Reg_ReadPrimaryDomainName(
  627. IN PREG_SESSION pRegSession, OPTIONAL
  628. IN HKEY hRegKey, OPTIONAL
  629. OUT PWSTR * ppPrimaryDomainName
  630. );
  631. BOOL
  632. Reg_IsMicrosoftDnsServer(
  633. VOID
  634. );
  635. DNS_STATUS
  636. Reg_WriteLoopbackDnsServerList(
  637. IN PWSTR pszAdapterName,
  638. IN PREG_SESSION pRegSession
  639. );
  640. //
  641. // Main reg config read (config.c)
  642. //
  643. DNS_STATUS
  644. Reg_ReadGlobalsEx(
  645. IN DWORD dwFlag,
  646. IN PVOID pRegSession
  647. );
  648. //
  649. // DNS Config info access (regfig.c)
  650. //
  651. DNS_STATUS
  652. Reg_ReadGlobalInfo(
  653. IN PREG_SESSION pRegSession,
  654. OUT PREG_GLOBAL_INFO pRegInfo
  655. );
  656. VOID
  657. Reg_FreeGlobalInfo(
  658. IN OUT PREG_GLOBAL_INFO pRegInfo,
  659. IN BOOL fFreeBlob
  660. );
  661. DNS_STATUS
  662. Reg_ReadAdapterInfo(
  663. IN PWSTR pszAdapterName,
  664. IN PREG_SESSION pRegSession,
  665. IN PREG_GLOBAL_INFO pRegInfo,
  666. OUT PREG_ADAPTER_INFO pBlob
  667. );
  668. DNS_STATUS
  669. Reg_ReadAdapterInfoA(
  670. IN PSTR pszAdapterName,
  671. IN PREG_SESSION pRegSession,
  672. IN PREG_GLOBAL_INFO pRegInfo,
  673. OUT PREG_ADAPTER_INFO pBlob
  674. );
  675. VOID
  676. Reg_FreeAdapterInfo(
  677. IN OUT PREG_ADAPTER_INFO pRegAdapterInfo,
  678. IN BOOL fFreeBlob
  679. );
  680. DNS_STATUS
  681. Reg_ReadUpdateInfo(
  682. IN PWSTR pszAdapterName,
  683. OUT PREG_UPDATE_INFO pUpdateInfo
  684. );
  685. VOID
  686. Reg_FreeUpdateInfo(
  687. IN OUT PREG_UPDATE_INFO pUpdateInfo,
  688. IN BOOL fFreeBlob
  689. );
  690. //
  691. // Insure fressh update config (regfig.c)
  692. //
  693. DNS_STATUS
  694. Reg_RefreshUpdateConfig(
  695. VOID
  696. );
  697. //
  698. // Simplified special type access
  699. //
  700. PSTR
  701. WINAPI
  702. Reg_GetPrimaryDomainName(
  703. IN DNS_CHARSET CharSet
  704. );
  705. PSTR
  706. WINAPI
  707. Reg_GetHostName(
  708. IN DNS_CHARSET CharSet
  709. );
  710. PSTR
  711. WINAPI
  712. Reg_GetFullHostName(
  713. IN DNS_CHARSET CharSet
  714. );
  715. //
  716. // Simple reg DWORD access
  717. //
  718. DWORD
  719. Reg_ReadDwordProperty(
  720. IN DNS_REGID RegId,
  721. IN PWSTR pwsAdapterName OPTIONAL
  722. );
  723. DNS_STATUS
  724. WINAPI
  725. Reg_SetDwordPropertyAndAlertCache(
  726. IN PWSTR pwsKey,
  727. IN DWORD RegId,
  728. IN DWORD dwValue
  729. );
  730. #endif // no MIDL_PASS
  731. #endif _DNSREGISTRY_INCLUDED_
  732. //
  733. // End registry.h
  734. //