summaryrefslogtreecommitdiff
path: root/src/utilcode
diff options
context:
space:
mode:
authorJohn Chen (CLR) <jochen@microsoft.com>2016-01-11 14:23:52 -0800
committerJohn Chen (CLR) <jochen@microsoft.com>2016-01-11 14:38:11 -0800
commitf3541757ddffd46da02f90909922872a694de1fd (patch)
treeafc36b03b6edb2d4b66872d61d8126b9781c1a56 /src/utilcode
parentdb743bc4103e78484bd0dac54a1b887da63a7059 (diff)
downloadcoreclr-f3541757ddffd46da02f90909922872a694de1fd.tar.gz
coreclr-f3541757ddffd46da02f90909922872a694de1fd.tar.bz2
coreclr-f3541757ddffd46da02f90909922872a694de1fd.zip
Make CORCOMPILE_HEADER backward compatible
Resolve issue #2348 by reordering fields in CORCOMPILE_HEADER, so that PEKind and Machines fields are in the same location as in older versions of this struct.
Diffstat (limited to 'src/utilcode')
-rw-r--r--src/utilcode/pedecoder.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp
index 049276ba5b..2e1a143534 100644
--- a/src/utilcode/pedecoder.cpp
+++ b/src/utilcode/pedecoder.cpp
@@ -1226,9 +1226,12 @@ IMAGE_DATA_DIRECTORY *PEDecoder::GetMetaDataHelper(METADATA_SECTION_TYPE type) c
// Visual Studio took dependency on crossgen /CreatePDB returning COR_E_NI_AND_RUNTIME_VERSION_MISMATCH
// when crossgen and the native image come from different runtimes. In order to reach error path that returns
- // COR_E_NI_AND_RUNTIME_VERSION_MISMATCH in this case, size of CORCOMPILE_HEADER has to remain constant to pass earlier
+ // COR_E_NI_AND_RUNTIME_VERSION_MISMATCH in this case, size of CORCOMPILE_HEADER has to remain constant,
+ // and the offset of PEKind and Machine fields inside CORCOMPILE_HEADER also have to remain constant, to pass earlier
// checks that lead to different error codes. See Windows Phone Blue Bug #45406 for details.
_ASSERTE(sizeof(CORCOMPILE_HEADER) == 160 + sizeof(TADDR));
+ _ASSERTE(offsetof(CORCOMPILE_HEADER, PEKind) == 108 + sizeof(TADDR));
+ _ASSERTE(offsetof(CORCOMPILE_HEADER, Machine) == 116 + sizeof(TADDR));
// Handle NGEN format; otherwise, there is only one MetaData section in the
// COR_HEADER and so the value of pDirRet is correct