/************************************************************************** * IDataObject_Constructor */ LPDATAOBJECT IDataObject_Constructor(HWND hwndOwner, LPITEMIDLIST pMyPidl, LPITEMIDLIST * apidl, UINT cidl) { IDataObjectImpl* dto; dto = (IDataObjectImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDataObjectImpl)); if (dto) { dto->ref = 1; ICOM_VTBL(dto) = &dtovt; dto->pidl = ILClone(pMyPidl); dto->apidl = _ILCopyaPidl(apidl, cidl); dto->cidl = cidl; dto->cfShellIDList = RegisterClipboardFormatA(CFSTR_SHELLIDLIST); dto->cfFileName = RegisterClipboardFormatA(CFSTR_FILENAMEA); InitFormatEtc(dto->pFormatEtc[0], dto->cfShellIDList, TYMED_HGLOBAL); InitFormatEtc(dto->pFormatEtc[1], CF_HDROP, TYMED_HGLOBAL); InitFormatEtc(dto->pFormatEtc[2], dto->cfFileName, TYMED_HGLOBAL); shell32_ObjCount++; } TRACE("(%p)->(apidl=%p cidl=%u)\n",dto, apidl, cidl); return (LPDATAOBJECT)dto; }
/************************************************************************** * ISvItemCm_Constructor() */ IContextMenu2 *ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *apidl, UINT cidl) { ItemCmImpl* cm; UINT u; cm = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ItemCmImpl)); cm->IContextMenu2_iface.lpVtbl = &cmvt; cm->ref = 1; cm->pidl = ILClone(pidl); cm->pSFParent = pSFParent; if(pSFParent) IShellFolder_AddRef(pSFParent); cm->apidl = _ILCopyaPidl(apidl, cidl); cm->cidl = cidl; cm->bAllValues = 1; for(u = 0; u < cidl; u++) { cm->bAllValues &= (_ILIsValue(apidl[u]) ? 1 : 0); } TRACE("(%p)->()\n",cm); return &cm->IContextMenu2_iface; }
HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *apidl, UINT cidl, REFIID riid, void **pObj) { ContextMenu* This; HRESULT hr; UINT i; This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); if (!This) return E_OUTOFMEMORY; This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl; This->ref = 1; This->parent = parent; if (parent) IShellFolder_AddRef(parent); This->pidl = ILClone(pidl); This->apidl = _ILCopyaPidl(apidl, cidl); This->cidl = cidl; This->allvalues = TRUE; This->desktop = FALSE; for (i = 0; i < cidl; i++) This->allvalues &= (_ILIsValue(apidl[i]) ? 1 : 0); hr = IContextMenu3_QueryInterface(&This->IContextMenu3_iface, riid, pObj); IContextMenu3_Release(&This->IContextMenu3_iface); return hr; }
static IContextMenu2* RecycleBinMenu_Constructor(UINT cidl, LPCITEMIDLIST *apidl, IShellFolder2 *folder) { RecycleBinMenu *This = SHAlloc(sizeof(RecycleBinMenu)); TRACE("(%u,%p)\n",cidl,apidl); This->IContextMenu2_iface.lpVtbl = &recycleBinMenuVtbl; This->cidl = cidl; This->apidl = _ILCopyaPidl(apidl,cidl); IShellFolder2_AddRef(folder); This->folder = folder; This->refCount = 1; return &This->IContextMenu2_iface; }
HRESULT WINAPI IDataObjectImpl::Initialize(HWND hwndOwner, LPCITEMIDLIST pMyPidl, LPCITEMIDLIST * apidlx, UINT cidlx) { pidl = ILClone(pMyPidl); apidl = _ILCopyaPidl(apidlx, cidlx); if (pidl == NULL || apidl == NULL) return E_OUTOFMEMORY; cidl = cidlx; cfShellIDList = RegisterClipboardFormatW(CFSTR_SHELLIDLIST); cfFileNameA = RegisterClipboardFormatA(CFSTR_FILENAMEA); cfFileNameW = RegisterClipboardFormatW(CFSTR_FILENAMEW); InitFormatEtc(pFormatEtc[0], cfShellIDList, TYMED_HGLOBAL); InitFormatEtc(pFormatEtc[1], CF_HDROP, TYMED_HGLOBAL); InitFormatEtc(pFormatEtc[2], cfFileNameA, TYMED_HGLOBAL); InitFormatEtc(pFormatEtc[3], cfFileNameW, TYMED_HGLOBAL); return S_OK; }
HRESULT WINAPI CIDLDataObj::Initialize(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidlx, UINT cidlx) { pidl = ILClone(pMyPidl); apidl = _ILCopyaPidl(apidlx, cidlx); if (pidl == NULL || apidl == NULL) return E_OUTOFMEMORY; cidl = cidlx; dropeffect = DROPEFFECT_COPY; cfShellIDList = RegisterClipboardFormatW(CFSTR_SHELLIDLIST); cfFileNameA = RegisterClipboardFormatA(CFSTR_FILENAMEA); cfFileNameW = RegisterClipboardFormatW(CFSTR_FILENAMEW); cfPreferredDropEffect = RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECTW); InitFormatEtc(pFormatEtc[0], cfShellIDList, TYMED_HGLOBAL); InitFormatEtc(pFormatEtc[1], CF_HDROP, TYMED_HGLOBAL); InitFormatEtc(pFormatEtc[2], cfFileNameA, TYMED_HGLOBAL); InitFormatEtc(pFormatEtc[3], cfFileNameW, TYMED_HGLOBAL); InitFormatEtc(pFormatEtc[4], cfPreferredDropEffect, TYMED_HGLOBAL); return S_OK; }