Ignore:
Timestamp:
Dec 13, 1999, 8:28:15 PM (26 years ago)
Author:
sandervl
Message:

Fixes for the on-demand page loader; disabled by default for debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/winimagepeldr.cpp

    r2061 r2066  
    1 /* $Id: winimagepeldr.cpp,v 1.22 1999-12-12 14:32:38 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.23 1999-12-13 19:28:15 sandervl Exp $ */
    22
    33/*
     
    4949#include "mmap.h"
    5050#include <wprocess.h>
     51
     52//Define COMMIT_ALL to let the pe loader commit all sections of the image
     53//This is very useful during debugging as you'll get lots of exceptions
     54//otherwise.
     55#define COMMIT_ALL
    5156
    5257char szErrorTitle[]     = "Odin";
     
    478483        commitPage((ULONG)pFixups, FALSE);
    479484   }
    480 //   if(fh.Characteristics & IMAGE_FILE_DLL) {
    481         if(processExports((char *)win32file) == FALSE) {
    482                 dprintf((LOG, "Failed to process exported apis" ));
    483                 goto failure;
    484         }
    485 //   }
    486   }
    487 
    488   for (i=0; i<nSections; i++) {
     485#ifdef COMMIT_ALL
     486   for (i=0; i<nSections; i++) {
    489487        commitPage((ULONG)section[i].realvirtaddr, FALSE, COMPLETE_SECTION);
    490   }
     488   }
     489#else
     490   for (i=0; i<nSections; i++) {
     491        switch(section[i].type)
     492        {
     493        case SECTION_IMPORT:
     494        case SECTION_RELOC:
     495        case SECTION_EXPORT:
     496                commitPage((ULONG)section[i].realvirtaddr, FALSE, COMPLETE_SECTION);
     497                break;
     498        }
     499   }
     500#endif
     501   if(processExports((char *)win32file) == FALSE) {
     502        dprintf((LOG, "Failed to process exported apis" ));
     503        goto failure;
     504   }
     505  }
     506#ifdef COMMIT_ALL
     507  else {
     508   for (i=0; i<nSections; i++) {
     509        commitPage((ULONG)section[i].realvirtaddr, FALSE, COMPLETE_SECTION);
     510   }
     511  }
     512#endif
    491513
    492514  //SvL: Use pointer to image header as module handle now. Some apps needs this
     
    895917                                }
    896918                                //SvL: Read page from disk
    897                                 commitPage(newpage, TRUE, SINGLE_PAGE);
     919                                commitPage(newpage, FALSE, SINGLE_PAGE);
    898920
    899921                                //SvL: Enable write access
     
    14141436        j++;
    14151437        if((ulCurFixup & 0xfff) == 0) {
    1416                 commitPage(ulCurFixup & ~0xfff, TRUE, SINGLE_PAGE);
     1438                commitPage(ulCurFixup & ~0xfff, FALSE, SINGLE_PAGE);
    14171439                DosSetMem((PVOID)(ulCurFixup & ~0xfff), PAGE_SIZE, PAG_READ|PAG_WRITE);
    14181440                nrPages++;
Note: See TracChangeset for help on using the changeset viewer.