結果發佈到我的文章我可以在windows xp上使用int21h來打印東西嗎?,我看過一篇關於使用Windows API的文章,並且在這篇文章中提到使用_WriteConsole @ 4 API將消息打印到控制檯。文章在http://cs.lmu.edu/~ray/notes/x86assembly/。x86彙編 - 如何使用Windows API _WriteConsole @ 4 - masm32語法
這是到目前爲止我的代碼:
.386P
.model flat
extern [email protected]:near
extern [email protected]:near
extern [email protected]:near
public _go
.data
msg byte 'if you get this, it worked.', 10
handle dword ?
written dword ?
.code
start:
_go:
push -11
call [email protected]
mov handle, eax
push 0
push offset written
push 13
push offset msg
push handle
call [email protected]
push 0
call [email protected]
end start
我使用這個語法編譯代碼: ML:
ml (the file is called test.asm) test.asm /c
鏈接:
link test.obj C:\masm32\lib\kernel32.lib /SUBSYSTEM:CONSOLE /entry:go
我已經得到了它來編譯和鏈接,但是當我運行產生的.exe時,它完全沒有任何作用,甚至不會出現錯誤轉。控制檯只是黑色。爲什麼是這樣?
任何幫助將不勝感激。對於這個論壇的用戶,我爲每天轟炸stackoverflow.com道歉,這只是我有很少的資源可以學習。
由於提前,
Progrmr
適用於Visual Studio 2010(10.00.40219.01),儘管您應該將'13'調整爲msg的實際長度。 – DCoder
真的嗎?我正在使用命令提示符並在帖子中鍵入'ml'和'link'字符串。我怎麼能得到這個工作? – Progrmr