There is the well known CONTAINING_RECORD() macro defined, for instance, in Winnt.h:
#define CONTAINING_RECORD(address, type, field) ((type *)( \\
Your ways to determine the address of the containing structure work only if 'type' is a type that does not use multiple inherritance. Otherwise, the macros would dereference the NULL pointer, and that is always guaranteed trouble. I once asked a question about this matter ( Is this valid ANSI C++ code? Trying to generate offsets of structure members at compile-time ).