VBoxDnDEnumFormat.cpp revision a29027bb2378172c7c88610ad5311548b66f96f6
/* $Id$ */
/** @file
* VBoxDnDEnumFormat.cpp - IEnumFORMATETC ("Format et cetera") implementation.
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <windows.h>
#include <new> /* For bad_alloc. */
#include "VBoxTray.h"
#include "VBoxHelpers.h"
#include "VBoxDnD.h"
#ifdef DEBUG
# define LOG_ENABLED
# define LOG_GROUP LOG_GROUP_DEFAULT
#endif
: m_lRefCount(1),
m_nIndex(0)
{
try
{
{
LogFlowFunc(("Format %RU32: cfFormat=%RI16, sFormat=%s, tyMed=%RU32, dwAspect=%RU32\n",
}
}
{
hr = E_OUTOFMEMORY;
}
}
{
if (m_pFormatEtc)
{
for (ULONG i = 0; i < m_nNumFormats; i++)
{
if(m_pFormatEtc[i].ptd)
}
delete[] m_pFormatEtc;
m_pFormatEtc = NULL;
}
}
/*
* IUnknown methods.
*/
{
return InterlockedIncrement(&m_lRefCount);
}
{
if (lCount == 0)
{
delete this;
return 0;
}
return lCount;
}
{
if ( iid == IID_IEnumFORMATETC
|| iid == IID_IUnknown)
{
AddRef();
*ppvObject = this;
return S_OK;
}
*ppvObject = 0;
return E_NOINTERFACE;
}
{
if(cFormats == 0 || pFormatEtc == 0)
return E_INVALIDARG;
while ( m_nIndex < m_nNumFormats
{
&m_pFormatEtc[m_nIndex]);
ulCopied++;
m_nIndex++;
}
if (pcFetched)
}
{
}
{
m_nIndex = 0;
return S_OK;
}
{
return hResult;
}
/* static */
{
{
}
}
/* static */
HRESULT VBoxDnDEnumFormatEtc::CreateEnumFormatEtc(UINT nNumFormats, FORMATETC *pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc)
{
try
{
}
{
hr = E_OUTOFMEMORY;
}
return hr;
}