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.

200 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. All rights reserved.
  4. Module Name:
  5. dbgreg.cxx
  6. Abstract:
  7. Debug Registry class header
  8. Author:
  9. Steve Kiraly (SteveKi) 18-Jun-1998
  10. Revision History:
  11. --*/
  12. #ifndef _DBGREG_HXX_
  13. #define _DBGREG_HXX_
  14. DEBUG_NS_BEGIN
  15. class TDebugRegApis
  16. {
  17. public:
  18. typedef LONG (APIENTRY *pfRegCreateKeyEx)( HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD );
  19. typedef LONG (APIENTRY *pfRegOpenKeyEx)(HKEY, LPCTSTR, DWORD, REGSAM, PHKEY );
  20. typedef LONG (APIENTRY *pfRegCloseKey)( HKEY );
  21. typedef LONG (APIENTRY *pfRegQueryValueEx)(HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
  22. typedef LONG (APIENTRY *pfRegSetValueEx)(HKEY, LPCTSTR, DWORD, DWORD, CONST BYTE*, DWORD );
  23. typedef LONG (APIENTRY *pfRegEnumKeyEx)(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPTSTR, LPDWORD, PFILETIME );
  24. typedef LONG (APIENTRY *pfRegDeleteKey)(HKEY, LPCTSTR );
  25. typedef LONG (APIENTRY *pfRegDeleteValue)(HKEY, LPCTSTR );
  26. TDebugRegApis::
  27. TDebugRegApis(
  28. VOID
  29. );
  30. BOOL
  31. TDebugRegApis::
  32. bValid(
  33. VOID
  34. ) const;
  35. pfRegCreateKeyEx m_CreateKeyEx;
  36. pfRegOpenKeyEx m_OpenKeyEx;
  37. pfRegCloseKey m_CloseKey;
  38. pfRegQueryValueEx m_QueryValueEx;
  39. pfRegSetValueEx m_SetValueEx;
  40. pfRegEnumKeyEx m_EnumKeyEx;
  41. pfRegDeleteKey m_DeleteKey;
  42. pfRegDeleteValue m_DeleteValue;
  43. private:
  44. //
  45. // Copying and assignment are not defined.
  46. //
  47. TDebugRegApis(
  48. const TDebugRegApis &
  49. );
  50. TDebugRegApis&
  51. operator =(
  52. const TDebugRegApis &
  53. );
  54. TDebugLibrary m_Lib;
  55. BOOL m_bValid;
  56. };
  57. class TDebugRegistry
  58. {
  59. public:
  60. enum EIoFlags
  61. {
  62. kRead = 1 << 0,
  63. kWrite = 1 << 1,
  64. kCreate = 1 << 2,
  65. kOpen = 1 << 3,
  66. };
  67. enum EConstants
  68. {
  69. kHint = 256,
  70. };
  71. TDebugRegistry(
  72. IN LPCTSTR pszSection,
  73. IN UINT ioFlags,
  74. IN HKEY hOpenedKey = HKEY_CURRENT_USER
  75. );
  76. ~TDebugRegistry(
  77. VOID
  78. );
  79. BOOL
  80. bValid(
  81. VOID
  82. ) const;
  83. DWORD
  84. LastError(
  85. VOID
  86. ) const;
  87. BOOL
  88. bRead(
  89. IN LPCTSTR pValueName,
  90. IN OUT DWORD &dwValue
  91. );
  92. BOOL
  93. bRead(
  94. IN LPCTSTR pValueName,
  95. IN OUT BOOL &bValue
  96. );
  97. BOOL
  98. bRead(
  99. IN LPCTSTR pValueName,
  100. IN OUT TDebugString &strValue
  101. );
  102. BOOL
  103. bRead(
  104. IN LPCTSTR pValueName,
  105. IN OUT PVOID pValue,
  106. IN DWORD cbSize,
  107. OUT LPDWORD pcbNeeded = NULL
  108. );
  109. BOOL
  110. bWrite(
  111. IN LPCTSTR pValueName,
  112. IN const DWORD dwValue
  113. );
  114. BOOL
  115. bWrite(
  116. IN LPCTSTR pValueName,
  117. IN LPCTSTR pszValue
  118. );
  119. BOOL
  120. bWrite(
  121. IN LPCTSTR pValueName,
  122. IN const PVOID pValue,
  123. IN DWORD cbSize
  124. );
  125. BOOL
  126. bRemove(
  127. IN LPCTSTR pValueName
  128. );
  129. BOOL
  130. bRemoveKey(
  131. IN LPCTSTR pKeyName
  132. );
  133. private:
  134. //
  135. // Copying and assignment are not defined.
  136. //
  137. TDebugRegistry(
  138. const TDebugRegistry &
  139. );
  140. TDebugRegistry&
  141. operator =(
  142. const TDebugRegistry &
  143. );
  144. DWORD
  145. dwRecursiveRegDeleteKey(
  146. IN HKEY hKey,
  147. IN LPCTSTR pszSubkey
  148. ) const;
  149. TDebugString m_strSection;
  150. HKEY m_hKey;
  151. DWORD m_Status;
  152. TDebugRegApis m_Reg;
  153. };
  154. DEBUG_NS_END
  155. #endif