I now know that this is not vise:

INVOKE SomeApi,eax
(Gives a GPF on Win2k)

But is this always safe:

INVOKE SomeApi,(POINT ptr ).x

Does anyone know the rules here?
:confused:
Posted on 2001-07-20 07:51:28 by KetilO
As far i can know, there is absolutely no possibility for
any problem with this. If 'invoke' does what it is supposed
to do, this mean:

- push this Parameter
- push this other one
- ...
- call the jumps table Adress of this Function.

Whatever you push is pushed. No matter if it is an immediate,
a Value in memory, an address or a Register. There is no way
for the called function to know where the value on the stack
comes from. This is nothing else than a number written on the
Stack.

I hav many
> call 'THISDLL.ThatFunction' eax
in SpAsm, and i never encouted problems with this under 2000.

So, your 'eax error' comes from something else (before).


betov.

________________________________


Thanks for supporting M$ software, keep on the good work.


Bill Gates.
Posted on 2001-07-20 09:58:36 by Betov
Masm somtimes gives the errormessage:

Register overwritten by invoke

Are you shure eax is not used for adress calculations in
Masm because doing this solved the problem:

mov val,eax
invoke SomeApi,val

KetilO
Posted on 2001-07-20 10:09:51 by KetilO
KetilO,

MASM uses eax register for address calculation on
only when you use ADDR operator for variable
defined in stack ( May be a param or local ). In
that case it will give you the error message. In
other situation using eax register in the invoke
will do no harm.
Posted on 2001-07-20 11:14:34 by sjhenry
_________________________________________

"...Masm because doing this solved the problem:
mov val,eax
invoke SomeApi,val"
_________________________________________

... This would be highly surprising... Are you sure you are
sending a value?

If yes, write:

nop
nop
nop
invoke SomeApi, eax

and run a disassembler to see what was really done...


betov.
Posted on 2001-07-20 12:35:27 by Unregistered
I just looked into the problem, and yes you are right.
I had also added "uses ebx" and completly forgot that
I did. So my confident in Masm doing things right is restored.

Thanks for your replies.
Posted on 2001-07-20 14:09:38 by KetilO