Mail Archives: cygwin-developers/2001/03/25/17:49:17
This is a multi-part message in MIME format.
--------------D3ADAD6D2DD67A4C838937DB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
attached is a patch for get_full_path_of_dll(), to lookup the application
directory for a DLL first. The documentation of get_full_path_of_dll() says,
it should behave like LoadLibrary(), but it did never lookup the application
directory. I'm not shure, if this patch brakes with any cygwin philosophy.
BTW: The patch is against the current cvs sources.
Motivation:
I recognized this lack of functionality, while playing with cdrtools-1.10a17
on Win2K and WinNT. cdrecord wants to load wnaspi32.dll and reported an error,
when the library was not in one of the directories, that were searched by
get_full_path_of_dll().
As I share cdrtools with other people on our local network, I'd like to put
wnaspi32.dll into the directory, where cdrecord.exe resides. After my patch,
cdrecord can be used easily without the need to configure anyones system in a
certain way (setup environment variables, copy libraries, change current
directory, etc.).
Bye.
--
Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl AT gmx DOT de
--------------D3ADAD6D2DD67A4C838937DB
Content-Type: text/plain; charset=us-ascii;
name="dlfcn.cc-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="dlfcn.cc-patch"
--- dlfcn.cc-orig Sun Mar 18 03:34:05 2001
+++ dlfcn.cc Mon Mar 26 00:32:52 2001
@@ -102,6 +102,26 @@ get_full_path_of_dll (const char* str)
if (isabspath (str))
ret = name;
+ /* Lookup application directory first (LoadLibrary() behaviour). */
+ if (!ret)
+ {
+ /* Get the absolute file name path of the executeable. */
+ if (GetModuleFileName (NULL, buf, MAX_PATH) == 0)
+ small_printf ("WARNING: get_full_path_of_dll can't get module file name win32 %E\n");
+ else
+ {
+ /* To get the application directory, strip off the file name. */
+ char *p = strrchr (buf, '\\');
+ if (!p)
+ small_printf ("WARNING: get_full_path_of_dll can't extract application directory from module file name\n");
+ else
+ {
+ *p = '\0';
+ ret = check_access (buf, name);
+ }
+ }
+ }
+
/* current directory */
if (!ret)
{
--------------D3ADAD6D2DD67A4C838937DB
Content-Type: text/plain; charset=us-ascii;
name="ChangeLog"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ChangeLog"
2001-03-26 Reinhard Nissl <rnissl AT gmx DOT de>
* dlfcn.cc (get_full_path_of_dll): Lookup application directory for DLL
first (LoadLibrary() behaviour).
--------------D3ADAD6D2DD67A4C838937DB--
- Raw text -