| [123] | 1 | 
 | 
|---|
 | 2 | /***********************************************************************
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 |   $Id: walkem.c 1214 2008-09-13 06:53:34Z jbs $
 | 
|---|
 | 5 | 
 | 
|---|
| [1077] | 6 |   Misc persistent lists support
 | 
|---|
 | 7 | 
 | 
|---|
| [123] | 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| [1082] | 9 |   Copyright (c) 2005, 2008 Steven H. Levine
 | 
|---|
| [123] | 10 | 
 | 
|---|
| [186] | 11 |   01 Aug 04 SHL Rework lstrip/rstrip usage
 | 
|---|
 | 12 |   05 Jun 05 SHL Use QWL_USER
 | 
|---|
| [242] | 13 |   13 Aug 05 SHL Run through indent
 | 
|---|
| [259] | 14 |   13 Aug 05 SHL remove_udir - avoid corrupting last dirs list
 | 
|---|
| [328] | 15 |   17 Jul 06 SHL Use Runtime_Error
 | 
|---|
| [404] | 16 |   29 Jul 06 SHL Use xfgets
 | 
|---|
| [518] | 17 |   20 Oct 06 SHL Correct . .. check
 | 
|---|
| [544] | 18 |   06 Nov 06 SHL Oops - need to allow .. here
 | 
|---|
 | 19 |   14 Nov 06 SHL Correct FillPathListBox regression
 | 
|---|
| [574] | 20 |   22 Mar 07 GKY Use QWL_USER
 | 
|---|
| [617] | 21 |   20 Apr 07 SHL Avoid spurious add_udir error reports
 | 
|---|
| [787] | 22 |   16 Aug 07 SHL Update add_setups for ticket# 109
 | 
|---|
| [789] | 23 |   19 Aug 07 SHL Correct load_setups error reporting
 | 
|---|
| [794] | 24 |   20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
 | 
|---|
| [807] | 25 |   25 Aug 07 SHL Correct #pragma alloc_text typos
 | 
|---|
| [864] | 26 |   11 Nov 07 GKY Cancel now directly closes dialog even if directory path text has changed
 | 
|---|
| [939] | 27 |   20 Jan 08 GKY Walk & walk2 dialogs now save and restore size and position
 | 
|---|
| [965] | 28 |   19 Feb 08 JBS Add "State at last FM/2 close" to the states combo box
 | 
|---|
| [985] | 29 |   29 Feb 08 GKY Use xfree where appropriate
 | 
|---|
 | 30 |   29 Feb 08 GKY Refactor global command line variables to notebook.h
 | 
|---|
| [1027] | 31 |   19 Jun 08 JBS Ticket 227: Allow temporary saving/deleting of the shutdown state of directory containers
 | 
|---|
| [1029] | 32 |   22 Jun 08 GKY Add free_?dir for fortify testing
 | 
|---|
| [1078] | 33 |   18 Jul 08 SHL More Fortify support
 | 
|---|
| [1082] | 34 |   19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory and use BldFullPathName
 | 
|---|
| [1119] | 35 |   24 Aug 08 GKY Warn full drive on save of .DAT file; prevent loss of existing file
 | 
|---|
| [123] | 36 | 
 | 
|---|
 | 37 | ***********************************************************************/
 | 
|---|
 | 38 | 
 | 
|---|
| [907] | 39 | #include <stdlib.h>
 | 
|---|
 | 40 | #include <string.h>
 | 
|---|
 | 41 | #include <ctype.h>
 | 
|---|
 | 42 | #include <share.h>
 | 
|---|
 | 43 | 
 | 
|---|
| [2] | 44 | #define INCL_WIN
 | 
|---|
 | 45 | #define INCL_DOS
 | 
|---|
 | 46 | #define INCL_DOSERRORS
 | 
|---|
| [787] | 47 | #define INCL_SHLERRORS                  // PMERR_NOT_IN_IDX
 | 
|---|
| [841] | 48 | #define INCL_LONGLONG
 | 
|---|
| [2] | 49 | 
 | 
|---|
| [1186] | 50 | #include "fm3dll.h"
 | 
|---|
| [1214] | 51 | #include "arccnrs.h"                    // Data declaration(s)
 | 
|---|
 | 52 | #include "info.h"                       // Data declaration(s)
 | 
|---|
 | 53 | #include "init.h"                       // Data declaration(s)
 | 
|---|
 | 54 | #include "mainwnd.h"                    // Data declaration(s)
 | 
|---|
| [2] | 55 | #include "fm3dlg.h"
 | 
|---|
 | 56 | #include "fm3str.h"
 | 
|---|
| [907] | 57 | #include "errutil.h"                    // Dos_Error...
 | 
|---|
 | 58 | #include "strutil.h"                    // GetPString
 | 
|---|
| [1077] | 59 | #include "notebook.h"                   // targetdirectory
 | 
|---|
| [1082] | 60 | #include "pathutil.h"                   // BldFullPathName
 | 
|---|
| [1162] | 61 | #include "walkem.h"
 | 
|---|
| [1186] | 62 | #include "valid.h"                      // MakeFullName
 | 
|---|
 | 63 | #include "chklist.h"                    // PosOverOkay
 | 
|---|
 | 64 | #include "mkdir.h"                      // SetDir
 | 
|---|
 | 65 | #include "wrappers.h"                   // xfgets
 | 
|---|
 | 66 | #include "strips.h"                     // bstrip
 | 
|---|
 | 67 | #include "misc.h"                       // CheckDriveSpaceAvail
 | 
|---|
 | 68 | #include "dirs.h"                       // save_dir2
 | 
|---|
| [1039] | 69 | #include "fortify.h"
 | 
|---|
| [2] | 70 | 
 | 
|---|
| [242] | 71 | typedef struct
 | 
|---|
 | 72 | {
 | 
|---|
| [551] | 73 |   USHORT size;
 | 
|---|
 | 74 |   USHORT changed;
 | 
|---|
 | 75 |   BOOL nounwriteable;
 | 
|---|
 | 76 |   CHAR szCurrentPath[CCHMAXPATH];
 | 
|---|
 | 77 |   CHAR *szReturnPath;
 | 
|---|
 | 78 | }
 | 
|---|
 | 79 | WALKER;
 | 
|---|
| [2] | 80 | 
 | 
|---|
| [1214] | 81 | static MRESULT EXPENTRY WalkTwoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
 | 
|---|
 | 82 | static VOID load_setups(VOID);
 | 
|---|
 | 83 | static BOOL remove_ldir(PSZ path);
 | 
|---|
 | 84 | 
 | 
|---|
 | 85 | // Data definitions
 | 
|---|
 | 86 | #pragma data_seg(DATA1)
 | 
|---|
 | 87 | 
 | 
|---|
 | 88 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
| [242] | 89 | static CHAR WalkFont[CCHMAXPATH] = "";
 | 
|---|
| [2] | 90 | static ULONG WalkFontSize = sizeof(WalkFont);
 | 
|---|
 | 91 | 
 | 
|---|
| [787] | 92 | /**
 | 
|---|
 | 93 |  * States names management
 | 
|---|
 | 94 |  */
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 | static BOOL fSetupsLoaded;
 | 
|---|
 | 97 | static LINKDIRS *pFirstSetup;
 | 
|---|
 | 98 | static const PSZ pszLastSetups = "LastSetups";
 | 
|---|
| [907] | 99 | // 18 Aug 07 SHL fixme to stop supporting old style 1 year from now?
 | 
|---|
| [787] | 100 | static const ULONG ulOldSetupsBytes = 100 * 13; // Prior to 3.0.7
 | 
|---|
 | 101 | 
 | 
|---|
| [1214] | 102 | #pragma data_seg(GLOBAL1)
 | 
|---|
 | 103 | BOOL fUdirsChanged;
 | 
|---|
 | 104 | BOOL loadedudirs;
 | 
|---|
 | 105 | 
 | 
|---|
 | 106 | #pragma data_seg(GLOBAL2)
 | 
|---|
 | 107 | LINKDIRS *ldirhead;
 | 
|---|
 | 108 | LINKDIRS *udirhead;
 | 
|---|
 | 109 | 
 | 
|---|
| [787] | 110 | /**
 | 
|---|
 | 111 |  * Fill States drop down list with known state names
 | 
|---|
 | 112 |  */
 | 
|---|
 | 113 | 
 | 
|---|
 | 114 | VOID fill_setups_list(VOID)
 | 
|---|
| [242] | 115 | {
 | 
|---|
| [787] | 116 |   WinSendMsg(hwndStatelist, LM_DELETEALL, MPVOID, MPVOID);
 | 
|---|
 | 117 |   if (fUserComboBox) {
 | 
|---|
 | 118 |     LINKDIRS *pld;
 | 
|---|
 | 119 |     load_setups();
 | 
|---|
 | 120 |     for (pld = pFirstSetup; pld; pld = pld->next) {
 | 
|---|
 | 121 |       // DbgMsg(pszSrcFile, __LINE__, "Inserted %s", pld->path);
 | 
|---|
 | 122 |       WinSendMsg(hwndStatelist,
 | 
|---|
 | 123 |                  LM_INSERTITEM,
 | 
|---|
 | 124 |                  MPFROM2SHORT(LIT_SORTASCENDING, 0),
 | 
|---|
 | 125 |                  MPFROMP(pld->path));
 | 
|---|
 | 126 |     }
 | 
|---|
 | 127 |     WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
 | 
|---|
 | 128 |   }
 | 
|---|
 | 129 | }
 | 
|---|
| [2] | 130 | 
 | 
|---|
| [787] | 131 | /**
 | 
|---|
 | 132 |  * Lookup setup and do requested action
 | 
|---|
 | 133 |  * @param - action, Support old/new style storage method
 | 
|---|
 | 134 |  * @return 1 if found and action OK, 0 if not found and action OK, -1 if error during action
 | 
|---|
 | 135 |  */
 | 
|---|
 | 136 | 
 | 
|---|
 | 137 | #define LS_FIND         0
 | 
|---|
 | 138 | #define LS_ADD          1
 | 
|---|
 | 139 | #define LS_DELETE       2
 | 
|---|
 | 140 | 
 | 
|---|
 | 141 | static INT lookup_setup(PSZ name, UINT action)
 | 
|---|
 | 142 | {
 | 
|---|
 | 143 |   LINKDIRS *pld;
 | 
|---|
 | 144 |   LINKDIRS *pldLast = NULL;
 | 
|---|
 | 145 | 
 | 
|---|
 | 146 |   if (!name || !*name) {
 | 
|---|
 | 147 |     Runtime_Error(pszSrcFile, __LINE__, "no data");
 | 
|---|
 | 148 |     return -1;
 | 
|---|
 | 149 |   }
 | 
|---|
 | 150 | 
 | 
|---|
 | 151 |   load_setups();
 | 
|---|
 | 152 | 
 | 
|---|
 | 153 |   for (pld = pFirstSetup; pld; pld = pld->next) {
 | 
|---|
 | 154 |     if (!stricmp(pld->path, name)) {
 | 
|---|
 | 155 |       if (action == LS_DELETE) {
 | 
|---|
 | 156 |         if (pldLast)
 | 
|---|
 | 157 |           pldLast->next = pld->next;
 | 
|---|
 | 158 |         else
 | 
|---|
 | 159 |           pFirstSetup = pld->next;
 | 
|---|
| [1009] | 160 |         xfree(pld->path, pszSrcFile, __LINE__);
 | 
|---|
| [1039] | 161 |         free(pld);
 | 
|---|
| [787] | 162 |       }
 | 
|---|
 | 163 |       return 1;                         // Found or added
 | 
|---|
 | 164 |     }
 | 
|---|
 | 165 |     pldLast = pld;                      // In case deleting
 | 
|---|
 | 166 |   } // for
 | 
|---|
 | 167 | 
 | 
|---|
 | 168 |   // Not found
 | 
|---|
 | 169 |   if (action == LS_ADD) {
 | 
|---|
 | 170 |     pld = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__);
 | 
|---|
 | 171 |     if (!pld)
 | 
|---|
 | 172 |       return -1;
 | 
|---|
 | 173 |     pld->path = xstrdup(name, pszSrcFile, __LINE__);
 | 
|---|
 | 174 |     if (!pld->path) {
 | 
|---|
| [1039] | 175 |       free(pld);
 | 
|---|
| [787] | 176 |       return -1;
 | 
|---|
 | 177 |     }
 | 
|---|
 | 178 |     // Insert at front of list - drop down will sort
 | 
|---|
 | 179 |     pld->next = pFirstSetup;
 | 
|---|
 | 180 |     pFirstSetup = pld;
 | 
|---|
 | 181 |     return 0;
 | 
|---|
 | 182 |   }
 | 
|---|
 | 183 | 
 | 
|---|
 | 184 |   return FALSE;                         // Not found
 | 
|---|
| [2] | 185 | }
 | 
|---|
 | 186 | 
 | 
|---|
| [787] | 187 | /**
 | 
|---|
 | 188 |  * Load state names from ini
 | 
|---|
 | 189 |  * Support old/new style storage method
 | 
|---|
 | 190 |  */
 | 
|---|
 | 191 | 
 | 
|---|
 | 192 | VOID load_setups(VOID)
 | 
|---|
| [242] | 193 | {
 | 
|---|
| [787] | 194 |   ULONG ulDataBytes;
 | 
|---|
 | 195 |   ULONG l;
 | 
|---|
 | 196 |   PSZ pszBuf;
 | 
|---|
 | 197 |   PSZ psz;
 | 
|---|
 | 198 |   LINKDIRS *pld;
 | 
|---|
 | 199 | 
 | 
|---|
 | 200 |   if (fSetupsLoaded)
 | 
|---|
| [551] | 201 |     return;
 | 
|---|
| [787] | 202 | 
 | 
|---|
 | 203 |   if (!PrfQueryProfileSize(fmprof, FM3Str, pszLastSetups, &ulDataBytes)) {
 | 
|---|
 | 204 |     // fixme to use generic hab
 | 
|---|
 | 205 |     ERRORID eid = WinGetLastError((HAB)0);
 | 
|---|
 | 206 |     if ((eid & 0xffff) != PMERR_NOT_IN_IDX) {
 | 
|---|
| [789] | 207 |       // Get error info back
 | 
|---|
 | 208 |       PrfQueryProfileSize(fmprof, FM3Str, pszLastSetups, &ulDataBytes);
 | 
|---|
 | 209 |       Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, "PrfQueryProfileSize");
 | 
|---|
| [787] | 210 |     }
 | 
|---|
| [789] | 211 |     else
 | 
|---|
 | 212 |       fSetupsLoaded = TRUE;             // Nothing saved
 | 
|---|
 | 213 |     return;
 | 
|---|
| [787] | 214 |   }
 | 
|---|
 | 215 | 
 | 
