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.

154 lines
2.4 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1997 - 1997
  3. All rights reserved.
  4. Module Name:
  5. persist.hxx
  6. Abstract:
  7. Persistent store class headers.
  8. Author:
  9. Steve Kiraly (SteveKi) 05/12/97
  10. Revision History:
  11. --*/
  12. #ifndef _PERSIST_HXX
  13. #define _PERSIST_HXX
  14. /********************************************************************
  15. Persistant registry store class.
  16. ********************************************************************/
  17. class TPersist
  18. {
  19. public:
  20. enum EIoFlags
  21. {
  22. kRead = 1 << 0,
  23. kWrite = 1 << 1,
  24. kCreate = 1 << 2,
  25. kOpen = 1 << 3,
  26. };
  27. enum EConstants
  28. {
  29. kHint = 256,
  30. };
  31. TPersist(
  32. IN LPCTSTR pszSection,
  33. IN UINT ioFlags,
  34. IN HKEY hOpenedKey = HKEY_CURRENT_USER
  35. );
  36. ~TPersist(
  37. VOID
  38. );
  39. BOOL
  40. bValid(
  41. VOID
  42. ) const;
  43. DWORD
  44. dwLastError(
  45. VOID
  46. ) const;
  47. BOOL
  48. bRead(
  49. IN LPCTSTR pValueName,
  50. IN OUT DWORD &dwValue
  51. );
  52. BOOL
  53. bRead(
  54. IN LPCTSTR pValueName,
  55. IN OUT BOOL &bValue
  56. );
  57. BOOL
  58. bRead(
  59. IN LPCTSTR pValueName,
  60. IN OUT TString &strValue
  61. );
  62. BOOL
  63. bRead(
  64. IN LPCTSTR pValueName,
  65. IN OUT PVOID pValue,
  66. IN DWORD cbSize,
  67. OUT LPDWORD pcbNeeded = NULL
  68. );
  69. BOOL
  70. bWrite(
  71. IN LPCTSTR pValueName,
  72. IN const DWORD dwValue
  73. );
  74. BOOL
  75. bWrite(
  76. IN LPCTSTR pValueName,
  77. IN LPCTSTR pszValue
  78. );
  79. BOOL
  80. bWrite(
  81. IN LPCTSTR pValueName,
  82. IN const PVOID pValue,
  83. IN DWORD cbSize
  84. );
  85. BOOL
  86. bRemove(
  87. IN LPCTSTR pValueName
  88. );
  89. BOOL
  90. bRemoveKey(
  91. IN LPCTSTR pKeyName
  92. );
  93. private:
  94. //
  95. // Copying and assignment are not defined.
  96. //
  97. TPersist( const TPersist & );
  98. TPersist& operator =( const TPersist & );
  99. DWORD
  100. dwRecursiveRegDeleteKey(
  101. IN HKEY hKey,
  102. IN LPCTSTR pszSubkey
  103. ) const;
  104. TString strSection_;
  105. HKEY hKey_;
  106. DWORD dwStatus_;
  107. };
  108. #if DBG
  109. VOID
  110. TestPersistClass(
  111. VOID
  112. );
  113. #endif
  114. #endif