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.

291 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. reflectr.h
  5. Abstract:
  6. This file define function used only in the setup/reflector thread
  7. Author:
  8. ATM Shafiqul Khalid (askhalid) 16-Feb-2000
  9. Revision History:
  10. --*/
  11. #ifndef __REFLECTR_H__
  12. #define __REFLECTR_H__
  13. //
  14. // must not define this for the checin code its only for the debugging code
  15. //
  16. //#define ENABLE_REGISTRY_LOG
  17. //#define WOW64_LOG_REGISTRY // will log information
  18. #define WAIT_INTERVAL INFINITE //Infinite
  19. #define VALUE_KEY_UPDATE_TIME_DIFF 10 // minimum difference in sec to Keyupdate and reflector thread scan
  20. #define WOW64_REGISTRY_SETUP_REFLECTOR_KEY L"SOFTWARE\\Microsoft\\WOW64\\Reflector Nodes"
  21. //
  22. // following flag used in the merge value key & Keys
  23. //
  24. #define PATCH_PATHNAME 0x00000001 // patch pathname from value
  25. #define DELETE_VALUEKEY 0x00000002 // delete the value after copy like runonce key
  26. #define NOT_MARK_SOURCE 0x00000004 // don't mark source
  27. #define NOT_MARK_DESTINATION 0x00000008 // don't mark destination
  28. #define DESTINATION_NEWLY_CREATED 0x00000010 // destination is newly created don't check timestamp
  29. #define DELETE_FLAG 0x10000000 // destination is newly created don't check timestamp
  30. #define CONSOLE_OUTPUT printf
  31. #ifndef THUNK
  32. #ifdef ENABLE_REGISTRY_LOG
  33. #define Wow64RegDbgPrint(x) RegLogPrint x
  34. #else
  35. #define Wow64RegDbgPrint(x) //NULL Statement
  36. #endif
  37. #endif
  38. //
  39. // over write for thunk
  40. //
  41. #if defined THUNK
  42. #undef CONSOLE_OUTPUT
  43. #define CONSOLE_OUTPUT DbgPrint
  44. #undef Wow64RegDbgPrint
  45. #define Wow64RegDbgPrint(x) CONSOLE_OUTPUT x
  46. #endif
  47. typedef struct __REFLECTOR_EVENT {
  48. HANDLE hRegistryEvent;
  49. HKEY hKey;
  50. DWORD dwIndex; //index to the ISN node table
  51. BOOL bDirty;
  52. } REFLECTOR_EVENT;
  53. typedef enum {
  54. Dead=0, // no thread
  55. Stopped, // events has been initialised
  56. Running, // running the thread
  57. PrepareToStop, // going to stop soon
  58. Abnormal // abnormal state need to clean up in some way
  59. } REFLECTR_STATUS;
  60. #define HIVE_LOADING L'L'
  61. #define HIVE_UNLOADING L'U'
  62. #define LIST_NAME_LEN 257 //256 +1 for the last entry
  63. #define OPEN_EXISTING_SHARED_RESOURCES 0x12
  64. #define CREATE_SHARED_MEMORY 0x13
  65. typedef WCHAR LISTNAME[LIST_NAME_LEN];
  66. #pragma warning( disable : 4200 ) //todisable zero length array which will be allocated later
  67. typedef struct _LIST_OBJECT {
  68. DWORD Count;
  69. DWORD MaxCount;
  70. LISTNAME Name[]; //the 256th position will hold the value like loading/unloading
  71. } LIST_OBJECT;
  72. #pragma warning( default : 4200 )
  73. #ifdef __cplusplus
  74. extern "C" {
  75. #endif
  76. BOOL
  77. ExistCLSID (
  78. PWCHAR Name,
  79. BOOL Mode
  80. );
  81. BOOL
  82. MarkNonMergeableKey (
  83. LPCWSTR KeyName,
  84. HKEY hKey,
  85. DWORD *pMergeableSubkey
  86. );
  87. BOOL
  88. SyncNode (
  89. PWCHAR NodeName
  90. );
  91. BOOL
  92. ProcessTypeLib (
  93. HKEY SrcKey,
  94. HKEY DestKey,
  95. BOOL Mode
  96. );
  97. void
  98. MergeK1K2 (
  99. HKEY SrcKey,
  100. HKEY DestKey,
  101. DWORD FlagDelete
  102. );
  103. BOOL
  104. CreateIsnNode();
  105. BOOL
  106. CreateIsnNodeSingle(
  107. DWORD dwIndex
  108. );
  109. BOOL
  110. GetWow6432ValueKey (
  111. HKEY hKey,
  112. WOW6432_VALUEKEY *pValue
  113. );
  114. DWORD
  115. DeleteKey (
  116. HKEY DestKey,
  117. WCHAR *pKeyName,
  118. DWORD mode
  119. );
  120. BOOL
  121. CleanpRegistry ( );
  122. BOOL
  123. InitializeIsnTable ();
  124. BOOL
  125. UnRegisterReflector();
  126. BOOL
  127. RegisterReflector();
  128. ULONG
  129. ReflectorFn (
  130. PVOID *pTemp
  131. );
  132. BOOL
  133. InitReflector ();
  134. BOOL
  135. InitializeIsnTableReflector ();
  136. BOOL
  137. PopulateReflectorTable ();
  138. BOOL
  139. Is64bitNode (
  140. WCHAR *pName
  141. );
  142. BOOL
  143. HandleRunonce(
  144. PWCHAR pKeyName
  145. );
  146. BOOL
  147. PatchPathName (
  148. PWCHAR pName
  149. );
  150. BOOL
  151. GetMirrorName (
  152. PWCHAR Name,
  153. PWCHAR TempName
  154. );
  155. VOID SetInitialCopy ();
  156. ////////////////shared memory service/////////////////////////////
  157. BOOL
  158. CreateSharedMemory (
  159. DWORD dwOption
  160. );
  161. VOID
  162. CloseSharedMemory ();
  163. BOOL
  164. Wow64CreateLock (
  165. DWORD dwOption
  166. );
  167. VOID
  168. Wow64CloseLock ();
  169. BOOL
  170. Wow64CreateEvent (
  171. DWORD dwOption,
  172. HANDLE *hEnent
  173. );
  174. VOID
  175. Wow64CloseEvent ();
  176. BOOL
  177. SignalWow64Svc ();
  178. BOOL
  179. EnQueueObject (
  180. PWCHAR pObjName,
  181. WCHAR Type
  182. );
  183. BOOL
  184. DeQueueObject (
  185. PWCHAR pObjName,
  186. PWCHAR Type
  187. );
  188. REFLECTR_STATUS
  189. GetReflectorThreadStatus ();
  190. BOOL
  191. GetMirrorName (
  192. PWCHAR Name,
  193. PWCHAR MirrorName
  194. );
  195. BOOL
  196. PopulateReflectorTable ();
  197. BOOL
  198. GetDefaultValue (
  199. HKEY SrcKey,
  200. WCHAR *pBuff,
  201. DWORD *Len
  202. );
  203. BOOL
  204. WriteRegLog (
  205. PWCHAR Msg
  206. );
  207. VOID
  208. CloseRegLog ();
  209. BOOL
  210. InitRegLog ();
  211. BOOL
  212. RegLogPrint (
  213. CHAR *p,
  214. ...
  215. );
  216. #ifdef __cplusplus
  217. }
  218. #endif
  219. #endif //__REFLECTR_H__