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.

367 lines
7.1 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. regredir.h
  5. Abstract:
  6. This module define the APis to redirect 32bit registry calls. All 32bit wow process must
  7. use following set of wowregistry APIs to manipulate registry so that 32-bit and 64-bit registry
  8. can co exist in the same system registry.
  9. Author:
  10. ATM Shafiqul Khalid (askhalid) 15-Oct-1999
  11. Revision History:
  12. --*/
  13. #ifndef _REGREDIR_H_
  14. #define _REGREDIR_H_
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. typedef CCHAR KPROCESSOR_MODE;
  22. //
  23. // Nt level registry API calls
  24. //
  25. #define REG_OPAQUE_ATTRIB_MIRROR 0x00000001 // need to see the 64 bit side
  26. #define REG_OPAQUE_ATTRIB_REAL 0x00000002 // this is real value
  27. #define DONT_CREATE_DEST_KEY 0x00000004 // Suync only if destination key exist
  28. #define SKIP_SPECIAL_CASE 0x00000008 // Skip special case
  29. #define MAX_KEY_BUFF_LEN STATIC_UNICODE_BUFFER_LENGTH*4
  30. typedef struct {
  31. DWORD dwSignature;
  32. DWORD dwAttribute;
  33. } REG_OPAQUE_VALUE;
  34. typedef struct {
  35. POBJECT_ATTRIBUTES pObjectAddress; // pointer to the object that that has been patched using this one
  36. PUNICODE_STRING p64bitName; // pointer to the correct unicode object name
  37. HANDLE RootDirectory; // handle to the root directory in case different handle need to pass
  38. UNICODE_STRING PatchedName; // pointer to the buffer holding patched name
  39. PVOID pThis; // pointer to this object to avoid multiple free
  40. SIZE_T Len; // Length of this memory segment including buffer at the end;
  41. } PATCHED_OBJECT_ATTRIB, *PPATCHED_OBJECT_ATTRIB;
  42. BOOL
  43. IsUnderWow64 ();
  44. BOOL
  45. UpdateKeyTag (
  46. HKEY hBase,
  47. DWORD dwAttribute
  48. );
  49. NTSTATUS
  50. RemapNtCreateKey(
  51. OUT PHANDLE phPatchedHandle,
  52. IN ACCESS_MASK DesiredAccess,
  53. IN POBJECT_ATTRIBUTES ObjectAttributes,
  54. IN ULONG TitleIndex,
  55. IN PUNICODE_STRING Class OPTIONAL,
  56. IN ULONG CreateOptions,
  57. OUT PULONG Disposition OPTIONAL
  58. );
  59. NTSTATUS
  60. Wow64NtCreateKey(
  61. OUT PHANDLE KeyHandle,
  62. IN ACCESS_MASK DesiredAccess,
  63. IN POBJECT_ATTRIBUTES ObjectAttributes,
  64. IN ULONG TitleIndex,
  65. IN PUNICODE_STRING Class OPTIONAL,
  66. IN ULONG CreateOptions,
  67. OUT PULONG Disposition OPTIONAL
  68. );
  69. NTSTATUS
  70. Wow64NtDeleteKey(
  71. IN HANDLE KeyHandle
  72. );
  73. NTSTATUS
  74. Wow64NtDeleteValueKey(
  75. IN HANDLE KeyHandle,
  76. IN PUNICODE_STRING ValueName
  77. );
  78. NTSTATUS
  79. Wow64NtEnumerateKey(
  80. IN HANDLE KeyHandle,
  81. IN ULONG Index,
  82. IN KEY_INFORMATION_CLASS KeyInformationClass,
  83. OUT PVOID KeyInformation,
  84. IN ULONG Length,
  85. OUT PULONG ResultLength
  86. );
  87. NTSTATUS
  88. Wow64NtEnumerateValueKey(
  89. IN HANDLE KeyHandle,
  90. IN ULONG Index,
  91. IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
  92. OUT PVOID KeyValueInformation,
  93. IN ULONG Length,
  94. OUT PULONG ResultLength
  95. );
  96. NTSTATUS
  97. Wow64NtFlushKey(
  98. IN HANDLE KeyHandle
  99. );
  100. NTSTATUS
  101. Wow64NtInitializeRegistry(
  102. IN USHORT BootCondition
  103. );
  104. NTSTATUS
  105. Wow64NtNotifyChangeKey(
  106. IN HANDLE KeyHandle,
  107. IN HANDLE Event OPTIONAL,
  108. IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
  109. IN PVOID ApcContext OPTIONAL,
  110. OUT PIO_STATUS_BLOCK IoStatusBlock,
  111. IN ULONG CompletionFilter,
  112. IN BOOLEAN WatchTree,
  113. OUT PVOID Buffer,
  114. IN ULONG BufferSize,
  115. IN BOOLEAN Asynchronous
  116. );
  117. NTSTATUS
  118. Wow64NtNotifyChangeMultipleKeys(
  119. IN HANDLE MasterKeyHandle,
  120. IN ULONG Count,
  121. IN OBJECT_ATTRIBUTES SlaveObjects[],
  122. IN HANDLE Event OPTIONAL,
  123. IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
  124. IN PVOID ApcContext OPTIONAL,
  125. OUT PIO_STATUS_BLOCK IoStatusBlock,
  126. IN ULONG CompletionFilter,
  127. IN BOOLEAN WatchTree,
  128. OUT PVOID Buffer,
  129. IN ULONG BufferSize,
  130. IN BOOLEAN Asynchronous
  131. );
  132. NTSTATUS
  133. Wow64NtLoadKey(
  134. IN POBJECT_ATTRIBUTES TargetKey,
  135. IN POBJECT_ATTRIBUTES SourceFile
  136. );
  137. NTSTATUS
  138. Wow64NtLoadKey2(
  139. IN POBJECT_ATTRIBUTES TargetKey,
  140. IN POBJECT_ATTRIBUTES SourceFile,
  141. IN ULONG Flags
  142. );
  143. NTSTATUS
  144. Wow64NtOpenKey(
  145. OUT PHANDLE KeyHandle,
  146. IN ACCESS_MASK DesiredAccess,
  147. IN POBJECT_ATTRIBUTES ObjectAttributes
  148. );
  149. NTSTATUS
  150. Wow64NtQueryKey(
  151. IN HANDLE KeyHandle,
  152. IN KEY_INFORMATION_CLASS KeyInformationClass,
  153. OUT PVOID KeyInformation,
  154. IN ULONG Length,
  155. OUT PULONG ResultLength
  156. );
  157. NTSTATUS
  158. Wow64NtQueryValueKey(
  159. IN HANDLE KeyHandle,
  160. IN PUNICODE_STRING ValueName,
  161. IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
  162. OUT PVOID KeyValueInformation,
  163. IN ULONG Length,
  164. OUT PULONG ResultLength
  165. );
  166. NTSTATUS
  167. Wow64NtQueryMultipleValueKey(
  168. IN HANDLE KeyHandle,
  169. IN PKEY_VALUE_ENTRY ValueEntries,
  170. IN ULONG EntryCount,
  171. OUT PVOID ValueBuffer,
  172. IN OUT PULONG BufferLength,
  173. OUT OPTIONAL PULONG RequiredBufferLength
  174. );
  175. NTSTATUS
  176. Wow64NtReplaceKey(
  177. IN POBJECT_ATTRIBUTES NewFile,
  178. IN HANDLE TargetHandle,
  179. IN POBJECT_ATTRIBUTES OldFile
  180. );
  181. NTSTATUS
  182. Wow64NtRestoreKey(
  183. IN HANDLE KeyHandle,
  184. IN HANDLE FileHandle,
  185. IN ULONG Flags
  186. );
  187. NTSTATUS
  188. Wow64NtSaveKey(
  189. IN HANDLE KeyHandle,
  190. IN HANDLE FileHandle
  191. );
  192. NTSTATUS
  193. Wow64NtSaveMergedKeys(
  194. IN HANDLE HighPrecedenceKeyHandle,
  195. IN HANDLE LowPrecedenceKeyHandle,
  196. IN HANDLE FileHandle
  197. );
  198. NTSTATUS
  199. Wow64NtSetValueKey(
  200. IN HANDLE KeyHandle,
  201. IN PUNICODE_STRING ValueName,
  202. IN ULONG TitleIndex OPTIONAL,
  203. IN ULONG Type,
  204. IN PVOID Data,
  205. IN ULONG DataSize
  206. );
  207. NTSTATUS
  208. Wow64NtUnloadKey(
  209. IN POBJECT_ATTRIBUTES TargetKey
  210. );
  211. NTSTATUS
  212. Wow64NtSetInformationKey(
  213. IN HANDLE KeyHandle,
  214. IN KEY_SET_INFORMATION_CLASS KeySetInformationClass,
  215. IN PVOID KeySetInformation,
  216. IN ULONG KeySetInformationLength
  217. );
  218. NTSTATUS
  219. Wow64NtClose(
  220. IN HANDLE Handle
  221. );
  222. VOID
  223. DisplayCallParam (
  224. char *strCallLoc,
  225. POBJECT_ATTRIBUTES ObjectAttributes
  226. );
  227. NTSTATUS
  228. Wow64NtQueryOpenSubKeys(
  229. IN POBJECT_ATTRIBUTES TargetKey,
  230. OUT PULONG HandleCount
  231. );
  232. BOOL
  233. IsIsnNode (
  234. PWCHAR wStr,
  235. PWCHAR *pwStrIsn
  236. );
  237. NTSTATUS
  238. CreatePathFromInsNode(
  239. PWCHAR wStr,
  240. PWCHAR wStrIsn
  241. );
  242. NTSTATUS
  243. OpenIsnNodeByObjectAttributes (
  244. POBJECT_ATTRIBUTES ObjectAttributes,
  245. ACCESS_MASK DesiredAccess,
  246. PHANDLE phPatchedHandle
  247. );
  248. int
  249. Regwcsnicmp(
  250. const WCHAR * first,
  251. const WCHAR * last,
  252. size_t count
  253. );
  254. BOOL
  255. SyncRegCreateKey (
  256. HANDLE hBase,
  257. PWCHAR AbsPath,
  258. DWORD Flag
  259. );
  260. BOOL
  261. NtSyncNode (
  262. HANDLE hBase,
  263. PWCHAR AbsPath,
  264. BOOL bForceSync
  265. );
  266. BOOL
  267. IsOnReflectionList (
  268. PWCHAR Path
  269. );
  270. BOOL
  271. NtSyncNodeOpenCreate (
  272. IN POBJECT_ATTRIBUTES ObjectAttributes
  273. );
  274. NTSTATUS
  275. ObjectAttributesToKeyName (
  276. POBJECT_ATTRIBUTES ObjectAttributes,
  277. PWCHAR AbsPath,
  278. DWORD AbsPathLenIn,
  279. BOOL *bPatched,
  280. DWORD *ParentLen
  281. );
  282. NTSTATUS
  283. Wow64NtSetSecurityObject (
  284. IN HANDLE Handle,
  285. IN SECURITY_INFORMATION SecurityInformation,
  286. IN PSECURITY_DESCRIPTOR SecurityDescriptor
  287. );
  288. void
  289. CleanupReflector (
  290. DWORD dwFlag
  291. );
  292. PWCHAR
  293. wcsistr(
  294. PWCHAR string1,
  295. PWCHAR string2
  296. );
  297. #ifdef __cplusplus
  298. }
  299. #endif //__cplusplus
  300. #endif // _REGREDIR_H_