News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

more complicated structure declaration

Started by vid, November 07, 2007, 05:35:47 PM

Previous topic - Next topic

vid

hi, how do i properly declare following types of structure members?

- pointer to another structure
- pointer to procedure

of course i can just make them DWORDS, but i wonder if there is better type (more explicit) for these.

Mark Jones

#1
...
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

drizz

;; procedure prototype and pointer
myproc proto :dword,:dword
pmyproc typedef ptr myproc

;; structure definition and pointer
MYSTRUCT struct
MYSTRUCT ends
PMYSTRUCT typedef ptr MYSTRUCT
OTHERSTRUCT struct
  pmy PMYSTRUCT ?
  pp pmyproc ?
OTHERSTRUCT ends
POTHERSTRUCT typedef ptr OTHERSTRUCT

;;usage:
myother proc param:pmyproc
;; dummy code
invoke param,0,0 ;; this is why masm rocks
assume edi:POTHERSTRUCT
invoke [edi].pp,0,0 ;; this is why masm rocks

assume edi:nothing
ret
myother endp


The truth cannot be learned ... it can only be recognized.

Shell

Quote from: drizz on November 07, 2007, 10:23:30 PM
;; procedure prototype and pointer
myproc proto :dword,:dword
pmyproc typedef ptr myproc

;; structure definition and pointer
MYSTRUCT struct
MYSTRUCT ends
PMYSTRUCT typedef ptr MYSTRUCT
OTHERSTRUCT struct
  pmy PMYSTRUCT ?
  pp pmyproc ?
OTHERSTRUCT ends
POTHERSTRUCT typedef ptr OTHERSTRUCT

;;usage:
myother proc param:pmyproc
;; dummy code
invoke param,0,0 ;; this is why masm rocks
assume edi:POTHERSTRUCT
invoke [edi].pp,0,0 ;; this is why masm rocks

assume edi:nothing
ret
myother endp


:dazzled: OMG, you have no idea how invaluable this is for me at this very moment. Thank you once again drizz  :U

Vortex

assume edi:POTHERSTRUCT
invoke [edi].pp,0,0 ;; this is why masm rocks


or you could do without ASSUME :

invoke POTHERSTRUCT.pp[edi],0,0