stdafx.h 9.1 KB

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