[v2 PATCH 2/2] dpnet/tests: Dont hard code paths
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Feb 7 15:27:32 CST 2017
No changes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/dpnet/tests/address.c | 12 +++++++++---
dlls/dpnet/tests/client.c | 12 +++++++++---
dlls/dpnet/tests/server.c | 32 +++++++++++++++++++++-----------
3 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/dlls/dpnet/tests/address.c b/dlls/dpnet/tests/address.c
index 4aed626ad8..a1dcdef100 100644
--- a/dlls/dpnet/tests/address.c
+++ b/dlls/dpnet/tests/address.c
@@ -358,10 +358,16 @@ static void address_duplicate(void)
START_TEST(address)
{
HRESULT hr;
+ char path[MAX_PATH];
- if (!winetest_interactive &&
- (is_stub_dll("c:\\windows\\system32\\dpnet.dll") ||
- is_stub_dll("c:\\windows\\syswow64\\dpnet.dll")))
+ if(!GetSystemDirectoryA(path, MAX_PATH))
+ {
+ 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");
return;
diff --git a/dlls/dpnet/tests/client.c b/dlls/dpnet/tests/client.c
index d2edcbef90..bbd77fe398 100644
--- a/dlls/dpnet/tests/client.c
+++ b/dlls/dpnet/tests/client.c
@@ -613,10 +613,16 @@ static void test_cleanup_dp_peer(void)
START_TEST(client)
{
BOOL firewall_enabled;
+ char path[MAX_PATH];
- if (!winetest_interactive &&
- (is_stub_dll("c:\\windows\\system32\\dpnet.dll") ||
- is_stub_dll("c:\\windows\\syswow64\\dpnet.dll")))
+ if(!GetSystemDirectoryA(path, MAX_PATH))
+ {
+ 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");
return;
diff --git a/dlls/dpnet/tests/server.c b/dlls/dpnet/tests/server.c
index 2f52c588a6..422e6d6939 100644
--- a/dlls/dpnet/tests/server.c
+++ b/dlls/dpnet/tests/server.c
@@ -236,11 +236,8 @@ done:
HRESULT set_firewall( enum firewall_op op )
{
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};
- 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};
+ {'d','p','n','s','v','r','.','e','x','e',0};
+ static const WCHAR seperator[] = {'\\',0};
static const WCHAR clientW[] =
{'d','p','n','e','t','_','c','l','i','e','n','t',0};
static const WCHAR serverW[] =
@@ -252,7 +249,7 @@ HRESULT set_firewall( enum firewall_op op )
INetFwAuthorizedApplication *app = NULL;
INetFwAuthorizedApplications *apps = NULL;
BSTR name, image = SysAllocStringLen( NULL, MAX_PATH );
- BOOL is_wow64;
+ WCHAR path[MAX_PATH];
if (!GetModuleFileNameW( NULL, image, MAX_PATH ))
{
@@ -260,6 +257,14 @@ HRESULT set_firewall( enum firewall_op op )
return E_FAIL;
}
+ if(!GetSystemDirectoryW(path, MAX_PATH))
+ {
+ SysFreeString( image );
+ return E_FAIL;
+ }
+ lstrcatW(path, seperator);
+ lstrcatW(path, dpnsvrW);
+
init = CoInitializeEx( 0, COINIT_APARTMENTTHREADED );
hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
@@ -307,8 +312,7 @@ HRESULT set_firewall( enum firewall_op op )
if (hr != S_OK) goto done;
SysFreeString( image );
- IsWow64Process( GetCurrentProcess(), &is_wow64 );
- image = is_wow64 ? SysAllocString( dpnsvr_wow64W ) : SysAllocString( dpnsvrW );
+ image = SysAllocString( path );
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
@@ -366,10 +370,16 @@ START_TEST(server)
{
HRESULT hr;
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 &&
- (is_stub_dll("c:\\windows\\system32\\dpnet.dll") ||
- is_stub_dll("c:\\windows\\syswow64\\dpnet.dll")))
+ if (!winetest_interactive && is_stub_dll(path))
{
win_skip("dpnet is a stub dll, skipping tests\n");
return;
--
2.11.0
More information about the wine-patches
mailing list