source: trunk/dll/dirsize.c@ 1871

Last change on this file since 1871 was 1871, checked in by Gregg Young, 10 years ago

Create CollapseAll and modify ExpandAll to reduce code overhead both to try and speed drive expansion. Change ExpandAll to allow it to loop in UM_EXPAND until until drive is completely expanded. Changes were need to work with Flesh, Stubby and UnFlesh being moved to a thread. Add code for Flesh to skip the directory entry added by Stubby (eliminate use of NULL/Nullstr pszFileNames by Stubby). Add code in Stubby to insert a complete container item. Add a flag to indicate when a directory needed to be Fleshed. Get expand and switch code to work with Flesh, UnFlesh and Stubby running on a thread. Loop and idle ExpandAll; Move tree expand to a thread; Have ShowTreeRec wait for the Flesh thread. Add a correction factor so directories don't get placed above the top of the tree container when a large drive has been expanded. Debug is mostly still in but all turned off.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 32.6 KB
Line 
1
2/***********************************************************************
3
4 $Id: dirsize.c 1871 2015-09-20 22:57:02Z gyoung $
5
6 Directory sizes
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2001, 2015 Steven H. Levine
10
11 16 Oct 02 SHL Handle large partitions
12 12 Feb 03 SHL Use CBLIST_TO_EASIZE
13 21 Nov 03 SHL Avoid VAC \ after // bug (wierd)
14 21 Nov 03 SHL Correct minor typos
15 21 Nov 03 SHL Total drives >4GB better
16 24 May 05 SHL Rework for CNRITEM.szSubject
17 25 May 05 SHL Use ULONGLONG and CommaFmtULL
18 26 May 05 SHL More large file formatting updates
19 06 Jun 05 SHL Drop obsoletes
20 19 Jun 05 SHL More 64-bit math fixes
21 08 Aug 05 SHL Avoid Expand/Collapse hangs while working
22 17 Jul 06 SHL Use Runtime_Error
23 19 Oct 06 SHL Correct . and .. detect
24 18 Feb 07 GKY Add new drive type icons
25 22 Mar 07 GKY Use QWL_USER
26 23 Jul 07 SHL Sync with naming standards
27 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading)
28 03 Aug 07 SHL DirSizeProc; correct sizing and positioning to be deterministic
29 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
30 13 Aug 07 SHL ProcessDir: remove unneeded reallocs. Sanitize code
31 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat
32 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
33 29 Feb 08 GKY Use xfree where appropriate
34 29 Feb 08 GKY Add presparams & update appearence of "Sizes" dialog
35 07 Jul 08 GKY Fixed trap in PMCTLS (strlen) inadequate memory allocation
36 07 Jul 08 GKY Fixed trap by no longer allocating pci->pszLongName as flag but pointing isroot
37 version to NullStr and all others to NULL.
38 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory; use pTmpDir for temp files
39 03 Aug 08 GKY Reworked FillInRecSizes to use pci->pszDisplayName for display names and
40 created a more consitent string for passing to DRAWITEM. Finally (I hope) fixed
41 the strlen trap.
42 23 Aug 08 GKY Fix memory leak (failure to free cnritems)
43 10 Dec 08 SHL Integrate exception handler support
44 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
45 08 Mar 09 GKY Renamed commafmt.h i18nutil.h
46 08 Mar 09 GKY Additional strings move to PCSZs in init.c
47 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
48 13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
49 profile calls for user settings that work and are setable in more than one
50 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
51 aren't user settable; realappname should be used for setting applicable to
52 one or more miniapp but not to FM/2
53 17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10).
54 Mostly cast CHAR CONSTANT * as CHAR *.
55 20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused
56 by temp file creation failures.
57 12 Jun 11 GKY Added SleepIfNeeded in the container fill loop
58 20 Sep 15 GKY Move directory expansion to a thread. Split ExpandAll into ExpandAll and CollapseAll
59 to try to speed proccessing else where.
60
61***********************************************************************/
62
63#include <stdlib.h>
64#include <string.h>
65#include <ctype.h>
66// #include <process.h> // _beginthread
67
68#define INCL_DOS
69#define INCL_DOSERRORS
70#define INCL_WIN
71#define INCL_GPI
72#define INCL_LONGLONG
73
74#include "fm3dll.h"
75#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
76#include "draglist.h" // Data declaration(s)
77#include "init.h" // Data declaration(s)
78#include "notebook.h" // Data declaration(s)
79#include "mainwnd.h" // Data declaration(s)
80#include "newview.h" // Data declarations
81#include "fm3dlg.h"
82#include "fm3str.h"
83#include "dircnrs.h"
84#include "errutil.h" // Dos_Error...
85#include "strutil.h" // GetPString
86#include "filldir.h" // EmptyCnr...
87#include "dirsize.h"
88#include "select.h" // ExpandAll
89#include "valid.h" // CheckDrive
90#include "common.h" // OpenDirCnr
91#include "shadow.h" // OpenObject
92#include "presparm.h" // PresParamChanged
93#include "i18nutil.h" // commafmt
94#include "getnames.h" // export_filename
95#include "wrappers.h" // xDosFindNext
96#include "dirs.h" // save_dir2
97#include "misc.h" // PostMsg
98#include "fortify.h"
99#include "excputil.h" // xbeginthread
100#include "pathutil.h" // AddBackslashToPath
101#include "tmrsvcs.h"
102
103typedef struct
104{
105 CHAR *pszFileName;
106 HWND hwndCnr;
107 CHAR *pchStopFlag;
108 DIRCNRDATA *pDCD;
109} DIRSIZE;
110
111typedef struct
112{
113 HWND hwndCnr;
114 PCNRITEM pci;
115} EXPANDSIZE;
116
117typedef struct
118{
119 CHAR szDirName[CCHMAXPATH];
120 CHAR chStopFlag;
121 BOOL dying;
122 BOOL working;
123 HPOINTER hptr;
124} tState;
125
126static PSZ pszSrcFile = __FILE__;
127
128static SHORT APIENTRY SortSizeCnr(PMINIRECORDCORE p1,
129 PMINIRECORDCORE p2,
130 PVOID SortFlags)
131{
132 ULONGLONG size1;
133 ULONGLONG size2;
134
135 size1 = ((PCNRITEM) p1)->cbFile + ((PCNRITEM) p1)->easize;
136 size2 = ((PCNRITEM) p2)->cbFile + ((PCNRITEM) p2)->easize;
137 return (size1 < size2) ? 1 : (size1 == size2) ? 0 : -1;
138}
139
140static BOOL ProcessDir(HWND hwndCnr,
141 CHAR *pszFileName,
142 PCNRITEM pciParent,
143 CHAR *pchStopFlag,
144 BOOL top,
145 PULONGLONG pullTotalBytes)
146{
147 CHAR maskstr[CCHMAXPATH];
148 CHAR szBuf[CCHMAXPATH];
149 CHAR FileSystem[CCHMAXPATH];
150 CHAR *pEndMask;
151 register char *p;
152 register char *sp;
153 register char *pp;
154 ULONG ulFindCnt;
155 ULONGLONG ullCurDirBytes = 0;
156 ULONGLONG ullSubDirBytes = 0;
157 ULONGLONG ull;
158 HDIR hdir;
159 PFILEFINDBUF4L pffbArray;
160 APIRET rc;
161 RECORDINSERT ri;
162 PCNRITEM pci;
163 ULONG ulBufBytes;
164
165 *pullTotalBytes = 0; // In case we fail
166
167 CheckDrive(toupper(*pszFileName), FileSystem, NULL);
168 ulBufBytes = sizeof(FILEFINDBUF4L) * FilesToGet;
169 pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__);
170 if (!pffbArray)
171 return FALSE; // Error already reported
172
173 strcpy(maskstr, pszFileName);
174 AddBackslashToPath(maskstr);
175 //if (maskstr[strlen(maskstr) - 1] != '\\')
176 // strcat(maskstr, "\\");
177 pEndMask = &maskstr[strlen(maskstr)]; // Point after last backslash
178 strcat(maskstr, "*");
179
180 hdir = HDIR_CREATE;
181 ulFindCnt = 1;
182 DosError(FERR_DISABLEHARDERR);
183 // Check directory exists
184 rc = xDosFindFirst(pszFileName, &hdir,
185 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
186 FILE_SYSTEM | FILE_HIDDEN | MUST_HAVE_DIRECTORY,
187 pffbArray, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZEL);
188
189 if (!rc)
190 DosFindClose(hdir);
191
192 /**
193 * the "|| strlen(pszFileName) < 4 below works around an OS/2 bug
194 * that prevents FAT root directories from being found when
195 * requesting EASIZE. sheesh.
196 */
197 if (((!rc || rc == ERROR_NO_MORE_FILES) && (pffbArray->attrFile & FILE_DIRECTORY)) ||
198 strlen(pszFileName) < 4) {
199 if (*pchStopFlag) {
200 free(pffbArray);
201 return FALSE;
202 }
203 pci = WinSendMsg(hwndCnr, CM_ALLOCRECORD, MPFROMLONG(EXTRA_RECORD_BYTES),
204 MPFROMLONG(1));
205 if (!pci) {
206 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, PCSZ_CM_ALLOCRECORD);
207 xfree(pffbArray, pszSrcFile, __LINE__);
208 return FALSE;
209 }
210 if (!rc) {
211 ullCurDirBytes = pffbArray->cbFile;
212 ullCurDirBytes += CBLIST_TO_EASIZE(pffbArray->cbList);
213 }
214 else
215 DosError(FERR_DISABLEHARDERR);
216 pci->rc.hptrIcon = hptrDir;
217 pci->attrFile = 0;
218 pci->pszDispAttr = NULL;
219 pci->pszSubject = NULL;
220 } // if got something
221 else {
222 // No match
223 xfree(pffbArray, pszSrcFile, __LINE__);
224 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
225 GetPString(IDS_CANTFINDDIRTEXT), pszFileName);
226 return FALSE;
227 }
228
229 if (strlen(pszFileName) < 4 || top)
230 pci->pszFileName = xstrdup(pszFileName, pszSrcFile, __LINE__);
231 else {
232 p = strrchr(pszFileName, '\\');
233 if (!p)
234 p = pszFileName;
235 else
236 p++; // After last backslash
237 // Handle quoted names
238 // fixme to understand this - why lose path prefix?
239 sp = strchr(pszFileName, ' ') != NULL ? "\"" : NullStr;
240 pp = szBuf;
241 if (*sp)
242 *pp++ = *sp; // Need quotes
243 strcpy(pp, p);
244 if (*sp)
245 strcat(pp, sp);
246 pci->pszFileName = xstrdup(szBuf, pszSrcFile, __LINE__);
247 }
248 // Use pszDisplayname for display so no need to save length of pszFileName 03 Aug 08 GKY
249 pci->pszDisplayName = pci->pszFileName;
250 pci->rc.pszIcon = pci->pszFileName;
251 pci->rc.flRecordAttr |= CRA_RECORDREADONLY;
252 if (fForceUpper)
253 strupr(pci->pszFileName);
254 else if (fForceLower)
255 strlwr(pci->pszFileName);
256 memset(&ri, 0, sizeof(RECORDINSERT));
257 ri.cb = sizeof(RECORDINSERT);
258 ri.pRecordOrder = (PRECORDCORE) CMA_END;
259 ri.pRecordParent = (PRECORDCORE) pciParent;
260 ri.zOrder = (USHORT) CMA_TOP;
261 ri.cRecordsInsert = 1;
262 ri.fInvalidateRecord = TRUE;
263 if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
264 xfree(pffbArray, pszSrcFile, __LINE__);
265 return FALSE;
266 }
267
268 // Find files and directories in this directory
269 hdir = HDIR_CREATE;
270 // 13 Aug 07 SHL fixme to know if need to support fRemoteBug here like objcnr.c?
271 ulFindCnt = FilesToGet;
272 rc = xDosFindFirst(maskstr, &hdir,
273 FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
274 FILE_SYSTEM | FILE_HIDDEN | FILE_DIRECTORY,
275 pffbArray, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZEL);
276 if (!rc) {
277 PFILEFINDBUF4L pffbFile;
278 ULONG x;
279 ITIMER_DESC itdSleep = { 0 }; // 30 May 11 GKY
280
281 InitITimer(&itdSleep, 500);
282 while (!rc) {
283
284 priority_normal();
285 pffbFile = pffbArray;
286 for (x = 0; x < ulFindCnt; x++) {
287 // Total size skipping . and ..
288 if ((~pffbFile->attrFile & FILE_DIRECTORY) ||
289 (pffbFile->achName[0] != '.' ||
290 (pffbFile->achName[1] &&
291 (pffbFile->achName[1] != '.' || pffbFile->achName[2])))) {
292 ullCurDirBytes += pffbFile->cbFile;
293 ullCurDirBytes += CBLIST_TO_EASIZE(pffbFile->cbList) & 0x3ff;
294
295 if (*pchStopFlag)
296 break;
297 if (~pffbFile->attrFile & FILE_DIRECTORY)
298 pci->attrFile++; // Bump file count
299 else {
300 // Recurse into subdir
301 strcpy(pEndMask, pffbFile->achName); // Append dirname to base dirname
302 ProcessDir(hwndCnr, maskstr, pci, pchStopFlag, FALSE, &ull);
303 ullSubDirBytes += ull;
304 }
305 }
306 if (!pffbFile->oNextEntryOffset)
307 break;
308 pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset);
309
310 } // for matches
311 if (*pchStopFlag)
312 break;
313 DosSleep(0);
314 ulFindCnt = FilesToGet;
315 DosError(FERR_DISABLEHARDERR);
316 rc = xDosFindNext(hdir, pffbArray, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZEL);
317 SleepIfNeeded(&itdSleep, 1);
318 } // while more found
319
320 DosFindClose(hdir);
321 priority_normal();
322 } // if got files or directories
323
324 if (rc && rc != ERROR_NO_MORE_FILES) {
325 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
326 GetPString(IDS_CANTFINDDIRTEXT), pszFileName);
327 }
328
329 xfree(pffbArray, pszSrcFile, __LINE__);
330
331 pci->cbFile = ullCurDirBytes;
332 pci->easize = ullSubDirBytes; // hack cough
333 WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pci),
334 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
335
336 *pullTotalBytes = ullCurDirBytes + ullSubDirBytes;
337 return TRUE;
338}
339
340static VOID FillInRecSizes(HWND hwndCnr, PCNRITEM pciParent,
341 ULONGLONG ullTotalBytes, CHAR * pchStopFlag,
342 BOOL isroot)
343{
344 PCNRITEM pci = pciParent;
345 SHORT attrib = CMA_FIRSTCHILD;
346
347 if (pci) {
348
349 float fltPct = (float) 0.0;
350 CHAR szCurDir[80];
351 CHAR szSubDir[80];
352 CHAR szAllDir[80];
353 CHAR szBar[101];
354 CHAR szBuf[CCHMAXPATH + 341];
355
356 // cbFile = currect directory usage in bytes
357 // easize = subdirectory usage in bytes
358 CommaFmtULL(szCurDir, sizeof(szCurDir), pci->cbFile, 'K');
359 *szBar = 0;
360 pci->pszLongName = NULL;
361 memset(szBuf, 0, sizeof(szBuf));
362 if (ullTotalBytes) {
363 UINT cBar;
364
365 if (isroot) {
366 FSALLOCATE fsa;
367 APIRET rc;
368
369
370 memset(&fsa, 0, sizeof(fsa));
371 rc = DosQueryFSInfo(toupper(*pci->pszFileName) - '@', FSIL_ALLOC, &fsa,
372 sizeof(FSALLOCATE));
373 if (!rc) {
374 fltPct = (float) (ullTotalBytes * 100.0) /
375 ((float)fsa.cUnit * (fsa.cSectorUnit * fsa.cbSector));
376 }
377 // Need unique buffer 23 Jul 07 SHL
378 pci->pszLongName = NullStr;
379 }
380 else
381 fltPct = (float) (((float)pci->cbFile + pci->easize) * 100.0) / ullTotalBytes;
382
383 //Second line for graph reworked 03 AUG 08 GKY
384 memset(szBar, ' ', sizeof(szBar));
385 cBar = (UINT) fltPct / 2;
386 if (cBar && cBar * 2 != (UINT) fltPct)
387 szBar[cBar] = '=';
388 szBar[100] = 0;
389 }
390
391 pci->flags = (ULONG) fltPct;
392 CommaFmtULL(szSubDir, sizeof(szSubDir), pci->easize, 'K');
393 CommaFmtULL(szAllDir, sizeof(szAllDir), pci->cbFile + pci->easize, 'K');
394 sprintf(szBuf,
395 "%s %s + %s = %s (%.02lf%%%s)\r%s",
396 pci->pszFileName,
397 szCurDir,
398 szSubDir,
399 szAllDir,
400 fltPct,
401 isroot ? GetPString(IDS_OFDRIVETEXT) : NullStr,
402 szBar);
403 pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
404 // use DisplayName for display hopefully fixes "strlen" trap 02 AUG 08 GKY
405 if (pci->pszDisplayName) {
406# ifdef FORTIFY
407 Fortify_ChangeScope(pci->pszDisplayName, -1);
408 Fortify_ChangeScope(pci->pszFileName, -1);
409# endif
410 WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1, 0));
411 }
412 isroot = FALSE;
413 }
414 else
415 attrib = CMA_FIRST;
416 pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
417 MPFROM2SHORT(attrib, CMA_ITEMORDER));
418 while (pci && (INT) pci != -1) {
419 if (*pchStopFlag)
420 break;
421 FillInRecSizes(hwndCnr, pci, ullTotalBytes, pchStopFlag, isroot);
422 isroot = FALSE;
423 pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
424 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
425 }
426}
427
428static VOID PrintToFile(HWND hwndCnr, ULONG indent, PCNRITEM pciParent,
429 FILE * fp)
430{
431 PCNRITEM pci;
432 CHAR *p;
433
434 if (!pciParent) {
435 pciParent = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(NULL),
436 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
437 indent = 0;
438 }
439 if (pciParent) {
440 p = strchr(pciParent->pszDisplayName, '\r'); // GKY use display name for display
441 if (p)
442 *p = 0;
443 fprintf(fp, "%*.*s%s %lu %s%s\n",
444 indent * 2, indent * 2, " ",
445 pciParent->pszDisplayName, //
446 pciParent->attrFile,
447 GetPString(IDS_FILETEXT), &"s"[pciParent->attrFile == 1]);
448 if (p)
449 *p = '\r';
450 if (pciParent->rc.flRecordAttr & CRA_EXPANDED) {
451 pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent),
452 MPFROM2SHORT(CMA_FIRSTCHILD,
453 CMA_ITEMORDER));
454 while (pci && (INT) pci != -1) {
455 DosSleep(0); //26 Aug 07 GKY 1
456 PrintToFile(hwndCnr, indent + 1, pci, fp);
457 pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
458 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
459 } //while
460 }
461 }
462}
463
464static VOID FillCnrThread(VOID *args)
465{
466 HAB hab;
467 HMQ hmq;
468 DIRSIZE *dirsize = (DIRSIZE *)args;
469 HWND hwndCnr;
470 ULONGLONG ull;
471
472 if (!dirsize) {
473 Runtime_Error(pszSrcFile, __LINE__, NULL);
474 return;
475 }
476# ifdef FORTIFY
477 Fortify_EnterScope();
478 Fortify_BecomeOwner(dirsize); // We free dirsize
479# endif
480
481 hwndCnr = dirsize->hwndCnr;
482
483 DosError(FERR_DISABLEHARDERR);
484
485 // priority_normal();
486 hab = WinInitialize(0);
487 if (hab) {
488 hmq = WinCreateMsgQueue(hab, 0);
489 if (hmq) {
490 WinCancelShutdown(hmq, TRUE);
491 ProcessDir(hwndCnr, dirsize->pszFileName,
492 (PCNRITEM) NULL, dirsize->pchStopFlag, TRUE, &ull);
493 DosPostEventSem(CompactSem);
494 WinEnableWindowUpdate(hwndCnr, FALSE);
495 FillInRecSizes(hwndCnr, NULL, ull, dirsize->pchStopFlag, TRUE);
496 WinEnableWindowUpdate(hwndCnr, TRUE);
497 WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPVOID,
498 MPFROM2SHORT(0, CMA_ERASE | CMA_TEXTCHANGED));
499 WinDestroyMsgQueue(hmq);
500 }
501 WinTerminate(hab);
502 }
503
504 xfree(dirsize, pszSrcFile, __LINE__);
505 PostMsg(WinQueryWindow(hwndCnr, QW_PARENT),
506 UM_CONTAINER_FILLED, MPVOID, MPVOID);
507# ifdef FORTIFY
508 Fortify_LeaveScope();
509# endif
510}
511
512static VOID ExpandCnrThread(VOID *args)
513{
514 HAB hab;
515 HMQ hmq;
516 INT x = 0;
517 EXPANDSIZE *expandsize = (EXPANDSIZE *)args;
518
519 if (!expandsize) {
520 Runtime_Error(pszSrcFile, __LINE__, NULL);
521 return;
522 }
523# ifdef FORTIFY
524 Fortify_EnterScope();
525 Fortify_BecomeOwner(expandsize); // We free dirsize
526# endif
527
528 DosError(FERR_DISABLEHARDERR);
529
530 priority_idle();
531 hab = WinInitialize(0);
532 if (hab) {
533 hmq = WinCreateMsgQueue(hab, 0);
534 if (hmq) {
535 WinCancelShutdown(hmq, TRUE);
536 ExpandAll(expandsize->hwndCnr, x, expandsize->pci);
537 WinDestroyMsgQueue(hmq);
538 }
539 WinTerminate(hab);
540 }
541
542 xfree(expandsize, pszSrcFile, __LINE__);
543# ifdef FORTIFY
544 Fortify_LeaveScope();
545# endif
546}
547
548MRESULT EXPENTRY DirSizeProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
549{
550 tState *pState;
551 PCNRITEM pci;
552 CHAR szBytes[44];
553 CHAR sz[66];
554
555 switch (msg) {
556 case WM_INITDLG:
557 if (!mp2) {
558 WinDismissDlg(hwnd, 0);
559 break;
560 }
561# ifdef FORTIFY
562 Fortify_EnterScope();
563# endif
564 pState = xmallocz(sizeof(tState), pszSrcFile, __LINE__);
565 if (!pState) {
566 WinDismissDlg(hwnd, 0);
567 break;
568 }
569 strcpy(pState->szDirName, (CHAR *)mp2);
570 WinSetWindowPtr(hwnd, QWL_USER, (PVOID) pState);
571 pState->hptr = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, DIRSIZE_ICON);
572 WinDefDlgProc(hwnd, WM_SETICON, MPFROMLONG(pState->hptr), MPVOID);
573 {
574 CHAR s[CCHMAXPATH + 81];
575 RestorePresParams(hwnd, PCSZ_DIRSIZES);
576 sprintf(s, GetPString(IDS_DIRSIZETITLETEXT), pState->szDirName);
577 WinSetWindowText(hwnd, s);
578 }
579 {
580 SWP swp;
581 ULONG size = sizeof(SWP);
582
583 PrfQueryProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, &size);
584 swp.fl &= ~SWP_SIZE; // 04 Feb 09 SHL ignore saved size
585 WinSetWindowPos(hwnd,
586 HWND_TOP,
587 swp.x,
588 swp.y,
589 swp.cx,
590 swp.cy,
591 swp.fl);
592 }
593 {
594 DIRSIZE *dirsize;
595
596 dirsize = xmalloc(sizeof(DIRSIZE), pszSrcFile, __LINE__);
597 if (!dirsize) {
598 WinDismissDlg(hwnd, 0);
599 break;
600 }
601 dirsize->pchStopFlag = (CHAR *)&pState->chStopFlag;
602 dirsize->pszFileName = pState->szDirName;
603 dirsize->hwndCnr = WinWindowFromID(hwnd, DSZ_CNR);
604 if (xbeginthread(FillCnrThread,
605 122880 * 5,
606 dirsize,
607 pszSrcFile,
608 __LINE__) == -1)
609 {
610 xfree(dirsize, pszSrcFile, __LINE__);
611 WinDismissDlg(hwnd, 0);
612 break;
613 }
614 pState->working = TRUE;
615 WinEnableWindow(WinWindowFromID(hwnd, DSZ_COLLAPSE), FALSE);
616 WinEnableWindow(WinWindowFromID(hwnd, DSZ_EXPAND), FALSE);
617 WinEnableWindow(WinWindowFromID(hwnd, DSZ_PRINT), FALSE);
618 }
619 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
620 break;
621
622 case UM_SETUP:
623 {
624 CNRINFO cnri;
625 FSALLOCATE fsa;
626 APIRET rc;
627
628 memset(&cnri, 0, sizeof(CNRINFO));
629 cnri.cb = sizeof(CNRINFO);
630 WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_QUERYCNRINFO,
631 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
632 cnri.cyLineSpacing = 0;
633 cnri.cxTreeIndent = 12;
634 cnri.flWindowAttr = CV_TREE | CV_FLOW | CA_TREELINE | CA_OWNERDRAW;
635 WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_SETCNRINFO, MPFROMP(&cnri),
636 MPFROMLONG(CMA_FLWINDOWATTR | CMA_TREEICON |
637 CMA_LINESPACING | CMA_CXTREEINDENT));
638 pState = INSTDATA(hwnd);
639 if (pState && isalpha(*pState->szDirName)) {
640 memset(&fsa, 0, sizeof(fsa));
641 rc =
642 DosQueryFSInfo(toupper(*pState->szDirName) - '@', FSIL_ALLOC, &fsa,
643 sizeof(FSALLOCATE));
644 if (!rc) {
645
646 CHAR s[132], tf[80], tb[80], tu[80];
647
648 CommaFmtULL(tf, sizeof(tf),
649 (ULONGLONG) fsa.cUnitAvail *
650 (fsa.cSectorUnit * fsa.cbSector), 'M');
651 CommaFmtULL(tb, sizeof(tb),
652 (ULONGLONG) fsa.cUnit *
653 (fsa.cSectorUnit * fsa.cbSector), 'M');
654 CommaFmtULL(tu, sizeof(tu),
655 (ULONGLONG) (fsa.cUnit - fsa.cUnitAvail) *
656 (fsa.cSectorUnit * fsa.cbSector), 'M');
657 sprintf(s, GetPString(IDS_FREESPACETEXT), tf, tb, tu);
658 WinSetDlgItemText(hwnd, DSZ_FREESPACE, s);
659 }
660 else
661 WinSetDlgItemText(hwnd, DSZ_FREESPACE, (CHAR *) GetPString(IDS_FREESPACEUTEXT));
662 }
663 }
664 return 0;
665
666 case UM_CONTAINER_FILLED:
667 pState = INSTDATA(hwnd);
668 if (!pState || pState->dying) {
669 if (pState)
670 pState->working = FALSE;
671 WinDismissDlg(hwnd, 0);
672 return 0;
673 }
674 pState->working = FALSE;
675 WinEnableWindow(WinWindowFromID(hwnd, DSZ_COLLAPSE), TRUE);
676 WinEnableWindow(WinWindowFromID(hwnd, DSZ_EXPAND), TRUE);
677 WinEnableWindow(WinWindowFromID(hwnd, DSZ_PRINT), TRUE);
678
679 pci = WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_QUERYRECORD, MPVOID,
680 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
681 if (pci && (INT) pci != -1)
682 WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_EXPANDTREE, MPFROMP(pci), MPVOID);
683 *sz = 0;
684 pci = WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_QUERYRECORDEMPHASIS,
685 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
686 if (pci && (INT) pci != -1) {
687 commafmt(szBytes, sizeof(szBytes), pci->attrFile);
688 sprintf(sz,
689 "%s %s%s",
690 szBytes, GetPString(IDS_FILETEXT), &"s"[pci->attrFile == 1]);
691 }
692 WinSetDlgItemText(hwnd, DSZ_NUMFILES, sz);
693
694 WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_SORTRECORD, MPFROMP(SortSizeCnr),
695 MPVOID);
696 if (!fAlertBeepOff)
697 DosBeep(500, 25); // Wake up user
698 return 0;
699
700 case WM_ADJUSTWINDOWPOS:
701 PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
702 break;
703
704 case UM_STRETCH:
705 {
706 SWP swpC, swp;
707
708 WinQueryWindowPos(hwnd, &swp);
709 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
710 WinQueryWindowPos(WinWindowFromID(hwnd, DSZ_CNR), &swpC);
711 WinSetWindowPos(WinWindowFromID(hwnd, DSZ_CNR), HWND_TOP,
712 SysVal(SV_CXSIZEBORDER),
713 swpC.y,
714 swp.cx - (SysVal(SV_CXSIZEBORDER) * 2),
715 (swp.cy - swpC.y) - (SysVal(SV_CYTITLEBAR) +
716 SysVal(SV_CYSIZEBORDER)),
717 SWP_MOVE | SWP_SIZE);
718 }
719 }
720 return 0;
721
722 case WM_PRESPARAMCHANGED:
723 PresParamChanged(hwnd, PCSZ_DIRSIZES, mp1, mp2);
724 break;
725
726 case WM_DRAWITEM:
727 if (mp2) {
728
729 OWNERITEM *oi = mp2;
730 CNRDRAWITEMINFO *cnd;
731 PCNRITEM pci;
732
733 if (oi->idItem == CMA_TEXT) {
734
735 cnd = (CNRDRAWITEMINFO *)oi->hItem;
736
737 if (cnd) {
738 pci = (PCNRITEM)cnd->pRecord;
739
740 if (pci) {
741 POINTL aptl[TXTBOX_COUNT];
742 POINTL ptl;
743 PSZ p;
744 LONG clr;
745 LONG x;
746 LONG yBottom;
747 INT boxHeight;
748 p = strchr(pci->pszDisplayName, '\r');
749 if (p) {
750 // draw text
751 if (pci->pszLongName == NullStr) // is root record
752 GpiSetColor(oi->hps, CLR_DARKRED);
753 else if (!pci->cbFile) // no size
754 GpiSetColor(oi->hps, CLR_DARKGRAY);
755 else if (!pci->easize) // no size below
756 GpiSetColor(oi->hps, CLR_DARKBLUE);
757 else
758 GpiSetColor(oi->hps, CLR_BLACK);
759 GpiSetBackMix(oi->hps, BM_LEAVEALONE);
760 GpiSetMix(oi->hps, FM_OVERPAINT);
761
762 *p = 0; // Make 1 line high
763
764 // Calculate nominal graph box height based on font size
765 GpiQueryTextBox(oi->hps, p - pci->pszDisplayName,
766 pci->pszDisplayName, TXTBOX_COUNT, aptl);
767 boxHeight = aptl[TXTBOX_TOPRIGHT].y - aptl[TXTBOX_BOTTOMRIGHT].y;
768 boxHeight -= 4;
769
770 // Calculate nominal baseline of graph box
771 // rclItem.yBottom is at center of icon because it is
772 yBottom = oi->rclItem.yBottom - boxHeight + 3;
773
774 // Place text above graph box with a bit of whitespace between
775 ptl.x = oi->rclItem.xLeft;
776 ptl.y = yBottom + boxHeight + 6;
777 GpiCharStringAt(oi->hps, &ptl, p - pci->pszDisplayName,
778 pci->pszDisplayName);
779
780 *p = '\r'; // Restore
781
782 // draw the graph box
783 // draw black outline
784 GpiSetColor(oi->hps, CLR_BLACK);
785 ptl.x = oi->rclItem.xLeft;
786 ptl.y = yBottom + 2;
787 GpiMove(oi->hps, &ptl);
788 ptl.x = oi->rclItem.xLeft + 201;
789 ptl.y = yBottom + boxHeight;
790 GpiBox(oi->hps, DRO_OUTLINE, &ptl, 0, 0);
791 // fill with gray
792 GpiSetColor(oi->hps, CLR_PALEGRAY);
793 ptl.x = oi->rclItem.xLeft + 1;
794 ptl.y = yBottom + 3;
795 GpiMove(oi->hps, &ptl);
796 ptl.x = oi->rclItem.xLeft + 200;
797 ptl.y = yBottom + boxHeight - 1;
798 GpiBox(oi->hps, DRO_OUTLINEFILL, &ptl, 0, 0);
799
800 // draw shadow at bottom & right sides
801 GpiSetColor(oi->hps, CLR_DARKGRAY);
802 ptl.x = oi->rclItem.xLeft + 1;
803 ptl.y = yBottom + 3;
804 GpiMove(oi->hps, &ptl);
805 ptl.x = oi->rclItem.xLeft + 200;
806 GpiLine(oi->hps, &ptl);
807 ptl.y = yBottom + boxHeight - 1;
808 GpiLine(oi->hps, &ptl);
809
810 // draw highlight at top and left sides
811 GpiSetColor(oi->hps, CLR_WHITE);
812 ptl.x = oi->rclItem.xLeft + 1;
813 GpiLine(oi->hps, &ptl);
814 ptl.y = yBottom + 3;
815 GpiLine(oi->hps, &ptl);
816
817 // draw shadow of box
818 GpiSetColor(oi->hps, CLR_DARKGRAY);
819 ptl.x = oi->rclItem.xLeft + 2;
820 ptl.y = yBottom + boxHeight;
821 GpiMove(oi->hps, &ptl);
822 ptl.x = oi->rclItem.xLeft + 201;
823 GpiLine(oi->hps, &ptl);
824 ptl.y = yBottom + boxHeight - 2;
825 GpiLine(oi->hps, &ptl);
826 ptl.x--;
827 GpiMove(oi->hps, &ptl);
828 ptl.y = yBottom + 1;
829 GpiLine(oi->hps, &ptl);
830 ptl.x = oi->rclItem.xLeft + 2;
831 GpiLine(oi->hps, &ptl);
832
833 // fill box with graph bar, flags is integer %
834 if (pci->flags) {
835 if (pci->pszLongName == NullStr) // is root record
836 GpiSetColor(oi->hps, CLR_DARKGREEN);
837 else
838 GpiSetColor(oi->hps, CLR_RED);
839 ptl.x = oi->rclItem.xLeft + 2;
840 ptl.y = yBottom + 3;
841 GpiMove(oi->hps, &ptl);
842 ptl.x = oi->rclItem.xLeft + pci->flags * 2;
843 ptl.y = yBottom + boxHeight - 1;
844 GpiBox(oi->hps, DRO_OUTLINEFILL, &ptl, 0, 0);
845
846 // draw highlights and shadows on graph
847 if (pci->pszLongName == NullStr)
848 GpiSetColor(oi->hps, CLR_GREEN);
849 else
850 GpiSetColor(oi->hps, CLR_PALEGRAY);
851 if (pci->flags > 5) {
852 ptl.x = oi->rclItem.xLeft + 1;
853 ptl.y = yBottom + 3;
854 GpiMove(oi->hps, &ptl);
855 ptl.y = yBottom + boxHeight - 1;
856 GpiLine(oi->hps, &ptl);
857 }
858 else {
859 ptl.y = yBottom + boxHeight - 1;
860 GpiMove(oi->hps, &ptl);
861 }
862 ptl.x = oi->rclItem.xLeft + pci->flags * 2;
863 GpiLine(oi->hps, &ptl);
864 if (pci->pszLongName == NULL) {
865 GpiSetColor(oi->hps, CLR_DARKRED);
866 ptl.x = oi->rclItem.xLeft + 2;
867 ptl.y = yBottom + 3;
868 GpiMove(oi->hps, &ptl);
869 ptl.x = oi->rclItem.xLeft + pci->flags * 2;
870 GpiLine(oi->hps, &ptl);
871 }
872 }
873
874 // draw hash marks in box
875 GpiSetColor(oi->hps, CLR_WHITE);
876 clr = CLR_WHITE;
877 for (x = 1; x < 20; x++) {
878 if (clr == CLR_WHITE && x * 10 > pci->flags * 2) {
879 clr = CLR_BLACK;
880 GpiSetColor(oi->hps, CLR_BLACK);
881 }
882 ptl.x = oi->rclItem.xLeft + 1 + x * 10;
883 ptl.y = yBottom + boxHeight - 1;
884 GpiMove(oi->hps, &ptl);
885 switch (x) {
886 case 1:
887 case 3:
888 case 5:
889 case 7:
890 case 9:
891 case 11:
892 case 13:
893 case 15:
894 case 17:
895 case 19:
896 ptl.y -= 1;
897 break;
898 case 10:
899 ptl.y -= 4;
900 break;
901 case 2:
902 case 4:
903 case 6:
904 case 8:
905 case 12:
906 case 14:
907 case 16:
908 case 18:
909 ptl.y -= 2;
910 break;
911 }
912 GpiLine(oi->hps, &ptl);
913 } // for x
914 return MRFROMLONG(TRUE);
915 }
916 }
917 }
918 }
919 }
920 return FALSE; // Let PM draw
921
922 case WM_CONTROL:
923 switch (SHORT2FROMMP(mp1)) {
924 case CN_ENTER:
925 if (mp2) {
926 PCNRITEM pci = (PCNRITEM)((PNOTIFYRECORDENTER)mp2)->pRecord;
927 CHAR szFileName[CCHMAXPATH]; // 23 Jul 07 SHL
928 CHAR szTemp[CCHMAXPATH];
929
930 if (pci) {
931 *szFileName = 0;
932 while (pci && (INT) pci != -1) {
933 memset(szTemp, 0, sizeof(szTemp));
934 strcpy(szTemp, pci->pszFileName);
935 strrev(szTemp);
936 AddBackslashToPath(szFileName);
937 //if (*szFileName && *szTemp != '\\')
938 // strcat(szFileName, "\\");
939 strcat(szFileName, szTemp);
940 pci = WinSendDlgItemMsg(hwnd, DSZ_CNR, CM_QUERYRECORD,
941 MPFROMP(pci),
942 MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
943 }
944 strrev(szFileName);
945 if (!fVTreeOpensWPS)
946 OpenDirCnr((HWND)0,
947 hwndMain ? hwndMain : HWND_DESKTOP,
948 hwnd,
949 FALSE,
950 szFileName);
951 else {
952
953 ULONG size = sizeof(ULONG);
954 ULONG flWindowAttr = CV_ICON;
955 CHAR s[33];
956
957 strcpy(s, PCSZ_ICON);
958 PrfQueryProfileData(fmprof, appname, "DirflWindowAttr",
959 (PVOID) &flWindowAttr, &size);
960 if (flWindowAttr & CV_DETAIL) {
961 if (IsRoot(szFileName))
962 strcpy(s, PCSZ_TREE);
963 else
964 strcpy(s, Details);
965 }
966 OpenObject(szFileName, s, hwnd);
967 }
968 }
969 }
970 break;
971 case CN_EMPHASIS:
972 pState = INSTDATA(hwnd);
973 if (pState && !pState->working && mp2) {
974
975 PNOTIFYRECORDEMPHASIS pre = mp2;
976
977 pci = (PCNRITEM) ((pre) ? pre->pRecord : NULL);
978 if (pci && (pre->fEmphasisMask & CRA_SELECTED) &&
979 (pci->rc.flRecordAttr & CRA_SELECTED)) {
980 commafmt(szBytes, sizeof(szBytes), pci->attrFile);
981 sprintf(sz,
982 "%s %s%s",
983 szBytes,
984 GetPString(IDS_FILETEXT), &"s"[pci->attrFile == 1]);
985 WinSetDlgItemText(hwnd, DSZ_NUMFILES, sz);
986 }
987 }
988 break;
989 }
990 return 0;
991
992 case WM_COMMAND:
993 switch (SHORT1FROMMP(mp1)) {
994 case IDM_HELP:
995 if (hwndHelp)
996 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
997 MPFROM2SHORT(HELP_DIRSIZE, 0), MPFROMSHORT(HM_RESOURCEID));
998 break;
999
1000 case DSZ_PRINT:
1001 // Save button
1002 pState = INSTDATA(hwnd);
1003 if (!pState)
1004 Runtime_Error(pszSrcFile, __LINE__, NULL);
1005 else {
1006
1007 CHAR szFileName[CCHMAXPATH];
1008 FILE *fp;
1009 CHAR *modea = "a+";
1010
1011 if (pTmpDir && !IsValidDir(pTmpDir))
1012 DosCreateDir(pTmpDir, 0);
1013 //if (pTmpDir)
1014 // strcpy(szFileName, pTmpDir);
1015 else if (!pTmpDir)
1016 strcpy(szFileName, pFM2SaveDirectory);
1017 sprintf(&szFileName[strlen(szFileName)], "%s%csizes.Rpt", PCSZ_BACKSLASH,
1018 (pState) ? toupper(*pState->szDirName) : '+');
1019 if (export_filename(hwnd, szFileName, FALSE) && *szFileName) {
1020 if (stricmp(szFileName, "PRN") &&
1021 strnicmp(szFileName, "\\DEV\\LPT", 8) &&
1022 !strchr(szFileName, '.'))
1023 strcat(szFileName, ".RPT");
1024 fp = xfopen(szFileName, modea, pszSrcFile, __LINE__, TRUE);
1025 if (!fp) {
1026 saymsg(MB_CANCEL,
1027 hwnd,
1028 GetPString(IDS_ERRORTEXT),
1029 GetPString(IDS_COMPCANTOPENTEXT), szFileName);
1030 }
1031 else {
1032 WinSetPointer(HWND_DESKTOP, hptrBusy);
1033 PrintToFile(WinWindowFromID(hwnd, DSZ_CNR), 0, NULL, fp);
1034 fclose(fp);
1035 WinSetPointer(HWND_DESKTOP, hptrArrow);
1036 }
1037 }
1038 }
1039 break;
1040
1041 case DSZ_EXPAND:
1042 case DSZ_COLLAPSE:
1043 pState = INSTDATA(hwnd);
1044 if (pState) {
1045 pci = (PCNRITEM) WinSendDlgItemMsg(hwnd, DSZ_CNR,
1046 CM_QUERYRECORDEMPHASIS,
1047 MPFROMLONG(CMA_FIRST),
1048 MPFROMSHORT(CRA_CURSORED));
1049 if (pci) {
1050 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
1051 WinEnableWindow(WinWindowFromID(hwnd, IDM_HELP), FALSE);
1052 WinEnableWindow(WinWindowFromID(hwnd, DSZ_COLLAPSE), FALSE);
1053 WinEnableWindow(WinWindowFromID(hwnd, DSZ_EXPAND), FALSE);
1054 WinEnableWindow(WinWindowFromID(hwnd, DSZ_PRINT), FALSE);
1055 WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
1056 if (SHORT1FROMMP(mp1) == DSZ_EXPAND) {
1057 EXPANDSIZE *expandsize;
1058
1059 expandsize = xmalloc(sizeof(EXPANDSIZE), pszSrcFile, __LINE__);
1060 if (expandsize) {
1061
1062 expandsize->pci = pci;
1063 expandsize->hwndCnr = WinWindowFromID(hwnd, DSZ_CNR);
1064 if (xbeginthread(ExpandCnrThread,
1065 122880 * 5,
1066 expandsize,
1067 pszSrcFile,
1068 __LINE__) == -1)
1069 xfree(expandsize, pszSrcFile, __LINE__);
1070 }
1071 }
1072 else
1073 CollapseAll(WinWindowFromID(hwnd, DSZ_CNR), pci);
1074 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
1075 WinEnableWindow(WinWindowFromID(hwnd, IDM_HELP), TRUE);
1076 WinEnableWindow(WinWindowFromID(hwnd, DSZ_COLLAPSE), TRUE);
1077 WinEnableWindow(WinWindowFromID(hwnd, DSZ_EXPAND), TRUE);
1078 WinEnableWindow(WinWindowFromID(hwnd, DSZ_PRINT), TRUE);
1079 WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), TRUE);
1080 }
1081 }
1082 break;
1083
1084 case DID_OK:
1085 case DID_CANCEL:
1086 {
1087 SWP swp;
1088 ULONG size = sizeof(SWP);
1089
1090 WinQueryWindowPos(hwnd, &swp);
1091 PrfWriteProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, size);
1092 }
1093 pState = INSTDATA(hwnd);
1094 if (!pState)
1095 Runtime_Error(pszSrcFile, __LINE__, NULL);
1096 else {
1097 if (pState->working) {
1098 pState->dying = TRUE;
1099 pState->chStopFlag = (CHAR)0xff;
1100 if (!fAlertBeepOff)
1101 DosBeep(1000, 100); // Complain?
1102 }
1103 else
1104 WinDismissDlg(hwnd, 0);
1105 }
1106 break;
1107 } // switch mp1
1108 return 0;
1109
1110 case WM_CLOSE:
1111 pState = INSTDATA(hwnd);
1112 if (pState)
1113 pState->chStopFlag = (CHAR)0xff;
1114 DosSleep(1);
1115 break;
1116
1117 case WM_DESTROY:
1118 pState = INSTDATA(hwnd);
1119 EmptyCnr(hwnd);
1120 if (pState) {
1121 pState->chStopFlag = (CHAR)0xff;
1122 if (pState->hptr)
1123 WinDestroyPointer(pState->hptr);
1124 DosSleep(16); //05 Aug 07 GKY 33
1125 xfree(pState, pszSrcFile, __LINE__); // Let's hope no one is still looking
1126# ifdef FORTIFY
1127 Fortify_LeaveScope();
1128# endif
1129 }
1130 DosPostEventSem(CompactSem);
1131 break;
1132 }
1133 return WinDefDlgProc(hwnd, msg, mp1, mp2);
1134}
1135
1136#pragma alloc_text(DIRSIZE,ProcessDir,FillCnrThread,DirSizeProc)
1137#pragma alloc_text(DIRSIZE2,PrintToFile,FillInRecSizes,SortSizeCnr)
1138
Note: See TracBrowser for help on using the repository browser.