Commit e6fc86e4 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

hnetcfg: Store the UNC path in INetFwAuthorizedApplication_put_ProcessImageFileName().

Fixes test failures when running from virtual drive. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 709cce63
MODULE = hnetcfg.dll MODULE = hnetcfg.dll
IMPORTS = oleaut32 ole32 advapi32 IMPORTS = oleaut32 ole32 advapi32 mpr
C_SRCS = \ C_SRCS = \
apps.c \ apps.c \
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "netfw.h" #include "netfw.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "hnetcfg_private.h" #include "hnetcfg_private.h"
...@@ -263,18 +264,39 @@ static HRESULT WINAPI fw_app_get_ProcessImageFileName( ...@@ -263,18 +264,39 @@ static HRESULT WINAPI fw_app_get_ProcessImageFileName(
} }
static HRESULT WINAPI fw_app_put_ProcessImageFileName( static HRESULT WINAPI fw_app_put_ProcessImageFileName(
INetFwAuthorizedApplication *iface, INetFwAuthorizedApplication *iface, BSTR image )
BSTR imageFileName )
{ {
fw_app *This = impl_from_INetFwAuthorizedApplication( iface ); 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; 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 ); SysFreeString( This->filename );
This->filename = SysAllocString( imageFileName ); This->filename = SysAllocString(image);
return This->filename ? S_OK : E_OUTOFMEMORY; return This->filename ? S_OK : E_OUTOFMEMORY;
} }
......
TESTDLL = hnetcfg.dll TESTDLL = hnetcfg.dll
IMPORTS = ole32 uuid oleaut32 advapi32 IMPORTS = ole32 uuid oleaut32 advapi32 mpr
C_SRCS = \ C_SRCS = \
policy.c policy.c
...@@ -106,9 +106,12 @@ static void test_NetFwAuthorizedApplication(void) ...@@ -106,9 +106,12 @@ static void test_NetFwAuthorizedApplication(void)
{ {
INetFwAuthorizedApplication *app; INetFwAuthorizedApplication *app;
static WCHAR empty[] = {0}; static WCHAR empty[] = {0};
UNIVERSAL_NAME_INFOW *info;
WCHAR netpath[MAX_PATH];
WCHAR image[MAX_PATH]; WCHAR image[MAX_PATH];
HRESULT hr; HRESULT hr;
BSTR bstr; BSTR bstr;
DWORD sz;
hr = CoCreateInstance(&CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, hr = CoCreateInstance(&CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_INetFwAuthorizedApplication, (void**)&app); &IID_INetFwAuthorizedApplication, (void**)&app);
...@@ -135,9 +138,19 @@ static void test_NetFwAuthorizedApplication(void) ...@@ -135,9 +138,19 @@ static void test_NetFwAuthorizedApplication(void)
ok(hr == S_OK, "got: %08x\n", hr); ok(hr == S_OK, "got: %08x\n", hr);
SysFreeString(bstr); 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); hr = INetFwAuthorizedApplication_get_ProcessImageFileName(app, &bstr);
ok(hr == S_OK, "got: %08x\n", hr); 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); SysFreeString(bstr);
INetFwAuthorizedApplication_Release(app); INetFwAuthorizedApplication_Release(app);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment