| 1 |  | 
|---|
| 2 | /*********************************************************************** | 
|---|
| 3 |  | 
|---|
| 4 | $Id: update.c 51 2003-02-12 20:22:14Z root $ | 
|---|
| 5 |  | 
|---|
| 6 | Update Container record/list | 
|---|
| 7 |  | 
|---|
| 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| 9 | Copyright (c) 2003 Steven H.Levine | 
|---|
| 10 |  | 
|---|
| 11 | Revisions     12 Feb 03 SHL - Standardize EA math | 
|---|
| 12 |  | 
|---|
| 13 | ***********************************************************************/ | 
|---|
| 14 |  | 
|---|
| 15 | #define INCL_DOS | 
|---|
| 16 | #define INCL_WIN | 
|---|
| 17 |  | 
|---|
| 18 | #include <os2.h> | 
|---|
| 19 | #include <stdarg.h> | 
|---|
| 20 | #include <stdio.h> | 
|---|
| 21 | #include <stdlib.h> | 
|---|
| 22 | #include <string.h> | 
|---|
| 23 | #include <ctype.h> | 
|---|
| 24 | #include "fm3dll.h" | 
|---|
| 25 |  | 
|---|
| 26 | #pragma alloc_text(UPDATECNR,UpdateCnrRecord,UpdateCnrList) | 
|---|
| 27 |  | 
|---|
| 28 |  | 
|---|
| 29 | PCNRITEM UpdateCnrRecord (HWND hwndCnr,CHAR *filename,BOOL partial, | 
|---|
| 30 | DIRCNRDATA *dcd) | 
|---|
| 31 | { | 
|---|
| 32 |  | 
|---|
| 33 | PCNRITEM      pci; | 
|---|
| 34 | FILEFINDBUF4  ffb; | 
|---|
| 35 | HDIR          hDir = HDIR_CREATE; | 
|---|
| 36 | ULONG         nm = 1L; | 
|---|
| 37 | ULONG         oldemphasis = 0; | 
|---|
| 38 | APIRET        status; | 
|---|
| 39 | BOOL          needtosort = FALSE; | 
|---|
| 40 | #ifdef DEBUG | 
|---|
| 41 | BOOL existed=FALSE,updated=FALSE,added=FALSE,deleted=FALSE,found=FALSE; | 
|---|
| 42 | #endif | 
|---|
| 43 |  | 
|---|
| 44 | if(!filename || !*filename) | 
|---|
| 45 | return (PCNRITEM)NULL; | 
|---|
| 46 | if(IsFullName(filename)) { | 
|---|
| 47 | if(driveflags[toupper(*filename) - 'A'] & DRIVE_NOTWRITEABLE) | 
|---|
| 48 | /* ignore non-writeable drives */ | 
|---|
| 49 | return (PCNRITEM)NULL; | 
|---|
| 50 | } | 
|---|
| 51 | status = DosFindFirst(filename, | 
|---|
| 52 | &hDir, | 
|---|
| 53 | FILE_NORMAL   | FILE_DIRECTORY | | 
|---|
| 54 | FILE_ARCHIVED | FILE_READONLY | | 
|---|
| 55 | FILE_HIDDEN   | FILE_SYSTEM, | 
|---|
| 56 | &ffb, | 
|---|
| 57 | sizeof(ffb), | 
|---|
| 58 | &nm, | 
|---|
| 59 | FIL_QUERYEASIZE); | 
|---|
| 60 | if(!status) { | 
|---|
| 61 | #ifdef DEBUG | 
|---|
| 62 | existed = TRUE; | 
|---|
| 63 | #endif | 
|---|
| 64 | /* file exists */ | 
|---|
| 65 | DosFindClose(hDir); | 
|---|
| 66 | if(!dcd) | 
|---|
| 67 | dcd = INSTDATA(hwndCnr); | 
|---|
| 68 | /* | 
|---|
| 69 | if(dcd->type == TREE_FRAME && | 
|---|
| 70 | !(ffb.attrFile & FILE_DIRECTORY)) | 
|---|
| 71 | return (PCNRITEM)NULL; | 
|---|
| 72 | */ | 
|---|
| 73 | if(dcd->type == ARC_FRAME) | 
|---|
| 74 | return (PCNRITEM)NULL; | 
|---|
| 75 | if(*dcd->directory) { | 
|---|
| 76 |  | 
|---|
| 77 | CHAR *p,temp; | 
|---|
| 78 |  | 
|---|
| 79 | p = strrchr(filename,'\\'); | 
|---|
| 80 | if(p) { | 
|---|
| 81 | if(p < filename + 3) | 
|---|
| 82 | p++; | 
|---|
| 83 | temp = *p; | 
|---|
| 84 | *p = 0; | 
|---|
| 85 | if(stricmp(filename,dcd->directory)) { | 
|---|
| 86 | *p = temp; | 
|---|
| 87 | return (PCNRITEM)NULL; | 
|---|
| 88 | } | 
|---|
| 89 | *p = temp; | 
|---|
| 90 | } | 
|---|
| 91 | else | 
|---|
| 92 | return (PCNRITEM)NULL; | 
|---|
| 93 | } | 
|---|
| 94 | pci = FindCnrRecord(hwndCnr, | 
|---|
| 95 | filename, | 
|---|
| 96 | (PCNRITEM)NULL, | 
|---|
| 97 | partial, | 
|---|
| 98 | FALSE, | 
|---|
| 99 | TRUE); | 
|---|
| 100 | Update: | 
|---|
| 101 | if(pci) {     /* update record? */ | 
|---|
| 102 | #ifdef DEBUG | 
|---|
| 103 | found=TRUE; | 
|---|
| 104 | #endif | 
|---|
| 105 | if((!fForceUpper && !fForceLower && | 
|---|
| 106 | strcmp(pci->szFileName,filename)) || | 
|---|
| 107 | pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile || | 
|---|
| 108 | pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || | 
|---|
| 109 | pci->date.day != ffb.fdateLastWrite.day || | 
|---|
| 110 | pci->date.month != ffb.fdateLastWrite.month || | 
|---|
| 111 | pci->date.year != ffb.fdateLastWrite.year + 1980 || | 
|---|
| 112 | pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 || | 
|---|
| 113 | pci->time.minutes != ffb.ftimeLastWrite.minutes || | 
|---|
| 114 | pci->time.hours != ffb.ftimeLastWrite.hours || | 
|---|
| 115 | pci->ladate.day != ffb.fdateLastAccess.day || | 
|---|
| 116 | pci->ladate.month != ffb.fdateLastAccess.month || | 
|---|
| 117 | pci->ladate.year != ffb.fdateLastAccess.year + 1980 || | 
|---|
| 118 | pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 || | 
|---|
| 119 | pci->latime.minutes != ffb.ftimeLastAccess.minutes || | 
|---|
| 120 | pci->latime.hours != ffb.ftimeLastAccess.hours) { /* changed; update */ | 
|---|
| 121 | #ifdef DEBUG | 
|---|
| 122 | updated=TRUE; | 
|---|
| 123 | #endif | 
|---|
| 124 | *ffb.achName = 0; | 
|---|
| 125 | ffb.cchName = 0; | 
|---|
| 126 | FillInRecordFromFFB(hwndCnr,pci,filename,&ffb,partial,dcd); | 
|---|
| 127 | if(strlen(pci->szFileName) < 4) { | 
|---|
| 128 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 129 | if(isalpha(*pci->szFileName) && toupper(*pci->szFileName) > 'B') { | 
|---|
| 130 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 131 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 132 | else | 
|---|
| 133 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 134 | hptrRemovable : | 
|---|
| 135 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 136 | hptrRemote : | 
|---|
| 137 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 138 | hptrZipstrm : hptrDrive; | 
|---|
| 139 | } | 
|---|
| 140 | else | 
|---|
| 141 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 142 | } | 
|---|
| 143 | oldemphasis = pci->rc.flRecordAttr & | 
|---|
| 144 | (CRA_SELECTED | CRA_CURSORED); | 
|---|
| 145 | if(oldemphasis) | 
|---|
| 146 | WinSendMsg(hwndCnr, | 
|---|
| 147 | CM_SETRECORDEMPHASIS, | 
|---|
| 148 | MPFROMP(pci), | 
|---|
| 149 | MPFROM2SHORT(FALSE, | 
|---|
| 150 | oldemphasis)); | 
|---|
| 151 | WinSendMsg(hwndCnr, | 
|---|
| 152 | CM_INVALIDATERECORD, | 
|---|
| 153 | MPFROMP(&pci), | 
|---|
| 154 | MPFROM2SHORT(1, | 
|---|
| 155 | /* CMA_ERASE | */CMA_TEXTCHANGED)); | 
|---|
| 156 | if(oldemphasis) | 
|---|
| 157 | WinSendMsg(hwndCnr, | 
|---|
| 158 | CM_SETRECORDEMPHASIS, | 
|---|
| 159 | MPFROMP(pci), | 
|---|
| 160 | MPFROM2SHORT(TRUE, | 
|---|
| 161 | oldemphasis)); | 
|---|
| 162 | } | 
|---|
| 163 | else  /* existed, unchanged, do nothing but return */ | 
|---|
| 164 | return pci; | 
|---|
| 165 | } | 
|---|
| 166 | else {        /* add record */ | 
|---|
| 167 | #ifdef DEBUG | 
|---|
| 168 | added=TRUE; | 
|---|
| 169 | #endif | 
|---|
| 170 | needtosort = TRUE; | 
|---|
| 171 | if(dcd->type == DIR_FRAME) { | 
|---|
| 172 |  | 
|---|
| 173 | RECORDINSERT ri; | 
|---|
| 174 | ULONG        totalbytes; | 
|---|
| 175 |  | 
|---|
| 176 | pci = WinSendMsg(hwndCnr, | 
|---|
| 177 | CM_ALLOCRECORD, | 
|---|
| 178 | MPFROMLONG(EXTRA_RECORD_BYTES), | 
|---|
| 179 | MPFROMLONG(1L)); | 
|---|
| 180 | if(pci) { | 
|---|
| 181 | *ffb.achName = 0; | 
|---|
| 182 | totalbytes = FillInRecordFromFFB(hwndCnr, | 
|---|
| 183 | pci, | 
|---|
| 184 | filename, | 
|---|
| 185 | &ffb, | 
|---|
| 186 | partial, | 
|---|
| 187 | dcd); | 
|---|
| 188 | if(strlen(pci->szFileName) < 4) { | 
|---|
| 189 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 190 | if(isalpha(*pci->szFileName) && | 
|---|
| 191 | toupper(*pci->szFileName) > 'B') { | 
|---|
| 192 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 193 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 194 | else | 
|---|
| 195 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 196 | hptrRemovable : | 
|---|
| 197 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 198 | hptrRemote : | 
|---|
| 199 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 200 | hptrZipstrm : hptrDrive; | 
|---|
| 201 | } | 
|---|
| 202 | else | 
|---|
| 203 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 204 | } | 
|---|
| 205 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
| 206 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
| 207 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
| 208 | ri.pRecordParent      = (PRECORDCORE)NULL; | 
|---|
| 209 | ri.zOrder             = (USHORT)CMA_TOP; | 
|---|
| 210 | ri.cRecordsInsert     = 1L; | 
|---|
| 211 | ri.fInvalidateRecord  = TRUE; | 
|---|
| 212 | if(WinSendMsg(hwndCnr, | 
|---|
| 213 | CM_INSERTRECORD, | 
|---|
| 214 | MPFROMP(pci), | 
|---|
| 215 | MPFROMP(&ri)) && | 
|---|
| 216 | totalbytes != (ULONG)-1L && | 
|---|
| 217 | totalbytes) { | 
|---|
| 218 | dcd->totalbytes += totalbytes; | 
|---|
| 219 | PostMsg(hwndCnr, | 
|---|
| 220 | UM_RESCAN, | 
|---|
| 221 | MPVOID, | 
|---|
| 222 | MPVOID); | 
|---|
| 223 | if(pci->attrFile & FILE_DIRECTORY) | 
|---|
| 224 | Stubby(hwndCnr,pci); | 
|---|
| 225 | } | 
|---|
| 226 | } | 
|---|
| 227 | } | 
|---|
| 228 | else if(ffb.attrFile & FILE_DIRECTORY) { | 
|---|
| 229 |  | 
|---|
| 230 | /* check all parts and insert as required */ | 
|---|
| 231 | CHAR    *p,temp; | 
|---|
| 232 | PCNRITEM pciParent = NULL,pciT; | 
|---|
| 233 |  | 
|---|
| 234 | p = strchr(filename,'\\'); | 
|---|
| 235 | if(p) { | 
|---|
| 236 | while(p && *p) { | 
|---|
| 237 | if(p < filename + 3) | 
|---|
| 238 | p++; | 
|---|
| 239 | temp = *p; | 
|---|
| 240 | *p = 0; | 
|---|
| 241 | pciT = FindCnrRecord(hwndCnr, | 
|---|
| 242 | filename, | 
|---|
| 243 | NULL, | 
|---|
| 244 | partial, | 
|---|
| 245 | FALSE, | 
|---|
| 246 | TRUE); | 
|---|
| 247 | if(!pciT || (INT)pciT == -1) { | 
|---|
| 248 | pci = WinSendMsg(hwndCnr, | 
|---|
| 249 | CM_ALLOCRECORD, | 
|---|
| 250 | MPFROMLONG(EXTRA_RECORD_BYTES), | 
|---|
| 251 | MPFROMLONG(1L)); | 
|---|
| 252 | if(pci) { | 
|---|
| 253 |  | 
|---|
| 254 | RECORDINSERT ri; | 
|---|
| 255 | ULONG        totalbytes; | 
|---|
| 256 |  | 
|---|
| 257 | *ffb.achName = 0; | 
|---|
| 258 | totalbytes = FillInRecordFromFFB(hwndCnr, | 
|---|
| 259 | pci, | 
|---|
| 260 | filename, | 
|---|
| 261 | &ffb, | 
|---|
| 262 | partial, | 
|---|
| 263 | dcd); | 
|---|
| 264 | if(strlen(pci->szFileName) < 4) { | 
|---|
| 265 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 266 | if(isalpha(*pci->szFileName) && toupper(*pci->szFileName) > 'B') { | 
|---|
| 267 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 268 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 269 | else | 
|---|
| 270 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 271 | hptrRemovable : | 
|---|
| 272 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 273 | hptrRemote : | 
|---|
| 274 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 275 | hptrZipstrm : hptrDrive; | 
|---|
| 276 | } | 
|---|
| 277 | else | 
|---|
| 278 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 279 | } | 
|---|
| 280 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
| 281 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
| 282 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
| 283 | ri.pRecordParent      = (PRECORDCORE)pciParent; | 
|---|
| 284 | ri.zOrder             = (USHORT)CMA_TOP; | 
|---|
| 285 | ri.cRecordsInsert     = 1L; | 
|---|
| 286 | ri.fInvalidateRecord  = TRUE; | 
|---|
| 287 | if(WinSendMsg(hwndCnr, | 
|---|
| 288 | CM_INSERTRECORD, | 
|---|
| 289 | MPFROMP(pci), | 
|---|
| 290 | MPFROMP(&ri))) { | 
|---|
| 291 | Flesh(hwndCnr,pci); | 
|---|
| 292 | *p = temp; | 
|---|
| 293 | pci = FindCnrRecord(hwndCnr, | 
|---|
| 294 | filename, | 
|---|
| 295 | pciT, | 
|---|
| 296 | partial, | 
|---|
| 297 | FALSE, | 
|---|
| 298 | TRUE); | 
|---|
| 299 | if(pci) | 
|---|
| 300 | goto Update; | 
|---|
| 301 | } | 
|---|
| 302 | } | 
|---|
| 303 | } | 
|---|
| 304 | else { | 
|---|
| 305 | pciParent = pciT; | 
|---|
| 306 | if(!(pciT->rc.flRecordAttr & CRA_EXPANDED)) { | 
|---|
| 307 | Flesh(hwndCnr,pciT); | 
|---|
| 308 | *p = temp; | 
|---|
| 309 | pci = FindCnrRecord(hwndCnr, | 
|---|
| 310 | filename, | 
|---|
| 311 | pciT, | 
|---|
| 312 | partial, | 
|---|
| 313 | FALSE, | 
|---|
| 314 | TRUE); | 
|---|
| 315 | if(pci) | 
|---|
| 316 | goto Update; | 
|---|
| 317 | } | 
|---|
| 318 | } | 
|---|
| 319 | *p = temp; | 
|---|
| 320 | p = strchr(p + ((temp == '\\') ? 1 : 0),'\\'); | 
|---|
| 321 | } | 
|---|
| 322 | } | 
|---|
| 323 | pci = WinSendMsg(hwndCnr, | 
|---|
| 324 | CM_ALLOCRECORD, | 
|---|
| 325 | MPFROMLONG(EXTRA_RECORD_BYTES), | 
|---|
| 326 | MPFROMLONG(1L)); | 
|---|
| 327 | if(pci) { | 
|---|
| 328 |  | 
|---|
| 329 | RECORDINSERT ri; | 
|---|
| 330 | ULONG        totalbytes; | 
|---|
| 331 |  | 
|---|
| 332 | *ffb.achName = 0; | 
|---|
| 333 | totalbytes = FillInRecordFromFFB(hwndCnr, | 
|---|
| 334 | pci, | 
|---|
| 335 | filename, | 
|---|
| 336 | &ffb, | 
|---|
| 337 | partial, | 
|---|
| 338 | dcd); | 
|---|
| 339 | if(strlen(pci->szFileName) < 4) { | 
|---|
| 340 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 341 | if(isalpha(*pci->szFileName) && | 
|---|
| 342 | toupper(*pci->szFileName) > 'B') { | 
|---|
| 343 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 344 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 345 | else | 
|---|
| 346 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 347 | hptrRemovable : | 
|---|
| 348 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 349 | hptrRemote : | 
|---|
| 350 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 351 | hptrZipstrm : hptrDrive; | 
|---|
| 352 | } | 
|---|
| 353 | else | 
|---|
| 354 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 355 | } | 
|---|
| 356 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
| 357 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
| 358 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
| 359 | ri.pRecordParent      = (PRECORDCORE)pciParent; | 
|---|
| 360 | ri.zOrder             = (USHORT)CMA_TOP; | 
|---|
| 361 | ri.cRecordsInsert     = 1L; | 
|---|
| 362 | ri.fInvalidateRecord  = TRUE; | 
|---|
| 363 | if(WinSendMsg(hwndCnr, | 
|---|
| 364 | CM_INSERTRECORD, | 
|---|
| 365 | MPFROMP(pci), | 
|---|
| 366 | MPFROMP(&ri)) && | 
|---|
| 367 | totalbytes != (ULONG)-1L && | 
|---|
| 368 | totalbytes) { | 
|---|
| 369 | if(dcd->type == DIR_FRAME) | 
|---|
| 370 | dcd->totalbytes += totalbytes; | 
|---|
| 371 | Stubby(hwndCnr,pci); | 
|---|
| 372 | } | 
|---|
| 373 | } | 
|---|
| 374 | } | 
|---|
| 375 | } | 
|---|
| 376 | } | 
|---|
| 377 | else if((pci = FindCnrRecord(hwndCnr, | 
|---|
| 378 | filename, | 
|---|
| 379 | (PCNRITEM)NULL, | 
|---|
| 380 | partial, | 
|---|
| 381 | FALSE, | 
|---|
| 382 | TRUE)) != | 
|---|
| 383 | NULL && (INT)pci != -1 && strlen(pci->szFileName) > 3) { | 
|---|
| 384 | /* file doesn't exist; delete record */ | 
|---|
| 385 | #ifdef DEBUG | 
|---|
| 386 | found=TRUE; | 
|---|
| 387 | deleted=TRUE; | 
|---|
| 388 | #endif | 
|---|
| 389 | if(!dcd) | 
|---|
| 390 | dcd = INSTDATA(hwndCnr); | 
|---|
| 391 | if(pci->rc.flRecordAttr & CRA_SELECTED) | 
|---|
| 392 | WinSendMsg(hwndCnr, | 
|---|
| 393 | CM_SETRECORDEMPHASIS, | 
|---|
| 394 | MPFROMP(pci), | 
|---|
| 395 | MPFROM2SHORT(FALSE, | 
|---|
| 396 | CRA_SELECTED)); | 
|---|
| 397 | if(dcd->type == DIR_FRAME) | 
|---|
| 398 | dcd->totalbytes -= (pci->cbFile + pci->easize); | 
|---|
| 399 | WinSendMsg(hwndCnr, | 
|---|
| 400 | CM_REMOVERECORD, | 
|---|
| 401 | MPFROMP(&pci), | 
|---|
| 402 | MPFROM2SHORT(1, | 
|---|
| 403 | CMA_FREE | CMA_INVALIDATE)); | 
|---|
| 404 | pci = (PCNRITEM)NULL; | 
|---|
| 405 | PostMsg(hwndCnr, | 
|---|
| 406 | UM_RESCAN, | 
|---|
| 407 | MPVOID, | 
|---|
| 408 | MPVOID); | 
|---|
| 409 | } | 
|---|
| 410 | #ifdef DEBUG | 
|---|
| 411 | { | 
|---|
| 412 | char s[CCHMAXPATH + 80]; | 
|---|
| 413 | sprintf(s,"%s:%s%s%s%s%s",filename,(existed) ? " Existed" : "", | 
|---|
| 414 | (updated) ? " Updated" : "",(added) ? " Added" : "", | 
|---|
| 415 | (deleted) ? " Deleted" : "",(found) ? " Found" : ""); | 
|---|
| 416 | WinSetWindowText(WinQueryWindow(hwndMain,QW_PARENT),s); | 
|---|
| 417 | } | 
|---|
| 418 | #endif | 
|---|
| 419 | return pci; | 
|---|
| 420 | } | 
|---|
| 421 |  | 
|---|
| 422 |  | 
|---|
| 423 |  | 
|---|
| 424 | BOOL UpdateCnrList (HWND hwndCnr,CHAR **filename,INT howmany,BOOL partial, | 
|---|
| 425 | DIRCNRDATA *dcd) | 
|---|
| 426 | { | 
|---|
| 427 |  | 
|---|
| 428 | PCNRITEM      pci,*pciList = NULL; | 
|---|
| 429 | FILEFINDBUF4  ffb; | 
|---|
| 430 | HDIR          hDir; | 
|---|
| 431 | ULONG         nm = 1L; | 
|---|
| 432 | register INT  x,numlist = 0,numremain; | 
|---|
| 433 | BOOL          repos = FALSE,needtosort = FALSE,ret = FALSE; | 
|---|
| 434 | APIRET        status; | 
|---|
| 435 |  | 
|---|
| 436 | if(!dcd) | 
|---|
| 437 | dcd = INSTDATA(hwndCnr); | 
|---|
| 438 | if(!dcd) | 
|---|
| 439 | return ret; | 
|---|
| 440 | if(!filename || !howmany || !filename[0]) | 
|---|
| 441 | return ret; | 
|---|
| 442 | { | 
|---|
| 443 | CNRINFO cnri; | 
|---|
| 444 |  | 
|---|
| 445 | memset(&cnri,0,sizeof(CNRINFO)); | 
|---|
| 446 | cnri.cb = sizeof(CNRINFO); | 
|---|
| 447 | WinSendMsg(hwndCnr, | 
|---|
| 448 | CM_QUERYCNRINFO, | 
|---|
| 449 | MPFROMP(&cnri), | 
|---|
| 450 | MPFROMLONG(sizeof(CNRINFO))); | 
|---|
| 451 | numremain = cnri.cRecords; | 
|---|
| 452 | } | 
|---|
| 453 | pciList = malloc(sizeof(PCNRITEM) * howmany); | 
|---|
| 454 | for(x = 0;filename[x] && x < howmany;x++) { | 
|---|
| 455 | if(IsFullName(filename[x])) { | 
|---|
| 456 | if(driveflags[toupper(*filename[x]) - 'A'] & DRIVE_NOTWRITEABLE) | 
|---|
| 457 | /* ignore non-writeable drives */ | 
|---|
| 458 | continue; | 
|---|
| 459 | } | 
|---|
| 460 | hDir = HDIR_CREATE; | 
|---|
| 461 | status = DosFindFirst(filename[x], | 
|---|
| 462 | &hDir, | 
|---|
| 463 | FILE_NORMAL   | FILE_DIRECTORY | | 
|---|
| 464 | FILE_ARCHIVED | FILE_READONLY | | 
|---|
| 465 | FILE_HIDDEN   | FILE_SYSTEM, | 
|---|
| 466 | &ffb, | 
|---|
| 467 | sizeof(ffb), | 
|---|
| 468 | &nm, | 
|---|
| 469 | FIL_QUERYEASIZE); | 
|---|
| 470 | if(!status) { | 
|---|
| 471 | /* file exists */ | 
|---|
| 472 | DosFindClose(hDir); | 
|---|
| 473 | //      if(dcd->type == TREE_FRAME && !(ffb.attrFile & FILE_DIRECTORY)) | 
|---|
| 474 | //        continue; | 
|---|
| 475 | if(dcd->type == DIR_FRAME && | 
|---|
| 476 | *dcd->directory) { | 
|---|
| 477 |  | 
|---|
| 478 | CHAR *p,temp; | 
|---|
| 479 |  | 
|---|
| 480 | p = strrchr(filename[x],'\\'); | 
|---|
| 481 | if(p) { | 
|---|
| 482 | if(p < filename[x] + 3) | 
|---|
| 483 | p++; | 
|---|
| 484 | temp = *p; | 
|---|
| 485 | *p = 0; | 
|---|
| 486 | if(stricmp(filename[x],dcd->directory)) { | 
|---|
| 487 | *p = temp; | 
|---|
| 488 | continue; | 
|---|
| 489 | } | 
|---|
| 490 | *p = temp; | 
|---|
| 491 | } | 
|---|
| 492 | else | 
|---|
| 493 | continue; | 
|---|
| 494 | } | 
|---|
| 495 | ret = TRUE; | 
|---|
| 496 | pci = FindCnrRecord(hwndCnr, | 
|---|
| 497 | filename[x], | 
|---|
| 498 | (PCNRITEM)NULL, | 
|---|
| 499 | partial, | 
|---|
| 500 | FALSE, | 
|---|
| 501 | TRUE); | 
|---|
| 502 | if(pci) {     /* update record? */ | 
|---|
| 503 | if((!fForceUpper && !fForceLower && | 
|---|
| 504 | strcmp(pci->szFileName,filename[x])) || | 
|---|
| 505 | pci->cbFile != ffb.cbFile || pci->attrFile != ffb.attrFile || | 
|---|
| 506 | pci->easize != CBLIST_TO_EASIZE(ffb.cbList) || | 
|---|
| 507 | pci->date.day != ffb.fdateLastWrite.day || | 
|---|
| 508 | pci->date.month != ffb.fdateLastWrite.month || | 
|---|
| 509 | pci->date.year != ffb.fdateLastWrite.year + 1980 || | 
|---|
| 510 | pci->time.seconds != ffb.ftimeLastWrite.twosecs * 2 || | 
|---|
| 511 | pci->time.minutes != ffb.ftimeLastWrite.minutes || | 
|---|
| 512 | pci->time.hours != ffb.ftimeLastWrite.hours || | 
|---|
| 513 | pci->ladate.day != ffb.fdateLastAccess.day || | 
|---|
| 514 | pci->ladate.month != ffb.fdateLastAccess.month || | 
|---|
| 515 | pci->ladate.year != ffb.fdateLastAccess.year + 1980 || | 
|---|
| 516 | pci->latime.seconds != ffb.ftimeLastAccess.twosecs * 2 || | 
|---|
| 517 | pci->latime.minutes != ffb.ftimeLastAccess.minutes || | 
|---|
| 518 | pci->latime.hours != ffb.ftimeLastAccess.hours) { /* changed; update */ | 
|---|
| 519 | pciList[numlist++] = pci; | 
|---|
| 520 | *ffb.achName = 0; | 
|---|
| 521 | ffb.cchName = 0; | 
|---|
| 522 | FillInRecordFromFFB(hwndCnr, | 
|---|
| 523 | pci, | 
|---|
| 524 | filename[x], | 
|---|
| 525 | &ffb, | 
|---|
| 526 | partial, | 
|---|
| 527 | dcd); | 
|---|
| 528 | if(IsRoot(pci->szFileName)) { | 
|---|
| 529 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 530 | if(isalpha(*pci->szFileName) && | 
|---|
| 531 | toupper(*pci->szFileName) > 'B') { | 
|---|
| 532 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 533 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 534 | else | 
|---|
| 535 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 536 | hptrRemovable : | 
|---|
| 537 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 538 | hptrRemote : | 
|---|
| 539 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 540 | hptrZipstrm : hptrDrive; | 
|---|
| 541 | } | 
|---|
| 542 | else | 
|---|
| 543 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 544 | } | 
|---|
| 545 | WinSendMsg(hwndCnr, | 
|---|
| 546 | CM_SETRECORDEMPHASIS, | 
|---|
| 547 | MPFROMP(pci), | 
|---|
| 548 | MPFROM2SHORT(FALSE, | 
|---|
| 549 | CRA_SELECTED | CRA_CURSORED)); | 
|---|
| 550 | } | 
|---|
| 551 | } | 
|---|
| 552 | else {        /* add record */ | 
|---|
| 553 | needtosort = TRUE; | 
|---|
| 554 | if(dcd->type == DIR_FRAME) { | 
|---|
| 555 |  | 
|---|
| 556 | RECORDINSERT ri; | 
|---|
| 557 | ULONG        totalbytes; | 
|---|
| 558 |  | 
|---|
| 559 | pci = WinSendMsg(hwndCnr, | 
|---|
| 560 | CM_ALLOCRECORD, | 
|---|
| 561 | MPFROMLONG(EXTRA_RECORD_BYTES), | 
|---|
| 562 | MPFROMLONG(1L)); | 
|---|
| 563 | if(pci) { | 
|---|
| 564 | ret = TRUE; | 
|---|
| 565 | *ffb.achName = 0; | 
|---|
| 566 | totalbytes = FillInRecordFromFFB(hwndCnr, | 
|---|
| 567 | pci, | 
|---|
| 568 | filename[x], | 
|---|
| 569 | &ffb, | 
|---|
| 570 | partial, | 
|---|
| 571 | dcd); | 
|---|
| 572 | if(strlen(pci->szFileName) < 4) { | 
|---|
| 573 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 574 | if(isalpha(*pci->szFileName) && | 
|---|
| 575 | toupper(*pci->szFileName) > 'B') { | 
|---|
| 576 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 577 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 578 | else | 
|---|
| 579 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 580 | hptrRemovable : | 
|---|
| 581 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 582 | hptrRemote : | 
|---|
| 583 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 584 | hptrZipstrm : hptrDrive; | 
|---|
| 585 | } | 
|---|
| 586 | else | 
|---|
| 587 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 588 | } | 
|---|
| 589 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
| 590 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
| 591 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
| 592 | ri.pRecordParent      = (PRECORDCORE)NULL; | 
|---|
| 593 | ri.zOrder             = (USHORT)CMA_TOP; | 
|---|
| 594 | ri.cRecordsInsert     = 1L; | 
|---|
| 595 | ri.fInvalidateRecord  = FALSE; | 
|---|
| 596 | if(WinSendMsg(hwndCnr, | 
|---|
| 597 | CM_INSERTRECORD, | 
|---|
| 598 | MPFROMP(pci), | 
|---|
| 599 | MPFROMP(&ri))) { | 
|---|
| 600 | if(totalbytes != (ULONG)-1L && | 
|---|
| 601 | totalbytes) { | 
|---|
| 602 | dcd->totalbytes += totalbytes; | 
|---|
| 603 | numremain++; | 
|---|
| 604 | } | 
|---|
| 605 | repos = TRUE; | 
|---|
| 606 | if(pci->attrFile & FILE_DIRECTORY) | 
|---|
| 607 | Stubby(hwndCnr,pci); | 
|---|
| 608 | } | 
|---|
| 609 | else | 
|---|
| 610 | WinSendMsg(hwndCnr, | 
|---|
| 611 | CM_FREERECORD, | 
|---|
| 612 | MPFROMP(&pci), | 
|---|
| 613 | MPFROMSHORT(1)); | 
|---|
| 614 | } | 
|---|
| 615 | } | 
|---|
| 616 | else if(ffb.attrFile & FILE_DIRECTORY) {  /* check all parts and insert as required */ | 
|---|
| 617 |  | 
|---|
| 618 | CHAR    *p,temp; | 
|---|
| 619 | PCNRITEM pciParent = NULL,pciT; | 
|---|
| 620 |  | 
|---|
| 621 | p = strchr(filename[x],'\\'); | 
|---|
| 622 | if(p) { | 
|---|
| 623 | while(p && *p) { | 
|---|
| 624 | if(p < filename[x] + 3) | 
|---|
| 625 | p++; | 
|---|
| 626 | temp = *p; | 
|---|
| 627 | *p = 0; | 
|---|
| 628 | pciT = FindCnrRecord(hwndCnr, | 
|---|
| 629 | filename[x], | 
|---|
| 630 | NULL, | 
|---|
| 631 | partial, | 
|---|
| 632 | FALSE, | 
|---|
| 633 | TRUE); | 
|---|
| 634 | if(!pciT || (INT)pciT == -1) { | 
|---|
| 635 | pci = WinSendMsg(hwndCnr, | 
|---|
| 636 | CM_ALLOCRECORD, | 
|---|
| 637 | MPFROMLONG(EXTRA_RECORD_BYTES), | 
|---|
| 638 | MPFROMLONG(1L)); | 
|---|
| 639 | if(pci) { | 
|---|
| 640 |  | 
|---|
| 641 | RECORDINSERT ri; | 
|---|
| 642 | ULONG        totalbytes; | 
|---|
| 643 |  | 
|---|
| 644 | ret = TRUE; | 
|---|
| 645 | *ffb.achName = 0; | 
|---|
| 646 | totalbytes = FillInRecordFromFFB(hwndCnr, | 
|---|
| 647 | pci, | 
|---|
| 648 | filename[x], | 
|---|
| 649 | &ffb, | 
|---|
| 650 | partial, | 
|---|
| 651 | dcd); | 
|---|
| 652 | if(strlen(pci->szFileName) < 4) { | 
|---|
| 653 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 654 | if(isalpha(*pci->szFileName) && | 
|---|
| 655 | toupper(*pci->szFileName) > 'B') { | 
|---|
| 656 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 657 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 658 | else | 
|---|
| 659 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 660 | hptrRemovable : | 
|---|
| 661 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 662 | hptrRemote : | 
|---|
| 663 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 664 | hptrZipstrm : hptrDrive; | 
|---|
| 665 | } | 
|---|
| 666 | else | 
|---|
| 667 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 668 | } | 
|---|
| 669 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
| 670 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
| 671 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
| 672 | ri.pRecordParent      = (PRECORDCORE)pciParent; | 
|---|
| 673 | ri.zOrder             = (USHORT)CMA_TOP; | 
|---|
| 674 | ri.cRecordsInsert     = 1L; | 
|---|
| 675 | ri.fInvalidateRecord  = FALSE; | 
|---|
| 676 | if(WinSendMsg(hwndCnr, | 
|---|
| 677 | CM_INSERTRECORD, | 
|---|
| 678 | MPFROMP(pci), | 
|---|
| 679 | MPFROMP(&ri))) { | 
|---|
| 680 | if(totalbytes != (ULONG)-1L && totalbytes) { | 
|---|
| 681 | numremain++; | 
|---|
| 682 | if(dcd->type == DIR_FRAME) | 
|---|
| 683 | dcd->totalbytes += totalbytes; | 
|---|
| 684 | } | 
|---|
| 685 | repos = TRUE; | 
|---|
| 686 | } | 
|---|
| 687 | else | 
|---|
| 688 | WinSendMsg(hwndCnr, | 
|---|
| 689 | CM_FREERECORD, | 
|---|
| 690 | MPFROMP(&pci), | 
|---|
| 691 | MPFROMSHORT(1)); | 
|---|
| 692 | } | 
|---|
| 693 | } | 
|---|
| 694 | else | 
|---|
| 695 | pciParent = pciT; | 
|---|
| 696 | *p = temp; | 
|---|
| 697 | p = strchr(p + ((temp == '\\') ? 1 : 0),'\\'); | 
|---|
| 698 | } | 
|---|
| 699 | } | 
|---|
| 700 | { | 
|---|
| 701 | pci = WinSendMsg(hwndCnr, | 
|---|
| 702 | CM_ALLOCRECORD, | 
|---|
| 703 | MPFROMLONG(EXTRA_RECORD_BYTES), | 
|---|
| 704 | MPFROMLONG(1L)); | 
|---|
| 705 | if(pci) { | 
|---|
| 706 |  | 
|---|
| 707 | RECORDINSERT ri; | 
|---|
| 708 | ULONG        totalbytes; | 
|---|
| 709 |  | 
|---|
| 710 | ret = TRUE; | 
|---|
| 711 | *ffb.achName = 0; | 
|---|
| 712 | totalbytes = FillInRecordFromFFB(hwndCnr, | 
|---|
| 713 | pci, | 
|---|
| 714 | filename[x], | 
|---|
| 715 | &ffb, | 
|---|
| 716 | partial, | 
|---|
| 717 | dcd); | 
|---|
| 718 | if(strlen(pci->szFileName) < 4) { | 
|---|
| 719 | *pci->szFileName = toupper(*pci->szFileName); | 
|---|
| 720 | if(isalpha(*pci->szFileName) && | 
|---|
| 721 | toupper(*pci->szFileName) > 'B') { | 
|---|
| 722 | if(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_CDROM) | 
|---|
| 723 | pci->rc.hptrIcon = hptrCDROM; | 
|---|
| 724 | else | 
|---|
| 725 | pci->rc.hptrIcon = (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOVABLE) ? | 
|---|
| 726 | hptrRemovable : | 
|---|
| 727 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_REMOTE) ? | 
|---|
| 728 | hptrRemote : | 
|---|
| 729 | (driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_ZIPSTREAM) ? | 
|---|
| 730 | hptrZipstrm : hptrDrive; | 
|---|
| 731 | } | 
|---|
| 732 | else | 
|---|
| 733 | pci->rc.hptrIcon = hptrFloppy; | 
|---|
| 734 | } | 
|---|
| 735 | memset(&ri,0,sizeof(RECORDINSERT)); | 
|---|
| 736 | ri.cb                 = sizeof(RECORDINSERT); | 
|---|
| 737 | ri.pRecordOrder       = (PRECORDCORE)CMA_END; | 
|---|
| 738 | ri.pRecordParent      = (PRECORDCORE)pciParent; | 
|---|
| 739 | ri.zOrder             = (USHORT)CMA_TOP; | 
|---|
| 740 | ri.cRecordsInsert     = 1L; | 
|---|
| 741 | ri.fInvalidateRecord  = FALSE; | 
|---|
| 742 | if(WinSendMsg(hwndCnr, | 
|---|
| 743 | CM_INSERTRECORD, | 
|---|
| 744 | MPFROMP(pci), | 
|---|
| 745 | MPFROMP(&ri))) { | 
|---|
| 746 | if(totalbytes != (ULONG)-1L && totalbytes) { | 
|---|
| 747 | numremain++; | 
|---|
| 748 | if(dcd->type == DIR_FRAME) | 
|---|
| 749 | dcd->totalbytes += totalbytes; | 
|---|
| 750 | } | 
|---|
| 751 | repos = TRUE; | 
|---|
| 752 | Stubby(hwndCnr,pci); | 
|---|
| 753 | } | 
|---|
| 754 | else | 
|---|
| 755 | WinSendMsg(hwndCnr, | 
|---|
| 756 | CM_FREERECORD, | 
|---|
| 757 | MPFROMP(&pci), | 
|---|
| 758 | MPFROMSHORT(1)); | 
|---|
| 759 | } | 
|---|
| 760 | } | 
|---|
| 761 | } | 
|---|
| 762 | } | 
|---|
| 763 | } | 
|---|
| 764 | else if((pci = FindCnrRecord(hwndCnr, | 
|---|
| 765 | filename[x], | 
|---|
| 766 | (PCNRITEM)NULL, | 
|---|
| 767 | partial, | 
|---|
| 768 | FALSE, | 
|---|
| 769 | TRUE)) !=  NULL && | 
|---|
| 770 | (INT)pci != -1 && !IsRoot(pci->szFileName)) { | 
|---|
| 771 | /* file doesn't exist; delete record */ | 
|---|
| 772 | if(pci->rc.flRecordAttr & CRA_SELECTED) | 
|---|
| 773 | WinSendMsg(hwndCnr, | 
|---|
| 774 | CM_SETRECORDEMPHASIS, | 
|---|
| 775 | MPFROMP(pci), | 
|---|
| 776 | MPFROM2SHORT(FALSE, | 
|---|
| 777 | CRA_SELECTED)); | 
|---|
| 778 | if(dcd->type == DIR_FRAME) | 
|---|
| 779 | dcd->totalbytes -= (pci->cbFile + pci->easize); | 
|---|
| 780 | if(WinSendMsg(hwndCnr, | 
|---|
| 781 | CM_REMOVERECORD, | 
|---|
| 782 | MPFROMP(&pci), | 
|---|
| 783 | MPFROM2SHORT(1, | 
|---|
| 784 | CMA_FREE | | 
|---|
| 785 | ((numremain == 1) ? | 
|---|
| 786 | CMA_INVALIDATE : 0)))) { | 
|---|
| 787 | numremain--; | 
|---|
| 788 | repos = TRUE; | 
|---|
| 789 | } | 
|---|
| 790 | } | 
|---|
| 791 | } | 
|---|
| 792 | if(repos || (pciList && numlist)) { | 
|---|
| 793 |  | 
|---|
| 794 | QUERYRECORDRECT qrr; | 
|---|
| 795 | RECTL           rCnr,rCItem; | 
|---|
| 796 |  | 
|---|
| 797 | pci = WinSendMsg(hwndCnr, | 
|---|
| 798 | CM_QUERYRECORDEMPHASIS, | 
|---|
| 799 | MPFROMLONG(CMA_FIRST), | 
|---|
| 800 | MPFROMLONG(CRA_CURSORED)); | 
|---|
| 801 | if(pci && (INT)pci != -1) { | 
|---|
| 802 | memset(&qrr, 0, sizeof(QUERYRECORDRECT)); | 
|---|
| 803 | qrr.cb = sizeof(QUERYRECORDRECT); | 
|---|
| 804 | qrr.pRecord = (PRECORDCORE) pci; | 
|---|
| 805 | qrr.fRightSplitWindow = FALSE; | 
|---|
| 806 | qrr.fsExtent = CMA_TEXT; | 
|---|
| 807 | if(!WinSendMsg(hwndCnr, | 
|---|
| 808 | CM_QUERYRECORDRECT, | 
|---|
| 809 | MPFROMP(&rCItem), | 
|---|
| 810 | MPFROMP(&qrr))) | 
|---|
| 811 | qrr.cb = 0; | 
|---|
| 812 | } | 
|---|
| 813 | if(pciList && numlist && !repos) | 
|---|
| 814 | WinSendMsg(hwndCnr, | 
|---|
| 815 | CM_INVALIDATERECORD, | 
|---|
| 816 | MPFROMP(pciList), | 
|---|
| 817 | MPFROM2SHORT(numlist,((repos) ? | 
|---|
| 818 | CMA_NOREPOSITION : | 
|---|
| 819 | CMA_REPOSITION | CMA_ERASE))); | 
|---|
| 820 | if(repos) | 
|---|
| 821 | WinSendMsg(hwndCnr, | 
|---|
| 822 | CM_INVALIDATERECORD, | 
|---|
| 823 | MPVOID, | 
|---|
| 824 | MPFROM2SHORT(0, | 
|---|
| 825 | CMA_ERASE | CMA_REPOSITION)); | 
|---|
| 826 | if(pci && (INT)pci != -1 && qrr.cb) { | 
|---|
| 827 | WinSendMsg(hwndCnr, | 
|---|
| 828 | CM_QUERYVIEWPORTRECT, | 
|---|
| 829 | MPFROMP(&rCnr), | 
|---|
| 830 | MPFROM2SHORT(CMA_WINDOW, | 
|---|
| 831 | (SHORT)FALSE)); | 
|---|
| 832 | WinSendMsg(hwndCnr, | 
|---|
| 833 | CM_SCROLLWINDOW, | 
|---|
| 834 | MPFROMSHORT(CMA_VERTICAL), | 
|---|
| 835 | MPFROMLONG(rCnr.yTop - rCItem.yTop)); | 
|---|
| 836 | } | 
|---|
| 837 | } | 
|---|
| 838 | PostMsg(hwndCnr, | 
|---|
| 839 | UM_RESCAN, | 
|---|
| 840 | MPVOID, | 
|---|
| 841 | MPVOID); | 
|---|
| 842 | if(pciList) { | 
|---|
| 843 | free(pciList); | 
|---|
| 844 | DosPostEventSem(CompactSem); | 
|---|
| 845 | } | 
|---|
| 846 | return ret; | 
|---|
| 847 | } | 
|---|
| 848 |  | 
|---|