Changeset 2219 for trunk/src


Ignore:
Timestamp:
Dec 27, 1999, 10:21:33 PM (26 years ago)
Author:
sandervl
Message:

Enable write access for code sections which have this flag set

Location:
trunk/src/kernel32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/makefile

    r2213 r2219  
    1 # $Id: makefile,v 1.72 1999-12-27 18:42:25 sandervl Exp $
     1# $Id: makefile,v 1.73 1999-12-27 21:20:48 sandervl Exp $
    22
    33#
     
    197197    $(PDWIN32_INCLUDE)\winimagebase.h \
    198198    $(PDWIN32_INCLUDE)\winfakepeldr.h \
     199    $(PDWIN32_INCLUDE)\winimagepeldr.h \
    199200    $(PDWIN32_INCLUDE)\versionos2.h \
    200201    $(PDWIN32_INCLUDE)\wprocess.h \
  • trunk/src/kernel32/winimagepeldr.cpp

    r2138 r2219  
    1 /* $Id: winimagepeldr.cpp,v 1.25 1999-12-19 17:41:15 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.26 1999-12-27 21:20:48 sandervl Exp $ */
    22
    33/*
     
    99 * Project Odin Software License can be found in LICENSE.TXT
    1010 *
     11 * TODO: Check psh[i].Characteristics for more than only the code section
    1112 *
    1213 * NOTE: RSRC_LOAD is a special flag to only load the resource directory
     
    313314            addSection(SECTION_RELOC, psh[i].PointerToRawData,
    314315                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    315                    psh[i].Misc.VirtualSize);
     316                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    316317            continue;
    317318        }
     
    320321            addSection(SECTION_EXPORT, psh[i].PointerToRawData,
    321322                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    322                    psh[i].Misc.VirtualSize);
     323                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    323324            continue;
    324325        }
     
    327328            addSection(SECTION_RESOURCE, psh[i].PointerToRawData,
    328329                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    329                    psh[i].Misc.VirtualSize);
     330                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    330331            continue;
    331332        }
     
    336337                        addSection(SECTION_TLS, psh[i].PointerToRawData,
    337338                                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    338                                    psh[i].Misc.VirtualSize);
     339                                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    339340                }
    340341                continue;
     
    345346            addSection(SECTION_DEBUG,  psh[i].PointerToRawData,
    346347                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    347                    psh[i].Misc.VirtualSize);
     348                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    348349            continue;
    349350        }
     
    358359            addSection(type, psh[i].PointerToRawData,
    359360                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    360                    psh[i].Misc.VirtualSize);
     361                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    361362            continue;
    362363        }
     
    371372            addSection(SECTION_CODE, psh[i].PointerToRawData,
    372373                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    373                    psh[i].Misc.VirtualSize);
     374                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    374375            continue;
    375376        }
     
    378379            addSection(SECTION_READONLYDATA, psh[i].PointerToRawData,
    379380                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    380                    psh[i].Misc.VirtualSize);
     381                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    381382            continue;
    382383        }
     
    385386            addSection(SECTION_UNINITDATA, psh[i].PointerToRawData,
    386387                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    387                    psh[i].Misc.VirtualSize);
     388                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    388389            continue;
    389390        }
     
    392393            addSection(SECTION_INITDATA, psh[i].PointerToRawData,
    393394                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    394                    psh[i].Misc.VirtualSize);
     395                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    395396            continue;
    396397        }
     
    399400            addSection(SECTION_UNINITDATA, psh[i].PointerToRawData,
    400401                   psh[i].SizeOfRawData, psh[i].VirtualAddress + oh.ImageBase,
    401                    psh[i].Misc.VirtualSize);
     402                   psh[i].Misc.VirtualSize, psh[i].Characteristics);
    402403            continue;
    403404        }
     
    412413            addSection(SECTION_RESOURCE, sh.PointerToRawData,
    413414                       sh.SizeOfRawData, sh.VirtualAddress + oh.ImageBase,
    414                        sh.Misc.VirtualSize);
     415                       sh.Misc.VirtualSize, sh.Characteristics);
    415416        }
    416417  }
     
    659660//******************************************************************************
    660661//******************************************************************************
    661 void Win32PeLdrImage::addSection(ULONG type, ULONG rawoffset, ULONG rawsize, ULONG virtaddress, ULONG virtsize)
     662void Win32PeLdrImage::addSection(ULONG type, ULONG rawoffset, ULONG rawsize, ULONG virtaddress, ULONG virtsize, ULONG flags)
    662663{
    663664  virtsize = max(rawsize, virtsize);
     
    667668  section[nrsections].rawsize        = rawsize;
    668669  section[nrsections].virtaddr       = virtaddress;
     670  section[nrsections].flags          = flags;
    669671
    670672  virtsize   = ((virtsize - 1) & ~0xFFF) + PAGE_SIZE;
     
    846848        case (SECTION_CODE | SECTION_IMPORT):
    847849                section[i].pageflags = PAG_EXECUTE | PAG_READ;
     850                if(section[i].flags & IMAGE_SCN_MEM_WRITE)
     851                        section[i].pageflags |= PAG_WRITE;
    848852                break;
    849853        case SECTION_INITDATA:
Note: See TracChangeset for help on using the changeset viewer.