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