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.

102 lines
5.3 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: RegistryResources.h
  3. //
  4. // Copyright (c) 1999-2000, Microsoft Corporation
  5. //
  6. // General class definitions that assist in resource management. These are
  7. // typically stack based objects where constructors initialize to a known
  8. // state. Member functions operate on that resource. Destructors release
  9. // resources when the object goes out of scope.
  10. //
  11. // History: 1999-08-18 vtan created
  12. // 1999-11-16 vtan separate file
  13. // 2000-01-31 vtan moved from Neptune to Whistler
  14. // --------------------------------------------------------------------------
  15. #ifndef _RegistryResources_
  16. #define _RegistryResources_
  17. // --------------------------------------------------------------------------
  18. // CRegKey
  19. //
  20. // Purpose: This class operates on the registry and manages the HKEY
  21. // resource.
  22. //
  23. // History: 1999-08-18 vtan created
  24. // 2000-01-31 vtan moved from Neptune to Whistler
  25. // --------------------------------------------------------------------------
  26. class CRegKey
  27. {
  28. private:
  29. CRegKey (const CRegKey& copyObject);
  30. bool operator == (const CRegKey& compareObject) const;
  31. const CRegKey& operator = (const CRegKey& assignObject);
  32. public:
  33. CRegKey (void);
  34. ~CRegKey (void);
  35. LONG Create (HKEY hKey,
  36. LPCTSTR lpSubKey,
  37. DWORD dwOptions,
  38. REGSAM samDesired,
  39. LPDWORD lpdwDisposition);
  40. LONG Open (HKEY hKey,
  41. LPCTSTR lpSubKey,
  42. REGSAM samDesired);
  43. LONG OpenCurrentUser (LPCTSTR lpSubKey,
  44. REGSAM samDesired);
  45. LONG QueryValue (LPCTSTR lpValueName,
  46. LPDWORD lpType,
  47. LPVOID lpData,
  48. LPDWORD lpcbData) const;
  49. LONG SetValue (LPCTSTR lpValueName,
  50. DWORD dwType,
  51. CONST VOID *lpData,
  52. DWORD cbData) const;
  53. LONG DeleteValue (LPCTSTR lpValueName) const;
  54. LONG QueryInfoKey (LPTSTR lpClass,
  55. LPDWORD lpcClass,
  56. LPDWORD lpcSubKeys,
  57. LPDWORD lpcMaxSubKeyLen,
  58. LPDWORD lpcMaxClassLen,
  59. LPDWORD lpcValues,
  60. LPDWORD lpcMaxValueNameLen,
  61. LPDWORD lpcMaxValueLen,
  62. LPDWORD lpcbSecurityDescriptor,
  63. PFILETIME lpftLastWriteTime) const;
  64. void Reset (void);
  65. LONG Next (LPTSTR lpValueName,
  66. LPDWORD lpcValueName,
  67. LPDWORD lpType,
  68. LPVOID lpData,
  69. LPDWORD lpcbData);
  70. LONG GetString (const TCHAR *pszValueName,
  71. TCHAR *pszValueData,
  72. int iStringCount) const;
  73. LONG GetPath (const TCHAR *pszValueName,
  74. TCHAR *pszValueData) const;
  75. LONG GetDWORD (const TCHAR *pszValueName,
  76. DWORD& dwValueData) const;
  77. LONG GetInteger (const TCHAR *pszValueName,
  78. int& iValueData) const;
  79. LONG SetString (const TCHAR *pszValueName,
  80. const TCHAR *pszValueData) const;
  81. LONG SetPath (const TCHAR *pszValueName,
  82. const TCHAR *pszValueData) const;
  83. LONG SetDWORD (const TCHAR *pszValueName,
  84. DWORD dwValueData) const;
  85. LONG SetInteger (const TCHAR *pszValueName,
  86. int iValueData) const;
  87. private:
  88. LONG Close (void);
  89. private:
  90. HKEY _hKey;
  91. DWORD _dwIndex;
  92. };
  93. #endif /* _RegistryResources_ */