Heres another dumb question for you all, say I have the follow:
MyObj struct
m_fpSetWindowLong DWORD NULL
MyObj ends
MyObjPTR TYPEDEF PTR MyObj
MyProc proto :ObjPTR
MyProc proc pData:ObjPTR
MOV EAX, pData.m_fpSetWindowLong
MyProc endp
Why does the the assembler give me the following error on the MOV line:
error A2006: undefined symbol : m_fpSetWindowLong
Also, what would I have to do to use invoke to call SetwindowLong? eg
invoke pData.m_fpSetWindowLong, 0,0,0
Thanks for any help.....
MyObjPTR TYPEDEF PTR MyObj
MyProc proto :ObjPTR
You used ObjPTR instead of MyObjPTR.
Regarding using invoke indirectly, check this thread (http://www.masmforum.com/simple/index.php?topic=694.0).
Oops sorry Jibz, that was just a typo. I still get the same error message?
That's because it's a double indirection. The mov instruction would have to first load the pointer from the stack, and then load the struct member from the struct it points to. You have to first get the pointer, and then use it to access the memory:
MOV EDX, pData
MOV EAX, [MyObjPTR PTR EDX].m_fpSetWindowLong
or you can use ASSUME if you have multiple accesses throughout the function and keep the struct pointer in the same register:
MOV EDX, pData
ASSUME EDX:MyObjPTR
MOV EAX, [EDX].m_fpSetWindowLong
...
ASSUME EDX:NOTHING