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.

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