简单的加法计算器dll
今天,我跟大家聊聊dll嗯,快开始吧!
首先,这次的项目需要一个共用的“Lib.h”这里上代码:
#include<Windows.h>
#define LIBAPI __declspec(dllimport)
LIBAPI int Add(int nLeft, int nRight);
加法程序(算1+2=?,有点幼稚,请原谅。。。)
#include<Windows.h>
#include<stdio.h>
#include<conio.h>
#include"Lib.h"
int main()
{
printf("1+2=%d", Add(1,2));
_getch();
return 0;
}
然后编写一个原始dll,将他拷贝到加法程序的目录中
#include"Lib.h"
int Add(int nLeft, int nRight)
{
return nLeft + nRight;
}
运行效果:
OK!一切正常!我们成功了!
ps:这里用了“dlll受攻击者”,是因为在做hook实验。。。
项目:
exe模块:
dll模块:
要加项目配置,在Release目录有一个lib文件,把他包含到项目中
参考:http://jingyan.baidu.com/article/215817f78839c21eda1423b9.html 顶一下 很厉害{:10_266:} 学习 看到HOOK,感觉很屌~~{:10_266:}
页:
[1]