I'm making a jump table with MASM. Being able to use invoke is part of my purpose.

If I try to use any instructions in the proc body (jmp, mov, lea, add, etc), MASM tries to make a stack frame.
My solution is to code the jmp with opcodes: (the code below works BTW)




AddRef proto
.
.
AddRef proc
db 255,37
dd $+10h
dd ?
AddRef endp
.
.


I've tried:

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
.
.
.
OPTION PROLOGUE:DefaultOption
OPTION EPILOGUE:DefaultOption

and

AddRef proc FORCENOFRAME

But I just get errors from the linker.



Is it just not possible to use invoke with a proc with no frames?
Yes, I must use proc for the initial E8 call to the table. Labels dont assemble correctly.

Thanks.
Posted on 2002-09-17 13:05:27 by ThoughtCriminal
Please, note proper syntax in bold:
	OPTION PROLOGUE:NONE

OPTION EPILOGUE:NONE

xxx PROC a:DWORD, b:DWORD
ret
xxx ENDP

OPTION PROLOGUE:[b]PROLOGUEDEF[/b]
OPTION EPILOGUE:[b]EPILOGUEDEF[/b]
Posted on 2002-09-17 18:50:05 by bitRAKE
the "hardcore" way
xxx proto stdcall :DWORD, :DWORD


xxx:

mov eax, [esp+4] ;a
mov edx, [esp+8] ;b
retn 8
:) but this method contradicts to title "...to use invoke Posted on 2002-09-17 19:18:12 by stryker
bitRAKE-

Heh, copied the syntax from a post by The Svin. I'll try the correct one, thanks.



stryker-

I tried some 'hardcore' stuff C,STDCALL etc. I use the a PROC just to get the E8****** form of call.
I'm just making a jump-table for a dll, so calls can be made with standard invoke and the code will be like you are calling a lib.

Invoke just setsup the stack. Call puts the return address on the stack. So you call to the jumptable, the first instruction is to jump to the address contained in the next dword. The address of the next dword is the entrypoint of a dll function.

I never touch the stack in the proc, just redirect flow to the dll.

Thanks.
Posted on 2002-09-17 23:25:36 by ThoughtCriminal