From 9fecc42e255bf26264e343c751da09a0bd1c69ad Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Mon, 30 Mar 2015 12:16:29 +0000 Subject: [PATCH] [SHLWAPI] - Implement SHForwardContextMenuMsg according to http://undoc.airesoft.co.uk/shlwapi.dll/SHForwardContextMenuMsg.php CORE-9446 (Part 1/2) svn path=/trunk/; revision=66978 --- reactos/dll/win32/shlwapi/CMakeLists.txt | 1 + reactos/dll/win32/shlwapi/rosordinal.c | 39 ++++++++++++++++++++++++ reactos/dll/win32/shlwapi/shlwapi.spec | 2 +- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 reactos/dll/win32/shlwapi/rosordinal.c diff --git a/reactos/dll/win32/shlwapi/CMakeLists.txt b/reactos/dll/win32/shlwapi/CMakeLists.txt index 4e15cda34af..320e462655d 100644 --- a/reactos/dll/win32/shlwapi/CMakeLists.txt +++ b/reactos/dll/win32/shlwapi/CMakeLists.txt @@ -17,6 +17,7 @@ list(APPEND SOURCE path.c reg.c regstream.c + rosordinal.c shlwapi_main.c stopwatch.c string.c diff --git a/reactos/dll/win32/shlwapi/rosordinal.c b/reactos/dll/win32/shlwapi/rosordinal.c new file mode 100644 index 00000000000..53d2a28a43a --- /dev/null +++ b/reactos/dll/win32/shlwapi/rosordinal.c @@ -0,0 +1,39 @@ +/* + * PROJECT: ReactOS Shell + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Misc shell helper functions + * COPYRIGHT: Copyright 2015 Giannis Adamopoulos + */ + +#include "precomp.h" + +/* http://undoc.airesoft.co.uk/shlwapi.dll/SHForwardContextMenuMsg.php */ +HRESULT WINAPI SHForwardContextMenuMsg(IUnknown* pUnk, UINT uMsg, WPARAM wParam, + LPARAM lParam, LRESULT* pResult, BOOL useIContextMenu2) +{ + HRESULT hr; + IContextMenu3* pcmenu3; + IContextMenu2* pcmenu2; + + /* First try to use the IContextMenu3 interface */ + hr = IUnknown_QueryInterface(pUnk, &IID_IContextMenu3, (void**)&pcmenu3); + if (SUCCEEDED(hr)) + { + hr = IContextMenu3_HandleMenuMsg2(pcmenu3, uMsg, wParam, lParam, pResult); + IContextMenu3_Release(pcmenu3); + return hr; + } + + /* Return failure if we can't use the IContextMenu2 interface */ + if(!useIContextMenu2) + return hr; + + /* Now try to use the IContextMenu2 interface */ + hr = IUnknown_QueryInterface(pUnk, &IID_IContextMenu2, (void**)&pcmenu2); + if (FAILED(hr)) + return hr; + + hr = IContextMenu2_HandleMenuMsg(pcmenu2, uMsg, wParam, lParam); + IContextMenu2_Release(pcmenu2); + return hr; +} diff --git a/reactos/dll/win32/shlwapi/shlwapi.spec b/reactos/dll/win32/shlwapi/shlwapi.spec index 7efc30f0db5..64bf7cd1696 100644 --- a/reactos/dll/win32/shlwapi/shlwapi.spec +++ b/reactos/dll/win32/shlwapi/shlwapi.spec @@ -542,7 +542,7 @@ 542 stdcall -noname GetUIVersion() 543 stdcall -noname CreateColorSpaceWrapW(ptr) gdi32.CreateColorSpaceW 544 stub -noname QuerySourceCreateFromKey -545 stub -noname SHForwardContextMenuMsg +545 stdcall -noname SHForwardContextMenuMsg(ptr long long long ptr long) 546 stub -noname IUnknown_DoContextMenuPopup 547 stdcall DelayLoadFailureHook(str str) kernel32.DelayLoadFailureHook 548 stub -noname SHAreIconsEqual