Nicolas Le Cam wrote:
Hi Paul, minor comments :
+static void append_path( const char *path) +{
- char *newpath;
- newpath = xmalloc(strlen(curpath) + 1 + strlen(path) + 1);
- strcpy(newpath, curpath);
- strcat(newpath, ";");
- strcat(newpath, path);
- SetEnvironmentVariableA("PATH", newpath);
- free(newpath);
+}
Perhaps use newpath = strmake( NULL, "%s;%s", curpath, path); I don't know. (I used it in a similar patch that I was making yesterday)
Just a matter of preference I guess.
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 dllpath[MAX_PATH];
dllpath should be declared at start of the function IMHO.
It's only needed in the else branch.
/* We have a dll that cannot be found through LoadLibraryExA.
This
* is the case for .NET provided dll's. We will add the
directory
* where the dll resides to the PATH variable when dealing with
* the tests for this dll.
*/
GetModuleFileNameA(dll, dllpath, MAX_PATH);
*strrchr(dllpath, '\\') = '\0';
wine_tests[nr_of_files].maindllpath = xmalloc(strlen(dllpath) +
1);
strcpy(wine_tests[nr_of_files].maindllpath, dllpath);
}
This won't work if test needs more than one dll found through LoadLibraryShim
Not sure what you mean as LoadLibraryShim will only return 1 dll.
} if (!dll) { xprintf (" %s=dll is missing\n", dllname);
@@ -578,6 +619,12 @@ run_tests (char *logname) DWORD strsize; SECURITY_ATTRIBUTES sa; char tmppath[MAX_PATH], tempdir[MAX_PATH+4];
- DWORD needed;
- /* Get the current PATH only once */
- needed = GetEnvironmentVariableA("PATH", NULL, 0);
- curpath = xmalloc(needed);
- GetEnvironmentVariable("PATH", curpath, needed);
This should be GetEnvironmentVariableA.
Well it would work anyway but for consistency sake I will change that.