首先是编辑dll库
汇编码:
1;######################################################################### 2; Assembler directives 3 4.486 5.model flat,stdcall 6option casemap:none 7 8;######################################################################### 9; Include file 10 11include AAA.inc 12 13.const 14 szTitle db '爱静',0 15.code 16 17;######################################################################### 18; Common AddIn Procedures 19 20DllEntry proc hInst, reason, reserved1 21 mov eax, 1 22 ret 23DllEntry Endp 24; Export this proc (it is autoexported if MakeDef is enabled with option 2) 25InstallDll proc uses ebx hWin:DWORD, fOpt:DWORD 26 mov eax, 1 27 ret 28 29InstallDll Endp 30; Export this proc (it is autoexported if MakeDef is enabled with option 2) 31_adds proc a,b 32 lea eax,szTitle 33 ret 34_adds endp 35;######################################################################### 36End DllEntry
只定义了一个简单的函数 adds 接受2个参数返回一个字符串指针(指针内存的就是内存地址的位置而已) 关于这点可以看C++反汇编与逆向分析技术揭秘
def 文件
EXPORTS _adds
上面的步骤就是生成普通的dll库
接下来写C语言部分:
头文件中定义: 注意这部分只能在头文件中定义
1#ifdef __cplusplus 2extern "C" { 3#endif 4 char * __stdcall _adds(int i,int b); 5#ifdef __cplusplus 6} 7#endif
这里看到我们将 4字节的DWORD 当做int 和放在eax中的 "爱静" 字符串的首地址当做char*;这点不明白的可以看C++反汇编与逆向分析技术揭秘,
接下来就需要向项目中添加 刚才汇编生成的lib文件了

选择lib文件 ,让后就可以了..
当然要运行的程序下必须含有 DLL文件..看好了是汇编生成的DLL文件 而不是lib文件
文件结构如下

VS 真是强大的编辑器= =window下最好的木有之一.