Fix for pr3301924.
If a relative path name is passed to the Windows LoadModule function, it is applied in turn to each path in the DLL search path. For the ivl_dlopen function, we actually want to mimic the Unix behaviour, where a relative path is relative to the current working directory. On systems where the KB2264107 security fix has been applied, the CWD is excluded from the DLL search path, so we no longer get the required behaviour. This patch reworks the ivl_dlopen function to give the correct behaviour under Windows. This patch also adds a flush of the stderr stream after reporting VPI call errors. This fixes a race between the stdout and stderr streams when running the regression tests in a MinGW shell.
This commit is contained in:
parent
6cad14c491
commit
767bb87ee2
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __ivl_dlfcn_H
|
||||
#define __ivl_dlfcn_H
|
||||
/*
|
||||
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -33,7 +33,15 @@ typedef shl_t ivl_dll_t;
|
|||
|
||||
#if defined(__MINGW32__)
|
||||
inline ivl_dll_t ivl_dlopen(const char *name, bool global_flag)
|
||||
{ return (void *)LoadLibrary(name); }
|
||||
{
|
||||
static char full_name[4096];
|
||||
unsigned long length = GetFullPathName(name, sizeof(full_name),
|
||||
full_name, NULL);
|
||||
if ((length == 0) || (length > sizeof(full_name)))
|
||||
return 0;
|
||||
|
||||
return (void *)LoadLibrary(full_name);
|
||||
}
|
||||
|
||||
inline void *ivl_dlsym(ivl_dll_t dll, const char *nm)
|
||||
{ return (void *)GetProcAddress((HINSTANCE)dll,nm);}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2010 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -742,6 +742,7 @@ void print_vpi_call_errors()
|
|||
free(vpi_call_error_lst[idx].name);
|
||||
}
|
||||
free(vpi_call_error_lst);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
|
|
|
|||
Loading…
Reference in New Issue