Changeset 3397 for trunk/src


Ignore:
Timestamp:
Apr 16, 2000, 6:19:58 AM (25 years ago)
Author:
bird
Message:

Added parameter pszAltPath to findDll.

Location:
trunk/src/kernel32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winimagebase.cpp

    r3391 r3397  
    1 /* $Id: winimagebase.cpp,v 1.14 2000-04-15 21:08:36 bird Exp $ */
     1/* $Id: winimagebase.cpp,v 1.15 2000-04-16 04:19:57 bird Exp $ */
    22
    33/*
     
    132132  return 0x40000; //NT 4
    133133}
    134 //******************************************************************************
     134
     135
    135136/**
    136137 * Finds a executable module (or really any file) using the DLL search order.
     
    161162 *                          the name.
    162163 * @param     pszFullname   Pointer to output buffer, this will hold the
    163  *                          filename upon return.
     164 *                          a fully qualified, uppercased, filename upon
     165 *                          successful return.
    164166 * @param     cchFullname   Size of the buffer pointer to by pszFullname.
    165167 *                          (A length of at least CCHMAXPATH is recommended.)
     168 * @parm      pszAltPath    Pointer to alternate first path. If this is NULL
     169 *                          (which is it by default) the executable path
     170 *                          is used. If this is specified, this path is used
     171 *                          instead. This is intented used to implement the
     172 *                          LoadLibraryEx flag LOAD_WITH_ALTERED_SEARCH_PATH.
    166173 *
    167174 * @status    Completely implemented.
     
    170177 * @remark
    171178 */
    172 BOOL Win32ImageBase::findDll(const char *pszFileName, char *pszFullName, int cchFullName)
     179BOOL Win32ImageBase::findDll(const char *pszFileName,
     180                             char *pszFullName, int cchFullName,
     181                             const char *pszAltPath /*=NULL*/)
    173182{
    174183    BOOL            fRet = FALSE;       /* Return value. (Pessimistic attitude! Init it to FALSE...) */
     
    249258        {
    250259            case FINDDLL_EXECUTABLEDIR:
    251                 //ASSUMES: getFullPath allways returns a fully qualified path, ie. with at least one backslash.
    252                 //         and that all slashes are backslashes!
    253                 pszPath = strcpy(plv->szPath, WinExe->getFullPath());
    254                 psz = strrchr(plv->szPath, '\\');
    255                 dassert(psz, ("KERNEL32:Win32ImageBase::findDll(%s, 0x%08x, %d): "
    256                         "WinExe->getFullPath returned a path not fully qualified: %s",
    257                         pszFileName, pszFullName, cchFullName, pszPath));
    258                 if (psz)
    259                     *psz = '\0';
     260                if (!pszAltPath)
     261                {
     262                    /* ASSUMES: getFullPath allways returns a fully qualified
     263                     *      path, ie. with at least one backslash. and that all
     264                     *      slashes are backslashes!
     265                     */
     266                    pszPath = strcpy(plv->szPath, WinExe->getFullPath());
     267                    psz = strrchr(plv->szPath, '\\');
     268                    dassert(psz, ("KERNEL32:Win32ImageBase::findDll(%s, 0x%08x, %d): "
     269                            "WinExe->getFullPath returned a path not fully qualified: %s",
     270                            pszFileName, pszFullName, cchFullName, pszPath));
     271                    if (psz)
     272                        *psz = '\0';
     273                    else
     274                        continue;
     275                }
    260276                else
    261                     continue;
     277                    pszPath = pszAltPath;
    262278                break;
    263279
     
    327343                goto end;
    328344        }
     345
    329346
    330347        /** @sketch
     
    376393             *  IF the file exists THEN
    377394             *      Query Fullpath using OS/2 API.
    378              *      IF unsuccessfull THEN return relative name.
     395             *      IF unsuccessful THEN return relative name.
    379396             *          Check that the fullname buffer is large enough.
    380397             *          Copy the filename found to the fullname buffer.
    381398             *      ENDIF
     399             *      IF successful THEN uppercase the fullname buffer.
    382400             *      goto end
    383401             *  ENDIF
     
    414432                    }
    415433                }
     434                if (fRet) strupr(pszFullName);
    416435                goto end;
    417436            }
     
    429448    return fRet;
    430449}
     450
     451
    431452//******************************************************************************
    432453//******************************************************************************
  • trunk/src/kernel32/winimagebase.h

    r3391 r3397  
    1 /* $Id: winimagebase.h,v 1.3 2000-04-15 21:08:37 bird Exp $ */
     1/* $Id: winimagebase.h,v 1.4 2000-04-16 04:19:58 bird Exp $ */
    22
    33/*
    44 * Win32 PE Image base class
    55 *
    6  * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
     6 * Copyright 1998-2000 Sander van Leeuwen (sandervl@xs4all.nl)
    77 *
    88 *
     
    8282
    8383static  BOOL  isPEImage(char *szFileName);
    84 static  BOOL  findDll(const char *pszFileName, char *pszFullName, int cchFullName);
     84static  BOOL  findDll(const char *pszFileName, char *pszFullName,
     85                      int cchFullName, const char *pszAltPath = NULL);
    8586
    8687    void  setEntryPoint(ULONG startAddress) { entryPoint = startAddress; };
Note: See TracChangeset for help on using the changeset viewer.