Hello !
Bellow are some functions that i made to print something on
a console. They work fine on Win2000 but not the same thing
happens on Win98.

What's the problem ?????????

strlen proc uses edi ecx lpstr:DWORD
mov edi, dword ptr
xor eax, eax
or ecx, -00000001
repne scasb
not ecx
dec ecx
mov eax, ecx
ret
strlen endp

Write proc uses esi eax ecx hConsoleOut:DWORD, lpszText:DWORD
mov esi, dword ptr
invoke strlen,
@@: inc esi
cmp byte ptr , 0h
jnz short @B
sub esi, eax
invoke WriteFile, , esi, eax, NULL, NULL
ret
Write endp

WriteLn proc uses esi edi ecx eax hConsoleOut:DWORD, lpszText:DWORD
mov esi, dword ptr
invoke strlen,
@@: inc esi
cmp byte ptr , 0h
jnz short @B
mov edi,
mov dword ptr , 0A0Dh
sub esi, eax
add eax, 2
push eax
invoke WriteFile, , esi, eax, NULL, NULL
pop eax
add esi, eax
dec esi
mov dword ptr , edi
ret
WriteLn endp
Posted on 2001-12-19 13:46:53 by eXterminator
Try putting your functions into a dll. I've noticed that pecular things happen when you touch the 4 mean registers within an app (and you push/pop them), but I haven't seen it when I use a dll. Here is a dll (and console app) written FAsm 1.4:
Posted on 2001-12-19 20:32:03 by eet_1024
Well eet_1024 i think that i resolved the problem that i had.
Now i use a pushad to save the regs and a popad to restore them :)

Well now i think that users of Win9x/2k can use the functions
without problems.

WriteLn proc hConsoleOut:DWORD, lpszText:DWORD

pushad
mov esi, dword ptr
xor ecx, ecx
@@:
inc ecx
inc esi
cmp byte ptr , 0h
jnz short @B
mov edi,
mov word ptr , 0A0Dh
sub esi, ecx
add ecx, 2
push ecx
invoke WriteFile, , esi, ecx, NULL, NULL
pop ecx
add esi, ecx
dec esi
mov dword ptr , edi
popad
ret 0008

WriteLn endp

Write proc hConsoleOut:DWORD, lpszText:DWORD

pushad
mov esi, dword ptr
xor ecx, ecx
@@:
inc ecx
inc esi
cmp byte ptr , 0h
jnz short @B
sub esi, ecx
invoke WriteFile, , esi, ecx, NULL, NULL
popad
ret 0008

Write endp

:alright:
Posted on 2001-12-20 13:31:26 by eXterminator