mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Rebase against 1d3b312f225f79bec74d3d265128ead455467e2a.
This commit is contained in:
parent
34eb04e7cc
commit
e768e46a86
@ -1,4 +1,4 @@
|
||||
From a9c768a74e8ecbe857dfb851e35c62d5447f8d10 Mon Sep 17 00:00:00 2001
|
||||
From 7b40ae4316f61b52e0ad740bb1ba0a32e6545a40 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Tue, 24 Nov 2015 17:22:02 +0800
|
||||
Subject: [PATCH] oleaut32: Implement a better stub for IPicture::SaveAsFile.
|
||||
@ -12,10 +12,10 @@ For bug 8532.
|
||||
2 files changed, 79 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
|
||||
index bbc5e2aa9c8..0410d2b3cad 100644
|
||||
index 6e0db65a101..48d7ae13846 100644
|
||||
--- a/dlls/oleaut32/olepicture.c
|
||||
+++ b/dlls/oleaut32/olepicture.c
|
||||
@@ -832,19 +832,6 @@ static HRESULT WINAPI OLEPictureImpl_PictureChanged(IPicture *iface)
|
||||
@@ -819,19 +819,6 @@ static HRESULT WINAPI OLEPictureImpl_PictureChanged(IPicture *iface)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@ index bbc5e2aa9c8..0410d2b3cad 100644
|
||||
/************************************************************************
|
||||
* OLEPictureImpl_get_Attributes
|
||||
*/
|
||||
@@ -1887,6 +1874,85 @@ static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
|
||||
return E_NOTIMPL;
|
||||
@@ -1891,6 +1878,85 @@ static HRESULT WINAPI OLEPictureImpl_GetSizeMax(IPersistStream *iface, ULARGE_IN
|
||||
return hr;
|
||||
}
|
||||
|
||||
+/************************************************************************
|
||||
@ -122,10 +122,10 @@ index bbc5e2aa9c8..0410d2b3cad 100644
|
||||
/************************************************************************
|
||||
* IDispatch
|
||||
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
|
||||
index beafb98b28f..e0fb3bb3cd8 100644
|
||||
index a269491fd3f..97c80027b99 100644
|
||||
--- a/dlls/oleaut32/tests/olepicture.c
|
||||
+++ b/dlls/oleaut32/tests/olepicture.c
|
||||
@@ -1178,18 +1178,14 @@ static void test_load_save_bmp(void)
|
||||
@@ -1231,18 +1231,14 @@ static void test_load_save_bmp(void)
|
||||
size = -1;
|
||||
hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
|
||||
ok(hr == S_OK, "IPicture_SaveasFile error %#lx\n", hr);
|
||||
@ -144,7 +144,7 @@ index beafb98b28f..e0fb3bb3cd8 100644
|
||||
ok(size == -1, "expected -1, got %ld\n", size);
|
||||
|
||||
offset.QuadPart = 0;
|
||||
@@ -1256,15 +1252,12 @@ static void test_load_save_icon(void)
|
||||
@@ -1317,15 +1313,12 @@ static void test_load_save_icon(void)
|
||||
todo_wine
|
||||
ok(size == 766, "expected 766, got %ld\n", size);
|
||||
mem = GlobalLock(hmem);
|
||||
@ -160,7 +160,7 @@ index beafb98b28f..e0fb3bb3cd8 100644
|
||||
ok(size == -1, "expected -1, got %ld\n", size);
|
||||
|
||||
offset.QuadPart = 0;
|
||||
@@ -1330,13 +1323,11 @@ static void test_load_save_empty_picture(void)
|
||||
@@ -1399,13 +1392,11 @@ static void test_load_save_empty_picture(void)
|
||||
size = -1;
|
||||
hr = IPicture_SaveAsFile(pic, dst_stream, TRUE, &size);
|
||||
ok(hr == S_OK, "IPicture_SaveasFile error %#lx\n", hr);
|
||||
@ -175,5 +175,5 @@ index beafb98b28f..e0fb3bb3cd8 100644
|
||||
|
||||
hr = IPicture_QueryInterface(pic, &IID_IPersistStream, (void **)&src_stream);
|
||||
--
|
||||
2.35.1
|
||||
2.43.0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From e6f8042ee351aa6821639a1d99e003e8425c36e9 Mon Sep 17 00:00:00 2001
|
||||
From 908557cc6bdd74e9e91cd984b82688e004dcda54 Mon Sep 17 00:00:00 2001
|
||||
From: Damjan Jovanovic <damjan.jov@gmail.com>
|
||||
Date: Sat, 29 Feb 2020 09:21:55 +0200
|
||||
Subject: [PATCH] oleaut32: preferentially load icons having the desired size
|
||||
@ -16,14 +16,14 @@ Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
|
||||
|
||||
Updated to default 32 when x/y are LP_DEFAULT.
|
||||
---
|
||||
dlls/oleaut32/olepicture.c | 22 ++++++++++++++++++----
|
||||
1 file changed, 18 insertions(+), 4 deletions(-)
|
||||
dlls/oleaut32/olepicture.c | 23 +++++++++++++++++++----
|
||||
1 file changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
|
||||
index 535a16146aa..05ad1137296 100644
|
||||
index 6e0db65a101..32645f5d2d5 100644
|
||||
--- a/dlls/oleaut32/olepicture.c
|
||||
+++ b/dlls/oleaut32/olepicture.c
|
||||
@@ -151,6 +151,8 @@ typedef struct OLEPictureImpl {
|
||||
@@ -149,6 +149,8 @@ typedef struct OLEPictureImpl {
|
||||
BOOL bIsDirty; /* Set to TRUE if picture has changed */
|
||||
unsigned int loadtime_magic; /* If a length header was found, saves value */
|
||||
unsigned int loadtime_format; /* for PICTYPE_BITMAP only, keeps track of image format (GIF/BMP/JPEG) */
|
||||
@ -32,7 +32,7 @@ index 535a16146aa..05ad1137296 100644
|
||||
} OLEPictureImpl;
|
||||
|
||||
static inline OLEPictureImpl *impl_from_IPicture(IPicture *iface)
|
||||
@@ -1190,14 +1192,20 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x
|
||||
@@ -1222,14 +1224,20 @@ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG x
|
||||
return E_FAIL;
|
||||
}
|
||||
i=0;
|
||||
@ -57,7 +57,7 @@ index 535a16146aa..05ad1137296 100644
|
||||
if (i==cifd->idCount) i=0;
|
||||
}
|
||||
if (xread < cifd->idEntries[i].dwDIBOffset + cifd->idEntries[i].dwDIBSize)
|
||||
@@ -2356,6 +2364,7 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
||||
@@ -2313,14 +2321,21 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
||||
{
|
||||
LPPERSISTSTREAM ps;
|
||||
IPicture *newpic;
|
||||
@ -65,7 +65,9 @@ index 535a16146aa..05ad1137296 100644
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("%p, %ld, %d, %s, %lu, %lu, %#lx, %p, partially implemented.\n",
|
||||
@@ -2364,6 +2373,11 @@ HRESULT WINAPI OleLoadPictureEx( LPSTREAM lpstream, LONG lSize, BOOL fRunmode,
|
||||
lpstream, lSize, fRunmode, debugstr_guid(riid), xsiz, ysiz, flags, ppvObj);
|
||||
+ /* hack to prevent this patch from applying in the wrong place */
|
||||
|
||||
hr = OleCreatePictureIndirect(NULL,riid,!fRunmode,(LPVOID*)&newpic);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
@ -78,5 +80,5 @@ index 535a16146aa..05ad1137296 100644
|
||||
if (hr != S_OK) {
|
||||
ERR("Could not get IPersistStream iface from Ole Picture?\n");
|
||||
--
|
||||
2.40.1
|
||||
2.43.0
|
||||
|
||||
|
@ -1,607 +0,0 @@
|
||||
From d061f8ebe8c9858a249e0129350d8b7c59ceaee6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 16 Aug 2015 17:34:22 +0200
|
||||
Subject: [PATCH] shell32: Implement NewMenu with new folder item.
|
||||
|
||||
v2:
|
||||
Added and Correct tests
|
||||
Use IContextMenu3 for all IContextMenu* interfaces.
|
||||
Use heap_alloc/free functions
|
||||
|
||||
v3:
|
||||
Correct header issue when compiling i386 (var_arg)
|
||||
---
|
||||
dlls/shell32/Makefile.in | 1 +
|
||||
dlls/shell32/shell32_classes.idl | 5 +
|
||||
dlls/shell32/shell32_main.h | 1 +
|
||||
dlls/shell32/shellnew.c | 497 +++++++++++++++++++++++++++++++
|
||||
dlls/shell32/shellole.c | 1 +
|
||||
dlls/shell32/tests/shlview.c | 9 +-
|
||||
6 files changed, 513 insertions(+), 1 deletion(-)
|
||||
create mode 100644 dlls/shell32/shellnew.c
|
||||
|
||||
diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in
|
||||
index 8efcbfb4dbf..7f5586ad6a5 100644
|
||||
--- a/dlls/shell32/Makefile.in
|
||||
+++ b/dlls/shell32/Makefile.in
|
||||
@@ -29,6 +29,7 @@ C_SRCS = \
|
||||
shelldispatch.c \
|
||||
shellitem.c \
|
||||
shelllink.c \
|
||||
+ shellnew.c \
|
||||
shellole.c \
|
||||
shellord.c \
|
||||
shellpath.c \
|
||||
diff --git a/dlls/shell32/shell32_classes.idl b/dlls/shell32/shell32_classes.idl
|
||||
index dc65ed3728d..c5f4215196f 100644
|
||||
--- a/dlls/shell32/shell32_classes.idl
|
||||
+++ b/dlls/shell32/shell32_classes.idl
|
||||
@@ -86,6 +86,11 @@ coclass KnownFolderManager { interface IKnownFolderManager; }
|
||||
uuid(4657278a-411b-11d2-839a-00c04fd918d0)
|
||||
] coclass DragDropHelper { interface IDropTargetHelper; }
|
||||
|
||||
+[
|
||||
+ threading(apartment),
|
||||
+ uuid(d969a300-e7ff-11d0-a93b-00a0c90f2719)
|
||||
+] coclass NewMenu { interface IShellExtInit; }
|
||||
+
|
||||
[
|
||||
threading(apartment),
|
||||
uuid(00bb2763-6a77-11d0-a535-00c04fd7d062)
|
||||
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
|
||||
index de6e8dfa9e6..12d2d84224a 100644
|
||||
--- a/dlls/shell32/shell32_main.h
|
||||
+++ b/dlls/shell32/shell32_main.h
|
||||
@@ -101,6 +101,7 @@ HRESULT WINAPI RecycleBin_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID
|
||||
HRESULT WINAPI QueryAssociations_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppOutput);
|
||||
HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv);
|
||||
HRESULT WINAPI KnownFolderManager_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv);
|
||||
+HRESULT WINAPI NewMenu_Constructor(IUnknown *outer, REFIID riid, LPVOID *ppv);
|
||||
HRESULT WINAPI IFileOperation_Constructor(IUnknown *outer, REFIID riid, void **out);
|
||||
HRESULT WINAPI ActiveDesktop_Constructor(IUnknown *outer, REFIID riid, void **out);
|
||||
|
||||
diff --git a/dlls/shell32/shellnew.c b/dlls/shell32/shellnew.c
|
||||
new file mode 100644
|
||||
index 00000000000..ba31b3787f8
|
||||
--- /dev/null
|
||||
+++ b/dlls/shell32/shellnew.c
|
||||
@@ -0,0 +1,497 @@
|
||||
+/*
|
||||
+ * Copyright 2015 Michael Müller
|
||||
+ *
|
||||
+ * This library is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
+ */
|
||||
+
|
||||
+#define COBJMACROS
|
||||
+#define NONAMELESSUNION
|
||||
+
|
||||
+#include <stdarg.h>
|
||||
+
|
||||
+#include "winerror.h"
|
||||
+#include "windef.h"
|
||||
+#include "winbase.h"
|
||||
+#include "winnls.h"
|
||||
+#include "winreg.h"
|
||||
+
|
||||
+#include "winuser.h"
|
||||
+#include "wingdi.h"
|
||||
+#include "shlobj.h"
|
||||
+
|
||||
+
|
||||
+#include "pidl.h"
|
||||
+#include "shell32_main.h"
|
||||
+#include "shlguid.h"
|
||||
+#include "shlwapi.h"
|
||||
+#include "shresdef.h"
|
||||
+#include "shellfolder.h"
|
||||
+
|
||||
+#include "wine/heap.h"
|
||||
+#include "wine/debug.h"
|
||||
+
|
||||
+WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||
+
|
||||
+typedef struct
|
||||
+{
|
||||
+ IShellExtInit IShellExtInit_iface;
|
||||
+ IContextMenu3 IContextMenu3_iface;
|
||||
+ IObjectWithSite IObjectWithSite_iface;
|
||||
+
|
||||
+ LONG ref;
|
||||
+ IUnknown *site;
|
||||
+ LPITEMIDLIST pidl;
|
||||
+ HICON icon_folder;
|
||||
+
|
||||
+ UINT folder_cmd;
|
||||
+} NewMenuImpl;
|
||||
+
|
||||
+static inline NewMenuImpl *impl_from_IShellExtInit(IShellExtInit *iface)
|
||||
+{
|
||||
+ return CONTAINING_RECORD(iface, NewMenuImpl, IShellExtInit_iface);
|
||||
+}
|
||||
+
|
||||
+static inline NewMenuImpl *impl_from_IContextMenu3(IContextMenu3 *iface)
|
||||
+{
|
||||
+ return CONTAINING_RECORD(iface, NewMenuImpl, IContextMenu3_iface);
|
||||
+}
|
||||
+
|
||||
+static inline NewMenuImpl *impl_from_IObjectWithSite(IObjectWithSite *iface)
|
||||
+{
|
||||
+ return CONTAINING_RECORD(iface, NewMenuImpl, IObjectWithSite_iface);
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ExtInit_QueryInterface(IShellExtInit *iface, REFIID riid, void **ppv)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IShellExtInit(iface);
|
||||
+ TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));
|
||||
+
|
||||
+ *ppv = NULL;
|
||||
+
|
||||
+ if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||
+ IsEqualIID(riid, &IID_IShellExtInit))
|
||||
+ {
|
||||
+ *ppv = &This->IShellExtInit_iface;
|
||||
+ }
|
||||
+ else if (IsEqualIID(riid, &IID_IObjectWithSite))
|
||||
+ {
|
||||
+ *ppv = &This->IObjectWithSite_iface;
|
||||
+ }
|
||||
+ else if (IsEqualIID(riid, &IID_IContextMenu) ||
|
||||
+ IsEqualIID(riid, &IID_IContextMenu2) ||
|
||||
+ IsEqualIID(riid, &IID_IContextMenu3))
|
||||
+ {
|
||||
+ *ppv = &This->IContextMenu3_iface;
|
||||
+ }
|
||||
+
|
||||
+ if (*ppv)
|
||||
+ {
|
||||
+ IUnknown_AddRef((IUnknown *)*ppv);
|
||||
+ TRACE("-- Interface: (%p)->(%p)\n", ppv, *ppv);
|
||||
+ return S_OK;
|
||||
+ }
|
||||
+
|
||||
+ ERR("-- Interface: E_NOINTERFACE for %s\n", debugstr_guid(riid));
|
||||
+ return E_NOINTERFACE;
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI
|
||||
+NewMenu_ExtInit_AddRef(IShellExtInit *iface)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IShellExtInit(iface);
|
||||
+ ULONG ref = InterlockedIncrement(&This->ref);
|
||||
+
|
||||
+ TRACE("(%p), refcount=%lu\n", iface, ref);
|
||||
+
|
||||
+ return ref;
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI
|
||||
+NewMenu_ExtInit_Release(IShellExtInit *iface)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IShellExtInit(iface);
|
||||
+ ULONG ref = InterlockedDecrement(&This->ref);
|
||||
+
|
||||
+ TRACE("(%p), refcount=%lu\n", iface, ref);
|
||||
+
|
||||
+ if (!ref)
|
||||
+ {
|
||||
+ if (This->site) IUnknown_Release(This->site);
|
||||
+ if (This->pidl) ILFree(This->pidl);
|
||||
+ heap_free(This);
|
||||
+ }
|
||||
+
|
||||
+ return ref;
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ExtInit_Initialize(IShellExtInit *iface, LPCITEMIDLIST pidl, IDataObject *obj, HKEY key)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IShellExtInit(iface);
|
||||
+
|
||||
+ TRACE("(%p)->(%p, %p, %p)\n", This, pidl, obj, key );
|
||||
+
|
||||
+ if (!pidl)
|
||||
+ return E_FAIL;
|
||||
+
|
||||
+ if (This->pidl) ILFree(This->pidl);
|
||||
+ This->pidl = ILClone(pidl);
|
||||
+ This->icon_folder = LoadImageW(shell32_hInstance, (LPCWSTR)MAKEINTRESOURCE(IDI_SHELL_FOLDER), IMAGE_ICON,
|
||||
+ GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
|
||||
+
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
+static const IShellExtInitVtbl eivt =
|
||||
+{
|
||||
+ NewMenu_ExtInit_QueryInterface,
|
||||
+ NewMenu_ExtInit_AddRef,
|
||||
+ NewMenu_ExtInit_Release,
|
||||
+ NewMenu_ExtInit_Initialize
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IObjectWithSite(iface);
|
||||
+ return NewMenu_ExtInit_QueryInterface(&This->IShellExtInit_iface, riid, ppv);
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI
|
||||
+NewMenu_ObjectWithSite_AddRef(IObjectWithSite *iface)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IObjectWithSite(iface);
|
||||
+ return NewMenu_ExtInit_AddRef(&This->IShellExtInit_iface);
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI
|
||||
+NewMenu_ObjectWithSite_Release(IObjectWithSite *iface)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IObjectWithSite(iface);
|
||||
+ return NewMenu_ExtInit_Release(&This->IShellExtInit_iface);
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID iid, void **ppv)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IObjectWithSite(iface);
|
||||
+
|
||||
+ TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(iid), ppv);
|
||||
+
|
||||
+ if (!This->site)
|
||||
+ return E_FAIL;
|
||||
+
|
||||
+ return IUnknown_QueryInterface(This->site, iid, ppv);
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *punk)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IObjectWithSite(iface);
|
||||
+
|
||||
+ TRACE("(%p)->(%p)\n", This, punk);
|
||||
+
|
||||
+ if (punk)
|
||||
+ IUnknown_AddRef(punk);
|
||||
+
|
||||
+ if (This->site)
|
||||
+ IUnknown_Release(This->site);
|
||||
+
|
||||
+ This->site = punk;
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
+static const IObjectWithSiteVtbl owsvt =
|
||||
+{
|
||||
+ NewMenu_ObjectWithSite_QueryInterface,
|
||||
+ NewMenu_ObjectWithSite_AddRef,
|
||||
+ NewMenu_ObjectWithSite_Release,
|
||||
+ NewMenu_ObjectWithSite_SetSite,
|
||||
+ NewMenu_ObjectWithSite_GetSite,
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ContextMenu3_QueryInterface(IContextMenu3 *iface, REFIID riid, void **ppv)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IContextMenu3(iface);
|
||||
+ return NewMenu_ExtInit_QueryInterface(&This->IShellExtInit_iface, riid, ppv);
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI
|
||||
+NewMenu_ContextMenu3_AddRef(IContextMenu3 *iface)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IContextMenu3(iface);
|
||||
+ return NewMenu_ExtInit_AddRef(&This->IShellExtInit_iface);
|
||||
+}
|
||||
+
|
||||
+static ULONG WINAPI
|
||||
+NewMenu_ContextMenu3_Release(IContextMenu3 *iface)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IContextMenu3(iface);
|
||||
+ return NewMenu_ExtInit_Release(&This->IShellExtInit_iface);
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ContextMenu3_GetCommandString(IContextMenu3 *iface, UINT_PTR cmd, UINT type,
|
||||
+ UINT *reserved, LPSTR name, UINT max_len)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IContextMenu3(iface);
|
||||
+
|
||||
+ FIXME("(%p)->(%Iu %u %p %p %u): stub\n", This, cmd, type, reserved, name, max_len);
|
||||
+
|
||||
+ return E_NOTIMPL;
|
||||
+}
|
||||
+
|
||||
+static HRESULT create_folder(NewMenuImpl *This, IShellView *view)
|
||||
+{
|
||||
+ IFolderView *folder_view = NULL;
|
||||
+ IShellFolder *desktop = NULL;
|
||||
+ IShellFolder *parent = NULL;
|
||||
+ ISFHelper *helper = NULL;
|
||||
+ LPITEMIDLIST pidl = NULL;
|
||||
+ WCHAR nameW[MAX_PATH];
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ if (view)
|
||||
+ {
|
||||
+ hr = IShellView_QueryInterface(view, &IID_IFolderView, (void **)&folder_view);
|
||||
+ if (FAILED(hr)) return hr;
|
||||
+
|
||||
+ hr = IFolderView_GetFolder(folder_view, &IID_IShellFolder, (void **)&parent);
|
||||
+ if (FAILED(hr)) goto out;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ hr = SHGetDesktopFolder(&desktop);
|
||||
+ if (FAILED(hr)) goto out;
|
||||
+
|
||||
+ hr = IShellFolder_BindToObject(desktop, This->pidl, NULL, &IID_IShellFolder, (void **)&parent);
|
||||
+ if (FAILED(hr)) goto out;
|
||||
+ }
|
||||
+
|
||||
+ IShellFolder_QueryInterface(parent, &IID_ISFHelper, (void **)&helper);
|
||||
+ if (FAILED(hr)) goto out;
|
||||
+
|
||||
+ hr = ISFHelper_GetUniqueName(helper, nameW, MAX_PATH);
|
||||
+ if (FAILED(hr)) goto out;
|
||||
+
|
||||
+ hr = ISFHelper_AddFolder(helper, 0, nameW, &pidl);
|
||||
+ if (FAILED(hr)) goto out;
|
||||
+
|
||||
+ if (view)
|
||||
+ {
|
||||
+ IShellView_SelectItem(view, pidl, SVSI_DESELECTOTHERS | SVSI_EDIT |
|
||||
+ SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT);
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ if (pidl) SHFree(pidl);
|
||||
+ if (helper) ISFHelper_Release(helper);
|
||||
+ if (parent) IShellFolder_Release(parent);
|
||||
+ if (desktop) IShellFolder_Release(desktop);
|
||||
+ if (folder_view) IFolderView_Release(folder_view);
|
||||
+ return hr;
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ContextMenu3_InvokeCommand(IContextMenu3 *iface, LPCMINVOKECOMMANDINFO info)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IContextMenu3(iface);
|
||||
+ IShellBrowser *browser;
|
||||
+ IShellView *view = NULL;
|
||||
+ HRESULT hr = E_FAIL;
|
||||
+
|
||||
+ TRACE("(%p)->(%p)\n", This, info);
|
||||
+
|
||||
+ /* New Folder */
|
||||
+ if (info->lpVerb == 0)
|
||||
+ {
|
||||
+ if ((browser = (IShellBrowser *)SendMessageA(info->hwnd, CWM_GETISHELLBROWSER, 0, 0)))
|
||||
+ {
|
||||
+ if (FAILED(IShellBrowser_QueryActiveShellView(browser, &view)))
|
||||
+ view = NULL;
|
||||
+ }
|
||||
+ hr = create_folder(This, view);
|
||||
+ if (view) IShellView_Release(view);
|
||||
+ }
|
||||
+
|
||||
+ return hr;
|
||||
+}
|
||||
+
|
||||
+static UINT insert_new_menu_items(NewMenuImpl *This, HMENU menu, UINT pos, UINT cmd_first, UINT cmd_last)
|
||||
+{
|
||||
+ MENUITEMINFOW item;
|
||||
+ WCHAR buffer[256];
|
||||
+
|
||||
+ memset(&item, 0, sizeof(item));
|
||||
+ item.cbSize = sizeof(item);
|
||||
+
|
||||
+ if (cmd_first > cmd_last)
|
||||
+ return cmd_first;
|
||||
+
|
||||
+ /* FIXME: on windows it is only 'Folder' not 'New Folder' */
|
||||
+ if (!LoadStringW(shell32_hInstance, IDS_NEWFOLDER, buffer, sizeof(buffer) / sizeof(WCHAR)))
|
||||
+ buffer[0] = 0;
|
||||
+
|
||||
+ item.fMask = MIIM_ID | MIIM_BITMAP | MIIM_STRING;
|
||||
+ item.dwTypeData = buffer;
|
||||
+ item.cch = wcslen(buffer);
|
||||
+ item.wID = cmd_first;
|
||||
+ item.hbmpItem = HBMMENU_CALLBACK;
|
||||
+ if (InsertMenuItemW(menu, pos, TRUE, &item))
|
||||
+ {
|
||||
+ This->folder_cmd = cmd_first++;
|
||||
+ pos++;
|
||||
+ }
|
||||
+
|
||||
+ return cmd_first;
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ContextMenu3_QueryContextMenu(IContextMenu3 *iface, HMENU menu, UINT index,
|
||||
+ UINT cmd_first, UINT cmd_last, UINT flags)
|
||||
+{
|
||||
+ static WCHAR newW[] = {'N','e','w',0};
|
||||
+ NewMenuImpl *This = impl_from_IContextMenu3(iface);
|
||||
+ MENUITEMINFOW item;
|
||||
+ HMENU submenu;
|
||||
+ UINT id;
|
||||
+
|
||||
+ TRACE("(%p)->(%p, %u, %u, %u, %u)\n", This,
|
||||
+ menu, index, cmd_first, cmd_last, flags );
|
||||
+
|
||||
+ if (!This->pidl)
|
||||
+ return E_FAIL;
|
||||
+
|
||||
+ submenu = CreateMenu();
|
||||
+ if (!submenu) return E_FAIL;
|
||||
+
|
||||
+ id = insert_new_menu_items(This, submenu, 0, cmd_first, cmd_last);
|
||||
+
|
||||
+ memset(&item, 0, sizeof(item));
|
||||
+ item.cbSize = sizeof(item);
|
||||
+ item.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE | MIIM_SUBMENU;
|
||||
+ item.fType = MFT_STRING;
|
||||
+ item.wID = -1;
|
||||
+ item.dwTypeData = newW; /* FIXME: load from resource file */
|
||||
+ item.cch = wcslen(newW);
|
||||
+ item.fState = MFS_ENABLED;
|
||||
+ item.hSubMenu = submenu;
|
||||
+
|
||||
+ if (!InsertMenuItemW(menu, index, TRUE, &item))
|
||||
+ return E_FAIL;
|
||||
+
|
||||
+ return MAKE_HRESULT(SEVERITY_SUCCESS, 0, id);
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ContextMenu3_HandleMenuMsg2(IContextMenu3 *iface, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *result)
|
||||
+{
|
||||
+ NewMenuImpl *This = impl_from_IContextMenu3(iface);
|
||||
+
|
||||
+ TRACE("(%p)->(%u, %Ix, %Ix, %p)\n", This, uMsg, wParam, lParam, result);
|
||||
+
|
||||
+ switch (uMsg)
|
||||
+ {
|
||||
+ case WM_MEASUREITEM:
|
||||
+ {
|
||||
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
|
||||
+ if (!mis || mis->CtlType != ODT_MENU)
|
||||
+ break;
|
||||
+
|
||||
+ if (This->folder_cmd == mis->itemID)
|
||||
+ {
|
||||
+ mis->itemWidth = GetSystemMetrics(SM_CXSMICON);
|
||||
+ mis->itemHeight = GetSystemMetrics(SM_CYSMICON);
|
||||
+ }
|
||||
+
|
||||
+ if (result) *result = TRUE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case WM_DRAWITEM:
|
||||
+ {
|
||||
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
|
||||
+ HICON icon = 0;
|
||||
+ UINT x, y;
|
||||
+
|
||||
+ if (!dis || dis->CtlType != ODT_MENU)
|
||||
+ break;
|
||||
+
|
||||
+ if (This->folder_cmd == dis->itemID)
|
||||
+ icon = This->icon_folder;
|
||||
+
|
||||
+ if (!icon)
|
||||
+ break;
|
||||
+
|
||||
+ x = (dis->rcItem.right - dis->rcItem.left - GetSystemMetrics(SM_CXSMICON)) / 2;
|
||||
+ y = (dis->rcItem.bottom - dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2;
|
||||
+ DrawStateW(dis->hDC, NULL, NULL, (LPARAM)icon, 0, x, y, 0, 0, DST_ICON | DSS_NORMAL);
|
||||
+
|
||||
+ if (result) *result = TRUE;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return S_OK;
|
||||
+}
|
||||
+
|
||||
+static HRESULT WINAPI
|
||||
+NewMenu_ContextMenu3_HandleMenuMsg(IContextMenu3 *iface, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
+{
|
||||
+ return NewMenu_ContextMenu3_HandleMenuMsg2(iface, uMsg, wParam, lParam, NULL);
|
||||
+}
|
||||
+
|
||||
+static const IContextMenu3Vtbl cmvt3 =
|
||||
+{
|
||||
+ NewMenu_ContextMenu3_QueryInterface,
|
||||
+ NewMenu_ContextMenu3_AddRef,
|
||||
+ NewMenu_ContextMenu3_Release,
|
||||
+ NewMenu_ContextMenu3_QueryContextMenu,
|
||||
+ NewMenu_ContextMenu3_InvokeCommand,
|
||||
+ NewMenu_ContextMenu3_GetCommandString,
|
||||
+ NewMenu_ContextMenu3_HandleMenuMsg,
|
||||
+ NewMenu_ContextMenu3_HandleMenuMsg2
|
||||
+};
|
||||
+
|
||||
+HRESULT WINAPI NewMenu_Constructor(IUnknown *outer, REFIID riid, void **obj)
|
||||
+{
|
||||
+ NewMenuImpl *menu;
|
||||
+ HRESULT hr;
|
||||
+
|
||||
+ TRACE("outer=%p riid=%s\n", outer, debugstr_guid(riid));
|
||||
+
|
||||
+ *obj = NULL;
|
||||
+
|
||||
+ if (outer)
|
||||
+ return CLASS_E_NOAGGREGATION;
|
||||
+
|
||||
+ menu = heap_alloc_zero(sizeof(NewMenuImpl));
|
||||
+ if (!menu) return E_OUTOFMEMORY;
|
||||
+
|
||||
+ menu->ref = 1;
|
||||
+ menu->IShellExtInit_iface.lpVtbl = &eivt;
|
||||
+ menu->IContextMenu3_iface.lpVtbl = &cmvt3;
|
||||
+ menu->IObjectWithSite_iface.lpVtbl = &owsvt;
|
||||
+
|
||||
+ TRACE("(%p)\n", menu);
|
||||
+
|
||||
+ hr = IShellExtInit_QueryInterface(&menu->IShellExtInit_iface, riid, obj);
|
||||
+ IShellExtInit_Release(&menu->IShellExtInit_iface);
|
||||
+ return hr;
|
||||
+}
|
||||
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
|
||||
index 52123ac0004..256f6e45122 100644
|
||||
--- a/dlls/shell32/shellole.c
|
||||
+++ b/dlls/shell32/shellole.c
|
||||
@@ -70,6 +70,7 @@ static const struct {
|
||||
{&CLSID_MyComputer, ISF_MyComputer_Constructor},
|
||||
{&CLSID_MyDocuments, MyDocuments_Constructor},
|
||||
{&CLSID_NetworkPlaces, ISF_NetworkPlaces_Constructor},
|
||||
+ {&CLSID_NewMenu, NewMenu_Constructor},
|
||||
{&CLSID_Printers, Printers_Constructor},
|
||||
{&CLSID_QueryAssociations, QueryAssociations_Constructor},
|
||||
{&CLSID_RecycleBin, RecycleBin_Constructor},
|
||||
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c
|
||||
index 89ff2e71eb0..2bfe543b61a 100644
|
||||
--- a/dlls/shell32/tests/shlview.c
|
||||
+++ b/dlls/shell32/tests/shlview.c
|
||||
@@ -1482,7 +1482,6 @@ static void test_newmenu(void)
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_NewMenu, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
|
||||
- todo_wine
|
||||
ok(hr == S_OK, "Failed to create NewMenu object, hr %#lx.\n", hr);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
@@ -1494,6 +1493,14 @@ static void test_newmenu(void)
|
||||
ok(hr == S_OK, "Failed to get IShellExtInit, hr %#lx.\n", hr);
|
||||
IUnknown_Release(unk2);
|
||||
|
||||
+ hr = IUnknown_QueryInterface(unk, &IID_IContextMenu, (void **)&unk2);
|
||||
+ ok(hr == S_OK, "Failed to get IContextMenu, hr %#lx.\n", hr);
|
||||
+ IUnknown_Release(unk2);
|
||||
+
|
||||
+ hr = IUnknown_QueryInterface(unk, &IID_IContextMenu2, (void **)&unk2);
|
||||
+ ok(hr == S_OK, "Failed to get IContextMenu2, hr %#lx.\n", hr);
|
||||
+ IUnknown_Release(unk2);
|
||||
+
|
||||
hr = IUnknown_QueryInterface(unk, &IID_IContextMenu3, (void **)&unk2);
|
||||
ok(hr == S_OK, "Failed to get IContextMenu3, hr %#lx.\n", hr);
|
||||
IUnknown_Release(unk2);
|
||||
--
|
||||
2.40.1
|
||||
|
@ -1,3 +0,0 @@
|
||||
Fixes: [24812] Implement shell32 NewMenu class with new folder item
|
||||
# In the process of upstreaming.
|
||||
Disabled: true
|
@ -1 +1 @@
|
||||
6cbe072c3799b27addb67014245ea7c59b1023dd
|
||||
1d3b312f225f79bec74d3d265128ead455467e2a
|
||||
|
Loading…
Reference in New Issue
Block a user