Commit d9610706 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

dpnet/tests: Don't hardcode paths.

parent afe438a8
...@@ -358,10 +358,16 @@ static void address_duplicate(void) ...@@ -358,10 +358,16 @@ static void address_duplicate(void)
START_TEST(address) START_TEST(address)
{ {
HRESULT hr; HRESULT hr;
char path[MAX_PATH];
if (!winetest_interactive && if(!GetSystemDirectoryA(path, MAX_PATH))
(is_stub_dll("c:\\windows\\system32\\dpnet.dll") || {
is_stub_dll("c:\\windows\\syswow64\\dpnet.dll"))) skip("Failed to get systems directory\n");
return;
}
strcat(path, "\\dpnet.dll");
if (!winetest_interactive && is_stub_dll(path))
{ {
win_skip("dpnet is a stub dll, skipping tests\n"); win_skip("dpnet is a stub dll, skipping tests\n");
return; return;
......
...@@ -613,10 +613,16 @@ static void test_cleanup_dp_peer(void) ...@@ -613,10 +613,16 @@ static void test_cleanup_dp_peer(void)
START_TEST(client) START_TEST(client)
{ {
BOOL firewall_enabled; BOOL firewall_enabled;
char path[MAX_PATH];
if (!winetest_interactive && if(!GetSystemDirectoryA(path, MAX_PATH))
(is_stub_dll("c:\\windows\\system32\\dpnet.dll") || {
is_stub_dll("c:\\windows\\syswow64\\dpnet.dll"))) skip("Failed to get systems directory\n");
return;
}
strcat(path, "\\dpnet.dll");
if (!winetest_interactive && is_stub_dll(path))
{ {
win_skip("dpnet is a stub dll, skipping tests\n"); win_skip("dpnet is a stub dll, skipping tests\n");
return; return;
......
...@@ -236,11 +236,8 @@ done: ...@@ -236,11 +236,8 @@ done:
HRESULT set_firewall( enum firewall_op op ) HRESULT set_firewall( enum firewall_op op )
{ {
static const WCHAR dpnsvrW[] = static const WCHAR dpnsvrW[] =
{'c',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2','\\', {'d','p','n','s','v','r','.','e','x','e',0};
'd','p','n','s','v','r','.','e','x','e',0}; static const WCHAR seperator[] = {'\\',0};
static const WCHAR dpnsvr_wow64W[] =
{'c',':','\\','w','i','n','d','o','w','s','\\','s','y','s','w','o','w','6','4','\\',
'd','p','n','s','v','r','.','e','x','e',0};
static const WCHAR clientW[] = static const WCHAR clientW[] =
{'d','p','n','e','t','_','c','l','i','e','n','t',0}; {'d','p','n','e','t','_','c','l','i','e','n','t',0};
static const WCHAR serverW[] = static const WCHAR serverW[] =
...@@ -252,7 +249,7 @@ HRESULT set_firewall( enum firewall_op op ) ...@@ -252,7 +249,7 @@ HRESULT set_firewall( enum firewall_op op )
INetFwAuthorizedApplication *app = NULL; INetFwAuthorizedApplication *app = NULL;
INetFwAuthorizedApplications *apps = NULL; INetFwAuthorizedApplications *apps = NULL;
BSTR name, image = SysAllocStringLen( NULL, MAX_PATH ); BSTR name, image = SysAllocStringLen( NULL, MAX_PATH );
BOOL is_wow64; WCHAR path[MAX_PATH];
if (!GetModuleFileNameW( NULL, image, MAX_PATH )) if (!GetModuleFileNameW( NULL, image, MAX_PATH ))
{ {
...@@ -260,6 +257,14 @@ HRESULT set_firewall( enum firewall_op op ) ...@@ -260,6 +257,14 @@ HRESULT set_firewall( enum firewall_op op )
return E_FAIL; return E_FAIL;
} }
if(!GetSystemDirectoryW(path, MAX_PATH))
{
SysFreeString( image );
return E_FAIL;
}
lstrcatW(path, seperator);
lstrcatW(path, dpnsvrW);
init = CoInitializeEx( 0, COINIT_APARTMENTTHREADED ); init = CoInitializeEx( 0, COINIT_APARTMENTTHREADED );
hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr, hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
...@@ -307,8 +312,7 @@ HRESULT set_firewall( enum firewall_op op ) ...@@ -307,8 +312,7 @@ HRESULT set_firewall( enum firewall_op op )
if (hr != S_OK) goto done; if (hr != S_OK) goto done;
SysFreeString( image ); SysFreeString( image );
IsWow64Process( GetCurrentProcess(), &is_wow64 ); image = SysAllocString( path );
image = is_wow64 ? SysAllocString( dpnsvr_wow64W ) : SysAllocString( dpnsvrW );
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image ); hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done; if (hr != S_OK) goto done;
...@@ -366,10 +370,16 @@ START_TEST(server) ...@@ -366,10 +370,16 @@ START_TEST(server)
{ {
HRESULT hr; HRESULT hr;
BOOL firewall_enabled; BOOL firewall_enabled;
char path[MAX_PATH];
if(!GetSystemDirectoryA(path, MAX_PATH))
{
skip("Failed to get systems directory\n");
return;
}
strcat(path, "\\dpnet.dll");
if (!winetest_interactive && if (!winetest_interactive && is_stub_dll(path))
(is_stub_dll("c:\\windows\\system32\\dpnet.dll") ||
is_stub_dll("c:\\windows\\syswow64\\dpnet.dll")))
{ {
win_skip("dpnet is a stub dll, skipping tests\n"); win_skip("dpnet is a stub dll, skipping tests\n");
return; return;
......
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