Changeset 3430 for trunk/src/kernel32/winimagepe2lx.cpp
- Timestamp:
- Apr 19, 2000, 10:19:13 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepe2lx.cpp
r2802 r3430 1 /* $Id: winimagepe2lx.cpp,v 1. 8 2000-02-16 14:22:12 sandervlExp $ */1 /* $Id: winimagepe2lx.cpp,v 1.9 2000-04-19 20:19:13 bird Exp $ */ 2 2 3 3 /* … … 29 29 #include <process.h> 30 30 #include <stdlib.h> 31 #include <string.h> 31 32 32 33 #include <win32type.h> … … 35 36 #include <winimagepe2lx.h> 36 37 37 #define DBG_LOCALLOG 38 #define DBG_LOCALLOG DBG_winimagepe2lx 38 39 #include "dbglocal.h" 39 40 … … 100 101 } qsLrec_t; 101 102 103 104 105 /* Pointer Record Structure 106 * This structure is the first in the user buffer. 107 * It contains pointers to heads of record types that are loaded 108 * into the buffer. 109 */ 110 111 typedef struct qsPtrRec_s { /* qsPRec */ 112 qsGrec_t *pGlobalRec; 113 void *pProcRec; /* ptr to head of process records */ 114 void *p16SemRec; /* ptr to head of 16 bit sem recds */ 115 void *p32SemRec; /* ptr to head of 32 bit sem recds */ 116 void *pMemRec; /* ptr to head of shared mem recs */ 117 qsLrec_t *pLibRec; /* ptr to head of mte records */ 118 void *pShrMemRec; /* ptr to head of shared mem records */ 119 void *pFSRec; /* ptr to head of file sys records */ 120 } qsPtrRec_t; 121 102 122 #endif 103 123 … … 310 330 { 311 331 APIRET rc = NO_ERROR; 312 qs Grec_t ** pBuf;313 ULONG cbBuf = 65536;314 315 p Buf = (qsGrec_t **)malloc(cbBuf);316 if (p Buf!= NULL)317 { 318 rc = DosQuerySysState(QS_MTE, QS_MTE, getpid(), 0L, p Buf, cbBuf);332 qsPtrRec_t * pPtrRec; 333 ULONG cbBuf = 65536; 334 335 pPtrRec = (qsPtrRec_t *)malloc(cbBuf); 336 if (pPtrRec != NULL) 337 { 338 rc = DosQuerySysState(QS_MTE, QS_MTE, getpid(), 0L, pPtrRec, cbBuf); 319 339 while (cbBuf < 1024*1024 && rc == ERROR_BUFFER_OVERFLOW) 320 340 { 321 PVOID pv = p Buf;341 PVOID pv = pPtrRec; 322 342 cbBuf += 65536; 323 p Buf = (qsGrec_t **)realloc(pv, cbBuf);324 if (p Buf!= NULL)325 rc = DosQuerySysState(QS_MTE, QS_MTE, getpid(), 0L, p Buf, cbBuf);343 pPtrRec = (qsPtrRec_t *)realloc(pv, cbBuf); 344 if (pPtrRec != NULL) 345 rc = DosQuerySysState(QS_MTE, QS_MTE, getpid(), 0L, pPtrRec, cbBuf); 326 346 else 327 347 { … … 333 353 if (rc == NO_ERROR) 334 354 { 335 qsGrec_t * pGrec = *pBuf; 336 qsLrec_t * pLrec = (qsLrec_t * )((ULONG)pGrec + sizeof(qsGrec_t)); 337 while (pLrec != NULL && pLrec->hmte != hinstance) 355 qsLrec_t * pLrec = pPtrRec->pLibRec; 356 while (pLrec != NULL) 357 { 358 /* 359 * Bug detected in OS/2 FP13. Probably a problem which occurs 360 * in _LDRSysMteInfo when qsCheckCache is calle before writing 361 * object info. The result is that the cache flushed and the 362 * attempt of updating the qsLrec_t next and object pointer is 363 * not done. This used to work earlier and on Aurora AFAIK. 364 * 365 * The fix for this problem is to check if the pObjInfo is NULL 366 * while the number of objects isn't 0 and correct this. pNextRec 367 * will also be NULL at this time. This will be have to corrected 368 * before we exit the loop or moves to the next record. 369 * There is also a nasty alignment of the object info... Hope 370 * I got it right. (This aligment seems new to FP13.) 371 */ 372 if (pLrec->pObjInfo == NULL /*&& pLrec->pNextRec == NULL*/ && pLrec->ctObj > 0) 373 { 374 pLrec->pObjInfo = (qsLObjrec_t*)( 375 (char*)pLrec 376 + ((sizeof(qsLrec_t) /* size of the lib record */ 377 + pLrec->ctImpMod * sizeof(short) /* size of the array of imported modules */ 378 + strlen((char*)pLrec->pName) + 1 /* size of the filename */ 379 + 3) & ~3)); /* the size is align on 4 bytes boundrary */ 380 pLrec->pNextRec = (qsLrec_t*)((char*)pLrec->pObjInfo 381 + sizeof(qsLObjrec_t) * pLrec->ctObj); 382 } 383 if (pLrec->hmte == hinstance) 384 break; 385 386 /* 387 * Next record 388 */ 338 389 pLrec = (qsLrec_t*)pLrec->pNextRec; 390 } 391 339 392 340 393 if (pLrec) … … 370 423 dprintf(("DosQuerySysState - failed with rc=%d (cbBuf=%d)\n", rc, cbBuf)); 371 424 372 if (p Buf!= NULL)373 free(p Buf);425 if (pPtrRec != NULL) 426 free(pPtrRec); 374 427 } 375 428 else
Note:
See TracChangeset
for help on using the changeset viewer.