利用detours劫持自己的系统函数
2015-08-12 17:08
525 查看
//劫持自己
#include<stdio.h>#include<stdlib.h>
#include<Windows.h>
#include<string.h>
#include "detours.h"
#pragma comment(lib,"detours.lib")
static int(*poldsystem)(const char * _Command) = system;
int newsystem(const char * _Command)
{
//禁止tasklist
char *p = strstr(_Command, "tasklist");
if (p == NULL)
{
poldsystem(_Command);
}
else
{
printf("%stasklist禁止执行", _Command);
return 0;
}
}
void Hook()
{
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread);
DetourAttach((void**)&poldsystem,newsystem);
DetourTransactionCommit();
}
void main()
{
system("calc");
Hook();
system("calc");
system("tasklist");
getchar();
}
相关文章推荐
- java中的修辞
- Android工具类收集
- CSU 1674 K swap operation
- maven java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
- 1111111111111111111111111111111
- zoj2688 Requirements 曼哈顿距离
- 【转载】iOS App提交指南-协议、税务和银行业务
- ORA-01013:用户请求取消当前的操作
- Swift开发学习(两):Playground
- 【程序员眼中的统计学(4)】离散概率分布的运用:善用期望
- libvirt-adabddad
- 企业招聘要什么人
- Win 7 安裝 SQL Server 2008 -Performance counter registry failed
- surf
- [设计模式学习]设计模式学习之简单工厂模式
- Spring 中的default-lazy-init="true" 和 lazy-init="true"
- 清除浮动方法及优缺点
- 谁是Windows 10中国市场的赢家?
- Android应用的性能问题
- Java进阶(十二)JDK版本错误之Unsupported major.minor version 51.0(jdk版本错误)