2016-07-22 09:47:27 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2016 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
|
|
|
|
*/
|
|
|
|
#define COBJMACROS
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "windows.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "oleauto.h"
|
|
|
|
#include "olectl.h"
|
|
|
|
#include "dispex.h"
|
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
#include "netfw.h"
|
2018-10-15 01:27:09 +02:00
|
|
|
#include "natupnp.h"
|
2016-07-22 09:47:27 +02:00
|
|
|
|
2022-02-01 11:49:20 +01:00
|
|
|
static ULONG get_refcount(IUnknown *unk)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef(unk);
|
|
|
|
return IUnknown_Release(unk);
|
|
|
|
}
|
|
|
|
|
2017-09-26 00:43:37 +02:00
|
|
|
static void test_policy2_rules(INetFwPolicy2 *policy2)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
INetFwRules *rules, *rules2;
|
|
|
|
INetFwServiceRestriction *restriction;
|
|
|
|
|
|
|
|
hr = INetFwPolicy2_QueryInterface(policy2, &IID_INetFwRules, (void**)&rules);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got 0x%08lx\n", hr);
|
2017-09-26 00:43:37 +02:00
|
|
|
|
|
|
|
hr = INetFwPolicy2_get_Rules(policy2, &rules);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2017-09-26 00:43:37 +02:00
|
|
|
|
|
|
|
hr = INetFwPolicy2_get_Rules(policy2, &rules2);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2017-09-26 00:43:37 +02:00
|
|
|
ok(rules == rules2, "Different pointers\n");
|
|
|
|
|
|
|
|
hr = INetFwPolicy2_get_ServiceRestriction(policy2, &restriction);
|
2022-02-28 08:26:14 +01:00
|
|
|
todo_wine ok(hr == S_OK, "got %08lx\n", hr);
|
2017-09-26 00:43:37 +02:00
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
|
|
|
INetFwRules *rules3;
|
|
|
|
|
|
|
|
hr = INetFwServiceRestriction_get_Rules(restriction, &rules3);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got %08lx\n", hr);
|
2017-09-26 00:43:37 +02:00
|
|
|
ok(rules != rules3, "same pointers\n");
|
|
|
|
|
|
|
|
if(rules3)
|
|
|
|
INetFwRules_Release(rules3);
|
|
|
|
INetFwServiceRestriction_Release(restriction);
|
|
|
|
}
|
|
|
|
|
2019-03-26 17:04:44 +01:00
|
|
|
hr = INetFwRules_get__NewEnum(rules, NULL);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_POINTER, "got %08lx\n", hr);
|
2019-03-26 17:04:44 +01:00
|
|
|
|
2017-09-26 00:43:37 +02:00
|
|
|
INetFwRules_Release(rules);
|
|
|
|
INetFwRules_Release(rules2);
|
|
|
|
}
|
|
|
|
|
2016-07-22 09:47:27 +02:00
|
|
|
static void test_interfaces(void)
|
|
|
|
{
|
|
|
|
INetFwMgr *manager;
|
|
|
|
INetFwPolicy *policy;
|
|
|
|
INetFwPolicy2 *policy2;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
|
|
&IID_INetFwMgr, (void**)&manager);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "NetFwMgr create failed: %08lx\n", hr);
|
2016-07-22 09:47:27 +02:00
|
|
|
|
|
|
|
hr = INetFwMgr_QueryInterface(manager, &IID_INetFwPolicy, (void**)&policy);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got 0x%08lx\n", hr);
|
2016-07-22 09:47:27 +02:00
|
|
|
|
|
|
|
hr = INetFwMgr_QueryInterface(manager, &IID_INetFwPolicy2, (void**)&policy2);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got 0x%08lx\n", hr);
|
2016-07-22 09:47:27 +02:00
|
|
|
|
|
|
|
hr = INetFwMgr_get_LocalPolicy(manager, &policy);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got 0x%08lx\n", hr);
|
2016-07-22 09:47:27 +02:00
|
|
|
|
|
|
|
hr = INetFwPolicy_QueryInterface(policy, &IID_INetFwPolicy2, (void**)&policy2);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got 0x%08lx\n", hr);
|
2016-07-22 09:47:27 +02:00
|
|
|
|
|
|
|
INetFwPolicy_Release(policy);
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_NetFwPolicy2, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
|
|
&IID_INetFwPolicy2, (void**)&policy2);
|
|
|
|
if(hr == S_OK)
|
|
|
|
{
|
2017-09-26 00:43:37 +02:00
|
|
|
test_policy2_rules(policy2);
|
|
|
|
|
2016-07-22 09:47:27 +02:00
|
|
|
INetFwPolicy2_Release(policy2);
|
|
|
|
}
|
|
|
|
else
|
2022-02-28 08:26:14 +01:00
|
|
|
win_skip("NetFwPolicy2 object is not supported: %08lx\n", hr);
|
2016-07-22 09:47:27 +02:00
|
|
|
|
|
|
|
INetFwMgr_Release(manager);
|
|
|
|
}
|
|
|
|
|
2018-04-23 04:24:06 +02:00
|
|
|
static void test_NetFwAuthorizedApplication(void)
|
|
|
|
{
|
|
|
|
INetFwAuthorizedApplication *app;
|
2020-12-13 12:42:01 +01:00
|
|
|
static WCHAR empty[] = L"";
|
2018-06-17 18:27:47 +02:00
|
|
|
UNIVERSAL_NAME_INFOW *info;
|
2018-06-25 22:41:14 +02:00
|
|
|
WCHAR fullpath[MAX_PATH];
|
2018-06-17 18:27:47 +02:00
|
|
|
WCHAR netpath[MAX_PATH];
|
2018-06-17 18:27:46 +02:00
|
|
|
WCHAR image[MAX_PATH];
|
2018-04-23 04:24:06 +02:00
|
|
|
HRESULT hr;
|
2018-06-17 18:27:46 +02:00
|
|
|
BSTR bstr;
|
2018-06-17 18:27:47 +02:00
|
|
|
DWORD sz;
|
2018-04-23 04:24:06 +02:00
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
|
|
&IID_INetFwAuthorizedApplication, (void**)&app);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got: %08lx\n", hr);
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-25 15:28:33 +02:00
|
|
|
hr = GetModuleFileNameW(NULL, image, ARRAY_SIZE(image));
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr, "GetModuleFileName failed: %lu\n", GetLastError());
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-17 18:27:46 +02:00
|
|
|
hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_POINTER, "got: %08lx\n", hr);
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-17 18:27:46 +02:00
|
|
|
hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY), "got: %08lx\n", hr);
|
2018-06-17 18:27:46 +02:00
|
|
|
ok(!bstr, "got: %s\n", wine_dbgstr_w(bstr));
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-17 18:27:46 +02:00
|
|
|
hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, NULL);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08lx\n", hr);
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-17 18:27:46 +02:00
|
|
|
hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, empty);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got: %08lx\n", hr);
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-17 18:27:46 +02:00
|
|
|
bstr = SysAllocString(image);
|
|
|
|
hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, bstr);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got: %08lx\n", hr);
|
2018-06-17 18:27:46 +02:00
|
|
|
SysFreeString(bstr);
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-25 22:41:14 +02:00
|
|
|
GetFullPathNameW(image, ARRAY_SIZE(fullpath), fullpath, NULL);
|
2018-06-28 17:39:36 +02:00
|
|
|
GetLongPathNameW(fullpath, fullpath, ARRAY_SIZE(fullpath));
|
2018-06-25 22:41:14 +02:00
|
|
|
|
2018-06-17 18:27:47 +02:00
|
|
|
info = (UNIVERSAL_NAME_INFOW *)&netpath;
|
|
|
|
sz = sizeof(netpath);
|
2018-07-20 21:05:04 +02:00
|
|
|
hr = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, info, &sz);
|
2018-06-17 18:27:47 +02:00
|
|
|
if (hr != NO_ERROR)
|
|
|
|
{
|
|
|
|
info->lpUniversalName = netpath + sizeof(*info)/sizeof(WCHAR);
|
2018-06-25 22:41:14 +02:00
|
|
|
lstrcpyW(info->lpUniversalName, fullpath);
|
2018-06-17 18:27:47 +02:00
|
|
|
}
|
|
|
|
|
2018-06-17 18:27:46 +02:00
|
|
|
hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got: %08lx\n", hr);
|
2018-06-17 18:27:47 +02:00
|
|
|
ok(!lstrcmpW(bstr,info->lpUniversalName), "expected %s, got %s\n",
|
|
|
|
wine_dbgstr_w(info->lpUniversalName), wine_dbgstr_w(bstr));
|
2018-06-17 18:27:46 +02:00
|
|
|
SysFreeString(bstr);
|
2018-04-23 04:24:06 +02:00
|
|
|
|
2018-06-17 18:27:46 +02:00
|
|
|
INetFwAuthorizedApplication_Release(app);
|
2018-04-23 04:24:06 +02:00
|
|
|
}
|
|
|
|
|
2022-02-01 11:49:20 +01:00
|
|
|
static void test_static_port_mapping_collection( IStaticPortMappingCollection *ports )
|
|
|
|
{
|
|
|
|
LONG i, count, count2, expected_count, external_port;
|
|
|
|
IStaticPortMapping *pm, *pm2;
|
|
|
|
ULONG refcount, refcount2;
|
|
|
|
IEnumVARIANT *enum_ports;
|
|
|
|
IUnknown *unk;
|
|
|
|
ULONG fetched;
|
|
|
|
BSTR protocol;
|
|
|
|
VARIANT var;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
refcount = get_refcount((IUnknown *)ports);
|
|
|
|
hr = IStaticPortMappingCollection_get__NewEnum(ports, &unk);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (void **)&enum_ports);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-03 12:28:33 +01:00
|
|
|
IUnknown_Release( unk );
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
refcount2 = get_refcount((IUnknown *)ports);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(refcount2 == refcount, "Got unexpected refcount %lu, refcount2 %lu.\n", refcount, refcount2);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IEnumVARIANT_Reset(enum_ports);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
count = 0xdeadbeef;
|
|
|
|
hr = IStaticPortMappingCollection_get_Count(ports, &count);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, 12345, (BSTR)L"UDP", &pm);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
expected_count = count;
|
|
|
|
IStaticPortMapping_Release(pm);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
expected_count = count + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_Add(ports, 12345, (BSTR)L"udp", 12345, (BSTR)L"1.2.3.4",
|
|
|
|
VARIANT_TRUE, (BSTR)L"wine_test", &pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
hr = IStaticPortMappingCollection_Add(ports, 12345, (BSTR)L"UDP", 12345, (BSTR)L"1.2.3.4",
|
|
|
|
VARIANT_TRUE, (BSTR)L"wine_test", &pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Count(ports, &count2);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
|
|
|
ok(count2 == expected_count, "Got unexpected count2 %lu, expected %lu.\n", count2, expected_count);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, 12345, NULL, &pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, 12345, (BSTR)L"UDP", NULL);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_POINTER, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, 12345, (BSTR)L"udp", &pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, -1, (BSTR)L"UDP", &pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, 65536, (BSTR)L"UDP", &pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, 12346, (BSTR)L"UDP", &pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IEnumVARIANT_Reset(enum_ports);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
for (i = 0; i < count2; ++i)
|
|
|
|
{
|
|
|
|
VariantInit(&var);
|
|
|
|
|
|
|
|
fetched = 0xdeadbeef;
|
|
|
|
hr = IEnumVARIANT_Next(enum_ports, 1, &var, &fetched);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
|
|
|
ok(fetched == 1, "Got unexpected fetched %lu.\n", fetched);
|
2022-02-01 11:49:20 +01:00
|
|
|
ok(V_VT(&var) == VT_DISPATCH, "Got unexpected variant type %u.\n", V_VT(&var));
|
|
|
|
|
|
|
|
hr = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IStaticPortMapping, (void **)&pm);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
hr = IStaticPortMapping_get_Protocol(pm, &protocol);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
external_port = 0xdeadbeef;
|
|
|
|
hr = IStaticPortMapping_get_ExternalPort(pm, &external_port);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
ok(!wcscmp(protocol, L"UDP") || !wcscmp(protocol, L"TCP"), "Got unexpected protocol %s.\n",
|
|
|
|
debugstr_w(protocol));
|
|
|
|
hr = IStaticPortMappingCollection_get_Item(ports, external_port, protocol, &pm2);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
ok(pm2 != pm, "Got same interface.\n");
|
|
|
|
|
|
|
|
IStaticPortMapping_Release(pm);
|
|
|
|
IStaticPortMapping_Release(pm2);
|
|
|
|
|
|
|
|
SysFreeString(protocol);
|
|
|
|
|
|
|
|
VariantClear(&var);
|
|
|
|
}
|
|
|
|
hr = IEnumVARIANT_Next(enum_ports, 1, &var, &fetched);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_FALSE, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
2022-02-02 09:32:57 +01:00
|
|
|
hr = IStaticPortMappingCollection_Remove(ports, 12345, (BSTR)L"UDP");
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
|
|
|
IEnumVARIANT_Release(enum_ports);
|
|
|
|
}
|
|
|
|
|
2018-10-15 01:27:09 +02:00
|
|
|
static void test_IUPnPNAT(void)
|
|
|
|
{
|
|
|
|
IUPnPNAT *nat;
|
|
|
|
IStaticPortMappingCollection *static_ports;
|
|
|
|
IDynamicPortMappingCollection *dync_ports;
|
|
|
|
INATEventManager *manager;
|
2018-10-17 06:06:16 +02:00
|
|
|
IProvideClassInfo *provider;
|
2022-02-01 11:49:20 +01:00
|
|
|
ULONG refcount, refcount2;
|
2018-10-15 01:27:09 +02:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_UPnPNAT, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IUPnPNAT, (void**)&nat);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got: %08lx\n", hr);
|
2018-10-15 01:27:09 +02:00
|
|
|
|
2018-10-17 06:06:16 +02:00
|
|
|
hr = IUPnPNAT_QueryInterface(nat, &IID_IProvideClassInfo, (void**)&provider);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "got: %08lx\n", hr);
|
2018-10-17 06:06:16 +02:00
|
|
|
|
2022-02-01 11:49:20 +01:00
|
|
|
refcount = get_refcount((IUnknown *)nat);
|
2018-10-15 01:27:09 +02:00
|
|
|
hr = IUPnPNAT_get_StaticPortMappingCollection(nat, &static_ports);
|
2022-02-01 11:49:20 +01:00
|
|
|
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK, "got: %08lx\n", hr);
|
2018-10-15 01:27:09 +02:00
|
|
|
if(hr == S_OK && static_ports)
|
2022-02-01 11:49:20 +01:00
|
|
|
{
|
|
|
|
refcount2 = get_refcount((IUnknown *)nat);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(refcount2 == refcount, "Got unexpected refcount %lu, refcount2 %lu.\n", refcount, refcount2);
|
2022-02-01 11:49:20 +01:00
|
|
|
test_static_port_mapping_collection( static_ports );
|
2018-10-15 01:27:09 +02:00
|
|
|
IStaticPortMappingCollection_Release(static_ports);
|
2022-02-01 11:49:20 +01:00
|
|
|
}
|
|
|
|
else if (hr == S_OK)
|
|
|
|
{
|
|
|
|
skip( "UPNP gateway not found.\n" );
|
|
|
|
}
|
2018-10-15 01:27:09 +02:00
|
|
|
hr = IUPnPNAT_get_DynamicPortMappingCollection(nat, &dync_ports);
|
2022-02-28 08:26:14 +01:00
|
|
|
ok(hr == S_OK || hr == E_NOTIMPL /* Windows 8.1 */, "got: %08lx\n", hr);
|
2018-10-15 01:27:09 +02:00
|
|
|
if(hr == S_OK && dync_ports)
|
|
|
|
IDynamicPortMappingCollection_Release(dync_ports);
|
|
|
|
|
|
|
|
hr = IUPnPNAT_get_NATEventManager(nat, &manager);
|
2022-02-28 08:26:14 +01:00
|
|
|
todo_wine ok(hr == S_OK, "got: %08lx\n", hr);
|
2018-10-15 01:27:09 +02:00
|
|
|
if(hr == S_OK && manager)
|
|
|
|
INATEventManager_Release(manager);
|
|
|
|
|
|
|
|
IUPnPNAT_Release(nat);
|
|
|
|
}
|
|
|
|
|
2016-07-22 09:47:27 +02:00
|
|
|
START_TEST(policy)
|
|
|
|
{
|
|
|
|
INetFwMgr *manager;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
|
|
&IID_INetFwMgr, (void**)&manager);
|
|
|
|
if(FAILED(hr))
|
|
|
|
{
|
2022-02-28 08:26:14 +01:00
|
|
|
win_skip("NetFwMgr object is not supported: %08lx\n", hr);
|
2016-07-22 09:47:27 +02:00
|
|
|
CoUninitialize();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
INetFwMgr_Release(manager);
|
|
|
|
|
|
|
|
test_interfaces();
|
2018-04-23 04:24:06 +02:00
|
|
|
test_NetFwAuthorizedApplication();
|
2018-10-15 01:27:09 +02:00
|
|
|
test_IUPnPNAT();
|
2016-07-22 09:47:27 +02:00
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
}
|