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