diff options
author | Ruben Ayrapetyan <r.ayrapetyan@samsung.com> | 2017-04-05 21:08:32 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-05-23 07:54:50 -0700 |
commit | 31b5ee0bc7df328fd9187d25dbadebe7c1623d38 (patch) | |
tree | 3ce7fc7769db58f9ca7a568f124870817ba66060 /src/utilcode | |
parent | 155f8c247b35549a5d48523f9e6715a94b939d01 (diff) | |
download | coreclr-31b5ee0bc7df328fd9187d25dbadebe7c1623d38.tar.gz coreclr-31b5ee0bc7df328fd9187d25dbadebe7c1623d38.tar.bz2 coreclr-31b5ee0bc7df328fd9187d25dbadebe7c1623d38.zip |
Direct mapping of IL-assembly images that don't contain writeable sections.
Diffstat (limited to 'src/utilcode')
-rw-r--r-- | src/utilcode/pedecoder.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp index 3b3c937419..babe374542 100644 --- a/src/utilcode/pedecoder.cpp +++ b/src/utilcode/pedecoder.cpp @@ -440,6 +440,37 @@ CHECK PEDecoder::CheckSection(COUNT_T previousAddressEnd, COUNT_T addressStart, CHECK_OK; } +BOOL PEDecoder::HasWriteableSections() const +{ + CONTRACT_CHECK + { + INSTANCE_CHECK; + PRECONDITION(CheckFormat()); + NOTHROW; + GC_NOTRIGGER; + SUPPORTS_DAC; + SO_TOLERANT; + } + CONTRACT_CHECK_END; + + PTR_IMAGE_SECTION_HEADER pSection = FindFirstSection(FindNTHeaders()); + _ASSERTE(pSection != NULL); + + PTR_IMAGE_SECTION_HEADER pSectionEnd = pSection + VAL16(FindNTHeaders()->FileHeader.NumberOfSections); + + while (pSection < pSectionEnd) + { + if ((pSection->Characteristics & VAL32(IMAGE_SCN_MEM_WRITE)) != 0) + { + return TRUE; + } + + pSection++; + } + + return FALSE; +} + CHECK PEDecoder::CheckDirectoryEntry(int entry, int forbiddenFlags, IsNullOK ok) const { CONTRACT_CHECK |