I have a pointer to a masm structure.
How can I "typecast" it to it's original type and thus use it directly.
There may be no need of doing this :bg, but I want to know this just for knowlegde sake.
The struct:
xyz STRUCT
version jint ?
nOptions jint ?
options DWORD ?
ignoreUnrecognized jboolean ?
xyz ENDS
LOCAL abc:DWORD ;say this is the pointer
LOCAL ste:xyz
;ste=(xyz)abc
local abc:ptr xyz
Utterly useless, save for readability....? A more readable line would be
local pSTE ; the address of "ste"
There is no actual typecasting involved. And dwords can be considered untyped.
Anyway, what you do is 'type' the pointer when you have its value..
mov edi,ste
assume edi:PTR xyz ;edi is now 'typed' to the xyz struct
mov eax,[edi].version
mov edx,[edi].options
...etc...
assume edi:nothing ;turn the typing back off
Thanks I got it,
I had seen such an example a few days ago.
I don't write in masm generally, that's why I didn't recall it.