Changeset 888


Ignore:
Timestamp:
Dec 22, 2007, 11:02:11 PM (18 years ago)
Author:
Gregg Young
Message:

runemf2 now quotes executable strings if needed (Ticket 180); it also reports where it was called from on errors

Location:
trunk
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • trunk/HISTORY

    r882 r888  
    22
    333.09(pre)
     4 o Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun (Gregg)
    45 o Update CopyPresParams to copy all types of pres parameters (Gregg)
    56 o Add "Save as" menu item to internal viewer (Gregg)
  • trunk/dll/arccnrs.c

    r872 r888  
    194194          if (*binview)
    195195            ExecOnList((HWND) 0, binview, WINDOWED | SEPARATE, NULL, list,
    196                        NULL);
     196                       NULL, pszSrcFile, __LINE__);
    197197          else
    198198            StartMLEEditor(HWND_DESKTOP, 16 + 4 + 1, ad->arcname, hwnd);
     
    201201          if (*viewer) {
    202202            ExecOnList((HWND) 0, viewer, WINDOWED | SEPARATE |
    203                         (fViewChild ? CHILD : 0),
    204                        NULL, list, NULL);
     203                            (fViewChild ? CHILD : 0),
     204                             NULL, list, NULL, pszSrcFile, __LINE__);
    205205          }
    206206          else
     
    213213      ad = WinQueryWindowPtr(hwnd, QWL_USER);
    214214      runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
    215               hwnd, NULL, NULL,
     215              hwnd, pszSrcFile, __LINE__, NULL, NULL,
    216216              "%s %s",
    217217              ad->info->test,
    218218              BldQuotedFileName(szQuotedArcName, ad->arcname));
    219       // runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
    220       //              hwnd, NULL, NULL, "%s %s%s%s", ad->info->test,
    221               // needs_quoting(ad->arcname) ? "\"" : NullStr,
    222               // ad->arcname,
    223               // needs_quoting(ad->arcname) ? "\"" : NullStr);
    224219      break;
    225220    }
     
    544539      p = GetCmdSpec(TRUE);
    545540      runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT,
    546               hwndCnr, NULL, "DOS_BACKGROUND_EXECUTION=1",
     541              hwndCnr, pszSrcFile, __LINE__, NULL, "DOS_BACKGROUND_EXECUTION=1",
    547542              "%s /C %s %s >%s",
    548543              p,                        // shell
     
    550545              BldQuotedFileName(s, arcname),
    551546              arctemp);
    552       // runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT,
    553       //              hwndCnr,
    554       //              NULL,
    555       //              "DOS_BACKGROUND_EXECUTION=1",
    556       //              "%s /C %s %s%s%s > %s",
    557       //              p,
    558       //              info->list,
    559       //              needs_quoting(arcname) ? "\"" : NullStr,
    560       //              arcname,
    561       //              needs_quoting(arcname) ? "\"" : NullStr,
    562       //              arctemp);
    563547    }
    564548    else {
     
    586570          else {
    587571            runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT,
    588                     hwndCnr, NULL, NULL,
     572                    hwndCnr, pszSrcFile, __LINE__, NULL, NULL,
    589573                    "%s %s",
    590574                    info->list,
    591575                    BldQuotedFileName(s, arcname));
    592             // runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT,
    593             //      hwndCnr, NULL, NULL, "%s %s%s%s", info->list,
    594             //      needs_quoting(arcname) ? "\"" : NullStr,
    595             //      arcname,
    596             //      needs_quoting(arcname) ? "\"" : NullStr);
    597576            oldstdout = fileno(stdout);
    598577            DosError(FERR_DISABLEHARDERR);
     
    13861365          // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%s %s %s\r[%s]",dcd->info->extract,dcd->arcname,membername,construct);
    13871366          runemf2(SEPARATE | WINDOWED | WAIT |
    1388                     (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    1389                   dcd->hwndClient, construct, NULL,
     1367                  (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
     1368                  dcd->hwndClient, pszSrcFile, __LINE__, construct, NULL,
    13901369                  "%s %s %s",
    13911370                  dcd->info->extract,
    13921371                  BldQuotedFileName(szQuotedArcName, dcd->arcname),
    13931372                  BldQuotedFileName(szQuotedMemberName, membername));
    1394           // runemf2(SEPARATE | WINDOWED | WAIT |
    1395           //        (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
    1396           //        WAIT,
    1397           //      dcd->hwndClient, construct, NULL, "%s %s%s%s %s%s%s",
    1398           //      dcd->info->extract,
    1399           //      needs_quoting(dcd->arcname) ? "\"" : NullStr,
    1400           //      dcd->arcname,
    1401           //      needs_quoting(dcd->arcname) ? "\"" : NullStr,
    1402           //      needs_quoting(membername) ? "\"" : NullStr,
    1403           //      membername,
    1404           //      needs_quoting(membername) ? "\"" : NullStr);
    14051373          BldFullPathName(construct, construct, membername);
    1406           // if (*construct && construct[strlen(construct) - 1] != '\\')
    1407           //   strcat(construct, "\\");
    1408           // strcat(construct, membername);
    14091374          if (IsFile(construct) != -1) {
    14101375            rename(construct, filename);
     
    15221487        }
    15231488        runemf2(SEPARATE | WINDOWED | WAIT |
    1524                   (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    1525                 dcd->hwndClient, dcd->workdir, NULL,
     1489                (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
     1490                dcd->hwndClient, pszSrcFile, __LINE__, dcd->workdir, NULL,
    15261491                "%s %s %s",
    15271492                dcd->info->exwdirs ? dcd->info->exwdirs :
     
    15291494                BldQuotedFileName(szQuotedArcName, dcd->arcname),
    15301495                BldQuotedFileName(szQuotedMemberName, s));
    1531         // runemf2(SEPARATE | WINDOWED |
    1532         //        (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
    1533         //        WAIT,
    1534         //      dcd->hwndClient, dcd->workdir, NULL, "%s %s%s%s %s%s%s",
    1535         //      dcd->info->exwdirs ? dcd->info->exwdirs :
    1536         //                           dcd->info->extract,
    1537         //      needs_quoting(dcd->arcname) ? "\"" : NullStr,
    1538         //      dcd->arcname,
    1539         //      needs_quoting(dcd->arcname) ? "\"" : NullStr,
    1540         //      needs_quoting(s) ? "\"" : NullStr,
    1541         //      s,
    1542         //      needs_quoting(s) ? "\"" : NullStr);
    15431496        if (!dcd->info->exwdirs) {
    15441497          p = s;
     
    16071560
    16081561            BldQuotedFileName(szBuffer + strlen(szBuffer), ad.arcname);
    1609             // if (needs_quoting(ad.arcname))
    1610             //   strcat(szBuffer, "\"");
    1611             // strcat(szBuffer, ad.arcname);
    1612             // if (needs_quoting(ad.arcname))
    1613             //   strcat(szBuffer, "\"");
    16141562
    16151563            p = &szBuffer[strlen(szBuffer)];    // Remeber where archiver name ends
     
    16191567
    16201568              BldQuotedFileName(szBuffer + strlen(szBuffer), ad.mask.szMask);
    1621               // if (needs_quoting(ad.mask.szMask))
    1622               //        strcat(szBuffer, "\"");
    1623               // strcat(szBuffer, ad.mask.szMask);
    1624               // if (needs_quoting(ad.mask.szMask))
    1625               //        strcat(szBuffer, "\"");
    16261569            }
    16271570            strcat(szBuffer, " ");
     
    16321575
    16331576              if (IsFile(li->list[x]))
    1634                 BldQuotedFileName(szBuffer + strlen(szBuffer), li->list[x]);
     1577                BldQuotedFileName(szBuffer + strlen(szBuffer), li->list[x]);
    16351578              else
    1636                 BldQuotedFullPathName(szBuffer + strlen(szBuffer), li->list[x], "*");
    1637 
    1638               // if (needs_quoting(li->list[x]))
    1639               //        strcat(szBuffer, "\"");
    1640               // strcat(szBuffer, li->list[x]);
    1641               // if (!IsFile(li->list[x])) {
    1642               //        if (szBuffer[strlen(szBuffer) - 1] != '\\')
    1643               //          strcat(szBuffer, "\\");
    1644               //        strcat(szBuffer, "*");
    1645               // }
    1646               // if (needs_quoting(li->list[x]))
    1647               //        strcat(szBuffer, "\"");
     1579                 BldQuotedFullPathName(szBuffer + strlen(szBuffer), li->list[x], "*");
    16481580
    16491581              x++;
     
    16511583                  strlen(li->list[x]) + 5 > 1024) {
    16521584                runemf2(SEPARATE | WINDOWED |
    1653                           (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
    1654                           WAIT,
    1655                         hwnd, NULL, NULL, "%s", szBuffer);
     1585                        (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
     1586                        WAIT, hwnd, pszSrcFile, __LINE__,
     1587                        NULL, NULL, "%s", szBuffer);
    16561588                *p = 0;
    16571589              }
     
    17031635            strcat(cl, " ");
    17041636            BldQuotedFileName(cl + strlen(cl), dcd->arcname);
    1705             // if (li->type == IDM_DELETE)
    1706             //   sprintf(cl, "%s %s%s%s", dcd->info->delete,
    1707             //        (needs_quoting(dcd->arcname)) ? "\"" : NullStr,
    1708             //        dcd->arcname,
    1709             //        (needs_quoting(dcd->arcname)) ? "\"" : NullStr);
    1710             // else
    1711             //   sprintf(cl, "%s %s%s%s", dcd->info->create,
    1712             //        (needs_quoting(dcd->arcname)) ? "\"" : NullStr,
    1713             //        dcd->arcname,
    1714             //        (needs_quoting(dcd->arcname)) ? "\"" : NullStr);
    17151637            endofit = &cl[strlen(cl)];
    17161638            z = 0;
    17171639            do {
    17181640              for (x = z; li->list[x] &&
    1719                    strlen(cl) + strlen(li->list[x]) < 999; x++) {
     1641                strlen(cl) + strlen(li->list[x]) < 999; x++) {
    17201642                strcat(cl, " ");
    17211643                BldQuotedFileName(cl + strlen(cl), li->list[x]);
    1722                 // if (needs_quoting(li->list[x]))
    1723                 //   strcat(cl, "\"");
    1724                 // strcat(cl, li->list[x]);
    1725                 // if (needs_quoting(li->list[x]))
    1726                 //   strcat(cl, "\"");
    17271644              }
    17281645              z = x;
    17291646              runemf2(SEPARATE | WINDOWED | WAIT |
    1730                         (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    1731                       hwnd, NullStr, NULL, "%s", cl);
     1647                      (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
     1648                      hwnd, pszSrcFile, __LINE__, NullStr, NULL, "%s", cl);
    17321649              *endofit = 0;
    17331650            } while (li->list[x]);
     
    18341751             strcat(cl, " ");
    18351752             BldQuotedFileName(cl + strlen(cl), li->arcname);
    1836             // sprintf(cl, "%s %s%s%s", (li->type == IDM_EXTRACT ||
    1837             //                        ((li->type == IDM_VIEW
    1838             //                          || li->type == IDM_VIEWTEXT
    1839             //                          || li->type == IDM_VIEWBINARY
    1840             //                          || li->type == IDM_VIEWARCHIVE
    1841             //                          || li->type == IDM_PRINT
    1842             //                          || li->type == IDM_EDIT
    1843             //                          || li->type == IDM_EDITTEXT
    1844             //                          || li->type == IDM_EDITBINARY
    1845             //                          && li->type == IDM_MCIPLAY)
    1846             //                         && !li->info->exwdirs)) ? li->info->
    1847             //      extract : li->info->exwdirs,
    1848             //      needs_quoting(li->arcname) ? "\"" : NullStr,
    1849             //      li->arcname,
    1850             //      needs_quoting(li->arcname) ? "\"" : NullStr);
    1851             endofit = &cl[strlen(cl)];
    1852             z = 0;
    1853             do {
    1854               for (x = z; li->list[x] &&
     1753             endofit = &cl[strlen(cl)];
     1754             z = 0;
     1755             do {
     1756               for (x = z; li->list[x] &&
    18551757                   strlen(cl) + strlen(li->list[x]) < 999; x++) {
    18561758                strcat(cl, " ");
    18571759                BldQuotedFileName(cl + strlen(cl), li->list[x]);
    1858                 // if (needs_quoting(li->list[x]))
    1859                 //   strcat(cl, "\"");
    1860                 // strcat(cl, li->list[x]);
    1861                 // if (needs_quoting(li->list[x]))
    1862                 //   strcat(cl, "\"");
    18631760                ptr = li->list[x];
    18641761                while (*ptr) {
     
    18701767              z = x;
    18711768              runemf2(SEPARATE | WINDOWED |
    1872                         (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
    1873                         WAIT,
    1874                       hwnd, li->targetpath, NULL, "%s", cl);
     1769                      (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
     1770                      WAIT, hwnd, pszSrcFile, __LINE__,
     1771                      li->targetpath, NULL, "%s", cl);
    18751772              *endofit = 0;
    18761773            } while (li->list[x]);
     
    19301827                         WINDOWED | SEPARATEKEEP | PROMPT,
    19311828                         li->targetpath,
    1932                          NULL, GetPString(IDS_EXECARCFILETITLETEXT));
     1829                         NULL, GetPString(IDS_EXECARCFILETITLETEXT),
     1830                         pszSrcFile, __LINE__);
    19331831            else if (li->type == IDM_VIRUSSCAN)
    19341832              ExecOnList(hwnd, virus, PROMPT | WINDOWED | SEPARATEKEEP,
    19351833                         li->targetpath, NULL,
    1936                          GetPString(IDS_VIRUSSCANARCHIVETITLETEXT));
     1834                         GetPString(IDS_VIRUSSCANARCHIVETITLETEXT),
     1835                         pszSrcFile, __LINE__);
    19371836            else if (li->type == IDM_VIEW || li->type == IDM_VIEWTEXT ||
    19381837                     li->type == IDM_VIEWBINARY || li->type == IDM_EDIT ||
     
    20351934                                  bined),
    20361935                           WINDOWED | SEPARATE, li->targetpath, li->list,
    2037                            NULL);
     1936                           NULL, pszSrcFile, __LINE__);
    20381937              }
    20391938              else {
     
    29352834        if (dcd->info->extract)
    29362835          runemf2(SEPARATE | WINDOWED |
    2937                     (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    2938                   hwnd, dcd->directory, NULL, "%s %s",
    2939                   dcd->info->extract,
     2836                  (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
     2837                  hwnd, pszSrcFile, __LINE__,
     2838                  dcd->directory, NULL, "%s %s", dcd->info->extract,
    29402839                  BldQuotedFileName(szQuotedArcName, dcd->arcname));
    2941           // runemf2(SEPARATE | WINDOWED |
    2942           //        (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    2943           //      hwnd, dcd->directory, NULL, "%s %s%s%s",
    2944           //      dcd->info->extract,
    2945           //      needs_quoting(dcd->arcname) ? "\"" : NullStr,
    2946           //      dcd->arcname,
    2947           //      needs_quoting(dcd->arcname) ? "\"" : NullStr);
    29482840        if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTEXIT)
    29492841          PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
     
    29542846        if (dcd->info->exwdirs)
    29552847          runemf2(SEPARATE | WINDOWED |
    2956                     (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    2957                   hwnd, dcd->directory, NULL,
    2958                   "%s %s",
     2848                  (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
     2849                  hwnd, pszSrcFile, __LINE__,
     2850                  dcd->directory, NULL, "%s %s",
    29592851                  dcd->info->exwdirs,
    29602852                  BldQuotedFileName(szQuotedArcName, dcd->arcname));
    2961           // runemf2(SEPARATE | WINDOWED |
    2962           //        (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    2963           //      hwnd, dcd->directory, NULL, "%s %s%s%s",
    2964           //      dcd->info->exwdirs,
    2965           //      needs_quoting(dcd->arcname) ? "\"" : NullStr,
    2966           //      dcd->arcname,
    2967           //      needs_quoting(dcd->arcname) ? "\"" : NullStr);
    29682853        if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTWDIRSEXIT)
    29692854          PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
     
    30332918        if (dcd->info->test)
    30342919          runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
    3035                   hwnd, NULL, NULL,
     2920                  hwnd, pszSrcFile, __LINE__, NULL, NULL,
    30362921                  "%s %s",dcd->info->test,
    30372922                  BldQuotedFileName(szQuotedArcName, dcd->arcname));
    3038           // runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
    3039           //      hwnd, NULL, NULL, "%s %s%s%s",dcd->info->test,
    3040           //      needs_quoting(dcd->arcname) ? "\"" : NullStr,
    3041           //      dcd->arcname,
    3042           //      needs_quoting(dcd->arcname) ? "\"" : NullStr);
    30432923        break;
    30442924
  • trunk/dll/archive.c

    r793 r888  
    264264            *p = 0;
    265265          ExecOnList(hwnd, s, WINDOWED | SEPARATEKEEP | MAXIMIZED | PROMPT,
    266                      NULL, NULL, GetPString(IDS_ARCEXECHELPTEXT));
     266                     NULL, NULL, GetPString(IDS_ARCEXECHELPTEXT),
     267                     pszSrcFile, __LINE__);
    267268        }
    268269        else
  • trunk/dll/assoc.c

    r834 r888  
    419419                        info->cl,
    420420                        flags,
    421                         NULL, list, GetPString(IDS_EXECASSOCTITLETEXT));
     421                        NULL, list, GetPString(IDS_EXECASSOCTITLETEXT),
     422                        pszSrcFile, __LINE__);
    422423        if (rc != -1 && dieafter)
    423424          PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
     
    613614    case ASS_FIND:
    614615      {
    615         CHAR filename[CCHMAXPATH + 9];
     616        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    616617
    617618        *filename = 0;
    618         if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    619           strcat(filename, " %a");
    620           WinSetDlgItemText(hwnd, ASS_CL, filename);
     619        if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     620          BldQuotedFileName(szfilename, filename);
     621          strcat(szfilename, " %a");
     622          WinSetDlgItemText(hwnd, ASS_CL, szfilename);
    621623        }
    622624      }
  • trunk/dll/avv.c

    r793 r888  
    797797                          CmdLineDlgProc, FM3ModHandle, EXEC_FRAME, &ex) == 1)
    798798              runemf2(ex.flags,
    799                       hwnd,
     799                      hwnd, pszSrcFile, __LINE__,
    800800                      NULL,
    801801                      (*ex.environment) ? ex.environment : NULL,
  • trunk/dll/collect.c

    r872 r888  
    23002300                strcat(li->targetpath, " %a");
    23012301                ExecOnList(dcd->hwndParent, li->targetpath,
    2302                            PROMPT | WINDOWED, NULL, li->list, NULL);
     2302                           PROMPT | WINDOWED, NULL, li->list, NULL,
     2303                           pszSrcFile, __LINE__);
    23032304                FreeList(li->list);
    23042305                li->list = NULL;
  • trunk/dll/command.c

    r793 r888  
    561561    case CMD_FIND:
    562562      {
    563         CHAR filename[CCHMAXPATH + 9];
     563        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    564564
    565565        *filename = 0;
    566         if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    567           strcat(filename, " %a");
    568           WinSetDlgItemText(hwnd, CMD_CL, filename);
     566        if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     567          BldQuotedFileName(szfilename, filename);
     568          strcat(szfilename, " %a");
     569          WinSetDlgItemText(hwnd, CMD_CL, szfilename);
    569570        }
    570571      }
     
    937938        ExecOnList(hwnd,
    938939                   info->cl,
    939                    flags, NULL, fakelist, GetPString(IDS_EXECCMDTITLETEXT));
     940                   flags, NULL, fakelist, GetPString(IDS_EXECCMDTITLETEXT),
     941                   pszSrcFile, __LINE__);
    940942      }
    941943    }
     
    943945      ExecOnList(hwnd,
    944946                 info->cl,
    945                  flags, NULL, list, GetPString(IDS_EXECCMDTITLETEXT));
     947                 flags, NULL, list, GetPString(IDS_EXECCMDTITLETEXT),
     948                 pszSrcFile, __LINE__);
    946949  }
    947950  FreeList(list);
  • trunk/dll/common.c

    r844 r888  
    244244  case IDM_CHKDSK:
    245245    runemf2(SEPARATE | WINDOWED,
    246             hwnd, NULL, NULL, "PMCHKDSK.EXE %c:", toupper(*dv));
     246            hwnd, pszSrcFile, __LINE__, NULL, NULL,
     247            "PMCHKDSK.EXE %c:", toupper(*dv));
    247248    break;
    248249  case IDM_OPTIMIZE:
     
    255256        strcat(FileSystem, "OPT.CMD");
    256257        runemf2(SEPARATE | WINDOWED,
    257                 hwnd,
     258                hwnd, pszSrcFile, __LINE__,
    258259                NULL,
    259260                NULL,
     
    264265  case IDM_FORMAT:
    265266    runemf2(SEPARATE | WINDOWED,
    266             hwnd, NULL, NULL, "PMFORMAT.EXE %c:", toupper(*dv));
     267            hwnd, pszSrcFile, __LINE__, NULL, NULL,
     268            "PMFORMAT.EXE %c:", toupper(*dv));
    267269    break;
    268270
     
    788790    assign_ignores(s);
    789791    runemf2(WINDOWED | SEPARATE,
    790             hwnd,
     792            hwnd, pszSrcFile, __LINE__,
    791793            NULL,
    792794            NULL,
  • trunk/dll/comp.c

    r850 r888  
    21742174            fakelist[2] = NULL;
    21752175            ExecOnList(hwnd, compare,
    2176                        WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL);
     2176                       WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL,
     2177                       pszSrcFile, __LINE__);
    21772178          }
    21782179          else {
  • trunk/dll/datamin.c

    r841 r888  
    429429          type = SEPARATE | FULLSCREEN;
    430430        }
    431         runemf2(type, hwnd, path, NULL, "%s", env);
     431        runemf2(type, hwnd, pszSrcFile, __LINE__,
     432                path, NULL, "%s", env);
    432433      }
    433434      break;
  • trunk/dll/defview.c

    r887 r888  
    1616  09 Jun 07 SHL ShowMultimedia: Initialize hwnd so that OpenObject might work
    1717  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
     18  20 Dec 07 GKY Open jpg files with OS2 object default since image.exe fails
    1819
    1920***********************************************************************/
  • trunk/dll/dircnrs.c

    r877 r888  
    17271727                  dummy[1] = NULL;
    17281728                  ExecOnList(hwnd,
    1729                              editor, WINDOWED | SEPARATE, NULL, dummy, NULL);
     1729                             editor, WINDOWED | SEPARATE, NULL, dummy, NULL,
     1730                             pszSrcFile, __LINE__);
    17301731                }
    17311732                else
     
    28872888              strcat(li->targetpath, " %a");
    28882889              ExecOnList(dcd->hwndParent, li->targetpath,
    2889                          PROMPT | WINDOWED, NULL, li->list, NULL);
     2890                         PROMPT | WINDOWED, NULL, li->list, NULL,
     2891                         pszSrcFile, __LINE__);
    28902892              FreeList(li->list);
    28912893              li->list = NULL;
  • trunk/dll/extract.c

    r793 r888  
    393393                        FM3ModHandle, EXEC_FRAME, MPFROMP(&ex)) && *s) {
    394394            runemf2(ex.flags,
    395                     hwnd,
     395                    hwnd, pszSrcFile, __LINE__,
    396396                    NULL, (*ex.environment) ? ex.environment : NULL, "%s", s);
    397397          }
  • trunk/dll/filter.c

    r834 r888  
    153153        }
    154154      }
    155     }
     155    }  //while
    156156    fclose(fp);
    157157  }
  • trunk/dll/fm3dll.h

    r886 r888  
    6565  10 Nov 07 GKY Add ThousandSeparator variable for file sizes NLS tseparator.
    6666  22 Nov 07 GKY Use CopyPresParams in CheckMenu to fix presparam inconsistencies in menus
     67  17 Dec 07 GKY Add variables for using WPURLDEFAULTSETTINGS as the fall back for ftphttprun
    6768
    6869***********************************************************************/
     
    902903BOOL ShowSession(HWND hwnd, PID pid);
    903904INT ExecOnList(HWND hwnd, CHAR * command, INT flags, CHAR * tpath,
    904                CHAR ** list, CHAR * prompt);
    905 INT runemf2(INT type, HWND hwnd, CHAR * directory, CHAR * environment,
     905               CHAR ** list, CHAR * prompt, PCSZ pszCallingFile, UINT uiLineNumber);
     906INT runemf2(INT type, HWND hwnd, PCSZ pszCallingFile, UINT uiLineNumber,
     907            CHAR * directory, CHAR * environment,
    906908            CHAR * formatstring, ...);
    907909HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env,
  • trunk/dll/fm3dll.str

    r878 r888  
    5885881381 China GB
    5895890
    590 DosStartSession failed to run "%s %s"
    591 DosExecPgm failed for %s.
     590DosStartSession failed to run "%s %s"\n called from %s %d.
     591DosExecPgm failed for %s.\n called from %s %d.
    592592We are all Books of Blood.
    593593"Is THIS your card?"
     
    996996Can't find drive %s
    997997Can't drag root directory
    998 DosQAppType failed for %s.
    999 apptype 0x%x unexpected for %s.
     998DosQAppType failed for %s\n called from %s %d.
     999apptype 0x%x unexpected for %s.\n called from %s %d.
    10001000%c:\\DESKTOP
    10011001FM/2: Drive info "%c:"
  • trunk/dll/init.c

    r886 r888  
    3838  10 Nov 07 GKY Get thousands separator from country info for file sizes.
    3939  26 Nov 07 GKY Eliminate check of ext path on start up
     40  17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun
    4041
    4142***********************************************************************/
  • trunk/dll/instant.c

    r793 r888  
    144144                fclose(fp);
    145145                runemf2(WINDOWED | SEPARATE,
    146                         hwnd,
     146                        hwnd, pszSrcFile, __LINE__,
    147147                        path, NULL, "%s /C \"%s\"", GetCmdSpec(FALSE), s);
    148148              }
     
    168168      if (rc == MBID_YES)
    169169        runemf2(WINDOWED | INVISIBLE | BACKGROUND,
    170                 hwnd, NULL, NULL, "%s /C HELP BATCH", GetCmdSpec(FALSE));
     170                hwnd, pszSrcFile, __LINE__, NULL, NULL,
     171                "%s /C HELP BATCH", GetCmdSpec(FALSE));
    171172      else if (rc == MBID_CANCEL)
    172173        WinDismissDlg(hwnd, 0);
  • trunk/dll/killproc.c

    r830 r888  
    236236    DosDupHandle(fileno(fp), &oldstdout);
    237237    rc = runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT,
    238                  hwnd, NULL, NULL, "%s", "PSTAT.EXE /C");
     238                 hwnd, pszSrcFile, __LINE__, NULL, NULL,
     239                 "%s", "PSTAT.EXE /C");
    239240    oldstdout = fileno(stdout);
    240241    DosDupHandle(newstdout, &oldstdout);
  • trunk/dll/mainwnd.c

    r877 r888  
    15921592                       WINDOWED | ((fKeepCmdLine) ?
    15931593                                   SEPARATEKEEP : SEPARATE),
    1594                        directory, list, NULL);
     1594                       directory, list, NULL, pszSrcFile, __LINE__);
    15951595            if (list)
    15961596              free(list);
     
    19601960          strcat(li->targetpath, " %a");
    19611961          ExecOnList(hwndMain,
    1962                      li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL);
     1962                     li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
     1963                     pszSrcFile, __LINE__);
    19631964          FreeList(li->list);
    19641965          li->list = NULL;
     
    42344235          CHAR szPath2[CCHMAXPATH];
    42354236          runemf2(SEPARATE,
    4236                   HWND_DESKTOP, NULL, NULL,
     4237                  HWND_DESKTOP, pszSrcFile, __LINE__,
     4238                  NULL, NULL,
    42374239                  "%s %s %s",
    42384240                  dircompare,
    42394241                  BldQuotedFileName(szPath1, wa.szCurrentPath1),
    42404242                  BldQuotedFileName(szPath2, wa.szCurrentPath2));
    4241           // CHAR d1[] = "\"";
    4242           // CHAR d2[] = "\"";
    4243           // if (!needs_quoting(wa.szCurrentPath1))
    4244           //   *d1 = 0;
    4245           // if (!needs_quoting(wa.szCurrentPath2))
    4246           //   *d2 = 0;
    4247           // runemf2(SEPARATE,
    4248           //      HWND_DESKTOP, NULL, NULL,
    4249           //      "%s %s%s%s %s%s%s",
    4250           //      dircompare,
    4251           //      d1, wa.szCurrentPath1, d1, d2, wa.szCurrentPath2, d2);
    42524243        }
    42534244      }
     
    46484639        type = SEPARATE | FULLSCREEN;
    46494640      }
    4650       runemf2(type, hwnd, path, NULL, "%s", env);
     4641      runemf2(type, hwnd, pszSrcFile, __LINE__,
     4642              path, NULL, "%s", env);
    46514643    }
    46524644    break;
  • trunk/dll/mainwnd2.c

    r875 r888  
    501501          CHAR szPath2[CCHMAXPATH];
    502502          runemf2(SEPARATE,
    503                   HWND_DESKTOP, NULL, NULL,
     503                  HWND_DESKTOP, pszSrcFile, __LINE__,
     504                  NULL, NULL,
    504505                  "%s %s %s",
    505506                  dircompare,
    506507                  BldQuotedFileName(szPath1, wa.szCurrentPath1),
    507508                  BldQuotedFileName(szPath2, wa.szCurrentPath2));
    508           // CHAR *d1 = "\"", *d2 = "\"";
    509           // if (!needs_quoting(wa.szCurrentPath1))
    510           //   *d1 = 0;
    511           // if (!needs_quoting(wa.szCurrentPath2))
    512           //   *d2 = 0;
    513           // runemf2(SEPARATE,
    514           //      HWND_DESKTOP,
    515           //      NULL,
    516           //      NULL,
    517           //      "%s %s%s%s %s%s%s",
    518           //      dircompare,
    519           //      d1, wa.szCurrentPath1, d1, d2, wa.szCurrentPath2, d2);
    520509        }
    521510      }
  • trunk/dll/misc.c

    r882 r888  
    913913    }
    914914    fclose(fp);
    915     ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, NULL, NULL,
     915    ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
     916                  NULL, NULL,
    916917                  "VIEW.EXE \"%s\"", filename);
    917918  }
     
    945946  *cl = 0;
    946947  BldQuotedFileName(cl, filename);
    947   // *cl = 0;
    948   // if (needs_quoting(filename))
    949   //   strcat(cl, "\"");
    950   // strcat(cl, filename);
    951   // if (needs_quoting(filename))
    952   //   strcat(cl, "\"");
    953948  memset(&ex, 0, sizeof(ex));
    954949  ex.flags = lastflags;
     
    960955  if (ret == 1) {
    961956    lastflags = ex.flags;
    962     return runemf2(ex.flags, hwnd, path,
     957    return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path,
    963958                   *ex.environment ? ex.environment : NULL,
    964959                   "%s", cl) != -1;
     
    14851480      list[0] = filename;
    14861481      list[1] = NULL;
    1487       ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, list, NULL);
     1482      ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, list, NULL,
     1483                 pszSrcFile, __LINE__);
    14881484      return;
    14891485    }
     
    14961492      ExecOnList(hwnd, viewer,
    14971493                 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
    1498                  NULL, list, NULL);
     1494                 NULL, list, NULL, pszSrcFile, __LINE__);
    14991495      return;
    15001496    }
     
    15121508      list[0] = filename;
    15131509      list[1] = NULL;
    1514       ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, list, NULL);
     1510      ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, list, NULL,
     1511                 pszSrcFile, __LINE__);
    15151512      return;
    15161513    }
     
    15211518      list[0] = filename;
    15221519      list[1] = NULL;
    1523       ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, list, NULL);
     1520      ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, list, NULL,
     1521                 pszSrcFile, __LINE__);
    15241522      return;
    15251523    }
  • trunk/dll/mle.c

    r886 r888  
    1717  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1818  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
     19  17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun
    1920
    2021***********************************************************************/
     
    178179          if (ftp && *ftprun)
    179180            runemf2(SEPARATE | WINDOWED,
    180                     h, ftprund, NULL, "%s %s", ftprun, temp);
     181                    h, pszSrcFile, __LINE__,
     182                    ftprund, NULL, "%s %s", ftprun, temp);
    181183          else if (!ftp && *httprun)
    182184            runemf2(SEPARATE | WINDOWED,
    183                     h, httprund, NULL, "%s %s", httprun, temp);
     185                    h, pszSrcFile, __LINE__,
     186                    httprund, NULL, "%s %s", httprun, temp);
    184187        }
    185188      }
  • trunk/dll/newview.c

    r886 r888  
    2626  14 Sep 07 SHL Another attempt to correct the fast viewer text load failure
    2727  10 Oct 07 SHL Correct ReLineThread typo
     28  17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun
    2829
    2930***********************************************************************/
     
    22892290                       if (*urld->url)
    22902291                         runemf2(SEPARATE | WINDOWED,
    2291                                hwnd, httprund, NULL, "%s %s", httprun, urld->url);
     2292                                 hwnd, pszSrcFile, __LINE__,
     2293                                 httprund, NULL, "%s %s", httprun, urld->url);
    22922294                free(urld);
    22932295                goto NoAdd;
     
    22952297                if (*urld->url)
    22962298                  runemf2(SEPARATE | WINDOWED,
    2297                           hwnd, ftprund, NULL, "%s %s", ftprun, urld->url);
     2299                          hwnd, pszSrcFile, __LINE__,
     2300                          ftprund, NULL, "%s %s", ftprun, urld->url);
    22982301                free(urld);
    22992302                goto NoAdd;
     
    31173120        dummy[0] = ad->filename;
    31183121        dummy[1] = NULL;
    3119         ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, dummy, NULL);
     3122        ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, dummy, NULL,
     3123                   pszSrcFile, __LINE__);
    31203124      }
    31213125      else
  • trunk/dll/notebook.c

    r878 r888  
    138138    case CFGA_FIND:
    139139      {
    140         CHAR filename[CCHMAXPATH + 9];
     140        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    141141        USHORT id;
    142142        HWND hwndFocus;
     
    148148          switch (id) {
    149149          case CFGA_VIRUS:
    150             if (insert_filename(hwnd, filename, 2, FALSE) && *filename)
    151               WinSetDlgItemText(hwnd, id, filename);
     150            if (insert_filename(hwnd, filename, 2, FALSE) && *filename){
     151              BldQuotedFileName(szfilename, filename);
     152              strcat(szfilename, " %p");
     153              WinSetDlgItemText(hwnd, id, szfilename);
     154            }
    152155            break;
    153156          case CFGA_EXTRACTPATH:
     
    194197      *szDefArc = 0;
    195198    PrfWriteProfileString(fmprof, appname, "DefArc", szDefArc);
    196     WinQueryDlgItemText(hwnd, CFGA_VIRUS, CCHMAXPATH, virus);
    197     virus[CCHMAXPATH - 1] = 0;
    198     bstrip(virus);
     199    {
     200      CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";
     201
     202      WinQueryDlgItemText(hwnd, CFGA_VIRUS, CCHMAXPATH, szBuf);
     203      szBuf[CCHMAXPATH - 1] = 0;
     204      bstrip(szBuf);
     205      if (!strcspn(szBuf, buf))
     206        BldQuotedFileName(virus, szBuf);
     207      else
     208        memcpy(virus, szBuf, strlen(szBuf) + 1);
     209      if (!strchr(virus, '%') && strlen(virus) > 3)
     210        strcat(virus, " %p");
     211    }
    199212    if (!*virus)
    200213      strcpy(virus, "OS2SCAN.EXE %p /SUB /A");
     
    414427    case CFGV_FIND:
    415428      {
    416         CHAR filename[CCHMAXPATH + 9];
     429        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    417430        USHORT id;
    418431        HWND hwndFocus;
     
    427440          case CFGV_VIEWER:
    428441          case CFGV_EDITOR:
    429             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    430               strcat(filename, " %a");
    431               WinSetDlgItemText(hwnd, id, filename);
     442            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     443              BldQuotedFileName(szfilename, filename);
     444              strcat(szfilename, " %a");
     445              WinSetDlgItemText(hwnd, id, szfilename);
    432446            }
    433447            break;
    434448          case CFGV_HTTPRUN:
    435449          case CFGV_FTPRUN:
    436             if (insert_filename(hwnd, filename, 2, FALSE) && *filename)
    437               WinSetDlgItemText(hwnd, id, filename);
     450            if (insert_filename(hwnd, filename, 2, FALSE) && *filename){
     451              BldQuotedFileName(szfilename, filename);
     452              WinSetDlgItemText(hwnd, id, szfilename);
     453            }
    438454            break;
    439455          default:
     
    448464
    449465  case WM_CLOSE:
    450     WinQueryDlgItemText(hwnd, CFGV_VIEWER, CCHMAXPATH, viewer);
    451     viewer[CCHMAXPATH - 1] = 0;
    452     bstrip(viewer);
    453     WinQueryDlgItemText(hwnd, CFGV_EDITOR, CCHMAXPATH, editor);
    454     editor[CCHMAXPATH - 1] = 0;
    455     bstrip(editor);
    456     WinQueryDlgItemText(hwnd, CFGV_BINVIEW, CCHMAXPATH, binview);
    457     binview[CCHMAXPATH - 1] = 0;
    458     bstrip(binview);
    459     WinQueryDlgItemText(hwnd, CFGV_BINED, CCHMAXPATH, bined);
    460     bined[CCHMAXPATH - 1] = 0;
    461     bstrip(bined);
    462     WinQueryDlgItemText(hwnd, CFGV_FTPRUN, CCHMAXPATH, ftprun);
    463     ftprun[CCHMAXPATH - 1] = 0;
    464     bstrip(ftprun);
    465     WinQueryDlgItemText(hwnd, CFGV_HTTPRUN, CCHMAXPATH, httprun);
    466     httprun[CCHMAXPATH - 1] = 0;
    467     bstrip(httprun);
    468     PrfWriteProfileString(fmprof, appname, "Viewer", viewer);
    469     PrfWriteProfileString(fmprof, appname, "Editor", editor);
    470     PrfWriteProfileString(fmprof, appname, "BinView", binview);
    471     PrfWriteProfileString(fmprof, appname, "BinEd", bined);
    472     PrfWriteProfileString(fmprof, appname, "FTPRun", ftprun);
    473     PrfWriteProfileString(fmprof, appname, "HTTPRun", httprun);
    474     fUseNewViewer = WinQueryButtonCheckstate(hwnd, CFGV_USENEWVIEWER);
    475     PrfWriteProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer,
    476                         sizeof(BOOL));
    477     fGuessType = WinQueryButtonCheckstate(hwnd, CFGV_GUESSTYPE);
    478     PrfWriteProfileData(fmprof, appname, "GuessType", &fGuessType,
    479                         sizeof(BOOL));
    480     fViewChild = WinQueryButtonCheckstate(hwnd, CFGV_VIEWCHILD);
    481     PrfWriteProfileData(fmprof, appname, "ViewChild", &fViewChild,
    482                         sizeof(BOOL));
    483     fCheckMM = WinQueryButtonCheckstate(hwnd, CFGV_CHECKMM);
    484     PrfWriteProfileData(fmprof, appname, "CheckMM", &fCheckMM, sizeof(BOOL));
    485     break;
     466    {
     467      CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";
     468
     469      WinQueryDlgItemText(hwnd, CFGV_VIEWER, CCHMAXPATH, szBuf);
     470      szBuf[CCHMAXPATH - 1] = 0;
     471      bstrip(szBuf);
     472      if (!strcspn(szBuf, buf))
     473        BldQuotedFileName(viewer, szBuf);
     474      else
     475        memcpy(viewer, szBuf, strlen(szBuf) + 1);
     476      if (!strchr(viewer, '%') && strlen(viewer) > 3)
     477        strcat(viewer, " %a");
     478      WinQueryDlgItemText(hwnd, CFGV_EDITOR, CCHMAXPATH, szBuf);
     479      szBuf[CCHMAXPATH - 1] = 0;
     480      bstrip(szBuf);
     481      if (!strcspn(szBuf, buf))
     482        BldQuotedFileName(editor, szBuf);
     483      else
     484        memcpy(editor, szBuf, strlen(szBuf) + 1);
     485      if (!strchr(editor, '%') && strlen(editor) > 3)
     486        strcat(editor, " %a");
     487      WinQueryDlgItemText(hwnd, CFGV_BINVIEW, CCHMAXPATH, szBuf);
     488      szBuf[CCHMAXPATH - 1] = 0;
     489      bstrip(szBuf);
     490      if (!strcspn(szBuf, buf))
     491        BldQuotedFileName(binview, szBuf);
     492      else
     493        memcpy(binview, szBuf, strlen(szBuf) + 1);
     494      if (!strchr(binview, '%') && strlen(binview) > 3)
     495        strcat(binview, " %a");
     496      WinQueryDlgItemText(hwnd, CFGV_BINED, CCHMAXPATH, szBuf);
     497      szBuf[CCHMAXPATH - 1] = 0;
     498      bstrip(szBuf);
     499      if (!strcspn(szBuf, buf))
     500        BldQuotedFileName(bined, szBuf);
     501      else
     502        memcpy(bined, szBuf, strlen(szBuf) + 1);
     503      if (!strchr(bined, '%') && strlen(bined) > 3)
     504        strcat(bined, " %a");
     505      WinQueryDlgItemText(hwnd, CFGV_FTPRUN, CCHMAXPATH, szBuf);
     506      szBuf[CCHMAXPATH - 1] = 0;
     507      bstrip(szBuf);
     508      if (!strchr(szBuf, '"'))
     509        BldQuotedFileName(ftprun, szBuf);
     510      else
     511        memcpy(ftprun, szBuf, strlen(szBuf) + 1);
     512      WinQueryDlgItemText(hwnd, CFGV_HTTPRUN, CCHMAXPATH, szBuf);
     513      szBuf[CCHMAXPATH - 1] = 0;
     514      bstrip(szBuf);
     515      if (!strchr(szBuf, '"'))
     516        BldQuotedFileName(httprun, szBuf);
     517      else
     518        memcpy(httprun, szBuf, strlen(szBuf) + 1);
     519      PrfWriteProfileString(fmprof, appname, "Viewer", viewer);
     520      PrfWriteProfileString(fmprof, appname, "Editor", editor);
     521      PrfWriteProfileString(fmprof, appname, "BinView", binview);
     522      PrfWriteProfileString(fmprof, appname, "BinEd", bined);
     523
     524      PrfWriteProfileString(fmprof, appname, "FTPRun", ftprun);
     525      PrfWriteProfileString(fmprof, appname, "HTTPRun", httprun);
     526      fUseNewViewer = WinQueryButtonCheckstate(hwnd, CFGV_USENEWVIEWER);
     527      PrfWriteProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer,
     528                          sizeof(BOOL));
     529      fGuessType = WinQueryButtonCheckstate(hwnd, CFGV_GUESSTYPE);
     530      PrfWriteProfileData(fmprof, appname, "GuessType", &fGuessType,
     531                          sizeof(BOOL));
     532      fViewChild = WinQueryButtonCheckstate(hwnd, CFGV_VIEWCHILD);
     533      PrfWriteProfileData(fmprof, appname, "ViewChild", &fViewChild,
     534                          sizeof(BOOL));
     535      fCheckMM = WinQueryButtonCheckstate(hwnd, CFGV_CHECKMM);
     536      PrfWriteProfileData(fmprof, appname, "CheckMM", &fCheckMM, sizeof(BOOL));
     537      break;
     538    }
    486539  }
    487540  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    9961049    case CFGC_FIND:
    9971050      {
    998         CHAR filename[CCHMAXPATH + 9];
     1051        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    9991052        USHORT id;
    10001053        HWND hwndFocus;
     
    10071060          case CFGC_COMPARE:
    10081061          case CFGC_DIRCOMPARE:
    1009             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    1010               strcat(filename, " %a");
    1011               WinSetDlgItemText(hwnd, id, filename);
     1062            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     1063              BldQuotedFileName(szfilename, filename);
     1064              strcat(szfilename, " %a");
     1065              WinSetDlgItemText(hwnd, id, szfilename);
    10121066            }
    10131067            break;
     
    10231077
    10241078  case WM_CLOSE:
    1025     WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, CCHMAXPATH, dircompare);
    1026     dircompare[CCHMAXPATH - 1] = 0;
    1027     bstrip(dircompare);
    1028     PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare);
    1029     WinQueryDlgItemText(hwnd, CFGC_COMPARE, CCHMAXPATH, compare);
    1030     compare[CCHMAXPATH - 1] = 0;
    1031     bstrip(compare);
    1032     PrfWriteProfileString(fmprof, appname, "Compare", compare);
    1033     break;
     1079    {
     1080      CHAR szBuf[CCHMAXPATH], buf[10] = "\"%-/";
     1081
     1082      WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, CCHMAXPATH, szBuf);
     1083        szBuf[CCHMAXPATH - 1] = 0;
     1084        bstrip(szBuf);
     1085        if (!strcspn(szBuf, buf))
     1086          BldQuotedFileName(dircompare, szBuf);
     1087        else
     1088          memcpy(dircompare, szBuf, strlen(szBuf) + 1);
     1089        if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
     1090          strcat(dircompare, " %a");
     1091      PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare);
     1092      WinQueryDlgItemText(hwnd, CFGC_COMPARE, CCHMAXPATH, szBuf);
     1093        szBuf[CCHMAXPATH - 1] = 0;
     1094        bstrip(szBuf);
     1095        if (!strcspn(szBuf, buf))
     1096          BldQuotedFileName(compare, szBuf);
     1097        else
     1098          memcpy(compare, szBuf, strlen(szBuf) + 1);
     1099        if (!strchr(compare, '%') && strlen(compare) > 3)
     1100          strcat(compare, " %a");
     1101      PrfWriteProfileString(fmprof, appname, "Compare", compare);
     1102      break;
     1103    }
    10341104  }
    10351105  return WinDefDlgProc(hwnd, msg, mp1, mp2);
  • trunk/dll/remap.c

    r793 r888  
    595595            case MAP_INFO:
    596596              runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
    597                       hwnd,
     597                      hwnd, pszSrcFile, __LINE__,
    598598                      NULL, NULL, "%s /C NET USE %s", GetCmdSpec(FALSE), d);
    599599              break;
  • trunk/dll/seeall.c

    r872 r888  
    466466          while (list[x]) {
    467467            FILESTATUS3 fsa;
    468             // BOOL spaces;
    469             // if (needs_quoting(list[x])) {
    470             //   spaces = TRUE;
    471             //   strcat(szBuffer, "\"");
    472             // }
    473             // else
    474             //   spaces = FALSE;
    475             // strcat(szBuffer, list[x]);
    476468            memset(&fsa, 0, sizeof(fsa));
    477469            DosError(FERR_DISABLEHARDERR);
     
    480472              BldQuotedFullPathName(szBuffer + strlen(szBuffer),
    481473                                    list[x], "*");
    482               // if (szBuffer[strlen(szBuffer) - 1] != '\\')
    483               //        strcat(szBuffer, "\\");
    484               // strcat(szBuffer, "*");
    485474            }
    486475            else
    487476              BldQuotedFileName(szBuffer + strlen(szBuffer), list[x]);
    488             // if (spaces)
    489             //   strcat(szBuffer, "\"");
    490477            x++;
    491478            if (!list[x] || strlen(szBuffer) + strlen(list[x]) + 5 > 1024) {
    492479              runemf2(SEPARATE | WINDOWED | WAIT |
    493480                      (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)),
    494                       HWND_DESKTOP, NULL, NULL,
    495                       "%s", szBuffer);
     481                      HWND_DESKTOP, pszSrcFile, __LINE__,
     482                      NULL, NULL, "%s", szBuffer);
    496483              DosSleep(1);              // Let archiver get started
    497484              *p = 0;
     
    831818            runemf2(SEPARATE | WINDOWED |
    832819                    (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)),
    833                     HWND_DESKTOP, ex.extractdir, NULL,
     820                    HWND_DESKTOP, pszSrcFile, __LINE__,
     821                    ex.extractdir, NULL,
    834822                    "%s %s %s%s%s",
    835823                    ex.command,
  • trunk/dll/srchpath.c

    r847 r888  
    6262    }
    6363    ret = runemf2(SEPARATE | WINDOWED,
    64                   HWND_DESKTOP,
     64                  HWND_DESKTOP, pszSrcFile, __LINE__,
    6565                  NULL,
    6666                  NULL,
  • trunk/dll/sysinfo.c

    r793 r888  
    6363      DosDupHandle(fileno(fp), &oldstdout);
    6464      runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT,
    65               hwnd, NULL, NULL, "%s", "RMVIEW.EXE");
     65              hwnd, pszSrcFile, __LINE__,
     66              NULL, NULL, "%s", "RMVIEW.EXE");
    6667      oldstdout = fileno(stdout);
    6768      DosDupHandle(newstdout, &oldstdout);
  • trunk/dll/systemf.c

    r793 r888  
    7171
    7272int ExecOnList(HWND hwnd, char *command, int flags, char *tpath,
    73                char **list, char *prompt)
     73               char **list, char *prompt, PCSZ pszCallingFile, UINT uiLineNumber)
    7474{
    7575  /* executes the command once for all files in list */
     
    591591      ex.flags = flags;
    592592    ex.flags &= (~PROMPT);
    593     return runemf2(ex.flags, hwnd, path,
     593    return runemf2(ex.flags, hwnd, pszCallingFile, uiLineNumber, path,
    594594                   (*ex.environment) ? ex.environment : NULL,
    595595                   "%s", commandline);
     
    599599//== runemf2() run requested app, return -1 if problem starting else return app rc ==
    600600
    601 int runemf2(int type, HWND hwnd, char *pszDirectory, char *pszEnvironment,
     601int runemf2(int type, HWND hwnd, PCSZ pszCallingFile, UINT uiLineNumber,
     602            char *pszDirectory, char *pszEnvironment,
    602603            char *formatstring,...)
    603604{
     
    605606
    606607   * status = runemf2(SEPARATE | WINDOWED,
    607    *                  hwnd,
     608   *                  hwnd, pszCallingFile, __LINE__,
    608609   *                  NullStr,
    609610   *                  NULL,
     
    613614   *
    614615   * use (HWND)0 for hwnd if window handle not handy.
     616   * pszCallingFile and __LINE__ are used to determine caller for easier error tracking
    615617   */
    616618
     
    634636  BOOL useTermQ = FALSE;
    635637  char szTempdir[CCHMAXPATH];
     638  char szTempPgm[CCHMAXPATH], tempcom[1024], temparg[1024], buf[10] = " &|<>";
     639  char *offset, *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat;
     640  UINT offsetquote;
    636641
    637642  typedef struct {
     
    675680  *pszPgm = 0;
    676681  va_start(parguments,
    677            formatstring);
     682           formatstring);
    678683  vsprintf(pszPgm,
    679684           formatstring,
    680            parguments);
     685           parguments);
    681686  va_end(parguments);
    682 
     687  offsetexe = strstr(pszPgm, ".exe");
     688  offsetcmd = strstr(pszPgm, ".cmd");
     689  offsetcom = strstr(pszPgm, ".com");
     690  offsetbtm = strstr(pszPgm, ".btm");
     691  offsetbat = strstr(pszPgm, ".bat");
     692  if (offsetexe)
     693    offset = offsetexe;
     694  else if (offsetcom)
     695    offset = offsetcom;
     696  else if (offsetcmd)
     697    offset = offsetcmd;
     698  else if (offsetbtm)
     699    offset = offsetbtm;
     700  else if (offsetbat)
     701    offset = offsetbat;
     702  else
     703    offset = NULL;
     704  offsetquote = strcspn(pszPgm, buf);
     705  if (pszPgm[0] != '\"' && offsetquote < offset - pszPgm && offsetquote != NULL){
     706    strcpy(tempcom, pszPgm);
     707    tempcom[offset + 4 - pszPgm] = '\0';
     708    strcpy (temparg, &pszPgm[offset + 4 - pszPgm]);
     709    pszDirectory = szTempdir;
     710    strcpy(pszDirectory, tempcom);
     711    offset = strrchr(pszDirectory, '\\');
     712    pszDirectory[offset +1 - pszDirectory] = '\0';
     713    BldQuotedFileName(szTempPgm, tempcom);
     714    strcat(szTempPgm, temparg);
     715    memcpy(pszPgm, szTempPgm, 1024);
     716    //printf("%s\n %s\n%s %s\n %d %d",
     717    //       pszPgm, szTempPgm, tempcom, temparg, offset, offsetquote); fflush(stdout);
     718  }
    683719  if (pszEnvironment) {
    684720    p = &pszEnvironment[strlen(pszEnvironment)] + 1;
     
    789825          Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
    790826                    GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
    791                     pszPgm);
     827                    pszPgm, pszCallingFile, __LINE__);
    792828          DosFreeMem(pszPgm);
    793829          if (pszArgs)
     
    801837            Runtime_Error(pszSrcFile, __LINE__,
    802838                          GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    803                           ulAppType, pszPgm);
     839                          ulAppType, pszPgm, pszCallingFile, __LINE__);
    804840            if (pszPgm)
    805841              DosFreeMem(pszPgm);
     
    813849            Runtime_Error(pszSrcFile, __LINE__,
    814850                          GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    815                           ulAppType, pszPgm);
     851                          ulAppType, pszPgm, pszCallingFile, __LINE__);
    816852            if (pszPgm)
    817853              DosFreeMem(pszPgm);
     
    834870        if (ret) {
    835871          Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__,
    836                     GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm);
     872                    GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm,
     873                    pszCallingFile, __LINE__);
    837874        }
    838875      }
     
    903940      }
    904941
    905       /* goddamned OS/2 limit */
     942      // goddamned OS/2 limit
    906943
    907944      if (strlen(pszPgm) + strlen(pszArgs) > 1024)
     
    922959          *pszDirectory)
    923960        switch_to(szSavedir);
    924       if (rc) {
     961      if (rc){
    925962        Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
    926963                  GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
    927                   pszPgm);
     964                  pszPgm, pszCallingFile, __LINE__);
    928965        DosFreeMem(pszPgm);
    929966        if (pszArgs)
     
    937974          Runtime_Error(pszSrcFile, __LINE__,
    938975                        GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    939                         pszPgm);
     976                        pszPgm, pszCallingFile, __LINE__);
    940977          DosFreeMem(pszPgm);
    941978          if (pszArgs)
     
    11061143      if (ret && ret != ERROR_SMG_START_IN_BACKGROUND) {
    11071144        Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,
    1108                   GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs);
     1145                  GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs,
     1146                  pszCallingFile, __LINE__);
    11091147      }
    11101148      else if (type & WAIT) {
  • trunk/dll/tools.c

    r847 r888  
    791791        }
    792792        runemf2(SEPARATE | WINDOWED,
    793                 hwnd, NULL, NULL, "ICONEDIT.EXE %s", filename);
     793                hwnd, pszSrcFile, __LINE__,
     794                NULL, NULL, "ICONEDIT.EXE %s", filename);
    794795      }
    795796      break;
  • trunk/dll/treecnr.c

    r877 r888  
    24112411
    24122412      case IDM_PARTITION:
    2413         runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, NULL, NULL,
     2413        runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
     2414                NULL, NULL,
    24142415                "%s", "MINILVM.EXE");
    24152416        break;
    24162417
    24172418      case IDM_PARTITIONDF:
    2418         runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, NULL, NULL,
     2419        runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
     2420                NULL, NULL,
    24192421                "%s", "DFSOS2.EXE");
    24202422        break;
    24212423
    24222424      case IDM_PARTITIONLVMG:
    2423         runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, NULL, NULL,
     2425        runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
     2426                NULL, NULL,
    24242427                "%s", "LVMGUI.CMD");
    24252428        break;
    24262429
    24272430      case IDM_PARTITIONFD:
    2428         runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, NULL, NULL,
     2431        runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
     2432                NULL, NULL,
    24292433                "%s", "FDISKPM.EXE");
    24302434        break;
  • trunk/dll/undel.c

    r847 r888  
    9090      DosDupHandle(fileno(fp), &oldstdout);
    9191      runemf2(SEPARATE | INVISIBLE | WINDOWED | BACKGROUND | WAIT,
    92               hwnd,
     92              hwnd, pszSrcFile, __LINE__,
    9393              NULL,
    9494              NULL,
     
    124124            if (temp == MBID_YES)
    125125              runemf2(BACKGROUND | INVISIBLE | SEPARATE | WINDOWED,
    126                       hwnd,
     126                      hwnd, pszSrcFile, __LINE__,
    127127                      NULL, NULL, "%s /C HELP UNDELETE", GetCmdSpec(FALSE));
    128128            if (temp == MBID_CANCEL)
     
    427427            fclose(fp);
    428428            runemf2(WINDOWED | BACKGROUND | SEPARATE | INVISIBLE,
    429                     hwnd,
     429                    hwnd, pszSrcFile, __LINE__,
    430430                    NULL, NULL, "%s /C \\FMUNDEL.CMD", GetCmdSpec(FALSE));
    431431          }
  • trunk/dll/viewinf.c

    r847 r888  
    575575            runemf2(SEPARATE | WINDOWED | MINIMIZED |
    576576                    BACKGROUND | INVISIBLE,
    577                     hwnd,
     577                    hwnd, pszSrcFile, __LINE__,
    578578                    NULL, NULL, "%s /C %s", GetCmdSpec(FALSE), filename);
    579579          }
  • trunk/dll/worker.c

    r847 r888  
    412412                  if (!runemf2(SEPARATE | WINDOWED |
    413413                               fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED),
    414                                HWND_DESKTOP, ex.extractdir, NULL,
     414                               HWND_DESKTOP, pszSrcFile, __LINE__, ex.extractdir, NULL,
    415415                               "%s %s %s%s%s",
    416416                               ex.command,
     
    857857                  else {
    858858                    runemf2(SEPARATE,
    859                             HWND_DESKTOP, NULL, NULL,
     859                            HWND_DESKTOP, pszSrcFile, __LINE__,
     860                            NULL, NULL,
    860861                            "%s %s %s",
    861862                            dircompare,
    862863                            BldQuotedFileName(szQuotedDirName, wk->li->targetpath),
    863864                            BldQuotedFileName(szQuotedFileName, wk->li->list[x]));
    864                     // CHAR d1[] = "\"";
    865                     // CHAR d2[] = "\"";
    866                     // if (!needs_quoting(wk->li->targetpath))
    867                     //   *d1 = 0;
    868                     // if (!needs_quoting(wk->li->list[x]))
    869                     //   *d2 = 0;
    870                     // runemf2(SEPARATE,
    871                     //      HWND_DESKTOP, NULL, NULL,
    872                     //      "%s %s%s%s %s%s%s",
    873                     //      dircompare,
    874                     //      d1, wk->li->targetpath, d1,
    875                     //      d2, wk->li->list[x], d2);
    876865                  }
    877866                }
     
    884873                  ExecOnList(wk->hwndFrame,
    885874                             compare,
    886                              WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL);
     875                             WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL,
     876                             pszSrcFile, __LINE__);
    887877                }
    888878                else {
     
    10291019                       "%a",
    10301020                       WINDOWED | SEPARATE | PROMPT,
    1031                        NULL, wk->li->list, GetPString(IDS_DOITYOURSELFTEXT));
     1021                       NULL, wk->li->list, GetPString(IDS_DOITYOURSELFTEXT),
     1022                       pszSrcFile, __LINE__);
    10321023            break;
    10331024
     
    10811072                strcat(szBuffer, " ");
    10821073                BldQuotedFileName(szBuffer + strlen(szBuffer), wk->li->arcname);
    1083                 // if (needs_quoting(wk->li->arcname))
    1084                 //   strcat(szBuffer, "\"");
    1085                 // strcat(szBuffer, wk->li->arcname);
    1086                 // if (needs_quoting(wk->li->arcname))
    1087                 //   strcat(szBuffer, "\"");
    10881074              }
    10891075              else {
     
    11061092                }
    11071093                BldQuotedFileName(szBuffer + strlen(szBuffer), wk->li->list[x]);
    1108                 // if (needs_quoting(wk->li->list[x]))
    1109                 //   strcat(szBuffer, "\"");
    1110                 // strcat(szBuffer, wk->li->list[x]);
    1111                 // if (needs_quoting(wk->li->list[x]))
    1112                 //   strcat(szBuffer, "\"");
    11131094                x++;
    11141095                if (!wk->li->list[x] || strlen(szBuffer) +
    11151096                    strlen(wk->li->list[x]) + 5 > 1024) {
    11161097                  runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED | WAIT,
    1117                           HWND_DESKTOP,
     1098                          HWND_DESKTOP, pszSrcFile, __LINE__,
    11181099                          (wk->li->type == IDM_FAKEEXTRACT ||
    11191100                           wk->li->type == IDM_FAKEEXTRACTM) ?
     
    12351216              strcat(szBuffer, " ");
    12361217              BldQuotedFileName(szBuffer + strlen(szBuffer), ad.arcname);
    1237               // if (needs_quoting(ad.arcname))
    1238               //        strcat(szBuffer, "\"");
    1239               // strcat(szBuffer, ad.arcname);
    1240               // if (needs_quoting(ad.arcname))
    1241               //        strcat(szBuffer, "\"");
    12421218              p = &szBuffer[strlen(szBuffer)];
    12431219              if (ad.mask.szMask) {
     
    12491225              while (wk->li->list[x]) {
    12501226                FILESTATUS3 fsa;
    1251                 // BOOL spaces;
    1252                 // if (needs_quoting(wk->li->list[x])) {
    1253                 //   spaces = TRUE;
    1254                 //   strcat(szBuffer, "\"");
    1255                 // }
    1256                 // else
    1257                 //   spaces = FALSE;
    1258                 // strcat(szBuffer, wk->li->list[x]);
    12591227                memset(&fsa, 0, sizeof(FILESTATUS3));
    12601228                DosError(FERR_DISABLEHARDERR);
     
    12641232                if (fsa.attrFile & FILE_DIRECTORY) {
    12651233                  BldQuotedFullPathName(szBuffer + strlen(szBuffer), wk->li->list[x], "*");
    1266                   // if (szBuffer[strlen(szBuffer) - 1] != '\\')
    1267                   //   strcat(szBuffer, "\\");
    1268                   // strcat(szBuffer, "*");
    12691234                }
    12701235                else
    12711236                  BldQuotedFileName(szBuffer + strlen(szBuffer), wk->li->list[x]);
    1272                 // if (spaces)
    1273                 //   strcat(szBuffer, "\"");
    12741237                x++;
    12751238                if (!wk->li->list[x] ||
     
    12771240                  runemf2(SEPARATE | WINDOWED | WAIT |
    12781241                          (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)),
    1279                           HWND_DESKTOP, NULL, NULL,
     1242                          HWND_DESKTOP, pszSrcFile, __LINE__, NULL, NULL,
    12801243                          "%s", szBuffer);
    12811244                  DosSleep(1);
     
    13051268              ExecOnList((HWND) 0,
    13061269                         binview,
    1307                          WINDOWED | SEPARATE, NULL, wk->li->list, NULL);
     1270                         WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
     1271                         pszSrcFile, __LINE__);
    13081272              break;
    13091273            }
     
    13151279                         WINDOWED | SEPARATE |
    13161280                         ((fViewChild) ? CHILD : 0),
    1317                          NULL, wk->li->list, NULL);
     1281                         NULL, wk->li->list, NULL,
     1282                         pszSrcFile, __LINE__);
    13181283            else {
    13191284
     
    13491314              ExecOnList((HWND) 0,
    13501315                         bined,
    1351                          WINDOWED | SEPARATE, NULL, wk->li->list, NULL);
     1316                         WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
     1317                         pszSrcFile, __LINE__);
    13521318              break;
    13531319            }
     
    13581324              ExecOnList((HWND) 0,
    13591325                         editor,
    1360                          WINDOWED | SEPARATE, NULL, wk->li->list, NULL);
     1326                         WINDOWED | SEPARATE, NULL, wk->li->list, NULL,
     1327                         pszSrcFile, __LINE__);
    13611328            else {
    13621329
Note: See TracChangeset for help on using the changeset viewer.