Changeset 1159 for trunk/dll/misc.c


Ignore:
Timestamp:
Sep 5, 2008, 11:41:13 PM (17 years ago)
Author:
John Small
Message:

Ticket 187: Draft 1: Functions only

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/misc.c

    r1120 r1159  
    1 
    21/***********************************************************************
    32
     
    4241  29 Feb 08 GKY Use xfree where appropriate
    4342  08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with
    44                 keys using a "DirCnr." prefix
     43                keys using a "DirCnr." prefix
    4544  19 Jun 08 JBS Ticket 239: Fix LoadDetailsSwitches so INI file is read correctly and details
    46                 switches are set correctly.
     45                switches are set correctly.
    4746  11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
    48                 all the details view settings (both the global variables and those in the
    49                 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.
    5049  17 Jul 08 SHL Add GetTidForWindow for Fortify support
    5150  20 Jul 08 GKY Add save/append filename to clipboard.
     
    5958#include <ctype.h>
    6059#include <share.h>
    61 #include <malloc.h>                     // _heapmin
     60#include <malloc.h>                     // _heapmin
    6261
    6362#define INCL_DOS
     
    6867#include "fm3dlg.h"
    6968#include "fm3str.h"
    70 #include "pathutil.h"                   // BldQuotedFileName
    71 #include "errutil.h"                    // Dos_Error...
    72 #include "strutil.h"                    // GetPString
    73 #include "command.h"                    // LINKCMDS
     69#include "pathutil.h"                   // BldQuotedFileName
     70#include "errutil.h"                    // Dos_Error...
     71#include "strutil.h"                    // GetPString
     72#include "command.h"                    // LINKCMDS
     73#include "cmdline.h"                    // CmdLineDlgProc
     74#include "defview.h"                    // QuickView
     75#include "copyf.h"                      // WriteLongName
     76#include "strips.h"                     // chop_at_crnl
    7477#include "fm3dll.h"
     78#include "fortify.h"
    7579#include "misc.h"
    76 #include "fortify.h"
    7780
    7881#pragma data_seg(DATA1)
     
    8184
    8285#ifndef BEGIN_LIBPATH
    83 #define BEGIN_LIBPATH       1
     86#define BEGIN_LIBPATH       1
    8487#endif
    8588
    8689#ifndef END_LIBPATH
    87 #define END_LIBPATH           2
     90#define END_LIBPATH           2
    8891#endif
    8992
     
    101104    if (rc) {
    102105      Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    103                 "DosGetInfoBlocks");
     106                "DosGetInfoBlocks");
    104107      yes = FALSE;
    105108    }
     
    112115      // OK for window to be dead - just return FALSE
    113116      yes = WinQueryWindowProcess(hwnd, &pid, &tid) &&
    114             pid == ppib->pib_ulpid &&
    115             (!chkTid || tid == ptib->tib_ptib2->tib2_ultid);
     117            pid == ppib->pib_ulpid &&
     118            (!chkTid || tid == ptib->tib_ptib2->tib2_ultid);
    116119    }
    117120    return yes;
     
    136139    if (rc) {
    137140      Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    138                 "DosGetInfoBlocks");
     141                "DosGetInfoBlocks");
    139142    }
    140143    else {
     
    142145      TID tid;
    143146      if (!WinQueryWindowProcess(hwnd, &pid, &tid))
    144         Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd);
     147        Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryWindowProcess failed for %X", hwnd);
    145148      else if (pid != ppib->pib_ulpid)
    146         Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd);
     149        Runtime_Error(pszSrcFile, __LINE__, "hwnd %X not created by fm/2", hwnd);
    147150      else
    148         ordinal = ptib->tib_ptib2->tib2_ultid;
     151        ordinal = ptib->tib_ptib2->tib2_ultid;
    149152    }
    150153    return ordinal;
     
    165168    if (rc) {
    166169      Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    167                 "DosGetInfoBlocks");
     170                "DosGetInfoBlocks");
    168171    }
    169172    else
     
    272275      WinQueryWindowText(hwnd, CCHMAXPATH, s);
    273276      if (*s) {
    274         rcl.xRight -= 3;
    275         p = s;
    276         GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl);
    277         len = aptl[TXTBOX_TOPRIGHT].x;
    278         do {
    279           GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
    280           if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0)))
    281             p++;
    282           else
    283             break;
    284         }
    285         while (*p);
    286         if (*p) {
    287           GpiSetMix(hps, FM_OVERPAINT);
    288           GpiSetColor(hps, CLR_BLACK);
    289           ptl.x = 3;
    290           ptl.y = ((rcl.yTop / 2) -
    291                    ((aptl[TXTBOX_TOPRIGHT].y +
    292                      aptl[TXTBOX_BOTTOMLEFT].y) / 2));
    293           GpiMove(hps, &ptl);
    294           if (p != s)
    295             GpiCharString(hps, 3, "...");
    296           GpiCharString(hps, strlen(p), p);
    297         }
     277        rcl.xRight -= 3;
     278        p = s;
     279        GpiQueryTextBox(hps, 3, "...", TXTBOX_COUNT, aptl);
     280        len = aptl[TXTBOX_TOPRIGHT].x;
     281        do {
     282          GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
     283          if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0)))
     284            p++;
     285          else
     286            break;
     287        }
     288        while (*p);
     289        if (*p) {
     290          GpiSetMix(hps, FM_OVERPAINT);
     291          GpiSetColor(hps, CLR_BLACK);
     292          ptl.x = 3;
     293          ptl.y = ((rcl.yTop / 2) -
     294                   ((aptl[TXTBOX_TOPRIGHT].y +
     295                     aptl[TXTBOX_BOTTOMLEFT].y) / 2));
     296          GpiMove(hps, &ptl);
     297          if (p != s)
     298            GpiCharString(hps, 3, "...");
     299          GpiCharString(hps, strlen(p), p);
     300        }
    298301      }
    299302      free(s);
     
    379382{
    380383  PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
    381                                            CM_QUERYDETAILFIELDINFO,
    382                                            MPVOID, MPFROMSHORT(CMA_FIRST));
     384                                           CM_QUERYDETAILFIELDINFO,
     385                                           MPVOID, MPFROMSHORT(CMA_FIRST));
    383386
    384387  while (pfi) {
    385388    if (!strcmp(pfi->pTitleData, title)) {
    386389      if (toggle) {
    387         if (pfi->flData & CFA_INVISIBLE)
    388           pfi->flData &= (~CFA_INVISIBLE);
    389         else
    390           pfi->flData |= CFA_INVISIBLE;
    391         return !(pfi->flData & CFA_INVISIBLE);
     390        if (pfi->flData & CFA_INVISIBLE)
     391          pfi->flData &= (~CFA_INVISIBLE);
     392        else
     393          pfi->flData |= CFA_INVISIBLE;
     394        return !(pfi->flData & CFA_INVISIBLE);
    392395      }
    393396      else {
    394         if (visible)
    395           pfi->flData &= (~CFA_INVISIBLE);
    396         else
    397           pfi->flData |= CFA_INVISIBLE;
     397        if (visible)
     398          pfi->flData &= (~CFA_INVISIBLE);
     399        else
     400          pfi->flData |= CFA_INVISIBLE;
    398401      }
    399402      return TRUE;
     
    407410{
    408411  PFIELDINFO pfi = (PFIELDINFO) WinSendMsg(hwndCnr,
    409                                            CM_QUERYDETAILFIELDINFO,
    410                                            MPVOID, MPFROMSHORT(CMA_FIRST));
     412                                           CM_QUERYDETAILFIELDINFO,
     413                                           MPVOID, MPFROMSHORT(CMA_FIRST));
    411414
    412415  while (pfi) {
    413416    if (!strcmp(pfi->pTitleData, title)) {
    414417      if (toggle) {
    415         if (pfi->flData & CFA_FIREADONLY)
    416           pfi->flData &= (~CFA_FIREADONLY);
    417         else
    418           pfi->flData |= CFA_FIREADONLY;
    419         return (pfi->flData & CFA_FIREADONLY);
     418        if (pfi->flData & CFA_FIREADONLY)
     419          pfi->flData &= (~CFA_FIREADONLY);
     420        else
     421          pfi->flData |= CFA_FIREADONLY;
     422        return (pfi->flData & CFA_FIREADONLY);
    420423      }
    421424      else {
    422         if (!readonly)
    423           pfi->flData &= (~CFA_FIREADONLY);
    424         else
    425           pfi->flData |= CFA_FIREADONLY;
     425        if (!readonly)
     426          pfi->flData &= (~CFA_FIREADONLY);
     427        else
     428          pfi->flData |= CFA_FIREADONLY;
    426429      }
    427430      return TRUE;
     
    445448  if (x != -1) {
    446449    if (!stricmp(FileSystem, HPFS) ||
    447         !stricmp(FileSystem, JFS) ||
    448         !stricmp(FileSystem, FAT32) ||
    449         !stricmp(FileSystem, RAMFS) ||
    450         !stricmp(FileSystem, NDFS32) ||
    451         !stricmp(FileSystem, NTFS) ||
    452         !stricmp(FileSystem, HPFS386)) {
     450        !stricmp(FileSystem, JFS) ||
     451        !stricmp(FileSystem, FAT32) ||
     452        !stricmp(FileSystem, RAMFS) ||
     453        !stricmp(FileSystem, NDFS32) ||
     454        !stricmp(FileSystem, NTFS) ||
     455        !stricmp(FileSystem, HPFS386)) {
    453456      hasCreateDT = TRUE;
    454457      hasAccessDT = TRUE;
     
    474477  }
    475478  AdjustCnrColVis(hwndCnr,
    476                   GetPString(IDS_LADATE),
    477                   pds->detailsladate ? hasAccessDT : FALSE,
    478                   FALSE);
     479                  GetPString(IDS_LADATE),
     480                  pds->detailsladate ? hasAccessDT : FALSE,
     481                  FALSE);
    479482  AdjustCnrColVis(hwndCnr,
    480                   GetPString(IDS_LATIME),
    481                   pds->detailslatime ? hasAccessDT : FALSE,
    482                   FALSE);
     483                  GetPString(IDS_LATIME),
     484                  pds->detailslatime ? hasAccessDT : FALSE,
     485                  FALSE);
    483486  AdjustCnrColVis(hwndCnr,
    484                   GetPString(IDS_CRDATE),
    485                   pds->detailscrdate ? hasCreateDT : FALSE,
    486                   FALSE);
     487                  GetPString(IDS_CRDATE),
     488                  pds->detailscrdate ? hasCreateDT : FALSE,
     489                  FALSE);
    487490  AdjustCnrColVis(hwndCnr,
    488                   GetPString(IDS_CRTIME),
    489                   pds->detailscrtime ? hasCreateDT : FALSE,
    490                   FALSE);
     491                  GetPString(IDS_CRTIME),
     492                  pds->detailscrtime ? hasCreateDT : FALSE,
     493                  FALSE);
    491494  AdjustCnrColVis(hwndCnr,
    492                   GetPString(IDS_LNAME),
    493                   pds->detailslongname ? hasLongNames : FALSE,
    494                   FALSE);
     495                  GetPString(IDS_LNAME),
     496                  pds->detailslongname ? hasLongNames : FALSE,
     497                  FALSE);
    495498  WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
    496499}
    497500
    498501VOID AdjustCnrColsForPref(HWND hwndCnr, CHAR * directory, DETAILS_SETTINGS * pds,
    499                           BOOL compare)
     502                          BOOL compare)
    500503{
    501504
    502505  AdjustCnrColVis(hwndCnr,
    503                   compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
    504                   pds->detailssubject,
    505                   FALSE);
     506                  compare ? GetPString(IDS_STATUS) : GetPString(IDS_SUBJ),
     507                  pds->detailssubject,
     508                  FALSE);
    506509
    507510  AdjustCnrColVis(hwndCnr, GetPString(IDS_ATTR), pds->detailsattr, FALSE);
     
    532535
    533536  pfi = WinSendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO,
    534                    MPFROMLONG(CONTAINER_COLUMNS), NULL);
     537                   MPFROMLONG(CONTAINER_COLUMNS), NULL);
    535538
    536539  if (!pfi) {
     
    582585      pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
    583586      if (isCompCnr)
    584         pfi->flData |= CFA_FIREADONLY;
     587        pfi->flData |= CFA_FIREADONLY;
    585588      pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
    586589      pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :
    587                                   GetPString(IDS_SUBJ);
     590                                  GetPString(IDS_SUBJ);
    588591      pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
    589592      pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
     
    602605      pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
    603606      if (isCompCnr)
    604         pfi->flData |= CFA_FIREADONLY;
     607        pfi->flData |= CFA_FIREADONLY;
    605608      pfi->flTitle = CFA_LEFT | CFA_FITITLEREADONLY;
    606609      pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) :
    607                                   GetPString(IDS_SUBJ);
     610                                  GetPString(IDS_SUBJ);
    608611      pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject);
    609612      pfi->cxWidth = dsDirCnrDefault.SubjectDisplayWidth;
     
    697700
    698701    if (!WinSendMsg(hwndCnr, CM_INSERTDETAILFIELDINFO, MPFROMP(pfiFirst),
    699                     MPFROMP(&fii))) {
     702                    MPFROMP(&fii))) {
    700703      Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_INSERTDETAILFIELDINFO");
    701704      fSuccess = FALSE;
     
    716719    size = sizeof(LONG);
    717720    PrfQueryProfileData(fmprof,
    718                         appname, "CnrSplitBar", &cnri.xVertSplitbar, &size);
     721                        appname, "CnrSplitBar", &cnri.xVertSplitbar, &size);
    719722    if (cnri.xVertSplitbar <= 0)
    720723      cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
    721724    if (!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri),
    722                     MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT |
    723                                CMA_XVERTSPLITBAR))) {
     725                    MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT |
     726                               CMA_XVERTSPLITBAR))) {
    724727      Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_SETCNRINFO");
    725728      fSuccess = FALSE;
     
    739742
    740743      if (pci &&
    741           (INT) pci != -1 &&
    742           !IsRoot(pci->pszFileName) &&
    743           !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) {
    744         if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) {
    745           PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID);
    746         }
    747         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject))
    748           PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID);
    749         else
    750           PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
     744          (INT) pci != -1 &&
     745          !IsRoot(pci->pszFileName) &&
     746          !(pci->flags & RECFLAGS_ENV) && !(pci->flags & RECFLAGS_UNDERENV)) {
     747        if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName)) {
     748          PostMsg(hwnd, UM_FIXEDITNAME, MPFROMP(pci->pszFileName), MPVOID);
     749        }
     750        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject))
     751          PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(1048), MPVOID);
     752        else
     753          PostMsg(hwnd, UM_FIXCNRMLE, MPFROMLONG(CCHMAXPATH), MPVOID);
    751754      }
    752755      else
    753         PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
     756        PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
    754757    }
    755758    break;
     
    763766
    764767      if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
    765         if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) {
    766 
    767           APIRET rc;
    768           EAOP2 eaop;
    769           PFEA2LIST pfealist = NULL;
    770           CHAR szSubject[1048];
    771           ULONG ealen;
    772           USHORT len;
    773           CHAR *eaval;
    774           LONG retlen;
    775           PSZ psz;
    776 
    777           retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject);
    778           szSubject[retlen + 1] = 0;
    779           bstrip(szSubject);
    780           if (pci->pszSubject != NullStr) {
    781             if (retlen == 0) {
    782               psz = pci->pszSubject;
    783               pci->pszSubject = NullStr;
    784               xfree(psz, pszSrcFile, __LINE__);
    785             }
    786             else
    787               pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
    788           }
    789           else {
    790             pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__);
    791             if (!pci->pszSubject)
    792               return FALSE;
    793           }
    794           len = strlen(szSubject);
    795           if (len)
    796             ealen = sizeof(FEA2LIST) + 9 + len + 4;
    797           else
    798             ealen = sizeof(FEALIST) + 9;
    799           rc = DosAllocMem((PPVOID) & pfealist, ealen + 64,
    800                            OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
    801           if (rc)
    802             Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile,
    803                       __LINE__, GetPString(IDS_OUTOFMEMORY));
    804           else {
    805             memset(pfealist, 0, ealen + 1);
    806             pfealist->cbList = ealen;
    807             pfealist->list[0].oNextEntryOffset = 0;
    808             pfealist->list[0].fEA = 0;
    809             pfealist->list[0].cbName = 8;
    810             strcpy(pfealist->list[0].szName, SUBJECT);
    811             if (len) {
    812               eaval = pfealist->list[0].szName + 9;
    813               *(USHORT *) eaval = (USHORT) EAT_ASCII;
    814               eaval += sizeof(USHORT);
    815               *(USHORT *) eaval = (USHORT) len;
    816               eaval += sizeof(USHORT);
    817               memcpy(eaval, szSubject, len);
    818               pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
    819             }
    820             else
    821               pfealist->list[0].cbValue = 0;
    822             eaop.fpGEA2List = (PGEA2LIST) 0;
    823             eaop.fpFEA2List = pfealist;
    824             eaop.oError = 0;
    825             rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE,
    826                                 &eaop, sizeof(eaop), DSPI_WRTTHRU);
    827             DosFreeMem(pfealist);
    828             if (rc)
    829               return FALSE;
    830           }
    831           return (MRESULT) TRUE;
    832         }
    833         else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) {
    834 
    835           CHAR longname[CCHMAXPATHCOMP];
    836           LONG retlen;
    837           PSZ psz;
    838 
    839           *longname = 0;
    840           retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname);
    841           longname[retlen + 1] = 0;
    842           chop_at_crnl(longname);
    843           bstrip(longname);
    844           WinSetWindowText(hwndMLE, longname);
    845           if (pci->pszLongName != NullStr) {
    846             if (retlen == 0) {
    847               psz = pci->pszLongName;
    848               pci->pszLongName = NullStr;
    849               xfree(psz, pszSrcFile, __LINE__);
    850             }
    851             else
    852               pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
    853           }
    854           else {
    855             pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__);
    856             if (!pci->pszLongName)
    857               return FALSE;
    858           }
    859           return (MRESULT) WriteLongName(pci->pszFileName, longname);
    860         }
    861         else {
    862           WinQueryWindowText(hwndMLE, sizeof(szData), szData);
    863           if (strchr(szData, '?') ||
    864               strchr(szData, '*') || IsRoot(pci->pszFileName))
    865             return (MRESULT) FALSE;
    866           /* If the text changed, rename the file system object. */
    867           chop_at_crnl(szData);
    868           bstrip(szData);
    869           if (!IsFullName(szData))
    870             Runtime_Error(pszSrcFile, __LINE__, "bad name");
    871           else {
    872             if (DosQueryPathInfo(szData,
    873                                 FIL_QUERYFULLNAME,
    874                                 testname, sizeof(testname)))
    875                 return FALSE;
    876             if (DosQueryPathInfo(pci->pszFileName,
    877                                 FIL_QUERYFULLNAME,
    878                                 szData,
    879                                 sizeof(szData)))
    880             {
    881               pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
    882               strcpy(szData, pci->pszFileName);
    883             }
    884             WinSetWindowText(hwndMLE, szData);
    885             if (strcmp(szData, testname)) {
    886               if (stricmp(szData, testname) && IsFile(testname) != -1) {
    887                 DosBeep(50, 100);       /* exists; disallow */
    888                 return (MRESULT) FALSE;
    889               }
    890               if (docopyf(MOVE, szData, "%s", testname))
    891                 Runtime_Error(pszSrcFile, __LINE__, "docopyf");
    892               else {
    893                 CHAR *filename;
    894 
    895                 filename = xstrdup(testname, pszSrcFile, __LINE__);
    896                 if (filename) {
    897                   if (!PostMsg(hwnd,
    898                                UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
    899                     free(filename);
    900                 }
    901                 if (stricmp(testname, pci->pszFileName)) {
    902                   PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci));
    903                   filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
    904                   if (filename) {
    905                     if (!PostMsg(hwnd,
    906                                 UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
    907                       free(filename);
    908                   }
    909                 }
    910               }
    911             }
    912           }
    913         }
     768        if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszSubject)) {
     769
     770          APIRET rc;
     771          EAOP2 eaop;
     772          PFEA2LIST pfealist = NULL;
     773          CHAR szSubject[1048];
     774          ULONG ealen;
     775          USHORT len;
     776          CHAR *eaval;
     777          LONG retlen;
     778          PSZ psz;
     779
     780          retlen = WinQueryWindowText(hwndMLE, sizeof(szSubject), szSubject);
     781          szSubject[retlen + 1] = 0;
     782          bstrip(szSubject);
     783          if (pci->pszSubject != NullStr) {
     784            if (retlen == 0) {
     785              psz = pci->pszSubject;
     786              pci->pszSubject = NullStr;
     787              xfree(psz, pszSrcFile, __LINE__);
     788            }
     789            else
     790              pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);
     791          }
     792          else {
     793            pci->pszSubject = xmalloc(retlen + 1, pszSrcFile, __LINE__);
     794            if (!pci->pszSubject)
     795              return FALSE;
     796          }
     797          len = strlen(szSubject);
     798          if (len)
     799            ealen = sizeof(FEA2LIST) + 9 + len + 4;
     800          else
     801            ealen = sizeof(FEALIST) + 9;
     802          rc = DosAllocMem((PPVOID) & pfealist, ealen + 64,
     803                           OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE);
     804          if (rc)
     805            Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile,
     806                      __LINE__, GetPString(IDS_OUTOFMEMORY));
     807          else {
     808            memset(pfealist, 0, ealen + 1);
     809            pfealist->cbList = ealen;
     810            pfealist->list[0].oNextEntryOffset = 0;
     811            pfealist->list[0].fEA = 0;
     812            pfealist->list[0].cbName = 8;
     813            strcpy(pfealist->list[0].szName, SUBJECT);
     814            if (len) {
     815              eaval = pfealist->list[0].szName + 9;
     816              *(USHORT *) eaval = (USHORT) EAT_ASCII;
     817              eaval += sizeof(USHORT);
     818              *(USHORT *) eaval = (USHORT) len;
     819              eaval += sizeof(USHORT);
     820              memcpy(eaval, szSubject, len);
     821              pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
     822            }
     823            else
     824              pfealist->list[0].cbValue = 0;
     825            eaop.fpGEA2List = (PGEA2LIST) 0;
     826            eaop.fpFEA2List = pfealist;
     827            eaop.oError = 0;
     828            rc = xDosSetPathInfo(pci->pszFileName, FIL_QUERYEASIZE,
     829                                &eaop, sizeof(eaop), DSPI_WRTTHRU);
     830            DosFreeMem(pfealist);
     831            if (rc)
     832              return FALSE;
     833          }
     834          return (MRESULT) TRUE;
     835        }
     836        else if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszLongName)) {
     837
     838          CHAR longname[CCHMAXPATHCOMP];
     839          LONG retlen;
     840          PSZ psz;
     841
     842          *longname = 0;
     843          retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname);
     844          longname[retlen + 1] = 0;
     845          chop_at_crnl(longname);
     846          bstrip(longname);
     847          WinSetWindowText(hwndMLE, longname);
     848          if (pci->pszLongName != NullStr) {
     849            if (retlen == 0) {
     850              psz = pci->pszLongName;
     851              pci->pszLongName = NullStr;
     852              xfree(psz, pszSrcFile, __LINE__);
     853            }
     854            else
     855              pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);
     856          }
     857          else {
     858            pci->pszLongName = xmalloc(retlen + 1, pszSrcFile, __LINE__);
     859            if (!pci->pszLongName)
     860              return FALSE;
     861          }
     862          return (MRESULT) WriteLongName(pci->pszFileName, longname);
     863        }
     864        else {
     865          WinQueryWindowText(hwndMLE, sizeof(szData), szData);
     866          if (strchr(szData, '?') ||
     867              strchr(szData, '*') || IsRoot(pci->pszFileName))
     868            return (MRESULT) FALSE;
     869          /* If the text changed, rename the file system object. */
     870          chop_at_crnl(szData);
     871          bstrip(szData);
     872          if (!IsFullName(szData))
     873            Runtime_Error(pszSrcFile, __LINE__, "bad name");
     874          else {
     875            if (DosQueryPathInfo(szData,
     876                                FIL_QUERYFULLNAME,
     877                                testname, sizeof(testname)))
     878                return FALSE;
     879            if (DosQueryPathInfo(pci->pszFileName,
     880                                FIL_QUERYFULLNAME,
     881                                szData,
     882                                sizeof(szData)))
     883            {
     884              pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);
     885              strcpy(szData, pci->pszFileName);
     886            }
     887            WinSetWindowText(hwndMLE, szData);
     888            if (strcmp(szData, testname)) {
     889              if (stricmp(szData, testname) && IsFile(testname) != -1) {
     890                DosBeep(50, 100);       /* exists; disallow */
     891                return (MRESULT) FALSE;
     892              }
     893              if (docopyf(MOVE, szData, "%s", testname))
     894                Runtime_Error(pszSrcFile, __LINE__, "docopyf");
     895              else {
     896                CHAR *filename;
     897
     898                filename = xstrdup(testname, pszSrcFile, __LINE__);
     899                if (filename) {
     900                  if (!PostMsg(hwnd,
     901                               UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
     902                    free(filename);
     903                }
     904                if (stricmp(testname, pci->pszFileName)) {
     905                  PostMsg(hwnd, UM_FIXEDITNAME, MPFROMLONG(-1), MPFROMP(pci));
     906                  filename = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
     907                  if (filename) {
     908                    if (!PostMsg(hwnd,
     909                                UM_FIXEDITNAME, MPVOID, MPFROMP(filename)))
     910                      free(filename);
     911                  }
     912                }
     913              }
     914            }
     915          }
     916        }
    914917      }
    915918    }
     
    922925
    923926      if (pci && (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
    924         WinSendMsg(hwnd,
    925                    CM_INVALIDATERECORD,
    926                    MPFROMP(&pci),
    927                    MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
    928         if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
    929           PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID);
     927        WinSendMsg(hwnd,
     928                   CM_INVALIDATERECORD,
     929                   MPFROMP(&pci),
     930                   MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     931        if (pfi && pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
     932          PostMsg(hwnd, UM_SORTRECORD, MPVOID, MPVOID);
    930933      }
    931934      else {
    932         USHORT cmd = 0;
    933 
    934         if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
    935           cmd = IDM_SORTSMARTNAME;
    936         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile))
    937           cmd = IDM_SORTSIZE;
    938         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize))
    939           cmd = IDM_SORTEASIZE;
    940         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date))
    941           cmd = IDM_SORTLWDATE;
    942         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time))
    943           cmd = IDM_SORTLWDATE;
    944         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate))
    945           cmd = IDM_SORTLADATE;
    946         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime))
    947           cmd = IDM_SORTLADATE;
    948         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate))
    949           cmd = IDM_SORTCRDATE;
    950         else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime))
    951           cmd = IDM_SORTCRDATE;
    952         if (cmd)
    953           PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
     935        USHORT cmd = 0;
     936
     937        if (!pfi || pfi->offStruct == FIELDOFFSET(CNRITEM, pszDisplayName))
     938          cmd = IDM_SORTSMARTNAME;
     939        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, cbFile))
     940          cmd = IDM_SORTSIZE;
     941        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, easize))
     942          cmd = IDM_SORTEASIZE;
     943        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, date))
     944          cmd = IDM_SORTLWDATE;
     945        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, time))
     946          cmd = IDM_SORTLWDATE;
     947        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, ladate))
     948          cmd = IDM_SORTLADATE;
     949        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, latime))
     950          cmd = IDM_SORTLADATE;
     951        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crdate))
     952          cmd = IDM_SORTCRDATE;
     953        else if (pfi->offStruct == FIELDOFFSET(CNRITEM, crtime))
     954          cmd = IDM_SORTCRDATE;
     955        if (cmd)
     956          PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
    954957      }
    955958    }
     
    960963
    961964BOOL SetMenuCheck(HWND hwndMenu, USHORT id, BOOL * bool, BOOL toggle,
    962                   CHAR * savename)
     965                  CHAR * savename)
    963966{
    964967  if (toggle) {
     
    968971  }
    969972  WinSendMsg(hwndMenu, MM_SETITEMATTR,
    970              MPFROM2SHORT(id, 1),
    971              MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0)));
     973             MPFROM2SHORT(id, 1),
     974             MPFROM2SHORT(MIA_CHECKED, (*bool ? MIA_CHECKED : 0)));
    972975  return *bool;
    973976}
     
    978981{
    979982  WinSendMsg(hwndMenu, MM_SETITEMATTR,
    980              MPFROM2SHORT(id, TRUE),
    981              MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0)));
     983             MPFROM2SHORT(id, TRUE),
     984             MPFROM2SHORT(MIA_DISABLED, (disable ? MIA_DISABLED : 0)));
    982985}
    983986
     
    10011004    fclose(fp);
    10021005    ret = runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
    1003                   NULL, NULL,
    1004                   "VIEW.EXE \"%s\"",
    1005                   BldQuotedFileName(szQuotedFileName, filename));
     1006                  NULL, NULL,
     1007                  "VIEW.EXE \"%s\"",
     1008                  BldQuotedFileName(szQuotedFileName, filename));
    10061009  }
    10071010
     
    10421045    *ex.environment = 0;
    10431046    ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle,
    1044                     EXEC_FRAME, &ex);
     1047                    EXEC_FRAME, &ex);
    10451048    if (ret == 1) {
    10461049      lastflags = ex.flags;
    10471050      return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path,
    1048                      *ex.environment ? ex.environment : NULL,
    1049                      "%s", pszCmdLine) != -1;
     1051                     *ex.environment ? ex.environment : NULL,
     1052                     "%s", pszCmdLine) != -1;
    10501053    }
    10511054    else if (ret != 0)
     
    10731076
    10741077VOID AdjustDetailsSwitches(HWND hwnd, HWND hwndMenu, USHORT cmd,
    1075                            CHAR * directory, CHAR * keyroot,
    1076                            DETAILS_SETTINGS * pds, BOOL compare)
     1078                           CHAR * directory, CHAR * keyroot,
     1079                           DETAILS_SETTINGS * pds, BOOL compare)
    10771080{
    10781081  BOOL *bool = NULL;
     
    11431146  mi.afStyle = MIS_TEXT;
    11441147  if (WinSendMsg(hwndMenu,
    1145                 MM_QUERYITEM,
    1146                 MPFROM2SHORT(id, TRUE),
    1147                 MPFROMP(&mi)))
     1148                MM_QUERYITEM,
     1149                MPFROM2SHORT(id, TRUE),
     1150                MPFROMP(&mi)))
    11481151  {
    11491152    WinSetWindowBits(mi.hwndSubMenu, QWL_STYLE, MS_CONDITIONALCASCADE,
    1150                      MS_CONDITIONALCASCADE);
     1153                     MS_CONDITIONALCASCADE);
    11511154    WinSendMsg(mi.hwndSubMenu, MM_SETDEFAULTITEMID, MPFROMSHORT(def), MPVOID);
    11521155    WinCheckMenuItem(mi.hwndSubMenu, def, TRUE);
     
    12251228  else
    12261229    WinSendMsg(hwndMenu, MM_QUERYITEM,
    1227                MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit));
     1230               MPFROM2SHORT(IDM_COMMANDSMENU, TRUE), MPFROMP(&mit));
    12281231  if (mit.hwndSubMenu) {
    12291232    numitems = (SHORT) WinSendMsg(mit.hwndSubMenu, MM_QUERYITEMCOUNT,
    1230                                   MPVOID, MPVOID);
     1233                                  MPVOID, MPVOID);
    12311234    WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM, MPFROMSHORT(-1), MPVOID);
    12321235    for (x = 0; x < numitems; x++)
    12331236      WinSendMsg(mit.hwndSubMenu, MM_DELETEITEM,
    1234                 MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID);
     1237                MPFROMSHORT((SHORT) (x + IDM_COMMANDSTART)), MPVOID);
    12351238    if (hwndCnr && cmdhead) {
    12361239      x = 0;
     
    12381241      while (info) {
    12391242
    1240         CHAR s[CCHMAXPATH + 24];
    1241 
    1242         sprintf(s,
    1243                 "%s%s%s",
    1244                 info->title,
    1245                 x < 20 ? "\tCtrl + " : NullStr,
    1246                 x < 20 && x > 9 ? "Shift + " : NullStr);
    1247         if (x < 20)
    1248           sprintf(&s[strlen(s)], "%d",
    1249                   ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1);
    1250         mi.id = IDM_COMMANDSTART + x;
    1251         mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) |
    1252                         (info->flags & PROMPT ? MIA_FRAMED : 0);
    1253         mi.afStyle = MIS_TEXT;
    1254         if (!(x % 24) && x && info->next)
    1255           mi.afStyle |= MIS_BREAK;
    1256         WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s));
    1257         x++;
    1258         info = info->next;
     1243        CHAR s[CCHMAXPATH + 24];
     1244
     1245        sprintf(s,
     1246                "%s%s%s",
     1247                info->title,
     1248                x < 20 ? "\tCtrl + " : NullStr,
     1249                x < 20 && x > 9 ? "Shift + " : NullStr);
     1250        if (x < 20)
     1251          sprintf(&s[strlen(s)], "%d",
     1252                  ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1);
     1253        mi.id = IDM_COMMANDSTART + x;
     1254        mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) |
     1255                        (info->flags & PROMPT ? MIA_FRAMED : 0);
     1256        mi.afStyle = MIS_TEXT;
     1257        if (!(x % 24) && x && info->next)
     1258          mi.afStyle |= MIS_BREAK;
     1259        WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi), MPFROMP(s));
     1260        x++;
     1261        info = info->next;
    12591262      }
    12601263    }
     
    13511354      hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
    13521355      if (hwndDir)
    1353         break;
     1356        break;
    13541357      hwndDir = (HWND) 0;
    13551358    }
     
    13681371  if (rc)
    13691372    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1370               "DosCreateEventSem");
     1373              "DosCreateEventSem");
    13711374  else {
    13721375    priority_normal();
    13731376    for (;;) {
    13741377      if (DosWaitEventSem(CompactSem, SEM_INDEFINITE_WAIT))
    1375         break;
     1378        break;
    13761379      _heapmin();
    13771380      DosResetEventSem(CompactSem, &postcount);
     
    13991402  if (dcd->hwndLastMenu && !dcd->cnremphasized) {
    14001403    WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
    1401                MPFROM2SHORT(TRUE, CRA_SOURCE));
     1404               MPFROM2SHORT(TRUE, CRA_SOURCE));
    14021405    dcd->cnremphasized = TRUE;
    14031406  }
     
    14051408    WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
    14061409  if (!WinPopupMenu(hwnd, hwnd, dcd->hwndLastMenu,
    1407                     8, 8, 0,
    1408                     PU_HCONSTRAIN | PU_VCONSTRAIN |
    1409                     PU_KEYBOARD | PU_MOUSEBUTTON1)) {
     1410                    8, 8, 0,
     1411                    PU_HCONSTRAIN | PU_VCONSTRAIN |
     1412                    PU_KEYBOARD | PU_MOUSEBUTTON1)) {
    14101413    if (dcd->cnremphasized) {
    14111414      WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
    1412                 MPFROM2SHORT(FALSE, CRA_SOURCE));
     1415                MPFROM2SHORT(FALSE, CRA_SOURCE));
    14131416      dcd->cnremphasized = FALSE;
    14141417    }
     
    14161419  else
    14171420    WinSendMsg(dcd->hwndLastMenu, MM_SELECTITEM,
    1418                MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE));
     1421               MPFROM2SHORT(id, TRUE), MPFROM2SHORT(0, FALSE));
    14191422}
    14201423
     
    14261429  for (;;) {
    14271430    pmi = (PMINIRECORDCORE) WinSendMsg(hwndCnr, CM_QUERYRECORDEMPHASIS,
    1428                                        MPFROMLONG(CMA_FIRST),
    1429                                        MPFROMSHORT(attrib));
     1431                                       MPFROMLONG(CMA_FIRST),
     1432                                       MPFROMSHORT(attrib));
    14301433    if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED)    /* punt */
    14311434      attrib = CRA_CURSORED;
     
    14461449      QMSG qmsg;
    14471450      for (;;) {
    1448         DosSleep(1);
    1449         rc = WinPostMsg(h, msg, mp1, mp2);
    1450         if (rc)
    1451           break;                        // OK
    1452         if (!WinIsWindow((HAB) 0, h))
    1453           break;                        // Window gone
    1454         if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE))
    1455           break;                        // Queue has message(s)
    1456       }                  // for
     1451        DosSleep(1);
     1452        rc = WinPostMsg(h, msg, mp1, mp2);
     1453        if (rc)
     1454          break;                        // OK
     1455        if (!WinIsWindow((HAB) 0, h))
     1456          break;                        // Window gone
     1457        if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE))
     1458          break;                        // Queue has message(s)
     1459      }                  // for
    14571460    }
    14581461  }
     
    14671470
    14681471  pci = (PCNRITEM) WinSendMsg(hwnd,
    1469                               CM_QUERYRECORDEMPHASIS,
    1470                               MPFROMLONG(CMA_FIRST),
    1471                               MPFROMSHORT(CRA_CURSORED));
     1472                              CM_QUERYRECORDEMPHASIS,
     1473                              MPFROMLONG(CMA_FIRST),
     1474                              MPFROMSHORT(CRA_CURSORED));
    14721475  if (pci && (INT) pci != -1) {
    14731476    memset(&ced, 0, sizeof(ced));
     
    14771480    ced.pRecord = (PRECORDCORE) pci;
    14781481    pfi = (PFIELDINFO) WinSendMsg(hwnd,
    1479                                   CM_QUERYDETAILFIELDINFO,
    1480                                   MPVOID, MPFROMSHORT(CMA_FIRST));
     1482                                  CM_QUERYDETAILFIELDINFO,
     1483                                  MPVOID, MPFROMSHORT(CMA_FIRST));
    14811484    if (!pfi)
    14821485      WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
    14831486    else {
    14841487      while (pfi && (INT) pfi != -1 &&
    1485              pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName))
    1486         pfi = (PFIELDINFO) WinSendMsg(hwnd,
    1487                                       CM_QUERYDETAILFIELDINFO,
    1488                                       MPFROMP(pfi), MPFROMSHORT(CMA_NEXT));
     1488             pfi->offStruct != FIELDOFFSET(CNRITEM, pszFileName))
     1489        pfi = (PFIELDINFO) WinSendMsg(hwnd,
     1490                                      CM_QUERYDETAILFIELDINFO,
     1491                                      MPFROMP(pfi), MPFROMSHORT(CMA_NEXT));
    14891492      if (pfi && (INT) pfi != -1) {
    1490         ced.pFieldInfo = pfi;
    1491         {
    1492           CNRINFO cnri;
    1493 
    1494           memset(&cnri, 0, sizeof(CNRINFO));
    1495           cnri.cb = sizeof(CNRINFO);
    1496           WinSendMsg(hwnd,
    1497                      CM_QUERYCNRINFO,
    1498                      MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
    1499           if (cnri.flWindowAttr & CV_DETAIL)
    1500             ced.id = CID_LEFTDVWND;
    1501         }
    1502         WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
     1493        ced.pFieldInfo = pfi;
     1494        {
     1495          CNRINFO cnri;
     1496
     1497          memset(&cnri, 0, sizeof(CNRINFO));
     1498          cnri.cb = sizeof(CNRINFO);
     1499          WinSendMsg(hwnd,
     1500                     CM_QUERYCNRINFO,
     1501                     MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
     1502          if (cnri.flWindowAttr & CV_DETAIL)
     1503            ced.id = CID_LEFTDVWND;
     1504        }
     1505        WinSendMsg(hwnd, CM_OPENEDIT, MPFROMP(&ced), MPVOID);
    15031506      }
    15041507    }
     
    15171520      list[1] = NULL;
    15181521      ExecOnList(hwnd, binview, WINDOWED | SEPARATE, NULL, list, NULL,
    1519                 pszSrcFile, __LINE__);
     1522                pszSrcFile, __LINE__);
    15201523      return;
    15211524    }
     
    15271530      list[1] = NULL;
    15281531      ExecOnList(hwnd, viewer,
    1529                 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
    1530                 NULL, list, NULL, pszSrcFile, __LINE__);
     1532                WINDOWED | SEPARATE | (fViewChild ? CHILD : 0),
     1533                NULL, list, NULL, pszSrcFile, __LINE__);
    15311534      return;
    15321535    }
     
    15451548      list[1] = NULL;
    15461549      ExecOnList(hwnd, bined, WINDOWED | SEPARATE, NULL, list, NULL,
    1547                 pszSrcFile, __LINE__);
     1550                pszSrcFile, __LINE__);
    15481551      return;
    15491552    }
     
    15551558      list[1] = NULL;
    15561559      ExecOnList(hwnd, editor, WINDOWED | SEPARATE, NULL, list, NULL,
    1557                 pszSrcFile, __LINE__);
     1560                pszSrcFile, __LINE__);
    15581561      return;
    15591562    }
     
    15871590      mi.afStyle = MIS_TEXT;
    15881591      WinSendMsg(hwndMenu, MM_QUERYITEM,
    1589                 MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi));
     1592                MPFROM2SHORT(IDM_FILESMENU, TRUE), MPFROMP(&mi));
    15901593      if (!DefMenu)
    1591         DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
     1594        DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
    15921595      hwndNow = mi.hwndSubMenu;
    15931596      mi.hwndSubMenu = hwndNew;
    15941597      if (!mi.hwndSubMenu)
    1595         mi.hwndSubMenu = DefMenu;
     1598        mi.hwndSubMenu = DefMenu;
    15961599      WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
    15971600      WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
     
    16181621      mi.afStyle = MIS_TEXT;
    16191622      WinSendMsg(hwndMenu, MM_QUERYITEM,
    1620                 MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi));
     1623                MPFROM2SHORT(IDM_VIEWSMENU, TRUE), MPFROMP(&mi));
    16211624      if (!DefMenu)
    1622         DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
     1625        DefMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, DEFMENU);
    16231626      hwndNow = mi.hwndSubMenu;
    16241627      mi.hwndSubMenu = hwndNew;
    16251628      if (!mi.hwndSubMenu)
    1626         mi.hwndSubMenu = DefMenu;
     1629        mi.hwndSubMenu = DefMenu;
    16271630      WinSetParent(hwndNow, WinQueryObjectWindow(HWND_DESKTOP), FALSE);
    16281631      WinSetOwner(hwndNow, WinQueryObjectWindow(HWND_DESKTOP));
     
    16571660      SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
    16581661      SetConditionalCascade(DirMenu, IDM_DELETESUBMENU,
    1659                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1662                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    16601663      SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES);
    16611664      SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
    16621665      if (fWorkPlace) {
    1663         WinSendMsg(DirMenu, MM_DELETEITEM,
    1664                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1665         WinSendMsg(DirMenu, MM_DELETEITEM,
    1666                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1666        WinSendMsg(DirMenu, MM_DELETEITEM,
     1667                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1668        WinSendMsg(DirMenu, MM_DELETEITEM,
     1669                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    16671670      }
    16681671    }
     
    16761679      SetConditionalCascade(TreeMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW);
    16771680      if (fWorkPlace) {
    1678         WinSendMsg(TreeMenu, MM_DELETEITEM,
    1679                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1680         WinSendMsg(TreeMenu, MM_DELETEITEM,
    1681                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1681        WinSendMsg(TreeMenu, MM_DELETEITEM,
     1682                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1683        WinSendMsg(TreeMenu, MM_DELETEITEM,
     1684                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    16821685      }
    16831686    }
     
    16881691      SetConditionalCascade(ArcMenu, IDM_VIEWSUBMENU, IDM_VIEW);
    16891692      if (fWorkPlace)
    1690         WinSendMsg(ArcMenu, MM_DELETEITEM,
    1691                    MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
     1693        WinSendMsg(ArcMenu, MM_DELETEITEM,
     1694                   MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
    16921695    }
    16931696    else if (hwndMenu == &FileMenu) {
     
    17011704      SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT);
    17021705      SetConditionalCascade(FileMenu, IDM_DELETESUBMENU,
    1703                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1706                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    17041707      SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT);
    17051708      SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
    17061709      if (fWorkPlace) {
    1707         WinSendMsg(FileMenu, MM_DELETEITEM,
    1708                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1709         WinSendMsg(FileMenu, MM_DELETEITEM,
    1710                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1710        WinSendMsg(FileMenu, MM_DELETEITEM,
     1711                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1712        WinSendMsg(FileMenu, MM_DELETEITEM,
     1713                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    17111714      }
    17121715    }
     
    17161719      SetConditionalCascade(DirCnrMenu, IDM_OPENSUBMENU, IDM_OPENSETTINGSME);
    17171720      if (fWorkPlace)
    1718         WinSendMsg(DirCnrMenu, MM_DELETEITEM,
    1719                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1721        WinSendMsg(DirCnrMenu, MM_DELETEITEM,
     1722                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    17201723    }
    17211724    else if (hwndMenu == &TreeCnrMenu) {
     
    17271730      SetConditionalCascade(ArcCnrMenu, IDM_EXTRACTSUBMENU, IDM_ARCEXTRACT);
    17281731      if (fWorkPlace)
    1729         WinSendMsg(ArcCnrMenu, MM_DELETEITEM,
    1730                    MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
     1732        WinSendMsg(ArcCnrMenu, MM_DELETEITEM,
     1733                   MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT, TRUE), MPVOID);
    17311734    }
    17321735    else if (hwndMenu == &CollectorCnrMenu) {
    17331736      WinSetWindowUShort(CollectorCnrMenu, QWS_ID, IDM_VIEWSMENU);
    17341737      SetConditionalCascade(CollectorCnrMenu, IDM_COLLECTMENU,
    1735                             IDM_COLLECTFROMCLIP);
     1738                            IDM_COLLECTFROMCLIP);
    17361739    }
    17371740    else if (hwndMenu == &CollectorFileMenu) {
    17381741      WinSetWindowUShort(CollectorFileMenu, QWS_ID, IDM_FILESMENU);
    17391742      SetConditionalCascade(CollectorFileMenu, IDM_COMMANDSMENU,
    1740                             IDM_DOITYOURSELF);
     1743                            IDM_DOITYOURSELF);
    17411744      SetConditionalCascade(CollectorFileMenu, IDM_COPYMENU, IDM_COPY);
    17421745      SetConditionalCascade(CollectorFileMenu, IDM_MOVEMENU, IDM_MOVE);
     
    17461749      SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT);
    17471750      SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU,
    1748                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1751                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    17491752      SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU,
    1750                             IDM_OPENDEFAULT);
     1753                            IDM_OPENDEFAULT);
    17511754      SetConditionalCascade(CollectorFileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW);
    17521755      if (fWorkPlace) {
    1753         WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
    1754                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1755         WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
    1756                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1756        WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
     1757                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1758        WinSendMsg(CollectorFileMenu, MM_DELETEITEM,
     1759                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    17571760      }
    17581761    }
     
    17601763      WinSetWindowUShort(CollectorDirMenu, QWS_ID, IDM_FILESMENU);
    17611764      SetConditionalCascade(CollectorDirMenu, IDM_COMMANDSMENU,
    1762                             IDM_DOITYOURSELF);
     1765                            IDM_DOITYOURSELF);
    17631766      SetConditionalCascade(CollectorDirMenu, IDM_COPYMENU, IDM_COPY);
    17641767      SetConditionalCascade(CollectorDirMenu, IDM_MOVEMENU, IDM_MOVE);
     
    17681771      SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS);
    17691772      SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU,
    1770                             fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
     1773                            fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE);
    17711774      SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES);
    17721775      SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU,
    1773                             IDM_OPENWINDOW);
     1776                            IDM_OPENWINDOW);
    17741777      if (fWorkPlace) {
    1775         WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
    1776                    MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
    1777         WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
    1778                    MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
     1778        WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
     1779                   MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID);
     1780        WinSendMsg(CollectorDirMenu, MM_DELETEITEM,
     1781                   MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID);
    17791782      }
    17801783    }
     
    17941797
    17951798  ln = (SHORT) WinSendMsg(hwnd, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0),
    1796                           MPFROMP(str));
     1799                          MPFROMP(str));
    17971800  if (ln)
    17981801    WinSendMsg(hwnd, LM_SELECTITEM, MPFROM2SHORT(ln, 0), MPVOID);
     
    18051808
    18061809  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1807                 MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) {
     1810                MPFROM2SHORT(SC_RESTORE, 128), MPFROMP(s))) {
    18081811    p = strchr(s, '\t');
    18091812    if (p) {
     
    18141817  }
    18151818  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1816                 MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) {
     1819                MPFROM2SHORT(SC_CLOSE, 128), MPFROMP(s))) {
    18171820    p = strchr(s, '\t');
    18181821    if (p) {
     
    18231826  }
    18241827  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1825                 MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) {
     1828                MPFROM2SHORT(SC_MOVE, 128), MPFROMP(s))) {
    18261829    p = strchr(s, '\t');
    18271830    if (p) {
     
    18321835  }
    18331836  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1834                 MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) {
     1837                MPFROM2SHORT(SC_SIZE, 128), MPFROMP(s))) {
    18351838    p = strchr(s, '\t');
    18361839    if (p) {
     
    18411844  }
    18421845  if (WinSendMsg(hwndSysMenu, MM_QUERYITEMTEXT,
    1843                 MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) {
     1846                MPFROM2SHORT(SC_MINIMIZE, 128), MPFROMP(s))) {
    18441847    p = strchr(s, '\t');
    18451848    if (p) {
     
    18501853  }
    18511854  if (WinSendMsg(hwndSysMenu,
    1852                 MM_QUERYITEMTEXT,
    1853                 MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) {
     1855                MM_QUERYITEMTEXT,
     1856                MPFROM2SHORT(SC_MAXIMIZE, 128), MPFROMP(s))) {
    18541857    p = strchr(s, '\t');
    18551858    if (p) {
     
    18601863  }
    18611864  if (WinSendMsg(hwndSysMenu,
    1862                 MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) {
     1865                MM_QUERYITEMTEXT, MPFROM2SHORT(SC_HIDE, 128), MPFROMP(s))) {
    18631866    p = strchr(s, '\t');
    18641867    if (p) {
     
    18831886    *str = 0;
    18841887    if (DosQuerySysInfo(QSV_BOOT_DRIVE,
    1885                         QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG)))
     1888                        QSV_BOOT_DRIVE, (PVOID) ver, (ULONG) sizeof(ULONG)))
    18861889      ver[0] = 3L;
    18871890    *configsys = (CHAR) ver[0] + '@';
    18881891    if (!DosQuerySysInfo(QSV_VERSION_MAJOR,
    1889                         QSV_VERSION_MINOR,
    1890                         (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30)
     1892                        QSV_VERSION_MINOR,
     1893                        (PVOID) ver, (ULONG) sizeof(ver)) && ver[1] >= 30)
    18911894      warp = TRUE;
    18921895    *var = *beg = *end = 0;
    18931896    if (warp) {
    18941897      if (!DosLoadModule(var, sizeof(var), "DOSCALL1.DLL", &hmod)) {
    1895         if (!DosQueryProcAddr(hmod,
    1896                               ORD_DOS32QUERYEXTLIBPATH,
    1897                               NULL, (PFN *) & DQELIBPATH)) {
    1898           DQELIBPATH(beg, BEGIN_LIBPATH);
    1899           DQELIBPATH(end, END_LIBPATH);
    1900         }
    1901         DosFreeModule(hmod);
     1898        if (!DosQueryProcAddr(hmod,
     1899                              ORD_DOS32QUERYEXTLIBPATH,
     1900                              NULL, (PFN *) & DQELIBPATH)) {
     1901          DQELIBPATH(beg, BEGIN_LIBPATH);
     1902          DQELIBPATH(end, END_LIBPATH);
     1903        }
     1904        DosFreeModule(hmod);
    19021905      }
    19031906      *var = 0;
     
    19061909    if (fp) {
    19071910      while (!feof(fp)) {
    1908         if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__))
    1909           break;
    1910         if (!strnicmp(var, "LIBPATH=", 8)) {
    1911           memmove(var, var + 8, strlen(var + 8) + 1);
    1912           lstrip(var);
    1913           break;
    1914         }
     1911        if (!xfgets_bstripcr(var, sizeof(var), fp, pszSrcFile, __LINE__))
     1912          break;
     1913        if (!strnicmp(var, "LIBPATH=", 8)) {
     1914          memmove(var, var + 8, strlen(var + 8) + 1);
     1915          lstrip(var);
     1916          break;
     1917        }
    19151918      }
    19161919      fclose(fp);
     
    19281931  WinCheckMenuItem(hwndMenu, IDM_TEXT, ((flWindowAttr & CV_TEXT)));
    19291932  WinCheckMenuItem(hwndMenu, IDM_ICON, ((flWindowAttr & CV_ICON) &&
    1930                                         !(flWindowAttr & CV_TREE)));
     1933                                        !(flWindowAttr & CV_TREE)));
    19311934  WinCheckMenuItem(hwndMenu, IDM_TREEVIEW, ((flWindowAttr & CV_TREE)));
    19321935  WinCheckMenuItem(hwndMenu, IDM_DETAILS, ((flWindowAttr & CV_DETAIL)));
     
    19411944  if (s) {
    19421945    sprintf(s, "S:%s%s",
    1943             sortflags & SORT_REVERSE ? "^" : NullStr,
    1944             (sortflags & SORT_FIRSTEXTENSION) ?
    1945               GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ?
    1946                 GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ?
    1947                   "Size" : (sortflags & SORT_EASIZE) ?
    1948                     (archive == 0) ?
    1949                       GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
    1950                     (sortflags & SORT_LWDATE) ?
    1951                       (archive == 0) ?
    1952                         GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
    1953                         (sortflags & SORT_LADATE) ?
    1954                           GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
    1955                             GetPString(IDS_CRDATE) :
    1956                             (sortflags & SORT_PATHNAME) ?
    1957                               GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
    1958                                 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
    1959                                   GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
     1946            sortflags & SORT_REVERSE ? "^" : NullStr,
     1947            (sortflags & SORT_FIRSTEXTENSION) ?
     1948              GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ?
     1949                GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ?
     1950                  "Size" : (sortflags & SORT_EASIZE) ?
     1951                    (archive == 0) ?
     1952                      GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
     1953                    (sortflags & SORT_LWDATE) ?
     1954                      (archive == 0) ?
     1955                        GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
     1956                        (sortflags & SORT_LADATE) ?
     1957                          GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ?
     1958                            GetPString(IDS_CRDATE) :
     1959                            (sortflags & SORT_PATHNAME) ?
     1960                              GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ?
     1961                                GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ?
     1962                                  GetPString(IDS_SUBJ) : GetPString(IDS_NAME));
    19601963    WinSetWindowText(hwnd, s);
    19611964    free(s);
     
    19701973  if (s) {
    19711974    sprintf(s, "V:%s%s",
    1972             (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) :
    1973             (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) :
    1974             (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) :
    1975             (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) :
    1976             GetPString(IDS_ICON),
    1977             ((flWindowAttr & CV_MINI) &&
    1978              !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
     1975            (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) :
     1976            (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) :
     1977            (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) :
     1978            (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) :
     1979            GetPString(IDS_ICON),
     1980            ((flWindowAttr & CV_MINI) &&
     1981             !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
    19791982    WinSetWindowText(hwnd, s);
    19801983    free(s);
     
    19891992  if (s) {
    19901993    sprintf(s, "F:%s%s",
    1991             mask->szMask,
    1992             (!archive && (mask->attrFile != ALLATTRS ||
    1993                           mask->antiattr != 0)) ? " " : NullStr,
    1994             (!archive && (mask->attrFile != ALLATTRS ||
    1995                           mask->antiattr !=
    1996                           0)) ? GetPString(IDS_ATTRTEXT) : NullStr);
     1994            mask->szMask,
     1995            (!archive && (mask->attrFile != ALLATTRS ||
     1996                          mask->antiattr != 0)) ? " " : NullStr,
     1997            (!archive && (mask->attrFile != ALLATTRS ||
     1998                          mask->antiattr !=
     1999                          0)) ? GetPString(IDS_ATTRTEXT) : NullStr);
    19972000    if (!s[2])
    19982001      sprintf(s, "F:%s", GetPString(IDS_ALLTEXT));
     
    20432046
    20442047  sItemCount = (SHORT) WinSendMsg(hwndMenu,
    2045                                   MM_QUERYITEMCOUNT, MPVOID, MPVOID);
     2048                                  MM_QUERYITEMCOUNT, MPVOID, MPVOID);
    20462049
    20472050  /* clean out old additions */
    20482051  while ((SHORT) WinSendMsg(hwndMenu,
    2049                             MM_DELETEITEM,
    2050                             MPFROM2SHORT(IDM_SWITCHSTART + x++,
    2051                                         TRUE), MPVOID) < sItemCount)
     2052                            MM_DELETEITEM,
     2053                            MPFROM2SHORT(IDM_SWITCHSTART + x++,
     2054                                        TRUE), MPVOID) < sItemCount)
    20522055    sItemCount--;
    20532056  x = 0;
    20542057  while ((SHORT) WinSendMsg(hwndMenu,
    2055                             MM_DELETEITEM,
    2056                             MPFROM2SHORT(IDM_WINDOWSTART + x++,
    2057                                         TRUE), MPVOID) < sItemCount)
     2058                            MM_DELETEITEM,
     2059                            MPFROM2SHORT(IDM_WINDOWSTART + x++,
     2060                                        TRUE), MPVOID) < sItemCount)
    20582061    sItemCount--;
    20592062
     
    20702073    while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
    20712074      if (WinQueryWindowUShort(hwndChild, QWS_ID) && hwndChild != hwndFrame) {
    2072         *wtext = 0;
    2073         WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext);
    2074         if (*wtext) {
    2075           wtext[CCHMAXPATH + 7] = 0;
    2076           mi.afStyle = MIS_TEXT;
    2077           if (!((x + sItemCount) % 28))
    2078             mi.afStyle |= MIS_BREAK;
    2079           mi.id = IDM_WINDOWSTART + x;
    2080           mi.iPosition = MIT_END;
    2081           if ((SHORT) WinSendMsg(hwndMenu,
    2082                                 MM_INSERTITEM,
    2083                                 MPFROMP(&mi), MPFROMP(wtext)) >= 0)
    2084             x++;
    2085         }
     2075        *wtext = 0;
     2076        WinQueryWindowText(hwndChild, CCHMAXPATH + 8, wtext);
     2077        if (*wtext) {
     2078          wtext[CCHMAXPATH + 7] = 0;
     2079          mi.afStyle = MIS_TEXT;
     2080          if (!((x + sItemCount) % 28))
     2081            mi.afStyle |= MIS_BREAK;
     2082          mi.id = IDM_WINDOWSTART + x;
     2083          mi.iPosition = MIT_END;
     2084          if ((SHORT) WinSendMsg(hwndMenu,
     2085                                MM_INSERTITEM,
     2086                                MPFROMP(&mi), MPFROMP(wtext)) >= 0)
     2087            x++;
     2088        }
    20862089      }
    20872090    }
     
    21102113      memset(&mi, 0, sizeof(mi));
    21112114      for (i = 0; i < pswb->cswentry; i++) {
    2112         if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&
    2113             pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&
    2114             (pswb->aswentry[i].swctl.idProcess != mypid ||
    2115              !hwndFrame ||
    2116              pswb->aswentry[i].swctl.hwnd != hwndFrame) &&
    2117             (pswb->aswentry[i].swctl.idProcess != mypid ||
    2118              !hwndTopFrame ||
    2119              pswb->aswentry[i].swctl.hwnd != hwndTopFrame ||
    2120              !WinIsChild(hwndFrame, hwndTop))) {
    2121           if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4)
    2122               || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2")
    2123               || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector")
    2124               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5)
    2125               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4)
    2126               || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) {
    2127             mi.afStyle = MIS_TEXT;
    2128             if (x && !(x % 28))
    2129               mi.afStyle |= MIS_BREAK;
    2130             mi.id = IDM_SWITCHSTART + y;
    2131             mi.iPosition = MIT_END;
    2132             switches[y] = pswb->aswentry[i].hswitch;
    2133             if ((SHORT) WinSendMsg(hwndMenu,
    2134                                    MM_INSERTITEM,
    2135                                    MPFROMP(&mi),
    2136                                    MPFROMP(pswb->aswentry[i].
    2137                                            swctl.szSwtitle)) >= 0) {
    2138               y++;
    2139               x++;
    2140             }
    2141           }
    2142         }
     2115        if (pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&
     2116            pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&
     2117            (pswb->aswentry[i].swctl.idProcess != mypid ||
     2118             !hwndFrame ||
     2119             pswb->aswentry[i].swctl.hwnd != hwndFrame) &&
     2120            (pswb->aswentry[i].swctl.idProcess != mypid ||
     2121             !hwndTopFrame ||
     2122             pswb->aswentry[i].swctl.hwnd != hwndTopFrame ||
     2123             !WinIsChild(hwndFrame, hwndTop))) {
     2124          if (!strnicmp(pswb->aswentry[i].swctl.szSwtitle, "AV/2", 4)
     2125              || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "File Manager/2")
     2126              || !stricmp(pswb->aswentry[i].swctl.szSwtitle, "Collector")
     2127              || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VTree", 5)
     2128              || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, "VDir", 4)
     2129              || !strnicmp(pswb->aswentry[i].swctl.szSwtitle, FM2Str, 4)) {
     2130            mi.afStyle = MIS_TEXT;
     2131            if (x && !(x % 28))
     2132              mi.afStyle |= MIS_BREAK;
     2133            mi.id = IDM_SWITCHSTART + y;
     2134            mi.iPosition = MIT_END;
     2135            switches[y] = pswb->aswentry[i].hswitch;
     2136            if ((SHORT) WinSendMsg(hwndMenu,
     2137                                   MM_INSERTITEM,
     2138                                   MPFROMP(&mi),
     2139                                   MPFROMP(pswb->aswentry[i].
     2140                                           swctl.szSwtitle)) >= 0) {
     2141              y++;
     2142              x++;
     2143            }
     2144          }
     2145        }
    21432146      }
    21442147      numswitches = y;
     
    21672170      mi.afStyle = MIS_TEXT;
    21682171      if (WinSendMsg(hwndMenu,
    2169                      MM_QUERYITEM,
    2170                      MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
    2171         hwndSubMenu = mi.hwndSubMenu;
     2172                     MM_QUERYITEM,
     2173                     MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
     2174        hwndSubMenu = mi.hwndSubMenu;
    21722175    }
    21732176    else
     
    21762179      *s = 0;
    21772180      if (WinSendMsg(hwndSubMenu,
    2178                      MM_QUERYITEMTEXT,
    2179                      MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) {
    2180 
    2181         HENUM henum;
    2182         CHAR checkText[CCHMAXPATH + 8];
    2183         SWP swp;
    2184 
    2185         s[CCHMAXPATH + 7] = 0;
    2186         henum = WinBeginEnumWindows(hwndMain);
    2187         while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
    2188           if (WinQueryWindowUShort(hwndChild, QWS_ID)) {
    2189             *checkText = 0;
    2190             WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText);
    2191             checkText[CCHMAXPATH + 7] = 0;
    2192             if (!stricmp(checkText, s)) {
    2193               if (WinQueryWindowPos(hwndChild, &swp)) {
    2194                 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
    2195                   WinSetWindowPos(hwndChild,
    2196                                   HWND_TOP,
    2197                                   0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER);
    2198               }
    2199               WinSetActiveWindow(HWND_DESKTOP, hwndChild);
    2200               ret = TRUE;
    2201               break;
    2202             }
    2203           }
    2204         }
    2205         WinEndEnumWindows(henum);
     2181                     MM_QUERYITEMTEXT,
     2182                     MPFROM2SHORT(cmd, CCHMAXPATH + 8), MPFROMP(s)) && *s) {
     2183
     2184        HENUM henum;
     2185        CHAR checkText[CCHMAXPATH + 8];
     2186        SWP swp;
     2187
     2188        s[CCHMAXPATH + 7] = 0;
     2189        henum = WinBeginEnumWindows(hwndMain);
     2190        while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
     2191          if (WinQueryWindowUShort(hwndChild, QWS_ID)) {
     2192            *checkText = 0;
     2193            WinQueryWindowText(hwndChild, CCHMAXPATH + 8, checkText);
     2194            checkText[CCHMAXPATH + 7] = 0;
     2195            if (!stricmp(checkText, s)) {
     2196              if (WinQueryWindowPos(hwndChild, &swp)) {
     2197                if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
     2198                  WinSetWindowPos(hwndChild,
     2199                                  HWND_TOP,
     2200                                  0, 0, 0, 0, SWP_RESTORE | SWP_ZORDER);
     2201              }
     2202              WinSetActiveWindow(HWND_DESKTOP, hwndChild);
     2203              ret = TRUE;
     2204              break;
     2205            }
     2206          }
     2207        }
     2208        WinEndEnumWindows(henum);
    22062209      }
    22072210    }
     
    22412244    if (ullFreeSpaceWhenComplete == 0) {
    22422245      saymsg(MB_OK,
    2243              HWND_DESKTOP,
    2244              NullStr,
     2246             HWND_DESKTOP,
     2247             NullStr,
    22452248             GetPString(IDS_DRIVESPACELIMITEDTMPSAVE),
    22462249             pTargetPath);
Note: See TracChangeset for help on using the changeset viewer.