|---|
 | 216 |   if (ulDataBytes == 0) {
 | 
|---|
 | 217 |     Runtime_Error(pszSrcFile, __LINE__, "PrfQueryProfileSize reported 0 bytes");
 | 
|---|
 | 218 |     return;
 | 
|---|
 | 219 |   }
 | 
|---|
 | 220 | 
 | 
|---|
 | 221 |   pszBuf = xmalloc(ulDataBytes + 1, pszSrcFile, __LINE__);      // One extra for end marker
 | 
|---|
 | 222 |   if (!pszBuf)
 | 
|---|
 | 223 |     return;
 | 
|---|
 | 224 |   l = ulDataBytes;
 | 
|---|
 | 225 |   if (!PrfQueryProfileData(fmprof, FM3Str, pszLastSetups, pszBuf, &l)) {
 | 
|---|
 | 226 |     Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, "PrfQueryProfileData");
 | 
|---|
| [1039] | 227 |     free(pszBuf);
 | 
|---|
| [787] | 228 |     return;
 | 
|---|
 | 229 |   }
 | 
|---|
 | 230 | 
 | 
|---|
 | 231 |   if (ulDataBytes != l) {
 | 
|---|
 | 232 |     Runtime_Error(pszSrcFile, __LINE__, "PrfQueryProfileData reported %u expected %u", l, ulDataBytes);
 | 
|---|
| [1039] | 233 |     free(pszBuf);
 | 
|---|
| [787] | 234 |     return;
 | 
|---|
 | 235 |   }
 | 
|---|
 | 236 | 
 | 
|---|
 | 237 |   *(pszBuf + ulDataBytes) = 0;                  // Insert end marker
 | 
|---|
 | 238 | 
 | 
|---|
 | 239 |   psz = pszBuf;
 | 
|---|
 | 240 |   if (!*psz && ulDataBytes == ulOldSetupsBytes)
 | 
|---|
 | 241 |     psz += 13;                  // Rarely used 1st fixed width entry prior to 3.0.7
 | 
|---|
 | 242 | 
 | 
|---|
 | 243 |   while (*psz) {
 | 
|---|
 | 244 |     pld = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__);
 | 
|---|
 | 245 |     if (!pld) {
 | 
|---|
| [1039] | 246 |       free(pszBuf);
 | 
|---|
| [787] | 247 |       return;
 | 
|---|
 | 248 |     }
 | 
|---|
| [1078] | 249 | 
 | 
|---|
 | 250 | #   ifdef FORTIFY
 | 
|---|
 | 251 |     Fortify_SetOwner(pld, 1);
 | 
|---|
 | 252 |     Fortify_SetScope(pld, 1);
 | 
|---|
 | 253 | #   endif
 | 
|---|
 | 254 | 
 | 
|---|
| [787] | 255 |     pld->path = xstrdup(psz, pszSrcFile, __LINE__);
 | 
|---|
 | 256 |     if (!pld->path) {
 | 
|---|
| [1039] | 257 |       free(pszBuf);
 | 
|---|
 | 258 |       free(pld);
 | 
|---|
| [787] | 259 |       return;
 | 
|---|
 | 260 |     }
 | 
|---|
 | 261 | 
 | 
|---|
| [1078] | 262 | #   ifdef FORTIFY
 | 
|---|
 | 263 |     Fortify_SetOwner(pld->path, 1);
 | 
|---|
 | 264 |     Fortify_SetScope(pld->path, 1);
 | 
|---|
 | 265 | #   endif
 | 
|---|
 | 266 | 
 | 
|---|
| [787] | 267 |     // Insert at front of list - drop down will sort
 | 
|---|
 | 268 |     pld->next = pFirstSetup;
 | 
|---|
 | 269 |     pFirstSetup = pld;
 | 
|---|
 | 270 |     // DbgMsg(pszSrcFile, __LINE__, "Inserted %s", pld->path);
 | 
|---|
 | 271 | 
 | 
|---|
 | 272 |     if (ulDataBytes == ulOldSetupsBytes)
 | 
|---|
 | 273 |       psz += 13;                        // Buffers fixed width prior to 3.0.7
 | 
|---|
 | 274 |     else
 | 
|---|
 | 275 |       psz += strlen(psz) + 1;
 | 
|---|
 | 276 |   } // while
 | 
|---|
 | 277 | 
 | 
|---|
| [1039] | 278 |   free(pszBuf);
 | 
|---|
| [787] | 279 | 
 | 
|---|
 | 280 |   fSetupsLoaded = TRUE;
 | 
|---|
| [2] | 281 | }
 | 
|---|
 | 282 | 
 | 
|---|
| [787] | 283 | VOID save_setups(VOID)
 | 
|---|
| [242] | 284 | {
 | 
|---|
| [787] | 285 |   ULONG ulBufBytes;
 | 
|---|
 | 286 |   ULONG ulFillBytes;
 | 
|---|
 | 287 |   ULONG l;
 | 
|---|
 | 288 |   PSZ pszBuf;
 | 
|---|
 | 289 |   PSZ psz;
 | 
|---|
 | 290 |   LINKDIRS *pld;
 | 
|---|
| [2] | 291 | 
 | 
|---|
| [787] | 292 |   if (!fSetupsLoaded)
 | 
|---|
 | 293 |     return;
 | 
|---|
 | 294 | 
 | 
|---|
 | 295 |   ulBufBytes = 0;
 | 
|---|
 | 296 |   for (pld = pFirstSetup; pld; pld = pld->next) {
 | 
|---|
 | 297 |     ulBufBytes += strlen(pld->path) + 1;
 | 
|---|
 | 298 |   } // for
 | 
|---|
 | 299 | 
 | 
|---|
 | 300 |   if (!ulBufBytes)
 | 
|---|
 | 301 |     pszBuf = NULL;
 | 
|---|
 | 302 |   else {
 | 
|---|
 | 303 |     // Ensure different than size prior to 3.0.7
 | 
|---|
 | 304 |     ulFillBytes = ulBufBytes == ulOldSetupsBytes ? 1 : 0;
 | 
|---|
 | 305 |     pszBuf = xmalloc(ulBufBytes + ulFillBytes, pszSrcFile, __LINE__);
 | 
|---|
 | 306 |     if (!pszBuf)
 | 
|---|
 | 307 |       return;
 | 
|---|
 | 308 | 
 | 
|---|
 | 309 |     psz = pszBuf;
 | 
|---|
 | 310 |     for (pld = pFirstSetup; pld; pld = pld->next) {
 | 
|---|
 | 311 |       l = strlen(pld->path) + 1;
 | 
|---|
 | 312 |       memcpy(psz, pld->path, l);
 | 
|---|
 | 313 |       psz += l;
 | 
|---|
 | 314 |     } // for
 | 
|---|
 | 315 |     if (ulFillBytes)
 | 
|---|
 | 316 |       *psz = 0;
 | 
|---|
| [551] | 317 |   }
 | 
|---|
| [787] | 318 | 
 | 
|---|
 | 319 |   if (!PrfWriteProfileData(fmprof,
 | 
|---|
 | 320 |                            FM3Str,
 | 
|---|
 | 321 |                             pszLastSetups, pszBuf, ulBufBytes)) {
 | 
|---|
 | 322 |     // Win_Error(pszSrcFile, __LINE__, HWND_DESKTOP, HWND_DESKTOP, "PrfWriteProfileData");
 | 
|---|
 | 323 |     ERRORID eid = WinGetLastError((HAB)0);
 | 
|---|
 | 324 |     if ((eid & 0xffff) != PMERR_NOT_IN_IDX)
 | 
|---|
 | 325 |       Runtime_Error(pszSrcFile, __LINE__, "PrfWriteProfileData returned %u", eid);
 | 
|---|
 | 326 |   }
 | 
|---|
 | 327 | 
 | 
|---|
 | 328 |   // Delete obsolete INI entry
 | 
|---|
 | 329 |   PrfWriteProfileData(fmprof, FM3Str, "LastSetup", NULL, 0);
 | 
|---|
| [2] | 330 | }
 | 
|---|
 | 331 | 
 | 
|---|
| [787] | 332 | /**
 | 
|---|
 | 333 |  * Add named state to setups list
 | 
|---|
 | 334 |  * @return same as lookup_setup
 | 
|---|
 | 335 |  */
 | 
|---|
 | 336 | 
 | 
|---|
 | 337 | INT add_setup(PSZ name)
 | 
|---|
| [242] | 338 | {
 | 
|---|
| [787] | 339 |   return lookup_setup(name, LS_ADD);
 | 
|---|
 | 340 | }
 | 
|---|
| [2] | 341 | 
 | 
|---|
| [787] | 342 | /**
 | 
|---|
 | 343 |  * Delete named state from setups list
 | 
|---|
 | 344 |  * @return same as lookup_setup
 | 
|---|
 | 345 |  */
 | 
|---|
 | 346 | 
 | 
|---|
 | 347 | INT remove_setup(PSZ name)
 | 
|---|
 | 348 | {
 | 
|---|
 | 349 |   return lookup_setup(name, LS_DELETE);
 | 
|---|
| [2] | 350 | }
 | 
|---|
 | 351 | 
 | 
|---|
| [1077] | 352 | #ifdef FORTIFY
 | 
|---|
 | 353 | 
 | 
|---|
 | 354 | VOID free_setups(VOID)
 | 
|---|
 | 355 | {
 | 
|---|
 | 356 |   LINKDIRS *pld = pFirstSetup;
 | 
|---|
 | 357 |   while (pld) {
 | 
|---|
 | 358 |     LINKDIRS *next = pld->next;
 | 
|---|
 | 359 |     free(pld->path);
 | 
|---|
 | 360 |     free(pld);
 | 
|---|
 | 361 |     pld = next;
 | 
|---|
 | 362 |   }
 | 
|---|
 | 363 |   pFirstSetup = NULL;
 | 
|---|
 | 364 | }
 | 
|---|
 | 365 | 
 | 
|---|
 | 366 | #endif // FORTIFY
 | 
|---|
 | 367 | 
 | 
|---|
| [242] | 368 | VOID load_udirs(VOID)
 | 
|---|
 | 369 | {
 | 
|---|
| [551] | 370 |   /* load linked list of user directories from USERDIRS.DAT file */
 | 
|---|
| [2] | 371 | 
 | 
|---|
| [551] | 372 |   FILE *fp;
 | 
|---|
 | 373 |   LINKDIRS *info;
 | 
|---|
 | 374 |   LINKDIRS *last = NULL;
 | 
|---|
 | 375 |   CHAR s[CCHMAXPATH + 24];
 | 
|---|
| [2] | 376 | 
 | 
|---|
| [1034] | 377 |   if (udirhead)
 | 
|---|
 | 378 |     free_udirs();
 | 
|---|
| [551] | 379 |   loadedudirs = TRUE;
 | 
|---|
 | 380 |   fUdirsChanged = FALSE;
 | 
|---|
| [1082] | 381 |   BldFullPathName(s, pFM2SaveDirectory, "USERDIRS.DAT");
 | 
|---|
| [551] | 382 |   fp = _fsopen(s, "r", SH_DENYWR);
 | 
|---|
 | 383 |   if (fp) {
 | 
|---|
 | 384 |     while (!feof(fp)) {
 | 
|---|
 | 385 |       if (!xfgets(s, CCHMAXPATH + 24, fp, pszSrcFile, __LINE__))
 | 
|---|
 | 386 |         break;
 | 
|---|
 | 387 |       s[CCHMAXPATH] = 0;
 | 
|---|
 | 388 |       bstripcr(s);
 | 
|---|
 | 389 |       if (*s && *s != ';') {
 | 
|---|
 | 390 |         info = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__);
 | 
|---|
| [1078] | 391 | #       ifdef FORTIFY
 | 
|---|
 | 392 |         Fortify_SetOwner(info, 1);
 | 
|---|
 | 393 |         Fortify_SetScope(info, 1);
 | 
|---|
 | 394 | #       endif
 | 
|---|
| [551] | 395 |         if (info) {
 | 
|---|
 | 396 |           info->path = xstrdup(s, pszSrcFile, __LINE__);
 | 
|---|
 | 397 |           if (!info->path)
 | 
|---|
| [1039] | 398 |             free(info);
 | 
|---|
| [551] | 399 |           else {
 | 
|---|
| [1078] | 400 | #           ifdef FORTIFY
 | 
|---|
 | 401 |             Fortify_SetOwner(info->path, 1);
 | 
|---|
 | 402 |             Fortify_SetScope(info->path, 1);
 | 
|---|
 | 403 | #           endif
 | 
|---|
| [551] | 404 |             info->next = NULL;
 | 
|---|
 | 405 |             if (!udirhead)
 | 
|---|
 | 406 |               udirhead = info;
 | 
|---|
 | 407 |             else
 | 
|---|
 | 408 |               last->next = info;
 | 
|---|
 | 409 |             last = info;
 | 
|---|
 | 410 |           }
 | 
|---|
| [242] | 411 |         }
 | 
|---|
| [551] | 412 |       }
 | 
|---|
| [2] | 413 |     }
 | 
|---|
| [551] | 414 |     fclose(fp);
 | 
|---|
 | 415 |   }
 | 
|---|
| [2] | 416 | }
 | 
|---|
 | 417 | 
 | 
|---|
| [242] | 418 | VOID save_udirs(VOID)
 | 
|---|
 | 419 | {
 | 
|---|
| [551] | 420 |   FILE *fp;
 | 
|---|
 | 421 |   LINKDIRS *info;
 | 
|---|
 | 422 |   CHAR s[CCHMAXPATH + 14];
 | 
|---|
| [2] | 423 | 
 | 
|---|
| [551] | 424 |   if (loadedudirs) {
 | 
|---|
 | 425 |     fUdirsChanged = FALSE;
 | 
|---|
 | 426 |     if (udirhead) {
 | 
|---|
| [1082] | 427 |       BldFullPathName(s, pFM2SaveDirectory, "USERDIRS.DAT");
 | 
|---|
| [1118] | 428 |       if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2)
 | 
|---|
| [1117] | 429 |         return; //already gave error msg
 | 
|---|
| [551] | 430 |       fp = xfopen(s, "w", pszSrcFile, __LINE__);
 | 
|---|
 | 431 |       if (fp) {
 | 
|---|
 | 432 |         fputs(GetPString(IDS_USERDEFDIRSTEXT), fp);
 | 
|---|
 | 433 |         info = udirhead;
 | 
|---|
 | 434 |         while (info) {
 | 
|---|
 | 435 |           fprintf(fp, "%0.*s\n", CCHMAXPATH, info->path);
 | 
|---|
 | 436 |           info = info->next;
 | 
|---|
| [242] | 437 |         }
 | 
|---|
| [551] | 438 |         fclose(fp);
 | 
|---|
 | 439 |       }
 | 
|---|
| [2] | 440 |     }
 | 
|---|
| [551] | 441 |   }
 | 
