Fix for bug 511315. Add support for LOAD_WITH_ALTERED_SEARCH_PATH flag to PR_LoadLibraryWithFlags . r=wtc
authorjulien.pierre.boogz%sun.com
Tue, 25 Aug 2009 21:29:44 +0000
changeset 4144 aa7d0bc6eb99fefb7f1f7f33a8b93f540fffa7e8
parent 4143 ee4ed519102eb4df4e8cf8037e5d85be313f737a
child 4145 72b310a1db93ae842f8ef4212bd704868072898f
push idunknown
push userunknown
push dateunknown
reviewerswtc
bugs511315
Fix for bug 511315. Add support for LOAD_WITH_ALTERED_SEARCH_PATH flag to PR_LoadLibraryWithFlags . r=wtc
pr/include/prlink.h
pr/src/linking/prlink.c
--- a/pr/include/prlink.h
+++ b/pr/include/prlink.h
@@ -160,16 +160,18 @@ typedef struct PRLibSpec {
 ** as the 'flags' argument to PR_LoadLibraryWithFlags.
 ** Flags not supported by the underlying OS are ignored.
 */
 
 #define PR_LD_LAZY   0x1  /* equivalent to RTLD_LAZY on Unix */
 #define PR_LD_NOW    0x2  /* equivalent to RTLD_NOW on Unix */
 #define PR_LD_GLOBAL 0x4  /* equivalent to RTLD_GLOBAL on Unix */
 #define PR_LD_LOCAL  0x8  /* equivalent to RTLD_LOCAL on Unix */
+/* The following is equivalent to LOAD_WITH_ALTERED_SEARCH_PATH on Windows */
+#define PR_LD_ALT_SEARCH_PATH  0x10  
 /*                0x8000     reserved for NSPR internal use */
 
 /*
 ** Load the specified library, in the manner specified by 'flags'.
 */
 
 NSPR_API(PRLibrary *)
 PR_LoadLibraryWithFlags(
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -747,17 +747,19 @@ pr_LoadLibraryByPathname(const char *nam
           pr_loadmap = lm;
     }
 #endif /* XP_OS2 */
 
 #ifdef WIN32
     {
     HINSTANCE h;
 
-    h = LoadLibraryW(wname);
+    h = LoadLibraryExW(wname, NULL,
+                       (flags & PR_LD_ALT_SEARCH_PATH) ?
+                       LOAD_WITH_ALTERED_SEARCH_PATH : 0);
     if (h == NULL) {
         oserr = _MD_ERRNO();
         PR_DELETE(lm);
         goto unlock;
     }
     lm->name = strdup(utf8name);
     lm->dlh = h;
     lm->next = pr_loadmap;