mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
[ImageResizer]Check for files in HDropIterator before processing (#20985)
This commit is contained in:
@@ -7,6 +7,7 @@ public:
|
||||
HDropIterator(IDataObject* pDataObject)
|
||||
{
|
||||
_current = 0;
|
||||
_listCount = 0;
|
||||
|
||||
FORMATETC formatetc = {
|
||||
CF_HDROP,
|
||||
@@ -16,14 +17,22 @@ public:
|
||||
TYMED_HGLOBAL
|
||||
};
|
||||
|
||||
pDataObject->GetData(&formatetc, &m_medium);
|
||||
|
||||
_listCount = DragQueryFile((HDROP)m_medium.hGlobal, 0xFFFFFFFF, NULL, 0);
|
||||
if (SUCCEEDED(pDataObject->GetData(&formatetc, &m_medium)))
|
||||
{
|
||||
_listCount = DragQueryFile((HDROP)m_medium.hGlobal, 0xFFFFFFFF, NULL, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_medium = {};
|
||||
}
|
||||
}
|
||||
|
||||
~HDropIterator()
|
||||
{
|
||||
ReleaseStgMedium(&m_medium);
|
||||
if (m_medium.tymed)
|
||||
{
|
||||
ReleaseStgMedium(&m_medium);
|
||||
}
|
||||
}
|
||||
|
||||
void First()
|
||||
|
||||
@@ -72,6 +72,11 @@ HRESULT CContextMenuHandler::QueryContextMenu(_In_ HMENU hmenu, UINT indexMenu,
|
||||
// NB: We just check the first item. We could iterate through more if the first one doesn't meet the criteria
|
||||
HDropIterator i(m_pdtobj);
|
||||
i.First();
|
||||
if (i.IsDone())
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Suppressing C26812 warning as the issue is in the shtypes.h library
|
||||
#pragma warning(suppress : 26812)
|
||||
PERCEIVED type;
|
||||
|
||||
Reference in New Issue
Block a user