本帖最后由 就是随便看看 于 2021-5-3 07:30 编辑
[C++] 纯文本查看 复制代码 #include "iostream"
#include "Windows.h"
#include "tchar.h"
#include "ntdll/ntdll.h"
//使用TLS
#pragma comment(linker,"/INCLUDE:__tls_used")
DWORD isDebug = 0;
void NTAPI TLS_CALLBACK(PVOID DllHandle, DWORD Reason, PVOID Reserved)
{
if (Reason == DLL_PROCESS_ATTACH)
{
::MessageBoxA(NULL, "Tls函数执行1", NULL, NULL);
//不接受内核调试信息
//NtSetInformationThread(GetCurrentThread(),TreadHidePromDebugger,0,0);
//NtQueryInformationProcess()
}
}
void NTAPI TLS_CALLBACK2(PVOID DllHandle, DWORD Reason, PVOID Reserved)
{
if (Reason == DLL_PROCESS_ATTACH)
{
::MessageBoxA(NULL, "Tls函数执行2", NULL, NULL);
//不接受内核调试信息
//NtSetInformationThread(GetCurrentThread(),TreadHidePromDebugger,0,0);
//NtQueryInformationProcess()
}
}
int main()
{
MessageBoxA(NULL, "Main函数执行", "提示", MB_OK);
system("pause");
//return 0;
}
//新建一段数据,放到TLS这个目录表里面 函数指针数组
#pragma data_seg (".CRT$XLX")
PIMAGE_TLS_CALLBACK pTlsCallBacks[] = { TLS_CALLBACK,TLS_CALLBACK2 ,NULL };
#pragma data_seg()
提示找不到源文件"ntdll/ntdll.h"
|