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.

77 lines
2.2 KiB

  1. //@doc
  2. /******************************************************
  3. **
  4. ** @module REGISTRY.H | Definition of RegistryKey class
  5. **
  6. ** Description:
  7. **
  8. ** History:
  9. ** Created 12/16/97 Matthew L. Coill (mlc)
  10. **
  11. ** (c) 1986-1997 Microsoft Corporation. All Rights Reserved.
  12. ******************************************************/
  13. #ifndef __REGISTRY_H__
  14. #define __REGISTRY_H__
  15. #include <windows.h>
  16. #ifndef override
  17. #define override
  18. #endif
  19. //
  20. // @class RegistryKey class
  21. //
  22. class RegistryKey
  23. {
  24. //@access Constructor/Destructor
  25. public:
  26. //@cmember constructor
  27. RegistryKey(HKEY osKey) : m_OSRegistryKey(osKey), m_ShouldClose(FALSE), m_pReferenceCount(NULL) {};
  28. RegistryKey(RegistryKey& rkey);
  29. //@cmember destructor
  30. ~RegistryKey();
  31. RegistryKey CreateSubkey(const TCHAR* subkeyName, const TCHAR* typeName = TEXT("REG_SZ"));
  32. RegistryKey OpenSubkey(const TCHAR* subkeyName, REGSAM access = KEY_READ);
  33. RegistryKey OpenCreateSubkey(const TCHAR* subkeyName);
  34. HRESULT RemoveSubkey(const TCHAR* subkeyName);
  35. HRESULT QueryValue(const TCHAR* valueName, BYTE* pEntryData, DWORD& dataSize);
  36. HRESULT SetValue(const TCHAR* valueName, const BYTE* pData, DWORD dataSize, DWORD dataType);
  37. DWORD GetNumSubkeys() const;
  38. virtual RegistryKey& operator=(RegistryKey& rhs);
  39. BOOL operator==(const RegistryKey& comparee);
  40. BOOL operator!=(const RegistryKey& comparee);
  41. void ShouldClose(BOOL closeable) { m_ShouldClose = closeable; }
  42. //@access private data members
  43. private:
  44. HKEY m_OSRegistryKey;
  45. BOOL m_ShouldClose; // Should only close keys we create
  46. UINT* m_pReferenceCount;
  47. };
  48. //
  49. // @class UnassignableRegistryKey class
  50. //
  51. class UnassignableRegistryKey : public RegistryKey
  52. {
  53. //@access Constructor/Destructor
  54. public:
  55. //@cmember constructor
  56. UnassignableRegistryKey(HKEY osKey) : RegistryKey(osKey) {};
  57. //@access private data members
  58. private:
  59. UnassignableRegistryKey(RegistryKey& rkey);
  60. override RegistryKey& operator=(RegistryKey& rhs) { return *this; } // vtable requires definition?
  61. };
  62. extern UnassignableRegistryKey c_InvalidKey; /* const unassignable, but not const immutable */
  63. #endif __REGISTRY_H__