|---|
| [2] | 442 | }
 | 
|---|
 | 443 | 
 | 
|---|
| [617] | 444 | /**
 | 
|---|
 | 445 |  * Add path to user directory list or last used directory list.
 | 
|---|
 | 446 |  * Callers need to check fUdirsChanged to know if user dirs change occured.
 | 
|---|
 | 447 |  * Callers need to check return code to know if last dirs change occured.
 | 
|---|
 | 448 |  * @param userdirs TRUE to process user directory list. Otherwise last used list.
 | 
|---|
 | 449 |  * @return TRUE if added, FALSE if already in list or error.
 | 
|---|
 | 450 |  */
 | 
|---|
| [259] | 451 | 
 | 
|---|
| [617] | 452 | BOOL add_udir(BOOL userdirs, CHAR *inpath)
 | 
|---|
| [242] | 453 | {
 | 
|---|
| [551] | 454 |   CHAR path[CCHMAXPATH];
 | 
|---|
 | 455 |   LINKDIRS *info;
 | 
|---|
 | 456 |   LINKDIRS *last = NULL;
 | 
|---|
 | 457 |   LINKDIRS *temp;
 | 
|---|
| [2] | 458 | 
 | 
|---|
| [551] | 459 |   if (inpath && *inpath) {
 | 
|---|
 | 460 |     if (DosQueryPathInfo(inpath, FIL_QUERYFULLNAME, path, sizeof(path)))
 | 
|---|
 | 461 |       strcpy(path, inpath);
 | 
|---|
 | 462 |     if (!userdirs && IsRoot(path))
 | 
|---|
 | 463 |       return FALSE;
 | 
|---|
 | 464 |     if (IsFullName(path)) {
 | 
|---|
 | 465 |       if (!loadedudirs)
 | 
|---|
 | 466 |         load_udirs();
 | 
|---|
 | 467 |       // Search user dir list first unless doing last dirs
 | 
|---|
 | 468 |       info = userdirs ? udirhead : ldirhead;
 | 
|---|
 | 469 |       while (info) {
 | 
|---|
 | 470 |         if (!stricmp(info->path, path))
 | 
|---|
 | 471 |           return FALSE;                 // Already in list
 | 
|---|
 | 472 |         last = info;                    // Remember append to location
 | 
|---|
 | 473 |         info = info->next;
 | 
|---|
 | 474 |       }
 | 
|---|
 | 475 |       // Search last dir list unless doing just last dirs
 | 
|---|
 | 476 |       if (!userdirs) {
 | 
|---|
 | 477 |         info = udirhead;
 | 
|---|
 | 478 |         while (info) {
 | 
|---|
 | 479 |           if (!stricmp(info->path, path))
 | 
|---|
| [242] | 480 |             return FALSE;
 | 
|---|
| [551] | 481 |           info = info->next;
 | 
|---|
 | 482 |         }
 | 
|---|
 | 483 |       }
 | 
|---|
 | 484 |       else {
 | 
|---|
 | 485 |         /* if adding manual directory, remove from auto list if present */
 | 
|---|
 | 486 |         info = ldirhead;
 | 
|---|
 | 487 |         temp = NULL;
 | 
|---|
 | 488 |         while (info) {
 | 
|---|
 | 489 |           if (!stricmp(info->path, path)) {
 | 
|---|
 | 490 |             if (temp)
 | 
|---|
 | 491 |               temp->next = info->next;
 | 
|---|
| [242] | 492 |             else
 | 
|---|
| [551] | 493 |               ldirhead = info->next;
 | 
|---|
| [1009] | 494 |             xfree(info->path, pszSrcFile, __LINE__);
 | 
|---|
| [1039] | 495 |             free(info);
 | 
|---|
| [551] | 496 |             break;
 | 
|---|
 | 497 |           }
 | 
|---|
 | 498 |           temp = info;
 | 
|---|
 | 499 |           info = info->next;
 | 
|---|
| [242] | 500 |         }
 | 
|---|
| [551] | 501 |       }
 | 
|---|
 | 502 |       // Append entry to end of user dirs list
 | 
|---|
 | 503 |       info = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__);
 | 
|---|
 | 504 |       if (info) {
 | 
|---|
| [1078] | 505 | #       ifdef FORTIFY
 | 
|---|
 | 506 |         Fortify_SetScope(info, 1);
 | 
|---|
 | 507 | #       endif
 | 
|---|
| [551] | 508 |         info->path = xstrdup(path, pszSrcFile, __LINE__);
 | 
|---|
 | 509 |         if (!info->path)
 | 
|---|
| [1039] | 510 |           free(info);
 | 
|---|
| [551] | 511 |         else {
 | 
|---|
| [1078] | 512 | #         ifdef FORTIFY
 | 
|---|
 | 513 |           Fortify_SetScope(info->path, 1);
 | 
|---|
 | 514 | #         endif
 | 
|---|
| [551] | 515 |           info->next = NULL;
 | 
|---|
 | 516 |           if (userdirs) {
 | 
|---|
 | 517 |             fUdirsChanged = TRUE;
 | 
|---|
 | 518 |             if (!udirhead)
 | 
|---|
 | 519 |               udirhead = info;
 | 
|---|
 | 520 |             else
 | 
|---|
 | 521 |               last->next = info;
 | 
|---|
 | 522 |           }
 | 
|---|
 | 523 |           else {
 | 
|---|
 | 524 |             if (!ldirhead)
 | 
|---|
 | 525 |               ldirhead = info;
 | 
|---|
 | 526 |             else
 | 
|---|
 | 527 |               last->next = info;
 | 
|---|
| [1077] | 528 |           }
 | 
|---|
| [551] | 529 |           return TRUE;
 | 
|---|
 | 530 |         }
 | 
|---|
 | 531 |       }
 | 
|---|
| [2] | 532 |     }
 | 
|---|
| [551] | 533 |   }
 | 
|---|
 | 534 |   return FALSE;
 | 
|---|
| [2] | 535 | }
 | 
|---|
 | 536 | 
 | 
|---|
| [259] | 537 | //=== remove_udir - remove path from user dir list or last directory list ===
 | 
|---|
 | 538 | 
 | 
|---|
| [242] | 539 | BOOL remove_udir(CHAR * path)
 | 
|---|
 | 540 | {
 | 
|---|
| [551] | 541 |   LINKDIRS *info;
 | 
|---|
 | 542 |   LINKDIRS *last = NULL;
 | 
|---|
| [2] | 543 | 
 | 
|---|
| [551] | 544 |   if (path && *path) {
 | 
|---|
 | 545 |     if (!loadedudirs)
 | 
|---|
 | 546 |       load_udirs();
 | 
|---|
 | 547 |     info = udirhead;
 | 
|---|
 | 548 |     while (info) {
 | 
|---|
 | 549 |       if (!stricmp(info->path, path)) {
 | 
|---|
 | 550 |         if (last)
 | 
|---|
 | 551 |           last->next = info->next;
 | 
|---|
 | 552 |         else
 | 
|---|
 | 553 |           udirhead = info->next;
 | 
|---|
| [1009] | 554 |         xfree(info->path, pszSrcFile, __LINE__);
 | 
|---|
| [1039] | 555 |         free(info);
 | 
|---|
| [551] | 556 |         fUdirsChanged = TRUE;
 | 
|---|
 | 557 |         return TRUE;
 | 
|---|
 | 558 |       }
 | 
|---|
 | 559 |       last = info;
 | 
|---|
 | 560 |       info = info->next;
 | 
|---|
 | 561 |     }
 | 
|---|
| [259] | 562 | 
 | 
|---|
| [551] | 563 |     info = ldirhead;
 | 
|---|
 | 564 |     last = NULL;
 | 
|---|
 | 565 |     while (info) {
 | 
|---|
 | 566 |       if (!stricmp(info->path, path)) {
 | 
|---|
 | 567 |         if (last)
 | 
|---|
 | 568 |           last->next = info->next;
 | 
|---|
 | 569 |         else
 | 
|---|
 | 570 |           ldirhead = info->next;
 | 
|---|
| [1009] | 571 |         xfree(info->path, pszSrcFile, __LINE__);
 | 
|---|
| [1039] | 572 |         free(info);
 | 
|---|
| [551] | 573 |         return TRUE;
 | 
|---|
 | 574 |       }
 | 
|---|
 | 575 |       last = info;
 | 
|---|
 | 576 |       info = info->next;
 | 
|---|
| [2] | 577 |     }
 | 
|---|
| [551] | 578 |   }
 | 
|---|
 | 579 |   return FALSE;
 | 
|---|
| [2] | 580 | }
 | 
|---|
 | 581 | 
 | 
|---|
| [242] | 582 | BOOL remove_ldir(CHAR * path)
 | 
|---|
 | 583 | {
 | 
|---|
| [551] | 584 |   LINKDIRS *info;
 | 
|---|
 | 585 |   LINKDIRS *last = NULL;
 | 
|---|
| [2] | 586 | 
 | 
|---|
| [551] | 587 |   if (path && *path) {
 | 
|---|
 | 588 |     info = ldirhead;
 | 
|---|
 | 589 |     while (info) {
 | 
|---|
 | 590 |       if (!stricmp(info->path, path)) {
 | 
|---|
 | 591 |         if (last)
 | 
|---|
 | 592 |           last->next = info->next;
 | 
|---|
 | 593 |         else
 | 
|---|
 | 594 |           ldirhead = info->next;
 | 
|---|
| [1009] | 595 |         xfree(info->path, pszSrcFile, __LINE__);
 | 
|---|
| [1039] | 596 |         free(info);
 | 
|---|
| [551] | 597 |         return TRUE;
 | 
|---|
 | 598 |       }
 | 
|---|
 | 599 |       last = info;
 | 
|---|
 | 600 |       info = info->next;
 | 
|---|
| [2] | 601 |     }
 | 
|---|
| [551] | 602 |   }
 | 
|---|
 | 603 |   return FALSE;
 | 
|---|
| [2] | 604 | }
 | 
|---|
 | 605 | 
 | 
|---|
| [1082] | 606 | # ifdef FORTIFY
 | 
|---|
 | 607 | 
 | 
|---|
| [1029] | 608 | VOID free_ldir(VOID)
 | 
|---|
 | 609 | {
 | 
|---|
 | 610 |   LINKDIRS *info, *next;
 | 
|---|
 | 611 | 
 | 
|---|
 | 612 |   info = ldirhead;
 | 
|---|
 | 613 |   while (info) {
 | 
|---|
 | 614 |     next = info->next;
 | 
|---|
 | 615 |     xfree(info->path, pszSrcFile, __LINE__);
 | 
|---|
| [1039] | 616 |     free(info);
 | 
|---|
| [1029] | 617 |     info = next;
 | 
|---|
 | 618 |   }
 | 
|---|
 | 619 |   ldirhead = NULL;
 | 
|---|
 | 620 | }
 | 
|---|
 | 621 | 
 | 
|---|
| [1082] | 622 | # endif
 | 
|---|
 | 623 | 
 | 
|---|
| [1034] | 624 | VOID free_udirs(VOID)
 | 
|---|
| [1029] | 625 | {
 | 
|---|
 | 626 |   LINKDIRS *info, *next;
 | 
|---|
 | 627 | 
 | 
|---|
 | 628 |   info = udirhead;
 | 
|---|
 | 629 |   while (info) {
 | 
|---|
 | 630 |     next = info->next;
 | 
|---|
 | 631 |     xfree(info->path, pszSrcFile, __LINE__);
 | 
|---|
| [1039] | 632 |     free(info);
 | 
|---|
| [1029] | 633 |     info = next;
 | 
|---|
 | 634 |   }
 | 
|---|
 | 635 |   udirhead = NULL;
 | 
|---|
 | 636 | }
 | 
|---|
 | 637 | 
 | 
|---|
| [551] | 638 | VOID FillPathListBox(HWND hwnd, HWND hwnddrive, HWND hwnddir, CHAR * pszPath,
 | 
|---|
| [242] | 639 |                      BOOL nounwriteable)
 | 
|---|
 | 640 | {
 | 
|---|
| [551] | 641 |   /*
 | 
|---|
 | 642 |    * this function fills one or two list boxes with drive and directory
 | 
|---|
 | 643 |    * information showing all available drives and all directories off of
 | 
|---|
 | 644 |    * the directory represented by path.  This works independently of the
 | 
|---|
 | 645 |    * current directory.
 | 
|---|
 | 646 |    */
 | 
|---|
| [2] | 647 | 
 | 
|---|
| [551] | 648 |   CHAR szDrive[] = " :", szTemp[1032];
 | 
|---|
| [847] | 649 |   FILEFINDBUF3 findbuf;
 | 
|---|
| [551] | 650 |   HDIR hDir = HDIR_CREATE;
 | 
|---|
 | 651 |   SHORT sDrive;
 | 
|---|
| [766] | 652 |   ULONG ulDriveNum, ulSearchCount = 1, ulDriveMap;
 | 
|---|
| [2] | 653 | 
 | 
|---|
| [551] | 654 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 655 |   DosQCurDisk(&ulDriveNum, &ulDriveMap);
 | 
|---|
 | 656 |   if (hwnddrive)
 | 
|---|
 | 657 |     WinSendMsg(hwnddrive, LM_DELETEALL, MPVOID, MPVOID);
 | 
|---|
 | 658 |   if (hwnddrive != hwnddir && hwnddir)
 | 
|---|
 | 659 |     WinSendMsg(hwnddir, LM_DELETEALL, MPVOID, MPVOID);
 | 
|---|
| [2] | 660 | 
 | 
|---|
| [551] | 661 |   if (hwnddrive) {
 | 
|---|
 | 662 |     // Fill drive listbox
 | 
|---|
 | 663 |     for (sDrive = 0; sDrive < 26; sDrive++) {
 | 
|---|
| [766] | 664 |       if (ulDriveMap & (1 << sDrive)) {
 | 
|---|
| [551] | 665 |         *szDrive = (CHAR) (sDrive + 'A');
 | 
|---|
 | 666 |         if ((!nounwriteable || !(driveflags[sDrive] & DRIVE_NOTWRITEABLE)) &&
 | 
|---|
 | 667 |             !(driveflags[sDrive] & (DRIVE_IGNORE | DRIVE_INVALID)))
 | 
|---|
 | 668 |           WinSendMsg(hwnddrive, LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0),
 | 
|---|
 | 669 |                      MPFROMP(szDrive));
 | 
|---|
 | 670 |       }
 | 
|---|
| [2] | 671 |     }
 | 
|---|
| [551] | 672 |     if (hwnddrive != hwnddir && pszPath && isalpha(*pszPath)
 | 
|---|
 | 673 |         && pszPath[1] == ':') {
 | 
|---|
 | 674 |       *szDrive = toupper(*pszPath);
 | 
|---|
 | 675 |       WinSetWindowText(hwnddrive, szDrive);
 | 
|---|
 | 676 |     }
 | 
|---|
 | 677 |   }
 | 
