Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shell32/tests/shlview.c | 30 ++++++++++++++++++++++++++++++ include/shlguid.h | 1 + 2 files changed, 31 insertions(+)
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c index 76855067c0..f31d16e5e2 100644 --- a/dlls/shell32/tests/shlview.c +++ b/dlls/shell32/tests/shlview.c @@ -1476,6 +1476,35 @@ if (0) IShellFolder_Release(desktop); }
+static void test_newmenu(void) +{ + IUnknown *unk, *unk2; + 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 %#x.\n", hr); + if (hr != S_OK) + { + skip("NewMenu is not supported.\n"); + return; + } + + hr = IUnknown_QueryInterface(unk, &IID_IShellExtInit, (void **)&unk2); + ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IContextMenu3, (void **)&unk2); + ok(hr == S_OK, "Failed to get IContextMenu3, hr %#x.\n", hr); + IUnknown_Release(unk2); + + hr = IUnknown_QueryInterface(unk, &IID_IObjectWithSite, (void **)&unk2); + ok(hr == S_OK, "Failed to get IObjectWithSite, hr %#x.\n", hr); + IUnknown_Release(unk2); + + IUnknown_Release(unk); +} + START_TEST(shlview) { OleInitialize(NULL); @@ -1491,6 +1520,7 @@ START_TEST(shlview) test_IOleCommandTarget(); test_SHCreateShellFolderView(); test_SHCreateShellFolderViewEx(); + test_newmenu();
OleUninitialize(); } diff --git a/include/shlguid.h b/include/shlguid.h index 028cb61f28..687bbec79e 100644 --- a/include/shlguid.h +++ b/include/shlguid.h @@ -146,6 +146,7 @@ DEFINE_GUID(CLSID_DragDropHelper, 0x4657278a, 0x411b, 0x11d2, 0x83, 0x9a, 0x00, DEFINE_GUID(CLSID_ProgressDialog, 0xf8383852, 0xfcd3, 0x11d1, 0xa6, 0xb9, 0x0, 0x60, 0x97, 0xdf, 0x5b, 0xd4);
DEFINE_GUID(CLSID_ShellItem, 0x2fe352ea, 0xfd1f, 0x11d2, 0xb1, 0xf4, 0x00, 0xc0, 0x4f, 0x8e, 0xeb, 0x3e); +DEFINE_GUID(CLSID_NewMenu, 0xd969a300, 0xe7ff, 0x11d0, 0xa9, 0x3b, 0x0, 0xa0, 0xc9, 0xf, 0x27, 0x19);
#define PSGUID_SHELLDETAILS {0x28636aa6, 0x953d, 0x11d2, 0xb5, 0xd6, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0} DEFINE_GUID(FMTID_ShellDetails, 0x28636aa6, 0x953d, 0x11d2, 0xb5, 0xd6, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shell32/tests/shlfolder.c | 191 +++++++++++++++++++++++------------------ 1 file changed, 108 insertions(+), 83 deletions(-)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 40ba378cc1..1cf04b5bbc 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -4343,6 +4343,96 @@ static void test_desktop_IPersist(void) IShellFolder_Release(desktop); }
+static void test_contextmenu(IContextMenu *menu, BOOL background) +{ + HMENU hmenu = CreatePopupMenu(); + const int id_upper_limit = 32767; + const int baseItem = 0x40; + INT max_id, max_id_check; + IUnknown *unk; + UINT count, i; + HRESULT hr; + + hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (void **)&unk); +todo_wine + ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); +if (hr == S_OK) + IUnknown_Release(unk); + + hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk); +todo_wine + ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); +if (hr == S_OK) + IUnknown_Release(unk); + + hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL); + ok(SUCCEEDED(hr), "Failed to query the menu, hr %#x.\n", hr); + + max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */ + ok(max_id <= id_upper_limit, "Got %d\n", max_id); + count = GetMenuItemCount(hmenu); + ok(count, "Got %d\n", count); + + max_id_check = 0; + for (i = 0; i < count; i++) + { + MENUITEMINFOA mii; + INT res; + char buf[255], buf2[255]; + ZeroMemory(&mii, sizeof(MENUITEMINFOA)); + mii.cbSize = sizeof(MENUITEMINFOA); + mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING; + mii.dwTypeData = buf2; + mii.cch = sizeof(buf2); + + res = GetMenuItemInfoA(hmenu, i, TRUE, &mii); + ok(res, "Failed to get menu item info, error %d.\n", GetLastError()); + + ok((mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR), + "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType); + if (!(mii.fType & MFT_SEPARATOR)) + { + max_id_check = (mii.wID > max_id_check) ? mii.wID : max_id_check; + hr = IContextMenu_GetCommandString(menu, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf)); + todo_wine_if(background) + ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData); + if (SUCCEEDED(hr)) + trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData); + else if (hr == E_NOTIMPL) + trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData); + } + } + max_id_check -= baseItem; + ok((max_id_check == max_id) || + (max_id_check == max_id-1) || /* Win 7 */ + (max_id_check == max_id-2) || /* Win 8 */ + (max_id_check == max_id-3), + "Not equal (or near equal), got %d and %d\n", max_id_check, max_id); + + if (count) + { + CMINVOKECOMMANDINFO cmi; + + memset(&cmi, 0, sizeof(CMINVOKECOMMANDINFO)); + cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); + + /* Attempt to execute a nonexistent command */ + cmi.lpVerb = MAKEINTRESOURCEA(9999); + hr = IContextMenu_InvokeCommand(menu, &cmi); + todo_wine_if(background) + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + + cmi.lpVerb = "foobar_wine_test"; + hr = IContextMenu_InvokeCommand(menu, &cmi); + todo_wine_if(background) + ok((hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) || + (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */), + "Unexpected hr %#x.\n", hr); + } + + DestroyMenu(hmenu); +} + static void test_GetUIObject(void) { IShellFolder *psf_desktop; @@ -4352,6 +4442,8 @@ static void test_GetUIObject(void) WCHAR path[MAX_PATH]; const WCHAR filename[] = {'\','t','e','s','t','d','i','r','\','t','e','s','t','1','.','t','x','t',0}; + LPCITEMIDLIST pidl_child; + IShellFolder *psf;
GetCurrentDirectoryW(MAX_PATH, path); if (!path[0]) @@ -4366,91 +4458,24 @@ static void test_GetUIObject(void)
hr = IShellFolder_ParseDisplayName(psf_desktop, NULL, NULL, path, NULL, &pidl, 0); ok(hr == S_OK, "Got 0x%08x\n", hr); - if(SUCCEEDED(hr)) - { - IShellFolder *psf; - LPCITEMIDLIST pidl_child; - hr = SHBindToParent(pidl, &IID_IShellFolder, (void**)&psf, &pidl_child); - ok(hr == S_OK, "Got 0x%08x\n", hr); - if(SUCCEEDED(hr)) - { - hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL, - (void**)&pcm); - ok(hr == S_OK, "Got 0x%08x\n", hr); - if(SUCCEEDED(hr)) - { - const int baseItem = 0x40; - HMENU hmenu = CreatePopupMenu(); - INT max_id, max_id_check; - UINT count, i; - const int id_upper_limit = 32767; - hr = IContextMenu_QueryContextMenu(pcm, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL); - ok(SUCCEEDED(hr), "Got 0x%08x\n", hr); - max_id = HRESULT_CODE(hr) - 1; /* returns max_id + 1 */ - ok(max_id <= id_upper_limit, "Got %d\n", max_id); - count = GetMenuItemCount(hmenu); - ok(count, "Got %d\n", count); - - max_id_check = 0; - for(i = 0; i < count; i++) - { - MENUITEMINFOA mii; - INT res; - char buf[255], buf2[255]; - ZeroMemory(&mii, sizeof(MENUITEMINFOA)); - mii.cbSize = sizeof(MENUITEMINFOA); - mii.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STRING; - mii.dwTypeData = buf2; - mii.cch = sizeof(buf2); - - SetLastError(0); - res = GetMenuItemInfoA(hmenu, i, TRUE, &mii); - ok(res, "Failed (last error: %d).\n", GetLastError()); - - ok( (mii.wID <= id_upper_limit) || (mii.fType & MFT_SEPARATOR), - "Got non-separator ID out of range: %d (type: %x)\n", mii.wID, mii.fType); - if(!(mii.fType & MFT_SEPARATOR)) - { - max_id_check = (mii.wID>max_id_check)?mii.wID:max_id_check; - hr = IContextMenu_GetCommandString(pcm, mii.wID - baseItem, GCS_VERBA, 0, buf, sizeof(buf)); - ok(SUCCEEDED(hr) || hr == E_NOTIMPL, "for id 0x%x got 0x%08x (menustr: %s)\n", mii.wID - baseItem, hr, mii.dwTypeData); - if (SUCCEEDED(hr)) - trace("for id 0x%x got string %s (menu string: %s)\n", mii.wID - baseItem, buf, mii.dwTypeData); - else if (hr == E_NOTIMPL) - trace("for id 0x%x got E_NOTIMPL (menu string: %s)\n", mii.wID - baseItem, mii.dwTypeData); - } - } - max_id_check -= baseItem; - ok((max_id_check == max_id) || - (max_id_check == max_id-1) || /* Win 7 */ - (max_id_check == max_id-2), /* Win 8 */ - "Not equal (or near equal), got %d and %d\n", max_id_check, max_id);
- if(count) - { - CMINVOKECOMMANDINFO cmi; - ZeroMemory(&cmi, sizeof(CMINVOKECOMMANDINFO)); - cmi.cbSize = sizeof(CMINVOKECOMMANDINFO); - - /* Attempt to execute a nonexistent command */ - cmi.lpVerb = MAKEINTRESOURCEA(9999); - hr = IContextMenu_InvokeCommand(pcm, &cmi); - ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); - - cmi.lpVerb = "foobar_wine_test"; - hr = IContextMenu_InvokeCommand(pcm, &cmi); - ok( (hr == E_INVALIDARG) || (hr == E_FAIL /* Win7 */) || - (hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Vista */), - "Got 0x%08x\n", hr); - } + hr = SHBindToParent(pidl, &IID_IShellFolder, (void **)&psf, &pidl_child); + ok(hr == S_OK, "Failed to bind to folder, hr %#x.\n", hr);
- DestroyMenu(hmenu); - IContextMenu_Release(pcm); - } - IShellFolder_Release(psf); - } - ILFree(pidl); - } + /* Item menu */ + hr = IShellFolder_GetUIObjectOf(psf, NULL, 1, &pidl_child, &IID_IContextMenu, NULL, (void **)&pcm); + ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr); + test_contextmenu(pcm, FALSE); + IContextMenu_Release(pcm); + + /* Background menu */ + hr = IShellFolder_GetUIObjectOf(psf_desktop, NULL, 0, NULL, &IID_IContextMenu, NULL, (void **)&pcm); + ok(hr == S_OK, "GetUIObjectOf() failed, hr %#x.\n", hr); + test_contextmenu(pcm, TRUE); + IContextMenu_Release(pcm); + + IShellFolder_Release(psf); + ILFree(pidl);
IShellFolder_Release(psf_desktop); Cleanup();
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shell32/shlview_cmenu.c | 48 ++++++++++++++++++++++++++++++++++++++++-- dlls/shell32/tests/shlfolder.c | 2 -- 2 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c index 3f09413f61..2b5d526994 100644 --- a/dlls/shell32/shlview_cmenu.c +++ b/dlls/shell32/shlview_cmenu.c @@ -45,6 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); typedef struct { IContextMenu3 IContextMenu3_iface; + IShellExtInit IShellExtInit_iface; LONG ref;
IShellFolder* parent; @@ -64,6 +65,11 @@ static inline ContextMenu *impl_from_IContextMenu3(IContextMenu3 *iface) return CONTAINING_RECORD(iface, ContextMenu, IContextMenu3_iface); }
+static inline ContextMenu *impl_from_IShellExtInit(IShellExtInit *iface) +{ + return CONTAINING_RECORD(iface, ContextMenu, IShellExtInit_iface); +} + static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID riid, LPVOID *ppvObj) { ContextMenu *This = impl_from_IContextMenu3(iface); @@ -79,9 +85,9 @@ static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID ri { *ppvObj = &This->IContextMenu3_iface; } - else if (IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ + else if (IsEqualIID(riid, &IID_IShellExtInit)) { - FIXME("-- LPSHELLEXTINIT pointer requested\n"); + *ppvObj = &This->IShellExtInit_iface; }
if(*ppvObj) @@ -580,6 +586,42 @@ static const IContextMenu3Vtbl ItemContextMenuVtbl = ContextMenu_HandleMenuMsg2 };
+static HRESULT WINAPI ShellExtInit_QueryInterface(IShellExtInit *iface, REFIID riid, void **obj) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + return IContextMenu3_QueryInterface(&This->IContextMenu3_iface, riid, obj); +} + +static ULONG WINAPI ShellExtInit_AddRef(IShellExtInit *iface) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + return IContextMenu3_AddRef(&This->IContextMenu3_iface); +} + +static ULONG WINAPI ShellExtInit_Release(IShellExtInit *iface) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + return IContextMenu3_Release(&This->IContextMenu3_iface); +} + +static HRESULT WINAPI ShellExtInit_Initialize(IShellExtInit *iface, LPCITEMIDLIST folder, + IDataObject *dataobj, HKEY progidkey) +{ + ContextMenu *This = impl_from_IShellExtInit(iface); + + FIXME("(%p)->(%p %p %p): stub\n", This, folder, dataobj, progidkey); + + return E_NOTIMPL; +} + +static const IShellExtInitVtbl ShellExtInitVtbl = +{ + ShellExtInit_QueryInterface, + ShellExtInit_AddRef, + ShellExtInit_Release, + ShellExtInit_Initialize +}; + HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *apidl, UINT cidl, REFIID riid, void **pObj) { @@ -591,6 +633,7 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl; + This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl; This->ref = 1; This->parent = parent; if (parent) IShellFolder_AddRef(parent); @@ -899,6 +942,7 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri if (!This) return E_OUTOFMEMORY;
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl; + This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl; This->ref = 1; This->parent = parent;
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 1cf04b5bbc..fac08018e7 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -4354,9 +4354,7 @@ static void test_contextmenu(IContextMenu *menu, BOOL background) HRESULT hr;
hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (void **)&unk); -todo_wine ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); -if (hr == S_OK) IUnknown_Release(unk);
hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shell32/shlview_cmenu.c | 57 ++++++++++++++++++++++++++++++++++++++++++ dlls/shell32/tests/shlfolder.c | 2 -- 2 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c index 2b5d526994..4a7263e4db 100644 --- a/dlls/shell32/shlview_cmenu.c +++ b/dlls/shell32/shlview_cmenu.c @@ -46,6 +46,7 @@ typedef struct { IContextMenu3 IContextMenu3_iface; IShellExtInit IShellExtInit_iface; + IObjectWithSite IObjectWithSite_iface; LONG ref;
IShellFolder* parent; @@ -70,6 +71,11 @@ static inline ContextMenu *impl_from_IShellExtInit(IShellExtInit *iface) return CONTAINING_RECORD(iface, ContextMenu, IShellExtInit_iface); }
+static inline ContextMenu *impl_from_IObjectWithSite(IObjectWithSite *iface) +{ + return CONTAINING_RECORD(iface, ContextMenu, IObjectWithSite_iface); +} + static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID riid, LPVOID *ppvObj) { ContextMenu *This = impl_from_IContextMenu3(iface); @@ -89,6 +95,10 @@ static HRESULT WINAPI ContextMenu_QueryInterface(IContextMenu3 *iface, REFIID ri { *ppvObj = &This->IShellExtInit_iface; } + else if (IsEqualIID(riid, &IID_IObjectWithSite)) + { + *ppvObj = &This->IObjectWithSite_iface; + }
if(*ppvObj) { @@ -622,6 +632,51 @@ static const IShellExtInitVtbl ShellExtInitVtbl = ShellExtInit_Initialize };
+static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **obj) +{ + ContextMenu *This = impl_from_IObjectWithSite(iface); + return IContextMenu3_QueryInterface(&This->IContextMenu3_iface, riid, obj); +} + +static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface) +{ + ContextMenu *This = impl_from_IObjectWithSite(iface); + return IContextMenu3_AddRef(&This->IContextMenu3_iface); +} + +static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface) +{ + ContextMenu *This = impl_from_IObjectWithSite(iface); + return IContextMenu3_Release(&This->IContextMenu3_iface); +} + +static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *site) +{ + ContextMenu *This = impl_from_IObjectWithSite(iface); + + FIXME("(%p)->(%p): stub\n", This, site); + + return E_NOTIMPL; +} + +static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID riid, void **site) +{ + ContextMenu *This = impl_from_IObjectWithSite(iface); + + FIXME("(%p)->(%s %p): stub\n", This, debugstr_guid(riid), site); + + return E_NOTIMPL; +} + +static const IObjectWithSiteVtbl ObjectWithSiteVtbl = +{ + ObjectWithSite_QueryInterface, + ObjectWithSite_AddRef, + ObjectWithSite_Release, + ObjectWithSite_SetSite, + ObjectWithSite_GetSite, +}; + HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPCITEMIDLIST *apidl, UINT cidl, REFIID riid, void **pObj) { @@ -634,6 +689,7 @@ HRESULT ItemMenu_Constructor(IShellFolder *parent, LPCITEMIDLIST pidl, const LPC
This->IContextMenu3_iface.lpVtbl = &ItemContextMenuVtbl; This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl; + This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl; This->ref = 1; This->parent = parent; if (parent) IShellFolder_AddRef(parent); @@ -943,6 +999,7 @@ HRESULT BackgroundMenu_Constructor(IShellFolder *parent, BOOL desktop, REFIID ri
This->IContextMenu3_iface.lpVtbl = &BackgroundContextMenuVtbl; This->IShellExtInit_iface.lpVtbl = &ShellExtInitVtbl; + This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl; This->ref = 1; This->parent = parent;
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index fac08018e7..ee7ec49a74 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -4358,9 +4358,7 @@ static void test_contextmenu(IContextMenu *menu, BOOL background) IUnknown_Release(unk);
hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk); -todo_wine ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); -if (hr == S_OK) IUnknown_Release(unk);
hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shell32/tests/shlfolder.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index ee7ec49a74..716a486515 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -4343,23 +4343,34 @@ static void test_desktop_IPersist(void) IShellFolder_Release(desktop); }
-static void test_contextmenu(IContextMenu *menu, BOOL background) +static void test_contextmenu_qi(IContextMenu *menu, BOOL todo) { - HMENU hmenu = CreatePopupMenu(); - const int id_upper_limit = 32767; - const int baseItem = 0x40; - INT max_id, max_id_check; IUnknown *unk; - UINT count, i; HRESULT hr;
hr = IContextMenu_QueryInterface(menu, &IID_IShellExtInit, (void **)&unk); +todo_wine_if(todo) ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); +if (hr == S_OK) IUnknown_Release(unk);
hr = IContextMenu_QueryInterface(menu, &IID_IObjectWithSite, (void **)&unk); +todo_wine_if(todo) ok(hr == S_OK, "Failed to get IShellExtInit, hr %#x.\n", hr); +if (hr == S_OK) IUnknown_Release(unk); +} + +static void test_contextmenu(IContextMenu *menu, BOOL background) +{ + HMENU hmenu = CreatePopupMenu(); + const int id_upper_limit = 32767; + const int baseItem = 0x40; + INT max_id, max_id_check; + UINT count, i; + HRESULT hr; + + test_contextmenu_qi(menu, FALSE);
hr = IContextMenu_QueryContextMenu(menu, hmenu, 0, baseItem, id_upper_limit, CMF_NORMAL); ok(SUCCEEDED(hr), "Failed to query the menu, hr %#x.\n", hr); @@ -5011,7 +5022,6 @@ static void test_SHCreateDefaultContextMenu(void) IPersistFolder2_Release(persist); if(SUCCEEDED(hr)) { - cminfo.hwnd=NULL; cminfo.pcmcb=NULL; cminfo.psf=folder; @@ -5021,13 +5031,18 @@ static void test_SHCreateDefaultContextMenu(void) cminfo.aKeys=NULL; cminfo.cKeys=0; cminfo.punkAssociationInfo=NULL; + hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu); ok(hr==S_OK,"Got 0x%08x\n", hr); + test_contextmenu_qi(cmenu, TRUE); IContextMenu_Release(cmenu); + cminfo.pidlFolder=pidlFolder; hr = pSHCreateDefaultContextMenu(&cminfo,&IID_IContextMenu,(void**)&cmenu); ok(hr==S_OK,"Got 0x%08x\n", hr); + test_contextmenu_qi(cmenu, TRUE); IContextMenu_Release(cmenu); + status = RegOpenKeyExA(HKEY_CLASSES_ROOT,"*",0,KEY_READ,keys); if(status==ERROR_SUCCESS){ for(i=1;i<16;i++)