Ignore:
Timestamp:
Oct 25, 2012, 12:39:39 PM (13 years ago)
Author:
dmik
Message:

kernel32: Fix Win32ImageBase::matchModName().

As opposed to the declared functionality, it was comparing the name part
of the argument with the full path of the stored module name and this would
obviously not work if the module name were a full path.

One of the failig cases was a frequent attempt to retrieve the resources of the
current executable by doing LoadLibraryEx() with the full executable name.

File:
1 edited

Legend:

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

    r21648 r22040  
    267267//******************************************************************************
    268268//******************************************************************************
    269 char *OSLibStripPath(char *path)
    270 {
    271   /* @@@PH what does this function do ? Strip the path from a FQFN name ? */
    272   char *pszFilename;
    273   char *pszFilename1;
    274 
    275   pszFilename  = strrchr(path, '\\');                 /* find rightmost backslash */
    276   pszFilename1 = strrchr(path, '/');                  /* find rightmost slash */
    277   if(pszFilename > pszFilename1 && pszFilename != NULL)
    278     return (++pszFilename);              /* return pointer to next character */
    279 
    280   if (pszFilename1 != NULL)
    281     return (++pszFilename1);              /* return pointer to next character */
    282 
    283   return (path);                                     /* default return value */
     269const char *OSLibStripPath(const char *path)
     270{
     271    const char *pszName;
     272    register char ch;
     273
     274    /*
     275     * Search the filename string finding the modulename start and end.
     276     * The loop ends when we have passed one char left of the module name.
     277     */
     278    pszName = path + strlen(path) - 1;
     279    while (pszName >= path
     280           && (ch = *pszName) != '\\'
     281           && ch != '/'
     282           && ch != ':'
     283           )
     284    {
     285        pszName--;
     286    }
     287    pszName++;
     288
     289    return pszName;
    284290}
    285291//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.