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.

370 lines
13 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. cm.h
  5. Abstract:
  6. This module contains the internal structure definitions and APIs
  7. used by the NT configuration management system, including the
  8. registry.
  9. Author:
  10. Bryan M. Willman (bryanwi) 28-Aug-91
  11. Revision History:
  12. --*/
  13. #ifndef _CM_
  14. #define _CM_
  15. //
  16. // Define Names used to access the regsitry
  17. //
  18. extern UNICODE_STRING CmRegistryRootName; // \REGISTRY
  19. extern UNICODE_STRING CmRegistryMachineName; // \REGISTRY\MACHINE
  20. extern UNICODE_STRING CmRegistryMachineHardwareName; // \REGISTRY\MACHINE\HARDWARE
  21. extern UNICODE_STRING CmRegistryMachineHardwareDescriptionName;
  22. // \REGISTRY\MACHINE\HARDWARE\DESCRIPTION
  23. extern UNICODE_STRING CmRegistryMachineHardwareDescriptionSystemName;
  24. // \REGISTRY\MACHINE\HARDWARE\DESCRIPTION\SYSTEM
  25. extern UNICODE_STRING CmRegistryMachineHardwareDeviceMapName;
  26. // \REGISTRY\MACHINE\HARDWARE\DEVICEMAP
  27. extern UNICODE_STRING CmRegistryMachineHardwareResourceMapName;
  28. // \REGISTRY\MACHINE\HARDWARE\RESOURCEMAP
  29. extern UNICODE_STRING CmRegistryMachineHardwareOwnerMapName;
  30. // \REGISTRY\MACHINE\HARDWARE\OWNERMAP
  31. extern UNICODE_STRING CmRegistryMachineSystemName;
  32. // \REGISTRY\MACHINE\SYSTEM
  33. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSet;
  34. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET
  35. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetEnumName;
  36. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\ENUM
  37. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetEnumRootName;
  38. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\ENUM\ROOT
  39. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetServices;
  40. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\SERVICES
  41. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetHardwareProfilesCurrent;
  42. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\HARDWARE PROFILES\CURRENT
  43. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetControlClass;
  44. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\CLASS
  45. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetControlSafeBoot;
  46. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\SAFEBOOT
  47. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetControlSessionManagerMemoryManagement;
  48. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\SESSION MANAGER\MEMORY MANAGEMENT
  49. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetControlBootLog;
  50. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\BOOTLOG
  51. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetServicesEventLog;
  52. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\SERVICES\EVENTLOG
  53. extern UNICODE_STRING CmRegistryUserName; // \REGISTRY\USER
  54. #ifdef _WANT_MACHINE_IDENTIFICATION
  55. extern UNICODE_STRING CmRegistryMachineSystemCurrentControlSetControlBiosInfo;
  56. // \REGISTRY\MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\BIOSINFO
  57. #endif
  58. //
  59. // The following strings will be used as the keynames for registry
  60. // nodes.
  61. // The associated enumerated type is CONFIGURATION_TYPE in arc.h
  62. //
  63. extern UNICODE_STRING CmTypeName[];
  64. extern const PWSTR CmTypeString[];
  65. //
  66. // CmpClassString - contains strings which are used as the class
  67. // strings in the keynode.
  68. // The associated enumerated type is CONFIGURATION_CLASS in arc.h
  69. //
  70. extern UNICODE_STRING CmClassName[];
  71. extern const PWSTR CmClassString[];
  72. // begin_ntosp
  73. //
  74. // Define structure of boot driver list.
  75. //
  76. typedef struct _BOOT_DRIVER_LIST_ENTRY {
  77. LIST_ENTRY Link;
  78. UNICODE_STRING FilePath;
  79. UNICODE_STRING RegistryPath;
  80. PKLDR_DATA_TABLE_ENTRY LdrEntry;
  81. } BOOT_DRIVER_LIST_ENTRY, *PBOOT_DRIVER_LIST_ENTRY;
  82. // end_ntosp
  83. PHANDLE
  84. CmGetSystemDriverList(
  85. VOID
  86. );
  87. BOOLEAN
  88. CmInitSystem1(
  89. IN PLOADER_PARAMETER_BLOCK LoaderBlock
  90. );
  91. BOOLEAN
  92. CmInitSystem2(
  93. VOID
  94. );
  95. VOID
  96. CmNotifyRunDown(
  97. PETHREAD Thread
  98. );
  99. VOID
  100. CmShutdownSystem(
  101. VOID
  102. );
  103. VOID
  104. CmBootLastKnownGood(
  105. ULONG ErrorLevel
  106. );
  107. BOOLEAN
  108. CmIsLastKnownGoodBoot(
  109. VOID
  110. );
  111. //
  112. // Stuctures and definitions for use with CmGetSystemControlValues
  113. //
  114. //
  115. // NOTES:
  116. // KeyPath is relative to currentcontrolset. So, if the variable
  117. // of interest is
  118. // "\registry\machine\system\currentcontrolset\control\fruit\apple:x"
  119. // the entry is
  120. // { L"fruit\\apple",
  121. // L"x",
  122. // &Xbuffer,
  123. // sizeof(ULONG),
  124. // &Xtype
  125. // }
  126. //
  127. // *BufferLength is available space on input
  128. // on output:
  129. // -1 = no such key or value
  130. // 0 = key and value exist, but have 0 length data
  131. // > input = buffer too small, filled to available space,
  132. // value is actual size of data in registry
  133. // <= input = number of bytes copied out
  134. //
  135. typedef struct _CM_SYSTEM_CONTROL_VECTOR {
  136. PWSTR KeyPath; // path name relative to
  137. // current control set
  138. PWSTR ValueName; // name of value entry
  139. PVOID Buffer; // data goes here
  140. PULONG BufferLength; // IN: space allocated
  141. // OUT: space used, -1 for no such
  142. // key or value, 0 for key/value
  143. // found but has 0 length data
  144. // if NULL pointer, assume 4 bytes
  145. // (reg DWORD) available and do not
  146. // report actual size
  147. PULONG Type; // return type of found data, may
  148. // be NULL
  149. } CM_SYSTEM_CONTROL_VECTOR, *PCM_SYSTEM_CONTROL_VECTOR;
  150. VOID
  151. CmGetSystemControlValues(
  152. PVOID SystemHiveBuffer,
  153. PCM_SYSTEM_CONTROL_VECTOR ControlVector
  154. );
  155. VOID
  156. CmQueryRegistryQuotaInformation(
  157. IN PSYSTEM_REGISTRY_QUOTA_INFORMATION RegistryQuotaInformation
  158. );
  159. VOID
  160. CmSetRegistryQuotaInformation(
  161. IN PSYSTEM_REGISTRY_QUOTA_INFORMATION RegistryQuotaInformation
  162. );
  163. typedef
  164. VOID
  165. (*PCM_TRACE_NOTIFY_ROUTINE)(
  166. IN NTSTATUS Status,
  167. IN PVOID Kcb,
  168. IN LONGLONG ElapsedTime,
  169. IN ULONG Index,
  170. IN PUNICODE_STRING KeyName,
  171. IN UCHAR Type
  172. );
  173. NTSTATUS
  174. CmSetTraceNotifyRoutine(
  175. IN PCM_TRACE_NOTIFY_ROUTINE NotifyRoutine,
  176. IN BOOLEAN Remove
  177. );
  178. NTSTATUS
  179. CmPrefetchHivePages(
  180. IN PUNICODE_STRING FullHivePath,
  181. IN OUT PREAD_LIST ReadList
  182. );
  183. VOID
  184. CmSetLazyFlushState(BOOLEAN Enable);
  185. // begin_ntddk begin_wdm
  186. //
  187. // Registry kernel mode callbacks
  188. //
  189. //
  190. // Hook selector
  191. //
  192. typedef enum _REG_NOTIFY_CLASS {
  193. RegNtDeleteKey,
  194. RegNtSetValueKey,
  195. RegNtDeleteValueKey,
  196. RegNtSetInformationKey,
  197. RegNtRenameKey,
  198. RegNtEnumerateKey,
  199. RegNtEnumerateValueKey,
  200. RegNtQueryKey,
  201. RegNtQueryValueKey,
  202. RegNtQueryMultipleValueKey,
  203. RegNtPreCreateKey,
  204. RegNtPostCreateKey,
  205. RegNtPreOpenKey,
  206. RegNtPostOpenKey,
  207. RegNtKeyHandleClose
  208. } REG_NOTIFY_CLASS;
  209. //
  210. // Parameter description for each notify class
  211. //
  212. typedef struct _REG_DELETE_KEY_INFORMATION {
  213. PVOID Object; // IN
  214. } REG_DELETE_KEY_INFORMATION, *PREG_DELETE_KEY_INFORMATION;
  215. typedef struct _REG_SET_VALUE_KEY_INFORMATION {
  216. PVOID Object; // IN
  217. PUNICODE_STRING ValueName; // IN
  218. ULONG TitleIndex; // IN
  219. ULONG Type; // IN
  220. PVOID Data; // IN
  221. ULONG DataSize; // IN
  222. } REG_SET_VALUE_KEY_INFORMATION, *PREG_SET_VALUE_KEY_INFORMATION;
  223. typedef struct _REG_DELETE_VALUE_KEY_INFORMATION {
  224. PVOID Object; // IN
  225. PUNICODE_STRING ValueName; // IN
  226. } REG_DELETE_VALUE_KEY_INFORMATION, *PREG_DELETE_VALUE_KEY_INFORMATION;
  227. typedef struct _REG_SET_INFORMATION_KEY_INFORMATION {
  228. PVOID Object; // IN
  229. KEY_SET_INFORMATION_CLASS KeySetInformationClass; // IN
  230. PVOID KeySetInformation; // IN
  231. ULONG KeySetInformationLength;// IN
  232. } REG_SET_INFORMATION_KEY_INFORMATION, *PREG_SET_INFORMATION_KEY_INFORMATION;
  233. typedef struct _REG_ENUMERATE_KEY_INFORMATION {
  234. PVOID Object; // IN
  235. ULONG Index; // IN
  236. KEY_INFORMATION_CLASS KeyInformationClass; // IN
  237. PVOID KeyInformation; // IN
  238. ULONG Length; // IN
  239. PULONG ResultLength; // OUT
  240. } REG_ENUMERATE_KEY_INFORMATION, *PREG_ENUMERATE_KEY_INFORMATION;
  241. typedef struct _REG_ENUMERATE_VALUE_KEY_INFORMATION {
  242. PVOID Object; // IN
  243. ULONG Index; // IN
  244. KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass; // IN
  245. PVOID KeyValueInformation; // IN
  246. ULONG Length; // IN
  247. PULONG ResultLength; // OUT
  248. } REG_ENUMERATE_VALUE_KEY_INFORMATION, *PREG_ENUMERATE_VALUE_KEY_INFORMATION;
  249. typedef struct _REG_QUERY_KEY_INFORMATION {
  250. PVOID Object; // IN
  251. KEY_INFORMATION_CLASS KeyInformationClass; // IN
  252. PVOID KeyInformation; // IN
  253. ULONG Length; // IN
  254. PULONG ResultLength; // OUT
  255. } REG_QUERY_KEY_INFORMATION, *PREG_QUERY_KEY_INFORMATION;
  256. typedef struct _REG_QUERY_VALUE_KEY_INFORMATION {
  257. PVOID Object; // IN
  258. PUNICODE_STRING ValueName; // IN
  259. KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass; // IN
  260. PVOID KeyValueInformation; // IN
  261. ULONG Length; // IN
  262. PULONG ResultLength; // OUT
  263. } REG_QUERY_VALUE_KEY_INFORMATION, *PREG_QUERY_VALUE_KEY_INFORMATION;
  264. typedef struct _REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION {
  265. PVOID Object; // IN
  266. PKEY_VALUE_ENTRY ValueEntries; // IN
  267. ULONG EntryCount; // IN
  268. PVOID ValueBuffer; // IN
  269. PULONG BufferLength; // IN OUT
  270. PULONG RequiredBufferLength; // OUT
  271. } REG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION, *PREG_QUERY_MULTIPLE_VALUE_KEY_INFORMATION;
  272. typedef struct _REG_RENAME_KEY_INFORMATION {
  273. PVOID Object; // IN
  274. PUNICODE_STRING NewName; // IN
  275. } REG_RENAME_KEY_INFORMATION, *PREG_RENAME_KEY_INFORMATION;
  276. typedef struct _REG_PRE_CREATE_KEY_INFORMATION {
  277. PUNICODE_STRING CompleteName; // IN
  278. } REG_PRE_CREATE_KEY_INFORMATION, REG_PRE_OPEN_KEY_INFORMATION,*PREG_PRE_CREATE_KEY_INFORMATION, *PREG_PRE_OPEN_KEY_INFORMATION;;
  279. typedef struct _REG_POST_CREATE_KEY_INFORMATION {
  280. PUNICODE_STRING CompleteName; // IN
  281. PVOID Object; // IN
  282. NTSTATUS Status; // IN
  283. } REG_POST_CREATE_KEY_INFORMATION,REG_POST_OPEN_KEY_INFORMATION, *PREG_POST_CREATE_KEY_INFORMATION, *PREG_POST_OPEN_KEY_INFORMATION;
  284. typedef struct _REG_KEY_HANDLE_CLOSE_INFORMATION {
  285. PVOID Object; // IN
  286. } REG_KEY_HANDLE_CLOSE_INFORMATION, *PREG_KEY_HANDLE_CLOSE_INFORMATION;
  287. NTSTATUS
  288. CmRegisterCallback(IN PEX_CALLBACK_FUNCTION Function,
  289. IN PVOID Context,
  290. IN OUT PLARGE_INTEGER Cookie
  291. );
  292. NTSTATUS
  293. CmUnRegisterCallback(IN LARGE_INTEGER Cookie);
  294. // end_ntddk end_wdm
  295. //
  296. // PnP private API
  297. //
  298. typedef VOID (*PCM_HYSTERESIS_CALLBACK)(PVOID Ref, ULONG Level);
  299. ULONG
  300. CmRegisterSystemHiveLimitCallback(
  301. ULONG Low,
  302. ULONG High,
  303. PVOID Ref,
  304. PCM_HYSTERESIS_CALLBACK Callback
  305. );
  306. #endif // _CM_