Commit bc160ff1 authored by Michael Jung's avatar Michael Jung Committed by Alexandre Julliard

Support for shell instance objects.

Removed a wine_todo for a no longer failing test. Added a test for IPersistFolder3::GetCurFolder.
parent 3e73b93a
......@@ -5,7 +5,8 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = shdocvw.dll
IMPORTLIB = libshdocvw.$(IMPLIBEXT)
IMPORTS = urlmon ole32 user32 advapi32 kernel32
IMPORTS = user32 advapi32 kernel32
DELAYIMPORTS = urlmon ole32 oleaut32
EXTRALIBS = -luuid
C_SRCS = \
......@@ -17,6 +18,7 @@ C_SRCS = \
persist.c \
regsvr.c \
shdocvw_main.c \
shlinstobj.c \
webbrowser.c
RC_SRCS = shdocvw.rc
......
......@@ -48,6 +48,11 @@ typedef struct
extern IClassFactoryImpl SHDOCVW_ClassFactory;
/**********************************************************************
* Shell Instance Objects
*/
extern HRESULT SHDOCVW_GetShellInstanceObjectClassObject(REFCLSID rclsid,
REFIID riid, LPVOID *ppvClassObj);
/**********************************************************************
* WebBrowser declaration for SHDOCVW.DLL
......
......@@ -490,7 +490,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return S_OK;
}
return CLASS_E_CLASSNOTAVAILABLE;
/* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
}
/***********************************************************************
......
/*
* Unit tests to document shdocvw's CLSID_FolderShortcut related functionality
* Unit tests to document shdocvw's 'Shell Instance Objects' features
*
* Copyright 2005 Michael Jung
*
......@@ -27,7 +27,10 @@
* Technologies". This mechanism would be cool for wine, since we could
* map Gnome's virtual devices to FolderShortcuts and have them appear in the
* file dialogs. These unit tests are meant to document how this mechanism
* works on windows. */
* works on windows.
*
* Search MSDN for "Creating Shell Extensions with Shell Instance Objects" for
* more documentation.*/
#include <stdarg.h>
......@@ -153,13 +156,15 @@ static void unregister_keys(HKEY hRootKey, const struct registry_key *keys, unsi
RegDeleteKeyA(hRootKey, keys[iKey].szName);
}
}
static void test_ShortcutFolder() {
LPSHELLFOLDER pDesktopFolder, pWineTestFolder;
IPersist *pWineTestPersist;
LPITEMIDLIST pidlWineTestFolder;
IPersistFolder3 *pWineTestPersistFolder;
LPITEMIDLIST pidlWineTestFolder, pidlCurFolder;
HRESULT hr;
CLSID clsid;
const CLSID CLSID_WineTest =
{ 0x9b352ebf, 0x2765, 0x45c1, { 0xb4, 0xc6, 0x85, 0xcc, 0x7f, 0x7a, 0xbc, 0x64 } };
WCHAR wszWineTestFolder[] = {
':',':','{','9','B','3','5','2','E','B','F','-','2','7','6','5','-','4','5','C','1','-',
'B','4','C','6','-','8','5','C','C','7','F','7','A','B','C','6','4','}',0 };
......@@ -187,20 +192,27 @@ static void test_ShortcutFolder() {
(LPVOID*)&pWineTestFolder);
IShellFolder_Release(pDesktopFolder);
ILFree(pidlWineTestFolder);
todo_wine { ok (SUCCEEDED(hr), "IShellFolder::BindToObject(WineTestFolder) failed! hr = %08lx\n", hr); }
ok (SUCCEEDED(hr), "IShellFolder::BindToObject(WineTestFolder) failed! hr = %08lx\n", hr);
if (FAILED(hr)) goto cleanup;
hr = IShellFolder_QueryInterface(pWineTestFolder, &IID_IPersist, (LPVOID*)&pWineTestPersist);
ok (SUCCEEDED(hr), "IShellFolder::QueryInterface(IPersist) failed! hr = %08lx\n", hr);
hr = IShellFolder_QueryInterface(pWineTestFolder, &IID_IPersistFolder3, (LPVOID*)&pWineTestPersistFolder);
ok (SUCCEEDED(hr), "IShellFolder::QueryInterface(IPersistFolder3) failed! hr = %08lx\n", hr);
IShellFolder_Release(pWineTestFolder);
if (FAILED(hr)) goto cleanup;
/* The resulting folder object has the FolderShortcut CLSID, instead of it's own. */
hr = IPersist_GetClassID(pWineTestPersist, &clsid);
hr = IPersistFolder3_GetClassID(pWineTestPersistFolder, &clsid);
ok (SUCCEEDED(hr), "IPersist::GetClassID failed! hr = %08lx\n", hr);
ok (IsEqualCLSID(&CLSID_FolderShortcut, &clsid), "GetClassId returned wrong CLSID!\n");
pidlCurFolder = (LPITEMIDLIST)0xdeadbeef;
hr = IPersistFolder3_GetCurFolder(pWineTestPersistFolder, &pidlCurFolder);
ok (SUCCEEDED(hr), "IPersistFolder3::GetCurFolder failed! hr = %08lx\n", hr);
ok (pidlCurFolder->mkid.cb == 20 && ((LPSHITEMID)((BYTE*)pidlCurFolder+20))->cb == 0 &&
IsEqualCLSID(&CLSID_WineTest, (REFCLSID)((LPBYTE)pidlCurFolder+4)),
"GetCurFolder returned unexpected pidl!\n");
IPersist_Release(pWineTestPersist);
IPersistFolder3_Release(pWineTestPersistFolder);
cleanup:
unregister_keys(HKEY_CLASSES_ROOT, HKEY_CLASSES_ROOT_keys, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment