VirtualBox

Changeset 106861 in vbox


Ignore:
Timestamp:
Nov 7, 2024 3:18:57 AM (2 months ago)
Author:
vboxsync
Message:

IPRT/ldrPE.cpp: Don't be so strict about SizeOfStackReserve/SizeOfStackCommit and SizeOfHeapReserve/SizeOfHeapCommit. Ran into this with wsock32.dll from NT 3.1. Also fixed the RTLDRTYPE classification (nobody uses this), which swapped DLLs and EXEs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp

    r106732 r106861  
    43814381        Log(("rtldrPEOpen: %s: SizeOfStackReserve %#x < SizeOfStackCommit %#x!!!\n",
    43824382             pszLogName, pOptHdr->SizeOfStackReserve, pOptHdr->SizeOfStackCommit));
    4383         return RTERRINFO_LOG_SET_F(pErrInfo, VERR_BAD_EXE_FORMAT, "SizeOfStackReserve %#x < SizeOfStackCommit %#x",
    4384                                    pOptHdr->SizeOfStackReserve, pOptHdr->SizeOfStackCommit);
     4383        if (   !(fFlags & (RTLDR_O_FOR_DEBUG | RTLDR_O_FOR_VALIDATION))
     4384            && !(pFileHdr->Characteristics & IMAGE_FILE_DLL))
     4385            return RTERRINFO_LOG_SET_F(pErrInfo, VERR_BAD_EXE_FORMAT, "SizeOfStackReserve %#x < SizeOfStackCommit %#x",
     4386                                       pOptHdr->SizeOfStackReserve, pOptHdr->SizeOfStackCommit);
    43854387    }
    43864388    if (pOptHdr->SizeOfHeapReserve < pOptHdr->SizeOfHeapCommit)
    43874389    {
    4388         Log(("rtldrPEOpen: %s: SizeOfStackReserve %#x < SizeOfStackCommit %#x!!!\n",
    4389              pszLogName, pOptHdr->SizeOfStackReserve, pOptHdr->SizeOfStackCommit));
    4390         return RTERRINFO_LOG_SET_F(pErrInfo, VERR_BAD_EXE_FORMAT, "SizeOfStackReserve %#x < SizeOfStackCommit %#x\n",
    4391                                    pOptHdr->SizeOfStackReserve, pOptHdr->SizeOfStackCommit);
     4390        Log(("rtldrPEOpen: %s: SizeOfHeapReserve %#x < SizeOfHeapCommit %#x!!!\n",
     4391             pszLogName, pOptHdr->SizeOfHeapReserve, pOptHdr->SizeOfHeapCommit));
     4392        if (   !(fFlags & (RTLDR_O_FOR_DEBUG | RTLDR_O_FOR_VALIDATION))
     4393            && !(pFileHdr->Characteristics & IMAGE_FILE_DLL))
     4394            return RTERRINFO_LOG_SET_F(pErrInfo, VERR_BAD_EXE_FORMAT, "SizeOfHeapReserve %#x < SizeOfHeapCommit %#x\n",
     4395                                       pOptHdr->SizeOfHeapReserve, pOptHdr->SizeOfHeapCommit);
    43924396    }
    43934397
     
    51525156                pModPe->Core.pReader  = pReader;
    51535157                pModPe->Core.enmFormat= RTLDRFMT_PE;
    5154                 pModPe->Core.enmType  = FileHdr.Characteristics & IMAGE_FILE_DLL
     5158                pModPe->Core.enmType  = !(FileHdr.Characteristics & IMAGE_FILE_DLL)
    51555159                                      ? FileHdr.Characteristics & IMAGE_FILE_RELOCS_STRIPPED
    51565160                                        ? RTLDRTYPE_EXECUTABLE_FIXED
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette