This little testapp:



.386
.MODEL FLAT,stdcall
option casemap:none

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

.CODE

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
ret
main endp

mainCRTStartup proc stdcall
invoke main
invoke ExitProcess,eax
mainCRTStartup endp


END


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