Condividi tramite


Metodo IDebugHostSymbols::EnumerateModules (dbgmodel.h)

Il metodo EnumerateModules crea un enumeratore che enumererà ogni modulo disponibile in un particolare contesto host. Tale contesto host potrebbe incapsulare un contesto di processo o incapsulare qualcosa come il kernel di Windows.

Sintassi

HRESULT EnumerateModules(
  IDebugHostContext          *context,
  IDebugHostSymbolEnumerator **moduleEnum
);

Parametri

context

Contesto host per il quale enumerare ogni modulo caricato.

moduleEnum

Verrà restituito un enumeratore che enumererà ogni modulo caricato nel contesto specificato.

Valore restituito

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

Osservazioni

codice di esempio

ComPtr<IDebugHost> spHost; /* get the host */

ComPtr<IDebugHostSymbols> spSym;
if (SUCCEEDED(spHost.As(&spSym)))
{
    // Enumerate all modules in the current UI context (process) of the debug host:
    ComPtr<IDebugHostSymbolEnumerator> spEnum;
    if (SUCCEEDED(spSym->EnumerateModules(USE_CURRENT_HOST_CONTEXT, &spEnum)))
    {
        HRESULT hr = S_OK;
        while (SUCCEEDED(hr))
        {
            ComPtr<IDebugHostSymbol> spModSym;
            hr = spEnum->GetNext(&spModSym);
            if (SUCCEEDED(hr))
            {
                ComPtr<IDebugHostModule> spModule;
                if (SUCCEEDED(spModSym.As(&spModule))) /* should always succeed */
                {
                    // spModule is one of the modules in the current
                    // UI context (process) of the debug host
                }
            }
        }

        // hr == E_BOUNDS : hit the end of the enumerator
        // hr == E_ABORT  : a user interrupt was requested / 
        //                  propagate upwards immediately
    }
}

Fabbisogno

Requisito Valore
intestazione dbgmodel.h

Vedere anche

interfaccia IDebugHostSymbols