Changeset 1156
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/attribs.c
r907 r1156 25 25 #include "errutil.h" // Runtime_Error 26 26 #include "strutil.h" // GetPString 27 #include "defview.h" // QuickView 28 #include "attribs.h" 27 29 #include "fm3dll.h" 28 30 -
trunk/dll/cmdline.c
r1119 r1156 37 37 #include "errutil.h" // Dos_Error... 38 38 #include "strutil.h" // GetPString 39 #include "mainwnd.h" // BubbleHelp 40 #include "cmdline.h" // CmdLineDlgProc, CmdLine2DlgProc 39 41 #include "fm3dll.h" 40 42 #include "pathutil.h" // MaxCmdLineStr -
trunk/dll/datamin.c
r1063 r1156 41 41 #include "errutil.h" // Dos_Error... 42 42 #include "strutil.h" // GetPString 43 #include "commafmt.h" // CommaFmtUL 44 #include "killproc.h" // KillDlgProc 45 #include "sysinfo.h" // SysInfoDlgProc 46 #include "mainwnd.h" // TopWindowName 43 47 #include "fm3dll.h" 44 48 #include "fortify.h" -
trunk/dll/dircnrs.c
r1120 r1156 1 2 1 /*********************************************************************** 3 2 … … 75 74 #include "notebook.h" // CfgDlgProc 76 75 #include "command.h" // RunCommand 76 #include "worker.h" // Action, MassAction 77 #include "misc.h" // GetTidForThread, AdjustCnrColsForFSType, AdjustCnrColsForPref 78 // AdjustDetailsSwitches, CnrDirectEdit, OpenEdit, QuickPopup 79 // SayFilter, SaySort, SayView, SetCnrCols, SetDetailsSwitches 80 // SetSortChecks, SetViewMenu, SwitchCommand 81 #include "chklist.h" // CenterOverWindow, DropListProc 82 #include "common.h" // CommonCnrProc, CommonCreateTextChildren, CommonFrameWndProc 83 // CommonTextPaint 84 #include "mainwnd.h" // CountDirCnrs, MakeBubble, TopWindow 85 #include "select.h" // DeselectAll, HideAll, InvertAll, SelectAll, SelectList 86 // SpecialSelect2 87 #include "dirsize.h" // DirSizeProc 88 #include "flesh.h" // Flesh, Stubby, UnFlesh 89 #include "valid.h" // IsValidDir 90 #include "objwin.h" // MakeObjWin 91 #include "notify.h" // NotifyError 92 #include "objcnr.h" // ObjCnrDlgProc 93 #include "draglist.h" // PickUp 94 #include "saveclip.h" // SaveListDlgProc 95 #include "findrec.h" // ShowCnrRecord 96 #include "sortcnr.h" // SortDirCnr 97 #include "seeall.h" // StartSeeAll 98 #include "update.h" // UpdateCnrList, UpdateCnrRecord 99 #include "walkem.h" // add_udir 100 #include "strips.h" // chop_at_crnl 77 101 #include "fm3dll.h" 78 102 //#include "avl.h" // free_archivers 79 #ifdef FORTIFY80 #include "misc.h" // GetTidForThread81 #endif82 103 #include "fortify.h" 83 104 -
trunk/dll/dirsize.c
r1114 r1156 61 61 #include "strutil.h" // GetPString 62 62 #include "filldir.h" // EmptyCnr... 63 #include "dirsize.h" 64 #include "select.h" // ExpandAll 63 65 #include "fm3dll.h" 64 66 -
trunk/dll/init.c
r1130 r1156 44 44 29 Feb 08 GKY Refactor global command line variables to notebook.h 45 45 08 Mar 08 JBS Ticket 230: Replace prefixless INI keys for default directory containers with 46 keys using a "DirCnr." prefix46 keys using a "DirCnr." prefix 47 47 20 Apr 08 GKY Change default cmd line length to 1024 Ask once if user wants to reset it. 48 48 11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating 49 all the details view settings (both the global variables and those in the50 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.49 all the details view settings (both the global variables and those in the 50 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS. 51 51 16 JUL 08 GKY Use TMP directory for temp files 52 52 17 Jul 08 SHL Reduce code bulk in fUseTmp setup … … 82 82 #include "fm3str.h" 83 83 #include "version.h" 84 #include "pathutil.h" // BldFullPathName 85 #include "arccnrs.h" // ArcClientWndProc 86 #include "errutil.h" // Dos_Error... 87 #include "strutil.h" // GetPString 84 #include "pathutil.h" // BldFullPathName 85 #include "arccnrs.h" // ArcClientWndProc 86 #include "errutil.h" // Dos_Error... 87 #include "strutil.h" // GetPString 88 #include "valid.h" // ArgDriveFlags 89 #include "autoview.h" // AutoViewProc 90 #include "mainwnd.h" // BubbleProc, ChildButtonProc, DriveBackProc, 91 // DriveProc, LEDProc, MainWndProc, StatusProc 92 // ToolBackProc 93 #include "collect.h" // CollectorClientWndProc, CollectorTextProc 94 #include "getnames.h" // CustomFileDlg 95 #include "notify.h" // EndNote 96 #include "valid.h" // FillInDriveFlags, IsValidDir 97 #include "inis.h" // IniProc 98 #include "viewer.h" // MLEEditorProc 99 #include "mainwnd2.h" // MainWndProc2 100 #include "notify.h" // NotifyWndProc 101 #include "treecnr.h" // OpenButtonProc 102 #include "seeall.h" // SeeAllWndProc, SeeStatusProc 103 #include "init.h" 104 #include "timer.h" // StartTimer, StopTimer 105 #include "treecnr.h" // TreeClientWndProc, TreeStatProc 106 #include "newview.h" // ViewStatusProc, ViewWndProc 88 107 #include "fm3dll.h" 89 #include "notebook.h" // command line variables (editor etc) 108 #include "misc.h" // HeapThread, LoadDetailsSwitches 109 #include "notebook.h" // command line variables (editor etc) 90 110 #include "fortify.h" 91 111 92 112 #ifdef __IBMC__ 93 113 #pragma alloc_text(INIT,LibMain,InitFM3DLL,DeInitFM3DLL) 94 #pragma alloc_text(INIT1,StartFM3 ,FindSwapperDat)114 #pragma alloc_text(INIT1,StartFM3) 95 115 #endif 96 116 … … 108 128 109 129 static PSZ pszSrcFile = __FILE__; 130 131 VOID FindSwapperDat(VOID); 110 132 111 133 BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset); … … 130 152 nm = 1; 131 153 rc = DosFindFirst(SwapperDat, 132 &hdir,133 FILE_NORMAL | FILE_ARCHIVED |134 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,135 &ffb, sizeof(ffb), &nm, FIL_STANDARDL);154 &hdir, 155 FILE_NORMAL | FILE_ARCHIVED | 156 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 157 &ffb, sizeof(ffb), &nm, FIL_STANDARDL); 136 158 if (rc && rc != ERROR_FILE_NOT_FOUND && rc != ERROR_PATH_NOT_FOUND) { 137 159 FILEFINDBUF3 ffb; 138 160 rc = DosFindFirst(SwapperDat, 139 &hdir,140 FILE_NORMAL | FILE_ARCHIVED |141 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,142 &ffb, sizeof(ffb), &nm, FIL_STANDARD);161 &hdir, 162 FILE_NORMAL | FILE_ARCHIVED | 163 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 164 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 143 165 fNoLargeFileSupport = TRUE; 144 166 } … … 147 169 fp = fopen(SwapperDat, "r"); 148 170 if (fp) { 149 fclose(fp);150 *SwapperDat = 0;151 rc = 1;// Force config.sys scan171 fclose(fp); 172 *SwapperDat = 0; 173 rc = 1; // Force config.sys scan 152 174 } 153 175 } … … 158 180 if (rc) { 159 181 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 160 QSV_BOOT_DRIVE,161 &nm,162 sizeof(ULONG))) {163 nm = 3; // Assume drive C:182 QSV_BOOT_DRIVE, 183 &nm, 184 sizeof(ULONG))) { 185 nm = 3; // Assume drive C: 164 186 } 165 187 *filename = (CHAR) nm + '@'; … … 167 189 if (fp) { 168 190 while (!feof(fp)) { 169 if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__))170 break;171 lstrip(input);172 if (!strnicmp(input, "SWAPPATH", 8)) {173 p = input + 8;174 while (*p == ' ')175 p++;176 if (*p == '=') {177 p++;178 stripcr(p);179 rstrip(p);180 while (*p == ' ')181 p++;182 if (*p == '\"') {183 p++;184 pp = p;185 while (*pp && *pp != '\"')186 *pp += 1;187 if (*pp)188 *pp = 0;189 }190 else {191 pp = strchr(p, ' ');192 if (pp)193 *pp = 0;194 }195 if (*p) {196 strncpy(SwapperDat, p, CCHMAXPATH);197 SwapperDat[CCHMAXPATH - 1] = 0;198 BldFullPathName(SwapperDat, SwapperDat, "SWAPPER.DAT");199 hdir = HDIR_CREATE;200 nm = 1;201 rc = DosFindFirst(SwapperDat,202 &hdir,203 FILE_NORMAL | FILE_ARCHIVED |204 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,205 &ffb, sizeof(ffb), &nm, FIL_STANDARD);206 if (rc){207 FILEFINDBUF3 ffb;208 rc = DosFindFirst(SwapperDat,209 &hdir,210 FILE_NORMAL | FILE_ARCHIVED |211 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY,212 &ffb, sizeof(ffb), &nm, FIL_STANDARD);213 fNoLargeFileSupport = TRUE;214 }215 if (!rc) {216 DosFindClose(hdir);217 PrfWriteProfileString(fmprof,218 FM3Str, "SwapperDat", SwapperDat);219 }220 else221 *SwapperDat = 0;222 break;223 }224 }225 }// if SWAPPATH226 } // while191 if (!xfgets(input, sizeof(input), fp, pszSrcFile, __LINE__)) 192 break; 193 lstrip(input); 194 if (!strnicmp(input, "SWAPPATH", 8)) { 195 p = input + 8; 196 while (*p == ' ') 197 p++; 198 if (*p == '=') { 199 p++; 200 stripcr(p); 201 rstrip(p); 202 while (*p == ' ') 203 p++; 204 if (*p == '\"') { 205 p++; 206 pp = p; 207 while (*pp && *pp != '\"') 208 *pp += 1; 209 if (*pp) 210 *pp = 0; 211 } 212 else { 213 pp = strchr(p, ' '); 214 if (pp) 215 *pp = 0; 216 } 217 if (*p) { 218 strncpy(SwapperDat, p, CCHMAXPATH); 219 SwapperDat[CCHMAXPATH - 1] = 0; 220 BldFullPathName(SwapperDat, SwapperDat, "SWAPPER.DAT"); 221 hdir = HDIR_CREATE; 222 nm = 1; 223 rc = DosFindFirst(SwapperDat, 224 &hdir, 225 FILE_NORMAL | FILE_ARCHIVED | 226 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 227 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 228 if (rc){ 229 FILEFINDBUF3 ffb; 230 rc = DosFindFirst(SwapperDat, 231 &hdir, 232 FILE_NORMAL | FILE_ARCHIVED | 233 FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY, 234 &ffb, sizeof(ffb), &nm, FIL_STANDARD); 235 fNoLargeFileSupport = TRUE; 236 } 237 if (!rc) { 238 DosFindClose(hdir); 239 PrfWriteProfileString(fmprof, 240 FM3Str, "SwapperDat", SwapperDat); 241 } 242 else 243 *SwapperDat = 0; 244 break; 245 } 246 } 247 } // if SWAPPATH 248 } // while 227 249 fclose(fp); 228 250 } … … 233 255 234 256 unsigned APIENTRY LibMain(unsigned hModule, 235 unsigned ulFlag)257 unsigned ulFlag) 236 258 { 237 259 CHAR *env; … … 252 274 rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa)); 253 275 if (!rc) { 254 if (fsa.attrFile & FILE_DIRECTORY) {255 BldFullPathName(stringfile, env, "FM3RES.STR");256 DosError(FERR_DISABLEHARDERR);257 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))258 strcpy(stringfile, "FM3RES.STR");259 }276 if (fsa.attrFile & FILE_DIRECTORY) { 277 BldFullPathName(stringfile, env, "FM3RES.STR"); 278 DosError(FERR_DISABLEHARDERR); 279 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa))) 280 strcpy(stringfile, "FM3RES.STR"); 281 } 260 282 } 261 283 } … … 347 369 348 370 unsigned long _System _DLL_InitTerm(unsigned long hModule, 349 unsigned long ulFlag)371 unsigned long ulFlag) 350 372 { 351 373 CHAR *env; … … 365 387 rc = DosQueryPathInfo(env, FIL_STANDARD, &fsa, sizeof(fsa)); 366 388 if (!rc) { 367 if (fsa.attrFile & FILE_DIRECTORY) {368 BldFullPathName(stringfile, env, "FM3RES.STR");369 DosError(FERR_DISABLEHARDERR);370 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa)))371 strcpy(stringfile, "FM3RES.STR");372 }389 if (fsa.attrFile & FILE_DIRECTORY) { 390 BldFullPathName(stringfile, env, "FM3RES.STR"); 391 DosError(FERR_DISABLEHARDERR); 392 if (DosQueryPathInfo(stringfile, FIL_STANDARD, &fsa, sizeof(fsa))) 393 strcpy(stringfile, "FM3RES.STR"); 394 } 373 395 } 374 396 } … … 501 523 num_matches = 1L; 502 524 if (!DosFindFirst(s, 503 &search_handle,504 FILE_NORMAL | FILE_DIRECTORY |505 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |506 FILE_ARCHIVED,507 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {525 &search_handle, 526 FILE_NORMAL | FILE_DIRECTORY | 527 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 528 FILE_ARCHIVED, 529 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 508 530 do { 509 strcpy(enddir, ffb.achName);510 if (ffb.attrFile & FILE_DIRECTORY) {511 wipeallf("%s\\*", s);512 DosDeleteDir(s);513 }514 else515 unlinkf("%s", s);531 strcpy(enddir, ffb.achName); 532 if (ffb.attrFile & FILE_DIRECTORY) { 533 wipeallf("%s\\*", s); 534 DosDeleteDir(s); 535 } 536 else 537 unlinkf("%s", s); 516 538 } 517 539 while (!DosFindNext(search_handle, 518 &ffb, sizeof(ffb), &num_matches));540 &ffb, sizeof(ffb), &num_matches)); 519 541 DosFindClose(search_handle); 520 542 } … … 532 554 num_matches = 1; 533 555 if (!DosFindFirst(s, 534 &search_handle,535 FILE_NORMAL | FILE_DIRECTORY |536 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |537 FILE_ARCHIVED,538 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {556 &search_handle, 557 FILE_NORMAL | FILE_DIRECTORY | 558 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 559 FILE_ARCHIVED, 560 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 539 561 do { 540 562 if (!(ffb.attrFile & FILE_DIRECTORY)) { 541 strcpy(enddir, ffb.achName);542 unlinkf("%s", s);563 strcpy(enddir, ffb.achName); 564 unlinkf("%s", s); 543 565 } 544 566 } 545 567 while (!DosFindNext(search_handle, 546 &ffb, sizeof(ffb), &num_matches));568 &ffb, sizeof(ffb), &num_matches)); 547 569 DosFindClose(search_handle); 548 570 } … … 575 597 ULONG RVMinor = 0; 576 598 ULONG ret = 0; 577 FILESTATUS3 fs3; // 25 Aug 07 SHL599 FILESTATUS3 fs3; // 25 Aug 07 SHL 578 600 PSZ env; 579 601 CHAR dllfile[CCHMAXPATH]; … … 582 604 if (!StringsLoaded()) { 583 605 saymsg(MB_ENTER, 584 HWND_DESKTOP,585 "Error",586 "FM3RES.STR isn't in right format, at least "587 "for this version of FM/2.");606 HWND_DESKTOP, 607 "Error", 608 "FM3RES.STR isn't in right format, at least " 609 "for this version of FM/2."); 588 610 return FALSE; 589 611 } … … 596 618 if (!rc) { 597 619 if (fs3.attrFile & FILE_DIRECTORY) { 598 BldFullPathName(dllfile, env, "FM3RES");// 23 Aug 07 SHL599 DosError(FERR_DISABLEHARDERR);600 if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3)))601 strcpy(dllfile, "FM3RES");620 BldFullPathName(dllfile, env, "FM3RES"); // 23 Aug 07 SHL 621 DosError(FERR_DISABLEHARDERR); 622 if (DosQueryPathInfo(dllfile, FIL_STANDARD, &fs3, sizeof(fs3))) 623 strcpy(dllfile, "FM3RES"); 602 624 } 603 625 } … … 606 628 if (rcl) { 607 629 saymsg(MB_CANCEL | MB_ICONEXCLAMATION, 608 HWND_DESKTOP,609 GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT));630 HWND_DESKTOP, 631 GetPString(IDS_ERRORTEXT), GetPString(IDS_FM3RESERROR1TEXT)); 610 632 return FALSE; 611 633 } … … 614 636 if (rc) { 615 637 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 616 "DosExitList");638 "DosExitList"); 617 639 } 618 640 rcq = DosQueryProcAddr(FM3ModHandle, 1, "ResVersion", &pfnResVersion); … … 622 644 if (RVMajor < VERMAJOR || (RVMajor == VERMAJOR && RVMinor < VERMINOR)) { 623 645 saymsg(MB_ENTER, 624 HWND_DESKTOP,625 GetPString(IDS_ERRORTEXT),626 GetPString(IDS_FM3RESERROR2TEXT),627 !rcq ?628 GetPString(IDS_FM3RESERROR3TEXT) :629 !rcl ?630 GetPString(IDS_FM3RESERROR4TEXT) :631 GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret);646 HWND_DESKTOP, 647 GetPString(IDS_ERRORTEXT), 648 GetPString(IDS_FM3RESERROR2TEXT), 649 !rcq ? 650 GetPString(IDS_FM3RESERROR3TEXT) : 651 !rcl ? 652 GetPString(IDS_FM3RESERROR4TEXT) : 653 GetPString(IDS_FM3RESERROR5TEXT), RVMajor, RVMinor, rcl, rcq, ret); 632 654 return FALSE; 633 655 } … … 647 669 DosSetMaxFH(100); 648 670 else if (!strcmp(appname, "VDir") || 649 !strcmp(appname, "VTree") ||650 !strcmp(appname, "VCollect") ||651 !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4"))671 !strcmp(appname, "VTree") || 672 !strcmp(appname, "VCollect") || 673 !strcmp(appname, "SEEALL") || !strcmp(appname, "FM/4")) 652 674 DosSetMaxFH(60); 653 675 else … … 655 677 656 678 if (DosQuerySysInfo(QSV_VERSION_MAJOR, 657 QSV_VERSION_MINOR,658 OS2ver,659 sizeof(OS2ver))) {679 QSV_VERSION_MINOR, 680 OS2ver, 681 sizeof(OS2ver))) { 660 682 OS2ver[0] = 2; 661 683 OS2ver[1] = 1; … … 684 706 num_matches = 1; 685 707 if (!DosFindFirst(szTempName, 686 &search_handle,687 FILE_NORMAL | FILE_DIRECTORY |688 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |689 FILE_ARCHIVED,690 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {708 &search_handle, 709 FILE_NORMAL | FILE_DIRECTORY | 710 FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN | 711 FILE_ARCHIVED, 712 &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) { 691 713 do { 692 714 strcpy(enddir, ffb.achName); … … 704 726 } 705 727 while (!DosFindNext(search_handle, 706 &ffb, sizeof(ffb), &num_matches));728 &ffb, sizeof(ffb), &num_matches)); 707 729 DosFindClose(search_handle); 708 730 } … … 763 785 if (_beginthread(HeapThread, NULL, 32768, NULL) == -1) { 764 786 Runtime_Error(pszSrcFile, __LINE__, 765 GetPString(IDS_COULDNTSTARTTHREADTEXT));787 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 766 788 return FALSE; 767 789 } … … 770 792 if (!StartTimer()) { 771 793 Runtime_Error(pszSrcFile, __LINE__, 772 GetPString(IDS_COULDNTSTARTTHREADTEXT));794 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 773 795 return FALSE; 774 796 } … … 777 799 env = getenv("WORKPLACE_PROCESS"); <
