Changeset 85 for trunk/kLdr/kLdrModPE.c


Ignore:
Timestamp:
Sep 6, 2016, 5:21:04 AM (9 years ago)
Author:
bird
Message:

fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/kLdrModPE.c

    r81 r85  
    336336        pMod->aSegments[i + 1].pchName = pch = (const char *)&pModPE->aShdrs[i].Name[0];
    337337        cb = IMAGE_SIZEOF_SHORT_NAME;
    338         while (     cb > 0
    339                &&   (pch[cb - 1] == ' ' || pch[cb - 1] == '\0'))
     338        while (   cb > 0
     339               && (pch[cb - 1] == ' ' || pch[cb - 1] == '\0'))
    340340            cb--;
    341341        pMod->aSegments[i + 1].cchName = cb;
     
    344344        if (!(pModPE->aShdrs[i].Characteristics & IMAGE_SCN_TYPE_NOLOAD))
    345345        {
     346            /* Kluge to deal with wlink ".reloc" sections that has a VirtualSize of 0 bytes. */
     347            KU32 cb = pModPE->aShdrs[i].Misc.VirtualSize;
     348            if (!cb)
     349                cb = K_ALIGN_Z(pModPE->aShdrs[i].SizeOfRawData, pModPE->Hdrs.OptionalHeader.SectionAlignment);
    346350            pMod->aSegments[i + 1].cb          = pModPE->aShdrs[i].Misc.VirtualSize;
    347351            pMod->aSegments[i + 1].LinkAddress = pModPE->aShdrs[i].VirtualAddress
    348352                                               + pModPE->Hdrs.OptionalHeader.ImageBase;
    349353            pMod->aSegments[i + 1].RVA         = pModPE->aShdrs[i].VirtualAddress;
    350             pMod->aSegments[i + 1].cbMapped    = pModPE->aShdrs[i].Misc.VirtualSize;
     354            pMod->aSegments[i + 1].cbMapped    = cb;
    351355            if (i + 2 < pMod->cSegments)
    352356                pMod->aSegments[i + 1].cbMapped= pModPE->aShdrs[i + 1].VirtualAddress
     
    363367        /* file location */
    364368        pMod->aSegments[i + 1].offFile = pModPE->aShdrs[i].PointerToRawData;
    365         pMod->aSegments[i + 1].cbFile = pModPE->aShdrs[i].SizeOfRawData;
     369        pMod->aSegments[i + 1].cbFile  = pModPE->aShdrs[i].SizeOfRawData;
    366370        if (    pMod->aSegments[i + 1].cbMapped > 0 /* if mapped */
    367371            &&  (KLDRSIZE)pMod->aSegments[i + 1].cbFile > pMod->aSegments[i + 1].cbMapped)
Note: See TracChangeset for help on using the changeset viewer.