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