|
2 | 2 | title: "IDiaDataSource::loadDataForExe | Microsoft Docs"
|
3 | 3 | ms.date: "11/04/2016"
|
4 | 4 | ms.topic: "conceptual"
|
5 |
| -dev_langs: |
| 5 | +dev_langs: |
6 | 6 | - "C++"
|
7 |
| -helpviewer_keywords: |
| 7 | +helpviewer_keywords: |
8 | 8 | - "IDiaDataSource::loadDataForExe method"
|
9 | 9 | ms.assetid: d94a1068-f53f-44b5-b6fb-00dec361a7f2
|
10 | 10 | author: "mikejo5000"
|
11 | 11 | ms.author: "mikejo"
|
12 | 12 | manager: jillfra
|
13 |
| -ms.workload: |
| 13 | +ms.workload: |
14 | 14 | - "multiple"
|
15 | 15 | ---
|
16 | 16 | # IDiaDataSource::loadDataForExe
|
17 |
| -Opens and prepares the debug data associated with the .exe/.dll file. |
18 |
| - |
19 |
| -## Syntax |
20 |
| - |
21 |
| -```C++ |
22 |
| -HRESULT loadDataForExe ( |
23 |
| - LPCOLESTR executable, |
24 |
| - LPCOLESTR searchPath, |
25 |
| - IUnknown* pCallback |
26 |
| -); |
27 |
| -``` |
28 |
| - |
29 |
| -#### Parameters |
30 |
| - executable |
31 |
| - [in] Path to the .exe or .dll file. |
32 |
| - |
33 |
| - searchPath |
34 |
| - [in] Alternate path to search for debug data. |
35 |
| - |
36 |
| - pCallback |
37 |
| - [in] An `IUnknown` interface for an object that supports a debug callback interface, such as the [IDiaLoadCallback](../../debugger/debug-interface-access/idialoadcallback.md), [IDiaLoadCallback2](../../debugger/debug-interface-access/idialoadcallback2.md), the [IDiaReadExeAtOffsetCallback](../../debugger/debug-interface-access/idiareadexeatoffsetcallback.md), and/or the [IDiaReadExeAtRVACallback](../../debugger/debug-interface-access/idiareadexeatrvacallback.md) interfaces. |
38 |
| - |
39 |
| -## Return Value |
40 |
| - If successful, returns `S_OK`; otherwise, returns an error code. The following table shows some of the possible error codes for this method. |
41 |
| - |
42 |
| -|Value|Description| |
43 |
| -|-----------|-----------------| |
44 |
| -|E_PDB_NOT_FOUND|Failed to open the file, or the file has an invalid format.| |
45 |
| -|E_PDB_FORMAT|Attempted to access a file with an obsolete format.| |
46 |
| -|E_PDB_INVALID_SIG|Signature does not match.| |
47 |
| -|E_PDB_INVALID_AGE|Age does not match.| |
48 |
| -|E_INVALIDARG|Invalid parameter.| |
49 |
| -|E_UNEXPECTED|Data source has already been prepared.| |
50 |
| - |
51 |
| -## Remarks |
52 |
| - The debug header of the .exe/.dll file names the associated debug data location. |
53 |
| - |
54 |
| - 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](../../debugger/debug-interface-access/idialoadcallback-notifydebugdir.md) is invoked when the `IDiaDataSource::loadDataForExe` method finds and processes a debug directory. |
55 |
| - |
56 |
| - The [IDiaReadExeAtOffsetCallback](../../debugger/debug-interface-access/idiareadexeatoffsetcallback.md) and [IDiaReadExeAtRVACallback](../../debugger/debug-interface-access/idiareadexeatrvacallback.md) 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. |
57 |
| - |
58 |
| - To load a .pdb file without validation, use the [IDiaDataSource::loadDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loaddatafrompdb.md) method. |
59 |
| - |
60 |
| - To validate the .pdb file against specific criteria, use the [IDiaDataSource::loadAndValidateDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loadandvalidatedatafrompdb.md) method. |
61 |
| - |
62 |
| - To load a .pdb file directly from memory, use the [IDiaDataSource::loadDataFromIStream](../../debugger/debug-interface-access/idiadatasource-loaddatafromistream.md) method. |
63 |
| - |
64 |
| -## Example |
65 |
| - |
66 |
| -```C++ |
67 |
| -class MyCallBack: public IDiaLoadCallback |
68 |
| -{ |
69 |
| -... |
70 |
| -}; |
71 |
| -MyCallBack callback; |
72 |
| -... |
73 |
| -HRESULT hr = pSource->loadDataForExe( L"myprog.exe", L".\debug", (IUnknown*)&callback); |
74 |
| -if (FAILED(hr)) |
75 |
| -{ |
76 |
| - // Report error |
77 |
| -} |
78 |
| -``` |
79 |
| - |
80 |
| -## See Also |
81 |
| - [IDiaDataSource](../../debugger/debug-interface-access/idiadatasource.md) |
82 |
| - [IDiaLoadCallback](../../debugger/debug-interface-access/idialoadcallback.md) |
83 |
| - [IDiaLoadCallback2](../../debugger/debug-interface-access/idialoadcallback2.md) |
84 |
| - [IDiaLoadCallback::NotifyDebugDir](../../debugger/debug-interface-access/idialoadcallback-notifydebugdir.md) |
85 |
| - [IDiaReadExeAtOffsetCallback](../../debugger/debug-interface-access/idiareadexeatoffsetcallback.md) |
86 |
| - [IDiaReadExeAtRVACallback](../../debugger/debug-interface-access/idiareadexeatrvacallback.md) |
87 |
| - [IDiaDataSource::loadDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loaddatafrompdb.md) |
88 |
| - [IDiaDataSource::loadAndValidateDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loadandvalidatedatafrompdb.md) |
89 |
| - [IDiaDataSource::loadDataFromIStream](../../debugger/debug-interface-access/idiadatasource-loaddatafromistream.md) |
| 17 | +Opens and prepares the debug data associated with the .exe/.dll file. |
| 18 | + |
| 19 | +## Syntax |
| 20 | + |
| 21 | +```C++ |
| 22 | +HRESULT loadDataForExe ( |
| 23 | + LPCOLESTR executable, |
| 24 | + LPCOLESTR searchPath, |
| 25 | + IUnknown* pCallback |
| 26 | +); |
| 27 | +``` |
| 28 | + |
| 29 | +#### Parameters |
| 30 | +executable |
| 31 | +[in] Path to the .exe or .dll file. |
| 32 | + |
| 33 | +searchPath |
| 34 | +[in] Alternate path to search for debug data. |
| 35 | + |
| 36 | +pCallback |
| 37 | +[in] An `IUnknown` interface for an object that supports a debug callback interface, such as the [IDiaLoadCallback](../../debugger/debug-interface-access/idialoadcallback.md), [IDiaLoadCallback2](../../debugger/debug-interface-access/idialoadcallback2.md), the [IDiaReadExeAtOffsetCallback](../../debugger/debug-interface-access/idiareadexeatoffsetcallback.md), and/or the [IDiaReadExeAtRVACallback](../../debugger/debug-interface-access/idiareadexeatrvacallback.md) interfaces. |
| 38 | + |
| 39 | +## Return Value |
| 40 | +If successful, returns `S_OK`; otherwise, returns an error code. The following table shows some of the possible error codes for this method. |
| 41 | + |
| 42 | +|Value|Description| |
| 43 | +|-----------|-----------------| |
| 44 | +|E_PDB_NOT_FOUND|Failed to open the file, or the file has an invalid format.| |
| 45 | +|E_PDB_FORMAT|Attempted to access a file with an obsolete format.| |
| 46 | +|E_PDB_INVALID_SIG|Signature does not match.| |
| 47 | +|E_PDB_INVALID_AGE|Age does not match.| |
| 48 | +|E_INVALIDARG|Invalid parameter.| |
| 49 | +|E_UNEXPECTED|Data source has already been prepared.| |
| 50 | + |
| 51 | +## Remarks |
| 52 | +The debug header of the .exe/.dll file names the associated debug data location. |
| 53 | + |
| 54 | +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](../../debugger/debug-interface-access/idialoadcallback-notifydebugdir.md) is invoked when the `IDiaDataSource::loadDataForExe` method finds and processes a debug directory. |
| 55 | + |
| 56 | +The [IDiaReadExeAtOffsetCallback](../../debugger/debug-interface-access/idiareadexeatoffsetcallback.md) and [IDiaReadExeAtRVACallback](../../debugger/debug-interface-access/idiareadexeatrvacallback.md) 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. |
| 57 | + |
| 58 | +To load a .pdb file without validation, use the [IDiaDataSource::loadDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loaddatafrompdb.md) method. |
| 59 | + |
| 60 | +To validate the .pdb file against specific criteria, use the [IDiaDataSource::loadAndValidateDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loadandvalidatedatafrompdb.md) method. |
| 61 | + |
| 62 | +To load a .pdb file directly from memory, use the [IDiaDataSource::loadDataFromIStream](../../debugger/debug-interface-access/idiadatasource-loaddatafromistream.md) method. |
| 63 | + |
| 64 | +## Example |
| 65 | + |
| 66 | +```C++ |
| 67 | +class MyCallBack: public IDiaLoadCallback |
| 68 | +{ |
| 69 | +... |
| 70 | +}; |
| 71 | +MyCallBack callback; |
| 72 | +... |
| 73 | +HRESULT hr = pSource->loadDataForExe( L"myprog.exe", L".\debug", (IUnknown*)&callback); |
| 74 | +if (FAILED(hr)) |
| 75 | +{ |
| 76 | + // Report error |
| 77 | +} |
| 78 | +``` |
| 79 | +
|
| 80 | +## See Also |
| 81 | +[IDiaDataSource](../../debugger/debug-interface-access/idiadatasource.md) |
| 82 | +[IDiaLoadCallback](../../debugger/debug-interface-access/idialoadcallback.md) |
| 83 | +[IDiaLoadCallback2](../../debugger/debug-interface-access/idialoadcallback2.md) |
| 84 | +[IDiaLoadCallback::NotifyDebugDir](../../debugger/debug-interface-access/idialoadcallback-notifydebugdir.md) |
| 85 | +[IDiaReadExeAtOffsetCallback](../../debugger/debug-interface-access/idiareadexeatoffsetcallback.md) |
| 86 | +[IDiaReadExeAtRVACallback](../../debugger/debug-interface-access/idiareadexeatrvacallback.md) |
| 87 | +[IDiaDataSource::loadDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loaddatafrompdb.md) |
| 88 | +[IDiaDataSource::loadAndValidateDataFromPdb](../../debugger/debug-interface-access/idiadatasource-loadandvalidatedatafrompdb.md) |
| 89 | +[IDiaDataSource::loadDataFromIStream](../../debugger/debug-interface-access/idiadatasource-loaddatafromistream.md) |
0 commit comments