https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4601b11fc94c522b119a2…
commit 4601b11fc94c522b119a27861e448b463e454609
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Sun Oct 20 20:04:04 2019 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sun Oct 20 20:04:04 2019 +0100
[HNETCFG_WINETEST] Sync with Wine Staging 4.18. CORE-16441
---
modules/rostests/winetests/hnetcfg/CMakeLists.txt | 2 +-
modules/rostests/winetests/hnetcfg/policy.c | 105 ++++++++++++++++------
2 files changed, 78 insertions(+), 29 deletions(-)
diff --git a/modules/rostests/winetests/hnetcfg/CMakeLists.txt
b/modules/rostests/winetests/hnetcfg/CMakeLists.txt
index 195bcbf9814..63f9841d798 100644
--- a/modules/rostests/winetests/hnetcfg/CMakeLists.txt
+++ b/modules/rostests/winetests/hnetcfg/CMakeLists.txt
@@ -3,5 +3,5 @@ add_definitions(-DUSE_WINE_TODOS)
add_executable(hnetcfg_winetest policy.c testlist.c)
target_link_libraries(hnetcfg_winetest uuid)
set_module_type(hnetcfg_winetest win32cui)
-add_importlibs(hnetcfg_winetest ole32 oleaut32 msvcrt kernel32)
+add_importlibs(hnetcfg_winetest ole32 oleaut32 mpr msvcrt kernel32)
add_rostests_file(TARGET hnetcfg_winetest)
diff --git a/modules/rostests/winetests/hnetcfg/policy.c
b/modules/rostests/winetests/hnetcfg/policy.c
index 4ee19d8db46..8701455841b 100644
--- a/modules/rostests/winetests/hnetcfg/policy.c
+++ b/modules/rostests/winetests/hnetcfg/policy.c
@@ -27,6 +27,7 @@
#include "wine/test.h"
#include "netfw.h"
+#include "natupnp.h"
static void test_policy2_rules(INetFwPolicy2 *policy2)
{
@@ -59,6 +60,9 @@ static void test_policy2_rules(INetFwPolicy2 *policy2)
INetFwServiceRestriction_Release(restriction);
}
+ hr = INetFwRules_get__NewEnum(rules, NULL);
+ ok(hr == E_POINTER, "got %08x\n", hr);
+
INetFwRules_Release(rules);
INetFwRules_Release(rules2);
}
@@ -105,48 +109,92 @@ static void test_interfaces(void)
static void test_NetFwAuthorizedApplication(void)
{
INetFwAuthorizedApplication *app;
+ static WCHAR empty[] = {0};
+ UNIVERSAL_NAME_INFOW *info;
+ WCHAR fullpath[MAX_PATH];
+ WCHAR netpath[MAX_PATH];
+ WCHAR image[MAX_PATH];
HRESULT hr;
+ BSTR bstr;
+ DWORD sz;
hr = CoCreateInstance(&CLSID_NetFwAuthorizedApplication, NULL,
CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_INetFwAuthorizedApplication, (void**)&app);
ok(hr == S_OK, "got: %08x\n", hr);
- if(hr == S_OK)
- {
- BSTR image = SysAllocStringLen( NULL, MAX_PATH );
- static WCHAR empty[] = {0};
- BSTR bstr;
- if (!GetModuleFileNameW( NULL, image, MAX_PATH ))
- {
- ok(0, "Failed to get filename\n");
- SysFreeString( image );
- return;
- }
+ hr = GetModuleFileNameW(NULL, image, ARRAY_SIZE(image));
+ ok(hr, "GetModuleFileName failed: %u\n", GetLastError());
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
- ok(hr == E_POINTER, "got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, NULL);
+ ok(hr == E_POINTER, "got: %08x\n", hr);
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
- ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY), "got:
%08x\n", hr);
- ok(!bstr, "got: %s\n", wine_dbgstr_w(bstr));
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
+ ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY), "got:
%08x\n", hr);
+ ok(!bstr, "got: %s\n", wine_dbgstr_w(bstr));
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, NULL);
- ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND),
"got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, NULL);
+ ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got:
%08x\n", hr);
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, empty);
- ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND),
"got: %08x\n", hr);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, empty);
+ ok(hr == E_INVALIDARG || hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "got:
%08x\n", hr);
- hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, image);
- ok(hr == S_OK, "got: %08x\n", hr);
+ bstr = SysAllocString(image);
+ hr = INetFwAuthorizedApplication_put_ProcessImageFileName(app, bstr);
+ ok(hr == S_OK, "got: %08x\n", hr);
+ SysFreeString(bstr);
- hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
- ok(hr == S_OK, "got: %08x\n", hr);
- ok(!lstrcmpiW(bstr,image), "got: %s\n", wine_dbgstr_w(bstr));
- SysFreeString( bstr );
+ GetFullPathNameW(image, ARRAY_SIZE(fullpath), fullpath, NULL);
+ GetLongPathNameW(fullpath, fullpath, ARRAY_SIZE(fullpath));
- SysFreeString( image );
- INetFwAuthorizedApplication_Release(app);
+ info = (UNIVERSAL_NAME_INFOW *)&netpath;
+ sz = sizeof(netpath);
+ hr = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, info, &sz);
+ if (hr != NO_ERROR)
+ {
+ info->lpUniversalName = netpath + sizeof(*info)/sizeof(WCHAR);
+ lstrcpyW(info->lpUniversalName, fullpath);
}
+
+ hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
+ ok(hr == S_OK, "got: %08x\n", hr);
+ ok(!lstrcmpW(bstr,info->lpUniversalName), "expected %s, got %s\n",
+ wine_dbgstr_w(info->lpUniversalName), wine_dbgstr_w(bstr));
+ SysFreeString(bstr);
+
+ INetFwAuthorizedApplication_Release(app);
+}
+
+static void test_IUPnPNAT(void)
+{
+ IUPnPNAT *nat;
+ IStaticPortMappingCollection *static_ports;
+ IDynamicPortMappingCollection *dync_ports;
+ INATEventManager *manager;
+ IProvideClassInfo *provider;
+ 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_QueryInterface(nat, &IID_IProvideClassInfo,
(void**)&provider);
+ ok(hr == E_NOINTERFACE, "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)
@@ -169,6 +217,7 @@ START_TEST(policy)
test_interfaces();
test_NetFwAuthorizedApplication();
+ test_IUPnPNAT();
CoUninitialize();
}