.code

hConsole dd ?
bWritten dd ?

text db 'hi,'0
textlen equ $-text

invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConsole,eax

invoke WriteConsole, hConsole, ADDR text, textlen, ADDR bWritten, NULL

GetLastError return:

ERROR_NOACCESS EQU 998



Ideas?
Posted on 2002-01-26 15:24:17 by unknow
I don't know why it dosen't work but there is StdOut and StdIn functions in the masm32.lib wich you can use
Posted on 2002-01-26 16:12:05 by Quantum
from MSDN:

ERROR_NOACCESS Invalid access to memory location. 998

:?

Error Message:
Invalid access to memory location.

User Action:
Contact the supplier of the running application




ahahahahahAHAHAHAHHA ;)
Posted on 2002-01-26 16:36:14 by unknow
A) Is this what you really have:
text db 'hi,'0

B) Maybe you shouldn't write nulls to the stdout.
Posted on 2002-01-26 17:04:33 by eet_1024
I assumed this wasn't yor real code because you have bWritten in the code section and since the code section is not writable by default WriteConsole can't write to it. Have you checked the return value from GetStdHandle? I did a test here and it returned an INVALID_HANDLE_VALUE, very strange
Posted on 2002-01-26 17:28:32 by Quantum
.386p
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib

.DATA

text db 'hi' ; i tried with db 'hi',0 too
textlen equ $-text


.DATA?

hConsole dd ?
bWritten dd ?


.CODE

start:

invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConsole,eax

invoke WriteConsole, hConsole, ADDR text, textlen, ADDR bWritten, NULL
invoke ExitProcess,NULL

end start


doesnt work ..
Posted on 2002-01-26 17:37:54 by unknow
I forgot to change my COMPILE.BAT ...

Link /SUBSYSTEM:WINDOWS
to
Link /SUBSYSTEM:CONSOLE


Sorry ...
Posted on 2002-01-26 17:44:42 by unknow