Hi !

I working for a while at some console program and i use
two function to print the text (WriteLn, Write).
Those functions work perfect on Windows 2000 but nothing
happens when i run the program in Windows 98.

I would debug program by myself but i have installed Win2000, so if someone is so good to help me can take a look at the
sources that i atached.


bye :( :confused:
Posted on 2001-12-21 12:28:22 by eXterminator
There are a few 'bugs' in this part of the main proc:
-Misaligned push edx/pop edx: Everytime the loop executes it 'pops edx'. It only pushs anything to the stack if the .IF condidtion at the start of this is met
-The loop will never exit:


mov ecx, 1
cmp ecx,2
jnz @B

This I guarentee will never get your code anywhere




mov edx, default_rate
push edx
@@:
invoke ReadFile, [stdin],addr option_nr, lengthof option_nr,ADDR bRead, NULL
pop edx


.if byte ptr [option_nr] == 42h || byte ptr [option_nr] == 62h ;checks if B or b is pressed
szText fmt, '%6d'
.if edx == 115200
mov edx, 2400
.elseif edx == 57600
mov eax, edx
call _mul
mov edx, eax
.elseif edx == 38400
add edx, 19200
.elseif edx == 19200
mov eax, edx
call _mul
mov edx, eax
.elseif edx == 9600
mov eax, edx
call _mul
mov edx, eax
.elseif edx == 4800
mov eax, edx
call _mul
mov edx, eax
.elseif edx == 2400
mov eax, edx
call _mul
mov edx, eax
.endif
push edx
invoke wsprintf, addr buf, addr fmt, edx
invoke WriteConsoleOutputCharacter, [newout], addr buf, 6, dword ptr crd,\
addr lpNumberOfCharsRead
.endif
mov ecx, 1
cmp ecx,2
jnz @B



And just a pointer, if you are every multiplity by a value which can be represented by a value 2^x where x is from 0 -> 32 (on a 32Bit system) it is much more efficent to use a shift in both speed and size.

i.e for x*2


shl eax,1


The same applies to a divide.


I dunno but maybe Win2000 is coping much better which the stack underrun which is why it isn't crashing ur app??
Posted on 2001-12-21 18:52:04 by huh