|---|
| [2] | 678 | 
 | 
|---|
| [551] | 679 |   if (hwnddir) {
 | 
|---|
 | 680 |     // Fill directory listbox
 | 
|---|
 | 681 |     sprintf(szTemp,
 | 
|---|
 | 682 |             "%s%s*",
 | 
|---|
 | 683 |             pszPath, (pszPath[strlen(pszPath) - 1] == '\\') ? "" : "\\");
 | 
|---|
 | 684 |     DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [847] | 685 |     if (!DosFindFirst(szTemp,
 | 
|---|
 | 686 |                       &hDir,
 | 
|---|
 | 687 |                       FILE_DIRECTORY | MUST_HAVE_DIRECTORY |
 | 
|---|
 | 688 |                       FILE_READONLY | FILE_ARCHIVED | FILE_SYSTEM |
 | 
|---|
 | 689 |                       FILE_HIDDEN,
 | 
|---|
 | 690 |                       &findbuf,
 | 
|---|
 | 691 |                       sizeof(FILEFINDBUF3), &ulSearchCount, FIL_STANDARD)) {
 | 
|---|
| [551] | 692 |       do {
 | 
|---|
 | 693 |         if (findbuf.attrFile & FILE_DIRECTORY) {
 | 
|---|
 | 694 |           // Skip .. unless full path supplied
 | 
|---|
 | 695 |           if (strcmp(findbuf.achName, "..") ||
 | 
|---|
 | 696 |               strlen(pszPath) > 3 || pszPath[1] != ':') {
 | 
|---|
 | 697 |             // Skip . allow ..
 | 
|---|
 | 698 |             if (findbuf.achName[0] != '.' || findbuf.achName[1]) {
 | 
|---|
 | 699 |               WinSendMsg(hwnddir,
 | 
|---|
 | 700 |                          LM_INSERTITEM,
 | 
|---|
 | 701 |                          MPFROM2SHORT(LIT_SORTASCENDING, 0),
 | 
|---|
 | 702 |                          MPFROMP(findbuf.achName));
 | 
|---|
 | 703 |             }
 | 
|---|
 | 704 |           }
 | 
|---|
| [242] | 705 |         }
 | 
|---|
| [766] | 706 |         ulSearchCount = 1;
 | 
|---|
| [847] | 707 |       } while (!DosFindNext(hDir,
 | 
|---|
 | 708 |                             &findbuf, sizeof(FILEFINDBUF3), &ulSearchCount));
 | 
|---|
| [551] | 709 |       DosFindClose(hDir);
 | 
|---|
| [2] | 710 |     }
 | 
|---|
| [551] | 711 |     DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 712 |   }
 | 
|---|
| [2] | 713 | }
 | 
|---|
 | 714 | 
 | 
|---|
| [242] | 715 | MRESULT EXPENTRY TextSubProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
 | 716 | {
 | 
|---|
| [574] | 717 |   PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [2] | 718 | 
 | 
|---|
| [551] | 719 |   switch (msg) {
 | 
|---|
 | 720 |   case WM_CHAR:
 | 
|---|
 | 721 |     if (SHORT1FROMMP(mp1) & KC_KEYUP) {
 | 
|---|
 | 722 |       if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
 | 
|---|
 | 723 |           (SHORT1FROMMP(mp2) & 255) == '\r')
 | 
|---|
 | 724 |         PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,
 | 
|---|
 | 725 |                 MPFROM2SHORT(DID_OK, 0), MPVOID);
 | 
|---|
| [242] | 726 |     }
 | 
|---|
| [551] | 727 |     break;
 | 
|---|
 | 728 |   }
 | 
|---|
 | 729 |   return oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 730 | }
 | 
|---|
 | 731 | 
 | 
|---|
| [242] | 732 | MRESULT EXPENTRY WalkDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
 | 733 | {
 | 
|---|
| [551] | 734 |   WALKER *wa;
 | 
|---|
 | 735 |   CHAR szBuff[CCHMAXPATH + 1], szBuffer[CCHMAXPATH + 1], *p;
 | 
|---|
 | 736 |   SHORT sSelect;
 | 
|---|
 | 737 |   static BOOL okay;             /* avoid combobox selecting as filled */
 | 
|---|
 | 738 |   static CHAR lastdir[CCHMAXPATH + 1];
 | 
|---|
| [2] | 739 | 
 | 
|---|
| [551] | 740 |   switch (msg) {
 | 
|---|
 | 741 |   case UM_SETUP2:
 | 
|---|
 | 742 |   case WM_INITDLG:
 | 
|---|
 | 743 |     okay = FALSE;
 | 
|---|
 | 744 |     *lastdir = 0;
 | 
|---|
 | 745 |     if (!mp2) {
 | 
|---|
 | 746 |       Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
 | 
|---|
 | 747 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 748 |       break;
 | 
|---|
 | 749 |     }
 | 
|---|
 | 750 |     wa = xmallocz(sizeof(WALKER), pszSrcFile, __LINE__);
 | 
|---|
 | 751 |     if (!wa) {
 | 
|---|
 | 752 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 753 |       break;
 | 
|---|
 | 754 |     }
 | 
|---|
 | 755 |     wa->size = (USHORT) sizeof(WALKER);
 | 
|---|
| [574] | 756 |     WinSetWindowPtr(hwnd, QWL_USER, (PVOID) wa);
 | 
|---|
| [1009] | 757 |     wa->szReturnPath = (CHAR *)mp2;
 | 
|---|
| [242] | 758 |     {
 | 
|---|
| [551] | 759 |       PFNWP oldproc;
 | 
|---|
| [2] | 760 | 
 | 
|---|
| [551] | 761 |       oldproc = WinSubclassWindow(WinWindowFromID(hwnd, WALK_PATH),
 | 
|---|
 | 762 |                                   (PFNWP) TextSubProc);
 | 
|---|
 | 763 |       if (oldproc)
 | 
|---|
 | 764 |         WinSetWindowPtr(WinWindowFromID(hwnd, WALK_PATH),
 | 
|---|
 | 765 |                         QWL_USER, (PVOID) oldproc);
 | 
|---|
 | 766 |       WinSendDlgItemMsg(WinWindowFromID(hwnd, WALK_RECENT),
 | 
|---|
 | 767 |                         CBID_EDIT,
 | 
|---|
 | 768 |                         EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
 | 
|---|
 | 769 |       WinSendDlgItemMsg(WinWindowFromID(hwnd, WALK_RECENT),
 | 
|---|
 | 770 |                         CBID_EDIT,
 | 
|---|
 | 771 |                         EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
 | 
|---|
 | 772 |     }
 | 
|---|
| [939] | 773 |     {
 | 
|---|
 | 774 |       SWP swp;
 | 
|---|
 | 775 |       ULONG size = sizeof(SWP);
 | 
|---|
 | 776 | 
 | 
|---|
 | 777 |       PrfQueryProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp, &size);
 | 
|---|
 | 778 |       WinSetWindowPos(hwnd,
 | 
|---|
| [1077] | 779 |                       HWND_TOP,
 | 
|---|
 | 780 |                       swp.x,
 | 
|---|
 | 781 |                       swp.y,
 | 
|---|
 | 782 |                       swp.cx,
 | 
|---|
 | 783 |                       swp.cy,
 | 
|---|
 | 784 |                       swp.fl);
 | 
|---|
| [939] | 785 |     }
 | 
|---|
| [551] | 786 |     PosOverOkay(hwnd);
 | 
|---|
 | 787 |     if (msg == UM_SETUP2)
 | 
|---|
 | 788 |       wa->nounwriteable = FALSE;
 | 
|---|
 | 789 |     else
 | 
|---|
 | 790 |       wa->nounwriteable = TRUE;
 | 
|---|
 | 791 |     if (!*wa->szReturnPath)
 | 
|---|
| [1104] | 792 |       strcpy(wa->szCurrentPath, pFM2SaveDirectory);
 | 
|---|
| [551] | 793 |     else {
 | 
|---|
 | 794 |       strcpy(wa->szCurrentPath, wa->szReturnPath);
 | 
|---|
 | 795 |       MakeFullName(wa->szCurrentPath);
 | 
|---|
 | 796 |     }
 | 
|---|
 | 797 |     if (wa->nounwriteable &&
 | 
|---|
 | 798 |         (driveflags[toupper(*wa->szCurrentPath) - 'A'] &
 | 
|---|
 | 799 |          DRIVE_NOTWRITEABLE)) {
 | 
|---|
| [2] | 800 | 
 | 
|---|
| [551] | 801 |       ULONG bd;
 | 
|---|
| [2] | 802 | 
 | 
|---|
| [551] | 803 |       strcpy(wa->szCurrentPath, "C:\\");
 | 
|---|
 | 804 |       if (DosQuerySysInfo(QSV_BOOT_DRIVE,
 | 
|---|
 | 805 |                           QSV_BOOT_DRIVE,
 | 
|---|
 | 806 |                           (PVOID) & bd, (ULONG) sizeof(ULONG)))
 | 
|---|
| [766] | 807 |         bd = 3;
 | 
|---|
| [551] | 808 |       *wa->szCurrentPath = (CHAR) bd + '@';
 | 
|---|
 | 809 |     }
 | 
|---|
 | 810 |     WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 811 |                       WALK_PATH,
 | 
|---|
 | 812 |                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
 | 
|---|
 | 813 |     WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
 | 
|---|
 | 814 |     if (!loadedudirs)
 | 
|---|
 | 815 |       load_udirs();
 | 
|---|
 | 816 |     {                                   /* fill user list box */
 | 
|---|
 | 817 |       ULONG ulDriveNum, ulDriveMap;
 | 
|---|
 | 818 |       ULONG ulSearchCount;
 | 
|---|
| [847] | 819 |       FILEFINDBUF3 findbuf;
 | 
|---|
| [551] | 820 |       HDIR hDir;
 | 
|---|
 | 821 |       APIRET rc;
 | 
|---|
 | 822 |       LINKDIRS *info, *temp;
 | 
|---|
| [2] | 823 | 
 | 
|---|
| [551] | 824 |       DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 825 |       DosQCurDisk(&ulDriveNum, &ulDriveMap);
 | 
|---|
 | 826 |       info = udirhead;
 | 
|---|
 | 827 |       while (info) {
 | 
|---|
 | 828 |         if (IsFullName(info->path) &&
 | 
|---|
 | 829 |             !(driveflags[toupper(*info->path) - 'A'] &
 | 
|---|
 | 830 |               (DRIVE_IGNORE | DRIVE_INVALID))) {
 | 
|---|
 | 831 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 832 |           hDir = HDIR_CREATE;
 | 
|---|
| [766] | 833 |           ulSearchCount = 1;
 | 
|---|
| [551] | 834 |           if (!IsRoot(info->path))
 | 
|---|
| [847] | 835 |             rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
 | 
|---|
 | 836 |                               MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
 | 837 |                               FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
 | 838 |                               &findbuf, sizeof(FILEFINDBUF3),
 | 
|---|
 | 839 |                               &ulSearchCount, FIL_STANDARD);
 | 
|---|
| [551] | 840 |           else {
 | 
|---|
 | 841 |             rc = 0;
 | 
|---|
 | 842 |             findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
 | 843 |           }
 | 
|---|
 | 844 |           if (!rc) {
 | 
|---|
 | 845 |             if (!IsRoot(info->path))
 | 
|---|
 | 846 |               DosFindClose(hDir);
 | 
|---|
 | 847 |             if (findbuf.attrFile & FILE_DIRECTORY)
 | 
|---|
 | 848 |               WinSendDlgItemMsg(hwnd, WALK_USERLIST, LM_INSERTITEM,
 | 
|---|
 | 849 |                                 MPFROM2SHORT(LIT_SORTASCENDING, 0),
 | 
|---|
 | 850 |                                 MPFROMP(info->path));
 | 
|---|
 | 851 |             else {
 | 
|---|
 | 852 |               temp = info->next;
 | 
|---|
 | 853 |               remove_udir(info->path);
 | 
|---|
 | 854 |               info = temp;
 | 
|---|
 | 855 |               continue;
 | 
|---|
| [242] | 856 |             }
 | 
|---|
| [551] | 857 |           }
 | 
|---|
| [766] | 858 |           else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
 | 
|---|
| [551] | 859 |             temp = info->next;
 | 
|---|
 | 860 |             remove_udir(info->path);
 | 
|---|
 | 861 |             info = temp;
 | 
|---|
 | 862 |             continue;
 | 
|---|
 | 863 |           }
 | 
|---|
 | 864 |         }
 | 
|---|
 | 865 |         info = info->next;
 | 
|---|
 | 866 |       }
 | 
|---|
 | 867 |       info = ldirhead;
 | 
|---|
 | 868 |       while (info) {
 | 
|---|
 | 869 |         if (IsFullName(info->path) &&
 | 
|---|
 | 870 |             !(driveflags[toupper(*info->path) - 'A'] &
 | 
|---|
 | 871 |               (DRIVE_IGNORE | DRIVE_INVALID))) {
 | 
|---|
 | 872 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 873 |           hDir = HDIR_CREATE;
 | 
|---|
| [766] | 874 |           ulSearchCount = 1;
 | 
|---|
| [551] | 875 |           if (!IsRoot(info->path))
 | 
|---|
| [847] | 876 |             rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
 | 
|---|
 | 877 |                               MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
 | 878 |                               FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
 | 879 |                               &findbuf, sizeof(FILEFINDBUF3),
 | 
|---|
 | 880 |                               &ulSearchCount, FIL_STANDARD);
 | 
|---|
| [551] | 881 |           else {
 | 
|---|
 | 882 |             rc = 0;
 | 
|---|
 | 883 |             findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
 | 884 |           }
 | 
|---|
 | 885 |           if (!rc) {
 | 
|---|
 | 886 |             if (!IsRoot(info->path))
 | 
|---|
 | 887 |               DosFindClose(hDir);
 | 
|---|
 | 888 |             if (findbuf.attrFile & FILE_DIRECTORY)
 | 
|---|
 | 889 |               WinSendDlgItemMsg(hwnd, WALK_RECENT, LM_INSERTITEM,
 | 
|---|
 | 890 |                                 MPFROM2SHORT(LIT_SORTASCENDING, 0),
 | 
|---|
 | 891 |                                 MPFROMP(info->path));
 | 
|---|
 | 892 |             else {
 | 
|---|
 | 893 |               temp = info->next;
 | 
|---|
 | 894 |               remove_ldir(info->path);
 | 
|---|
 | 895 |               info = temp;
 | 
|---|
 | 896 |               continue;
 | 
|---|
| [242] | 897 |             }
 | 
|---|
| [551] | 898 |             WinSetDlgItemText(hwnd, WALK_RECENT,
 | 
|---|
 | 899 |                               GetPString(IDS_WALKRECENTDIRSTEXT));
 | 
|---|
 | 900 |           }
 | 
|---|
| [766] | 901 |           else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
 | 
|---|
| [551] | 902 |             temp = info->next;
 | 
|---|
 | 903 |             remove_ldir(info->path);
 | 
|---|
 | 904 |             info = temp;
 | 
|---|
 | 905 |             continue;
 | 
|---|
 | 906 |           }
 | 
|---|
| [242] | 907 |         }
 | 
|---|
| [551] | 908 |         info = info->next;
 | 
|---|
 | 909 |       }
 | 
