shell32: Add ::Initialize() and ::GetCurFolder() for printers folder IPersistFolder2 interface.
This commit is contained in:
parent
e51fe8e070
commit
90a5529de8
|
@ -42,6 +42,8 @@ typedef struct {
|
|||
const IShellFolder2Vtbl *lpVtbl;
|
||||
const IPersistFolder2Vtbl *lpvtblPersistFolder2;
|
||||
LONG ref;
|
||||
|
||||
LPITEMIDLIST pidl;
|
||||
} IPrintersFolderImpl;
|
||||
|
||||
static inline IPrintersFolderImpl *impl_from_IPersistFolder2(IPersistFolder2 *iface)
|
||||
|
@ -111,6 +113,7 @@ static ULONG WINAPI IShellFolder_Printers_fnRelease (IShellFolder2 * iface)
|
|||
if (!refCount)
|
||||
{
|
||||
TRACE ("-- destroying IShellFolder(%p)\n", This);
|
||||
SHFree(This->pidl);
|
||||
LocalFree (This);
|
||||
}
|
||||
return refCount;
|
||||
|
@ -380,15 +383,24 @@ static HRESULT WINAPI IPersistFolder2_Printers_fnGetClassID(IPersistFolder2 *ifa
|
|||
static HRESULT WINAPI IPersistFolder2_Printers_fnInitialize(IPersistFolder2 *iface, LPCITEMIDLIST pidl)
|
||||
{
|
||||
IPrintersFolderImpl *This = impl_from_IPersistFolder2(iface);
|
||||
FIXME("(%p) stub\n", This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pidl);
|
||||
|
||||
SHFree(This->pidl);
|
||||
This->pidl = ILClone(pidl);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IPersistFolder2_Printers_fnGetCurFolder(IPersistFolder2 *iface, LPITEMIDLIST *pidl)
|
||||
{
|
||||
IPrintersFolderImpl *This = impl_from_IPersistFolder2(iface);
|
||||
FIXME("(%p) stub\n", This);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pidl);
|
||||
|
||||
*pidl = ILClone(This->pidl);
|
||||
|
||||
return *pidl ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
static const IPersistFolder2Vtbl vtbl_PersistFolder2 =
|
||||
|
@ -417,6 +429,7 @@ HRESULT WINAPI Printers_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID *
|
|||
return E_OUTOFMEMORY;
|
||||
|
||||
sf->ref = 0;
|
||||
sf->pidl = NULL;
|
||||
sf->lpVtbl = &vtbl_ShellFolder2;
|
||||
sf->lpvtblPersistFolder2 = &vtbl_PersistFolder2;
|
||||
|
||||
|
|
|
@ -125,8 +125,10 @@ static void test_parse_for_control_panel(void)
|
|||
static void test_printers_folder(void)
|
||||
{
|
||||
IShellFolder2 *folder;
|
||||
IPersistFolder2 *pf;
|
||||
SHELLDETAILS details;
|
||||
SHCOLSTATEF state;
|
||||
LPITEMIDLIST pidl1, pidl2;
|
||||
INT i;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -145,6 +147,7 @@ if (0)
|
|||
/* crashes on XP */
|
||||
hr = IShellFolder2_GetDetailsOf(folder, NULL, 0, NULL);
|
||||
hr = IShellFolder2_GetDefaultColumnState(folder, 0, NULL);
|
||||
hr = IPersistFolder2_GetCurFolder(pf, NULL);
|
||||
}
|
||||
|
||||
/* 5 columns defined */
|
||||
|
@ -173,6 +176,30 @@ if (0)
|
|||
ok(state == (SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT), "got 0x%x\n", state);
|
||||
}
|
||||
|
||||
/* default pidl */
|
||||
hr = IShellFolder2_QueryInterface(folder, &IID_IPersistFolder2, (void**)&pf);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
/* not initialized */
|
||||
pidl1 = (void*)0xdeadbeef;
|
||||
hr = IPersistFolder2_GetCurFolder(pf, &pidl1);
|
||||
ok(hr == S_FALSE, "got 0x%08x\n", hr);
|
||||
ok(pidl1 == NULL, "got %p\n", pidl1);
|
||||
|
||||
hr = SHGetSpecialFolderLocation(NULL, CSIDL_PRINTERS, &pidl2);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IPersistFolder2_Initialize(pf, pidl2);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
hr = IPersistFolder2_GetCurFolder(pf, &pidl1);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
ok(ILIsEqual(pidl1, pidl2), "expected same PIDL\n");
|
||||
IPersistFolder2_Release(pf);
|
||||
|
||||
ILFree(pidl1);
|
||||
ILFree(pidl2);
|
||||
IShellFolder2_Release(folder);
|
||||
|
||||
CoUninitialize();
|
||||
|
|
Loading…
Reference in New Issue