Changeset 1161
- Timestamp:
 - Sep 5, 2008, 11:42:27 PM (17 years ago)
 - Location:
 - trunk/dll
 - Files:
 - 
      
- 10 edited
 
- 
          
  filter.c (modified) (1 diff)
 - 
          
  grep2.c (modified) (22 diffs)
 - 
          
  inis.c (modified) (86 diffs)
 - 
          
  mainwnd2.c (modified) (1 diff)
 - 
          
  mle.c (modified) (1 diff)
 - 
          
  notebook.c (modified) (108 diffs)
 - 
          
  pathutil.c (modified) (2 diffs)
 - 
          
  sortcnr.c (modified) (10 diffs)
 - 
          
  srchpath.c (modified) (1 diff)
 - 
          
  undel.c (modified) (1 diff)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/dll/filter.c
r1119 r1161 51 51 static LINKMASKS *maskhead = NULL; 52 52 static BOOL loadedmasks = FALSE; 53 54 static VOID save_masks(VOID); 53 55 54 56 INT APIENTRY Filter(PMINIRECORDCORE rmini, PVOID arg)  - 
      
trunk/dll/grep2.c
r1119 r1161 31 31 #include <ctype.h> 32 32 #include <share.h> 33 #include <process.h> // _beginthread33 #include <process.h> // _beginthread 34 34 35 35 #define INCL_DOS 36 36 #define INCL_WIN 37 #define INCL_LONGLONG // dircnrs.h38 #define INCL_WINSTDCNR // makelist.h37 #define INCL_LONGLONG // dircnrs.h 38 #define INCL_WINSTDCNR // makelist.h 39 39 40 40 #include "fm3dlg.h" … … 42 42 #include "mle.h" 43 43 #include "grep.h" 44 #include "errutil.h" // Dos_Error...45 #include "strutil.h" // GetPString44 #include "errutil.h" // Dos_Error... 45 #include "strutil.h" // GetPString 46 46 #include "pathutil.h" // BldFullPathName 47 #include "walkem.h" // FillPathListBox 48 #include "grep2.h" 47 49 #include "fm3dll.h" 50 #include "misc.h" // LoadLibPath 48 51 #include "fortify.h" 49 52 … … 67 70 *(CHAR *)mp2 = 0; 68 71 { 69 CHAR *p;70 CHAR *pp;71 72 p = GetPString(IDS_ENVVARNAMES);73 while (*p == ' ')74 p++;75 while (*p) {76 *szPath = 0;77 pp = szPath;78 while (*p && *p != ' ')79 *pp++ = *p++;80 *pp = 0;81 while (*p == ' ')82 p++;83 if (*szPath)84 WinSendDlgItemMsg(hwnd,85 ENV_LISTBOX,86 LM_INSERTITEM,87 MPFROM2SHORT(LIT_END, 0), MPFROMP(szPath));88 }72 CHAR *p; 73 CHAR *pp; 74 75 p = GetPString(IDS_ENVVARNAMES); 76 while (*p == ' ') 77 p++; 78 while (*p) { 79 *szPath = 0; 80 pp = szPath; 81 while (*p && *p != ' ') 82 *pp++ = *p++; 83 *pp = 0; 84 while (*p == ' ') 85 p++; 86 if (*szPath) 87 WinSendDlgItemMsg(hwnd, 88 ENV_LISTBOX, 89 LM_INSERTITEM, 90 MPFROM2SHORT(LIT_END, 0), MPFROMP(szPath)); 91 } 89 92 } 90 93 WinSendDlgItemMsg(hwnd, 91 ENV_NAME,92 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);94 ENV_NAME, 95 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 93 96 WinSetDlgItemText(hwnd, ENV_NAME, lastenv); 94 97 WinSendDlgItemMsg(hwnd, 95 ENV_NAME,96 EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID);98 ENV_NAME, 99 EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID); 97 100 } 98 101 else … … 105 108 switch (SHORT2FROMMP(mp1)) { 106 109 case LN_SELECT: 107 {108 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,109 ENV_LISTBOX,110 LM_QUERYSELECTION,111 MPFROMSHORT(LIT_FIRST), MPVOID);112 if (sSelect >= 0) {113 *s = 0;114 WinSendDlgItemMsg(hwnd,115 ENV_LISTBOX,116 LM_QUERYITEMTEXT,117 MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));118 bstrip(s);119 if (*s)120 WinSetDlgItemText(hwnd, ENV_NAME, s);121 }122 }123 break;110 { 111 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 112 ENV_LISTBOX, 113 LM_QUERYSELECTION, 114 MPFROMSHORT(LIT_FIRST), MPVOID); 115 if (sSelect >= 0) { 116 *s = 0; 117 WinSendDlgItemMsg(hwnd, 118 ENV_LISTBOX, 119 LM_QUERYITEMTEXT, 120 MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s)); 121 bstrip(s); 122 if (*s) 123 WinSetDlgItemText(hwnd, ENV_NAME, s); 124 } 125 } 126 break; 124 127 case LN_ENTER: 125 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID);126 break;128 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID); 129 break; 127 130 } 128 131 } … … 137 140 p = WinQueryWindowPtr(hwnd, QWL_USER); 138 141 if (p) { 139 WinQueryDlgItemText(hwnd, ENV_NAME, CCHMAXPATH, p);140 bstrip(p);141 if (!*p) {142 DosBeep(50, 100);143 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ENV_NAME));144 }145 else {146 strcpy(lastenv, p);147 WinDismissDlg(hwnd, 1);148 }142 WinQueryDlgItemText(hwnd, ENV_NAME, CCHMAXPATH, p); 143 bstrip(p); 144 if (!*p) { 145 DosBeep(50, 100); 146 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ENV_NAME)); 147 } 148 else { 149 strcpy(lastenv, p); 150 WinDismissDlg(hwnd, 1); 151 } 149 152 } 150 153 break; 151 154 case IDM_HELP: 152 155 if (hwndHelp) 153 WinSendMsg(hwndHelp,154 HM_DISPLAY_HELP,155 MPFROM2SHORT(HELP_ENV, 0), MPFROMSHORT(HM_RESOURCEID));156 WinSendMsg(hwndHelp, 157 HM_DISPLAY_HELP, 158 MPFROM2SHORT(HELP_ENV, 0), MPFROMSHORT(HM_RESOURCEID)); 156 159 break; 157 160 } … … 199 202 WinSetWindowULong(hwnd, QWL_USER, *(HWND *) mp2); 200 203 WinSendDlgItemMsg(hwnd, 201 GREP_MASK,202 EM_SETTEXTLIMIT, MPFROM2SHORT(8192, 0), MPVOID);204 GREP_MASK, 205 EM_SETTEXTLIMIT, MPFROM2SHORT(8192, 0), MPVOID); 203 206 MLEsetlimit(hwndMLE, 4096); 204 207 MLEsetformat(hwndMLE, MLFIE_NOTRANS); 205 208 WinSendDlgItemMsg(hwnd, 206 GREP_NEWER,207 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);209 GREP_NEWER, 210 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID); 208 211 WinSendDlgItemMsg(hwnd, 209 GREP_OLDER,210 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);212 GREP_OLDER, 213 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID); 211 214 WinSendDlgItemMsg(hwnd, 212 GREP_GREATER,213 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);215 GREP_GREATER, 216 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID); 214 217 WinSendDlgItemMsg(hwnd, 215 GREP_LESSER,216 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID);218 GREP_LESSER, 219 EM_SETTEXTLIMIT, MPFROM2SHORT(34, 0), MPVOID); 217 220 WinSetDlgItemText(hwnd, GREP_MASK, lastmask); 218 221 WinSendDlgItemMsg(hwnd, 219 GREP_MASK, EM_SETSEL, MPFROM2SHORT(0, 8192), MPVOID);222 GREP_MASK, EM_SETSEL, MPFROM2SHORT(0, 8192), MPVOID); 220 223 PrfQueryProfileData(fmprof, FM3Str, "RememberFlagsGrep", 221 (PVOID) & gRemember, &size);224 (PVOID) & gRemember, &size); 222 225 WinCheckButton(hwnd, GREP_REMEMBERFLAGS, gRemember); 223 226 if (gRemember) { 224 227 PrfQueryProfileData(fmprof, FM3Str, "Grep_Recurse", 225 (PVOID) & recurse, &size);228 (PVOID) & recurse, &size); 226 229 PrfQueryProfileData(fmprof, FM3Str, "Grep_Absolute", 227 (PVOID) & absolute, &size);230 (PVOID) & absolute, &size); 228 231 PrfQueryProfileData(fmprof, FM3Str, "Grep_Case", 229 (PVOID) & sensitive, &size);232 (PVOID) & sensitive, &size); 230 233 PrfQueryProfileData(fmprof, FM3Str, "Grep_Sayfiles", 231 (PVOID) & sayfiles, &size);234 (PVOID) & sayfiles, &size); 232 235 PrfQueryProfileData(fmprof, FM3Str, "Grep_Searchfiles", 233 (PVOID) & searchFiles, &size);236 (PVOID) & searchFiles, &size); 234 237 PrfQueryProfileData(fmprof, FM3Str, "Grep_SearchfEAs", 235 (PVOID) & searchEAs, &size);238 (PVOID) & searchEAs, &size); 236 239 } 237 240 if (!gRemember) { … … 248 251 MLEsetcurposa(hwndMLE, 4096); 249 252 if (!searchEAs) 250 searchFiles = TRUE;253 searchFiles = TRUE; 251 254 } 252 255 WinCheckButton(hwnd, GREP_RECURSE, recurse); … … 275 278 if (fp) { 276 279 while (!feof(fp)) { 277 if (!xfgets_bstripcr(s, 8192 + 4, fp, pszSrcFile, __LINE__))278 break;279 if (*s && *s != ';') {280 WinSendDlgItemMsg(hwnd,281 GREP_LISTBOX,282 LM_INSERTITEM,283 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));284 }280 if (!xfgets_bstripcr(s, 8192 + 4, fp, pszSrcFile, __LINE__)) 281 break; 282 if (*s && *s != ';') { 283 WinSendDlgItemMsg(hwnd, 284 GREP_LISTBOX, 285 LM_INSERTITEM, 286 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s)); 287 } 285 288 } 286 289 fclose(fp); … … 288 291 289 292 FillPathListBox(hwnd, 290 WinWindowFromID(hwnd, GREP_DRIVELIST),291 (HWND) 0, NULL, FALSE);293 WinWindowFromID(hwnd, GREP_DRIVELIST), 294 (HWND) 0, NULL, FALSE); 292 295 break; 293 296 … … 298 301 case UM_SETDIR: 299 302 PaintRecessedWindow(WinWindowFromID(hwnd, GREP_HELP), 300 (HPS) 0, FALSE, TRUE);303 (HPS) 0, FALSE, TRUE); 301 304 return 0; 302 305 … … 311 314 case GREP_REMEMBERFLAGS: 312 315 { 313 BOOL gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS);314 315 PrfWriteProfileData(fmprof, FM3Str, "RememberFlagsGrep",316 (PVOID) & gRemember, sizeof(BOOL));316 BOOL gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS); 317 318 PrfWriteProfileData(fmprof, FM3Str, "RememberFlagsGrep", 319 (PVOID) & gRemember, sizeof(BOOL)); 317 320 } 318 321 break; … … 321 324 switch (SHORT2FROMMP(mp1)) { 322 325 case LN_KILLFOCUS: 323 WinSetDlgItemText(hwnd,324 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));325 break;326 WinSetDlgItemText(hwnd, 327 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 328 break; 326 329 case LN_SETFOCUS: 327 WinSetDlgItemText(hwnd,328 GREP_HELP, GetPString(IDS_2CLICKADDDRVMASKTEXT));329 break;330 WinSetDlgItemText(hwnd, 331 GREP_HELP, GetPString(IDS_2CLICKADDDRVMASKTEXT)); 332 break; 330 333 case LN_ENTER: 331 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);332 bstrip(s);333 p = strrchr(s, '\\');334 if (p)335 strcpy(simple, p);336 else if (*s) {337 strcpy(simple, "\\");338 strcat(simple, s);339 *s = 0;340 }341 else342 strcpy(simple, "\\*");343 if (simple[strlen(simple) - 1] == ';')344 simple[strlen(simple) - 1] = 0;345 lLen = strlen(simple) + 1;346 if (strlen(s) > 8192 - lLen) {347 Runtime_Error(pszSrcFile, __LINE__, "too big");348 WinSetDlgItemText(hwnd, GREP_MASK, s);349 break;350 }351 352 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,353 GREP_DRIVELIST,354 LM_QUERYSELECTION,355 MPFROMSHORT(LIT_FIRST), MPVOID);356 if (sSelect >= 0) {357 if (*s && s[strlen(s) - 1] != ';')358 strcat(s, ";");359 WinSendDlgItemMsg(hwnd,360 GREP_DRIVELIST,361 LM_QUERYITEMTEXT,362 MPFROM2SHORT(sSelect,363 (8192 - strlen(s)) - lLen),364 MPFROMP(&s[strlen(s)]));365 rstrip(s);366 if (*s) {367 strcat(s, simple);368 WinSetDlgItemText(hwnd, GREP_MASK, s);369 WinSendDlgItemMsg(hwnd,370 GREP_MASK,371 EM_SETSEL,372 MPFROM2SHORT(strlen(s) - (lLen + 1),373 strlen(s)), MPVOID);374 PostMsg(hwnd,375 UM_FOCUSME,376 MPFROMLONG(WinWindowFromID(hwnd, GREP_MASK)), MPVOID);377 }378 }379 break;// LN_ENTER380 } // switch334 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s); 335 bstrip(s); 336 p = strrchr(s, '\\'); 337 if (p) 338 strcpy(simple, p); 339 else if (*s) { 340 strcpy(simple, "\\"); 341 strcat(simple, s); 342 *s = 0; 343 } 344 else 345 strcpy(simple, "\\*"); 346 if (simple[strlen(simple) - 1] == ';') 347 simple[strlen(simple) - 1] = 0; 348 lLen = strlen(simple) + 1; 349 if (strlen(s) > 8192 - lLen) { 350 Runtime_Error(pszSrcFile, __LINE__, "too big"); 351 WinSetDlgItemText(hwnd, GREP_MASK, s); 352 break; 353 } 354 355 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 356 GREP_DRIVELIST, 357 LM_QUERYSELECTION, 358 MPFROMSHORT(LIT_FIRST), MPVOID); 359 if (sSelect >= 0) { 360 if (*s && s[strlen(s) - 1] != ';') 361 strcat(s, ";"); 362 WinSendDlgItemMsg(hwnd, 363 GREP_DRIVELIST, 364 LM_QUERYITEMTEXT, 365 MPFROM2SHORT(sSelect, 366 (8192 - strlen(s)) - lLen), 367 MPFROMP(&s[strlen(s)])); 368 rstrip(s); 369 if (*s) { 370 strcat(s, simple); 371 WinSetDlgItemText(hwnd, GREP_MASK, s); 372 WinSendDlgItemMsg(hwnd, 373 GREP_MASK, 374 EM_SETSEL, 375 MPFROM2SHORT(strlen(s) - (lLen + 1), 376 strlen(s)), MPVOID); 377 PostMsg(hwnd, 378 UM_FOCUSME, 379 MPFROMLONG(WinWindowFromID(hwnd, GREP_MASK)), MPVOID); 380 } 381 } 382 break; // LN_ENTER 383 } // switch 381 384 break; 382 385 … … 384 387 switch (SHORT2FROMMP(mp1)) { 385 388 case LN_KILLFOCUS: 386 WinSetDlgItemText(hwnd,387 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));388 break;389 WinSetDlgItemText(hwnd, 390 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 391 break; 389 392 case LN_SETFOCUS: 390 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_ADDSELDELMASKTEXT));391 break;393 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_ADDSELDELMASKTEXT)); 394 break; 392 395 case LN_ENTER: 393 396 case LN_SELECT: 394 if ((SHORT2FROMMP(mp1) == LN_ENTER &&395 !WinQueryButtonCheckstate(hwnd, GREP_APPEND)) ||396 (SHORT2FROMMP(mp1) == LN_SELECT &&397 WinQueryButtonCheckstate(hwnd, GREP_APPEND)))398 break;399 {400 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,401 GREP_LISTBOX,402 LM_QUERYSELECTION,403 MPFROMSHORT(LIT_FIRST), MPVOID);404 if (sSelect >= 0) {405 *s = 0;406 if (WinQueryButtonCheckstate(hwnd, GREP_APPEND)) {407 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);408 bstrip(s);409 if (*s && strlen(s) < 8190 && s[strlen(s) - 1] != ';')410 strcat(s, ";");411 }412 WinSendDlgItemMsg(hwnd,413 GREP_LISTBOX,414 LM_QUERYITEMTEXT,415 MPFROM2SHORT(sSelect, 8192 - strlen(s)),416 MPFROMP(s + strlen(s)));417 bstrip(s);418 if (*s)419 WinSetDlgItemText(hwnd, GREP_MASK, s);420 }421 }422 break;397 if ((SHORT2FROMMP(mp1) == LN_ENTER && 398 !WinQueryButtonCheckstate(hwnd, GREP_APPEND)) || 399 (SHORT2FROMMP(mp1) == LN_SELECT && 400 WinQueryButtonCheckstate(hwnd, GREP_APPEND))) 401 break; 402 { 403 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 404 GREP_LISTBOX, 405 LM_QUERYSELECTION, 406 MPFROMSHORT(LIT_FIRST), MPVOID); 407 if (sSelect >= 0) { 408 *s = 0; 409 if (WinQueryButtonCheckstate(hwnd, GREP_APPEND)) { 410 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s); 411 bstrip(s); 412 if (*s && strlen(s) < 8190 && s[strlen(s) - 1] != ';') 413 strcat(s, ";"); 414 } 415 WinSendDlgItemMsg(hwnd, 416 GREP_LISTBOX, 417 LM_QUERYITEMTEXT, 418 MPFROM2SHORT(sSelect, 8192 - strlen(s)), 419 MPFROMP(s + strlen(s))); 420 bstrip(s); 421 if (*s) 422 WinSetDlgItemText(hwnd, GREP_MASK, s); 423 } 424 } 425 break; 423 426 } 424 427 break; … … 426 429 case GREP_MASK: 427 430 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 428 WinSetDlgItemText(hwnd,429 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));431 WinSetDlgItemText(hwnd, 432 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 430 433 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 431 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MASKSFINDTEXT));434 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MASKSFINDTEXT)); 432 435 break; 433 436 case GREP_SEARCH: 434 437 if (SHORT2FROMMP(mp1) == MLN_KILLFOCUS) 435 WinSetDlgItemText(hwnd,436 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));438 WinSetDlgItemText(hwnd, 439 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 437 440 if (SHORT2FROMMP(mp1) == MLN_SETFOCUS) 438 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_TEXTFINDTEXT));441 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_TEXTFINDTEXT)); 439 442 break; 440 443 case GREP_GREATER: 441 444 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 442 WinSetDlgItemText(hwnd,443 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));445 WinSetDlgItemText(hwnd, 446 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 444 447 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 445 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINSIZEFINDTEXT));448 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINSIZEFINDTEXT)); 446 449 break; 447 450 case GREP_LESSER: 448 451 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 449 WinSetDlgItemText(hwnd,450 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));452 WinSetDlgItemText(hwnd, 453 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 451 454 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 452 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXSIZEFINDTEXT));455 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXSIZEFINDTEXT)); 453 456 break; 454 457 case GREP_NEWER: 455 458 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 456 WinSetDlgItemText(hwnd,457 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));459 WinSetDlgItemText(hwnd, 460 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 458 461 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 459 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXAGEFINDTEXT));462 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MAXAGEFINDTEXT)); 460 463 break; 461 464 case GREP_OLDER: 462 465 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 463 WinSetDlgItemText(hwnd,464 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT));466 WinSetDlgItemText(hwnd, 467 GREP_HELP, GetPString(IDS_ARCDEFAULTHELPTEXT)); 465 468 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 466 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINAGEFINDTEXT));469 WinSetDlgItemText(hwnd, GREP_HELP, GetPString(IDS_MINAGEFINDTEXT)); 467 470 break; 468 471 case GREP_FINDDUPES: 469 472 { 470 BOOL finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES);471 472 WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCH), !finddupes);473 WinEnableWindow(WinWindowFromID(hwnd, GREP_ABSOLUTE), !finddupes);474 WinEnableWindow(WinWindowFromID(hwnd, GREP_CASE), !finddupes);475 WinEnableWindow(WinWindowFromID(hwnd, GREP_CRCDUPES), finddupes);476 WinEnableWindow(WinWindowFromID(hwnd, GREP_NOSIZEDUPES), finddupes);477 WinEnableWindow(WinWindowFromID(hwnd, GREP_IGNOREEXTDUPES),478 finddupes);479 WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHFILES), !finddupes);480 WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHEAS), !finddupes);481 WinEnableWindow(WinWindowFromID(hwnd, GREP_GREATER), !finddupes);482 WinEnableWindow(WinWindowFromID(hwnd, GREP_LESSER), !finddupes);483 WinEnableWindow(WinWindowFromID(hwnd, GREP_NEWER), !finddupes);484 WinEnableWindow(WinWindowFromID(hwnd, GREP_OLDER), !finddupes);485 WinEnableWindow(WinWindowFromID(hwnd, GREP_FINDIFANY), !finddupes);486 WinEnableWindow(WinWindowFromID(hwnd, GREP_GK), !finddupes);487 WinEnableWindow(WinWindowFromID(hwnd, GREP_LK), !finddupes);488 WinEnableWindow(WinWindowFromID(hwnd, GREP_NM), !finddupes);489 WinEnableWindow(WinWindowFromID(hwnd, GREP_OM), !finddupes);490 if (finddupes)491 WinCheckButton(hwnd, GREP_RECURSE, TRUE);473 BOOL finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES); 474 475 WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCH), !finddupes); 476 WinEnableWindow(WinWindowFromID(hwnd, GREP_ABSOLUTE), !finddupes); 477 WinEnableWindow(WinWindowFromID(hwnd, GREP_CASE), !finddupes); 478 WinEnableWindow(WinWindowFromID(hwnd, GREP_CRCDUPES), finddupes); 479 WinEnableWindow(WinWindowFromID(hwnd, GREP_NOSIZEDUPES), finddupes); 480 WinEnableWindow(WinWindowFromID(hwnd, GREP_IGNOREEXTDUPES), 481 finddupes); 482 WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHFILES), !finddupes); 483 WinEnableWindow(WinWindowFromID(hwnd, GREP_SEARCHEAS), !finddupes); 484 WinEnableWindow(WinWindowFromID(hwnd, GREP_GREATER), !finddupes); 485 WinEnableWindow(WinWindowFromID(hwnd, GREP_LESSER), !finddupes); 486 WinEnableWindow(WinWindowFromID(hwnd, GREP_NEWER), !finddupes); 487 WinEnableWindow(WinWindowFromID(hwnd, GREP_OLDER), !finddupes); 488 WinEnableWindow(WinWindowFromID(hwnd, GREP_FINDIFANY), !finddupes); 489 WinEnableWindow(WinWindowFromID(hwnd, GREP_GK), !finddupes); 490 WinEnableWindow(WinWindowFromID(hwnd, GREP_LK), !finddupes); 491 WinEnableWindow(WinWindowFromID(hwnd, GREP_NM), !finddupes); 492 WinEnableWindow(WinWindowFromID(hwnd, GREP_OM), !finddupes); 493 if (finddupes) 494 WinCheckButton(hwnd, GREP_RECURSE, TRUE); 492 495 } 493 496 } … … 498 501 case GREP_ENV: 499 502 { 500 CHAR *t;501 CHAR env[8192];502 503 *path = 0;504 if (!WinDlgBox(HWND_DESKTOP,505 hwnd, EnvDlgProc, FM3ModHandle, ENV_FRAME, path)) {506 break;507 }508 bstrip(path);509 if (!*path)510 break;511 if (!stricmp(path, "LIBPATH"))512 LoadLibPath(env, 8192);513 else {514 p = getenv(path);515 if (!p)516 break;517 strcpy(env, p);518 }519 bstrip(env);520 if (!*env)521 break;522 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);523 bstrip(s);524 if (strlen(s) > 8192 - 5) {525 Runtime_Error(pszSrcFile, __LINE__, "too big");526 break;527 }528 p = strrchr(s, '\\');529 if (p)530 strcpy(simple, p + 1);531 else if (*s)532 strcpy(simple, s);533 else534 strcpy(simple, "*");535 if (!p)536 *s = 0;537 if (simple[strlen(simple) - 1] == ';')538 simple[strlen(simple) - 1] = 0;539 lLen = strlen(simple) + 1;540 p = env;541 while (p && *p) {542 strncpy(path, p, CCHMAXPATH - 1);543 path[CCHMAXPATH - 1] = 0;544 t = strchr(path, ';');545 if (t)546 *t = 0;547 bstrip(path);548 if (isalpha(*path) && path[1] == ':' && path[2] == '\\') {549 if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) {550 WinSetDlgItemText(hwnd, GREP_MASK, s);551 break;552 }553 if (!*s || (*s && s[strlen(s) - 1] != ';')) {554 if (*s)555 strcat(s, ";");556 strcat(s, path);557 lLen += strlen(path);558 if (s[strlen(s) - 1] != '\\') {559 lLen++;560 strcat(s, "\\");561 }562 rstrip(s);563 if (*s) {564 strcat(s, simple);565 WinSetDlgItemText(hwnd, GREP_MASK, s);566 WinSendDlgItemMsg(hwnd,567 GREP_MASK,568 EM_SETSEL,569 MPFROM2SHORT(strlen(s) - (lLen - 1),570 strlen(s)), MPVOID);571 }572 }573 }574 p = strchr(p, ';');575 if (p)576 p++;577 }503 CHAR *t; 504 CHAR env[8192]; 505 506 *path = 0; 507 if (!WinDlgBox(HWND_DESKTOP, 508 hwnd, EnvDlgProc, FM3ModHandle, ENV_FRAME, path)) { 509 break; 510 } 511 bstrip(path); 512 if (!*path) 513 break; 514 if (!stricmp(path, "LIBPATH")) 515 LoadLibPath(env, 8192); 516 else { 517 p = getenv(path); 518 if (!p) 519 break; 520 strcpy(env, p); 521 } 522 bstrip(env); 523 if (!*env) 524 break; 525 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s); 526 bstrip(s); 527 if (strlen(s) > 8192 - 5) { 528 Runtime_Error(pszSrcFile, __LINE__, "too big"); 529 break; 530 } 531 p = strrchr(s, '\\'); 532 if (p) 533 strcpy(simple, p + 1); 534 else if (*s) 535 strcpy(simple, s); 536 else 537 strcpy(simple, "*"); 538 if (!p) 539 *s = 0; 540 if (simple[strlen(simple) - 1] == ';') 541 simple[strlen(simple) - 1] = 0; 542 lLen = strlen(simple) + 1; 543 p = env; 544 while (p && *p) { 545 strncpy(path, p, CCHMAXPATH - 1); 546 path[CCHMAXPATH - 1] = 0; 547 t = strchr(path, ';'); 548 if (t) 549 *t = 0; 550 bstrip(path); 551 if (isalpha(*path) && path[1] == ':' && path[2] == '\\') { 552 if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) { 553 WinSetDlgItemText(hwnd, GREP_MASK, s); 554 break; 555 } 556 if (!*s || (*s && s[strlen(s) - 1] != ';')) { 557 if (*s) 558 strcat(s, ";"); 559 strcat(s, path); 560 lLen += strlen(path); 561 if (s[strlen(s) - 1] != '\\') { 562 lLen++; 563 strcat(s, "\\"); 564 } 565 rstrip(s); 566 if (*s) { 567 strcat(s, simple); 568 WinSetDlgItemText(hwnd, GREP_MASK, s); 569 WinSendDlgItemMsg(hwnd, 570 GREP_MASK, 571 EM_SETSEL, 572 MPFROM2SHORT(strlen(s) - (lLen - 1), 573 strlen(s)), MPVOID); 574 } 575 } 576 } 577 p = strchr(p, ';'); 578 if (p) 579 p++; 580 } 578 581 } 579 582 break; … … 583 586 bstrip(s); 584 587 if (strlen(s) > 8192 - 5) { 585 Runtime_Error(pszSrcFile, __LINE__, "too big");586 break;588 Runtime_Error(pszSrcFile, __LINE__, "too big"); 589 break; 587 590 } 588 591 *path = 0; 589 592 if (WinDlgBox(HWND_DESKTOP, 590 hwnd,591 WalkAllDlgProc,592 FM3ModHandle, WALK_FRAME, MPFROMP(path)) && *path) {593 p = strrchr(s, '\\');594 if (p)595 strcpy(simple, p + 1);596 else if (*s)597 strcpy(simple, s);598 else599 strcpy(simple, "*");600 if (!p)601 *s = 0;602 if (simple[strlen(simple) - 1] == ';')603 simple[strlen(simple) - 1] = 0;604 lLen = strlen(simple) + 1;605 if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) {606 Runtime_Error(pszSrcFile, __LINE__, "too big");607 WinSetDlgItemText(hwnd, GREP_MASK, s);608 break;609 }610 if (!*s || (*s && s[strlen(s) - 1] != ';')) {611 if (*s)612 strcat(s, ";");613 strcat(s, path);614 lLen += strlen(path);615 if (s[strlen(s) - 1] != '\\') {616 lLen++;617 strcat(s, "\\");618 }619 rstrip(s);620 if (*s) {621 strcat(s, simple);622 WinSetDlgItemText(hwnd, GREP_MASK, s);623 WinSendDlgItemMsg(hwnd,624 GREP_MASK,625 EM_SETSEL,626 MPFROM2SHORT(strlen(s) - (lLen - 1),627 strlen(s)), MPVOID);628 }629 }593 hwnd, 594 WalkAllDlgProc, 595 FM3ModHandle, WALK_FRAME, MPFROMP(path)) && *path) { 596 p = strrchr(s, '\\'); 597 if (p) 598 strcpy(simple, p + 1); 599 else if (*s) 600 strcpy(simple, s); 601 else 602 strcpy(simple, "*"); 603 if (!p) 604 *s = 0; 605 if (simple[strlen(simple) - 1] == ';') 606 simple[strlen(simple) - 1] = 0; 607 lLen = strlen(simple) + 1; 608 if (strlen(s) > (8192 - lLen) - (strlen(path) + 1)) { 609 Runtime_Error(pszSrcFile, __LINE__, "too big"); 610 WinSetDlgItemText(hwnd, GREP_MASK, s); 611 break; 612 } 613 if (!*s || (*s && s[strlen(s) - 1] != ';')) { 614 if (*s) 615 strcat(s, ";"); 616 strcat(s, path); 617 lLen += strlen(path); 618 if (s[strlen(s) - 1] != '\\') { 619 lLen++; 620 strcat(s, "\\"); 621 } 622 rstrip(s); 623 if (*s) { 624 strcat(s, simple); 625 WinSetDlgItemText(hwnd, GREP_MASK, s); 626 WinSendDlgItemMsg(hwnd, 627 GREP_MASK, 628 EM_SETSEL, 629 MPFROM2SHORT(strlen(s) - (lLen - 1), 630 strlen(s)), MPVOID); 631 } 632 } 630 633 } 631 634 break; … … 636 639 bstrip(s); 637 640 if (*s) { 638 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,639 GREP_LISTBOX,640 LM_SEARCHSTRING,641 MPFROM2SHORT(0, LIT_FIRST),642 MPFROMP(s));643 if (sSelect < 0) {644 WinSendDlgItemMsg(hwnd,645 GREP_LISTBOX,646 LM_INSERTITEM,647 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s));648 changed = TRUE;649 }641 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 642 GREP_LISTBOX, 643 LM_SEARCHSTRING, 644 MPFROM2SHORT(0, LIT_FIRST), 645 MPFROMP(s)); 646 if (sSelect < 0) { 647 WinSendDlgItemMsg(hwnd, 648 GREP_LISTBOX, 649 LM_INSERTITEM, 650 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(s)); 651 changed = TRUE; 652 } 650 653 } 651 654 break; … … 653 656 case GREP_DELETE: 654 657 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 655 GREP_LISTBOX,656 LM_QUERYSELECTION,657 MPFROMSHORT(LIT_FIRST), MPVOID);658 GREP_LISTBOX, 659 LM_QUERYSELECTION, 660 MPFROMSHORT(LIT_FIRST), MPVOID); 658 661 if (sSelect >= 0) { 659 WinSendDlgItemMsg(hwnd,660 GREP_LISTBOX,661 LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID);662 changed = TRUE;662 WinSendDlgItemMsg(hwnd, 663 GREP_LISTBOX, 664 LM_DELETEITEM, MPFROM2SHORT(sSelect, 0), MPVOID); 665 changed = TRUE; 663 666 } 664 667 break; … … 702 705 case IDM_HELP: 703 706 if (hwndHelp) 704 WinSendMsg(hwndHelp,705 HM_DISPLAY_HELP,706 MPFROM2SHORT(HELP_GREP, 0), MPFROMSHORT(HM_RESOURCEID));707 WinSendMsg(hwndHelp, 708 HM_DISPLAY_HELP, 709 MPFROM2SHORT(HELP_GREP, 0), MPFROMSHORT(HM_RESOURCEID)); 707 710 break; 708 711 … … 711 714 case GREP_ALLHDS: 712 715 { 713 CHAR szDrive[] = " :\\";714 ULONG ulDriveNum;715 ULONG ulDriveMap;716 INT x;717 BOOL incl;718 719 CHAR new[8192];720 721 *s = 0;722 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s);723 s[8192 - 1] = 0;724 p = strchr(s, ';');725 if (p)726 *p = 0;727 p = strrchr(s, '\\');728 if (!p)729 p = strrchr(s, '/');730 if (!p)731 p = strrchr(s, ':');732 if (p)733 strcpy(s, p + 1);734 if (!*s)735 strcpy(s, "*");736 DosError(FERR_DISABLEHARDERR);737 DosQCurDisk(&ulDriveNum, &ulDriveMap);738 *new = 0;739 for (x = 2; x < 26; x++) {740 if (ulDriveMap & (1L << x)) {741 incl = FALSE;742 switch (SHORT1FROMMP(mp1)) {743 case GREP_ALLHDS:744 if (!(driveflags[x] & (DRIVE_REMOVABLE | DRIVE_IGNORE)))745 incl = TRUE;746 break;747 case GREP_LOCALHDS:748 if (!(driveflags[x] &749 (DRIVE_REMOVABLE | DRIVE_IGNORE | DRIVE_REMOTE |750 DRIVE_VIRTUAL)))751 incl = TRUE;752 break;753 case GREP_REMOTEHDS:754 if (!(driveflags[x] &755 (DRIVE_REMOVABLE | DRIVE_IGNORE)) &&756 (driveflags[x] & DRIVE_REMOTE))757 incl = TRUE;758 break;759 }760 }761 if (incl) {762 if (strlen(new) + strlen(s) + 5 < 8192 - 1) {763 if (*new)764 strcat(new, ";");765 *szDrive = x + 'A';766 strcat(new, szDrive);767 strcat(new, s);768 }769 }770 }771 if (*new)772 WinSetDlgItemText(hwnd, GREP_MASK, new);716 CHAR szDrive[] = " :\\"; 717 ULONG ulDriveNum; 718 ULONG ulDriveMap; 719 INT x; 720 BOOL incl; 721 722 CHAR new[8192]; 723 724 *s = 0; 725 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, s); 726 s[8192 - 1] = 0; 727 p = strchr(s, ';'); 728 if (p) 729 *p = 0; 730 p = strrchr(s, '\\'); 731 if (!p) 732 p = strrchr(s, '/'); 733 if (!p) 734 p = strrchr(s, ':'); 735 if (p) 736 strcpy(s, p + 1); 737 if (!*s) 738 strcpy(s, "*"); 739 DosError(FERR_DISABLEHARDERR); 740 DosQCurDisk(&ulDriveNum, &ulDriveMap); 741 *new = 0; 742 for (x = 2; x < 26; x++) { 743 if (ulDriveMap & (1L << x)) { 744 incl = FALSE; 745 switch (SHORT1FROMMP(mp1)) { 746 case GREP_ALLHDS: 747 if (!(driveflags[x] & (DRIVE_REMOVABLE | DRIVE_IGNORE))) 748 incl = TRUE; 749 break; 750 case GREP_LOCALHDS: 751 if (!(driveflags[x] & 752 (DRIVE_REMOVABLE | DRIVE_IGNORE | DRIVE_REMOTE | 753 DRIVE_VIRTUAL))) 754 incl = TRUE; 755 break; 756 case GREP_REMOTEHDS: 757 if (!(driveflags[x] & 758 (DRIVE_REMOVABLE | DRIVE_IGNORE)) && 759 (driveflags[x] & DRIVE_REMOTE)) 760 incl = TRUE; 761 break; 762 } 763 } 764 if (incl) { 765 if (strlen(new) + strlen(s) + 5 < 8192 - 1) { 766 if (*new) 767 strcat(new, ";"); 768 *szDrive = x + 'A'; 769 strcat(new, szDrive); 770 strcat(new, s); 771 } 772 } 773 } 774 if (*new) 775 WinSetDlgItemText(hwnd, GREP_MASK, new); 773 776 } 774 777 break; … … 777 780 hwndCollect = WinQueryWindowULong(hwnd, QWL_USER); 778 781 if (!hwndCollect) 779 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);782 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 780 783 else { 781 // 07 Feb 08 SHL - fixme to malloc and free in thread782 static GREP g;// Passed to thread783 784 p = xmalloc(8192 + 512, pszSrcFile, __LINE__);785 if (!p)786 break;787 memset(&g, 0, sizeof(GREP));788 g.size = sizeof(GREP);789 recurse = WinQueryButtonCheckstate(hwnd, GREP_RECURSE) != 0;790 absolute = WinQueryButtonCheckstate(hwnd, GREP_ABSOLUTE) != 0;791 sensitive = WinQueryButtonCheckstate(hwnd, GREP_CASE) != 0;792 sayfiles = WinQueryButtonCheckstate(hwnd, GREP_SAYFILES) != 0;793 searchEAs = WinQueryButtonCheckstate(hwnd, GREP_SEARCHEAS) != 0;794 searchFiles = WinQueryButtonCheckstate(hwnd, GREP_SEARCHFILES) != 0;795 findifany = WinQueryButtonCheckstate(hwnd, GREP_FINDIFANY) != 0;796 gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS);797 if (gRemember) {798 PrfWriteProfileData(fmprof, FM3Str, "Grep_Recurse",799 (PVOID) & recurse, sizeof(BOOL));800 PrfWriteProfileData(fmprof, FM3Str, "Grep_Absolute",801 (PVOID) & absolute, sizeof(BOOL));802 PrfWriteProfileData(fmprof, FM3Str, "Grep_Case",803 (PVOID) & sensitive, sizeof(BOOL));804 PrfWriteProfileData(fmprof, FM3Str, "Grep_Sayfiles",805 (PVOID) & sayfiles, sizeof(BOOL));806 PrfWriteProfileData(fmprof, FM3Str, "Grep_Searchfiles",807 (PVOID) & searchFiles, sizeof(BOOL));808 PrfWriteProfileData(fmprof, FM3Str, "Grep_SearchfEAs",809 (PVOID) & searchEAs, sizeof(BOOL));810 }811 g.finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES) != 0;812 if (g.finddupes) {813 g.CRCdupes = WinQueryButtonCheckstate(hwnd, GREP_CRCDUPES) != 0;814 g.nosizedupes =815 WinQueryButtonCheckstate(hwnd, GREP_NOSIZEDUPES) != 0;816 g.ignoreextdupes =817 WinQueryButtonCheckstate(hwnd, GREP_IGNOREEXTDUPES) != 0;818 }819 // Parse file masks820 *p = 0;821 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, p);822 bstrip(p);823 if (!*p) {824 DosBeep(50, 100);825 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK));826 free(p);784 // 07 Feb 08 SHL - fixme to malloc and free in thread 785 static GREP g; // Passed to thread 786 787 p = xmalloc(8192 + 512, pszSrcFile, __LINE__); 788 if (!p) 789 break; 790 memset(&g, 0, sizeof(GREP)); 791 g.size = sizeof(GREP); 792 recurse = WinQueryButtonCheckstate(hwnd, GREP_RECURSE) != 0; 793 absolute = WinQueryButtonCheckstate(hwnd, GREP_ABSOLUTE) != 0; 794 sensitive = WinQueryButtonCheckstate(hwnd, GREP_CASE) != 0; 795 sayfiles = WinQueryButtonCheckstate(hwnd, GREP_SAYFILES) != 0; 796 searchEAs = WinQueryButtonCheckstate(hwnd, GREP_SEARCHEAS) != 0; 797 searchFiles = WinQueryButtonCheckstate(hwnd, GREP_SEARCHFILES) != 0; 798 findifany = WinQueryButtonCheckstate(hwnd, GREP_FINDIFANY) != 0; 799 gRemember = WinQueryButtonCheckstate(hwnd, GREP_REMEMBERFLAGS); 800 if (gRemember) { 801 PrfWriteProfileData(fmprof, FM3Str, "Grep_Recurse", 802 (PVOID) & recurse, sizeof(BOOL)); 803 PrfWriteProfileData(fmprof, FM3Str, "Grep_Absolute", 804 (PVOID) & absolute, sizeof(BOOL)); 805 PrfWriteProfileData(fmprof, FM3Str, "Grep_Case", 806 (PVOID) & sensitive, sizeof(BOOL)); 807 PrfWriteProfileData(fmprof, FM3Str, "Grep_Sayfiles", 808 (PVOID) & sayfiles, sizeof(BOOL)); 809 PrfWriteProfileData(fmprof, FM3Str, "Grep_Searchfiles", 810 (PVOID) & searchFiles, sizeof(BOOL)); 811 PrfWriteProfileData(fmprof, FM3Str, "Grep_SearchfEAs", 812 (PVOID) & searchEAs, sizeof(BOOL)); 813 } 814 g.finddupes = WinQueryButtonCheckstate(hwnd, GREP_FINDDUPES) != 0; 815 if (g.finddupes) { 816 g.CRCdupes = WinQueryButtonCheckstate(hwnd, GREP_CRCDUPES) != 0; 817 g.nosizedupes = 818 WinQueryButtonCheckstate(hwnd, GREP_NOSIZEDUPES) != 0; 819 g.ignoreextdupes = 820 WinQueryButtonCheckstate(hwnd, GREP_IGNOREEXTDUPES) != 0; 821 } 822 // Parse file masks 823 *p = 0; 824 WinQueryDlgItemText(hwnd, GREP_MASK, 8192, p); 825 bstrip(p); 826 if (!*p) { 827 DosBeep(50, 100); 828 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK)); 829 free(p); 827 830 # ifdef FORTIFY 828 831 Fortify_LeaveScope(); 829 832 # endif 830 break;831 }832 strcpy(g.tosearch, p);833 strcpy(lastmask, p);834 // Parse search strings835 *p = 0;836 WinQueryWindowText(hwndMLE, 4096, p);837 strcpy(lasttext, p);838 {839 CHAR *pszFrom;840 CHAR *pszTo;841 ULONG matched = 0;842 843 pszTo = g.searchPattern;844 pszFrom = p;845 while (*pszFrom) {846 if (*pszFrom == '\r') {847 pszFrom++;848 continue;849 }850 if (*pszFrom == '\n') {851 if (*(pszFrom + 1))852 matched++;853 *pszTo = 0;854 }855 else856 *pszTo = *pszFrom;857 pszTo++;858 pszFrom++;859 }860 if (*g.searchPattern)861 matched++;862 *pszTo++ = 0;863 *pszTo = 0;864 g.numlines = matched;865 if (matched) {866 g.matched = xmalloc(g.numlines, pszSrcFile, __LINE__);867 if (!g.matched)868 g.numlines = 0;869 }870 }871 *p = 0;872 WinQueryDlgItemText(hwnd, GREP_GREATER, 34, p);873 greater = atol(p);874 *p = 0;875 WinQueryDlgItemText(hwnd, GREP_LESSER, 34, p);876 lesser = atol(p);877 *p = 0;878 WinQueryDlgItemText(hwnd, GREP_NEWER, 34, p);879 newer = atoi(p);880 *p = 0;881 WinQueryDlgItemText(hwnd, GREP_OLDER, 34, p);882 older = atoi(p);883 if (older || newer) {884 FDATE fdate;885 FTIME ftime;886 struct tm tm;887 time_t t;888 889 t = time(NULL);890 tm = *localtime(&t);891 fdate.day = tm.tm_mday;892 fdate.month = tm.tm_mon + 1;893 fdate.year = tm.tm_year - 80;894 ftime.hours = tm.tm_hour;895 ftime.minutes = tm.tm_min;896 ftime.twosecs = tm.tm_sec / 2;897 if (older) {898 g.olderthan = SecsSince1980(&fdate, &ftime);899 g.olderthan -= (older * (24L * 60L * 60L));900 }901 if (newer) {902 g.newerthan = SecsSince1980(&fdate, &ftime);903 g.newerthan -= (newer * (24L * 60L * 60L));904 }905 }906 if (!newer)907 g.newerthan = 0;908 if (!older)909 g.olderthan = 0;910 g.greaterthan = greater;911 g.lessthan = lesser;912 g.absFlag = absolute;913 g.caseFlag = sensitive;914 g.dirFlag = recurse;915 g.sayfiles = sayfiles;916 g.searchEAs = searchEAs;917 g.searchFiles = searchFiles;918 g.findifany = findifany;919 g.hwndFiles = hwndCollect;920 g.hwnd = WinQueryWindow(hwndCollect, QW_PARENT);921 g.hwndCurFile = WinWindowFromID(g.hwnd, DIR_SELECTED);922 g.attrFile = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.attrFile;923 g.antiattr = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.antiattr;924 g.stopflag = &((DIRCNRDATA *)INSTDATA(hwndCollect))->stopflag;925 if (_beginthread(GrepThread, NULL, 524280, (PVOID) & g) == -1) {926 Runtime_Error(pszSrcFile, __LINE__,927 GetPString(IDS_COULDNTSTARTTHREADTEXT));928 free(p);833 break; 834 } 835 strcpy(g.tosearch, p); 836 strcpy(lastmask, p); 837 // Parse search strings 838 *p = 0; 839 WinQueryWindowText(hwndMLE, 4096, p); 840 strcpy(lasttext, p); 841 { 842 CHAR *pszFrom; 843 CHAR *pszTo; 844 ULONG matched = 0; 845 846 pszTo = g.searchPattern; 847 pszFrom = p; 848 while (*pszFrom) { 849 if (*pszFrom == '\r') { 850 pszFrom++; 851 continue; 852 } 853 if (*pszFrom == '\n') { 854 if (*(pszFrom + 1)) 855 matched++; 856 *pszTo = 0; 857 } 858 else 859 *pszTo = *pszFrom; 860 pszTo++; 861 pszFrom++; 862 } 863 if (*g.searchPattern) 864 matched++; 865 *pszTo++ = 0; 866 *pszTo = 0; 867 g.numlines = matched; 868 if (matched) { 869 g.matched = xmalloc(g.numlines, pszSrcFile, __LINE__); 870 if (!g.matched) 871 g.numlines = 0; 872 } 873 } 874 *p = 0; 875 WinQueryDlgItemText(hwnd, GREP_GREATER, 34, p); 876 greater = atol(p); 877 *p = 0; 878 WinQueryDlgItemText(hwnd, GREP_LESSER, 34, p); 879 lesser = atol(p); 880 *p = 0; 881 WinQueryDlgItemText(hwnd, GREP_NEWER, 34, p); 882 newer = atoi(p); 883 *p = 0; 884 WinQueryDlgItemText(hwnd, GREP_OLDER, 34, p); 885 older = atoi(p); 886 if (older || newer) { 887 FDATE fdate; 888 FTIME ftime; 889 struct tm tm; 890 time_t t; 891 892 t = time(NULL); 893 tm = *localtime(&t); 894 fdate.day = tm.tm_mday; 895 fdate.month = tm.tm_mon + 1; 896 fdate.year = tm.tm_year - 80; 897 ftime.hours = tm.tm_hour; 898 ftime.minutes = tm.tm_min; 899 ftime.twosecs = tm.tm_sec / 2; 900 if (older) { 901 g.olderthan = SecsSince1980(&fdate, &ftime); 902 g.olderthan -= (older * (24L * 60L * 60L)); 903 } 904 if (newer) { 905 g.newerthan = SecsSince1980(&fdate, &ftime); 906 g.newerthan -= (newer * (24L * 60L * 60L)); 907 } 908 } 909 if (!newer) 910 g.newerthan = 0; 911 if (!older) 912 g.olderthan = 0; 913 g.greaterthan = greater; 914 g.lessthan = lesser; 915 g.absFlag = absolute; 916 g.caseFlag = sensitive; 917 g.dirFlag = recurse; 918 g.sayfiles = sayfiles; 919 g.searchEAs = searchEAs; 920 g.searchFiles = searchFiles; 921 g.findifany = findifany; 922 g.hwndFiles = hwndCollect; 923 g.hwnd = WinQueryWindow(hwndCollect, QW_PARENT); 924 g.hwndCurFile = WinWindowFromID(g.hwnd, DIR_SELECTED); 925 g.attrFile = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.attrFile; 926 g.antiattr = ((DIRCNRDATA *)INSTDATA(hwndCollect))->mask.antiattr; 927 g.stopflag = &((DIRCNRDATA *)INSTDATA(hwndCollect))->stopflag; 928 if (_beginthread(GrepThread, NULL, 524280, (PVOID) & g) == -1) { 929 Runtime_Error(pszSrcFile, __LINE__, 930 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 931 free(p); 929 932 # ifdef FORTIFY 930 933 Fortify_LeaveScope(); 931 934 # endif 932 WinDismissDlg(hwnd, 0);933 break;934 }935 DosSleep(100); //05 Aug 07 GKY 128936 free(p);935 WinDismissDlg(hwnd, 0); 936 break; 937 } 938 DosSleep(100); //05 Aug 07 GKY 128 939 free(p); 937 940 # ifdef FORTIFY 938 941 Fortify_LeaveScope(); … … 940 943 } 941 944 if (changed) { 942 // Grep mask list changed943 SHORT x;944 945 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,946 GREP_LISTBOX,947 LM_QUERYITEMCOUNT,948 MPVOID, MPVOID);945 // Grep mask list changed 946 SHORT x; 947 948 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 949 GREP_LISTBOX, 950 LM_QUERYITEMCOUNT, 951 MPVOID, MPVOID); 949 952 if (sSelect > 0) { 950 953 BldFullPathName(s, pFM2SaveDirectory, "GREPMASK.DAT"); 951 954 if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2) 952 955 break; //already gave error msg 953 fp = xfopen(s, "w", pszSrcFile, __LINE__);954 if (fp) {955 fputs(GetPString(IDS_GREPFILETEXT), fp);956 for (x = 0; x < sSelect; x++) {957 *s = 0;958 WinSendDlgItemMsg(hwnd,959 GREP_LISTBOX,960 LM_QUERYITEMTEXT,961 MPFROM2SHORT(x, 8192), MPFROMP(s));962 bstrip(s);963 if (*s)964 fprintf(fp, "%s\n", s);965 }966 fclose(fp);967 }968 }956 fp = xfopen(s, "w", pszSrcFile, __LINE__); 957 if (fp) { 958 fputs(GetPString(IDS_GREPFILETEXT), fp); 959 for (x = 0; x < sSelect; x++) { 960 *s = 0; 961 WinSendDlgItemMsg(hwnd, 962 GREP_LISTBOX, 963 LM_QUERYITEMTEXT, 964 MPFROM2SHORT(x, 8192), MPFROMP(s)); 965 bstrip(s); 966 if (*s) 967 fprintf(fp, "%s\n", s); 968 } 969 fclose(fp); 970 } 971 } 969 972 } 970 973 WinDismissDlg(hwnd, 1);  - 
      
trunk/dll/inis.c
r1104 r1161 34 34 #include <ctype.h> 35 35 #include <share.h> 36 #include <process.h> // _beginthread36 #include <process.h> // _beginthread 37 37 38 38 #define INCL_DOS … … 40 40 #define INCL_WIN 41 41 #define INCL_GPI 42 #define INCL_LONGLONG // dircnrs.h42 #define INCL_LONGLONG // dircnrs.h 43 43 44 44 #include "fm3dlg.h" 45 45 #include "fm3str.h" 46 46 #include "mle.h" 47 #include "errutil.h" // Dos_Error...48 #include "strutil.h" // GetPString47 #include "errutil.h" // Dos_Error... 48 #include "strutil.h" // GetPString 49 49 #include "pathutil.h" // BldFullPathName 50 #include "mainwnd.h" // FillClient 51 #include "droplist.h" // FullDrgName 52 #include "inis.h" 53 #include "literal.h" // fixup 50 54 #include "fm3dll.h" 55 #include "eas.h" // HexDump 51 56 #include "fortify.h" 57 #include "misc.h" // BoxWindow 52 58 53 59 #pragma data_seg(DATA2) … … 58 64 { 59 65 USHORT size; 60 CHAR ininame[CCHMAXPATH]; // Must be null string if user or system ini66 CHAR ininame[CCHMAXPATH]; // Must be null string if user or system ini 61 67 HINI hini; 62 68 BOOL working; … … 107 113 { 108 114 BOOL ok = fSkipIfSystem && 109 (hini == HINI_USERPROFILE || hini == HINI_SYSTEMPROFILE);115 (hini == HINI_USERPROFILE || hini == HINI_SYSTEMPROFILE); 110 116 111 117 if (!ok) { … … 113 119 if (!ok) { 114 120 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 115 "PrfCloseProfile failed for handle 0x%x", hini);121 "PrfCloseProfile failed for handle 0x%x", hini); 116 122 } 117 123 } … … 136 142 hmq2 = WinCreateMsgQueue(hab2, 0); 137 143 if (hmq2) { 138 WinCancelShutdown(hmq2, TRUE);139 IncrThreadUsage();140 *userini = *sysini = 0;141 memset(&cprfp, 0, sizeof(PRFPROFILE));142 cprfp.cchUserName = CCHMAXPATH;143 cprfp.cchSysName = CCHMAXPATH;144 cprfp.pszUserName = (PSZ) userini;145 cprfp.pszSysName = (PSZ) sysini;146 if (PrfQueryProfile(hab2, &cprfp)) {147 if (!stricmp(cprfp.pszUserName, inirec->filename1))148 hiniFrom = HINI_USERPROFILE;149 else if (!stricmp(cprfp.pszSysName, inirec->filename1))150 hiniFrom = HINI_SYSTEMPROFILE;151 if (!stricmp(cprfp.pszUserName, inirec->filename2))152 hiniTo = HINI_USERPROFILE;153 else if (!stricmp(cprfp.pszSysName, inirec->filename2))154 hiniTo = HINI_SYSTEMPROFILE;155 }156 if (hiniFrom == NULLHANDLE) {157 hiniFrom = PrfOpenProfile(hab2, inirec->filename1);158 if (hiniFrom == NULLHANDLE) {159 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,160 "PrfOpenProfile failed for %s", inirec->filename1);161 }162 }163 if (hiniTo == NULLHANDLE) {164 if (!stricmp(inirec->filename1, inirec->filename2))165 hiniTo = hiniFrom;166 else {167 hiniTo = PrfOpenProfile(hab2, inirec->filename2);168 if (hiniTo == NULLHANDLE) {169 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,170 "PrfOpenProfile failed for %s", inirec->filename2);171 }172 }173 }174 if (hiniFrom && hiniTo && (*inirec->app2 || hiniFrom != hiniTo)) {175 176 PVOID pDataK, pData;177 PBYTE pCurrentK;178 ULONG ulSize = 0L;179 180 if (inirec->action == IDM_MOVE || inirec->action == IDM_COPY) {181 if (!*inirec->key) {182 if (inirec->confirm &&183 PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ?184 inirec->app2 : inirec->185 app), NULL,186 (PULONG) & ulSize) && ulSize) {187 if (saymsg188 (MB_YESNOCANCEL, HWND_DESKTOP,189 GetPString(IDS_CONFIRMTEXT),190 GetPString(IDS_INIOVERAPPNAMETEXT),191 ((*inirec->app2) ? inirec->app2 : inirec->app),192 inirec->filename1) != MBID_YES)193 goto Abort;194 }195 if (PrfQueryProfileSize(hiniTo,196 (PSZ) inirec->app,197 NULL, (PULONG) & ulSize) && ulSize) {198 pDataK = xmalloc(ulSize, pszSrcFile, __LINE__);/* allocate space for keynames */199 if (pDataK) {200 /* get keynames */201 if (PrfQueryProfileString(hiniTo,202 (PSZ) inirec->app,203 NULL, "\0", pDataK, ulSize)) {204 pCurrentK = pDataK;205 /* step through keynames */206 while (*pCurrentK) {207 if (PrfQueryProfileSize(hiniTo, inirec->app,208 pCurrentK,209 (PULONG) & ulSize) && ulSize) {210 pData = xmalloc(ulSize, pszSrcFile, __LINE__);211 if (pData) {212 /* get data */213 if (PrfQueryProfileData(hiniTo, inirec->app,214 pCurrentK,215 pData, (PULONG) & ulSize))216 /* write data to new ini file */217 PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?218 inirec->219 app2 : inirec->app),220 pCurrentK, pData, ulSize);221 free(pData);/* free data */222 }223 }224 while (*pCurrentK)/* next keyname */225 pCurrentK++;226 pCurrentK++;227 }228 }229 free(pDataK);/* free keynames */230 }231 }232 }233 else {234 if (inirec->confirm &&235 PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ?236 inirec->app2 : inirec->237 app),238 ((*inirec->key2) ? inirec->239 key2 : inirec->key), (PULONG) & ulSize)240 && ulSize) {241 if (saymsg242 (MB_YESNOCANCEL, HWND_DESKTOP,243 GetPString(IDS_CONFIRMTEXT),244 GetPString(IDS_INIOVERAPPKEYNAMETEXT),245 ((*inirec->app2) ? inirec->app2 : inirec->app),246 ((*inirec->key2) ? inirec->key2 : inirec->key),247 inirec->filename1) != MBID_YES)248 goto Abort;249 }250 if (PrfQueryProfileSize(hiniTo, inirec->app,251 inirec->key,252 (PULONG) & ulSize) && ulSize) {253 pData = xmalloc(ulSize, pszSrcFile, __LINE__);254 if (pData) {255 /* get data */256 if (PrfQueryProfileData(hiniTo, inirec->app,257 inirec->key,258 pData, (PULONG) & ulSize))259 /* write data to new ini file */260 PrfWriteProfileData(hiniFrom, ((*inirec->app2) ?261 inirec->app2 : inirec->app),262 ((*inirec->key2) ?263 inirec->key2 : inirec->key),264 pData, ulSize);265 free(pData);/* free data */266 }267 }268 }269 if (inirec->action == IDM_MOVE) {270 if (inirec->confirm &&271 saymsg(MB_YESNOCANCEL,272 HWND_DESKTOP,273 GetPString(IDS_CONFIRMTEXT),274 GetPString(IDS_INIDELETEMOVEDTEXT),275 inirec->filename2) != MBID_YES)276 goto Abort;277 PrfWriteProfileData(hiniTo,278 inirec->app,279 ((*inirec->key) ? inirec->key : NULL),280 NULL, 0L);281 }282 }283 }144 WinCancelShutdown(hmq2, TRUE); 145 IncrThreadUsage(); 146 *userini = *sysini = 0; 147 memset(&cprfp, 0, sizeof(PRFPROFILE)); 148 cprfp.cchUserName = CCHMAXPATH; 149 cprfp.cchSysName = CCHMAXPATH; 150 cprfp.pszUserName = (PSZ) userini; 151 cprfp.pszSysName = (PSZ) sysini; 152 if (PrfQueryProfile(hab2, &cprfp)) { 153 if (!stricmp(cprfp.pszUserName, inirec->filename1)) 154 hiniFrom = HINI_USERPROFILE; 155 else if (!stricmp(cprfp.pszSysName, inirec->filename1)) 156 hiniFrom = HINI_SYSTEMPROFILE; 157 if (!stricmp(cprfp.pszUserName, inirec->filename2)) 158 hiniTo = HINI_USERPROFILE; 159 else if (!stricmp(cprfp.pszSysName, inirec->filename2)) 160 hiniTo = HINI_SYSTEMPROFILE; 161 } 162 if (hiniFrom == NULLHANDLE) { 163 hiniFrom = PrfOpenProfile(hab2, inirec->filename1); 164 if (hiniFrom == NULLHANDLE) { 165 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 166 "PrfOpenProfile failed for %s", inirec->filename1); 167 } 168 } 169 if (hiniTo == NULLHANDLE) { 170 if (!stricmp(inirec->filename1, inirec->filename2)) 171 hiniTo = hiniFrom; 172 else { 173 hiniTo = PrfOpenProfile(hab2, inirec->filename2); 174 if (hiniTo == NULLHANDLE) { 175 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 176 "PrfOpenProfile failed for %s", inirec->filename2); 177 } 178 } 179 } 180 if (hiniFrom && hiniTo && (*inirec->app2 || hiniFrom != hiniTo)) { 181 182 PVOID pDataK, pData; 183 PBYTE pCurrentK; 184 ULONG ulSize = 0L; 185 186 if (inirec->action == IDM_MOVE || inirec->action == IDM_COPY) { 187 if (!*inirec->key) { 188 if (inirec->confirm && 189 PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ? 190 inirec->app2 : inirec-> 191 app), NULL, 192 (PULONG) & ulSize) && ulSize) { 193 if (saymsg 194 (MB_YESNOCANCEL, HWND_DESKTOP, 195 GetPString(IDS_CONFIRMTEXT), 196 GetPString(IDS_INIOVERAPPNAMETEXT), 197 ((*inirec->app2) ? inirec->app2 : inirec->app), 198 inirec->filename1) != MBID_YES) 199 goto Abort; 200 } 201 if (PrfQueryProfileSize(hiniTo, 202 (PSZ) inirec->app, 203 NULL, (PULONG) & ulSize) && ulSize) { 204 pDataK = xmalloc(ulSize, pszSrcFile, __LINE__); /* allocate space for keynames */ 205 if (pDataK) { 206 /* get keynames */ 207 if (PrfQueryProfileString(hiniTo, 208 (PSZ) inirec->app, 209 NULL, "\0", pDataK, ulSize)) { 210 pCurrentK = pDataK; 211 /* step through keynames */ 212 while (*pCurrentK) { 213 if (PrfQueryProfileSize(hiniTo, inirec->app, 214 pCurrentK, 215 (PULONG) & ulSize) && ulSize) { 216 pData = xmalloc(ulSize, pszSrcFile, __LINE__); 217 if (pData) { 218 /* get data */ 219 if (PrfQueryProfileData(hiniTo, inirec->app, 220 pCurrentK, 221 pData, (PULONG) & ulSize)) 222 /* write data to new ini file */ 223 PrfWriteProfileData(hiniFrom, ((*inirec->app2) ? 224 inirec-> 225 app2 : inirec->app), 226 pCurrentK, pData, ulSize); 227 free(pData); /* free data */ 228 } 229 } 230 while (*pCurrentK) /* next keyname */ 231 pCurrentK++; 232 pCurrentK++; 233 } 234 } 235 free(pDataK); /* free keynames */ 236 } 237 } 238 } 239 else { 240 if (inirec->confirm && 241 PrfQueryProfileSize(hiniFrom, (PSZ) ((*inirec->app2) ? 242 inirec->app2 : inirec-> 243 app), 244 ((*inirec->key2) ? inirec-> 245 key2 : inirec->key), (PULONG) & ulSize) 246 && ulSize) { 247 if (saymsg 248 (MB_YESNOCANCEL, HWND_DESKTOP, 249 GetPString(IDS_CONFIRMTEXT), 250 GetPString(IDS_INIOVERAPPKEYNAMETEXT), 251 ((*inirec->app2) ? inirec->app2 : inirec->app), 252 ((*inirec->key2) ? inirec->key2 : inirec->key), 253 inirec->filename1) != MBID_YES) 254 goto Abort; 255 } 256 if (PrfQueryProfileSize(hiniTo, inirec->app, 257 inirec->key, 258 (PULONG) & ulSize) && ulSize) { 259 pData = xmalloc(ulSize, pszSrcFile, __LINE__); 260 if (pData) { 261 /* get data */ 262 if (PrfQueryProfileData(hiniTo, inirec->app, 263 inirec->key, 264 pData, (PULONG) & ulSize)) 265 /* write data to new ini file */ 266 PrfWriteProfileData(hiniFrom, ((*inirec->app2) ? 267 inirec->app2 : inirec->app), 268 ((*inirec->key2) ? 269 inirec->key2 : inirec->key), 270 pData, ulSize); 271 free(pData); /* free data */ 272 } 273 } 274 } 275 if (inirec->action == IDM_MOVE) { 276 if (inirec->confirm && 277 saymsg(MB_YESNOCANCEL, 278 HWND_DESKTOP, 279 GetPString(IDS_CONFIRMTEXT), 280 GetPString(IDS_INIDELETEMOVEDTEXT), 281 inirec->filename2) != MBID_YES) 282 goto Abort; 283 PrfWriteProfileData(hiniTo, 284 inirec->app, 285 ((*inirec->key) ? inirec->key : NULL), 286 NULL, 0L); 287 } 288 } 289 } 284 290 Abort: 285 if (hiniFrom)286 CloseProfile(hiniFrom, TRUE);287 if (hiniTo && hiniTo != hiniFrom)288 CloseProfile(hiniTo, FALSE);289 WinDestroyMsgQueue(hmq2);291 if (hiniFrom) 292 CloseProfile(hiniFrom, TRUE); 293 if (hiniTo && hiniTo != hiniFrom) 294 CloseProfile(hiniTo, FALSE); 295 WinDestroyMsgQueue(hmq2); 290 296 } 291 297 DecrThreadUsage(); … … 293 299 } 294 300 PostMsg(inirec->hwndDlg, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), 295 MPVOID);301 MPVOID); 296 302 if (inirec->action == IDM_MOVE && inirec->hwndSource && 297 inirec->hwndSource != inirec->hwndDlg)303 inirec->hwndSource != inirec->hwndDlg) 298 304 PostMsg(inirec->hwndSource, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), 299 MPVOID);305 MPVOID); 300 306 free(inirec); 301 307 # ifdef FORTIFY … … 316 322 hmq2 = WinCreateMsgQueue(hab2, 0); 317 323 if (hmq2) { 318 WinCancelShutdown(hmq2, TRUE);319 IncrThreadUsage();320 321 // fixme to do something?322 323 WinDestroyMsgQueue(hmq2);324 WinCancelShutdown(hmq2, TRUE); 325 IncrThreadUsage(); 326 327 // fixme to do something? 328 329 WinDestroyMsgQueue(hmq2); 324 330 } 325 331 DecrThreadUsage(); … … 351 357 hmq2 = WinCreateMsgQueue(hab2, 0); 352 358 if (hmq2) { 353 WinCancelShutdown(hmq2, TRUE);354 IncrThreadUsage();355 *userini = *sysini = 0;356 memset(&cprfp, 0, sizeof(PRFPROFILE));357 cprfp.cchUserName = CCHMAXPATH;358 cprfp.cchSysName = CCHMAXPATH;359 cprfp.pszUserName = (PSZ) userini;360 cprfp.pszSysName = (PSZ) sysini;361 if (PrfQueryProfile(hab2, &cprfp)) {362 if (!stricmp(cprfp.pszUserName, prfp->pszUserName))363 orig = HINI_USERPROFILE;364 else if (!stricmp(cprfp.pszSysName, prfp->pszUserName))365 orig = HINI_SYSTEMPROFILE;366 }367 if (orig == NULLHANDLE)368 orig = PrfOpenProfile(hab2, prfp->pszUserName);369 if (orig == NULLHANDLE) {370 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,371 "PrfOpenProfile failed for %s", prfp->pszUserName);372 }373 else {374 new = PrfOpenProfile(hab2, prfp->pszSysName);375 if (new == NULLHANDLE) {376 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,377 "PrfOpenProfile failed for %s", prfp->pszSysName);378 }379 else {380 ulSize = 0;381 if (PrfQueryProfileSize(orig, NULL, NULL, (PULONG) & ulSize)382 && ulSize) {383 pDataA = xmalloc(ulSize, pszSrcFile, __LINE__);/* allocate space for applnames */384 if (pDataA) {385 /* get applnames */386 if (PrfQueryProfileString387 (orig, NULL, NULL, "\0", pDataA, ulSize)) {388 pCurrentA = pDataA;389 /* step through applnames */390 while (*pCurrentA) {391 /* now keynames for this applname */392 if (PrfQueryProfileSize(orig, (PSZ) pCurrentA, NULL,393 (PULONG) & ulSize) && ulSize) {394 pDataK = xmalloc(ulSize, pszSrcFile, __LINE__);/* allocate space for keynames */395 if (pDataK) {396 /* get keynames */397 if (PrfQueryProfileString(orig, (PSZ) pCurrentA, NULL,398 "\0", pDataK, ulSize)) {399 pCurrentK = pDataK;400 /* step through keynames */401 while (*pCurrentK) {402 if (PrfQueryProfileSize(orig, pCurrentA,403 pCurrentK,404 (PULONG) & ulSize) &&405 ulSize) {406 pData = xmalloc(ulSize, pszSrcFile, __LINE__);407 if (pData) {408 /* get data */409 if (PrfQueryProfileData(orig, pCurrentA,410 pCurrentK,411 pData,412 (PULONG) & ulSize))413 /* write data to new ini file */414 PrfWriteProfileData(new, pCurrentA,415 pCurrentK, pData,416 ulSize);417 free(pData);/* free data */418 }419 }420 while (*pCurrentK)/* next keyname */421 pCurrentK++;422 pCurrentK++;423 }424 }425 free(pDataK);/* free keynames */426 }427 }428 while (*pCurrentA)/* next applname */429 pCurrentA++;430 pCurrentA++;431 }432 }433 free(pDataA);/* free applnames */434 }435 }436 CloseProfile(new, FALSE);437 }438 CloseProfile(orig, TRUE);439 }440 WinDestroyMsgQueue(hmq2);359 WinCancelShutdown(hmq2, TRUE); 360 IncrThreadUsage(); 361 *userini = *sysini = 0; 362 memset(&cprfp, 0, sizeof(PRFPROFILE)); 363 cprfp.cchUserName = CCHMAXPATH; 364 cprfp.cchSysName = CCHMAXPATH; 365 cprfp.pszUserName = (PSZ) userini; 366 cprfp.pszSysName = (PSZ) sysini; 367 if (PrfQueryProfile(hab2, &cprfp)) { 368 if (!stricmp(cprfp.pszUserName, prfp->pszUserName)) 369 orig = HINI_USERPROFILE; 370 else if (!stricmp(cprfp.pszSysName, prfp->pszUserName)) 371 orig = HINI_SYSTEMPROFILE; 372 } 373 if (orig == NULLHANDLE) 374 orig = PrfOpenProfile(hab2, prfp->pszUserName); 375 if (orig == NULLHANDLE) { 376 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 377 "PrfOpenProfile failed for %s", prfp->pszUserName); 378 } 379 else { 380 new = PrfOpenProfile(hab2, prfp->pszSysName); 381 if (new == NULLHANDLE) { 382 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 383 "PrfOpenProfile failed for %s", prfp->pszSysName); 384 } 385 else { 386 ulSize = 0; 387 if (PrfQueryProfileSize(orig, NULL, NULL, (PULONG) & ulSize) 388 && ulSize) { 389 pDataA = xmalloc(ulSize, pszSrcFile, __LINE__); /* allocate space for applnames */ 390 if (pDataA) { 391 /* get applnames */ 392 if (PrfQueryProfileString 393 (orig, NULL, NULL, "\0", pDataA, ulSize)) { 394 pCurrentA = pDataA; 395 /* step through applnames */ 396 while (*pCurrentA) { 397 /* now keynames for this applname */ 398 if (PrfQueryProfileSize(orig, (PSZ) pCurrentA, NULL, 399 (PULONG) & ulSize) && ulSize) { 400 pDataK = xmalloc(ulSize, pszSrcFile, __LINE__); /* allocate space for keynames */ 401 if (pDataK) { 402 /* get keynames */ 403 if (PrfQueryProfileString(orig, (PSZ) pCurrentA, NULL, 404 "\0", pDataK, ulSize)) { 405 pCurrentK = pDataK; 406 /* step through keynames */ 407 while (*pCurrentK) { 408 if (PrfQueryProfileSize(orig, pCurrentA, 409 pCurrentK, 410 (PULONG) & ulSize) && 411 ulSize) { 412 pData = xmalloc(ulSize, pszSrcFile, __LINE__); 413 if (pData) { 414 /* get data */ 415 if (PrfQueryProfileData(orig, pCurrentA, 416 pCurrentK, 417 pData, 418 (PULONG) & ulSize)) 419 /* write data to new ini file */ 420 PrfWriteProfileData(new, pCurrentA, 421 pCurrentK, pData, 422 ulSize); 423 free(pData); /* free data */ 424 } 425 } 426 while (*pCurrentK) /* next keyname */ 427 pCurrentK++; 428 pCurrentK++; 429 } 430 } 431 free(pDataK); /* free keynames */ 432 } 433 } 434 while (*pCurrentA) /* next applname */ 435 pCurrentA++; 436 pCurrentA++; 437 } 438 } 439 free(pDataA); /* free applnames */ 440 } 441 } 442 CloseProfile(new, FALSE); 443 } 444 CloseProfile(orig, TRUE); 445 } 446 WinDestroyMsgQueue(hmq2); 441 447 } 442 448 DecrThreadUsage(); … … 461 467 if (!PrfQueryProfileSize(hini, NULL, NULL, (PULONG) & ulSize)) 462 468 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 463 "PrfQueryProfileSize");469 "PrfQueryProfileSize"); 464 470 else if (!ulSize) 465 471 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); … … 468 474 if (pData) { 469 475 if (PrfQueryProfileString(hini, NULL, NULL, "\0", pData, ulSize)) { 470 pCurrent = pData;471 WinEnableWindowUpdate(hwndList, FALSE);472 while (*pCurrent) {473 WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING),474 MPFROMP(pCurrent));475 while (*pCurrent)476 pCurrent++;477 pCurrent++;478 }479 WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0),480 MPFROMSHORT(TRUE));481 WinEnableWindowUpdate(hwndList, TRUE);476 pCurrent = pData; 477 WinEnableWindowUpdate(hwndList, FALSE); 478 while (*pCurrent) { 479 WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING), 480 MPFROMP(pCurrent)); 481 while (*pCurrent) 482 pCurrent++; 483 pCurrent++; 484 } 485 WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0), 486 MPFROMSHORT(TRUE)); 487 WinEnableWindowUpdate(hwndList, TRUE); 482 488 } 483 489 free(pData); … … 487 493 488 494 static CHAR *GetKeyData(HWND hwndList, HINI hini, PSZ pAppName, 489 PSZ pKeyName, PULONG datalen)495 PSZ pKeyName, PULONG datalen) 490 496 { 491 497 ULONG ulKeySize = 0L; … … 495 501 if (!PrfQueryProfileSize(hini, pAppName, pKeyName, (PULONG) & ulKeySize)) 496 502 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 497 "PrfQueryProfileSize");503 "PrfQueryProfileSize"); 498 504 else { 499 505 pKeyData = xmalloc(ulKeySize + 1L, pszSrcFile, __LINE__); 500 506 if (pKeyData) { 501 507 if (!PrfQueryProfileData 502 (hini, pAppName, pKeyName, pKeyData, (PULONG) & ulKeySize))503 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,504 "PrfQueryProfileData");508 (hini, pAppName, pKeyName, pKeyData, (PULONG) & ulKeySize)) 509 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 510 "PrfQueryProfileData"); 505 511 else { 506 HexDump(hwndList, pKeyData, ulKeySize);507 {508 CHAR s[81];509 510 sprintf(s,511 GetPString(IDS_INIBYTESTEXT),512 ulKeySize, &"s"[ulKeySize == 1]);513 WinSetDlgItemText(WinQueryWindow(hwndList, QW_PARENT),514 INI_NUMDATA, s);515 }516 *datalen = ulKeySize;517 return (CHAR *)pKeyData;512 HexDump(hwndList, pKeyData, ulKeySize); 513 { 514 CHAR s[81]; 515 516 sprintf(s, 517 GetPString(IDS_INIBYTESTEXT), 518 ulKeySize, &"s"[ulKeySize == 1]); 519 WinSetDlgItemText(WinQueryWindow(hwndList, QW_PARENT), 520 INI_NUMDATA, s); 521 } 522 *datalen = ulKeySize; 523 return (CHAR *)pKeyData; 518 524 } 519 525 } … … 531 537 if (!PrfQueryProfileSize(hini, pAppName, NULL, (PULONG) & ulSize)) 532 538 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 533 "PrfQueryProfileSize");539 "PrfQueryProfileSize"); 534 540 else { 535 541 if (!ulSize) … … 538 544 if (pData) { 539 545 if (!PrfQueryProfileString(hini, pAppName, NULL, "\0", pData, ulSize)) { 540 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,541 "PrfQueryProfileString");542 free(pData);546 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 547 "PrfQueryProfileString"); 548 free(pData); 543 549 } 544 550 else { 545 pCurrent = pData;546 WinEnableWindowUpdate(hwndList, FALSE);547 while (*pCurrent) {548 WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING),549 MPFROMP(pCurrent));550 while (*pCurrent)551 pCurrent++;552 pCurrent++;553 }554 WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0),555 MPFROMSHORT(TRUE));551 pCurrent = pData; 552 WinEnableWindowUpdate(hwndList, FALSE); 553 while (*pCurrent) { 554 WinSendMsg(hwndList, LM_INSERTITEM, MPFROMSHORT(LIT_SORTASCENDING), 555 MPFROMP(pCurrent)); 556 while (*pCurrent) 557 pCurrent++; 558 pCurrent++; 559 } 560 WinSendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(0), 561 MPFROMSHORT(TRUE)); 556 562 WinEnableWindowUpdate(hwndList, TRUE); 557 563 free(pData); 558 return TRUE;564 return TRUE; 559 565 } 560 566 } … … 575 581 inidata = (INIDATA *) mp2; 576 582 WinSendDlgItemMsg(hwnd, IAF_SAVENAME, EM_SETTEXTLIMIT, 577 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);583 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 578 584 MLEsetformat(hwndMLE, MLFIE_NOTRANS); 579 585 MLEsetlimit(hwndMLE, 8192); … … 588 594 DosError(FERR_DISABLEHARDERR); 589 595 if (!DosFindFirst("*.IST", 590 &hdir,591 FILE_NORMAL | FILE_ARCHIVED,592 &ffb, sizeof(ffb), &nm, FIL_STANDARD)) {593 do {594 priority_bumped();595 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_INSERTITEM,596 MPFROMSHORT(LIT_SORTASCENDING),597 MPFROMP(ffb.achName));598 nm = 1;599 } while (!DosFindNext(hdir, &ffb, sizeof(ffb), &nm));600 DosFindClose(hdir);601 priority_bumped();596 &hdir, 597 FILE_NORMAL | FILE_ARCHIVED, 598 &ffb, sizeof(ffb), &nm, FIL_STANDARD)) { 599 do { 600 priority_bumped(); 601 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_INSERTITEM, 602 MPFROMSHORT(LIT_SORTASCENDING), 603 MPFROMP(ffb.achName)); 604 nm = 1; 605 } while (!DosFindNext(hdir, &ffb, sizeof(ffb), &nm)); 606 DosFindClose(hdir); 607 priority_bumped(); 602 608 } 603 609 } … … 610 616 case UM_SETDIR: 611 617 PaintRecessedWindow(WinWindowFromID(hwnd, IAF_HELP), (HPS) 0, FALSE, 612 TRUE);618 TRUE); 613 619 PaintRecessedWindow(WinWindowFromID(hwnd, IAF_SAVENAME), (HPS) 0, FALSE, 614 FALSE);620 FALSE); 615 621 PaintRecessedWindow(WinWindowFromID(hwnd, IAF_LISTBOX), (HPS) 0, FALSE, 616 FALSE);622 FALSE); 617 623 PaintRecessedWindow(WinWindowFromID(hwnd, IAF_MLE), (HPS) 0, FALSE, 618 FALSE);624 FALSE); 619 625 return 0; 620 626 … … 623 629 case IAF_SAVENAME: 624 630 if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) 625 WinSetDlgItemText(hwnd, IAF_HELP, NullStr);631 WinSetDlgItemText(hwnd, IAF_HELP, NullStr); 626 632 if (SHORT2FROMMP(mp1) == EN_SETFOCUS) 627 WinSetDlgItemText(hwnd,628 IAF_HELP, GetPString(IDS_MASKLISTNAMEHELPTEXT));633 WinSetDlgItemText(hwnd, 634 IAF_HELP, GetPString(IDS_MASKLISTNAMEHELPTEXT)); 629 635 break; 630 636 631 637 case IAF_LISTBOX: 632 638 if (SHORT2FROMMP(mp1) == LN_KILLFOCUS) 633 WinSetDlgItemText(hwnd, IAF_HELP, NullStr);639 WinSetDlgItemText(hwnd, IAF_HELP, NullStr); 634 640 if (SHORT2FROMMP(mp1) == LN_SETFOCUS) 635 WinSetDlgItemText(hwnd,636 IAF_HELP, GetPString(IDS_MASKLISTFILESHELPTEXT));641 WinSetDlgItemText(hwnd, 642 IAF_HELP, GetPString(IDS_MASKLISTFILESHELPTEXT)); 637 643 else if (SHORT2FROMMP(mp1) == LN_ENTER) 638 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IAF_LOAD, 0), MPVOID);644 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IAF_LOAD, 0), MPVOID); 639 645 break; 640 646 641 647 case IAF_MLE: 642 648 if (SHORT2FROMMP(mp1) == MLN_KILLFOCUS) 643 WinSetDlgItemText(hwnd, IAF_HELP, NullStr);649 WinSetDlgItemText(hwnd, IAF_HELP, NullStr); 644 650 if (SHORT2FROMMP(mp1) == MLN_SETFOCUS) 645 WinSetDlgItemText(hwnd,646 IAF_HELP, GetPString(IDS_MASKLISTMASKSHELPTEXT));651 WinSetDlgItemText(hwnd, 652 IAF_HELP, GetPString(IDS_MASKLISTMASKSHELPTEXT)); 647 653 break; 648 654 } … … 654 660 inidata = INSTDATA(hwnd); 655 661 if (!inidata) 656 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);662 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 657 663 else { 658 CHAR s[8193], app[1024];659 register CHAR *p;660 SHORT sSelect, numitems;661 BOOL match;662 663 *s = 0;664 WinQueryWindowText(hwndMLE, 8192, s);665 if (!*s) {666 DosBeep(250, 100);667 break;668 }669 else {670 strcpy(lasttext, s);671 p = s;672 while (*p) {673 if (*p == '\r') {674 memmove(p, p + 1, strlen(p));675 continue;676 }677 if (*p == '\n')678 *p = 0;679 p++;680 }681 p++;682 *p = 0;683 }684 numitems = (SHORT) WinSendMsg(inidata->hwndApp,685 LM_QUERYITEMCOUNT, MPVOID, MPVOID);686 if (!numitems) {687 DosBeep(250, 100);688 break;689 }690 else {691 WinSetPointer(HWND_DESKTOP, hptrBusy);692 WinSetDlgItemText(hwnd, IAF_HELP, GetPString(IDS_FILTERINGTEXT));693 sSelect = 0;694 while (numitems) {695 *app = 0;696 WinSendMsg(inidata->hwndApp,697 LM_QUERYITEMTEXT,698 MPFROM2SHORT(sSelect, 1024), MPFROMP(app));699 match = FALSE;700 if (*app) {701 p = s;702 while (*p) {703 if (*p != '/') {704 if (wildcard(app, p, TRUE))705 match = TRUE;706 }707 else if (wildcard(app, p + 1, TRUE)) {708 match = FALSE;709 break;710 }711 while (*p)712 p++;713 p++;714 }715 }716 if (!match)717 WinSendMsg(inidata->hwndApp, LM_DELETEITEM,718 MPFROMSHORT(sSelect), MPVOID);719 else720 sSelect++;721 numitems--;722 }723 WinSetPointer(HWND_DESKTOP, hptrArrow);724 }664 CHAR s[8193], app[1024]; 665 register CHAR *p; 666 SHORT sSelect, numitems; 667 BOOL match; 668 669 *s = 0; 670 WinQueryWindowText(hwndMLE, 8192, s); 671 if (!*s) { 672 DosBeep(250, 100); 673 break; 674 } 675 else { 676 strcpy(lasttext, s); 677 p = s; 678 while (*p) { 679 if (*p == '\r') { 680 memmove(p, p + 1, strlen(p)); 681 continue; 682 } 683 if (*p == '\n') 684 *p = 0; 685 p++; 686 } 687 p++; 688 *p = 0; 689 } 690 numitems = (SHORT) WinSendMsg(inidata->hwndApp, 691 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 692 if (!numitems) { 693 DosBeep(250, 100); 694 break; 695 } 696 else { 697 WinSetPointer(HWND_DESKTOP, hptrBusy); 698 WinSetDlgItemText(hwnd, IAF_HELP, GetPString(IDS_FILTERINGTEXT)); 699 sSelect = 0; 700 while (numitems) { 701 *app = 0; 702 WinSendMsg(inidata->hwndApp, 703 LM_QUERYITEMTEXT, 704 MPFROM2SHORT(sSelect, 1024), MPFROMP(app)); 705 match = FALSE; 706 if (*app) { 707 p = s; 708 while (*p) { 709 if (*p != '/') { 710 if (wildcard(app, p, TRUE)) 711 match = TRUE; 712 } 713 else if (wildcard(app, p + 1, TRUE)) { 714 match = FALSE; 715 break; 716 } 717 while (*p) 718 p++; 719 p++; 720 } 721 } 722 if (!match) 723 WinSendMsg(inidata->hwndApp, LM_DELETEITEM, 724 MPFROMSHORT(sSelect), MPVOID); 725 else 726 sSelect++; 727 numitems--; 728 } 729 WinSetPointer(HWND_DESKTOP, hptrArrow); 730 } 725 731 } 726 732 WinDismissDlg(hwnd, 1); … … 729 735 case IAF_LOAD: 730 736 { 731 CHAR s[8193];732 FILE *fp;733 INT len;734 SHORT sSelect;735 736 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX,737 LM_QUERYSELECTION,738 MPFROM2SHORT(LIT_FIRST, 0),739 MPVOID);740 if (sSelect < 0)741 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);742 else {743 *s = 0;744 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT,745 MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));746 bstrip(s);747 if (*s) {748 fp = _fsopen(s, "r", SH_DENYWR);749 if (fp) {750 len = fread(s, 1, 8192, fp);751 s[len] = 0;752 WinSetWindowText(hwndMLE, s);753 fclose(fp);754 }755 }756 }737 CHAR s[8193]; 738 FILE *fp; 739 INT len; 740 SHORT sSelect; 741 742 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX, 743 LM_QUERYSELECTION, 744 MPFROM2SHORT(LIT_FIRST, 0), 745 MPVOID); 746 if (sSelect < 0) 747 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 748 else { 749 *s = 0; 750 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT, 751 MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s)); 752 bstrip(s); 753 if (*s) { 754 fp = _fsopen(s, "r", SH_DENYWR); 755 if (fp) { 756 len = fread(s, 1, 8192, fp); 757 s[len] = 0; 758 WinSetWindowText(hwndMLE, s); 759 fclose(fp); 760 } 761 } 762 } 757 763 } 758 764 break; … … 760 766 case IAF_SAVE: 761 767 { 762 CHAR s[8193], filename[CCHMAXPATH], *p;763 FILE *fp;764 765 *filename = 0;766 WinQueryDlgItemText(hwnd, IAF_SAVENAME, CCHMAXPATH, filename);767 bstrip(filename);768 if (*filename) {769 p = strchr(filename, '.');770 if (p) {771 strcpy(p, ".IST");772 WinSetDlgItemText(hwnd, IAF_SAVENAME, filename);773 }774 *s = 0;775 WinQueryWindowText(hwndMLE, 8192, s);776 if (!*s)777 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);778 else {779 fp = xfopen(filename, "w", pszSrcFile, __LINE__);780 if (fp) {781 fwrite(s, 1, strlen(s), fp);782 fclose(fp);783 WinSendDlgItemMsg(hwnd,784 IAF_LISTBOX,785 LM_INSERTITEM,786 MPFROMSHORT(LIT_SORTASCENDING),787 MPFROMP(filename));788 }789 }790 }768 CHAR s[8193], filename[CCHMAXPATH], *p; 769 FILE *fp; 770 771 *filename = 0; 772 WinQueryDlgItemText(hwnd, IAF_SAVENAME, CCHMAXPATH, filename); 773 bstrip(filename); 774 if (*filename) { 775 p = strchr(filename, '.'); 776 if (p) { 777 strcpy(p, ".IST"); 778 WinSetDlgItemText(hwnd, IAF_SAVENAME, filename); 779 } 780 *s = 0; 781 WinQueryWindowText(hwndMLE, 8192, s); 782 if (!*s) 783 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 784 else { 785 fp = xfopen(filename, "w", pszSrcFile, __LINE__); 786 if (fp) { 787 fwrite(s, 1, strlen(s), fp); 788 fclose(fp); 789 WinSendDlgItemMsg(hwnd, 790 IAF_LISTBOX, 791 LM_INSERTITEM, 792 MPFROMSHORT(LIT_SORTASCENDING), 793 MPFROMP(filename)); 794 } 795 } 796 } 791 797 } 792 798 break; … … 794 800 case IAF_DELETE: 795 801 { 796 CHAR s[CCHMAXPATH];797 SHORT sSelect;798 799 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX,800 LM_QUERYSELECTION,801 MPFROM2SHORT(LIT_FIRST, 0),802 MPVOID);803 if (sSelect >= 0) {804 *s = 0;805 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT,806 MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));807 bstrip(s);808 if (*s) {809 unlinkf(s);810 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_DELETEITEM,811 MPFROMSHORT(sSelect), MPVOID);812 }813 }802 CHAR s[CCHMAXPATH]; 803 SHORT sSelect; 804 805 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, IAF_LISTBOX, 806 LM_QUERYSELECTION, 807 MPFROM2SHORT(LIT_FIRST, 0), 808 MPVOID); 809 if (sSelect >= 0) { 810 *s = 0; 811 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_QUERYITEMTEXT, 812 MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s)); 813 bstrip(s); 814 if (*s) { 815 unlinkf(s); 816 WinSendDlgItemMsg(hwnd, IAF_LISTBOX, LM_DELETEITEM, 817 MPFROMSHORT(sSelect), MPVOID); 818 } 819 } 814 820 } 815 821 break; … … 821 827 case IDM_HELP: 822 828 if (hwndHelp) 823 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,824 MPFROM2SHORT(HELP_FILTERINI, 0),825 MPFROMSHORT(HM_RESOURCEID));829 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 830 MPFROM2SHORT(HELP_FILTERINI, 0), 831 MPFROMSHORT(HM_RESOURCEID)); 826 832 break; 827 833 } … … 840 846 inirec = (INIREC *) mp2; 841 847 WinSendDlgItemMsg(hwnd, 842 INII_NEWAPP,843 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);848 INII_NEWAPP, 849 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 844 850 WinSendDlgItemMsg(hwnd, 845 INII_NEWKEY,846 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);851 INII_NEWKEY, 852 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 847 853 { 848 854 CHAR s[CCHMAXPATH + 34]; … … 856 862 switch (inirec->action) { 857 863 case IDM_MOVE: 858 WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEAPPTITLETEXT));859 break;864 WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEAPPTITLETEXT)); 865 break; 860 866 case IDM_COPY: 861 WinSetWindowText(hwnd, GetPString(IDS_INICOPYAPPTITLETEXT));862 break;867 WinSetWindowText(hwnd, GetPString(IDS_INICOPYAPPTITLETEXT)); 868 break; 863 869 } 864 870 } 865 871 else { 866 872 { 867 CHAR s[CCHMAXPATH + 34];868 869 sprintf(s, GetPString(IDS_INIWASTEXT), inirec->key);870 WinSetDlgItemText(hwnd, INII_OLDKEY, s);873 CHAR s[CCHMAXPATH + 34]; 874 875 sprintf(s, GetPString(IDS_INIWASTEXT), inirec->key); 876 WinSetDlgItemText(hwnd, INII_OLDKEY, s); 871 877 } 872 878 WinSetDlgItemText(hwnd, INII_NEWAPP, inirec->app); 873 879 WinSendDlgItemMsg(hwnd, 874 INII_NEWAPP,875 EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID);880 INII_NEWAPP, 881 EM_SETSEL, MPFROM2SHORT(0, CCHMAXPATH), MPVOID); 876 882 switch (inirec->action) { 877 883 case IDM_MOVE: 878 WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEKEYTITLETEXT));879 break;884 WinSetWindowText(hwnd, GetPString(IDS_INIRENAMEKEYTITLETEXT)); 885 break; 880 886 case IDM_COPY: 881 WinSetWindowText(hwnd, GetPString(IDS_INICOPYKEYTITLETEXT));882 break;887 WinSetWindowText(hwnd, GetPString(IDS_INICOPYKEYTITLETEXT)); 888 break; 883 889 } 884 890 } … … 890 896 inirec = (INIREC *) WinQueryWindowPtr(hwnd, QWL_USER); 891 897 if (inirec) { 892 WinQueryDlgItemText(hwnd, INII_NEWAPP, CCHMAXPATH, inirec->app2);893 bstrip(inirec->app2);894 if (!*inirec->app2) {895 DosBeep(50, 100);896 break;897 }898 if (*inirec->key) {899 WinQueryDlgItemText(hwnd, INII_NEWKEY, CCHMAXPATH, inirec->key2);900 bstrip(inirec->key2);901 if (!*inirec->key2) {902 DosBeep(50, 100);903 break;904 }905 }906 WinDismissDlg(hwnd, 1);898 WinQueryDlgItemText(hwnd, INII_NEWAPP, CCHMAXPATH, inirec->app2); 899 bstrip(inirec->app2); 900 if (!*inirec->app2) { 901 DosBeep(50, 100); 902 break; 903 } 904 if (*inirec->key) { 905 WinQueryDlgItemText(hwnd, INII_NEWKEY, CCHMAXPATH, inirec->key2); 906 bstrip(inirec->key2); 907 if (!*inirec->key2) { 908 DosBeep(50, 100); 909 break; 910 } 911 } 912 WinDismissDlg(hwnd, 1); 907 913 } 908 914 break; … … 914 920 case IDM_HELP: 915 921 if (hwndHelp) 916 WinSendMsg(hwndHelp,917 HM_DISPLAY_HELP,918 MPFROM2SHORT(HELP_INTRAINI, 0),919 MPFROMSHORT(HM_RESOURCEID));922 WinSendMsg(hwndHelp, 923 HM_DISPLAY_HELP, 924 MPFROM2SHORT(HELP_INTRAINI, 0), 925 MPFROMSHORT(HM_RESOURCEID)); 920 926 break; 921 927 } … … 931 937 WinSetWindowPtr(hwnd, QWL_USER, mp2); 932 938 WinSendDlgItemMsg(hwnd, INIR_USERPROFILE, EM_SETTEXTLIMIT, 933 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);939 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 934 940 WinSendDlgItemMsg(hwnd, INIR_SYSTEMPROFILE, EM_SETTEXTLIMIT, 935 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);941 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 936 942 break; 937 943 … … 940 946 case INIR_FIND: 941 947 { 942 CHAR filename[CCHMAXPATH], *p, *ininame;943 USHORT id = 0;944 HWND hwndFocus;945 946 hwndFocus = WinQueryFocus(HWND_DESKTOP);947 if (hwndFocus)948 id = WinQueryWindowUShort(hwndFocus, QWS_ID);949 if (id != INIR_SYSTEMPROFILE)950 id = INIR_USERPROFILE;951 ininame = INSTDATA(hwnd);952 if (ininame && *ininame) {953 strcpy(filename, ininame);954 p = filename;955 while (*p) {956 if (*p == '/')957 *p = '\\';958 p++;959 }960 p = strrchr(filename, '\\');961 if (p) {962 p++;963 *p = 0;964 }965 else966 *filename = 0;967 }968 else969 *filename = 0;970 strcat(filename, "*.INI");971 if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename)972 WinSetDlgItemText(hwnd, id, filename);948 CHAR filename[CCHMAXPATH], *p, *ininame; 949 USHORT id = 0; 950 HWND hwndFocus; 951 952 hwndFocus = WinQueryFocus(HWND_DESKTOP); 953 if (hwndFocus) 954 id = WinQueryWindowUShort(hwndFocus, QWS_ID); 955 if (id != INIR_SYSTEMPROFILE) 956 id = INIR_USERPROFILE; 957 ininame = INSTDATA(hwnd); 958 if (ininame && *ininame) { 959 strcpy(filename, ininame); 960 p = filename; 961 while (*p) { 962 if (*p == '/') 963 *p = '\\'; 964 p++; 965 } 966 p = strrchr(filename, '\\'); 967 if (p) { 968 p++; 969 *p = 0; 970 } 971 else 972 *filename = 0; 973 } 974 else 975 *filename = 0; 976 strcat(filename, "*.INI"); 977 if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename) 978 WinSetDlgItemText(hwnd, id, filename); 973 979 } 974 980 break; … … 976 982 case DID_OK: 977 983 { 978 HINI testini;979 PRFPROFILE prfp;980 CHAR sysini[CCHMAXPATH];981 CHAR userini[CCHMAXPATH];982 983 WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini);984 WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini);985 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini);986 if (testini == NULLHANDLE) {987 saymsg(MB_CANCEL,988 hwnd,989 GetPString(IDS_ERRORTEXT),990 GetPString(IDS_INICANTOPENUSERTEXT), userini);991 break;992 }993 CloseProfile(testini, FALSE);994 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini);995 if (testini == NULLHANDLE) {996 saymsg(MB_CANCEL,997 hwnd,998 GetPString(IDS_ERRORTEXT),999 GetPString(IDS_INICANTOPENSYSTEXT), sysini);1000 break;1001 }1002 CloseProfile(testini, FALSE);1003 memset(&prfp, 0, sizeof(PRFPROFILE));1004 prfp.cchUserName = strlen(sysini);1005 prfp.cchSysName = strlen(userini);1006 prfp.pszUserName = (PSZ) userini;1007 prfp.pszSysName = (PSZ) sysini;1008 if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {1009 Win_Error(hwnd, hwnd, __FILE__, __LINE__,1010 GetPString(IDS_INIPRFRESETFAILEDTEXT));1011 }1012 else1013 WinDismissDlg(hwnd, 1);984 HINI testini; 985 PRFPROFILE prfp; 986 CHAR sysini[CCHMAXPATH]; 987 CHAR userini[CCHMAXPATH]; 988 989 WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini); 990 WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini); 991 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini); 992 if (testini == NULLHANDLE) { 993 saymsg(MB_CANCEL, 994 hwnd, 995 GetPString(IDS_ERRORTEXT), 996 GetPString(IDS_INICANTOPENUSERTEXT), userini); 997 break; 998 } 999 CloseProfile(testini, FALSE); 1000 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini); 1001 if (testini == NULLHANDLE) { 1002 saymsg(MB_CANCEL, 1003 hwnd, 1004 GetPString(IDS_ERRORTEXT), 1005 GetPString(IDS_INICANTOPENSYSTEXT), sysini); 1006 break; 1007 } 1008 CloseProfile(testini, FALSE); 1009 memset(&prfp, 0, sizeof(PRFPROFILE)); 1010 prfp.cchUserName = strlen(sysini); 1011 prfp.cchSysName = strlen(userini); 1012 prfp.pszUserName = (PSZ) userini; 1013 prfp.pszSysName = (PSZ) sysini; 1014 if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) { 1015 Win_Error(hwnd, hwnd, __FILE__, __LINE__, 1016 GetPString(IDS_INIPRFRESETFAILEDTEXT)); 1017 } 1018 else 1019 WinDismissDlg(hwnd, 1); 1014 1020 } 1015 1021 break; … … 1021 1027 case IDM_HELP: 1022 1028 if (hwndHelp) 1023 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1024 MPFROM2SHORT(HELP_CHANGEINI, 0),1025 MPFROMSHORT(HM_RESOURCEID));1029 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1030 MPFROM2SHORT(HELP_CHANGEINI, 0), 1031 MPFROMSHORT(HM_RESOURCEID)); 1026 1032 break; 1027 1033 } … … 1037 1043 WinSetWindowPtr(hwnd, QWL_USER, mp2); 1038 1044 WinSendDlgItemMsg(hwnd, 1039 INIR_USERPROFILE,1040 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);1045 INIR_USERPROFILE, 1046 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 1041 1047 WinSendDlgItemMsg(hwnd, 1042 INIR_SYSTEMPROFILE,1043 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);1048 INIR_SYSTEMPROFILE, 1049 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 1044 1050 WinSetWindowText(hwnd, GetPString(IDS_INISWAPOS2INISTITLETEXT)); 1045 1051 break; … … 1049 1055 case INIR_FIND: 1050 1056 { 1051 CHAR filename[CCHMAXPATH], *p, *ininame;1052 USHORT id = 0;1053 HWND hwndFocus;1054 1055 hwndFocus = WinQueryFocus(HWND_DESKTOP);1056 if (hwndFocus)1057 id = WinQueryWindowUShort(hwndFocus, QWS_ID);1058 if (id != INIR_SYSTEMPROFILE)1059 id = INIR_USERPROFILE;1060 ininame = INSTDATA(hwnd);1061 if (ininame && *ininame) {1062 strcpy(filename, ininame);1063 p = filename;1064 while (*p) {1065 if (*p == '/')1066 *p = '\\';1067 p++;1068 }1069 p = strrchr(filename, '\\');1070 if (p) {1071 p++;1072 *p = 0;1073 }1074 else1075 *filename = 0;1076 }1077 else1078 *filename = 0;1079 strcat(filename, "*.INI");1080 if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename)1081 WinSetDlgItemText(hwnd, id, filename);1057 CHAR filename[CCHMAXPATH], *p, *ininame; 1058 USHORT id = 0; 1059 HWND hwndFocus; 1060 1061 hwndFocus = WinQueryFocus(HWND_DESKTOP); 1062 if (hwndFocus) 1063 id = WinQueryWindowUShort(hwndFocus, QWS_ID); 1064 if (id != INIR_SYSTEMPROFILE) 1065 id = INIR_USERPROFILE; 1066 ininame = INSTDATA(hwnd); 1067 if (ininame && *ininame) { 1068 strcpy(filename, ininame); 1069 p = filename; 1070 while (*p) { 1071 if (*p == '/') 1072 *p = '\\'; 1073 p++; 1074 } 1075 p = strrchr(filename, '\\'); 1076 if (p) { 1077 p++; 1078 *p = 0; 1079 } 1080 else 1081 *filename = 0; 1082 } 1083 else 1084 *filename = 0; 1085 strcat(filename, "*.INI"); 1086 if (insert_filename(hwnd, filename, TRUE, FALSE) && *filename) 1087 WinSetDlgItemText(hwnd, id, filename); 1082 1088 } 1083 1089 break; … … 1085 1091 case DID_OK: 1086 1092 { 1087 HINI testini;1088 PRFPROFILE prfp;1089 CHAR sysini[CCHMAXPATH];1090 CHAR userini[CCHMAXPATH];1091 CHAR oldsysini[CCHMAXPATH];1092 CHAR olduserini[CCHMAXPATH];1093 CHAR tempsysini[CCHMAXPATH];1094 CHAR tempuserini[CCHMAXPATH];1095 CHAR tempsysini2[CCHMAXPATH];1096 CHAR tempuserini2[CCHMAXPATH];1097 CHAR *p;1098 APIRET rc;1099 1100 *tempuserini = 0;1101 *tempsysini = 0;1102 *tempuserini2 = 0;1103 *tempsysini2 = 0;1104 memset(&prfp, 0, sizeof(PRFPROFILE));1105 prfp.cchUserName = CCHMAXPATH;1106 prfp.cchSysName = CCHMAXPATH;1107 prfp.pszUserName = (PSZ) olduserini;1108 prfp.pszSysName = (PSZ) oldsysini;1109 if (!PrfQueryProfile(WinQueryAnchorBlock(hwnd), &prfp)) {1110 Win_Error(hwnd, hwnd, __FILE__, __LINE__,1111 GetPString(IDS_INIQUERYPRFFAILEDTEXT));1112 break;1113 }1114 WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini);1115 WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini);1116 MakeFullName(userini);1117 MakeFullName(sysini);1118 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini);1119 if (testini == NULLHANDLE) {1120 saymsg(MB_CANCEL,1121 hwnd,1122 GetPString(IDS_ERRORTEXT),1123 GetPString(IDS_INICANTOPENUSERTEXT), userini);1124 break;1125 }1126 CloseProfile(testini, FALSE);1127 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini);1128 if (testini == NULLHANDLE) {1129 saymsg(MB_CANCEL,1130 hwnd,1131 GetPString(IDS_ERRORTEXT),1132 GetPString(IDS_INICANTOPENSYSTEXT), sysini);1133 break;1134 }1135 CloseProfile(testini, FALSE);1136 /* make copies of new inis */1137 *tempuserini = 0;1093 HINI testini; 1094 PRFPROFILE prfp; 1095 CHAR sysini[CCHMAXPATH]; 1096 CHAR userini[CCHMAXPATH]; 1097 CHAR oldsysini[CCHMAXPATH]; 1098 CHAR olduserini[CCHMAXPATH]; 1099 CHAR tempsysini[CCHMAXPATH]; 1100 CHAR tempuserini[CCHMAXPATH]; 1101 CHAR tempsysini2[CCHMAXPATH]; 1102 CHAR tempuserini2[CCHMAXPATH]; 1103 CHAR *p; 1104 APIRET rc; 1105 1106 *tempuserini = 0; 1107 *tempsysini = 0; 1108 *tempuserini2 = 0; 1109 *tempsysini2 = 0; 1110 memset(&prfp, 0, sizeof(PRFPROFILE)); 1111 prfp.cchUserName = CCHMAXPATH; 1112 prfp.cchSysName = CCHMAXPATH; 1113 prfp.pszUserName = (PSZ) olduserini; 1114 prfp.pszSysName = (PSZ) oldsysini; 1115 if (!PrfQueryProfile(WinQueryAnchorBlock(hwnd), &prfp)) { 1116 Win_Error(hwnd, hwnd, __FILE__, __LINE__, 1117 GetPString(IDS_INIQUERYPRFFAILEDTEXT)); 1118 break; 1119 } 1120 WinQueryDlgItemText(hwnd, INIR_USERPROFILE, CCHMAXPATH, userini); 1121 WinQueryDlgItemText(hwnd, INIR_SYSTEMPROFILE, CCHMAXPATH, sysini); 1122 MakeFullName(userini); 1123 MakeFullName(sysini); 1124 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), userini); 1125 if (testini == NULLHANDLE) { 1126 saymsg(MB_CANCEL, 1127 hwnd, 1128 GetPString(IDS_ERRORTEXT), 1129 GetPString(IDS_INICANTOPENUSERTEXT), userini); 1130 break; 1131 } 1132 CloseProfile(testini, FALSE); 1133 testini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), sysini); 1134 if (testini == NULLHANDLE) { 1135 saymsg(MB_CANCEL, 1136 hwnd, 1137 GetPString(IDS_ERRORTEXT), 1138 GetPString(IDS_INICANTOPENSYSTEXT), sysini); 1139 break; 1140 } 1141 CloseProfile(testini, FALSE); 1142 /* make copies of new inis */ 1143 *tempuserini = 0; 1138 1144 *tempsysini = 0; 1139 1145 BldFullPathName(tempuserini, pTmpDir ? pTmpDir : pFM2SaveDirectory, "TEMPUSER.INI"); 1140 rc = DosCopy(userini, tempuserini, DCPY_EXISTING);1141 if (rc) {1142 Dos_Error(MB_CANCEL,1143 rc,1144 hwnd,1145 __FILE__,1146 __LINE__,1147 GetPString(IDS_COMPCOPYFAILEDTEXT), userini, tempuserini);1148 break;1146 rc = DosCopy(userini, tempuserini, DCPY_EXISTING); 1147 if (rc) { 1148 Dos_Error(MB_CANCEL, 1149 rc, 1150 hwnd, 1151 __FILE__, 1152 __LINE__, 1153 GetPString(IDS_COMPCOPYFAILEDTEXT), userini, tempuserini); 1154 break; 1149 1155 } 1150 1156 BldFullPathName(tempsysini, pTmpDir ? pTmpDir : pFM2SaveDirectory, "TEMPSYS.INI"); 1151 rc = DosCopy(sysini, tempsysini, DCPY_EXISTING);1152 if (rc) {1153 Dos_Error(MB_CANCEL,1154 rc,1155 hwnd,1156 __FILE__,1157 __LINE__,1158 GetPString(IDS_COMPCOPYFAILEDTEXT), sysini, tempsysini);1159 break;1160 }1161 memset(&prfp, 0, sizeof(PRFPROFILE));1162 prfp.cchUserName = strlen(tempuserini);1163 prfp.cchSysName = strlen(tempsysini);1164 prfp.pszUserName = (PSZ) tempuserini;1165 prfp.pszSysName = (PSZ) tempsysini;1166 if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {1167 Win_Error(hwnd, hwnd, __FILE__, __LINE__,1168 GetPString(IDS_INIPRFRESETFAILEDTEXT));1169 }1170 else {1171 /* backup old inis */1172 strcpy(tempuserini2, olduserini);1173 p = strrchr(tempuserini2, '\\');1174 if (!p)1175 *tempuserini2 = 0;1176 else {1177 p++;1178 *p = 0;1179 }1180 strcat(tempuserini2, "OS2INI.BAK");1181 rc = DosCopy(olduserini, tempuserini2, DCPY_EXISTING);1182 if (rc) {1183 Dos_Error(MB_CANCEL,1184 rc,1185 hwnd,1186 __FILE__,1187 __LINE__,1188 GetPString(IDS_COMPCOPYFAILEDTEXT),1189 olduserini, tempuserini2);1190 WinDismissDlg(hwnd, 1);1191 break;1192 }1193 strcpy(tempsysini2, oldsysini);1194 p = strrchr(tempsysini2, '\\');1195 if (!p)1196 *tempsysini2 = 0;1197 else {1198 p++;1199 *p = 0;1200 }1201 strcat(tempsysini2, "OS2SYINI.BAK");1202 rc = DosCopy(oldsysini, tempsysini2, DCPY_EXISTING);1203 if (rc) {1204 Dos_Error(MB_CANCEL,1205 rc,1206 hwnd,1207 __FILE__,1208 __LINE__,1209 GetPString(IDS_COMPCOPYFAILEDTEXT),1210 oldsysini, tempsysini2);1211 WinDismissDlg(hwnd, 1);1212 break;1213 }1214 /* copy new inis to old ini names */1215 rc = DosCopy(userini, olduserini, DCPY_EXISTING);1216 if (rc) {1217 Dos_Error(MB_CANCEL,1218 rc,1219 hwnd,1220 __FILE__,1221 __LINE__,1222 GetPString(IDS_COMPCOPYFAILEDTEXT),1223 userini, olduserini);1224 WinDismissDlg(hwnd, 1);1225 break;1226 }1227 rc = DosCopy(sysini, oldsysini, DCPY_EXISTING);1228 if (rc) {1229 Dos_Error(MB_CANCEL,1230 rc,1231 hwnd,1232 __FILE__,1233 __LINE__,1234 GetPString(IDS_COMPCOPYFAILEDTEXT),1235 userini, olduserini);1236 WinDismissDlg(hwnd, 1);1237 break;1238 }1239 /* replace temp inis with new permanent inis */1240 memset(&prfp, 0, sizeof(PRFPROFILE));1241 prfp.cchUserName = strlen(oldsysini);1242 prfp.cchSysName = strlen(olduserini);1243 prfp.pszUserName = (PSZ) olduserini;1244 prfp.pszSysName = (PSZ) oldsysini;1245 if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) {1246 Win_Error(hwnd, hwnd, __FILE__, __LINE__,1247 GetPString(IDS_INIPRFRESETFAILEDTEXT));1248 }1249 else {1250 Notify(GetPString(IDS_SUCCESSTEXT));1251 unlinkf(tempuserini);1252 unlinkf(tempsysini);1253 }1254 WinDismissDlg(hwnd, 1);1255 }1157 rc = DosCopy(sysini, tempsysini, DCPY_EXISTING); 1158 if (rc) { 1159 Dos_Error(MB_CANCEL, 1160 rc, 1161 hwnd, 1162 __FILE__, 1163 __LINE__, 1164 GetPString(IDS_COMPCOPYFAILEDTEXT), sysini, tempsysini); 1165 break; 1166 } 1167 memset(&prfp, 0, sizeof(PRFPROFILE)); 1168 prfp.cchUserName = strlen(tempuserini); 1169 prfp.cchSysName = strlen(tempsysini); 1170 prfp.pszUserName = (PSZ) tempuserini; 1171 prfp.pszSysName = (PSZ) tempsysini; 1172 if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) { 1173 Win_Error(hwnd, hwnd, __FILE__, __LINE__, 1174 GetPString(IDS_INIPRFRESETFAILEDTEXT)); 1175 } 1176 else { 1177 /* backup old inis */ 1178 strcpy(tempuserini2, olduserini); 1179 p = strrchr(tempuserini2, '\\'); 1180 if (!p) 1181 *tempuserini2 = 0; 1182 else { 1183 p++; 1184 *p = 0; 1185 } 1186 strcat(tempuserini2, "OS2INI.BAK"); 1187 rc = DosCopy(olduserini, tempuserini2, DCPY_EXISTING); 1188 if (rc) { 1189 Dos_Error(MB_CANCEL, 1190 rc, 1191 hwnd, 1192 __FILE__, 1193 __LINE__, 1194 GetPString(IDS_COMPCOPYFAILEDTEXT), 1195 olduserini, tempuserini2); 1196 WinDismissDlg(hwnd, 1); 1197 break; 1198 } 1199 strcpy(tempsysini2, oldsysini); 1200 p = strrchr(tempsysini2, '\\'); 1201 if (!p) 1202 *tempsysini2 = 0; 1203 else { 1204 p++; 1205 *p = 0; 1206 } 1207 strcat(tempsysini2, "OS2SYINI.BAK"); 1208 rc = DosCopy(oldsysini, tempsysini2, DCPY_EXISTING); 1209 if (rc) { 1210 Dos_Error(MB_CANCEL, 1211 rc, 1212 hwnd, 1213 __FILE__, 1214 __LINE__, 1215 GetPString(IDS_COMPCOPYFAILEDTEXT), 1216 oldsysini, tempsysini2); 1217 WinDismissDlg(hwnd, 1); 1218 break; 1219 } 1220 /* copy new inis to old ini names */ 1221 rc = DosCopy(userini, olduserini, DCPY_EXISTING); 1222 if (rc) { 1223 Dos_Error(MB_CANCEL, 1224 rc, 1225 hwnd, 1226 __FILE__, 1227 __LINE__, 1228 GetPString(IDS_COMPCOPYFAILEDTEXT), 1229 userini, olduserini); 1230 WinDismissDlg(hwnd, 1); 1231 break; 1232 } 1233 rc = DosCopy(sysini, oldsysini, DCPY_EXISTING); 1234 if (rc) { 1235 Dos_Error(MB_CANCEL, 1236 rc, 1237 hwnd, 1238 __FILE__, 1239 __LINE__, 1240 GetPString(IDS_COMPCOPYFAILEDTEXT), 1241 userini, olduserini); 1242 WinDismissDlg(hwnd, 1); 1243 break; 1244 } 1245 /* replace temp inis with new permanent inis */ 1246 memset(&prfp, 0, sizeof(PRFPROFILE)); 1247 prfp.cchUserName = strlen(oldsysini); 1248 prfp.cchSysName = strlen(olduserini); 1249 prfp.pszUserName = (PSZ) olduserini; 1250 prfp.pszSysName = (PSZ) oldsysini; 1251 if (!PrfReset(WinQueryAnchorBlock(hwnd), &prfp)) { 1252 Win_Error(hwnd, hwnd, __FILE__, __LINE__, 1253 GetPString(IDS_INIPRFRESETFAILEDTEXT)); 1254 } 1255 else { 1256 Notify(GetPString(IDS_SUCCESSTEXT)); 1257 unlinkf(tempuserini); 1258 unlinkf(tempsysini); 1259 } 1260 WinDismissDlg(hwnd, 1); 1261 } 1256 1262 } 1257 1263 break; … … 1263 1269 case IDM_HELP: 1264 1270 if (hwndHelp) 1265 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1266 MPFROM2SHORT(HELP_SWAPINI, 0), MPFROMSHORT(HM_RESOURCEID));1271 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1272 MPFROM2SHORT(HELP_SWAPINI, 0), MPFROMSHORT(HM_RESOURCEID)); 1267 1273 break; 1268 1274 } … … 1288 1294 WinSetWindowPtr(hwnd, QWL_USER, (PVOID) mp2); 1289 1295 WinSendDlgItemMsg(hwnd, 1290 IAD_APPNAME,1291 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);1296 IAD_APPNAME, 1297 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 1292 1298 WinSendDlgItemMsg(hwnd, 1293 IAD_KEYNAME,1294 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);1299 IAD_KEYNAME, 1300 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 1295 1301 WinSendDlgItemMsg(hwnd, 1296 IAD_DATA,1297 EM_SETTEXTLIMIT, MPFROM2SHORT(32767, 0), MPVOID);1302 IAD_DATA, 1303 EM_SETTEXTLIMIT, MPFROM2SHORT(32767, 0), MPVOID); 1298 1304 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE); 1299 1305 WinSetDlgItemText(hwnd, IAD_APPNAME, inidata->applname); … … 1302 1308 if (inidata->data && inidata->datalen) { 1303 1309 1304 CHAR *p;1305 1306 inidata->isbinary = FALSE;1307 p = inidata->data;1308 while ((p - inidata->data) < inidata->datalen - 1) {1309 if (*p < ' ' || !isprint(*p)) {1310 inidata->isbinary = TRUE;1311 break;1312 }1313 p++;1314 }1315 if (inidata->isbinary) {1316 inidata->isbinary = TRUE;1317 WinCheckButton(hwnd, IAD_ISBINARY, TRUE);1318 if (saymsg(MB_ENTERCANCEL | MB_ICONEXCLAMATION,1319 hwnd,1320 GetPString(IDS_WARNINGTEXT),1321 GetPString(IDS_INIBINARYDATASKIPTEXT)) == MBID_CANCEL)1322 WinDismissDlg(hwnd, 0);1323 l = inidata->datalen * 4 + 1;1324 p = xmallocz(l, pszSrcFile, __LINE__);1325 if (p) {1326 fixup(inidata->data, p, l, inidata->datalen);1327 WinSetDlgItemText(hwnd, IAD_DATA, p);1328 free(p);1329 }1330 }1331 else1332 WinSetDlgItemText(hwnd, IAD_DATA, inidata->data);1310 CHAR *p; 1311 1312 inidata->isbinary = FALSE; 1313 p = inidata->data; 1314 while ((p - inidata->data) < inidata->datalen - 1) { 1315 if (*p < ' ' || !isprint(*p)) { 1316 inidata->isbinary = TRUE; 1317 break; 1318 } 1319 p++; 1320 } 1321 if (inidata->isbinary) { 1322 inidata->isbinary = TRUE; 1323 WinCheckButton(hwnd, IAD_ISBINARY, TRUE); 1324 if (saymsg(MB_ENTERCANCEL | MB_ICONEXCLAMATION, 1325 hwnd, 1326 GetPString(IDS_WARNINGTEXT), 1327 GetPString(IDS_INIBINARYDATASKIPTEXT)) == MBID_CANCEL) 1328 WinDismissDlg(hwnd, 0); 1329 l = inidata->datalen * 4 + 1; 1330 p = xmallocz(l, pszSrcFile, __LINE__); 1331 if (p) { 1332 fixup(inidata->data, p, l, inidata->datalen); 1333 WinSetDlgItemText(hwnd, IAD_DATA, p); 1334 free(p); 1335 } 1336 } 1337 else 1338 WinSetDlgItemText(hwnd, IAD_DATA, inidata->data); 1333 1339 } 1334 1340 PostMsg(hwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID); … … 1342 1348 WinQueryDlgItemText(hwnd, IAD_DATA, 32, s); 1343 1349 if (*s) 1344 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);1350 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE); 1345 1351 } 1346 1352 WinSendDlgItemMsg(hwnd, IAD_APPNAME, EM_QUERYCHANGED, MPVOID, MPVOID); … … 1358 1364 case UM_SETUP: 1359 1365 saymsg(MB_ENTER | MB_ICONASTERISK, 1360 hwnd,1361 GetPString(IDS_WARNINGTEXT), GetPString(IDS_INIAPPKEYEXISTSTEXT));1366 hwnd, 1367 GetPString(IDS_WARNINGTEXT), GetPString(IDS_INIAPPKEYEXISTSTEXT)); 1362 1368 return 0; 1363 1369 … … 1367 1373 inidata = INSTDATA(hwnd); 1368 1374 if (!inidata) 1369 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);1375 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 1370 1376 else { 1371 CHAR s[CCHMAXPATH], applname[CCHMAXPATH];1372 BOOL appchanged = FALSE, keychanged = FALSE;1373 1374 *applname = 0;1375 WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname);1376 bstrip(applname);1377 if (*applname) {1378 *s = 0;1379 WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, s);1380 bstrip(s);1381 if (*s) {1382 appchanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_APPNAME,1383 EM_QUERYCHANGED,1384 MPVOID, MPVOID);1385 keychanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_KEYNAME,1386 EM_QUERYCHANGED,1387 MPVOID, MPVOID);1388 if (appchanged || keychanged) {1389 1390 ULONG size = 0L;1391 1392 if (PrfQueryProfileSize(inidata->hini, applname, s, &size))1393 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);1394 }1395 *s = 0;1396 WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, s);1397 bstrip(s);1398 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), (*s != 0));1399 }1400 else1401 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);1402 }1403 else1404 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);1377 CHAR s[CCHMAXPATH], applname[CCHMAXPATH]; 1378 BOOL appchanged = FALSE, keychanged = FALSE; 1379 1380 *applname = 0; 1381 WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname); 1382 bstrip(applname); 1383 if (*applname) { 1384 *s = 0; 1385 WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, s); 1386 bstrip(s); 1387 if (*s) { 1388 appchanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_APPNAME, 1389 EM_QUERYCHANGED, 1390 MPVOID, MPVOID); 1391 keychanged = (BOOL) WinSendDlgItemMsg(hwnd, IAD_KEYNAME, 1392 EM_QUERYCHANGED, 1393 MPVOID, MPVOID); 1394 if (appchanged || keychanged) { 1395 1396 ULONG size = 0L; 1397 1398 if (PrfQueryProfileSize(inidata->hini, applname, s, &size)) 1399 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 1400 } 1401 *s = 0; 1402 WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, s); 1403 bstrip(s); 1404 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), (*s != 0)); 1405 } 1406 else 1407 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE); 1408 } 1409 else 1410 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE); 1405 1411 } 1406 1412 break; … … 1412 1418 case DID_OK: 1413 1419 { 1414 CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH], data[CCHMAXPATH];1415 INT len;1416 1417 inidata = INSTDATA(hwnd);1418 if (!inidata) {1419 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);1420 break;1421 }1422 inidata->isbinary = WinQueryButtonCheckstate(hwnd, IAD_ISBINARY);1423 *applname = 0;1424 WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname);1425 bstrip(applname);1426 if (*applname) {1427 *keyname = 0;1428 WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, keyname);1429 bstrip(keyname);1430 if (*keyname) {1431 *data = 0;1432 WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, data);1433 if (*data) {1434 if (inidata->isbinary)1435 len = literal(data);1436 else1437 len = strlen(data) + 1;1438 PrfWriteProfileData(inidata->hini, applname, keyname, data,1439 (ULONG) len);1440 WinSendMsg(inidata->hwndIni, UM_RESCAN,1441 MPFROMP(applname), MPFROMP(keyname));1442 WinDismissDlg(hwnd, 1);1443 }1444 }1445 }1420 CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH], data[CCHMAXPATH]; 1421 INT len; 1422 1423 inidata = INSTDATA(hwnd); 1424 if (!inidata) { 1425 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 1426 break; 1427 } 1428 inidata->isbinary = WinQueryButtonCheckstate(hwnd, IAD_ISBINARY); 1429 *applname = 0; 1430 WinQueryDlgItemText(hwnd, IAD_APPNAME, CCHMAXPATH, applname); 1431 bstrip(applname); 1432 if (*applname) { 1433 *keyname = 0; 1434 WinQueryDlgItemText(hwnd, IAD_KEYNAME, CCHMAXPATH, keyname); 1435 bstrip(keyname); 1436 if (*keyname) { 1437 *data = 0; 1438 WinQueryDlgItemText(hwnd, IAD_DATA, CCHMAXPATH, data); 1439 if (*data) { 1440 if (inidata->isbinary) 1441 len = literal(data); 1442 else 1443 len = strlen(data) + 1; 1444 PrfWriteProfileData(inidata->hini, applname, keyname, data, 1445 (ULONG) len); 1446 WinSendMsg(inidata->hwndIni, UM_RESCAN, 1447 MPFROMP(applname), MPFROMP(keyname)); 1448 WinDismissDlg(hwnd, 1); 1449 } 1450 } 1451 } 1446 1452 } 1447 1453 break; … … 1453 1459 case IDM_HELP: 1454 1460 if (hwndHelp) 1455 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1456 MPFROM2SHORT(HELP_INIADD, 0), MPFROMSHORT(HM_RESOURCEID));1461 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1462 MPFROM2SHORT(HELP_INIADD, 0), MPFROMSHORT(HM_RESOURCEID)); 1457 1463 break; 1458 1464 } … … 1499 1505 flFrameFlags |= FCF_TASKLIST; 1500 1506 hwndFrame = WinCreateStdWindow(hwnd, 1501 0,1502 &flFrameFlags,1503 WC_INIEDITOR,1504 NullStr,1505 fwsAnimate,1506 FM3ModHandle, INI_FRAME, &hwndClient);1507 0, 1508 &flFrameFlags, 1509 WC_INIEDITOR, 1510 NullStr, 1511 fwsAnimate, 1512 FM3ModHandle, INI_FRAME, &hwndClient); 1507 1513 if (hwndFrame) { 1508 1514 WinSetWindowUShort(hwndFrame, QWS_ID, INI_FRAME); … … 1513 1519 FillClient(hwnd, &swp, NULL, FALSE); 1514 1520 WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 1515 SWP_SIZE | SWP_MOVE);1521 SWP_SIZE | SWP_MOVE); 1516 1522 } 1517 1523 else if (ParentIsDesktop(hwndFrame, hwnd)) { 1518 1524 if (!WinRestoreWindowPos(FM2Str, "INIWindowPos", hwndFrame)) { 1519 1525 1520 ULONG fl = SWP_MOVE | SWP_SIZE;1521 SWP swp;1522 1523 WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0L, &swp);1524 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE))1525 fl = swp.fl;1526 else if (swp.fl & SWP_ACTIVATE)1527 fl |= SWP_ACTIVATE;1528 WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,1529 fl);1526 ULONG fl = SWP_MOVE | SWP_SIZE; 1527 SWP swp; 1528 1529 WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0L, &swp); 1530 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) 1531 fl = swp.fl; 1532 else if (swp.fl & SWP_ACTIVATE) 1533 fl |= SWP_ACTIVATE; 1534 WinSetWindowPos(hwndFrame, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 1535 fl); 1530 1536 } 1531 1537 } … … 1533 1539 PostMsg(hwndClient, UM_ACTION, MPVOID, MPVOID); 1534 1540 if (!PostMsg(hwndClient, UM_LOADFILE, MPFROMP(((filename && *filename) ? 1535 filename : NULL)), MPVOID))1541 filename : NULL)), MPVOID)) 1536 1542 WinSendMsg(hwndClient, UM_LOADFILE, MPFROMP(((filename && *filename) ? 1537 filename : NULL)), MPVOID);1543 filename : NULL)), MPVOID); 1538 1544 if (flags & 4) 1539 1545 PostMsg(hwndClient, UM_INITIALSIZE, MPVOID, MPVOID); … … 1568 1574 switch (id) { 1569 1575 case INI_APPLIST: 1570 id = INI_APPMENU;1571 break;1576 id = INI_APPMENU; 1577 break; 1572 1578 case INI_KEYLIST: 1573 id = INI_KEYMENU;1574 break;1579 id = INI_KEYMENU; 1580 break; 1575 1581 default: 1576 id = 0;1577 break;1582 id = 0; 1583 break; 1578 1584 } 1579 1585 if (id) { 1580 if (hwndPopup)1581 WinDestroyWindow(hwndPopup);1582 hwndPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);1583 if (hwndPopup)1584 WinPopupMenu(hwnd, WinQueryWindow(hwnd, QW_PARENT),1585 hwndPopup, 8, 8, 0,1586 PU_HCONSTRAIN | PU_VCONSTRAIN |1587 PU_KEYBOARD | PU_MOUSEBUTTON1);1586 if (hwndPopup) 1587 WinDestroyWindow(hwndPopup); 1588 hwndPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id); 1589 if (hwndPopup) 1590 WinPopupMenu(hwnd, WinQueryWindow(hwnd, QW_PARENT), 1591 hwndPopup, 8, 8, 0, 1592 PU_HCONSTRAIN | PU_VCONSTRAIN | 1593 PU_KEYBOARD | PU_MOUSEBUTTON1); 1588 1594 } 1589 1595 } … … 1603 1609 inidata = WinQueryWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER); 1604 1610 if (!inidata || !*inidata->ininame || !*inidata->applname || 1605 !inidata->keyname) {1606 DosBeep(50, 100);1607 break;1611 !inidata->keyname) { 1612 DosBeep(50, 100); 1613 break; 1608 1614 } 1609 1615 hptrINI = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, INI_FRAME); … … 1625 1631 DItem.hstrSourceName = DrgAddStrHandle(inidata->applname); 1626 1632 if (id == INI_APPLIST) 1627 DItem.hstrTargetName = DrgAddStrHandle(NullStr);1633 DItem.hstrTargetName = DrgAddStrHandle(NullStr); 1628 1634 else 1629 DItem.hstrTargetName = DrgAddStrHandle(inidata->keyname);1635 DItem.hstrTargetName = DrgAddStrHandle(inidata->keyname); 1630 1636 DItem.fsControl = 0; 1631 1637 DItem.fsSupportedOps = DO_COPYABLE | DO_LINKABLE | DO_MOVEABLE; … … 1634 1640 hDrop = DrgDrag(hwnd, pDInfo, &DIcon, 1L, VK_ENDDRAG, (PVOID) NULL); 1635 1641 if (hDrop == NULLHANDLE) 1636 FreeDragInfoData(hwnd, pDInfo);1642 FreeDragInfoData(hwnd, pDInfo); 1637 1643 WinDestroyPointer(hptrINI); 1638 1644 } … … 1645 1651 1646 1652 if (!DrgAccessDraginfo(pDInfo)) { 1647 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,1648 "DrgAccessDraginfo");1653 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 1654 "DrgAccessDraginfo"); 1649 1655 } 1650 1656 else { 1651 pDItem = DrgQueryDragitemPtr(pDInfo,0);1652 /* Check valid rendering mechanisms and data */1653 if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) {1654 DrgFreeDraginfo(pDInfo);1655 return (MRFROM2SHORT(DOR_DROP, DO_LINK));/* OK to drop */1656 }1657 else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) {1658 if (WinQueryWindow(pDInfo->hwndSource, QW_PARENT) !=1659 WinQueryWindow(hwnd, QW_PARENT))1660 {1661 DrgFreeDraginfo(pDInfo);1662 return (MRFROM2SHORT(DOR_DROP, ((fCopyDefault) ? DO_COPY : DO_MOVE)));1663 }1664 }1665 DrgFreeDraginfo(pDInfo);1657 pDItem = DrgQueryDragitemPtr(pDInfo,0); 1658 /* Check valid rendering mechanisms and data */ 1659 if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) { 1660 DrgFreeDraginfo(pDInfo); 1661 return (MRFROM2SHORT(DOR_DROP, DO_LINK)); /* OK to drop */ 1662 } 1663 else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) { 1664 if (WinQueryWindow(pDInfo->hwndSource, QW_PARENT) != 1665 WinQueryWindow(hwnd, QW_PARENT)) 1666 { 1667 DrgFreeDraginfo(pDInfo); 1668 return (MRFROM2SHORT(DOR_DROP, ((fCopyDefault) ? DO_COPY : DO_MOVE))); 1669 } 1670 } 1671 DrgFreeDraginfo(pDInfo); 1666 1672 } 1667 1673 } … … 1675 1681 { 1676 1682 PDRAGINFO pDInfo = (PDRAGINFO) mp1; 1677 PDRAGITEM pDItem; /* Pointer to DRAGITEM */1683 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ 1678 1684 ULONG numitems, curitem, len; 1679 1685 USHORT action; 1680 1686 CHAR szFrom[CCHMAXPATH + 2], szDir[CCHMAXPATH + 1], 1681 szTemp[CCHMAXPATH + 2];1687 szTemp[CCHMAXPATH + 2]; 1682 1688 FILESTATUS3 fsa; 1683 1689 INIREC inirec; 1684 1690 1685 1691 if (!DrgAccessDraginfo(pDInfo)) { 1686 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,1687 "DrgAccessDraginfo");1688 return 0;1692 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 1693 "DrgAccessDraginfo"); 1694 return 0; 1689 1695 } 1690 1696 numitems = DrgQueryDragitemCount(pDInfo); 1691 1697 for (curitem = 0; curitem < numitems; curitem++) { 1692 pDItem = DrgQueryDragitemPtr(pDInfo, curitem);1693 if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) {1694 if (pDItem->fsControl & DC_PREPARE)1695 DrgSendTransferMsg(pDItem->hwndItem,1696 DM_ENDCONVERSATION,1697 MPFROMLONG(pDItem->ulItemID),1698 MPFROMLONG(DMFL_TARGETFAIL));1699 else {1700 if (FullDrgName(pDItem, szFrom, sizeof(szFrom)) &&1701 !DosQueryPathInfo(szFrom, FIL_STANDARD, &fsa, sizeof(fsa)))1702 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,1703 MPFROM2SHORT(IDM_COMPARE, 0), MPFROMP(szFrom));1704 DrgSendTransferMsg(pDItem->hwndItem,1705 DM_ENDCONVERSATION,1706 MPFROMLONG(pDItem->ulItemID),1707 MPFROMLONG(DMFL_TARGETFAIL));1708 }1709 }1710 else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) {1711 *szDir = *szFrom = *szTemp = 0;1712 len = DrgQueryStrName(pDItem->hstrContainerName, CCHMAXPATH, szDir);1713 szDir[len] = 0;1714 len = DrgQueryStrName(pDItem->hstrSourceName, CCHMAXPATH, szFrom);1715 szFrom[len] = 0;1716 len = DrgQueryStrName(pDItem->hstrTargetName, CCHMAXPATH, szTemp);1717 szTemp[len] = 0;1718 switch (pDInfo->usOperation) {1719 case DO_MOVE:1720 action = IDM_MOVE;1721 break;1722 case DO_COPY:1723 action = IDM_COPY;1724 break;1725 default:1726 action = IDM_INFO;1727 break;1728 }1729 memset(&inirec, 0, sizeof(inirec));1730 inirec.size = sizeof(inirec);1731 strcpy(inirec.filename2, szDir);1732 strcpy(inirec.app, szFrom);1733 strcpy(inirec.key, szTemp);1734 inirec.action = action;1735 inirec.hwndSource = WinQueryWindow(pDInfo->hwndSource, QW_PARENT);1736 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND,1737 MPFROM2SHORT(action, 0), MPFROMP(&inirec));1738 DrgSendTransferMsg(pDItem->hwndItem,1739 DM_ENDCONVERSATION,1740 MPFROMLONG(pDItem->ulItemID),1741 MPFROMLONG(DMFL_TARGETFAIL));1742 }1698 pDItem = DrgQueryDragitemPtr(pDInfo, curitem); 1699 if (DrgVerifyRMF(pDItem, DRM_OS2FILE, NULL)) { 1700 if (pDItem->fsControl & DC_PREPARE) 1701 DrgSendTransferMsg(pDItem->hwndItem, 1702 DM_ENDCONVERSATION, 1703 MPFROMLONG(pDItem->ulItemID), 1704 MPFROMLONG(DMFL_TARGETFAIL)); 1705 else { 1706 if (FullDrgName(pDItem, szFrom, sizeof(szFrom)) && 1707 !DosQueryPathInfo(szFrom, FIL_STANDARD, &fsa, sizeof(fsa))) 1708 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND, 1709 MPFROM2SHORT(IDM_COMPARE, 0), MPFROMP(szFrom)); 1710 DrgSendTransferMsg(pDItem->hwndItem, 1711 DM_ENDCONVERSATION, 1712 MPFROMLONG(pDItem->ulItemID), 1713 MPFROMLONG(DMFL_TARGETFAIL)); 1714 } 1715 } 1716 else if (DrgVerifyRMF(pDItem, DRM_FM2INIRECORD, DRF_FM2INI)) { 1717 *szDir = *szFrom = *szTemp = 0; 1718 len = DrgQueryStrName(pDItem->hstrContainerName, CCHMAXPATH, szDir); 1719 szDir[len] = 0; 1720 len = DrgQueryStrName(pDItem->hstrSourceName, CCHMAXPATH, szFrom); 1721 szFrom[len] = 0; 1722 len = DrgQueryStrName(pDItem->hstrTargetName, CCHMAXPATH, szTemp); 1723 szTemp[len] = 0; 1724 switch (pDInfo->usOperation) { 1725 case DO_MOVE: 1726 action = IDM_MOVE; 1727 break; 1728 case DO_COPY: 1729 action = IDM_COPY; 1730 break; 1731 default: 1732 action = IDM_INFO; 1733 break; 1734 } 1735 memset(&inirec, 0, sizeof(inirec)); 1736 inirec.size = sizeof(inirec); 1737 strcpy(inirec.filename2, szDir); 1738 strcpy(inirec.app, szFrom); 1739 strcpy(inirec.key, szTemp); 1740 inirec.action = action; 1741 inirec.hwndSource = WinQueryWindow(pDInfo->hwndSource, QW_PARENT); 1742 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_COMMAND, 1743 MPFROM2SHORT(action, 0), MPFROMP(&inirec)); 1744 DrgSendTransferMsg(pDItem->hwndItem, 1745 DM_ENDCONVERSATION, 1746 MPFROMLONG(pDItem->ulItemID), 1747 MPFROMLONG(DMFL_TARGETFAIL)); 1748 } 1743 1749 } // for 1744 1750 FreeDragInfoData(hwnd, pDInfo); … … 1789 1795 inidata->currid = INI_APPLIST; 1790 1796 inidata->hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1791 FID_MENU);1797 FID_MENU); 1792 1798 inidata->hwndIni = hwnd; 1793 1799 WinSetWindowPtr(hwnd, QWL_USER, (PVOID) inidata); … … 1795 1801 1796 1802 if (!WinCreateWindow 1797 (hwnd, WC_LISTBOX, (PSZ) NULL,1798 WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,1799 HWND_TOP, INI_APPLIST, NULL, NULL)) {1803 (hwnd, WC_LISTBOX, (PSZ) NULL, 1804 WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd, 1805 HWND_TOP, INI_APPLIST, NULL, NULL)) { 1800 1806 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1801 1807 } 1802 1808 if (!WinCreateWindow 1803 (hwnd, WC_LISTBOX, (PSZ) NULL,1804 WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,1805 HWND_TOP, INI_KEYLIST, NULL, NULL)) {1809 (hwnd, WC_LISTBOX, (PSZ) NULL, 1810 WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd, 1811 HWND_TOP, INI_KEYLIST, NULL, NULL)) { 1806 1812 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1807 1813 } 1808 1814 if (!WinCreateWindow 1809 (hwnd, WC_LISTBOX, (PSZ) NULL,1810 WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd,1811 HWND_TOP, INI_DATALIST, NULL, NULL)) {1815 (hwnd, WC_LISTBOX, (PSZ) NULL, 1816 WS_VISIBLE | LS_HORZSCROLL | LS_NOADJUSTPOS, 0, 0, 0, 0, hwnd, 1817 HWND_TOP, INI_DATALIST, NULL, NULL)) { 1812 1818 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1813 1819 } 1814 1820 if (!WinCreateWindow(hwnd, WC_STATIC, (PSZ) NULL, WS_VISIBLE | SS_TEXT | 1815 DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,1816 INI_NUMAPPS, NULL, NULL)) {1821 DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP, 1822 INI_NUMAPPS, NULL, NULL)) { 1817 1823 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1818 1824 } 1819 1825 if (!WinCreateWindow(hwnd, WC_STATIC, (PSZ) NULL, WS_VISIBLE | SS_TEXT | 1820 DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,1821 INI_NUMKEYS, NULL, NULL)) {1826 DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP, 1827 INI_NUMKEYS, NULL, NULL)) { 1822 1828 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1823 1829 } 1824 1830 if (!WinCreateWindow(hwnd, WC_STATIC, (PSZ) NULL, WS_VISIBLE | SS_TEXT | 1825 DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP,1826 INI_NUMDATA, NULL, NULL)) {1831 DT_CENTER | DT_VCENTER, 0, 0, 0, 0, hwnd, HWND_TOP, 1832 INI_NUMDATA, NULL, NULL)) { 1827 1833 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1828 1834 } 1829 1835 if (!WinCreateWindow(hwnd, 1830 WC_STATIC,1831 GetPString(IDS_APPLICATIONSTITLETEXT),1832 WS_VISIBLE | SS_TEXT |1833 DT_CENTER | DT_VCENTER,1834 0,1835 0, 0, 0, hwnd, HWND_TOP, INI_APPHDR, NULL, NULL)) {1836 WC_STATIC, 1837 GetPString(IDS_APPLICATIONSTITLETEXT), 1838 WS_VISIBLE | SS_TEXT | 1839 DT_CENTER | DT_VCENTER, 1840 0, 1841 0, 0, 0, hwnd, HWND_TOP, INI_APPHDR, NULL, NULL)) { 1836 1842 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1837 1843 } 1838 1844 if (!WinCreateWindow(hwnd, 1839 WC_STATIC,1840 GetPString(IDS_KEYWORDSTITLETEXT),1841 WS_VISIBLE | SS_TEXT |1842 DT_CENTER | DT_VCENTER,1843 0,1844 0, 0, 0, hwnd, HWND_TOP, INI_KEYHDR, NULL, NULL)) {1845 WC_STATIC, 1846 GetPString(IDS_KEYWORDSTITLETEXT), 1847 WS_VISIBLE | SS_TEXT | 1848 DT_CENTER | DT_VCENTER, 1849 0, 1850 0, 0, 0, hwnd, HWND_TOP, INI_KEYHDR, NULL, NULL)) { 1845 1851 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1846 1852 } 1847 1853 if (!WinCreateWindow(hwnd, 1848 WC_STATIC,1849 GetPString(IDS_DATABYTESTITLETEXT),1850 WS_VISIBLE | SS_TEXT |1851 DT_CENTER | DT_VCENTER,1852 0,1853 0, 0, 0, hwnd, HWND_TOP, INI_DATAHDR, NULL, NULL)) {1854 WC_STATIC, 1855 GetPString(IDS_DATABYTESTITLETEXT), 1856 WS_VISIBLE | SS_TEXT | 1857 DT_CENTER | DT_VCENTER, 1858 0, 1859 0, 0, 0, hwnd, HWND_TOP, INI_DATAHDR, NULL, NULL)) { 1854 1860 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 1855 1861 } … … 1860 1866 1861 1867 oldproc = WinSubclassWindow(WinWindowFromID(hwnd, INI_APPLIST), 1862 IniLBSubProc);1868 IniLBSubProc); 1863 1869 WinSetWindowPtr(WinWindowFromID(hwnd, INI_APPLIST), 1864 QWL_USER, (PVOID) oldproc);1870 QWL_USER, (PVOID) oldproc); 1865 1871 oldproc = WinSubclassWindow(WinWindowFromID(hwnd, INI_KEYLIST), 1866 IniLBSubProc);1872 IniLBSubProc); 1867 1873 WinSetWindowPtr(WinWindowFromID(hwnd, INI_KEYLIST), 1868 QWL_USER, (PVOID) oldproc);1874 QWL_USER, (PVOID) oldproc); 1869 1875 oldproc = WinSubclassWindow(WinWindowFromID(hwnd, INI_DATALIST), 1870 IniLBSubProc2);1876 IniLBSubProc2); 1871 1877 WinSetWindowPtr(WinWindowFromID(hwnd, INI_DATALIST), 1872 QWL_USER, (PVOID) oldproc);1878 QWL_USER, (PVOID) oldproc); 1873 1879 break; 1874 1880 … … 1877 1883 if (mp2) { 1878 1884 if (hwndMain && fAutoView) 1879 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);1885 PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID); 1880 1886 inidata = INSTDATA(hwnd); 1881 1887 if (!inidata) 1882 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);1888 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 1883 1889 else if (hwndStatus) { 1884 if (*inidata->ininame) {1885 WinSetWindowText(hwndStatus, GetPString(IDS_INTERNALINIVIEWERTEXT));1886 if (hwndStatus2)1887 WinSetWindowText(hwndStatus2, inidata->ininame);1888 }1889 else1890 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);1890 if (*inidata->ininame) { 1891 WinSetWindowText(hwndStatus, GetPString(IDS_INTERNALINIVIEWERTEXT)); 1892 if (hwndStatus2) 1893 WinSetWindowText(hwndStatus2, inidata->ininame); 1894 } 1895 else 1896 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 1891 1897 } 1892 1898 } … … 1901 1907 case UM_ACTION: 1902 1908 SetPresParams(WinWindowFromID(hwnd, INI_APPHDR), 1903 &RGBGREY,1904 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));1909 &RGBGREY, 1910 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT)); 1905 1911 SetPresParams(WinWindowFromID(hwnd, INI_KEYHDR), 1906 &RGBGREY,1907 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));1912 &RGBGREY, 1913 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT)); 1908 1914 SetPresParams(WinWindowFromID(hwnd, INI_DATAHDR), 1909 &RGBGREY,1910 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));1915 &RGBGREY, 1916 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT)); 1911 1917 SetPresParams(WinWindowFromID(hwnd, INI_NUMAPPS), 1912 &RGBGREY,1913 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));1918 &RGBGREY, 1919 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT)); 1914 1920 SetPresParams(WinWindowFromID(hwnd, INI_NUMKEYS), 1915 &RGBGREY,1916 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));1921 &RGBGREY, 1922 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT)); 1917 1923 SetPresParams(WinWindowFromID(hwnd, INI_NUMDATA), 1918 &RGBGREY,1919 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT));1924 &RGBGREY, 1925 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVBOLDTEXT)); 1920 1926 if (!WinSetPresParam(WinWindowFromID(hwnd, INI_DATALIST), 1921 PP_FONTNAMESIZE,1922 (ULONG) strlen(GetPString(IDS_5SYSTEMVIOTEXT)) + 1,1923 (PVOID) GetPString(IDS_5SYSTEMVIOTEXT)))1927 PP_FONTNAMESIZE, 1928 (ULONG) strlen(GetPString(IDS_5SYSTEMVIOTEXT)) + 1, 1929 (PVOID) GetPString(IDS_5SYSTEMVIOTEXT))) 1924 1930 WinSetPresParam(WinWindowFromID(hwnd, INI_DATALIST), 1925 PP_FONTNAMESIZE,1926 (ULONG) strlen(GetPString(IDS_10SYSTEMMONOTEXT)) + 1,1927 (PVOID) GetPString(IDS_10SYSTEMMONOTEXT));1931 PP_FONTNAMESIZE, 1932 (ULONG) strlen(GetPString(IDS_10SYSTEMMONOTEXT)) + 1, 1933 (PVOID) GetPString(IDS_10SYSTEMMONOTEXT)); 1928 1934 RestorePresParams(hwnd, "IniUtil"); 1929 1935 return 0; … … 1942 1948 ULONG size; 1943 1949 SHORT numitems = (SHORT)WinSendDlgItemMsg(hwnd, 1944 INI_APPLIST,1945 LM_QUERYITEMCOUNT,1946 MPVOID, MPVOID);1950 INI_APPLIST, 1951 LM_QUERYITEMCOUNT, 1952 MPVOID, MPVOID); 1947 1953 if (!numitems) { 1948 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);1949 return 0;1954 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID); 1955 return 0; 1950 1956 } 1951 1957 size = 0; 1952 1958 if (PrfQueryProfileSize(inidata->hini, 1953 (CHAR *)mp1, NULL, (PULONG) & size) && size)1954 inprofile = TRUE;1959 (CHAR *)mp1, NULL, (PULONG) & size) && size) 1960 inprofile = TRUE; 1955 1961 else 1956 inprofile = FALSE;1962 inprofile = FALSE; 1957 1963 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 1958 INI_APPLIST,1959 LM_SEARCHSTRING,1960 MPFROM2SHORT(LSS_CASESENSITIVE,1961 LIT_FIRST),1962 MPFROMP((CHAR *)mp1));1964 INI_APPLIST, 1965 LM_SEARCHSTRING, 1966 MPFROM2SHORT(LSS_CASESENSITIVE, 1967 LIT_FIRST), 1968 MPFROMP((CHAR *)mp1)); 1963 1969 if (sSelect >= 0) { 1964 if (!inprofile)1965 WinSendDlgItemMsg(hwnd,1966 INI_APPLIST,1967 LM_DELETEITEM, MPFROMSHORT(sSelect), MPVOID);1968 else if (!strcmp(inidata->applname, (CHAR *)mp1))1969 PostMsg(hwnd,1970 WM_CONTROL,1971 MPFROM2SHORT(INI_APPLIST, LN_SELECT),1972 MPFROMLONG(WinWindowFromID(hwnd, INI_APPLIST)));1970 if (!inprofile) 1971 WinSendDlgItemMsg(hwnd, 1972 INI_APPLIST, 1973 LM_DELETEITEM, MPFROMSHORT(sSelect), MPVOID); 1974 else if (!strcmp(inidata->applname, (CHAR *)mp1)) 1975 PostMsg(hwnd, 1976 WM_CONTROL, 1977 MPFROM2SHORT(INI_APPLIST, LN_SELECT), 1978 MPFROMLONG(WinWindowFromID(hwnd, INI_APPLIST))); 1973 1979 } 1974 1980 else if (inprofile) 1975 WinSendDlgItemMsg(hwnd,1976 INI_APPLIST,1977 LM_INSERTITEM,1978 MPFROM2SHORT(LIT_SORTASCENDING, 0),1979 MPFROMP((CHAR *)mp1));1981 WinSendDlgItemMsg(hwnd, 1982 INI_APPLIST, 1983 LM_INSERTITEM, 1984 MPFROM2SHORT(LIT_SORTASCENDING, 0), 1985 MPFROMP((CHAR *)mp1)); 1980 1986 if (mp2 && inidata->applname) { 1981 if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST),1982 inidata->hini, inidata->applname))1983 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);1987 if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST), 1988 inidata->hini, inidata->applname)) 1989 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID); 1984 1990 } 1985 1991 } 1986 1992 return 0; 1987 1993 1988 case UM_INITIALSIZE: /* kludge */1994 case UM_INITIALSIZE: /* kludge */ 1989 1995 inidata = INSTDATA(hwnd); 1990 1996 if (!inidata) … … 2000 2006 2001 2007 WinSetWindowPos(WinWindowFromID(hwnd, INI_APPHDR), HWND_TOP, 2002 2, cy - 22, (cx / 4) - 4, 20, SWP_MOVE | SWP_SIZE);2008 2, cy - 22, (cx / 4) - 4, 20, SWP_MOVE | SWP_SIZE); 2003 2009 WinSetWindowPos(WinWindowFromID(hwnd, INI_NUMAPPS), HWND_TOP, 2004 (cx / 4) + 2, cy - 22, (cx / 4) - 4, 20,2005 SWP_MOVE | SWP_SIZE);2010 (cx / 4) + 2, cy - 22, (cx / 4) - 4, 20, 2011 SWP_MOVE | SWP_SIZE); 2006 2012 WinSetWindowPos(WinWindowFromID(hwnd, INI_APPLIST), HWND_TOP, 2007 2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28,2008 SWP_MOVE | SWP_SIZE);2013 2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28, 2014 SWP_MOVE | SWP_SIZE); 2009 2015 WinSetWindowPos(WinWindowFromID(hwnd, INI_KEYHDR), HWND_TOP, 2010 (cx / 2) + 2, cy - 22, (cx / 4) - 4, 20,2011 SWP_MOVE | SWP_SIZE);2016 (cx / 2) + 2, cy - 22, (cx / 4) - 4, 20, 2017 SWP_MOVE | SWP_SIZE); 2012 2018 WinSetWindowPos(WinWindowFromID(hwnd, INI_NUMKEYS), HWND_TOP, 2013 (cx - (cx / 4)) + 2, cy - 22, (cx / 4) - 4, 20,2014 SWP_MOVE | SWP_SIZE);2019 (cx - (cx / 4)) + 2, cy - 22, (cx / 4) - 4, 20, 2020 SWP_MOVE | SWP_SIZE); 2015 2021 WinSetWindowPos(WinWindowFromID(hwnd, INI_KEYLIST), HWND_TOP, 2016 (cx / 2) + 2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28,2017 SWP_MOVE | SWP_SIZE);2022 (cx / 2) + 2, (cy / 2) + 2, (cx / 2) - 4, (cy / 2) - 28, 2023 SWP_MOVE | SWP_SIZE); 2018 2024 WinSetWindowPos(WinWindowFromID(hwnd, INI_DATAHDR), HWND_TOP, 2019 2, (cy / 2) - 22, (cx / 2) - 4, 20,2020 SWP_MOVE | SWP_SIZE);2025 2, (cy / 2) - 22, (cx / 2) - 4, 20, 2026 SWP_MOVE | SWP_SIZE); 2021 2027 WinSetWindowPos(WinWindowFromID(hwnd, INI_NUMDATA), HWND_TOP, 2022 (cx / 2) + 2, (cy / 2) - 22, (cx / 2) - 4, 20,2023 SWP_MOVE | SWP_SIZE);2028 (cx / 2) + 2, (cy / 2) - 22, (cx / 2) - 4, 20, 2029 SWP_MOVE | SWP_SIZE); 2024 2030 WinSetWindowPos(WinWindowFromID(hwnd, INI_DATALIST), HWND_TOP, 2025 2, 2, cx - 4, (cy / 2) - 28, SWP_MOVE | SWP_SIZE);2031 2, 2, cx - 4, (cy / 2) - 28, SWP_MOVE | SWP_SIZE); 2026 2032 } 2027 2033 break; … … 2034 2040 else { 2035 2041 if (mp1) { 2036 strcpy(inidata->ininame, (CHAR *)mp1);2037 inidata->hini = PrfOpenProfile(WinQueryAnchorBlock(hwnd),2038 inidata->ininame);2039 free(mp1);2042 strcpy(inidata->ininame, (CHAR *)mp1); 2043 inidata->hini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), 2044 inidata->ininame); 2045 free(mp1); 2040 2046 } 2041 2047 else 2042 inidata->hini = HINI_USERPROFILE;2048 inidata->hini = HINI_USERPROFILE; 2043 2049 if (inidata->hini == NULLHANDLE) { 2044 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,2045 "PrfOpenProfile failed for %s", inidata->ininame);2050 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 2051 "PrfOpenProfile failed for %s", inidata->ininame); 2046 2052 } 2047 2053 else { 2048 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);2049 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2050 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT),2051 HWND_TOP,2052 0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER);2053 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);2054 return 0;2054 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 2055 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2056 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), 2057 HWND_TOP, 2058 0, 0, 0, 0, SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER); 2059 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini); 2060 return 0; 2055 2061 } 2056 2062 } … … 2069 2075 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 2070 2076 if (hps) { 2071 WinQueryWindowRect(hwnd, &rcl);2072 WinFillRect(hps, &rcl, CLR_PALEGRAY);2073 WinEndPaint(hps);2074 /*2075 * tell status window to paint its box2076 */2077 PaintRecessedWindow(WinWindowFromID(hwnd, INI_APPHDR),2078 (HPS) 0, FALSE, FALSE);2079 PaintRecessedWindow(WinWindowFromID(hwnd, INI_KEYHDR),2080 (HPS) 0, FALSE, FALSE);2081 PaintRecessedWindow(WinWindowFromID(hwnd, INI_DATAHDR),2082 (HPS) 0, FALSE, FALSE);2083 PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMAPPS),2084 (HPS) 0, FALSE, FALSE);2085 PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMKEYS),2086 (HPS) 0, FALSE, FALSE);2087 PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMDATA),2088 (HPS) 0, FALSE, FALSE);2089 inidata = INSTDATA(hwnd);2090 if (!inidata)2091 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2092 else if (inidata->hwndCurrent)2093 BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_RED);2077 WinQueryWindowRect(hwnd, &rcl); 2078 WinFillRect(hps, &rcl, CLR_PALEGRAY); 2079 WinEndPaint(hps); 2080 /* 2081 * tell status window to paint its box 2082 */ 2083 PaintRecessedWindow(WinWindowFromID(hwnd, INI_APPHDR), 2084 (HPS) 0, FALSE, FALSE); 2085 PaintRecessedWindow(WinWindowFromID(hwnd, INI_KEYHDR), 2086 (HPS) 0, FALSE, FALSE); 2087 PaintRecessedWindow(WinWindowFromID(hwnd, INI_DATAHDR), 2088 (HPS) 0, FALSE, FALSE); 2089 PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMAPPS), 2090 (HPS) 0, FALSE, FALSE); 2091 PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMKEYS), 2092 (HPS) 0, FALSE, FALSE); 2093 PaintRecessedWindow(WinWindowFromID(hwnd, INI_NUMDATA), 2094 (HPS) 0, FALSE, FALSE); 2095 inidata = INSTDATA(hwnd); 2096 if (!inidata) 2097 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2098 else if (inidata->hwndCurrent) 2099 BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_RED); 2094 2100 } 2095 2101 } … … 2103 2109 switch (SHORT2FROMMP(mp1)) { 2104 2110 case LN_SETFOCUS: 2105 inidata = INSTDATA(hwnd);2106 if (!inidata)2107 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2108 else {2109 if (inidata->hwndCurrent)2110 BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_PALEGRAY);2111 inidata->hwndCurrent = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));2112 BoxWindow(WinWindowFromID(hwnd,2113 SHORT1FROMMP(mp1)), (HPS) 0, CLR_RED);2114 }2115 break;2111 inidata = INSTDATA(hwnd); 2112 if (!inidata) 2113 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2114 else { 2115 if (inidata->hwndCurrent) 2116 BoxWindow(inidata->hwndCurrent, (HPS) 0, CLR_PALEGRAY); 2117 inidata->hwndCurrent = WinWindowFromID(hwnd, SHORT1FROMMP(mp1)); 2118 BoxWindow(WinWindowFromID(hwnd, 2119 SHORT1FROMMP(mp1)), (HPS) 0, CLR_RED); 2120 } 2121 break; 2116 2122 2117 2123 case LN_ENTER: 2118 2124 case LN_SELECT: 2119 {2120 CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH];2121 SHORT sSelect;2122 2123 if (SHORT1FROMMP(mp1) == INI_DATALIST)2124 break;2125 2126 inidata = INSTDATA(hwnd);2127 if (!inidata || !inidata->hini) {2128 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2129 break;2130 }2131 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2132 inidata->keyindex = inidata->appindex = 0;2133 *applname = *keyname = *inidata->applname = *inidata->keyname = 0;2134 sSelect = (SHORT) WinSendDlgItemMsg(hwnd,2135 INI_APPLIST,2136 LM_QUERYSELECTION,2137 MPFROM2SHORT(LIT_FIRST, 0),2138 MPVOID);2139 if (sSelect < 0)2140 break;2141 inidata->appindex = sSelect;2142 WinSendDlgItemMsg(hwnd,2143 INI_APPLIST,2144 LM_QUERYITEMTEXT,2145 MPFROM2SHORT(sSelect, CCHMAXPATH - 1),2146 MPFROMP(applname));2147 if (SHORT1FROMMP(mp1) == INI_APPLIST) {2148 if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST),2149 inidata->hini, applname))2150 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);2151 }2152 else {2153 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, INI_KEYLIST,2154 LM_QUERYSELECTION,2155 MPFROM2SHORT(LIT_FIRST, 0),2156 MPVOID);2157 if (sSelect < 0)2158 break;2159 inidata->keyindex = sSelect;2160 WinSendDlgItemMsg(hwnd,2161 INI_KEYLIST,2162 LM_QUERYITEMTEXT,2163 MPFROM2SHORT(sSelect, CCHMAXPATH - 1),2164 MPFROMP(keyname));2165 if (!*keyname || !*applname)2166 break;2167 strcpy(inidata->keyname, keyname);2168 strcpy(inidata->applname, applname);2169 xfree(inidata->data, pszSrcFile, __LINE__);2170 inidata->data = GetKeyData(WinWindowFromID(hwnd,2171 INI_DATALIST),2172 inidata->hini,2173 applname, keyname, &inidata->datalen);2174 if (!inidata->data)2175 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID);2176 }2177 }2178 break;2125 { 2126 CHAR applname[CCHMAXPATH], keyname[CCHMAXPATH]; 2127 SHORT sSelect; 2128 2129 if (SHORT1FROMMP(mp1) == INI_DATALIST) 2130 break; 2131 2132 inidata = INSTDATA(hwnd); 2133 if (!inidata || !inidata->hini) { 2134 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2135 break; 2136 } 2137 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2138 inidata->keyindex = inidata->appindex = 0; 2139 *applname = *keyname = *inidata->applname = *inidata->keyname = 0; 2140 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, 2141 INI_APPLIST, 2142 LM_QUERYSELECTION, 2143 MPFROM2SHORT(LIT_FIRST, 0), 2144 MPVOID); 2145 if (sSelect < 0) 2146 break; 2147 inidata->appindex = sSelect; 2148 WinSendDlgItemMsg(hwnd, 2149 INI_APPLIST, 2150 LM_QUERYITEMTEXT, 2151 MPFROM2SHORT(sSelect, CCHMAXPATH - 1), 2152 MPFROMP(applname)); 2153 if (SHORT1FROMMP(mp1) == INI_APPLIST) { 2154 if (!EnumKeyNames(WinWindowFromID(hwnd, INI_KEYLIST), 2155 inidata->hini, applname)) 2156 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID); 2157 } 2158 else { 2159 sSelect = (SHORT) WinSendDlgItemMsg(hwnd, INI_KEYLIST, 2160 LM_QUERYSELECTION, 2161 MPFROM2SHORT(LIT_FIRST, 0), 2162 MPVOID); 2163 if (sSelect < 0) 2164 break; 2165 inidata->keyindex = sSelect; 2166 WinSendDlgItemMsg(hwnd, 2167 INI_KEYLIST, 2168 LM_QUERYITEMTEXT, 2169 MPFROM2SHORT(sSelect, CCHMAXPATH - 1), 2170 MPFROMP(keyname)); 2171 if (!*keyname || !*applname) 2172 break; 2173 strcpy(inidata->keyname, keyname); 2174 strcpy(inidata->applname, applname); 2175 xfree(inidata->data, pszSrcFile, __LINE__); 2176 inidata->data = GetKeyData(WinWindowFromID(hwnd, 2177 INI_DATALIST), 2178 inidata->hini, 2179 applname, keyname, &inidata->datalen); 2180 if (!inidata->data) 2181 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), MPVOID); 2182 } 2183 } 2184 break; 2179 2185 } 2180 2186 break; … … 2188 2194 2189 2195 num = (SHORT) WinSendDlgItemMsg(hwnd, 2190 INI_APPLIST,2191 LM_QUERYITEMCOUNT, MPVOID, MPVOID);2196 INI_APPLIST, 2197 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 2192 2198 sprintf(s, "%u", num); 2193 2199 WinSetDlgItemText(hwnd, INI_NUMAPPS, s); 2194 2200 num = (SHORT) WinSendDlgItemMsg(hwnd, 2195 INI_KEYLIST,2196 LM_QUERYITEMCOUNT, MPVOID, MPVOID);2201 INI_KEYLIST, 2202 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 2197 2203 sprintf(s, "%u", num); 2198 2204 WinSetDlgItemText(hwnd, INI_NUMKEYS, s); 2199 2205 WinSetDlgItemText(hwnd, INI_NUMDATA, "0"); 2200 2206 WinSendDlgItemMsg(hwnd, INI_DATALIST, LM_DELETEALL, MPVOID, MPVOID); 2201 // inidata = WinQueryWindowPtr(hwnd, QWL_USER); // 09 Jan 08 SHL2207 // inidata = WinQueryWindowPtr(hwnd, QWL_USER); // 09 Jan 08 SHL 2202 2208 } 2203 2209 return 0; … … 2218 2224 prfp.pszSysName = (PSZ) sysini; 2219 2225 if (PrfQueryProfile(WinQueryAnchorBlock(hwnd), &prfp)) { 2220 if (inidata->hini == HINI_SYSTEMPROFILE)2221 strcpy(inidata->ininame, sysini);2222 else if (inidata->hini == HINI_USERPROFILE)2223 strcpy(inidata->ininame, userini);2224 sprintf(sysini, GetPString(IDS_INITITLETEXT), inidata->ininame);2225 WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), sysini);2226 if (WinQueryWindow(hwnd, QW_PARENT) ==2227 WinQueryActiveWindow(WinQueryWindow2228 (WinQueryWindow(hwnd, QW_PARENT),2229 QW_PARENT))) {2230 if (hwndStatus)2231 WinSetWindowText(hwndStatus,2232 GetPString(IDS_INTERNALINIVIEWERTEXT));2233 if (hwndStatus2)2234 WinSetWindowText(hwndStatus2, inidata->ininame);2235 }2226 if (inidata->hini == HINI_SYSTEMPROFILE) 2227 strcpy(inidata->ininame, sysini); 2228 else if (inidata->hini == HINI_USERPROFILE) 2229 strcpy(inidata->ininame, userini); 2230 sprintf(sysini, GetPString(IDS_INITITLETEXT), inidata->ininame); 2231 WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), sysini); 2232 if (WinQueryWindow(hwnd, QW_PARENT) == 2233 WinQueryActiveWindow(WinQueryWindow 2234 (WinQueryWindow(hwnd, QW_PARENT), 2235 QW_PARENT))) { 2236 if (hwndStatus) 2237 WinSetWindowText(hwndStatus, 2238 GetPString(IDS_INTERNALINIVIEWERTEXT)); 2239 if (hwndStatus2) 2240 WinSetWindowText(hwndStatus2, inidata->ininame); 2241 } 2236 2242 } 2237 2243 else 2238 WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT),2239 GetPString(IDS_INIQUERYPRFFAILEDTEXT));2244 WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), 2245 GetPString(IDS_INIQUERYPRFFAILEDTEXT)); 2240 2246 return 0; 2241 2247 } … … 2247 2253 if (!(SHORT1FROMMP(mp1) & KC_KEYUP)) { 2248 2254 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { 2249 switch (SHORT2FROMMP(mp2)) {2250 case VK_DELETE:2251 inidata = INSTDATA(hwnd);2252 if (!inidata)2253 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2254 else {2255 SHORT cmd = inidata->hwndCurrent &&2256 WinQueryWindowUShort(inidata->hwndCurrent, QWS_ID) ==2257 INI_APPLIST ?2258 INI_DELETEAPP :INI_DELETEKEY;2259 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);2260 }2261 break;2262 }2255 switch (SHORT2FROMMP(mp2)) { 2256 case VK_DELETE: 2257 inidata = INSTDATA(hwnd); 2258 if (!inidata) 2259 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2260 else { 2261 SHORT cmd = inidata->hwndCurrent && 2262 WinQueryWindowUShort(inidata->hwndCurrent, QWS_ID) == 2263 INI_APPLIST ? 2264 INI_DELETEAPP :INI_DELETEKEY; 2265 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 2266 } 2267 break; 2268 } 2263 2269 } 2264 2270 } … … 2271 2277 inidata = INSTDATA(hwnd); 2272 2278 if (!inidata) 2273 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2279 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2274 2280 else if (inidata->hwndCurrent) { 2275 STRINGINPARMS sip;2276 static CHAR tofind[258] = "";2277 SHORT x, z;2278 2279 if (SHORT1FROMMP(mp1) == IDM_FINDFIRST || !*tofind) {2280 z = LIT_FIRST;2281 memset(&sip, 0, sizeof(sip));2282 sip.help = GetPString(IDS_INISEARCHHELPTEXT);2283 sip.prompt = GetPString(IDS_INISEARCHPROMPTTEXT);2284 sip.inputlen = 257;2285 sip.ret = tofind;2286 sip.title = GetPString(IDS_INISEARCHTITLETEXT);2287 if (WinDlgBox(HWND_DESKTOP,2288 hwnd,2289 InputDlgProc, FM3ModHandle, STR_FRAME, &sip)) {2290 rstrip(tofind);2291 if (!*tofind) {2292 DosBeep(50, 100);2293 break;2294 }2295 }2296 else2297 break;2298 }2299 else {2300 z = (SHORT) WinSendMsg(inidata->hwndCurrent,2301 LM_QUERYSELECTION,2302 MPFROM2SHORT(LIT_CURSOR, 0), MPVOID);2303 if (z < 0)2304 z = LIT_FIRST;2305 }2306 x = (SHORT) WinSendMsg(inidata->hwndCurrent,2307 LM_SEARCHSTRING,2308 MPFROM2SHORT(LSS_SUBSTRING, z),2309 MPFROMP(tofind));2310 if (x >= 0 && x > z) {2311 WinSendMsg(inidata->hwndCurrent,2312 LM_SETTOPINDEX, MPFROM2SHORT(x, 0), MPVOID);2313 WinSendMsg(inidata->hwndCurrent,2314 LM_SELECTITEM,2315 MPFROM2SHORT(x, 0), MPFROM2SHORT(TRUE, 0));2316 }2317 else2318 DosBeep(250, 100);2281 STRINGINPARMS sip; 2282 static CHAR tofind[258] = ""; 2283 SHORT x, z; 2284 2285 if (SHORT1FROMMP(mp1) == IDM_FINDFIRST || !*tofind) { 2286 z = LIT_FIRST; 2287 memset(&sip, 0, sizeof(sip)); 2288 sip.help = GetPString(IDS_INISEARCHHELPTEXT); 2289 sip.prompt = GetPString(IDS_INISEARCHPROMPTTEXT); 2290 sip.inputlen = 257; 2291 sip.ret = tofind; 2292 sip.title = GetPString(IDS_INISEARCHTITLETEXT); 2293 if (WinDlgBox(HWND_DESKTOP, 2294 hwnd, 2295 InputDlgProc, FM3ModHandle, STR_FRAME, &sip)) { 2296 rstrip(tofind); 2297 if (!*tofind) { 2298 DosBeep(50, 100); 2299 break; 2300 } 2301 } 2302 else 2303 break; 2304 } 2305 else { 2306 z = (SHORT) WinSendMsg(inidata->hwndCurrent, 2307 LM_QUERYSELECTION, 2308 MPFROM2SHORT(LIT_CURSOR, 0), MPVOID); 2309 if (z < 0) 2310 z = LIT_FIRST; 2311 } 2312 x = (SHORT) WinSendMsg(inidata->hwndCurrent, 2313 LM_SEARCHSTRING, 2314 MPFROM2SHORT(LSS_SUBSTRING, z), 2315 MPFROMP(tofind)); 2316 if (x >= 0 && x > z) { 2317 WinSendMsg(inidata->hwndCurrent, 2318 LM_SETTOPINDEX, MPFROM2SHORT(x, 0), MPVOID); 2319 WinSendMsg(inidata->hwndCurrent, 2320 LM_SELECTITEM, 2321 MPFROM2SHORT(x, 0), MPFROM2SHORT(TRUE, 0)); 2322 } 2323 else 2324 DosBeep(250, 100); 2319 2325 } 2320 2326 break; … … 2323 2329 inidata = INSTDATA(hwnd); 2324 2330 if (!inidata) 2325 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2331 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2326 2332 else { 2327 SHORT numitems = (SHORT)WinSendDlgItemMsg(hwnd,2328 INI_APPLIST,2329 LM_QUERYITEMCOUNT,2330 MPVOID, MPVOID);2331 if (numitems)2332 WinDlgBox(HWND_DESKTOP,2333 hwnd,2334 FilterIniProc, FM3ModHandle, IAF_FRAME, (PVOID) inidata);2335 else2336 DosBeep(50, 100);2333 SHORT numitems = (SHORT)WinSendDlgItemMsg(hwnd, 2334 INI_APPLIST, 2335 LM_QUERYITEMCOUNT, 2336 MPVOID, MPVOID); 2337 if (numitems) 2338 WinDlgBox(HWND_DESKTOP, 2339 hwnd, 2340 FilterIniProc, FM3ModHandle, IAF_FRAME, (PVOID) inidata); 2341 else 2342 DosBeep(50, 100); 2337 2343 } 2338 2344 break; … … 2343 2349 inidata = INSTDATA(hwnd); 2344 2350 if (!inidata || !*inidata->ininame) 2345 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2351 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2346 2352 else if (mp2) { 2347 INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__);2348 if (inirec) {2349 *inirec = *(INIREC *) mp2;2350 inirec->hwndDlg = hwnd;2351 inirec->confirm = inidata->confirm;2352 strcpy(inirec->filename1, inidata->ininame);2353 if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) {2354 Runtime_Error(pszSrcFile, __LINE__,2355 GetPString(IDS_COULDNTSTARTTHREADTEXT));2356 free(inirec);2357 }2358 }2353 INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__); 2354 if (inirec) { 2355 *inirec = *(INIREC *) mp2; 2356 inirec->hwndDlg = hwnd; 2357 inirec->confirm = inidata->confirm; 2358 strcpy(inirec->filename1, inidata->ininame); 2359 if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) { 2360 Runtime_Error(pszSrcFile, __LINE__, 2361 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2362 free(inirec); 2363 } 2364 } 2359 2365 } 2360 2366 break; … … 2363 2369 inidata = INSTDATA(hwnd); 2364 2370 if (!inidata || !*inidata->ininame) 2365 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2371 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2366 2372 else if (mp2) { 2367 INIREC *inirec = xmalloc(sizeof(INIREC), pszSrcFile, __LINE__);2368 if (inirec) {2369 strcpy(inirec->filename2, (CHAR *)(mp2));2370 strcpy(inirec->filename1, inidata->ininame);2371 inirec->hwndDlg = hwnd;2372 if (_beginthread(CompareIniThread, NULL, 122880, (PVOID) inirec) ==2373 -1) {2374 Runtime_Error(pszSrcFile, __LINE__,2375 GetPString(IDS_COULDNTSTARTTHREADTEXT));2376 free(inirec);2377 }2378 }2373 INIREC *inirec = xmalloc(sizeof(INIREC), pszSrcFile, __LINE__); 2374 if (inirec) { 2375 strcpy(inirec->filename2, (CHAR *)(mp2)); 2376 strcpy(inirec->filename1, inidata->ininame); 2377 inirec->hwndDlg = hwnd; 2378 if (_beginthread(CompareIniThread, NULL, 122880, (PVOID) inirec) == 2379 -1) { 2380 Runtime_Error(pszSrcFile, __LINE__, 2381 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2382 free(inirec); 2383 } 2384 } 2379 2385 } 2380 2386 break; … … 2386 2392 inidata = INSTDATA(hwnd); 2387 2393 if (!inidata) { 2388 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2389 break;2394 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2395 break; 2390 2396 } 2391 2397 if (!*inidata->ininame || 2392 !*inidata->applname ||2393 (!*inidata->keyname &&2394 (SHORT1FROMMP(mp1) == INI_RENAMEKEY ||2395 SHORT1FROMMP(mp1) == INI_COPYKEY)))2396 break;2398 !*inidata->applname || 2399 (!*inidata->keyname && 2400 (SHORT1FROMMP(mp1) == INI_RENAMEKEY || 2401 SHORT1FROMMP(mp1) == INI_COPYKEY))) 2402 break; 2397 2403 { 2398 INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__);2399 if (inirec) {2400 inirec->size = sizeof(INIREC);2401 inirec->hwndDlg = hwnd;2402 inirec->confirm = inidata->confirm;2403 inirec->action = (SHORT1FROMMP(mp1) == INI_COPYAPP ||2404 SHORT1FROMMP(mp1) == INI_COPYKEY) ?2405 IDM_COPY : IDM_MOVE;2406 strcpy(inirec->filename1, inidata->ininame);2407 strcpy(inirec->filename2, inidata->ininame);2408 if (SHORT1FROMMP(mp1) == INI_COPYKEY ||2409 SHORT1FROMMP(mp1) == INI_RENAMEKEY)2410 strcpy(inirec->key, inidata->keyname);2411 strcpy(inirec->app, inidata->applname);2412 if (!WinDlgBox(HWND_DESKTOP,2413 hwnd,2414 IntraIniProc,2415 FM3ModHandle, INII_FRAME, (PVOID) inirec)) {2416 free(inirec);2417 break;2418 }2419 if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) {2420 Runtime_Error(pszSrcFile, __LINE__,2421 GetPString(IDS_COULDNTSTARTTHREADTEXT));2422 free(inirec);2423 }2424 }2404 INIREC *inirec = xmallocz(sizeof(INIREC), pszSrcFile, __LINE__); 2405 if (inirec) { 2406 inirec->size = sizeof(INIREC); 2407 inirec->hwndDlg = hwnd; 2408 inirec->confirm = inidata->confirm; 2409 inirec->action = (SHORT1FROMMP(mp1) == INI_COPYAPP || 2410 SHORT1FROMMP(mp1) == INI_COPYKEY) ? 2411 IDM_COPY : IDM_MOVE; 2412 strcpy(inirec->filename1, inidata->ininame); 2413 strcpy(inirec->filename2, inidata->ininame); 2414 if (SHORT1FROMMP(mp1) == INI_COPYKEY || 2415 SHORT1FROMMP(mp1) == INI_RENAMEKEY) 2416 strcpy(inirec->key, inidata->keyname); 2417 strcpy(inirec->app, inidata->applname); 2418 if (!WinDlgBox(HWND_DESKTOP, 2419 hwnd, 2420 IntraIniProc, 2421 FM3ModHandle, INII_FRAME, (PVOID) inirec)) { 2422 free(inirec); 2423 break; 2424 } 2425 if (_beginthread(CopyIniThread, NULL, 122880, (PVOID) inirec) == -1) { 2426 Runtime_Error(pszSrcFile, __LINE__, 2427 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2428 free(inirec); 2429 } 2430 } 2425 2431 } 2426 2432 break; … … 2429 2435 inidata = INSTDATA(hwnd); 2430 2436 if (!inidata) 2431 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2437 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2432 2438 else if (*inidata->ininame) { 2433 // 09 Jan 08 SHL fixme to complain2434 CHAR filename[CCHMAXPATH], *p;2435 2436 strcpy(filename, inidata->ininame);2437 p = filename;2438 while (*p) {2439 if (*p == '/')2440 *p = '\\';2441 p++;2442 }2443 p = strrchr(filename, '\\');2444 if (p) {2445 p++;2446 *p = 0;2447 }2448 else2449 *filename = 0;2450 strcat(filename, "*.INI");2451 if (export_filename(hwnd, filename, TRUE)) {2452 2453 PPRFPROFILE prfp;2454 2455 prfp = xmallocz(sizeof(PRFPROFILE), pszSrcFile, __LINE__);2456 if (prfp) {2457 prfp->pszUserName =2458 xstrdup(inidata->ininame, pszSrcFile, __LINE__);2459 if (!prfp->pszUserName)2460 free(prfp);2461 else {2462 prfp->cchUserName = strlen(prfp->pszUserName);2463 prfp->pszSysName = xstrdup(filename, pszSrcFile, __LINE__);2464 if (!prfp->pszSysName) {2465 free(prfp->pszUserName);2466 free(prfp);2467 }2468 else {2469 prfp->cchSysName = strlen(prfp->pszSysName);2470 if (_beginthread(BackupIniThread, NULL, 122880, (PVOID) prfp)2471 == -1) {2472 Runtime_Error(pszSrcFile, __LINE__,2473 GetPString(IDS_COULDNTSTARTTHREADTEXT));2474 free(prfp->pszSysName);2475 free(prfp->pszUserName);2476 free(prfp);2477 }2478 else2479 DosSleep(100); //05 Aug 07 GKY 2502480 }2481 }2482 }2483 }2439 // 09 Jan 08 SHL fixme to complain 2440 CHAR filename[CCHMAXPATH], *p; 2441 2442 strcpy(filename, inidata->ininame); 2443 p = filename; 2444 while (*p) { 2445 if (*p == '/') 2446 *p = '\\'; 2447 p++; 2448 } 2449 p = strrchr(filename, '\\'); 2450 if (p) { 2451 p++; 2452 *p = 0; 2453 } 2454 else 2455 *filename = 0; 2456 strcat(filename, "*.INI"); 2457 if (export_filename(hwnd, filename, TRUE)) { 2458 2459 PPRFPROFILE prfp; 2460 2461 prfp = xmallocz(sizeof(PRFPROFILE), pszSrcFile, __LINE__); 2462 if (prfp) { 2463 prfp->pszUserName = 2464 xstrdup(inidata->ininame, pszSrcFile, __LINE__); 2465 if (!prfp->pszUserName) 2466 free(prfp); 2467 else { 2468 prfp->cchUserName = strlen(prfp->pszUserName); 2469 prfp->pszSysName = xstrdup(filename, pszSrcFile, __LINE__); 2470 if (!prfp->pszSysName) { 2471 free(prfp->pszUserName); 2472 free(prfp); 2473 } 2474 else { 2475 prfp->cchSysName = strlen(prfp->pszSysName); 2476 if (_beginthread(BackupIniThread, NULL, 122880, (PVOID) prfp) 2477 == -1) { 2478 Runtime_Error(pszSrcFile, __LINE__, 2479 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2480 free(prfp->pszSysName); 2481 free(prfp->pszUserName); 2482 free(prfp); 2483 } 2484 else 2485 DosSleep(100); //05 Aug 07 GKY 250 2486 } 2487 } 2488 } 2489 } 2484 2490 } 2485 2491 break; … … 2488 2494 inidata = INSTDATA(hwnd); 2489 2495 if (!inidata) 2490 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2496 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2491 2497 else { 2492 if (WinDlgBox(HWND_DESKTOP,2493 hwnd,2494 ChangeIniProc,2495 FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) {2496 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);2497 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2498 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);2499 }2498 if (WinDlgBox(HWND_DESKTOP, 2499 hwnd, 2500 ChangeIniProc, 2501 FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) { 2502 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 2503 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2504 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini); 2505 } 2500 2506 } 2501 2507 break; … … 2504 2510 inidata = INSTDATA(hwnd); 2505 2511 if (!inidata) 2506 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2512 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2507 2513 else { 2508 if (WinDlgBox(HWND_DESKTOP,2509 hwnd,2510 SwapIniProc,2511 FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) {2512 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);2513 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2514 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);2515 }2514 if (WinDlgBox(HWND_DESKTOP, 2515 hwnd, 2516 SwapIniProc, 2517 FM3ModHandle, INIR_FRAME, (PVOID) inidata->ininame)) { 2518 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 2519 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2520 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini); 2521 } 2516 2522 } 2517 2523 break; … … 2520 2526 inidata = INSTDATA(hwnd); 2521 2527 if (!inidata) 2522 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2528 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2523 2529 else { 2524 inidata->currid++;2525 if (inidata->currid > INI_DATALIST)2526 inidata->currid = INI_APPLIST;2530 inidata->currid++; 2531 if (inidata->currid > INI_DATALIST) 2532 inidata->currid = INI_APPLIST; 2527 2533 } 2528 2534 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, inidata->currid)); … … 2532 2538 inidata = INSTDATA(hwnd); 2533 2539 if (!inidata) 2534 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2540 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2535 2541 else { 2536 inidata->currid--;2537 if (inidata->currid < INI_APPLIST)2538 inidata->currid = INI_DATALIST;2542 inidata->currid--; 2543 if (inidata->currid < INI_APPLIST) 2544 inidata->currid = INI_DATALIST; 2539 2545 } 2540 2546 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, inidata->currid)); … … 2544 2550 inidata = INSTDATA(hwnd); 2545 2551 if (!inidata) 2546 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2552 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2547 2553 else { 2548 inidata->confirm = (inidata->confirm) ? FALSE : TRUE;2549 WinCheckMenuItem(inidata->hwndMenu, INI_CONFIRM, inidata->confirm);2554 inidata->confirm = (inidata->confirm) ? FALSE : TRUE; 2555 WinCheckMenuItem(inidata->hwndMenu, INI_CONFIRM, inidata->confirm); 2550 2556 2551 2557 } … … 2556 2562 inidata = INSTDATA(hwnd); 2557 2563 if (!inidata) 2558 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2564 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2559 2565 else { 2560 inidata->edit = (SHORT1FROMMP(mp1) == INI_EDITENTRY);2561 WinDlgBox(HWND_DESKTOP,2562 hwnd, AddIniProc, FM3ModHandle, IAD_FRAME, (PVOID) inidata);2566 inidata->edit = (SHORT1FROMMP(mp1) == INI_EDITENTRY); 2567 WinDlgBox(HWND_DESKTOP, 2568 hwnd, AddIniProc, FM3ModHandle, IAD_FRAME, (PVOID) inidata); 2563 2569 } 2564 2570 break; … … 2567 2573 inidata = INSTDATA(hwnd); 2568 2574 if (!inidata) 2569 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2575 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2570 2576 else { 2571 CHAR filename[CCHMAXPATH + 81], *p;2572 FILESTATUS3 fsa;2573 HINI hINI;2574 2575 strcpy(filename, inidata->ininame);2576 p = filename;2577 while (*p) {2578 if (*p == '/')2579 *p = '\\';2580 p++;2581 }2582 p = strrchr(filename, '\\');2583 if (p) {2584 p++;2585 *p = 0;2586 }2587 else2588 *filename = 0;2589 strcat(filename, "*.INI");2590 if (insert_filename(hwnd,2591 filename,2592 TRUE,2593 TRUE) &&2594 *filename &&2595 !DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) {2596 hINI = PrfOpenProfile(WinQueryAnchorBlock(hwnd), filename);2597 if (hINI == NULLHANDLE) {2598 Win_Error(hwnd, hwnd, __FILE__, __LINE__,2599 GetPString(IDS_INICANTOPENINITEXT), filename);2600 }2601 else {2602 if (*inidata->ininame) {2603 if (inidata->hini)2604 CloseProfile(inidata->hini, FALSE);2605 *inidata->ininame = 0;2606 }2607 inidata->hini = hINI;2608 strcpy(inidata->ininame, filename);2609 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);2610 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2611 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);2612 }2613 }2577 CHAR filename[CCHMAXPATH + 81], *p; 2578 FILESTATUS3 fsa; 2579 HINI hINI; 2580 2581 strcpy(filename, inidata->ininame); 2582 p = filename; 2583 while (*p) { 2584 if (*p == '/') 2585 *p = '\\'; 2586 p++; 2587 } 2588 p = strrchr(filename, '\\'); 2589 if (p) { 2590 p++; 2591 *p = 0; 2592 } 2593 else 2594 *filename = 0; 2595 strcat(filename, "*.INI"); 2596 if (insert_filename(hwnd, 2597 filename, 2598 TRUE, 2599 TRUE) && 2600 *filename && 2601 !DosQueryPathInfo(filename, FIL_STANDARD, &fsa, sizeof(fsa))) { 2602 hINI = PrfOpenProfile(WinQueryAnchorBlock(hwnd), filename); 2603 if (hINI == NULLHANDLE) { 2604 Win_Error(hwnd, hwnd, __FILE__, __LINE__, 2605 GetPString(IDS_INICANTOPENINITEXT), filename); 2606 } 2607 else { 2608 if (*inidata->ininame) { 2609 if (inidata->hini) 2610 CloseProfile(inidata->hini, FALSE); 2611 *inidata->ininame = 0; 2612 } 2613 inidata->hini = hINI; 2614 strcpy(inidata->ininame, filename); 2615 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 2616 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2617 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini); 2618 } 2619 } 2614 2620 } 2615 2621 break; … … 2618 2624 inidata = INSTDATA(hwnd); 2619 2625 if (!inidata) 2620 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2626 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2621 2627 else { 2622 if (inidata->hini && *inidata->ininame)2623 CloseProfile(inidata->hini, FALSE);2624 *inidata->ininame = 0;2625 inidata->hini = HINI_USERPROFILE;2626 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);2627 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2628 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);2628 if (inidata->hini && *inidata->ininame) 2629 CloseProfile(inidata->hini, FALSE); 2630 *inidata->ininame = 0; 2631 inidata->hini = HINI_USERPROFILE; 2632 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 2633 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2634 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini); 2629 2635 } 2630 2636 break; … … 2633 2639 inidata = INSTDATA(hwnd); 2634 2640 if (!inidata) 2635 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2641 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2636 2642 else { 2637 if (inidata->hini && *inidata->ininame)2638 CloseProfile(inidata->hini, FALSE);2639 *inidata->ininame = 0;2640 inidata->hini = HINI_SYSTEMPROFILE;2641 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);2642 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2643 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);2643 if (inidata->hini && *inidata->ininame) 2644 CloseProfile(inidata->hini, FALSE); 2645 *inidata->ininame = 0; 2646 inidata->hini = HINI_SYSTEMPROFILE; 2647 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 2648 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2649 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini); 2644 2650 } 2645 2651 break; … … 2648 2654 inidata = INSTDATA(hwnd); 2649 2655 if (!inidata) 2650 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2656 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2651 2657 else { 2652 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2653 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini);2658 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2659 EnumAppNames(WinWindowFromID(hwnd, INI_APPLIST), inidata->hini); 2654 2660 } 2655 2661 break; … … 2658 2664 inidata = INSTDATA(hwnd); 2659 2665 if (!inidata) 2660 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2666 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2661 2667 else if (*inidata->applname && *inidata->keyname) { 2662 2668 2663 SHORT keyindex = inidata->keyindex;2664 2665 if (inidata->confirm && saymsg(MB_YESNO,2666 hwnd,2667 GetPString(IDS_CONFIRMTEXT),2668 GetPString(IDS_INIDELETEKEYTEXT),2669 inidata->keyname) == MBID_NO)2670 break;2671 PrfWriteProfileData(inidata->hini,2672 inidata->applname, inidata->keyname, NULL, 0L);2673 *inidata->keyname = 0;2674 WinSendDlgItemMsg(hwnd,2675 INI_KEYLIST,2676 LM_DELETEITEM, MPFROM2SHORT(keyindex, 0), MPVOID);2677 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2678 sSel = (SHORT) WinSendDlgItemMsg(hwnd,2679 INI_KEYLIST,2680 LM_QUERYITEMCOUNT, MPVOID, MPVOID);2681 if (!sSel)2682 WinSendMsg(hwnd, INI_DELETEAPP, MPVOID, MPVOID);2683 else {2684 sSel = min(keyindex, sSel - 1);2685 WinSendDlgItemMsg(hwnd,2686 INI_KEYLIST,2687 LM_SELECTITEM,2688 MPFROMSHORT(sSel), MPFROMSHORT(TRUE));2689 }2669 SHORT keyindex = inidata->keyindex; 2670 2671 if (inidata->confirm && saymsg(MB_YESNO, 2672 hwnd, 2673 GetPString(IDS_CONFIRMTEXT), 2674 GetPString(IDS_INIDELETEKEYTEXT), 2675 inidata->keyname) == MBID_NO) 2676 break; 2677 PrfWriteProfileData(inidata->hini, 2678 inidata->applname, inidata->keyname, NULL, 0L); 2679 *inidata->keyname = 0; 2680 WinSendDlgItemMsg(hwnd, 2681 INI_KEYLIST, 2682 LM_DELETEITEM, MPFROM2SHORT(keyindex, 0), MPVOID); 2683 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2684 sSel = (SHORT) WinSendDlgItemMsg(hwnd, 2685 INI_KEYLIST, 2686 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 2687 if (!sSel) 2688 WinSendMsg(hwnd, INI_DELETEAPP, MPVOID, MPVOID); 2689 else { 2690 sSel = min(keyindex, sSel - 1); 2691 WinSendDlgItemMsg(hwnd, 2692 INI_KEYLIST, 2693 LM_SELECTITEM, 2694 MPFROMSHORT(sSel), MPFROMSHORT(TRUE)); 2695 } 2690 2696 } 2691 2697 break; … … 2694 2700 inidata = INSTDATA(hwnd); 2695 2701 if (!inidata) 2696 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2702 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2697 2703 // 09 Jan 08 SHL fixme to complain? 2698 2704 else if (*inidata->applname) { 2699 2705 2700 SHORT appindex = inidata->appindex;2701 2702 if (inidata->confirm && saymsg(MB_YESNO,2703 hwnd,2704 GetPString(IDS_CONFIRMTEXT),2705 GetPString(IDS_INIDELETEAPPTEXT),2706 inidata->applname) == MBID_NO)2707 break;2708 PrfWriteProfileData(inidata->hini, inidata->applname, NULL, NULL, 0L);2709 *inidata->applname = *inidata->keyname = 0;2710 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2711 WinSendDlgItemMsg(hwnd, INI_KEYLIST, LM_DELETEALL, MPVOID, MPVOID);2712 WinSendDlgItemMsg(hwnd,2713 INI_APPLIST,2714 LM_DELETEITEM, MPFROM2SHORT(appindex, 0), MPVOID);2715 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);2716 sSel = (SHORT) WinSendDlgItemMsg(hwnd,2717 INI_APPLIST,2718 LM_QUERYITEMCOUNT, MPVOID, MPVOID);2719 if (sSel) {2720 sSel = min(appindex, sSel - 1);2721 WinSendDlgItemMsg(hwnd,2722 INI_APPLIST,2723 LM_SELECTITEM,2724 MPFROMSHORT(sSel), MPFROMSHORT(TRUE));2725 }2706 SHORT appindex = inidata->appindex; 2707 2708 if (inidata->confirm && saymsg(MB_YESNO, 2709 hwnd, 2710 GetPString(IDS_CONFIRMTEXT), 2711 GetPString(IDS_INIDELETEAPPTEXT), 2712 inidata->applname) == MBID_NO) 2713 break; 2714 PrfWriteProfileData(inidata->hini, inidata->applname, NULL, NULL, 0L); 2715 *inidata->applname = *inidata->keyname = 0; 2716 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2717 WinSendDlgItemMsg(hwnd, INI_KEYLIST, LM_DELETEALL, MPVOID, MPVOID); 2718 WinSendDlgItemMsg(hwnd, 2719 INI_APPLIST, 2720 LM_DELETEITEM, MPFROM2SHORT(appindex, 0), MPVOID); 2721 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID); 2722 sSel = (SHORT) WinSendDlgItemMsg(hwnd, 2723 INI_APPLIST, 2724 LM_QUERYITEMCOUNT, MPVOID, MPVOID); 2725 if (sSel) { 2726 sSel = min(appindex, sSel - 1); 2727 WinSendDlgItemMsg(hwnd, 2728 INI_APPLIST, 2729 LM_SELECTITEM, 2730 MPFROMSHORT(sSel), MPFROMSHORT(TRUE)); 2731 } 2726 2732 } 2727 2733 break; … … 2734 2740 case IDM_HELP: 2735 2741 if (hwndHelp) 2736 WinSendMsg(hwndHelp,2737 HM_DISPLAY_HELP,2738 MPFROM2SHORT(HELP_INI, 0), MPFROMSHORT(HM_RESOURCEID));2742 WinSendMsg(hwndHelp, 2743 HM_DISPLAY_HELP, 2744 MPFROM2SHORT(HELP_INI, 0), MPFROMSHORT(HM_RESOURCEID)); 2739 2745 break; 2740 2746 2741 2747 case IDM_ABOUT: 2742 2748 saymsg(MB_ENTER | MB_ICONASTERISK, 2743 hwnd,2744 GetPString(IDS_VIEWABOUTTITLETEXT),2745 GetPString(IDS_INIABOUTTEXT));2749 hwnd, 2750 GetPString(IDS_VIEWABOUTTITLETEXT), 2751 GetPString(IDS_INIABOUTTEXT)); 2746 2752 break; 2747 2753 } … … 2755 2761 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 2756 2762 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 2757 WinStoreWindowPos(FM2Str,2758 "INIWindowPos", WinQueryWindow(hwnd, QW_PARENT));2759 // inidata = WinQueryWindowPtr(hwnd, QWL_USER); // 09 Jan 08 SHL2763 WinStoreWindowPos(FM2Str, 2764 "INIWindowPos", WinQueryWindow(hwnd, QW_PARENT)); 2765 // inidata = WinQueryWindowPtr(hwnd, QWL_USER); // 09 Jan 08 SHL 2760 2766 } 2761 2767 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); … … 2768 2774 inidata = INSTDATA(hwnd); 2769 2775 if (!inidata) 2770 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);2776 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2771 2777 else { 2772 dontclose = inidata->dontclose;2773 if (inidata->hini != NULLHANDLE && *inidata->ininame)2774 CloseProfile(inidata->hini, FALSE);2775 free(inidata->data);2776 if (inidata->hwndPopup)2777 WinDestroyWindow(inidata->hwndPopup);2778 free(inidata);2778 dontclose = inidata->dontclose; 2779 if (inidata->hini != NULLHANDLE && *inidata->ininame) 2780 CloseProfile(inidata->hini, FALSE); 2781 free(inidata->data); 2782 if (inidata->hwndPopup) 2783 WinDestroyWindow(inidata->hwndPopup); 2784 free(inidata); 2779 2785 } 2780 2786 if (!dontclose && 2781 ParentIsDesktop(hwnd, WinQueryWindow(WinQueryWindow(hwnd,2782 QW_PARENT),2783 QW_PARENT))) {2784 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))2785 DosExit(EXIT_PROCESS, 1);2787 ParentIsDesktop(hwnd, WinQueryWindow(WinQueryWindow(hwnd, 2788 QW_PARENT), 2789 QW_PARENT))) { 2790 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) 2791 DosExit(EXIT_PROCESS, 1); 2786 2792 } 2787 2793 }  - 
      
trunk/dll/mainwnd2.c
r1140 r1161 49 49 #include "notebook.h" // CfgDlgProc 50 50 #include "command.h" // RunCommand 51 #include "misc.h" // BoxWindow, FixSwitchList, SetConditionalCascade 52 // SetSysMenu 53 #include "mainwnd.h" // CloseChildren, MainWMCommand, MakeMainObjWin, ResizeDrives 54 // TopWindow 55 #include "common.h" // CommonCreateMainChildren, CommonMainWndProc 56 #include "notify.h" // HideNote 57 #include "mainwnd2.h" 58 #include "remap.h" // RemapDlgProc 59 #include "treecnr.h" // StartTreeCnr 60 #include "walkem.h" // WalkTwoCmpDlgProc, WalkTwoSetDlgProc 61 #include "dirs.h" // switch_to 51 62 #include "fm3dll.h" 52 63 #include "fortify.h"  - 
      
trunk/dll/mle.c
r1063 r1161 40 40 #include "strutil.h" // GetPString 41 41 #include "notebook.h" // httprun etc 42 #include "autoview.h" // CreateHexDump 43 #include "saveclip.h" // SaveToClip 42 44 #include "fm3dll.h" 43 45 #include "fortify.h"  - 
      
trunk/dll/notebook.c
r1109 r1161 49 49 #define INCL_DOS 50 50 #define INCL_WIN 51 #define INCL_LONGLONG // dircnrs.h51 #define INCL_LONGLONG // dircnrs.h 52 52 53 53 #include "fm3dlg.h" 54 54 #include "fm3str.h" 55 #include "pathutil.h" // BldQuotedFileName56 #include "errutil.h" // Dos_Error...57 #include "strutil.h" // GetPString55 #include "pathutil.h" // BldQuotedFileName 56 #include "errutil.h" // Dos_Error... 57 #include "strutil.h" // GetPString 58 58 #include "notebook.h" 59 #include "getnames.h" // CustomFileDlg 60 #include "mainwnd.h" // SaveDirCnrState 61 #include "walkem.h" // WalkExtractDlgProc 59 62 #include "fm3dll.h" 63 #include "misc.h" // LoadDetailsSwitches, SetConditionalCascade 60 64 #include "fortify.h" 61 65 … … 75 79 case WM_INITDLG: 76 80 WinSendDlgItemMsg(hwnd, CFGA_VIRUS, EM_SETTEXTLIMIT, 77 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);81 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 78 82 WinSendDlgItemMsg(hwnd, CFGA_EXTRACTPATH, EM_SETTEXTLIMIT, 79 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);83 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 80 84 WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE); 81 85 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); … … 123 127 switch (SHORT2FROMMP(mp1)) { 124 128 case EN_KILLFOCUS: 125 WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE);126 break;129 WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), FALSE); 130 break; 127 131 case EN_SETFOCUS: 128 WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), TRUE);129 break;132 WinEnableWindow(WinWindowFromID(hwnd, CFGA_FIND), TRUE); 133 break; 130 134 } 131 135 break; … … 133 137 switch (SHORT2FROMMP(mp1)) { 134 138 case BN_CLICKED: 135 if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) {136 137 ARC_TYPE *pat = arcsighead;// Hide dups138 139 if (!WinDlgBox(HWND_DESKTOP, hwnd,140 SBoxDlgProc, FM3ModHandle, ASEL_FRAME,141 (PVOID) & pat) || !pat || !pat->id || !*pat->id) {142 DosBeep(250, 100);// Complain143 WinCheckButton(hwnd, CFGA_DEFARC, FALSE);144 }145 else146 WinSetDlgItemText(hwnd, CFGA_DEFARCNAME, pat->id);147 }148 break;139 if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) { 140 141 ARC_TYPE *pat = arcsighead; // Hide dups 142 143 if (!WinDlgBox(HWND_DESKTOP, hwnd, 144 SBoxDlgProc, FM3ModHandle, ASEL_FRAME, 145 (PVOID) & pat) || !pat || !pat->id || !*pat->id) { 146 DosBeep(250, 100); // Complain 147 WinCheckButton(hwnd, CFGA_DEFARC, FALSE); 148 } 149 else 150 WinSetDlgItemText(hwnd, CFGA_DEFARCNAME, pat->id); 151 } 152 break; 149 153 default: 150 break;154 break; 151 155 } 152 156 break; … … 172 176 case IDM_HELP: 173 177 if (hwndHelp) 174 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,175 MPFROM2SHORT(HELP_CFGA, 0), MPFROMSHORT(HM_RESOURCEID));178 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 179 MPFROM2SHORT(HELP_CFGA, 0), MPFROMSHORT(HM_RESOURCEID)); 176 180 break; 177 181 178 182 case CFGA_FIND: 179 183 { 180 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];181 USHORT id;182 HWND hwndFocus;183 184 strcpy(filename, "*.EXE");185 hwndFocus = WinQueryFocus(HWND_DESKTOP);186 if (hwndFocus) {187 id = WinQueryWindowUShort(hwndFocus, QWS_ID);188 switch (id) {189 case CFGA_VIRUS:190 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {191 BldQuotedFileName(szfilename, filename);192 strcat(szfilename, " %p");193 WinSetDlgItemText(hwnd, id, szfilename);194 }195 break;196 case CFGA_EXTRACTPATH:197 strcpy(filename, extractpath);198 if (WinDlgBox(HWND_DESKTOP, hwndNotebook,199 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,200 MPFROMP(filename)) && *filename)201 WinSetDlgItemText(hwnd, id, filename);202 break;203 default:204 Runtime_Error(pszSrcFile, __LINE__, "bad case");205 break;206 }207 }184 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9]; 185 USHORT id; 186 HWND hwndFocus; 187 188 strcpy(filename, "*.EXE"); 189 hwndFocus = WinQueryFocus(HWND_DESKTOP); 190 if (hwndFocus) { 191 id = WinQueryWindowUShort(hwndFocus, QWS_ID); 192 switch (id) { 193 case CFGA_VIRUS: 194 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) { 195 BldQuotedFileName(szfilename, filename); 196 strcat(szfilename, " %p"); 197 WinSetDlgItemText(hwnd, id, szfilename); 198 } 199 break; 200 case CFGA_EXTRACTPATH: 201 strcpy(filename, extractpath); 202 if (WinDlgBox(HWND_DESKTOP, hwndNotebook, 203 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME, 204 MPFROMP(filename)) && *filename) 205 WinSetDlgItemText(hwnd, id, filename); 206 break; 207 default: 208 Runtime_Error(pszSrcFile, __LINE__, "bad case"); 209 break; 210 } 211 } 208 212 } 209 213 break; … … 214 218 fQuickArcFind = WinQueryButtonCheckstate(hwnd, CFGA_QUICKARCFIND); 215 219 PrfWriteProfileData(fmprof, 216 appname,217 "QuickArcFind", &fQuickArcFind, sizeof(BOOL));220 appname, 221 "QuickArcFind", &fQuickArcFind, sizeof(BOOL)); 218 222 fArcStuffVisible = WinQueryButtonCheckstate(hwnd, CFGA_ARCSTUFFVISIBLE); 219 223 PrfWriteProfileData(fmprof, 220 appname,221 "ArcStuffVisible", &fArcStuffVisible, sizeof(BOOL));224 appname, 225 "ArcStuffVisible", &fArcStuffVisible, sizeof(BOOL)); 222 226 fFolderAfterExtract = WinQueryButtonCheckstate(hwnd, 223 CFGA_FOLDERAFTEREXTRACT);227 CFGA_FOLDERAFTEREXTRACT); 224 228 PrfWriteProfileData(fmprof, 225 appname,226 "FolderAfterExtract",227 &fFolderAfterExtract, sizeof(BOOL));229 appname, 230 "FolderAfterExtract", 231 &fFolderAfterExtract, sizeof(BOOL)); 228 232 if (WinQueryButtonCheckstate(hwnd, CFGA_DEFARC)) { 229 233 … … 253 257 szCLBuf[MaxComLineStrg - 1] = 0; 254 258 if (strcmp(szCLBuf, virus)){ 255 NormalizeCmdLine(pszWorkBuf, szCLBuf);256 memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);257 if (!strchr(virus, '%') && strlen(virus) > 3)258 strcat(virus, " %p");259 NormalizeCmdLine(pszWorkBuf, szCLBuf); 260 memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1); 261 if (!strchr(virus, '%') && strlen(virus) > 3) 262 strcat(virus, " %p"); 259 263 } 260 264 free(pszWorkBuf); 261 265 free(szCLBuf); 262 266 if (!*virus) 263 strcpy(virus, "OS2SCAN.EXE %p /SUB /A");267 strcpy(virus, "OS2SCAN.EXE %p /SUB /A"); 264 268 WinQueryDlgItemText(hwnd, CFGA_EXTRACTPATH, CCHMAXPATH, szPathBuf); 265 269 szPathBuf[CCHMAXPATH - 1] = 0; 266 270 bstrip(szPathBuf); 267 271 if (strcmp(extractpath, szPathBuf)) { 268 memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1);269 if (*extractpath){270 MakeFullName(extractpath);271 if (IsFile(extractpath)) {272 ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,273 GetPString(IDS_WARNINGTEXT),274 GetPString(IDS_EXTPATHNOTVALIDTEXT),275 extractpath);276 if (ulResult == MBID_YES)277 *extractpath = 0;278 if (ulResult == MBID_CANCEL){279 WinDlgBox(HWND_DESKTOP,280 hwnd,281 CfgDlgProc,282 FM3ModHandle,283 CFG_FRAME,284 MPFROMLONG(IDM_ARCHIVERSETTINGS));285 break;286 }287 }288 }272 memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1); 273 if (*extractpath){ 274 MakeFullName(extractpath); 275 if (IsFile(extractpath)) { 276 ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP, 277 GetPString(IDS_WARNINGTEXT), 278 GetPString(IDS_EXTPATHNOTVALIDTEXT), 279 extractpath); 280 if (ulResult == MBID_YES) 281 *extractpath = 0; 282 if (ulResult == MBID_CANCEL){ 283 WinDlgBox(HWND_DESKTOP, 284 hwnd, 285 CfgDlgProc, 286 FM3ModHandle, 287 CFG_FRAME, 288 MPFROMLONG(IDM_ARCHIVERSETTINGS)); 289 break; 290 } 291 } 292 } 289 293 } 290 294 } … … 296 300 fCancelAction = FALSE; 297 301 WinDlgBox(HWND_DESKTOP, 298 hwnd,299 CfgDlgProc,300 FM3ModHandle,301 CFG_FRAME,302 MPFROMLONG(IDM_ARCHIVERSETTINGS));302 hwnd, 303 CfgDlgProc, 304 FM3ModHandle, 305 CFG_FRAME, 306 MPFROMLONG(IDM_ARCHIVERSETTINGS)); 303 307 } 304 308 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 311 315 case WM_INITDLG: 312 316 WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_SETTEXTLIMIT, 313 MPFROMSHORT(8), MPVOID);317 MPFROMSHORT(8), MPVOID); 314 318 WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_OVERRIDESETLIMITS, 315 MPFROMLONG(FILESTOGET_MAX), MPFROMLONG(FILESTOGET_MIN));319 MPFROMLONG(FILESTOGET_MAX), MPFROMLONG(FILESTOGET_MIN)); 316 320 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); 317 321 break; … … 352 356 WinCheckButton(hwnd, CFGS_REMOTEBUG, fRemoteBug); 353 357 WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_SETCURRENTVALUE, 354 MPFROMLONG(FilesToGet), MPVOID);358 MPFROMLONG(FilesToGet), MPVOID); 355 359 return 0; 356 360 … … 360 364 case CFGS_FORCELOWER: 361 365 { 362 BOOL temp;363 364 temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));365 if (temp) {366 switch (SHORT1FROMMP(mp1)) {367 case CFGS_FORCEUPPER:368 WinCheckButton(hwnd, CFGS_FORCELOWER, FALSE);369 break;370 case CFGS_FORCELOWER:371 WinCheckButton(hwnd, CFGS_FORCEUPPER, FALSE);372 break;373 }374 }366 BOOL temp; 367 368 temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1)); 369 if (temp) { 370 switch (SHORT1FROMMP(mp1)) { 371 case CFGS_FORCEUPPER: 372 WinCheckButton(hwnd, CFGS_FORCELOWER, FALSE); 373 break; 374 case CFGS_FORCELOWER: 375 WinCheckButton(hwnd, CFGS_FORCEUPPER, FALSE); 376 break; 377 } 378 } 375 379 } 376 380 break; … … 393 397 case IDM_HELP: 394 398 if (hwndHelp) 395 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,396 MPFROM2SHORT(HELP_CFGS, 0), MPFROMSHORT(HM_RESOURCEID));399 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 400 MPFROM2SHORT(HELP_CFGS, 0), MPFROMSHORT(HM_RESOURCEID)); 397 401 break; 398 402 } … … 402 406 fLoadLongnames = WinQueryButtonCheckstate(hwnd, CFGS_LOADLONGNAMES); 403 407 PrfWriteProfileData(fmprof, appname, "LoadLongname", &fLoadLongnames, 404 sizeof(BOOL));408 sizeof(BOOL)); 405 409 fLoadSubject = WinQueryButtonCheckstate(hwnd, CFGS_LOADSUBJECTS); 406 410 PrfWriteProfileData(fmprof, appname, "LoadSubject", &fLoadSubject, 407 sizeof(BOOL));411 sizeof(BOOL)); 408 412 fRemoteBug = WinQueryButtonCheckstate(hwnd, CFGS_REMOTEBUG); 409 413 PrfWriteProfileData(fmprof, appname, "RemoteBug", &fRemoteBug, 410 sizeof(BOOL));414 sizeof(BOOL)); 411 415 fNoRemovableScan = WinQueryButtonCheckstate(hwnd, CFGS_NOREMOVABLESCAN); 412 416 PrfWriteProfileData(fmprof, FM3Str, "NoRemovableScan", &fNoRemovableScan, 413 sizeof(BOOL));417 sizeof(BOOL)); 414 418 fNoIconsFiles = WinQueryButtonCheckstate(hwnd, CFGS_NOICONSFILES); 415 419 fNoIconsFiles = (fNoIconsFiles) ? FALSE : TRUE; 416 420 PrfWriteProfileData(fmprof, appname, "NoIconsFiles", 417 &fNoIconsFiles, sizeof(BOOL));421 &fNoIconsFiles, sizeof(BOOL)); 418 422 fNoIconsDirs = WinQueryButtonCheckstate(hwnd, CFGS_NOICONSDIRS); 419 423 fNoIconsDirs = (fNoIconsDirs) ? FALSE : TRUE; 420 424 PrfWriteProfileData(fmprof, appname, "NoIconsDirs", 421 &fNoIconsDirs, sizeof(BOOL));425 &fNoIconsDirs, sizeof(BOOL)); 422 426 fForceUpper = WinQueryButtonCheckstate(hwnd, CFGS_FORCEUPPER); 423 427 PrfWriteProfileData(fmprof, appname, "ForceUpper", 424 &fForceUpper, sizeof(BOOL));428 &fForceUpper, sizeof(BOOL)); 425 429 fForceLower = WinQueryButtonCheckstate(hwnd, CFGS_FORCELOWER); 426 430 PrfWriteProfileData(fmprof, appname, "ForceLower", 427 &fForceLower, sizeof(BOOL));431 &fForceLower, sizeof(BOOL)); 428 432 { 429 433 WinSendDlgItemMsg(hwnd, CFGS_FILESTOGET, SPBM_QUERYVALUE, 430 MPFROMP(&FilesToGet), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));434 MPFROMP(&FilesToGet), MPFROM2SHORT(0, SPBQ_DONOTUPDATE)); 431 435 if (FilesToGet < FILESTOGET_MIN) 432 FilesToGet = FILESTOGET_MIN;436 FilesToGet = FILESTOGET_MIN; 433 437 else if (FilesToGet > FILESTOGET_MAX) 434 FilesToGet = FILESTOGET_MAX;438 FilesToGet = FILESTOGET_MAX; 435 439 PrfWriteProfileData(fmprof, 436 appname, "FilesToGet", &FilesToGet, sizeof(ULONG));440 appname, "FilesToGet", &FilesToGet, sizeof(ULONG)); 437 441 } 438 442 break; … … 447 451 case WM_INITDLG: 448 452 WinSendDlgItemMsg(hwnd, CFGV_VIEWER, EM_SETTEXTLIMIT, 449 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);453 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 450 454 WinSendDlgItemMsg(hwnd, CFGV_EDITOR, EM_SETTEXTLIMIT, 451 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);455 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 452 456 WinSendDlgItemMsg(hwnd, CFGV_BINVIEW, EM_SETTEXTLIMIT, 453 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);457 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 454 458 WinSendDlgItemMsg(hwnd, CFGV_BINED, EM_SETTEXTLIMIT, 455 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);459 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 456 460 WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE); 457 461 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); … … 502 506 switch (SHORT2FROMMP(mp1)) { 503 507 case EN_KILLFOCUS: 504 WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE);505 break;508 WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE); 509 break; 506 510 case EN_SETFOCUS: 507 WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), TRUE);508 break;511 WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), TRUE); 512 break; 509 513 } 510 514 break; … … 527 531 case IDM_HELP: 528 532 if (hwndHelp) 529 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,530 MPFROM2SHORT(HELP_CFGV, 0), MPFROMSHORT(HM_RESOURCEID));533 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 534 MPFROM2SHORT(HELP_CFGV, 0), MPFROMSHORT(HM_RESOURCEID)); 531 535 break; 532 536 533 537 case CFGV_FIND: 534 538 { 535 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];536 USHORT id;537 HWND hwndFocus;538 539 strcpy(filename, "*.EXE");540 hwndFocus = WinQueryFocus(HWND_DESKTOP);541 if (hwndFocus) {542 id = WinQueryWindowUShort(hwndFocus, QWS_ID);543 switch (id) {544 case CFGV_BINVIEW:545 case CFGV_BINED:546 case CFGV_VIEWER:547 case CFGV_EDITOR:548 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {549 BldQuotedFileName(szfilename, filename);550 strcat(szfilename, " %a");551 WinSetDlgItemText(hwnd, id, szfilename);552 }553 break;554 default:555 Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);556 break;557 }558 }539 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9]; 540 USHORT id; 541 HWND hwndFocus; 542 543 strcpy(filename, "*.EXE"); 544 hwndFocus = WinQueryFocus(HWND_DESKTOP); 545 if (hwndFocus) { 546 id = WinQueryWindowUShort(hwndFocus, QWS_ID); 547 switch (id) { 548 case CFGV_BINVIEW: 549 case CFGV_BINED: 550 case CFGV_VIEWER: 551 case CFGV_EDITOR: 552 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) { 553 BldQuotedFileName(szfilename, filename); 554 strcat(szfilename, " %a"); 555 WinSetDlgItemText(hwnd, id, szfilename); 556 } 557 break; 558 default: 559 Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id); 560 break; 561 } 562 } 559 563 } 560 564 break; … … 578 582 szCLBuf[MaxComLineStrg - 1] = 0; 579 583 if (strcmp(szCLBuf, viewer)){ 580 NormalizeCmdLine(pszWorkBuf, szCLBuf);581 memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1);582 if (!strchr(viewer, '%') && strlen(viewer) > 3)583 strcat(viewer, " %a");584 NormalizeCmdLine(pszWorkBuf, szCLBuf); 585 memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1); 586 if (!strchr(viewer, '%') && strlen(viewer) > 3) 587 strcat(viewer, " %a"); 584 588 } 585 589 WinQueryDlgItemText(hwnd, CFGV_EDITOR, MaxComLineStrg, szCLBuf); 586 590 szCLBuf[MaxComLineStrg - 1] = 0; 587 591 if (strcmp(szCLBuf, editor)){ 588 NormalizeCmdLine(pszWorkBuf, szCLBuf);589 memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1);590 if (!strchr(editor, '%') && strlen(editor) > 3)591 strcat(editor, " %a");592 NormalizeCmdLine(pszWorkBuf, szCLBuf); 593 memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1); 594 if (!strchr(editor, '%') && strlen(editor) > 3) 595 strcat(editor, " %a"); 592 596 } 593 597 WinQueryDlgItemText(hwnd, CFGV_BINVIEW, MaxComLineStrg, szCLBuf); 594 598 szCLBuf[MaxComLineStrg - 1] = 0; 595 599 if (strcmp(szCLBuf, binview)){ 596 NormalizeCmdLine(pszWorkBuf, szCLBuf);597 memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1);598 if (!strchr(binview, '%') && strlen(binview) > 3)599 strcat(binview, " %a");600 NormalizeCmdLine(pszWorkBuf, szCLBuf); 601 memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1); 602 if (!strchr(binview, '%') && strlen(binview) > 3) 603 strcat(binview, " %a"); 600 604 } 601 605 WinQueryDlgItemText(hwnd, CFGV_BINED, MaxComLineStrg, szCLBuf); 602 606 szCLBuf[MaxComLineStrg - 1] = 0; 603 607 if (strcmp(szCLBuf, bined)){ 604 NormalizeCmdLine(pszWorkBuf, szCLBuf);605 memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1);606 if (!strchr(bined, '%') && strlen(bined) > 3)607 strcat(bined, " %a");608 NormalizeCmdLine(pszWorkBuf, szCLBuf); 609 memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1); 610 if (!strchr(bined, '%') && strlen(bined) > 3) 611 strcat(bined, " %a"); 608 612 } 609 613 free(pszWorkBuf); … … 615 619 fUseNewViewer = WinQueryButtonCheckstate(hwnd, CFGV_USENEWVIEWER); 616 620 PrfWriteProfileData(fmprof, appname, "UseNewViewer", &fUseNewViewer, 617 sizeof(BOOL));621 sizeof(BOOL)); 618 622 fGuessType = WinQueryButtonCheckstate(hwnd, CFGV_GUESSTYPE); 619 623 PrfWriteProfileData(fmprof, appname, "GuessType", &fGuessType, 620 sizeof(BOOL));624 sizeof(BOOL)); 621 625 fViewChild = WinQueryButtonCheckstate(hwnd, CFGV_VIEWCHILD); 622 626 PrfWriteProfileData(fmprof, appname, "ViewChild", &fViewChild, 623 sizeof(BOOL));627 sizeof(BOOL)); 624 628 fCheckMM = WinQueryButtonCheckstate(hwnd, CFGV_CHECKMM); 625 629 PrfWriteProfileData(fmprof, appname, "CheckMM", &fCheckMM, sizeof(BOOL)); … … 631 635 fCancelAction = FALSE; 632 636 WinDlgBox(HWND_DESKTOP, 633 hwnd,634 CfgDlgProc,635 FM3ModHandle,636 CFG_FRAME,637 MPFROMLONG(IDM_VIEWERSETTINGS));637 hwnd, 638 CfgDlgProc, 639 FM3ModHandle, 640 CFG_FRAME, 641 MPFROMLONG(IDM_VIEWERSETTINGS)); 638 642 } 639 643 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 645 649 case WM_INITDLG: 646 650 WinSendDlgItemMsg(hwnd, CFGH_RUNFTPWORKDIR, EM_SETTEXTLIMIT, 647 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);651 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 648 652 WinSendDlgItemMsg(hwnd, CFGH_RUNHTTPWORKDIR, EM_SETTEXTLIMIT, 649 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);653 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 650 654 WinSendDlgItemMsg(hwnd, CFGH_FTPRUN, EM_SETTEXTLIMIT, 651 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);655 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 652 656 WinSendDlgItemMsg(hwnd, CFGH_HTTPRUN, EM_SETTEXTLIMIT, 653 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);657 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 654 658 WinSendDlgItemMsg(hwnd, CFGH_MAILRUN, EM_SETTEXTLIMIT, 655 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);659 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 656 660 WinSendDlgItemMsg(hwnd, CFGH_RUNMAILWORKDIR, EM_SETTEXTLIMIT, 657 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);661 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 658 662 WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE); 659 663 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); … … 710 714 switch (SHORT2FROMMP(mp1)) { 711 715 case EN_KILLFOCUS: 712 WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE);713 break;716 WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), FALSE); 717 break; 714 718 case EN_SETFOCUS: 715 WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), TRUE);716 break;719 WinEnableWindow(WinWindowFromID(hwnd, CFGH_FIND), TRUE); 720 break; 717 721 } 718 722 break; … … 735 739 case IDM_HELP: 736 740 if (hwndHelp) 737 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,738 MPFROM2SHORT(HELP_CFGH, 0), MPFROMSHORT(HM_RESOURCEID));741 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 742 MPFROM2SHORT(HELP_CFGH, 0), MPFROMSHORT(HM_RESOURCEID)); 739 743 break; 740 744 741 745 case CFGH_FIND: 742 746 { 743 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];744 USHORT id;745 HWND hwndFocus;746 747 strcpy(filename, "*.EXE");748 hwndFocus = WinQueryFocus(HWND_DESKTOP);749 if (hwndFocus) {750 id = WinQueryWindowUShort(hwndFocus, QWS_ID);751 switch (id) {752 case CFGH_HTTPRUN:753 case CFGH_FTPRUN:754 case CFGH_MAILRUN:755 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {756 BldQuotedFileName(szfilename, filename);757 WinSetDlgItemText(hwnd, id, szfilename);758 }759 break;760 case CFGH_RUNFTPWORKDIR:761 strcpy(filename, ftprundir);762 if (WinDlgBox(HWND_DESKTOP, hwndNotebook,763 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,764 MPFROMP(filename)) && *filename)765 WinSetDlgItemText(hwnd, id, filename);766 break;767 case CFGH_RUNHTTPWORKDIR:768 strcpy(filename, httprundir);769 if (WinDlgBox(HWND_DESKTOP, hwndNotebook,770 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,771 MPFROMP(filename)) && *filename)772 WinSetDlgItemText(hwnd, id, filename);773 break;774 case CFGH_RUNMAILWORKDIR:775 strcpy(filename, mailrundir);776 if (WinDlgBox(HWND_DESKTOP, hwndNotebook,777 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME,778 MPFROMP(filename)) && *filename)779 WinSetDlgItemText(hwnd, id, filename);780 break;781 default:782 Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);783 break;784 }785 }747 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9]; 748 USHORT id; 749 HWND hwndFocus; 750 751 strcpy(filename, "*.EXE"); 752 hwndFocus = WinQueryFocus(HWND_DESKTOP); 753 if (hwndFocus) { 754 id = WinQueryWindowUShort(hwndFocus, QWS_ID); 755 switch (id) { 756 case CFGH_HTTPRUN: 757 case CFGH_FTPRUN: 758 case CFGH_MAILRUN: 759 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) { 760 BldQuotedFileName(szfilename, filename); 761 WinSetDlgItemText(hwnd, id, szfilename); 762 } 763 break; 764 case CFGH_RUNFTPWORKDIR: 765 strcpy(filename, ftprundir); 766 if (WinDlgBox(HWND_DESKTOP, hwndNotebook, 767 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME, 768 MPFROMP(filename)) && *filename) 769 WinSetDlgItemText(hwnd, id, filename); 770 break; 771 case CFGH_RUNHTTPWORKDIR: 772 strcpy(filename, httprundir); 773 if (WinDlgBox(HWND_DESKTOP, hwndNotebook, 774 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME, 775 MPFROMP(filename)) && *filename) 776 WinSetDlgItemText(hwnd, id, filename); 777 break; 778 case CFGH_RUNMAILWORKDIR: 779 strcpy(filename, mailrundir); 780 if (WinDlgBox(HWND_DESKTOP, hwndNotebook, 781 WalkExtractDlgProc, FM3ModHandle, WALK_FRAME, 782 MPFROMP(filename)) && *filename) 783 WinSetDlgItemText(hwnd, id, filename); 784 break; 785 default: 786 Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id); 787 break; 788 } 789 } 786 790 } 787 791 break; … … 818 822 szCLBuf[MaxComLineStrg - 1] = 0; 819 823 if (strcmp(szCLBuf, ftprun)){ 820 NormalizeCmdLine(pszWorkBuf, szCLBuf);821 memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);824 NormalizeCmdLine(pszWorkBuf, szCLBuf); 825 memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1); 822 826 } 823 827 WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MaxComLineStrg, szCLBuf); 824 828 szCLBuf[MaxComLineStrg - 1] = 0; 825 829 if (strcmp(szCLBuf, httprun)){ 826 NormalizeCmdLine(pszWorkBuf, szCLBuf);827 memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);830 NormalizeCmdLine(pszWorkBuf, szCLBuf); 831 memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1); 828 832 } 829 833 WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MaxComLineStrg, szCLBuf); 830 834 szCLBuf[MaxComLineStrg - 1] = 0; 831 835 if (strcmp(szCLBuf, mailrun)){ 832 NormalizeCmdLine(pszWorkBuf, szCLBuf);833 memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1);836 NormalizeCmdLine(pszWorkBuf, szCLBuf); 837 memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1); 834 838 } 835 839 free(pszWorkBuf); … … 843 847 fHttpRunWPSDefault = WinQueryButtonCheckstate(hwnd, CFGH_HTTPRUNWPSDEFAULT); 844 848 PrfWriteProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, 845 sizeof(BOOL));849 sizeof(BOOL)); 846 850 fFtpRunWPSDefault = WinQueryButtonCheckstate(hwnd, CFGH_FTPRUNWPSDEFAULT); 847 851 PrfWriteProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, 848 sizeof(BOOL));852 sizeof(BOOL)); 849 853 fLibPathStrictHttpRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTHTTPRUN); 850 854 PrfWriteProfileData(fmprof, appname, "LibPathStrictHttpRun", 851 &fLibPathStrictHttpRun, sizeof(BOOL));855 &fLibPathStrictHttpRun, sizeof(BOOL)); 852 856 fLibPathStrictFtpRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTFTPRUN); 853 857 PrfWriteProfileData(fmprof, appname, "LibPathStrictFtpRun", 854 &fLibPathStrictFtpRun, sizeof(BOOL));858 &fLibPathStrictFtpRun, sizeof(BOOL)); 855 859 fLibPathStrictMailRun = WinQueryButtonCheckstate(hwnd, CFGH_LIBPATHSTRICTMAILRUN); 856 860 PrfWriteProfileData(fmprof, appname, "LibPathStrictMailRun", 857 &fLibPathStrictMailRun, sizeof(BOOL));861 &fLibPathStrictMailRun, sizeof(BOOL)); 858 862 fNoMailtoMailRun = WinQueryButtonCheckstate(hwnd, CFGH_NOMAILTOMAILRUN); 859 863 PrfWriteProfileData(fmprof, appname, "NoMailtoMailRun", 860 &fNoMailtoMailRun, sizeof(BOOL));864 &fNoMailtoMailRun, sizeof(BOOL)); 861 865 break; 862 866 } … … 865 869 fCancelAction = FALSE; 866 870 WinDlgBox(HWND_DESKTOP, 867 hwnd,868 CfgDlgProc,869 FM3ModHandle,870 CFG_FRAME,871 MPFROMLONG(IDM_VIEWERSETTINGS));871 hwnd, 872 CfgDlgProc, 873 FM3ModHandle, 874 CFG_FRAME, 875 MPFROMLONG(IDM_VIEWERSETTINGS)); 872 876 } 873 877 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 927 931 case IDM_HELP: 928 932 if (hwndHelp) 929 WinSendMsg(hwndHelp,930 HM_DISPLAY_HELP,931 MPFROM2SHORT(HELP_CFGB, 0), MPFROMSHORT(HM_RESOURCEID));933 WinSendMsg(hwndHelp, 934 HM_DISPLAY_HELP, 935 MPFROM2SHORT(HELP_CFGB, 0), MPFROMSHORT(HM_RESOURCEID)); 932 936 break; 933 937 } … … 937 941 fToolbarHelp = WinQueryButtonCheckstate(hwnd, CFGB_TOOLBARHELP); 938 942 PrfWriteProfileData(fmprof, 939 FM3Str, "ToolbarHelp", &fToolbarHelp, sizeof(BOOL));943 FM3Str, "ToolbarHelp", &fToolbarHelp, sizeof(BOOL)); 940 944 fDrivebarHelp = WinQueryButtonCheckstate(hwnd, CFGB_DRIVEBARHELP); 941 945 PrfWriteProfileData(fmprof, 942 FM3Str, "DrivebarHelp", &fDrivebarHelp, sizeof(BOOL));946 FM3Str, "DrivebarHelp", &fDrivebarHelp, sizeof(BOOL)); 943 947 fOtherHelp = WinQueryButtonCheckstate(hwnd, CFGB_OTHERHELP); 944 948 PrfWriteProfileData(fmprof, 945 FM3Str, "OtherHelp", &fOtherHelp, sizeof(BOOL));949 FM3Str, "OtherHelp", &fOtherHelp, sizeof(BOOL)); 946 950 break; 947 951 } … … 956 960 case WM_INITDLG: 957 961 WinSendDlgItemMsg(hwnd, 958 CFG5_FILTER,959 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);962 CFG5_FILTER, 963 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 960 964 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); 961 965 break; … … 996 1000 997 1001 if (!PrfQueryProfileData(fmprof, 998 appname,999 "TreeflWindowAttr",1000 (PVOID) & flWindowAttr, &ulSize))1001 flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI | CV_FLOW);1002 appname, 1003 "TreeflWindowAttr", 1004 (PVOID) & flWindowAttr, &ulSize)) 1005 flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI | CV_FLOW); 1002 1006 WinCheckButton(hwnd, CFG5_ICON, ((flWindowAttr & CV_ICON) != FALSE)); 1003 1007 WinCheckButton(hwnd, CFG5_MINIICONS, 1004 ((flWindowAttr & CV_MINI) != FALSE));1008 ((flWindowAttr & CV_MINI) != FALSE)); 1005 1009 memset(&mask, 0, sizeof(mask)); 1006 1010 mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN | 1007 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;1011 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY; 1008 1012 mask.fIsTree = TRUE; 1009 1013 ulSize = sizeof(MASK); 1010 1014 if (PrfQueryProfileData(fmprof, appname, "TreeFilter", &mask, &ulSize)) { 1011 SetMask(NULL, &mask);1015 SetMask(NULL, &mask); 1012 1016 } 1013 1017 if (!mask.attrFile) 1014 mask.attrFile = (FILE_READONLY | FILE_NORMAL |1015 FILE_ARCHIVED | FILE_DIRECTORY |1016 FILE_HIDDEN | FILE_SYSTEM);1018 mask.attrFile = (FILE_READONLY | FILE_NORMAL | 1019 FILE_ARCHIVED | FILE_DIRECTORY | 1020 FILE_HIDDEN | FILE_SYSTEM); 1017 1021 strcpy(mask.prompt, GetPString(IDS_TREEFILTERTITLETEXT)); 1018 1022 WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask); … … 1027 1031 WinCheckButton(hwnd, CFG6_SORTREVERSE, FALSE); 1028 1032 if (TreesortFlags & SORT_FIRSTEXTENSION) 1029 WinCheckButton(hwnd, CFG6_SORTFIRST, TRUE);1033 WinCheckButton(hwnd, CFG6_SORTFIRST, TRUE); 1030 1034 else if (TreesortFlags & SORT_LASTEXTENSION) 1031 WinCheckButton(hwnd, CFG6_SORTLAST, TRUE);1035 WinCheckButton(hwnd, CFG6_SORTLAST, TRUE); 1032 1036 else if (TreesortFlags & SORT_SIZE) 1033 WinCheckButton(hwnd, CFG6_SORTSIZE, TRUE);1037 WinCheckButton(hwnd, CFG6_SORTSIZE, TRUE); 1034 1038 else if (TreesortFlags & SORT_EASIZE) 1035 WinCheckButton(hwnd, CFG6_SORTEASIZE, TRUE);1039 WinCheckButton(hwnd, CFG6_SORTEASIZE, TRUE); 1036 1040 else if (TreesortFlags & SORT_LWDATE) 1037 WinCheckButton(hwnd, CFG6_SORTLWDATE, TRUE);1041 WinCheckButton(hwnd, CFG6_SORTLWDATE, TRUE); 1038 1042 else if (TreesortFlags & SORT_LADATE) 1039 WinCheckButton(hwnd, CFG6_SORTLADATE, TRUE);1043 WinCheckButton(hwnd, CFG6_SORTLADATE, TRUE); 1040 1044 else if (TreesortFlags & SORT_CRDATE) 1041 WinCheckButton(hwnd, CFG6_SORTCRDATE, TRUE);1045 WinCheckButton(hwnd, CFG6_SORTCRDATE, TRUE); 1042 1046 else if (TreesortFlags & SORT_FILENAME) 1043 WinCheckButton(hwnd, CFG6_SORTFILENAME, TRUE);1047 WinCheckButton(hwnd, CFG6_SORTFILENAME, TRUE); 1044 1048 else 1045 WinCheckButton(hwnd, CFG6_SORTNAME, TRUE);1049 WinCheckButton(hwnd, CFG6_SORTNAME, TRUE); 1046 1050 if (TreesortFlags & SORT_REVERSE) 1047 WinCheckButton(hwnd, CFG6_SORTREVERSE, TRUE);1051 WinCheckButton(hwnd, CFG6_SORTREVERSE, TRUE); 1048 1052 } 1049 1053 return 0; … … 1051 1055 case UM_SETUP5: 1052 1056 if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc, 1053 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {1057 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) { 1054 1058 SetMask(NULL, &mask); 1055 1059 WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask); … … 1062 1066 switch (SHORT2FROMMP(mp1)) { 1063 1067 case EN_SETFOCUS: 1064 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);1065 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);1066 break;1068 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 1069 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); 1070 break; 1067 1071 } 1068 1072 break; … … 1085 1089 case IDM_HELP: 1086 1090 if (hwndHelp) 1087 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1088 MPFROM2SHORT(HELP_TREEVIEW, 0),1089 MPFROMSHORT(HM_RESOURCEID));1091 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1092 MPFROM2SHORT(HELP_TREEVIEW, 0), 1093 MPFROMSHORT(HM_RESOURCEID)); 1090 1094 break; 1091 1095 } … … 1097 1101 1098 1102 if (WinQueryButtonCheckstate(hwnd, CFG5_ICON)) 1099 flWindowAttr |= CV_ICON;1103 flWindowAttr |= CV_ICON; 1100 1104 else 1101 flWindowAttr |= CV_TEXT;1105 flWindowAttr |= CV_TEXT; 1102 1106 if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS)) 1103 flWindowAttr |= CV_MINI;1107 flWindowAttr |= CV_MINI; 1104 1108 flWindowAttr |= (CV_TREE | CV_FLOW | CA_TREELINE); 1105 1109 PrfWriteProfileData(fmprof, 1106 appname,1107 "TreeflWindowAttr", &flWindowAttr, sizeof(ULONG));1110 appname, 1111 "TreeflWindowAttr", &flWindowAttr, sizeof(ULONG)); 1108 1112 if (hwndTree) { 1109 1113 1110 CNRINFO cnri;1111 1112 memset(&cnri, 0, sizeof(cnri));1113 cnri.cb = sizeof(cnri);1114 WinSendMsg(WinWindowFromID1115 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),1116 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));1117 cnri.flWindowAttr = flWindowAttr;1118 WinSendMsg(WinWindowFromID1119 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),1120 CM_SETCNRINFO, MPFROMP(&cnri),1121 MPFROMLONG(CMA_FLWINDOWATTR));1114 CNRINFO cnri; 1115 1116 memset(&cnri, 0, sizeof(cnri)); 1117 cnri.cb = sizeof(cnri); 1118 WinSendMsg(WinWindowFromID 1119 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 1120 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 1121 cnri.flWindowAttr = flWindowAttr; 1122 WinSendMsg(WinWindowFromID 1123 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 1124 CM_SETCNRINFO, MPFROMP(&cnri), 1125 MPFROMLONG(CMA_FLWINDOWATTR)); 1122 1126 } 1123 1127 } … … 1146 1150 TreesortFlags |= SORT_REVERSE; 1147 1151 PrfWriteProfileData(fmprof, appname, "TreeSort", &TreesortFlags, 1148 sizeof(INT));1152 sizeof(INT)); 1149 1153 if (hwndTree) 1150 1154 PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_RESORT, 0), MPVOID); … … 1156 1160 1157 1161 dcd = WinQueryWindowPtr(WinWindowFromID(WinWindowFromID(hwndTree, 1158 FID_CLIENT),1159 TREE_CNR), QWL_USER);1162 FID_CLIENT), 1163 TREE_CNR), QWL_USER); 1160 1164 if (dcd && dcd->size == sizeof(DIRCNRDATA)) { 1161 dcd->mask = mask;1162 PostMsg(hwndTree, UM_FILTER, MPVOID, MPVOID);1165 dcd->mask = mask; 1166 PostMsg(hwndTree, UM_FILTER, MPVOID, MPVOID); 1163 1167 } 1164 1168 } … … 1176 1180 case WM_INITDLG: 1177 1181 WinSendDlgItemMsg(hwnd, CFGT_ENVVARLIST, EM_SETTEXTLIMIT, 1178 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);1182 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 1179 1183 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); 1180 1184 break; … … 1233 1237 case IDM_HELP: 1234 1238 if (hwndHelp) 1235 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1236 MPFROM2SHORT(HELP_CFGT, 0), MPFROMSHORT(HM_RESOURCEID));1239 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1240 MPFROM2SHORT(HELP_CFGT, 0), MPFROMSHORT(HM_RESOURCEID)); 1237 1241 break; 1238 1242 } … … 1242 1246 fVTreeOpensWPS = WinQueryButtonCheckstate(hwnd, CFGT_VTREEOPENSWPS); 1243 1247 PrfWriteProfileData(fmprof, FM3Str, "VTreeOpensWPS", &fVTreeOpensWPS, 1244 sizeof(BOOL));1248 sizeof(BOOL)); 1245 1249 fCollapseFirst = WinQueryButtonCheckstate(hwnd, CFGT_COLLAPSEFIRST); 1246 1250 PrfWriteProfileData(fmprof, appname, "CollapseFirst", &fCollapseFirst, 1247 sizeof(BOOL));1251 sizeof(BOOL)); 1248 1252 fSwitchTreeOnFocus = WinQueryButtonCheckstate(hwnd, 1249 CFGT_SWITCHTREEONFOCUS);1253 CFGT_SWITCHTREEONFOCUS); 1250 1254 PrfWriteProfileData(fmprof, appname, "SwitchTreeOnFocus", 1251 &fSwitchTreeOnFocus, sizeof(BOOL));1255 &fSwitchTreeOnFocus, sizeof(BOOL)); 1252 1256 fSwitchTreeExpand = WinQueryButtonCheckstate(hwnd, CFGT_SWITCHTREEEXPAND); 1253 1257 PrfWriteProfileData(fmprof, appname, "SwitchTreeExpand", 1254 &fSwitchTreeExpand, sizeof(BOOL));1258 &fSwitchTreeExpand, sizeof(BOOL)); 1255 1259 fSwitchTree = WinQueryButtonCheckstate(hwnd, CFGT_SWITCHTREE); 1256 1260 PrfWriteProfileData(fmprof, appname, "SwitchTree", &fSwitchTree, 1257 sizeof(BOOL));1261 sizeof(BOOL)); 1258 1262 fFollowTree = WinQueryButtonCheckstate(hwnd, CFGT_FOLLOWTREE); 1259 1263 PrfWriteProfileData(fmprof, appname, "FollowTree", &fFollowTree, 1260 sizeof(BOOL));1264 sizeof(BOOL)); 1261 1265 fTopDir = WinQueryButtonCheckstate(hwnd, CFGT_TOPDIR); 1262 1266 PrfWriteProfileData(fmprof, appname, "TopDir", (PVOID) & fTopDir, 1263 sizeof(BOOL));1267 sizeof(BOOL)); 1264 1268 fDCOpens = WinQueryButtonCheckstate(hwnd, CFGT_DCOPENS); 1265 1269 PrfWriteProfileData(fmprof, FM3Str, "DoubleClickOpens", &fDCOpens, 1266 sizeof(BOOL));1270 sizeof(BOOL)); 1267 1271 fShowEnvChanged = (fShowEnv != WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV)); 1268 1272 fShowEnv = WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV); … … 1282 1286 if (hwndTree && (fShowEnvChanged || (fShowEnv && fTreeEnvVarListChanged))) 1283 1287 { 1284 PCNRITEM pci = WinSendMsg(WinWindowFromID1285 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), CM_QUERYRECORDEMPHASIS,1286 MPFROMLONG(CMA_FIRST),1287 MPFROMSHORT(CRA_SELECTED));1288 PCNRITEM pci = WinSendMsg(WinWindowFromID 1289 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), CM_QUERYRECORDEMPHASIS, 1290 MPFROMLONG(CMA_FIRST), 1291 MPFROMSHORT(CRA_SELECTED)); 1288 1292 PostMsg(WinWindowFromID 1289 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND,1290 MPFROM2SHORT(IDM_RESCAN, 0), MPVOID);1291 pszTemp = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);1292 if (pszTemp) {1293 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND, 1294 MPFROM2SHORT(IDM_RESCAN, 0), MPVOID); 1295 pszTemp = xstrdup(pci->pszFileName, pszSrcFile, __LINE__); 1296 if (pszTemp) { 1293 1297 if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszTemp), MPVOID)) 1294 1298 free(pszTemp); 1295 /* pszTemp is freed in the UM_SHOWME code */1296 }1299 /* pszTemp is freed in the UM_SHOWME code */ 1300 } 1297 1301 } 1298 1302 } … … 1307 1311 case WM_INITDLG: 1308 1312 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETTEXTLIMIT, 1309 MPFROMSHORT(8), MPVOID);1313 MPFROMSHORT(8), MPVOID); 1310 1314 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_OVERRIDESETLIMITS, 1311 MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN));1315 MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN)); 1312 1316 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); 1313 1317 break; … … 1358 1362 WinCheckButton(hwnd, CFGG_TRASHCAN, fTrashCan); 1359 1363 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETCURRENTVALUE, 1360 MPFROMLONG(MaxComLineStrg), MPVOID);1364 MPFROMLONG(MaxComLineStrg), MPVOID); 1361 1365 return 0; 1362 1366 … … 1375 1379 switch (SHORT2FROMMP(mp1)) { 1376 1380 case EN_SETFOCUS: 1377 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);1378 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);1379 break;1381 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 1382 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); 1383 break; 1380 1384 } 1381 1385 break; … … 1398 1402 case IDM_HELP: 1399 1403 if (hwndHelp) 1400 WinSendMsg(hwndHelp,1401 HM_DISPLAY_HELP,1402 MPFROM2SHORT(HELP_CFGG, 0), MPFROMSHORT(HM_RESOURCEID));1404 WinSendMsg(hwndHelp, 1405 HM_DISPLAY_HELP, 1406 MPFROM2SHORT(HELP_CFGG, 0), MPFROMSHORT(HM_RESOURCEID)); 1403 1407 break; 1404 1408 } … … 1414 1418 PrfWriteProfileData(fmprof, FM3Str, "NoDead", &fNoDead, sizeof(BOOL)); 1415 1419 PrfWriteProfileData(fmprof, 1416 FM3Str, "NoFinger", &fNoFinger, sizeof(BOOL));1420 FM3Str, "NoFinger", &fNoFinger, sizeof(BOOL)); 1417 1421 WinDestroyPointer(hptrFinger); 1418 1422 if (!fNoDead) 1419 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON);1423 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER_ICON); 1420 1424 else 1421 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON);1425 hptrFinger = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, FINGER2_ICON); 1422 1426 } 1423 1427 fLinkSetsIcon = WinQueryButtonCheckstate(hwnd, CFGG_LINKSETSICON); 1424 1428 PrfWriteProfileData(fmprof, 1425 appname,1426 "LinkSetsIcon", &fLinkSetsIcon, sizeof(BOOL));1429 appname, 1430 "LinkSetsIcon", &fLinkSetsIcon, sizeof(BOOL)); 1427 1431 fCustomFileDlg = WinQueryButtonCheckstate(hwnd, CFGG_CUSTOMFILEDLG); 1428 1432 PrfWriteProfileData(fmprof, 1429 FM3Str,1430 "CustomFileDlg", &fCustomFileDlg, sizeof(BOOL));1433 FM3Str, 1434 "CustomFileDlg", &fCustomFileDlg, sizeof(BOOL)); 1431 1435 fDullMin = WinQueryButtonCheckstate(hwnd, CFGG_BORING); 1432 1436 PrfWriteProfileData(fmprof, 1433 FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL));1437 FM3Str, "DullDatabar", &fDullMin, sizeof(BOOL)); 1434 1438 fConfirmDelete = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMDELETE); 1435 1439 PrfWriteProfileData(fmprof, 1436 appname,1437 "ConfirmDelete", &fConfirmDelete, sizeof(BOOL));1440 appname, 1441 "ConfirmDelete", &fConfirmDelete, sizeof(BOOL)); 1438 1442 fDontMoveMouse = WinQueryButtonCheckstate(hwnd, CFGG_DONTMOVEMOUSE); 1439 1443 PrfWriteProfileData(fmprof, 1440 appname,1441 "DontMoveMouse", &fDontMoveMouse, sizeof(BOOL));1444 appname, 1445 "DontMoveMouse", &fDontMoveMouse, sizeof(BOOL)); 1442 1446 fCopyDefault = WinQueryButtonCheckstate(hwnd, CFGG_DEFAULTCOPY); 1443 1447 PrfWriteProfileData(fmprof, appname, "DefaultCopy", 1444 &fCopyDefault, sizeof(BOOL));1448 &fCopyDefault, sizeof(BOOL)); 1445 1449 fRealIdle = WinQueryButtonCheckstate(hwnd, CFGG_IDLECOPY); 1446 1450 PrfWriteProfileData(fmprof, appname, "IdleCopy", 1447 &fRealIdle, sizeof(BOOL));1451 &fRealIdle, sizeof(BOOL)); 1448 1452 fDragndropDlg = WinQueryButtonCheckstate(hwnd, CFGG_DNDDLG); 1449 1453 PrfWriteProfileData(fmprof, appname, "Drag&DropDlg", 1450 &fDragndropDlg, sizeof(BOOL));1454 &fDragndropDlg, sizeof(BOOL)); 1451 1455 fVerify = WinQueryButtonCheckstate(hwnd, CFGG_VERIFYWRITES); 1452 1456 PrfWriteProfileData(fmprof, appname, "VerifyWrites", 1453 &fVerify, sizeof(BOOL));1457 &fVerify, sizeof(BOOL)); 1454 1458 DosSetVerify(fVerify); 1455 1459 fDefaultDeletePerm = WinQueryButtonCheckstate(hwnd, 1456 CFGG_DEFAULTDELETEPERM);1460 CFGG_DEFAULTDELETEPERM); 1457 1461 PrfWriteProfileData(fmprof, appname, "DefaultDeletePerm", 1458 &fDefaultDeletePerm, sizeof(BOOL));1462 &fDefaultDeletePerm, sizeof(BOOL)); 1459 1463 fFM2Deletes = WinQueryButtonCheckstate(hwnd, CFGG_FM2DELETES); 1460 1464 PrfWriteProfileData(fmprof, FM3Str, "FM2Deletes", … … 1462 1466 fTrashCan = WinQueryButtonCheckstate(hwnd, CFGG_TRASHCAN); 1463 1467 PrfWriteProfileData(fmprof, FM3Str, "TrashCan", 1464 &fTrashCan, sizeof(BOOL));1468 &fTrashCan, sizeof(BOOL)); 1465 1469 fConfirmTarget = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMTARGET); 1466 1470 PrfWriteProfileData(fmprof, appname, "ConfirmTarget", … … 1468 1472 { 1469 1473 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_QUERYVALUE, 1470 MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));1474 MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE)); 1471 1475 if (MaxComLineStrg < CMDLNLNGTH_MIN) 1472 MaxComLineStrg = CMDLNLNGTH_MIN;1476 MaxComLineStrg = CMDLNLNGTH_MIN; 1473 1477 else if (MaxComLineStrg > CMDLNLNGTH_MAX) 1474 MaxComLineStrg = CMDLNLNGTH_MAX;1478 MaxComLineStrg = CMDLNLNGTH_MAX; 1475 1479 PrfWriteProfileData(fmprof, 1476 appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG));1480 appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG)); 1477 1481 } 1478 1482 break; … … 1486 1490 case WM_INITDLG: 1487 1491 WinSendDlgItemMsg(hwnd, CFGC_COMPARE, EM_SETTEXTLIMIT, 1488 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);1492 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 1489 1493 WinSendDlgItemMsg(hwnd, CFGC_DIRCOMPARE, EM_SETTEXTLIMIT, 1490 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID);1494 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 1491 1495 WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE); 1492 1496 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); … … 1529 1533 switch (SHORT2FROMMP(mp1)) { 1530 1534 case EN_KILLFOCUS: 1531 WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE);1532 break;1535 WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE); 1536 break; 1533 1537 case EN_SETFOCUS: 1534 WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), TRUE);1535 break;1538 WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), TRUE); 1539 break; 1536 1540 } 1537 1541 break; … … 1554 1558 case IDM_HELP: 1555 1559 if (hwndHelp) 1556 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1557 MPFROM2SHORT(HELP_CFGC, 0), MPFROMSHORT(HM_RESOURCEID));1560 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1561 MPFROM2SHORT(HELP_CFGC, 0), MPFROMSHORT(HM_RESOURCEID)); 1558 1562 break; 1559 1563 1560 1564 case CFGC_FIND: 1561 1565 { 1562 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9];1563 USHORT id;1564 HWND hwndFocus;1565 1566 strcpy(filename, "*.EXE");1567 hwndFocus = WinQueryFocus(HWND_DESKTOP);1568 if (hwndFocus) {1569 id = WinQueryWindowUShort(hwndFocus, QWS_ID);1570 switch (id) {1571 case CFGC_COMPARE:1572 case CFGC_DIRCOMPARE:1573 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) {1574 BldQuotedFileName(szfilename, filename);1575 strcat(szfilename, " %a");1576 WinSetDlgItemText(hwnd, id, szfilename);1577 }1578 break;1579 default:1580 Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id);1581 break;1582 }1583 }1566 CHAR filename[CCHMAXPATH + 9], szfilename[CCHMAXPATH + 9]; 1567 USHORT id; 1568 HWND hwndFocus; 1569 1570 strcpy(filename, "*.EXE"); 1571 hwndFocus = WinQueryFocus(HWND_DESKTOP); 1572 if (hwndFocus) { 1573 id = WinQueryWindowUShort(hwndFocus, QWS_ID); 1574 switch (id) { 1575 case CFGC_COMPARE: 1576 case CFGC_DIRCOMPARE: 1577 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) { 1578 BldQuotedFileName(szfilename, filename); 1579 strcat(szfilename, " %a"); 1580 WinSetDlgItemText(hwnd, id, szfilename); 1581 } 1582 break; 1583 default: 1584 Runtime_Error(pszSrcFile, __LINE__, "bad case %d", id); 1585 break; 1586 } 1587 } 1584 1588 } 1585 1589 break; … … 1601 1605 } 1602 1606 WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MaxComLineStrg, szCLBuf); 1603 szCLBuf[MaxComLineStrg - 1] = 0;1604 if (strcmp(szCLBuf, dircompare)){1605 NormalizeCmdLine(pszWorkBuf, szCLBuf);1606 memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1);1607 if (!strchr(dircompare, '%') && strlen(dircompare) > 3)1608 strcat(dircompare, " %a");1609 }1607 szCLBuf[MaxComLineStrg - 1] = 0; 1608 if (strcmp(szCLBuf, dircompare)){ 1609 NormalizeCmdLine(pszWorkBuf, szCLBuf); 1610 memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1); 1611 if (!strchr(dircompare, '%') && strlen(dircompare) > 3) 1612 strcat(dircompare, " %a"); 1613 } 1610 1614 PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare); 1611 1615 WinQueryDlgItemText(hwnd, CFGC_COMPARE, MaxComLineStrg, szCLBuf); … … 1626 1630 fCancelAction = FALSE; 1627 1631 WinDlgBox(HWND_DESKTOP, 1628 hwnd,1629 CfgDlgProc,1630 FM3ModHandle,1631 CFG_FRAME,1632 MPFROMLONG(IDM_COMPARESETTINGS));1632 hwnd, 1633 CfgDlgProc, 1634 FM3ModHandle, 1635 CFG_FRAME, 1636 MPFROMLONG(IDM_COMPARESETTINGS)); 1633 1637 } 1634 1638 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 1651 1655 WinCheckButton(hwnd, CFGD_NOSEARCH, fNoSearch); 1652 1656 WinCheckButton(hwnd, CFGD_EXTENDEDSEL, 1653 ((ulCnrType & CCS_EXTENDSEL) != 0));1657 ((ulCnrType & CCS_EXTENDSEL) != 0)); 1654 1658 WinCheckButton(hwnd, CFGD_MULTIPLESEL, 1655 ((ulCnrType & CCS_MULTIPLESEL) != 0));1659 ((ulCnrType & CCS_MULTIPLESEL) != 0)); 1656 1660 WinCheckButton(hwnd, CFGD_LEAVETREE, fLeaveTree); 1657 1661 WinCheckButton(hwnd, CFGD_NOFOLDMENU, fNoFoldMenu); … … 1698 1702 case IDM_HELP: 1699 1703 if (hwndHelp) 1700 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1701 MPFROM2SHORT(HELP_CFGD, 0), MPFROMSHORT(HM_RESOURCEID));1704 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1705 MPFROM2SHORT(HELP_CFGD, 0), MPFROMSHORT(HM_RESOURCEID)); 1702 1706 break; 1703 1707 } … … 1711 1715 ulCnrType |= CCS_MULTIPLESEL; 1712 1716 PrfWriteProfileData(fmprof, appname, "ContainerType", 1713 (PVOID) & ulCnrType, sizeof(BOOL));1717 (PVOID) & ulCnrType, sizeof(BOOL)); 1714 1718 fMinOnOpen = WinQueryButtonCheckstate(hwnd, CFGD_MINONOPEN); 1715 1719 PrfWriteProfileData(fmprof, FM3Str, "MinDirOnOpen", &fMinOnOpen, 1716 sizeof(BOOL));1720 sizeof(BOOL)); 1717 1721 fLeaveTree = WinQueryButtonCheckstate(hwnd, CFGD_LEAVETREE); 1718 1722 PrfWriteProfileData(fmprof, appname, "LeaveTree", &fLeaveTree, 1719 sizeof(BOOL));1723 sizeof(BOOL)); 1720 1724 fNoFoldMenu = WinQueryButtonCheckstate(hwnd, CFGD_NOFOLDMENU); 1721 1725 PrfWriteProfileData(fmprof, appname, "NoFoldMenu", &fNoFoldMenu, 1722 sizeof(BOOL));1726 sizeof(BOOL)); 1723 1727 fSelectedAlways = WinQueryButtonCheckstate(hwnd, CFGD_SELECTEDALWAYS); 1724 1728 PrfWriteProfileData(fmprof, appname, "SelectedAlways", &fSelectedAlways, 1725 sizeof(BOOL));1729 sizeof(BOOL)); 1726 1730 fNoSearch = WinQueryButtonCheckstate(hwnd, CFGD_NOSEARCH); 1727 1731 PrfWriteProfileData(fmprof, appname, "NoSearch", &fNoSearch, 1728 sizeof(BOOL));1732 sizeof(BOOL)); 1729 1733 fLookInDir = WinQueryButtonCheckstate(hwnd, CFGD_LOOKINDIR); 1730 1734 PrfWriteProfileData(fmprof, FM3Str, "LookInDir", (PVOID) & fLookInDir, 1731 sizeof(BOOL));1735 sizeof(BOOL)); 1732 1736 fUnHilite = WinQueryButtonCheckstate(hwnd, CFGD_UNHILITE); 1733 1737 PrfWriteProfileData(fmprof, appname, "UnHilite", 1734 &fUnHilite, sizeof(BOOL));1738 &fUnHilite, sizeof(BOOL)); 1735 1739 { 1736 1740 BOOL fOldSyncUpdates = WinQueryButtonCheckstate(hwnd, CFGD_SYNCUPDATES); 1737 1741 1738 1742 if (fOldSyncUpdates != fSyncUpdates) { 1739 fSyncUpdates = fOldSyncUpdates;1740 if (hwndMain && !strcmp(realappname, FM3Str)) {1741 // Save state and restore to refresh windows with new settings1742 if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {1743 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));1744 // PostMsg(hwndMain, UM_RESTORE, MPVOID, MPVOID);1745 PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);1746 }1747 }1743 fSyncUpdates = fOldSyncUpdates; 1744 if (hwndMain && !strcmp(realappname, FM3Str)) { 1745 // Save state and restore to refresh windows with new settings 1746 if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) { 1747 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2)); 1748 // PostMsg(hwndMain, UM_RESTORE, MPVOID, MPVOID); 1749 PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID); 1750 } 1751 } 1748 1752 } 1749 1753 } 1750 1754 PrfWriteProfileData(fmprof, appname, "SyncUpdates", 1751 &fSyncUpdates, sizeof(BOOL));1755 &fSyncUpdates, sizeof(BOOL)); 1752 1756 if (!(ulCnrType & (CCS_EXTENDSEL | CCS_MULTIPLESEL))) 1753 1757 saymsg(MB_ENTER | MB_ICONEXCLAMATION, 1754 HWND_DESKTOP,1755 GetPString(IDS_WARNINGTEXT),1756 GetPString(IDS_SELECTTYPEERRORTEXT));1757 break; // WM_CLOSE1758 HWND_DESKTOP, 1759 GetPString(IDS_WARNINGTEXT), 1760 GetPString(IDS_SELECTTYPEERRORTEXT)); 1761 break; // WM_CLOSE 1758 1762 } 1759 1763 return WinDefDlgProc(hwnd, msg, mp1, mp2); … … 1834 1838 switch (SHORT1FROMMP(mp1)) { 1835 1839 case CFGM_RECENTDIRS: 1836 sprintf(s,1837 GetPString(IDS_RECENTHELPWHICHTEXT),1838 (!oh && th) ?1839 GetPString(IDS_RECENTONLYTEXT) :1840 (oh && th) ?1841 GetPString(IDS_ALLONLYTEXT) : GetPString(IDS_NONE));1842 break;1840 sprintf(s, 1841 GetPString(IDS_RECENTHELPWHICHTEXT), 1842 (!oh && th) ? 1843 GetPString(IDS_RECENTONLYTEXT) : 1844 (oh && th) ? 1845 GetPString(IDS_ALLONLYTEXT) : GetPString(IDS_NONE)); 1846 break; 1843 1847 } 1844 1848 if (*s) 1845 WinSetDlgItemText(hwnd, SHORT1FROMMP(mp1), s);1849 WinSetDlgItemText(hwnd, SHORT1FROMMP(mp1), s); 1846 1850 } 1847 1851 return 0; … … 1854 1858 case CFGM_STARTMIN: 1855 1859 if (WinQueryButtonCheckstate(hwnd, CFGM_STARTMIN)) { 1856 WinCheckButton(hwnd, CFGM_STARTMAX, FALSE);1857 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), FALSE);1860 WinCheckButton(hwnd, CFGM_STARTMAX, FALSE); 1861 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), FALSE); 1858 1862 } 1859 1863 else 1860 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), TRUE);1864 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMAX), TRUE); 1861 1865 break; 1862 1866 case CFGM_STARTMAX: 1863 1867 if (WinQueryButtonCheckstate(hwnd, CFGM_STARTMAX)) { 1864 WinCheckButton(hwnd, CFGM_STARTMIN, FALSE);1865 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), FALSE);1868 WinCheckButton(hwnd, CFGM_STARTMIN, FALSE); 1869 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), FALSE); 1866 1870 } 1867 1871 else 1868 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), TRUE);1872 WinEnableWindow(WinWindowFromID(hwnd, CFGM_STARTMIN), TRUE); 1869 1873 break; 1870 1874 } … … 1886 1890 case IDM_HELP: 1887 1891 if (hwndHelp) 1888 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,1889 MPFROM2SHORT(HELP_CFGM, 0), MPFROMSHORT(HM_RESOURCEID));1892 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 1893 MPFROM2SHORT(HELP_CFGM, 0), MPFROMSHORT(HM_RESOURCEID)); 1890 1894 break; 1891 1895 } … … 1895 1899 if (hwndMain && !strcmp(realappname, FM3Str)) { 1896 1900 if (fFreeTree != WinQueryButtonCheckstate(hwnd, CFGM_FREETREE)) 1897 PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);1901 PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID); 1898 1902 if (fAutoTile != WinQueryButtonCheckstate(hwnd, CFGM_AUTOTILE)) 1899 PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);1903 PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID); 1900 1904 if (fSplitStatus != WinQueryButtonCheckstate(hwnd, CFGM_SPLITSTATUS)) { 1901 fSplitStatus = (fSplitStatus) ? FALSE : TRUE;1902 PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_BLINK, 0), MPVOID);1903 PrfWriteProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus,1904 sizeof(BOOL));1905 fSplitStatus = (fSplitStatus) ? FALSE : TRUE; 1906 PostMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_BLINK, 0), MPVOID); 1907 PrfWriteProfileData(fmprof, FM3Str, "SplitStatus", &fSplitStatus, 1908 sizeof(BOOL)); 1905 1909 } 1906 1910 } 1907 1911 fUserListSwitches = WinQueryButtonCheckstate(hwnd, CFGM_USERLISTSWITCHES); 1908 1912 PrfWriteProfileData(fmprof, FM3Str, "UserListSwitches", 1909 (PVOID) & fUserListSwitches, sizeof(BOOL));1913 (PVOID) & fUserListSwitches, sizeof(BOOL)); 1910 1914 fExternalINIs = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALINIS); 1911 1915 PrfWriteProfileData(fmprof, FM3Str, "ExternalINIs", 1912 (PVOID) & fExternalINIs, sizeof(BOOL));1916 (PVOID) & fExternalINIs, sizeof(BOOL)); 1913 1917 fExternalArcboxes = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALARCBOXES); 1914 1918 PrfWriteProfileData(fmprof, FM3Str, "ExternalArcboxes", 1915 (PVOID) & fExternalArcboxes, sizeof(BOOL));1919 (PVOID) & fExternalArcboxes, sizeof(BOOL)); 1916 1920 fExternalCollector = 1917 1921 WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALCOLLECTOR); 1918 1922 PrfWriteProfileData(fmprof, FM3Str, "ExternalCollector", 1919 (PVOID) & fExternalCollector, sizeof(BOOL));1923 (PVOID) & fExternalCollector, sizeof(BOOL)); 1920 1924 fExternalViewer = WinQueryButtonCheckstate(hwnd, CFGM_EXTERNALVIEWER); 1921 1925 PrfWriteProfileData(fmprof, FM3Str, "ExternalViewer", 1922 (PVOID) & fExternalViewer, sizeof(BOOL));1926 (PVOID) & fExternalViewer, sizeof(BOOL)); 1923 1927 { 1924 1928 long test; … … 1929 1933 } 1930 1934 PrfWriteProfileData(fmprof, 1931 appname,1932 "AutoAddDirs", (PVOID) & fAutoAddDirs, sizeof(BOOL));1935 appname, 1936 "AutoAddDirs", (PVOID) & fAutoAddDirs, sizeof(BOOL)); 1933 1937 PrfWriteProfileData(fmprof, 1934 appname,1935 "AutoAddAllDirs",1936 (PVOID) & fAutoAddAllDirs, sizeof(BOOL));1938 appname, 1939 "AutoAddAllDirs", 1940 (PVOID) & fAutoAddAllDirs, sizeof(BOOL)); 1937 1941 fwsAnimate = WinQueryButtonCheckstate(hwnd, CFGM_WSANIMATE); 1938 1942 if (fwsAnimate) 1939 1943 fwsAnimate = WS_ANIMATE; 1940 1944 PrfWriteProfileData(fmprof, 1941 appname,1942 "WS_ANIMATE", (PVOID) & fwsAnimate, sizeof(ULONG));1945 appname, 1946 "WS_ANIMATE", (PVOID) & fwsAnimate, sizeof(ULONG)); 1943 1947 fSaveState = WinQueryButtonCheckstate(hwnd, CFGM_SAVESTATE); 1944 1948 PrfWriteProfileData(fmprof, 1945 FM3Str,1946 "SaveState", (PVOID) & fSaveState, sizeof(BOOL));1949 FM3Str, 1950 "SaveState", (PVOID) & fSaveState, sizeof(BOOL)); 1947 1951 fStartMinimized = WinQueryButtonCheckstate(hwnd, CFGM_STARTMIN); 1948 1952 PrfWriteProfileData(fmprof, 1949 appname,1950 "StartMinimized",1951 (PVOID) & fStartMinimized, sizeof(BOOL));1953 appname, 1954 "StartMinimized", 1955 (PVOID) & fStartMinimized, sizeof(BOOL)); 1952 1956 fStartMaximized = WinQueryButtonCheckstate(hwnd, CFGM_STARTMAX); 1953 1957 PrfWriteProfileData(fmprof, 1954 appname,1955 "StartMaximized",1956 (PVOID) & fStartMaximized, sizeof(BOOL));1958 appname, 1959 "StartMaximized", 1960 (PVOID) & fStartMaximized, sizeof(BOOL)); 1957 1961 fDataMin = WinQueryButtonCheckstate(hwnd, CFGM_DATAMIN); 1958 1962 PrfWriteProfileData(fmprof, 1959 FM3Str, "DataMin", (PVOID) & fDataMin, sizeof(BOOL));1963 FM3Str, "DataMin", (PVOID) & fDataMin, sizeof(BOOL)); 1960 1964 fTileBackwards = WinQueryButtonCheckstate(hwnd, CFGM_TILEBACKWARDS); 1961 1965 PrfWriteProfileData(fmprof, 1962 FM3Str,1963 "TileBackwards",1964 (PVOID) & fTileBackwards, sizeof(BOOL));1966 FM3Str, 1967 "TileBackwards", 1968 (PVOID) & fTileBackwards, sizeof(BOOL)); 1965 1969 fNoTreeGap = WinQueryButtonCheckstate(hwnd, CFGM_NOTREEGAP); 1966 1970 PrfWriteProfileData(fmprof, 1967 FM3Str,1968 "NoTreeGap", (PVOID) & fNoTreeGap, sizeof(BOOL));1971 FM3Str, 1972 "NoTreeGap", (PVOID) & fNoTreeGap, sizeof(BOOL)); 1969 1973 fBlueLED = WinQueryButtonCheckstate(hwnd, CFGM_BLUELED); 1970 1974 PrfWriteProfileData(fmprof, 1971 appname, "BlueLED", (PVOID) & fBlueLED, sizeof(BOOL));1975 appname, "BlueLED", (PVOID) & fBlueLED, sizeof(BOOL)); 1972 1976 { 1973 1977 BOOL dummy; … … 1975 1979 dummy = WinQueryButtonCheckstate(hwnd, CFGM_SHOWTARGET); 1976 1980 if (dummy != fShowTarget) { 1977 fShowTarget = dummy;1978 PrfWriteProfileData(fmprof,1979 appname,1980 "ShowTarget",1981 (PVOID) & fShowTarget, sizeof(BOOL));1982 if (hwndMain)1983 PostMsg(WinQueryWindow(hwndMain, QW_PARENT),1984 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);1985 SetTargetDir(hwnd, TRUE);1981 fShowTarget = dummy; 1982 PrfWriteProfileData(fmprof, 1983 appname, 1984 "ShowTarget", 1985 (PVOID) & fShowTarget, sizeof(BOOL)); 1986 if (hwndMain) 1987 PostMsg(WinQueryWindow(hwndMain, QW_PARENT), 1988 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 1989 SetTargetDir(hwnd, TRUE); 1986 1990 } 1987 1991 dummy = WinQueryButtonCheckstate(hwnd, CFGM_SEPARATEPARMS); 1988 1992 if (dummy != fSeparateParms) { 1989 fSeparateParms = dummy;1990 PrfWriteProfileData(fmprof,1991 FM3Str,1992 "SeparateParms",1993 (PVOID) & fSeparateParms, sizeof(BOOL));1994 WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER),1995 UM_UNDO, MPVOID, MPVOID);1993 fSeparateParms = dummy; 1994 PrfWriteProfileData(fmprof, 1995 FM3Str, 1996 "SeparateParms", 1997 (PVOID) & fSeparateParms, sizeof(BOOL)); 1998 WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), 1999 UM_UNDO, MPVOID, MPVOID); 1996 2000 } 1997 2001 } … … 2008 2012 case WM_INITDLG: 2009 2013 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETTEXTLIMIT, 2010 MPFROMSHORT(8), MPVOID);2014 MPFROMSHORT(8), MPVOID); 2011 2015 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_OVERRIDESETLIMITS, 2012 MPFROMLONG(1000), MPFROMLONG(50));2016 MPFROMLONG(1000), MPFROMLONG(50)); 2013 2017 WinSendDlgItemMsg(hwnd, 2014 CFG5_FILTER,2015 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);2018 CFG5_FILTER, 2019 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 2016 2020 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); 2017 2021 break; … … 2052 2056 2053 2057 if (!PrfQueryProfileData(fmprof, 2054 appname,2055 "DirflWindowAttr", &flWindowAttr, &ulSize))2056 flWindowAttr = (CV_NAME | CV_MINI | CA_DETAILSVIEWTITLES | CV_FLOW);2058 appname, 2059 "DirflWindowAttr", &flWindowAttr, &ulSize)) 2060 flWindowAttr = (CV_NAME | CV_MINI | CA_DETAILSVIEWTITLES | CV_FLOW); 2057 2061 if (flWindowAttr & CV_ICON) 2058 WinCheckButton(hwnd, CFG5_ICON, TRUE);2062 WinCheckButton(hwnd, CFG5_ICON, TRUE); 2059 2063 if (flWindowAttr & CV_NAME) 2060 WinCheckButton(hwnd, CFG5_NAME, TRUE);2064 WinCheckButton(hwnd, CFG5_NAME, TRUE); 2061 2065 if (flWindowAttr & CV_TEXT) 2062 WinCheckButton(hwnd, CFG5_TEXT, TRUE);2066 WinCheckButton(hwnd, CFG5_TEXT, TRUE); 2063 2067 if (flWindowAttr & CV_DETAIL) 2064 WinCheckButton(hwnd, CFG5_DETAIL, TRUE);2068 WinCheckButton(hwnd, CFG5_DETAIL, TRUE); 2065 2069 if (flWindowAttr & CV_MINI) 2066 WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);2070 WinCheckButton(hwnd, CFG5_MINIICONS, TRUE); 2067 2071 if (flWindowAttr & CA_DETAILSVIEWTITLES) 2068 WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);2072 WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE); 2069 2073 WinCheckButton(hwnd, CFG5_SHOWLNAMES, dsDirCnrDefault.detailslongname); 2070 2074 WinCheckButton(hwnd, CFG5_SHOWSUBJECT, dsDirCnrDefault.detailssubject); … … 2081 2085 memset(&mask, 0, sizeof(mask)); 2082 2086 mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN | 2083 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;2087 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY; 2084 2088 ulSize = sizeof(MASK); 2085 2089 if (PrfQueryProfileData(fmprof, appname, "DirFilter", &mask, &ulSize)) 2086 SetMask(NULL, &mask);2090 SetMask(NULL, &mask); 2087 2091 if (!mask.attrFile) 2088 mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |2089 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;2092 mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN | 2093 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY; 2090 2094 strcpy(mask.prompt, GetPString(IDS_DEFDIRFILTERTITLETEXT)); 2091 2095 WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask); … … 2093 2097 WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, dsDirCnrDefault.fSubjectLengthMax); 2094 2098 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE, 2095 MPFROMLONG(dsDirCnrDefault.SubjectDisplayWidth), MPVOID);2099 MPFROMLONG(dsDirCnrDefault.SubjectDisplayWidth), MPVOID); 2096 2100 } 2097 2101 return 0; … … 2099 2103 case UM_SETUP5: 2100 2104 if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc, 2101 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {2105 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) { 2102 2106 SetMask(NULL, &mask); 2103 2107 WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask); … … 2110 2114 switch (SHORT2FROMMP(mp1)) { 2111 2115 case EN_SETFOCUS: 2112 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);2113 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);2114 break;2116 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 2117 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); 2118 break; 2115 2119 } 2116 2120 break; … … 2133 2137 case IDM_HELP: 2134 2138 if (hwndHelp) 2135 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,2136 MPFROM2SHORT(HELP_CFG5, 0), MPFROMSHORT(HM_RESOURCEID));2139 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 2140 MPFROM2SHORT(HELP_CFG5, 0), MPFROMSHORT(HM_RESOURCEID)); 2137 2141 break; 2138 2142 } … … 2144 2148 2145 2149 if (WinQueryButtonCheckstate(hwnd, CFG5_ICON)) 2146 flWindowAttr |= CV_ICON;2150 flWindowAttr |= CV_ICON; 2147 2151 if (WinQueryButtonCheckstate(hwnd, CFG5_NAME)) 2148 flWindowAttr |= CV_NAME;2152 flWindowAttr |= CV_NAME; 2149 2153 if (WinQueryButtonCheckstate(hwnd, CFG5_TEXT)) 2150 flWindowAttr |= CV_TEXT;2154 flWindowAttr |= CV_TEXT; 2151 2155 if (WinQueryButtonCheckstate(hwnd, CFG5_DETAIL)) 2152 flWindowAttr |= CV_DETAIL;2156 flWindowAttr |= CV_DETAIL; 2153 2157 if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS)) 2154 flWindowAttr |= CV_MINI;2158 flWindowAttr |= CV_MINI; 2155 2159 if (WinQueryButtonCheckstate(hwnd, CFG5_SHOWTITLES)) 2156 flWindowAttr |= CA_DETAILSVIEWTITLES;2160 flWindowAttr |= CA_DETAILSVIEWTITLES; 2157 2161 flWindowAttr |= CV_FLOW; 2158 2162 PrfWriteProfileData(fmprof, 2159 appname,2160 "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));2163 appname, 2164 "DirflWindowAttr", &flWindowAttr, sizeof(ULONG)); 2161 2165 } 2162 2166 dsDirCnrDefault.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES); 2163 2167 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname", 2164 &dsDirCnrDefault.detailslongname, sizeof(BOOL));2168 &dsDirCnrDefault.detailslongname, sizeof(BOOL)); 2165 2169 dsDirCnrDefault.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT); 2166 2170 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject", 2167 &dsDirCnrDefault.detailssubject, sizeof(BOOL));2171 &dsDirCnrDefault.detailssubject, sizeof(BOOL)); 2168 2172 dsDirCnrDefault.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT); 2169 2173 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA", 2170 &dsDirCnrDefault.detailsea, sizeof(BOOL));2174 &dsDirCnrDefault.detailsea, sizeof(BOOL)); 2171 2175 dsDirCnrDefault.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE); 2172 2176 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize", 2173 &dsDirCnrDefault.detailssize, sizeof(BOOL));2177 &dsDirCnrDefault.detailssize, sizeof(BOOL)); 2174 2178 dsDirCnrDefault.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON); 2175 2179 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon", 2176 &dsDirCnrDefault.detailsicon, sizeof(BOOL));2180 &dsDirCnrDefault.detailsicon, sizeof(BOOL)); 2177 2181 dsDirCnrDefault.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE); 2178 2182 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate", 2179 &dsDirCnrDefault.detailslwdate, sizeof(BOOL));2183 &dsDirCnrDefault.detailslwdate, sizeof(BOOL)); 2180 2184 dsDirCnrDefault.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME); 2181 2185 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime", 2182 &dsDirCnrDefault.detailslwtime, sizeof(BOOL));2186 &dsDirCnrDefault.detailslwtime, sizeof(BOOL)); 2183 2187 dsDirCnrDefault.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE); 2184 2188 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate", 2185 &dsDirCnrDefault.detailsladate, sizeof(BOOL));2189 &dsDirCnrDefault.detailsladate, sizeof(BOOL)); 2186 2190 dsDirCnrDefault.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME); 2187 2191 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime", 2188 &dsDirCnrDefault.detailslatime, sizeof(BOOL));2192 &dsDirCnrDefault.detailslatime, sizeof(BOOL)); 2189 2193 dsDirCnrDefault.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE); 2190 2194 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate", 2191 &dsDirCnrDefault.detailscrdate, sizeof(BOOL));2195 &dsDirCnrDefault.detailscrdate, sizeof(BOOL)); 2192 2196 dsDirCnrDefault.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME); 2193 2197 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime", 2194 &dsDirCnrDefault.detailscrtime, sizeof(BOOL));2198 &dsDirCnrDefault.detailscrtime, sizeof(BOOL)); 2195 2199 dsDirCnrDefault.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR); 2196 2200 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr", 2197 &dsDirCnrDefault.detailsattr, sizeof(BOOL));2201 &dsDirCnrDefault.detailsattr, sizeof(BOOL)); 2198 2202 dsDirCnrDefault.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE); 2199 2203 PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectInLeftPane", 2200 &dsDirCnrDefault.fSubjectInLeftPane, sizeof(BOOL));2204 &dsDirCnrDefault.fSubjectInLeftPane, sizeof(BOOL)); 2201 2205 dsDirCnrDefault.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX); 2202 2206 PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectLengthMax", 2203 &dsDirCnrDefault.fSubjectLengthMax, sizeof(BOOL));2207 &dsDirCnrDefault.fSubjectLengthMax, sizeof(BOOL)); 2204 2208 *mask.prompt = 0; 2205 2209 PrfWriteProfileData(fmprof, appname, "DirFilter", &mask, sizeof(MASK)); 2206 2210 { 2207 if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {2208 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,2209 MPFROMP(&dsDirCnrDefault.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));2210 if (dsDirCnrDefault.SubjectDisplayWidth < 50)2211 dsDirCnrDefault.SubjectDisplayWidth = 0;2212 else if (dsDirCnrDefault.SubjectDisplayWidth > 1000)2213 dsDirCnrDefault.SubjectDisplayWidth = 1000;2214 }2215 else2216 dsDirCnrDefault.SubjectDisplayWidth = 0;2217 PrfWriteProfileData(fmprof,2218 appname, "DirCnr.SubjectDisplayWidth",2219 &dsDirCnrDefault.SubjectDisplayWidth, sizeof(ULONG));2211 if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) { 2212 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE, 2213 MPFROMP(&dsDirCnrDefault.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE)); 2214 if (dsDirCnrDefault.SubjectDisplayWidth < 50) 2215 dsDirCnrDefault.SubjectDisplayWidth = 0; 2216 else if (dsDirCnrDefault.SubjectDisplayWidth > 1000) 2217 dsDirCnrDefault.SubjectDisplayWidth = 1000; 2218 } 2219 else 2220 dsDirCnrDefault.SubjectDisplayWidth = 0; 2221 PrfWriteProfileData(fmprof, 2222 appname, "DirCnr.SubjectDisplayWidth", 2223 &dsDirCnrDefault.SubjectDisplayWidth, sizeof(ULONG)); 2220 2224 } 2221 2225 break; … … 2299 2303 case CFG6_SORTDIRSLAST: 2300 2304 { 2301 BOOL temp;2302 2303 temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));2304 if (temp) {2305 switch (SHORT1FROMMP(mp1)) {2306 case CFG6_SORTDIRSFIRST:2307 WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);2308 break;2309 case CFG6_SORTDIRSLAST:2310 WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);2311 break;2312 }2313 }2305 BOOL temp; 2306 2307 temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1)); 2308 if (temp) { 2309 switch (SHORT1FROMMP(mp1)) { 2310 case CFG6_SORTDIRSFIRST: 2311 WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE); 2312 break; 2313 case CFG6_SORTDIRSLAST: 2314 WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE); 2315 break; 2316 } 2317 } 2314 2318 } 2315 2319 break; … … 2332 2336 case IDM_HELP: 2333 2337 if (hwndHelp) 2334 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,2335 MPFROM2SHORT(HELP_CFG6, 0), MPFROMSHORT(HM_RESOURCEID));2338 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 2339 MPFROM2SHORT(HELP_CFG6, 0), MPFROMSHORT(HM_RESOURCEID)); 2336 2340 break; 2337 2341 } … … 2375 2379 case WM_INITDLG: 2376 2380 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETTEXTLIMIT, 2377 MPFROMSHORT(8), MPVOID);2381 MPFROMSHORT(8), MPVOID); 2378 2382 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_OVERRIDESETLIMITS, 2379 MPFROMLONG(1000), MPFROMLONG(50));2383 MPFROMLONG(1000), MPFROMLONG(50)); 2380 2384 WinSendDlgItemMsg(hwnd, CFG5_FILTER, EM_SETTEXTLIMIT, 2381 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);2385 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 2382 2386 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); 2383 2387 break; … … 2419 2423 2420 2424 if (!PrfQueryProfileData(fmprof, 2421 appname,2422 "CollectorflWindowAttr", &flWindowAttr, &ulSize))2423 flWindowAttr = (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI | CV_FLOW);2425 appname, 2426 "CollectorflWindowAttr", &flWindowAttr, &ulSize)) 2427 flWindowAttr = (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI | CV_FLOW); 2424 2428 if (flWindowAttr & CV_ICON) 2425 WinCheckButton(hwnd, CFG5_ICON, TRUE);2429 WinCheckButton(hwnd, CFG5_ICON, TRUE); 2426 2430 if (flWindowAttr & CV_NAME) 2427 WinCheckButton(hwnd, CFG5_NAME, TRUE);2431 WinCheckButton(hwnd, CFG5_NAME, TRUE); 2428 2432 if (flWindowAttr & CV_TEXT) 2429 WinCheckButton(hwnd, CFG5_TEXT, TRUE);2433 WinCheckButton(hwnd, CFG5_TEXT, TRUE); 2430 2434 if (flWindowAttr & CV_DETAIL) 2431 WinCheckButton(hwnd, CFG5_DETAIL, TRUE);2435 WinCheckButton(hwnd, CFG5_DETAIL, TRUE); 2432 2436 if (flWindowAttr & CV_MINI) 2433 WinCheckButton(hwnd, CFG5_MINIICONS, TRUE);2437 WinCheckButton(hwnd, CFG5_MINIICONS, TRUE); 2434 2438 if (flWindowAttr & CA_DETAILSVIEWTITLES) 2435 WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE);2439 WinCheckButton(hwnd, CFG5_SHOWTITLES, TRUE); 2436 2440 memset(&mask, 0, sizeof(mask)); 2437 2441 mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN | 2438 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;2442 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY; 2439 2443 ulSize = sizeof(MASK); 2440 2444 if (PrfQueryProfileData(fmprof, 2441 appname, "CollectorFilter", &mask, &ulSize)) {2442 SetMask(NULL, &mask);2445 appname, "CollectorFilter", &mask, &ulSize)) { 2446 SetMask(NULL, &mask); 2443 2447 } 2444 2448 if (!mask.attrFile) 2445 mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN |2446 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY;2449 mask.attrFile = FILE_DIRECTORY | FILE_ARCHIVED | FILE_HIDDEN | 2450 FILE_SYSTEM | FILE_NORMAL | FILE_READONLY; 2447 2451 strcpy(mask.prompt, GetPString(IDS_DEFCOLFILTERTITLETEXT)); 2448 2452 WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask); … … 2468 2472 WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, ds.fSubjectLengthMax); 2469 2473 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE, 2470 MPFROMLONG(ds.SubjectDisplayWidth), MPVOID);2474 MPFROMLONG(ds.SubjectDisplayWidth), MPVOID); 2471 2475 2472 2476 } … … 2475 2479 case UM_SETUP5: 2476 2480 if (WinDlgBox(HWND_DESKTOP, hwndNotebook, PickMaskDlgProc, 2477 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {2481 FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) { 2478 2482 SetMask(NULL, &mask); 2479 2483 WinSetDlgItemText(hwnd, CFG5_FILTER, mask.szMask); … … 2486 2490 switch (SHORT2FROMMP(mp1)) { 2487 2491 case EN_SETFOCUS: 2488 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);2489 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID);2490 break;2492 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 2493 PostMsg(hwnd, UM_SETUP5, MPVOID, MPVOID); 2494 break; 2491 2495 } 2492 2496 break; … … 2509 2513 case IDM_HELP: 2510 2514 if (hwndHelp) 2511 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,2512 MPFROM2SHORT(HELP_CFG7, 0), MPFROMSHORT(HM_RESOURCEID));2515 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 2516 MPFROM2SHORT(HELP_CFG7, 0), MPFROMSHORT(HM_RESOURCEID)); 2513 2517 break; 2514 2518 } … … 2517 2521 case WM_CLOSE: 2518 2522 fExternalCollector = WinQueryButtonCheckstate(hwnd, 2519 CFG5_EXTERNALCOLLECTOR);2523 CFG5_EXTERNALCOLLECTOR); 2520 2524 PrfWriteProfileData(fmprof, FM3Str, "ExternalCollector", 2521 &fExternalCollector, sizeof(BOOL));2525 &fExternalCollector, sizeof(BOOL)); 2522 2526 { 2523 2527 ULONG flWindowAttr = 0; 2524 2528 2525 2529 if (WinQueryButtonCheckstate(hwnd, CFG5_ICON)) 2526 flWindowAttr |= CV_ICON;2530 flWindowAttr |= CV_ICON; 2527 2531 if (WinQueryButtonCheckstate(hwnd, CFG5_NAME)) 2528 flWindowAttr |= CV_NAME;2532 flWindowAttr |= CV_NAME; 2529 2533 if (WinQueryButtonCheckstate(hwnd, CFG5_TEXT)) 2530 flWindowAttr |= CV_TEXT;2534 flWindowAttr |= CV_TEXT; 2531 2535 if (WinQueryButtonCheckstate(hwnd, CFG5_DETAIL)) 2532 flWindowAttr |= CV_DETAIL;2536 flWindowAttr |= CV_DETAIL; 2533 2537 if (WinQueryButtonCheckstate(hwnd, CFG5_MINIICONS)) 2534 flWindowAttr |= CV_MINI;2538 flWindowAttr |= CV_MINI; 2535 2539 if (WinQueryButtonCheckstate(hwnd, CFG5_SHOWTITLES)) 2536 flWindowAttr |= CA_DETAILSVIEWTITLES;2540 flWindowAttr |= CA_DETAILSVIEWTITLES; 2537 2541 flWindowAttr |= CV_FLOW; 2538 2542 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr", 2539 &flWindowAttr, sizeof(ULONG));2543 &flWindowAttr, sizeof(ULONG)); 2540 2544 } 2541 2545 { … … 2545 2549 ds.detailslongname = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLNAMES); 2546 2550 PrfWriteProfileData(fmprof, appname, "Collector.DetailsLongname", 2547 &ds.detailslongname, sizeof(BOOL));2551 &ds.detailslongname, sizeof(BOOL)); 2548 2552 ds.detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT); 2549 2553 PrfWriteProfileData(fmprof, appname, "Collector.DetailsSubject", 2550 &ds.detailssubject, sizeof(BOOL));2554 &ds.detailssubject, sizeof(BOOL)); 2551 2555 ds.detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWEAS); 2552 2556 PrfWriteProfileData(fmprof, appname, "Collector.DetailsEA", 2553 &ds.detailsea, sizeof(BOOL));2557 &ds.detailsea, sizeof(BOOL)); 2554 2558 ds.detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE); 2555 2559 PrfWriteProfileData(fmprof, appname, "Collector.DetailsSize", 2556 &ds.detailssize, sizeof(BOOL));2560 &ds.detailssize, sizeof(BOOL)); 2557 2561 ds.detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON); 2558 2562 PrfWriteProfileData(fmprof, appname, "Collector.DetailsIcon", 2559 &ds.detailsicon, sizeof(BOOL));2563 &ds.detailsicon, sizeof(BOOL)); 2560 2564 ds.detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE); 2561 2565 PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWDate", 2562 &ds.detailslwdate, sizeof(BOOL));2566 &ds.detailslwdate, sizeof(BOOL)); 2563 2567 ds.detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME); 2564 2568 PrfWriteProfileData(fmprof, appname, "Collector.DetailsLWTime", 2565 &ds.detailslwtime, sizeof(BOOL));2569 &ds.detailslwtime, sizeof(BOOL)); 2566 2570 ds.detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE); 2567 2571 PrfWriteProfileData(fmprof, appname, "Collector.DetailsLADate", 2568 &ds.detailsladate, sizeof(BOOL));2572 &ds.detailsladate, sizeof(BOOL)); 2569 2573 ds.detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME); 2570 2574 PrfWriteProfileData(fmprof, appname, "Collector.DetailsLATime", 2571 &ds.detailslatime, sizeof(BOOL));2575 &ds.detailslatime, sizeof(BOOL)); 2572 2576 ds.detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE); 2573 2577 PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRDate", 2574 &ds.detailscrdate, sizeof(BOOL));2578 &ds.detailscrdate, sizeof(BOOL)); 2575 2579 ds.detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME); 2576 2580 PrfWriteProfileData(fmprof, appname, "Collector.DetailsCRTime", 2577 &ds.detailscrtime, sizeof(BOOL));2581 &ds.detailscrtime, sizeof(BOOL)); 2578 2582 ds.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR); 2579 2583 PrfWriteProfileData(fmprof, appname, "Collector.DetailsAttr", 2580 &ds.detailsattr, sizeof(BOOL));2584 &ds.detailsattr, sizeof(BOOL)); 2581 2585 ds.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE); 2582 2586 PrfWriteProfileData(fmprof, appname, "Collector.SubjectInLeftPane", 2583 &ds.fSubjectInLeftPane, sizeof(BOOL));2587 &ds.fSubjectInLeftPane, sizeof(BOOL)); 2584 2588 ds.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX); 2585 2589 PrfWriteProfileData(fmprof, appname, "Collector.SubjectLengthMax", 2586 &ds.fSubjectLengthMax, sizeof(BOOL));2590 &ds.fSubjectLengthMax, sizeof(BOOL)); 2587 2591 *mask.prompt = 0; 2588 2592 PrfWriteProfileData(fmprof, 2589 appname, "CollectorFilter", &mask, sizeof(MASK));2593 appname, "CollectorFilter", &mask, sizeof(MASK)); 2590 2594 { 2591 if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {2592 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE,2593 MPFROMP(&ds.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE));2594 if (ds.SubjectDisplayWidth < 50)2595 ds.SubjectDisplayWidth = 0;2596 else if (ds.SubjectDisplayWidth > 1000)2597 ds.SubjectDisplayWidth = 1000;2598 }2599 else2600 ds.SubjectDisplayWidth = 0;2601 PrfWriteProfileData(fmprof,2602 appname, "Collector.SubjectDisplayWidth",2603 &ds.SubjectDisplayWidth, sizeof(ULONG));2595 if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) { 2596 WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_QUERYVALUE, 2597 MPFROMP(&ds.SubjectDisplayWidth), MPFROM2SHORT(0, SPBQ_DONOTUPDATE)); 2598 if (ds.SubjectDisplayWidth < 50) 2599 ds.SubjectDisplayWidth = 0; 2600 else if (ds.SubjectDisplayWidth > 1000) 2601 ds.SubjectDisplayWidth = 1000; 2602 } 2603 else 2604 ds.SubjectDisplayWidth = 0; 2605 PrfWriteProfileData(fmprof, 2606 appname, "Collector.SubjectDisplayWidth", 2607 &ds.SubjectDisplayWidth, sizeof(ULONG)); 2604 2608 } 2605 2609 } … … 2684 2688 case CFG6_SORTDIRSLAST: 2685 2689 { 2686 BOOL temp;2687 2688 temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1));2689 if (temp) {2690 switch (SHORT1FROMMP(mp1)) {2691 case CFG6_SORTDIRSFIRST:2692 WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE);2693 break;2694 case CFG6_SORTDIRSLAST:2695 WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE);2696 break;2697 }2698 }2690 BOOL temp; 2691 2692 temp = WinQueryButtonCheckstate(hwnd, SHORT1FROMMP(mp1)); 2693 if (temp) { 2694 switch (SHORT1FROMMP(mp1)) { 2695 case CFG6_SORTDIRSFIRST: 2696 WinCheckButton(hwnd, CFG6_SORTDIRSLAST, FALSE); 2697 break; 2698 case CFG6_SORTDIRSLAST: 2699 WinCheckButton(hwnd, CFG6_SORTDIRSFIRST, FALSE); 2700 break; 2701 } 2702 } 2699 2703 } 2700 2704 break; … … 2717 2721 case IDM_HELP: 2718 2722 if (hwndHelp) 2719 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,2720 MPFROM2SHORT(HELP_CFG8, 0), MPFROMSHORT(HM_RESOURCEID));2723 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 2724 MPFROM2SHORT(HELP_CFG8, 0), MPFROMSHORT(HM_RESOURCEID)); 2721 2725 break; 2722 2726 } … … 2748 2752 CollectorsortFlags |= SORT_REVERSE; 2749 2753 PrfWriteProfileData(fmprof, 2750 appname,2751 "CollectorSort", &CollectorsortFlags, sizeof(INT));2754 appname, 2755 "CollectorSort", &CollectorsortFlags, sizeof(INT)); 2752 2756 break; 2753 2757 } … … 2790 2794 case IDM_HELP: 2791 2795 if (hwndHelp) 2792 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,2793 MPFROM2SHORT(HELP_CFG9, 0), MPFROMSHORT(HM_RESOURCEID));2796 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 2797 MPFROM2SHORT(HELP_CFG9, 0), MPFROMSHORT(HM_RESOURCEID)); 2794 2798 return 0; 2795 2799 case CFG9_MAXIMUMUI: 2796 2800 if (hwndMain) { 2797 if (MenuInvisible)2798 WinSendMsg(hwndMain, WM_COMMAND,2799 MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);2800 if (!fAutoView)2801 WinSendMsg(hwndMain, WM_COMMAND,2802 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);2803 if (!fDrivebar)2804 WinSendMsg(hwndMain, WM_COMMAND,2805 MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);2806 if (!fToolbar)2807 WinSendMsg(hwndMain, WM_COMMAND,2808 MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);2809 if (!fMoreButtons)2810 WinSendMsg(hwndMain, WM_COMMAND,2811 MPFROM2SHORT(IDM_MOREBUTTONS, 0), MPVOID);2812 if (!fUserComboBox)2813 WinSendMsg(hwndMain, WM_COMMAND,2814 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);2801 if (MenuInvisible) 2802 WinSendMsg(hwndMain, WM_COMMAND, 2803 MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 2804 if (!fAutoView) 2805 WinSendMsg(hwndMain, WM_COMMAND, 2806 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID); 2807 if (!fDrivebar) 2808 WinSendMsg(hwndMain, WM_COMMAND, 2809 MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID); 2810 if (!fToolbar) 2811 WinSendMsg(hwndMain, WM_COMMAND, 2812 MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 2813 if (!fMoreButtons) 2814 WinSendMsg(hwndMain, WM_COMMAND, 2815 MPFROM2SHORT(IDM_MOREBUTTONS, 0), MPVOID); 2816 if (!fUserComboBox) 2817 WinSendMsg(hwndMain, WM_COMMAND, 2818 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID); 2815 2819 } 2816 2820 return 0; 2817 2821 case CFG9_MINIMUMUI: 2818 2822 if (hwndMain) { 2819 if (!MenuInvisible)2820 WinSendMsg(hwndMain, WM_COMMAND,2821 MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);2822 if (fAutoView)2823 WinSendMsg(hwndMain, WM_COMMAND,2824 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);2825 if (fToolbar)2826 WinSendMsg(hwndMain, WM_COMMAND,2827 MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);2828 if (fMoreButtons)2829 WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),2830 MPVOID);2831 if (fUserComboBox)2832 WinSendMsg(hwndMain, WM_COMMAND,2833 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);2834 saymsg(MB_ENTER | MB_ICONASTERISK,2835 hwnd,2836 GetPString(IDS_DONTFORGETTEXT),2837 GetPString(IDS_UNHIDEMENUWARNTEXT));2823 if (!MenuInvisible) 2824 WinSendMsg(hwndMain, WM_COMMAND, 2825 MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 2826 if (fAutoView) 2827 WinSendMsg(hwndMain, WM_COMMAND, 2828 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID); 2829 if (fToolbar) 2830 WinSendMsg(hwndMain, WM_COMMAND, 2831 MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 2832 if (fMoreButtons) 2833 WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0), 2834 MPVOID); 2835 if (fUserComboBox) 2836 WinSendMsg(hwndMain, WM_COMMAND, 2837 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID); 2838 saymsg(MB_ENTER | MB_ICONASTERISK, 2839 hwnd, 2840 GetPString(IDS_DONTFORGETTEXT), 2841 GetPString(IDS_UNHIDEMENUWARNTEXT)); 2838 2842 } 2839 2843 return 0; … … 2849 2853 fDragndropDlg = TRUE; 2850 2854 { 2851 ULONG flWindowAttr;2852 2853 flWindowAttr = CV_DETAIL | CV_FLOW | CA_DETAILSVIEWTITLES;2854 PrfWriteProfileData(fmprof,2855 appname,2856 "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));2857 PrfWriteProfileData(fmprof,2858 appname,2859 "CollectorflWindowAttr",2860 &flWindowAttr, sizeof(ULONG));2861 PrfWriteProfileData(fmprof,2862 appname, "Collector.Fontnamesize", NULL, 0);2855 ULONG flWindowAttr; 2856 2857 flWindowAttr = CV_DETAIL | CV_FLOW | CA_DETAILSVIEWTITLES; 2858 PrfWriteProfileData(fmprof, 2859 appname, 2860 "DirflWindowAttr", &flWindowAttr, sizeof(ULONG)); 2861 PrfWriteProfileData(fmprof, 2862 appname, 2863 "CollectorflWindowAttr", 2864 &flWindowAttr, sizeof(ULONG)); 2865 PrfWriteProfileData(fmprof, 2866 appname, "Collector.Fontnamesize", NULL, 0); 2863 2867 } 2864 2868 dsDirCnrDefault.detailslongname = TRUE; … … 2876 2880 if (hwndTree) { 2877 2881 2878 CNRINFO cnri;2879 ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;2880 2881 memset(&cnri, 0, sizeof(cnri));2882 cnri.cb = sizeof(cnri);2883 WinSendMsg(WinWindowFromID2884 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),2885 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));2886 cnri.flWindowAttr = flWindowAttr;2887 WinSendMsg(WinWindowFromID2888 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),2889 CM_SETCNRINFO, MPFROMP(&cnri),2890 MPFROMLONG(CMA_FLWINDOWATTR));2882 CNRINFO cnri; 2883 ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE; 2884 2885 memset(&cnri, 0, sizeof(cnri)); 2886 cnri.cb = sizeof(cnri); 2887 WinSendMsg(WinWindowFromID 2888 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 2889 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 2890 cnri.flWindowAttr = flWindowAttr; 2891 WinSendMsg(WinWindowFromID 2892 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 2893 CM_SETCNRINFO, MPFROMP(&cnri), 2894 MPFROMLONG(CMA_FLWINDOWATTR)); 2891 2895 } 2892 2896 break; … … 2903 2907 fDragndropDlg = TRUE; 2904 2908 { 2905 ULONG flWindowAttr;2906 2907 flWindowAttr = CV_DETAIL | CV_FLOW | CV_MINI;2908 PrfWriteProfileData(fmprof,2909 appname,2910 "DirflWindowAttr", &flWindowAttr, sizeof(ULONG));2911 PrfWriteProfileData(fmprof,2912 appname,2913 "CollectorflWindowAttr",2914 &flWindowAttr, sizeof(ULONG));2915 PrfWriteProfileData(fmprof,2916 appname,2917 "Collector.Fontnamesize",2918 GetPString(IDS_8HELVTEXT),2919 strlen(GetPString(IDS_8HELVTEXT)) + 1);2909 ULONG flWindowAttr; 2910 2911 flWindowAttr = CV_DETAIL | CV_FLOW | CV_MINI; 2912 PrfWriteProfileData(fmprof, 2913 appname, 2914 "DirflWindowAttr", &flWindowAttr, sizeof(ULONG)); 2915 PrfWriteProfileData(fmprof, 2916 appname, 2917 "CollectorflWindowAttr", 2918 &flWindowAttr, sizeof(ULONG)); 2919 PrfWriteProfileData(fmprof, 2920 appname, 2921 "Collector.Fontnamesize", 2922 GetPString(IDS_8HELVTEXT), 2923 strlen(GetPString(IDS_8HELVTEXT)) + 1); 2920 2924 } 2921 2925 dsDirCnrDefault.detailslongname = TRUE; … … 2933 2937 if (hwndTree) { 2934 2938 2935 CNRINFO cnri;2936 ULONG flWindowAttr = CV_TREE | CV_MINI | CV_TEXT |2937 CV_FLOW | CA_TREELINE;2938 2939 memset(&cnri, 0, sizeof(cnri));2940 cnri.cb = sizeof(cnri);2941 WinSendMsg(WinWindowFromID2942 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),2943 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));2944 cnri.flWindowAttr = flWindowAttr;2945 WinSendMsg(WinWindowFromID2946 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),2947 CM_SETCNRINFO, MPFROMP(&cnri),2948 MPFROMLONG(CMA_FLWINDOWATTR));2939 CNRINFO cnri; 2940 ULONG flWindowAttr = CV_TREE | CV_MINI | CV_TEXT | 2941 CV_FLOW | CA_TREELINE; 2942 2943 memset(&cnri, 0, sizeof(cnri)); 2944 cnri.cb = sizeof(cnri); 2945 WinSendMsg(WinWindowFromID 2946 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 2947 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 2948 cnri.flWindowAttr = flWindowAttr; 2949 WinSendMsg(WinWindowFromID 2950 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 2951 CM_SETCNRINFO, MPFROMP(&cnri), 2952 MPFROMLONG(CMA_FLWINDOWATTR)); 2949 2953 } 2950 2954 break; 2951 2955 case CFG9_MAXFILENAMES: 2952 2956 if (hwndMain && fAutoView) 2953 WinSendMsg(hwndMain, WM_COMMAND,2954 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);2957 WinSendMsg(hwndMain, WM_COMMAND, 2958 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID); 2955 2959 fForceUpper = FALSE; 2956 2960 fForceLower = TRUE; … … 2964 2968 fNoIconsDirs = TRUE; 2965 2969 { 2966 ULONG flWindowAttr;2967 2968 flWindowAttr = CV_TEXT | CV_FLOW;2969 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",2970 &flWindowAttr, sizeof(ULONG));2971 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",2972 &flWindowAttr, sizeof(ULONG));2973 PrfWriteProfileData(fmprof, appname, "Collector.Fontnamesize",2974 GetPString(IDS_8HELVTEXT),2975 strlen(GetPString(IDS_8HELVTEXT)) + 1);2970 ULONG flWindowAttr; 2971 2972 flWindowAttr = CV_TEXT | CV_FLOW; 2973 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr", 2974 &flWindowAttr, sizeof(ULONG)); 2975 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr", 2976 &flWindowAttr, sizeof(ULONG)); 2977 PrfWriteProfileData(fmprof, appname, "Collector.Fontnamesize", 2978 GetPString(IDS_8HELVTEXT), 2979 strlen(GetPString(IDS_8HELVTEXT)) + 1); 2976 2980 } 2977 2981 if (hwndTree) { 2978 2982 2979 CNRINFO cnri;2980 ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;2981 2982 memset(&cnri, 0, sizeof(cnri));2983 cnri.cb = sizeof(cnri);2984 WinSendMsg(WinWindowFromID2985 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),2986 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));2987 cnri.flWindowAttr = flWindowAttr;2988 WinSendMsg(WinWindowFromID2989 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),2990 CM_SETCNRINFO, MPFROMP(&cnri),2991 MPFROMLONG(CMA_FLWINDOWATTR));2983 CNRINFO cnri; 2984 ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE; 2985 2986 memset(&cnri, 0, sizeof(cnri)); 2987 cnri.cb = sizeof(cnri); 2988 WinSendMsg(WinWindowFromID 2989 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 2990 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 2991 cnri.flWindowAttr = flWindowAttr; 2992 WinSendMsg(WinWindowFromID 2993 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 2994 CM_SETCNRINFO, MPFROMP(&cnri), 2995 MPFROMLONG(CMA_FLWINDOWATTR)); 2992 2996 } 2993 2997 break; … … 3059 3063 fNoTreeGap = TRUE; 3060 3064 { 3061 ULONG flWindowAttr;3062 3063 flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);3064 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",3065 &flWindowAttr, sizeof(ULONG));3066 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",3067 &flWindowAttr, sizeof(ULONG));3065 ULONG flWindowAttr; 3066 3067 flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES); 3068 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr", 3069 &flWindowAttr, sizeof(ULONG)); 3070 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr", 3071 &flWindowAttr, sizeof(ULONG)); 3068 3072 } 3069 3073 dsDirCnrDefault.detailslongname = FALSE; … … 3083 3087 if (hwndMain) { 3084 3088 3085 SWP swp;3086 3087 if (WinQueryWindowPos(hwndMain, &swp)) {3088 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,3089 swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);3090 }3091 if (MenuInvisible)3092 WinSendMsg(hwndMain, WM_COMMAND,3093 MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);3094 if (fAutoView)3095 WinSendMsg(hwndMain, WM_COMMAND,3096 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);3097 if (fToolbar)3098 WinSendMsg(hwndMain, WM_COMMAND,3099 MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);3100 if (!fDrivebar)3101 WinSendMsg(hwndMain, WM_COMMAND,3102 MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);3103 if (!fMoreButtons)3104 WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0),3105 MPVOID);3106 if (!fUserComboBox)3107 WinSendMsg(hwndMain, WM_COMMAND,3108 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);3089 SWP swp; 3090 3091 if (WinQueryWindowPos(hwndMain, &swp)) { 3092 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 3093 swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE); 3094 } 3095 if (MenuInvisible) 3096 WinSendMsg(hwndMain, WM_COMMAND, 3097 MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 3098 if (fAutoView) 3099 WinSendMsg(hwndMain, WM_COMMAND, 3100 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID); 3101 if (fToolbar) 3102 WinSendMsg(hwndMain, WM_COMMAND, 3103 MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 3104 if (!fDrivebar) 3105 WinSendMsg(hwndMain, WM_COMMAND, 3106 MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID); 3107 if (!fMoreButtons) 3108 WinSendMsg(hwndMain, WM_COMMAND, MPFROM2SHORT(IDM_MOREBUTTONS, 0), 3109 MPVOID); 3110 if (!fUserComboBox) 3111 WinSendMsg(hwndMain, WM_COMMAND, 3112 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID); 3109 3113 } 3110 3114 if (hwndTree) { 3111 3115 3112 CNRINFO cnri;3113 ULONG flWindowAttr = (CV_TREE | CV_TEXT | CV_MINI |3114 CV_FLOW | CA_TREELINE);3115 3116 memset(&cnri, 0, sizeof(cnri));3117 cnri.cb = sizeof(cnri);3118 WinSendMsg(WinWindowFromID3119 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3120 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));3121 cnri.flWindowAttr = flWindowAttr;3122 WinSendMsg(WinWindowFromID3123 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3124 CM_SETCNRINFO, MPFROMP(&cnri),3125 MPFROMLONG(CMA_FLWINDOWATTR));3116 CNRINFO cnri; 3117 ULONG flWindowAttr = (CV_TREE | CV_TEXT | CV_MINI | 3118 CV_FLOW | CA_TREELINE); 3119 3120 memset(&cnri, 0, sizeof(cnri)); 3121 cnri.cb = sizeof(cnri); 3122 WinSendMsg(WinWindowFromID 3123 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3124 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 3125 cnri.flWindowAttr = flWindowAttr; 3126 WinSendMsg(WinWindowFromID 3127 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3128 CM_SETCNRINFO, MPFROMP(&cnri), 3129 MPFROMLONG(CMA_FLWINDOWATTR)); 3126 3130 } 3127 3131 break; … … 3176 3180 fNoTreeGap = FALSE; 3177 3181 { 3178 ULONG flWindowAttr;3179 3180 flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES);3181 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",3182 &flWindowAttr, sizeof(ULONG));3183 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",3184 &flWindowAttr, sizeof(ULONG));3182 ULONG flWindowAttr; 3183 3184 flWindowAttr = (CV_NAME | CV_MINI | CV_FLOW | CA_DETAILSVIEWTITLES); 3185 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr", 3186 &flWindowAttr, sizeof(ULONG)); 3187 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr", 3188 &flWindowAttr, sizeof(ULONG)); 3185 3189 } 3186 3190 dsDirCnrDefault.detailslongname = FALSE; … … 3200 3204 if (hwndMain) { 3201 3205 3202 SWP swp;3203 3204 if (WinQueryWindowPos(hwndMain, &swp)) {3205 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,3206 swp.cx / 5,3207 swp.cy -3208 (WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2),3209 SWP_MOVE | SWP_SIZE);3210 }3206 SWP swp; 3207 3208 if (WinQueryWindowPos(hwndMain, &swp)) { 3209 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 3210 swp.cx / 5, 3211 swp.cy - 3212 (WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2), 3213 SWP_MOVE | SWP_SIZE); 3214 } 3211 3215 } 3212 3216 if (hwndTree) { 3213 3217 3214 CNRINFO cnri;3215 ULONG flWindowAttr = (CV_TREE | CV_TEXT |3216 CV_FLOW | CA_TREELINE | CV_MINI);3217 3218 memset(&cnri, 0, sizeof(cnri));3219 cnri.cb = sizeof(cnri);3220 WinSendMsg(WinWindowFromID3221 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3222 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));3223 cnri.flWindowAttr = flWindowAttr;3224 WinSendMsg(WinWindowFromID3225 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3226 CM_SETCNRINFO, MPFROMP(&cnri),3227 MPFROMLONG(CMA_FLWINDOWATTR));3218 CNRINFO cnri; 3219 ULONG flWindowAttr = (CV_TREE | CV_TEXT | 3220 CV_FLOW | CA_TREELINE | CV_MINI); 3221 3222 memset(&cnri, 0, sizeof(cnri)); 3223 cnri.cb = sizeof(cnri); 3224 WinSendMsg(WinWindowFromID 3225 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3226 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 3227 cnri.flWindowAttr = flWindowAttr; 3228 WinSendMsg(WinWindowFromID 3229 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3230 CM_SETCNRINFO, MPFROMP(&cnri), 3231 MPFROMLONG(CMA_FLWINDOWATTR)); 3228 3232 } 3229 3233 break; … … 3240 3244 fDCOpens = FALSE; 3241 3245 { 3242 ULONG flWindowAttr;3243 3244 flWindowAttr = CV_NAME | CV_FLOW | CA_DETAILSVIEWTITLES;3245 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",3246 &flWindowAttr, sizeof(ULONG));3247 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",3248 &flWindowAttr, sizeof(ULONG));3246 ULONG flWindowAttr; 3247 3248 flWindowAttr = CV_NAME | CV_FLOW | CA_DETAILSVIEWTITLES; 3249 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr", 3250 &flWindowAttr, sizeof(ULONG)); 3251 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr", 3252 &flWindowAttr, sizeof(ULONG)); 3249 3253 } 3250 3254 fLinkSetsIcon = FALSE; … … 3257 3261 fUserListSwitches = TRUE; 3258 3262 WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), UM_UNDO, MPVOID, 3259 MPVOID);3263 MPVOID); 3260 3264 if (hwndTree) { 3261 3265 3262 CNRINFO cnri;3263 ULONG flWindowAttr = CV_TREE | CV_MINI | CV_ICON |3264 CV_FLOW | CA_TREELINE;3265 3266 memset(&cnri, 0, sizeof(cnri));3267 cnri.cb = sizeof(cnri);3268 WinSendMsg(WinWindowFromID3269 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3270 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));3271 cnri.flWindowAttr = flWindowAttr;3272 WinSendMsg(WinWindowFromID3273 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3274 CM_SETCNRINFO, MPFROMP(&cnri),3275 MPFROMLONG(CMA_FLWINDOWATTR));3266 CNRINFO cnri; 3267 ULONG flWindowAttr = CV_TREE | CV_MINI | CV_ICON | 3268 CV_FLOW | CA_TREELINE; 3269 3270 memset(&cnri, 0, sizeof(cnri)); 3271 cnri.cb = sizeof(cnri); 3272 WinSendMsg(WinWindowFromID 3273 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3274 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 3275 cnri.flWindowAttr = flWindowAttr; 3276 WinSendMsg(WinWindowFromID 3277 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3278 CM_SETCNRINFO, MPFROMP(&cnri), 3279 MPFROMLONG(CMA_FLWINDOWATTR)); 3276 3280 } 3277 3281 if (hwndMain) { 3278 if (fAutoView)3279 WinSendMsg(hwndMain, WM_COMMAND,3280 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);3281 if (!fDrivebar)3282 WinSendMsg(hwndMain, WM_COMMAND,3283 MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID);3284 {3285 SWP swp;3286 3287 if (WinQueryWindowPos(hwndMain, &swp)) {3288 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,3289 swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);3290 }3291 }3292 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));3293 PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID);3282 if (fAutoView) 3283 WinSendMsg(hwndMain, WM_COMMAND, 3284 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID); 3285 if (!fDrivebar) 3286 WinSendMsg(hwndMain, WM_COMMAND, 3287 MPFROM2SHORT(IDM_DRIVEBAR, 0), MPVOID); 3288 { 3289 SWP swp; 3290 3291 if (WinQueryWindowPos(hwndMain, &swp)) { 3292 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 3293 swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE); 3294 } 3295 } 3296 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L)); 3297 PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1L), MPVOID); 3294 3298 } 3295 3299 return 0; … … 3305 3309 fTopDir = FALSE; 3306 3310 if (hwndMain) { 3307 if (!fTextTools)3308 WinSendMsg(hwndMain, WM_COMMAND,3309 MPFROM2SHORT(IDM_TEXTTOOLS, 0), MPVOID);3311 if (!fTextTools) 3312 WinSendMsg(hwndMain, WM_COMMAND, 3313 MPFROM2SHORT(IDM_TEXTTOOLS, 0), MPVOID); 3310 3314 } 3311 3315 { 3312 ULONG flWindowAttr;3313 3314 flWindowAttr = CV_TEXT | CV_FLOW | CA_DETAILSVIEWTITLES;3315 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr",3316 &flWindowAttr, sizeof(ULONG));3317 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",3318 &flWindowAttr, sizeof(ULONG));3316 ULONG flWindowAttr; 3317 3318 flWindowAttr = CV_TEXT | CV_FLOW | CA_DETAILSVIEWTITLES; 3319 PrfWriteProfileData(fmprof, appname, "DirflWindowAttr", 3320 &flWindowAttr, sizeof(ULONG)); 3321 PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr", 3322 &flWindowAttr, sizeof(ULONG)); 3319 3323 } 3320 3324 if (hwndTree) { 3321 3325 3322 CNRINFO cnri;3323 ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE;3324 3325 memset(&cnri, 0, sizeof(cnri));3326 cnri.cb = sizeof(cnri);3327 WinSendMsg(WinWindowFromID3328 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3329 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));3330 cnri.flWindowAttr = flWindowAttr;3331 WinSendMsg(WinWindowFromID3332 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),3333 CM_SETCNRINFO, MPFROMP(&cnri),3334 MPFROMLONG(CMA_FLWINDOWATTR));3326 CNRINFO cnri; 3327 ULONG flWindowAttr = CV_TREE | CV_TEXT | CV_FLOW | CA_TREELINE; 3328 3329 memset(&cnri, 0, sizeof(cnri)); 3330 cnri.cb = sizeof(cnri); 3331 WinSendMsg(WinWindowFromID 3332 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3333 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 3334 cnri.flWindowAttr = flWindowAttr; 3335 WinSendMsg(WinWindowFromID 3336 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 3337 CM_SETCNRINFO, MPFROMP(&cnri), 3338 MPFROMLONG(CMA_FLWINDOWATTR)); 3335 3339 } 3336 3340 /* intentional fallthru */ 3337 3341 case CFG9_1X: 3338 3342 if (SHORT1FROMMP(mp1) == CFG9_1X) { 3339 fTileBackwards = FALSE;3340 ulCnrType = CCS_MULTIPLESEL | CCS_EXTENDSEL;3341 fSwitchTree = FALSE;3342 fSwitchTreeOnFocus = FALSE;3343 fSwitchTreeExpand = FALSE;3344 fCollapseFirst = FALSE;3345 fFollowTree = FALSE;3346 fNoSearch = TRUE;3343 fTileBackwards = FALSE; 3344 ulCnrType = CCS_MULTIPLESEL | CCS_EXTENDSEL; 3345 fSwitchTree = FALSE; 3346 fSwitchTreeOnFocus = FALSE; 3347 fSwitchTreeExpand = FALSE; 3348 fCollapseFirst = FALSE; 3349 fFollowTree = FALSE; 3350 fNoSearch = TRUE; 3347 3351 } 3348 3352 fAutoTile = TRUE; … … 3358 3362 fUserListSwitches = TRUE; 3359 3363 WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), UM_UNDO, MPVOID, 3360 MPVOID);3364 MPVOID); 3361 3365 if (hwndTree) { 3362 3366 3363 CNRINFO cnri;3364 ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE;3365 3366 memset(&cnri, 0, sizeof(cnri));3367 cnri.cb = sizeof(cnri);3368 WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),3369 TREE_CNR),3370 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri)));3371 cnri.flWindowAttr = flWindowAttr;3372 WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT),3373 TREE_CNR),3374 CM_SETCNRINFO,3375 MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR));3367 CNRINFO cnri; 3368 ULONG flWindowAttr = CV_TREE | CV_ICON | CV_FLOW | CA_TREELINE; 3369 3370 memset(&cnri, 0, sizeof(cnri)); 3371 cnri.cb = sizeof(cnri); 3372 WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT), 3373 TREE_CNR), 3374 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(cnri))); 3375 cnri.flWindowAttr = flWindowAttr; 3376 WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, FID_CLIENT), 3377 TREE_CNR), 3378 CM_SETCNRINFO, 3379 MPFROMP(&cnri), MPFROMLONG(CMA_FLWINDOWATTR)); 3376 3380 } 3377 3381 if (hwndMain) { 3378 if (fAutoView)3379 WinSendMsg(hwndMain, WM_COMMAND,3380 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID);3381 if (fUserComboBox)3382 WinSendMsg(hwndMain, WM_COMMAND,3383 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID);3384 {3385 SWP swp;3386 3387 if (WinQueryWindowPos(hwndMain, &swp)) {3388 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0,3389 swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE);3390 }3391 }3392 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));3393 PostMsg(MainObjectHwnd, UM_SETDIR, MPVOID, MPVOID);3382 if (fAutoView) 3383 WinSendMsg(hwndMain, WM_COMMAND, 3384 MPFROM2SHORT(IDM_AUTOVIEW, 0), MPVOID); 3385 if (fUserComboBox) 3386 WinSendMsg(hwndMain, WM_COMMAND, 3387 MPFROM2SHORT(IDM_USERLIST, 0), MPVOID); 3388 { 3389 SWP swp; 3390 3391 if (WinQueryWindowPos(hwndMain, &swp)) { 3392 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 3393 swp.cx / 5, swp.cy, SWP_MOVE | SWP_SIZE); 3394 } 3395 } 3396 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L)); 3397 PostMsg(MainObjectHwnd, UM_SETDIR, MPVOID, MPVOID); 3394 3398 } 3395 3399 return 0; … … 3407 3411 // Save new details settings and refresh windows 3408 3412 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname", 3409 &dsDirCnrDefault.detailslongname, sizeof(BOOL));3413 &dsDirCnrDefault.detailslongname, sizeof(BOOL)); 3410 3414 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject", 3411 &dsDirCnrDefault.detailssubject, sizeof(BOOL));3415 &dsDirCnrDefault.detailssubject, sizeof(BOOL)); 3412 3416 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA", 3413 &dsDirCnrDefault.detailsea, sizeof(BOOL));3417 &dsDirCnrDefault.detailsea, sizeof(BOOL)); 3414 3418 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize", 3415 &dsDirCnrDefault.detailssize, sizeof(BOOL));3419 &dsDirCnrDefault.detailssize, sizeof(BOOL)); 3416 3420 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon", 3417 &dsDirCnrDefault.detailsicon, sizeof(BOOL));3421 &dsDirCnrDefault.detailsicon, sizeof(BOOL)); 3418 3422 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate", 3419 &dsDirCnrDefault.detailslwdate, sizeof(BOOL));3423 &dsDirCnrDefault.detailslwdate, sizeof(BOOL)); 3420 3424 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime", 3421 &dsDirCnrDefault.detailslwtime, sizeof(BOOL));3425 &dsDirCnrDefault.detailslwtime, sizeof(BOOL)); 3422 3426 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate", 3423 &dsDirCnrDefault.detailsladate, sizeof(BOOL));3427 &dsDirCnrDefault.detailsladate, sizeof(BOOL)); 3424 3428 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime", 3425 &dsDirCnrDefault.detailslatime, sizeof(BOOL));3429 &dsDirCnrDefault.detailslatime, sizeof(BOOL)); 3426 3430 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate", 3427 &dsDirCnrDefault.detailscrdate, sizeof(BOOL));3431 &dsDirCnrDefault.detailscrdate, sizeof(BOOL)); 3428 3432 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime", 3429 &dsDirCnrDefault.detailscrtime, sizeof(BOOL));3433 &dsDirCnrDefault.detailscrtime, sizeof(BOOL)); 3430 3434 PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr", 3431 &dsDirCnrDefault.detailsattr, sizeof(BOOL));3435 &dsDirCnrDefault.detailsattr, sizeof(BOOL)); 3432 3436 if (hwndMain) { 3433 3437 // Save state and restore to refresh windows with new settings 3434 3438 if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) { 3435 // Tell window procedure to close container windows3436 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));3437 // Restore saved state3438 PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID);3439 // Tell window procedure to close container windows 3440 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2)); 3441 // Restore saved state 3442 PostMsg(MainObjectHwnd, UM_RESTORE, GetPString(IDS_FM2TEMPTEXT), MPVOID); 3439 3443 } 3440 3444 } 3441 3445 WinSendMsg((HWND) WinQueryWindowULong(hwnd, QWL_USER), 3442 UM_UNDO, MPVOID, MPVOID);3446 UM_UNDO, MPVOID, MPVOID); 3443 3447 return 0; 3444 3448 … … 3475 3479 { IDM_BUBBLESSETTINGS, CFGB_FRAME, IDS_NOTEBUBBLE1TEXT, CfgBDlgProc, 0, 0, 0 }, 3476 3480 { IDM_QUICKSETTINGS, CFG9_FRAME, IDS_NOTEQUICK1TEXT, Cfg9DlgProc, 0, 0, 0 }, 3477 { 0, 0, 0, NULL, 0, 0, 0 } // usFrameId 0 is end marker3481 { 0, 0, 0, NULL, 0, 0, 0 } // usFrameId 0 is end marker 3478 3482 }; 3479 3483 … … 3513 3517 hwndTemp = WinQueryWindow(hwnd, QW_OWNER); 3514 3518 if (hwndTemp != HWND_DESKTOP) { 3515 HWND hwndMenu;3516 // Owner is frame if not applet3517 hwndMenu = WinWindowFromID(hwndTemp, FID_MENU);3518 if (hwndMenu == NULLHANDLE)3519 Runtime_Error(pszSrcFile, __LINE__, "FID_MENU");3520 else {3521 MENUITEM mi;3522 BOOL ok;3523 memset(&mi, 0, sizeof(mi));3524 ok = (BOOL)WinSendMsg(hwndMenu,3525 MM_QUERYITEM,3526 MPFROM2SHORT(IDM_NOTEBOOKSUBMENU, TRUE),3527 MPFROMP(&mi));3528 if (!ok)3529 Runtime_Error(pszSrcFile, __LINE__, "IDM_NOTEBOOKSUBMENU");3530 else {3531 mp2 = WinSendMsg(mi.hwndSubMenu, MM_QUERYDEFAULTITEMID, MPVOID, MPVOID);3532 if (!mp2)3533 Runtime_Error(pszSrcFile, __LINE__, "MM_QUERYDEFAULTITEMID");3534 }3535 }3519 HWND hwndMenu; 3520 // Owner is frame if not applet 3521 hwndMenu = WinWindowFromID(hwndTemp, FID_MENU); 3522 if (hwndMenu == NULLHANDLE) 3523 Runtime_Error(pszSrcFile, __LINE__, "FID_MENU"); 3524 else { 3525 MENUITEM mi; 3526 BOOL ok; 3527 memset(&mi, 0, sizeof(mi)); 3528 ok = (BOOL)WinSendMsg(hwndMenu, 3529 MM_QUERYITEM, 3530 MPFROM2SHORT(IDM_NOTEBOOKSUBMENU, TRUE), 3531 MPFROMP(&mi)); 3532 if (!ok) 3533 Runtime_Error(pszSrcFile, __LINE__, "IDM_NOTEBOOKSUBMENU"); 3534 else { 3535 mp2 = WinSendMsg(mi.hwndSubMenu, MM_QUERYDEFAULTITEMID, MPVOID, MPVOID); 3536 if (!mp2) 3537 Runtime_Error(pszSrcFile, __LINE__, "MM_QUERYDEFAULTITEMID"); 3538 } 3539 } 3536 3540 } 3537 3541 } … … 3539 3543 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 3540 3544 WinSendDlgItemMsg(hwnd, 3541 CFG_NOTEBOOK,3542 BKM_SETDIMENSIONS,3543 MPFROM2SHORT(82, 24), MPFROMLONG(BKA_MAJORTAB));3545 CFG_NOTEBOOK, 3546 BKM_SETDIMENSIONS, 3547 MPFROM2SHORT(82, 24), MPFROMLONG(BKA_MAJORTAB)); 3544 3548 WinSendDlgItemMsg(hwnd, 3545 CFG_NOTEBOOK,3546 BKM_SETDIMENSIONS,3547 MPFROM2SHORT(20, 20), MPFROMLONG(BKA_PAGEBUTTON));3549 CFG_NOTEBOOK, 3550 BKM_SETDIMENSIONS, 3551 MPFROM2SHORT(20, 20), MPFROMLONG(BKA_PAGEBUTTON)); 3548 3552 WinSendDlgItemMsg(hwnd, 3549 CFG_NOTEBOOK,3550 BKM_SETDIMENSIONS,3551 MPFROM2SHORT(0, 0), MPFROMLONG(BKA_MINORTAB));3553 CFG_NOTEBOOK, 3554 BKM_SETDIMENSIONS, 3555 MPFROM2SHORT(0, 0), MPFROMLONG(BKA_MINORTAB)); 3552 3556 3553 3557 // Build and insert notebook pages 3554 3558 for (x = 0; np[x].usFrameId; x++) { 3555 3559 hwndTemp = WinLoadDlg(HWND_DESKTOP, 3556 HWND_DESKTOP,3557 np[x].pfnPageProc, FM3ModHandle, np[x].usFrameId, MPVOID);3560 HWND_DESKTOP, 3561 np[x].pfnPageProc, FM3ModHandle, np[x].usFrameId, MPVOID); 3558 3562 if (!hwndTemp) { 3559 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,3560 "Can not load settings page %u", x);3563 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, 3564 "Can not load settings page %u", x); 3561 3565 } 3562 3566 else { 3563 WinSetWindowULong(hwndTemp, QWL_USER, (ULONG)hwnd);3564 np[x].hwnd = hwndTemp;3565 np[x].ulPageId = (ULONG)WinSendDlgItemMsg(hwnd,3566 CFG_NOTEBOOK,3567 BKM_INSERTPAGE,3568 MPFROMLONG(BKA_FIRST),3569 MPFROM2SHORT(BKA_AUTOPAGESIZE |3570 BKA_STATUSTEXTON |3571 BKA_MAJOR, attrib));3572 attrib = BKA_LAST;3573 WinSendDlgItemMsg(hwnd,3574 CFG_NOTEBOOK,3575 BKM_SETPAGEWINDOWHWND,3576 MPFROMLONG(np[x].ulPageId), MPFROMLONG(np[x].hwnd));3577 WinSendDlgItemMsg(hwnd,3578 CFG_NOTEBOOK,3579 BKM_SETTABTEXT,3580 MPFROMLONG(np[x].ulPageId),3581 MPFROMP(GetPString(np[x].ulTitle)));3582 WinSendDlgItemMsg(hwnd,3583 CFG_NOTEBOOK,3584 BKM_SETSTATUSLINETEXT,3585 MPFROMLONG(np[x].ulPageId),3586 MPFROMP(GetPString(np[x].ulTitle + 1)));3587 3588 if (LONGFROMMP(mp2) == np[x].usMenuId)3589 uPageIndex = x;// Remember selected page3567 WinSetWindowULong(hwndTemp, QWL_USER, (ULONG)hwnd); 3568 np[x].hwnd = hwndTemp; 3569 np[x].ulPageId = (ULONG)WinSendDlgItemMsg(hwnd, 3570 CFG_NOTEBOOK, 3571 BKM_INSERTPAGE, 3572 MPFROMLONG(BKA_FIRST), 3573 MPFROM2SHORT(BKA_AUTOPAGESIZE | 3574 BKA_STATUSTEXTON | 3575 BKA_MAJOR, attrib)); 3576 attrib = BKA_LAST; 3577 WinSendDlgItemMsg(hwnd, 3578 CFG_NOTEBOOK, 3579 BKM_SETPAGEWINDOWHWND, 3580 MPFROMLONG(np[x].ulPageId), MPFROMLONG(np[x].hwnd)); 3581 WinSendDlgItemMsg(hwnd, 3582 CFG_NOTEBOOK, 3583 BKM_SETTABTEXT, 3584 MPFROMLONG(np[x].ulPageId), 3585 MPFROMP(GetPString(np[x].ulTitle))); 3586 WinSendDlgItemMsg(hwnd, 3587 CFG_NOTEBOOK, 3588 BKM_SETSTATUSLINETEXT, 3589 MPFROMLONG(np[x].ulPageId), 3590 MPFROMP(GetPString(np[x].ulTitle + 1))); 3591 3592 if (LONGFROMMP(mp2) == np[x].usMenuId) 3593 uPageIndex = x; // Remember selected page 3590 3594 } 3591 3595 } // for pages … … 3596 3600 // 15 Feb 08 SHL fixme to do just once? 3597 3601 if (mp2 == MPFROMLONG(IDM_QUICKSETTINGS) && 3598 x-- > 0 &&3599 np[x].hwnd &&3600 np[x].usFrameId == CFG9_FRAME)3602 x-- > 0 && 3603 np[x].hwnd && 3604 np[x].usFrameId == CFG9_FRAME) 3601 3605 { 3602 3606 // 10 Jan 08 SHL fixme to document what UM_SETDIR 1 means 3603 3607 //PostMsg(MainObjectHwnd, UM_SETDIR, MPFROMLONG(1), MPVOID); 3604 3608 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3605 BKM_TURNTOPAGE, MPFROMLONG(np[x].ulPageId), MPVOID);3609 BKM_TURNTOPAGE, MPFROMLONG(np[x].ulPageId), MPVOID); 3606 3610 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(np[x].hwnd), MPVOID); 3607 3611 PostMsg(np[x].hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID); … … 3609 3613 else if (uPageIndex >= x) { 3610 3614 Runtime_Error(pszSrcFile, __LINE__, "uPageIndex corrupted (%u)", 3611 uPageIndex);3615 uPageIndex); 3612 3616 uPageIndex = 0; 3613 3617 } 3614 3618 PostMsg(WinWindowFromID(hwnd, CFG_NOTEBOOK), 3615 BKM_TURNTOPAGE, MPFROMLONG(np[uPageIndex].ulPageId), MPVOID);3619 BKM_TURNTOPAGE, MPFROMLONG(np[uPageIndex].ulPageId), MPVOID); 3616 3620 // 15 Feb 08 SHL fixme to put focus on first field of page 3617 3621 … … 3664 3668 SaveLastPageIndex(hwnd); 3665 3669 ulPageId = (ULONG) WinSendDlgItemMsg(hwnd, 3666 CFG_NOTEBOOK,3667 BKM_QUERYPAGEID,3668 MPFROMLONG(0),3669 MPFROM2SHORT(BKA_TOP, 0));3670 CFG_NOTEBOOK, 3671 BKM_QUERYPAGEID, 3672 MPFROMLONG(0), 3673 MPFROM2SHORT(BKA_TOP, 0)); 3670 3674 hwndTemp = (HWND) WinSendDlgItemMsg(hwnd, 3671 CFG_NOTEBOOK,3672 BKM_QUERYPAGEWINDOWHWND,3673 MPFROMLONG(ulPageId), MPVOID);3675 CFG_NOTEBOOK, 3676 BKM_QUERYPAGEWINDOWHWND, 3677 MPFROMLONG(ulPageId), MPVOID); 3674 3678 if (hwndTemp) 3675 WinSendMsg(hwndTemp, UM_UNDO, MPVOID, MPVOID);3679 WinSendMsg(hwndTemp, UM_UNDO, MPVOID, MPVOID); 3676 3680 3677 3681 WinDismissDlg(hwnd, 0); 3678 3682 break; 3679 3683 3680 case IDM_HELP: /* relay message to appropriate page's window */3684 case IDM_HELP: /* relay message to appropriate page's window */ 3681 3685 ulPageId = (ULONG) WinSendDlgItemMsg(hwnd, 3682 CFG_NOTEBOOK,3683 BKM_QUERYPAGEID,3684 MPFROMLONG(0),3685 MPFROM2SHORT(BKA_TOP, 0));3686 CFG_NOTEBOOK, 3687 BKM_QUERYPAGEID, 3688 MPFROMLONG(0), 3689 MPFROM2SHORT(BKA_TOP, 0)); 3686 3690 hwndTemp = (HWND) WinSendDlgItemMsg(hwnd, 3687 CFG_NOTEBOOK,3688 BKM_QUERYPAGEWINDOWHWND,3689 MPFROMLONG(ulPageId), MPVOID);3691 CFG_NOTEBOOK, 3692 BKM_QUERYPAGEWINDOWHWND, 3693 MPFROMLONG(ulPageId), MPVOID); 3690 3694 if (hwndTemp) 3691 PostMsg(hwndTemp, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID);3695 PostMsg(hwndTemp, WM_COMMAND, MPFROM2SHORT(IDM_HELP, 0), MPVOID); 3692 3696 break; 3693 3697 } … … 3697 3701 for (x = 0; np[x].usFrameId; x++) { 3698 3702 if (np[x].hwnd) 3699 WinSendMsg(np[x].hwnd, UM_UNDO, MPVOID, MPVOID);3703 WinSendMsg(np[x].hwnd, UM_UNDO, MPVOID, MPVOID); 3700 3704 } 3701 3705 break; … … 3704 3708 if (np[0].usFrameId) { 3705 3709 for (x = 1; np[x].usFrameId; x++) { 3706 if (np[x].hwnd) {3707 WinSendMsg(np[x].hwnd, WM_CLOSE, MPVOID, MPVOID);3708 np[x].hwnd = (HWND) 0;3709 np[x].ulPageId = 0;3710 }3710 if (np[x].hwnd) { 3711 WinSendMsg(np[x].hwnd, WM_CLOSE, MPVOID, MPVOID); 3712 np[x].hwnd = (HWND) 0; 3713 np[x].ulPageId = 0; 3714 } 3711 3715 } 3712 3716 WinSendMsg(np[0].hwnd, WM_CLOSE, MPVOID, MPVOID); … … 3735 3739 PrfQueryProfileData(fmprof, appname, pszIK_LastSettingsPage, &uPageIndex, &ulSize); 3736 3740 for (x = 0; x < uPageIndex && np[x].usFrameId; x++) 3737 ; // Search3741 ; // Search 3738 3742 if (np[x].usMenuId) 3739 3743 SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[uPageIndex].usMenuId); … … 3741 3745 if (fIsLite) { 3742 3746 WinSendMsg(hwndMenu, 3743 MM_DELETEITEM,3744 MPFROM2SHORT(IDM_QUICKSETTINGS, FALSE), MPVOID);3747 MM_DELETEITEM, 3748 MPFROM2SHORT(IDM_QUICKSETTINGS, FALSE), MPVOID); 3745 3749 // If fm/2 lite drop quick setting page 3746 3750 for (x = 0; np[x].usFrameId && np[x].usFrameId != CFG9_FRAME; x++) … … 3761 3765 if (hwndOwner != HWND_DESKTOP) { 3762 3766 ulPageId = (ULONG)WinSendDlgItemMsg(hwnd, 3763 CFG_NOTEBOOK,3764 BKM_QUERYPAGEID,3765 MPFROMLONG(0),3766 MPFROM2SHORT(BKA_TOP, 0));3767 CFG_NOTEBOOK, 3768 BKM_QUERYPAGEID, 3769 MPFROMLONG(0), 3770 MPFROM2SHORT(BKA_TOP, 0)); 3767 3771 if (!ulPageId) 3768 3772 Runtime_Error(pszSrcFile, __LINE__, "BKM_QUERYPAGEID"); 3769 3773 else { 3770 3774 for (x = 0; np[x].usMenuId && np[x].ulPageId != ulPageId; x++) 3771 ; // Scan3775 ; // Scan 3772 3776 if (!np[x].usMenuId) 3773 Runtime_Error(pszSrcFile, __LINE__, "bad menu id %lu", ulPageId);3777 Runtime_Error(pszSrcFile, __LINE__, "bad menu id %lu", ulPageId); 3774 3778 else { 3775 PrfWriteProfileData(fmprof, FM3Str, pszIK_LastSettingsPage,3776 (PVOID)&x, sizeof(x));3777 hwndMenu = WinWindowFromID(hwndOwner, FID_MENU);3778 SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[x].usMenuId);3779 PrfWriteProfileData(fmprof, FM3Str, pszIK_LastSettingsPage, 3780 (PVOID)&x, sizeof(x)); 3781 hwndMenu = WinWindowFromID(hwndOwner, FID_MENU); 3782 SetConditionalCascade(hwndMenu, IDM_NOTEBOOKSUBMENU, np[x].usMenuId); 3779 3783 } 3780 3784 }  - 
      
trunk/dll/pathutil.c
r1047 r1161 23 23 24 24 #include "pathutil.h" 25 #include "strips.h" // remove_first_occurence_of_character 25 26 #include "fm3dll.h" // needs_quoting 26 27 #include "fm3str.h" … … 64 65 { 65 66 UINT c = pszPathName ? strlen(pszPathName) : 0; 66 BOOL q = needs_quoting(pszPathName) || 67 needs_quoting(pszFileName); 67 BOOL q = needs_quoting(pszPathName) || needs_quoting(pszFileName); 68 68 PSZ psz = pszFullPathName; 69 69  - 
      
trunk/dll/sortcnr.c
r907 r1161 21 21 22 22 #include "fm3dll.h" 23 #include "sortcnr.h" 24 #include "valid.h" // TestCDates 25 26 static SHORT SortCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2, INT Sortflags); 23 27 24 28 SHORT APIENTRY SortTreeCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2, 25 PVOID pStorage)29 PVOID pStorage) 26 30 { 27 31 return SortCnr(p1, p2, ((pStorage) ? (INT) pStorage : TreesortFlags)); … … 29 33 30 34 SHORT APIENTRY SortDirCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2, 31 PVOID pStorage)35 PVOID pStorage) 32 36 { 33 37 DIRCNRDATA *dcd = WinQueryWindowPtr(((PCNRITEM) p1)->hwndCnr, QWL_USER); 34 38 35 39 return SortCnr(p1, p2, ((pStorage) ? (INT) pStorage : 36 (dcd && dcd->size == sizeof(DIRCNRDATA)) ?37 dcd->sortFlags : sortFlags));40 (dcd && dcd->size == sizeof(DIRCNRDATA)) ? 41 dcd->sortFlags : sortFlags)); 38 42 } 39 43 40 44 SHORT APIENTRY SortCollectorCnr(PMINIRECORDCORE p1, PMINIRECORDCORE p2, 41 PVOID pStorage)45 PVOID pStorage) 42 46 { 43 47 return SortCnr(p1, p2, ((pStorage) ? (INT) pStorage : CollectorsortFlags)); … … 56 60 if (SortFlags & SORT_DIRSFIRST) { 57 61 if ((pCI1->attrFile & FILE_DIRECTORY) != 58 (pCI2->attrFile & FILE_DIRECTORY))59 return (pCI1->attrFile & FILE_DIRECTORY) ? -1 : 1;62 (pCI2->attrFile & FILE_DIRECTORY)) 63 return (pCI1->attrFile & FILE_DIRECTORY) ? -1 : 1; 60 64 } 61 65 else if (SortFlags & SORT_DIRSLAST) { 62 66 if ((pCI1->attrFile & FILE_DIRECTORY) != 63 (pCI2->attrFile & FILE_DIRECTORY))64 return (pCI1->attrFile & FILE_DIRECTORY) ? 1 : -1;67 (pCI2->attrFile & FILE_DIRECTORY)) 68 return (pCI1->attrFile & FILE_DIRECTORY) ? 1 : -1; 65 69 } 66 70 switch (SortFlags & (~(SORT_DIRSFIRST | SORT_DIRSLAST | SORT_REVERSE))) { 67 71 case SORT_SUBJECT: 68 72 if (*pCI1->pszSubject && *pCI2->pszSubject) 69 ret = stricmp(pCI1->pszSubject, pCI2->pszSubject);73 ret = stricmp(pCI1->pszSubject, pCI2->pszSubject); 70 74 else { 71 ret = (*pCI2->pszSubject) ? 1 : (*pCI1->pszSubject) ? -1 : 0;72 if (ret && (SortFlags & SORT_REVERSE))73 ret = (ret > 0) ? -1 : 1;75 ret = (*pCI2->pszSubject) ? 1 : (*pCI1->pszSubject) ? -1 : 0; 76 if (ret && (SortFlags & SORT_REVERSE)) 77 ret = (ret > 0) ? -1 : 1; 74 78 } 75 79 break; … … 79 83 pch2 = strrchr(pCI2->pszFileName, '\\'); 80 84 if (!pch1) 81 pch1 = NullStr;82 if (!pch2) 83 pch2 = NullStr;85 pch1 = NullStr; 86 if (!pch2) 87 pch2 = NullStr; 84 88 ret = stricmp(pch1, pch2); 85 89 break; … … 89 93 pch2 = strrchr(pCI2->pszFileName, '\\'); 90 94 if (!pch1) 91 pch1 = pCI1->pszFileName;92 if (!pch2) 93 pch2 = pCI2->pszFileName;95 pch1 = pCI1->pszFileName; 96 if (!pch2) 97 pch2 = pCI2->pszFileName; 94 98 pch1 = strchr(pch1, '.'); 95 99 pch2 = strchr(pch2, '.'); 96 100 if (!pch1) 97 pch1 = NullStr;98 if (!pch2) 99 pch2 = NullStr;101 pch1 = NullStr; 102 if (!pch2) 103 pch2 = NullStr; 100 104 ret = stricmp(pch1, pch2); 101 105 break; … … 105 109 pch2 = strrchr(pCI2->pszFileName, '\\'); 106 110 if (!pch1) 107 pch1 = pCI1->pszFileName;108 if (!pch2) 109 pch2 = pCI2->pszFileName;111 pch1 = pCI1->pszFileName; 112 if (!pch2) 113 pch2 = pCI2->pszFileName; 110 114 pch1 = strrchr(pch1, '.'); 111 115 pch2 = strrchr(pch2, '.'); 112 116 if (!pch1) 113 pch1 = NullStr;114 if (!pch2) 115 pch2 = NullStr;117 pch1 = NullStr; 118 if (!pch2) 119 pch2 = NullStr; 116 120 ret = stricmp(pch1, pch2); 117 121 break; … … 119 123 case SORT_SIZE: 120 124 ret = 121 (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile ==122 pCI2->cbFile) ? 0 : -1;125 (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile == 126 pCI2->cbFile) ? 0 : -1; 123 127 if (!ret) 124 ret =125 (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize ==126 pCI2->easize) ? 0 : -1;128 ret = 129 (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize == 130 pCI2->easize) ? 0 : -1; 127 131 break; 128 132 129 133 case SORT_EASIZE: 130 134 ret = 131 (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize ==132 pCI2->easize) ? 0 : -1;135 (pCI1->easize < pCI2->easize) ? 1 : (pCI1->easize == 136 pCI2->easize) ? 0 : -1; 133 137 if (!ret) 134 ret =135 (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile ==136 pCI2->cbFile) ? 0 : -1;138 ret = 139 (pCI1->cbFile < pCI2->cbFile) ? 1 : (pCI1->cbFile == 140 pCI2->cbFile) ? 0 : -1; 137 141 break; 138 142 … … 141 145 &pCI2->date, &pCI2->time); 142 146 /*(pCI1->date.year < pCI2->date.year) ? 1 : 143 (pCI1->date.year > pCI2->date.year) ? -1 :144 (pCI1->date.month < pCI2->date.month) ? 1 :145 (pCI1->date.month > pCI2->date.month) ? -1 :146 (pCI1->date.day < pCI2->date.day) ? 1 :147 (pCI1->date.day > pCI2->date.day) ? -1 :148 (pCI1->time.hours < pCI2->time.hours) ? 1 :149 (pCI1->time.hours > pCI2->time.hours) ? -1 :150 (pCI1->time.minutes < pCI2->time.minutes) ? 1 :151 (pCI1->time.minutes > pCI2->time.minutes) ? -1 :152 (pCI1->time.seconds < pCI2->time.seconds) ? 1 :153 (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;*/147 (pCI1->date.year > pCI2->date.year) ? -1 : 148 (pCI1->date.month < pCI2->date.month) ? 1 : 149 (pCI1->date.month > pCI2->date.month) ? -1 : 150 (pCI1->date.day < pCI2->date.day) ? 1 : 151 (pCI1->date.day > pCI2->date.day) ? -1 : 152 (pCI1->time.hours < pCI2->time.hours) ? 1 : 153 (pCI1->time.hours > pCI2->time.hours) ? -1 : 154 (pCI1->time.minutes < pCI2->time.minutes) ? 1 : 155 (pCI1->time.minutes > pCI2->time.minutes) ? -1 : 156 (pCI1->time.seconds < pCI2->time.seconds) ? 1 : 157 (pCI1->time.seconds > pCI2->time.seconds) ? -1 : 0;*/ 154 158 break; 155 159 … … 158 162 &pCI2->ladate, &pCI2->latime); 159 163 /*(pCI1->ladate.year < pCI2->ladate.year) ? 1 : 160 (pCI1->ladate.year > pCI2->ladate.year) ? -1 :161 (pCI1->ladate.month < pCI2->ladate.month) ? 1 :162 (pCI1->ladate.month > pCI2->ladate.month) ? -1 :163 (pCI1->ladate.day < pCI2->ladate.day) ? 1 :164 (pCI1->ladate.day > pCI2->ladate.day) ? -1 :165 (pCI1->latime.hours < pCI2->latime.hours) ? 1 :166 (pCI1->latime.hours > pCI2->latime.hours) ? -1 :167 (pCI1->latime.minutes < pCI2->latime.minutes) ? 1 :168 (pCI1->latime.minutes > pCI2->latime.minutes) ? -1 :169 (pCI1->latime.seconds < pCI2->latime.seconds) ? 1 :170 (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;*/164 (pCI1->ladate.year > pCI2->ladate.year) ? -1 : 165 (pCI1->ladate.month < pCI2->ladate.month) ? 1 : 166 (pCI1->ladate.month > pCI2->ladate.month) ? -1 : 167 (pCI1->ladate.day < pCI2->ladate.day) ? 1 : 168 (pCI1->ladate.day > pCI2->ladate.day) ? -1 : 169 (pCI1->latime.hours < pCI2->latime.hours) ? 1 : 170 (pCI1->latime.hours > pCI2->latime.hours) ? -1 : 171 (pCI1->latime.minutes < pCI2->latime.minutes) ? 1 : 172 (pCI1->latime.minutes > pCI2->latime.minutes) ? -1 : 173 (pCI1->latime.seconds < pCI2->latime.seconds) ? 1 : 174 (pCI1->latime.seconds > pCI2->latime.seconds) ? -1 : 0;*/ 171 175 break; 172 176 … … 175 179 &pCI2->crdate, &pCI2->crtime); 176 180 /*(pCI1->crdate.year < pCI2->crdate.year) ? 1 : 177 (pCI1->crdate.year > pCI2->crdate.year) ? -1 :178 (pCI1->crdate.month < pCI2->crdate.month) ? 1 :179 (pCI1->crdate.month > pCI2->crdate.month) ? -1 :180 (pCI1->crdate.day < pCI2->crdate.day) ? 1 :181 (pCI1->crdate.day > pCI2->crdate.day) ? -1 :182 (pCI1->crtime.hours < pCI2->crtime.hours) ? 1 :183 (pCI1->crtime.hours > pCI2->crtime.hours) ? -1 :184 (pCI1->crtime.minutes < pCI2->crtime.minutes) ? 1 :185 (pCI1->crtime.minutes > pCI2->crtime.minutes) ? -1 :186 (pCI1->crtime.seconds < pCI2->crtime.seconds) ? 1 :187 (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;*/181 (pCI1->crdate.year > pCI2->crdate.year) ? -1 : 182 (pCI1->crdate.month < pCI2->crdate.month) ? 1 : 183 (pCI1->crdate.month > pCI2->crdate.month) ? -1 : 184 (pCI1->crdate.day < pCI2->crdate.day) ? 1 : 185 (pCI1->crdate.day > pCI2->crdate.day) ? -1 : 186 (pCI1->crtime.hours < pCI2->crtime.hours) ? 1 : 187 (pCI1->crtime.hours > pCI2->crtime.hours) ? -1 : 188 (pCI1->crtime.minutes < pCI2->crtime.minutes) ? 1 : 189 (pCI1->crtime.minutes > pCI2->crtime.minutes) ? -1 : 190 (pCI1->crtime.seconds < pCI2->crtime.seconds) ? 1 : 191 (pCI1->crtime.seconds > pCI2->crtime.seconds) ? -1 : 0;*/ 188 192 break; 189 193 }  - 
      
trunk/dll/srchpath.c
r907 r1161 25 25 #include "pathutil.h" // BldQuotedFileName 26 26 #include "errutil.h" // Dos_Error... 27 #include "srchpath.h" 27 28 #include "fm3dll.h" 28 29  - 
      
trunk/dll/undel.c
r1075 r1161 33 33 #include "strutil.h" // GetPString 34 34 #include "pathutil.h" // BldFullPathName 35 #include "walkem.h" // FillPathListBox 35 36 #include "fm3dll.h" 36 37 #include "fortify.h"  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  