|---|
 | 910 |     }
 | 
|---|
 | 911 |     FillPathListBox(hwnd,
 | 
|---|
 | 912 |                     WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 913 |                     WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 914 |                     wa->szCurrentPath, wa->nounwriteable);
 | 
|---|
 | 915 |     if (!PostMsg(hwnd, UM_SETUP4, MPVOID, MPVOID))
 | 
|---|
 | 916 |       okay = TRUE;
 | 
|---|
 | 917 |     {
 | 
|---|
 | 918 |       MRESULT ret;
 | 
|---|
| [2] | 919 | 
 | 
|---|
| [551] | 920 |       ret = WinDefDlgProc(hwnd, WM_INITDLG, mp1, mp2);
 | 
|---|
 | 921 |       WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
 | 
|---|
 | 922 |       WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
 | 
|---|
 | 923 |       return ret;
 | 
|---|
 | 924 |     }
 | 
|---|
| [2] | 925 | 
 | 
|---|
| [551] | 926 |   case UM_SETUP4:
 | 
|---|
 | 927 |     okay = TRUE;
 | 
|---|
 | 928 |     return 0;
 | 
|---|
| [2] | 929 | 
 | 
|---|
| [551] | 930 |   case WM_ADJUSTWINDOWPOS:
 | 
|---|
 | 931 |     PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
 | 
|---|
 | 932 |     break;
 | 
|---|
| [2] | 933 | 
 | 
|---|
| [551] | 934 |   case UM_SETDIR:
 | 
|---|
 | 935 |     PaintRecessedWindow(WinWindowFromID(hwnd, WALK_HELP), (HPS) 0, FALSE,
 | 
|---|
 | 936 |                         TRUE);
 | 
|---|
 | 937 |     return 0;
 | 
|---|
| [2] | 938 | 
 | 
|---|
| [551] | 939 |   case WM_PRESPARAMCHANGED:
 | 
|---|
 | 940 |     {
 | 
|---|
 | 941 |       ULONG AttrFound, AttrValue[64], cbRetLen;
 | 
|---|
| [2] | 942 | 
 | 
|---|
| [551] | 943 |       cbRetLen = WinQueryPresParam(hwnd, (ULONG) mp1, 0, &AttrFound,
 | 
|---|
 | 944 |                                    (ULONG) sizeof(AttrValue), &AttrValue, 0);
 | 
|---|
 | 945 |       if (cbRetLen) {
 | 
|---|
 | 946 |         switch (AttrFound) {
 | 
|---|
 | 947 |         case PP_FONTNAMESIZE:
 | 
|---|
 | 948 |           PrfWriteProfileData(fmprof,
 | 
|---|
 | 949 |                               appname,
 | 
|---|
 | 950 |                               "WalkFont", (PVOID) AttrValue, cbRetLen);
 | 
|---|
 | 951 |           *WalkFont = 0;
 | 
|---|
 | 952 |           WalkFontSize = sizeof(WalkFont);
 | 
|---|
 | 953 |           WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
 | 
|---|
 | 954 |           break;
 | 
|---|
| [242] | 955 |         }
 | 
|---|
| [551] | 956 |       }
 | 
|---|
 | 957 |     }
 | 
|---|
 | 958 |     break;
 | 
|---|
| [2] | 959 | 
 | 
|---|
| [551] | 960 |   case UM_SETUP3:
 | 
|---|
 | 961 |     save_udirs();
 | 
|---|
 | 962 |     if (hwndMain)
 | 
|---|
 | 963 |       PostMsg(hwndMain, UM_FILLUSERLIST, MPVOID, MPVOID);
 | 
|---|
 | 964 |     return 0;
 | 
|---|
| [2] | 965 | 
 | 
|---|
| [551] | 966 |   case UM_SETUP:
 | 
|---|
 | 967 |     {
 | 
|---|
 | 968 |       INT x;
 | 
|---|
 | 969 |       USHORT id[] = { WALK_PATH, WALK_DIRLIST, WALK_USERLIST,
 | 
|---|
 | 970 |         WALK_RECENT, 0
 | 
|---|
 | 971 |       };
 | 
|---|
| [2] | 972 | 
 | 
|---|
| [551] | 973 |       if (*WalkFont ||
 | 
|---|
 | 974 |           (PrfQueryProfileData(fmprof,
 | 
|---|
 | 975 |                                appname,
 | 
|---|
 | 976 |                                "WalkFont",
 | 
|---|
 | 977 |                                (PVOID) WalkFont,
 | 
|---|
 | 978 |                                &WalkFontSize) && WalkFontSize)) {
 | 
|---|
 | 979 |         for (x = 0; id[x]; x++)
 | 
|---|
 | 980 |           WinSetPresParam(WinWindowFromID(hwnd, id[x]),
 | 
|---|
 | 981 |                           PP_FONTNAMESIZE, WalkFontSize, (PVOID) WalkFont);
 | 
|---|
 | 982 |       }
 | 
|---|
 | 983 |     }
 | 
|---|
 | 984 |     return 0;
 | 
|---|
| [2] | 985 | 
 | 
|---|
| [551] | 986 |   case UM_CONTROL:
 | 
|---|
 | 987 |   case WM_CONTROL:
 | 
|---|
| [574] | 988 |     wa = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [551] | 989 |     if (SHORT1FROMMP(mp1) == WALK_DRIVELIST ||
 | 
|---|
 | 990 |         SHORT1FROMMP(mp1) == WALK_DIRLIST ||
 | 
|---|
 | 991 |         SHORT1FROMMP(mp1) == WALK_USERLIST ||
 | 
|---|
 | 992 |         SHORT1FROMMP(mp1) == WALK_RECENT) {
 | 
|---|
 | 993 |       sSelect = (USHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 994 |                                            SHORT1FROMMP(mp1),
 | 
|---|
 | 995 |                                            LM_QUERYSELECTION, MPVOID, MPVOID);
 | 
|---|
 | 996 |       *szBuffer = 0;
 | 
|---|
 | 997 |       if (sSelect >= 0)
 | 
|---|
 | 998 |         WinSendDlgItemMsg(hwnd, SHORT1FROMMP(mp1), LM_QUERYITEMTEXT,
 | 
|---|
 | 999 |                           MPFROM2SHORT(sSelect, CCHMAXPATH),
 | 
|---|
 | 1000 |                           MPFROMP(szBuffer));
 | 
|---|
 | 1001 |     }
 | 
|---|
 | 1002 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 1003 |     case WALK_PATH:
 | 
|---|
 | 1004 |       if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
 | 
|---|
 | 1005 |         WinSetDlgItemText(hwnd, WALK_HELP, GetPString(IDS_WALKCURRDIRTEXT));
 | 
|---|
 | 1006 |       else if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
 | 
|---|
 | 1007 |         WinSetDlgItemText(hwnd, WALK_HELP,
 | 
|---|
 | 1008 |                           GetPString(IDS_WALKDEFAULTHELPTEXT));
 | 
|---|
 | 1009 |       break;
 | 
|---|
| [2] | 1010 | 
 | 
|---|
| [551] | 1011 |     case WALK_RECENT:
 | 
|---|
 | 1012 |       if (okay && SHORT2FROMMP(mp1) == CBN_LBSELECT) {
 | 
|---|
| [2] | 1013 | 
 | 
|---|
| [551] | 1014 |         ULONG ulSearchCount;
 | 
|---|
| [847] | 1015 |         FILEFINDBUF3 findbuf;
 | 
|---|
| [551] | 1016 |         HDIR hDir;
 | 
|---|
 | 1017 |         APIRET rc;
 | 
|---|
| [2] | 1018 | 
 | 
|---|
| [551] | 1019 |         // *szBuffer = 0;
 | 
|---|
 | 1020 |         // WinQueryDlgItemText(hwnd,WALK_RECENT,CCHMAXPATH,szBuffer);
 | 
|---|
 | 1021 |         if (!*szBuffer)
 | 
|---|
 | 1022 |           break;
 | 
|---|
 | 1023 |         DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 1024 |         hDir = HDIR_CREATE;
 | 
|---|
| [766] | 1025 |         ulSearchCount = 1;
 | 
|---|
| [551] | 1026 |         if (!IsRoot(szBuffer)) {
 | 
|---|
| [847] | 1027 |           rc = DosFindFirst(szBuffer, &hDir, FILE_DIRECTORY |
 | 
|---|
 | 1028 |                             MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
 | 1029 |                             FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
 | 1030 |                             &findbuf, sizeof(FILEFINDBUF3),
 | 
|---|
 | 1031 |                             &ulSearchCount, FIL_STANDARD);
 | 
|---|
| [551] | 1032 |           if (!rc)
 | 
|---|
 | 1033 |             DosFindClose(hDir);
 | 
|---|
 | 1034 |         }
 | 
|---|
 | 1035 |         else {
 | 
|---|
 | 1036 |           findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
 | 1037 |           rc = 0;
 | 
|---|
 | 1038 |         }
 | 
|---|
 | 1039 |         if (rc)
 | 
|---|
 | 1040 |           Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
 | 
|---|
| [838] | 1041 |                     "xDosFindFirst");
 | 
|---|
| [551] | 1042 |         else if (~findbuf.attrFile & FILE_DIRECTORY)
 | 
|---|
 | 1043 |           Runtime_Error(pszSrcFile, __LINE__, "not a directory");
 | 
|---|
 | 1044 |         else {
 | 
|---|
 | 1045 |           strcpy(wa->szCurrentPath, szBuffer);
 | 
|---|
 | 1046 |           WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
 | 
|---|
 | 1047 |           WinSetDlgItemText(hwnd, WALK_RECENT, wa->szCurrentPath);
 | 
|---|
 | 1048 |           FillPathListBox(hwnd,
 | 
|---|
 | 1049 |                           WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 1050 |                           WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 1051 |                           wa->szCurrentPath, FALSE);
 | 
|---|
 | 1052 |         }
 | 
|---|
 | 1053 |       }
 | 
|---|
 | 1054 |       else if (SHORT2FROMMP(mp1) == CBN_ENTER)
 | 
|---|
 | 1055 |         PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
 | 
|---|
 | 1056 |       else if (SHORT2FROMMP(mp1) == CBN_SHOWLIST)
 | 
|---|
 | 1057 |         WinSetDlgItemText(hwnd, WALK_HELP,
 | 
|---|
 | 1058 |                           GetPString(IDS_WALKRECENTDIRSHELPTEXT));
 | 
|---|
 | 1059 |       break;
 | 
|---|
| [2] | 1060 | 
 | 
|---|
| [551] | 1061 |     case WALK_USERLIST:
 | 
|---|
 | 1062 |       if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_SELECT) {
 | 
|---|
| [2] | 1063 | 
 | 
|---|
| [551] | 1064 |         ULONG ulSearchCount;
 | 
|---|
| [847] | 1065 |         FILEFINDBUF3 findbuf;
 | 
|---|
| [551] | 1066 |         HDIR hDir;
 | 
|---|
 | 1067 |         APIRET rc;
 | 
|---|
| [2] | 1068 | 
 | 
|---|
| [551] | 1069 |         DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 1070 |         hDir = HDIR_CREATE;
 | 
|---|
| [766] | 1071 |         ulSearchCount = 1;
 | 
|---|
| [551] | 1072 |         if (!IsRoot(szBuffer)) {
 | 
|---|
| [847] | 1073 |           rc = DosFindFirst(szBuffer,
 | 
|---|
 | 1074 |                             &hDir,
 | 
|---|
 | 1075 |                             FILE_DIRECTORY |
 | 
|---|
 | 1076 |                             MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
 | 1077 |                             FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
 | 1078 |                             &findbuf,
 | 
|---|
 | 1079 |                             sizeof(FILEFINDBUF3),
 | 
|---|
 | 1080 |                             &ulSearchCount, FIL_STANDARD);
 | 
|---|
| [551] | 1081 |           if (!rc)
 | 
|---|
 | 1082 |             DosFindClose(hDir);
 | 
|---|
 | 1083 |         }
 | 
|---|
 | 1084 |         else {
 | 
|---|
 | 1085 |           findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
 | 1086 |           rc = 0;
 | 
|---|
 | 1087 |         }
 | 
|---|
 | 1088 |         if (rc)
 | 
|---|
 | 1089 |           Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__,
 | 
|---|
| [838] | 1090 |                     "xDosFindFirst");
 | 
|---|
| [551] | 1091 |         else if (~findbuf.attrFile & FILE_DIRECTORY)
 | 
|---|
 | 1092 |           Runtime_Error(pszSrcFile, __LINE__, "not a directory");
 | 
|---|
 | 1093 |         else {
 | 
|---|
 | 1094 |           strcpy(wa->szCurrentPath, szBuffer);
 | 
|---|
 | 1095 |           WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
 | 
|---|
 | 1096 |           FillPathListBox(hwnd,
 | 
|---|
 | 1097 |                           WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 1098 |                           WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 1099 |                           wa->szCurrentPath, FALSE);
 | 
|---|
 | 1100 |         }
 | 
|---|
 | 1101 |       }
 | 
|---|
 | 1102 |       else if (SHORT2FROMMP(mp1) == LN_ENTER)
 | 
|---|
 | 1103 |         PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);
 | 
|---|
 | 1104 |       else if (SHORT2FROMMP(mp1) == LN_SETFOCUS)
 | 
|---|
 | 1105 |         WinSetDlgItemText(hwnd,
 | 
|---|
 | 1106 |                           WALK_HELP, GetPString(IDS_WALKUSERDIRSHELPTEXT));
 | 
|---|
 | 1107 |       else if (SHORT2FROMMP(mp1) == LN_KILLFOCUS)
 | 
|---|
 | 1108 |         WinSetDlgItemText(hwnd,
 | 
|---|
 | 1109 |                           WALK_HELP, GetPString(IDS_WALKDEFAULTHELPTEXT));
 | 
|---|
 | 1110 |       break;
 | 
|---|
| [2] | 1111 | 
 | 
|---|
| [551] | 1112 |     case WALK_DRIVELIST:
 | 
|---|
 | 1113 |       if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
 | 
