【发布时间】:2015-09-20 10:53:53
【问题描述】:
这是代码...
extern GetStdHandle
extern GetModuleFileNameW
extern WriteFile
extern ExitProcess
import GetStdHandle kernel32.dll
import GetModuleFileNameW kernel32.dll
import WriteFile kernel32.dll
import ExitProcess kernel32.dll
global ..start
segment .code USE32
..start:
push dword -11
call [GetStdHandle]
mov dword [hStdOut], eax
;Getting the filepath of exe on disk...
push dword 256 ;MAX_PATH
push dword [filepath] ;Pointer to the buffer
push dword 0 ;NULL
call [GetModuleFileNameW]
;Trying to output the filepath...
push dword 0
push dword nBytes
push dword 256 ;MAX_PATH
push dword filepath
push dword [hStdOut]
call [WriteFile]
xor eax, eax
push eax
call [ExitProcess]
segment .data
segment .bss
hStdOut resd 1
nBytes resd 1
filepath resd 32
我已经玩了一点,我得到的只是一个空白输出。当我玩弄它时,我也得到了一堆乱码。仍然没有文件路径,仍然没有喜悦。我有一种预感,我在 GetModuleFileNameW 上做错了什么,但我不能确定。我遵循了 Microsoft 网站上的文档,并按照您在汇编语言中的相反顺序放置了参数。我做错了什么?
【问题讨论】:
-
这个
push dword [filepath]看起来很可疑...