Expand Minimize

CONTAINING_RECORD macro

The CONTAINING_RECORD macro 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.

Syntax


PCHAR CONTAINING_RECORD(
  [in]  PCHAR Address,
  [in]  TYPE Type,
  [in]  PCHAR Field
);

Parameters

Address [in]

A pointer to a field in an instance of a structure of type Type.

Type [in]

The name of the type of the structure whose base address is to be returned.

Field [in]

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.

Remarks

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.

Requirements

Version

Available starting with Windows 2000.

Header

Ntdef.h (include Wdm.h or Ntddk.h)

IRQL

Any level

See also

FIELD_OFFSET

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft