[programs/winetest] Extend PATH if we have dll's that only come with .NET
Paul Vriens
paul.vriens.wine at gmail.com
Tue Feb 24 07:31:54 CST 2009
Nicolas Le Cam wrote:
> 2009/2/24 Paul Vriens <paul.vriens.wine at gmail.com>:
>> Hi,
>>
>> This makes sure that if we have a dll that's only provided via .NET it can
>> still
>> be found. Now both our extraction (and the generation of the subtest list)
>> and
>> the real test will find the dll.
>>
>> The downside (and hence this is a bit hackish) is that we extend the PATH
>> for
>> every test. For now it's only gdiplus that needs this btw as that dll can
>> also
>> exist without .NET (if I'm correct) and these tests directly import gdiplus.
>>
>> Changelog
>> Extend PATH if we have dll's that only come with .NET
>>
>> --
>> Cheers,
>>
>> Paul.
>>
>>
>> >From 3cf6c1e876ac032aab988efa0751b26b9643cf93 Mon Sep 17 00:00:00 2001
>> From: Paul Vriens <Paul.Vriens.Wine at gmail.com>
>> 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
>>
>>
>>
>>
>>
>>
>
> What about extending wine_test struct with a path variable that will
> be set and restored around the CreateProcess call in run_ex if not
> null ?
>
That will provide us at least with a per-test PATH change if needed. Let me
think about that one a bit more (maybe AJ already has another/better idea, how
to solve this) as that requires some bigger changes.
--
Cheers,
Paul.
More information about the wine-devel
mailing list