explorerframe: Internally make calls with interface wrappers.

This commit is contained in:
Nikolay Sivov 2014-06-11 08:58:40 +04:00 committed by Alexandre Julliard
parent 3d691afd97
commit ad4ccd1821
2 changed files with 31 additions and 20 deletions

View File

@ -1056,7 +1056,7 @@ static HRESULT WINAPI NSTC2_fnAppendRoot(INameSpaceTreeControl2* iface,
root_count = list_count(&This->roots); root_count = list_count(&This->roots);
return NSTC2_fnInsertRoot(iface, root_count, psiRoot, grfEnumFlags, grfRootStyle, pif); return INameSpaceTreeControl2_InsertRoot(iface, root_count, psiRoot, grfEnumFlags, grfRootStyle, pif);
} }
static HRESULT WINAPI NSTC2_fnRemoveRoot(INameSpaceTreeControl2* iface, static HRESULT WINAPI NSTC2_fnRemoveRoot(INameSpaceTreeControl2* iface,
@ -1101,19 +1101,16 @@ static HRESULT WINAPI NSTC2_fnRemoveAllRoots(INameSpaceTreeControl2* iface)
{ {
NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface); NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
nstc_root *cur1, *cur2; nstc_root *cur1, *cur2;
UINT removed = 0;
TRACE("%p\n", This); TRACE("%p\n", This);
LIST_FOR_EACH_ENTRY_SAFE(cur1, cur2, &This->roots, nstc_root, entry) if (list_empty(&This->roots))
{
NSTC2_fnRemoveRoot(iface, cur1->psi);
removed++;
}
if(removed)
return S_OK;
else
return E_INVALIDARG; return E_INVALIDARG;
LIST_FOR_EACH_ENTRY_SAFE(cur1, cur2, &This->roots, nstc_root, entry)
INameSpaceTreeControl2_RemoveRoot(iface, cur1->psi);
return S_OK;
} }
static HRESULT WINAPI NSTC2_fnGetRootItems(INameSpaceTreeControl2* iface, static HRESULT WINAPI NSTC2_fnGetRootItems(INameSpaceTreeControl2* iface,
@ -1253,7 +1250,7 @@ static HRESULT WINAPI NSTC2_fnGetSelectedItems(INameSpaceTreeControl2* iface,
{ {
NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface); NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
IShellItem *psiselected; IShellItem *psiselected;
HRESULT hr;
TRACE("%p (%p)\n", This, psiaItems); TRACE("%p (%p)\n", This, psiaItems);
psiselected = get_selected_shellitem(This); psiselected = get_selected_shellitem(This);
@ -1263,9 +1260,8 @@ static HRESULT WINAPI NSTC2_fnGetSelectedItems(INameSpaceTreeControl2* iface,
return E_FAIL; return E_FAIL;
} }
hr = SHCreateShellItemArrayFromShellItem(psiselected, &IID_IShellItemArray, return SHCreateShellItemArrayFromShellItem(psiselected, &IID_IShellItemArray,
(void**)psiaItems); (void**)psiaItems);
return hr;
} }
static HRESULT WINAPI NSTC2_fnGetItemCustomState(INameSpaceTreeControl2* iface, static HRESULT WINAPI NSTC2_fnGetItemCustomState(INameSpaceTreeControl2* iface,
@ -1553,22 +1549,19 @@ static const INameSpaceTreeControl2Vtbl vt_INameSpaceTreeControl2 = {
static HRESULT WINAPI IOW_fnQueryInterface(IOleWindow *iface, REFIID riid, void **ppvObject) static HRESULT WINAPI IOW_fnQueryInterface(IOleWindow *iface, REFIID riid, void **ppvObject)
{ {
NSTC2Impl *This = impl_from_IOleWindow(iface); NSTC2Impl *This = impl_from_IOleWindow(iface);
TRACE("%p\n", This); return INameSpaceTreeControl2_QueryInterface(&This->INameSpaceTreeControl2_iface, riid, ppvObject);
return NSTC2_fnQueryInterface(&This->INameSpaceTreeControl2_iface, riid, ppvObject);
} }
static ULONG WINAPI IOW_fnAddRef(IOleWindow *iface) static ULONG WINAPI IOW_fnAddRef(IOleWindow *iface)
{ {
NSTC2Impl *This = impl_from_IOleWindow(iface); NSTC2Impl *This = impl_from_IOleWindow(iface);
TRACE("%p\n", This); return INameSpaceTreeControl2_AddRef(&This->INameSpaceTreeControl2_iface);
return NSTC2_fnAddRef(&This->INameSpaceTreeControl2_iface);
} }
static ULONG WINAPI IOW_fnRelease(IOleWindow *iface) static ULONG WINAPI IOW_fnRelease(IOleWindow *iface)
{ {
NSTC2Impl *This = impl_from_IOleWindow(iface); NSTC2Impl *This = impl_from_IOleWindow(iface);
TRACE("%p\n", This); return INameSpaceTreeControl2_Release(&This->INameSpaceTreeControl2_iface);
return NSTC2_fnRelease(&This->INameSpaceTreeControl2_iface);
} }
static HRESULT WINAPI IOW_fnGetWindow(IOleWindow *iface, HWND *phwnd) static HRESULT WINAPI IOW_fnGetWindow(IOleWindow *iface, HWND *phwnd)
@ -1612,6 +1605,9 @@ HRESULT NamespaceTreeControl_Constructor(IUnknown *pUnkOuter, REFIID riid, void
EFRAME_LockModule(); EFRAME_LockModule();
nstc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NSTC2Impl)); nstc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NSTC2Impl));
if (!nstc)
return E_OUTOFMEMORY;
nstc->ref = 1; nstc->ref = 1;
nstc->INameSpaceTreeControl2_iface.lpVtbl = &vt_INameSpaceTreeControl2; nstc->INameSpaceTreeControl2_iface.lpVtbl = &vt_INameSpaceTreeControl2;
nstc->IOleWindow_iface.lpVtbl = &vt_IOleWindow; nstc->IOleWindow_iface.lpVtbl = &vt_IOleWindow;

View File

@ -1170,6 +1170,11 @@ static void test_basics(void)
hr = INameSpaceTreeControl_InsertRoot(pnstc, 5, psidesktop, 0, 0, NULL); hr = INameSpaceTreeControl_InsertRoot(pnstc, 5, psidesktop, 0, 0, NULL);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
roots[0] = psitestdir2;
roots[1] = psidesktop;
roots[2] = psidesktop2;
roots[3] = psitestdir;
roots[4] = psitestdir2;
roots[5] = psidesktop; roots[5] = psidesktop;
roots[6] = NULL; roots[6] = NULL;
verify_root_order(pnstc, roots); verify_root_order(pnstc, roots);
@ -1177,6 +1182,9 @@ static void test_basics(void)
hr = INameSpaceTreeControl_InsertRoot(pnstc, 3, psitestdir2, 0, 0, NULL); hr = INameSpaceTreeControl_InsertRoot(pnstc, 3, psitestdir2, 0, 0, NULL);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
roots[0] = psitestdir2;
roots[1] = psidesktop;
roots[2] = psidesktop2;
roots[3] = psitestdir2; roots[3] = psitestdir2;
roots[4] = psitestdir; roots[4] = psitestdir;
roots[5] = psitestdir2; roots[5] = psitestdir2;
@ -1187,6 +1195,13 @@ static void test_basics(void)
hr = INameSpaceTreeControl_AppendRoot(pnstc, psitestdir2, 0, 0, NULL); hr = INameSpaceTreeControl_AppendRoot(pnstc, psitestdir2, 0, 0, NULL);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
roots[0] = psitestdir2;
roots[1] = psidesktop;
roots[2] = psidesktop2;
roots[3] = psitestdir2;
roots[4] = psitestdir;
roots[5] = psitestdir2;
roots[6] = psidesktop;
roots[7] = psitestdir2; roots[7] = psitestdir2;
roots[8] = NULL; roots[8] = NULL;
verify_root_order(pnstc, roots); verify_root_order(pnstc, roots);