其中定义了SYSTEM_INFORMATION_CLASS
Where is SYSTEM_INFORMATION_CLASS defined?
我发现了一个简短的C++代码,旨在防止应用程序使用DLL注入窃取焦点。和C++一样,我遇到了一些未定义的东西和缺少库的问题。
具体来说,这个常数是未定义的:SYSTEM_INFORMATION_CLASS
。在此代码中:
typedef NTSTATUS( WINAPI* PNT_QUERY_SYSTEM_INFORMATION ) (
__in SYSTEM_INFORMATION_CLASS SystemInformationClass,
__inout PVOID SystemInformation,
__in ULONG SystemInformationLength,
__out_opt PULONG ReturnLength
);
windows.h
已经包含在内,所以它一定缺少其他内容。在谷歌上搜索时,我得到了很多关于CPU温度的结果,但我看不出应该在其中包含什么。。。
如文档中所述,此枚举在Winternl.h
头文件中定义。7.1版SDK头文件中的定义是:
typedef enum _SYSTEM_INFORMATION_CLASS {
SystemBasicInformation = 0,
SystemPerformanceInformation = 2,
SystemTimeOfDayInformation = 3,
SystemProcessInformation = 5,
SystemProcessorPerformanceInformation = 8,
SystemInterruptInformation = 23,
SystemExceptionInformation = 33,
SystemRegistryQuotaInformation = 37,
SystemLookasideInformation = 45
} SYSTEM_INFORMATION_CLASS;
此NT API函数的文档编制有些不足。您可以通过在线搜索找到其他值。至于如何使用这些其他价值观,你可能需要再次树立信心,依靠你可以从网络搜索中找到的逆向工程信息。
使用未记录的功能是有风险的业务。如果Microsoft在将来的版本中更改或删除功能,从而破坏您的程序,请不要感到惊讶。在使用未记录的功能或记录为将来可能更改的功能之前,您可能需要三思而后行。同样,我链接到的文档确实以这种方式警告您:
NtQuerySystemInformation可能在未来版本的Windows中更改或不可用。应用程序应使用本主题中列出的备用函数。
最后,我使用搜索词"typedef SYSTEM_INFORMATION_CLASS
"找到了一些SYSTEM_INFORMATION_class定义。虽然在发布这篇文章的时候,我自己的问题是第三个结果。。。
这是我得到的:
typedef enum _SYSTEM_INFORMATION_CLASS {
SystemBasicInformation,
SystemProcessorInformation,
SystemPerformanceInformation,
SystemTimeOfDayInformation,
SystemPathInformation,
SystemProcessInformation,
SystemCallCountInformation,
SystemDeviceInformation,
SystemProcessorPerformanceInformation,
SystemFlagsInformation,
SystemCallTimeInformation,
SystemModuleInformation,
SystemLocksInformation,
SystemStackTraceInformation,
SystemPagedPoolInformation,
SystemNonPagedPoolInformation,
SystemHandleInformation,
SystemObjectInformation,
SystemPageFileInformation,
SystemVdmInstemulInformation,
SystemVdmBopInformation,
SystemFileCacheInformation,
SystemPoolTagInformation,
SystemInterruptInformation,
SystemDpcBehaviorInformation,
SystemFullMemoryInformation,
SystemLoadGdiDriverInformation,
SystemUnloadGdiDriverInformation,
SystemTimeAdjustmentInformation,
SystemSummaryMemoryInformation,
SystemNextEventIdInformation,
SystemEventIdsInformation,
SystemCrashDumpInformation,
SystemExceptionInformation,
SystemCrashDumpStateInformation,
SystemKernelDebuggerInformation,
SystemContextSwitchInformation,
SystemRegistryQuotaInformation,
SystemExtendServiceTableInformation,
SystemPrioritySeperation,
SystemPlugPlayBusInformation,
SystemDockInformation,
SystemPowerInformation,
SystemProcessorSpeedInformation,
SystemCurrentTimeZoneInformation,
SystemLookasideInformation
} SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS;
由于无法编译任何内容,我不能确定它是否正确。我刚刚创建了新的.hpp
文件并添加了上面的代码。
看看这个:http://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/sysinfo/query.htm.
[Nt]|[Zw]QuerySystemInformation
和输入参数有一个很好的描述。
- 这个语法std::class<>{}(arg1, arg2) 在C++中是什么意思?
- C++核心准则 C35 对于接口类"A base class destructor should be either public and virtual, or protected and nonv
- 使用模板进行堆栈实现; "name followed by :: must be a class or namespace"
- "Undefined class"作为is_base_of的论据
- 如何将class.cpp和class.hpp编译为一个.o文件
- '{'标记之前的预期类名,然后在预声明时无效使用不完整的类型'class class_name'
- 如何使用"derived input class"创建派生类?
- 错误:"Left of getValue must have class/struct/union"
- ' class a : b ' 和 ' class a : public b ' 之间的继承类不同
- Pybind11 Class Definition
- 在C++中使用没有合作伙伴Class/Cpp文件的头文件是否实用
- C2011 'CMemDC':Visual Studio 2019中的'class'类型重新定义
- TypeError: [c++ addon class] 不是构造函数
- C++ class template
- 当初始值设定项是基类名时'initializer does not name a non-static data member or base class'错误
- Clearing Class Foo with new(pFoo) Foo()
- C++ class vs a library
- 继承类时"invalid use of incomplete type ‘class tree_node_t’"
- 使用"class"关键字,后跟未声明的标识符
- "storage-class information" __declspec() 是什么意思?