* Fix zap and ready to run disabling
While the COMPlus_ZapDisable and COMPlus_ReadyToRun config settings
can be used to disable using crossgened / ready to run images, loading
IL from such images fails.
This change foxes that.
* Reflect PR feedback
Remove ReadyToRunInfo::IsReadyToRunEnabled from Module::Initialize again
and move the same check in the ReadyToRunInfo::Initialize before we
start checking the PE file properties.
// if (!HasNativeHeader())
// ThrowHR(COR_E_BADIMAGEFORMAT);
- if (HasNativeHeader())
+ if (HasNativeHeader() && g_fAllowNativeImages)
{
if (!IsNativeMachineFormat())
ThrowHR(COR_E_BADIMAGEFORMAT);
if (!HasCorHeader())
ThrowHR(COR_E_BADIMAGEFORMAT);
- if (HasNativeHeader() || HasReadyToRunHeader())
+ if ((HasNativeHeader() || HasReadyToRunHeader()) && g_fAllowNativeImages)
{
//Do base relocation for PE, if necessary.
if (!IsNativeMachineFormat())
PEFile * pFile = pModule->GetFile();
+ if (!IsReadyToRunEnabled())
+ {
+ // Log message is ignored in this case.
+ DoLog(NULL);
+ return NULL;
+ }
+
// Ignore ReadyToRun for introspection-only loads
if (pFile->IsIntrospectionOnly())
{
return NULL;
}
- if (!IsReadyToRunEnabled())
- {
- // Log message is ignored in this case.
- DoLog(NULL);
- return NULL;
- }
-
if (CORProfilerDisableAllNGenImages() || CORProfilerUseProfileImages())
{
DoLog("Ready to Run disabled - profiler disabled native images");