>From 3cf6c1e876ac032aab988efa0751b26b9643cf93 Mon Sep 17 00:00:00 2001 From: Paul Vriens Date: Tue, 24 Feb 2009 14:05:26 +0100 Subject: [PATCH] Extend PATH if we have dll's that only come with .NET --- programs/winetest/main.c | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/programs/winetest/main.c b/programs/winetest/main.c index 74a4307..ee390ec 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -542,7 +542,33 @@ extract_test_proc (HMODULE hModule, LPCTSTR lpszType, if (!dll && pLoadLibraryShim) { MultiByteToWideChar(CP_ACP, 0, dllname, -1, dllnameW, MAX_PATH); - if (FAILED( pLoadLibraryShim(dllnameW, NULL, NULL, &dll) )) dll = 0; + if (FAILED( pLoadLibraryShim(dllnameW, NULL, NULL, &dll) )) + dll = 0; + else + { + char *newpath; + char dllpath[MAX_PATH]; + DWORD needed, pathlen = 0; + + /* Extend the path so get_subtests() and the test itself can find + * the dll (gdiplus for example). + */ + GetModuleFileNameA(dll, dllpath, MAX_PATH); + *strrchr(dllpath, '\\') = '\0'; + + needed = GetEnvironmentVariableA("PATH", NULL, 0); + + /* current path + ';' + dllpath + '\0' */ + pathlen = needed + 1 + strlen(dllpath) + 1; + newpath = xmalloc(pathlen); + GetEnvironmentVariable("PATH", newpath, pathlen); + + strcat(newpath, ";"); + strcat(newpath, dllpath); + SetEnvironmentVariableA("PATH", newpath); + + free(newpath); + } } if (!dll) { xprintf (" %s=dll is missing\n", dllname); -- 1.6.0.6