// // Calls the accessors to build native data. // 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) PrivateMemoryAlloc( sizeof( IHV_SECURITY_PROFILE ) ); if ( !pIhvProfile ) { hr = E_OUTOFMEMORY; BAIL_ON_FAILURE( hr ); } pIhvProfile->bUseIhvConnectivityOnly = ( m_pRootNode == NULL ); // Ignoring errors since structure is already // populated with defaults. hr = GetFullSecurityFlag ( &(pIhvProfile->bUseFullSecurity) ); hr = GetAuthType ( &(pIhvProfile->AuthType) ); hr = GetCipherType ( &(pIhvProfile->CipherType) ); hr = GetParam1 ( &(pIhvProfile->dwParam1) ); hr = GetParam2 ( &bstrParam2 ); BAIL_ON_FAILURE( hr ); if ( NULL == bstrParam2 ) { hr = E_POINTER; BAIL_ON_FAILURE( hr ); } hr = Wstr2Wstr ( bstrParam2, &(pIhvProfile->pszParam2) ); // Consuming earlier failures. hr = S_OK; // Transfering local cache to OUT parameter. (*ppvData) = pIhvProfile; pIhvProfile = NULL; error: if ( pIhvProfile ) { PrivateMemoryFree( pIhvProfile->pszParam2 ); // NULL Safe. PrivateMemoryFree( pIhvProfile ); } SYS_FREE_STRING( bstrParam2 ); return hr; }
// // Calls the accessors to build native data. // 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) PrivateMemoryAlloc( sizeof( IHV_CONNECTIVITY_PROFILE ) ); if ( !pIhvProfile ) { hr = E_OUTOFMEMORY; BAIL_ON_FAILURE( hr ); } // Ignoring errors since structure is already // populated with defaults. hr = GetParam2 ( &bstrParam2 ); hr = Wstr2Wstr ( bstrParam2, &(pIhvProfile->pszParam2) ); hr = GetParam1 ( &(pIhvProfile->dwParam1) ); // Consuming earlier failures. hr = S_OK; // Transfering local cache to OUT parameter. (*ppvData) = pIhvProfile; pIhvProfile = NULL; error: if ( pIhvProfile ) { PrivateMemoryFree( pIhvProfile->pszParam2 ); // NULL Safe. PrivateMemoryFree( pIhvProfile ); } SYS_FREE_STRING( bstrParam2 ); return hr; }