Ignore:
Timestamp:
Oct 6, 2000, 1:04:02 PM (25 years ago)
Author:
sandervl
Message:

console, pe loader + FormatMessage fixes

File:
1 edited

Legend:

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

    r4422 r4440  
    1 /* $Id: winimagepeldr.cpp,v 1.55 2000-10-04 19:36:25 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.56 2000-10-06 11:04:02 sandervl Exp $ */
    22
    33/*
     
    287287   if ((psh = (PIMAGE_SECTION_HEADER)SECTIONHDROFF (win32file)) != NULL) {
    288288    dprintf((LOG, "*************************PE SECTIONS START**************************" ));
    289     for (i=0; i<nSections; i++) {
     289    for (i=0; i<nSections; i++)
     290    {
    290291        dprintf((LOG, "Raw data size:        %x", psh[i].SizeOfRawData ));
    291292        dprintf((LOG, "Virtual Address:      %x", psh[i].VirtualAddress ));
     
    295296        dprintf((LOG, "Pointer to raw data:  %x", psh[i].PointerToRawData ));
    296297        dprintf((LOG, "Section flags:        %x\n\n", psh[i].Characteristics ));
    297         if(strcmp(psh[i].Name, ".reloc") == 0) {
     298
     299        if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_BASERELOC))
     300        {
    298301            dprintf((LOG, ".reloc" ));
    299302            addSection(SECTION_RELOC, psh[i].PointerToRawData,
     
    302305            continue;
    303306        }
    304         if(strcmp(psh[i].Name, ".edata") == 0) {
     307        if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_EXPORT))
     308        {
    305309            dprintf((LOG, ".edata" ));
    306310            addSection(SECTION_EXPORT, psh[i].PointerToRawData,
     
    309313            continue;
    310314        }
    311         if(strcmp(psh[i].Name, ".rsrc") == 0) {
     315        if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_RESOURCE))
     316        {
    312317            dprintf((LOG, ".rsrc" ));
    313318            addSection(SECTION_RESOURCE, psh[i].PointerToRawData,
     
    316321            continue;
    317322        }
    318         if(strcmp(psh[i].Name, ".tls") == 0)
     323        if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_TLS))
    319324        {
    320325                tlsDir = (IMAGE_TLS_DIRECTORY *)ImageDirectoryOffset(win32file, IMAGE_DIRECTORY_ENTRY_TLS);
     
    326331                continue;
    327332        }
    328 
    329         if(strcmp(psh[i].Name, ".debug") == 0) {
     333        if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_DEBUG)) 
     334        {
    330335            dprintf((LOG, ".rdebug" ));
    331336            addSection(SECTION_DEBUG,  psh[i].PointerToRawData,
     
    334339            continue;
    335340        }
    336         if(IsImportSection(win32file, &psh[i]))
     341        if(IsSectionType(win32file, &psh[i], IMAGE_DIRECTORY_ENTRY_IMPORT))
    337342        {
    338           int type = SECTION_IMPORT;
     343            int type = SECTION_IMPORT;
     344
    339345            dprintf((LOG, "Import Data Section" ));
    340346            if(psh[i].Characteristics & IMAGE_SCN_CNT_CODE) {
     
    348354        }
    349355
    350             //KSO Sun 1998-08-09: Borland does not alway set the CODE flag for its "CODE" section
    351         if(  psh[i].Characteristics & IMAGE_SCN_CNT_CODE ||
    352             (psh[i].Characteristics & IMAGE_SCN_MEM_EXECUTE &&
    353                !(psh[i].Characteristics & (IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_CNT_INITIALIZED_DATA))) //KSO: make sure its not marked as a datasection
     356        //KSO Sun 1998-08-09: Borland does not alway set the CODE flag for its "CODE" section
     357        if(psh[i].Characteristics & IMAGE_SCN_CNT_CODE ||
     358           (psh[i].Characteristics & IMAGE_SCN_MEM_EXECUTE &&
     359           !(psh[i].Characteristics & (IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_CNT_INITIALIZED_DATA))) //KSO: make sure its not marked as a datasection
    354360            )
    355361        {
     
    394400  }
    395401  else {
    396         if(GetSectionHdrByName (win32file, &sh, ".rsrc"))
     402        if(GetSectionHdrByImageDir(win32file, IMAGE_DIRECTORY_ENTRY_RESOURCE, &sh))
    397403        {
    398404            addSection(SECTION_RESOURCE, sh.PointerToRawData,
     
    539545  //PH: get pResRootDir pointer correct first, since processImports may
    540546  //    implicitly call functions depending on it.
    541   if(GetSectionHdrByName (win32file, &sh, ".rsrc")) {
     547  if(GetSectionHdrByImageDir(win32file, IMAGE_DIRECTORY_ENTRY_RESOURCE, &sh)) {
    542548        //get offset in resource object of directory entry
    543549        pResRootDir = (PIMAGE_RESOURCE_DIRECTORY)(sh.VirtualAddress + realBaseAddress);
Note: See TracChangeset for help on using the changeset viewer.