description | title | ms.date | ms.topic | f1_keywords | helpviewer_keywords | author | ms.author | manager | ms.subservice | dev_langs | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Attach a session to a program. |
IDebugProgramEx2::Attach |
11/04/2016 |
reference |
|
|
maiak |
maiak |
mijacobs |
debug-diagnostics |
|
Attach a session to a program.
int Attach(
IDebugEventCallback2 pCallback,
uint dwReason,
IDebugSession2 pSession
);
HRESULT Attach(
IDebugEventCallback2* pCallback,
DWORD dwReason,
IDebugSession2* pSession
);
pCallback
[in] An IDebugEventCallback2 object that represents the callback function that the attached debug engine sends events to.
dwReason
[in] A value from the ATTACH_REASON enumeration that describes the reason for the attach operation.
pSession
[in] A value that uniquely identifies the session that is attaching to the program.
If successful, returns S_OK
; otherwise returns an error code. This method should return E_ATTACH_DEBUGGER_ALREADY_ATTACHED
if the program is already attached.
The port that contains the program can use the value in pSession
to determine which session is attempting to attach to the program. For example, if a port allows only one debug session to attach to a process at a time, the port can determine if the same session is already attached to other programs in the process.
Note
The interface passed in pSession
is to be treated only as a cookie, a value that uniquely identifies the session debug manager attaching to this program; none of the methods on the supplied interface are functional.