对于具有偏移量的字段(例如位置类型指示 LocationMember 的字段),GetOffset 方法将返回从包含类型(此指针)的基址到字段本身的数据的偏移量。 此类偏移量始终表示为无符号 64 位值。
如果给定字段没有与包含类型的基址相偏移的位置,GetOffset 方法将失败。
语法
HRESULT GetOffset(
ULONG64 *offset
);
参数
offset
字段数据相对于包含类型的基址(例如:此指针)的偏移量将在此处返回。
返回值
此方法返回 HRESULT,指示成功或失败。
言论
ComPtr<IDebugHostField> spField; /* get a field symbol (see EnumerateChildren) */
ULONG64 fieldOffset;
if (SUCCEEDED(spField->GetOffset(&fieldOffset)))
{
// For locations which have offsets (as indicated by GetLocationKind),
// fieldOffset will contain the offset of the field from the start
// of its containing type.
}
要求
要求 | 价值 |
---|---|
标头 | dbgmodel.h |