shell32/tests: COM cleanup in ebrowser.c.

This commit is contained in:
Michael Stefaniuc 2011-05-25 10:40:07 +02:00 committed by Alexandre Julliard
parent 381f72fd7e
commit 4d003283c1
1 changed files with 73 additions and 52 deletions

View File

@ -21,6 +21,7 @@
#include <stdio.h> #include <stdio.h>
#define COBJMACROS #define COBJMACROS
#define CONST_VTABLE
#include "shlobj.h" #include "shlobj.h"
#include "shlwapi.h" #include "shlwapi.h"
@ -123,13 +124,18 @@ static void dbg_print_guid(const GUID *guid) {
* IExplorerBrowserEvents implementation * IExplorerBrowserEvents implementation
*/ */
typedef struct { typedef struct {
const IExplorerBrowserEventsVtbl *lpVtbl; IExplorerBrowserEvents IExplorerBrowserEvents_iface;
LONG ref; LONG ref;
UINT pending, created, completed, failed; UINT pending, created, completed, failed;
} IExplorerBrowserEventsImpl; } IExplorerBrowserEventsImpl;
static IExplorerBrowserEventsImpl ebev; static IExplorerBrowserEventsImpl ebev;
static inline IExplorerBrowserEventsImpl *impl_from_IExplorerBrowserEvents(IExplorerBrowserEvents *iface)
{
return CONTAINING_RECORD(iface, IExplorerBrowserEventsImpl, IExplorerBrowserEvents_iface);
}
static HRESULT WINAPI IExplorerBrowserEvents_fnQueryInterface(IExplorerBrowserEvents *iface, static HRESULT WINAPI IExplorerBrowserEvents_fnQueryInterface(IExplorerBrowserEvents *iface,
REFIID riid, void **ppvObj) REFIID riid, void **ppvObj)
{ {
@ -139,20 +145,20 @@ static HRESULT WINAPI IExplorerBrowserEvents_fnQueryInterface(IExplorerBrowserEv
static ULONG WINAPI IExplorerBrowserEvents_fnAddRef(IExplorerBrowserEvents *iface) static ULONG WINAPI IExplorerBrowserEvents_fnAddRef(IExplorerBrowserEvents *iface)
{ {
IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface; IExplorerBrowserEventsImpl *This = impl_from_IExplorerBrowserEvents(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI IExplorerBrowserEvents_fnRelease(IExplorerBrowserEvents *iface) static ULONG WINAPI IExplorerBrowserEvents_fnRelease(IExplorerBrowserEvents *iface)
{ {
IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface; IExplorerBrowserEventsImpl *This = impl_from_IExplorerBrowserEvents(iface);
return InterlockedDecrement(&This->ref); return InterlockedDecrement(&This->ref);
} }
static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationPending(IExplorerBrowserEvents *iface, static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationPending(IExplorerBrowserEvents *iface,
PCIDLIST_ABSOLUTE pidlFolder) PCIDLIST_ABSOLUTE pidlFolder)
{ {
IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface; IExplorerBrowserEventsImpl *This = impl_from_IExplorerBrowserEvents(iface);
This->pending++; This->pending++;
return S_OK; return S_OK;
} }
@ -160,21 +166,21 @@ static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationPending(IExplorerBrow
static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationComplete(IExplorerBrowserEvents *iface, static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationComplete(IExplorerBrowserEvents *iface,
PCIDLIST_ABSOLUTE pidlFolder) PCIDLIST_ABSOLUTE pidlFolder)
{ {
IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface; IExplorerBrowserEventsImpl *This = impl_from_IExplorerBrowserEvents(iface);
This->completed++; This->completed++;
return S_OK; return S_OK;
} }
static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationFailed(IExplorerBrowserEvents *iface, static HRESULT WINAPI IExplorerBrowserEvents_fnOnNavigationFailed(IExplorerBrowserEvents *iface,
PCIDLIST_ABSOLUTE pidlFolder) PCIDLIST_ABSOLUTE pidlFolder)
{ {
IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface; IExplorerBrowserEventsImpl *This = impl_from_IExplorerBrowserEvents(iface);
This->failed++; This->failed++;
return S_OK; return S_OK;
} }
static HRESULT WINAPI IExplorerBrowserEvents_fnOnViewCreated(IExplorerBrowserEvents *iface, static HRESULT WINAPI IExplorerBrowserEvents_fnOnViewCreated(IExplorerBrowserEvents *iface,
IShellView *psv) IShellView *psv)
{ {
IExplorerBrowserEventsImpl *This = (IExplorerBrowserEventsImpl*)iface; IExplorerBrowserEventsImpl *This = impl_from_IExplorerBrowserEvents(iface);
This->created++; This->created++;
return S_OK; return S_OK;
} }
@ -195,12 +201,17 @@ static const IExplorerBrowserEventsVtbl ebevents =
*/ */
typedef struct typedef struct
{ {
const IExplorerPaneVisibilityVtbl *lpVtbl; IExplorerPaneVisibility IExplorerPaneVisibility_iface;
LONG ref; LONG ref;
LONG count; LONG count;
LONG np, cp, cp_o, cp_v, dp, pp, qp, aqp, unk; /* The panes */ LONG np, cp, cp_o, cp_v, dp, pp, qp, aqp, unk; /* The panes */
} IExplorerPaneVisibilityImpl; } IExplorerPaneVisibilityImpl;
static inline IExplorerPaneVisibilityImpl *impl_from_IExplorerPaneVisibility(IExplorerPaneVisibility *iface)
{
return CONTAINING_RECORD(iface, IExplorerPaneVisibilityImpl, IExplorerPaneVisibility_iface);
}
static HRESULT WINAPI IExplorerPaneVisibility_fnQueryInterface(IExplorerPaneVisibility *iface, static HRESULT WINAPI IExplorerPaneVisibility_fnQueryInterface(IExplorerPaneVisibility *iface,
REFIID riid, LPVOID *ppvObj) REFIID riid, LPVOID *ppvObj)
{ {
@ -212,13 +223,13 @@ static HRESULT WINAPI IExplorerPaneVisibility_fnQueryInterface(IExplorerPaneVisi
static ULONG WINAPI IExplorerPaneVisibility_fnAddRef(IExplorerPaneVisibility *iface) static ULONG WINAPI IExplorerPaneVisibility_fnAddRef(IExplorerPaneVisibility *iface)
{ {
IExplorerPaneVisibilityImpl *This = (IExplorerPaneVisibilityImpl *)iface; IExplorerPaneVisibilityImpl *This = impl_from_IExplorerPaneVisibility(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI IExplorerPaneVisibility_fnRelease(IExplorerPaneVisibility *iface) static ULONG WINAPI IExplorerPaneVisibility_fnRelease(IExplorerPaneVisibility *iface)
{ {
IExplorerPaneVisibilityImpl *This = (IExplorerPaneVisibilityImpl *)iface; IExplorerPaneVisibilityImpl *This = impl_from_IExplorerPaneVisibility(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
if(!ref) if(!ref)
@ -231,7 +242,7 @@ static HRESULT WINAPI IExplorerPaneVisibility_fnGetPaneState(IExplorerPaneVisibi
REFEXPLORERPANE ep, REFEXPLORERPANE ep,
EXPLORERPANESTATE *peps) EXPLORERPANESTATE *peps)
{ {
IExplorerPaneVisibilityImpl *This = (IExplorerPaneVisibilityImpl *)iface; IExplorerPaneVisibilityImpl *This = impl_from_IExplorerPaneVisibility(iface);
This->count++; This->count++;
ok(ep != NULL, "ep is NULL.\n"); ok(ep != NULL, "ep is NULL.\n");
@ -269,7 +280,7 @@ static IExplorerPaneVisibilityImpl *create_explorerpanevisibility(void)
IExplorerPaneVisibilityImpl *epv; IExplorerPaneVisibilityImpl *epv;
epv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IExplorerPaneVisibilityImpl)); epv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IExplorerPaneVisibilityImpl));
epv->lpVtbl = &epvvt; epv->IExplorerPaneVisibility_iface.lpVtbl = &epvvt;
epv->ref = 1; epv->ref = 1;
return epv; return epv;
@ -280,13 +291,18 @@ static IExplorerPaneVisibilityImpl *create_explorerpanevisibility(void)
*/ */
typedef struct typedef struct
{ {
const ICommDlgBrowser3Vtbl *lpVtbl; ICommDlgBrowser3 ICommDlgBrowser3_iface;
LONG ref; LONG ref;
UINT OnDefaultCommand, OnStateChange, IncludeObject; UINT OnDefaultCommand, OnStateChange, IncludeObject;
UINT Notify, GetDefaultMenuText, GetViewFlags; UINT Notify, GetDefaultMenuText, GetViewFlags;
UINT OnColumnClicked, GetCurrentFilter, OnPreviewCreated; UINT OnColumnClicked, GetCurrentFilter, OnPreviewCreated;
} ICommDlgBrowser3Impl; } ICommDlgBrowser3Impl;
static inline ICommDlgBrowser3Impl *impl_from_ICommDlgBrowser3(ICommDlgBrowser3 *iface)
{
return CONTAINING_RECORD(iface, ICommDlgBrowser3Impl, ICommDlgBrowser3_iface);
}
static HRESULT WINAPI ICommDlgBrowser3_fnQueryInterface(ICommDlgBrowser3 *iface, REFIID riid, LPVOID *ppvObj) static HRESULT WINAPI ICommDlgBrowser3_fnQueryInterface(ICommDlgBrowser3 *iface, REFIID riid, LPVOID *ppvObj)
{ {
ok(0, "Not called.\n"); ok(0, "Not called.\n");
@ -297,13 +313,13 @@ static HRESULT WINAPI ICommDlgBrowser3_fnQueryInterface(ICommDlgBrowser3 *iface,
static ULONG WINAPI ICommDlgBrowser3_fnAddRef(ICommDlgBrowser3 *iface) static ULONG WINAPI ICommDlgBrowser3_fnAddRef(ICommDlgBrowser3 *iface)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface) static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
if(!ref) if(!ref)
@ -314,7 +330,7 @@ static ULONG WINAPI ICommDlgBrowser3_fnRelease(ICommDlgBrowser3 *iface)
static HRESULT WINAPI ICommDlgBrowser3_fnOnDefaultCommand(ICommDlgBrowser3* iface, IShellView *shv) static HRESULT WINAPI ICommDlgBrowser3_fnOnDefaultCommand(ICommDlgBrowser3* iface, IShellView *shv)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->OnDefaultCommand++; This->OnDefaultCommand++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -324,7 +340,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnOnStateChange(
IShellView *shv, IShellView *shv,
ULONG uChange) ULONG uChange)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->OnStateChange++; This->OnStateChange++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -334,7 +350,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnIncludeObject(
IShellView *shv, IShellView *shv,
LPCITEMIDLIST pidl) LPCITEMIDLIST pidl)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->IncludeObject++; This->IncludeObject++;
return S_OK; return S_OK;
} }
@ -344,7 +360,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnNotify(
IShellView *ppshv, IShellView *ppshv,
DWORD dwNotifyType) DWORD dwNotifyType)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->Notify++; This->Notify++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -355,7 +371,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnGetDefaultMenuText(
LPWSTR pszText, LPWSTR pszText,
int cchMax) int cchMax)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->GetDefaultMenuText++; This->GetDefaultMenuText++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -364,7 +380,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnGetViewFlags(
ICommDlgBrowser3* iface, ICommDlgBrowser3* iface,
DWORD *pdwFlags) DWORD *pdwFlags)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->GetViewFlags++; This->GetViewFlags++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -374,7 +390,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnOnColumnClicked(
IShellView *ppshv, IShellView *ppshv,
int iColumn) int iColumn)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->OnColumnClicked++; This->OnColumnClicked++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -384,7 +400,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnGetCurrentFilter(
LPWSTR pszFileSpec, LPWSTR pszFileSpec,
int cchFileSpec) int cchFileSpec)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->GetCurrentFilter++; This->GetCurrentFilter++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -393,7 +409,7 @@ static HRESULT WINAPI ICommDlgBrowser3_fnOnPreviewCreated(
ICommDlgBrowser3* iface, ICommDlgBrowser3* iface,
IShellView *ppshv) IShellView *ppshv)
{ {
ICommDlgBrowser3Impl *This = (ICommDlgBrowser3Impl *)iface; ICommDlgBrowser3Impl *This = impl_from_ICommDlgBrowser3(iface);
This->OnPreviewCreated++; This->OnPreviewCreated++;
return E_NOTIMPL; return E_NOTIMPL;
} }
@ -419,7 +435,7 @@ static ICommDlgBrowser3Impl *create_commdlgbrowser3(void)
ICommDlgBrowser3Impl *cdb; ICommDlgBrowser3Impl *cdb;
cdb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ICommDlgBrowser3Impl)); cdb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ICommDlgBrowser3Impl));
cdb->lpVtbl = &cdbvtbl; cdb->ICommDlgBrowser3_iface.lpVtbl = &cdbvtbl;
cdb->ref = 1; cdb->ref = 1;
return cdb; return cdb;
@ -429,7 +445,7 @@ static ICommDlgBrowser3Impl *create_commdlgbrowser3(void)
* IServiceProvider Implementation * IServiceProvider Implementation
*/ */
typedef struct { typedef struct {
const IServiceProviderVtbl *lpVtbl; IServiceProvider IServiceProvider_iface;
LONG ref; LONG ref;
struct services { struct services {
REFGUID service; REFGUID service;
@ -439,6 +455,11 @@ typedef struct {
} *interfaces; } *interfaces;
} IServiceProviderImpl; } IServiceProviderImpl;
static inline IServiceProviderImpl *impl_from_IServiceProvider(IServiceProvider *iface)
{
return CONTAINING_RECORD(iface, IServiceProviderImpl, IServiceProvider_iface);
}
static HRESULT WINAPI IServiceProvider_fnQueryInterface(IServiceProvider *iface, REFIID riid, LPVOID *ppvObj) static HRESULT WINAPI IServiceProvider_fnQueryInterface(IServiceProvider *iface, REFIID riid, LPVOID *ppvObj)
{ {
*ppvObj = NULL; *ppvObj = NULL;
@ -462,13 +483,13 @@ static HRESULT WINAPI IServiceProvider_fnQueryInterface(IServiceProvider *iface,
static ULONG WINAPI IServiceProvider_fnAddRef(IServiceProvider *iface) static ULONG WINAPI IServiceProvider_fnAddRef(IServiceProvider *iface)
{ {
IServiceProviderImpl *This = (IServiceProviderImpl*)iface; IServiceProviderImpl *This = impl_from_IServiceProvider(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI IServiceProvider_fnRelease(IServiceProvider *iface) static ULONG WINAPI IServiceProvider_fnRelease(IServiceProvider *iface)
{ {
IServiceProviderImpl *This = (IServiceProviderImpl*)iface; IServiceProviderImpl *This = impl_from_IServiceProvider(iface);
LONG ref = InterlockedDecrement(&This->ref); LONG ref = InterlockedDecrement(&This->ref);
if(!ref) if(!ref)
@ -482,7 +503,7 @@ static HRESULT WINAPI IServiceProvider_fnQueryService(IServiceProvider *iface,
REFIID riid, REFIID riid,
void **ppv) void **ppv)
{ {
IServiceProviderImpl *This = (IServiceProviderImpl*)iface; IServiceProviderImpl *This = impl_from_IServiceProvider(iface);
BOOL was_in_list = FALSE; BOOL was_in_list = FALSE;
IUnknown *punk = NULL; IUnknown *punk = NULL;
UINT i; UINT i;
@ -529,7 +550,7 @@ static const IServiceProviderVtbl spvtbl =
static IServiceProviderImpl *create_serviceprovider(void) static IServiceProviderImpl *create_serviceprovider(void)
{ {
IServiceProviderImpl *sp = HeapAlloc(GetProcessHeap(), 0, sizeof(IServiceProviderImpl)); IServiceProviderImpl *sp = HeapAlloc(GetProcessHeap(), 0, sizeof(IServiceProviderImpl));
sp->lpVtbl = &spvtbl; sp->IServiceProvider_iface.lpVtbl = &spvtbl;
sp->ref = 1; sp->ref = 1;
return sp; return sp;
} }
@ -932,7 +953,7 @@ static void test_SetSite(void)
{ {
spimpl->interfaces = expected; spimpl->interfaces = expected;
hr = IObjectWithSite_SetSite(pow, (IUnknown*)spimpl); hr = IObjectWithSite_SetSite(pow, (IUnknown*)&spimpl->IServiceProvider_iface);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
if(FAILED(hr)) if(FAILED(hr))
@ -943,9 +964,9 @@ static void test_SetSite(void)
{ {
skip("Failed to set site.\n"); skip("Failed to set site.\n");
IServiceProvider_Release((IServiceProvider*)spimpl); IServiceProvider_Release(&spimpl->IServiceProvider_iface);
ICommDlgBrowser3_Release((ICommDlgBrowser3*)cdbimpl); ICommDlgBrowser3_Release(&cdbimpl->ICommDlgBrowser3_iface);
IExplorerPaneVisibility_Release((IExplorerPaneVisibility*)epvimpl); IExplorerPaneVisibility_Release(&epvimpl->IExplorerPaneVisibility_iface);
IExplorerBrowser_Destroy(peb); IExplorerBrowser_Destroy(peb);
ref = IExplorerBrowser_Release(peb); ref = IExplorerBrowser_Release(peb);
ok(ref == 0, "Got ref %d\n", ref); ok(ref == 0, "Got ref %d\n", ref);
@ -993,40 +1014,40 @@ static void test_SetSite(void)
} }
/* Test when IServiceProvider is released. */ /* Test when IServiceProvider is released. */
IServiceProvider_AddRef((IServiceProvider*)spimpl); IServiceProvider_AddRef(&spimpl->IServiceProvider_iface);
ref = IServiceProvider_Release((IServiceProvider*)spimpl); ref = IServiceProvider_Release(&spimpl->IServiceProvider_iface);
ok(ref == 2, "Got ref %d\n", ref); ok(ref == 2, "Got ref %d\n", ref);
hr = IObjectWithSite_SetSite(pow, NULL); hr = IObjectWithSite_SetSite(pow, NULL);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
IServiceProvider_AddRef((IServiceProvider*)spimpl); IServiceProvider_AddRef(&spimpl->IServiceProvider_iface);
ref = IServiceProvider_Release((IServiceProvider*)spimpl); ref = IServiceProvider_Release(&spimpl->IServiceProvider_iface);
ok(ref == 1, "Got ref %d\n", ref); ok(ref == 1, "Got ref %d\n", ref);
hr = IObjectWithSite_SetSite(pow, (IUnknown*)spimpl); hr = IObjectWithSite_SetSite(pow, (IUnknown*)&spimpl->IServiceProvider_iface);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
IServiceProvider_AddRef((IServiceProvider*)spimpl); IServiceProvider_AddRef(&spimpl->IServiceProvider_iface);
ref = IServiceProvider_Release((IServiceProvider*)spimpl); ref = IServiceProvider_Release(&spimpl->IServiceProvider_iface);
ok(ref == 2, "Got ref %d\n", ref); ok(ref == 2, "Got ref %d\n", ref);
IExplorerBrowser_Destroy(peb); IExplorerBrowser_Destroy(peb);
IServiceProvider_AddRef((IServiceProvider*)spimpl); IServiceProvider_AddRef(&spimpl->IServiceProvider_iface);
ref = IServiceProvider_Release((IServiceProvider*)spimpl); ref = IServiceProvider_Release(&spimpl->IServiceProvider_iface);
ok(ref == 2, "Got ref %d\n", ref); ok(ref == 2, "Got ref %d\n", ref);
IObjectWithSite_Release(pow); IObjectWithSite_Release(pow);
ref = IExplorerBrowser_Release(peb); ref = IExplorerBrowser_Release(peb);
ok(ref == 0, "Got ref %d\n", ref); ok(ref == 0, "Got ref %d\n", ref);
ref = IServiceProvider_Release((IServiceProvider*)spimpl); ref = IServiceProvider_Release(&spimpl->IServiceProvider_iface);
ok(ref == 0, "Got ref %d\n", ref); ok(ref == 0, "Got ref %d\n", ref);
ref = ICommDlgBrowser3_Release((ICommDlgBrowser3*)cdbimpl); ref = ICommDlgBrowser3_Release(&cdbimpl->ICommDlgBrowser3_iface);
ok(ref == 0, "Got ref %d\n", ref); ok(ref == 0, "Got ref %d\n", ref);
ref = IExplorerPaneVisibility_Release((IExplorerPaneVisibility*)epvimpl); ref = IExplorerPaneVisibility_Release(&epvimpl->IExplorerPaneVisibility_iface);
ok(ref == 0, "Got ref %d\n", ref); ok(ref == 0, "Got ref %d\n", ref);
} }
@ -1171,8 +1192,8 @@ static void test_Advise(void)
UINT i, ref; UINT i, ref;
/* Set up our IExplorerBrowserEvents implementation */ /* Set up our IExplorerBrowserEvents implementation */
ebev.lpVtbl = &ebevents; ebev.IExplorerBrowserEvents_iface.lpVtbl = &ebevents;
pebe = (IExplorerBrowserEvents*) &ebev; pebe = &ebev.IExplorerBrowserEvents_iface;
ebrowser_instantiate(&peb); ebrowser_instantiate(&peb);
@ -1372,10 +1393,10 @@ static void test_navigation(void)
ebrowser_initialize(peb2); ebrowser_initialize(peb2);
/* Set up our IExplorerBrowserEvents implementation */ /* Set up our IExplorerBrowserEvents implementation */
ebev.lpVtbl = &ebevents; ebev.IExplorerBrowserEvents_iface.lpVtbl = &ebevents;
IExplorerBrowser_Advise(peb, (IExplorerBrowserEvents*)&ebev, &cookie); IExplorerBrowser_Advise(peb, &ebev.IExplorerBrowserEvents_iface, &cookie);
IExplorerBrowser_Advise(peb2, (IExplorerBrowserEvents*)&ebev, &cookie2); IExplorerBrowser_Advise(peb2, &ebev.IExplorerBrowserEvents_iface, &cookie2);
/* These should all fail */ /* These should all fail */
test_browse_pidl(peb, &ebev, 0, SBSP_ABSOLUTE | SBSP_RELATIVE, E_FAIL, 0, 0, 0, 0); test_browse_pidl(peb, &ebev, 0, SBSP_ABSOLUTE | SBSP_RELATIVE, E_FAIL, 0, 0, 0, 0);
@ -1487,7 +1508,7 @@ static void test_navigation(void)
/* Test some options that affect browsing */ /* Test some options that affect browsing */
ebrowser_instantiate(&peb); ebrowser_instantiate(&peb);
hr = IExplorerBrowser_Advise(peb, (IExplorerBrowserEvents*)&ebev, &cookie); hr = IExplorerBrowser_Advise(peb, &ebev.IExplorerBrowserEvents_iface, &cookie);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
hr = IExplorerBrowser_SetOptions(peb, EBO_NAVIGATEONCE); hr = IExplorerBrowser_SetOptions(peb, EBO_NAVIGATEONCE);
ok(hr == S_OK, "got (0x%08x)\n", hr); ok(hr == S_OK, "got (0x%08x)\n", hr);