Hello, all!
I think this is the right place for this problem...
I want to store in .DATA section an offset to a label within a function like this:
.DATA
L1Addr DWORD x
L2Addr DWORD y
.CODE
MyFunction PROC Param1:DWORD, Param2:DWORD
Label1:
mov eax, 1
Label2:
mov ecx, 1
et
MyFunction ENDP
where x = OFFSET Label1 and y = OFFSET Label2
I know I could make both labels public, but I don't want that. Also, disassambly is not an efficient solution, because every time I would change my function I would have to find it again. :eek
Is there any other way? :'(
Thanks
Nick
Nick,
try something like this.
MyFunc proc args etc ....
.data
plbl1 dd label1
plbl2 dd label2
.code
; your code
label1:
; more code
label2:
ret
MyFunc endp
Whohohoooo! Thanks hutch!!! That works perfectly!!
:: makes label global
.DATA
L1Addr DWORD offset Label1
L2Addr DWORD offset Label2
.CODE
MyFunction PROC Param1:DWORD, Param2:DWORD
Label1::
mov eax, L1Addr
Label2::
mov ecx, L2Addr
ret
MyFunction ENDP
Yes, thanks, drizz, but that's exactly what I don't want: a global label ... :)
Regards,
Nick
ooops i didn't see that hutchs code was surounded by a procĀ (overlookded proc/endp lines) :red