Index: trunk/src/kernel32/winimagebase.cpp
===================================================================
--- trunk/src/kernel32/winimagebase.cpp	(revision 3393)
+++ trunk/src/kernel32/winimagebase.cpp	(revision 3397)
@@ -1,3 +1,3 @@
-/* $Id: winimagebase.cpp,v 1.14 2000-04-15 21:08:36 bird Exp $ */
+/* $Id: winimagebase.cpp,v 1.15 2000-04-16 04:19:57 bird Exp $ */
 
 /*
@@ -132,5 +132,6 @@
   return 0x40000; //NT 4
 }
-//******************************************************************************
+
+
 /**
  * Finds a executable module (or really any file) using the DLL search order.
@@ -161,7 +162,13 @@
  *                          the name.
  * @param     pszFullname   Pointer to output buffer, this will hold the
- *                          filename upon return.
+ *                          a fully qualified, uppercased, filename upon
+ *                          successful return.
  * @param     cchFullname   Size of the buffer pointer to by pszFullname.
  *                          (A length of at least CCHMAXPATH is recommended.)
+ * @parm      pszAltPath    Pointer to alternate first path. If this is NULL
+ *                          (which is it by default) the executable path
+ *                          is used. If this is specified, this path is used
+ *                          instead. This is intented used to implement the
+ *                          LoadLibraryEx flag LOAD_WITH_ALTERED_SEARCH_PATH.
  *
  * @status    Completely implemented.
@@ -170,5 +177,7 @@
  * @remark
  */
-BOOL Win32ImageBase::findDll(const char *pszFileName, char *pszFullName, int cchFullName)
+BOOL Win32ImageBase::findDll(const char *pszFileName,
+                             char *pszFullName, int cchFullName,
+                             const char *pszAltPath /*=NULL*/)
 {
     BOOL            fRet = FALSE;       /* Return value. (Pessimistic attitude! Init it to FALSE...) */
@@ -249,15 +258,22 @@
         {
             case FINDDLL_EXECUTABLEDIR:
-                //ASSUMES: getFullPath allways returns a fully qualified path, ie. with at least one backslash.
-                //         and that all slashes are backslashes!
-                pszPath = strcpy(plv->szPath, WinExe->getFullPath());
-                psz = strrchr(plv->szPath, '\\');
-                dassert(psz, ("KERNEL32:Win32ImageBase::findDll(%s, 0x%08x, %d): "
-                        "WinExe->getFullPath returned a path not fully qualified: %s",
-                        pszFileName, pszFullName, cchFullName, pszPath));
-                if (psz)
-                    *psz = '\0';
+                if (!pszAltPath)
+                {
+                    /* ASSUMES: getFullPath allways returns a fully qualified
+                     *      path, ie. with at least one backslash. and that all
+                     *      slashes are backslashes!
+                     */
+                    pszPath = strcpy(plv->szPath, WinExe->getFullPath());
+                    psz = strrchr(plv->szPath, '\\');
+                    dassert(psz, ("KERNEL32:Win32ImageBase::findDll(%s, 0x%08x, %d): "
+                            "WinExe->getFullPath returned a path not fully qualified: %s",
+                            pszFileName, pszFullName, cchFullName, pszPath));
+                    if (psz)
+                        *psz = '\0';
+                    else
+                        continue;
+                }
                 else
-                    continue;
+                    pszPath = pszAltPath;
                 break;
 
@@ -327,4 +343,5 @@
                 goto end;
         }
+
 
         /** @sketch
@@ -376,8 +393,9 @@
              *  IF the file exists THEN
              *      Query Fullpath using OS/2 API.
-             *      IF unsuccessfull THEN return relative name.
+             *      IF unsuccessful THEN return relative name.
              *          Check that the fullname buffer is large enough.
              *          Copy the filename found to the fullname buffer.
              *      ENDIF
+             *      IF successful THEN uppercase the fullname buffer.
              *      goto end
              *  ENDIF
@@ -414,4 +432,5 @@
                     }
                 }
+                if (fRet) strupr(pszFullName);
                 goto end;
             }
@@ -429,4 +448,6 @@
     return fRet;
 }
+
+
 //******************************************************************************
 //******************************************************************************
Index: trunk/src/kernel32/winimagebase.h
===================================================================
--- trunk/src/kernel32/winimagebase.h	(revision 3393)
+++ trunk/src/kernel32/winimagebase.h	(revision 3397)
@@ -1,8 +1,8 @@
-/* $Id: winimagebase.h,v 1.3 2000-04-15 21:08:37 bird Exp $ */
+/* $Id: winimagebase.h,v 1.4 2000-04-16 04:19:58 bird Exp $ */
 
 /*
  * Win32 PE Image base class
  *
- * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
+ * Copyright 1998-2000 Sander van Leeuwen (sandervl@xs4all.nl)
  *
  *
@@ -82,5 +82,6 @@
 
 static  BOOL  isPEImage(char *szFileName);
-static  BOOL  findDll(const char *pszFileName, char *pszFullName, int cchFullName);
+static  BOOL  findDll(const char *pszFileName, char *pszFullName,
+                      int cchFullName, const char *pszAltPath = NULL);
 
     void  setEntryPoint(ULONG startAddress) { entryPoint = startAddress; };
