Exemplo n.º 1
0
void PropertyAdmin::initialize()
{
    if (m_bInitialized)
        return;
    m_bInitialized = true;
    try 
    {
        CComPtr<IPropertyManager> pPropMan;
        if ((pPropMan.p = GET_OPMPROPERTY_MANAGER(m_pClass))==NULL)
            _com_issue_error(E_FAIL);
        _com_util::CheckError(CComObject<CSimpleProperty>::CreateInstance(&m_pSimple));
        m_pSimple->AddRef();
        _com_util::CheckError(CComObject<CCategorizedProperty>::CreateInstance(&m_pCategorized));
        m_pCategorized->AddRef();
        _com_util::CheckError(CComObject<CEnumProperty>::CreateInstance(&m_pEnum));
        m_pEnum->AddRef();
        _com_util::CheckError(pPropMan->AddProperty(m_pSimple));
        _com_util::CheckError(pPropMan->AddProperty(m_pCategorized));
        _com_util::CheckError(pPropMan->AddProperty(m_pEnum));
    }
    catch(const _com_error& )
    {
        uninitialize();                
        acutPrintf("\nSimpleDynProps: initialize failed!!!\n");
        return;
    }
}
HRESULT CTedTestSink::InitVideoStream()
{
    HRESULT hr = S_OK;

    InternalAddRef();
    /*IMFMediaSink* pMediaSink;
    InternalQueryInterface(this, CTedTestSink::_GetEntries(), IID_IMFMediaSink, (void**) &pMediaSink);*/
    
    CComPtr<IMFMediaType> spVideoType;
    IFC( MFCreateMediaType(&spVideoType) );
    IFC( spVideoType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video) );
    IFC( spVideoType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB24) );

    CComObject<CTedTestMediaTypeHandler>* pVideoTypeHandler = NULL;
    IFC( CComObject<CTedTestMediaTypeHandler>::CreateInstance(&pVideoTypeHandler) );
    pVideoTypeHandler->AddRef();
    pVideoTypeHandler->SetMajorType(MFMediaType_Video);
    pVideoTypeHandler->AddAvailableType(spVideoType);

    CComObject<CTedTestStreamSink>* pVideoStreamSink = NULL;
    IFC( CComObject<CTedTestStreamSink>::CreateInstance(&pVideoStreamSink) );
    pVideoStreamSink->AddRef();
    m_spVideoStreamSink = pVideoStreamSink;
    //IFC( pVideoStreamSink->Init(pMediaSink, pVideoTypeHandler, 1) );
    IFC( pVideoStreamSink->Init(this, pVideoTypeHandler, 1) );
    pVideoTypeHandler->Release();
    pVideoStreamSink->Release();

    //pMediaSink->Release();