|---|
| [2] | 1114 | 
 | 
|---|
| [551] | 1115 |         ULONG ulDirLen = CCHMAXPATH;
 | 
|---|
 | 1116 |         APIRET rc;
 | 
|---|
| [2] | 1117 | 
 | 
|---|
| [551] | 1118 |         rc = DosQCurDir(toupper(*szBuffer) - '@', &szBuff[3], &ulDirLen);
 | 
|---|
 | 1119 |         if (!rc) {
 | 
|---|
 | 1120 |           strcpy(wa->szCurrentPath, "C:\\");
 | 
|---|
 | 1121 |           *wa->szCurrentPath = toupper(*szBuffer);
 | 
|---|
 | 1122 |           WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
 | 
|---|
 | 1123 |           FillPathListBox(hwnd,
 | 
|---|
 | 1124 |                           WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 1125 |                           WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 1126 |                           wa->szCurrentPath, FALSE);
 | 
|---|
 | 1127 |         }
 | 
|---|
 | 1128 |       }
 | 
|---|
 | 1129 |       else if (SHORT2FROMMP(mp1) == LN_SETFOCUS)
 | 
|---|
 | 1130 |         WinSetDlgItemText(hwnd, WALK_HELP,
 | 
|---|
 | 1131 |                           GetPString(IDS_WALKDRIVELISTHELPTEXT));
 | 
|---|
 | 1132 |       else if (SHORT2FROMMP(mp1) == LN_KILLFOCUS)
 | 
|---|
 | 1133 |         WinSetDlgItemText(hwnd, WALK_HELP,
 | 
|---|
 | 1134 |                           GetPString(IDS_WALKDEFAULTHELPTEXT));
 | 
|---|
 | 1135 |       break;
 | 
|---|
| [2] | 1136 | 
 | 
|---|
| [551] | 1137 |     case WALK_DIRLIST:
 | 
|---|
 | 1138 |       if (okay && SHORT2FROMMP(mp1) == LN_ENTER) {
 | 
|---|
| [2] | 1139 | 
 | 
|---|
| [551] | 1140 |         ULONG ulSearchCount;
 | 
|---|
| [847] | 1141 |         FILEFINDBUF3 findbuf;
 | 
|---|
| [551] | 1142 |         HDIR hDir;
 | 
|---|
 | 1143 |         APIRET rc;
 | 
|---|
| [2] | 1144 | 
 | 
|---|
| [551] | 1145 |         bstrip(szBuffer);
 | 
|---|
 | 1146 |         if (*szBuffer) {
 | 
|---|
 | 1147 |           strcpy(szBuff, wa->szCurrentPath);
 | 
|---|
 | 1148 |           if (szBuff[strlen(szBuff) - 1] != '\\')
 | 
|---|
 | 1149 |             strcat(szBuff, "\\");
 | 
|---|
 | 1150 |           strcat(szBuff, szBuffer);
 | 
|---|
 | 1151 |           MakeFullName(szBuff);
 | 
|---|
 | 1152 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 1153 |           hDir = HDIR_CREATE;
 | 
|---|
| [766] | 1154 |           ulSearchCount = 1;
 | 
|---|
| [551] | 1155 |           if (!IsRoot(szBuff)) {
 | 
|---|
| [847] | 1156 |             rc = DosFindFirst(szBuff,
 | 
|---|
 | 1157 |                               &hDir,
 | 
|---|
 | 1158 |                               FILE_DIRECTORY |
 | 
|---|
 | 1159 |                               MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
 | 1160 |                               FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
 | 1161 |                               &findbuf,
 | 
|---|
 | 1162 |                               sizeof(FILEFINDBUF3),
 | 
|---|
 | 1163 |                               &ulSearchCount, FIL_STANDARD);
 | 
|---|
| [551] | 1164 |             if (!rc)
 | 
|---|
 | 1165 |               DosFindClose(hDir);
 | 
|---|
 | 1166 |           }
 | 
|---|
 | 1167 |           else {
 | 
|---|
 | 1168 |             findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
 | 1169 |             rc = 0;
 | 
|---|
 | 1170 |           }
 | 
|---|
 | 1171 |           if (!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
 | 
|---|
 | 1172 |             strcpy(wa->szCurrentPath, szBuff);
 | 
|---|
 | 1173 |             WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
 | 
|---|
 | 1174 |             FillPathListBox(hwnd,
 | 
|---|
 | 1175 |                             WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 1176 |                             WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 1177 |                             wa->szCurrentPath, FALSE);
 | 
|---|
 | 1178 |           }
 | 
|---|
| [242] | 1179 |         }
 | 
|---|
| [551] | 1180 |       }
 | 
|---|
 | 1181 |       else if (SHORT2FROMMP(mp1) == LN_SETFOCUS)
 | 
|---|
 | 1182 |         WinSetDlgItemText(hwnd, WALK_HELP,
 | 
|---|
 | 1183 |                           GetPString(IDS_WALKDIRLISTHELPTEXT));
 | 
|---|
 | 1184 |       else if (SHORT2FROMMP(mp1) == LN_KILLFOCUS)
 | 
|---|
 | 1185 |         WinSetDlgItemText(hwnd, WALK_HELP,
 | 
|---|
 | 1186 |                           GetPString(IDS_WALKDEFAULTHELPTEXT));
 | 
|---|
 | 1187 |       break;
 | 
|---|
 | 1188 |     }
 | 
|---|
 | 1189 |     return 0;
 | 
|---|
 | 1190 | 
 | 
|---|
 | 1191 |   case WM_COMMAND:
 | 
|---|
| [574] | 1192 |     wa = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [551] | 1193 |     if (!wa)
 | 
|---|
 | 1194 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 1195 |     *szBuff = 0;
 | 
|---|
 | 1196 |     WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
 | 
|---|
 | 1197 |     bstrip(szBuff);
 | 
|---|
 | 1198 |     while ((p = strchr(szBuff, '/')) != NULL)
 | 
|---|
 | 1199 |       *p = '\\';
 | 
|---|
 | 1200 |     while (strlen(szBuff) > 3 && szBuff[strlen(szBuff) - 1] == '\\')
 | 
|---|
 | 1201 |       szBuff[strlen(szBuff) - 1] = 0;
 | 
|---|
 | 1202 |     MakeFullName(szBuff);
 | 
|---|
| [864] | 1203 |     if (*szBuff && stricmp(szBuff, wa->szCurrentPath) && SHORT1FROMMP(mp1) != DID_CANCEL) {
 | 
|---|
| [551] | 1204 |       if (!SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 1205 |                                  QW_OWNER), hwnd, szBuff, 0))
 | 
|---|
 | 1206 |         strcpy(wa->szCurrentPath, szBuff);
 | 
|---|
| [865] | 1207 |       else
 | 
|---|
| [242] | 1208 |         return 0;
 | 
|---|
| [551] | 1209 |     }
 | 
|---|
 | 1210 |     WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath);
 | 
|---|
 | 1211 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 1212 |     case WALK_ADD:
 | 
|---|
 | 1213 |       *szBuff = 0;
 | 
|---|
 | 1214 |       WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
 | 
|---|
 | 1215 |       bstrip(szBuff);
 | 
|---|
 | 1216 |       while ((p = strchr(szBuff, '/')) != NULL)
 | 
|---|
 | 1217 |         *p = '\\';
 | 
|---|
 | 1218 |       if (*szBuff && !IsFile(szBuff)) {
 | 
|---|
 | 1219 |         MakeFullName(szBuff);
 | 
|---|
| [617] | 1220 |         add_udir(TRUE, szBuff);
 | 
|---|
 | 1221 |         if (fUdirsChanged) {
 | 
|---|
| [551] | 1222 |           WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 1223 |                             WALK_USERLIST,
 | 
|---|
 | 1224 |                             LM_INSERTITEM,
 | 
|---|
 | 1225 |                             MPFROM2SHORT(LIT_SORTASCENDING, 0),
 | 
|---|
 | 1226 |                             MPFROMP(szBuff));
 | 
|---|
 | 1227 |           wa->changed = 1;
 | 
|---|
 | 1228 |         }
 | 
|---|
 | 1229 |       }
 | 
|---|
 | 1230 |       break;
 | 
|---|
| [2] | 1231 | 
 | 
|---|
| [551] | 1232 |     case WALK_DELETE:
 | 
|---|
 | 1233 |       *szBuff = 0;
 | 
|---|
 | 1234 |       WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
 | 
|---|
 | 1235 |       bstrip(szBuff);
 | 
|---|
 | 1236 |       while ((p = strchr(szBuff, '/')) != NULL)
 | 
|---|
 | 1237 |         *p = '\\';
 | 
|---|
 | 1238 |       if (*szBuff && !IsFile(szBuff)) {
 | 
|---|
| [242] | 1239 |         MakeFullName(szBuff);
 | 
|---|
| [551] | 1240 |         sSelect = (SHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 1241 |                                             WALK_USERLIST,
 | 
|---|
 | 1242 |                                             LM_SEARCHSTRING,
 | 
|---|
 | 1243 |                                             MPFROM2SHORT(0, LIT_FIRST),
 | 
|---|
 | 1244 |                                             MPFROMP(szBuff));
 | 
|---|
 | 1245 |         if (sSelect >= 0) {
 | 
|---|
 | 1246 |           WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 1247 |                             WALK_USERLIST,
 | 
|---|
 | 1248 |                             LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID);
 | 
|---|
 | 1249 |           remove_udir(szBuff);
 | 
|---|
 | 1250 |           wa->changed = 1;
 | 
|---|
| [242] | 1251 |         }
 | 
|---|
| [551] | 1252 |       }
 | 
|---|
 | 1253 |       break;
 | 
|---|
| [2] | 1254 | 
 | 
|---|
| [551] | 1255 |     case DID_OK:
 | 
|---|
 | 1256 |       if (*wa->szCurrentPath) {
 | 
|---|
 | 1257 |         strcpy(wa->szReturnPath, wa->szCurrentPath);
 | 
|---|
 | 1258 |         MakeValidDir(wa->szReturnPath);
 | 
|---|
 | 1259 |         if (fAutoAddAllDirs)
 | 
|---|
 | 1260 |           add_udir(FALSE, wa->szReturnPath);
 | 
|---|
 | 1261 |         if (fChangeTarget) {
 | 
|---|
 | 1262 |           strcpy(targetdir, wa->szReturnPath);
 | 
|---|
 | 1263 |           PrfWriteProfileString(fmprof, appname, "Targetdir", targetdir);
 | 
|---|
 | 1264 |         }
 | 
|---|
 | 1265 |       }
 | 
|---|
| [939] | 1266 |       {
 | 
|---|
| [1077] | 1267 |         SWP swp;
 | 
|---|
 | 1268 |         ULONG size = sizeof(SWP);
 | 
|---|
| [939] | 1269 | 
 | 
|---|
| [1077] | 1270 |         WinQueryWindowPos(hwnd, &swp);
 | 
|---|
 | 1271 |         PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp,
 | 
|---|
 | 1272 |                             size);
 | 
|---|
| [939] | 1273 |       }
 | 
|---|
| [551] | 1274 |       if (wa->changed)
 | 
|---|
 | 1275 |         WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
 | 
|---|
 | 1276 |       WinDismissDlg(hwnd, 1);
 | 
|---|
 | 1277 |       break;
 | 
|---|
| [2] | 1278 | 
 | 
|---|
| [551] | 1279 |     case IDM_HELP:
 | 
|---|
 | 1280 |       if (hwndHelp)
 | 
|---|
 | 1281 |         WinSendMsg(hwndHelp,
 | 
|---|
 | 1282 |                    HM_DISPLAY_HELP,
 | 
|---|
 | 1283 |                    MPFROM2SHORT(HELP_WALKEM, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
 | 1284 |       break;
 | 
|---|
| [2] | 1285 | 
 | 
|---|
| [551] | 1286 |     case DID_CANCEL:
 | 
|---|
| [939] | 1287 |       {
 | 
|---|
| [1077] | 1288 |         SWP swp;
 | 
|---|
 | 1289 |         ULONG size = sizeof(SWP);
 | 
|---|
| [939] | 1290 | 
 | 
|---|
| [1077] | 1291 |         WinQueryWindowPos(hwnd, &swp);
 | 
|---|
 | 1292 |         PrfWriteProfileData(fmprof, FM3Str, "WalkDir.Position", (PVOID) &swp,
 | 
|---|
 | 1293 |                             size);
 | 
|---|
| [939] | 1294 |       }
 | 
|---|
| [551] | 1295 |       if (wa->changed)
 | 
|---|
| [1077] | 1296 |         WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID);
 | 
|---|
| [1039] | 1297 |       free(wa);
 | 
|---|
| [551] | 1298 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 1299 |       break;
 | 
|---|
 | 1300 |     }
 | 
|---|
 | 1301 |     return 0;
 | 
|---|
| [2] | 1302 | 
 | 
|---|
| [551] | 1303 |   case WM_CLOSE:
 | 
|---|
| [1077] | 1304 |         break;
 | 
|---|
| [551] | 1305 |   }
 | 
|---|
 | 1306 |   return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1307 | }
 | 
|---|
 | 1308 | 
 | 
|---|
| [242] | 1309 | MRESULT EXPENTRY WalkAllDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
 | 1310 | {
 | 
|---|
| [551] | 1311 |   switch (msg) {
 | 
|---|
 | 1312 |   case WM_INITDLG:
 | 
|---|
 | 1313 |     return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
 | 
|---|
 | 1314 |   }
 | 
|---|
 | 1315 |   return WalkDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1316 | }
 | 
|---|
 | 1317 | 
 | 
|---|
| [242] | 1318 | MRESULT EXPENTRY WalkCopyDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
 | 1319 | {
 | 
|---|
| [551] | 1320 |   switch (msg) {
 | 
|---|
 | 1321 |   case WM_INITDLG:
 | 
|---|
 | 1322 |     WinSetWindowText(hwnd, GetPString(IDS_WALKCOPYDLGTEXT));
 | 
|---|
 | 1323 |     return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
 | 
|---|
 | 1324 |   }
 | 
|---|
 | 1325 |   return WalkDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1326 | }
 | 
|---|
 | 1327 | 
 | 
|---|
| [242] | 1328 | MRESULT EXPENTRY WalkMoveDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
 | 1329 | {
 | 
|---|
| [551] | 1330 |   switch (msg) {
 | 
|---|
 | 1331 |   case WM_INITDLG:
 | 
|---|
 | 1332 |     WinSetWindowText(hwnd, GetPString(IDS_WALKMOVEDLGTEXT));
 | 
|---|
 | 1333 |     return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
 | 
|---|
 | 1334 |   }
 | 
|---|
 | 1335 |   return WalkDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1336 | }
 | 
|---|
 | 1337 | 
 | 
