HOHO,我的第一个用ASM写的64位程序新鲜出炉!
程序的效果就是运行后弹出对话框,并且在C盘根目录创建Hello World.txt文件。
就是这么点功能,代码却要好几行,VB实现这个仅需5行代码。不过ASM却可以做很多VB无法完成的事,我要继续学习!
代码:
;——————————————————————————–
;程序设计:中国·Parthas
;版权所有:Parthas 2006-2010
;禁止任何修改与盗版
;请访问64位汇编语言官方站 Http://Www.X64Asm.Com
;电子邮件 xywhpanda@gmail.Com Tel:138******** QQ:497242884
;官方论坛:Http://Www.X64Asm.Com/AsmBbs 官方QQ群总群:97339661
;——————————————————————————–
;编译命令 Ml64.exe /c FristWindow.Asm
;连接命令 Link.exe /SubSystem:Windows /Entry:Entry /Out:FristWindow.Exe
;——————————————————————————–
;包含文件
Includelib Kernel32.Lib
Includelib User32.Lib
MB_ICONASTERISK EQU 40H
MB_ICONINFORMATION EQU MB_ICONASTERISK
GENERIC_WRITE EQU 40000000H
FILE_ATTRIBUTE_NORMAL EQU 80H
CREATE_ALWAYS EQU 2
EXTERN MessageBoxA:PROC
EXTERN CreateFileA:PROC
EXTERN WriteFile:PROC
EXTERN ExitProcess:PROC
EXTERN CloseHandle:PROC
EXTERN lstrlen:PROC
.DATA
Parthas BYTE “Hello World!This is Parthas’ First X64 Application. My Blog:https://blog.martixdoge.com”,0
ParText BYTE “This is my first ASM Application based on WIN7 X64”,0
ParTitle BYTE “Parthas’ First X64 ASM Application”,0
ParPath db “C:\Hello World.txt”,0
.DATA?
ParL QWORD ?
hFile QWORD ?
;——————————————————————————–
;代码
.CODE
;——————————————————————————–
;——————————————————————————–
;程序入口点
Entry PROC
sub rsp,40H
lea rcx,ParPath
mov rdx,GENERIC_WRITE
xor r8,r8;mov r8,NULL
xor r9,r9;mov r9,NULL
mov rax,CREATE_ALWAYS
mov [rsp+20H],rax
mov rax,FILE_ATTRIBUTE_NORMAL
mov [rsp+28H],rax
xor rax,rax
mov [rsp+30H],rax
call CreateFileA
add rsp,40H
mov hFile,rax
sub rsp,10H
lea rcx,Parthas
call lstrlen
add rsp,10H
sub rsp,30H
mov rcx,hFile
lea rdx,Parthas
mov r8,rax
lea r9,ParL
xor rax,rax
mov [rsp+20H],rax
call WriteFile
add rsp,30H
sub rsp,10H
mov rcx,rax
call CloseHandle
add rsp,10H
sub rsp,28H
xor rcx,rcx
lea rdx,ParText
lea r8,ParTitle
mov r9,MB_ICONINFORMATION
call MessageBoxA
add rsp,28H
sub rsp,10H
call ExitProcess
add rsp,10H
Entry ENDP
;——————————————————————————–
;程序结束
END
For the help please use http://www.google.com
膜拜大神!!