Zebediah Figura : hnetcfg: Store the UNC path in INetFwAuthorizedApplication_put_ProcessImageFileName ().
Alexandre Julliard
julliard at winehq.org
Tue Jun 19 14:52:02 CDT 2018
Module: wine
Branch: master
Commit: e6fc86e4a0a8396a345ae21fbe7be9210441d307
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e6fc86e4a0a8396a345ae21fbe7be9210441d307
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Jun 17 11:27:47 2018 -0500
hnetcfg: Store the UNC path in INetFwAuthorizedApplication_put_ProcessImageFileName().
Fixes test failures when running from virtual drive.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/hnetcfg/Makefile.in | 2 +-
dlls/hnetcfg/apps.c | 32 +++++++++++++++++++++++++++-----
dlls/hnetcfg/tests/Makefile.in | 2 +-
dlls/hnetcfg/tests/policy.c | 15 ++++++++++++++-
4 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/dlls/hnetcfg/Makefile.in b/dlls/hnetcfg/Makefile.in
index 3744368..44c9cb5 100644
--- a/dlls/hnetcfg/Makefile.in
+++ b/dlls/hnetcfg/Makefile.in
@@ -1,5 +1,5 @@
MODULE = hnetcfg.dll
-IMPORTS = oleaut32 ole32 advapi32
+IMPORTS = oleaut32 ole32 advapi32 mpr
C_SRCS = \
apps.c \
diff --git a/dlls/hnetcfg/apps.c b/dlls/hnetcfg/apps.c
index fda714e..34ef108 100644
--- a/dlls/hnetcfg/apps.c
+++ b/dlls/hnetcfg/apps.c
@@ -29,6 +29,7 @@
#include "netfw.h"
#include "wine/debug.h"
+#include "wine/heap.h"
#include "wine/unicode.h"
#include "hnetcfg_private.h"
@@ -263,18 +264,39 @@ static HRESULT WINAPI fw_app_get_ProcessImageFileName(
}
static HRESULT WINAPI fw_app_put_ProcessImageFileName(
- INetFwAuthorizedApplication *iface,
- BSTR imageFileName )
+ INetFwAuthorizedApplication *iface, BSTR image )
{
fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
+ UNIVERSAL_NAME_INFOW *info;
+ WCHAR *netpath;
+ DWORD res;
+ DWORD sz;
- FIXME("%p, %s\n", This, debugstr_w(imageFileName));
+ FIXME("%p, %s\n", This, debugstr_w(image));
- if (!imageFileName || !imageFileName[0])
+ if (!image || !image[0])
return E_INVALIDARG;
+ sz = 0;
+ res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, NULL, &sz);
+ if (res == WN_MORE_DATA)
+ {
+ if (!(netpath = heap_alloc(sz)))
+ return E_OUTOFMEMORY;
+
+ info = (UNIVERSAL_NAME_INFOW *)&netpath;
+ res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
+ if (res == NO_ERROR)
+ {
+ SysFreeString(This->filename);
+ This->filename = SysAllocString(info->lpUniversalName);
+ }
+ heap_free(netpath);
+ return HRESULT_FROM_WIN32(res);
+ }
+
SysFreeString( This->filename );
- This->filename = SysAllocString( imageFileName );
+ This->filename = SysAllocString(image);
return This->filename ? S_OK : E_OUTOFMEMORY;
}
diff --git a/dlls/hnetcfg/tests/Makefile.in b/dlls/hnetcfg/tests/Makefile.in
index 8315b4b..922370a 100644
--- a/dlls/hnetcfg/tests/Makefile.in
+++ b/dlls/hnetcfg/tests/Makefile.in
@@ -1,5 +1,5 @@
TESTDLL = hnetcfg.dll
-IMPORTS = ole32 uuid oleaut32 advapi32
+IMPORTS = ole32 uuid oleaut32 advapi32 mpr
C_SRCS = \
policy.c
diff --git a/dlls/hnetcfg/tests/policy.c b/dlls/hnetcfg/tests/policy.c
index 012bbcd..f2d1372 100644
--- a/dlls/hnetcfg/tests/policy.c
+++ b/dlls/hnetcfg/tests/policy.c
@@ -106,9 +106,12 @@ static void test_NetFwAuthorizedApplication(void)
{
INetFwAuthorizedApplication *app;
static WCHAR empty[] = {0};
+ UNIVERSAL_NAME_INFOW *info;
+ 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);
@@ -135,9 +138,19 @@ static void test_NetFwAuthorizedApplication(void)
ok(hr == S_OK, "got: %08x\n", hr);
SysFreeString(bstr);
+ 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, image);
+ }
+
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));
+ ok(!lstrcmpW(bstr,info->lpUniversalName), "expected %s, got %s\n",
+ wine_dbgstr_w(info->lpUniversalName), wine_dbgstr_w(bstr));
SysFreeString(bstr);
INetFwAuthorizedApplication_Release(app);
More information about the wine-cvs
mailing list