|---|
| [242] | 1338 | MRESULT EXPENTRY WalkExtractDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 1339 |                                     MPARAM mp2)
 | 
|---|
 | 1340 | {
 | 
|---|
| [551] | 1341 |   switch (msg) {
 | 
|---|
 | 1342 |   case WM_INITDLG:
 | 
|---|
 | 1343 |     WinSetWindowText(hwnd, GetPString(IDS_WALKEXTRACTDLGTEXT));
 | 
|---|
 | 1344 |     return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
 | 
|---|
 | 1345 |   }
 | 
|---|
 | 1346 |   return WalkDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1347 | }
 | 
|---|
 | 1348 | 
 | 
|---|
| [242] | 1349 | MRESULT EXPENTRY WalkTargetDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 1350 |                                    MPARAM mp2)
 | 
|---|
 | 1351 | {
 | 
|---|
| [551] | 1352 |   switch (msg) {
 | 
|---|
 | 1353 |   case WM_INITDLG:
 | 
|---|
| [242] | 1354 |     {
 | 
|---|
| [551] | 1355 |       char s[CCHMAXPATH + 32];
 | 
|---|
| [2] | 1356 | 
 | 
|---|
| [551] | 1357 |       sprintf(s,
 | 
|---|
 | 1358 |               GetPString(IDS_WALKTARGETDLGTEXT),
 | 
|---|
 | 1359 |               (*targetdir) ?
 | 
|---|
 | 1360 |               NullStr :
 | 
|---|
 | 1361 |               " (",
 | 
|---|
 | 1362 |               (*targetdir) ?
 | 
|---|
 | 1363 |               NullStr : GetPString(IDS_NONE), (*targetdir) ? NullStr : ")");
 | 
|---|
 | 1364 |       WinSetWindowText(hwnd, s);
 | 
|---|
| [242] | 1365 |     }
 | 
|---|
| [551] | 1366 |     return WalkDlgProc(hwnd, UM_SETUP2, mp1, mp2);
 | 
|---|
 | 1367 |   }
 | 
|---|
 | 1368 |   return WalkDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1369 | }
 | 
|---|
 | 1370 | 
 | 
|---|
| [242] | 1371 | MRESULT EXPENTRY WalkTwoDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 | 
|---|
 | 1372 | {
 | 
|---|
| [551] | 1373 |   WALK2 *wa;
 | 
|---|
 | 1374 |   CHAR szBuff[CCHMAXPATH + 1], szBuffer[CCHMAXPATH + 1], *p;
 | 
|---|
 | 1375 |   SHORT sSelect;
 | 
|---|
 | 1376 |   static BOOL okay;             /* avoid combobox selecting as filled */
 | 
|---|
| [2] | 1377 | 
 | 
|---|
| [551] | 1378 |   switch (msg) {
 | 
|---|
 | 1379 |   case UM_SETUP2:
 | 
|---|
 | 1380 |   case WM_INITDLG:
 | 
|---|
 | 1381 |     okay = FALSE;
 | 
|---|
 | 1382 |     if (!mp2) {
 | 
|---|
 | 1383 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 1384 |       break;
 | 
|---|
 | 1385 |     }
 | 
|---|
| [574] | 1386 |     WinSetWindowPtr(hwnd, QWL_USER, mp2);
 | 
|---|
| [551] | 1387 |     wa = mp2;
 | 
|---|
| [242] | 1388 |     {
 | 
|---|
| [551] | 1389 |       PFNWP oldproc;
 | 
|---|
| [2] | 1390 | 
 | 
|---|
| [551] | 1391 |       oldproc = WinSubclassWindow(WinWindowFromID(hwnd, WALK_PATH),
 | 
|---|
 | 1392 |                                   (PFNWP) TextSubProc);
 | 
|---|
 | 1393 |       if (oldproc)
 | 
|---|
 | 1394 |         WinSetWindowPtr(WinWindowFromID(hwnd, WALK_PATH),
 | 
|---|
 | 1395 |                         QWL_USER, (PVOID) oldproc);
 | 
|---|
 | 1396 |       oldproc = WinSubclassWindow(WinWindowFromID(hwnd, WALK2_PATH),
 | 
|---|
 | 1397 |                                   (PFNWP) TextSubProc);
 | 
|---|
 | 1398 |       if (oldproc)
 | 
|---|
 | 1399 |         WinSetWindowPtr(WinWindowFromID(hwnd, WALK2_PATH),
 | 
|---|
 | 1400 |                         QWL_USER, (PVOID) oldproc);
 | 
|---|
 | 1401 |     }
 | 
|---|
| [939] | 1402 |     {
 | 
|---|
 | 1403 |       SWP swp;
 | 
|---|
 | 1404 |       ULONG size = sizeof(SWP);
 | 
|---|
 | 1405 | 
 | 
|---|
 | 1406 |       PrfQueryProfileData(fmprof, FM3Str, "WalkDir2.Position", (PVOID) &swp, &size);
 | 
|---|
 | 1407 |       WinSetWindowPos(hwnd,
 | 
|---|
| [1077] | 1408 |                       HWND_TOP,
 | 
|---|
 | 1409 |                       swp.x,
 | 
|---|
 | 1410 |                       swp.y,
 | 
|---|
 | 1411 |                       swp.cx,
 | 
|---|
 | 1412 |                       swp.cy,
 | 
|---|
 | 1413 |                       swp.fl);
 | 
|---|
| [939] | 1414 |     }
 | 
|---|
| [551] | 1415 |     if (!*wa->szCurrentPath1)
 | 
|---|
| [1104] | 1416 |       strcpy(wa->szCurrentPath1, pFM2SaveDirectory);
 | 
|---|
| [551] | 1417 |     MakeFullName(wa->szCurrentPath1);
 | 
|---|
 | 1418 |     if (!*wa->szCurrentPath2)
 | 
|---|
| [1104] | 1419 |       strcpy(wa->szCurrentPath2, pFM2SaveDirectory);
 | 
|---|
| [551] | 1420 |     MakeFullName(wa->szCurrentPath2);
 | 
|---|
 | 1421 |     WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 1422 |                       WALK_PATH,
 | 
|---|
 | 1423 |                       EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
 | 
|---|
 | 1424 |     WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
 | 
|---|
 | 1425 |     WinSendDlgItemMsg(hwnd, WALK2_PATH, EM_SETTEXTLIMIT,
 | 
|---|
 | 1426 |                       MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
 | 
|---|
 | 1427 |     WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
 | 
|---|
 | 1428 |     FillPathListBox(hwnd,
 | 
|---|
 | 1429 |                     WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 1430 |                     WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 1431 |                     wa->szCurrentPath1, FALSE);
 | 
|---|
 | 1432 |     FillPathListBox(hwnd,
 | 
|---|
 | 1433 |                     WinWindowFromID(hwnd, WALK2_DRIVELIST),
 | 
|---|
 | 1434 |                     WinWindowFromID(hwnd, WALK2_DIRLIST),
 | 
|---|
 | 1435 |                     wa->szCurrentPath2, FALSE);
 | 
|---|
 | 1436 |     if (!PostMsg(hwnd, UM_SETUP4, MPVOID, MPVOID))
 | 
|---|
 | 1437 |       okay = TRUE;
 | 
|---|
 | 1438 |     {
 | 
|---|
 | 1439 |       MRESULT ret;
 | 
|---|
| [2] | 1440 | 
 | 
|---|
| [551] | 1441 |       ret = WinDefDlgProc(hwnd, WM_INITDLG, mp1, mp2);
 | 
|---|
 | 1442 |       WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
 | 
|---|
 | 1443 |       WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
 | 
|---|
 | 1444 |       WinInvalidateRect(WinWindowFromID(hwnd, WALK2_PATH), NULL, TRUE);
 | 
|---|
 | 1445 |       return ret;
 | 
|---|
 | 1446 |     }
 | 
|---|
| [2] | 1447 | 
 | 
|---|
| [551] | 1448 |   case UM_SETUP4:
 | 
|---|
 | 1449 |     okay = TRUE;
 | 
|---|
 | 1450 |     return 0;
 | 
|---|
| [2] | 1451 | 
 | 
|---|
| [551] | 1452 |   case WM_PRESPARAMCHANGED:
 | 
|---|
 | 1453 |     {
 | 
|---|
 | 1454 |       ULONG AttrFound, AttrValue[64], cbRetLen;
 | 
|---|
| [2] | 1455 | 
 | 
|---|
| [551] | 1456 |       cbRetLen = WinQueryPresParam(hwnd, (ULONG) mp1, 0, &AttrFound,
 | 
|---|
 | 1457 |                                    (ULONG) sizeof(AttrValue), &AttrValue, 0);
 | 
|---|
 | 1458 |       if (cbRetLen) {
 | 
|---|
 | 1459 |         switch (AttrFound) {
 | 
|---|
 | 1460 |         case PP_FONTNAMESIZE:
 | 
|---|
 | 1461 |           PrfWriteProfileData(fmprof,
 | 
|---|
 | 1462 |                               appname,
 | 
|---|
 | 1463 |                               "WalkFont", (PVOID) AttrValue, cbRetLen);
 | 
|---|
 | 1464 |           *WalkFont = 0;
 | 
|---|
 | 1465 |           WalkFontSize = sizeof(WalkFont);
 | 
|---|
 | 1466 |           WinInvalidateRect(WinWindowFromID(hwnd, WALK_PATH), NULL, TRUE);
 | 
|---|
 | 1467 |           break;
 | 
|---|
| [242] | 1468 |         }
 | 
|---|
| [551] | 1469 |       }
 | 
|---|
 | 1470 |     }
 | 
|---|
 | 1471 |     break;
 | 
|---|
| [2] | 1472 | 
 | 
|---|
| [551] | 1473 |   case UM_SETUP:
 | 
|---|
 | 1474 |     {
 | 
|---|
 | 1475 |       INT x;
 | 
|---|
 | 1476 |       USHORT id[] = { WALK_PATH, WALK_DIRLIST,
 | 
|---|
 | 1477 |         WALK2_PATH, WALK2_DIRLIST, 0
 | 
|---|
 | 1478 |       };
 | 
|---|
| [2] | 1479 | 
 | 
|---|
| [551] | 1480 |       if (*WalkFont ||
 | 
|---|
 | 1481 |           (PrfQueryProfileData(fmprof,
 | 
|---|
 | 1482 |                                appname,
 | 
|---|
 | 1483 |                                "WalkFont",
 | 
|---|
 | 1484 |                                (PVOID) WalkFont,
 | 
|---|
 | 1485 |                                &WalkFontSize) && WalkFontSize)) {
 | 
|---|
 | 1486 |         for (x = 0; id[x]; x++)
 | 
|---|
 | 1487 |           WinSetPresParam(WinWindowFromID(hwnd, id[x]),
 | 
|---|
 | 1488 |                           PP_FONTNAMESIZE, WalkFontSize, (PVOID) WalkFont);
 | 
|---|
 | 1489 |       }
 | 
|---|
 | 1490 |     }
 | 
|---|
 | 1491 |     return 0;
 | 
|---|
| [2] | 1492 | 
 | 
|---|
| [551] | 1493 |   case UM_CONTROL:
 | 
|---|
 | 1494 |   case WM_CONTROL:
 | 
|---|
| [574] | 1495 |     wa = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [551] | 1496 |     if (SHORT1FROMMP(mp1) == WALK_DRIVELIST ||
 | 
|---|
 | 1497 |         SHORT1FROMMP(mp1) == WALK_DIRLIST ||
 | 
|---|
 | 1498 |         SHORT1FROMMP(mp1) == WALK2_DRIVELIST ||
 | 
|---|
 | 1499 |         SHORT1FROMMP(mp1) == WALK2_DIRLIST) {
 | 
|---|
 | 1500 |       sSelect = (USHORT) WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 1501 |                                            SHORT1FROMMP(mp1),
 | 
|---|
 | 1502 |                                            LM_QUERYSELECTION, MPVOID, MPVOID);
 | 
|---|
 | 1503 |       *szBuffer = 0;
 | 
|---|
 | 1504 |       if (sSelect >= 0)
 | 
|---|
 | 1505 |         WinSendDlgItemMsg(hwnd, SHORT1FROMMP(mp1), LM_QUERYITEMTEXT,
 | 
|---|
 | 1506 |                           MPFROM2SHORT(sSelect, CCHMAXPATH),
 | 
|---|
 | 1507 |                           MPFROMP(szBuffer));
 | 
|---|
 | 1508 |     }
 | 
|---|
 | 1509 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 1510 |     case WALK_DRIVELIST:
 | 
|---|
 | 1511 |       if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
 | 
|---|
| [2] | 1512 | 
 | 
|---|
| [551] | 1513 |         ULONG ulDirLen = CCHMAXPATH;
 | 
|---|
 | 1514 |         APIRET rc;
 | 
|---|
| [2] | 1515 | 
 | 
|---|
| [551] | 1516 |         rc = DosQCurDir(toupper(*szBuffer) - '@', &szBuff[3], &ulDirLen);
 | 
|---|
 | 1517 |         if (!rc) {
 | 
|---|
 | 1518 |           strcpy(wa->szCurrentPath1, "C:\\");
 | 
|---|
 | 1519 |           *wa->szCurrentPath1 = toupper(*szBuffer);
 | 
|---|
 | 1520 |           WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
 | 
|---|
 | 1521 |           FillPathListBox(hwnd,
 | 
|---|
 | 1522 |                           WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 1523 |                           WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 1524 |                           wa->szCurrentPath1, FALSE);
 | 
|---|
 | 1525 |         }
 | 
|---|
 | 1526 |       }
 | 
|---|
 | 1527 |       break;
 | 
|---|
| [2] | 1528 | 
 | 
|---|
| [551] | 1529 |     case WALK_DIRLIST:
 | 
|---|
 | 1530 |       if (okay && SHORT2FROMMP(mp1) == LN_ENTER) {
 | 
|---|
| [2] | 1531 | 
 | 
|---|
| [551] | 1532 |         ULONG ulSearchCount;
 | 
|---|
| [847] | 1533 |         FILEFINDBUF3 findbuf;
 | 
|---|
| [551] | 1534 |         HDIR hDir;
 | 
|---|
 | 1535 |         APIRET rc;
 | 
|---|
| [2] | 1536 | 
 | 
|---|
| [551] | 1537 |         bstrip(szBuffer);
 | 
|---|
 | 1538 |         if (*szBuffer) {
 | 
|---|
 | 1539 |           strcpy(szBuff, wa->szCurrentPath1);
 | 
|---|
 | 1540 |           if (szBuff[strlen(szBuff) - 1] != '\\')
 | 
|---|
 | 1541 |             strcat(szBuff, "\\");
 | 
|---|
 | 1542 |           strcat(szBuff, szBuffer);
 | 
|---|
 | 1543 |           MakeFullName(szBuff);
 | 
|---|
 | 1544 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 1545 |           hDir = HDIR_CREATE;
 | 
|---|
| [766] | 1546 |           ulSearchCount = 1;
 | 
|---|
| [551] | 1547 |           if (!IsRoot(szBuff)) {
 | 
|---|
| [847] | 1548 |             rc = DosFindFirst(szBuff,
 | 
|---|
 | 1549 |                               &hDir,
 | 
|---|
 | 1550 |                               FILE_DIRECTORY |
 | 
|---|
 | 1551 |                               MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
 | 1552 |                               FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
 | 1553 |                               &findbuf,
 | 
|---|
 | 1554 |                               sizeof(FILEFINDBUF3),
 | 
|---|
 | 1555 |                               &ulSearchCount, FIL_STANDARD);
 | 
|---|
| [551] | 1556 |             if (!rc)
 | 
|---|
 | 1557 |               DosFindClose(hDir);
 | 
|---|
 | 1558 |           }
 | 
|---|
 | 1559 |           else {
 | 
|---|
 | 1560 |             findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
 | 1561 |             rc = 0;
 | 
|---|
 | 1562 |           }
 | 
|---|
 | 1563 |           if (!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
 | 
|---|
 | 1564 |             strcpy(wa->szCurrentPath1, szBuff);
 | 
|---|
 | 1565 |             WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
 | 
|---|
 | 1566 |             FillPathListBox(hwnd,
 | 
|---|
 | 1567 |                             WinWindowFromID(hwnd, WALK_DRIVELIST),
 | 
|---|
 | 1568 |                             WinWindowFromID(hwnd, WALK_DIRLIST),
 | 
|---|
 | 1569 |                             wa->szCurrentPath1, FALSE);
 | 
|---|
 | 1570 |           }
 | 
|---|
 | 1571 |         }
 | 
|---|
 | 1572 |       }
 | 
|---|
 | 1573 |       break;
 | 
|---|
| [2] | 1574 | 
 | 
|---|
| [551] | 1575 |     case WALK2_DRIVELIST:
 | 
|---|
 | 1576 |       if (okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
 | 
|---|
| [2] | 1577 | 
 | 
|---|
| [551] | 1578 |         ULONG ulDirLen = CCHMAXPATH;
 | 
|---|
 | 1579 |         APIRET rc;
 | 
|---|
| [2] | 1580 | 
 | 
|---|
| [551] | 1581 |         rc = DosQCurDir(toupper(*szBuffer) - '@', &szBuff[3], &ulDirLen);
 | 
|---|
 | 1582 |         if (!rc) {
 | 
|---|
 | 1583 |           strcpy(wa->szCurrentPath2, "C:\\");
 | 
|---|
 | 1584 |           *wa->szCurrentPath2 = toupper(*szBuffer);
 | 
|---|
 | 1585 |           WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
 | 
|---|
 | 1586 |           FillPathListBox(hwnd,
 | 
|---|
 | 1587 |                           WinWindowFromID(hwnd, WALK2_DRIVELIST),
 | 
|---|
 | 1588 |                           WinWindowFromID(hwnd, WALK2_DIRLIST),
 | 
|---|
 | 1589 |                           wa->szCurrentPath2, FALSE);
 | 
|---|
 | 1590 |         }
 | 
|---|
 | 1591 |       }
 | 
|---|
 | 1592 |       break;
 | 
|---|
| [2] | 1593 | 
 | 
|---|
| [551] | 1594 |     case WALK2_DIRLIST:
 | 
|---|
 | 1595 |       if (okay && SHORT2FROMMP(mp1) == LN_ENTER) {
 | 
|---|
| [2] | 1596 | 
 | 
|---|
| [551] | 1597 |         ULONG ulSearchCount;
 | 
|---|
| [847] | 1598 |         FILEFINDBUF3 findbuf;
 | 
|---|
| [551] | 1599 |         HDIR hDir;
 | 
|---|
 | 1600 |         APIRET rc;
 | 
|---|
| [2] | 1601 | 
 | 
|---|
| [551] | 1602 |         bstrip(szBuffer);
 | 
|---|
 | 1603 |         if (*szBuffer) {
 | 
|---|
 | 1604 |           strcpy(szBuff, wa->szCurrentPath2);
 | 
|---|
 | 1605 |           if (szBuff[strlen(szBuff) - 1] != '\\')
 | 
|---|
 | 1606 |             strcat(szBuff, "\\");
 | 
|---|
 | 1607 |           strcat(szBuff, szBuffer);
 | 
|---|
 | 1608 |           MakeFullName(szBuff);
 | 
|---|
 | 1609 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 1610 |           hDir = HDIR_CREATE;
 | 
|---|
| [766] | 1611 |           ulSearchCount = 1;
 | 
|---|
| [551] | 1612 |           if (!IsRoot(szBuff)) {
 | 
|---|
| [847] | 1613 |             rc = DosFindFirst(szBuff,
 | 
|---|
 | 1614 |                               &hDir,
 | 
|---|
 | 1615 |                               FILE_DIRECTORY |
 | 
|---|
 | 1616 |                               MUST_HAVE_DIRECTORY | FILE_READONLY |
 | 
|---|
 | 1617 |                               FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
 | 
|---|
 | 1618 |                               &findbuf,
 | 
|---|
 | 1619 |                               sizeof(FILEFINDBUF3),
 | 
|---|
 | 1620 |                               &ulSearchCount, FIL_STANDARD);
 | 
|---|
| [551] | 1621 |             if (!rc)
 | 
|---|
 | 1622 |               DosFindClose(hDir);
 | 
|---|
 | 1623 |           }
 | 
|---|
 | 1624 |           else {
 | 
|---|
 | 1625 |             findbuf.attrFile = FILE_DIRECTORY;
 | 
|---|
 | 1626 |             rc = 0;
 | 
|---|
 | 1627 |           }
 | 
|---|
 | 1628 |           if (!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
 | 
|---|
 | 1629 |             strcpy(wa->szCurrentPath2, szBuff);
 | 
|---|
 | 1630 |             WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
 | 
|---|
 | 1631 |             FillPathListBox(hwnd,
 | 
|---|
 | 1632 |                             WinWindowFromID(hwnd, WALK2_DRIVELIST),
 | 
|---|
 | 1633 |                             WinWindowFromID(hwnd, WALK2_DIRLIST),
 | 
|---|
 | 1634 |                             wa->szCurrentPath2, FALSE);
 | 
|---|
 | 1635 |           }
 | 
|---|
| [242] | 1636 |         }
 | 
|---|
| [551] | 1637 |       }
 | 
|---|
 | 1638 |       break;
 | 
|---|
 | 1639 |     }
 | 
