Module: wine Branch: master Commit: d9610706e527dbc470af7696f41c8d2b31870204 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d9610706e527dbc470af7696f4...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Tue Feb 7 21:27:32 2017 +0000
dpnet/tests: Don't hardcode paths.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com Signed-off-by: Erich E. Hoover erich.e.hoover@wine-staging.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 4aed626..a1dcdef 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 d2edcbe..bbd77fe 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 2f52c58..422e6d6 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;