source: trunk/dll/update.c

Last change on this file was 1916, checked in by Gregg Young, 8 days ago

Fix easize so that EAs larger than 32767 show their actual size instead of 32767

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 18.2 KB
Line 
1
2/***********************************************************************
3
4 $Id: update.c 1916 2025-11-01 18:30:47Z gyoung $
5
6 Update Container record/list
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2003, 2015 Steven H. Levine
10
11 12 Feb 03 SHL Standardize EA math
12 10 Jan 04 SHL Add some intermin large drive error avoidance
13 25 May 05 SHL Rework for ULONGLONG
14 25 May 05 SHL Rework for FillInRecordFromFFB
15 06 Jun 05 SHL Drop unused code
16 22 Jul 06 SHL Use wrappers
17 20 Feb 07 GKY Add SelectDriveIcon()
18 09 Mar 07 GKY Cleanup SelectDriveIcon using "driveflag =" from Steven
19 02 Aug 07 SHL Sync with CNRITEM mods
20 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
21 14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring
22 22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning
23 07 Aug 15 SHL Sync with Flesh/Stubby mods
24 10 Oct 15 GKY Eliminate some unnecessary Flesh and UnFlesh calls
25
26***********************************************************************/
27
28#include <stdlib.h>
29#include <string.h>
30#include <ctype.h>
31
32#define INCL_DOS
33#define INCL_WIN
34#define INCL_LONGLONG
35
36#include "fm3dll.h"
37#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
38#include "update.h"
39#include "init.h" // Data declaration(s)
40#include "notebook.h" // Data declaration(s)
41#include "info.h" // Data declaration(s)
42#include "newview.h" // Data declarations
43#include "fm3str.h"
44#include "errutil.h" // Dos_Error...
45#include "filldir.h" // FillInRecordFromFFB
46#include "dircnrs.h"
47#include "flesh.h" // Flesh, Stubby
48#include "findrec.h" // FindCnrRecord
49#include "valid.h" // IsFullName
50#include "wrappers.h" // xDosFindFirst
51#include "misc.h" // PostMsg
52#include "fortify.h"
53#include "eas.h" // GetLargeEASize
54
55#ifdef PMPRINTF
56#define _PMPRINTF_ // Enable debug macros
57#include "PMPRINTF.H"
58#endif
59
60static PSZ pszSrcFile = __FILE__;
61
62HPOINTER SelectDriveIcon(PCNRITEM pci)
63{
64 UINT driveflag = driveflags[toupper(*pci->pszFileName) - 'A'];
65 *pci->pszFileName = toupper(*pci->pszFileName);
66 if (isalpha(*pci->pszFileName) &&
67 toupper(*pci->pszFileName) > 'B') {
68 if (driveflag & DRIVE_CDROM)
69 pci->rc.hptrIcon = hptrCDROM;
70 else
71 pci->rc.hptrIcon =
72 (driveflag & DRIVE_REMOVABLE) ? hptrRemovable
73 :(driveflag & DRIVE_VIRTUAL) ? hptrVirtual
74 :(driveflag & DRIVE_REMOTE) ? hptrRemote
75 :(driveflag & DRIVE_RAMDISK) ? hptrRamdisk
76 :(driveflag & DRIVE_ZIPSTREAM) ? hptrZipstrm : hptrDrive;
77 }
78 else
79 pci->rc.hptrIcon = hptrFloppy;
80 return pci->rc.hptrIcon;
81}
82
83/**
84 * Update/add CNRITEM record for filename
85 * Deletes existing CNRITEM if file has disappeared
86 * @returns pci pointer to CNRITEM record or NULL if not found or if stale CNRITEM deleted
87 */
88
89PCNRITEM UpdateCnrRecord(HWND hwndCnr, CHAR *filename, BOOL partial,
90 DIRCNRDATA *dcd)
91{
92 PCNRITEM pci;
93 FILEFINDBUF4L ffb;
94 HDIR hDir = HDIR_CREATE;
95 ULONG nm = 1;
96 ULONG oldemphasis = 0;
97 APIRET status;
98
99 if (!filename || !*filename)
100 return (PCNRITEM) NULL;
101 if (IsFullName(filename)) {
102 if (driveflags[toupper(*filename) - 'A'] & DRIVE_NOTWRITEABLE)
103 // ignore non-writeable drives
104 return (PCNRITEM) NULL;
105 }
106 status = xDosFindFirst(filename,
107 &hDir,
108 FILE_NORMAL | FILE_DIRECTORY |
109 FILE_ARCHIVED | FILE_READONLY |
110 FILE_HIDDEN | FILE_SYSTEM,
111 &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
112 if (!status) {
113 // file exists
114 DosFindClose(hDir);
115 if (!dcd)
116 dcd = INSTDATA(hwndCnr);
117 if (dcd->type == ARC_FRAME)
118 return (PCNRITEM) NULL;
119 if (*dcd->directory) {
120
121 CHAR *p, temp;
122
123 p = strrchr(filename, '\\');
124 if (p) {
125 if (p < filename + 3)
126 p++;
127 temp = *p;
128 *p = 0;
129 if (stricmp(filename, dcd->directory)) {
130 *p = temp;
131 return (PCNRITEM) NULL;
132 }
133 *p = temp;
134 }
135 else
136 return (PCNRITEM) NULL;
137 }
138 pci = FindCnrRecord(hwndCnr,
139 filename, (PCNRITEM) NULL, partial, FALSE, TRUE);
140 Update:
141 if (pci) {
142 // Check if record needs to be updated
143 if ((!fForceUpper && !fForceLower && strcmp(pci->pszFileName, filename)) ||
144 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
145 pci->easize != 65535 ? GetLargeEASize(filename) : CBLIST_TO_EASIZE(ffb.cbList) || pci->date.day !=
146 ffb.fdateLastWrite.day || pci->date.month != ffb.fdateLastWrite.month ||
147 pci->date.year != ffb.fdateLastWrite.year + 1980 || pci->time.seconds !=
148 ffb.ftimeLastWrite.twosecs * 2 || pci->time.minutes != ffb.ftimeLastWrite.minutes ||
149 pci->time.hours != ffb.ftimeLastWrite.hours || pci->ladate.day !=
150 ffb.fdateLastAccess.day || pci->ladate.month != ffb.fdateLastAccess.month ||
151 pci->ladate.year != ffb.fdateLastAccess.year + 1980 || pci->latime.seconds !=
152 ffb.ftimeLastAccess.twosecs * 2 || pci->latime.minutes !=
153 ffb.ftimeLastAccess.minutes || pci->latime.hours != ffb.ftimeLastAccess.hours)
154 {
155 // Something changed - update
156 *ffb.achName = 0; // Tell FillInRecordFromFFB that filename contains full pathname
157 ffb.cchName = 0;
158 FillInRecordFromFFB(hwndCnr, pci, filename, &ffb, partial, dcd);
159 if (strlen(pci->pszFileName) < 4)
160 SelectDriveIcon(pci);
161 oldemphasis = pci->rc.flRecordAttr & (CRA_SELECTED | CRA_CURSORED);
162 if (oldemphasis)
163 WinSendMsg(hwndCnr,
164 CM_SETRECORDEMPHASIS,
165 MPFROMP(pci), MPFROM2SHORT(FALSE, oldemphasis));
166 WinSendMsg(hwndCnr,
167 CM_INVALIDATERECORD, MPFROMP(&pci), MPFROM2SHORT(1, CMA_TEXTCHANGED));
168 if (oldemphasis)
169 WinSendMsg(hwndCnr,
170 CM_SETRECORDEMPHASIS,
171 MPFROMP(pci), MPFROM2SHORT(TRUE, oldemphasis));
172 }
173 else // existed, unchanged, do nothing but return
174 return pci;
175 }
176 else {
177 // Add record
178 if (dcd->type == DIR_FRAME) {
179
180 RECORDINSERT ri;
181 ULONGLONG ullTotalBytes;
182
183 pci = WinSendMsg(hwndCnr,
184 CM_ALLOCRECORD,
185 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
186 if (pci) {
187 *ffb.achName = 0;
188 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
189 pci,
190 filename, &ffb, partial, dcd);
191 if (strlen(pci->pszFileName) < 4)
192 SelectDriveIcon(pci);
193 memset(&ri, 0, sizeof(RECORDINSERT));
194 ri.cb = sizeof(RECORDINSERT);
195 ri.pRecordOrder = (PRECORDCORE) CMA_END;
196 ri.pRecordParent = (PRECORDCORE) NULL;
197 ri.zOrder = (USHORT) CMA_TOP;
198 ri.cRecordsInsert = 1;
199 ri.fInvalidateRecord = TRUE;
200 if (WinSendMsg(hwndCnr,
201 CM_INSERTRECORD,
202 MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
203 dcd->ullTotalBytes += ullTotalBytes;
204 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
205 if (pci->attrFile & FILE_DIRECTORY) {
206 AddFleshWorkRequest(hwndCnr, pci, eStubby);
207 }
208 }
209 }
210 }
211 else if (ffb.attrFile & FILE_DIRECTORY) {
212
213 // check all parts and insert as required
214 CHAR *p, temp;
215 PCNRITEM pciParent = NULL, pciT;
216
217 p = strchr(filename, '\\');
218 if (p) {
219 while (p && *p) {
220 if (p < filename + 3)
221 p++;
222 temp = *p;
223 *p = 0;
224 pciT = FindCnrRecord(hwndCnr,
225 filename, NULL, partial, FALSE, TRUE);
226 if (!pciT || (INT) pciT == -1) {
227 pci = WinSendMsg(hwndCnr,
228 CM_ALLOCRECORD,
229 MPFROMLONG(EXTRA_RECORD_BYTES),
230 MPFROMLONG(1));
231 if (pci) {
232
233 RECORDINSERT ri;
234
235 *ffb.achName = 0;
236 FillInRecordFromFFB(hwndCnr,
237 pci, filename, &ffb, partial, dcd);
238 if (strlen(pci->pszFileName) < 4)
239 SelectDriveIcon(pci);
240 memset(&ri, 0, sizeof(RECORDINSERT));
241 ri.cb = sizeof(RECORDINSERT);
242 ri.pRecordOrder = (PRECORDCORE) CMA_END;
243 ri.pRecordParent = (PRECORDCORE) pciParent;
244 ri.zOrder = (USHORT) CMA_TOP;
245 ri.cRecordsInsert = 1;
246 ri.fInvalidateRecord = TRUE;
247 if (WinSendMsg(hwndCnr,
248 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
249 if (!pci->fleshed)
250 AddFleshWorkRequest(hwndCnr, pci, eFlesh);
251 *p = temp;
252 pci = FindCnrRecord(hwndCnr,
253 filename, pciT, partial, FALSE, TRUE);
254 if (pci)
255 goto Update;
256 }
257 }
258 }
259 else {
260 pciParent = pciT;
261 if (!(pciT->rc.flRecordAttr & CRA_EXPANDED)) {
262 if (!pciT->fleshed)
263 AddFleshWorkRequest(hwndCnr, pciT, eFlesh);
264 *p = temp;
265 pci = FindCnrRecord(hwndCnr,
266 filename, pciT, partial, FALSE, TRUE);
267 if (pci)
268 goto Update;
269 }
270 }
271 *p = temp;
272 p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
273 }
274 }
275 pci = WinSendMsg(hwndCnr,
276 CM_ALLOCRECORD,
277 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
278 if (pci) {
279
280 RECORDINSERT ri;
281 ULONGLONG ullTotalBytes;
282
283 *ffb.achName = 0;
284 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
285 pci,
286 filename, &ffb, partial, dcd);
287 if (strlen(pci->pszFileName) < 4)
288 SelectDriveIcon(pci);
289 memset(&ri, 0, sizeof(RECORDINSERT));
290 ri.cb = sizeof(RECORDINSERT);
291 ri.pRecordOrder = (PRECORDCORE) CMA_END;
292 ri.pRecordParent = (PRECORDCORE) pciParent;
293 ri.zOrder = (USHORT) CMA_TOP;
294 ri.cRecordsInsert = 1;
295 ri.fInvalidateRecord = TRUE;
296 if (WinSendMsg(hwndCnr,
297 CM_INSERTRECORD,
298 MPFROMP(pci), MPFROMP(&ri)) && ullTotalBytes) {
299 if (dcd->type == DIR_FRAME) {
300 dcd->ullTotalBytes += ullTotalBytes;
301 }
302 AddFleshWorkRequest(hwndCnr, pci, eStubby);
303 }
304 }
305 }
306 }
307 }
308 else if ((pci = FindCnrRecord(hwndCnr,
309 filename,
310 (PCNRITEM) NULL,
311 partial,
312 FALSE,
313 TRUE)) !=
314 NULL && (INT) pci != -1 && strlen(pci->pszFileName) > 3) {
315 // File has disappeared and found stale CNRITEM record delete it
316 if (!dcd)
317 dcd = INSTDATA(hwndCnr);
318 if (pci->rc.flRecordAttr & CRA_SELECTED)
319 WinSendMsg(hwndCnr,
320 CM_SETRECORDEMPHASIS,
321 MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
322 if (dcd->type == DIR_FRAME)
323 dcd->ullTotalBytes -= pci->cbFile + pci->easize;
324 RemoveCnrItems(hwndCnr, pci, 1, CMA_FREE | CMA_INVALIDATE);
325 pci = NULL;
326 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
327 }
328 return pci;
329}
330
331BOOL UpdateCnrList(HWND hwndCnr, CHAR ** filename, INT howmany, BOOL partial,
332 DIRCNRDATA * dcd)
333{
334 PCNRITEM pci, *pciList = NULL;
335 FILEFINDBUF4L ffb;
336 HDIR hDir;
337 ULONG nm = (ULONG) howmany;
338 INT x;
339 INT numlist = 0;
340 INT numremain;
341 BOOL repos = FALSE;
342 BOOL ret = FALSE;
343 APIRET status;
344
345 if (!dcd)
346 dcd = INSTDATA(hwndCnr);
347 if (!dcd) {
348 Runtime_Error(pszSrcFile, __LINE__, NULL);
349 return ret;
350 }
351 if (!filename || !howmany || !filename[0])
352 return ret;
353 {
354 CNRINFO cnri;
355
356 memset(&cnri, 0, sizeof(CNRINFO));
357 cnri.cb = sizeof(CNRINFO);
358 WinSendMsg(hwndCnr,
359 CM_QUERYCNRINFO, MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
360 numremain = cnri.cRecords;
361 }
362 pciList = xmalloc(sizeof(PCNRITEM) * howmany, pszSrcFile, __LINE__);
363 if (pciList) {
364 for (x = 0; filename[x] && x < howmany; x++) {
365 if (IsFullName(filename[x])) {
366 if (driveflags[toupper(*filename[x]) - 'A'] & DRIVE_NOTWRITEABLE)
367 // ignore non-writeable drives
368 continue;
369 }
370 hDir = HDIR_CREATE;
371 status = xDosFindFirst(filename[x],
372 &hDir,
373 FILE_NORMAL | FILE_DIRECTORY |
374 FILE_ARCHIVED | FILE_READONLY |
375 FILE_HIDDEN | FILE_SYSTEM,
376 &ffb, sizeof(ffb), &nm, FIL_QUERYEASIZEL);
377 if (!status) {
378 // file exists
379 DosFindClose(hDir);
380 if (dcd->type == DIR_FRAME && *dcd->directory) {
381
382 CHAR *p, temp;
383
384 p = strrchr(filename[x], '\\');
385 if (p) {
386 if (p < filename[x] + 3)
387 p++;
388 temp = *p;
389 *p = 0;
390 if (stricmp(filename[x], dcd->directory)) {
391 *p = temp;
392 continue;
393 }
394 *p = temp;
395 }
396 else
397 continue;
398 }
399 ret = TRUE;
400 pci = FindCnrRecord(hwndCnr,
401 filename[x],
402 (PCNRITEM) NULL, partial, FALSE, TRUE);
403 if (pci) {
404 // update record?
405 if ((!fForceUpper && !fForceLower &&
406 strcmp(pci->pszFileName, filename[x])) ||
407 pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile ||
408 pci->easize != 65535 ? GetLargeEASize(filename[x]) : CBLIST_TO_EASIZE(ffb.cbList) ||
409 pci->date.day != ffb.fdateLastWrite.day ||
410 pci->date.month != ffb.fdateLastWrite.month ||
411 pci->date.year != ffb.fdateLastWrite.year + 1980 ||
412 pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 ||
413 pci->time.minutes != ffb.ftimeLastWrite.minutes ||
414 pci->time.hours != ffb.ftimeLastWrite.hours ||
415 pci->ladate.day != ffb.fdateLastAccess.day ||
416 pci->ladate.month != ffb.fdateLastAccess.month ||
417 pci->ladate.year != ffb.fdateLastAccess.year + 1980 ||
418 pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 ||
419 pci->latime.minutes != ffb.ftimeLastAccess.minutes ||
420 pci->latime.hours != ffb.ftimeLastAccess.hours) {
421 // changed; update
422 pciList[numlist++] = pci;
423 *ffb.achName = 0;
424 ffb.cchName = 0;
425 FillInRecordFromFFB(hwndCnr,
426 pci, filename[x], &ffb, partial, dcd);
427 if (IsRoot(pci->pszFileName))
428 SelectDriveIcon(pci);
429 WinSendMsg(hwndCnr,
430 CM_SETRECORDEMPHASIS,
431 MPFROMP(pci),
432 MPFROM2SHORT(FALSE, CRA_SELECTED | CRA_CURSORED));
433 }
434 }
435 else {
436 // add record
437 if (dcd->type == DIR_FRAME) {
438 RECORDINSERT ri;
439 ULONGLONG ullTotalBytes;
440
441 pci = WinSendMsg(hwndCnr,
442 CM_ALLOCRECORD,
443 MPFROMLONG(EXTRA_RECORD_BYTES), MPFROMLONG(1));
444 if (pci) {
445 ret = TRUE;
446 *ffb.achName = 0;
447 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
448 pci,
449 filename[x],
450 &ffb, partial, dcd);
451 if (strlen(pci->pszFileName) < 4)
452 SelectDriveIcon(pci);
453 memset(&ri, 0, sizeof(RECORDINSERT));
454 ri.cb = sizeof(RECORDINSERT);
455 ri.pRecordOrder = (PRECORDCORE) CMA_END;
456 ri.pRecordParent = (PRECORDCORE) NULL;
457 ri.zOrder = (USHORT) CMA_TOP;
458 ri.cRecordsInsert = 1;
459 ri.fInvalidateRecord = FALSE;
460 if (WinSendMsg(hwndCnr,
461 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
462 if (ullTotalBytes) {
463 dcd->ullTotalBytes += ullTotalBytes;
464 numremain++;
465 }
466 repos = TRUE;
467 if (pci->attrFile & FILE_DIRECTORY) {
468 AddFleshWorkRequest(hwndCnr, pci, eStubby);
469 }
470 }
471 else
472 FreeCnrItem(hwndCnr, pci);
473 }
474 }
475 else if (ffb.attrFile & FILE_DIRECTORY) {
476 // check all parts and insert as required
477 CHAR *p, temp;
478 PCNRITEM pciParent = NULL, pciT;
479
480 p = strchr(filename[x], '\\');
481 if (p) {
482 while (p && *p) {
483 if (p < filename[x] + 3)
484 p++;
485 temp = *p;
486 *p = 0;
487 pciT = FindCnrRecord(hwndCnr,
488 filename[x], NULL, partial, FALSE, TRUE);
489 if (!pciT || (INT) pciT == -1) {
490 pci = WinSendMsg(hwndCnr,
491 CM_ALLOCRECORD,
492 MPFROMLONG(EXTRA_RECORD_BYTES),
493 MPFROMLONG(1));
494 if (pci) {
495
496 RECORDINSERT ri;
497 ULONGLONG ullTotalBytes;
498
499 ret = TRUE;
500 *ffb.achName = 0;
501 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
502 pci,
503 filename[x],
504 &ffb, partial, dcd);
505 if (strlen(pci->pszFileName) < 4)
506 SelectDriveIcon(pci);
507 memset(&ri, 0, sizeof(RECORDINSERT));
508 ri.cb = sizeof(RECORDINSERT);
509 ri.pRecordOrder = (PRECORDCORE) CMA_END;
510 ri.pRecordParent = (PRECORDCORE) pciParent;
511 ri.zOrder = (USHORT) CMA_TOP;
512 ri.cRecordsInsert = 1;
513 ri.fInvalidateRecord = FALSE;
514 if (WinSendMsg(hwndCnr,
515 CM_INSERTRECORD,
516 MPFROMP(pci), MPFROMP(&ri))) {
517 if (ullTotalBytes) {
518 numremain++;
519 if (dcd->type == DIR_FRAME)
520 dcd->ullTotalBytes += ullTotalBytes;
521 }
522 repos = TRUE;
523 }
524 else
525 FreeCnrItem(hwndCnr, pci);
526 }
527 }
528 else
529 pciParent = pciT;
530 *p = temp;
531 p = strchr(p + ((temp == '\\') ? 1 : 0), '\\');
532 }
533 }
534 {
535 pci = WinSendMsg(hwndCnr,
536 CM_ALLOCRECORD,
537 MPFROMLONG(EXTRA_RECORD_BYTES),
538 MPFROMLONG(1));
539 if (pci) {
540
541 RECORDINSERT ri;
542 ULONGLONG ullTotalBytes;
543
544 ret = TRUE;
545 *ffb.achName = 0;
546 ullTotalBytes = FillInRecordFromFFB(hwndCnr,
547 pci,
548 filename[x],
549 &ffb, partial, dcd);
550 if (strlen(pci->pszFileName) < 4)
551 SelectDriveIcon(pci);
552 memset(&ri, 0, sizeof(RECORDINSERT));
553 ri.cb = sizeof(RECORDINSERT);
554 ri.pRecordOrder = (PRECORDCORE) CMA_END;
555 ri.pRecordParent = (PRECORDCORE) pciParent;
556 ri.zOrder = (USHORT) CMA_TOP;
557 ri.cRecordsInsert = 1;
558 ri.fInvalidateRecord = FALSE;
559 if (WinSendMsg(hwndCnr,
560 CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) {
561 if (ullTotalBytes) {
562 numremain++;
563 if (dcd->type == DIR_FRAME)
564 dcd->ullTotalBytes += ullTotalBytes;
565 }
566 repos = TRUE;
567 AddFleshWorkRequest(hwndCnr, pci, eStubby);
568 }
569 else
570 FreeCnrItem(hwndCnr, pci);
571 }
572 }
573 }
574 }
575 }
576 else if ((pci = FindCnrRecord(hwndCnr,
577 filename[x],
578 (PCNRITEM) NULL,
579 partial,
580 FALSE,
581 TRUE)) != NULL &&
582 (INT) pci != -1 && !IsRoot(pci->pszFileName)) {
583 // file doesn't exist; delete record
584 if (pci->rc.flRecordAttr & CRA_SELECTED)
585 WinSendMsg(hwndCnr,
586 CM_SETRECORDEMPHASIS,
587 MPFROMP(pci), MPFROM2SHORT(FALSE, CRA_SELECTED));
588 if (dcd->type == DIR_FRAME)
589 dcd->ullTotalBytes -= (pci->cbFile + pci->easize);
590 // 02 Aug 07 SHL rc check was wrong
591 if (RemoveCnrItems(hwndCnr, pci, 1,
592 CMA_FREE |
593 numremain == 1 ? CMA_INVALIDATE : 0) != -1) {
594 pci = NULL;
595 numremain--;
596 repos = TRUE;
597 }
598 }
599 } // for x
600 }
601 if (repos || (pciList && numlist)) {
602 QUERYRECORDRECT qrr;
603 RECTL rCnr, rCItem;
604
605 pci = WinSendMsg(hwndCnr,
606 CM_QUERYRECORDEMPHASIS,
607 MPFROMLONG(CMA_FIRST), MPFROMLONG(CRA_CURSORED));
608 if (pci && (INT) pci != -1) {
609 memset(&qrr, 0, sizeof(QUERYRECORDRECT));
610 qrr.cb = sizeof(QUERYRECORDRECT);
611 qrr.pRecord = (PRECORDCORE) pci;
612 qrr.fRightSplitWindow = FALSE;
613 qrr.fsExtent = CMA_TEXT;
614 if (!WinSendMsg(hwndCnr,
615 CM_QUERYRECORDRECT, MPFROMP(&rCItem), MPFROMP(&qrr)))
616 qrr.cb = 0;
617 }
618 if (pciList && numlist && !repos) {
619 WinSendMsg(hwndCnr,
620 CM_INVALIDATERECORD,
621 MPFROMP(pciList),
622 MPFROM2SHORT(numlist,
623 (repos ? CMA_NOREPOSITION :
624 CMA_REPOSITION | CMA_ERASE)));
625 }
626 if (repos)
627 WinSendMsg(hwndCnr,
628 CM_INVALIDATERECORD,
629 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
630 if (pci && (INT) pci != -1 && qrr.cb) {
631 WinSendMsg(hwndCnr,
632 CM_QUERYVIEWPORTRECT,
633 MPFROMP(&rCnr), MPFROM2SHORT(CMA_WINDOW, (SHORT) FALSE));
634 WinSendMsg(hwndCnr,
635 CM_SCROLLWINDOW,
636 MPFROMSHORT(CMA_VERTICAL),
637 MPFROMLONG(rCnr.yTop - rCItem.yTop));
638 }
639 }
640 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID);
641 if (pciList) {
642 free(pciList);
643 DosPostEventSem(CompactSem);
644 }
645 return ret;
646}
647
648#pragma alloc_text(UPDATECNR,UpdateCnrRecord,UpdateCnrList)
Note: See TracBrowser for help on using the repository browser.