Partager via


ReadField

The ReadField and ReadFieldStr macros read a field whose size is less than 8 bytes from a structure initialized with InitTypeRead or InitTypeReadPhysical.

#define ReadField(Field) \
    GetShortField(0, #Field, 0)

#define ReadFieldStr(FieldStr) \
    GetShortField(0, FieldStr, 0)

Parameters

Field

Specifies the name of the field. The C-preprocessor will turn Field into a string.

FieldStr

Specifies the name of the field. FieldStr is expected to be an ASCII string.

Return Value

If this macro succeeds, it returns the value of the specified field in the previously initialized structure. The structure is the one initialized in a previous call to InitTypeRead, InitTypeStrRead, InitTypeReadPhysical, InitTypeStrReadPhysical, or GetShortField. The field is the one specified by the Field or FieldStr parameter of ReadField. The return value is cast to ULONG64. If the function fails, it returns the value zero.

Remarks

The parameter Field is the name of the member. For ReadField, the C pre-processor will turn the parameter into a string. For ReadFieldStr, Field is expected to already be an ASCII string. For example, the following two commands are identical and read the same member from a previously initialized structure:

  • ReadField( myField );
  • ReadFieldStr( "myField" );

Submembers can be read by using a period-separated path, for example, "myField.mySubfield".

Note   Because these macros use the GetShortField function, they must be called from the same source code file as the macros that initialize the structure for reading. For more details, see GetShortField.

 

If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).

Requirements

Header

Wdbgexts.h (include Wdbgexts.h, Wdbgexts.h, or Dbgeng.h)

See also

InitTypeRead

InitTypeReadPhysical

GetShortField

 

 

Send comments about this topic to Microsoft