Changeset 22028 for trunk/src/peldr/pe.c


Ignore:
Timestamp:
Oct 22, 2012, 2:48:13 PM (13 years ago)
Author:
dmik
Message:

pe: A better fix for adding .EXE than r22016.

It will only add .EXE if there is no (any) extention already specified,
regardless of whether the path is present or not. This matches the
behavior of CMD.EXE on both Windows and OS/2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/peldr/pe.c

    r22016 r22028  
    199199        win32cmdline = pszTemp;
    200200
    201         // add the .EXE extension if missing (only if there's no path)
    202         if (*str_find_char(exeName, '.') == '\0' &&
    203             *str_find_char(exeName, '\\') == '\0' &&
    204             *str_find_char(exeName, '/') == '\0')
     201        // add the .EXE extension if missing (only if there's no extension already)
     202        if (*str_find_last_char(exeName, '.') == '\0')
    205203        {
    206204            int i = strlen(exeName);
    207             if (i < 4 || !((exeName[i-1] == 'E' || exeName[i-1] == 'e') &&
    208                            (exeName[i-2] == 'X' || exeName[i-2] == 'x') &&
    209                            (exeName[i-3] == 'E' || exeName[i-3] == 'e') &&
    210                            exeName[i-4] == '.'))
    211             {
    212                 if (i + 4 < CCHMAXPATH)
    213                     strcat(exeName, ".exe");
    214             }
     205            if (i + 4 < CCHMAXPATH)
     206                strcat(exeName, ".exe");
    215207        }
    216208
Note: See TracChangeset for help on using the changeset viewer.