Home | Info | Community | Development | myReactOS | Contact Us
[virtual]
Implements IShellExtInit.
Definition at line 1293 of file openwithmenu.cpp.
{ STGMEDIUM medium; FORMATETC fmt; HRESULT hr; LPIDA pida; LPCITEMIDLIST pidlFolder2; LPCITEMIDLIST pidlChild; LPCITEMIDLIST pidl; LPCWSTR pwszExt; TRACE("This %p\n", this); if (pdtobj == NULL) return E_INVALIDARG; fmt.cfFormat = RegisterClipboardFormatW(CFSTR_SHELLIDLIST); fmt.ptd = NULL; fmt.dwAspect = DVASPECT_CONTENT; fmt.lindex = -1; fmt.tymed = TYMED_HGLOBAL; hr = pdtobj->GetData(&fmt, &medium); if (FAILED(hr)) { ERR("pdtobj->GetData failed with 0x%x\n", hr); return hr; } pida = (LPIDA)GlobalLock(medium.hGlobal); ASSERT(pida->cidl >= 1); pidlFolder2 = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[0]); pidlChild = (LPCITEMIDLIST) ((LPBYTE)pida + pida->aoffset[1]); pidl = ILCombine(pidlFolder2, pidlChild); GlobalUnlock(medium.hGlobal); GlobalFree(medium.hGlobal); if (!pidl) { ERR("no mem\n"); return E_OUTOFMEMORY; } if (!_ILIsValue(pidlChild)) { TRACE("pidl is not a file\n"); SHFree((void*)pidl); return E_FAIL; } if (!SHGetPathFromIDListW(pidl, m_wszPath)) { SHFree((void*)pidl); ERR("SHGetPathFromIDListW failed\n"); return E_FAIL; } SHFree((void*)pidl); TRACE("szPath %s\n", debugstr_w(m_wszPath)); pwszExt = PathFindExtensionW(m_wszPath); if (PathIsExeW(pwszExt) || !_wcsicmp(pwszExt, L".lnk")) { TRACE("file is a executable or shortcut\n"); return E_FAIL; } return S_OK; }