flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 23 Jul 2010, 11:54
ReadConsole returns more than one keystroke for some keys. Try displaying what ReadConsole returns to you and you will see. Alternatively you can try http://ollydbg.de to watch what happens.
|
|||
![]() |
|
bitshifter 23 Jul 2010, 23:22
You can trick it by reading 2 bytes from the stream.
Its because ReadConsole blocks (w/echo) until VK_RETURN is found. Code: format PE GUI 4.0 entry start include 'win32a.inc' section '.code' code readable executable start: invoke AllocConsole invoke GetStdHandle,STD_INPUT_HANDLE mov [g_stdin],eax invoke GetStdHandle,STD_OUTPUT_HANDLE mov [g_stdout],eax .mloop: invoke WriteConsole,[g_stdout],g_number,1,g_iobytes,0 invoke ReadConsole,[g_stdin],g_inchar,2,g_iobytes,0 cmp byte[g_inchar],'q' je .quit inc [g_number] cmp [g_number],'5' jl .mloop .quit: invoke ExitProcess,0 section '.data' data readable writeable g_stdin dd ? g_stdout dd ? g_iobytes dd ? g_inchar dw ? g_number db '0' section '.idata' import data readable library kernel32,'kernel32.dll',\ user32,'user32.dll' include 'api\kernel32.inc' include 'api\user32.inc' |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.