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