ReactOS  0.4.15-dev-1039-gb9754fa
CIDLDataObj Class Reference
Inheritance diagram for CIDLDataObj:
Collaboration diagram for CIDLDataObj:

Public Member Functions

 CIDLDataObj ()
 
 ~CIDLDataObj ()
 
HRESULT WINAPI Initialize (HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidlx, UINT cidlx, BOOL bAddAdditionalFormats)
 
virtual HRESULT WINAPI GetData (LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
 
virtual HRESULT WINAPI GetDataHere (LPFORMATETC pformatetc, STGMEDIUM *pmedium)
 
virtual HRESULT WINAPI QueryGetData (LPFORMATETC pformatetc)
 
virtual HRESULT WINAPI GetCanonicalFormatEtc (LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut)
 
virtual HRESULT WINAPI SetData (LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
 
virtual HRESULT WINAPI EnumFormatEtc (DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
 
virtual HRESULT WINAPI DAdvise (FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
 
virtual HRESULT WINAPI DUnadvise (DWORD dwConnection)
 
virtual HRESULT WINAPI EnumDAdvise (IEnumSTATDATA **ppenumAdvise)
 
virtual HRESULT WINAPI SetAsyncMode (BOOL fDoOpAsync)
 
virtual HRESULT WINAPI GetAsyncMode (BOOL *pfIsOpAsync)
 
virtual HRESULT WINAPI StartOperation (IBindCtx *pbcReserved)
 
virtual HRESULT WINAPI InOperation (BOOL *pfInAsyncOp)
 
virtual HRESULT WINAPI EndOperation (HRESULT hResult, IBindCtx *pbcReserved, DWORD dwEffects)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IDataObject
HRESULT GetData ([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
 
HRESULT RemoteGetData ([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pRemoteMedium)
 
HRESULT GetDataHere ([in, unique] FORMATETC *pformatetc, [in, out] STGMEDIUM *pmedium)
 
HRESULT RemoteGetDataHere ([in, unique] FORMATETC *pformatetc, [in, out] STGMEDIUM *pRemoteMedium)
 
HRESULT QueryGetData ([in, unique] FORMATETC *pformatetc)
 
HRESULT GetCanonicalFormatEtc ([in, unique] FORMATETC *pformatectIn, [out] FORMATETC *pformatetcOut)
 
HRESULT SetData ([in, unique] FORMATETC *pformatetc, [in, unique] STGMEDIUM *pmedium, [in] BOOL fRelease)
 
HRESULT RemoteSetData ([in, unique] FORMATETC *pformatetc, [in, unique] FLAG_STGMEDIUM *pmedium, [in] BOOL fRelease)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Attributes

CSimpleArray< FORMATETC > m_Formats
 
CSimpleArray< STGMEDIUM > m_Storage
 
UINT m_cfShellIDList
 
BOOL m_doasync
 

Additional Inherited Members

- Public Types inherited from IDataObject
enum  tagDATADIR { DATADIR_GET = 1, DATADIR_SET = 2 }
 
typedef IDataObjectLPDATAOBJECT
 
typedef enum IDataObject::tagDATADIR DATADIR
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IAsyncOperation
typedef IAsyncOperationLPASYNCOPERATION
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 133 of file CIDLDataObj.cpp.

Constructor & Destructor Documentation

◆ CIDLDataObj()

CIDLDataObj::CIDLDataObj ( )

Definition at line 172 of file CIDLDataObj.cpp.

173 {
174  m_cfShellIDList = 0;
175  m_doasync = FALSE;
176 }
UINT m_cfShellIDList
#define FALSE
Definition: types.h:117

◆ ~CIDLDataObj()

CIDLDataObj::~CIDLDataObj ( )

Definition at line 178 of file CIDLDataObj.cpp.

179 {
180  TRACE(" destroying IDataObject(%p)\n", this);
181 
182  for (int n = 0; n < m_Storage.GetSize(); ++n)
183  {
185  }
188 }
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
GLdouble n
Definition: glext.h:7729
CSimpleArray< FORMATETC > m_Formats
int GetSize() const
Definition: atlsimpcoll.h:104
#define TRACE(s)
Definition: solgame.cpp:4
CSimpleArray< STGMEDIUM > m_Storage

Member Function Documentation

◆ DAdvise()

HRESULT WINAPI CIDLDataObj::DAdvise ( FORMATETC *  pformatetc,
DWORD  advf,
IAdviseSink pAdvSink,
DWORD pdwConnection 
)
virtual

Implements IDataObject.

Definition at line 332 of file CIDLDataObj.cpp.

333 {
335 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ DUnadvise()

HRESULT WINAPI CIDLDataObj::DUnadvise ( DWORD  dwConnection)
virtual

Implements IDataObject.

Definition at line 337 of file CIDLDataObj.cpp.

338 {
340 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ EndOperation()

HRESULT WINAPI CIDLDataObj::EndOperation ( HRESULT  hResult,
IBindCtx pbcReserved,
DWORD  dwEffects 
)
virtual

Implements IAsyncOperation.

Definition at line 370 of file CIDLDataObj.cpp.

371 {
372  TRACE("(%p)->()\n", this);
373  return E_NOTIMPL;
374 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumDAdvise()

HRESULT WINAPI CIDLDataObj::EnumDAdvise ( IEnumSTATDATA **  ppenumAdvise)
virtual

Implements IDataObject.

Definition at line 342 of file CIDLDataObj.cpp.

343 {
345 }
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ EnumFormatEtc()

HRESULT WINAPI CIDLDataObj::EnumFormatEtc ( DWORD  dwDirection,
IEnumFORMATETC **  ppenumFormatEtc 
)
virtual

Implements IDataObject.

Definition at line 318 of file CIDLDataObj.cpp.

319 {
320  TRACE("(%p)->()\n", this);
321  *ppenumFormatEtc = NULL;
322 
323  /* only get data */
324  if (DATADIR_GET == dwDirection)
325  {
326  return IEnumFORMATETC_Constructor(m_Formats.GetSize(), m_Formats.GetData(), ppenumFormatEtc);
327  }
328 
329  return E_NOTIMPL;
330 }
CSimpleArray< FORMATETC > m_Formats
int GetSize() const
Definition: atlsimpcoll.h:104
HRESULT IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC **ppFormat)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetAsyncMode()

HRESULT WINAPI CIDLDataObj::GetAsyncMode ( BOOL pfIsOpAsync)
virtual

Implements IAsyncOperation.

Definition at line 347 of file CIDLDataObj.cpp.

348 {
349  TRACE("(%p)->()\n", this);
350  *pfIsOpAsync = m_doasync;
351  return S_OK;
352 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ GetCanonicalFormatEtc()

HRESULT WINAPI CIDLDataObj::GetCanonicalFormatEtc ( LPFORMATETC  pformatectIn,
LPFORMATETC  pformatetcOut 
)
virtual

Definition at line 288 of file CIDLDataObj.cpp.

289 {
290  //FIXME("(%p)->()\n", this);
291  return DATA_S_SAMEFORMATETC;
292 }
#define DATA_S_SAMEFORMATETC
Definition: winerror.h:2674

◆ GetData()

HRESULT WINAPI CIDLDataObj::GetData ( LPFORMATETC  pformatetcIn,
STGMEDIUM *  pmedium 
)
virtual

Definition at line 231 of file CIDLDataObj.cpp.

232 {
233  if (TRACE_ON(shell))
234  {
235  char szTemp[256] = {0};
236  GetClipboardFormatNameA (pformatetcIn->cfFormat, szTemp, 256);
237  TRACE("(%p)->(%p %p format=%s)\n", this, pformatetcIn, pmedium, szTemp);
238  }
239  pmedium->hGlobal = NULL;
240  pmedium->pUnkForRelease = NULL;
241  for (int n = 0; n < m_Formats.GetSize(); ++n)
242  {
243  const FORMATETC& fmt = m_Formats[n];
244  if (fmt.cfFormat == pformatetcIn->cfFormat &&
245  fmt.dwAspect == pformatetcIn->dwAspect &&
246  fmt.tymed == pformatetcIn->tymed)
247  {
248  if (pformatetcIn->tymed != TYMED_HGLOBAL)
249  {
251  return E_INVALIDARG;
252  }
253  else
254  {
255  *pmedium = m_Storage[n];
256  return QueryInterface(IID_PPV_ARG(IUnknown, &pmedium->pUnkForRelease));
257  }
258  }
259  }
260 
261  return E_INVALIDARG;
262 }
GLdouble n
Definition: glext.h:7729
CSimpleArray< FORMATETC > m_Formats
#define IID_PPV_ARG(Itype, ppType)
int GetSize() const
Definition: atlsimpcoll.h:104
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
CSimpleArray< STGMEDIUM > m_Storage
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define UNIMPLEMENTED
Definition: debug.h:115
#define TRACE_ON(x)
Definition: compat.h:75
Definition: dsound.c:943
int WINAPI GetClipboardFormatNameA(_In_ UINT format, _Out_writes_(cchMaxCount) LPSTR lpszFormatName, _In_ int cchMaxCount)

◆ GetDataHere()

HRESULT WINAPI CIDLDataObj::GetDataHere ( LPFORMATETC  pformatetc,
STGMEDIUM *  pmedium 
)
virtual

Definition at line 264 of file CIDLDataObj.cpp.

265 {
266  FIXME("(%p)->()\n", this);
267  return E_NOTIMPL;
268 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Initialize()

HRESULT WINAPI CIDLDataObj::Initialize ( HWND  hwndOwner,
PCIDLIST_ABSOLUTE  pMyPidl,
PCUIDLIST_RELATIVE_ARRAY  apidlx,
UINT  cidlx,
BOOL  bAddAdditionalFormats 
)

Definition at line 190 of file CIDLDataObj.cpp.

191 {
192  HGLOBAL hida = RenderSHELLIDLIST((LPITEMIDLIST)pMyPidl, (LPITEMIDLIST*)apidlx, cidlx);
193  if (!hida)
194  {
195  ERR("Failed to render " CFSTR_SHELLIDLISTA "\n");
196  return E_OUTOFMEMORY;
197  }
198 
200 
201  FORMATETC Format = { (CLIPFORMAT)m_cfShellIDList, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
202  STGMEDIUM medium = {0};
203  medium.tymed = TYMED_HGLOBAL;
204  medium.hGlobal = hida;
205  HRESULT hr = SetData(&Format, &medium, TRUE);
206  if (!FAILED_UNEXPECTEDLY(hr) && bAddAdditionalFormats)
207  {
208  Format.cfFormat = CF_HDROP;
209  medium.hGlobal = RenderHDROP((LPITEMIDLIST)pMyPidl, (LPITEMIDLIST*)apidlx, cidlx);
210  hr = SetData(&Format, &medium, TRUE);
211  if (FAILED_UNEXPECTEDLY(hr))
212  return hr;
213 
215  medium.hGlobal = RenderFILENAMEA((LPITEMIDLIST)pMyPidl, (LPITEMIDLIST*)apidlx, cidlx);
216  hr = SetData(&Format, &medium, TRUE);
217  if (FAILED_UNEXPECTEDLY(hr))
218  return hr;
219 
221  medium.hGlobal = RenderFILENAMEW((LPITEMIDLIST)pMyPidl, (LPITEMIDLIST*)apidlx, cidlx);
222  hr = SetData(&Format, &medium, TRUE);
223  if (FAILED_UNEXPECTEDLY(hr))
224  return hr;
225  }
226 
227  return hr;
228 }
virtual HRESULT WINAPI SetData(LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
Definition: clipboard.c:54
UINT m_cfShellIDList
#define CFSTR_SHELLIDLIST
Definition: shlobj.h:477
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define CF_HDROP
Definition: constants.h:410
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
HGLOBAL RenderFILENAMEW(LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
Definition: clipboard.c:220
HGLOBAL RenderFILENAMEA(LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
Definition: clipboard.c:188
UINT WINAPI RegisterClipboardFormatA(_In_ LPCSTR)
#define ERR(fmt,...)
Definition: debug.h:110
static const WCHAR CFSTR_FILENAMEW[]
Definition: shlobj.h:443
#define CFSTR_SHELLIDLISTA
Definition: shlobj.h:345
#define CFSTR_FILENAMEA
Definition: shlobj.h:352
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
HGLOBAL RenderSHELLIDLIST(LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
Definition: clipboard.c:146

◆ InOperation()

HRESULT WINAPI CIDLDataObj::InOperation ( BOOL pfInAsyncOp)
virtual

Implements IAsyncOperation.

Definition at line 353 of file CIDLDataObj.cpp.

354 {
355  FIXME("(%p)->()\n", this);
356  return E_NOTIMPL;
357 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ QueryGetData()

HRESULT WINAPI CIDLDataObj::QueryGetData ( LPFORMATETC  pformatetc)
virtual

Definition at line 270 of file CIDLDataObj.cpp.

271 {
272  TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", this, pformatetc->cfFormat, pformatetc->tymed);
273 
274  for (int n = 0; n < m_Formats.GetSize(); ++n)
275  {
276  const FORMATETC& fmt = m_Formats[n];
277  if (fmt.cfFormat == pformatetc->cfFormat &&
278  fmt.dwAspect == pformatetc->dwAspect &&
279  fmt.tymed == pformatetc->tymed)
280  {
281  return S_OK;
282  }
283  }
284 
285  return S_FALSE;
286 }
GLdouble n
Definition: glext.h:7729
CSimpleArray< FORMATETC > m_Formats
int GetSize() const
Definition: atlsimpcoll.h:104
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
Definition: dsound.c:943

◆ SetAsyncMode()

HRESULT WINAPI CIDLDataObj::SetAsyncMode ( BOOL  fDoOpAsync)
virtual

Implements IAsyncOperation.

Definition at line 358 of file CIDLDataObj.cpp.

359 {
360  TRACE("(%p)->()\n", this);
361  m_doasync = fDoOpAsync;
362  return S_OK;
363 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ SetData()

HRESULT WINAPI CIDLDataObj::SetData ( LPFORMATETC  pformatetc,
STGMEDIUM *  pmedium,
BOOL  fRelease 
)
virtual

Definition at line 294 of file CIDLDataObj.cpp.

295 {
296  if (!fRelease)
297  return E_INVALIDARG;
298 
299  for (int n = 0; n < m_Formats.GetSize(); ++n)
300  {
301  const FORMATETC& fmt = m_Formats[n];
302  if (fmt.cfFormat == pformatetc->cfFormat &&
303  fmt.dwAspect == pformatetc->dwAspect &&
304  fmt.tymed == pformatetc->tymed)
305  {
307  m_Storage[n] = *pmedium;
308  return S_OK;
309  }
310  }
311 
312  m_Formats.Add(*pformatetc);
313  m_Storage.Add(*pmedium);
314 
315  return S_OK;
316 }
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
GLdouble n
Definition: glext.h:7729
CSimpleArray< FORMATETC > m_Formats
int GetSize() const
Definition: atlsimpcoll.h:104
#define E_INVALIDARG
Definition: ddrawi.h:101
CSimpleArray< STGMEDIUM > m_Storage
#define S_OK
Definition: intsafe.h:51
Definition: dsound.c:943

Referenced by Initialize().

◆ StartOperation()

HRESULT WINAPI CIDLDataObj::StartOperation ( IBindCtx pbcReserved)
virtual

Implements IAsyncOperation.

Definition at line 365 of file CIDLDataObj.cpp.

366 {
367  TRACE("(%p)->()\n", this);
368  return E_NOTIMPL;
369 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

Member Data Documentation

◆ m_cfShellIDList

UINT CIDLDataObj::m_cfShellIDList
private

Definition at line 141 of file CIDLDataObj.cpp.

Referenced by CIDLDataObj(), and Initialize().

◆ m_doasync

BOOL CIDLDataObj::m_doasync
private

Definition at line 142 of file CIDLDataObj.cpp.

Referenced by CIDLDataObj(), GetAsyncMode(), and SetAsyncMode().

◆ m_Formats

CSimpleArray<FORMATETC> CIDLDataObj::m_Formats
private

Definition at line 139 of file CIDLDataObj.cpp.

Referenced by EnumFormatEtc(), GetData(), QueryGetData(), SetData(), and ~CIDLDataObj().

◆ m_Storage

CSimpleArray<STGMEDIUM> CIDLDataObj::m_Storage
private

Definition at line 140 of file CIDLDataObj.cpp.

Referenced by GetData(), SetData(), and ~CIDLDataObj().


The documentation for this class was generated from the following file: