CONTAINING_RECORD

PCHAR
CONTAINING_RECORD(
IN PCHAR
Address,
IN TYPE 
Type,
IN PCHAR  Field
);

CONTAINING_RECORD returns the base address of an instance of a structure given the type of the structure and the address of a field within the containing structure.

Parameters

Address

Points to a field in an instance of a structure of type Type.

Type

The name of the type of the structure whose base address is to be returned. For example, type IRP.

Field

The name of the field pointed to by Address and which is contained in a structure of type Type .

Return Value

Returns the address of the base of the structure containing Field.

Comments

Called to determine the base address of a structure whose type is known when the caller has a pointer to a field inside such a structure.  This macro is useful for symbolically accessing other fields in a structure of known type.

Callers of CONTAINING_RECORD can be running at any IRQL as long as the structure is resident. If a page fault might occur, callers must be at or below IRQL APC_LEVEL.

See Also

FIELD_OFFSET