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.

78 lines
2.3 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 OpenNextSubkey(ULONG& ulCookie, TCHAR* subkeyName = NULL, REGSAM access = KEY_READ);
  34. RegistryKey OpenCreateSubkey(const TCHAR* subkeyName);
  35. HRESULT RemoveSubkey(const TCHAR* subkeyName);
  36. HRESULT QueryValue(const TCHAR* valueName, BYTE* pEntryData, DWORD& dataSize);
  37. HRESULT SetValue(const TCHAR* valueName, const BYTE* pData, DWORD dataSize, DWORD dataType);
  38. DWORD GetNumSubkeys() const;
  39. virtual RegistryKey& operator=(RegistryKey& rhs);
  40. BOOL operator==(const RegistryKey& comparee);
  41. BOOL operator!=(const RegistryKey& comparee);
  42. void ShouldClose(BOOL closeable) { m_ShouldClose = closeable; }
  43. //@access private data members
  44. private:
  45. HKEY m_OSRegistryKey;
  46. BOOL m_ShouldClose; // Should only close keys we create
  47. UINT* m_pReferenceCount;
  48. };
  49. //
  50. // @class UnassignableRegistryKey class
  51. //
  52. class UnassignableRegistryKey : public RegistryKey
  53. {
  54. //@access Constructor/Destructor
  55. public:
  56. //@cmember constructor
  57. UnassignableRegistryKey(HKEY osKey) : RegistryKey(osKey) {};
  58. //@access private data members
  59. private:
  60. UnassignableRegistryKey(RegistryKey& rkey);
  61. override RegistryKey& operator=(RegistryKey& rhs) { return *this; } // vtable requires definition?
  62. };
  63. extern UnassignableRegistryKey c_InvalidKey; /* const unassignable, but not const immutable */
  64. #endif __REGISTRY_H__