Changeset 4167 for trunk/src/kernel32/winimagepe2lx.cpp
- Timestamp:
- Sep 2, 2000, 11:14:50 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagepe2lx.cpp
r4097 r4167 1 /* $Id: winimagepe2lx.cpp,v 1.1 3 2000-08-27 03:20:37bird Exp $ */1 /* $Id: winimagepe2lx.cpp,v 1.14 2000-09-02 21:14:50 bird Exp $ */ 2 2 3 3 /* … … 33 33 #include <win32type.h> 34 34 #include <misc.h> 35 #include <winimagebase.h> 36 #include <winimagepe2lx.h> 35 #include "winimagebase.h" 36 #include "winimagepe2lx.h" 37 #include "Win32k.h" 37 38 38 39 #define DBG_LOCALLOG DBG_winimagepe2lx … … 386 387 { 387 388 APIRET rc = NO_ERROR; 389 390 /* 391 * If Win32k.sys is installed we'll use it. 392 */ 393 if (libWin32kInstalled()) 394 { 395 ULONG cbQte = sizeof(QOTEBUFFER) + sizeof(QOTE)*20; 396 PQOTEBUFFER pQOte = (PQOTEBUFFER)malloc(sizeof(QOTEBUFFER) + sizeof(QOTE)*20); 397 if (pQOte != NULL) 398 { 399 /* 400 * Get the query OTEs for this module. 401 * If there is a buffer overflow we'll allocate more storage and retry. 402 */ 403 rc = W32kQueryOTEs(hinstance, pQOte, cbQte); 404 while (rc == ERROR_BUFFER_OVERFLOW && cbQte < 32000); 405 { 406 PVOID pvOld = pQOte; 407 cbQte += sizeof(QOTE) * 20; 408 pQOte = (PQOTEBUFFER)realloc(pQOte, cbQte); 409 if (pQOte == NULL) 410 { 411 free(pvOld); 412 return ERROR_NOT_ENOUGH_MEMORY; 413 } 414 415 rc = W32kQueryOTEs(hinstance, pQOte, cbQte); 416 } 417 418 /* 419 * If successfully got the OTEs then allocate and set paSections structs. 420 */ 421 if (rc == NO_ERROR) 422 { 423 /* Allocate memory for paSections */ 424 paSections = (PSECTION)malloc(pQOte->cOTEs * sizeof(SECTION)); 425 if (paSections != NULL) 426 { 427 /* objects -> section array */ 428 for (int i = 0; i < pQOte->cOTEs; i++) 429 { 430 paSections[i].ulRVA = ~0UL; 431 paSections[i].cbVirtual = pQOte->aOTE[i].ote_size; 432 paSections[i].ulAddress = pQOte->aOTE[i].ote_base; 433 } 434 cSections = pQOte->cOTEs; 435 } 436 else 437 rc = ERROR_NOT_ENOUGH_MEMORY; 438 } 439 else 440 { 441 dprintf(("Win32Pe2LxImage::getSections: libW32kQueryOTEs failed with rc=%d." 442 " Falls back on the DosQuerySysState method.\n", rc)); 443 } 444 } 445 else 446 { /* server error, no use in trying the fallback method. */ 447 dprintf(("Win32Pe2LxImage::getSections: malloc failed\n")); 448 return ERROR_NOT_ENOUGH_MEMORY; 449 } 450 451 if (rc == NO_ERROR) 452 return rc; 453 } 454 455 456 /* 457 * Fallback method, using DosQuerySysState. 458 */ 388 459 qsPtrRec_t * pPtrRec; 389 460 ULONG cbBuf = 65536;
Note:
See TracChangeset
for help on using the changeset viewer.