mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[ImageResizer]Check for files in HDropIterator before processing (#20985)
This commit is contained in:
@@ -7,6 +7,7 @@ public:
|
|||||||
HDropIterator(IDataObject* pDataObject)
|
HDropIterator(IDataObject* pDataObject)
|
||||||
{
|
{
|
||||||
_current = 0;
|
_current = 0;
|
||||||
|
_listCount = 0;
|
||||||
|
|
||||||
FORMATETC formatetc = {
|
FORMATETC formatetc = {
|
||||||
CF_HDROP,
|
CF_HDROP,
|
||||||
@@ -16,14 +17,22 @@ public:
|
|||||||
TYMED_HGLOBAL
|
TYMED_HGLOBAL
|
||||||
};
|
};
|
||||||
|
|
||||||
pDataObject->GetData(&formatetc, &m_medium);
|
if (SUCCEEDED(pDataObject->GetData(&formatetc, &m_medium)))
|
||||||
|
{
|
||||||
_listCount = DragQueryFile((HDROP)m_medium.hGlobal, 0xFFFFFFFF, NULL, 0);
|
_listCount = DragQueryFile((HDROP)m_medium.hGlobal, 0xFFFFFFFF, NULL, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_medium = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~HDropIterator()
|
~HDropIterator()
|
||||||
{
|
{
|
||||||
ReleaseStgMedium(&m_medium);
|
if (m_medium.tymed)
|
||||||
|
{
|
||||||
|
ReleaseStgMedium(&m_medium);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void First()
|
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
|
// 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);
|
HDropIterator i(m_pdtobj);
|
||||||
i.First();
|
i.First();
|
||||||
|
if (i.IsDone())
|
||||||
|
{
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Suppressing C26812 warning as the issue is in the shtypes.h library
|
// Suppressing C26812 warning as the issue is in the shtypes.h library
|
||||||
#pragma warning(suppress : 26812)
|
#pragma warning(suppress : 26812)
|
||||||
PERCEIVED type;
|
PERCEIVED type;
|
||||||
|
|||||||
Reference in New Issue
Block a user