Share via


IDiaDataSource::loadDataForExe

Opens and prepares the debug data associated with the .exe/.dll file.

HRESULT loadDataForExe (
   LPCOLESTR executable,
   LPCOLESTR searchPath,
   IUnknown* pCallback
);

Parameters

Return Value

If successful, returns S_OK; otherwise, returns an error code. The following table shows some of the possible error codes for this method.

Value

Description

E_PDB_NOT_FOUND

Failed to open the file, or the file has an invalid format.

E_PDB_FORMAT

Attempted to access a file with an obsolete format.

E_PDB_INVALID_SIG

Signature does not match.

E_PDB_INVALID_AGE

Age does not match.

E_INVALIDARG

Invalid parameter.

E_UNEXPECTED

Data source has already been prepared.

Remarks

The debug header of the .exe/.dll file names the associated debug data location.

This method reads the debug header and then searches for and prepares the debug data. The progress of the search may, optionally, be reported and controlled through callbacks. For example, the IDiaLoadCallback::NotifyDebugDir is invoked when the IDiaDataSource::loadDataForExe method finds and processes a debug directory.

The IDiaReadExeAtOffsetCallback and IDiaReadExeAtRVACallback interfaces allow the client application to provide alternative methods for reading data from the executable file when the file cannot be accessed directly through standard file I/O.

To load a .pdb file without validation, use the IDiaDataSource::loadDataFromPdb method.

To validate the .pdb file against specific criteria, use the IDiaDataSource::loadAndValidateDataFromPdb method.

To load a .pdb file directly from memory, use the IDiaDataSource::loadDataFromIStream method.

Example

class MyCallBack: public IDiaLoadCallback
{
...
};
MyCallBack callback;
...
HRESULT hr = pSource->loadDataForExe( L"myprog.exe", L".\debug", (IUnknown*)&callback);
if (FAILED(hr))
{
    // Report error
}

See Also

Reference

IDiaDataSource

IDiaLoadCallback

IDiaLoadCallback2

IDiaLoadCallback::NotifyDebugDir

IDiaReadExeAtOffsetCallback

IDiaReadExeAtRVACallback

IDiaDataSource::loadDataFromPdb

IDiaDataSource::loadAndValidateDataFromPdb

IDiaDataSource::loadDataFromIStream