Changeset 1161


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

Ticket 187: Draft 1: Functions only

Location:
trunk/dll
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filter.c

    r1119 r1161  
    5151static LINKMASKS *maskhead = NULL;
    5252static BOOL loadedmasks = FALSE;
     53
     54static VOID save_masks(VOID);
    5355
    5456INT APIENTRY Filter(PMINIRECORDCORE rmini, PVOID arg)
  • trunk/dll/grep2.c

    r1119 r1161  
    3131#include <ctype.h>
    3232#include <share.h>
    33 #include <process.h>                    // _beginthread
     33#include <process.h>                    // _beginthread
    3434
    3535#define INCL_DOS
    3636#define INCL_WIN
    37 #define INCL_LONGLONG                   // dircnrs.h
    38 #define INCL_WINSTDCNR                  // makelist.h
     37#define INCL_LONGLONG                   // dircnrs.h
     38#define INCL_WINSTDCNR                  // makelist.h
    3939
    4040#include "fm3dlg.h"
     
    4242#include "mle.h"
    4343#include "grep.h"
    44 #include "errutil.h"                    // Dos_Error...
    45 #include "strutil.h"                    // GetPString
     44#include "errutil.h"                    // Dos_Error...
     45#include "strutil.h"                    // GetPString
    4646#include "pathutil.h"                   // BldFullPathName
     47#include "walkem.h"                     // FillPathListBox
     48#include "grep2.h"
    4749#include "fm3dll.h"
     50#include "misc.h"                       // LoadLibPath
    4851#include "fortify.h"
    4952
     
    6770      *(CHAR *)mp2 = 0;
    6871      {
    69         CHAR *p;
    70         CHAR *pp;
    71 
    72         p = GetPString(IDS_ENVVARNAMES);
    73         while (*p == ' ')
    74           p++;
    75         while (*p) {
    76           *szPath = 0;
    77           pp = szPath;
    78           while (*p && *p != ' ')
    79             *pp++ = *p++;
    80           *pp = 0;
    81           while (*p == ' ')
    82             p++;
    83           if (*szPath)
    84             WinSendDlgItemMsg(hwnd,
    85                               ENV_LISTBOX,
    86                               LM_INSERTITEM,
    87                               MPFROM2SHORT(LIT_END, 0), MPFROMP(szPath));
    88         }
     72        CHAR *p;
     73        CHAR *pp;
     74
     75        p = GetPString(IDS_ENVVARNAMES);
     76        while (*p == ' ')
     77          p++;
     78        while (*p) {
     79          *szPath = 0;
     80          pp = szPath;
     81          while (*p && *p != ' ')
     82            *pp++ = *p++;
     83          *pp = 0;
     84          while (*p == ' ')
     85            p++;
     86          if (*szPath)
     87            WinSendDlgItemMsg(hwnd,
     88                              ENV_LISTBOX,
     89                              LM_INSERTITEM,
     90                              MPFROM2SHORT(LIT_END, 0), MPFROMP(szPath));
     91        }
    8992      }
    9093      WinSendDlgItemMsg(hwnd,
    91                         ENV_NAME,
    92                         EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     94                        ENV_NAME,
     95                        EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    9396      WinSetDlgItemText(hwnd, ENV_NAME, lastenv);
    9497      WinSendDlgItemMsg(hwnd,
    95                         ENV_NAME,
    96                         EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID);
     98                        ENV_NAME,
     99                        EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID);
    97100    }
    98101    else
     
    105108      switch (SHORT2FROMMP(mp1)) {
    106109      case LN_SELECT:
    107         {
    108           sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    109                                               ENV_LISTBOX,
    110                                               LM_QUERYSELECTION,
    111                                               MPFROMSHORT(LIT_FIRST), MPVOID);
    112           if (sSelect >= 0) {
    113             *s = 0;
    114             WinSendDlgItemMsg(hwnd,
    115                               ENV_LISTBOX,
    116                               LM_QUERYITEMTEXT,
    117                               MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
    118             bstrip(s);
    119             if (*s)
    120               WinSetDlgItemText(hwnd, ENV_NAME, s);
    121           }
    122         }
    123         break;
     110        {
     111          sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
     112                                              ENV_LISTBOX,
     113                                              LM_QUERYSELECTION,
     114                                              MPFROMSHORT(LIT_FIRST), MPVOID);
     115          if (sSelect >= 0) {
     116            *s = 0;
     117            WinSendDlgItemMsg(hwnd,
     118                              ENV_LISTBOX,
     119                              LM_QUERYITEMTEXT,
     120                              MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
     121            bstrip(s);
     122            if (*s)
     123              WinSetDlgItemText(hwnd, ENV_NAME, s);
     124          }
     125        }
     126        break;
    124127      case LN_ENTER:
    125         PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
    126         break;
     128        PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
     129        break;
    127130      }
    128131    }
     
    137140      p = WinQueryWindowPtr(hwnd, QWL_USER);
    138141      if (p) {
    139         WinQueryDlgItemText(hwnd, ENV_NAME, CCHMAXPATH, p);
    140         bstrip(p);
    141         if (!*p) {
    142           DosBeep(50, 100);
    143           WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ENV_NAME));
    144         }
    145         else {
    146           strcpy(lastenv, p);
    147           WinDismissDlg(hwnd, 1);
    148         }
     142        WinQueryDlgItemText(hwnd, ENV_NAME, CCHMAXPATH, p);
     143        bstrip(p);
     144        if (!*p) {
     145          DosBeep(50, 100);
     146          WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ENV_NAME));
     147        }
     148        else {
     149          strcpy(lastenv, p);
     150          WinDismissDlg(hwnd, 1);
     151        }
    149152      }
    150153      break;
    151154    case IDM_HELP:
    152155      if (hwndHelp)
    153         WinSendMsg(hwndHelp,
    154                    HM_DISPLAY_HELP,
    155                    MPFROM2SHORT(HELP_ENV, 0), MPFROMSHORT(HM_RESOURCEID));
     156        WinSendMsg(hwndHelp,
     157                   HM_DISPLAY_HELP,
     158                   MPFROM2SHORT(HELP_ENV, 0), MPFROMSHORT(HM_RESOURCEID));
    156159      break;
    157160    }
     
    199202    WinSetWindowULong(hwnd, QWL_USER, *(HWND *) mp2);
    200203    WinSendDlgItemMsg(hwnd,
    201                       GREP_MASK,
    202                       EM_SETTEXTLIMIT, MPFROM2SHORT(8192, 0), MPVOID);
     204                      GREP_MASK,
     205                      EM_SETTEXTLIMIT, MPFROM2SHORT(8192, 0), MPVOID);
    203206    MLEsetlimit(hwndMLE, 4096);
    204207    MLEsetformat(hwndMLE, MLFIE_NOTRANS);
    205208    WinSendDlgItemMsg(hwnd,
    206                       GREP_NEWER,
    207                       EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
     209                      GREP_NEWER,
     210                      EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
    208211    WinSendDlgItemMsg(hwnd,
    209                       GREP_OLDER,
    210                       EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
     212                      GREP_OLDER,
     213                      EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
    211214    WinSendDlgItemMsg(hwnd,
    212                       GREP_GREATER,
    213                       EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
     215                      GREP_GREATER,
     216                      EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
    214217    WinSendDlgItemMsg(hwnd,
    215                       GREP_LESSER,
    216                       EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
     218                      GREP_LESSER,
     219                      EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);
    217220    WinSetDlgItemText(hwnd, GREP_MASK, lastmask);
    218221    WinSendDlgItemMsg(hwnd,
    219                       GREP_MASK, EM_SETSEL, MPFROM2SHORT(0, 8192), MPVOID);
     222                      GREP_MASK, EM_SETSEL, MPFROM2SHORT(0, 8192), MPVOID);
    220223    PrfQueryProfileData(fmprof, FM3Str, "RememberFlagsGrep",
    221                         (PVOID) & gRemember, &size);
     224                        (PVOID) & gRemember, &size);
    222225    WinCheckButton(hwnd, GREP_REMEMBERFLAGS, gRemember);
    223226    if (gRemember) {
    224227      PrfQueryProfileData(fmprof, FM3Str, "Grep_Recurse",
    225                           (PVOID) & recurse, &size);
     228                          (PVOID) & recurse, &size);
    226229      PrfQueryProfileData(fmprof, FM3Str, "Grep_Absolute",
    227                           (PVOID) & absolute, &size);
     230                          (PVOID) & absolute, &size);
    228231      PrfQueryProfileData(fmprof, FM3Str, "Grep_Case",
    229                           (PVOID) & sensitive, &size);
     232                          (PVOID) & sensitive, &size);
    230233      PrfQueryProfileData(fmprof, FM3Str, "Grep_Sayfiles",
    231                           (PVOID) & sayfiles, &size);
     234                          (PVOID) & sayfiles, &size);
    232235      PrfQueryProfileData(fmprof, FM3Str, "Grep_Searchfiles",
    233                           (PVOID) & searchFiles, &size);
     236                          (PVOID) & searchFiles, &size);
    234237      PrfQueryProfileData(fmprof, FM3Str, "Grep_SearchfEAs",
    235                           (PVOID) & searchEAs, &size);
     238                          (PVOID) & searchEAs, &size);
    236239    }
    237240    if (!gRemember) {
     
    248251      MLEsetcurposa(hwndMLE, 4096);
    249252      if (!searchEAs)
    250         searchFiles = TRUE;
     253        searchFiles = TRUE;
    251254    }
    252255    WinCheckButton(hwnd, GREP_RECURSE, recurse);
     
    275278    if (fp) {
    276279      while (!feof(fp)) {
    277         if (!xfgets_bstripcr(s, 8192 + 4, fp, pszSrcFile, __LINE__))
    278           break;
    279         if (*s && *s != ';') {
    280           WinSendDlgItemMsg(hwnd,
    281                             GREP_LISTBOX,
    282                             LM_INSERTITEM,
    283                             MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));
    284         }
     280        if (!xfgets_bstripcr(s, 8192 + 4, fp, pszSrcFile, __LINE__))
     281          break;
     282        if (*s && *s != ';') {
     283          WinSendDlgItemMsg(hwnd,
     284                            GREP_LISTBOX,
     285                            LM_INSERTITEM,
     286                            MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));
     287        }
    285288      }
    286289      fclose(fp);
     
    288291
    289292    FillPathListBox(hwnd,
    290                     WinWindowFromID(hwnd, GREP_DRIVELIST),
    291                     (HWND) 0, NULL, FALSE);
     293                    WinWindowFromID(hwnd, GREP_DRIVELIST),
     294                    (HWND) 0, NULL, FALSE);
    292295    break;
    293296
     
    298301  case UM_SETDIR:
    299302    PaintRecessedWindow(WinWindowFromID(hwnd, GREP_HELP),
    300                         (HPS) 0, FALSE, TRUE);
     303                        (HPS) 0, FALSE, TRUE);
    301304    return 0;
    302305
     
    311314    case GREP_REMEMBERFLAGS:
    312315      {
    313         BOOL gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS);
    314 
    315         PrfWriteProfileData(fmprof, FM3Str, "RememberFlagsGrep",
    316                             (PVOID) & gRemember, sizeof(BOOL));
     316        BOOL gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS);
     317
     318        PrfWriteProfileData(fmprof, FM3Str, "RememberFlagsGrep",
     319                            (PVOID) & gRemember, sizeof(BOOL));
    317320      }
    318321      break;
     
    321324      switch (SHORT2FROMMP(mp1)) {
    322325      case LN_KILLFOCUS:
    323         WinSetDlgItemText(hwnd,
    324                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    325         break;
     326        WinSetDlgItemText(hwnd,
     327                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     328        break;
    326329      case LN_SETFOCUS:
    327         WinSetDlgItemText(hwnd,
    328                           GREP_HELP, GetPString(IDS_2CLICKADDDRVMASKTEXT));
    329         break;
     330        WinSetDlgItemText(hwnd,
     331                          GREP_HELP, GetPString(IDS_2CLICKADDDRVMASKTEXT));
     332        break;
    330333      case LN_ENTER:
    331         WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
    332         bstrip(s);
    333         p = strrchr(s, '\\');
    334         if (p)
    335           strcpy(simple, p);
    336         else if (*s) {
    337           strcpy(simple, "\\");
    338           strcat(simple, s);
    339           *s = 0;
    340         }
    341         else
    342           strcpy(simple, "\\*");
    343         if (simple[strlen(simple) - 1] == ';')
    344           simple[strlen(simple) - 1] = 0;
    345         lLen = strlen(simple) + 1;
    346         if (strlen(s) > 8192 - lLen) {
    347           Runtime_Error(pszSrcFile, __LINE__, "too big");
    348           WinSetDlgItemText(hwnd, GREP_MASK, s);
    349           break;
    350         }
    351 
    352         sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    353                                             GREP_DRIVELIST,
    354                                             LM_QUERYSELECTION,
    355                                             MPFROMSHORT(LIT_FIRST), MPVOID);
    356         if (sSelect >= 0) {
    357           if (*s && s[strlen(s) - 1] != ';')
    358             strcat(s, ";");
    359           WinSendDlgItemMsg(hwnd,
    360                             GREP_DRIVELIST,
    361                             LM_QUERYITEMTEXT,
    362                             MPFROM2SHORT(sSelect,
    363                                         (8192 - strlen(s)) - lLen),
    364                             MPFROMP(&s[strlen(s)]));
    365           rstrip(s);
    366           if (*s) {
    367             strcat(s, simple);
    368             WinSetDlgItemText(hwnd, GREP_MASK, s);
    369             WinSendDlgItemMsg(hwnd,
    370                               GREP_MASK,
    371                               EM_SETSEL,
    372                               MPFROM2SHORT(strlen(s) - (lLen + 1),
    373                                            strlen(s)), MPVOID);
    374             PostMsg(hwnd,
    375                     UM_FOCUSME,
    376                     MPFROMLONG(WinWindowFromID(hwnd, GREP_MASK)), MPVOID);
    377           }
    378         }
    379         break;                          // LN_ENTER
    380       }                                 // switch
     334        WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
     335        bstrip(s);
     336        p = strrchr(s, '\\');
     337        if (p)
     338          strcpy(simple, p);
     339        else if (*s) {
     340          strcpy(simple, "\\");
     341          strcat(simple, s);
     342          *s = 0;
     343        }
     344        else
     345          strcpy(simple, "\\*");
     346        if (simple[strlen(simple) - 1] == ';')
     347          simple[strlen(simple) - 1] = 0;
     348        lLen = strlen(simple) + 1;
     349        if (strlen(s) > 8192 - lLen) {
     350          Runtime_Error(pszSrcFile, __LINE__, "too big");
     351          WinSetDlgItemText(hwnd, GREP_MASK, s);
     352          break;
     353        }
     354
     355        sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
     356                                            GREP_DRIVELIST,
     357                                            LM_QUERYSELECTION,
     358                                            MPFROMSHORT(LIT_FIRST), MPVOID);
     359        if (sSelect >= 0) {
     360          if (*s && s[strlen(s) - 1] != ';')
     361            strcat(s, ";");
     362          WinSendDlgItemMsg(hwnd,
     363                            GREP_DRIVELIST,
     364                            LM_QUERYITEMTEXT,
     365                            MPFROM2SHORT(sSelect,
     366                                        (8192 - strlen(s)) - lLen),
     367                            MPFROMP(&s[strlen(s)]));
     368          rstrip(s);
     369          if (*s) {
     370            strcat(s, simple);
     371            WinSetDlgItemText(hwnd, GREP_MASK, s);
     372            WinSendDlgItemMsg(hwnd,
     373                              GREP_MASK,
     374                              EM_SETSEL,
     375                              MPFROM2SHORT(strlen(s) - (lLen + 1),
     376                                           strlen(s)), MPVOID);
     377            PostMsg(hwnd,
     378                    UM_FOCUSME,
     379                    MPFROMLONG(WinWindowFromID(hwnd, GREP_MASK)), MPVOID);
     380          }
     381        }
     382        break;                          // LN_ENTER
     383      }                                 // switch
    381384      break;
    382385
     
    384387      switch (SHORT2FROMMP(mp1)) {
    385388      case LN_KILLFOCUS:
    386         WinSetDlgItemText(hwnd,
    387                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    388         break;
     389        WinSetDlgItemText(hwnd,
     390                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     391        break;
    389392      case LN_SETFOCUS:
    390         WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_ADDSELDELMASKTEXT));
    391         break;
     393        WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_ADDSELDELMASKTEXT));
     394        break;
    392395      case LN_ENTER:
    393396      case LN_SELECT:
    394         if ((SHORT2FROMMP(mp1) == LN_ENTER &&
    395              !WinQueryButtonCheckstate(hwnd, GREP_APPEND)) ||
    396             (SHORT2FROMMP(mp1) == LN_SELECT &&
    397              WinQueryButtonCheckstate(hwnd, GREP_APPEND)))
    398           break;
    399         {
    400           sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    401                                               GREP_LISTBOX,
    402                                               LM_QUERYSELECTION,
    403                                               MPFROMSHORT(LIT_FIRST), MPVOID);
    404           if (sSelect >= 0) {
    405             *s = 0;
    406             if (WinQueryButtonCheckstate(hwnd, GREP_APPEND)) {
    407               WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
    408               bstrip(s);
    409               if (*s && strlen(s) < 8190 && s[strlen(s) - 1] != ';')
    410                 strcat(s, ";");
    411             }
    412             WinSendDlgItemMsg(hwnd,
    413                               GREP_LISTBOX,
    414                               LM_QUERYITEMTEXT,
    415                               MPFROM2SHORT(sSelect, 8192 - strlen(s)),
    416                               MPFROMP(s + strlen(s)));
    417             bstrip(s);
    418             if (*s)
    419               WinSetDlgItemText(hwnd, GREP_MASK, s);
    420           }
    421         }
    422         break;
     397        if ((SHORT2FROMMP(mp1) == LN_ENTER &&
     398             !WinQueryButtonCheckstate(hwnd, GREP_APPEND)) ||
     399            (SHORT2FROMMP(mp1) == LN_SELECT &&
     400             WinQueryButtonCheckstate(hwnd, GREP_APPEND)))
     401          break;
     402        {
     403          sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
     404                                              GREP_LISTBOX,
     405                                              LM_QUERYSELECTION,
     406                                              MPFROMSHORT(LIT_FIRST), MPVOID);
     407          if (sSelect >= 0) {
     408            *s = 0;
     409            if (WinQueryButtonCheckstate(hwnd, GREP_APPEND)) {
     410              WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
     411              bstrip(s);
     412              if (*s && strlen(s) < 8190 && s[strlen(s) - 1] != ';')
     413                strcat(s, ";");
     414            }
     415            WinSendDlgItemMsg(hwnd,
     416                              GREP_LISTBOX,
     417                              LM_QUERYITEMTEXT,
     418                              MPFROM2SHORT(sSelect, 8192 - strlen(s)),
     419                              MPFROMP(s + strlen(s)));
     420            bstrip(s);
     421            if (*s)
     422              WinSetDlgItemText(hwnd, GREP_MASK, s);
     423          }
     424        }
     425        break;
    423426      }
    424427      break;
     
    426429    case GREP_MASK:
    427430      if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    428         WinSetDlgItemText(hwnd,
    429                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     431        WinSetDlgItemText(hwnd,
     432                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    430433      if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    431         WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MASKSFINDTEXT));
     434        WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MASKSFINDTEXT));
    432435      break;
    433436    case GREP_SEARCH:
    434437      if (SHORT2FROMMP(mp1) == MLN_KILLFOCUS)
    435         WinSetDlgItemText(hwnd,
    436                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     438        WinSetDlgItemText(hwnd,
     439                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    437440      if (SHORT2FROMMP(mp1) == MLN_SETFOCUS)
    438         WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_TEXTFINDTEXT));
     441        WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_TEXTFINDTEXT));
    439442      break;
    440443    case GREP_GREATER:
    441444      if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    442         WinSetDlgItemText(hwnd,
    443                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     445        WinSetDlgItemText(hwnd,
     446                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    444447      if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    445         WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINSIZEFINDTEXT));
     448        WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINSIZEFINDTEXT));
    446449      break;
    447450    case GREP_LESSER:
    448451      if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    449         WinSetDlgItemText(hwnd,
    450                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     452        WinSetDlgItemText(hwnd,
     453                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    451454      if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    452         WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXSIZEFINDTEXT));
     455        WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXSIZEFINDTEXT));
    453456      break;
    454457    case GREP_NEWER:
    455458      if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    456         WinSetDlgItemText(hwnd,
    457                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     459        WinSetDlgItemText(hwnd,
     460                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    458461      if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    459         WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXAGEFINDTEXT));
     462        WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXAGEFINDTEXT));
    460463      break;
    461464    case GREP_OLDER:
    462465      if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    463         WinSetDlgItemText(hwnd,
    464                           GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
     466        WinSetDlgItemText(hwnd,
     467                          GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));
    465468      if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    466         WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINAGEFINDTEXT));
     469        WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINAGEFINDTEXT));
    467470      break;
    468471    case GREP_FINDDUPES:
    469472      {
    470         BOOL finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES);
    471 
    472         WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCH), !finddupes);
    473         WinEnableWindow(WinWindowFromID(hwnd, GREP_ABSOLUTE), !finddupes);
    474         WinEnableWindow(WinWindowFromID(hwnd, GREP_CASE), !finddupes);
    475         WinEnableWindow(WinWindowFromID(hwnd, GREP_CRCDUPES), finddupes);
    476         WinEnableWindow(WinWindowFromID(hwnd, GREP_NOSIZEDUPES), finddupes);
    477         WinEnableWindow(WinWindowFromID(hwnd, GREP_IGNOREEXTDUPES),
    478                         finddupes);
    479         WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHFILES), !finddupes);
    480         WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHEAS), !finddupes);
    481         WinEnableWindow(WinWindowFromID(hwnd, GREP_GREATER), !finddupes);
    482         WinEnableWindow(WinWindowFromID(hwnd, GREP_LESSER), !finddupes);
    483         WinEnableWindow(WinWindowFromID(hwnd, GREP_NEWER), !finddupes);
    484         WinEnableWindow(WinWindowFromID(hwnd, GREP_OLDER), !finddupes);
    485         WinEnableWindow(WinWindowFromID(hwnd, GREP_FINDIFANY), !finddupes);
    486         WinEnableWindow(WinWindowFromID(hwnd, GREP_GK), !finddupes);
    487         WinEnableWindow(WinWindowFromID(hwnd, GREP_LK), !finddupes);
    488         WinEnableWindow(WinWindowFromID(hwnd, GREP_NM), !finddupes);
    489         WinEnableWindow(WinWindowFromID(hwnd, GREP_OM), !finddupes);
    490         if (finddupes)
    491           WinCheckButton(hwnd, GREP_RECURSE, TRUE);
     473        BOOL finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES);
     474
     475        WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCH), !finddupes);
     476        WinEnableWindow(WinWindowFromID(hwnd, GREP_ABSOLUTE), !finddupes);
     477        WinEnableWindow(WinWindowFromID(hwnd, GREP_CASE), !finddupes);
     478        WinEnableWindow(WinWindowFromID(hwnd, GREP_CRCDUPES), finddupes);
     479        WinEnableWindow(WinWindowFromID(hwnd, GREP_NOSIZEDUPES), finddupes);
     480        WinEnableWindow(WinWindowFromID(hwnd, GREP_IGNOREEXTDUPES),
     481                        finddupes);
     482        WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHFILES), !finddupes);
     483        WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHEAS), !finddupes);
     484        WinEnableWindow(WinWindowFromID(hwnd, GREP_GREATER), !finddupes);
     485        WinEnableWindow(WinWindowFromID(hwnd, GREP_LESSER), !finddupes);
     486        WinEnableWindow(WinWindowFromID(hwnd, GREP_NEWER), !finddupes);
     487        WinEnableWindow(WinWindowFromID(hwnd, GREP_OLDER), !finddupes);
     488        WinEnableWindow(WinWindowFromID(hwnd, GREP_FINDIFANY), !finddupes);
     489        WinEnableWindow(WinWindowFromID(hwnd, GREP_GK), !finddupes);
     490        WinEnableWindow(WinWindowFromID(hwnd, GREP_LK), !finddupes);
     491        WinEnableWindow(WinWindowFromID(hwnd, GREP_NM), !finddupes);
     492        WinEnableWindow(WinWindowFromID(hwnd, GREP_OM), !finddupes);
     493        if (finddupes)
     494          WinCheckButton(hwnd, GREP_RECURSE, TRUE);
    492495      }
    493496    }
     
    498501    case GREP_ENV:
    499502      {
    500         CHAR *t;
    501         CHAR env[8192];
    502 
    503         *path = 0;
    504         if (!WinDlgBox(HWND_DESKTOP,
    505                        hwnd, EnvDlgProc, FM3ModHandle, ENV_FRAME, path)) {
    506           break;
    507         }
    508         bstrip(path);
    509         if (!*path)
    510           break;
    511         if (!stricmp(path, "LIBPATH"))
    512           LoadLibPath(env, 8192);
    513         else {
    514           p = getenv(path);
    515           if (!p)
    516             break;
    517           strcpy(env, p);
    518         }
    519         bstrip(env);
    520         if (!*env)
    521           break;
    522         WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
    523         bstrip(s);
    524         if (strlen(s) > 8192 - 5) {
    525           Runtime_Error(pszSrcFile, __LINE__, "too big");
    526           break;
    527         }
    528         p = strrchr(s, '\\');
    529         if (p)
    530           strcpy(simple, p + 1);
    531         else if (*s)
    532           strcpy(simple, s);
    533         else
    534           strcpy(simple, "*");
    535         if (!p)
    536           *s = 0;
    537         if (simple[strlen(simple) - 1] == ';')
    538           simple[strlen(simple) - 1] = 0;
    539         lLen = strlen(simple) + 1;
    540         p = env;
    541         while (p && *p) {
    542           strncpy(path, p, CCHMAXPATH - 1);
    543           path[CCHMAXPATH - 1] = 0;
    544           t = strchr(path, ';');
    545           if (t)
    546             *t = 0;
    547           bstrip(path);
    548           if (isalpha(*path) && path[1] == ':' && path[2] == '\\') {
    549             if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) {
    550               WinSetDlgItemText(hwnd, GREP_MASK, s);
    551               break;
    552             }
    553             if (!*s || (*s && s[strlen(s) - 1] != ';')) {
    554               if (*s)
    555                 strcat(s, ";");
    556               strcat(s, path);
    557               lLen += strlen(path);
    558               if (s[strlen(s) - 1] != '\\') {
    559                 lLen++;
    560                 strcat(s, "\\");
    561               }
    562               rstrip(s);
    563               if (*s) {
    564                 strcat(s, simple);
    565                 WinSetDlgItemText(hwnd, GREP_MASK, s);
    566                 WinSendDlgItemMsg(hwnd,
    567                                   GREP_MASK,
    568                                   EM_SETSEL,
    569                                   MPFROM2SHORT(strlen(s) - (lLen - 1),
    570                                                strlen(s)), MPVOID);
    571               }
    572             }
    573           }
    574           p = strchr(p, ';');
    575           if (p)
    576             p++;
    577         }
     503        CHAR *t;
     504        CHAR env[8192];
     505
     506        *path = 0;
     507        if (!WinDlgBox(HWND_DESKTOP,
     508                       hwnd, EnvDlgProc, FM3ModHandle, ENV_FRAME, path)) {
     509          break;
     510        }
     511        bstrip(path);
     512        if (!*path)
     513          break;
     514        if (!stricmp(path, "LIBPATH"))
     515          LoadLibPath(env, 8192);
     516        else {
     517          p = getenv(path);
     518          if (!p)
     519            break;
     520          strcpy(env, p);
     521        }
     522        bstrip(env);
     523        if (!*env)
     524          break;
     525        WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
     526        bstrip(s);
     527        if (strlen(s) > 8192 - 5) {
     528          Runtime_Error(pszSrcFile, __LINE__, "too big");
     529          break;
     530        }
     531        p = strrchr(s, '\\');
     532        if (p)
     533          strcpy(simple, p + 1);
     534        else if (*s)
     535          strcpy(simple, s);
     536        else
     537          strcpy(simple, "*");
     538        if (!p)
     539          *s = 0;
     540        if (simple[strlen(simple) - 1] == ';')
     541          simple[strlen(simple) - 1] = 0;
     542        lLen = strlen(simple) + 1;
     543        p = env;
     544        while (p && *p) {
     545          strncpy(path, p, CCHMAXPATH - 1);
     546          path[CCHMAXPATH - 1] = 0;
     547          t = strchr(path, ';');
     548          if (t)
     549            *t = 0;
     550          bstrip(path);
     551          if (isalpha(*path) && path[1] == ':' && path[2] == '\\') {
     552            if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) {
     553              WinSetDlgItemText(hwnd, GREP_MASK, s);
     554              break;
     555            }
     556            if (!*s || (*s && s[strlen(s) - 1] != ';')) {
     557              if (*s)
     558                strcat(s, ";");
     559              strcat(s, path);
     560              lLen += strlen(path);
     561              if (s[strlen(s) - 1] != '\\') {
     562                lLen++;
     563                strcat(s, "\\");
     564              }
     565              rstrip(s);
     566              if (*s) {
     567                strcat(s, simple);
     568                WinSetDlgItemText(hwnd, GREP_MASK, s);
     569                WinSendDlgItemMsg(hwnd,
     570                                  GREP_MASK,
     571                                  EM_SETSEL,
     572                                  MPFROM2SHORT(strlen(s) - (lLen - 1),
     573                                               strlen(s)), MPVOID);
     574              }
     575            }
     576          }
     577          p = strchr(p, ';');
     578          if (p)
     579            p++;
     580        }
    578581      }
    579582      break;
     
    583586      bstrip(s);
    584587      if (strlen(s) > 8192 - 5) {
    585         Runtime_Error(pszSrcFile, __LINE__, "too big");
    586         break;
     588        Runtime_Error(pszSrcFile, __LINE__, "too big");
     589        break;
    587590      }
    588591      *path = 0;
    589592      if (WinDlgBox(HWND_DESKTOP,
    590                     hwnd,
    591                     WalkAllDlgProc,
    592                     FM3ModHandle, WALK_FRAME, MPFROMP(path)) && *path) {
    593         p = strrchr(s, '\\');
    594         if (p)
    595           strcpy(simple, p + 1);
    596         else if (*s)
    597           strcpy(simple, s);
    598         else
    599           strcpy(simple, "*");
    600         if (!p)
    601           *s = 0;
    602         if (simple[strlen(simple) - 1] == ';')
    603           simple[strlen(simple) - 1] = 0;
    604         lLen = strlen(simple) + 1;
    605         if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) {
    606           Runtime_Error(pszSrcFile, __LINE__, "too big");
    607           WinSetDlgItemText(hwnd, GREP_MASK, s);
    608           break;
    609         }
    610         if (!*s || (*s && s[strlen(s) - 1] != ';')) {
    611           if (*s)
    612             strcat(s, ";");
    613           strcat(s, path);
    614           lLen += strlen(path);
    615           if (s[strlen(s) - 1] != '\\') {
    616             lLen++;
    617             strcat(s, "\\");
    618           }
    619           rstrip(s);
    620           if (*s) {
    621             strcat(s, simple);
    622             WinSetDlgItemText(hwnd, GREP_MASK, s);
    623             WinSendDlgItemMsg(hwnd,
    624                               GREP_MASK,
    625                               EM_SETSEL,
    626                               MPFROM2SHORT(strlen(s) - (lLen - 1),
    627                                            strlen(s)), MPVOID);
    628           }
    629         }
     593                    hwnd,
     594                    WalkAllDlgProc,
     595                    FM3ModHandle, WALK_FRAME, MPFROMP(path)) && *path) {
     596        p = strrchr(s, '\\');
     597        if (p)
     598          strcpy(simple, p + 1);
     599        else if (*s)
     600          strcpy(simple, s);
     601        else
     602          strcpy(simple, "*");
     603        if (!p)
     604          *s = 0;
     605        if (simple[strlen(simple) - 1] == ';')
     606          simple[strlen(simple) - 1] = 0;
     607        lLen = strlen(simple) + 1;
     608        if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) {
     609          Runtime_Error(pszSrcFile, __LINE__, "too big");
     610          WinSetDlgItemText(hwnd, GREP_MASK, s);
     611          break;
     612        }
     613        if (!*s || (*s && s[strlen(s) - 1] != ';')) {
     614          if (*s)
     615            strcat(s, ";");
     616          strcat(s, path);
     617          lLen += strlen(path);
     618          if (s[strlen(s) - 1] != '\\') {
     619            lLen++;
     620            strcat(s, "\\");
     621          }
     622          rstrip(s);
     623          if (*s) {
     624            strcat(s, simple);
     625            WinSetDlgItemText(hwnd, GREP_MASK, s);
     626            WinSendDlgItemMsg(hwnd,
     627                              GREP_MASK,
     628                              EM_SETSEL,
     629                              MPFROM2SHORT(strlen(s) - (lLen - 1),
     630                                           strlen(s)), MPVOID);
     631          }
     632        }
    630633      }
    631634      break;
     
    636639      bstrip(s);
    637640      if (*s) {
    638         sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    639                                             GREP_LISTBOX,
    640                                             LM_SEARCHSTRING,
    641                                             MPFROM2SHORT(0, LIT_FIRST),
    642                                             MPFROMP(s));
    643         if (sSelect < 0) {
    644           WinSendDlgItemMsg(hwnd,
    645                             GREP_LISTBOX,
    646                             LM_INSERTITEM,
    647                             MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));
    648           changed = TRUE;
    649         }
     641        sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
     642                                            GREP_LISTBOX,
     643                                            LM_SEARCHSTRING,
     644                                            MPFROM2SHORT(0, LIT_FIRST),
     645                                            MPFROMP(s));
     646        if (sSelect < 0) {
     647          WinSendDlgItemMsg(hwnd,
     648                            GREP_LISTBOX,
     649                            LM_INSERTITEM,
     650                            MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));
     651          changed = TRUE;
     652        }
    650653      }
    651654      break;
     
    653656    case GREP_DELETE:
    654657      sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    655                                           GREP_LISTBOX,
    656                                           LM_QUERYSELECTION,
    657                                           MPFROMSHORT(LIT_FIRST), MPVOID);
     658                                          GREP_LISTBOX,
     659                                          LM_QUERYSELECTION,
     660                                          MPFROMSHORT(LIT_FIRST), MPVOID);
    658661      if (sSelect >= 0) {
    659         WinSendDlgItemMsg(hwnd,
    660                           GREP_LISTBOX,
    661                           LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID);
    662         changed = TRUE;
     662        WinSendDlgItemMsg(hwnd,
     663                          GREP_LISTBOX,
     664                          LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID);
     665        changed = TRUE;
    663666      }
    664667      break;
     
    702705    case IDM_HELP:
    703706      if (hwndHelp)
    704         WinSendMsg(hwndHelp,
    705                    HM_DISPLAY_HELP,
    706                    MPFROM2SHORT(HELP_GREP, 0), MPFROMSHORT(HM_RESOURCEID));
     707        WinSendMsg(hwndHelp,
     708                   HM_DISPLAY_HELP,
     709                   MPFROM2SHORT(HELP_GREP, 0), MPFROMSHORT(HM_RESOURCEID));
    707710      break;
    708711
     
    711714    case GREP_ALLHDS:
    712715      {
    713         CHAR szDrive[] = " :\\";
    714         ULONG ulDriveNum;
    715         ULONG ulDriveMap;
    716         INT x;
    717         BOOL incl;
    718 
    719         CHAR new[8192];
    720 
    721         *s = 0;
    722         WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
    723         s[8192 - 1] = 0;
    724         p = strchr(s, ';');
    725         if (p)
    726           *p = 0;
    727         p = strrchr(s, '\\');
    728         if (!p)
    729           p = strrchr(s, '/');
    730         if (!p)
    731           p = strrchr(s, ':');
    732         if (p)
    733           strcpy(s, p + 1);
    734         if (!*s)
    735           strcpy(s, "*");
    736         DosError(FERR_DISABLEHARDERR);
    737         DosQCurDisk(&ulDriveNum, &ulDriveMap);
    738         *new = 0;
    739         for (x = 2; x < 26; x++) {
    740           if (ulDriveMap & (1L << x)) {
    741             incl = FALSE;
    742             switch (SHORT1FROMMP(mp1)) {
    743             case GREP_ALLHDS:
    744               if (!(driveflags[x] & (DRIVE_REMOVABLE | DRIVE_IGNORE)))
    745                 incl = TRUE;
    746               break;
    747             case GREP_LOCALHDS:
    748               if (!(driveflags[x] &
    749                     (DRIVE_REMOVABLE | DRIVE_IGNORE | DRIVE_REMOTE |
    750                      DRIVE_VIRTUAL)))
    751                 incl = TRUE;
    752               break;
    753             case GREP_REMOTEHDS:
    754               if (!(driveflags[x] &
    755                     (DRIVE_REMOVABLE | DRIVE_IGNORE)) &&
    756                   (driveflags[x] & DRIVE_REMOTE))
    757                 incl = TRUE;
    758               break;
    759             }
    760           }
    761           if (incl) {
    762             if (strlen(new) + strlen(s) + 5 < 8192 - 1) {
    763               if (*new)
    764                 strcat(new, ";");
    765               *szDrive = x + 'A';
    766               strcat(new, szDrive);
    767               strcat(new, s);
    768             }
    769           }
    770         }
    771         if (*new)
    772           WinSetDlgItemText(hwnd, GREP_MASK, new);
     716        CHAR szDrive[] = " :\\";
     717        ULONG ulDriveNum;
     718        ULONG ulDriveMap;
     719        INT x;
     720        BOOL incl;
     721
     722        CHAR new[8192];
     723
     724        *s = 0;
     725        WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);
     726        s[8192 - 1] = 0;
     727        p = strchr(s, ';');
     728        if (p)
     729          *p = 0;
     730        p = strrchr(s, '\\');
     731        if (!p)
     732          p = strrchr(s, '/');
     733        if (!p)
     734          p = strrchr(s, ':');
     735        if (p)
     736          strcpy(s, p + 1);
     737        if (!*s)
     738          strcpy(s, "*");
     739        DosError(FERR_DISABLEHARDERR);
     740        DosQCurDisk(&ulDriveNum, &ulDriveMap);
     741        *new = 0;
     742        for (x = 2; x < 26; x++) {
     743          if (ulDriveMap & (1L << x)) {
     744            incl = FALSE;
     745            switch (SHORT1FROMMP(mp1)) {
     746            case GREP_ALLHDS:
     747              if (!(driveflags[x] & (DRIVE_REMOVABLE | DRIVE_IGNORE)))
     748                incl = TRUE;
     749              break;
     750            case GREP_LOCALHDS:
     751              if (!(driveflags[x] &
     752                    (DRIVE_REMOVABLE | DRIVE_IGNORE | DRIVE_REMOTE |
     753                     DRIVE_VIRTUAL)))
     754                incl = TRUE;
     755              break;
     756            case GREP_REMOTEHDS:
     757              if (!(driveflags[x] &
     758                    (DRIVE_REMOVABLE | DRIVE_IGNORE)) &&
     759                  (driveflags[x] & DRIVE_REMOTE))
     760                incl = TRUE;
     761              break;
     762            }
     763          }
     764          if (incl) {
     765            if (strlen(new) + strlen(s) + 5 < 8192 - 1) {
     766              if (*new)
     767                strcat(new, ";");
     768              *szDrive = x + 'A';
     769              strcat(new, szDrive);
     770              strcat(new, s);
     771            }
     772          }
     773        }
     774        if (*new)
     775          WinSetDlgItemText(hwnd, GREP_MASK, new);
    773776      }
    774777      break;
     
    777780      hwndCollect = WinQueryWindowULong(hwnd, QWL_USER);
    778781      if (!hwndCollect)
    779         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     782        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    780783      else {
    781         // 07 Feb 08 SHL - fixme to malloc and free in thread
    782         static GREP g;          // Passed to thread
    783 
    784         p = xmalloc(8192 + 512, pszSrcFile, __LINE__);
    785         if (!p)
    786           break;
    787         memset(&g, 0, sizeof(GREP));
    788         g.size = sizeof(GREP);
    789         recurse = WinQueryButtonCheckstate(hwnd, GREP_RECURSE) != 0;
    790         absolute = WinQueryButtonCheckstate(hwnd, GREP_ABSOLUTE) != 0;
    791         sensitive = WinQueryButtonCheckstate(hwnd, GREP_CASE) != 0;
    792         sayfiles = WinQueryButtonCheckstate(hwnd, GREP_SAYFILES) != 0;
    793         searchEAs = WinQueryButtonCheckstate(hwnd, GREP_SEARCHEAS) != 0;
    794         searchFiles = WinQueryButtonCheckstate(hwnd, GREP_SEARCHFILES) != 0;
    795         findifany = WinQueryButtonCheckstate(hwnd, GREP_FINDIFANY) != 0;
    796         gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS);
    797         if (gRemember) {
    798           PrfWriteProfileData(fmprof, FM3Str, "Grep_Recurse",
    799                               (PVOID) & recurse, sizeof(BOOL));
    800           PrfWriteProfileData(fmprof, FM3Str, "Grep_Absolute",
    801                               (PVOID) & absolute, sizeof(BOOL));
    802           PrfWriteProfileData(fmprof, FM3Str, "Grep_Case",
    803                               (PVOID) & sensitive, sizeof(BOOL));
    804           PrfWriteProfileData(fmprof, FM3Str, "Grep_Sayfiles",
    805                               (PVOID) & sayfiles, sizeof(BOOL));
    806           PrfWriteProfileData(fmprof, FM3Str, "Grep_Searchfiles",
    807                               (PVOID) & searchFiles, sizeof(BOOL));
    808           PrfWriteProfileData(fmprof, FM3Str, "Grep_SearchfEAs",
    809                               (PVOID) & searchEAs, sizeof(BOOL));
    810         }
    811         g.finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES) != 0;
    812         if (g.finddupes) {
    813           g.CRCdupes = WinQueryButtonCheckstate(hwnd, GREP_CRCDUPES) != 0;
    814           g.nosizedupes =
    815             WinQueryButtonCheckstate(hwnd, GREP_NOSIZEDUPES) != 0;
    816           g.ignoreextdupes =
    817             WinQueryButtonCheckstate(hwnd, GREP_IGNOREEXTDUPES) != 0;
    818         }
    819         // Parse file masks
    820         *p = 0;
    821         WinQueryDlgItemText(hwnd, GREP_MASK, 8192, p);
    822         bstrip(p);
    823         if (!*p) {
    824           DosBeep(50, 100);
    825           WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK));
    826           free(p);
     784        // 07 Feb 08 SHL - fixme to malloc and free in thread
     785        static GREP g;          // Passed to thread
     786
     787        p = xmalloc(8192 + 512, pszSrcFile, __LINE__);
     788        if (!p)
     789          break;
     790        memset(&g, 0, sizeof(GREP));
     791        g.size = sizeof(GREP);
     792        recurse = WinQueryButtonCheckstate(hwnd, GREP_RECURSE) != 0;
     793        absolute = WinQueryButtonCheckstate(hwnd, GREP_ABSOLUTE) != 0;
     794        sensitive = WinQueryButtonCheckstate(hwnd, GREP_CASE) != 0;
     795        sayfiles = WinQueryButtonCheckstate(hwnd, GREP_SAYFILES) != 0;
     796        searchEAs = WinQueryButtonCheckstate(hwnd, GREP_SEARCHEAS) != 0;
     797        searchFiles = WinQueryButtonCheckstate(hwnd, GREP_SEARCHFILES) != 0;
     798        findifany = WinQueryButtonCheckstate(hwnd, GREP_FINDIFANY) != 0;
     799        gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS);
     800        if (gRemember) {
     801          PrfWriteProfileData(fmprof, FM3Str, "Grep_Recurse",
     802                              (PVOID) & recurse, sizeof(BOOL));
     803          PrfWriteProfileData(fmprof, FM3Str, "Grep_Absolute",
     804                              (PVOID) & absolute, sizeof(BOOL));
     805          PrfWriteProfileData(fmprof, FM3Str, "Grep_Case",
     806                              (PVOID) & sensitive, sizeof(BOOL));
     807          PrfWriteProfileData(fmprof, FM3Str, "Grep_Sayfiles",
     808                              (PVOID) & sayfiles, sizeof(BOOL));
     809          PrfWriteProfileData(fmprof, FM3Str, "Grep_Searchfiles",
     810                              (PVOID) & searchFiles, sizeof(BOOL));
     811          PrfWriteProfileData(fmprof, FM3Str, "Grep_SearchfEAs",
     812                              (PVOID) & searchEAs, sizeof(BOOL));
     813        }
     814        g.finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES) != 0;
     815        if (g.finddupes) {
     816          g.CRCdupes = WinQueryButtonCheckstate(hwnd, GREP_CRCDUPES) != 0;
     817          g.nosizedupes =
     818            WinQueryButtonCheckstate(hwnd, GREP_NOSIZEDUPES) != 0;
     819          g.ignoreextdupes =
     820            WinQueryButtonCheckstate(hwnd, GREP_IGNOREEXTDUPES) != 0;
     821        }
     822        // Parse file masks
     823        *p = 0;
     824        WinQueryDlgItemText(hwnd, GREP_MASK, 8192, p);
     825        bstrip(p);
     826        if (!*p) {
     827          DosBeep(50, 100);
     828          WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK));
     829          free(p);
    827830#         ifdef FORTIFY
    828831          Fortify_LeaveScope();
    829832#          endif
    830           break;
    831         }
    832         strcpy(g.tosearch, p);
    833         strcpy(lastmask, p);
    834         // Parse search strings
    835         *p = 0;
    836         WinQueryWindowText(hwndMLE, 4096, p);
    837         strcpy(lasttext, p);
    838         {
    839           CHAR *pszFrom;
    840           CHAR *pszTo;
    841           ULONG matched = 0;
    842 
    843           pszTo = g.searchPattern;
    844           pszFrom = p;
    845           while (*pszFrom) {
    846             if (*pszFrom == '\r') {
    847               pszFrom++;
    848               continue;
    849             }
    850             if (*pszFrom == '\n') {
    851               if (*(pszFrom + 1))
    852                 matched++;
    853               *pszTo = 0;
    854             }
    855             else
    856               *pszTo = *pszFrom;
    857             pszTo++;
    858             pszFrom++;
    859           }
    860           if (*g.searchPattern)
    861             matched++;
    862           *pszTo++ = 0;
    863           *pszTo = 0;
    864           g.numlines = matched;
    865           if (matched) {
    866             g.matched = xmalloc(g.numlines, pszSrcFile, __LINE__);
    867             if (!g.matched)
    868               g.numlines = 0;
    869           }
    870         }
    871         *p = 0;
    872         WinQueryDlgItemText(hwnd, GREP_GREATER, 34, p);
    873         greater = atol(p);
    874         *p = 0;
    875         WinQueryDlgItemText(hwnd, GREP_LESSER, 34, p);
    876         lesser = atol(p);
    877         *p = 0;
    878         WinQueryDlgItemText(hwnd, GREP_NEWER, 34, p);
    879         newer = atoi(p);
    880         *p = 0;
    881         WinQueryDlgItemText(hwnd, GREP_OLDER, 34, p);
    882         older = atoi(p);
    883         if (older || newer) {
    884           FDATE fdate;
    885           FTIME ftime;
    886           struct tm tm;
    887           time_t t;
    888 
    889           t = time(NULL);
    890           tm = *localtime(&t);
    891           fdate.day = tm.tm_mday;
    892           fdate.month = tm.tm_mon + 1;
    893           fdate.year = tm.tm_year - 80;
    894           ftime.hours = tm.tm_hour;
    895           ftime.minutes = tm.tm_min;
    896           ftime.twosecs = tm.tm_sec / 2;
    897           if (older) {
    898             g.olderthan = SecsSince1980(&fdate, &ftime);
    899             g.olderthan -= (older * (24L * 60L * 60L));
    900           }
    901           if (newer) {
    902             g.newerthan = SecsSince1980(&fdate, &ftime);
    903             g.newerthan -= (newer * (24L * 60L * 60L));
    904           }
    905         }
    906         if (!newer)
    907           g.newerthan = 0;
    908         if (!older)
    909           g.olderthan = 0;
    910         g.greaterthan = greater;
    911         g.lessthan = lesser;
    912         g.absFlag = absolute;
    913         g.caseFlag = sensitive;
    914         g.dirFlag = recurse;
    915         g.sayfiles = sayfiles;
    916         g.searchEAs = searchEAs;
    917         g.searchFiles = searchFiles;
    918         g.findifany = findifany;
    919         g.hwndFiles = hwndCollect;
    920         g.hwnd = WinQueryWindow(hwndCollect, QW_PARENT);
    921         g.hwndCurFile = WinWindowFromID(g.hwnd, DIR_SELECTED);
    922         g.attrFile = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.attrFile;
    923         g.antiattr = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.antiattr;
    924         g.stopflag = &((DIRCNRDATA *)INSTDATA(hwndCollect))->stopflag;
    925         if (_beginthread(GrepThread, NULL, 524280, (PVOID) & g) == -1) {
    926           Runtime_Error(pszSrcFile, __LINE__,
    927                         GetPString(IDS_COULDNTSTARTTHREADTEXT));
    928           free(p);
     833          break;
     834        }
     835        strcpy(g.tosearch, p);
     836        strcpy(lastmask, p);
     837        // Parse search strings
     838        *p = 0;
     839        WinQueryWindowText(hwndMLE, 4096, p);
     840        strcpy(lasttext, p);
     841        {
     842          CHAR *pszFrom;
     843          CHAR *pszTo;
     844          ULONG matched = 0;
     845
     846          pszTo = g.searchPattern;
     847          pszFrom = p;
     848          while (*pszFrom) {
     849            if (*pszFrom == '\r') {
     850              pszFrom++;
     851              continue;
     852            }
     853            if (*pszFrom == '\n') {
     854              if (*(pszFrom + 1))
     855                matched++;
     856              *pszTo = 0;
     857            }
     858            else
     859              *pszTo = *pszFrom;
     860            pszTo++;
     861            pszFrom++;
     862          }
     863          if (*g.searchPattern)
     864            matched++;
     865          *pszTo++ = 0;
     866          *pszTo = 0;
     867          g.numlines = matched;
     868          if (matched) {
     869            g.matched = xmalloc(g.numlines, pszSrcFile, __LINE__);
     870            if (!g.matched)
     871              g.numlines = 0;
     872          }
     873        }
     874        *p = 0;
     875        WinQueryDlgItemText(hwnd, GREP_GREATER, 34, p);
     876        greater = atol(p);
     877        *p = 0;
     878        WinQueryDlgItemText(hwnd, GREP_LESSER, 34, p);
     879        lesser = atol(p);
     880        *p = 0;
     881        WinQueryDlgItemText(hwnd, GREP_NEWER, 34, p);
     882        newer = atoi(p);
     883        *p = 0;
     884        WinQueryDlgItemText(hwnd, GREP_OLDER, 34, p);
     885        older = atoi(p);
     886        if (older || newer) {
     887          FDATE fdate;
     888          FTIME ftime;
     889          struct tm tm;
     890          time_t t;
     891
     892          t = time(NULL);
     893          tm = *localtime(&t);
     894          fdate.day = tm.tm_mday;
     895          fdate.month = tm.tm_mon + 1;
     896          fdate.year = tm.tm_year - 80;
     897          ftime.hours = tm.tm_hour;
     898          ftime.minutes = tm.tm_min;
     899          ftime.twosecs = tm.tm_sec / 2;
     900          if (older) {
     901            g.olderthan = SecsSince1980(&fdate, &ftime);
     902            g.olderthan -= (older * (24L * 60L * 60L));
     903          }
     904          if (newer) {
     905            g.newerthan = SecsSince1980(&fdate, &ftime);
     906            g.newerthan -= (newer * (24L * 60L * 60L));
     907          }
     908        }
     909        if (!newer)
     910          g.newerthan = 0;
     911        if (!older)
     912          g.olderthan = 0;
     913        g.greaterthan = greater;
     914        g.lessthan = lesser;
     915        g.absFlag = absolute;
     916        g.caseFlag = sensitive;
     917        g.dirFlag = recurse;
     918        g.sayfiles = sayfiles;
     919        g.searchEAs = searchEAs;
     920        g.searchFiles = searchFiles;
     921        g.findifany = findifany;
     922        g.hwndFiles = hwndCollect;
     923        g.hwnd = WinQueryWindow(hwndCollect, QW_PARENT);
     924        g.hwndCurFile = WinWindowFromID(g.hwnd, DIR_SELECTED);
     925        g.attrFile = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.attrFile;
     926        g.antiattr = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.antiattr;
     927        g.stopflag = &((DIRCNRDATA *)INSTDATA(hwndCollect))->stopflag;
     928        if (_beginthread(GrepThread, NULL, 524280, (PVOID) & g) == -1) {
     929          Runtime_Error(pszSrcFile, __LINE__,
     930                        GetPString(IDS_COULDNTSTARTTHREADTEXT));
     931          free(p);
    929932#         ifdef FORTIFY
    930933          Fortify_LeaveScope();
    931934#          endif
    932           WinDismissDlg(hwnd, 0);
    933           break;
    934         }
    935         DosSleep(100); //05 Aug 07 GKY 128
    936         free(p);
     935          WinDismissDlg(hwnd, 0);
     936          break;
     937        }
     938        DosSleep(100); //05 Aug 07 GKY 128
     939        free(p);
    937940#       ifdef FORTIFY
    938941        Fortify_LeaveScope();
     
    940943      }
    941944      if (changed) {
    942         // Grep mask list changed
    943         SHORT x;
    944 
    945         sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    946                                             GREP_LISTBOX,
    947                                             LM_QUERYITEMCOUNT,
    948                                             MPVOID, MPVOID);
     945        // Grep mask list changed
     946        SHORT x;
     947
     948        sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
     949                                            GREP_LISTBOX,
     950                                            LM_QUERYITEMCOUNT,
     951                                            MPVOID, MPVOID);
    949952        if (sSelect > 0) {
    950953          BldFullPathName(s, pFM2SaveDirectory, "GREPMASK.DAT");
    951954          if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2)
    952955            break; //already gave error msg
    953           fp = xfopen(s, "w", pszSrcFile, __LINE__);
    954           if (fp) {
    955             fputs(GetPString(IDS_GREPFILETEXT), fp);
    956             for (x = 0; x < sSelect; x++) {
    957               *s = 0;
    958               WinSendDlgItemMsg(hwnd,
    959                                 GREP_LISTBOX,
    960                                 LM_QUERYITEMTEXT,
    961                                 MPFROM2SHORT(x, 8192), MPFROMP(s));
    962               bstrip(s);
    963               if (*s)
    964                 fprintf(fp, "%s\n", s);
    965             }
    966             fclose(fp);
    967           }
    968         }
     956          fp = xfopen(s, "w", pszSrcFile, __LINE__);
     957          if (fp) {
     958            fputs(GetPString(IDS_GREPFILETEXT), fp);
     959            for (x = 0; x < sSelect; x++) {
     960              *s = 0;
     961              WinSendDlgItemMsg(hwnd,
     962                                GREP_LISTBOX,
     963                                LM_QUERYITEMTEXT,
     964                                MPFROM2SHORT(x, 8192), MPFROMP(s));
     965              bstrip(s);
     966              if (*s)
     967                fprintf(fp, "%s\n", s);
     968            }
     969            fclose(fp);
     970          }
     971        }
    969972      }
    970973      WinDismissDlg(hwnd, 1);
  • trunk/dll/inis.c

    r1104 r1161  
    3434#include <ctype.h>
    3535#include <share.h>
    36 #include <process.h>                    // _beginthread
     36#include <process.h>                    // _beginthread
    3737
    3838#define INCL_DOS
     
    4040#define INCL_WIN
    4141#define INCL_GPI
    42 #define INCL_LONGLONG                   // dircnrs.h
     42#define INCL_LONGLONG                   // dircnrs.h
    4343
    4444#include "fm3dlg.h"
    4545#include "fm3str.h"
    4646#include "mle.h"
    47 #include "errutil.h"                    // Dos_Error...
    48 #include "strutil.h"                    // GetPString
     47#include "errutil.h"                    // Dos_Error...
     48#include "strutil.h"                    // GetPString
    4949#include "pathutil.h"                   // BldFullPathName
     50#include "mainwnd.h"                    // FillClient
     51#include "droplist.h"                   // FullDrgName
     52#include "inis.h"
     53#include "literal.h"                    // fixup
    5054#include "fm3dll.h"
     55#include "eas.h"                        // HexDump
    5156#include "fortify.h"
     57#include "misc.h"                       // BoxWindow
    5258
    5359#pragma data_seg(DATA2)
     
    5864{
    5965  USHORT size;
    60   CHAR ininame[CCHMAXPATH];     // Must be null string if user or system ini
     66  CHAR ininame[CCHMAXPATH];     // Must be null string if user or system ini
    6167  HINI hini;
    6268  BOOL working;
     
    107113{
    108114  BOOL ok = fSkipIfSystem &&
    109             (hini == HINI_USERPROFILE || hini == HINI_SYSTEMPROFILE);
     115            (hini == HINI_USERPROFILE || hini == HINI_SYSTEMPROFILE);
    110116
    111117  if (!ok) {
     
    113119    if (!ok) {
    114120      Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    115                 "PrfCloseProfile failed for handle 0x%x", hini);
     121                "PrfCloseProfile failed for handle 0x%x", hini);
    116122    }
    117123  }
     
    136142      hmq2 = WinCreateMsgQueue(hab2, 0);
    137143      if (hmq2) {
    138         WinCancelShutdown(hmq2, TRUE);
    139         IncrThreadUsage();
    140         *userini = *sysini = 0;
    141         memset(&cprfp, 0, sizeof(PRFPROFILE));
    142         cprfp.cchUserName = CCHMAXPATH;
    143         cprfp.cchSysName = CCHMAXPATH;
    144         cprfp.pszUserName = (PSZ) userini;
    145         cprfp.pszSysName = (PSZ) sysini;
    146         if (PrfQueryProfile(hab2, &cprfp)) {
    147           if (!stricmp(cprfp.pszUserName, inirec->filename1))
    148             hiniFrom = HINI_USERPROFILE;
    149           else if (!stricmp(cprfp.pszSysName, inirec->filename1))
    150             hiniFrom = HINI_SYSTEMPROFILE;
    151           if (!stricmp(cprfp.pszUserName, inirec->filename2))
    152             hiniTo = HINI_USERPROFILE;
    153           else if (!stricmp(cprfp.pszSysName, inirec->filename2))
    154             hiniTo = HINI_SYSTEMPROFILE;
    155         }
    156         if (hiniFrom == NULLHANDLE) {
    157           hiniFrom = PrfOpenProfile(hab2, inirec->filename1);
    158           if (hiniFrom == NULLHANDLE) {
    159             Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    160                       "PrfOpenProfile failed for %s", inirec->filename1);
    161           }
    162         }
    163         if (hiniTo == NULLHANDLE) {
    164           if (!stricmp(inirec->filename1, inirec->filename2))
    165             hiniTo = hiniFrom;
    166           else {
    167             hiniTo = PrfOpenProfile(hab2, inirec->filename2);
    168             if (hiniTo == NULLHANDLE) {
    169               Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    170                         "PrfOpenProfile failed for %s", inirec->filename2);
    171             }
    172           }
    173         }
    174         if (hiniFrom && hiniTo && (*inirec->app2 || hiniFrom != hiniTo)) {
    175 
    176           PVOID pDataK, pData;
    177           PBYTE pCurrentK;
    178           ULONG ulSize = 0L;
    179 
    180           if (inirec->action == IDM_MOVE || inirec->action == IDM_COPY) {
    181             if (!*inirec->key) {
    182               if (inirec->confirm &&
    183                   PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ?
    184                                                     inirec->app2 : inirec->
    185                                                     app), NULL,
    186                                       (PULONG) & ulSize) && ulSize) {
    187                 if (saymsg
    188                     (MB_YESNOCANCEL, HWND_DESKTOP,
    189                      GetPString(IDS_CONFIRMTEXT),
    190                      GetPString(IDS_INIOVERAPPNAMETEXT),
    191                      ((*inirec->app2) ? inirec->app2 : inirec->app),
    192                      inirec->filename1) != MBID_YES)
    193                   goto Abort;
    194               }
    195               if (PrfQueryProfileSize(hiniTo,
    196                                       (PSZ) inirec->app,
    197                                       NULL, (PULONG) & ulSize) && ulSize) {
    198                 pDataK = xmalloc(ulSize, pszSrcFile, __LINE__); /* allocate space for keynames */
    199                 if (pDataK) {
    200                   /* get keynames */
    201                   if (PrfQueryProfileString(hiniTo,
    202                                             (PSZ) inirec->app,
    203                                             NULL, "\0", pDataK, ulSize)) {
    204                     pCurrentK = pDataK;
    205                     /* step through keynames */
    206                     while (*pCurrentK) {
    207                       if (PrfQueryProfileSize(hiniTo, inirec->app,
    208                                               pCurrentK,
    209                                               (PULONG) & ulSize) && ulSize) {
    210                         pData = xmalloc(ulSize, pszSrcFile, __LINE__);
    211                         if (pData) {
    212                           /* get data */
    213                           if (PrfQueryProfileData(hiniTo, inirec->app,
    214                                                   pCurrentK,
    215                                                   pData, (PULONG) & ulSize))
    216                             /* write data to new ini file */
    217                             PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?
    218                                                         inirec->
    219                                                         app2 : inirec->app),
    220                                                 pCurrentK, pData, ulSize);
    221                           free(pData);  /* free data */
    222                         }
    223                       }
    224                       while (*pCurrentK)        /* next keyname */
    225                         pCurrentK++;
    226                       pCurrentK++;
    227                     }
    228                   }
    229                   free(pDataK);         /* free keynames */
    230                 }
    231               }
    232             }
    233             else {
    234               if (inirec->confirm &&
    235                   PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ?
    236                                                     inirec->app2 : inirec->
    237                                                     app),
    238                                       ((*inirec->key2) ? inirec->
    239                                        key2 : inirec->key), (PULONG) & ulSize)
    240                   && ulSize) {
    241                 if (saymsg
    242                     (MB_YESNOCANCEL, HWND_DESKTOP,
    243                      GetPString(IDS_CONFIRMTEXT),
    244                      GetPString(IDS_INIOVERAPPKEYNAMETEXT),
    245                      ((*inirec->app2) ? inirec->app2 : inirec->app),
    246                      ((*inirec->key2) ? inirec->key2 : inirec->key),
    247                      inirec->filename1) != MBID_YES)
    248                   goto Abort;
    249               }
    250               if (PrfQueryProfileSize(hiniTo, inirec->app,
    251                                       inirec->key,
    252                                       (PULONG) & ulSize) && ulSize) {
    253                 pData = xmalloc(ulSize, pszSrcFile, __LINE__);
    254                 if (pData) {
    255                   /* get data */
    256                   if (PrfQueryProfileData(hiniTo, inirec->app,
    257                                           inirec->key,
    258                                           pData, (PULONG) & ulSize))
    259                     /* write data to new ini file */
    260                     PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?
    261                                                 inirec->app2 : inirec->app),
    262                                         ((*inirec->key2) ?
    263                                         inirec->key2 : inirec->key),
    264                                         pData, ulSize);
    265                   free(pData);          /* free data */
    266                 }
    267               }
    268             }
    269             if (inirec->action == IDM_MOVE) {
    270               if (inirec->confirm &&
    271                   saymsg(MB_YESNOCANCEL,
    272                         HWND_DESKTOP,
    273                         GetPString(IDS_CONFIRMTEXT),
    274                         GetPString(IDS_INIDELETEMOVEDTEXT),
    275                         inirec->filename2) != MBID_YES)
    276                 goto Abort;
    277               PrfWriteProfileData(hiniTo,
    278                                   inirec->app,
    279                                   ((*inirec->key) ? inirec->key : NULL),
    280                                   NULL, 0L);
    281             }
    282           }
    283         }
     144        WinCancelShutdown(hmq2, TRUE);
     145        IncrThreadUsage();
     146        *userini = *sysini = 0;
     147        memset(&cprfp, 0, sizeof(PRFPROFILE));
     148        cprfp.cchUserName = CCHMAXPATH;
     149        cprfp.cchSysName = CCHMAXPATH;
     150        cprfp.pszUserName = (PSZ) userini;
     151        cprfp.pszSysName = (PSZ) sysini;
     152        if (PrfQueryProfile(hab2, &cprfp)) {
     153          if (!stricmp(cprfp.pszUserName, inirec->filename1))
     154            hiniFrom = HINI_USERPROFILE;
     155          else if (!stricmp(cprfp.pszSysName, inirec->filename1))
     156            hiniFrom = HINI_SYSTEMPROFILE;
     157          if (!stricmp(cprfp.pszUserName, inirec->filename2))
     158            hiniTo = HINI_USERPROFILE;
     159          else if (!stricmp(cprfp.pszSysName, inirec->filename2))
     160            hiniTo = HINI_SYSTEMPROFILE;
     161        }
     162        if (hiniFrom == NULLHANDLE) {
     163          hiniFrom = PrfOpenProfile(hab2, inirec->filename1);
     164          if (hiniFrom == NULLHANDLE) {
     165            Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     166                      "PrfOpenProfile failed for %s", inirec->filename1);
     167          }
     168        }
     169        if (hiniTo == NULLHANDLE) {
     170          if (!stricmp(inirec->filename1, inirec->filename2))
     171            hiniTo = hiniFrom;
     172          else {
     173            hiniTo = PrfOpenProfile(hab2, inirec->filename2);
     174            if (hiniTo == NULLHANDLE) {
     175              Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     176                        "PrfOpenProfile failed for %s", inirec->filename2);
     177            }
     178          }
     179        }
     180        if (hiniFrom && hiniTo && (*inirec->app2 || hiniFrom != hiniTo)) {
     181
     182          PVOID pDataK, pData;
     183          PBYTE pCurrentK;
     184          ULONG ulSize = 0L;
     185
     186          if (inirec->action == IDM_MOVE || inirec->action == IDM_COPY) {
     187            if (!*inirec->key) {
     188              if (inirec->confirm &&
     189                  PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ?
     190                                                    inirec->app2 : inirec->
     191                                                    app), NULL,
     192                                      (PULONG) & ulSize) && ulSize) {
     193                if (saymsg
     194                    (MB_YESNOCANCEL, HWND_DESKTOP,
     195                     GetPString(IDS_CONFIRMTEXT),
     196                     GetPString(IDS_INIOVERAPPNAMETEXT),
     197                     ((*inirec->app2) ? inirec->app2 : inirec->app),
     198                     inirec->filename1) != MBID_YES)
     199                  goto Abort;
     200              }
     201              if (PrfQueryProfileSize(hiniTo,
     202                                      (PSZ) inirec->app,
     203                                      NULL, (PULONG) & ulSize) && ulSize) {
     204                pDataK = xmalloc(ulSize, pszSrcFile, __LINE__); /* allocate space for keynames */
     205                if (pDataK) {
     206                  /* get keynames */
     207                  if (PrfQueryProfileString(hiniTo,
     208                                            (PSZ) inirec->app,
     209                                            NULL, "\0", pDataK, ulSize)) {
     210                    pCurrentK = pDataK;
     211                    /* step through keynames */
     212                    while (*pCurrentK) {
     213                      if (PrfQueryProfileSize(hiniTo, inirec->app,
     214                                              pCurrentK,
     215                                              (PULONG) & ulSize) && ulSize) {
     216                        pData = xmalloc(ulSize, pszSrcFile, __LINE__);
     217                        if (pData) {
     218                          /* get data */
     219                          if (PrfQueryProfileData(hiniTo, inirec->app,
     220                                                  pCurrentK,
     221                                                  pData, (PULONG) & ulSize))
     222                            /* write data to new ini file */
     223                            PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?
     224                                                        inirec->
     225                                                        app2 : inirec->app),
     226                                                pCurrentK, pData, ulSize);
     227                          free(pData);  /* free data */
     228                        }
     229                      }
     230                      while (*pCurrentK)        /* next keyname */
     231                        pCurrentK++;
     232                      pCurrentK++;
     233                    }
     234                  }
     235                  free(pDataK);         /* free keynames */
     236                }
     237              }
     238            }
     239            else {
     240              if (inirec->confirm &&
     241                  PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ?
     242                                                    inirec->app2 : inirec->
     243                                                    app),
     244                                      ((*inirec->key2) ? inirec->
     245                                       key2 : inirec->key), (PULONG) & ulSize)
     246                  && ulSize) {
     247                if (saymsg
     248                    (MB_YESNOCANCEL, HWND_DESKTOP,
     249                     GetPString(IDS_CONFIRMTEXT),
     250                     GetPString(IDS_INIOVERAPPKEYNAMETEXT),
     251                     ((*inirec->app2) ? inirec->app2 : inirec->app),
     252                     ((*inirec->key2) ? inirec->key2 : inirec->key),
     253                     inirec->filename1) != MBID_YES)
     254                  goto Abort;
     255              }
     256              if (PrfQueryProfileSize(hiniTo, inirec->app,
     257                                      inirec->key,
     258                                      (PULONG) & ulSize) && ulSize) {
     259                pData = xmalloc(ulSize, pszSrcFile, __LINE__);
     260                if (pData) {
     261                  /* get data */
     262                  if (PrfQueryProfileData(hiniTo, inirec->app,
     263                                          inirec->key,
     264                                          pData, (PULONG) & ulSize))
     265                    /* write data to new ini file */
     266                    PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?
     267                                                inirec->app2 : inirec->app),
     268                                        ((*inirec->key2) ?
     269                                        inirec->key2 : inirec->key),
     270                                        pData, ulSize);
     271                  free(pData);          /* free data */
     272                }
     273              }
     274            }
     275            if (inirec->action == IDM_MOVE) {
     276              if (inirec->confirm &&
     277                  saymsg(MB_YESNOCANCEL,
     278                        HWND_DESKTOP,
     279                        GetPString(IDS_CONFIRMTEXT),
     280                        GetPString(IDS_INIDELETEMOVEDTEXT),
     281                        inirec->filename2) != MBID_YES)
     282                goto Abort;
     283              PrfWriteProfileData(hiniTo,
     284                                  inirec->app,
     285                                  ((*inirec->key) ? inirec->key : NULL),
     286                                  NULL, 0L);
     287            }
     288          }
     289        }
    284290      Abort:
    285         if (hiniFrom)
    286           CloseProfile(hiniFrom, TRUE);
    287         if (hiniTo && hiniTo != hiniFrom)
    288           CloseProfile(hiniTo, FALSE);
    289         WinDestroyMsgQueue(hmq2);
     291        if (hiniFrom)
     292          CloseProfile(hiniFrom, TRUE);
     293        if (hiniTo && hiniTo != hiniFrom)
     294          CloseProfile(hiniTo, FALSE);
     295        WinDestroyMsgQueue(hmq2);
    290296      }
    291297      DecrThreadUsage();
     
    293299    }
    294300    PostMsg(inirec->hwndDlg, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0),
    295             MPVOID);
     301            MPVOID);
    296302    if (inirec->action == IDM_MOVE && inirec->hwndSource &&
    297         inirec->hwndSource != inirec->hwndDlg)
     303        inirec->hwndSource != inirec->hwndDlg)
    298304      PostMsg(inirec->hwndSource, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0),
    299               MPVOID);
     305              MPVOID);
    300306    free(inirec);
    301307#   ifdef FORTIFY
     
    316322      hmq2 = WinCreateMsgQueue(hab2, 0);
    317323      if (hmq2) {
    318         WinCancelShutdown(hmq2, TRUE);
    319         IncrThreadUsage();
    320 
    321         // fixme to do something?
    322 
    323         WinDestroyMsgQueue(hmq2);
     324        WinCancelShutdown(hmq2, TRUE);
     325        IncrThreadUsage();
     326
     327        // fixme to do something?
     328
     329        WinDestroyMsgQueue(hmq2);
    324330      }
    325331      DecrThreadUsage();
     
    351357      hmq2 = WinCreateMsgQueue(hab2, 0);
    352358      if (hmq2) {
    353         WinCancelShutdown(hmq2, TRUE);
    354         IncrThreadUsage();
    355         *userini = *sysini = 0;
    356         memset(&cprfp, 0, sizeof(PRFPROFILE));
    357         cprfp.cchUserName = CCHMAXPATH;
    358         cprfp.cchSysName = CCHMAXPATH;
    359         cprfp.pszUserName = (PSZ) userini;
    360         cprfp.pszSysName = (PSZ) sysini;
    361         if (PrfQueryProfile(hab2, &cprfp)) {
    362           if (!stricmp(cprfp.pszUserName, prfp->pszUserName))
    363             orig = HINI_USERPROFILE;
    364           else if (!stricmp(cprfp.pszSysName, prfp->pszUserName))
    365             orig = HINI_SYSTEMPROFILE;
    366         }
    367         if (orig == NULLHANDLE)
    368           orig = PrfOpenProfile(hab2, prfp->pszUserName);
    369         if (orig == NULLHANDLE) {
    370           Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    371                     "PrfOpenProfile failed for %s", prfp->pszUserName);
    372         }
    373         else {
    374           new = PrfOpenProfile(hab2, prfp->pszSysName);
    375           if (new == NULLHANDLE) {
    376             Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    377                       "PrfOpenProfile failed for %s", prfp->pszSysName);
    378           }
    379           else {
    380             ulSize = 0;
    381             if (PrfQueryProfileSize(orig, NULL, NULL, (PULONG) & ulSize)
    382                 && ulSize) {
    383               pDataA = xmalloc(ulSize, pszSrcFile, __LINE__);   /* allocate space for applnames */
    384               if (pDataA) {
    385                 /* get applnames */
    386                 if (PrfQueryProfileString
    387                     (orig, NULL, NULL, "\0", pDataA, ulSize)) {
    388                   pCurrentA = pDataA;
    389                   /* step through applnames */
    390                   while (*pCurrentA) {
    391                     /* now keynames for this applname */
    392                     if (PrfQueryProfileSize(orig, (PSZ) pCurrentA, NULL,
    393                                             (PULONG) & ulSize) && ulSize) {
    394                       pDataK = xmalloc(ulSize, pszSrcFile, __LINE__);   /* allocate space for keynames */
    395                       if (pDataK) {
    396                         /* get keynames */
    397                         if (PrfQueryProfileString(orig, (PSZ) pCurrentA, NULL,
    398                                                   "\0", pDataK, ulSize)) {
    399                           pCurrentK = pDataK;
    400                           /* step through keynames */
    401                           while (*pCurrentK) {
    402                             if (PrfQueryProfileSize(orig, pCurrentA,
    403                                                     pCurrentK,
    404                                                     (PULONG) & ulSize) &&
    405                                 ulSize) {
    406                               pData = xmalloc(ulSize, pszSrcFile, __LINE__);
    407                               if (pData) {
    408                                 /* get data */
    409                                 if (PrfQueryProfileData(orig, pCurrentA,
    410                                                         pCurrentK,
    411                                                         pData,
    412                                                         (PULONG) & ulSize))
    413                                   /* write data to new ini file */
    414                                   PrfWriteProfileData(new, pCurrentA,
    415                                                       pCurrentK, pData,
    416                                                       ulSize);
    417                                 free(pData);    /* free data */
    418                               }
    419                             }
    420                             while (*pCurrentK)  /* next keyname */
    421                               pCurrentK++;
    422                             pCurrentK++;
    423                           }
    424                         }
    425                         free(pDataK);   /* free keynames */
    426                       }
    427                     }
    428                     while (*pCurrentA)  /* next applname */
    429                       pCurrentA++;
    430                     pCurrentA++;
    431                   }
    432                 }
    433                 free(pDataA);           /* free applnames */
    434               }
    435             }
    436             CloseProfile(new, FALSE);
    437           }
    438           CloseProfile(orig, TRUE);
    439         }
    440         WinDestroyMsgQueue(hmq2);
     359        WinCancelShutdown(hmq2, TRUE);
     360        IncrThreadUsage();
     361        *userini = *sysini = 0;
     362        memset(&cprfp, 0, sizeof(PRFPROFILE));
     363        cprfp.cchUserName = CCHMAXPATH;
     364        cprfp.cchSysName = CCHMAXPATH;
     365        cprfp.pszUserName = (PSZ) userini;
     366        cprfp.pszSysName = (PSZ) sysini;
     367        if (PrfQueryProfile(hab2, &cprfp)) {
     368          if (!stricmp(cprfp.pszUserName, prfp->pszUserName))
     369            orig = HINI_USERPROFILE;
     370          else if (!stricmp(cprfp.pszSysName, prfp->pszUserName))
     371            orig = HINI_SYSTEMPROFILE;
     372        }
     373        if (orig == NULLHANDLE)
     374          orig = PrfOpenProfile(hab2, prfp->pszUserName);
     375        if (orig == NULLHANDLE) {
     376          Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     377                    "PrfOpenProfile failed for %s", prfp->pszUserName);
     378        }
     379        else {
     380          new = PrfOpenProfile(hab2, prfp->pszSysName);
     381          if (new == NULLHANDLE) {
     382            Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     383                      "PrfOpenProfile failed for %s", prfp->pszSysName);
     384          }
     385          else {
     386            ulSize = 0;
     387            if (PrfQueryProfileSize(orig, NULL, NULL, (PULONG) & ulSize)
     388                && ulSize) {
     389              pDataA = xmalloc(ulSize, pszSrcFile, __LINE__);   /* allocate space for applnames */
     390              if (pDataA) {
     391                /* get applnames */
     392                if (PrfQueryProfileString
     393                    (orig, NULL, NULL, "\0", pDataA, ulSize)) {
     394                  pCurrentA = pDataA;
     395                  /* step through applnames */
     396                  while (*pCurrentA) {
     397                    /* now keynames for this applname */
     398                    if (PrfQueryProfileSize(orig, (PSZ) pCurrentA, NULL,
     399                                            (PULONG) & ulSize) && ulSize) {
     400                      pDataK = xmalloc(ulSize, pszSrcFile, __LINE__);   /* allocate space for keynames */
     401                      if (pDataK) {
     402                        /* get keynames */
     403                        if (PrfQueryProfileString(orig, (PSZ) pCurrentA, NULL,
     404                                                  "\0", pDataK, ulSize)) {
     405                          pCurrentK = pDataK;
     406                          /* step through keynames */
     407                          while (*pCurrentK) {
     408                            if (PrfQueryProfileSize(orig, pCurrentA,
     409                                                    pCurrentK,
     410                                                    (PULONG) & ulSize) &&
     411                                ulSize) {
     412                              pData = xmalloc(ulSize, pszSrcFile, __LINE__);
     413                              if (pData) {
     414                                /* get data */
     415                                if (PrfQueryProfileData(orig, pCurrentA,
     416                                                        pCurrentK,
     417                                                        pData,
     418                                                        (PULONG) & ulSize))
     419                                  /* write data to new ini file */
     420                                  PrfWriteProfileData(new, pCurrentA,
     421                                                      pCurrentK, pData,
     422                                                      ulSize);
     423                                free(pData);    /* free data */
     424                              }
     425                            }
     426                            while (*pCurrentK)  /* next keyname */
     427                              pCurrentK++;
     428                            pCurrentK++;
     429                          }
     430                        }
     431                        free(pDataK);   /* free keynames */
     432                      }
     433                    }
     434                    while (*pCurrentA)  /* next applname */
     435                      pCurrentA++;
     436                    pCurrentA++;
     437                  }
     438                }
     439                free(pDataA);           /* free applnames */
     440              }
     441            }
     442            CloseProfile(new, FALSE);
     443          }
     444          CloseProfile(orig, TRUE);
     445        }
     446        WinDestroyMsgQueue(hmq2);
    441447      }
    442448      DecrThreadUsage();
     
    461467  if (!PrfQueryProfileSize(hini, NULL, NULL, (PULONG) & ulSize))
    462468    Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    463               "PrfQueryProfileSize");
     469              "PrfQueryProfileSize");
    464470  else if (!ulSize)
    465471    Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     
    468474    if (pData) {
    469475      if (PrfQueryProfileString(hini, NULL, NULL, "\0", pData, ulSize)) {
    470         pCurrent = pData;
    471         WinEnableWindowUpdate(hwndList, FALSE);
    472         while (*pCurrent) {
    473           WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING),
    474                      MPFROMP(pCurrent));
    475           while (*pCurrent)
    476             pCurrent++;
    477           pCurrent++;
    478         }
    479         WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0),
    480                    MPFROMSHORT(TRUE));
    481         WinEnableWindowUpdate(hwndList, TRUE);
     476        pCurrent = pData;
     477        WinEnableWindowUpdate(hwndList, FALSE);
     478        while (*pCurrent) {
     479          WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING),
     480                     MPFROMP(pCurrent));
     481          while (*pCurrent)
     482            pCurrent++;
     483          pCurrent++;
     484        }
     485        WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0),
     486                   MPFROMSHORT(TRUE));
     487        WinEnableWindowUpdate(hwndList, TRUE);
    482488      }
    483489      free(pData);
     
    487493
    488494static CHAR *GetKeyData(HWND hwndList, HINI hini, PSZ pAppName,
    489                         PSZ pKeyName, PULONG datalen)
     495                        PSZ pKeyName, PULONG datalen)
    490496{
    491497  ULONG ulKeySize = 0L;
     
    495501  if (!PrfQueryProfileSize(hini, pAppName, pKeyName, (PULONG) & ulKeySize))
    496502    Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    497               "PrfQueryProfileSize");
     503              "PrfQueryProfileSize");
    498504  else {
    499505    pKeyData = xmalloc(ulKeySize + 1L, pszSrcFile, __LINE__);
    500506    if (pKeyData) {
    501507      if (!PrfQueryProfileData
    502           (hini, pAppName, pKeyName, pKeyData, (PULONG) & ulKeySize))
    503         Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    504                   "PrfQueryProfileData");
     508          (hini, pAppName, pKeyName, pKeyData, (PULONG) & ulKeySize))
     509        Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     510                  "PrfQueryProfileData");
    505511      else {
    506         HexDump(hwndList, pKeyData, ulKeySize);
    507         {
    508           CHAR s[81];
    509 
    510           sprintf(s,
    511                   GetPString(IDS_INIBYTESTEXT),
    512                   ulKeySize, &"s"[ulKeySize == 1]);
    513           WinSetDlgItemText(WinQueryWindow(hwndList, QW_PARENT),
    514                             INI_NUMDATA, s);
    515         }
    516         *datalen = ulKeySize;
    517         return (CHAR *)pKeyData;
     512        HexDump(hwndList, pKeyData, ulKeySize);
     513        {
     514          CHAR s[81];
     515
     516          sprintf(s,
     517                  GetPString(IDS_INIBYTESTEXT),
     518                  ulKeySize, &"s"[ulKeySize == 1]);
     519          WinSetDlgItemText(WinQueryWindow(hwndList, QW_PARENT),
     520                            INI_NUMDATA, s);
     521        }
     522        *datalen = ulKeySize;
     523        return (CHAR *)pKeyData;
    518524      }
    519525    }
     
    531537  if (!PrfQueryProfileSize(hini, pAppName, NULL, (PULONG) & ulSize))
    532538    Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    533               "PrfQueryProfileSize");
     539              "PrfQueryProfileSize");
    534540  else {
    535541    if (!ulSize)
     
    538544    if (pData) {
    539545      if (!PrfQueryProfileString(hini, pAppName, NULL, "\0", pData, ulSize)) {
    540         Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    541                   "PrfQueryProfileString");
    542         free(pData);
     546        Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     547                  "PrfQueryProfileString");
     548        free(pData);
    543549      }
    544550      else {
    545         pCurrent = pData;
    546         WinEnableWindowUpdate(hwndList, FALSE);
    547         while (*pCurrent) {
    548           WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING),
    549                      MPFROMP(pCurrent));
    550           while (*pCurrent)
    551             pCurrent++;
    552           pCurrent++;
    553         }
    554         WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0),
    555                    MPFROMSHORT(TRUE));
     551        pCurrent = pData;
     552        WinEnableWindowUpdate(hwndList, FALSE);
     553        while (*pCurrent) {
     554          WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING),
     555                     MPFROMP(pCurrent));
     556          while (*pCurrent)
     557            pCurrent++;
     558          pCurrent++;
     559        }
     560        WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0),
     561                   MPFROMSHORT(TRUE));
    556562        WinEnableWindowUpdate(hwndList, TRUE);
    557563        free(pData);
    558         return TRUE;
     564        return TRUE;
    559565      }
    560566    }
     
    575581    inidata = (INIDATA *) mp2;
    576582    WinSendDlgItemMsg(hwnd, IAF_SAVENAME, EM_SETTEXTLIMIT,
    577                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     583                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    578584    MLEsetformat(hwndMLE, MLFIE_NOTRANS);
    579585    MLEsetlimit(hwndMLE, 8192);
     
    588594      DosError(FERR_DISABLEHARDERR);
    589595      if (!DosFindFirst("*.IST",
    590                         &hdir,
    591                         FILE_NORMAL | FILE_ARCHIVED,
    592                         &ffb, sizeof(ffb), &nm, FIL_STANDARD)) {
    593         do {
    594           priority_bumped();
    595           WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_INSERTITEM,
    596                             MPFROMSHORT(LIT_SORTASCENDING),
    597                             MPFROMP(ffb.achName));
    598           nm = 1;
    599         } while (!DosFindNext(hdir, &ffb, sizeof(ffb), &nm));
    600         DosFindClose(hdir);
    601         priority_bumped();
     596                        &hdir,
     597                        FILE_NORMAL | FILE_ARCHIVED,
     598                        &ffb, sizeof(ffb), &nm, FIL_STANDARD)) {
     599        do {
     600          priority_bumped();
     601          WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_INSERTITEM,
     602                            MPFROMSHORT(LIT_SORTASCENDING),
     603                            MPFROMP(ffb.achName));
     604          nm = 1;
     605        } while (!DosFindNext(hdir, &ffb, sizeof(ffb), &nm));
     606        DosFindClose(hdir);
     607        priority_bumped();
    602608      }
    603609    }
     
    610616  case UM_SETDIR:
    611617    PaintRecessedWindow(WinWindowFromID(hwnd, IAF_HELP), (HPS) 0, FALSE,
    612                         TRUE);
     618                        TRUE);
    613619    PaintRecessedWindow(WinWindowFromID(hwnd, IAF_SAVENAME), (HPS) 0, FALSE,
    614                         FALSE);
     620                        FALSE);
    615621    PaintRecessedWindow(WinWindowFromID(hwnd, IAF_LISTBOX), (HPS) 0, FALSE,
    616                         FALSE);
     622                        FALSE);
    617623    PaintRecessedWindow(WinWindowFromID(hwnd, IAF_MLE), (HPS) 0, FALSE,
    618                         FALSE);
     624                        FALSE);
    619625    return 0;
    620626
     
    623629    case IAF_SAVENAME:
    624630      if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    625         WinSetDlgItemText(hwnd, IAF_HELP, NullStr);
     631        WinSetDlgItemText(hwnd, IAF_HELP, NullStr);
    626632      if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    627         WinSetDlgItemText(hwnd,
    628                           IAF_HELP, GetPString(IDS_MASKLISTNAMEHELPTEXT));
     633        WinSetDlgItemText(hwnd,
     634                          IAF_HELP, GetPString(IDS_MASKLISTNAMEHELPTEXT));
    629635      break;
    630636
    631637    case IAF_LISTBOX:
    632638      if (SHORT2FROMMP(mp1) == LN_KILLFOCUS)
    633         WinSetDlgItemText(hwnd, IAF_HELP, NullStr);
     639        WinSetDlgItemText(hwnd, IAF_HELP, NullStr);
    634640      if (SHORT2FROMMP(mp1) == LN_SETFOCUS)
    635         WinSetDlgItemText(hwnd,
    636                           IAF_HELP, GetPString(IDS_MASKLISTFILESHELPTEXT));
     641        WinSetDlgItemText(hwnd,
     642                          IAF_HELP, GetPString(IDS_MASKLISTFILESHELPTEXT));
    637643      else if (SHORT2FROMMP(mp1) == LN_ENTER)
    638         PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IAF_LOAD, 0), MPVOID);
     644        PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IAF_LOAD, 0), MPVOID);
    639645      break;
    640646
    641647    case IAF_MLE:
    642648      if (SHORT2FROMMP(mp1) == MLN_KILLFOCUS)
    643         WinSetDlgItemText(hwnd, IAF_HELP, NullStr);
     649        WinSetDlgItemText(hwnd, IAF_HELP, NullStr);
    644650      if (SHORT2FROMMP(mp1) == MLN_SETFOCUS)
    645         WinSetDlgItemText(hwnd,
    646                           IAF_HELP, GetPString(IDS_MASKLISTMASKSHELPTEXT));
     651        WinSetDlgItemText(hwnd,
     652                          IAF_HELP, GetPString(IDS_MASKLISTMASKSHELPTEXT));
    647653      break;
    648654    }
     
    654660      inidata = INSTDATA(hwnd);
    655661      if (!inidata)
    656         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     662        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    657663      else {
    658         CHAR s[8193], app[1024];
    659         register CHAR *p;
    660         SHORT sSelect, numitems;
    661         BOOL match;
    662 
    663         *s = 0;
    664         WinQueryWindowText(hwndMLE, 8192, s);
    665         if (!*s) {
    666           DosBeep(250, 100);
    667           break;
    668         }
    669         else {
    670           strcpy(lasttext, s);
    671           p = s;
    672           while (*p) {
    673             if (*p == '\r') {
    674               memmove(p, p + 1, strlen(p));
    675               continue;
    676             }
    677             if (*p == '\n')
    678               *p = 0;
    679             p++;
    680           }
    681           p++;
    682           *p = 0;
    683         }
    684         numitems = (SHORT) WinSendMsg(inidata->hwndApp,
    685                                       LM_QUERYITEMCOUNT, MPVOID, MPVOID);
    686         if (!numitems) {
    687           DosBeep(250, 100);
    688           break;
    689         }
    690         else {
    691           WinSetPointer(HWND_DESKTOP, hptrBusy);
    692           WinSetDlgItemText(hwnd, IAF_HELP, GetPString(IDS_FILTERINGTEXT));
    693           sSelect = 0;
    694           while (numitems) {
    695             *app = 0;
    696             WinSendMsg(inidata->hwndApp,
    697                        LM_QUERYITEMTEXT,
    698                        MPFROM2SHORT(sSelect, 1024), MPFROMP(app));
    699             match = FALSE;
    700             if (*app) {
    701               p = s;
    702               while (*p) {
    703                 if (*p != '/') {
    704                   if (wildcard(app, p, TRUE))
    705                     match = TRUE;
    706                 }
    707                 else if (wildcard(app, p + 1, TRUE)) {
    708                   match = FALSE;
    709                   break;
    710                 }
    711                 while (*p)
    712                   p++;
    713                 p++;
    714               }
    715             }
    716             if (!match)
    717               WinSendMsg(inidata->hwndApp, LM_DELETEITEM,
    718                         MPFROMSHORT(sSelect), MPVOID);
    719             else
    720               sSelect++;
    721             numitems--;
    722           }
    723           WinSetPointer(HWND_DESKTOP, hptrArrow);
    724         }
     664        CHAR s[8193], app[1024];
     665        register CHAR *p;
     666        SHORT sSelect, numitems;
     667        BOOL match;
     668
     669        *s = 0;
     670        WinQueryWindowText(hwndMLE, 8192, s);
     671        if (!*s) {
     672          DosBeep(250, 100);
     673          break;
     674        }
     675        else {
     676          strcpy(lasttext, s);
     677          p = s;
     678          while (*p) {
     679            if (*p == '\r') {
     680              memmove(p, p + 1, strlen(p));
     681              continue;
     682            }
     683            if (*p == '\n')
     684              *p = 0;
     685            p++;
     686          }
     687          p++;
     688          *p = 0;
     689        }
     690        numitems = (SHORT) WinSendMsg(inidata->hwndApp,
     691                                      LM_QUERYITEMCOUNT, MPVOID, MPVOID);
     692        if (!numitems) {
     693          DosBeep(250, 100);
     694          break;
     695        }
     696        else {
     697          WinSetPointer(HWND_DESKTOP, hptrBusy);
     698          WinSetDlgItemText(hwnd, IAF_HELP, GetPString(IDS_FILTERINGTEXT));
     699          sSelect = 0;
     700          while (numitems) {
     701            *app = 0;
     702            WinSendMsg(inidata->hwndApp,
     703                       LM_QUERYITEMTEXT,
     704                       MPFROM2SHORT(sSelect, 1024), MPFROMP(app));
     705            match = FALSE;
     706            if (*app) {
     707              p = s;
     708              while (*p) {
     709                if (*p != '/') {
     710                  if (wildcard(app, p, TRUE))
     711                    match = TRUE;
     712                }
     713                else if (wildcard(app, p + 1, TRUE)) {
     714                  match = FALSE;
     715                  break;
     716                }
     717                while (*p)
     718                  p++;
     719                p++;
     720              }
     721            }
     722            if (!match)
     723              WinSendMsg(inidata->hwndApp, LM_DELETEITEM,
     724                        MPFROMSHORT(sSelect), MPVOID);
     725            else
     726              sSelect++;
     727            numitems--;
     728          }
     729          WinSetPointer(HWND_DESKTOP, hptrArrow);
     730        }
    725731      }
    726732      WinDismissDlg(hwnd, 1);
     
    729735    case IAF_LOAD:
    730736      {
    731         CHAR s[8193];
    732         FILE *fp;
    733         INT len;
    734         SHORT sSelect;
    735 
    736         sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX,
    737                                             LM_QUERYSELECTION,
    738                                             MPFROM2SHORT(LIT_FIRST, 0),
    739                                             MPVOID);
    740         if (sSelect < 0)
    741           Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    742         else {
    743           *s = 0;
    744           WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT,
    745                             MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
    746           bstrip(s);
    747           if (*s) {
    748             fp = _fsopen(s, "r", SH_DENYWR);
    749             if (fp) {
    750               len = fread(s, 1, 8192, fp);
    751               s[len] = 0;
    752               WinSetWindowText(hwndMLE, s);
    753               fclose(fp);
    754             }
    755           }
    756         }
     737        CHAR s[8193];
     738        FILE *fp;
     739        INT len;
     740        SHORT sSelect;
     741
     742        sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX,
     743                                            LM_QUERYSELECTION,
     744                                            MPFROM2SHORT(LIT_FIRST, 0),
     745                                            MPVOID);
     746        if (sSelect < 0)
     747          Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     748        else {
     749          *s = 0;
     750          WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT,
     751                            MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
     752          bstrip(s);
     753          if (*s) {
     754            fp = _fsopen(s, "r", SH_DENYWR);
     755            if (fp) {
     756              len = fread(s, 1, 8192, fp);
     757              s[len] = 0;
     758              WinSetWindowText(hwndMLE, s);
     759              fclose(fp);
     760            }
     761          }
     762        }
    757763      }
    758764      break;
     
    760766    case IAF_SAVE:
    761767      {
    762         CHAR s[8193], filename[CCHMAXPATH], *p;
    763         FILE *fp;
    764 
    765         *filename = 0;
    766         WinQueryDlgItemText(hwnd, IAF_SAVENAME, CCHMAXPATH, filename);
    767         bstrip(filename);
    768         if (*filename) {
    769           p = strchr(filename, '.');
    770           if (p) {
    771             strcpy(p, ".IST");
    772             WinSetDlgItemText(hwnd, IAF_SAVENAME, filename);
    773           }
    774           *s = 0;
    775           WinQueryWindowText(hwndMLE, 8192, s);
    776           if (!*s)
    777             Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    778           else {
    779             fp = xfopen(filename, "w", pszSrcFile, __LINE__);
    780             if (fp) {
    781               fwrite(s, 1, strlen(s), fp);
    782               fclose(fp);
    783               WinSendDlgItemMsg(hwnd,
    784                                 IAF_LISTBOX,
    785                                 LM_INSERTITEM,
    786                                 MPFROMSHORT(LIT_SORTASCENDING),
    787                                 MPFROMP(filename));
    788             }
    789           }
    790         }
     768        CHAR s[8193], filename[CCHMAXPATH], *p;
     769        FILE *fp;
     770
     771        *filename = 0;
     772        WinQueryDlgItemText(hwnd, IAF_SAVENAME, CCHMAXPATH, filename);
     773        bstrip(filename);
     774        if (*filename) {
     775          p = strchr(filename, '.');
     776          if (p) {
     777            strcpy(p, ".IST");
     778            WinSetDlgItemText(hwnd, IAF_SAVENAME, filename);
     779          }
     780          *s = 0;
     781          WinQueryWindowText(hwndMLE, 8192, s);
     782          if (!*s)
     783            Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     784          else {
     785            fp = xfopen(filename, "w", pszSrcFile, __LINE__);
     786            if (fp) {
     787              fwrite(s, 1, strlen(s), fp);
     788              fclose(fp);
     789              WinSendDlgItemMsg(hwnd,
     790                                IAF_LISTBOX,
     791                                LM_INSERTITEM,
     792                                MPFROMSHORT(LIT_SORTASCENDING),
     793                                MPFROMP(filename));
     794            }
     795          }
     796        }
    791797      }
    792798      break;
     
    794800    case IAF_DELETE:
    795801      {
    796         CHAR s[CCHMAXPATH];
    797         SHORT sSelect;
    798 
    799         sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX,
    800                                             LM_QUERYSELECTION,
    801                                             MPFROM2SHORT(LIT_FIRST, 0),
    802                                             MPVOID);
    803         if (sSelect >= 0) {
    804           *s = 0;
    805           WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT,
    806                             MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
    807           bstrip(s);
    808           if (*s) {
    809             unlinkf(s);
    810             WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_DELETEITEM,
    811                               MPFROMSHORT(sSelect), MPVOID);
    812           }
    813         }
     802        CHAR s[CCHMAXPATH];
     803        SHORT sSelect;
     804
     805        sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX,
     806                                            LM_QUERYSELECTION,
     807                                            MPFROM2SHORT(LIT_FIRST, 0),
     808                                            MPVOID);
     809        if (sSelect >= 0) {
     810          *s = 0;
     811          WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT,
     812                            MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
     813          bstrip(s);
     814          if (*s) {
     815            unlinkf(s);
     816            WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_DELETEITEM,
     817                              MPFROMSHORT(sSelect), MPVOID);
     818          }
     819        }
    814820      }
    815821      break;
     
    821827    case IDM_HELP:
    822828      if (hwndHelp)
    823         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    824                    MPFROM2SHORT(HELP_FILTERINI, 0),
    825                    MPFROMSHORT(HM_RESOURCEID));
     829        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     830                   MPFROM2SHORT(HELP_FILTERINI, 0),
     831                   MPFROMSHORT(HM_RESOURCEID));
    826832      break;
    827833    }
     
    840846    inirec = (INIREC *) mp2;
    841847    WinSendDlgItemMsg(hwnd,
    842                       INII_NEWAPP,
    843                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     848                      INII_NEWAPP,
     849                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    844850    WinSendDlgItemMsg(hwnd,
    845                       INII_NEWKEY,
    846                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     851                      INII_NEWKEY,
     852                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    847853    {
    848854      CHAR s[CCHMAXPATH + 34];
     
    856862      switch (inirec->action) {
    857863      case IDM_MOVE:
    858         WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEAPPTITLETEXT));
    859         break;
     864        WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEAPPTITLETEXT));
     865        break;
    860866      case IDM_COPY:
    861         WinSetWindowText(hwnd, GetPString(IDS_INICOPYAPPTITLETEXT));
    862         break;
     867        WinSetWindowText(hwnd, GetPString(IDS_INICOPYAPPTITLETEXT));
     868        break;
    863869      }
    864870    }
    865871    else {
    866872      {
    867         CHAR s[CCHMAXPATH + 34];
    868 
    869         sprintf(s, GetPString(IDS_INIWASTEXT), inirec->key);
    870         WinSetDlgItemText(hwnd, INII_OLDKEY, s);
     873        CHAR s[CCHMAXPATH + 34];
     874
     875        sprintf(s, GetPString(IDS_INIWASTEXT), inirec->key);
     876        WinSetDlgItemText(hwnd, INII_OLDKEY, s);
    871877      }
    872878      WinSetDlgItemText(hwnd, INII_NEWAPP, inirec->app);
    873879      WinSendDlgItemMsg(hwnd,
    874                         INII_NEWAPP,
    875                         EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID);
     880                        INII_NEWAPP,
     881                        EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID);
    876882      switch (inirec->action) {
    877883      case IDM_MOVE:
    878         WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEKEYTITLETEXT));
    879         break;
     884        WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEKEYTITLETEXT));
     885        break;
    880886      case IDM_COPY:
    881         WinSetWindowText(hwnd, GetPString(IDS_INICOPYKEYTITLETEXT));
    882         break;
     887        WinSetWindowText(hwnd, GetPString(IDS_INICOPYKEYTITLETEXT));
     888        break;
    883889      }
    884890    }
     
    890896      inirec = (INIREC *) WinQueryWindowPtr(hwnd, QWL_USER);
    891897      if (inirec) {
    892         WinQueryDlgItemText(hwnd, INII_NEWAPP, CCHMAXPATH, inirec->app2);
    893         bstrip(inirec->app2);
    894         if (!*inirec->app2) {
    895           DosBeep(50, 100);
    896           break;
    897         }
    898         if (*inirec->key) {
    899           WinQueryDlgItemText(hwnd, INII_NEWKEY, CCHMAXPATH, inirec->key2);
    900           bstrip(inirec->key2);
    901           if (!*inirec->key2) {
    902             DosBeep(50, 100);
    903             break;
    904           }
    905         }
    906         WinDismissDlg(hwnd, 1);
     898        WinQueryDlgItemText(hwnd, INII_NEWAPP, CCHMAXPATH, inirec->app2);
     899        bstrip(inirec->app2);
     900        if (!*inirec->app2) {
     901          DosBeep(50, 100);
     902          break;
     903        }
     904        if (*inirec->key) {
     905          WinQueryDlgItemText(hwnd, INII_NEWKEY, CCHMAXPATH, inirec->key2);
     906          bstrip(inirec->key2);
     907          if (!*inirec->key2) {
     908            DosBeep(50, 100);
     909            break;
     910          }
     911        }
     912        WinDismissDlg(hwnd, 1);
    907913      }
    908914      break;
     
    914920    case IDM_HELP:
    915921      if (hwndHelp)
    916         WinSendMsg(hwndHelp,
    917                    HM_DISPLAY_HELP,
    918                    MPFROM2SHORT(HELP_INTRAINI, 0),
    919                    MPFROMSHORT(HM_RESOURCEID));
     922        WinSendMsg(hwndHelp,
     923                   HM_DISPLAY_HELP,
     924                   MPFROM2SHORT(HELP_INTRAINI, 0),
     925                   MPFROMSHORT(HM_RESOURCEID));
    920926      break;
    921927    }
     
    931937    WinSetWindowPtr(hwnd, QWL_USER, mp2);
    932938    WinSendDlgItemMsg(hwnd, INIR_USERPROFILE, EM_SETTEXTLIMIT,
    933                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     939                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    934940    WinSendDlgItemMsg(hwnd, INIR_SYSTEMPROFILE, EM_SETTEXTLIMIT,
    935                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     941                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    936942    break;
    937943
     
    940946    case INIR_FIND:
    941947      {
    942         CHAR filename[CCHMAXPATH], *p, *ininame;
    943         USHORT id = 0;
    944         HWND hwndFocus;
    945 
    946         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    947         if (hwndFocus)
    948           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    949         if (id != INIR_SYSTEMPROFILE)
    950           id = INIR_USERPROFILE;
    951         ininame = INSTDATA(hwnd);
    952         if (ininame && *ininame) {
    953           strcpy(filename, ininame);
    954           p = filename;
    955           while (*p) {
    956             if (*p == '/')
    957               *p = '\\';
    958             p++;
    959           }
    960           p = strrchr(filename, '\\');
    961           if (p) {
    962             p++;
    963             *p = 0;
    964           }
    965           else
    966             *filename = 0;
    967         }
    968         else
    969           *filename = 0;
    970         strcat(filename, "*.INI");
    971         if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename)
    972           WinSetDlgItemText(hwnd, id, filename);
     948        CHAR filename[CCHMAXPATH], *p, *ininame;
     949        USHORT id = 0;
     950        HWND hwndFocus;
     951
     952        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     953        if (hwndFocus)
     954          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     955        if (id != INIR_SYSTEMPROFILE)
     956          id = INIR_USERPROFILE;
     957        ininame = INSTDATA(hwnd);
     958        if (ininame && *ininame) {
     959          strcpy(filename, ininame);
     960          p = filename;
     961          while (*p) {
     962            if (*p == '/')
     963              *p = '\\';
     964            p++;
     965          }
     966          p = strrchr(filename, '\\');
     967          if (p) {
     968            p++;
     969            *p = 0;
     970          }
     971          else
     972            *filename = 0;
     973        }
     974        else
     975          *filename = 0;
     976        strcat(filename, "*.INI");
     977        if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename)
     978          WinSetDlgItemText(hwnd, id, filename);
    973979      }
    974980      break;
     
    976982    case DID_OK:
    977983      {
    978         HINI testini;
    979         PRFPROFILE prfp;
    980         CHAR sysini[CCHMAXPATH];
    981         CHAR userini[CCHMAXPATH];
    982 
    983         WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini);
    984         WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini);
    985         testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini);
    986         if (testini == NULLHANDLE) {
    987           saymsg(MB_CANCEL,
    988                 hwnd,
    989                 GetPString(IDS_ERRORTEXT),
    990                 GetPString(IDS_INICANTOPENUSERTEXT), userini);
    991           break;
    992         }
    993         CloseProfile(testini, FALSE);
    994         testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini);
    995         if (testini == NULLHANDLE) {
    996           saymsg(MB_CANCEL,
    997                 hwnd,
    998                 GetPString(IDS_ERRORTEXT),
    999                 GetPString(IDS_INICANTOPENSYSTEXT), sysini);
    1000           break;
    1001         }
    1002         CloseProfile(testini, FALSE);
    1003         memset(&prfp, 0, sizeof(PRFPROFILE));
    1004         prfp.cchUserName = strlen(sysini);
    1005         prfp.cchSysName = strlen(userini);
    1006         prfp.pszUserName = (PSZ) userini;
    1007         prfp.pszSysName = (PSZ) sysini;
    1008         if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {
    1009           Win_Error(hwnd, hwnd, __FILE__, __LINE__,
    1010                     GetPString(IDS_INIPRFRESETFAILEDTEXT));
    1011         }
    1012         else
    1013           WinDismissDlg(hwnd, 1);
     984        HINI testini;
     985        PRFPROFILE prfp;
     986        CHAR sysini[CCHMAXPATH];
     987        CHAR userini[CCHMAXPATH];
     988
     989        WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini);
     990        WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini);
     991        testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini);
     992        if (testini == NULLHANDLE) {
     993          saymsg(MB_CANCEL,
     994                hwnd,
     995                GetPString(IDS_ERRORTEXT),
     996                GetPString(IDS_INICANTOPENUSERTEXT), userini);
     997          break;
     998        }
     999        CloseProfile(testini, FALSE);
     1000        testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini);
     1001        if (testini == NULLHANDLE) {
     1002          saymsg(MB_CANCEL,
     1003                hwnd,
     1004                GetPString(IDS_ERRORTEXT),
     1005                GetPString(IDS_INICANTOPENSYSTEXT), sysini);
     1006          break;
     1007        }
     1008        CloseProfile(testini, FALSE);
     1009        memset(&prfp, 0, sizeof(PRFPROFILE));
     1010        prfp.cchUserName = strlen(sysini);
     1011        prfp.cchSysName = strlen(userini);
     1012        prfp.pszUserName = (PSZ) userini;
     1013        prfp.pszSysName = (PSZ) sysini;
     1014        if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {
     1015          Win_Error(hwnd, hwnd, __FILE__, __LINE__,
     1016                    GetPString(IDS_INIPRFRESETFAILEDTEXT));
     1017        }
     1018        else
     1019          WinDismissDlg(hwnd, 1);
    10141020      }
    10151021      break;
     
    10211027    case IDM_HELP:
    10221028      if (hwndHelp)
    1023         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1024                    MPFROM2SHORT(HELP_CHANGEINI, 0),
    1025                    MPFROMSHORT(HM_RESOURCEID));
     1029        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1030                   MPFROM2SHORT(HELP_CHANGEINI, 0),
     1031                   MPFROMSHORT(HM_RESOURCEID));
    10261032      break;
    10271033    }
     
    10371043    WinSetWindowPtr(hwnd, QWL_USER, mp2);
    10381044    WinSendDlgItemMsg(hwnd,
    1039                       INIR_USERPROFILE,
    1040                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     1045                      INIR_USERPROFILE,
     1046                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    10411047    WinSendDlgItemMsg(hwnd,
    1042                       INIR_SYSTEMPROFILE,
    1043                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     1048                      INIR_SYSTEMPROFILE,
     1049                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    10441050    WinSetWindowText(hwnd, GetPString(IDS_INISWAPOS2INISTITLETEXT));
    10451051    break;
     
    10491055    case INIR_FIND:
    10501056      {
    1051         CHAR filename[CCHMAXPATH], *p, *ininame;
    1052         USHORT id = 0;
    1053         HWND hwndFocus;
    1054 
    1055         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    1056         if (hwndFocus)
    1057           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    1058         if (id != INIR_SYSTEMPROFILE)
    1059           id = INIR_USERPROFILE;
    1060         ininame = INSTDATA(hwnd);
    1061         if (ininame && *ininame) {
    1062           strcpy(filename, ininame);
    1063           p = filename;
    1064           while (*p) {
    1065             if (*p == '/')
    1066               *p = '\\';
    1067             p++;
    1068           }
    1069           p = strrchr(filename, '\\');
    1070           if (p) {
    1071             p++;
    1072             *p = 0;
    1073           }
    1074           else
    1075             *filename = 0;
    1076         }
    1077         else
    1078           *filename = 0;
    1079         strcat(filename, "*.INI");
    1080         if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename)
    1081           WinSetDlgItemText(hwnd, id, filename);
     1057        CHAR filename[CCHMAXPATH], *p, *ininame;
     1058        USHORT id = 0;
     1059        HWND hwndFocus;
     1060
     1061        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     1062        if (hwndFocus)
     1063          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     1064        if (id != INIR_SYSTEMPROFILE)
     1065          id = INIR_USERPROFILE;
     1066        ininame = INSTDATA(hwnd);
     1067        if (ininame && *ininame) {
     1068          strcpy(filename, ininame);
     1069          p = filename;
     1070          while (*p) {
     1071            if (*p == '/')
     1072              *p = '\\';
     1073            p++;
     1074          }
     1075          p = strrchr(filename, '\\');
     1076          if (p) {
     1077            p++;
     1078            *p = 0;
     1079          }
     1080          else
     1081            *filename = 0;
     1082        }
     1083        else
     1084          *filename = 0;
     1085        strcat(filename, "*.INI");
     1086        if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename)
     1087          WinSetDlgItemText(hwnd, id, filename);
    10821088      }
    10831089      break;
     
    10851091    case DID_OK:
    10861092      {
    1087         HINI testini;
    1088         PRFPROFILE prfp;
    1089         CHAR sysini[CCHMAXPATH];
    1090         CHAR userini[CCHMAXPATH];
    1091         CHAR oldsysini[CCHMAXPATH];
    1092         CHAR olduserini[CCHMAXPATH];
    1093         CHAR tempsysini[CCHMAXPATH];
    1094         CHAR tempuserini[CCHMAXPATH];
    1095         CHAR tempsysini2[CCHMAXPATH];
    1096         CHAR tempuserini2[CCHMAXPATH];
    1097         CHAR *p;
    1098         APIRET rc;
    1099 
    1100         *tempuserini = 0;
    1101         *tempsysini = 0;
    1102         *tempuserini2 = 0;
    1103         *tempsysini2 = 0;
    1104         memset(&prfp, 0, sizeof(PRFPROFILE));
    1105         prfp.cchUserName = CCHMAXPATH;
    1106         prfp.cchSysName = CCHMAXPATH;
    1107         prfp.pszUserName = (PSZ) olduserini;
    1108         prfp.pszSysName = (PSZ) oldsysini;
    1109         if (!PrfQueryProfile(WinQueryAnchorBlock(hwnd), &prfp)) {
    1110           Win_Error(hwnd, hwnd, __FILE__, __LINE__,
    1111                     GetPString(IDS_INIQUERYPRFFAILEDTEXT));
    1112           break;
    1113         }
    1114         WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini);
    1115         WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini);
    1116         MakeFullName(userini);
    1117         MakeFullName(sysini);
    1118         testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini);
    1119         if (testini == NULLHANDLE) {
    1120           saymsg(MB_CANCEL,
    1121                 hwnd,
    1122                 GetPString(IDS_ERRORTEXT),
    1123                 GetPString(IDS_INICANTOPENUSERTEXT), userini);
    1124           break;
    1125         }
    1126         CloseProfile(testini, FALSE);
    1127         testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini);
    1128         if (testini == NULLHANDLE) {
    1129           saymsg(MB_CANCEL,
    1130                 hwnd,
    1131                 GetPString(IDS_ERRORTEXT),
    1132                 GetPString(IDS_INICANTOPENSYSTEXT), sysini);
    1133           break;
    1134         }
    1135         CloseProfile(testini, FALSE);
    1136         /* make copies of new inis */
    1137         *tempuserini = 0;
     1093        HINI testini;
     1094        PRFPROFILE prfp;
     1095        CHAR sysini[CCHMAXPATH];
     1096        CHAR userini[CCHMAXPATH];
     1097        CHAR oldsysini[CCHMAXPATH];
     1098        CHAR olduserini[CCHMAXPATH];
     1099        CHAR tempsysini[CCHMAXPATH];
     1100        CHAR tempuserini[CCHMAXPATH];
     1101        CHAR tempsysini2[CCHMAXPATH];
     1102        CHAR tempuserini2[CCHMAXPATH];
     1103        CHAR *p;
     1104        APIRET rc;
     1105
     1106        *tempuserini = 0;
     1107        *tempsysini = 0;
     1108        *tempuserini2 = 0;
     1109        *tempsysini2 = 0;
     1110        memset(&prfp, 0, sizeof(PRFPROFILE));
     1111        prfp.cchUserName = CCHMAXPATH;
     1112        prfp.cchSysName = CCHMAXPATH;
     1113        prfp.pszUserName = (PSZ) olduserini;
     1114        prfp.pszSysName = (PSZ) oldsysini;
     1115        if (!PrfQueryProfile(WinQueryAnchorBlock(hwnd), &prfp)) {
     1116          Win_Error(hwnd, hwnd, __FILE__, __LINE__,
     1117                    GetPString(IDS_INIQUERYPRFFAILEDTEXT));
     1118          break;
     1119        }
     1120        WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini);
     1121        WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini);
     1122        MakeFullName(userini);
     1123        MakeFullName(sysini);
     1124        testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini);
     1125        if (testini == NULLHANDLE) {
     1126          saymsg(MB_CANCEL,
     1127                hwnd,
     1128                GetPString(IDS_ERRORTEXT),
     1129                GetPString(IDS_INICANTOPENUSERTEXT), userini);
     1130          break;
     1131        }
     1132        CloseProfile(testini, FALSE);
     1133        testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini);
     1134        if (testini == NULLHANDLE) {
     1135          saymsg(MB_CANCEL,
     1136                hwnd,
     1137                GetPString(IDS_ERRORTEXT),
     1138                GetPString(IDS_INICANTOPENSYSTEXT), sysini);
     1139          break;
     1140        }
     1141        CloseProfile(testini, FALSE);
     1142        /* make copies of new inis */
     1143        *tempuserini = 0;
    11381144        *tempsysini = 0;
    11391145        BldFullPathName(tempuserini, pTmpDir ? pTmpDir : pFM2SaveDirectory, "TEMPUSER.INI");
    1140         rc = DosCopy(userini, tempuserini, DCPY_EXISTING);
    1141         if (rc) {
    1142           Dos_Error(MB_CANCEL,
    1143                     rc,
    1144                     hwnd,
    1145                     __FILE__,
    1146                     __LINE__,
    1147                     GetPString(IDS_COMPCOPYFAILEDTEXT), userini, tempuserini);
    1148           break;
     1146        rc = DosCopy(userini, tempuserini, DCPY_EXISTING);
     1147        if (rc) {
     1148          Dos_Error(MB_CANCEL,
     1149                    rc,
     1150                    hwnd,
     1151                    __FILE__,
     1152                    __LINE__,
     1153                    GetPString(IDS_COMPCOPYFAILEDTEXT), userini, tempuserini);
     1154          break;
    11491155        }
    11501156        BldFullPathName(tempsysini, pTmpDir ? pTmpDir : pFM2SaveDirectory, "TEMPSYS.INI");
    1151         rc = DosCopy(sysini, tempsysini, DCPY_EXISTING);
    1152         if (rc) {
    1153           Dos_Error(MB_CANCEL,
    1154                     rc,
    1155                     hwnd,
    1156                     __FILE__,
    1157                     __LINE__,
    1158                     GetPString(IDS_COMPCOPYFAILEDTEXT), sysini, tempsysini);
    1159           break;
    1160         }
    1161         memset(&prfp, 0, sizeof(PRFPROFILE));
    1162         prfp.cchUserName = strlen(tempuserini);
    1163         prfp.cchSysName = strlen(tempsysini);
    1164         prfp.pszUserName = (PSZ) tempuserini;
    1165         prfp.pszSysName = (PSZ) tempsysini;
    1166         if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {
    1167           Win_Error(hwnd, hwnd, __FILE__, __LINE__,
    1168                     GetPString(IDS_INIPRFRESETFAILEDTEXT));
    1169         }
    1170         else {
    1171           /* backup old inis */
    1172           strcpy(tempuserini2, olduserini);
    1173           p = strrchr(tempuserini2, '\\');
    1174           if (!p)
    1175             *tempuserini2 = 0;
    1176           else {
    1177             p++;
    1178             *p = 0;
    1179           }
    1180           strcat(tempuserini2, "OS2INI.BAK");
    1181           rc = DosCopy(olduserini, tempuserini2, DCPY_EXISTING);
    1182           if (rc) {
    1183             Dos_Error(MB_CANCEL,
    1184                       rc,
    1185                       hwnd,
    1186                       __FILE__,
    1187                       __LINE__,
    1188                       GetPString(IDS_COMPCOPYFAILEDTEXT),
    1189                       olduserini, tempuserini2);
    1190             WinDismissDlg(hwnd, 1);
    1191             break;
    1192           }
    1193           strcpy(tempsysini2, oldsysini);
    1194           p = strrchr(tempsysini2, '\\');
    1195           if (!p)
    1196             *tempsysini2 = 0;
    1197           else {
    1198             p++;
    1199             *p = 0;
    1200           }
    1201           strcat(tempsysini2, "OS2SYINI.BAK");
    1202           rc = DosCopy(oldsysini, tempsysini2, DCPY_EXISTING);
    1203           if (rc) {
    1204             Dos_Error(MB_CANCEL,
    1205                       rc,
    1206                       hwnd,
    1207                       __FILE__,
    1208                       __LINE__,
    1209                       GetPString(IDS_COMPCOPYFAILEDTEXT),
    1210                       oldsysini, tempsysini2);
    1211             WinDismissDlg(hwnd, 1);
    1212             break;
    1213           }
    1214           /* copy new inis to old ini names */
    1215           rc = DosCopy(userini, olduserini, DCPY_EXISTING);
    1216           if (rc) {
    1217             Dos_Error(MB_CANCEL,
    1218                       rc,
    1219                       hwnd,
    1220                       __FILE__,
    1221                       __LINE__,
    1222                       GetPString(IDS_COMPCOPYFAILEDTEXT),
    1223                       userini, olduserini);
    1224             WinDismissDlg(hwnd, 1);
    1225             break;
    1226           }
    1227           rc = DosCopy(sysini, oldsysini, DCPY_EXISTING);
    1228           if (rc) {
    1229             Dos_Error(MB_CANCEL,
    1230                       rc,
    1231                       hwnd,
    1232                       __FILE__,
    1233                       __LINE__,
    1234                       GetPString(IDS_COMPCOPYFAILEDTEXT),
    1235                       userini, olduserini);
    1236             WinDismissDlg(hwnd, 1);
    1237             break;
    1238           }
    1239           /* replace temp inis with new permanent inis */
    1240           memset(&prfp, 0, sizeof(PRFPROFILE));
    1241           prfp.cchUserName = strlen(oldsysini);
    1242           prfp.cchSysName = strlen(olduserini);
    1243           prfp.pszUserName = (PSZ) olduserini;
    1244           prfp.pszSysName = (PSZ) oldsysini;
    1245           if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {
    1246             Win_Error(hwnd, hwnd, __FILE__, __LINE__,
    1247                       GetPString(IDS_INIPRFRESETFAILEDTEXT));
    1248           }
    1249           else {
    1250             Notify(GetPString(IDS_SUCCESSTEXT));
    1251             unlinkf(tempuserini);
    1252             unlinkf(tempsysini);
    1253           }
    1254           WinDismissDlg(hwnd, 1);
    1255         }
     1157        rc = DosCopy(sysini, tempsysini, DCPY_EXISTING);
     1158        if (rc) {
     1159          Dos_Error(MB_CANCEL,
     1160                    rc,
     1161                    hwnd,
     1162                    __FILE__,
     1163                    __LINE__,
     1164                    GetPString(IDS_COMPCOPYFAILEDTEXT), sysini, tempsysini);
     1165          break;
     1166        }
     1167        memset(&prfp, 0, sizeof(PRFPROFILE));
     1168        prfp.cchUserName = strlen(tempuserini);
     1169        prfp.cchSysName = strlen(tempsysini);
     1170        prfp.pszUserName = (PSZ) tempuserini;
     1171        prfp.pszSysName = (PSZ) tempsysini;
     1172        if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {
     1173          Win_Error(hwnd, hwnd, __FILE__, __LINE__,
     1174                    GetPString(IDS_INIPRFRESETFAILEDTEXT));
     1175        }
     1176        else {
     1177          /* backup old inis */
     1178          strcpy(tempuserini2, olduserini);
     1179          p = strrchr(tempuserini2, '\\');
     1180          if (!p)
     1181            *tempuserini2 = 0;
     1182          else {
     1183            p++;
     1184            *p = 0;
     1185          }
     1186          strcat(tempuserini2, "OS2INI.BAK");
     1187          rc = DosCopy(olduserini, tempuserini2, DCPY_EXISTING);
     1188          if (rc) {
     1189            Dos_Error(MB_CANCEL,
     1190                      rc,
     1191                      hwnd,
     1192                      __FILE__,
     1193                      __LINE__,
     1194                      GetPString(IDS_COMPCOPYFAILEDTEXT),
     1195                      olduserini, tempuserini2);
     1196            WinDismissDlg(hwnd, 1);
     1197            break;
     1198          }
     1199          strcpy(tempsysini2, oldsysini);
     1200          p = strrchr(tempsysini2, '\\');
     1201          if (!p)
     1202            *tempsysini2 = 0;
     1203          else {
     1204            p++;
     1205            *p = 0;
     1206          }
     1207          strcat(tempsysini2, "OS2SYINI.BAK");
     1208          rc = DosCopy(oldsysini, tempsysini2, DCPY_EXISTING);
     1209          if (rc) {
     1210            Dos_Error(MB_CANCEL,
     1211                      rc,
     1212                      hwnd,
     1213                      __FILE__,
     1214                      __LINE__,
     1215                      GetPString(IDS_COMPCOPYFAILEDTEXT),
     1216                      oldsysini, tempsysini2);
     1217            WinDismissDlg(hwnd, 1);
     1218            break;
     1219          }
     1220          /* copy new inis to old ini names */
     1221          rc = DosCopy(userini, olduserini, DCPY_EXISTING);
     1222          if (rc) {
     1223            Dos_Error(MB_CANCEL,
     1224                      rc,
     1225                      hwnd,
     1226                      __FILE__,
     1227                      __LINE__,
     1228                      GetPString(IDS_COMPCOPYFAILEDTEXT),
     1229                      userini, olduserini);
     1230            WinDismissDlg(hwnd, 1);
     1231            break;
     1232          }
     1233          rc = DosCopy(sysini, oldsysini, DCPY_EXISTING);
     1234          if (rc) {
     1235            Dos_Error(MB_CANCEL,
     1236                      rc,
     1237                      hwnd,
     1238                      __FILE__,
     1239                      __LINE__,
     1240                      GetPString(IDS_COMPCOPYFAILEDTEXT),
     1241                      userini, olduserini);
     1242            WinDismissDlg(hwnd, 1);
     1243            break;
     1244          }
     1245          /* replace temp inis with new permanent inis */
     1246          memset(&prfp, 0, sizeof(PRFPROFILE));
     1247          prfp.cchUserName = strlen(oldsysini);
     1248          prfp.cchSysName = strlen(olduserini);
     1249          prfp.pszUserName = (PSZ) olduserini;
     1250          prfp.pszSysName = (PSZ) oldsysini;
     1251          if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {
     1252            Win_Error(hwnd, hwnd, __FILE__, __LINE__,
     1253                      GetPString(IDS_INIPRFRESETFAILEDTEXT));
     1254          }
     1255          else {
     1256            Notify(GetPString(IDS_SUCCESSTEXT));
     1257            unlinkf(tempuserini);
     1258            unlinkf(tempsysini);
     1259          }
     1260          WinDismissDlg(hwnd, 1);
     1261        }
    12561262      }
    12571263      break;
     
    12631269    case IDM_HELP:
    12641270      if (hwndHelp)
    1265         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1266                    MPFROM2SHORT(HELP_SWAPINI, 0), MPFROMSHORT(HM_RESOURCEID));
     1271        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1272                   MPFROM2SHORT(HELP_SWAPINI, 0), MPFROMSHORT(HM_RESOURCEID));
    12671273      break;
    12681274    }
     
    12881294    WinSetWindowPtr(hwnd, QWL_USER, (PVOID) mp2);
    12891295    WinSendDlgItemMsg(hwnd,
    1290                       IAD_APPNAME,
    1291                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     1296                      IAD_APPNAME,
     1297                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    12921298    WinSendDlgItemMsg(hwnd,
    1293                       IAD_KEYNAME,
    1294                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     1299                      IAD_KEYNAME,
     1300                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    12951301    WinSendDlgItemMsg(hwnd,
    1296                       IAD_DATA,
    1297                       EM_SETTEXTLIMIT, MPFROM2SHORT(32767, 0), MPVOID);
     1302                      IAD_DATA,
     1303                      EM_SETTEXTLIMIT, MPFROM2SHORT(32767, 0), MPVOID);
    12981304    WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
    12991305    WinSetDlgItemText(hwnd, IAD_APPNAME, inidata->applname);
     
    13021308      if (inidata->data && inidata->datalen) {
    13031309
    1304         CHAR *p;
    1305 
    1306         inidata->isbinary = FALSE;
    1307         p = inidata->data;
    1308         while ((p - inidata->data) < inidata->datalen - 1) {
    1309           if (*p < ' ' || !isprint(*p)) {
    1310             inidata->isbinary = TRUE;
    1311             break;
    1312           }
    1313           p++;
    1314         }
    1315         if (inidata->isbinary) {
    1316           inidata->isbinary = TRUE;
    1317           WinCheckButton(hwnd, IAD_ISBINARY, TRUE);
    1318           if (saymsg(MB_ENTERCANCEL | MB_ICONEXCLAMATION,
    1319                      hwnd,
    1320                      GetPString(IDS_WARNINGTEXT),
    1321                      GetPString(IDS_INIBINARYDATASKIPTEXT)) == MBID_CANCEL)
    1322             WinDismissDlg(hwnd, 0);
    1323           l = inidata->datalen * 4 + 1;
    1324           p = xmallocz(l, pszSrcFile, __LINE__);
    1325           if (p) {
    1326             fixup(inidata->data, p, l, inidata->datalen);
    1327             WinSetDlgItemText(hwnd, IAD_DATA, p);
    1328             free(p);
    1329           }
    1330         }
    1331         else
    1332           WinSetDlgItemText(hwnd, IAD_DATA, inidata->data);
     1310        CHAR *p;
     1311
     1312        inidata->isbinary = FALSE;
     1313        p = inidata->data;
     1314        while ((p - inidata->data) < inidata->datalen - 1) {
     1315          if (*p < ' ' || !isprint(*p)) {
     1316            inidata->isbinary = TRUE;
     1317            break;
     1318          }
     1319          p++;
     1320        }
     1321        if (inidata->isbinary) {
     1322          inidata->isbinary = TRUE;
     1323          WinCheckButton(hwnd, IAD_ISBINARY, TRUE);
     1324          if (saymsg(MB_ENTERCANCEL | MB_ICONEXCLAMATION,
     1325                     hwnd,
     1326                     GetPString(IDS_WARNINGTEXT),
     1327                     GetPString(IDS_INIBINARYDATASKIPTEXT)) == MBID_CANCEL)
     1328            WinDismissDlg(hwnd, 0);
     1329          l = inidata->datalen * 4 + 1;
     1330          p = xmallocz(l, pszSrcFile, __LINE__);
     1331          if (p) {
     1332            fixup(inidata->data, p, l, inidata->datalen);
     1333            WinSetDlgItemText(hwnd, IAD_DATA, p);
     1334            free(p);
     1335          }
     1336        }
     1337        else
     1338          WinSetDlgItemText(hwnd, IAD_DATA, inidata->data);
    13331339      }
    13341340      PostMsg(hwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID);
     
    13421348      WinQueryDlgItemText(hwnd, IAD_DATA, 32, s);
    13431349      if (*s)
    1344         WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
     1350        WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
    13451351    }
    13461352    WinSendDlgItemMsg(hwnd, IAD_APPNAME, EM_QUERYCHANGED, MPVOID, MPVOID);
     
    13581364  case UM_SETUP:
    13591365    saymsg(MB_ENTER | MB_ICONASTERISK,
    1360            hwnd,
    1361            GetPString(IDS_WARNINGTEXT), GetPString(IDS_INIAPPKEYEXISTSTEXT));
     1366           hwnd,
     1367           GetPString(IDS_WARNINGTEXT), GetPString(IDS_INIAPPKEYEXISTSTEXT));
    13621368    return 0;
    13631369
     
    13671373      inidata = INSTDATA(hwnd);
    13681374      if (!inidata)
    1369         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     1375        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    13701376      else {
    1371         CHAR s[CCHMAXPATH], applname[CCHMAXPATH];
    1372         BOOL appchanged = FALSE, keychanged = FALSE;
    1373 
    1374         *applname = 0;
    1375         WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname);
    1376         bstrip(applname);
    1377         if (*applname) {
    1378           *s = 0;
    1379           WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, s);
    1380           bstrip(s);
    1381           if (*s) {
    1382             appchanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_APPNAME,
    1383                                                   EM_QUERYCHANGED,
    1384                                                   MPVOID, MPVOID);
    1385             keychanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_KEYNAME,
    1386                                                   EM_QUERYCHANGED,
    1387                                                   MPVOID, MPVOID);
    1388             if (appchanged || keychanged) {
    1389 
    1390               ULONG size = 0L;
    1391 
    1392               if (PrfQueryProfileSize(inidata->hini, applname, s, &size))
    1393                 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    1394             }
    1395             *s = 0;
    1396             WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, s);
    1397             bstrip(s);
    1398             WinEnableWindow(WinWindowFromID(hwnd, DID_OK), (*s != 0));
    1399           }
    1400           else
    1401             WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
    1402         }
    1403         else
    1404           WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
     1377        CHAR s[CCHMAXPATH], applname[CCHMAXPATH];
     1378        BOOL appchanged = FALSE, keychanged = FALSE;
     1379
     1380        *applname = 0;
     1381        WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname);
     1382        bstrip(applname);
     1383        if (*applname) {
     1384          *s = 0;
     1385          WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, s);
     1386          bstrip(s);
     1387          if (*s) {
     1388            appchanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_APPNAME,
     1389                                                  EM_QUERYCHANGED,
     1390                                                  MPVOID, MPVOID);
     1391            keychanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_KEYNAME,
     1392                                                  EM_QUERYCHANGED,
     1393                                                  MPVOID, MPVOID);
     1394            if (appchanged || keychanged) {
     1395
     1396              ULONG size = 0L;
     1397
     1398              if (PrfQueryProfileSize(inidata->hini, applname, s, &size))
     1399                PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     1400            }
     1401            *s = 0;
     1402            WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, s);
     1403            bstrip(s);
     1404            WinEnableWindow(WinWindowFromID(hwnd, DID_OK), (*s != 0));
     1405          }
     1406          else
     1407            WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
     1408        }
     1409        else
     1410          WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
    14051411      }
    14061412      break;
     
    14121418    case DID_OK:
    14131419      {
    1414         CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH], data[CCHMAXPATH];
    1415         INT len;
    1416 
    1417         inidata = INSTDATA(hwnd);
    1418         if (!inidata) {
    1419           Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    1420           break;
    1421         }
    1422         inidata->isbinary = WinQueryButtonCheckstate(hwnd, IAD_ISBINARY);
    1423         *applname = 0;
    1424         WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname);
    1425         bstrip(applname);
    1426         if (*applname) {
    1427           *keyname = 0;
    1428           WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, keyname);
    1429           bstrip(keyname);
    1430           if (*keyname) {
    1431             *data = 0;
    1432             WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, data);
    1433             if (*data) {
    1434               if (inidata->isbinary)
    1435                 len = literal(data);
    1436               else
    1437                 len = strlen(data) + 1;
    1438               PrfWriteProfileData(inidata->hini, applname, keyname, data,
    1439                                   (ULONG) len);
    1440               WinSendMsg(inidata->hwndIni, UM_RESCAN,
    1441                         MPFROMP(applname), MPFROMP(keyname));
    1442               WinDismissDlg(hwnd, 1);
    1443             }
    1444           }
    1445         }
     1420        CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH], data[CCHMAXPATH];
     1421        INT len;
     1422
     1423        inidata = INSTDATA(hwnd);
     1424        if (!inidata) {
     1425          Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     1426          break;
     1427        }
     1428        inidata->isbinary = WinQueryButtonCheckstate(hwnd, IAD_ISBINARY);
     1429        *applname = 0;
     1430        WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname);
     1431        bstrip(applname);
     1432        if (*applname) {
     1433          *keyname = 0;
     1434          WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, keyname);
     1435          bstrip(keyname);
     1436          if (*keyname) {
     1437            *data = 0;
     1438            WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, data);
     1439            if (*data) {
     1440              if (inidata->isbinary)
     1441                len = literal(data);
     1442              else
     1443                len = strlen(data) + 1;
     1444              PrfWriteProfileData(inidata->hini, applname, keyname, data,
     1445                                  (ULONG) len);
     1446              WinSendMsg(inidata->hwndIni, UM_RESCAN,
     1447                        MPFROMP(applname), MPFROMP(keyname));
     1448              WinDismissDlg(hwnd, 1);
     1449            }
     1450          }
     1451        }
    14461452      }
    14471453      break;
     
    14531459    case IDM_HELP:
    14541460      if (hwndHelp)
    1455         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1456                    MPFROM2SHORT(HELP_INIADD, 0), MPFROMSHORT(HM_RESOURCEID));
     1461        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1462                   MPFROM2SHORT(HELP_INIADD, 0), MPFROMSHORT(HM_RESOURCEID));
    14571463      break;
    14581464    }
     
    14991505    flFrameFlags |= FCF_TASKLIST;
    15001506  hwndFrame = WinCreateStdWindow(hwnd,
    1501                                 0,
    1502                                 &flFrameFlags,
    1503                                 WC_INIEDITOR,
    1504                                 NullStr,
    1505                                 fwsAnimate,
    1506                                 FM3ModHandle, INI_FRAME, &hwndClient);
     1507                                0,
     1508                                &flFrameFlags,
     1509                                WC_INIEDITOR,
     1510                                NullStr,
     1511                                fwsAnimate,
     1512                                FM3ModHandle, INI_FRAME, &hwndClient);
    15071513  if (hwndFrame) {
    15081514    WinSetWindowUShort(hwndFrame, QWS_ID, INI_FRAME);
     
    15131519      FillClient(hwnd, &swp, NULL, FALSE);
    15141520      WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
    1515                       SWP_SIZE | SWP_MOVE);
     1521                      SWP_SIZE | SWP_MOVE);
    15161522    }
    15171523    else if (ParentIsDesktop(hwndFrame, hwnd)) {
    15181524      if (!WinRestoreWindowPos(FM2Str, "INIWindowPos", hwndFrame)) {
    15191525
    1520         ULONG fl = SWP_MOVE | SWP_SIZE;
    1521         SWP swp;
    1522 
    1523         WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0L, &swp);
    1524         if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
    1525           fl = swp.fl;
    1526         else if (swp.fl & SWP_ACTIVATE)
    1527           fl |= SWP_ACTIVATE;
    1528         WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
    1529                         fl);
     1526        ULONG fl = SWP_MOVE | SWP_SIZE;
     1527        SWP swp;
     1528
     1529        WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0L, &swp);
     1530        if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))
     1531          fl = swp.fl;
     1532        else if (swp.fl & SWP_ACTIVATE)
     1533          fl |= SWP_ACTIVATE;
     1534        WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
     1535                        fl);
    15301536      }
    15311537    }
     
    15331539    PostMsg(hwndClient, UM_ACTION, MPVOID, MPVOID);
    15341540    if (!PostMsg(hwndClient, UM_LOADFILE, MPFROMP(((filename && *filename) ?
    1535                                                    filename : NULL)), MPVOID))
     1541                                                   filename : NULL)), MPVOID))
    15361542      WinSendMsg(hwndClient, UM_LOADFILE, MPFROMP(((filename && *filename) ?
    1537                                                    filename : NULL)), MPVOID);
     1543                                                   filename : NULL)), MPVOID);
    15381544    if (flags & 4)
    15391545      PostMsg(hwndClient, UM_INITIALSIZE, MPVOID, MPVOID);
     
    15681574      switch (id) {
    15691575      case INI_APPLIST:
    1570         id = INI_APPMENU;
    1571         break;
     1576        id = INI_APPMENU;
     1577        break;
    15721578      case INI_KEYLIST:
    1573         id = INI_KEYMENU;
    1574         break;
     1579        id = INI_KEYMENU;
     1580        break;
    15751581      default:
    1576         id = 0;
    1577         break;
     1582        id = 0;
     1583        break;
    15781584      }
    15791585      if (id) {
    1580         if (hwndPopup)
    1581           WinDestroyWindow(hwndPopup);
    1582         hwndPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
    1583         if (hwndPopup)
    1584           WinPopupMenu(hwnd, WinQueryWindow(hwnd, QW_PARENT),
    1585                        hwndPopup, 8, 8, 0,
    1586                        PU_HCONSTRAIN | PU_VCONSTRAIN |
    1587                        PU_KEYBOARD | PU_MOUSEBUTTON1);
     1586        if (hwndPopup)
     1587          WinDestroyWindow(hwndPopup);
     1588        hwndPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
     1589        if (hwndPopup)
     1590          WinPopupMenu(hwnd, WinQueryWindow(hwnd, QW_PARENT),
     1591                       hwndPopup, 8, 8, 0,
     1592                       PU_HCONSTRAIN | PU_VCONSTRAIN |
     1593                       PU_KEYBOARD | PU_MOUSEBUTTON1);
    15881594      }
    15891595    }
     
    16031609      inidata = WinQueryWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER);
    16041610      if (!inidata || !*inidata->ininame || !*inidata->applname ||
    1605           !inidata->keyname) {
    1606         DosBeep(50, 100);
    1607         break;
     1611          !inidata->keyname) {
     1612        DosBeep(50, 100);
     1613        break;
    16081614      }
    16091615      hptrINI = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, INI_FRAME);
     
    16251631      DItem.hstrSourceName = DrgAddStrHandle(inidata->applname);
    16261632      if (id == INI_APPLIST)
    1627         DItem.hstrTargetName = DrgAddStrHandle(NullStr);
     1633        DItem.hstrTargetName = DrgAddStrHandle(NullStr);
    16281634      else
    1629         DItem.hstrTargetName = DrgAddStrHandle(inidata->keyname);
     1635        DItem.hstrTargetName = DrgAddStrHandle(inidata->keyname);
    16301636      DItem.fsControl = 0;
    16311637      DItem.fsSupportedOps = DO_COPYABLE | DO_LINKABLE | DO_MOVEABLE;
     
    16341640      hDrop = DrgDrag(hwnd, pDInfo, &DIcon, 1L, VK_ENDDRAG, (PVOID) NULL);
    16351641      if (hDrop == NULLHANDLE)
    1636         FreeDragInfoData(hwnd, pDInfo);
     1642        FreeDragInfoData(hwnd, pDInfo);
    16371643      WinDestroyPointer(hptrINI);
    16381644    }
     
    16451651
    16461652      if (!DrgAccessDraginfo(pDInfo)) {
    1647         Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    1648                   "DrgAccessDraginfo");
     1653        Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     1654                  "DrgAccessDraginfo");
    16491655      }
    16501656      else {
    1651         pDItem = DrgQueryDragitemPtr(pDInfo,0);
    1652         /* Check valid rendering mechanisms and data */
    1653         if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) {
    1654           DrgFreeDraginfo(pDInfo);
    1655           return (MRFROM2SHORT(DOR_DROP, DO_LINK));     /* OK to drop */
    1656         }
    1657         else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) {
    1658           if (WinQueryWindow(pDInfo->hwndSource, QW_PARENT) !=
    1659               WinQueryWindow(hwnd, QW_PARENT))
    1660           {
    1661             DrgFreeDraginfo(pDInfo);
    1662             return (MRFROM2SHORT(DOR_DROP, ((fCopyDefault) ? DO_COPY : DO_MOVE)));
    1663           }
    1664         }
    1665         DrgFreeDraginfo(pDInfo);
     1657        pDItem = DrgQueryDragitemPtr(pDInfo,0);
     1658        /* Check valid rendering mechanisms and data */
     1659        if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) {
     1660          DrgFreeDraginfo(pDInfo);
     1661          return (MRFROM2SHORT(DOR_DROP, DO_LINK));     /* OK to drop */
     1662        }
     1663        else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) {
     1664          if (WinQueryWindow(pDInfo->hwndSource, QW_PARENT) !=
     1665              WinQueryWindow(hwnd, QW_PARENT))
     1666          {
     1667            DrgFreeDraginfo(pDInfo);
     1668            return (MRFROM2SHORT(DOR_DROP, ((fCopyDefault) ? DO_COPY : DO_MOVE)));
     1669          }
     1670        }
     1671        DrgFreeDraginfo(pDInfo);
    16661672      }
    16671673    }
     
    16751681    {
    16761682      PDRAGINFO pDInfo = (PDRAGINFO) mp1;
    1677       PDRAGITEM pDItem;         /* Pointer to DRAGITEM */
     1683      PDRAGITEM pDItem;         /* Pointer to DRAGITEM */
    16781684      ULONG numitems, curitem, len;
    16791685      USHORT action;
    16801686      CHAR szFrom[CCHMAXPATH + 2], szDir[CCHMAXPATH + 1],
    1681         szTemp[CCHMAXPATH + 2];
     1687        szTemp[CCHMAXPATH + 2];
    16821688      FILESTATUS3 fsa;
    16831689      INIREC inirec;
    16841690
    16851691      if (!DrgAccessDraginfo(pDInfo)) {
    1686         Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    1687                   "DrgAccessDraginfo");
    1688         return 0;
     1692        Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     1693                  "DrgAccessDraginfo");
     1694        return 0;
    16891695      }
    16901696      numitems = DrgQueryDragitemCount(pDInfo);
    16911697      for (curitem = 0; curitem < numitems; curitem++) {
    1692         pDItem = DrgQueryDragitemPtr(pDInfo, curitem);
    1693         if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) {
    1694           if (pDItem->fsControl & DC_PREPARE)
    1695             DrgSendTransferMsg(pDItem->hwndItem,
    1696                                DM_ENDCONVERSATION,
    1697                                MPFROMLONG(pDItem->ulItemID),
    1698                                MPFROMLONG(DMFL_TARGETFAIL));
    1699           else {
    1700             if (FullDrgName(pDItem, szFrom, sizeof(szFrom)) &&
    1701                 !DosQueryPathInfo(szFrom, FIL_STANDARD, &fsa, sizeof(fsa)))
    1702               WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,
    1703                         MPFROM2SHORT(IDM_COMPARE, 0), MPFROMP(szFrom));
    1704             DrgSendTransferMsg(pDItem->hwndItem,
    1705                                DM_ENDCONVERSATION,
    1706                                MPFROMLONG(pDItem->ulItemID),
    1707                                MPFROMLONG(DMFL_TARGETFAIL));
    1708           }
    1709         }
    1710         else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) {
    1711           *szDir = *szFrom = *szTemp = 0;
    1712           len = DrgQueryStrName(pDItem->hstrContainerName, CCHMAXPATH, szDir);
    1713           szDir[len] = 0;
    1714           len = DrgQueryStrName(pDItem->hstrSourceName, CCHMAXPATH, szFrom);
    1715           szFrom[len] = 0;
    1716           len = DrgQueryStrName(pDItem->hstrTargetName, CCHMAXPATH, szTemp);
    1717           szTemp[len] = 0;
    1718           switch (pDInfo->usOperation) {
    1719           case DO_MOVE:
    1720             action = IDM_MOVE;
    1721             break;
    1722           case DO_COPY:
    1723             action = IDM_COPY;
    1724             break;
    1725           default:
    1726             action = IDM_INFO;
    1727             break;
    1728           }
    1729           memset(&inirec, 0, sizeof(inirec));
    1730           inirec.size = sizeof(inirec);
    1731           strcpy(inirec.filename2, szDir);
    1732           strcpy(inirec.app, szFrom);
    1733           strcpy(inirec.key, szTemp);
    1734           inirec.action = action;
    1735           inirec.hwndSource = WinQueryWindow(pDInfo->hwndSource, QW_PARENT);
    1736           WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,
    1737                      MPFROM2SHORT(action, 0), MPFROMP(&inirec));
    1738           DrgSendTransferMsg(pDItem->hwndItem,
    1739                              DM_ENDCONVERSATION,
    1740                              MPFROMLONG(pDItem->ulItemID),
    1741                              MPFROMLONG(DMFL_TARGETFAIL));
    1742         }
     1698        pDItem = DrgQueryDragitemPtr(pDInfo, curitem);
     1699        if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) {
     1700          if (pDItem->fsControl & DC_PREPARE)
     1701            DrgSendTransferMsg(pDItem->hwndItem,
     1702                               DM_ENDCONVERSATION,
     1703                               MPFROMLONG(pDItem->ulItemID),
     1704                               MPFROMLONG(DMFL_TARGETFAIL));
     1705          else {
     1706            if (FullDrgName(pDItem, szFrom, sizeof(szFrom)) &&
     1707                !DosQueryPathInfo(szFrom, FIL_STANDARD, &fsa, sizeof(fsa)))
     1708              WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,
     1709                        MPFROM2SHORT(IDM_COMPARE, 0), MPFROMP(szFrom));
     1710            DrgSendTransferMsg(pDItem->hwndItem,
     1711                               DM_ENDCONVERSATION,
     1712                               MPFROMLONG(pDItem->ulItemID),
     1713                               MPFROMLONG(DMFL_TARGETFAIL));
     1714          }
     1715        }
     1716        else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) {
     1717          *szDir = *szFrom = *szTemp = 0;
     1718          len = DrgQueryStrName(pDItem->hstrContainerName, CCHMAXPATH, szDir);
     1719          szDir[len] = 0;
     1720          len = DrgQueryStrName(pDItem->hstrSourceName, CCHMAXPATH, szFrom);
     1721          szFrom[len] = 0;
     1722          len = DrgQueryStrName(pDItem->hstrTargetName, CCHMAXPATH, szTemp);
     1723          szTemp[len] = 0;
     1724          switch (pDInfo->usOperation) {
     1725          case DO_MOVE:
     1726            action = IDM_MOVE;
     1727            break;
     1728          case DO_COPY:
     1729            action = IDM_COPY;
     1730            break;
     1731          default:
     1732            action = IDM_INFO;
     1733            break;
     1734          }
     1735          memset(&inirec, 0, sizeof(inirec));
     1736          inirec.size = sizeof(inirec);
     1737          strcpy(inirec.filename2, szDir);
     1738          strcpy(inirec.app, szFrom);
     1739          strcpy(inirec.key, szTemp);
     1740          inirec.action = action;
     1741          inirec.hwndSource = WinQueryWindow(pDInfo->hwndSource, QW_PARENT);
     1742          WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,
     1743                     MPFROM2SHORT(action, 0), MPFROMP(&inirec));
     1744          DrgSendTransferMsg(pDItem->hwndItem,
     1745                             DM_ENDCONVERSATION,
     1746                             MPFROMLONG(pDItem->ulItemID),
     1747                             MPFROMLONG(DMFL_TARGETFAIL));
     1748        }
    17431749      } // for
    17441750      FreeDragInfoData(hwnd, pDInfo);
     
    17891795    inidata->currid = INI_APPLIST;
    17901796    inidata->hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1791                                         FID_MENU);
     1797                                        FID_MENU);
    17921798    inidata->hwndIni = hwnd;
    17931799    WinSetWindowPtr(hwnd, QWL_USER, (PVOID) inidata);
     
    17951801
    17961802    if (!WinCreateWindow
    1797         (hwnd, WC_LISTBOX, (PSZ) NULL,
    1798         WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,
    1799         HWND_TOP, INI_APPLIST, NULL, NULL)) {
     1803        (hwnd, WC_LISTBOX, (PSZ) NULL,
     1804        WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,
     1805        HWND_TOP, INI_APPLIST, NULL, NULL)) {
    18001806      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18011807    }
    18021808    if (!WinCreateWindow
    1803         (hwnd, WC_LISTBOX, (PSZ) NULL,
    1804         WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,
    1805         HWND_TOP, INI_KEYLIST, NULL, NULL)) {
     1809        (hwnd, WC_LISTBOX, (PSZ) NULL,
     1810        WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,
     1811        HWND_TOP, INI_KEYLIST, NULL, NULL)) {
    18061812      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18071813    }
    18081814    if (!WinCreateWindow
    1809         (hwnd, WC_LISTBOX, (PSZ) NULL,
    1810         WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,
    1811         HWND_TOP, INI_DATALIST, NULL, NULL)) {
     1815        (hwnd, WC_LISTBOX, (PSZ) NULL,
     1816        WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,
     1817        HWND_TOP, INI_DATALIST, NULL, NULL)) {
    18121818      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18131819    }
    18141820    if (!WinCreateWindow(hwnd, WC_STATIC, (PSZ) NULL, WS_VISIBLE | SS_TEXT |
    1815                         DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,
    1816                         INI_NUMAPPS, NULL, NULL)) {
     1821                        DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,
     1822                        INI_NUMAPPS, NULL, NULL)) {
    18171823      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18181824    }
    18191825    if (!WinCreateWindow(hwnd, WC_STATIC, (PSZ) NULL, WS_VISIBLE | SS_TEXT |
    1820                         DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,
    1821                         INI_NUMKEYS, NULL, NULL)) {
     1826                        DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,
     1827                        INI_NUMKEYS, NULL, NULL)) {
    18221828      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18231829    }
    18241830    if (!WinCreateWindow(hwnd, WC_STATIC, (PSZ) NULL, WS_VISIBLE | SS_TEXT |
    1825                         DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,
    1826                         INI_NUMDATA, NULL, NULL)) {
     1831                        DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,
     1832                        INI_NUMDATA, NULL, NULL)) {
    18271833      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18281834    }
    18291835    if (!WinCreateWindow(hwnd,
    1830                         WC_STATIC,
    1831                         GetPString(IDS_APPLICATIONSTITLETEXT),
    1832                         WS_VISIBLE | SS_TEXT |
    1833                         DT_CENTER | DT_VCENTER,
    1834                         0,
    1835                         0, 0, 0, hwnd, HWND_TOP, INI_APPHDR, NULL, NULL)) {
     1836                        WC_STATIC,
     1837                        GetPString(IDS_APPLICATIONSTITLETEXT),
     1838                        WS_VISIBLE | SS_TEXT |
     1839                        DT_CENTER | DT_VCENTER,
     1840                        0,
     1841                        0, 0, 0, hwnd, HWND_TOP, INI_APPHDR, NULL, NULL)) {
    18361842      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18371843    }
    18381844    if (!WinCreateWindow(hwnd,
    1839                         WC_STATIC,
    1840                         GetPString(IDS_KEYWORDSTITLETEXT),
    1841                         WS_VISIBLE | SS_TEXT |
    1842                         DT_CENTER | DT_VCENTER,
    1843                         0,
    1844                         0, 0, 0, hwnd, HWND_TOP, INI_KEYHDR, NULL, NULL)) {
     1845                        WC_STATIC,
     1846                        GetPString(IDS_KEYWORDSTITLETEXT),
     1847                        WS_VISIBLE | SS_TEXT |
     1848                        DT_CENTER | DT_VCENTER,
     1849                        0,
     1850                        0, 0, 0, hwnd, HWND_TOP, INI_KEYHDR, NULL, NULL)) {
    18451851      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18461852    }
    18471853    if (!WinCreateWindow(hwnd,
    1848                         WC_STATIC,
    1849                         GetPString(IDS_DATABYTESTITLETEXT),
    1850                         WS_VISIBLE | SS_TEXT |
    1851                         DT_CENTER | DT_VCENTER,
    1852                         0,
    1853                         0, 0, 0, hwnd, HWND_TOP, INI_DATAHDR, NULL, NULL)) {
     1854                        WC_STATIC,
     1855                        GetPString(IDS_DATABYTESTITLETEXT),
     1856                        WS_VISIBLE | SS_TEXT |
     1857                        DT_CENTER | DT_VCENTER,
     1858                        0,
     1859                        0, 0, 0, hwnd, HWND_TOP, INI_DATAHDR, NULL, NULL)) {
    18541860      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    18551861    }
     
    18601866
    18611867    oldproc = WinSubclassWindow(WinWindowFromID(hwnd, INI_APPLIST),
    1862                                 IniLBSubProc);
     1868                                IniLBSubProc);
    18631869    WinSetWindowPtr(WinWindowFromID(hwnd, INI_APPLIST),
    1864                     QWL_USER, (PVOID) oldproc);
     1870                    QWL_USER, (PVOID) oldproc);
    18651871    oldproc = WinSubclassWindow(WinWindowFromID(hwnd, INI_KEYLIST),
    1866                                 IniLBSubProc);
     1872                                IniLBSubProc);
    18671873    WinSetWindowPtr(WinWindowFromID(hwnd, INI_KEYLIST),
    1868                     QWL_USER, (PVOID) oldproc);
     1874                    QWL_USER, (PVOID) oldproc);
    18691875    oldproc = WinSubclassWindow(WinWindowFromID(hwnd, INI_DATALIST),
    1870                                 IniLBSubProc2);
     1876                                IniLBSubProc2);
    18711877    WinSetWindowPtr(WinWindowFromID(hwnd, INI_DATALIST),
    1872                     QWL_USER, (PVOID) oldproc);
     1878                    QWL_USER, (PVOID) oldproc);
    18731879    break;
    18741880
     
    18771883    if (mp2) {
    18781884      if (hwndMain && fAutoView)
    1879         PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
     1885        PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
    18801886      inidata = INSTDATA(hwnd);
    18811887      if (!inidata)
    1882         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     1888        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    18831889      else if (hwndStatus) {
    1884         if (*inidata->ininame) {
    1885           WinSetWindowText(hwndStatus, GetPString(IDS_INTERNALINIVIEWERTEXT));
    1886           if (hwndStatus2)
    1887             WinSetWindowText(hwndStatus2, inidata->ininame);
    1888         }
    1889         else
    1890           PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     1890        if (*inidata->ininame) {
     1891          WinSetWindowText(hwndStatus, GetPString(IDS_INTERNALINIVIEWERTEXT));
     1892          if (hwndStatus2)
     1893            WinSetWindowText(hwndStatus2, inidata->ininame);
     1894        }
     1895        else
     1896          PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    18911897      }
    18921898    }
     
    19011907  case UM_ACTION:
    19021908    SetPresParams(WinWindowFromID(hwnd, INI_APPHDR),
    1903                   &RGBGREY,
    1904                   &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
     1909                  &RGBGREY,
     1910                  &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
    19051911    SetPresParams(WinWindowFromID(hwnd, INI_KEYHDR),
    1906                   &RGBGREY,
    1907                   &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
     1912                  &RGBGREY,
     1913                  &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
    19081914    SetPresParams(WinWindowFromID(hwnd, INI_DATAHDR),
    1909                   &RGBGREY,
    1910                   &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
     1915                  &RGBGREY,
     1916                  &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
    19111917    SetPresParams(WinWindowFromID(hwnd, INI_NUMAPPS),
    1912                   &RGBGREY,
    1913                   &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
     1918                  &RGBGREY,
     1919                  &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
    19141920    SetPresParams(WinWindowFromID(hwnd, INI_NUMKEYS),
    1915                   &RGBGREY,
    1916                   &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
     1921                  &RGBGREY,
     1922                  &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
    19171923    SetPresParams(WinWindowFromID(hwnd, INI_NUMDATA),
    1918                   &RGBGREY,
    1919                   &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
     1924                  &RGBGREY,
     1925                  &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));
    19201926    if (!WinSetPresParam(WinWindowFromID(hwnd, INI_DATALIST),
    1921                         PP_FONTNAMESIZE,
    1922                         (ULONG) strlen(GetPString(IDS_5SYSTEMVIOTEXT)) + 1,
    1923                         (PVOID) GetPString(IDS_5SYSTEMVIOTEXT)))
     1927                        PP_FONTNAMESIZE,
     1928                        (ULONG) strlen(GetPString(IDS_5SYSTEMVIOTEXT)) + 1,
     1929                        (PVOID) GetPString(IDS_5SYSTEMVIOTEXT)))
    19241930      WinSetPresParam(WinWindowFromID(hwnd, INI_DATALIST),
    1925                       PP_FONTNAMESIZE,
    1926                       (ULONG) strlen(GetPString(IDS_10SYSTEMMONOTEXT)) + 1,
    1927                       (PVOID) GetPString(IDS_10SYSTEMMONOTEXT));
     1931                      PP_FONTNAMESIZE,
     1932                      (ULONG) strlen(GetPString(IDS_10SYSTEMMONOTEXT)) + 1,
     1933                      (PVOID) GetPString(IDS_10SYSTEMMONOTEXT));
    19281934    RestorePresParams(hwnd, "IniUtil");
    19291935    return 0;
     
    19421948      ULONG size;
    19431949      SHORT numitems = (SHORT)WinSendDlgItemMsg(hwnd,
    1944                                                 INI_APPLIST,
    1945                                                 LM_QUERYITEMCOUNT,
    1946                                                 MPVOID, MPVOID);
     1950                                                INI_APPLIST,
     1951                                                LM_QUERYITEMCOUNT,
     1952                                                MPVOID, MPVOID);
    19471953      if (!numitems) {
    1948         PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
    1949         return 0;
     1954        PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
     1955        return 0;
    19501956      }
    19511957      size = 0;
    19521958      if (PrfQueryProfileSize(inidata->hini,
    1953                               (CHAR *)mp1, NULL, (PULONG) & size) && size)
    1954         inprofile = TRUE;
     1959                              (CHAR *)mp1, NULL, (PULONG) & size) && size)
     1960        inprofile = TRUE;
    19551961      else
    1956         inprofile = FALSE;
     1962        inprofile = FALSE;
    19571963      sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    1958                                           INI_APPLIST,
    1959                                           LM_SEARCHSTRING,
    1960                                           MPFROM2SHORT(LSS_CASESENSITIVE,
    1961                                                        LIT_FIRST),
    1962                                           MPFROMP((CHAR *)mp1));
     1964                                          INI_APPLIST,
     1965                                          LM_SEARCHSTRING,
     1966                                          MPFROM2SHORT(LSS_CASESENSITIVE,
     1967                                                       LIT_FIRST),
     1968                                          MPFROMP((CHAR *)mp1));
    19631969      if (sSelect >= 0) {
    1964         if (!inprofile)
    1965           WinSendDlgItemMsg(hwnd,
    1966                             INI_APPLIST,
    1967                             LM_DELETEITEM, MPFROMSHORT(sSelect), MPVOID);
    1968         else if (!strcmp(inidata->applname, (CHAR *)mp1))
    1969           PostMsg(hwnd,
    1970                   WM_CONTROL,
    1971                   MPFROM2SHORT(INI_APPLIST, LN_SELECT),
    1972                   MPFROMLONG(WinWindowFromID(hwnd, INI_APPLIST)));
     1970        if (!inprofile)
     1971          WinSendDlgItemMsg(hwnd,
     1972                            INI_APPLIST,
     1973                            LM_DELETEITEM, MPFROMSHORT(sSelect), MPVOID);
     1974        else if (!strcmp(inidata->applname, (CHAR *)mp1))
     1975          PostMsg(hwnd,
     1976                  WM_CONTROL,
     1977                  MPFROM2SHORT(INI_APPLIST, LN_SELECT),
     1978                  MPFROMLONG(WinWindowFromID(hwnd, INI_APPLIST)));
    19731979      }
    19741980      else if (inprofile)
    1975         WinSendDlgItemMsg(hwnd,
    1976                           INI_APPLIST,
    1977                           LM_INSERTITEM,
    1978                           MPFROM2SHORT(LIT_SORTASCENDING, 0),
    1979                           MPFROMP((CHAR *)mp1));
     1981        WinSendDlgItemMsg(hwnd,
     1982                          INI_APPLIST,
     1983                          LM_INSERTITEM,
     1984                          MPFROM2SHORT(LIT_SORTASCENDING, 0),
     1985                          MPFROMP((CHAR *)mp1));
    19801986      if (mp2 && inidata->applname) {
    1981         if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST),
    1982                           inidata->hini, inidata->applname))
    1983           PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
     1987        if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST),
     1988                          inidata->hini, inidata->applname))
     1989          PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
    19841990      }
    19851991    }
    19861992    return 0;
    19871993
    1988   case UM_INITIALSIZE:                  /* kludge */
     1994  case UM_INITIALSIZE:                  /* kludge */
    19891995    inidata = INSTDATA(hwnd);
    19901996    if (!inidata)
     
    20002006
    20012007      WinSetWindowPos(WinWindowFromID(hwnd, INI_APPHDR), HWND_TOP,
    2002                       2, cy - 22, (cx / 4) - 4, 20, SWP_MOVE | SWP_SIZE);
     2008                      2, cy - 22, (cx / 4) - 4, 20, SWP_MOVE | SWP_SIZE);
    20032009      WinSetWindowPos(WinWindowFromID(hwnd, INI_NUMAPPS), HWND_TOP,
    2004                       (cx / 4) + 2, cy - 22, (cx / 4) - 4, 20,
    2005                       SWP_MOVE | SWP_SIZE);
     2010                      (cx / 4) + 2, cy - 22, (cx / 4) - 4, 20,
     2011                      SWP_MOVE | SWP_SIZE);
    20062012      WinSetWindowPos(WinWindowFromID(hwnd, INI_APPLIST), HWND_TOP,
    2007                       2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28,
    2008                       SWP_MOVE | SWP_SIZE);
     2013                      2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28,
     2014                      SWP_MOVE | SWP_SIZE);
    20092015      WinSetWindowPos(WinWindowFromID(hwnd, INI_KEYHDR), HWND_TOP,
    2010                       (cx / 2) + 2, cy - 22, (cx / 4) - 4, 20,
    2011                       SWP_MOVE | SWP_SIZE);
     2016                      (cx / 2) + 2, cy - 22, (cx / 4) - 4, 20,
     2017                      SWP_MOVE | SWP_SIZE);
    20122018      WinSetWindowPos(WinWindowFromID(hwnd, INI_NUMKEYS), HWND_TOP,
    2013                       (cx - (cx / 4)) + 2, cy - 22, (cx / 4) - 4, 20,
    2014                       SWP_MOVE | SWP_SIZE);
     2019                      (cx - (cx / 4)) + 2, cy - 22, (cx / 4) - 4, 20,
     2020                      SWP_MOVE | SWP_SIZE);
    20152021      WinSetWindowPos(WinWindowFromID(hwnd, INI_KEYLIST), HWND_TOP,
    2016                       (cx / 2) + 2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28,
    2017                       SWP_MOVE | SWP_SIZE);
     2022                      (cx / 2) + 2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28,
     2023                      SWP_MOVE | SWP_SIZE);
    20182024      WinSetWindowPos(WinWindowFromID(hwnd, INI_DATAHDR), HWND_TOP,
    2019                       2, (cy / 2) - 22, (cx / 2) - 4, 20,
    2020                       SWP_MOVE | SWP_SIZE);
     2025                      2, (cy / 2) - 22, (cx / 2) - 4, 20,
     2026                      SWP_MOVE | SWP_SIZE);
    20212027      WinSetWindowPos(WinWindowFromID(hwnd, INI_NUMDATA), HWND_TOP,
    2022                       (cx / 2) + 2, (cy / 2) - 22, (cx / 2) - 4, 20,
    2023                       SWP_MOVE | SWP_SIZE);
     2028                      (cx / 2) + 2, (cy / 2) - 22, (cx / 2) - 4, 20,
     2029                      SWP_MOVE | SWP_SIZE);
    20242030      WinSetWindowPos(WinWindowFromID(hwnd, INI_DATALIST), HWND_TOP,
    2025                       2, 2, cx - 4, (cy / 2) - 28, SWP_MOVE | SWP_SIZE);
     2031                      2, 2, cx - 4, (cy / 2) - 28, SWP_MOVE | SWP_SIZE);
    20262032    }
    20272033    break;
     
    20342040    else {
    20352041      if (mp1) {
    2036         strcpy(inidata->ininame, (CHAR *)mp1);
    2037         inidata->hini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),
    2038                                        inidata->ininame);
    2039         free(mp1);
     2042        strcpy(inidata->ininame, (CHAR *)mp1);
     2043        inidata->hini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),
     2044                                       inidata->ininame);
     2045        free(mp1);
    20402046      }
    20412047      else
    2042         inidata->hini = HINI_USERPROFILE;
     2048        inidata->hini = HINI_USERPROFILE;
    20432049      if (inidata->hini == NULLHANDLE) {
    2044         Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    2045                   "PrfOpenProfile failed for %s", inidata->ininame);
     2050        Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     2051                  "PrfOpenProfile failed for %s", inidata->ininame);
    20462052      }
    20472053      else {
    2048         WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    2049         WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2050         WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
    2051                         HWND_TOP,
    2052                         0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
    2053         EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
    2054         return 0;
     2054        WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     2055        WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2056        WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),
     2057                        HWND_TOP,
     2058                        0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);
     2059        EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
     2060        return 0;
    20552061      }
    20562062    }
     
    20692075      hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
    20702076      if (hps) {
    2071         WinQueryWindowRect(hwnd, &rcl);
    2072         WinFillRect(hps, &rcl, CLR_PALEGRAY);
    2073         WinEndPaint(hps);
    2074         /*
    2075         * tell status window to paint its box
    2076         */
    2077         PaintRecessedWindow(WinWindowFromID(hwnd, INI_APPHDR),
    2078                             (HPS) 0, FALSE, FALSE);
    2079         PaintRecessedWindow(WinWindowFromID(hwnd, INI_KEYHDR),
    2080                             (HPS) 0, FALSE, FALSE);
    2081         PaintRecessedWindow(WinWindowFromID(hwnd, INI_DATAHDR),
    2082                             (HPS) 0, FALSE, FALSE);
    2083         PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMAPPS),
    2084                             (HPS) 0, FALSE, FALSE);
    2085         PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMKEYS),
    2086                             (HPS) 0, FALSE, FALSE);
    2087         PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMDATA),
    2088                             (HPS) 0, FALSE, FALSE);
    2089         inidata = INSTDATA(hwnd);
    2090         if (!inidata)
    2091           Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    2092         else if (inidata->hwndCurrent)
    2093           BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_RED);
     2077        WinQueryWindowRect(hwnd, &rcl);
     2078        WinFillRect(hps, &rcl, CLR_PALEGRAY);
     2079        WinEndPaint(hps);
     2080        /*
     2081        * tell status window to paint its box
     2082        */
     2083        PaintRecessedWindow(WinWindowFromID(hwnd, INI_APPHDR),
     2084                            (HPS) 0, FALSE, FALSE);
     2085        PaintRecessedWindow(WinWindowFromID(hwnd, INI_KEYHDR),
     2086                            (HPS) 0, FALSE, FALSE);
     2087        PaintRecessedWindow(WinWindowFromID(hwnd, INI_DATAHDR),
     2088                            (HPS) 0, FALSE, FALSE);
     2089        PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMAPPS),
     2090                            (HPS) 0, FALSE, FALSE);
     2091        PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMKEYS),
     2092                            (HPS) 0, FALSE, FALSE);
     2093        PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMDATA),
     2094                            (HPS) 0, FALSE, FALSE);
     2095        inidata = INSTDATA(hwnd);
     2096        if (!inidata)
     2097          Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2098        else if (inidata->hwndCurrent)
     2099          BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_RED);
    20942100      }
    20952101    }
     
    21032109      switch (SHORT2FROMMP(mp1)) {
    21042110      case LN_SETFOCUS:
    2105         inidata = INSTDATA(hwnd);
    2106         if (!inidata)
    2107           Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    2108         else {
    2109           if (inidata->hwndCurrent)
    2110             BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_PALEGRAY);
    2111           inidata->hwndCurrent = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
    2112           BoxWindow(WinWindowFromID(hwnd,
    2113                                     SHORT1FROMMP(mp1)), (HPS) 0, CLR_RED);
    2114         }
    2115         break;
     2111        inidata = INSTDATA(hwnd);
     2112        if (!inidata)
     2113          Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2114        else {
     2115          if (inidata->hwndCurrent)
     2116            BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_PALEGRAY);
     2117          inidata->hwndCurrent = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
     2118          BoxWindow(WinWindowFromID(hwnd,
     2119                                    SHORT1FROMMP(mp1)), (HPS) 0, CLR_RED);
     2120        }
     2121        break;
    21162122
    21172123      case LN_ENTER:
    21182124      case LN_SELECT:
    2119         {
    2120           CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH];
    2121           SHORT sSelect;
    2122 
    2123           if (SHORT1FROMMP(mp1) == INI_DATALIST)
    2124             break;
    2125 
    2126           inidata = INSTDATA(hwnd);
    2127           if (!inidata || !inidata->hini) {
    2128             Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    2129             break;
    2130           }
    2131           WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2132           inidata->keyindex = inidata->appindex = 0;
    2133           *applname = *keyname = *inidata->applname = *inidata->keyname = 0;
    2134           sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
    2135                                               INI_APPLIST,
    2136                                               LM_QUERYSELECTION,
    2137                                               MPFROM2SHORT(LIT_FIRST, 0),
    2138                                               MPVOID);
    2139           if (sSelect < 0)
    2140             break;
    2141           inidata->appindex = sSelect;
    2142           WinSendDlgItemMsg(hwnd,
    2143                             INI_APPLIST,
    2144                             LM_QUERYITEMTEXT,
    2145                             MPFROM2SHORT(sSelect, CCHMAXPATH - 1),
    2146                             MPFROMP(applname));
    2147           if (SHORT1FROMMP(mp1) == INI_APPLIST) {
    2148             if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST),
    2149                               inidata->hini, applname))
    2150               PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
    2151           }
    2152           else {
    2153             sSelect = (SHORT) WinSendDlgItemMsg(hwnd, INI_KEYLIST,
    2154                                                 LM_QUERYSELECTION,
    2155                                                 MPFROM2SHORT(LIT_FIRST, 0),
    2156                                                 MPVOID);
    2157             if (sSelect < 0)
    2158               break;
    2159             inidata->keyindex = sSelect;
    2160             WinSendDlgItemMsg(hwnd,
    2161                               INI_KEYLIST,
    2162                               LM_QUERYITEMTEXT,
    2163                               MPFROM2SHORT(sSelect, CCHMAXPATH - 1),
    2164                               MPFROMP(keyname));
    2165             if (!*keyname || !*applname)
    2166               break;
    2167             strcpy(inidata->keyname, keyname);
    2168             strcpy(inidata->applname, applname);
    2169             xfree(inidata->data, pszSrcFile, __LINE__);
    2170             inidata->data = GetKeyData(WinWindowFromID(hwnd,
    2171                                                        INI_DATALIST),
    2172                                        inidata->hini,
    2173                                        applname, keyname, &inidata->datalen);
    2174             if (!inidata->data)
    2175               PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
    2176           }
    2177         }
    2178         break;
     2125        {
     2126          CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH];
     2127          SHORT sSelect;
     2128
     2129          if (SHORT1FROMMP(mp1) == INI_DATALIST)
     2130            break;
     2131
     2132          inidata = INSTDATA(hwnd);
     2133          if (!inidata || !inidata->hini) {
     2134            Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2135            break;
     2136          }
     2137          WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2138          inidata->keyindex = inidata->appindex = 0;
     2139          *applname = *keyname = *inidata->applname = *inidata->keyname = 0;
     2140          sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
     2141                                              INI_APPLIST,
     2142                                              LM_QUERYSELECTION,
     2143                                              MPFROM2SHORT(LIT_FIRST, 0),
     2144                                              MPVOID);
     2145          if (sSelect < 0)
     2146            break;
     2147          inidata->appindex = sSelect;
     2148          WinSendDlgItemMsg(hwnd,
     2149                            INI_APPLIST,
     2150                            LM_QUERYITEMTEXT,
     2151                            MPFROM2SHORT(sSelect, CCHMAXPATH - 1),
     2152                            MPFROMP(applname));
     2153          if (SHORT1FROMMP(mp1) == INI_APPLIST) {
     2154            if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST),
     2155                              inidata->hini, applname))
     2156              PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
     2157          }
     2158          else {
     2159            sSelect = (SHORT) WinSendDlgItemMsg(hwnd, INI_KEYLIST,
     2160                                                LM_QUERYSELECTION,
     2161                                                MPFROM2SHORT(LIT_FIRST, 0),
     2162                                                MPVOID);
     2163            if (sSelect < 0)
     2164              break;
     2165            inidata->keyindex = sSelect;
     2166            WinSendDlgItemMsg(hwnd,
     2167                              INI_KEYLIST,
     2168                              LM_QUERYITEMTEXT,
     2169                              MPFROM2SHORT(sSelect, CCHMAXPATH - 1),
     2170                              MPFROMP(keyname));
     2171            if (!*keyname || !*applname)
     2172              break;
     2173            strcpy(inidata->keyname, keyname);
     2174            strcpy(inidata->applname, applname);
     2175            xfree(inidata->data, pszSrcFile, __LINE__);
     2176            inidata->data = GetKeyData(WinWindowFromID(hwnd,
     2177                                                       INI_DATALIST),
     2178                                       inidata->hini,
     2179                                       applname, keyname, &inidata->datalen);
     2180            if (!inidata->data)
     2181              PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);
     2182          }
     2183        }
     2184        break;
    21792185      }
    21802186      break;
     
    21882194
    21892195      num = (SHORT) WinSendDlgItemMsg(hwnd,
    2190                                       INI_APPLIST,
    2191                                       LM_QUERYITEMCOUNT, MPVOID, MPVOID);
     2196                                      INI_APPLIST,
     2197                                      LM_QUERYITEMCOUNT, MPVOID, MPVOID);
    21922198      sprintf(s, "%u", num);
    21932199      WinSetDlgItemText(hwnd, INI_NUMAPPS, s);
    21942200      num = (SHORT) WinSendDlgItemMsg(hwnd,
    2195                                       INI_KEYLIST,
    2196                                       LM_QUERYITEMCOUNT, MPVOID, MPVOID);
     2201                                      INI_KEYLIST,
     2202                                      LM_QUERYITEMCOUNT, MPVOID, MPVOID);
    21972203      sprintf(s, "%u", num);
    21982204      WinSetDlgItemText(hwnd, INI_NUMKEYS, s);
    21992205      WinSetDlgItemText(hwnd, INI_NUMDATA, "0");
    22002206      WinSendDlgItemMsg(hwnd, INI_DATALIST, LM_DELETEALL, MPVOID, MPVOID);
    2201       // inidata = WinQueryWindowPtr(hwnd, QWL_USER);   // 09 Jan 08 SHL
     2207      // inidata = WinQueryWindowPtr(hwnd, QWL_USER);   // 09 Jan 08 SHL
    22022208    }
    22032209    return 0;
     
    22182224      prfp.pszSysName = (PSZ) sysini;
    22192225      if (PrfQueryProfile(WinQueryAnchorBlock(hwnd), &prfp)) {
    2220         if (inidata->hini == HINI_SYSTEMPROFILE)
    2221           strcpy(inidata->ininame, sysini);
    2222         else if (inidata->hini == HINI_USERPROFILE)
    2223           strcpy(inidata->ininame, userini);
    2224         sprintf(sysini, GetPString(IDS_INITITLETEXT), inidata->ininame);
    2225         WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), sysini);
    2226         if (WinQueryWindow(hwnd, QW_PARENT) ==
    2227             WinQueryActiveWindow(WinQueryWindow
    2228                                 (WinQueryWindow(hwnd, QW_PARENT),
    2229                                   QW_PARENT))) {
    2230           if (hwndStatus)
    2231             WinSetWindowText(hwndStatus,
    2232                              GetPString(IDS_INTERNALINIVIEWERTEXT));
    2233           if (hwndStatus2)
    2234             WinSetWindowText(hwndStatus2, inidata->ininame);
    2235         }
     2226        if (inidata->hini == HINI_SYSTEMPROFILE)
     2227          strcpy(inidata->ininame, sysini);
     2228        else if (inidata->hini == HINI_USERPROFILE)
     2229          strcpy(inidata->ininame, userini);
     2230        sprintf(sysini, GetPString(IDS_INITITLETEXT), inidata->ininame);
     2231        WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), sysini);
     2232        if (WinQueryWindow(hwnd, QW_PARENT) ==
     2233            WinQueryActiveWindow(WinQueryWindow
     2234                                (WinQueryWindow(hwnd, QW_PARENT),
     2235                                  QW_PARENT))) {
     2236          if (hwndStatus)
     2237            WinSetWindowText(hwndStatus,
     2238                             GetPString(IDS_INTERNALINIVIEWERTEXT));
     2239          if (hwndStatus2)
     2240            WinSetWindowText(hwndStatus2, inidata->ininame);
     2241        }
    22362242      }
    22372243      else
    2238         WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT),
    2239                         GetPString(IDS_INIQUERYPRFFAILEDTEXT));
     2244        WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT),
     2245                        GetPString(IDS_INIQUERYPRFFAILEDTEXT));
    22402246      return 0;
    22412247    }
     
    22472253    if (!(SHORT1FROMMP(mp1) & KC_KEYUP)) {
    22482254      if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
    2249         switch (SHORT2FROMMP(mp2)) {
    2250         case VK_DELETE:
    2251           inidata = INSTDATA(hwnd);
    2252           if (!inidata)
    2253             Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    2254           else {
    2255             SHORT cmd = inidata->hwndCurrent &&
    2256                         WinQueryWindowUShort(inidata->hwndCurrent, QWS_ID) ==
    2257                         INI_APPLIST ?
    2258                         INI_DELETEAPP :INI_DELETEKEY;
    2259             PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
    2260           }
    2261           break;
    2262         }
     2255        switch (SHORT2FROMMP(mp2)) {
     2256        case VK_DELETE:
     2257          inidata = INSTDATA(hwnd);
     2258          if (!inidata)
     2259            Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2260          else {
     2261            SHORT cmd = inidata->hwndCurrent &&
     2262                        WinQueryWindowUShort(inidata->hwndCurrent, QWS_ID) ==
     2263                        INI_APPLIST ?
     2264                        INI_DELETEAPP :INI_DELETEKEY;
     2265            PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
     2266          }
     2267          break;
     2268        }
    22632269      }
    22642270    }
     
    22712277      inidata = INSTDATA(hwnd);
    22722278      if (!inidata)
    2273         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2279        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    22742280      else if (inidata->hwndCurrent) {
    2275         STRINGINPARMS sip;
    2276         static CHAR tofind[258] = "";
    2277         SHORT x, z;
    2278 
    2279         if (SHORT1FROMMP(mp1) == IDM_FINDFIRST || !*tofind) {
    2280           z = LIT_FIRST;
    2281           memset(&sip, 0, sizeof(sip));
    2282           sip.help = GetPString(IDS_INISEARCHHELPTEXT);
    2283           sip.prompt = GetPString(IDS_INISEARCHPROMPTTEXT);
    2284           sip.inputlen = 257;
    2285           sip.ret = tofind;
    2286           sip.title = GetPString(IDS_INISEARCHTITLETEXT);
    2287           if (WinDlgBox(HWND_DESKTOP,
    2288                         hwnd,
    2289                         InputDlgProc, FM3ModHandle, STR_FRAME, &sip)) {
    2290             rstrip(tofind);
    2291             if (!*tofind) {
    2292               DosBeep(50, 100);
    2293               break;
    2294             }
    2295           }
    2296           else
    2297             break;
    2298         }
    2299         else {
    2300           z = (SHORT) WinSendMsg(inidata->hwndCurrent,
    2301                                 LM_QUERYSELECTION,
    2302                                 MPFROM2SHORT(LIT_CURSOR, 0), MPVOID);
    2303           if (z < 0)
    2304             z = LIT_FIRST;
    2305         }
    2306         x = (SHORT) WinSendMsg(inidata->hwndCurrent,
    2307                                LM_SEARCHSTRING,
    2308                                MPFROM2SHORT(LSS_SUBSTRING, z),
    2309                                MPFROMP(tofind));
    2310         if (x >= 0 && x > z) {
    2311           WinSendMsg(inidata->hwndCurrent,
    2312                      LM_SETTOPINDEX, MPFROM2SHORT(x, 0), MPVOID);
    2313           WinSendMsg(inidata->hwndCurrent,
    2314                      LM_SELECTITEM,
    2315                      MPFROM2SHORT(x, 0), MPFROM2SHORT(TRUE, 0));
    2316         }
    2317         else
    2318           DosBeep(250, 100);
     2281        STRINGINPARMS sip;
     2282        static CHAR tofind[258] = "";
     2283        SHORT x, z;
     2284
     2285        if (SHORT1FROMMP(mp1) == IDM_FINDFIRST || !*tofind) {
     2286          z = LIT_FIRST;
     2287          memset(&sip, 0, sizeof(sip));
     2288          sip.help = GetPString(IDS_INISEARCHHELPTEXT);
     2289          sip.prompt = GetPString(IDS_INISEARCHPROMPTTEXT);
     2290          sip.inputlen = 257;
     2291          sip.ret = tofind;
     2292          sip.title = GetPString(IDS_INISEARCHTITLETEXT);
     2293          if (WinDlgBox(HWND_DESKTOP,
     2294                        hwnd,
     2295                        InputDlgProc, FM3ModHandle, STR_FRAME, &sip)) {
     2296            rstrip(tofind);
     2297            if (!*tofind) {
     2298              DosBeep(50, 100);
     2299              break;
     2300            }
     2301          }
     2302          else
     2303            break;
     2304        }
     2305        else {
     2306          z = (SHORT) WinSendMsg(inidata->hwndCurrent,
     2307                                LM_QUERYSELECTION,
     2308                                MPFROM2SHORT(LIT_CURSOR, 0), MPVOID);
     2309          if (z < 0)
     2310            z = LIT_FIRST;
     2311        }
     2312        x = (SHORT) WinSendMsg(inidata->hwndCurrent,
     2313                               LM_SEARCHSTRING,
     2314                               MPFROM2SHORT(LSS_SUBSTRING, z),
     2315                               MPFROMP(tofind));
     2316        if (x >= 0 && x > z) {
     2317          WinSendMsg(inidata->hwndCurrent,
     2318                     LM_SETTOPINDEX, MPFROM2SHORT(x, 0), MPVOID);
     2319          WinSendMsg(inidata->hwndCurrent,
     2320                     LM_SELECTITEM,
     2321                     MPFROM2SHORT(x, 0), MPFROM2SHORT(TRUE, 0));
     2322        }
     2323        else
     2324          DosBeep(250, 100);
    23192325      }
    23202326      break;
     
    23232329      inidata = INSTDATA(hwnd);
    23242330      if (!inidata)
    2325         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2331        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    23262332      else {
    2327         SHORT numitems = (SHORT)WinSendDlgItemMsg(hwnd,
    2328                                                   INI_APPLIST,
    2329                                                   LM_QUERYITEMCOUNT,
    2330                                                   MPVOID, MPVOID);
    2331         if (numitems)
    2332           WinDlgBox(HWND_DESKTOP,
    2333                     hwnd,
    2334                     FilterIniProc, FM3ModHandle, IAF_FRAME, (PVOID) inidata);
    2335         else
    2336           DosBeep(50, 100);
     2333        SHORT numitems = (SHORT)WinSendDlgItemMsg(hwnd,
     2334                                                  INI_APPLIST,
     2335                                                  LM_QUERYITEMCOUNT,
     2336                                                  MPVOID, MPVOID);
     2337        if (numitems)
     2338          WinDlgBox(HWND_DESKTOP,
     2339                    hwnd,
     2340                    FilterIniProc, FM3ModHandle, IAF_FRAME, (PVOID) inidata);
     2341        else
     2342          DosBeep(50, 100);
    23372343      }
    23382344      break;
     
    23432349      inidata = INSTDATA(hwnd);
    23442350      if (!inidata || !*inidata->ininame)
    2345         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2351        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    23462352      else if (mp2) {
    2347         INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__);
    2348         if (inirec) {
    2349           *inirec = *(INIREC *) mp2;
    2350           inirec->hwndDlg = hwnd;
    2351           inirec->confirm = inidata->confirm;
    2352           strcpy(inirec->filename1, inidata->ininame);
    2353           if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) {
    2354             Runtime_Error(pszSrcFile, __LINE__,
    2355                           GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2356             free(inirec);
    2357           }
    2358         }
     2353        INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__);
     2354        if (inirec) {
     2355          *inirec = *(INIREC *) mp2;
     2356          inirec->hwndDlg = hwnd;
     2357          inirec->confirm = inidata->confirm;
     2358          strcpy(inirec->filename1, inidata->ininame);
     2359          if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) {
     2360            Runtime_Error(pszSrcFile, __LINE__,
     2361                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
     2362            free(inirec);
     2363          }
     2364        }
    23592365      }
    23602366      break;
     
    23632369      inidata = INSTDATA(hwnd);
    23642370      if (!inidata || !*inidata->ininame)
    2365         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2371        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    23662372      else if (mp2) {
    2367         INIREC *inirec = xmalloc(sizeof(INIREC), pszSrcFile, __LINE__);
    2368         if (inirec) {
    2369           strcpy(inirec->filename2, (CHAR *)(mp2));
    2370           strcpy(inirec->filename1, inidata->ininame);
    2371           inirec->hwndDlg = hwnd;
    2372           if (_beginthread(CompareIniThread, NULL, 122880, (PVOID) inirec) ==
    2373               -1) {
    2374             Runtime_Error(pszSrcFile, __LINE__,
    2375                           GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2376             free(inirec);
    2377           }
    2378         }
     2373        INIREC *inirec = xmalloc(sizeof(INIREC), pszSrcFile, __LINE__);
     2374        if (inirec) {
     2375          strcpy(inirec->filename2, (CHAR *)(mp2));
     2376          strcpy(inirec->filename1, inidata->ininame);
     2377          inirec->hwndDlg = hwnd;
     2378          if (_beginthread(CompareIniThread, NULL, 122880, (PVOID) inirec) ==
     2379              -1) {
     2380            Runtime_Error(pszSrcFile, __LINE__,
     2381                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
     2382            free(inirec);
     2383          }
     2384        }
    23792385      }
    23802386      break;
     
    23862392      inidata = INSTDATA(hwnd);
    23872393      if (!inidata) {
    2388         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    2389         break;
     2394        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2395        break;
    23902396      }
    23912397      if (!*inidata->ininame ||
    2392           !*inidata->applname ||
    2393           (!*inidata->keyname &&
    2394            (SHORT1FROMMP(mp1) == INI_RENAMEKEY ||
    2395             SHORT1FROMMP(mp1) == INI_COPYKEY)))
    2396         break;
     2398          !*inidata->applname ||
     2399          (!*inidata->keyname &&
     2400           (SHORT1FROMMP(mp1) == INI_RENAMEKEY ||
     2401            SHORT1FROMMP(mp1) == INI_COPYKEY)))
     2402        break;
    23972403      {
    2398         INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__);
    2399         if (inirec) {
    2400           inirec->size = sizeof(INIREC);
    2401           inirec->hwndDlg = hwnd;
    2402           inirec->confirm = inidata->confirm;
    2403           inirec->action = (SHORT1FROMMP(mp1) == INI_COPYAPP ||
    2404                             SHORT1FROMMP(mp1) == INI_COPYKEY) ?
    2405             IDM_COPY : IDM_MOVE;
    2406           strcpy(inirec->filename1, inidata->ininame);
    2407           strcpy(inirec->filename2, inidata->ininame);
    2408           if (SHORT1FROMMP(mp1) == INI_COPYKEY ||
    2409               SHORT1FROMMP(mp1) == INI_RENAMEKEY)
    2410             strcpy(inirec->key, inidata->keyname);
    2411           strcpy(inirec->app, inidata->applname);
    2412           if (!WinDlgBox(HWND_DESKTOP,
    2413                         hwnd,
    2414                         IntraIniProc,
    2415                         FM3ModHandle, INII_FRAME, (PVOID) inirec)) {
    2416             free(inirec);
    2417             break;
    2418           }
    2419           if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) {
    2420             Runtime_Error(pszSrcFile, __LINE__,
    2421                           GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2422             free(inirec);
    2423           }
    2424         }
     2404        INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__);
     2405        if (inirec) {
     2406          inirec->size = sizeof(INIREC);
     2407          inirec->hwndDlg = hwnd;
     2408          inirec->confirm = inidata->confirm;
     2409          inirec->action = (SHORT1FROMMP(mp1) == INI_COPYAPP ||
     2410                            SHORT1FROMMP(mp1) == INI_COPYKEY) ?
     2411            IDM_COPY : IDM_MOVE;
     2412          strcpy(inirec->filename1, inidata->ininame);
     2413          strcpy(inirec->filename2, inidata->ininame);
     2414          if (SHORT1FROMMP(mp1) == INI_COPYKEY ||
     2415              SHORT1FROMMP(mp1) == INI_RENAMEKEY)
     2416            strcpy(inirec->key, inidata->keyname);
     2417          strcpy(inirec->app, inidata->applname);
     2418          if (!WinDlgBox(HWND_DESKTOP,
     2419                        hwnd,
     2420                        IntraIniProc,
     2421                        FM3ModHandle, INII_FRAME, (PVOID) inirec)) {
     2422            free(inirec);
     2423            break;
     2424          }
     2425          if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) {
     2426            Runtime_Error(pszSrcFile, __LINE__,
     2427                          GetPString(IDS_COULDNTSTARTTHREADTEXT));
     2428            free(inirec);
     2429          }
     2430        }
    24252431      }
    24262432      break;
     
    24292435      inidata = INSTDATA(hwnd);
    24302436      if (!inidata)
    2431         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2437        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    24322438      else if (*inidata->ininame) {
    2433         // 09 Jan 08 SHL fixme to complain
    2434         CHAR filename[CCHMAXPATH], *p;
    2435 
    2436         strcpy(filename, inidata->ininame);
    2437         p = filename;
    2438         while (*p) {
    2439           if (*p == '/')
    2440             *p = '\\';
    2441           p++;
    2442         }
    2443         p = strrchr(filename, '\\');
    2444         if (p) {
    2445           p++;
    2446           *p = 0;
    2447         }
    2448         else
    2449           *filename = 0;
    2450         strcat(filename, "*.INI");
    2451         if (export_filename(hwnd, filename, TRUE)) {
    2452 
    2453           PPRFPROFILE prfp;
    2454 
    2455           prfp = xmallocz(sizeof(PRFPROFILE), pszSrcFile, __LINE__);
    2456           if (prfp) {
    2457             prfp->pszUserName =
    2458               xstrdup(inidata->ininame, pszSrcFile, __LINE__);
    2459             if (!prfp->pszUserName)
    2460               free(prfp);
    2461             else {
    2462               prfp->cchUserName = strlen(prfp->pszUserName);
    2463               prfp->pszSysName = xstrdup(filename, pszSrcFile, __LINE__);
    2464               if (!prfp->pszSysName) {
    2465                 free(prfp->pszUserName);
    2466                 free(prfp);
    2467               }
    2468               else {
    2469                 prfp->cchSysName = strlen(prfp->pszSysName);
    2470                 if (_beginthread(BackupIniThread, NULL, 122880, (PVOID) prfp)
    2471                     == -1) {
    2472                   Runtime_Error(pszSrcFile, __LINE__,
    2473                                 GetPString(IDS_COULDNTSTARTTHREADTEXT));
    2474                   free(prfp->pszSysName);
    2475                   free(prfp->pszUserName);
    2476                   free(prfp);
    2477                 }
    2478                 else
    2479                   DosSleep(100); //05 Aug 07 GKY 250
    2480               }
    2481             }
    2482           }
    2483         }
     2439        // 09 Jan 08 SHL fixme to complain
     2440        CHAR filename[CCHMAXPATH], *p;
     2441
     2442        strcpy(filename, inidata->ininame);
     2443        p = filename;
     2444        while (*p) {
     2445          if (*p == '/')
     2446            *p = '\\';
     2447          p++;
     2448        }
     2449        p = strrchr(filename, '\\');
     2450        if (p) {
     2451          p++;
     2452          *p = 0;
     2453        }
     2454        else
     2455          *filename = 0;
     2456        strcat(filename, "*.INI");
     2457        if (export_filename(hwnd, filename, TRUE)) {
     2458
     2459          PPRFPROFILE prfp;
     2460
     2461          prfp = xmallocz(sizeof(PRFPROFILE), pszSrcFile, __LINE__);
     2462          if (prfp) {
     2463            prfp->pszUserName =
     2464              xstrdup(inidata->ininame, pszSrcFile, __LINE__);
     2465            if (!prfp->pszUserName)
     2466              free(prfp);
     2467            else {
     2468              prfp->cchUserName = strlen(prfp->pszUserName);
     2469              prfp->pszSysName = xstrdup(filename, pszSrcFile, __LINE__);
     2470              if (!prfp->pszSysName) {
     2471                free(prfp->pszUserName);
     2472                free(prfp);
     2473              }
     2474              else {
     2475                prfp->cchSysName = strlen(prfp->pszSysName);
     2476                if (_beginthread(BackupIniThread, NULL, 122880, (PVOID) prfp)
     2477                    == -1) {
     2478                  Runtime_Error(pszSrcFile, __LINE__,
     2479                                GetPString(IDS_COULDNTSTARTTHREADTEXT));
     2480                  free(prfp->pszSysName);
     2481                  free(prfp->pszUserName);
     2482                  free(prfp);
     2483                }
     2484                else
     2485                  DosSleep(100); //05 Aug 07 GKY 250
     2486              }
     2487            }
     2488          }
     2489        }
    24842490      }
    24852491      break;
     
    24882494      inidata = INSTDATA(hwnd);
    24892495      if (!inidata)
    2490         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2496        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    24912497      else {
    2492         if (WinDlgBox(HWND_DESKTOP,
    2493                       hwnd,
    2494                       ChangeIniProc,
    2495                       FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) {
    2496           WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    2497           WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2498           EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
    2499         }
     2498        if (WinDlgBox(HWND_DESKTOP,
     2499                      hwnd,
     2500                      ChangeIniProc,
     2501                      FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) {
     2502          WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     2503          WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2504          EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
     2505        }
    25002506      }
    25012507      break;
     
    25042510      inidata = INSTDATA(hwnd);
    25052511      if (!inidata)
    2506         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2512        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    25072513      else {
    2508         if (WinDlgBox(HWND_DESKTOP,
    2509                       hwnd,
    2510                       SwapIniProc,
    2511                       FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) {
    2512           WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    2513           WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2514           EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
    2515         }
     2514        if (WinDlgBox(HWND_DESKTOP,
     2515                      hwnd,
     2516                      SwapIniProc,
     2517                      FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) {
     2518          WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     2519          WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2520          EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
     2521        }
    25162522      }
    25172523      break;
     
    25202526      inidata = INSTDATA(hwnd);
    25212527      if (!inidata)
    2522         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2528        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    25232529      else {
    2524         inidata->currid++;
    2525         if (inidata->currid > INI_DATALIST)
    2526           inidata->currid = INI_APPLIST;
     2530        inidata->currid++;
     2531        if (inidata->currid > INI_DATALIST)
     2532          inidata->currid = INI_APPLIST;
    25272533      }
    25282534      WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, inidata->currid));
     
    25322538      inidata = INSTDATA(hwnd);
    25332539      if (!inidata)
    2534         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2540        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    25352541      else {
    2536         inidata->currid--;
    2537         if (inidata->currid < INI_APPLIST)
    2538           inidata->currid = INI_DATALIST;
     2542        inidata->currid--;
     2543        if (inidata->currid < INI_APPLIST)
     2544          inidata->currid = INI_DATALIST;
    25392545      }
    25402546      WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, inidata->currid));
     
    25442550      inidata = INSTDATA(hwnd);
    25452551      if (!inidata)
    2546         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2552        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    25472553      else {
    2548         inidata->confirm = (inidata->confirm) ? FALSE : TRUE;
    2549         WinCheckMenuItem(inidata->hwndMenu, INI_CONFIRM, inidata->confirm);
     2554        inidata->confirm = (inidata->confirm) ? FALSE : TRUE;
     2555        WinCheckMenuItem(inidata->hwndMenu, INI_CONFIRM, inidata->confirm);
    25502556
    25512557      }
     
    25562562      inidata = INSTDATA(hwnd);
    25572563      if (!inidata)
    2558         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2564        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    25592565      else {
    2560         inidata->edit = (SHORT1FROMMP(mp1) == INI_EDITENTRY);
    2561         WinDlgBox(HWND_DESKTOP,
    2562                   hwnd, AddIniProc, FM3ModHandle, IAD_FRAME, (PVOID) inidata);
     2566        inidata->edit = (SHORT1FROMMP(mp1) == INI_EDITENTRY);
     2567        WinDlgBox(HWND_DESKTOP,
     2568                  hwnd, AddIniProc, FM3ModHandle, IAD_FRAME, (PVOID) inidata);
    25632569      }
    25642570      break;
     
    25672573      inidata = INSTDATA(hwnd);
    25682574      if (!inidata)
    2569         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2575        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    25702576      else {
    2571         CHAR filename[CCHMAXPATH + 81], *p;
    2572         FILESTATUS3 fsa;
    2573         HINI hINI;
    2574 
    2575         strcpy(filename, inidata->ininame);
    2576         p = filename;
    2577         while (*p) {
    2578           if (*p == '/')
    2579             *p = '\\';
    2580           p++;
    2581         }
    2582         p = strrchr(filename, '\\');
    2583         if (p) {
    2584           p++;
    2585           *p = 0;
    2586         }
    2587         else
    2588           *filename = 0;
    2589         strcat(filename, "*.INI");
    2590         if (insert_filename(hwnd,
    2591                             filename,
    2592                             TRUE,
    2593                             TRUE) &&
    2594             *filename &&
    2595             !DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) {
    2596           hINI = PrfOpenProfile(WinQueryAnchorBlock(hwnd), filename);
    2597           if (hINI == NULLHANDLE) {
    2598             Win_Error(hwnd, hwnd, __FILE__, __LINE__,
    2599                       GetPString(IDS_INICANTOPENINITEXT), filename);
    2600           }
    2601           else {
    2602             if (*inidata->ininame) {
    2603               if (inidata->hini)
    2604                 CloseProfile(inidata->hini, FALSE);
    2605               *inidata->ininame = 0;
    2606             }
    2607             inidata->hini = hINI;
    2608             strcpy(inidata->ininame, filename);
    2609             WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    2610             WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2611             EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
    2612           }
    2613         }
     2577        CHAR filename[CCHMAXPATH + 81], *p;
     2578        FILESTATUS3 fsa;
     2579        HINI hINI;
     2580
     2581        strcpy(filename, inidata->ininame);
     2582        p = filename;
     2583        while (*p) {
     2584          if (*p == '/')
     2585            *p = '\\';
     2586          p++;
     2587        }
     2588        p = strrchr(filename, '\\');
     2589        if (p) {
     2590          p++;
     2591          *p = 0;
     2592        }
     2593        else
     2594          *filename = 0;
     2595        strcat(filename, "*.INI");
     2596        if (insert_filename(hwnd,
     2597                            filename,
     2598                            TRUE,
     2599                            TRUE) &&
     2600            *filename &&
     2601            !DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) {
     2602          hINI = PrfOpenProfile(WinQueryAnchorBlock(hwnd), filename);
     2603          if (hINI == NULLHANDLE) {
     2604            Win_Error(hwnd, hwnd, __FILE__, __LINE__,
     2605                      GetPString(IDS_INICANTOPENINITEXT), filename);
     2606          }
     2607          else {
     2608            if (*inidata->ininame) {
     2609              if (inidata->hini)
     2610                CloseProfile(inidata->hini, FALSE);
     2611              *inidata->ininame = 0;
     2612            }
     2613            inidata->hini = hINI;
     2614            strcpy(inidata->ininame, filename);
     2615            WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     2616            WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2617            EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
     2618          }
     2619        }
    26142620      }
    26152621      break;
     
    26182624      inidata = INSTDATA(hwnd);
    26192625      if (!inidata)
    2620         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2626        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    26212627      else {
    2622         if (inidata->hini && *inidata->ininame)
    2623           CloseProfile(inidata->hini, FALSE);
    2624         *inidata->ininame = 0;
    2625         inidata->hini = HINI_USERPROFILE;
    2626         WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    2627         WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2628         EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
     2628        if (inidata->hini && *inidata->ininame)
     2629          CloseProfile(inidata->hini, FALSE);
     2630        *inidata->ininame = 0;
     2631        inidata->hini = HINI_USERPROFILE;
     2632        WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     2633        WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2634        EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
    26292635      }
    26302636      break;
     
    26332639      inidata = INSTDATA(hwnd);
    26342640      if (!inidata)
    2635         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2641        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    26362642      else {
    2637         if (inidata->hini && *inidata->ininame)
    2638           CloseProfile(inidata->hini, FALSE);
    2639         *inidata->ininame = 0;
    2640         inidata->hini = HINI_SYSTEMPROFILE;
    2641         WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    2642         WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2643         EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
     2643        if (inidata->hini && *inidata->ininame)
     2644          CloseProfile(inidata->hini, FALSE);
     2645        *inidata->ininame = 0;
     2646        inidata->hini = HINI_SYSTEMPROFILE;
     2647        WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
     2648        WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2649        EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
    26442650      }
    26452651      break;
     
    26482654      inidata = INSTDATA(hwnd);
    26492655      if (!inidata)
    2650         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2656        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    26512657      else {
    2652         WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2653         EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
     2658        WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2659        EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);
    26542660      }
    26552661      break;
     
    26582664      inidata = INSTDATA(hwnd);
    26592665      if (!inidata)
    2660         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2666        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    26612667      else if (*inidata->applname && *inidata->keyname) {
    26622668
    2663         SHORT keyindex = inidata->keyindex;
    2664 
    2665         if (inidata->confirm && saymsg(MB_YESNO,
    2666                                        hwnd,
    2667                                        GetPString(IDS_CONFIRMTEXT),
    2668                                        GetPString(IDS_INIDELETEKEYTEXT),
    2669                                        inidata->keyname) == MBID_NO)
    2670           break;
    2671         PrfWriteProfileData(inidata->hini,
    2672                             inidata->applname, inidata->keyname, NULL, 0L);
    2673         *inidata->keyname = 0;
    2674         WinSendDlgItemMsg(hwnd,
    2675                           INI_KEYLIST,
    2676                           LM_DELETEITEM, MPFROM2SHORT(keyindex, 0), MPVOID);
    2677         WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2678         sSel = (SHORT) WinSendDlgItemMsg(hwnd,
    2679                                         INI_KEYLIST,
    2680                                         LM_QUERYITEMCOUNT, MPVOID, MPVOID);
    2681         if (!sSel)
    2682           WinSendMsg(hwnd, INI_DELETEAPP, MPVOID, MPVOID);
    2683         else {
    2684           sSel = min(keyindex, sSel - 1);
    2685           WinSendDlgItemMsg(hwnd,
    2686                             INI_KEYLIST,
    2687                             LM_SELECTITEM,
    2688                             MPFROMSHORT(sSel), MPFROMSHORT(TRUE));
    2689         }
     2669        SHORT keyindex = inidata->keyindex;
     2670
     2671        if (inidata->confirm && saymsg(MB_YESNO,
     2672                                       hwnd,
     2673                                       GetPString(IDS_CONFIRMTEXT),
     2674                                       GetPString(IDS_INIDELETEKEYTEXT),
     2675                                       inidata->keyname) == MBID_NO)
     2676          break;
     2677        PrfWriteProfileData(inidata->hini,
     2678                            inidata->applname, inidata->keyname, NULL, 0L);
     2679        *inidata->keyname = 0;
     2680        WinSendDlgItemMsg(hwnd,
     2681                          INI_KEYLIST,
     2682                          LM_DELETEITEM, MPFROM2SHORT(keyindex, 0), MPVOID);
     2683        WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2684        sSel = (SHORT) WinSendDlgItemMsg(hwnd,
     2685                                        INI_KEYLIST,
     2686                                        LM_QUERYITEMCOUNT, MPVOID, MPVOID);
     2687        if (!sSel)
     2688          WinSendMsg(hwnd, INI_DELETEAPP, MPVOID, MPVOID);
     2689        else {
     2690          sSel = min(keyindex, sSel - 1);
     2691          WinSendDlgItemMsg(hwnd,
     2692                            INI_KEYLIST,
     2693                            LM_SELECTITEM,
     2694                            MPFROMSHORT(sSel), MPFROMSHORT(TRUE));
     2695        }
    26902696      }
    26912697      break;
     
    26942700      inidata = INSTDATA(hwnd);
    26952701      if (!inidata)
    2696         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2702        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    26972703      // 09 Jan 08 SHL fixme to complain?
    26982704      else if (*inidata->applname) {
    26992705
    2700         SHORT appindex = inidata->appindex;
    2701 
    2702         if (inidata->confirm && saymsg(MB_YESNO,
    2703                                        hwnd,
    2704                                        GetPString(IDS_CONFIRMTEXT),
    2705                                        GetPString(IDS_INIDELETEAPPTEXT),
    2706                                        inidata->applname) == MBID_NO)
    2707           break;
    2708         PrfWriteProfileData(inidata->hini, inidata->applname, NULL, NULL, 0L);
    2709         *inidata->applname = *inidata->keyname = 0;
    2710         WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2711         WinSendDlgItemMsg(hwnd, INI_KEYLIST, LM_DELETEALL, MPVOID, MPVOID);
    2712         WinSendDlgItemMsg(hwnd,
    2713                           INI_APPLIST,
    2714                           LM_DELETEITEM, MPFROM2SHORT(appindex, 0), MPVOID);
    2715         WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
    2716         sSel = (SHORT) WinSendDlgItemMsg(hwnd,
    2717                                         INI_APPLIST,
    2718                                         LM_QUERYITEMCOUNT, MPVOID, MPVOID);
    2719         if (sSel) {
    2720           sSel = min(appindex, sSel - 1);
    2721           WinSendDlgItemMsg(hwnd,
    2722                             INI_APPLIST,
    2723                             LM_SELECTITEM,
    2724                             MPFROMSHORT(sSel), MPFROMSHORT(TRUE));
    2725         }
     2706        SHORT appindex = inidata->appindex;
     2707
     2708        if (inidata->confirm && saymsg(MB_YESNO,
     2709                                       hwnd,
     2710                                       GetPString(IDS_CONFIRMTEXT),
     2711                                       GetPString(IDS_INIDELETEAPPTEXT),
     2712                                       inidata->applname) == MBID_NO)
     2713          break;
     2714        PrfWriteProfileData(inidata->hini, inidata->applname, NULL, NULL, 0L);
     2715        *inidata->applname = *inidata->keyname = 0;
     2716        WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2717        WinSendDlgItemMsg(hwnd, INI_KEYLIST, LM_DELETEALL, MPVOID, MPVOID);
     2718        WinSendDlgItemMsg(hwnd,
     2719                          INI_APPLIST,
     2720                          LM_DELETEITEM, MPFROM2SHORT(appindex, 0), MPVOID);
     2721        WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
     2722        sSel = (SHORT) WinSendDlgItemMsg(hwnd,
     2723                                        INI_APPLIST,
     2724                                        LM_QUERYITEMCOUNT, MPVOID, MPVOID);
     2725        if (sSel) {
     2726          sSel = min(appindex, sSel - 1);
     2727          WinSendDlgItemMsg(hwnd,
     2728                            INI_APPLIST,
     2729                            LM_SELECTITEM,
     2730                            MPFROMSHORT(sSel), MPFROMSHORT(TRUE));
     2731        }
    27262732      }
    27272733      break;
     
    27342740    case IDM_HELP:
    27352741      if (hwndHelp)
    2736         WinSendMsg(hwndHelp,
    2737                    HM_DISPLAY_HELP,
    2738                    MPFROM2SHORT(HELP_INI, 0), MPFROMSHORT(HM_RESOURCEID));
     2742        WinSendMsg(hwndHelp,
     2743                   HM_DISPLAY_HELP,
     2744                   MPFROM2SHORT(HELP_INI, 0), MPFROMSHORT(HM_RESOURCEID));
    27392745      break;
    27402746
    27412747    case IDM_ABOUT:
    27422748      saymsg(MB_ENTER | MB_ICONASTERISK,
    2743              hwnd,
    2744              GetPString(IDS_VIEWABOUTTITLETEXT),
    2745              GetPString(IDS_INIABOUTTEXT));
     2749             hwnd,
     2750             GetPString(IDS_VIEWABOUTTITLETEXT),
     2751             GetPString(IDS_INIABOUTTEXT));
    27462752      break;
    27472753    }
     
    27552761      WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
    27562762      if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
    2757         WinStoreWindowPos(FM2Str,
    2758                           "INIWindowPos", WinQueryWindow(hwnd, QW_PARENT));
    2759       // inidata = WinQueryWindowPtr(hwnd, QWL_USER);   // 09 Jan 08 SHL
     2763        WinStoreWindowPos(FM2Str,
     2764                          "INIWindowPos", WinQueryWindow(hwnd, QW_PARENT));
     2765      // inidata = WinQueryWindowPtr(hwnd, QWL_USER);   // 09 Jan 08 SHL
    27602766    }
    27612767    WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
     
    27682774      inidata = INSTDATA(hwnd);
    27692775      if (!inidata)
    2770         Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     2776        Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    27712777      else {
    2772         dontclose = inidata->dontclose;
    2773         if (inidata->hini != NULLHANDLE && *inidata->ininame)
    2774           CloseProfile(inidata->hini, FALSE);
    2775         free(inidata->data);
    2776         if (inidata->hwndPopup)
    2777           WinDestroyWindow(inidata->hwndPopup);
    2778         free(inidata);
     2778        dontclose = inidata->dontclose;
     2779        if (inidata->hini != NULLHANDLE && *inidata->ininame)
     2780          CloseProfile(inidata->hini, FALSE);
     2781        free(inidata->data);
     2782        if (inidata->hwndPopup)
     2783          WinDestroyWindow(inidata->hwndPopup);
     2784        free(inidata);
    27792785      }
    27802786      if (!dontclose &&
    2781           ParentIsDesktop(hwnd, WinQueryWindow(WinQueryWindow(hwnd,
    2782                                                               QW_PARENT),
    2783                                                QW_PARENT))) {
    2784         if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
    2785           DosExit(EXIT_PROCESS, 1);
     2787          ParentIsDesktop(hwnd, WinQueryWindow(WinQueryWindow(hwnd,
     2788                                                              QW_PARENT),
     2789                                               QW_PARENT))) {
     2790        if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
     2791          DosExit(EXIT_PROCESS, 1);
    27862792      }
    27872793    }
  • trunk/dll/mainwnd2.c

    r1140 r1161  
    4949#include "notebook.h"                   // CfgDlgProc
    5050#include "command.h"                    // RunCommand
     51#include "misc.h"                       // BoxWindow, FixSwitchList, SetConditionalCascade
     52                                        // SetSysMenu
     53#include "mainwnd.h"                    // CloseChildren, MainWMCommand, MakeMainObjWin, ResizeDrives
     54                                        // TopWindow
     55#include "common.h"                     // CommonCreateMainChildren, CommonMainWndProc
     56#include "notify.h"                     // HideNote
     57#include "mainwnd2.h"
     58#include "remap.h"                      // RemapDlgProc
     59#include "treecnr.h"                    // StartTreeCnr
     60#include "walkem.h"                     // WalkTwoCmpDlgProc, WalkTwoSetDlgProc
     61#include "dirs.h"                       // switch_to
    5162#include "fm3dll.h"
    5263#include "fortify.h"
  • trunk/dll/mle.c

    r1063 r1161  
    4040#include "strutil.h"                    // GetPString
    4141#include "notebook.h"                   // httprun etc
     42#include "autoview.h"                   // CreateHexDump
     43#include "saveclip.h"                   // SaveToClip
    4244#include "fm3dll.h"
    4345#include "fortify.h"
  • trunk/dll/notebook.c

    r1109 r1161  
    4949#define INCL_DOS
    5050#define INCL_WIN
    51 #define INCL_LONGLONG                   // dircnrs.h
     51#define INCL_LONGLONG                   // dircnrs.h
    5252
    5353#include "fm3dlg.h"
    5454#include "fm3str.h"
    55 #include "pathutil.h"                   // BldQuotedFileName
    56 #include "errutil.h"                    // Dos_Error...
    57 #include "strutil.h"                    // GetPString
     55#include "pathutil.h"                   // BldQuotedFileName
     56#include "errutil.h"                    // Dos_Error...
     57#include "strutil.h"                    // GetPString
    5858#include "notebook.h"
     59#include "getnames.h"                   // CustomFileDlg
     60#include "mainwnd.h"                    // SaveDirCnrState
     61#include "walkem.h"                     // WalkExtractDlgProc
    5962#include "fm3dll.h"
     63#include "misc.h"                       // LoadDetailsSwitches, SetConditionalCascade
    6064#include "fortify.h"
    6165
     
    7579  case WM_INITDLG:
    7680    WinSendDlgItemMsg(hwnd, CFGA_VIRUS, EM_SETTEXTLIMIT,
    77                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     81                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    7882    WinSendDlgItemMsg(hwnd, CFGA_EXTRACTPATH, EM_SETTEXTLIMIT,
    79                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     83                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    8084    WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE);
    8185    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    123127      switch (SHORT2FROMMP(mp1)) {
    124128      case EN_KILLFOCUS:
    125         WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE);
    126         break;
     129        WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE);
     130        break;
    127131      case EN_SETFOCUS:
    128         WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), TRUE);
    129         break;
     132        WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), TRUE);
     133        break;
    130134      }
    131135      break;
     
    133137      switch (SHORT2FROMMP(mp1)) {
    134138      case BN_CLICKED:
    135         if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) {
    136 
    137           ARC_TYPE *pat = arcsighead;   // Hide dups
    138 
    139           if (!WinDlgBox(HWND_DESKTOP, hwnd,
    140                         SBoxDlgProc, FM3ModHandle, ASEL_FRAME,
    141                         (PVOID) & pat) || !pat || !pat->id || !*pat->id) {
    142             DosBeep(250, 100);          // Complain
    143             WinCheckButton(hwnd, CFGA_DEFARC, FALSE);
    144           }
    145           else
    146             WinSetDlgItemText(hwnd, CFGA_DEFARCNAME, pat->id);
    147         }
    148         break;
     139        if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) {
     140
     141          ARC_TYPE *pat = arcsighead;   // Hide dups
     142
     143          if (!WinDlgBox(HWND_DESKTOP, hwnd,
     144                        SBoxDlgProc, FM3ModHandle, ASEL_FRAME,
     145                        (PVOID) & pat) || !pat || !pat->id || !*pat->id) {
     146            DosBeep(250, 100);          // Complain
     147            WinCheckButton(hwnd, CFGA_DEFARC, FALSE);
     148          }
     149          else
     150            WinSetDlgItemText(hwnd, CFGA_DEFARCNAME, pat->id);
     151        }
     152        break;
    149153      default:
    150         break;
     154        break;
    151155      }
    152156      break;
     
    172176    case IDM_HELP:
    173177      if (hwndHelp)
    174         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    175                    MPFROM2SHORT(HELP_CFGA, 0), MPFROMSHORT(HM_RESOURCEID));
     178        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     179                   MPFROM2SHORT(HELP_CFGA, 0), MPFROMSHORT(HM_RESOURCEID));
    176180      break;
    177181
    178182    case CFGA_FIND:
    179183      {
    180         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    181         USHORT id;
    182         HWND hwndFocus;
    183 
    184         strcpy(filename, "*.EXE");
    185         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    186         if (hwndFocus) {
    187           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    188           switch (id) {
    189           case CFGA_VIRUS:
    190             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    191               BldQuotedFileName(szfilename, filename);
    192               strcat(szfilename, " %p");
    193               WinSetDlgItemText(hwnd, id, szfilename);
    194             }
    195             break;
    196           case CFGA_EXTRACTPATH:
    197             strcpy(filename, extractpath);
    198             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    199                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    200                           MPFROMP(filename)) && *filename)
    201               WinSetDlgItemText(hwnd, id, filename);
    202             break;
    203           default:
    204             Runtime_Error(pszSrcFile, __LINE__, "bad case");
    205             break;
    206           }
    207         }
     184        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     185        USHORT id;
     186        HWND hwndFocus;
     187
     188        strcpy(filename, "*.EXE");
     189        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     190        if (hwndFocus) {
     191          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     192          switch (id) {
     193          case CFGA_VIRUS:
     194            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     195              BldQuotedFileName(szfilename, filename);
     196              strcat(szfilename, " %p");
     197              WinSetDlgItemText(hwnd, id, szfilename);
     198            }
     199            break;
     200          case CFGA_EXTRACTPATH:
     201            strcpy(filename, extractpath);
     202            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     203                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     204                          MPFROMP(filename)) && *filename)
     205              WinSetDlgItemText(hwnd, id, filename);
     206            break;
     207          default:
     208            Runtime_Error(pszSrcFile, __LINE__, "bad case");
     209            break;
     210          }
     211        }
    208212      }
    209213      break;
     
    214218    fQuickArcFind = WinQueryButtonCheckstate(hwnd, CFGA_QUICKARCFIND);
    215219    PrfWriteProfileData(fmprof,
    216                         appname,
    217                         "QuickArcFind", &fQuickArcFind, sizeof(BOOL));
     220                        appname,
     221                        "QuickArcFind", &fQuickArcFind, sizeof(BOOL));
    218222    fArcStuffVisible = WinQueryButtonCheckstate(hwnd, CFGA_ARCSTUFFVISIBLE);
    219223    PrfWriteProfileData(fmprof,
    220                         appname,
    221                         "ArcStuffVisible", &fArcStuffVisible, sizeof(BOOL));
     224                        appname,
     225                        "ArcStuffVisible", &fArcStuffVisible, sizeof(BOOL));
    222226    fFolderAfterExtract = WinQueryButtonCheckstate(hwnd,
    223                                                    CFGA_FOLDERAFTEREXTRACT);
     227                                                   CFGA_FOLDERAFTEREXTRACT);
    224228    PrfWriteProfileData(fmprof,
    225                         appname,
    226                         "FolderAfterExtract",
    227                         &fFolderAfterExtract, sizeof(BOOL));
     229                        appname,
     230                        "FolderAfterExtract",
     231                        &fFolderAfterExtract, sizeof(BOOL));
    228232    if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) {
    229233
     
    253257      szCLBuf[MaxComLineStrg - 1] = 0;
    254258      if (strcmp(szCLBuf, virus)){
    255         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    256         memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);
    257         if (!strchr(virus, '%') && strlen(virus) > 3)
    258           strcat(virus, " %p");
     259        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     260        memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);
     261        if (!strchr(virus, '%') && strlen(virus) > 3)
     262          strcat(virus, " %p");
    259263      }
    260264      free(pszWorkBuf);
    261265      free(szCLBuf);
    262266      if (!*virus)
    263         strcpy(virus, "OS2SCAN.EXE %p /SUB /A");
     267        strcpy(virus, "OS2SCAN.EXE %p /SUB /A");
    264268      WinQueryDlgItemText(hwnd, CFGA_EXTRACTPATH, CCHMAXPATH, szPathBuf);
    265269      szPathBuf[CCHMAXPATH - 1] = 0;
    266270      bstrip(szPathBuf);
    267271      if (strcmp(extractpath, szPathBuf)) {
    268         memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1);
    269         if (*extractpath){
    270           MakeFullName(extractpath);
    271           if (IsFile(extractpath)) {
    272             ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
    273                               GetPString(IDS_WARNINGTEXT),
    274                               GetPString(IDS_EXTPATHNOTVALIDTEXT),
    275                               extractpath);
    276             if (ulResult == MBID_YES)
    277               *extractpath = 0;
    278             if (ulResult == MBID_CANCEL){
    279               WinDlgBox(HWND_DESKTOP,
    280                         hwnd,
    281                         CfgDlgProc,
    282                         FM3ModHandle,
    283                         CFG_FRAME,
    284                         MPFROMLONG(IDM_ARCHIVERSETTINGS));
    285               break;
    286             }
    287           }
    288         }
     272        memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1);
     273        if (*extractpath){
     274          MakeFullName(extractpath);
     275          if (IsFile(extractpath)) {
     276            ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
     277                              GetPString(IDS_WARNINGTEXT),
     278                              GetPString(IDS_EXTPATHNOTVALIDTEXT),
     279                              extractpath);
     280            if (ulResult == MBID_YES)
     281              *extractpath = 0;
     282            if (ulResult == MBID_CANCEL){
     283              WinDlgBox(HWND_DESKTOP,
     284                        hwnd,
     285                        CfgDlgProc,
     286                        FM3ModHandle,
     287                        CFG_FRAME,
     288                        MPFROMLONG(IDM_ARCHIVERSETTINGS));
     289              break;
     290            }
     291          }
     292        }
    289293      }
    290294    }
     
    296300    fCancelAction = FALSE;
    297301    WinDlgBox(HWND_DESKTOP,
    298               hwnd,
    299               CfgDlgProc,
    300               FM3ModHandle,
    301               CFG_FRAME,
    302               MPFROMLONG(IDM_ARCHIVERSETTINGS));
     302              hwnd,
     303              CfgDlgProc,
     304              FM3ModHandle,
     305              CFG_FRAME,
     306              MPFROMLONG(IDM_ARCHIVERSETTINGS));
    303307  }
    304308  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    311315  case WM_INITDLG:
    312316    WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_SETTEXTLIMIT,
    313                       MPFROMSHORT(8), MPVOID);
     317                      MPFROMSHORT(8), MPVOID);
    314318    WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_OVERRIDESETLIMITS,
    315                       MPFROMLONG(FILESTOGET_MAX), MPFROMLONG(FILESTOGET_MIN));
     319                      MPFROMLONG(FILESTOGET_MAX), MPFROMLONG(FILESTOGET_MIN));
    316320    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    317321    break;
     
    352356    WinCheckButton(hwnd, CFGS_REMOTEBUG, fRemoteBug);
    353357    WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_SETCURRENTVALUE,
    354                       MPFROMLONG(FilesToGet), MPVOID);
     358                      MPFROMLONG(FilesToGet), MPVOID);
    355359    return 0;
    356360
     
    360364    case CFGS_FORCELOWER:
    361365      {
    362         BOOL temp;
    363 
    364         temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
    365         if (temp) {
    366           switch (SHORT1FROMMP(mp1)) {
    367           case CFGS_FORCEUPPER:
    368             WinCheckButton(hwnd, CFGS_FORCELOWER, FALSE);
    369             break;
    370           case CFGS_FORCELOWER:
    371             WinCheckButton(hwnd, CFGS_FORCEUPPER, FALSE);
    372             break;
    373           }
    374         }
     366        BOOL temp;
     367
     368        temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
     369        if (temp) {
     370          switch (SHORT1FROMMP(mp1)) {
     371          case CFGS_FORCEUPPER:
     372            WinCheckButton(hwnd, CFGS_FORCELOWER, FALSE);
     373            break;
     374          case CFGS_FORCELOWER:
     375            WinCheckButton(hwnd, CFGS_FORCEUPPER, FALSE);
     376            break;
     377          }
     378        }
    375379      }
    376380      break;
     
    393397    case IDM_HELP:
    394398      if (hwndHelp)
    395         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    396                    MPFROM2SHORT(HELP_CFGS, 0), MPFROMSHORT(HM_RESOURCEID));
     399        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     400                   MPFROM2SHORT(HELP_CFGS, 0), MPFROMSHORT(HM_RESOURCEID));
    397401      break;
    398402    }
     
    402406    fLoadLongnames = WinQueryButtonCheckstate(hwnd, CFGS_LOADLONGNAMES);
    403407    PrfWriteProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames,
    404                         sizeof(BOOL));
     408                        sizeof(BOOL));
    405409    fLoadSubject = WinQueryButtonCheckstate(hwnd, CFGS_LOADSUBJECTS);
    406410    PrfWriteProfileData(fmprof, appname, "LoadSubject", &fLoadSubject,
    407                         sizeof(BOOL));
     411                        sizeof(BOOL));
    408412    fRemoteBug = WinQueryButtonCheckstate(hwnd, CFGS_REMOTEBUG);
    409413    PrfWriteProfileData(fmprof, appname, "RemoteBug", &fRemoteBug,
    410                         sizeof(BOOL));
     414                        sizeof(BOOL));
    411415    fNoRemovableScan = WinQueryButtonCheckstate(hwnd, CFGS_NOREMOVABLESCAN);
    412416    PrfWriteProfileData(fmprof, FM3Str, "NoRemovableScan", &fNoRemovableScan,
    413                         sizeof(BOOL));
     417                        sizeof(BOOL));
    414418    fNoIconsFiles = WinQueryButtonCheckstate(hwnd, CFGS_NOICONSFILES);
    415419    fNoIconsFiles = (fNoIconsFiles) ? FALSE : TRUE;
    416420    PrfWriteProfileData(fmprof, appname, "NoIconsFiles",
    417                         &fNoIconsFiles, sizeof(BOOL));
     421                        &fNoIconsFiles, sizeof(BOOL));
    418422    fNoIconsDirs = WinQueryButtonCheckstate(hwnd, CFGS_NOICONSDIRS);
    419423    fNoIconsDirs = (fNoIconsDirs) ? FALSE : TRUE;
    420424    PrfWriteProfileData(fmprof, appname, "NoIconsDirs",
    421                         &fNoIconsDirs, sizeof(BOOL));
     425                        &fNoIconsDirs, sizeof(BOOL));
    422426    fForceUpper = WinQueryButtonCheckstate(hwnd, CFGS_FORCEUPPER);
    423427    PrfWriteProfileData(fmprof, appname, "ForceUpper",
    424                         &fForceUpper, sizeof(BOOL));
     428                        &fForceUpper, sizeof(BOOL));
    425429    fForceLower = WinQueryButtonCheckstate(hwnd, CFGS_FORCELOWER);
    426430    PrfWriteProfileData(fmprof, appname, "ForceLower",
    427                         &fForceLower, sizeof(BOOL));
     431                        &fForceLower, sizeof(BOOL));
    428432    {
    429433      WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_QUERYVALUE,
    430                         MPFROMP(&FilesToGet), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     434                        MPFROMP(&FilesToGet), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    431435      if (FilesToGet < FILESTOGET_MIN)
    432         FilesToGet = FILESTOGET_MIN;
     436        FilesToGet = FILESTOGET_MIN;
    433437      else if (FilesToGet > FILESTOGET_MAX)
    434         FilesToGet = FILESTOGET_MAX;
     438        FilesToGet = FILESTOGET_MAX;
    435439      PrfWriteProfileData(fmprof,
    436                           appname, "FilesToGet", &FilesToGet, sizeof(ULONG));
     440                          appname, "FilesToGet", &FilesToGet, sizeof(ULONG));
    437441    }
    438442    break;
     
    447451  case WM_INITDLG:
    448452    WinSendDlgItemMsg(hwnd, CFGV_VIEWER, EM_SETTEXTLIMIT,
    449                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     453                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    450454    WinSendDlgItemMsg(hwnd, CFGV_EDITOR, EM_SETTEXTLIMIT,
    451                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     455                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    452456    WinSendDlgItemMsg(hwnd, CFGV_BINVIEW, EM_SETTEXTLIMIT,
    453                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     457                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    454458    WinSendDlgItemMsg(hwnd, CFGV_BINED, EM_SETTEXTLIMIT,
    455                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     459                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    456460    WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);
    457461    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    502506      switch (SHORT2FROMMP(mp1)) {
    503507      case EN_KILLFOCUS:
    504         WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);
    505         break;
     508        WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);
     509        break;
    506510      case EN_SETFOCUS:
    507         WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), TRUE);
    508         break;
     511        WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), TRUE);
     512        break;
    509513      }
    510514      break;
     
    527531    case IDM_HELP:
    528532      if (hwndHelp)
    529         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    530                    MPFROM2SHORT(HELP_CFGV, 0), MPFROMSHORT(HM_RESOURCEID));
     533        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     534                   MPFROM2SHORT(HELP_CFGV, 0), MPFROMSHORT(HM_RESOURCEID));
    531535      break;
    532536
    533537    case CFGV_FIND:
    534538      {
    535         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    536         USHORT id;
    537         HWND hwndFocus;
    538 
    539         strcpy(filename, "*.EXE");
    540         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    541         if (hwndFocus) {
    542           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    543           switch (id) {
    544           case CFGV_BINVIEW:
    545           case CFGV_BINED:
    546           case CFGV_VIEWER:
    547           case CFGV_EDITOR:
    548             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    549               BldQuotedFileName(szfilename, filename);
    550               strcat(szfilename, " %a");
    551               WinSetDlgItemText(hwnd, id, szfilename);
    552             }
    553             break;
    554           default:
    555             Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
    556             break;
    557           }
    558         }
     539        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     540        USHORT id;
     541        HWND hwndFocus;
     542
     543        strcpy(filename, "*.EXE");
     544        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     545        if (hwndFocus) {
     546          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     547          switch (id) {
     548          case CFGV_BINVIEW:
     549          case CFGV_BINED:
     550          case CFGV_VIEWER:
     551          case CFGV_EDITOR:
     552            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     553              BldQuotedFileName(szfilename, filename);
     554              strcat(szfilename, " %a");
     555              WinSetDlgItemText(hwnd, id, szfilename);
     556            }
     557            break;
     558          default:
     559            Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
     560            break;
     561          }
     562        }
    559563      }
    560564      break;
     
    578582      szCLBuf[MaxComLineStrg - 1] = 0;
    579583      if (strcmp(szCLBuf, viewer)){
    580         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    581         memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1);
    582         if (!strchr(viewer, '%') && strlen(viewer) > 3)
    583           strcat(viewer, " %a");
     584        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     585        memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1);
     586        if (!strchr(viewer, '%') && strlen(viewer) > 3)
     587          strcat(viewer, " %a");
    584588      }
    585589      WinQueryDlgItemText(hwnd, CFGV_EDITOR, MaxComLineStrg, szCLBuf);
    586590      szCLBuf[MaxComLineStrg - 1] = 0;
    587591      if (strcmp(szCLBuf, editor)){
    588         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    589         memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1);
    590         if (!strchr(editor, '%') && strlen(editor) > 3)
    591           strcat(editor, " %a");
     592        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     593        memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1);
     594        if (!strchr(editor, '%') && strlen(editor) > 3)
     595          strcat(editor, " %a");
    592596      }
    593597      WinQueryDlgItemText(hwnd, CFGV_BINVIEW, MaxComLineStrg, szCLBuf);
    594598      szCLBuf[MaxComLineStrg - 1] = 0;
    595599      if (strcmp(szCLBuf, binview)){
    596         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    597         memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1);
    598         if (!strchr(binview, '%') && strlen(binview) > 3)
    599           strcat(binview, " %a");
     600        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     601        memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1);
     602        if (!strchr(binview, '%') && strlen(binview) > 3)
     603          strcat(binview, " %a");
    600604      }
    601605      WinQueryDlgItemText(hwnd, CFGV_BINED, MaxComLineStrg, szCLBuf);
    602606      szCLBuf[MaxComLineStrg - 1] = 0;
    603607      if (strcmp(szCLBuf, bined)){
    604         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    605         memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1);
    606         if (!strchr(bined, '%') && strlen(bined) > 3)
    607           strcat(bined, " %a");
     608        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     609        memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1);
     610        if (!strchr(bined, '%') && strlen(bined) > 3)
     611          strcat(bined, " %a");
    608612      }
    609613      free(pszWorkBuf);
     
    615619      fUseNewViewer = WinQueryButtonCheckstate(hwnd, CFGV_USENEWVIEWER);
    616620      PrfWriteProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer,
    617                           sizeof(BOOL));
     621                          sizeof(BOOL));
    618622      fGuessType = WinQueryButtonCheckstate(hwnd, CFGV_GUESSTYPE);
    619623      PrfWriteProfileData(fmprof, appname, "GuessType", &fGuessType,
    620                           sizeof(BOOL));
     624                          sizeof(BOOL));
    621625      fViewChild = WinQueryButtonCheckstate(hwnd, CFGV_VIEWCHILD);
    622626      PrfWriteProfileData(fmprof, appname, "ViewChild", &fViewChild,
    623                           sizeof(BOOL));
     627                          sizeof(BOOL));
    624628      fCheckMM = WinQueryButtonCheckstate(hwnd, CFGV_CHECKMM);
    625629      PrfWriteProfileData(fmprof, appname, "CheckMM", &fCheckMM, sizeof(BOOL));
     
    631635    fCancelAction = FALSE;
    632636    WinDlgBox(HWND_DESKTOP,
    633               hwnd,
    634               CfgDlgProc,
    635               FM3ModHandle,
    636               CFG_FRAME,
    637               MPFROMLONG(IDM_VIEWERSETTINGS));
     637              hwnd,
     638              CfgDlgProc,
     639              FM3ModHandle,
     640              CFG_FRAME,
     641              MPFROMLONG(IDM_VIEWERSETTINGS));
    638642  }
    639643  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    645649  case WM_INITDLG:
    646650    WinSendDlgItemMsg(hwnd, CFGH_RUNFTPWORKDIR, EM_SETTEXTLIMIT,
    647                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     651                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    648652    WinSendDlgItemMsg(hwnd, CFGH_RUNHTTPWORKDIR, EM_SETTEXTLIMIT,
    649                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     653                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    650654    WinSendDlgItemMsg(hwnd, CFGH_FTPRUN, EM_SETTEXTLIMIT,
    651                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     655                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    652656    WinSendDlgItemMsg(hwnd, CFGH_HTTPRUN, EM_SETTEXTLIMIT,
    653                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     657                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    654658    WinSendDlgItemMsg(hwnd, CFGH_MAILRUN, EM_SETTEXTLIMIT,
    655                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     659                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    656660    WinSendDlgItemMsg(hwnd, CFGH_RUNMAILWORKDIR, EM_SETTEXTLIMIT,
    657                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     661                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    658662    WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE);
    659663    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    710714      switch (SHORT2FROMMP(mp1)) {
    711715      case EN_KILLFOCUS:
    712         WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE);
    713         break;
     716        WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE);
     717        break;
    714718      case EN_SETFOCUS:
    715         WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), TRUE);
    716         break;
     719        WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), TRUE);
     720        break;
    717721      }
    718722      break;
     
    735739    case IDM_HELP:
    736740      if (hwndHelp)
    737         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    738                    MPFROM2SHORT(HELP_CFGH, 0), MPFROMSHORT(HM_RESOURCEID));
     741        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     742                   MPFROM2SHORT(HELP_CFGH, 0), MPFROMSHORT(HM_RESOURCEID));
    739743      break;
    740744
    741745    case CFGH_FIND:
    742746      {
    743         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    744         USHORT id;
    745         HWND hwndFocus;
    746 
    747         strcpy(filename, "*.EXE");
    748         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    749         if (hwndFocus) {
    750           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    751           switch (id) {
    752           case CFGH_HTTPRUN:
    753           case CFGH_FTPRUN:
    754           case CFGH_MAILRUN:
    755             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    756               BldQuotedFileName(szfilename, filename);
    757               WinSetDlgItemText(hwnd, id, szfilename);
    758             }
    759             break;
    760           case CFGH_RUNFTPWORKDIR:
    761             strcpy(filename, ftprundir);
    762             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    763                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    764                           MPFROMP(filename)) && *filename)
    765               WinSetDlgItemText(hwnd, id, filename);
    766             break;
    767           case CFGH_RUNHTTPWORKDIR:
    768             strcpy(filename, httprundir);
    769             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    770                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    771                           MPFROMP(filename)) && *filename)
    772               WinSetDlgItemText(hwnd, id, filename);
    773             break;
    774           case CFGH_RUNMAILWORKDIR:
    775             strcpy(filename, mailrundir);
    776             if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
    777                           WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
    778                           MPFROMP(filename)) && *filename)
    779               WinSetDlgItemText(hwnd, id, filename);
    780             break;
    781           default:
    782             Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
    783             break;
    784           }
    785         }
     747        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     748        USHORT id;
     749        HWND hwndFocus;
     750
     751        strcpy(filename, "*.EXE");
     752        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     753        if (hwndFocus) {
     754          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     755          switch (id) {
     756          case CFGH_HTTPRUN:
     757          case CFGH_FTPRUN:
     758          case CFGH_MAILRUN:
     759            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     760              BldQuotedFileName(szfilename, filename);
     761              WinSetDlgItemText(hwnd, id, szfilename);
     762            }
     763            break;
     764          case CFGH_RUNFTPWORKDIR:
     765            strcpy(filename, ftprundir);
     766            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     767                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     768                          MPFROMP(filename)) && *filename)
     769              WinSetDlgItemText(hwnd, id, filename);
     770            break;
     771          case CFGH_RUNHTTPWORKDIR:
     772            strcpy(filename, httprundir);
     773            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     774                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     775                          MPFROMP(filename)) && *filename)
     776              WinSetDlgItemText(hwnd, id, filename);
     777            break;
     778          case CFGH_RUNMAILWORKDIR:
     779            strcpy(filename, mailrundir);
     780            if (WinDlgBox(HWND_DESKTOP, hwndNotebook,
     781                          WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,
     782                          MPFROMP(filename)) && *filename)
     783              WinSetDlgItemText(hwnd, id, filename);
     784            break;
     785          default:
     786            Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
     787            break;
     788          }
     789        }
    786790      }
    787791      break;
     
    818822      szCLBuf[MaxComLineStrg - 1] = 0;
    819823      if (strcmp(szCLBuf, ftprun)){
    820         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    821         memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     824        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     825        memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    822826      }
    823827      WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MaxComLineStrg, szCLBuf);
    824828      szCLBuf[MaxComLineStrg - 1] = 0;
    825829      if (strcmp(szCLBuf, httprun)){
    826         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    827         memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     830        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     831        memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    828832      }
    829833      WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MaxComLineStrg, szCLBuf);
    830834      szCLBuf[MaxComLineStrg - 1] = 0;
    831835      if (strcmp(szCLBuf, mailrun)){
    832         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    833         memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     836        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     837        memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    834838      }
    835839      free(pszWorkBuf);
     
    843847      fHttpRunWPSDefault = WinQueryButtonCheckstate(hwnd, CFGH_HTTPRUNWPSDEFAULT);
    844848      PrfWriteProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault,
    845                           sizeof(BOOL));
     849                          sizeof(BOOL));
    846850      fFtpRunWPSDefault = WinQueryButtonCheckstate(hwnd, CFGH_FTPRUNWPSDEFAULT);
    847851      PrfWriteProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault,
    848                           sizeof(BOOL));
     852                          sizeof(BOOL));
    849853      fLibPathStrictHttpRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTHTTPRUN);
    850854      PrfWriteProfileData(fmprof, appname, "LibPathStrictHttpRun",
    851                           &fLibPathStrictHttpRun, sizeof(BOOL));
     855                          &fLibPathStrictHttpRun, sizeof(BOOL));
    852856      fLibPathStrictFtpRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTFTPRUN);
    853857      PrfWriteProfileData(fmprof, appname, "LibPathStrictFtpRun",
    854                           &fLibPathStrictFtpRun, sizeof(BOOL));
     858                          &fLibPathStrictFtpRun, sizeof(BOOL));
    855859      fLibPathStrictMailRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTMAILRUN);
    856860      PrfWriteProfileData(fmprof, appname, "LibPathStrictMailRun",
    857                           &fLibPathStrictMailRun, sizeof(BOOL));
     861                          &fLibPathStrictMailRun, sizeof(BOOL));
    858862      fNoMailtoMailRun = WinQueryButtonCheckstate(hwnd, CFGH_NOMAILTOMAILRUN);
    859863      PrfWriteProfileData(fmprof, appname, "NoMailtoMailRun",
    860                           &fNoMailtoMailRun, sizeof(BOOL));
     864                          &fNoMailtoMailRun, sizeof(BOOL));
    861865      break;
    862866    }
     
    865869    fCancelAction = FALSE;
    866870    WinDlgBox(HWND_DESKTOP,
    867               hwnd,
    868               CfgDlgProc,
    869               FM3ModHandle,
    870               CFG_FRAME,
    871               MPFROMLONG(IDM_VIEWERSETTINGS));
     871              hwnd,
     872              CfgDlgProc,
     873              FM3ModHandle,
     874              CFG_FRAME,
     875              MPFROMLONG(IDM_VIEWERSETTINGS));
    872876  }
    873877  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    927931    case IDM_HELP:
    928932      if (hwndHelp)
    929         WinSendMsg(hwndHelp,
    930                    HM_DISPLAY_HELP,
    931                    MPFROM2SHORT(HELP_CFGB, 0), MPFROMSHORT(HM_RESOURCEID));
     933        WinSendMsg(hwndHelp,
     934                   HM_DISPLAY_HELP,
     935                   MPFROM2SHORT(HELP_CFGB, 0), MPFROMSHORT(HM_RESOURCEID));
    932936      break;
    933937    }
     
    937941    fToolbarHelp = WinQueryButtonCheckstate(hwnd, CFGB_TOOLBARHELP);
    938942    PrfWriteProfileData(fmprof,
    939                         FM3Str, "ToolbarHelp", &fToolbarHelp, sizeof(BOOL));
     943                        FM3Str, "ToolbarHelp", &fToolbarHelp, sizeof(BOOL));
    940944    fDrivebarHelp = WinQueryButtonCheckstate(hwnd, CFGB_DRIVEBARHELP);
    941945    PrfWriteProfileData(fmprof,
    942                         FM3Str, "DrivebarHelp", &fDrivebarHelp, sizeof(BOOL));
     946                        FM3Str, "DrivebarHelp", &fDrivebarHelp, sizeof(BOOL));
    943947    fOtherHelp = WinQueryButtonCheckstate(hwnd, CFGB_OTHERHELP);
    944948    PrfWriteProfileData(fmprof,
    945                         FM3Str, "OtherHelp", &fOtherHelp, sizeof(BOOL));
     949                        FM3Str, "OtherHelp", &fOtherHelp, sizeof(BOOL));
    946950    break;
    947951  }
     
    956960  case WM_INITDLG:
    957961    WinSendDlgItemMsg(hwnd,
    958                       CFG5_FILTER,
    959                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     962                      CFG5_FILTER,
     963                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    960964    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    961965    break;
     
    9961000
    9971001      if (!PrfQueryProfileData(fmprof,
    998                                appname,
    999                                "TreeflWindowAttr",
    1000                                (PVOID) & flWindowAttr, &ulSize))
    1001         flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI | CV_FLOW);
     1002                               appname,
     1003                               "TreeflWindowAttr",
     1004                               (PVOID) & flWindowAttr, &ulSize))
     1005        flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI | CV_FLOW);
    10021006      WinCheckButton(hwnd, CFG5_ICON, ((flWindowAttr & CV_ICON) != FALSE));
    10031007      WinCheckButton(hwnd, CFG5_MINIICONS,
    1004                      ((flWindowAttr & CV_MINI) != FALSE));
     1008                     ((flWindowAttr & CV_MINI) != FALSE));
    10051009      memset(&mask, 0, sizeof(mask));
    10061010      mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    1007         FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     1011        FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    10081012      mask.fIsTree = TRUE;
    10091013      ulSize = sizeof(MASK);
    10101014      if (PrfQueryProfileData(fmprof, appname, "TreeFilter", &mask, &ulSize)) {
    1011         SetMask(NULL, &mask);
     1015        SetMask(NULL, &mask);
    10121016      }
    10131017      if (!mask.attrFile)
    1014         mask.attrFile = (FILE_READONLY | FILE_NORMAL |
    1015                         FILE_ARCHIVED | FILE_DIRECTORY |
    1016                         FILE_HIDDEN | FILE_SYSTEM);
     1018        mask.attrFile = (FILE_READONLY | FILE_NORMAL |
     1019                        FILE_ARCHIVED | FILE_DIRECTORY |
     1020                        FILE_HIDDEN | FILE_SYSTEM);
    10171021      strcpy(mask.prompt, GetPString(IDS_TREEFILTERTITLETEXT));
    10181022      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    10271031      WinCheckButton(hwnd, CFG6_SORTREVERSE, FALSE);
    10281032      if (TreesortFlags & SORT_FIRSTEXTENSION)
    1029         WinCheckButton(hwnd, CFG6_SORTFIRST, TRUE);
     1033        WinCheckButton(hwnd, CFG6_SORTFIRST, TRUE);
    10301034      else if (TreesortFlags & SORT_LASTEXTENSION)
    1031         WinCheckButton(hwnd, CFG6_SORTLAST, TRUE);
     1035        WinCheckButton(hwnd, CFG6_SORTLAST, TRUE);
    10321036      else if (TreesortFlags & SORT_SIZE)
    1033         WinCheckButton(hwnd, CFG6_SORTSIZE, TRUE);
     1037        WinCheckButton(hwnd, CFG6_SORTSIZE, TRUE);
    10341038      else if (TreesortFlags & SORT_EASIZE)
    1035         WinCheckButton(hwnd, CFG6_SORTEASIZE, TRUE);
     1039        WinCheckButton(hwnd, CFG6_SORTEASIZE, TRUE);
    10361040      else if (TreesortFlags & SORT_LWDATE)
    1037         WinCheckButton(hwnd, CFG6_SORTLWDATE, TRUE);
     1041        WinCheckButton(hwnd, CFG6_SORTLWDATE, TRUE);
    10381042      else if (TreesortFlags & SORT_LADATE)
    1039         WinCheckButton(hwnd, CFG6_SORTLADATE, TRUE);
     1043        WinCheckButton(hwnd, CFG6_SORTLADATE, TRUE);
    10401044      else if (TreesortFlags & SORT_CRDATE)
    1041         WinCheckButton(hwnd, CFG6_SORTCRDATE, TRUE);
     1045        WinCheckButton(hwnd, CFG6_SORTCRDATE, TRUE);
    10421046      else if (TreesortFlags & SORT_FILENAME)
    1043         WinCheckButton(hwnd, CFG6_SORTFILENAME, TRUE);
     1047        WinCheckButton(hwnd, CFG6_SORTFILENAME, TRUE);
    10441048      else
    1045         WinCheckButton(hwnd, CFG6_SORTNAME, TRUE);
     1049        WinCheckButton(hwnd, CFG6_SORTNAME, TRUE);
    10461050      if (TreesortFlags & SORT_REVERSE)
    1047         WinCheckButton(hwnd, CFG6_SORTREVERSE, TRUE);
     1051        WinCheckButton(hwnd, CFG6_SORTREVERSE, TRUE);
    10481052    }
    10491053    return 0;
     
    10511055  case UM_SETUP5:
    10521056    if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc,
    1053                   FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
     1057                  FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
    10541058      SetMask(NULL, &mask);
    10551059      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    10621066      switch (SHORT2FROMMP(mp1)) {
    10631067      case EN_SETFOCUS:
    1064         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    1065         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    1066         break;
     1068        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     1069        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     1070        break;
    10671071      }
    10681072      break;
     
    10851089    case IDM_HELP:
    10861090      if (hwndHelp)
    1087         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1088                    MPFROM2SHORT(HELP_TREEVIEW, 0),
    1089                    MPFROMSHORT(HM_RESOURCEID));
     1091        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1092                   MPFROM2SHORT(HELP_TREEVIEW, 0),
     1093                   MPFROMSHORT(HM_RESOURCEID));
    10901094      break;
    10911095    }
     
    10971101
    10981102      if (WinQueryButtonCheckstate(hwnd, CFG5_ICON))
    1099         flWindowAttr |= CV_ICON;
     1103        flWindowAttr |= CV_ICON;
    11001104      else
    1101         flWindowAttr |= CV_TEXT;
     1105        flWindowAttr |= CV_TEXT;
    11021106      if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS))
    1103         flWindowAttr |= CV_MINI;
     1107        flWindowAttr |= CV_MINI;
    11041108      flWindowAttr |= (CV_TREE | CV_FLOW | CA_TREELINE);
    11051109      PrfWriteProfileData(fmprof,
    1106                           appname,
    1107                           "TreeflWindowAttr", &flWindowAttr, sizeof(ULONG));
     1110                          appname,
     1111                          "TreeflWindowAttr", &flWindowAttr, sizeof(ULONG));
    11081112      if (hwndTree) {
    11091113
    1110         CNRINFO cnri;
    1111 
    1112         memset(&cnri, 0, sizeof(cnri));
    1113         cnri.cb = sizeof(cnri);
    1114         WinSendMsg(WinWindowFromID
    1115                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    1116                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    1117         cnri.flWindowAttr = flWindowAttr;
    1118         WinSendMsg(WinWindowFromID
    1119                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    1120                    CM_SETCNRINFO, MPFROMP(&cnri),
    1121                    MPFROMLONG(CMA_FLWINDOWATTR));
     1114        CNRINFO cnri;
     1115
     1116        memset(&cnri, 0, sizeof(cnri));
     1117        cnri.cb = sizeof(cnri);
     1118        WinSendMsg(WinWindowFromID
     1119                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     1120                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     1121        cnri.flWindowAttr = flWindowAttr;
     1122        WinSendMsg(WinWindowFromID
     1123                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     1124                   CM_SETCNRINFO, MPFROMP(&cnri),
     1125                   MPFROMLONG(CMA_FLWINDOWATTR));
    11221126      }
    11231127    }
     
    11461150      TreesortFlags |= SORT_REVERSE;
    11471151    PrfWriteProfileData(fmprof, appname, "TreeSort", &TreesortFlags,
    1148                         sizeof(INT));
     1152                        sizeof(INT));
    11491153    if (hwndTree)
    11501154      PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESORT, 0), MPVOID);
     
    11561160
    11571161      dcd = WinQueryWindowPtr(WinWindowFromID(WinWindowFromID(hwndTree,
    1158                                                               FID_CLIENT),
    1159                                               TREE_CNR), QWL_USER);
     1162                                                              FID_CLIENT),
     1163                                              TREE_CNR), QWL_USER);
    11601164      if (dcd && dcd->size == sizeof(DIRCNRDATA)) {
    1161         dcd->mask = mask;
    1162         PostMsg(hwndTree, UM_FILTER, MPVOID, MPVOID);
     1165        dcd->mask = mask;
     1166        PostMsg(hwndTree, UM_FILTER, MPVOID, MPVOID);
    11631167      }
    11641168    }
     
    11761180  case WM_INITDLG:
    11771181    WinSendDlgItemMsg(hwnd, CFGT_ENVVARLIST, EM_SETTEXTLIMIT,
    1178                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     1182                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    11791183    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    11801184    break;
     
    12331237    case IDM_HELP:
    12341238      if (hwndHelp)
    1235         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1236                    MPFROM2SHORT(HELP_CFGT, 0), MPFROMSHORT(HM_RESOURCEID));
     1239        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1240                   MPFROM2SHORT(HELP_CFGT, 0), MPFROMSHORT(HM_RESOURCEID));
    12371241      break;
    12381242    }
     
    12421246    fVTreeOpensWPS = WinQueryButtonCheckstate(hwnd, CFGT_VTREEOPENSWPS);
    12431247    PrfWriteProfileData(fmprof, FM3Str, "VTreeOpensWPS", &fVTreeOpensWPS,
    1244                         sizeof(BOOL));
     1248                        sizeof(BOOL));
    12451249    fCollapseFirst = WinQueryButtonCheckstate(hwnd, CFGT_COLLAPSEFIRST);
    12461250    PrfWriteProfileData(fmprof, appname, "CollapseFirst", &fCollapseFirst,
    1247                         sizeof(BOOL));
     1251                        sizeof(BOOL));
    12481252    fSwitchTreeOnFocus = WinQueryButtonCheckstate(hwnd,
    1249                                                   CFGT_SWITCHTREEONFOCUS);
     1253                                                  CFGT_SWITCHTREEONFOCUS);
    12501254    PrfWriteProfileData(fmprof, appname, "SwitchTreeOnFocus",
    1251                         &fSwitchTreeOnFocus, sizeof(BOOL));
     1255                        &fSwitchTreeOnFocus, sizeof(BOOL));
    12521256    fSwitchTreeExpand = WinQueryButtonCheckstate(hwnd, CFGT_SWITCHTREEEXPAND);
    12531257    PrfWriteProfileData(fmprof, appname, "SwitchTreeExpand",
    1254                         &fSwitchTreeExpand, sizeof(BOOL));
     1258                        &fSwitchTreeExpand, sizeof(BOOL));
    12551259    fSwitchTree = WinQueryButtonCheckstate(hwnd, CFGT_SWITCHTREE);
    12561260    PrfWriteProfileData(fmprof, appname, "SwitchTree", &fSwitchTree,
    1257                         sizeof(BOOL));
     1261                        sizeof(BOOL));
    12581262    fFollowTree = WinQueryButtonCheckstate(hwnd, CFGT_FOLLOWTREE);
    12591263    PrfWriteProfileData(fmprof, appname, "FollowTree", &fFollowTree,
    1260                         sizeof(BOOL));
     1264                        sizeof(BOOL));
    12611265    fTopDir = WinQueryButtonCheckstate(hwnd, CFGT_TOPDIR);
    12621266    PrfWriteProfileData(fmprof, appname, "TopDir", (PVOID) & fTopDir,
    1263                         sizeof(BOOL));
     1267                        sizeof(BOOL));
    12641268    fDCOpens = WinQueryButtonCheckstate(hwnd, CFGT_DCOPENS);
    12651269    PrfWriteProfileData(fmprof, FM3Str, "DoubleClickOpens", &fDCOpens,
    1266                         sizeof(BOOL));
     1270                        sizeof(BOOL));
    12671271    fShowEnvChanged = (fShowEnv != WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV));
    12681272    fShowEnv = WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV);
     
    12821286      if (hwndTree && (fShowEnvChanged || (fShowEnv && fTreeEnvVarListChanged)))
    12831287      {
    1284         PCNRITEM pci = WinSendMsg(WinWindowFromID
    1285                 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), CM_QUERYRECORDEMPHASIS,
    1286                                   MPFROMLONG(CMA_FIRST),
    1287                                   MPFROMSHORT(CRA_SELECTED));
     1288        PCNRITEM pci = WinSendMsg(WinWindowFromID
     1289                (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), CM_QUERYRECORDEMPHASIS,
     1290                                  MPFROMLONG(CMA_FIRST),
     1291                                  MPFROMSHORT(CRA_SELECTED));
    12881292        PostMsg(WinWindowFromID
    1289                 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND,
    1290                 MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
    1291         pszTemp = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
    1292         if (pszTemp) {
     1293                (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND,
     1294                MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);
     1295        pszTemp = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
     1296        if (pszTemp) {
    12931297          if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTemp), MPVOID))
    12941298            free(pszTemp);
    1295           /* pszTemp is freed in the UM_SHOWME code */
    1296         }
     1299          /* pszTemp is freed in the UM_SHOWME code */
     1300        }
    12971301      }
    12981302    }
     
    13071311  case WM_INITDLG:
    13081312    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETTEXTLIMIT,
    1309                       MPFROMSHORT(8), MPVOID);
     1313                      MPFROMSHORT(8), MPVOID);
    13101314    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_OVERRIDESETLIMITS,
    1311                       MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN));
     1315                      MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN));
    13121316    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    13131317    break;
     
    13581362    WinCheckButton(hwnd, CFGG_TRASHCAN, fTrashCan);
    13591363    WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETCURRENTVALUE,
    1360                       MPFROMLONG(MaxComLineStrg), MPVOID);
     1364                      MPFROMLONG(MaxComLineStrg), MPVOID);
    13611365    return 0;
    13621366
     
    13751379      switch (SHORT2FROMMP(mp1)) {
    13761380      case EN_SETFOCUS:
    1377         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    1378         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    1379         break;
     1381        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     1382        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     1383        break;
    13801384      }
    13811385      break;
     
    13981402    case IDM_HELP:
    13991403      if (hwndHelp)
    1400         WinSendMsg(hwndHelp,
    1401                    HM_DISPLAY_HELP,
    1402                    MPFROM2SHORT(HELP_CFGG, 0), MPFROMSHORT(HM_RESOURCEID));
     1404        WinSendMsg(hwndHelp,
     1405                   HM_DISPLAY_HELP,
     1406                   MPFROM2SHORT(HELP_CFGG, 0), MPFROMSHORT(HM_RESOURCEID));
    14031407      break;
    14041408    }
     
    14141418      PrfWriteProfileData(fmprof, FM3Str, "NoDead", &fNoDead, sizeof(BOOL));
    14151419      PrfWriteProfileData(fmprof,
    1416                           FM3Str, "NoFinger", &fNoFinger, sizeof(BOOL));
     1420                          FM3Str, "NoFinger", &fNoFinger, sizeof(BOOL));
    14171421      WinDestroyPointer(hptrFinger);
    14181422      if (!fNoDead)
    1419         hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
     1423        hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);
    14201424      else
    1421         hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
     1425        hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);
    14221426    }
    14231427    fLinkSetsIcon = WinQueryButtonCheckstate(hwnd, CFGG_LINKSETSICON);
    14241428    PrfWriteProfileData(fmprof,
    1425                         appname,
    1426                         "LinkSetsIcon", &fLinkSetsIcon, sizeof(BOOL));
     1429                        appname,
     1430                        "LinkSetsIcon", &fLinkSetsIcon, sizeof(BOOL));
    14271431    fCustomFileDlg = WinQueryButtonCheckstate(hwnd, CFGG_CUSTOMFILEDLG);
    14281432    PrfWriteProfileData(fmprof,
    1429                         FM3Str,
    1430                         "CustomFileDlg", &fCustomFileDlg, sizeof(BOOL));
     1433                        FM3Str,
     1434                        "CustomFileDlg", &fCustomFileDlg, sizeof(BOOL));
    14311435    fDullMin = WinQueryButtonCheckstate(hwnd, CFGG_BORING);
    14321436    PrfWriteProfileData(fmprof,
    1433                         FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL));
     1437                        FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL));
    14341438    fConfirmDelete = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMDELETE);
    14351439    PrfWriteProfileData(fmprof,
    1436                         appname,
    1437                         "ConfirmDelete", &fConfirmDelete, sizeof(BOOL));
     1440                        appname,
     1441                        "ConfirmDelete", &fConfirmDelete, sizeof(BOOL));
    14381442    fDontMoveMouse = WinQueryButtonCheckstate(hwnd, CFGG_DONTMOVEMOUSE);
    14391443    PrfWriteProfileData(fmprof,
    1440                         appname,
    1441                         "DontMoveMouse", &fDontMoveMouse, sizeof(BOOL));
     1444                        appname,
     1445                        "DontMoveMouse", &fDontMoveMouse, sizeof(BOOL));
    14421446    fCopyDefault = WinQueryButtonCheckstate(hwnd, CFGG_DEFAULTCOPY);
    14431447    PrfWriteProfileData(fmprof, appname, "DefaultCopy",
    1444                         &fCopyDefault, sizeof(BOOL));
     1448                        &fCopyDefault, sizeof(BOOL));
    14451449    fRealIdle = WinQueryButtonCheckstate(hwnd, CFGG_IDLECOPY);
    14461450    PrfWriteProfileData(fmprof, appname, "IdleCopy",
    1447                         &fRealIdle, sizeof(BOOL));
     1451                        &fRealIdle, sizeof(BOOL));
    14481452    fDragndropDlg = WinQueryButtonCheckstate(hwnd, CFGG_DNDDLG);
    14491453    PrfWriteProfileData(fmprof, appname, "Drag&DropDlg",
    1450                         &fDragndropDlg, sizeof(BOOL));
     1454                        &fDragndropDlg, sizeof(BOOL));
    14511455    fVerify = WinQueryButtonCheckstate(hwnd, CFGG_VERIFYWRITES);
    14521456    PrfWriteProfileData(fmprof, appname, "VerifyWrites",
    1453                         &fVerify, sizeof(BOOL));
     1457                        &fVerify, sizeof(BOOL));
    14541458    DosSetVerify(fVerify);
    14551459    fDefaultDeletePerm = WinQueryButtonCheckstate(hwnd,
    1456                                                   CFGG_DEFAULTDELETEPERM);
     1460                                                  CFGG_DEFAULTDELETEPERM);
    14571461    PrfWriteProfileData(fmprof, appname, "DefaultDeletePerm",
    1458                         &fDefaultDeletePerm, sizeof(BOOL));
     1462                        &fDefaultDeletePerm, sizeof(BOOL));
    14591463    fFM2Deletes = WinQueryButtonCheckstate(hwnd, CFGG_FM2DELETES);
    14601464    PrfWriteProfileData(fmprof, FM3Str, "FM2Deletes",
     
    14621466    fTrashCan = WinQueryButtonCheckstate(hwnd, CFGG_TRASHCAN);
    14631467    PrfWriteProfileData(fmprof, FM3Str, "TrashCan",
    1464                         &fTrashCan, sizeof(BOOL));
     1468                        &fTrashCan, sizeof(BOOL));
    14651469    fConfirmTarget = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMTARGET);
    14661470    PrfWriteProfileData(fmprof, appname, "ConfirmTarget",
     
    14681472    {
    14691473      WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_QUERYVALUE,
    1470                         MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     1474                        MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    14711475      if (MaxComLineStrg < CMDLNLNGTH_MIN)
    1472         MaxComLineStrg = CMDLNLNGTH_MIN;
     1476        MaxComLineStrg = CMDLNLNGTH_MIN;
    14731477      else if (MaxComLineStrg > CMDLNLNGTH_MAX)
    1474         MaxComLineStrg = CMDLNLNGTH_MAX;
     1478        MaxComLineStrg = CMDLNLNGTH_MAX;
    14751479      PrfWriteProfileData(fmprof,
    1476                           appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG));
     1480                          appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG));
    14771481    }
    14781482    break;
     
    14861490  case WM_INITDLG:
    14871491    WinSendDlgItemMsg(hwnd, CFGC_COMPARE, EM_SETTEXTLIMIT,
    1488                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     1492                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    14891493    WinSendDlgItemMsg(hwnd, CFGC_DIRCOMPARE, EM_SETTEXTLIMIT,
    1490                       MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
     1494                      MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);
    14911495    WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);
    14921496    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     
    15291533      switch (SHORT2FROMMP(mp1)) {
    15301534      case EN_KILLFOCUS:
    1531         WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);
    1532         break;
     1535        WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);
     1536        break;
    15331537      case EN_SETFOCUS:
    1534         WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), TRUE);
    1535         break;
     1538        WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), TRUE);
     1539        break;
    15361540      }
    15371541      break;
     
    15541558    case IDM_HELP:
    15551559      if (hwndHelp)
    1556         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1557                    MPFROM2SHORT(HELP_CFGC, 0), MPFROMSHORT(HM_RESOURCEID));
     1560        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1561                   MPFROM2SHORT(HELP_CFGC, 0), MPFROMSHORT(HM_RESOURCEID));
    15581562      break;
    15591563
    15601564    case CFGC_FIND:
    15611565      {
    1562         CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
    1563         USHORT id;
    1564         HWND hwndFocus;
    1565 
    1566         strcpy(filename, "*.EXE");
    1567         hwndFocus = WinQueryFocus(HWND_DESKTOP);
    1568         if (hwndFocus) {
    1569           id = WinQueryWindowUShort(hwndFocus, QWS_ID);
    1570           switch (id) {
    1571           case CFGC_COMPARE:
    1572           case CFGC_DIRCOMPARE:
    1573             if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
    1574               BldQuotedFileName(szfilename, filename);
    1575               strcat(szfilename, " %a");
    1576               WinSetDlgItemText(hwnd, id, szfilename);
    1577             }
    1578             break;
    1579           default:
    1580             Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
    1581             break;
    1582           }
    1583         }
     1566        CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];
     1567        USHORT id;
     1568        HWND hwndFocus;
     1569
     1570        strcpy(filename, "*.EXE");
     1571        hwndFocus = WinQueryFocus(HWND_DESKTOP);
     1572        if (hwndFocus) {
     1573          id = WinQueryWindowUShort(hwndFocus, QWS_ID);
     1574          switch (id) {
     1575          case CFGC_COMPARE:
     1576          case CFGC_DIRCOMPARE:
     1577            if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {
     1578              BldQuotedFileName(szfilename, filename);
     1579              strcat(szfilename, " %a");
     1580              WinSetDlgItemText(hwnd, id, szfilename);
     1581            }
     1582            break;
     1583          default:
     1584            Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);
     1585            break;
     1586          }
     1587        }
    15841588      }
    15851589      break;
     
    16011605      }
    16021606      WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MaxComLineStrg, szCLBuf);
    1603         szCLBuf[MaxComLineStrg - 1] = 0;
    1604         if (strcmp(szCLBuf, dircompare)){
    1605           NormalizeCmdLine(pszWorkBuf, szCLBuf);
    1606           memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1);
    1607           if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
    1608             strcat(dircompare, " %a");
    1609         }
     1607        szCLBuf[MaxComLineStrg - 1] = 0;
     1608        if (strcmp(szCLBuf, dircompare)){
     1609          NormalizeCmdLine(pszWorkBuf, szCLBuf);
     1610          memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1);
     1611          if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
     1612            strcat(dircompare, " %a");
     1613        }
    16101614      PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare);
    16111615      WinQueryDlgItemText(hwnd, CFGC_COMPARE, MaxComLineStrg, szCLBuf);
     
    16261630    fCancelAction = FALSE;
    16271631    WinDlgBox(HWND_DESKTOP,
    1628               hwnd,
    1629               CfgDlgProc,
    1630               FM3ModHandle,
    1631               CFG_FRAME,
    1632               MPFROMLONG(IDM_COMPARESETTINGS));
     1632              hwnd,
     1633              CfgDlgProc,
     1634              FM3ModHandle,
     1635              CFG_FRAME,
     1636              MPFROMLONG(IDM_COMPARESETTINGS));
    16331637  }
    16341638  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    16511655    WinCheckButton(hwnd, CFGD_NOSEARCH, fNoSearch);
    16521656    WinCheckButton(hwnd, CFGD_EXTENDEDSEL,
    1653                    ((ulCnrType & CCS_EXTENDSEL) != 0));
     1657                   ((ulCnrType & CCS_EXTENDSEL) != 0));
    16541658    WinCheckButton(hwnd, CFGD_MULTIPLESEL,
    1655                    ((ulCnrType & CCS_MULTIPLESEL) != 0));
     1659                   ((ulCnrType & CCS_MULTIPLESEL) != 0));
    16561660    WinCheckButton(hwnd, CFGD_LEAVETREE, fLeaveTree);
    16571661    WinCheckButton(hwnd, CFGD_NOFOLDMENU, fNoFoldMenu);
     
    16981702    case IDM_HELP:
    16991703      if (hwndHelp)
    1700         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1701                    MPFROM2SHORT(HELP_CFGD, 0), MPFROMSHORT(HM_RESOURCEID));
     1704        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1705                   MPFROM2SHORT(HELP_CFGD, 0), MPFROMSHORT(HM_RESOURCEID));
    17021706      break;
    17031707    }
     
    17111715      ulCnrType |= CCS_MULTIPLESEL;
    17121716    PrfWriteProfileData(fmprof, appname, "ContainerType",
    1713                         (PVOID) & ulCnrType, sizeof(BOOL));
     1717                        (PVOID) & ulCnrType, sizeof(BOOL));
    17141718    fMinOnOpen = WinQueryButtonCheckstate(hwnd, CFGD_MINONOPEN);
    17151719    PrfWriteProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen,
    1716                         sizeof(BOOL));
     1720                        sizeof(BOOL));
    17171721    fLeaveTree = WinQueryButtonCheckstate(hwnd, CFGD_LEAVETREE);
    17181722    PrfWriteProfileData(fmprof, appname, "LeaveTree", &fLeaveTree,
    1719                         sizeof(BOOL));
     1723                        sizeof(BOOL));
    17201724    fNoFoldMenu = WinQueryButtonCheckstate(hwnd, CFGD_NOFOLDMENU);
    17211725    PrfWriteProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu,
    1722                         sizeof(BOOL));
     1726                        sizeof(BOOL));
    17231727    fSelectedAlways = WinQueryButtonCheckstate(hwnd, CFGD_SELECTEDALWAYS);
    17241728    PrfWriteProfileData(fmprof, appname, "SelectedAlways", &fSelectedAlways,
    1725                         sizeof(BOOL));
     1729                        sizeof(BOOL));
    17261730    fNoSearch = WinQueryButtonCheckstate(hwnd, CFGD_NOSEARCH);
    17271731    PrfWriteProfileData(fmprof, appname, "NoSearch", &fNoSearch,
    1728                         sizeof(BOOL));
     1732                        sizeof(BOOL));
    17291733    fLookInDir = WinQueryButtonCheckstate(hwnd, CFGD_LOOKINDIR);
    17301734    PrfWriteProfileData(fmprof, FM3Str, "LookInDir", (PVOID) & fLookInDir,
    1731                         sizeof(BOOL));
     1735                        sizeof(BOOL));
    17321736    fUnHilite = WinQueryButtonCheckstate(hwnd, CFGD_UNHILITE);
    17331737    PrfWriteProfileData(fmprof, appname, "UnHilite",
    1734                         &fUnHilite, sizeof(BOOL));
     1738                        &fUnHilite, sizeof(BOOL));
    17351739    {
    17361740      BOOL fOldSyncUpdates = WinQueryButtonCheckstate(hwnd, CFGD_SYNCUPDATES);
    17371741
    17381742      if (fOldSyncUpdates != fSyncUpdates) {
    1739         fSyncUpdates = fOldSyncUpdates;
    1740         if (hwndMain && !strcmp(realappname, FM3Str)) {
    1741           // Save state and restore to refresh windows with new settings
    1742           if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {
    1743             PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
    1744 //          PostMsg(hwndMain, UM_RESTORE, MPVOID, MPVOID);
    1745             PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);
    1746           }
    1747         }
     1743        fSyncUpdates = fOldSyncUpdates;
     1744        if (hwndMain && !strcmp(realappname, FM3Str)) {
     1745          // Save state and restore to refresh windows with new settings
     1746          if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {
     1747            PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
     1748//          PostMsg(hwndMain, UM_RESTORE, MPVOID, MPVOID);
     1749            PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);
     1750          }
     1751        }
    17481752      }
    17491753    }
    17501754    PrfWriteProfileData(fmprof, appname, "SyncUpdates",
    1751                         &fSyncUpdates, sizeof(BOOL));
     1755                        &fSyncUpdates, sizeof(BOOL));
    17521756    if (!(ulCnrType & (CCS_EXTENDSEL | CCS_MULTIPLESEL)))
    17531757      saymsg(MB_ENTER | MB_ICONEXCLAMATION,
    1754              HWND_DESKTOP,
    1755              GetPString(IDS_WARNINGTEXT),
    1756              GetPString(IDS_SELECTTYPEERRORTEXT));
    1757     break;                              // WM_CLOSE
     1758             HWND_DESKTOP,
     1759             GetPString(IDS_WARNINGTEXT),
     1760             GetPString(IDS_SELECTTYPEERRORTEXT));
     1761    break;                              // WM_CLOSE
    17581762  }
    17591763  return WinDefDlgProc(hwnd, msg, mp1, mp2);
     
    18341838      switch (SHORT1FROMMP(mp1)) {
    18351839      case CFGM_RECENTDIRS:
    1836         sprintf(s,
    1837                 GetPString(IDS_RECENTHELPWHICHTEXT),
    1838                 (!oh && th) ?
    1839                 GetPString(IDS_RECENTONLYTEXT) :
    1840                 (oh && th) ?
    1841                 GetPString(IDS_ALLONLYTEXT) : GetPString(IDS_NONE));
    1842         break;
     1840        sprintf(s,
     1841                GetPString(IDS_RECENTHELPWHICHTEXT),
     1842                (!oh && th) ?
     1843                GetPString(IDS_RECENTONLYTEXT) :
     1844                (oh && th) ?
     1845                GetPString(IDS_ALLONLYTEXT) : GetPString(IDS_NONE));
     1846        break;
    18431847      }
    18441848      if (*s)
    1845         WinSetDlgItemText(hwnd, SHORT1FROMMP(mp1), s);
     1849        WinSetDlgItemText(hwnd, SHORT1FROMMP(mp1), s);
    18461850    }
    18471851    return 0;
     
    18541858    case CFGM_STARTMIN:
    18551859      if (WinQueryButtonCheckstate(hwnd, CFGM_STARTMIN)) {
    1856         WinCheckButton(hwnd, CFGM_STARTMAX, FALSE);
    1857         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), FALSE);
     1860        WinCheckButton(hwnd, CFGM_STARTMAX, FALSE);
     1861        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), FALSE);
    18581862      }
    18591863      else
    1860         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), TRUE);
     1864        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), TRUE);
    18611865      break;
    18621866    case CFGM_STARTMAX:
    18631867      if (WinQueryButtonCheckstate(hwnd, CFGM_STARTMAX)) {
    1864         WinCheckButton(hwnd, CFGM_STARTMIN, FALSE);
    1865         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), FALSE);
     1868        WinCheckButton(hwnd, CFGM_STARTMIN, FALSE);
     1869        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), FALSE);
    18661870      }
    18671871      else
    1868         WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), TRUE);
     1872        WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), TRUE);
    18691873      break;
    18701874    }
     
    18861890    case IDM_HELP:
    18871891      if (hwndHelp)
    1888         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    1889                    MPFROM2SHORT(HELP_CFGM, 0), MPFROMSHORT(HM_RESOURCEID));
     1892        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     1893                   MPFROM2SHORT(HELP_CFGM, 0), MPFROMSHORT(HM_RESOURCEID));
    18901894      break;
    18911895    }
     
    18951899    if (hwndMain && !strcmp(realappname, FM3Str)) {
    18961900      if (fFreeTree != WinQueryButtonCheckstate(hwnd, CFGM_FREETREE))
    1897         PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
     1901        PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
    18981902      if (fAutoTile != WinQueryButtonCheckstate(hwnd, CFGM_AUTOTILE))
    1899         PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
     1903        PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
    19001904      if (fSplitStatus != WinQueryButtonCheckstate(hwnd, CFGM_SPLITSTATUS)) {
    1901         fSplitStatus = (fSplitStatus) ? FALSE : TRUE;
    1902         PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_BLINK, 0), MPVOID);
    1903         PrfWriteProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus,
    1904                             sizeof(BOOL));
     1905        fSplitStatus = (fSplitStatus) ? FALSE : TRUE;
     1906        PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_BLINK, 0), MPVOID);
     1907        PrfWriteProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus,
     1908                            sizeof(BOOL));
    19051909      }
    19061910    }
    19071911    fUserListSwitches = WinQueryButtonCheckstate(hwnd, CFGM_USERLISTSWITCHES);
    19081912    PrfWriteProfileData(fmprof, FM3Str, "UserListSwitches",
    1909                         (PVOID) & fUserListSwitches, sizeof(BOOL));
     1913                        (PVOID) & fUserListSwitches, sizeof(BOOL));
    19101914    fExternalINIs = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALINIS);
    19111915    PrfWriteProfileData(fmprof, FM3Str, "ExternalINIs",
    1912                         (PVOID) & fExternalINIs, sizeof(BOOL));
     1916                        (PVOID) & fExternalINIs, sizeof(BOOL));
    19131917    fExternalArcboxes = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALARCBOXES);
    19141918    PrfWriteProfileData(fmprof, FM3Str, "ExternalArcboxes",
    1915                         (PVOID) & fExternalArcboxes, sizeof(BOOL));
     1919                        (PVOID) & fExternalArcboxes, sizeof(BOOL));
    19161920    fExternalCollector =
    19171921      WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALCOLLECTOR);
    19181922    PrfWriteProfileData(fmprof, FM3Str, "ExternalCollector",
    1919                         (PVOID) & fExternalCollector, sizeof(BOOL));
     1923                        (PVOID) & fExternalCollector, sizeof(BOOL));
    19201924    fExternalViewer = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALVIEWER);
    19211925    PrfWriteProfileData(fmprof, FM3Str, "ExternalViewer",
    1922                         (PVOID) & fExternalViewer, sizeof(BOOL));
     1926                        (PVOID) & fExternalViewer, sizeof(BOOL));
    19231927    {
    19241928      long test;
     
    19291933    }
    19301934    PrfWriteProfileData(fmprof,
    1931                         appname,
    1932                         "AutoAddDirs", (PVOID) & fAutoAddDirs, sizeof(BOOL));
     1935                        appname,
     1936                        "AutoAddDirs", (PVOID) & fAutoAddDirs, sizeof(BOOL));
    19331937    PrfWriteProfileData(fmprof,
    1934                         appname,
    1935                         "AutoAddAllDirs",
    1936                         (PVOID) & fAutoAddAllDirs, sizeof(BOOL));
     1938                        appname,
     1939                        "AutoAddAllDirs",
     1940                        (PVOID) & fAutoAddAllDirs, sizeof(BOOL));
    19371941    fwsAnimate = WinQueryButtonCheckstate(hwnd, CFGM_WSANIMATE);
    19381942    if (fwsAnimate)
    19391943      fwsAnimate = WS_ANIMATE;
    19401944    PrfWriteProfileData(fmprof,
    1941                         appname,
    1942                         "WS_ANIMATE", (PVOID) & fwsAnimate, sizeof(ULONG));
     1945                        appname,
     1946                        "WS_ANIMATE", (PVOID) & fwsAnimate, sizeof(ULONG));
    19431947    fSaveState = WinQueryButtonCheckstate(hwnd, CFGM_SAVESTATE);
    19441948    PrfWriteProfileData(fmprof,
    1945                         FM3Str,
    1946                         "SaveState", (PVOID) & fSaveState, sizeof(BOOL));
     1949                        FM3Str,
     1950                        "SaveState", (PVOID) & fSaveState, sizeof(BOOL));
    19471951    fStartMinimized = WinQueryButtonCheckstate(hwnd, CFGM_STARTMIN);
    19481952    PrfWriteProfileData(fmprof,
    1949                         appname,
    1950                         "StartMinimized",
    1951                         (PVOID) & fStartMinimized, sizeof(BOOL));
     1953                        appname,
     1954                        "StartMinimized",
     1955                        (PVOID) & fStartMinimized, sizeof(BOOL));
    19521956    fStartMaximized = WinQueryButtonCheckstate(hwnd, CFGM_STARTMAX);
    19531957    PrfWriteProfileData(fmprof,
    1954                         appname,
    1955                         "StartMaximized",
    1956                         (PVOID) & fStartMaximized, sizeof(BOOL));
     1958                        appname,
     1959                        "StartMaximized",
     1960                        (PVOID) & fStartMaximized, sizeof(BOOL));
    19571961    fDataMin = WinQueryButtonCheckstate(hwnd, CFGM_DATAMIN);
    19581962    PrfWriteProfileData(fmprof,
    1959                         FM3Str, "DataMin", (PVOID) & fDataMin, sizeof(BOOL));
     1963                        FM3Str, "DataMin", (PVOID) & fDataMin, sizeof(BOOL));
    19601964    fTileBackwards = WinQueryButtonCheckstate(hwnd, CFGM_TILEBACKWARDS);
    19611965    PrfWriteProfileData(fmprof,
    1962                         FM3Str,
    1963                         "TileBackwards",
    1964                         (PVOID) & fTileBackwards, sizeof(BOOL));
     1966                        FM3Str,
     1967                        "TileBackwards",
     1968                        (PVOID) & fTileBackwards, sizeof(BOOL));
    19651969    fNoTreeGap = WinQueryButtonCheckstate(hwnd, CFGM_NOTREEGAP);
    19661970    PrfWriteProfileData(fmprof,
    1967                         FM3Str,
    1968                         "NoTreeGap", (PVOID) & fNoTreeGap, sizeof(BOOL));
     1971                        FM3Str,
     1972                        "NoTreeGap", (PVOID) & fNoTreeGap, sizeof(BOOL));
    19691973    fBlueLED = WinQueryButtonCheckstate(hwnd, CFGM_BLUELED);
    19701974    PrfWriteProfileData(fmprof,
    1971                         appname, "BlueLED", (PVOID) & fBlueLED, sizeof(BOOL));
     1975                        appname, "BlueLED", (PVOID) & fBlueLED, sizeof(BOOL));
    19721976    {
    19731977      BOOL dummy;
     
    19751979      dummy = WinQueryButtonCheckstate(hwnd, CFGM_SHOWTARGET);
    19761980      if (dummy != fShowTarget) {
    1977         fShowTarget = dummy;
    1978         PrfWriteProfileData(fmprof,
    1979                             appname,
    1980                             "ShowTarget",
    1981                             (PVOID) & fShowTarget, sizeof(BOOL));
    1982         if (hwndMain)
    1983           PostMsg(WinQueryWindow(hwndMain, QW_PARENT),
    1984                   WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    1985         SetTargetDir(hwnd, TRUE);
     1981        fShowTarget = dummy;
     1982        PrfWriteProfileData(fmprof,
     1983                            appname,
     1984                            "ShowTarget",
     1985                            (PVOID) & fShowTarget, sizeof(BOOL));
     1986        if (hwndMain)
     1987          PostMsg(WinQueryWindow(hwndMain, QW_PARENT),
     1988                  WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     1989        SetTargetDir(hwnd, TRUE);
    19861990      }
    19871991      dummy = WinQueryButtonCheckstate(hwnd, CFGM_SEPARATEPARMS);
    19881992      if (dummy != fSeparateParms) {
    1989         fSeparateParms = dummy;
    1990         PrfWriteProfileData(fmprof,
    1991                             FM3Str,
    1992                             "SeparateParms",
    1993                             (PVOID) & fSeparateParms, sizeof(BOOL));
    1994         WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER),
    1995                    UM_UNDO, MPVOID, MPVOID);
     1993        fSeparateParms = dummy;
     1994        PrfWriteProfileData(fmprof,
     1995                            FM3Str,
     1996                            "SeparateParms",
     1997                            (PVOID) & fSeparateParms, sizeof(BOOL));
     1998        WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER),
     1999                   UM_UNDO, MPVOID, MPVOID);
    19962000      }
    19972001    }
     
    20082012  case WM_INITDLG:
    20092013    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETTEXTLIMIT,
    2010                       MPFROMSHORT(8), MPVOID);
     2014                      MPFROMSHORT(8), MPVOID);
    20112015    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_OVERRIDESETLIMITS,
    2012                       MPFROMLONG(1000), MPFROMLONG(50));
     2016                      MPFROMLONG(1000), MPFROMLONG(50));
    20132017    WinSendDlgItemMsg(hwnd,
    2014                       CFG5_FILTER,
    2015                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     2018                      CFG5_FILTER,
     2019                      EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    20162020    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    20172021    break;
     
    20522056
    20532057      if (!PrfQueryProfileData(fmprof,
    2054                                appname,
    2055                                "DirflWindowAttr", &flWindowAttr, &ulSize))
    2056         flWindowAttr = (CV_NAME | CV_MINI | CA_DETAILSVIEWTITLES | CV_FLOW);
     2058                               appname,
     2059                               "DirflWindowAttr", &flWindowAttr, &ulSize))
     2060        flWindowAttr = (CV_NAME | CV_MINI | CA_DETAILSVIEWTITLES | CV_FLOW);
    20572061      if (flWindowAttr & CV_ICON)
    2058         WinCheckButton(hwnd, CFG5_ICON, TRUE);
     2062        WinCheckButton(hwnd, CFG5_ICON, TRUE);
    20592063      if (flWindowAttr & CV_NAME)
    2060         WinCheckButton(hwnd, CFG5_NAME, TRUE);
     2064        WinCheckButton(hwnd, CFG5_NAME, TRUE);
    20612065      if (flWindowAttr & CV_TEXT)
    2062         WinCheckButton(hwnd, CFG5_TEXT, TRUE);
     2066        WinCheckButton(hwnd, CFG5_TEXT, TRUE);
    20632067      if (flWindowAttr & CV_DETAIL)
    2064         WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
     2068        WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
    20652069      if (flWindowAttr & CV_MINI)
    2066         WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
     2070        WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
    20672071      if (flWindowAttr & CA_DETAILSVIEWTITLES)
    2068         WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
     2072        WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
    20692073      WinCheckButton(hwnd, CFG5_SHOWLNAMES, dsDirCnrDefault.detailslongname);
    20702074      WinCheckButton(hwnd, CFG5_SHOWSUBJECT, dsDirCnrDefault.detailssubject);
     
    20812085      memset(&mask, 0, sizeof(mask));
    20822086      mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2083         FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2087        FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    20842088      ulSize = sizeof(MASK);
    20852089      if (PrfQueryProfileData(fmprof, appname, "DirFilter", &mask, &ulSize))
    2086         SetMask(NULL, &mask);
     2090        SetMask(NULL, &mask);
    20872091      if (!mask.attrFile)
    2088         mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2089           FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2092        mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
     2093          FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    20902094      strcpy(mask.prompt, GetPString(IDS_DEFDIRFILTERTITLETEXT));
    20912095      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    20932097      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, dsDirCnrDefault.fSubjectLengthMax);
    20942098      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    2095                         MPFROMLONG(dsDirCnrDefault.SubjectDisplayWidth), MPVOID);
     2099                        MPFROMLONG(dsDirCnrDefault.SubjectDisplayWidth), MPVOID);
    20962100    }
    20972101    return 0;
     
    20992103  case UM_SETUP5:
    21002104    if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc,
    2101                   FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
     2105                  FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
    21022106      SetMask(NULL, &mask);
    21032107      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    21102114      switch (SHORT2FROMMP(mp1)) {
    21112115      case EN_SETFOCUS:
    2112         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    2113         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    2114         break;
     2116        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     2117        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     2118        break;
    21152119      }
    21162120      break;
     
    21332137    case IDM_HELP:
    21342138      if (hwndHelp)
    2135         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2136                    MPFROM2SHORT(HELP_CFG5, 0), MPFROMSHORT(HM_RESOURCEID));
     2139        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2140                   MPFROM2SHORT(HELP_CFG5, 0), MPFROMSHORT(HM_RESOURCEID));
    21372141      break;
    21382142    }
     
    21442148
    21452149      if (WinQueryButtonCheckstate(hwnd, CFG5_ICON))
    2146         flWindowAttr |= CV_ICON;
     2150        flWindowAttr |= CV_ICON;
    21472151      if (WinQueryButtonCheckstate(hwnd, CFG5_NAME))
    2148         flWindowAttr |= CV_NAME;
     2152        flWindowAttr |= CV_NAME;
    21492153      if (WinQueryButtonCheckstate(hwnd, CFG5_TEXT))
    2150         flWindowAttr |= CV_TEXT;
     2154        flWindowAttr |= CV_TEXT;
    21512155      if (WinQueryButtonCheckstate(hwnd, CFG5_DETAIL))
    2152         flWindowAttr |= CV_DETAIL;
     2156        flWindowAttr |= CV_DETAIL;
    21532157      if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS))
    2154         flWindowAttr |= CV_MINI;
     2158        flWindowAttr |= CV_MINI;
    21552159      if (WinQueryButtonCheckstate(hwnd, CFG5_SHOWTITLES))
    2156         flWindowAttr |= CA_DETAILSVIEWTITLES;
     2160        flWindowAttr |= CA_DETAILSVIEWTITLES;
    21572161      flWindowAttr |= CV_FLOW;
    21582162      PrfWriteProfileData(fmprof,
    2159                           appname,
    2160                           "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
     2163                          appname,
     2164                          "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
    21612165    }
    21622166    dsDirCnrDefault.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
    21632167    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    2164                         &dsDirCnrDefault.detailslongname, sizeof(BOOL));
     2168                        &dsDirCnrDefault.detailslongname, sizeof(BOOL));
    21652169    dsDirCnrDefault.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    21662170    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    2167                         &dsDirCnrDefault.detailssubject, sizeof(BOOL));
     2171                        &dsDirCnrDefault.detailssubject, sizeof(BOOL));
    21682172    dsDirCnrDefault.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    21692173    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    2170                         &dsDirCnrDefault.detailsea, sizeof(BOOL));
     2174                        &dsDirCnrDefault.detailsea, sizeof(BOOL));
    21712175    dsDirCnrDefault.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
    21722176    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    2173                         &dsDirCnrDefault.detailssize, sizeof(BOOL));
     2177                        &dsDirCnrDefault.detailssize, sizeof(BOOL));
    21742178    dsDirCnrDefault.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
    21752179    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    2176                         &dsDirCnrDefault.detailsicon, sizeof(BOOL));
     2180                        &dsDirCnrDefault.detailsicon, sizeof(BOOL));
    21772181    dsDirCnrDefault.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
    21782182    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    2179                         &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
     2183                        &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
    21802184    dsDirCnrDefault.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
    21812185    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    2182                         &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
     2186                        &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
    21832187    dsDirCnrDefault.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
    21842188    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    2185                         &dsDirCnrDefault.detailsladate, sizeof(BOOL));
     2189                        &dsDirCnrDefault.detailsladate, sizeof(BOOL));
    21862190    dsDirCnrDefault.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
    21872191    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    2188                         &dsDirCnrDefault.detailslatime, sizeof(BOOL));
     2192                        &dsDirCnrDefault.detailslatime, sizeof(BOOL));
    21892193    dsDirCnrDefault.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
    21902194    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    2191                         &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
     2195                        &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
    21922196    dsDirCnrDefault.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
    21932197    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    2194                         &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
     2198                        &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
    21952199    dsDirCnrDefault.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    21962200    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    2197                         &dsDirCnrDefault.detailsattr, sizeof(BOOL));
     2201                        &dsDirCnrDefault.detailsattr, sizeof(BOOL));
    21982202    dsDirCnrDefault.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    21992203    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectInLeftPane",
    2200                         &dsDirCnrDefault.fSubjectInLeftPane, sizeof(BOOL));
     2204                        &dsDirCnrDefault.fSubjectInLeftPane, sizeof(BOOL));
    22012205    dsDirCnrDefault.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    22022206    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectLengthMax",
    2203                         &dsDirCnrDefault.fSubjectLengthMax, sizeof(BOOL));
     2207                        &dsDirCnrDefault.fSubjectLengthMax, sizeof(BOOL));
    22042208    *mask.prompt = 0;
    22052209    PrfWriteProfileData(fmprof, appname, "DirFilter", &mask, sizeof(MASK));
    22062210    {
    2207         if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
    2208           WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
    2209                             MPFROMP(&dsDirCnrDefault.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    2210           if (dsDirCnrDefault.SubjectDisplayWidth < 50)
    2211             dsDirCnrDefault.SubjectDisplayWidth = 0;
    2212           else if (dsDirCnrDefault.SubjectDisplayWidth > 1000)
    2213             dsDirCnrDefault.SubjectDisplayWidth = 1000;
    2214         }
    2215         else
    2216           dsDirCnrDefault.SubjectDisplayWidth = 0;
    2217         PrfWriteProfileData(fmprof,
    2218                             appname, "DirCnr.SubjectDisplayWidth",
    2219                             &dsDirCnrDefault.SubjectDisplayWidth, sizeof(ULONG));
     2211        if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
     2212          WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
     2213                            MPFROMP(&dsDirCnrDefault.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     2214          if (dsDirCnrDefault.SubjectDisplayWidth < 50)
     2215            dsDirCnrDefault.SubjectDisplayWidth = 0;
     2216          else if (dsDirCnrDefault.SubjectDisplayWidth > 1000)
     2217            dsDirCnrDefault.SubjectDisplayWidth = 1000;
     2218        }
     2219        else
     2220          dsDirCnrDefault.SubjectDisplayWidth = 0;
     2221        PrfWriteProfileData(fmprof,
     2222                            appname, "DirCnr.SubjectDisplayWidth",
     2223                            &dsDirCnrDefault.SubjectDisplayWidth, sizeof(ULONG));
    22202224    }
    22212225    break;
     
    22992303    case CFG6_SORTDIRSLAST:
    23002304      {
    2301         BOOL temp;
    2302 
    2303         temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
    2304         if (temp) {
    2305           switch (SHORT1FROMMP(mp1)) {
    2306           case CFG6_SORTDIRSFIRST:
    2307             WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
    2308             break;
    2309           case CFG6_SORTDIRSLAST:
    2310             WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
    2311             break;
    2312           }
    2313         }
     2305        BOOL temp;
     2306
     2307        temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
     2308        if (temp) {
     2309          switch (SHORT1FROMMP(mp1)) {
     2310          case CFG6_SORTDIRSFIRST:
     2311            WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
     2312            break;
     2313          case CFG6_SORTDIRSLAST:
     2314            WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
     2315            break;
     2316          }
     2317        }
    23142318      }
    23152319      break;
     
    23322336    case IDM_HELP:
    23332337      if (hwndHelp)
    2334         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2335                    MPFROM2SHORT(HELP_CFG6, 0), MPFROMSHORT(HM_RESOURCEID));
     2338        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2339                   MPFROM2SHORT(HELP_CFG6, 0), MPFROMSHORT(HM_RESOURCEID));
    23362340      break;
    23372341    }
     
    23752379  case WM_INITDLG:
    23762380    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETTEXTLIMIT,
    2377                       MPFROMSHORT(8), MPVOID);
     2381                      MPFROMSHORT(8), MPVOID);
    23782382    WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_OVERRIDESETLIMITS,
    2379                       MPFROMLONG(1000), MPFROMLONG(50));
     2383                      MPFROMLONG(1000), MPFROMLONG(50));
    23802384    WinSendDlgItemMsg(hwnd, CFG5_FILTER, EM_SETTEXTLIMIT,
    2381                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     2385                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    23822386    PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    23832387    break;
     
    24192423
    24202424      if (!PrfQueryProfileData(fmprof,
    2421                                appname,
    2422                                "CollectorflWindowAttr", &flWindowAttr, &ulSize))
    2423         flWindowAttr = (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI | CV_FLOW);
     2425                               appname,
     2426                               "CollectorflWindowAttr", &flWindowAttr, &ulSize))
     2427        flWindowAttr = (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI | CV_FLOW);
    24242428      if (flWindowAttr & CV_ICON)
    2425         WinCheckButton(hwnd, CFG5_ICON, TRUE);
     2429        WinCheckButton(hwnd, CFG5_ICON, TRUE);
    24262430      if (flWindowAttr & CV_NAME)
    2427         WinCheckButton(hwnd, CFG5_NAME, TRUE);
     2431        WinCheckButton(hwnd, CFG5_NAME, TRUE);
    24282432      if (flWindowAttr & CV_TEXT)
    2429         WinCheckButton(hwnd, CFG5_TEXT, TRUE);
     2433        WinCheckButton(hwnd, CFG5_TEXT, TRUE);
    24302434      if (flWindowAttr & CV_DETAIL)
    2431         WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
     2435        WinCheckButton(hwnd, CFG5_DETAIL, TRUE);
    24322436      if (flWindowAttr & CV_MINI)
    2433         WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
     2437        WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);
    24342438      if (flWindowAttr & CA_DETAILSVIEWTITLES)
    2435         WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
     2439        WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);
    24362440      memset(&mask, 0, sizeof(mask));
    24372441      mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2438         FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2442        FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    24392443      ulSize = sizeof(MASK);
    24402444      if (PrfQueryProfileData(fmprof,
    2441                               appname, "CollectorFilter", &mask, &ulSize)) {
    2442         SetMask(NULL, &mask);
     2445                              appname, "CollectorFilter", &mask, &ulSize)) {
     2446        SetMask(NULL, &mask);
    24432447      }
    24442448      if (!mask.attrFile)
    2445         mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
    2446           FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
     2449        mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |
     2450          FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;
    24472451      strcpy(mask.prompt, GetPString(IDS_DEFCOLFILTERTITLETEXT));
    24482452      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    24682472      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, ds.fSubjectLengthMax);
    24692473      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    2470                         MPFROMLONG(ds.SubjectDisplayWidth), MPVOID);
     2474                        MPFROMLONG(ds.SubjectDisplayWidth), MPVOID);
    24712475
    24722476    }
     
    24752479  case UM_SETUP5:
    24762480    if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc,
    2477                   FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
     2481                  FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
    24782482      SetMask(NULL, &mask);
    24792483      WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask);
     
    24862490      switch (SHORT2FROMMP(mp1)) {
    24872491      case EN_SETFOCUS:
    2488         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    2489         PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
    2490         break;
     2492        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     2493        PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);
     2494        break;
    24912495      }
    24922496      break;
     
    25092513    case IDM_HELP:
    25102514      if (hwndHelp)
    2511         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2512                    MPFROM2SHORT(HELP_CFG7, 0), MPFROMSHORT(HM_RESOURCEID));
     2515        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2516                   MPFROM2SHORT(HELP_CFG7, 0), MPFROMSHORT(HM_RESOURCEID));
    25132517      break;
    25142518    }
     
    25172521  case WM_CLOSE:
    25182522    fExternalCollector = WinQueryButtonCheckstate(hwnd,
    2519                                                   CFG5_EXTERNALCOLLECTOR);
     2523                                                  CFG5_EXTERNALCOLLECTOR);
    25202524    PrfWriteProfileData(fmprof, FM3Str, "ExternalCollector",
    2521                         &fExternalCollector, sizeof(BOOL));
     2525                        &fExternalCollector, sizeof(BOOL));
    25222526    {
    25232527      ULONG flWindowAttr = 0;
    25242528
    25252529      if (WinQueryButtonCheckstate(hwnd, CFG5_ICON))
    2526         flWindowAttr |= CV_ICON;
     2530        flWindowAttr |= CV_ICON;
    25272531      if (WinQueryButtonCheckstate(hwnd, CFG5_NAME))
    2528         flWindowAttr |= CV_NAME;
     2532        flWindowAttr |= CV_NAME;
    25292533      if (WinQueryButtonCheckstate(hwnd, CFG5_TEXT))
    2530         flWindowAttr |= CV_TEXT;
     2534        flWindowAttr |= CV_TEXT;
    25312535      if (WinQueryButtonCheckstate(hwnd, CFG5_DETAIL))
    2532         flWindowAttr |= CV_DETAIL;
     2536        flWindowAttr |= CV_DETAIL;
    25332537      if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS))
    2534         flWindowAttr |= CV_MINI;
     2538        flWindowAttr |= CV_MINI;
    25352539      if (WinQueryButtonCheckstate(hwnd, CFG5_SHOWTITLES))
    2536         flWindowAttr |= CA_DETAILSVIEWTITLES;
     2540        flWindowAttr |= CA_DETAILSVIEWTITLES;
    25372541      flWindowAttr |= CV_FLOW;
    25382542      PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    2539                           &flWindowAttr, sizeof(ULONG));
     2543                          &flWindowAttr, sizeof(ULONG));
    25402544    }
    25412545    {
     
    25452549      ds.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES);
    25462550      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLongname",
    2547                           &ds.detailslongname, sizeof(BOOL));
     2551                          &ds.detailslongname, sizeof(BOOL));
    25482552      ds.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    25492553      PrfWriteProfileData(fmprof, appname, "Collector.DetailsSubject",
    2550                           &ds.detailssubject, sizeof(BOOL));
     2554                          &ds.detailssubject, sizeof(BOOL));
    25512555      ds.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWEAS);
    25522556      PrfWriteProfileData(fmprof, appname, "Collector.DetailsEA",
    2553                           &ds.detailsea, sizeof(BOOL));
     2557                          &ds.detailsea, sizeof(BOOL));
    25542558      ds.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
    25552559      PrfWriteProfileData(fmprof, appname, "Collector.DetailsSize",
    2556                           &ds.detailssize, sizeof(BOOL));
     2560                          &ds.detailssize, sizeof(BOOL));
    25572561      ds.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
    25582562      PrfWriteProfileData(fmprof, appname, "Collector.DetailsIcon",
    2559                           &ds.detailsicon, sizeof(BOOL));
     2563                          &ds.detailsicon, sizeof(BOOL));
    25602564      ds.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
    25612565      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWDate",
    2562                           &ds.detailslwdate, sizeof(BOOL));
     2566                          &ds.detailslwdate, sizeof(BOOL));
    25632567      ds.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
    25642568      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWTime",
    2565                           &ds.detailslwtime, sizeof(BOOL));
     2569                          &ds.detailslwtime, sizeof(BOOL));
    25662570      ds.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
    25672571      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLADate",
    2568                           &ds.detailsladate, sizeof(BOOL));
     2572                          &ds.detailsladate, sizeof(BOOL));
    25692573      ds.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
    25702574      PrfWriteProfileData(fmprof, appname, "Collector.DetailsLATime",
    2571                           &ds.detailslatime, sizeof(BOOL));
     2575                          &ds.detailslatime, sizeof(BOOL));
    25722576      ds.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
    25732577      PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRDate",
    2574                           &ds.detailscrdate, sizeof(BOOL));
     2578                          &ds.detailscrdate, sizeof(BOOL));
    25752579      ds.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
    25762580      PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRTime",
    2577                           &ds.detailscrtime, sizeof(BOOL));
     2581                          &ds.detailscrtime, sizeof(BOOL));
    25782582      ds.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    25792583      PrfWriteProfileData(fmprof, appname, "Collector.DetailsAttr",
    2580                           &ds.detailsattr, sizeof(BOOL));
     2584                          &ds.detailsattr, sizeof(BOOL));
    25812585      ds.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    25822586      PrfWriteProfileData(fmprof, appname, "Collector.SubjectInLeftPane",
    2583                           &ds.fSubjectInLeftPane, sizeof(BOOL));
     2587                          &ds.fSubjectInLeftPane, sizeof(BOOL));
    25842588      ds.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    25852589      PrfWriteProfileData(fmprof, appname, "Collector.SubjectLengthMax",
    2586                           &ds.fSubjectLengthMax, sizeof(BOOL));
     2590                          &ds.fSubjectLengthMax, sizeof(BOOL));
    25872591      *mask.prompt = 0;
    25882592      PrfWriteProfileData(fmprof,
    2589                           appname, "CollectorFilter", &mask, sizeof(MASK));
     2593                          appname, "CollectorFilter", &mask, sizeof(MASK));
    25902594      {
    2591         if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
    2592           WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
    2593                             MPFROMP(&ds.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
    2594           if (ds.SubjectDisplayWidth < 50)
    2595             ds.SubjectDisplayWidth = 0;
    2596           else if (ds.SubjectDisplayWidth > 1000)
    2597             ds.SubjectDisplayWidth = 1000;
    2598         }
    2599         else
    2600           ds.SubjectDisplayWidth = 0;
    2601         PrfWriteProfileData(fmprof,
    2602                             appname, "Collector.SubjectDisplayWidth",
    2603                             &ds.SubjectDisplayWidth, sizeof(ULONG));
     2595        if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
     2596          WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,
     2597                            MPFROMP(&ds.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));
     2598          if (ds.SubjectDisplayWidth < 50)
     2599            ds.SubjectDisplayWidth = 0;
     2600          else if (ds.SubjectDisplayWidth > 1000)
     2601            ds.SubjectDisplayWidth = 1000;
     2602        }
     2603        else
     2604          ds.SubjectDisplayWidth = 0;
     2605        PrfWriteProfileData(fmprof,
     2606                            appname, "Collector.SubjectDisplayWidth",
     2607                            &ds.SubjectDisplayWidth, sizeof(ULONG));
    26042608      }
    26052609    }
     
    26842688    case CFG6_SORTDIRSLAST:
    26852689      {
    2686         BOOL temp;
    2687 
    2688         temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
    2689         if (temp) {
    2690           switch (SHORT1FROMMP(mp1)) {
    2691           case CFG6_SORTDIRSFIRST:
    2692             WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
    2693             break;
    2694           case CFG6_SORTDIRSLAST:
    2695             WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
    2696             break;
    2697           }
    2698         }
     2690        BOOL temp;
     2691
     2692        temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));
     2693        if (temp) {
     2694          switch (SHORT1FROMMP(mp1)) {
     2695          case CFG6_SORTDIRSFIRST:
     2696            WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);
     2697            break;
     2698          case CFG6_SORTDIRSLAST:
     2699            WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);
     2700            break;
     2701          }
     2702        }
    26992703      }
    27002704      break;
     
    27172721    case IDM_HELP:
    27182722      if (hwndHelp)
    2719         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2720                    MPFROM2SHORT(HELP_CFG8, 0), MPFROMSHORT(HM_RESOURCEID));
     2723        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2724                   MPFROM2SHORT(HELP_CFG8, 0), MPFROMSHORT(HM_RESOURCEID));
    27212725      break;
    27222726    }
     
    27482752      CollectorsortFlags |= SORT_REVERSE;
    27492753    PrfWriteProfileData(fmprof,
    2750                         appname,
    2751                         "CollectorSort", &CollectorsortFlags, sizeof(INT));
     2754                        appname,
     2755                        "CollectorSort", &CollectorsortFlags, sizeof(INT));
    27522756    break;
    27532757  }
     
    27902794    case IDM_HELP:
    27912795      if (hwndHelp)
    2792         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    2793                    MPFROM2SHORT(HELP_CFG9, 0), MPFROMSHORT(HM_RESOURCEID));
     2796        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     2797                   MPFROM2SHORT(HELP_CFG9, 0), MPFROMSHORT(HM_RESOURCEID));
    27942798      return 0;
    27952799    case CFG9_MAXIMUMUI:
    27962800      if (hwndMain) {
    2797         if (MenuInvisible)
    2798           WinSendMsg(hwndMain, WM_COMMAND,
    2799                      MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    2800         if (!fAutoView)
    2801           WinSendMsg(hwndMain, WM_COMMAND,
    2802                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    2803         if (!fDrivebar)
    2804           WinSendMsg(hwndMain, WM_COMMAND,
    2805                      MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
    2806         if (!fToolbar)
    2807           WinSendMsg(hwndMain, WM_COMMAND,
    2808                      MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    2809         if (!fMoreButtons)
    2810           WinSendMsg(hwndMain, WM_COMMAND,
    2811                      MPFROM2SHORT(IDM_MOREBUTTONS, 0), MPVOID);
    2812         if (!fUserComboBox)
    2813           WinSendMsg(hwndMain, WM_COMMAND,
    2814                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     2801        if (MenuInvisible)
     2802          WinSendMsg(hwndMain, WM_COMMAND,
     2803                     MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
     2804        if (!fAutoView)
     2805          WinSendMsg(hwndMain, WM_COMMAND,
     2806                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     2807        if (!fDrivebar)
     2808          WinSendMsg(hwndMain, WM_COMMAND,
     2809                     MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
     2810        if (!fToolbar)
     2811          WinSendMsg(hwndMain, WM_COMMAND,
     2812                     MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
     2813        if (!fMoreButtons)
     2814          WinSendMsg(hwndMain, WM_COMMAND,
     2815                     MPFROM2SHORT(IDM_MOREBUTTONS, 0), MPVOID);
     2816        if (!fUserComboBox)
     2817          WinSendMsg(hwndMain, WM_COMMAND,
     2818                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    28152819      }
    28162820      return 0;
    28172821    case CFG9_MINIMUMUI:
    28182822      if (hwndMain) {
    2819         if (!MenuInvisible)
    2820           WinSendMsg(hwndMain, WM_COMMAND,
    2821                      MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    2822         if (fAutoView)
    2823           WinSendMsg(hwndMain, WM_COMMAND,
    2824                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    2825         if (fToolbar)
    2826           WinSendMsg(hwndMain, WM_COMMAND,
    2827                      MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    2828         if (fMoreButtons)
    2829           WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
    2830                      MPVOID);
    2831         if (fUserComboBox)
    2832           WinSendMsg(hwndMain, WM_COMMAND,
    2833                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    2834         saymsg(MB_ENTER | MB_ICONASTERISK,
    2835                hwnd,
    2836                GetPString(IDS_DONTFORGETTEXT),
    2837                GetPString(IDS_UNHIDEMENUWARNTEXT));
     2823        if (!MenuInvisible)
     2824          WinSendMsg(hwndMain, WM_COMMAND,
     2825                     MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
     2826        if (fAutoView)
     2827          WinSendMsg(hwndMain, WM_COMMAND,
     2828                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     2829        if (fToolbar)
     2830          WinSendMsg(hwndMain, WM_COMMAND,
     2831                     MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
     2832        if (fMoreButtons)
     2833          WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
     2834                     MPVOID);
     2835        if (fUserComboBox)
     2836          WinSendMsg(hwndMain, WM_COMMAND,
     2837                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     2838        saymsg(MB_ENTER | MB_ICONASTERISK,
     2839               hwnd,
     2840               GetPString(IDS_DONTFORGETTEXT),
     2841               GetPString(IDS_UNHIDEMENUWARNTEXT));
    28382842      }
    28392843      return 0;
     
    28492853      fDragndropDlg = TRUE;
    28502854      {
    2851         ULONG flWindowAttr;
    2852 
    2853         flWindowAttr = CV_DETAIL | CV_FLOW | CA_DETAILSVIEWTITLES;
    2854         PrfWriteProfileData(fmprof,
    2855                             appname,
    2856                             "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
    2857         PrfWriteProfileData(fmprof,
    2858                             appname,
    2859                             "CollectorflWindowAttr",
    2860                             &flWindowAttr, sizeof(ULONG));
    2861         PrfWriteProfileData(fmprof,
    2862                             appname, "Collector.Fontnamesize", NULL, 0);
     2855        ULONG flWindowAttr;
     2856
     2857        flWindowAttr = CV_DETAIL | CV_FLOW | CA_DETAILSVIEWTITLES;
     2858        PrfWriteProfileData(fmprof,
     2859                            appname,
     2860                            "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
     2861        PrfWriteProfileData(fmprof,
     2862                            appname,
     2863                            "CollectorflWindowAttr",
     2864                            &flWindowAttr, sizeof(ULONG));
     2865        PrfWriteProfileData(fmprof,
     2866                            appname, "Collector.Fontnamesize", NULL, 0);
    28632867      }
    28642868      dsDirCnrDefault.detailslongname = TRUE;
     
    28762880      if (hwndTree) {
    28772881
    2878         CNRINFO cnri;
    2879         ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
    2880 
    2881         memset(&cnri, 0, sizeof(cnri));
    2882         cnri.cb = sizeof(cnri);
    2883         WinSendMsg(WinWindowFromID
    2884                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    2885                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    2886         cnri.flWindowAttr = flWindowAttr;
    2887         WinSendMsg(WinWindowFromID
    2888                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    2889                    CM_SETCNRINFO, MPFROMP(&cnri),
    2890                    MPFROMLONG(CMA_FLWINDOWATTR));
     2882        CNRINFO cnri;
     2883        ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
     2884
     2885        memset(&cnri, 0, sizeof(cnri));
     2886        cnri.cb = sizeof(cnri);
     2887        WinSendMsg(WinWindowFromID
     2888                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     2889                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     2890        cnri.flWindowAttr = flWindowAttr;
     2891        WinSendMsg(WinWindowFromID
     2892                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     2893                   CM_SETCNRINFO, MPFROMP(&cnri),
     2894                   MPFROMLONG(CMA_FLWINDOWATTR));
    28912895      }
    28922896      break;
     
    29032907      fDragndropDlg = TRUE;
    29042908      {
    2905         ULONG flWindowAttr;
    2906 
    2907         flWindowAttr = CV_DETAIL | CV_FLOW | CV_MINI;
    2908         PrfWriteProfileData(fmprof,
    2909                             appname,
    2910                             "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
    2911         PrfWriteProfileData(fmprof,
    2912                             appname,
    2913                             "CollectorflWindowAttr",
    2914                             &flWindowAttr, sizeof(ULONG));
    2915         PrfWriteProfileData(fmprof,
    2916                             appname,
    2917                             "Collector.Fontnamesize",
    2918                             GetPString(IDS_8HELVTEXT),
    2919                             strlen(GetPString(IDS_8HELVTEXT)) + 1);
     2909        ULONG flWindowAttr;
     2910
     2911        flWindowAttr = CV_DETAIL | CV_FLOW | CV_MINI;
     2912        PrfWriteProfileData(fmprof,
     2913                            appname,
     2914                            "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));
     2915        PrfWriteProfileData(fmprof,
     2916                            appname,
     2917                            "CollectorflWindowAttr",
     2918                            &flWindowAttr, sizeof(ULONG));
     2919        PrfWriteProfileData(fmprof,
     2920                            appname,
     2921                            "Collector.Fontnamesize",
     2922                            GetPString(IDS_8HELVTEXT),
     2923                            strlen(GetPString(IDS_8HELVTEXT)) + 1);
    29202924      }
    29212925      dsDirCnrDefault.detailslongname = TRUE;
     
    29332937      if (hwndTree) {
    29342938
    2935         CNRINFO cnri;
    2936         ULONG flWindowAttr = CV_TREE | CV_MINI | CV_TEXT |
    2937           CV_FLOW | CA_TREELINE;
    2938 
    2939         memset(&cnri, 0, sizeof(cnri));
    2940         cnri.cb = sizeof(cnri);
    2941         WinSendMsg(WinWindowFromID
    2942                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    2943                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    2944         cnri.flWindowAttr = flWindowAttr;
    2945         WinSendMsg(WinWindowFromID
    2946                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    2947                    CM_SETCNRINFO, MPFROMP(&cnri),
    2948                    MPFROMLONG(CMA_FLWINDOWATTR));
     2939        CNRINFO cnri;
     2940        ULONG flWindowAttr = CV_TREE | CV_MINI | CV_TEXT |
     2941          CV_FLOW | CA_TREELINE;
     2942
     2943        memset(&cnri, 0, sizeof(cnri));
     2944        cnri.cb = sizeof(cnri);
     2945        WinSendMsg(WinWindowFromID
     2946                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     2947                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     2948        cnri.flWindowAttr = flWindowAttr;
     2949        WinSendMsg(WinWindowFromID
     2950                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     2951                   CM_SETCNRINFO, MPFROMP(&cnri),
     2952                   MPFROMLONG(CMA_FLWINDOWATTR));
    29492953      }
    29502954      break;
    29512955    case CFG9_MAXFILENAMES:
    29522956      if (hwndMain && fAutoView)
    2953         WinSendMsg(hwndMain, WM_COMMAND,
    2954                    MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     2957        WinSendMsg(hwndMain, WM_COMMAND,
     2958                   MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    29552959      fForceUpper = FALSE;
    29562960      fForceLower = TRUE;
     
    29642968      fNoIconsDirs = TRUE;
    29652969      {
    2966         ULONG flWindowAttr;
    2967 
    2968         flWindowAttr = CV_TEXT | CV_FLOW;
    2969         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    2970                             &flWindowAttr, sizeof(ULONG));
    2971         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    2972                             &flWindowAttr, sizeof(ULONG));
    2973         PrfWriteProfileData(fmprof, appname, "Collector.Fontnamesize",
    2974                             GetPString(IDS_8HELVTEXT),
    2975                             strlen(GetPString(IDS_8HELVTEXT)) + 1);
     2970        ULONG flWindowAttr;
     2971
     2972        flWindowAttr = CV_TEXT | CV_FLOW;
     2973        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     2974                            &flWindowAttr, sizeof(ULONG));
     2975        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     2976                            &flWindowAttr, sizeof(ULONG));
     2977        PrfWriteProfileData(fmprof, appname, "Collector.Fontnamesize",
     2978                            GetPString(IDS_8HELVTEXT),
     2979                            strlen(GetPString(IDS_8HELVTEXT)) + 1);
    29762980      }
    29772981      if (hwndTree) {
    29782982
    2979         CNRINFO cnri;
    2980         ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
    2981 
    2982         memset(&cnri, 0, sizeof(cnri));
    2983         cnri.cb = sizeof(cnri);
    2984         WinSendMsg(WinWindowFromID
    2985                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    2986                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    2987         cnri.flWindowAttr = flWindowAttr;
    2988         WinSendMsg(WinWindowFromID
    2989                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    2990                    CM_SETCNRINFO, MPFROMP(&cnri),
    2991                    MPFROMLONG(CMA_FLWINDOWATTR));
     2983        CNRINFO cnri;
     2984        ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
     2985
     2986        memset(&cnri, 0, sizeof(cnri));
     2987        cnri.cb = sizeof(cnri);
     2988        WinSendMsg(WinWindowFromID
     2989                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     2990                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     2991        cnri.flWindowAttr = flWindowAttr;
     2992        WinSendMsg(WinWindowFromID
     2993                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     2994                   CM_SETCNRINFO, MPFROMP(&cnri),
     2995                   MPFROMLONG(CMA_FLWINDOWATTR));
    29922996      }
    29932997      break;
     
    30593063      fNoTreeGap = TRUE;
    30603064      {
    3061         ULONG flWindowAttr;
    3062 
    3063         flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
    3064         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3065                             &flWindowAttr, sizeof(ULONG));
    3066         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3067                             &flWindowAttr, sizeof(ULONG));
     3065        ULONG flWindowAttr;
     3066
     3067        flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
     3068        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3069                            &flWindowAttr, sizeof(ULONG));
     3070        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3071                            &flWindowAttr, sizeof(ULONG));
    30683072      }
    30693073      dsDirCnrDefault.detailslongname = FALSE;
     
    30833087      if (hwndMain) {
    30843088
    3085         SWP swp;
    3086 
    3087         if (WinQueryWindowPos(hwndMain, &swp)) {
    3088           WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3089                           swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
    3090         }
    3091         if (MenuInvisible)
    3092           WinSendMsg(hwndMain, WM_COMMAND,
    3093                      MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    3094         if (fAutoView)
    3095           WinSendMsg(hwndMain, WM_COMMAND,
    3096                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    3097         if (fToolbar)
    3098           WinSendMsg(hwndMain, WM_COMMAND,
    3099                      MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    3100         if (!fDrivebar)
    3101           WinSendMsg(hwndMain, WM_COMMAND,
    3102                      MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
    3103         if (!fMoreButtons)
    3104           WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
    3105                      MPVOID);
    3106         if (!fUserComboBox)
    3107           WinSendMsg(hwndMain, WM_COMMAND,
    3108                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     3089        SWP swp;
     3090
     3091        if (WinQueryWindowPos(hwndMain, &swp)) {
     3092          WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3093                          swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
     3094        }
     3095        if (MenuInvisible)
     3096          WinSendMsg(hwndMain, WM_COMMAND,
     3097                     MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
     3098        if (fAutoView)
     3099          WinSendMsg(hwndMain, WM_COMMAND,
     3100                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     3101        if (fToolbar)
     3102          WinSendMsg(hwndMain, WM_COMMAND,
     3103                     MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
     3104        if (!fDrivebar)
     3105          WinSendMsg(hwndMain, WM_COMMAND,
     3106                     MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
     3107        if (!fMoreButtons)
     3108          WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),
     3109                     MPVOID);
     3110        if (!fUserComboBox)
     3111          WinSendMsg(hwndMain, WM_COMMAND,
     3112                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    31093113      }
    31103114      if (hwndTree) {
    31113115
    3112         CNRINFO cnri;
    3113         ULONG flWindowAttr = (CV_TREE | CV_TEXT | CV_MINI |
    3114                               CV_FLOW | CA_TREELINE);
    3115 
    3116         memset(&cnri, 0, sizeof(cnri));
    3117         cnri.cb = sizeof(cnri);
    3118         WinSendMsg(WinWindowFromID
    3119                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3120                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3121         cnri.flWindowAttr = flWindowAttr;
    3122         WinSendMsg(WinWindowFromID
    3123                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3124                    CM_SETCNRINFO, MPFROMP(&cnri),
    3125                    MPFROMLONG(CMA_FLWINDOWATTR));
     3116        CNRINFO cnri;
     3117        ULONG flWindowAttr = (CV_TREE | CV_TEXT | CV_MINI |
     3118                              CV_FLOW | CA_TREELINE);
     3119
     3120        memset(&cnri, 0, sizeof(cnri));
     3121        cnri.cb = sizeof(cnri);
     3122        WinSendMsg(WinWindowFromID
     3123                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3124                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3125        cnri.flWindowAttr = flWindowAttr;
     3126        WinSendMsg(WinWindowFromID
     3127                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3128                   CM_SETCNRINFO, MPFROMP(&cnri),
     3129                   MPFROMLONG(CMA_FLWINDOWATTR));
    31263130      }
    31273131      break;
     
    31763180      fNoTreeGap = FALSE;
    31773181      {
    3178         ULONG flWindowAttr;
    3179 
    3180         flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
    3181         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3182                             &flWindowAttr, sizeof(ULONG));
    3183         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3184                             &flWindowAttr, sizeof(ULONG));
     3182        ULONG flWindowAttr;
     3183
     3184        flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);
     3185        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3186                            &flWindowAttr, sizeof(ULONG));
     3187        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3188                            &flWindowAttr, sizeof(ULONG));
    31853189      }
    31863190      dsDirCnrDefault.detailslongname = FALSE;
     
    32003204      if (hwndMain) {
    32013205
    3202         SWP swp;
    3203 
    3204         if (WinQueryWindowPos(hwndMain, &swp)) {
    3205           WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3206                           swp.cx / 5,
    3207                           swp.cy -
    3208                           (WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2),
    3209                           SWP_MOVE | SWP_SIZE);
    3210         }
     3206        SWP swp;
     3207
     3208        if (WinQueryWindowPos(hwndMain, &swp)) {
     3209          WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3210                          swp.cx / 5,
     3211                          swp.cy -
     3212                          (WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2),
     3213                          SWP_MOVE | SWP_SIZE);
     3214        }
    32113215      }
    32123216      if (hwndTree) {
    32133217
    3214         CNRINFO cnri;
    3215         ULONG flWindowAttr = (CV_TREE | CV_TEXT |
    3216                               CV_FLOW | CA_TREELINE | CV_MINI);
    3217 
    3218         memset(&cnri, 0, sizeof(cnri));
    3219         cnri.cb = sizeof(cnri);
    3220         WinSendMsg(WinWindowFromID
    3221                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3222                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3223         cnri.flWindowAttr = flWindowAttr;
    3224         WinSendMsg(WinWindowFromID
    3225                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3226                    CM_SETCNRINFO, MPFROMP(&cnri),
    3227                    MPFROMLONG(CMA_FLWINDOWATTR));
     3218        CNRINFO cnri;
     3219        ULONG flWindowAttr = (CV_TREE | CV_TEXT |
     3220                              CV_FLOW | CA_TREELINE | CV_MINI);
     3221
     3222        memset(&cnri, 0, sizeof(cnri));
     3223        cnri.cb = sizeof(cnri);
     3224        WinSendMsg(WinWindowFromID
     3225                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3226                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3227        cnri.flWindowAttr = flWindowAttr;
     3228        WinSendMsg(WinWindowFromID
     3229                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3230                   CM_SETCNRINFO, MPFROMP(&cnri),
     3231                   MPFROMLONG(CMA_FLWINDOWATTR));
    32283232      }
    32293233      break;
     
    32403244      fDCOpens = FALSE;
    32413245      {
    3242         ULONG flWindowAttr;
    3243 
    3244         flWindowAttr = CV_NAME | CV_FLOW | CA_DETAILSVIEWTITLES;
    3245         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3246                             &flWindowAttr, sizeof(ULONG));
    3247         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3248                             &flWindowAttr, sizeof(ULONG));
     3246        ULONG flWindowAttr;
     3247
     3248        flWindowAttr = CV_NAME | CV_FLOW | CA_DETAILSVIEWTITLES;
     3249        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3250                            &flWindowAttr, sizeof(ULONG));
     3251        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3252                            &flWindowAttr, sizeof(ULONG));
    32493253      }
    32503254      fLinkSetsIcon = FALSE;
     
    32573261      fUserListSwitches = TRUE;
    32583262      WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), UM_UNDO, MPVOID,
    3259                 MPVOID);
     3263                MPVOID);
    32603264      if (hwndTree) {
    32613265
    3262         CNRINFO cnri;
    3263         ULONG flWindowAttr = CV_TREE | CV_MINI | CV_ICON |
    3264           CV_FLOW | CA_TREELINE;
    3265 
    3266         memset(&cnri, 0, sizeof(cnri));
    3267         cnri.cb = sizeof(cnri);
    3268         WinSendMsg(WinWindowFromID
    3269                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3270                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3271         cnri.flWindowAttr = flWindowAttr;
    3272         WinSendMsg(WinWindowFromID
    3273                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3274                    CM_SETCNRINFO, MPFROMP(&cnri),
    3275                    MPFROMLONG(CMA_FLWINDOWATTR));
     3266        CNRINFO cnri;
     3267        ULONG flWindowAttr = CV_TREE | CV_MINI | CV_ICON |
     3268          CV_FLOW | CA_TREELINE;
     3269
     3270        memset(&cnri, 0, sizeof(cnri));
     3271        cnri.cb = sizeof(cnri);
     3272        WinSendMsg(WinWindowFromID
     3273                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3274                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3275        cnri.flWindowAttr = flWindowAttr;
     3276        WinSendMsg(WinWindowFromID
     3277                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3278                   CM_SETCNRINFO, MPFROMP(&cnri),
     3279                   MPFROMLONG(CMA_FLWINDOWATTR));
    32763280      }
    32773281      if (hwndMain) {
    3278         if (fAutoView)
    3279           WinSendMsg(hwndMain, WM_COMMAND,
    3280                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    3281         if (!fDrivebar)
    3282           WinSendMsg(hwndMain, WM_COMMAND,
    3283                      MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
    3284         {
    3285           SWP swp;
    3286 
    3287           if (WinQueryWindowPos(hwndMain, &swp)) {
    3288             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3289                             swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
    3290           }
    3291         }
    3292         PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
    3293         PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID);
     3282        if (fAutoView)
     3283          WinSendMsg(hwndMain, WM_COMMAND,
     3284                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     3285        if (!fDrivebar)
     3286          WinSendMsg(hwndMain, WM_COMMAND,
     3287                     MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);
     3288        {
     3289          SWP swp;
     3290
     3291          if (WinQueryWindowPos(hwndMain, &swp)) {
     3292            WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3293                            swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
     3294          }
     3295        }
     3296        PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
     3297        PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID);
    32943298      }
    32953299      return 0;
     
    33053309      fTopDir = FALSE;
    33063310      if (hwndMain) {
    3307         if (!fTextTools)
    3308           WinSendMsg(hwndMain, WM_COMMAND,
    3309                      MPFROM2SHORT(IDM_TEXTTOOLS, 0), MPVOID);
     3311        if (!fTextTools)
     3312          WinSendMsg(hwndMain, WM_COMMAND,
     3313                     MPFROM2SHORT(IDM_TEXTTOOLS, 0), MPVOID);
    33103314      }
    33113315      {
    3312         ULONG flWindowAttr;
    3313 
    3314         flWindowAttr = CV_TEXT | CV_FLOW | CA_DETAILSVIEWTITLES;
    3315         PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
    3316                             &flWindowAttr, sizeof(ULONG));
    3317         PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
    3318                             &flWindowAttr, sizeof(ULONG));
     3316        ULONG flWindowAttr;
     3317
     3318        flWindowAttr = CV_TEXT | CV_FLOW | CA_DETAILSVIEWTITLES;
     3319        PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",
     3320                            &flWindowAttr, sizeof(ULONG));
     3321        PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
     3322                            &flWindowAttr, sizeof(ULONG));
    33193323      }
    33203324      if (hwndTree) {
    33213325
    3322         CNRINFO cnri;
    3323         ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
    3324 
    3325         memset(&cnri, 0, sizeof(cnri));
    3326         cnri.cb = sizeof(cnri);
    3327         WinSendMsg(WinWindowFromID
    3328                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3329                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3330         cnri.flWindowAttr = flWindowAttr;
    3331         WinSendMsg(WinWindowFromID
    3332                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    3333                    CM_SETCNRINFO, MPFROMP(&cnri),
    3334                    MPFROMLONG(CMA_FLWINDOWATTR));
     3326        CNRINFO cnri;
     3327        ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;
     3328
     3329        memset(&cnri, 0, sizeof(cnri));
     3330        cnri.cb = sizeof(cnri);
     3331        WinSendMsg(WinWindowFromID
     3332                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3333                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3334        cnri.flWindowAttr = flWindowAttr;
     3335        WinSendMsg(WinWindowFromID
     3336                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     3337                   CM_SETCNRINFO, MPFROMP(&cnri),
     3338                   MPFROMLONG(CMA_FLWINDOWATTR));
    33353339      }
    33363340      /* intentional fallthru */
    33373341    case CFG9_1X:
    33383342      if (SHORT1FROMMP(mp1) == CFG9_1X) {
    3339         fTileBackwards = FALSE;
    3340         ulCnrType = CCS_MULTIPLESEL | CCS_EXTENDSEL;
    3341         fSwitchTree = FALSE;
    3342         fSwitchTreeOnFocus = FALSE;
    3343         fSwitchTreeExpand = FALSE;
    3344         fCollapseFirst = FALSE;
    3345         fFollowTree = FALSE;
    3346         fNoSearch = TRUE;
     3343        fTileBackwards = FALSE;
     3344        ulCnrType = CCS_MULTIPLESEL | CCS_EXTENDSEL;
     3345        fSwitchTree = FALSE;
     3346        fSwitchTreeOnFocus = FALSE;
     3347        fSwitchTreeExpand = FALSE;
     3348        fCollapseFirst = FALSE;
     3349        fFollowTree = FALSE;
     3350        fNoSearch = TRUE;
    33473351      }
    33483352      fAutoTile = TRUE;
     
    33583362      fUserListSwitches = TRUE;
    33593363      WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), UM_UNDO, MPVOID,
    3360                 MPVOID);
     3364                MPVOID);
    33613365      if (hwndTree) {
    33623366
    3363         CNRINFO cnri;
    3364         ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
    3365 
    3366         memset(&cnri, 0, sizeof(cnri));
    3367         cnri.cb = sizeof(cnri);
    3368         WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
    3369                                    TREE_CNR),
    3370                    CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
    3371         cnri.flWindowAttr = flWindowAttr;
    3372         WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
    3373                                    TREE_CNR),
    3374                    CM_SETCNRINFO,
    3375                    MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
     3367        CNRINFO cnri;
     3368        ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;
     3369
     3370        memset(&cnri, 0, sizeof(cnri));
     3371        cnri.cb = sizeof(cnri);
     3372        WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
     3373                                   TREE_CNR),
     3374                   CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));
     3375        cnri.flWindowAttr = flWindowAttr;
     3376        WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),
     3377                                   TREE_CNR),
     3378                   CM_SETCNRINFO,
     3379                   MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));
    33763380      }
    33773381      if (hwndMain) {
    3378         if (fAutoView)
    3379           WinSendMsg(hwndMain, WM_COMMAND,
    3380                      MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
    3381         if (fUserComboBox)
    3382           WinSendMsg(hwndMain, WM_COMMAND,
    3383                      MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
    3384         {
    3385           SWP swp;
    3386 
    3387           if (WinQueryWindowPos(hwndMain, &swp)) {
    3388             WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
    3389                             swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
    3390           }
    3391         }
    3392         PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
    3393         PostMsg(MainObjectHwnd, UM_SETDIR, MPVOID, MPVOID);
     3382        if (fAutoView)
     3383          WinSendMsg(hwndMain, WM_COMMAND,
     3384                     MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);
     3385        if (fUserComboBox)
     3386          WinSendMsg(hwndMain, WM_COMMAND,
     3387                     MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);
     3388        {
     3389          SWP swp;
     3390
     3391          if (WinQueryWindowPos(hwndMain, &swp)) {
     3392            WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,
     3393                            swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);
     3394          }
     3395        }
     3396        PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
     3397        PostMsg(MainObjectHwnd, UM_SETDIR, MPVOID, MPVOID);
    33943398      }
    33953399      return 0;
     
    34073411    // Save new details settings and refresh windows
    34083412    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    3409                         &dsDirCnrDefault.detailslongname, sizeof(BOOL));
     3413                        &dsDirCnrDefault.detailslongname, sizeof(BOOL));
    34103414    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    3411                         &dsDirCnrDefault.detailssubject, sizeof(BOOL));
     3415                        &dsDirCnrDefault.detailssubject, sizeof(BOOL));
    34123416    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    3413                         &dsDirCnrDefault.detailsea, sizeof(BOOL));
     3417                        &dsDirCnrDefault.detailsea, sizeof(BOOL));
    34143418    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    3415                         &dsDirCnrDefault.detailssize, sizeof(BOOL));
     3419                        &dsDirCnrDefault.detailssize, sizeof(BOOL));
    34163420    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    3417                         &dsDirCnrDefault.detailsicon, sizeof(BOOL));
     3421                        &dsDirCnrDefault.detailsicon, sizeof(BOOL));
    34183422    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    3419                         &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
     3423                        &dsDirCnrDefault.detailslwdate, sizeof(BOOL));
    34203424    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    3421                         &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
     3425                        &dsDirCnrDefault.detailslwtime, sizeof(BOOL));
    34223426    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    3423                         &dsDirCnrDefault.detailsladate, sizeof(BOOL));
     3427                        &dsDirCnrDefault.detailsladate, sizeof(BOOL));
    34243428    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    3425                         &dsDirCnrDefault.detailslatime, sizeof(BOOL));
     3429                        &dsDirCnrDefault.detailslatime, sizeof(BOOL));
    34263430    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    3427                         &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
     3431                        &dsDirCnrDefault.detailscrdate, sizeof(BOOL));
    34283432    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    3429                         &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
     3433                        &dsDirCnrDefault.detailscrtime, sizeof(BOOL));
    34303434    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    3431                         &dsDirCnrDefault.detailsattr, sizeof(BOOL));
     3435                        &dsDirCnrDefault.detailsattr, sizeof(BOOL));
    34323436    if (hwndMain) {
    34333437      // Save state and restore to refresh windows with new settings
    34343438      if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {
    3435         // Tell window procedure to close container windows
    3436         PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
    3437         // Restore saved state
    3438         PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);
     3439        // Tell window procedure to close container windows
     3440        PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
     3441        // Restore saved state
     3442        PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);
    34393443      }
    34403444    }
    34413445    WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER),
    3442                UM_UNDO, MPVOID, MPVOID);
     3446               UM_UNDO, MPVOID, MPVOID);
    34433447    return 0;
    34443448
     
    34753479  { IDM_BUBBLESSETTINGS, CFGB_FRAME, IDS_NOTEBUBBLE1TEXT, CfgBDlgProc, 0, 0, 0 },
    34763480  { IDM_QUICKSETTINGS, CFG9_FRAME, IDS_NOTEQUICK1TEXT, Cfg9DlgProc, 0, 0, 0 },
    3477   { 0, 0, 0, NULL, 0, 0, 0 }    // usFrameId 0 is end marker
     3481  { 0, 0, 0, NULL, 0, 0, 0 }    // usFrameId 0 is end marker
    34783482};
    34793483
     
    35133517      hwndTemp = WinQueryWindow(hwnd, QW_OWNER);
    35143518      if (hwndTemp != HWND_DESKTOP) {
    3515         HWND hwndMenu;
    3516         // Owner is frame if not applet
    3517         hwndMenu = WinWindowFromID(hwndTemp, FID_MENU);
    3518         if (hwndMenu == NULLHANDLE)
    3519           Runtime_Error(pszSrcFile, __LINE__, "FID_MENU");
    3520         else {
    3521           MENUITEM mi;
    3522           BOOL ok;
    3523           memset(&mi, 0, sizeof(mi));
    3524           ok = (BOOL)WinSendMsg(hwndMenu,
    3525                                 MM_QUERYITEM,
    3526                                 MPFROM2SHORT(IDM_NOTEBOOKSUBMENU, TRUE),
    3527                                 MPFROMP(&mi));
    3528           if (!ok)
    3529             Runtime_Error(pszSrcFile, __LINE__, "IDM_NOTEBOOKSUBMENU");
    3530           else {
    3531             mp2 = WinSendMsg(mi.hwndSubMenu, MM_QUERYDEFAULTITEMID, MPVOID, MPVOID);
    3532             if (!mp2)
    3533               Runtime_Error(pszSrcFile, __LINE__, "MM_QUERYDEFAULTITEMID");
    3534           }
    3535         }
     3519        HWND hwndMenu;
     3520        // Owner is frame if not applet
     3521        hwndMenu = WinWindowFromID(hwndTemp, FID_MENU);
     3522        if (hwndMenu == NULLHANDLE)
     3523          Runtime_Error(pszSrcFile, __LINE__, "FID_MENU");
     3524        else {
     3525          MENUITEM mi;
     3526          BOOL ok;
     3527          memset(&mi, 0, sizeof(mi));
     3528          ok = (BOOL)WinSendMsg(hwndMenu,
     3529                                MM_QUERYITEM,
     3530                                MPFROM2SHORT(IDM_NOTEBOOKSUBMENU, TRUE),
     3531                                MPFROMP(&mi));
     3532          if (!ok)
     3533            Runtime_Error(pszSrcFile, __LINE__, "IDM_NOTEBOOKSUBMENU");
     3534          else {
     3535            mp2 = WinSendMsg(mi.hwndSubMenu, MM_QUERYDEFAULTITEMID, MPVOID, MPVOID);
     3536            if (!mp2)
     3537              Runtime_Error(pszSrcFile, __LINE__, "MM_QUERYDEFAULTITEMID");
     3538          }
     3539        }
    35363540      }
    35373541    }
     
    35393543    PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
    35403544    WinSendDlgItemMsg(hwnd,
    3541                       CFG_NOTEBOOK,
    3542                       BKM_SETDIMENSIONS,
    3543                       MPFROM2SHORT(82, 24), MPFROMLONG(BKA_MAJORTAB));
     3545                      CFG_NOTEBOOK,
     3546                      BKM_SETDIMENSIONS,
     3547                      MPFROM2SHORT(82, 24), MPFROMLONG(BKA_MAJORTAB));
    35443548    WinSendDlgItemMsg(hwnd,
    3545                       CFG_NOTEBOOK,
    3546                       BKM_SETDIMENSIONS,
    3547                       MPFROM2SHORT(20, 20), MPFROMLONG(BKA_PAGEBUTTON));
     3549                      CFG_NOTEBOOK,
     3550                      BKM_SETDIMENSIONS,
     3551                      MPFROM2SHORT(20, 20), MPFROMLONG(BKA_PAGEBUTTON));
    35483552    WinSendDlgItemMsg(hwnd,
    3549                       CFG_NOTEBOOK,
    3550                       BKM_SETDIMENSIONS,
    3551                       MPFROM2SHORT(0, 0), MPFROMLONG(BKA_MINORTAB));
     3553                      CFG_NOTEBOOK,
     3554                      BKM_SETDIMENSIONS,
     3555                      MPFROM2SHORT(0, 0), MPFROMLONG(BKA_MINORTAB));
    35523556
    35533557    // Build and insert notebook pages
    35543558    for (x = 0; np[x].usFrameId; x++) {
    35553559      hwndTemp = WinLoadDlg(HWND_DESKTOP,
    3556                             HWND_DESKTOP,
    3557                             np[x].pfnPageProc, FM3ModHandle, np[x].usFrameId, MPVOID);
     3560                            HWND_DESKTOP,
     3561                            np[x].pfnPageProc, FM3ModHandle, np[x].usFrameId, MPVOID);
    35583562      if (!hwndTemp) {
    3559         Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    3560                   "Can not load settings page %u", x);
     3563        Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
     3564                  "Can not load settings page %u", x);
    35613565      }
    35623566      else {
    3563         WinSetWindowULong(hwndTemp, QWL_USER, (ULONG)hwnd);
    3564         np[x].hwnd = hwndTemp;
    3565         np[x].ulPageId = (ULONG)WinSendDlgItemMsg(hwnd,
    3566                                                 CFG_NOTEBOOK,
    3567                                                 BKM_INSERTPAGE,
    3568                                                 MPFROMLONG(BKA_FIRST),
    3569                                                 MPFROM2SHORT(BKA_AUTOPAGESIZE |
    3570                                                              BKA_STATUSTEXTON |
    3571                                                              BKA_MAJOR, attrib));
    3572         attrib = BKA_LAST;
    3573         WinSendDlgItemMsg(hwnd,
    3574                           CFG_NOTEBOOK,
    3575                           BKM_SETPAGEWINDOWHWND,
    3576                           MPFROMLONG(np[x].ulPageId), MPFROMLONG(np[x].hwnd));
    3577         WinSendDlgItemMsg(hwnd,
    3578                           CFG_NOTEBOOK,
    3579                           BKM_SETTABTEXT,
    3580                           MPFROMLONG(np[x].ulPageId),
    3581                           MPFROMP(GetPString(np[x].ulTitle)));
    3582         WinSendDlgItemMsg(hwnd,
    3583                           CFG_NOTEBOOK,
    3584                           BKM_SETSTATUSLINETEXT,
    3585                           MPFROMLONG(np[x].ulPageId),
    3586                           MPFROMP(GetPString(np[x].ulTitle + 1)));
    3587 
    3588         if (LONGFROMMP(mp2) == np[x].usMenuId)
    3589           uPageIndex = x;               // Remember selected page
     3567        WinSetWindowULong(hwndTemp, QWL_USER, (ULONG)hwnd);
     3568        np[x].hwnd = hwndTemp;
     3569        np[x].ulPageId = (ULONG)WinSendDlgItemMsg(hwnd,
     3570                                                CFG_NOTEBOOK,
     3571                                                BKM_INSERTPAGE,
     3572                                                MPFROMLONG(BKA_FIRST),
     3573                                                MPFROM2SHORT(BKA_AUTOPAGESIZE |
     3574                                                             BKA_STATUSTEXTON |
     3575                                                             BKA_MAJOR, attrib));
     3576        attrib = BKA_LAST;
     3577        WinSendDlgItemMsg(hwnd,
     3578                          CFG_NOTEBOOK,
     3579                          BKM_SETPAGEWINDOWHWND,
     3580                          MPFROMLONG(np[x].ulPageId), MPFROMLONG(np[x].hwnd));
     3581        WinSendDlgItemMsg(hwnd,
     3582                          CFG_NOTEBOOK,
     3583                          BKM_SETTABTEXT,
     3584                          MPFROMLONG(np[x].ulPageId),
     3585                          MPFROMP(GetPString(np[x].ulTitle)));
     3586        WinSendDlgItemMsg(hwnd,
     3587                          CFG_NOTEBOOK,
     3588                          BKM_SETSTATUSLINETEXT,
     3589                          MPFROMLONG(np[x].ulPageId),
     3590                          MPFROMP(GetPString(np[x].ulTitle + 1)));
     3591
     3592        if (LONGFROMMP(mp2) == np[x].usMenuId)
     3593          uPageIndex = x;               // Remember selected page
    35903594      }
    35913595    } // for pages
     
    35963600    // 15 Feb 08 SHL fixme to do just once?
    35973601    if (mp2 == MPFROMLONG(IDM_QUICKSETTINGS) &&
    3598         x-- > 0 &&
    3599         np[x].hwnd &&
    3600         np[x].usFrameId == CFG9_FRAME)
     3602        x-- > 0 &&
     3603        np[x].hwnd &&
     3604        np[x].usFrameId == CFG9_FRAME)
    36013605    {
    36023606      // 10 Jan 08 SHL fixme to document what UM_SETDIR 1 means
    36033607      //PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1), MPVOID);
    36043608      PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
    3605               BKM_TURNTOPAGE, MPFROMLONG(np[x].ulPageId), MPVOID);
     3609              BKM_TURNTOPAGE, MPFROMLONG(np[x].ulPageId), MPVOID);
    36063610      PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(np[x].hwnd), MPVOID);
    36073611      PostMsg(np[x].hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
     
    36093613    else if (uPageIndex >= x) {
    36103614      Runtime_Error(pszSrcFile, __LINE__, "uPageIndex corrupted (%u)",
    3611                     uPageIndex);
     3615                    uPageIndex);
    36123616      uPageIndex = 0;
    36133617    }
    36143618    PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK),
    3615             BKM_TURNTOPAGE, MPFROMLONG(np[uPageIndex].ulPageId), MPVOID);
     3619            BKM_TURNTOPAGE, MPFROMLONG(np[uPageIndex].ulPageId), MPVOID);
    36163620    // 15 Feb 08 SHL fixme to put focus on first field of page
    36173621
     
    36643668      SaveLastPageIndex(hwnd);
    36653669      ulPageId = (ULONG) WinSendDlgItemMsg(hwnd,
    3666                                         CFG_NOTEBOOK,
    3667                                         BKM_QUERYPAGEID,
    3668                                         MPFROMLONG(0),
    3669                                         MPFROM2SHORT(BKA_TOP, 0));
     3670                                        CFG_NOTEBOOK,
     3671                                        BKM_QUERYPAGEID,
     3672                                        MPFROMLONG(0),
     3673                                        MPFROM2SHORT(BKA_TOP, 0));
    36703674      hwndTemp = (HWND) WinSendDlgItemMsg(hwnd,
    3671                                           CFG_NOTEBOOK,
    3672                                           BKM_QUERYPAGEWINDOWHWND,
    3673                                           MPFROMLONG(ulPageId), MPVOID);
     3675                                          CFG_NOTEBOOK,
     3676                                          BKM_QUERYPAGEWINDOWHWND,
     3677                                          MPFROMLONG(ulPageId), MPVOID);
    36743678      if (hwndTemp)
    3675         WinSendMsg(hwndTemp, UM_UNDO, MPVOID, MPVOID);
     3679        WinSendMsg(hwndTemp, UM_UNDO, MPVOID, MPVOID);
    36763680
    36773681      WinDismissDlg(hwnd, 0);
    36783682      break;
    36793683
    3680     case IDM_HELP:                      /* relay message to appropriate page's window */
     3684    case IDM_HELP:                      /* relay message to appropriate page's window */
    36813685      ulPageId = (ULONG) WinSendDlgItemMsg(hwnd,
    3682                                         CFG_NOTEBOOK,
    3683                                         BKM_QUERYPAGEID,
    3684                                         MPFROMLONG(0),
    3685                                         MPFROM2SHORT(BKA_TOP, 0));
     3686                                        CFG_NOTEBOOK,
     3687                                        BKM_QUERYPAGEID,
     3688                                        MPFROMLONG(0),
     3689                                        MPFROM2SHORT(BKA_TOP, 0));
    36863690      hwndTemp = (HWND) WinSendDlgItemMsg(hwnd,
    3687                                           CFG_NOTEBOOK,
    3688                                           BKM_QUERYPAGEWINDOWHWND,
    3689                                           MPFROMLONG(ulPageId), MPVOID);
     3691                                          CFG_NOTEBOOK,
     3692                                          BKM_QUERYPAGEWINDOWHWND,
     3693                                          MPFROMLONG(ulPageId), MPVOID);
    36903694      if (hwndTemp)
    3691         PostMsg(hwndTemp, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
     3695        PostMsg(hwndTemp, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);
    36923696      break;
    36933697    }
     
    36973701    for (x = 0; np[x].usFrameId; x++) {
    36983702      if (np[x].hwnd)
    3699         WinSendMsg(np[x].hwnd, UM_UNDO, MPVOID, MPVOID);
     3703        WinSendMsg(np[x].hwnd, UM_UNDO, MPVOID, MPVOID);
    37003704    }
    37013705    break;
     
    37043708    if (np[0].usFrameId) {
    37053709      for (x = 1; np[x].usFrameId; x++) {
    3706         if (np[x].hwnd) {
    3707           WinSendMsg(np[x].hwnd, WM_CLOSE, MPVOID, MPVOID);
    3708           np[x].hwnd = (HWND) 0;
    3709           np[x].ulPageId = 0;
    3710         }
     3710        if (np[x].hwnd) {
     3711          WinSendMsg(np[x].hwnd, WM_CLOSE, MPVOID, MPVOID);
     3712          np[x].hwnd = (HWND) 0;
     3713          np[x].ulPageId = 0;
     3714        }
    37113715      }
    37123716      WinSendMsg(np[0].hwnd, WM_CLOSE, MPVOID, MPVOID);
     
    37353739  PrfQueryProfileData(fmprof, appname, pszIK_LastSettingsPage, &uPageIndex, &ulSize);
    37363740  for (x = 0; x < uPageIndex && np[x].usFrameId; x++)
    3737     ;                                   // Search
     3741    ;                                   // Search
    37383742  if (np[x].usMenuId)
    37393743    SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[uPageIndex].usMenuId);
     
    37413745  if (fIsLite) {
    37423746    WinSendMsg(hwndMenu,
    3743                MM_DELETEITEM,
    3744                MPFROM2SHORT(IDM_QUICKSETTINGS, FALSE), MPVOID);
     3747               MM_DELETEITEM,
     3748               MPFROM2SHORT(IDM_QUICKSETTINGS, FALSE), MPVOID);
    37453749    // If fm/2 lite drop quick setting page
    37463750    for (x = 0; np[x].usFrameId && np[x].usFrameId != CFG9_FRAME; x++)
     
    37613765  if (hwndOwner != HWND_DESKTOP) {
    37623766    ulPageId = (ULONG)WinSendDlgItemMsg(hwnd,
    3763                                        CFG_NOTEBOOK,
    3764                                        BKM_QUERYPAGEID,
    3765                                        MPFROMLONG(0),
    3766                                        MPFROM2SHORT(BKA_TOP, 0));
     3767                                       CFG_NOTEBOOK,
     3768                                       BKM_QUERYPAGEID,
     3769                                       MPFROMLONG(0),
     3770                                       MPFROM2SHORT(BKA_TOP, 0));
    37673771    if (!ulPageId)
    37683772      Runtime_Error(pszSrcFile, __LINE__, "BKM_QUERYPAGEID");
    37693773    else {
    37703774      for (x = 0; np[x].usMenuId && np[x].ulPageId != ulPageId; x++)
    3771         ; // Scan
     3775        ; // Scan
    37723776      if (!np[x].usMenuId)
    3773         Runtime_Error(pszSrcFile, __LINE__, "bad menu id %lu", ulPageId);
     3777        Runtime_Error(pszSrcFile, __LINE__, "bad menu id %lu", ulPageId);
    37743778      else {
    3775         PrfWriteProfileData(fmprof, FM3Str, pszIK_LastSettingsPage,
    3776                             (PVOID)&x, sizeof(x));
    3777         hwndMenu = WinWindowFromID(hwndOwner, FID_MENU);
    3778         SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[x].usMenuId);
     3779        PrfWriteProfileData(fmprof, FM3Str, pszIK_LastSettingsPage,
     3780                            (PVOID)&x, sizeof(x));
     3781        hwndMenu = WinWindowFromID(hwndOwner, FID_MENU);
     3782        SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[x].usMenuId);
    37793783      }
    37803784    }
  • trunk/dll/pathutil.c

    r1047 r1161  
    2323
    2424#include "pathutil.h"
     25#include "strips.h"                     // remove_first_occurence_of_character
    2526#include "fm3dll.h"                     // needs_quoting
    2627#include "fm3str.h"
     
    6465{
    6566  UINT c = pszPathName ? strlen(pszPathName) : 0;
    66   BOOL q = needs_quoting(pszPathName) ||
    67            needs_quoting(pszFileName);
     67  BOOL q = needs_quoting(pszPathName) || needs_quoting(pszFileName);
    6868  PSZ psz = pszFullPathName;
    6969
  • trunk/dll/sortcnr.c

    r907 r1161  
    2121
    2222#include "fm3dll.h"
     23#include "sortcnr.h"
     24#include "valid.h"                      // TestCDates
     25
     26static SHORT SortCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2, INT Sortflags);
    2327
    2428SHORT APIENTRY SortTreeCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2,
    25                            PVOID pStorage)
     29                           PVOID pStorage)
    2630{
    2731  return SortCnr(p1, p2, ((pStorage) ? (INT) pStorage : TreesortFlags));
     
    2933
    3034SHORT APIENTRY SortDirCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2,
    31                           PVOID pStorage)
     35                          PVOID pStorage)
    3236{
    3337  DIRCNRDATA *dcd = WinQueryWindowPtr(((PCNRITEM) p1)->hwndCnr, QWL_USER);
    3438
    3539  return SortCnr(p1, p2, ((pStorage) ? (INT) pStorage :
    36                           (dcd && dcd->size == sizeof(DIRCNRDATA)) ?
    37                           dcd->sortFlags : sortFlags));
     40                          (dcd && dcd->size == sizeof(DIRCNRDATA)) ?
     41                          dcd->sortFlags : sortFlags));
    3842}
    3943
    4044SHORT APIENTRY SortCollectorCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2,
    41                                 PVOID pStorage)
     45                                PVOID pStorage)
    4246{
    4347  return SortCnr(p1, p2, ((pStorage) ? (INT) pStorage : CollectorsortFlags));
     
    5660    if (SortFlags & SORT_DIRSFIRST) {
    5761      if ((pCI1->attrFile & FILE_DIRECTORY) !=
    58           (pCI2->attrFile & FILE_DIRECTORY))
    59         return (pCI1->attrFile & FILE_DIRECTORY) ? -1 : 1;
     62          (pCI2->attrFile & FILE_DIRECTORY))
     63        return (pCI1->attrFile & FILE_DIRECTORY) ? -1 : 1;
    6064    }
    6165    else if (SortFlags & SORT_DIRSLAST) {
    6266      if ((pCI1->attrFile & FILE_DIRECTORY) !=
    63           (pCI2->attrFile & FILE_DIRECTORY))
    64         return (pCI1->attrFile & FILE_DIRECTORY) ? 1 : -1;
     67          (pCI2->attrFile & FILE_DIRECTORY))
     68        return (pCI1->attrFile & FILE_DIRECTORY) ? 1 : -1;
    6569    }
    6670    switch (SortFlags & (~(SORT_DIRSFIRST | SORT_DIRSLAST | SORT_REVERSE))) {
    6771    case SORT_SUBJECT:
    6872      if (*pCI1->pszSubject && *pCI2->pszSubject)
    69         ret = stricmp(pCI1->pszSubject, pCI2->pszSubject);
     73        ret = stricmp(pCI1->pszSubject, pCI2->pszSubject);
    7074      else {
    71         ret = (*pCI2->pszSubject) ? 1 : (*pCI1->pszSubject) ? -1 : 0;
    72         if (ret && (SortFlags & SORT_REVERSE))
    73           ret = (ret > 0) ? -1 : 1;
     75        ret = (*pCI2->pszSubject) ? 1 : (*pCI1->pszSubject) ? -1 : 0;
     76        if (ret && (SortFlags & SORT_REVERSE))
     77          ret = (ret > 0) ? -1 : 1;
    7478      }
    7579      break;
     
    7983      pch2 = strrchr(pCI2->pszFileName, '\\');
    8084      if (!pch1)
    81         pch1 = NullStr;
    82       if (!pch2)
    83         pch2 = NullStr;
     85        pch1 = NullStr;
     86      if (!pch2)
     87        pch2 = NullStr;
    8488      ret = stricmp(pch1, pch2);
    8589      break;
     
    8993      pch2 = strrchr(pCI2->pszFileName, '\\');
    9094      if (!pch1)
    91         pch1 = pCI1->pszFileName;
    92       if (!pch2)
    93         pch2 = pCI2->pszFileName;
     95        pch1 = pCI1->pszFileName;
     96      if (!pch2)
     97        pch2 = pCI2->pszFileName;
    9498      pch1 = strchr(pch1, '.');
    9599      pch2 = strchr(pch2, '.');
    96100      if (!pch1)
    97         pch1 = NullStr;
    98       if (!pch2)
    99         pch2 = NullStr;
     101        pch1 = NullStr;
     102      if (!pch2)
     103        pch2 = NullStr;
    100104      ret = stricmp(pch1, pch2);
    101105      break;
     
    105109      pch2 = strrchr(pCI2->pszFileName, '\\');
    106110      if (!pch1)
    107         pch1 = pCI1->pszFileName;
    108       if (!pch2)
    109         pch2 = pCI2->pszFileName;
     111        pch1 = pCI1->pszFileName;
     112      if (!pch2)
     113        pch2 = pCI2->pszFileName;
    110114      pch1 = strrchr(pch1, '.');
    111115      pch2 = strrchr(pch2, '.');
    112116      if (!pch1)
    113         pch1 = NullStr;
    114       if (!pch2)
    115         pch2 = NullStr;
     117        pch1 = NullStr;
     118      if (!pch2)
     119        pch2 = NullStr;
    116120      ret = stricmp(pch1, pch2);
    117121      break;
     
    119123    case SORT_SIZE:
    120124      ret =
    121         (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile ==
    122                                              pCI2->cbFile) ? 0 : -1;
     125        (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile ==
     126                                             pCI2->cbFile) ? 0 : -1;
    123127      if (!ret)
    124         ret =
    125           (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize ==
    126                                                pCI2->easize) ? 0 : -1;
     128        ret =
     129          (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize ==
     130                                               pCI2->easize) ? 0 : -1;
    127131      break;
    128132
    129133    case SORT_EASIZE:
    130134      ret =
    131         (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize ==
    132                                              pCI2->easize) ? 0 : -1;
     135        (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize ==
     136                                             pCI2->easize) ? 0 : -1;
    133137      if (!ret)
    134         ret =
    135           (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile ==
    136                                                pCI2->cbFile) ? 0 : -1;
     138        ret =
     139          (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile ==
     140                                               pCI2->cbFile) ? 0 : -1;
    137141      break;
    138142
     
    141145                        &pCI2->date, &pCI2->time);
    142146        /*(pCI1->date.year < pCI2->date.year) ? 1 :
    143         (pCI1->date.year > pCI2->date.year) ? -1 :
    144         (pCI1->date.month < pCI2->date.month) ? 1 :
    145         (pCI1->date.month > pCI2->date.month) ? -1 :
    146         (pCI1->date.day < pCI2->date.day) ? 1 :
    147         (pCI1->date.day > pCI2->date.day) ? -1 :
    148         (pCI1->time.hours < pCI2->time.hours) ? 1 :
    149         (pCI1->time.hours > pCI2->time.hours) ? -1 :
    150         (pCI1->time.minutes < pCI2->time.minutes) ? 1 :
    151         (pCI1->time.minutes > pCI2->time.minutes) ? -1 :
    152         (pCI1->time.seconds < pCI2->time.seconds) ? 1 :
    153         (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;*/
     147        (pCI1->date.year > pCI2->date.year) ? -1 :
     148        (pCI1->date.month < pCI2->date.month) ? 1 :
     149        (pCI1->date.month > pCI2->date.month) ? -1 :
     150        (pCI1->date.day < pCI2->date.day) ? 1 :
     151        (pCI1->date.day > pCI2->date.day) ? -1 :
     152        (pCI1->time.hours < pCI2->time.hours) ? 1 :
     153        (pCI1->time.hours > pCI2->time.hours) ? -1 :
     154        (pCI1->time.minutes < pCI2->time.minutes) ? 1 :
     155        (pCI1->time.minutes > pCI2->time.minutes) ? -1 :
     156        (pCI1->time.seconds < pCI2->time.seconds) ? 1 :
     157        (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;*/
    154158      break;
    155159
     
    158162                       &pCI2->ladate, &pCI2->latime);
    159163        /*(pCI1->ladate.year < pCI2->ladate.year) ? 1 :
    160         (pCI1->ladate.year > pCI2->ladate.year) ? -1 :
    161         (pCI1->ladate.month < pCI2->ladate.month) ? 1 :
    162         (pCI1->ladate.month > pCI2->ladate.month) ? -1 :
    163         (pCI1->ladate.day < pCI2->ladate.day) ? 1 :
    164         (pCI1->ladate.day > pCI2->ladate.day) ? -1 :
    165         (pCI1->latime.hours < pCI2->latime.hours) ? 1 :
    166         (pCI1->latime.hours > pCI2->latime.hours) ? -1 :
    167         (pCI1->latime.minutes < pCI2->latime.minutes) ? 1 :
    168         (pCI1->latime.minutes > pCI2->latime.minutes) ? -1 :
    169         (pCI1->latime.seconds < pCI2->latime.seconds) ? 1 :
    170         (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;*/
     164        (pCI1->ladate.year > pCI2->ladate.year) ? -1 :
     165        (pCI1->ladate.month < pCI2->ladate.month) ? 1 :
     166        (pCI1->ladate.month > pCI2->ladate.month) ? -1 :
     167        (pCI1->ladate.day < pCI2->ladate.day) ? 1 :
     168        (pCI1->ladate.day > pCI2->ladate.day) ? -1 :
     169        (pCI1->latime.hours < pCI2->latime.hours) ? 1 :
     170        (pCI1->latime.hours > pCI2->latime.hours) ? -1 :
     171        (pCI1->latime.minutes < pCI2->latime.minutes) ? 1 :
     172        (pCI1->latime.minutes > pCI2->latime.minutes) ? -1 :
     173        (pCI1->latime.seconds < pCI2->latime.seconds) ? 1 :
     174        (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;*/
    171175      break;
    172176
     
    175179                       &pCI2->crdate, &pCI2->crtime);
    176180        /*(pCI1->crdate.year < pCI2->crdate.year) ? 1 :
    177         (pCI1->crdate.year > pCI2->crdate.year) ? -1 :
    178         (pCI1->crdate.month < pCI2->crdate.month) ? 1 :
    179         (pCI1->crdate.month > pCI2->crdate.month) ? -1 :
    180         (pCI1->crdate.day < pCI2->crdate.day) ? 1 :
    181         (pCI1->crdate.day > pCI2->crdate.day) ? -1 :
    182         (pCI1->crtime.hours < pCI2->crtime.hours) ? 1 :
    183         (pCI1->crtime.hours > pCI2->crtime.hours) ? -1 :
    184         (pCI1->crtime.minutes < pCI2->crtime.minutes) ? 1 :
    185         (pCI1->crtime.minutes > pCI2->crtime.minutes) ? -1 :
    186         (pCI1->crtime.seconds < pCI2->crtime.seconds) ? 1 :
    187         (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;*/
     181        (pCI1->crdate.year > pCI2->crdate.year) ? -1 :
     182        (pCI1->crdate.month < pCI2->crdate.month) ? 1 :
     183        (pCI1->crdate.month > pCI2->crdate.month) ? -1 :
     184        (pCI1->crdate.day < pCI2->crdate.day) ? 1 :
     185        (pCI1->crdate.day > pCI2->crdate.day) ? -1 :
     186        (pCI1->crtime.hours < pCI2->crtime.hours) ? 1 :
     187        (pCI1->crtime.hours > pCI2->crtime.hours) ? -1 :
     188        (pCI1->crtime.minutes < pCI2->crtime.minutes) ? 1 :
     189        (pCI1->crtime.minutes > pCI2->crtime.minutes) ? -1 :
     190        (pCI1->crtime.seconds < pCI2->crtime.seconds) ? 1 :
     191        (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;*/
    188192      break;
    189193    }
  • trunk/dll/srchpath.c

    r907 r1161  
    2525#include "pathutil.h"                   // BldQuotedFileName
    2626#include "errutil.h"                    // Dos_Error...
     27#include "srchpath.h"
    2728#include "fm3dll.h"
    2829
  • trunk/dll/undel.c

    r1075 r1161  
    3333#include "strutil.h"                    // GetPString
    3434#include "pathutil.h"                   // BldFullPathName
     35#include "walkem.h"                     // FillPathListBox
    3536#include "fm3dll.h"
    3637#include "fortify.h"
Note: See TracChangeset for help on using the changeset viewer.