Please forgive me, as I don't/can't have masm on this computer...

I'm trying to flow out a couple of procs on paper. I want to pass a couple of params (2 global dwords defined in .data?) to a 2nd proc, have it write to them so that I can access those dwords after the 2nd proc returns.

I'm guessing that it will work something like the following:


.data?
param1 dd ?
param2 dd ?
...
...
proc1 proc
invoke proc2,param1,param2
mov eax,param1
PrintHex eax
;I'm sure there's something in the debug.lib so that I don't have to move param1 into a register
;but I can't look right now as I don't have masm installed.
ret
proc1 endp

proc2 proc stuff:dword,morestuff:dword
push ebx
mov ebx,stuff
mov ebx,[ebx]
mov ebx,0DEADBEEFh
pop ebx
ret
proc2 endp


Can someone please correct me if that works or if I've got something wrong? I can't try this code until I get home tonight and I don't have internet access at home right now so I can't post a question after I try this myself.

thanks,
will
Posted on 2004-03-05 16:58:27 by Will
you just need to change the line
invoke proc2,param1,param2
to
invoke proc2,addr param1,addr param2
:)

I am not sure if I need to write this, but in order to write in the dwords in proc2, you'll:


mov ebx,stuff
mov dword ptr[ebx],0DEADBEEFh

your code doesn't modify the "stuff" var (I guess this remark is really dull ^^", but just in case :) )
Posted on 2004-03-05 17:11:26 by Ultrano