-- v2: wshom.ocx: Implement WshNetwork2_Invoke. wshom.ocx: Implement WshNetwork2_GetIDsOfNames. wshom.ocx: Downgrade FIXME to WARN for unsupported interfaces.
From: Robert Wilhelm robert.wilhelm@gmx.net
Scripting always checks for DispatchEx interface before falling back to Dispatch. --- dlls/wshom.ocx/network.c | 16 +++++++++------- dlls/wshom.ocx/tests/wshom.c | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/wshom.ocx/network.c b/dlls/wshom.ocx/network.c index dcc52c02ed7..764a1d8b25a 100644 --- a/dlls/wshom.ocx/network.c +++ b/dlls/wshom.ocx/network.c @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#define COBJMACROS + +#include "dispex.h" #include "wshom_private.h" #include "wshom.h"
@@ -30,17 +33,16 @@ static HRESULT WINAPI WshNetwork2_QueryInterface(IWshNetwork2 *iface, REFIID rii if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDispatch) || IsEqualGUID(riid, &IID_IWshNetwork) || - IsEqualGUID(riid, &IID_IWshNetwork2)) - { + IsEqualGUID(riid, &IID_IWshNetwork2)) { *ppv = iface; - }else { - FIXME("Unknown iface %s\n", debugstr_guid(riid)); + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; + } + else { + WARN("interface not supported %s\n", debugstr_guid(riid)); *ppv = NULL; return E_NOINTERFACE; } - - IUnknown_AddRef((IUnknown*)*ppv); - return S_OK; }
static ULONG WINAPI WshNetwork2_AddRef(IWshNetwork2 *iface) diff --git a/dlls/wshom.ocx/tests/wshom.c b/dlls/wshom.ocx/tests/wshom.c index d84eb0441ff..5b3b7f81720 100644 --- a/dlls/wshom.ocx/tests/wshom.c +++ b/dlls/wshom.ocx/tests/wshom.c @@ -700,6 +700,8 @@ static void test_wshnetwork(void)
check_interface(disp, &IID_IWshNetwork, TRUE); check_interface(disp, &IID_IWshNetwork2, TRUE); + check_interface(disp, &IID_IDispatchEx, FALSE); + check_interface(disp, &IID_IObjectWithSite, FALSE);
IDispatch_Release(disp); }
From: Robert Wilhelm robert.wilhelm@gmx.net
--- dlls/wshom.ocx/network.c | 15 +++++++++++++-- dlls/wshom.ocx/wshom_main.c | 3 ++- dlls/wshom.ocx/wshom_private.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/wshom.ocx/network.c b/dlls/wshom.ocx/network.c index 764a1d8b25a..fc4e30040ea 100644 --- a/dlls/wshom.ocx/network.c +++ b/dlls/wshom.ocx/network.c @@ -74,8 +74,19 @@ static HRESULT WINAPI WshNetwork2_GetTypeInfo(IWshNetwork2 *iface, UINT iTInfo, static HRESULT WINAPI WshNetwork2_GetIDsOfNames(IWshNetwork2 *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { - FIXME("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); - return E_NOTIMPL; + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IWshNetwork2_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; }
static HRESULT WINAPI WshNetwork2_Invoke(IWshNetwork2 *iface, DISPID dispIdMember, REFIID riid, LCID lcid, diff --git a/dlls/wshom.ocx/wshom_main.c b/dlls/wshom.ocx/wshom_main.c index aed9f2dedf4..dda72f2796e 100644 --- a/dlls/wshom.ocx/wshom_main.c +++ b/dlls/wshom.ocx/wshom_main.c @@ -40,7 +40,8 @@ static REFIID tid_ids[] = { &IID_IWshEnvironment, &IID_IWshExec, &IID_IWshShell3, - &IID_IWshShortcut + &IID_IWshShortcut, + &IID_IWshNetwork2 };
static HRESULT load_typelib(void) diff --git a/dlls/wshom.ocx/wshom_private.h b/dlls/wshom.ocx/wshom_private.h index c2a66bf0610..709b8817342 100644 --- a/dlls/wshom.ocx/wshom_private.h +++ b/dlls/wshom.ocx/wshom_private.h @@ -33,6 +33,7 @@ typedef enum tid_t { IWshExec_tid, IWshShell3_tid, IWshShortcut_tid, + IWshNetwork2_tid, LAST_tid } tid_t;
From: Robert Wilhelm robert.wilhelm@gmx.net
--- dlls/wshom.ocx/network.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/wshom.ocx/network.c b/dlls/wshom.ocx/network.c index fc4e30040ea..c33f4347762 100644 --- a/dlls/wshom.ocx/network.c +++ b/dlls/wshom.ocx/network.c @@ -26,6 +26,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(wshom);
+static IWshNetwork2 WshNetwork2; + static HRESULT WINAPI WshNetwork2_QueryInterface(IWshNetwork2 *iface, REFIID riid, void **ppv) { TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), ppv); @@ -92,9 +94,21 @@ static HRESULT WINAPI WshNetwork2_GetIDsOfNames(IWshNetwork2 *iface, REFIID riid static HRESULT WINAPI WshNetwork2_Invoke(IWshNetwork2 *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { - FIXME("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid), + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - return E_NOTIMPL; + + hr = get_typeinfo(IWshNetwork2_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, &WshNetwork2, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; }
static HRESULT WINAPI WshNetwork2_get_UserDomain(IWshNetwork2 *iface, BSTR *user_domain)
On Fri Dec 2 05:06:06 2022 +0000, Nikolay Sivov wrote:
I think it's easier to make this a warning instead.
That is fine for me. I just updated my patchset to use warning. We are inconsistent about this. Some components check for DispatchEx and ObjectWithSite, some use warning as you suggested.
I would do it together with WshNetwork2_GetTypeInfo(), in a single patch. But it's not that important.
This merge request was approved by Nikolay Sivov.