[MYDOCS] Simplify HIDA usage

This commit is contained in:
Mark Jansen 2021-07-25 01:08:35 +02:00
parent e5ea6041c9
commit eba16dc9e9
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B

View file

@ -9,8 +9,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mydocs);
static CLIPFORMAT g_cfHIDA = 0;
CMyDocsDropHandler::CMyDocsDropHandler()
{
InterlockedIncrement(&g_ModuleRefCnt);
@ -68,23 +66,15 @@ CMyDocsDropHandler::Drop(IDataObject *pDataObject, DWORD dwKeyState,
if (FAILED_UNEXPECTEDLY(hr))
return hr;
// get the clipboard format
if (g_cfHIDA == 0)
g_cfHIDA = ::RegisterClipboardFormatW(CFSTR_SHELLIDLIST);
// Retrieve an HIDA (handle of IDA)
STGMEDIUM medium;
FORMATETC fmt = { g_cfHIDA, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
hr = pDataObject->GetData(&fmt, &medium);
if (FAILED_UNEXPECTEDLY(hr))
CDataObjectHIDA pida(pDataObject);
if (FAILED_UNEXPECTEDLY(pida.hr()))
{
*pdwEffect = 0;
DragLeave();
return E_FAIL;
return pida.hr();
}
// lock HIDA
LPIDA pida = reinterpret_cast<LPIDA>(GlobalLock(medium.hGlobal));
UINT iItem, cItems = pida->cidl;
// get the path of "My Documents"
@ -123,9 +113,6 @@ CMyDocsDropHandler::Drop(IDataObject *pDataObject, DWORD dwKeyState,
strSrcList += szSrc;
}
// unlock HIDA
GlobalUnlock(medium.hGlobal);
if (iItem != cItems)
{
// source not found