Changeset 1335 for trunk/dll/dirsize.c
- Timestamp:
- Dec 13, 2008, 12:49:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/dirsize.c
r1321 r1335 35 35 07 Jul 08 GKY Fixed trap in PMCTLS (strlen) inadequate memory allocation 36 36 07 Jul 08 GKY Fixed trap by no longer allocating pci->pszLongName as flag but pointing isroot 37 37 version to NullStr and all others to NULL. 38 38 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory; use pTmpDir for temp files 39 39 03 Aug 08 GKY Reworked FillInRecSizes to use pci->pszDisplayName for display names and 40 41 40 created a more consitent string for passing to DRAWITEM. Finally (I hope) fixed 41 the strlen trap. 42 42 23 Aug 08 GKY Fix memory leak (failure to free cnritems) 43 10 Dec 08 SHL Integrate exception handler support 43 44 44 45 ***********************************************************************/ … … 47 48 #include <string.h> 48 49 #include <ctype.h> 49 #include <process.h> // _beginthread50 // #include <process.h> // _beginthread 50 51 51 52 #define INCL_DOS … … 80 81 #include "misc.h" // PostMsg 81 82 #include "fortify.h" 83 #include "excputil.h" // xbeginthread 82 84 83 85 typedef struct … … 142 144 /*if (!stricmp(FileSystem, NTFS)) { 143 145 saymsg(MB_OK, 144 145 146 146 HWND_DESKTOP, 147 NullStr, 148 GetPString(IDS_NTFSDRIVERFAILSTEXT)); 147 149 return FALSE; 148 150 } */ … … 343 345 if (isroot) { 344 346 FSALLOCATE fsa; 345 346 347 348 347 APIRET rc; 348 349 350 memset(&fsa, 0, sizeof(fsa)); 349 351 rc = DosQueryFSInfo(toupper(*pci->pszFileName) - '@', FSIL_ALLOC, &fsa, 350 352 sizeof(FSALLOCATE)); … … 353 355 ((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector)); 354 356 } 355 356 357 // Need unique buffer 23 Jul 07 SHL 358 pci->pszLongName = NullStr; 357 359 } 358 360 else … … 363 365 cBar = (UINT) fltPct / 2; 364 366 if (cBar && cBar * 2 != (UINT) fltPct) 365 367 szBar[cBar] = '='; 366 368 szBar[100] = 0; 367 369 } … … 378 380 fltPct, 379 381 isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr, 380 382 szBar); 381 383 pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__); 382 384 // use DisplayName for display hopefully fixes "strlen" trap 02 AUG 08 GKY … … 393 395 attrib = CMA_FIRST; 394 396 pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci), 395 397 MPFROM2SHORT(attrib, CMA_ITEMORDER)); 396 398 while (pci && (INT) pci != -1) { 397 399 if (*pchStopFlag) … … 525 527 PrfQueryProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, &size); 526 528 WinSetWindowPos(hwnd, 527 528 529 530 531 532 529 HWND_TOP, 530 swp.x, 531 swp.y, 532 swp.cx, 533 swp.cy, 534 swp.fl); 533 535 } 534 536 { … … 543 545 dirsize->pszFileName = pState->szDirName; 544 546 dirsize->hwndCnr = WinWindowFromID(hwnd, DSZ_CNR); 545 if (_beginthread(FillCnrThread, NULL, 122880L * 5, (PVOID)dirsize) == 546 -1) { 547 Runtime_Error(pszSrcFile, __LINE__, 548 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 547 if (xbeginthread(FillCnrThread, 548 122880 * 5, 549 dirsize, 550 pszSrcFile, 551 __LINE__) == -1) 552 { 549 553 xfree(dirsize, pszSrcFile, __LINE__); 550 554 WinDismissDlg(hwnd, 0); … … 687 691 p = strchr(pci->pszDisplayName, '\r'); 688 692 if (p) { 689 690 691 693 // draw text 694 if (pci->pszLongName == NullStr) // is root record 695 GpiSetColor(oi->hps, CLR_DARKRED); 692 696 else if (!pci->cbFile) // no size 693 697 GpiSetColor(oi->hps, CLR_DARKGRAY); … … 826 830 switch (x) { 827 831 case 1: 828 829 832 case 3: 833 case 5: 830 834 case 7: 831 832 833 834 835 836 835 case 9: 836 case 11: 837 case 13: 838 case 15: 839 case 17: 840 case 19: 837 841 ptl.y -= 1; 838 842 break; … … 843 847 case 4: 844 848 case 6: 845 846 847 848 849 849 case 8: 850 case 12: 851 case 14: 852 case 16: 853 case 18: 850 854 ptl.y -= 2; 851 855 break; … … 854 858 } // for x 855 859 return MRFROMLONG(TRUE); 856 860 } 857 861 } 858 862 } … … 948 952 FILE *fp; 949 953 950 951 952 953 954 if (pTmpDir) 955 strcpy(szFileName, pTmpDir); 956 else 957 strcpy(szFileName, pFM2SaveDirectory); 954 958 sprintf(&szFileName[strlen(szFileName)], "\\%csizes.Rpt", 955 959 (pState) ? toupper(*pState->szDirName) : '+'); … … 1007 1011 case DID_CANCEL: 1008 1012 { 1009 1010 1011 1012 1013 1014 1013 SWP swp; 1014 ULONG size = sizeof(SWP); 1015 1016 WinQueryWindowPos(hwnd, &swp); 1017 PrfWriteProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, 1018 size); 1015 1019 } 1016 1020 pState = INSTDATA(hwnd);
Note:
See TracChangeset
for help on using the changeset viewer.