Alexandre Julliard : dbghelp: Use wine_dll_enum_load_path to search the dll load path.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 17 11:41:59 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 133b3069bb7641ffe130586ae762f7314c1cf763
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=133b3069bb7641ffe130586ae762f7314c1cf763

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Feb 17 17:38:28 2006 +0100

dbghelp: Use wine_dll_enum_load_path to search the dll load path.

---

 dlls/dbghelp/elf_module.c |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 6331b57..92bb3f1 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -69,6 +69,7 @@
 # include <sys/link.h>
 #endif
 
+#include "wine/library.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
@@ -1160,6 +1161,33 @@ static BOOL elf_load_file_from_path(HAND
 }
 
 /******************************************************************
+ *		elf_load_file_from_dll_path
+ *
+ * Tries to load an ELF file from the dll path
+ */
+static BOOL elf_load_file_from_dll_path(HANDLE hProcess,
+                                        const char* filename,
+                                        unsigned long load_offset,
+                                        struct elf_info* elf_info)
+{
+    BOOL ret = FALSE;
+    unsigned int index = 0;
+    const char *path;
+
+    while (!ret && (path = wine_dll_enum_load_path( index++ )))
+    {
+        char *name = HeapAlloc( GetProcessHeap(), 0, strlen(path) + strlen(filename) + 2 );
+        if (!name) break;
+        strcpy( name, path );
+        strcat( name, "/" );
+        strcat( name, filename );
+        ret = elf_load_file(hProcess, name, load_offset, elf_info);
+        HeapFree( GetProcessHeap(), 0, name );
+    }
+    return ret;
+}
+
+/******************************************************************
  *		elf_search_and_load_file
  *
  * lookup a file in standard ELF locations, and if found, load it
@@ -1187,9 +1215,8 @@ static BOOL elf_search_and_load_file(str
         ret = elf_load_file_from_path(pcs, filename, load_offset, 
                                       getenv("PATH"), elf_info) ||
             elf_load_file_from_path(pcs, filename, load_offset,
-                                    getenv("LD_LIBRARY_PATH"), elf_info) ||
-            elf_load_file_from_path(pcs, filename, load_offset,
-                                    getenv("WINEDLLPATH"), elf_info);
+                                    getenv("LD_LIBRARY_PATH"), elf_info);
+        if (!ret) ret = elf_load_file_from_dll_path(pcs, filename, load_offset, elf_info);
     }
     
     return ret;




More information about the wine-cvs mailing list