dll注入实现MFC程序劫持(4)

dll注入实现MFC程序劫持(4)


双击会运行system("pause")打开计算器

现在禁止打开

#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<string.h>
#include"detours.h"
#pragma comment (lib ,"detours.lib" )

static int (*oldsystem)(const char * _Command) = system;

int  newsystem(const char * _Command ){
        return 0;
}

void Hook()
{
       DetourRestoreAfterWith();
       DetourTransactionBegin();
       DetourUpdateThread(GetCurrentThread());
       DetourAttach(( void **)&oldsystem, newsystem);
       DetourTransactionCommit();
}

_declspec(dllexport ) void go(){
       Hook();
}
  




原文地址:https://www.cnblogs.com/ZhangJinkun/p/4531493.html