【发布时间】:2017-01-02 06:24:42
【问题描述】:
这是第一个名为 hooktry.cpp 的程序
#include <iostream>
#include<stdio.h>
using namespace std;
class c1{
int c=2;
public:
int * printadd()
{
int *p=&c;
printf("the address of c is %d\n",p);
return p;
}
void printv()
{
printf("the value is ===%d\n",c);
}
};
int main(int argc, const char * argv[]) {
int *p;
c1 mem;
char c;
p=mem.printadd();
mem.printv();
*p=12;
scanf("%c",&c);
mem.printv();
return 0;
}
输出:
c的地址是1606416304
值为 ===2
同时运行另一个代码hooktry2.cpp
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
// insert code here...
int *p;
p=(int*)1606416304;
*p=23;
return 0;
}
我收到分段错误
hooktry2.cpp 无法访问 hooktry.cpp 一的内存
有没有办法通过修补操作系统来关闭这种保护
或者这是不可能的。
我正在研究恶意软件和挂钩程序,例如游戏作弊等...
或者这不是我在做的钩子......
【问题讨论】:
-
这不是您读取其他进程内存的方式。通常你会使用OS specific system calls 来做类似的事情
-
这可以在 20 年前使用 DOS 6.1 的 IBM PC 上运行。欢迎来到 21 世纪。
-
“我正在研究像游戏作弊这样的恶意软件和钩子程序” - 很高兴看到你完全无法做到这些。