应用层
NtQueryInformationProcess函数,微软给出的一些信息:
https://docs.microsoft.com/zh-cn/windows/win32/api/winternl/nf-winternl-ntqueryinformationprocess?redirectedfrom=MSDN
这个函数的功能是检索指定进程的信息(Retrieves information about the specified process.)。
[C] 纯文本查看 复制代码__kernel_entry NTSTATUS NtQueryInformationProcess( HANDLE ProcessHandle, PROCESSINFOCLASS ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength, PULONG ReturnLength);
PROCESSINFOCLASS 是一个枚举类型:
[C] 纯文本查看 复制代码typedef enum _PROCESSINFOCLASS { ProcessBasicInformation = 0, ProcessDebugPort = 7, ProcessWow64Information = 26, ProcessImageFileName = 27, ProcessBreakOnTermination = 29} PROCESSINFOCLASS;
与调试相关的只有ProcessDebugPort,微软列出了CheckRemoteDebuggerPresent()和 IsDebuggerPresent()与NtQueryInformationProcess相关。
CheckRemoteDebuggerPresent终极会调用NtQueryInformationProcess:
IsDebuggerPresent()并不会调用NtQueryInformationProcess,而是直接在PEB中取值返回。
[C] 纯文本查看 复制代码int main(){ IsDebuggerPresent(); cout |