Cleanup:
    return hr;
}
Exemplo n.º 3
0
LRESULT CMediaClipView::OnEditFrame(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
{
#if 0
	CComObject<CImageDocument>* pImageDocument;
	CComObject<CImageDocument>::CreateInstance(&pImageDocument);
	pImageDocument->AddRef();

	{
		CComObject<CImageLayerBitmap>* pLayer;
		CComObject<CImageLayerBitmap>::CreateInstance(&pLayer);
		pLayer->AddRef();

		pLayer->m_pBitmap = m_pDocument->m_pSample->m_pBitmap;

		pLayer->m_pInitialBitmap = pLayer->m_pBitmap->Clone(Gdiplus::Rect(0, 0, pLayer->m_pBitmap->GetWidth(), pLayer->m_pBitmap->GetHeight()), PixelFormat32bppARGB);
		{
			Gdiplus::BitmapData bitmapData;
			pLayer->m_pBitmap->LockBits(
				&Gdiplus::Rect(0, 0, pLayer->m_pBitmap->GetWidth(), pLayer->m_pBitmap->GetHeight()),
				Gdiplus::ImageLockModeRead,
				PixelFormat32bppARGB, &bitmapData);

			GetAlphaBounds(&bitmapData, &pLayer->m_alphaBounds);

			pLayer->m_pBitmap->UnlockBits(&bitmapData);
		}

		pLayer->m_name = L"Layer 0";

		pLayer->m_width = pLayer->m_pBitmap->GetWidth();
		pLayer->m_height = pLayer->m_pBitmap->GetHeight();

		pImageDocument->m_width = pLayer->m_pBitmap->GetWidth();
		pImageDocument->m_height = pLayer->m_pBitmap->GetHeight();

		/*
		Gdiplus::BitmapData data;
		if (pBitmap->LockBits(
			&Gdiplus::Rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()),
			Gdiplus::ImageLockModeRead,
			PixelFormat32bppPARGB, &data) != 0)
		{
			ATLASSERT(0);
			return -1;
		}

		pBitmap->UnlockBits(&data);
		*/

		pLayer->m_parentGroup = pImageDocument->m_imageLayerGroup;
		pImageDocument->m_imageLayerGroup->m_subLayers.Add(pLayer);
	}

	pImageDocument->ShowViews(NULL);
#endif

	return 0;
}
Exemplo n.º 4
0
IASDeclaration* CASXMLSchemaModel::CreateGlobalDefinition(ILDOMElement* element)
{
	IASDeclaration* pDef = NULL;

	BSTR btagName;
	element->get_tagName(&btagName);
	_bstr_t tagName = _bstr_t(btagName, false);

	if (!wcscmp(tagName, L"element"))
	{
		CComObject<CGlobalElementDefinition>* p;
		CComObject<CGlobalElementDefinition>::CreateInstance(&p);
		p->AddRef();
		p->m_element = element;
		p->m_pSchema = this;

		pDef = p;
	}
	else if (!wcscmp(tagName, L"attribute"))
	{
		pDef = NULL;//new CElementDefinition;
	}
	else if (!wcscmp(tagName, L"simpleType"))
	{
		CComObject<CSimpleTypeDefinition>* p;
		CComObject<CSimpleTypeDefinition>::CreateInstance(&p);
		p->AddRef();
		p->m_element = element;
		p->m_pSchema = this;

		pDef = p;
	}
	else if (!wcscmp(tagName, L"complexType"))
	{
		CComObject<CComplexTypeDefinition>* p;
		CComObject<CComplexTypeDefinition>::CreateInstance(&p);
		p->AddRef();
		p->m_element = element;
		p->m_pSchema = this;

		pDef = p;
	}

	if (pDef)
	{
	}

	return pDef;
}
Exemplo n.º 5
0
STDMETHODIMP InterfaceAliases::get_Item(long Index, IInterfaceAlias **pVal)
{
   try
   {
      if (!m_pAliases)
         return GetAccessDenied();

      CComObject<InterfaceAlias>* pAlias = new CComObject<InterfaceAlias>();
      pAlias->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Alias> pPersAlias = m_pAliases->GetItem(Index);
   
      if (!pPersAlias)
         return DISP_E_BADINDEX;  
   
      pAlias->AttachItem(pPersAlias);
      pAlias->AddRef();
      *pVal = pAlias;
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceBlockedAttachments::Add(IInterfaceBlockedAttachment **pVal)
{
   try
   {
      if (!m_pBlockedAttachments)
         return GetAccessDenied();

      if (!m_pBlockedAttachments)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceBlockedAttachment>* pInterfaceBlockedAttachment = new CComObject<InterfaceBlockedAttachment>();
      pInterfaceBlockedAttachment->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::BlockedAttachment> pBA = shared_ptr<HM::BlockedAttachment>(new HM::BlockedAttachment);
   
      pInterfaceBlockedAttachment->AttachItem(pBA);
      pInterfaceBlockedAttachment->AttachParent(m_pBlockedAttachments, false);
   
      pInterfaceBlockedAttachment->AddRef();
   
      *pVal = pInterfaceBlockedAttachment;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceBackupManager::LoadBackup(BSTR sXMLFile, IInterfaceBackup **pVal)
{
   try
   {
      if (!m_pBackupManager)
         return GetAccessDenied();

      CComObject<InterfaceBackup>* pBackupInt = new CComObject<InterfaceBackup>();
      pBackupInt->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Backup> pBackup = m_pBackupManager->LoadBackup(sXMLFile);
   
      if (!pBackup)
         return DISP_E_BADINDEX;
   
      pBackupInt->Attach(pBackup);
      pBackupInt->AddRef();
      *pVal = pBackupInt;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceIMAPFolderPermission::get_Account(IInterfaceAccount **pVal)
{
   try
   {
      if (!object_)
         return GetAccessDenied();

      CComObject<InterfaceAccount>* pInterfaceAccount = new CComObject<InterfaceAccount>();
      pInterfaceAccount->SetAuthentication(authentication_);
   
      std::shared_ptr<HM::Account> pAccount = std::shared_ptr<HM::Account>(new HM::Account);
   
      if (!HM::PersistentAccount::ReadObject(pAccount, (__int64) object_->GetPermissionAccountID()))
         return DISP_E_BADINDEX;
   
      pInterfaceAccount->AttachItem(pAccount);
      pInterfaceAccount->AddRef();
      *pVal = pInterfaceAccount;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Exemplo n.º 9
0
STDMETHODIMP CCOMClauseVariant::get_Group(long lGroupNum, IGroup **pVal)
{	
	try
	{
		if(     (lGroupNum < 0) 
			|| (lGroupNum >= m_pSynVariant->m_vectorGroups.GetGroups().size()) 
		  )
			return E_FAIL;

		const CGroup& group =  m_pSynVariant->m_vectorGroups.GetGroups()[lGroupNum];

		CComObject<CCOMGroup>* pGroup = NULL;
		pGroup = new CComObject<CCOMGroup>;
		
		BOOL bRes = pGroup->Init(&group, GetOptions());
		if( !bRes )
			return FALSE;
		*pVal = pGroup;
		pGroup->AddRef();
	}
	catch(...)
	{
		return E_FAIL;
	}

	return S_OK;
}
STDMETHODIMP 
InterfaceSSLCertificates::get_Item(long Index, IInterfaceSSLCertificate **pVal)
{
   try
   {
      if (!m_pSSLCertificates)
         return GetAccessDenied();

      CComObject<InterfaceSSLCertificate>* pInterfaceSSLCertificate = new CComObject<InterfaceSSLCertificate>();
      pInterfaceSSLCertificate->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::SSLCertificate> pBA = m_pSSLCertificates->GetItem(Index);
   
      if (!pBA)
         return DISP_E_BADINDEX;
   
      pInterfaceSSLCertificate->AttachItem(pBA);
      pInterfaceSSLCertificate->AttachParent(m_pSSLCertificates, true);
      pInterfaceSSLCertificate->AddRef();
      *pVal = pInterfaceSSLCertificate;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceDistributionLists::get_ItemByAddress(BSTR sAddress, IInterfaceDistributionList **pVal)
{
   try
   {
      if (!m_pDistributionLists)
         return GetAccessDenied();

      CComObject<InterfaceDistributionList>* pList = new CComObject<InterfaceDistributionList>();
      pList->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::DistributionList> pPersList = m_pDistributionLists->GetItemByAddress(sAddress);
   
      if (!pPersList)
         return DISP_E_BADINDEX;  
   
      pList->AttachItem(pPersList);
      pList->AttachParent(m_pDistributionLists, true);
      pList->AddRef();
      *pVal = pList;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Exemplo n.º 12
0
STDMETHODIMP
InterfaceSURBLServers::get_Item(long Index, IInterfaceSURBLServer **pVal)
{
    try
    {
        if (!m_pSURBLServers)
            return GetAccessDenied();

        CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
        pInterfaceSURBLServer->SetAuthentication(m_pAuthentication);

        shared_ptr<HM::SURBLServer> pDNSBlackList = m_pSURBLServers->GetItem(Index);

        if (!pDNSBlackList)
            return DISP_E_BADINDEX;

        pInterfaceSURBLServer->AttachItem(pDNSBlackList);
        pInterfaceSURBLServer->AttachParent(m_pSURBLServers, true);
        pInterfaceSURBLServer->AddRef();
        *pVal = pInterfaceSURBLServer;

        return S_OK;
    }
    catch (...)
    {
        return COMError::GenerateGenericMessage();
    }
}
Exemplo n.º 13
0
STDMETHODIMP
InterfaceSURBLServers::get_ItemByDNSHost(BSTR ItemName, IInterfaceSURBLServer **pVal)
{
    try
    {
        if (!m_pSURBLServers)
            return GetAccessDenied();

        CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
        pInterfaceSURBLServer->SetAuthentication(m_pAuthentication);

        shared_ptr<HM::SURBLServer> pDNSBL = m_pSURBLServers->GetItemByName(ItemName);
        if (!pDNSBL)
            return S_FALSE;

        pInterfaceSURBLServer->AttachItem(pDNSBL);
        pInterfaceSURBLServer->AttachParent(m_pSURBLServers, true);
        pInterfaceSURBLServer->AddRef();

        *pVal = pInterfaceSURBLServer;

        return S_OK;
    }
    catch (...)
    {
        return COMError::GenerateGenericMessage();
    }
}
Exemplo n.º 14
0
STDMETHODIMP
InterfaceSURBLServers::Add(IInterfaceSURBLServer **pVal)
{
    try
    {
        if (!m_pSURBLServers)
            return GetAccessDenied();

        if (!m_pSURBLServers)
            return m_pAuthentication->GetAccessDenied();

        CComObject<InterfaceSURBLServer>* pInterfaceSURBLServer = new CComObject<InterfaceSURBLServer>();
        pInterfaceSURBLServer->SetAuthentication(m_pAuthentication);

        shared_ptr<HM::SURBLServer> pDNSBL = shared_ptr<HM::SURBLServer>(new HM::SURBLServer);

        pInterfaceSURBLServer->AttachItem(pDNSBL);
        pInterfaceSURBLServer->AttachParent(m_pSURBLServers, false);

        pInterfaceSURBLServer->AddRef();

        *pVal = pInterfaceSURBLServer;

        return S_OK;
    }
    catch (...)
    {
        return COMError::GenerateGenericMessage();
    }
}
Exemplo n.º 15
0
STDMETHODIMP CMmRvFutColl::Add(LONG Key, BSTR SortKey, IMmRvFutAtom* Value, IMmRvFutAtom** pRetVal)
{
	try
	{
		if(m_collRef.find(Key) != m_collRef.end())
			EgLib::CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Futures with the same key is already exists."));

		if(!Value)
		{
			CComObject<CMmRvFutAtom>* pNewVal;

			_CHK(CComObject<CMmRvFutAtom>::CreateInstance(&pNewVal), _T("Fail to add futures."));
			pNewVal->AddRef();
			if(FAILED(IMmRvFutCollImpl::Add(Key, CComBSTR(SortKey), pNewVal)))
			{
				pNewVal->Release();
				EgLib::CComErrorWrapper::ThrowError(E_INVALIDARG, _T("Fail to add futures."));
			}
			*pRetVal = pNewVal;
		}
		else
		{
			_CHK(IMmRvFutCollImpl::Add(Key, CComBSTR(SortKey), Value), _T("Fail to add futures."));
			Value->AddRef();
			*pRetVal = Value;
		}
	}
	catch(const _com_error& e)
	{
		return Error((PTCHAR)EgLib::CComErrorWrapper::ErrorDescription(e), IID_IMmRvFutColl, e.Error());
	}

	return S_OK;
}
STDMETHODIMP 
InterfaceGreyListingWhiteAddresses::get_Item(long Index, IInterfaceGreyListingWhiteAddress **pVal)
{
   try
   {
      if (!gl_white_addresses_)
         return GetAccessDenied();

      CComObject<InterfaceGreyListingWhiteAddress>* pInterfaceGreyListingWhiteAddress = new CComObject<InterfaceGreyListingWhiteAddress>();
      pInterfaceGreyListingWhiteAddress->SetAuthentication(authentication_);
   
      shared_ptr<HM::GreyListingWhiteAddress> pBA = gl_white_addresses_->GetItem(Index);
   
      if (!pBA)
         return DISP_E_BADINDEX;
   
      pInterfaceGreyListingWhiteAddress->AttachItem(pBA);
      pInterfaceGreyListingWhiteAddress->AttachParent(gl_white_addresses_, true);
      pInterfaceGreyListingWhiteAddress->AddRef();
      *pVal = pInterfaceGreyListingWhiteAddress;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceSSLCertificates::Add(IInterfaceSSLCertificate **pVal)
{
   try
   {
      if (!m_pSSLCertificates)
         return GetAccessDenied();

      if (!m_pSSLCertificates)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceSSLCertificate>* pInterfaceSSLCertificate = new CComObject<InterfaceSSLCertificate>();
      pInterfaceSSLCertificate->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::SSLCertificate> pBA = shared_ptr<HM::SSLCertificate>(new HM::SSLCertificate);
   
      pInterfaceSSLCertificate->AttachItem(pBA);
      pInterfaceSSLCertificate->AttachParent(m_pSSLCertificates, false);
      pInterfaceSSLCertificate->AddRef();
   
      *pVal = pInterfaceSSLCertificate;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceDistributionLists::Add(IInterfaceDistributionList **pVal)
{
   try
   {
      if (!m_pDistributionLists)
         return GetAccessDenied();

      if (!m_pDistributionLists)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceDistributionList>* pList = new CComObject<InterfaceDistributionList>();
      pList->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::DistributionList> pPersList = shared_ptr<HM::DistributionList>(new HM::DistributionList);
      pPersList->SetDomainID(m_iDomainID);
   
      pList->AttachItem(pPersList);
      pList->AttachParent(m_pDistributionLists, false);
      pList->AddRef();
   
      *pVal = pList;
   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Exemplo n.º 19
0
STDMETHODIMP CCOMClauseVariant::get_Unit(long lUnitNum, ISyntaxUnit **pVal)
{
	try
	{
		CComObject<CCOMUnit>* pUnit;
		pUnit = new CComObject<CCOMUnit>;
		int iClauseNum = -1;

		if( m_pSynVariant->m_SynUnits[lUnitNum].m_Type == EClause )
		{
			iClauseNum = m_pClause->m_pSent->FindClauseIndexByPeriod(m_pSynVariant->m_SynUnits[lUnitNum].m_SentPeriod);
			if( iClauseNum == -1 )
			{
				delete pUnit;
				return E_FAIL;
			}
		}

		if( !pUnit->InitUnit(m_pClause, *(m_pSynVariant), lUnitNum, iClauseNum) )
			return E_FAIL;

		*pVal = pUnit;
		pUnit->AddRef();		
		
	}
	catch(...)
	{
		return E_FAIL;
	}

	return S_OK;
}
Exemplo n.º 20
0
HRESULT CNktHookInfoImpl::InternalCreate(__in DV_AGENTCOM_HOOKINFO_CREATE_DATA *lpData,
        __deref_out IDispatch **lplpDisp)
{
    CComObject<CNktHookInfoImpl> *lpPtr = NULL;
    HRESULT hRes;

    if (lplpDisp != NULL)
        *lplpDisp = NULL;
    if (lpData == NULL || lplpDisp == NULL)
        return E_POINTER;
    //if we have no "OuterInterface" stored, create a new one
    hRes = CComObject<CNktHookInfoImpl>::CreateInstance(&lpPtr);
    //initialize object
    if (SUCCEEDED(hRes))
    {
        lpPtr->AddRef(); //CComObject::CreateInstance returns with zero refcount
        lpPtr->dwId = lpData->dwId;
        lpPtr->nAddress = lpData->nAddress;
        lpPtr->lpDbFunc = lpData->lpDbFunc;
        lpPtr->szFunctionNameW = lpData->szFunctionNameW;
        lpPtr->sCallTrampoline = lpData->sCallTrampoline;
        lpPtr->cProc = lpData->lpProc;
        lpPtr->InterfaceItemSetCookies(lpData->dwCookie);
    }
    //final initialization
    if (SUCCEEDED(hRes))
        hRes = lpPtr->QueryInterface<IDispatch>(lplpDisp);
    //decrement extra ref
    if (lpPtr != NULL)
        lpPtr->Release();
    //done
    if (FAILED(hRes))
        *lplpDisp = NULL;
    return hRes;
}
Exemplo n.º 21
0
STDMETHODIMP InterfaceLinks::get_Alias(long DBID, IInterfaceAlias **pVal)
{
   try
   {
      if (!authentication_->GetIsAuthenticated())
         return authentication_->GetAccessDenied();
   
      shared_ptr<HM::Alias> pAlias = shared_ptr<HM::Alias>(new HM::Alias);
      if (!HM::PersistentAlias::ReadObject(pAlias, DBID))
         return DISP_E_BADINDEX;
   
      bool domainAdminOK = authentication_->GetIsDomainAdmin() && authentication_->GetDomainID() == pAlias->GetDomainID();
   
      if (!authentication_->GetIsServerAdmin() && !domainAdminOK)
         return authentication_->GetAccessDenied();
   
      CComObject<InterfaceAlias>* pInterface = new CComObject<InterfaceAlias>();
      pInterface->SetAuthentication(authentication_);
      pInterface->AttachItem(pAlias);
      pInterface->AddRef();
      *pVal = pInterface;
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceFetchAccounts::Add(IInterfaceFetchAccount **pVal)
{
   try
   {
      if (!m_pFetchAccounts)
         return GetAccessDenied();

      if (!m_pFetchAccounts)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceFetchAccount>* pIntFA = new CComObject<InterfaceFetchAccount>();
      pIntFA->SetAuthentication(m_pAuthentication);
   
      boost::shared_ptr<HM::FetchAccount> pFA = boost::shared_ptr<HM::FetchAccount>(new HM::FetchAccount);
   
      pFA->SetAccountID(m_pFetchAccounts->GetAccountID());
   
      pIntFA->AttachItem(pFA);
      pIntFA->AttachParent(m_pFetchAccounts, false);
   
      pIntFA->AddRef();
      *pVal = pIntFA;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceIMAPFolderPermission::get_Group(IInterfaceGroup **pVal)
{
   try
   {
      if (!object_)
         return GetAccessDenied();

      CComObject<InterfaceGroup>* pInterfaceGroup = new CComObject<InterfaceGroup>();
      pInterfaceGroup->SetAuthentication(authentication_);
   
      std::shared_ptr<HM::Group> pGroup = HM::Configuration::Instance()->GetIMAPConfiguration()->GetGroups()->GetItemByDBID(object_->GetPermissionGroupID());
   
      if (!pGroup)
         return DISP_E_BADINDEX;
   
      pInterfaceGroup->AttachItem(pGroup);
      pInterfaceGroup->AddRef();
      *pVal = pInterfaceGroup;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP InterfaceFetchAccounts::get_Item(long lIndex, IInterfaceFetchAccount** pVal)
{
   try
   {
      if (!m_pFetchAccounts)
         return GetAccessDenied();

      CComObject<InterfaceFetchAccount>* pInterfaceAccount = new CComObject<InterfaceFetchAccount>();
      pInterfaceAccount->SetAuthentication(m_pAuthentication);
   
      boost::shared_ptr<HM::FetchAccount> pFetchAccount = m_pFetchAccounts->GetItem(lIndex);
      if (!pFetchAccount)
         return DISP_E_BADINDEX;
   
      pInterfaceAccount->AttachItem(pFetchAccount);
      pInterfaceAccount->AttachParent(m_pFetchAccounts, true);
      pInterfaceAccount->AddRef();
      *pVal = pInterfaceAccount;   
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Exemplo n.º 25
0
STDMETHODIMP 
InterfaceRecipients::get_Item(long Index, IInterfaceRecipient **pVal)
{
   try
   {
      if (!m_pMessage)
         return GetAccessDenied();

      CComObject<InterfaceRecipient>* pInterfaceRecipient = new CComObject<InterfaceRecipient>();
      pInterfaceRecipient->SetAuthentication(m_pAuthentication);
   
      std::vector<shared_ptr<HM::MessageRecipient> > vecRecipients = m_pMessage->GetRecipients()->GetVector();
   
      if (Index >= (long) vecRecipients.size())
         return DISP_E_BADINDEX;
   
      shared_ptr<HM::MessageRecipient> pRecipient = vecRecipients[Index];
   
      pInterfaceRecipient->AttachItem(pRecipient);
      pInterfaceRecipient->AddRef();
      *pVal = pInterfaceRecipient;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Exemplo n.º 26
0
STDMETHODIMP 
InterfaceIMAPFolders::get_ItemByName(BSTR sName, IInterfaceIMAPFolder **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceIMAPFolder>* pIMAPFolderInt = new CComObject<InterfaceIMAPFolder>();
      pIMAPFolderInt->SetAuthentication(m_pAuthentication);
   
      HM::String sUnicode (sName);
      HM::AnsiString sFolderName = HM::ModifiedUTF7::Encode(sUnicode);
   
      shared_ptr<HM::IMAPFolder> pIMAPFolder = m_pObject->GetFolderByName(sFolderName);
   
      if (!pIMAPFolder)
         return DISP_E_BADINDEX;
   
      pIMAPFolderInt->Attach(pIMAPFolder);
      pIMAPFolderInt->AttachParent(m_pObject, true);
      pIMAPFolderInt->AddRef();
      *pVal = pIMAPFolderInt;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceBlockedAttachments::get_ItemByDBID(long lDBID, IInterfaceBlockedAttachment **pVal)
{
   try
   {
      if (!m_pBlockedAttachments)
         return GetAccessDenied();

      CComObject<InterfaceBlockedAttachment>* pInterfaceBlockedAttachment = new CComObject<InterfaceBlockedAttachment>();
      pInterfaceBlockedAttachment->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::BlockedAttachment> pBA = m_pBlockedAttachments->GetItemByDBID(lDBID);
   
      if (!pBA)
         return DISP_E_BADINDEX;
   
      pInterfaceBlockedAttachment->AttachItem(pBA);
      pInterfaceBlockedAttachment->AttachParent(m_pBlockedAttachments, true);
      pInterfaceBlockedAttachment->AddRef();
   
      *pVal = pInterfaceBlockedAttachment;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Exemplo n.º 28
0
STDMETHODIMP 
InterfaceIMAPFolders::get_ItemByDBID(long DBID, IInterfaceIMAPFolder **pVal)
{
   try
   {
      if (!m_pObject)
         return GetAccessDenied();

      CComObject<InterfaceIMAPFolder>* pIMAPFolderInt = new CComObject<InterfaceIMAPFolder>();
      pIMAPFolderInt->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::IMAPFolder> pIMAPFolder = m_pObject->GetItemByDBID(DBID);
   
      if (!pIMAPFolder)
         return DISP_E_BADINDEX;  
   
      pIMAPFolderInt->Attach(pIMAPFolder);
      pIMAPFolderInt->AttachParent(m_pObject, true);
      pIMAPFolderInt->AddRef();
      *pVal = pIMAPFolderInt;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
Exemplo n.º 29
0
STDMETHODIMP InterfaceAliases::Add(IInterfaceAlias **pVal)
{
   try
   {
      if (!m_pAliases)
         return GetAccessDenied();

      if (!m_pAuthentication->GetIsDomainAdmin())
         return m_pAuthentication->GetAccessDenied();
   
      if (!m_pAliases)
         return m_pAuthentication->GetAccessDenied();
   
      CComObject<InterfaceAlias>* pIntAlias = new CComObject<InterfaceAlias>();
      pIntAlias->SetAuthentication(m_pAuthentication);
   
      shared_ptr<HM::Alias> pAliasADO = shared_ptr<HM::Alias>(new HM::Alias);
      
      pIntAlias->AttachItem(pAliasADO);
      pIntAlias->AttachParent(m_pAliases, false);
   
      pAliasADO->SetDomainID(m_iDomainID);
   
      pIntAlias->AddRef();
      *pVal = pIntAlias;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}
STDMETHODIMP 
InterfaceGreyListingWhiteAddresses::Add(IInterfaceGreyListingWhiteAddress **pVal)
{
   try
   {
      if (!gl_white_addresses_)
         return GetAccessDenied();

      if (!gl_white_addresses_)
         return authentication_->GetAccessDenied();
   
      CComObject<InterfaceGreyListingWhiteAddress>* pInterfaceGreyListingWhiteAddress = new CComObject<InterfaceGreyListingWhiteAddress>();
      pInterfaceGreyListingWhiteAddress->SetAuthentication(authentication_);
   
      shared_ptr<HM::GreyListingWhiteAddress> pBA = shared_ptr<HM::GreyListingWhiteAddress>(new HM::GreyListingWhiteAddress);
   
      pInterfaceGreyListingWhiteAddress->AttachItem(pBA);
      pInterfaceGreyListingWhiteAddress->AttachParent(gl_white_addresses_, false);
      pInterfaceGreyListingWhiteAddress->AddRef();
   
      *pVal = pInterfaceGreyListingWhiteAddress;
   
      return S_OK;
   }
   catch (...)
   {
      return COMError::GenerateGenericMessage();
   }
}