Leaked source code of windows server 2003
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.

298 lines
9.1 KiB

  1. // LoggedRegIntercept.h: interface for the CLoggedRegIntercept class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_LOGGEDREGINTERCEPT_H__856F5C97_794D_40B4_B18A_DEB3C96B086F__INCLUDED_)
  5. #define AFX_LOGGEDREGINTERCEPT_H__856F5C97_794D_40B4_B18A_DEB3C96B086F__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "RegIntercept.h"
  10. #include <stdio.h>
  11. #include <tchar.h>
  12. class CLoggedRegIntercept : public CRegIntercept
  13. {
  14. public:
  15. void GetLocation(POBJECT_ATTRIBUTES ObjectAttributes, bool bAppendBackslash = true);
  16. void LogError(LPCTSTR msg);
  17. void SetCurrentDll(LPCTSTR DllName);
  18. CLoggedRegIntercept(TCHAR* FileName);
  19. virtual ~CLoggedRegIntercept();
  20. //intercepted registry functions
  21. virtual void NtOpenKey( PHANDLE KeyHandle,
  22. ACCESS_MASK DesiredAccess,
  23. POBJECT_ATTRIBUTES ObjectAttributes);
  24. virtual void NtCreateKey(PHANDLE KeyHandle,
  25. ACCESS_MASK DesiredAccess,
  26. POBJECT_ATTRIBUTES ObjectAttributes,
  27. ULONG TitleIndex,
  28. PUNICODE_STRING Class,
  29. ULONG CreateOptions,
  30. PULONG Disposition);
  31. virtual void NtDeleteKey(HANDLE KeyHandle);
  32. virtual void NtDeleteValueKey(HANDLE KeyHandle, PUNICODE_STRING ValueName);
  33. virtual void NtEnumerateKey(HANDLE KeyHandle, ULONG Index, KEY_INFORMATION_CLASS KeyInformationClass, PVOID KeyInformation, ULONG Length, PULONG ResultLength);
  34. virtual void NtEnumerateValueKey(HANDLE KeyHandle, ULONG Index, KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, PVOID KeyValueInformation, ULONG Length, PULONG ResultLength) ;
  35. virtual void NtQueryKey(HANDLE KeyHandle, KEY_INFORMATION_CLASS KeyInformationClass, PVOID KeyInformation, ULONG Length, PULONG ResultLength);
  36. virtual void NtQueryValueKey(HANDLE KeyHandle, PUNICODE_STRING ValueName, KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, PVOID KeyValueInformation, ULONG Length, PULONG ResultLength);
  37. virtual void NtQueryMultipleValueKey(HANDLE KeyHandle, PKEY_VALUE_ENTRY ValueEntries, ULONG EntryCount, PVOID ValueBuffer, PULONG BufferLength, PULONG RequiredBufferLength);
  38. virtual void NtSetValueKey(HANDLE KeyHandle, PUNICODE_STRING ValueName, ULONG TitleIndex, ULONG Type, PVOID Data, ULONG DataSize);
  39. //intercepted File System functions
  40. virtual void NtDeleteFile(POBJECT_ATTRIBUTES ObjectAttributes);
  41. virtual void NtQueryAttributesFile(POBJECT_ATTRIBUTES ObjectAttributes, PFILE_BASIC_INFORMATION FileInformation);
  42. virtual void NtQueryFullAttributesFile(POBJECT_ATTRIBUTES ObjectAttributes, PFILE_NETWORK_OPEN_INFORMATION FileInformation);
  43. virtual void NtCreateFile(
  44. PHANDLE FileHandle,
  45. ACCESS_MASK DesiredAccess,
  46. POBJECT_ATTRIBUTES ObjectAttributes,
  47. PIO_STATUS_BLOCK IoStatusBlock,
  48. PLARGE_INTEGER AllocationSize,
  49. ULONG FileAttributes,
  50. ULONG ShareAccess,
  51. ULONG CreateDisposition,
  52. ULONG CreateOptions,
  53. PVOID EaBuffer,
  54. ULONG EaLength);
  55. virtual void NtOpenFile(
  56. PHANDLE FileHandle,
  57. ACCESS_MASK DesiredAccess,
  58. POBJECT_ATTRIBUTES ObjectAttributes,
  59. PIO_STATUS_BLOCK IoStatusBlock,
  60. ULONG ShareAccess,
  61. ULONG OpenOptions);
  62. //intercepted Driver functions
  63. virtual void NtLoadDriver(PUNICODE_STRING DriverServiceName);
  64. /* virtual void NtDeviceIoControlFile(
  65. HANDLE FileHandle,
  66. HANDLE Event,
  67. PIO_APC_ROUTINE ApcRoutine,
  68. PVOID ApcContext,
  69. PIO_STATUS_BLOCK IoStatusBlock,
  70. ULONG IoControlCode,
  71. PVOID InputBuffer,
  72. ULONG InputBufferLength,
  73. PVOID OutputBuffer,
  74. ULONG OutputBufferLength);
  75. virtual void NtFsControlFile(
  76. HANDLE FileHandle,
  77. HANDLE Event,
  78. PIO_APC_ROUTINE ApcRoutine,
  79. PVOID ApcContext,
  80. PIO_STATUS_BLOCK IoStatusBlock,
  81. ULONG FsControlCode,
  82. PVOID InputBuffer,
  83. ULONG InputBufferLength,
  84. PVOID OutputBuffer,
  85. ULONG OutputBufferLength);
  86. */
  87. virtual void NtPlugPlayControl(
  88. IN PLUGPLAY_CONTROL_CLASS PnPControlClass,
  89. IN OUT PVOID PnPControlData,
  90. IN ULONG PnPControlDataLength);
  91. virtual void NtCreateSymbolicLinkObject(
  92. OUT PHANDLE LinkHandle,
  93. IN ACCESS_MASK DesiredAccess,
  94. IN POBJECT_ATTRIBUTES ObjectAttributes,
  95. IN PUNICODE_STRING LinkTarget);
  96. virtual void NtOpenSymbolicLinkObject(
  97. OUT PHANDLE LinkHandle,
  98. IN ACCESS_MASK DesiredAccess,
  99. IN POBJECT_ATTRIBUTES ObjectAttributes);
  100. virtual void NtCreateDirectoryObject(
  101. OUT PHANDLE DirectoryHandle,
  102. IN ACCESS_MASK DesiredAccess,
  103. IN POBJECT_ATTRIBUTES ObjectAttributes);
  104. virtual void NtOpenDirectoryObject(
  105. OUT PHANDLE DirectoryHandle,
  106. IN ACCESS_MASK DesiredAccess,
  107. IN POBJECT_ATTRIBUTES ObjectAttributes);
  108. virtual void NtSignalAndWaitForSingleObject(
  109. IN HANDLE SignalHandle,
  110. IN HANDLE WaitHandle,
  111. IN BOOLEAN Alertable,
  112. IN PLARGE_INTEGER Timeout);
  113. virtual void NtWaitForSingleObject(
  114. IN HANDLE Handle,
  115. IN BOOLEAN Alertable,
  116. IN PLARGE_INTEGER Timeout);
  117. virtual void NtWaitForMultipleObjects(
  118. IN ULONG Count,
  119. IN HANDLE* Handles,
  120. IN WAIT_TYPE WaitType,
  121. IN BOOLEAN Alertable,
  122. IN PLARGE_INTEGER Timeout);
  123. virtual void NtCreatePort(
  124. OUT PHANDLE PortHandle,
  125. IN POBJECT_ATTRIBUTES ObjectAttributes,
  126. IN ULONG MaxConnectionInfoLength,
  127. IN ULONG MaxMessageLength,
  128. IN ULONG MaxPoolUsage);
  129. virtual void NtCreateWaitablePort(
  130. OUT PHANDLE PortHandle,
  131. IN POBJECT_ATTRIBUTES ObjectAttributes,
  132. IN ULONG MaxConnectionInfoLength,
  133. IN ULONG MaxMessageLength,
  134. IN ULONG MaxPoolUsage);
  135. virtual void NtCreateThread(
  136. OUT PHANDLE ThreadHandle,
  137. IN ACCESS_MASK DesiredAccess,
  138. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  139. IN HANDLE ProcessHandle,
  140. OUT PCLIENT_ID ClientId,
  141. IN PCONTEXT ThreadContext,
  142. IN PINITIAL_TEB InitialTeb,
  143. IN BOOLEAN CreateSuspended);
  144. virtual void NtOpenThread(
  145. OUT PHANDLE ThreadHandle,
  146. IN ACCESS_MASK DesiredAccess,
  147. IN POBJECT_ATTRIBUTES ObjectAttributes,
  148. IN PCLIENT_ID ClientId);
  149. virtual void NtCreateProcess(
  150. OUT PHANDLE ProcessHandle,
  151. IN ACCESS_MASK DesiredAccess,
  152. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  153. IN HANDLE ParentProcess,
  154. IN BOOLEAN InheritObjectTable,
  155. IN HANDLE SectionHandle OPTIONAL,
  156. IN HANDLE DebugPort OPTIONAL,
  157. IN HANDLE ExceptionPort OPTIONAL);
  158. virtual void NtCreateProcessEx(
  159. OUT PHANDLE ProcessHandle,
  160. IN ACCESS_MASK DesiredAccess,
  161. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  162. IN HANDLE ParentProcess,
  163. IN ULONG Flags,
  164. IN HANDLE SectionHandle OPTIONAL,
  165. IN HANDLE DebugPort OPTIONAL,
  166. IN HANDLE ExceptionPort OPTIONAL,
  167. IN ULONG JobMemberLevel);
  168. virtual void NtOpenProcess(
  169. OUT PHANDLE ProcessHandle,
  170. IN ACCESS_MASK DesiredAccess,
  171. IN POBJECT_ATTRIBUTES ObjectAttributes,
  172. IN PCLIENT_ID ClientId OPTIONAL);
  173. virtual void NtQueryDefaultLocale(
  174. IN BOOLEAN UserProfile,
  175. OUT PLCID DefaultLocaleId);
  176. virtual void NtSetDefaultLocale(
  177. IN BOOLEAN UserProfile,
  178. IN LCID DefaultLocaleId);
  179. virtual void NtQuerySystemEnvironmentValue(
  180. IN PUNICODE_STRING VariableName,
  181. OUT PWSTR VariableValue,
  182. IN USHORT ValueLength,
  183. OUT PUSHORT ReturnLength OPTIONAL);
  184. virtual void NtSetSystemEnvironmentValue(
  185. IN PUNICODE_STRING VariableName,
  186. IN PUNICODE_STRING VariableValue);
  187. virtual void NtQuerySystemEnvironmentValueEx(
  188. IN PUNICODE_STRING VariableName,
  189. IN LPGUID VendorGuid,
  190. OUT PVOID Value,
  191. IN OUT PULONG ValueLength,
  192. OUT PULONG Attributes OPTIONAL);
  193. virtual void NtSetSystemEnvironmentValueEx(
  194. IN PUNICODE_STRING VariableName,
  195. IN LPGUID VendorGuid,
  196. IN PVOID Value,
  197. IN ULONG ValueLength,
  198. IN ULONG Attributes);
  199. virtual void NtEnumerateSystemEnvironmentValuesEx(
  200. IN ULONG InformationClass,
  201. OUT PVOID Buffer,
  202. IN OUT PULONG BufferLength);
  203. virtual void NtQuerySystemTime(
  204. OUT PLARGE_INTEGER SystemTime);
  205. virtual void NtSetSystemTime(
  206. IN PLARGE_INTEGER SystemTime,
  207. OUT PLARGE_INTEGER PreviousTime OPTIONAL);
  208. virtual void NtQuerySystemInformation(
  209. IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
  210. OUT PVOID SystemInformation,
  211. IN ULONG SystemInformationLength,
  212. OUT PULONG ReturnLength OPTIONAL);
  213. virtual void NtSetSystemInformation(
  214. IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
  215. IN PVOID SystemInformation,
  216. IN ULONG SystemInformationLength);
  217. virtual void NtQueryInformationFile(
  218. IN HANDLE FileHandle,
  219. OUT PIO_STATUS_BLOCK IoStatusBlock,
  220. OUT PVOID FileInformation,
  221. IN ULONG Length,
  222. IN FILE_INFORMATION_CLASS FileInformationClass);
  223. virtual void NtSetInformationFile(
  224. IN HANDLE FileHandle,
  225. OUT PIO_STATUS_BLOCK IoStatusBlock,
  226. IN PVOID FileInformation,
  227. IN ULONG Length,
  228. IN FILE_INFORMATION_CLASS FileInformationClass);
  229. protected:
  230. // bool GetTempKeyName(HANDLE key);
  231. FILE* m_LogFile;
  232. LPCTSTR m_pDllName;
  233. TCHAR m_TempKeyName[2048];
  234. void LOGSTR(LPCTSTR ValueName, LPCTSTR Value);
  235. };
  236. #endif // !defined(AFX_LOGGEDREGINTERCEPT_H__856F5C97_794D_40B4_B18A_DEB3C96B086F__INCLUDED_)