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.

754 lines
25 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1992, Microsoft Corporation.
  4. //
  5. // File: dsysreg.hxx
  6. //
  7. // Contents: Definitions of classes for manipulating registry entries.
  8. //
  9. // Classes: CRegKey - 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. // 09/22/93 AlokS Took out exception throwing code
  18. // and added proper return code for
  19. // each method.
  20. //
  21. // 07/26/94 AlokS Made it lightweight for normal set/get
  22. // operations. Threw out all exception code
  23. //
  24. // Notes: CRegKey can use another CRegKey as a parent, so you can
  25. // build a tree of keys. To kick things off, you can give one
  26. // of the default registry keys like HKEY_CURRENT_USER. When
  27. // you do this, the GetParent method returns NULL. Currently
  28. // however, no ptrs are kept to child and sibling keys.
  29. //
  30. // CRegValue is a base class for dealing with registry values.
  31. // The other classes (except CRegKey) are for dealing with a
  32. // specific type of registry value in the native data format.
  33. // For example, CRegDWORD lets you call methods just providing
  34. // a dword. The methods take care of figuring out the size and
  35. // casting the dword to a ptr to bytes, etc for use in the Win32
  36. // registry APIs.
  37. //
  38. // For any registry type not defined here, you can always resort
  39. // to using the CRegValue base class directly, though you then
  40. // must call GetValue or SetValue methods explicitly.
  41. //
  42. // Sample Usage:
  43. //
  44. // The following reads the username in the ValueID UserName
  45. // within the key HKEY_CURRENT_USER\LogonInfo. It then changes
  46. // it to Rickhi. It also sets the password valueid in the
  47. // the same key to foobar.
  48. //
  49. // #include <dsysreg.hxx>
  50. //
  51. // // open the registry key
  52. // CRegKey rkLogInfo(HKEY_CURRENT_USER, L"LogonInfo");
  53. //
  54. // // read the user name
  55. // LPWSTR pwszUserName;
  56. // CRegSZ rszUserName(&rkLogInfo, L"UserName", pwszUserName);
  57. // rszUserName.SetString(L"Rickhi");
  58. //
  59. // // set the password
  60. // CRegSZ rszPassWord(&rkLogInfo, L"PassWord", L"foobar");
  61. //
  62. //----------------------------------------------------------------------------
  63. #ifndef __DSYSREG_HXX__
  64. #define __DSYSREG_HXX__
  65. #include "wcbuffer.hxx"
  66. // to simplify error creation
  67. #define Creg_ERROR(x) (x)
  68. // forward declarations for use in the following structures
  69. class CRegValue;
  70. class CRegKey;
  71. // structure for enumerating subkeys of a key
  72. typedef struct _SRegKeySet
  73. {
  74. ULONG cKeys;
  75. CRegKey *aprkKey[1];
  76. } SRegKeySet;
  77. // structure for enumerating values within a key
  78. typedef struct _SRegValueSet
  79. {
  80. ULONG cValues;
  81. CRegValue *aprvValue[1];
  82. } SRegValueSet;
  83. // structure for dealing with multi-string values
  84. typedef struct _SMultiStringSet
  85. {
  86. ULONG cStrings;
  87. LPWSTR apwszString[1];
  88. } SMultiStringSet;
  89. //+-------------------------------------------------------------------------
  90. //
  91. // Class: CRegKey
  92. //
  93. // Purpose: class for abstracting Registry Keys
  94. //
  95. // Interface: CRegKey - constructor for a registry key object
  96. // ~CRegKey - destructor for a registry key object
  97. // GetParentHandle - returns parent key's handle
  98. // GetHandle - returns this key's handle
  99. // GetName - returns key path
  100. // Delete - deletes the key from the registry
  101. // EnumValues - enumerate values stored in the key
  102. // EnumKeys - enumerates subkeys of the key
  103. // NotifyChange - sets up change notification for the key
  104. // QueryErrorStatus - Should be used to determine if constructor
  105. // completed successfully or not
  106. // History: 09/30/92 Rickhi Created
  107. //
  108. // Notes:
  109. //
  110. //--------------------------------------------------------------------------
  111. class CRegKey
  112. {
  113. public:
  114. // constructor using HKEY for parent
  115. // Mode: Create key if not present
  116. CRegKey( HKEY hkParent,
  117. const LPWSTR pwszPath,
  118. // remaining parameters are optional
  119. REGSAM samDesiredAccess = KEY_ALL_ACCESS,
  120. const LPWSTR pwszClass = NULL,
  121. DWORD dwOptions = REG_OPTION_NON_VOLATILE,
  122. DWORD *pdwDisposition = NULL,
  123. const LPSECURITY_ATTRIBUTES pSecurityAttributes = NULL
  124. );
  125. // constructor using CRegKey as parent
  126. // Mode: Create key if not present
  127. CRegKey(const CRegKey& crkParent,
  128. const LPWSTR pwszPath,
  129. // remaining parameters are optional
  130. REGSAM samDesiredAccess = KEY_ALL_ACCESS,
  131. const LPWSTR pwszClass = NULL,
  132. DWORD dwOptions = REG_OPTION_NON_VOLATILE,
  133. DWORD *pdwDisposition = NULL,
  134. const LPSECURITY_ATTRIBUTES pSecurityAttributes = NULL
  135. );
  136. // Constructor using HKEY for parent
  137. // Mode: Simply Open the key, if exists
  138. CRegKey (
  139. HKEY hkParent,
  140. DWORD *pdwErr,
  141. const LPWSTR pwszPath,
  142. REGSAM samDesiredAccess = KEY_ALL_ACCESS
  143. );
  144. // Constructor using CRegKey as parent
  145. // Mode: Simply open the key, if exists
  146. CRegKey (const CRegKey& crkParent,
  147. DWORD *pdwErr,
  148. const LPWSTR pwszPath,
  149. REGSAM samDesiredAccess = KEY_ALL_ACCESS
  150. );
  151. // Destructor - Closes registry key
  152. ~CRegKey(void);
  153. HKEY GetHandle(void) const;
  154. DWORD Delete(void);
  155. DWORD DeleteChildren(void);
  156. DWORD EnumValues(SRegValueSet **pprvs);
  157. DWORD EnumKeys(SRegKeySet **pprks);
  158. // This method can be called to determine if
  159. // Object is in sane state or not
  160. DWORD QueryErrorStatus () const { return _dwErr ; }
  161. // Static routine which frees memory allocated during EnumValues/Keys
  162. static void MemFree ( void * pv )
  163. {
  164. delete [] (BYTE*)pv;
  165. }
  166. private:
  167. DWORD CreateKey( HKEY hkParent,
  168. const LPWSTR pwszPath,
  169. REGSAM samDesiredAccess,
  170. const LPWSTR pwszClass,
  171. DWORD dwOptions,
  172. DWORD *pdwDisposition,
  173. const LPSECURITY_ATTRIBUTES pSecurityAttributes
  174. );
  175. DWORD OpenKey ( HKEY hkParent,
  176. const LPWSTR pwszPath,
  177. REGSAM samDesiredAccess
  178. );
  179. HKEY _hkParent; // Handle to parent
  180. HKEY _hkThis; // handle for this key
  181. LPWSTR _Name;
  182. CWCHARBuffer _cwszName; // Buffer containing the registry path
  183. // path from parent key to this key
  184. DWORD _dwErr; // Internal error status
  185. };
  186. inline HKEY CRegKey::GetHandle(void) const
  187. {
  188. return _hkThis;
  189. }
  190. //+-------------------------------------------------------------------------
  191. //
  192. // Class: CRegValue
  193. //
  194. // Purpose: base class for abstracting Registry Values
  195. //
  196. // Interface: CRegValue - constructor for value
  197. // ~CRegValue - destructor for value
  198. // GetKeyHandle - returns handle for parent key
  199. // GetValueID - returns the ValueID name
  200. // GetTypeCode - returns the TypeCode of the data
  201. // GetValue - returns the data associated with the value
  202. // SetValue - sets the data associated with the value
  203. // Delete - deletes the value from the registry
  204. // QueryErrorStatus - Should be used to determine if constructor
  205. // completed successfully or not
  206. //
  207. // History: 09/30/92 Rickhi Created
  208. //
  209. // Notes: This is a base class from which more specific classes are
  210. // derived for each of the different registry value types.
  211. //
  212. //--------------------------------------------------------------------------
  213. class CRegValue
  214. {
  215. public:
  216. CRegValue(const CRegKey& crkParentKey,
  217. const LPWSTR pwszValueID);
  218. ~CRegValue(void){;};
  219. HKEY GetParentHandle(void) const;
  220. const LPWSTR GetValueID(void) const;
  221. VOID Delete(void);
  222. // Caller supplies buffer
  223. DWORD GetValue(LPBYTE pbData, ULONG *pcbData, DWORD *pdwTypeCode);
  224. DWORD SetValue(const LPBYTE pbData, ULONG cbData, DWORD dwTypeCode);
  225. virtual DWORD QueryErrorStatus (void) const { return _dwErr ; }
  226. private:
  227. CWCHARBuffer _cwszValueID;
  228. HKEY _hkParent;
  229. DWORD _dwErr ;
  230. };
  231. //+-------------------------------------------------------------------------
  232. //
  233. // Member: CRegValue::CRegValue
  234. //
  235. // Purpose: constructor for base registry value
  236. //
  237. // Arguments: [prkParent] - ptr to parent CRegKey for the key
  238. // [pwszValueID] - the valueID name for the value
  239. //
  240. // Signals: nothing
  241. //
  242. // Returns: nothing
  243. //
  244. // History: 09/30/92 Rickhi Created
  245. //
  246. // Notes:
  247. //
  248. //--------------------------------------------------------------------------
  249. inline CRegValue::CRegValue(const CRegKey& crkParent,
  250. const LPWSTR pwszValueID)
  251. : _hkParent (crkParent.GetHandle()),
  252. _dwErr(crkParent.QueryErrorStatus())
  253. {
  254. _cwszValueID.Set(pwszValueID);
  255. }
  256. inline HKEY CRegValue::GetParentHandle(void) const
  257. {
  258. return _hkParent;
  259. }
  260. inline const LPWSTR CRegValue::GetValueID(void) const
  261. {
  262. return (const LPWSTR) (LPWSTR) _cwszValueID;
  263. }
  264. inline VOID CRegValue::Delete(void)
  265. {
  266. _dwErr = RegDeleteValue( _hkParent, _cwszValueID );
  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 CRegKey &crkParent,
  299. const LPWSTR pwszValueID,
  300. const LPWSTR pwszData
  301. );
  302. // io-less constructor - used by enumerator
  303. CRegSZ(const CRegKey &crkParent,
  304. const LPWSTR pwszValueID
  305. );
  306. ~CRegSZ(void){;};
  307. DWORD SetString(const LPWSTR pwszData);
  308. // Caller supplies buffer (supply the buffer size in bytes)
  309. DWORD GetString( LPWSTR pwszData, 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 CRegKey &crkParent,
  327. const LPWSTR pwszValueID,
  328. const LPWSTR pwszData)
  329. : CRegValue(crkParent, pwszValueID)
  330. {
  331. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  332. _dwErr = SetString(pwszData);
  333. }
  334. inline CRegSZ::CRegSZ(const CRegKey &crkParent,
  335. const LPWSTR pwszValueID)
  336. : CRegValue(crkParent, pwszValueID)
  337. {
  338. // automatic actions in header are sufficient
  339. _dwErr = CRegValue::QueryErrorStatus();
  340. }
  341. inline DWORD CRegSZ::SetString(const LPWSTR pwszData)
  342. {
  343. return SetValue((LPBYTE)pwszData, (wcslen(pwszData)+1)*sizeof(WCHAR), REG_SZ);
  344. }
  345. inline DWORD CRegSZ::GetString(LPWSTR pwszData, ULONG* pcbData)
  346. {
  347. DWORD dwTypeCode;
  348. return GetValue((LPBYTE)pwszData, 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 CRegKey &crkParent,
  385. const LPWSTR pwszValueID,
  386. const LPWSTR pwszData
  387. );
  388. // io-less constructor - used by enumerator
  389. CRegMSZ(const CRegKey &crkParent,
  390. const LPWSTR pwszValueID
  391. );
  392. ~CRegMSZ(void){;};
  393. DWORD SetString(const LPWSTR pwszData);
  394. // Caller supplies buffer (supply the buffer size in bytes)
  395. DWORD GetString( LPWSTR pwszData, 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 CRegKey &crkParent,
  413. const LPWSTR pwszValueID,
  414. const LPWSTR pwszData)
  415. : CRegValue(crkParent, pwszValueID)
  416. {
  417. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  418. _dwErr = SetString(pwszData);
  419. }
  420. inline CRegMSZ::CRegMSZ(const CRegKey &crkParent,
  421. const LPWSTR pwszValueID)
  422. : CRegValue(crkParent, pwszValueID)
  423. {
  424. // automatic actions in header are sufficient
  425. _dwErr = CRegValue::QueryErrorStatus();
  426. }
  427. inline DWORD CRegMSZ::SetString(const LPWSTR pwszData)
  428. {
  429. DWORD cwLen, cbData;
  430. LPWSTR pwszNextString;
  431. for (pwszNextString = pwszData, cbData = 0;
  432. *pwszNextString != UNICODE_NULL;
  433. pwszNextString += cwLen) {
  434. cwLen = wcslen(pwszNextString) + 1;
  435. cbData += (cwLen * sizeof(WCHAR));
  436. }
  437. cbData += sizeof(UNICODE_NULL);
  438. return SetValue((LPBYTE)pwszData, cbData, REG_MULTI_SZ);
  439. }
  440. inline DWORD CRegMSZ::GetString(LPWSTR pwszData, ULONG* pcbData)
  441. {
  442. DWORD dwTypeCode;
  443. return GetValue((LPBYTE)pwszData, 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 CRegKey &crkParent,
  480. const LPWSTR pwszValueID,
  481. DWORD dwData);
  482. // open/read value constructor
  483. CRegDWORD(const CRegKey &crkParent,
  484. const LPWSTR pwszValueID,
  485. DWORD *pdwData);
  486. // io-less constructor - used by enumerator
  487. CRegDWORD( const CRegKey &crkParent,
  488. const LPWSTR pwszValueID);
  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 CRegKey &crkParent,
  509. const LPWSTR pwszValueID,
  510. DWORD dwData)
  511. : CRegValue(crkParent, pwszValueID)
  512. {
  513. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  514. _dwErr = SetDword(dwData);
  515. }
  516. inline CRegDWORD::CRegDWORD(const CRegKey &crkParent,
  517. const LPWSTR pwszValueID,
  518. DWORD *pdwData)
  519. : CRegValue(crkParent, pwszValueID)
  520. {
  521. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  522. _dwErr = GetDword(pdwData);
  523. }
  524. inline CRegDWORD::CRegDWORD(const CRegKey &crkParent,
  525. const LPWSTR pwszValueID)
  526. : CRegValue(crkParent, pwszValueID)
  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 CRegKey &crkParent,
  578. const LPWSTR pwszValueID,
  579. const LPBYTE pbData,
  580. ULONG cbData);
  581. // io-less constructor - used by enumerator
  582. CRegBINARY(const CRegKey &crkParent,
  583. const LPWSTR pwszValueID);
  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 CRegKey &crkParent,
  605. const LPWSTR pwszValueID,
  606. const LPBYTE pbData,
  607. ULONG cbData)
  608. : CRegValue(crkParent, pwszValueID)
  609. {
  610. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  611. _dwErr = SetBinary(pbData, cbData);
  612. }
  613. inline CRegBINARY::CRegBINARY(const CRegKey &crkParent,
  614. const LPWSTR pwszValueID)
  615. : CRegValue(crkParent, pwszValueID)
  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, LPWSTR lpwszKeyPath);
  647. #endif // __DSYSREG_HXX__