Added hnetcfg-NATUPnP patchset

This commit is contained in:
Alistair Leslie-Hughes 2018-09-13 08:18:05 +10:00
parent 6587db3575
commit d4710fd098
7 changed files with 714 additions and 0 deletions

View File

@ -0,0 +1,256 @@
From dec395793651dfe805fcfb7e1443a2a57fcfb4b5 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 31 Aug 2018 15:22:03 +1000
Subject: [PATCH 1/5] include: Add natupnp.idl
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
include/Makefile.in | 1 +
include/natupnp.idl | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 224 insertions(+)
create mode 100644 include/natupnp.idl
diff --git a/include/Makefile.in b/include/Makefile.in
index ffecb98..741af54 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -453,6 +453,7 @@ SOURCES = \
msxmldid.h \
mtxdm.h \
multimon.h \
+ natupnp.idl \
nb30.h \
ncrypt.h \
ndrtypes.h \
diff --git a/include/natupnp.idl b/include/natupnp.idl
new file mode 100644
index 0000000..9dbccf2
--- /dev/null
+++ b/include/natupnp.idl
@@ -0,0 +1,223 @@
+/*
+ * Copyright 2018 Alistair Leslie-Hughes
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+import "oaidl.idl";
+import "ocidl.idl";
+
+#if !defined(progid) && !defined(__WIDL__)
+#define threading(model)
+#define progid(str)
+#define vi_progid(str)
+#endif
+
+[
+ object,
+ uuid(6F10711F-729B-41E5-93B8-F21D0F818DF1),
+ dual,
+ pointer_default(unique)
+]
+interface IStaticPortMapping : IDispatch
+{
+ [propget, id(1)]
+ HRESULT ExternalIPAddress ([out, retval] BSTR *value);
+
+ [propget, id(2)]
+ HRESULT ExternalPort([out, retval] long *value);
+
+ [propget, id(3)]
+ HRESULT InternalPort([out, retval] long *value);
+
+ [propget, id(4)]
+ HRESULT Protocol([out, retval] BSTR *value);
+
+ [propget, id(5)]
+ HRESULT InternalClient([out, retval] BSTR *value);
+
+ [propget, id(6)]
+ HRESULT Enabled([out, retval] VARIANT_BOOL *value);
+
+ [propget, id(7)]
+ HRESULT Description([out, retval] BSTR *value);
+
+ [id(8)]
+ HRESULT EditInternalClient ([in] BSTR client);
+
+ [id(9)]
+ HRESULT Enable ([in] VARIANT_BOOL enable);
+
+ [id(10)]
+ HRESULT EditDescription ([in] BSTR description);
+
+ [id(11)]
+ HRESULT EditInternalPort ([in] long port);
+};
+
+[
+ object,
+ uuid(cd1f3e77-66d6-4664-82c7-36dbb641d0f1),
+ dual,
+ pointer_default(unique)
+]
+interface IStaticPortMappingCollection : IDispatch
+{
+ [propget, id(DISPID_NEWENUM), hidden, restricted]
+ HRESULT _NewEnum([out, retval] IUnknown **value);
+
+ [propget, id(DISPID_VALUE)]
+ HRESULT Item([in] long port, [in] BSTR protocol, [out, retval] IStaticPortMapping **mapping);
+
+ [propget, id(1)]
+ HRESULT Count([out, retval] long *value);
+
+ [id(2)]
+ HRESULT Remove([in] long port, [in] BSTR protocol);
+
+ [id(3)]
+ HRESULT Add([in] long external, [in] BSTR protocol, [in] long internal, [in] BSTR client,
+ [in] VARIANT_BOOL enabled, [in] BSTR description, [out, retval] IStaticPortMapping **mapping);
+};
+
+[
+ object,
+ uuid(4FC80282-23B6-4378-9A27-CD8F17C9400C),
+ dual,
+ pointer_default(unique)
+]
+interface IDynamicPortMapping : IDispatch
+{
+ [propget, id(1)]
+ HRESULT ExternalIPAddress ([out, retval] BSTR *value);
+
+ [propget, id(2)]
+ HRESULT RemoteHost ([out, retval] BSTR *value);
+
+ [propget, id(3)]
+ HRESULT ExternalPort([out, retval] long *value);
+
+ [propget, id(4)]
+ HRESULT Protocol([out, retval] BSTR *value);
+
+ [propget, id(5)]
+ HRESULT InternalPort([out, retval] long *value);
+
+ [propget, id(6)]
+ HRESULT InternalClient([out, retval] BSTR *value);
+
+ [propget, id(7)]
+ HRESULT Enabled([out, retval] VARIANT_BOOL *value);
+
+ [propget, id(8)]
+ HRESULT Description([out, retval] BSTR *value);
+
+ [propget, id(9)]
+ HRESULT LeaseDuration([out, retval] long *value);
+
+ [id(10)]
+ HRESULT RenewLease([in] long desired, [out, retval] long *duration);
+
+ [id(11)]
+ HRESULT EditInternalClient ([in] BSTR client);
+
+ [id(12)]
+ HRESULT Enable ([in] VARIANT_BOOL enabled);
+
+ [id(13)]
+ HRESULT EditDescription ([in] BSTR description);
+
+ [id(14)]
+ HRESULT EditInternalPort ([in] long port);
+};
+
+[
+ object,
+ uuid(b60de00f-156e-4e8d-9ec1-3a2342c10899),
+ dual,
+ pointer_default(unique)
+]
+interface IDynamicPortMappingCollection : IDispatch
+{
+ [propget, id(DISPID_NEWENUM), hidden, restricted]
+ HRESULT _NewEnum([out, retval] IUnknown **value);
+
+ [propget, id(DISPID_VALUE)]
+ HRESULT Item([in] BSTR host, [in] long port, [in] BSTR orotocol,
+ [out, retval] IDynamicPortMapping **mapping);
+
+ [propget, id(1)]
+ HRESULT Count([out, retval] long *value);
+
+ [id(2)]
+ HRESULT Remove([in] BSTR host, [in] long port, [in] BSTR protocol);
+
+ [id(3)]
+ HRESULT Add([in] BSTR host, [in] long port, [in] BSTR protocol, [in] long internal,
+ [in] BSTR client, [in] VARIANT_BOOL enabled, [in] BSTR Description,
+ [in] long duration, [out, retval] IDynamicPortMapping **mapping);
+};
+
+[
+ object,
+ uuid(624bd588-9060-4109-b0b0-1adbbcac32df),
+ dual,
+ pointer_default(unique)
+]
+interface INATEventManager : IDispatch
+{
+ [id(1), propput]
+ HRESULT ExternalIPAddressCallback ([in] IUnknown *unk);
+
+ [id(2), propput]
+ HRESULT NumberOfEntriesCallback ([in] IUnknown *unk);
+};
+
+[
+ object,
+ uuid(b171c812-cc76-485a-94d8-b6b3a2794e99),
+ dual,
+ pointer_default(unique)
+]
+interface IUPnPNAT : IDispatch
+{
+ [propget, id(1)]
+ HRESULT StaticPortMappingCollection ([out, retval] IStaticPortMappingCollection **collection);
+
+ [propget, id(2)]
+ HRESULT DynamicPortMappingCollection ([out, retval] IDynamicPortMappingCollection **collection);
+
+ [propget, id(3)]
+ HRESULT NATEventManager ([out, retval] INATEventManager **manager);
+};
+
+[
+ uuid(1c565858-f302-471e-b409-f180aa4abec6),
+ version(1.0)
+]
+library NATUPNPLib
+{
+ importlib("stdole2.tlb");
+
+ [
+ vi_progid("HNetCfg.NATUPnP"),
+ progid("HNetCfg.NATUPnP.1"),
+ threading(both),
+ uuid(ae1e00aa-3fd5-403c-8a27-2bbdc30cd0e1)
+ ]
+ coclass UPnPNAT
+ {
+ [default] interface IUPnPNAT;
+ };
+};
--
1.9.1

View File

@ -0,0 +1,22 @@
From 3b4f9505365d6803c0205c6f16f19a15bf0cc24d Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 31 Aug 2018 15:32:13 +1000
Subject: [PATCH 2/5] hnetcfg: Register NATUPnP interface
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/hnetcfg_tlb.idl | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlls/hnetcfg/hnetcfg_tlb.idl b/dlls/hnetcfg/hnetcfg_tlb.idl
index 33e8cc8..e368fe6 100644
--- a/dlls/hnetcfg/hnetcfg_tlb.idl
+++ b/dlls/hnetcfg/hnetcfg_tlb.idl
@@ -21,3 +21,4 @@
#pragma makedep regtypelib
#include "netfw.idl"
+#include "natupnp.idl"
--
1.9.1

View File

@ -0,0 +1,284 @@
From 12fda22718f88a772f8b389f7d85b79c91795552 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 3 Sep 2018 10:59:18 +1000
Subject: [PATCH 3/5] hnetcfg: Support IUPnPNAT interface
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=34711
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/apps.c | 4 +-
dlls/hnetcfg/hnetcfg.c | 7 ++
dlls/hnetcfg/hnetcfg_private.h | 2 +
dlls/hnetcfg/manager.c | 1 +
dlls/hnetcfg/port.c | 167 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 180 insertions(+), 1 deletion(-)
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index e671e8c..9972468 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -27,6 +27,7 @@
#include "winuser.h"
#include "ole2.h"
#include "netfw.h"
+#include "natupnp.h"
#include "wine/debug.h"
#include "wine/heap.h"
@@ -115,7 +116,8 @@ static REFIID tid_id[] =
&IID_INetFwOpenPorts,
&IID_INetFwPolicy,
&IID_INetFwPolicy2,
- &IID_INetFwProfile
+ &IID_INetFwProfile,
+ &IID_IUPnPNAT
};
HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
diff --git a/dlls/hnetcfg/hnetcfg.c b/dlls/hnetcfg/hnetcfg.c
index e56dbab..5cc24a1 100644
--- a/dlls/hnetcfg/hnetcfg.c
+++ b/dlls/hnetcfg/hnetcfg.c
@@ -25,6 +25,7 @@
#include "objbase.h"
#include "rpcproxy.h"
#include "netfw.h"
+#include "natupnp.h"
#include "wine/debug.h"
#include "hnetcfg_private.h"
@@ -114,6 +115,8 @@ static hnetcfg_cf fw_manager_cf = { { &hnetcfg_cf_vtbl }, NetFwMgr_create };
static hnetcfg_cf fw_app_cf = { { &hnetcfg_cf_vtbl }, NetFwAuthorizedApplication_create };
static hnetcfg_cf fw_openport_cf = { { &hnetcfg_cf_vtbl }, NetFwOpenPort_create };
static hnetcfg_cf fw_policy2_cf = { { &hnetcfg_cf_vtbl }, NetFwPolicy2_create };
+static hnetcfg_cf upnpnat_cf = { { &hnetcfg_cf_vtbl }, IUPnPNAT_create };
+
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID reserved)
{
@@ -156,6 +159,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv )
{
cf = &fw_policy2_cf.IClassFactory_iface;
}
+ else if (IsEqualGUID( rclsid, &CLSID_UPnPNAT ))
+ {
+ cf = &upnpnat_cf.IClassFactory_iface;
+ }
if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
return IClassFactory_QueryInterface( cf, iid, ppv );
diff --git a/dlls/hnetcfg/hnetcfg_private.h b/dlls/hnetcfg/hnetcfg_private.h
index 5245883..be2d0f3 100644
--- a/dlls/hnetcfg/hnetcfg_private.h
+++ b/dlls/hnetcfg/hnetcfg_private.h
@@ -27,6 +27,7 @@ enum type_id
INetFwPolicy2_tid,
INetFwProfile_tid,
INetFwRules_tid,
+ IUPnPNAT_tid,
last_tid
};
@@ -42,3 +43,4 @@ HRESULT NetFwAuthorizedApplications_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN
HRESULT NetFwOpenPorts_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT NetFwOpenPort_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT NetFwServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
+HRESULT IUPnPNAT_create(IUnknown *, void **) DECLSPEC_HIDDEN;
diff --git a/dlls/hnetcfg/manager.c b/dlls/hnetcfg/manager.c
index 1d548b4..d3f089e 100644
--- a/dlls/hnetcfg/manager.c
+++ b/dlls/hnetcfg/manager.c
@@ -28,6 +28,7 @@
#include "initguid.h"
#include "ole2.h"
#include "netfw.h"
+#include "natupnp.h"
#include "wine/debug.h"
#include "wine/unicode.h"
diff --git a/dlls/hnetcfg/port.c b/dlls/hnetcfg/port.c
index 7d74965..f497bcb 100644
--- a/dlls/hnetcfg/port.c
+++ b/dlls/hnetcfg/port.c
@@ -27,7 +27,9 @@
#include "winuser.h"
#include "ole2.h"
#include "netfw.h"
+#include "natupnp.h"
+#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "hnetcfg_private.h"
@@ -603,3 +605,168 @@ HRESULT NetFwOpenPorts_create( IUnknown *pUnkOuter, LPVOID *ppObj )
TRACE("returning iface %p\n", *ppObj);
return S_OK;
}
+
+typedef struct _upnpnat
+{
+ IUPnPNAT IUPnPNAT_iface;
+ LONG ref;
+} upnpnat;
+
+static inline upnpnat *impl_from_IUPnPNAT( IUPnPNAT *iface )
+{
+ return CONTAINING_RECORD(iface, upnpnat, IUPnPNAT_iface);
+}
+
+static HRESULT WINAPI upnpnat_QueryInterface(IUPnPNAT *iface, REFIID riid, void **object)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+
+ TRACE("%p %s %p\n", This, debugstr_guid( riid ), object );
+
+ if ( IsEqualGUID( riid, &IID_IUPnPNAT ) ||
+ IsEqualGUID( riid, &IID_IDispatch ) ||
+ IsEqualGUID( riid, &IID_IUnknown ) )
+ {
+ *object = iface;
+ }
+ else
+ {
+ FIXME("interface %s not implemented\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
+ }
+ IUPnPNAT_AddRef( iface );
+ return S_OK;
+}
+
+static ULONG WINAPI upnpnat_AddRef(IUPnPNAT *iface)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ return InterlockedIncrement( &This->ref );
+}
+
+static ULONG WINAPI upnpnat_Release(IUPnPNAT *iface)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ LONG refs = InterlockedDecrement( &This->ref );
+ if (!refs)
+ {
+ heap_free( This );
+ }
+ return refs;
+}
+
+static HRESULT WINAPI upnpnat_GetTypeInfoCount(IUPnPNAT *iface, UINT *pctinfo)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+
+ TRACE("%p %p\n", This, pctinfo);
+ *pctinfo = 1;
+ return S_OK;
+}
+
+static HRESULT WINAPI upnpnat_GetTypeInfo(IUPnPNAT *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+
+ TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
+ return get_typeinfo( IUPnPNAT_tid, ppTInfo );
+}
+
+static HRESULT WINAPI upnpnat_GetIDsOfNames(IUPnPNAT *iface, REFIID riid, LPOLESTR *rgszNames,
+ UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
+
+ hr = get_typeinfo( IUPnPNAT_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI upnpnat_Invoke(IUPnPNAT *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
+ WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
+ lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+
+ hr = get_typeinfo( IUPnPNAT_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_Invoke( typeinfo, &This->IUPnPNAT_iface, dispIdMember,
+ wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI upnpnat_get_StaticPortMappingCollection(IUPnPNAT *iface, IStaticPortMappingCollection **collection)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ FIXME("%p, %p\n", This, collection);
+ if(collection)
+ *collection = NULL;
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI upnpnat_get_DynamicPortMappingCollection(IUPnPNAT *iface, IDynamicPortMappingCollection **collection)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ FIXME("%p, %p\n", This, collection);
+ if(collection)
+ *collection = NULL;
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI upnpnat_get_NATEventManager(IUPnPNAT *iface, INATEventManager **manager)
+{
+ upnpnat *This = impl_from_IUPnPNAT( iface );
+ FIXME("%p, %p\n", This, manager);
+ if(manager)
+ *manager = NULL;
+ return E_NOTIMPL;
+}
+
+const static IUPnPNATVtbl upnpnat_vtbl =
+{
+ upnpnat_QueryInterface,
+ upnpnat_AddRef,
+ upnpnat_Release,
+ upnpnat_GetTypeInfoCount,
+ upnpnat_GetTypeInfo,
+ upnpnat_GetIDsOfNames,
+ upnpnat_Invoke,
+ upnpnat_get_StaticPortMappingCollection,
+ upnpnat_get_DynamicPortMappingCollection,
+ upnpnat_get_NATEventManager
+};
+
+
+HRESULT IUPnPNAT_create(IUnknown *outer, void **object)
+{
+ upnpnat *nat;
+
+ TRACE("(%p,%p)\n", outer, object);
+
+ nat = heap_alloc( sizeof(*nat) );
+ if (!nat) return E_OUTOFMEMORY;
+
+ nat->IUPnPNAT_iface.lpVtbl = &upnpnat_vtbl;
+ nat->ref = 1;
+
+ *object = &nat->IUPnPNAT_iface;
+
+ TRACE("returning iface %p\n", *object);
+ return S_OK;
+}
--
1.9.1

View File

@ -0,0 +1,53 @@
From 33ff7bd1532ee29512f289d8d07c53fe7583c27c Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 3 Sep 2018 11:20:03 +1000
Subject: [PATCH 4/5] hnetcfg: Linked to uuid
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/Makefile.in | 2 +-
dlls/hnetcfg/manager.c | 2 --
dlls/uuid/uuid.c | 1 +
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/hnetcfg/Makefile.in b/dlls/hnetcfg/Makefile.in
index 44c9cb5..e4960ab 100644
--- a/dlls/hnetcfg/Makefile.in
+++ b/dlls/hnetcfg/Makefile.in
@@ -1,5 +1,5 @@
MODULE = hnetcfg.dll
-IMPORTS = oleaut32 ole32 advapi32 mpr
+IMPORTS = oleaut32 ole32 advapi32 mpr uuid
C_SRCS = \
apps.c \
diff --git a/dlls/hnetcfg/manager.c b/dlls/hnetcfg/manager.c
index d3f089e..2d89479 100644
--- a/dlls/hnetcfg/manager.c
+++ b/dlls/hnetcfg/manager.c
@@ -25,10 +25,8 @@
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
-#include "initguid.h"
#include "ole2.h"
#include "netfw.h"
-#include "natupnp.h"
#include "wine/debug.h"
#include "wine/unicode.h"
diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c
index 913e99c..aa3b30c 100644
--- a/dlls/uuid/uuid.c
+++ b/dlls/uuid/uuid.c
@@ -79,6 +79,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
#include "perhist.h"
#include "netcon.h"
#include "netfw.h"
+#include "natupnp.h"
#include "msctf.h"
#include "sensevts.h"
#include "ocmm.h"
--
1.9.1

View File

@ -0,0 +1,69 @@
From e9fe08455e3545e0781fd86ce0688e1eb53ef2f7 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 7 Sep 2018 14:40:06 +1000
Subject: [PATCH 5/5] hnetcfg/tests: Add IUPnPNAT interface tests
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/hnetcfg/tests/policy.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index 208f583..61175f9 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -27,6 +27,7 @@
#include "wine/test.h"
#include "netfw.h"
+#include "natupnp.h"
static void test_policy2_rules(INetFwPolicy2 *policy2)
{
@@ -160,6 +161,35 @@ static void test_NetFwAuthorizedApplication(void)
INetFwAuthorizedApplication_Release(app);
}
+static void test_IUPnPNAT(void)
+{
+ IUPnPNAT *nat;
+ IStaticPortMappingCollection *static_ports;
+ IDynamicPortMappingCollection *dync_ports;
+ INATEventManager *manager;
+ HRESULT hr;
+
+ hr = CoCreateInstance(&CLSID_UPnPNAT, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IUPnPNAT, (void**)&nat);
+ ok(hr == S_OK, "got: %08x\n", hr);
+
+ hr = IUPnPNAT_get_StaticPortMappingCollection(nat, &static_ports);
+ todo_wine ok(hr == S_OK, "got: %08x\n", hr);
+ if(hr == S_OK && static_ports)
+ IStaticPortMappingCollection_Release(static_ports);
+
+ hr = IUPnPNAT_get_DynamicPortMappingCollection(nat, &dync_ports);
+ ok(hr == S_OK || hr == E_NOTIMPL /* Windows 8.1 */, "got: %08x\n", hr);
+ if(hr == S_OK && dync_ports)
+ IDynamicPortMappingCollection_Release(dync_ports);
+
+ hr = IUPnPNAT_get_NATEventManager(nat, &manager);
+ todo_wine ok(hr == S_OK, "got: %08x\n", hr);
+ if(hr == S_OK && manager)
+ INATEventManager_Release(manager);
+
+ IUPnPNAT_Release(nat);
+}
+
START_TEST(policy)
{
INetFwMgr *manager;
@@ -180,6 +210,7 @@ START_TEST(policy)
test_interfaces();
test_NetFwAuthorizedApplication();
+ test_IUPnPNAT();
CoUninitialize();
}
--
1.9.1

