From 3eb4594f9d874632e81928b003b1bf818a57739b Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 4 Aug 2010 19:17:29 +0000 Subject: * win/tclWin32Dll.c (asciiProcs, unicodeProcs): * win/tclWinLoad.c (TclpDlopen): 'load' use LoadLibraryEx with * win/tclWinInt.h (TclWinProcs): LOAD_WITH_ALTERED_SEARCH_PATH to prefer dependent DLLs in same dir as loaded DLL. --- ChangeLog | 5 +++++ win/tclWin32Dll.c | 6 +++--- win/tclWinInt.h | 4 ++-- win/tclWinLoad.c | 8 +++++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91b97e9..44ecb02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-08-04 Jeff Hobbs + * win/tclWin32Dll.c (asciiProcs, unicodeProcs): + * win/tclWinLoad.c (TclpDlopen): 'load' use LoadLibraryEx with + * win/tclWinInt.h (TclWinProcs): LOAD_WITH_ALTERED_SEARCH_PATH to + prefer dependent DLLs in same dir as loaded DLL. + * win/Makefile.in (%.${OBJEXT}): better implicit rules support 2010-08-04 Don Porter diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index eca7ec8..1913204 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWin32Dll.c,v 1.54.2.1 2009/07/01 14:05:19 patthoyts Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.54.2.2 2010/08/04 19:17:29 hobbs Exp $ */ #include "tclWinInt.h" @@ -106,7 +106,7 @@ static TclWinProcs asciiProcs = { (DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathA, (BOOL (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD, WCHAR *, DWORD)) GetVolumeInformationA, - (HINSTANCE (WINAPI *)(CONST TCHAR *)) LoadLibraryA, + (HINSTANCE (WINAPI *)(CONST TCHAR *, HANDLE, DWORD)) LoadLibraryExA, (TCHAR (WINAPI *)(WCHAR *, CONST TCHAR *)) lstrcpyA, (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *)) MoveFileA, (BOOL (WINAPI *)(CONST TCHAR *)) RemoveDirectoryA, @@ -165,7 +165,7 @@ static TclWinProcs unicodeProcs = { (DWORD (WINAPI *)(DWORD, WCHAR *)) GetTempPathW, (BOOL (WINAPI *)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD, WCHAR *, DWORD)) GetVolumeInformationW, - (HINSTANCE (WINAPI *)(CONST TCHAR *)) LoadLibraryW, + (HINSTANCE (WINAPI *)(CONST TCHAR *, HANDLE, DWORD)) LoadLibraryExW, (TCHAR (WINAPI *)(WCHAR *, CONST TCHAR *)) lstrcpyW, (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR *)) MoveFileW, (BOOL (WINAPI *)(CONST TCHAR *)) RemoveDirectoryW, diff --git a/win/tclWinInt.h b/win/tclWinInt.h index f8471d8..7568df2 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinInt.h,v 1.29.10.1 2009/07/01 14:05:19 patthoyts Exp $ + * RCS: @(#) $Id: tclWinInt.h,v 1.29.10.2 2010/08/04 19:17:29 hobbs Exp $ */ #ifndef _TCLWININT @@ -75,7 +75,7 @@ typedef struct TclWinProcs { DWORD (WINAPI *getTempPathProc)(DWORD, WCHAR *); BOOL (WINAPI *getVolumeInformationProc)(CONST TCHAR *, WCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD, WCHAR *, DWORD); - HINSTANCE (WINAPI *loadLibraryProc)(CONST TCHAR *); + HINSTANCE (WINAPI *loadLibraryExProc)(CONST TCHAR *, HANDLE, DWORD); TCHAR (WINAPI *lstrcpyProc)(WCHAR *, CONST TCHAR *); BOOL (WINAPI *moveFileProc)(CONST TCHAR *, CONST TCHAR *); BOOL (WINAPI *removeDirectoryProc)(CONST TCHAR *); diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 30bc750..9785648 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinLoad.c,v 1.20 2007/04/20 06:11:00 kennykb Exp $ + * RCS: @(#) $Id: tclWinLoad.c,v 1.20.4.1 2010/08/04 19:17:29 hobbs Exp $ */ #include "tclWinInt.h" @@ -57,7 +57,8 @@ TclpDlopen( */ nativeName = Tcl_FSGetNativePath(pathPtr); - handle = (*tclWinProcs->loadLibraryProc)(nativeName); + handle = (*tclWinProcs->loadLibraryExProc)(nativeName, NULL, + LOAD_WITH_ALTERED_SEARCH_PATH); if (handle == NULL) { /* * Let the OS loader examine the binary search path for whatever @@ -69,7 +70,8 @@ TclpDlopen( char *fileName = Tcl_GetString(pathPtr); nativeName = Tcl_WinUtfToTChar(fileName, -1, &ds); - handle = (*tclWinProcs->loadLibraryProc)(nativeName); + handle = (*tclWinProcs->loadLibraryExProc)(nativeName, NULL, + LOAD_WITH_ALTERED_SEARCH_PATH); Tcl_DStringFree(&ds); } -- cgit v0.12