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