Discussion:
unknown
1970-01-01 00:00:00 UTC
Permalink
-// LONG
-// FIELD_OFFSET(
-// IN <typename> type,
-// IN <fieldname> field
-// );
-#define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field))
-/*++
-
-Routine Description:
-
- Calculates the byte offset of a field in a structure of type "type".=
The
- offset is from the beginning of the containing structure.
-
- Note that since this macro uses compile-time type knowledge, there =
is no
- equivalent C procedure for this macro.
-
-Arguments:
-
- type - Supplies the type name of the containing structure.
-
- field - Supplies the field name of the field whose offset is =
to be
- computed.
-
-Return Value:
-
- Returns the byte offset of the named field within a structure of the =
named
- type.
---*/
-
-
-
-

-// <typename> FAR *
-// CONTAINING_RECORD(
-// IN PVOID address,
-// IN <typename> type,
-// IN <fieldname> field
-// );
-#define CONTAINING_RECORD(address, type, field) ((type FAR *)( \
- (PCHAR)(address) - \
- (PCHAR)(&((type *)0)->field)))
-/*++
-
-Routine Description:
-
- Retrieves a typed pointer to a linked list item given the address o=
f the
- link storage structure embedded in the linked list item, the type o=
f the
- linked list item, and the field name of the embedded link st=
orage
- structure.
-
- Note that since this macro uses compile-time type knowledge, there =
is no
- equivalent C procedure for this macro.
-
-Arguments:
-
- address - Supplies the address of a LIST_ENTRY structure embedded in=
an a
- linked list item.
-
- type - Supplies the type name of the containing linked list=
item
- structure.
-
- field - Supplies the field name if the LIST_ENTRY structure emb=
edded
- within the linked list item structure.
-
-Return Value:
-
- Returns a pointer to the linked list item.
---*/
-
-
-#endif // !defined( _WINNT_ )
-
-
-//
-//

Loading...