IDebugComPlusSymbolProvider::CreateTypeFromPrimitive

Crea un tipo dal tipo primitivo specificato.

Sintassi

int CreateTypeFromPrimitive(
    uint          dwPrimType,
    IDebugAddress pAddress,
    IDebugField   ppType
);

Parametri

dwPrimType
[in] Valore dell'enumerazione CorElementType che rappresenta il tipo primitivo.

pAddress
[in] Oggetto indirizzo rappresentato da un'interfaccia IDebugAddress .

ppType
[in] Restituisce un oggetto IDebugField che descrive il tipo.

Valore restituito

Se ha esito positivo, restituisce S_OK; in caso contrario, restituisce un codice di errore.

Esempio

Nell'esempio seguente viene illustrato come implementare questo metodo per un oggetto CDebugSymbolProvider che espone l'interfaccia IDebugComPlusSymbolProvider .

HRESULT CDebugSymbolProvider::CreateTypeFromPrimitive(
    DWORD dwPrimType,
    IDebugAddress* pAddress,
    IDebugField** ppType)
{
    HRESULT hr = S_OK;
    CDEBUG_ADDRESS addr;
    const COR_SIGNATURE* pTypeInfo = (const COR_SIGNATURE*) & dwPrimType;
    CDebugGenericParamScope* pGenScope = NULL;

    //
    // This function will only work for primitive types
    //

    METHOD_ENTRY( CDebugSymbolProvider::CreateTypeFromPrimitive );

    IfFailGo( pAddress->GetAddress( &addr ) );

    IfNullGo( pGenScope = new CDebugGenericParamScope(addr.GetModule(), addr.tokClass, addr.GetMethod()), E_OUTOFMEMORY );

    IfFailGo( CreateType( pTypeInfo,
                          1,
                          addr.GetModule(),
                          addr.GetMethod(),
                          pGenScope,
                          ppType ) );

    METHOD_EXIT( CDebugSymbolProvider::CreateTypeFromPrimitive, hr );

Error:

    RELEASE( pGenScope );
    return hr;
}

Vedi anche