Changeset 7970 for trunk/src


Ignore:
Timestamp:
Feb 20, 2002, 10:45:49 AM (24 years ago)
Author:
sandervl
Message:

DF: Added support for WINDOWSPATH environment variable; PE searches for executables in directories listed in WINDOWSPATH

File:
1 edited

Legend:

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

    r6325 r7970  
    1 /* $Id: pe.cpp,v 1.31 2001-07-14 07:44:40 sandervl Exp $ */
     1/* $Id: pe.cpp,v 1.32 2002-02-20 09:45:49 sandervl Exp $ */
    22
    33/*
     
    155155                while(*cmdline == ' ') cmdline--;
    156156                cmdline[1] = 0;
    157                 if(DosQueryPathInfo(exeName, FIL_QUERYFULLNAME, (PVOID)fullpath, sizeof(fullpath)) == 0) {
    158                         strcpy(exeName, fullpath);
    159                 }
     157
     158                char drive[_MAX_DRIVE];
     159                char dir[_MAX_DIR];
     160                char fname[_MAX_FNAME];
     161                char ext[_MAX_EXT];
     162                char exeShortName[_MAX_FNAME+_MAX_EXT];
     163                _splitpath(exeName, drive, dir, fname, ext);
     164
     165                strcpy(fullpath, drive);
     166                strcat(fullpath, dir);
     167
     168                strcpy(exeShortName, fname);
     169                strcat(exeShortName, ext);
     170
     171                if ( strlen(fullpath) == 0 ) {
     172                        DosSearchPath( SEARCH_CUR_DIRECTORY | SEARCH_ENVIRONMENT | SEARCH_IGNORENETERRS
     173                                     , "WINDOWSPATH"           /* environment value */
     174                                     , exeShortName            /* Name of file to look for */
     175                                     , exeName                 /* Result of the search     */
     176                                     , sizeof(exeName)         /* Length of search buffer  */
     177                                     );
     178                }
     179
    160180                FILESTATUS3 fstat3;
    161181                if(DosQueryPathInfo(exeName, FIL_STANDARD, (PVOID)&fstat3, sizeof(fstat3)))
Note: See TracChangeset for help on using the changeset viewer.