|---|
 | 1640 |     return 0;
 | 
|---|
 | 1641 | 
 | 
|---|
 | 1642 |   case WM_COMMAND:
 | 
|---|
| [574] | 1643 |     wa = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [551] | 1644 |     if (!wa)
 | 
|---|
 | 1645 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 1646 |     *szBuff = 0;
 | 
|---|
 | 1647 |     WinQueryDlgItemText(hwnd, WALK_PATH, CCHMAXPATH, szBuff);
 | 
|---|
 | 1648 |     bstrip(szBuff);
 | 
|---|
 | 1649 |     while ((p = strchr(szBuff, '/')) != NULL)
 | 
|---|
 | 1650 |       *p = '\\';
 | 
|---|
 | 1651 |     while (strlen(szBuff) > 3 && szBuff[strlen(szBuff) - 1] == '\\')
 | 
|---|
 | 1652 |       szBuff[strlen(szBuff) - 1] = 0;
 | 
|---|
 | 1653 |     MakeFullName(szBuff);
 | 
|---|
| [864] | 1654 |     if (*szBuff && stricmp(szBuff, wa->szCurrentPath1) && SHORT1FROMMP(mp1) != DID_CANCEL) {
 | 
|---|
| [551] | 1655 |       if (!SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 1656 |                                  QW_OWNER), hwnd, szBuff, 0))
 | 
|---|
 | 1657 |         strcpy(wa->szCurrentPath1, szBuff);
 | 
|---|
| [865] | 1658 |       else
 | 
|---|
| [242] | 1659 |         return 0;
 | 
|---|
| [551] | 1660 |     }
 | 
|---|
 | 1661 |     WinSetDlgItemText(hwnd, WALK_PATH, wa->szCurrentPath1);
 | 
|---|
 | 1662 |     *szBuff = 0;
 | 
|---|
 | 1663 |     WinQueryDlgItemText(hwnd, WALK2_PATH, CCHMAXPATH, szBuff);
 | 
|---|
 | 1664 |     bstrip(szBuff);
 | 
|---|
 | 1665 |     while ((p = strchr(szBuff, '/')) != NULL)
 | 
|---|
 | 1666 |       *p = '\\';
 | 
|---|
 | 1667 |     while (strlen(szBuff) > 3 && szBuff[strlen(szBuff) - 1] == '\\')
 | 
|---|
 | 1668 |       szBuff[strlen(szBuff) - 1] = 0;
 | 
|---|
 | 1669 |     MakeFullName(szBuff);
 | 
|---|
| [864] | 1670 |     if (*szBuff && stricmp(szBuff, wa->szCurrentPath2) && SHORT1FROMMP(mp1) != DID_CANCEL) {
 | 
|---|
| [551] | 1671 |       if (!SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 1672 |                                  QW_OWNER), hwnd, szBuff, 0))
 | 
|---|
 | 1673 |         strcpy(wa->szCurrentPath2, szBuff);
 | 
|---|
| [865] | 1674 |       else
 | 
|---|
| [551] | 1675 |         return 0;
 | 
|---|
 | 1676 |     }
 | 
|---|
 | 1677 |     WinSetDlgItemText(hwnd, WALK2_PATH, wa->szCurrentPath2);
 | 
|---|
 | 1678 |     switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 1679 |     case DID_OK:
 | 
|---|
| [939] | 1680 |       {
 | 
|---|
 | 1681 |       SWP swp;
 | 
|---|
 | 1682 |       ULONG size = sizeof(SWP);
 | 
|---|
 | 1683 | 
 | 
|---|
 | 1684 |       WinQueryWindowPos(hwnd, &swp);
 | 
|---|
 | 1685 |       PrfWriteProfileData(fmprof, FM3Str, "WalkDir2.Position", (PVOID) &swp,
 | 
|---|
| [1077] | 1686 |                           size);
 | 
|---|
| [939] | 1687 |       }
 | 
|---|
| [551] | 1688 |       WinDismissDlg(hwnd, 1);
 | 
|---|
 | 1689 |       break;
 | 
|---|
| [2] | 1690 | 
 | 
|---|
| [551] | 1691 |     case IDM_HELP:
 | 
|---|
 | 1692 |       if (hwndHelp)
 | 
|---|
 | 1693 |         WinSendMsg(hwndHelp,
 | 
|---|
 | 1694 |                    HM_DISPLAY_HELP,
 | 
|---|
 | 1695 |                    MPFROM2SHORT(HELP_WALKEM2, 0), MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
 | 1696 |       break;
 | 
|---|
| [2] | 1697 | 
 | 
|---|
| [551] | 1698 |     case DID_CANCEL:
 | 
|---|
| [939] | 1699 |       {
 | 
|---|
 | 1700 |       SWP swp;
 | 
|---|
 | 1701 |       ULONG size = sizeof(SWP);
 | 
|---|
 | 1702 | 
 | 
|---|
 | 1703 |       WinQueryWindowPos(hwnd, &swp);
 | 
|---|
 | 1704 |       PrfWriteProfileData(fmprof, FM3Str, "WalkDir2.Position", (PVOID) &swp,
 | 
|---|
| [1077] | 1705 |                           size);
 | 
|---|
| [939] | 1706 |       }
 | 
|---|
| [551] | 1707 |       WinDismissDlg(hwnd, 0);
 | 
|---|
 | 1708 |       break;
 | 
|---|
 | 1709 |     }
 | 
|---|
 | 1710 |     return 0;
 | 
|---|
| [2] | 1711 | 
 | 
|---|
| [551] | 1712 |   case WM_CLOSE:
 | 
|---|
 | 1713 |     break;
 | 
|---|
 | 1714 |   }
 | 
|---|
 | 1715 |   return WinDefDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1716 | }
 | 
|---|
 | 1717 | 
 | 
|---|
| [242] | 1718 | MRESULT EXPENTRY WalkTwoCmpDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 1719 |                                    MPARAM mp2)
 | 
|---|
 | 1720 | {
 | 
|---|
| [551] | 1721 |   switch (msg) {
 | 
|---|
 | 1722 |   case WM_INITDLG:
 | 
|---|
 | 1723 |     WinSetWindowText(hwnd, GetPString(IDS_WALKCOMPAREDLGTEXT));
 | 
|---|
 | 1724 |     return WalkTwoDlgProc(hwnd, UM_SETUP2, mp1, mp2);
 | 
|---|
 | 1725 |   }
 | 
|---|
 | 1726 |   return WalkTwoDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1727 | }
 | 
|---|
 | 1728 | 
 | 
|---|
| [242] | 1729 | MRESULT EXPENTRY WalkTwoSetDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 1730 |                                    MPARAM mp2)
 | 
|---|
 | 1731 | {
 | 
|---|
| [551] | 1732 |   switch (msg) {
 | 
|---|
 | 1733 |   case WM_INITDLG:
 | 
|---|
 | 1734 |     WinSetWindowText(hwnd, GetPString(IDS_WALKSETDIRSDLGTEXT));
 | 
|---|
 | 1735 |     return WalkTwoDlgProc(hwnd, UM_SETUP2, mp1, mp2);
 | 
|---|
 | 1736 |   }
 | 
|---|
 | 1737 |   return WalkTwoDlgProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1738 | }
 | 
|---|
| [794] | 1739 | 
 | 
|---|
 | 1740 | #pragma alloc_text(WALKER,FillPathListBox,WalkDlgProc,TextSubProc)
 | 
|---|
 | 1741 | #pragma alloc_text(WALKER,WalkAllDlgProc,WalkCopyDlgProc)
 | 
|---|
 | 1742 | #pragma alloc_text(WALKER,WalkMoveDlgProc,WalkExtractDlgProc,WalkTargetDlgProc)
 | 
|---|
 | 1743 | #pragma alloc_text(WALK2,WalkTwoDlgProc,WalkTwoCmpDlgProc,WalkTwoSetDlgProc)
 | 
|---|
 | 1744 | #pragma alloc_text(UDIRS,add_udir,remove_udir,remove_ldir,load_udirs)
 | 
|---|
| [807] | 1745 | #pragma alloc_text(UDIRS,save_udirs,load_setups,save_setups,add_setups)
 | 
|---|
| [794] | 1746 | #pragma alloc_text(UDIRS,remove_setup)
 | 
|---|