View File

@ -0,0 +1 @@
Fixes: [34711] hnetcfg: Add Support for interface UPnPNAT

View File

@ -152,6 +152,7 @@ patch_enable_all ()
enable_gdi32_Path_Metafile="$1"
enable_gdi32_Symbol_Truetype_Font="$1"
enable_gdiplus_Performance_Improvements="$1"
enable_hnetcfg_NATUPnP="$1"
enable_imagehlp_BindImageEx="$1"
enable_imagehlp_Cleanup="$1"
enable_imagehlp_ImageLoad="$1"
@ -627,6 +628,9 @@ patch_enable ()
gdiplus-Performance-Improvements)
enable_gdiplus_Performance_Improvements="$2"
;;
hnetcfg-NATUPnP)
enable_hnetcfg_NATUPnP="$2"
;;
imagehlp-BindImageEx)
enable_imagehlp_BindImageEx="$2"
;;
@ -3801,6 +3805,31 @@ if test "$enable_gdiplus_Performance_Improvements" -eq 1; then
) >> "$patchlist"
fi
# Patchset hnetcfg-NATUPnP
# |
# | This patchset fixes the following Wine bugs:
# | * [#34711] hnetcfg: Add Support for interface UPnPNAT
# |
# | Modified files:
# | * dlls/hnetcfg/Makefile.in, dlls/hnetcfg/apps.c, dlls/hnetcfg/hnetcfg.c, dlls/hnetcfg/hnetcfg_private.h,
# | dlls/hnetcfg/hnetcfg_tlb.idl, dlls/hnetcfg/manager.c, dlls/hnetcfg/port.c, dlls/hnetcfg/tests/policy.c,
# | dlls/uuid/uuid.c, include/Makefile.in, include/natupnp.idl
# |
if test "$enable_hnetcfg_NATUPnP" -eq 1; then
patch_apply hnetcfg-NATUPnP/0001-include-Add-natupnp.idl.patch
patch_apply hnetcfg-NATUPnP/0002-hnetcfg-Register-NATUPnP-interface.patch
patch_apply hnetcfg-NATUPnP/0003-hnetcfg-Support-IUPnPNAT-interface.patch
patch_apply hnetcfg-NATUPnP/0004-hnetcfg-Linked-to-uuid.patch
patch_apply hnetcfg-NATUPnP/0005-hnetcfg-tests-Add-IUPnPNAT-interface-tests.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "include: Add natupnp.idl.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg: Register NATUPnP interface.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg: Support IUPnPNAT interface.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg: Linked to uuid.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "hnetcfg/tests: Add IUPnPNAT interface tests.", 1 },';
) >> "$patchlist"
fi
# Patchset imagehlp-BindImageEx
# |
# | This patchset fixes the following Wine bugs: