https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e45beb55f83a5bb6ae766…
commit e45beb55f83a5bb6ae766dcda7235ce5263c32b0
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sun Oct 20 00:54:11 2019 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Oct 20 17:10:12 2019 +0200
[SHELL32] CDefaultContextMenu: Always add the wanted operation to the IDataObject
---
dll/win32/shell32/CDefaultContextMenu.cpp | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/dll/win32/shell32/CDefaultContextMenu.cpp
b/dll/win32/shell32/CDefaultContextMenu.cpp
index 55e0121a749..d64d9423ff0 100644
--- a/dll/win32/shell32/CDefaultContextMenu.cpp
+++ b/dll/win32/shell32/CDefaultContextMenu.cpp
@@ -840,18 +840,16 @@ HRESULT CDefaultContextMenu::DoCopyOrCut(LPCMINVOKECOMMANDINFO
lpcmi, BOOL bCopy
if (!m_cidl || !m_pDataObj)
return E_FAIL;
- if (!bCopy)
- {
- FORMATETC formatetc;
- STGMEDIUM medium;
- InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECT),
TYMED_HGLOBAL);
- m_pDataObj->GetData(&formatetc, &medium);
- DWORD * pdwFlag = (DWORD*)GlobalLock(medium.hGlobal);
- if (pdwFlag)
- *pdwFlag = DROPEFFECT_MOVE;
- GlobalUnlock(medium.hGlobal);
- m_pDataObj->SetData(&formatetc, &medium, TRUE);
- }
+ FORMATETC formatetc;
+ InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_PREFERREDDROPEFFECT),
TYMED_HGLOBAL);
+ STGMEDIUM medium = {0};
+ medium.tymed = TYMED_HGLOBAL;
+ medium.hGlobal = GlobalAlloc(GHND, sizeof(DWORD));
+ DWORD* pdwFlag = (DWORD*)GlobalLock(medium.hGlobal);
+ if (pdwFlag)
+ *pdwFlag = bCopy ? DROPEFFECT_COPY : DROPEFFECT_MOVE;
+ GlobalUnlock(medium.hGlobal);
+ m_pDataObj->SetData(&formatetc, &medium, TRUE);
HRESULT hr = OleSetClipboard(m_pDataObj);
if (FAILED_UNEXPECTEDLY(hr))