IDiaSegment
Maps data from the section number to segments of address space.
IDiaSegment : IUnknown
Methods in Vtable Order
The following table shows the methods of IDiaSegment.
Method |
Description |
---|---|
Retrieves the segment number. |
|
Retrieves the offset in segments where the section begins. |
|
Retrieves the number of bytes in the segment. |
|
Retrieves a flag that indicates whether the segment can be read. |
|
Retrieves a flag that indicates whether the segment can be modified. |
|
Retrieves a flag that indicates whether the segment is executable. |
|
Retrieves the section number that maps to this segment. |
|
Retrieves the relative virtual address (RVA) of the beginning of the section. |
|
Retrieves the virtual address (VA) of the beginning of the section. |
Remarks
Because the DIA SDK already performs translations from the section offset to relative virtual addresses, most applications will not make use of the information in the segment map.
Notes for Callers
Obtain this interface by calling the IDiaEnumSegments::Item or IDiaEnumSegments::Next methods. See the example for details.
Example
This function displays the address of all segments in a table and the nearest symbol.
void ShowSegments(IDiaTable *pTable, IDiaSession *pSession)
{
CComPtr<IDiaEnumSegments> pSegments;
if ( SUCCEEDED( pTable->QueryInterface(
_uuidof( IDiaEnumSegments ),
(void**)&pSegments )
)
)
{
CComPtr<IDiaSegment> pSegment;
while ( SUCCEEDED( hr = pSegments->Next( 1, &pSegment, &celt ) ) &&
celt == 1 )
{
DWORD rva;
DWORD seg;
pSegment->get_addressSection( &seg );
if ( pSegment->get_relativeVirtualAddress( &rva ) == S_OK )
{
printf( "Segment %i addr: 0x%.8X\n", seg, rva );
pSegment = NULL;
CComPtr<IDiaSymbol> pSym;
if ( psession->findSymbolByRVA( rva, SymTagNull, &pSym ) == S_OK )
{
CDiaBSTR name;
DWORD tag;
pSym->get_symTag( &tag );
pSym->get_name( &name );
printf( "\tClosest symbol: %ws (%ws)\n",
name != NULL ? name : L"",
szTags[ tag ] );
}
}
}
}
}
Requirements
Header: Dia2.h
Library: diaguids.lib
DLL: msdia80.dll