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.

751 lines
25 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1992, Microsoft Corporation.
  4. //
  5. // File: registry.h
  6. //
  7. // Contents: Definitions of classes for manipulating registry entries.
  8. //
  9. // Classes: CMyRegKey - class for registry key objects
  10. // CRegValue - base class for registry value objects
  11. // CRegSZ - derived class for registry string values
  12. // CRegDWORD - derived class for registry dword values
  13. // CRegBINARY - derived class for registry binary values
  14. // CRegMSZ - derived class for registry multi-string values
  15. //
  16. // History: 09/30/92 Rickhi Created
  17. //
  18. // 09/22/93 AlokS Took out exception throwing code
  19. // and added proper return code for
  20. // each method.
  21. //
  22. // 07/26/94 AlokS Made it lightweight for normal set/get
  23. // operations. Threw out all exception code
  24. //
  25. // 12/09/97 Milans Ported it over to Exchange
  26. //
  27. // Notes: CMyRegKey can use another CMyRegKey as a parent, so you can
  28. // build a tree of keys. To kick things off, you can give one
  29. // of the default registry keys like HKEY_CURRENT_USER. When
  30. // you do this, the GetParent method returns NULL. Currently
  31. // however, no ptrs are kept to child and sibling keys.
  32. //
  33. // CRegValue is a base class for dealing with registry values.
  34. // The other classes (except CMyRegKey) are for dealing with a
  35. // specific type of registry value in the native data format.
  36. // For example, CRegDWORD lets you call methods just providing
  37. // a dword. The methods take care of figuring out the size and
  38. // casting the dword to a ptr to bytes, etc for use in the Win32
  39. // registry APIs.
  40. //
  41. // For any registry type not defined here, you can always resort
  42. // to using the CRegValue base class directly, though you then
  43. // must call GetValue or SetValue methods explicitly.
  44. //
  45. // Sample Usage:
  46. //
  47. // The following reads the username in the ValueID UserName
  48. // within the key HKEY_CURRENT_USER\LogonInfo. It then changes
  49. // it to Rickhi. It also sets the password valueid in the
  50. // the same key to foobar.
  51. //
  52. // #include <registry.h>
  53. //
  54. // // open the registry key
  55. // CMyRegKey rkLogInfo(HKEY_CURRENT_USER, L"LogonInfo");
  56. //
  57. // // read the user name
  58. // LPSTR pszUserName;
  59. // CRegSZ rszUserName(&rkLogInfo, "UserName", pszUserName);
  60. // rszUserName.SetString("Rickhi");
  61. //
  62. // // set the password
  63. // CRegSZ rszPassWord(&rkLogInfo, "PassWord", "foobar");
  64. //
  65. //----------------------------------------------------------------------------
  66. #ifndef __REGISTRY_H__
  67. #define __REGISTRY_H__
  68. #include "reg_cbuffer.h"
  69. // to simplify error creation
  70. #define Creg_ERROR(x) (x)
  71. // forward declarations for use in the following structures
  72. class CRegValue;
  73. class CMyRegKey;
  74. // structure for enumerating subkeys of a key
  75. typedef struct _SRegKeySet
  76. {
  77. ULONG cKeys;
  78. CMyRegKey *aprkKey[1];
  79. } SRegKeySet;
  80. // structure for enumerating values within a key
  81. typedef struct _SRegValueSet
  82. {
  83. ULONG cValues;
  84. CRegValue *aprvValue[1];
  85. } SRegValueSet;
  86. // structure for dealing with multi-string values
  87. typedef struct _SMultiStringSet
  88. {
  89. ULONG cStrings;
  90. LPSTR apszString[1];
  91. } SMultiStringSet;
  92. //+-------------------------------------------------------------------------
  93. //
  94. // Class: CMyRegKey
  95. //
  96. // Purpose: class for abstracting Registry Keys
  97. //
  98. // Interface: CMyRegKey - constructor for a registry key object
  99. // ~CMyRegKey - destructor for a registry key object
  100. // GetParentHandle - returns parent key's handle
  101. // GetHandle - returns this key's handle
  102. // GetName - returns key path
  103. // Delete - deletes the key from the registry
  104. // EnumValues - enumerate values stored in the key
  105. // EnumKeys - enumerates subkeys of the key
  106. // NotifyChange - sets up change notification for the key
  107. // QueryErrorStatus - Should be used to determine if constructor
  108. // completed successfully or not
  109. // History: 09/30/92 Rickhi Created
  110. //
  111. // Notes:
  112. //
  113. //--------------------------------------------------------------------------
  114. class CMyRegKey
  115. {
  116. public:
  117. // constructor using HKEY for parent
  118. // Mode: Create key if not present
  119. CMyRegKey(HKEY hkParent,
  120. LPCSTR pszPath,
  121. // remaining parameters are optional
  122. REGSAM samDesiredAccess = KEY_ALL_ACCESS,
  123. LPCSTR pszClass = NULL,
  124. DWORD dwOptions = REG_OPTION_NON_VOLATILE,
  125. DWORD *pdwDisposition = NULL,
  126. const LPSECURITY_ATTRIBUTES pSecurityAttributes = NULL
  127. );
  128. // constructor using CMyRegKey as parent
  129. // Mode: Create key if not present
  130. CMyRegKey(const CMyRegKey& crkParent,
  131. LPCSTR pszPath,
  132. // remaining parameters are optional
  133. REGSAM samDesiredAccess = KEY_ALL_ACCESS,
  134. LPCSTR pszClass = NULL,
  135. DWORD dwOptions = REG_OPTION_NON_VOLATILE,
  136. DWORD *pdwDisposition = NULL,
  137. const LPSECURITY_ATTRIBUTES pSecurityAttributes = NULL
  138. );
  139. // Constructor using HKEY for parent
  140. // Mode: Simply Open the key, if exists
  141. CMyRegKey (HKEY hkParent,
  142. DWORD *pdwErr,
  143. LPCSTR pszPath,
  144. REGSAM samDesiredAccess = KEY_ALL_ACCESS
  145. );
  146. // Constructor using CMyRegKey as parent
  147. // Mode: Simply open the key, if exists
  148. CMyRegKey (const CMyRegKey& crkParent,
  149. DWORD *pdwErr,
  150. LPCSTR pszPath,
  151. REGSAM samDesiredAccess = KEY_ALL_ACCESS
  152. );
  153. // Destructor - Closes registry key
  154. ~CMyRegKey(void);
  155. HKEY GetHandle(void) const;
  156. LPCSTR GetName(void) const;
  157. DWORD Delete(void);
  158. DWORD EnumValues(SRegValueSet **pprvs);
  159. DWORD EnumKeys(SRegKeySet **pprks);
  160. // This method can be called to determine if
  161. // Object is in sane state or not
  162. DWORD QueryErrorStatus () const { return _dwErr ; }
  163. // Static routine which frees memory allocated during EnumValues/Keys
  164. static void MemFree ( void * pv )
  165. {
  166. delete [] (BYTE*)pv;
  167. }
  168. private:
  169. DWORD CreateKey(HKEY hkParent,
  170. LPCSTR pszPath,
  171. REGSAM samDesiredAccess,
  172. LPCSTR pszClass,
  173. DWORD dwOptions,
  174. DWORD *pdwDisposition,
  175. const LPSECURITY_ATTRIBUTES pSecurityAttributes
  176. );
  177. DWORD OpenKey (HKEY hkParent,
  178. LPCSTR pszPath,
  179. REGSAM samDesiredAccess
  180. );
  181. HKEY _hkParent; // Handle to parent
  182. HKEY _hkThis; // handle for this key
  183. CCHARBuffer _cszName; // Buffer containing the registry path
  184. // path from parent key to this key
  185. DWORD _dwErr; // Internal error status
  186. };
  187. inline HKEY CMyRegKey::GetHandle(void) const
  188. {
  189. return _hkThis;
  190. }
  191. inline LPCSTR CMyRegKey::GetName(void) const
  192. {
  193. return (LPCSTR) (LPSTR)_cszName;
  194. }
  195. //+-------------------------------------------------------------------------
  196. //
  197. // Class: CRegValue
  198. //
  199. // Purpose: base class for abstracting Registry Values
  200. //
  201. // Interface: CRegValue - constructor for value
  202. // ~CRegValue - destructor for value
  203. // GetKeyHandle - returns handle for parent key
  204. // GetValueID - returns the ValueID name
  205. // GetTypeCode - returns the TypeCode of the data
  206. // GetValue - returns the data associated with the value
  207. // SetValue - sets the data associated with the value
  208. // Delete - deletes the value from the registry
  209. // QueryErrorStatus - Should be used to determine if constructor
  210. // completed successfully or not
  211. //
  212. // History: 09/30/92 Rickhi Created
  213. //
  214. // Notes: This is a base class from which more specific classes are
  215. // derived for each of the different registry value types.
  216. //
  217. //--------------------------------------------------------------------------
  218. class CRegValue
  219. {
  220. public:
  221. CRegValue(const CMyRegKey& crkParentKey,
  222. LPCSTR pszValueID);
  223. ~CRegValue(void){;};
  224. HKEY GetParentHandle(void) const;
  225. LPCSTR GetValueID(void) const;
  226. // Caller supplies buffer
  227. DWORD GetValue(LPBYTE pbData, ULONG *pcbData, DWORD *pdwTypeCode);
  228. DWORD SetValue(const LPBYTE pbData, ULONG cbData, DWORD dwTypeCode);
  229. virtual DWORD QueryErrorStatus (void) const { return _dwErr ; }
  230. private:
  231. CCHARBuffer _cszValueID;
  232. HKEY _hkParent;
  233. DWORD _dwErr ;
  234. };
  235. //+-------------------------------------------------------------------------
  236. //
  237. // Member: CRegValue::CRegValue
  238. //
  239. // Purpose: constructor for base registry value
  240. //
  241. // Arguments: [prkParent] - ptr to parent CMyRegKey for the key
  242. // [pszValueID] - the valueID name for the value
  243. //
  244. // Signals: nothing
  245. //
  246. // Returns: nothing
  247. //
  248. // History: 09/30/92 Rickhi Created
  249. //
  250. // Notes:
  251. //
  252. //--------------------------------------------------------------------------
  253. inline CRegValue::CRegValue(const CMyRegKey& crkParent,
  254. LPCSTR pszValueID)
  255. : _hkParent (crkParent.GetHandle()),
  256. _dwErr(crkParent.QueryErrorStatus())
  257. {
  258. _cszValueID.Set((PCHAR) pszValueID);
  259. }
  260. inline HKEY CRegValue::GetParentHandle(void) const
  261. {
  262. return _hkParent;
  263. }
  264. inline LPCSTR CRegValue::GetValueID(void) const
  265. {
  266. return (LPCSTR) (LPSTR) _cszValueID;
  267. }
  268. //+-------------------------------------------------------------------------
  269. //
  270. // Class: CRegSZ
  271. //
  272. // Purpose: Derived class for abstracting Registry string Values
  273. //
  274. // Interface: CRegSZ - constructor for registry value using string
  275. // ~CRegSZ - destructor for registry string object
  276. // GetString - returns the string
  277. // SetString - sets a new string value
  278. // QueryErrorStatus - Should be used to determine if constructor
  279. // completed successfully or not
  280. //
  281. // History: 09/30/92 Rickhi Created
  282. //
  283. // Notes: Derived from CRegValue.
  284. //
  285. // There are three constructors. The first is used if you want
  286. // to create a new value or overwrite the existing value data.
  287. // The second is used if you want to open an existing value
  288. // and read it's data. The third is used if you just want to
  289. // make an object without doing any read/write of the data yet.
  290. // In all three cases, you can always use any of the Get/Set
  291. // operations on the object at a later time.
  292. //
  293. //--------------------------------------------------------------------------
  294. class CRegSZ : public CRegValue
  295. {
  296. public:
  297. // create/write value constructor
  298. CRegSZ(const CMyRegKey &crkParent,
  299. LPCSTR pszValueID,
  300. LPCSTR pszData
  301. );
  302. // io-less constructor - used by enumerator
  303. CRegSZ(const CMyRegKey &crkParent,
  304. LPCSTR pszValueID
  305. );
  306. ~CRegSZ(void){;};
  307. DWORD SetString(LPCSTR pszData);
  308. // Caller supplies buffer (supply the buffer size in bytes)
  309. DWORD GetString( LPSTR pszData, ULONG *pcbData);
  310. DWORD GetTypeCode(void);
  311. DWORD QueryErrorStatus(void) const { return _dwErr ; }
  312. private:
  313. DWORD _dwErr;
  314. };
  315. //+-------------------------------------------------------------------------
  316. //
  317. // Member: CRegSZ::CRegSZ
  318. //
  319. // Purpose: Constructor for registry string value
  320. //
  321. // History: 09/30/92 Rickhi Created
  322. //
  323. // Notes:
  324. //
  325. //--------------------------------------------------------------------------
  326. inline CRegSZ::CRegSZ(const CMyRegKey &crkParent,
  327. LPCSTR pszValueID,
  328. LPCSTR pszData)
  329. : CRegValue(crkParent, pszValueID)
  330. {
  331. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  332. _dwErr = SetString(pszData);
  333. }
  334. inline CRegSZ::CRegSZ(const CMyRegKey &crkParent,
  335. LPCSTR pszValueID)
  336. : CRegValue(crkParent, pszValueID)
  337. {
  338. // automatic actions in header are sufficient
  339. _dwErr = CRegValue::QueryErrorStatus();
  340. }
  341. inline DWORD CRegSZ::SetString(LPCSTR pszData)
  342. {
  343. return SetValue((LPBYTE)pszData, (strlen(pszData)+1), REG_SZ);
  344. }
  345. inline DWORD CRegSZ::GetString(LPSTR pszData, ULONG* pcbData)
  346. {
  347. DWORD dwTypeCode;
  348. return GetValue((LPBYTE)pszData, pcbData, &dwTypeCode);
  349. }
  350. inline DWORD CRegSZ::GetTypeCode(void)
  351. {
  352. return REG_SZ;
  353. }
  354. //+-------------------------------------------------------------------------
  355. //
  356. // Class: CRegMSZ
  357. //
  358. // Purpose: Derived class for abstracting Registry multi-string Values
  359. //
  360. // Interface: CRegMSZ - constructor for registry value using string
  361. // ~CRegMSZ - destructor for registry string object
  362. // GetString - returns the string
  363. // SetString - sets a new string value
  364. // QueryErrorStatus - Should be used to determine if constructor
  365. // completed successfully or not
  366. //
  367. // History: 09/30/92 Rickhi Created
  368. //
  369. // Notes: Derived from CRegValue.
  370. //
  371. // There are three constructors. The first is used if you want
  372. // to create a new value or overwrite the existing value data.
  373. // The second is used if you want to open an existing value
  374. // and read it's data. The third is used if you just want to
  375. // make an object without doing any read/write of the data yet.
  376. // In all three cases, you can always use any of the Get/Set
  377. // operations on the object at a later time.
  378. //
  379. //--------------------------------------------------------------------------
  380. class CRegMSZ : public CRegValue
  381. {
  382. public:
  383. // create/write value constructor
  384. CRegMSZ(const CMyRegKey &crkParent,
  385. LPCSTR pszValueID,
  386. LPCSTR pszData
  387. );
  388. // io-less constructor - used by enumerator
  389. CRegMSZ(const CMyRegKey &crkParent,
  390. LPCSTR pszValueID
  391. );
  392. ~CRegMSZ(void){;};
  393. DWORD SetString(LPCSTR pszData);
  394. // Caller supplies buffer (supply the buffer size in bytes)
  395. DWORD GetString( LPSTR pszData, ULONG *pcbData);
  396. DWORD GetTypeCode(void);
  397. DWORD QueryErrorStatus(void) const { return _dwErr ; }
  398. private:
  399. DWORD _dwErr;
  400. };
  401. //+-------------------------------------------------------------------------
  402. //
  403. // Member: CRegMSZ::CRegMSZ
  404. //
  405. // Purpose: Constructor for registry string value
  406. //
  407. // History: 09/30/92 Rickhi Created
  408. //
  409. // Notes:
  410. //
  411. //--------------------------------------------------------------------------
  412. inline CRegMSZ::CRegMSZ(const CMyRegKey &crkParent,
  413. LPCSTR pszValueID,
  414. LPCSTR pszData)
  415. : CRegValue(crkParent, pszValueID)
  416. {
  417. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  418. _dwErr = SetString(pszData);
  419. }
  420. inline CRegMSZ::CRegMSZ(const CMyRegKey &crkParent,
  421. LPCSTR pszValueID)
  422. : CRegValue(crkParent, pszValueID)
  423. {
  424. // automatic actions in header are sufficient
  425. _dwErr = CRegValue::QueryErrorStatus();
  426. }
  427. inline DWORD CRegMSZ::SetString(LPCSTR pszData)
  428. {
  429. DWORD cLen, cbData;
  430. LPCSTR pszNextString;
  431. for (pszNextString = pszData, cbData = 0;
  432. *pszNextString != '\0';
  433. pszNextString += cLen) {
  434. cLen = strlen(pszNextString) + 1;
  435. cbData += cLen;
  436. }
  437. cbData += sizeof('\0');
  438. return SetValue((LPBYTE)pszData, cbData, REG_MULTI_SZ);
  439. }
  440. inline DWORD CRegMSZ::GetString(LPSTR pszData, ULONG* pcbData)
  441. {
  442. DWORD dwTypeCode;
  443. return GetValue((LPBYTE)pszData, pcbData, &dwTypeCode);
  444. }
  445. inline DWORD CRegMSZ::GetTypeCode(void)
  446. {
  447. return REG_MULTI_SZ;
  448. }
  449. //+-------------------------------------------------------------------------
  450. //
  451. // Class: CRegDWORD
  452. //
  453. // Purpose: Derived class for abstracting Registry dword Values
  454. //
  455. // Interface: CRegDWORD - constructor for registry value using dword
  456. // ~CRegDWORD - destructor for registry dword object
  457. // GetDword - returns the dword
  458. // SetDword - sets a new dword value
  459. // QueryErrorStatus - Should be used to determine if constructor
  460. // completed successfully or not
  461. //
  462. // History: 09/30/92 Rickhi Created
  463. //
  464. // Notes: Derived from CRegValue.
  465. //
  466. // There are three constructors. The first is used if you want
  467. // to create a new value or overwrite the existing value data.
  468. // The second is used if you want to open an existing value
  469. // and read it's data. The third is used if you just want to
  470. // make an object without doing any read/write of the data yet.
  471. // In all three cases, you can always use any of the Get/Set
  472. // operations on the object at a later time.
  473. //
  474. //--------------------------------------------------------------------------
  475. class CRegDWORD : public CRegValue
  476. {
  477. public:
  478. // create/write value constructor
  479. CRegDWORD(const CMyRegKey &crkParent,
  480. LPCSTR pszValueID,
  481. DWORD dwData);
  482. // open/read value constructor
  483. CRegDWORD(const CMyRegKey &crkParent,
  484. LPCSTR pszValueID,
  485. DWORD *pdwData);
  486. // io-less constructor - used by enumerator
  487. CRegDWORD( const CMyRegKey &crkParent,
  488. LPCSTR pszValueID);
  489. ~CRegDWORD(void){;};
  490. DWORD SetDword(DWORD dwData);
  491. DWORD GetDword(DWORD *pdwData);
  492. DWORD GetTypeCode(void) ;
  493. DWORD QueryErrorStatus(void) const { return _dwErr ; }
  494. private:
  495. DWORD _dwErr;
  496. };
  497. //+-------------------------------------------------------------------------
  498. //
  499. // Member: CRegDWORD::CRegDWORD
  500. //
  501. // Purpose: Constructor for registry dword value
  502. //
  503. // History: 09/30/92 Rickhi Created
  504. //
  505. // Notes:
  506. //
  507. //--------------------------------------------------------------------------
  508. inline CRegDWORD::CRegDWORD(const CMyRegKey &crkParent,
  509. LPCSTR pszValueID,
  510. DWORD dwData)
  511. : CRegValue(crkParent, pszValueID)
  512. {
  513. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  514. _dwErr = SetDword(dwData);
  515. }
  516. inline CRegDWORD::CRegDWORD(const CMyRegKey &crkParent,
  517. LPCSTR pszValueID,
  518. DWORD *pdwData)
  519. : CRegValue(crkParent, pszValueID)
  520. {
  521. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  522. _dwErr = GetDword(pdwData);
  523. }
  524. inline CRegDWORD::CRegDWORD(const CMyRegKey &crkParent,
  525. LPCSTR pszValueID)
  526. : CRegValue(crkParent, pszValueID)
  527. {
  528. // automatic actions in header are sufficient
  529. _dwErr = CRegValue::QueryErrorStatus();
  530. }
  531. inline DWORD CRegDWORD::GetDword(DWORD *pdwData)
  532. {
  533. DWORD dwTypeCode;
  534. DWORD dwErr;
  535. ULONG cbData= sizeof(DWORD);
  536. dwErr = GetValue((LPBYTE)pdwData, &cbData, &dwTypeCode);
  537. return (dwErr);
  538. }
  539. inline DWORD CRegDWORD::SetDword(DWORD dwData)
  540. {
  541. return SetValue((LPBYTE)&dwData, sizeof(DWORD), REG_DWORD);
  542. }
  543. inline DWORD CRegDWORD::GetTypeCode(void)
  544. {
  545. return REG_DWORD;
  546. }
  547. //+-------------------------------------------------------------------------
  548. //
  549. // Class: CRegBINARY
  550. //
  551. // Purpose: Derived class for abstracting Registry binary Values
  552. //
  553. // Interface: CRegBINARY - constructor for registry value using binary data
  554. // ~CRegBINARY - destructor for registry binary data object
  555. // GetBinary - returns the binary data
  556. // SetBinary - sets a new binary data value
  557. // QueryErrorStatus - Should be used to determine if constructor
  558. // completed successfully or not
  559. //
  560. // History: 09/30/92 Rickhi Created
  561. //
  562. // Notes: Derived from CRegValue.
  563. //
  564. // There are three constructors. The first is used if you want
  565. // to create a new value or overwrite the existing value data.
  566. // The second is used if you want to open an existing value
  567. // and read it's data. The third is used if you just want to
  568. // make an object without doing any read/write of the data yet.
  569. // In all three cases, you can always use any of the Get/Set
  570. // operations on the object at a later time.
  571. //
  572. //--------------------------------------------------------------------------
  573. class CRegBINARY : public CRegValue
  574. {
  575. public:
  576. // create/write value constructor
  577. CRegBINARY(const CMyRegKey &crkParent,
  578. LPCSTR pszValueID,
  579. const LPBYTE pbData,
  580. ULONG cbData);
  581. // io-less constructor - used by enumerator
  582. CRegBINARY(const CMyRegKey &crkParent,
  583. LPCSTR pszValueID);
  584. ~CRegBINARY(void){;};
  585. DWORD SetBinary(const LPBYTE pbData, ULONG cbData);
  586. // Caller supplies buffer (supply the buffer size in bytes)
  587. DWORD GetBinary(LPBYTE pbData, ULONG *pcbData);
  588. DWORD GetTypeCode(void);
  589. DWORD QueryErrorStatus(void) { return _dwErr ; }
  590. private:
  591. DWORD _dwErr;
  592. };
  593. //+-------------------------------------------------------------------------
  594. //
  595. // Member: CRegBINARY::CRegBINARY
  596. //
  597. // Purpose: Constructor for registry binary value
  598. //
  599. // History: 09/30/92 Rickhi Created
  600. //
  601. // Notes:
  602. //
  603. //--------------------------------------------------------------------------
  604. inline CRegBINARY::CRegBINARY(const CMyRegKey &crkParent,
  605. LPCSTR pszValueID,
  606. const LPBYTE pbData,
  607. ULONG cbData)
  608. : CRegValue(crkParent, pszValueID)
  609. {
  610. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  611. _dwErr = SetBinary(pbData, cbData);
  612. }
  613. inline CRegBINARY::CRegBINARY(const CMyRegKey &crkParent,
  614. LPCSTR pszValueID)
  615. : CRegValue(crkParent, pszValueID)
  616. {
  617. // automatic actions in header are sufficient
  618. _dwErr = CRegValue::QueryErrorStatus();
  619. }
  620. inline DWORD CRegBINARY::SetBinary(const LPBYTE pbData, ULONG cbData)
  621. {
  622. return SetValue(pbData, cbData, REG_BINARY);
  623. }
  624. inline DWORD CRegBINARY::GetBinary(LPBYTE pbData, ULONG* pcbData)
  625. {
  626. DWORD dwTypeCode;
  627. return GetValue(pbData, pcbData, &dwTypeCode);
  628. }
  629. inline DWORD CRegBINARY::GetTypeCode(void)
  630. {
  631. return REG_BINARY;
  632. }
  633. //+-------------------------------------------------------------------------
  634. //
  635. // Function: DelRegKeyTree
  636. //
  637. // Purpose: This function can be used to deleting a key and all it's
  638. // children.
  639. //
  640. // History: 09/30/93 AlokS Created
  641. //
  642. // Notes: We assume that caller has proper access priviledge
  643. // and the key is non-volatile.
  644. //
  645. //--------------------------------------------------------------------------
  646. DWORD DelRegKeyTree ( HKEY hParent, LPSTR lpszKeyPath);
  647. #endif // __REGISTRY_H__