source: trunk/dll/update.c@ 1878

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

Eliminate some unnecessary Flesh and UnFlesh calls.Update icon and display name on CD/DVD eject in all cases.
Don't use Flesh thread for floppy drive scans fix them getting mistakenly identified as directories and add nonexistent subdirectories.

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