Beispiel #1
0
HRESULT
CIhvConnectivityProfile::GetNativeData
(
    LPVOID* ppvData
)
{
    HRESULT                     hr          =   S_OK;
    PIHV_CONNECTIVITY_PROFILE   pIhvProfile =   NULL;
    BSTR                        bstrParam2  =   NULL;

    if ( !ppvData )
    {
        hr = E_INVALIDARG;
        BAIL_ON_FAILURE( hr );
    }

    pIhvProfile = (PIHV_CONNECTIVITY_PROFILE) malloc( sizeof( IHV_CONNECTIVITY_PROFILE ) );
    if ( !pIhvProfile )
    {
        hr = E_OUTOFMEMORY;
        BAIL_ON_FAILURE( hr );
    }
    ZeroMemory( pIhvProfile, sizeof( IHV_CONNECTIVITY_PROFILE ) );

    hr =
    GetParamBSTR
    (
        &bstrParam2
    );
    BAIL_ON_FAILURE( hr );

    hr =
    Wstr2Wstr
    (
        bstrParam2,
        &(pIhvProfile->pszParam2)
    );
    BAIL_ON_FAILURE( hr );

    hr =
    GetParamDWORD
    (
        &(pIhvProfile->dwParam1)
    );
    BAIL_ON_FAILURE( hr );

    // Transfering local cache to OUT parameter.
    (*ppvData) = pIhvProfile;
    pIhvProfile = NULL;

error:
    if ( pIhvProfile )
    {
        free( pIhvProfile->pszParam2 ); // NULL Safe.
        free( pIhvProfile );
    }
    SYS_FREE_STRING( bstrParam2 );
    return hr;
}
HRESULT
CIhvSecurityProfile::GetNativeData
(
    LPVOID* ppvData
)
{
    HRESULT                 hr          =   S_OK;
    PIHV_SECURITY_PROFILE   pIhvProfile =   NULL;
    BSTR                    bstrParam2  =   NULL;

    if ( !ppvData )
    {
        hr = E_INVALIDARG;
        BAIL_ON_FAILURE( hr );
    }

    pIhvProfile = (PIHV_SECURITY_PROFILE) malloc( sizeof( IHV_SECURITY_PROFILE ) );
    if ( !pIhvProfile )
    {
        hr = E_OUTOFMEMORY;
        BAIL_ON_FAILURE( hr );
    }
    ZeroMemory( pIhvProfile, sizeof( IHV_SECURITY_PROFILE ) );

    hr =
    GetFullSecurityFlag
    (
        &(pIhvProfile->bUseFullSecurity)
    );
    BAIL_ON_FAILURE( hr );

    hr =
    GetAuthType
    (
        &(pIhvProfile->AuthType)
    );
    BAIL_ON_FAILURE( hr );

    hr =
    GetCipherType
    (
        &(pIhvProfile->CipherType)
    );
    BAIL_ON_FAILURE( hr );

    hr =
    GetParamDWORD
    (
        &(pIhvProfile->dwParam1)
    );
    BAIL_ON_FAILURE( hr );

    hr =
    GetParamBSTR
    (
        &bstrParam2
    );
    BAIL_ON_FAILURE( hr );

    if ( NULL == bstrParam2 ) {
        hr = E_POINTER;
        BAIL_ON_FAILURE( hr );
    }

    hr =
    Wstr2Wstr
    (
        bstrParam2,
        &(pIhvProfile->pszParam2)
    );
    BAIL_ON_FAILURE( hr );

    // Transfering local cache to OUT parameter.
    (*ppvData) = pIhvProfile;
    pIhvProfile = NULL;

error:
    if ( pIhvProfile )
    {
        free( pIhvProfile->pszParam2 ); // NULL Safe.
        free( pIhvProfile );
    }
    SYS_FREE_STRING( bstrParam2 );
    return hr;

}