Metodo IModelObject::GetContext (dbgmodel.h)

Il metodo GetContext restituisce il contesto host associato all'oggetto . Rappresenta la destinazione, il processo, il thread e così via. l'oggetto proviene da .

Sintassi

HRESULT GetContext(
  IDebugHostContext **context
);

Parametri

context

Il contesto host dell'oggetto verrà restituito in questo argomento.

Valore restituito

Questo metodo restituisce HRESULT che indica l'esito positivo o negativo.

Commenti

Codice di esempio

ComPtr<IDebugHost> spHost;      // get the debug host
ComPtr<IModelObject> spObject;  // get an object within a process (or a process object)

ComPtr<IDebugHostContext> spContext;
ComPtr<IDebugHostMemory> spMemory;
if (SUCCEEDED(spObject->GetContext(&spContext)) &&
    SUCCEEDED(spHost.As(&spMemory)))
{
    // Read 4 bytes from address 0x100 in the process context represented by spObject
    char bytes[4];
    ULONG64 bytesRead;
    HRESULT hr = spMemory->ReadBytes(spContext.Get(), 0x100, bytes, ARRAYSIZE(bytes), &bytesRead);
    
    // Check / Use read.
}

Requisiti

Requisito Valore
Intestazione dbgmodel.h

Vedi anche

Interfaccia IModelObject