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