comdlg32: Use proper helpers for iface calls.

This commit is contained in:
Jacek Caban 2012-08-16 13:19:27 +02:00 committed by Alexandre Julliard
parent 7839d134e9
commit e5e2673984
3 changed files with 20 additions and 24 deletions

View File

@ -226,26 +226,22 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ if(IsEqualIID(riid, &IID_IUnknown))
{ *ppvObj = This; *ppvObj = &This->IShellBrowser_iface;
} else if(IsEqualIID(riid, &IID_IOleWindow))
else if(IsEqualIID(riid, &IID_IOleWindow)) /*IOleWindow*/ *ppvObj = &This->IShellBrowser_iface;
{ *ppvObj = This; else if(IsEqualIID(riid, &IID_IShellBrowser))
} *ppvObj = &This->IShellBrowser_iface;
else if(IsEqualIID(riid, &IID_ICommDlgBrowser))
else if(IsEqualIID(riid, &IID_IShellBrowser)) /*IShellBrowser*/
{ *ppvObj = This;
}
else if(IsEqualIID(riid, &IID_ICommDlgBrowser)) /*ICommDlgBrowser*/
*ppvObj = &This->ICommDlgBrowser_iface; *ppvObj = &This->ICommDlgBrowser_iface;
else if(IsEqualIID(riid, &IID_IServiceProvider)) /* IServiceProvider */ else if(IsEqualIID(riid, &IID_IServiceProvider))
*ppvObj = &This->IServiceProvider_iface; *ppvObj = &This->IServiceProvider_iface;
if(*ppvObj) if(*ppvObj) {
{ IUnknown_AddRef( (IShellBrowser*) *ppvObj); IUnknown_AddRef((IUnknown*)*ppvObj);
return S_OK; return S_OK;
} }
FIXME("Unknown interface requested\n"); FIXME("Unknown interface requested\n");
return E_NOINTERFACE; return E_NOINTERFACE;
} }

View File

@ -506,7 +506,7 @@ static HRESULT on_default_action(FileDialogImpl *This)
pidla[i] = COMDLG32_SHSimpleIDListFromPathAW(canon_filename); pidla[i] = COMDLG32_SHSimpleIDListFromPathAW(canon_filename);
if(psf_parent && !(open_action == ONOPEN_BROWSE)) if(psf_parent && !(open_action == ONOPEN_BROWSE))
IShellItem_Release(psf_parent); IShellFolder_Release(psf_parent);
fn_iter += (WCHAR)lstrlenW(fn_iter) + 1; fn_iter += (WCHAR)lstrlenW(fn_iter) + 1;
} }
@ -528,7 +528,7 @@ static HRESULT on_default_action(FileDialogImpl *This)
if(FAILED(hr)) if(FAILED(hr))
ERR("Failed to browse to directory: %08x\n", hr); ERR("Failed to browse to directory: %08x\n", hr);
IShellItem_Release(psf_parent); IShellFolder_Release(psf_parent);
break; break;
case ONOPEN_OPEN: case ONOPEN_OPEN:

View File

@ -369,7 +369,7 @@ static BOOL test_instantiation(void)
hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialogEvents, (void**)&punk); hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialogEvents, (void**)&punk);
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr); ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(pfd); if(SUCCEEDED(hr)) IFileDialog_Release(pfd);
hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IExplorerBrowser, (void**)&punk); hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IExplorerBrowser, (void**)&punk);
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr); ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
@ -379,7 +379,7 @@ static BOOL test_instantiation(void)
ok(hr == S_OK, "got 0x%08x.\n", hr); ok(hr == S_OK, "got 0x%08x.\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk); if(SUCCEEDED(hr)) IUnknown_Release(punk);
hr = IFileOpenDialog_QueryInterface(pfsd, &IID_ICommDlgBrowser3, (void**)&punk); hr = IFileSaveDialog_QueryInterface(pfsd, &IID_ICommDlgBrowser3, (void**)&punk);
ok(hr == S_OK, "got 0x%08x.\n", hr); ok(hr == S_OK, "got 0x%08x.\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk); if(SUCCEEDED(hr)) IUnknown_Release(punk);
@ -1378,7 +1378,7 @@ static void test_customize(void)
&IID_IFileDialog, (void**)&pfod); &IID_IFileDialog, (void**)&pfod);
ok(hr == S_OK, "got 0x%08x.\n", hr); ok(hr == S_OK, "got 0x%08x.\n", hr);
hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc); hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
ok(hr == S_OK, "got 0x%08x.\n", hr); ok(hr == S_OK, "got 0x%08x.\n", hr);
if(FAILED(hr)) if(FAILED(hr))
{ {
@ -1666,7 +1666,7 @@ static void test_customize(void)
IFileDialogEvents_Release(pfde); IFileDialogEvents_Release(pfde);
IFileDialogCustomize_Release(pfdc); IFileDialogCustomize_Release(pfdc);
ref = IFileOpenDialog_Release(pfod); ref = IFileDialog_Release(pfod);
ok(!ref, "Refcount not zero (%d).\n", ref); ok(!ref, "Refcount not zero (%d).\n", ref);
@ -1674,7 +1674,7 @@ static void test_customize(void)
&IID_IFileDialog, (void**)&pfod); &IID_IFileDialog, (void**)&pfod);
ok(hr == S_OK, "got 0x%08x.\n", hr); ok(hr == S_OK, "got 0x%08x.\n", hr);
hr = IFileDialogCustomize_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc); hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
ok(hr == S_OK, "got 0x%08x.\n", hr); ok(hr == S_OK, "got 0x%08x.\n", hr);
i = 0; i = 0;
@ -1884,7 +1884,7 @@ static void test_customize(void)
} }
IFileDialogCustomize_Release(pfdc); IFileDialogCustomize_Release(pfdc);
ref = IFileOpenDialog_Release(pfod); ref = IFileDialog_Release(pfod);
ok(!ref, "Refcount not zero (%d).\n", ref); ok(!ref, "Refcount not zero (%d).\n", ref);
} }