WINDOW struct
  struct win
    handle HANDLE ?
  ends
WINDOW ends

mainwin WINDOW <>

1. mov eax,.handle
2. mov eax,.win.handle

Both [1] and [2] will work (and access the same field).

What can I do to make masm acccept only [2] and produce
an error (eg. 'variable not found') on [1]?


Is there another way (switch?), except this:

WIN struct
  handle HANDLE ?
ends

WINDOW struct
  win WIN <>
WINDOW ends
Posted on 2009-08-20 03:10:33 by aleksaZR

Your last example is the standard way of building up more complex structs from simpler ones. It's not pretty, but its VERY easy to read and understand, and does not impact apon build times.

Nonetheless, MASM's macro engine IS powerful enough to accomplish such a task.

Generating an error is easy - detecting the error condition in the raw sourcecode at buildtime is going to be a huge job, Biterider has achieved something like what you want, be warned that you're going to write a LOT of macro code to achieve it, and that's going to have some impact on your build times.


Posted on 2009-08-20 03:32:58 by Homer