我一般都是直接查看VC生成的ASM文件。
要得到汇编代码与源代码的对应,设置选项:
project settings:
---> C++
---> category == Listing files
--->Listing file type ==... 高人啊
看了很多你的帖子
你破解水平起码是我的100倍啊
我这个网络验证的外挂都在看雪顶了15楼了
能不能麻烦你帮我秒杀一下
衷心谢谢
___________________________________________________________
1.新建一个空的Win32控制台工程
2.添加hello.asm到源文件目录中
编写汇编代码
3.右键单击hello.asm-->设置...
在“Project setting”对话框的Custom Bulid中修改如下:
Commands:
ml /c /coff /Zi hello.asm
Output
hello.obj
4.F7编译组建exe可执行文件,成功!
PS:
要保证C:\Windows目录下有ml.exe和ml.err文件。
2007.12.28
Herowuking
参考《Windows汇编语言程序设计教程》(谭毓安 张雪兰编著)
Hello.asm的完整代码:
.386
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 先说明程序中用到的库、函数和常量
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
includelib msvcrt.lib
printf PROTO C :DWORD,:VARARG
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.da
szMsg db 'Hello World!', 0ah, 0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.co
start:
invoke printf, OFFSET szMsg
RET
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
; 编译链接命令:
; ml /coff hello.asm /link /subsystem:console
;来源:《Windows汇编语言程序设计教程》 谭毓安
__________________________________________________________________
虽然早就安装了RadASM,但是今天却是第一次使用它编译汇编程序。之前总是手动用CMD控制台编译链接。然而,今天第一个汇编程序用RadASM编译失败了(安装了RadASM之后,它变成系统默认的汇编编译器,双击ASm文件直接编译失败),手动的、用VC编译的、以及用MASM32编译的都成功了,刚开始很是不解,但是观察RadASM和MASM32编译的程序运行的结果发现,用MASM32编译的默认为Win32 Console Application,用RadASM编译的却不是。在Windows里面双击看看有没有黑色的控制台窗口闪现就知道了,后来看了一下jhkdiy的“Win32汇编开发环境介绍和RadAsm简明教程.chm”才知道,然来RadASM编译汇编程序也是像VC一样以工程的形式进行的,而且工程的类型有好几种。
知道了原因,接下来的就很简单了。新建一个合适类型的工程编译就成功了。后来好好的对照这jhkdiy的这个简明教程研究了一下RadASM的界面,发现却是是一个很优秀的汇编IDE工具。差点让我给删除掉了~
_______________________________________________________________
use ASM and CPP together:
1. create an ASM file
;;;;;;;;;;;;; asmsrc.asm:
.386
.model flat, stdcall
option casemap :none
.co
myasmproc proc dw1:DWORD,dw2:DWORD
mov eax,dw1
add eax,dw2
ret
myasmproc endp
end
;;;;;;;;;;;;end of asmsrc.asm
2. create a VC project name: useasm, type console application, A "Hello World" application
3. move the asm file to your project directory, then in VC project menu->Add to Project...->Files...
Files of type change to "all files", then you can select the asmsrc.asm, and click OK
4.in workspace window, FileView tab, select asmsrc.asm, right click to select "settings..." menu, custom build tab, put the following in commands edit box :
d:\masm32\bin\ml.exe /nologo /coff /Zf /c /Sa $(InputName).asm
put the following in Outputs edit box:
$(InputName).obj
5.edit your useasm.cpp as the following:
//////////////////////useasm.cpp///////////////////////////////
#include "stdafx.h"
#include <windows.h>
extern "C" int __stdcall myasmproc(DWORD d1,DWORD d2);
int main(int argc, char* argv[])
{
printf("test of using cpp and asm together, if it works, it is done by masterz,otherwise I don't know who write this^_^\n");
int ret=myasmproc(22,33);
printf("ASM result:%d\n",ret);
return 0;
}
//////////////////////end of useasm.cpp///////////////////////////////
6. build the project and run it, it works.
notes: I assume you have installed masm32V8(you can get it from http://www.movsd.com/masmdl.htm) at D:\masm32
评论