Ignore:
Timestamp:
Jun 15, 1999, 7:57:34 PM (26 years ago)
Author:
phaller
Message:

Fix: LoadLibraryA not skips specified path to DLL image if loading failed on 1st attempt.

File:
1 edited

Legend:

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

    r99 r108  
    1 /* $Id: wprocess.cpp,v 1.4 1999-06-10 19:09:05 phaller Exp $ */
     1/* $Id: wprocess.cpp,v 1.5 1999-06-15 17:57:34 phaller Exp $ */
    22
    33/*
     
    204204/******************************************************************************/
    205205/******************************************************************************/
    206 HINSTANCE WIN32API LoadLibraryA(LPCTSTR lpszLibFile)
     206static HINSTANCE iLoadLibraryA(LPCTSTR lpszLibFile)
    207207{
    208208 HINSTANCE   hDll;
     
    210210
    211211  hDll = O32_LoadLibrary(lpszLibFile);
    212   dprintf(("KERNEL32:  LoadLibraryA %s returned %X (%d)\n", lpszLibFile, hDll, GetLastError()));
    213   if(hDll) {
     212  dprintf(("KERNEL32:  iLoadLibraryA %s returned %X (%d)\n",
     213           lpszLibFile,
     214           hDll,
     215           GetLastError()));
     216  if(hDll)
     217  {
    214218    return hDll;    //converted dll or win32k took care of it
    215219  }
     
    239243    return module->getInstanceHandle();
    240244  }
    241   else  return(0);
    242 }
     245  else
     246    return(0);
     247}
     248
     249
     250HINSTANCE WIN32API LoadLibraryA(LPCTSTR lpszLibFile)
     251{
     252  HINSTANCE hDll;
     253
     254  dprintf(("KERNEL32:  LoadLibraryA(%s)\n",
     255           lpszLibFile));
     256
     257  hDll = iLoadLibraryA(lpszLibFile);
     258  if (hDll == 0)
     259  {
     260    PSZ pszName;
     261
     262    // remove path from the image name
     263    pszName = strrchr((PSZ)lpszLibFile,
     264                      '\\');
     265    if (pszName != NULL)
     266    {
     267      pszName++;                // skip backslash
     268
     269      // now try again without fully qualified path
     270      hDll = iLoadLibraryA(pszName);
     271    }
     272  }
     273
     274  return hDll;
     275}
     276
     277
    243278//******************************************************************************
    244279//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.