Hi what does that mean ? *wonder wonder wonder wonder*


MOV DW_hFile, EAX
INVOKE lstrlen, ADDR DB_data
INVOKE WriteFile, hFile, ADDR data, EAX, ADDR bytes_written, NULL

The error message is ascribe to the last line.

Regard FF.
Posted on 2003-04-16 13:47:41 by Forginforcer
It means you cannot use eax to represent a value when using that particular API call. The register is overwritten before the value is used by the function.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmasm/html/vcerrA2133.asp
Posted on 2003-04-16 13:49:50 by donkey
THX ! :confused:

P.S. I bookmarked this site imediately :confused:
Posted on 2003-04-16 14:01:06 by Forginforcer
As Donkey's link says, eax is used by the assembler itself.
The actual code will assemble to the following:



push 0 ; NULL
lea eax, [esp +/- some_value]
push eax ; ADDR bytes_written
push eax ; Here eax has lost your value because of above
lea eax, [esp +/- some_value]
push eax ; ADDR data
push [esp +/- n] ; hFile
call WriteFile


Mirno
Posted on 2003-04-16 17:05:13 by Mirno

As Donkey's link says, eax is used by the assembler itself.
The actual code will assemble to the following:



push 0 ; NULL
lea eax, [esp +/- some_value]
push eax ; ADDR bytes_written
push eax ; Here eax has lost your value because of above
lea eax, [esp +/- some_value]
push eax ; ADDR data
push [esp +/- n] ; hFile
call WriteFile


Mirno

You wish ;) It's ebp + value, MASM can't use parameters/locals without a stackframe :).But it shows the idea correctly.

Shortest solution is to just use lea ecx, bytes_written before the invoke and ecx instead of addr bytes_written.

Thomas
Posted on 2003-04-16 17:09:06 by Thomas
I used after "INVOKE lstrlen, String" MOV lenght, EAX.
Is taht also good ?
Are there differences ?
Posted on 2003-04-16 17:13:34 by Forginforcer
Why don't you try it and tell us :eek:
Posted on 2003-04-16 17:22:40 by donkey
I found that out later !
Sorry !
Posted on 2003-04-16 17:36:41 by Forginforcer