stdafx.h 9.1 KB

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