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.

670 lines
21 KiB

  1. //========================================================================
  2. // Copyright (C) 1997 Microsoft Corporation
  3. // Author: RameshV
  4. // Description: This file has been generated. Pl look at the .c file
  5. //========================================================================
  6. #ifndef _MMREG_REGUTIL_H
  7. #define _MMREG_REGUTIL_H
  8. typedef struct _REG_HANDLE {
  9. HKEY Key;
  10. HKEY SubKey;
  11. LPWSTR SubKeyLocation;
  12. } REG_HANDLE, *PREG_HANDLE, *LPREG_HANDLE;
  13. #define REG_THIS_SERVER L"Software\\Microsoft\\DHCPServer\\Configuration"
  14. #define REG_THIS_SERVER_DS L"Software\\Microsoft\\DHCPServer\\Config_DS"
  15. #define REG_THIS_SERVER_DS_VALUE L"Config_DS"
  16. #define REG_THIS_SERVER_DS_PARENT L"Software\\Microsoft\\DHCPServer"
  17. #define REG_SERVER_GLOBAL_OPTIONS L"GlobalOptionValues"
  18. #define REG_SERVER_OPTDEFS L"OptionInfo"
  19. #define REG_SERVER_SUBNETS L"Subnets"
  20. #define REG_SERVER_SSCOPES L"SuperScope"
  21. #define REG_SERVER_CLASSDEFS L"ClassDefs"
  22. #define REG_SERVER_MSCOPES L"MulticastScopes"
  23. #define REG_SUBNET_SERVERS L"DHCPServers"
  24. #define REG_SUBNET_RANGES L"IpRanges"
  25. #define REG_SUBNET_RESERVATIONS L"ReservedIps"
  26. #define REG_SUBNET_OPTIONS L"SubnetOptions"
  27. #define REG_SUBNET_EXCL L"ExcludedIpRanges"
  28. #define REG_SUBNET_ADDRESS L"SubnetAddress"
  29. #define REG_SUBNET_NAME L"SubnetName"
  30. #define REG_SUBNET_COMMENT L"SubnetComment"
  31. #define REG_SUBNET_MASK L"SubnetMask"
  32. #define REG_SUBNET_STATE L"SubnetState"
  33. #define REG_SUBNET_SWITCHED_FLAG L"SwitchedNetworkFlag"
  34. #define REG_MSCOPE_NAME L"MScopeName"
  35. #define REG_MSCOPE_COMMENT L"MScopeComment"
  36. #define REG_MSCOPE_SCOPEID L"MScopeIdValue"
  37. #define REG_MSCOPE_STATE L"MScopeState"
  38. #define REG_MSCOPE_ADDR_POLICY L"MScopeAddressPolicy"
  39. #define REG_MSCOPE_TTL L"MScopeTTL"
  40. #define REG_MSCOPE_LANG_TAG L"MScopeLangTag"
  41. #define REG_MSCOPE_EXPIRY_TIME L"MScopeExpiryTime"
  42. #define REG_SUB_SERVER_NAME L"ServerHostName"
  43. #define REG_SUB_SERVER_COMMENT L"ServerComment"
  44. #define REG_SUB_SERVER_ADDRESS L"ServerAddress"
  45. #define REG_SUB_SERVER_ROLE L"Role"
  46. #define REG_RANGE_NAME L"RangeName"
  47. #define REG_RANGE_COMMENT L"RangeComment"
  48. #define REG_RANGE_START_ADDRESS L"StartAddress"
  49. #define REG_RANGE_END_ADDRESS L"EndAddress"
  50. #define REG_RANGE_INUSE_CLUSTERS L"InUseClusters"
  51. #define REG_RANGE_USED_CLUSTERS L"UsedClusters"
  52. #define REG_RANGE_BITS_PREFIX L"Bits "
  53. #define REG_RANGE_BITS_PREFIX_WCHAR_COUNT (5)
  54. #define REG_RANGE_FLAGS L"RangeFlags"
  55. #define REG_RANGE_ALLOC L"RangeBootpAllocated"
  56. #define REG_RANGE_MAX_ALLOC L"RangeBootpMaxAllowed"
  57. #define REG_OPTION_NAME L"OptionName"
  58. #define REG_OPTION_COMMENT L"OptionComment"
  59. #define REG_OPTION_TYPE L"OptionType"
  60. #define REG_OPTION_VALUE L"OptionValue"
  61. #define REG_OPTION_ID L"OptionId"
  62. #define REG_OPTION_CLASSNAME L"OptionClassName"
  63. #define REG_OPTION_VENDORNAME L"OptionVendorName"
  64. #define REG_CLASSDEF_NAME L"ClassName"
  65. #define REG_CLASSDEF_COMMENT L"ClassComment"
  66. #define REG_CLASSDEF_TYPE L"ClassType"
  67. #define REG_CLASSDEF_VALUE L"ClassValue"
  68. #define REG_RESERVATION_ADDRESS L"IpAddress"
  69. #define REG_RESERVATION_UID L"ClientUID"
  70. #define REG_RESERVATION_TYPE L"AllowedClientTypes"
  71. #define REG_RESERVATION_NAME L"ReservationName"
  72. #define REG_RESERVATION_COMMENT L"ReservationComment"
  73. #define REG_FLAGS L"Flags"
  74. #define REG_ACCESS KEY_ALL_ACCESS
  75. #define REG_DEFAULT_SUBNET_STATE 0
  76. #define REG_DEFAULT_SUBNET_MASK 0xFFFFFFFF
  77. #define REG_DEFAULT_SWITCHED_FLAG FALSE
  78. #define REG_CLASS L"DhcpClass"
  79. #define DHCP_LAST_DOWNLOAD_TIME_VALUE L"LastDownloadTime"
  80. #define DHCP_LAST_DOWNLOAD_TIME_TYPE REG_BINARY
  81. #define DEF_RANGE_ALLOC 0
  82. #define DEF_RANGE_MAX_ALLOC (~(ULONG)0)
  83. //================================================================================
  84. // The basic open/traverse/close functions are here
  85. //================================================================================
  86. DWORD
  87. DhcpRegSetCurrentServer(
  88. IN OUT PREG_HANDLE Hdl
  89. ) ;
  90. DWORD
  91. DhcpRegGetThisServer(
  92. IN OUT PREG_HANDLE Hdl
  93. ) ;
  94. DWORD
  95. DhcpRegGetNextHdl(
  96. IN PREG_HANDLE Hdl,
  97. IN LPWSTR NextLoc,
  98. OUT PREG_HANDLE OutHdl
  99. ) ;
  100. DWORD
  101. DhcpRegCloseHdl(
  102. IN OUT PREG_HANDLE Hdl
  103. ) ;
  104. //================================================================================
  105. // MISC utilities for registry manipulation
  106. //================================================================================
  107. DWORD
  108. DhcpRegFillSubKeys(
  109. IN PREG_HANDLE Hdl,
  110. IN OUT PARRAY Array // fill in a list of key names
  111. ) ;
  112. LPVOID // DWORD or LPWSTR or LPBYTE
  113. DhcpRegRead( // read differnt values from registry and allocate if not DWORD
  114. IN PREG_HANDLE Hdl,
  115. IN DWORD Type, // if DWORD dont allocate memory
  116. IN LPWSTR ValueName,
  117. IN LPVOID RetValue // value to use if nothing found
  118. ) ;
  119. DWORD
  120. DhcpRegReadBinary( // read binary type
  121. IN PREG_HANDLE Hdl,
  122. IN LPWSTR ValueName,
  123. OUT LPBYTE *RetVal,
  124. OUT DWORD *RetValSize
  125. ) ;
  126. LPWSTR
  127. DhcpRegCombineClassAndOption( // create string based on class name and option id
  128. IN LPWSTR ClassName,
  129. IN LPWSTR VendorName,
  130. IN DWORD OptionId
  131. ) ;
  132. LPWSTR
  133. ConvertAddressToLPWSTR(
  134. IN DWORD Address,
  135. IN OUT LPWSTR BufferStr // input buffer to fill with dotted notation
  136. ) ;
  137. //================================================================================
  138. // the following functions help traversing the registry
  139. //================================================================================
  140. DWORD
  141. DhcpRegServerGetSubnetHdl(
  142. IN PREG_HANDLE Hdl,
  143. IN LPWSTR Subnet,
  144. OUT PREG_HANDLE Hdl2
  145. ) ;
  146. DWORD
  147. DhcpRegServerGetSScopeHdl(
  148. IN PREG_HANDLE Hdl,
  149. IN LPWSTR SScope,
  150. OUT PREG_HANDLE Hdl2
  151. ) ;
  152. DWORD
  153. DhcpRegServerGetOptDefHdl(
  154. IN PREG_HANDLE Hdl,
  155. IN LPWSTR OptDef,
  156. OUT PREG_HANDLE Hdl2
  157. ) ;
  158. DWORD
  159. DhcpRegServerGetOptHdl(
  160. IN PREG_HANDLE Hdl,
  161. IN LPWSTR Opt,
  162. OUT PREG_HANDLE Hdl2
  163. ) ;
  164. DWORD
  165. DhcpRegServerGetMScopeHdl(
  166. IN PREG_HANDLE Hdl,
  167. IN LPWSTR MScope,
  168. OUT PREG_HANDLE Hdl2
  169. ) ;
  170. DWORD
  171. DhcpRegServerGetClassDefHdl(
  172. IN PREG_HANDLE Hdl,
  173. IN LPWSTR ClassDef,
  174. OUT PREG_HANDLE Hdl2
  175. ) ;
  176. DWORD
  177. DhcpRegSubnetGetOptHdl(
  178. IN PREG_HANDLE Hdl,
  179. IN LPWSTR Opt,
  180. OUT PREG_HANDLE Hdl2
  181. ) ;
  182. DWORD
  183. DhcpRegSubnetGetRangeHdl(
  184. IN PREG_HANDLE Hdl,
  185. IN LPWSTR Range,
  186. OUT PREG_HANDLE Hdl2
  187. ) ;
  188. DWORD
  189. DhcpRegSubnetGetReservationHdl(
  190. IN PREG_HANDLE Hdl,
  191. IN LPWSTR Reservation,
  192. OUT PREG_HANDLE Hdl2
  193. ) ;
  194. DWORD
  195. DhcpRegSubnetGetServerHdl(
  196. IN PREG_HANDLE Hdl,
  197. IN LPWSTR Server,
  198. OUT PREG_HANDLE Hdl2
  199. ) ;
  200. DWORD
  201. DhcpRegReservationGetOptHdl(
  202. IN PREG_HANDLE Hdl,
  203. IN LPWSTR OptionName,
  204. OUT PREG_HANDLE Hdl2
  205. ) ;
  206. //================================================================================
  207. // List retrieval functions.. for servers, subnets, ranges etc.
  208. //================================================================================
  209. DWORD
  210. DhcpRegServerGetList(
  211. IN PREG_HANDLE Hdl, // ptr to server location
  212. IN OUT PARRAY OptList, // list of LPWSTR options
  213. IN OUT PARRAY OptDefList, // list of LPWSTR optdefs
  214. IN OUT PARRAY Subnets, // list of LPWSTR subnets
  215. IN OUT PARRAY SScopes, // list of LPWSTR sscopes
  216. IN OUT PARRAY ClassDefs, // list of LPWSTR classes
  217. IN OUT PARRAY MScopes // list of LPWSTR mscopes
  218. ) ;
  219. DWORD
  220. DhcpRegSubnetGetExclusions(
  221. IN PREG_HANDLE Hdl,
  222. OUT LPBYTE *Excl,
  223. OUT DWORD *ExclSize
  224. ) ;
  225. DWORD
  226. DhcpRegSubnetGetList(
  227. IN PREG_HANDLE Hdl,
  228. IN OUT PARRAY Servers,
  229. IN OUT PARRAY IpRanges,
  230. IN OUT PARRAY Reservations,
  231. IN OUT PARRAY Options,
  232. OUT LPBYTE *Excl,
  233. OUT DWORD *ExclSizeInBytes
  234. ) ;
  235. DWORD
  236. DhcpRegSScopeGetList(
  237. IN PREG_HANDLE Hdl,
  238. IN OUT PARRAY Subnets
  239. ) ;
  240. DWORD
  241. DhcpRegReservationGetList(
  242. IN PREG_HANDLE Hdl,
  243. IN OUT PARRAY Options
  244. ) ;
  245. //================================================================================
  246. // the separate stuff are here -- these are not list stuff, but just simple
  247. // single valued attributes
  248. // some of these actually, dont even go to the registry, but that's fine alright?
  249. //================================================================================
  250. DWORD
  251. DhcpRegServerGetAttributes(
  252. IN PREG_HANDLE Hdl,
  253. OUT LPWSTR *Name,
  254. OUT LPWSTR *Comment,
  255. OUT DWORD *Flags
  256. // more attributes will come here soon?
  257. ) ;
  258. DWORD
  259. DhcpRegSubnetGetAttributes(
  260. IN PREG_HANDLE Hdl,
  261. OUT LPWSTR *Name,
  262. OUT LPWSTR *Comment,
  263. OUT DWORD *Flags,
  264. OUT DWORD *Address,
  265. OUT DWORD *Mask
  266. ) ;
  267. DWORD
  268. DhcpRegMScopeGetAttributes(
  269. IN PREG_HANDLE Hdl,
  270. OUT LPWSTR *Comments,
  271. OUT DWORD *State,
  272. OUT DWORD *ScopeId,
  273. OUT DWORD *Policy,
  274. OUT DWORD *TTL,
  275. OUT LPWSTR *LangTag,
  276. OUT PDATE_TIME *ExpiryTime
  277. ) ;
  278. DWORD
  279. DhcpRegOptDefGetAttributes(
  280. IN PREG_HANDLE Hdl,
  281. OUT LPWSTR *Name,
  282. OUT LPWSTR *Comments,
  283. OUT DWORD *Flags,
  284. OUT DWORD *OptionId,
  285. OUT LPWSTR *ClassName,
  286. OUT LPWSTR *VendorName,
  287. OUT LPBYTE *Value,
  288. OUT DWORD *ValueSize
  289. ) ;
  290. DWORD
  291. DhcpRegSScopeGetAttributes( // superscopes dont have any information stored.. dont use this
  292. IN PREG_HANDLE Hdl,
  293. OUT LPWSTR *Name,
  294. OUT LPWSTR *Comment,
  295. OUT DWORD *Flags
  296. ) ;
  297. DWORD
  298. DhcpRegClassDefGetAttributes(
  299. IN PREG_HANDLE Hdl,
  300. OUT LPWSTR *Name,
  301. OUT LPWSTR *Comment,
  302. OUT DWORD *Flags,
  303. OUT LPBYTE *Value,
  304. OUT DWORD *ValueSize
  305. ) ;
  306. DWORD
  307. DhcpRegSubnetServerGetAttributes(
  308. IN PREG_HANDLE Hdl,
  309. OUT LPWSTR *Name,
  310. OUT LPWSTR *Comment,
  311. OUT DWORD *Flags,
  312. OUT DWORD *Address,
  313. OUT DWORD *Role
  314. ) ;
  315. DWORD
  316. DhcpRegRangeGetAttributes(
  317. IN PREG_HANDLE Hdl,
  318. OUT LPWSTR *Name,
  319. OUT LPWSTR *Comment,
  320. OUT DWORD *Flags,
  321. OUT ULONG *AllocCount,
  322. OUT ULONG *MaxAllocCount,
  323. OUT DWORD *StartAddress,
  324. OUT DWORD *EndAddress,
  325. OUT LPBYTE *InUseClusters,
  326. OUT DWORD *InUseClusterSize,
  327. OUT LPBYTE *UsedClusters,
  328. OUT DWORD *UsedClustersSize
  329. ) ;
  330. DWORD
  331. DhcpRegReservationGetAttributes(
  332. IN PREG_HANDLE Hdl,
  333. OUT LPWSTR *Name,
  334. OUT LPWSTR *Comment,
  335. OUT DWORD *Flags,
  336. OUT DWORD *Address,
  337. OUT LPBYTE *ClientUID,
  338. OUT DWORD *ClientUIDSize
  339. ) ;
  340. DWORD
  341. DhcpRegOptGetAttributes(
  342. IN PREG_HANDLE Hdl,
  343. OUT DWORD *OptionId,
  344. OUT LPWSTR *ClassName,
  345. OUT LPWSTR *VendorName,
  346. OUT DWORD *Flags,
  347. OUT LPBYTE *Value,
  348. OUT DWORD *ValueSize
  349. ) ;
  350. //================================================================================
  351. // the following functiosn help in writing to the registry
  352. //================================================================================
  353. DWORD
  354. DhcpRegSaveSubKeys(
  355. IN PREG_HANDLE Hdl,
  356. IN OUT PARRAY Array
  357. ) ;
  358. DWORD
  359. DhcpRegSaveSubKeysPrefixed(
  360. IN PREG_HANDLE Hdl,
  361. IN OUT PARRAY Array,
  362. IN LPWSTR CommonPrefix
  363. ) ;
  364. DWORD
  365. DhcpRegServerSetList(
  366. IN PREG_HANDLE Hdl,
  367. IN PARRAY OptList, // list of LPWSTR options
  368. IN PARRAY OptDefList, // list of LPWSTR optdefs
  369. IN PARRAY Subnets, // list of LPWSTR subnets
  370. IN PARRAY SScopes, // list of LPWSTR sscopes
  371. IN PARRAY ClassDefs, // list of LPWSTR classes
  372. IN PARRAY MScopes // list of LPWSTR mscopes
  373. ) ;
  374. DWORD
  375. DhcpRegSubnetSetExclusions(
  376. IN PREG_HANDLE Hdl,
  377. IN LPBYTE *Excl,
  378. IN DWORD ExclSize
  379. ) ;
  380. DWORD
  381. DhcpRegSubnetSetList(
  382. IN PREG_HANDLE Hdl,
  383. IN PARRAY Servers,
  384. IN PARRAY IpRanges,
  385. IN PARRAY Reservations,
  386. IN PARRAY Options,
  387. IN LPBYTE *Excl,
  388. IN DWORD ExclSizeInBytes
  389. ) ;
  390. DWORD
  391. DhcpRegSScopeSetList(
  392. IN PREG_HANDLE Hdl,
  393. IN OUT PARRAY Subnets
  394. ) ;
  395. DWORD
  396. DhcpRegReservationSetList(
  397. IN PREG_HANDLE Hdl,
  398. IN PARRAY Subnets
  399. ) ;
  400. //================================================================================
  401. // the single stuff are here -- these are not list stuff, but just simple
  402. // single valued attributes
  403. // some of these actually, dont even go to the registry, but that's fine alright?
  404. //================================================================================
  405. DWORD
  406. DhcpRegServerSetAttributes(
  407. IN PREG_HANDLE Hdl,
  408. IN LPWSTR *Name,
  409. IN LPWSTR *Comment,
  410. IN DWORD *Flags
  411. // more attributes will come here soon?
  412. ) ;
  413. DWORD
  414. DhcpRegSubnetSetAttributes(
  415. IN PREG_HANDLE Hdl,
  416. IN LPWSTR *Name,
  417. IN LPWSTR *Comment,
  418. IN DWORD *Flags,
  419. IN DWORD *Address,
  420. IN DWORD *Mask
  421. ) ;
  422. DWORD
  423. DhcpRegMScopeSetAttributes(
  424. IN PREG_HANDLE Hdl,
  425. IN LPWSTR *Comments,
  426. IN DWORD *State,
  427. IN DWORD *ScopeId,
  428. IN DWORD *Policy,
  429. IN DWORD *TTL,
  430. IN LPWSTR *LangTag,
  431. IN PDATE_TIME *ExpiryTime
  432. ) ;
  433. DWORD
  434. DhcpRegOptDefSetAttributes(
  435. IN PREG_HANDLE Hdl,
  436. IN LPWSTR *Name,
  437. IN LPWSTR *Comments,
  438. IN DWORD *Flags,
  439. IN DWORD *OptionId,
  440. IN LPWSTR *ClassName,
  441. IN LPWSTR *VendorName,
  442. IN LPBYTE *Value,
  443. IN DWORD ValueSize
  444. ) ;
  445. DWORD
  446. DhcpRegSScopeSetAttributes( // superscopes dont have any information stored.. dont use this
  447. IN PREG_HANDLE Hdl,
  448. IN LPWSTR *Name,
  449. IN LPWSTR *Comment,
  450. IN DWORD *Flags
  451. ) ;
  452. DWORD
  453. DhcpRegClassDefSetAttributes(
  454. IN PREG_HANDLE Hdl,
  455. IN LPWSTR *Name,
  456. IN LPWSTR *Comment,
  457. IN DWORD *Flags,
  458. IN LPBYTE *Value,
  459. IN DWORD ValueSize
  460. ) ;
  461. DWORD
  462. DhcpRegSubnetServerSetAttributes(
  463. IN PREG_HANDLE Hdl,
  464. IN LPWSTR *Name,
  465. IN LPWSTR *Comment,
  466. IN DWORD *Flags,
  467. IN DWORD *Address,
  468. IN DWORD *Role
  469. ) ;
  470. DWORD
  471. DhcpRegRangeSetAttributes(
  472. IN PREG_HANDLE Hdl,
  473. IN LPWSTR *Name,
  474. IN LPWSTR *Comment,
  475. IN DWORD *Flags,
  476. IN ULONG *AllocCount,
  477. IN ULONG *MaxAllocCount,
  478. IN DWORD *StartAddress,
  479. IN DWORD *EndAddress,
  480. IN LPBYTE *InUseClusters,
  481. IN DWORD InUseClusterSize,
  482. IN LPBYTE *UsedClusters,
  483. IN DWORD UsedClustersSize
  484. ) ;
  485. DWORD
  486. DhcpRegReservationSetAttributes(
  487. IN PREG_HANDLE Hdl,
  488. IN LPWSTR *Name,
  489. IN LPWSTR *Comment,
  490. IN DWORD *Flags,
  491. IN DWORD *Address,
  492. IN LPBYTE *ClientUID,
  493. IN DWORD ClientUIDSize
  494. ) ;
  495. DWORD
  496. DhcpRegOptSetAttributes(
  497. IN PREG_HANDLE Hdl,
  498. IN DWORD *OptionId,
  499. IN LPWSTR *ClassName,
  500. IN LPWSTR *VendorName,
  501. IN DWORD *Flags,
  502. IN LPBYTE *Value,
  503. IN DWORD ValueSize
  504. ) ;
  505. DWORD
  506. DhcpRegRecurseDelete(
  507. IN PREG_HANDLE Hdl,
  508. IN LPWSTR KeyName
  509. ) ;
  510. DWORD
  511. DhcpRegRecurseDeleteBunch(
  512. IN PREG_HANDLE Hdl,
  513. IN PARRAY KeysArray
  514. ) ;
  515. DWORD
  516. DhcpRegUpdateTime( // update the last modified time
  517. VOID
  518. ) ;
  519. #endif // _MMREG_REGUTIL_H
  520. //========================================================================
  521. // end of file
  522. //========================================================================