i would like to write a string in console output using writeconsole API but it doesn't work i link and build it using console in masm
here is the code
.386
.MODEL Flat,STDCALL
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
STD_OUTPUT_HANDLE EQU -11
.DATA
Msg db "Hello World",13,10,0
lmessage dd 13
.DATA?
consoleOutHandle dd ?
bytesWritten dd ?
.code
start:
INVOKE GetStdHandle, STD_OUTPUT_HANDLE
mov [consoleOutHandle],eax
invoke WriteConsole, consoleOutHandle,offset Msg,offset lmessage,offset bytesWritten,0
INVOKE ExitProcess,0
end start
when i run the exe output i got the following
C:\masm32>18.exe
C:\masm32>
empty ouput
so any advice
The third parameter is the number of characters to be written, not the address of the number of characters to be written. Fortunately for you the address turned out to be over 64K which caused the call to fail with the error code ERROR_NOT_ENOUGH_MEMORY.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With