/////////////////////////////////////////////////////////////////
// HRESULT CBase::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CBase::AutoRelease()
{
	//Common OLE DB Interface
	RELEASE_INTERFACE(ISupportErrorInfo);
	RELEASE_INTERFACE(IAggregate);
	RELEASE_INTERFACE(IService);
	return S_OK;
}
/////////////////////////////////////////////////////////////////
// HRESULT CError::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CError::AutoRelease()
{
	//Error
	RELEASE_INTERFACE(IErrorInfo);
	RELEASE_INTERFACE(IErrorRecords);

	//Delegate
	return CBase::AutoRelease();
}
/////////////////////////////////////////////////////////////////
// HRESULT CBinder::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CBinder::AutoRelease()
{
	RELEASE_INTERFACE(IBindResource);
	RELEASE_INTERFACE(ICreateRow);
	RELEASE_INTERFACE(IDBProperties);
	RELEASE_INTERFACE(IDBBinderProperties);
	RELEASE_INTERFACE(IRegisterProvider);

	//Delegate
	return CBase::AutoRelease();
}
/////////////////////////////////////////////////////////////////
// CStream::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CStream::AutoRelease()
{
	//Stream
	RELEASE_INTERFACE(ISequentialStream);
	RELEASE_INTERFACE(IStream);
	RELEASE_INTERFACE(IStorage);
	RELEASE_INTERFACE(ILockBytes);

	//Delegate
	return CAsynchBase::AutoRelease();
}
/////////////////////////////////////////////////////////////////
// CDataset::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CDataset::AutoRelease()
{
	HRESULT hr = S_OK;

	//Free the AxisInfo
	FreeAxisInfo(&m_cAxis, &m_rgAxisInfo);

	//Interface
	RELEASE_INTERFACE(IMDDataset);
	RELEASE_INTERFACE(IMDFind);
	RELEASE_INTERFACE(IMDRangeRowset);

	//Delegate
	return CDataAccess::AutoRelease();
}
////////////////////////////////////////////////////////////////
// CAsynchBase::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CAsynchBase::AutoRelease()
{
	//UnadviseListeners
	UnadviseListener(IID_IDBAsynchNotify, &m_dwCookieAsynchNotify);

	//OLE DB interfaces
	RELEASE_INTERFACE(IDBInitialize);
	RELEASE_INTERFACE(IDBAsynchStatus);

	//Extra interfaces

	//Data
	m_fInitialized = FALSE;

	//Delegate
	return CContainerBase::AutoRelease();
}
/////////////////////////////////////////////////////////////////
// HRESULT CCustomError::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CCustomError::AutoRelease()
{
	//Error
	RELEASE_INTERFACE(ISQLErrorInfo);

	//Delegate
	return CBase::AutoRelease();
}
/////////////////////////////////////////////////////////////////
// CMultipleResults::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CMultipleResults::AutoRelease()
{
	//MultipleResults
	RELEASE_INTERFACE(IMultipleResults);

	//Delegate
	return CBase::AutoRelease();
}
/////////////////////////////////////////////////////////////////
// HRESULT CConnectionPoint::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CConnectionPoint::AutoRelease()
{
	//Common OLE DB Interface
	RELEASE_INTERFACE(IConnectionPoint);

	//Delegate
	return CBase::AutoRelease();
}
Example #10
0
////////////////////////////////////////////////////////////////
// CPropertiesBase::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CPropertiesBase::AutoRelease()
{
	//OLE DB interfaces
	RELEASE_INTERFACE(IDBProperties);

	//Delegate
	return CAsynchBase::AutoRelease();
}
Example #11
0
// base function to obtain text from
// node described by XPATH.
HRESULT
CIhvProfileBase::GetTextFromNode
(
    IN  LPCWSTR         pszQuery,
    OUT BSTR*           pbstrText
)
{
    HRESULT         hr          =   S_OK;
    BSTR            bstrQuery   =   NULL;
    IXMLDOMNode*    pQueryNode  =   NULL;

    ASSERT( pszQuery );
    ASSERT( pbstrText );

    // if node is NULL, return empty string.
    if ( !m_pRootNode )
    {
        hr =
        Wstr2Bstr
        (
            L"",
            pbstrText
        );
        BAIL( );
    }

    hr =
    Wstr2Bstr
    (
        pszQuery,
        &bstrQuery
    );
    BAIL_ON_FAILURE( hr );

    hr = m_pRootNode->selectSingleNode( bstrQuery, &pQueryNode );
    BAIL_ON_FAILURE( hr );

    if (!pQueryNode)
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    hr = pQueryNode->get_text( pbstrText );
    BAIL_ON_FAILURE( hr );

    if ( !(*pbstrText) )
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

error:
    RELEASE_INTERFACE( pQueryNode );
    SYS_FREE_STRING( bstrQuery );
    return hr;
}
////////////////////////////////////////////////////////////////
// CDataSource::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CDataSource::AutoRelease()
{
	//DataSource interfaces
	RELEASE_INTERFACE(IDBCreateSession);
	RELEASE_INTERFACE(IPersist);

	RELEASE_INTERFACE(IDBDataSourceAdmin);
	RELEASE_INTERFACE(IDBInfo);
	RELEASE_INTERFACE(IPersistFile);

	//Services
	RELEASE_INTERFACE(IServiceProvider);


	//Extra interfaces

	//Properties
	m_cstrDataSource.Empty();
	m_cstrDBMS.Empty();
	m_cstrDBMSVer.Empty();
	m_cstrProviderName.Empty();
	m_cstrProviderDesc.Empty();

	//Delegate
	return CPropertiesBase::AutoRelease();
}
Example #13
0
/////////////////////////////////////////////////////////////////
// CRow::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CRow::AutoRelease()
{
	m_cColAccess = 0;
	SAFE_FREE(m_rgColAccess);

	//Rowset
	RELEASE_INTERFACE(IRow);
	RELEASE_INTERFACE(IGetSession);

	RELEASE_INTERFACE(IColumnsInfo2);
	RELEASE_INTERFACE(ICreateRow);
	RELEASE_INTERFACE(IDBCreateCommand);
	RELEASE_INTERFACE(IRowChange);
	RELEASE_INTERFACE(IRowSchemaChange);
	RELEASE_INTERFACE(IBindResource);
	RELEASE_INTERFACE(IScopedOperations);

	//Delegate
	return CDataAccess::AutoRelease();
}
Example #14
0
HRESULT UTILS_OutputString(
	_In_	IDebugClient *	piClient,
	_In_	ULONG			nMask,
	_In_	PCSTR			pszFormat,
	...
	)
{
	HRESULT			hrResult			= E_FAIL;
	IDebugControl *	piDebugControl		= NULL;
	va_list			vaArguments			= NULL;
	BOOL			bArgsInitialized	= FALSE;

	hrResult = piClient->lpVtbl->QueryInterface(piClient,
												&IID_IDebugControl,
												&piDebugControl);
	if (FAILED(hrResult))
	{
		goto lblCleanup;
	}

	va_start(vaArguments, pszFormat);
	bArgsInitialized = TRUE;

	hrResult = piDebugControl->lpVtbl->OutputVaList(piDebugControl,
													nMask,
													pszFormat,
													vaArguments);
	if (FAILED(hrResult))
	{
		goto lblCleanup;
	}

	hrResult = S_OK;

lblCleanup:
	if (bArgsInitialized)
	{
		va_end(vaArguments);
		bArgsInitialized = FALSE;
	}
	RELEASE_INTERFACE(piDebugControl);

	return hrResult;
}
HRESULT
CIhvProfileBase::PutTextInNode
(
    IN  LPCWSTR         pszQuery,
    IN  BSTR            bstrText
)
{
    HRESULT         hr          =   S_OK;
    BSTR            bstrQuery   =   NULL;
    BSTR            bstrOrig    =   NULL;
    BOOL            bPut        =   TRUE;
    IXMLDOMNode*    pQueryNode  =   NULL;

    if ( !m_pRootNode )
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    if ( (!pszQuery) || (!bstrText) )
    {
        hr = E_INVALIDARG;
        BAIL_ON_FAILURE( hr );
    }

    hr =
    Wstr2Bstr
    (
        pszQuery,
        &bstrQuery
    );
    BAIL_ON_FAILURE( hr );

    hr = m_pRootNode->selectSingleNode( bstrQuery, &pQueryNode );
    BAIL_ON_FAILURE( hr );

    if (!pQueryNode)
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    hr = pQueryNode->get_text( &bstrOrig );
    BAIL_ON_FAILURE( hr );

    if ( bstrOrig && ( 0 == wcscmp( bstrOrig, bstrText ) ) )
    {
        bPut = FALSE;
    }

    if ( bPut )
    {
        hr = pQueryNode->put_text( bstrText );
        BAIL_ON_FAILURE( hr );

        SetModified( );
    }

error:
    RELEASE_INTERFACE( pQueryNode );
    SYS_FREE_STRING( bstrQuery );
    SYS_FREE_STRING( bstrOrig  );
    return hr;
}
HRESULT
CIhvProfileBase::LoadXml
(
    IN  BSTR    bstrProfileData
)
{
    HRESULT             hr              =   S_OK;
    IXMLDOMDocument*    pDOMDoc         =   NULL;
    IXMLDOMElement*     pDocElem        =   NULL;
    BSTR                bstrIhvProfile  =   NULL;
    VARIANT_BOOL        vfSuccess;

    if ( !bstrProfileData )
    {
        hr = GetDefaultXml( &bstrIhvProfile );
        BAIL_ON_FAILURE( hr );
    }
    else
    {
		bstrIhvProfile = bstrProfileData;
    }

    if ( m_pRootNode )
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    hr =
    CoCreateInstance
    (
        CLSID_DOMDocument,
        NULL,
        CLSCTX_ALL,
        IID_IXMLDOMDocument,
        (LPVOID *) &pDOMDoc
    );
    BAIL_ON_FAILURE( hr );

    hr =
    pDOMDoc->loadXML
    (
        bstrIhvProfile,
        &vfSuccess
    );
    BAIL_ON_FAILURE( hr );

    if ( VARIANT_TRUE != vfSuccess )
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    hr =
    pDOMDoc->get_documentElement
    (
        &pDocElem
    );
    BAIL_ON_FAILURE( hr );

    // Caching the pointer to the document element
    // in a member variable.
    m_pRootNode =   pDocElem;
    pDocElem    =   NULL;


error:
    if ( !bstrProfileData )
    {
	    SYS_FREE_STRING( bstrIhvProfile );
    }
    RELEASE_INTERFACE( pDOMDoc  );
    RELEASE_INTERFACE( pDocElem );
    return hr;
}
/////////////////////////////////////////////////////////////////
// HRESULT CSession::AutoRelease
//
/////////////////////////////////////////////////////////////////
HRESULT CSession::AutoRelease()
{
	//Session
	RELEASE_INTERFACE(IGetDataSource);
	RELEASE_INTERFACE(IOpenRowset);
	RELEASE_INTERFACE(ISessionProperties);
	RELEASE_INTERFACE(IDBCreateCommand);
	RELEASE_INTERFACE(IDBSchemaRowset);
	RELEASE_INTERFACE(IIndexDefinition);
	RELEASE_INTERFACE(IAlterIndex);
	RELEASE_INTERFACE(IAlterTable);
	RELEASE_INTERFACE(ITableDefinition);
	RELEASE_INTERFACE(ITableDefinitionWithConstraints);
	RELEASE_INTERFACE(ITransaction);
	RELEASE_INTERFACE(ITransactionLocal);
	RELEASE_INTERFACE(ITransactionObject);
	RELEASE_INTERFACE(ITransactionJoin);

	RELEASE_INTERFACE(IBindResource);
	RELEASE_INTERFACE(ICreateRow);

	//Delegate
	return CAsynchBase::AutoRelease();
}
Example #18
0
 // Destructor
 ~CIhvProfileBase( )
 {
     RELEASE_INTERFACE( m_pRootNode );
 }