I have the folowing code:
mov ecx, 0
mov eax, offset ReadWritten
RottenApple:
push ecx
push eax
push 0
push eax
push 1
push offset bytearray
push consoleOutHandle
call WriteConsole
pop eax
pop ecx
inc ecx
inc eax
cmp ecx, 10
jne RottenApple
The intention is to print, if the user input was “123456”, fist 1, then 2, etc… But it only print 10 1’s. Whats wrong with incrementing the offset,and why doesn’t it make any diference?
Note that
eaxis destroyed by the call toWriteConsole(it will contain the return value) so you have to save it just like you do withecx.Update:
On closer look, you are calling the
WriteConsolewith wrong arguments. You want to increment the offset, as you say in the question, but you are not doing that.Try something like: