Changeset 910 for trunk/dll/systemf.c


Ignore:
Timestamp:
Jan 6, 2008, 10:53:49 PM (18 years ago)
Author:
Gregg Young
Message:

Cover case where exe without an extention calls a.cmd file. Cleanup error returns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/systemf.c

    r909 r910  
    13491349      tempcom[offset + 4 - pszPgm] = '\0';
    13501350      strcpy(temparg, &pszPgm[offset + 4 - pszPgm]);
    1351       /*if ((offsetexe  && !offsetcom && !offsetcmd && !offsetbtm && !offsetbat) ||
    1352           (offsetcom  && !offsetexe && !offsetcmd && !offsetbtm && !offsetbat) ||
    1353           (offsetcmd  && !offsetexe && !offsetcom && !offsetbtm && !offsetbat) ||
    1354           (offsetbtm  && !offsetexe && !offsetcom && !offsetcmd && !offsetbat) ||
    1355           (offsetbat  && !offsetexe && !offsetcom && !offsetcmd && !offsetbtm))*/
    1356       remove_first_occurence_of_character("\"", tempcom);
    1357       if (strchr(tempcom, '\"') != strrchr(tempcom, '\"'))
    1358         saymsg(MB_OK, HWND_DESKTOP,
    1359                NullStr,
    1360                GetPString(IDS_QUOTESINARGSTEXT),
    1361                pszPgm);
    1362       else
    1363         remove_first_occurence_of_character("\"", tempcom);
     1351      while (strchr(tempcom, '\"'))
     1352           remove_first_occurence_of_character("\"", tempcom);
    13641353      if ((temparg[0] == '\"' && temparg[1] == ' ') ||
    13651354           !strstr(pszPgm, "\\:")||
     
    13711360               GetPString(IDS_QUOTESINARGSTEXT),
    13721361               pszPgm);
    1373       if (!strstr(strlwr(tempcom), ".exe")) {
     1362      if (!offsetexe) {
    13741363        ret = DosFindFirst(tempcom, &hdirFindHandle, FILE_NORMAL, &FindBuffer,
    13751364                           ulResultBufLen, &ulFindCount, FIL_STANDARD);
    1376         BldQuotedFileName(szTempPgm, tempcom);
    1377       }
    1378       else{
    1379         BldQuotedFileName(szTempPgm, tempcom);
     1365        if (ret){
     1366          pszChar = tempcom;
     1367          while (pszChar){
     1368            if (*pszChar == ' '){
     1369              *pszChar = '\0';
     1370              strcat(tempcom, ".exe");
     1371              ret = DosQueryAppType(tempcom, &ulAppType);
     1372              //printf("%d %s\n", ret, tempcom); fflush(stdout);
     1373              if (!ret){
     1374                strcpy(temparg, pszPgm + strlen(tempcom) - 3);
     1375                break;
     1376              }
     1377            }
     1378            strcpy(tempcom, pszPgm);
     1379            pszChar++;
     1380          }
     1381        }
     1382      }
     1383      else
    13801384        ret = DosQueryAppType(tempcom, &ulAppType);
    1381       }
     1385      BldQuotedFileName(szTempPgm, tempcom);
    13821386      //printf("%d A", ret); fflush(stdout);
    13831387      if (ret) {
     
    13881392                     pszPgm);
    13891393        if (ret == MBID_YES){
    1390           if (temparg[0] != ' ')
    1391             strcat(szTempPgm, " ");
    1392           strcat(szTempPgm, temparg);
    1393           pszQuotedCompletePgm = szTempPgm;
     1394          pszQuotedCompletePgm = pszPgm;
    13941395        }
    13951396        else{
     
    14911492                   pszPgm);
    14921493      if (ret == MBID_YES){
    1493         if (temparg[0] != ' ')
    1494           strcat(szTempPgm, " ");
    1495         strcat(szTempPgm, temparg);
    1496         pszQuotedCompletePgm = szTempPgm;
     1494        pszQuotedCompletePgm = pszPgm;
    14971495      }
    14981496      else{
     
    15011499      }
    15021500    }
    1503     ret = saymsg(MB_YESNO,
     1501    ret = saymsg(MB_YESNOCANCEL,
    15041502                   HWND_DESKTOP,
    15051503                   NullStr,
    15061504                   GetPString(IDS_PROGRAMNOTEXE3TEXT),
    1507                    pszPgm);
     1505                   pszPgm, szTempPgm);
    15081506      if (ret == MBID_YES){
    15091507        if (temparg[0] != ' ')
     
    15121510        pszQuotedCompletePgm = szTempPgm;
    15131511      }
    1514       else{
     1512      if (ret == MBID_CANCEL){
    15151513        fCancelAction = TRUE;
    15161514        pszQuotedCompletePgm = pszPgm;
    15171515      }
     1516      else
     1517        pszQuotedCompletePgm = pszPgm;
    15181518    }
    15191519    return pszQuotedCompletePgm;
Note: See TracChangeset for help on using the changeset viewer.