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.

394 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1991-2000 Microsoft Corporation
  3. Module Name:
  4. regvalue.hxx
  5. Abstract:
  6. This module contains the declarations for the REGISTRY_VALUE_ENTRY class.
  7. This class models a value entry of a registry key.
  8. It contains:
  9. -value name
  10. -title index
  11. -data type
  12. -buffer that contains the data in a value entry
  13. Author:
  14. Jaime Sasson (jaimes) 06-Aug-1991
  15. Environment:
  16. Ulib, User Mode
  17. --*/
  18. #if !defined( _REGISTRY_VALUE_ENTRY_ )
  19. #define _REGISTRY_VALUE_ENTRY_
  20. #include "ulib.hxx"
  21. #include "wstring.hxx"
  22. //
  23. // Declare primitive value types.
  24. //
  25. typedef enum _REG_TYPE {
  26. TYPE_REG_NONE = REG_NONE,
  27. TYPE_REG_SZ = REG_SZ,
  28. TYPE_REG_EXPAND_SZ = REG_EXPAND_SZ,
  29. TYPE_REG_BINARY = REG_BINARY,
  30. TYPE_REG_DWORD = REG_DWORD,
  31. TYPE_REG_MULTI_SZ = REG_MULTI_SZ,
  32. TYPE_REG_RESOURCE_LIST= REG_RESOURCE_LIST,
  33. TYPE_REG_FULL_RESOURCE_DESCRIPTOR= REG_FULL_RESOURCE_DESCRIPTOR,
  34. TYPE_REG_RESOURCE_REQUIREMENTS_LIST= REG_RESOURCE_REQUIREMENTS_LIST,
  35. TYPE_UNKNOWN
  36. } REG_TYPE;
  37. DECLARE_CLASS( REGISTRY );
  38. DECLARE_CLASS( REGISTRY_VALUE_ENTRY );
  39. class REGISTRY_VALUE_ENTRY : public OBJECT {
  40. FRIEND class REGISTRY;
  41. public:
  42. DECLARE_CONSTRUCTOR( REGISTRY_VALUE_ENTRY );
  43. DECLARE_CAST_MEMBER_FUNCTION( REGISTRY_VALUE_ENTRY );
  44. VIRTUAL
  45. ~REGISTRY_VALUE_ENTRY(
  46. );
  47. NONVIRTUAL
  48. BOOLEAN
  49. Initialize(
  50. IN PCWSTRING ValueName,
  51. IN ULONG TitleIndex,
  52. IN REG_TYPE Type,
  53. IN PCBYTE Data DEFAULT NULL,
  54. IN ULONG Size DEFAULT 0
  55. );
  56. NONVIRTUAL
  57. ULONG
  58. GetData(
  59. OUT PCBYTE* Data
  60. ) CONST;
  61. NONVIRTUAL
  62. PCWSTRING
  63. GetName(
  64. ) CONST;
  65. NONVIRTUAL
  66. ULONG
  67. GetTitleIndex(
  68. ) CONST;
  69. NONVIRTUAL
  70. REG_TYPE
  71. GetType(
  72. ) CONST;
  73. NONVIRTUAL
  74. BOOLEAN
  75. PutData(
  76. IN PCBYTE Data,
  77. IN ULONG DataSize
  78. );
  79. #if DBG
  80. NONVIRTUAL
  81. VOID
  82. DbgPrintValueEntry(
  83. );
  84. #endif
  85. private:
  86. NONVIRTUAL
  87. BOOLEAN
  88. Initialize(
  89. );
  90. NONVIRTUAL
  91. VOID
  92. Construct(
  93. );
  94. NONVIRTUAL
  95. VOID
  96. Destroy(
  97. );
  98. NONVIRTUAL
  99. VOID
  100. SetTitleIndex(
  101. IN ULONG TitleIndex
  102. );
  103. NONVIRTUAL
  104. VOID
  105. SetType(
  106. IN REG_TYPE Type
  107. );
  108. NONVIRTUAL
  109. BOOLEAN
  110. PutName(
  111. IN PCWSTRING ValueName
  112. );
  113. DSTRING _Name;
  114. ULONG _TitleIndex;
  115. REG_TYPE _Type;
  116. PBYTE _Data;
  117. ULONG _Size;
  118. };
  119. INLINE
  120. ULONG
  121. REGISTRY_VALUE_ENTRY::GetData(
  122. OUT PCBYTE* Data
  123. ) CONST
  124. /*++
  125. Routine Description:
  126. Return the buffer that contains the data stored in the value entry.
  127. Arguments:
  128. Data - Variable that will contain the pointer to the buffer that
  129. contains the data.
  130. Return Value:
  131. ULONG - Number of bytes in the buffer (Data size)
  132. --*/
  133. {
  134. *Data = _Data;
  135. return( _Size );
  136. }
  137. INLINE
  138. PCWSTRING
  139. REGISTRY_VALUE_ENTRY::GetName(
  140. ) CONST
  141. /*++
  142. Routine Description:
  143. Return a pointer to a WSTRING object that contains the value name.
  144. Arguments:
  145. None.
  146. Return Value:
  147. The value name.
  148. --*/
  149. {
  150. return( &_Name );
  151. }
  152. INLINE
  153. ULONG
  154. REGISTRY_VALUE_ENTRY::GetTitleIndex(
  155. ) CONST
  156. /*++
  157. Routine Description:
  158. Return the title index of this value.
  159. Arguments:
  160. None.
  161. Return Value:
  162. ULONG - The title index.
  163. --*/
  164. {
  165. return( _TitleIndex );
  166. }
  167. INLINE
  168. REG_TYPE
  169. REGISTRY_VALUE_ENTRY::GetType(
  170. ) CONST
  171. /*++
  172. Routine Description:
  173. Return the type of data stored in this object.
  174. Arguments:
  175. None.
  176. Return Value:
  177. REG_TYPE - The data type.
  178. --*/
  179. {
  180. return( _Type );
  181. }
  182. INLINE
  183. BOOLEAN
  184. REGISTRY_VALUE_ENTRY::PutName(
  185. IN PCWSTRING ValueName
  186. )
  187. /*++
  188. Routine Description:
  189. Initialize the variable _Name.
  190. Arguments:
  191. ValueName - Pointer to a WSTRING object that contains the value name.
  192. Return Value:
  193. None.
  194. --*/
  195. {
  196. DebugPtrAssert( ValueName );
  197. return( _Name.Initialize( ValueName ) );
  198. }
  199. INLINE
  200. VOID
  201. REGISTRY_VALUE_ENTRY::SetTitleIndex(
  202. IN ULONG TitleIndex
  203. )
  204. /*++
  205. Routine Description:
  206. Initialize the variable _TitleIndex.
  207. Arguments:
  208. TitleIndex - The title index.
  209. Return Value:
  210. None.
  211. --*/
  212. {
  213. _TitleIndex = TitleIndex;
  214. }
  215. INLINE
  216. VOID
  217. REGISTRY_VALUE_ENTRY::SetType(
  218. IN REG_TYPE Type
  219. )
  220. /*++
  221. Routine Description:
  222. Initialize the variable _Type.
  223. Arguments:
  224. Type - The type of data.
  225. Return Value:
  226. None.
  227. --*/
  228. {
  229. _Type = Type;
  230. }
  231. #endif // _REGISTRY_VALUE_ENTRY_