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.

753 lines
26 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 EnumValues(SRegValueSet **pprvs);
  156. DWORD EnumKeys(SRegKeySet **pprks);
  157. // This method can be called to determine if
  158. // Object is in sane state or not
  159. DWORD QueryErrorStatus () const { return _dwErr ; }
  160. // Static routine which frees memory allocated during EnumValues/Keys
  161. static void MemFree ( void * pv )
  162. {
  163. delete [] (BYTE*)pv;
  164. }
  165. private:
  166. DWORD CreateKey( HKEY hkParent,
  167. const LPWSTR pwszPath,
  168. REGSAM samDesiredAccess,
  169. const LPWSTR pwszClass,
  170. DWORD dwOptions,
  171. DWORD *pdwDisposition,
  172. const LPSECURITY_ATTRIBUTES pSecurityAttributes
  173. );
  174. DWORD OpenKey ( HKEY hkParent,
  175. const LPWSTR pwszPath,
  176. REGSAM samDesiredAccess
  177. );
  178. HKEY _hkParent; // Handle to parent
  179. HKEY _hkThis; // handle for this key
  180. LPWSTR _Name;
  181. CWCHARBuffer _cwszName; // Buffer containing the registry path
  182. // path from parent key to this key
  183. DWORD _dwErr; // Internal error status
  184. };
  185. inline HKEY CRegKey::GetHandle(void) const
  186. {
  187. return _hkThis;
  188. }
  189. //+-------------------------------------------------------------------------
  190. //
  191. // Class: CRegValue
  192. //
  193. // Purpose: base class for abstracting Registry Values
  194. //
  195. // Interface: CRegValue - constructor for value
  196. // ~CRegValue - destructor for value
  197. // GetKeyHandle - returns handle for parent key
  198. // GetValueID - returns the ValueID name
  199. // GetTypeCode - returns the TypeCode of the data
  200. // GetValue - returns the data associated with the value
  201. // SetValue - sets the data associated with the value
  202. // Delete - deletes the value from the registry
  203. // QueryErrorStatus - Should be used to determine if constructor
  204. // completed successfully or not
  205. //
  206. // History: 09/30/92 Rickhi Created
  207. //
  208. // Notes: This is a base class from which more specific classes are
  209. // derived for each of the different registry value types.
  210. //
  211. //--------------------------------------------------------------------------
  212. class CRegValue
  213. {
  214. public:
  215. CRegValue(const CRegKey& crkParentKey,
  216. const LPWSTR pwszValueID);
  217. ~CRegValue(void){;};
  218. HKEY GetParentHandle(void) const;
  219. const LPWSTR GetValueID(void) const;
  220. VOID Delete(void);
  221. // Caller supplies buffer
  222. DWORD GetValue(LPBYTE pbData, ULONG *pcbData, DWORD *pdwTypeCode);
  223. DWORD SetValue(const LPBYTE pbData, ULONG cbData, DWORD dwTypeCode);
  224. virtual DWORD QueryErrorStatus (void) const { return _dwErr ; }
  225. private:
  226. CWCHARBuffer _cwszValueID;
  227. HKEY _hkParent;
  228. DWORD _dwErr ;
  229. };
  230. //+-------------------------------------------------------------------------
  231. //
  232. // Member: CRegValue::CRegValue
  233. //
  234. // Purpose: constructor for base registry value
  235. //
  236. // Arguments: [prkParent] - ptr to parent CRegKey for the key
  237. // [pwszValueID] - the valueID name for the value
  238. //
  239. // Signals: nothing
  240. //
  241. // Returns: nothing
  242. //
  243. // History: 09/30/92 Rickhi Created
  244. //
  245. // Notes:
  246. //
  247. //--------------------------------------------------------------------------
  248. inline CRegValue::CRegValue(const CRegKey& crkParent,
  249. const LPWSTR pwszValueID)
  250. : _hkParent (crkParent.GetHandle()),
  251. _dwErr(crkParent.QueryErrorStatus())
  252. {
  253. _cwszValueID.Set(pwszValueID);
  254. }
  255. inline HKEY CRegValue::GetParentHandle(void) const
  256. {
  257. return _hkParent;
  258. }
  259. inline const LPWSTR CRegValue::GetValueID(void) const
  260. {
  261. return (const LPWSTR) (LPWSTR) _cwszValueID;
  262. }
  263. inline VOID CRegValue::Delete(void)
  264. {
  265. _dwErr = RegDeleteValue( _hkParent, _cwszValueID );
  266. }
  267. //+-------------------------------------------------------------------------
  268. //
  269. // Class: CRegSZ
  270. //
  271. // Purpose: Derived class for abstracting Registry string Values
  272. //
  273. // Interface: CRegSZ - constructor for registry value using string
  274. // ~CRegSZ - destructor for registry string object
  275. // GetString - returns the string
  276. // SetString - sets a new string value
  277. // QueryErrorStatus - Should be used to determine if constructor
  278. // completed successfully or not
  279. //
  280. // History: 09/30/92 Rickhi Created
  281. //
  282. // Notes: Derived from CRegValue.
  283. //
  284. // There are three constructors. The first is used if you want
  285. // to create a new value or overwrite the existing value data.
  286. // The second is used if you want to open an existing value
  287. // and read it's data. The third is used if you just want to
  288. // make an object without doing any read/write of the data yet.
  289. // In all three cases, you can always use any of the Get/Set
  290. // operations on the object at a later time.
  291. //
  292. //--------------------------------------------------------------------------
  293. class CRegSZ : public CRegValue
  294. {
  295. public:
  296. // create/write value constructor
  297. CRegSZ(const CRegKey &crkParent,
  298. const LPWSTR pwszValueID,
  299. const LPWSTR pwszData
  300. );
  301. // io-less constructor - used by enumerator
  302. CRegSZ(const CRegKey &crkParent,
  303. const LPWSTR pwszValueID
  304. );
  305. ~CRegSZ(void){;};
  306. DWORD SetString(const LPWSTR pwszData);
  307. // Caller supplies buffer (supply the buffer size in bytes)
  308. DWORD GetString( LPWSTR pwszData, ULONG *pcbData);
  309. DWORD GetTypeCode(void);
  310. DWORD QueryErrorStatus(void) const { return _dwErr ; }
  311. private:
  312. DWORD _dwErr;
  313. };
  314. //+-------------------------------------------------------------------------
  315. //
  316. // Member: CRegSZ::CRegSZ
  317. //
  318. // Purpose: Constructor for registry string value
  319. //
  320. // History: 09/30/92 Rickhi Created
  321. //
  322. // Notes:
  323. //
  324. //--------------------------------------------------------------------------
  325. inline CRegSZ::CRegSZ(const CRegKey &crkParent,
  326. const LPWSTR pwszValueID,
  327. const LPWSTR pwszData)
  328. : CRegValue(crkParent, pwszValueID)
  329. {
  330. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  331. _dwErr = SetString(pwszData);
  332. }
  333. inline CRegSZ::CRegSZ(const CRegKey &crkParent,
  334. const LPWSTR pwszValueID)
  335. : CRegValue(crkParent, pwszValueID)
  336. {
  337. // automatic actions in header are sufficient
  338. _dwErr = CRegValue::QueryErrorStatus();
  339. }
  340. inline DWORD CRegSZ::SetString(const LPWSTR pwszData)
  341. {
  342. return SetValue((LPBYTE)pwszData, (wcslen(pwszData)+1)*sizeof(WCHAR), REG_SZ);
  343. }
  344. inline DWORD CRegSZ::GetString(LPWSTR pwszData, ULONG* pcbData)
  345. {
  346. DWORD dwTypeCode;
  347. return GetValue((LPBYTE)pwszData, pcbData, &dwTypeCode);
  348. }
  349. inline DWORD CRegSZ::GetTypeCode(void)
  350. {
  351. return REG_SZ;
  352. }
  353. //+-------------------------------------------------------------------------
  354. //
  355. // Class: CRegMSZ
  356. //
  357. // Purpose: Derived class for abstracting Registry multi-string Values
  358. //
  359. // Interface: CRegMSZ - constructor for registry value using string
  360. // ~CRegMSZ - destructor for registry string object
  361. // GetString - returns the string
  362. // SetString - sets a new string value
  363. // QueryErrorStatus - Should be used to determine if constructor
  364. // completed successfully or not
  365. //
  366. // History: 09/30/92 Rickhi Created
  367. //
  368. // Notes: Derived from CRegValue.
  369. //
  370. // There are three constructors. The first is used if you want
  371. // to create a new value or overwrite the existing value data.
  372. // The second is used if you want to open an existing value
  373. // and read it's data. The third is used if you just want to
  374. // make an object without doing any read/write of the data yet.
  375. // In all three cases, you can always use any of the Get/Set
  376. // operations on the object at a later time.
  377. //
  378. //--------------------------------------------------------------------------
  379. class CRegMSZ : public CRegValue
  380. {
  381. public:
  382. // create/write value constructor
  383. CRegMSZ(const CRegKey &crkParent,
  384. const LPWSTR pwszValueID,
  385. const LPWSTR pwszData
  386. );
  387. // io-less constructor - used by enumerator
  388. CRegMSZ(const CRegKey &crkParent,
  389. const LPWSTR pwszValueID
  390. );
  391. ~CRegMSZ(void){;};
  392. DWORD SetString(const LPWSTR pwszData);
  393. // Caller supplies buffer (supply the buffer size in bytes)
  394. DWORD GetString( LPWSTR pwszData, ULONG *pcbData);
  395. DWORD GetTypeCode(void);
  396. DWORD QueryErrorStatus(void) const { return _dwErr ; }
  397. private:
  398. DWORD _dwErr;
  399. };
  400. //+-------------------------------------------------------------------------
  401. //
  402. // Member: CRegMSZ::CRegMSZ
  403. //
  404. // Purpose: Constructor for registry string value
  405. //
  406. // History: 09/30/92 Rickhi Created
  407. //
  408. // Notes:
  409. //
  410. //--------------------------------------------------------------------------
  411. inline CRegMSZ::CRegMSZ(const CRegKey &crkParent,
  412. const LPWSTR pwszValueID,
  413. const LPWSTR pwszData)
  414. : CRegValue(crkParent, pwszValueID)
  415. {
  416. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  417. _dwErr = SetString(pwszData);
  418. }
  419. inline CRegMSZ::CRegMSZ(const CRegKey &crkParent,
  420. const LPWSTR pwszValueID)
  421. : CRegValue(crkParent, pwszValueID)
  422. {
  423. // automatic actions in header are sufficient
  424. _dwErr = CRegValue::QueryErrorStatus();
  425. }
  426. inline DWORD CRegMSZ::SetString(const LPWSTR pwszData)
  427. {
  428. DWORD cwLen, cbData;
  429. LPWSTR pwszNextString;
  430. for (pwszNextString = pwszData, cbData = 0;
  431. *pwszNextString != UNICODE_NULL;
  432. pwszNextString += cwLen) {
  433. cwLen = wcslen(pwszNextString) + 1;
  434. cbData += (cwLen * sizeof(WCHAR));
  435. }
  436. cbData += sizeof(UNICODE_NULL);
  437. return SetValue((LPBYTE)pwszData, cbData, REG_MULTI_SZ);
  438. }
  439. inline DWORD CRegMSZ::GetString(LPWSTR pwszData, ULONG* pcbData)
  440. {
  441. DWORD dwTypeCode;
  442. return GetValue((LPBYTE)pwszData, pcbData, &dwTypeCode);
  443. }
  444. inline DWORD CRegMSZ::GetTypeCode(void)
  445. {
  446. return REG_MULTI_SZ;
  447. }
  448. //+-------------------------------------------------------------------------
  449. //
  450. // Class: CRegDWORD
  451. //
  452. // Purpose: Derived class for abstracting Registry dword Values
  453. //
  454. // Interface: CRegDWORD - constructor for registry value using dword
  455. // ~CRegDWORD - destructor for registry dword object
  456. // GetDword - returns the dword
  457. // SetDword - sets a new dword value
  458. // QueryErrorStatus - Should be used to determine if constructor
  459. // completed successfully or not
  460. //
  461. // History: 09/30/92 Rickhi Created
  462. //
  463. // Notes: Derived from CRegValue.
  464. //
  465. // There are three constructors. The first is used if you want
  466. // to create a new value or overwrite the existing value data.
  467. // The second is used if you want to open an existing value
  468. // and read it's data. The third is used if you just want to
  469. // make an object without doing any read/write of the data yet.
  470. // In all three cases, you can always use any of the Get/Set
  471. // operations on the object at a later time.
  472. //
  473. //--------------------------------------------------------------------------
  474. class CRegDWORD : public CRegValue
  475. {
  476. public:
  477. // create/write value constructor
  478. CRegDWORD(const CRegKey &crkParent,
  479. const LPWSTR pwszValueID,
  480. DWORD dwData);
  481. // open/read value constructor
  482. CRegDWORD(const CRegKey &crkParent,
  483. const LPWSTR pwszValueID,
  484. DWORD *pdwData);
  485. // io-less constructor - used by enumerator
  486. CRegDWORD( const CRegKey &crkParent,
  487. const LPWSTR pwszValueID);
  488. ~CRegDWORD(void){;};
  489. DWORD SetDword(DWORD dwData);
  490. DWORD GetDword(DWORD *pdwData);
  491. DWORD GetTypeCode(void) ;
  492. DWORD QueryErrorStatus(void) const { return _dwErr ; }
  493. private:
  494. DWORD _dwErr;
  495. };
  496. //+-------------------------------------------------------------------------
  497. //
  498. // Member: CRegDWORD::CRegDWORD
  499. //
  500. // Purpose: Constructor for registry dword value
  501. //
  502. // History: 09/30/92 Rickhi Created
  503. //
  504. // Notes:
  505. //
  506. //--------------------------------------------------------------------------
  507. inline CRegDWORD::CRegDWORD(const CRegKey &crkParent,
  508. const LPWSTR pwszValueID,
  509. DWORD dwData)
  510. : CRegValue(crkParent, pwszValueID)
  511. {
  512. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  513. _dwErr = SetDword(dwData);
  514. }
  515. inline CRegDWORD::CRegDWORD(const CRegKey &crkParent,
  516. const LPWSTR pwszValueID,
  517. DWORD *pdwData)
  518. : CRegValue(crkParent, pwszValueID)
  519. {
  520. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  521. _dwErr = GetDword(pdwData);
  522. }
  523. inline CRegDWORD::CRegDWORD(const CRegKey &crkParent,
  524. const LPWSTR pwszValueID)
  525. : CRegValue(crkParent, pwszValueID)
  526. {
  527. // automatic actions in header are sufficient
  528. _dwErr = CRegValue::QueryErrorStatus();
  529. }
  530. inline DWORD CRegDWORD::GetDword(DWORD *pdwData)
  531. {
  532. DWORD dwTypeCode;
  533. DWORD dwErr;
  534. ULONG cbData= sizeof(DWORD);
  535. dwErr = GetValue((LPBYTE)pdwData, &cbData, &dwTypeCode);
  536. return (dwErr);
  537. }
  538. inline DWORD CRegDWORD::SetDword(DWORD dwData)
  539. {
  540. return SetValue((LPBYTE)&dwData, sizeof(DWORD), REG_DWORD);
  541. }
  542. inline DWORD CRegDWORD::GetTypeCode(void)
  543. {
  544. return REG_DWORD;
  545. }
  546. //+-------------------------------------------------------------------------
  547. //
  548. // Class: CRegBINARY
  549. //
  550. // Purpose: Derived class for abstracting Registry binary Values
  551. //
  552. // Interface: CRegBINARY - constructor for registry value using binary data
  553. // ~CRegBINARY - destructor for registry binary data object
  554. // GetBinary - returns the binary data
  555. // SetBinary - sets a new binary data value
  556. // QueryErrorStatus - Should be used to determine if constructor
  557. // completed successfully or not
  558. //
  559. // History: 09/30/92 Rickhi Created
  560. //
  561. // Notes: Derived from CRegValue.
  562. //
  563. // There are three constructors. The first is used if you want
  564. // to create a new value or overwrite the existing value data.
  565. // The second is used if you want to open an existing value
  566. // and read it's data. The third is used if you just want to
  567. // make an object without doing any read/write of the data yet.
  568. // In all three cases, you can always use any of the Get/Set
  569. // operations on the object at a later time.
  570. //
  571. //--------------------------------------------------------------------------
  572. class CRegBINARY : public CRegValue
  573. {
  574. public:
  575. // create/write value constructor
  576. CRegBINARY(const CRegKey &crkParent,
  577. const LPWSTR pwszValueID,
  578. const LPBYTE pbData,
  579. ULONG cbData);
  580. // io-less constructor - used by enumerator
  581. CRegBINARY(const CRegKey &crkParent,
  582. const LPWSTR pwszValueID);
  583. ~CRegBINARY(void){;};
  584. DWORD SetBinary(const LPBYTE pbData, ULONG cbData);
  585. // Caller supplies buffer (supply the buffer size in bytes)
  586. DWORD GetBinary(LPBYTE pbData, ULONG *pcbData);
  587. DWORD GetTypeCode(void);
  588. DWORD QueryErrorStatus(void) { return _dwErr ; }
  589. private:
  590. DWORD _dwErr;
  591. };
  592. //+-------------------------------------------------------------------------
  593. //
  594. // Member: CRegBINARY::CRegBINARY
  595. //
  596. // Purpose: Constructor for registry binary value
  597. //
  598. // History: 09/30/92 Rickhi Created
  599. //
  600. // Notes:
  601. //
  602. //--------------------------------------------------------------------------
  603. inline CRegBINARY::CRegBINARY(const CRegKey &crkParent,
  604. const LPWSTR pwszValueID,
  605. const LPBYTE pbData,
  606. ULONG cbData)
  607. : CRegValue(crkParent, pwszValueID)
  608. {
  609. if (ERROR_SUCCESS == (_dwErr = CRegValue::QueryErrorStatus()))
  610. _dwErr = SetBinary(pbData, cbData);
  611. }
  612. inline CRegBINARY::CRegBINARY(const CRegKey &crkParent,
  613. const LPWSTR pwszValueID)
  614. : CRegValue(crkParent, pwszValueID)
  615. {
  616. // automatic actions in header are sufficient
  617. _dwErr = CRegValue::QueryErrorStatus();
  618. }
  619. inline DWORD CRegBINARY::SetBinary(const LPBYTE pbData, ULONG cbData)
  620. {
  621. return SetValue(pbData, cbData, REG_BINARY);
  622. }
  623. inline DWORD CRegBINARY::GetBinary(LPBYTE pbData, ULONG* pcbData)
  624. {
  625. DWORD dwTypeCode;
  626. return GetValue(pbData, pcbData, &dwTypeCode);
  627. }
  628. inline DWORD CRegBINARY::GetTypeCode(void)
  629. {
  630. return REG_BINARY;
  631. }
  632. //+-------------------------------------------------------------------------
  633. //
  634. // Function: DelRegKeyTree
  635. //
  636. // Purpose: This function can be used to deleting a key and all it's
  637. // children.
  638. //
  639. // History: 09/30/93 AlokS Created
  640. //
  641. // Notes: We assume that caller has proper access priviledge
  642. // and the key is non-volatile.
  643. //
  644. //--------------------------------------------------------------------------
  645. DWORD DelRegKeyTree ( HKEY hParent, LPWSTR lpwszKeyPath);
  646. #endif // __DSYSREG_HXX__