Hi,

when I call WriteConsoleA with a zero terminated string i get an incorrect output.



szWriteText db 'Hello, world!", 0

push 0
push 0
push 16d
push offset szWriteText
push hStdout
call WriteConsoleA



Output: "Hello, world! t"
Why is there a t at the end? :)



sWriteText db 'Hello, world!'

push 0
push 0
push 16d
push offset sWriteText
push hStdout
call WriteConsoleA

Output: "Hello, world!"
Correct. Good but why? :)

Regards,
Paris
Posted on 2003-07-10 02:12:40 by Parasight
don't need zero terminate .
your string wants to print have length is 13d.
why do you?


push 16d


it is


push 13d


SC
Posted on 2003-07-10 03:10:40 by h4ng4m3
Parasight, WriteConsole doesn't stop at NUL, it stops when it has written the amount of bytes you tell it to. Pushing a hardcoded 16 == pretty bad code.
Posted on 2003-07-10 03:22:44 by f0dder
Thanks! Pardon my stupidity ;)
Posted on 2003-07-10 03:38:19 by Parasight
Parasight,

You can use the StdOut function from the masm32 lib. :)
Posted on 2003-07-10 04:29:32 by Vortex