Changeset 1394


Ignore:
Timestamp:
Feb 5, 2009, 5:17:25 AM (17 years ago)
Author:
Steven Levine
Message:

Ticket 340: Convert GetPString to use STRINGTABLE.

Drop fm3dll.str and mkstr.exe from makefiles and wpi builders

Convert many functions to expect PCSZ arguments.
Correct walk, compare and dirsizes dialog setups to ignore saved dialog size
Drop copyright.c logic from makefile

Location:
trunk
Files:
3 deleted
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/HISTORY

    r1385 r1394  
    11New stuff's at the top.  This list is not necessarily complete.
     2
     33.16
     4 o Correct walk, compare and dirsizes dialog setups to ignore saved dialog size
     5 o Move translatable strings to fm3dll.rc STRINGTABLE to support NLS translations
    26
    373.15
  • trunk/dll/arccnrs.c

    r1339 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  11 Jun 02 SHL Ensure archive name not garbage
     
    212212      priority_normal();
    213213      ret = runemf2(WaitChild->RunFlags, WaitChild->hwndClient,
    214                     WaitChild->pszSrcFile, WaitChild->uiLineNumber,
     214                    WaitChild->pszSrcFile, WaitChild->uiLineNumber,
    215215                    WaitChild->pszDirectory, WaitChild->pszEnvironment,
    216216                    WaitChild->formatstring, WaitChild->pszCmdLine);
     
    10751075    {
    10761076      USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
    1077       char *s = NULL;
     1077      PCSZ s = NULL;
    10781078
    10791079      if (fOtherHelp) {
     
    15991599          return 0;
    16001600        }
    1601         sprintf(WaitChild->pszCmdLine, "%s %s %s",
    1602                 dcd->info->exwdirs ? dcd->info->exwdirs :
     1601        sprintf(WaitChild->pszCmdLine, "%s %s %s",
     1602                dcd->info->exwdirs ? dcd->info->exwdirs :
    16031603                dcd->info->extract,
    16041604                BldQuotedFileName(szQuotedArcName, dcd->arcname),
     
    16251625        WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT |
    16261626                              (fArcStuffVisible ? 0 : BACKGROUND);
    1627         WaitChild->hwndClient = dcd->hwndClient;
    1628         WaitChild->msg = UM_ENTER;
    1629         WaitChild->uiLineNumber = __LINE__;
    1630         WaitChild->pszSrcFile = pszSrcFile;
     1627        WaitChild->hwndClient = dcd->hwndClient;
     1628        WaitChild->msg = UM_ENTER;
     1629        WaitChild->uiLineNumber = __LINE__;
     1630        WaitChild->pszSrcFile = pszSrcFile;
    16311631        WaitChild->pszDirectory = xstrdup(dcd->workdir, pszSrcFile, __LINE__);
    16321632        WaitChild->pszEnvironment = NULL;
     
    19011901                }
    19021902              }
    1903               z = x;
    1904               runemf2(SEPARATE | WINDOWED | WAIT |
    1905                       (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
    1906                       hwnd, pszSrcFile, __LINE__,
    1907                       li->targetpath, NULL, "%s", pszCmdLine);
     1903              z = x;
     1904              runemf2(SEPARATE | WINDOWED | WAIT |
     1905                      (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
     1906                      hwnd, pszSrcFile, __LINE__,
     1907                      li->targetpath, NULL, "%s", pszCmdLine);
    19081908              *endofit = 0;
    19091909            } while (li->list[x]);
     
    25312531            pfi->flData = CFA_STRING | CFA_LEFT | CFA_FIREADONLY;
    25322532            pfi->flTitle = CFA_CENTER;
    2533             pfi->pTitleData = GetPString(IDS_FILENAMECOLTEXT);
     2533            pfi->pTitleData = (PSZ)GetPString(IDS_FILENAMECOLTEXT);
    25342534            pfi->offStruct = FIELDOFFSET(ARCITEM, pszDisplayName);
    25352535            pfiLastLeftCol = pfi;
     
    25382538              CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
    25392539            pfi->flTitle = CFA_CENTER;
    2540             pfi->pTitleData = GetPString(IDS_OLDSIZECOLTEXT);
     2540            pfi->pTitleData = (PSZ)GetPString(IDS_OLDSIZECOLTEXT);
    25412541            pfi->offStruct = FIELDOFFSET(ARCITEM, cbFile);
    25422542            pfi = pfi->pNextFieldInfo;
     
    25442544              CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
    25452545            pfi->flTitle = CFA_CENTER;
    2546             pfi->pTitleData = GetPString(IDS_NEWSIZECOLTEXT);
     2546            pfi->pTitleData = (PSZ)GetPString(IDS_NEWSIZECOLTEXT);
    25472547            pfi->offStruct = FIELDOFFSET(ARCITEM, cbComp);
    25482548            pfi = pfi->pNextFieldInfo;
     
    25502550              CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY;
    25512551            pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
    2552             pfi->pTitleData = GetPString(IDS_DATETIMECOLTEXT);
     2552            pfi->pTitleData = (PSZ)GetPString(IDS_DATETIMECOLTEXT);
    25532553            pfi->offStruct = FIELDOFFSET(ARCITEM, pszDate);
    25542554            pfi = pfi->pNextFieldInfo;
    25552555            pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
    25562556            pfi->flTitle = CFA_CENTER;
    2557             pfi->pTitleData = GetPString(IDS_DATECOLTEXT);
     2557            pfi->pTitleData = (PSZ)GetPString(IDS_DATECOLTEXT);
    25582558            pfi->offStruct = FIELDOFFSET(ARCITEM, date);
    25592559            pfi = pfi->pNextFieldInfo;
    25602560            pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY;
    25612561            pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
    2562             pfi->pTitleData = GetPString(IDS_TIMECOLTEXT);
     2562            pfi->pTitleData = (PSZ)GetPString(IDS_TIMECOLTEXT);
    25632563            pfi->offStruct = FIELDOFFSET(ARCITEM, time);
    25642564            memset(&fii, 0, sizeof(FIELDINFOINSERT));
     
    35853585              IDM_FILTER,
    35863586              0};
    3587         char *szHelpString = NULL;
     3587        PCSZ szHelpString = NULL;
    35883588
    35893589
  • trunk/dll/avv.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2004, 2008 Steven H.Levine
     9  Copyright (c) 2004, 2009 Steven H.Levine
    1010
    1111  31 Jul 04 SHL ArcReviewDlgProc: correct nameis... decodes
     
    406406    apptype &= (~FAPPTYP_32BIT);
    407407    if (!apptype ||
    408         (apptype == FAPPTYP_NOTWINDOWCOMPAT) ||
    409         (apptype == FAPPTYP_WINDOWCOMPAT) ||
    410         (apptype & FAPPTYP_BOUND) ||
    411         (apptype & FAPPTYP_WINDOWAPI) || (apptype & FAPPTYP_DOS)) {
     408        (apptype == FAPPTYP_NOTWINDOWCOMPAT) ||
     409        (apptype == FAPPTYP_WINDOWCOMPAT) ||
     410        (apptype & FAPPTYP_BOUND) ||
     411        (apptype & FAPPTYP_WINDOWAPI) || (apptype & FAPPTYP_DOS)) {
    412412       *error = 0;
    413413     }
     
    425425  BOOL noStart = FALSE, noEnd = FALSE, badPos = FALSE;
    426426  INT badList = 0, badCreate = 0, badExtract = 0;
    427   static PSZ aerrors[3];
     427  static PCSZ aerrors[3];
    428428
    429429  aerrors[0] = GetPString(IDS_STARTLISTEMPTYTEXT);
  • trunk/dll/chklist.c

    r1301 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2005, 2008 Steven H.Levine
     9  Copyright (c) 2005, 2009 Steven H.Levine
    1010
    1111  10 Jan 05 SHL Allow DND_TARGET to hold CCHMAXPATH
     
    172172            *szBuffer = 0;
    173173            WinSendDlgItemMsg(hwnd, CHECK_LISTBOX, LM_QUERYITEMTEXT,
    174                               MPFROM2SHORT(x, CCHMAXPATH), MPFROMP(szBuffer));
    175             cl = WinQueryWindowPtr(hwnd, QWL_USER);
     174                              MPFROM2SHORT(x, CCHMAXPATH), MPFROMP(szBuffer));
     175            cl = WinQueryWindowPtr(hwnd, QWL_USER);
    176176            if (*szBuffer && !(cl->flags & CHECK_ARCHIVE))
    177177              QuickView(hwnd, szBuffer);
     
    451451            fdlg.fl = FDS_HELPBUTTON | FDS_CENTER |
    452452              FDS_OPEN_DIALOG | FDS_CUSTOM;
    453             fdlg.pszTitle = GetPString(IDS_NEWTARGETTEXT);
    454             fdlg.pszOKButton = GetPString(IDS_CHANGETEXT);
     453            fdlg.pszTitle = (PSZ)GetPString(IDS_NEWTARGETTEXT);
     454            fdlg.pszOKButton = (PSZ)GetPString(IDS_CHANGETEXT);
    455455            *drive = *cl->prompt;
    456456            drive[1] = ':';
  • trunk/dll/collect.c

    r1375 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2003, 2008 Steven H. Levine
     9  Copyright (c) 2003, 2009 Steven H. Levine
    1010
    1111  15 Oct 02 MK Baseline
     
    292292    {
    293293      USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
    294       char *s = NULL;
     294      PCSZ s = NULL;
    295295
    296296      if (fOtherHelp) {
     
    13841384               MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
    13851385    disable_menuitem(WinWindowFromID(WinQueryWindow(hwndMain, QW_PARENT),
    1386                                      FID_MENU), IDM_GREP, FALSE);
     1386                                     FID_MENU), IDM_GREP, FALSE);
    13871387    disable_menuitem(TreeMenu, IDM_GREP, FALSE);
    13881388    disable_menuitem(DirMenu, IDM_GREP, FALSE);
     
    19381938                 "Collector busy - please try again later");
    19391939        }
    1940         else {
    1941           GREPINFO *GrepInfo;
    1942 
    1943           GrepInfo = xmallocz(sizeof(GREPINFO), pszSrcFile, __LINE__);
    1944           if (GrepInfo) {
    1945             GrepInfo->hwnd = &hwnd;
    1946             if (mp2)
    1947               GrepInfo->szGrepPath = mp2;
    1948             if (WinDlgBox(HWND_DESKTOP, hwnd, GrepDlgProc,
    1949                           FM3ModHandle, GREP_FRAME, (PVOID) GrepInfo)) {
    1950               free(GrepInfo);
    1951               dcd->amextracted = TRUE;  // Say busy scanning
    1952               disable_menuitem(WinWindowFromID
    1953                                (WinQueryWindow(hwndMain, QW_PARENT), FID_MENU),
    1954                                IDM_GREP, TRUE);
    1955               disable_menuitem(TreeMenu, IDM_GREP, TRUE);
    1956               disable_menuitem(DirMenu, IDM_GREP, TRUE);
    1957               PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    1958             }
    1959             else
    1960               free(GrepInfo);
     1940        else {
     1941          GREPINFO *GrepInfo;
     1942
     1943          GrepInfo = xmallocz(sizeof(GREPINFO), pszSrcFile, __LINE__);
     1944          if (GrepInfo) {
     1945            GrepInfo->hwnd = &hwnd;
     1946            if (mp2)
     1947              GrepInfo->szGrepPath = mp2;
     1948            if (WinDlgBox(HWND_DESKTOP, hwnd, GrepDlgProc,
     1949                          FM3ModHandle, GREP_FRAME, (PVOID) GrepInfo)) {
     1950              free(GrepInfo);
     1951              dcd->amextracted = TRUE;  // Say busy scanning
     1952              disable_menuitem(WinWindowFromID
     1953                               (WinQueryWindow(hwndMain, QW_PARENT), FID_MENU),
     1954                               IDM_GREP, TRUE);
     1955              disable_menuitem(TreeMenu, IDM_GREP, TRUE);
     1956              disable_menuitem(DirMenu, IDM_GREP, TRUE);
     1957              PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     1958            }
     1959            else
     1960              free(GrepInfo);
    19611961          }
    19621962        }
     
    23782378          numitems = DrgQueryDragitemCount(pDInfo);
    23792379          usOperation = pDInfo->usOperation;
    2380           if (usOperation == DO_DEFAULT)
    2381             usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
     2380          if (usOperation == DO_DEFAULT)
     2381            usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
    23822382          FreeDragInfoData(hwnd, pDInfo);
    23832383          saymsg(MB_ENTER | MB_ICONASTERISK,
     
    29052905              IDM_REMOVE,
    29062906              0};
    2907         char *szHelpString = NULL;
     2907        PCSZ szHelpString = NULL;
    29082908
    29092909
  • trunk/dll/comp.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-02 M. Kimes
    9   Copyright (c) 2003, 2008 Steven H. Levine
     9  Copyright (c) 2003, 2009 Steven H. Levine
    1010
    1111  16 Oct 02 MK Baseline
     
    553553            break;
    554554
    555           case IDM_MOVE:
    556             {
    557               BOOL fResetVerify = FALSE;
    558 
    559               if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
    560                 BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
    561               else
    562                 BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
    563               // Make directory if required
    564               strcpy(szDirName, szNewName);
    565               p = strrchr(szDirName, '\\');
    566               if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
    567                               driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
    568                 DosSetVerify(FALSE);
    569                 fResetVerify = TRUE;
    570               }
    571               if (p) {
    572                 if (p > szDirName + 2)
    573                   p++;
    574                 *p = 0;
    575                 if (IsFile(szDirName) == -1)
    576                   MassMkdir(hwndMain, szDirName);
    577               }
    578               rc = docopyf(MOVE, pciS->pszFileName, "%s", szNewName);
    579               if (fResetVerify) {
    580                 DosSetVerify(fVerify);
    581                 fResetVerify = FALSE;
    582               }
    583               if (!rc && stricmp(pciS->pszFileName, szNewName)) {
    584                 WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
    585                            MPFROM2SHORT(FALSE, CRA_SELECTED));
    586                 if (pciD->rc.flRecordAttr & CRA_SELECTED)
    587                   WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
    588                              MPFROM2SHORT(FALSE, CRA_SELECTED));
    589                 FreeCnrItemData(pciD);
    590                 pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
    591                 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
    592                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
    593                   if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
    594                     pciD->pszDisplayName++;
    595                 }
    596                 else {
    597                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
    598                   if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
    599                     pciD->pszDisplayName++;
    600                 }
    601                 pciD->pszLongName = pciS->pszLongName;
    602                 pciS->pszLongName = NullStr;    // 07 Sep 08 SHL avoid aliased pointer
    603                 if (pciD->pszSubject != NullStr) {
    604                   xfree(pciD->pszSubject, pszSrcFile, __LINE__);
    605                   pciD->pszSubject = NullStr;
    606                 }
    607                 pciD->attrFile = pciS->attrFile;
    608                 pciD->pszDispAttr = pciS->pszDispAttr;
    609                 pciD->flags = 0;                // Just on one side
    610                 pciD->date = pciS->date;
    611                 pciD->time = pciS->time;
    612                 pciD->ladate = pciS->ladate;
    613                 pciD->latime = pciS->latime;
    614                 pciD->crdate = pciS->crdate;
    615                 pciD->crtime = pciS->crtime;
    616                 pciD->cbFile = pciS->cbFile;
    617                 pciD->easize = pciS->easize;
    618 
    619                 if (pciS->pszFileName != NullStr) {
    620                   xfree(pciS->pszFileName, pszSrcFile, __LINE__);
    621                   pciS->pszFileName = NullStr;
    622                   pciS->pszDisplayName = pciS->pszFileName;
    623                   pciS->rc.pszIcon = pciS->pszFileName;
    624                 }
    625                 if (pciS->pszSubject != NullStr) {
    626                   xfree(pciS->pszSubject, pszSrcFile, __LINE__);
    627                   pciS->pszSubject = NullStr;
    628                 }
    629                 pciS->flags = 0;                // Just on one side
    630 
    631                 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
    632                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    633 
    634                 WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
    635                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    636 
    637                 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
    638                   cmp->cmp->totalleft--;
    639                 else
    640                   cmp->cmp->totalright--;
    641               }
    642               else if (rc) {
    643                 rc = Dos_Error(MB_ENTERCANCEL,
    644                                rc,
    645                                HWND_DESKTOP,
    646                                pszSrcFile,
    647                                __LINE__,
    648                                GetPString(IDS_COMPMOVEFAILEDTEXT),
    649                                pciS->pszFileName, szNewName);
    650                 if (rc == MBID_CANCEL)  // Cause loop to break
    651                   pciNextS = NULL;
    652               }
    653               break;
    654             }
    655 
    656           case IDM_COPY:
    657             {
    658               BOOL fResetVerify = FALSE;
    659 
    660               if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
    661                 BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
    662               else
    663                 BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
    664               // Make directory if required
    665               strcpy(szDirName, szNewName);
    666               p = strrchr(szDirName, '\\');
    667               if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
    668                                 driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
    669                 DosSetVerify(FALSE);
    670                 fResetVerify = TRUE;
    671               }
    672               if (p) {
    673                 if (p > szDirName + 2)
    674                   p++;
    675                 *p = 0;
    676                 if (IsFile(szDirName) == -1)
    677                   MassMkdir(hwndMain, szDirName);
    678               }
    679               rc = docopyf(COPY, pciS->pszFileName, "%s", szNewName);
    680               if (fResetVerify) {
    681                 DosSetVerify(fVerify);
    682                 fResetVerify = FALSE;
    683               }
    684               if (rc) {
    685                 rc = Dos_Error(MB_ENTERCANCEL,
    686                                rc,
    687                                HWND_DESKTOP,
    688                                pszSrcFile,
    689                                __LINE__,
    690                                GetPString(IDS_COMPCOPYFAILEDTEXT),
    691                                pciS->pszFileName, szNewName);
    692                 if (rc == MBID_CANCEL)
    693                   pciNextS = NULL;      // Cause loop to break
    694               }
    695               else {
    696                 WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
    697                            MPFROM2SHORT(FALSE, CRA_SELECTED));
    698                 if (pciD->rc.flRecordAttr & CRA_SELECTED)
    699                   WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
    700                              MPFROM2SHORT(FALSE, CRA_SELECTED));
    701                 // 12 Jan 08 SHL
    702                 if (pciD->pszFileName == NullStr) {
    703                   if (hwndCnrD == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
    704                     cmp->totalleft++;
    705                   else
    706                     cmp->totalright++;
    707                 }
    708                 FreeCnrItemData(pciD);
    709                 pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
    710                 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
    711                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
    712                   if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
    713                     pciD->pszDisplayName++;
    714                 }
    715                 else {
    716                   pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
    717                   if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
    718                     pciD->pszDisplayName++;
    719                 }
    720                 pciD->attrFile = pciS->attrFile;
    721                 pciD->pszDispAttr = pciS->pszDispAttr;
    722                 pciD->flags = CNRITEM_EXISTS;   // Now on both sides
    723                 pciD->date = pciS->date;
    724                 pciD->time = pciS->time;
    725                 pciD->ladate = pciS->ladate;
    726                 pciD->latime = pciS->latime;
    727                 pciD->crdate = pciS->crdate;
    728                 pciD->crtime = pciS->crtime;
    729                 pciD->cbFile = pciS->cbFile;
    730                 pciD->easize = pciS->easize;
    731 
    732                 // Forget status until we regenerate it
    733                 if (pciS->pszSubject != NullStr) {
    734                   xfree(pciS->pszSubject, pszSrcFile, __LINE__);
    735                   pciS->pszSubject = NullStr;
    736                 }
    737                 pciS->flags = CNRITEM_EXISTS;   // Now on both sides
    738 
    739                 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
    740                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    741                 WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
    742                            MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    743               }
    744               break;
    745             }
     555          case IDM_MOVE:
     556            {
     557              BOOL fResetVerify = FALSE;
     558
     559              if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
     560                BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
     561              else
     562                BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
     563              // Make directory if required
     564              strcpy(szDirName, szNewName);
     565              p = strrchr(szDirName, '\\');
     566              if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
     567                              driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
     568                DosSetVerify(FALSE);
     569                fResetVerify = TRUE;
     570              }
     571              if (p) {
     572                if (p > szDirName + 2)
     573                  p++;
     574                *p = 0;
     575                if (IsFile(szDirName) == -1)
     576                  MassMkdir(hwndMain, szDirName);
     577              }
     578              rc = docopyf(MOVE, pciS->pszFileName, "%s", szNewName);
     579              if (fResetVerify) {
     580                DosSetVerify(fVerify);
     581                fResetVerify = FALSE;
     582              }
     583              if (!rc && stricmp(pciS->pszFileName, szNewName)) {
     584                WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
     585                           MPFROM2SHORT(FALSE, CRA_SELECTED));
     586                if (pciD->rc.flRecordAttr & CRA_SELECTED)
     587                  WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
     588                             MPFROM2SHORT(FALSE, CRA_SELECTED));
     589                FreeCnrItemData(pciD);
     590                pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
     591                if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
     592                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
     593                  if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
     594                    pciD->pszDisplayName++;
     595                }
     596                else {
     597                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
     598                  if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
     599                    pciD->pszDisplayName++;
     600                }
     601                pciD->pszLongName = pciS->pszLongName;
     602                pciS->pszLongName = NullStr;    // 07 Sep 08 SHL avoid aliased pointer
     603                if (pciD->pszSubject != NullStr) {
     604                  xfree(pciD->pszSubject, pszSrcFile, __LINE__);
     605                  pciD->pszSubject = NullStr;
     606                }
     607                pciD->attrFile = pciS->attrFile;
     608                pciD->pszDispAttr = pciS->pszDispAttr;
     609                pciD->flags = 0;                // Just on one side
     610                pciD->date = pciS->date;
     611                pciD->time = pciS->time;
     612                pciD->ladate = pciS->ladate;
     613                pciD->latime = pciS->latime;
     614                pciD->crdate = pciS->crdate;
     615                pciD->crtime = pciS->crtime;
     616                pciD->cbFile = pciS->cbFile;
     617                pciD->easize = pciS->easize;
     618
     619                if (pciS->pszFileName != NullStr) {
     620                  xfree(pciS->pszFileName, pszSrcFile, __LINE__);
     621                  pciS->pszFileName = NullStr;
     622                  pciS->pszDisplayName = pciS->pszFileName;
     623                  pciS->rc.pszIcon = pciS->pszFileName;
     624                }
     625                if (pciS->pszSubject != NullStr) {
     626                  xfree(pciS->pszSubject, pszSrcFile, __LINE__);
     627                  pciS->pszSubject = NullStr;
     628                }
     629                pciS->flags = 0;                // Just on one side
     630
     631                WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
     632                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     633
     634                WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
     635                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     636
     637                if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
     638                  cmp->cmp->totalleft--;
     639                else
     640                  cmp->cmp->totalright--;
     641              }
     642              else if (rc) {
     643                rc = Dos_Error(MB_ENTERCANCEL,
     644                               rc,
     645                               HWND_DESKTOP,
     646                               pszSrcFile,
     647                               __LINE__,
     648                               GetPString(IDS_COMPMOVEFAILEDTEXT),
     649                               pciS->pszFileName, szNewName);
     650                if (rc == MBID_CANCEL)  // Cause loop to break
     651                  pciNextS = NULL;
     652              }
     653              break;
     654            }
     655
     656          case IDM_COPY:
     657            {
     658              BOOL fResetVerify = FALSE;
     659
     660              if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
     661                BldFullPathName(szNewName, cmp->leftdir, pciS->pszDisplayName);
     662              else
     663                BldFullPathName(szNewName, cmp->rightdir, pciS->pszDisplayName);
     664              // Make directory if required
     665              strcpy(szDirName, szNewName);
     666              p = strrchr(szDirName, '\\');
     667              if (fVerify && (driveflags[toupper(*szNewName) - 'A'] & DRIVE_WRITEVERIFYOFF ||
     668                                driveflags[toupper(*pciS->pszFileName) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
     669                DosSetVerify(FALSE);
     670                fResetVerify = TRUE;
     671              }
     672              if (p) {
     673                if (p > szDirName + 2)
     674                  p++;
     675                *p = 0;
     676                if (IsFile(szDirName) == -1)
     677                  MassMkdir(hwndMain, szDirName);
     678              }
     679              rc = docopyf(COPY, pciS->pszFileName, "%s", szNewName);
     680              if (fResetVerify) {
     681                DosSetVerify(fVerify);
     682                fResetVerify = FALSE;
     683              }
     684              if (rc) {
     685                rc = Dos_Error(MB_ENTERCANCEL,
     686                               rc,
     687                               HWND_DESKTOP,
     688                               pszSrcFile,
     689                               __LINE__,
     690                               GetPString(IDS_COMPCOPYFAILEDTEXT),
     691                               pciS->pszFileName, szNewName);
     692                if (rc == MBID_CANCEL)
     693                  pciNextS = NULL;      // Cause loop to break
     694              }
     695              else {
     696                WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciS),
     697                           MPFROM2SHORT(FALSE, CRA_SELECTED));
     698                if (pciD->rc.flRecordAttr & CRA_SELECTED)
     699                  WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciD),
     700                             MPFROM2SHORT(FALSE, CRA_SELECTED));
     701                // 12 Jan 08 SHL
     702                if (pciD->pszFileName == NullStr) {
     703                  if (hwndCnrD == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
     704                    cmp->totalleft++;
     705                  else
     706                    cmp->totalright++;
     707                }
     708                FreeCnrItemData(pciD);
     709                pciD->pszFileName = xstrdup(szNewName, pszSrcFile, __LINE__);
     710                if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
     711                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->leftdir);
     712                  if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
     713                    pciD->pszDisplayName++;
     714                }
     715                else {
     716                  pciD->pszDisplayName = pciD->pszFileName + strlen(cmp->rightdir);
     717                  if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
     718                    pciD->pszDisplayName++;
     719                }
     720                pciD->attrFile = pciS->attrFile;
     721                pciD->pszDispAttr = pciS->pszDispAttr;
     722                pciD->flags = CNRITEM_EXISTS;   // Now on both sides
     723                pciD->date = pciS->date;
     724                pciD->time = pciS->time;
     725                pciD->ladate = pciS->ladate;
     726                pciD->latime = pciS->latime;
     727                pciD->crdate = pciS->crdate;
     728                pciD->crtime = pciS->crtime;
     729                pciD->cbFile = pciS->cbFile;
     730                pciD->easize = pciS->easize;
     731
     732                // Forget status until we regenerate it
     733                if (pciS->pszSubject != NullStr) {
     734                  xfree(pciS->pszSubject, pszSrcFile, __LINE__);
     735                  pciS->pszSubject = NullStr;
     736                }
     737                pciS->flags = CNRITEM_EXISTS;   // Now on both sides
     738
     739                WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pciS),
     740                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     741                WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciD),
     742                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     743              }
     744              break;
     745            }
    746746
    747747          default:
     
    22112211
    22122212        PrfQueryProfileData(fmprof, FM3Str, "CompDir.Position", (PVOID) &swp, &size);
     2213        swp.fl &= ~SWP_SIZE;            // 04 Feb 09 SHL ignore saved size
    22132214        WinSetWindowPos(hwnd,
    22142215                        HWND_TOP,
     
    22302231                       };
    22312232        UINT x;
    2232         for (x = 0; ids[x]; x++) {
    2233           //fixme to allow user to change presparams 1-10-09 GKY
     2233        for (x = 0; ids[x]; x++) {
     2234          //fixme to allow user to change presparams 1-10-09 GKY
    22342235          SetPresParams(WinWindowFromID(hwnd, ids[x]),
    22352236                        &RGBGREY,
  • trunk/dll/dircnrs.c

    r1375 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    363363    {
    364364      USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
    365       char *s = NULL;
     365      PCSZ s = NULL;
    366366
    367367      if (fOtherHelp) {
     
    703703        numentries++;
    704704      if (numentries)
    705         UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
     705        UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
    706706    }
    707707    return 0;
     
    19411941          }
    19421942        }
    1943         break;
     1943        break;
    19441944
    19451945      case IDM_FINDINTREE:
     
    21472147        }
    21482148        else
    2149           StartCollector(dcd->hwndParent, 4);
    2150         if (SHORT1FROMMP(mp1) == IDM_GREP) {
    2151           PCNRITEM pci = NULL;
    2152 
    2153           pci = WinSendMsg(hwnd,
    2154                            CM_QUERYRECORDEMPHASIS,
    2155                            MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
    2156           if (pci && (INT) pci != -1)
    2157             PostMsg(Collector, WM_COMMAND,
    2158                     MPFROM2SHORT(IDM_GREP, 0), MPFROMP(pci->pszFileName));
    2159           else
    2160             PostMsg(Collector, WM_COMMAND,
    2161                     MPFROM2SHORT(IDM_GREP, 0), MPVOID);
    2162         }
    2163         else
     2149          StartCollector(dcd->hwndParent, 4);
     2150        if (SHORT1FROMMP(mp1) == IDM_GREP) {
     2151          PCNRITEM pci = NULL;
     2152
     2153          pci = WinSendMsg(hwnd,
     2154                           CM_QUERYRECORDEMPHASIS,
     2155                           MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
     2156          if (pci && (INT) pci != -1)
     2157            PostMsg(Collector, WM_COMMAND,
     2158                    MPFROM2SHORT(IDM_GREP, 0), MPFROMP(pci->pszFileName));
     2159          else
     2160            PostMsg(Collector, WM_COMMAND,
     2161                    MPFROM2SHORT(IDM_GREP, 0), MPVOID);
     2162        }
     2163        else
    21642164          PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
    21652165        break;
     
    29252925          else {
    29262926            numitems = DrgQueryDragitemCount(pDInfo);
    2927             usOperation = pDInfo->usOperation;
    2928             if (usOperation == DO_DEFAULT)
    2929               usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
     2927            usOperation = pDInfo->usOperation;
     2928            if (usOperation == DO_DEFAULT)
     2929              usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
    29302930            FreeDragInfoData(hwnd, pDInfo);
    29312931            saymsg(MB_ENTER | MB_ICONASTERISK,
     
    36203620                                   WC_DIRCONTAINER,
    36213621                                   NULL,
    3622                                    WS_VISIBLE | fwsAnimate,
     3622                                   WS_VISIBLE | fwsAnimate,
    36233623                                   FM3ModHandle, DIR_FRAME, &hwndClient);
    36243624    if (hwndFrame && hwndClient) {
     
    37293729                            SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER |
    37303730                            SWP_ACTIVATE);
    3731           }
    3732           WinShowWindow(dcd->hwndCnr, TRUE);
     3731          }
     3732          WinShowWindow(dcd->hwndCnr, TRUE);
    37333733        }
    37343734      }
  • trunk/dll/dirsize.c

    r1347 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    518518
    519519      PrfQueryProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, &size);
     520      swp.fl &= ~SWP_SIZE;              // 04 Feb 09 SHL ignore saved size
    520521      WinSetWindowPos(hwnd,
    521522                      HWND_TOP,
  • trunk/dll/droplist.c

    r1347 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2003, 2008 Steven H.Levine
     9  Copyright (c) 2003, 2009 Steven H.Levine
    1010
    1111  22 Nov 02 SHL Baseline
     
    272272}
    273273
    274 void DropHelp(MPARAM mp1, MPARAM mp2, HWND hwnd, char *text)
     274void DropHelp(MPARAM mp1, MPARAM mp2, HWND hwnd, PCSZ text)
    275275{
    276276  ULONG numitems;
     
    281281}
    282282
    283 LISTINFO *DoFileDrop(HWND hwndCnr, CHAR * directory, BOOL arcfilesok,
     283LISTINFO *DoFileDrop(HWND hwndCnr, PCSZ directory, BOOL arcfilesok,
    284284                     MPARAM mp1, MPARAM mp2)
    285285{
     
    424424
    425425        CHAR **test;
    426         PULONG pltest;
    427         PULONGLONG plltest;
     426        PULONG pltest;
     427        PULONGLONG plltest;
    428428
    429429        numalloc += 12;
  • trunk/dll/droplist.h

    r1222 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2009 Steven H. Levine
    1010
    1111  Change log
     
    2020BOOL AcceptOneDrop(HWND hwnd, MPARAM mp1, MPARAM mp2);
    2121BOOL CheckPmDrgLimit(PDRAGINFO pDInfo);
    22 LISTINFO *DoFileDrop(HWND hwndCnr, CHAR * directory, BOOL arcfilesok,
     22LISTINFO *DoFileDrop(HWND hwndCnr, PCSZ directory, BOOL arcfilesok,
    2323                     MPARAM mp1, MPARAM mp2);
    24 void DropHelp(MPARAM mp1, MPARAM mp2, HWND hwnd, char *text);
     24void DropHelp(MPARAM mp1, MPARAM mp2, HWND hwnd, PCSZ text);
    2525BOOL FullDrgName(PDRAGITEM pDItem, CHAR * buffer, ULONG buflen);
    2626BOOL GetOneDrop(HWND hwnd, MPARAM mp1, MPARAM mp2, char *buffer, ULONG buflen);
  • trunk/dll/fm3res.rc

    r1392 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2003, 2008 Steven H. Levine
     9  Copyright (c) 2003, 2009 Steven H. Levine
    1010
    1111  08 Feb 03 SHL Enable SYS_FRAME
     
    23562356STRINGTABLE
    23572357  BEGIN
    2358     IDS_COPYRIGHT, COPYRIGHT_STRING;
    2359     IDS_OPENBUTTONHELP                   "Click this button to open a Directory\rContainer for the highlighted directory\rin the Drive Tree below.  Or click B2 to\rWalk to a directory to open.  Or drop an\robject here to open its directory."
    2360     IDS_OPENDROPHELP                     "Dropping here will open a Directory container for the item."
    2361     IDS_IDEALBUTTONHELP                  "Click this button to set FM/2's window\rsize to an ""ideal"" size."
    2362     IDS_LEDHELP                          "This control indicates how\rmany background threads\rare currently active.\rB1 = show list of active threads\rB2 = close list of active threads\rB3 or chord = FM/2 open windows dialog"
    2363     IDS_WALKBUTTONHELP                   "B1 = Open new directory\rB2 = Change directories\rB3 = Tile child windows"
     2358    IDS_COPYRIGHT                         COPYRIGHT_STRING
     2359    IDS_OPENBUTTONHELP                    "Click this button to open a Directory\rContainer for the highlighted directory\rin the Drive Tree below.  Or click B2 to\rWalk to a directory to open.  Or drop an\robject here to open its directory."
     2360    IDS_OPENDROPHELP                      "Dropping here will open a Directory container for the item."
     2361    IDS_IDEALBUTTONHELP                   "Click this button to set FM/2's window\rsize to an ""ideal"" size."
     2362    IDS_LEDHELP                           "This control indicates how\rmany background threads\rare currently active.\rB1 = show list of active threads\rB2 = close list of active threads\rB3 or chord = FM/2 open windows dialog"
     2363    IDS_WALKBUTTONHELP                    "B1 = Open new directory\rB2 = Change directories\rB3 = Tile child windows"
    23642364    IDS_QUICKBUTTONHELP                   "B1 = Toggle quicklists\rB2 = Toggle toolbar\rB3 = Toggle drive buttons\r"
    23652365    IDS_ATTRSBUTTONHELP                   "This window shows the current\ritem's attributes.\rClick to change date\rand/or attributes."
     
    28182818    IDS_EXTABTITLETEXT                    "FM/2: Set tabstop space equivalants"
    28192819    IDS_VIEWABOUTTITLETEXT                "About This Thing"
    2820     IDS_VIEWABOUTTEXT                     "FM/2 Cheap Internal Viewer/Editor\r\rCopyright (c) 1993-98 M. Kimes\r(Barebones Software)\rCopyright (c) 2001, 2007 Steven Levine and Associates, Inc.\rAll Rights Reserved"
     2820    IDS_VIEWABOUTTEXT                     "FM/2 Cheap Internal Viewer/Editor\r\rCopyright (c) 1993-98 M. Kimes\r(Barebones Software)\rCopyright (c) 2001, 2009 Steven Levine and Associates, Inc.\rAll Rights Reserved"
    28212821    IDS_LANERRORTITLETEXT                 "LAN Error report"
    28222822    IDS_LANERROR2TITLETEXT                "Don't forget"
     
    29262926    IDS_INIDELETEKEYTEXT                  "Do you want to delete keyname ""%s""?"
    29272927    IDS_INIDELETEAPPTEXT                  "Do you want to delete application ""%s""?"
    2928     IDS_INIABOUTTEXT                      "FM/2 Cheap Internal INI Viewer\r\rCopyright (c) 1993-98 M. Kimes\r(Barebones Software)\rCopyright (c) 2001, 2007 Steven Levine and Associates, Inc.\rAll Rights Reserved"
     2928    IDS_INIABOUTTEXT                      "FM/2 Cheap Internal INI Viewer\r\rCopyright (c) 1993-98 M. Kimes\r(Barebones Software)\rCopyright (c) 2001, 2009 Steven Levine and Associates, Inc.\rAll Rights Reserved"
    29292929    IDS_INITITLETEXT                      "FM/2: INI ""%s"""
    29302930    IDS_INISEARCHHELPTEXT                 "Enter the characters to find.\r\rInput is case insensitive. Leading\rspaces are not stripped. Find\rnexts are made after the current\ritem, find firsts always start at\rthe top.  Beep means no (more)\rmatches."
     
    32713271    IDS_EDITREADONLYFILETEXT2             "%s is marked Read Only\n You will need to change its name to save."
    32723272
     3273    // Add strings that need to be combined by GetPString here
    32733274    IDS_SUGGEST1TEXT1                     "Based on what I've seen while scanning your drives, I would like to suggest the following Parameters for your FM/2 program object (explanation:  each letter following the '/' character is a drive that probably should be excluded from viewing by FM/2"
    32743275    IDS_SUGGEST1TEXT2                     " (see READ.ME), and the '%%*' on the end just enables drag-and-drop to the program object%s):\r\r""%s""\r\rWould you like me to automagically place this in the Parameters field of the FM/2 program objects (note:  existing Parameters will be replaced)?"
  • trunk/dll/fm3str.h

    r1391 r1394  
    44  $Id$
    55
    6   Index for fm3dll.str (source) fm3res.str (compiled)
     6  Index for STRINGTABLE items in fm3res.rc
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2002, 2006 Steven H. Levine
     9  Copyright (c) 2002, 2009 Steven H. Levine
    1010
    1111  21 May 04 SHL Adjust IDS_NUMSTRS
     
    2323  26 Aug 08 GKY Error strings for require unique ID plus text and help strings for all tools
    2424  03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
    25                 Dos/Win programs from being inserted into the execute dialog with message why.
     25                Dos/Win programs from being inserted into the execute dialog with message why.
    2626  10 Jan 09 GKY Removed rotating strings for font samples as part of StringTable conversion
    2727  11 Jan 08 GKY Move strings that will need translating to stringtable from sting file cut to
    28                 255 where necessary
     28                255 where necessary
     29  04 Feb 09 SHL Switch to STRINGTABLE
    2930
    3031***********************************************************************/
     
    3435
    3536// Spares are named IDS_SPARE_### here
    36 // Text in fm3dll.str will contain the notation Spare ###
    37 // Last string in fm3dll.str reserved for cvs id
    38 // Set IDS_NUMSTRS to max value here plus 2
    39 
    40 #define IDS_NUMSTRS                                           1009
    4137
    4238#define IDS_OPENBUTTONHELP                                    0
  • trunk/dll/fonts.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2009 Steven H. Levine
    1010
    1111  05 Jan 08 SHL Sync
     
    7676
    7777VOID SetPresParamFromFattrs(HWND hwnd, FATTRS * fattrs,
    78                             SHORT sNominalPointSize, FIXED fxPointSize)
     78                            SHORT sNominalPointSize, FIXED fxPointSize)
    7979{
    8080
     
    8787    if ((((USHORT) FIXEDFRAC(fxPointSize) * 100) / 65536) > 0)
    8888      sprintf(&s[strlen(s)], "%hd.",
    89               ((USHORT) FIXEDFRAC(fxPointSize) * 100) / 65536);
     89              ((USHORT) FIXEDFRAC(fxPointSize) * 100) / 65536);
    9090  }
    9191  strcat(s, fattrs->szFacename);
     
    125125  //DosEnterCritSec(); //GKY 11-30-08
    126126  DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    127   szPreview = GetPString(IDS_BLURB1TEXT);
     127  szPreview = GetPString(IDS_BLURB1TEXT + counter++);
     128  if (strcmp(szPreview, "0") == 0) {
     129    counter = 0;
     130    szPreview = GetPString(IDS_BLURB1TEXT + counter++);
     131  }
    128132  DosReleaseMutexSem(hmtxFM2Globals);
    129133  //DosExitCritSec();
     
    157161  WinReleasePS(fontdlg.hpsScreen);
    158162  SetPresParamFromFattrs(hwnd, &fontdlg.fAttrs, fontdlg.sNominalPointSize,
    159                         fontdlg.fxPointSize);
     163                        fontdlg.fxPointSize);
    160164}
    161165#endif
     
    177181  HPS hps;
    178182  FONTMETRICS fontMetrics;
    179   CHAR szFamily[CCHMAXPATH], *szPreview;
     183  CHAR szFamily[CCHMAXPATH];
     184  PCSZ pcszPreview;
    180185  static FIXED fxPointSize = 0; /* keep track of this for vector fonts */
    181186
     
    184189  //DosEnterCritSec(); //GKY 11-30-08
    185190  DosRequestMutexSem(hmtxFM2Globals, SEM_INDEFINITE_WAIT);
    186   szPreview = GetPString(IDS_BLURB1TEXT);
     191  // 12 Jan 09 SHL fixme to do multiple previews or rename to IDS_BLURBTEXT
     192  pcszPreview = GetPString(IDS_BLURB1TEXT);
    187193  DosReleaseMutexSem(hmtxFM2Globals);
    188194  //DosExitCritSec();
     
    194200  if (!(flags & 1))
    195201    WinSendMsg(hwndMLE, MLM_QUERYFONT,
    196                MPFROMP((PFATTRS) & (fontDlg.fAttrs)), NULL);
     202               MPFROMP((PFATTRS) & (fontDlg.fAttrs)), NULL);
    197203  else
    198204    memcpy(&fontDlg.fAttrs, fattrs, sizeof(FATTRS));
     
    201207
    202208  GpiCreateLogFont(hps, (PSTR8) fontDlg.fAttrs.szFacename, 1,
    203                    &(fontDlg.fAttrs));
     209                   &(fontDlg.fAttrs));
    204210  GpiSetCharSet(hps, 1);
    205211  GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fontMetrics);
     
    215221  fontDlg.hpsPrinter = NULLHANDLE;      /* Printer presentation space */
    216222
    217   fontDlg.pszTitle = GetPString(IDS_SETVIEWERFONTTITLETEXT);
    218   fontDlg.pszPreview = szPreview;
     223  fontDlg.pszTitle = (PSZ)GetPString(IDS_SETVIEWERFONTTITLETEXT);
     224  fontDlg.pszPreview = (PSZ)pcszPreview;
    219225  fontDlg.pszPtSizeList = NULL;         /* Application provided size list  */
    220226  fontDlg.pfnDlgProc = NULL;            /* Dialog subclass procedure       */
  • trunk/dll/getnames.c

    r1347 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2006, 2008 Steven H. Levine
     9  Copyright (c) 2006, 2009 Steven H. Levine
    1010
    1111  23 Aug 06 SHL Comments
     
    229229  fdlg.fl = FDS_CENTER | FDS_OPEN_DIALOG;
    230230  if (!loadit) {
    231     fdlg.pszTitle = GetPString(IDS_ENTERFILEINSERTTEXT);
    232     fdlg.pszOKButton = GetPString(IDS_INSERTTEXT);
     231    fdlg.pszTitle = (PSZ)GetPString(IDS_ENTERFILEINSERTTEXT);
     232    fdlg.pszOKButton = (PSZ)GetPString(IDS_INSERTTEXT);
    233233  }
    234234  else if (loadit == TRUE) {
    235     fdlg.pszTitle = GetPString(IDS_ENTERFILELOADTEXT);
    236     fdlg.pszOKButton = GetPString(IDS_LOADTEXT);
     235    fdlg.pszTitle = (PSZ)GetPString(IDS_ENTERFILELOADTEXT);
     236    fdlg.pszOKButton = (PSZ)GetPString(IDS_LOADTEXT);
    237237  }
    238238  else {
    239     fdlg.pszTitle = GetPString(IDS_ENTERFILETEXT);
    240     fdlg.pszOKButton = GetPString(IDS_OKAYTEXT);
     239    fdlg.pszTitle = (PSZ)GetPString(IDS_ENTERFILETEXT);
     240    fdlg.pszOKButton = (PSZ)GetPString(IDS_OKAYTEXT);
    241241  }
    242242  if (IsFullName(filename)) {
     
    333333  fdlg.cbSize = sizeof(FILEDLG);
    334334  fdlg.fl = FDS_CENTER | FDS_OPEN_DIALOG;
    335   fdlg.pszTitle = GetPString(IDS_EXPORTNAMETITLETEXT);
    336   fdlg.pszOKButton = GetPString(IDS_OKAYTEXT);
     335  fdlg.pszTitle = (PSZ)GetPString(IDS_EXPORTNAMETITLETEXT);
     336  fdlg.pszOKButton = (PSZ)GetPString(IDS_OKAYTEXT);
    337337  if (IsFullName(filename)) {
    338338    *drive = *filename;
  • trunk/dll/grep2.c

    r1375 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2004, 2008 Steven H. Levine
     9  Copyright (c) 2004, 2009 Steven H. Levine
    1010
    1111  01 Aug 04 SHL Rework lstrip/rstrip usage
     
    8484      *(CHAR *)mp2 = 0;
    8585      {
    86         CHAR *p;
    87         CHAR *pp;
     86        PCSZ p;
     87        PSZ pp;
    8888
    8989        p = GetPString(IDS_ENVVARNAMES);
     
    239239    WinSetDlgItemText(hwnd, GREP_MASK, lastmask);
    240240    WinSendDlgItemMsg(hwnd,
    241                       GREP_MASK, EM_SETSEL, MPFROM2SHORT(0, 8192), MPVOID);
     241                      GREP_MASK, EM_SETSEL, MPFROM2SHORT(0, 8192), MPVOID);
    242242    size = sizeof(BOOL);
    243243    PrfQueryProfileData(fmprof, FM3Str, "RememberFlagsGrep",
     
    247247      size = sizeof(BOOL);
    248248      PrfQueryProfileData(fmprof, FM3Str, "Grep_Recurse",
    249                           (PVOID) & recurse, &size);
     249                          (PVOID) & recurse, &size);
    250250      size = sizeof(BOOL);
    251251      PrfQueryProfileData(fmprof, FM3Str, "Grep_Absolute",
    252                           (PVOID) & absolute, &size);
     252                          (PVOID) & absolute, &size);
    253253      size = sizeof(BOOL);
    254254      PrfQueryProfileData(fmprof, FM3Str, "Grep_Case",
    255                           (PVOID) & sensitive, &size);
     255                          (PVOID) & sensitive, &size);
    256256      size = sizeof(BOOL);
    257257      PrfQueryProfileData(fmprof, FM3Str, "Grep_Sayfiles",
    258                           (PVOID) & sayfiles, &size);
     258                          (PVOID) & sayfiles, &size);
    259259      size = sizeof(BOOL);
    260260      PrfQueryProfileData(fmprof, FM3Str, "Grep_Searchfiles",
    261                           (PVOID) & searchFiles, &size);
     261                          (PVOID) & searchFiles, &size);
    262262      size = sizeof(BOOL);
    263263      PrfQueryProfileData(fmprof, FM3Str, "Grep_SearchfEAs",
  • trunk/dll/init.c

    r1393 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  11 Jun 02 SHL Add CheckVersion
     
    6464  28 Dec 08 GKY Check for LVM.EXE and remove Refresh removable media menu item as appropriate
    6565  28 Dec 08 GKY Rework partition submenu to gray out unavailable items (check for existence of files)
    66                 and have no default choice.
     66                and have no default choice.
    6767  01 Jan 09 GKY Add option to rescan tree container on eject of removable media
    6868  03 Jan 09 GKY Avoid dbl scan of drive on startup by checking for first rescan drive.
    6969  03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
    70                 Dos/Win programs from being inserted into the execute dialog with message why.
     70                Dos/Win programs from being inserted into the execute dialog with message why.
    7171  11 Jan 09 GKY Move strings that shouldn't be translated (font names etc) compile time variables
     72  03 Feb 09 SHL Switch to STRINGTABLE
    7273
    7374***********************************************************************/
     
    387388                          unsigned ulFlag)
    388389{
    389   CHAR *env;
    390   CHAR stringfile[CCHMAXPATH];
    391   FILESTATUS3 fsa;
    392   APIRET rc;
    393 
    394390  switch (ulFlag) {
    395391  case 0:
    396392    FM3DllHandle = hModule;
    397     strcpy(stringfile, "FM3RES.STR");
    398     env = getenv("FM3INI");
    399     if (env) {
    400       DosError(FERR_DISABLEHARDERR);
    401       rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa));
    402       if (!rc) {
    403         if (fsa.attrFile & FILE_DIRECTORY) {
    404           BldFullPathName(stringfile, env, "FM3RES.STR");
    405           DosError(FERR_DISABLEHARDERR);
    406           if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))
    407             strcpy(stringfile, "FM3RES.STR");
    408         }
    409       }
    410     }
    411     LoadStrings(stringfile);
    412393
    413394    DosError(FERR_DISABLEHARDERR);
     
    506487                                    unsigned long ulFlag)
    507488{
    508   CHAR *env;
    509   CHAR stringfile[CCHMAXPATH];
    510   FILESTATUS3 fsa;
    511   APIRET rc;
    512 
    513489  switch (ulFlag) {
    514490  case 0:
     
    516492      return 0UL;
    517493    FM3DllHandle = hModule;
    518     strcpy(stringfile, "FM3RES.STR");
    519     env = getenv("FM3INI");
    520     if (env) {
    521       DosError(FERR_DISABLEHARDERR);
    522       rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa));
    523       if (!rc) {
    524         if (fsa.attrFile & FILE_DIRECTORY) {
    525           BldFullPathName(stringfile, env, "FM3RES.STR");
    526           DosError(FERR_DISABLEHARDERR);
    527           if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))
    528             strcpy(stringfile, "FM3RES.STR");
    529         }
    530       }
    531     }
    532     LoadStrings(stringfile);
    533494
    534495    DosError(FERR_DISABLEHARDERR);
     
    747708  ULONG size;
    748709
    749   if (!StringsLoaded()) {
    750     saymsg(MB_ENTER,
    751            HWND_DESKTOP,
    752            "Error",
    753            "FM3RES.STR isn't in right format, at least "
    754            "for this version of FM/2.");
    755     return FALSE;
    756   }
    757 
    758710  strcpy(dllfile, "FM3RES");
    759711  env = getenv("FM3INI");
     
    10511003  hini.idAccelTable = 0;
    10521004  hini.idActionBar = 0;
    1053   hini.pszHelpWindowTitle = GetPString(IDS_FM2HELPTITLETEXT);
     1005  hini.pszHelpWindowTitle = (PSZ)GetPString(IDS_FM2HELPTITLETEXT);
    10541006  hini.fShowPanelId = CMIC_HIDE_PANEL_ID;
    10551007  hini.pszHelpLibraryName = "FM3.HLP";
     
    12981250    if (!DosQueryAppType(GetCmdSpec(TRUE), &ulAppType)) {
    12991251      ret = runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED,
    1300                     (HWND) 0, pszSrcFile, __LINE__, NULL, NULL,
    1301                     "%s /C exit", GetCmdSpec(TRUE));
     1252                    (HWND) 0, pszSrcFile, __LINE__, NULL, NULL,
     1253                    "%s /C exit", GetCmdSpec(TRUE));
    13021254      if (ret == ERROR_SMG_INVALID_PROGRAM_TYPE)
    1303         fProtectOnly = TRUE;
     1255        fProtectOnly = TRUE;
    13041256    }
    13051257    else
  • trunk/dll/input.c

    r1348 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2005, 2008 Steven H. Levine
     9  Copyright (c) 2005, 2009 Steven H. Levine
    1010
    1111  28 May 05 SHL Use saymsg
     
    3737  // mp2 points at a structure of type STRINGINPARMS
    3838  STRINGINPARMS *psip;
    39   PSZ psz;
     39  PCSZ psz;
    4040
    4141  switch (msg) {
  • trunk/dll/input.h

    r1224 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2009 Steven H. Levine
    1010
    1111  Change log
     
    1818typedef struct
    1919{
    20   CHAR *title;                  /* title of dialog */
    21   CHAR *prompt;                 /* prompt to user */
     20  PCSZ title;                   /* title of dialog */
     21  PCSZ prompt;                  /* prompt to user */
    2222  CHAR *ret;                    /* buffer out, default in */
    23   CHAR *help;                   /* help text */
     23  PCSZ help;                    /* help text */
    2424  INT inputlen;                 /* max len of ret */
    2525}
  • trunk/dll/mainwnd.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  11 Jun 02 SHL Drop obsolete xor code
     
    7777  30 Dec 08 GKY Initialize tool bar background color to palegray not black
    7878  03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
    79                 Dos/Win programs from being inserted into the execute dialog with message why.
     79                Dos/Win programs from being inserted into the execute dialog with message why.
    8080  11 Jan 09 GKY Replace font names in the string file with global set at compile in init.c
    8181
     
    942942}
    943943
    944 void BubbleHelp(HWND hwnd, BOOL other, BOOL drive, BOOL above, char *help)
     944void BubbleHelp(HWND hwnd, BOOL other, BOOL drive, BOOL above, PCSZ help)
    945945{
    946946  if (help && *help &&
     
    954954}
    955955
    956 VOID MakeBubble(HWND hwnd, BOOL above, CHAR * help)
     956VOID MakeBubble(HWND hwnd, BOOL above, PCSZ help)
    957957{
    958958  if (!hwnd || !help || !*help)
     
    997997    POINTL aptl[TXTBOX_COUNT], ptl, tptl;
    998998    LONG lxScreen, sx, sy, extra = 0, lyScreen;
    999     char *p, *pp, *wp;
     999    CHAR *p, *pp, *wp;
    10001000    SWP swp;
    10011001
     
    10071007    SetPresParams(hwndBubble, NULL, NULL, NULL, FNT_8HELVETICA);
    10081008    hps = WinGetPS(hwndBubble);
    1009     p = help;
     1009    // 03 Feb 09 SHL fixme to not overwrite?
     1010    p = (PSZ)help;
    10101011    tptl.x = tptl.y = 0;
    10111012    while (p && *p) {
     
    12281229        break;
    12291230      default:
    1230         //fixme to allow user to change presparams 1-10-09 GKY
     1231        //fixme to allow user to change presparams 1-10-09 GKY
    12311232        SetPresParams(hwnd,
    12321233                      &RGBGREY,
     
    13221323        id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
    13231324                                PickToolProc, FM3ModHandle,
    1324                                 PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
     1325                                PICKBTN_FRAME, (PSZ)GetPString(IDS_HIDETEXT));
    13251326      if (id) {
    13261327        tool = find_tool(id);
     
    13481349        id =
    13491350          (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
    1350                              PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
     1351                             PICKBTN_FRAME, (PSZ)GetPString(IDS_DELETETEXT));
    13511352      if (id)
    13521353        PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
     
    13611362        id =
    13621363          (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
    1363                              PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
     1364                             PICKBTN_FRAME, (PSZ)GetPString(IDS_EDITTEXT));
    13641365      if (id) {
    13651366        tool = find_tool(id);
     
    22752276            Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    22762277                       IDS_WINCREATEWINDOW);
    2277           else {
    2278             //fixme to allow user to change presparams 1-10-09 GKY
     2278          else {
     2279            //fixme to allow user to change presparams 1-10-09 GKY
    22792280            SetPresParams(hwndB,
    22802281                          &RGBGREY,
     
    24042405    {
    24052406      USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
    2406       char *s = NULL;
     2407      PCSZ s = NULL;
    24072408
    24082409      if (fOtherHelp) {
     
    26422643      hps = WinBeginPaint(hwnd, (HPS)0, NULL);
    26432644      if (hps) {
    2644         GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
    2645         if (!WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,
    2646                                sizeof(lColor), &lColor, 0))
    2647           lColor = 0x00CCCCCCL; //Palegray
     2645        GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
     2646        if (!WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,
     2647                               sizeof(lColor), &lColor, 0))
     2648          lColor = 0x00CCCCCCL; //Palegray
    26482649        WinQueryWindowRect(hwnd, &rcl);
    26492650        WinFillRect(hps, &rcl, lColor);
     
    29232924 */
    29242925
    2925 INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName)
     2926INT SaveDirCnrState(HWND hwndClient, PCSZ pszStateName)
    29262927{
    29272928  HENUM henum;
     
    34263427          if (hwndDir) {
    34273428            hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
    3428             if (hwndC) {
     3429            if (hwndC) {
    34293430              HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
    34303431              if (!hwndPPSave) {
     
    35023503                                   MPFROMLONG(sizeof(CNRINFO)))) {
    35033504                      cnri.flWindowAttr = dcd->flWindowAttr;
    3504                       WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
    3505                                 CM_SETCNRINFO,
    3506                                 MPFROMP(&cnri),
    3507                                 MPFROMLONG(CMA_FLWINDOWATTR));
     3505                      WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
     3506                                CM_SETCNRINFO,
     3507                                MPFROMP(&cnri),
     3508                                MPFROMLONG(CMA_FLWINDOWATTR));
    35083509                    }
    35093510                  }
     
    35133514                if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
    35143515                  WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
    3515               }
     3516              }
    35163517            }
    35173518            fRestored = TRUE;
     
    56255626    else {
    56265627      WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE),
    5627                         IdealButtonProc);
     5628                        IdealButtonProc);
    56285629      //fixme to allow user to change presparams 1-10-09 GKY
    56295630      SetPresParams(WinWindowFromID(hwndFrame,
     
    57155716                                    WC_COMBOBOX,
    57165717                                    (PSZ) NULL,
    5717                                     //WS_VISIBLE |
    5718                                     CBS_DROPDOWN,
     5718                                    //WS_VISIBLE |
     5719                                    CBS_DROPDOWN,
    57195720                                    (swp.x +
    57205721                                     WinQuerySysValue(HWND_DESKTOP,
     
    59215922    /* start remaining child windows */
    59225923    if (!fNoSaveState && fSaveState) {
    5923       PSZ pszStatename = GetPString(IDS_SHUTDOWNSTATE);
     5924      PCSZ pszStatename = GetPString(IDS_SHUTDOWNSTATE);
    59245925      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
    59255926      if (!add_setup(pszStatename))
  • trunk/dll/mainwnd.h

    r1326 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  05 Sep 08 JBS Ticket 187: Refactor FM3DLL.H
     12  04 Feb 09 SHL Convert args to const to match GetPString mods
    1213
    1314***********************************************************************/
     
    1920#include "colors.h"             // typedef for RGB2
    2021
    21 void BubbleHelp(HWND hwnd, BOOL other, BOOL data, BOOL above, char *help);
     22void BubbleHelp(HWND hwnd, BOOL other, BOOL data, BOOL above, PCSZ help);
    2223MRESULT EXPENTRY BubbleProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    2324VOID BuildDriveBarButtons(HWND hwndT);
     
    3536MRESULT EXPENTRY MainWMCommand(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    3637MRESULT EXPENTRY MainWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    37 VOID MakeBubble(HWND hwnd, BOOL above, CHAR * help);
     38VOID MakeBubble(HWND hwnd, BOOL above, PCSZ help);
    3839VOID MakeMainObjWin(VOID * args);
    3940VOID ResizeDrives(HWND hwndT, long xwidth);
    40 INT SaveDirCnrState(HWND hwndClient, CHAR * name);
     41INT SaveDirCnrState(HWND hwndClient, PCSZ name);
    4142MRESULT EXPENTRY StatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    4243VOID TileChildren(HWND hwndClient, BOOL absolute);
     
    8384extern USHORT shiftstate;
    8485
    85 #define STATE_NAME_MAX_BYTES    256
     86#define STATE_NAME_MAX_BYTES 256
    8687
    8788#endif  // MAINWND_H
  • trunk/dll/makefile

    r1335 r1394  
    33
    44# Copyright (c) 1993-98 M. Kimes
    5 # Copyright (c) 2002, 2008 Steven H. Levine
     5# Copyright (c) 2002, 2009 Steven H. Levine
    66
    77# 22 May 03 SHL Correct icon dependencies
     
    4848# 08 Dec 08 SHL Ticket 307: Add process dump support
    4949# 10 Dec 08 SHL Ticket 26: Add exception handler and exceptq support
     50# 14 Dec 08 SHL Drop copyright.c support - it's gone
     51# 18 Dec 08 SHL Avoid extra fm3res.str builds
     52# 04 Feb 09 SHL Drop mkstr and fm3*.str now that we use STRINGTABLE
    5053
    5154# Environment: see makefile_pre.mk
     
    9598!endif
    9699
    97 SYMS = $(BASE).sym $(BASERES).sym internal\mkstr.sym  #set a targets for building SYM files
     100SYMS = $(BASE).sym $(BASERES).sym # targets for building SYM files
    98101
    99102# Some flags are order dependent - see OpenWatcom docs
     
    135138CFLAGS =  -bt=os2 -mf -bd -bm -hd -d1 -olirs -s -sg -j -wx -zfp -zgp -zp4 -zq
    136139!endif
    137 # Omit -bd so exes can use copyright.obj
    138 COPYRIGHT_CFLAGS = -bt=os2 -mf -bm -s -j -zfp -zgp -zp4 -zq -hd
    139140
    140141# 26 May 08 SHL Was reversed
    141142!ifdef WARNALL
    142143CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
    143 COPYRIGHT_CFLAGS += -wce=118 -wce=130 -wce=303 -wce=307 -wce=308 -wce=309
    144144!else
    145145CFLAGS += -we
     
    182182       avl.obj avv.obj chklist.obj cmdline.obj codepage.obj &
    183183       collect.obj colors.obj commafmt.obj command.obj common.obj &
    184        comp.obj copyf.obj copyright.obj &
     184       comp.obj copyf.obj &
    185185       datamin.obj defview.obj delims.obj dircnrs.obj &
    186186       dirs.obj dirsize.obj draglist.obj droplist.obj dumputil.obj &
     
    210210     $(BASERES).res &
    211211     $(BASERES).dll &
    212      ipf\fm3.hlp &
    213      $(BASERES).str
     212     ipf\fm3.hlp
    214213
    215214syms: $(SYMS) .symbolic
    216215
    217 $(BASE).dll $(BASE).lib $(BASE).map: $(OBJS) $(BASE).def $(BASE).lrf copyright.obj
     216$(BASE).dll $(BASE).lib $(BASE).map: $(OBJS) $(BASE).def $(BASE).lrf
    218217  @echo $(LINK) @$(BASE).lrf @$(BASE).def
    219218  $(LINK) @$(BASE).lrf @$(BASE).def
     
    226225  @%append $^@ library os2386.lib
    227226
    228 copyright.obj: copyright.c .AUTODEPEND
    229   $(CC) $(COPYRIGHT_CFLAGS) copyright.c
    230 
    231227!else # MAKERES defined
    232228
     
    235231all: $(BASERES).res &
    236232     $(BASERES).dll &
    237      ipf\fm3.hlp &
    238      $(BASERES).str
     233     ipf\fm3.hlp
    239234
    240235!endif # MAKERES
     
    280275   @echo Processing: $?
    281276   -perl ..\debugtools\mapsymw.pl $?
    282 
    283 internal\mkstr.exe: .symbolic
    284   cd internal
    285   $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT)
    286   cd..
    287 
    288 internal\mkstr.sym: internal\mkstr.map
    289    @echo Processing: $?
    290    cd internal
    291    -perl ..\..\debugtools\mapsymw.pl mkstr.map
    292    cd ..
    293277
    294278!else # MAKERES defined
     
    310294!endif
    311295
    312 internal\mkstr.exe: .symbolic
    313   @echo Checking required EXEs
    314   if not exist internal\mkstr.exe internal\mkstr.exe
    315 
    316296!endif # MAKERES
    317297
    318298# For testing new code
    319299tmp.obj: tmp.c
    320 
    321 $(BASERES).str: $(BASE).str fm3str.h version.h internal\mkstr.exe
    322   internal\mkstr
    323   # ren $(BASERES).str $(BASERES).str
    324   copy $(BASERES).str ..\ /v
    325300
    326301ipf: ipf\fm3.hlp .symbolic
     
    336311!ifndef DEBUG
    337312  @for %f in ($(BASE).dll $(BASERES).dll) do !lxlite /x- /b- %f
    338   cd internal
    339   $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) lxlite
    340   cd ..
    341313!endif
    342314
    343315cleanobj: .symbolic
    344   cd internal
    345   $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) cleanobj
    346   cd..
    347316  -del *.obj
    348317
    349318clean: .symbolic
    350   cd internal
    351   $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean
    352   cd ..\ipf
     319  cd ipf
    353320  $(MAKE) $(__MAKEOPTS__) $(DEBUG_OPT) clean
    354321  cd..
     
    360327  -del *.res
    361328  -del *.sym
    362   -del $(BASERES).str
  • trunk/dll/misc.c

    r1360 r1394  
    66
    77  Copyright (c) 1993-98 M. Kimes
    8   Copyright (c) 2003, 2008 Steven H. Levine
     8  Copyright (c) 2003, 2009 Steven H. Levine
    99
    1010  11 Jun 03 SHL Add JFS and FAT32 support
     
    4141  29 Feb 08 GKY Use xfree where appropriate
    4242  08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
    43                 keys using a "DirCnr." prefix
     43                keys using a "DirCnr." prefix
    4444  19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details
    45                 switches are set correctly.
     45                switches are set correctly.
    4646  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
    47                 all the details view settings (both the global variables and those in the
    48                 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
     47                all the details view settings (both the global variables and those in the
     48                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    4949  17 Jul 08 SHL Add GetTidForWindow for Fortify support
    5050  20 Jul 08 GKY Add save/append filename to clipboard.
    51                 Change menu wording to make these easier to find
     51                Change menu wording to make these easier to find
    5252  23 Aug 08 GKY Add CheckDriveSpaceAvail To pre check drive space to prevent failures
    5353  25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
     
    141141    if (rc) {
    142142      Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    143                 "DosGetInfoBlocks");
     143                "DosGetInfoBlocks");
    144144      yes = FALSE;
    145145    }
     
    152152      // OK for window to be dead - just return FALSE
    153153      yes = WinQueryWindowProcess(hwnd, &pid, &tid) &&
    154             pid == ppib->pib_ulpid &&
    155             (!chkTid || tid == ptib->tib_ptib2->tib2_ultid);
     154            pid == ppib->pib_ulpid &&
     155            (!chkTid || tid == ptib->tib_ptib2->tib2_ultid);
    156156    }
    157157    return yes;
     
    176176    if (rc) {
    177177      Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    178                 "DosGetInfoBlocks");
     178                "DosGetInfoBlocks");
    179179    }
    180180    else {
     
    182182      TID tid;
    183183      if (!WinQueryWindowProcess(hwnd, &pid, &tid))
    184         Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd);
     184        Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd);
    185185      else if (pid != ppib->pib_ulpid)
    186         Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd);
     186        Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd);
    187187      else
    188         ordinal = ptib->tib_ptib2->tib2_ultid;
     188        ordinal = ptib->tib_ptib2->tib2_ultid;
    189189    }
    190190    return ordinal;
     
    205205    if (rc) {
    206206      Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    207                 "DosGetInfoBlocks");
     207                "DosGetInfoBlocks");
    208208    }
    209209    else
     
    312312      WinQueryWindowText(hwnd, CCHMAXPATH, s);
    313313      if (*s) {
    314         rcl.xRight -= 3;
    315         p = s;
    316         GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl);
    317         len = aptl[TXTBOX_TOPRIGHT].x;
    318         do {
    319           GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
    320           if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0)))
    321             p++;
    322           else
    323             break;
    324         }
    325         while (*p);
    326         if (*p) {
    327           GpiSetMix(hps, FM_OVERPAINT);
    328           GpiSetColor(hps, CLR_BLACK);
    329           ptl.x = 3;
    330           ptl.y = ((rcl.yTop / 2) -
    331                    ((aptl[TXTBOX_TOPRIGHT].y +
    332                      aptl[TXTBOX_BOTTOMLEFT].y) / 2));
    333           GpiMove(hps, &ptl);
    334           if (p != s)
    335             GpiCharString(hps, 3, "...");
    336           GpiCharString(hps, strlen(p), p);
    337         }
     314        rcl.xRight -= 3;
     315        p = s;
     316        GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl);
     317        len = aptl[TXTBOX_TOPRIGHT].x;
     318        do {
     319          GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
     320          if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0)))
     321            p++;
     322          else
     323            break;
     324        }
     325        while (*p);
     326        if (*p) {
     327          GpiSetMix(hps, FM_OVERPAINT);
     328          GpiSetColor(hps, CLR_BLACK);
     329          ptl.x = 3;
     330          ptl.y = ((rcl.yTop / 2) -
     331                   ((aptl[TXTBOX_TOPRIGHT].y +
     332                     aptl[TXTBOX_BOTTOMLEFT].y) / 2));
     333          GpiMove(hps, &ptl);
     334          if (p != s)
     335            GpiCharString(hps, 3, "...");
     336          GpiCharString(hps, strlen(p), p);
     337        }
    338338      }
    339339      free(s);
     
    416416}
    417417
    418 BOOL AdjustCnrColVis(HWND hwndCnr, CHAR * title, BOOL visible, BOOL toggle)
     418BOOL AdjustCnrColVis(HWND hwndCnr, PCSZ title, BOOL visible, BOOL toggle)
    419419{
    420420  PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
    421                                            CM_QUERYDETAILFIELDINFO,
    422                                            MPVOID, MPFROMSHORT(CMA_FIRST));
     421                                           CM_QUERYDETAILFIELDINFO,
     422                                           MPVOID, MPFROMSHORT(CMA_FIRST));
    423423
    424424  while (pfi) {
    425425    if (!strcmp(pfi->pTitleData, title)) {
    426426      if (toggle) {
    427         if (pfi->flData & CFA_INVISIBLE)
    428           pfi->flData &= (~CFA_INVISIBLE);
    429         else
    430           pfi->flData |= CFA_INVISIBLE;
    431         return !(pfi->flData & CFA_INVISIBLE);
     427        if (pfi->flData & CFA_INVISIBLE)
     428          pfi->flData &= (~CFA_INVISIBLE);
     429        else
     430          pfi->flData |= CFA_INVISIBLE;
     431        return !(pfi->flData & CFA_INVISIBLE);
    432432      }
    433433      else {
    434         if (visible)
    435           pfi->flData &= (~CFA_INVISIBLE);
    436         else
    437           pfi->flData |= CFA_INVISIBLE;
     434        if (visible)
     435          pfi->flData &= (~CFA_INVISIBLE);
     436        else
     437          pfi->flData |= CFA_INVISIBLE;
    438438      }
    439439      return TRUE;
     
    444444}
    445445
    446 BOOL AdjustCnrColRO(HWND hwndCnr, CHAR * title, BOOL readonly, BOOL toggle)
     446BOOL AdjustCnrColRO(HWND hwndCnr, PCSZ title, BOOL readonly, BOOL toggle)
    447447{
    448448  PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
    449                                            CM_QUERYDETAILFIELDINFO,
    450                                            MPVOID, MPFROMSHORT(CMA_FIRST));
     449                                           CM_QUERYDETAILFIELDINFO,
     450                                           MPVOID, MPFROMSHORT(CMA_FIRST));
    451451
    452452  while (pfi) {
    453453    if (!strcmp(pfi->pTitleData, title)) {
    454454      if (toggle) {
    455         if (pfi->flData & CFA_FIREADONLY)
    456           pfi->flData &= (~CFA_FIREADONLY);
    457         else
    458           pfi->flData |= CFA_FIREADONLY;
    459         return (pfi->flData & CFA_FIREADONLY);
     455        if (pfi->flData & CFA_FIREADONLY)
     456          pfi->flData &= (~CFA_FIREADONLY);
     457        else
     458          pfi->flData |= CFA_FIREADONLY;
     459        return (pfi->flData & CFA_FIREADONLY);
    460460      }
    461461      else {
    462         if (!readonly)
    463           pfi->flData &= (~CFA_FIREADONLY);
    464         else
    465           pfi->flData |= CFA_FIREADONLY;
     462        if (!readonly)
     463          pfi->flData &= (~CFA_FIREADONLY);
     464        else
     465          pfi->flData |= CFA_FIREADONLY;
    466466      }
    467467      return TRUE;
     
    472472}
    473473
    474 VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds)
     474VOID AdjustCnrColsForFSType(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS * pds)
    475475{
    476476  CHAR FileSystem[CCHMAXPATH];
     
    485485  if (x != -1) {
    486486    if (!stricmp(FileSystem, HPFS) ||
    487         !stricmp(FileSystem, JFS) ||
    488         !stricmp(FileSystem, FAT32) ||
    489         !stricmp(FileSystem, RAMFS) ||
    490         !stricmp(FileSystem, NDFS32) ||
    491         !stricmp(FileSystem, NTFS) ||
    492         !stricmp(FileSystem, HPFS386)) {
     487        !stricmp(FileSystem, JFS) ||
     488        !stricmp(FileSystem, FAT32) ||
     489        !stricmp(FileSystem, RAMFS) ||
     490        !stricmp(FileSystem, NDFS32) ||
     491        !stricmp(FileSystem, NTFS) ||
     492        !stricmp(FileSystem, HPFS386)) {
    493493      hasCreateDT = TRUE;
    494494      hasAccessDT = TRUE;
     
    514514  }
    515515  AdjustCnrColVis(hwndCnr,
    516                   GetPString(IDS_LADATE),
    517                   pds->detailsladate ? hasAccessDT : FALSE,
    518                   FALSE);
     516                  GetPString(IDS_LADATE),
     517                  pds->detailsladate ? hasAccessDT : FALSE,
     518                  FALSE);
    519519  AdjustCnrColVis(hwndCnr,
    520                   GetPString(IDS_LATIME),
    521                   pds->detailslatime ? hasAccessDT : FALSE,
    522                   FALSE);
     520                  GetPString(IDS_LATIME),
     521                  pds->detailslatime ? hasAccessDT : FALSE,
     522                  FALSE);
    523523  AdjustCnrColVis(hwndCnr,
    524                   GetPString(IDS_CRDATE),
    525                   pds->detailscrdate ? hasCreateDT : FALSE,
    526                   FALSE);
     524                  GetPString(IDS_CRDATE),
     525                  pds->detailscrdate ? hasCreateDT : FALSE,
     526                  FALSE);
    527527  AdjustCnrColVis(hwndCnr,
    528                   GetPString(IDS_CRTIME),
    529                   pds->detailscrtime ? hasCreateDT : FALSE,
    530                   FALSE);
     528                  GetPString(IDS_CRTIME),
     529                  pds->detailscrtime ? hasCreateDT : FALSE,
     530                  FALSE);
    531531  AdjustCnrColVis(hwndCnr,
    532                   GetPString(IDS_LNAME),
    533                   pds->detailslongname ? hasLongNames : FALSE,
    534                   FALSE);
     532                  GetPString(IDS_LNAME),
     533                  pds->detailslongname ? hasLongNames : FALSE,
     534                  FALSE);
    535535  WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
    536536}
    537537
    538 VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds,
    539                           BOOL compare)
     538VOID AdjustCnrColsForPref(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS * pds,
     539                          BOOL compare)
    540540{
    541541
    542542  AdjustCnrColVis(hwndCnr,
    543                   compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
    544                   pds->detailssubject,
    545                   FALSE);
     543                  compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
     544                  pds->detailssubject,
     545                  FALSE);
    546546
    547547  AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), pds->detailsattr, FALSE);
     
    572572
    573573  pfi = WinSendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO,
    574                    MPFROMLONG(CONTAINER_COLUMNS), NULL);
     574                   MPFROMLONG(CONTAINER_COLUMNS), NULL);
    575575
    576576  if (!pfi) {
     
    592592    pfi->flData = CFA_BITMAPORICON | CFA_CENTER | CFA_FIREADONLY;
    593593    pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
    594     pfi->pTitleData = GetPString(IDS_ICON);
     594    pfi->pTitleData = (PSZ)GetPString(IDS_ICON);
    595595    pfi->offStruct = FIELDOFFSET(MINIRECORDCORE, hptrIcon);
    596596
     
    605605    pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
    606606    pfi->flTitle = CFA_LEFT;
    607     pfi->pTitleData = GetPString(IDS_FILENAME);
     607    pfi->pTitleData = (PSZ)GetPString(IDS_FILENAME);
    608608    pfi->offStruct = FIELDOFFSET(CNRITEM, pszDisplayName);
    609609
     
    613613    pfi->flData = CFA_STRING | CFA_LEFT;
    614614    pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
    615     pfi->pTitleData = GetPString(IDS_LNAME);
     615    pfi->pTitleData = (PSZ)GetPString(IDS_LNAME);
    616616    pfi->offStruct = FIELDOFFSET(CNRITEM, pszLongName);
    617617
     
    622622      pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
    623623      if (isCompCnr)
    624         pfi->flData |= CFA_FIREADONLY;
     624        pfi->flData |= CFA_FIREADONLY;
    625625      pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
    626       pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :
    627                                   GetPString(IDS_SUBJ);
     626      pfi->pTitleData = isCompCnr ? (PSZ)GetPString(IDS_STATUS) :
     627                                    (PSZ)GetPString(IDS_SUBJ);
    628628      pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
    629629      pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
     
    642642      pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
    643643      if (isCompCnr)
    644         pfi->flData |= CFA_FIREADONLY;
     644        pfi->flData |= CFA_FIREADONLY;
    645645      pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
    646       pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :
    647                                   GetPString(IDS_SUBJ);
     646      pfi->pTitleData = isCompCnr ? (PSZ)GetPString(IDS_STATUS) :
     647                                    (PSZ)GetPString(IDS_SUBJ);
    648648      pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
    649649      pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
     
    656656    pfi->flData = CFA_STRING | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
    657657    pfi->flTitle = CFA_CENTER;
    658     pfi->pTitleData = GetPString(IDS_SIZE);
     658    pfi->pTitleData = (PSZ)GetPString(IDS_SIZE);
    659659    pfi->offStruct = FIELDOFFSET(CNRITEM, pszFmtFileSize);
    660660
     
    665665    pfi->flData = CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
    666666    pfi->flTitle = CFA_CENTER;
    667     pfi->pTitleData = GetPString(IDS_EA);
     667    pfi->pTitleData = (PSZ)GetPString(IDS_EA);
    668668    pfi->offStruct = FIELDOFFSET(CNRITEM, easize);
    669669
     
    673673    pfi->flData = CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY;
    674674    pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
    675     pfi->pTitleData = GetPString(IDS_ATTR);
     675    pfi->pTitleData = (PSZ)GetPString(IDS_ATTR);
    676676    pfi->offStruct = FIELDOFFSET(CNRITEM, pszDispAttr);
    677677
     
    681681    pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
    682682    pfi->flTitle = CFA_CENTER;
    683     pfi->pTitleData = GetPString(IDS_LWDATE);
     683    pfi->pTitleData = (PSZ)GetPString(IDS_LWDATE);
    684684    pfi->offStruct = FIELDOFFSET(CNRITEM, date);
    685685
     
    689689    pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
    690690    pfi->flTitle = CFA_CENTER;
    691     pfi->pTitleData = GetPString(IDS_LWTIME);
     691    pfi->pTitleData = (PSZ)GetPString(IDS_LWTIME);
    692692    pfi->offStruct = FIELDOFFSET(CNRITEM, time);
    693693
     
    697697    pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
    698698    pfi->flTitle = CFA_CENTER;
    699     pfi->pTitleData = GetPString(IDS_LADATE);
     699    pfi->pTitleData = (PSZ)GetPString(IDS_LADATE);
    700700    pfi->offStruct = FIELDOFFSET(CNRITEM, ladate);
    701701
     
    705705    pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
    706706    pfi->flTitle = CFA_CENTER;
    707     pfi->pTitleData = GetPString(IDS_LATIME);
     707    pfi->pTitleData = (PSZ)GetPString(IDS_LATIME);
    708708    pfi->offStruct = FIELDOFFSET(CNRITEM, latime);
    709709
     
    713713    pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
    714714    pfi->flTitle = CFA_CENTER;
    715     pfi->pTitleData = GetPString(IDS_CRDATE);
     715    pfi->pTitleData = (PSZ)GetPString(IDS_CRDATE);
    716716    pfi->offStruct = FIELDOFFSET(CNRITEM, crdate);
    717717
     
    721721    pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY;
    722722    pfi->flTitle = CFA_CENTER;
    723     pfi->pTitleData = GetPString(IDS_CRTIME);
     723    pfi->pTitleData = (PSZ)GetPString(IDS_CRTIME);
    724724    pfi->offStruct = FIELDOFFSET(CNRITEM, crtime);
    725725
     
    737737
    738738    if (!WinSendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, MPFROMP(pfiFirst),
    739                     MPFROMP(&fii))) {
     739                    MPFROMP(&fii))) {
    740740      Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_INSERTDETAILFIELDINFO");
    741741      fSuccess = FALSE;
     
    756756    size = sizeof(LONG);
    757757    PrfQueryProfileData(fmprof,
    758                         appname, "CnrSplitBar", &cnri.xVertSplitbar, &size);
     758                        appname, "CnrSplitBar", &cnri.xVertSplitbar, &size);
    759759    if (cnri.xVertSplitbar <= 0)
    760760      cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
    761761    if (!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri),
    762                     MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT |
    763                                CMA_XVERTSPLITBAR))) {
     762                    MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT |
     763                               CMA_XVERTSPLITBAR))) {
    764764      Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_SETCNRINFO");
    765765      fSuccess = FALSE;
     
    779779
    780780      if (pci &&
    781           (INT) pci != -1 &&
    782           !IsRoot(pci->pszFileName) &&
    783           !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) {
    784         if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) {
    785           PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID);
    786         }
    787         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject))
    788           PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID);
    789         else
    790           PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
     781          (INT) pci != -1 &&
     782          !IsRoot(pci->pszFileName) &&
     783          !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) {
     784        if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) {
     785          PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID);
     786        }
     787        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject))
     788          PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID);
     789        else
     790          PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
    791791      }
    792792      else
    793         PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
     793        PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
    794794    }
    795795    break;
     
    804804
    805805      if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
    806         if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) {
    807 
    808           APIRET rc;
    809           EAOP2 eaop;
    810           PFEA2LIST pfealist = NULL;
    811           CHAR szSubject[1048];
    812           ULONG ealen;
    813           USHORT len;
    814           CHAR *eaval;
    815           LONG retlen;
    816           PSZ psz;
    817 
    818           retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject);
    819           szSubject[retlen + 1] = 0;
    820           bstrip(szSubject);
    821           if (pci->pszSubject != NullStr) {
    822             if (retlen == 0) {
    823               psz = pci->pszSubject;
    824               pci->pszSubject = NullStr;
    825               xfree(psz, pszSrcFile, __LINE__);
    826             }
    827             else
    828               pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
    829           }
    830           else {
    831             pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__);
    832             if (!pci->pszSubject)
    833               return FALSE;
    834           }
    835           len = strlen(szSubject);
    836           if (len)
    837             ealen = sizeof(FEA2LIST) + 9 + len + 4;
    838           else
    839             ealen = sizeof(FEALIST) + 9;
    840           rc = DosAllocMem((PPVOID) & pfealist, ealen + 64,
    841                            OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
    842           if (rc)
    843             Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile,
    844                       __LINE__, GetPString(IDS_OUTOFMEMORY));
    845           else {
    846             memset(pfealist, 0, ealen + 1);
    847             pfealist->cbList = ealen;
    848             pfealist->list[0].oNextEntryOffset = 0;
    849             pfealist->list[0].fEA = 0;
    850             pfealist->list[0].cbName = 8;
    851             strcpy(pfealist->list[0].szName, SUBJECT);
    852             if (len) {
    853               eaval = pfealist->list[0].szName + 9;
    854               *(USHORT *) eaval = (USHORT) EAT_ASCII;
    855               eaval += sizeof(USHORT);
    856               *(USHORT *) eaval = (USHORT) len;
    857               eaval += sizeof(USHORT);
    858               memcpy(eaval, szSubject, len);
    859               pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
    860             }
    861             else
    862               pfealist->list[0].cbValue = 0;
    863             eaop.fpGEA2List = (PGEA2LIST) 0;
    864             eaop.fpFEA2List = pfealist;
    865             eaop.oError = 0;
    866             rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE,
    867                                 &eaop, sizeof(eaop), DSPI_WRTTHRU);
    868             DosFreeMem(pfealist);
    869             if (rc)
    870               return FALSE;
    871           }
    872           return (MRESULT) TRUE;
    873         }
    874         else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) {
    875 
    876           CHAR longname[CCHMAXPATHCOMP];
    877           LONG retlen;
    878           PSZ psz;
    879 
    880           *longname = 0;
    881           retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname);
    882           longname[retlen + 1] = 0;
    883           chop_at_crnl(longname);
    884           bstrip(longname);
    885           WinSetWindowText(hwndMLE, longname);
    886           if (pci->pszLongName != NullStr) {
    887             if (retlen == 0) {
    888               psz = pci->pszLongName;
    889               pci->pszLongName = NullStr;
    890               xfree(psz, pszSrcFile, __LINE__);
    891             }
    892             else
    893               pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
    894           }
    895           else {
    896             pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__);
    897             if (!pci->pszLongName)
    898               return FALSE;
    899           }
    900           return (MRESULT) WriteLongName(pci->pszFileName, longname);
    901         }
    902         else {
    903           WinQueryWindowText(hwndMLE, sizeof(szData), szData);
    904           if (strchr(szData, '?') ||
    905               strchr(szData, '*') || IsRoot(pci->pszFileName))
    906             return (MRESULT) FALSE;
    907           /* If the text changed, rename the file system object. */
    908           chop_at_crnl(szData);
    909           bstrip(szData);
    910           if (!IsFullName(szData))
    911             Runtime_Error(pszSrcFile, __LINE__, "bad name");
    912           else {
    913             if (DosQueryPathInfo(szData,
    914                                 FIL_QUERYFULLNAME,
    915                                 testname, sizeof(testname)))
    916                 return FALSE;
    917             if (DosQueryPathInfo(pci->pszFileName,
    918                                 FIL_QUERYFULLNAME,
    919                                 szData,
    920                                 sizeof(szData)))
    921             {
    922               pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
    923               strcpy(szData, pci->pszFileName);
    924             }
    925             WinSetWindowText(hwndMLE, szData);
    926             if (strcmp(szData, testname)) {
    927               if (stricmp(szData, testname) && IsFile(testname) != -1) {
    928                 DosBeep(50, 100);       /* exists; disallow */
    929                 return (MRESULT) FALSE;
    930               }
    931               if (fVerify && (driveflags[toupper(*szData) - 'A'] & DRIVE_WRITEVERIFYOFF ||
    932                               driveflags[toupper(*testname) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
    933                 DosSetVerify(FALSE);
    934                 fResetVerify = TRUE;
    935               }
    936               if (docopyf(MOVE, szData, "%s", testname))
    937                 Runtime_Error(pszSrcFile, __LINE__, "docopyf");
    938               else {
    939                 CHAR *filename;
    940 
    941                 filename = xstrdup(testname, pszSrcFile, __LINE__);
    942                 if (filename) {
    943                   if (!PostMsg(hwnd,
    944                                UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
    945                     free(filename);
    946                 }
    947                 if (stricmp(testname, pci->pszFileName)) {
    948                   PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci));
    949                   filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
    950                   if (filename) {
    951                     if (!PostMsg(hwnd,
    952                                 UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
    953                       free(filename);
    954                   }
    955                 }
    956               }
    957               if (fResetVerify) {
    958                 DosSetVerify(fVerify);
    959                 fResetVerify = FALSE;
    960               }
    961             }
    962           }
    963         }
     806        if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) {
     807
     808          APIRET rc;
     809          EAOP2 eaop;
     810          PFEA2LIST pfealist = NULL;
     811          CHAR szSubject[1048];
     812          ULONG ealen;
     813          USHORT len;
     814          CHAR *eaval;
     815          LONG retlen;
     816          PSZ psz;
     817
     818          retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject);
     819          szSubject[retlen + 1] = 0;
     820          bstrip(szSubject);
     821          if (pci->pszSubject != NullStr) {
     822            if (retlen == 0) {
     823              psz = pci->pszSubject;
     824              pci->pszSubject = NullStr;
     825              xfree(psz, pszSrcFile, __LINE__);
     826            }
     827            else
     828              pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
     829          }
     830          else {
     831            pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__);
     832            if (!pci->pszSubject)
     833              return FALSE;
     834          }
     835          len = strlen(szSubject);
     836          if (len)
     837            ealen = sizeof(FEA2LIST) + 9 + len + 4;
     838          else
     839            ealen = sizeof(FEALIST) + 9;
     840          rc = DosAllocMem((PPVOID) & pfealist, ealen + 64,
     841                           OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     842          if (rc)
     843            Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile,
     844                      __LINE__, GetPString(IDS_OUTOFMEMORY));
     845          else {
     846            memset(pfealist, 0, ealen + 1);
     847            pfealist->cbList = ealen;
     848            pfealist->list[0].oNextEntryOffset = 0;
     849            pfealist->list[0].fEA = 0;
     850            pfealist->list[0].cbName = 8;
     851            strcpy(pfealist->list[0].szName, SUBJECT);
     852            if (len) {
     853              eaval = pfealist->list[0].szName + 9;
     854              *(USHORT *) eaval = (USHORT) EAT_ASCII;
     855              eaval += sizeof(USHORT);
     856              *(USHORT *) eaval = (USHORT) len;
     857              eaval += sizeof(USHORT);
     858              memcpy(eaval, szSubject, len);
     859              pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
     860            }
     861            else
     862              pfealist->list[0].cbValue = 0;
     863            eaop.fpGEA2List = (PGEA2LIST) 0;
     864            eaop.fpFEA2List = pfealist;
     865            eaop.oError = 0;
     866            rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE,
     867                                &eaop, sizeof(eaop), DSPI_WRTTHRU);
     868            DosFreeMem(pfealist);
     869            if (rc)
     870              return FALSE;
     871          }
     872          return (MRESULT) TRUE;
     873        }
     874        else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) {
     875
     876          CHAR longname[CCHMAXPATHCOMP];
     877          LONG retlen;
     878          PSZ psz;
     879
     880          *longname = 0;
     881          retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname);
     882          longname[retlen + 1] = 0;
     883          chop_at_crnl(longname);
     884          bstrip(longname);
     885          WinSetWindowText(hwndMLE, longname);
     886          if (pci->pszLongName != NullStr) {
     887            if (retlen == 0) {
     888              psz = pci->pszLongName;
     889              pci->pszLongName = NullStr;
     890              xfree(psz, pszSrcFile, __LINE__);
     891            }
     892            else
     893              pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
     894          }
     895          else {
     896            pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__);
     897            if (!pci->pszLongName)
     898              return FALSE;
     899          }
     900          return (MRESULT) WriteLongName(pci->pszFileName, longname);
     901        }
     902        else {
     903          WinQueryWindowText(hwndMLE, sizeof(szData), szData);
     904          if (strchr(szData, '?') ||
     905              strchr(szData, '*') || IsRoot(pci->pszFileName))
     906            return (MRESULT) FALSE;
     907          /* If the text changed, rename the file system object. */
     908          chop_at_crnl(szData);
     909          bstrip(szData);
     910          if (!IsFullName(szData))
     911            Runtime_Error(pszSrcFile, __LINE__, "bad name");
     912          else {
     913            if (DosQueryPathInfo(szData,
     914                                FIL_QUERYFULLNAME,
     915                                testname, sizeof(testname)))
     916                return FALSE;
     917            if (DosQueryPathInfo(pci->pszFileName,
     918                                FIL_QUERYFULLNAME,
     919                                szData,
     920                                sizeof(szData)))
     921            {
     922              pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
     923              strcpy(szData, pci->pszFileName);
     924            }
     925            WinSetWindowText(hwndMLE, szData);
     926            if (strcmp(szData, testname)) {
     927              if (stricmp(szData, testname) && IsFile(testname) != -1) {
     928                DosBeep(50, 100);       /* exists; disallow */
     929                return (MRESULT) FALSE;
     930              }
     931              if (fVerify && (driveflags[toupper(*szData) - 'A'] & DRIVE_WRITEVERIFYOFF ||
     932                              driveflags[toupper(*testname) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
     933                DosSetVerify(FALSE);
     934                fResetVerify = TRUE;
     935              }
     936              if (docopyf(MOVE, szData, "%s", testname))
     937                Runtime_Error(pszSrcFile, __LINE__, "docopyf");
     938              else {
     939                CHAR *filename;
     940
     941                filename = xstrdup(testname, pszSrcFile, __LINE__);
     942                if (filename) {
     943                  if (!PostMsg(hwnd,
     944                               UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
     945                    free(filename);
     946                }
     947                if (stricmp(testname, pci->pszFileName)) {
     948                  PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci));
     949                  filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
     950                  if (filename) {
     951                    if (!PostMsg(hwnd,
     952                                UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
     953                      free(filename);
     954                  }
     955                }
     956              }
     957              if (fResetVerify) {
     958                DosSetVerify(fVerify);
     959                fResetVerify = FALSE;
     960              }
     961            }
     962          }
     963        }
    964964      }
    965965    }
     
    972972
    973973      if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
    974         WinSendMsg(hwnd,
    975                    CM_INVALIDATERECORD,
    976                    MPFROMP(&pci),
    977                    MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    978         if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
    979           PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID);
     974        WinSendMsg(hwnd,
     975                   CM_INVALIDATERECORD,
     976                   MPFROMP(&pci),
     977                   MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     978        if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
     979          PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID);
    980980      }
    981981      else {
    982         USHORT cmd = 0;
    983 
    984         if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
    985           cmd = IDM_SORTSMARTNAME;
    986         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile))
    987           cmd = IDM_SORTSIZE;
    988         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize))
    989           cmd = IDM_SORTEASIZE;
    990         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date))
    991           cmd = IDM_SORTLWDATE;
    992         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time))
    993           cmd = IDM_SORTLWDATE;
    994         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate))
    995           cmd = IDM_SORTLADATE;
    996         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime))
    997           cmd = IDM_SORTLADATE;
    998         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate))
    999           cmd = IDM_SORTCRDATE;
    1000         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime))
    1001           cmd = IDM_SORTCRDATE;
    1002         if (cmd)
    1003           PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
     982        USHORT cmd = 0;
     983
     984        if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
     985          cmd = IDM_SORTSMARTNAME;
     986        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile))
     987          cmd = IDM_SORTSIZE;
     988        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize))
     989          cmd = IDM_SORTEASIZE;
     990        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date))
     991          cmd = IDM_SORTLWDATE;
     992        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time))
     993          cmd = IDM_SORTLWDATE;
     994        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate))
     995          cmd = IDM_SORTLADATE;
     996        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime))
     997          cmd = IDM_SORTLADATE;
     998        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate))
     999          cmd = IDM_SORTCRDATE;
     1000        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime))
     1001          cmd = IDM_SORTCRDATE;
     1002        if (cmd)
     1003          PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
    10041004      }
    10051005    }
     
    10101010
    10111011BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle,
    1012                   CHAR * savename)
     1012                  PCSZ savename)
    10131013{
    10141014  if (toggle) {
     
    10181018  }
    10191019  WinSendMsg(hwndMenu, MM_SETITEMATTR,
    1020              MPFROM2SHORT(id, 1),
    1021              MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0)));
     1020             MPFROM2SHORT(id, 1),
     1021             MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0)));
    10221022  return *bool;
    10231023}
     
    10281028{
    10291029  WinSendMsg(hwndMenu, MM_SETITEMATTR,
    1030              MPFROM2SHORT(id, TRUE),
    1031              MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0)));
     1030             MPFROM2SHORT(id, TRUE),
     1031             MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0)));
    10321032}
    10331033
    10341034//== ViewHelp() invoke view.exe, return TRUE if OK ==
    10351035
    1036 BOOL ViewHelp(CHAR * filename)
     1036BOOL ViewHelp(PCSZ filename)
    10371037{
    10381038  CHAR s[CCHMAXPATH + 81];
     
    10511051    fclose(fp);
    10521052    ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
    1053                   NULL, NULL,
    1054                   "VIEW.EXE \"%s\"",
    1055                   BldQuotedFileName(szQuotedFileName, filename));
     1053                  NULL, NULL,
     1054                  "VIEW.EXE \"%s\"",
     1055                  BldQuotedFileName(szQuotedFileName, filename));
    10561056  }
    10571057
     
    10611061//== ExecFile() run file, return 1 if OK 0 if skipped -1 if can't run ==
    10621062
    1063 INT ExecFile(HWND hwnd, CHAR * filename)
     1063INT ExecFile(HWND hwnd, PCSZ filename)
    10641064{
    10651065  EXECARGS ex;
     
    10921092    *ex.environment = 0;
    10931093    ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle,
    1094                     EXEC_FRAME, &ex);
     1094                    EXEC_FRAME, &ex);
    10951095    if (ret == 1) {
    10961096      lastflags = ex.flags;
    10971097      return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path,
    1098                      *ex.environment ? ex.environment : NULL,
    1099                      "%s", pszCmdLine) != -1;
     1098                     *ex.environment ? ex.environment : NULL,
     1099                     "%s", pszCmdLine) != -1;
    11001100    }
    11011101    else if (ret != 0)
     
    11231123
    11241124VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd,
    1125                            CHAR * directory, CHAR * keyroot,
    1126                            DETAILS_SETTINGS * pds, BOOL compare)
     1125                           PCSZ directory, PCSZ keyroot,
     1126                           DETAILS_SETTINGS * pds, BOOL compare)
    11271127{
    11281128  BOOL *bool = NULL;
     
    11931193  mi.afStyle = MIS_TEXT;
    11941194  if (WinSendMsg(hwndMenu,
    1195                 MM_QUERYITEM,
    1196                 MPFROM2SHORT(id, TRUE),
    1197                 MPFROMP(&mi)))
     1195                MM_QUERYITEM,
     1196                MPFROM2SHORT(id, TRUE),
     1197                MPFROMP(&mi)))
    11981198  {
    11991199    WinSetWindowBits(mi.hwndSubMenu, QWL_STYLE, MS_CONDITIONALCASCADE,
    1200                      MS_CONDITIONALCASCADE);
     1200                     MS_CONDITIONALCASCADE);
    12011201    WinSendMsg(mi.hwndSubMenu, MM_SETDEFAULTITEMID, MPFROMSHORT(def), MPVOID);
    12021202    WinCheckMenuItem(mi.hwndSubMenu, def, TRUE);
     
    12751275  else
    12761276    WinSendMsg(hwndMenu, MM_QUERYITEM,
    1277                MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit));
     1277               MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit));
    12781278  if (mit.hwndSubMenu) {
    12791279    numitems = (SHORT) WinSendMsg(mit.hwndSubMenu, MM_QUERYITEMCOUNT,
    1280                                   MPVOID, MPVOID);
     1280                                  MPVOID, MPVOID);
    12811281    WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, MPFROMSHORT(-1), MPVOID);
    12821282    for (x = 0; x < numitems; x++)
    12831283      WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM,
    1284                 MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID);
     1284                MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID);
    12851285    if (hwndCnr && cmdhead) {
    12861286      x = 0;
     
    12881288      while (info) {
    12891289
    1290         CHAR s[CCHMAXPATH + 24];
    1291 
    1292         sprintf(s,
    1293                 "%s%s%s",
    1294                 info->title,
    1295                 x < 20 ? "\tCtrl + " : NullStr,
    1296                 x < 20 && x > 9 ? "Shift + " : NullStr);
    1297         if (x < 20)
    1298           sprintf(&s[strlen(s)], "%d",
    1299                   ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1);
    1300         mi.id = IDM_COMMANDSTART + x;
    1301         mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) |
    1302                         (info->flags & PROMPT ? MIA_FRAMED : 0);
    1303         mi.afStyle = MIS_TEXT;
    1304         if (!(x % 24) && x && info->next)
    1305           mi.afStyle |= MIS_BREAK;
    1306         WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s));
    1307         x++;
    1308         info = info->next;
     1290        CHAR s[CCHMAXPATH + 24];
     1291
     1292        sprintf(s,
     1293                "%s%s%s",
     1294                info->title,
     1295                x < 20 ? "\tCtrl + " : NullStr,
     1296                x < 20 && x > 9 ? "Shift + " : NullStr);
     1297        if (x < 20)
     1298          sprintf(&s[strlen(s)], "%d",
     1299                  ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1);
     1300        mi.id = IDM_COMMANDSTART + x;
     1301        mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) |
     1302                        (info->flags & PROMPT ? MIA_FRAMED : 0);
     1303        mi.afStyle = MIS_TEXT;
     1304        if (!(x % 24) && x && info->next)
     1305          mi.afStyle |= MIS_BREAK;
     1306        WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s));
     1307        x++;
     1308        info = info->next;
    13091309      }
    13101310    }
     
    13121312}
    13131313
    1314 VOID LoadDetailsSwitches(CHAR * keyroot, DETAILS_SETTINGS * pds)
     1314VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS * pds)
    13151315{
    13161316  ULONG size;
     
    14011401      hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
    14021402      if (hwndDir)
    1403         break;
     1403        break;
    14041404      hwndDir = (HWND) 0;
    14051405    }
     
    14181418  if (rc)
    14191419    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1420               "DosCreateEventSem");
     1420              "DosCreateEventSem");
    14211421  else {
    14221422    priority_normal();
    14231423    for (;;) {
    14241424      if (DosWaitEventSem(CompactSem, SEM_INDEFINITE_WAIT))
    1425         break;
     1425        break;
    14261426      _heapmin();
    14271427      DosResetEventSem(CompactSem, &postcount);
     
    14301430}
    14311431
    1432 VOID FixSwitchList(HWND hwnd, CHAR * text)
     1432VOID FixSwitchList(HWND hwnd, PCSZ text)
    14331433{
    14341434  HSWITCH hswitch;
     
    14491449  if (dcd->hwndLastMenu && !dcd->cnremphasized) {
    14501450    WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
    1451                MPFROM2SHORT(TRUE, CRA_SOURCE));
     1451               MPFROM2SHORT(TRUE, CRA_SOURCE));
    14521452    dcd->cnremphasized = TRUE;
    14531453  }
     
    14551455    WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
    14561456  if (!WinPopupMenu(hwnd, hwnd, dcd->hwndLastMenu,
    1457                     8, 8, 0,
    1458                     PU_HCONSTRAIN | PU_VCONSTRAIN |
    1459                     PU_KEYBOARD | PU_MOUSEBUTTON1)) {
     1457                    8, 8, 0,
     1458                    PU_HCONSTRAIN | PU_VCONSTRAIN |
     1459                    PU_KEYBOARD | PU_MOUSEBUTTON1)) {
    14601460    if (dcd->cnremphasized) {
    14611461      WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
    1462                 MPFROM2SHORT(FALSE, CRA_SOURCE));
     1462                MPFROM2SHORT(FALSE, CRA_SOURCE));
    14631463      dcd->cnremphasized = FALSE;
    14641464    }
     
    14661466  else
    14671467    WinSendMsg(dcd->hwndLastMenu, MM_SELECTITEM,
    1468                MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE));
     1468               MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE));
    14691469}
    14701470
     
    14761476  for (;;) {
    14771477    pmi = (PMINIRECORDCORE) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS,
    1478                                        MPFROMLONG(CMA_FIRST),
    1479                                        MPFROMSHORT(attrib));
     1478                                       MPFROMLONG(CMA_FIRST),
     1479                                       MPFROMSHORT(attrib));
    14801480    if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED)    /* punt */
    14811481      attrib = CRA_CURSORED;
     
    14961496      QMSG qmsg;
    14971497      for (;;) {
    1498         DosSleep(1);
    1499         rc = WinPostMsg(h, msg, mp1, mp2);
    1500         if (rc)
    1501           break;                        // OK
    1502         if (!WinIsWindow((HAB) 0, h))
    1503           break;                        // Window gone
    1504         if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE))
    1505           break;                        // Queue has message(s)
     1498        DosSleep(1);
     1499        rc = WinPostMsg(h, msg, mp1, mp2);
     1500        if (rc)
     1501          break;                        // OK
     1502        if (!WinIsWindow((HAB) 0, h))
     1503          break;                        // Window gone
     1504        if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE))
     1505          break;                        // Queue has message(s)
    15061506      }                  // for
    15071507    }
     
    15171517
    15181518  pci = (PCNRITEM) WinSendMsg(hwnd,
    1519                               CM_QUERYRECORDEMPHASIS,
    1520                               MPFROMLONG(CMA_FIRST),
    1521                               MPFROMSHORT(CRA_CURSORED));
     1519                              CM_QUERYRECORDEMPHASIS,
     1520                              MPFROMLONG(CMA_FIRST),
     1521                              MPFROMSHORT(CRA_CURSORED));
    15221522  if (pci && (INT) pci != -1) {
    15231523    memset(&ced, 0, sizeof(ced));
     
    15271527    ced.pRecord = (PRECORDCORE) pci;
    15281528    pfi = (PFIELDINFO) WinSendMsg(hwnd,
    1529                                   CM_QUERYDETAILFIELDINFO,
    1530                                   MPVOID, MPFROMSHORT(CMA_FIRST));
     1529                                  CM_QUERYDETAILFIELDINFO,
     1530                                  MPVOID, MPFROMSHORT(CMA_FIRST));
    15311531    if (!pfi)
    15321532      WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
    15331533    else {
    15341534      while (pfi && (INT) pfi != -1 &&
    1535              pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName))
    1536         pfi = (PFIELDINFO) WinSendMsg(hwnd,
    1537                                       CM_QUERYDETAILFIELDINFO,
    1538                                       MPFROMP(pfi), MPFROMSHORT(CMA_NEXT));
     1535             pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName))
     1536        pfi = (PFIELDINFO) WinSendMsg(hwnd,
     1537                                      CM_QUERYDETAILFIELDINFO,
     1538                                      MPFROMP(pfi), MPFROMSHORT(CMA_NEXT));
    15391539      if (pfi && (INT) pfi != -1) {
    1540         ced.pFieldInfo = pfi;
    1541         {
    1542           CNRINFO cnri;
    1543 
    1544           memset(&cnri, 0, sizeof(CNRINFO));
    1545           cnri.cb = sizeof(CNRINFO);
    1546           WinSendMsg(hwnd,
    1547                      CM_QUERYCNRINFO,
    1548                      MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
    1549           if (cnri.flWindowAttr & CV_DETAIL)
    1550             ced.id = CID_LEFTDVWND;
    1551         }
    1552         WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
     1540        ced.pFieldInfo = pfi;
     1541        {
     1542          CNRINFO cnri;
     1543
     1544          memset(&cnri, 0, sizeof(CNRINFO));
     1545          cnri.cb = sizeof(CNRINFO);
     1546          WinSendMsg(hwnd,
     1547                     CM_QUERYCNRINFO,
     1548                     MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
     1549          if (cnri.flWindowAttr & CV_DETAIL)
     1550            ced.id = CID_LEFTDVWND;
     1551        }
     1552        WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
    15531553      }
    15541554    }
     
    15571557
    15581558#ifdef NEVER
    1559 VOID QuickView(HWND hwnd, CHAR * filename)
     1559VOID QuickView(HWND hwnd, PCSZ filename)
    15601560{
    15611561  if (filename && IsFile(filename) == 1) {
     
    15671567      list[1] = NULL;
    15681568      ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, list, NULL,
    1569                 pszSrcFile, __LINE__);
     1569                pszSrcFile, __LINE__);
    15701570      return;
    15711571    }
     
    15771577      list[1] = NULL;
    15781578      ExecOnList(hwnd, viewer,
    1579                 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
    1580                 NULL, list, NULL, pszSrcFile, __LINE__);
     1579                WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
     1580                NULL, list, NULL, pszSrcFile, __LINE__);
    15811581      return;
    15821582    }
     
    15951595      list[1] = NULL;
    15961596      ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, list, NULL,
    1597                 pszSrcFile, __LINE__);
     1597                pszSrcFile, __LINE__);
    15981598      return;
    15991599    }
     
    16051605      list[1] = NULL;
    16061606      ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, list, NULL,
    1607                 pszSrcFile, __LINE__);
     1607                pszSrcFile, __LINE__);
    16081608      return;
    16091609    }
     
    16371637      mi.afStyle = MIS_TEXT;
    16381638      WinSendMsg(hwndMenu, MM_QUERYITEM,
    1639                 MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi));
     1639                MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi));
    16401640      if (!DefMenu)
    1641         DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
     1641        DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
    16421642      hwndNow = mi.hwndSubMenu;
    16431643      mi.hwndSubMenu = hwndNew;
    16441644      if (!mi.hwndSubMenu)
    1645         mi.hwndSubMenu = DefMenu;
     1645        mi.hwndSubMenu = DefMenu;
    16461646      WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
    16471647      WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
     
    16681668      mi.afStyle = MIS_TEXT;
    16691669      WinSendMsg(hwndMenu, MM_QUERYITEM,
    1670                 MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi));
     1670                MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi));
    16711671      if (!DefMenu)
    1672         DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
     1672        DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
    16731673      hwndNow = mi.hwndSubMenu;
    16741674      mi.hwndSubMenu = hwndNew;
    16751675      if (!mi.hwndSubMenu)
    1676         mi.hwndSubMenu = DefMenu;
     1676        mi.hwndSubMenu = DefMenu;
    16771677      WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
    16781678      WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
     
    17061706      SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
    17071707      SetConditionalCascade(DirMenu, IDM_DELETESUBMENU,
    1708                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1708                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    17091709      SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES);
    17101710      SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
    17111711      if (fWorkPlace) {
    1712         WinSendMsg(DirMenu, MM_DELETEITEM,
    1713                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1714         WinSendMsg(DirMenu, MM_DELETEITEM,
    1715                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1712        WinSendMsg(DirMenu, MM_DELETEITEM,
     1713                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1714        WinSendMsg(DirMenu, MM_DELETEITEM,
     1715                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    17161716      }
    17171717    }
     
    17251725      SetConditionalCascade(TreeMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
    17261726      if (fWorkPlace) {
    1727         WinSendMsg(TreeMenu, MM_DELETEITEM,
    1728                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1729         WinSendMsg(TreeMenu, MM_DELETEITEM,
    1730                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1727        WinSendMsg(TreeMenu, MM_DELETEITEM,
     1728                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1729        WinSendMsg(TreeMenu, MM_DELETEITEM,
     1730                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    17311731      }
    17321732      if (!fLVM)
    1733         WinSendMsg(TreeMenu, MM_DELETEITEM,
    1734                    MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
     1733        WinSendMsg(TreeMenu, MM_DELETEITEM,
     1734                   MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
    17351735    }
    17361736    else if (hwndMenu == &ArcMenu) {
     
    17401740      SetConditionalCascade(ArcMenu, IDM_VIEWSUBMENU, IDM_VIEW);
    17411741      if (fWorkPlace)
    1742         WinSendMsg(ArcMenu, MM_DELETEITEM,
    1743                    MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
     1742        WinSendMsg(ArcMenu, MM_DELETEITEM,
     1743                   MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
    17441744    }
    17451745    else if (hwndMenu == &FileMenu) {
     
    17531753      SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT);
    17541754      SetConditionalCascade(FileMenu, IDM_DELETESUBMENU,
    1755                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1755                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    17561756      SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT);
    17571757      SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
    17581758      if (fWorkPlace) {
    1759         WinSendMsg(FileMenu, MM_DELETEITEM,
    1760                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1761         WinSendMsg(FileMenu, MM_DELETEITEM,
    1762                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1759        WinSendMsg(FileMenu, MM_DELETEITEM,
     1760                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1761        WinSendMsg(FileMenu, MM_DELETEITEM,
     1762                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    17631763      }
    17641764      if (!fLVM)
    1765         WinSendMsg(FileMenu, MM_DELETEITEM,
    1766                    MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
     1765        WinSendMsg(FileMenu, MM_DELETEITEM,
     1766                   MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
    17671767    }
    17681768    else if (hwndMenu == &DirCnrMenu) {
     
    17711771      SetConditionalCascade(DirCnrMenu, IDM_OPENSUBMENU, IDM_OPENSETTINGSME);
    17721772      if (fWorkPlace)
    1773         WinSendMsg(DirCnrMenu, MM_DELETEITEM,
    1774                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1773        WinSendMsg(DirCnrMenu, MM_DELETEITEM,
     1774                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    17751775    }
    17761776    else if (hwndMenu == &TreeCnrMenu) {
    17771777      WinSetWindowUShort(TreeCnrMenu, QWS_ID, IDM_VIEWSMENU);
    17781778      if (!fLVM)
    1779         WinSendMsg(TreeCnrMenu, MM_DELETEITEM,
    1780                    MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
     1779        WinSendMsg(TreeCnrMenu, MM_DELETEITEM,
     1780                   MPFROM2SHORT(IDM_REFRESHREMOVABLES, TRUE), MPVOID);
    17811781    }
    17821782    else if (hwndMenu == &ArcCnrMenu) {
     
    17841784      SetConditionalCascade(ArcCnrMenu, IDM_EXTRACTSUBMENU, IDM_ARCEXTRACT);
    17851785      if (fWorkPlace)
    1786         WinSendMsg(ArcCnrMenu, MM_DELETEITEM,
    1787                    MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
     1786        WinSendMsg(ArcCnrMenu, MM_DELETEITEM,
     1787                   MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
    17881788    }
    17891789    else if (hwndMenu == &CollectorCnrMenu) {
    17901790      WinSetWindowUShort(CollectorCnrMenu, QWS_ID, IDM_VIEWSMENU);
    17911791      SetConditionalCascade(CollectorCnrMenu, IDM_COLLECTMENU,
    1792                             IDM_COLLECTFROMCLIP);
     1792                            IDM_COLLECTFROMCLIP);
    17931793    }
    17941794    else if (hwndMenu == &CollectorFileMenu) {
    17951795      WinSetWindowUShort(CollectorFileMenu, QWS_ID, IDM_FILESMENU);
    17961796      SetConditionalCascade(CollectorFileMenu, IDM_COMMANDSMENU,
    1797                             IDM_DOITYOURSELF);
     1797                            IDM_DOITYOURSELF);
    17981798      SetConditionalCascade(CollectorFileMenu, IDM_COPYMENU, IDM_COPY);
    17991799      SetConditionalCascade(CollectorFileMenu, IDM_MOVEMENU, IDM_MOVE);
    18001800      SetConditionalCascade(CollectorFileMenu, IDM_SAVESUBMENU,
    1801                             IDM_SAVETOCLIP);
     1801                            IDM_SAVETOCLIP);
    18021802      SetConditionalCascade(CollectorFileMenu, IDM_VIEWSUBMENU, IDM_VIEW);
    18031803      SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT);
    18041804      SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU,
    1805                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1805                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    18061806      SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU,
    1807                             IDM_OPENDEFAULT);
     1807                            IDM_OPENDEFAULT);
    18081808      SetConditionalCascade(CollectorFileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
    18091809      if (fWorkPlace) {
    1810         WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
    1811                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1812         WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
    1813                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1810        WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
     1811                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1812        WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
     1813                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    18141814      }
    18151815    }
     
    18171817      WinSetWindowUShort(CollectorDirMenu, QWS_ID, IDM_FILESMENU);
    18181818      SetConditionalCascade(CollectorDirMenu, IDM_COMMANDSMENU,
    1819                             IDM_DOITYOURSELF);
     1819                            IDM_DOITYOURSELF);
    18201820      SetConditionalCascade(CollectorDirMenu, IDM_COPYMENU, IDM_COPY);
    18211821      SetConditionalCascade(CollectorDirMenu, IDM_MOVEMENU, IDM_MOVE);
    18221822      SetConditionalCascade(CollectorDirMenu, IDM_SAVESUBMENU,
    1823                             IDM_SAVETOCLIP);
     1823                            IDM_SAVETOCLIP);
    18241824      SetConditionalCascade(CollectorDirMenu, IDM_VIEWSUBMENU, IDM_INFO);
    18251825      SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
    18261826      SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU,
    1827                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1827                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    18281828      SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES);
    18291829      SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU,
    1830                             IDM_OPENWINDOW);
     1830                            IDM_OPENWINDOW);
    18311831      if (fWorkPlace) {
    1832         WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
    1833                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1834         WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
    1835                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1832        WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
     1833                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1834        WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
     1835                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    18361836      }
    18371837    }
     
    18461846}
    18471847
    1848 SHORT AddToListboxBottom(HWND hwnd, CHAR * str)
     1848SHORT AddToListboxBottom(HWND hwnd, PCSZ str)
    18491849{
    18501850  SHORT ln;
    18511851
    18521852  ln = (SHORT) WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0),
    1853                           MPFROMP(str));
     1853                          MPFROMP(str));
    18541854  if (ln)
    18551855    WinSendMsg(hwnd, LM_SELECTITEM, MPFROM2SHORT(ln, 0), MPVOID);
     
    18621862
    18631863  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1864                 MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) {
     1864                MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) {
    18651865    p = strchr(s, '\t');
    18661866    if (p) {
     
    18711871  }
    18721872  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1873                 MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) {
     1873                MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) {
    18741874    p = strchr(s, '\t');
    18751875    if (p) {
     
    18801880  }
    18811881  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1882                 MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) {
     1882                MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) {
    18831883    p = strchr(s, '\t');
    18841884    if (p) {
     
    18891889  }
    18901890  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1891                 MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) {
     1891                MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) {
    18921892    p = strchr(s, '\t');
    18931893    if (p) {
     
    18981898  }
    18991899  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1900                 MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) {
     1900                MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) {
    19011901    p = strchr(s, '\t');
    19021902    if (p) {
     
    19071907  }
    19081908  if (WinSendMsg(hwndSysMenu,
    1909                 MM_QUERYITEMTEXT,
    1910                 MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) {
     1909                MM_QUERYITEMTEXT,
     1910                MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) {
    19111911    p = strchr(s, '\t');
    19121912    if (p) {
     
    19171917  }
    19181918  if (WinSendMsg(hwndSysMenu,
    1919                 MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) {
     1919                MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) {
    19201920    p = strchr(s, '\t');
    19211921    if (p) {
     
    19271927}
    19281928
    1929 VOID LoadLibPath(CHAR * str, LONG len)
     1929VOID LoadLibPath(PSZ str, LONG len)
    19301930{
    19311931  ULONG ver[2];
     
    19401940    *str = 0;
    19411941    if (DosQuerySysInfo(QSV_BOOT_DRIVE,
    1942                         QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG)))
     1942                        QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG)))
    19431943      ver[0] = 3L;
    19441944    *configsys = (CHAR) ver[0] + '@';
    19451945    if (!DosQuerySysInfo(QSV_VERSION_MAJOR,
    1946                         QSV_VERSION_MINOR,
    1947                         (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30)
     1946                        QSV_VERSION_MINOR,
     1947                        (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30)
    19481948      warp = TRUE;
    19491949    *var = *beg = *end = 0;
    19501950    if (warp) {
    19511951      if (!DosLoadModule(var, sizeof(var), "DOSCALL1.DLL", &hmod)) {
    1952         if (!DosQueryProcAddr(hmod,
    1953                               ORD_DOS32QUERYEXTLIBPATH,
    1954                               NULL, (PFN *) & DQELIBPATH)) {
    1955           DQELIBPATH(beg, BEGIN_LIBPATH);
    1956           DQELIBPATH(end, END_LIBPATH);
    1957         }
    1958         DosFreeModule(hmod);
     1952        if (!DosQueryProcAddr(hmod,
     1953                              ORD_DOS32QUERYEXTLIBPATH,
     1954                              NULL, (PFN *) & DQELIBPATH)) {
     1955          DQELIBPATH(beg, BEGIN_LIBPATH);
     1956          DQELIBPATH(end, END_LIBPATH);
     1957        }
     1958        DosFreeModule(hmod);
    19591959      }
    19601960      *var = 0;
     
    19631963    if (fp) {
    19641964      while (!feof(fp)) {
    1965         if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__))
    1966           break;
    1967         if (!strnicmp(var, "LIBPATH=", 8)) {
    1968           memmove(var, var + 8, strlen(var + 8) + 1);
    1969           lstrip(var);
    1970           break;
    1971         }
     1965        if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__))
     1966          break;
     1967        if (!strnicmp(var, "LIBPATH=", 8)) {
     1968          memmove(var, var + 8, strlen(var + 8) + 1);
     1969          lstrip(var);
     1970          break;
     1971        }
    19721972      }
    19731973      fclose(fp);
     
    19851985  WinCheckMenuItem(hwndMenu, IDM_TEXT, ((flWindowAttr & CV_TEXT)));
    19861986  WinCheckMenuItem(hwndMenu, IDM_ICON, ((flWindowAttr & CV_ICON) &&
    1987                                         !(flWindowAttr & CV_TREE)));
     1987                                        !(flWindowAttr & CV_TREE)));
    19881988  WinCheckMenuItem(hwndMenu, IDM_TREEVIEW, ((flWindowAttr & CV_TREE)));
    19891989  WinCheckMenuItem(hwndMenu, IDM_DETAILS, ((flWindowAttr & CV_DETAIL)));
     
    19981998  if (s) {
    19991999    sprintf(s, "S:%s%s",
    2000             sortflags & SORT_REVERSE ? "^" : NullStr,
    2001             (sortflags & SORT_FIRSTEXTENSION) ?
    2002               GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ?
    2003                 GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ?
    2004                   "Size" : (sortflags & SORT_EASIZE) ?
    2005                     (archive == 0) ?
    2006                       GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
    2007                     (sortflags & SORT_LWDATE) ?
    2008                       (archive == 0) ?
    2009                         GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
    2010                         (sortflags & SORT_LADATE) ?
    2011                           GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
    2012                             GetPString(IDS_CRDATE) :
    2013                             (sortflags & SORT_PATHNAME) ?
    2014                               GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
    2015                                 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
    2016                                   GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
     2000            sortflags & SORT_REVERSE ? "^" : NullStr,
     2001            (sortflags & SORT_FIRSTEXTENSION) ?
     2002              GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ?
     2003                GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ?
     2004                  "Size" : (sortflags & SORT_EASIZE) ?
     2005                    (archive == 0) ?
     2006                      GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
     2007                    (sortflags & SORT_LWDATE) ?
     2008                      (archive == 0) ?
     2009                        GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
     2010                        (sortflags & SORT_LADATE) ?
     2011                          GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
     2012                            GetPString(IDS_CRDATE) :
     2013                            (sortflags & SORT_PATHNAME) ?
     2014                              GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
     2015                                GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
     2016                                  GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
    20172017    WinSetWindowText(hwnd, s);
    20182018    free(s);
     
    20272027  if (s) {
    20282028    sprintf(s, "V:%s%s",
    2029             (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) :
    2030             (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) :
    2031             (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) :
    2032             (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) :
    2033             GetPString(IDS_ICON),
    2034             ((flWindowAttr & CV_MINI) &&
    2035              !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
     2029            (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) :
     2030            (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) :
     2031            (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) :
     2032            (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) :
     2033            GetPString(IDS_ICON),
     2034            ((flWindowAttr & CV_MINI) &&
     2035             !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
    20362036    WinSetWindowText(hwnd, s);
    20372037    free(s);
     
    20462046  if (s) {
    20472047    sprintf(s, "F:%s%s",
    2048             mask->szMask,
    2049             (!archive && (mask->attrFile != ALLATTRS ||
    2050                           mask->antiattr != 0)) ? " " : NullStr,
    2051             (!archive && (mask->attrFile != ALLATTRS ||
    2052                           mask->antiattr !=
    2053                           0)) ? GetPString(IDS_ATTRTEXT) : NullStr);
     2048            mask->szMask,
     2049            (!archive && (mask->attrFile != ALLATTRS ||
     2050                          mask->antiattr != 0)) ? " " : NullStr,
     2051            (!archive && (mask->attrFile != ALLATTRS ||
     2052                          mask->antiattr !=
     2053                          0)) ? GetPString(IDS_ATTRTEXT) : NullStr);
    20542054    if (!s[2])
    20552055      sprintf(s, "F:%s", GetPString(IDS_ALLTEXT));
     
    21002100
    21012101  sItemCount = (SHORT) WinSendMsg(hwndMenu,
    2102                                   MM_QUERYITEMCOUNT, MPVOID, MPVOID);
     2102                                  MM_QUERYITEMCOUNT, MPVOID, MPVOID);
    21032103
    21042104  /* clean out old additions */
    21052105  while ((SHORT) WinSendMsg(hwndMenu,
    2106                             MM_DELETEITEM,
    2107                             MPFROM2SHORT(IDM_SWITCHSTART + x++,
    2108                                         TRUE), MPVOID) < sItemCount)
     2106                            MM_DELETEITEM,
     2107                            MPFROM2SHORT(IDM_SWITCHSTART + x++,
     2108                                        TRUE), MPVOID) < sItemCount)
    21092109    sItemCount--;
    21102110  x = 0;
    21112111  while ((SHORT) WinSendMsg(hwndMenu,
    2112                             MM_DELETEITEM,
    2113                             MPFROM2SHORT(IDM_WINDOWSTART + x++,
    2114                                         TRUE), MPVOID) < sItemCount)
     2112                            MM_DELETEITEM,
     2113                            MPFROM2SHORT(IDM_WINDOWSTART + x++,
     2114                                        TRUE), MPVOID) < sItemCount)
    21152115    sItemCount--;
    21162116
     
    21272127    while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
    21282128      if (WinQueryWindowUShort(hwndChild, QWS_ID) && hwndChild != hwndFrame) {
    2129         *wtext = 0;
    2130         WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext);
    2131         if (*wtext) {
    2132           wtext[CCHMAXPATH + 7] = 0;
    2133           mi.afStyle = MIS_TEXT;
    2134           if (!((x + sItemCount) % 28))
    2135             mi.afStyle |= MIS_BREAK;
    2136           mi.id = IDM_WINDOWSTART + x;
    2137           mi.iPosition = MIT_END;
    2138           if ((SHORT) WinSendMsg(hwndMenu,
    2139                                 MM_INSERTITEM,
    2140                                 MPFROMP(&mi), MPFROMP(wtext)) >= 0)
    2141             x++;
    2142         }
     2129        *wtext = 0;
     2130        WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext);
     2131        if (*wtext) {
     2132          wtext[CCHMAXPATH + 7] = 0;
     2133          mi.afStyle = MIS_TEXT;
     2134          if (!((x + sItemCount) % 28))
     2135            mi.afStyle |= MIS_BREAK;
     2136          mi.id = IDM_WINDOWSTART + x;
     2137          mi.iPosition = MIT_END;
     2138          if ((SHORT) WinSendMsg(hwndMenu,
     2139                                MM_INSERTITEM,
     2140                                MPFROMP(&mi), MPFROMP(wtext)) >= 0)
     2141            x++;
     2142        }
    21432143      }
    21442144    }
     
    21672167      memset(&mi, 0, sizeof(mi));
    21682168      for (i = 0; i < pswb->cswentry; i++) {
    2169         if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&
    2170             pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&
    2171             (pswb->aswentry[i].swctl.idProcess != mypid ||
    2172              !hwndFrame ||
    2173              pswb->aswentry[i].swctl.hwnd != hwndFrame) &&
    2174             (pswb->aswentry[i].swctl.idProcess != mypid ||
    2175              !hwndTopFrame ||
    2176              pswb->aswentry[i].swctl.hwnd != hwndTopFrame ||
    2177              !WinIsChild(hwndFrame, hwndTop))) {
    2178           if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4)
    2179               || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2")
    2180               || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector")
    2181               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5)
    2182               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4)
    2183               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) {
    2184             mi.afStyle = MIS_TEXT;
    2185             if (x && !(x % 28))
    2186               mi.afStyle |= MIS_BREAK;
    2187             mi.id = IDM_SWITCHSTART + y;
    2188             mi.iPosition = MIT_END;
    2189             switches[y] = pswb->aswentry[i].hswitch;
    2190             if ((SHORT) WinSendMsg(hwndMenu,
    2191                                    MM_INSERTITEM,
    2192                                    MPFROMP(&mi),
    2193                                    MPFROMP(pswb->aswentry[i].
    2194                                            swctl.szSwtitle)) >= 0) {
    2195               y++;
    2196               x++;
    2197             }
    2198           }
    2199         }
     2169        if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&
     2170            pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&
     2171            (pswb->aswentry[i].swctl.idProcess != mypid ||
     2172             !hwndFrame ||
     2173             pswb->aswentry[i].swctl.hwnd != hwndFrame) &&
     2174            (pswb->aswentry[i].swctl.idProcess != mypid ||
     2175             !hwndTopFrame ||
     2176             pswb->aswentry[i].swctl.hwnd != hwndTopFrame ||
     2177             !WinIsChild(hwndFrame, hwndTop))) {
     2178          if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4)
     2179              || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2")
     2180              || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector")
     2181              || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5)
     2182              || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4)
     2183              || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) {
     2184            mi.afStyle = MIS_TEXT;
     2185            if (x && !(x % 28))
     2186              mi.afStyle |= MIS_BREAK;
     2187            mi.id = IDM_SWITCHSTART + y;
     2188            mi.iPosition = MIT_END;
     2189            switches[y] = pswb->aswentry[i].hswitch;
     2190            if ((SHORT) WinSendMsg(hwndMenu,
     2191                                   MM_INSERTITEM,
     2192                                   MPFROMP(&mi),
     2193                                   MPFROMP(pswb->aswentry[i].
     2194                                           swctl.szSwtitle)) >= 0) {
     2195              y++;
     2196              x++;
     2197            }
     2198          }
     2199        }
    22002200      }
    22012201      numswitches = y;
     
    22242224      mi.afStyle = MIS_TEXT;
    22252225      if (WinSendMsg(hwndMenu,
    2226                      MM_QUERYITEM,
    2227                      MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
    2228         hwndSubMenu = mi.hwndSubMenu;
     2226                     MM_QUERYITEM,
     2227                     MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
     2228        hwndSubMenu = mi.hwndSubMenu;
    22292229    }
    22302230    else
     
    22332233      *s = 0;
    22342234      if (WinSendMsg(hwndSubMenu,
    2235                      MM_QUERYITEMTEXT,
    2236                      MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) {
    2237 
    2238         HENUM henum;
    2239         CHAR checkText[CCHMAXPATH + 8];
    2240         SWP swp;
    2241 
    2242         s[CCHMAXPATH + 7] = 0;
    2243         henum = WinBeginEnumWindows(hwndMain);
    2244         while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
    2245           if (WinQueryWindowUShort(hwndChild, QWS_ID)) {
    2246             *checkText = 0;
    2247             WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText);
    2248             checkText[CCHMAXPATH + 7] = 0;
    2249             if (!stricmp(checkText, s)) {
    2250               if (WinQueryWindowPos(hwndChild, &swp)) {
    2251                 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
    2252                   WinSetWindowPos(hwndChild,
    2253                                   HWND_TOP,
    2254                                   0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER);
    2255               }
    2256               WinSetActiveWindow(HWND_DESKTOP, hwndChild);
    2257               ret = TRUE;
    2258               break;
    2259             }
    2260           }
    2261         }
    2262         WinEndEnumWindows(henum);
     2235                     MM_QUERYITEMTEXT,
     2236                     MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) {
     2237
     2238        HENUM henum;
     2239        CHAR checkText[CCHMAXPATH + 8];
     2240        SWP swp;
     2241
     2242        s[CCHMAXPATH + 7] = 0;
     2243        henum = WinBeginEnumWindows(hwndMain);
     2244        while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
     2245          if (WinQueryWindowUShort(hwndChild, QWS_ID)) {
     2246            *checkText = 0;
     2247            WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText);
     2248            checkText[CCHMAXPATH + 7] = 0;
     2249            if (!stricmp(checkText, s)) {
     2250              if (WinQueryWindowPos(hwndChild, &swp)) {
     2251                if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
     2252                  WinSetWindowPos(hwndChild,
     2253                                  HWND_TOP,
     2254                                  0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER);
     2255              }
     2256              WinSetActiveWindow(HWND_DESKTOP, hwndChild);
     2257              ret = TRUE;
     2258              break;
     2259            }
     2260          }
     2261        }
     2262        WinEndEnumWindows(henum);
    22632263      }
    22642264    }
     
    22802280 */
    22812281
    2282 INT CheckDriveSpaceAvail(CHAR *pTargetPath, ULONGLONG ullSpaceNeeded,
    2283                           ULONGLONG ullFreeSpaceWhenComplete)
     2282INT CheckDriveSpaceAvail(PCSZ pTargetPath, ULONGLONG ullSpaceNeeded,
     2283                          ULONGLONG ullFreeSpaceWhenComplete)
    22842284{
    22852285  FSALLOCATE fsa;
     
    22952295
    22962296    CommaFmtULL(szKB, sizeof(szKB),
    2297                 ullFreeQty - ullSpaceNeeded, ' ');
     2297                ullFreeQty - ullSpaceNeeded, ' ');
    22982298    if (ullFreeSpaceWhenComplete == 0) {
    22992299      saymsg(MB_OK,
    2300              HWND_DESKTOP,
    2301              NullStr,
    2302              GetPString(IDS_DRIVESPACELIMITEDTMPSAVE),
    2303              pTargetPath);
     2300             HWND_DESKTOP,
     2301             NullStr,
     2302             GetPString(IDS_DRIVESPACELIMITEDTMPSAVE),
     2303             pTargetPath);
    23042304      return 0;
    23052305    }
    23062306    else {
    23072307      if (ullFreeQty > ullSpaceNeeded) {
    2308         ret = saymsg(MB_YESNO,
    2309                      HWND_DESKTOP,
    2310                      NullStr,
    2311                      GetPString(IDS_DRIVESPACELIMITED),
    2312                      pTargetPath,
    2313                      szKB);
    2314         if (ret == MBID_YES)
    2315           return 0;
    2316         else
    2317           return 2;
     2308        ret = saymsg(MB_YESNO,
     2309                     HWND_DESKTOP,
     2310                     NullStr,
     2311                     GetPString(IDS_DRIVESPACELIMITED),
     2312                     pTargetPath,
     2313                     szKB);
     2314        if (ret == MBID_YES)
     2315          return 0;
     2316        else
     2317          return 2;
    23182318      }
    23192319      else {
    2320         saymsg(MB_OK,
    2321                HWND_DESKTOP,
    2322                NullStr,
    2323                GetPString(IDS_DRIVESPACEEXCEEDED),
    2324                pTargetPath);
    2325         return 2;
     2320        saymsg(MB_OK,
     2321               HWND_DESKTOP,
     2322               NullStr,
     2323               GetPString(IDS_DRIVESPACEEXCEEDED),
     2324               pTargetPath);
     2325        return 2;
    23262326      }
    23272327    }
  • trunk/dll/misc.h

    r1225 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2009 Steven H. Levine
    1010
    1111  17 Jul 08 SHL Baseline
     
    2727#endif
    2828
    29 SHORT AddToListboxBottom(HWND hwnd, CHAR * str);
    30 BOOL AdjustCnrColRO(HWND hwndCnr, CHAR * title, BOOL readonly, BOOL toggle);
    31 BOOL AdjustCnrColVis(HWND hwndCnr, CHAR * title, BOOL visible, BOOL toggle);
    32 VOID AdjustCnrColsForFSType(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds);
    33 VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds,
     29SHORT AddToListboxBottom(HWND hwnd, PCSZ str);
     30BOOL AdjustCnrColRO(HWND hwndCnr, PCSZ title, BOOL readonly, BOOL toggle);
     31BOOL AdjustCnrColVis(HWND hwndCnr, PCSZ title, BOOL visible, BOOL toggle);
     32VOID AdjustCnrColsForFSType(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS * pds);
     33VOID AdjustCnrColsForPref(HWND hwndCnr, PCSZ directory, DETAILS_SETTINGS * pds,
    3434                          BOOL compare);
    3535VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd,
    36                            CHAR * directory, CHAR * keyroot, DETAILS_SETTINGS * pds,
     36                           PCSZ directory, PCSZ keyroot, DETAILS_SETTINGS * pds,
    3737                           BOOL compare);
    3838void BoxWindow(HWND hwnd, HPS hps, LONG color);
    3939void Broadcast(HAB hab, HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    40 INT CheckDriveSpaceAvail(CHAR *pTargetPath, ULONGLONG ullSpaceNeeded,
    41                         ULONGLONG ullFreeSpaceWhenComplete);
     40INT CheckDriveSpaceAvail(PCSZ pTargetPath, ULONGLONG ullSpaceNeeded,
     41                        ULONGLONG ullFreeSpaceWhenComplete);
    4242HWND CheckMenu(HWND hwnd, HWND * hwndMenu, USHORT id);
    4343MRESULT CnrDirectEdit(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
     
    4545void DrawTargetEmphasis(HWND hwnd, BOOL on);
    4646void EmphasizeButton(HWND hwnd, BOOL on);
    47 INT ExecFile(HWND hwnd, CHAR * filename);
     47INT ExecFile(HWND hwnd, PCSZ filename);
    4848HWND FindDirCnr(HWND hwndParent);
    49 VOID FixSwitchList(HWND hwnd, CHAR * text);
     49VOID FixSwitchList(HWND hwnd, PCSZ text);
    5050char *GetCmdSpec(BOOL dos);
    5151VOID HeapThread(VOID * dummy);
    5252BOOL IsFm2Window(HWND hwnd, BOOL chkTid);
    53 VOID LoadDetailsSwitches(CHAR * keyroot, DETAILS_SETTINGS * pds);
    54 VOID LoadLibPath(CHAR * str, LONG len);
     53VOID LoadDetailsSwitches(PCSZ keyroot, DETAILS_SETTINGS * pds);
     54VOID LoadLibPath(PSZ str, LONG len);
    5555VOID OpenEdit(HWND hwnd);
    5656VOID PaintRecessedWindow(HWND hwnd, HPS hps, BOOL outtie, BOOL dbl);
     
    6666VOID SetDetailsSwitches(HWND hwnd, DETAILS_SETTINGS * pds);
    6767BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle,
    68                   CHAR * savename);
     68                  PCSZ savename);
    6969VOID SetShiftState(VOID);
    7070VOID SetSortChecks(HWND hwndMenu, INT sortflags);
     
    7474void SetupWinList(HWND hwndMenu, HWND hwndTop, HWND hwndFrame);
    7575BOOL SwitchCommand(HWND hwndMenu, USHORT cmd);
    76 BOOL ViewHelp(CHAR * filename);
     76BOOL ViewHelp(PCSZ filename);
    7777VOID disable_menuitem(HWND hwndMenu, USHORT id, BOOL enable);
    7878
  • trunk/dll/newview.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  01 Dec 03 SHL Comments
     
    519519            && !WinQueryCapture(HWND_DESKTOP)) {
    520520
    521           char *s = NULL;
     521          PCSZ s = NULL;
    522522
    523523          switch (id) {
     
    18141814                   IDS_WINCREATEWINDOW);
    18151815      else {
    1816         //fixme to allow user to change presparams 1-10-09 GKY
     1816        //fixme to allow user to change presparams 1-10-09 GKY
    18171817        WinSetPresParam(temphwnd,
    18181818                        PP_FONTNAMESIZE,
     
    18351835                   IDS_WINCREATEWINDOW);
    18361836      else {
    1837         //fixme to allow user to change presparams 1-10-09 GKY
     1837        //fixme to allow user to change presparams 1-10-09 GKY
    18381838        WinSetPresParam(temphwnd,
    18391839                        PP_FONTNAMESIZE,
     
    26272627        ad->hwndPopup =
    26282628          WinLoadMenu(HWND_DESKTOP, FM3ModHandle, NEWVIEW_POPUP);
    2629         if (ad->hwndPopup)
    2630           //fixme to allow user to change presparams 1-10-09 GKY
     2629        if (ad->hwndPopup)
     2630          //fixme to allow user to change presparams 1-10-09 GKY
    26312631          WinSetPresParam(ad->hwndPopup,
    26322632                          PP_FONTNAMESIZE,
     
    36993699            sip.ret = s;
    37003700            *s = 0;
    3701             sip.prompt = ss;
    37023701            sip.inputlen = 34;
    37033702            sip.title = (SHORT1FROMMP(mp1) == IDM_GOTOLINE) ?
    37043703              GetPString(IDS_NVLINEJUMPTITLETEXT) :
    37053704              GetPString(IDS_NVBYTEJUMPTITLETEXT);
    3706             sprintf(sip.prompt,
     3705            sprintf(ss,
    37073706                    GetPString(IDS_NVJUMPTEXT),
    37083707                    (SHORT1FROMMP(mp1) == IDM_GOTOLINE) ?
     
    37143713                    (SHORT1FROMMP(mp1) == IDM_GOTOLINE) ?
    37153714                    ad->numlines : ad->textsize - 1);
     3715            sip.prompt = ss;
    37163716            WinDlgBox(HWND_DESKTOP,
    37173717                      hwnd, InputDlgProc, FM3ModHandle, STR_FRAME, &sip);
  • trunk/dll/notebook.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2004, 2008 Steven H. Levine
     9  Copyright (c) 2004, 2009 Steven H. Levine
    1010
    1111  01 Aug 04 SHL Rework lstrip/rstrip usage
     
    3131  29 Feb 08 GKY Changes to enable user settable command line length
    3232  08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
    33                 keys using a "DirCnr." prefix
     33                keys using a "DirCnr." prefix
    3434  06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
    3535  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
    36                 all the details view settings (both the global variables and those in the
    37                 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
     36                all the details view settings (both the global variables and those in the
     37                DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
    3838  19 Jul 08 JBS Ticket 197: Support accelerator keys in setting dialogs.
    3939  20 Jul 08 JBS Ticket 114: Support user-selectable env. strings in Tree container.
     
    4141  02 Aug 08 JBS Ticket 114: Improved code to avoid traps.
    4242  30 Nov 08 GKY Add the option of creating a subdirectory from the arcname
    43                 for the extract path to arc container.
     43                for the extract path to arc container.
    4444  25 Dec 08 GKY Add ProcessDirectoryThread to allow optional recursive drive scan at startup.
    4545  01 Jan 09 GKY Add option to rescan tree container on eject of removable media
     
    202202  case WM_INITDLG:
    203203    WinSendDlgItemMsg(hwnd, CFGA_VIRUS, EM_SETTEXTLIMIT,
    204                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     204                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    205205    WinSendDlgItemMsg(hwnd, CFGA_EXTRACTPATH, EM_SETTEXTLIMIT,
    206                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     206                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    207207    WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE);
    208208    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    216216    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    217217      switch (CHARMSG(&msg)->vkey) {
    218         case VK_F3:
    219         case VK_ENTER:
    220         case VK_NEWLINE:
    221           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    222           return 0;
    223           break;
    224         case VK_ESC:
    225           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    226           return 0;
    227           break;
    228         case VK_F1:
    229           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    230           return 0;
    231           break;
     218        case VK_F3:
     219        case VK_ENTER:
     220        case VK_NEWLINE:
     221          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     222          return 0;
     223          break;
     224        case VK_ESC:
     225          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     226          return 0;
     227          break;
     228        case VK_F1:
     229          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     230          return 0;
     231          break;
    232232      }
    233233    }
     
    251251      switch (SHORT2FROMMP(mp1)) {
    252252      case EN_KILLFOCUS:
    253         WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE);
    254         break;
     253        WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE);
     254        break;
    255255      case EN_SETFOCUS:
    256         WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), TRUE);
    257         break;
     256        WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), TRUE);
     257        break;
    258258      }
    259259      break;
     
    261261      switch (SHORT2FROMMP(mp1)) {
    262262      case BN_CLICKED:
    263         if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) {
    264 
    265           ARC_TYPE *pat = arcsighead;   // Hide dups
    266 
    267           if (!WinDlgBox(HWND_DESKTOP, hwnd,
    268                         SBoxDlgProc, FM3ModHandle, ASEL_FRAME,
    269                         (PVOID) & pat) || !pat || !pat->id || !*pat->id) {
    270             DosBeep(250, 100);          // Complain
    271             WinCheckButton(hwnd, CFGA_DEFARC, FALSE);
    272           }
    273           else
    274             WinSetDlgItemText(hwnd, CFGA_DEFARCNAME, pat->id);
    275         }
    276         break;
     263        if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) {
     264
     265          ARC_TYPE *pat = arcsighead;   // Hide dups
     266
     267          if (!WinDlgBox(HWND_DESKTOP, hwnd,
     268                        SBoxDlgProc, FM3ModHandle, ASEL_FRAME,
     269                        (PVOID) & pat) || !pat || !pat->id || !*pat->id) {
     270            DosBeep(250, 100);          // Complain
     271            WinCheckButton(hwnd, CFGA_DEFARC, FALSE);
     272          }
     273          else
     274            WinSetDlgItemText(hwnd, CFGA_DEFARCNAME, pat->id);
     275        }
     276        break;
    277277      default:
    278         break;
     278        break;
    279279      }
    280280      break;
     
    300300    case IDM_HELP:
    301301      if (hwndHelp)
    302         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    303                    MPFROM2SHORT(HELP_CFGA, 0), MPFROMSHORT(HM_RESOURCEID));
     302        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     303                   MPFROM2SHORT(HELP_CFGA, 0), MPFROMSHORT(HM_RESOURCEID));
    304304      break;
    305305
    306306    case CFGA_FIND:
    307307      {
    308         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    309         USHORT id;
    310         HWND hwndFocus;
    311 
    312         strcpy(filename, "*.EXE");
    313         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    314         if (hwndFocus) {
    315           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    316           switch (id) {
    317           case CFGA_VIRUS:
    318             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    319               BldQuotedFileName(szfilename, filename);
    320               strcat(szfilename, " %p");
    321               WinSetDlgItemText(hwnd, id, szfilename);
    322             }
    323             break;
    324           case CFGA_EXTRACTPATH:
    325             strcpy(filename, extractpath);
    326             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    327                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    328                           MPFROMP(filename)) && *filename)
    329               WinSetDlgItemText(hwnd, id, filename);
    330             break;
    331           default:
    332             Runtime_Error(pszSrcFile, __LINE__, "bad case");
    333             break;
    334           }
    335         }
     308        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     309        USHORT id;
     310        HWND hwndFocus;
     311
     312        strcpy(filename, "*.EXE");
     313        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     314        if (hwndFocus) {
     315          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     316          switch (id) {
     317          case CFGA_VIRUS:
     318            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     319              BldQuotedFileName(szfilename, filename);
     320              strcat(szfilename, " %p");
     321              WinSetDlgItemText(hwnd, id, szfilename);
     322            }
     323            break;
     324          case CFGA_EXTRACTPATH:
     325            strcpy(filename, extractpath);
     326            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     327                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     328                          MPFROMP(filename)) && *filename)
     329              WinSetDlgItemText(hwnd, id, filename);
     330            break;
     331          default:
     332            Runtime_Error(pszSrcFile, __LINE__, "bad case");
     333            break;
     334          }
     335        }
    336336      }
    337337      break;
     
    342342    fQuickArcFind = WinQueryButtonCheckstate(hwnd, CFGA_QUICKARCFIND);
    343343    PrfWriteProfileData(fmprof,
    344                         appname,
    345                         "QuickArcFind", &fQuickArcFind, sizeof(BOOL));
     344                        appname,
     345                        "QuickArcFind", &fQuickArcFind, sizeof(BOOL));
    346346    fArcStuffVisible = WinQueryButtonCheckstate(hwnd, CFGA_ARCSTUFFVISIBLE);
    347347    PrfWriteProfileData(fmprof,
    348                         appname,
    349                         "ArcStuffVisible", &fArcStuffVisible, sizeof(BOOL));
     348                        appname,
     349                        "ArcStuffVisible", &fArcStuffVisible, sizeof(BOOL));
    350350    fFileNameCnrPath = WinQueryButtonCheckstate(hwnd, CFGA_FILENAMEPATH);
    351351    PrfWriteProfileData(fmprof,
    352                         appname,
    353                         "FileNamePathCnr", &fFileNameCnrPath, sizeof(BOOL));
     352                        appname,
     353                        "FileNamePathCnr", &fFileNameCnrPath, sizeof(BOOL));
    354354    fFolderAfterExtract = WinQueryButtonCheckstate(hwnd,
    355                                                    CFGA_FOLDERAFTEREXTRACT);
     355                                                   CFGA_FOLDERAFTEREXTRACT);
    356356    PrfWriteProfileData(fmprof,
    357                         appname,
    358                         "FolderAfterExtract",
    359                         &fFolderAfterExtract, sizeof(BOOL));
     357                        appname,
     358                        "FolderAfterExtract",
     359                        &fFolderAfterExtract, sizeof(BOOL));
    360360    if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) {
    361361
     
    375375
    376376      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    377         if (!szCLBuf)
    378           return 0; //already complained
     377        if (!szCLBuf)
     378          return 0; //already complained
    379379      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    380380      if (!pszWorkBuf) {
    381         free(szCLBuf);
    382         return 0; //already complained
     381        free(szCLBuf);
     382        return 0; //already complained
    383383      }
    384384      WinQueryDlgItemText(hwnd, CFGA_VIRUS, MaxComLineStrg, szCLBuf);
    385385      szCLBuf[MaxComLineStrg - 1] = 0;
    386386      if (strcmp(szCLBuf, virus)){
    387         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    388         memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);
    389         if (!strchr(virus, '%') && strlen(virus) > 3)
    390           strcat(virus, " %p");
     387        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     388        memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);
     389        if (!strchr(virus, '%') && strlen(virus) > 3)
     390          strcat(virus, " %p");
    391391      }
    392392      free(pszWorkBuf);
    393393      free(szCLBuf);
    394394      if (!*virus)
    395         strcpy(virus, "OS2SCAN.EXE %p /SUB /A");
     395        strcpy(virus, "OS2SCAN.EXE %p /SUB /A");
    396396      WinQueryDlgItemText(hwnd, CFGA_EXTRACTPATH, CCHMAXPATH, szPathBuf);
    397397      szPathBuf[CCHMAXPATH - 1] = 0;
    398398      bstrip(szPathBuf);
    399399      if (strcmp(extractpath, szPathBuf)) {
    400         memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1);
    401         if (*extractpath){
    402           MakeFullName(extractpath);
    403           if (IsFile(extractpath)) {
    404             ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
    405                               GetPString(IDS_WARNINGTEXT),
    406                               GetPString(IDS_EXTPATHNOTVALIDTEXT),
    407                               extractpath);
    408             if (ulResult == MBID_YES)
    409               *extractpath = 0;
    410             if (ulResult == MBID_CANCEL){
    411               WinDlgBox(HWND_DESKTOP,
    412                         hwnd,
    413                         CfgDlgProc,
    414                         FM3ModHandle,
    415                         CFG_FRAME,
    416                         MPFROMLONG(IDM_ARCHIVERSETTINGS));
    417               break;
    418             }
    419           }
    420         }
     400        memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1);
     401        if (*extractpath){
     402          MakeFullName(extractpath);
     403          if (IsFile(extractpath)) {
     404            ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
     405                              GetPString(IDS_WARNINGTEXT),
     406                              GetPString(IDS_EXTPATHNOTVALIDTEXT),
     407                              extractpath);
     408            if (ulResult == MBID_YES)
     409              *extractpath = 0;
     410            if (ulResult == MBID_CANCEL){
     411              WinDlgBox(HWND_DESKTOP,
     412                        hwnd,
     413                        CfgDlgProc,
     414                        FM3ModHandle,
     415                        CFG_FRAME,
     416                        MPFROMLONG(IDM_ARCHIVERSETTINGS));
     417              break;
     418            }
     419          }
     420        }
    421421      }
    422422    }
     
    428428    fCancelAction = FALSE;
    429429    WinDlgBox(HWND_DESKTOP,
    430               hwnd,
    431               CfgDlgProc,
    432               FM3ModHandle,
    433               CFG_FRAME,
    434               MPFROMLONG(IDM_ARCHIVERSETTINGS));
     430              hwnd,
     431              CfgDlgProc,
     432              FM3ModHandle,
     433              CFG_FRAME,
     434              MPFROMLONG(IDM_ARCHIVERSETTINGS));
    435435  }
    436436  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    443443  case WM_INITDLG:
    444444    WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_SETTEXTLIMIT,
    445                       MPFROMSHORT(8), MPVOID);
     445                      MPFROMSHORT(8), MPVOID);
    446446    WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_OVERRIDESETLIMITS,
    447                       MPFROMLONG(FILESTOGET_MAX), MPFROMLONG(FILESTOGET_MIN));
     447                      MPFROMLONG(FILESTOGET_MAX), MPFROMLONG(FILESTOGET_MIN));
    448448    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    449449    break;
     
    456456    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    457457      switch (CHARMSG(&msg)->vkey) {
    458         case VK_F3:
    459         case VK_ENTER:
    460         case VK_NEWLINE:
    461           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    462           return 0;
    463           break;
    464         case VK_ESC:
    465           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    466           return 0;
    467           break;
    468         case VK_F1:
    469           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    470           return 0;
    471           break;
     458        case VK_F3:
     459        case VK_ENTER:
     460        case VK_NEWLINE:
     461          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     462          return 0;
     463          break;
     464        case VK_ESC:
     465          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     466          return 0;
     467          break;
     468        case VK_F1:
     469          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     470          return 0;
     471          break;
    472472      }
    473473    }
     
    492492    WinCheckButton(hwnd, CFGS_EJECTFLPYSCAN, fEjectFlpyScan);
    493493    WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_SETCURRENTVALUE,
    494                       MPFROMLONG(FilesToGet), MPVOID);
     494                      MPFROMLONG(FilesToGet), MPVOID);
    495495    return 0;
    496496
     
    500500    case CFGS_FORCELOWER:
    501501      {
    502         BOOL temp;
    503 
    504         temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
    505         if (temp) {
    506           switch (SHORT1FROMMP(mp1)) {
    507           case CFGS_FORCEUPPER:
    508             WinCheckButton(hwnd, CFGS_FORCELOWER, FALSE);
    509             break;
    510           case CFGS_FORCELOWER:
    511             WinCheckButton(hwnd, CFGS_FORCEUPPER, FALSE);
    512             break;
    513           }
    514         }
     502        BOOL temp;
     503
     504        temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
     505        if (temp) {
     506          switch (SHORT1FROMMP(mp1)) {
     507          case CFGS_FORCEUPPER:
     508            WinCheckButton(hwnd, CFGS_FORCELOWER, FALSE);
     509            break;
     510          case CFGS_FORCELOWER:
     511            WinCheckButton(hwnd, CFGS_FORCEUPPER, FALSE);
     512            break;
     513          }
     514        }
    515515      }
    516516      break;
     
    533533    case IDM_HELP:
    534534      if (hwndHelp)
    535         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    536                    MPFROM2SHORT(HELP_CFGS, 0), MPFROMSHORT(HM_RESOURCEID));
     535        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     536                   MPFROM2SHORT(HELP_CFGS, 0), MPFROMSHORT(HM_RESOURCEID));
    537537      break;
    538538    }
     
    542542    fLoadLongnames = WinQueryButtonCheckstate(hwnd, CFGS_LOADLONGNAMES);
    543543    PrfWriteProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames,
    544                         sizeof(BOOL));
     544                        sizeof(BOOL));
    545545    fLoadSubject = WinQueryButtonCheckstate(hwnd, CFGS_LOADSUBJECTS);
    546546    PrfWriteProfileData(fmprof, appname, "LoadSubject", &fLoadSubject,
    547                         sizeof(BOOL));
     547                        sizeof(BOOL));
    548548    fRemoteBug = WinQueryButtonCheckstate(hwnd, CFGS_REMOTEBUG);
    549549    PrfWriteProfileData(fmprof, appname, "RemoteBug", &fRemoteBug,
    550                         sizeof(BOOL));
     550                        sizeof(BOOL));
    551551    fRScanLocal = WinQueryButtonCheckstate(hwnd, CFGS_RSCANLOCAL);
    552552    PrfWriteProfileData(fmprof, appname, "RScanLocal", &fRScanLocal,
    553                         sizeof(BOOL));
     553                        sizeof(BOOL));
    554554    fRScanRemote = WinQueryButtonCheckstate(hwnd, CFGS_RSCANREMOTE);
    555555    PrfWriteProfileData(fmprof, appname, "RScanRemote", &fRScanRemote,
    556                         sizeof(BOOL));
     556                        sizeof(BOOL));
    557557    fRScanVirtual = WinQueryButtonCheckstate(hwnd, CFGS_RSCANVIRTUAL);
    558558    PrfWriteProfileData(fmprof, appname, "RScanVirtual", &fRScanVirtual,
    559                         sizeof(BOOL));
     559                        sizeof(BOOL));
    560560    fRScanSlow = WinQueryButtonCheckstate(hwnd, CFGS_RSCANSLOW);
    561561    PrfWriteProfileData(fmprof, appname, "RScanSlow", &fRScanSlow,
    562                         sizeof(BOOL));
     562                        sizeof(BOOL));
    563563    fRScanNoWrite = WinQueryButtonCheckstate(hwnd, CFGS_RSCANNOWRITE);
    564564    PrfWriteProfileData(fmprof, appname, "RScanNoWrite", &fRScanNoWrite,
    565                         sizeof(BOOL));
     565                        sizeof(BOOL));
    566566    fNoRemovableScan = WinQueryButtonCheckstate(hwnd, CFGS_NOREMOVABLESCAN);
    567567    PrfWriteProfileData(fmprof, appname, "NoRemovableScan", &fNoRemovableScan,
    568                         sizeof(BOOL));
     568                        sizeof(BOOL));
    569569    fEjectRemovableScan = WinQueryButtonCheckstate(hwnd, CFGS_EJECTREMOVABLESCAN);
    570570    PrfWriteProfileData(fmprof, appname, "EjectRemovableScan", &fEjectRemovableScan,
    571                         sizeof(BOOL));
     571                        sizeof(BOOL));
    572572    fEjectCDScan = WinQueryButtonCheckstate(hwnd, CFGS_EJECTCDSCAN);
    573573    PrfWriteProfileData(fmprof, appname, "EjectCDScan", &fEjectCDScan,
    574                         sizeof(BOOL));
     574                        sizeof(BOOL));
    575575    fEjectFlpyScan = WinQueryButtonCheckstate(hwnd, CFGS_EJECTFLPYSCAN);
    576576    PrfWriteProfileData(fmprof, appname, "EjectFlpyScan", &fEjectFlpyScan,
    577                         sizeof(BOOL));
     577                        sizeof(BOOL));
    578578    fNoIconsFiles = WinQueryButtonCheckstate(hwnd, CFGS_NOICONSFILES);
    579579    fNoIconsFiles = (fNoIconsFiles) ? FALSE : TRUE;
    580580    PrfWriteProfileData(fmprof, appname, "NoIconsFiles",
    581                         &fNoIconsFiles, sizeof(BOOL));
     581                        &fNoIconsFiles, sizeof(BOOL));
    582582    fNoIconsDirs = WinQueryButtonCheckstate(hwnd, CFGS_NOICONSDIRS);
    583583    fNoIconsDirs = (fNoIconsDirs) ? FALSE : TRUE;
    584584    PrfWriteProfileData(fmprof, appname, "NoIconsDirs",
    585                         &fNoIconsDirs, sizeof(BOOL));
     585                        &fNoIconsDirs, sizeof(BOOL));
    586586    fForceUpper = WinQueryButtonCheckstate(hwnd, CFGS_FORCEUPPER);
    587587    PrfWriteProfileData(fmprof, appname, "ForceUpper",
    588                         &fForceUpper, sizeof(BOOL));
     588                        &fForceUpper, sizeof(BOOL));
    589589    fForceLower = WinQueryButtonCheckstate(hwnd, CFGS_FORCELOWER);
    590590    PrfWriteProfileData(fmprof, appname, "ForceLower",
    591                         &fForceLower, sizeof(BOOL));
     591                        &fForceLower, sizeof(BOOL));
    592592    {
    593593      WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_QUERYVALUE,
    594                         MPFROMP(&FilesToGet), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     594                        MPFROMP(&FilesToGet), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    595595      if (FilesToGet < FILESTOGET_MIN)
    596         FilesToGet = FILESTOGET_MIN;
     596        FilesToGet = FILESTOGET_MIN;
    597597      else if (FilesToGet > FILESTOGET_MAX)
    598         FilesToGet = FILESTOGET_MAX;
     598        FilesToGet = FILESTOGET_MAX;
    599599      PrfWriteProfileData(fmprof,
    600                           appname, "FilesToGet", &FilesToGet, sizeof(ULONG));
     600                          appname, "FilesToGet", &FilesToGet, sizeof(ULONG));
    601601    }
    602602    break;
     
    611611  case WM_INITDLG:
    612612    WinSendDlgItemMsg(hwnd, CFGV_VIEWER, EM_SETTEXTLIMIT,
    613                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     613                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    614614    WinSendDlgItemMsg(hwnd, CFGV_EDITOR, EM_SETTEXTLIMIT,
    615                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     615                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    616616    WinSendDlgItemMsg(hwnd, CFGV_BINVIEW, EM_SETTEXTLIMIT,
    617                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     617                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    618618    WinSendDlgItemMsg(hwnd, CFGV_BINED, EM_SETTEXTLIMIT,
    619                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     619                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    620620    WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);
    621621    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    629629    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    630630      switch (CHARMSG(&msg)->vkey) {
    631         case VK_F3:
    632         case VK_ENTER:
    633         case VK_NEWLINE:
    634           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    635           return 0;
    636           break;
    637         case VK_ESC:
    638           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    639           return 0;
    640           break;
    641         case VK_F1:
    642           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    643           return 0;
    644           break;
     631        case VK_F3:
     632        case VK_ENTER:
     633        case VK_NEWLINE:
     634          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     635          return 0;
     636          break;
     637        case VK_ESC:
     638          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     639          return 0;
     640          break;
     641        case VK_F1:
     642          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     643          return 0;
     644          break;
    645645      }
    646646    }
     
    666666      switch (SHORT2FROMMP(mp1)) {
    667667      case EN_KILLFOCUS:
    668         WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);
    669         break;
     668        WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);
     669        break;
    670670      case EN_SETFOCUS:
    671         WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), TRUE);
    672         break;
     671        WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), TRUE);
     672        break;
    673673      }
    674674      break;
     
    691691    case IDM_HELP:
    692692      if (hwndHelp)
    693         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    694                    MPFROM2SHORT(HELP_CFGV, 0), MPFROMSHORT(HM_RESOURCEID));
     693        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     694                   MPFROM2SHORT(HELP_CFGV, 0), MPFROMSHORT(HM_RESOURCEID));
    695695      break;
    696696
    697697    case CFGV_FIND:
    698698      {
    699         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    700         USHORT id;
    701         HWND hwndFocus;
    702 
    703         strcpy(filename, "*.EXE");
    704         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    705         if (hwndFocus) {
    706           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    707           switch (id) {
    708           case CFGV_BINVIEW:
    709           case CFGV_BINED:
    710           case CFGV_VIEWER:
    711           case CFGV_EDITOR:
    712             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    713               BldQuotedFileName(szfilename, filename);
    714               strcat(szfilename, " %a");
    715               WinSetDlgItemText(hwnd, id, szfilename);
    716             }
    717             break;
    718           default:
    719             Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
    720             break;
    721           }
    722         }
     699        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     700        USHORT id;
     701        HWND hwndFocus;
     702
     703        strcpy(filename, "*.EXE");
     704        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     705        if (hwndFocus) {
     706          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     707          switch (id) {
     708          case CFGV_BINVIEW:
     709          case CFGV_BINED:
     710          case CFGV_VIEWER:
     711          case CFGV_EDITOR:
     712            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     713              BldQuotedFileName(szfilename, filename);
     714              strcat(szfilename, " %a");
     715              WinSetDlgItemText(hwnd, id, szfilename);
     716            }
     717            break;
     718          default:
     719            Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
     720            break;
     721          }
     722        }
    723723      }
    724724      break;
     
    732732
    733733      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    734         if (!szCLBuf)
    735           return 0; //already complained
     734        if (!szCLBuf)
     735          return 0; //already complained
    736736      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    737737      if (!pszWorkBuf) {
    738         free(szCLBuf);
    739         return 0; //already complained
     738        free(szCLBuf);
     739        return 0; //already complained
    740740      }
    741741      WinQueryDlgItemText(hwnd, CFGV_VIEWER, MaxComLineStrg, szCLBuf);
    742742      szCLBuf[MaxComLineStrg - 1] = 0;
    743743      if (strcmp(szCLBuf, viewer)){
    744         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    745         memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1);
    746         if (!strchr(viewer, '%') && strlen(viewer) > 3)
    747           strcat(viewer, " %a");
     744        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     745        memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1);
     746        if (!strchr(viewer, '%') && strlen(viewer) > 3)
     747          strcat(viewer, " %a");
    748748      }
    749749      WinQueryDlgItemText(hwnd, CFGV_EDITOR, MaxComLineStrg, szCLBuf);
    750750      szCLBuf[MaxComLineStrg - 1] = 0;
    751751      if (strcmp(szCLBuf, editor)){
    752         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    753         memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1);
    754         if (!strchr(editor, '%') && strlen(editor) > 3)
    755           strcat(editor, " %a");
     752        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     753        memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1);
     754        if (!strchr(editor, '%') && strlen(editor) > 3)
     755          strcat(editor, " %a");
    756756      }
    757757      WinQueryDlgItemText(hwnd, CFGV_BINVIEW, MaxComLineStrg, szCLBuf);
    758758      szCLBuf[MaxComLineStrg - 1] = 0;
    759759      if (strcmp(szCLBuf, binview)){
    760         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    761         memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1);
    762         if (!strchr(binview, '%') && strlen(binview) > 3)
    763           strcat(binview, " %a");
     760        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     761        memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1);
     762        if (!strchr(binview, '%') && strlen(binview) > 3)
     763          strcat(binview, " %a");
    764764      }
    765765      WinQueryDlgItemText(hwnd, CFGV_BINED, MaxComLineStrg, szCLBuf);
    766766      szCLBuf[MaxComLineStrg - 1] = 0;
    767767      if (strcmp(szCLBuf, bined)){
    768         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    769         memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1);
    770         if (!strchr(bined, '%') && strlen(bined) > 3)
    771           strcat(bined, " %a");
     768        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     769        memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1);
     770        if (!strchr(bined, '%') && strlen(bined) > 3)
     771          strcat(bined, " %a");
    772772      }
    773773      free(pszWorkBuf);
     
    779779      fUseNewViewer = WinQueryButtonCheckstate(hwnd, CFGV_USENEWVIEWER);
    780780      PrfWriteProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer,
    781                           sizeof(BOOL));
     781                          sizeof(BOOL));
    782782      fGuessType = WinQueryButtonCheckstate(hwnd, CFGV_GUESSTYPE);
    783783      PrfWriteProfileData(fmprof, appname, "GuessType", &fGuessType,
    784                           sizeof(BOOL));
     784                          sizeof(BOOL));
    785785      fViewChild = WinQueryButtonCheckstate(hwnd, CFGV_VIEWCHILD);
    786786      PrfWriteProfileData(fmprof, appname, "ViewChild", &fViewChild,
    787                           sizeof(BOOL));
     787                          sizeof(BOOL));
    788788      fCheckMM = WinQueryButtonCheckstate(hwnd, CFGV_CHECKMM);
    789789      PrfWriteProfileData(fmprof, appname, "CheckMM", &fCheckMM, sizeof(BOOL));
     
    795795    fCancelAction = FALSE;
    796796    WinDlgBox(HWND_DESKTOP,
    797               hwnd,
    798               CfgDlgProc,
    799               FM3ModHandle,
    800               CFG_FRAME,
    801               MPFROMLONG(IDM_VIEWERSETTINGS));
     797              hwnd,
     798              CfgDlgProc,
     799              FM3ModHandle,
     800              CFG_FRAME,
     801              MPFROMLONG(IDM_VIEWERSETTINGS));
    802802  }
    803803  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    809809  case WM_INITDLG:
    810810    WinSendDlgItemMsg(hwnd, CFGH_RUNFTPWORKDIR, EM_SETTEXTLIMIT,
    811                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     811                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    812812    WinSendDlgItemMsg(hwnd, CFGH_RUNHTTPWORKDIR, EM_SETTEXTLIMIT,
    813                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     813                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    814814    WinSendDlgItemMsg(hwnd, CFGH_FTPRUN, EM_SETTEXTLIMIT,
    815                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     815                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    816816    WinSendDlgItemMsg(hwnd, CFGH_HTTPRUN, EM_SETTEXTLIMIT,
    817                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     817                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    818818    WinSendDlgItemMsg(hwnd, CFGH_MAILRUN, EM_SETTEXTLIMIT,
    819                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     819                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    820820    WinSendDlgItemMsg(hwnd, CFGH_RUNMAILWORKDIR, EM_SETTEXTLIMIT,
    821                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     821                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    822822    WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE);
    823823    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    831831    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    832832      switch (CHARMSG(&msg)->vkey) {
    833         case VK_F3:
    834         case VK_ENTER:
    835         case VK_NEWLINE:
    836           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    837           return 0;
    838           break;
    839         case VK_ESC:
    840           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    841           return 0;
    842           break;
    843         case VK_F1:
    844           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    845           return 0;
    846           break;
     833        case VK_F3:
     834        case VK_ENTER:
     835        case VK_NEWLINE:
     836          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     837          return 0;
     838          break;
     839        case VK_ESC:
     840          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     841          return 0;
     842          break;
     843        case VK_F1:
     844          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     845          return 0;
     846          break;
    847847      }
    848848    }
     
    874874      switch (SHORT2FROMMP(mp1)) {
    875875      case EN_KILLFOCUS:
    876         WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE);
    877         break;
     876        WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE);
     877        break;
    878878      case EN_SETFOCUS:
    879         WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), TRUE);
    880         break;
     879        WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), TRUE);
     880        break;
    881881      }
    882882      break;
     
    899899    case IDM_HELP:
    900900      if (hwndHelp)
    901         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    902                    MPFROM2SHORT(HELP_CFGH, 0), MPFROMSHORT(HM_RESOURCEID));
     901        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     902                   MPFROM2SHORT(HELP_CFGH, 0), MPFROMSHORT(HM_RESOURCEID));
    903903      break;
    904904
    905905    case CFGH_FIND:
    906906      {
    907         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    908         USHORT id;
    909         HWND hwndFocus;
    910 
    911         strcpy(filename, "*.EXE");
    912         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    913         if (hwndFocus) {
    914           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    915           switch (id) {
    916           case CFGH_HTTPRUN:
    917           case CFGH_FTPRUN:
    918           case CFGH_MAILRUN:
    919             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    920               BldQuotedFileName(szfilename, filename);
    921               WinSetDlgItemText(hwnd, id, szfilename);
    922             }
    923             break;
    924           case CFGH_RUNFTPWORKDIR:
    925             strcpy(filename, ftprundir);
    926             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    927                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    928                           MPFROMP(filename)) && *filename)
    929               WinSetDlgItemText(hwnd, id, filename);
    930             break;
    931           case CFGH_RUNHTTPWORKDIR:
    932             strcpy(filename, httprundir);
    933             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    934                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    935                           MPFROMP(filename)) && *filename)
    936               WinSetDlgItemText(hwnd, id, filename);
    937             break;
    938           case CFGH_RUNMAILWORKDIR:
    939             strcpy(filename, mailrundir);
    940             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    941                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    942                           MPFROMP(filename)) && *filename)
    943               WinSetDlgItemText(hwnd, id, filename);
    944             break;
    945           default:
    946             Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
    947             break;
    948           }
    949         }
     907        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     908        USHORT id;
     909        HWND hwndFocus;
     910
     911        strcpy(filename, "*.EXE");
     912        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     913        if (hwndFocus) {
     914          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     915          switch (id) {
     916          case CFGH_HTTPRUN:
     917          case CFGH_FTPRUN:
     918          case CFGH_MAILRUN:
     919            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     920              BldQuotedFileName(szfilename, filename);
     921              WinSetDlgItemText(hwnd, id, szfilename);
     922            }
     923            break;
     924          case CFGH_RUNFTPWORKDIR:
     925            strcpy(filename, ftprundir);
     926            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     927                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     928                          MPFROMP(filename)) && *filename)
     929              WinSetDlgItemText(hwnd, id, filename);
     930            break;
     931          case CFGH_RUNHTTPWORKDIR:
     932            strcpy(filename, httprundir);
     933            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     934                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     935                          MPFROMP(filename)) && *filename)
     936              WinSetDlgItemText(hwnd, id, filename);
     937            break;
     938          case CFGH_RUNMAILWORKDIR:
     939            strcpy(filename, mailrundir);
     940            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     941                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     942                          MPFROMP(filename)) && *filename)
     943              WinSetDlgItemText(hwnd, id, filename);
     944            break;
     945          default:
     946            Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
     947            break;
     948          }
     949        }
    950950      }
    951951      break;
     
    960960
    961961      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    962         if (!szCLBuf)
    963           return 0; //already complained
     962        if (!szCLBuf)
     963          return 0; //already complained
    964964      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    965965      if (!pszWorkBuf) {
    966         free(szCLBuf);
    967         return 0; //already complained
     966        free(szCLBuf);
     967        return 0; //already complained
    968968      }
    969969      WinQueryDlgItemText(hwnd, CFGH_RUNHTTPWORKDIR, CCHMAXPATH, szPathBuf);
     
    982982      szCLBuf[MaxComLineStrg - 1] = 0;
    983983      if (strcmp(szCLBuf, ftprun)){
    984         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    985         memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     984        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     985        memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    986986      }
    987987      WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MaxComLineStrg, szCLBuf);
    988988      szCLBuf[MaxComLineStrg - 1] = 0;
    989989      if (strcmp(szCLBuf, httprun)){
    990         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    991         memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     990        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     991        memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    992992      }
    993993      WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MaxComLineStrg, szCLBuf);
    994994      szCLBuf[MaxComLineStrg - 1] = 0;
    995995      if (strcmp(szCLBuf, mailrun)){
    996         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    997         memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     996        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     997        memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    998998      }
    999999      free(pszWorkBuf);
     
    10071007      fHttpRunWPSDefault = WinQueryButtonCheckstate(hwnd, CFGH_HTTPRUNWPSDEFAULT);
    10081008      PrfWriteProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault,
    1009                           sizeof(BOOL));
     1009                          sizeof(BOOL));
    10101010      fFtpRunWPSDefault = WinQueryButtonCheckstate(hwnd, CFGH_FTPRUNWPSDEFAULT);
    10111011      PrfWriteProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault,
    1012                           sizeof(BOOL));
     1012                          sizeof(BOOL));
    10131013      fLibPathStrictHttpRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTHTTPRUN);
    10141014      PrfWriteProfileData(fmprof, appname, "LibPathStrictHttpRun",
    1015                           &fLibPathStrictHttpRun, sizeof(BOOL));
     1015                          &fLibPathStrictHttpRun, sizeof(BOOL));
    10161016      fLibPathStrictFtpRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTFTPRUN);
    10171017      PrfWriteProfileData(fmprof, appname, "LibPathStrictFtpRun",
    1018                           &fLibPathStrictFtpRun, sizeof(BOOL));
     1018                          &fLibPathStrictFtpRun, sizeof(BOOL));
    10191019      fLibPathStrictMailRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTMAILRUN);
    10201020      PrfWriteProfileData(fmprof, appname, "LibPathStrictMailRun",
    1021                           &fLibPathStrictMailRun, sizeof(BOOL));
     1021                          &fLibPathStrictMailRun, sizeof(BOOL));
    10221022      fNoMailtoMailRun = WinQueryButtonCheckstate(hwnd, CFGH_NOMAILTOMAILRUN);
    10231023      PrfWriteProfileData(fmprof, appname, "NoMailtoMailRun",
    1024                           &fNoMailtoMailRun, sizeof(BOOL));
     1024                          &fNoMailtoMailRun, sizeof(BOOL));
    10251025      break;
    10261026    }
     
    10291029    fCancelAction = FALSE;
    10301030    WinDlgBox(HWND_DESKTOP,
    1031               hwnd,
    1032               CfgDlgProc,
    1033               FM3ModHandle,
    1034               CFG_FRAME,
    1035               MPFROMLONG(IDM_VIEWERSETTINGS));
     1031              hwnd,
     1032              CfgDlgProc,
     1033              FM3ModHandle,
     1034              CFG_FRAME,
     1035              MPFROMLONG(IDM_VIEWERSETTINGS));
    10361036  }
    10371037  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    10581058    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    10591059      switch (CHARMSG(&msg)->vkey) {
    1060         case VK_F3:
    1061         case VK_ENTER:
    1062         case VK_NEWLINE:
    1063           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    1064           return 0;
    1065           break;
    1066         case VK_ESC:
    1067           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    1068           return 0;
    1069           break;
    1070         case VK_F1:
    1071           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    1072           return 0;
    1073           break;
     1060        case VK_F3:
     1061        case VK_ENTER:
     1062        case VK_NEWLINE:
     1063          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     1064          return 0;
     1065          break;
     1066        case VK_ESC:
     1067          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     1068          return 0;
     1069          break;
     1070        case VK_F1:
     1071          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     1072          return 0;
     1073          break;
    10741074      }
    10751075    }
     
    10911091    case IDM_HELP:
    10921092      if (hwndHelp)
    1093         WinSendMsg(hwndHelp,
    1094                    HM_DISPLAY_HELP,
    1095                    MPFROM2SHORT(HELP_CFGB, 0), MPFROMSHORT(HM_RESOURCEID));
     1093        WinSendMsg(hwndHelp,
     1094                   HM_DISPLAY_HELP,
     1095                   MPFROM2SHORT(HELP_CFGB, 0), MPFROMSHORT(HM_RESOURCEID));
    10961096      break;
    10971097    }
     
    11011101    fToolbarHelp = WinQueryButtonCheckstate(hwnd, CFGB_TOOLBARHELP);
    11021102    PrfWriteProfileData(fmprof,
    1103                         FM3Str, "ToolbarHelp", &fToolbarHelp, sizeof(BOOL));
     1103                        FM3Str, "ToolbarHelp", &fToolbarHelp, sizeof(BOOL));
    11041104    fDrivebarHelp = WinQueryButtonCheckstate(hwnd, CFGB_DRIVEBARHELP);
    11051105    PrfWriteProfileData(fmprof,
    1106                         FM3Str, "DrivebarHelp", &fDrivebarHelp, sizeof(BOOL));
     1106                        FM3Str, "DrivebarHelp", &fDrivebarHelp, sizeof(BOOL));
    11071107    fOtherHelp = WinQueryButtonCheckstate(hwnd, CFGB_OTHERHELP);
    11081108    PrfWriteProfileData(fmprof,
    1109                         FM3Str, "OtherHelp", &fOtherHelp, sizeof(BOOL));
     1109                        FM3Str, "OtherHelp", &fOtherHelp, sizeof(BOOL));
    11101110    break;
    11111111  }
     
    11201120  case WM_INITDLG:
    11211121    WinSendDlgItemMsg(hwnd,
    1122                       CFG5_FILTER,
    1123                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     1122                      CFG5_FILTER,
     1123                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    11241124    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    11251125    break;
     
    11321132    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    11331133      switch (CHARMSG(&msg)->vkey) {
    1134         case VK_F3:
    1135         case VK_ENTER:
    1136         case VK_NEWLINE:
    1137           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    1138           return 0;
    1139           break;
    1140         case VK_ESC:
    1141           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    1142           return 0;
    1143           break;
    1144         case VK_F1:
    1145           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    1146           return 0;
    1147           break;
     1134        case VK_F3:
     1135        case VK_ENTER:
     1136        case VK_NEWLINE:
     1137          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     1138          return 0;
     1139          break;
     1140        case VK_ESC:
     1141          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     1142          return 0;
     1143          break;
     1144        case VK_F1:
     1145          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     1146          return 0;
     1147          break;
    11481148      }
    11491149    }
     
    11601160
    11611161      if (!PrfQueryProfileData(fmprof,
    1162                                appname,
    1163                                "TreeflWindowAttr",
    1164                                (PVOID) & flWindowAttr, &ulSize))
    1165         flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI | CV_FLOW);
     1162                               appname,
     1163                               "TreeflWindowAttr",
     1164                               (PVOID) & flWindowAttr, &ulSize))
     1165        flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI | CV_FLOW);
    11661166      WinCheckButton(hwnd, CFG5_ICON, ((flWindowAttr & CV_ICON) != FALSE));
    11671167      WinCheckButton(hwnd, CFG5_MINIICONS,
    1168                      ((flWindowAttr & CV_MINI) != FALSE));
     1168                     ((flWindowAttr & CV_MINI) != FALSE));
    11691169      memset(&mask, 0, sizeof(mask));
    11701170      mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    1171         FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     1171        FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    11721172      mask.fIsTree = TRUE;
    11731173      ulSize = sizeof(MASK);
    11741174      if (PrfQueryProfileData(fmprof, appname, "TreeFilter", &mask, &ulSize)) {
    1175         SetMask(NULL, &mask);
     1175        SetMask(NULL, &mask);
    11761176      }
    11771177      if (!mask.attrFile)
    1178         mask.attrFile = (FILE_READONLY | FILE_NORMAL |
    1179                         FILE_ARCHIVED | FILE_DIRECTORY |
    1180                         FILE_HIDDEN | FILE_SYSTEM);
     1178        mask.attrFile = (FILE_READONLY | FILE_NORMAL |
     1179                        FILE_ARCHIVED | FILE_DIRECTORY |
     1180                        FILE_HIDDEN | FILE_SYSTEM);
    11811181      strcpy(mask.prompt, GetPString(IDS_TREEFILTERTITLETEXT));
    11821182      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    11911191      WinCheckButton(hwnd, CFG6_SORTREVERSE, FALSE);
    11921192      if (TreesortFlags & SORT_FIRSTEXTENSION)
    1193         WinCheckButton(hwnd, CFG6_SORTFIRST, TRUE);
     1193        WinCheckButton(hwnd, CFG6_SORTFIRST, TRUE);
    11941194      else if (TreesortFlags & SORT_LASTEXTENSION)
    1195         WinCheckButton(hwnd, CFG6_SORTLAST, TRUE);
     1195        WinCheckButton(hwnd, CFG6_SORTLAST, TRUE);
    11961196      else if (TreesortFlags & SORT_SIZE)
    1197         WinCheckButton(hwnd, CFG6_SORTSIZE, TRUE);
     1197        WinCheckButton(hwnd, CFG6_SORTSIZE, TRUE);
    11981198      else if (TreesortFlags & SORT_EASIZE)
    1199         WinCheckButton(hwnd, CFG6_SORTEASIZE, TRUE);
     1199        WinCheckButton(hwnd, CFG6_SORTEASIZE, TRUE);
    12001200      else if (TreesortFlags & SORT_LWDATE)
    1201         WinCheckButton(hwnd, CFG6_SORTLWDATE, TRUE);
     1201        WinCheckButton(hwnd, CFG6_SORTLWDATE, TRUE);
    12021202      else if (TreesortFlags & SORT_LADATE)
    1203         WinCheckButton(hwnd, CFG6_SORTLADATE, TRUE);
     1203        WinCheckButton(hwnd, CFG6_SORTLADATE, TRUE);
    12041204      else if (TreesortFlags & SORT_CRDATE)
    1205         WinCheckButton(hwnd, CFG6_SORTCRDATE, TRUE);
     1205        WinCheckButton(hwnd, CFG6_SORTCRDATE, TRUE);
    12061206      else if (TreesortFlags & SORT_FILENAME)
    1207         WinCheckButton(hwnd, CFG6_SORTFILENAME, TRUE);
     1207        WinCheckButton(hwnd, CFG6_SORTFILENAME, TRUE);
    12081208      else
    1209         WinCheckButton(hwnd, CFG6_SORTNAME, TRUE);
     1209        WinCheckButton(hwnd, CFG6_SORTNAME, TRUE);
    12101210      if (TreesortFlags & SORT_REVERSE)
    1211         WinCheckButton(hwnd, CFG6_SORTREVERSE, TRUE);
     1211        WinCheckButton(hwnd, CFG6_SORTREVERSE, TRUE);
    12121212    }
    12131213    return 0;
     
    12151215  case UM_SETUP5:
    12161216    if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc,
    1217                   FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
     1217                  FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
    12181218      SetMask(NULL, &mask);
    12191219      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    12261226      switch (SHORT2FROMMP(mp1)) {
    12271227      case EN_SETFOCUS:
    1228         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    1229         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    1230         break;
     1228        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     1229        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     1230        break;
    12311231      }
    12321232      break;
     
    12491249    case IDM_HELP:
    12501250      if (hwndHelp)
    1251         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1252                    MPFROM2SHORT(HELP_TREEVIEW, 0),
    1253                    MPFROMSHORT(HM_RESOURCEID));
     1251        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1252                   MPFROM2SHORT(HELP_TREEVIEW, 0),
     1253                   MPFROMSHORT(HM_RESOURCEID));
    12541254      break;
    12551255    }
     
    12611261
    12621262      if (WinQueryButtonCheckstate(hwnd, CFG5_ICON))
    1263         flWindowAttr |= CV_ICON;
     1263        flWindowAttr |= CV_ICON;
    12641264      else
    1265         flWindowAttr |= CV_TEXT;
     1265        flWindowAttr |= CV_TEXT;
    12661266      if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS))
    1267         flWindowAttr |= CV_MINI;
     1267        flWindowAttr |= CV_MINI;
    12681268      flWindowAttr |= (CV_TREE | CV_FLOW | CA_TREELINE);
    12691269      PrfWriteProfileData(fmprof,
    1270                           appname,
    1271                           "TreeflWindowAttr", &flWindowAttr, sizeof(ULONG));
     1270                          appname,
     1271                          "TreeflWindowAttr", &flWindowAttr, sizeof(ULONG));
    12721272      if (hwndTree) {
    12731273
    1274         CNRINFO cnri;
    1275 
    1276         memset(&cnri, 0, sizeof(cnri));
    1277         cnri.cb = sizeof(cnri);
    1278         WinSendMsg(WinWindowFromID
    1279                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    1280                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    1281         cnri.flWindowAttr = flWindowAttr;
    1282         WinSendMsg(WinWindowFromID
    1283                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    1284                    CM_SETCNRINFO, MPFROMP(&cnri),
    1285                    MPFROMLONG(CMA_FLWINDOWATTR));
     1274        CNRINFO cnri;
     1275
     1276        memset(&cnri, 0, sizeof(cnri));
     1277        cnri.cb = sizeof(cnri);
     1278        WinSendMsg(WinWindowFromID
     1279                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     1280                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     1281        cnri.flWindowAttr = flWindowAttr;
     1282        WinSendMsg(WinWindowFromID
     1283                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     1284                   CM_SETCNRINFO, MPFROMP(&cnri),
     1285                   MPFROMLONG(CMA_FLWINDOWATTR));
    12861286      }
    12871287    }
     
    13101310      TreesortFlags |= SORT_REVERSE;
    13111311    PrfWriteProfileData(fmprof, appname, "TreeSort", &TreesortFlags,
    1312                         sizeof(INT));
     1312                        sizeof(INT));
    13131313    if (hwndTree)
    13141314      PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESORT, 0), MPVOID);
     
    13201320
    13211321      dcd = WinQueryWindowPtr(WinWindowFromID(WinWindowFromID(hwndTree,
    1322                                                               FID_CLIENT),
    1323                                               TREE_CNR), QWL_USER);
     1322                                                              FID_CLIENT),
     1323                                              TREE_CNR), QWL_USER);
    13241324      if (dcd && dcd->size == sizeof(DIRCNRDATA)) {
    1325         dcd->mask = mask;
    1326         PostMsg(hwndTree, UM_FILTER, MPVOID, MPVOID);
     1325        dcd->mask = mask;
     1326        PostMsg(hwndTree, UM_FILTER, MPVOID, MPVOID);
    13271327      }
    13281328    }
     
    13401340  case WM_INITDLG:
    13411341    WinSendDlgItemMsg(hwnd, CFGT_ENVVARLIST, EM_SETTEXTLIMIT,
    1342                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     1342                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    13431343    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    13441344    break;
     
    13641364    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    13651365      switch (CHARMSG(&msg)->vkey) {
    1366         case VK_F3:
    1367         case VK_ENTER:
    1368         case VK_NEWLINE:
    1369           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    1370           return 0;
    1371           break;
    1372         case VK_ESC:
    1373           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    1374           return 0;
    1375           break;
    1376         case VK_F1:
    1377           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    1378           return 0;
    1379           break;
     1366        case VK_F3:
     1367        case VK_ENTER:
     1368        case VK_NEWLINE:
     1369          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     1370          return 0;
     1371          break;
     1372        case VK_ESC:
     1373          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     1374          return 0;
     1375          break;
     1376        case VK_F1:
     1377          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     1378          return 0;
     1379          break;
    13801380      }
    13811381    }
     
    13971397    case IDM_HELP:
    13981398      if (hwndHelp)
    1399         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1400                    MPFROM2SHORT(HELP_CFGT, 0), MPFROMSHORT(HM_RESOURCEID));
     1399        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1400                   MPFROM2SHORT(HELP_CFGT, 0), MPFROMSHORT(HM_RESOURCEID));
    14011401      break;
    14021402    }
     
    14061406    fVTreeOpensWPS = WinQueryButtonCheckstate(hwnd, CFGT_VTREEOPENSWPS);
    14071407    PrfWriteProfileData(fmprof, FM3Str, "VTreeOpensWPS", &fVTreeOpensWPS,
    1408                         sizeof(BOOL));
     1408                        sizeof(BOOL));
    14091409    fCollapseFirst = WinQueryButtonCheckstate(hwnd, CFGT_COLLAPSEFIRST);
    14101410    PrfWriteProfileData(fmprof, appname, "CollapseFirst", &fCollapseFirst,
    1411                         sizeof(BOOL));
     1411                        sizeof(BOOL));
    14121412    fSwitchTreeOnFocus = WinQueryButtonCheckstate(hwnd,
    1413                                                   CFGT_SWITCHTREEONFOCUS);
     1413                                                  CFGT_SWITCHTREEONFOCUS);
    14141414    PrfWriteProfileData(fmprof, appname, "SwitchTreeOnFocus",
    1415                         &fSwitchTreeOnFocus, sizeof(BOOL));
     1415                        &fSwitchTreeOnFocus, sizeof(BOOL));
    14161416    fSwitchTreeExpand = WinQueryButtonCheckstate(hwnd, CFGT_SWITCHTREEEXPAND);
    14171417    PrfWriteProfileData(fmprof, appname, "SwitchTreeExpand",
    1418                         &fSwitchTreeExpand, sizeof(BOOL));
     1418                        &fSwitchTreeExpand, sizeof(BOOL));
    14191419    fSwitchTree = WinQueryButtonCheckstate(hwnd, CFGT_SWITCHTREE);
    14201420    PrfWriteProfileData(fmprof, appname, "SwitchTree", &fSwitchTree,
    1421                         sizeof(BOOL));
     1421                        sizeof(BOOL));
    14221422    fFollowTree = WinQueryButtonCheckstate(hwnd, CFGT_FOLLOWTREE);
    14231423    PrfWriteProfileData(fmprof, appname, "FollowTree", &fFollowTree,
    1424                         sizeof(BOOL));
     1424                        sizeof(BOOL));
    14251425    fTopDir = WinQueryButtonCheckstate(hwnd, CFGT_TOPDIR);
    14261426    PrfWriteProfileData(fmprof, appname, "TopDir", (PVOID) & fTopDir,
    1427                         sizeof(BOOL));
     1427                        sizeof(BOOL));
    14281428    fDCOpens = WinQueryButtonCheckstate(hwnd, CFGT_DCOPENS);
    14291429    PrfWriteProfileData(fmprof, FM3Str, "DoubleClickOpens", &fDCOpens,
    1430                         sizeof(BOOL));
     1430                        sizeof(BOOL));
    14311431    fShowEnvChanged = (fShowEnv != WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV));
    14321432    fShowEnv = WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV);
     
    14351435      char * pszTemp = xmalloc(WinQueryDlgItemTextLength(hwnd, CFGT_ENVVARLIST) + 1, pszSrcFile, __LINE__);
    14361436      if (pszTemp) {
    1437         WinQueryDlgItemText(hwnd, CFGT_ENVVARLIST, MaxComLineStrg, pszTemp);
    1438         strupr(pszTemp);
    1439         if (strcmp(pszTemp, pszTreeEnvVarList)) {
    1440           fTreeEnvVarListChanged = TRUE;
    1441           strcpy(pszTreeEnvVarList, pszTemp);
    1442           PrfWriteProfileString(fmprof, appname, "TreeEnvVarList", pszTreeEnvVarList);
    1443         }
    1444         free(pszTemp);
     1437        WinQueryDlgItemText(hwnd, CFGT_ENVVARLIST, MaxComLineStrg, pszTemp);
     1438        strupr(pszTemp);
     1439        if (strcmp(pszTemp, pszTreeEnvVarList)) {
     1440          fTreeEnvVarListChanged = TRUE;
     1441          strcpy(pszTreeEnvVarList, pszTemp);
     1442          PrfWriteProfileString(fmprof, appname, "TreeEnvVarList", pszTreeEnvVarList);
     1443        }
     1444        free(pszTemp);
    14451445      }
    14461446      if (hwndTree && (fShowEnvChanged || (fShowEnv && fTreeEnvVarListChanged)))
    14471447      {
    1448         PCNRITEM pci = WinSendMsg(WinWindowFromID
    1449                 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), CM_QUERYRECORDEMPHASIS,
    1450                                   MPFROMLONG(CMA_FIRST),
    1451                                   MPFROMSHORT(CRA_SELECTED));
    1452         PostMsg(WinWindowFromID
    1453                 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND,
    1454                 MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    1455         pszTemp = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
    1456         if (pszTemp) {
    1457           if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTemp), MPVOID))
    1458             free(pszTemp);
    1459           /* pszTemp is freed in the UM_SHOWME code */
    1460         }
     1448        PCNRITEM pci = WinSendMsg(WinWindowFromID
     1449                (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), CM_QUERYRECORDEMPHASIS,
     1450                                  MPFROMLONG(CMA_FIRST),
     1451                                  MPFROMSHORT(CRA_SELECTED));
     1452        PostMsg(WinWindowFromID
     1453                (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND,
     1454                MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
     1455        pszTemp = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
     1456        if (pszTemp) {
     1457          if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTemp), MPVOID))
     1458            free(pszTemp);
     1459          /* pszTemp is freed in the UM_SHOWME code */
     1460        }
    14611461      }
    14621462    }
     
    14711471  case WM_INITDLG:
    14721472    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETTEXTLIMIT,
    1473                       MPFROMSHORT(8), MPVOID);
     1473                      MPFROMSHORT(8), MPVOID);
    14741474    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_OVERRIDESETLIMITS,
    1475                       MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN));
     1475                      MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN));
    14761476    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    14771477    break;
     
    14841484    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    14851485      switch (CHARMSG(&msg)->vkey) {
    1486         case VK_F3:
    1487         case VK_ENTER:
    1488         case VK_NEWLINE:
    1489           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    1490           return 0;
    1491           break;
    1492         case VK_ESC:
    1493           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    1494           return 0;
    1495           break;
    1496         case VK_F1:
    1497           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    1498           return 0;
    1499           break;
     1486        case VK_F3:
     1487        case VK_ENTER:
     1488        case VK_NEWLINE:
     1489          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     1490          return 0;
     1491          break;
     1492        case VK_ESC:
     1493          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     1494          return 0;
     1495          break;
     1496        case VK_F1:
     1497          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     1498          return 0;
     1499          break;
    15001500      }
    15011501    }
     
    15221522    WinCheckButton(hwnd, CFGG_TRASHCAN, fTrashCan);
    15231523    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETCURRENTVALUE,
    1524                       MPFROMLONG(MaxComLineStrg), MPVOID);
     1524                      MPFROMLONG(MaxComLineStrg), MPVOID);
    15251525    return 0;
    15261526
     
    15391539      switch (SHORT2FROMMP(mp1)) {
    15401540      case EN_SETFOCUS:
    1541         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    1542         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    1543         break;
     1541        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     1542        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     1543        break;
    15441544      }
    15451545      break;
     
    15621562    case IDM_HELP:
    15631563      if (hwndHelp)
    1564         WinSendMsg(hwndHelp,
    1565                    HM_DISPLAY_HELP,
    1566                    MPFROM2SHORT(HELP_CFGG, 0), MPFROMSHORT(HM_RESOURCEID));
     1564        WinSendMsg(hwndHelp,
     1565                   HM_DISPLAY_HELP,
     1566                   MPFROM2SHORT(HELP_CFGG, 0), MPFROMSHORT(HM_RESOURCEID));
    15671567      break;
    15681568    }
     
    15781578      PrfWriteProfileData(fmprof, FM3Str, "NoDead", &fNoDead, sizeof(BOOL));
    15791579      PrfWriteProfileData(fmprof,
    1580                           FM3Str, "NoFinger", &fNoFinger, sizeof(BOOL));
     1580                          FM3Str, "NoFinger", &fNoFinger, sizeof(BOOL));
    15811581      WinDestroyPointer(hptrFinger);
    15821582      if (!fNoDead)
    1583         hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
     1583        hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
    15841584      else
    1585         hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
     1585        hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
    15861586    }
    15871587    fLinkSetsIcon = WinQueryButtonCheckstate(hwnd, CFGG_LINKSETSICON);
    15881588    PrfWriteProfileData(fmprof,
    1589                         appname,
    1590                         "LinkSetsIcon", &fLinkSetsIcon, sizeof(BOOL));
     1589                        appname,
     1590                        "LinkSetsIcon", &fLinkSetsIcon, sizeof(BOOL));
    15911591    fCustomFileDlg = WinQueryButtonCheckstate(hwnd, CFGG_CUSTOMFILEDLG);
    15921592    PrfWriteProfileData(fmprof,
    1593                         FM3Str,
    1594                         "CustomFileDlg", &fCustomFileDlg, sizeof(BOOL));
     1593                        FM3Str,
     1594                        "CustomFileDlg", &fCustomFileDlg, sizeof(BOOL));
    15951595    fDullMin = WinQueryButtonCheckstate(hwnd, CFGG_BORING);
    15961596    PrfWriteProfileData(fmprof,
    1597                         FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL));
     1597                        FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL));
    15981598    fConfirmDelete = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMDELETE);
    15991599    PrfWriteProfileData(fmprof,
    1600                         appname,
    1601                         "ConfirmDelete", &fConfirmDelete, sizeof(BOOL));
     1600                        appname,
     1601                        "ConfirmDelete", &fConfirmDelete, sizeof(BOOL));
    16021602    fDontMoveMouse = WinQueryButtonCheckstate(hwnd, CFGG_DONTMOVEMOUSE);
    16031603    PrfWriteProfileData(fmprof,
    1604                         appname,
    1605                         "DontMoveMouse", &fDontMoveMouse, sizeof(BOOL));
     1604                        appname,
     1605                        "DontMoveMouse", &fDontMoveMouse, sizeof(BOOL));
    16061606    fCopyDefault = WinQueryButtonCheckstate(hwnd, CFGG_DEFAULTCOPY);
    16071607    PrfWriteProfileData(fmprof, appname, "DefaultCopy",
    1608                         &fCopyDefault, sizeof(BOOL));
     1608                        &fCopyDefault, sizeof(BOOL));
    16091609    fRealIdle = WinQueryButtonCheckstate(hwnd, CFGG_IDLECOPY);
    16101610    PrfWriteProfileData(fmprof, appname, "IdleCopy",
    1611                         &fRealIdle, sizeof(BOOL));
     1611                        &fRealIdle, sizeof(BOOL));
    16121612    fDragndropDlg = WinQueryButtonCheckstate(hwnd, CFGG_DNDDLG);
    16131613    PrfWriteProfileData(fmprof, appname, "Drag&DropDlg",
    1614                         &fDragndropDlg, sizeof(BOOL));
     1614                        &fDragndropDlg, sizeof(BOOL));
    16151615    fVerify = WinQueryButtonCheckstate(hwnd, CFGG_VERIFYWRITES);
    16161616    PrfWriteProfileData(fmprof, appname, "VerifyWrites",
    1617                         &fVerify, sizeof(BOOL));
     1617                        &fVerify, sizeof(BOOL));
    16181618    DosSetVerify(fVerify);
    16191619    fDefaultDeletePerm = WinQueryButtonCheckstate(hwnd,
    1620                                                   CFGG_DEFAULTDELETEPERM);
     1620                                                  CFGG_DEFAULTDELETEPERM);
    16211621    PrfWriteProfileData(fmprof, appname, "DefaultDeletePerm",
    1622                         &fDefaultDeletePerm, sizeof(BOOL));
     1622                        &fDefaultDeletePerm, sizeof(BOOL));
    16231623    fFM2Deletes = WinQueryButtonCheckstate(hwnd, CFGG_FM2DELETES);
    16241624    PrfWriteProfileData(fmprof, FM3Str, "FM2Deletes",
    1625                         &fFM2Deletes, sizeof(BOOL));
     1625                        &fFM2Deletes, sizeof(BOOL));
    16261626    fTrashCan = WinQueryButtonCheckstate(hwnd, CFGG_TRASHCAN);
    16271627    PrfWriteProfileData(fmprof, FM3Str, "TrashCan",
    1628                         &fTrashCan, sizeof(BOOL));
     1628                        &fTrashCan, sizeof(BOOL));
    16291629    fConfirmTarget = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMTARGET);
    16301630    PrfWriteProfileData(fmprof, appname, "ConfirmTarget",
    1631                         &fConfirmTarget, sizeof(BOOL));
     1631                        &fConfirmTarget, sizeof(BOOL));
    16321632    {
    16331633      WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_QUERYVALUE,
    1634                         MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     1634                        MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    16351635      if (MaxComLineStrg < CMDLNLNGTH_MIN)
    1636         MaxComLineStrg = CMDLNLNGTH_MIN;
     1636        MaxComLineStrg = CMDLNLNGTH_MIN;
    16371637      else if (MaxComLineStrg > CMDLNLNGTH_MAX)
    1638         MaxComLineStrg = CMDLNLNGTH_MAX;
     1638        MaxComLineStrg = CMDLNLNGTH_MAX;
    16391639      PrfWriteProfileData(fmprof,
    1640                           appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG));
     1640                          appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG));
    16411641    }
    16421642    break;
     
    16501650  case WM_INITDLG:
    16511651    WinSendDlgItemMsg(hwnd, CFGC_COMPARE, EM_SETTEXTLIMIT,
    1652                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     1652                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    16531653    WinSendDlgItemMsg(hwnd, CFGC_DIRCOMPARE, EM_SETTEXTLIMIT,
    1654                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     1654                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    16551655    WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);
    16561656    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    16641664    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    16651665      switch (CHARMSG(&msg)->vkey) {
    1666         case VK_F3:
    1667         case VK_ENTER:
    1668         case VK_NEWLINE:
    1669           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    1670           return 0;
    1671           break;
    1672         case VK_ESC:
    1673           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    1674           return 0;
    1675           break;
    1676         case VK_F1:
    1677           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    1678           return 0;
    1679           break;
     1666        case VK_F3:
     1667        case VK_ENTER:
     1668        case VK_NEWLINE:
     1669          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     1670          return 0;
     1671          break;
     1672        case VK_ESC:
     1673          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     1674          return 0;
     1675          break;
     1676        case VK_F1:
     1677          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     1678          return 0;
     1679          break;
    16801680      }
    16811681    }
     
    16931693      switch (SHORT2FROMMP(mp1)) {
    16941694      case EN_KILLFOCUS:
    1695         WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);
    1696         break;
     1695        WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);
     1696        break;
    16971697      case EN_SETFOCUS:
    1698         WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), TRUE);
    1699         break;
     1698        WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), TRUE);
     1699        break;
    17001700      }
    17011701      break;
     
    17181718    case IDM_HELP:
    17191719      if (hwndHelp)
    1720         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1721                    MPFROM2SHORT(HELP_CFGC, 0), MPFROMSHORT(HM_RESOURCEID));
     1720        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1721                   MPFROM2SHORT(HELP_CFGC, 0), MPFROMSHORT(HM_RESOURCEID));
    17221722      break;
    17231723
    17241724    case CFGC_FIND:
    17251725      {
    1726         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    1727         USHORT id;
    1728         HWND hwndFocus;
    1729 
    1730         strcpy(filename, "*.EXE");
    1731         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    1732         if (hwndFocus) {
    1733           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    1734           switch (id) {
    1735           case CFGC_COMPARE:
    1736           case CFGC_DIRCOMPARE:
    1737             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    1738               BldQuotedFileName(szfilename, filename);
    1739               strcat(szfilename, " %a");
    1740               WinSetDlgItemText(hwnd, id, szfilename);
    1741             }
    1742             break;
    1743           default:
    1744             Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
    1745             break;
    1746           }
    1747         }
     1726        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     1727        USHORT id;
     1728        HWND hwndFocus;
     1729
     1730        strcpy(filename, "*.EXE");
     1731        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     1732        if (hwndFocus) {
     1733          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     1734          switch (id) {
     1735          case CFGC_COMPARE:
     1736          case CFGC_DIRCOMPARE:
     1737            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     1738              BldQuotedFileName(szfilename, filename);
     1739              strcat(szfilename, " %a");
     1740              WinSetDlgItemText(hwnd, id, szfilename);
     1741            }
     1742            break;
     1743          default:
     1744            Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
     1745            break;
     1746          }
     1747        }
    17481748      }
    17491749      break;
     
    17571757
    17581758      szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    1759         if (!szCLBuf)
    1760           return 0; //already complained
     1759        if (!szCLBuf)
     1760          return 0; //already complained
    17611761      pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    17621762      if (!pszWorkBuf) {
    1763         free(szCLBuf);
    1764         return 0; //already complained
     1763        free(szCLBuf);
     1764        return 0; //already complained
    17651765      }
    17661766      WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MaxComLineStrg, szCLBuf);
    1767         szCLBuf[MaxComLineStrg - 1] = 0;
    1768         if (strcmp(szCLBuf, dircompare)){
    1769           NormalizeCmdLine(pszWorkBuf, szCLBuf);
    1770           memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1);
    1771           if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
    1772             strcat(dircompare, " %a");
    1773         }
     1767        szCLBuf[MaxComLineStrg - 1] = 0;
     1768        if (strcmp(szCLBuf, dircompare)){
     1769          NormalizeCmdLine(pszWorkBuf, szCLBuf);
     1770          memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1);
     1771          if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
     1772            strcat(dircompare, " %a");
     1773        }
    17741774      PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare);
    17751775      WinQueryDlgItemText(hwnd, CFGC_COMPARE, MaxComLineStrg, szCLBuf);
    17761776      szCLBuf[MaxComLineStrg - 1] = 0;
    17771777      if (strcmp(szCLBuf, compare)){
    1778         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    1779         memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1);
    1780         if (!strchr(compare, '%') && strlen(compare) > 3)
    1781           strcat(compare, " %a");
     1778        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     1779        memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1);
     1780        if (!strchr(compare, '%') && strlen(compare) > 3)
     1781          strcat(compare, " %a");
    17821782      }
    17831783      free(pszWorkBuf);
     
    17901790    fCancelAction = FALSE;
    17911791    WinDlgBox(HWND_DESKTOP,
    1792               hwnd,
    1793               CfgDlgProc,
    1794               FM3ModHandle,
    1795               CFG_FRAME,
    1796               MPFROMLONG(IDM_COMPARESETTINGS));
     1792              hwnd,
     1793              CfgDlgProc,
     1794              FM3ModHandle,
     1795              CFG_FRAME,
     1796              MPFROMLONG(IDM_COMPARESETTINGS));
    17971797  }
    17981798  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    18151815    WinCheckButton(hwnd, CFGD_NOSEARCH, fNoSearch);
    18161816    WinCheckButton(hwnd, CFGD_EXTENDEDSEL,
    1817                    ((ulCnrType & CCS_EXTENDSEL) != 0));
     1817                   ((ulCnrType & CCS_EXTENDSEL) != 0));
    18181818    WinCheckButton(hwnd, CFGD_MULTIPLESEL,
    1819                    ((ulCnrType & CCS_MULTIPLESEL) != 0));
     1819                   ((ulCnrType & CCS_MULTIPLESEL) != 0));
    18201820    WinCheckButton(hwnd, CFGD_LEAVETREE, fLeaveTree);
    18211821    WinCheckButton(hwnd, CFGD_NOFOLDMENU, fNoFoldMenu);
     
    18291829    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    18301830      switch (CHARMSG(&msg)->vkey) {
    1831         case VK_F3:
    1832         case VK_ENTER:
    1833         case VK_NEWLINE:
    1834           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    1835           return 0;
    1836           break;
    1837         case VK_ESC:
    1838           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    1839           return 0;
    1840           break;
    1841         case VK_F1:
    1842           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    1843           return 0;
    1844           break;
     1831        case VK_F3:
     1832        case VK_ENTER:
     1833        case VK_NEWLINE:
     1834          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     1835          return 0;
     1836          break;
     1837        case VK_ESC:
     1838          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     1839          return 0;
     1840          break;
     1841        case VK_F1:
     1842          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     1843          return 0;
     1844          break;
    18451845      }
    18461846    }
     
    18621862    case IDM_HELP:
    18631863      if (hwndHelp)
    1864         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1865                    MPFROM2SHORT(HELP_CFGD, 0), MPFROMSHORT(HM_RESOURCEID));
     1864        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1865                   MPFROM2SHORT(HELP_CFGD, 0), MPFROMSHORT(HM_RESOURCEID));
    18661866      break;
    18671867    }
     
    18751875      ulCnrType |= CCS_MULTIPLESEL;
    18761876    PrfWriteProfileData(fmprof, appname, "ContainerType",
    1877                         (PVOID) & ulCnrType, sizeof(BOOL));
     1877                        (PVOID) & ulCnrType, sizeof(BOOL));
    18781878    fMinOnOpen = WinQueryButtonCheckstate(hwnd, CFGD_MINONOPEN);
    18791879    PrfWriteProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen,
    1880                         sizeof(BOOL));
     1880                        sizeof(BOOL));
    18811881    fLeaveTree = WinQueryButtonCheckstate(hwnd, CFGD_LEAVETREE);
    18821882    PrfWriteProfileData(fmprof, appname, "LeaveTree", &fLeaveTree,
    1883                         sizeof(BOOL));
     1883                        sizeof(BOOL));
    18841884    fNoFoldMenu = WinQueryButtonCheckstate(hwnd, CFGD_NOFOLDMENU);
    18851885    PrfWriteProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu,
    1886                         sizeof(BOOL));
     1886                        sizeof(BOOL));
    18871887    fSelectedAlways = WinQueryButtonCheckstate(hwnd, CFGD_SELECTEDALWAYS);
    18881888    PrfWriteProfileData(fmprof, appname, "SelectedAlways", &fSelectedAlways,
    1889                         sizeof(BOOL));
     1889                        sizeof(BOOL));
    18901890    fNoSearch = WinQueryButtonCheckstate(hwnd, CFGD_NOSEARCH);
    18911891    PrfWriteProfileData(fmprof, appname, "NoSearch", &fNoSearch,
    1892                         sizeof(BOOL));
     1892                        sizeof(BOOL));
    18931893    fLookInDir = WinQueryButtonCheckstate(hwnd, CFGD_LOOKINDIR);
    18941894    PrfWriteProfileData(fmprof, FM3Str, "LookInDir", (PVOID) & fLookInDir,
    1895                         sizeof(BOOL));
     1895                        sizeof(BOOL));
    18961896    fUnHilite = WinQueryButtonCheckstate(hwnd, CFGD_UNHILITE);
    18971897    PrfWriteProfileData(fmprof, appname, "UnHilite",
    1898                         &fUnHilite, sizeof(BOOL));
     1898                        &fUnHilite, sizeof(BOOL));
    18991899    {
    19001900      BOOL fOldSyncUpdates = WinQueryButtonCheckstate(hwnd, CFGD_SYNCUPDATES);
    19011901
    19021902      if (fOldSyncUpdates != fSyncUpdates) {
    1903         fSyncUpdates = fOldSyncUpdates;
    1904         if (hwndMain && !strcmp(realappname, FM3Str)) {
    1905           // Save state and restore to refresh windows with new settings
    1906           if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {
    1907             PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
     1903        fSyncUpdates = fOldSyncUpdates;
     1904        if (hwndMain && !strcmp(realappname, FM3Str)) {
     1905          // Save state and restore to refresh windows with new settings
     1906          if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {
     1907            PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
    19081908//          PostMsg(hwndMain, UM_RESTORE, MPVOID, MPVOID);
    1909             PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);
    1910           }
    1911         }
     1909            PostMsg(MainObjectHwnd, UM_RESTORE, (PSZ)GetPString(IDS_FM2TEMPTEXT), MPVOID);
     1910          }
     1911        }
    19121912      }
    19131913    }
    19141914    PrfWriteProfileData(fmprof, appname, "SyncUpdates",
    1915                         &fSyncUpdates, sizeof(BOOL));
     1915                        &fSyncUpdates, sizeof(BOOL));
    19161916    if (!(ulCnrType & (CCS_EXTENDSEL | CCS_MULTIPLESEL)))
    19171917      saymsg(MB_ENTER | MB_ICONEXCLAMATION,
    1918              HWND_DESKTOP,
    1919              GetPString(IDS_WARNINGTEXT),
    1920              GetPString(IDS_SELECTTYPEERRORTEXT));
     1918             HWND_DESKTOP,
     1919             GetPString(IDS_WARNINGTEXT),
     1920             GetPString(IDS_SELECTTYPEERRORTEXT));
    19211921    break;                              // WM_CLOSE
    19221922  }
     
    19381938    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    19391939      switch (CHARMSG(&msg)->vkey) {
    1940         case VK_F3:
    1941         case VK_ENTER:
    1942         case VK_NEWLINE:
    1943           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    1944           return 0;
    1945           break;
    1946         case VK_ESC:
    1947           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    1948           return 0;
    1949           break;
    1950         case VK_F1:
    1951           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    1952           return 0;
    1953           break;
     1940        case VK_F3:
     1941        case VK_ENTER:
     1942        case VK_NEWLINE:
     1943          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     1944          return 0;
     1945          break;
     1946        case VK_ESC:
     1947          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     1948          return 0;
     1949          break;
     1950        case VK_F1:
     1951          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     1952          return 0;
     1953          break;
    19541954      }
    19551955    }
     
    19981998      switch (SHORT1FROMMP(mp1)) {
    19991999      case CFGM_RECENTDIRS:
    2000         sprintf(s,
    2001                 GetPString(IDS_RECENTHELPWHICHTEXT),
    2002                 (!oh && th) ?
    2003                 GetPString(IDS_RECENTONLYTEXT) :
    2004                 (oh && th) ?
    2005                 GetPString(IDS_ALLONLYTEXT) : GetPString(IDS_NONE));
    2006         break;
     2000        sprintf(s,
     2001                GetPString(IDS_RECENTHELPWHICHTEXT),
     2002                (!oh && th) ?
     2003                GetPString(IDS_RECENTONLYTEXT) :
     2004                (oh && th) ?
     2005                GetPString(IDS_ALLONLYTEXT) : GetPString(IDS_NONE));
     2006        break;
    20072007      }
    20082008      if (*s)
    2009         WinSetDlgItemText(hwnd, SHORT1FROMMP(mp1), s);
     2009        WinSetDlgItemText(hwnd, SHORT1FROMMP(mp1), s);
    20102010    }
    20112011    return 0;
     
    20182018    case CFGM_STARTMIN:
    20192019      if (WinQueryButtonCheckstate(hwnd, CFGM_STARTMIN)) {
    2020         WinCheckButton(hwnd, CFGM_STARTMAX, FALSE);
    2021         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), FALSE);
     2020        WinCheckButton(hwnd, CFGM_STARTMAX, FALSE);
     2021        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), FALSE);
    20222022      }
    20232023      else
    2024         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), TRUE);
     2024        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), TRUE);
    20252025      break;
    20262026    case CFGM_STARTMAX:
    20272027      if (WinQueryButtonCheckstate(hwnd, CFGM_STARTMAX)) {
    2028         WinCheckButton(hwnd, CFGM_STARTMIN, FALSE);
    2029         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), FALSE);
     2028        WinCheckButton(hwnd, CFGM_STARTMIN, FALSE);
     2029        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), FALSE);
    20302030      }
    20312031      else
    2032         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), TRUE);
     2032        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), TRUE);
    20332033      break;
    20342034    }
     
    20502050    case IDM_HELP:
    20512051      if (hwndHelp)
    2052         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2053                    MPFROM2SHORT(HELP_CFGM, 0), MPFROMSHORT(HM_RESOURCEID));
     2052        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2053                   MPFROM2SHORT(HELP_CFGM, 0), MPFROMSHORT(HM_RESOURCEID));
    20542054      break;
    20552055    }
     
    20592059    if (hwndMain && !strcmp(realappname, FM3Str)) {
    20602060      if (fFreeTree != WinQueryButtonCheckstate(hwnd, CFGM_FREETREE))
    2061         PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
     2061        PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
    20622062      if (fAutoTile != WinQueryButtonCheckstate(hwnd, CFGM_AUTOTILE))
    2063         PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
     2063        PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
    20642064      if (fSplitStatus != WinQueryButtonCheckstate(hwnd, CFGM_SPLITSTATUS)) {
    2065         fSplitStatus = (fSplitStatus) ? FALSE : TRUE;
    2066         PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_BLINK, 0), MPVOID);
    2067         PrfWriteProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus,
    2068                             sizeof(BOOL));
     2065        fSplitStatus = (fSplitStatus) ? FALSE : TRUE;
     2066        PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_BLINK, 0), MPVOID);
     2067        PrfWriteProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus,
     2068                            sizeof(BOOL));
    20692069      }
    20702070    }
    20712071    fUserListSwitches = WinQueryButtonCheckstate(hwnd, CFGM_USERLISTSWITCHES);
    20722072    PrfWriteProfileData(fmprof, FM3Str, "UserListSwitches",
    2073                         (PVOID) & fUserListSwitches, sizeof(BOOL));
     2073                        (PVOID) & fUserListSwitches, sizeof(BOOL));
    20742074    fExternalINIs = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALINIS);
    20752075    PrfWriteProfileData(fmprof, FM3Str, "ExternalINIs",
    2076                         (PVOID) & fExternalINIs, sizeof(BOOL));
     2076                        (PVOID) & fExternalINIs, sizeof(BOOL));
    20772077    fExternalArcboxes = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALARCBOXES);
    20782078    PrfWriteProfileData(fmprof, FM3Str, "ExternalArcboxes",
    2079                         (PVOID) & fExternalArcboxes, sizeof(BOOL));
     2079                        (PVOID) & fExternalArcboxes, sizeof(BOOL));
    20802080    fExternalCollector =
    20812081      WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALCOLLECTOR);
    20822082    PrfWriteProfileData(fmprof, FM3Str, "ExternalCollector",
    2083                         (PVOID) & fExternalCollector, sizeof(BOOL));
     2083                        (PVOID) & fExternalCollector, sizeof(BOOL));
    20842084    fExternalViewer = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALVIEWER);
    20852085    PrfWriteProfileData(fmprof, FM3Str, "ExternalViewer",
    2086                         (PVOID) & fExternalViewer, sizeof(BOOL));
     2086                        (PVOID) & fExternalViewer, sizeof(BOOL));
    20872087    {
    20882088      long test;
     
    20932093    }
    20942094    PrfWriteProfileData(fmprof,
    2095                         appname,
    2096                         "AutoAddDirs", (PVOID) & fAutoAddDirs, sizeof(BOOL));
     2095                        appname,
     2096                        "AutoAddDirs", (PVOID) & fAutoAddDirs, sizeof(BOOL));
    20972097    PrfWriteProfileData(fmprof,
    2098                         appname,
    2099                         "AutoAddAllDirs",
    2100                         (PVOID) & fAutoAddAllDirs, sizeof(BOOL));
     2098                        appname,
     2099                        "AutoAddAllDirs",
     2100                        (PVOID) & fAutoAddAllDirs, sizeof(BOOL));
    21012101    fwsAnimate = WinQueryButtonCheckstate(hwnd, CFGM_WSANIMATE);
    21022102    if (fwsAnimate)
    21032103      fwsAnimate = WS_ANIMATE;
    21042104    PrfWriteProfileData(fmprof,
    2105                         appname,
    2106                         "WS_ANIMATE", (PVOID) & fwsAnimate, sizeof(ULONG));
     2105                        appname,
     2106                        "WS_ANIMATE", (PVOID) & fwsAnimate, sizeof(ULONG));
    21072107    fSaveState = WinQueryButtonCheckstate(hwnd, CFGM_SAVESTATE);
    21082108    PrfWriteProfileData(fmprof,
    2109                         FM3Str,
    2110                         "SaveState", (PVOID) & fSaveState, sizeof(BOOL));
     2109                        FM3Str,
     2110                        "SaveState", (PVOID) & fSaveState, sizeof(BOOL));
    21112111    fStartMinimized = WinQueryButtonCheckstate(hwnd, CFGM_STARTMIN);
    21122112    PrfWriteProfileData(fmprof,
    2113                         appname,
    2114                         "StartMinimized",
    2115                         (PVOID) & fStartMinimized, sizeof(BOOL));
     2113                        appname,
     2114                        "StartMinimized",
     2115                        (PVOID) & fStartMinimized, sizeof(BOOL));
    21162116    fStartMaximized = WinQueryButtonCheckstate(hwnd, CFGM_STARTMAX);
    21172117    PrfWriteProfileData(fmprof,
    2118                         appname,
    2119                         "StartMaximized",
    2120                         (PVOID) & fStartMaximized, sizeof(BOOL));
     2118                        appname,
     2119                        "StartMaximized",
     2120                        (PVOID) & fStartMaximized, sizeof(BOOL));
    21212121    fDataMin = WinQueryButtonCheckstate(hwnd, CFGM_DATAMIN);
    21222122    PrfWriteProfileData(fmprof,
    2123                         FM3Str, "DataMin", (PVOID) & fDataMin, sizeof(BOOL));
     2123                        FM3Str, "DataMin", (PVOID) & fDataMin, sizeof(BOOL));
    21242124    fTileBackwards = WinQueryButtonCheckstate(hwnd, CFGM_TILEBACKWARDS);
    21252125    PrfWriteProfileData(fmprof,
    2126                         FM3Str,
    2127                         "TileBackwards",
    2128                         (PVOID) & fTileBackwards, sizeof(BOOL));
     2126                        FM3Str,
     2127                        "TileBackwards",
     2128                        (PVOID) & fTileBackwards, sizeof(BOOL));
    21292129    fNoTreeGap = WinQueryButtonCheckstate(hwnd, CFGM_NOTREEGAP);
    21302130    PrfWriteProfileData(fmprof,
    2131                         FM3Str,
    2132                         "NoTreeGap", (PVOID) & fNoTreeGap, sizeof(BOOL));
     2131                        FM3Str,
     2132                        "NoTreeGap", (PVOID) & fNoTreeGap, sizeof(BOOL));
    21332133    fBlueLED = WinQueryButtonCheckstate(hwnd, CFGM_BLUELED);
    21342134    PrfWriteProfileData(fmprof,
    2135                         appname, "BlueLED", (PVOID) & fBlueLED, sizeof(BOOL));
     2135                        appname, "BlueLED", (PVOID) & fBlueLED, sizeof(BOOL));
    21362136    {
    21372137      BOOL dummy;
     
    21392139      dummy = WinQueryButtonCheckstate(hwnd, CFGM_SHOWTARGET);
    21402140      if (dummy != fShowTarget) {
    2141         fShowTarget = dummy;
    2142         PrfWriteProfileData(fmprof,
    2143                             appname,
    2144                             "ShowTarget",
    2145                             (PVOID) & fShowTarget, sizeof(BOOL));
    2146         if (hwndMain)
    2147           PostMsg(WinQueryWindow(hwndMain, QW_PARENT),
    2148                   WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    2149         SetTargetDir(hwnd, TRUE);
     2141        fShowTarget = dummy;
     2142        PrfWriteProfileData(fmprof,
     2143                            appname,
     2144                            "ShowTarget",
     2145                            (PVOID) & fShowTarget, sizeof(BOOL));
     2146        if (hwndMain)
     2147          PostMsg(WinQueryWindow(hwndMain, QW_PARENT),
     2148                  WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     2149        SetTargetDir(hwnd, TRUE);
    21502150      }
    21512151      dummy = WinQueryButtonCheckstate(hwnd, CFGM_SEPARATEPARMS);
    21522152      if (dummy != fSeparateParms) {
    2153         fSeparateParms = dummy;
    2154         PrfWriteProfileData(fmprof,
    2155                             FM3Str,
    2156                             "SeparateParms",
    2157                             (PVOID) & fSeparateParms, sizeof(BOOL));
    2158         WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER),
    2159                    UM_UNDO, MPVOID, MPVOID);
     2153        fSeparateParms = dummy;
     2154        PrfWriteProfileData(fmprof,
     2155                            FM3Str,
     2156                            "SeparateParms",
     2157                            (PVOID) & fSeparateParms, sizeof(BOOL));
     2158        WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER),
     2159                   UM_UNDO, MPVOID, MPVOID);
    21602160      }
    21612161    }
     
    21722172  case WM_INITDLG:
    21732173    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETTEXTLIMIT,
    2174                       MPFROMSHORT(8), MPVOID);
     2174                      MPFROMSHORT(8), MPVOID);
    21752175    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_OVERRIDESETLIMITS,
    2176                       MPFROMLONG(1000), MPFROMLONG(50));
     2176                      MPFROMLONG(1000), MPFROMLONG(50));
    21772177    WinSendDlgItemMsg(hwnd,
    2178                       CFG5_FILTER,
    2179                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     2178                      CFG5_FILTER,
     2179                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    21802180    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    21812181    break;
     
    21882188    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    21892189      switch (CHARMSG(&msg)->vkey) {
    2190         case VK_F3:
    2191         case VK_ENTER:
    2192         case VK_NEWLINE:
    2193           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    2194           return 0;
    2195           break;
    2196         case VK_ESC:
    2197           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    2198           return 0;
    2199           break;
    2200         case VK_F1:
    2201           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    2202           return 0;
    2203           break;
     2190        case VK_F3:
     2191        case VK_ENTER:
     2192        case VK_NEWLINE:
     2193          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     2194          return 0;
     2195          break;
     2196        case VK_ESC:
     2197          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     2198          return 0;
     2199          break;
     2200        case VK_F1:
     2201          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     2202          return 0;
     2203          break;
    22042204      }
    22052205    }
     
    22162216
    22172217      if (!PrfQueryProfileData(fmprof,
    2218                                appname,
    2219                                "DirflWindowAttr", &flWindowAttr, &ulSize))
    2220         flWindowAttr = (CV_NAME | CV_MINI | CA_DETAILSVIEWTITLES | CV_FLOW);
     2218                               appname,
     2219                               "DirflWindowAttr", &flWindowAttr, &ulSize))
     2220        flWindowAttr = (CV_NAME | CV_MINI | CA_DETAILSVIEWTITLES | CV_FLOW);
    22212221      if (flWindowAttr & CV_ICON)
    2222         WinCheckButton(hwnd, CFG5_ICON, TRUE);
     2222        WinCheckButton(hwnd, CFG5_ICON, TRUE);
    22232223      if (flWindowAttr & CV_NAME)
    2224         WinCheckButton(hwnd, CFG5_NAME, TRUE);
     2224        WinCheckButton(hwnd, CFG5_NAME, TRUE);
    22252225      if (flWindowAttr & CV_TEXT)
    2226         WinCheckButton(hwnd, CFG5_TEXT, TRUE);
     2226        WinCheckButton(hwnd, CFG5_TEXT, TRUE);
    22272227      if (flWindowAttr & CV_DETAIL)
    2228         WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
     2228        WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
    22292229      if (flWindowAttr & CV_MINI)
    2230         WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
     2230        WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
    22312231      if (flWindowAttr & CA_DETAILSVIEWTITLES)
    2232         WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
     2232        WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
    22332233      WinCheckButton(hwnd, CFG5_SHOWLNAMES, dsDirCnrDefault.detailslongname);
    22342234      WinCheckButton(hwnd, CFG5_SHOWSUBJECT, dsDirCnrDefault.detailssubject);
     
    22452245      memset(&mask, 0, sizeof(mask));
    22462246      mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2247         FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2247        FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    22482248      ulSize = sizeof(MASK);
    22492249      if (PrfQueryProfileData(fmprof, appname, "DirFilter", &mask, &ulSize))
    2250         SetMask(NULL, &mask);
     2250        SetMask(NULL, &mask);
    22512251      if (!mask.attrFile)
    2252         mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2253           FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2252        mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
     2253          FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    22542254      strcpy(mask.prompt, GetPString(IDS_DEFDIRFILTERTITLETEXT));
    22552255      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    22572257      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, dsDirCnrDefault.fSubjectLengthMax);
    22582258      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    2259                         MPFROMLONG(dsDirCnrDefault.SubjectDisplayWidth), MPVOID);
     2259                        MPFROMLONG(dsDirCnrDefault.SubjectDisplayWidth), MPVOID);
    22602260    }
    22612261    return 0;
     
    22632263  case UM_SETUP5:
    22642264    if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc,
    2265                   FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
     2265                  FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
    22662266      SetMask(NULL, &mask);
    22672267      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    22742274      switch (SHORT2FROMMP(mp1)) {
    22752275      case EN_SETFOCUS:
    2276         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    2277         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    2278         break;
     2276        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     2277        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     2278        break;
    22792279      }
    22802280      break;
     
    22972297    case IDM_HELP:
    22982298      if (hwndHelp)
    2299         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2300                    MPFROM2SHORT(HELP_CFG5, 0), MPFROMSHORT(HM_RESOURCEID));
     2299        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2300                   MPFROM2SHORT(HELP_CFG5, 0), MPFROMSHORT(HM_RESOURCEID));
    23012301      break;
    23022302    }
     
    23082308
    23092309      if (WinQueryButtonCheckstate(hwnd, CFG5_ICON))
    2310         flWindowAttr |= CV_ICON;
     2310        flWindowAttr |= CV_ICON;
    23112311      if (WinQueryButtonCheckstate(hwnd, CFG5_NAME))
    2312         flWindowAttr |= CV_NAME;
     2312        flWindowAttr |= CV_NAME;
    23132313      if (WinQueryButtonCheckstate(hwnd, CFG5_TEXT))
    2314         flWindowAttr |= CV_TEXT;
     2314        flWindowAttr |= CV_TEXT;
    23152315      if (WinQueryButtonCheckstate(hwnd, CFG5_DETAIL))
    2316         flWindowAttr |= CV_DETAIL;
     2316        flWindowAttr |= CV_DETAIL;
    23172317      if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS))
    2318         flWindowAttr |= CV_MINI;
     2318        flWindowAttr |= CV_MINI;
    23192319      if (WinQueryButtonCheckstate(hwnd, CFG5_SHOWTITLES))
    2320         flWindowAttr |= CA_DETAILSVIEWTITLES;
     2320        flWindowAttr |= CA_DETAILSVIEWTITLES;
    23212321      flWindowAttr |= CV_FLOW;
    23222322      PrfWriteProfileData(fmprof,
    2323                           appname,
    2324                           "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
     2323                          appname,
     2324                          "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
    23252325    }
    23262326    dsDirCnrDefault.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
    23272327    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    2328                         &dsDirCnrDefault.detailslongname, sizeof(BOOL));
     2328                        &dsDirCnrDefault.detailslongname, sizeof(BOOL));
    23292329    dsDirCnrDefault.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    23302330    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    2331                         &dsDirCnrDefault.detailssubject, sizeof(BOOL));
     2331                        &dsDirCnrDefault.detailssubject, sizeof(BOOL));
    23322332    dsDirCnrDefault.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    23332333    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    2334                         &dsDirCnrDefault.detailsea, sizeof(BOOL));
     2334                        &dsDirCnrDefault.detailsea, sizeof(BOOL));
    23352335    dsDirCnrDefault.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
    23362336    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    2337                         &dsDirCnrDefault.detailssize, sizeof(BOOL));
     2337                        &dsDirCnrDefault.detailssize, sizeof(BOOL));
    23382338    dsDirCnrDefault.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
    23392339    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    2340                         &dsDirCnrDefault.detailsicon, sizeof(BOOL));
     2340                        &dsDirCnrDefault.detailsicon, sizeof(BOOL));
    23412341    dsDirCnrDefault.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
    23422342    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    2343                         &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
     2343                        &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
    23442344    dsDirCnrDefault.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
    23452345    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    2346                         &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
     2346                        &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
    23472347    dsDirCnrDefault.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
    23482348    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    2349                         &dsDirCnrDefault.detailsladate, sizeof(BOOL));
     2349                        &dsDirCnrDefault.detailsladate, sizeof(BOOL));
    23502350    dsDirCnrDefault.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
    23512351    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    2352                         &dsDirCnrDefault.detailslatime, sizeof(BOOL));
     2352                        &dsDirCnrDefault.detailslatime, sizeof(BOOL));
    23532353    dsDirCnrDefault.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
    23542354    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    2355                         &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
     2355                        &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
    23562356    dsDirCnrDefault.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
    23572357    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    2358                         &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
     2358                        &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
    23592359    dsDirCnrDefault.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    23602360    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    2361                         &dsDirCnrDefault.detailsattr, sizeof(BOOL));
     2361                        &dsDirCnrDefault.detailsattr, sizeof(BOOL));
    23622362    dsDirCnrDefault.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    23632363    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectInLeftPane",
    2364                         &dsDirCnrDefault.fSubjectInLeftPane, sizeof(BOOL));
     2364                        &dsDirCnrDefault.fSubjectInLeftPane, sizeof(BOOL));
    23652365    dsDirCnrDefault.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    23662366    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectLengthMax",
    2367                         &dsDirCnrDefault.fSubjectLengthMax, sizeof(BOOL));
     2367                        &dsDirCnrDefault.fSubjectLengthMax, sizeof(BOOL));
    23682368    *mask.prompt = 0;
    23692369    PrfWriteProfileData(fmprof, appname, "DirFilter", &mask, sizeof(MASK));
    23702370    {
    2371         if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
    2372           WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
    2373                             MPFROMP(&dsDirCnrDefault.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    2374           if (dsDirCnrDefault.SubjectDisplayWidth < 50)
    2375             dsDirCnrDefault.SubjectDisplayWidth = 0;
    2376           else if (dsDirCnrDefault.SubjectDisplayWidth > 1000)
    2377             dsDirCnrDefault.SubjectDisplayWidth = 1000;
    2378         }
    2379         else
    2380           dsDirCnrDefault.SubjectDisplayWidth = 0;
    2381         PrfWriteProfileData(fmprof,
    2382                             appname, "DirCnr.SubjectDisplayWidth",
    2383                             &dsDirCnrDefault.SubjectDisplayWidth, sizeof(ULONG));
     2371        if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
     2372          WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
     2373                            MPFROMP(&dsDirCnrDefault.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     2374          if (dsDirCnrDefault.SubjectDisplayWidth < 50)
     2375            dsDirCnrDefault.SubjectDisplayWidth = 0;
     2376          else if (dsDirCnrDefault.SubjectDisplayWidth > 1000)
     2377            dsDirCnrDefault.SubjectDisplayWidth = 1000;
     2378        }
     2379        else
     2380          dsDirCnrDefault.SubjectDisplayWidth = 0;
     2381        PrfWriteProfileData(fmprof,
     2382                            appname, "DirCnr.SubjectDisplayWidth",
     2383                            &dsDirCnrDefault.SubjectDisplayWidth, sizeof(ULONG));
    23842384    }
    23852385    break;
     
    24022402    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    24032403      switch (CHARMSG(&msg)->vkey) {
    2404         case VK_F3:
    2405         case VK_ENTER:
    2406         case VK_NEWLINE:
    2407           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    2408           return 0;
    2409           break;
    2410         case VK_ESC:
    2411           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    2412           return 0;
    2413           break;
    2414         case VK_F1:
    2415           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    2416           return 0;
    2417           break;
     2404        case VK_F3:
     2405        case VK_ENTER:
     2406        case VK_NEWLINE:
     2407          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     2408          return 0;
     2409          break;
     2410        case VK_ESC:
     2411          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     2412          return 0;
     2413          break;
     2414        case VK_F1:
     2415          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     2416          return 0;
     2417          break;
    24182418      }
    24192419    }
     
    24632463    case CFG6_SORTDIRSLAST:
    24642464      {
    2465         BOOL temp;
    2466 
    2467         temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
    2468         if (temp) {
    2469           switch (SHORT1FROMMP(mp1)) {
    2470           case CFG6_SORTDIRSFIRST:
    2471             WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
    2472             break;
    2473           case CFG6_SORTDIRSLAST:
    2474             WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
    2475             break;
    2476           }
    2477         }
     2465        BOOL temp;
     2466
     2467        temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
     2468        if (temp) {
     2469          switch (SHORT1FROMMP(mp1)) {
     2470          case CFG6_SORTDIRSFIRST:
     2471            WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
     2472            break;
     2473          case CFG6_SORTDIRSLAST:
     2474            WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
     2475            break;
     2476          }
     2477        }
    24782478      }
    24792479      break;
     
    24962496    case IDM_HELP:
    24972497      if (hwndHelp)
    2498         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2499                    MPFROM2SHORT(HELP_CFG6, 0), MPFROMSHORT(HM_RESOURCEID));
     2498        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2499                   MPFROM2SHORT(HELP_CFG6, 0), MPFROMSHORT(HM_RESOURCEID));
    25002500      break;
    25012501    }
     
    25392539  case WM_INITDLG:
    25402540    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETTEXTLIMIT,
    2541                       MPFROMSHORT(8), MPVOID);
     2541                      MPFROMSHORT(8), MPVOID);
    25422542    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_OVERRIDESETLIMITS,
    2543                       MPFROMLONG(1000), MPFROMLONG(50));
     2543                      MPFROMLONG(1000), MPFROMLONG(50));
    25442544    WinSendDlgItemMsg(hwnd, CFG5_FILTER, EM_SETTEXTLIMIT,
    2545                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     2545                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    25462546    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    25472547    break;
     
    25542554    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    25552555      switch (CHARMSG(&msg)->vkey) {
    2556         case VK_F3:
    2557         case VK_ENTER:
    2558         case VK_NEWLINE:
    2559           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    2560           return 0;
    2561           break;
    2562         case VK_ESC:
    2563           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    2564           return 0;
    2565           break;
    2566         case VK_F1:
    2567           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    2568           return 0;
    2569           break;
     2556        case VK_F3:
     2557        case VK_ENTER:
     2558        case VK_NEWLINE:
     2559          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     2560          return 0;
     2561          break;
     2562        case VK_ESC:
     2563          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     2564          return 0;
     2565          break;
     2566        case VK_F1:
     2567          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     2568          return 0;
     2569          break;
    25702570      }
    25712571    }
     
    25832583
    25842584      if (!PrfQueryProfileData(fmprof,
    2585                                appname,
    2586                                "CollectorflWindowAttr", &flWindowAttr, &ulSize))
    2587         flWindowAttr = (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI | CV_FLOW);
     2585                               appname,
     2586                               "CollectorflWindowAttr", &flWindowAttr, &ulSize))
     2587        flWindowAttr = (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI | CV_FLOW);
    25882588      if (flWindowAttr & CV_ICON)
    2589         WinCheckButton(hwnd, CFG5_ICON, TRUE);
     2589        WinCheckButton(hwnd, CFG5_ICON, TRUE);
    25902590      if (flWindowAttr & CV_NAME)
    2591         WinCheckButton(hwnd, CFG5_NAME, TRUE);
     2591        WinCheckButton(hwnd, CFG5_NAME, TRUE);
    25922592      if (flWindowAttr & CV_TEXT)
    2593         WinCheckButton(hwnd, CFG5_TEXT, TRUE);
     2593        WinCheckButton(hwnd, CFG5_TEXT, TRUE);
    25942594      if (flWindowAttr & CV_DETAIL)
    2595         WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
     2595        WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
    25962596      if (flWindowAttr & CV_MINI)
    2597         WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
     2597        WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
    25982598      if (flWindowAttr & CA_DETAILSVIEWTITLES)
    2599         WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
     2599        WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
    26002600      memset(&mask, 0, sizeof(mask));
    26012601      mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2602         FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2602        FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    26032603      ulSize = sizeof(MASK);
    26042604      if (PrfQueryProfileData(fmprof,
    2605                               appname, "CollectorFilter", &mask, &ulSize)) {
    2606         SetMask(NULL, &mask);
     2605                              appname, "CollectorFilter", &mask, &ulSize)) {
     2606        SetMask(NULL, &mask);
    26072607      }
    26082608      if (!mask.attrFile)
    2609         mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2610           FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2609        mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
     2610          FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    26112611      strcpy(mask.prompt, GetPString(IDS_DEFCOLFILTERTITLETEXT));
    26122612      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    26322632      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, ds.fSubjectLengthMax);
    26332633      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    2634                         MPFROMLONG(ds.SubjectDisplayWidth), MPVOID);
     2634                        MPFROMLONG(ds.SubjectDisplayWidth), MPVOID);
    26352635
    26362636    }
     
    26392639  case UM_SETUP5:
    26402640    if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc,
    2641                   FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
     2641                  FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
    26422642      SetMask(NULL, &mask);
    26432643      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    26502650      switch (SHORT2FROMMP(mp1)) {
    26512651      case EN_SETFOCUS:
    2652         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    2653         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    2654         break;
     2652        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     2653        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     2654        break;
    26552655      }
    26562656      break;
     
    26732673    case IDM_HELP:
    26742674      if (hwndHelp)
    2675         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2676                    MPFROM2SHORT(HELP_CFG7, 0), MPFROMSHORT(HM_RESOURCEID));
     2675        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2676                   MPFROM2SHORT(HELP_CFG7, 0), MPFROMSHORT(HM_RESOURCEID));
    26772677      break;
    26782678    }
     
    26812681  case WM_CLOSE:
    26822682    fExternalCollector = WinQueryButtonCheckstate(hwnd,
    2683                                                   CFG5_EXTERNALCOLLECTOR);
     2683                                                  CFG5_EXTERNALCOLLECTOR);
    26842684    PrfWriteProfileData(fmprof, FM3Str, "ExternalCollector",
    2685                         &fExternalCollector, sizeof(BOOL));
     2685                        &fExternalCollector, sizeof(BOOL));
    26862686    {
    26872687      ULONG flWindowAttr = 0;
    26882688
    26892689      if (WinQueryButtonCheckstate(hwnd, CFG5_ICON))
    2690         flWindowAttr |= CV_ICON;
     2690        flWindowAttr |= CV_ICON;
    26912691      if (WinQueryButtonCheckstate(hwnd, CFG5_NAME))
    2692         flWindowAttr |= CV_NAME;
     2692        flWindowAttr |= CV_NAME;
    26932693      if (WinQueryButtonCheckstate(hwnd, CFG5_TEXT))
    2694         flWindowAttr |= CV_TEXT;
     2694        flWindowAttr |= CV_TEXT;
    26952695      if (WinQueryButtonCheckstate(hwnd, CFG5_DETAIL))
    2696         flWindowAttr |= CV_DETAIL;
     2696        flWindowAttr |= CV_DETAIL;
    26972697      if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS))
    2698         flWindowAttr |= CV_MINI;
     2698        flWindowAttr |= CV_MINI;
    26992699      if (WinQueryButtonCheckstate(hwnd, CFG5_SHOWTITLES))
    2700         flWindowAttr |= CA_DETAILSVIEWTITLES;
     2700        flWindowAttr |= CA_DETAILSVIEWTITLES;
    27012701      flWindowAttr |= CV_FLOW;
    27022702      PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    2703                           &flWindowAttr, sizeof(ULONG));
     2703                          &flWindowAttr, sizeof(ULONG));
    27042704    }
    27052705    {
     
    27092709      ds.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
    27102710      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLongname",
    2711                           &ds.detailslongname, sizeof(BOOL));
     2711                          &ds.detailslongname, sizeof(BOOL));
    27122712      ds.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    27132713      PrfWriteProfileData(fmprof, appname, "Collector.DetailsSubject",
    2714                           &ds.detailssubject, sizeof(BOOL));
     2714                          &ds.detailssubject, sizeof(BOOL));
    27152715      ds.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWEAS);
    27162716      PrfWriteProfileData(fmprof, appname, "Collector.DetailsEA",
    2717                           &ds.detailsea, sizeof(BOOL));
     2717                          &ds.detailsea, sizeof(BOOL));
    27182718      ds.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
    27192719      PrfWriteProfileData(fmprof, appname, "Collector.DetailsSize",
    2720                           &ds.detailssize, sizeof(BOOL));
     2720                          &ds.detailssize, sizeof(BOOL));
    27212721      ds.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
    27222722      PrfWriteProfileData(fmprof, appname, "Collector.DetailsIcon",
    2723                           &ds.detailsicon, sizeof(BOOL));
     2723                          &ds.detailsicon, sizeof(BOOL));
    27242724      ds.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
    27252725      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWDate",
    2726                           &ds.detailslwdate, sizeof(BOOL));
     2726                          &ds.detailslwdate, sizeof(BOOL));
    27272727      ds.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
    27282728      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWTime",
    2729                           &ds.detailslwtime, sizeof(BOOL));
     2729                          &ds.detailslwtime, sizeof(BOOL));
    27302730      ds.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
    27312731      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLADate",
    2732                           &ds.detailsladate, sizeof(BOOL));
     2732                          &ds.detailsladate, sizeof(BOOL));
    27332733      ds.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
    27342734      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLATime",
    2735                           &ds.detailslatime, sizeof(BOOL));
     2735                          &ds.detailslatime, sizeof(BOOL));
    27362736      ds.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
    27372737      PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRDate",
    2738                           &ds.detailscrdate, sizeof(BOOL));
     2738                          &ds.detailscrdate, sizeof(BOOL));
    27392739      ds.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
    27402740      PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRTime",
    2741                           &ds.detailscrtime, sizeof(BOOL));
     2741                          &ds.detailscrtime, sizeof(BOOL));
    27422742      ds.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    27432743      PrfWriteProfileData(fmprof, appname, "Collector.DetailsAttr",
    2744                           &ds.detailsattr, sizeof(BOOL));
     2744                          &ds.detailsattr, sizeof(BOOL));
    27452745      ds.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    27462746      PrfWriteProfileData(fmprof, appname, "Collector.SubjectInLeftPane",
    2747                           &ds.fSubjectInLeftPane, sizeof(BOOL));
     2747                          &ds.fSubjectInLeftPane, sizeof(BOOL));
    27482748      ds.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    27492749      PrfWriteProfileData(fmprof, appname, "Collector.SubjectLengthMax",
    2750                           &ds.fSubjectLengthMax, sizeof(BOOL));
     2750                          &ds.fSubjectLengthMax, sizeof(BOOL));
    27512751      *mask.prompt = 0;
    27522752      PrfWriteProfileData(fmprof,
    2753                           appname, "CollectorFilter", &mask, sizeof(MASK));
     2753                          appname, "CollectorFilter", &mask, sizeof(MASK));
    27542754      {
    2755         if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
    2756           WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
    2757                             MPFROMP(&ds.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    2758           if (ds.SubjectDisplayWidth < 50)
    2759             ds.SubjectDisplayWidth = 0;
    2760           else if (ds.SubjectDisplayWidth > 1000)
    2761             ds.SubjectDisplayWidth = 1000;
    2762         }
    2763         else
    2764           ds.SubjectDisplayWidth = 0;
    2765         PrfWriteProfileData(fmprof,
    2766                             appname, "Collector.SubjectDisplayWidth",
    2767                             &ds.SubjectDisplayWidth, sizeof(ULONG));
     2755        if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
     2756          WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
     2757                            MPFROMP(&ds.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     2758          if (ds.SubjectDisplayWidth < 50)
     2759            ds.SubjectDisplayWidth = 0;
     2760          else if (ds.SubjectDisplayWidth > 1000)
     2761            ds.SubjectDisplayWidth = 1000;
     2762        }
     2763        else
     2764          ds.SubjectDisplayWidth = 0;
     2765        PrfWriteProfileData(fmprof,
     2766                            appname, "Collector.SubjectDisplayWidth",
     2767                            &ds.SubjectDisplayWidth, sizeof(ULONG));
    27682768      }
    27692769    }
     
    27872787    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    27882788      switch (CHARMSG(&msg)->vkey) {
    2789         case VK_F3:
    2790         case VK_ENTER:
    2791         case VK_NEWLINE:
    2792           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    2793           return 0;
    2794           break;
    2795         case VK_ESC:
    2796           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    2797           return 0;
    2798           break;
    2799         case VK_F1:
    2800           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    2801           return 0;
    2802           break;
     2789        case VK_F3:
     2790        case VK_ENTER:
     2791        case VK_NEWLINE:
     2792          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     2793          return 0;
     2794          break;
     2795        case VK_ESC:
     2796          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     2797          return 0;
     2798          break;
     2799        case VK_F1:
     2800          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     2801          return 0;
     2802          break;
    28032803      }
    28042804    }
     
    28482848    case CFG6_SORTDIRSLAST:
    28492849      {
    2850         BOOL temp;
    2851 
    2852         temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
    2853         if (temp) {
    2854           switch (SHORT1FROMMP(mp1)) {
    2855           case CFG6_SORTDIRSFIRST:
    2856             WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
    2857             break;
    2858           case CFG6_SORTDIRSLAST:
    2859             WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
    2860             break;
    2861           }
    2862         }
     2850        BOOL temp;
     2851
     2852        temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
     2853        if (temp) {
     2854          switch (SHORT1FROMMP(mp1)) {
     2855          case CFG6_SORTDIRSFIRST:
     2856            WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
     2857            break;
     2858          case CFG6_SORTDIRSLAST:
     2859            WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
     2860            break;
     2861          }
     2862        }
    28632863      }
    28642864      break;
     
    28812881    case IDM_HELP:
    28822882      if (hwndHelp)
    2883         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2884                    MPFROM2SHORT(HELP_CFG8, 0), MPFROMSHORT(HM_RESOURCEID));
     2883        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2884                   MPFROM2SHORT(HELP_CFG8, 0), MPFROMSHORT(HM_RESOURCEID));
    28852885      break;
    28862886    }
     
    29122912      CollectorsortFlags |= SORT_REVERSE;
    29132913    PrfWriteProfileData(fmprof,
    2914                         appname,
    2915                         "CollectorSort", &CollectorsortFlags, sizeof(INT));
     2914                        appname,
     2915                        "CollectorSort", &CollectorsortFlags, sizeof(INT));
    29162916    break;
    29172917  }
     
    29322932    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    29332933      switch (CHARMSG(&msg)->vkey) {
    2934         case VK_F3:
    2935         case VK_ENTER:
    2936         case VK_NEWLINE:
    2937           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    2938           return 0;
    2939           break;
    2940         case VK_ESC:
    2941           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    2942           return 0;
    2943           break;
    2944         case VK_F1:
    2945           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    2946           return 0;
    2947           break;
     2934        case VK_F3:
     2935        case VK_ENTER:
     2936        case VK_NEWLINE:
     2937          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     2938          return 0;
     2939          break;
     2940        case VK_ESC:
     2941          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     2942          return 0;
     2943          break;
     2944        case VK_F1:
     2945          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     2946          return 0;
     2947          break;
    29482948      }
    29492949    }
     
    29542954    case IDM_HELP:
    29552955      if (hwndHelp)
    2956         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2957                    MPFROM2SHORT(HELP_CFG9, 0), MPFROMSHORT(HM_RESOURCEID));
     2956        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2957                   MPFROM2SHORT(HELP_CFG9, 0), MPFROMSHORT(HM_RESOURCEID));
    29582958      return 0;
    29592959    case CFG9_MAXIMUMUI:
    29602960      if (hwndMain) {
    2961         if (MenuInvisible)
    2962           WinSendMsg(hwndMain, WM_COMMAND,
    2963                      MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    2964         if (!fAutoView)
    2965           WinSendMsg(hwndMain, WM_COMMAND,
    2966                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    2967         if (!fDrivebar)
    2968           WinSendMsg(hwndMain, WM_COMMAND,
    2969                      MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
    2970         if (!fToolbar)
    2971           WinSendMsg(hwndMain, WM_COMMAND,
    2972                      MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    2973         if (!fMoreButtons)
    2974           WinSendMsg(hwndMain, WM_COMMAND,
    2975                      MPFROM2SHORT(IDM_MOREBUTTONS, 0), MPVOID);
    2976         if (!fUserComboBox)
    2977           WinSendMsg(hwndMain, WM_COMMAND,
    2978                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     2961        if (MenuInvisible)
     2962          WinSendMsg(hwndMain, WM_COMMAND,
     2963                     MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
     2964        if (!fAutoView)
     2965          WinSendMsg(hwndMain, WM_COMMAND,
     2966                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     2967        if (!fDrivebar)
     2968          WinSendMsg(hwndMain, WM_COMMAND,
     2969                     MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
     2970        if (!fToolbar)
     2971          WinSendMsg(hwndMain, WM_COMMAND,
     2972                     MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
     2973        if (!fMoreButtons)
     2974          WinSendMsg(hwndMain, WM_COMMAND,
     2975                     MPFROM2SHORT(IDM_MOREBUTTONS, 0), MPVOID);
     2976        if (!fUserComboBox)
     2977          WinSendMsg(hwndMain, WM_COMMAND,
     2978                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    29792979      }
    29802980      return 0;
    29812981    case CFG9_MINIMUMUI:
    29822982      if (hwndMain) {
    2983         if (!MenuInvisible)
    2984           WinSendMsg(hwndMain, WM_COMMAND,
    2985                      MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    2986         if (fAutoView)
    2987           WinSendMsg(hwndMain, WM_COMMAND,
    2988                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    2989         if (fToolbar)
    2990           WinSendMsg(hwndMain, WM_COMMAND,
    2991                      MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    2992         if (fMoreButtons)
    2993           WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
    2994                      MPVOID);
    2995         if (fUserComboBox)
    2996           WinSendMsg(hwndMain, WM_COMMAND,
    2997                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    2998         saymsg(MB_ENTER | MB_ICONASTERISK,
    2999                hwnd,
    3000                GetPString(IDS_DONTFORGETTEXT),
    3001                GetPString(IDS_UNHIDEMENUWARNTEXT));
     2983        if (!MenuInvisible)
     2984          WinSendMsg(hwndMain, WM_COMMAND,
     2985                     MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
     2986        if (fAutoView)
     2987          WinSendMsg(hwndMain, WM_COMMAND,
     2988                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     2989        if (fToolbar)
     2990          WinSendMsg(hwndMain, WM_COMMAND,
     2991                     MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
     2992        if (fMoreButtons)
     2993          WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
     2994                     MPVOID);
     2995        if (fUserComboBox)
     2996          WinSendMsg(hwndMain, WM_COMMAND,
     2997                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     2998        saymsg(MB_ENTER | MB_ICONASTERISK,
     2999               hwnd,
     3000               GetPString(IDS_DONTFORGETTEXT),
     3001               GetPString(IDS_UNHIDEMENUWARNTEXT));
    30023002      }
    30033003      return 0;
     
    30133013      fDragndropDlg = TRUE;
    30143014      {
    3015         ULONG flWindowAttr;
    3016 
    3017         flWindowAttr = CV_DETAIL | CV_FLOW | CA_DETAILSVIEWTITLES;
    3018         PrfWriteProfileData(fmprof,
    3019                             appname,
    3020                             "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
    3021         PrfWriteProfileData(fmprof,
    3022                             appname,
    3023                             "CollectorflWindowAttr",
    3024                             &flWindowAttr, sizeof(ULONG));
    3025         PrfWriteProfileData(fmprof,
    3026                             appname, "Collector.Fontnamesize", NULL, 0);
     3015        ULONG flWindowAttr;
     3016
     3017        flWindowAttr = CV_DETAIL | CV_FLOW | CA_DETAILSVIEWTITLES;
     3018        PrfWriteProfileData(fmprof,
     3019                            appname,
     3020                            "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
     3021        PrfWriteProfileData(fmprof,
     3022                            appname,
     3023                            "CollectorflWindowAttr",
     3024                            &flWindowAttr, sizeof(ULONG));
     3025        PrfWriteProfileData(fmprof,
     3026                            appname, "Collector.Fontnamesize", NULL, 0);
    30273027      }
    30283028      dsDirCnrDefault.detailslongname = TRUE;
     
    30403040      if (hwndTree) {
    30413041
    3042         CNRINFO cnri;
    3043         ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
    3044 
    3045         memset(&cnri, 0, sizeof(cnri));
    3046         cnri.cb = sizeof(cnri);
    3047         WinSendMsg(WinWindowFromID
    3048                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3049                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3050         cnri.flWindowAttr = flWindowAttr;
    3051         WinSendMsg(WinWindowFromID
    3052                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3053                    CM_SETCNRINFO, MPFROMP(&cnri),
    3054                    MPFROMLONG(CMA_FLWINDOWATTR));
     3042        CNRINFO cnri;
     3043        ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
     3044
     3045        memset(&cnri, 0, sizeof(cnri));
     3046        cnri.cb = sizeof(cnri);
     3047        WinSendMsg(WinWindowFromID
     3048                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3049                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3050        cnri.flWindowAttr = flWindowAttr;
     3051        WinSendMsg(WinWindowFromID
     3052                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3053                   CM_SETCNRINFO, MPFROMP(&cnri),
     3054                   MPFROMLONG(CMA_FLWINDOWATTR));
    30553055      }
    30563056      break;
     
    30673067      fDragndropDlg = TRUE;
    30683068      {
    3069         ULONG flWindowAttr;
    3070 
    3071         flWindowAttr = CV_DETAIL | CV_FLOW | CV_MINI;
    3072         PrfWriteProfileData(fmprof,
    3073                             appname,
    3074                             "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
    3075         PrfWriteProfileData(fmprof,
    3076                             appname,
    3077                             "CollectorflWindowAttr",
    3078                             &flWindowAttr, sizeof(ULONG));
    3079         //fixme to allow user to change presparams 1-10-09 GKY
    3080         PrfWriteProfileData(fmprof,
    3081                             appname,
    3082                             "Collector.Fontnamesize",
    3083                             FNT_8HELVETICA,
    3084                             strlen(FNT_8HELVETICA) + 1);
     3069        ULONG flWindowAttr;
     3070
     3071        flWindowAttr = CV_DETAIL | CV_FLOW | CV_MINI;
     3072        PrfWriteProfileData(fmprof,
     3073                            appname,
     3074                            "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
     3075        PrfWriteProfileData(fmprof,
     3076                            appname,
     3077                            "CollectorflWindowAttr",
     3078                            &flWindowAttr, sizeof(ULONG));
     3079        //fixme to allow user to change presparams 1-10-09 GKY
     3080        PrfWriteProfileData(fmprof,
     3081                            appname,
     3082                            "Collector.Fontnamesize",
     3083                            FNT_8HELVETICA,
     3084                            strlen(FNT_8HELVETICA) + 1);
    30853085      }
    30863086      dsDirCnrDefault.detailslongname = TRUE;
     
    30983098      if (hwndTree) {
    30993099
    3100         CNRINFO cnri;
    3101         ULONG flWindowAttr = CV_TREE | CV_MINI | CV_TEXT |
    3102           CV_FLOW | CA_TREELINE;
    3103 
    3104         memset(&cnri, 0, sizeof(cnri));
    3105         cnri.cb = sizeof(cnri);
    3106         WinSendMsg(WinWindowFromID
    3107                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3108                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3109         cnri.flWindowAttr = flWindowAttr;
    3110         WinSendMsg(WinWindowFromID
    3111                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3112                    CM_SETCNRINFO, MPFROMP(&cnri),
    3113                    MPFROMLONG(CMA_FLWINDOWATTR));
     3100        CNRINFO cnri;
     3101        ULONG flWindowAttr = CV_TREE | CV_MINI | CV_TEXT |
     3102          CV_FLOW | CA_TREELINE;
     3103
     3104        memset(&cnri, 0, sizeof(cnri));
     3105        cnri.cb = sizeof(cnri);
     3106        WinSendMsg(WinWindowFromID
     3107                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3108                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3109        cnri.flWindowAttr = flWindowAttr;
     3110        WinSendMsg(WinWindowFromID
     3111                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3112                   CM_SETCNRINFO, MPFROMP(&cnri),
     3113                   MPFROMLONG(CMA_FLWINDOWATTR));
    31143114      }
    31153115      break;
    31163116    case CFG9_MAXFILENAMES:
    31173117      if (hwndMain && fAutoView)
    3118         WinSendMsg(hwndMain, WM_COMMAND,
    3119                    MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     3118        WinSendMsg(hwndMain, WM_COMMAND,
     3119                   MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    31203120      fForceUpper = FALSE;
    31213121      fForceLower = TRUE;
     
    31293129      fNoIconsDirs = TRUE;
    31303130      {
    3131         ULONG flWindowAttr;
    3132 
    3133         flWindowAttr = CV_TEXT | CV_FLOW;
    3134         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3135                             &flWindowAttr, sizeof(ULONG));
    3136         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3137                             &flWindowAttr, sizeof(ULONG));
    3138         //fixme to allow user to change presparams 1-10-09 GKY
    3139         PrfWriteProfileData(fmprof, appname, "Collector.Fontnamesize",
    3140                             FNT_8HELVETICA,
    3141                             strlen(FNT_8HELVETICA) + 1);
     3131        ULONG flWindowAttr;
     3132
     3133        flWindowAttr = CV_TEXT | CV_FLOW;
     3134        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3135                            &flWindowAttr, sizeof(ULONG));
     3136        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3137                            &flWindowAttr, sizeof(ULONG));
     3138        //fixme to allow user to change presparams 1-10-09 GKY
     3139        PrfWriteProfileData(fmprof, appname, "Collector.Fontnamesize",
     3140                            FNT_8HELVETICA,
     3141                            strlen(FNT_8HELVETICA) + 1);
    31423142      }
    31433143      if (hwndTree) {
    31443144
    3145         CNRINFO cnri;
    3146         ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
    3147 
    3148         memset(&cnri, 0, sizeof(cnri));
    3149         cnri.cb = sizeof(cnri);
    3150         WinSendMsg(WinWindowFromID
    3151                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3152                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3153         cnri.flWindowAttr = flWindowAttr;
    3154         WinSendMsg(WinWindowFromID
    3155                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3156                    CM_SETCNRINFO, MPFROMP(&cnri),
    3157                    MPFROMLONG(CMA_FLWINDOWATTR));
     3145        CNRINFO cnri;
     3146        ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
     3147
     3148        memset(&cnri, 0, sizeof(cnri));
     3149        cnri.cb = sizeof(cnri);
     3150        WinSendMsg(WinWindowFromID
     3151                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3152                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3153        cnri.flWindowAttr = flWindowAttr;
     3154        WinSendMsg(WinWindowFromID
     3155                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3156                   CM_SETCNRINFO, MPFROMP(&cnri),
     3157                   MPFROMLONG(CMA_FLWINDOWATTR));
    31583158      }
    31593159      break;
     
    32253225      fNoTreeGap = TRUE;
    32263226      {
    3227         ULONG flWindowAttr;
    3228 
    3229         flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
    3230         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3231                             &flWindowAttr, sizeof(ULONG));
    3232         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3233                             &flWindowAttr, sizeof(ULONG));
     3227        ULONG flWindowAttr;
     3228
     3229        flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
     3230        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3231                            &flWindowAttr, sizeof(ULONG));
     3232        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3233                            &flWindowAttr, sizeof(ULONG));
    32343234      }
    32353235      dsDirCnrDefault.detailslongname = FALSE;
     
    32493249      if (hwndMain) {
    32503250
    3251         SWP swp;
    3252 
    3253         if (WinQueryWindowPos(hwndMain, &swp)) {
    3254           WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3255                           swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
    3256         }
    3257         if (MenuInvisible)
    3258           WinSendMsg(hwndMain, WM_COMMAND,
    3259                      MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    3260         if (fAutoView)
    3261           WinSendMsg(hwndMain, WM_COMMAND,
    3262                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    3263         if (fToolbar)
    3264           WinSendMsg(hwndMain, WM_COMMAND,
    3265                      MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    3266         if (!fDrivebar)
    3267           WinSendMsg(hwndMain, WM_COMMAND,
    3268                      MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
    3269         if (!fMoreButtons)
    3270           WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
    3271                      MPVOID);
    3272         if (!fUserComboBox)
    3273           WinSendMsg(hwndMain, WM_COMMAND,
    3274                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     3251        SWP swp;
     3252
     3253        if (WinQueryWindowPos(hwndMain, &swp)) {
     3254          WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3255                          swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
     3256        }
     3257        if (MenuInvisible)
     3258          WinSendMsg(hwndMain, WM_COMMAND,
     3259                     MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
     3260        if (fAutoView)
     3261          WinSendMsg(hwndMain, WM_COMMAND,
     3262                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     3263        if (fToolbar)
     3264          WinSendMsg(hwndMain, WM_COMMAND,
     3265                     MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
     3266        if (!fDrivebar)
     3267          WinSendMsg(hwndMain, WM_COMMAND,
     3268                     MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
     3269        if (!fMoreButtons)
     3270          WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
     3271                     MPVOID);
     3272        if (!fUserComboBox)
     3273          WinSendMsg(hwndMain, WM_COMMAND,
     3274                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    32753275      }
    32763276      if (hwndTree) {
    32773277
    3278         CNRINFO cnri;
    3279         ULONG flWindowAttr = (CV_TREE | CV_TEXT | CV_MINI |
    3280                               CV_FLOW | CA_TREELINE);
    3281 
    3282         memset(&cnri, 0, sizeof(cnri));
    3283         cnri.cb = sizeof(cnri);
    3284         WinSendMsg(WinWindowFromID
    3285                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3286                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3287         cnri.flWindowAttr = flWindowAttr;
    3288         WinSendMsg(WinWindowFromID
    3289                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3290                    CM_SETCNRINFO, MPFROMP(&cnri),
    3291                    MPFROMLONG(CMA_FLWINDOWATTR));
     3278        CNRINFO cnri;
     3279        ULONG flWindowAttr = (CV_TREE | CV_TEXT | CV_MINI |
     3280                              CV_FLOW | CA_TREELINE);
     3281
     3282        memset(&cnri, 0, sizeof(cnri));
     3283        cnri.cb = sizeof(cnri);
     3284        WinSendMsg(WinWindowFromID
     3285                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3286                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3287        cnri.flWindowAttr = flWindowAttr;
     3288        WinSendMsg(WinWindowFromID
     3289                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3290                   CM_SETCNRINFO, MPFROMP(&cnri),
     3291                   MPFROMLONG(CMA_FLWINDOWATTR));
    32923292      }
    32933293      break;
     
    33423342      fNoTreeGap = FALSE;
    33433343      {
    3344         ULONG flWindowAttr;
    3345 
    3346         flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
    3347         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3348                             &flWindowAttr, sizeof(ULONG));
    3349         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3350                             &flWindowAttr, sizeof(ULONG));
     3344        ULONG flWindowAttr;
     3345
     3346        flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
     3347        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3348                            &flWindowAttr, sizeof(ULONG));
     3349        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3350                            &flWindowAttr, sizeof(ULONG));
    33513351      }
    33523352      dsDirCnrDefault.detailslongname = FALSE;
     
    33663366      if (hwndMain) {
    33673367
    3368         SWP swp;
    3369 
    3370         if (WinQueryWindowPos(hwndMain, &swp)) {
    3371           WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3372                           swp.cx / 5,
    3373                           swp.cy -
    3374                           (WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2),
    3375                           SWP_MOVE | SWP_SIZE);
    3376         }
     3368        SWP swp;
     3369
     3370        if (WinQueryWindowPos(hwndMain, &swp)) {
     3371          WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3372                          swp.cx / 5,
     3373                          swp.cy -
     3374                          (WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2),
     3375                          SWP_MOVE | SWP_SIZE);
     3376        }
    33773377      }
    33783378      if (hwndTree) {
    33793379
    3380         CNRINFO cnri;
    3381         ULONG flWindowAttr = (CV_TREE | CV_TEXT |
    3382                               CV_FLOW | CA_TREELINE | CV_MINI);
    3383 
    3384         memset(&cnri, 0, sizeof(cnri));
    3385         cnri.cb = sizeof(cnri);
    3386         WinSendMsg(WinWindowFromID
    3387                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3388                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3389         cnri.flWindowAttr = flWindowAttr;
    3390         WinSendMsg(WinWindowFromID
    3391                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3392                    CM_SETCNRINFO, MPFROMP(&cnri),
    3393                    MPFROMLONG(CMA_FLWINDOWATTR));
     3380        CNRINFO cnri;
     3381        ULONG flWindowAttr = (CV_TREE | CV_TEXT |
     3382                              CV_FLOW | CA_TREELINE | CV_MINI);
     3383
     3384        memset(&cnri, 0, sizeof(cnri));
     3385        cnri.cb = sizeof(cnri);
     3386        WinSendMsg(WinWindowFromID
     3387                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3388                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3389        cnri.flWindowAttr = flWindowAttr;
     3390        WinSendMsg(WinWindowFromID
     3391                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3392                   CM_SETCNRINFO, MPFROMP(&cnri),
     3393                   MPFROMLONG(CMA_FLWINDOWATTR));
    33943394      }
    33953395      break;
     
    34063406      fDCOpens = FALSE;
    34073407      {
    3408         ULONG flWindowAttr;
    3409 
    3410         flWindowAttr = CV_NAME | CV_FLOW | CA_DETAILSVIEWTITLES;
    3411         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3412                             &flWindowAttr, sizeof(ULONG));
    3413         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3414                             &flWindowAttr, sizeof(ULONG));
     3408        ULONG flWindowAttr;
     3409
     3410        flWindowAttr = CV_NAME | CV_FLOW | CA_DETAILSVIEWTITLES;
     3411        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3412                            &flWindowAttr, sizeof(ULONG));
     3413        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3414                            &flWindowAttr, sizeof(ULONG));
    34153415      }
    34163416      fLinkSetsIcon = FALSE;
     
    34233423      fUserListSwitches = TRUE;
    34243424      WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), UM_UNDO, MPVOID,
    3425                 MPVOID);
     3425                MPVOID);
    34263426      if (hwndTree) {
    34273427
    3428         CNRINFO cnri;
    3429         ULONG flWindowAttr = CV_TREE | CV_MINI | CV_ICON |
    3430           CV_FLOW | CA_TREELINE;
    3431 
    3432         memset(&cnri, 0, sizeof(cnri));
    3433         cnri.cb = sizeof(cnri);
    3434         WinSendMsg(WinWindowFromID
    3435                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3436                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3437         cnri.flWindowAttr = flWindowAttr;
    3438         WinSendMsg(WinWindowFromID
    3439                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3440                    CM_SETCNRINFO, MPFROMP(&cnri),
    3441                    MPFROMLONG(CMA_FLWINDOWATTR));
     3428        CNRINFO cnri;
     3429        ULONG flWindowAttr = CV_TREE | CV_MINI | CV_ICON |
     3430          CV_FLOW | CA_TREELINE;
     3431
     3432        memset(&cnri, 0, sizeof(cnri));
     3433        cnri.cb = sizeof(cnri);
     3434        WinSendMsg(WinWindowFromID
     3435                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3436                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3437        cnri.flWindowAttr = flWindowAttr;
     3438        WinSendMsg(WinWindowFromID
     3439                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3440                   CM_SETCNRINFO, MPFROMP(&cnri),
     3441                   MPFROMLONG(CMA_FLWINDOWATTR));
    34423442      }
    34433443      if (hwndMain) {
    3444         if (fAutoView)
    3445           WinSendMsg(hwndMain, WM_COMMAND,
    3446                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    3447         if (!fDrivebar)
    3448           WinSendMsg(hwndMain, WM_COMMAND,
    3449                      MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
    3450         {
    3451           SWP swp;
    3452 
    3453           if (WinQueryWindowPos(hwndMain, &swp)) {
    3454             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3455                             swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
    3456           }
    3457         }
    3458         PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
    3459         PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID);
     3444        if (fAutoView)
     3445          WinSendMsg(hwndMain, WM_COMMAND,
     3446                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     3447        if (!fDrivebar)
     3448          WinSendMsg(hwndMain, WM_COMMAND,
     3449                     MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
     3450        {
     3451          SWP swp;
     3452
     3453          if (WinQueryWindowPos(hwndMain, &swp)) {
     3454            WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3455                            swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
     3456          }
     3457        }
     3458        PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
     3459        PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID);
    34603460      }
    34613461      return 0;
     
    34713471      fTopDir = FALSE;
    34723472      if (hwndMain) {
    3473         if (!fTextTools)
    3474           WinSendMsg(hwndMain, WM_COMMAND,
    3475                      MPFROM2SHORT(IDM_TEXTTOOLS, 0), MPVOID);
     3473        if (!fTextTools)
     3474          WinSendMsg(hwndMain, WM_COMMAND,
     3475                     MPFROM2SHORT(IDM_TEXTTOOLS, 0), MPVOID);
    34763476      }
    34773477      {
    3478         ULONG flWindowAttr;
    3479 
    3480         flWindowAttr = CV_TEXT | CV_FLOW | CA_DETAILSVIEWTITLES;
    3481         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3482                             &flWindowAttr, sizeof(ULONG));
    3483         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3484                             &flWindowAttr, sizeof(ULONG));
     3478        ULONG flWindowAttr;
     3479
     3480        flWindowAttr = CV_TEXT | CV_FLOW | CA_DETAILSVIEWTITLES;
     3481        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3482                            &flWindowAttr, sizeof(ULONG));
     3483        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3484                            &flWindowAttr, sizeof(ULONG));
    34853485      }
    34863486      if (hwndTree) {
    34873487
    3488         CNRINFO cnri;
    3489         ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
    3490 
    3491         memset(&cnri, 0, sizeof(cnri));
    3492         cnri.cb = sizeof(cnri);
    3493         WinSendMsg(WinWindowFromID
    3494                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3495                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3496         cnri.flWindowAttr = flWindowAttr;
    3497         WinSendMsg(WinWindowFromID
    3498                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3499                    CM_SETCNRINFO, MPFROMP(&cnri),
    3500                    MPFROMLONG(CMA_FLWINDOWATTR));
     3488        CNRINFO cnri;
     3489        ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
     3490
     3491        memset(&cnri, 0, sizeof(cnri));
     3492        cnri.cb = sizeof(cnri);
     3493        WinSendMsg(WinWindowFromID
     3494                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3495                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3496        cnri.flWindowAttr = flWindowAttr;
     3497        WinSendMsg(WinWindowFromID
     3498                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3499                   CM_SETCNRINFO, MPFROMP(&cnri),
     3500                   MPFROMLONG(CMA_FLWINDOWATTR));
    35013501      }
    35023502      /* intentional fallthru */
    35033503    case CFG9_1X:
    35043504      if (SHORT1FROMMP(mp1) == CFG9_1X) {
    3505         fTileBackwards = FALSE;
    3506         ulCnrType = CCS_MULTIPLESEL | CCS_EXTENDSEL;
    3507         fSwitchTree = FALSE;
    3508         fSwitchTreeOnFocus = FALSE;
    3509         fSwitchTreeExpand = FALSE;
    3510         fCollapseFirst = FALSE;
    3511         fFollowTree = FALSE;
    3512         fNoSearch = TRUE;
     3505        fTileBackwards = FALSE;
     3506        ulCnrType = CCS_MULTIPLESEL | CCS_EXTENDSEL;
     3507        fSwitchTree = FALSE;
     3508        fSwitchTreeOnFocus = FALSE;
     3509        fSwitchTreeExpand = FALSE;
     3510        fCollapseFirst = FALSE;
     3511        fFollowTree = FALSE;
     3512        fNoSearch = TRUE;
    35133513      }
    35143514      fAutoTile = TRUE;
     
    35243524      fUserListSwitches = TRUE;
    35253525      WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), UM_UNDO, MPVOID,
    3526                 MPVOID);
     3526                MPVOID);
    35273527      if (hwndTree) {
    35283528
    3529         CNRINFO cnri;
    3530         ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
    3531 
    3532         memset(&cnri, 0, sizeof(cnri));
    3533         cnri.cb = sizeof(cnri);
    3534         WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
    3535                                    TREE_CNR),
    3536                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3537         cnri.flWindowAttr = flWindowAttr;
    3538         WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
    3539                                    TREE_CNR),
    3540                    CM_SETCNRINFO,
    3541                    MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
     3529        CNRINFO cnri;
     3530        ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
     3531
     3532        memset(&cnri, 0, sizeof(cnri));
     3533        cnri.cb = sizeof(cnri);
     3534        WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
     3535                                   TREE_CNR),
     3536                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3537        cnri.flWindowAttr = flWindowAttr;
     3538        WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
     3539                                   TREE_CNR),
     3540                   CM_SETCNRINFO,
     3541                   MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
    35423542      }
    35433543      if (hwndMain) {
    3544         if (fAutoView)
    3545           WinSendMsg(hwndMain, WM_COMMAND,
    3546                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    3547         if (fUserComboBox)
    3548           WinSendMsg(hwndMain, WM_COMMAND,
    3549                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    3550         {
    3551           SWP swp;
    3552 
    3553           if (WinQueryWindowPos(hwndMain, &swp)) {
    3554             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3555                             swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
    3556           }
    3557         }
    3558         PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
    3559         PostMsg(MainObjectHwnd, UM_SETDIR, MPVOID, MPVOID);
     3544        if (fAutoView)
     3545          WinSendMsg(hwndMain, WM_COMMAND,
     3546                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     3547        if (fUserComboBox)
     3548          WinSendMsg(hwndMain, WM_COMMAND,
     3549                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     3550        {
     3551          SWP swp;
     3552
     3553          if (WinQueryWindowPos(hwndMain, &swp)) {
     3554            WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3555                            swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
     3556          }
     3557        }
     3558        PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
     3559        PostMsg(MainObjectHwnd, UM_SETDIR, MPVOID, MPVOID);
    35603560      }
    35613561      return 0;
     
    35733573    // Save new details settings and refresh windows
    35743574    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    3575                         &dsDirCnrDefault.detailslongname, sizeof(BOOL));
     3575                        &dsDirCnrDefault.detailslongname, sizeof(BOOL));
    35763576    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    3577                         &dsDirCnrDefault.detailssubject, sizeof(BOOL));
     3577                        &dsDirCnrDefault.detailssubject, sizeof(BOOL));
    35783578    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    3579                         &dsDirCnrDefault.detailsea, sizeof(BOOL));
     3579                        &dsDirCnrDefault.detailsea, sizeof(BOOL));
    35803580    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    3581                         &dsDirCnrDefault.detailssize, sizeof(BOOL));
     3581                        &dsDirCnrDefault.detailssize, sizeof(BOOL));
    35823582    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    3583                         &dsDirCnrDefault.detailsicon, sizeof(BOOL));
     3583                        &dsDirCnrDefault.detailsicon, sizeof(BOOL));
    35843584    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    3585                         &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
     3585                        &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
    35863586    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    3587                         &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
     3587                        &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
    35883588    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    3589                         &dsDirCnrDefault.detailsladate, sizeof(BOOL));
     3589                        &dsDirCnrDefault.detailsladate, sizeof(BOOL));
    35903590    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    3591                         &dsDirCnrDefault.detailslatime, sizeof(BOOL));
     3591                        &dsDirCnrDefault.detailslatime, sizeof(BOOL));
    35923592    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    3593                         &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
     3593                        &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
    35943594    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    3595                         &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
     3595                        &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
    35963596    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    3597                         &dsDirCnrDefault.detailsattr, sizeof(BOOL));
     3597                        &dsDirCnrDefault.detailsattr, sizeof(BOOL));
    35983598    if (hwndMain) {
    35993599      // Save state and restore to refresh windows with new settings
    36003600      if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {
    3601         // Tell window procedure to close container windows
    3602         PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
    3603         // Restore saved state
    3604         PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);
     3601        // Tell window procedure to close container windows
     3602        PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
     3603        // Restore saved state
     3604        PostMsg(MainObjectHwnd, UM_RESTORE, (PSZ)GetPString(IDS_FM2TEMPTEXT), MPVOID);
    36053605      }
    36063606    }
    36073607    WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER),
    3608                UM_UNDO, MPVOID, MPVOID);
     3608               UM_UNDO, MPVOID, MPVOID);
    36093609    return 0;
    36103610
     
    36643664      haccelCfg = WinLoadAccelTable(hab, FM3ModHandle, CFG_FRAME);
    36653665      if (haccelCfg == NULLHANDLE)
    3666         Win_Error(hwndNotebook, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
     3666        Win_Error(hwndNotebook, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
    36673667    }
    36683668    if (haccelCfg != NULLHANDLE) {
    36693669      if (!WinSetAccelTable(hab, haccelCfg, hwndNotebook))
    3670         Win_Error(hwndNotebook, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
     3670        Win_Error(hwndNotebook, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
    36713671      // else
    3672         // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
     3672        // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
    36733673    }
    36743674
     
    36793679      hwndTemp = WinQueryWindow(hwnd, QW_OWNER);
    36803680      if (hwndTemp != HWND_DESKTOP) {
    3681         HWND hwndMenu;
    3682         // Owner is frame if not applet
    3683         hwndMenu = WinWindowFromID(hwndTemp, FID_MENU);
    3684         if (hwndMenu == NULLHANDLE)
    3685           Runtime_Error(pszSrcFile, __LINE__, "FID_MENU");
    3686         else {
    3687           MENUITEM mi;
    3688           BOOL ok;
    3689           memset(&mi, 0, sizeof(mi));
    3690           ok = (BOOL)WinSendMsg(hwndMenu,
    3691                                 MM_QUERYITEM,
    3692                                 MPFROM2SHORT(IDM_NOTEBOOKSUBMENU, TRUE),
    3693                                 MPFROMP(&mi));
    3694           if (!ok)
    3695             Runtime_Error(pszSrcFile, __LINE__, "IDM_NOTEBOOKSUBMENU");
    3696           else {
    3697             mp2 = WinSendMsg(mi.hwndSubMenu, MM_QUERYDEFAULTITEMID, MPVOID, MPVOID);
    3698             //if (!mp2) // causes spurious error message on new installs GKY 1-9-09
    3699             //  mp2 = MPFROMLONG(IDM_QUICKSETTINGS);
    3700               //Runtime_Error(pszSrcFile, __LINE__, "MM_QUERYDEFAULTITEMID");
    3701           }
    3702         }
     3681        HWND hwndMenu;
     3682        // Owner is frame if not applet
     3683        hwndMenu = WinWindowFromID(hwndTemp, FID_MENU);
     3684        if (hwndMenu == NULLHANDLE)
     3685          Runtime_Error(pszSrcFile, __LINE__, "FID_MENU");
     3686        else {
     3687          MENUITEM mi;
     3688          BOOL ok;
     3689          memset(&mi, 0, sizeof(mi));
     3690          ok = (BOOL)WinSendMsg(hwndMenu,
     3691                                MM_QUERYITEM,
     3692                                MPFROM2SHORT(IDM_NOTEBOOKSUBMENU, TRUE),
     3693                                MPFROMP(&mi));
     3694          if (!ok)
     3695            Runtime_Error(pszSrcFile, __LINE__, "IDM_NOTEBOOKSUBMENU");
     3696          else {
     3697            mp2 = WinSendMsg(mi.hwndSubMenu, MM_QUERYDEFAULTITEMID, MPVOID, MPVOID);
     3698            //if (!mp2) // causes spurious error message on new installs GKY 1-9-09
     3699            //  mp2 = MPFROMLONG(IDM_QUICKSETTINGS);
     3700              //Runtime_Error(pszSrcFile, __LINE__, "MM_QUERYDEFAULTITEMID");
     3701          }
     3702        }
    37033703      }
    37043704    }
     
    37063706    PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    37073707    WinSendDlgItemMsg(hwnd,
    3708                       CFG_NOTEBOOK,
    3709                       BKM_SETDIMENSIONS,
    3710                       MPFROM2SHORT(82, 24), MPFROMLONG(BKA_MAJORTAB));
     3708                      CFG_NOTEBOOK,
     3709                      BKM_SETDIMENSIONS,
     3710                      MPFROM2SHORT(82, 24), MPFROMLONG(BKA_MAJORTAB));
    37113711    WinSendDlgItemMsg(hwnd,
    3712                       CFG_NOTEBOOK,
    3713                       BKM_SETDIMENSIONS,
    3714                       MPFROM2SHORT(20, 20), MPFROMLONG(BKA_PAGEBUTTON));
     3712                      CFG_NOTEBOOK,
     3713                      BKM_SETDIMENSIONS,
     3714                      MPFROM2SHORT(20, 20), MPFROMLONG(BKA_PAGEBUTTON));
    37153715    WinSendDlgItemMsg(hwnd,
    3716                       CFG_NOTEBOOK,
    3717                       BKM_SETDIMENSIONS,
    3718                       MPFROM2SHORT(0, 0), MPFROMLONG(BKA_MINORTAB));
     3716                      CFG_NOTEBOOK,
     3717                      BKM_SETDIMENSIONS,
     3718                      MPFROM2SHORT(0, 0), MPFROMLONG(BKA_MINORTAB));
    37193719
    37203720    // Build and insert notebook pages
    37213721    for (x = 0; np[x].usFrameId; x++) {
    37223722      hwndTemp = WinLoadDlg(HWND_DESKTOP,
    3723                             HWND_DESKTOP,
    3724                             np[x].pfnPageProc, FM3ModHandle, np[x].usFrameId, MPVOID);
     3723                            HWND_DESKTOP,
     3724                            np[x].pfnPageProc, FM3ModHandle, np[x].usFrameId, MPVOID);
    37253725      if (!hwndTemp) {
    3726         Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    3727                   "Can not load settings page %u", x);
     3726        Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
     3727                  "Can not load settings page %u", x);
    37283728      }
    37293729      else {
    3730         WinSetWindowULong(hwndTemp, QWL_USER, (ULONG)hwnd);
    3731         np[x].hwnd = hwndTemp;
    3732         np[x].ulPageId = (ULONG)WinSendDlgItemMsg(hwnd,
    3733                                                 CFG_NOTEBOOK,
    3734                                                 BKM_INSERTPAGE,
    3735                                                 MPFROMLONG(BKA_FIRST),
    3736                                                 MPFROM2SHORT(BKA_AUTOPAGESIZE |
    3737                                                              BKA_STATUSTEXTON |
    3738                                                              BKA_MAJOR, attrib));
    3739         attrib = BKA_LAST;
    3740         WinSendDlgItemMsg(hwnd,
    3741                           CFG_NOTEBOOK,
    3742                           BKM_SETPAGEWINDOWHWND,
    3743                           MPFROMLONG(np[x].ulPageId), MPFROMLONG(np[x].hwnd));
    3744         WinSendDlgItemMsg(hwnd,
    3745                           CFG_NOTEBOOK,
    3746                           BKM_SETTABTEXT,
    3747                           MPFROMLONG(np[x].ulPageId),
    3748                           MPFROMP(GetPString(np[x].ulTitle)));
    3749         WinSendDlgItemMsg(hwnd,
    3750                           CFG_NOTEBOOK,
    3751                           BKM_SETSTATUSLINETEXT,
    3752                           MPFROMLONG(np[x].ulPageId),
    3753                           MPFROMP(GetPString(np[x].ulTitle + 1)));
    3754 
    3755         if (LONGFROMMP(mp2) == np[x].usMenuId)
    3756           uPageIndex = x;               // Remember selected page
     3730        WinSetWindowULong(hwndTemp, QWL_USER, (ULONG)hwnd);
     3731        np[x].hwnd = hwndTemp;
     3732        np[x].ulPageId = (ULONG)WinSendDlgItemMsg(hwnd,
     3733                                                CFG_NOTEBOOK,
     3734                                                BKM_INSERTPAGE,
     3735                                                MPFROMLONG(BKA_FIRST),
     3736                                                MPFROM2SHORT(BKA_AUTOPAGESIZE |
     3737                                                             BKA_STATUSTEXTON |
     3738                                                             BKA_MAJOR, attrib));
     3739        attrib = BKA_LAST;
     3740        WinSendDlgItemMsg(hwnd,
     3741                          CFG_NOTEBOOK,
     3742                          BKM_SETPAGEWINDOWHWND,
     3743                          MPFROMLONG(np[x].ulPageId), MPFROMLONG(np[x].hwnd));
     3744        WinSendDlgItemMsg(hwnd,
     3745                          CFG_NOTEBOOK,
     3746                          BKM_SETTABTEXT,
     3747                          MPFROMLONG(np[x].ulPageId),
     3748                          MPFROMP(GetPString(np[x].ulTitle)));
     3749        WinSendDlgItemMsg(hwnd,
     3750                          CFG_NOTEBOOK,
     3751                          BKM_SETSTATUSLINETEXT,
     3752                          MPFROMLONG(np[x].ulPageId),
     3753                          MPFROMP(GetPString(np[x].ulTitle + 1)));
     3754
     3755        if (LONGFROMMP(mp2) == np[x].usMenuId)
     3756          uPageIndex = x;               // Remember selected page
    37573757      }
    37583758    } // for pages
     
    37633763    // 15 Feb 08 SHL fixme to do just once?
    37643764    if (mp2 == MPFROMLONG(IDM_QUICKSETTINGS) &&
    3765         x-- > 0 &&
    3766         np[x].hwnd &&
    3767         np[x].usFrameId == CFG9_FRAME)
     3765        x-- > 0 &&
     3766        np[x].hwnd &&
     3767        np[x].usFrameId == CFG9_FRAME)
    37683768    {
    37693769      // 10 Jan 08 SHL fixme to document what UM_SETDIR 1 means
    37703770      //PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1), MPVOID);
    37713771      PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
    3772               BKM_TURNTOPAGE, MPFROMLONG(np[x].ulPageId), MPVOID);
     3772              BKM_TURNTOPAGE, MPFROMLONG(np[x].ulPageId), MPVOID);
    37733773      PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(np[x].hwnd), MPVOID);
    37743774      PostMsg(np[x].hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
     
    37763776    else if (uPageIndex >= x) {
    37773777      Runtime_Error(pszSrcFile, __LINE__, "uPageIndex corrupted (%u)",
    3778                     uPageIndex);
     3778                    uPageIndex);
    37793779      uPageIndex = 0;
    37803780    }
    37813781    PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
    3782             BKM_TURNTOPAGE, MPFROMLONG(np[uPageIndex].ulPageId), MPVOID);
     3782            BKM_TURNTOPAGE, MPFROMLONG(np[uPageIndex].ulPageId), MPVOID);
    37833783    // 15 Feb 08 SHL fixme to put focus on first field of page
    37843784
     
    38023802    if (CHARMSG(&msg)->fs & KC_VIRTUALKEY) {
    38033803      switch (CHARMSG(&msg)->vkey) {
    3804         case VK_F3:
    3805         case VK_ENTER:
    3806         case VK_NEWLINE:
    3807           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
    3808           return 0;
    3809           break;
    3810         case VK_ESC:
    3811           PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
    3812           return 0;
    3813           break;
    3814         case VK_F1:
    3815           PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
    3816           return 0;
    3817           break;
     3804        case VK_F3:
     3805        case VK_ENTER:
     3806        case VK_NEWLINE:
     3807          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_OK, MPVOID);
     3808          return 0;
     3809          break;
     3810        case VK_ESC:
     3811          PostMsg(hwnd, WM_COMMAND, (MPARAM)DID_CANCEL, MPVOID);
     3812          return 0;
     3813          break;
     3814        case VK_F1:
     3815          PostMsg(hwnd, WM_COMMAND, (MPARAM)IDM_HELP, MPVOID);
     3816          return 0;
     3817          break;
    38183818      }
    38193819    }
     
    38313831      SaveLastPageIndex(hwnd);
    38323832      ulPageId = (ULONG) WinSendDlgItemMsg(hwnd,
    3833                                         CFG_NOTEBOOK,
    3834                                         BKM_QUERYPAGEID,
    3835                                         MPFROMLONG(0),
    3836                                         MPFROM2SHORT(BKA_TOP, 0));
     3833                                        CFG_NOTEBOOK,
     3834                                        BKM_QUERYPAGEID,
     3835                                        MPFROMLONG(0),
     3836                                        MPFROM2SHORT(BKA_TOP, 0));
    38373837      hwndTemp = (HWND) WinSendDlgItemMsg(hwnd,
    3838                                           CFG_NOTEBOOK,
    3839                                           BKM_QUERYPAGEWINDOWHWND,
    3840                                           MPFROMLONG(ulPageId), MPVOID);
     3838                                          CFG_NOTEBOOK,
     3839                                          BKM_QUERYPAGEWINDOWHWND,
     3840                                          MPFROMLONG(ulPageId), MPVOID);
    38413841      if (hwndTemp)
    3842         WinSendMsg(hwndTemp, UM_UNDO, MPVOID, MPVOID);
     3842        WinSendMsg(hwndTemp, UM_UNDO, MPVOID, MPVOID);
    38433843
    38443844      WinDismissDlg(hwnd, 0);
     
    38473847    case IDM_HELP:                      /* relay message to appropriate page's window */
    38483848      ulPageId = (ULONG) WinSendDlgItemMsg(hwnd,
    3849                                         CFG_NOTEBOOK,
    3850                                         BKM_QUERYPAGEID,
    3851                                         MPFROMLONG(0),
    3852                                         MPFROM2SHORT(BKA_TOP, 0));
     3849                                        CFG_NOTEBOOK,
     3850                                        BKM_QUERYPAGEID,
     3851                                        MPFROMLONG(0),
     3852                                        MPFROM2SHORT(BKA_TOP, 0));
    38533853      hwndTemp = (HWND) WinSendDlgItemMsg(hwnd,
    3854                                           CFG_NOTEBOOK,
    3855                                           BKM_QUERYPAGEWINDOWHWND,
    3856                                           MPFROMLONG(ulPageId), MPVOID);
     3854                                          CFG_NOTEBOOK,
     3855                                          BKM_QUERYPAGEWINDOWHWND,
     3856                                          MPFROMLONG(ulPageId), MPVOID);
    38573857      if (hwndTemp)
    3858         PostMsg(hwndTemp, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
     3858        PostMsg(hwndTemp, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
    38593859      break;
    38603860    }
     
    38643864    for (x = 0; np[x].usFrameId; x++) {
    38653865      if (np[x].hwnd)
    3866         WinSendMsg(np[x].hwnd, UM_UNDO, MPVOID, MPVOID);
     3866        WinSendMsg(np[x].hwnd, UM_UNDO, MPVOID, MPVOID);
    38673867    }
    38683868    break;
     
    38713871    if (np[0].usFrameId) {
    38723872      for (x = 1; np[x].usFrameId; x++) {
    3873         if (np[x].hwnd) {
    3874           WinSendMsg(np[x].hwnd, WM_CLOSE, MPVOID, MPVOID);
    3875           np[x].hwnd = (HWND) 0;
    3876           np[x].ulPageId = 0;
    3877         }
     3873        if (np[x].hwnd) {
     3874          WinSendMsg(np[x].hwnd, WM_CLOSE, MPVOID, MPVOID);
     3875          np[x].hwnd = (HWND) 0;
     3876          np[x].ulPageId = 0;
     3877        }
    38783878      }
    38793879      WinSendMsg(np[0].hwnd, WM_CLOSE, MPVOID, MPVOID);
     
    39083908  if (fIsLite) {
    39093909    WinSendMsg(hwndMenu,
    3910                MM_DELETEITEM,
    3911                MPFROM2SHORT(IDM_QUICKSETTINGS, FALSE), MPVOID);
     3910               MM_DELETEITEM,
     3911               MPFROM2SHORT(IDM_QUICKSETTINGS, FALSE), MPVOID);
    39123912    // If fm/2 lite drop quick setting page
    39133913    for (x = 0; np[x].usFrameId && np[x].usFrameId != CFG9_FRAME; x++)
     
    39283928  if (hwndOwner != HWND_DESKTOP) {
    39293929    ulPageId = (ULONG)WinSendDlgItemMsg(hwnd,
    3930                                        CFG_NOTEBOOK,
    3931                                        BKM_QUERYPAGEID,
    3932                                        MPFROMLONG(0),
    3933                                        MPFROM2SHORT(BKA_TOP, 0));
     3930                                       CFG_NOTEBOOK,
     3931                                       BKM_QUERYPAGEID,
     3932                                       MPFROMLONG(0),
     3933                                       MPFROM2SHORT(BKA_TOP, 0));
    39343934    if (!ulPageId)
    39353935      Runtime_Error(pszSrcFile, __LINE__, "BKM_QUERYPAGEID");
    39363936    else {
    39373937      for (x = 0; np[x].usMenuId && np[x].ulPageId != ulPageId; x++)
    3938         ; // Scan
     3938        ; // Scan
    39393939      if (!np[x].usMenuId)
    3940         Runtime_Error(pszSrcFile, __LINE__, "bad menu id %lu", ulPageId);
     3940        Runtime_Error(pszSrcFile, __LINE__, "bad menu id %lu", ulPageId);
    39413941      else {
    3942         PrfWriteProfileData(fmprof, FM3Str, pszIK_LastSettingsPage,
    3943                             (PVOID)&x, sizeof(x));
    3944         hwndMenu = WinWindowFromID(hwndOwner, FID_MENU);
    3945         SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[x].usMenuId);
     3942        PrfWriteProfileData(fmprof, FM3Str, pszIK_LastSettingsPage,
     3943                            (PVOID)&x, sizeof(x));
     3944        hwndMenu = WinWindowFromID(hwndOwner, FID_MENU);
     3945        SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[x].usMenuId);
    39463946      }
    39473947    }
  • trunk/dll/notify.c

    r1391 r1394  
    66
    77  Copyright (c) 1993-98 M. Kimes
    8   Copyright (c) 2006, 2008 Steven H.Levine
     8  Copyright (c) 2006, 2009 Steven H.Levine
    99
    1010  17 Jul 06 SHL Use Win_Error
     
    8585        rgb2F.bRed = (BYTE)65;
    8686        rgb2.bRed = rgb2.bGreen = rgb2.bBlue = (BYTE)255;
    87         rgb2.fcOptions = 0;
    88         //fixme to allow user to change presparams 1-10-09 GKY
     87        rgb2.fcOptions = 0;
     88        //fixme to allow user to change presparams 1-10-09 GKY
    8989        SetPresParams(hwnd, &rgb2, &rgb2F, &rgb2, FNT_8HELVETICA);
    9090        if (hwndMain) {
     
    163163 */
    164164
    165 HWND DoNotify(char *str)
     165HWND DoNotify(PCSZ str)
    166166{
    167167  char *p;
     
    197197      p = xmalloc(strlen(str) + 2, pszSrcFile, __LINE__);
    198198      if (!p)
    199         p = str;
     199        p = (PSZ)str;
    200200      else {
    201201        strcpy(p + 1, str);
     
    204204    }
    205205    else
    206       p = str;
     206      p = (PSZ)str;
    207207
    208208    hwnd = WinCreateWindow(hwndP,
     
    229229 */
    230230
    231 HWND Notify(char *str)
     231HWND Notify(PCSZ str)
    232232{
    233233  return (HWND)WinSendMsg(MainObjectHwnd, UM_NOTIFY, MPFROMP(str), MPVOID);
     
    238238 */
    239239
    240 VOID NotifyError(CHAR * filename, APIRET status)
     240VOID NotifyError(PCSZ filename, APIRET status)
    241241{
    242242  CHAR errortext[512];
     
    495495 */
    496496
    497 BOOL AddNote(CHAR * note)
    498 {
    499   CHAR *s, *p;
     497BOOL AddNote(PCSZ note)
     498{
     499  PSZ s;
     500  PCSZ p;
    500501  BOOL once = FALSE, ret = FALSE;
    501502
  • trunk/dll/notify.h

    r1211 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  05 Sep 08 JBS Ticket 187: Refactor FM3DLL.H
     
    1717#define NOTIFY_H
    1818
    19 BOOL AddNote(CHAR * note);
    20 HWND DoNotify(char *text);
     19BOOL AddNote(PCSZ note);
     20HWND DoNotify(PCSZ text);
    2121VOID EndNote(VOID);
    2222VOID HideNote(VOID);
    23 HWND Notify(char *text);
    24 VOID NotifyError(CHAR * filename, APIRET error);
     23HWND Notify(PCSZ text);
     24VOID NotifyError(PCSZ filename, APIRET error);
    2525MRESULT EXPENTRY NotifyWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
    2626VOID ShowNote(VOID);
  • trunk/dll/objcnr.c

    r1335 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2005, 2008 Steven H. Levine
     9  Copyright (c) 2005, 2009 Steven H. Levine
    1010
    1111  24 May 05 SHL Rework for CNRITEM.szSubject
     
    329329      cnri.cyLineSpacing = 0;
    330330      cnri.cxTreeIndent = 12L;
    331       cnri.pszCnrTitle = GetPString(IDS_WORKINGTEXT);
     331      cnri.pszCnrTitle = (PSZ)GetPString(IDS_WORKINGTEXT);
    332332      cnri.flWindowAttr = CV_TREE | CV_FLOW |
    333333        CA_CONTAINERTITLE | CA_TITLESEPARATOR | CA_TREELINE;
  • trunk/dll/pathutil.c

    r1323 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  05 Jan 08 SHL Move from arccnrs.c and comp.c to here
     
    1313  29 Feb 08 GKY Changes to enable user settable command line length
    1414  15 Oct 08 GKY Fix NormalizeCmdLine to check all 5 executible extensions when no extension provided;
    15                 use searchapath to check for existance of file types not checked by DosQAppType;
    16                 close DosFind.
     15                use searchapath to check for existance of file types not checked by DosQAppType;
     16                close DosFind.
    1717
    1818***********************************************************************/
     
    9898 */
    9999
    100 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName)
     100PSZ BldQuotedFileName(PSZ pszQuotedFileName, PCSZ pszFileName)
    101101{
    102102  BOOL q = needs_quoting(pszFileName);
     
    184184               pszCmdLine_);
    185185      if (!offsetexe && !offsetcom) {
    186         FullPath = searchapath("PATH", szCmdLine);
    187         if (*FullPath)
    188           ret = 0;
     186        FullPath = searchapath("PATH", szCmdLine);
     187        if (*FullPath)
     188          ret = 0;
    189189      }
    190190      else
     
    193193      //printf("%d A", ret); fflush(stdout);
    194194      if (ret) {
    195         ret = saymsg(MB_YESNO,
    196                      HWND_DESKTOP,
    197                      NullStr,
    198                      GetPString(IDS_PROGRAMNOTFOUNDTEXT),
    199                      pszCmdLine_);
    200         if (ret == MBID_YES){
    201           if (szArgs[0] != ' ')
    202             strcat(pszNewCmdLine, " ");
    203           strcat(pszNewCmdLine, szArgs);
    204       }
    205         else{
    206           fCancelAction = TRUE;
    207           pszNewCmdLine = pszCmdLine_;
    208         }
     195        ret = saymsg(MB_YESNO,
     196                     HWND_DESKTOP,
     197                     NullStr,
     198                     GetPString(IDS_PROGRAMNOTFOUNDTEXT),
     199                     pszCmdLine_);
     200        if (ret == MBID_YES){
     201          if (szArgs[0] != ' ')
     202            strcat(pszNewCmdLine, " ");
     203          strcat(pszNewCmdLine, szArgs);
     204      }
     205        else{
     206          fCancelAction = TRUE;
     207          pszNewCmdLine = pszCmdLine_;
     208        }
    209209      }
    210210      else{
    211         if (szArgs[0] != ' ')
    212           strcat(pszNewCmdLine, " ");
    213         strcat(pszNewCmdLine, szArgs);
     211        if (szArgs[0] != ' ')
     212          strcat(pszNewCmdLine, " ");
     213        strcat(pszNewCmdLine, szArgs);
    214214      }
    215215
     
    219219                           strrchr(szCmdLine, '.' ) < strrchr(szCmdLine, '\\'))) {
    220220      if (!strchr(szCmdLine, ' ')) {
    221         // strip quotes readded by BuildQuotedFileName
     221        // strip quotes readded by BuildQuotedFileName
    222222        while (strchr(szCmdLine, '\"'))
    223223          remove_first_occurence_of_character("\"", szCmdLine);
    224         ret = DosQueryAppType(szCmdLine, &ulAppType); // exe automatically appended
    225         if (!ret)
    226           strcat(szCmdLine, ".exe");
    227         else {
    228           strcat(szCmdLine, ".com");
    229           ret = DosQueryAppType(szCmdLine, &ulAppType);
    230           if (ret) {
    231             offset = strrchr(szCmdLine, '.' );
    232             *offset = 0;
    233             strcat(szCmdLine, ".cmd");
    234             FullPath = searchapath("PATH", szCmdLine);
    235             if (*FullPath)
    236               ret = 0;
    237             else {
    238               *offset = 0;
    239               strcat(szCmdLine, ".bat");
    240               FullPath = searchapath("PATH", szCmdLine);
    241               if (*FullPath)
    242                 ret = 0;
    243               else {
    244                 *offset = 0;
    245                 strcat(szCmdLine, ".bmt");
    246                 FullPath = searchapath("PATH", szCmdLine);
    247                 if (*FullPath)
    248                   ret = 0;
    249               }
    250             }
    251           }
    252         }
     224        ret = DosQueryAppType(szCmdLine, &ulAppType); // exe automatically appended
     225        if (!ret)
     226          strcat(szCmdLine, ".exe");
     227        else {
     228          strcat(szCmdLine, ".com");
     229          ret = DosQueryAppType(szCmdLine, &ulAppType);
     230          if (ret) {
     231            offset = strrchr(szCmdLine, '.' );
     232            *offset = 0;
     233            strcat(szCmdLine, ".cmd");
     234            FullPath = searchapath("PATH", szCmdLine);
     235            if (*FullPath)
     236              ret = 0;
     237            else {
     238              *offset = 0;
     239              strcat(szCmdLine, ".bat");
     240              FullPath = searchapath("PATH", szCmdLine);
     241              if (*FullPath)
     242                ret = 0;
     243              else {
     244                *offset = 0;
     245                strcat(szCmdLine, ".bmt");
     246                FullPath = searchapath("PATH", szCmdLine);
     247                if (*FullPath)
     248                  ret = 0;
     249              }
     250            }
     251          }
     252        }
    253253        //printf("%d", ret); fflush(stdout);
    254254      }
     
    260260          if (*pszChar == ' ') { //test at every space for the end of the filename
    261261            *pszChar = '\0';
    262             ret = DosQueryAppType(szCmdLine, &ulAppType);
    263             if (!ret) {
    264               strcat(szCmdLine, ".exe");
    265               break;
    266             }
    267             else {
    268               strcat(szCmdLine, ".com");
    269               ret = DosQueryAppType(szCmdLine, &ulAppType);
    270               if (ret) {
    271                 offset = strrchr(szCmdLine, '.' );
    272                 *offset = 0;
    273                 strcat(szCmdLine, ".cmd");
    274                 FullPath = searchapath("PATH", szCmdLine);
    275                 if (*FullPath) {
    276                   ret = 0;
    277                   break;
    278                 }
    279                 else {
    280                   *offset = 0;
    281                   strcat(szCmdLine, ".bat");
    282                   FullPath = searchapath("PATH", szCmdLine);
    283                   if (*FullPath) {
    284                     ret = 0;
    285                     break;
    286                   }
    287                   else {
    288                     *offset = 0;
    289                     strcat(szCmdLine, ".bmt");
    290                     FullPath = searchapath("PATH", szCmdLine);
    291                     if (*FullPath) {
    292                       ret = 0;
    293                       break;
    294                     }
    295                   }
    296                 }
    297               }
    298               else
    299                 break;
    300             }
     262            ret = DosQueryAppType(szCmdLine, &ulAppType);
     263            if (!ret) {
     264              strcat(szCmdLine, ".exe");
     265              break;
     266            }
     267            else {
     268              strcat(szCmdLine, ".com");
     269              ret = DosQueryAppType(szCmdLine, &ulAppType);
     270              if (ret) {
     271                offset = strrchr(szCmdLine, '.' );
     272                *offset = 0;
     273                strcat(szCmdLine, ".cmd");
     274                FullPath = searchapath("PATH", szCmdLine);
     275                if (*FullPath) {
     276                  ret = 0;
     277                  break;
     278                }
     279                else {
     280                  *offset = 0;
     281                  strcat(szCmdLine, ".bat");
     282                  FullPath = searchapath("PATH", szCmdLine);
     283                  if (*FullPath) {
     284                    ret = 0;
     285                    break;
     286                  }
     287                  else {
     288                    *offset = 0;
     289                    strcat(szCmdLine, ".bmt");
     290                    FullPath = searchapath("PATH", szCmdLine);
     291                    if (*FullPath) {
     292                      ret = 0;
     293                      break;
     294                    }
     295                  }
     296                }
     297              }
     298              else
     299                break;
     300            }
    301301            //printf("%d %s\n", ret, szCmdLine); fflush(stdout);
    302302          }
     
    306306      }
    307307      if (!ret){
    308         BldQuotedFileName(pszNewCmdLine, szCmdLine);
    309         strcpy(szArgs, pszCmdLine_ + strlen(szCmdLine) - 3);
    310         if ((szArgs[0] == '\"' && szArgs[1] == ' ') ||
    311              !strstr(pszCmdLine_, "\\:" ) ||
    312              strchr(szArgs, '\"') == strrchr(szArgs, '\"'))
    313           remove_first_occurence_of_character("\"", szArgs);
    314         if (strchr(szArgs, '\"') != strrchr(szArgs, '\"'))
    315           saymsg(MB_OK, HWND_DESKTOP,
    316                 NullStr,
    317                 GetPString(IDS_QUOTESINARGSTEXT),
    318                 pszCmdLine_);
    319         if (szArgs[0] != ' ')
    320           strcat(pszNewCmdLine, " ");
    321         strcat(pszNewCmdLine, szArgs);
     308        BldQuotedFileName(pszNewCmdLine, szCmdLine);
     309        strcpy(szArgs, pszCmdLine_ + strlen(szCmdLine) - 3);
     310        if ((szArgs[0] == '\"' && szArgs[1] == ' ') ||
     311             !strstr(pszCmdLine_, "\\:" ) ||
     312             strchr(szArgs, '\"') == strrchr(szArgs, '\"'))
     313          remove_first_occurence_of_character("\"", szArgs);
     314        if (strchr(szArgs, '\"') != strrchr(szArgs, '\"'))
     315          saymsg(MB_OK, HWND_DESKTOP,
     316                NullStr,
     317                GetPString(IDS_QUOTESINARGSTEXT),
     318                pszCmdLine_);
     319        if (szArgs[0] != ' ')
     320          strcat(pszNewCmdLine, " ");
     321        strcat(pszNewCmdLine, szArgs);
    322322      }
    323323      else { // fail if no extension can be found runemf2 requires one
    324         ret = saymsg(MB_OK,
    325                      HWND_DESKTOP,
    326                      NullStr,
    327                      GetPString(IDS_PROGRAMNOTEXE2TEXT),
    328                      pszCmdLine_);
    329           fCancelAction = TRUE;
    330           pszNewCmdLine = pszCmdLine_;
     324        ret = saymsg(MB_OK,
     325                     HWND_DESKTOP,
     326                     NullStr,
     327                     GetPString(IDS_PROGRAMNOTEXE2TEXT),
     328                     pszCmdLine_);
     329          fCancelAction = TRUE;
     330          pszNewCmdLine = pszCmdLine_;
    331331      }
    332332    }
     
    359359                   pszCmdLine_);
    360360      if (ret == MBID_YES) {
    361         if (szArgs[0] != ' ')
    362           strcat(pszNewCmdLine, " ");
    363         strcat(pszNewCmdLine, szArgs);
     361        if (szArgs[0] != ' ')
     362          strcat(pszNewCmdLine, " ");
     363        strcat(pszNewCmdLine, szArgs);
    364364      }
    365365      else {
     
    370370    else {
    371371      ret = saymsg(MB_YESNOCANCEL,
    372                    HWND_DESKTOP,
    373                    NullStr,
    374                    GetPString(IDS_PROGRAMNOTEXE3TEXT),
    375                    pszCmdLine_, pszNewCmdLine);
    376         if (ret == MBID_YES){
    377           if (szArgs[0] != ' ')
    378             strcat(pszNewCmdLine, " ");
    379           strcat(pszNewCmdLine, szArgs);
    380         }
    381         if (ret == MBID_CANCEL){
    382           fCancelAction = TRUE;
    383           pszNewCmdLine = pszCmdLine_;
    384         }
     372                   HWND_DESKTOP,
     373                   NullStr,
     374                   GetPString(IDS_PROGRAMNOTEXE3TEXT),
     375                   pszCmdLine_, pszNewCmdLine);
     376        if (ret == MBID_YES){
     377          if (szArgs[0] != ' ')
     378            strcat(pszNewCmdLine, " ");
     379          strcat(pszNewCmdLine, szArgs);
     380        }
     381        if (ret == MBID_CANCEL){
     382          fCancelAction = TRUE;
     383          pszNewCmdLine = pszCmdLine_;
     384        }
    385385      }
    386386    }
  • trunk/dll/pathutil.h

    r1241 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  05 Jan 08 SHL Move from fm3dll.h to here
     
    2424PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName);
    2525PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName);
    26 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName);
     26PSZ BldQuotedFileName(PSZ pszQuotedFileName, PCSZ pszFileName);
    2727PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_);
    2828
    29 #define MAXCOMLINESTRGDEFAULT (1024)                    /* used to build command line strings */
     29#define MAXCOMLINESTRGDEFAULT (1024)                    /* used to build command line strings */
    3030#define CMDLNLNGTH_MIN (299)
    3131#define CMDLNLNGTH_MAX (32768)
  • trunk/dll/remap.c

    r1226 r1394  
    55
    66  Copyright (c) 1993, 1998 M. Kimes
    7   Copyright (c) 2004, 2008 Steven H.Levine
     7  Copyright (c) 2004, 2009 Steven H.Levine
    88
    99  01 Aug 04 SHL Rework lstrip/rstrip usage
     
    427427            pgd.progt.progc = PROG_WINDOWABLEVIO;
    428428            pgd.progt.fbVisible = SHE_VISIBLE;
    429             pgd.pszTitle = (info->attach) ? GetPString(IDS_ATTACHREQTEXT) :
    430               GetPString(IDS_DETACHREQTEXT);
     429            pgd.pszTitle = info->attach ? (PSZ)GetPString(IDS_ATTACHREQTEXT) :
     430                                          (PSZ)GetPString(IDS_DETACHREQTEXT);
    431431            pgd.pszExecutable = p;
    432432            pgd.pszParameters = params;
     
    543543                pgd.progt.progc = PROG_WINDOWABLEVIO;
    544544                pgd.progt.fbVisible = SHE_VISIBLE;
    545                 pgd.pszTitle = GetPString(IDS_DETACHREQTEXT);
     545                pgd.pszTitle = (PSZ)GetPString(IDS_DETACHREQTEXT);
    546546                pgd.pszExecutable = p;
    547547                pgd.pszParameters = params;
     
    648648              pgd.progt.progc = PROG_WINDOWABLEVIO;
    649649              pgd.progt.fbVisible = SHE_VISIBLE;
    650               pgd.pszTitle = GetPString(IDS_ATTACHREQTEXT);
     650              pgd.pszTitle = (PSZ)GetPString(IDS_ATTACHREQTEXT);
    651651              pgd.pszExecutable = p;
    652652              pgd.pszParameters = params;
  • trunk/dll/seeall.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    612612      case IDM_RENAME:
    613613        {
    614           CHAR newname[CCHMAXPATH], *moving, *move, *moved;
     614          CHAR newname[CCHMAXPATH];
     615          PCSZ moving, move, moved;
    615616          APIRET rc;
    616617          INT type;
     
    734735                             message);
    735736            if (fRealIdle)
    736               priority_idle();
    737             if (fVerify && (driveflags[toupper(*list[x]) - 'A'] & DRIVE_WRITEVERIFYOFF ||
    738                             driveflags[toupper(*newname) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
    739               DosSetVerify(FALSE);
    740               fResetVerify = TRUE;
    741             }
     737              priority_idle();
     738            if (fVerify && (driveflags[toupper(*list[x]) - 'A'] & DRIVE_WRITEVERIFYOFF ||
     739                            driveflags[toupper(*newname) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
     740              DosSetVerify(FALSE);
     741              fResetVerify = TRUE;
     742            }
    742743            if (plen) {
    743744              /* make directory/ies, if required */
     
    753754              }
    754755            }
    755             rc = docopyf(type, list[x], "%s", newname);
    756             if (fResetVerify) {
    757               DosSetVerify(fVerify);
    758               fResetVerify = FALSE;
    759             }
     756            rc = docopyf(type, list[x], "%s", newname);
     757            if (fResetVerify) {
     758              DosSetVerify(fVerify);
     759              fResetVerify = FALSE;
     760            }
    760761            priority_normal();
    761762            if (rc) {
     
    33373338        pAD->hwndPopup =
    33383339          WinLoadMenu(HWND_DESKTOP, FM3ModHandle, SEEALL_POPUP);
    3339         if (pAD->hwndPopup) {
    3340           //fixme to allow user to change presparams 1-10-09 GKY
     3340        if (pAD->hwndPopup) {
     3341          //fixme to allow user to change presparams 1-10-09 GKY
    33413342          WinSetPresParam(pAD->hwndPopup, PP_FONTNAMESIZE,
    33423343                          strlen(FNT_8HELVETICA) + 1,
  • trunk/dll/strutil.c

    r1213 r1394  
    44  $Id$
    55
    6   External strings file support
     6  External strings support - stored in STRINGTABLE
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2006, 2008 Steven H. Levine
     9  Copyright (c) 2006, 2009 Steven H. Levine
    1010
    1111  22 Jul 06 SHL Comments
    1212  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1313  05 Jan 08 SHL Rename from string.c to avoid string.h conflict
     14  03 Feb 09 SHL Switch to STRINGTABLE and const return
    1415
    1516***********************************************************************/
     
    1718#include <stdio.h>
    1819#include <share.h>
     20#include <string.h>
     21
     22#define INCL_DOSPROCESS                 // DosSleep
    1923
    2024#include "fm3dll.h"
    2125#include "fm3str.h"
    2226#include "init.h"                       // Data declaration(s)
     27#include "mainwnd.h"                    // FM3ModHandle
     28#include "wrappers.h"
     29#include "errutil.h"
    2330#include "strutil.h"
    2431#include "version.h"
    2532
    26 extern PSZ NullStr;                     // 05 Jan 08 SHL fixme to be in some .h
    27 
    28 static char **strs, *str;
    29 static ULONG numStr;
    30 
    31 //== LoadStrings() load strings from file ==
    32 
    33 BOOL LoadStrings(char *filename)
     33static PSZ pszSrcFile = __FILE__;
     34
     35//== GetPString() return a readonly pointer to the requested string in memory ==
     36
     37PCSZ GetPString(ULONG id)
    3438{
    35   BOOL ok = FALSE;
    36   ULONG size, len, totalsize;
    37   USHORT vermajor = 0, verminor = 0;
    38   register char *p;
    39   register ULONG x;
    40   FILE *fp;
    41   APIRET rc;
    42 
    43   /* Load strings from requested file or FM3RES.STR
    44    * with some quiet error-checking.
    45    * Return TRUE on success, FALSE on error.
    46    */
    47 
    48   if (!filename)
    49     filename = "FM3RES.STR";
    50   numStr = 0;
    51   if (str)
    52     DosFreeMem(str);
    53   strs = NULL;
    54   str = NULL;
    55 
    56   fp = _fsopen(filename, "rb", SH_DENYWR);
    57   if (fp) {
    58     if (fread(&numStr,
    59               sizeof(numStr),
    60               1,
    61               fp) &&
    62         numStr == IDS_NUMSTRS &&
    63         fread(&len, sizeof(len), 1, fp) &&
    64         fread(&vermajor, sizeof(vermajor), 1, fp) &&
    65         fread(&verminor, sizeof(verminor), 1, fp) &&
    66         (vermajor >= VERMAJORBREAK &&
    67          (vermajor > VERMAJORBREAK || verminor >= VERMINORBREAK))) {
    68       fseek(fp, 0, SEEK_END);
    69       size = ftell(fp) - ((sizeof(ULONG) * 2) + (sizeof(USHORT) * 2));
    70       if (size && size == len) {
    71         fseek(fp, (sizeof(ULONG) * 2) + (sizeof(USHORT) * 2), SEEK_SET);
    72         /* NOTE:  Make one memory object for both str and strs
    73          * for efficiency.
    74          */
    75         totalsize = size + sizeof(ULONG);
    76         totalsize += (totalsize % sizeof(ULONG));
    77         len = totalsize;
    78         totalsize += (numStr * sizeof(char *));
    79         totalsize += 4;
    80         rc = DosAllocMem((PPVOID) & str, totalsize,
    81                          PAG_COMMIT | PAG_READ | PAG_WRITE);
    82         if (!rc && str) {
    83           strs = (char **)(str + len);
    84           if (fread(str, 1, size, fp) == size) {
    85             p = str;
    86             for (x = 0; x < numStr; x++) {
    87               if (p - str >= size)
    88                 break;
    89               strs[x] = p;
    90               while (*p)
    91                 p++;
    92               p++;
    93             }
    94             if (x == numStr)
    95               ok = TRUE;
     39  PSZ psz;
     40  LONG l;
     41  CHAR sz[257];
     42  ULONG ulNewFirstId;
     43  ULONG ulNewLastId;
     44
     45  static PSZ *pLoadedStrings;
     46  static ULONG ulFirstId;
     47  static ULONG ulLastId;
     48
     49  // Strings that must be combined because stringtable items limited to 256
     50  static struct LongString {
     51    ULONG id;
     52    ULONG sub_id;
     53  } LongStrings[] = {
     54    {IDS_SUGGEST1TEXT, IDS_SUGGEST1TEXT1},
     55    {IDS_SUGGEST1TEXT, IDS_SUGGEST1TEXT2},
     56    {IDS_ARCHIVERBB2TEXT, IDS_ARCHIVERBB2TEXT1},
     57    {IDS_ARCHIVERBB2TEXT, IDS_ARCHIVERBB2TEXT2},
     58    {IDS_ARCHIVERBB2TEXT, IDS_ARCHIVERBB2TEXT3},
     59    {IDS_ARCHIVERBB2TEXT, IDS_ARCHIVERBB2TEXT4},
     60    {IDS_ARCHIVERBB2TEXT, IDS_ARCHIVERBB2TEXT5},
     61    {IDS_ARCHIVERBB2TEXT, IDS_ARCHIVERBB2TEXT6},
     62    {IDS_ARCHIVERBB2TEXT, IDS_ARCHIVERBB2TEXT7},
     63    {IDS_INIBINARYDATASKIPTEXT, IDS_INIBINARYDATASKIPTEXT1},
     64    {IDS_INIBINARYDATASKIPTEXT, IDS_INIBINARYDATASKIPTEXT2},
     65    {IDS_INSTANTHELPTEXT, IDS_INSTANTHELPTEXT1},
     66    {IDS_INSTANTHELPTEXT, IDS_INSTANTHELPTEXT2},
     67    {IDS_FSDERRORTEXT, IDS_FSDERRORTEXT1},
     68    {IDS_FSDERRORTEXT, IDS_FSDERRORTEXT2},
     69    {IDS_LANERRORTEXT, IDS_LANERRORTEXT1},
     70    {IDS_LANERRORTEXT, IDS_LANERRORTEXT2},
     71    {IDS_MAKESHADOWHELPTEXT, IDS_MAKESHADOWHELPTEXT1},
     72    {IDS_MAKESHADOWHELPTEXT, IDS_MAKESHADOWHELPTEXT2},
     73    {IDS_UNDELETEHELPTEXT, IDS_UNDELETEHELPTEXT1},
     74    {IDS_UNDELETEHELPTEXT, IDS_UNDELETEHELPTEXT2},
     75    {IDS_KILLPROCHELPTEXT, IDS_KILLPROCHELPTEXT1},
     76    {IDS_KILLPROCHELPTEXT, IDS_KILLPROCHELPTEXT2},
     77    {IDS_ARCNOTTHERETEXT, IDS_ARCNOTTHERETEXT1},
     78    {IDS_ARCNOTTHERETEXT, IDS_ARCNOTTHERETEXT2},
     79    {IDS_FM2CMDHELPTEXT, IDS_FM2CMDHELPTEXT1},
     80    {IDS_FM2CMDHELPTEXT, IDS_FM2CMDHELPTEXT2},
     81    {IDS_FM2CMDHELPTEXT, IDS_FM2CMDHELPTEXT3}
     82  };
     83
     84  static UINT cLongStrings = sizeof(LongStrings) / sizeof(struct LongString);
     85
     86  static volatile INT cBusy;            // Need to be MT-safe
     87  static ULONG ulDbgId;                 // 13 Jan 09 SHL fixme to be gone?
     88  static UINT uDbgState;                // 03 Feb 09 SHL fixme to be gone?
     89  static ULONG ulDbgTid;                // 13 Jan 09 SHL fixme to be gone?
     90
     91  UINT c;
     92  // 23 Jan 09 SHL fixme to use SMP safe inc/dec?
     93  extern void SMPSafeInc(void);
     94  extern void SMPSafeDec(void);
     95  #pragma aux SMPSafeInc = "lock inc cBusy" modify exact [];
     96  #pragma aux SMPSafeDec = "lock dec cBusy" modify exact [];
     97  // SMPSafeInc();
     98  for (c = 0; ; c++) {
     99    if (++cBusy == 1)
     100      break;
     101    cBusy--;
     102    // Hold off 1 cycle before reporting since some contention expected
     103    if (c == 1)
     104      DbgMsg(pszSrcFile, __LINE__, "GetPString(%lu) waiting for tid %lu GetPString(%lu), state=%u", id, ulDbgTid, ulDbgId, uDbgState);
     105    DosSleep(1);                        // Let current owner finish
     106  }
     107  if (c > 1)
     108    DbgMsg(pszSrcFile, __LINE__, "continuing with GetPString(%lu) after tid %lu GetPString(%lu), state=%u", id, ulDbgTid, ulDbgId, uDbgState);
     109
     110  // Remember id and thread ordinal for diagnosing MT hangs
     111  // Use fast DosGetInfoBlocks to ensure debug logic does not change timing
     112  {
     113    extern PTIB2 GetPTIB2(void);
     114    #pragma aux GetPTIB2 = "mov eax,fs:[12]" value [eax];
     115    // PIB *ppib;
     116    // TIB *ptib;
     117    TIB2 *ptib2 = GetPTIB2();
     118    // APIRET apiret = DosGetInfoBlocks(&ptib, &ppib);
     119    ulDbgId = id;
     120    // ulDbgTid = apiret == 0 ? ptib->tib_ptib2->tib2_ultid : 0;
     121    ulDbgTid = ptib2->tib2_ultid;
     122  }
     123
     124  // DbgMsg(pszSrcFile, __LINE__, "Fetching %lu", id);
     125
     126  // If string already loaded, return it now
     127  if (id >= ulFirstId &&
     128      id <= ulLastId &&
     129      pLoadedStrings &&
     130      (psz = pLoadedStrings[id - ulFirstId]) != NULL) {
     131    cBusy--;
     132    if (((ULONG)psz & 0xffff0000) == 0)
     133      DbgMsg(pszSrcFile, __LINE__, "id %lu corrupted %p", id, psz);
     134    // DbgMsg(pszSrcFile, __LINE__, "id %lu \"%s\"", id, psz ? psz : "(null)");
     135    return psz;
     136  }
     137
     138  // Try to load
     139  // 11 Jan 09 SHL fixme to use global HAB?
     140  uDbgState = 1;
     141  l = WinLoadString((HAB)NULL, FM3ModHandle, id, sizeof(sz), sz);
     142  uDbgState = 2;
     143
     144  if (l != 0) {
     145    psz = xstrdup(sz, pszSrcFile, __LINE__);
     146    if (!psz) {
     147      cBusy--;
     148      return NullStr;
     149    }
     150  }
     151  else {
     152    // Assume string must be built from multiple strings - find first
     153    UINT i;
     154    psz = NULL;
     155    for (i = 0; i < cLongStrings && LongStrings[i].id != id; i++);      // Scan
     156
     157    if (i < cLongStrings) {
     158      // Combine stringtable items to build long string
     159      // DbgMsg(pszSrcFile, __LINE__, "Building long string %lu", id);
     160      for (; LongStrings[i].id == id; i++) {
     161        uDbgState = 3;
     162        l = WinLoadString((HAB)NULL, FM3ModHandle, LongStrings[i].sub_id, sizeof(sz), sz);
     163        uDbgState = 4;
     164        if (l == 0) {
     165          cBusy--;
     166          Runtime_Error(pszSrcFile, __LINE__, "string %lu missing", LongStrings[i].sub_id);
     167          xfree(psz, pszSrcFile, __LINE__);
     168          return NullStr;
     169        }
     170        if (!psz) {
     171          // Remember 1st string
     172          psz = strdup(sz);
     173          if (!psz) {
     174            cBusy--;
     175            return NullStr;
    96176          }
    97           if (ok)
    98             /* set pages to readonly */
    99             DosSetMem(str, totalsize, PAG_COMMIT | PAG_READ);
    100177        }
    101       }
    102     }
    103     fclose(fp);
    104   }
    105 
    106   if (!ok) {
    107     numStr = 0;
    108     if (str)
    109       DosFreeMem(str);
    110     str = NULL;
    111     strs = NULL;
    112   }
    113 
    114   return ok;
     178        else {
     179          // Append string
     180          UINT curLen = strlen(psz);
     181          PSZ psz2 = xrealloc(psz, curLen + l + 1, pszSrcFile, __LINE__);
     182          if (!psz2) {
     183            xfree(psz, pszSrcFile, __LINE__);
     184            cBusy--;
     185            return NullStr;
     186          }
     187          memcpy(psz2 + curLen, sz, l); // Append
     188          *(psz2 + curLen + l) = 0;     // Terminate
     189          psz = psz2;                   // Remember
     190          l += curLen;
     191        }
     192      } // while
     193    } // if long
     194  } // if loaded
     195
     196  if (l == 0) {
     197    DbgMsg(pszSrcFile, __LINE__, "Error loading %lu", id);
     198    sprintf(sz, "** Error loading id %lu **", id);
     199    psz = xstrdup(sz, pszSrcFile, __LINE__);
     200    if (psz)
     201      l = strlen(sz);
     202    else
     203      psz = NullStr;            // Oh heck
     204  }
     205
     206  uDbgState = 5;
     207  // Add to cache
     208  // DbgMsg(pszSrcFile, __LINE__, "Caching %lu", id);
     209
     210  // Calculate new array limits
     211  if (!pLoadedStrings) {
     212    ulNewFirstId = id;
     213    ulNewLastId = id;
     214    ulFirstId = id;
     215    ulLastId = id;
     216  }
     217  else {
     218    ulNewFirstId = id < ulFirstId ? id : ulFirstId;
     219    ulNewLastId = id > ulLastId ? id : ulLastId;
     220  }
     221
     222  if (ulNewFirstId != ulFirstId ||
     223      ulNewLastId != ulLastId ||
     224      !pLoadedStrings) {
     225    PSZ *pNewLoadedStrings;
     226    // DbgMsg(pszSrcFile, __LINE__, "Reallocating for %lu", id);
     227    pNewLoadedStrings = xrealloc(pLoadedStrings,
     228                                 (ulNewLastId - ulNewFirstId + 1) * sizeof(PSZ),
     229                                 pszSrcFile, __LINE__);
     230    if (!pNewLoadedStrings) {
     231      cBusy--;
     232      Runtime_Error(pszSrcFile, __LINE__, "realloc failed");
     233      xfree(psz, pszSrcFile, __LINE__);
     234      return NullStr;
     235    }
     236    // Align existing entries and zero fill unused entries as needed
     237    if (ulNewFirstId < ulFirstId) {
     238      // Move room for new entries at head of array
     239      memmove(pNewLoadedStrings + (ulFirstId - ulNewFirstId),
     240             pNewLoadedStrings,
     241             (ulLastId - ulFirstId + 1) * sizeof(PSZ));
     242      // Null unused placeholder entries
     243      if (ulFirstId - ulNewFirstId > 1)
     244        memset(pNewLoadedStrings + 1, 0, (ulFirstId - ulNewFirstId - 1) * sizeof(PSZ));
     245    }
     246    if (ulNewLastId - ulLastId > 1) {
     247      // Null unused placeholder entries
     248      memset(pNewLoadedStrings + (ulLastId - ulNewFirstId + 1),
     249             0,
     250             (ulNewLastId - ulLastId - 1) * sizeof(PSZ));
     251    }
     252    pLoadedStrings = pNewLoadedStrings;
     253    ulFirstId = ulNewFirstId;
     254    ulLastId = ulNewLastId;
     255  }
     256
     257  uDbgState = 6;
     258  pLoadedStrings[id - ulFirstId] = psz;
     259  cBusy--;
     260  // DbgMsg(pszSrcFile, __LINE__, "id %lu \"%s\"", id, psz ? psz : "(null)");
     261  return psz;
    115262}
    116263
    117 //== GetPString() return a readonly pointer to the requested string in memory ==
    118 
    119 char *GetPString(ULONG id)
    120 {
    121   return id < numStr && str && strs && strs[id] ? strs[id] : NullStr;
    122 }
    123 
    124 //== StringsLoaded() return TRUE is strings loaded
    125 
    126 BOOL StringsLoaded(void)
    127 {
    128   return numStr && str && strs;
    129 }
    130 
    131264#pragma alloc_text(STRINGS,LoadStrings,GetPString)
  • trunk/dll/strutil.h

    r1201 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2009 Steven H. Levine
    1010
    1111  05 Jan 08 SHL Move from fm3dll.h to here
     12  03 Feb 09 SHL Switch to STRINGTABLE and const return
    1213
    1314***********************************************************************/
     
    2021#endif
    2122
    22 BOOL LoadStrings(PSZ filename);
    23 PSZ GetPString(ULONG id);
    24 BOOL StringsLoaded(void);
     23PCSZ GetPString(ULONG id);
    2524
    2625#endif // STRUTIL_H
  • trunk/dll/systemf.c

    r1375 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2003, 2008 Steven H.Levine
     9  Copyright (c) 2003, 2009 Steven H.Levine
    1010
    1111  21 Nov 03 SHL Comments
     
    2525  19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory or pTmpDir and use MakeTempName
    2626  03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
    27                 Dos/Win programs from being inserted into the execute dialog with message why.
     27                Dos/Win programs from being inserted into the execute dialog with message why.
    2828
    2929***********************************************************************/
     
    8282    if (!rc) {
    8383      if (swctl.idProcess == pid && swctl.uchVisibility == SWL_VISIBLE)
    84         rc = WinSwitchToProgram(hswitch);
     84        rc = WinSwitchToProgram(hswitch);
    8585      if (!rc)
    86         return TRUE;
     86        return TRUE;
    8787      // else saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Failed: %lu/%lx",rc,rc);
    8888
     
    100100
    101101int ExecOnList(HWND hwnd, char *command, int flags, char *tpath,
    102                char **list, char *prompt, PCSZ pszCallingFile, UINT uiLineNumber)
     102               PSZ *list, PCSZ prompt, PCSZ pszCallingFile, UINT uiLineNumber)
    103103{
    104104  /* executes the command once for all files in list */
    105105
    106   char path[CCHMAXPATH], *commandline, modpath[CCHMAXPATH], listfile[CCHMAXPATH],
     106  CHAR path[CCHMAXPATH], *commandline, modpath[CCHMAXPATH], listfile[CCHMAXPATH],
    107107       *p, *pp, drive, *file, *ext, *dot;
    108108  register int x;
     
    135135    if (p) {
    136136      if (*p == ':') {
    137         p++;
    138         *p = '\\';
    139         p++;
     137        p++;
     138        *p = '\\';
     139        p++;
    140140      }
    141141      *p = 0;
     
    152152    if (p) {
    153153      if (*p == ':') {
    154         p++;
    155         *p = '\\';
    156         p++;
     154        p++;
     155        *p = '\\';
     156        p++;
    157157      }
    158158      *p = 0;
     
    196196      switch (*(p + 1)) {
    197197      case '!':                 /* write list to file, add filename */
    198         if (list) {
    199           if (!*listfile) {
    200             FILE *fp;
    201 
    202 
    203             strcpy(listfile, pTmpDir ? pTmpDir : pFM2SaveDirectory);
    204             MakeTempName(listfile, "$FM2LI$T", 2);
    205             /*if (listfile[strlen(listfile) - 1] != '\\')
    206               strcat(listfile, "\\");
    207             sprintf(&listfile[strlen(listfile)], "%s.%03x",
    208                     LISTTEMPROOT, (clock() & 4095));*/
    209             fp = xfopen(listfile, "w",pszSrcFile,__LINE__);
    210             if (fp) {
    211               for (x = 0; list[x]; x++)
    212               {
    213                 fputs(list[x], fp);
    214                 if (list[x + 1])
    215                   fputc('\n', fp);
    216               }
    217               fclose(fp);
    218             }
    219           }
    220           strcpy(pp, listfile);
    221           pp += strlen(listfile);
    222         }
    223         p += 2;
    224         break;
     198        if (list) {
     199          if (!*listfile) {
     200            FILE *fp;
     201
     202
     203            strcpy(listfile, pTmpDir ? pTmpDir : pFM2SaveDirectory);
     204            MakeTempName(listfile, "$FM2LI$T", 2);
     205            /*if (listfile[strlen(listfile) - 1] != '\\')
     206              strcat(listfile, "\\");
     207            sprintf(&listfile[strlen(listfile)], "%s.%03x",
     208                    LISTTEMPROOT, (clock() & 4095));*/
     209            fp = xfopen(listfile, "w",pszSrcFile,__LINE__);
     210            if (fp) {
     211              for (x = 0; list[x]; x++)
     212              {
     213                fputs(list[x], fp);
     214                if (list[x + 1])
     215                  fputc('\n', fp);
     216              }
     217              fclose(fp);
     218            }
     219          }
     220          strcpy(pp, listfile);
     221          pp += strlen(listfile);
     222        }
     223        p += 2;
     224        break;
    225225
    226226      case 'c':                 /* add name of command processor */
    227         {
    228           char *env = GetCmdSpec(FALSE);
    229 
    230           if (needs_quoting(env) && !strchr(env, '\"')) {
    231             *pp = '\"';
    232             pp++;
    233             spaces = TRUE;
    234           }
    235           else
    236             spaces = FALSE;
    237           strcpy(pp, env);
    238           p += 2;
    239           pp += strlen(env);
    240           if (spaces) {
    241             *pp = '\"';
    242             pp++;
    243           }
    244         }
    245         break;
     227        {
     228          char *env = GetCmdSpec(FALSE);
     229
     230          if (needs_quoting(env) && !strchr(env, '\"')) {
     231            *pp = '\"';
     232            pp++;
     233            spaces = TRUE;
     234          }
     235          else
     236            spaces = FALSE;
     237          strcpy(pp, env);
     238          p += 2;
     239          pp += strlen(env);
     240          if (spaces) {
     241            *pp = '\"';
     242            pp++;
     243          }
     244        }
     245        break;
    246246
    247247      case 't':                 /* add Target directory */
    248         if (needs_quoting(targetdir) && !strchr(targetdir, '\"')) {
    249           *pp = '\"';
    250           pp++;
    251           spaces = TRUE;
    252         }
    253         else
    254           spaces = FALSE;
    255         strcpy(pp, targetdir);
    256         p += 2;
    257         pp += strlen(targetdir);
    258         if (spaces) {
    259           *pp = '\"';
    260           pp++;
    261         }
    262         break;
     248        if (needs_quoting(targetdir) && !strchr(targetdir, '\"')) {
     249          *pp = '\"';
     250          pp++;
     251          spaces = TRUE;
     252        }
     253        else
     254          spaces = FALSE;
     255        strcpy(pp, targetdir);
     256        p += 2;
     257        pp += strlen(targetdir);
     258        if (spaces) {
     259          *pp = '\"';
     260          pp++;
     261        }
     262        break;
    263263
    264264      case '$':                 /* add drive letter */
    265         if (drive)
    266           *pp = drive;
    267         else {
    268           ULONG ulDriveNum = 3, ulDriveMap;
    269 
    270           DosQCurDisk(&ulDriveNum, &ulDriveMap);
    271           *pp = (char) (ulDriveNum + '@');
    272         }
    273         pp++;
    274         p += 2;
    275         break;
     265        if (drive)
     266          *pp = drive;
     267        else {
     268          ULONG ulDriveNum = 3, ulDriveMap;
     269
     270          DosQCurDisk(&ulDriveNum, &ulDriveMap);
     271          *pp = (char) (ulDriveNum + '@');
     272        }
     273        pp++;
     274        p += 2;
     275        break;
    276276
    277277      case 'U':                 /* add path of first list component */
    278278      case 'u':
    279         if (*modpath) {
    280           if (needs_quoting(modpath) && !strchr(modpath, '\"')) {
    281             spaces = TRUE;
    282             *pp = '\"';
    283             pp++;
    284           }
    285           else
    286             spaces = FALSE;
    287           if (*(p + 1) == 'u') {
    288             strcpy(pp, modpath);
    289             pp += strlen(modpath);
    290           }
    291           else {
    292             strcpy(pp, modpath + 2);
    293             pp += strlen(modpath + 2);
    294           }
    295           if (spaces) {
    296             if (modpath[strlen(modpath) - 1] == '\\') {
    297               *pp = '\\';
    298               pp++;
    299             }
    300             *pp = '\"';
    301             pp++;
    302           }
    303         }
    304         else {
    305           char temp[CCHMAXPATH];
    306 
    307           strcpy(temp, pFM2SaveDirectory);
    308           if (needs_quoting(temp) && !strchr(temp, '\"')) {
    309             spaces = TRUE;
    310             *pp = '\"';
    311             pp++;
    312           }
    313           else
    314             spaces = FALSE;
    315           strcpy(pp, temp);
    316           pp += strlen(temp);
    317           if (spaces) {
    318             if (temp[strlen(temp) - 1] == '\\') {
    319               *pp = '\\';
    320               pp++;
    321             }
    322             *pp = '\"';
    323             pp++;
    324           }
    325         }
    326         p += 2;
    327         break;
     279        if (*modpath) {
     280          if (needs_quoting(modpath) && !strchr(modpath, '\"')) {
     281            spaces = TRUE;
     282            *pp = '\"';
     283            pp++;
     284          }
     285          else
     286            spaces = FALSE;
     287          if (*(p + 1) == 'u') {
     288            strcpy(pp, modpath);
     289            pp += strlen(modpath);
     290          }
     291          else {
     292            strcpy(pp, modpath + 2);
     293            pp += strlen(modpath + 2);
     294          }
     295          if (spaces) {
     296            if (modpath[strlen(modpath) - 1] == '\\') {
     297              *pp = '\\';
     298              pp++;
     299            }
     300            *pp = '\"';
     301            pp++;
     302          }
     303        }
     304        else {
     305          char temp[CCHMAXPATH];
     306
     307          strcpy(temp, pFM2SaveDirectory);
     308          if (needs_quoting(temp) && !strchr(temp, '\"')) {
     309            spaces = TRUE;
     310            *pp = '\"';
     311            pp++;
     312          }
     313          else
     314            spaces = FALSE;
     315          strcpy(pp, temp);
     316          pp += strlen(temp);
     317          if (spaces) {
     318            if (temp[strlen(temp) - 1] == '\\') {
     319              *pp = '\\';
     320              pp++;
     321            }
     322            *pp = '\"';
     323            pp++;
     324          }
     325        }
     326        p += 2;
     327        break;
    328328
    329329      case 'P':                 /* add path of execution */
    330330      case 'p':
    331         if (*path) {
    332           if (needs_quoting(path) && !strchr(path, '\"')) {
    333             spaces = TRUE;
    334             *pp = '\"';
    335             pp++;
    336           }
    337           else
    338             spaces = FALSE;
    339           if (*(p + 1) == 'p') {
    340             strcpy(pp, path);
    341             pp += strlen(path);
    342           }
    343           else {
    344             strcpy(pp, path + 2);
    345             pp += strlen(path + 2);
    346           }
    347           if (spaces) {
    348             if (path[strlen(path) - 1] == '\\') {
    349               *pp = '\\';
    350               pp++;
    351             }
    352             *pp = '\"';
    353             pp++;
    354           }
    355         }
    356         else {
    357           char temp[CCHMAXPATH];
    358 
    359           strcpy(temp, pFM2SaveDirectory);
    360           if (needs_quoting(temp) && !strchr(temp, '\"')) {
    361             spaces = TRUE;
    362             *pp = '\"';
    363             pp++;
    364           }
    365           else
    366             spaces = FALSE;
    367           strcpy(pp, temp);
    368           pp += strlen(temp);
    369           if (spaces) {
    370             if (temp[strlen(temp) - 1] == '\\') {
    371               *pp = '\\';
    372               pp++;
    373             }
    374             *pp = '\"';
    375             pp++;
    376           }
    377         }
    378         p += 2;
    379         break;
     331        if (*path) {
     332          if (needs_quoting(path) && !strchr(path, '\"')) {
     333            spaces = TRUE;
     334            *pp = '\"';
     335            pp++;
     336          }
     337          else
     338            spaces = FALSE;
     339          if (*(p + 1) == 'p') {
     340            strcpy(pp, path);
     341            pp += strlen(path);
     342          }
     343          else {
     344            strcpy(pp, path + 2);
     345            pp += strlen(path + 2);
     346          }
     347          if (spaces) {
     348            if (path[strlen(path) - 1] == '\\') {
     349              *pp = '\\';
     350              pp++;
     351            }
     352            *pp = '\"';
     353            pp++;
     354          }
     355        }
     356        else {
     357          char temp[CCHMAXPATH];
     358
     359          strcpy(temp, pFM2SaveDirectory);
     360          if (needs_quoting(temp) && !strchr(temp, '\"')) {
     361            spaces = TRUE;
     362            *pp = '\"';
     363            pp++;
     364          }
     365          else
     366            spaces = FALSE;
     367          strcpy(pp, temp);
     368          pp += strlen(temp);
     369          if (spaces) {
     370            if (temp[strlen(temp) - 1] == '\\') {
     371              *pp = '\\';
     372              pp++;
     373            }
     374            *pp = '\"';
     375            pp++;
     376          }
     377        }
     378        p += 2;
     379        break;
    380380
    381381      case 'D':
    382         if (hwndMain) {
    383           PCNRITEM pci;
    384 
    385           pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(
    386                                            hwndTree, FID_CLIENT), TREE_CNR),
    387                                       CM_QUERYRECORDEMPHASIS,
    388                                       MPFROMLONG(CMA_FIRST),
    389                                       MPFROMSHORT(CRA_CURSORED));
    390           if (pci && (int) pci != -1 && *pci->pszFileName) {
    391             if (needs_quoting(pci->pszFileName) &&
    392                 !strchr(pci->pszFileName, '\"'))
    393             {
    394               *pp = '\"';
    395               pp++;
    396               spaces = TRUE;
    397             }
    398             else
    399               spaces = FALSE;
    400             strcpy(pp, pci->pszFileName);
    401             pp += strlen(pci->pszFileName);
    402             if (spaces) {
    403               *pp = '\"';
    404               pp++;
    405             }
    406           }
    407         }
    408         p += 2;
    409         break;
     382        if (hwndMain) {
     383          PCNRITEM pci;
     384
     385          pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(
     386                                           hwndTree, FID_CLIENT), TREE_CNR),
     387                                      CM_QUERYRECORDEMPHASIS,
     388                                      MPFROMLONG(CMA_FIRST),
     389                                      MPFROMSHORT(CRA_CURSORED));
     390          if (pci && (int) pci != -1 && *pci->pszFileName) {
     391            if (needs_quoting(pci->pszFileName) &&
     392                !strchr(pci->pszFileName, '\"'))
     393            {
     394              *pp = '\"';
     395              pp++;
     396              spaces = TRUE;
     397            }
     398            else
     399              spaces = FALSE;
     400            strcpy(pp, pci->pszFileName);
     401            pp += strlen(pci->pszFileName);
     402            if (spaces) {
     403              *pp = '\"';
     404              pp++;
     405            }
     406          }
     407        }
     408        p += 2;
     409        break;
    410410
    411411      case 'd':
    412         if (hwndMain) {
    413           HENUM henum;
    414           char retstr[CCHMAXPATH];
    415           HWND hwndC, hwndDir;
    416           USHORT id;
    417           BOOL first = TRUE;
    418 
    419           henum = WinBeginEnumWindows(hwndMain);
    420           while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
    421             if (hwndC != hwndTree) {
    422               id = WinQueryWindowUShort(hwndC, QWS_ID);
    423               if (id) {
    424                 hwndDir = WinWindowFromID(hwndC, FID_CLIENT);
    425                 if (hwndDir) {
    426                   hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
    427                   if (hwndDir) {
    428                     *retstr = 0;
    429                     WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
    430                     if (*retstr) {
    431                       if (!first) {
    432                         *pp = ' ';
    433                         pp++;
    434                       }
    435                       first = FALSE;
    436                       if (needs_quoting(retstr) && !strchr(retstr, '\"')) {
    437                         *pp = '\"';
    438                         pp++;
    439                         spaces = TRUE;
    440                       }
    441                       else
    442                         spaces = FALSE;
    443                       strcpy(pp, retstr);
    444                       pp += strlen(retstr);
    445                       if (spaces) {
    446                         *pp = '\"';
    447                         pp++;
    448                       }
    449                     }
    450                   }
    451                 }
    452               }
    453             }
    454           }
    455           WinEndEnumWindows(henum);
    456         }
    457         p += 2;
    458         break;
     412        if (hwndMain) {
     413          HENUM henum;
     414          char retstr[CCHMAXPATH];
     415          HWND hwndC, hwndDir;
     416          USHORT id;
     417          BOOL first = TRUE;
     418
     419          henum = WinBeginEnumWindows(hwndMain);
     420          while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
     421            if (hwndC != hwndTree) {
     422              id = WinQueryWindowUShort(hwndC, QWS_ID);
     423              if (id) {
     424                hwndDir = WinWindowFromID(hwndC, FID_CLIENT);
     425                if (hwndDir) {
     426                  hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
     427                  if (hwndDir) {
     428                    *retstr = 0;
     429                    WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
     430                    if (*retstr) {
     431                      if (!first) {
     432                        *pp = ' ';
     433                        pp++;
     434                      }
     435                      first = FALSE;
     436                      if (needs_quoting(retstr) && !strchr(retstr, '\"')) {
     437                        *pp = '\"';
     438                        pp++;
     439                        spaces = TRUE;
     440                      }
     441                      else
     442                        spaces = FALSE;
     443                      strcpy(pp, retstr);
     444                      pp += strlen(retstr);
     445                      if (spaces) {
     446                        *pp = '\"';
     447                        pp++;
     448                      }
     449                    }
     450                  }
     451                }
     452              }
     453            }
     454          }
     455          WinEndEnumWindows(henum);
     456        }
     457        p += 2;
     458        break;
    459459
    460460      case '%':
    461         *pp = '%';
    462         pp++;
    463         p += 2;
    464         break;
     461        *pp = '%';
     462        pp++;
     463        p += 2;
     464        break;
    465465
    466466      case 'R':
     
    471471      case 'a':
    472472      case 'e':
    473         if (list) {
    474           for (x = 0; list[x]; x++)
    475           {
    476             file = strrchr(list[x], '\\');
    477             if (!file)
    478               file = strrchr(list[x], ':');
    479             if (file)
    480               file++;
    481             else
    482               file = list[x];
    483             ext = strrchr(file, '.');
    484             dot = ext;
    485             if (ext)
    486               ext++;
    487             switch (*(p + 1)) {
    488             case 'R':
    489             case 'r':
    490               if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
    491                 goto BreakOut;
    492               if (*(p + 1) == 'r') {
    493                 strcpy(pp, list[x]);
    494                 pp += strlen(list[x]);
    495               }
    496               else {
    497                 strcpy(pp, list[x] + 2);
    498                 pp += strlen(list[x] + 2);
    499               }
    500               break;
    501 
    502             case 'F':
    503             case 'f':
    504               if (*(p + 1) == 'F' && dot)
    505                 *dot = 0;
    506               if (pp + strlen(file) > commandline + MaxComLineStrg)
    507                 goto BreakOut;
    508               if (needs_quoting(file)) {
    509                 spaces = TRUE;
    510                 *pp = '\"';
    511                 pp++;
    512               }
    513               else
    514                 spaces = FALSE;
    515               strcpy(pp, file);
    516               pp += strlen(file);
    517               if (*(p + 1) == 'F' && dot)
    518                 *dot = '.';
    519               if (spaces) {
    520                 if (*(pp - 1) != '\"') {
    521                   *pp = '\"';
    522                   pp++;
    523                 }
    524               }
    525               break;
    526 
    527             case 'A':
    528             case 'a':
    529               if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
    530                 goto BreakOut;
    531               if (needs_quoting(list[x]) && !strchr(list[x], '\"')) {
    532                 spaces = TRUE;
    533                 *pp = '\"';
    534                 pp++;
    535               }
    536               else
    537                 spaces = FALSE;
    538               if (*(p + 1) == 'a') {
    539                 strcpy(pp, list[x]);
    540                 pp += strlen(list[x]);
    541               }
    542               else {
    543                 strcpy(pp, list[x] + 2);
    544                 pp += strlen(list[x] + 2);
    545               }
    546               if (spaces) {
    547                 if (list[x][strlen(list[x]) - 1] == '\\') {
    548                   *pp = '\\';
    549                   pp++;
    550                 }
    551                 *pp = '\"';
    552                 pp++;
    553               }
    554               break;
    555 
    556             case 'e':
    557               if (ext) {
    558                 if (pp + strlen(ext) > commandline + MaxComLineStrg)
    559                   goto BreakOut;
    560                 if (needs_quoting(ext)) {
    561                   spaces = TRUE;
    562                   *pp = '\"';
    563                   pp++;
    564                 }
    565                 else
    566                   spaces = FALSE;
    567                 strcpy(pp, ext);
    568                 pp += strlen(ext);
    569                 if (spaces) {
    570                   if (*(pp - 1) != '\"') {
    571                     *pp = '\"';
    572                     pp++;
    573                   }
    574                 }
    575               }
    576               break;
    577             }
    578             if (list[x + 1]) {
    579               *pp = ' ';
    580               pp++;
    581             }
    582           }
    583         }
    584         p += 2;
    585         break;
     473        if (list) {
     474          for (x = 0; list[x]; x++)
     475          {
     476            file = strrchr(list[x], '\\');
     477            if (!file)
     478              file = strrchr(list[x], ':');
     479            if (file)
     480              file++;
     481            else
     482              file = list[x];
     483            ext = strrchr(file, '.');
     484            dot = ext;
     485            if (ext)
     486              ext++;
     487            switch (*(p + 1)) {
     488            case 'R':
     489            case 'r':
     490              if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
     491                goto BreakOut;
     492              if (*(p + 1) == 'r') {
     493                strcpy(pp, list[x]);
     494                pp += strlen(list[x]);
     495              }
     496              else {
     497                strcpy(pp, list[x] + 2);
     498                pp += strlen(list[x] + 2);
     499              }
     500              break;
     501
     502            case 'F':
     503            case 'f':
     504              if (*(p + 1) == 'F' && dot)
     505                *dot = 0;
     506              if (pp + strlen(file) > commandline + MaxComLineStrg)
     507                goto BreakOut;
     508              if (needs_quoting(file)) {
     509                spaces = TRUE;
     510                *pp = '\"';
     511                pp++;
     512              }
     513              else
     514                spaces = FALSE;
     515              strcpy(pp, file);
     516              pp += strlen(file);
     517              if (*(p + 1) == 'F' && dot)
     518                *dot = '.';
     519              if (spaces) {
     520                if (*(pp - 1) != '\"') {
     521                  *pp = '\"';
     522                  pp++;
     523                }
     524              }
     525              break;
     526
     527            case 'A':
     528            case 'a':
     529              if (pp + strlen(list[x]) > commandline + MaxComLineStrg)
     530                goto BreakOut;
     531              if (needs_quoting(list[x]) && !strchr(list[x], '\"')) {
     532                spaces = TRUE;
     533                *pp = '\"';
     534                pp++;
     535              }
     536              else
     537                spaces = FALSE;
     538              if (*(p + 1) == 'a') {
     539                strcpy(pp, list[x]);
     540                pp += strlen(list[x]);
     541              }
     542              else {
     543                strcpy(pp, list[x] + 2);
     544                pp += strlen(list[x] + 2);
     545              }
     546              if (spaces) {
     547                if (list[x][strlen(list[x]) - 1] == '\\') {
     548                  *pp = '\\';
     549                  pp++;
     550                }
     551                *pp = '\"';
     552                pp++;
     553              }
     554              break;
     555
     556            case 'e':
     557              if (ext) {
     558                if (pp + strlen(ext) > commandline + MaxComLineStrg)
     559                  goto BreakOut;
     560                if (needs_quoting(ext)) {
     561                  spaces = TRUE;
     562                  *pp = '\"';
     563                  pp++;
     564                }
     565                else
     566                  spaces = FALSE;
     567                strcpy(pp, ext);
     568                pp += strlen(ext);
     569                if (spaces) {
     570                  if (*(pp - 1) != '\"') {
     571                    *pp = '\"';
     572                    pp++;
     573                  }
     574                }
     575              }
     576              break;
     577            }
     578            if (list[x + 1]) {
     579              *pp = ' ';
     580              pp++;
     581            }
     582          }
     583        }
     584        p += 2;
     585        break;
    586586
    587587      default:
    588         *pp = *p;
    589         p++;
    590         pp++;
    591         break;
     588        *pp = *p;
     589        p++;
     590        pp++;
     591        break;
    592592      }
    593593    }
     
    616616      strcpy(ex.path, path);
    617617      if (prompt)
    618         strcpy(ex.title, prompt);
     618        strcpy(ex.title, prompt);
    619619      ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle,
    620                       EXEC_FRAME, &ex);
     620                      EXEC_FRAME, &ex);
    621621      if (ret != 1) {
    622         free(commandline);
    623         return (ret == 0) ? -1 : -2;
     622        free(commandline);
     623        return (ret == 0) ? -1 : -2;
    624624      }
    625625    }
     
    628628    ex.flags &= (~PROMPT);
    629629    ret = runemf2(ex.flags, hwnd, pszCallingFile, uiLineNumber, path,
    630                    (*ex.environment) ? ex.environment : NULL,
    631                    "%s", commandline);
     630                   (*ex.environment) ? ex.environment : NULL,
     631                   "%s", commandline);
    632632    free(commandline);
    633633    return ret;
     
    640640
    641641int runemf2(int type, HWND hwnd, PCSZ pszCallingFile, UINT uiLineNumber,
    642             char *pszDirectory, char *pszEnvironment,
    643             char *formatstring,...)
     642            char *pszDirectory, char *pszEnvironment,
     643            char *formatstring,...)
    644644{
    645645  /** example:
     
    697697  if (pszDirectory && *pszDirectory) {
    698698    if (!DosQueryPathInfo(pszDirectory,
    699                           FIL_QUERYFULLNAME,
    700                           szTempdir,
    701                           sizeof(szTempdir)))
     699                          FIL_QUERYFULLNAME,
     700                          szTempdir,
     701                          sizeof(szTempdir)))
    702702      pszDirectory = szTempdir;
    703703  }
     
    707707
    708708  rc = DosAllocMem((PVOID)&pszPgm,
    709                    MaxComLineStrg,
    710                    PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     709                   MaxComLineStrg,
     710                   PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    711711  if (rc) {
    712712    Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     
    718718  *pszPgm = 0;
    719719  va_start(parguments,
    720            formatstring);
     720           formatstring);
    721721  vsprintf(pszPgm,
    722            formatstring,
    723            parguments);
     722           formatstring,
     723           parguments);
    724724  va_end(parguments);
    725725
     
    754754      temp = *p;
    755755      if (temp) {
    756         rc = DosAllocMem((PVOID)&pszArgs,
    757                         MaxComLineStrg * 2,
    758                         PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    759         if (rc)
    760           Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     756        rc = DosAllocMem((PVOID)&pszArgs,
     757                        MaxComLineStrg * 2,
     758                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     759        if (rc)
     760          Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
    761761      }
    762762      else
    763         pszArgs = NULL;
     763        pszArgs = NULL;
    764764      *p = 0;
    765765      /* Find the handle of the WPS object */
     
    767767      *p = temp;
    768768      if (hWPSObject != NULLHANDLE) {
    769         if (pszArgs && *p) {
    770           sprintf(pszArgs,"OPEN=DEFAULT;PARAMETERS=\"%s\"",p);
    771           WinSetObjectData(hWPSObject,pszArgs);
    772         }
    773         else
    774           WinSetObjectData(hWPSObject,"OPEN=DEFAULT");
    775         ret = 0;
     769        if (pszArgs && *p) {
     770          sprintf(pszArgs,"OPEN=DEFAULT;PARAMETERS=\"%s\"",p);
     771          WinSetObjectData(hWPSObject,pszArgs);
     772        }
     773        else
     774          WinSetObjectData(hWPSObject,"OPEN=DEFAULT");
     775        ret = 0;
    776776      }
    777777      goto ObjectInterrupt;
     
    779779
    780780    if ((type & RUNTYPE_MASK) == SYNCHRONOUS ||
    781         (type & RUNTYPE_MASK) == ASYNCHRONOUS ||
    782         (type & RUNTYPE_MASK) == DETACHED)
     781        (type & RUNTYPE_MASK) == ASYNCHRONOUS ||
     782        (type & RUNTYPE_MASK) == DETACHED)
    783783    {
    784784      strip_lead_char(" \t", pszPgm);
     
    786786      wasquote = FALSE;
    787787      while (*p &&
    788              (wasquote ||
    789               (*p != ' ' &&
    790                *p != '\t')))
     788             (wasquote ||
     789              (*p != ' ' &&
     790               *p != '\t')))
    791791      {
    792         if (*p == '\"') {
    793           if (!wasquote) {
    794             wasquote = TRUE;
    795             memmove(p,
    796                     p + 1,
    797                     strlen(p));
    798             while (*p == ' ' ||
    799                    *p == '\t')
    800               p++;
    801           }
    802           else {
    803             memmove(p,
    804                     p + 1,
    805                     strlen(p));
    806             break;
    807           }
    808         }
    809         else
    810           p++;
     792        if (*p == '\"') {
     793          if (!wasquote) {
     794            wasquote = TRUE;
     795            memmove(p,
     796                    p + 1,
     797                    strlen(p));
     798            while (*p == ' ' ||
     799                   *p == '\t')
     800              p++;
     801          }
     802          else {
     803            memmove(p,
     804                    p + 1,
     805                    strlen(p));
     806            break;
     807          }
     808        }
     809        else
     810          p++;
    811811      }
    812812      if (*p) {
    813         *p = 0;
    814         p++;
     813        *p = 0;
     814        p++;
    815815      }
    816816      else
    817         p = pszPgm;
     817        p = pszPgm;
    818818      p[strlen(p) + 1] = 0;             /* double-terminate args */
    819819      if (*pszPgm) {
    820         if (!strchr(pszPgm, '\\') &&
    821             !strchr(pszPgm, ':') &&
    822             pszDirectory &&
    823             *pszDirectory)
    824         {
    825           strcpy(szSavedir, pFM2SaveDirectory);
    826           switch_to(pszDirectory);
    827         }
    828         rc = DosQueryAppType(pszPgm,&ulAppType);
    829         if (!strchr(pszPgm, '\\') &&
    830             !strchr(pszPgm, ':') &&
    831             pszDirectory &&
    832             *pszDirectory)
    833           switch_to(szSavedir);
    834         if (rc) {
    835           Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
    836                     GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
    837                     pszPgm, pszCallingFile, uiLineNumber);      // 26 May 08 SHL
    838           DosFreeMem(pszPgm);
    839           if (pszArgs)
    840             DosFreeMem(pszArgs);
    841           return -1;
    842         }
    843         if (ulAppType) {
    844           if (ulAppType & FAPPTYP_DLL || ulAppType & FAPPTYP_VIRTDRV ||
    845               ulAppType & FAPPTYP_PHYSDRV || ulAppType & FAPPTYP_PROTDLL)
    846           {
    847             Runtime_Error(pszSrcFile, __LINE__,
    848                           GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    849                           ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
    850             if (pszPgm)
    851               DosFreeMem(pszPgm);
    852             if (pszArgs)
    853               DosFreeMem(pszArgs);
    854             return -1;
    855           }
    856           if (ulAppType & FAPPTYP_DOS || ulAppType & FAPPTYP_WINDOWSREAL ||
    857               ulAppType & FAPPTYP_WINDOWSPROT || ulAppType & FAPPTYP_WINDOWSPROT31)
    858           {
    859             Runtime_Error(pszSrcFile, __LINE__,
    860                           GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    861                           ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
    862             if (pszPgm)
    863               DosFreeMem(pszPgm);
    864             if (pszArgs)
    865               DosFreeMem(pszArgs);
    866             return -1;
    867           }
    868         }
    869         memset(&results, 0, sizeof(results));
    870         if (pszDirectory && *pszDirectory) {
    871           strcpy(szSavedir, pFM2SaveDirectory);
    872           switch_to(pszDirectory);
    873         }
    874         ret = DosExecPgm(szObject, sizeof(szObject),
    875                         ((type & RUNTYPE_MASK) == ASYNCHRONOUS ?  EXEC_ASYNC : 0) +
    876                         ((type & RUNTYPE_MASK) == DETACHED ? EXEC_BACKGROUND : 0),
    877                         pszPgm, pszEnvironment, &results, pszPgm);
    878         if (pszDirectory && *pszDirectory)
    879           switch_to(szSavedir);
    880         if (ret && !fNoErrorMsg) {
    881           Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__,
    882                     GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm,
    883                     pszCallingFile, uiLineNumber);      // 26 May 08 SHL
    884         }
     820        if (!strchr(pszPgm, '\\') &&
     821            !strchr(pszPgm, ':') &&
     822            pszDirectory &&
     823            *pszDirectory)
     824        {
     825          strcpy(szSavedir, pFM2SaveDirectory);
     826          switch_to(pszDirectory);
     827        }
     828        rc = DosQueryAppType(pszPgm,&ulAppType);
     829        if (!strchr(pszPgm, '\\') &&
     830            !strchr(pszPgm, ':') &&
     831            pszDirectory &&
     832            *pszDirectory)
     833          switch_to(szSavedir);
     834        if (rc) {
     835          Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
     836                    GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
     837                    pszPgm, pszCallingFile, uiLineNumber);      // 26 May 08 SHL
     838          DosFreeMem(pszPgm);
     839          if (pszArgs)
     840            DosFreeMem(pszArgs);
     841          return -1;
     842        }
     843        if (ulAppType) {
     844          if (ulAppType & FAPPTYP_DLL || ulAppType & FAPPTYP_VIRTDRV ||
     845              ulAppType & FAPPTYP_PHYSDRV || ulAppType & FAPPTYP_PROTDLL)
     846          {
     847            Runtime_Error(pszSrcFile, __LINE__,
     848                          GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
     849                          ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
     850            if (pszPgm)
     851              DosFreeMem(pszPgm);
     852            if (pszArgs)
     853              DosFreeMem(pszArgs);
     854            return -1;
     855          }
     856          if (ulAppType & FAPPTYP_DOS || ulAppType & FAPPTYP_WINDOWSREAL ||
     857              ulAppType & FAPPTYP_WINDOWSPROT || ulAppType & FAPPTYP_WINDOWSPROT31)
     858          {
     859            Runtime_Error(pszSrcFile, __LINE__,
     860                          GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
     861                          ulAppType, pszPgm, pszCallingFile, uiLineNumber);     // 26 May 08 SHL
     862            if (pszPgm)
     863              DosFreeMem(pszPgm);
     864            if (pszArgs)
     865              DosFreeMem(pszArgs);
     866            return -1;
     867          }
     868        }
     869        memset(&results, 0, sizeof(results));
     870        if (pszDirectory && *pszDirectory) {
     871          strcpy(szSavedir, pFM2SaveDirectory);
     872          switch_to(pszDirectory);
     873        }
     874        ret = DosExecPgm(szObject, sizeof(szObject),
     875                        ((type & RUNTYPE_MASK) == ASYNCHRONOUS ?  EXEC_ASYNC : 0) +
     876                        ((type & RUNTYPE_MASK) == DETACHED ? EXEC_BACKGROUND : 0),
     877                        pszPgm, pszEnvironment, &results, pszPgm);
     878        if (pszDirectory && *pszDirectory)
     879          switch_to(szSavedir);
     880        if (ret && !fNoErrorMsg) {
     881          Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__,
     882                    GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm,
     883                    pszCallingFile, uiLineNumber);      // 26 May 08 SHL
     884        }
    885885      }
    886886    }
    887887    else {
    888888      if (~type & FULLSCREEN)
    889         type |= WINDOWED;
     889        type |= WINDOWED;
    890890      rc = DosAllocMem((PVOID) & pszArgs, MaxComLineStrg * 2,
    891                        PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
     891                       PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE);
    892892      if (rc) {
    893         Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
    894         DosFreeMem(pszPgm);
    895         return -1;
     893        Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,GetPString(IDS_OUTOFMEMORY));
     894        DosFreeMem(pszPgm);
     895        return -1;
    896896      }
    897897      *pszArgs = 0;
     
    901901      wasquote = FALSE;
    902902      while (*p && (wasquote || (*p != ' ' && *p != '\t'))) {
    903         if (*p == '\"') {
    904           if (!wasquote) {
    905             wasquote = TRUE;
    906             memmove(p, p + 1, strlen(p));
    907             while (*p == ' ' || *p == '\t')
    908               p++;
    909           }
    910           else {
    911             memmove(p, p + 1, strlen(p));
    912             break;
    913           }
    914         }
    915         else
    916           p++;
     903        if (*p == '\"') {
     904          if (!wasquote) {
     905            wasquote = TRUE;
     906            memmove(p, p + 1, strlen(p));
     907            while (*p == ' ' || *p == '\t')
     908              p++;
     909          }
     910          else {
     911            memmove(p, p + 1, strlen(p));
     912            break;
     913          }
     914        }
     915        else
     916          p++;
    917917      } // while
    918918      if (*p) {
    919         *p = 0;
    920         p++;
     919        *p = 0;
     920        p++;
    921921      }
    922922      else
    923         p = NullStr;
     923        p = NullStr;
    924924      if (*p)
    925         strcpy(pszArgs, p);
     925        strcpy(pszArgs, p);
    926926
    927927      p = strrchr(pszPgm, '.');
    928928      if (p) {
    929         char temp[CCHMAXPATH + 1];
    930 
    931         if (!stricmp(p, ".BAT")) {
    932           strcpy(temp, pszPgm);
    933           strcpy(pszPgm, pszArgs);
    934           strcpy(pszArgs, "/C ");
    935           strcat(pszArgs, temp);
    936           strcat(pszArgs, " ");
    937           strcat(pszArgs, pszPgm);
    938           strcpy(pszPgm, GetCmdSpec(TRUE));             // DOS
    939         }
    940         else if (!stricmp(p, ".CMD") || !stricmp(p, ".BTM")) {
    941           // Assume 4OS2 is BTM
    942           strcpy(temp, pszPgm);
    943           strcpy(pszPgm, pszArgs);
    944           strcpy(pszArgs, "/C ");
    945           strcat(pszArgs, temp);
    946           strcat(pszArgs, " ");
    947           strcat(pszArgs, pszPgm);
    948           strcpy(pszPgm, GetCmdSpec(FALSE));            // OS/2
    949         }
     929        char temp[CCHMAXPATH + 1];
     930
     931        if (!stricmp(p, ".BAT")) {
     932          strcpy(temp, pszPgm);
     933          strcpy(pszPgm, pszArgs);
     934          strcpy(pszArgs, "/C ");
     935          strcat(pszArgs, temp);
     936          strcat(pszArgs, " ");
     937          strcat(pszArgs, pszPgm);
     938          strcpy(pszPgm, GetCmdSpec(TRUE));             // DOS
     939        }
     940        else if (!stricmp(p, ".CMD") || !stricmp(p, ".BTM")) {
     941          // Assume 4OS2 is BTM
     942          strcpy(temp, pszPgm);
     943          strcpy(pszPgm, pszArgs);
     944          strcpy(pszArgs, "/C ");
     945          strcat(pszArgs, temp);
     946          strcat(pszArgs, " ");
     947          strcat(pszArgs, pszPgm);
     948          strcpy(pszPgm, GetCmdSpec(FALSE));            // OS/2
     949        }
    950950      }
    951951
     
    953953
    954954      if (strlen(pszPgm) + strlen(pszArgs) > 1024)
    955         pszArgs[1024 - strlen(pszPgm)] = 0;
     955        pszArgs[1024 - strlen(pszPgm)] = 0;
    956956
    957957      if (!strchr(pszPgm, '\\') &&
    958           !strchr(pszPgm, ':') &&
    959           pszDirectory &&
    960           *pszDirectory)
     958          !strchr(pszPgm, ':') &&
     959          pszDirectory &&
     960          *pszDirectory)
    961961      {
    962         strcpy(szSavedir, pFM2SaveDirectory);
    963         switch_to(pszDirectory);
     962        strcpy(szSavedir, pFM2SaveDirectory);
     963        switch_to(pszDirectory);
    964964      }
    965965      rc = DosQueryAppType(pszPgm,&ulAppType);
    966966      if (!strchr(pszPgm, '\\') &&
    967           !strchr(pszPgm, ':') &&
    968           pszDirectory &&
    969           *pszDirectory)
    970         switch_to(szSavedir);
     967          !strchr(pszPgm, ':') &&
     968          pszDirectory &&
     969          *pszDirectory)
     970        switch_to(szSavedir);
    971971      if (rc) {
    972         Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
    973                   GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
    974                   pszPgm, pszCallingFile, uiLineNumber);        // 26 May 08 SHL
    975         DosFreeMem(pszPgm);
    976         if (pszArgs)
    977           DosFreeMem(pszArgs);
    978         return -1;
     972        Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,
     973                  GetPString(IDS_DOSQAPPTYPEFAILEDTEXT),
     974                  pszPgm, pszCallingFile, uiLineNumber);        // 26 May 08 SHL
     975        DosFreeMem(pszPgm);
     976        if (pszArgs)
     977          DosFreeMem(pszArgs);
     978        return -1;
    979979      }
    980980
    981981      if (ulAppType) {
    982         if (ulAppType & (FAPPTYP_DLL | FAPPTYP_VIRTDRV | FAPPTYP_PHYSDRV | FAPPTYP_PROTDLL))
    983         {
    984           Runtime_Error(pszSrcFile, __LINE__,
    985                         GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
    986                         ulAppType, pszPgm, pszCallingFile, uiLineNumber);  // 26 May 08 SHL
    987           DosFreeMem(pszPgm);
    988           if (pszArgs)
    989             DosFreeMem(pszArgs);
    990           return -1;
    991         }
    992         ulAppType &= ~FAPPTYP_BOUND;
    993         if (ulAppType & (FAPPTYP_DOS | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
    994         {
    995           if (ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
    996           {
    997             if (~type & FULLSCREEN &&
    998                 ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
    999             {
    1000               ret = RunSeamless(pszPgm, pszArgs, hwnd);
    1001               if (pszPgm)
    1002                 DosFreeMem(pszPgm);
    1003               if (pszArgs)
    1004                 DosFreeMem(pszArgs);
    1005               return ret ? 0 : -1;
    1006             }
    1007             else {
    1008               strcat(pszPgm, " ");
    1009               strcat(pszPgm, pszArgs);
    1010               *pszArgs = 0;
    1011               if (ulAppType & (FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT31))
    1012                 strcat(pszArgs, "/3 ");
    1013               strcat(pszArgs, pszPgm);
    1014               strcpy(pszPgm, "WINOS2.COM");
    1015             }
    1016           }
    1017           else {
    1018             if (~type & FULLSCREEN) {
    1019               type |= WINDOWED;
    1020               ulAppType = SSF_TYPE_WINDOWEDVDM;
    1021             }
    1022             else {
    1023               type &= ~WINDOWED;
    1024               ulAppType = SSF_TYPE_VDM;
    1025             }
    1026           }
    1027         }
    1028         else if (ulAppType & FAPPTYP_32BIT) {
    1029           ulAppType &= ~FAPPTYP_32BIT;
    1030           if (ulAppType == FAPPTYP_WINDOWAPI)
    1031             ulAppType = SSF_TYPE_PM;
    1032           else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
    1033             ulAppType = SSF_TYPE_WINDOWABLEVIO;
    1034           else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
    1035             ulAppType = SSF_TYPE_FULLSCREEN;
    1036             type &= ~WINDOWED;
    1037             type |= FULLSCREEN;
    1038           }
    1039           else                          /* ? */
    1040             ulAppType = SSF_TYPE_WINDOWABLEVIO;
    1041         }
    1042         else if (ulAppType == FAPPTYP_WINDOWAPI)
    1043           ulAppType = SSF_TYPE_PM;
    1044         else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
    1045           ulAppType = SSF_TYPE_WINDOWABLEVIO;
    1046         else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
    1047           type &= ~WINDOWED;
    1048           ulAppType = SSF_TYPE_FULLSCREEN;
    1049         }
    1050         else
    1051           ulAppType = SSF_TYPE_DEFAULT;
    1052         if ((type & FULLSCREEN || ~type & WINDOWED) &&
    1053             ulAppType == SSF_TYPE_WINDOWABLEVIO)
    1054         {
    1055           ulAppType = SSF_TYPE_FULLSCREEN;
    1056         }
    1057         // fixme parens?
    1058         else if (type & FULLSCREEN ||
    1059                 (type & WINDOWED && ulAppType == SSF_TYPE_WINDOWEDVDM))
    1060         {
    1061           ulAppType = SSF_TYPE_VDM;
    1062         }
     982        if (ulAppType & (FAPPTYP_DLL | FAPPTYP_VIRTDRV | FAPPTYP_PHYSDRV | FAPPTYP_PROTDLL))
     983        {
     984          Runtime_Error(pszSrcFile, __LINE__,
     985                        GetPString(IDS_APPTYPEUNEXPECTEDTEXT),
     986                        ulAppType, pszPgm, pszCallingFile, uiLineNumber);  // 26 May 08 SHL
     987          DosFreeMem(pszPgm);
     988          if (pszArgs)
     989            DosFreeMem(pszArgs);
     990          return -1;
     991        }
     992        ulAppType &= ~FAPPTYP_BOUND;
     993        if (ulAppType & (FAPPTYP_DOS | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
     994        {
     995          if (ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
     996          {
     997            if (~type & FULLSCREEN &&
     998                ulAppType & (FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSPROT31))
     999            {
     1000              ret = RunSeamless(pszPgm, pszArgs, hwnd);
     1001              if (pszPgm)
     1002                DosFreeMem(pszPgm);
     1003              if (pszArgs)
     1004                DosFreeMem(pszArgs);
     1005              return ret ? 0 : -1;
     1006            }
     1007            else {
     1008              strcat(pszPgm, " ");
     1009              strcat(pszPgm, pszArgs);
     1010              *pszArgs = 0;
     1011              if (ulAppType & (FAPPTYP_WINDOWSPROT | FAPPTYP_WINDOWSREAL | FAPPTYP_WINDOWSPROT31))
     1012                strcat(pszArgs, "/3 ");
     1013              strcat(pszArgs, pszPgm);
     1014              strcpy(pszPgm, "WINOS2.COM");
     1015            }
     1016          }
     1017          else {
     1018            if (~type & FULLSCREEN) {
     1019              type |= WINDOWED;
     1020              ulAppType = SSF_TYPE_WINDOWEDVDM;
     1021            }
     1022            else {
     1023              type &= ~WINDOWED;
     1024              ulAppType = SSF_TYPE_VDM;
     1025            }
     1026          }
     1027        }
     1028        else if (ulAppType & FAPPTYP_32BIT) {
     1029          ulAppType &= ~FAPPTYP_32BIT;
     1030          if (ulAppType == FAPPTYP_WINDOWAPI)
     1031            ulAppType = SSF_TYPE_PM;
     1032          else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
     1033            ulAppType = SSF_TYPE_WINDOWABLEVIO;
     1034          else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
     1035            ulAppType = SSF_TYPE_FULLSCREEN;
     1036            type &= ~WINDOWED;
     1037            type |= FULLSCREEN;
     1038          }
     1039          else                          /* ? */
     1040            ulAppType = SSF_TYPE_WINDOWABLEVIO;
     1041        }
     1042        else if (ulAppType == FAPPTYP_WINDOWAPI)
     1043          ulAppType = SSF_TYPE_PM;
     1044        else if (ulAppType == FAPPTYP_WINDOWCOMPAT)
     1045          ulAppType = SSF_TYPE_WINDOWABLEVIO;
     1046        else if (ulAppType == FAPPTYP_NOTWINDOWCOMPAT) {
     1047          type &= ~WINDOWED;
     1048          ulAppType = SSF_TYPE_FULLSCREEN;
     1049        }
     1050        else
     1051          ulAppType = SSF_TYPE_DEFAULT;
     1052        if ((type & FULLSCREEN || ~type & WINDOWED) &&
     1053            ulAppType == SSF_TYPE_WINDOWABLEVIO)
     1054        {
     1055          ulAppType = SSF_TYPE_FULLSCREEN;
     1056        }
     1057        // fixme parens?
     1058        else if (type & FULLSCREEN ||
     1059                (type & WINDOWED && ulAppType == SSF_TYPE_WINDOWEDVDM))
     1060        {
     1061          ulAppType = SSF_TYPE_VDM;
     1062        }
    10631063      }
    10641064      if (ulAppType == SSF_TYPE_WINDOWEDVDM && type & SEPARATEKEEP) {
    1065         type &= ~SEPARATEKEEP;
    1066         type |= SEPARATE;
     1065        type &= ~SEPARATEKEEP;
     1066        type |= SEPARATE;
    10671067      }
    10681068
     
    10701070
    10711071      if (~type & WAIT)
    1072         useTermQ = FALSE;
     1072        useTermQ = FALSE;
    10731073      else {
    1074         rc = 0;
    1075         DosEnterCritSec();
    1076         if (!hTermQ) {
    1077           // Create term queue and event semaphore just once
    1078           sprintf(szTermQName, TERMQ_BASE_NAME "_%x", ppib->pib_ulpid);
    1079           rc = DosCreateQueue(&hTermQ, QUE_FIFO | QUE_CONVERT_ADDRESS, szTermQName);
    1080           if (rc) {
    1081             hTermQ = (HQUEUE)0;         // Try to survive
    1082             DosExitCritSec();
    1083             Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosCreateQueue");
    1084           }
    1085           else {
    1086             rc = DosCreateEventSem(NULL,(PHEV)&hTermQSem,0,FALSE);
    1087             if (rc) {
    1088                 hTermQSem = (HEV)0;     // Try to survive
    1089                 DosCloseQueue(hTermQ);
    1090                 hTermQ = (HQUEUE)0;     // Try to survive
    1091                 DosExitCritSec();
    1092                 Dos_Error(MB_ENTER,rc,HWND_DESKTOP,pszSrcFile,__LINE__,"DoCreateEventSem");
    1093             }
    1094             // if (!rc) fprintf(stderr,"%s %d qcreated ptib %x hTermQ %x\n",__FILE__, __LINE__,ptib,hTermQ);
    1095           }
    1096         } // if 1st time
    1097         useTermQ = hTermQ && hTermQSem;
    1098         if (!rc)
    1099           DosExitCritSec();
     1074        rc = 0;
     1075        DosEnterCritSec();
     1076        if (!hTermQ) {
     1077          // Create term queue and event semaphore just once
     1078          sprintf(szTermQName, TERMQ_BASE_NAME "_%x", ppib->pib_ulpid);
     1079          rc = DosCreateQueue(&hTermQ, QUE_FIFO | QUE_CONVERT_ADDRESS, szTermQName);
     1080          if (rc) {
     1081            hTermQ = (HQUEUE)0;         // Try to survive
     1082            DosExitCritSec();
     1083            Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosCreateQueue");
     1084          }
     1085          else {
     1086            rc = DosCreateEventSem(NULL,(PHEV)&hTermQSem,0,FALSE);
     1087            if (rc) {
     1088                hTermQSem = (HEV)0;     // Try to survive
     1089                DosCloseQueue(hTermQ);
     1090                hTermQ = (HQUEUE)0;     // Try to survive
     1091                DosExitCritSec();
     1092                Dos_Error(MB_ENTER,rc,HWND_DESKTOP,pszSrcFile,__LINE__,"DoCreateEventSem");
     1093            }
     1094            // if (!rc) fprintf(stderr,"%s %d qcreated ptib %x hTermQ %x\n",__FILE__, __LINE__,ptib,hTermQ);
     1095          }
     1096        } // if 1st time
     1097        useTermQ = hTermQ && hTermQSem;
     1098        if (!rc)
     1099          DosExitCritSec();
    11001100      } // if wait
    11011101
     
    11031103      sdata.Length = sizeof(sdata);
    11041104      sdata.Related = type & (WAIT | CHILD) ? SSF_RELATED_CHILD :
    1105                                               SSF_RELATED_INDEPENDENT;
     1105                                              SSF_RELATED_INDEPENDENT;
    11061106      sdata.FgBg = type & BACKGROUND ? SSF_FGBG_BACK : SSF_FGBG_FORE;
    11071107      sdata.TraceOpt = SSF_TRACEOPT_NONE;
    11081108      sdata.PgmName = pszPgm;
    11091109      if (*pszArgs)
    1110         sdata.PgmInputs = (PBYTE)pszArgs;
     1110        sdata.PgmInputs = (PBYTE)pszArgs;
    11111111      if (useTermQ)
    1112         sdata.TermQ = (PBYTE)szTermQName;
     1112        sdata.TermQ = (PBYTE)szTermQName;
    11131113      sdata.Environment = (PBYTE)pszEnvironment;
    11141114      sdata.InheritOpt = SSF_INHERTOPT_PARENT;
     
    11171117      sdata.ObjectBuffLen = sizeof(szObject);
    11181118      if ((type & RUNTYPE_MASK) == SEPARATEKEEP)
    1119         sdata.PgmControl |= SSF_CONTROL_NOAUTOCLOSE;
     1119        sdata.PgmControl |= SSF_CONTROL_NOAUTOCLOSE;
    11201120      if (type & MAXIMIZED)
    1121         sdata.PgmControl |= SSF_CONTROL_MAXIMIZE;
     1121        sdata.PgmControl |= SSF_CONTROL_MAXIMIZE;
    11221122      if (type & MINIMIZED)
    1123         sdata.PgmControl |= SSF_CONTROL_MINIMIZE;
     1123        sdata.PgmControl |= SSF_CONTROL_MINIMIZE;
    11241124      if (type & INVISIBLE)
    1125         sdata.PgmControl |= SSF_CONTROL_INVISIBLE;
     1125        sdata.PgmControl |= SSF_CONTROL_INVISIBLE;
    11261126
    11271127      if (pszDirectory && *pszDirectory) {
    1128         strcpy(szSavedir, pFM2SaveDirectory);
    1129         switch_to(pszDirectory);
     1128        strcpy(szSavedir, pFM2SaveDirectory);
     1129        switch_to(pszDirectory);
    11301130      }
    11311131      ret = DosStartSession(&sdata, &ulSessID, &sessPID);
     
    11331133
    11341134      if (pszDirectory && *pszDirectory)
    1135         switch_to(szSavedir);
     1135        switch_to(szSavedir);
    11361136
    11371137      if (ret && ret != ERROR_SMG_START_IN_BACKGROUND) {
    1138         if (!fNoErrorMsg)
    1139         Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,
    1140                   GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs,
    1141                   pszCallingFile, uiLineNumber);        // 26 May 08 SHL
     1138        if (!fNoErrorMsg)
     1139        Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__,
     1140                  GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs,
     1141                  pszCallingFile, uiLineNumber);        // 26 May 08 SHL
    11421142      }
    11431143      else if (type & WAIT) {
    1144         if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE)))
    1145           ShowSession(hwnd, sessPID);
    1146 
    1147         if (!useTermQ) {
    1148           STATUSDATA sd;
    1149 
    1150           memset(&sd, 0, sizeof(sd));
    1151           sd.Length = (USHORT) sizeof(sd);
    1152           sd.SelectInd = SET_SESSION_UNCHANGED;
    1153           sd.BondInd = SET_SESSION_UNCHANGED;
    1154           for (ctr = 0;; ctr++)
    1155           {
    1156             DosSleep(100);//05 Aug 07 GKY 200
    1157             if (DosSetSession(ulSessID, &sd))   // Check if session gone (i.e. finished)
    1158               break;
    1159             if (ctr > 10) {
    1160               ShowSession(hwnd, sessPID);       // Show every 2 seconds
    1161               ctr = 0;
    1162             }
    1163           }
    1164         }
    1165         else {
    1166           for (ctr = 0;; ctr++)
    1167           {
    1168             if (ctr < 20) {
    1169               rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
    1170                                 DCWW_NOWAIT, &bPriority, hTermQSem);
    1171               if (rc == ERROR_QUE_EMPTY) {
    1172                 DosSleep(50);//05 Aug 07 GKY 100
    1173                 continue;
    1174               }
    1175             }
    1176             else {
    1177               if (ctr == 20) {
    1178                 ShowSession(hwnd, sessPID);             // Show long running session
    1179               }
    1180               rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
    1181                                 DCWW_WAIT, &bPriority, 0);
    1182             }
    1183 
    1184             if (rc) {
    1185               // Oh heck
    1186               Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosReadQueue");
    1187               DosSleep(100);//05 Aug 07 GKY 500
    1188               continue;
    1189             }
    1190 
    1191             //  printf("%s %d DosReadQueue thread 0x%x sess %u sessRC %u rq.pid 0x%x rq.data 0x%x\n",
    1192             //       __FILE__, __LINE__,ptib->tib_ordinal,pTermInfo->usSessID,pTermInfo->usRC,rq.pid, rq.ulData); fflush(stdout);
    1193 
    1194             if (pTermInfo->usSessID == ulSessID)
    1195               break;                    // Our session is done
    1196 
    1197             // Requeue session for other thread
    1198             {
    1199               static ULONG ulLastSessID;
    1200               // printf("%s %d requeue thread 0x%x our sess %u term sess %u term rc %u\n",
    1201               //       __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,pTermInfo->usSessID,pTermInfo->usRC); fflush(stdout);
    1202               // fixme to be gone when no longer needed for debug?
    1203               if (ulLastSessID) {
    1204                 DosSleep(100);//05 Aug 07 GKY 500
    1205                 ulLastSessID = pTermInfo->usSessID;
    1206               }
    1207               // requeue term report for other thread and do not free yet
    1208               rc = DosWriteQueue(hTermQ, rq.ulData, ulLength,(PVOID)pTermInfo, bPriority);
    1209               if (rc)
    1210                 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosWriteQueue");
    1211               DosSleep(50); //05 Aug 07 GKY 100         // Let other thread see queue entry
    1212             }
    1213           } // for
    1214 
    1215           ret = pTermInfo->usRC == 0;           // Set 1 if rc 0 else 0
    1216           // printf("%s %d thread 0x%x term for sess %u\n",
    1217           //      __FILE__, __LINE__,ptib->tib_ordinal,ulSessID);fflush(stdout);
    1218           DosFreeMem(pTermInfo);
    1219         }
     1144        if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE)))
     1145          ShowSession(hwnd, sessPID);
     1146
     1147        if (!useTermQ) {
     1148          STATUSDATA sd;
     1149
     1150          memset(&sd, 0, sizeof(sd));
     1151          sd.Length = (USHORT) sizeof(sd);
     1152          sd.SelectInd = SET_SESSION_UNCHANGED;
     1153          sd.BondInd = SET_SESSION_UNCHANGED;
     1154          for (ctr = 0;; ctr++)
     1155          {
     1156            DosSleep(100);//05 Aug 07 GKY 200
     1157            if (DosSetSession(ulSessID, &sd))   // Check if session gone (i.e. finished)
     1158              break;
     1159            if (ctr > 10) {
     1160              ShowSession(hwnd, sessPID);       // Show every 2 seconds
     1161              ctr = 0;
     1162            }
     1163          }
     1164        }
     1165        else {
     1166          for (ctr = 0;; ctr++)
     1167          {
     1168            if (ctr < 20) {
     1169              rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
     1170                                DCWW_NOWAIT, &bPriority, hTermQSem);
     1171              if (rc == ERROR_QUE_EMPTY) {
     1172                DosSleep(50);//05 Aug 07 GKY 100
     1173                continue;
     1174              }
     1175            }
     1176            else {
     1177              if (ctr == 20) {
     1178                ShowSession(hwnd, sessPID);             // Show long running session
     1179              }
     1180              rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0,
     1181                                DCWW_WAIT, &bPriority, 0);
     1182            }
     1183
     1184            if (rc) {
     1185              // Oh heck
     1186              Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosReadQueue");
     1187              DosSleep(100);//05 Aug 07 GKY 500
     1188              continue;
     1189            }
     1190
     1191            //  printf("%s %d DosReadQueue thread 0x%x sess %u sessRC %u rq.pid 0x%x rq.data 0x%x\n",
     1192            //       __FILE__, __LINE__,ptib->tib_ordinal,pTermInfo->usSessID,pTermInfo->usRC,rq.pid, rq.ulData); fflush(stdout);
     1193
     1194            if (pTermInfo->usSessID == ulSessID)
     1195              break;                    // Our session is done
     1196
     1197            // Requeue session for other thread
     1198            {
     1199              static ULONG ulLastSessID;
     1200              // printf("%s %d requeue thread 0x%x our sess %u term sess %u term rc %u\n",
     1201              //       __FILE__, __LINE__,ptib->tib_ordinal,ulSessID,pTermInfo->usSessID,pTermInfo->usRC); fflush(stdout);
     1202              // fixme to be gone when no longer needed for debug?
     1203              if (ulLastSessID) {
     1204                DosSleep(100);//05 Aug 07 GKY 500
     1205                ulLastSessID = pTermInfo->usSessID;
     1206              }
     1207              // requeue term report for other thread and do not free yet
     1208              rc = DosWriteQueue(hTermQ, rq.ulData, ulLength,(PVOID)pTermInfo, bPriority);
     1209              if (rc)
     1210                Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__,"DosWriteQueue");
     1211              DosSleep(50); //05 Aug 07 GKY 100         // Let other thread see queue entry
     1212            }
     1213          } // for
     1214
     1215          ret = pTermInfo->usRC == 0;           // Set 1 if rc 0 else 0
     1216          // printf("%s %d thread 0x%x term for sess %u\n",
     1217          //      __FILE__, __LINE__,ptib->tib_ordinal,ulSessID);fflush(stdout);
     1218          DosFreeMem(pTermInfo);
     1219        }
    12201220      } // if wait
    12211221      else if (!(type & (BACKGROUND | MINIMIZED | INVISIBLE)))
    1222         ShowSession(hwnd, sessPID);
     1222        ShowSession(hwnd, sessPID);
    12231223    }
    12241224  }
     
    12371237#if 0  // JBS   11 Sep 08
    12381238HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env,
    1239           PROGTYPE *progt, ULONG fl, char *formatstring,...)
     1239          PROGTYPE *progt, ULONG fl, char *formatstring,...)
    12401240{
    12411241  PROGDETAILS pgd;
     
    12591259      parameters = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__);
    12601260      if (parameters) {
    1261         p = executable;
    1262         wasquote = FALSE;
    1263         while (*p && (wasquote || (*p != ' ' && *p != '\t'))) {
    1264           if (*p == '\"') {
    1265             if (!wasquote) {
    1266               wasquote = TRUE;
    1267               memmove(p, p + 1, strlen(p));
    1268               while (*p == ' ' || *p == '\t')
    1269                 p++;
    1270             }
    1271             else {
    1272               memmove(p, p + 1, strlen(p));
    1273               break;
    1274             }
    1275           }
    1276           else
    1277             p++;
    1278         }
    1279         if (*p) {
    1280           *p = 0;
    1281           p++;
    1282         }
    1283         else
    1284           p = NullStr;
    1285         if (*p)
    1286           strcpy(parameters, p);
    1287 
    1288         if (p && (!stricmp(p, ".BAT") || !stricmp(p, ".CMD"))) {
    1289           char *temp;
    1290 
    1291           temp = xmalloc(CCHMAXPATH * 2,pszSrcFile,__LINE__);
    1292           if (temp) {
    1293             if (!stricmp(p, ".BAT")) {
    1294               strcpy(temp, executable);
    1295               strcpy(executable, parameters);
    1296               strcpy(parameters, "/C ");
    1297               strcat(parameters, temp);
    1298               strcat(parameters, " ");
    1299               strcat(parameters, executable);
    1300               strcpy(executable, GetCmdSpec(TRUE));
    1301             }
    1302             else if (!stricmp(p, ".CMD")) {
    1303               strcpy(temp, executable);
    1304               strcpy(executable, parameters);
    1305               strcpy(parameters, "/C ");
    1306               strcat(parameters, temp);
    1307               strcat(parameters, " ");
    1308               strcat(parameters, executable);
    1309               strcpy(executable, GetCmdSpec(FALSE));
    1310             }
    1311             free(temp);
    1312           }
    1313         }
    1314 
    1315         memset(&pgd, 0, sizeof(pgd));
    1316         pgd.Length = sizeof(pgd);
    1317         pgd.progt = *progt;
    1318         pgd.swpInitial.fl = fl;
    1319         pgd.pszEnvironment = env;
    1320         pgd.pszStartupDir = startdir;
    1321         pgd.pszParameters = *parameters ? parameters : NULL;
    1322         pgd.pszExecutable = executable;
    1323         pgd.swpInitial.hwndInsertBehind = HWND_TOP;
    1324         happ = WinStartApp(hwndNotify, &pgd, NULL, NULL, ulOptions);
    1325         free(parameters);
     1261        p = executable;
     1262        wasquote = FALSE;
     1263        while (*p && (wasquote || (*p != ' ' && *p != '\t'))) {
     1264          if (*p == '\"') {
     1265            if (!wasquote) {
     1266              wasquote = TRUE;
     1267              memmove(p, p + 1, strlen(p));
     1268              while (*p == ' ' || *p == '\t')
     1269                p++;
     1270            }
     1271            else {
     1272              memmove(p, p + 1, strlen(p));
     1273              break;
     1274            }
     1275          }
     1276          else
     1277            p++;
     1278        }
     1279        if (*p) {
     1280          *p = 0;
     1281          p++;
     1282        }
     1283        else
     1284          p = NullStr;
     1285        if (*p)
     1286          strcpy(parameters, p);
     1287
     1288        if (p && (!stricmp(p, ".BAT") || !stricmp(p, ".CMD"))) {
     1289          char *temp;
     1290
     1291          temp = xmalloc(CCHMAXPATH * 2,pszSrcFile,__LINE__);
     1292          if (temp) {
     1293            if (!stricmp(p, ".BAT")) {
     1294              strcpy(temp, executable);
     1295              strcpy(executable, parameters);
     1296              strcpy(parameters, "/C ");
     1297              strcat(parameters, temp);
     1298              strcat(parameters, " ");
     1299              strcat(parameters, executable);
     1300              strcpy(executable, GetCmdSpec(TRUE));
     1301            }
     1302            else if (!stricmp(p, ".CMD")) {
     1303              strcpy(temp, executable);
     1304              strcpy(executable, parameters);
     1305              strcpy(parameters, "/C ");
     1306              strcat(parameters, temp);
     1307              strcat(parameters, " ");
     1308              strcat(parameters, executable);
     1309              strcpy(executable, GetCmdSpec(FALSE));
     1310            }
     1311            free(temp);
     1312          }
     1313        }
     1314
     1315        memset(&pgd, 0, sizeof(pgd));
     1316        pgd.Length = sizeof(pgd);
     1317        pgd.progt = *progt;
     1318        pgd.swpInitial.fl = fl;
     1319        pgd.pszEnvironment = env;
     1320        pgd.pszStartupDir = startdir;
     1321        pgd.pszParameters = *parameters ? parameters : NULL;
     1322        pgd.pszExecutable = executable;
     1323        pgd.swpInitial.hwndInsertBehind = HWND_TOP;
     1324        happ = WinStartApp(hwndNotify, &pgd, NULL, NULL, ulOptions);
     1325        free(parameters);
    13261326      }
    13271327    }
  • trunk/dll/systemf.h

    r1271 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2009 Steven H. Levine
    1010
    1111  Change log
     
    4848EXECARGS;
    4949
    50 INT ExecOnList(HWND hwnd, CHAR * command, INT flags, CHAR * tpath,
    51                CHAR ** list, CHAR * prompt, PCSZ pszCallingFile, UINT uiLineNumber);
     50INT ExecOnList(HWND hwnd, PSZ command, INT flags, PSZ tpath,
     51               PSZ *list, PCSZ prompt, PCSZ pszCallingFile, UINT uiLineNumber);
    5252BOOL ShowSession(HWND hwnd, PID pid);
    5353INT runemf2(INT type, HWND hwnd, PCSZ pszCallingFile, UINT uiLineNumber,
    54             CHAR * directory, CHAR * environment,
    55             CHAR * formatstring, ...);
     54            PSZ directory, PSZ environment,
     55            PSZ formatstring, ...);
    5656
    5757
  • trunk/dll/treecnr.c

    r1391 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    5656  27 Dec 08 GKY Add refresh removable media to tree container menus
    5757  28 Dec 08 GKY Rework partition submenu to gray out unavailable items (check for existence of files)
    58                 and have no default choice.
     58                and have no default choice.
    5959  01 Jan 09 GKY Add Seek and Scan to drives & directory context menus pass drive/dir as search root
    6060  11 Jan 09 GKY Replace font names in the string file with global set at compile in init.c
     
    248248                   MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
    249249  if (pci && (INT) pci != -1 && !stricmp(pci->pszFileName, dirname)) {
    250     // DbgMsg(pszSrcFile, __LINE__, "already at %s collapse %u maketop %u", dirname, collapsefirst, maketop);   // 14 Aug 07 SHL fixme
    251250    quickbail = TRUE;                   // Bypass repositioning
    252251    goto MakeTop;
    253252  }
    254253  WinEnableWindowUpdate(hwndCnr, FALSE);
    255   // DbgMsg(pszSrcFile, __LINE__, "finding %s collapse %u maketop %u", dirname, collapsefirst, maketop);        // 14 Aug 07 SHL fixme
    256254  pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
    257255  if (!pci || (INT) pci == -1) {
     
    285283    pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
    286284  }
    287   // DbgMsg(pszSrcFile, __LINE__, "found");     // 14 Aug 07 SHL fixme
    288285  if (pci && (INT) pci != -1) {
    289286    if (~pci->rc.flRecordAttr & CRA_CURSORED) {
    290287      if (collapsefirst) {
    291         // DbgMsg(pszSrcFile, __LINE__, "collapsing");  // 14 Aug 07 SHL fixme
    292288        pciP = WinSendMsg(hwndCnr,
    293289                          CM_QUERYRECORD,
    294290                          MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    295291        while (pciP && (INT) pciP != -1) {
    296 #if 1 // // 05 Jan 08 SHL fixme to be sure this is correct code
     292#if 1 // 05 Jan 08 SHL fixme to be sure this is correct code
    297293          if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
    298294            // collapse top level of all branches
     
    317313      }
    318314      /* expand all parent branches */
    319       // DbgMsg(pszSrcFile, __LINE__, "expanding parents");     // 14 Aug 07 SHL fixme
    320315      pciToSelect = pci;
    321316      for (;;) {
     
    336331    /* make record visible */
    337332  MakeTop:
    338     // DbgMsg(pszSrcFile, __LINE__, "moving into view");        // 14 Aug 07 SHL fixme
    339333    pciToSelect = pci;
    340334    if (pciToSelect && (INT) pciToSelect != -1) {
     
    343337      }
    344338      if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) {
    345         // DbgMsg(pszSrcFile, __LINE__, "expanding current");   // 14 Aug 07 SHL fixme
    346339        WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
    347         // DbgMsg(pszSrcFile, __LINE__, "expanded");    // 14 Aug 07 SHL fixme
    348340      }
    349341      if (!quickbail) {
     
    355347    }
    356348  }
    357   // DbgMsg(pszSrcFile, __LINE__, "done");      // 14 Aug 07 SHL fixme
    358349  WinEnableWindowUpdate(hwndCnr, TRUE);
    359350  // DosSleep(1);                       // Let GUI update
     
    540531                                   MPARAM mp2)
    541532{
    542 
    543533  switch (msg) {
    544534  case UM_CONTAINERHWND:
     
    623613
    624614  switch (msg) {
    625   case WM_CREATE:
    626     DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2);  // 18 Jul 08 SHL fixme
    627     break;
    628 
    629615  case UM_SHOWME:
    630     // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME mp1 %p mp2 %p", mp1, mp2);       // 14 Aug 07 SHL fixme
    631616    if (mp1) {
    632617#     ifdef FORTIFY
     
    634619#     endif
    635620      dcd = INSTDATA(hwnd);
    636       // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME dcd %p", dcd); // 14 Aug 07 SHL fixme
    637621      if (dcd) {
    638622        BOOL tempsusp, tempfollow, temptop;
     
    706690      while (list[numentries])
    707691        numentries++;
    708       if (numentries) {
    709         //DbgMsg(pszSrcFile, __LINE__, "UM_UPDATERECORD %s", *list);
    710         UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
    711       }
     692      if (numentries)
     693        UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
    712694    }
    713695    return 0;
     
    981963
    982964  switch (msg) {
    983   case WM_CREATE:
    984     DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2);  // 18 Jul 08 SHL fixme
    985     break;
    986 
    987965  case DM_PRINTOBJECT:
    988966    return MRFROMLONG(DRR_TARGET);
     
    11901168  case UM_UPDATERECORD:
    11911169    if (dcd && mp1) {
    1192 
    11931170      CHAR *filename;
    1194 
    11951171      filename = mp1;
    11961172      if (filename) {
    1197         //DbgMsg(pszSrcFile, __LINE__, "UM_UPDATERECORD %s", filename);
    1198         UpdateCnrRecord(hwnd, filename, TRUE, dcd);
     1173        UpdateCnrRecord(hwnd, filename, TRUE, dcd);
    11991174      }
    12001175    }
     
    13301305        cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
    13311306        cnri.flWindowAttr |= CV_FLOW;
    1332         dcd->flWindowAttr = cnri.flWindowAttr;
     1307        dcd->flWindowAttr = cnri.flWindowAttr;
    13331308        WinSendMsg(hwnd,
    13341309                   CM_SETCNRINFO,
    13351310                   MPFROMP(&cnri),
    13361311                   MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
    1337                               CMA_CXTREEINDENT | CMA_PSORTRECORD));
     1312                              CMA_CXTREEINDENT | CMA_PSORTRECORD));
    13381313        if (xbeginthread(MakeObjWin,
    13391314                         327680,
     
    14311406          DrgFreeDraginfo(pDInfo);
    14321407        }
    1433         return 0;
     1408        return 0;
    14341409
    14351410      case CN_DROPHELP:
     
    14491424          else {
    14501425            numitems = DrgQueryDragitemCount(pDInfo);
    1451             usOperation = pDInfo->usOperation;
    1452             if (usOperation == DO_DEFAULT)
    1453               usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
     1426            usOperation = pDInfo->usOperation;
     1427            if (usOperation == DO_DEFAULT)
     1428              usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
    14541429            FreeDragInfoData(hwnd, pDInfo);
    14551430            saymsg(MB_ENTER | MB_ICONASTERISK,
     
    18651840              }
    18661841            }
    1867             else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
     1842            else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
    18681843              if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir)
    18691844                PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
     
    19961971                                DRIVE_NOLOADICONS | DRIVE_NOLOADSUBJS |
    19971972                                DRIVE_NOLOADLONGS | DRIVE_INCLUDEFILES |
    1998                                 DRIVE_SLOW | DRIVE_NOSTATS |
    1999                                 DRIVE_WRITEVERIFYOFF);
     1973                                DRIVE_SLOW | DRIVE_NOSTATS |
     1974                                DRIVE_WRITEVERIFYOFF);
    20001975
    20011976              if (removable == 1)
     
    20262001                  strcmp(FileSystem, FAT32) &&
    20272002                  strcmp(FileSystem, NDFS32) &&
    2028                   strcmp(FileSystem, NTFS) &&
     2003                  strcmp(FileSystem, NTFS) &&
    20292004                  strcmp(FileSystem, HPFS386)) {
    20302005                driveflags[x] |= DRIVE_NOLONGNAMES;
    2031               }
     2006              }
    20322007              SelectDriveIcon(pciP);
    20332008              WinSendMsg(hwnd,
     
    22342209            writeable = rdy
    22352210              && !(driveflags[chDrvU - 'A'] & DRIVE_NOTWRITEABLE);
    2236             local = rdy && (!(driveflags[chDrvU - 'A'] & (DRIVE_REMOTE | DRIVE_VIRTUAL)));
     2211            local = rdy && (!(driveflags[chDrvU - 'A'] & (DRIVE_REMOTE | DRIVE_VIRTUAL)));
    22372212            underenv = (pci->flags & RECFLAGS_UNDERENV) != 0;
    22382213
     
    22602235            WinEnableMenuItem((HWND) mp2, IDM_FORMAT, writeable && local);
    22612236            WinEnableMenuItem((HWND) mp2, IDM_OPTIMIZE, writeable && local);
    2262             WinEnableMenuItem((HWND) mp2, IDM_PARTITIONSMENU, local);
    2263             WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
    2264             WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
    2265             WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
    2266             WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
     2237            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONSMENU, local);
     2238            WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
     2239            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
     2240            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
     2241            WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
    22672242
    22682243            WinEnableMenuItem((HWND) mp2, IDM_DETACH, !local);
     
    22912266        CopyPresParams((HWND) mp2, hwndMainMenu);
    22922267        WinEnableMenuItem((HWND) mp2, IDM_RESELECT, FALSE);
    2293         WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
    2294         WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
    2295         WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
    2296         WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
     2268        WinEnableMenuItem((HWND) mp2, IDM_PARTITION, fMiniLVM);
     2269        WinEnableMenuItem((HWND) mp2, IDM_PARTITIONDF, fDFSee);
     2270        WinEnableMenuItem((HWND) mp2, IDM_PARTITIONLVMG, fLVMGui);
     2271        WinEnableMenuItem((HWND) mp2, IDM_PARTITIONFD, fFDisk);
    22972272        break;
    22982273
     
    24522427            pgd.progt.progc = PROG_WINDOWABLEVIO;
    24532428            pgd.progt.fbVisible = SHE_VISIBLE;
    2454             pgd.pszTitle = GetPString(IDS_DETACHREQUESTTEXT);
     2429            pgd.pszTitle = (PSZ)GetPString(IDS_DETACHREQUESTTEXT);
    24552430            pgd.pszExecutable = p;
    24562431            pgd.pszParameters = params;
     
    26422617
    26432618      case IDM_REFRESHREMOVABLES:
    2644         runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED | WAIT,
    2645                 HWND_DESKTOP, pszSrcFile, __LINE__, NULL, NULL,
    2646                 "%s", "LVM.EXE /RediscoverPRM");
    2647         PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
     2619        runemf2(SEPARATE | WINDOWED | BACKGROUND | MINIMIZED | WAIT,
     2620                HWND_DESKTOP, pszSrcFile, __LINE__, NULL, NULL,
     2621                "%s", "LVM.EXE /RediscoverPRM");
     2622        PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    26482623        break;
    26492624
     
    27502725        else
    27512726          StartCollector(dcd->hwndParent, 4);
    2752         if (SHORT1FROMMP(mp1) == IDM_GREP) {
    2753           PCNRITEM pci = NULL;
    2754 
    2755           pci = WinSendMsg(hwnd,
    2756                            CM_QUERYRECORDEMPHASIS,
    2757                            MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
    2758           if (pci && (INT) pci != -1)
    2759             PostMsg(Collector, WM_COMMAND,
    2760                     MPFROM2SHORT(IDM_GREP, 0), MPFROMP(pci->pszFileName));
    2761           else
    2762             PostMsg(Collector, WM_COMMAND,
    2763                     MPFROM2SHORT(IDM_GREP, 0), MPVOID);
    2764         }
    2765         else
     2727        if (SHORT1FROMMP(mp1) == IDM_GREP) {
     2728          PCNRITEM pci = NULL;
     2729
     2730          pci = WinSendMsg(hwnd,
     2731                           CM_QUERYRECORDEMPHASIS,
     2732                           MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
     2733          if (pci && (INT) pci != -1)
     2734            PostMsg(Collector, WM_COMMAND,
     2735                    MPFROM2SHORT(IDM_GREP, 0), MPFROMP(pci->pszFileName));
     2736          else
     2737            PostMsg(Collector, WM_COMMAND,
     2738                    MPFROM2SHORT(IDM_GREP, 0), MPVOID);
     2739        }
     2740        else
    27662741        PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
    27672742        break;
     
    28182793                driveflags[toupper(*pci->pszFileName) - 'A'] &=
    28192794                  (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
    2820                    DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | DRIVE_NOSTATS |
    2821                    DRIVE_WRITEVERIFYOFF);
     2795                   DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | DRIVE_NOSTATS |
     2796                   DRIVE_WRITEVERIFYOFF);
    28222797                DriveFlagsOne(toupper(*pci->pszFileName) - 'A');
    28232798                driveflag = driveflags[toupper(*pci->pszFileName) - 'A'];
     
    31183093      /* kill object window */
    31193094      if (WinIsWindow((HAB) 0, dcd->hwndObject)) {
    3120         if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
    3121           WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
     3095        if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
     3096          WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
    31223097      }
    31233098    }
     
    33023277        }
    33033278        dcd->oldproc = WinSubclassWindow(dcd->hwndCnr, TreeCnrWndProc);
    3304         // DbgMsg(pszSrcFile, __LINE__, "oldproc subclass %X", dcd->oldproc);   // 05 Jul 07 SHL
    33053279        // fixme to document 01 test?
    33063280        if (dcd->oldproc == 0)
  • trunk/dll/valid.c

    r1387 r1394  
    2929  25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
    3030  03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
    31                 Dos/Win programs from being inserted into the execute dialog with message why.
     31                Dos/Win programs from being inserted into the execute dialog with message why.
    3232  03 Jan 09 GKY Modify IsExecutable to prevent some text files from being treated as executable
    33                 and prevent dlls from being loaded into execute dialog.
     33                and prevent dlls from being loaded into execute dialog.
    3434  05 Jan 09 GKY Fix IsBinary to recognize values above \xc4 (maybe lower) as positive.
    35                 When these high codes were it text files they showed as hex in new view.
     35                When these high codes were it text files they showed as hex in new view.
    3636
    3737***********************************************************************/
     
    121121
    122122int TestFDates(char *file1, char *file2, FDATE *datevar1, FTIME *timevar1,
    123                FDATE *datevar2, FTIME *timevar2)
     123               FDATE *datevar2, FTIME *timevar2)
    124124{
    125125  int comp = 0;
     
    140140  if (&datevar1 && &datevar2 && &timevar1 && &timevar2) {
    141141    comp = (datevar2->year >
    142             datevar1->year) ? 1 :
     142            datevar1->year) ? 1 :
    143143      (datevar2->year <
    144144       datevar1->year) ? -1 :
     
    173173
    174174int TestCDates(CDATE *datevar1, CTIME *timevar1,
    175                CDATE *datevar2, CTIME *timevar2)
     175               CDATE *datevar2, CTIME *timevar2)
    176176{
    177177  int comp = 0;
     
    179179  if (&datevar1 && &datevar2 && &timevar1 && &timevar2) {
    180180    comp = (datevar2->year >
    181             datevar1->year) ? 1 :
     181            datevar1->year) ? 1 :
    182182      (datevar2->year <
    183183       datevar1->year) ? -1 :
     
    212212}
    213213
    214 #if 0   // JBS  11 Sep 08
     214#if 0   // JBS  11 Sep 08
    215215BOOL IsDesktop(HAB hab, HWND hwnd)
    216216{
     
    329329    *pulType |= DRIVE_NOTWRITEABLE;
    330330  if (pulType && !strcmp(pfsn, NDFS32)){
    331         *pulType |= DRIVE_VIRTUAL;
     331        *pulType |= DRIVE_VIRTUAL;
    332332    }
    333333  if (pulType && !strcmp(pfsn, RAMFS)){
    334         *pulType |= DRIVE_RAMDISK;
     334        *pulType |= DRIVE_RAMDISK;
    335335    }
    336336  if (((PFSQBUFFER2) pvBuffer)->iType == FSAT_REMOTEDRV &&
     
    359359         !strcmp(pfsn, JFS) ||
    360360         !strcmp(pfsn, FAT32) ||
    361         !strcmp(pfsn, RAMFS) ||
    362         !strcmp(pfsn, NDFS32) ||
    363         !strcmp(pfsn, NTFS) ||
    364         !strcmp(pfsn, HPFS386))) {
     361        !strcmp(pfsn, RAMFS) ||
     362        !strcmp(pfsn, NDFS32) ||
     363        !strcmp(pfsn, NTFS) ||
     364        !strcmp(pfsn, HPFS386))) {
    365365      *pulType &= ~DRIVE_NOLONGNAMES;
    366366    }
     
    401401  NonRemovable = 1;                     // Preset as non removable
    402402  DosError(FERR_DISABLEHARDERR);
    403   rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_BLOCKREMOVABLE, &parmPkt.Cmd,  /*  Address of the command-specific argument list. */
    404                    sizeof(parmPkt.Cmd), /*  Length, in bytes, of pParams. */
    405                    &clParmBytes,        /*  Pointer to the length of parameters. */
    406                    &NonRemovable,       /*  Address of the data area. */
    407                    sizeof(NonRemovable),        /*  Length, in bytes, of pData. */
    408                    &clDataBytes);       /*  Pointer to the length of data. */
     403  rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_BLOCKREMOVABLE, &parmPkt.Cmd,  /* Address of the command-specific argument list. */
     404                   sizeof(parmPkt.Cmd), /* Length, in bytes, of pParams. */
     405                   &clParmBytes,        /* Pointer to the length of parameters. */
     406                   &NonRemovable,       /* Address of the data area. */
     407                   sizeof(NonRemovable),        /* Length, in bytes, of pData. */
     408                   &clDataBytes);       /* Pointer to the length of data. */
    409409
    410410  if (!rc && NonRemovable) {
     
    414414    memset(&dataPkt, 0xff, sizeof(dataPkt));
    415415    DosError(FERR_DISABLEHARDERR);
    416     rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_GETDEVICEPARAMS, &parmPkt.Cmd,       /*  Address of the command-specific argument list. */
    417                      sizeof(parmPkt.Cmd),       /*  Length, in bytes, of pParams. */
    418                      &clParmBytes,      /*  Pointer to the length of parameters. */
    419                      &dataPkt,          /*  Address of the data area. */
    420                      sizeof(dataPkt),   /*  Length, in bytes, of pData. */
    421                      &clDataBytes);     /*  Pointer to the length of data. */
     416    rc = DosDevIOCtl(hDev, IOCTL_DISK, DSK_GETDEVICEPARAMS, &parmPkt.Cmd,       /* Address of the command-specific argument list. */
     417                     sizeof(parmPkt.Cmd),       /* Length, in bytes, of pParams. */
     418                     &clParmBytes,      /* Pointer to the length of parameters. */
     419                     &dataPkt,          /* Address of the data area. */
     420                     sizeof(dataPkt),   /* Length, in bytes, of pData. */
     421                     &clDataBytes);     /* Pointer to the length of data. */
    422422
    423423    if (!rc && (dataPkt.bpb.fsDeviceAttr & BPB_REMOVABLE_MEDIA))
     
    438438BOOL IsFileSame(CHAR * filename1, CHAR * filename2)
    439439{
    440   /* returns:  -1 (error), 0 (is a directory), or 1 (is a file) */
     440  /* returns: -1 (error), 0 (is a directory), or 1 (is a file) */
    441441
    442442  FILESTATUS3L fsa1, fsa2;
     
    463463#endif
    464464
    465 INT IsFile(CHAR * filename)
    466 {
    467   /* returns:  -1 (error), 0 (is a directory), or 1 (is a file) */
     465INT IsFile(PCSZ filename)
     466{
     467  /* returns: -1 (error), 0 (is a directory), or 1 (is a file) */
    468468
    469469  FILESTATUS3 fsa;
     
    487487}
    488488
    489 BOOL IsRoot(CHAR * filename)
     489BOOL IsRoot(PCSZ filename)
    490490{
    491491  return (filename && isalpha(*filename) && filename[1] == ':' &&
     
    608608    }
    609609    if (apptype & (FAPPTYP_DLL |
    610                    FAPPTYP_PHYSDRV |
    611                    FAPPTYP_VIRTDRV |
    612                    FAPPTYP_PROTDLL))
     610                   FAPPTYP_PHYSDRV |
     611                   FAPPTYP_VIRTDRV |
     612                   FAPPTYP_PROTDLL))
    613613      return FALSE;
    614614    if (apptype == 0x000b && (!p ||
    615         (stricmp(p, ".EXE") &&
    616         stricmp(p, ".COM") &&
    617         stricmp(p, ".CMD") &&
    618         stricmp(p, ".BAT") &&
    619         stricmp(p, ".BTM"))))
     615        (stricmp(p, ".EXE") &&
     616        stricmp(p, ".COM") &&
     617        stricmp(p, ".CMD") &&
     618        stricmp(p, ".BAT") &&
     619        stricmp(p, ".BTM"))))
    620620      return FALSE;
    621621    if (!fProtectOnly) {
    622622      if ((!ret && (!apptype ||
    623                     (apptype &
    624                      (FAPPTYP_NOTWINDOWCOMPAT |
    625                       FAPPTYP_WINDOWCOMPAT |
    626                       FAPPTYP_WINDOWAPI |
    627                       FAPPTYP_BOUND |
    628                       FAPPTYP_DOS |
    629                       FAPPTYP_WINDOWSREAL |
    630                       FAPPTYP_WINDOWSPROT |
    631                       FAPPTYP_32BIT |
    632                       FAPPTYP_WINDOWSPROT31)))) ||
    633           (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BAT") || !stricmp(p, ".BTM"))))
    634         return TRUE;
     623                    (apptype &
     624                     (FAPPTYP_NOTWINDOWCOMPAT |
     625                      FAPPTYP_WINDOWCOMPAT |
     626                      FAPPTYP_WINDOWAPI |
     627                      FAPPTYP_BOUND |
     628                      FAPPTYP_DOS |
     629                      FAPPTYP_WINDOWSREAL |
     630                      FAPPTYP_WINDOWSPROT |
     631                      FAPPTYP_32BIT |
     632                      FAPPTYP_WINDOWSPROT31)))) ||
     633          (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BAT") || !stricmp(p, ".BTM"))))
     634        return TRUE;
    635635    }
    636636    else if ((!ret && (!apptype ||
    637                        (apptype &
    638                         (FAPPTYP_NOTWINDOWCOMPAT |
    639                         FAPPTYP_WINDOWCOMPAT |
    640                         FAPPTYP_WINDOWAPI |
    641                         FAPPTYP_BOUND |
    642                         FAPPTYP_32BIT)))) ||
    643              (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BTM"))))
     637                       (apptype &
     638                        (FAPPTYP_NOTWINDOWCOMPAT |
     639                        FAPPTYP_WINDOWCOMPAT |
     640                        FAPPTYP_WINDOWAPI |
     641                        FAPPTYP_BOUND |
     642                        FAPPTYP_32BIT)))) ||
     643             (p && (!stricmp(p, ".CMD") || !stricmp(p, ".BTM"))))
    644644      return TRUE;
    645645    if (fProtectOnly && (apptype &
    646                         (FAPPTYP_DOS |
    647                           FAPPTYP_WINDOWSREAL |
    648                           FAPPTYP_WINDOWSPROT |
    649                           FAPPTYP_WINDOWSPROT31)) &&
    650         (p && (!stricmp(p, ".EXE") || !stricmp(p, ".COM"))))
     646                        (FAPPTYP_DOS |
     647                          FAPPTYP_WINDOWSREAL |
     648                          FAPPTYP_WINDOWSPROT |
     649                          FAPPTYP_WINDOWSPROT31)) &&
     650        (p && (!stricmp(p, ".EXE") || !stricmp(p, ".COM"))))
    651651      saymsg(MB_OK,
    652              HWND_DESKTOP,
    653              NullStr,
    654              GetPString(IDS_NOTPROTECTONLYEXE),
    655              filename);
     652             HWND_DESKTOP,
     653             NullStr,
     654             GetPString(IDS_NOTPROTECTONLYEXE),
     655             filename);
    656656  }
    657657  return FALSE;
     
    733733  driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
    734734                    DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS |
    735                     DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
    736                     DRIVE_WRITEVERIFYOFF);
     735                    DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
     736                    DRIVE_WRITEVERIFYOFF);
    737737  if (removable != -1) {
    738738    struct
     
    800800    driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
    801801                      DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS |
    802                       DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
    803                       DRIVE_WRITEVERIFYOFF);
     802                      DRIVE_INCLUDEFILES | DRIVE_SLOW | DRIVE_NOSTATS |
     803                      DRIVE_WRITEVERIFYOFF);
    804804  memset(driveserial, -1, sizeof(driveserial));
    805805  DosError(FERR_DISABLEHARDERR);
     
    808808    if (ulDriveMap & (1 << x) && !(driveflags[x] & DRIVE_IGNORE)) {
    809809      {
    810         ULONG flags = 0, size = sizeof(ULONG);
    811         CHAR FlagKey[80];
    812 
    813           sprintf(FlagKey, "%c.DriveFlags", (CHAR) (x + 'A'));
    814           if (PrfQueryProfileData(fmprof, appname, FlagKey, &flags, &size) &&
    815               size == sizeof(ULONG))
    816             driveflags[x] |= flags;
     810        ULONG flags = 0, size = sizeof(ULONG);
     811        CHAR FlagKey[80];
     812
     813          sprintf(FlagKey, "%c.DriveFlags", (CHAR) (x + 'A'));
     814          if (PrfQueryProfileData(fmprof, appname, FlagKey, &flags, &size) &&
     815              size == sizeof(ULONG))
     816            driveflags[x] |= flags;
    817817      }
    818818
     
    849849      PrfQueryProfileData(fmprof, appname, Key, &fVerifyOffChecked[x], &size);
    850850      if (!fVerifyOffChecked[x]) {
    851         if (driveflags[x] & DRIVE_REMOVABLE)
    852           driveflags[x] |= DRIVE_WRITEVERIFYOFF;
    853         if (!(driveflags[x] & DRIVE_INVALID)) {
    854           fVerifyOffChecked[x] = TRUE;
    855           PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[x], sizeof(BOOL));
    856         }
     851        if (driveflags[x] & DRIVE_REMOVABLE)
     852          driveflags[x] |= DRIVE_WRITEVERIFYOFF;
     853        if (!(driveflags[x] & DRIVE_INVALID)) {
     854          fVerifyOffChecked[x] = TRUE;
     855          PrfWriteProfileData(fmprof, appname, Key, &fVerifyOffChecked[x], sizeof(BOOL));
     856        }
    857857      }
    858858    }
     
    972972}
    973973
    974 BOOL needs_quoting(register CHAR * f)
     974BOOL needs_quoting(PCSZ f)
    975975{
    976976  register CHAR *p = " &|<>";
     
    992992      if ((UINT) str[x] < ' ' && str[x] != '\r' && str[x] != '\n' && str[x] != '\t'
    993993          && str[x] != '\x1b' && str[x] != '\x1a' && str[x] != '\x07'
    994           && str[x] != '\x0c') {
    995         return TRUE;
     994          && str[x] != '\x0c') {
     995        return TRUE;
    996996      }
    997997      x++;
  • trunk/dll/valid.h

    r1358 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  05 Sep 08 JBS Ticket 187: Refactor FM3DLL.H
     
    2525BOOL IsBinary(CHAR * str, ULONG len);
    2626BOOL IsExecutable(CHAR * filename);
    27 INT IsFile(CHAR * filename);
     27INT IsFile(PCSZ filename);
    2828BOOL IsFullName(CHAR * filename);
    2929BOOL IsNewer(char *file1, char *file2);
    30 BOOL IsRoot(CHAR * filename);
     30BOOL IsRoot(PCSZ filename);
    3131BOOL IsValidDir(CHAR * test);
    3232BOOL IsValidDrive(CHAR drive);
     
    4040               FDATE *datevar2, FTIME *timevar2);
    4141CHAR *assign_ignores(CHAR * s);
    42 BOOL needs_quoting(CHAR * f);
     42BOOL needs_quoting(PCSZ f);
    4343
    4444// Data declarations
  • trunk/dll/viewer.c

    r1358 r1394  
    77
    88  Copyright (c) 1993-97 M. Kimes
    9   Copyright (c) 2005, 2006 Steven H. Levine
     9  Copyright (c) 2005, 2009 Steven H. Levine
    1010
    1111  23 May 05 SHL Use QWL_USER
     
    9797  if (fs3.attrFile & FILE_READONLY) {
    9898    ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
    99                       GetPString(IDS_WARNINGTEXT),
    100                       GetPString(IDS_EDITREADONLYFILETEXT),
    101                       filename);
     99                      GetPString(IDS_WARNINGTEXT),
     100                      GetPString(IDS_EDITREADONLYFILETEXT),
     101                      filename);
    102102    switch (ulResult){
    103103    case MBID_YES:{
     
    108108    case MBID_NO:
    109109      if (fUseNewViewer)
    110         return StartViewer(hwndClient, (USHORT) flags, filename, hwndRestore);
     110        return StartViewer(hwndClient, (USHORT) flags, filename, hwndRestore);
    111111      else{
    112         OpenInViewer = TRUE;
    113         break;
     112        OpenInViewer = TRUE;
     113        break;
    114114      }
    115115
    116116    case MBID_CANCEL:
    117         return (HWND) 0;
     117        return (HWND) 0;
    118118    }
    119119  }
     
    706706    switch (SHORT1FROMMP(mp1)) {
    707707      /*
    708         case MLE_PREVIEW:
    709         preview_text(hwndMLE);
    710         break;
     708        case MLE_PREVIEW:
     709        preview_text(hwndMLE);
     710        break;
    711711       */
    712712    case MLE_VIEWFTP:
     
    786786          if (temp == MBID_CANCEL)
    787787            break;
    788           if (temp == MBID_YES){
     788          if (temp == MBID_YES){
    789789            WinSendMsg(hwnd,
    790                        WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
    791             if (vw->fileattrreadonly) {
    792               temp = saymsg(MB_OKCANCEL | MB_ICONEXCLAMATION,
    793                             hwnd, NullStr, "File is readonly and has not been saved");
    794               if (temp == MBID_CANCEL)
    795                 return 0;
    796             }
    797           }
     790                       WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
     791            if (vw->fileattrreadonly) {
     792              temp = saymsg(MB_OKCANCEL | MB_ICONEXCLAMATION,
     793                            hwnd, NullStr, "File is readonly and has not been saved");
     794              if (temp == MBID_CANCEL)
     795                return 0;
     796            }
     797          }
    798798        }
    799799        MLEclearall(hwndMLE);
     
    835835      vw->saveas = TRUE;
    836836      WinSendMsg(hwnd,
    837                 WM_COMMAND, MPFROM2SHORT(MLE_SETEXPORTFILE, 0), MPVOID);
     837                WM_COMMAND, MPFROM2SHORT(MLE_SETEXPORTFILE, 0), MPVOID);
    838838      break;
    839839
     
    842842      if (vw && !MLEgetreadonly(hwndMLE)) {
    843843
    844         CHAR filename[1027];
    845         ULONG ulResult;
     844        CHAR filename[1027];
     845        ULONG ulResult;
    846846
    847847        strcpy(filename, vw->exportfilename);
    848848        if (export_filename(hwnd, filename, !vw->fileattrreadonly)) {
    849849          if (stricmp(filename, vw->exportfilename)) {
    850             vw->ch = TRUE;
    851             vw->fileattrreadonly = FALSE;
    852             MLEsetchanged(hwndMLE, TRUE);
     850            vw->ch = TRUE;
     851            vw->fileattrreadonly = FALSE;
     852            MLEsetchanged(hwndMLE, TRUE);
    853853            strcpy(vw->exportfilename, filename);
    854             WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
    855             if (vw->saveas) {
    856               vw->saveas = FALSE;
    857               WinSendMsg(hwnd,
    858                         WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
    859             }
    860           }
    861           else if (vw->fileattrreadonly){
    862               ulResult = saymsg(MB_OKCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
    863                                 GetPString(IDS_WARNINGTEXT),
    864                                 GetPString(IDS_EDITREADONLYFILETEXT2),
    865                                 filename);
    866               if (ulResult == MBID_OK){
    867                 WinSendMsg(hwnd,
    868                            WM_COMMAND, MPFROM2SHORT(MLE_SETEXPORTFILE, 0), MPVOID);
    869                 break;
    870               }
    871               else
    872                 vw->saveas = FALSE;
    873           }
    874           else if (vw->saveas) {
    875             vw->saveas = FALSE;
    876             WinSendMsg(hwnd,
    877                        WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
    878           }
     854            WinSendMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
     855            if (vw->saveas) {
     856              vw->saveas = FALSE;
     857              WinSendMsg(hwnd,
     858                        WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
     859            }
     860          }
     861          else if (vw->fileattrreadonly){
     862              ulResult = saymsg(MB_OKCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
     863                                GetPString(IDS_WARNINGTEXT),
     864                                GetPString(IDS_EDITREADONLYFILETEXT2),
     865                                filename);
     866              if (ulResult == MBID_OK){
     867                WinSendMsg(hwnd,
     868                           WM_COMMAND, MPFROM2SHORT(MLE_SETEXPORTFILE, 0), MPVOID);
     869                break;
     870              }
     871              else
     872                vw->saveas = FALSE;
     873          }
     874          else if (vw->saveas) {
     875            vw->saveas = FALSE;
     876            WinSendMsg(hwnd,
     877                       WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
     878          }
    879879        }
    880880      }
     
    883883    case MLE_EXPORTFILE:
    884884      if (vw->fileattrreadonly){
    885         WinSendMsg(hwnd,
    886                    WM_COMMAND, MPFROM2SHORT(MLE_SETEXPORTFILE, 0), MPVOID);
    887         break;
     885        WinSendMsg(hwnd,
     886                   WM_COMMAND, MPFROM2SHORT(MLE_SETEXPORTFILE, 0), MPVOID);
     887        break;
    888888      }
    889889      if (!MLEgetreadonly(hwndMLE)) {
     
    912912          }
    913913        }
    914         //printf("%s %s %d\n ",vw->exportfilename, __FILE__, __LINE__); fflush(stdout);
     914        //printf("%s %s %d\n ",vw->exportfilename, __FILE__, __LINE__); fflush(stdout);
    915915        if (!MLEexportfile(hwndMLE,
    916916                           vw->exportfilename,
     
    10851085        sip.ret = s;
    10861086        *s = 0;
    1087         sip.prompt = ss;
    10881087        sip.inputlen = 34;
    10891088        sip.title = GetPString(IDS_NVLINEJUMPTITLETEXT);
     
    10921091          DosBeep(50, 100);
    10931092        else {
    1094           sprintf(sip.prompt,
     1093          sprintf(ss,
    10951094                  GetPString(IDS_NVJUMPTEXT),
    10961095                  GetPString(IDS_LINETEXT), 1, numlines);
     1096          sip.prompt = ss;
    10971097          WinDlgBox(HWND_DESKTOP,
    10981098                    hwnd, InputDlgProc, FM3ModHandle, STR_FRAME, &sip);
     
    12371237        if (temp == MBID_CANCEL)
    12381238          return 0;
    1239         if (temp == MBID_YES){
     1239        if (temp == MBID_YES){
    12401240          WinSendMsg(hwnd,
    1241                      WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
    1242           if (vw->fileattrreadonly) {
    1243             temp = saymsg(MB_OKCANCEL | MB_ICONEXCLAMATION,
    1244                           hwnd, NullStr, "File is readonly and has not been saved");
    1245             if (temp == MBID_CANCEL)
    1246                 return 0;
    1247           }
    1248         }
     1241                     WM_COMMAND, MPFROM2SHORT(MLE_EXPORTFILE, 0), MPVOID);
     1242          if (vw->fileattrreadonly) {
     1243            temp = saymsg(MB_OKCANCEL | MB_ICONEXCLAMATION,
     1244                          hwnd, NullStr, "File is readonly and has not been saved");
     1245            if (temp == MBID_CANCEL)
     1246                return 0;
     1247          }
     1248        }
    12491249      }
    12501250    }
  • trunk/dll/walkem.c

    r1321 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2005, 2008 Steven H. Levine
     9  Copyright (c) 2005, 2009 Steven H. Levine
    1010
    1111  01 Aug 04 SHL Rework lstrip/rstrip usage
     
    140140#define LS_DELETE       2
    141141
    142 static INT lookup_setup(PSZ name, UINT action)
     142static INT lookup_setup(PCSZ name, UINT action)
    143143{
    144144  LINKDIRS *pld;
     
    336336 */
    337337
    338 INT add_setup(PSZ name)
     338INT add_setup(PCSZ name)
    339339{
    340340  return lookup_setup(name, LS_ADD);
     
    428428      BldFullPathName(s, pFM2SaveDirectory, "USERDIRS.DAT");
    429429      if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2)
    430         return; //already gave error msg
     430        return; //already gave error msg
    431431      fp = xfopen(s, "w", pszSrcFile, __LINE__);
    432432      if (fp) {
     
    777777
    778778      PrfQueryProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp, &size);
     779      swp.fl &= ~SWP_SIZE;              // 04 Feb 09 SHL ignore saved size
    779780      WinSetWindowPos(hwnd,
    780781                      HWND_TOP,
     
    14061407
    14071408      PrfQueryProfileData(fmprof, FM3Str, "WalkDir2.Position", (PVOID) &swp, &size);
     1409      swp.fl &= ~SWP_SIZE;              // 04 Feb 09 SHL ignore saved size
    14081410      WinSetWindowPos(hwnd,
    14091411                      HWND_TOP,
  • trunk/dll/walkem.h

    r1321 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2008 Steven H. Levine
     9  Copyright (c) 2008, 2009 Steven H. Levine
    1010
    1111  17 Jul 08 SHL Baseline
     
    5252MRESULT EXPENTRY WalkTwoSetDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
    5353                                   MPARAM mp2);
    54 INT add_setup(PSZ stateName);
     54INT add_setup(PCSZ stateName);
    5555BOOL add_udir(BOOL userdirs, PSZ inpath);
    5656VOID fill_setups_list(VOID);
  • trunk/dll/worker.c

    r1358 r1394  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2008 Steven H. Levine
     9  Copyright (c) 2001, 2009 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Comments
     
    3737  25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis
    3838  25 Dec 08 GKY Add DRIVE_RSCANNED flag to monitor for the first recursive drive scan per session
    39                 to prevent duplicate directory names in tree following a copy before initial scan.
     39                to prevent duplicate directory names in tree following a copy before initial scan.
    4040
    4141***********************************************************************/
     
    678678                Retry:
    679679                  {
    680                     CHAR newname[CCHMAXPATH], *moving, *move, *moved;
     680                    CHAR newname[CCHMAXPATH];
     681                    PCSZ moving, move, moved;
    681682                    APIRET rc;
    682683                    INT type;
     
    808809                            (usedtarget) ? GetPString(IDS_TOTARGETTEXT) :
    809810                            NullStr);
    810                     AddNote(message);
    811                     if (fVerify && (driveflags[toupper(*wk->li->targetpath) - 'A'] & DRIVE_WRITEVERIFYOFF) |
    812                         (driveflags[toupper(*wk->li->list[x]) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
    813                       DosSetVerify(FALSE);
    814                       fResetVerify = TRUE;
    815                     }
     811                    AddNote(message);
     812                    if (fVerify && (driveflags[toupper(*wk->li->targetpath) - 'A'] & DRIVE_WRITEVERIFYOFF) |
     813                        (driveflags[toupper(*wk->li->list[x]) - 'A'] & DRIVE_WRITEVERIFYOFF)) {
     814                      DosSetVerify(FALSE);
     815                      fResetVerify = TRUE;
     816                    }
    816817                    if (plen) {
    817818                      /* make directory/ies, if required */
     
    830831                    if (fRealIdle)
    831832                      priority_idle();
    832                     rc = docopyf(type, wk->li->list[x], "%s", newname);
    833                     if (fResetVerify) {
    834                       DosSetVerify(fVerify);
    835                       fResetVerify = FALSE;
    836                     }
     833                    rc = docopyf(type, wk->li->list[x], "%s", newname);
     834                    if (fResetVerify) {
     835                      DosSetVerify(fVerify);
     836                      fResetVerify = FALSE;
     837                    }
    837838                    priority_normal();
    838839                    if (rc) {
     
    923924                                    &files, &numfiles, &numalloc))
    924925                        Broadcast(hab2,
    925                                   wk->hwndCnr,
     926                                  wk->hwndCnr,
    926927                                  UM_UPDATERECORD,
    927                                   MPFROMP(wk->li->list[x]), MPVOID);
     928                                  MPFROMP(wk->li->list[x]), MPVOID);
    928929                      if ((driveflags[*wk->li->targetpath - 'A'] & DRIVE_RSCANNED) &&
    929930                          AddToList(newname, &files, &numfiles, &numalloc))
    930931                        Broadcast(hab2,
    931                                   wk->hwndCnr,
    932                                   UM_UPDATERECORD, MPFROMP(newname), MPVOID);
     932                                  wk->hwndCnr,
     933                                  UM_UPDATERECORD, MPFROMP(newname), MPVOID);
    933934                    }
    934935                  }
     
    938939              case IDM_COMPARE:
    939940                if ((!IsFile(wk->li->targetpath) ||
    940                      IsRoot(wk->li->targetpath)) &&
     941                     IsRoot(wk->li->targetpath)) &&
    941942                    (!IsFile(wk->li->list[x]) || IsRoot(wk->li->list[x]))) {
    942943                  if (!*dircompare && WinIsWindow(hab2, wk->hwndCnr))
     
    10311032        Abort:
    10321033
    1033           if (files) {
    1034             if (driveflags[*wk->li->targetpath - 'A'] & DRIVE_RSCANNED)
     1034          if (files) {
     1035            if (driveflags[*wk->li->targetpath - 'A'] & DRIVE_RSCANNED)
    10351036              Broadcast(hab2,
    1036                         wk->hwndCnr,
    1037                         UM_UPDATERECORDLIST, MPFROMP(files), MPVOID);
    1038            // DbgMsg(pszSrcFile, __LINE__, "UM_UPDATERECORD %s", *files);
     1037                        wk->hwndCnr,
     1038                        UM_UPDATERECORDLIST, MPFROMP(files), MPVOID);
     1039           // DbgMsg(pszSrcFile, __LINE__, "UM_UPDATERECORD %s", *files);
    10391040            FreeList(files);
    10401041          }
     
    11021103            Broadcast(hab2,
    11031104                      wk->hwndCnr,
    1104                       UM_UPDATERECORDLIST, MPFROMP(wk->li->list), MPVOID);
     1105                      UM_UPDATERECORDLIST, MPFROMP(wk->li->list), MPVOID);
    11051106            break;
    11061107
     
    12251226                Broadcast(hab2,
    12261227                          wk->hwndCnr,
    1227                           UM_UPDATERECORDLIST, MPFROMP(wk->li->list), MPVOID);
     1228                          UM_UPDATERECORDLIST, MPFROMP(wk->li->list), MPVOID);
    12281229            }
    12291230            break;
     
    12451246              Broadcast(hab2,
    12461247                        wk->hwndCnr,
    1247                         UM_UPDATERECORD, MPFROMP(wk->li->targetpath), MPVOID);
     1248                        UM_UPDATERECORD, MPFROMP(wk->li->targetpath), MPVOID);
    12481249            }
    12491250            break;
     
    15141515                Broadcast(hab2,
    15151516                          wk->hwndCnr,
    1516                           UM_UPDATERECORDLIST, MPFROMP(wk->li->list), MPVOID);
     1517                          UM_UPDATERECORDLIST, MPFROMP(wk->li->list), MPVOID);
    15171518            }
    15181519            break;
     
    15291530              HOBJECT hObjectdest, hObjectofObject;
    15301531              BYTE G_abSupportedDrives[24] = {0};
    1531               ULONG cbSupportedDrives = sizeof(G_abSupportedDrives);
     1532              ULONG cbSupportedDrives = sizeof(G_abSupportedDrives);
    15321533
    15331534              for (x = 0; wk->li->list[x]; x++) {
     
    16241625                if (!wk->li->list || !wk->li->list[0])
    16251626                  break;
    1626               }
    1627               if (fVerify && driveflags[toupper(*wk->li->list[0]) - 'A'] & DRIVE_WRITEVERIFYOFF)
    1628                 DosSetVerify(FALSE);
     1627              }
     1628              if (fVerify && driveflags[toupper(*wk->li->list[0]) - 'A'] & DRIVE_WRITEVERIFYOFF)
     1629                DosSetVerify(FALSE);
    16291630              DosRequestMutexSem(hmtxFM2Delete, SEM_INDEFINITE_WAIT); // Prevent race 12-3-08 GKY
    16301631              for (x = 0; wk->li->list[x]; x++) {
     
    16471648                    DosDeleteDir(wk->li->list[x]);
    16481649                }
    1649                 else {
     1650                else {
    16501651
    16511652                  DosError(FERR_DISABLEHARDERR);
     
    16661667                        error = WinMoveObject(hObjectofObject, hObjectdest, 0);
    16671668                    }
    1668                     else {
    1669                       error = DosDelete(wk->li->list[x]);
    1670                     }
    1671                   }
    1672                   else {
    1673                     error = DosForceDelete(wk->li->list[x]); ;
    1674                   }
    1675                   if (error) {
    1676                     DosError(FERR_DISABLEHARDERR);
     1669                    else {
     1670                      error = DosDelete(wk->li->list[x]);
     1671                    }
     1672                  }
     1673                  else {
     1674                    error = DosForceDelete(wk->li->list[x]); ;
     1675                  }
     1676                  if (error) {
     1677                    DosError(FERR_DISABLEHARDERR);
    16771678                    make_deleteable(wk->li->list[x]);
    16781679                    if (wk->li->type == IDM_DELETE){
     
    16921693                          error = WinMoveObject(hObjectofObject, hObjectdest, 0);
    16931694                      }
    1694                       else {
    1695                         error = DosDelete(wk->li->list[x]);
     1695                      else {
     1696                        error = DosDelete(wk->li->list[x]);
    16961697                      }
    16971698                    }
    1698                     else {
    1699                       error = DosForceDelete(wk->li->list[x]);
     1699                    else {
     1700                      error = DosForceDelete(wk->li->list[x]);
    17001701                    }
    17011702                  }
     
    17141715                                GetPString(IDS_DELETEFAILED2TEXT),
    17151716                                wk->li->list[x]) == MBID_CANCEL) {
    1716                     DosSetVerify(fVerify);
    1717                     break;
    1718                   }
     1717                    DosSetVerify(fVerify);
     1718                    break;
     1719                  }
    17191720                }
    17201721                else {
     
    17341735                }
    17351736              } // for
    1736             }
    1737             if (fVerify)
    1738               DosSetVerify(fVerify);
     1737            }
     1738            if (fVerify)
     1739              DosSetVerify(fVerify);
    17391740            break;
    17401741          } // switch
     
    17421743            Broadcast(hab2,
    17431744                      wk->hwndCnr,
    1744                       UM_UPDATERECORDLIST, MPFROMP(files), MPVOID);
     1745                      UM_UPDATERECORDLIST, MPFROMP(files), MPVOID);
    17451746            FreeList(files);
    17461747          }
  • trunk/warpin/bld_fm2_wpidirs.txt

    r1264 r1394  
    55;       23 Feb 08 JBS: Added lines for debugging support package (#10)
    66;       28 Oct 08 JBS: Added lines for new icons (ticket 294)
     7;       04 Feb 09 SHL: Drop fm3res.str
    78;
    89;  This is a file which will be used to simplify the process of
     
    5657FILE: fm3dll.dll                 1  dll      .
    5758FILE: fm3res.dll                 1  dll      .
    58 FILE: fm3res.str                 1  dll      .
    5959FILE: fm4.exe                    1  .        .
    6060FILE: cfgmgr.cmd                 1  .        .
Note: See TracChangeset for help on using the changeset viewer.