This little testapp:

.MODEL FLAT,stdcall
option casemap:none

include \masm32\include\
include \masm32\include\


main proc c public

local hConsole:dword
local dwChar:dword
local dwRead:dword
local oldmode:dword

invoke GetStdHandle, STD_INPUT_HANDLE
mov hConsole,eax

invoke GetConsoleMode, hConsole, addr oldmode

invoke SetConsoleMode, hConsole, 0
invoke ReadConsole,hConsole,addr dwChar,1,addr dwRead,0
mov al,byte ptr dwChar
cmp al,1Bh
jnz @B

invoke SetConsoleMode, hConsole, oldmode

xor eax,eax
main endp

mainCRTStartup proc stdcall
invoke main
invoke ExitProcess,eax
mainCRTStartup endp


works as expected in Win9x (waits for ESC key pressed), but fails on WinXP (never ends because you dont get the ESC keys).

I want to know if theres a bug in the code above or in Win9x or is this a "feature" of WinXP?
Posted on 2002-06-02 15:13:59 by japheth