We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.


Retrieves the lines in a specified compiland that contain a specified relative virtual address (RVA).

HRESULT findLinesByRVA ( 
   DWORD                 rva,
   DWORD                 length,
   IDiaEnumLineNumbers** ppResult


[in] Specifies the address as an RVA.


[in] Specifies the number of bytes of address range to cover with this query.


[out] Returns an IDiaEnumLineNumbers object that contains a list of all the line numbers that cover the specified address range.

If successful, returns S_OK; otherwise, returns an error code.

This example shows a function that obtains all line numbers contained in the specified function using the function's relative virtual address and length.

IDiaEnumLineNumbers* GetLineNumbersByRVA(IDiaSymbol *pFunc, IDiaSession *pSession)
    IDiaEnumLineNumbers* pEnum = NULL;
    DWORD                rva;
    ULONGLONG            length;

    if (pFunc->get_relativeVirtualAddress ( &rva ) == S_OK)
        pFunc->get_length ( &length );
        pSession->findLinesByRVA( rva, static_cast<DWORD>( length ), &pEnum );