[反调试] STATUSINFO

背景

STARTUPINFO 反调试:
程序启动时默认会通过 explorer 资源管理器,调用 CreateProcess() 函数创建的时候会把 STARTUPINFO 结构体中的值设置为0,但如果通过调试器启动程序时该值并不会发生变化,我们可以通过判断结构体中的 dwFlags 参数来实现反调试.

代码

#include <Windows.h>
#include <stdio.h>

int IsDebug()
{
    
    
	STARTUPINFO si = {
    
    0};
	GetStartupInfo(&si);

	if (si.dwFlags != 1)
		return 1;
	return 0;
}

int main(int argc, char * argv[])
{
    
    
	int ret = IsDebug();
	printf("%d \n", ret);


	system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/Simon798/article/details/110244506
今日推荐