From 73774597a1b44438076a6f72df9c5040b54e3a04 Mon Sep 17 00:00:00 2001 From: andreas_kupries Date: Wed, 3 Nov 2010 22:10:47 +0000 Subject: Backported from 8.6 (see 2010-08-04). * 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 | 8 ++++++++ win/tclWin32Dll.c | 6 +++--- win/tclWinInt.h | 4 ++-- win/tclWinLoad.c | 8 +++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index db1a182..8199e1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-11-03 Jeff Hobbs + + Backported from 8.6 (see 2010-08-04). + * 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. + 2010-10-31 Jan Nijtmans * win/tcl.m4 Add -D_CRT_SECURE_NO_DEPRECATE and diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 32fca20..4ba65b7 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -9,7 +9,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.24.2.10 2006/10/17 04:36:45 dgp Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.24.2.11 2010/11/03 22:10:48 andreas_kupries Exp $ */ #include "tclWinInt.h" @@ -98,7 +98,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, @@ -154,7 +154,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 3b06f50..3a87623 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.20.2.5 2006/03/10 10:35:25 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinInt.h,v 1.20.2.6 2010/11/03 22:10:48 andreas_kupries Exp $ */ #ifndef _TCLWININT @@ -85,7 +85,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 77b440a..1698871 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.15 2002/10/10 12:25:53 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinLoad.c,v 1.15.2.1 2010/11/03 22:10:48 andreas_kupries Exp $ */ #include "tclWinInt.h" @@ -56,7 +56,8 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) * using a relative path. */ 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 @@ -66,7 +67,8 @@ TclpDlopen(interp, pathPtr, loadHandle, unloadProcPtr) Tcl_DString ds; 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