stdafx.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. // stdafx.h : 标准系统包含文件的包含文件,
  2. // 或是经常使用但不常更改的
  3. // 特定于项目的包含文件
  4. #pragma once
  5. #ifndef _SECURE_ATL
  6. #define _SECURE_ATL 1
  7. #endif
  8. #ifndef VC_EXTRALEAN
  9. #define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
  10. #endif
  11. #include "targetver.h"
  12. #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
  13. // 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
  14. #define _AFX_ALL_WARNINGS
  15. #include <afxwin.h> // MFC 核心组件和标准组件
  16. #include <afxext.h> // MFC 扩展
  17. #include <afxdisp.h> // MFC 自动化类
  18. #ifndef _AFX_NO_OLE_SUPPORT
  19. #include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
  20. #endif
  21. #ifndef _AFX_NO_AFXCMN_SUPPORT
  22. #include <afxcmn.h> // MFC 对 Windows 公共控件的支持
  23. #endif // _AFX_NO_AFXCMN_SUPPORT
  24. #include <afxcontrolbars.h> // 功能区和控件条的 MFC 支持
  25. #include "Global.h"
  26. #ifdef _UNICODE
  27. #if defined _M_IX86
  28. #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
  29. #elif defined _M_IA64
  30. #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
  31. #elif defined _M_X64
  32. #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
  33. #else
  34. #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
  35. #endif
  36. #endif
  37. //////////////////////////////////////////////////////////////////////////
  38. typedef LONG NTSTATUS;
  39. #define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
  40. #define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
  41. typedef enum _SYSTEM_INFORMATION_CLASS {
  42. SystemBasicInformation, // 0 Y N
  43. SystemProcessorInformation, // 1 Y N
  44. SystemPerformanceInformation, // 2 Y N
  45. SystemTimeOfDayInformation, // 3 Y N
  46. SystemNotImplemented1, // 4 Y N
  47. SystemProcessesAndThreadsInformation, // 5 Y N
  48. SystemCallCounts, // 6 Y N
  49. SystemConfigurationInformation, // 7 Y N
  50. SystemProcessorTimes, // 8 Y N
  51. SystemGlobalFlag, // 9 Y Y
  52. SystemNotImplemented2, // 10 Y N
  53. SystemModuleInformation, // 11 Y N
  54. SystemLockInformation, // 12 Y N
  55. SystemNotImplemented3, // 13 Y N
  56. SystemNotImplemented4, // 14 Y N
  57. SystemNotImplemented5, // 15 Y N
  58. SystemHandleInformation, // 16 Y N
  59. SystemObjectInformation, // 17 Y N
  60. SystemPagefileInformation, // 18 Y N
  61. SystemInstructionEmulationCounts, // 19 Y N
  62. SystemInvalidInfoClass1, // 20
  63. SystemCacheInformation, // 21 Y Y
  64. SystemPoolTagInformation, // 22 Y N
  65. SystemProcessorStatistics, // 23 Y N
  66. SystemDpcInformation, // 24 Y Y
  67. SystemNotImplemented6, // 25 Y N
  68. SystemLoadImage, // 26 N Y
  69. SystemUnloadImage, // 27 N Y
  70. SystemTimeAdjustment, // 28 Y Y
  71. SystemNotImplemented7, // 29 Y N
  72. SystemNotImplemented8, // 30 Y N
  73. SystemNotImplemented9, // 31 Y N
  74. SystemCrashDumpInformation, // 32 Y N
  75. SystemExceptionInformation, // 33 Y N
  76. SystemCrashDumpStateInformation, // 34 Y Y/N
  77. SystemKernelDebuggerInformation, // 35 Y N
  78. SystemContextSwitchInformation, // 36 Y N
  79. SystemRegistryQuotaInformation, // 37 Y Y
  80. SystemLoadAndCallImage, // 38 N Y
  81. SystemPrioritySeparation, // 39 N Y
  82. SystemNotImplemented10, // 40 Y N
  83. SystemNotImplemented11, // 41 Y N
  84. SystemInvalidInfoClass2, // 42
  85. SystemInvalidInfoClass3, // 43
  86. SystemTimeZoneInformation, // 44 Y N
  87. SystemLookasideInformation, // 45 Y N
  88. SystemSetTimeSlipEvent, // 46 N Y
  89. SystemCreateSession, // 47 N Y
  90. SystemDeleteSession, // 48 N Y
  91. SystemInvalidInfoClass4, // 49
  92. SystemRangeStartInformation, // 50 Y N
  93. SystemVerifierInformation, // 51 Y Y
  94. SystemAddVerifier, // 52 N Y
  95. SystemSessionProcessesInformation // 53 Y N
  96. } SYSTEM_INFORMATION_CLASS;
  97. typedef struct _CLIENT_ID
  98. {
  99. HANDLE UniqueProcess;
  100. HANDLE UniqueThread;
  101. }CLIENT_ID,*PCLIENT_ID;
  102. typedef struct
  103. {
  104. USHORT Length;
  105. USHORT MaxLen;
  106. USHORT *Buffer;
  107. }UNICODE_STRING, *PUNICODE_STRING;
  108. typedef struct _OBJECT_ATTRIBUTES
  109. {
  110. ULONG Length;
  111. HANDLE RootDirectory;
  112. PUNICODE_STRING ObjectName;
  113. ULONG Attributes;
  114. PVOID SecurityDescriptor;
  115. PVOID SecurityQualityOfService;
  116. } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
  117. typedef struct _IO_COUNTERSEX {
  118. LARGE_INTEGER ReadOperationCount;
  119. LARGE_INTEGER WriteOperationCount;
  120. LARGE_INTEGER OtherOperationCount;
  121. LARGE_INTEGER ReadTransferCount;
  122. LARGE_INTEGER WriteTransferCount;
  123. LARGE_INTEGER OtherTransferCount;
  124. } IO_COUNTERSEX, *PIO_COUNTERSEX;
  125. typedef enum {
  126. StateInitialized,
  127. StateReady,
  128. StateRunning,
  129. StateStandby,
  130. StateTerminated,
  131. StateWait,
  132. StateTransition,
  133. StateUnknown
  134. } THREAD_STATE;
  135. typedef struct _VM_COUNTERS {
  136. SIZE_T PeakVirtualSize;
  137. SIZE_T VirtualSize;
  138. ULONG PageFaultCount;
  139. SIZE_T PeakWorkingSetSize;
  140. SIZE_T WorkingSetSize;
  141. SIZE_T QuotaPeakPagedPoolUsage;
  142. SIZE_T QuotaPagedPoolUsage;
  143. SIZE_T QuotaPeakNonPagedPoolUsage;
  144. SIZE_T QuotaNonPagedPoolUsage;
  145. SIZE_T PagefileUsage;
  146. SIZE_T PeakPagefileUsage;
  147. } VM_COUNTERS;
  148. typedef VM_COUNTERS *PVM_COUNTERS;
  149. typedef struct _SYSTEM_THREADS {
  150. LARGE_INTEGER KernelTime;
  151. LARGE_INTEGER UserTime;
  152. LARGE_INTEGER CreateTime;
  153. ULONG WaitTime;
  154. PVOID StartAddress;
  155. CLIENT_ID ClientId;
  156. ULONG Priority;
  157. ULONG BasePriority;
  158. ULONG ContextSwitchCount;
  159. THREAD_STATE State;
  160. ULONG WaitReason;
  161. } SYSTEM_THREADS, *PSYSTEM_THREADS;
  162. typedef struct _SYSTEM_PROCESSES { // Information Class 5
  163. ULONG NextEntryDelta;
  164. ULONG ThreadCount;
  165. ULONG Reserved1[6];
  166. LARGE_INTEGER CreateTime;
  167. LARGE_INTEGER UserTime;
  168. LARGE_INTEGER KernelTime;
  169. UNICODE_STRING ProcessName;
  170. ULONG BasePriority;
  171. ULONG ProcessId;
  172. ULONG InheritedFromProcessId;
  173. ULONG HandleCount;
  174. ULONG Reserved2[2];
  175. VM_COUNTERS VmCounters;
  176. IO_COUNTERSEX IoCounters; // Windows 2000 only
  177. SYSTEM_THREADS Threads[1];
  178. } SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
  179. typedef struct _SYSTEM_HANDLE_INFORMATION
  180. {
  181. ULONG ProcessId;
  182. UCHAR ObjectTypeNumber;
  183. UCHAR Flags;
  184. USHORT Handle;
  185. PVOID Object;
  186. ACCESS_MASK GrantedAccess;
  187. } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
  188. typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO {
  189. USHORT UniqueProcessId;
  190. USHORT CreatorBackTraceIndex;
  191. UCHAR ObjectTypeIndex;
  192. UCHAR HandleAttributes;
  193. USHORT HandleValue;
  194. PVOID Object;
  195. ULONG GrantedAccess;
  196. } SYSTEM_HANDLE_TABLE_ENTRY_INFO, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO;
  197. typedef struct _SYSTEM_HANDLE_INFORMATION1 {
  198. ULONG NumberOfHandles;
  199. SYSTEM_HANDLE_TABLE_ENTRY_INFO Handles[ 1 ];
  200. } SYSTEM_HANDLE_INFORMATION1, *PSYSTEM_HANDLE_INFORMATION1;
  201. typedef enum _OBJECT_INFORMATION_CLASS {
  202. ObjectBasicInformation,
  203. ObjectNameInformation,
  204. ObjectTypeInformation,
  205. ObjectAllInformation,
  206. ObjectDataInformation
  207. } OBJECT_INFORMATION_CLASS;
  208. typedef struct _OBJECT_NAME_INFORMATION {
  209. UNICODE_STRING Name;
  210. } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
  211. typedef NTSTATUS (NTAPI *NTQUERYOBJECT)(
  212. _In_opt_ HANDLE Handle,
  213. _In_ OBJECT_INFORMATION_CLASS ObjectInformationClass,
  214. _Out_opt_ PVOID ObjectInformation,
  215. _In_ ULONG ObjectInformationLength,
  216. _Out_opt_ PULONG ReturnLength
  217. );
  218. typedef NTSTATUS
  219. (NTAPI *ZWQUERYSYSTEMINFORMATION)(
  220. IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
  221. OUT PVOID SystemInformation,
  222. IN ULONG SystemInformationLength,
  223. OUT PULONG ReturnLength OPTIONAL
  224. );
  225. ZWQUERYSYSTEMINFORMATION ZwQuerySystemInformation = (ZWQUERYSYSTEMINFORMATION)GetProcAddress(GetModuleHandleA("ntdll.dll"),"ZwQuerySystemInformation");
  226. NTQUERYOBJECT NtQueryObject = (NTQUERYOBJECT)GetProcAddress(GetModuleHandleA("ntdll.dll"),"NtQueryObject");
  227. extern int PatchWeChat();