source: trunk/dll/comp.c@ 574

Last change on this file since 574 was 574, checked in by Gregg Young, 18 years ago

Use QWL_USER; Replace doesn't move the command and Okay on cmd dialog removed error on unchanged command

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 77.7 KB
Line 
1
2/***********************************************************************
3
4 $Id: comp.c 574 2007-03-23 22:37:07Z gyoung $
5
6 Compare directories
7
8 Copyright (c) 1993-02 M. Kimes
9 Copyright (c) 2003, 2007 Steven H. Levine
10
11 16 Oct 02 MK Baseline
12 04 Nov 03 SHL Force window refresh after subdir toggle
13 01 Aug 04 SHL Rework lstrip/rstrip usage
14 24 May 05 SHL Rework Win_Error usage
15 24 May 05 SHL Rework for CNRITEM.szSubject
16 25 May 05 SHL Rework with ULONGLONG
17 06 Jun 05 SHL Drop unused
18 12 Jul 06 SHL Renames and comments
19 13 Jul 06 SHL Use Runtime_Error
20 26 Jul 06 SHL Drop unreachable CN_... code
21 29 Jul 06 SHL Use xfgets_bstripcr
22 15 Aug 06 SHL Turn off hide not selected on dir change
23 19 Oct 06 SHL Correct . and .. detect
24 03 Nov 06 SHL Count thread usage
25 22 Mar 07 GKY Use QWL_USER
26
27***********************************************************************/
28
29#define INCL_DOS
30#define INCL_WIN
31#define INCL_GPI
32#define INCL_LONGLONG
33#include <os2.h>
34
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38#include <ctype.h>
39#include <share.h>
40#include <io.h>
41
42#include "fm3dll.h"
43#include "fm3dlg.h"
44#include "fm3str.h"
45
46#pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames)
47#pragma alloc_text(COMPAREDIR1,CompareDlgProc)
48#pragma alloc_text(COMPAREDIR2,SelectCnrsThread,ActionCnrThread)
49#pragma alloc_text(COMPAREFILE,CFileDlgProc,CompareFilesThread)
50#pragma alloc_text(SNAPSHOT,SnapShot,StartSnap)
51
52typedef struct
53{
54 CHAR filename[CCHMAXPATH];
55 CHAR dirname[CCHMAXPATH];
56 BOOL recurse;
57}
58SNAPSTUFF;
59
60static PSZ pszSrcFile = __FILE__;
61
62//=== SnapShot() Write directory tree to file and recurse if requested ===
63
64static VOID SnapShot(char *path, FILE * fp, BOOL recurse)
65{
66 FILEFINDBUF4 *fb;
67 char *mask, *enddir;
68 HDIR hdir = HDIR_CREATE;
69 ULONG nm = 1L;
70
71 fb = xmalloc(sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
72 if (fb) {
73 mask = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
74 if (mask) {
75 sprintf(mask,
76 "%s%s*",
77 path, (path[strlen(path) - 1] != '\\') ? "\\" : NullStr);
78 enddir = strrchr(mask, '\\');
79 enddir++;
80 if (!DosFindFirst(mask,
81 &hdir,
82 FILE_NORMAL | FILE_DIRECTORY |
83 FILE_ARCHIVED | FILE_READONLY | FILE_HIDDEN |
84 FILE_SYSTEM,
85 fb, sizeof(FILEFINDBUF4), &nm, FIL_QUERYEASIZE)) {
86 do {
87 strcpy(enddir, fb->achName);
88 if (!(fb->attrFile & FILE_DIRECTORY))
89 fprintf(fp,
90 "\"%s\",%u,%lu,%04u/%02u/%02u,%02u:%02u:%02u,%lu,%lu,N\n",
91 mask,
92 enddir - mask,
93 fb->cbFile,
94 (fb->fdateLastWrite.year + 1980),
95 fb->fdateLastWrite.month,
96 fb->fdateLastWrite.day,
97 fb->ftimeLastWrite.hours,
98 fb->ftimeLastWrite.minutes,
99 fb->ftimeLastWrite.twosecs,
100 fb->attrFile, (fb->cbList > 4L) ? (fb->cbList / 2L) : 0L);
101 // Skip . and ..
102 else if (recurse &&
103 (fb->achName[0] != '.' ||
104 (fb->achName[1] &&
105 (fb->achName[1] != '.' || fb->achName[2])))) {
106 SnapShot(mask, fp, recurse);
107 }
108 nm = 1L;
109 } while (!DosFindNext(hdir, fb, sizeof(FILEFINDBUF4), &nm));
110 DosFindClose(hdir);
111 }
112 free(mask);
113 }
114 free(fb);
115 }
116}
117
118//=== StartSnap() Write directory tree to snapshot file ===
119
120static VOID StartSnap(VOID * dummy)
121{
122 SNAPSTUFF *sf = (SNAPSTUFF *) dummy;
123 FILE *fp;
124 CHAR *p;
125
126 if (sf) {
127 if (*sf->dirname && *sf->filename) {
128 priority_normal();
129 p = sf->dirname;
130 while (*p) {
131 if (*p == '/')
132 *p = '\\';
133 p++;
134 }
135 if (*(p - 1) != '\\') {
136 *p = '\\';
137 p++;
138 }
139 fp = xfopen(sf->filename, "w", pszSrcFile, __LINE__);
140 if (fp) {
141 fprintf(fp, "\"%s\"\n", sf->dirname);
142 SnapShot(sf->dirname, fp, sf->recurse);
143 fclose(fp);
144 }
145 }
146 free(sf);
147 }
148}
149
150//=== CompareFilesThread() Compare files and update container select flags ===
151
152static VOID CompareFilesThread(VOID * args)
153{
154 FCOMPARE fc;
155 HAB hab2;
156 HMQ hmq2;
157 FILE *fp1, *fp2;
158 ULONG len1, len2, offset = 0L;
159 LONG numread1, numread2;
160 CHAR s[1024], ss[1024], *p1, *p2;
161
162 if (args) {
163 fc = *(FCOMPARE *) args;
164 hab2 = WinInitialize(0);
165 if (hab2) {
166 hmq2 = WinCreateMsgQueue(hab2, 0);
167 if (hmq2) {
168 WinCancelShutdown(hmq2, TRUE);
169 IncrThreadUsage();
170 if (!IsFile(fc.file1) || IsRoot(fc.file1)) {
171 p1 = strrchr(fc.file2, '\\');
172 if (p1) {
173 if (fc.file1[strlen(fc.file1) - 1] == '\\')
174 p1++;
175 strcat(fc.file1, p1);
176 }
177 }
178 else if (!IsFile(fc.file2) || IsRoot(fc.file2)) {
179 p1 = strrchr(fc.file1, '\\');
180 if (p1) {
181 if (fc.file2[strlen(fc.file2) - 1] == '\\')
182 p1++;
183 strcat(fc.file2, p1);
184 }
185 }
186 sprintf(s, GetPString(IDS_COMPCOMPARETEXT), fc.file1);
187 AddToListboxBottom(fc.hwndList, s);
188 sprintf(s, GetPString(IDS_COMPTOTEXT), fc.file2);
189 AddToListboxBottom(fc.hwndList, s);
190 fp1 = _fsopen(fc.file1, "rb", SH_DENYNO);
191 if (!fp1) {
192 sprintf(s, GetPString(IDS_COMPCANTOPENTEXT), fc.file1);
193 AddToListboxBottom(fc.hwndList, s);
194 WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
195 }
196 else {
197 fp2 = _fsopen(fc.file2, "rb", SH_DENYNO);
198 if (!fp2) {
199 sprintf(s, GetPString(IDS_COMPCANTOPENTEXT), fc.file2);
200 AddToListboxBottom(fc.hwndList, s);
201 WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
202 }
203 else {
204 len1 = filelength(fileno(fp1));
205 len2 = filelength(fileno(fp2));
206 if (len1 != len2) {
207 strcpy(s, GetPString(IDS_COMPDIFSIZESTEXT));
208 AddToListboxBottom(fc.hwndList, s);
209 sprintf(s, GetPString(IDS_COMPVSBYTESTEXT), len1, len2);
210 AddToListboxBottom(fc.hwndList, s);
211 WinSetWindowText(fc.hwndHelp,
212 GetPString(IDS_COMPDONTMATCHTEXT));
213 }
214 else {
215 WinSetWindowText(fc.hwndHelp,
216 GetPString(IDS_COMPCOMPARINGTEXT));
217 while (WinIsWindow(hab2, fc.hwndList)) {
218 numread1 = fread(s, 1, 1024, fp1);
219 numread2 = fread(ss, 1, 1024, fp2);
220 if (numread1 != numread2 || feof(fp1) != feof(fp2)) {
221 sprintf(s, GetPString(IDS_COMPREADERRORTEXT),
222 offset, offset);
223 AddToListboxBottom(fc.hwndList, s);
224 WinSetWindowText(fc.hwndHelp, GetPString(IDS_ERRORTEXT));
225 break;
226 }
227 else if (!numread1 && feof(fp1) && feof(fp2)) {
228 AddToListboxBottom(fc.hwndList,
229 GetPString(IDS_COMPFILESMATCHTEXT));
230 if (!stricmp(fc.file1, fc.file2))
231 AddToListboxBottom(fc.hwndList,
232 GetPString(IDS_COMPWONDERWHYTEXT));
233 WinSetWindowText(fc.hwndHelp,
234 GetPString(IDS_COMPCOMPLETETEXT));
235 break;
236 }
237 else if (numread1 <= 0 || numread2 <= 0) {
238 if (offset == len1)
239 break;
240 else {
241 sprintf(s, GetPString(IDS_COMPMATCHREADERRORTEXT),
242 offset, offset);
243 WinSetWindowText(fc.hwndHelp,
244 GetPString(IDS_COMPODDERRORTEXT));
245 AddToListboxBottom(fc.hwndList, s);
246 break;
247 }
248 }
249 else if (memcmp(s, ss, numread1)) {
250 p1 = s;
251 p2 = ss;
252 while (p1 < s + numread1) {
253 if (*p1 != *p2) {
254 sprintf(s, GetPString(IDS_COMPMISMATCHERRORTEXT),
255 offset + (p1 - s), offset + (p1 - s));
256 AddToListboxBottom(fc.hwndList, s);
257 WinSetWindowText(fc.hwndHelp,
258 GetPString(IDS_COMPDONTMATCHTEXT));
259 break;
260 }
261 p1++;
262 p2++;
263 }
264 break;
265 }
266 offset += numread1;
267 }
268 }
269 fclose(fp2);
270 }
271 fclose(fp1);
272 }
273 DecrThreadUsage();
274 WinDestroyMsgQueue(hmq2);
275 }
276 WinTerminate(hab2);
277 }
278 }
279}
280
281//=== CFileDlgProc() Select directories to compare dialog procedure ===
282
283MRESULT EXPENTRY CFileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
284{
285 FCOMPARE *fc;
286
287 switch (msg) {
288 case WM_INITDLG:
289 if (!mp2)
290 WinDismissDlg(hwnd, 0);
291 else {
292 WinSetWindowPtr(hwnd, QWL_USER, mp2);
293 fc = (FCOMPARE *) mp2;
294 fc->hwndReport = hwnd;
295 fc->hwndList = WinWindowFromID(hwnd, FCMP_LISTBOX);
296 fc->hwndHelp = WinWindowFromID(hwnd, FCMP_HELP);
297 if (!*fc->file1 || !fc->file2) {
298 WinDismissDlg(hwnd, 0);
299 break;
300 }
301 MakeFullName(fc->file1);
302 MakeFullName(fc->file2);
303 if (!stricmp(fc->file1, fc->file2)) {
304 saymsg(MB_CANCEL, hwnd,
305 GetPString(IDS_COMPSILLYALERTTEXT),
306 GetPString(IDS_COMPTOITSELFTEXT));
307 WinDismissDlg(hwnd, 0);
308 break;
309 }
310 if (_beginthread(CompareFilesThread, NULL, 65536, (PVOID) fc) == -1) {
311 Runtime_Error(pszSrcFile, __LINE__,
312 GetPString(IDS_COULDNTSTARTTHREADTEXT));
313 WinDismissDlg(hwnd, 0);
314 }
315 }
316 break;
317
318 case WM_ADJUSTWINDOWPOS:
319 PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
320 break;
321
322 case UM_SETDIR:
323 PaintRecessedWindow(WinWindowFromID(hwnd, FCMP_HELP),
324 (HPS) 0, FALSE, TRUE);
325 return 0;
326
327 case WM_COMMAND:
328 switch (SHORT1FROMMP(mp1)) {
329 case DID_OK:
330 WinDismissDlg(hwnd, 0);
331 break;
332 case DID_CANCEL:
333 WinDismissDlg(hwnd, 1);
334 break;
335 }
336 return 0;
337
338 case WM_DESTROY:
339 DosSleep(100L);
340 break;
341 }
342 return WinDefDlgProc(hwnd, msg, mp1, mp2);
343}
344
345//=== ActionCnrThread() Do requested action on container contents ===
346
347static VOID ActionCnrThread(VOID * args)
348{
349 COMPARE *cmp = (COMPARE *) args;
350 HAB hab;
351 HMQ hmq;
352 HWND hwndCnrS, hwndCnrD;
353 PCNRITEM pci, pciO, pcin, pciOn;
354 CHAR newname[CCHMAXPATH], dirname[CCHMAXPATH], *p;
355 APIRET rc;
356
357 if (!cmp)
358 return;
359
360 DosError(FERR_DISABLEHARDERR);
361
362 hab = WinInitialize(0);
363 if (hab) {
364 hmq = WinCreateMsgQueue(hab, 0);
365 if (hmq) {
366 WinCancelShutdown(hmq, TRUE);
367 IncrThreadUsage();
368 priority_normal();
369 switch (cmp->action) {
370 case COMP_DELETELEFT:
371 hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
372 hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
373 cmp->action = IDM_DELETE;
374 break;
375 case COMP_DELETERIGHT:
376 hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
377 hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
378 cmp->action = IDM_DELETE;
379 break;
380 case COMP_MOVELEFT:
381 cmp->action = IDM_MOVE;
382 hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
383 hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
384 break;
385 case COMP_MOVERIGHT:
386 cmp->action = IDM_MOVE;
387 hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
388 hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
389 break;
390 case COMP_COPYLEFT:
391 cmp->action = IDM_COPY;
392 hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
393 hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
394 break;
395 case COMP_COPYRIGHT:
396 cmp->action = IDM_COPY;
397 hwndCnrS = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
398 hwndCnrD = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
399 break;
400 default:
401 Runtime_Error(pszSrcFile, __LINE__, "bad case %u", cmp->action);
402 goto Abort;
403 }
404
405 pci = WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPVOID,
406 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
407 pciO = WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPVOID,
408 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
409 while (pci && (INT) pci != -1 && pciO && (INT) pciO != -1) {
410
411 pcin = WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPFROMP(pci),
412 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
413 pciOn = WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPFROMP(pciO),
414 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
415 if (*pci->szFileName && (pci->rc.flRecordAttr & CRA_SELECTED)) {
416 switch (cmp->action) {
417 case IDM_DELETE:
418 if (!unlinkf("%s", pci->szFileName)) {
419 WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pci),
420 MPFROM2SHORT(FALSE, CRA_SELECTED));
421 if (!*pciO->szFileName) {
422 WinSendMsg(hwndCnrS, CM_REMOVERECORD, MPFROMP(&pci),
423 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE));
424 if (pciO->rc.flRecordAttr & CRA_SELECTED)
425 WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciO),
426 MPFROM2SHORT(FALSE, CRA_SELECTED));
427 WinSendMsg(hwndCnrD, CM_REMOVERECORD, MPFROMP(&pciO),
428 MPFROM2SHORT(1, CMA_FREE | CMA_INVALIDATE));
429 }
430 else {
431 *pci->szFileName = 0;
432 pci->pszFileName = pci->szFileName;
433 pci->flags = 0;
434 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci),
435 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
436 }
437 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_LEFTDIR))
438 cmp->cmp->totalleft--;
439 else
440 cmp->cmp->totalright--;
441 DosSleep(0L);
442 }
443 break;
444
445 case IDM_MOVE:
446 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
447 sprintf(newname, "%s%s%s", cmp->leftdir,
448 cmp->leftdir[strlen(cmp->leftdir) - 1] ==
449 '\\' ? NullStr : "\\", pci->pszFileName);
450 else
451 sprintf(newname, "%s%s%s", cmp->rightdir,
452 cmp->rightdir[strlen(cmp->rightdir) - 1] ==
453 '\\' ? NullStr : "\\", pci->pszFileName);
454 /* make directory if required */
455 strcpy(dirname, newname);
456 p = strrchr(dirname, '\\');
457 if (p) {
458 if (p > dirname + 2)
459 p++;
460 *p = 0;
461 if (IsFile(dirname) == -1)
462 MassMkdir(hwndMain, dirname);
463 }
464 rc = docopyf(MOVE, pci->szFileName, "%s", newname);
465 if (!rc && stricmp(pci->szFileName, newname)) {
466 WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pci),
467 MPFROM2SHORT(FALSE, CRA_SELECTED));
468 if (pciO->rc.flRecordAttr & CRA_SELECTED)
469 WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciO),
470 MPFROM2SHORT(FALSE, CRA_SELECTED));
471 strcpy(pciO->szFileName, newname);
472 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
473 pciO->pszFileName = pciO->szFileName + strlen(cmp->leftdir);
474 if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
475 pciO->pszFileName++;
476 }
477 else {
478 pciO->pszFileName = pciO->szFileName + strlen(cmp->rightdir);
479 if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
480 pciO->pszFileName++;
481 }
482 strcpy(pciO->szDispAttr, pci->szDispAttr);
483 pciO->attrFile = pci->attrFile;
484 pciO->flags = 0;
485 pciO->date = pci->date;
486 pciO->time = pci->time;
487 pciO->ladate = pci->ladate;
488 pciO->latime = pci->latime;
489 pciO->crdate = pci->crdate;
490 pciO->crtime = pci->crtime;
491 pciO->cbFile = pci->cbFile;
492 pciO->easize = pci->easize;
493 *pciO->szSubject = 0;
494 *pci->szFileName = 0;
495 pci->pszFileName = pci->szFileName;
496 pci->flags = 0;
497 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci),
498 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
499 WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciO),
500 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
501 }
502 else if (rc) {
503 rc = Dos_Error(MB_ENTERCANCEL,
504 rc,
505 HWND_DESKTOP,
506 pszSrcFile,
507 __LINE__,
508 GetPString(IDS_COMPMOVEFAILEDTEXT),
509 pci->szFileName, newname);
510 if (rc == MBID_CANCEL) /* cause loop to break */
511 pcin = NULL;
512 }
513 break;
514
515 case IDM_COPY:
516 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR))
517 sprintf(newname, "%s%s%s", cmp->leftdir,
518 cmp->leftdir[strlen(cmp->leftdir) - 1] ==
519 '\\' ? NullStr : "\\", pci->pszFileName);
520 else
521 sprintf(newname, "%s%s%s", cmp->rightdir,
522 cmp->rightdir[strlen(cmp->rightdir) - 1] ==
523 '\\' ? NullStr : "\\", pci->pszFileName);
524 /* make directory if required */
525 strcpy(dirname, newname);
526 p = strrchr(dirname, '\\');
527 if (p) {
528 if (p > dirname + 2)
529 p++;
530 *p = 0;
531 if (IsFile(dirname) == -1)
532 MassMkdir(hwndMain, dirname);
533 }
534 rc = docopyf(COPY, pci->szFileName, "%s", newname);
535 if (rc) {
536 rc = Dos_Error(MB_ENTERCANCEL,
537 rc,
538 HWND_DESKTOP,
539 pszSrcFile,
540 __LINE__,
541 GetPString(IDS_COMPCOPYFAILEDTEXT),
542 pci->szFileName, newname);
543 if (rc == MBID_CANCEL)
544 pcin = NULL; /* cause loop to break */
545 }
546 else {
547 WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pci),
548 MPFROM2SHORT(FALSE, CRA_SELECTED));
549 if (pciO->rc.flRecordAttr & CRA_SELECTED)
550 WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciO),
551 MPFROM2SHORT(FALSE, CRA_SELECTED));
552 strcpy(pciO->szFileName, newname);
553 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) {
554 pciO->pszFileName = pciO->szFileName + strlen(cmp->leftdir);
555 if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
556 pciO->pszFileName++;
557 }
558 else {
559 pciO->pszFileName = pciO->szFileName + strlen(cmp->rightdir);
560 if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
561 pciO->pszFileName++;
562 }
563 strcpy(pciO->szDispAttr, pci->szDispAttr);
564 pciO->attrFile = pci->attrFile;
565 pciO->flags = CNRITEM_EXISTS;
566 pciO->date = pci->date;
567 pciO->time = pci->time;
568 pciO->ladate = pci->ladate;
569 pciO->latime = pci->latime;
570 pciO->crdate = pci->crdate;
571 pciO->crtime = pci->crtime;
572 pciO->cbFile = pci->cbFile;
573 pciO->easize = pci->easize;
574 *pci->szSubject = 0;
575 pci->flags = CNRITEM_EXISTS;
576 WinSendMsg(hwndCnrS, CM_INVALIDATERECORD, MPFROMP(&pci),
577 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
578 WinSendMsg(hwndCnrD, CM_INVALIDATERECORD, MPFROMP(&pciO),
579 MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
580 }
581 break;
582
583 default:
584 break;
585 } // switch
586 }
587 pci = pcin;
588 pciO = pciOn;
589 } // while
590 Abort:
591 WinDestroyMsgQueue(hmq);
592 }
593 DecrThreadUsage();
594 WinTerminate(hab);
595 }
596 PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID);
597 PostMsg(cmp->hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DESELECTALL, 0), MPVOID);
598 free(cmp);
599}
600
601//=== SelectCnrsThread() Update container selection flags thread ===
602
603static VOID SelectCnrsThread(VOID * args)
604{
605 COMPARE *cmp = (COMPARE *) args;
606 HAB hab;
607 HMQ hmq;
608
609 if (!cmp)
610 return;
611
612 DosError(FERR_DISABLEHARDERR);
613
614 hab = WinInitialize(0);
615 if (hab) {
616 hmq = WinCreateMsgQueue(hab, 0);
617 if (hmq) {
618 WinCancelShutdown(hmq, TRUE);
619 IncrThreadUsage();
620 priority_normal();
621 switch (cmp->action) {
622 case IDM_INVERT:
623 InvertAll(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR));
624 InvertAll(WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR));
625 break;
626
627 case IDM_DESELECTALL:
628 Deselect(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR));
629 Deselect(WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR));
630 break;
631
632 default:
633 SpecialSelect(WinWindowFromID(cmp->hwnd, COMP_LEFTDIR),
634 WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR),
635 cmp->action, cmp->reset);
636 break;
637 }
638 if (!PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID))
639 WinSendMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPFROMLONG(1L), MPVOID);
640 WinDestroyMsgQueue(hmq);
641 }
642 DecrThreadUsage();
643 WinTerminate(hab);
644 }
645 free(cmp);
646}
647
648static VOID FillDirList(CHAR * str, INT skiplen, BOOL recurse,
649 FILELIST *** list, INT * numfiles, INT * numalloc)
650{
651
652 register BYTE *fb;
653 register CHAR *enddir;
654 register ULONG x;
655 CHAR *maskstr;
656 FILEFINDBUF4 *ffb4, *pffb;
657 HDIR hDir;
658 ULONG nm, fl = 0, ulM = 64;
659 APIRET rc;
660
661 if (!str || !*str)
662 return;
663 if (!recurse)
664 ulM = 128;
665 maskstr = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__);
666 if (!maskstr)
667 return;
668 ffb4 = xmalloc(sizeof(FILEFINDBUF4) * ulM, pszSrcFile, __LINE__);
669 if (!ffb4) {
670 free(maskstr);
671 return;
672 }
673 x = strlen(str);
674 memcpy(maskstr, str, x + 1);
675 enddir = maskstr + x;
676 if (*(enddir - 1) != '\\') {
677 *enddir = '\\';
678 enddir++;
679 *enddir = 0;
680 }
681 *enddir = '*';
682 *(enddir + 1) = 0;
683 hDir = HDIR_CREATE;
684 nm = ulM;
685 if (recurse)
686 fl = FILE_DIRECTORY;
687 DosError(FERR_DISABLEHARDERR);
688 rc = DosFindFirst(maskstr, &hDir,
689 (FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
690 FILE_SYSTEM | FILE_HIDDEN) | fl,
691 ffb4, sizeof(FILEFINDBUF4) * nm, &nm, FIL_QUERYEASIZE);
692 if (!rc) {
693 while (!rc) {
694 fb = (BYTE *) ffb4;
695 x = 0;
696 while (x < nm) {
697 pffb = (FILEFINDBUF4 *) fb;
698 if (pffb->attrFile & FILE_DIRECTORY) {
699 // Skip . and ..
700 if (recurse &&
701 (pffb->achName[0] != '.' ||
702 (pffb->achName[1] &&
703 (pffb->achName[1] != '.' || pffb->achName[2])))) {
704 if (fForceUpper)
705 strupr(pffb->achName);
706 else if (fForceLower)
707 strlwr(pffb->achName);
708 memcpy(enddir, pffb->achName, pffb->cchName + 1);
709 FillDirList(maskstr, skiplen, recurse, list, numfiles, numalloc);
710 }
711 }
712 else {
713 if (fForceUpper)
714 strupr(pffb->achName);
715 else if (fForceLower)
716 strlwr(pffb->achName);
717 memcpy(enddir, pffb->achName, pffb->cchName + 1);
718 if (AddToFileList
719 (maskstr + skiplen, pffb, list, numfiles, numalloc))
720 goto Abort;
721 }
722 fb += pffb->oNextEntryOffset;
723 x++;
724 }
725 nm = ulM;
726 DosError(FERR_DISABLEHARDERR);
727 rc = DosFindNext(hDir, ffb4, sizeof(FILEFINDBUF4) * nm, &nm);
728 }
729 Abort:
730 DosFindClose(hDir);
731 DosSleep(0L);
732 }
733 free(maskstr);
734 free(ffb4);
735}
736
737//=== CompNames() Compare names for qsort ===
738
739static int CompNames(const void *n1, const void *n2)
740{
741 FILELIST *fl1 = *(FILELIST **) n1;
742 FILELIST *fl2 = *(FILELIST **) n2;
743
744 return stricmp(fl1->fname, fl2->fname);
745}
746
747//=== FillCnrsThread() Fill left and right containers ===
748
749static VOID FillCnrsThread(VOID * args)
750{
751 COMPARE *cmp = (COMPARE *) args;
752 HAB hab;
753 HMQ hmq;
754 BOOL notified = FALSE;
755 static CHAR attrstring[] = "RHS\0DA";
756 HWND hwndLeft, hwndRight;
757
758 if (!cmp)
759 _endthread();
760
761 DosError(FERR_DISABLEHARDERR);
762
763 hab = WinInitialize(0);
764 if (!hab)
765 Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, "WinInitialize");
766 else {
767 hmq = WinCreateMsgQueue(hab, 0);
768 if (!hmq)
769 Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__,
770 "WinCreateMsgQueue");
771 else {
772 INT x;
773 INT l;
774 INT r;
775 INT y;
776 ULONG cntr;
777 FILELIST **filesl = NULL;
778 FILELIST **filesr = NULL;
779 INT numfilesl = 0;
780 INT numfilesr = 0;
781 INT numallocl = 0;
782 INT numallocr = 0;
783 INT lenl; // Directory prefix length
784 INT lenr;
785 UINT recsNeeded; // fixme to check ovf
786 PCNRITEM pcilFirst;
787 PCNRITEM pcirFirst;
788 PCNRITEM pcil;
789 PCNRITEM pcir;
790 PCNRITEM pcit;
791 RECORDINSERT ri;
792 CHAR *pch;
793
794 WinCancelShutdown(hmq, TRUE);
795 IncrThreadUsage();
796 hwndLeft = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
797 hwndRight = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
798 lenl = strlen(cmp->leftdir);
799 if (cmp->leftdir[strlen(cmp->leftdir) - 1] != '\\')
800 lenl++;
801 lenr = strlen(cmp->rightdir);
802 if (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\')
803 lenr++;
804 priority_normal();
805 /* clear containers */
806 WinSendMsg(hwndRight, CM_REMOVERECORD,
807 MPVOID, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE));
808 WinSendMsg(hwndLeft, CM_REMOVERECORD,
809 MPVOID, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE));
810 cmp->cmp->totalleft = cmp->cmp->totalright = 0;
811
812 /* build list of all files in left directory */
813 if (fForceLower)
814 strlwr(cmp->leftdir);
815 else if (fForceUpper)
816 strupr(cmp->leftdir);
817 FillDirList(cmp->leftdir, lenl, cmp->includesubdirs,
818 &filesl, &numfilesl, &numallocl);
819
820 if (filesl)
821 qsort(filesl, numfilesl, sizeof(CHAR *), CompNames);
822 /* build list of all files in right directory */
823 if (!*cmp->rightlist) {
824 if (fForceLower)
825 strlwr(cmp->rightdir);
826 else if (fForceUpper)
827 strupr(cmp->rightdir);
828 FillDirList(cmp->rightdir, lenr, cmp->includesubdirs,
829 &filesr, &numfilesr, &numallocr);
830 }
831 else {
832 /* use snapshot file */
833 FILE *fp;
834 FILEFINDBUF4 fb4;
835 CHAR str[CCHMAXPATH * 2], *p;
836
837 memset(&fb4, 0, sizeof(fb4));
838 fp = fopen(cmp->rightlist, "r");
839 if (!fp)
840 Runtime_Error(pszSrcFile, __LINE__, "can not open %s (%d)",
841 cmp->rightlist, errno);
842 else {
843 while (!feof(fp)) {
844 /* first get name of directory */
845 if (!xfgets_bstripcr(str, sizeof(str), fp, pszSrcFile, __LINE__))
846 break; // EOF
847 p = str;
848 if (*p == '\"') {
849 /* Quoted */
850 p++;
851 if (*p && *p != '\"') {
852 p = strchr(p, '\"');
853 if (p) {
854 *p = 0;
855 if (*(str + 1)) {
856 strcpy(cmp->rightdir, str + 1);
857 if (fForceUpper)
858 strupr(cmp->rightdir);
859 else if (fForceLower)
860 strlwr(cmp->rightdir);
861 p = cmp->rightdir + (strlen(cmp->rightdir) - 1);
862 if (p - cmp->rightdir > 3 && *p == '\\')
863 *p = 0; // Chop trailing slash
864 break;
865 }
866 }
867 }
868 }
869 } // while !EOF
870 {
871 CNRINFO cnri;
872
873 memset(&cnri, 0, sizeof(cnri));
874 cnri.cb = sizeof(cnri);
875 cnri.pszCnrTitle = cmp->rightdir;
876 WinSendMsg(hwndRight, CM_SETCNRINFO,
877 MPFROMP(&cnri), MPFROMLONG(CMA_CNRTITLE));
878 }
879 if (*cmp->rightdir) {
880 lenr = strlen(cmp->rightdir) +
881 (cmp->rightdir[strlen(cmp->rightdir) - 1] != '\\');
882 while (!feof(fp)) {
883 if (!xfgets_bstripcr
884 (str, sizeof(str), fp, pszSrcFile, __LINE__))
885 break;
886 p = str;
887 if (*p == '\"') {
888 p++;
889 if (*p && *p != '\"') {
890 p = strchr(p, '\"');
891 if (p) {
892 *p = 0;
893 p++;
894 if (*p == ',') {
895 p++;
896 if (!cmp->includesubdirs && atol(p) > lenr)
897 continue;
898 p = strchr(p, ',');
899 if (p) {
900 p++;
901 fb4.cbFile = atol(p);
902 p = strchr(p, ',');
903 if (p) {
904 p++;
905 fb4.fdateLastWrite.year = atol(p) - 1980;
906 p = strchr(p, '/');
907 if (p) {
908 p++;
909 fb4.fdateLastWrite.month = atol(p);
910 p = strchr(p, '/');
911 if (p) {
912 p++;
913 fb4.fdateLastWrite.day = atol(p);
914 p = strchr(p, ',');
915 if (p) {
916 p++;
917 fb4.ftimeLastWrite.hours = atol(p);
918 p = strchr(p, ':');
919 if (p) {
920 p++;
921 fb4.ftimeLastWrite.minutes = atol(p);
922 p = strchr(p, ':');
923 if (p) {
924 p++;
925 fb4.ftimeLastWrite.twosecs = atol(p);
926 p = strchr(p, ',');
927 if (p) {
928 p++;
929 fb4.attrFile = atol(p);
930 p = strchr(p, ',');
931 if (p) {
932 p++;
933 fb4.cbList = atol(p) * 2;
934 if (fForceUpper)
935 strupr(str + 1);
936 else if (fForceLower)
937 strlwr(str + 1);
938 if (AddToFileList((str + 1) + lenr,
939 &fb4,
940 &filesr,
941 &numfilesr,
942 &numallocr))
943 break;
944 }
945 }
946 }
947 }
948 }
949 }
950 }
951 }
952 }
953 }
954 }
955 }
956 }
957 } // while
958 } // if have rightdir
959 fclose(fp);
960 }
961 } // if snapshot file
962
963 if (filesr)
964 qsort(filesr, numfilesr, sizeof(CHAR *), CompNames);
965
966 /* we now have two lists of files, both sorted. */
967 /* first, count total number of container entries required */
968 l = r = 0;
969 recsNeeded = 0;
970 while ((filesl && filesl[l]) || (filesr && filesr[r])) {
971 if ((filesl && filesl[l]) && (filesr && filesr[r])) {
972 x = stricmp(filesl[l]->fname, filesr[r]->fname);
973 if (!x) {
974 l++; // In both
975 r++;
976 }
977 else if (x < 0)
978 l++; // In left only
979 else
980 r++; // In right only
981 }
982 else if (filesl && filesl[l])
983 l++; // In left only
984 else /* filesr && filesr[r] */
985 r++; // In right only
986 recsNeeded++; /* keep count of how many entries req'd */
987 }
988 WinSendMsg(cmp->hwnd, UM_CONTAINERHWND, MPVOID, MPVOID);
989 /* now insert records into the containers */
990 cntr = 0;
991 l = r = 0;
992 if (recsNeeded) {
993 pcilFirst = WinSendMsg(hwndLeft,
994 CM_ALLOCRECORD,
995 MPFROMLONG(EXTRA_RECORD_BYTES2),
996 MPFROMLONG(recsNeeded));
997 if (!pcilFirst) {
998 Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
999 recsNeeded);
1000 recsNeeded = 0;
1001 }
1002 }
1003 if (recsNeeded) {
1004 pcirFirst = WinSendMsg(hwndRight, CM_ALLOCRECORD,
1005 MPFROMLONG(EXTRA_RECORD_BYTES2),
1006 MPFROMLONG(recsNeeded));
1007 if (!pcirFirst) {
1008 Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD %u failed",
1009 recsNeeded);
1010 recsNeeded = 0;
1011 pcil = pcilFirst;
1012 while (pcil) {
1013 pcit = (PCNRITEM) pcil->rc.preccNextRecord;
1014 WinSendMsg(hwndLeft, CM_FREERECORD,
1015 MPFROMP(&pcil), MPFROMSHORT(1));
1016 pcil = pcit;
1017 }
1018 }
1019 }
1020 if (recsNeeded) {
1021 pcil = pcilFirst;
1022 pcir = pcirFirst;
1023 while ((filesl && filesl[l]) || (filesr && filesr[r])) {
1024 pcir->hwndCnr = hwndRight;
1025 pcir->pszFileName = pcir->szFileName;
1026 pcir->rc.pszIcon = pcir->pszFileName;
1027 pcir->rc.hptrIcon = (HPOINTER) 0;
1028 pcir->pszSubject = pcir->szSubject;
1029 pcir->pszLongname = pcir->szLongname;
1030 pcir->pszDispAttr = pcir->szDispAttr;
1031 pcil->hwndCnr = hwndLeft;
1032 pcil->pszFileName = pcil->szFileName;
1033 pcil->rc.pszIcon = pcil->pszFileName;
1034 pcil->rc.hptrIcon = (HPOINTER) 0;
1035 pcil->pszDispAttr = pcil->szDispAttr;
1036 pcil->pszSubject = pcil->szSubject;
1037 pcil->pszLongname = pcil->szLongname;
1038 if ((filesl && filesl[l]) && (filesr && filesr[r])) {
1039 x = stricmp(filesl[l]->fname, filesr[r]->fname);
1040 if (!x) {
1041 // Same
1042 sprintf(pcil->szFileName, "%s%s%s", cmp->leftdir,
1043 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ?
1044 NullStr : "\\", filesl[l]->fname);
1045 // pcil->rc.hptrIcon = hptrFile;
1046 pcil->pszFileName = pcil->szFileName + lenl;
1047 pcil->attrFile = filesl[l]->attrFile;
1048 y = 0;
1049 for (x = 0; x < 6; x++) {
1050 if (attrstring[x])
1051 pcil->szDispAttr[y++] =
1052 (CHAR) ((pcil->
1053 attrFile & (1 << x)) ? attrstring[x] : '-');
1054 }
1055 pcil->szDispAttr[5] = 0;
1056 pcil->cbFile = filesl[l]->cbFile;
1057 pcil->easize = filesl[l]->easize;
1058 pcil->date.day = filesl[l]->date.day;
1059 pcil->date.month = filesl[l]->date.month;
1060 pcil->date.year = filesl[l]->date.year + 1980;
1061 pcil->time.seconds = filesl[l]->time.twosecs * 2;
1062 pcil->time.minutes = filesl[l]->time.minutes;
1063 pcil->time.hours = filesl[l]->time.hours;
1064 pcil->ladate.day = filesl[l]->ladate.day;
1065 pcil->ladate.month = filesl[l]->ladate.month;
1066 pcil->ladate.year = filesl[l]->ladate.year + 1980;
1067 pcil->latime.seconds = filesl[l]->latime.twosecs * 2;
1068 pcil->latime.minutes = filesl[l]->latime.minutes;
1069 pcil->latime.hours = filesl[l]->latime.hours;
1070 pcil->crdate.day = filesl[l]->crdate.day;
1071 pcil->crdate.month = filesl[l]->crdate.month;
1072 pcil->crdate.year = filesl[l]->crdate.year + 1980;
1073 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;
1074 pcil->crtime.minutes = filesl[l]->crtime.minutes;
1075 pcil->crtime.hours = filesl[l]->crtime.hours;
1076 if (*cmp->dcd.mask.szMask) {
1077 if (!Filter((PMINIRECORDCORE) pcil, (PVOID) & cmp->dcd.mask)) {
1078 pcil->rc.flRecordAttr |= CRA_FILTERED;
1079 pcir->rc.flRecordAttr |= CRA_FILTERED;
1080 }
1081 }
1082 sprintf(pcir->szFileName, "%s%s%s", cmp->rightdir,
1083 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ?
1084 NullStr : "\\", filesr[r]->fname);
1085 pcir->pszFileName = pcir->szFileName + lenr;
1086 pcir->attrFile = filesr[r]->attrFile;
1087 // pcir->rc.hptrIcon = hptrFile;
1088 y = 0;
1089 for (x = 0; x < 6; x++)
1090 if (attrstring[x])
1091 pcir->szDispAttr[y++] =
1092 (CHAR) ((pcir->
1093 attrFile & (1 << x)) ? attrstring[x] : '-');
1094 pcir->szDispAttr[5] = 0;
1095 pcir->cbFile = filesr[r]->cbFile;
1096 pcir->easize = filesr[r]->easize;
1097 pcir->date.day = filesr[r]->date.day;
1098 pcir->date.month = filesr[r]->date.month;
1099 pcir->date.year = filesr[r]->date.year + 1980;
1100 pcir->time.seconds = filesr[r]->time.twosecs * 2;
1101 pcir->time.minutes = filesr[r]->time.minutes;
1102 pcir->time.hours = filesr[r]->time.hours;
1103 pcir->ladate.day = filesr[r]->ladate.day;
1104 pcir->ladate.month = filesr[r]->ladate.month;
1105 pcir->ladate.year = filesr[r]->ladate.year + 1980;
1106 pcir->latime.seconds = filesr[r]->latime.twosecs * 2;
1107 pcir->latime.minutes = filesr[r]->latime.minutes;
1108 pcir->latime.hours = filesr[r]->latime.hours;
1109 pcir->crdate.day = filesr[r]->crdate.day;
1110 pcir->crdate.month = filesr[r]->crdate.month;
1111 pcir->crdate.year = filesr[r]->crdate.year + 1980;
1112 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;
1113 pcir->crtime.minutes = filesr[r]->crtime.minutes;
1114 pcir->crtime.hours = filesr[r]->crtime.hours;
1115 pcil->flags |= CNRITEM_EXISTS;
1116 pcir->flags |= CNRITEM_EXISTS;
1117 pch = pcil->szSubject;
1118 if (pcil->cbFile + pcil->easize > pcir->cbFile + pcir->easize) {
1119 pcil->flags |= CNRITEM_LARGER;
1120 pcir->flags |= CNRITEM_SMALLER;
1121 strcpy(pch, GetPString(IDS_LARGERTEXT));
1122 pch += 6;
1123 }
1124 else if (pcil->cbFile + pcil->easize <
1125 pcir->cbFile + pcir->easize) {
1126 pcil->flags |= CNRITEM_SMALLER;
1127 pcir->flags |= CNRITEM_LARGER;
1128 strcpy(pch, GetPString(IDS_SMALLERTEXT));
1129 pch += 7;
1130 }
1131 if ((pcil->date.year > pcir->date.year) ? TRUE :
1132 (pcil->date.year < pcir->date.year) ? FALSE :
1133 (pcil->date.month > pcir->date.month) ? TRUE :
1134 (pcil->date.month < pcir->date.month) ? FALSE :
1135 (pcil->date.day > pcir->date.day) ? TRUE :
1136 (pcil->date.day < pcir->date.day) ? FALSE :
1137 (pcil->time.hours > pcir->time.hours) ? TRUE :
1138 (pcil->time.hours < pcir->time.hours) ? FALSE :
1139 (pcil->time.minutes > pcir->time.minutes) ? TRUE :
1140 (pcil->time.minutes < pcir->time.minutes) ? FALSE :
1141 (pcil->time.seconds > pcir->time.seconds) ? TRUE :
1142 (pcil->time.seconds < pcir->time.seconds) ? FALSE : FALSE) {
1143 pcil->flags |= CNRITEM_NEWER;
1144 pcir->flags |= CNRITEM_OLDER;
1145 if (pch != pcil->szSubject) {
1146 strcpy(pch, ", ");
1147 pch += 2;
1148 }
1149 strcpy(pch, GetPString(IDS_NEWERTEXT));
1150 pch += 5;
1151 }
1152 else if ((pcil->date.year < pcir->date.year) ? TRUE :
1153 (pcil->date.year > pcir->date.year) ? FALSE :
1154 (pcil->date.month < pcir->date.month) ? TRUE :
1155 (pcil->date.month > pcir->date.month) ? FALSE :
1156 (pcil->date.day < pcir->date.day) ? TRUE :
1157 (pcil->date.day > pcir->date.day) ? FALSE :
1158 (pcil->time.hours < pcir->time.hours) ? TRUE :
1159 (pcil->time.hours > pcir->time.hours) ? FALSE :
1160 (pcil->time.minutes < pcir->time.minutes) ? TRUE :
1161 (pcil->time.minutes > pcir->time.minutes) ? FALSE :
1162 (pcil->time.seconds < pcir->time.seconds) ? TRUE :
1163 (pcil->time.seconds > pcir->time.seconds) ? FALSE :
1164 FALSE) {
1165 pcil->flags |= CNRITEM_OLDER;
1166 pcir->flags |= CNRITEM_NEWER;
1167 if (pch != pcil->szSubject) {
1168 strcpy(pch, ", ");
1169 pch += 2;
1170 }
1171 strcpy(pch, GetPString(IDS_OLDERTEXT));
1172 pch += 5;
1173 }
1174 *pch = 0;
1175 r++;
1176 l++;
1177 }
1178 else if (x < 0) {
1179 // Just on left
1180 sprintf(pcil->szFileName, "%s%s%s", cmp->leftdir,
1181 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ?
1182 NullStr : "\\", filesl[l]->fname);
1183 pcil->pszFileName = pcil->szFileName + lenl;
1184 pcil->attrFile = filesl[l]->attrFile;
1185 // pcil->rc.hptrIcon = hptrFile;
1186 y = 0;
1187 for (x = 0; x < 6; x++)
1188 if (attrstring[x])
1189 pcil->szDispAttr[y++] =
1190 (CHAR) ((pcil->
1191 attrFile & (1 << x)) ? attrstring[x] : '-');
1192 pcil->szDispAttr[5] = 0;
1193 pcil->cbFile = filesl[l]->cbFile;
1194 pcil->easize = filesl[l]->easize;
1195 pcil->date.day = filesl[l]->date.day;
1196 pcil->date.month = filesl[l]->date.month;
1197 pcil->date.year = filesl[l]->date.year + 1980;
1198 pcil->time.seconds = filesl[l]->time.twosecs * 2;
1199 pcil->time.minutes = filesl[l]->time.minutes;
1200 pcil->time.hours = filesl[l]->time.hours;
1201 pcil->ladate.day = filesl[l]->ladate.day;
1202 pcil->ladate.month = filesl[l]->ladate.month;
1203 pcil->ladate.year = filesl[l]->ladate.year + 1980;
1204 pcil->latime.seconds = filesl[l]->latime.twosecs * 2;
1205 pcil->latime.minutes = filesl[l]->latime.minutes;
1206 pcil->latime.hours = filesl[l]->latime.hours;
1207 pcil->crdate.day = filesl[l]->crdate.day;
1208 pcil->crdate.month = filesl[l]->crdate.month;
1209 pcil->crdate.year = filesl[l]->crdate.year + 1980;
1210 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;
1211 pcil->crtime.minutes = filesl[l]->crtime.minutes;
1212 pcil->crtime.hours = filesl[l]->crtime.hours;
1213 if (*cmp->dcd.mask.szMask) {
1214 if (!Filter((PMINIRECORDCORE) pcil, (PVOID) & cmp->dcd.mask)) {
1215 pcil->rc.flRecordAttr |= CRA_FILTERED;
1216 pcir->rc.flRecordAttr |= CRA_FILTERED;
1217 }
1218 }
1219 free(filesl[l]);
1220 l++;
1221 }
1222 else {
1223 // Just on right
1224 sprintf(pcir->szFileName, "%s%s%s", cmp->rightdir,
1225 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ?
1226 NullStr : "\\", filesr[r]->fname);
1227 pcir->pszFileName = pcir->szFileName + lenr;
1228 pcir->attrFile = filesr[r]->attrFile;
1229 // pcir->rc.hptrIcon = hptrFile;
1230 y = 0;
1231 for (x = 0; x < 6; x++) {
1232 if (attrstring[x])
1233 pcir->szDispAttr[y++] =
1234 (CHAR) ((pcir->
1235 attrFile & (1 << x)) ? attrstring[x] : '-');
1236 }
1237 pcir->szDispAttr[5] = 0;
1238 pcir->cbFile = filesr[r]->cbFile;
1239 pcir->easize = filesr[r]->easize;
1240 pcir->date.day = filesr[r]->date.day;
1241 pcir->date.month = filesr[r]->date.month;
1242 pcir->date.year = filesr[r]->date.year + 1980;
1243 pcir->time.seconds = filesr[r]->time.twosecs * 2;
1244 pcir->time.minutes = filesr[r]->time.minutes;
1245 pcir->time.hours = filesr[r]->time.hours;
1246 pcir->ladate.day = filesr[r]->ladate.day;
1247 pcir->ladate.month = filesr[r]->ladate.month;
1248 pcir->ladate.year = filesr[r]->ladate.year + 1980;
1249 pcir->latime.seconds = filesr[r]->latime.twosecs * 2;
1250 pcir->latime.minutes = filesr[r]->latime.minutes;
1251 pcir->latime.hours = filesr[r]->latime.hours;
1252 pcir->crdate.day = filesr[r]->crdate.day;
1253 pcir->crdate.month = filesr[r]->crdate.month;
1254 pcir->crdate.year = filesr[r]->crdate.year + 1980;
1255 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;
1256 pcir->crtime.minutes = filesr[r]->crtime.minutes;
1257 pcir->crtime.hours = filesr[r]->crtime.hours;
1258 if (*cmp->dcd.mask.szMask) {
1259 if (!Filter((PMINIRECORDCORE) pcir, (PVOID) & cmp->dcd.mask)) {
1260 pcir->rc.flRecordAttr |= CRA_FILTERED;
1261 pcil->rc.flRecordAttr |= CRA_FILTERED;
1262 }
1263 }
1264 free(filesr[r]);
1265 r++;
1266 }
1267 }
1268 else if (filesl && filesl[l]) {
1269 // Just on left
1270 sprintf(pcil->szFileName, "%s%s%s", cmp->leftdir,
1271 (cmp->leftdir[strlen(cmp->leftdir) - 1] == '\\') ?
1272 NullStr : "\\", filesl[l]->fname);
1273 pcil->pszFileName = pcil->szFileName + lenl;
1274 pcil->attrFile = filesl[l]->attrFile;
1275 // pcil->rc.hptrIcon = hptrFile;
1276 y = 0;
1277 for (x = 0; x < 6; x++)
1278 if (attrstring[x])
1279 pcil->szDispAttr[y++] = (CHAR) ((pcil->attrFile & (1 << x)) ?
1280 attrstring[x] : '-');
1281 pcil->szDispAttr[5] = 0;
1282 pcil->cbFile = filesl[l]->cbFile;
1283 pcil->easize = filesl[l]->easize;
1284 pcil->date.day = filesl[l]->date.day;
1285 pcil->date.month = filesl[l]->date.month;
1286 pcil->date.year = filesl[l]->date.year + 1980;
1287 pcil->time.seconds = filesl[l]->time.twosecs * 2;
1288 pcil->time.minutes = filesl[l]->time.minutes;
1289 pcil->time.hours = filesl[l]->time.hours;
1290 pcil->ladate.day = filesl[l]->ladate.day;
1291 pcil->ladate.month = filesl[l]->ladate.month;
1292 pcil->ladate.year = filesl[l]->ladate.year + 1980;
1293 pcil->latime.seconds = filesl[l]->latime.twosecs * 2;
1294 pcil->latime.minutes = filesl[l]->latime.minutes;
1295 pcil->latime.hours = filesl[l]->latime.hours;
1296 pcil->crdate.day = filesl[l]->crdate.day;
1297 pcil->crdate.month = filesl[l]->crdate.month;
1298 pcil->crdate.year = filesl[l]->crdate.year + 1980;
1299 pcil->crtime.seconds = filesl[l]->crtime.twosecs * 2;
1300 pcil->crtime.minutes = filesl[l]->crtime.minutes;
1301 pcil->crtime.hours = filesl[l]->crtime.hours;
1302 if (*cmp->dcd.mask.szMask) {
1303 if (!Filter((PMINIRECORDCORE) pcil, (PVOID) & cmp->dcd.mask)) {
1304 pcil->rc.flRecordAttr |= CRA_FILTERED;
1305 pcir->rc.flRecordAttr |= CRA_FILTERED;
1306 }
1307 }
1308 free(filesl[l]);
1309 l++;
1310 }
1311 else {
1312 /* filesr && filesr[r] */
1313 // Just on right
1314 sprintf(pcir->szFileName, "%s%s%s", cmp->rightdir,
1315 (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ?
1316 NullStr : "\\", filesr[r]->fname);
1317 pcir->pszFileName = pcir->szFileName + lenr;
1318 pcir->attrFile = filesr[r]->attrFile;
1319 // pcir->rc.hptrIcon = hptrFile;
1320 y = 0;
1321 for (x = 0; x < 6; x++) {
1322 if (attrstring[x])
1323 pcir->szDispAttr[y++] = (CHAR) ((pcir->attrFile & (1 << x)) ?
1324 attrstring[x] : '-');
1325 }
1326 pcir->szDispAttr[5] = 0;
1327 pcir->cbFile = filesr[r]->cbFile;
1328 pcir->easize = filesr[r]->easize;
1329 pcir->date.day = filesr[r]->date.day;
1330 pcir->date.month = filesr[r]->date.month;
1331 pcir->date.year = filesr[r]->date.year + 1980;
1332 pcir->time.seconds = filesr[r]->time.twosecs * 2;
1333 pcir->time.minutes = filesr[r]->time.minutes;
1334 pcir->time.hours = filesr[r]->time.hours;
1335 pcir->ladate.day = filesr[r]->ladate.day;
1336 pcir->ladate.month = filesr[r]->ladate.month;
1337 pcir->ladate.year = filesr[r]->ladate.year + 1980;
1338 pcir->latime.seconds = filesr[r]->latime.twosecs * 2;
1339 pcir->latime.minutes = filesr[r]->latime.minutes;
1340 pcir->latime.hours = filesr[r]->latime.hours;
1341 pcir->crdate.day = filesr[r]->crdate.day;
1342 pcir->crdate.month = filesr[r]->crdate.month;
1343 pcir->crdate.year = filesr[r]->crdate.year + 1980;
1344 pcir->crtime.seconds = filesr[r]->crtime.twosecs * 2;
1345 pcir->crtime.minutes = filesr[r]->crtime.minutes;
1346 pcir->crtime.hours = filesr[r]->crtime.hours;
1347 if (*cmp->dcd.mask.szMask) {
1348 if (!Filter((PMINIRECORDCORE) pcir, (PVOID) & cmp->dcd.mask)) {
1349 pcir->rc.flRecordAttr |= CRA_FILTERED;
1350 pcil->rc.flRecordAttr |= CRA_FILTERED;
1351 }
1352 }
1353 free(filesr[r]);
1354 r++;
1355 }
1356 if (!(cntr % 500))
1357 DosSleep(1L);
1358 else if (!(cntr % 50))
1359 DosSleep(0L);
1360 cntr++;
1361 pcil = (PCNRITEM) pcil->rc.preccNextRecord;
1362 pcir = (PCNRITEM) pcir->rc.preccNextRecord;
1363 } // while
1364 if (filesl)
1365 free(filesl); // Free header - have already freed elements
1366 filesl = NULL;
1367 if (filesr)
1368 free(filesr);
1369 filesr = NULL;
1370 /* insert 'em */
1371 WinSendMsg(cmp->hwnd, UM_CONTAINERDIR, MPVOID, MPVOID);
1372 memset(&ri, 0, sizeof(RECORDINSERT));
1373 ri.cb = sizeof(RECORDINSERT);
1374 ri.pRecordOrder = (PRECORDCORE) CMA_END;
1375 ri.pRecordParent = (PRECORDCORE) NULL;
1376 ri.zOrder = (ULONG) CMA_TOP;
1377 ri.cRecordsInsert = recsNeeded;
1378 ri.fInvalidateRecord = FALSE;
1379 if (!WinSendMsg(hwndLeft, CM_INSERTRECORD,
1380 MPFROMP(pcilFirst), MPFROMP(&ri))) {
1381 pcil = pcilFirst;
1382 while (pcil) {
1383 pcit = (PCNRITEM) pcil->rc.preccNextRecord;
1384 WinSendMsg(hwndLeft, CM_FREERECORD,
1385 MPFROMP(&pcil), MPFROMSHORT(1));
1386 pcil = pcit;
1387 }
1388 numfilesl = 0;
1389 }
1390 memset(&ri, 0, sizeof(RECORDINSERT));
1391 ri.cb = sizeof(RECORDINSERT);
1392 ri.pRecordOrder = (PRECORDCORE) CMA_END;
1393 ri.pRecordParent = (PRECORDCORE) NULL;
1394 ri.zOrder = (ULONG) CMA_TOP;
1395 ri.cRecordsInsert = recsNeeded;
1396 ri.fInvalidateRecord = FALSE;
1397 if (!WinSendMsg(hwndRight, CM_INSERTRECORD,
1398 MPFROMP(pcirFirst), MPFROMP(&ri))) {
1399 WinSendMsg(hwndLeft, CM_REMOVERECORD,
1400 MPVOID, MPFROM2SHORT(0, CMA_FREE | CMA_INVALIDATE));
1401 pcir = pcirFirst;
1402 while (pcir) {
1403 pcit = (PCNRITEM) pcir->rc.preccNextRecord;
1404 WinSendMsg(hwndRight, CM_FREERECORD,
1405 MPFROMP(&pcir), MPFROMSHORT(1));
1406 pcir = pcit;
1407 }
1408 numfilesr = 0;
1409 }
1410 cmp->cmp->totalleft = numfilesl;
1411 cmp->cmp->totalright = numfilesr;
1412 } // if recsNeeded
1413 Deselect(hwndLeft);
1414 Deselect(hwndRight);
1415 if (!PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID))
1416 WinSendMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
1417 notified = TRUE;
1418 if (filesl)
1419 FreeList((CHAR **) filesl); // Must have failed to create container
1420 if (filesr)
1421 FreeList((CHAR **) filesr);
1422 WinDestroyMsgQueue(hmq);
1423 }
1424 DecrThreadUsage();
1425 WinTerminate(hab);
1426 }
1427 if (!notified)
1428 PostMsg(cmp->hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
1429 free(cmp);
1430 DosPostEventSem(CompactSem);
1431}
1432
1433#define hwndLeft (WinWindowFromID(hwnd,COMP_LEFTDIR))
1434#define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR))
1435
1436//=== CompareDlgProc() Compare directories dialog procedure ===
1437
1438MRESULT EXPENTRY CompareDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
1439{
1440 COMPARE *cmp;
1441
1442 static HPOINTER hptr = (HPOINTER) 0;
1443
1444 switch (msg) {
1445 case WM_INITDLG:
1446 cmp = (COMPARE *) mp2;
1447 if (!cmp) {
1448 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
1449 WinDismissDlg(hwnd, 0);
1450 }
1451 else {
1452 if (!hptr)
1453 hptr = WinLoadPointer(HWND_DESKTOP, FM3ModHandle, COMPARE_ICON);
1454 WinDefDlgProc(hwnd, WM_SETICON, MPFROMLONG(hptr), MPVOID);
1455 cmp->hwnd = hwnd;
1456 WinSetWindowPtr(hwnd, QWL_USER, (PVOID) cmp);
1457 SetCnrCols(hwndLeft, TRUE);
1458 SetCnrCols(hwndRight, TRUE);
1459 WinSendMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
1460 WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
1461 PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
1462 {
1463 USHORT ids[] = { COMP_LEFTDIR, COMP_RIGHTDIR, COMP_TOTALLEFT,
1464 COMP_TOTALRIGHT, COMP_SELLEFT, COMP_SELRIGHT,
1465 0
1466 };
1467 register INT x;
1468
1469 for (x = 0; ids[x]; x++)
1470 SetPresParams(WinWindowFromID(hwnd, ids[x]),
1471 &RGBGREY,
1472 &RGBBLACK, &RGBBLACK, GetPString(IDS_8HELVTEXT));
1473 }
1474 }
1475 break;
1476
1477 case UM_STRETCH:
1478 {
1479 SWP swp, swpC;
1480 LONG titl, szbx, szby, sz;
1481 HWND hwndActive;
1482
1483 WinQueryWindowPos(hwnd, &swp);
1484 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
1485 hwndActive = WinQueryFocus(HWND_DESKTOP);
1486 szbx = SysVal(SV_CXSIZEBORDER);
1487 szby = SysVal(SV_CYSIZEBORDER);
1488 titl = SysVal(SV_CYTITLEBAR);
1489 titl += 26;
1490 swp.cx -= (szbx * 2);
1491 sz = (swp.cx / 8);
1492 WinQueryWindowPos(WinWindowFromID(hwnd, COMP_LEFTDIR), &swpC);
1493 WinSetWindowPos(WinWindowFromID(hwnd, COMP_LEFTDIR), HWND_TOP,
1494 szbx + 6,
1495 swpC.y,
1496 (swp.cx / 2) - (szbx + 6),
1497 ((swp.cy - swpC.y) - titl) - szby,
1498 SWP_MOVE | SWP_SIZE);
1499 WinSetWindowPos(WinWindowFromID(hwnd, COMP_RIGHTDIR), HWND_TOP,
1500 (swp.cx / 2) + (szbx + 6),
1501 swpC.y,
1502 (swp.cx / 2) - (szbx + 6),
1503 ((swp.cy - swpC.y) - titl) - szby,
1504 SWP_MOVE | SWP_SIZE);
1505 WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALLEFTHDR), HWND_TOP,
1506 szbx + 6,
1507 ((swp.cy - titl) - szby) + 4,
1508 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1509 WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALLEFT), HWND_TOP,
1510 sz + (szbx + 6),
1511 ((swp.cy - titl) - szby) + 4,
1512 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1513 WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELLEFTHDR), HWND_TOP,
1514 (sz * 2) + (szbx + 6),
1515 ((swp.cy - titl) - szby) + 4,
1516 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1517 WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELLEFT), HWND_TOP,
1518 (sz * 3) + (szbx + 6),
1519 ((swp.cy - titl) - szby) + 4,
1520 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1521 WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALRIGHTHDR), HWND_TOP,
1522 (sz * 4) + (szbx + 6),
1523 ((swp.cy - titl) - szby) + 4,
1524 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1525 WinSetWindowPos(WinWindowFromID(hwnd, COMP_TOTALRIGHT), HWND_TOP,
1526 (sz * 5) + (szbx + 6),
1527 ((swp.cy - titl) - szby) + 4,
1528 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1529 WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELRIGHTHDR), HWND_TOP,
1530 (sz * 6) + (szbx + 6),
1531 ((swp.cy - titl) - szby) + 4,
1532 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1533 WinSetWindowPos(WinWindowFromID(hwnd, COMP_SELRIGHT), HWND_TOP,
1534 (sz * 7) + (szbx + 6),
1535 ((swp.cy - titl) - szby) + 4,
1536 sz - (szbx + 6), 20, SWP_MOVE | SWP_SIZE);
1537 PaintRecessedWindow(WinWindowFromID(hwnd, COMP_TOTALLEFT),
1538 (HPS) 0, FALSE, FALSE);
1539 PaintRecessedWindow(WinWindowFromID(hwnd, COMP_SELLEFT),
1540 (HPS) 0, FALSE, FALSE);
1541 PaintRecessedWindow(WinWindowFromID(hwnd, COMP_TOTALRIGHT),
1542 (HPS) 0, FALSE, FALSE);
1543 PaintRecessedWindow(WinWindowFromID(hwnd, COMP_SELRIGHT),
1544 (HPS) 0, FALSE, FALSE);
1545 PaintRecessedWindow(hwndLeft, (HPS) 0,
1546 (hwndActive == hwndLeft), TRUE);
1547 PaintRecessedWindow(hwndRight, (HPS) 0,
1548 (hwndActive == hwndRight), TRUE);
1549 }
1550 }
1551 return 0;
1552
1553 case WM_ADJUSTWINDOWPOS:
1554 PostMsg(hwnd, UM_STRETCH, MPVOID, MPVOID);
1555 break;
1556
1557 case UM_SETUP:
1558 {
1559 CNRINFO cnri;
1560 BOOL tempsubj;
1561
1562 cmp = INSTDATA(hwnd);
1563 if (cmp) {
1564 cmp->dcd.size = sizeof(DIRCNRDATA);
1565 cmp->dcd.type = DIR_FRAME;
1566 cmp->dcd.hwndFrame = hwnd;
1567 cmp->dcd.hwndClient = hwnd;
1568 cmp->dcd.mask.attrFile = (FILE_DIRECTORY | FILE_ARCHIVED |
1569 FILE_READONLY | FILE_SYSTEM | FILE_HIDDEN);
1570 LoadDetailsSwitches("DirCmp", &cmp->dcd);
1571 cmp->dcd.detailslongname = FALSE;
1572 cmp->dcd.detailsicon = FALSE; /* TRUE; */
1573 }
1574 memset(&cnri, 0, sizeof(CNRINFO));
1575 cnri.cb = sizeof(CNRINFO);
1576 WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_QUERYCNRINFO,
1577 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1578 cnri.flWindowAttr |= (CA_OWNERDRAW | CV_MINI);
1579 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 68;
1580 WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
1581 MPFROMLONG(CMA_FLWINDOWATTR | CMA_XVERTSPLITBAR));
1582 memset(&cnri, 0, sizeof(CNRINFO));
1583 cnri.cb = sizeof(CNRINFO);
1584 WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_QUERYCNRINFO,
1585 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1586 cnri.flWindowAttr |= (CA_OWNERDRAW | CV_MINI);
1587 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 54;
1588 WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
1589 MPFROMLONG(CMA_FLWINDOWATTR | CMA_XVERTSPLITBAR));
1590 AdjustCnrColRO(hwndLeft, GetPString(IDS_FILENAMECOLTEXT), TRUE, FALSE);
1591 AdjustCnrColRO(hwndLeft, GetPString(IDS_LONGNAMECOLTEXT), TRUE, FALSE);
1592 AdjustCnrColRO(hwndRight, GetPString(IDS_FILENAMECOLTEXT), TRUE, FALSE);
1593 AdjustCnrColRO(hwndRight, GetPString(IDS_LONGNAMECOLTEXT), TRUE, FALSE);
1594 AdjustCnrColsForPref(hwndLeft, cmp->leftdir, &cmp->dcd, TRUE);
1595 tempsubj = cmp->dcd.detailssubject;
1596 cmp->dcd.detailssubject = FALSE;
1597 AdjustCnrColsForPref(hwndRight, cmp->rightdir, &cmp->dcd, TRUE);
1598 if (*cmp->rightlist) {
1599 AdjustCnrColVis(hwndRight, GetPString(IDS_LADATECOLTEXT), FALSE,
1600 FALSE);
1601 AdjustCnrColVis(hwndRight, GetPString(IDS_LATIMECOLTEXT), FALSE,
1602 FALSE);
1603 AdjustCnrColVis(hwndRight, GetPString(IDS_CRDATECOLTEXT), FALSE,
1604 FALSE);
1605 AdjustCnrColVis(hwndRight, GetPString(IDS_CRTIMECOLTEXT), FALSE,
1606 FALSE);
1607 }
1608 cmp->dcd.detailssubject = tempsubj;
1609 }
1610 return 0;
1611
1612 case WM_DRAWITEM:
1613 if (mp2) {
1614
1615 POWNERITEM pown = (POWNERITEM) mp2;
1616 PCNRDRAWITEMINFO pcown;
1617 PCNRITEM pci;
1618
1619 pcown = (PCNRDRAWITEMINFO) pown->hItem;
1620 if (pcown) {
1621 pci = (PCNRITEM) pcown->pRecord;
1622 if (pci && (INT) pci != -1 && !*pci->szFileName)
1623 return MRFROMLONG(TRUE);
1624 }
1625 }
1626 return 0;
1627
1628 case UM_CONTAINERHWND:
1629 WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPHOLDBLDLISTTEXT));
1630 return 0;
1631
1632 case UM_CONTAINERDIR:
1633 WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPHOLDFILLCNRTEXT));
1634 return 0;
1635
1636 case UM_CONTAINER_FILLED:
1637 cmp = INSTDATA(hwnd);
1638 if (!cmp) {
1639 Runtime_Error(pszSrcFile, __LINE__, "pCompare NULL");
1640 WinDismissDlg(hwnd, 0);
1641 }
1642 else {
1643 CHAR s[81];
1644
1645 cmp->filling = FALSE;
1646 WinEnableWindow(hwndLeft, TRUE);
1647 WinEnableWindow(hwndRight, TRUE);
1648 WinEnableWindowUpdate(hwndLeft, TRUE);
1649 WinEnableWindowUpdate(hwndRight, TRUE);
1650 sprintf(s, " %d", cmp->totalleft);
1651 WinSetDlgItemText(hwnd, COMP_TOTALLEFT, s);
1652 sprintf(s, " %d", cmp->totalright);
1653 WinSetDlgItemText(hwnd, COMP_TOTALRIGHT, s);
1654 sprintf(s, " %d", cmp->selleft);
1655 WinSetDlgItemText(hwnd, COMP_SELLEFT, s);
1656 sprintf(s, " %d", cmp->selright);
1657 WinSetDlgItemText(hwnd, COMP_SELRIGHT, s);
1658 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
1659 WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), TRUE);
1660 WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), TRUE);
1661 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), TRUE);
1662 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), TRUE);
1663 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), TRUE);
1664 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), TRUE);
1665 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), TRUE);
1666 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), TRUE);
1667 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), TRUE);
1668 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), TRUE);
1669 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), TRUE);
1670 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), TRUE);
1671 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), TRUE);
1672 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), TRUE);
1673 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), TRUE);
1674 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT), TRUE);
1675 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), TRUE);
1676 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), TRUE);
1677 WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), TRUE);
1678 WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), TRUE);
1679 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), TRUE);
1680 WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), TRUE);
1681 if (!*cmp->rightlist) {
1682 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), TRUE);
1683 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), TRUE);
1684 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), TRUE);
1685 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), TRUE);
1686 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), TRUE);
1687 }
1688 WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), TRUE);
1689 if (*cmp->dcd.mask.szMask)
1690 WinSetDlgItemText(hwnd, COMP_NOTE,
1691 GetPString(IDS_COMPREADYFILTEREDTEXT));
1692 else
1693 WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
1694 }
1695 break;
1696
1697 case WM_INITMENU:
1698 cmp = INSTDATA(hwnd);
1699 if (cmp) {
1700 switch (SHORT1FROMMP(mp1)) {
1701 case IDM_COMMANDSMENU:
1702 SetupCommandMenu(cmp->dcd.hwndLastMenu, hwnd);
1703 break;
1704 }
1705 }
1706 break;
1707
1708 case WM_MENUEND:
1709 cmp = INSTDATA(hwnd);
1710 if (cmp) {
1711 if ((HWND) mp2 == cmp->dcd.hwndLastMenu) {
1712 MarkAll(hwndLeft, TRUE, FALSE, TRUE);
1713 MarkAll(hwndRight, TRUE, FALSE, TRUE);
1714 WinDestroyWindow(cmp->dcd.hwndLastMenu);
1715 cmp->dcd.hwndLastMenu = (HWND) 0;
1716 }
1717 }
1718 break;
1719
1720 case WM_CONTROL:
1721 switch (SHORT1FROMMP(mp1)) {
1722 case COMP_INCLUDESUBDIRS:
1723 switch (SHORT2FROMMP(mp1)) {
1724 case BN_CLICKED:
1725 cmp = INSTDATA(hwnd);
1726 if (cmp)
1727 *cmp->rightlist = 0;
1728 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
1729 PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
1730 break;
1731 }
1732 break;
1733 case COMP_HIDENOTSELECTED:
1734 switch (SHORT2FROMMP(mp1)) {
1735 case BN_CLICKED:
1736 WinSendMsg(hwnd, UM_HIDENOTSELECTED, MPVOID, MPVOID);
1737 break;
1738 }
1739 break;
1740
1741 case COMP_LEFTDIR:
1742 case COMP_RIGHTDIR:
1743 switch (SHORT2FROMMP(mp1)) {
1744 case CN_KILLFOCUS:
1745 PaintRecessedWindow(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
1746 (HPS) 0, FALSE, TRUE);
1747 break;
1748
1749 case CN_SETFOCUS:
1750 PaintRecessedWindow(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
1751 (HPS) 0, TRUE, TRUE);
1752 break;
1753
1754 case CN_ENTER:
1755 if (mp2) {
1756
1757 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
1758 HWND hwndCnr = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
1759
1760 SetShiftState();
1761 if (pci) {
1762 if ((pci->rc.flRecordAttr & CRA_INUSE) || !*pci->szFileName)
1763 break;
1764 WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci),
1765 MPFROM2SHORT(TRUE, CRA_INUSE));
1766 if (pci->attrFile & FILE_DIRECTORY) {
1767 if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT))
1768 OpenObject(pci->szFileName, Settings, hwnd);
1769 else
1770 OpenObject(pci->szFileName, Default, hwnd);
1771 }
1772 else
1773 DefaultViewKeys(hwnd, hwnd, HWND_DESKTOP, NULL,
1774 pci->szFileName);
1775 WinSendMsg(hwndCnr, CM_SETRECORDEMPHASIS,
1776 MPFROMP(pci),
1777 MPFROM2SHORT(FALSE, CRA_INUSE |
1778 ((fUnHilite) ? CRA_SELECTED : 0)));
1779 }
1780 }
1781 break;
1782
1783 case CN_CONTEXTMENU:
1784 cmp = INSTDATA(hwnd);
1785 if (cmp) {
1786
1787 PCNRITEM pci = (PCNRITEM) mp2;
1788 USHORT id = COMP_CNRMENU;
1789
1790 if (cmp->dcd.hwndLastMenu)
1791 WinDestroyWindow(cmp->dcd.hwndLastMenu);
1792 cmp->dcd.hwndLastMenu = (HWND) 0;
1793 cmp->hwndCalling = WinWindowFromID(hwnd, SHORT1FROMMP(mp1));
1794 if (pci) {
1795 if (!*pci->szFileName || *cmp->rightlist)
1796 break;
1797 id = COMP_MENU;
1798 WinSendMsg(cmp->hwndCalling, CM_SETRECORDEMPHASIS,
1799 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
1800 }
1801 cmp->dcd.hwndLastMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
1802 if (cmp->dcd.hwndLastMenu) {
1803 if (id == COMP_CNRMENU) {
1804 if (SHORT1FROMMP(mp1) == COMP_RIGHTDIR)
1805 WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
1806 MPFROM2SHORT(IDM_SHOWSUBJECT, FALSE), MPVOID);
1807 SetDetailsSwitches(cmp->dcd.hwndLastMenu, &cmp->dcd);
1808 if (SHORT1FROMMP(mp1) == COMP_LEFTDIR)
1809 WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
1810 MPFROM2SHORT(IDM_LOADLISTFILE, 0), MPVOID);
1811 else if (*cmp->rightlist)
1812 WinSendMsg(cmp->dcd.hwndLastMenu, MM_DELETEITEM,
1813 MPFROM2SHORT(IDM_SAVELISTFILE, 0), MPVOID);
1814 }
1815 PopupMenu(hwnd, hwnd, cmp->dcd.hwndLastMenu);
1816 }
1817 }
1818 break;
1819
1820 case CN_INITDRAG:
1821 cmp = INSTDATA(hwnd);
1822 if (*cmp->rightlist && SHORT1FROMMP(mp1) == COMP_RIGHTDIR)
1823 break;
1824 DoFileDrag(WinWindowFromID(hwnd, SHORT1FROMMP(mp1)),
1825 (HWND) 0, mp2, NULL, NULL, TRUE);
1826 break;
1827
1828 case CN_BEGINEDIT:
1829 case CN_REALLOCPSZ:
1830 // fixme to be gone - field edits not allowed
1831 Runtime_Error(pszSrcFile, __LINE__,
1832 "CN_BEGINEDIT/CN_REALLOCPSZ unexpected");
1833 break;
1834
1835 case CN_EMPHASIS:
1836 {
1837 PNOTIFYRECORDEMPHASIS pre = mp2;
1838 PCNRITEM pci;
1839
1840 if (pre->fEmphasisMask & CRA_SELECTED) {
1841 pci = (PCNRITEM) pre->pRecord;
1842 if (pci) {
1843 if (!*pci->szFileName) {
1844 if (pci->rc.flRecordAttr & CRA_SELECTED)
1845 WinSendDlgItemMsg(hwnd, SHORT1FROMMP(mp1),
1846 CM_SETRECORDEMPHASIS,
1847 MPFROMP(pci),
1848 MPFROM2SHORT(FALSE, CRA_SELECTED));
1849 }
1850 else {
1851
1852 CHAR s[81];
1853
1854 cmp = INSTDATA(hwnd);
1855 if (pci->rc.flRecordAttr & CRA_SELECTED) {
1856 if (SHORT1FROMMP(mp1) == COMP_LEFTDIR)
1857 cmp->selleft++;
1858 else
1859 cmp->selright++;
1860 }
1861 else {
1862 if (SHORT1FROMMP(mp1) == COMP_LEFTDIR) {
1863 if (cmp->selleft)
1864 cmp->selleft--;
1865 }
1866 else {
1867 if (cmp->selright)
1868 cmp->selright--;
1869 }
1870 }
1871 if (SHORT1FROMMP(mp1) == COMP_LEFTDIR) {
1872 if (WinIsWindowEnabled(hwndLeft) || !(cmp->selleft % 50)) {
1873 sprintf(s, " %d", cmp->selleft);
1874 WinSetDlgItemText(hwnd, COMP_SELLEFT, s);
1875 }
1876 }
1877 else {
1878 if (WinIsWindowEnabled(hwndRight) || !(cmp->selright % 50)) {
1879 sprintf(s, " %d", cmp->selright);
1880 WinSetDlgItemText(hwnd, COMP_SELRIGHT, s);
1881 }
1882 }
1883 }
1884 }
1885 }
1886 }
1887 break;
1888
1889 case CN_SCROLL:
1890 cmp = INSTDATA(hwnd);
1891 if (!cmp->forcescroll) {
1892
1893 PNOTIFYSCROLL pns = mp2;
1894
1895 if (pns->fScroll & CMA_VERTICAL) {
1896 cmp->forcescroll = TRUE;
1897 WinSendDlgItemMsg(hwnd, (SHORT1FROMMP(mp1) == COMP_LEFTDIR) ?
1898 COMP_RIGHTDIR : COMP_LEFTDIR,
1899 CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL),
1900 MPFROMLONG(pns->lScrollInc));
1901 cmp->forcescroll = FALSE;
1902 }
1903 }
1904 break;
1905 }
1906 break; // COMP_RIGHTDIR
1907 }
1908 return 0; // WM_CONTROL
1909
1910 case UM_SETDIR:
1911 cmp = INSTDATA(hwnd);
1912 if (cmp) {
1913
1914 COMPARE *forthread;
1915 CNRINFO cnri;
1916
1917 cmp->includesubdirs = WinQueryButtonCheckstate(hwnd,
1918 COMP_INCLUDESUBDIRS);
1919 memset(&cnri, 0, sizeof(CNRINFO));
1920 cnri.cb = sizeof(CNRINFO);
1921 cnri.pszCnrTitle = cmp->leftdir;
1922 cnri.flWindowAttr = CV_DETAIL | CV_MINI |
1923 CA_CONTAINERTITLE | CA_TITLESEPARATOR |
1924 CA_DETAILSVIEWTITLES | CA_OWNERDRAW;
1925 WinSendDlgItemMsg(hwnd, COMP_LEFTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
1926 MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
1927 cnri.pszCnrTitle = cmp->rightdir;
1928 WinSendDlgItemMsg(hwnd, COMP_RIGHTDIR, CM_SETCNRINFO, MPFROMP(&cnri),
1929 MPFROMLONG(CMA_CNRTITLE | CMA_FLWINDOWATTR));
1930 WinCheckButton(hwnd, COMP_HIDENOTSELECTED, 0);
1931 cmp->filling = TRUE;
1932 forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
1933 if (!forthread)
1934 WinDismissDlg(hwnd, 0);
1935 else {
1936 *forthread = *cmp;
1937 forthread->cmp = cmp;
1938 if (_beginthread(FillCnrsThread, NULL, 122880, (PVOID) forthread) ==
1939 -1) {
1940 Runtime_Error(pszSrcFile, __LINE__,
1941 GetPString(IDS_COULDNTSTARTTHREADTEXT));
1942 WinDismissDlg(hwnd, 0);
1943 free(forthread);
1944 }
1945 else {
1946 WinEnableWindowUpdate(hwndLeft, FALSE);
1947 WinEnableWindowUpdate(hwndRight, FALSE);
1948 cmp->selleft = cmp->selright = 0;
1949 WinSetDlgItemText(hwnd, COMP_SELLEFT, "0");
1950 WinSetDlgItemText(hwnd, COMP_SELRIGHT, "0");
1951 WinSetDlgItemText(hwnd, COMP_TOTALLEFT, "0");
1952 WinSetDlgItemText(hwnd, COMP_TOTALRIGHT, "0");
1953 WinSetDlgItemText(hwnd, COMP_NOTE,
1954 GetPString(IDS_COMPHOLDREADDISKTEXT));
1955 WinEnableWindow(hwndRight, FALSE);
1956 WinEnableWindow(hwndLeft, FALSE);
1957 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
1958 WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
1959 WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
1960 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
1961 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
1962 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
1963 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
1964 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
1965 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
1966 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
1967 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
1968 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
1969 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
1970 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
1971 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER), FALSE);
1972 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
1973 WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS), FALSE);
1974 WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
1975 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
1976 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
1977 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
1978 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
1979 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
1980 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
1981 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT),
1982 FALSE);
1983 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL), FALSE);
1984 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
1985 WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
1986 WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
1987 }
1988 }
1989 }
1990 return 0;
1991
1992 case UM_FILTER:
1993 cmp = INSTDATA(hwnd);
1994 if (cmp) {
1995 if (mp1) {
1996 DosEnterCritSec();
1997 SetMask((CHAR *) mp1, &cmp->dcd.mask);
1998 DosExitCritSec();
1999 }
2000 cmp->dcd.suspendview = 1;
2001 WinSendMsg(hwndLeft, CM_FILTER, MPFROMP(Filter),
2002 MPFROMP(&cmp->dcd.mask));
2003 WinSendMsg(hwndRight, CM_FILTER, MPFROMP(Filter),
2004 MPFROMP(&cmp->dcd.mask));
2005 cmp->dcd.suspendview = 0;
2006 if (*cmp->dcd.mask.szMask)
2007 WinSetDlgItemText(hwnd, COMP_NOTE,
2008 GetPString(IDS_COMPREADYFILTEREDTEXT));
2009 else
2010 WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
2011 }
2012 return 0;
2013
2014 case UM_HIDENOTSELECTED:
2015 cmp = INSTDATA(hwnd);
2016 if (cmp) {
2017 USHORT wantHide = WinQueryButtonCheckstate(hwnd,
2018 COMP_HIDENOTSELECTED);
2019
2020 cmp->dcd.suspendview = 1;
2021 if (wantHide) {
2022 BOOL needRefresh = FALSE;
2023 HWND hwndl = WinWindowFromID(cmp->hwnd, COMP_LEFTDIR);
2024 HWND hwndr = WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR);
2025 PCNRITEM pcil = WinSendMsg(hwndl, CM_QUERYRECORD, MPVOID,
2026 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
2027 PCNRITEM pcir = WinSendMsg(hwndr, CM_QUERYRECORD, MPVOID,
2028 MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
2029
2030 while (pcil && (INT) pcil != -1 && pcir && (INT) pcir != -1) {
2031 if (~pcil->rc.flRecordAttr & CRA_SELECTED &&
2032 ~pcir->rc.flRecordAttr & CRA_SELECTED) {
2033 pcil->rc.flRecordAttr |= CRA_FILTERED;
2034 pcir->rc.flRecordAttr |= CRA_FILTERED;
2035 needRefresh = TRUE;
2036 }
2037 pcil = WinSendMsg(hwndl, CM_QUERYRECORD, MPFROMP(pcil),
2038 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
2039 pcir = WinSendMsg(hwndr, CM_QUERYRECORD, MPFROMP(pcir),
2040 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
2041 } // while
2042 if (needRefresh) {
2043 WinSendMsg(hwndl, CM_INVALIDATERECORD,
2044 MPVOID, MPFROM2SHORT(0, CMA_REPOSITION));
2045 WinSendMsg(hwndr, CM_INVALIDATERECORD,
2046 MPVOID, MPFROM2SHORT(0, CMA_REPOSITION));
2047 }
2048 }
2049 else {
2050 WinSendMsg(hwndLeft, CM_FILTER, MPFROMP(Filter),
2051 MPFROMP(&cmp->dcd.mask));
2052 WinSendMsg(hwndRight, CM_FILTER, MPFROMP(Filter),
2053 MPFROMP(&cmp->dcd.mask));
2054 }
2055 cmp->dcd.suspendview = 0;
2056 if (*cmp->dcd.mask.szMask)
2057 WinSetDlgItemText(hwnd, COMP_NOTE,
2058 GetPString(IDS_COMPREADYFILTEREDTEXT));
2059 else
2060 WinSetDlgItemText(hwnd, COMP_NOTE, GetPString(IDS_COMPREADYTEXT));
2061 }
2062 return 0;
2063
2064 case WM_COMMAND:
2065 switch (SHORT1FROMMP(mp1)) {
2066 case IDM_COMPARE:
2067 cmp = INSTDATA(hwnd);
2068 if (cmp) {
2069
2070 PCNRITEM pci;
2071 CHAR ofile[CCHMAXPATH];
2072
2073 pci = (PCNRITEM) WinSendMsg(cmp->hwndCalling,
2074 CM_QUERYRECORDEMPHASIS,
2075 MPFROMLONG(CMA_FIRST),
2076 MPFROMSHORT(CRA_CURSORED));
2077 if (pci) {
2078 if (cmp->hwndCalling == hwndLeft)
2079 strcpy(ofile, cmp->rightdir);
2080 else
2081 strcpy(ofile, cmp->leftdir);
2082 if (ofile[strlen(ofile) - 1] != '\\')
2083 strcat(ofile, "\\");
2084 strcat(ofile, pci->pszFileName);
2085 if (*compare) {
2086
2087 CHAR *fakelist[3];
2088
2089 fakelist[0] = pci->szFileName;
2090 fakelist[1] = ofile;
2091 fakelist[2] = NULL;
2092 ExecOnList(hwnd, compare,
2093 WINDOWED | SEPARATEKEEP, NULL, fakelist, NULL);
2094 }
2095 else {
2096
2097 FCOMPARE fc;
2098
2099 memset(&fc, 0, sizeof(fc));
2100 fc.size = sizeof(fc);
2101 fc.hwndParent = hwnd;
2102 strcpy(fc.file1, pci->szFileName);
2103 strcpy(fc.file2, ofile);
2104 WinDlgBox(HWND_DESKTOP, hwnd,
2105 CFileDlgProc, FM3ModHandle, FCMP_FRAME, (PVOID) & fc);
2106 }
2107 }
2108 }
2109 break;
2110
2111 case COMP_FILTER:
2112 case IDM_FILTER:
2113 cmp = INSTDATA(hwnd);
2114 if (cmp) {
2115
2116 BOOL empty = FALSE;
2117 PCNRITEM pci;
2118 CHAR *p;
2119 BOOL temp;
2120
2121 if (!*cmp->dcd.mask.szMask) {
2122 empty = TRUE;
2123 temp = fSelectedAlways;
2124 fSelectedAlways = TRUE;
2125 pci = (PCNRITEM) CurrentRecord(hwnd);
2126 fSelectedAlways = temp;
2127 if (pci && !(pci->attrFile & FILE_DIRECTORY)) {
2128 p = strrchr(pci->szFileName, '\\');
2129 if (p) {
2130 p++;
2131 strcpy(cmp->dcd.mask.szMask, p);
2132 }
2133 }
2134 }
2135 cmp->dcd.mask.fNoAttribs = TRUE;
2136 cmp->dcd.mask.attrFile = ALLATTRS;
2137 cmp->dcd.mask.antiattr = 0;
2138 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
2139 FM3ModHandle, MSK_FRAME, MPFROMP(&cmp->dcd.mask))) {
2140 cmp->dcd.mask.attrFile = ALLATTRS;
2141 cmp->dcd.mask.antiattr = 0;
2142 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
2143 }
2144 else if (empty) {
2145 *cmp->dcd.mask.szMask = 0;
2146 cmp->dcd.mask.attrFile = ALLATTRS;
2147 cmp->dcd.mask.antiattr = 0;
2148 }
2149 }
2150 break;
2151
2152 case IDM_SHOWSUBJECT:
2153 case IDM_SHOWEAS:
2154 case IDM_SHOWSIZE:
2155 case IDM_SHOWLWDATE:
2156 case IDM_SHOWLWTIME:
2157 case IDM_SHOWLADATE:
2158 case IDM_SHOWLATIME:
2159 case IDM_SHOWCRDATE:
2160 case IDM_SHOWCRTIME:
2161 case IDM_SHOWATTR:
2162 cmp = INSTDATA(hwnd);
2163 if (cmp) {
2164
2165 DIRCNRDATA dcd1;
2166 BOOL tempsubj;
2167
2168 dcd1 = cmp->dcd;
2169 AdjustDetailsSwitches(hwndLeft,
2170 (HWND) 0, SHORT1FROMMP(mp1),
2171 cmp->leftdir, "DirCmp", &cmp->dcd, TRUE);
2172 tempsubj = cmp->dcd.detailssubject;
2173 cmp->dcd = dcd1;
2174 cmp->dcd.detailssubject = FALSE;
2175 AdjustDetailsSwitches(hwndRight,
2176 cmp->dcd.hwndLastMenu, SHORT1FROMMP(mp1),
2177 cmp->rightdir, "DirCmp", &cmp->dcd, TRUE);
2178 cmp->dcd.detailssubject = tempsubj;
2179 }
2180 break;
2181
2182 case IDM_LOADLISTFILE:
2183 cmp = INSTDATA(hwnd);
2184 if (cmp) {
2185
2186 CHAR fullname[CCHMAXPATH];
2187
2188 strcpy(fullname, "*.PMD");
2189 if (insert_filename(HWND_DESKTOP, fullname, TRUE, FALSE) &&
2190 *fullname && !strchr(fullname, '*') && !strchr(fullname, '?')) {
2191 strcpy(cmp->rightlist, fullname);
2192 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
2193 PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
2194 }
2195 }
2196 break;
2197
2198 case IDM_SAVELISTFILE:
2199 cmp = INSTDATA(hwnd);
2200 if (cmp) {
2201
2202 SNAPSTUFF *sf;
2203 CHAR fullname[CCHMAXPATH];
2204
2205 strcpy(fullname, "*.PMD");
2206 if (export_filename(HWND_DESKTOP, fullname, 1) && *fullname &&
2207 !strchr(fullname, '*') && !strchr(fullname, '?')) {
2208 sf = xmallocz(sizeof(SNAPSTUFF), pszSrcFile, __LINE__);
2209 if (sf) {
2210 strcpy(sf->filename, fullname);
2211 if (hwndLeft == cmp->hwndCalling)
2212 strcpy(sf->dirname, cmp->leftdir);
2213 else
2214 strcpy(sf->dirname, cmp->rightdir);
2215 sf->recurse = cmp->includesubdirs;
2216 if (_beginthread(StartSnap, NULL, 65536, (PVOID) sf) == -1) {
2217 Runtime_Error(pszSrcFile, __LINE__,
2218 GetPString(IDS_COULDNTSTARTTHREADTEXT));
2219 free(sf);
2220 }
2221 }
2222 }
2223 }
2224 break;
2225
2226 case COMP_SETDIRS:
2227 cmp = INSTDATA(hwnd);
2228 if (cmp) {
2229
2230 WALK2 wa;
2231
2232 memset(&wa, 0, sizeof(wa));
2233 wa.size = sizeof(wa);
2234 strcpy(wa.szCurrentPath1, cmp->leftdir);
2235 strcpy(wa.szCurrentPath2, cmp->rightdir);
2236 if (WinDlgBox(HWND_DESKTOP, hwnd, WalkTwoCmpDlgProc,
2237 FM3ModHandle, WALK2_FRAME,
2238 MPFROMP(&wa)) &&
2239 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
2240 strcpy(cmp->leftdir, wa.szCurrentPath1);
2241 strcpy(cmp->rightdir, wa.szCurrentPath2);
2242 *cmp->rightlist = 0;
2243 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID);
2244 PostMsg(hwnd, UM_SETDIR, MPVOID, MPVOID);
2245 }
2246 }
2247 break;
2248
2249 case COMP_COPYLEFT:
2250 case COMP_MOVELEFT:
2251 case COMP_COPYRIGHT:
2252 case COMP_MOVERIGHT:
2253 case COMP_DELETELEFT:
2254 case COMP_DELETERIGHT:
2255 cmp = INSTDATA(hwnd);
2256 if (cmp) {
2257
2258 COMPARE *forthread;
2259
2260 cmp->filling = TRUE;
2261 forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
2262 if (forthread) {
2263 *forthread = *cmp;
2264 forthread->cmp = cmp;
2265 forthread->action = SHORT1FROMMP(mp1);
2266 if (_beginthread(ActionCnrThread, NULL, 122880, (PVOID) forthread)
2267 == -1) {
2268 Runtime_Error(pszSrcFile, __LINE__,
2269 GetPString(IDS_COULDNTSTARTTHREADTEXT));
2270 free(forthread);
2271 }
2272 else {
2273 WinEnableWindowUpdate(hwndLeft, FALSE);
2274 WinEnableWindowUpdate(hwndRight, FALSE);
2275 switch (SHORT1FROMMP(mp1)) {
2276 case COMP_DELETELEFT:
2277 case COMP_DELETERIGHT:
2278 WinSetDlgItemText(hwnd, COMP_NOTE,
2279 GetPString(IDS_COMPHOLDDELETINGTEXT));
2280 break;
2281 case COMP_MOVELEFT:
2282 case COMP_MOVERIGHT:
2283 WinSetDlgItemText(hwnd, COMP_NOTE,
2284 GetPString(IDS_COMPHOLDMOVINGTEXT));
2285 break;
2286 case COMP_COPYLEFT:
2287 case COMP_COPYRIGHT:
2288 WinSetDlgItemText(hwnd, COMP_NOTE,
2289 GetPString(IDS_COMPHOLDCOPYINGTEXT));
2290 break;
2291 default:
2292 WinSetDlgItemText(hwnd, COMP_NOTE,
2293 GetPString(IDS_COMPHOLDDUNNOTEXT));
2294 break;
2295 }
2296 WinEnableWindow(hwndRight, FALSE);
2297 WinEnableWindow(hwndLeft, FALSE);
2298 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
2299 WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
2300 WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
2301 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
2302 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
2303 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
2304 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
2305 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
2306 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
2307 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
2308 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
2309 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
2310 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
2311 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
2312 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER),
2313 FALSE);
2314 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
2315 WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS),
2316 FALSE);
2317 WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
2318 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
2319 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
2320 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
2321 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
2322 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
2323 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
2324 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT),
2325 FALSE);
2326 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL),
2327 FALSE);
2328 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
2329 WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
2330 WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
2331 }
2332 }
2333 }
2334 break;
2335
2336 case DID_OK:
2337 WinDismissDlg(hwnd, 0);
2338 break;
2339 case DID_CANCEL:
2340 WinDismissDlg(hwnd, 1);
2341 break;
2342
2343 case IDM_HELP:
2344 if (hwndHelp)
2345 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
2346 MPFROM2SHORT(HELP_COMPARE, 0), MPFROMSHORT(HM_RESOURCEID));
2347 break;
2348
2349 case IDM_DESELECTALL:
2350 case IDM_SELECTNEWER:
2351 case IDM_SELECTOLDER:
2352 case IDM_SELECTBIGGER:
2353 case IDM_SELECTSMALLER:
2354 case IDM_DESELECTNEWER:
2355 case IDM_DESELECTOLDER:
2356 case IDM_DESELECTBIGGER:
2357 case IDM_DESELECTSMALLER:
2358 case IDM_DESELECTONE:
2359 case IDM_DESELECTBOTH:
2360 case IDM_SELECTBOTH:
2361 case IDM_SELECTONE:
2362 case IDM_SELECTSAMECONTENT:
2363 case IDM_SELECTIDENTICAL: // name, size and time
2364 case IDM_SELECTSAME: // name and size
2365 case IDM_INVERT:
2366 cmp = INSTDATA(hwnd);
2367 if (!cmp)
2368 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
2369 else {
2370 COMPARE *forthread;
2371
2372 cmp->filling = TRUE;
2373 forthread = xmalloc(sizeof(COMPARE), pszSrcFile, __LINE__);
2374 if (forthread) {
2375 *forthread = *cmp;
2376 forthread->cmp = cmp;
2377 forthread->action = SHORT1FROMMP(mp1);
2378 if (_beginthread(SelectCnrsThread, NULL, 65536, (PVOID) forthread)
2379 == -1) {
2380 Runtime_Error(pszSrcFile, __LINE__,
2381 GetPString(IDS_COULDNTSTARTTHREADTEXT));
2382 free(forthread);
2383 }
2384 else {
2385 WinEnableWindowUpdate(hwndLeft, FALSE);
2386 WinEnableWindowUpdate(hwndRight, FALSE);
2387 switch (SHORT1FROMMP(mp1)) {
2388 case IDM_DESELECTALL:
2389 case IDM_DESELECTNEWER:
2390 case IDM_DESELECTOLDER:
2391 case IDM_DESELECTBIGGER:
2392 case IDM_DESELECTSMALLER:
2393 case IDM_DESELECTONE:
2394 case IDM_DESELECTBOTH:
2395 WinSetDlgItemText(hwnd, COMP_NOTE,
2396 GetPString(IDS_COMPHOLDDESELTEXT));
2397 break;
2398 case IDM_INVERT:
2399 WinSetDlgItemText(hwnd, COMP_NOTE,
2400 GetPString(IDS_COMPHOLDINVERTTEXT));
2401 break;
2402 default:
2403 WinSetDlgItemText(hwnd, COMP_NOTE,
2404 GetPString(IDS_COMPHOLDSELTEXT));
2405 break;
2406 }
2407 WinEnableWindow(hwndRight, FALSE);
2408 WinEnableWindow(hwndLeft, FALSE);
2409 WinEnableWindow(WinWindowFromID(hwnd, DID_OK), FALSE);
2410 WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
2411 WinEnableWindow(WinWindowFromID(hwnd, COMP_COLLECT), FALSE);
2412 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBOTH), FALSE);
2413 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTONE), FALSE);
2414 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTNEWER), FALSE);
2415 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTOLDER), FALSE);
2416 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTBIGGER), FALSE);
2417 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSMALLER), FALSE);
2418 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBOTH), FALSE);
2419 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTONE), FALSE);
2420 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTNEWER), FALSE);
2421 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTOLDER), FALSE);
2422 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTBIGGER), FALSE);
2423 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTSMALLER),
2424 FALSE);
2425 WinEnableWindow(WinWindowFromID(hwnd, IDM_DESELECTALL), FALSE);
2426 WinEnableWindow(WinWindowFromID(hwnd, COMP_INCLUDESUBDIRS),
2427 FALSE);
2428 WinEnableWindow(WinWindowFromID(hwnd, COMP_SETDIRS), FALSE);
2429 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETELEFT), FALSE);
2430 WinEnableWindow(WinWindowFromID(hwnd, COMP_DELETERIGHT), FALSE);
2431 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYLEFT), FALSE);
2432 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVELEFT), FALSE);
2433 WinEnableWindow(WinWindowFromID(hwnd, COMP_COPYRIGHT), FALSE);
2434 WinEnableWindow(WinWindowFromID(hwnd, COMP_MOVERIGHT), FALSE);
2435 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAMECONTENT),
2436 FALSE);
2437 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTIDENTICAL),
2438 FALSE);
2439 WinEnableWindow(WinWindowFromID(hwnd, IDM_SELECTSAME), FALSE);
2440 WinEnableWindow(WinWindowFromID(hwnd, IDM_INVERT), FALSE);
2441 WinEnableWindow(WinWindowFromID(hwnd, COMP_FILTER), FALSE);
2442 }
2443 }
2444 }
2445 break;
2446
2447 case COMP_COLLECT:
2448 cmp = INSTDATA(hwnd);
2449 if (cmp) {
2450
2451 CHAR **listl, **listr = NULL;
2452
2453 if (!Collector) {
2454
2455 SWP swp;
2456 HWND hwndC;
2457
2458 if (!fAutoTile && !ParentIsDesktop(hwnd, cmp->hwndParent) &&
2459 (!fExternalCollector && !strcmp(realappname, FM3Str)))
2460 GetNextWindowPos(cmp->hwndParent, &swp, NULL, NULL);
2461 hwndC = StartCollector((fExternalCollector ||
2462 strcmp(realappname, FM3Str)) ?
2463 HWND_DESKTOP : cmp->hwndParent, 4);
2464 if (hwndC) {
2465 if (!fAutoTile && !ParentIsDesktop(hwnd, cmp->hwndParent) &&
2466 (!fExternalCollector && !strcmp(realappname, FM3Str)))
2467 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y,
2468 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE |
2469 SWP_SHOW | SWP_ZORDER);
2470 else if (!ParentIsDesktop(hwnd, cmp->hwndParent) && fAutoTile &&
2471 !strcmp(realappname, FM3Str))
2472 TileChildren(cmp->hwndParent, TRUE);
2473 DosSleep(64L);
2474 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(COMP_COLLECT, 0), MPVOID);
2475 break;
2476 }
2477 }
2478 else
2479 StartCollector(cmp->hwndParent, 4);
2480 {
2481 BOOL temp;
2482
2483 temp = fSelectedAlways;
2484 fSelectedAlways = TRUE;
2485 listl = BuildList(hwndLeft);
2486 if (!*cmp->rightlist)
2487 listr = BuildList(hwndRight);
2488 fSelectedAlways = temp;
2489 }
2490 if (listl || listr) {
2491 if (Collector) {
2492 if (listl) {
2493 if (!PostMsg(Collector, WM_COMMAND,
2494 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listl)))
2495 FreeList(listl);
2496 }
2497 if (listr) {
2498 if (!PostMsg(Collector, WM_COMMAND,
2499 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listr)))
2500 FreeList(listr);
2501 }
2502 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
2503 QW_PARENT),
2504 QW_PARENT), HWND_TOP, 0, 0, 0, 0,
2505 SWP_ACTIVATE);
2506 }
2507 else {
2508 FreeList(listl);
2509 FreeList(listr);
2510 }
2511 }
2512 }
2513 break;
2514 }
2515 return 0;
2516
2517 case WM_CLOSE:
2518 WinDismissDlg(hwnd, 0);
2519 return 0;
2520
2521 case WM_DESTROY:
2522 cmp = INSTDATA(hwnd);
2523 if (cmp) {
2524 if (cmp->dcd.hwndLastMenu)
2525 WinDestroyWindow(cmp->dcd.hwndLastMenu);
2526 if (cmp->dcd.hwndObject) {
2527 WinSetWindowPtr(cmp->dcd.hwndObject, QWL_USER, (PVOID) NULL);
2528 if (!PostMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID))
2529 WinSendMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID);
2530 }
2531 free(cmp);
2532 }
2533 EmptyCnr(hwndLeft);
2534 EmptyCnr(hwndRight);
2535 DosPostEventSem(CompactSem);
2536 break;
2537 }
2538 return WinDefDlgProc(hwnd, msg, mp1, mp2);
2539}
Note: See TracBrowser for help on using the repository browser.