summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ToolBox/SOS/Strike/disasm.h3
-rw-r--r--src/binder/coreclrbindercommon.cpp4
-rw-r--r--src/classlibnative/bcltype/arraynative.cpp13
-rw-r--r--src/classlibnative/bcltype/number.cpp53
-rw-r--r--src/classlibnative/bcltype/number.h3
-rw-r--r--src/classlibnative/bcltype/stringnative.cpp5
-rw-r--r--src/classlibnative/bcltype/system.cpp171
-rw-r--r--src/classlibnative/bcltype/system.h21
-rw-r--r--src/classlibnative/inc/nlsinfo.h7
-rw-r--r--src/classlibnative/nls/encodingdata.cpp579
-rw-r--r--src/classlibnative/nls/nlsinfo.cpp544
-rw-r--r--src/debug/daccess/dacdbiimpl.cpp24
-rw-r--r--src/debug/daccess/nidump.cpp16
-rw-r--r--src/debug/di/cordb.cpp2
-rw-r--r--src/debug/di/process.cpp42
-rw-r--r--src/debug/di/rsmain.cpp4
-rw-r--r--src/debug/di/rsmda.cpp23
-rw-r--r--src/debug/di/rspriv.h2
-rw-r--r--src/debug/ee/dactable.cpp4
-rw-r--r--src/debug/ee/debugger.cpp6
-rw-r--r--src/debug/ee/stdafx.h4
-rw-r--r--src/dlls/mscordbi/mscordbi.src2
-rw-r--r--src/dlls/mscoree/mscorwks_ntdef.src168
-rw-r--r--src/dlls/mscorrc/mscorrc.rc31
-rw-r--r--src/dlls/mscorrc/resource.h11
-rw-r--r--src/ilasm/asmman.cpp263
-rw-r--r--src/ilasm/asmman.hpp10
-rw-r--r--src/ilasm/asmtemplates.h49
-rw-r--r--src/ilasm/assem.cpp14
-rw-r--r--src/ilasm/assembler.cpp31
-rw-r--r--src/ilasm/assembler.h7
-rw-r--r--src/ilasm/grammar_after.cpp11
-rw-r--r--src/ilasm/grammar_before.cpp12
-rw-r--r--src/ilasm/main.cpp28
-rw-r--r--src/ilasm/method.cpp20
-rw-r--r--src/ilasm/writer.cpp230
-rw-r--r--src/ilasm/writer_enc.cpp59
-rw-r--r--src/ildasm/dasm.cpp48
-rw-r--r--src/inc/appxutil.h87
-rw-r--r--src/inc/clrconfigvalues.h26
-rw-r--r--src/inc/clrhost.h2
-rw-r--r--src/inc/clrinternal.idl195
-rw-r--r--src/inc/clrnt.h2
-rw-r--r--src/inc/cor.h5
-rw-r--r--src/inc/corcompile.h37
-rw-r--r--src/inc/corhost.h504
-rw-r--r--src/inc/corpolicy.h40
-rw-r--r--src/inc/corpriv.h14
-rw-r--r--src/inc/dacvars.h12
-rw-r--r--src/inc/fusionpriv.idl16
-rw-r--r--src/inc/fxretarget.h2
-rw-r--r--src/inc/holder.h5
-rw-r--r--src/inc/longfilepathwrappers.h115
-rw-r--r--src/inc/metadatatracker.h2
-rw-r--r--src/inc/palclr_win.h61
-rw-r--r--src/inc/registrywrapper.h28
-rw-r--r--src/inc/shimload.h11
-rw-r--r--src/inc/stacktrace.h2
-rw-r--r--src/inc/switches.h29
-rw-r--r--src/inc/utilcode.h250
-rw-r--r--src/inc/vptr_list.h3
-rw-r--r--src/inc/winwrap.h10
-rw-r--r--src/inc/zapper.h73
-rw-r--r--src/ipcman/ipcsharedsrc.cpp75
-rw-r--r--src/md/compiler/classfactory.cpp8
-rw-r--r--src/md/compiler/disp.cpp23
-rw-r--r--src/md/compiler/regmeta.cpp6
-rw-r--r--src/md/compiler/regmeta.h3
-rw-r--r--src/md/compiler/regmeta_vm.cpp155
-rw-r--r--src/md/enc/liteweightstgdbrw.cpp23
-rw-r--r--src/md/enc/metamodelenc.cpp25
-rw-r--r--src/md/enc/metamodelrw.cpp13
-rw-r--r--src/md/inc/metamodelrw.h4
-rw-r--r--src/md/inc/winmdinterfaces.h8
-rw-r--r--src/md/winmd/adapter.cpp2
-rw-r--r--src/md/winmd/inc/adapter.h6
-rw-r--r--src/pal/prebuilt/inc/asm_version.h7
-rw-r--r--src/pal/src/locale/utf8.cpp8
-rw-r--r--src/pal/src/misc/dbgmsg.cpp4
-rw-r--r--src/pal/src/safecrt/safecrt_output_l.cpp25
-rw-r--r--src/strongname/inc/sncoreclr.h3
-rw-r--r--src/strongname/inc/strongnameholders.h2
-rw-r--r--src/strongname/inc/strongnameinternal.h4
-rw-r--r--src/strongname/inc/thekey.h2
-rw-r--r--src/tools/crossgen/crossgen.cpp42
-rw-r--r--src/tools/metainfo/mdinfo.cpp9
-rw-r--r--src/utilcode/appxutil.cpp820
-rw-r--r--src/utilcode/ccomprc.cpp83
-rw-r--r--src/utilcode/clrhost.cpp6
-rw-r--r--src/utilcode/dlwrap.cpp152
-rw-r--r--src/utilcode/ex.cpp4
-rw-r--r--src/utilcode/longfilepathwrappers.cpp2
-rw-r--r--src/utilcode/makepath.cpp203
-rw-r--r--src/utilcode/newapis.cpp45
-rw-r--r--src/utilcode/pedecoder.cpp67
-rw-r--r--src/utilcode/registrywrapper.cpp285
-rw-r--r--src/utilcode/regutil.cpp697
-rw-r--r--src/utilcode/sortversioning.cpp244
-rw-r--r--src/utilcode/stacktrace.cpp2
-rw-r--r--src/utilcode/stresslog.cpp27
-rw-r--r--src/utilcode/util.cpp212
-rw-r--r--src/utilcode/utilmessagebox.cpp26
-rw-r--r--src/vm/appdomain.cpp908
-rw-r--r--src/vm/appdomain.hpp42
-rw-r--r--src/vm/appdomain.inl9
-rw-r--r--src/vm/appdomainnative.cpp11
-rw-r--r--src/vm/appdomainnative.hpp2
-rw-r--r--src/vm/appxutil.cpp39
-rw-r--r--src/vm/arm/stubs.cpp2
-rw-r--r--src/vm/assembly.cpp1187
-rw-r--r--src/vm/assembly.hpp74
-rw-r--r--src/vm/assemblyname.cpp53
-rw-r--r--src/vm/assemblynative.hpp40
-rw-r--r--src/vm/assemblyspec.cpp109
-rw-r--r--src/vm/assemblyspec.hpp10
-rw-r--r--src/vm/baseassemblyspec.cpp4
-rw-r--r--src/vm/baseassemblyspec.h4
-rw-r--r--src/vm/baseassemblyspec.inl50
-rw-r--r--src/vm/ceeload.cpp16
-rw-r--r--src/vm/ceeload.h6
-rw-r--r--src/vm/ceemain.cpp1045
-rw-r--r--src/vm/ceemain.h39
-rw-r--r--src/vm/class.h15
-rw-r--r--src/vm/classnames.h4
-rw-r--r--src/vm/clrprivbinderwinrt.cpp165
-rw-r--r--src/vm/clrprivbinderwinrt.h6
-rw-r--r--src/vm/clsload.cpp194
-rw-r--r--src/vm/clsload.hpp17
-rw-r--r--src/vm/clsload.inl6
-rw-r--r--src/vm/codeman.cpp39
-rw-r--r--src/vm/comcallablewrapper.cpp12
-rw-r--r--src/vm/comdelegate.cpp30
-rw-r--r--src/vm/comdelegate.h4
-rw-r--r--src/vm/comdynamic.cpp442
-rw-r--r--src/vm/comdynamic.h15
-rw-r--r--src/vm/cominterfacemarshaler.cpp12
-rw-r--r--src/vm/comisolatedstorage.cpp6
-rw-r--r--src/vm/commodule.cpp15
-rw-r--r--src/vm/commodule.h2
-rw-r--r--src/vm/common.h13
-rw-r--r--src/vm/compile.cpp680
-rw-r--r--src/vm/compile.h38
-rw-r--r--src/vm/comsynchronizable.cpp151
-rw-r--r--src/vm/comsynchronizable.h13
-rw-r--r--src/vm/comthreadpool.cpp32
-rw-r--r--src/vm/comutilnative.cpp101
-rw-r--r--src/vm/comutilnative.h34
-rw-r--r--src/vm/comwaithandle.cpp90
-rw-r--r--src/vm/coreassemblyspec.cpp99
-rw-r--r--src/vm/corhost.cpp3457
-rw-r--r--src/vm/crossgencompile.cpp2
-rw-r--r--src/vm/crst.cpp83
-rw-r--r--src/vm/dangerousapis.h14
-rw-r--r--src/vm/dataimage.cpp4
-rw-r--r--src/vm/debugdebugger.cpp61
-rw-r--r--src/vm/disassembler.h5
-rw-r--r--src/vm/dllimport.cpp643
-rw-r--r--src/vm/dllimport.h18
-rw-r--r--src/vm/domainfile.cpp329
-rw-r--r--src/vm/dwbucketmanager.hpp43
-rw-r--r--src/vm/dwreport.cpp26
-rw-r--r--src/vm/ecall.h8
-rw-r--r--src/vm/ecalllist.h238
-rw-r--r--src/vm/eeconfig.cpp376
-rw-r--r--src/vm/eeconfig.h18
-rw-r--r--src/vm/eepolicy.cpp29
-rw-r--r--src/vm/eventreporter.cpp24
-rw-r--r--src/vm/eventreporter.h2
-rw-r--r--src/vm/eventtrace.cpp43
-rw-r--r--src/vm/excep.cpp101
-rw-r--r--src/vm/excep.h2
-rw-r--r--src/vm/exceptionhandling.cpp2
-rw-r--r--src/vm/finalizerthread.cpp2
-rw-r--r--src/vm/frames.h18
-rw-r--r--src/vm/gcenv.os.cpp18
-rw-r--r--src/vm/gchost.cpp248
-rw-r--r--src/vm/hosting.cpp31
-rw-r--r--src/vm/i386/asmconstants.h5
-rw-r--r--src/vm/i386/cgencpu.h3
-rw-r--r--src/vm/i386/excepx86.cpp2
-rw-r--r--src/vm/ilmarshalers.cpp129
-rw-r--r--src/vm/ilmarshalers.h38
-rw-r--r--src/vm/ilstubcache.cpp41
-rw-r--r--src/vm/interoputil.cpp21
-rw-r--r--src/vm/invokeutil.cpp68
-rw-r--r--src/vm/jithelpers.cpp11
-rw-r--r--src/vm/jitinterface.cpp35
-rw-r--r--src/vm/jitinterface.h48
-rw-r--r--src/vm/metasig.h4
-rw-r--r--src/vm/method.cpp97
-rw-r--r--src/vm/method.hpp42
-rw-r--r--src/vm/methodtable.cpp16
-rw-r--r--src/vm/methodtable.inl8
-rw-r--r--src/vm/mlinfo.cpp81
-rw-r--r--src/vm/mlinfo.h41
-rw-r--r--src/vm/mtypes.h5
-rw-r--r--src/vm/multicorejit.cpp37
-rw-r--r--src/vm/multicorejitimpl.h12
-rw-r--r--src/vm/multicorejitplayer.cpp27
-rw-r--r--src/vm/nativeoverlapped.cpp7
-rw-r--r--src/vm/ngenoptout.cpp25
-rw-r--r--src/vm/object.cpp3
-rw-r--r--src/vm/object.h153
-rw-r--r--src/vm/olevariant.cpp6
-rw-r--r--src/vm/pefile.cpp380
-rw-r--r--src/vm/pefile.h31
-rw-r--r--src/vm/pefile.inl81
-rw-r--r--src/vm/peimage.cpp180
-rw-r--r--src/vm/peimage.h10
-rw-r--r--src/vm/peimage.inl114
-rw-r--r--src/vm/peimagelayout.cpp94
-rw-r--r--src/vm/profilinghelper.cpp43
-rw-r--r--src/vm/proftoeeinterfaceimpl.cpp16
-rw-r--r--src/vm/readytoruninfo.cpp5
-rw-r--r--src/vm/reflectclasswriter.h5
-rw-r--r--src/vm/reflectioninvocation.cpp245
-rw-r--r--src/vm/reflectioninvocation.h4
-rw-r--r--src/vm/rejit.cpp6
-rw-r--r--src/vm/rexcep.h13
-rw-r--r--src/vm/runtimecallablewrapper.cpp44
-rw-r--r--src/vm/runtimehandles.cpp44
-rw-r--r--src/vm/runtimehandles.h4
-rw-r--r--src/vm/security.cpp18
-rw-r--r--src/vm/security.h13
-rw-r--r--src/vm/security.inl35
-rw-r--r--src/vm/securitydeclarative.cpp38
-rw-r--r--src/vm/securitydescriptor.cpp152
-rw-r--r--src/vm/securitydescriptor.h26
-rw-r--r--src/vm/securitydescriptor.inl11
-rw-r--r--src/vm/securitydescriptorappdomain.cpp3
-rw-r--r--src/vm/securitydescriptorassembly.cpp9
-rw-r--r--src/vm/securitydescriptorassembly.h3
-rw-r--r--src/vm/securitymeta.cpp245
-rw-r--r--src/vm/securitymeta.h7
-rw-r--r--src/vm/securitymeta.inl41
-rw-r--r--src/vm/securitypolicy.cpp28
-rw-r--r--src/vm/securitypolicy.h3
-rw-r--r--src/vm/securitytransparentassembly.cpp314
-rw-r--r--src/vm/sha1.h4
-rw-r--r--src/vm/stdinterfaces.cpp259
-rw-r--r--src/vm/stubhelpers.cpp176
-rw-r--r--src/vm/stubhelpers.h6
-rw-r--r--src/vm/syncblk.cpp7
-rw-r--r--src/vm/threads.cpp356
-rw-r--r--src/vm/threads.h116
-rw-r--r--src/vm/threadsuspend.cpp471
-rw-r--r--src/vm/util.cpp13
-rw-r--r--src/vm/util.hpp28
-rw-r--r--src/vm/vars.cpp6
-rw-r--r--src/vm/vars.hpp15
-rw-r--r--src/zap/common.h3
-rw-r--r--src/zap/svcworker.cpp820
-rw-r--r--src/zap/zapimage.cpp99
-rw-r--r--src/zap/zapinfo.cpp29
-rw-r--r--src/zap/zapper.cpp236
255 files changed, 59 insertions, 24932 deletions
diff --git a/src/ToolBox/SOS/Strike/disasm.h b/src/ToolBox/SOS/Strike/disasm.h
index 59fc168a6e..2a2d9f7779 100644
--- a/src/ToolBox/SOS/Strike/disasm.h
+++ b/src/ToolBox/SOS/Strike/disasm.h
@@ -54,9 +54,6 @@ LPCWSTR EHTypedClauseTypeName(const DACEHInfo* pEHInfo);
struct SOSEHInfo
{
-#ifndef FEATURE_CORECLR
- __field_ecount(EHCount)
-#endif
DACEHInfo *m_pInfos;
UINT EHCount;
CLRDATA_ADDRESS methodStart;
diff --git a/src/binder/coreclrbindercommon.cpp b/src/binder/coreclrbindercommon.cpp
index 86540fcfd5..e788c15488 100644
--- a/src/binder/coreclrbindercommon.cpp
+++ b/src/binder/coreclrbindercommon.cpp
@@ -107,12 +107,8 @@ HRESULT CCoreCLRBinderHelper::BindToSystem(ICLRPrivAssembly **ppSystemAssembly,
EX_TRY
{
ReleaseHolder<BINDER_SPACE::Assembly> pAsm;
-#ifdef FEATURE_CORECLR
StackSString systemPath(SystemDomain::System()->SystemDirectory());
hr = AssemblyBinder::BindToSystem(systemPath, &pAsm, fBindToNativeImage);
-#else
- AssemblySpec::BindToSystem(&pAsm);
-#endif
if(SUCCEEDED(hr))
{
_ASSERTE(pAsm != NULL);
diff --git a/src/classlibnative/bcltype/arraynative.cpp b/src/classlibnative/bcltype/arraynative.cpp
index 0eae8b2d07..39899b80ea 100644
--- a/src/classlibnative/bcltype/arraynative.cpp
+++ b/src/classlibnative/bcltype/arraynative.cpp
@@ -1186,18 +1186,6 @@ void ArrayNative::CheckElementType(TypeHandle elementType)
// TODO: We also should check for type/member visibility here. To do that we can replace
// the following chunk of code with a simple InvokeUtil::CanAccessClass call.
// But it's too late to make this change in Dev10 and we want SL4 to be compatible with Dev10.
-#ifndef FEATURE_CORECLR
- // Make sure security allows us access to the array type - if it is critical, convert that to a
- // demand for full trust
- if (!SecurityStackWalk::HasFlagsOrFullyTrusted(0))
- {
- if (Security::TypeRequiresTransparencyCheck(pMT, true))
- {
- // If we're creating a critical type, convert the critical check into a demand for full trust
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST);
- }
- }
-#else
if (Security::TypeRequiresTransparencyCheck(pMT))
{
// The AccessCheckOptions flag doesn't matter because we just need to get the caller.
@@ -1210,7 +1198,6 @@ void ArrayNative::CheckElementType(TypeHandle elementType)
accessCheckOptions.DemandMemberAccessOrFail(&sCtx, pMT, FALSE /*visibilityCheck*/);
}
-#endif // !FEATURE_CORECLR
// Check for byref-like types.
if (pMT->IsByRefLike())
diff --git a/src/classlibnative/bcltype/number.cpp b/src/classlibnative/bcltype/number.cpp
index 3f2d63c70e..34169a77ed 100644
--- a/src/classlibnative/bcltype/number.cpp
+++ b/src/classlibnative/bcltype/number.cpp
@@ -1294,14 +1294,6 @@ STRINGREF NumberToString(NUMBER* number, wchar format, int nMaxDigits, NUMFMTREF
STRINGREF sZero=NULL;
// @TODO what if not sequential?
-#ifndef FEATURE_CORECLR
- if (numfmt->iDigitSubstitution == 2) // native digits
- {
- PTRARRAYREF aDigits = numfmt->sNativeDigits;
- if (aDigits!=NULL && aDigits->GetNumComponents()>0)
- sZero=(STRINGREF)aDigits->GetAt(0);
- }
-#endif
// Do the worst case calculation
/* US English - for Double.MinValue.ToString("C99"); we require 514 characters
@@ -2557,51 +2549,6 @@ FCIMPL3_VII(Object*, COMNumber::FormatUInt64, UINT64 value, StringObject* format
}
FCIMPLEND
-#if !defined(FEATURE_CORECLR)
-//
-// Used by base types that are not in mscorlib.dll (such as System.Numerics.BigInteger in System.Core.dll)
-// Note that the allDigits buffer must be fixed across this call or you will introduce a GC Hole.
-//
-FCIMPL4(Object*, COMNumber::FormatNumberBuffer, BYTE* number, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE, __in_z wchar_t* allDigits)
-{
- FCALL_CONTRACT;
-
- wchar fmt;
- int digits;
- NUMBER* pNumber;
-
- struct _gc
- {
- STRINGREF refFormat;
- NUMFMTREF refNumFmt;
- STRINGREF refRetString;
- } gc;
-
- gc.refFormat = ObjectToSTRINGREF(formatUNSAFE);
- gc.refNumFmt = (NUMFMTREF)numfmtUNSAFE;
- gc.refRetString = NULL;
-
- HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc);
- if (gc.refNumFmt == 0) COMPlusThrowArgumentNull(W("NumberFormatInfo"));
-
- pNumber = (NUMBER*) number;
-
- pNumber->allDigits = allDigits;
-
- fmt = ParseFormatSpecifier(gc.refFormat, &digits);
- if (fmt != 0) {
- gc.refRetString = NumberToString(pNumber, fmt, digits, gc.refNumFmt);
- }
- else {
- gc.refRetString = NumberToStringFormat(pNumber, gc.refFormat, gc.refNumFmt);
- }
- HELPER_METHOD_FRAME_END();
-
- return OBJECTREFToObject(gc.refRetString);
-}
-FCIMPLEND
-
-#endif // !FEATURE_CORECLR
FCIMPL2(FC_BOOL_RET, COMNumber::NumberBufferToDecimal, BYTE* number, DECIMAL* value)
{
diff --git a/src/classlibnative/bcltype/number.h b/src/classlibnative/bcltype/number.h
index 87bab3b9f6..db66435117 100644
--- a/src/classlibnative/bcltype/number.h
+++ b/src/classlibnative/bcltype/number.h
@@ -33,9 +33,6 @@ public:
static FCDECL3(Object*, FormatUInt32, UINT32 value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE);
static FCDECL3_VII(Object*, FormatInt64, INT64 value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE);
static FCDECL3_VII(Object*, FormatUInt64, UINT64 value, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE);
-#if !defined(FEATURE_CORECLR)
- static FCDECL4(Object*, FormatNumberBuffer, BYTE* number, StringObject* formatUNSAFE, NumberFormatInfo* numfmtUNSAFE, __in_z wchar_t* allDigits);
-#endif // !FEATURE_CORECLR
static FCDECL2(FC_BOOL_RET, NumberBufferToDecimal, BYTE* number, DECIMAL* value);
static FCDECL2(FC_BOOL_RET, NumberBufferToDouble, BYTE* number, double* value);
diff --git a/src/classlibnative/bcltype/stringnative.cpp b/src/classlibnative/bcltype/stringnative.cpp
index 1e6b132b17..af6593a6be 100644
--- a/src/classlibnative/bcltype/stringnative.cpp
+++ b/src/classlibnative/bcltype/stringnative.cpp
@@ -160,12 +160,7 @@ FCIMPLEND
inline COMNlsHashProvider * GetCurrentNlsHashProvider()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
- return curDomain->m_pNlsHashProvider;
-#else
return &COMNlsHashProvider::s_NlsHashProvider;
-#endif // FEATURE_CORECLR
}
FCIMPL3(INT32, COMString::Marvin32HashString, StringObject* thisRefUNSAFE, INT32 strLen, INT64 additionalEntropy) {
diff --git a/src/classlibnative/bcltype/system.cpp b/src/classlibnative/bcltype/system.cpp
index 8bb3409974..c1d85c45e9 100644
--- a/src/classlibnative/bcltype/system.cpp
+++ b/src/classlibnative/bcltype/system.cpp
@@ -31,9 +31,6 @@
#include "array.h"
#include "eepolicy.h"
-#if !defined(FEATURE_CORECLR)
-#include "metahost.h"
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_WINDOWSPHONE
Volatile<BOOL> g_fGetPhoneVersionInitialized;
@@ -83,20 +80,6 @@ FCIMPLEND;
-#ifndef FEATURE_CORECLR
-INT64 QCALLTYPE SystemNative::GetWorkingSet()
-{
- QCALL_CONTRACT;
-
- DWORD memUsage = 0;
-
- BEGIN_QCALL;
- memUsage = WszGetWorkingSet();
- END_QCALL;
-
- return memUsage;
-}
-#endif // !FEATURE_CORECLR
VOID QCALLTYPE SystemNative::Exit(INT32 exitcode)
{
@@ -377,24 +360,6 @@ FCIMPL0(StringObject*, SystemNative::GetHostBindingFile);
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-
-void QCALLTYPE SystemNative::_GetSystemVersion(QCall::StringHandleOnStack retVer)
-{
- QCALL_CONTRACT;
- BEGIN_QCALL;
-
- WCHAR wszVersion[_MAX_PATH];
- DWORD dwVersion = _MAX_PATH;
-
- // Get the version
- IfFailThrow(g_pCLRRuntime->GetVersionString(wszVersion, &dwVersion));
- retVer.Set(wszVersion);
-
- END_QCALL;
-}
-
-#endif
INT32 QCALLTYPE SystemNative::GetProcessorCount()
{
@@ -439,16 +404,7 @@ LPVOID QCALLTYPE SystemNative::GetRuntimeInterfaceImpl(
BEGIN_QCALL;
-#ifdef FEATURE_CORECLR
IfFailThrow(E_NOINTERFACE);
-#else
- HRESULT hr = g_pCLRRuntime->GetInterface(clsid, riid, &pUnk);
-
- if (FAILED(hr))
- hr = g_pCLRRuntime->QueryInterface(riid, &pUnk);
-
- IfFailThrow(hr);
-#endif
END_QCALL;
@@ -560,11 +516,9 @@ void SystemNative::GenericFailFast(STRINGREF refMesgString, EXCEPTIONREF refExce
#ifndef FEATURE_PAL
// If we have the exception object, then try to setup
// the watson bucket if it has any details.
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this, if required.
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
BEGIN_SO_INTOLERANT_CODE(pThread);
if ((gc.refExceptionForWatsonBucketing == NULL) || !SetupWatsonBucketsForFailFast(gc.refExceptionForWatsonBucketing))
@@ -650,34 +604,6 @@ FCIMPL2(VOID, SystemNative::FailFastWithException, StringObject* refMessageUNSAF
FCIMPLEND
-#ifndef FEATURE_CORECLR
-BOOL QCALLTYPE SystemNative::IsCLRHosted()
-{
- QCALL_CONTRACT;
-
- BOOL retVal = false;
- BEGIN_QCALL;
- retVal = (CLRHosted() & CLRHOSTED) != 0;
- END_QCALL;
-
- return retVal;
-}
-
-void QCALLTYPE SystemNative::TriggerCodeContractFailure(ContractFailureKind failureKind, LPCWSTR pMessage, LPCWSTR pCondition, LPCWSTR exceptionAsString)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- GCX_COOP();
-
- EEPolicy::HandleCodeContractFailure(pMessage, pCondition, exceptionAsString);
- // Note: if the host chose to throw an exception, we've returned from this method and
- // will throw that exception in managed code, because it's easier to pass the right parameters there.
-
- END_QCALL;
-}
-#endif // !FEATURE_CORECLR
FCIMPL0(FC_BOOL_RET, SystemNative::IsServerGC)
{
@@ -795,104 +721,7 @@ FCIMPL1(FC_BOOL_RET, SystemNative::GetOSVersionEx, OSVERSIONINFOEXObject *osVer)
FCIMPLEND
-#ifndef FEATURE_CORECLR
-//
-// SystemNative::LegacyFormatMode - Fcall implementation for System.TimeSpan.LegacyFormatMode
-// checks for the DWORD "TimeSpan_LegacyFormatMode" CLR config option
-//
-FCIMPL0(FC_BOOL_RET, SystemNative::LegacyFormatMode)
-{
- FCALL_CONTRACT;
-
- DWORD flag = 0;
-
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException));
- flag = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_TimeSpan_LegacyFormatMode);
- END_SO_INTOLERANT_CODE;
-
- if (flag)
- FC_RETURN_BOOL(TRUE);
- else
- FC_RETURN_BOOL(FALSE);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
-#ifndef FEATURE_CORECLR
-//
-// SystemNative::CheckLegacyManagedDeflateStream - Fcall implementation for System.IO.Compression.DeflateStream
-// checks for the DWORD "NetFx45_LegacyManagedDeflateStream" CLR config option
-//
-// Move this into a separate CLRConfigQCallWrapper class once CLRConfig has been refactored!
-//
-FCIMPL0(FC_BOOL_RET, SystemNative::CheckLegacyManagedDeflateStream)
-{
- FCALL_CONTRACT;
-
- DWORD flag = 0;
-
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException));
- flag = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NetFx45_LegacyManagedDeflateStream);
- END_SO_INTOLERANT_CODE;
-
- if (flag)
- FC_RETURN_BOOL(TRUE);
- else
- FC_RETURN_BOOL(FALSE);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
-
-#ifndef FEATURE_CORECLR
-//
-// SystemNative::CheckThrowUnobservedTaskExceptions - Fcall implementation for System.Threading.Tasks.TaskExceptionHolder
-// checks for the DWORD "ThrowUnobservedTaskExceptions" CLR config option
-//
-FCIMPL0(FC_BOOL_RET, SystemNative::CheckThrowUnobservedTaskExceptions)
-{
- FCALL_CONTRACT;
-
- DWORD flag = 0;
-
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), FCThrow(kStackOverflowException));
- flag = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_ThrowUnobservedTaskExceptions);
- END_SO_INTOLERANT_CODE;
-
- if (flag)
- FC_RETURN_BOOL(TRUE);
- else
- FC_RETURN_BOOL(FALSE);
-}
-FCIMPLEND
-
-BOOL QCALLTYPE SystemNative::LegacyDateTimeParseMode()
-{
- QCALL_CONTRACT;
-
- BOOL retVal = false;
- BEGIN_QCALL;
- retVal = (BOOL) CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_DateTime_NetFX35ParseMode);
- END_QCALL;
-
- return retVal;
-}
-
-//
-// This method used with DateTimeParse to fix the parsing of AM/PM like "1/10 5 AM" case
-//
-BOOL QCALLTYPE SystemNative::EnableAmPmParseAdjustment()
-{
- QCALL_CONTRACT;
-
- BOOL retVal = false;
- BEGIN_QCALL;
- retVal = (BOOL) CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_DateTime_NetFX40AmPmParseAdjustment);
- END_QCALL;
-
- return retVal;
-}
-
-#endif // !FEATURE_CORECLR
diff --git a/src/classlibnative/bcltype/system.h b/src/classlibnative/bcltype/system.h
index 9edc595039..1da105841f 100644
--- a/src/classlibnative/bcltype/system.h
+++ b/src/classlibnative/bcltype/system.h
@@ -77,10 +77,6 @@ public:
static FCDECL1(FC_BOOL_RET, GetOSVersion, OSVERSIONINFOObject *osVer);
static FCDECL1(FC_BOOL_RET, GetOSVersionEx, OSVERSIONINFOEXObject *osVer);
-#ifndef FEATURE_CORECLR
- static
- INT64 QCALLTYPE GetWorkingSet();
-#endif // !FEATURE_CORECLR
static
void QCALLTYPE Exit(INT32 exitcode);
@@ -96,10 +92,6 @@ public:
static FCDECL1(VOID, FailFast, StringObject* refMessageUNSAFE);
static FCDECL2(VOID, FailFastWithExitCode, StringObject* refMessageUNSAFE, UINT exitCode);
static FCDECL2(VOID, FailFastWithException, StringObject* refMessageUNSAFE, ExceptionObject* refExceptionUNSAFE);
-#ifndef FEATURE_CORECLR
- static void QCALLTYPE TriggerCodeContractFailure(ContractFailureKind failureKind, LPCWSTR pMessage, LPCWSTR pCondition, LPCWSTR exceptionAsText);
- static BOOL QCALLTYPE IsCLRHosted();
-#endif // !FEATURE_CORECLR
static FCDECL0(StringObject*, GetDeveloperPath);
static FCDECL1(Object*, _GetEnvironmentVariable, StringObject* strVar);
@@ -123,23 +115,10 @@ public:
// Return a method info for the method were the exception was thrown
static FCDECL1(ReflectMethodObject*, GetMethodFromStackTrace, ArrayBase* pStackTraceUNSAFE);
-#ifndef FEATURE_CORECLR
- // Functions on the System.TimeSpan class
- static FCDECL0(FC_BOOL_RET, LegacyFormatMode);
- // Function on the DateTime
- static BOOL QCALLTYPE EnableAmPmParseAdjustment();
- static BOOL QCALLTYPE LegacyDateTimeParseMode();
-#endif // !FEATURE_CORECLR
// Move this into a separate CLRConfigQCallWrapper class once CLRConfif has been refactored:
-#ifndef FEATURE_CORECLR
- static FCDECL0(FC_BOOL_RET, CheckLegacyManagedDeflateStream);
-#endif // !FEATURE_CORECLR
-#ifndef FEATURE_CORECLR
- static FCDECL0(FC_BOOL_RET, CheckThrowUnobservedTaskExceptions);
-#endif // !FEATURE_CORECLR
private:
// Common processing code for FailFast
diff --git a/src/classlibnative/inc/nlsinfo.h b/src/classlibnative/inc/nlsinfo.h
index a5dc13f9a8..173edc6d97 100644
--- a/src/classlibnative/inc/nlsinfo.h
+++ b/src/classlibnative/inc/nlsinfo.h
@@ -85,9 +85,7 @@ public:
static BOOL QCALLTYPE InternalGetSystemDefaultUILanguage(QCall::StringHandleOnStack systemDefaultUiLanguage);
// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#ifdef FEATURE_CORECLR
static FCDECL0(Object*, nativeGetResourceFallbackArray);
-#endif
//
// Native helper functions for methods in DateTimeFormatInfo
@@ -111,11 +109,6 @@ public:
static INT_PTR QCALLTYPE InternalInitSortHandle(LPCWSTR localeName, INT_PTR* handleOrigin);
static INT_PTR InitSortHandleHelper(LPCWSTR localeName, INT_PTR* handleOrigin);
static INT_PTR InternalInitOsSortHandle(LPCWSTR localeName, INT_PTR* handleOrigin);
-#ifndef FEATURE_CORECLR
- static INT_PTR InternalInitVersionedSortHandle(LPCWSTR localeName, INT_PTR* handleOrigin);
- static INT_PTR InternalInitVersionedSortHandle(LPCWSTR localeName, INT_PTR* handleOrigin, DWORD sortVersion);
- static DWORD QCALLTYPE InternalGetSortVersion();
-#endif
static BOOL QCALLTYPE InternalGetNlsVersionEx(INT_PTR handle, INT_PTR handleOrigin, LPCWSTR lpLocaleName, NLSVERSIONINFOEX * lpVersionInformation);
//
diff --git a/src/classlibnative/nls/encodingdata.cpp b/src/classlibnative/nls/encodingdata.cpp
index bf5c73fd63..c6021256be 100644
--- a/src/classlibnative/nls/encodingdata.cpp
+++ b/src/classlibnative/nls/encodingdata.cpp
@@ -17,7 +17,6 @@
//
// Please KEEP this table SORTED ALPHABETICALLY! We do a binary search on this array.
const EncodingDataItem COMNlsInfo::EncodingDataTable[] = {
-#ifdef FEATURE_CORECLR
// encoding name, codepage.
{"ANSI_X3.4-1968", 20127 },
{"ANSI_X3.4-1986", 20127 },
@@ -63,429 +62,6 @@ const EncodingDataItem COMNlsInfo::EncodingDataTable[] = {
{"x-unicode-1-1-utf-8", 65001 },
{"x-unicode-2-0-utf-7", 65000 },
{"x-unicode-2-0-utf-8", 65001 },
-#else
- // Total Items: 455
-// encoding name, codepage.
-{"437", 437},
-{"ANSI_X3.4-1968", 20127},
-{"ANSI_X3.4-1986", 20127},
-// {L"_autodetect", 50932},
-// {L"_autodetect_all", 50001},
-// {L"_autodetect_kr", 50949},
-{"arabic", 28596},
-{"ascii", 20127},
-{"ASMO-708", 708},
-{"Big5", 950},
-{"Big5-HKSCS", 950},
-{"CCSID00858", 858},
-{"CCSID00924", 20924},
-{"CCSID01140", 1140},
-{"CCSID01141", 1141},
-{"CCSID01142", 1142},
-{"CCSID01143", 1143},
-{"CCSID01144", 1144},
-{"CCSID01145", 1145},
-{"CCSID01146", 1146},
-{"CCSID01147", 1147},
-{"CCSID01148", 1148},
-{"CCSID01149", 1149},
-{"chinese", 936},
-{"cn-big5", 950},
-{"CN-GB", 936},
-{"CP00858", 858},
-{"CP00924", 20924},
-{"CP01140", 1140},
-{"CP01141", 1141},
-{"CP01142", 1142},
-{"CP01143", 1143},
-{"CP01144", 1144},
-{"CP01145", 1145},
-{"CP01146", 1146},
-{"CP01147", 1147},
-{"CP01148", 1148},
-{"CP01149", 1149},
-{"cp037", 37},
-{"cp1025", 21025},
-{"CP1026", 1026},
-{"cp1256", 1256},
-{"CP273", 20273},
-{"CP278", 20278},
-{"CP280", 20280},
-{"CP284", 20284},
-{"CP285", 20285},
-{"cp290", 20290},
-{"cp297", 20297},
-{"cp367", 20127},
-{"cp420", 20420},
-{"cp423", 20423},
-{"cp424", 20424},
-{"cp437", 437},
-{"CP500", 500},
-{"cp50227", 50227},
- //{L"cp50229", 50229},
-{"cp819", 28591},
-{"cp850", 850},
-{"cp852", 852},
-{"cp855", 855},
-{"cp857", 857},
-{"cp858", 858},
-{"cp860", 860},
-{"cp861", 861},
-{"cp862", 862},
-{"cp863", 863},
-{"cp864", 864},
-{"cp865", 865},
-{"cp866", 866},
-{"cp869", 869},
-{"CP870", 870},
-{"CP871", 20871},
-{"cp875", 875},
-{"cp880", 20880},
-{"CP905", 20905},
-//{L"cp930", 50930},
-//{L"cp933", 50933},
-//{L"cp935", 50935},
-//{L"cp937", 50937},
-//{L"cp939", 50939},
-{"csASCII", 20127},
-{"csbig5", 950},
-{"csEUCKR", 51949},
-{"csEUCPkdFmtJapanese", 51932},
-{"csGB2312", 936},
-{"csGB231280", 936},
-{"csIBM037", 37},
-{"csIBM1026", 1026},
-{"csIBM273", 20273},
-{"csIBM277", 20277},
-{"csIBM278", 20278},
-{"csIBM280", 20280},
-{"csIBM284", 20284},
-{"csIBM285", 20285},
-{"csIBM290", 20290},
-{"csIBM297", 20297},
-{"csIBM420", 20420},
-{"csIBM423", 20423},
-{"csIBM424", 20424},
-{"csIBM500", 500},
-{"csIBM870", 870},
-{"csIBM871", 20871},
-{"csIBM880", 20880},
-{"csIBM905", 20905},
-{"csIBMThai", 20838},
-{"csISO2022JP", 50221},
-{"csISO2022KR", 50225},
-{"csISO58GB231280", 936},
-{"csISOLatin1", 28591},
-{"csISOLatin2", 28592},
-{"csISOLatin3", 28593},
-{"csISOLatin4", 28594},
-{"csISOLatin5", 28599},
-{"csISOLatin9", 28605},
-{"csISOLatinArabic", 28596},
-{"csISOLatinCyrillic", 28595},
-{"csISOLatinGreek", 28597},
-{"csISOLatinHebrew", 28598},
-{"csKOI8R", 20866},
-{"csKSC56011987", 949},
-{"csPC8CodePage437", 437},
-{"csShiftJIS", 932},
-{"csUnicode11UTF7", 65000},
-{"csWindows31J", 932},
-{"cyrillic", 28595},
-{"DIN_66003", 20106},
-{"DOS-720", 720},
-{"DOS-862", 862},
-{"DOS-874", 874},
-{"ebcdic-cp-ar1", 20420},
-{"ebcdic-cp-be", 500},
-{"ebcdic-cp-ca", 37},
-{"ebcdic-cp-ch", 500},
-{"EBCDIC-CP-DK", 20277},
-{"ebcdic-cp-es", 20284},
-{"ebcdic-cp-fi", 20278},
-{"ebcdic-cp-fr", 20297},
-{"ebcdic-cp-gb", 20285},
-{"ebcdic-cp-gr", 20423},
-{"ebcdic-cp-he", 20424},
-{"ebcdic-cp-is", 20871},
-{"ebcdic-cp-it", 20280},
-{"ebcdic-cp-nl", 37},
-{"EBCDIC-CP-NO", 20277},
-{"ebcdic-cp-roece", 870},
-{"ebcdic-cp-se", 20278},
-{"ebcdic-cp-tr", 20905},
-{"ebcdic-cp-us", 37},
-{"ebcdic-cp-wt", 37},
-{"ebcdic-cp-yu", 870},
-{"EBCDIC-Cyrillic", 20880},
-{"ebcdic-de-273+euro", 1141},
-{"ebcdic-dk-277+euro", 1142},
-{"ebcdic-es-284+euro", 1145},
-{"ebcdic-fi-278+euro", 1143},
-{"ebcdic-fr-297+euro", 1147},
-{"ebcdic-gb-285+euro", 1146},
-{"ebcdic-international-500+euro", 1148},
-{"ebcdic-is-871+euro", 1149},
-{"ebcdic-it-280+euro", 1144},
-{"EBCDIC-JP-kana", 20290},
-{"ebcdic-Latin9--euro", 20924},
-{"ebcdic-no-277+euro", 1142},
-{"ebcdic-se-278+euro", 1143},
-{"ebcdic-us-37+euro", 1140},
-{"ECMA-114", 28596},
-{"ECMA-118", 28597},
-{"ELOT_928", 28597},
-{"euc-cn", 51936},
-{"euc-jp", 51932},
-{"euc-kr", 51949},
-{"Extended_UNIX_Code_Packed_Format_for_Japanese", 51932},
-{"GB18030", 54936},
-{"GB2312", 936},
-{"GB2312-80", 936},
-{"GB231280", 936},
-{"GBK", 936},
-{"GB_2312-80", 936},
-{"German", 20106},
-{"greek", 28597},
-{"greek8", 28597},
-{"hebrew", 28598},
-{"hz-gb-2312", 52936},
-{"IBM-Thai", 20838},
-{"IBM00858", 858},
-{"IBM00924", 20924},
-{"IBM01047", 1047},
-{"IBM01140", 1140},
-{"IBM01141", 1141},
-{"IBM01142", 1142},
-{"IBM01143", 1143},
-{"IBM01144", 1144},
-{"IBM01145", 1145},
-{"IBM01146", 1146},
-{"IBM01147", 1147},
-{"IBM01148", 1148},
-{"IBM01149", 1149},
-{"IBM037", 37},
-{"IBM1026", 1026},
-{"IBM273", 20273},
-{"IBM277", 20277},
-{"IBM278", 20278},
-{"IBM280", 20280},
-{"IBM284", 20284},
-{"IBM285", 20285},
-{"IBM290", 20290},
-{"IBM297", 20297},
-{"IBM367", 20127},
-{"IBM420", 20420},
-{"IBM423", 20423},
-{"IBM424", 20424},
-{"IBM437", 437},
-{"IBM500", 500},
-{"ibm737", 737},
-{"ibm775", 775},
-{"ibm819", 28591},
-{"IBM850", 850},
-{"IBM852", 852},
-{"IBM855", 855},
-{"IBM857", 857},
-{"IBM860", 860},
-{"IBM861", 861},
-{"IBM862", 862},
-{"IBM863", 863},
-{"IBM864", 864},
-{"IBM865", 865},
-{"IBM866", 866},
-{"IBM869", 869},
-{"IBM870", 870},
-{"IBM871", 20871},
-{"IBM880", 20880},
-{"IBM905", 20905},
-{"irv", 20105},
-{"ISO-10646-UCS-2", 1200},
-{"iso-2022-jp", 50220},
-{"iso-2022-jpeuc", 51932},
-{"iso-2022-kr", 50225},
-{"iso-2022-kr-7", 50225},
-{"iso-2022-kr-7bit", 50225},
-{"iso-2022-kr-8", 51949},
-{"iso-2022-kr-8bit", 51949},
-{"iso-8859-1", 28591},
-{"iso-8859-11", 874},
-{"iso-8859-13", 28603},
-{"iso-8859-15", 28605},
-{"iso-8859-2", 28592},
-{"iso-8859-3", 28593},
-{"iso-8859-4", 28594},
-{"iso-8859-5", 28595},
-{"iso-8859-6", 28596},
-{"iso-8859-7", 28597},
-{"iso-8859-8", 28598},
-{"ISO-8859-8 Visual", 28598},
-{"iso-8859-8-i", 38598},
-{"iso-8859-9", 28599},
-{"iso-ir-100", 28591},
-{"iso-ir-101", 28592},
-{"iso-ir-109", 28593},
-{"iso-ir-110", 28594},
-{"iso-ir-126", 28597},
-{"iso-ir-127", 28596},
-{"iso-ir-138", 28598},
-{"iso-ir-144", 28595},
-{"iso-ir-148", 28599},
-{"iso-ir-149", 949},
-{"iso-ir-58", 936},
-{"iso-ir-6", 20127},
-{"ISO646-US", 20127},
-{"iso8859-1", 28591},
-{"iso8859-2", 28592},
-{"ISO_646.irv:1991", 20127},
-{"iso_8859-1", 28591},
-{"ISO_8859-15", 28605},
-{"iso_8859-1:1987", 28591},
-{"iso_8859-2", 28592},
-{"iso_8859-2:1987", 28592},
-{"ISO_8859-3", 28593},
-{"ISO_8859-3:1988", 28593},
-{"ISO_8859-4", 28594},
-{"ISO_8859-4:1988", 28594},
-{"ISO_8859-5", 28595},
-{"ISO_8859-5:1988", 28595},
-{"ISO_8859-6", 28596},
-{"ISO_8859-6:1987", 28596},
-{"ISO_8859-7", 28597},
-{"ISO_8859-7:1987", 28597},
-{"ISO_8859-8", 28598},
-{"ISO_8859-8:1988", 28598},
-{"ISO_8859-9", 28599},
-{"ISO_8859-9:1989", 28599},
-{"Johab", 1361},
-{"koi", 20866},
-{"koi8", 20866},
-{"koi8-r", 20866},
-{"koi8-ru", 21866},
-{"koi8-u", 21866},
-{"koi8r", 20866},
-{"korean", 949},
-{"ks-c-5601", 949},
-{"ks-c5601", 949},
-{"KSC5601", 949},
-{"KSC_5601", 949},
-{"ks_c_5601", 949},
-{"ks_c_5601-1987", 949},
-{"ks_c_5601-1989", 949},
-{"ks_c_5601_1987", 949},
-{"l1", 28591},
-{"l2", 28592},
-{"l3", 28593},
-{"l4", 28594},
-{"l5", 28599},
-{"l9", 28605},
-{"latin1", 28591},
-{"latin2", 28592},
-{"latin3", 28593},
-{"latin4", 28594},
-{"latin5", 28599},
-{"latin9", 28605},
-{"logical", 28598},
-{"macintosh", 10000},
-{"ms_Kanji", 932},
-{"Norwegian", 20108},
-{"NS_4551-1", 20108},
-{"PC-Multilingual-850+euro", 858},
-{"SEN_850200_B", 20107},
-{"shift-jis", 932},
-{"shift_jis", 932},
-{"sjis", 932},
-{"Swedish", 20107},
-{"TIS-620", 874},
-{"ucs-2", 1200},
-{"unicode", 1200},
-{"unicode-1-1-utf-7", 65000},
-{"unicode-1-1-utf-8", 65001},
-{"unicode-2-0-utf-7", 65000},
-{"unicode-2-0-utf-8", 65001},
-// People get confused about the FFFE here. We can't change this because it'd break existing apps.
-// This has been this way for a long time, including in Mlang.
-{"unicodeFFFE", 1201}, // Big Endian, BOM seems backwards, think of the BOM in little endian order.
-{"us", 20127},
-{"us-ascii", 20127},
-{"utf-16", 1200},
-{"UTF-16BE", 1201},
-{"UTF-16LE", 1200},
-{"utf-32", 12000},
-{"UTF-32BE", 12001},
-{"UTF-32LE", 12000},
-{"utf-7", 65000},
-{"utf-8", 65001},
-{"visual", 28598},
-{"windows-1250", 1250},
-{"windows-1251", 1251},
-{"windows-1252", 1252},
-{"windows-1253", 1253},
-{"Windows-1254", 1254},
-{"windows-1255", 1255},
-{"windows-1256", 1256},
-{"windows-1257", 1257},
-{"windows-1258", 1258},
-{"windows-874", 874},
-{"x-ansi", 1252},
-{"x-Chinese-CNS", 20000},
-{"x-Chinese-Eten", 20002},
-{"x-cp1250", 1250},
-{"x-cp1251", 1251},
-{"x-cp20001", 20001},
-{"x-cp20003", 20003},
-{"x-cp20004", 20004},
-{"x-cp20005", 20005},
-{"x-cp20261", 20261},
-{"x-cp20269", 20269},
-{"x-cp20936", 20936},
-{"x-cp20949", 20949},
-{"x-cp50227", 50227},
-//{L"x-cp50229", 50229},
-//{L"X-EBCDIC-JapaneseAndUSCanada", 50931},
-{"X-EBCDIC-KoreanExtended", 20833},
-{"x-euc", 51932},
-{"x-euc-cn", 51936},
-{"x-euc-jp", 51932},
-{"x-Europa", 29001},
-{"x-IA5", 20105},
-{"x-IA5-German", 20106},
-{"x-IA5-Norwegian", 20108},
-{"x-IA5-Swedish", 20107},
-{"x-iscii-as", 57006},
-{"x-iscii-be", 57003},
-{"x-iscii-de", 57002},
-{"x-iscii-gu", 57010},
-{"x-iscii-ka", 57008},
-{"x-iscii-ma", 57009},
-{"x-iscii-or", 57007},
-{"x-iscii-pa", 57011},
-{"x-iscii-ta", 57004},
-{"x-iscii-te", 57005},
-{"x-mac-arabic", 10004},
-{"x-mac-ce", 10029},
-{"x-mac-chinesesimp", 10008},
-{"x-mac-chinesetrad", 10002},
-{"x-mac-croatian", 10082},
-{"x-mac-cyrillic", 10007},
-{"x-mac-greek", 10006},
-{"x-mac-hebrew", 10005},
-{"x-mac-icelandic", 10079},
-{"x-mac-japanese", 10001},
-{"x-mac-korean", 10003},
-{"x-mac-romanian", 10010},
-{"x-mac-thai", 10021},
-{"x-mac-turkish", 10081},
-{"x-mac-ukrainian", 10017},
-{"x-ms-cp932", 932},
-{"x-sjis", 932},
-{"x-unicode-1-1-utf-7", 65000},
-{"x-unicode-1-1-utf-8", 65001},
-{"x-unicode-2-0-utf-7", 65000},
-{"x-unicode-2-0-utf-8", 65001},
-{"x-x-big5", 950},
-
-#endif // FEATURE_CORECLR
};
@@ -503,7 +79,6 @@ const int COMNlsInfo::m_nEncodingDataTableItems =
//
const CodePageDataItem COMNlsInfo::CodePageDataTable[] = {
-#ifdef FEATURE_CORECLR
// Total Items:
// code page, family code page, web name, header name, body name, flags
@@ -517,160 +92,6 @@ const CodePageDataItem COMNlsInfo::CodePageDataTable[] = {
MapCodePageDataItem( 65000, 1200, "utf-7", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Unicode (UTF-7)"
MapCodePageDataItem( 65001, 1200, "utf-8", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Unicode (UTF-8)"
-#else //FEATURE_CORECLR
-
-// Total Items: 146
-// code page, family code page, web name, header name, body name, flags
-
-
- MapCodePageDataItem( 37, 1252, "IBM037", 0), // "IBM EBCDIC (US-Canada)"
- MapCodePageDataItem( 437, 1252, "IBM437", 0), // "OEM United States"
- MapCodePageDataItem( 500, 1252, "IBM500", 0), // "IBM EBCDIC (International)"
- MapCodePageDataItem( 708, 1256, "ASMO-708", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (ASMO 708)"
- MapCodePageDataItem( 720, 1256, "DOS-720", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (DOS)"
- MapCodePageDataItem( 737, 1253, "ibm737", 0), // "Greek (DOS)"
- MapCodePageDataItem( 775, 1257, "ibm775", 0), // "Baltic (DOS)"
- MapCodePageDataItem( 850, 1252, "ibm850", 0), // "Western European (DOS)"
- MapCodePageDataItem( 852, 1250, "ibm852", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Central European (DOS)"
- MapCodePageDataItem( 855, 1252, "IBM855", 0), // "OEM Cyrillic"
- MapCodePageDataItem( 857, 1254, "ibm857", 0), // "Turkish (DOS)"
- MapCodePageDataItem( 858, 1252, "IBM00858", 0), // "OEM Multilingual Latin I"
- MapCodePageDataItem( 860, 1252, "IBM860", 0), // "Portuguese (DOS)"
- MapCodePageDataItem( 861, 1252, "ibm861", 0), // "Icelandic (DOS)"
- MapCodePageDataItem( 862, 1255, "DOS-862", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (DOS)"
- MapCodePageDataItem( 863, 1252, "IBM863", 0), // "French Canadian (DOS)"
- MapCodePageDataItem( 864, 1256, "IBM864", 0), // "Arabic (864)"
- MapCodePageDataItem( 865, 1252, "IBM865", 0), // "Nordic (DOS)"
- MapCodePageDataItem( 866, 1251, "cp866", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (DOS)"
- MapCodePageDataItem( 869, 1253, "ibm869", 0), // "Greek, Modern (DOS)"
- MapCodePageDataItem( 870, 1250, "IBM870", 0), // "IBM EBCDIC (Multilingual Latin-2)"
- MapCodePageDataItem( 874, 874, "windows-874", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Thai (Windows)"
- MapCodePageDataItem( 875, 1253, "cp875", 0), // "IBM EBCDIC (Greek Modern)"
- MapCodePageDataItem( 932, 932, "|shift_jis|iso-2022-jp|iso-2022-jp", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Japanese (Shift-JIS)"
- MapCodePageDataItem( 936, 936, "gb2312", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Simplified (GB2312)"
- MapCodePageDataItem( 949, 949, "ks_c_5601-1987", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Korean"
- MapCodePageDataItem( 950, 950, "big5", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Traditional (Big5)"
- MapCodePageDataItem( 1026, 1254, "IBM1026", 0), // "IBM EBCDIC (Turkish Latin-5)"
- MapCodePageDataItem( 1047, 1252, "IBM01047", 0), // "IBM Latin-1"
- MapCodePageDataItem( 1140, 1252, "IBM01140", 0), // "IBM EBCDIC (US-Canada-Euro)"
- MapCodePageDataItem( 1141, 1252, "IBM01141", 0), // "IBM EBCDIC (Germany-Euro)"
- MapCodePageDataItem( 1142, 1252, "IBM01142", 0), // "IBM EBCDIC (Denmark-Norway-Euro)"
- MapCodePageDataItem( 1143, 1252, "IBM01143", 0), // "IBM EBCDIC (Finland-Sweden-Euro)"
- MapCodePageDataItem( 1144, 1252, "IBM01144", 0), // "IBM EBCDIC (Italy-Euro)"
- MapCodePageDataItem( 1145, 1252, "IBM01145", 0), // "IBM EBCDIC (Spain-Euro)"
- MapCodePageDataItem( 1146, 1252, "IBM01146", 0), // "IBM EBCDIC (UK-Euro)"
- MapCodePageDataItem( 1147, 1252, "IBM01147", 0), // "IBM EBCDIC (France-Euro)"
- MapCodePageDataItem( 1148, 1252, "IBM01148", 0), // "IBM EBCDIC (International-Euro)"
- MapCodePageDataItem( 1149, 1252, "IBM01149", 0), // "IBM EBCDIC (Icelandic-Euro)"
- MapCodePageDataItem( 1200, 1200, "utf-16", MIMECONTF_SAVABLE_BROWSER), // "Unicode"
- MapCodePageDataItem( 1201, 1200, "utf-16BE", 0), // Big Endian, old FFFE BOM seems backwards, think of the BOM in little endian order.
- MapCodePageDataItem( 1250, 1250, "|windows-1250|windows-1250|iso-8859-2", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Central European (Windows)"
- MapCodePageDataItem( 1251, 1251, "|windows-1251|windows-1251|koi8-r", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (Windows)"
- MapCodePageDataItem( 1252, 1252, "|Windows-1252|Windows-1252|iso-8859-1", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Western European (Windows)"
- MapCodePageDataItem( 1253, 1253, "|windows-1253|windows-1253|iso-8859-7", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Greek (Windows)"
- MapCodePageDataItem( 1254, 1254, "|windows-1254|windows-1254|iso-8859-9", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Turkish (Windows)"
- MapCodePageDataItem( 1255, 1255, "windows-1255", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (Windows)"
- MapCodePageDataItem( 1256, 1256, "windows-1256", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Arabic (Windows)"
- MapCodePageDataItem( 1257, 1257, "windows-1257", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Baltic (Windows)"
- MapCodePageDataItem( 1258, 1258, "windows-1258", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Vietnamese (Windows)"
- MapCodePageDataItem( 1361, 949, "Johab", 0), // "Korean (Johab)"
- MapCodePageDataItem( 10000, 1252, "macintosh", 0), // "Western European (Mac)"
- MapCodePageDataItem( 10001, 932, "x-mac-japanese", 0), // "Japanese (Mac)"
- MapCodePageDataItem( 10002, 950, "x-mac-chinesetrad", 0), // "Chinese Traditional (Mac)"
- MapCodePageDataItem( 10003, 949, "x-mac-korean", 0), // "Korean (Mac)"
- MapCodePageDataItem( 10004, 1256, "x-mac-arabic", 0), // "Arabic (Mac)"
- MapCodePageDataItem( 10005, 1255, "x-mac-hebrew", 0), // "Hebrew (Mac)"
- MapCodePageDataItem( 10006, 1253, "x-mac-greek", 0), // "Greek (Mac)"
- MapCodePageDataItem( 10007, 1251, "x-mac-cyrillic", 0), // "Cyrillic (Mac)"
- MapCodePageDataItem( 10008, 936, "x-mac-chinesesimp", 0), // "Chinese Simplified (Mac)"
- MapCodePageDataItem( 10010, 1250, "x-mac-romanian", 0), // "Romanian (Mac)"
- MapCodePageDataItem( 10017, 1251, "x-mac-ukrainian", 0), // "Ukrainian (Mac)"
- MapCodePageDataItem( 10021, 874, "x-mac-thai", 0), // "Thai (Mac)"
- MapCodePageDataItem( 10029, 1250, "x-mac-ce", 0), // "Central European (Mac)"
- MapCodePageDataItem( 10079, 1252, "x-mac-icelandic", 0), // "Icelandic (Mac)"
- MapCodePageDataItem( 10081, 1254, "x-mac-turkish", 0), // "Turkish (Mac)"
- MapCodePageDataItem( 10082, 1250, "x-mac-croatian", 0), // "Croatian (Mac)"
- MapCodePageDataItem( 12000, 1200, "utf-32", 0), // "Unicode (UTF-32)"
- MapCodePageDataItem( 12001, 1200, "utf-32BE", 0), // "Unicode (UTF-32 Big Endian)"
- MapCodePageDataItem( 20000, 950, "x-Chinese-CNS", 0), // "Chinese Traditional (CNS)"
- MapCodePageDataItem( 20001, 950, "x-cp20001", 0), // "TCA Taiwan"
- MapCodePageDataItem( 20002, 950, "x-Chinese-Eten", 0), // "Chinese Traditional (Eten)"
- MapCodePageDataItem( 20003, 950, "x-cp20003", 0), // "IBM5550 Taiwan"
- MapCodePageDataItem( 20004, 950, "x-cp20004", 0), // "TeleText Taiwan"
- MapCodePageDataItem( 20005, 950, "x-cp20005", 0), // "Wang Taiwan"
- MapCodePageDataItem( 20105, 1252, "x-IA5", 0), // "Western European (IA5)"
- MapCodePageDataItem( 20106, 1252, "x-IA5-German", 0), // "German (IA5)"
- MapCodePageDataItem( 20107, 1252, "x-IA5-Swedish", 0), // "Swedish (IA5)"
- MapCodePageDataItem( 20108, 1252, "x-IA5-Norwegian", 0), // "Norwegian (IA5)"
- MapCodePageDataItem( 20127, 1252, "us-ascii", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "US-ASCII"
- MapCodePageDataItem( 20261, 1252, "x-cp20261", 0), // "T.61"
- MapCodePageDataItem( 20269, 1252, "x-cp20269", 0), // "ISO-6937"
- MapCodePageDataItem( 20273, 1252, "IBM273", 0), // "IBM EBCDIC (Germany)"
- MapCodePageDataItem( 20277, 1252, "IBM277", 0), // "IBM EBCDIC (Denmark-Norway)"
- MapCodePageDataItem( 20278, 1252, "IBM278", 0), // "IBM EBCDIC (Finland-Sweden)"
- MapCodePageDataItem( 20280, 1252, "IBM280", 0), // "IBM EBCDIC (Italy)"
- MapCodePageDataItem( 20284, 1252, "IBM284", 0), // "IBM EBCDIC (Spain)"
- MapCodePageDataItem( 20285, 1252, "IBM285", 0), // "IBM EBCDIC (UK)"
- MapCodePageDataItem( 20290, 932, "IBM290", 0), // "IBM EBCDIC (Japanese katakana)"
- MapCodePageDataItem( 20297, 1252, "IBM297", 0), // "IBM EBCDIC (France)"
- MapCodePageDataItem( 20420, 1256, "IBM420", 0), // "IBM EBCDIC (Arabic)"
- MapCodePageDataItem( 20423, 1253, "IBM423", 0), // "IBM EBCDIC (Greek)"
- MapCodePageDataItem( 20424, 1255, "IBM424", 0), // "IBM EBCDIC (Hebrew)"
- MapCodePageDataItem( 20833, 949, "x-EBCDIC-KoreanExtended", 0), // "IBM EBCDIC (Korean Extended)"
- MapCodePageDataItem( 20838, 874, "IBM-Thai", 0), // "IBM EBCDIC (Thai)"
- MapCodePageDataItem( 20866, 1251, "koi8-r", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (KOI8-R)"
- MapCodePageDataItem( 20871, 1252, "IBM871", 0), // "IBM EBCDIC (Icelandic)"
- MapCodePageDataItem( 20880, 1251, "IBM880", 0), // "IBM EBCDIC (Cyrillic Russian)"
- MapCodePageDataItem( 20905, 1254, "IBM905", 0), // "IBM EBCDIC (Turkish)"
- MapCodePageDataItem( 20924, 1252, "IBM00924", 0), // "IBM Latin-1"
- MapCodePageDataItem( 20932, 932, "EUC-JP", 0), // "Japanese (JIS 0208-1990 and 0212-1990)"
- MapCodePageDataItem( 20936, 936, "x-cp20936", 0), // "Chinese Simplified (GB2312-80)"
- MapCodePageDataItem( 20949, 949, "x-cp20949", 0), // "Korean Wansung"
- MapCodePageDataItem( 21025, 1251, "cp1025", 0), // "IBM EBCDIC (Cyrillic Serbian-Bulgarian)"
- MapCodePageDataItem( 21866, 1251, "koi8-u", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (KOI8-U)"
- MapCodePageDataItem( 28591, 1252, "iso-8859-1", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Western European (ISO)"
- MapCodePageDataItem( 28592, 1250, "iso-8859-2", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Central European (ISO)"
- MapCodePageDataItem( 28593, 1254, "iso-8859-3", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Latin 3 (ISO)"
- MapCodePageDataItem( 28594, 1257, "iso-8859-4", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Baltic (ISO)"
- MapCodePageDataItem( 28595, 1251, "iso-8859-5", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Cyrillic (ISO)"
- MapCodePageDataItem( 28596, 1256, "iso-8859-6", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Arabic (ISO)"
- MapCodePageDataItem( 28597, 1253, "iso-8859-7", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Greek (ISO)"
- MapCodePageDataItem( 28598, 1255, "iso-8859-8", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (ISO-Visual)"
- MapCodePageDataItem( 28599, 1254, "iso-8859-9", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Turkish (ISO)"
- MapCodePageDataItem( 28603, 1257, "iso-8859-13", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Estonian (ISO)"
- MapCodePageDataItem( 28605, 1252, "iso-8859-15", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Latin 9 (ISO)"
- MapCodePageDataItem( 29001, 1252, "x-Europa", 0), // "Europa"
- MapCodePageDataItem( 38598, 1255, "iso-8859-8-i", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Hebrew (ISO-Logical)"
- MapCodePageDataItem( 50220, 932, "iso-2022-jp", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Japanese (JIS)"
- MapCodePageDataItem( 50221, 932, "|csISO2022JP|iso-2022-jp|iso-2022-jp", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Japanese (JIS-Allow 1 byte Kana)"
- MapCodePageDataItem( 50222, 932, "iso-2022-jp", 0), // "Japanese (JIS-Allow 1 byte Kana - SO/SI)"
- MapCodePageDataItem( 50225, 949, "|iso-2022-kr|euc-kr|iso-2022-kr", MIMECONTF_MAILNEWS), // "Korean (ISO)"
- MapCodePageDataItem( 50227, 936, "x-cp50227", 0), // "Chinese Simplified (ISO-2022)"
-//MapCodePageDataItem( 50229, 950, L"x-cp50229", L"x-cp50229", L"x-cp50229", 0}, // "Chinese Traditional (ISO-2022)"
-//MapCodePageDataItem( 50930, 932, L"cp930", L"cp930", L"cp930", 0}, // "IBM EBCDIC (Japanese and Japanese Katakana)"
-//MapCodePageDataItem( 50931, 932, L"x-EBCDIC-JapaneseAndUSCanada", L"x-EBCDIC-JapaneseAndUSCanada", L"x-EBCDIC-JapaneseAndUSCanada", 0}, // "IBM EBCDIC (Japanese and US-Canada)"
-//MapCodePageDataItem( 50933, 949, L"cp933", L"cp933", L"cp933", 0}, // "IBM EBCDIC (Korean and Korean Extended)"
-//MapCodePageDataItem( 50935, 936, L"cp935", L"cp935", L"cp935", 0}, // "IBM EBCDIC (Simplified Chinese)"
-//MapCodePageDataItem( 50937, 950, L"cp937", L"cp937", L"cp937", 0}, // "IBM EBCDIC (Traditional Chinese)"
-//MapCodePageDataItem( 50939, 932, L"cp939", L"cp939", L"cp939", 0}, // "IBM EBCDIC (Japanese and Japanese-Latin)"
- MapCodePageDataItem( 51932, 932, "euc-jp", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Japanese (EUC)"
- MapCodePageDataItem( 51936, 936, "EUC-CN", 0), // "Chinese Simplified (EUC)"
- MapCodePageDataItem( 51949, 949, "euc-kr", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Korean (EUC)"
- MapCodePageDataItem( 52936, 936, "hz-gb-2312", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Simplified (HZ)"
- MapCodePageDataItem( 54936, 936, "GB18030", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Chinese Simplified (GB18030)"
- MapCodePageDataItem( 57002, 57002, "x-iscii-de", 0), // "ISCII Devanagari"
- MapCodePageDataItem( 57003, 57003, "x-iscii-be", 0), // "ISCII Bengali"
- MapCodePageDataItem( 57004, 57004, "x-iscii-ta", 0), // "ISCII Tamil"
- MapCodePageDataItem( 57005, 57005, "x-iscii-te", 0), // "ISCII Telugu"
- MapCodePageDataItem( 57006, 57006, "x-iscii-as", 0), // "ISCII Assamese"
- MapCodePageDataItem( 57007, 57007, "x-iscii-or", 0), // "ISCII Oriya"
- MapCodePageDataItem( 57008, 57008, "x-iscii-ka", 0), // "ISCII Kannada"
- MapCodePageDataItem( 57009, 57009, "x-iscii-ma", 0), // "ISCII Malayalam"
- MapCodePageDataItem( 57010, 57010, "x-iscii-gu", 0), // "ISCII Gujarati"
- MapCodePageDataItem( 57011, 57011, "x-iscii-pa", 0), // "ISCII Punjabi"
- MapCodePageDataItem( 65000, 1200, "utf-7", MIMECONTF_MAILNEWS | MIMECONTF_SAVABLE_MAILNEWS), // "Unicode (UTF-7)"
- MapCodePageDataItem( 65001, 1200, "utf-8", MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER), // "Unicode (UTF-8)"
-#endif // FEATURE_CORECLR
// End of data.
MapCodePageDataItem( 0, 0, NULL, 0),
diff --git a/src/classlibnative/nls/nlsinfo.cpp b/src/classlibnative/nls/nlsinfo.cpp
index d24e4b02d6..4a4c294551 100644
--- a/src/classlibnative/nls/nlsinfo.cpp
+++ b/src/classlibnative/nls/nlsinfo.cpp
@@ -218,20 +218,6 @@ BOOL QCALLTYPE COMNlsInfo::InternalIsSortable(INT_PTR handle, INT_PTR handleOrig
BOOL result = FALSE;
BEGIN_QCALL;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- if(!(curDomain->m_bUseOsSorting))
- {
- handle = EnsureValidSortHandle(handle, handleOrigin, localeName);
- result = SortVersioning::SortDllIsDefinedString((SortVersioning::PSORTHANDLE) handle, COMPARE_STRING, 0, string, length);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- result = (curDomain->m_pCustomSortLibrary->pIsNLSDefinedString)(COMPARE_STRING, 0, NULL, string, length);
- }
- else
-#endif
{
// Function should be COMPARE_STRING, dwFlags should be NULL, lpVersionInfo should be NULL for now
result = NewApis::IsNLSDefinedString(COMPARE_STRING, 0, NULL, string, length);
@@ -389,7 +375,6 @@ BOOL QCALLTYPE COMNlsInfo::InternalGetUserDefaultUILanguage(QCall::StringHandleO
}
// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#ifdef FEATURE_CORECLR
FCIMPL0(Object*, COMNlsInfo::nativeGetResourceFallbackArray)
{
CONTRACTL
@@ -452,7 +437,6 @@ FCIMPL0(Object*, COMNlsInfo::nativeGetResourceFallbackArray)
}
FCIMPLEND
-#endif // FEATURE_CORECLR
INT32 COMNlsInfo::CallGetUserDefaultUILanguage()
{
@@ -492,31 +476,8 @@ INT_PTR COMNlsInfo::EnsureValidSortHandle(INT_PTR handle, INT_PTR handleOrigin,
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- if(!(curDomain->m_bUseOsSorting) && handleOrigin == (INT_PTR) SortVersioning::GetSortHandle && ((SortVersioning::PSORTHANDLE) handle)->dwNLSVersion == curDomain->m_sortVersion)
- {
- return handle;
- }
-
- if(curDomain->m_bUseOsSorting && curDomain->m_pCustomSortLibrary == NULL && handleOrigin == (INT_PTR) NewApis::LCMapStringEx)
- {
- return handle;
- }
-
- if(curDomain->m_bUseOsSorting && curDomain->m_pCustomSortLibrary != NULL && handleOrigin == (INT_PTR) curDomain->m_pCustomSortLibrary->pLCMapStringEx)
- {
- return handle;
- }
-
- // At this point, we can't reuse the sort handle (it has different sort semantics than this domain) so we need to get a new one.
- INT_PTR newHandleOrigin;
- return InitSortHandleHelper(localeName, &newHandleOrigin);
-#else
// For CoreCLR, on Windows 8 and up the handle will be valid. on downlevels the handle will be null
return handle;
-#endif
}
#ifdef FEATURE_SYNTHETIC_CULTURES
@@ -569,45 +530,6 @@ INT32 COMNlsInfo::WstrToInteger4(
#endif // FEATURE_SYNTHETIC_CULTURES
-#ifndef FEATURE_CORECLR
-FCIMPL1(FC_BOOL_RET, COMNlsInfo::nativeSetThreadLocale, StringObject* localeNameUNSAFE)
-{
- CONTRACTL
- {
- FCALL_CHECK;
- PRECONDITION(CheckPointer(localeNameUNSAFE));
- } CONTRACTL_END;
-
- LCID lcid = 0;
-
- // TODO: NLS Arrowhead -A bit scary becausue Set ThreadLocale can't handle custom cultures?
- STRINGREF localeName = (STRINGREF)localeNameUNSAFE;
- HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(localeName);
- lcid=NewApis::LocaleNameToLCID(localeName->GetBuffer(),0);
- if (lcid == 0)
- {
- ThrowHR(HRESULT_FROM_WIN32(GetLastError()));
- }
- HELPER_METHOD_FRAME_END();
-
-
- BOOL result = TRUE;
-
- // SetThreadLocale doesn't handle names/custom cultures
-#ifdef _MSC_VER
-// Get rid of the SetThreadLocale warning in OACR:
-#pragma warning(push)
-#pragma warning(disable:38010)
-#endif
- result = ::SetThreadLocale(lcid);
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
- FC_RETURN_BOOL(result);
-}
-FCIMPLEND
-#endif
FCIMPL2(Object*, COMNlsInfo::nativeGetLocaleInfoEx, StringObject* localeNameUNSAFE, INT32 lcType)
@@ -1661,18 +1583,6 @@ INT32 QCALLTYPE COMNlsInfo::InternalCompareString(
handle = EnsureValidSortHandle(handle, handleOrigin, localeName);
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- if(!(curDomain->m_bUseOsSorting))
- {
- result = SortVersioning::SortDllCompareString((SortVersioning::PSORTHANDLE) handle, flags, &string1[offset1], length1, &string2[offset2], length2, NULL, 0);
- }
- else if (curDomain->m_pCustomSortLibrary != NULL) {
- result = (curDomain->m_pCustomSortLibrary->pCompareStringEx)(handle != NULL ? NULL : localeName, flags, &string1[offset1], length1, &string2[offset2], length2, NULL, NULL, (LPARAM) handle);
- }
- else
-#endif
{
result = NewApis::CompareStringEx(handle != NULL ? NULL : localeName, flags, &string1[offset1], length1, &string2[offset2], length2,NULL,NULL, (LPARAM) handle);
}
@@ -1770,40 +1680,19 @@ INT32 QCALLTYPE COMNlsInfo::InternalGetGlobalizedHashCode(INT_PTR handle, INT_PT
COMPlusThrowArgumentNull(W("string"),W("ArgumentNull_String"));
}
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-#endif // FEATURE_CORECLR
if(length > 0 && UseConstantSpaceHashAlgorithm()
// Note that we can't simply do the hash without the entropy and then try to add it after the fact we need the hash function itself to pass entropy to its inputs.
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
&& !bForceRandomizedHashing
-#ifndef FEATURE_CORECLR
- && !curDomain->m_pNlsHashProvider->GetUseRandomHashing()
-#else
&& !COMNlsHashProvider::s_NlsHashProvider.GetUseRandomHashing()
-#endif // FEATURE_CORECLR
#endif // FEATURE_RANDOMIZED_STRING_HASHING
)
{
-#ifndef FEATURE_CORECLR
- if(!(curDomain->m_bUseOsSorting))
- {
- iReturnHash=SortVersioning::SortDllGetHashCode((SortVersioning::PSORTHANDLE) handle, dwFlagsIn, string, length, NULL, 0);
- }
- else
-#endif
{
int iRes = 0;
int iHashValue = 0;
-#ifndef FEATURE_CORECLR
- if (curDomain->m_pCustomSortLibrary != NULL)
- {
- iRes = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(localeName, dwFlagsIn | LCMAP_HASH, string, length, (LPWSTR) &iHashValue, sizeof(INT32), NULL, NULL, 0);
- }
- else
-#endif
{
iRes = NewApis::LCMapStringEx(localeName, dwFlagsIn | LCMAP_HASH, string, length, (LPWSTR) &iHashValue, sizeof(INT32), NULL, NULL, 0);
}
@@ -1824,17 +1713,6 @@ INT32 QCALLTYPE COMNlsInfo::InternalGetGlobalizedHashCode(INT_PTR handle, INT_PT
//
// Assert if we might hit an AV in LCMapStringEx for the invariant culture.
_ASSERTE(length > 0 || (dwFlags & LCMAP_LINGUISTIC_CASING) == 0);
-#ifndef FEATURE_CORECLR
- if(!(curDomain->m_bUseOsSorting))
- {
- byteCount=SortVersioning::SortDllGetSortKey((SortVersioning::PSORTHANDLE) handle, dwFlagsIn, string, length, NULL, 0, NULL, 0);
- }
- else if (curDomain->m_pCustomSortLibrary != NULL)
- {
- byteCount = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : localeName, dwFlags, string, length, NULL, 0, NULL, NULL, (LPARAM) handle);
- }
- else
-#endif
{
byteCount=NewApis::LCMapStringEx(handle != NULL ? NULL : localeName, dwFlags, string, length, NULL, 0, NULL, NULL, (LPARAM) handle);
}
@@ -1851,26 +1729,11 @@ INT32 QCALLTYPE COMNlsInfo::InternalGetGlobalizedHashCode(INT_PTR handle, INT_PT
CQuickBytesSpecifySize<MAX_STRING_VALUE * sizeof(WCHAR)> qbBuffer;
BYTE* pByte = (BYTE*)qbBuffer.AllocThrows(byteCount);
-#ifndef FEATURE_CORECLR
- if(!(curDomain->m_bUseOsSorting))
- {
- SortVersioning::SortDllGetSortKey((SortVersioning::PSORTHANDLE) handle, dwFlagsIn, string, length, pByte, byteCount, NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : localeName, dwFlags, string, length, (LPWSTR)pByte, byteCount, NULL, NULL, (LPARAM) handle);
- }
- else
-#endif
{
NewApis::LCMapStringEx(handle != NULL ? NULL : localeName, dwFlags, string, length, (LPWSTR)pByte, byteCount, NULL,NULL, (LPARAM) handle);
}
-#ifndef FEATURE_CORECLR
- iReturnHash = curDomain->m_pNlsHashProvider->HashSortKey(pByte, byteCount, bForceRandomizedHashing, additionalEntropy);
-#else
iReturnHash = COMNlsHashProvider::s_NlsHashProvider.HashSortKey(pByte, byteCount, bForceRandomizedHashing, additionalEntropy);
-#endif // FEATURE_CORECLR
}
}
END_QCALL;
@@ -1910,36 +1773,6 @@ FCIMPL5(FC_CHAR_RET, COMNlsInfo::InternalChangeCaseChar,
handle = EnsureValidSortHandle(handle, handleOrigin, localeName->GetBuffer());
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- //For a versioned sort, Invariant should still use the OS
- if(!(curDomain->m_bUseOsSorting) && !isInvariantLocale)
- {
- ret_LCMapStringEx = SortVersioning::SortDllChangeCase((SortVersioning::PSORTHANDLE) handle,
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing:
- LCMAP_LOWERCASE | linguisticCasing,
- &wch,
- 1,
- &retVal,
- 1,
- NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- ret_LCMapStringEx = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : localeName->GetBuffer(),
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing:
- LCMAP_LOWERCASE | linguisticCasing,
- &wch,
- 1,
- &retVal,
- 1,
- NULL,
- NULL,
- (LPARAM) handle);
- }
- else
-#endif
{
ret_LCMapStringEx = NewApis::LCMapStringEx(handle != NULL ? NULL : localeName->GetBuffer(),
bIsToUpper?LCMAP_UPPERCASE | linguisticCasing:
@@ -2025,36 +1858,6 @@ FCIMPL5(Object*, COMNlsInfo::InternalChangeCaseString,
LPWSTR pResultStr = gc.pResult->GetBuffer();
int result;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- //Invariant should always use OS
- if(!(curDomain->m_bUseOsSorting) && !isInvariantLocale)
- {
- result = SortVersioning::SortDllChangeCase((SortVersioning::PSORTHANDLE) handle,
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing:
- LCMAP_LOWERCASE | linguisticCasing,
- gc.pString->GetBuffer(),
- nLengthInput,
- pResultStr,
- nLengthOutput,
- NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- result = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : (gc.pLocale)->GetBuffer(),
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing :
- LCMAP_LOWERCASE | linguisticCasing,
- gc.pString->GetBuffer(),
- nLengthInput,
- pResultStr,
- nLengthOutput,
- NULL,
- NULL,
- (LPARAM) handle);
- }
- else
-#endif
{
result = NewApis::LCMapStringEx(handle != NULL ? NULL : (gc.pLocale)->GetBuffer(),
bIsToUpper?LCMAP_UPPERCASE | linguisticCasing :
@@ -2076,34 +1879,6 @@ FCIMPL5(Object*, COMNlsInfo::InternalChangeCaseString,
ThrowLastError();
}
// need to update buffer
-#ifndef FEATURE_CORECLR
- //Invariant should always use OS
- if(!(curDomain->m_bUseOsSorting) && !IsInvariantLocale(gc.pLocale))
- {
- nLengthOutput = SortVersioning::SortDllChangeCase((SortVersioning::PSORTHANDLE) handle,
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing:
- LCMAP_LOWERCASE | linguisticCasing,
- gc.pString->GetBuffer(),
- nLengthInput,
- NULL,
- 0,
- NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- nLengthOutput = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : (gc.pLocale)->GetBuffer(),
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing :
- LCMAP_LOWERCASE | linguisticCasing,
- gc.pString->GetBuffer(),
- nLengthInput,
- NULL,
- 0,
- NULL,
- NULL,
- (LPARAM) handle);
- }
- else
-#endif
{
nLengthOutput = NewApis::LCMapStringEx(handle != NULL ? NULL : (gc.pLocale)->GetBuffer(),
bIsToUpper?LCMAP_UPPERCASE | linguisticCasing :
@@ -2133,34 +1908,6 @@ FCIMPL5(Object*, COMNlsInfo::InternalChangeCaseString,
gc.pResult = StringObject::NewString(nLengthOutput);
pResultStr = gc.pResult->GetBuffer();
-#ifndef FEATURE_CORECLR
- //Invariant should always use OS
- if(!(curDomain->m_bUseOsSorting) && !IsInvariantLocale(gc.pLocale))
- {
- result = SortVersioning::SortDllChangeCase((SortVersioning::PSORTHANDLE) handle,
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing:
- LCMAP_LOWERCASE | linguisticCasing,
- gc.pString->GetBuffer(),
- nLengthInput,
- pResultStr,
- nLengthOutput,
- NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- result = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : (gc.pLocale)->GetBuffer(),
- bIsToUpper?LCMAP_UPPERCASE | linguisticCasing :
- LCMAP_LOWERCASE | linguisticCasing,
- gc.pString->GetBuffer(),
- nLengthInput,
- pResultStr,
- nLengthOutput,
- NULL,
- NULL,
- (LPARAM) handle);
- }
- else
-#endif
{
result = NewApis::LCMapStringEx(handle != NULL ? NULL : (gc.pLocale)->GetBuffer(),
bIsToUpper?LCMAP_UPPERCASE | linguisticCasing :
@@ -2217,9 +1964,6 @@ FCIMPL6(INT32, COMNlsInfo::InternalGetCaseInsHash,
*((LPVOID *)&strA)=pvStrA;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-#endif
//
// If we know that we don't have any high characters (the common case) we can
@@ -2235,11 +1979,7 @@ FCIMPL6(INT32, COMNlsInfo::InternalGetCaseInsHash,
{
// Notice that for Turkish and Azeri we don't get here and shouldn't use this
// fast path because of their special Latin casing rules.
-#ifndef FEATURE_CORECLR
- result = curDomain->m_pNlsHashProvider->HashiStringKnownLower80(strA->GetBuffer(), strA->GetStringLength(), bForceRandomizedHashing, additionalEntropy);
-#else
result = COMNlsHashProvider::s_NlsHashProvider.HashiStringKnownLower80(strA->GetBuffer(), strA->GetStringLength(), bForceRandomizedHashing, additionalEntropy);
-#endif // FEATURE_CORECLR
}
else
{
@@ -2259,29 +1999,6 @@ FCIMPL6(INT32, COMNlsInfo::InternalGetCaseInsHash,
}
int lcmapResult;
-#ifndef FEATURE_CORECLR
- if(!(curDomain->m_bUseOsSorting))
- {
- lcmapResult = SortVersioning::SortDllChangeCase((SortVersioning::PSORTHANDLE) handle,
- LCMAP_UPPERCASE | linguisticCasing,
- strA->GetBuffer(),
- length,
- pNewStr,
- length,
- NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- lcmapResult = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : localeName->GetBuffer(),
- LCMAP_UPPERCASE | linguisticCasing,
- strA->GetBuffer(),
- length,
- pNewStr,
- length,
- NULL, NULL, (LPARAM) handle);
- }
- else
-#endif
{
lcmapResult = NewApis::LCMapStringEx(handle != NULL ? NULL : localeName->GetBuffer(),
LCMAP_UPPERCASE | linguisticCasing,
@@ -2302,11 +2019,7 @@ FCIMPL6(INT32, COMNlsInfo::InternalGetCaseInsHash,
// Get hash for the upper case of the new string
-#ifndef FEATURE_CORECLR
- result = curDomain->m_pNlsHashProvider->HashString(pNewStr, length, (BOOL)bForceRandomizedHashing, additionalEntropy);
-#else
result = COMNlsHashProvider::s_NlsHashProvider.HashString(pNewStr, length, (BOOL)bForceRandomizedHashing, additionalEntropy);
-#endif // FEATURE_CORECLR
}
END_SO_INTOLERANT_CODE
@@ -2351,23 +2064,6 @@ BOOL QCALLTYPE COMNlsInfo::InternalTryFindStringOrdinalIgnoreCase(
else {
lpSearchStart = &lpStringSource[sourceIndex];
}
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- // Check if the default sorting is overridden
- if (curDomain->m_pCustomSortLibrary != NULL)
- {
- *foundIndex = (curDomain->m_pCustomSortLibrary->pFindStringOrdinal)(
- dwFindNLSStringFlags,
- lpSearchStart,
- cchSource,
- lpStringValue,
- cchValue,
- TRUE);
- result = TRUE;
- }
- else
-#endif
{
{
*foundIndex = FindStringOrdinal(
@@ -2423,14 +2119,6 @@ INT32 QCALLTYPE COMNlsInfo::InternalCompareStringOrdinalIgnoreCase(
_ASSERT(length2 >= 0);
// Do the comparison
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- if (curDomain->m_pCustomSortLibrary != NULL) {
- result = (curDomain->m_pCustomSortLibrary->pCompareStringOrdinal)(string1 + index1, length1, string2 + index2, length2, TRUE);
- }
- else
-#endif
{
result = NewApis::CompareStringOrdinal(string1 + index1, length1, string2 + index2, length2, TRUE);
}
@@ -2581,15 +2269,6 @@ void QCALLTYPE COMNlsInfo::nativeNormalizationInitNormalization(int NormForm, BY
if (!hNormalization)
ThrowLastError();
}
-#ifndef FEATURE_CORECLR
- // in coreclr we should always find the normalization in kernel32 as it supports Win7 and up
- else
- {
- HRESULT hr = g_pCLRRuntime->LoadLibrary(NORMALIZATION_DLL, &hNormalization);
- if (FAILED(hr))
- ThrowHR(hr);
- }
-#endif // FEATURE_CORECLR
_ASSERTE(hNormalization != NULL);
m_hNormalization = hNormalization;
@@ -2771,7 +2450,6 @@ FCIMPL1(FC_BOOL_RET, COMNlsInfo::nativeInitCultureData, CultureDataBaseObject *c
gc.stringResult = StringObject::NewString(buffer, result - 1);
SetObjectReference((OBJECTREF*)&(gc.cultureData->sSpecificCulture), gc.stringResult, NULL);
-#ifdef FEATURE_CORECLR
if (!IsWindows7())
{
// For neutrals on Windows 7 + the neutral windows name can be the same as the neutral name,
@@ -2779,7 +2457,6 @@ FCIMPL1(FC_BOOL_RET, COMNlsInfo::nativeInitCultureData, CultureDataBaseObject *c
gc.stringResult = StringObject::NewString(buffer, result - 1);
SetObjectReference((OBJECTREF*)&(gc.cultureData->sWindowsName), gc.stringResult, NULL);
}
-#endif
}
@@ -2819,12 +2496,10 @@ FCIMPL1(FC_BOOL_RET, COMNlsInfo::nativeInitCultureData, CultureDataBaseObject *c
SetObjectReference((OBJECTREF*)&(gc.cultureData->sName), gc.stringResult, NULL);
}
-#ifdef FEATURE_CORECLR
// For Silverlight make sure that the sorting tables are available (< Vista may not have east asian installed)
result = NewApis::CompareStringEx(((STRINGREF)gc.cultureData->sWindowsName)->GetBuffer(),
0, W("A"), 1, W("B"), 1, NULL, NULL, 0);
if (result == 0) goto Exit;
-#endif
// It succeeded.
success = TRUE;
@@ -2887,16 +2562,9 @@ int QCALLTYPE COMNlsInfo::InternalFindNLSStringEx(
BEGIN_QCALL;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
- handle = EnsureValidSortHandle(handle, handleOrigin, lpLocaleName);
-#endif
#define RESERVED_FIND_ASCII_STRING 0x20000000 // This flag used only to tell the sorting DLL can assume the string characters are in ASCII.
-#ifndef FEATURE_CORECLR
- int asciiFlag = (dwFindNLSStringFlags & RESERVED_FIND_ASCII_STRING);
-#endif // FEATURE_CORECLR
dwFindNLSStringFlags &= ~RESERVED_FIND_ASCII_STRING;
@@ -2950,29 +2618,6 @@ int QCALLTYPE COMNlsInfo::InternalFindNLSStringEx(
{
if (dwFindNLSStringFlags & (FIND_FROMEND | FIND_ENDSWITH))
{
-#ifndef FEATURE_CORECLR
- if(!(curDomain->m_bUseOsSorting))
- {
- retValue = SortVersioning::SortDllFindString((SortVersioning::PSORTHANDLE) handle,
- dwFindNLSStringFlags | asciiFlag,
- &lpStringSource[sourceIndex - cchSource + 1],
- cchSource,
- lpStringValue,
- cchValue,
- NULL, NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- retValue = (curDomain->m_pCustomSortLibrary->pFindNLSStringEx)(
- handle != NULL ? NULL : lpLocaleName,
- dwFindNLSStringFlags,
- &lpStringSource[sourceIndex - cchSource + 1],
- cchSource,
- lpStringValue,
- cchValue, NULL, NULL, NULL, (LPARAM) handle);
- }
- else
-#endif
{
retValue = NewApis::FindNLSStringEx(
handle != NULL ? NULL : lpLocaleName,
@@ -2990,29 +2635,6 @@ int QCALLTYPE COMNlsInfo::InternalFindNLSStringEx(
}
else
{
-#ifndef FEATURE_CORECLR
- if(!(curDomain->m_bUseOsSorting))
- {
- retValue = SortVersioning::SortDllFindString((SortVersioning::PSORTHANDLE) handle,
- dwFindNLSStringFlags | asciiFlag,
- &lpStringSource[sourceIndex],
- cchSource,
- lpStringValue,
- cchValue,
- NULL, NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- retValue = (curDomain->m_pCustomSortLibrary->pFindNLSStringEx)(
- handle != NULL ? NULL : lpLocaleName,
- dwFindNLSStringFlags,
- &lpStringSource[sourceIndex],
- cchSource,
- lpStringValue,
- cchValue, NULL, NULL, NULL, (LPARAM) handle);
- }
- else
-#endif
{
retValue = NewApis::FindNLSStringEx(
handle != NULL ? NULL : lpLocaleName,
@@ -3062,35 +2684,6 @@ int QCALLTYPE COMNlsInfo::InternalGetSortKey(
BEGIN_QCALL;
-#ifndef FEATURE_CORECLR
- handle = EnsureValidSortHandle(handle, handleOrigin, pLocaleName);
-
- AppDomain* curDomain = GetAppDomain();
-
- if(!(curDomain->m_bUseOsSorting))
- {
- retValue = SortVersioning::SortDllGetSortKey((SortVersioning::PSORTHANDLE) handle,
- flags,
- pStringSource,
- cchSource,
- pTarget,
- cchTarget,
- NULL, 0);
- }
- else if(curDomain->m_pCustomSortLibrary != NULL)
- {
- retValue = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(handle != NULL ? NULL : pLocaleName,
- flags | LCMAP_SORTKEY,
- pStringSource,
- cchSource,
- (LPWSTR)pTarget,
- cchTarget,
- NULL,
- NULL,
- (LPARAM) handle);
- }
- else
-#endif
{
// Just call NewApis::LCMapStringEx to do our work
retValue = NewApis::LCMapStringEx(handle != NULL ? NULL : pLocaleName,
@@ -3143,86 +2736,11 @@ INT_PTR COMNlsInfo::InitSortHandleHelper(LPCWSTR localeName, __out INT_PTR* hand
INT_PTR pSort = NULL;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
-#if _DEBUG
- _ASSERTE(curDomain->m_bSortingInitialized);
-#endif
-
- if(curDomain->m_bUseOsSorting)
- {
- pSort = InternalInitOsSortHandle(localeName, handleOrigin);
- }
- else
- {
- pSort = InternalInitVersionedSortHandle(localeName, handleOrigin);
- }
-#else
// coreclr will try to initialize the handle and if running on downlevel it'll just return null
pSort = InternalInitOsSortHandle(localeName, handleOrigin);
-#endif // FEATURE_CORECLR
return pSort;
}
-#ifndef FEATURE_CORECLR
-INT_PTR COMNlsInfo::InternalInitVersionedSortHandle(LPCWSTR localeName, __out INT_PTR* handleOrigin)
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- CANNOT_TAKE_LOCK;
- PRECONDITION(localeName != NULL);
- } CONTRACTL_END;
-
- AppDomain* curDomain = GetAppDomain();
-
- if(curDomain->m_pCustomSortLibrary != NULL)
- {
- return NULL;
- }
-
- return InternalInitVersionedSortHandle(localeName, handleOrigin, curDomain->m_sortVersion);
-}
-
-INT_PTR COMNlsInfo::InternalInitVersionedSortHandle(LPCWSTR localeName, __out INT_PTR* handleOrigin, DWORD sortVersion)
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- CANNOT_TAKE_LOCK;
- PRECONDITION(localeName != NULL);
- } CONTRACTL_END;
-
- INT_PTR pSort = NULL;
-
- _ASSERTE(NewApis::NotLeakingFrameworkOnlyCultures(localeName));
-
- *handleOrigin = (INT_PTR) SortVersioning::GetSortHandle;
-
- // try the requested version
- if(sortVersion != DEFAULT_SORT_VERSION)
- {
- NLSVERSIONINFO sortVersionInfo;
- sortVersionInfo.dwNLSVersionInfoSize = sizeof(NLSVERSIONINFO);
- sortVersionInfo.dwNLSVersion = sortVersion;
- sortVersionInfo.dwDefinedVersion = sortVersion;
- pSort = (INT_PTR) SortVersioning::GetSortHandle(localeName, &sortVersionInfo);
- }
-
- // fallback to default version
- if(pSort == NULL)
- {
- pSort = (INT_PTR) SortVersioning::GetSortHandle(localeName, NULL);
- }
-
- _ASSERTE(RunningOnWin8() || pSort != NULL);
-
- return pSort;
-}
-#endif //FEATURE_CORECLR
// Can return NULL
INT_PTR COMNlsInfo::InternalInitOsSortHandle(LPCWSTR localeName, __out INT_PTR* handleOrigin)
@@ -3239,23 +2757,11 @@ INT_PTR COMNlsInfo::InternalInitOsSortHandle(LPCWSTR localeName, __out INT_PTR*
AppDomain* curDomain = GetAppDomain();
-#ifndef FEATURE_CORECLR
- if (RunningOnWin8() || curDomain->m_pCustomSortLibrary != NULL)
-#else
if (RunningOnWin8())
-#endif //FEATURE_CORECLR
{
LPARAM lSortHandle;
int ret;
-#ifndef FEATURE_CORECLR
- if (curDomain->m_pCustomSortLibrary != NULL)
- {
- ret = (curDomain->m_pCustomSortLibrary->pLCMapStringEx)(localeName, LCMAP_SORTHANDLE, NULL, 0, (LPWSTR) &lSortHandle, sizeof(LPARAM), NULL, NULL, 0);
- *handleOrigin = (INT_PTR) curDomain->m_pCustomSortLibrary->pLCMapStringEx;
- }
- else
-#endif //FEATURE_CORECLR
{
ret = NewApis::LCMapStringEx(localeName, LCMAP_SORTHANDLE, NULL, 0, (LPWSTR) &lSortHandle, sizeof(LPARAM), NULL, NULL, 0);
*handleOrigin = (INT_PTR) NewApis::LCMapStringEx;
@@ -3279,59 +2785,9 @@ BOOL QCALLTYPE COMNlsInfo::InternalGetNlsVersionEx(INT_PTR handle, INT_PTR handl
BOOL ret = FALSE;
BEGIN_QCALL;
-#ifndef FEATURE_CORECLR
- AppDomain* curDomain = GetAppDomain();
-
- if(curDomain->m_bUseOsSorting)
- {
- if(curDomain->m_pCustomSortLibrary != NULL)
- {
- ret = (curDomain->m_pCustomSortLibrary->pGetNLSVersionEx)(COMPARE_STRING, lpLocaleName, lpVersionInformation);
- }
- else
- {
- ret = GetNLSVersionEx(COMPARE_STRING, lpLocaleName, lpVersionInformation);
- }
- }
- else
- {
- handle = EnsureValidSortHandle(handle, handleOrigin, lpLocaleName);
-
- NLSVERSIONINFO nlsVersion;
- nlsVersion.dwNLSVersionInfoSize = sizeof(NLSVERSIONINFO);
-
- ret = SortVersioning::SortGetNLSVersion((SortVersioning::PSORTHANDLE) handle, COMPARE_STRING, &nlsVersion);
-
- lpVersionInformation->dwNLSVersion = nlsVersion.dwNLSVersion;
- lpVersionInformation->dwDefinedVersion = nlsVersion.dwDefinedVersion;
- lpVersionInformation->dwEffectiveId = 0;
- ZeroMemory(&(lpVersionInformation->guidCustomVersion), sizeof(GUID));
- }
-#else
ret = GetNLSVersionEx(COMPARE_STRING, lpLocaleName, lpVersionInformation);
-#endif // FEATURE_CORECLR
END_QCALL;
return ret;
}
-#ifndef FEATURE_CORECLR
-DWORD QCALLTYPE COMNlsInfo::InternalGetSortVersion()
-{
- CONTRACTL {
- QCALL_CHECK;
- } CONTRACTL_END;
-
- DWORD version = DEFAULT_SORT_VERSION;
-
- BEGIN_QCALL;
-
- AppDomain* curDomain = GetAppDomain();
- version = curDomain->m_sortVersion;
-
- END_QCALL;
-
- return version;
-}
-
-#endif //FEATURE_CORECLR
diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp
index ae266e8a6f..7c5ab14a7e 100644
--- a/src/debug/daccess/dacdbiimpl.cpp
+++ b/src/debug/daccess/dacdbiimpl.cpp
@@ -25,9 +25,6 @@
#include "stackwalk.h"
#include "dacdbiimpl.h"
-#ifndef FEATURE_CORECLR
-#include "assemblyusagelogmanager.h"
-#endif
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
@@ -5684,28 +5681,7 @@ VMPTR_Object DacDbiInterfaceImpl::GetObject(CORDB_ADDRESS ptr)
HRESULT DacDbiInterfaceImpl::EnableNGENPolicy(CorDebugNGENPolicy ePolicy)
{
-#ifndef FEATURE_CORECLR
- DD_ENTER_MAY_THROW;
-
- // translate from our publicly exposed enum to the appropriate internal value
- AssemblyUsageLogManager::ASSEMBLY_USAGE_LOG_FLAGS asmFlag = AssemblyUsageLogManager::ASSEMBLY_USAGE_LOG_FLAGS_NONE;
-
- switch (ePolicy)
- {
- case DISABLE_LOCAL_NIC:
- asmFlag = AssemblyUsageLogManager::ASSEMBLY_USAGE_LOG_FLAGS_APPLOCALNGENDISABLED;
- break;
- default:
- return E_INVALIDARG;
- }
-
- // we should have made some selection
- _ASSERTE(asmFlag != AssemblyUsageLogManager::ASSEMBLY_USAGE_LOG_FLAGS_NONE);
-
- return AssemblyUsageLogManager::SetUsageLogFlag(asmFlag, TRUE);
-#else
return E_NOTIMPL;
-#endif // FEATURE_CORECLR
}
HRESULT DacDbiInterfaceImpl::SetNGENCompilerFlags(DWORD dwFlags)
diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp
index 91dff84008..3818c4f2bd 100644
--- a/src/debug/daccess/nidump.cpp
+++ b/src/debug/daccess/nidump.cpp
@@ -615,16 +615,6 @@ void NativeImageDumper::DumpAssemblySignature(CORCOMPILE_ASSEMBLY_SIGNATURE & as
CORCOMPILE_ASSEMBLY_SIGNATURE, COR_INFO );
}
-#ifndef FEATURE_CORECLR
-
-const NativeImageDumper::EnumMnemonics s_CorCompileDependencyInfoFlags[] =
-{
-#define CMDI_ENTRY(f) NativeImageDumper::EnumMnemonics(CORCOMPILE_DEPENDENCY_ ## f, W(#f))
-
-#undef CMDI_ENTRY
-};
-
-#endif //!FEATURE_CORECLR
//error code return?
void
@@ -1090,12 +1080,6 @@ NativeImageDumper::DumpNativeImage()
WriteFieldMDTokenImport( dwAssemblyDef, deps[i].dwAssemblyDef,
CORCOMPILE_DEPENDENCY, COR_INFO,
m_manifestImport );
-#ifndef FEATURE_CORECLR
- DisplayWriteFieldEnumerated( dependencyInfo, deps[i].dependencyInfo,
- CORCOMPILE_DEPENDENCY,
- s_CorCompileDependencyInfoFlags, W(", "),
- COR_INFO );
-#endif // !FEATURE_CORECLR
DisplayStartStructureWithOffset( signAssemblyDef,
DPtrToPreferredAddr(deps + i) + offsetof(CORCOMPILE_DEPENDENCY, signAssemblyDef),
sizeof(deps[i]).signAssemblyDef,
diff --git a/src/debug/di/cordb.cpp b/src/debug/di/cordb.cpp
index 7f8c087399..3cb93756ec 100644
--- a/src/debug/di/cordb.cpp
+++ b/src/debug/di/cordb.cpp
@@ -99,7 +99,6 @@ STDAPI CreateCordbObject(int iDebuggerVersion, IUnknown ** ppCordb)
return Cordb::CreateObject((CorDebugInterfaceVersion)iDebuggerVersion, IID_ICorDebug, (void **) ppCordb);
}
-#if defined(FEATURE_CORECLR)
//
// Public API.
// Telesto Creation path - only way to debug multi-instance.
@@ -152,7 +151,6 @@ STDAPI CoreCLRCreateCordbObject(int iDebuggerVersion, DWORD pid, HMODULE hmodTar
return hr;
}
-#endif // FEATURE_CORECLR
diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp
index 53fb2ca0f6..2d73c3a273 100644
--- a/src/debug/di/process.cpp
+++ b/src/debug/di/process.cpp
@@ -2361,18 +2361,7 @@ HRESULT CordbProcess::EnumerateHandles(CorGCReferenceType types, ICorDebugGCRefe
HRESULT CordbProcess::EnableNGENPolicy(CorDebugNGENPolicy ePolicy)
{
-#ifdef FEATURE_CORECLR
return E_NOTIMPL;
-#else
- HRESULT hr = S_OK;
- PUBLIC_API_BEGIN(this);
-
- IDacDbiInterface* pDAC = GetProcess()->GetDAC();
- hr = pDAC->EnableNGENPolicy(ePolicy);
-
- PUBLIC_API_END(hr);
- return hr;
-#endif
}
@@ -7507,33 +7496,6 @@ void CordbProcess::VerifyControlBlock()
// For Telesto, Dbi and Wks have a more flexible versioning allowed, as described by the Debugger
// Version Protocol String in DEBUGGER_PROTOCOL_STRING in DbgIpcEvents.h. This allows different build
// numbers, but the other protocol numbers should still match.
-#if !defined(FEATURE_CORECLR)
- bool fSkipVerCheck = false;
-#if _DEBUG
- // In debug builds, allow us to disable the version check to help with applying hotfixes.
- // The hotfix may be built against a compatible IPC protocol, but have a slightly different build number.
- fSkipVerCheck = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_DbgSkipVerCheck) != 0;
-#endif
-
- if (!fSkipVerCheck)
- {
- //
- // These asserts double check that the version of the Right Side matches the version of the left side.
- //
- // If you hit these asserts, it is probably because you rebuilt mscordbi without rebuilding mscorwks, or rebuilt
- // mscorwks without rebuilding mscordbi. You might be able to ignore these asserts, but proceed at your own risk.
- //
- CONSISTENCY_CHECK_MSGF(VER_PRODUCTBUILD == GetDCB()->m_verMajor,
- ("version of %s (%d) in the debuggee does not match version of mscordbi.dll (%d) in the debugger.\n"
- "This means your setup is wrong. You can ignore this but proceed at your own risk.\n",
- MAIN_CLR_DLL_NAME_A, GetDCB()->m_verMajor, VER_PRODUCTBUILD));
- CONSISTENCY_CHECK_MSGF(VER_PRODUCTBUILD_QFE == GetDCB()->m_verMinor,
- ("QFE version of %s (%d) in the debuggee does not match QFE version of mscordbi.dll (%d) in the debugger.\n"
- "Both dlls have build # (%d).\n"
- "This means your setup is wrong. You can ignore this but proceed at your own risk.\n",
- MAIN_CLR_DLL_NAME_A, GetDCB()->m_verMinor, VER_PRODUCTBUILD_QFE, VER_PRODUCTBUILD));
- }
-#endif // !FEATURE_CORECLR
// These assertions verify that the debug manager is behaving correctly.
// An assertion failure here means that the runtime version of the debuggee is different from the runtime version of
@@ -15175,11 +15137,7 @@ bool CordbProcess::IsCompatibleWith(DWORD clrMajorVersion)
// honored for SLv4.
if (requiredVersion <= 0)
{
-#if defined(FEATURE_CORECLR)
requiredVersion = 2;
-#else
- requiredVersion = 4;
-#endif
}
// Compare the version we were created for against the minimum required
diff --git a/src/debug/di/rsmain.cpp b/src/debug/di/rsmain.cpp
index 6e0ccf8872..542872577f 100644
--- a/src/debug/di/rsmain.cpp
+++ b/src/debug/di/rsmain.cpp
@@ -1306,7 +1306,6 @@ HRESULT Cordb::WaitForIPCEventFromProcess(CordbProcess* process,
event);
}
-#ifdef FEATURE_CORECLR
HRESULT Cordb::SetTargetCLR(HMODULE hmodTargetCLR)
{
if (m_initialized)
@@ -1328,7 +1327,6 @@ HRESULT Cordb::SetTargetCLR(HMODULE hmodTargetCLR)
return S_OK;
}
-#endif // FEATURE_CORECLR
//-----------------------------------------------------------
// ICorDebug
@@ -1407,7 +1405,7 @@ HRESULT Cordb::SetUnmanagedHandler(ICorDebugUnmanagedCallback *pCallback)
// It is currently supported on Mac CoreCLR, but that may change.
bool Cordb::IsCreateProcessSupported()
{
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_DBGIPC_TRANSPORT_DI)
+#if !defined(FEATURE_DBGIPC_TRANSPORT_DI)
return false;
#else
return true;
diff --git a/src/debug/di/rsmda.cpp b/src/debug/di/rsmda.cpp
index d69b448309..751fdc8938 100644
--- a/src/debug/di/rsmda.cpp
+++ b/src/debug/di/rsmda.cpp
@@ -150,11 +150,7 @@ HRESULT CordbMDA::GetName(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
{
-#if defined(FEATURE_CORECLR)
hr = E_NOTIMPL;
-#else // !FEATURE_CORECLR
- hr = CopyOutString(m_szName, cchName, pcchName, szName);
-#endif // FEATURE_CORECLR
}
PUBLIC_API_END(hr);
return hr;
@@ -169,11 +165,7 @@ HRESULT CordbMDA::GetDescription(ULONG32 cchName, ULONG32 * pcchName, __out_ecou
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
{
-#if defined(FEATURE_CORECLR)
hr = E_NOTIMPL;
-#else // !FEATURE_CORECLR
- hr = CopyOutString(m_szDescription, cchName, pcchName, szName);
-#endif // FEATURE_CORECLR
}
PUBLIC_API_END(hr);
return hr;
@@ -190,11 +182,7 @@ HRESULT CordbMDA::GetXML(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
{
-#if defined(FEATURE_CORECLR)
hr = E_NOTIMPL;
-#else // !FEATURE_CORECLR
- hr = CopyOutString(m_szXml, cchName, pcchName, szName);
-#endif // FEATURE_CORECLR
}
PUBLIC_API_END(hr);
return hr;
@@ -208,12 +196,7 @@ HRESULT CordbMDA::GetFlags(CorDebugMDAFlags * pFlags)
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
{
-#if defined(FEATURE_CORECLR)
hr = E_NOTIMPL;
-#else // !FEATURE_CORECLR
- ValidateOrThrow(pFlags);
- *pFlags = this->m_flags;
-#endif // FEATURE_CORECLR
}
PUBLIC_API_END(hr);
return hr;
@@ -229,13 +212,7 @@ HRESULT CordbMDA::GetOSThreadId(DWORD * pOsTid)
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
{
-#if defined(FEATURE_CORECLR)
hr = E_NOTIMPL;
-#else // !FEATURE_CORECLR
- ValidateOrThrow(pOsTid);
-
- *pOsTid = this->m_dwOSTID;
-#endif // FEATURE_CORECLR
}
PUBLIC_API_END(hr);
return hr;
diff --git a/src/debug/di/rspriv.h b/src/debug/di/rspriv.h
index 1db784b636..5b832c7731 100644
--- a/src/debug/di/rspriv.h
+++ b/src/debug/di/rspriv.h
@@ -2199,9 +2199,7 @@ public:
// ICorDebug
//-----------------------------------------------------------
-#ifdef FEATURE_CORECLR
HRESULT SetTargetCLR(HMODULE hmodTargetCLR);
-#endif // FEATURE_CORECLR
COM_METHOD Initialize();
COM_METHOD Terminate();
diff --git a/src/debug/ee/dactable.cpp b/src/debug/ee/dactable.cpp
index c37bbed744..a54fa7515c 100644
--- a/src/debug/ee/dactable.cpp
+++ b/src/debug/ee/dactable.cpp
@@ -40,11 +40,7 @@ extern DWORD gThreadTLSIndex;
extern DWORD gAppDomainTLSIndex;
#ifdef FEATURE_APPX
-#if defined(FEATURE_CORECLR)
extern BOOL g_fAppX;
-#else
-extern PTR_AppXRTInfo g_pAppXRTInfo;
-#endif
#endif // FEATURE_APPX
DacGlobals g_dacTable;
diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp
index 1f2126b9f0..d77227f213 100644
--- a/src/debug/ee/debugger.cpp
+++ b/src/debug/ee/debugger.cpp
@@ -43,9 +43,7 @@
#include "datatest.h"
#endif // TEST_DATA_CONSISTENCY
-#if defined(FEATURE_CORECLR)
#include "dbgenginemetrics.h"
-#endif // FEATURE_CORECLR
#include "../../vm/rejit.h"
@@ -1896,7 +1894,7 @@ void Debugger::SendCreateProcess(DebuggerLockHolder * pDbgLockHolder)
pDbgLockHolder->Acquire();
}
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
HANDLE g_hContinueStartupEvent = INVALID_HANDLE_VALUE;
@@ -1999,7 +1997,7 @@ HRESULT Debugger::Startup(void)
_ASSERTE(g_pEEInterface != NULL);
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
if (IsWatsonEnabled() || IsTelestoDebugPackInstalled())
{
// Iff the debug pack is installed, then go through the telesto debugging pipeline.
diff --git a/src/debug/ee/stdafx.h b/src/debug/ee/stdafx.h
index 7ccfa8d984..519ce510c4 100644
--- a/src/debug/ee/stdafx.h
+++ b/src/debug/ee/stdafx.h
@@ -12,10 +12,6 @@
#include <stdio.h>
#include <windows.h>
-#if !defined(FEATURE_CORECLR)
-#undef GetCurrentTime // works around a macro def conflict of GetCurrentTime
-#include <windows.ui.xaml.h>
-#endif // !FEATURE_CORECLR
#include <switches.h>
#include <winwrap.h>
diff --git a/src/dlls/mscordbi/mscordbi.src b/src/dlls/mscordbi/mscordbi.src
index 0baa49537e..3b1f37720d 100644
--- a/src/dlls/mscordbi/mscordbi.src
+++ b/src/dlls/mscordbi/mscordbi.src
@@ -18,9 +18,7 @@ EXPORTS
OpenVirtualProcess private
OpenVirtualProcess2
-#ifdef FEATURE_CORECLR
CoreCLRCreateCordbObject private
-#endif // FEATURE_CORECLR
#if defined(FEATURE_DBGIPC_TRANSPORT_DI)
DllGetClassObject private
diff --git a/src/dlls/mscoree/mscorwks_ntdef.src b/src/dlls/mscoree/mscorwks_ntdef.src
index 13656d7aca..8115475418 100644
--- a/src/dlls/mscoree/mscorwks_ntdef.src
+++ b/src/dlls/mscoree/mscorwks_ntdef.src
@@ -7,7 +7,6 @@ EXPORTS
; Common exports
;
-#ifdef FEATURE_CORECLR
GetCLRRuntimeHost
@@ -29,170 +28,3 @@ EXPORTS
GetMetaDataInternalInterfaceFromPublic
GetMetaDataPublicInterfaceFromInternal
-#else //FEATURE_CORECLR
-
-; VM
- DllGetClassObjectInternal private
- DllGetActivationFactoryImpl private
- GetClassActivatorForApplicationImpl private
- MetaDataGetDispenser
- GetMetaDataInternalInterface
- GetMetaDataInternalInterfaceFromPublic
- GetMetaDataPublicInterfaceFromInternal
- _CorExeMain2
- _CorDllMain
- CoInitializeEE
- CoUninitializeEE
- CoInitializeCor
- CoUninitializeCor
- PostErrorVA
-
- LoadStringRC @22
- ReOpenMetaDataWithMemory @23
-
- LoadStringRCEx
- ReOpenMetaDataWithMemoryEx private
- TranslateSecurityAttributes private
- GetPermissionRequests
- CorExitProcess
-#ifdef FEATURE_CLICKONCE
- CorLaunchApplication
-#endif
-
- CorMarkThreadInThreadPool
-
- LogHelp_LogAssert private
- LogHelp_NoGuiOnAssert private
- LogHelp_TerminateOnAssert private
-
- GetPrivateContextsPerfCounters private
-
- GetAssemblyMDImport private
-
- IEE private
-
-#ifdef FEATURE_FUSION
-; Fusion
- GetCachePath
- CreateAssemblyNameObject
- CreateApplicationContext
- CreateAssemblyCache
- CreateAssemblyEnum
- CreateHistoryReader
- LookupHistoryAssembly
- GetHistoryFileDirectory
- PreBindAssembly
- PreBindAssemblyEx
- SetMSIHandleForLogging
- NukeDownloadedCache
- ClearDownloadCache
- GetCLRIdentityManager
- CreateAssemblyConfigCookie
- DestroyAssemblyConfigCookie
- CompareAssemblyIdentity
- CompareAssemblyIdentityWithConfig
- InitializeFusion private
- CopyPDBs private
- DeleteShadowCache private
-#endif
-; Strong Name
- StrongNameErrorInfo
- StrongNameFreeBuffer
- StrongNameKeyGen
- StrongNameKeyGenEx
- StrongNameKeyInstall
- StrongNameKeyDelete
- StrongNameGetPublicKey
- StrongNameSignatureGeneration
- StrongNameSignatureGenerationEx
- StrongNameTokenFromAssembly
- StrongNameTokenFromAssemblyEx
- StrongNameTokenFromPublicKey
- StrongNameSignatureVerification
- StrongNameCompareAssemblies
- StrongNameHashSize
- StrongNameSignatureSize
- StrongNameSignatureVerificationEx
- GetHashFromAssemblyFile
- GetHashFromAssemblyFileW
- GetHashFromBlob
- GetHashFromFile
- GetHashFromFileW
- GetHashFromHandle
- StrongNameSignatureVerificationFromImage
- StrongNameGetBlob
- StrongNameGetBlobFromImage
- StrongNameSignatureVerificationEx2
- StrongNameGetPublicKeyEx
- StrongNameDigestGenerate
- StrongNameDigestSign
- StrongNameDigestEmbed
-
-; VM
-#ifdef FEATURE_COMINTEROP
- DllCanUnloadNowInternal private
-#endif
-#ifdef FEATURE_COMINTEROP_REGISTRATION
- ClrCreateManagedInstance
- DllRegisterServerInternal private
- DllUnregisterServerInternal private
- EEDllRegisterServer private
- EEDllUnregisterServer private
-#endif
- SetRuntimeInfo
- _CorExeMain
-#ifdef FEATURE_MIXEDMODE
- CorDllMainForThunk private
-#endif
- CoEEShutDownCOM
-#ifdef FEATURE_PREJIT
- NGenCreateNGenWorker
- LegacyNGenCreateZapper
- LegacyNGenFreeZapper
- LegacyNGenTryEnumerateFusionCache
- LegacyNGenCompile
-#endif
- GetAddrOfContractShutoffFlag private
- GetCLRFunction private
-
-#ifdef PROFILING_SUPPORTED
- AttachProfiler private
-#endif // PROFILING_SUPPORTED
-
-#ifdef FEATURE_FUSION
-; Fusion
- CreateInstallReferenceEnum
- InstallCustomModule
- GetAssemblyIdentityFromFile
- GetIdentityAuthority private
- ParseManifest private
- CreateCMSFromXml private
- GetAppIdAuthority private
- GetUserStore private
- CreateActContext private
- GetUserStateManager private
-; CreateCMSFromXmlInternal private
-; GetUserStoreInternal private
-; ParseManifestInternal private
-; CreateActContextInternal private
-; GetUserStateManagerInternal private
- CertCreateAuthenticodeLicense private
- CertTimestampAuthenticodeLicense private
- CertVerifyAuthenticodeLicense private
- CertFreeAuthenticodeSignerInfo private
- CertFreeAuthenticodeTimestamperInfo private
- _AxlPublicKeyBlobToPublicKeyToken private
- _AxlRSAKeyValueToPublicKeyToken private
- _AxlGetIssuerPublicKeyHash private
-#endif // FEATURE_FUSION
-
-;
-; win64 common
-;
-#ifdef _WIN64
- GetRuntimeStackWalkInfo
-#endif
-
- Nirvana_Dummy @24 NONAME PRIVATE
-
-#endif //FEATURE_CORECLR
diff --git a/src/dlls/mscorrc/mscorrc.rc b/src/dlls/mscorrc/mscorrc.rc
index 5385327a1f..3352256612 100644
--- a/src/dlls/mscorrc/mscorrc.rc
+++ b/src/dlls/mscorrc/mscorrc.rc
@@ -994,11 +994,7 @@ BEGIN
IDS_EE_LOAD_BAD_MAIN_SIG "Main method for type '%1' has invalid signature."
IDS_EE_LOAD_CIRCULAR_DEPENDENCY "A circular dependency was detected when loading file or assembly '%1'."
-#ifdef FEATURE_CORECLR
IDS_EE_FILE_NOT_FOUND "File or assembly name '%1' was not found."
-#else
- IDS_EE_FILE_NOT_FOUND "File or assembly name '%1', or one of its dependencies, was not found."
-#endif
IDS_EE_TOO_MANY_OPEN_FILES "The system cannot open file '%1'. There may be too many open files."
IDS_EE_SHARING_VIOLATION "Cannot access file '%1' because it is being used by another process."
@@ -1376,11 +1372,7 @@ BEGIN
IDS_EE_CANNOT_HAVE_ASSEMBLY_SPEC "Unexpected assembly-qualifier in a typename."
IDS_EE_NEEDS_ASSEMBLY_SPEC "Typename needs an assembly qualifier."
-#ifdef FEATURE_CORECLR
IDS_EE_FILELOAD_ERROR_GENERIC "Could not load file or assembly '%1'. %2"
-#else
- IDS_EE_FILELOAD_ERROR_GENERIC "Could not load file or assembly '%1' or one of its dependencies. %2"
-#endif
IDS_EE_CRYPTO_UNKNOWN_OPERATION "Unknown import key operation specified."
@@ -1509,11 +1501,7 @@ BEGIN
IDS_CLASSLOAD_OVERLAPPING_INTERFACES "The type '%1' in assembly '%2' has a contracting interface set for some instantiations"
-#ifdef FEATURE_CORECLR
IDS_CLASSLOAD_32BITCLRLOADING64BITASSEMBLY "Attempted to load a 64-bit assembly on a 32-bit platform."
-#else // !FEATURE_CORECLR
- IDS_CLASSLOAD_32BITCLRLOADING64BITASSEMBLY "Attempted to load a 64-bit assembly on a 32-bit platform. Use ReflectionOnlyLoad() instead if trying to load for reflection purposes."
-#endif // FEATURE_CORECLR
IDS_CLASSLOAD_CONSTRAINT_MISMATCH_ON_IMPLICIT_OVERRIDE "Method '%3' on type '%1' from assembly '%2' tried to implicitly override a method with weaker type parameter constraints."
IDS_CLASSLOAD_CONSTRAINT_MISMATCH_ON_IMPLICIT_IMPLEMENTATION "Method '%3' on type '%1' from assembly '%2' tried to implicitly implement an interface method with weaker type parameter constraints."
@@ -1545,11 +1533,7 @@ BEGIN
IDS_UNMARSHALABLE_DEMAND_OBJECT "The security object (Permission or PermissionSet) used for performing a Demand caused an error relating to serialization/deserialization."
IDS_EE_OBJECT_TO_VARIANT_NOT_SUPPORTED "Invalid managed/unmanaged type combination (Marshaling to and from COM VARIANTs isn't supported)."
IDS_EE_OBJECT_TO_ITF_NOT_SUPPORTED "Invalid managed/unmanaged type combination (Marshaling to and from COM interface pointers isn't supported)."
-#ifdef FEATURE_CORECLR
IDS_TYPE_INHERITANCE_RULES_VIOLATED "Inheritance security rules violated by type: '%1'. Derived types must either match the security accessibility of the base type or be less accessible. If the base class has a non-transparent default constructor, the derived class must also have a default constructor, and the method inheritance rules apply across those two methods."
-#else // !FEATURE_CORECLR
- IDS_TYPE_INHERITANCE_RULES_VIOLATED "Inheritance security rules violated by type: '%1'. Derived types must either match the security accessibility of the base type or be less accessible."
-#endif // FEATURE_CORECLR
IDS_METHOD_INHERITANCE_RULES_VIOLATED "Inheritance security rules violated while overriding member: '%1'. Security accessibility of the overriding method must match the security accessibility of the method being overriden."
IDS_CRITICAL_METHOD_ACCESS_DENIED "Attempt to access method %1 in violation of security transparency rules failed."
#ifdef FEATURE_CAS_POLICY
@@ -1574,11 +1558,9 @@ BEGIN
IDS_E_CRITICAL_FIELD_ACCESS_DENIED "Attempt by security transparent method '%1' to access security critical field '%2' failed.%3"
IDS_E_CRITICAL_METHOD_ACCESS_DENIED "Attempt by security transparent method '%1' to access security critical method '%2' failed.%3"
IDS_E_CRITICAL_TYPE_ACCESS_DENIED "Attempt by security transparent method '%1' to access security critical type '%2' failed.%3"
-#ifdef FEATURE_CORECLR
IDS_E_DELEGATE_BINDING_TRANSPARENCY "A delegate of type '%1' cannot be bound to the method '%2' due to security transparency rules. Ensure the delegate type and the method being bound have compatible security transparency."
IDS_E_DELEGATE_FULLTRUST_ARPIC_1 "Delegate '%1' must be bound to a method in a fully-trusted assembly and the method must have the AllowReversePinvokeCallsAttribute."
IDS_E_DELEGATE_FULLTRUST_ARPIC_2 "Cannot create a Delegate for marshalling out unless it is bound to a method in a fully-trusted assembly and the method has the AllowReversePinvokeCallsAttribute."
-#endif
IDS_E_ACCESSING_PRIVATE_FRAMEWORK_CODE "Reflection invocation to internal or private types or members in the framework is not allowed."
IDS_EE_TORNSTATE "Unexpected change made to file '%1'."
@@ -1608,11 +1590,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_ER_APPLICATION "Application: "
IDS_ER_UNKNOWN "unknown"
-#ifndef FEATURE_CORECLR
- IDS_ER_FRAMEWORK_VERSION "Framework Version: "
-#else // FEATURE_CORECLR
IDS_ER_FRAMEWORK_VERSION "CoreCLR Version: "
-#endif // !FEATURE_CORECLR
IDS_ER_UNHANDLEDEXCEPTION "Description: The process was terminated due to an unhandled exception."
IDS_ER_UNHANDLEDEXCEPTIONMSG "Exception Info: "
IDS_ER_MANAGEDFAILFAST "Description: The application requested process termination through System.Environment.FailFast(string message)."
@@ -2117,15 +2095,7 @@ BEGIN
IDS_DIALOG_BOX_IGNORE_BUTTON "&Ignore"
END
-#ifndef FEATURE_CORECLR
-// OOB servicing
-STRINGTABLE DISCARDABLE
-BEGIN
- IDS_EE_ASSEMBLY_ON_DENY_LIST "The assembly %1 that the application tried to load has a known vulnerability. Please go to %2 to find a fix for this issue."
-END
-#endif
-#ifdef FEATURE_CORECLR
STRINGTABLE DISCARDABLE
BEGIN
IDS_EE_BADMARSHAL_TYPE_ANSIBSTR "Marshalling as AnsiBStr is not supported"
@@ -2136,7 +2106,6 @@ BEGIN
IDS_EE_BADMARSHAL_TYPE_IDISPATCH "Marshalling as IDispatch is not supported"
IDS_EE_ERROR_IDISPATCH "IDispatch and IDispatchEx are not supported"
END
-#endif // FEATURE_CORECLR
#ifdef FEATURE_HOST_ASSEMBLY_RESOLVER
STRINGTABLE DISCARDABLE
diff --git a/src/dlls/mscorrc/resource.h b/src/dlls/mscorrc/resource.h
index 77e937a81e..3b87d1e9cb 100644
--- a/src/dlls/mscorrc/resource.h
+++ b/src/dlls/mscorrc/resource.h
@@ -812,16 +812,12 @@
#define IDS_E_TRANSPARENT_CALL_NATIVE 0x2120
#define IDS_E_TRANSPARENT_REFLECTION 0x2121
-#ifdef FEATURE_CORECLR
#define IDS_E_DELEGATE_BINDING_TRANSPARENCY 0x2122
-#endif
#define IDS_E_ACCESSING_PRIVATE_FRAMEWORK_CODE 0x2123
-#ifdef FEATURE_CORECLR
#define IDS_E_DELEGATE_FULLTRUST_ARPIC_1 0x2124
#define IDS_E_DELEGATE_FULLTRUST_ARPIC_2 0x2125
-#endif
#define IDS_ACCESS_EXCEPTION_CONTEXT_LEVEL2_APTCA 0x2200
#define IDS_ACCESS_EXCEPTION_CONTEXT_APTCA_KILLBIT 0x2201
@@ -870,10 +866,8 @@
#define IDS_E_PROF_TIMEOUT_WAITING_FOR_CONCURRENT_GC 0x251D
-#ifdef FEATURE_CORECLR
#define IDS_EE_LINK_FOR_ERROR_MESSAGES 0x2600
#define IDS_EE_LINK_FOR_DEBUGGING_MESSAGES 0x2601
-#endif
#define IDS_DIALOG_BOX_ABORT_BUTTON 0x2602
#define IDS_DIALOG_BOX_DEBUG_BUTTON 0x2603
@@ -920,15 +914,11 @@
#define IDS_EE_INTEROP_DLL_IMPORT_ON_USER_METHOD 0x262b
#endif
-#ifndef FEATURE_CORECLR
-#define IDS_EE_ASSEMBLY_ON_DENY_LIST 0x262c
-#endif
#ifdef FEATURE_COMINTEROP
#define IDS_EE_WINRT_WEAKREF_BAD_TYPE 0x262e
#endif // FEATURE_COMINTEROP
-#ifdef FEATURE_CORECLR
#define IDS_EE_BADMARSHAL_TYPE_ANSIBSTR 0x262f
#define IDS_EE_BADMARSHAL_TYPE_VBBYVALSTR 0x2630
#define IDS_EE_BADMARSHAL_TYPE_REFERENCECUSTOMMARSHALER 0x2631
@@ -936,7 +926,6 @@
#define IDS_EE_BADMARSHAL_TYPE_ASANYA 0x2633
#define IDS_EE_BADMARSHAL_TYPE_IDISPATCH 0x2634
#define IDS_EE_ERROR_IDISPATCH 0x2635
-#endif // FEATURE_CORECLR
#ifdef FEATURE_HOST_ASSEMBLY_RESOLVER
#define IDS_HOST_ASSEMBLY_RESOLVER_ASSEMBLY_ALREADY_LOADED_IN_CONTEXT 0x2636
diff --git a/src/ilasm/asmman.cpp b/src/ilasm/asmman.cpp
index dba481faf2..4f594d67cb 100644
--- a/src/ilasm/asmman.cpp
+++ b/src/ilasm/asmman.cpp
@@ -10,9 +10,6 @@
#include "assembler.h"
#include "strongname.h"
-#ifndef FEATURE_CORECLR
-#include "LegacyActivationShim.h"
-#endif
#include <limits.h>
#include <fusion.h>
@@ -154,76 +151,6 @@ void AsmMan::SetModuleName(__inout_opt __nullterminated char* szName)
}
//==============================================================================================================
// Borrowed from VM\assembly.cpp
-#ifndef FEATURE_CORECLR
-HRESULT GetHash(__in LPWSTR moduleName,
- ALG_ID iHashAlg,
- BYTE** pbCurrentValue, // should be NULL
- DWORD *cbCurrentValue)
-{
- HRESULT hr = E_FAIL;
- HCRYPTPROV hProv = 0;
- HCRYPTHASH hHash = 0;
- DWORD dwCount = sizeof(DWORD);
- PBYTE pbBuffer = NULL;
- DWORD dwBufferLen;
- HANDLE hFile = INVALID_HANDLE_VALUE;
- HANDLE hMapFile = NULL;
-
- hFile = WszCreateFile(moduleName, GENERIC_READ, FILE_SHARE_READ,
- 0, OPEN_EXISTING, 0, 0);
- if (hFile == INVALID_HANDLE_VALUE) return E_FAIL;
-
- dwBufferLen = SafeGetFileSize(hFile,NULL);
- if (dwBufferLen == 0xffffffff)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto exit;
- }
- hMapFile = WszCreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (hMapFile == NULL) goto exit;
-
- pbBuffer = (PBYTE) MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
- if (pbBuffer == NULL) goto exit;
-
- // No need to late bind this stuff, all these crypto API entry points happen
- // to live in ADVAPI32.
-
- if ((!WszCryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) ||
- (!CryptCreateHash(hProv, iHashAlg, 0, 0, &hHash)) ||
- (!CryptHashData(hHash, pbBuffer, dwBufferLen, 0)) ||
- (!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE *) cbCurrentValue,
- &dwCount, 0))) {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto exit;
- }
-
- *pbCurrentValue = new BYTE[*cbCurrentValue];
- if (!(*pbCurrentValue)) {
- hr = E_OUTOFMEMORY;
- goto exit;
- }
-
- if(!CryptGetHashParam(hHash, HP_HASHVAL, *pbCurrentValue, cbCurrentValue, 0)) {
- hr = HRESULT_FROM_WIN32(GetLastError());
- delete[] *pbCurrentValue;
- *pbCurrentValue = 0;
- goto exit;
- }
-
- hr = S_OK;
-
- exit:
- if (pbBuffer) UnmapViewOfFile(pbBuffer);
- if (hMapFile) CloseHandle(hMapFile);
- CloseHandle(hFile);
- if (hHash)
- CryptDestroyHash(hHash);
- if (hProv)
- CryptReleaseContext(hProv, 0);
-
- return hr;
-}
-#endif // !FEATURE_CORECLR
//==============================================================================================================
void AsmMan::AddFile(__in __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob)
@@ -277,13 +204,6 @@ void AsmMan::EmitFiles()
if(m_pAssembly // and assembly is defined
&& m_pAssembly->ulHashAlgorithm) // and hash algorithm is defined...
{ // then try to compute it
-#ifndef FEATURE_CORECLR
- if(SUCCEEDED(GetHash(wzUniBuf,(ALG_ID)(m_pAssembly->ulHashAlgorithm),&pHash,&cbHash)))
- {
- tmp->pHash = new BinStr(pHash,cbHash);
- }
- else
-#endif // !FEATURE_CORECLR
{
pHash = NULL;
cbHash = 0;
@@ -449,145 +369,6 @@ void AsmMan::EndAssembly()
m_pCurAsmRef = NULL;
return;
}
-#ifndef FEATURE_CORECLR
- if(m_pCurAsmRef->isAutodetect)
- {
- IAssemblyName* pIAsmName;
- HRESULT hr;
- // Convert name to Unicode
- WszMultiByteToWideChar(g_uCodePage,0,m_pCurAsmRef->szName,-1,wzUniBuf,dwUniBuf);
- hr = CreateAssemblyNameObject(&pIAsmName,wzUniBuf,CANOF_PARSE_DISPLAY_NAME,NULL);
- if(SUCCEEDED(hr))
- {
- // set enumeration criteria: what is known about AsmRef (besides name)
- if(m_pCurAsmRef->usVerMajor != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_MAJOR_VERSION,&(m_pCurAsmRef->usVerMajor),2);
- if(m_pCurAsmRef->usVerMinor != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_MINOR_VERSION,&(m_pCurAsmRef->usVerMinor),2);
- if(m_pCurAsmRef->usBuild != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_BUILD_NUMBER,&(m_pCurAsmRef->usBuild),2);
- if(m_pCurAsmRef->usRevision != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_REVISION_NUMBER,&(m_pCurAsmRef->usRevision),2);
- if(m_pCurAsmRef->pPublicKeyToken)
- pIAsmName->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN,
- m_pCurAsmRef->pPublicKeyToken->ptr(),
- m_pCurAsmRef->pPublicKeyToken->length());
- if(m_pCurAsmRef->pLocale)
- pIAsmName->SetProperty(ASM_NAME_CULTURE,
- m_pCurAsmRef->pLocale->ptr(),
- m_pCurAsmRef->pLocale->length());
-
- // enumerate assemblies
- IAssemblyEnum* pIAsmEnum = NULL;
- hr = CreateAssemblyEnum(&pIAsmEnum, NULL, pIAsmName, ASM_CACHE_GAC, NULL);
- if(SUCCEEDED(hr))
- {
- IAssemblyName* pIAsmNameFound;
- IAssemblyName* pIAsmNameLatestVer = NULL;
- ULONGLONG ullVer=0, ullVerLatest=0;
- DWORD dwVerHi, dwVerLo;
-
- // find the latest and greatest, if any
- for(;;)
- {
- pIAsmNameFound = NULL;
- hr = pIAsmEnum->GetNextAssembly(NULL,&pIAsmNameFound,0);
- if(SUCCEEDED(hr) && pIAsmNameFound)
- {
-
- pIAsmNameFound->GetVersion(&dwVerHi,&dwVerLo);
- ullVer = (ULONGLONG)dwVerHi;
- ullVer <<= sizeof(DWORD);
- ullVer |= dwVerLo;
- if(ullVer > ullVerLatest)
- {
- if(pIAsmNameLatestVer)
- pIAsmNameLatestVer->Release();
- ullVerLatest = ullVer;
- pIAsmNameLatestVer = pIAsmNameFound;
- }
- else
- pIAsmNameFound->Release();
- }
- else break;
- }
- // if found, fill the gaps
- if(pIAsmNameLatestVer)
- {
- DWORD cbSize=0;
- USHORT usDummy=0;
-
- if(m_pCurAsmRef->pPublicKeyToken == NULL)
- {
- cbSize = 1024;
- pIAsmNameLatestVer->GetProperty(ASM_NAME_PUBLIC_KEY_TOKEN,
- wzUniBuf, &cbSize);
- if(cbSize)
- {
- if((m_pCurAsmRef->pPublicKeyToken = new BinStr()))
- memcpy(m_pCurAsmRef->pPublicKeyToken->getBuff(cbSize),
- wzUniBuf, cbSize);
- }
- }
-
- if(m_pCurAsmRef->usVerMajor == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_MAJOR_VERSION,
- &usDummy, &cbSize);
- m_pCurAsmRef->usVerMajor = usDummy;
- }
- if(m_pCurAsmRef->usVerMinor == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_MINOR_VERSION,
- &usDummy, &cbSize);
- m_pCurAsmRef->usVerMinor = usDummy;
- }
- if(m_pCurAsmRef->usBuild == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_BUILD_NUMBER,
- &usDummy, &cbSize);
- m_pCurAsmRef->usBuild = usDummy;
- }
- if(m_pCurAsmRef->usRevision == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_REVISION_NUMBER,
- &usDummy, &cbSize);
- m_pCurAsmRef->usRevision = usDummy;
- }
-
- if(m_pCurAsmRef->pLocale == NULL)
- {
- cbSize = 1024;
- pIAsmNameLatestVer->GetProperty(ASM_NAME_CULTURE,
- wzUniBuf, &cbSize);
-
- if(cbSize > (DWORD)sizeof(WCHAR))
- {
- if((m_pCurAsmRef->pLocale = new BinStr()))
- memcpy(m_pCurAsmRef->pLocale->getBuff(cbSize),
- wzUniBuf, cbSize);
- }
- }
- pIAsmNameLatestVer->Release();
- }
- else
- report->warn("Failed to autodetect assembly '%s'\n",m_pCurAsmRef->szName);
- // if no assembly found, leave it as is, it might be not a GAC assembly
-
- pIAsmEnum->Release();
- }
- else
- report->error("Failed to enum assemblies %S, hr=0x%08X\n",wzUniBuf,hr);
- pIAsmName->Release();
- }
- else
- report->error("Failed to create assembly name object for %S, hr=0x%08X\n",wzUniBuf,hr);
- } // end if isAutodetect
-#endif // !FEATURE_CORECLR
m_AsmRefLst.PUSH(m_pCurAsmRef);
m_pCurAsmRef->tkTok = TokenFromRid(m_AsmRefLst.COUNT(),mdtAssemblyRef);
}
@@ -608,29 +389,9 @@ void AsmMan::EndAssembly()
// character of the source ('@' for container).
if (*(((Assembler*)m_pAssembler)->m_wzKeySourceName) == L'@')
{
-#ifdef FEATURE_CORECLR
report->error("Error: ilasm on CoreCLR does not support getting public key from container.\n");
m_pCurAsmRef = NULL;
return;
-#else
- // Extract public key from container (works whether
- // container has just a public key or an entire key
- // pair).
- m_sStrongName.m_wzKeyContainer = &((Assembler*)m_pAssembler)->m_wzKeySourceName[1];
- if (FAILED(hr = LegacyActivationShim::StrongNameGetPublicKey_HRESULT(
- m_sStrongName.m_wzKeyContainer,
- NULL,
- 0,
- &m_sStrongName.m_pbPublicKey,
- &m_sStrongName.m_cbPublicKey)))
- {
- report->error("Failed to extract public key from '%S': 0x%08X\n",m_sStrongName.m_wzKeyContainer,hr);
- m_pCurAsmRef = NULL;
- return;
- }
- m_sStrongName.m_fFullSign = TRUE;
- m_sStrongName.m_dwPublicKeyAllocated = AsmManStrongName::AllocatedBySNApi;
-#endif // FEATURE_CORECLR
}
else
{
@@ -696,33 +457,9 @@ void AsmMan::EndAssembly()
// from a consistent place.
if (m_sStrongName.m_fFullSign)
{
-#ifdef FEATURE_CORECLR
report->error("Error: ilasm on CoreCLR does not support full sign.\n");
m_pCurAsmRef = NULL;
return;
-#else
- m_sStrongName.m_pbPrivateKey = m_sStrongName.m_pbPublicKey;
- m_sStrongName.m_cbPrivateKey = m_sStrongName.m_cbPublicKey;
-
- m_sStrongName.m_pbPublicKey = NULL;
- m_sStrongName.m_cbPublicKey = NULL;
- m_sStrongName.m_dwPublicKeyAllocated = AsmManStrongName::NotAllocated;
-
- // Retrieve the public key portion as a byte blob.
- if (FAILED(hr = LegacyActivationShim::StrongNameGetPublicKey_HRESULT(
- NULL,
- m_sStrongName.m_pbPrivateKey,
- m_sStrongName.m_cbPrivateKey,
- &m_sStrongName.m_pbPublicKey,
- &m_sStrongName.m_cbPublicKey)))
- {
- report->error("Failed to extract public key: 0x%08X\n",hr);
- m_pCurAsmRef = NULL;
- return;
- }
-
- m_sStrongName.m_dwPublicKeyAllocated = AsmManStrongName::AllocatedBySNApi;
-#endif // FEATURE_CORECLR
}
}
}
diff --git a/src/ilasm/asmman.hpp b/src/ilasm/asmman.hpp
index 35d8fdc0bc..0ee875b805 100644
--- a/src/ilasm/asmman.hpp
+++ b/src/ilasm/asmman.hpp
@@ -9,9 +9,6 @@
#define ASMMAN_HPP
#include "strongname.h"
-#ifndef FEATURE_CORECLR
-#include "LegacyActivationShim.h"
-#endif
#include "specstrings.h"
struct AsmManFile
@@ -173,13 +170,6 @@ struct AsmManStrongName
AsmManStrongName() { ZeroMemory(this, sizeof(*this)); }
~AsmManStrongName()
{
-#ifndef FEATURE_CORECLR
- if (m_dwPublicKeyAllocated == AllocatedBySNApi)
- {
- LegacyActivationShim::StrongNameFreeBuffer(m_pbPublicKey);
- }
- else
-#endif
if (m_dwPublicKeyAllocated == AllocatedByNew)
delete [] m_pbPublicKey;
diff --git a/src/ilasm/asmtemplates.h b/src/ilasm/asmtemplates.h
index eb2b413abf..b7d3025f02 100644
--- a/src/ilasm/asmtemplates.h
+++ b/src/ilasm/asmtemplates.h
@@ -60,54 +60,6 @@ private:
};
-#if (0)
-template <class T>
-class FIFO
-{
-public:
- inline FIFO() { m_pHead = m_pTail = NULL; m_ulCount = 0;};
- inline ~FIFO() {T *val; while(val = POP()) delete val; };
- void PUSH(T *item)
- {
- m_pTemp = new LIST_EL <T>(item);
- if(m_pTail) m_pTail->m_Next = m_pTemp;
- m_pTail = m_pTemp;
- if(m_pHead == NULL) m_pHead = m_pTemp;
- m_ulCount++;
- };
- T* POP()
- {
- T* ret = NULL;
- if(m_pTemp = m_pHead)
- {
- m_pHead = m_pHead->m_Next;
- ret = m_pTemp->m_Ptr;
- delete m_pTemp;
- if(m_pHead == NULL) m_pTail = NULL;
- m_ulCount--;
- }
- return ret;
- };
- ULONG COUNT() { return m_ulCount; };
- T* PEEK(ULONG idx)
- {
- T* ret = NULL;
- ULONG i;
- if(idx < m_ulCount)
- {
- if(idx == m_ulCount-1) m_pTemp = m_pTail;
- else for(m_pTemp = m_pHead, i = 0; i < idx; m_pTemp = m_pTemp->m_Next, i++);
- ret = m_pTemp->m_Ptr;
- }
- return ret;
- };
-private:
- LIST_EL <T> *m_pHead;
- LIST_EL <T> *m_pTail;
- LIST_EL <T> *m_pTemp;
- ULONG m_ulCount;
-};
-#else
template <class T>
class FIFO
{
@@ -180,7 +132,6 @@ private:
ULONG m_ulOffset;
ULONG m_ulArrLen;
};
-#endif
template <class T> struct Indx256
diff --git a/src/ilasm/assem.cpp b/src/ilasm/assem.cpp
index 18247621f9..6416dfe5c7 100644
--- a/src/ilasm/assem.cpp
+++ b/src/ilasm/assem.cpp
@@ -231,24 +231,18 @@ Assembler::~Assembler()
m_pDisp = NULL;
}
-#ifdef FEATURE_CORECLR
#ifdef FEATURE_PAL
if (g_loader != NULL)
{
g_loader->Finish();
}
#endif
-#else
- if (m_fDidCoInitialise)
- CoUninitialize();
-#endif // FEATURE_CORECLR
}
BOOL Assembler::Init()
{
-#ifdef FEATURE_CORECLR
#ifdef FEATURE_PAL
g_loader = CoreCLRLoader::Create(g_pszExeFile);
if (g_loader == NULL)
@@ -259,14 +253,6 @@ BOOL Assembler::Init()
#else
metaDataGetDispenser = (MetaDataGetDispenserFunc)MetaDataGetDispenser;
#endif // FEATURE_PAL
-#else
- if(!m_fDidCoInitialise)
- {
- if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
- return FALSE;
- m_fDidCoInitialise = TRUE;
- }
-#endif // FEATURE_CORECLR
if (m_pCeeFileGen != NULL) {
if (m_pCeeFile)
m_pCeeFileGen->DestroyCeeFile(&m_pCeeFile);
diff --git a/src/ilasm/assembler.cpp b/src/ilasm/assembler.cpp
index 49d4ee9712..92fd681af6 100644
--- a/src/ilasm/assembler.cpp
+++ b/src/ilasm/assembler.cpp
@@ -99,17 +99,6 @@ mdToken Assembler::ResolveClassRef(mdToken tkResScope, __in __nullterminated con
mdToken *ptkSpecial = NULL;
if(pszFullClassName == NULL) return mdTokenNil;
-#if (0)
- if (m_fInitialisedMetaData == FALSE)
- {
- if (FAILED(InitMetaData())) // impl. see WRITER.CPP
- {
- _ASSERTE(0);
- if(ppClass) *ppClass = NULL;
- return mdTokenNil;
- }
- }
-#endif
switch(strlen(pszFullClassName))
{
@@ -2213,26 +2202,6 @@ void Assembler::EmitBytes(BYTE *p, unsigned len)
BinStr* Assembler::EncodeSecAttr(__in __nullterminated char* szReflName, BinStr* pbsSecAttrBlob, unsigned nProps)
{
unsigned cnt;
-#if (0)
- // Emit MemberRef for .ctor
- mdToken tkMscorlib = m_fIsMscorlib ? 1 : GetAsmRef("mscorlib");
- char buffer[64];
- BinStr *pbsSig = new BinStr();
-
- strcpy(buffer,"System.Security.Permissions.SecurityAction");
- mdToken tkSecAction = ResolveClassRef(tkMscorlib,buffer, NULL);
-
- pbsSig->appendInt8(IMAGE_CEE_CS_CALLCONV_HASTHIS);
- pbsSig->appendInt8(1); //corEmitInt(pbsSig,1);
- pbsSig->appendInt8(ELEMENT_TYPE_VOID);
- pbsSig->appendInt8(ELEMENT_TYPE_VALUETYPE);
- cnt = CorSigCompressToken(tkSecAction, pbsSig->getBuff(5));
- pbsSig->remove(5 - cnt);
-
- char* szName = new char[16];
- strcpy(szName,".ctor");
- MakeMemberRef(tkSecAttr,szName,pbsSig);
-#endif
// build the blob As BinStr
unsigned L = (unsigned) strlen(szReflName);
diff --git a/src/ilasm/assembler.h b/src/ilasm/assembler.h
index 1c211bc3c5..2e3404f7d3 100644
--- a/src/ilasm/assembler.h
+++ b/src/ilasm/assembler.h
@@ -1049,10 +1049,6 @@ public:
void EmitSecurityInfo(mdToken token,
PermissionDecl* pPermissions,
PermissionSetDecl*pPermissionSets);
-#ifndef FEATURE_CORECLR
- HRESULT AllocateStrongNameSignature();
- HRESULT StrongNameSign();
-#endif
BinStr* EncodeSecAttr(__in __nullterminated char* szReflName, BinStr* pbsSecAttrBlob, unsigned nProps);
// Custom values paraphernalia:
@@ -1189,9 +1185,6 @@ public:
unsigned NumTypeDefs() {return m_TypeDefDList.COUNT();};
private:
HRESULT GetCAName(mdToken tkCA, __out LPWSTR *ppszName);
-#ifndef FEATURE_CORECLR
- HRESULT GetSignatureKey();
-#endif
};
#endif // Assember_h
diff --git a/src/ilasm/grammar_after.cpp b/src/ilasm/grammar_after.cpp
index c8634801c7..344e504f05 100644
--- a/src/ilasm/grammar_after.cpp
+++ b/src/ilasm/grammar_after.cpp
@@ -372,16 +372,6 @@ static void AppendStringWithLength(BinStr* pbs, __in __nullterminated char* sz)
/* fetch the next token, and return it Also set the yylval.union if the
lexical token also has a value */
-#if (0)
-
-#define IsAlpha(x) ((('A' <= (x))&&((x) <= 'Z'))||(('a' <= (x))&&((x) <= 'z')))
-#define IsDigit(x) (('0' <= (x))&&((x) <= '9'))
-#define IsAlNum(x) (IsAlpha(x) || IsDigit(x))
-#define IsValidStartingSymbol(x) (IsAlpha(x)||((x)=='#')||((x)=='_')||((x)=='@')||((x)=='$'))
-#define IsValidContinuingSymbol(x) (IsAlNum(x)||((x)=='_')||((x)=='@')||((x)=='$')||((x)=='?'))
-void SetSymbolTables() { ; }
-
-#else
BOOL _Alpha[128];
BOOL _Digit[128];
@@ -433,7 +423,6 @@ BOOL IsAlNum(unsigned x) { return (x < 128)&&_AlNum[x]; }
BOOL IsValidStartingSymbol(unsigned x) { return (x < 128)&&_ValidSS[x]; }
BOOL IsValidContinuingSymbol(unsigned x) { return (x < 128)&&_ValidCS[x]; }
-#endif
char* nextBlank(__in __nullterminated char* curPos)
{
diff --git a/src/ilasm/grammar_before.cpp b/src/ilasm/grammar_before.cpp
index 42d2927fa5..dd30416bae 100644
--- a/src/ilasm/grammar_before.cpp
+++ b/src/ilasm/grammar_before.cpp
@@ -29,17 +29,6 @@ static AsmParse* parser = 0;
#define PASMM (parser->assem->m_pManifest)
#define PENV (parser->penv)
-#if (0)
-
-#define nextchar parser->penv->pfn_nextchar
-#define Sym parser->penv->pfn_Sym
-#define NewStrFromToken parser->penv->pfn_NewStrFromToken
-#define NewStaticStrFromToken parser->penv->pfn_NewStaticStrFromToken
-#define GetDouble parser->penv->pfn_GetDouble
-
-void SetFunctionPtrs() {;}
-
-#else
PFN_NEXTCHAR nextchar;
@@ -57,7 +46,6 @@ void SetFunctionPtrs()
GetDouble = PENV->pfn_GetDouble;
}
-#endif
static char* newStringWDel(__in __nullterminated char* str1, char delimiter, __in __nullterminated char* str3 = 0);
static char* newString(__in __nullterminated const char* str1);
diff --git a/src/ilasm/main.cpp b/src/ilasm/main.cpp
index 2bef40dd47..35f4545a05 100644
--- a/src/ilasm/main.cpp
+++ b/src/ilasm/main.cpp
@@ -248,12 +248,8 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
else if (!_stricmp(szOpt, "DEB"))
{
pAsm->m_dwIncludeDebugInfo = 0x101;
-#ifdef FEATURE_CORECLR
// PDB is ignored under 'DEB' option for ilasm on CoreCLR.
// https://github.com/dotnet/coreclr/issues/2982
-#else
- pAsm->m_fGeneratePDB = TRUE;
-#endif
bNoDebug = FALSE;
WCHAR *pStr = EqualOrColon(argv[i]);
@@ -281,12 +277,8 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
}
else if (!_stricmp(szOpt, "PDB"))
{
-#ifdef FEATURE_CORECLR
// 'PDB' option is ignored for ilasm on CoreCLR.
// https://github.com/dotnet/coreclr/issues/2982
-#else
- pAsm->m_fGeneratePDB = TRUE;
-#endif
bNoDebug = FALSE;
}
else if (!_stricmp(szOpt, "CLO"))
@@ -746,21 +738,8 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
exitval = 1;
pParser->msg("Failed to write output file, error code=0x%08X\n",hr);
}
-#ifndef FEATURE_CORECLR
- else if (pAsm->m_pManifest->m_sStrongName.m_fFullSign)
- {
- // Strong name sign the resultant assembly.
- if(pAsm->m_fReportProgress) pParser->msg("Signing file with strong name\n");
- if (FAILED(hr=pAsm->StrongNameSign()))
- {
- exitval = 1;
- pParser->msg("Failed to strong name sign output file, error code=0x%08X\n",hr);
- }
- }
-#endif
if(bClock) cw.cEnd = GetTickCount();
#define ENC_ENABLED
-#ifdef ENC_ENABLED
if(exitval==0)
{
pAsm->m_fENCMode = TRUE;
@@ -857,7 +836,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
}
} // end for(iFile)
} // end if(exitval==0)
-#endif
}
}
@@ -922,12 +900,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
#pragma warning(pop)
#endif
-#ifndef FEATURE_CORECLR
-HINSTANCE GetModuleInst()
-{
- return (NULL);
-}
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_PAL
int main(int argc, char* str[])
diff --git a/src/ilasm/method.cpp b/src/ilasm/method.cpp
index 18f6c47b00..8fc300c23a 100644
--- a/src/ilasm/method.cpp
+++ b/src/ilasm/method.cpp
@@ -93,16 +93,6 @@ void Method::OpenScope()
{
psc->dwStart = m_pAssembler->m_CurPC;
psc->pSuperScope = m_pCurrScope;
-#if(0)
- LinePC *pLPC = new LinePC;
- if(pLPC)
- {
- pLPC->Line = m_pAssembler->m_ulCurLine;
- pLPC->Column = m_pAssembler->m_ulCurColumn;
- pLPC->PC = m_pAssembler->m_CurPC;
- m_LinePCList.PUSH(pLPC);
- }
-#endif
m_pCurrScope->SubScope.PUSH(psc);
m_pCurrScope = psc;
}
@@ -116,16 +106,6 @@ void Method::CloseScope()
if((pVD = m_Locals.PEEK(pAN->dwAttr))) pVD->bInScope = FALSE;
}
m_pCurrScope->dwEnd = m_pAssembler->m_CurPC;
-#if(0)
- LinePC *pLPC = new LinePC;
- if(pLPC)
- {
- pLPC->Line = m_pAssembler->m_ulCurLine;
- pLPC->Column = m_pAssembler->m_ulCurColumn;
- pLPC->PC = m_pAssembler->m_CurPC;
- m_LinePCList.PUSH(pLPC);
- }
-#endif
m_pCurrScope = m_pCurrScope->pSuperScope;
}
diff --git a/src/ilasm/writer.cpp b/src/ilasm/writer.cpp
index b5b87ce1ad..85f29af5e7 100644
--- a/src/ilasm/writer.cpp
+++ b/src/ilasm/writer.cpp
@@ -10,10 +10,6 @@
#include "assembler.h"
#include "ceefilegenwriter.h"
-#ifndef FEATURE_CORECLR
-#include "strongname.h"
-#include "LegacyActivationShim.h"
-#endif
#ifndef _MSC_VER
//cloned definition from ntimage.h that is removed for non MSVC builds
@@ -34,17 +30,8 @@ HRESULT Assembler::InitMetaData()
if(bClock) bClock->cMDInitBegin = GetTickCount();
-#ifdef FEATURE_CORECLR
hr = metaDataGetDispenser(CLSID_CorMetaDataDispenser,
IID_IMetaDataDispenserEx, (void **)&m_pDisp);
-#else
- hr = LegacyActivationShim::ClrCoCreateInstance(
- CLSID_CorMetaDataDispenser,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_IMetaDataDispenserEx,
- (void **)&m_pDisp);
-#endif
if (FAILED(hr))
goto exit;
@@ -66,25 +53,6 @@ HRESULT Assembler::InitMetaData()
if(FAILED(hr = m_pEmitter->QueryInterface(IID_IMetaDataImport2, (void**)&m_pImporter)))
goto exit;
-#ifndef FEATURE_CORECLR
- hr = CoCreateInstance(CLSID_CorSymWriter_SxS,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_ISymUnmanagedWriter,
- (void **)&m_pSymWriter);
- if(SUCCEEDED(hr))
- {
- if(m_pSymWriter) m_pSymWriter->Initialize((IUnknown*)m_pEmitter,
- m_wzOutputFileName,
- NULL,
- TRUE);
- }
- else
- {
- fprintf(stderr, "Error: QueryInterface(IID_ISymUnmanagedWriter) returns %X\n",hr);
- m_pSymWriter = NULL;
- }
-#endif // !FEATURE_CORECLR
//m_Parser = new AsmParse(m_pEmitter);
m_fInitialisedMetaData = TRUE;
@@ -687,197 +655,6 @@ BYTE HexToByte (CHAR wc)
return (BYTE) (wc - L'a' + 10);
}
-#ifndef FEATURE_CORECLR
-bool GetBytesFromHex (LPCSTR szPublicKeyHexString, ULONG cchPublicKeyHexString, BYTE** buffer, ULONG *cbBufferSize)
-{
- ULONG cchHex = cchPublicKeyHexString;
- if (cchHex % 2 != 0)
- return false;
- *cbBufferSize = cchHex / 2;
-
- *buffer = new BYTE[*cbBufferSize];
- if (!*buffer)
- return false;
-
- for (ULONG i = 0; i < *cbBufferSize; i++)
- {
- BYTE msn = HexToByte(*szPublicKeyHexString);
- BYTE lsn = HexToByte(*(szPublicKeyHexString + 1));
- if (msn == 0xFF || lsn == 0xFF)
- {
- delete[] *buffer;
- return false;
- }
-
- (*buffer)[i] = (BYTE) ( (msn << 4) | lsn );
- szPublicKeyHexString += 2;
- }
-
- return true;
-}
-
-HRESULT Assembler::GetSignatureKey()
-{
- HRESULT hr = S_OK;
- ULONG cbSize = 0;
- void * pvData = NULL;
- LPWSTR pName = NULL;
-
- CustomDescrList* pCDList = &m_pManifest->m_pAssembly->m_CustomDescrList;
-
- for (ULONG i = 0;i < pCDList->COUNT(); i++)
- {
- CustomDescr* pCD = pCDList->PEEK(i);
-
- if(pCD->pBlob)
- {
- pvData = (void *)(pCD->pBlob->ptr());
- cbSize = pCD->pBlob->length();
- pCD->tkOwner = m_pManifest->m_pAssembly->tkTok;
- mdToken tkOwnerType, tkTypeType = TypeFromToken(pCD->tkType);
-
- if (GetCAName(pCD->tkType, &pName) != S_OK)
- continue;
-
- if (wcscmp(pName, L"System.Reflection.AssemblySignatureKeyAttribute") == 0)
- {
- if (cbSize < sizeof(WORD) || GET_UNALIGNED_VAL16(pvData) != 1)
- {
- hr = E_FAIL;
- break;;
- }
- pvData = (unsigned char *)pvData + sizeof(WORD);
- cbSize -= sizeof(WORD);
-
- // String is stored as compressed length, UTF8.
- if (*(const BYTE*)pvData != 0xFF)
- {
- PCCOR_SIGNATURE sig = (PCCOR_SIGNATURE)pvData;
- cbSize -= CorSigUncompressedDataSize(sig);
- DWORD len = CorSigUncompressData(sig);
- pvData = (void *)sig;
- if (cbSize < len)
- {
- hr = E_FAIL;
- break;
- }
-
- AsmManStrongName *pSN = &m_pManifest->m_sStrongName;
- GetBytesFromHex((LPCSTR)pvData, len, &pSN->m_pbSignatureKey, &pSN->m_cbSignatureKey);
- }
-
- break;
- }
-
- if (pName)
- {
- delete pName;
- pName = NULL;
- }
- }
- }
-
- if (pName)
- delete pName;
- return hr;
-}
-
-HRESULT Assembler::AllocateStrongNameSignature()
-{
- HRESULT hr = S_OK;
- HCEESECTION hSection;
- DWORD dwDataLength;
- DWORD dwDataOffset;
- DWORD dwDataRVA;
- VOID *pvBuffer;
- AsmManStrongName *pSN = &m_pManifest->m_sStrongName;
-
- // Pulls the AssemblySignatureKey attribute from m_CustomDescrList
- // If present, populate the pSN->m_pbSignatureKey from the AssemblySignatureKeyAttribute blob
- if (FAILED(hr = GetSignatureKey()))
- {
- return hr;
- }
-
- // Determine size of signature blob.
- if (pSN->m_pbSignatureKey != NULL)
- {
- // If m_pbSignatureKey present use it, else fall back to using identity key.
- if (FAILED(hr = LegacyActivationShim::StrongNameSignatureSize_HRESULT(
- pSN->m_pbSignatureKey,
- pSN->m_cbSignatureKey,
- &dwDataLength)))
- {
- return hr;
- }
- }
- else if (FAILED(hr = LegacyActivationShim::StrongNameSignatureSize_HRESULT(
- pSN->m_pbPublicKey,
- pSN->m_cbPublicKey,
- &dwDataLength)))
- {
- return hr;
- }
-
- // Grab memory in the section for our stuff.
- if (FAILED(hr = m_pCeeFileGen->GetIlSection(m_pCeeFile,
- &hSection)))
- return hr;
-
- if (FAILED(hr = m_pCeeFileGen->GetSectionBlock(hSection,
- dwDataLength,
- 4,
- &pvBuffer)))
- return hr;
-
- // Where did we get that memory?
- if (FAILED(hr = m_pCeeFileGen->GetSectionDataLen(hSection,
- &dwDataOffset)))
- return hr;
-
- dwDataOffset -= dwDataLength;
-
- // Convert to an RVA.
- if (FAILED(hr = m_pCeeFileGen->GetMethodRVA(m_pCeeFile,
- dwDataOffset,
- &dwDataRVA)))
- return hr;
-
- // Emit the directory entry.
- if (FAILED(hr = m_pCeeFileGen->SetStrongNameEntry(m_pCeeFile,
- dwDataLength,
- dwDataRVA)))
- return hr;
-
- return S_OK;
-}
-
-HRESULT Assembler::StrongNameSign()
-{
- LPWSTR wszOutputFile;
- HRESULT hr = S_OK;
- AsmManStrongName *pSN = &m_pManifest->m_sStrongName;
-
- // Determine what the ouput PE was called.
- if (FAILED(hr = m_pCeeFileGen->GetOutputFileName(m_pCeeFile,
- &wszOutputFile)))
- return hr;
-
- // Update the output PE image with a strong name signature.
- if (FAILED(hr = LegacyActivationShim::StrongNameSignatureGeneration_HRESULT(
- wszOutputFile,
- pSN->m_wzKeyContainer,
- pSN->m_pbPrivateKey,
- pSN->m_cbPrivateKey,
- NULL,
- NULL)))
- {
- return hr;
- }
-
- return S_OK;
-}
-#endif // !FEATURE_CORECLR
BOOL Assembler::EmitFieldsMethods(Class* pClass)
{
@@ -1231,13 +1008,6 @@ HRESULT Assembler::CreatePEFile(__in __nullterminated WCHAR *pwzOutputFilename)
if(bClock) bClock->cMDEmit1 = GetTickCount();
-#ifndef FEATURE_CORECLR
- // Allocate space for a strong name signature if we're delay or full
- // signing the assembly.
- if (m_pManifest->m_sStrongName.m_pbPublicKey)
- if (FAILED(hr = AllocateStrongNameSignature()))
- goto exit;
-#endif
if(bClock) bClock->cMDEmit2 = GetTickCount();
diff --git a/src/ilasm/writer_enc.cpp b/src/ilasm/writer_enc.cpp
index 055b2edca9..eee9c00a0a 100644
--- a/src/ilasm/writer_enc.cpp
+++ b/src/ilasm/writer_enc.cpp
@@ -70,28 +70,6 @@ HRESULT Assembler::InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileNam
if(!Init()) goto exit; // close and re-open CeeFileGen and CeeFile
hr = S_OK;
-#ifndef FEATURE_CORECLR
- hr = CoCreateInstance(CLSID_CorSymWriter_SxS,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_ISymUnmanagedWriter,
- (void **)&m_pSymWriter);
- if(SUCCEEDED(hr))
- {
- WCHAR* pwc = &wzOrigFileName[wcslen(wzOrigFileName)];
- wcscat_s(wzOrigFileName,MAX_SCOPE_LENGTH,W(".pdb"));
- if(m_pSymWriter) m_pSymWriter->Initialize((IUnknown*)m_pEmitter,
- wzOrigFileName,
- NULL,
- TRUE);
- *pwc = 0;
- }
- else
- {
- fprintf(stderr, "Error: CoCreateInstance(IID_ISymUnmanagedWriter) returns %X\n",hr);
- m_pSymWriter = NULL;
- }
-#endif
exit:
return hr;
@@ -453,43 +431,6 @@ REPT_STEP
pBaseMDEmit->Release();
}
-#if(0)
-//===================================================================================
- // release SymWriter interfaces
- if (m_pSymWriter != NULL)
- {
- m_pSymWriter->Close();
- m_pSymWriter->Release();
- m_pSymWriter = NULL;
- }
-
- hr = CoCreateInstance(CLSID_CorSymWriter_SxS,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_ISymUnmanagedWriter,
- (void **)&m_pSymWriter);
- if(SUCCEEDED(hr))
- {
- WCHAR* pwc = &pwzOutputFilename[wcslen(pwzOutputFilename)];
- wcscat(pwzOutputFilename,L".pdb");
- if(m_pSymWriter) m_pSymWriter->Initialize((IUnknown*)m_pEmitter,
- pwzOutputFilename,
- NULL,
- TRUE);
- *pwc = 0;
- }
- else
- {
- fprintf(stderr, "Error: CoCreateInstance(IID_ISymUnmanagedWriter) returns %X\n",hr);
- m_pSymWriter = NULL;
- }
-
- m_fENCMode = FALSE;
- if(FAILED(hr=CreatePEFile(pwzOutputFilename)))
- report->msg("Could not create output file, error code=0x%08X\n",hr);
- m_fENCMode = TRUE;
-//=====================================================================================
-#endif
// release all interfaces
if (m_pSymWriter != NULL)
diff --git a/src/ildasm/dasm.cpp b/src/ildasm/dasm.cpp
index 7b6bca926e..0cb5cc8932 100644
--- a/src/ildasm/dasm.cpp
+++ b/src/ildasm/dasm.cpp
@@ -4576,36 +4576,6 @@ BOOL DumpClass(mdTypeDef cl, DWORD dwEntryPointToken, void* GUICookie, ULONG Wha
pszClassName = (char*)(pc1 ? pc1 : "");
pszNamespace = (char*)(pc2 ? pc2 : "");
-#if (0)
-
- if((!IsTdNested(dwClassAttrs)))
- {
- // take care of namespace, if any
- if(strcmp(pszNamespace,g_szNamespace))
- {
- if(strlen(g_szNamespace))
- {
- if(g_szAsmCodeIndent[0]) g_szAsmCodeIndent[strlen(g_szAsmCodeIndent)-2] = 0;
- szptr = &szString[0];
- szptr+=sprintf_s(szptr,SZSTRING_SIZE,"%s%s ",g_szAsmCodeIndent,UNSCOPE());
- sprintf_s(szptr,SZSTRING_REMAINING_SIZE(szptr),COMMENT("// end of namespace %s"),ProperName(g_szNamespace));
- printLine(GUICookie,szString);
- printLine(GUICookie,"");
- }
- strcpy_s(g_szNamespace,MAX_MEMBER_LENGTH,pszNamespace);
- if(strlen(g_szNamespace))
- {
- sprintf_s(szString,SZSTRING_SIZE,"%s%s %s",
- g_szAsmCodeIndent,KEYWORD(".namespace"), ProperName(g_szNamespace));
- printLine(GUICookie,szString);
- sprintf_s(szString,SZSTRING_SIZE,"%s%s",g_szAsmCodeIndent,SCOPE());
- printLine(GUICookie,szString);
- strcat_s(g_szAsmCodeIndent,MAX_MEMBER_LENGTH," ");
- }
- }
- }
-
-#endif
szptr = &szString[0];
szptr+=sprintf_s(szptr,SZSTRING_SIZE,"%s%s ",g_szAsmCodeIndent,KEYWORD(".class"));
@@ -7571,24 +7541,6 @@ DoneInitialization:
}
}
-#if (0)
- /* Third, dump GC/EH info about the native methods, using the IPMap */
- IMAGE_DATA_DIRECTORY *pIPMap;
- if (g_pPELoader->IsPE32())
- {
- pIPMap = &g_pPELoader->ntHeaders32()->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION];
- }
- else
- {
- pIPMap = &g_pPELoader->ntHeaders64()->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION];
- }
- DWORD IPMapSize;
- const BYTE * ipmap;
- IPMapSize = VAL32(pIPMap->Size);
- g_pPELoader->getVAforRVA(VAL32(pIPMap->VirtualAddress), (void **) &ipmap);
-
- DumpNativeInfo(ipmap, IPMapSize);
-#endif
// If there were "ldptr", dump the .rdata section with labels
if(g_iPtrCount)
diff --git a/src/inc/appxutil.h b/src/inc/appxutil.h
index 2892ab7dd8..893c429c95 100644
--- a/src/inc/appxutil.h
+++ b/src/inc/appxutil.h
@@ -24,7 +24,6 @@ template <typename T>
class NewArrayHolder;
BOOL WinRTSupported();
-#ifdef FEATURE_CORECLR
namespace AppX
{
@@ -45,92 +44,6 @@ namespace AppX
#endif // DACCESS_COMPILE
};
-#else // FEATURE_CORECLR
-
-struct AppXRTInfo;
-typedef DPTR(AppXRTInfo) PTR_AppXRTInfo;
-
-//---------------------------------------------------------------------------------------------
-namespace AppX
-{
- // cleans up resources allocated in InitAppXRT()
- void ShutDown();
-
- // Returns true if process is immersive (or if running in mockup environment).
- // NOTE: a return value of true doesn't necessarily indicate that the process is a
- // real Metro app, e.g. it could be an ngen process compiling an AppX assembly.
- bool IsAppXProcess();
-
-#ifdef DACCESS_COMPILE
- bool DacIsAppXProcess();
-#endif // DACCESS_COMPILE
-
- // Returns true if process is immersive (or if running in mockup environment).
- // Use only in NOFAULT regions when you are 100% sure that code:IsAppXProcess has been already called.
- // This function does not initialize (no faults).
- bool IsAppXProcess_Initialized_NoFault();
-
- // Returns true if process is NGen worker compiling an AppX assembly.
- bool IsAppXNGen();
-
- // Returns true if the host OS supports immersive apps.
- inline bool IsAppXSupported()
- { return WinRTSupported() != FALSE; }
-
- LPCWSTR GetHeadPackageMoniker();
-
- HRESULT GetCurrentPackageId(
- __inout PUINT32 pBufferLength,
- __out PBYTE pBuffer);
-
- HRESULT GetCurrentPackageInfo(
- __in UINT32 dwFlags,
- __inout PUINT32 pcbBuffer,
- __out PBYTE pbBuffer,
- __out PUINT32 nCount);
-
- bool IsAdaptiveApp();
- HRESULT GetCurrentPackageRoot(_Inout_ UINT32* length, _Out_opt_ PWSTR packageRoot);
- HRESULT GetWinMetadataDirForAdaptiveApps(_Out_ LPWSTR* winMetadDataDir);
-#ifdef FEATURE_APPX_BINDER
- enum FindFindInPackageFlags
- {
- FindFindInPackageFlags_None = 0,
- FindFindInPackageFlags_AllowLongFormatPath = 1,
- FindFindInPackageFlags_SkipCurrentPackageGraph = 2, // Only search in alt path
- };
-
- // If the function succeeds, pcchPathName is set to the length of the string that is copied to the buffer,
- // in characters, including the terminating null character, and the function returns S_OK. If the buffer
- // is too small, pcchPathName is set to the length of the buffer required (in characters),
- // including the terminating null character, and the function returns ERROR_INSUFFICIENT_BUFFER.
- HRESULT FindFileInCurrentPackage(
- __in PCWSTR pszFileName,
- __inout PUINT32 pcchPathName,
- __out PWSTR pszPathName,
- __in UINT32 uiFlags = PACKAGE_FILTER_CLR_DEFAULT,
- __in PCWSTR *rgwzAltPaths = NULL,
- __in UINT32 cAltPaths = 0,
- FindFindInPackageFlags findInCurrentPackageFlags = FindFindInPackageFlags_None);
-#endif // FEATURE_APPX_BINDER
-
- // Attempts to retrieve the AppContainer SID for the specified process.
- // For non-AppContainer processes the function will return S_FALSE and pAppContainerTokenInfo will be NULL.
- // For AppContainer processes the function will return S_OK and pAppContainerTokenInfo will contain data.
- // Note that there might be legitimate cases where this function fails (caller doesn't have permissions to
- // OpenProcess() for example) so any callers must account for such failures.
- // Use of NewArrayHolder permits method to reuse info for current process (dwPid == self) or to allocate
- // memory (dwPid != self). Cast the result to PTOKEN_APPCONTAINER_INFORMATION;
- HRESULT GetAppContainerTokenInfoForProcess(
- DWORD dwPid,
- NewArrayHolder<BYTE>& pbAppContainerTokenInfo, // Cast to PTOKEN_APPCONTAINER_INFORMATION on return.
- DWORD* pcbAppContainerTokenInfo = nullptr);
-
- // Called during NGen to pretend that we are in a certain package.
- HRESULT SetCurrentPackageForNGen(__in PCWSTR pszPackageFullName);
-}
-
-#endif // FEATURE_CORECLR
#else // FEATURE_APPX
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h
index eb321f3b3b..347cdd0c34 100644
--- a/src/inc/clrconfigvalues.h
+++ b/src/inc/clrconfigvalues.h
@@ -123,13 +123,9 @@ CONFIG_DWORD_INFO(INTERNAL_AppDomainNoUnload, W("AppDomainNoUnload"), 0, "Not us
RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_TargetFrameworkMoniker, W("TargetFrameworkMoniker"), "Allows the test team to specify what TargetFrameworkMoniker to use.", CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU | CLRConfig::IgnoreConfigFiles | CLRConfig::IgnoreWindowsQuirkDB)
RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_AppContextSwitchOverrides, W("AppContextSwitchOverrides"), "Allows default switch values defined in AppContext to be overwritten by values in the Config", CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU | CLRConfig::IgnoreWindowsQuirkDB | CLRConfig::ConfigFile_ApplicationFirst)
-#ifdef FEATURE_CORECLR
// For the proposal and discussion on why finalizers are not run on shutdown by default anymore in CoreCLR, see the API review:
// https://github.com/dotnet/corefx/issues/5205
#define DEFAULT_FinalizeOnShutdown (0)
-#else
-#define DEFAULT_FinalizeOnShutdown (1)
-#endif
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_FinalizeOnShutdown, W("FinalizeOnShutdown"), DEFAULT_FinalizeOnShutdown, "When enabled, on shutdown, blocks all user threads and calls finalizers for all finalizable objects, including live objects")
//
@@ -312,9 +308,7 @@ RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConcurrent, W("gcConcurrent"), (DWORD)-1,
#ifdef FEATURE_CONSERVATIVE_GC
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConservative, W("gcConservative"), 0, "Enables/Disables conservative GC")
#endif
-#ifdef FEATURE_CORECLR
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcServer, W("gcServer"), 0, "Enables server GC")
-#endif
CONFIG_STRING_INFO(INTERNAL_GcCoverage, W("GcCoverage"), "specify a method or regular expression of method names to run with GCStress")
CONFIG_STRING_INFO(INTERNAL_SkipGCCoverage, W("SkipGcCoverage"), "specify a list of assembly names to skip with GC Coverage")
RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_gcForceCompact, W("gcForceCompact"), "When set to true, always do compacting GC")
@@ -386,7 +380,7 @@ CONFIG_STRING_INFO_EX(INTERNAL_JitDebugBreak, W("JitDebugBreak"), "", CLRConfig:
CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitDebuggable, W("JitDebuggable"), "")
CONFIG_DWORD_INFO_EX(INTERNAL_JitDefaultFill, W("JitDefaultFill"), 0xDD, "In debug builds, initialize the memory allocated by the nra with this byte.", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_JitDirectAlloc, W("JitDirectAlloc"), 0, "", CLRConfig::REGUTIL_default)
-#if (!defined(DEBUG) && !defined(_DEBUG)) || (defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR))
+#if !defined(DEBUG) && !defined(_DEBUG)
#define INTERNAL_JitEnableNoWayAssert_Default 0
#else
#define INTERNAL_JitEnableNoWayAssert_Default 1
@@ -477,7 +471,7 @@ RETAIL_CONFIG_DWORD_INFO(EXTERNAL_UseLegacyJit, W("useLegacyJit"), 0, "Set to 1
RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_DisableNativeImageLoadList, W("DisableNativeImageLoadList"), "Refuse to load native images corresponding to one of the assemblies on this semicolon-delimited list of assembly names.", CLRConfig::REGUTIL_default)
#endif
-#if defined(FEATURE_CORECLR) && defined(_TARGET_X86_)
+#if defined(_TARGET_X86_)
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_UseWindowsX86CoreLegacyJit, W("UseWindowsX86CoreLegacyJit"), 0, "Set to 1 to do all JITing with compatjit.dll. Only applicable to Windows x86 .NET Core.")
#endif
@@ -670,9 +664,6 @@ CONFIG_DWORD_INFO_EX(INTERNAL_MD_RegMetaDump, W("MD_RegMetaDump"), 0, "? Dump MD
CONFIG_DWORD_INFO_EX(INTERNAL_MD_TlbImp_BreakOnErr, W("MD_TlbImp_BreakOnErr"), 0, "ASSERT when importing TLB into MD", CLRConfig::REGUTIL_default)
CONFIG_STRING_INFO_EX(INTERNAL_MD_TlbImp_BreakOnTypeImport, W("MD_TlbImp_BreakOnTypeImport"), "ASSERT when importing a type from TLB", (CLRConfig::LookupOptions) (CLRConfig::REGUTIL_default | CLRConfig::DontPrependCOMPlus_))
// MetaData - Desktop-only
-#ifndef FEATURE_CORECLR
-RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_MD_UseMinimalDeltas, W("MD_UseMinimalDeltas"), 1, "? Some MD modifications when applying EnC?", CLRConfig::REGUTIL_default)
-#endif //!FEATURE_CORECLR
CONFIG_DWORD_INFO_EX(INTERNAL_MD_WinMD_Disable, W("MD_WinMD_Disable"), 0, "Never activate the WinMD import adapter", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_MD_WinMD_AssertOnIllegalUsage, W("MD_WinMD_AssertOnIllegalUsage"), 0, "ASSERT if a WinMD import adapter detects a tool incompatibility", CLRConfig::REGUTIL_default)
@@ -777,12 +768,7 @@ RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_NicPath, W("NicPath"), "Redirects NIC a
RETAIL_CONFIG_DWORD_INFO(INTERNAL_NGenTaskDelayStart, W("NGenTaskDelayStart"), 0, "Use NGen Task delay start trigger, instead of critical idle task")
// Flag for cross-platform ngen: Removes all execution of managed or third-party code in the ngen compilation process.
-#ifdef FEATURE_CORECLR
RETAIL_CONFIG_DWORD_INFO(INTERNAL_Ningen, W("Ningen"), 1, "Enable no-impact ngen")
-#else
-// Ningen is off by default for desktop to reduce compat risk
-RETAIL_CONFIG_DWORD_INFO(INTERNAL_Ningen, W("Ningen"), 0, "Enable no-impact ngen")
-#endif
CONFIG_DWORD_INFO(INTERNAL_NoASLRForNgen, W("NoASLRForNgen"), 0, "Turn off IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE bit in generated ngen images. Makes nidump output repeatable from run to run.")
RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NgenAllowOutput, W("NgenAllowOutput"), 0, "If set to 1, the NGEN worker will bind to the parent console, thus allowing stdout output to work", CLRConfig::REGUTIL_default)
@@ -1027,11 +1013,7 @@ CONFIG_DWORD_INFO(INTERNAL_DebugAssertOnMissedCOWPage, W("DebugAssertOnMissedCOW
#endif //FEATURE_LAZY_COW_PAGES
-#ifdef FEATURE_CORECLR
RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 1, "Enable/disable use of ReadyToRun native code") // On by default for CoreCLR
-#else
-RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 0, "Enable/disable use of ReadyToRun native code") // Off by default for desktop
-#endif
RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunExcludeList, W("ReadyToRunExcludeList"), "List of assemblies that cannot use Ready to Run images")
RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunLogFile, W("ReadyToRunLogFile"), "Name of file to log success/failure of using Ready to Run images")
@@ -1128,11 +1110,7 @@ CONFIG_DWORD_INFO_EX(INTERNAL_MscorsnLogging, W("MscorsnLogging"), 0, "Enables s
RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NativeImageRequire, W("NativeImageRequire"), 0, "", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_NestedEhOom, W("NestedEhOom"), 0, "", CLRConfig::REGUTIL_default)
RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NO_SO_NOT_MAINLINE, W("NO_SO_NOT_MAINLINE"), 0, "", CLRConfig::REGUTIL_default)
-#if defined(CROSSGEN_COMPILE) || defined(FEATURE_CORECLR)
#define INTERNAL_NoGuiOnAssert_Default 1
-#else
-#define INTERNAL_NoGuiOnAssert_Default 0
-#endif
RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_NoGuiOnAssert, W("NoGuiOnAssert"), INTERNAL_NoGuiOnAssert_Default, "", CLRConfig::REGUTIL_default)
RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NoProcedureSplitting, W("NoProcedureSplitting"), 0, "", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_NoStringInterning, W("NoStringInterning"), 1, "Disallows string interning. I see no value in it anymore.", CLRConfig::REGUTIL_default)
diff --git a/src/inc/clrhost.h b/src/inc/clrhost.h
index 8cd9e3e9c2..9fe978f95a 100644
--- a/src/inc/clrhost.h
+++ b/src/inc/clrhost.h
@@ -364,9 +364,7 @@ private:
SEMAPHORE_COOKIE m_semaphore;
};
-#if defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
HMODULE GetCLRModule ();
-#endif // defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
#ifndef FEATURE_NO_HOST
/*
diff --git a/src/inc/clrinternal.idl b/src/inc/clrinternal.idl
index 4193d1bfe8..0c93f4ae6d 100644
--- a/src/inc/clrinternal.idl
+++ b/src/inc/clrinternal.idl
@@ -16,17 +16,7 @@ import "unknwn.idl";
// import mscoree.idl for BucketParameters definition
import "mscoree.idl";
-#ifndef FEATURE_CORECLR
-import "hstring.idl";
-#endif //!FEATURE_CORECLR
-#ifndef FEATURE_CORECLR
-interface IActivationFactory;
-cpp_quote("interface IActivationFactory;")
-
-interface IWinRTClassActivator;
-cpp_quote("interface IWinRTClassActivator;")
-#endif //!FEATURE_CORECLR
cpp_quote("#if 0")
@@ -97,30 +87,6 @@ cpp_quote("EXTERN_GUID(CLR_ID_ONECORE_CLR, 0xb1ee760d, 0x6c4a, 0x4533, 0xba, 0x4
// IID_IPrivateManagedExceptionReporting : uuid{AD76A023-332D-4298-8001-07AA9350DCA4}
cpp_quote("EXTERN_GUID(IID_IPrivateManagedExceptionReporting, 0xad76a023, 0x332d, 0x4298, 0x80, 0x01, 0x07, 0xaa, 0x93, 0x50, 0xdc, 0xa4);")
-#ifndef FEATURE_CORECLR
-// CLSID CLRRuntimeHostInternal : uuid(f7721072-bf57-476d-89f8-a7625d27683a)
-cpp_quote("EXTERN_GUID(CLSID_CLRRuntimeHostInternal, 0xf7721072, 0xbf57, 0x476d, 0x89, 0xf8, 0xa7, 0x62, 0x5d, 0x27, 0x68, 0x3a);")
-// IID ICLRRuntimeHostInternal : uuid{07C4E752-3CBA-4A07-9943-B5F206382178}
-cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHostInternal, 0x07c4e752, 0x3cba, 0x4a07, 0x99, 0x43, 0xb5, 0xf2, 0x06, 0x38, 0x21, 0x78);")
-
-// CLSID_CLRShimControlInternal : uuid(62D02A5B-F527-44d8-80BC-650BBD3CB082)
-cpp_quote("EXTERN_GUID(CLSID_CLRShimControlInternal, 0x62d02a5b, 0xf527, 0x44d8, 0x80, 0xbc, 0x65, 0xb, 0xbd, 0x3c, 0xb0, 0x82);")
-
-// IID ICLRShimControlInternal : uuid{826AAAD7-717B-44f8-9BB0-7DAC368B85A5}
-cpp_quote("EXTERN_GUID(IID_ICLRShimControlInternal, 0x826AAAD7, 0x717b, 0x44f8, 0x9b, 0xb0, 0x7d, 0xac, 0x36, 0x8b, 0x85, 0xa5);")
-
-// CLSID_CLRActivationFactory : uuid{5B132A7D-DA8E-461b-A0F2-109141C768CB}
-cpp_quote("EXTERN_GUID(CLSID_CLRActivationFactory, 0x5b132a7d, 0xda8e, 0x461b, 0xa0, 0xf2, 0x10, 0x91, 0x41, 0xc7, 0x68, 0xcb );")
-
-// IID_ICLRActivationFactory : uuid{331F2F6C-385F-462c-9125-816712FB2BC6}
-cpp_quote("EXTERN_GUID(IID_ICLRActivationFactory, 0x331f2f6c, 0x385f, 0x462c, 0x91, 0x25, 0x81, 0x67, 0x12, 0xfb, 0x2b, 0xc6);")
-
-// IID_ICLRActivationFactory2 : uuid{035049E5-2658-40C0-9269-21C48D8F0748}
-cpp_quote("EXTERN_GUID(IID_ICLRActivationFactory2, 0x035049E5, 0x2658, 0x40C0, 0x92, 0x69, 0x21, 0xC4, 0x8D, 0x8F, 0x07, 0x48);")
-
-// IID IID_ICLRExecutionManager: uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D)
-cpp_quote("EXTERN_GUID(IID_ICLRExecutionManager, 0x1000A3E7, 0xB420, 0x4620, 0xAE, 0x30, 0xFB, 0x19, 0xB5, 0x87, 0xAD, 0x1D);")
-#endif // !FEATURE_CORECLR
//*****************************************************************************
// Interface for exposing services from the EE to other DLLs of the CLR.
@@ -327,165 +293,4 @@ interface IPrivateManagedExceptionReporting : IUnknown
HRESULT GetBucketParametersForCurrentException([out]BucketParameters *pParams);
}
-#ifndef FEATURE_CORECLR
-/**************************************************************************************
- ** ICLRRuntimeHostInternal **
- ** This is the functionality used only by CLR internal tools that moved from being **
- ** flat APIs (loading the latest runtime) to something that is runtime-specific and **
- ** requires the runtime to be loaded. **
- **************************************************************************************/
-[
- uuid(07C4E752-3CBA-4A07-9943-B5F206382178),
- version(1.0),
- helpstring("CLR internal hosting interface for V4.0"),
- local
-]
-interface ICLRRuntimeHostInternal : IUnknown
-{
- HRESULT MetaDataGetDispenser(
- [in] REFCLSID rclsid,
- [in] REFIID riid,
- [out, iid_is(riid), retval] IUnknown **ppInterface);
-
- HRESULT GetAssemblyMDImport(
- [in] LPCWSTR wszFileName, // The scope (file name) to open.
- [in] REFIID riid, // Desired interface.
- [out, iid_is(riid), retval] IUnknown **ppIUnk); // Returned interface on success.
-
- HRESULT GetMetaDataInternalInterface(
- [in, size_is(cbData)] BYTE *pbData, // MetaData data.
- [in] ULONG cbData, // MetaData data size.
- [in] DWORD flags, // Flags.
- [in] REFIID riid, // Desired interface.
- [out, iid_is(riid), retval] LPVOID *ppInterface); // Returned interface.
-
- HRESULT GetMetaDataInternalInterfaceFromPublic(
- [in] IUnknown *pInterface, // Given interface.
- [in] REFIID riid, // Desired interface.
- [out, iid_is(riid), retval] LPVOID *ppInterface); // Returned interface.
-
- HRESULT GetMetaDataPublicInterfaceFromInternal(
- [in] IUnknown *pInterface, // Given interface.
- [in] REFIID riid, // Desired interface.
- [out, iid_is(riid), retval] LPVOID *ppInterface); // Returned interface.
-
- /**********************************************************************************
- ** Returns the version string that MD emitter should by default write to images.**
- ** Supersedes: GetCORRequiredVersion **
- **********************************************************************************/
- HRESULT GetImageVersionString(
- [out, size_is(*pcchBuffer), annotation("__out_ecount_opt(*pcchBuffer)")] LPWSTR pwzBuffer, // Returned version string.
- [in, out] DWORD *pcchBuffer); // Buffer size/version length.
-
- /**********************************************************************************
- ** Locks the given module for this runtime. The HRESULT is S_OK if it is the **
- ** runtime represented by this instance, S_FALSE if somebody beat us to it. **
- **********************************************************************************/
- HRESULT LockModuleForRuntime(
- [in] BYTE *pModuleBase, // Address where the module is mapped.
- [in] REFIID riid, // Desired interface.
- [out, iid_is(riid)] LPVOID *ppRuntime); // The owning runtime.
-
- /**********************************************************************************
- ** Asks the Shim to attempt a graceful shutdown of all other runtimes loaded **
- ** in this process, then to exit the process via ::ExitProcess(). V4+ runtimes **
- ** call this instead of ::ExitProcess(). **
- **********************************************************************************/
- HRESULT ShutdownAllRuntimesThenExit(
- [in] UINT exitCode); // Process exit code.
-
- /**********************************************************************************
- ** GetTrueOSVersion - Bypasses the OS compatibility shim **
- **********************************************************************************/
- HRESULT GetTrueOSVersion(
- [out, in] LPOSVERSIONINFO osvi); // OS Version.
-
- /**********************************************************************************
- ** Returns the runtime that a COM component with the given CLSID would be **
- ** activated in. Returns runtime represented by this instance for Fx types. **
- **********************************************************************************/
- HRESULT GetRuntimeForManagedCOMObject(
- [in] REFCLSID rclsid, // CLSID of the component.
- [in] REFIID riid, // Desired runtime interface.
- [out, iid_is(riid), retval] LPVOID *ppRuntime); // Returned runtime.
-}; // interface ICLRRuntimeHostInternal
-
-/**************************************************************************************
- ** ICLRShimControlInternal **
- ** This is the functionality used only by CLR internal tools that moved from being **
- ** flat APIs (loading the latest runtime) to controlshim behavior **
- **************************************************************************************/
-[
- uuid(826AAAD7-717B-44f8-9BB0-7DAC368B85A5),
- version(1.0),
- helpstring("CLR internal hosting interface for V4.0"),
- local
-]
-interface ICLRShimControlInternal : IUnknown
-{
- HRESULT SetShouldSkipSkuCheck(
- [in] BOOL bValue
- );
-}; // interface ICLRRuntimeHostInternal
-
-
-
-/**************************************************************************************
- ** ICLRActivationFactory **
- ** This is the functionality used only by CLR to provide in-proc **
- ** hosting **
- **************************************************************************************/
-[
- uuid(331F2F6C-385F-462c-9125-816712FB2BC6),
- version(1.0),
- helpstring("CLR internal activation factory for V4.5"),
- local
-]
-interface ICLRActivationFactory : IUnknown
-{
- HRESULT CreateFactory([in] LPCWSTR activatableClassId,
- [out, retval] IActivationFactory** factory);
-
-}; // interface ICLRActivationFactory
-
-/**************************************************************************************
- ** ICLRActivationFactory2 **
- ** This is functionality exposed by the CLR to enable hosting WinRT components in a **
- ** non-AppX process **
- **************************************************************************************/
-[
- uuid(035049E5-2658-40C0-9269-21C48D8F0748),
- version(1.0),
- helpstring("CLR internal activation factory for desktop WinRT activation"),
- local
-]
-interface ICLRActivationFactory2 : ICLRActivationFactory
-{
- HRESULT GetClassActivatorForApplication(HSTRING appPath, [out] IWinRTClassActivator** ppActivator);
-};
-
-typedef enum
-{
- PAUSE_APP_DOMAINS = 0x1
-
-} PauseFlags;
-
-[
- uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D),
- version(1.0),
- helpstring("Pause and Resume Interface"),
- pointer_default(unique),
- local
-]
-interface ICLRExecutionManager : IUnknown
-{
- // Pause all managed threads
- // Parameters are ignored and reserved for future use.
- HRESULT Pause([in] DWORD dwAppDomainId, [in] DWORD dwFlags);
-
- // Resume managed threads
- // Parameters are ignored and reserved for future use.
- HRESULT Resume([in] DWORD dwAppDomainId);
-}
-#endif // !FEATURE_CORECLR
diff --git a/src/inc/clrnt.h b/src/inc/clrnt.h
index 08a93a4961..ebea066663 100644
--- a/src/inc/clrnt.h
+++ b/src/inc/clrnt.h
@@ -80,10 +80,8 @@
#define __field_ecount(EHCount)
#endif
-#ifdef FEATURE_CORECLR
#undef _Ret_bytecap_
#define _Ret_bytecap_(_Size)
-#endif
#ifndef NT_SUCCESS
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
diff --git a/src/inc/cor.h b/src/inc/cor.h
index 9fd279e74b..424500930a 100644
--- a/src/inc/cor.h
+++ b/src/inc/cor.h
@@ -190,13 +190,8 @@ DEPRECATED_CLR_STDAPI_(void) CoEEShutDownCOM(void);
#endif //FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
-#ifdef FEATURE_CORECLR
#define MSCOREE_SHIM_W MAIN_CLR_DLL_NAME_W
#define MSCOREE_SHIM_A MAIN_CLR_DLL_NAME_A
-#else
-#define MSCOREE_SHIM_W L"mscoree.dll"
-#define MSCOREE_SHIM_A "mscoree.dll"
-#endif // FEATURE_CORECLR
#define SWITCHOUT_HANDLE_VALUE ((HANDLE)(LONG_PTR)-2)
diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h
index 6b1fdb775a..9a8c6b0f8b 100644
--- a/src/inc/corcompile.h
+++ b/src/inc/corcompile.h
@@ -190,14 +190,8 @@ enum CorCompileCodegen
CORCOMPILE_CODEGEN_PROFILING = 0x0004, // supports profiling
CORCOMPILE_CODEGEN_PROF_INSTRUMENTING = 0x0008, // code is instrumented to collect profile count info
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
- CORCOMPILE_CODEGEN_USE_RYUJIT = 0x0100, // code is generated by Ryu JIT
-#endif
};
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
-bool UseRyuJit();
-#endif
// Used for INativeImageInstallInfo::GetConfigMask()
// A bind will ask for the particular bits it needs set; if all bits are set, it is a match. Additional
@@ -833,13 +827,8 @@ struct CORCOMPILE_ASSEMBLY_SIGNATURE
typedef enum
{
-#ifdef FEATURE_CORECLR
CORECLR_INFO,
CROSSGEN_COMPILER_INFO,
-#else
- CLR_INFO,
- NGEN_COMPILER_INFO,
-#endif
NUM_RUNTIME_DLLS
} CorCompileRuntimeDlls;
@@ -894,14 +883,6 @@ struct CORCOMPILE_VERSION_INFO
};
-#ifndef FEATURE_CORECLR
-enum CorCompileDependencyInfo
-{
-
- CORCOMPILE_DEPENDENCY_PEKIND_MASK = 0xff00,
- CORCOMPILE_DEPENDENCY_PEKIND_SHIFT = 8,
-};
-#endif //!FEATURE_CORECLR
struct CORCOMPILE_DEPENDENCY
@@ -916,9 +897,6 @@ struct CORCOMPILE_DEPENDENCY
CORCOMPILE_NGEN_SIGNATURE signNativeImage; // INVALID_NGEN_SIGNATURE if this a soft-bound dependency
-#ifndef FEATURE_CORECLR
- CorCompileDependencyInfo dependencyInfo; //Flags about the dependency
-#endif //!FEATURE_CORECLR
};
/*********************************************************************************/
@@ -1566,19 +1544,6 @@ class ICorCompileInfo
CORINFO_MODULE_HANDLE *pHandle
) = 0;
-#ifndef FEATURE_CORECLR
- // Check if the assembly supports automatic NGen
- virtual BOOL SupportsAutoNGen(
- CORINFO_ASSEMBLY_HANDLE assembly
- ) = 0;
-
- // Tell OS to set cached signing level of the native image based on input assemblies
- virtual HRESULT SetCachedSigningLevel(
- HANDLE hNI,
- HANDLE *pModules,
- COUNT_T nModules
- ) = 0;
-#endif
// Checks to see if an up to date zap exists for the
// assembly
@@ -1900,9 +1865,7 @@ extern "C" unsigned __stdcall PartialNGenStressPercentage();
// create a PDB dumping all functions in hAssembly into pdbPath
extern "C" HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath, LPCWSTR pDiasymreaderPath);
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
extern bool g_fNGenMissingDependenciesOk;
-#endif
extern bool g_fNGenWinMDResilient;
diff --git a/src/inc/corhost.h b/src/inc/corhost.h
index 579088ca61..8c634a926b 100644
--- a/src/inc/corhost.h
+++ b/src/inc/corhost.h
@@ -46,210 +46,6 @@ class DangerousNonHostedSpinLock;
class AppDomain;
class Assembly;
-#if !defined(FEATURE_CORECLR)
-class CorThreadpool : public ICorThreadpool
-{
-public:
- HRESULT STDMETHODCALLTYPE CorRegisterWaitForSingleObject(PHANDLE phNewWaitObject,
- HANDLE hWaitObject,
- WAITORTIMERCALLBACK Callback,
- PVOID Context,
- ULONG timeout,
- BOOL executeOnlyOnce,
- BOOL* pResult);
-
- HRESULT STDMETHODCALLTYPE CorBindIoCompletionCallback(HANDLE fileHandle, LPOVERLAPPED_COMPLETION_ROUTINE callback);
-
- HRESULT STDMETHODCALLTYPE CorUnregisterWait(HANDLE hWaitObject,HANDLE CompletionEvent, BOOL* pResult);
-
- HRESULT STDMETHODCALLTYPE CorQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,PVOID Context,BOOL executeOnlyOnce, BOOL* pResult );
-
- HRESULT STDMETHODCALLTYPE CorCallOrQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,PVOID Context,BOOL* pResult );
-
- HRESULT STDMETHODCALLTYPE CorCreateTimer(PHANDLE phNewTimer,
- WAITORTIMERCALLBACK Callback,
- PVOID Parameter,
- DWORD DueTime,
- DWORD Period,
- BOOL* pResult);
-
- HRESULT STDMETHODCALLTYPE CorDeleteTimer(HANDLE Timer, HANDLE CompletionEvent, BOOL* pResult);
-
- HRESULT STDMETHODCALLTYPE CorChangeTimer(HANDLE Timer,ULONG DueTime,ULONG Period, BOOL* pResult);
-
- HRESULT STDMETHODCALLTYPE CorSetMaxThreads(DWORD MaxWorkerThreads,
- DWORD MaxIOCompletionThreads);
-
- HRESULT STDMETHODCALLTYPE CorGetMaxThreads(DWORD *MaxWorkerThreads,
- DWORD *MaxIOCompletionThreads);
-
- HRESULT STDMETHODCALLTYPE CorGetAvailableThreads(DWORD *AvailableWorkerThreads,
- DWORD *AvailableIOCompletionThreads);
-};
-
-class CorGCHost : public IGCHost2
-{
-public:
- // IGCHost
- STDMETHODIMP STDMETHODCALLTYPE SetGCStartupLimits(
- DWORD SegmentSize,
- DWORD MaxGen0Size);
-
- STDMETHODIMP STDMETHODCALLTYPE Collect(
- LONG Generation);
-
- STDMETHODIMP STDMETHODCALLTYPE GetStats(
- COR_GC_STATS *pStats);
-
- STDMETHODIMP STDMETHODCALLTYPE GetThreadStats(
- DWORD *pFiberCookie,
- COR_GC_THREAD_STATS *pStats);
-
- STDMETHODIMP STDMETHODCALLTYPE SetVirtualMemLimit(
- SIZE_T sztMaxVirtualMemMB);
-
- // IGCHost2
- STDMETHODIMP STDMETHODCALLTYPE SetGCStartupLimitsEx(
- SIZE_T SegmentSize,
- SIZE_T MaxGen0Size);
-
-private:
-
- HRESULT _SetGCSegmentSize(SIZE_T SegmentSize);
- HRESULT _SetGCMaxGen0Size(SIZE_T MaxGen0Size);
-};
-
-class CorConfiguration : public ICorConfiguration
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE SetGCThreadControl(
- /* [in] */ IGCThreadControl __RPC_FAR *pGCThreadControl);
-
- virtual HRESULT STDMETHODCALLTYPE SetGCHostControl(
- /* [in] */ IGCHostControl __RPC_FAR *pGCHostControl);
-
- virtual HRESULT STDMETHODCALLTYPE SetDebuggerThreadControl(
- /* [in] */ IDebuggerThreadControl __RPC_FAR *pDebuggerThreadControl);
-
- virtual HRESULT STDMETHODCALLTYPE AddDebuggerSpecialThread(
- /* [in] */ DWORD dwSpecialThreadId);
-
- // This mechanism isn't thread-safe with respect to reference counting, because
- // the runtime will use the cached pointer without adding extra refcounts to protect
- // itself. So if one thread calls GetGCThreadControl & another thread calls
- // ICorHost::SetGCThreadControl, we have a race.
- static IGCThreadControl *GetGCThreadControl()
- {
- LIMITED_METHOD_CONTRACT;
-
- return m_CachedGCThreadControl;
- }
-
- static IGCHostControl *GetGCHostControl()
- {
- LIMITED_METHOD_CONTRACT;
-
- return m_CachedGCHostControl;
- }
-
- static IDebuggerThreadControl *GetDebuggerThreadControl()
- {
- LIMITED_METHOD_CONTRACT;
-
- return m_CachedDebuggerThreadControl;
- }
-
- static DWORD GetDebuggerSpecialThreadCount()
- {
- LIMITED_METHOD_CONTRACT;
-
- return m_DSTCount;
- }
-
- static DWORD *GetDebuggerSpecialThreadArray()
- {
- LIMITED_METHOD_CONTRACT;
-
- return m_DSTArray;
- }
-
- // Helper function that returns true if the thread is in the debugger special thread list
- static BOOL IsDebuggerSpecialThread(DWORD dwThreadId);
-
- // Helper function to update the thread list in the debugger control block
- static HRESULT RefreshDebuggerSpecialThreadList();
-
- // Clean up debugger thread control object, called at shutdown
- static void CleanupDebuggerThreadControl();
-
-private:
- // Cache the IGCThreadControl interface until the EE is started, at which point
- // we pass it through.
- static IGCThreadControl *m_CachedGCThreadControl;
- static IGCHostControl *m_CachedGCHostControl;
- static IDebuggerThreadControl *m_CachedDebuggerThreadControl;
-
- // Array of ID's of threads that should be considered "special" to
- // the debugging services.
- static DWORD *m_DSTArray;
- static DWORD m_DSTArraySize;
- static DWORD m_DSTCount;
-};
-
-class CorValidator : public IValidator
-{
-protected:
- CorValidator() {LIMITED_METHOD_CONTRACT;}
-
-public:
- STDMETHODIMP STDMETHODCALLTYPE Validate(
- IVEHandler *veh,
- IUnknown *pAppDomain,
- unsigned long ulFlags,
- unsigned long ulMaxError,
- unsigned long token,
- __in_z LPWSTR fileName,
- BYTE *pe,
- unsigned long ulSize);
-
- STDMETHODIMP STDMETHODCALLTYPE FormatEventInfo(
- HRESULT hVECode,
- VEContext Context,
- __out_ecount(ulMaxLength) LPWSTR msg,
- unsigned long ulMaxLength,
- SAFEARRAY *psa);
-};
-
-class CLRValidator : public ICLRValidator
-{
-protected:
- CLRValidator() {LIMITED_METHOD_CONTRACT;}
-
-public:
- STDMETHODIMP STDMETHODCALLTYPE Validate(
- IVEHandler *veh,
- unsigned long ulAppDomainId,
- unsigned long ulFlags,
- unsigned long ulMaxError,
- unsigned long token,
- __in_z LPWSTR fileName,
- BYTE *pe,
- unsigned long ulSize);
-
- STDMETHODIMP STDMETHODCALLTYPE FormatEventInfo(
- HRESULT hVECode,
- VEContext Context,
- __out_ecount(ulMaxLength) LPWSTR msg,
- unsigned long ulMaxLength,
- SAFEARRAY *psa);
-};
-
-class CorDebuggerInfo : public IDebuggerInfo
-{
-public:
- STDMETHODIMP IsDebuggerAttached(BOOL *pbAttached);
-};
-#endif // !defined(FEATURE_CORECLR)
class CorExecutionManager
: public ICLRExecutionManager
@@ -271,9 +67,7 @@ protected:
CorRuntimeHostBase()
:m_Started(FALSE),
m_cRef(0)
-#ifdef FEATURE_CORECLR
, m_fStarted(FALSE)
-#endif // FEATURE_CORECLR
{LIMITED_METHOD_CONTRACT;}
STDMETHODIMP_(ULONG) AddRef(void);
@@ -336,11 +130,9 @@ protected:
LONG m_cRef; // Ref count.
-#ifdef FEATURE_CORECLR
// This flag will be used to ensure that a CoreCLR host can invoke Start/Stop in pairs only.
BOOL m_fStarted;
BOOL m_fAppDomainCreated; // this flag is used when an appdomain can only create a single appdomain
-#endif // FEATURE_CORECLR
static ULONG m_Version; // Version of ICorRuntimeHost.
// Some functions are only available in ICLRRuntimeHost.
@@ -358,162 +150,6 @@ public:
};
-#if !defined(FEATURE_CORECLR) // simple hosting
-class CorHost :
- public CorRuntimeHostBase, public ICorRuntimeHost, public CorThreadpool
- , public CorGCHost, public CorConfiguration
- , public CorValidator, public CorDebuggerInfo
- , public CorExecutionManager
-{
-public:
- CorHost() {WRAPPER_NO_CONTRACT;}
-
- // *** IUnknown methods ***
- STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
- STDMETHODIMP_(ULONG) AddRef(void)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::AddRef();
- }
- STDMETHODIMP_(ULONG) Release(void);
-
-
- // *** ICorRuntimeHost methods ***
- // Returns an object for configuring the runtime prior to
- // it starting. If the runtime has been initialized this
- // routine returns an error. See ICorConfiguration.
- STDMETHODIMP GetConfiguration(ICorConfiguration** pConfiguration);
-
-
- // Starts the runtime. This is equivalent to CoInitializeCor();
- STDMETHODIMP Start(void);
-
- STDMETHODIMP Stop();
-
- // Creates a domain in the runtime. The identity array is
- // a pointer to an array TYPE containing IIdentity objects defining
- // the security identity.
- STDMETHODIMP CreateDomain(LPCWSTR pwzFriendlyName, // Optional
- IUnknown* pIdentityArray, // Optional
- IUnknown ** pAppDomain)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::CreateDomain(pwzFriendlyName,pIdentityArray,pAppDomain);
- }
-
- // Returns the default domain.
- STDMETHODIMP GetDefaultDomain(IUnknown ** pAppDomain)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::GetDefaultDomain(pAppDomain);
- }
-
- // Enumerate currently existing domains.
- STDMETHODIMP EnumDomains(HDOMAINENUM *hEnum)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::EnumDomains(hEnum);
- }
-
- // Returns S_FALSE when there are no more domains. A domain
- // is passed out only when S_OK is returned.
- STDMETHODIMP NextDomain(HDOMAINENUM hEnum,
- IUnknown** pAppDomain)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::NextDomain(hEnum,pAppDomain);
- }
-
- // Close the enumeration releasing resources
- STDMETHODIMP CloseEnum(HDOMAINENUM hEnum)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::CloseEnum(hEnum);
- }
-
- STDMETHODIMP CreateDomainEx(LPCWSTR pwzFriendlyName,
- IUnknown* pSetup, // Optional
- IUnknown* pEvidence, // Optional
- IUnknown ** pAppDomain)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::CreateDomainEx(pwzFriendlyName,pSetup,pEvidence,pAppDomain);
- }
-
- // Create appdomain setup object that can be passed into CreateDomainEx
- STDMETHODIMP CreateDomainSetup(IUnknown** pAppDomainSetup)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::CreateDomainSetup(pAppDomainSetup);
- }
-
- // Create Evidence object that can be passed into CreateDomainEx
- STDMETHODIMP CreateEvidence(IUnknown** pEvidence)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::CreateEvidence(pEvidence);
- }
-
- // Unload a domain, releasing the reference will only release the
- // the wrapper to the domain not unload the domain.
- STDMETHODIMP UnloadDomain(IUnknown* pAppDomain)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::UnloadDomain(pAppDomain);
- }
-
- // Returns the threads domain if there is one.
- STDMETHODIMP CurrentDomain(IUnknown ** pAppDomain)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::CurrentDomain(pAppDomain);
- }
-
- // TODO: Following 4 APIs should be move to CorHost for V1.
- STDMETHODIMP CreateLogicalThreadState(); // Return code.
- STDMETHODIMP DeleteLogicalThreadState(); // Return code.
- STDMETHODIMP SwitchInLogicalThreadState( // Return code.
- DWORD *pFiberCookie // [in] Cookie that indicates the fiber to use.
- );
-
- STDMETHODIMP SwitchOutLogicalThreadState( // Return code.
- DWORD **pFiberCookie // [out] Cookie that indicates the fiber being switched out.
- );
-
- STDMETHODIMP LocksHeldByLogicalThread( // Return code.
- DWORD *pCount // [out] Number of locks that the current thread holds.
- )
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::LocksHeldByLogicalThread(pCount);
- }
-
- // Class factory hook-up.
- static HRESULT CreateObject(REFIID riid, void **ppUnk);
-
- STDMETHODIMP MapFile( // Return code.
- HANDLE hFile, // [in] Handle for file
- HMODULE *hMapAddress // [out] HINSTANCE for mapped file
- )
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
- return CorRuntimeHostBase::MapFile(hFile,hMapAddress);
- }
-};
-#endif // !defined(FEATURE_CORECLR)
class ConnectionNameTable;
typedef DPTR(class ConnectionNameTable) PTR_ConnectionNameTable;
@@ -725,17 +361,7 @@ class CorHost2 :
#ifndef FEATURE_PAL
, public IPrivateManagedExceptionReporting /* This interface is for internal Watson testing only*/
#endif // FEATURE_PAL
-#ifdef FEATURE_CORECLR
, public ICLRRuntimeHost2
-#else
- , public CorThreadpool
- , public CorGCHost
- , public CorConfiguration
- , public CLRValidator
- , public CorDebuggerInfo
- , public ICLRRuntimeHost
- , public ICLRPrivRuntime
-#endif // FEATURE_CORECLR
, public CorExecutionManager
{
friend struct _DacGlobals;
@@ -755,12 +381,6 @@ public:
// *** ICorRuntimeHost methods ***
-#ifndef FEATURE_CORECLR
- // Returns an object for configuring the runtime prior to
- // it starting. If the runtime has been initialized this
- // routine returns an error. See ICorConfiguration.
- STDMETHODIMP GetConfiguration(ICorConfiguration** pConfiguration);
-#endif // FEATURE_CORECLR
#ifndef FEATURE_PAL
// defined in IPrivateManagedExceptionReporting interface for internal Watson testing only
@@ -818,7 +438,6 @@ public:
LPCWSTR pwzArgument,
DWORD *pReturnValue);
-#ifdef FEATURE_CORECLR
// *** ICLRRuntimeHost2 methods ***
STDMETHODIMP CreateAppDomainWithManager(
LPCWSTR wszFriendlyName,
@@ -853,44 +472,13 @@ public:
LPCWSTR* argv,
DWORD* pReturnValue);
-#endif // !FEATURE_CORECLR
-#if !defined(FEATURE_CORECLR)
- /**********************************************************************************
- ** ICLRPrivRuntime Methods
- **********************************************************************************/
- STDMETHODIMP GetInterface(
- REFCLSID rclsid,
- REFIID riid,
- LPVOID * ppUnk);
-
- STDMETHODIMP CreateAppDomain(
- LPCWSTR pwzFriendlyName,
- ICLRPrivBinder * pBinder,
- LPDWORD pdwAppDomainId);
-
- STDMETHODIMP CreateDelegate(
- DWORD appDomainID,
- LPCWSTR wszAssemblyName,
- LPCWSTR wszClassName,
- LPCWSTR wszMethodName,
- LPVOID * ppvDelegate);
-
- STDMETHODIMP ExecuteMain(
- ICLRPrivBinder * pBinder,
- int * pRetVal);
-
-#endif // !FEATURE_CORECLR
static IHostControl *GetHostControl ()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostControl;
-#endif // FEATURE_CORECLR
}
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
@@ -898,110 +486,70 @@ public:
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostMemoryManager;
-#endif // FEATURE_CORECLR
}
static IHostMalloc *GetHostMalloc ()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostMalloc;
-#endif // FEATURE_CORECLR
}
static IHostTaskManager *GetHostTaskManager ()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostTaskManager;
-#endif // FEATURE_CORECLR
}
static IHostThreadpoolManager *GetHostThreadpoolManager ()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostThreadpoolManager;
-#endif // FEATURE_CORECLR
}
static IHostIoCompletionManager *GetHostIoCompletionManager ()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostIoCompletionManager;
-#endif // FEATURE_CORECLR
}
static IHostSyncManager *GetHostSyncManager ()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostSyncManager;
-#endif // FEATURE_CORECLR
}
static IHostAssemblyManager *GetHostAssemblyManager()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostAssemblyManager;
-#endif // FEATURE_CORECLR
}
static IHostGCManager *GetHostGCManager()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostGCManager;
-#endif // FEATURE_CORECLR
}
static IHostSecurityManager *GetHostSecurityManager()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostSecurityManager;
-#endif // FEATURE_CORECLR
}
static IHostPolicyManager *GetHostPolicyManager ()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_HostPolicyManager;
-#endif // FEATURE_CORECLR
}
#endif // FEATURE_INCLUDE_ALL_INTERFACES
@@ -1009,12 +557,7 @@ public:
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return 0;
-#else // FEATURE_CORECLR
- _ASSERTE (m_HostOverlappedExtensionSize != -1);
- return m_HostOverlappedExtensionSize;
-#endif // FEATURE_CORECLR
}
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
@@ -1022,32 +565,13 @@ public:
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- return m_pHostDomainNeutralAsms;
-#endif // FEATURE_CORECLR
}
#endif // FEATURE_INCLUDE_ALL_INTERFACES
-#ifndef FEATURE_CORECLR
- static HRESULT SetFlagsAndHostConfig(STARTUP_FLAGS dwStartupFlags, LPCWSTR pwzHostConfigFile, BOOL fFinalize);
- static LPCWSTR GetHostConfigFile();
-
- static void GetDefaultAppDomainProperties(StringArrayList **ppPropertyNames, StringArrayList **ppPropertyValues);
-#endif // !FEATURE_CORECLR
static STARTUP_FLAGS GetStartupFlags();
-#ifndef FEATURE_CORECLR
- static HRESULT SetPropertiesForDefaultAppDomain(DWORD nProperties,
- __in_ecount(nProperties) LPCWSTR *pwszPropertyNames,
- __in_ecount(nProperties) LPCWSTR *pwszPropertyValues);
-
- static HRESULT SetAppDomainManagerType(LPCWSTR wszAppDomainManagerAssembly,
- LPCWSTR wszAppDomainManagerType,
- EInitializeNewDomainFlags dwInitializeDomainFlags);
-#endif // FEATURE_CORECLR
static LPCWSTR GetAppDomainManagerAsm();
@@ -1069,14 +593,12 @@ public:
static BOOL IsLoadFromBlocked(); // LoadFrom, LoadFile and Load(byte[]) are blocked in certain hosting scenarios
private:
-#ifdef FEATURE_CORECLR
// This flag indicates if this instance was the first to load and start CoreCLR
BOOL m_fFirstToLoadCLR;
// This flag indicates if the host has authenticated with us or not
BOOL m_fIsHostAuthenticated;
-#endif // FEATURE_CORECLR
// Helpers for both ICLRRuntimeHost2 and ICLRPrivRuntime
HRESULT _CreateAppDomain(
@@ -1087,9 +609,6 @@ private:
int nProperties,
LPCWSTR* pPropertyNames,
LPCWSTR* pPropertyValues,
-#if !defined(FEATURE_CORECLR)
- ICLRPrivBinder* pBinder,
-#endif
DWORD* pAppDomainID);
HRESULT _CreateDelegate(
@@ -1110,29 +629,6 @@ private:
static LPCWSTR s_wszAppDomainManagerType;
static EInitializeNewDomainFlags s_dwDomainManagerInitFlags;
-#if !defined(FEATURE_CORECLR)
- static StringArrayList s_defaultDomainPropertyNames;
- static StringArrayList s_defaultDomainPropertyValues;
-
-protected:
- static IHostMemoryManager *m_HostMemoryManager;
- static IHostMalloc *m_HostMalloc;
- static IHostTaskManager *m_HostTaskManager;
- static IHostThreadpoolManager *m_HostThreadpoolManager;
- static IHostIoCompletionManager *m_HostIoCompletionManager;
- static IHostSyncManager *m_HostSyncManager;
- static IHostAssemblyManager *m_HostAssemblyManager;
- static IHostGCManager *m_HostGCManager;
- static IHostSecurityManager *m_HostSecurityManager;
- static IHostPolicyManager *m_HostPolicyManager;
- static int m_HostOverlappedExtensionSize;
- static ICLRAssemblyReferenceList *m_pHostDomainNeutralAsms;
-
- static WCHAR m_wzHostConfigFile[_MAX_PATH];
-
- static BOOL m_dwFlagsFinalized;
- static DangerousNonHostedSpinLock m_FlagsLock; // protects the flags and host config
-#endif // !defined(FEATURE_CORECLR)
SVAL_DECL(STARTUP_FLAGS, m_dwStartupFlags);
};
diff --git a/src/inc/corpolicy.h b/src/inc/corpolicy.h
index ce37db463e..21d615bc82 100644
--- a/src/inc/corpolicy.h
+++ b/src/inc/corpolicy.h
@@ -28,46 +28,6 @@ extern "C" {
{ 0xd41e4f1f, 0xa407, 0x11d1, {0x8b, 0xc9, 0x0, 0xc0, 0x4f, 0xa3, 0xa, 0x41 } }
-#ifndef FEATURE_CORECLR
-// See if we're set up to do a version check
-#if (VER_MAJORVERSION < 4)
-#error "Looks like major version isn't set correctly. Are you including product_version.h?"
-#endif
-
-// The following check has been added to ensure the right thing is done
-// for SxS compatibility of mscorsecimpl.dll when moving to a new framework
-// version.
-//
-// The library is registered using a full path and a GUID in the following location:
-// HKLM\SOFTWARE\Microsoft\Cryptography\Providers\Trust\*
-// With a new SxS version of the framework, we need to move to a new
-// GUID so older versions continue to work unimpacted.
-//
-// The check will fail when the runtime version changes; when it does,
-// please do the following:
-//
-// If the new version is NOT a SxS release with the version number in the #if,
-// update the version number in the #if below to the new version and you're done.
-//
-// If the new release is a SxS release, then there's a bit more work involved:
-// 1. Change COREE_POLICY_PROVIDER in CorPolicy.h to a new GUID.
-// 2. Update batchSetup to use the new GUID. To do so, update
-// all occurrences of the GUID in
-// ndp\clr\src\dlls\mscorsecimpl\mscorsecimpl.vrg
-// 3. Update "real" setup to use the new GUID. To do so, update
-// all occurrences of the GUID in
-// setupauthoring\netfx\clr\Components\mscorsec.dll.ddc
-// 4. Update the version number in the #if below.
-
-#if !(VER_MAJORVERSION == 4 && VER_MINORVERSION == 0)
-#error "The guid for mscorsecimpl needs to change when the runtime version changes"
-#endif
-
-// {A7F4C378-21BE-494e-BA0F-BB12C5D208C5}
-#define COREE_POLICY_PROVIDER \
-{ 0xa7f4c378, 0x21be, 0x494e, {0xba, 0x0f, 0xbb, 0x12, 0xc5, 0xd2, 0x08, 0xc5 } }
-
-#endif //#ifndef FEATURE_CORECLR
// This structure is returned from the winverify trust call, free up the structure
// using CoTaskMemAlloc except for COREE_POLICY_PROVIDER which uses LocalALLoc.
diff --git a/src/inc/corpriv.h b/src/inc/corpriv.h
index 8c737c7607..edab391827 100644
--- a/src/inc/corpriv.h
+++ b/src/inc/corpriv.h
@@ -23,10 +23,6 @@
#include "peinformation.h"
//
-#ifndef FEATURE_CORECLR
-interface IILFingerprint;
-interface IILFingerprintFactory;
-#endif
interface IAssemblyName;
// PE images loaded through the runtime.
@@ -331,11 +327,6 @@ STDAPI RuntimeOpenImageInternal(LPCWSTR pszFileName, HCORMODULE* hHandle,
STDAPI RuntimeOpenImageByStream(IStream* pIStream, UINT64 AssemblyId, DWORD dwModuleId,
HCORMODULE* hHandle, DWORD *pdwLength, MDInternalImportFlags flags);
-#ifndef FEATURE_CORECLR
-// NOTE: Performance critical codepaths should cache the result of this function.
-STDAPI RuntimeGetILFingerprintForPath(LPCWSTR path, IILFingerprint **ppFingerprint);
-STDAPI RuntimeCreateCachingILFingerprintFactory(IILFingerprintFactory **ppILFingerprintFactory);
-#endif //!FEATURE_CORECLR
void RuntimeAddRefHandle(HCORMODULE hHandle);
STDAPI RuntimeReleaseHandle(HCORMODULE hHandle);
STDAPI RuntimeGetImageBase(HCORMODULE hHandle, LPVOID* base, BOOL bMapped, COUNT_T* dwSize);
@@ -720,11 +711,6 @@ BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_DEPENDENCY *pExpected
-#ifndef FEATURE_CORECLR
-
-#include "iilfingerprint.h"
-
-#endif //!FEATURE_CORECLR
#endif // _CORPRIV_H_
// EOF =======================================================================
diff --git a/src/inc/dacvars.h b/src/inc/dacvars.h
index 0a60684ad1..b54ca108f3 100644
--- a/src/inc/dacvars.h
+++ b/src/inc/dacvars.h
@@ -160,11 +160,7 @@ DEFINE_DACVAR(ULONG, int, CCLRErrorReportingManager__g_ECustomDumpFlavor, CCLREr
DEFINE_DACVAR(ULONG, PTR_SString, SString__s_Empty, SString::s_Empty)
#ifdef FEATURE_APPX
-#if defined(FEATURE_CORECLR)
DEFINE_DACVAR(ULONG, BOOL, dac__g_fAppX, ::g_fAppX)
-#else
-DEFINE_DACVAR(ULONG, PTR_AppXRTInfo, dac__g_pAppXRTInfo, ::g_pAppXRTInfo)
-#endif
#endif // FEATURE_APPX
DEFINE_DACVAR(ULONG, BOOL, SString__s_IsANSIMultibyte, SString::s_IsANSIMultibyte)
@@ -236,9 +232,6 @@ DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pThreadClass, ::g_pThreadClass
#ifdef FEATURE_CER
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pCriticalFinalizerObjectClass, ::g_pCriticalFinalizerObjectClass)
#endif
-#ifndef FEATURE_CORECLR
-DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pAsyncFileStream_AsyncResultClass, ::g_pAsyncFileStream_AsyncResultClass)
-#endif // !FEATURE_CORECLR
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pPredefinedArrayTypes, ::g_pPredefinedArrayTypes)
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_TypedReferenceMT, ::g_TypedReferenceMT)
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pByteArrayMT, ::g_pByteArrayMT)
@@ -316,12 +309,10 @@ DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__saved_sweep_ephemeral_start, WKS::g
DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__background_saved_lowest_address, WKS::gc_heap::background_saved_lowest_address)
DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__background_saved_highest_address, WKS::gc_heap::background_saved_highest_address)
-#ifdef FEATURE_CORECLR
#ifndef FEATURE_PAL
DEFINE_DACVAR(ULONG, HANDLE, dac__g_hContinueStartupEvent, ::g_hContinueStartupEvent)
#endif // !FEATURE_PAL
DEFINE_DACVAR(ULONG, DWORD, CorHost2__m_dwStartupFlags, CorHost2::m_dwStartupFlags)
-#endif // FEATURE_CORECLR
DEFINE_DACVAR(ULONG, HRESULT, dac__g_hrFatalError, ::g_hrFatalError)
@@ -329,9 +320,6 @@ DEFINE_DACVAR(ULONG, HRESULT, dac__g_hrFatalError, ::g_hrFatalError)
DEFINE_DACVAR(ULONG, DWORD, PEFile__s_NGENDebugFlags, PEFile::s_NGENDebugFlags)
#endif //defined(DEBUGGING_SUPPORTED) && defined (FEATURE_PREJIT)
-#ifndef FEATURE_CORECLR
-DEFINE_DACVAR(ULONG, DWORD, AssemblyUsageLogManager__s_UsageLogFlags, AssemblyUsageLogManager::s_UsageLogFlags)
-#endif // FEATURE_CORECLR
#if defined(FEATURE_APPX_BINDER)
DEFINE_DACVAR(ULONG, PTR_CLRPrivBinderAppX, CLRPrivBinderAppX__s_pSingleton, CLRPrivBinderAppX::s_pSingleton)
diff --git a/src/inc/fusionpriv.idl b/src/inc/fusionpriv.idl
index f9aaefcd9c..a988539f52 100644
--- a/src/inc/fusionpriv.idl
+++ b/src/inc/fusionpriv.idl
@@ -39,9 +39,6 @@ import "objidl.idl";
import "oleidl.idl";
import "fusion.idl";
-#ifndef FEATURE_CORECLR
-import "binderngen.idl";
-#endif
cpp_quote("#ifdef _MSC_VER")
cpp_quote("#pragma once")
@@ -955,16 +952,3 @@ interface IHostAssemblyModuleImport : IUnknown
cpp_quote("#define EXPLICITBIND_FLAGS_NON_BINDABLE 0x0")
cpp_quote("#define EXPLICITBIND_FLAGS_EXE 0x1")
-#ifndef FEATURE_CORECLR
-#pragma midl_echo("HRESULT BindToSystem(IAssemblyName *pNameSystem, LPCWSTR pcwzSystemDirectory, IUnknown *pNIEva, IApplicationContext *pAppCtx, IAssembly **ppAsmOut, IBindResult **ppNIAsmOut, IFusionBindLog **ppdbglog);")
-
-#pragma midl_echo("HRESULT ExplicitBind(LPCWSTR wzPath, IApplicationContext *pAppCtx, DWORD dwFlags, IUnknown *pNIEva, IAssembly **ppAsmOut, IBindResult **ppNIAsmOut, IFusionBindLog **ppdbglog);")
-
-#pragma midl_echo("HRESULT GetBindContextFromApplicationContext(IApplicationContext *pAppCtx, IBindContext **ppBindCtx);")
-
-#pragma midl_echo("HRESULT SetApplicationContext_WinRTBinder(IApplicationContext * pAppCtx, IBindContext * pWinRTBinder);")
-
-// Used by InstallNativeImage() to extract dependency names from the NI's CORCOMPILE_DEPENDENCY_INFO records.
-#pragma midl_echo("STDAPI FusionGetAssemblyNameRefFromMDImport(IMetaDataAssemblyImport *pMDImport, /* This is really an mdAssemblyRef */ DWORD mdar, DWORD dwFlags, IAssemblyName **ppName);")
-
-#endif //!FEATURE_CORECLR
diff --git a/src/inc/fxretarget.h b/src/inc/fxretarget.h
index abac8d8047..eedb694b59 100644
--- a/src/inc/fxretarget.h
+++ b/src/inc/fxretarget.h
@@ -135,7 +135,6 @@ const FrameworkConfig g_arFxPolicy[] =
{L"System.Windows.Forms", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
{L"System.Xml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
-#ifdef NDP4_AUTO_VERSION_ROLLFORWARD
// Post-Everett FX 2.0 assemblies:
{L"AspNetMMCExt", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
@@ -332,7 +331,6 @@ const FrameworkConfig g_arFxPolicy[] =
{L"System.Windows", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
{L"System.Xml.Serialization", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
-#endif // NDP4_AUTO_VERSION_ROLLFORWARD
// ENDDICTIONARY
}; //g_arFxPolicy
diff --git a/src/inc/holder.h b/src/inc/holder.h
index a4d19bbf92..36a3dfc4af 100644
--- a/src/inc/holder.h
+++ b/src/inc/holder.h
@@ -112,9 +112,6 @@ struct AutoExpVisibleValue
const class AppXBindResultImpl *_asAppXBindResultImpl;
#endif
-#ifndef FEATURE_CORECLR
- const class PEFingerprint *_asPEFingerprint;
-#endif //!FEATURE_CORECLR
const void *_pPreventEmptyUnion;
};
};
@@ -1214,7 +1211,7 @@ FORCEINLINE void VoidDeleteFile(LPCWSTR wszFilePath) { WszDeleteFile(wszFilePath
typedef Wrapper<LPCWSTR, DoNothing<LPCWSTR>, VoidDeleteFile, NULL> DeleteFileHolder;
#endif // WszDeleteFile
-#if !defined(FEATURE_CORECLR) || defined(FEATURE_CRYPTO)
+#if defined(FEATURE_CRYPTO)
// Crypto holders
FORCEINLINE void VoidCryptReleaseContext(HCRYPTPROV h) { CryptReleaseContext(h, 0); }
FORCEINLINE void VoidCryptDestroyHash(HCRYPTHASH h) { CryptDestroyHash(h); }
diff --git a/src/inc/longfilepathwrappers.h b/src/inc/longfilepathwrappers.h
index a0ffe38da5..3bb9166990 100644
--- a/src/inc/longfilepathwrappers.h
+++ b/src/inc/longfilepathwrappers.h
@@ -152,120 +152,5 @@ DWORD WINAPI GetEnvironmentVariableWrapper(
BOOL PAL_GetPALDirectoryWrapper(SString& pbuffer);
-#ifndef FEATURE_CORECLR
-//Temporarily providing direct OS Calls Till All of the Desktop CLR start using the above format
-inline DWORD
-SearchPathWrapper(
- _In_opt_ LPCWSTR lpPath,
- _In_ LPCWSTR lpFileName,
- _In_opt_ LPCWSTR lpExtension,
- _In_ BOOL getPath,
- _Out_ LPWSTR lpBuffer,
- _Out_opt_ LPWSTR * lpFilePart
- )
-{
- return SearchPathW(
- lpPath,
- lpFileName,
- lpExtension,
- getPath,
- lpBuffer,
- lpFilePart
- );
-}
-
-
-inline DWORD
-GetShortPathNameWrapper(
- _In_ LPCWSTR lpszLongPath,
- _Out_ LPWSTR lpszShortPath,
- _In_ DWORD cchBuffer
- )
-{
- return GetShortPathNameW(
- lpszLongPath,
- lpszShortPath,
- cchBuffer
- );
-}
-
-inline DWORD
-GetLongPathNameWrapper(
- _In_ LPCWSTR lpszShortPath,
- _Out_ LPWSTR lpszLongPath,
- _In_ DWORD cchBuffer
- )
-{
- return GetLongPathNameW(
- lpszShortPath,
- lpszLongPath,
- cchBuffer
- );
-}
-
-inline UINT GetTempFileNameWrapper(
- _In_ LPCWSTR lpPathName,
- _In_ LPCWSTR lpPrefixString,
- _In_ UINT uUnique,
- _Out_ LPWSTR lpTempFileName
- )
-{
- return GetTempFileNameW(
- lpPathName,
- lpPrefixString,
- uUnique,
- lpTempFileName
- );
-}
-
-inline DWORD GetTempPathWrapper(
- _In_ DWORD nBufferLength,
- _Out_ LPWSTR lpBuffer
- )
-{
- return GetTempPathW(
- nBufferLength,
- lpBuffer
- );
-}
-
-inline DWORD GetCurrentDirectoryWrapper(
- _In_ DWORD nBufferLength,
- _Out_ LPWSTR lpBuffer
- )
-{
- return GetCurrentDirectoryW(
- nBufferLength,
- lpBuffer
- );
-}
-
-inline DWORD
-GetModuleFileNameWrapper(
- _In_opt_ HMODULE hModule,
- _Out_ LPWSTR lpFilename,
- _In_ DWORD nSize
- )
-{
- return GetModuleFileNameW(
- hModule,
- lpFilename,
- nSize
- );
-}
-
-inline DWORD GetEnvironmentVariableWrapper(
- _In_opt_ LPCWSTR lpName,
- _Out_opt_ LPWSTR lpBuffer,
- _In_ DWORD nSize
- )
-{
- return GetEnvironmentVariableW(
- lpName,
- lpBuffer,
- nSize
- );
-}
-#endif //FEATURE_CORECLR
#endif //_WIN_PATH_APIS_WRAPPER_
diff --git a/src/inc/metadatatracker.h b/src/inc/metadatatracker.h
index 93ecaab983..00aa56afae 100644
--- a/src/inc/metadatatracker.h
+++ b/src/inc/metadatatracker.h
@@ -5,7 +5,7 @@
#ifndef _METADATATRACKER_H_
#define _METADATATRACKER_H_
-#if defined(FEATURE_PREJIT) && (!defined(FEATURE_CORECLR) || defined(FEATURE_WINDOWSPHONE))
+#if defined(FEATURE_PREJIT) && defined(FEATURE_WINDOWSPHONE)
#define METADATATRACKER_DATA 1
#if !defined(DACCESS_COMPILE)
diff --git a/src/inc/palclr_win.h b/src/inc/palclr_win.h
index 18edc6c8f5..372f467cbd 100644
--- a/src/inc/palclr_win.h
+++ b/src/inc/palclr_win.h
@@ -83,67 +83,6 @@
// WIN_PAL_ENDTRY
//
-#if !defined(FEATURE_CORECLR)
-
-#include "staticcontract.h"
-
-#define WIN_PAL_TRY_NAKED \
- { \
- bool __exHandled; __exHandled = false; \
- DWORD __exCode; __exCode = 0; \
- __try \
- {
-
-#define WIN_PAL_TRY \
- { \
- WIN_PAL_TRY_NAKED \
- WIN_PAL_TRY_HANDLER_DBG_BEGIN
-
-#define WIN_PAL_TRY_FOR_DLLMAIN(_reason) \
- { \
- WIN_PAL_TRY_NAKED \
- WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason)
-
-// Note: PAL_SEH_RESTORE_GUARD_PAGE is only ever defined in clrex.h, so we only restore guard pages automatically
-// when these macros are used from within the VM.
-#define WIN_PAL_SEH_RESTORE_GUARD_PAGE PAL_SEH_RESTORE_GUARD_PAGE
-
-#define WIN_PAL_EXCEPT_NAKED(Disposition) \
- } __except(__exCode = GetExceptionCode(), Disposition) { \
- __exHandled = true; \
- WIN_PAL_SEH_RESTORE_GUARD_PAGE
-
-#define WIN_PAL_EXCEPT(Disposition) \
- WIN_PAL_TRY_HANDLER_DBG_END \
- WIN_PAL_EXCEPT_NAKED(Disposition)
-
-#define WIN_PAL_EXCEPT_FILTER_NAKED(pfnFilter, pvFilterParameter) \
- } __except(__exCode = GetExceptionCode(), pfnFilter(GetExceptionInformation(), pvFilterParameter)) { \
- __exHandled = true; \
- WIN_PAL_SEH_RESTORE_GUARD_PAGE
-
-#define WIN_PAL_EXCEPT_FILTER(pfnFilter, pvFilterParameter) \
- WIN_PAL_TRY_HANDLER_DBG_END \
- WIN_PAL_EXCEPT_FILTER_NAKED(pfnFilter, pvFilterParameter)
-
-#define WIN_PAL_FINALLY_NAKED \
- } __finally { \
-
-#define WIN_PAL_FINALLY \
- WIN_PAL_TRY_HANDLER_DBG_END \
- WIN_PAL_FINALLY_NAKED
-
-#define WIN_PAL_ENDTRY_NAKED \
- } \
- } \
-
-#define WIN_PAL_ENDTRY \
- } \
- WIN_PAL_ENDTRY_NAKED_DBG \
- } \
- }
-
-#endif // !PAL_WIN_SEH
#if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(JIT64_BUILD) && !defined(_ARM_) // @ARMTODO
diff --git a/src/inc/registrywrapper.h b/src/inc/registrywrapper.h
index bd6afe190b..6b284506bb 100644
--- a/src/inc/registrywrapper.h
+++ b/src/inc/registrywrapper.h
@@ -11,38 +11,10 @@
#ifndef __REGISTRYWRAPPER_H
#define __REGISTRYWRAPPER_H
-#if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && !defined(FEATURE_CORECLR)
-
-// Registry API wrappers
-
-LONG ClrRegCreateKeyEx(
- HKEY hKey,
- LPCWSTR lpSubKey,
- DWORD Reserved,
- __in_opt LPWSTR lpClass,
- DWORD dwOptions,
- REGSAM samDesired,
- LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- PHKEY phkResult,
- LPDWORD lpdwDisposition
- );
-
-LONG ClrRegOpenKeyEx(
- HKEY hKey,
- LPCWSTR lpSubKey,
- DWORD ulOptions,
- REGSAM samDesired,
- PHKEY phkResult
- );
-
-bool IsNgenOffline();
-
-#else
#define ClrRegCreateKeyEx RegCreateKeyExW
#define ClrRegOpenKeyEx RegOpenKeyExW
#define IsNgenOffline() false
-#endif
#endif // __REGISTRYWRAPPER_H
diff --git a/src/inc/shimload.h b/src/inc/shimload.h
index 9a6ab7de6f..a2651d1aff 100644
--- a/src/inc/shimload.h
+++ b/src/inc/shimload.h
@@ -14,17 +14,6 @@
#ifndef _SHIMLOAD_H
#define _SHIMLOAD_H
-#ifndef FEATURE_CORECLR
-#include <delayimp.h>
-
-extern FARPROC __stdcall ShimDelayLoadHook(unsigned dliNotify, // What event has occurred, dli* flag.
- DelayLoadInfo *pdli); // Description of the event.
-
-//and one for safe mode
-extern FARPROC __stdcall ShimSafeModeDelayLoadHook(unsigned dliNotify, // What event has occurred, dli* flag.
- DelayLoadInfo *pdli); // Description of the event.
-
-#endif
//*****************************************************************************
// Sets/Gets the directory based on the location of the module. This routine
diff --git a/src/inc/stacktrace.h b/src/inc/stacktrace.h
index 49e951780c..24fdf9482c 100644
--- a/src/inc/stacktrace.h
+++ b/src/inc/stacktrace.h
@@ -74,7 +74,7 @@ void GetStringFromStackLevels(UINT ifrStart, UINT cfrTotal, __out_ecount(cchMaxA
******************************************************************** robch */
void GetStringFromAddr(DWORD_PTR dwAddr, __out_ecount(cchMaxAssertStackLevelStringLen) LPSTR szString);
-#if defined(_TARGET_X86_) && defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if defined(_TARGET_X86_) && !defined(FEATURE_PAL)
/****************************************************************************
* ClrCaptureContext *
*-------------------*
diff --git a/src/inc/switches.h b/src/inc/switches.h
index 9faf620dc7..daf1751502 100644
--- a/src/inc/switches.h
+++ b/src/inc/switches.h
@@ -10,9 +10,6 @@
#define STRESS_HEAP
#endif
-#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-#define STRESS_THREAD
-#endif
#define VERIFY_HEAP
@@ -67,9 +64,6 @@
#define GC_STATS
#endif
-#if !defined(FEATURE_CORECLR)
-#define EMIT_FIXUPS
-#endif
#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && (defined(_TARGET_X86_) || defined(_TARGET_AMD64_))
// On x86/x64 Windows debug builds, respect the COMPlus_EnforceEEThreadNotRequiredContracts
@@ -110,16 +104,12 @@
// ALLOW_SXS_JIT_NGEN enables AltJit support for NGEN, via COMPlus_AltJitNgen / COMPlus_AltJitName.
// Note that if ALLOW_SXS_JIT_NGEN is defined, then ALLOW_SXS_JIT must be defined.
#define ALLOW_SXS_JIT
-#if defined(ALLOW_SXS_JIT)
#define ALLOW_SXS_JIT_NGEN
-#endif // ALLOW_SXS_JIT
-#if defined(FEATURE_CORECLR)
//master switch for gc suspension not based on hijacking
#define FEATURE_ENABLE_GCPOLL
-#endif //FEATURE_CORECLR
-#if defined(FEATURE_ENABLE_GCPOLL) && defined(_TARGET_X86_)
+#if defined(_TARGET_X86_)
//this enables a fast version of the GC Poll helper instead of the default portable one.
#define ENABLE_FAST_GCPOLL_HELPER
#endif // defined(FEATURE_ENABLE_GCPOLL) && defined(_TARGET_X86_)
@@ -132,18 +122,13 @@
#define PLATFORM_SUPPORTS_SAFE_THREADSUSPEND
#endif // !FEATURE_PAL
-#if !defined(PLATFORM_SUPPORTS_SAFE_THREADSUSPEND) && !defined(FEATURE_ENABLE_GCPOLL)
-#error "Platform must support either safe thread suspension or GC polling"
-#endif
#if defined(STRESS_HEAP) && defined(_DEBUG) && defined(FEATURE_HIJACK)
#define HAVE_GCCOVER
#endif
-#ifdef FEATURE_CORECLR
//Turns on a startup delay to allow simulation of slower and faster startup times.
#define ENABLE_STARTUP_DELAY
-#endif
#ifndef ALLOW_LOCAL_WORKER
@@ -184,15 +169,9 @@
// Windows desktop supports the profiling API attach / detach feature.
// This will eventually be supported on coreclr as well.
-#if defined(PROFILING_SUPPORTED) && !defined(FEATURE_CORECLR)
-#define FEATURE_PROFAPI_ATTACH_DETACH
-#endif
// Windows desktop DAC builds need to see some of the data used in the profiling API
// attach / detach feature, particularly Thread::m_dwProfilerEvacuationCounter
-#if defined(PROFILING_SUPPORTED_DATA) && !defined(FEATURE_CORECLR)
-#define DATA_PROFAPI_ATTACH_DETACH
-#endif
// MUST NEVER CHECK IN WITH THIS ENABLED.
// This is just for convenience in doing performance investigations in a checked-out enlistment.
@@ -219,9 +198,7 @@
// are treated as potential pinned interior pointers. When enabled, the runtime flag COMPLUS_GCCONSERVATIVE
// determines dynamically whether GC is conservative. Note that appdomain unload, LCG and unloadable assemblies
// do not work reliably with conservative GC.
-#ifdef FEATURE_CORECLR
#define FEATURE_CONSERVATIVE_GC 1
-#endif
#if (defined(_TARGET_ARM_) && !defined(ARM_SOFTFP)) || defined(_TARGET_ARM64_)
#define FEATURE_HFA
@@ -242,7 +219,7 @@
#define FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
-#if defined(FEATURE_PREJIT) && defined(FEATURE_CORECLR)
+#if defined(FEATURE_PREJIT)
// Desktop CLR allows profilers and debuggers to opt out of loading NGENd images, and to
// JIT everything instead. "FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS" is roughly the
// equivalent for Apollo, where MSIL images may not be available at all.
@@ -256,7 +233,7 @@
// If defined, support interpretation.
#if !defined(CROSSGEN_COMPILE)
-#if defined(ALLOW_SXS_JIT) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
#define FEATURE_STACK_SAMPLING
#endif // defined (ALLOW_SXS_JIT)
diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h
index a1a083638b..5394f1beb2 100644
--- a/src/inc/utilcode.h
+++ b/src/inc/utilcode.h
@@ -51,7 +51,6 @@ const WCHAR kWatsonName2[] = W("drwtsn32");
#define WINDOWS_KERNEL32_DLLNAME_A "kernel32"
#define WINDOWS_KERNEL32_DLLNAME_W W("kernel32")
-#if defined(FEATURE_CORECLR)
#define CoreLibName_W W("System.Private.CoreLib")
#define CoreLibName_IL_W W("System.Private.CoreLib.dll")
#define CoreLibName_NI_W W("System.Private.CoreLib.ni.dll")
@@ -64,20 +63,6 @@ const WCHAR kWatsonName2[] = W("drwtsn32");
#define CoreLibSatelliteName_A "System.Private.CoreLib.resources"
#define CoreLibSatelliteNameLen 32
#define LegacyCoreLibName_A "mscorlib"
-#else // !defined(FEATURE_CORECLR)
-#define CoreLibName_W W("mscorlib")
-#define CoreLibName_IL_W W("mscorlib.dll")
-#define CoreLibName_NI_W W("mscorlib.ni.dll")
-#define CoreLibName_TLB_W W("mscorlib.tlb")
-#define CoreLibName_A "mscorlib"
-#define CoreLibName_IL_A "mscorlib.dll"
-#define CoreLibName_NI_A "mscorlib.ni.dll"
-#define CoreLibName_TLB_A "mscorlib.tlb"
-#define CoreLibNameLen 8
-#define CoreLibSatelliteName_A "mscorlib.resources"
-#define CoreLibSatelliteNameLen 18
-#define LegacyCoreLibName_A "mscorlib"
-#endif // defined(FEATURE_CORECLR)
class StringArrayList;
@@ -814,10 +799,8 @@ public:
// Get the default resource location (mscorrc.dll for desktop, mscorrc.debug.dll for CoreCLR)
static CCompRC* GetDefaultResourceDll();
-#ifdef FEATURE_CORECLR
// Get the generic messages dll (Silverlight only, mscorrc.dll)
static CCompRC* GetFallbackResourceDll();
-#endif
static void ShutdownDefaultResourceDll();
static void GetDefaultCallbacks(
FPGETTHREADUICULTURENAMES* fpGetThreadUICultureNames,
@@ -842,12 +825,10 @@ public:
fpGetThreadUICultureNames,
fpGetThreadUICultureId);
-#ifdef FEATURE_CORECLR
m_FallbackResourceDll.SetResourceCultureCallbacks(
fpGetThreadUICultureNames,
fpGetThreadUICultureId);
-#endif
}
#ifdef USE_FORMATMESSAGE_WRAPPER
@@ -881,12 +862,10 @@ private:
static CCompRC m_DefaultResourceDll;
static LPCWSTR m_pDefaultResource;
-#ifdef FEATURE_CORECLR
// fallback resources if debug pack is not installed
static LONG m_dwFallbackInitialized;
static CCompRC m_FallbackResourceDll;
static LPCWSTR m_pFallbackResource;
-#endif
// We must map between a thread's int and a dll instance.
// Since we only expect 1 language almost all of the time, we'll special case
@@ -1143,13 +1122,6 @@ void SplitPathInterior(
__out_opt LPCWSTR *pwszFileName, __out_opt size_t *pcchFileName,
__out_opt LPCWSTR *pwszExt, __out_opt size_t *pcchExt);
-#ifndef FEATURE_CORECLR
-void MakePath(__out_ecount (MAX_LONGPATH) register WCHAR *path,
- __in LPCWSTR drive,
- __in LPCWSTR dir,
- __in LPCWSTR fname,
- __in LPCWSTR ext);
-#endif
void MakePath(__out CQuickWSTR &path,
__in LPCWSTR drive,
@@ -1243,13 +1215,9 @@ public:
static void FreeConfigString(__in __in_z LPWSTR name);
-#ifdef FEATURE_CORECLR
private:
-#endif //FEATURE_CORECLR
static LPWSTR EnvGetString(LPCWSTR name, BOOL fPrependCOMPLUS);
-#ifdef FEATURE_CORECLR
public:
-#endif //FEATURE_CORECLR
static BOOL UseRegistry();
@@ -1267,138 +1235,6 @@ private:
BOOL fPrependCOMPLUS = TRUE);
public:
-#ifndef FEATURE_CORECLR
- static void AllowRegistryUse(BOOL fAllowUse);
-
-
-//*****************************************************************************
-// Open's the given key and returns the value desired. If the key or value is
-// not found, then the default is returned.
-//*****************************************************************************
- static long GetLong( // Return value from registry or default.
- LPCTSTR szName, // Name of value to get.
- long iDefault, // Default value to return if not found.
- LPCTSTR szKey=NULL, // Name of key, NULL==default.
- HKEY hKey=HKEY_LOCAL_MACHINE);// What key to work on.
-
-//*****************************************************************************
-// Open's the given key and returns the value desired. If the key or value is
-// not found, then the default is returned.
-//*****************************************************************************
- static long SetLong( // Return value from registry or default.
- LPCTSTR szName, // Name of value to get.
- long iValue, // Value to set.
- LPCTSTR szKey=NULL, // Name of key, NULL==default.
- HKEY hKey=HKEY_LOCAL_MACHINE);// What key to work on.
-
-//*****************************************************************************
-// Open's the given key and returns the value desired. If the key or value is
-// not found, then it's created
-//*****************************************************************************
- static long SetOrCreateLong( // Return value from registry or default.
- LPCTSTR szName, // Name of value to get.
- long iValue, // Value to set.
- LPCTSTR szKey=NULL, // Name of key, NULL==default.
- HKEY hKey=HKEY_LOCAL_MACHINE);// What key to work on.
-
-
-
-//*****************************************************************************
-// Set an entry in the registry of the form:
-// HKEY_CLASSES_ROOT\szKey\szSubkey = szValue. If szSubkey or szValue are
-// NULL, omit them from the above expression.
-//*****************************************************************************
- static BOOL SetKeyAndValue( // TRUE or FALSE.
- LPCTSTR szKey, // Name of the reg key to set.
- LPCTSTR szSubkey, // Optional subkey of szKey.
- LPCTSTR szValue); // Optional value for szKey\szSubkey.
-
-//*****************************************************************************
-// Delete an entry in the registry of the form:
-// HKEY_CLASSES_ROOT\szKey\szSubkey.
-//*****************************************************************************
- static LONG DeleteKey( // TRUE or FALSE.
- LPCTSTR szKey, // Name of the reg key to set.
- LPCTSTR szSubkey); // Subkey of szKey.
-
-//*****************************************************************************
-// Open the key, create a new keyword and value pair under it.
-//*****************************************************************************
- static BOOL SetRegValue( // Return status.
- LPCTSTR szKeyName, // Name of full key.
- LPCTSTR szKeyword, // Name of keyword.
- LPCTSTR szValue); // Value of keyword.
-
-//*****************************************************************************
-// Does standard registration of a CoClass with a progid.
-//*****************************************************************************
- static HRESULT RegisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID.
- LPCTSTR szDesc, // Description of the class.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID, // Class progid.
- LPCTSTR szThreadingModel, // What threading model to use.
- LPCTSTR szModule, // Path to class.
- HINSTANCE hInst, // Handle to module being registered
- LPCTSTR szAssemblyName, // Optional assembly name
- LPCTSTR szVersion, // Optional Runtime Version (directry containing runtime)
- BOOL fExternal, // flag - External to mscoree.
- BOOL fRelativePath); // flag - Relative path in szModule
-
-//*****************************************************************************
-// Unregister the basic information in the system registry for a given object
-// class.
-//*****************************************************************************
- static HRESULT UnregisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID, // Class progid.
- BOOL fExternal); // flag - External to mscoree.
-
-//*****************************************************************************
-// Does standard registration of a CoClass with a progid.
-// NOTE: This is the non-side-by-side execution version.
-//*****************************************************************************
- static HRESULT RegisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID.
- LPCTSTR szDesc, // Description of the class.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID, // Class progid.
- LPCTSTR szThreadingModel, // What threading model to use.
- LPCTSTR szModule, // Path to class.
- BOOL bInprocServer = true); // Whether we register the server as inproc or local
-
-//*****************************************************************************
-// Unregister the basic information in the system registry for a given object
-// class.
-// NOTE: This is the non-side-by-side execution version.
-//*****************************************************************************
- static HRESULT UnregisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID); // Class progid.
-
-//*****************************************************************************
-// Register a type library.
-//*****************************************************************************
- static HRESULT RegisterTypeLib( // Return code.
- REFGUID rtlbid, // TypeLib ID we are registering.
- int iVersion, // Typelib version.
- LPCTSTR szDesc, // TypeLib description.
- LPCTSTR szModule); // Path to the typelib.
-
-//*****************************************************************************
-// Remove the registry keys for a type library.
-//*****************************************************************************
- static HRESULT UnregisterTypeLib( // Return code.
- REFGUID rtlbid, // TypeLib ID we are registering.
- int iVersion); // Typelib version.
-
-#endif //#ifndef FEATURE_CORECLR
//*****************************************************************************
// (Optional) Initialize the config registry cache
@@ -1408,31 +1244,6 @@ public:
private:
-#ifndef FEATURE_CORECLR
-
-//*****************************************************************************
-// Register the basics for a in proc server.
-//*****************************************************************************
- static HRESULT RegisterClassBase( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szDesc, // Class description.
- LPCTSTR szProgID, // Class prog ID.
- LPCTSTR szIndepProgID, // Class version independant prog ID.
- __out_ecount (cchOutCLSID) LPTSTR szOutCLSID, // CLSID formatted in character form.
- DWORD cchOutCLSID); // Out CLS ID buffer size in characters
-
-
-//*****************************************************************************
-// Delete the basic settings for an inproc server.
-//*****************************************************************************
- static HRESULT UnregisterClassBase( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szProgID, // Class prog ID.
- LPCTSTR szIndepProgID, // Class version independant prog ID.
- __out_ecount (cchOutCLSID) LPTSTR szOutCLSID, // Return formatted class ID here.
- DWORD cchOutCLSID); // Out CLS ID buffer size in characters
-
-#endif //#ifndef FEATURE_CORECLR
//*****************************************************************************
// Return TRUE if the registry value name might have been seen in the registry
@@ -4688,18 +4499,6 @@ public:
return NtCurrentTeb()->ProcessEnvironmentBlock;
}
-#ifndef FEATURE_CORECLR
- static void* GetFiberDataPtr()
- {
- LIMITED_METHOD_CONTRACT;
- return ClrTeb::IsCurrentThreadAFiber()? GetCurrentFiber() : NULL;
- }
-
- static BOOL IsCurrentThreadAFiber()
- {
- return IsThreadAFiber();
- }
-#endif
static void* InvalidFiberPtrId()
{
@@ -5205,22 +5004,6 @@ typedef Wrapper<BSTR, DoNothing, HolderSysFreeString> BSTRHolder;
BOOL FileExists(LPCWSTR filename);
-#ifndef FEATURE_CORECLR
-class FileLockHolder
-{
-public:
- FileLockHolder();
- ~FileLockHolder();
-
- virtual void Acquire(LPCWSTR lockName, HANDLE hInterrupt = 0, BOOL* pInterrupted = NULL);
- HRESULT AcquireNoThrow(LPCWSTR lockName, HANDLE hInterrupt = 0, BOOL* pInterrupted = NULL);
-
- static BOOL IsTaken(LPCWSTR lockName);
- void Release();
-private:
- HANDLE _hLock;
-};
-#endif // FEATURE_CORECLR
// a class for general x.x version info
class MajorMinorVersionInfo
@@ -5336,7 +5119,6 @@ struct CoreClrCallbacks
pfnGetCLRFunction_t m_pfnGetCLRFunction;
};
-#if defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
// For DAC, we include this functionality only when EH SxS is enabled.
@@ -5362,7 +5144,6 @@ void OnUninitializedCoreClrCallbacks();
#define VALIDATECORECLRCALLBACKS()
#endif //_DEBUG
-#endif // defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
#ifdef FEATURE_CORRUPTING_EXCEPTIONS
@@ -5572,33 +5353,6 @@ void* FindLocalizedFile(_In_z_ LPCWSTR wzResourceDllName, LocalizedFileHandler l
BOOL IsClrHostedLegacyComObject(REFCLSID rclsid);
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-
-// No utilcode code should use the global LoadLibraryShim anymore. UtilCode::LoadLibraryShim will do
-// the right thing based on whether the hosted or non-hosted utilcode is linked to. Using the global
-// LoadLibraryShim will result in a deprecated use warning.
-
-#ifdef SELF_NO_HOST
-#define LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY WszLoadLibrary
-#include "legacyactivationshim.h"
-#include "mscoreepriv.h"
-
-namespace UtilCode
-{
- inline HRESULT LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll)
- {
- return LegacyActivationShim::LoadLibraryShim(szDllName, szVersion, pvReserved, phModDll);
- }
-};
-#else // SELF_NO_HOST
-namespace UtilCode
-{
- // Hosted environment
- HRESULT LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll);
-};
-#endif // SELF_NO_HOST
-
-#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
// Helper to support termination due to heap corruption
@@ -5606,10 +5360,6 @@ namespace UtilCode
void EnableTerminationOnHeapCorruption();
-#if !defined(FEATURE_CORECLR)
-// On success, sets pwszProcessExePath (required) to full path to process EXE.
-HRESULT GetProcessExePath(LPCWSTR *pwszProcessExePath);
-#endif
namespace Clr { namespace Util
{
diff --git a/src/inc/vptr_list.h b/src/inc/vptr_list.h
index bac0c1165e..11c91bba03 100644
--- a/src/inc/vptr_list.h
+++ b/src/inc/vptr_list.h
@@ -27,9 +27,6 @@ VPTR_CLASS(Module)
VPTR_CLASS(ReflectionModule)
VPTR_CLASS(AppDomain)
-#ifndef FEATURE_CORECLR // FEATURE_NATIVE_IMAGE_GENERATION
-VPTR_MULTI_CLASS(CompilationDomain, AppDomain)
-#endif
VPTR_CLASS(SharedDomain)
VPTR_CLASS(SystemDomain)
diff --git a/src/inc/winwrap.h b/src/inc/winwrap.h
index f44aae5750..6c4dfe8331 100644
--- a/src/inc/winwrap.h
+++ b/src/inc/winwrap.h
@@ -633,16 +633,6 @@
#define WszRegQueryValueExTrue RegQueryValueExW
#define WszRegQueryStringValueEx RegQueryValueExW
-#ifndef FEATURE_CORECLR
-#define WszRegDeleteKey RegDeleteKeyW
-#define WszRegCreateKeyEx ClrRegCreateKeyEx
-#define WszRegSetValueEx RegSetValueExW
-#define WszRegDeleteValue RegDeleteValueW
-#define WszRegLoadKey RegLoadKeyW
-#define WszRegUnLoadKey RegUnLoadKeyW
-#define WszRegRestoreKey RegRestoreKeyW
-#define WszRegReplaceKey RegReplaceKeyW
-#endif //#ifndef FEATURE_CORECLR
#define WszRegQueryInfoKey RegQueryInfoKeyW
#define WszRegEnumValue RegEnumValueW
diff --git a/src/inc/zapper.h b/src/inc/zapper.h
index 1018505faa..4356f5e682 100644
--- a/src/inc/zapper.h
+++ b/src/inc/zapper.h
@@ -115,20 +115,18 @@ class Zapper
BOOL m_failed;
CorInfoRegionKind m_currentRegionKind;
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
SString m_platformAssembliesPaths;
SString m_trustedPlatformAssemblies;
SString m_platformResourceRoots;
SString m_appPaths;
SString m_appNiPaths;
SString m_platformWinmdPaths;
-#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
SString m_CLRJITPath;
bool m_fDontLoadJit;
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
SString m_DiasymreaderPath;
#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
bool m_fForceFullTrust;
@@ -270,65 +268,6 @@ class Zapper
}
} m_assemblyDependencies;
-#ifndef FEATURE_CORECLR // No load lists on CoreCLR
- struct loadLists
- {
- loadLists() :
- m_loadAlwaysList(NULL),
- m_loadSometimesList(NULL),
- m_loadNeverList(NULL)
- {
- }
-
- SAFEARRAY *m_loadAlwaysList;
- SAFEARRAY *m_loadSometimesList;
- SAFEARRAY *m_loadNeverList;
-
- void SetLoadLists(SAFEARRAY *loadAlwaysList, SAFEARRAY *loadSometimesList, SAFEARRAY *loadNeverList)
- {
- m_loadAlwaysList = loadAlwaysList;
- m_loadSometimesList = loadSometimesList;
- m_loadNeverList = loadNeverList;
- }
-
- } m_loadLists;
-
- void SetLoadLists(SAFEARRAY *loadAlwaysList, SAFEARRAY *loadSometimesList, SAFEARRAY *loadNeverList)
- {
- m_loadLists.SetLoadLists(loadAlwaysList, loadSometimesList, loadNeverList);
- }
-
- void SetAssemblyHardBindList()
- {
- SAFEARRAY *loadAlwaysList = m_loadLists.m_loadAlwaysList;
- if (loadAlwaysList == NULL)
- {
- return;
- }
-
- LONG ubound = 0;
- IfFailThrow(SafeArrayGetUBound(loadAlwaysList, 1, &ubound));
-
- BSTR *pArrBstr = NULL;
- IfFailThrow(SafeArrayAccessData(loadAlwaysList, reinterpret_cast<void **>(&pArrBstr)));
-
- EX_TRY
- {
- _ASSERTE((ubound + 1) >= 0);
- m_pEECompileInfo->SetAssemblyHardBindList(reinterpret_cast<LPWSTR *>(pArrBstr), ubound + 1);
- }
- EX_CATCH
- {
- // If something went wrong, try to unlock the OLE array
- // Do not verify the outcome, as we can do nothing about it
- SafeArrayUnaccessData(loadAlwaysList);
- EX_RETHROW;
- }
- EX_END_CATCH_UNREACHABLE;
-
- IfFailThrow(SafeArrayUnaccessData(loadAlwaysList));
- }
-#endif // !FEATURE_CORECLR
public:
@@ -442,7 +381,6 @@ class Zapper
void GetOutputFolder();
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
void SetPlatformAssembliesPaths(LPCWSTR pwzPlatformAssembliesPaths);
void SetTrustedPlatformAssemblies(LPCWSTR pwzTrustedPlatformAssemblies);
void SetPlatformResourceRoots(LPCWSTR pwzPlatformResourceRoots);
@@ -450,14 +388,13 @@ class Zapper
void SetAppNiPaths(LPCWSTR pwzAppNiPaths);
void SetPlatformWinmdPaths(LPCWSTR pwzPlatformWinmdPaths);
void SetForceFullTrust(bool val);
-#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
void SetCLRJITPath(LPCWSTR pwszCLRJITPath);
void SetDontLoadJit();
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
void SetDiasymreaderPath(LPCWSTR pwzDiasymreaderPath);
#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
@@ -544,9 +481,7 @@ class ZapperOptions
bool m_legacyMode; // true if the zapper was invoked using legacy mode
-#ifdef FEATURE_CORECLR
bool m_fNoMetaData; // Do not copy metadata and IL to native image
-#endif
ZapperOptions();
~ZapperOptions();
diff --git a/src/ipcman/ipcsharedsrc.cpp b/src/ipcman/ipcsharedsrc.cpp
index ed1e7dc1ba..bb0f46bf0d 100644
--- a/src/ipcman/ipcsharedsrc.cpp
+++ b/src/ipcman/ipcsharedsrc.cpp
@@ -18,9 +18,6 @@
#include "ipcshared.h"
#include "ipcmanagerinterface.h"
-#ifndef FEATURE_CORECLR
-#include "AppXUtil.h"
-#endif
#if defined(FEATURE_IPCMAN)
@@ -170,41 +167,6 @@ HRESULT IPCShared::GenerateBlockTableName(DWORD pid, SString & sName, HANDLE & p
return hr;
}
-#ifndef FEATURE_CORECLR
- // when pid != GetCurrentProcessId() it means we're the consumer opening other process perf counter data
- if (pid != GetCurrentProcessId())
- {
- // if the target process is inside an appcontainer we need to add the appcontainer SID to the boundary descriptor.
- NewArrayHolder<BYTE> pbTokenMem;
- hr = AppX::GetAppContainerTokenInfoForProcess(pid, pbTokenMem);
-
- if (FAILED(hr))
- {
- // failed to open the target's process, continue on
- // assuming that the process isn't in an AppContainer.
- _ASSERTE(pbTokenMem == NULL);
- }
- else
- {
- if (hr == S_FALSE)
- {
- // not an appcontainer
- _ASSERTE(pbTokenMem == NULL);
- }
- else
- {
- // process is an appcontainer so add the SID
- PTOKEN_APPCONTAINER_INFORMATION pAppContainerTokenInfo =
- reinterpret_cast<PTOKEN_APPCONTAINER_INFORMATION>(pbTokenMem.GetValue());
- _ASSERTE(pAppContainerTokenInfo);
- _ASSERTE(pAppContainerTokenInfo->TokenAppContainer);
-
- if (!(*pAddSIDToBoundaryDescriptor)(&pBoundaryDesc, pAppContainerTokenInfo->TokenAppContainer))
- return HRESULT_FROM_WIN32(GetLastError());
- }
- }
- }
-#endif // FEATURE_CORECLR
if(bCreate)
{
@@ -666,10 +628,6 @@ BOOL IPCShared::InitializeGenericIPCAcl(DWORD pid, BOOL bRestrictiveACL, PACL *p
int iSIDforAdmin = -1;
int iSIDforUsers = -1;
int iSIDforLoggingUsers = -1;
-#if !defined (DACCESS_COMPILE) && !defined(FEATURE_CORECLR)
- NewArrayHolder<BYTE> pbTokenMem;
- PTOKEN_APPCONTAINER_INFORMATION pAppContainerTokenInfo = NULL;
-#endif
PermStruct[0].rgPSID = NULL;
@@ -802,39 +760,6 @@ BOOL IPCShared::InitializeGenericIPCAcl(DWORD pid, BOOL bRestrictiveACL, PACL *p
// non-fatal error, so don't goto errorexit
}
-#if !defined(DACCESS_COMPILE) && !defined(FEATURE_CORECLR)
- // when running on win8 if the process is an appcontainer then add the appcontainer SID to the ACL
- // going down this code path means we're creating the descriptor for our current PID.
- _ASSERTE(pid == GetCurrentProcessId());
- hr = AppX::GetAppContainerTokenInfoForProcess(pid, pbTokenMem);
-
- if (FAILED(hr))
- {
- // failed to open the target's process, continue on
- // assuming that the process isn't in an AppContainer.
- _ASSERTE(pbTokenMem == NULL);
- }
- else
- {
- if (hr == S_FALSE)
- {
- // not an appcontainer
- _ASSERTE(pbTokenMem == NULL);
- }
- else
- {
- // process is an appcontainer so add the SID
- pAppContainerTokenInfo =
- reinterpret_cast<PTOKEN_APPCONTAINER_INFORMATION>(pbTokenMem.GetValue());
- _ASSERTE(pAppContainerTokenInfo);
- _ASSERTE(pAppContainerTokenInfo->TokenAppContainer);
-
- PermStruct[cActualACECount].rgPSID = pAppContainerTokenInfo->TokenAppContainer;
- PermStruct[cActualACECount].rgAccessFlags = GetAccessFlagsForObject(whatObject, FALSE);
- ++cActualACECount;
- }
- }
-#endif // !defined(DACCESS_COMPILE) && !defined(FEATURE_CORECLR)
}
_ASSERTE(cActualACECount <= MaxNumberACEs);
diff --git a/src/md/compiler/classfactory.cpp b/src/md/compiler/classfactory.cpp
index 603f7975aa..338095add3 100644
--- a/src/md/compiler/classfactory.cpp
+++ b/src/md/compiler/classfactory.cpp
@@ -42,14 +42,6 @@ const COCLASS_REGISTER g_CoClasses[] =
{
// pClsid szProgID pfnCreateObject
{ &CLSID_CorMetaDataDispenser, W("CorMetaDataDispenser"), Disp::CreateObject },
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) // coreclr doesn't export these
- { &CLSID_CorMetaDataDispenserRuntime, W("CorMetaDataDispenserRuntime"), Disp::CreateObject },
-
- { &CLSID_CorRuntimeHost, W("CorRuntimeHost"), CorHost::CreateObject },
- { &CLSID_CLRRuntimeHost, W("CLRRuntimeHost"), CorHost2::CreateObject },
- { &__uuidof(CLRPrivRuntime), W("CLRPrivRuntime"), CorHost2::CreateObject },
- { &CLSID_TypeNameFactory, NULL, (PFN_CREATE_OBJ)TypeNameFactoryCreateObject },
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
{ NULL, NULL, NULL }
};
diff --git a/src/md/compiler/disp.cpp b/src/md/compiler/disp.cpp
index b091729744..8012d1f97e 100644
--- a/src/md/compiler/disp.cpp
+++ b/src/md/compiler/disp.cpp
@@ -439,13 +439,6 @@ ErrExit:
return hr;
} // Disp::OpenScopeOnMemory
-#if defined(FEATURE_METADATA_IN_VM) && !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-
-#include <metahost.h>
-// Pointer to the activated CLR interface provided by the shim.
-extern ICLRRuntimeInfo * g_pCLRRuntime;
-
-#endif
//*****************************************************************************
// Get the directory where the CLR system resides.
@@ -458,27 +451,11 @@ Disp::GetCORSystemDirectory(
DWORD cchBuffer, // [in] Size of the buffer
DWORD *pcchBuffer) // [out] Number of characters returned
{
-#if defined(FEATURE_METADATA_IN_VM) && !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- // This implies a machine-wide CLR install root, which may not exist for some CLR
- // skus using standalone metadata.
- *pcchBuffer = cchBuffer;
- hr = g_pCLRRuntime->GetRuntimeDirectory(szBuffer, pcchBuffer);
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-#else //!FEATURE_METADATA_IN_VM || FEATURE_CORECLR
-#ifdef FEATURE_CORECLR
UNREACHABLE_MSG("Calling IMetaDataDispenser::GetCORSystemDirectory! This code should not be "
"reachable or needs to be reimplemented for CoreCLR!");
-#endif //FEATURE_CORECLR
return E_NOTIMPL;
-#endif //!FEATURE_METADATA_IN_VM || FEATURE_CORECLR
} // Disp::GetCORSystemDirectory
HRESULT Disp::FindAssembly( // S_OK or error
diff --git a/src/md/compiler/regmeta.cpp b/src/md/compiler/regmeta.cpp
index feb1cdd31b..b849c6433a 100644
--- a/src/md/compiler/regmeta.cpp
+++ b/src/md/compiler/regmeta.cpp
@@ -581,12 +581,6 @@ RegMeta::QueryInterface(
}
#endif //FEATURE_METADATA_EMIT
-#if defined(FEATURE_METADATA_IN_VM) && !defined(FEATURE_CORECLR)
- else if (riid == IID_IMetaDataValidate)
- {
- *ppUnk = (IMetaDataValidate *)this;
- }
-#endif //defined(FEATURE_METADATA_IN_VM) && !defined(FEATURE_CORECLR)
#ifdef FEATURE_METADATA_EMIT_ALL
else if (riid == IID_IMetaDataFilter)
diff --git a/src/md/compiler/regmeta.h b/src/md/compiler/regmeta.h
index cb7bae17b5..f9967d79c0 100644
--- a/src/md/compiler/regmeta.h
+++ b/src/md/compiler/regmeta.h
@@ -2059,9 +2059,6 @@ private:
CorValidatorModuleType m_ModuleType;
IVEHandler *m_pVEHandler;
-#ifndef FEATURE_CORECLR
- ValidateRecordFunction m_ValidateRecordFunctionTable[TBL_COUNT];
-#endif
CCustAttrHash m_caHash; // Hashed list of custom attribute types seen.
bool m_bKeepKnownCa; // Should all known CA's be kept?
diff --git a/src/md/compiler/regmeta_vm.cpp b/src/md/compiler/regmeta_vm.cpp
index beebb08b5c..38ca308e01 100644
--- a/src/md/compiler/regmeta_vm.cpp
+++ b/src/md/compiler/regmeta_vm.cpp
@@ -29,23 +29,6 @@
#include <metamodelrw.h>
-#ifndef FEATURE_CORECLR
-
-#include <metahost.h>
-
-// Pointer to the activated CLR interface provided by the shim.
-extern ICLRRuntimeInfo *g_pCLRRuntime;
-
-#ifdef FEATURE_METADATA_EMIT_ALL
-
-#include "iappdomainsetup.h"
-
-// {27FFF232-A7A8-40dd-8D4A-734AD59FCD41}
-EXTERN_GUID(IID_IAppDomainSetup, 0x27FFF232, 0xA7A8, 0x40dd, 0x8D, 0x4A, 0x73, 0x4A, 0xD5, 0x9F, 0xCD, 0x41);
-
-#endif //FEATURE_METADATA_EMIT_ALL
-
-#endif // !FEATURE_CORECLR
#define DEFINE_CUSTOM_NODUPCHECK 1
@@ -117,90 +100,8 @@ HRESULT RegMeta::FindCachedReadOnlyEntry(
//*****************************************************************************
HRESULT RegMeta::StartupEE()
{
-#ifdef FEATURE_CORECLR
UNREACHABLE_MSG_RET("About to CoCreateInstance! This code should not be "
"reachable or needs to be reimplemented for CoreCLR!");
-#else // !FEATURE_CORECLR
-
- struct Param
- {
- RegMeta *pThis;
- IUnknown *pSetup;
- IAppDomainSetup *pDomainSetup;
- bool fDoneStart;
- HRESULT hr;
- } param;
- param.pThis = this;
- param.pSetup = NULL;
- param.pDomainSetup = NULL;
- param.fDoneStart = false;
- param.hr = S_OK;
-
- PAL_TRY(Param *, pParam, &param)
- {
- HRESULT hr = S_OK;
-
- DWORD dwBuffer[1 + (MAX_LONGPATH+1) * sizeof(WCHAR) / sizeof(DWORD) + 1];
- BSTR bstrDir = NULL;
-
- // Create a hosting environment.
- IfFailGo(g_pCLRRuntime->GetInterface(
- CLSID_CorRuntimeHost,
- IID_ICorRuntimeHost,
- (void **)&pParam->pThis->m_pCorHost));
-
- // Startup the runtime.
- IfFailGo(pParam->pThis->m_pCorHost->Start());
- pParam->fDoneStart = true;
-
- // Create an AppDomain Setup so we can set the AppBase.
- IfFailGo(pParam->pThis->m_pCorHost->CreateDomainSetup(&pParam->pSetup));
-
- // Get the current directory (place it in a BSTR).
- bstrDir = (BSTR)(dwBuffer + 1);
- if ((dwBuffer[0] = (WszGetCurrentDirectory(MAX_LONGPATH + 1, bstrDir) * sizeof(WCHAR))))
- {
- // QI for the IAppDomainSetup interface.
- IfFailGo(pParam->pSetup->QueryInterface(IID_IAppDomainSetup,
- (void**)&pParam->pDomainSetup));
-
- // Set the AppBase.
- pParam->pDomainSetup->put_ApplicationBase(bstrDir);
- }
-
- // Create a new AppDomain.
- IfFailGo(pParam->pThis->m_pCorHost->CreateDomainEx(W("Compilation Domain"),
- pParam->pSetup,
- NULL,
- &pParam->pThis->m_pAppDomain));
-
- // That's it, we're all set up.
- _ASSERTE(pParam->pThis->m_pAppDomain != NULL);
- pParam->pThis->m_fStartedEE = true;
-
- ErrExit:
- pParam->hr = hr;
- }
- PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- _ASSERTE(!"Unexpected exception setting up hosting environment for security attributes");
- param.hr = E_FAIL;
- }
- PAL_ENDTRY
-
- // Cleanup temporary resources.
- if (m_pAppDomain && FAILED(param.hr))
- m_pAppDomain->Release();
- if (param.pDomainSetup)
- param.pDomainSetup->Release();
- if (param.pSetup)
- param.pSetup->Release();
- if (param.fDoneStart && FAILED(param.hr))
- m_pCorHost->Stop();
- if (m_pCorHost && FAILED(param.hr))
- m_pCorHost->Release();
- return param.hr;
-#endif // FEATURE_CORECLR
}
#endif //FEATURE_METADATA_EMIT_ALL
@@ -471,63 +372,7 @@ RegMeta::ResolveTypeRef(
goto ErrExit;
}
-#ifndef FEATURE_CORECLR
- wcscpy_s(rcModule, _MAX_PATH, wzNameSpace);
-
- //******************
- // Try to find the module on CORPATH
- //******************
-
- if ((wcsncmp(rcModule, W("System."), 16) != 0) &&
- (wcsncmp(rcModule, W("System/"), 16) != 0))
- {
- // only go through regular CORPATH lookup by fully qualified class name when
- // it is not System.*
- hr = CORPATHService::GetClassFromCORPath(
- rcModule,
- tr,
- pMiniMd,
- riid,
- ppIScope,
- ptd);
- }
- else
- {
- // force it to look for System.* in mscorlib.dll
- hr = S_FALSE;
- }
-
- if (hr == S_FALSE)
- {
- LPWSTR szTmp;
- WszSearchPath(
- NULL,
- W("mscorlib.dll"),
- NULL,
- sizeof(rcModule) / sizeof(rcModule[0]),
- rcModule,
- &szTmp);
-
- //*******************
- // Last desperate try!!
- //*******************
-
- // Use the file name "mscorlib:
- IfFailGo(CORPATHService::FindTypeDef(
- rcModule,
- tr,
- pMiniMd,
- riid,
- ppIScope,
- ptd));
- if (hr == S_FALSE)
- {
- IfFailGo(META_E_CANNOTRESOLVETYPEREF);
- }
- }
-#else //FEATURE_CORECLR
IfFailGo(META_E_CANNOTRESOLVETYPEREF);
-#endif //FEATURE_CORECLR
ErrExit:
STOP_MD_PERF(ResolveTypeRef);
diff --git a/src/md/enc/liteweightstgdbrw.cpp b/src/md/enc/liteweightstgdbrw.cpp
index 12779f59c0..de81a017b4 100644
--- a/src/md/enc/liteweightstgdbrw.cpp
+++ b/src/md/enc/liteweightstgdbrw.cpp
@@ -1251,28 +1251,5 @@ BOOL
CLiteWeightStgdbRW::IsValidFileNameLength(
const WCHAR * wszFileName)
{
-#ifdef FEATURE_CORECLR
return TRUE;
-#else
- static const WCHAR const_wszLongPathPrefix[] = W("\\\\?\\");
-
- if (wszFileName == NULL)
- {
- return TRUE;
- }
- size_t cchFileName = wcslen(wszFileName);
- if (cchFileName < _MAX_PATH)
- {
- return TRUE;
- }
- if (SString::_wcsnicmp(wszFileName, const_wszLongPathPrefix, _countof(const_wszLongPathPrefix) - 1) != 0)
- { // Path does not have long path prefix \\?\ (as required by CreateFile API)
- return FALSE;
- }
- if (cchFileName < 32767)
- { // Limit for the long path length as defined in CreateFile API
- return TRUE;
- }
- return FALSE;
-#endif
} // CLiteWeightStgdbRW::IsValidFileNameLength
diff --git a/src/md/enc/metamodelenc.cpp b/src/md/enc/metamodelenc.cpp
index 4d972827ca..7460d580dc 100644
--- a/src/md/enc/metamodelenc.cpp
+++ b/src/md/enc/metamodelenc.cpp
@@ -263,18 +263,6 @@ CMiniMdRW::ApplyDelta(
return E_INVALIDARG;
}
-#ifndef FEATURE_CORECLR
- // Verify that the delta is based on the base.
- IfFailGo(mdDelta.getEncBaseIdOfModule(pModDelta, &GuidDelta));
- IfFailGo(getEncBaseIdOfModule(pModBase,&GuidBase));
- if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MD_DeltaCheck) &&
- CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MD_UseMinimalDeltas) &&
- (GuidDelta != GuidBase))
- {
- _ASSERTE(!"The Delta MetaData is based on a different generation than the current MetaData.");
- return E_INVALIDARG;
- }
-#endif //!FEATURE_CORECLR
// Let the other md prepare for sparse records.
IfFailGo(mdDelta.StartENCMap());
@@ -390,19 +378,6 @@ ErrExit:
HRESULT hrReturn = hr;
IfFailRet(mdDelta.EndENCMap());
-#ifndef FEATURE_CORECLR
- if (SUCCEEDED(hrReturn) &&
- CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MD_DeltaCheck) &&
- CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MD_UseMinimalDeltas))
- {
- GUID GuidNewBase;
-
- // We'll use the delta's 'delta guid' for our new base guid
- IfFailRet(mdDelta.getEncIdOfModule(pModDelta, &GuidNewBase));
-
- IfFailRet(PutGuid(TBL_Module, ModuleRec::COL_EncBaseId, pModBase, GuidNewBase));
- }
-#endif //!FEATURE_CORECLR
return hrReturn;
} // CMiniMdRW::ApplyDelta
diff --git a/src/md/enc/metamodelrw.cpp b/src/md/enc/metamodelrw.cpp
index f9002b6fa9..e6877bc84b 100644
--- a/src/md/enc/metamodelrw.cpp
+++ b/src/md/enc/metamodelrw.cpp
@@ -8228,19 +8228,6 @@ CMiniMdRW::ResetENCLog()
// Get the module record.
IfFailGo(GetModuleRecord(1, &pMod));
-#ifndef FEATURE_CORECLR
- if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MD_UseMinimalDeltas))
- { // Update the ENC Guids
- GUID encid;
- // Copy EncId as BaseId.
- ULONG uVal = GetCol(TBL_Module, ModuleRec::COL_EncId, pMod);
- IfFailGo(PutCol(TBL_Module, ModuleRec::COL_EncBaseId, pMod, uVal));
-
- // Allocate a new GUID for EncId.
- IfFailGo(CoCreateGuid(&encid));
- IfFailGo(PutGuid(TBL_Module, ModuleRec::COL_EncId, pMod, encid));
- }
-#endif //!FEATURE_CORECLR
// Reset the pool deltas
m_StringHeap.StartNewEnCSession();
diff --git a/src/md/inc/metamodelrw.h b/src/md/inc/metamodelrw.h
index 6e00d3cf3e..c2d24db8a5 100644
--- a/src/md/inc/metamodelrw.h
+++ b/src/md/inc/metamodelrw.h
@@ -1420,10 +1420,6 @@ public:
void EnableDeltaMetadataGeneration()
{
_ASSERTE(m_OptionValue.m_UpdateMode == MDUpdateENC);
-#ifndef FEATURE_CORECLR
- if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MD_UseMinimalDeltas))
- m_OptionValue.m_UpdateMode = MDUpdateDelta;
-#endif //!FEATURE_CORECLR
}
void DisableDeltaMetadataGeneration() {m_OptionValue.m_UpdateMode = MDUpdateENC;}
diff --git a/src/md/inc/winmdinterfaces.h b/src/md/inc/winmdinterfaces.h
index 4233e615d3..47f43df083 100644
--- a/src/md/inc/winmdinterfaces.h
+++ b/src/md/inc/winmdinterfaces.h
@@ -103,15 +103,7 @@ HRESULT VerifyNotWinMDHelper(IUnknown *pUnknown
,int line
#endif //_DEBUG
);
-#if defined(FEATURE_METADATA_IN_VM) && !defined(FEATURE_CORECLR)
-#ifdef _DEBUG
-#define VerifyNotWinMD(pUnknown, assertMsg) VerifyNotWinMDHelper(pUnknown, assertMsg, __FILE__, __LINE__)
-#else
-#define VerifyNotWinMD(pUnknown, assertMsg) VerifyNotWinMDHelper(pUnknown)
-#endif
-#else
#define VerifyNotWinMD(pUnknown, assertMsg) S_OK
-#endif // FEATURE_METADATA_IN_VM
#endif //__WINMDINTERFACES_H__
diff --git a/src/md/winmd/adapter.cpp b/src/md/winmd/adapter.cpp
index 2c9dd1b9fd..d4e95b7f8b 100644
--- a/src/md/winmd/adapter.cpp
+++ b/src/md/winmd/adapter.cpp
@@ -1185,14 +1185,12 @@ void WinMDAdapter::GetExtraAssemblyRefProps(FrameworkAssemblyIndex index,
if (ppPublicKeytoken)
{
-#ifdef FEATURE_CORECLR
if (index == FrameworkAssembly_Mscorlib)
{
*ppPublicKeytoken = g_rbTheSilverlightPlatformKeyToken;
*pTokenLength = sizeof(g_rbTheSilverlightPlatformKeyToken);
}
else
-#endif
{
if (index == FrameworkAssembly_SystemNumericsVectors || index == FrameworkAssembly_SystemRuntime || index == FrameworkAssembly_SystemObjectModel)
{
diff --git a/src/md/winmd/inc/adapter.h b/src/md/winmd/inc/adapter.h
index e42992f81f..cc422017b6 100644
--- a/src/md/winmd/inc/adapter.h
+++ b/src/md/winmd/inc/adapter.h
@@ -236,14 +236,12 @@ public:
if (pusRevisionNumber != nullptr)
*pusRevisionNumber = VER_ASSEMBLYBUILD_QFE;
-#ifdef FEATURE_CORECLR
// Under CoreCLR, we replace the ECMA key in the mscorlib assembly ref with the CoreCLR platform public key token
if (ppbPublicKeyOrToken != nullptr)
{
*ppbPublicKeyOrToken = g_rbTheSilverlightPlatformKeyToken;
*pcbPublicKeyOrToken = _countof(g_rbTheSilverlightPlatformKeyToken);
}
-#endif
}
else if (RidFromToken(mdar) > m_rawAssemblyRefCount)
{
@@ -632,11 +630,7 @@ public:
case FrameworkAssembly_SystemRuntimeWindowsRuntimeUIXaml:
return "System.Runtime.WindowsRuntime.UI.Xaml";
case FrameworkAssembly_SystemNumericsVectors:
-#ifdef FEATURE_CORECLR
return "System.Numerics.Vectors";
-#else
- return "System.Numerics";
-#endif
default:
_ASSERTE(!"Invalid AssemblyRef token!");
return NULL;
diff --git a/src/pal/prebuilt/inc/asm_version.h b/src/pal/prebuilt/inc/asm_version.h
index f1f2b0ad7d..a9a9fed18a 100644
--- a/src/pal/prebuilt/inc/asm_version.h
+++ b/src/pal/prebuilt/inc/asm_version.h
@@ -1,15 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-#if defined(SILVERLIGHT) || defined(FEATURE_CORECLR)
#define asm_rmj 4
#define asm_rmm 0
#define asm_rup 0
#define asm_rpt 0
-#else
-#define asm_rmj 4
-#define asm_rmm 0
-#define asm_rup 0
-#define asm_rpt 0
-#endif
diff --git a/src/pal/src/locale/utf8.cpp b/src/pal/src/locale/utf8.cpp
index 87493a9673..ca55a4e23b 100644
--- a/src/pal/src/locale/utf8.cpp
+++ b/src/pal/src/locale/utf8.cpp
@@ -1399,7 +1399,6 @@ public:
EncodeChar:
-#ifdef FASTLOOP
int availableBytes = PtrDiff(pEnd, pSrc);
// don't fall into the fast decoding loop if we don't have enough bytes
@@ -1565,7 +1564,6 @@ public:
// extra byte
charCount--;
}
-#endif // FASTLOOP
// no pending bits at this point
ch = 0;
@@ -1815,7 +1813,6 @@ public:
*pTarget = (WCHAR)ch;
pTarget++;
-#ifdef FASTLOOP
int availableChars = PtrDiff(pAllocatedBufferEnd, pTarget);
int availableBytes = PtrDiff(pEnd, pSrc);
@@ -2054,7 +2051,6 @@ public:
// subtract an extra count from pStop so that we don't overrun the input.
pStop--;
}
-#endif // FASTLOOP
Contract::Assert(pTarget <= pAllocatedBufferEnd, "[UTF8Encoding.GetChars]pTarget <= pAllocatedBufferEnd");
@@ -2301,7 +2297,6 @@ public:
pTarget++;
-#ifdef FASTLOOP
// If still have fallback don't do fast loop
if (fallbackBuffer != nullptr && (ch = fallbackBuffer->InternalGetNextChar()) != 0)
goto ProcessChar;
@@ -2480,7 +2475,6 @@ public:
Contract::Assert(pTarget <= pAllocatedBufferEnd, "[UTF8Encoding.GetBytes]pTarget <= pAllocatedBufferEnd");
-#endif // FASTLOOP
// no pending char at this point
ch = 0;
@@ -2645,7 +2639,6 @@ public:
}
#endif
-#ifdef FASTLOOP
// If still have fallback don't do fast loop
if (fallbackBuffer != nullptr && (ch = fallbackBuffer->InternalGetNextChar()) != 0)
{
@@ -2797,7 +2790,6 @@ public:
// byteCount - the last byte is already included
}
-#endif // FASTLOOP
// no pending char at this point
ch = 0;
diff --git a/src/pal/src/misc/dbgmsg.cpp b/src/pal/src/misc/dbgmsg.cpp
index d6f173f160..5eb5ebf9ba 100644
--- a/src/pal/src/misc/dbgmsg.cpp
+++ b/src/pal/src/misc/dbgmsg.cpp
@@ -50,11 +50,7 @@ using namespace CorUnix;
/* append mode file I/O is safer */
#define _PAL_APPEND_DBG_OUTPUT_
-#if defined(_PAL_APPEND_DBG_OUTPUT_)
static const char FOPEN_FLAGS[] = "at";
-#else
-static const char FOPEN_FLAGS[] = "wt";
-#endif
/* number of ENTRY nesting levels to indicate with a '.' */
#define MAX_NESTING 50
diff --git a/src/pal/src/safecrt/safecrt_output_l.cpp b/src/pal/src/safecrt/safecrt_output_l.cpp
index d6844f4f8b..6cc105abf9 100644
--- a/src/pal/src/safecrt/safecrt_output_l.cpp
+++ b/src/pal/src/safecrt/safecrt_output_l.cpp
@@ -84,9 +84,6 @@ Buffer size required to be passed to _gcvt, fcvt and other fp conversion routine
// SNIP -srs 7/3/07
-#ifndef _CFLTCVT
-#define _CFLTCVT _cfltcvt
-#endif /* _CFLTCVT */
#ifndef _CLDCVT
#define _CLDCVT _cldcvt
@@ -146,14 +143,6 @@ Buffer size required to be passed to _gcvt, fcvt and other fp conversion routine
#define BUFFERSIZE 512
#define MAXPRECISION BUFFERSIZE
-#if BUFFERSIZE < _CVTBUFSIZE + 6
-/*
- * Buffer needs to be big enough for default minimum precision
- * when converting floating point needs bigger buffer, and malloc
- * fails
- */
-#error Conversion buffer too small for max double.
-#endif /* BUFFERSIZE < _CVTBUFSIZE + 6 */
/* flag definitions */
#define FL_SIGN 0x00001 /* put plus or minus in front */
@@ -935,11 +924,6 @@ int __cdecl _output (
else
#endif /* !LONG_IS_INT */
-#if !SHORT_IS_INT
- if (flags & FL_SHORT)
- *(short *)p = (short) charsout;
- else
-#endif /* !SHORT_IS_INT */
*(int *)p = charsout;
no_output = 1; /* force no output */
@@ -1085,15 +1069,6 @@ int __cdecl _output (
else
#endif /* !LONG_IS_INT */
-#if !SHORT_IS_INT
- if (flags & FL_SHORT) {
- if (flags & FL_SIGNED)
- l = (short) get_int_arg(&argptr); /* sign extend */
- else
- l = (unsigned short) get_int_arg(&argptr); /* zero-extend*/
-
- } else
-#endif /* !SHORT_IS_INT */
{
if (flags & FL_SIGNED)
l = get_int_arg(&argptr); /* sign extend */
diff --git a/src/strongname/inc/sncoreclr.h b/src/strongname/inc/sncoreclr.h
index a2f794b26a..1b84a32372 100644
--- a/src/strongname/inc/sncoreclr.h
+++ b/src/strongname/inc/sncoreclr.h
@@ -5,9 +5,6 @@
#ifndef _SNCORECLR_H
#define _SNCORECLR_H
-#if !defined(FEATURE_CORECLR)
-#error sncoreclr.h should only be used on CoreCLR builds
-#endif // !FEATURE_CORECLR
void InitUtilcode();
diff --git a/src/strongname/inc/strongnameholders.h b/src/strongname/inc/strongnameholders.h
index a439768e74..b6af80f583 100644
--- a/src/strongname/inc/strongnameholders.h
+++ b/src/strongname/inc/strongnameholders.h
@@ -21,7 +21,7 @@ void VoidStrongNameFreeBuffer(__in T *pBuffer)
}
NEW_WRAPPER_TEMPLATE1(StrongNameBufferHolder, VoidStrongNameFreeBuffer<_TYPE>);
-#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX))
+#if defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)
// Holder for HCRYPTPROV handles directly allocated from CAPI
inline void ReleaseCapiProvider(HCRYPTPROV hProv)
{
diff --git a/src/strongname/inc/strongnameinternal.h b/src/strongname/inc/strongnameinternal.h
index 614fdfb53a..5aae39daa2 100644
--- a/src/strongname/inc/strongnameinternal.h
+++ b/src/strongname/inc/strongnameinternal.h
@@ -35,7 +35,7 @@ bool StrongNameIsEcmaKey(const PublicKeyBlob &keyPublicKey);
bool StrongNameIsTheKey(__in_ecount(cbKey) const BYTE *pbKey, DWORD cbKey);
-#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX))
+#if defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)
// Verify the format of a public key blob
bool StrongNameIsValidKeyPair(__in_ecount(cbKeyPair) const BYTE *pbKeyPair, DWORD cbKeyPair);
@@ -45,9 +45,7 @@ bool GetBytesFromHex(LPCUTF8 szHexString, ULONG cchHexString, BYTE** buffer, ULO
bool StrongNameCryptAcquireContext(HCRYPTPROV *phProv, LPCWSTR pwszContainer, LPCWSTR pwszProvider, DWORD dwProvType, DWORD dwFlags);
#endif // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX)
-#ifdef FEATURE_CORECLR
bool StrongNameIsSilverlightPlatformKey(__in_ecount(cbKey) const BYTE *pbKey, DWORD cbKey);
bool StrongNameIsSilverlightPlatformKey(const PublicKeyBlob &keyPublicKey);
-#endif // FEATURE_CORECLR
#endif // !_STRONGNAME_INTERNAL_H
diff --git a/src/strongname/inc/thekey.h b/src/strongname/inc/thekey.h
index 24d0375c5e..7a53f4713b 100644
--- a/src/strongname/inc/thekey.h
+++ b/src/strongname/inc/thekey.h
@@ -21,7 +21,6 @@ static const BYTE g_rbTheKey[] =
static const BYTE g_rbTheKeyToken[] = {0xb0,0x3f,0x5f,0x7f,0x11,0xd5,0x0a,0x3a};
-#ifdef FEATURE_CORECLR
static const BYTE g_rbTheSilverlightPlatformKey[] =
{
0x00,0x24,0x00,0x00,0x04,0x80,0x00,0x00,0x94,0x00,0x00,0x00,0x06,0x02,0x00,0x00,
@@ -100,5 +99,4 @@ static const BYTE g_rbTheMicrosoftXNAKeyToken[] = {0xCC,0xAC,0x92,0xED,0x87,0x3B
#endif
// for FEATURE_WINDOWSPHONE, we can add the Microsoft.Phone key and the Xna key to the list of blessed keys...
-#endif // FEATURE_CORECLR
diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp
index a3e66e69e2..285714c777 100644
--- a/src/tools/crossgen/crossgen.cpp
+++ b/src/tools/crossgen/crossgen.cpp
@@ -36,9 +36,7 @@ enum ReturnValues
STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo, LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths, LPCWSTR pwzDiasymreaderPath);
STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL, LPCWSTR pwzPlatformWinmdPaths=NULL, ICorSvcLogger *pLogger = NULL, LPCWSTR pwszCLRJITPath = nullptr);
void SetSvcLogger(ICorSvcLogger *pCorSvcLogger);
-#ifdef FEATURE_CORECLR
void SetMscorlibPath(LPCWSTR wzSystemDirectory);
-#endif
/* --------------------------------------------------------------------------- *
* Console stuff
@@ -94,11 +92,7 @@ void ErrorWin32(DWORD err)
void PrintLogoHelper()
{
-#ifdef FEATURE_CORECLR
Output(W("Microsoft (R) CoreCLR Native Image "));
-#else
- Output(W("Microsoft (R) CLR Native Image "));
-#endif
Outputf(W("Generator - Version %S\n"), VER_FILEVERSION_STR);
Outputf(W("%S\n"), VER_LEGALCOPYRIGHT_LOGO_STR);
Output(W("\n"));
@@ -116,12 +110,9 @@ void PrintUsageHelper()
W(" /nologo - Prevents displaying the logo\n")
W(" @response.rsp - Process command line arguments from specified\n")
W(" response file\n")
-#ifdef FEATURE_CORECLR
W(" /partialtrust - Assembly will be run in a partial trust domain.\n")
-#endif
W(" /in <file> - Specifies input filename (optional)\n")
W(" /out <file> - Specifies output filename (optional)\n")
-#ifdef FEATURE_CORECLR
W(" /Trusted_Platform_Assemblies <path[") PATH_SEPARATOR_STR_W W("path]>\n")
W(" - List of assemblies treated as trusted platform\n")
W(" - Cannot be used with Platform_Assemblies_Paths\n")
@@ -134,15 +125,12 @@ void PrintUsageHelper()
W(" - List of paths containing user-application native images\n")
W(" - Must be used with /CreatePDB switch\n")
#endif // NO_NGENPDB
-#endif // FEATURE_CORECLR
W(" /Platform_Assemblies_Paths <path[") PATH_SEPARATOR_STR_W W("path]>\n")
W(" - List of paths containing target platform assemblies\n")
-#ifdef FEATURE_CORECLR
// If Platform_Assemblies_Paths, we will use it to build the TPA list and thus,
// TPA list cannot be explicitly specified.
W(" - Cannot be used with Trusted_Platform_Assemblies\n")
-#endif // FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
W(" /Platform_Winmd_Paths <path[") PATH_SEPARATOR_STR_W W("path]>\n")
@@ -156,7 +144,7 @@ void PrintUsageHelper()
W(" /Tuning - Generate an instrumented image to collect\n")
W(" scenario traces, which can be used with ibcmerge.exe\n")
#endif
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
W(" /JITPath <path>\n")
W(" - Specifies the absolute file path to JIT compiler to be used.\n")
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -168,19 +156,15 @@ void PrintUsageHelper()
W(" WinMD Parameters\n")
W(" /WinMDResilient - Generate images resilient to WinMD dependency changes.\n")
#endif
-#ifdef FEATURE_CORECLR
W(" Size on Disk Parameters\n")
W(" /NoMetaData - Do not copy metadata and IL into native image.\n")
-#endif // FEATURE_CORECLR
#ifndef NO_NGENPDB
W(" Debugging Parameters\n")
W(" /CreatePDB <Dir to store PDB> [/lines [<search path for managed PDB>] ]\n")
W(" When specifying /CreatePDB, the native image should be created\n")
W(" first, and <assembly name> should be the path to the NI.\n")
-#ifdef FEATURE_CORECLR
W(" /DiasymreaderPath <Path to diasymreader.dll>\n")
W(" - Specifies the absolute file path to diasymreader.dll to be used.\n")
-#endif // FEATURE_CORECLR
#elif defined(FEATURE_PERFMAP)
W(" Debugging Parameters\n")
W(" /CreatePerfMap <Dir to store perf map>\n")
@@ -265,7 +249,6 @@ bool StringEndsWith(LPCWSTR pwzString, LPCWSTR pwzCandidate)
return !_wcsicmp(pwzStringEnd, pwzCandidate);
}
-#ifdef FEATURE_CORECLR
//
// When using the Phone binding model (TrustedPlatformAssemblies), automatically
// detect which path CoreLib.[ni.]dll lies in.
@@ -429,7 +412,6 @@ void ComputeTPAListFromPlatformAssembliesPath(LPCWSTR pwzPlatformAssembliesPaths
}
}
}
-#endif // FEATURE_CORECLR
extern HMODULE g_hThisInst;
@@ -459,7 +441,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
LPCWSTR pwzOutputFilename = NULL;
LPCWSTR pwzPublicKeys = nullptr;
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
LPCWSTR pwszCLRJITPath = nullptr;
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -501,10 +483,8 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
// By default, Crossgen will assume code-generation for fulltrust domains unless /PartialTrust switch is specified
dwFlags |= NGENWORKER_FLAGS_FULLTRUSTDOMAIN;
-#ifdef FEATURE_CORECLR
// By default, Crossgen will generate readytorun images unless /FragileNonVersionable switch is specified
dwFlags |= NGENWORKER_FLAGS_READYTORUN;
-#endif
while (argc > 0)
{
@@ -526,7 +506,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
{
dwFlags |= NGENWORKER_FLAGS_MISSINGDEPENDENCIESOK;
}
-#ifdef FEATURE_CORECLR
else if (MatchParameter(*argv, W("PartialTrust")))
{
// Clear the /fulltrust flag
@@ -551,7 +530,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
argc--;
}
#endif // !defined(FEATURE_MERGE_JIT_AND_ENGINE)
-#endif
#ifdef FEATURE_WINMD_RESILIENT
else if (MatchParameter(*argv, W("WinMDResilient")))
{
@@ -568,12 +546,10 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
dwFlags &= ~NGENWORKER_FLAGS_READYTORUN;
}
#endif
-#ifdef FEATURE_CORECLR
else if (MatchParameter(*argv, W("NoMetaData")))
{
dwFlags |= NGENWORKER_FLAGS_NO_METADATA;
}
-#endif
else if (MatchParameter(*argv, W("out")))
{
if (pwzOutputFilename != NULL)
@@ -596,7 +572,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
argv++;
argc--;
}
-#ifdef FEATURE_CORECLR
else if (MatchParameter(*argv, W("Trusted_Platform_Assemblies")) && (argc > 1))
{
pwzTrustedPlatformAssemblies = argv[1];
@@ -631,7 +606,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
argc--;
}
#endif // NO_NGENPDB
-#endif // FEATURE_CORECLR
else if (MatchParameter(*argv, W("Platform_Assemblies_Paths")) && (argc > 1))
{
pwzPlatformAssembliesPaths = argv[1];
@@ -708,7 +682,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
argv--;
argc++;
}
-#ifdef FEATURE_CORECLR
else if (MatchParameter(*argv, W("DiasymreaderPath")) && (argc > 1))
{
pwzDiasymreaderPath = argv[1];
@@ -717,7 +690,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
argv++;
argc--;
}
-#endif // FEATURE_CORECLR
#endif // NO_NGENPDB
#ifdef FEATURE_PERFMAP
else if (MatchParameter(*argv, W("CreatePerfMap")) && (argc > 1))
@@ -816,7 +788,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
exit(FAILURE_RESULT);
}
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
if (pwszCLRJITPath != nullptr && fCreatePDB)
{
Output(W("The /JITPath switch can not be used with the /CreatePDB switch.\n"));
@@ -824,7 +796,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
}
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
if (pwzDiasymreaderPath != nullptr && !fCreatePDB)
{
Output(W("The /DiasymreaderPath switch can only be used with the /CreatePDB switch.\n"));
@@ -832,7 +804,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
}
#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
-#if defined(FEATURE_CORECLR)
if ((pwzTrustedPlatformAssemblies != nullptr) && (pwzPlatformAssembliesPaths != nullptr))
{
Output(W("The /Trusted_Platform_Assemblies and /Platform_Assemblies_Paths switches cannot be both specified.\n"));
@@ -863,7 +834,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
exit(FAILURE_RESULT);
}
}
-#endif // FEATURE_CORESYSTEM
#ifdef FEATURE_READYTORUN_COMPILER
if (((dwFlags & NGENWORKER_FLAGS_TUNING) != 0) && ((dwFlags & NGENWORKER_FLAGS_READYTORUN) != 0))
@@ -888,7 +858,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
PathString wzTrustedPathRoot;
-#ifdef FEATURE_CORECLR
SString ssTPAList;
if (fCreatePDB)
@@ -924,7 +893,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
SetMscorlibPath(pwzPlatformAssembliesPaths);
}
}
-#endif // FEATURE_CORECLR
if (pwzPlatformAssembliesPaths == NULL)
{
@@ -977,7 +945,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
pwzAppPaths,
pwzOutputFilename,
pwzPlatformWinmdPaths
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
,
NULL, // ICorSvcLogger
pwszCLRJITPath
diff --git a/src/tools/metainfo/mdinfo.cpp b/src/tools/metainfo/mdinfo.cpp
index 70dfa28bcf..143220117e 100644
--- a/src/tools/metainfo/mdinfo.cpp
+++ b/src/tools/metainfo/mdinfo.cpp
@@ -22,9 +22,6 @@
#define LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY WszLoadLibrary
#define LEGACY_ACTIVATION_SHIM_DEFINE_CoInitializeEE
-#ifndef FEATURE_CORECLR
-#include "LegacyActivationShim.h"
-#endif
#define ENUM_BUFFER_SIZE 10
#define TAB_SIZE 8
@@ -760,12 +757,6 @@ void MDInfo::Error(const char* szError, HRESULT hr)
pIErr->Release();
}
-#ifndef FEATURE_CORECLR
- LegacyActivationShim::CoUninitializeCor();
-#ifndef FEATURE_PAL
- CoUninitialize();
-#endif
-#endif
exit(hr);
} // void MDInfo::Error()
diff --git a/src/utilcode/appxutil.cpp b/src/utilcode/appxutil.cpp
index 759fbffcb1..5d095a4873 100644
--- a/src/utilcode/appxutil.cpp
+++ b/src/utilcode/appxutil.cpp
@@ -19,7 +19,6 @@
#include "shlwapi.h" // Path manipulation APIs
-#ifdef FEATURE_CORECLR
GVAL_IMPL(bool, g_fAppX);
INDEBUG(bool g_fIsAppXAsked;)
@@ -49,822 +48,3 @@ namespace AppX
#endif
};
-#else // FEATURE_CORECLR
-
-//---------------------------------------------------------------------------------------------
-// Convenience values
-
-#ifndef E_INSUFFICIENT_BUFFER
- #define E_INSUFFICIENT_BUFFER (HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
-#endif
-
-#ifndef E_FILE_NOT_FOUND
- #define E_FILE_NOT_FOUND (HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
-#endif
-
-//---------------------------------------------------------------------------------------------
-using clr::str::IsNullOrEmpty;
-
-//---------------------------------------------------------------------------------------------
-typedef decltype(GetCurrentPackageId) GetCurrentPackageId_t;
-typedef decltype(GetCurrentPackageInfo) GetCurrentPackageInfo_t;
-typedef decltype(GetCurrentPackagePath) GetCurrentPackagePath_t;
-typedef decltype(OpenPackageInfoByFullName) OpenPackageInfoByFullName_t;
-typedef decltype(ClosePackageInfo) ClosePackageInfo_t;
-typedef decltype(GetPackageInfo) GetPackageInfo_t;
-
-//---------------------------------------------------------------------------------------------
-// Caches AppX ARI API-related information.
-struct AppXRTInfo
-{
- HMODULE m_hAppXRTMod;
- bool m_fIsAppXProcess;
- bool m_fIsAppXAdaptiveApp;
- bool m_fIsAppXNGen;
-
- GetCurrentPackageId_t * m_pfnGetCurrentPackageId;
- GetCurrentPackageInfo_t * m_pfnGetCurrentPackageInfo;
- GetCurrentPackagePath_t * m_pfnGetCurrentPackagePath;
-
- NewArrayHolder<BYTE> m_pbAppContainerInfo;
- DWORD m_cbAppContainerInfo;
-
- struct CurrentPackageInfo
- {
- UINT32 m_cbCurrentPackageInfo;
- PBYTE m_pbCurrentPackageInfo;
- UINT32 m_nCount;
-
- CurrentPackageInfo(UINT32 cbPkgInfo, PBYTE pbPkgInfo, UINT32 nCount)
- : m_cbCurrentPackageInfo(cbPkgInfo)
- , m_pbCurrentPackageInfo(pbPkgInfo)
- , m_nCount(nCount)
- { LIMITED_METHOD_CONTRACT; }
-
- ~CurrentPackageInfo()
- {
- LIMITED_METHOD_CONTRACT;
- if (m_pbCurrentPackageInfo != nullptr)
- {
- delete [] m_pbCurrentPackageInfo;
- m_pbCurrentPackageInfo = nullptr;
- }
- }
- };
-
- CurrentPackageInfo * m_pCurrentPackageInfo;
-
- NewArrayHolder<WCHAR> m_AdaptiveAppWinmetadataDir;
-
- AppXRTInfo() :
- m_hAppXRTMod(nullptr),
- m_fIsAppXProcess(false),
- m_fIsAppXAdaptiveApp(false),
- m_fIsAppXNGen(false),
- m_pfnGetCurrentPackageId(nullptr),
- m_pfnGetCurrentPackageInfo(nullptr),
- m_pfnGetCurrentPackagePath(nullptr),
- m_pbAppContainerInfo(nullptr),
- m_pCurrentPackageInfo(nullptr),
- m_AdaptiveAppWinmetadataDir(nullptr)
- { LIMITED_METHOD_CONTRACT; }
-
- ~AppXRTInfo()
- {
- LIMITED_METHOD_CONTRACT;
- if (m_pCurrentPackageInfo != nullptr)
- {
- delete m_pCurrentPackageInfo;
- m_pCurrentPackageInfo = nullptr;
- }
-
- if (m_hAppXRTMod != nullptr)
- {
- FreeLibrary(m_hAppXRTMod);
- m_hAppXRTMod = nullptr;
- }
- }
-}; // struct AppXRTInfo
-
-GPTR_IMPL(AppXRTInfo, g_pAppXRTInfo); // Relies on zero init static memory.
-
-#ifndef DACCESS_COMPILE
-
-//---------------------------------------------------------------------------------------------
-static
-HRESULT GetAppContainerTokenInfoForProcess(
- DWORD pid,
- NewArrayHolder<BYTE>& pbAppContainerTokenInfo,
- DWORD* pcbAppContainerTokenInfo)
-{
- PRECONDITION(CheckPointer(pcbAppContainerTokenInfo, NULL_OK));
-
- HRESULT hr = S_OK;
-
- pbAppContainerTokenInfo = nullptr;
-
- // In order to get the AppContainer SID we need to open the process token
- HandleHolder hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
- if (hProcess == NULL)
- return HRESULT_FROM_GetLastError();
-
- HandleHolder hToken;
- if (!OpenProcessToken(hProcess, TOKEN_QUERY, &hToken))
- return HRESULT_FROM_GetLastError();
-
- // Query the process to see if it's inside an AppContainer
- ULONG isAppContainer = 0;
- DWORD actualLength = 0;
- if (!GetTokenInformation(hToken, static_cast<TOKEN_INFORMATION_CLASS>(TokenIsAppContainer), &isAppContainer, sizeof(isAppContainer), &actualLength))
- return HRESULT_FROM_GetLastError();
-
- _ASSERTE(actualLength > 0);
-
- // Not an AppContainer so bail
- if (!isAppContainer)
- {
- return S_FALSE;
- }
-
- // Now we need the AppContainer SID so first get the required buffer length
- actualLength = 0;
- VERIFY(!GetTokenInformation(hToken, static_cast<TOKEN_INFORMATION_CLASS>(TokenAppContainerSid), NULL, 0, &actualLength));
- hr = HRESULT_FROM_GetLastError();
- _ASSERTE(hr == E_INSUFFICIENT_BUFFER);
-
- // Something unexpected happened
- if (hr != E_INSUFFICIENT_BUFFER)
- return hr;
-
- // Now we know the length of the AppContainer SID so create a buffer and retrieve it
- pbAppContainerTokenInfo = new (nothrow) BYTE[actualLength];
- IfNullRet(pbAppContainerTokenInfo);
-
- if (!GetTokenInformation(hToken, static_cast<TOKEN_INFORMATION_CLASS>(TokenAppContainerSid), pbAppContainerTokenInfo.GetValue(), actualLength, &actualLength))
- return HRESULT_FROM_GetLastError();
-
- if (pcbAppContainerTokenInfo != nullptr)
- *pcbAppContainerTokenInfo = actualLength;
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------------------------
-// Initializes a global AppXRTInfo structure if it has not already been initialized. Returns
-// false only in the event of OOM; otherwise caches the result of ARI information in
-// g_pAppXRTInfo. Thread safe.
-static
-HRESULT InitAppXRT()
-{
- // This will be used for catastrophic errors.
- HRESULT hr = S_OK;
-
- if (VolatileLoad(&g_pAppXRTInfo) == nullptr)
- {
- NewHolder<AppXRTInfo> pAppXRTInfo = new (nothrow) AppXRTInfo();
- IfNullRet(pAppXRTInfo); // Catastrophic error.
-
- pAppXRTInfo->m_fIsAppXProcess = false;
-
- do
- {
- if (!RunningOnWin8())
- {
- break;
- }
-
- LPCWSTR wzAppXRTDll = W("api-ms-win-appmodel-runtime-l1-1-0.dll");
- // Does not use GetLoadWithAlteredSearchPathFlag() because that would cause infinite recursion.
- pAppXRTInfo->m_hAppXRTMod = WszLoadLibraryEx(wzAppXRTDll, nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
- if (pAppXRTInfo->m_hAppXRTMod == nullptr)
- { // Error is catastrophic: can't find kernel32.dll?
- hr = HRESULT_FROM_GetLastError();
- break;
- }
-
- pAppXRTInfo->m_pfnGetCurrentPackageId = reinterpret_cast<GetCurrentPackageId_t *>(
- GetProcAddress(pAppXRTInfo->m_hAppXRTMod, "GetCurrentPackageId"));
- if (pAppXRTInfo->m_pfnGetCurrentPackageId == nullptr)
- { // Error is non-catastrophic: could be running downlevel
- break;
- }
-
- pAppXRTInfo->m_pfnGetCurrentPackageInfo = reinterpret_cast<GetCurrentPackageInfo_t *>(
- GetProcAddress(pAppXRTInfo->m_hAppXRTMod, "GetCurrentPackageInfo"));
- if (pAppXRTInfo->m_pfnGetCurrentPackageInfo == nullptr)
- { // Error is catastrophic: GetCurrentPackageId is available but not GetCurrentPackageInfo?
- hr = HRESULT_FROM_GetLastError();
- break;
- }
-
- pAppXRTInfo->m_pfnGetCurrentPackagePath = reinterpret_cast<GetCurrentPackagePath_t *>(
- GetProcAddress(pAppXRTInfo->m_hAppXRTMod, "GetCurrentPackagePath"));
- if (pAppXRTInfo->m_pfnGetCurrentPackagePath == nullptr)
- { // Error is catastrophic: GetCurrentPackageInfo is available but not GetCurrentPackagePath?
- hr = HRESULT_FROM_GetLastError();
- break;
- }
-
- // Determine if this is an AppX process
- UINT32 cbBuffer = 0;
- LONG lRes = (*pAppXRTInfo->m_pfnGetCurrentPackageId)(&cbBuffer, nullptr);
- pAppXRTInfo->m_fIsAppXProcess = (lRes == ERROR_INSUFFICIENT_BUFFER);
-
- _ASSERTE(AppX::IsAppXSupported());
-
- hr = GetAppContainerTokenInfoForProcess(
- GetCurrentProcessId(),
- pAppXRTInfo->m_pbAppContainerInfo,
- &pAppXRTInfo->m_cbAppContainerInfo);
-
- if (FAILED(hr))
- {
- if (pAppXRTInfo->m_fIsAppXProcess)
- { // Error is catastrophic: running in true immersive process but no token info?
- }
- else
- { // Error is non-catastrophic: reset HRESULT to S_OK.
- hr = S_OK;
- }
- break;
- }
- }
- while (false);
-
- if (InterlockedCompareExchangeT<AppXRTInfo>(&g_pAppXRTInfo, pAppXRTInfo, nullptr) == nullptr)
- {
- pAppXRTInfo.SuppressRelease();
- }
- }
-
- return hr;
-}
-
-//---------------------------------------------------------------------------------------------
-// Inline helper to check first an only init when required.
-static inline HRESULT CheckInitAppXRT()
-{
- return (VolatileLoad(&g_pAppXRTInfo) != nullptr) ? S_OK : InitAppXRT();
-}
-
-#endif // !DACCESS_COMPILE
-
-//---------------------------------------------------------------------------------------------
-// Contains general helper methods for interacting with AppX functionality. This code will
-// gracefully fail on downlevel OS by returning false from AppX::IsAppXProcess, so always
-// call this API first to check before calling any of the others defined in this namespace.
-//
-// See http://windows/windows8/docs/Windows%208%20Feature%20Documents/Developer%20Experience%20(DEVX)/Apps%20Experience%20(APPX)/Modern%20Client/App%20Runtime%20Improvements%20API%20Developer%20Platform%20Spec.docm
-// for more information.
-
-namespace AppX
-{
-#ifdef DACCESS_COMPILE
-
- //-----------------------------------------------------------------------------------------
- // DAC-only IsAppXProcess. Returns false if g_pAppXRTInfo has not been initialized.
- bool DacIsAppXProcess()
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return (g_pAppXRTInfo != nullptr && g_pAppXRTInfo->m_fIsAppXProcess);
- }
-
-#else // DACCESS_COMPILE
-
- //---------------------------------------------------------------------------------------------
- // cleans up resources allocated in InitAppXRT()
- void ShutDown()
- {
- if (VolatileLoad(&g_pAppXRTInfo) != nullptr)
- {
- delete g_pAppXRTInfo;
- g_pAppXRTInfo = nullptr;
- }
- }
-
- //-----------------------------------------------------------------------------------------
- // Returns true if the current process is immersive.
- // NOTE: a return value of true doesn't necessarily indicate that the process is a
- // real Metro app, e.g. it could be an ngen process compiling an AppX assembly.
- bool IsAppXProcess()
- {
- LIMITED_METHOD_CONTRACT;
- HRESULT hr = S_OK;
-
- if (FAILED(hr = CheckInitAppXRT()))
- {
- SetLastError(hr); // HRESULT_FROM_WIN32 is idempotent when error value is HRESULT.
- return false;
- }
-
- return g_pAppXRTInfo->m_fIsAppXProcess;
- }
-
- //-----------------------------------------------------------------------------------------
- // Returns true if the current process is immersive.
- // Only produces reliable results after IsAppXProcess is inititalized
- bool IsAppXProcess_Initialized_NoFault()
- {
- LIMITED_METHOD_CONTRACT;
- if (VolatileLoad(&g_pAppXRTInfo) == nullptr)
- {
- return false;
- }
- return g_pAppXRTInfo->m_fIsAppXProcess;
- }
-
- bool IsAppXNGen()
- {
- LIMITED_METHOD_CONTRACT;
- return VolatileLoad(&g_pAppXRTInfo) != nullptr && g_pAppXRTInfo->m_fIsAppXNGen;
- }
-
- //-----------------------------------------------------------------------------------------
- HRESULT InitCurrentPackageInfoCache()
- {
- LIMITED_METHOD_CONTRACT;
- HRESULT hr = S_OK;
-
- UINT32 cbBuffer = 0;
- hr = HRESULT_FROM_WIN32((*g_pAppXRTInfo->m_pfnGetCurrentPackageInfo)(PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, nullptr, nullptr));
- if (hr != E_INSUFFICIENT_BUFFER)
- return hr;
-
- NewArrayHolder<BYTE> pbBuffer(new (nothrow) BYTE[cbBuffer]);
- IfNullRet(pbBuffer);
-
- UINT32 nCount = 0;
- IfFailRet(HRESULT_FROM_WIN32((*g_pAppXRTInfo->m_pfnGetCurrentPackageInfo)(PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, pbBuffer, &nCount)));
-
- NewHolder<AppXRTInfo::CurrentPackageInfo> pPkgInfo(
- new (nothrow) AppXRTInfo::CurrentPackageInfo(cbBuffer, pbBuffer.Extract(), nCount));
- IfNullRet(pPkgInfo);
-
- if (InterlockedCompareExchangeT<AppXRTInfo::CurrentPackageInfo>(
- &g_pAppXRTInfo->m_pCurrentPackageInfo, pPkgInfo, nullptr) == nullptr)
- {
- pPkgInfo.SuppressRelease();
- }
-
- return S_OK;
- }
-
- //-----------------------------------------------------------------------------------------
- FORCEINLINE HRESULT CheckInitCurrentPackageInfoCache()
- {
- WRAPPER_NO_CONTRACT;
- PRECONDITION(IsAppXProcess());
-
- if (!IsAppXProcess())
- return E_UNEXPECTED;
-
- if (g_pAppXRTInfo->m_pCurrentPackageInfo == nullptr)
- return InitCurrentPackageInfoCache();
- else
- return S_OK;
- }
-
- //-----------------------------------------------------------------------------------------
- LPCWSTR GetHeadPackageMoniker()
- {
- STANDARD_VM_CONTRACT;
-
- IfFailThrow(CheckInitCurrentPackageInfoCache());
- return reinterpret_cast<PPACKAGE_INFO>(
- g_pAppXRTInfo->m_pCurrentPackageInfo->m_pbCurrentPackageInfo)->packageFullName;
- }
-
- //-----------------------------------------------------------------------------------------
- // Returns the current process' PACKAGE_ID in the provided buffer. See the ARI spec (above)
- // for more information.
- HRESULT GetCurrentPackageId(
- PUINT32 pBufferLength,
- PBYTE pBuffer)
- {
- LIMITED_METHOD_CONTRACT;
- HRESULT hr = S_OK;
-
- IfFailRet(CheckInitAppXRT());
- IfFailRet(HRESULT_FROM_WIN32((*g_pAppXRTInfo->m_pfnGetCurrentPackageId)(pBufferLength, pBuffer)));
-
- return S_OK;
- }
-
- //-----------------------------------------------------------------------------------------
- // Returns the current process' PACKAGE_INFO in the provided buffer. See the ARI spec
- // (above) for more information.
- HRESULT GetCurrentPackageInfo(
- UINT32 uiFlags,
- PUINT32 pcbBuffer,
- PBYTE pbBuffer,
- PUINT32 pnCount)
- {
- LIMITED_METHOD_CONTRACT;
- PRECONDITION(IsAppXProcess());
- PRECONDITION(CheckPointer(pcbBuffer));
-
- HRESULT hr = S_OK;
-
- IfFailRet(CheckInitAppXRT());
-
- if (pcbBuffer == nullptr)
- return E_INVALIDARG;
-
- if (uiFlags == PACKAGE_FILTER_CLR_DEFAULT)
- {
- IfFailRet(CheckInitCurrentPackageInfoCache());
-
- DWORD cbBuffer = *pcbBuffer;
- *pcbBuffer = g_pAppXRTInfo->m_pCurrentPackageInfo->m_cbCurrentPackageInfo;
- if (pnCount != nullptr)
- {
- *pnCount = g_pAppXRTInfo->m_pCurrentPackageInfo->m_nCount;
- }
-
- if (pbBuffer == nullptr || cbBuffer < g_pAppXRTInfo->m_pCurrentPackageInfo->m_cbCurrentPackageInfo)
- {
- return E_INSUFFICIENT_BUFFER;
- }
- memcpy(pbBuffer, g_pAppXRTInfo->m_pCurrentPackageInfo->m_pbCurrentPackageInfo, g_pAppXRTInfo->m_pCurrentPackageInfo->m_cbCurrentPackageInfo);
- }
- else
- {
- IfFailRet(HRESULT_FROM_WIN32((*g_pAppXRTInfo->m_pfnGetCurrentPackageInfo)(uiFlags, pcbBuffer, pbBuffer, pnCount)));
- }
-
- return S_OK;
- }
-
- //-----------------------------------------------------------------------------------------
- bool IsAdaptiveApp()
- {
- LIMITED_METHOD_CONTRACT;
-
- HRESULT hr = S_OK;
- static bool cachedIsAdaptiveApp = false;
-
- if (!IsAppXProcess())
- {
- return false;
- }
-
- if (!cachedIsAdaptiveApp)
- {
- cachedIsAdaptiveApp = true;
- LPWSTR adaptiveAppWinmetaDataDir = NULL;
-
- if (SUCCEEDED(hr = AppX::GetWinMetadataDirForAdaptiveApps(&adaptiveAppWinmetaDataDir)))
- {
- g_pAppXRTInfo->m_fIsAppXAdaptiveApp = clr::fs::Dir::Exists(adaptiveAppWinmetaDataDir);
-
- }
- else
- {
- SetLastError(hr);
- g_pAppXRTInfo->m_fIsAppXAdaptiveApp = false;
- }
-
- }
-
- return g_pAppXRTInfo->m_fIsAppXAdaptiveApp;
- }
-
-
- //-----------------------------------------------------------------------------------------
- // length : Upon success, contains the the length of packagePath
- // [in/out]
- //
- // packageRoot : Upon success, contains the full packagePath
- // [out] [ Note: The memory has to be preallocated for the above length]
- //
- HRESULT GetCurrentPackagePath(_Inout_ UINT32* length, _Out_opt_ PWSTR packageRoot)
- {
- PRECONDITION(IsAppXProcess());
- PRECONDITION(CheckPointer(length));
-
- HRESULT hr;
- IfFailRet(CheckInitAppXRT());
-
- IfFailRet(HRESULT_FROM_WIN32((*g_pAppXRTInfo->m_pfnGetCurrentPackagePath)(length, packageRoot)));
- return S_OK;
- }
-
- //-----------------------------------------------------------------------------------------
- // winMetadDataDir : Upon success, contains the absolute path for the winmetadata directory for the adaptive app
- // [out] NOTE: The string the pointer points to is global memory and never should be modified
- //
- HRESULT GetWinMetadataDirForAdaptiveApps(_Out_ LPWSTR* winMetadDataDir)
- {
-
- PRECONDITION(IsAppXProcess());
-
- HRESULT hr;
-
- IfFailRet(CheckInitAppXRT());
-
- if (g_pAppXRTInfo->m_AdaptiveAppWinmetadataDir == nullptr)
- {
- LPCWSTR wzWinMetadataFolder=W("\\WinMetadata");
- NewArrayHolder<WCHAR> wzCompletePath;
- UINT32 length=0;
-
- hr = GetCurrentPackagePath(&length, NULL);
- if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
- return hr;
-
- NewArrayHolder<WCHAR> wzPath_holder = new (nothrow) WCHAR[length];
-
- IfNullRet(wzPath_holder);
- IfFailRet(GetCurrentPackagePath(&length, wzPath_holder.GetValue()));
-
- DWORD cchFullPathBuf = length + (DWORD)wcslen(wzWinMetadataFolder) + 1;
- IfNullRet(wzCompletePath = new (nothrow) WCHAR[cchFullPathBuf]);
- IfFailRet(clr::fs::Path::Combine(wzPath_holder.GetValue(), wzWinMetadataFolder, &cchFullPathBuf, wzCompletePath.GetValue()));
- g_pAppXRTInfo->m_AdaptiveAppWinmetadataDir = wzCompletePath.Extract();
- }
-
- *winMetadDataDir = g_pAppXRTInfo->m_AdaptiveAppWinmetadataDir;
-
- return S_OK;
- }
-
-#if defined(FEATURE_APPX_BINDER)
- //-----------------------------------------------------------------------------------------
- // Iterates the current process' packages and returns the first package that contains a
- // file matching wzFileName.
- //
- // wzFileName : The file to look for in the current process' packages. If this is a
- // [in] relative path, then it appends the path to the root of each package in
- // sequence to see if the resulting path points to an existing file. If this
- // is an absolute path, then for each package it determines if the package
- // root is a prefix of wzFileName.
- // pcchPathName : Upon entry contains the length of the buffer pwzPathName, and upon return
- // [in/out] contains either the number of characters written or the buffer size
- // required.
- // pwzPathName : Upon success, contains the absolute path for the first matching file.
- // [out]
- HRESULT FindFileInCurrentPackage(
- PCWSTR wzFileName,
- PUINT32 pcchPathName,
- PWSTR pwzPathName,
- UINT32 uiFlags,
- __in PCWSTR *rgwzAltPaths,
- __in UINT32 cAltPaths,
- FindFindInPackageFlags findInCurrentPackageFlags)
- {
- LIMITED_METHOD_CONTRACT;
- PRECONDITION(IsAppXProcess());
- PRECONDITION(CheckPointer(wzFileName));
- PRECONDITION(CheckPointer(pcchPathName));
- PRECONDITION(CheckPointer(pwzPathName));
-
- HRESULT hr = S_OK;
-
- if (!IsAppXProcess())
- return E_UNEXPECTED;
-
- // PACKAGE_FILTER_ALL_LOADED is obsolete, and shouldn't be used.
- // We also don't currently handle the case where PACKAGE_FILTER_HEAD isn't set.
- _ASSERTE(uiFlags != PACKAGE_FILTER_ALL_LOADED && (uiFlags & PACKAGE_FILTER_HEAD) != 0);
- if (uiFlags == PACKAGE_FILTER_ALL_LOADED || (uiFlags & PACKAGE_FILTER_HEAD) == 0)
- return E_NOTIMPL;
-
- // File name must be non-null and relative
- if (IsNullOrEmpty(wzFileName) || pcchPathName == nullptr || pwzPathName == nullptr)
- return E_INVALIDARG;
-
- // If we've been provided a full path and the file doesn't actually exist
- // then we can immediately say that this function will fail with "file not found".
- bool fIsRelative = clr::fs::Path::IsRelative(wzFileName);
- if (!fIsRelative && !clr::fs::File::Exists(wzFileName))
- return E_FILE_NOT_FOUND;
-
- IfFailRet(CheckInitCurrentPackageInfoCache());
-
- DWORD const cchFileName = static_cast<DWORD>(wcslen(wzFileName));
- DWORD cchFullPathBuf = _MAX_PATH;
- NewArrayHolder<WCHAR> wzFullPathBuf = new (nothrow) WCHAR[cchFullPathBuf];
- IfNullRet(wzFullPathBuf);
-
- auto FindFileInCurrentPackageHelper = [&](LPCWSTR wzPath) -> HRESULT
- {
- HRESULT hr = S_OK;
-
- if (!(findInCurrentPackageFlags & FindFindInPackageFlags_AllowLongFormatPath) && clr::fs::Path::HasLongFormatPrefix(wzPath))
- return COR_E_BAD_PATHNAME; // We can't handle long format paths.
-
- // If the path is relative, concatenate the package root and the file name and see
- // if the file exists.
- if (fIsRelative)
- {
- DWORD cchFullPath = cchFullPathBuf;
- hr = clr::fs::Path::Combine(wzPath, wzFileName, &cchFullPath, wzFullPathBuf);
- if (hr == E_INSUFFICIENT_BUFFER)
- {
- IfNullRet(wzFullPathBuf = new (nothrow) WCHAR[cchFullPathBuf = (cchFullPath + 1)]);
- hr = clr::fs::Path::Combine(wzPath, wzFileName, &cchFullPath, wzFullPathBuf);
- }
- IfFailRet(hr);
-
- if (!clr::fs::Path::IsValid(wzFullPathBuf, cchFullPath, !!(findInCurrentPackageFlags & FindFindInPackageFlags_AllowLongFormatPath)))
- return COR_E_BAD_PATHNAME;
-
- if (clr::fs::File::Exists(wzFullPathBuf))
- {
- DWORD cchPathName = *pcchPathName;
- *pcchPathName = cchFullPath;
- return StringCchCopy(pwzPathName, cchPathName, wzFullPathBuf);
- }
- }
- // If the path is absolute, see if the file name contains the pacakge root as a prefix
- // and if the file exists.
- else
- {
- DWORD cchPath = static_cast<DWORD>(wcslen(wzPath));
-
- // Determine if wzPath is a path prefix of wzFileName
- if (cchPath < cchFileName &&
- _wcsnicmp(wzPath, wzFileName, cchPath) == 0 &&
- (wzFileName[cchPath] == W('\\') || wzPath[cchPath-1] == W('\\'))) // Ensure wzPath is not just a prefix, but a path prefix
- {
- if (clr::fs::File::Exists(wzFileName))
- {
- DWORD cchPathName = *pcchPathName;
- *pcchPathName = cchFileName;
- return StringCchCopy(pwzPathName, cchPathName, wzFileName);
- }
- }
- }
-
- return S_FALSE;
- }; // FindFileInCurrentPackageHelper
-
- if (!(findInCurrentPackageFlags & FindFindInPackageFlags_SkipCurrentPackageGraph))
- {
- PCPACKAGE_INFO pCurNode = reinterpret_cast<PPACKAGE_INFO>(
- g_pAppXRTInfo->m_pCurrentPackageInfo->m_pbCurrentPackageInfo);
- PCPACKAGE_INFO pEndNode = pCurNode + g_pAppXRTInfo->m_pCurrentPackageInfo->m_nCount;
- for (; pCurNode != pEndNode; ++pCurNode)
- {
- IfFailRet(FindFileInCurrentPackageHelper(pCurNode->path));
-
- if (hr == S_OK)
- {
- return hr;
- }
-
- // End search if dependent packages should not be checked.
- if ((uiFlags & PACKAGE_FILTER_DIRECT) == 0)
- {
- break;
- }
- }
- }
-
- // Process alternative paths
- for (UINT iAltPath = 0; iAltPath < cAltPaths; iAltPath++)
- {
- IfFailRet(FindFileInCurrentPackageHelper(rgwzAltPaths[iAltPath]));
-
- if (hr == S_OK)
- {
- return hr;
- }
- }
-
- return E_FILE_NOT_FOUND;
- }
-#endif // FEATURE_APPX_BINDER
-
- //-----------------------------------------------------------------------------------------
- HRESULT GetAppContainerTokenInfoForProcess(
- DWORD dwPid,
- NewArrayHolder<BYTE>& pbAppContainerTokenInfo,
- DWORD* pcbAppContainerTokenInfo)
- {
- LIMITED_METHOD_CONTRACT;
-
- HRESULT hr = S_OK;
-
- pbAppContainerTokenInfo = nullptr;
-
- if (!IsAppXSupported())
- {
- return S_FALSE;
- }
-
- if (dwPid == GetCurrentProcessId())
- {
- if (FAILED(hr = CheckInitAppXRT()))
- {
- SetLastError(hr);
- return S_FALSE;
- }
-
- if (g_pAppXRTInfo->m_pbAppContainerInfo == nullptr)
- {
- return S_FALSE;
- }
- else
- {
- pbAppContainerTokenInfo = g_pAppXRTInfo->m_pbAppContainerInfo.GetValue();
- pbAppContainerTokenInfo.SuppressRelease(); // Caller does not need to free mem.
- if (pcbAppContainerTokenInfo != nullptr)
- {
- *pcbAppContainerTokenInfo = g_pAppXRTInfo->m_cbAppContainerInfo;
- }
- return S_OK;
- }
- }
- else
- {
- return ::GetAppContainerTokenInfoForProcess(dwPid, pbAppContainerTokenInfo, pcbAppContainerTokenInfo);
- }
- }
-
- // Called during NGen to pretend that we're in a certain package. Due to Windows restriction, we can't
- // start NGen worker processes in the right package environment (only in the right AppContainer). So
- // NGen calls this function with a package name, to indicate that all AppX-related code should behave as
- // if the current process is running in that package.
- HRESULT SetCurrentPackageForNGen(__in PCWSTR pszPackageFullName)
- {
- LIMITED_METHOD_CONTRACT;
-
- HRESULT hr = S_OK;
-
- IfFailRet(CheckInitAppXRT());
-
- _ASSERTE(IsAppXSupported());
- _ASSERTE(g_pAppXRTInfo->m_hAppXRTMod != nullptr);
-
- HMODULE hAppXRTMod = g_pAppXRTInfo->m_hAppXRTMod;
- OpenPackageInfoByFullName_t *pfnOpenPackageInfoByFullName
- = reinterpret_cast<OpenPackageInfoByFullName_t*>(GetProcAddress(hAppXRTMod, "OpenPackageInfoByFullName"));
- _ASSERTE(pfnOpenPackageInfoByFullName != nullptr);
- if (pfnOpenPackageInfoByFullName == nullptr)
- return HRESULT_FROM_GetLastError();
-
- ClosePackageInfo_t *pfnClosePackageInfo
- = reinterpret_cast<ClosePackageInfo_t*>(GetProcAddress(hAppXRTMod, "ClosePackageInfo"));
- _ASSERTE(pfnClosePackageInfo != nullptr);
- if (pfnClosePackageInfo == nullptr)
- return HRESULT_FROM_GetLastError();
-
- GetPackageInfo_t *pfnGetPackageInfo
- = reinterpret_cast<GetPackageInfo_t*>(GetProcAddress(hAppXRTMod, "GetPackageInfo"));
- _ASSERTE(pfnGetPackageInfo != nullptr);
- if (pfnGetPackageInfo == nullptr)
- return HRESULT_FROM_GetLastError();
-
- PACKAGE_INFO_REFERENCE packageInfoReference;
- hr = HRESULT_FROM_WIN32(pfnOpenPackageInfoByFullName(pszPackageFullName, 0, &packageInfoReference));
- if (FAILED(hr))
- return hr;
-
- // Automatically close packageInfoReference before we return.
- class PackageInfoReferenceHolder
- {
- public:
- PackageInfoReferenceHolder(ClosePackageInfo_t *pfnClosePackageInfo, PACKAGE_INFO_REFERENCE &packageInfoReference)
- :m_pfnClosePackageInfo(pfnClosePackageInfo),
- m_packageInfoReference(packageInfoReference)
- {
- }
- ~PackageInfoReferenceHolder() { m_pfnClosePackageInfo(m_packageInfoReference); }
- private:
- ClosePackageInfo_t *m_pfnClosePackageInfo;
- PACKAGE_INFO_REFERENCE &m_packageInfoReference;
- } pirh(pfnClosePackageInfo, packageInfoReference);
-
- UINT32 cbBuffer = 0;
- hr = HRESULT_FROM_WIN32(pfnGetPackageInfo(packageInfoReference, PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, nullptr, nullptr));
- if (hr != E_INSUFFICIENT_BUFFER)
- return hr;
-
- NewArrayHolder<BYTE> pbBuffer(new (nothrow) BYTE[cbBuffer]);
- IfNullRet(pbBuffer);
-
- UINT32 nCount = 0;
- IfFailRet(HRESULT_FROM_WIN32(pfnGetPackageInfo(packageInfoReference, PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, pbBuffer, &nCount)));
-
- NewHolder<AppXRTInfo::CurrentPackageInfo> pPkgInfo(
- new (nothrow) AppXRTInfo::CurrentPackageInfo(cbBuffer, pbBuffer.Extract(), nCount));
- IfNullRet(pPkgInfo);
-
- if (InterlockedCompareExchangeT<AppXRTInfo::CurrentPackageInfo>(
- &g_pAppXRTInfo->m_pCurrentPackageInfo, pPkgInfo, nullptr) == nullptr)
- {
- pPkgInfo.SuppressRelease();
- }
-
- g_pAppXRTInfo->m_fIsAppXProcess = true;
- g_pAppXRTInfo->m_fIsAppXNGen = true;
-
- return hr;
- }
-
-#endif // DACCESS_COMPILE
-} // namespace AppX
-
-
-#endif // FEATURE_CORECLR
diff --git a/src/utilcode/ccomprc.cpp b/src/utilcode/ccomprc.cpp
index a4c79fc127..ed902dc6ca 100644
--- a/src/utilcode/ccomprc.cpp
+++ b/src/utilcode/ccomprc.cpp
@@ -261,12 +261,8 @@ HRESULT CCompRC::AddMapNode(LocaleID langId, HRESOURCEDLL hInst, BOOL fMissing)
//*****************************************************************************
// Initialize
//*****************************************************************************
-#ifndef FEATURE_CORECLR
-LPCWSTR CCompRC::m_pDefaultResource = W("mscorrc.dll");
-#else // !FEATURE_CORECLR
LPCWSTR CCompRC::m_pDefaultResource = W("mscorrc.debug.dll");
LPCWSTR CCompRC::m_pFallbackResource= W("mscorrc.dll");
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_PAL
LPCSTR CCompRC::m_pDefaultResourceDomain = "mscorrc.debug";
@@ -482,7 +478,6 @@ CCompRC* CCompRC::GetDefaultResourceDll()
return &m_DefaultResourceDll;
}
-#ifdef FEATURE_CORECLR
LONG CCompRC::m_dwFallbackInitialized = 0;
CCompRC CCompRC::m_FallbackResourceDll;
@@ -510,7 +505,6 @@ CCompRC* CCompRC::GetFallbackResourceDll()
return &m_FallbackResourceDll;
}
-#endif // FEATURE_CORECLR
//*****************************************************************************
@@ -747,7 +741,6 @@ HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iR
// Failed to load string
if ( hr != E_OUTOFMEMORY && ShouldUseFallback())
{
-#ifdef FEATURE_CORECLR
CCompRC* pFallback=CCompRC::GetFallbackResourceDll();
if (pFallback)
{
@@ -761,13 +754,11 @@ HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iR
if(SUCCEEDED(hr))
return hr;
}
-#endif
switch (eCategory)
{
case Optional:
hr = E_FAIL;
break;
-#ifdef FEATURE_CORECLR
case DesktopCLR:
hr = E_FAIL;
break;
@@ -837,12 +828,6 @@ HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iR
// if we got here then we couldn't get the fallback message
// the fallback message is required so just falling through into "Required"
-#else // FEATURE_CORECLR
- // everything that's not optional goes here for Desktop
- case DesktopCLR:
- case Debugging:
- case Error:
-#endif
case Required:
if ( hr != E_OUTOFMEMORY)
@@ -1035,7 +1020,6 @@ HRESULT CCompRC::LoadLibraryThrows(HRESOURCEDLL * pHInst)
PathString rcPath; // Path to resource DLL.
// Try first in the same directory as this dll.
-#if defined(FEATURE_CORECLR)
VALIDATECORECLRCALLBACKS();
@@ -1046,73 +1030,6 @@ HRESULT CCompRC::LoadLibraryThrows(HRESOURCEDLL * pHInst)
hr = LoadLibraryHelper(pHInst, rcPath);
-#else // FEATURE_CORECLR
-
- if (!WszGetModuleFileName(GetModuleInst(), rcPath))
- return HRESULT_FROM_GetLastError();
-
- CopySystemDirectory(rcPath, rcPath);
-
- hr = LoadLibraryHelper(pHInst, rcPath);
- if (hr == E_OUTOFMEMORY)
- return hr;
-
- // In case of default rc file, also try CORSystemDirectory.
- // Note that GetRequestedRuntimeInfo is a function in ths shim. As of 12/06, this is the only
- // place where utilcode appears to take a dependency on the shim. This forces everyone that links
- // with us to also dynamically link to mscoree.dll. Perhaps this should be a delay-load to prevent
- // that static dependency and have a gracefull fallback when the shim isn't installed.
- // We don't do this in DAC builds because mscordacwks.dll cannot take a dependency on other CLR
- // dlls (eg. you must be able to examine a managed dump on a machine without any CLR installed).
-#ifndef DACCESS_COMPILE
- if (FAILED(hr) && m_pResourceFile == m_pDefaultResource)
- {
-#ifdef SELF_NO_HOST
- WCHAR rcVersion[MAX_VERSION_STRING];
- DWORD rcVersionSize;
-
- DWORD corSystemPathSize;
-
- // The reason for using GetRequestedRuntimeInfo is the ability to suppress message boxes
- // with RUNTIME_INFO_DONT_SHOW_ERROR_DIALOG.
- COUNT_T size = MAX_PATH;
- hr = LegacyActivationShim::GetRequestedRuntimeInfo(
- NULL,
- W("v")VER_PRODUCTVERSION_NO_QFE_STR_L,
- NULL,
- 0,
- RUNTIME_INFO_UPGRADE_VERSION|RUNTIME_INFO_DONT_SHOW_ERROR_DIALOG|RUNTIME_INFO_CONSIDER_POST_2_0,
- rcPath.OpenUnicodeBuffer(size-1),
- size,
- &corSystemPathSize,
- rcVersion,
- NumItems(rcVersion),
- &rcVersionSize);
-
- rcPath.CloseBuffer(corSystemPathSize);
-
- if (SUCCEEDED(hr))
- {
- if (rcVersionSize > 0)
- {
- rcPath.Append(rcVersion);
- rcPath.Append(W("\\"));
- }
- }
-#else
- // If we're hosted, we have the advantage of a CoreClrCallbacks reference.
- // More importantly, we avoid calling back to mscoree.dll.
-
- hr = GetClrCallbacks().m_pfnGetCORSystemDirectory(rcPath);
-#endif
- if (SUCCEEDED(hr))
- {
- hr = LoadLibraryHelper(pHInst, rcPath);
- }
- }
-#endif // !DACCESS_COMPILE
-
-#endif // FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
diff --git a/src/utilcode/clrhost.cpp b/src/utilcode/clrhost.cpp
index 8a61eee966..5b28018514 100644
--- a/src/utilcode/clrhost.cpp
+++ b/src/utilcode/clrhost.cpp
@@ -16,9 +16,7 @@
#include "contract.h"
#include "tls.h"
-#if defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE) || defined(CROSSGEN_COMPILE)
CoreClrCallbacks g_CoreClrCallbacks;
-#endif
// In some cirumstance (e.g, the thread suspecd another thread), allocation on heap
@@ -206,7 +204,6 @@ int RFS_HashStack ()
#endif // FAILPOINTS_ENABLED
-#if defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
//-----------------------------------------------------------------------------------
// This is the approved way to get a module handle to mscorwks.dll (or coreclr.dll).
@@ -264,7 +261,6 @@ HMODULE GetCLRModule ()
return g_CoreClrCallbacks.m_hmodCoreCLR;
}
-#endif // defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
#if defined(SELF_NO_HOST)
@@ -402,7 +398,6 @@ LoadsTypeHolder::~LoadsTypeHolder()
// versions in the same process.
//--------------------------------------------------------------------------
-#if defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
//--------------------------------------------------------------------------
// One-time initialized called by coreclr.dll in its dllmain.
@@ -456,4 +451,3 @@ void OnUninitializedCoreClrCallbacks()
}
#endif // _DEBUG
-#endif // defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
diff --git a/src/utilcode/dlwrap.cpp b/src/utilcode/dlwrap.cpp
index 0c9026a421..a6771c9daa 100644
--- a/src/utilcode/dlwrap.cpp
+++ b/src/utilcode/dlwrap.cpp
@@ -77,155 +77,3 @@ VerQueryValueW_NoThrow(
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-// The following functions are not used in CoreCLR. Normally LINKER can remove these functions
-// from generated files. But LINKER does it in two steps:
-// 1. If no function in a source file is used, the file is ignored by LINKER
-// 2. If one function is used, LINKER will first make sure all imported functions in the file
-// is available, and then it will remove unused functions.
-// Instead of specifying all libs for imported functions needed by the following codes, we just
-// remove them from compiling phase.
-__success(return)
-BOOL
-CreateUrlCacheEntryW_NoThrow(
- IN LPCWSTR lpszUrlName,
- IN DWORD dwExpectedFileSize,
- IN LPCWSTR lpszFileExtension,
- __out_ecount(MAX_LONGPATH+1) LPWSTR lpszFileName,
- IN DWORD dwReserved
- )
-{
- WRAPPER_NO_CONTRACT;
- HRESULT hr=S_OK;
- BOOL bRet=FALSE;
- EX_TRY
- {
- bRet=CreateUrlCacheEntryW(lpszUrlName,dwExpectedFileSize,lpszFileExtension,
- lpszFileName,dwReserved);
- }
- EX_CATCH_HRESULT(hr);
- if (hr!=S_OK)
- SetLastError(hr);
- return bRet;
-
-}
-
-BOOL
-CommitUrlCacheEntryW_NoThrow(
- IN LPCWSTR lpszUrlName,
- IN LPCWSTR lpszLocalFileName,
- IN FILETIME ExpireTime,
- IN FILETIME LastModifiedTime,
- IN DWORD CacheEntryType,
- IN LPCWSTR lpHeaderInfo,
- IN DWORD dwHeaderSize,
- IN LPCWSTR lpszFileExtension,
- IN LPCWSTR lpszOriginalUrl
- )
-{
- WRAPPER_NO_CONTRACT;
- HRESULT hr=S_OK;
- BOOL bRet=FALSE;
- EX_TRY
- {
- bRet=CommitUrlCacheEntryW(lpszUrlName,lpszLocalFileName,ExpireTime,
- LastModifiedTime,CacheEntryType,(LPWSTR)lpHeaderInfo,
- dwHeaderSize,lpszFileExtension,lpszOriginalUrl);
- }
- EX_CATCH_HRESULT(hr);
- if (hr!=S_OK)
- SetLastError(hr);
- return bRet;
-
-}
-
-BOOL
-InternetTimeToSystemTimeA_NoThrow(
- IN LPCSTR lpszTime, // NULL terminated string
- OUT SYSTEMTIME *pst, // output in GMT time
- IN DWORD dwReserved
- )
-{
- WRAPPER_NO_CONTRACT;
- HRESULT hr=S_OK;
- BOOL bRet=FALSE;
- EX_TRY
- {
- bRet=InternetTimeToSystemTimeA(lpszTime,pst,dwReserved);
- }
- EX_CATCH_HRESULT(hr);
- if (hr!=S_OK)
- SetLastError(hr);
- return bRet;
-
-}
-
-HRESULT
-CoInternetCreateSecurityManager_NoThrow(
- IServiceProvider *pSP,
- IInternetSecurityManager **ppSM,
- DWORD dwReserved
- )
-{
- WRAPPER_NO_CONTRACT;
- HRESULT hr=S_OK;
- EX_TRY
- {
- hr=CoInternetCreateSecurityManager(pSP,ppSM, dwReserved);
- }
- EX_CATCH_HRESULT(hr);
- return hr;
-}
-
-HRESULT
-URLDownloadToCacheFileW_NoThrow(
- LPUNKNOWN lpUnkcaller,
- LPCWSTR szURL,
- __out_ecount(dwBufLength) LPWSTR szFileName,
- DWORD dwBufLength,
- DWORD dwReserved,
- IBindStatusCallback *pBSC
- )
-{
- WRAPPER_NO_CONTRACT;
- HRESULT hr=S_OK;
- EX_TRY
- {
- hr=URLDownloadToCacheFileW(lpUnkcaller,szURL,szFileName,dwBufLength,dwReserved,pBSC);
- }
- EX_CATCH_HRESULT(hr);
- return hr;
-}
-
-HRESULT
-CoInternetGetSession_NoThrow(
- WORD dwSessionMode,
- IInternetSession **ppIInternetSession,
- DWORD dwReserved
- )
-{
- WRAPPER_NO_CONTRACT;
- HRESULT hr=S_OK;
- EX_TRY
- {
- hr=CoInternetGetSession(dwSessionMode,ppIInternetSession,dwReserved);
- }
- EX_CATCH_HRESULT(hr);
- return hr;
-}
-
-HRESULT
-CopyBindInfo_NoThrow(
- const BINDINFO * pcbiSrc, BINDINFO * pbiDest
- )
-{
- WRAPPER_NO_CONTRACT;
- HRESULT hr=S_OK;
- EX_TRY
- {
- hr=CopyBindInfo(pcbiSrc,pbiDest );
- }
- EX_CATCH_HRESULT(hr);
- return hr;
-}
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp
index bb164571ad..5d060660e3 100644
--- a/src/utilcode/ex.cpp
+++ b/src/utilcode/ex.cpp
@@ -2037,7 +2037,7 @@ static DWORD MarkAsThrownByUsWorker(UINT numArgs, /*out*/ ULONG_PTR exceptionArg
exceptionArgs[0] = arg0;
-#if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && (defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE))
+#if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES)
exceptionArgs[INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE - 1] = (ULONG_PTR) (GetCLRModule());
#endif // !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
@@ -2086,7 +2086,7 @@ BOOL WasThrownByUs(const EXCEPTION_RECORD *pcER, DWORD dwExceptionCode)
{
return FALSE;
}
-#if!defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && (defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE))
+#if!defined(FEATURE_UTILCODE_NO_DEPENDENCIES)
if ( ((ULONG_PTR)(GetCLRModule())) != pcER->ExceptionInformation[INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE - 1] )
{
return FALSE;
diff --git a/src/utilcode/longfilepathwrappers.cpp b/src/utilcode/longfilepathwrappers.cpp
index 5272d35807..2e493d02b5 100644
--- a/src/utilcode/longfilepathwrappers.cpp
+++ b/src/utilcode/longfilepathwrappers.cpp
@@ -1187,7 +1187,6 @@ FindFirstFileExWrapper(
}
#endif //!FEATURE_PAL
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
#ifndef FEATURE_PAL
@@ -1247,7 +1246,6 @@ BOOL PAL_GetPALDirectoryWrapper(SString& pbuffer)
#endif // FEATURE_PAL
-#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
//Implementation of LongFile Helpers
const WCHAR LongFile::DirectorySeparatorChar = W('\\');
diff --git a/src/utilcode/makepath.cpp b/src/utilcode/makepath.cpp
index 701c525cf4..6e0b56281c 100644
--- a/src/utilcode/makepath.cpp
+++ b/src/utilcode/makepath.cpp
@@ -15,158 +15,6 @@
#include "utilcode.h"
#include "ex.h"
-#ifndef FEATURE_CORECLR
-/***
-*void MakePath() - build path name from components
-*
-*Purpose:
-* create a path name from its individual components
-*
-*Entry:
-* WCHAR *path - pointer to buffer for constructed path
-* WCHAR *drive - pointer to drive component, may or may not contain
-* trailing ':'
-* WCHAR *dir - pointer to subdirectory component, may or may not include
-* leading and/or trailing '/' or '\' characters
-* WCHAR *fname - pointer to file base name component
-* WCHAR *ext - pointer to extension component, may or may not contain
-* a leading '.'.
-*
-*Exit:
-* path - pointer to constructed path name
-*
-*Exceptions:
-*
-*******************************************************************************/
-
-void MakePath (
- __out_ecount (MAX_LONGPATH) WCHAR *path,
- __in LPCWSTR drive,
- __in LPCWSTR dir,
- __in LPCWSTR fname,
- __in LPCWSTR ext
- )
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- FORBID_FAULT;
- }
- CONTRACTL_END
-
- const WCHAR *p;
- DWORD count = 0;
-
- /* we assume that the arguments are in the following form (although we
- * do not diagnose invalid arguments or illegal filenames (such as
- * names longer than 8.3 or with illegal characters in them)
- *
- * drive:
- * A ; or
- * A:
- * dir:
- * \top\next\last\ ; or
- * /top/next/last/ ; or
- * either of the above forms with either/both the leading
- * and trailing / or \ removed. Mixed use of '/' and '\' is
- * also tolerated
- * fname:
- * any valid file name
- * ext:
- * any valid extension (none if empty or null )
- */
-
- /* copy drive */
-
- if (drive && *drive) {
- *path++ = *drive;
- *path++ = _T(':');
- count += 2;
- }
-
- /* copy dir */
-
- if ((p = dir)) {
- while (*p) {
- *path++ = *p++;
- count++;
-
- if (count == MAX_LONGPATH) {
- --path;
- *path = _T('\0');
- return;
- }
- }
-
-#ifdef _MBCS
- if (*(p=_mbsdec(dir,p)) != _T('/') && *p != _T('\\')) {
-#else /* _MBCS */
- // suppress warning for the following line; this is safe but would require significant code
- // delta for prefast to understand.
-#ifdef _PREFAST_
- #pragma warning( suppress: 26001 )
-#endif
- if (*(p-1) != _T('/') && *(p-1) != _T('\\')) {
-#endif /* _MBCS */
- *path++ = _T('\\');
- count++;
-
- if (count == MAX_LONGPATH) {
- --path;
- *path = _T('\0');
- return;
- }
- }
- }
-
- /* copy fname */
-
- if ((p = fname)) {
- while (*p) {
- *path++ = *p++;
- count++;
-
- if (count == MAX_LONGPATH) {
- --path;
- *path = _T('\0');
- return;
- }
- }
- }
-
- /* copy ext, including 0-terminator - check to see if a '.' needs
- * to be inserted.
- */
-
- if ((p = ext)) {
- if (*p && *p != _T('.')) {
- *path++ = _T('.');
- count++;
-
- if (count == MAX_LONGPATH) {
- --path;
- *path = _T('\0');
- return;
- }
- }
-
- while ((*path++ = *p++)) {
- count++;
-
- if (count == MAX_LONGPATH) {
- --path;
- *path = _T('\0');
- return;
- }
- }
- }
- else {
- /* better add the 0-terminator */
- *path = _T('\0');
- }
-}
-#endif // !FEATURE_CORECLR
/***
*void Makepath() - build path name from components
@@ -307,57 +155,6 @@ void MakePath (
szPath.Shrink(count + 1);
}
-#if !defined(FEATURE_CORECLR)
-static LPCWSTR g_wszProcessExePath = NULL;
-
-HRESULT GetProcessExePath(LPCWSTR *pwszProcessExePath)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- CONSISTENCY_CHECK(CheckPointer(pwszProcessExePath));
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- if (g_wszProcessExePath == NULL)
- {
- DWORD cchProcName = 0;
- NewArrayHolder<WCHAR> wszProcName;
- EX_TRY
- {
- PathString wszProcNameString;
- cchProcName = WszGetModuleFileName(NULL, wszProcNameString);
- if (cchProcName == 0)
- {
- hr = HRESULT_FROM_GetLastError();
- }
- else
- {
- wszProcName = wszProcNameString.GetCopyOfUnicodeString();
- }
- }
- EX_CATCH_HRESULT(hr);
-
- if (FAILED(hr))
- {
- return hr;
- }
-
- if (InterlockedCompareExchangeT(&g_wszProcessExePath, const_cast<LPCWSTR>(wszProcName.GetValue()), NULL) == NULL)
- {
- wszProcName.SuppressRelease();
- }
- }
- _ASSERTE(g_wszProcessExePath != NULL);
- _ASSERTE(SUCCEEDED(hr));
-
- *pwszProcessExePath = g_wszProcessExePath;
- return hr;
-}
-#endif
// Returns the directory for HMODULE. So, if HMODULE was for "C:\Dir1\Dir2\Filename.DLL",
// then this would return "C:\Dir1\Dir2\" (note the trailing backslash).
diff --git a/src/utilcode/newapis.cpp b/src/utilcode/newapis.cpp
index 3717f0280d..c05d024b7e 100644
--- a/src/utilcode/newapis.cpp
+++ b/src/utilcode/newapis.cpp
@@ -32,27 +32,6 @@ namespace NewApis
FARPROC result = NULL;
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-
- // First try to use the function defined in the culture dll
- // if we are running on a platform prior to Win7
- if(!IsWindows7Platform())
- {
- // only need to load the culture dll's handle once then we can hold onto it
- static HMODULE hCulture = NULL;
- // if we haven't loaded the culture dll yet
- if (hCulture == NULL)
- {
- UtilCode::LoadLibraryShim(MAKEDLLNAME_W(W("culture")), NULL, 0, &hCulture);
- }
-
- // make sure we were successful before using the handle
- if (hCulture != NULL)
- {
- result=GetProcAddress(hCulture,lpProcName);
- }
- }
-#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
// next try the kernel
if(result==NULL)
@@ -1094,9 +1073,7 @@ inline BOOL IsInvariantCasing(__in LPCWSTR lpLocaleName, __in DWORD dwMapFlags)
retVal = ::LCIDToLocaleName(Locale, lpName, cchName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
#else
-#ifdef FEATURE_CORECLR
retVal = DownLevel::LCIDToLocaleName(Locale, lpName,cchName,dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
-#endif // FEATURE_CORECLR
typedef int (WINAPI *PFNLCIDToLocaleName)(LCID, LPWSTR,int ,DWORD);
static PFNLCIDToLocaleName pFNLCIDToLocaleName=NULL;
@@ -1138,9 +1115,7 @@ inline BOOL IsInvariantCasing(__in LPCWSTR lpLocaleName, __in DWORD dwMapFlags)
#if !defined(ENABLE_DOWNLEVEL_FOR_NLS)
return ::LocaleNameToLCID(lpName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
#else
-#ifdef FEATURE_CORECLR
retVal = DownLevel::LocaleNameToLCID(lpName, dwFlags | LOCALE_ALLOW_NEUTRAL_NAMES);
-#endif // FEATURE_CORECLR
typedef int (WINAPI *PFNLocaleNameToLCID)(LPCWSTR,DWORD);
static PFNLocaleNameToLCID pFNLocaleNameToLCID=NULL;
@@ -1278,26 +1253,6 @@ inline BOOL IsInvariantCasing(__in LPCWSTR lpLocaleName, __in DWORD dwMapFlags)
}
-#if !defined(FEATURE_CORECLR)
- BOOL GetNlsVersionEx(__in NLS_FUNCTION Function, __in LPCWSTR lpLocaleName, __inout LPNLSVERSIONINFOEX lpVersionInfo)
- {
-
- typedef BOOL (WINAPI *PFNGetNLSVersionEx)(NLS_FUNCTION, LPCWSTR, LPNLSVERSIONINFOEX);
-
- static PFNGetNLSVersionEx pFNGetNLSVersionEx=NULL;
-
- // See if we still need to find our function
- if (pFNGetNLSVersionEx == NULL)
- {
- // We only call this on Win8 and above, so this should always work.
- pFNGetNLSVersionEx = (PFNGetNLSVersionEx) GetSystemProcAddressForSortingApi("GetNLSVersionEx", NULL);
- }
-
- _ASSERTE(pFNGetNLSVersionEx != NULL);
-
- return pFNGetNLSVersionEx(Function, lpLocaleName, lpVersionInfo);
- }
-#endif
// This is a Windows 7 and above function
// This returns the "specific" locale from an input name, ie: "en" returns "en-US",
diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp
index c437c21c35..0ab1cf3563 100644
--- a/src/utilcode/pedecoder.cpp
+++ b/src/utilcode/pedecoder.cpp
@@ -1173,12 +1173,6 @@ CHECK PEDecoder::CheckCorHeader() const
CHECK_OK;
}
-#if !defined(FEATURE_CORECLR)
-#define WHIDBEY_SP2_VERSION_MAJOR 2
-#define WHIDBEY_SP2_VERSION_MINOR 0
-#define WHIDBEY_SP2_VERSION_BUILD 50727
-#define WHIDBEY_SP2_VERSION_PRIVATE_BUILD 3053
-#endif // !defined(FEATURE_CORECLR)
// This function exists to provide compatibility between two different native image
@@ -1236,71 +1230,10 @@ IMAGE_DATA_DIRECTORY *PEDecoder::GetMetaDataHelper(METADATA_SECTION_TYPE type) c
// COR_HEADER and so the value of pDirRet is correct
if (HasNativeHeader())
{
-#ifdef FEATURE_CORECLR
if (type == METADATA_SECTION_MANIFEST)
pDirRet = &GetNativeHeader()->ManifestMetaData;
-#else // FEATURE_CORECLR
-
- IMAGE_DATA_DIRECTORY *pDirNativeHeader = &GetNativeHeader()->ManifestMetaData;
-
- // This code leverages the fact that pre-Whidbey SP2 private build numbers can never
- // be greater than Whidbey SP2 private build number, because otherwise major setup
- // issues would arise. To prevent this, it is standard to bump the private build
- // number up a significant amount for SPs, as was the case between Whidbey SP1 and
- // Whidbey SP2.
- //
- // Since we could be reading an older version of native image, we tell
- // GetNativeVersionInfoMaybeNull to skip checking the native header.
- CORCOMPILE_VERSION_INFO *pVerInfo = GetNativeVersionInfoMaybeNull(true);
- bool fIsPreWhidbeySP2 = false;
-
- // If pVerInfo is NULL, we assume that we're in an NGEN compilation domain and that
- // the information has not yet been written. Since an NGEN compilation domain running
- // in the v4.0 runtime can only complie v4.0 native images, we'll assume the default
- // fIsPreWhidbeySP2 value (false) is correct.
- if (pVerInfo != NULL && pVerInfo->wVersionMajor <= WHIDBEY_SP2_VERSION_MAJOR)
- {
- if (pVerInfo->wVersionMajor < WHIDBEY_SP2_VERSION_MAJOR)
- fIsPreWhidbeySP2 = true;
- else if (pVerInfo->wVersionMajor == WHIDBEY_SP2_VERSION_MAJOR)
- {
- // If the sp2 minor version isn't 0, we need this logic:
- // if (pVerInfo->wVersionMinor < WHIDBEY_SP2_VERSION_MINOR)
- // fIsPreWhidbeySP2 = true;
- // else
- // However, if it is zero, with that logic we get a warning about the comparison
- // of an unsigned variable to zero always being false.
- _ASSERTE(WHIDBEY_SP2_VERSION_MINOR == 0);
-
- if (pVerInfo->wVersionMinor == WHIDBEY_SP2_VERSION_MINOR)
- {
- if (pVerInfo->wVersionBuildNumber < WHIDBEY_SP2_VERSION_BUILD)
- fIsPreWhidbeySP2 = true;
- else if (pVerInfo->wVersionBuildNumber == WHIDBEY_SP2_VERSION_BUILD)
- {
- if (pVerInfo->wVersionPrivateBuildNumber < WHIDBEY_SP2_VERSION_PRIVATE_BUILD)
- fIsPreWhidbeySP2 = true;
- }
- }
- }
- }
-
- // In pre-Whidbey SP2, pDirRet points to manifest and pDirNativeHeader points to full.
- if (fIsPreWhidbeySP2)
- {
- if (type == METADATA_SECTION_FULL)
- pDirRet = pDirNativeHeader;
- }
- // In Whidbey SP2 and later, pDirRet points to full and pDirNativeHeader points to manifest.
- else
- {
- if (type == METADATA_SECTION_MANIFEST)
- pDirRet = pDirNativeHeader;
- }
-
-#endif // FEATURE_CORECLR
}
diff --git a/src/utilcode/registrywrapper.cpp b/src/utilcode/registrywrapper.cpp
index f6b88db977..b3c4b42946 100644
--- a/src/utilcode/registrywrapper.cpp
+++ b/src/utilcode/registrywrapper.cpp
@@ -74,288 +74,3 @@
#include "clrconfig.h"
#include "strsafe.h"
-#if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && !defined(FEATURE_CORECLR)
-
-static LPCWSTR kRegistryRootKey = W("SOFTWARE\\");
-static const HKEY kRegistryRootHive = HKEY_LOCAL_MACHINE;
-static LPCWSTR kWow6432Node = W("Wow6432Node\\");
-static LPCWSTR kMicrosoftDotNetFrameworkPolicy = W("Microsoft\\.NETFramework\\Policy");
-static LPCWSTR wszHKLM = W("HKLM\\");
-static WCHAR * g_registryRoot = NULL;
-static volatile bool g_initialized = false;
-static const WCHAR BACKSLASH_CHARACTER[] = W("\\");
-
-//
-// Called the first time we use ClrRegCreateKeyEx or ClrRegOpenKeyEx to determine if the registry redirection
-// config value has been set. If so, we parse it into g_registryRoot
-// If the config string is mal-formed, we don't set the global variable.
-//
-HRESULT ParseRegistryRootConfigValue()
-{
- if (!IsNgenOffline())
- {
- return ERROR_SUCCESS;
- }
-
- CLRConfigStringHolder configValue(CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_RegistryRoot));
- // Since IsNgenOffline returned true, this better not be NULL
- if (configValue == NULL)
- return ERROR_BAD_ARGUMENTS;
-
- if (_wcsnicmp(configValue, wszHKLM, wcslen(wszHKLM)) != 0)
- {
- return ERROR_BAD_ARGUMENTS;
- }
-
- // The rest of the string is the location of the redirected registry key
- LPWSTR configValueKey = (LPWSTR)configValue;
- configValueKey = _wcsninc(configValueKey, wcslen(wszHKLM));
-
- size_t len = wcslen(configValueKey) + 1;
-
- bool appendBackslash = false;
- if (configValueKey[wcslen(configValueKey) - 1] != W('\\'))
- {
- appendBackslash = true;
- len += wcslen(BACKSLASH_CHARACTER);
- }
- g_registryRoot = new (nothrow) WCHAR[len];
-
- if (g_registryRoot == NULL)
- {
- return ERROR_NOT_ENOUGH_MEMORY;
- }
-
- wcscpy_s(g_registryRoot, len, configValueKey);
- if (appendBackslash)
- {
- StringCchCat(g_registryRoot, len, BACKSLASH_CHARACTER);
- }
-
- return ERROR_SUCCESS;
-}
-
-//
-// This is our check that the target machine is 32/64bit
-// If 32bit only, there will be no Wow6432Node key
-// If 64bit, there will be a Wow6432Node key
-//
-HRESULT CheckWow6432NodeNetFxExists(bool * fResult)
-{
- static bool bInitialized = false;
- static bool bNodeExists = false;
- HRESULT hr = ERROR_SUCCESS;
-
- if (!bInitialized)
- {
- size_t redirectedLength = wcslen(g_registryRoot) + wcslen(kWow6432Node) + wcslen(kMicrosoftDotNetFrameworkPolicy) + 1;
- LPWSTR lpRedirectedKey = new (nothrow) WCHAR[redirectedLength];
-
- if (lpRedirectedKey == NULL)
- {
- return ERROR_NOT_ENOUGH_MEMORY;
- }
-
- wcscpy_s(lpRedirectedKey, redirectedLength, g_registryRoot);
- StringCchCat(lpRedirectedKey, redirectedLength, kWow6432Node);
- StringCchCat(lpRedirectedKey, redirectedLength, kMicrosoftDotNetFrameworkPolicy);
-
- HKEY hkey;
- hr = RegOpenKeyExW(HKEY_LOCAL_MACHINE, lpRedirectedKey, 0, KEY_READ, &hkey);
- bNodeExists = hr == ERROR_SUCCESS;
-
- if (hr == ERROR_FILE_NOT_FOUND)
- {
- hr = ERROR_SUCCESS;
- }
-
- if (hkey)
- {
- RegCloseKey(hkey);
- }
- bInitialized = true;
- }
- *fResult = bNodeExists;
- return hr;
-}
-
-HRESULT CheckUseWow6432Node(REGSAM samDesired, bool * fResult)
-{
- HRESULT hr = ERROR_SUCCESS;
- bool fWow6432NodeExists = false;
-
- hr = CheckWow6432NodeNetFxExists(&fWow6432NodeExists);
- if (hr == ERROR_SUCCESS)
- {
- if (!fWow6432NodeExists)
- {
- *fResult = false;
- } else
- {
-#if defined(_WIN64)
- *fResult = false;
-#else
- *fResult = true;
-#endif
- // If KEY_WOW64_64KEY or KEY_WOW64_32KEY are set, override
- // If both are set, the actual registry call will fail with ERROR_INVALID_PARAMETER
- // so no worries here
- if (samDesired & KEY_WOW64_64KEY)
- {
- *fResult = false;
- } else if (samDesired & KEY_WOW64_32KEY)
- {
- *fResult = true;
- }
- }
- }
- return hr;
-}
-
-//
-// lpRedirectedKey is allocated and returned from this method. Caller owns the new string and
-// should release
-//
-__success(return == ERROR_SUCCESS)
-HRESULT RedirectKey(REGSAM samDesired, HKEY hKey, LPCWSTR lpKey, __deref_out_z LPWSTR * lpRedirectedKey)
-{
- if (hKey != kRegistryRootHive || _wcsnicmp(lpKey, kRegistryRootKey, wcslen(kRegistryRootKey)) != 0)
- {
- *lpRedirectedKey = NULL;
- return ERROR_SUCCESS;
- }
-
- LPCWSTR lpRootStrippedKey = lpKey + wcslen(kRegistryRootKey);
- size_t redirectedLength = wcslen(g_registryRoot) + wcslen(lpRootStrippedKey) + 1;
-
- bool bUseWow = false;
- HRESULT hr = CheckUseWow6432Node(samDesired, &bUseWow);
-
- if (hr != ERROR_SUCCESS)
- {
- return hr;
- }
-
- if (bUseWow)
- {
- redirectedLength += wcslen(kWow6432Node);
- }
-
- *lpRedirectedKey = new (nothrow) WCHAR[redirectedLength];
-
- if (*lpRedirectedKey == NULL)
- {
- return ERROR_NOT_ENOUGH_MEMORY;
- }
-
- wcscpy_s(*lpRedirectedKey, redirectedLength, g_registryRoot);
- if (bUseWow)
- {
- StringCchCat(*lpRedirectedKey, redirectedLength, kWow6432Node);
- }
-
- StringCchCat(*lpRedirectedKey, redirectedLength, lpRootStrippedKey);
-
- return ERROR_SUCCESS;
-}
-
-LONG ClrRegCreateKeyEx(
- HKEY hKey,
- LPCWSTR lpSubKey,
- DWORD Reserved,
- __in_opt LPWSTR lpClass,
- DWORD dwOptions,
- REGSAM samDesired,
- LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- PHKEY phkResult,
- LPDWORD lpdwDisposition
- )
-{
- HRESULT hr;
- if (!g_initialized)
- {
- hr = ParseRegistryRootConfigValue();
- if (hr != ERROR_SUCCESS)
- return hr;
- g_initialized = true;
- }
-
- if (g_registryRoot != NULL)
- {
- NewArrayHolder<WCHAR> lpRedirectedKey(NULL);
- hr = RedirectKey(samDesired, hKey, lpSubKey, &lpRedirectedKey);
- // We don't want to touch the registry if we're low on memory and can't redirect properly. It could lead
- // to use reading and writing to two separate registries and corrupting both in the process
- if (hr != ERROR_SUCCESS)
- return hr;
- LPCWSTR lpKeyToUse = lpRedirectedKey == NULL ? lpSubKey : lpRedirectedKey;
- return RegCreateKeyExW(hKey, lpKeyToUse, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);
- }
- return RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);
-} // ClrRegCreateKeyEx
-
-LONG ClrRegOpenKeyEx(
- HKEY hKey,
- LPCWSTR lpSubKey,
- DWORD ulOptions,
- REGSAM samDesired,
- PHKEY phkResult
- )
-{
- HRESULT hr;
- if (!g_initialized)
- {
- hr = ParseRegistryRootConfigValue();
- if (hr != ERROR_SUCCESS)
- return hr;
- g_initialized = true;
- }
-
- if (g_registryRoot != NULL)
- {
- NewArrayHolder<WCHAR> lpRedirectedKey(NULL);
- hr = RedirectKey(samDesired, hKey, lpSubKey, &lpRedirectedKey);
- // We don't want to touch the registry if we're low on memory and can't redirect properly. It could lead
- // to use reading and writing to two separate registries and corrupting both in the process
- if (hr != ERROR_SUCCESS)
- return hr;
- LPCWSTR lpKeyToUse = lpRedirectedKey == NULL ? lpSubKey : lpRedirectedKey;
- return RegOpenKeyExW(hKey, lpKeyToUse, ulOptions, samDesired, phkResult);
- }
- return RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult);
-}
-
-//
-// Determine whether we're running Offline Ngen for Build Lab based on the settings of several Config Values.
-//
-bool IsNgenOffline()
-{
- static volatile bool fInitialized = false;
- static volatile bool fNgenOffline = false;
-
- if (!fInitialized)
- {
- REGUTIL::CORConfigLevel kCorConfigLevel = static_cast<REGUTIL::CORConfigLevel>(REGUTIL::COR_CONFIG_ENV);
- CLRConfigStringHolder pwzConfigInstallRoot = REGUTIL::GetConfigString_DontUse_(CLRConfig::INTERNAL_InstallRoot,
- TRUE /* Prepend Complus */,
- kCorConfigLevel,
- FALSE /* fUsePerfCache */);
- CLRConfigStringHolder pwzConfigNicPath(CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_NicPath));
- CLRConfigStringHolder pwzRegistryRoot(CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_RegistryRoot));
- CLRConfigStringHolder pwzConfigAssemblyPath(CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_AssemblyPath));
- CLRConfigStringHolder pwzConfigAssemblyPath2(CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_AssemblyPath2));
- if (pwzConfigInstallRoot != NULL &&
- pwzConfigNicPath != NULL &&
- pwzConfigAssemblyPath != NULL &&
- pwzConfigAssemblyPath2 != NULL &&
- pwzRegistryRoot != NULL)
- {
- fNgenOffline = true;
- }
- fInitialized = true;
- }
-
- return fNgenOffline;
-}
-
-#endif //!FEATURE_UTILCODE_NO_DEPENDENCIES && !FEATURE_CORECLR
diff --git a/src/utilcode/regutil.cpp b/src/utilcode/regutil.cpp
index d611ef965f..c38c38907a 100644
--- a/src/utilcode/regutil.cpp
+++ b/src/utilcode/regutil.cpp
@@ -111,19 +111,6 @@ LPWSTR REGUTIL::EnvGetString(LPCWSTR name, BOOL fPrependCOMPLUS)
#ifdef ALLOW_REGISTRY
-#ifndef FEATURE_CORECLR
-
-//*****************************************************************************
-// Gives the use the ability to turn on/off REGUTIL's ability to read from
-// the registry. This is useful in mscoree.dll on startup, in order to avoid
-// loading advapi32 and rpcrt4 until we're ready for them
-//*****************************************************************************
-void REGUTIL::AllowRegistryUse(BOOL fAllowUse)
-{
- s_fUseRegistry = fAllowUse;
-}// AllowRegistryUse
-
-#endif // !FEATURE_CORECLR
#endif // ALLOW_REGISTRY
@@ -522,690 +509,6 @@ DWORD REGUTIL::GetConfigFlag_DontUse_(LPCWSTR name, DWORD bitToSet, BOOL defValu
#ifdef ALLOW_REGISTRY
-#ifndef FEATURE_CORECLR
-
-//*****************************************************************************
-// Open's the given key and returns the value desired. If the key or value is
-// not found, then the default is returned.
-//*****************************************************************************
-long REGUTIL::GetLong( // Return value from registry or default.
- LPCTSTR szName, // Name of value to get.
- long iDefault, // Default value to return if not found.
- LPCTSTR szKey, // Name of key, NULL==default.
- HKEY hKeyVal) // What key to work on.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- FORBID_FAULT;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- long iValue; // The value to read.
- DWORD iType; // Type of value to get.
- DWORD iSize; // Size of buffer.
- HKEY hKey; // Key for the registry entry.
-
- _ASSERTE(UseRegistry());
-
- FAULT_NOT_FATAL(); // We don't report OOM errors here, we return a default value.
-
- // Open the key if it is there.
- if (ERROR_SUCCESS != WszRegOpenKeyEx(hKeyVal, (szKey) ? szKey : FRAMEWORK_REGISTRY_KEY_W, 0, KEY_READ, &hKey))
- return (iDefault);
-
- // Read the key value if found.
- iType = REG_DWORD;
- iSize = sizeof(long);
- if (ERROR_SUCCESS != WszRegQueryValueEx(hKey, szName, NULL,
- &iType, (LPBYTE)&iValue, &iSize) || iType != REG_DWORD)
- iValue = iDefault;
-
- // We're done with the key now.
- VERIFY(!RegCloseKey(hKey));
- return (iValue);
-}
-
-
-// Opens or creates desired reg key, then writes iValue
-//*****************************************************************************
-long REGUTIL::SetOrCreateLong( // Return value from registry or default.
- LPCTSTR szName, // Name of value to get.
- long iValue, // Value to set.
- LPCTSTR szKey, // Name of key, NULL==default.
- HKEY hKeyVal) // What key to work on.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- _ASSERTE(UseRegistry());
-
- long lRtn; // Return code.
- HKEY hKey; // Key for the registry entry.
-
-
- // Open the key if it is there, else create it
- if (WszRegCreateKeyEx(hKeyVal,
- (szKey) ? szKey : FRAMEWORK_REGISTRY_KEY_W,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_WRITE,
- NULL,
- &hKey,
- NULL) != ERROR_SUCCESS)
- {
- return (-1);
- }
-
- // Read the key value if found.
- lRtn = WszRegSetValueEx(hKey, szName, NULL, REG_DWORD, (const BYTE *) &iValue, sizeof(DWORD));
-
- // We're done with the key now.
- VERIFY(!RegCloseKey(hKey));
- return (lRtn);
-}
-
-
-//*****************************************************************************
-// Open's the given key and returns the value desired. If the key or value is
-// not found, then the default is returned.
-//*****************************************************************************
-long REGUTIL::SetLong( // Return value from registry or default.
- LPCTSTR szName, // Name of value to get.
- long iValue, // Value to set.
- LPCTSTR szKey, // Name of key, NULL==default.
- HKEY hKeyVal) // What key to work on.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- _ASSERTE(UseRegistry());
-
- long lRtn; // Return code.
- HKEY hKey; // Key for the registry entry.
-
- // Open the key if it is there.
- if (ERROR_SUCCESS != WszRegOpenKey(hKeyVal, (szKey) ? szKey : FRAMEWORK_REGISTRY_KEY_W, &hKey))
- return (-1);
-
- // Read the key value if found.
- lRtn = WszRegSetValueEx(hKey, szName, NULL, REG_DWORD, (const BYTE *) &iValue, sizeof(DWORD));
-
- // We're done with the key now.
- VERIFY(!RegCloseKey(hKey));
- return (lRtn);
-}
-
-//*****************************************************************************
-// Set an entry in the registry of the form:
-// HKEY_CLASSES_ROOT\szKey\szSubkey = szValue. If szSubkey or szValue are
-// NULL, omit them from the above expression.
-//*****************************************************************************
-BOOL REGUTIL::SetKeyAndValue( // TRUE or FALSE.
- LPCTSTR szKey, // Name of the reg key to set.
- LPCTSTR szSubkey, // Optional subkey of szKey.
- LPCTSTR szValue) // Optional value for szKey\szSubkey.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- _ASSERTE(UseRegistry());
-
- size_t nLen = _tcslen(szKey) + 1;
- if (szSubkey)
- nLen += (_tcslen(szSubkey) + 1);
-
- NewArrayHolder<TCHAR> rcKey = new (nothrow) TCHAR[nLen]; // Buffer for the full key name.
- if (rcKey == NULL)
- return FALSE;
-
- HKEY hKey = NULL; // Handle to the new reg key.
-
- // Init the key with the base key name.
- _tcscpy_s(rcKey, nLen, szKey);
-
- // Append the subkey name (if there is one).
- if (szSubkey != NULL)
- {
- _tcscat_s(rcKey, nLen, _T("\\"));
- _tcscat_s(rcKey, nLen, szSubkey);
- }
-
- // Create the registration key.
- if (WszRegCreateKeyEx(HKEY_CLASSES_ROOT, rcKey, 0, NULL,
- REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
- &hKey, NULL) != ERROR_SUCCESS)
- return(FALSE);
-
- // Set the value (if there is one).
- if (szValue != NULL)
- if( WszRegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE *) szValue,
- (Wszlstrlen(szValue)+1) * sizeof(TCHAR)) != ERROR_SUCCESS ) {
- VERIFY(!RegCloseKey(hKey));
- return(FALSE);
- }
-
- VERIFY(!RegCloseKey(hKey));
- return(TRUE);
-}
-
-
-//*****************************************************************************
-// Delete an entry in the registry of the form:
-// HKEY_CLASSES_ROOT\szKey\szSubkey.
-//*****************************************************************************
-LONG REGUTIL::DeleteKey( // TRUE or FALSE.
- LPCTSTR szKey, // Name of the reg key to set.
- LPCTSTR szSubkey) // Subkey of szKey.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- _ASSERTE(UseRegistry());
-
- size_t nLen = _tcslen(szKey) + 1;
- if (szSubkey)
- nLen += (_tcslen(szSubkey) + 1);
-
- NewArrayHolder<TCHAR> rcKey = new (nothrow) TCHAR[nLen]; // Buffer for the full key name.
- if (rcKey == NULL)
- return ERROR_NOT_ENOUGH_MEMORY;
-
- // Init the key with the base key name.
- _tcscpy_s(rcKey, nLen, szKey);
-
- // Append the subkey name (if there is one).
- if (szSubkey != NULL)
- {
- _tcscat_s(rcKey, nLen, _T("\\"));
- _tcscat_s(rcKey, nLen, szSubkey);
- }
-
- // Delete the registration key.
- return WszRegDeleteKey(HKEY_CLASSES_ROOT, rcKey);
-}
-
-
-//*****************************************************************************
-// Open the key, create a new keyword and value pair under it.
-//*****************************************************************************
-BOOL REGUTIL::SetRegValue( // Return status.
- LPCTSTR szKeyName, // Name of full key.
- LPCTSTR szKeyword, // Name of keyword.
- LPCTSTR szValue) // Value of keyword.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- _ASSERTE(UseRegistry());
-
- HKEY hKey; // Handle to the new reg key.
-
- // Create the registration key.
- if (WszRegCreateKeyEx(HKEY_CLASSES_ROOT, szKeyName, 0, NULL,
- REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
- &hKey, NULL) != ERROR_SUCCESS)
- return (FALSE);
-
- // Set the value (if there is one).
- if (szValue != NULL)
- if( WszRegSetValueEx(hKey, szKeyword, 0, REG_SZ, (BYTE *)szValue,
- (Wszlstrlen(szValue)+1) * sizeof(TCHAR)) != ERROR_SUCCESS) {
- VERIFY(!RegCloseKey(hKey));
- return(FALSE);
- }
-
- VERIFY(!RegCloseKey(hKey));
- return (TRUE);
-}
-
-
-//*****************************************************************************
-// Does standard registration of a CoClass with a progid.
-//*****************************************************************************
-HRESULT REGUTIL::RegisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID.
- LPCTSTR szDesc, // Description of the class.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID, // Class progid.
- LPCTSTR szThreadingModel, // What threading model to use.
- LPCTSTR szModule, // Path to class.
- HINSTANCE hInst, // Handle to module being registered
- LPCTSTR szAssemblyName, // Optional Assembly,
- LPCTSTR szVersion, // Optional Runtime version (directory containing runtime)
- BOOL fExternal, // flag - External to mscoree.
- BOOL fRelativePath) // flag - Relative path in szModule
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- WCHAR rcCLSID[256]; // CLSID\\szID.
- WCHAR rcInproc[_MAX_PATH+64]; // CLSID\\InprocServer32
- WCHAR rcProgID[256]; // szProgIDPrefix.szClassProgID
- WCHAR rcIndProgID[256]; // rcProgID.iVersion
- WCHAR rcShim[_MAX_PATH];
- HRESULT hr;
-
- // Format the prog ID values.
- VERIFY(_snwprintf_s(rcIndProgID, _countof(rcIndProgID), _TRUNCATE, W("%s.%s"), szProgIDPrefix, szClassProgID));
-
- VERIFY(_snwprintf_s(rcProgID, _countof(rcProgID), _TRUNCATE, W("%s.%d"), rcIndProgID, iVersion));
-
- // Do the initial portion.
- if (FAILED(hr = RegisterClassBase(rclsid, szDesc, rcProgID, rcIndProgID, rcCLSID, NumItems(rcCLSID))))
- return (hr);
-
- VERIFY(_snwprintf_s(rcInproc, _countof(rcInproc), _TRUNCATE, W("%s\\%s"), rcCLSID, W("InprocServer32")));
-
- if (!fExternal){
- SetKeyAndValue(rcCLSID, W("InprocServer32"), szModule);
- }
- else{
- LPCTSTR pSep = szModule;
- if (!fRelativePath && szModule) {
- pSep = wcsrchr(szModule, W('\\'));
- if(pSep == NULL)
- pSep = szModule;
- else
- pSep++;
- }
- HMODULE hMod = WszLoadLibrary(W("mscoree.dll"));
- if (!hMod)
- return E_FAIL;
-
- DWORD ret;
- VERIFY(ret = WszGetModuleFileName(hMod, rcShim, NumItems(rcShim)));
- FreeLibrary(hMod);
- if( !ret )
- return E_FAIL;
-
- // Set the server path.
- SetKeyAndValue(rcCLSID, W("InprocServer32"), rcShim);
- if(pSep)
- SetKeyAndValue(rcCLSID, W("Server"), pSep);
-
- if(szAssemblyName) {
- SetRegValue(rcInproc, W("Assembly"), szAssemblyName);
- SetRegValue(rcInproc, W("Class"), rcIndProgID);
- }
- }
-
- // Set the runtime version, it needs to be passed in from the outside
- if(szVersion != NULL) {
- LPCTSTR pSep2 = NULL;
- LPTSTR pSep1 = const_cast<LPTSTR>(wcsrchr(szVersion, W('\\')));
- if(pSep1 != NULL) {
- *pSep1 = '\0';
- pSep2 = wcsrchr(szVersion, W('\\'));
- if (!pSep2)
- pSep2 = szVersion;
- else
- pSep2 = pSep2++; // exclude '\\'
- }
- else
- pSep2 = szVersion;
-
- size_t bufLen = wcslen(rcInproc)+wcslen(pSep2)+2;
- WCHAR* rcVersion = new (nothrow) WCHAR[bufLen];
- if(rcVersion==NULL)
- return (E_OUTOFMEMORY);
- wcscpy_s(rcVersion, bufLen, rcInproc);
- wcscat_s(rcVersion, bufLen, W("\\"));
- wcscat_s(rcVersion, bufLen, pSep2);
- SetRegValue(rcVersion, W("ImplementedInThisVersion"), W(""));
- delete[] rcVersion;
-
- if(pSep1 != NULL)
- *pSep1 = W('\\');
- }
-
- // Add the threading model information.
- SetRegValue(rcInproc, W("ThreadingModel"), szThreadingModel);
- return (S_OK);
-}
-
-
-
-//*****************************************************************************
-// Does standard registration of a CoClass with a progid.
-// NOTE: This is the non-side-by-side execution version.
-//*****************************************************************************
-HRESULT REGUTIL::RegisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID.
- LPCTSTR szDesc, // Description of the class.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID, // Class progid.
- LPCTSTR szThreadingModel, // What threading model to use.
- LPCTSTR szModule, // Path to class.
- BOOL bInprocServer) // Whether we register the server as inproc or local
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- WCHAR rcCLSID[256]; // CLSID\\szID.
- WCHAR rcInproc[_MAX_PATH+64]; // CLSID\\InprocServer32
- WCHAR rcProgID[256]; // szProgIDPrefix.szClassProgID
- WCHAR rcIndProgID[256]; // rcProgID.iVersion
- HRESULT hr;
-
- // Format the prog ID values.
- VERIFY(_snwprintf_s(rcIndProgID, _countof(rcIndProgID), _TRUNCATE, W("%s.%s"), szProgIDPrefix, szClassProgID));
-
- VERIFY(_snwprintf_s(rcProgID, _countof(rcProgID), _TRUNCATE, W("%s.%d"), rcIndProgID, iVersion));
-
- // Do the initial portion.
- if (FAILED(hr = RegisterClassBase(rclsid, szDesc, rcProgID, rcIndProgID, rcCLSID, NumItems(rcCLSID))))
- return (hr);
-
- WCHAR *szServerType = bInprocServer ? W("InprocServer32") : W("LocalServer32");
-
- // Set the server path.
- SetKeyAndValue(rcCLSID, szServerType , szModule);
-
- // Add the threading model information.
- VERIFY(_snwprintf_s(rcInproc, _countof(rcInproc), _TRUNCATE, W("%s\\%s"), rcCLSID, szServerType));
-
- SetRegValue(rcInproc, W("ThreadingModel"), szThreadingModel);
- return (S_OK);
-}
-
-
-
-//*****************************************************************************
-// Register the basics for a in proc server.
-//*****************************************************************************
-HRESULT REGUTIL::RegisterClassBase( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szDesc, // Class description.
- LPCTSTR szProgID, // Class prog ID.
- LPCTSTR szIndepProgID, // Class version independant prog ID.
- __out_ecount(cchOutCLSID) LPTSTR szOutCLSID, // CLSID formatted in character form.
- DWORD cchOutCLSID) // Out CLS ID buffer size
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- TCHAR szID[64]; // The class ID to register.
-
- // Create some base key strings.
- GuidToLPWSTR(rclsid, szID, NumItems(szID));
-
- size_t nLen = _tcslen(_T("CLSID\\")) + _tcslen( szID) + 1;
- if( cchOutCLSID < nLen )
- return E_INVALIDARG;
-
- _tcscpy_s(szOutCLSID, cchOutCLSID, W("CLSID\\"));
- _tcscat_s(szOutCLSID, cchOutCLSID, szID);
-
- // Create ProgID keys.
- SetKeyAndValue(szProgID, NULL, szDesc);
- SetKeyAndValue(szProgID, W("CLSID"), szID);
-
- // Create VersionIndependentProgID keys.
- SetKeyAndValue(szIndepProgID, NULL, szDesc);
- SetKeyAndValue(szIndepProgID, W("CurVer"), szProgID);
- SetKeyAndValue(szIndepProgID, W("CLSID"), szID);
-
- // Create entries under CLSID.
- SetKeyAndValue(szOutCLSID, NULL, szDesc);
- SetKeyAndValue(szOutCLSID, W("ProgID"), szProgID);
- SetKeyAndValue(szOutCLSID, W("VersionIndependentProgID"), szIndepProgID);
- SetKeyAndValue(szOutCLSID, W("NotInsertable"), NULL);
- return (S_OK);
-}
-
-
-
-//*****************************************************************************
-// Unregister the basic information in the system registry for a given object
-// class.
-//*****************************************************************************
-HRESULT REGUTIL::UnregisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID, // Class progid.
- BOOL fExternal) // flag - External to mscoree.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- WCHAR rcCLSID[64]; // CLSID\\szID.
- WCHAR rcProgID[128]; // szProgIDPrefix.szClassProgID
- WCHAR rcIndProgID[128]; // rcProgID.iVersion
-
- // Format the prog ID values.
- VERIFY(_snwprintf_s(rcProgID, _countof(rcProgID), _TRUNCATE, W("%s.%s"), szProgIDPrefix, szClassProgID));
-
- VERIFY(_snwprintf_s(rcIndProgID, _countof(rcIndProgID), _TRUNCATE, W("%s.%d"), rcProgID, iVersion));
-
- UnregisterClassBase(rclsid, rcProgID, rcIndProgID, rcCLSID, NumItems(rcCLSID));
- DeleteKey(rcCLSID, W("InprocServer32"));
- if (fExternal){
- DeleteKey(rcCLSID, W("Server"));
- DeleteKey(rcCLSID, W("Version"));
- }
- GuidToLPWSTR(rclsid, rcCLSID, NumItems(rcCLSID));
- DeleteKey(W("CLSID"), rcCLSID);
- return (S_OK);
-}
-
-
-//*****************************************************************************
-// Unregister the basic information in the system registry for a given object
-// class.
-// NOTE: This is the non-side-by-side execution version.
-//*****************************************************************************
-HRESULT REGUTIL::UnregisterCOMClass( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szProgIDPrefix, // Prefix for progid.
- int iVersion, // Version # for progid.
- LPCTSTR szClassProgID) // Class progid.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- WCHAR rcCLSID[64]; // CLSID\\szID.
- WCHAR rcProgID[128]; // szProgIDPrefix.szClassProgID
- WCHAR rcIndProgID[128]; // rcProgID.iVersion
-
- // Format the prog ID values.
- VERIFY(_snwprintf_s(rcProgID, _countof(rcProgID), _TRUNCATE, W("%s.%s"), szProgIDPrefix, szClassProgID));
-
- VERIFY(_snwprintf_s(rcIndProgID, _countof(rcIndProgID), _TRUNCATE, W("%s.%d"), rcProgID, iVersion));
-
- UnregisterClassBase(rclsid, rcProgID, rcIndProgID, rcCLSID, NumItems(rcCLSID));
- DeleteKey(rcCLSID, W("InprocServer32"));
- DeleteKey(rcCLSID, W("LocalServer32"));
-
- GuidToLPWSTR(rclsid, rcCLSID, NumItems(rcCLSID));
- DeleteKey(W("CLSID"), rcCLSID);
- return (S_OK);
-}
-
-
-//*****************************************************************************
-// Delete the basic settings for an inproc server.
-//*****************************************************************************
-HRESULT REGUTIL::UnregisterClassBase( // Return code.
- REFCLSID rclsid, // Class ID we are registering.
- LPCTSTR szProgID, // Class prog ID.
- LPCTSTR szIndepProgID, // Class version independant prog ID.
- __out_ecount(cchOutCLSID) LPTSTR szOutCLSID, // Return formatted class ID here.
- DWORD cchOutCLSID) // Out CLS ID buffer size
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- TCHAR szID[64]; // The class ID to register.
-
- // Create some base key strings.
- GuidToLPWSTR(rclsid, szID, NumItems(szID));
- size_t nLen = _tcslen(_T("CLSID\\")) + _tcslen( szID) + 1;
- if( cchOutCLSID < nLen )
- return E_INVALIDARG;
-
- _tcscpy_s(szOutCLSID, cchOutCLSID, W("CLSID\\"));
- _tcscat_s(szOutCLSID, cchOutCLSID, szID);
-
- // Delete the version independant prog ID settings.
- DeleteKey(szIndepProgID, W("CurVer"));
- DeleteKey(szIndepProgID, W("CLSID"));
- WszRegDeleteKey(HKEY_CLASSES_ROOT, szIndepProgID);
-
- // Delete the prog ID settings.
- DeleteKey(szProgID, W("CLSID"));
- WszRegDeleteKey(HKEY_CLASSES_ROOT, szProgID);
-
- // Delete the class ID settings.
- DeleteKey(szOutCLSID, W("ProgID"));
- DeleteKey(szOutCLSID, W("VersionIndependentProgID"));
- DeleteKey(szOutCLSID, W("NotInsertable"));
- WszRegDeleteKey(HKEY_CLASSES_ROOT, szOutCLSID);
- return (S_OK);
-}
-
-
-//*****************************************************************************
-// Register a type library.
-//*****************************************************************************
-HRESULT REGUTIL::RegisterTypeLib( // Return code.
- REFGUID rtlbid, // TypeLib ID we are registering.
- int iVersion, // Typelib version.
- LPCTSTR szDesc, // TypeLib description.
- LPCTSTR szModule) // Path to the typelib.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- WCHAR szID[64]; // The typelib ID to register.
- WCHAR szTLBID[256]; // TypeLib\\szID.
- WCHAR szHelpDir[_MAX_PATH];
- WCHAR szDrive[_MAX_DRIVE] = {0};
- WCHAR szDir[_MAX_DIR] = {0};
- WCHAR szVersion[64];
- LPWSTR szTmp;
-
- // Create some base key strings.
- GuidToLPWSTR(rtlbid, szID, NumItems(szID));
-
- _tcscpy_s(szTLBID, _countof(szTLBID), W("TypeLib\\"));
- _tcscat_s(szTLBID, _countof(szTLBID), szID);
-
- VERIFY(_snwprintf_s(szVersion, _countof(szVersion), _TRUNCATE, W("%d.0"), iVersion));
-
- // Create Typelib keys.
- SetKeyAndValue(szTLBID, NULL, NULL);
- SetKeyAndValue(szTLBID, szVersion, szDesc);
- _tcscat_s(szTLBID, _countof(szTLBID), W("\\"));
- _tcscat_s(szTLBID, _countof(szTLBID), szVersion);
- SetKeyAndValue(szTLBID, W("0"), NULL);
- SetKeyAndValue(szTLBID, W("0\\win32"), szModule);
- SetKeyAndValue(szTLBID, W("FLAGS"), W("0"));
- SplitPath(szModule, szDrive, _MAX_DRIVE, szDir, _MAX_DIR, NULL, 0, NULL, 0);
- _tcscpy_s(szHelpDir, _countof(szHelpDir), szDrive);
- if ((szTmp = CharPrev(szDir, szDir + Wszlstrlen(szDir))) != NULL)
- *szTmp = '\0';
- _tcscat_s(szHelpDir, _countof(szHelpDir), szDir);
- SetKeyAndValue(szTLBID, W("HELPDIR"), szHelpDir);
- return (S_OK);
-}
-
-
-//*****************************************************************************
-// Remove the registry keys for a type library.
-//*****************************************************************************
-HRESULT REGUTIL::UnregisterTypeLib( // Return code.
- REFGUID rtlbid, // TypeLib ID we are registering.
- int iVersion) // Typelib version.
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- WCHAR szID[64]; // The typelib ID to register.
- WCHAR szTLBID[256]; // TypeLib\\szID.
- WCHAR szTLBVersion[256]; // TypeLib\\szID\\szVersion
- WCHAR szVersion[64];
-
- // Create some base key strings.
- GuidToLPWSTR(rtlbid, szID, NumItems(szID));
-
- VERIFY(_snwprintf_s(szVersion, _countof(szVersion), _TRUNCATE, W("%d.0"), iVersion));
-
- _tcscpy_s(szTLBID, _countof(szTLBID), W("TypeLib\\"));
- _tcscat_s(szTLBID, _countof(szTLBID), szID);
- _tcscpy_s(szTLBVersion, _countof(szTLBVersion), szTLBID);
- _tcscat_s(szTLBVersion, _countof(szTLBVersion), W("\\"));
- _tcscat_s(szTLBVersion, _countof(szTLBVersion), szVersion);
-
- // Delete Typelib keys.
- DeleteKey(szTLBVersion, W("HELPDIR"));
- DeleteKey(szTLBVersion, W("FLAGS"));
- DeleteKey(szTLBVersion, W("0\\win32"));
- DeleteKey(szTLBVersion, W("0"));
- DeleteKey(szTLBID, szVersion);
- WszRegDeleteKey(HKEY_CLASSES_ROOT, szTLBID);
- return (0);
-}
-
-#endif // !FEATURE_CORECLR
//
diff --git a/src/utilcode/sortversioning.cpp b/src/utilcode/sortversioning.cpp
index 5420947842..65781cdc1a 100644
--- a/src/utilcode/sortversioning.cpp
+++ b/src/utilcode/sortversioning.cpp
@@ -136,230 +136,6 @@ namespace SortVersioning
return i;
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- ////////////////////////////////////////////////////////////////////////////
- //
- // LoadSortModuleAndInvariant()
- //
- // Attempts to load the given dll. If that is successful, attempts to
- // load the invariant data. If that is successful, returns the module handle
- // and the addresses of the SortGetHandle function and SortCloseHandle function
- //
- // failure is indicated by returning NULL for the module handle and the
- // function addresses
- //
- ////////////////////////////////////////////////////////////////////////////
-
- HMODULE LoadSortModuleAndInvariant(
- __in LPCWSTR sDllName,
- __in DWORD dwVersion,
- __out SORTGETHANDLE* ppGetHandle,
- __out SORTCLOSEHANDLE* ppCloseHandle
- )
- {
- *ppGetHandle = NULL;
- *ppCloseHandle = NULL;
- HMODULE hSort;
-
- if(FAILED(UtilCode::LoadLibraryShim(sDllName, NULL, NULL, &hSort)))
- {
- return NULL;
- }
-
- SORTGETHANDLE pGetHandle = (SORTGETHANDLE)GetProcAddress(hSort, "SortGetHandle");
- SORTCLOSEHANDLE pCloseHandle = (SORTCLOSEHANDLE)GetProcAddress(hSort, "SortCloseHandle");
-
- // If we didn't load the procs, then remember that
- if (pCloseHandle == NULL || pGetHandle == NULL)
- {
- ::FreeLibrary(hSort);
- return NULL;
- }
-
- // Verify that the data file's available
- NLSVERSIONINFO sortVersion;
- sortVersion.dwNLSVersionInfoSize = sizeof(NLSVERSIONINFO);
- sortVersion.dwNLSVersion = dwVersion;
- sortVersion.dwDefinedVersion = dwVersion;
-
- // Invariant must be there and is kinda common, so we'll just get it
- PSORTHANDLE pSort = pGetHandle(W(""), &sortVersion, NULL);
- if (!pSort)
- {
- // Yikes, invariant failed, forget about it.
- ::FreeLibrary(hSort);
- return NULL;
- }
-
- // Since we found it, may as well remember it.
- const SORTHANDLE * const pSortInHash = InsertSortHashNode(pSort);
-
- // If we got a different one back then free the one we added
- if (pSortInHash != pSort && pSortInHash)
- {
- // We got a different one from the hash (someone beat us to the cache)
- // so use that and discard the new one.
- pCloseHandle(pSort);
- }
-
- *ppGetHandle = pGetHandle;
- *ppCloseHandle = pCloseHandle;
- return hSort;
- }
-
- // Attempts to load a Sort DLL. If this fails, the values of the __out parameters are unchanged.
- __success(return)
- BOOL LoadSortDllAndPublish(
- __in LPCWSTR sDllName,
- __in DWORD dwVersion,
- __out __encoded_pointer SORTGETHANDLE* ppGetHandle,
- __out __encoded_pointer SORTCLOSEHANDLE* ppCloseHandle,
- __out HMODULE* phSortDll)
- {
- HMODULE hSortDll;
- SORTGETHANDLE pGetHandle;
- SORTCLOSEHANDLE pCloseHandle;
-
- hSortDll = LoadSortModuleAndInvariant(sDllName, dwVersion, &pGetHandle, &pCloseHandle);
-
- if(hSortDll != NULL) {
- *phSortDll = hSortDll;
- *ppGetHandle = (SORTGETHANDLE)EncodePointer(pGetHandle);
- *ppCloseHandle = (SORTCLOSEHANDLE)EncodePointer(pCloseHandle);
- return TRUE;
- }
-
- return FALSE;
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // GetSortGetHandle()
- //
- // Get the SortGetHandle() function for the proper dll version.
- //
- ////////////////////////////////////////////////////////////////////////////
- SORTGETHANDLE GetSortGetHandle(__in DWORD dwVersion)
- {
- if(dwVersion == SORT_VERSION_DEFAULT)
- {
- // If we haven't tried to load the module/proc before do so now
- if (g_hSortDefault == (HMODULE)-1)
- {
- LoadSortDllAndPublish(SORT_DEFAULT_DLL_NAME, SORT_VERSION_DEFAULT, &g_pDefaultGetHandle, &g_pDefaultCloseHandle, &g_hSortDefault);
- }
-
- // This check is necessary because the LoadSortDllAndPublish call may have failed since some platforms
- // won't have nlssorting.dll (e.g. Windows 8 and above).
- if (g_hSortDefault != (HMODULE)-1)
- {
- return (SORTGETHANDLE)DecodePointer(g_pDefaultGetHandle);
- }
- }
-
- HMODULE* pHSortModule;
- SORTGETHANDLE* ppGetHandle;
- SORTCLOSEHANDLE* ppCloseHandle;
-
- if(dwVersion == SORT_VERSION_V4)
- {
- ppGetHandle = &g_pV4GetHandle;
- ppCloseHandle = &g_pV4CloseHandle;
- pHSortModule = &g_hSortCompatV4;
- }
- else if(dwVersion == SORT_VERSION_WHIDBEY)
- {
- ppGetHandle = &g_pV2GetHandle;
- ppCloseHandle = &g_pV2CloseHandle;
- pHSortModule = &g_hSortCompatV2;
- }
- else
- {
- // Unsupported sorting version.
- return NULL;
- }
-
- if(*pHSortModule == (HMODULE) -1)
- {
- // get module name - the module name should be "Sort"+dwVersion.ToString("x8")+".dll"
- WCHAR moduleName[] = W("Sort00000000.dll");
- // replace the "00000000" with the hexadecimal of dwVersion
- LPCWSTR hex = W("0123456789abcdef");
- WCHAR* p = &moduleName[4+8]; // position at end of number part of dll name
-
- unsigned int value = dwVersion;
-
- while (value != 0 && p != moduleName) {
- int digit = value & 0xF;
- *--p = hex[digit];
- value >>= 4;
- }
-
- if(!LoadSortDllAndPublish(&moduleName[0], dwVersion, ppGetHandle, ppCloseHandle, pHSortModule))
- {
- // We failed to load a versioned sort dll, try to fall back to the current version.
- // If we haven't tried to load the module/proc before do so now
- if (g_hSortDefault == (HMODULE)-1)
- {
- LoadSortDllAndPublish(SORT_DEFAULT_DLL_NAME, SORT_VERSION_DEFAULT, &g_pDefaultGetHandle, &g_pDefaultCloseHandle, &g_hSortDefault);
- }
-
- *pHSortModule = g_hSortDefault;
- *ppCloseHandle = g_pDefaultCloseHandle;
- *ppGetHandle = g_pDefaultGetHandle;
- }
- }
-
- // At this point, we've either loaded a sorting dll or we've exausted all options.
- if(*pHSortModule == (HMODULE) -1)
- {
- // Couldn't find anything, give up.
- return NULL;
- }
- else
- {
- return (SORTGETHANDLE)DecodePointer(*ppGetHandle);
- }
-
- // Unknown version requested
- return NULL;
- }
-
- void DoSortCloseHandle(__in DWORD dwVersion, __in PSORTHANDLE pSort)
- {
- if (dwVersion == SORT_VERSION_DEFAULT)
- {
- SORTCLOSEHANDLE pDefaultCloseHandle = (SORTCLOSEHANDLE)DecodePointer(g_pDefaultCloseHandle);
- if(pDefaultCloseHandle != NULL)
- {
- (pDefaultCloseHandle)(pSort);
- return;
- }
- }
-
- if (dwVersion == SORT_VERSION_V4)
- {
- SORTCLOSEHANDLE pV4CloseHandle = (SORTCLOSEHANDLE)DecodePointer(g_pV4CloseHandle);
- if(pV4CloseHandle != NULL)
- {
- (pV4CloseHandle)(pSort);
- return;
- }
- }
-
-
- if (dwVersion == SORT_VERSION_WHIDBEY)
- {
- SORTCLOSEHANDLE pV2CloseHandle = (SORTCLOSEHANDLE)DecodePointer(g_pV2CloseHandle);
- if(pV2CloseHandle != NULL)
- {
- (pV2CloseHandle)(pSort);
- return;
- }
- }
- }
-
-#else // !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
SORTGETHANDLE GetSortGetHandle(__in DWORD dwVersion)
{
@@ -370,7 +146,6 @@ namespace SortVersioning
{
}
-#endif // !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
////////////////////////////////////////////////////////////////////////////
//
@@ -663,26 +438,7 @@ namespace SortVersioning
////////////////////////////////////////////////////////////////////////////
DWORD SortNLSVersion()
{
-#ifdef FEATURE_CORECLR
return SORT_VERSION_DEFAULT;
-#else
- static bool sortNLSVersionConfigChecked = false;
- static DWORD sortNLSVersion = SORT_VERSION_DEFAULT;
-
- if(!sortNLSVersionConfigChecked)
- {
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return false);
- sortNLSVersion = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CompatSortNLSVersion);
- if(sortNLSVersion == 0)
- {
- sortNLSVersion = SORT_VERSION_DEFAULT;
- }
- END_SO_INTOLERANT_CODE;
-
- sortNLSVersionConfigChecked = true;
- }
- return sortNLSVersion;
-#endif // !FEATURE_CORECLR
}
////////////////////////////////////////////////////////////////////////////
diff --git a/src/utilcode/stacktrace.cpp b/src/utilcode/stacktrace.cpp
index 858fac723e..8fbc457019 100644
--- a/src/utilcode/stacktrace.cpp
+++ b/src/utilcode/stacktrace.cpp
@@ -949,7 +949,7 @@ void MagicDeinit(void)
}
}
-#if defined(_TARGET_X86_) && defined(FEATURE_CORECLR)
+#if defined(_TARGET_X86_)
/****************************************************************************
* ClrCaptureContext *
*-------------------*
diff --git a/src/utilcode/stresslog.cpp b/src/utilcode/stresslog.cpp
index d364b06dd6..91c5c0e8ef 100644
--- a/src/utilcode/stresslog.cpp
+++ b/src/utilcode/stresslog.cpp
@@ -608,12 +608,7 @@ FORCEINLINE BOOL StressLog::InlinedETWLogOn(unsigned facility, unsigned level)
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
-#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE)
- return ((Microsoft_Windows_DotNETRuntimeStressHandle != 0) &&
- (ETW_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_Context, (UCHAR)level, facility) != 0));
-#else
return FALSE;
-#endif
}
BOOL StressLog::ETWLogOn(unsigned facility, unsigned level)
@@ -671,28 +666,6 @@ void StressLog::LogMsg (unsigned level, unsigned facility, int cArgs, const char
}
// Stress Log ETW feature available only on the desktop versions of the runtime
-#if !defined(FEATURE_CORECLR)
- // The previous LogMsg call could have modified the Args, so we need to reset it
- if(InlinedETWLogOn(facility, level))
- {
-#define MAX_STRESSLOG_DATA_ETW_LENGTH 256
- CHAR logMessage[MAX_STRESSLOG_DATA_ETW_LENGTH];
-
- va_start(Args, format);
- ULONG messageLength = (USHORT)_vsnprintf_s(logMessage, COUNTOF(logMessage), MAX_STRESSLOG_DATA_ETW_LENGTH-1, format, Args);
- va_end(Args);
-
- if(messageLength >= 0 &&
- messageLength < MAX_STRESSLOG_DATA_ETW_LENGTH) // this condition has been added to make prefast happy
- {
- logMessage[messageLength] = 0;
- }
- messageLength++;
- logMessage[MAX_STRESSLOG_DATA_ETW_LENGTH-1] = 0;
- FireEtwStressLogEvent_V1((UINT32)facility, (UCHAR)level, logMessage, GetClrInstanceId());
-#undef MAX_STRESSLOG_DATA_ETW_LENGTH
- }
-#endif // !FEATURE_CORECLR
#endif //!DACCESS_COMPILE
}
diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp
index 45b5125206..67e353b359 100644
--- a/src/utilcode/util.cpp
+++ b/src/utilcode/util.cpp
@@ -19,9 +19,6 @@
#include "cor.h"
#include "corinfo.h"
-#ifndef FEATURE_CORECLR
-#include "metahost.h"
-#endif // !FEATURE_CORECLR
const char g_RTMVersion[]= "v1.0.3705";
@@ -3269,114 +3266,6 @@ BOOL FileExists(LPCWSTR filename)
return TRUE;
}
-#ifndef FEATURE_CORECLR
-// Current users for FileLock are ngen and ngen service
-
-FileLockHolder::FileLockHolder()
-{
- _hLock = INVALID_HANDLE_VALUE;
-}
-
-FileLockHolder::~FileLockHolder()
-{
- Release();
-}
-
-// the amount of time we want to wait
-#define FILE_LOCK_RETRY_TIME 100
-
-void FileLockHolder::Acquire(LPCWSTR lockName, HANDLE hInterrupt, BOOL* pInterrupted)
-{
- WRAPPER_NO_CONTRACT;
-
- DWORD dwErr = 0;
- DWORD dwAccessDeniedRetry = 0;
- const DWORD MAX_ACCESS_DENIED_RETRIES = 10;
-
- if (pInterrupted)
- {
- *pInterrupted = FALSE;
- }
-
- _ASSERTE(_hLock == INVALID_HANDLE_VALUE);
-
- for (;;) {
- _hLock = WszCreateFile(lockName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
- if (_hLock != INVALID_HANDLE_VALUE) {
- return;
- }
-
- dwErr = GetLastError();
- // Logically we should only expect ERROR_SHARING_VIOLATION, but Windows can also return
- // ERROR_ACCESS_DENIED for underlying NtStatus DELETE_PENDING. That happens when another process
- // (gacutil.exe or indexer) have the file opened. Unfortunately there is no public API that would
- // allow us to detect this NtStatus and distinguish it from 'real' access denied (candidates are
- // RtlGetLastNtStatus that is not documented on MSDN and NtCreateFile that is internal and can change
- // at any time), so we retry on access denied, but only for a limited number of times.
- if (dwErr == ERROR_SHARING_VIOLATION ||
- (dwErr == ERROR_ACCESS_DENIED && ++dwAccessDeniedRetry <= MAX_ACCESS_DENIED_RETRIES))
- {
- // Somebody is holding the lock. Let's sleep, and come back again.
- if (hInterrupt)
- {
- _ASSERTE(pInterrupted &&
- "If you can be interrupted, you better want to know if you actually were interrupted");
- if (WaitForSingleObject(hInterrupt, FILE_LOCK_RETRY_TIME) == WAIT_OBJECT_0)
- {
- if (pInterrupted)
- {
- *pInterrupted = TRUE;
- }
-
- // We've been interrupted, so return without acquiring
- return;
- }
- }
- else
- {
- ClrSleepEx(FILE_LOCK_RETRY_TIME, FALSE);
- }
- }
- else {
- ThrowHR(HRESULT_FROM_WIN32(dwErr));
- }
- }
-}
-
-
-HRESULT FileLockHolder::AcquireNoThrow(LPCWSTR lockName, HANDLE hInterrupt, BOOL* pInterrupted)
-{
- HRESULT hr = S_OK;
-
- EX_TRY
- {
- Acquire(lockName, hInterrupt, pInterrupted);
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
-BOOL FileLockHolder::IsTaken(LPCWSTR lockName)
-{
-
- // We don't want to do an acquire the lock to know if its taken, so we want to see if the file
- // exists. However, in situations like unplugging a machine, a DELETE_ON_CLOSE still leaves the file
- // around. We try to delete it here. If the lock is acquired, DeleteFile will fail, as the file is
- // not opened with SHARE_DELETE.
- WszDeleteFile(lockName);
-
- return FileExists(lockName);
-}
-
-void FileLockHolder::Release()
-{
- if (_hLock != INVALID_HANDLE_VALUE) {
- CloseHandle(_hLock);
- _hLock = INVALID_HANDLE_VALUE;
- }
-}
-#endif // FEATURE_CORECLR
//======================================================================
// This function returns true, if it can determine that the instruction pointer
@@ -3534,59 +3423,6 @@ RUNTIMEVERSIONINFO RUNTIMEVERSIONINFO::notDefined;
BOOL IsV2RuntimeLoaded(void)
{
-#ifndef FEATURE_CORECLR
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- CANNOT_TAKE_LOCK;
- }
- CONTRACTL_END;
-
- ReleaseHolder<ICLRMetaHost> pMetaHost(NULL);
- ReleaseHolder<IEnumUnknown> pEnum(NULL);
- ReleaseHolder<IUnknown> pUnk(NULL);
- ReleaseHolder<ICLRRuntimeInfo> pRuntime(NULL);
- HRESULT hr;
-
- HModuleHolder hModule = WszLoadLibrary(MSCOREE_SHIM_W);
- if (hModule == NULL)
- return FALSE;
-
- CLRCreateInstanceFnPtr pfnCLRCreateInstance = (CLRCreateInstanceFnPtr)::GetProcAddress(hModule, "CLRCreateInstance");
- if (pfnCLRCreateInstance == NULL)
- return FALSE;
-
- hr = (*pfnCLRCreateInstance)(CLSID_CLRMetaHost, IID_ICLRMetaHost, (LPVOID *)&pMetaHost);
- if (FAILED(hr))
- return FALSE;
-
- hr = pMetaHost->EnumerateLoadedRuntimes(GetCurrentProcess(), &pEnum);
- if (FAILED(hr))
- return FALSE;
-
- while (pEnum->Next(1, &pUnk, NULL) == S_OK)
- {
- hr = pUnk->QueryInterface(IID_ICLRRuntimeInfo, (void **)&pRuntime);
- if (FAILED(hr))
- continue;
-
- WCHAR wszVersion[30];
- DWORD cchVersion = _countof(wszVersion);
- hr = pRuntime->GetVersionString(wszVersion, &cchVersion);
- if (FAILED(hr))
- continue;
-
- // Is it a V2 runtime?
- if ((cchVersion < 3) ||
- ((wszVersion[0] != W('v')) && (wszVersion[0] != W('V'))) ||
- (wszVersion[1] != W('2')) ||
- (wszVersion[2] != W('.')))
- continue;
-
- return TRUE;
- }
-#endif // FEATURE_CORECLR
return FALSE;
}
@@ -3610,54 +3446,6 @@ BOOL IsClrHostedLegacyComObject(REFCLSID rclsid)
-#if !defined(FEATURE_CORECLR) && !defined(SELF_NO_HOST) && !defined(FEATURE_UTILCODE_NO_DEPENDENCIES)
-
-namespace UtilCode
-{
-
-#pragma warning(push)
-#pragma warning(disable:4996) // For use of deprecated LoadLibraryShim
-
- // When a NULL version is passed to LoadLibraryShim, this told the shim to bind the already-loaded
- // runtime or to the latest runtime. In hosted environments, we already know a runtime (or two) is
- // loaded, and since we are no longer guaranteed that a call to mscoree!LoadLibraryShim with a NULL
- // version will return the correct runtime, this code uses the ClrCallbacks infrastructure
- // available to get the ICLRRuntimeInfo for the runtime in which this code is hosted, and then
- // calls ICLRRuntimeInfo::LoadLibrary to make sure that the load occurs within the context of the
- // correct runtime.
- HRESULT LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll)
- {
- HRESULT hr = S_OK;
-
- if (szVersion != NULL)
- { // If a version is provided, then we just fall back to the legacy function to allow
- // it to construct the explicit path and load from that location.
- //@TODO: Can we verify that all callers of LoadLibraryShim in hosted environments always pass null and eliminate this code?
- return ::LoadLibraryShim(szDllName, szVersion, pvReserved, phModDll);
- }
-
- //
- // szVersion is NULL, which means we should load the DLL from the hosted environment's directory.
- //
-
- typedef ICLRRuntimeInfo *GetCLRRuntime_t();
- GetCLRRuntime_t *pfnGetCLRRuntime =
- reinterpret_cast<GetCLRRuntime_t *>((*GetClrCallbacks().m_pfnGetCLRFunction)("GetCLRRuntime"));
- if (pfnGetCLRRuntime == NULL)
- return E_UNEXPECTED;
-
- ICLRRuntimeInfo* pRI = (*pfnGetCLRRuntime)();
- if (pRI == NULL)
- return E_UNEXPECTED;
-
- return pRI->LoadLibrary(szDllName, phModDll);
- }
-
-#pragma warning(pop)
-
-}
-
-#endif //!FEATURE_CORECLR && !SELF_NO_HOST && !FEATURE_UTILCODE_NO_DEPENDENCIES
namespace Clr
{
diff --git a/src/utilcode/utilmessagebox.cpp b/src/utilcode/utilmessagebox.cpp
index 3d13489b84..899b12088a 100644
--- a/src/utilcode/utilmessagebox.cpp
+++ b/src/utilcode/utilmessagebox.cpp
@@ -19,29 +19,6 @@
#include "../dlls/mscorrc/resource.h"
#include "ex.h"
-#if !defined(SELF_NO_HOST) && !defined(FEATURE_CORECLR)
-
-//
-// This should be used for runtime dialog box, because we assume the resource is from mscorrc.dll
-// For tools like ildasm or Shim which uses their own resource file, you need to define IDS_RTL in
-// their resource file and define a function like this and append the style returned from the function
-// to every calls to WszMessageBox.
-//
-UINT GetCLRMBRTLStyle()
-{
- WRAPPER_NO_CONTRACT;
-
- UINT mbStyle = 0;
- WCHAR buff[MAX_LONGPATH];
- if(SUCCEEDED(UtilLoadStringRC(IDS_RTL, buff, MAX_LONGPATH, true))) {
- if(wcscmp(buff, W("RTL_True")) == 0) {
- mbStyle = 0x00080000 |0x00100000; // MB_RIGHT || MB_RTLREADING
- }
- }
- return mbStyle;
-}
-
-#endif //!defined(SELF_NO_HOST) && !defined(FEATURE_CORECLR)
BOOL ShouldDisplayMsgBoxOnCriticalFailure()
{
@@ -263,9 +240,6 @@ int UtilMessageBoxNonLocalizedVA(
// in use. However, outside the CLR (SELF_NO_HOST) we can't assume we have resources and
// in CORECLR we can't even necessarily expect that our CLR callbacks have been initialized.
// This code path is used for ASSERT dialogs.
-#if !defined(SELF_NO_HOST) && !defined(FEATURE_CORECLR)
- uType |= GetCLRMBRTLStyle();
-#endif
result = MessageBoxImpl(hWnd, formattedMessage, formattedTitle, details, uType);
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 040837a8a7..bf41be6544 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -103,9 +103,6 @@
#include "clrprivtypecachewinrt.h"
-#ifndef FEATURE_CORECLR
-#include "nlsinfo.h"
-#endif
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
#pragma warning(push)
@@ -739,10 +736,8 @@ OBJECTHANDLE ThreadStaticHandleTable::AllocateHandles(DWORD nRequested)
void BaseDomain::Attach()
{
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
-#ifdef FEATURE_CORECLR
// Randomized string hashing is on by default for String.GetHashCode in coreclr.
COMNlsHashProvider::s_NlsHashProvider.SetUseRandomHashing((CorHost2::GetStartupFlags() & STARTUP_DISABLE_RANDOMIZED_STRING_HASHING) == 0);
-#endif // FEATURE_CORECLR
#endif // FEATURE_RANDOMIZED_STRING_HASHING
m_SpecialStaticsCrst.Init(CrstSpecialStatics);
}
@@ -1229,7 +1224,6 @@ void AppDomain::RegisterLoaderAllocatorForDeletion(LoaderAllocator * pLoaderAllo
m_pDelayedLoaderAllocatorUnloadList = pLoaderAllocator;
}
-#ifdef FEATURE_CORECLR
void AppDomain::ShutdownNativeDllSearchDirectories()
{
LIMITED_METHOD_CONTRACT;
@@ -1243,7 +1237,6 @@ void AppDomain::ShutdownNativeDllSearchDirectories()
m_NativeDllSearchDirectories.Clear();
}
-#endif
void AppDomain::ReleaseDomainBoundInfo()
{
@@ -3497,10 +3490,6 @@ void SystemDomain::InitializeDefaultDomain(
#ifndef CROSSGEN_COMPILE
if (!NingenEnabled())
{
-#ifndef FEATURE_CORECLR
- pDefaultDomain->InitializeHashing(NULL);
- pDefaultDomain->InitializeSorting(NULL);
-#endif // FEATURE_CORECLR
}
#endif // CROSSGEN_COMPILE
@@ -3540,174 +3529,6 @@ void SystemDomain::InitializeDefaultDomain(
Volatile<LONG> g_fInExecuteMainMethod = 0;
#endif
-#ifndef FEATURE_CORECLR
-void SystemDomain::ExecuteMainMethod(HMODULE hMod, __in_opt LPWSTR path /*=NULL*/)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- PRECONDITION(CheckPointer(hMod, NULL_OK));
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
-#ifdef _DEBUG
- CounterHolder counter(&g_fInExecuteMainMethod);
-#endif
-
- Thread *pThread = GetThread();
- _ASSERTE(pThread);
-
- GCX_COOP();
-
- //
- // There is no EH protecting this transition!
- // This is generically ok in this method because if we throw out of here, it becomes unhandled anyway.
- //
- FrameWithCookie<ContextTransitionFrame> frame;
- pThread->EnterContextRestricted(SystemDomain::System()->DefaultDomain()->GetDefaultContext(), &frame);
- _ASSERTE(pThread->GetDomain());
-
- AppDomain *pDomain = GetAppDomain();
- _ASSERTE(pDomain);
-
- // Push this frame around loading the main assembly to ensure the
- // debugger can properly recognize any managed code that gets run
- // as "class initializaion" code.
- FrameWithCookie<DebuggerClassInitMarkFrame> __dcimf;
- {
- GCX_PREEMP();
-
- PEImageHolder pTempImage(PEImage::LoadImage(hMod));
-
- PEFileHolder pTempFile(PEFile::Open(pTempImage.Extract()));
-
- // Check for CustomAttributes - Set up the DefaultDomain and the main thread
- // Note that this has to be done before ExplicitBind() as it
- // affects the bind
- mdToken tkEntryPoint = pTempFile->GetEntryPointToken();
- // <TODO>@TODO: What if the entrypoint is in another file of the assembly?</TODO>
- ReleaseHolder<IMDInternalImport> scope(pTempFile->GetMDImportWithRef());
- // In theory, we should have a valid executable image and scope should never be NULL, but we've been
- // getting Watson failures for AVs here due to ISVs modifying image headers and some new OS loader
- // checks (see Dev10# 718530 and Windows 7# 615596)
- if (scope == NULL)
- {
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
-#ifdef FEATURE_COMINTEROP
- Thread::ApartmentState state = Thread::AS_Unknown;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef)) {
- if (scope->IsValidToken(tkEntryPoint))
- state = SystemDomain::GetEntryPointThreadAptState(scope, tkEntryPoint);
- else
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
- // If the entry point has an explicit thread apartment state, set it
- // before running the AppDomainManager initialization code.
- if (state == Thread::AS_InSTA || state == Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-#endif // FEATURE_COMINTEROP
-
- BOOL fSetGlobalSharePolicyUsingAttribute = FALSE;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef))
- {
- // The global share policy needs to be set before initializing default domain
- // so that it is in place for loading of appdomain manager.
- fSetGlobalSharePolicyUsingAttribute = SystemDomain::SetGlobalSharePolicyUsingAttribute(scope, tkEntryPoint);
- }
-
- // This can potentially run managed code.
- InitializeDefaultDomain(FALSE);
-
-#ifdef FEATURE_COMINTEROP
- // If we haven't set an explicit thread apartment state, set it after the
- // AppDomainManager has got a chance to go set it in InitializeNewDomain.
- if (state != Thread::AS_InSTA && state != Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-#endif // FEATURE_COMINTEROP
-
- if (fSetGlobalSharePolicyUsingAttribute)
- SystemDomain::System()->DefaultDomain()->SetupLoaderOptimization(g_dwGlobalSharePolicy);
-
- NewHolder<IPEFileSecurityDescriptor> pSecDesc(Security::CreatePEFileSecurityDescriptor(pDomain, pTempFile));
-
- {
- GCX_COOP();
- pSecDesc->Resolve();
- if (pSecDesc->AllowBindingRedirects())
- pDomain->TurnOnBindingRedirects();
- }
-
- PEAssemblyHolder pFile(pDomain->BindExplicitAssembly(hMod, TRUE));
-
- pDomain->m_pRootAssembly = GetAppDomain()->LoadAssembly(NULL, pFile, FILE_ACTIVE);
-
- {
- GCX_COOP();
-
- // Reuse the evidence that was generated for the PEFile for the assembly so we don't have to
- // regenerate evidence of the same type again if it is requested later.
- pDomain->m_pRootAssembly->GetSecurityDescriptor()->SetEvidenceFromPEFile(pSecDesc);
- }
-
- // If the AppDomainManager for the default domain was specified in the application config file then
- // we require that the assembly be trusted in order to set the manager
- if (pDomain->HasAppDomainManagerInfo() && pDomain->AppDomainManagerSetFromConfig())
- {
- Assembly *pEntryAssembly = pDomain->GetAppDomainManagerEntryAssembly();
- if (!pEntryAssembly->GetSecurityDescriptor()->AllowApplicationSpecifiedAppDomainManager())
- {
- COMPlusThrow(kTypeLoadException, IDS_E_UNTRUSTED_APPDOMAIN_MANAGER);
- }
- }
-
- if (CorCommandLine::m_pwszAppFullName == NULL) {
- StackSString friendlyName;
- StackSString assemblyPath = pFile->GetPath();
- SString::Iterator i = assemblyPath.End();
-
- if (PEAssembly::FindLastPathSeparator(assemblyPath, i)) {
- i++;
- friendlyName.Set(assemblyPath, i, assemblyPath.End());
- }
- else
- friendlyName.Set(assemblyPath);
-
- pDomain->SetFriendlyName(friendlyName, TRUE);
- }
- }
- __dcimf.Pop();
-
- {
- GCX_PREEMP();
-
- LOG((LF_CLASSLOADER | LF_CORDB,
- LL_INFO10,
- "Created domain for an executable at %p\n",
- (pDomain->m_pRootAssembly ? pDomain->m_pRootAssembly->Parent() : NULL)));
- TESTHOOKCALL(RuntimeStarted(RTS_CALLINGENTRYPOINT));
-
-#ifdef FEATURE_MULTICOREJIT
- pDomain->GetMulticoreJitManager().AutoStartProfile(pDomain);
-#endif
-
- pDomain->m_pRootAssembly->ExecuteMainMethod(NULL, TRUE /* waitForOtherThreads */);
- }
-
- pThread->ReturnToContext(&frame);
-
-#ifdef FEATURE_TESTHOOKS
- TESTHOOKCALL(LeftAppDomain(DefaultADID));
-#endif
-}
-#endif //!FEATURE_CORECLR
#ifdef FEATURE_CLICKONCE
void SystemDomain::ActivateApplication(int *pReturnValue)
@@ -3895,7 +3716,6 @@ Assembly *AppDomain::LoadAssemblyHelper(LPCWSTR wszAssembly,
#if defined(FEATURE_CLASSIC_COMINTEROP) && !defined(CROSSGEN_COMPILE)
-#ifdef FEATURE_CORECLR
MethodTable *AppDomain::LoadCOMClass(GUID clsid,
BOOL bLoadRecord/*=FALSE*/,
BOOL* pfAssemblyInReg/*=NULL*/)
@@ -3903,135 +3723,6 @@ MethodTable *AppDomain::LoadCOMClass(GUID clsid,
// @CORESYSTODO: what to do here?
return NULL;
}
-#else // FEATURE_CORECLR
-
-static BOOL IsSameRuntimeVersion(ICLRRuntimeInfo *pInfo1, ICLRRuntimeInfo *pInfo2)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- WCHAR wszVersion1[_MAX_PATH];
- WCHAR wszVersion2[_MAX_PATH];
- DWORD cchVersion;
-
- cchVersion = COUNTOF(wszVersion1);
- IfFailThrow(pInfo1->GetVersionString(wszVersion1, &cchVersion));
-
- cchVersion = COUNTOF(wszVersion2);
- IfFailThrow(pInfo2->GetVersionString(wszVersion2, &cchVersion));
-
- return SString::_wcsicmp(wszVersion1, wszVersion2) == 0;
-}
-
-MethodTable *AppDomain::LoadCOMClass(GUID clsid,
- BOOL bLoadRecord/*=FALSE*/,
- BOOL* pfAssemblyInReg/*=NULL*/)
-{
- CONTRACT (MethodTable*)
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- POSTCONDITION(CheckPointer(RETVAL, NULL_OK));
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACT_END;
-
-
- MethodTable* pMT = NULL;
-
- NewArrayHolder<WCHAR> wszClassName = NULL;
- NewArrayHolder<WCHAR> wszAssemblyString = NULL;
- NewArrayHolder<WCHAR> wszCodeBaseString = NULL;
-
- DWORD cbAssembly = 0;
- DWORD cbCodeBase = 0;
- Assembly *pAssembly = NULL;
- BOOL fFromRegistry = FALSE;
- BOOL fRegFreePIA = FALSE;
-
- HRESULT hr = S_OK;
-
- if (pfAssemblyInReg != NULL)
- *pfAssemblyInReg = FALSE;
-
- // with sxs.dll help
- hr = FindShimInfoFromWin32(clsid, bLoadRecord, NULL, NULL, &wszClassName, &wszAssemblyString, &fRegFreePIA);
-
- if(FAILED(hr))
- {
- hr = FindShimInfoFromRegistry(clsid, bLoadRecord, VER_ASSEMBLYMAJORVERSION, VER_ASSEMBLYMINORVERSION,
- &wszClassName, &wszAssemblyString, &wszCodeBaseString);
- if (FAILED(hr))
- RETURN NULL;
-
- fFromRegistry = TRUE;
- }
-
- // Skip the GetRuntimeForManagedCOMObject check for value types since they cannot be activated and are
- // always used for wrapping existing instances coming from COM.
- if (!bLoadRecord)
- {
- // We will load the assembly only if it is a PIA or if unmanaged activation would load the currently running
- // runtime. Otherwise we return NULL which will result in using the default System.__ComObject type.
-
- // the type is a PIA type if mscoree.dll is not its inproc server dll or it was specified as <clrSurrogate> in the manifest
- BOOL fPIA = (fFromRegistry ? !Clr::Util::Com::CLSIDHasMscoreeAsInprocServer32(clsid) : fRegFreePIA);
- if (!fPIA)
- {
- // this isn't a PIA, so we must determine which runtime it would load
- ReleaseHolder<ICLRRuntimeHostInternal> pRuntimeHostInternal;
- IfFailThrow(g_pCLRRuntime->GetInterface(CLSID_CLRRuntimeHostInternal,
- IID_ICLRRuntimeHostInternal,
- &pRuntimeHostInternal));
-
- // we call the shim to see which runtime would this be activated in
- ReleaseHolder<ICLRRuntimeInfo> pRuntimeInfo;
- if (FAILED(pRuntimeHostInternal->GetRuntimeForManagedCOMObject(clsid, IID_ICLRRuntimeInfo, &pRuntimeInfo)))
- {
- // the requested runtime is not loadable - don't load the assembly
- RETURN NULL;
- }
-
- if (!IsSameRuntimeVersion(g_pCLRRuntime, pRuntimeInfo))
- {
- // the requested runtime is different from this runtime - don't load the assembly
- RETURN NULL;
- }
- }
- }
-
- if (pfAssemblyInReg != NULL)
- *pfAssemblyInReg = TRUE;
-
- if (wszAssemblyString != NULL) {
- pAssembly = LoadAssemblyHelper(wszAssemblyString, wszCodeBaseString);
- pMT = TypeName::GetTypeFromAssembly(wszClassName, pAssembly).GetMethodTable();
- if (!pMT)
- goto ErrExit;
- }
-
- if (pMT == NULL) {
- ErrExit:
- // Convert the GUID to its string representation.
- WCHAR szClsid[64];
- if (GuidToLPWSTR(clsid, szClsid, NumItems(szClsid)) == 0)
- szClsid[0] = 0;
-
- // Throw an exception indicating we failed to load the type with
- // the requested CLSID.
- COMPlusThrow(kTypeLoadException, IDS_CLASSLOAD_NOCLSIDREG, szClsid);
- }
-
- RETURN pMT;
-}
-
-#endif // FEATURE_CORECLR
#endif // FEATURE_CLASSIC_COMINTEROP && !CROSSGEN_COMPILE
@@ -4078,17 +3769,6 @@ bool SystemDomain::IsReflectionInvocationMethod(MethodDesc* pMeth)
CLASS__ASSEMBLY,
CLASS__TYPE_DELEGATOR,
CLASS__RUNTIME_HELPERS,
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- CLASS__ITYPE,
- CLASS__IASSEMBLY,
- CLASS__IMETHODBASE,
- CLASS__IMETHODINFO,
- CLASS__ICONSTRUCTORINFO,
- CLASS__IFIELDINFO,
- CLASS__IPROPERTYINFO,
- CLASS__IEVENTINFO,
- CLASS__IAPPDOMAIN,
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
CLASS__LAZY_INITIALIZER,
CLASS__DYNAMICMETHOD,
CLASS__DELEGATE,
@@ -4838,15 +4518,6 @@ AppDomain::AppDomain()
m_pUnloadRequestThread = NULL;
m_ADUnloadSink=NULL;
-#ifndef FEATURE_CORECLR
- m_bUseOsSorting = RunningOnWin8();
- m_sortVersion = DEFAULT_SORT_VERSION;
- m_pCustomSortLibrary = NULL;
-#if _DEBUG
- m_bSortingInitialized = FALSE;
-#endif // _DEBUG
- m_pNlsHashProvider = NULL;
-#endif //!FEATURE_CORECLR
// Initialize Shared state. Assemblies are loaded
// into each domain by default.
@@ -4979,13 +4650,6 @@ AppDomain::~AppDomain()
if(!g_fEEInit)
Terminate();
-#ifndef FEATURE_CORECLR
- if (m_pCustomSortLibrary)
- delete m_pCustomSortLibrary;
-
- if (m_pNlsHashProvider)
- delete m_pNlsHashProvider;
-#endif
#ifdef FEATURE_REMOTING
@@ -5450,9 +5114,7 @@ void AppDomain::Terminate()
}
ShutdownAssemblies();
-#ifdef FEATURE_CORECLR
ShutdownNativeDllSearchDirectories();
-#endif
if (m_pRefClassFactHash)
{
@@ -5589,123 +5251,7 @@ OBJECTREF AppDomain::GetExposedObject()
return ref;
}
-#ifndef FEATURE_CORECLR
-void AppDomain::InitializeSorting(OBJECTREF* ppAppdomainSetup)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- THROWS;
- GC_NOTRIGGER;
- PRECONDITION(ppAppdomainSetup == NULL || IsProtectedByGCFrame(ppAppdomainSetup));
- }
- CONTRACTL_END;
-
- DWORD sortVersionFromConfig = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CompatSortNLSVersion);
-
- if(sortVersionFromConfig != 0)
- {
- m_bUseOsSorting = FALSE;
- m_sortVersion = sortVersionFromConfig;
- }
-
- if(ppAppdomainSetup != NULL)
- {
- APPDOMAINSETUPREF adSetup = (APPDOMAINSETUPREF) *ppAppdomainSetup;
- APPDOMAINSORTINGSETUPINFOREF sortingSetup = adSetup->GetAppDomainSortingSetupInfo();
-
- if(sortingSetup != NULL)
- {
- if(sortingSetup->UseV2LegacySorting() || sortingSetup->UseV4LegacySorting())
- {
-
- m_bUseOsSorting = FALSE;
-
- if(sortingSetup->UseV2LegacySorting())
- {
- m_sortVersion = SORT_VERSION_WHIDBEY;
- }
-
- if(sortingSetup->UseV4LegacySorting())
- {
- m_sortVersion = SORT_VERSION_V4;
- }
- }
- else if(sortingSetup->GetPFNIsNLSDefinedString() != NULL
- && sortingSetup->GetPFNCompareStringEx() != NULL
- && sortingSetup->GetPFNLCMapStringEx() != NULL
- && sortingSetup->GetPFNFindNLSStringEx() != NULL
- && sortingSetup->GetPFNCompareStringOrdinal() != NULL
- && sortingSetup->GetPFNGetNLSVersionEx() != NULL
- && sortingSetup->GetPFNFindStringOrdinal() != NULL)
- {
- m_pCustomSortLibrary = new COMNlsCustomSortLibrary;
- m_pCustomSortLibrary->pIsNLSDefinedString = (PFN_IS_NLS_DEFINED_STRING) sortingSetup->GetPFNIsNLSDefinedString();
- m_pCustomSortLibrary->pCompareStringEx = (PFN_COMPARE_STRING_EX) sortingSetup->GetPFNCompareStringEx();
- m_pCustomSortLibrary->pLCMapStringEx = (PFN_LC_MAP_STRING_EX) sortingSetup->GetPFNLCMapStringEx();
- m_pCustomSortLibrary->pFindNLSStringEx = (PFN_FIND_NLS_STRING_EX) sortingSetup->GetPFNFindNLSStringEx();
- m_pCustomSortLibrary->pCompareStringOrdinal = (PFN_COMPARE_STRING_ORDINAL) sortingSetup->GetPFNCompareStringOrdinal();
- m_pCustomSortLibrary->pGetNLSVersionEx = (PFN_GET_NLS_VERSION_EX) sortingSetup->GetPFNGetNLSVersionEx();
- m_pCustomSortLibrary->pFindStringOrdinal = (PFN_FIND_STRING_ORDINAL) sortingSetup->GetPFNFindStringOrdinal();
- }
- }
- }
-
- if(m_bUseOsSorting == FALSE && m_sortVersion == DEFAULT_SORT_VERSION)
- {
- // If we are using the legacy sorting dlls, the default version for sorting is SORT_VERSION_V4. Note that
- // we don't expect this to change in the future (even when V5 or V6 of the runtime comes out).
- m_sortVersion = SORT_VERSION_V4;
- }
-
- if(RunningOnWin8() && m_bUseOsSorting == FALSE)
- {
- // We need to ensure that the versioned sort DLL could load so we don't crash later. This ensures we have
- // the same behavior as Windows 7, where even if we couldn't load the correct versioned sort dll, we would
- // provide the default sorting behavior.
- INT_PTR sortOrigin;
- if(COMNlsInfo::InternalInitVersionedSortHandle(W(""), &sortOrigin, m_sortVersion) == NULL)
- {
- LOG((LF_APPDOMAIN, LL_WARNING, "AppDomain::InitializeSorting failed to load legacy sort DLL for AppDomain.\n"));
- // We couldn't load a sort DLL. Fall back to default sorting using the OS.
- m_bUseOsSorting = TRUE;
- m_sortVersion = DEFAULT_SORT_VERSION;
- }
- }
-
-#if _DEBUG
- m_bSortingInitialized = TRUE;
-#endif
-}
-#endif
-
-#ifndef FEATURE_CORECLR
-void AppDomain::InitializeHashing(OBJECTREF* ppAppdomainSetup)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- THROWS;
- GC_NOTRIGGER;
- PRECONDITION(ppAppdomainSetup == NULL || IsProtectedByGCFrame(ppAppdomainSetup));
- }
- CONTRACTL_END;
-
- m_pNlsHashProvider = new COMNlsHashProvider;
-#ifdef FEATURE_RANDOMIZED_STRING_HASHING
- BOOL fUseRandomizedHashing = (BOOL) CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_UseRandomizedStringHashAlgorithm);
-
- if(ppAppdomainSetup != NULL)
- {
- APPDOMAINSETUPREF adSetup = (APPDOMAINSETUPREF) *ppAppdomainSetup;
- fUseRandomizedHashing |= adSetup->UseRandomizedStringHashing();
- }
-
- m_pNlsHashProvider->SetUseRandomHashing(fUseRandomizedHashing);
-#endif // FEATURE_RANDOMIZED_STRING_HASHING
-}
-#endif // FEATURE_CORECLR
OBJECTREF AppDomain::DoSetup(OBJECTREF* setupInfo)
{
@@ -5949,11 +5495,7 @@ bool IsPlatformAssembly(LPCSTR szName, DomainAssembly *pDomainAssembly)
return false;
}
-#ifdef FEATURE_CORECLR
return StrongNameIsSilverlightPlatformKey(pbPublicKey, cbPublicKey);
-#else
- return StrongNameIsEcmaKey(pbPublicKey, cbPublicKey);
-#endif
}
void AppDomain::AddAssembly(DomainAssembly * assem)
@@ -6047,54 +5589,6 @@ BOOL AppDomain::HasSetSecurityPolicy()
RETURN ((APPDOMAINREF)GetExposedObject())->HasSetPolicy();
}
-#if defined (FEATURE_LOADER_OPTIMIZATION) && !defined(FEATURE_CORECLR)
-// Returns true if the user has declared the desire to load an
-// assembly domain-neutral. This is either by specifying System.LoaderOptimizationAttribute
-// on the entry routine or the host has set this loader-optimization flag.
-BOOL AppDomain::ApplySharePolicy(DomainAssembly *pFile)
-{
- CONTRACT(BOOL)
- {
- PRECONDITION(CheckPointer(pFile));
- THROWS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACT_END;
-
- if (!pFile->GetFile()->IsShareable())
- RETURN FALSE;
-
- if (ApplySharePolicyFlag(pFile))
- RETURN TRUE;
-
- RETURN FALSE;
-}
-
-BOOL AppDomain::ApplySharePolicyFlag(DomainAssembly *pFile)
-{
- CONTRACT(BOOL)
- {
- PRECONDITION(CheckPointer(pFile));
- THROWS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACT_END;
-
- switch(GetSharePolicy()) {
- case SHARE_POLICY_ALWAYS:
- RETURN (!pFile->MayHaveUnknownDependencies());
-
- case SHARE_POLICY_GAC:
- RETURN (pFile->IsClosedInGAC());
-
- case SHARE_POLICY_NEVER:
- RETURN pFile->IsSystem();
-
- default:
- UNREACHABLE_MSG("Unknown share policy");
- }
-}
-#endif // FEATURE_LOADER_OPTIMIZATION
EEClassFactoryInfoHashTable* AppDomain::SetupClassFactHash()
{
@@ -6714,7 +6208,6 @@ DomainAssembly* AppDomain::LoadDomainAssembly( AssemblySpec* pSpec,
Exception* pEx=GET_EXCEPTION();
if (!pEx->IsTransient())
{
-#if defined(FEATURE_CORECLR)
// Setup the binder reference in AssemblySpec from the PEAssembly if one is not already set.
ICLRPrivBinder* pCurrentBindingContext = pSpec->GetBindingContext();
ICLRPrivBinder* pBindingContextFromPEAssembly = pFile->GetBindingContext();
@@ -6733,7 +6226,6 @@ DomainAssembly* AppDomain::LoadDomainAssembly( AssemblySpec* pSpec,
_ASSERTE(AreSameBinderInstance(pCurrentBindingContext, pBindingContextFromPEAssembly));
}
#endif // _DEBUG
-#endif // defined(FEATURE_CORECLR)
if (!EEFileLoadException::CheckType(pEx))
{
@@ -7152,16 +6644,6 @@ void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, F
EX_TRY
{
-#ifndef FEATURE_CORECLR
- // Event Tracing for Windows is used to log data for performance and functional testing purposes.
- // The events below are used to measure the performance of two steps in the assembly loader, namely assembly initialization and delivering events.
- StackSString ETWAssemblySimpleName;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD))
- {
- LPCUTF8 simpleName = pFile->GetSimpleName();
- ETWAssemblySimpleName.AppendUTF8(simpleName ? simpleName : "NULL"); // Gather data used by ETW events later in this function.
- }
-#endif // FEATURE_CORECLR
// Special case: for LoadLibrary, we cannot hold the lock during the
// actual LoadLibrary call, because we might get a callback from _CorDllMain on any
@@ -7172,28 +6654,10 @@ void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, F
lockHolder.Release();
released = TRUE;
}
-#ifndef FEATURE_CORECLR
- else if (workLevel == FILE_LOAD_DELIVER_EVENTS)
- {
- FireEtwLoaderDeliverEventsPhaseStart(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
- }
-#endif // FEATURE_CORECLR
// Do the work
TESTHOOKCALL(NextFileLoadLevel(GetId().m_dwId,pFile,workLevel));
-#ifndef FEATURE_CORECLR
- if (workLevel == FILE_LOAD_ALLOCATE)
- {
- FireEtwLoaderAssemblyInitPhaseStart(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
- }
-#endif // FEATURE_CORECLR
BOOL success = pFile->DoIncrementalLoad(workLevel);
-#ifndef FEATURE_CORECLR
- if (workLevel == FILE_LOAD_ALLOCATE)
- {
- FireEtwLoaderAssemblyInitPhaseEnd(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
- }
-#endif // FEATURE_CORECLR
TESTHOOKCALL(CompletingFileLoadLevel(GetId().m_dwId,pFile,workLevel));
if (released)
{
@@ -7216,9 +6680,6 @@ void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, F
lockHolder.Release();
released = TRUE;
pFile->DeliverAsyncEvents();
-#ifndef FEATURE_CORECLR
- FireEtwLoaderDeliverEventsPhaseEnd(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
-#endif // FEATURE_CORECLR
};
}
}
@@ -7489,7 +6950,6 @@ AppDomain::SharePolicy AppDomain::GetSharePolicy()
#endif // FEATURE_LOADER_OPTIMIZATION
-#ifdef FEATURE_CORECLR
void AppDomain::CheckForMismatchedNativeImages(AssemblySpec * pSpec, const GUID * pGuid)
{
STANDARD_VM_CONTRACT;
@@ -7555,7 +7015,6 @@ void AppDomain::CheckForMismatchedNativeImages(AssemblySpec * pSpec, const GUID
amTracker.SuppressRelease();
}
}
-#endif // FEATURE_CORECLR
void AppDomain::SetupSharedStatics()
@@ -8097,13 +7556,11 @@ BOOL AppDomain::IsCached(AssemblySpec *pSpec)
return m_AssemblyCache.Contains(pSpec);
}
-#ifdef FEATURE_CORECLR
void AppDomain::GetCacheAssemblyList(SetSHash<PTR_DomainAssembly>& assemblyList)
{
CrstHolder holder(&m_DomainCacheCrst);
m_AssemblyCache.GetAllAssemblies(assemblyList);
}
-#endif
PEAssembly* AppDomain::FindCachedFile(AssemblySpec* pSpec, BOOL fThrow /*=TRUE*/)
{
@@ -8886,12 +8343,10 @@ EndTry2:;
}
fAddFileToCache = true;
-#if defined(FEATURE_CORECLR)
// Setup the reference to the binder, which performed the bind, into the AssemblySpec
ICLRPrivBinder* pBinder = result->GetBindingContext();
_ASSERTE(pBinder != NULL);
pSpec->SetBindingContext(pBinder);
-#endif // defined(FEATURE_CORECLR)
}
#endif //!FEATURE_FUSION
@@ -9568,13 +9023,6 @@ BOOL AppDomain::OnUnhandledException(OBJECTREF *pThrowable, BOOL isTerminating/*
orSender = pAppDomain->GetRawExposedObject();
retVal = pAppDomain->RaiseUnhandledExceptionEventNoThrow(&orSender, pThrowable, isTerminating);
-#ifndef FEATURE_CORECLR
-// CoreCLR#520:
-// To make this work correctly we need the changes for coreclr 473
- if (pAppDomain != SystemDomain::System()->DefaultDomain())
- retVal |= SystemDomain::System()->DefaultDomain()->RaiseUnhandledExceptionEventNoThrow
- (&orSender, pThrowable, isTerminating);
-#endif
GCPROTECT_END();
@@ -9670,54 +9118,6 @@ void AppDomain::RaiseExitProcessEvent()
}
}
-#ifndef FEATURE_CORECLR
-void AppDomain::RaiseUnhandledExceptionEvent_Wrapper(LPVOID ptr)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- INJECT_FAULT(COMPlusThrowOM(););
- SO_INTOLERANT;
- }
- CONTRACTL_END;
- AppDomain::RaiseUnhandled_Args *args = (AppDomain::RaiseUnhandled_Args *) ptr;
-
- struct _gc {
- OBJECTREF orThrowable;
- OBJECTREF orSender;
- } gc;
-
- ZeroMemory(&gc, sizeof(gc));
-
- _ASSERTE(args->pTargetDomain == GetAppDomain());
- GCPROTECT_BEGIN(gc);
- EX_TRY
- {
- SetObjectReference(&gc.orThrowable,
- AppDomainHelper::CrossContextCopyFrom(args->pExceptionDomain,
- args->pThrowable),
- args->pTargetDomain);
-
- SetObjectReference(&gc.orSender,
- AppDomainHelper::CrossContextCopyFrom(args->pExceptionDomain,
- args->pSender),
- args->pTargetDomain);
- }
- EX_CATCH
- {
- SetObjectReference(&gc.orThrowable, GET_THROWABLE(), args->pTargetDomain);
- SetObjectReference(&gc.orSender, GetAppDomain()->GetRawExposedObject(), args->pTargetDomain);
- }
- EX_END_CATCH(SwallowAllExceptions)
- *(args->pResult) = args->pTargetDomain->RaiseUnhandledExceptionEvent(&gc.orSender,
- &gc.orThrowable,
- args->isTerminating);
- GCPROTECT_END();
-
-}
-#endif //!FEATURE_CORECLR
BOOL
AppDomain::RaiseUnhandledExceptionEventNoThrow(OBJECTREF *pSender, OBJECTREF *pThrowable, BOOL isTerminating)
@@ -9780,18 +9180,7 @@ AppDomain::RaiseUnhandledExceptionEvent(OBJECTREF *pSender, OBJECTREF *pThrowabl
_ASSERTE(pThrowable != NULL && IsProtectedByGCFrame(pThrowable));
_ASSERTE(pSender != NULL && IsProtectedByGCFrame(pSender));
-#ifndef FEATURE_CORECLR
- Thread *pThread = GetThread();
- if (this != pThread->GetDomain())
- {
- RaiseUnhandled_Args args = {pThread->GetDomain(), this, pSender, pThrowable, isTerminating, &result};
- // call through DoCallBack with a domain transition
- pThread->DoADCallBack(this, AppDomain::RaiseUnhandledExceptionEvent_Wrapper, &args, ADV_DEFAULTAD);
- return result;
- }
-#else
_ASSERTE(this == GetThread()->GetDomain());
-#endif
OBJECTREF orDelegate = NULL;
@@ -9814,48 +9203,6 @@ AppDomain::RaiseUnhandledExceptionEvent(OBJECTREF *pSender, OBJECTREF *pThrowabl
}
-#ifndef FEATURE_CORECLR
-// Create a domain based on a string name
-AppDomain* AppDomain::CreateDomainContext(LPCWSTR fileName)
-{
- CONTRACTL
- {
- THROWS;
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- if(fileName == NULL) return NULL;
-
- AppDomain* pDomain = NULL;
-
- MethodDescCallSite valCreateDomain(METHOD__APP_DOMAIN__VAL_CREATE_DOMAIN);
-
- STRINGREF pFilePath = NULL;
- GCPROTECT_BEGIN(pFilePath);
- pFilePath = StringObject::NewString(fileName);
-
- ARG_SLOT args[1] =
- {
- ObjToArgSlot(pFilePath),
- };
-
- APPDOMAINREF pDom = (APPDOMAINREF) valCreateDomain.Call_RetOBJECTREF(args);
- if(pDom != NULL)
- {
- Context* pContext = Context::GetExecutionContext(pDom);
- if(pContext)
- {
- pDomain = pContext->GetDomain();
- }
- }
- GCPROTECT_END();
-
- return pDomain;
-}
-#endif // !FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
@@ -9909,28 +9256,6 @@ void AppDomain::InitializeDomainContext(BOOL allowRedirects,
gc.pConfig = StringObject::NewString(pwszConfig);
}
-#ifndef FEATURE_CORECLR
- StringArrayList *pPropertyNames;
- StringArrayList *pPropertyValues;
- CorHost2::GetDefaultAppDomainProperties(&pPropertyNames, &pPropertyValues);
-
- _ASSERTE(pPropertyNames->GetCount() == pPropertyValues->GetCount());
-
- if (pPropertyNames->GetCount() > 0)
- {
- gc.propertyNames = (PTRARRAYREF)AllocateObjectArray(pPropertyNames->GetCount(), g_pStringClass);
- gc.propertyValues = (PTRARRAYREF)AllocateObjectArray(pPropertyValues->GetCount(), g_pStringClass);
-
- for (DWORD i = 0; i < pPropertyNames->GetCount(); ++i)
- {
- STRINGREF propertyName = StringObject::NewString(pPropertyNames->Get(i));
- gc.propertyNames->SetAt(i, propertyName);
-
- STRINGREF propertyValue = StringObject::NewString(pPropertyValues->Get(i));
- gc.propertyValues->SetAt(i, propertyValue);
- }
- }
-#endif // !FEATURE_CORECLR
if ((gc.ref = GetExposedObject()) != NULL)
{
@@ -9998,23 +9323,6 @@ IApplicationContext *AppDomain::CreateFusionContext()
IfFailThrow(FusionBind::CreateFusionContext(NULL, &pFusionContext));
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- CLRPrivBinderWinRT * pWinRtBinder;
- if (AppX::IsAppXProcess())
- { // Note: Fusion binder is used in AppX to bind .NET Fx assemblies - some of them depend on .winmd files (e.g. System.Runtime.WindowsRuntime.dll)
- CLRPrivBinderAppX * pAppXBinder = CLRPrivBinderAppX::GetOrCreateBinder();
- pWinRtBinder = pAppXBinder->GetWinRtBinder();
- }
- else
- {
- pWinRtBinder = m_pWinRtBinder;
- }
- _ASSERTE(pWinRtBinder != nullptr);
-
- IfFailThrow(SetApplicationContext_WinRTBinder(
- pFusionContext,
- static_cast<IBindContext *>(pWinRtBinder)));
-#endif
#ifdef FEATURE_PREJIT
if (NGENImagesAllowed())
@@ -12587,13 +11895,6 @@ AppDomain::RaiseAssemblyResolveEvent(
{
if (pSpec->GetParentAssembly() != NULL)
{
-#ifndef FEATURE_CORECLR
- if ( pSpec->IsIntrospectionOnly()
-#ifdef FEATURE_FUSION
- || pSpec->GetParentLoadContext() == LOADCTX_TYPE_UNKNOWN
-#endif
- )
-#endif // FEATURE_CORECLR
{
gc.AssemblyRef=pSpec->GetParentAssembly()->GetExposedAssemblyObject();
}
@@ -12636,68 +11937,6 @@ AppDomain::RaiseAssemblyResolveEvent(
RETURN pAssembly;
} // AppDomain::RaiseAssemblyResolveEvent
-#ifndef FEATURE_CORECLR
-
-//---------------------------------------------------------------------------------------
-//
-// Ask the AppDomainManager for the entry assembly of the application
-//
-// Note:
-// Most AppDomainManagers will fall back on the root assembly for the domain, so we need
-// to make sure this is set before we call through to the AppDomainManager itself.
-//
-
-Assembly *AppDomain::GetAppDomainManagerEntryAssembly()
-{
- CONTRACT(Assembly *)
- {
- STANDARD_VM_CHECK;
- PRECONDITION(HasAppDomainManagerInfo());
- PRECONDITION(CheckPointer(m_pRootAssembly));
- POSTCONDITION(CheckPointer(RETVAL));
- }
- CONTRACT_END;
-
- GCX_COOP();
-
- Assembly *pEntryAssembly = NULL;
-
- struct
- {
- APPDOMAINREF orDomain;
- OBJECTREF orAppDomainManager;
- ASSEMBLYREF orEntryAssembly;
- }
- gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
-
- gc.orDomain = static_cast<APPDOMAINREF>(GetExposedObject());
- gc.orAppDomainManager = gc.orDomain->GetAppDomainManager();
- _ASSERTE(gc.orAppDomainManager != NULL);
-
- MethodDescCallSite getEntryAssembly(METHOD__APPDOMAIN_MANAGER__GET_ENTRY_ASSEMBLY, &gc.orAppDomainManager);
- ARG_SLOT argThis = ObjToArgSlot(gc.orAppDomainManager);
- gc.orEntryAssembly = static_cast<ASSEMBLYREF>(getEntryAssembly.Call_RetOBJECTREF(&argThis));
-
- if (gc.orEntryAssembly != NULL)
- {
- pEntryAssembly = gc.orEntryAssembly->GetAssembly();
- }
-
- GCPROTECT_END();
-
- // If the AppDomainManager did not return an entry assembly, we'll assume the default assembly
- if (pEntryAssembly == NULL)
- {
- pEntryAssembly = m_pRootAssembly;
- }
-
- RETURN(pEntryAssembly);
-}
-
-#endif // !FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -12740,45 +11979,6 @@ void AppDomain::InitializeDefaultDomainManager()
LOG((LF_APPDOMAIN, LL_INFO10, "Setting default AppDomainManager '%S', '%S' from hosting API.\n", GetAppDomainManagerAsm(), GetAppDomainManagerType()));
}
-#ifndef FEATURE_CORECLR
- else
- {
- CLRConfigStringHolder wszConfigAppDomainManagerAssembly(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_AppDomainManagerAsm));
- CLRConfigStringHolder wszConfigAppDomainManagerType(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_AppDomainManagerType));
-
- if (wszConfigAppDomainManagerAssembly != NULL &&
- wszConfigAppDomainManagerType != NULL)
- {
- SetAppDomainManagerInfo(wszConfigAppDomainManagerAssembly,
- wszConfigAppDomainManagerType,
- eInitializeNewDomainFlags_None);
- m_fAppDomainManagerSetInConfig = TRUE;
-
- LOG((LF_APPDOMAIN, LL_INFO10, "Setting default AppDomainManager '%S', '%S' from application config file.\n", GetAppDomainManagerAsm(), GetAppDomainManagerType()));
- }
- else
- {
- CLRConfigStringHolder wszEnvironmentAppDomainManagerAssembly(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_ASM));
- CLRConfigStringHolder wszEnvironmentAppDomainManagerType(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_TYPE));
-
- if (wszEnvironmentAppDomainManagerAssembly != NULL &&
- wszEnvironmentAppDomainManagerType != NULL)
- {
- SetAppDomainManagerInfo(wszEnvironmentAppDomainManagerAssembly,
- wszEnvironmentAppDomainManagerType,
- eInitializeNewDomainFlags_None);
- m_fAppDomainManagerSetInConfig = FALSE;
-
- LOG((LF_APPDOMAIN, LL_INFO10, "Setting default AppDomainManager '%S', '%S' from environment variables.\n", GetAppDomainManagerAsm(), GetAppDomainManagerType()));
-
- // Reset the environmetn variables so that child processes do not inherit our domain manager
- // by default.
- WszSetEnvironmentVariable(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_ASM.name, NULL);
- WszSetEnvironmentVariable(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_TYPE.name, NULL);
- }
- }
- }
-#endif // !FEATURE_CORECLR
// If we found an AppDomain manager to use, create and initialize it
// Otherwise, initialize the config flags.
@@ -12962,11 +12162,9 @@ void AppDomain::CreateADUnloadWorker()
{
STANDARD_VM_CONTRACT;
-#ifdef FEATURE_CORECLR
// Do not create adUnload thread if there is only default domain
if(IsSingleAppDomain())
return;
-#endif
Retry:
BOOL fCreator = FALSE;
@@ -13820,95 +13018,6 @@ PTR_MethodTable BaseDomain::LookupType(UINT32 id) {
#ifndef DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
-//------------------------------------------------------------------------
-DWORD* SetupCompatibilityFlags()
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- } CONTRACTL_END;
-
- LPCWSTR buf;
- bool return_null = true;
-
- FAULT_NOT_FATAL(); // we can simply give up
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return NULL;)
- InlineSString<4> bufString;
-
- if (WszGetEnvironmentVariable(W("UnsupportedCompatSwitchesEnabled"), bufString) != 0)
- {
- buf = bufString.GetUnicode();
- if (buf[0] != '1' || buf[1] != '\0')
- {
- return_null = true;
- }
- else
- {
- return_null = false;
- }
-
- }
- END_SO_INTOLERANT_CODE
-
- if (return_null)
- return NULL;
-
- static const LPCWSTR rgFlagNames[] = {
-#define COMPATFLAGDEF(name) TEXT(#name),
-#include "compatibilityflagsdef.h"
- };
-
- int size = (compatCount+31) / 32;
- DWORD* pFlags = new (nothrow) DWORD[size];
- if (pFlags == NULL)
- return NULL;
- ZeroMemory(pFlags, size * sizeof(DWORD));
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return NULL;)
- InlineSString<4> bufEnvString;
- for (int i = 0; i < COUNTOF(rgFlagNames); i++)
- {
- if (WszGetEnvironmentVariable(rgFlagNames[i], bufEnvString) == 0)
- continue;
-
- buf = bufEnvString.GetUnicode();
- if (buf[0] != '1' || buf[1] != '\0')
- continue;
-
- pFlags[i / 32] |= 1 << (i % 32);
- }
- END_SO_INTOLERANT_CODE
-
- return pFlags;
-}
-
-//------------------------------------------------------------------------
-static VolatilePtr<DWORD> g_pCompatibilityFlags = (DWORD*)(-1);
-
-DWORD* GetGlobalCompatibilityFlags()
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- } CONTRACTL_END;
-
- if (g_pCompatibilityFlags == (DWORD*)(-1))
- {
- DWORD *pCompatibilityFlags = SetupCompatibilityFlags();
-
- if (FastInterlockCompareExchangePointer(g_pCompatibilityFlags.GetPointer(), pCompatibilityFlags, reinterpret_cast<DWORD *>(-1)) != (VOID*)(-1))
- {
- delete [] pCompatibilityFlags;
- }
- }
-
- return g_pCompatibilityFlags;
-}
-#endif // !FEATURE_CORECLR
//------------------------------------------------------------------------
BOOL GetCompatibilityFlag(CompatibilityFlag flag)
@@ -13919,16 +13028,7 @@ BOOL GetCompatibilityFlag(CompatibilityFlag flag)
SO_TOLERANT;
} CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- DWORD *pFlags = GetGlobalCompatibilityFlags();
-
- if (pFlags != NULL)
- return (pFlags[flag / 32] & (1 << (flag % 32))) ? TRUE : FALSE;
- else
- return FALSE;
-#else // !FEATURE_CORECLR
return FALSE;
-#endif // !FEATURE_CORECLR
}
#endif // !DACCESS_COMPILE
@@ -14127,7 +13227,6 @@ AppDomain::AssemblyIterator::Next_UnsafeNoAddRef(
return FALSE;
} // AppDomain::AssemblyIterator::Next_UnsafeNoAddRef
-#ifdef FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -14165,7 +13264,6 @@ BOOL AppDomain::IsImageFullyTrusted(PEImage* pPEImage)
return IsImageFromTrustedPath(pPEImage);
}
-#endif //FEATURE_CORECLR
#endif //!DACCESS_COMPILE
@@ -14850,7 +13948,7 @@ void AppDomain::UnPublishHostedAssembly(
}
}
-#if defined(FEATURE_CORECLR) && defined(FEATURE_COMINTEROP)
+#if defined(FEATURE_COMINTEROP)
HRESULT AppDomain::SetWinrtApplicationContext(SString &appLocalWinMD)
{
STANDARD_VM_CONTRACT;
@@ -14904,7 +14002,7 @@ PTR_DomainAssembly AppDomain::FindAssembly(PTR_ICLRPrivAssembly pHostAssembly)
}
}
-#if !defined(DACCESS_COMPILE) && defined(FEATURE_CORECLR) && defined(FEATURE_NATIVE_IMAGE_GENERATION)
+#if !defined(DACCESS_COMPILE) && defined(FEATURE_NATIVE_IMAGE_GENERATION)
void ZapperSetBindingPaths(ICorCompilationDomain *pDomain, SString &trustedPlatformAssemblies, SString &platformResourceRoots, SString &appPaths, SString &appNiPaths)
{
@@ -14919,7 +14017,7 @@ void ZapperSetBindingPaths(ICorCompilationDomain *pDomain, SString &trustedPlatf
#endif
-#if defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
+#if !defined(CROSSGEN_COMPILE)
bool IsSingleAppDomain()
{
STARTUP_FLAGS flags = CorHost2::GetStartupFlags();
diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp
index 670f685fdc..0e7ab65e63 100644
--- a/src/vm/appdomain.hpp
+++ b/src/vm/appdomain.hpp
@@ -42,10 +42,6 @@
#ifdef FEATURE_COMINTEROP
#include "clrprivbinderwinrt.h"
-#ifndef FEATURE_CORECLR
-#include "clrprivbinderreflectiononlywinrt.h"
-#include "clrprivtypecachereflectiononlywinrt.h"
-#endif
#include "..\md\winmd\inc\adapter.h"
#include "winrttypenameconverter.h"
#endif // FEATURE_COMINTEROP
@@ -1988,13 +1984,8 @@ public:
inline LPCWSTR GetAppDomainManagerType();
inline EInitializeNewDomainFlags GetAppDomainManagerInitializeNewDomainFlags();
-#ifndef FEATURE_CORECLR
- inline BOOL AppDomainManagerSetFromConfig();
- Assembly *GetAppDomainManagerEntryAssembly();
- void ComputeTargetFrameworkName();
-#endif // FEATURE_CORECLR
-#if defined(FEATURE_CORECLR) && defined(FEATURE_COMINTEROP)
+#if defined(FEATURE_COMINTEROP)
HRESULT SetWinrtApplicationContext(SString &appLocalWinMD);
#endif // FEATURE_CORECLR && FEATURE_COMINTEROP
@@ -2032,10 +2023,6 @@ public:
virtual BOOL IsAppDomain() { LIMITED_METHOD_DAC_CONTRACT; return TRUE; }
virtual PTR_AppDomain AsAppDomain() { LIMITED_METHOD_CONTRACT; return dac_cast<PTR_AppDomain>(this); }
-#ifndef FEATURE_CORECLR
- void InitializeSorting(OBJECTREF* ppAppdomainSetup);
- void InitializeHashing(OBJECTREF* ppAppdomainSetup);
-#endif
OBJECTREF DoSetup(OBJECTREF* setupInfo);
@@ -2290,7 +2277,6 @@ public:
return AssemblyIterator::Create(this, assemblyIterationFlags);
}
-#ifdef FEATURE_CORECLR
private:
struct NativeImageDependenciesEntry
{
@@ -2346,7 +2332,6 @@ public:
void SetNativeDllSearchDirectories(LPCWSTR paths);
BOOL HasNativeDllSearchDirectories();
void ShutdownNativeDllSearchDirectories();
-#endif // FEATURE_CORECLR
public:
SIZE_T GetAssemblyCount()
@@ -2485,10 +2470,6 @@ public:
//****************************************************************************************
// Determines if the image is to be loaded into the shared assembly or an individual
// appdomains.
-#ifndef FEATURE_CORECLR
- BOOL ApplySharePolicy(DomainAssembly *pFile);
- BOOL ApplySharePolicyFlag(DomainAssembly *pFile);
-#endif
#endif // FEATURE_LOADER_OPTIMIZATION
BOOL HasSetSecurityPolicy();
@@ -3480,9 +3461,6 @@ private:
BOOL isTerminating;
BOOL *pResult;
};
- #ifndef FEATURE_CORECLR
- static void RaiseUnhandledExceptionEvent_Wrapper(LPVOID /* RaiseUnhandled_Args * */);
- #endif
static void AllowThreadEntrance(AppDomain *pApp);
@@ -3843,11 +3821,9 @@ public:
ILLEGAL_VERIFICATION_DOMAIN = 0x8000, // This can't be a verification domain
IGNORE_UNHANDLED_EXCEPTIONS = 0x10000, // AppDomain was created using the APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS flag
ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x20000, // AppDomain was created using the APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP flag
-#ifdef FEATURE_CORECLR
ENABLE_SKIP_PLAT_CHECKS = 0x200000, // Skip various assembly checks (like platform check)
ENABLE_ASSEMBLY_LOADFILE = 0x400000, // Allow Assembly.LoadFile in CoreCLR
DISABLE_TRANSPARENCY_ENFORCEMENT= 0x800000, // Disable enforcement of security transparency rules
-#endif
};
SecurityContext *m_pSecContext;
@@ -3861,9 +3837,7 @@ public:
BOOL m_fAppDomainManagerSetInConfig;
EInitializeNewDomainFlags m_dwAppDomainManagerInitializeDomainFlags;
-#ifdef FEATURE_CORECLR
ArrayList m_NativeDllSearchDirectories;
-#endif
BOOL m_ReversePInvokeCanEnter;
bool m_ForceTrivialWaitOperations;
// Section to support AD unload due to escalation
@@ -3891,10 +3865,8 @@ public:
return (m_Stage == STAGE_UNLOAD_REQUESTED);
}
-#ifdef FEATURE_CORECLR
BOOL IsImageFromTrustedPath(PEImage* pImage);
BOOL IsImageFullyTrusted(PEImage* pImage);
-#endif
#ifdef FEATURE_TYPEEQUIVALENCE
private:
@@ -3941,15 +3913,6 @@ private:
#endif //FEATURE_COMINTEROP
public:
-#ifndef FEATURE_CORECLR
- BOOL m_bUseOsSorting;
- DWORD m_sortVersion;
- COMNlsCustomSortLibrary *m_pCustomSortLibrary;
-#if _DEBUG
- BOOL m_bSortingInitialized;
-#endif // _DEBUG
- COMNlsHashProvider *m_pNlsHashProvider;
-#endif // !FEATURE_CORECLR
private:
// This is the root-level default load context root binder. If null, then
@@ -4367,9 +4330,6 @@ public:
}
#endif // DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
- static void ExecuteMainMethod(HMODULE hMod, __in_opt LPWSTR path = NULL);
-#endif
static void ActivateApplication(int *pReturnValue);
static void InitializeDefaultDomain(BOOL allowRedirects, ICLRPrivBinder * pBinder = NULL);
diff --git a/src/vm/appdomain.inl b/src/vm/appdomain.inl
index 210334c78e..2986588ddc 100644
--- a/src/vm/appdomain.inl
+++ b/src/vm/appdomain.inl
@@ -231,13 +231,6 @@ inline LPCWSTR AppDomain::GetAppDomainManagerType()
return m_AppDomainManagerType;
}
-#ifndef FEATURE_CORECLR
-inline BOOL AppDomain::AppDomainManagerSetFromConfig()
-{
- WRAPPER_NO_CONTRACT;
- return m_fAppDomainManagerSetInConfig;
-}
-#endif // !FEATURE_CORECLR
inline EInitializeNewDomainFlags AppDomain::GetAppDomainManagerInitializeNewDomainFlags()
{
@@ -245,7 +238,6 @@ inline EInitializeNewDomainFlags AppDomain::GetAppDomainManagerInitializeNewDoma
return m_dwAppDomainManagerInitializeDomainFlags;
}
-#ifdef FEATURE_CORECLR
inline AppDomain::PathIterator AppDomain::IterateNativeDllSearchDirectories()
{
WRAPPER_NO_CONTRACT;
@@ -260,7 +252,6 @@ inline BOOL AppDomain::HasNativeDllSearchDirectories()
return m_NativeDllSearchDirectories.GetCount() !=0;
}
-#endif // FEATURE_CORECLR
inline BOOL AppDomain::CanReversePInvokeEnter()
{
diff --git a/src/vm/appdomainnative.cpp b/src/vm/appdomainnative.cpp
index 9266849be4..02e96e2286 100644
--- a/src/vm/appdomainnative.cpp
+++ b/src/vm/appdomainnative.cpp
@@ -16,9 +16,6 @@
#include "eeconfig.h"
#include "appdomain.inl"
#include "eventtrace.h"
-#ifndef FEATURE_CORECLR
-#include "comutilnative.h"
-#endif // !FEATURE_CORECLR
#if defined(FEATURE_APPX)
#include "appxutil.h"
#endif // FEATURE_APPX
@@ -177,12 +174,6 @@ void AppDomainNative::CreateDomainHelper (STRINGREF* ppFriendlyName, OBJECTREF*
setupInfo = prepareDataForSetup.Call_RetOBJECTREF(args);
-#ifndef FEATURE_CORECLR
- // We need to setup domain sorting before any other managed code runs in the domain, since that code
- // could end up caching data based on the sorting mode of the domain.
- pDomain->InitializeSorting(ppAppdomainSetup);
- pDomain->InitializeHashing(ppAppdomainSetup);
-#endif
// We need to ensure that the AppDomainProxy is generated before we call into DoSetup, since
// GetAppDomainProxy will ensure that remoting is correctly configured in the domain. DoSetup can
@@ -1341,7 +1332,6 @@ FCIMPL1(void , AppDomainNative::PublishAnonymouslyHostedDynamicMethodsAssembly,
}
FCIMPLEND
-#ifdef FEATURE_CORECLR
void QCALLTYPE AppDomainNative::SetNativeDllSearchDirectories(__in_z LPCWSTR wszNativeDllSearchDirectories)
{
@@ -1398,7 +1388,6 @@ void QCALLTYPE AppDomainNative::SetNativeDllSearchDirectories(__in_z LPCWSTR wsz
END_QCALL;
}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
FCIMPL0(void, AppDomainNative::EnableMonitoring)
diff --git a/src/vm/appdomainnative.hpp b/src/vm/appdomainnative.hpp
index dff84345ea..6825fcfac6 100644
--- a/src/vm/appdomainnative.hpp
+++ b/src/vm/appdomainnative.hpp
@@ -66,9 +66,7 @@ public:
static FCDECL2(FC_BOOL_RET, IsFrameworkAssembly, AppDomainBaseObject* refThisUNSAFE, AssemblyNameBaseObject* refAssemblyNameUNSAFE);
static FCDECL1(UINT32, GetAppDomainId, AppDomainBaseObject* refThisUNSAFE);
static FCDECL1(void , PublishAnonymouslyHostedDynamicMethodsAssembly, AssemblyBaseObject * pAssemblyUNSAFE);
-#ifdef FEATURE_CORECLR
static void QCALLTYPE SetNativeDllSearchDirectories(__in_z LPCWSTR wszAssembly);
-#endif // FEATURE_CORECLR
#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
static FCDECL0(void, EnableMonitoring);
diff --git a/src/vm/appxutil.cpp b/src/vm/appxutil.cpp
index 6bc04d74cd..6ec0386d0a 100644
--- a/src/vm/appxutil.cpp
+++ b/src/vm/appxutil.cpp
@@ -148,48 +148,9 @@ namespace AppX
}
CONTRACTL_END
-#ifdef FEATURE_CORECLR
// CoreCLR does not have proper support for AppX design mode. Once/if it has one, it should not need
// any special casing like desktop. Avoid the expensive check completely.
return false;
-#else
- // DevMode does not change over the lifetime of a process and is expensive to compute
- // Cache the first answer and return it once computed; idempotent so races are fine
- static enum
- {
- CachedAppxMode_Unknown,
- CachedAppxMode_Normal,
- CachedAppxMode_Design
- }
- s_cachedAppxMode = CachedAppxMode_Unknown;
-
- bool result = false;
-
- switch (s_cachedAppxMode)
- {
- case CachedAppxMode_Unknown:
- if (SUCCEEDED(IsAppXDesignModeWorker(&result)))
- { // Cache the result on success; otherwise use the default value of false.
- s_cachedAppxMode = result ? CachedAppxMode_Design : CachedAppxMode_Normal;
- }
- break;
-
- case CachedAppxMode_Normal:
- result = false;
- break;
-
- case CachedAppxMode_Design:
- result = true;
- break;
- }
-
-#ifdef _DEBUG
- bool dbg_result = false;
- _ASSERTE(FAILED(IsAppXDesignModeWorker(&dbg_result)) || dbg_result == result);
-#endif
-
- return result;
-#endif // FEATURE_CORECLR
}
HRESULT GetApplicationId(LPCWSTR& rString)
diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp
index 1309695f73..5c9e31eab5 100644
--- a/src/vm/arm/stubs.cpp
+++ b/src/vm/arm/stubs.cpp
@@ -2675,7 +2675,6 @@ void InitJITHelpers1()
}
-#ifdef FEATURE_CORECLR
if(IsSingleAppDomain())
{
SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase_SingleAppDomain);
@@ -2684,7 +2683,6 @@ void InitJITHelpers1()
SetJitHelperFunction(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain);
}
else
-#endif
if (gAppDomainTLSIndex >= TLS_MINIMUM_AVAILABLE)
{
SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase_Portable);
diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp
index eb4c2e5083..59f9947ef0 100644
--- a/src/vm/assembly.cpp
+++ b/src/vm/assembly.cpp
@@ -28,10 +28,6 @@
#include "ngenoptout.h"
#endif
-#if !defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
-#include "assemblyusagelogmanager.h"
-#include "policy.h"
-#endif
#include "eeprofinterfaces.h"
#include "reflectclasswriter.h"
@@ -67,10 +63,6 @@
#include "peimagelayout.inl"
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-#include <shlobj.h>
-#include "eventmsg.h"
-#endif
#ifdef FEATURE_TRACELOGGING
#include "clrtracelogging.h"
@@ -171,9 +163,6 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pFile, DebuggerAssemblyContr
#ifdef FEATURE_COMINTEROP
, m_InteropAttributeStatus(INTEROP_ATTRIBUTE_UNSET)
#endif
-#ifndef FEATURE_CORECLR
- , m_fSupportsAutoNGen(FALSE)
-#endif
{
STANDARD_VM_CONTRACT;
}
@@ -285,13 +274,6 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
if (!m_pManifest->IsReadyToRun())
CacheManifestExportedTypes(pamTracker);
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- GenerateBreadcrumbForServicing();
-
- m_fSupportsAutoNGen = SupportsAutoNGenWorker();
-
- ReportAssemblyUse();
-#endif
#ifdef FEATURE_TRACELOGGING
@@ -808,69 +790,12 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, CreateDynamicAssemblyArgs
}
AssemblyLoadSecurity loadSecurity;
-#ifndef FEATURE_CORECLR
- DWORD dwSpecialFlags = 0xFFFFFFFF;
-
- // Don't bother with setting up permissions if this isn't allowed to run
- // This doesn't apply in CoreCLR because you cannot specify evidence when creating a dynamic assembly
- if ((args->identity != NULL) &&
- (args->access & ASSEMBLY_ACCESS_RUN))
- {
- loadSecurity.m_pAdditionalEvidence = &args->identity;
- }
- else
- {
- if (pCallerAssembly != NULL) // can be null if caller is interop
- {
- if (args->securityContextSource == kCurrentAssembly)
- {
- IAssemblySecurityDescriptor *pCallerSecDesc = pCallerAssembly->GetSecurityDescriptor(pCallersDomain);
- gc.granted = pCallerSecDesc->GetGrantedPermissionSet(&(gc.denied));
- dwSpecialFlags = pCallerSecDesc->GetSpecialFlags();
- }
- else
- {
- IApplicationSecurityDescriptor *pCallersDomainSecDesc = pCallersDomain->GetSecurityDescriptor();
-
-#ifdef FEATURE_CAS_POLICY
- // We only want to propigate the identity of homogenous domains, since heterogenous domains tend
- // to be fully trusted even if they are housing partially trusted code - which could lead to an
- // elevation of privilege if we allow the grant set to be pushed to assemblies partially trusted
- // code is loading.
- if (!pCallersDomainSecDesc->IsHomogeneous())
- {
- COMPlusThrow(kNotSupportedException, W("NotSupported_SecurityContextSourceAppDomainInHeterogenous"));
- }
-#endif // FEATURE_CAS_POLICY
-
- gc.granted = pCallersDomainSecDesc->GetGrantedPermissionSet();
- dwSpecialFlags = pCallersDomainSecDesc->GetSpecialFlags();
- }
-
- // Caller may be in another appdomain context, in which case we'll
- // need to marshal/unmarshal the grant and deny sets across.
-#ifdef FEATURE_REMOTING // should not happen without remoting
- if (pCallersDomain != ::GetAppDomain())
- {
- gc.granted = AppDomainHelper::CrossContextCopyFrom(pCallersDomain->GetId(), &(gc.granted));
- if (gc.denied != NULL)
- {
- gc.denied = AppDomainHelper::CrossContextCopyFrom(pCallersDomain->GetId(), &(gc.denied));
- }
- }
-#else // !FEATURE_REMOTING
- _ASSERTE(pCallersDomain == ::GetAppDomain());
-#endif // FEATURE_REMOTING
- }
- }
-#else // FEATURE_CORECLR
// In SilverLight all dynamic assemblies should be transparent and partially trusted, even if they are
// created by platform assemblies. Thus they should inherit the grant sets from the appdomain not the
// parent assembly.
IApplicationSecurityDescriptor *pCurrentDomainSecDesc = ::GetAppDomain()->GetSecurityDescriptor();
gc.granted = pCurrentDomainSecDesc->GetGrantedPermissionSet();
DWORD dwSpecialFlags = pCurrentDomainSecDesc->GetSpecialFlags();
-#endif // !FEATURE_CORECLR
// If the dynamic assembly creator did not specify evidence for the newly created assembly, then it
// should inherit the grant set of the creation assembly.
@@ -992,33 +917,6 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, CreateDynamicAssemblyArgs
tokenFlags |= TokenSecurityDescriptorFlags_TreatAsSafe;
-#ifndef FEATURE_CORECLR
- // Use the security rules given to us if the emitting code has selected a specific one. Otherwise,
- // inherit the security rules of the emitting assembly.
- if (args->securityRulesBlob != NULL)
- {
- tokenFlags |= ParseSecurityRulesAttribute(args->securityRulesBlob->GetDirectPointerToNonObjectElements(),
- args->securityRulesBlob->GetNumComponents());
- }
- else
- {
- // Ensure that dynamic assemblies created by mscorlib always specify a rule set, since we want to
- // make sure that creating a level 2 assembly was an explicit decision by the emitting code,
- // rather than an implicit decision because mscorlib is level 2 itself.
- //
- // If you're seeing this assert, it means that you've created a dynamic assembly from mscorlib,
- // but did not pass a CustomAttributeBuilder for the SecurityRulesAttribute to the
- // DefineDynamicAssembly call.
- _ASSERTE(!pCallerAssembly->IsSystem());
-
- // Use the creating assembly's security rule set for the emitted assembly
- SecurityRuleSet callerRuleSet =
- ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pCallerAssembly)->GetSecurityRuleSet();
- tokenFlags |= EncodeSecurityRuleSet(callerRuleSet);
-
- tokenFlags |= TokenSecurityDescriptorFlags_SecurityRules;
- }
-#endif // !FEATURE_CORECLR
_ASSERTE(pAssem->GetManifestModule()->m_pModuleSecurityDescriptor != NULL);
pAssem->GetManifestModule()->m_pModuleSecurityDescriptor->OverrideTokenFlags(tokenFlags);
@@ -1030,47 +928,6 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, CreateDynamicAssemblyArgs
if (publicKey.GetSize() > 0)
{
pAssem->SetStrongNameLevel(Assembly::SN_PUBLIC_KEY);
-#ifndef FEATURE_CORECLR
- gc.strongNameKeyPair = args->assemblyName->GetStrongNameKeyPair();
- // If there's a public key, there might be a strong name key pair.
- if (gc.strongNameKeyPair != NULL)
- {
- MethodDescCallSite getKeyPair(METHOD__STRONG_NAME_KEY_PAIR__GET_KEY_PAIR, &gc.strongNameKeyPair);
-
- ARG_SLOT arglist[] =
- {
- ObjToArgSlot(gc.strongNameKeyPair),
- PtrToArgSlot(&gc.orArrayOrContainer)
- };
-
- BOOL bKeyInArray;
- bKeyInArray = (BOOL)getKeyPair.Call_RetBool(arglist);
-
- if (bKeyInArray)
- {
- U1ARRAYREF orArray = (U1ARRAYREF)gc.orArrayOrContainer;
- pAssem->m_cbStrongNameKeyPair = orArray->GetNumComponents();
- pAssem->m_pbStrongNameKeyPair = new BYTE[pAssem->m_cbStrongNameKeyPair];
-
- pAssem->m_FreeFlag |= pAssem->FREE_KEY_PAIR;
- memcpy(pAssem->m_pbStrongNameKeyPair, orArray->GetDataPtr(), pAssem->m_cbStrongNameKeyPair);
- pAssem->SetStrongNameLevel(Assembly::SN_FULL_KEYPAIR_IN_ARRAY);
- }
- else
- {
- STRINGREF orContainer = (STRINGREF)gc.orArrayOrContainer;
- DWORD cchContainer = orContainer->GetStringLength();
- pAssem->m_pwStrongNameKeyContainer = new WCHAR[cchContainer + 1];
-
- pAssem->m_FreeFlag |= pAssem->FREE_KEY_CONTAINER;
- memcpy(pAssem->m_pwStrongNameKeyContainer, orContainer->GetBuffer(), cchContainer * sizeof(WCHAR));
- pAssem->m_pwStrongNameKeyContainer[cchContainer] = W('\0');
-
- pAssem->SetStrongNameLevel(Assembly::SN_FULL_KEYPAIR_IN_CONTAINER);
- }
- }
- else
-#endif // FEATURE_CORECLR
{
// Since we have no way to validate the public key of a dynamic assembly we don't allow
// partial trust code to emit a dynamic assembly with an arbitrary public key.
@@ -1764,11 +1621,6 @@ Module * Assembly::FindModuleByTypeRef(
RETURN NULL;
}
-#ifndef FEATURE_CORECLR
- // Event Tracing for Windows is used to log data for performance and functional testing purposes.
- // The events below are used to help measure the performance of assembly loading of a static reference.
- FireEtwLoaderPhaseStart((::GetAppDomain() ? ::GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable), ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderStaticLoad, NULL, NULL, GetClrInstanceId());
-#endif //!FEATURE_CORECLR
DomainAssembly * pDomainAssembly = pModule->LoadAssembly(
::GetAppDomain(),
@@ -1776,27 +1628,6 @@ Module * Assembly::FindModuleByTypeRef(
szNamespace,
szClassName);
-#ifndef FEATURE_CORECLR
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD))
- {
- StackSString assemblySimpleName;
- EX_TRY
- {
- if ((pDomainAssembly != NULL) && (pDomainAssembly->GetCurrentAssembly() != NULL))
- {
- assemblySimpleName.AppendUTF8(pDomainAssembly->GetCurrentAssembly()->GetSimpleName());
- assemblySimpleName.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- }
- EX_CATCH
- {
- assemblySimpleName.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- FireEtwLoaderPhaseEnd(::GetAppDomain() ? ::GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderStaticLoad, NULL, assemblySimpleName.IsEmpty() ? NULL : (LPCWSTR)assemblySimpleName, GetClrInstanceId());
- }
-#endif //!FEATURE_CORECLR
if (pDomainAssembly == NULL)
RETURN NULL;
@@ -2539,20 +2370,7 @@ HRESULT RunMain(MethodDesc *pFD ,
if ((EntryType == EntryManagedMain) &&
(stringArgs == NULL)) {
- #ifndef FEATURE_CORECLR
- // If you look at the DIFF on this code then you will see a major change which is that we
- // no longer accept all the different types of data arguments to main. We now only accept
- // an array of strings.
-
- wzArgs = CorCommandLine::GetArgvW(&cCommandArgs);
- // In the WindowsCE case where the app has additional args the count will come back zero.
- if (cCommandArgs > 0) {
- if (!wzArgs)
- return E_INVALIDARG;
- }
-#else // !FEATURE_CORECLR
return E_INVALIDARG;
-#endif // !FEATURE_CORECLR
}
ETWFireEvent(Main_V1);
@@ -2727,13 +2545,11 @@ INT32 Assembly::ExecuteMainMethod(PTRARRAYREF *stringArgs, BOOL waitForOtherThre
}
#endif // FEATURE_APPX_BINDER && FEATURE_MULTICOREJIT
-#ifdef FEATURE_CORECLR
// Set the root assembly as the assembly that is containing the main method
// The root assembly is used in the GetEntryAssembly method that on CoreCLR is used
// to get the TargetFrameworkMoniker for the app
AppDomain * pDomain = pThread->GetDomain();
pDomain->SetRootAssembly(pMeth->GetAssembly());
-#endif
hr = RunMain(pMeth, 1, &iRetVal, stringArgs);
}
}
@@ -3165,24 +2981,13 @@ mdAssemblyRef Assembly::AddAssemblyRef(Assembly *refedAssembly, IMetaDataAssembl
GC_TRIGGERS;
INJECT_FAULT(COMPlusThrowOM(););
PRECONDITION(CheckPointer(refedAssembly));
-#ifdef FEATURE_CORECLR
PRECONDITION(CheckPointer(pAssemEmitter, NULL_NOT_OK));
-#else
- PRECONDITION(CheckPointer(pAssemEmitter, NULL_OK));
-#endif //FEATURE_CORECLR
POSTCONDITION(!IsNilToken(RETVAL));
POSTCONDITION(TypeFromToken(RETVAL) == mdtAssemblyRef);
}
CONTRACT_END;
SafeComHolder<IMetaDataAssemblyEmit> emitHolder;
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- if (pAssemEmitter == NULL)
- {
- pAssemEmitter = GetOnDiskMDAssemblyEmitter();
- emitHolder.Assign(pAssemEmitter);
- }
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
AssemblySpec spec;
spec.InitializeSpec(refedAssembly->GetManifestFile());
@@ -3250,476 +3055,6 @@ void Assembly::AddExportedType(mdExportedType cl)
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-
-//***********************************************************
-//
-// get the IMetaDataAssemblyEmit for the on disk manifest.
-// Note that the pointer returned is AddRefed. It is the caller's
-// responsibility to release the reference.
-//
-//***********************************************************
-IMetaDataAssemblyEmit *Assembly::GetOnDiskMDAssemblyEmitter()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END
-
- IMetaDataAssemblyEmit *pAssemEmitter = NULL;
- IMetaDataEmit *pEmitter;
- RefClassWriter *pRCW;
-
- _ASSERTE(m_pOnDiskManifest);
-
- pRCW = m_pOnDiskManifest->GetClassWriter();
- _ASSERTE(pRCW);
-
- // If the RefClassWriter has a on disk emitter, then use it rather than the in-memory emitter.
- pEmitter = pRCW->GetOnDiskEmitter();
-
- if (pEmitter == NULL)
- pEmitter = m_pOnDiskManifest->GetEmitter();
-
- _ASSERTE(pEmitter != NULL);
-
- IfFailThrow(pEmitter->QueryInterface(IID_IMetaDataAssemblyEmit, (void**) &pAssemEmitter));
-
- if (pAssemEmitter == NULL)
- {
- // the manifest is not writable
- _ASSERTE(!"Bad usage!");
- }
- return pAssemEmitter;
-}
-
-//***********************************************************
-//
-// prepare saving manifest to disk.
-//
-//***********************************************************
-void Assembly::PrepareSavingManifest(ReflectionModule *pAssemblyModule)
-{
- STANDARD_VM_CONTRACT;
-
- if (pAssemblyModule)
- {
- // embedded assembly
- m_pOnDiskManifest = pAssemblyModule;
- m_fEmbeddedManifest = true;
- }
- else
- {
- m_fEmbeddedManifest = false;
-
- StackSString name(SString::Utf8, GetSimpleName());
-
- // Create the module
- m_pOnDiskManifest = CreateDynamicModule(name, name, FALSE /*fIsTransient*/);
- // store the fact this on disk manifest is temporary and can be hidden from the user
- m_needsToHideManifestForEmit = TRUE;
- }
-
- NonVMComHolder<IMetaDataAssemblyEmit> pAssemblyEmit(GetOnDiskMDAssemblyEmitter());
-
- // Copy assembly metadata to emit scope
- //<TODO>@todo: add Title, Description, Alias as CA</TODO>
- // <TODO>@todo: propagate all of the information</TODO>
- // <TODO>@todo: introduce a helper in metadata to take the ansi version of string.</TODO>
-
- IMetaDataAssemblyImport *pAssemblyImport = GetManifestFile()->GetAssemblyImporter();
-
- const void *pbPublicKey;
- ULONG cbPublicKey;
- ULONG ulHashAlgId;
- LPWSTR szName;
- ULONG chName;
- ASSEMBLYMETADATA MetaData;
- DWORD dwAssemblyFlags;
-
- MetaData.cbLocale = 0;
- MetaData.ulProcessor = 0;
- MetaData.ulOS = 0;
- IfFailThrow(pAssemblyImport->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- NULL, NULL, NULL,
- NULL, 0, &chName,
- &MetaData, NULL));
- StackSString name;
- szName = name.OpenUnicodeBuffer(chName);
-
- SString locale;
- MetaData.szLocale = locale.OpenUnicodeBuffer(MetaData.cbLocale);
-
- SBuffer proc;
- MetaData.rProcessor = (DWORD *) proc.OpenRawBuffer(MetaData.ulProcessor*sizeof(*MetaData.rProcessor));
-
- SBuffer os;
- MetaData.rOS = (OSINFO *) os.OpenRawBuffer(MetaData.ulOS*sizeof(*MetaData.rOS));
-
- IfFailThrow(pAssemblyImport->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- &pbPublicKey, &cbPublicKey, &ulHashAlgId,
- szName, chName, &chName,
- &MetaData, &dwAssemblyFlags));
-
- mdAssembly ad;
- IfFailThrow(pAssemblyEmit->DefineAssembly(pbPublicKey, cbPublicKey, ulHashAlgId,
- szName, &MetaData, dwAssemblyFlags, &ad));
-
- SafeComHolder<IMetaDataImport> pImport;
- IfFailThrow(pAssemblyEmit->QueryInterface(IID_IMetaDataImport, (void**)&pImport));
- ULONG cExistingName = 0;
- if (FAILED(pImport->GetScopeProps(NULL, 0, &cExistingName, NULL)) || cExistingName == 0)
- {
- SafeComHolder<IMetaDataEmit> pEmit;
- IfFailThrow(pAssemblyEmit->QueryInterface(IID_IMetaDataEmit, (void**)&pEmit));
- IfFailThrow(pEmit->SetModuleProps(szName));
- }
-
- name.CloseBuffer();
- locale.CloseBuffer();
- proc.CloseRawBuffer();
- os.CloseRawBuffer();
-} // Assembly::PrepareSavingManifest
-
-
-//***********************************************************
-//
-// add a file name to the file list of this assembly. On disk only.
-//
-//***********************************************************
-mdFile Assembly::AddFile(LPCWSTR wszFileName)
-{
- STANDARD_VM_CONTRACT;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
- mdFile fl;
-
- // Define File.
- IfFailThrow( pAssemEmitter->DefineFile(
- wszFileName, // [IN] Name of the file.
- 0, // [IN] Hash Blob.
- 0, // [IN] Count of bytes in the Hash Blob.
- 0, // [IN] Flags.
- &fl) ); // [OUT] Returned File token.
-
- return fl;
-} // Assembly::AddFile
-
-
-//***********************************************************
-//
-// Set the hash value on a file table entry.
-//
-//***********************************************************
-void Assembly::SetFileHashValue(mdFile tkFile, LPCWSTR wszFullFileName)
-{
- STANDARD_VM_CONTRACT;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
-
- // Get the hash value.
- SBuffer buffer;
- PEImageHolder map(PEImage::OpenImage(StackSString(wszFullFileName)));
- map->ComputeHash(GetHashAlgId(), buffer);
-
- // Set the hash blob.
- IfFailThrow( pAssemEmitter->SetFileProps(
- tkFile, // [IN] File Token.
- buffer, // [IN] Hash Blob.
- buffer.GetSize(), // [IN] Count of bytes in the Hash Blob.
- (DWORD) -1)); // [IN] Flags.
-
-} // Assembly::SetHashValue
-
-//*****************************************************************************
-// Add a Type name to the ExportedType table in the on-disk assembly manifest.
-//*****************************************************************************
-mdExportedType Assembly::AddExportedTypeOnDisk(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags)
-{
- STANDARD_VM_CONTRACT;
-
- _ASSERTE(TypeFromToken(tkTypeDef) == mdtTypeDef);
-
- // The on-disk assembly manifest
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
-
- mdExportedType ct;
-
- IfFailThrow( pAssemEmitter->DefineExportedType(
- wszExportedType, // [IN] Name of the COMType.
- tkImpl, // [IN] mdFile or mdAssemblyRef that provides the ExportedType.
- tkTypeDef, // [IN] TypeDef token within the file.
- flags, // [IN] Flags.
- &ct) ); // [OUT] Returned ExportedType token.
-
- return ct;
-} // Assembly::AddExportedTypeOnDisk
-
-//*******************************************************************************
-// Add a Type name to the ExportedType table in the in-memory assembly manifest.
-//*******************************************************************************
-mdExportedType Assembly::AddExportedTypeInMemory(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags)
-{
- STANDARD_VM_CONTRACT;
-
- _ASSERTE(TypeFromToken(tkTypeDef) == mdtTypeDef);
-
- // The in-memory assembly manifest
- IMetaDataAssemblyEmit* pAssemEmitter = GetManifestFile()->GetAssemblyEmitter();
-
- mdExportedType ct;
-
- IfFailThrow( pAssemEmitter->DefineExportedType(
- wszExportedType, // [IN] Name of the COMType.
- tkImpl, // [IN] mdFile or mdAssemblyRef that provides the ExportedType.
- tkTypeDef, // [IN] TypeDef token within the file.
- flags, // [IN] Flags.
- &ct) ); // [OUT] Returned ExportedType token.
-
- return ct;
-} // Assembly::AddExportedTypeInMemory
-
-
-//***********************************************************
-// add an entry to ManifestResource table for a stand alone managed resource. On disk only.
-//***********************************************************
-void Assembly::AddStandAloneResource(LPCWSTR wszName, LPCWSTR wszDescription, LPCWSTR wszMimeType, LPCWSTR wszFileName, LPCWSTR wszFullFileName, int iAttribute)
-{
- STANDARD_VM_CONTRACT;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
- mdFile tkFile;
- mdManifestResource mr;
- SBuffer hash;
-
- // Get the hash value;
- if (GetHashAlgId())
- {
- PEImageHolder pImage(PEImage::OpenImage(StackSString(wszFullFileName)));
- pImage->ComputeHash(GetHashAlgId(), hash);
- }
-
- IfFailThrow( pAssemEmitter->DefineFile(
- wszFileName, // [IN] Name of the file.
- hash, // [IN] Hash Blob.
- hash.GetSize(), // [IN] Count of bytes in the Hash Blob.
- ffContainsNoMetaData, // [IN] Flags.
- &tkFile) ); // [OUT] Returned File token.
-
-
- IfFailThrow( pAssemEmitter->DefineManifestResource(
- wszName, // [IN] Name of the resource.
- tkFile, // [IN] mdFile or mdAssemblyRef that provides the resource.
- 0, // [IN] Offset to the beginning of the resource within the file.
- iAttribute, // [IN] Flags.
- &mr) ); // [OUT] Returned ManifestResource token.
-
-} // Assembly::AddStandAloneResource
-
-
-//***********************************************************
-// Save security permission requests.
-//***********************************************************
-void Assembly::AddDeclarativeSecurity(DWORD dwAction, void const *pValue, DWORD cbValue)
-{
- STANDARD_VM_CONTRACT;
-
- mdAssembly tkAssembly = 0x20000001;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
- _ASSERTE( pAssemEmitter );
-
- SafeComHolder<IMetaDataEmitHelper> pEmitHelper;
- IfFailThrow( pAssemEmitter->QueryInterface(IID_IMetaDataEmitHelper, (void**)&pEmitHelper) );
-
- IfFailThrow(pEmitHelper->AddDeclarativeSecurityHelper(tkAssembly,
- dwAction,
- pValue,
- cbValue,
- NULL));
-}
-
-
-//***********************************************************
-// Allocate space for a strong name signature in the manifest
-//***********************************************************
-HRESULT Assembly::AllocateStrongNameSignature(ICeeFileGen *pCeeFileGen,
- HCEEFILE ceeFile)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END
-
- HRESULT hr;
- HCEESECTION TData;
- DWORD dwDataOffset;
- DWORD dwDataLength;
- DWORD dwDataRVA;
- VOID *pvBuffer;
- const void *pbPublicKey;
- ULONG cbPublicKey;
-
- // Determine size of signature blob.
-
- IfFailRet(GetManifestImport()->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- &pbPublicKey, &cbPublicKey, NULL,
- NULL, NULL, NULL));
-
- if (!StrongNameSignatureSize((BYTE *) pbPublicKey, cbPublicKey, &dwDataLength)) {
- hr = StrongNameErrorInfo();
- return hr;
- }
-
- // Allocate space for the signature in the text section and update the COM+
- // header to point to the space.
- IfFailRet(pCeeFileGen->GetIlSection(ceeFile, &TData));
- IfFailRet(pCeeFileGen->GetSectionDataLen(TData, &dwDataOffset));
- IfFailRet(pCeeFileGen->GetSectionBlock(TData, dwDataLength, 4, &pvBuffer));
- IfFailRet(pCeeFileGen->GetMethodRVA(ceeFile, dwDataOffset, &dwDataRVA));
- IfFailRet(pCeeFileGen->SetStrongNameEntry(ceeFile, dwDataLength, dwDataRVA));
-
- return S_OK;
-}
-
-
-//***********************************************************
-// Strong name sign a manifest already persisted to disk
-//***********************************************************
-HRESULT Assembly::SignWithStrongName(LPCWSTR wszFileName)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END
-
- HRESULT hr = S_OK;
-
- // If we're going to do a full signing we have a key pair either
- // in a key container or provided directly in a byte array.
-
- switch (m_eStrongNameLevel) {
- case SN_FULL_KEYPAIR_IN_ARRAY:
- if (!StrongNameSignatureGeneration(wszFileName, NULL, m_pbStrongNameKeyPair, m_cbStrongNameKeyPair, NULL, NULL))
- hr = StrongNameErrorInfo();
- break;
-
- case SN_FULL_KEYPAIR_IN_CONTAINER:
- if (!StrongNameSignatureGeneration(wszFileName, m_pwStrongNameKeyContainer, NULL, 0, NULL, NULL))
- hr = StrongNameErrorInfo();
- break;
-
- default:
- break;
- }
-
- return hr;
-}
-
-
-//***********************************************************
-// save the manifest to disk!
-//***********************************************************
-void Assembly::SaveManifestToDisk(LPCWSTR wszFileName, int entrypoint, int fileKind, DWORD corhFlags, DWORD peFlags)
-{
- STANDARD_VM_CONTRACT;
-
- HRESULT hr = NOERROR;
- HCEEFILE ceeFile = NULL;
- ICeeFileGen *pCeeFileGen = NULL;
- RefClassWriter *pRCW;
- IMetaDataEmit *pEmitter;
-
- _ASSERTE( m_fEmbeddedManifest == false );
-
- pRCW = m_pOnDiskManifest->GetClassWriter();
- _ASSERTE(pRCW);
-
- IfFailGo( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- pCeeFileGen = pRCW->GetCeeFileGen();
- ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- //Emit the MetaData
- pEmitter = m_pOnDiskManifest->GetClassWriter()->GetEmitter();
- IfFailGo( pCeeFileGen->EmitMetaDataEx(ceeFile, pEmitter) );
-
- // Allocate space for a strong name signature if a public key was supplied
- // (this doesn't strong name the assembly, but it makes it possible to do so
- // as a post processing step).
- if (IsStrongNamed())
- IfFailGo(AllocateStrongNameSignature(pCeeFileGen, ceeFile));
-
- IfFailGo( pCeeFileGen->SetOutputFileName(ceeFile, (LPWSTR)wszFileName) );
-
- // the entryPoint for an assembly is a tkFile token if exist.
- if (RidFromToken(entrypoint) != mdTokenNil)
- IfFailGo( pCeeFileGen->SetEntryPoint(ceeFile, entrypoint) );
- if (fileKind == Dll)
- {
- pCeeFileGen->SetDllSwitch(ceeFile, true);
- }
- else
- {
- // should have a valid entry point for applications
- if (fileKind == WindowApplication)
- {
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_GUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- }
- else
- {
- _ASSERTE(fileKind == ConsoleApplication);
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_CUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- }
-
- }
-
- //Generate the CeeFile
- IfFailGo(pCeeFileGen->GenerateCeeFile(ceeFile) );
-
- // Strong name sign the resulting assembly if required.
- if (IsStrongNamed())
- IfFailGo(SignWithStrongName(wszFileName));
-
- // now release the m_pOnDiskManifest
-ErrExit:
- pRCW->DestroyCeeFileGen();
-
- // we keep the on disk manifest so that the GetModules code can skip over this ad-hoc module when modules are enumerated.
- // Need to see if we can remove the creation of this module alltogether
- //m_pOnDiskManifest = NULL;
-
- if (FAILED(hr))
- {
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- {
- if (IsWin32IOError(HRESULT_CODE(hr)))
- {
- COMPlusThrowHR(COR_E_IO);
- }
- else
- {
- COMPlusThrowHR(hr);
- }
- }
- if (hr == CEE_E_CVTRES_NOT_FOUND)
- COMPlusThrow(kIOException, W("Argument_cvtres_NotFound"));
- COMPlusThrowHR(hr);
- }
-} // Assembly::SaveManifestToDisk
-
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
HRESULT STDMETHODCALLTYPE
@@ -3749,78 +3084,7 @@ GetAssembliesByName(LPCWSTR szAppBase,
if (!(szAssemblyName && ppIUnk && pcAssemblies))
return E_POINTER;
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
hr = COR_E_NOTSUPPORTED;
-#else
- AppDomain *pDomain = NULL;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- if(szAppBase || szPrivateBin)
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
- MethodDescCallSite createDomainEx(METHOD__APP_DOMAIN__CREATE_DOMAINEX);
- struct _gc {
- STRINGREF pFriendlyName;
- STRINGREF pAppBase;
- STRINGREF pPrivateBin;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
- gc.pFriendlyName = StringObject::NewString(W("GetAssembliesByName"));
-
- if(szAppBase)
- {
- gc.pAppBase = StringObject::NewString(szAppBase);
- }
-
- if(szPrivateBin)
- {
- gc.pPrivateBin = StringObject::NewString(szPrivateBin);
- }
-
- ARG_SLOT args[5] =
- {
- ObjToArgSlot(gc.pFriendlyName),
- NULL,
- ObjToArgSlot(gc.pAppBase),
- ObjToArgSlot(gc.pPrivateBin),
- BoolToArgSlot(false)
- };
- APPDOMAINREF pDom = (APPDOMAINREF) createDomainEx.Call_RetOBJECTREF(args);
- if (pDom == NULL)
- {
- hr = E_FAIL;
- }
- else
- {
- Context *pContext = CRemotingServices::GetServerContextForProxy((OBJECTREF) pDom);
- _ASSERTE(pContext);
- pDomain = pContext->GetDomain();
- }
-
- GCPROTECT_END();
- }
- else
- pDomain = SystemDomain::System()->DefaultDomain();
-
- Assembly *pFoundAssembly;
- if (SUCCEEDED(hr)) {
- pFoundAssembly = pDomain->LoadAssemblyHelper(szAssemblyName,
- NULL);
- if (SUCCEEDED(hr)) {
- if (cMax < 1)
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- else {
- ppIUnk[0] = (IUnknown *)pFoundAssembly->GetManifestAssemblyImporter();
- ppIUnk[0]->AddRef();
- }
- *pcAssemblies = 1;
- }
- }
-
- END_EXTERNAL_ENTRYPOINT;
-#endif // FEATURE_CORECLR
return hr;
}// Used by the IMetadata API's to access an assemblies metadata.
@@ -4296,365 +3560,6 @@ IWinMDImport *Assembly::GetManifestWinMDImport()
#endif // FEATURE_COMINTEROP
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-void Assembly::GenerateBreadcrumbForServicing()
-{
- STANDARD_VM_CONTRACT;
-
- if (AppX::IsAppXProcess() || IsIntrospectionOnly() || GetManifestFile()->IsDynamic())
- {
- return;
- }
-
- if (HasServiceableAttribute() || IsExistingOobAssembly())
- {
- StackSString ssDisplayName;
- GetDisplayName(ssDisplayName);
-
- WriteBreadcrumb(ssDisplayName);
- CheckDenyList(ssDisplayName);
- }
-}
-
-void Assembly::WriteBreadcrumb(const SString &ssDisplayName)
-{
- STANDARD_VM_CONTRACT;
-
- WCHAR path[MAX_LONGPATH];
- HRESULT hr = WszSHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, ARRAYSIZE(path), path);
- if (hr != S_OK)
- {
- return;
- }
-
- if (wcscat_s(path, W("\\Microsoft\\NetFramework\\BreadcrumbStore\\")) != 0)
- {
- return;
- }
-
- size_t dirPathLen = wcslen(path);
-
- // Validate the display name. E.g., we don't want the display name to start with "..\\".
- bool inSimpleName = true;
- for (SString::CIterator it = ssDisplayName.Begin(); it != ssDisplayName.End(); ++it)
- {
- WCHAR c = *it;
-
- // The following characters are always allowed: a-zA-Z0-9_
- if (c >= W('a') && c <= W('z') || c >= W('A') && c <= W('Z') || c >= W('0') && c <= W('9') || c == W('_')) continue;
-
- // The period is allowed except as the first char.
- if (c == W('.') && it != ssDisplayName.Begin()) continue;
-
- // A comma terminates the assembly simple name, and we are in key=value portion of the display name.
- if (c == W(','))
- {
- inSimpleName = false;
- continue;
- }
-
- // In key=value portion, space and equal sign are also allowed.
- if (!inSimpleName && (c == W(' ') || c == W('='))) continue;
-
- // If we reach here, we have an invalid assembly display name. Return without writing breadcrumb.
- return;
- }
-
- // Log a breadcrumb using full display name.
- if (wcscat_s(path, ssDisplayName.GetUnicode()) == 0)
- {
- HandleHolder hFile = WszCreateFile(path, 0, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- }
-
- // Log another breadcrumb using display name without version.
- // First make a copy of the display name, and look for its version part.
- StackSString ssNoVersion(ssDisplayName);
- SString::Iterator itVersion = ssNoVersion.Begin();
- if (!ssNoVersion.Find(itVersion, W(", Version=")))
- {
- return;
- }
-
- // Start from the comma before Version=, advance past the comma, then look for the next comma.
- SString::Iterator itVersionEnd = itVersion;
- ++itVersionEnd;
- if (!ssNoVersion.Find(itVersionEnd, W(',')))
- {
- // Version is the last key=value pair.
- itVersionEnd = ssNoVersion.End();
- }
-
- // Erase the version.
- ssNoVersion.Delete(itVersion, itVersionEnd - itVersion);
-
- // Generate the full path string and create the file.
- path[dirPathLen] = W('\0');
- if (wcscat_s(path, ssNoVersion.GetUnicode()) == 0)
- {
- HandleHolder hFile = WszCreateFile(path, 0, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- }
-
-}
-
-bool Assembly::HasServiceableAttribute()
-{
- STANDARD_VM_CONTRACT;
-
- IMDInternalImport *pImport = GetManifestImport();
- MDEnumHolder hEnum(pImport);
- HRESULT hr = pImport->EnumCustomAttributeByNameInit(GetManifestToken(), ASSEMBLY_METADATA_TYPE, &hEnum);
- if (hr != S_OK)
- {
- return false;
- }
-
- mdCustomAttribute tkAttribute;
- while (pImport->EnumNext(&hEnum, &tkAttribute))
- {
- // Get raw custom attribute.
- const BYTE *pbAttr = NULL; // Custom attribute data as a BYTE*.
- ULONG cbAttr = 0; // Size of custom attribute data.
- if (FAILED(pImport->GetCustomAttributeAsBlob(tkAttribute, reinterpret_cast<const void **>(&pbAttr), &cbAttr)))
- {
- THROW_BAD_FORMAT(BFA_INVALID_TOKEN, GetManifestModule());
- }
-
- CustomAttributeParser cap(pbAttr, cbAttr);
- if (FAILED(cap.ValidateProlog()))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- // Get the metadata key. It is not null terminated.
- LPCUTF8 key;
- ULONG cbKey;
- if (FAILED(cap.GetString(&key, &cbKey)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- const LPCUTF8 szServiceable = "Serviceable";
- const ULONG cbServiceable = 11;
- if (cbKey != cbServiceable || strncmp(key, szServiceable, cbKey) != 0)
- {
- continue;
- }
-
- // Get the metadata value. It is not null terminated.
- if (FAILED(cap.GetString(&key, &cbKey)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- const LPCUTF8 szTrue = "True";
- const ULONG cbTrue = 4;
- if (cbKey == cbTrue && strncmp(key, szTrue, cbKey) == 0)
- {
- return true;
- }
- }
-
- return false;
-}
-
-bool Assembly::IsExistingOobAssembly()
-{
- WRAPPER_NO_CONTRACT;
-
- return ExistingOobAssemblyList::Instance()->IsOnlist(this);
-}
-
-void Assembly::CheckDenyList(const SString &ssDisplayName)
-{
- STANDARD_VM_CONTRACT;
-
- StackSString ssKeyName(W("SOFTWARE\\Microsoft\\.NETFramework\\Policy\\DenyList\\"));
-
- ssKeyName.Append(ssDisplayName);
-
- RegKeyHolder hKey;
- LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ssKeyName.GetUnicode(), 0, KEY_WOW64_64KEY | GENERIC_READ, &hKey);
-
- if (status != ERROR_SUCCESS)
- {
- return;
- }
-
- StackSString ssFwlink;
- HRESULT hr = Clr::Util::Reg::ReadStringValue(hKey, NULL, NULL, ssFwlink);
- if (FAILED(hr) || ssFwlink.GetCount() == 0)
- {
- ssFwlink.Set(W("http://go.microsoft.com/fwlink/?LinkID=286319"));
- }
-
- StackSString ssMessageTemplate;
- if(!ssMessageTemplate.LoadResource(CCompRC::Optional, IDS_EE_ASSEMBLY_ON_DENY_LIST))
- {
- ssMessageTemplate.Set(W("The assembly %1 that the application tried to load has a known vulnerability. Please go to %2 to find a fix for this issue."));
- }
-
- StackSString ssMessage;
- ssMessage.FormatMessage(FORMAT_MESSAGE_FROM_STRING, ssMessageTemplate.GetUnicode(), 0, 0, ssDisplayName, ssFwlink);
-
- ClrReportEvent(
- W(".NET Runtime"), // Event source
- EVENTLOG_ERROR_TYPE, // Type
- 0, // Category
- SecurityConfig, // Event ID
- NULL, // User SID
- ssMessage.GetUnicode()); // Message
-
- NewHolder<EEMessageException> pEx(new EEMessageException(kSecurityException, IDS_EE_ASSEMBLY_ON_DENY_LIST, ssDisplayName.GetUnicode(), ssFwlink.GetUnicode()));
- EEFileLoadException::Throw(m_pManifestFile, pEx->GetHR(), pEx);
-}
-
-BOOL IsReportableAssembly(PEAssembly *pPEAssembly)
-{
- STANDARD_VM_CONTRACT;
-
- // If the assembly could have used a native image, but did not, report the IL image
- BOOL fCanUseNativeImage = (pPEAssembly->HasHostAssembly() || pPEAssembly->IsContextLoad()) &&
- pPEAssembly->CanUseNativeImage() &&
- !IsNativeImageOptedOut(pPEAssembly->GetFusionAssemblyName());
-
- return fCanUseNativeImage;
-}
-
-BOOL Assembly::SupportsAutoNGenWorker()
-{
- STANDARD_VM_CONTRACT;
-
- PEAssembly *pPEAssembly = GetManifestFile();
-
- if (pPEAssembly->IsSourceGAC() && Fusion::Util::IsUnifiedAssembly(pPEAssembly->GetFusionAssemblyName()) == S_OK)
- {
- // Assemblies in the .NET Framework supports Auto NGen.
- return TRUE;
- }
-
- if (IsAfContentType_WindowsRuntime(GetFlags()))
- {
- // WinMD files support Auto NGen.
- return TRUE;
- }
-
- if (pPEAssembly->HasHostAssembly())
- {
- // Auto NGen is enabled on all Metro app assemblies.
- return TRUE;
- }
-
- if (pPEAssembly->IsSourceGAC())
- {
- // For non-framework assemblies in GAC, look for TargetFrameworkAttriute.
- const BYTE *pbAttr; // Custom attribute data as a BYTE*.
- ULONG cbAttr; // Size of custom attribute data.
- HRESULT hr = GetManifestImport()->GetCustomAttributeByName(GetManifestToken(), TARGET_FRAMEWORK_TYPE, (const void**)&pbAttr, &cbAttr);
- if (hr != S_OK)
- {
- return FALSE;
- }
-
- CustomAttributeParser cap(pbAttr, cbAttr);
- if (FAILED(cap.ValidateProlog()))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
- LPCUTF8 lpTargetFramework;
- ULONG cbTargetFramework;
- if (FAILED(cap.GetString(&lpTargetFramework, &cbTargetFramework)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- if (lpTargetFramework == NULL || cbTargetFramework == 0)
- {
- return FALSE;
- }
-
- SString ssTargetFramework(SString::Utf8, lpTargetFramework, cbTargetFramework);
-
- // Look for two special TargetFramework values that disables AutoNGen. To guard against future
- // variations of the string values, we do prefix matches.
- SString ssFramework40(SString::Literal, W(".NETFramework,Version=v4.0"));
- SString ssPortableLib(SString::Literal, W(".NETPortable,"));
- if (ssTargetFramework.BeginsWithCaseInsensitive(ssFramework40) || ssTargetFramework.BeginsWithCaseInsensitive(ssPortableLib))
- {
- return FALSE;
- }
-
- // If TargetFramework doesn't match one of the two special values, we enable Auto NGen.
- return TRUE;
- }
-
- return FALSE;
-}
-
-void Assembly::ReportAssemblyUse()
-{
- STANDARD_VM_CONTRACT;
-
- // Do not log if we don't have a global gac logger object
- if (g_pIAssemblyUsageLogGac != NULL)
- {
- // Only consider reporting for loads that could possibly use native images.
- PEAssembly *pPEAssembly = this->GetManifestFile();
- if (IsReportableAssembly(pPEAssembly) && !pPEAssembly->IsReportedToUsageLog())
- {
- // Do not log repeatedly
- pPEAssembly->SetReportedToUsageLog();
-
- ReleaseHolder<IAssemblyUsageLog> pRefCountedUsageLog;
- IAssemblyUsageLog *pUsageLog = NULL;
- if (SupportsAutoNGen())
- {
- if (pPEAssembly->IsSourceGAC())
- {
- pUsageLog = g_pIAssemblyUsageLogGac;
- }
- else if (pPEAssembly->HasHostAssembly())
- {
- UINT_PTR binderId;
- IfFailThrow(pPEAssembly->GetHostAssembly()->GetBinderID(&binderId));
- pRefCountedUsageLog = AssemblyUsageLogManager::GetUsageLogForBinder(binderId);
- pUsageLog = pRefCountedUsageLog;
- }
- }
-
- if (pUsageLog)
- {
- PEAssembly *pPEAssembly = GetManifestFile();
- StackSString name;
- // GAC Assemblies are reported by assembly name
- if (pUsageLog == g_pIAssemblyUsageLogGac)
- {
- this->GetDisplayName(name);
- }
- // Other assemblies (AppX...) are reported by file path
- else
- {
- name.Set(pPEAssembly->GetILimage()->GetPath().GetUnicode());
- }
-
- if (pPEAssembly->HasNativeImage())
- {
- if(!IsSystem())
- {
- // If the assembly used a native image, report it
- ReleaseHolder<PEImage> pNativeImage = pPEAssembly->GetNativeImageWithRef();
- pUsageLog->LogFile(name.GetUnicode(), pNativeImage->GetPath().GetUnicode(), ASSEMBLY_USAGE_LOG_FLAGS_NI);
- }
- }
- else
- {
- // If the assembly could have used a native image, but did not, report the IL image
- pUsageLog->LogFile(name.GetUnicode(), NULL, ASSEMBLY_USAGE_LOG_FLAGS_IL);
- }
- }
- }
- }
-}
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
#endif // #ifndef DACCESS_COMPILE
@@ -4857,31 +3762,6 @@ FriendAssemblyDescriptor *FriendAssemblyDescriptor::CreateFriendAssemblyDescript
// CoreCLR does not have a valid scenario for strong-named assemblies requiring their dependencies
// to be strong-named as well.
-#if !defined(FEATURE_CORECLR)
- // If this assembly has a strong name, then its friends declarations need to have strong names too
- if (pAssembly->IsStrongNamed())
- {
-#ifdef FEATURE_FUSION
- DWORD dwSize = 0;
- if (SUCCEEDED(hr = pFriendAssemblyName->GetProperty(ASM_NAME_PUBLIC_KEY, NULL, &dwSize)))
- {
- // If this call succeeds with an empty buffer, then the supplied name doesn't have a public key.
- THROW_HR_ERROR_WITH_INFO(META_E_CA_FRIENDS_SN_REQUIRED, pAssembly);
- }
- else if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
- {
- IfFailThrow(hr);
- }
-#else // FEATURE_FUSION
- // Desktop crossgen comes here
- if (!pFriendAssemblyName->IsStrongNamed())
- {
- // If this call succeeds with an empty buffer, then the supplied name doesn't have a public key.
- THROW_HR_ERROR_WITH_INFO(META_E_CA_FRIENDS_SN_REQUIRED, pAssembly);
- }
-#endif // FEATURE_FUSION
- }
-#endif // !defined(FEATURE_CORECLR)
pFriendAssemblies->AddFriendAssembly(pFriendAssemblyName);
@@ -4974,70 +3854,3 @@ bool FriendAssemblyDescriptor::IsAssemblyOnList(PEAssembly *pAssembly, const Arr
#endif // !DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) && !defined(DACCESS_COMPILE)
-
-ExistingOobAssemblyList::ExistingOobAssemblyList()
-{
- STANDARD_VM_CONTRACT;
-
- RegKeyHolder hKey;
- LONG status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, W("SOFTWARE\\Microsoft\\.NETFramework\\Policy\\Servicing"), 0, KEY_WOW64_64KEY | GENERIC_READ, &hKey);
- if (status != ERROR_SUCCESS)
- {
- return;
- }
-
- for (DWORD i = 0; ; i++)
- {
- WCHAR name[MAX_PATH_FNAME + 1];
- DWORD cchName = ARRAYSIZE(name);
- status = RegEnumKeyExW(hKey, i, name, &cchName, NULL, NULL, NULL, NULL);
-
- if (status == ERROR_NO_MORE_ITEMS)
- {
- break;
- }
-
- if (status == ERROR_SUCCESS)
- {
- NonVMComHolder<IAssemblyName> pAssemblyName;
- HRESULT hr = CreateAssemblyNameObject(&pAssemblyName, name, CANOF_PARSE_DISPLAY_NAME, NULL);
- if (SUCCEEDED(hr))
- {
- hr = m_alExistingOobAssemblies.Append(pAssemblyName.GetValue());
- if (SUCCEEDED(hr))
- {
- pAssemblyName.SuppressRelease();
- }
- }
- }
- }
-}
-
-bool ExistingOobAssemblyList::IsOnlist(Assembly *pAssembly)
-{
- STANDARD_VM_CONTRACT;
-
- ArrayList::Iterator itAssemblyNames = m_alExistingOobAssemblies.Iterate();
- while (itAssemblyNames.Next())
- {
- IAssemblyName *pAssemblyName = static_cast<IAssemblyName *>(itAssemblyNames.GetElement());
- HRESULT hr = pAssemblyName->IsEqual(pAssembly->GetFusionAssemblyName(), ASM_CMPF_DEFAULT);
- if (hr == S_OK)
- {
- return true;
- }
- }
-
- return false;
-}
-
-void ExistingOobAssemblyList::Init()
-{
- STANDARD_VM_CONTRACT;
-
- s_pInstance = new ExistingOobAssemblyList();
-}
-
-ExistingOobAssemblyList *ExistingOobAssemblyList::s_pInstance;
-#endif // !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) && !defined(DACCESS_COMPILE)
diff --git a/src/vm/assembly.hpp b/src/vm/assembly.hpp
index 7466903663..6974fdd62f 100644
--- a/src/vm/assembly.hpp
+++ b/src/vm/assembly.hpp
@@ -531,23 +531,7 @@ public:
void AddType(Module* pModule,
mdTypeDef cl);
void AddExportedType(mdExportedType cl);
-#ifndef FEATURE_CORECLR
- void PrepareSavingManifest(ReflectionModule *pAssemblyModule);
- mdFile AddFile(LPCWSTR wszFileName);
- void SetFileHashValue(mdFile tkFile, LPCWSTR wszFullFileName);
-#endif
mdAssemblyRef AddAssemblyRef(Assembly *refedAssembly, IMetaDataAssemblyEmit *pAssemEmitter = NULL, BOOL fUsePublicKeyToken = TRUE);
-#ifndef FEATURE_CORECLR
- mdExportedType AddExportedTypeOnDisk(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags);
- mdExportedType AddExportedTypeInMemory(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags);
- void AddStandAloneResource(LPCWSTR wszName, LPCWSTR wszDescription, LPCWSTR wszMimeType, LPCWSTR wszFileName, LPCWSTR wszFullFileName, int iAttribute);
- void SaveManifestToDisk(LPCWSTR wszFileName, int entrypoint, int fileKind, DWORD corhFlags, DWORD peFlags);
-#endif // FEATURE_CORECLR
-#ifndef FEATURE_CORECLR
- void AddDeclarativeSecurity(DWORD dwAction, void const *pValue, DWORD cbValue);
-
- IMetaDataAssemblyEmit *GetOnDiskMDAssemblyEmitter();
-#endif // FEATURE_CORECLR
//****************************************************************************************
@@ -714,13 +698,6 @@ public:
IWinMDImport *GetManifestWinMDImport();
#endif
-#ifndef FEATURE_CORECLR
- BOOL SupportsAutoNGen()
- {
- WRAPPER_NO_CONTRACT;
- return m_fSupportsAutoNGen;
- }
-#endif
protected:
@@ -797,15 +774,6 @@ private:
void CacheFriendAssemblyInfo();
-#ifndef FEATURE_CORECLR
- void GenerateBreadcrumbForServicing();
- void WriteBreadcrumb(const SString &ssDisplayName);
- bool HasServiceableAttribute();
- bool IsExistingOobAssembly();
- void CheckDenyList(const SString &ssDisplayName);
-
- BOOL SupportsAutoNGenWorker();
-#endif
PTR_BaseDomain m_pDomain; // Parent Domain
PTR_ClassLoader m_pClassLoader; // Single Loader
@@ -870,9 +838,6 @@ private:
DWORD m_dwReliabilityContract;
-#ifndef FEATURE_CORECLR
- BOOL m_fSupportsAutoNGen;
-#endif
};
typedef Assembly::ModuleIterator ModuleIterator;
@@ -923,25 +888,6 @@ public:
return IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies);
}
-#ifndef FEATURE_CORECLR
- //------------------------------------------------------------------------------
- // It is undesirable to reintroduce the concept of inquiring about friendship without specifying a member or type
- // but necessary for TP. In case of doubt, it's safer to return "true" as this won't affect
- // correctness (but might cause unnecessary ngen's when updating assemblies.)
- //------------------------------------------------------------------------------
- bool MightGrantFriendAccessTo(PEAssembly *pAccessingAssembly)
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- PRECONDITION(CheckPointer(pAccessingAssembly));
- }
- CONTRACTL_END;
-
- return IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies);
- }
-#endif // !FEATURE_CORECLR
bool IgnoresAccessChecksTo(Assembly *pAccessedAssembly)
{
@@ -977,25 +923,5 @@ private:
#endif // !DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-class ExistingOobAssemblyList
-{
-public:
-#ifndef DACCESS_COMPILE
- ExistingOobAssemblyList();
-
- bool IsOnlist(Assembly *pAssembly);
-
- static void Init();
- static ExistingOobAssemblyList *Instance() { return s_pInstance; }
-#endif
-
-private:
- ArrayList m_alExistingOobAssemblies;
-
- // The single instance of this class:
- static ExistingOobAssemblyList *s_pInstance;
-};
-#endif // !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
#endif
diff --git a/src/vm/assemblyname.cpp b/src/vm/assemblyname.cpp
index d7689e8b88..686527f8c2 100644
--- a/src/vm/assemblyname.cpp
+++ b/src/vm/assemblyname.cpp
@@ -62,15 +62,11 @@ FCIMPL1(Object*, AssemblyNameNative::GetFileInformation, StringObject* filenameU
EX_TRY
{
-#ifdef FEATURE_CORECLR
// Allow AssemblyLoadContext.GetAssemblyName for native images on CoreCLR
if (pImage->HasNTHeaders() && pImage->HasCorHeader() && pImage->HasNativeHeader())
pImage->VerifyIsNIAssembly();
else
pImage->VerifyIsAssembly();
-#else
- pImage->VerifyIsAssembly();
-#endif
}
EX_CATCH
{
@@ -84,9 +80,6 @@ FCIMPL1(Object*, AssemblyNameNative::GetFileInformation, StringObject* filenameU
AssemblySpec spec;
spec.InitializeSpec(TokenFromRid(mdtAssembly,1),pImage->GetMDImport(),NULL,TRUE);
-#ifndef FEATURE_CORECLR
- spec.SetCodeBase(sUrl);
-#endif
spec.AssemblyNameInit(&gc.result, pImage);
HELPER_METHOD_FRAME_END();
@@ -168,52 +161,6 @@ FCIMPL1(Object*, AssemblyNameNative::GetPublicKeyToken, Object* refThisUNSAFE)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-FCIMPL1(Object*, AssemblyNameNative::EscapeCodeBase, StringObject* filenameUNSAFE)
-{
- FCALL_CONTRACT;
-
- STRINGREF rv = NULL;
- STRINGREF filename = (STRINGREF) filenameUNSAFE;
- HELPER_METHOD_FRAME_BEGIN_RET_1(filename);
-
- LPWSTR pCodeBase = NULL;
- DWORD dwCodeBase = 0;
- CQuickBytes qb;
-
- if (filename != NULL) {
- WCHAR* pString;
- int iString;
- filename->RefInterpretGetStringValuesDangerousForGC(&pString, &iString);
- dwCodeBase = (DWORD) iString;
- pCodeBase = (LPWSTR) qb.AllocThrows((++dwCodeBase) * sizeof(WCHAR));
- memcpy(pCodeBase, pString, dwCodeBase*sizeof(WCHAR));
- }
-
- if(pCodeBase) {
- CQuickBytes qb2;
- DWORD dwEscaped = 1;
-
- DWORD flags = 0;
- if (RunningOnWin7())
- flags |= URL_ESCAPE_AS_UTF8;
-
- UrlEscape(pCodeBase, (LPWSTR) qb2.Ptr(), &dwEscaped, flags);
-
- LPWSTR result = (LPWSTR)qb2.AllocThrows((++dwEscaped) * sizeof(WCHAR));
- HRESULT hr = UrlEscape(pCodeBase, result, &dwEscaped, flags);
-
- if (SUCCEEDED(hr))
- rv = StringObject::NewString(result);
- else
- COMPlusThrowHR(hr);
- }
-
- HELPER_METHOD_FRAME_END();
- return OBJECTREFToObject(rv);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL4(void, AssemblyNameNative::Init, Object * refThisUNSAFE, OBJECTREF * pAssemblyRef, CLR_BOOL fForIntrospection, CLR_BOOL fRaiseResolveEvent)
{
diff --git a/src/vm/assemblynative.hpp b/src/vm/assemblynative.hpp
index 99f51e9837..a92198cb32 100644
--- a/src/vm/assemblynative.hpp
+++ b/src/vm/assemblynative.hpp
@@ -74,10 +74,6 @@ public:
static
INT32 QCALLTYPE GetHashAlgorithm(QCall::AssemblyHandle pAssembly);
-#ifndef FEATURE_CORECLR
- static
- BYTE QCALLTYPE GetSecurityRuleSet(QCall::AssemblyHandle pAssembly);
-#endif // !FEATURE_CORECLR
static
void QCALLTYPE GetSimpleName(QCall::AssemblyHandle pAssembly, QCall::StringHandleOnStack retSimpleName);
@@ -149,10 +145,6 @@ public:
static FCDECL1(ReflectModuleBaseObject *, GetOnDiskAssemblyModule, AssemblyBaseObject * pAssemblyUNSAFE);
static FCDECL1(ReflectModuleBaseObject *, GetInMemoryAssemblyModule, AssemblyBaseObject * pAssemblyUNSAFE);
-#ifndef FEATURE_CORECLR
- static
- FCDECL1(FC_BOOL_RET, IsGlobalAssemblyCache, AssemblyBaseObject* pAssemblyUNSAFE);
-#endif // !FEATURE_CORECLR
static
void QCALLTYPE GetGrantSet(QCall::AssemblyHandle pAssembly, QCall::ObjectHandleOnStack retGranted, QCall::ObjectHandleOnStack retDenied);
@@ -187,22 +179,6 @@ public:
static
void QCALLTYPE PrepareForSavingManifestToDisk(QCall::AssemblyHandle pAssembly, QCall::ModuleHandle pAssemblyModule);
-#ifndef FEATURE_CORECLR
- static
- void QCALLTYPE SaveManifestToDisk(QCall::AssemblyHandle pAssembly,
- LPCWSTR wszManifestFileName,
- INT32 entrypoint,
- INT32 fileKind,
- INT32 portableExecutableKind,
- INT32 imageFileMachine);
-
- static
- mdExportedType QCALLTYPE AddExportedTypeOnDisk(QCall::AssemblyHandle pAssembly, LPCWSTR wzzCOMTypeName, INT32 tkImpl, INT32 tkTypeDef, INT32 flags);
-
- static
- mdExportedType QCALLTYPE AddExportedTypeInMemory(QCall::AssemblyHandle pAssembly, LPCWSTR wzzCOMTypeName, INT32 tkImpl, INT32 tkTypeDef, INT32 flags);
-
-#endif // FEATURE_CORECLR
static
mdFile QCALLTYPE AddFile(QCall::AssemblyHandle pAssembly, LPCWSTR wszFileName);
@@ -216,22 +192,6 @@ public:
static
void QCALLTYPE AddDeclarativeSecurity(QCall::AssemblyHandle pAssembly, INT32 action, PVOID blob, INT32 length);
-#ifndef FEATURE_CORECLR
- static
- void QCALLTYPE CreateVersionInfoResource(LPCWSTR pwzFilename,
- LPCWSTR pwzTitle,
- LPCWSTR pwzIconFilename,
- LPCWSTR pwzDescription,
- LPCWSTR pwzCopyright,
- LPCWSTR pwzTrademark,
- LPCWSTR pwzCompany,
- LPCWSTR pwzProduct,
- LPCWSTR pwzProductVersion,
- LPCWSTR pwzFileVersion,
- INT32 lcid,
- BOOL fIsDll,
- QCall::StringHandleOnStack retFileName);
-#endif // !FEATURE_CORECLR
static
void QCALLTYPE GetRawBytes(QCall::AssemblyHandle pAssembly, QCall::ObjectHandleOnStack retRawBytes);
diff --git a/src/vm/assemblyspec.cpp b/src/vm/assemblyspec.cpp
index b9e94e8a81..004b1cb12c 100644
--- a/src/vm/assemblyspec.cpp
+++ b/src/vm/assemblyspec.cpp
@@ -252,13 +252,6 @@ HRESULT AssemblySpec::InitializeSpecInternal(mdToken kAssemblyToken,
if (pStaticParent != NULL)
{
// We dont validate this for CoreCLR as there is no good use-case for this scenario.
-#if !defined(FEATURE_CORECLR)
- // It is OK for signed assemblies to reference WinRT assemblies (.winmd files) that are not signed
- if (!IsContentType_WindowsRuntime() && pStaticParent->GetFile()->IsStrongNamed() && !IsStrongNamed())
- {
- ThrowHR(FUSION_E_PRIVATE_ASM_DISALLOWED);
- }
-#endif // !defined(FEATURE_CORECLR)
SetParentAssembly(pStaticParent);
}
@@ -378,7 +371,6 @@ void AssemblySpec::InitializeSpec(PEAssembly * pFile)
}
#endif //FEATURE_COMINTEROP
-#if defined(FEATURE_CORECLR)
// Set the binding context for the AssemblySpec
ICLRPrivBinder* pCurrentBinder = GetBindingContext();
ICLRPrivBinder* pExpectedBinder = pFile->GetBindingContext();
@@ -391,7 +383,6 @@ void AssemblySpec::InitializeSpec(PEAssembly * pFile)
_ASSERTE((pExpectedBinder != NULL) || pFile->IsSystem() || pFile->IsDynamic());
SetBindingContext(pExpectedBinder);
}
-#endif // defined(FEATURE_CORECLR)
}
#ifndef CROSSGEN_COMPILE
@@ -1206,7 +1197,6 @@ Assembly *AssemblySpec::LoadAssembly(FileLoadLevel targetLevel, AssemblyLoadSecu
return pDomainAssembly->GetAssembly();
}
-#if defined(FEATURE_CORECLR)
// Returns a BOOL indicating if the two Binder references point to the same
// binder instance.
BOOL AreSameBinderInstance(ICLRPrivBinder *pBinderA, ICLRPrivBinder *pBinderB)
@@ -1233,7 +1223,6 @@ BOOL AreSameBinderInstance(ICLRPrivBinder *pBinderA, ICLRPrivBinder *pBinderB)
return fIsSameInstance;
}
-#endif // defined(FEATURE_CORECLR)
ICLRPrivBinder* AssemblySpec::GetBindingContextFromParentAssembly(AppDomain *pDomain)
{
@@ -1360,78 +1349,6 @@ DomainAssembly *AssemblySpec::LoadDomainAssembly(FileLoadLevel targetLevel,
ETWOnStartup (LoaderCatchCall_V1, LoaderCatchCallEnd_V1);
AppDomain* pDomain = GetAppDomain();
-#ifndef FEATURE_CORECLR
- // Event Tracing for Windows is used to log data for performance and functional testing purposes.
- // The events in this function are used to help measure the performance of assembly loading as a whole for dynamic loads.
-
- // Special-purpose holder structure to ensure the LoaderPhaseEnd ETW event is fired when returning from function.
- struct ETWLoaderPhaseHolder
- {
- StackSString ETWCodeBase, ETWAssemblyName;
-
- DWORD _dwAppDomainId;
- BOOL initialized;
-
- ETWLoaderPhaseHolder()
- : _dwAppDomainId(ETWAppDomainIdNotAvailable)
- , initialized(FALSE)
- { }
-
- void Init(DWORD dwAppDomainId, LPCWSTR wszCodeBase, LPCSTR szAssemblyName)
- {
- _dwAppDomainId = dwAppDomainId;
-
- EX_TRY
- {
- if (wszCodeBase != NULL)
- {
- ETWCodeBase.Append(wszCodeBase);
- ETWCodeBase.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- }
- EX_CATCH
- {
- ETWCodeBase.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- EX_TRY
- {
- if (szAssemblyName != NULL)
- {
- ETWAssemblyName.AppendUTF8(szAssemblyName);
- ETWAssemblyName.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- }
- EX_CATCH
- {
- ETWAssemblyName.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- FireEtwLoaderPhaseStart(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderDynamicLoad, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, ETWAssemblyName.IsEmpty() ? NULL : (LPCWSTR)ETWAssemblyName, GetClrInstanceId());
-
- initialized = TRUE;
- }
-
- ~ETWLoaderPhaseHolder()
- {
- if (initialized)
- {
- FireEtwLoaderPhaseEnd(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderDynamicLoad, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, ETWAssemblyName.IsEmpty() ? NULL : (LPCWSTR)ETWAssemblyName, GetClrInstanceId());
- }
- }
- };
-
- ETWLoaderPhaseHolder loaderPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
-#ifdef FEATURE_FUSION
- loaderPhaseHolder.Init(pDomain->GetId().m_dwId, m_wszCodeBase, m_pAssemblyName);
-#else
- loaderPhaseHolder.Init(pDomain->GetId().m_dwId, NULL, NULL);
-#endif
- }
-#endif // FEATURE_CORECLR
DomainAssembly *pAssembly = nullptr;
@@ -1821,7 +1738,6 @@ void AssemblySpecBindingCache::Init(CrstBase *pCrst, LoaderHeap *pHeap)
m_pHeap = pHeap;
}
-#if defined(FEATURE_CORECLR)
AssemblySpecBindingCache::AssemblyBinding* AssemblySpecBindingCache::GetAssemblyBindingEntryForAssemblySpec(AssemblySpec* pSpec, BOOL fThrow)
{
CONTRACTL
@@ -1895,19 +1811,12 @@ AssemblySpecBindingCache::AssemblyBinding* AssemblySpecBindingCache::GetAssembly
return pEntry;
}
-#endif // defined(FEATURE_CORECLR)
BOOL AssemblySpecBindingCache::Contains(AssemblySpec *pSpec)
{
WRAPPER_NO_CONTRACT;
-#if !defined(FEATURE_CORECLR)
- DWORD key = pSpec->Hash();
- AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
- return (entry != (AssemblyBinding *) INVALIDENTRY);
-#else // defined(FEATURE_CORECLR)
return (GetAssemblyBindingEntryForAssemblySpec(pSpec, TRUE) != (AssemblyBinding *) INVALIDENTRY);
-#endif // !defined(FEATURE_CORECLR)
}
DomainAssembly *AssemblySpecBindingCache::LookupAssembly(AssemblySpec *pSpec,
@@ -1933,12 +1842,7 @@ DomainAssembly *AssemblySpecBindingCache::LookupAssembly(AssemblySpec *pSpec,
AssemblyBinding *entry = (AssemblyBinding *) INVALIDENTRY;
-#if !defined(FEATURE_CORECLR)
- DWORD key = pSpec->Hash();
- entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
-#else // defined(FEATURE_CORECLR)
entry = GetAssemblyBindingEntryForAssemblySpec(pSpec, fThrow);
-#endif // !defined(FEATURE_CORECLR)
if (entry == (AssemblyBinding *) INVALIDENTRY)
RETURN NULL;
@@ -1976,12 +1880,7 @@ PEAssembly *AssemblySpecBindingCache::LookupFile(AssemblySpec *pSpec, BOOL fThro
AssemblyBinding *entry = (AssemblyBinding *) INVALIDENTRY;
-#if !defined(FEATURE_CORECLR)
- DWORD key = pSpec->Hash();
- entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
-#else // defined(FEATURE_CORECLR)
entry = GetAssemblyBindingEntryForAssemblySpec(pSpec, fThrow);
-#endif // !defined(FEATURE_CORECLR)
if (entry == (AssemblyBinding *) INVALIDENTRY)
RETURN NULL;
@@ -2108,7 +2007,6 @@ BOOL AssemblySpecBindingCache::StoreAssembly(AssemblySpec *pSpec, DomainAssembly
UPTR key = (UPTR)pSpec->Hash();
-#if defined(FEATURE_CORECLR)
// On CoreCLR, we will use the BinderID as the key
ICLRPrivBinder* pBinderContextForLookup = pAssembly->GetFile()->GetBindingContext();
_ASSERTE(pBinderContextForLookup || pAssembly->GetFile()->IsSystem());
@@ -2124,7 +2022,6 @@ BOOL AssemblySpecBindingCache::StoreAssembly(AssemblySpec *pSpec, DomainAssembly
pSpec->SetBindingContext(pBinderContextForLookup);
}
}
-#endif // defined(FEATURE_CORECLR)
AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
@@ -2190,7 +2087,6 @@ BOOL AssemblySpecBindingCache::StoreFile(AssemblySpec *pSpec, PEAssembly *pFile)
UPTR key = (UPTR)pSpec->Hash();
-#if defined(FEATURE_CORECLR)
// On CoreCLR, we will use the BinderID as the key
ICLRPrivBinder* pBinderContextForLookup = pFile->GetBindingContext();
_ASSERTE(pBinderContextForLookup || pFile->IsSystem());
@@ -2206,7 +2102,6 @@ BOOL AssemblySpecBindingCache::StoreFile(AssemblySpec *pSpec, PEAssembly *pFile)
pSpec->SetBindingContext(pBinderContextForLookup);
}
}
-#endif // defined(FEATURE_CORECLR)
AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
@@ -2263,9 +2158,6 @@ BOOL AssemblySpecBindingCache::StoreException(AssemblySpec *pSpec, Exception* pE
UPTR key = (UPTR)pSpec->Hash();
-#if !defined(FEATURE_CORECLR)
- AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
-#else // defined(FEATURE_CORECLR)
AssemblyBinding *entry = GetAssemblyBindingEntryForAssemblySpec(pSpec, TRUE);
if (entry == (AssemblyBinding *) INVALIDENTRY)
{
@@ -2287,7 +2179,6 @@ BOOL AssemblySpecBindingCache::StoreException(AssemblySpec *pSpec, Exception* pE
}
}
}
-#endif // defined(FEATURE_CORECLR)
if (entry == (AssemblyBinding *) INVALIDENTRY) {
AssemblyBindingHolder abHolder;
diff --git a/src/vm/assemblyspec.hpp b/src/vm/assemblyspec.hpp
index d94a847124..2669f5234c 100644
--- a/src/vm/assemblyspec.hpp
+++ b/src/vm/assemblyspec.hpp
@@ -125,9 +125,6 @@ class AssemblySpec : public BaseAssemblySpec
HRESULT hr=InitializeSpecInternal(kAssemblyRefOrDef, pImport,pStaticParent,fIntrospectionOnly,TRUE);
if(FAILED(hr))
EEFileLoadException::Throw(this,hr);
-#ifndef FEATURE_CORECLR
- CloneFields();
-#endif
};
#ifdef FEATURE_FUSION
@@ -269,9 +266,6 @@ class AssemblySpec : public BaseAssemblySpec
BOOL fNgenExplicitBind = FALSE,
BOOL fExplicitBindToNativeImage = FALSE,
StackCrawlMark *pCallerStackMark = NULL );
-#ifndef FEATURE_CORECLR
- static VOID BindToSystem(BINDER_SPACE::Assembly** ppAssembly);
-#endif
#endif
Assembly *LoadAssembly(FileLoadLevel targetLevel,
@@ -653,9 +647,7 @@ class AssemblySpecBindingCache
PtrHashMap m_map;
LoaderHeap *m_pHeap;
-#if defined(FEATURE_CORECLR)
AssemblySpecBindingCache::AssemblyBinding* GetAssemblyBindingEntryForAssemblySpec(AssemblySpec* pSpec, BOOL fThrow);
-#endif // defined(FEATURE_CORECLR)
public:
@@ -683,7 +675,7 @@ class AssemblySpecBindingCache
return pSpec->Hash();
}
-#if defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE)
+#if !defined(DACCESS_COMPILE)
void GetAllAssemblies(SetSHash<PTR_DomainAssembly>& assemblyList)
{
PtrHashMap::PtrIterator i = m_map.begin();
diff --git a/src/vm/baseassemblyspec.cpp b/src/vm/baseassemblyspec.cpp
index 806416e923..09297f6db7 100644
--- a/src/vm/baseassemblyspec.cpp
+++ b/src/vm/baseassemblyspec.cpp
@@ -122,7 +122,6 @@ BOOL BaseAssemblySpec::IsMscorlib()
( (iNameLen == CoreLibNameLen) || (m_pAssemblyName[CoreLibNameLen] == ',') ) ) ) );
}
-#ifdef FEATURE_CORECLR
BOOL BaseAssemblySpec::IsAssemblySpecForMscorlib()
{
CONTRACTL
@@ -150,9 +149,6 @@ BOOL BaseAssemblySpec::IsAssemblySpecForMscorlib()
}
#define MSCORLIB_PUBLICKEY g_rbTheSilverlightPlatformKey
-#else
-#define MSCORLIB_PUBLICKEY g_rbNeutralPublicKey
-#endif
// A satellite assembly for mscorlib is named "mscorlib.resources" or
diff --git a/src/vm/baseassemblyspec.h b/src/vm/baseassemblyspec.h
index 0a21d95ee8..d27c90fb98 100644
--- a/src/vm/baseassemblyspec.h
+++ b/src/vm/baseassemblyspec.h
@@ -36,9 +36,7 @@ protected:
ICLRPrivBinder *m_pHostBinder;
int m_ownedFlags;
BOOL m_fIntrospectionOnly;
-#if defined(FEATURE_CORECLR)
ICLRPrivBinder *m_pBindingContext;
-#endif // defined(FEATURE_CORECLR)
public:
enum
@@ -76,7 +74,6 @@ public:
VOID CloneFieldsToLoaderHeap(int flags, LoaderHeap *pHeap, AllocMemTracker *pamTracker);
VOID CloneFieldsToStackingAllocator(StackingAllocator* alloc);
-#if defined(FEATURE_CORECLR)
inline void SetBindingContext(ICLRPrivBinder *pBindingContext)
{
LIMITED_METHOD_CONTRACT;
@@ -92,7 +89,6 @@ public:
}
BOOL IsAssemblySpecForMscorlib();
-#endif // defined(FEATURE_CORECLR)
HRESULT ParseName();
DWORD Hash();
diff --git a/src/vm/baseassemblyspec.inl b/src/vm/baseassemblyspec.inl
index 53c312f069..63107c6208 100644
--- a/src/vm/baseassemblyspec.inl
+++ b/src/vm/baseassemblyspec.inl
@@ -17,9 +17,7 @@
extern LocaleID g_lcid;
-#if defined(FEATURE_CORECLR)
BOOL AreSameBinderInstance(ICLRPrivBinder *pBinderA, ICLRPrivBinder *pBinderB);
-#endif // defined(FEATURE_CORECLR)
inline int BaseAssemblySpec::CompareStrings(LPCUTF8 string1, LPCUTF8 string2)
{
@@ -262,12 +260,10 @@ inline void BaseAssemblySpec::CopyFrom(const BaseAssemblySpec *pSpec)
m_pHostBinder = pSpec->m_pHostBinder;
-#ifdef FEATURE_CORECLR
if ((pSpec->m_ownedFlags & BAD_NAME_OWNED) != 0)
{
m_ownedFlags |= BAD_NAME_OWNED;
}
-#endif
#ifdef FEATURE_FUSION
IAssemblyName* pNameAfterPolicy=pSpec->GetNameAfterPolicy();
@@ -278,9 +274,7 @@ inline void BaseAssemblySpec::CopyFrom(const BaseAssemblySpec *pSpec)
}
#endif
-#if defined(FEATURE_CORECLR)
m_pBindingContext = pSpec->m_pBindingContext;
-#endif // defined(FEATURE_CORECLR)
}
@@ -294,10 +288,8 @@ inline DWORD BaseAssemblySpec::Hash()
MODE_ANY;
} CONTRACTL_END;
-#ifdef FEATURE_CORECLR
if(m_wszCodeBase)
return HashString(m_wszCodeBase);
-#endif
// Hash fields.
DWORD hash = 0;
@@ -312,11 +304,6 @@ inline DWORD BaseAssemblySpec::Hash()
hash ^= m_dwFlags;
hash = _rotl(hash, 4);
-#ifndef FEATURE_CORECLR
- if (m_wszCodeBase)
- hash ^= HashString(m_wszCodeBase);
- hash = _rotl(hash, 4);
-#endif
hash ^= m_context.usMajorVersion;
hash = _rotl(hash, 8);
@@ -364,42 +351,13 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
{
WRAPPER_NO_CONTRACT;
-#ifndef FEATURE_CORECLR
- _ASSERTE(pSpec != NULL);
-
- if ((m_dwFlags & afContentType_Mask) == (pSpec->m_dwFlags & afContentType_Mask))
- {
- if (IsContentType_WindowsRuntime() && pSpec->IsContentType_WindowsRuntime())
- {
- // If comparing assembly definitions, can not use bindability attributes as
- // a shortcut for equivalence, as this type of shortcut is only applicable
- // when comparing assembly references (not definitions).
- //
- // Example of why this is needed: native images still need to compare
- // assembly identities even if they are not bindable, because it needs to
- // ensure that the exact same assembly file (definition) is used at runtime
- // as was used during compilation.
- if ((dwCompareFlags & ASC_DefinitionEquality) != ASC_DefinitionEquality)
- {
- // WinRT assembly references are meaningless, they are all equal to each other
- return TRUE;
- }
- }
- }
- else
- {
- return FALSE;
- }
-#endif
-#ifdef FEATURE_CORECLR
if(m_wszCodeBase || pSpec->m_wszCodeBase)
{
if(!m_wszCodeBase || !pSpec->m_wszCodeBase)
return FALSE;
return wcscmp(m_wszCodeBase,(pSpec->m_wszCodeBase))==0;
}
-#endif
// Compare fields
#ifdef FEATURE_FUSION
@@ -418,12 +376,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
|| memcmp(m_pbPublicKeyOrToken, pSpec->m_pbPublicKeyOrToken, m_cbPublicKeyOrToken))
return FALSE;
-#ifndef FEATURE_CORECLR
- if (m_wszCodeBase != pSpec->m_wszCodeBase
- && (m_wszCodeBase == NULL || pSpec->m_wszCodeBase == NULL
- || wcscmp(m_wszCodeBase, pSpec->m_wszCodeBase)))
- return FALSE;
-#endif
if (m_dwFlags != pSpec->m_dwFlags)
return FALSE;
@@ -465,7 +417,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
}
#endif
-#if defined(FEATURE_CORECLR)
// If the assemblySpec contains the binding context, then check if they match.
if (!(pSpec->IsAssemblySpecForMscorlib() && IsAssemblySpecForMscorlib()))
{
@@ -474,7 +425,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
return FALSE;
}
}
-#endif // defined(FEATURE_CORECLR)
return TRUE;
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index c95fbac16e..c89e7a641e 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -4260,14 +4260,12 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void)
SafeComHolder<ISymUnmanagedBinder> pBinder;
-#if defined(FEATURE_CORECLR)
if (g_pDebugInterface == NULL)
{
// @TODO: this is reachable when debugging!
UNREACHABLE_MSG("About to CoCreateInstance! This code should not be "
"reachable or needs to be reimplemented for CoreCLR!");
}
-#endif // FEATURE_CORECLR
if (this->GetInMemorySymbolStreamFormat() == eSymbolFormatILDB)
{
@@ -4286,21 +4284,13 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void)
// On desktop, the framework installer is supposed to install diasymreader.dll as well
// and so this shouldn't happen.
hr = FakeCoCreateInstanceEx(CLSID_CorSymBinder_SxS,
-#ifdef FEATURE_CORECLR
NATIVE_SYMBOL_READER_DLL,
-#else
- GetInternalSystemDirectory(),
-#endif
IID_ISymUnmanagedBinder,
(void**)&pBinder,
NULL);
if (FAILED(hr))
{
-#ifdef FEATURE_CORECLR
RETURN (NULL);
-#else
- ThrowHR(hr);
-#endif
}
}
@@ -5840,7 +5830,6 @@ Module::GetAssemblyIfLoaded(
continue;
}
-#if defined(FEATURE_CORECLR)
// If we have been passed the binding context for the loaded assembly that is being looked up in the
// cache, then set it up in the AssemblySpec for the cache lookup to use it below.
if (pBindingContextForLoadedAssembly != NULL)
@@ -5848,7 +5837,6 @@ Module::GetAssemblyIfLoaded(
_ASSERTE(spec.GetBindingContext() == NULL);
spec.SetBindingContext(pBindingContextForLoadedAssembly);
}
-#endif // defined(FEATURE_CORECLR)
DomainAssembly * pDomainAssembly = nullptr;
#ifdef FEATURE_APPX_BINDER
@@ -6154,7 +6142,6 @@ DomainAssembly * Module::LoadAssembly(
szWinRtTypeClassName);
AssemblySpec spec;
spec.InitializeSpec(kAssemblyRef, GetMDImport(), GetDomainFile(GetAppDomain())->GetDomainAssembly(), IsIntrospectionOnly());
-#if defined(FEATURE_CORECLR)
// Set the binding context in the AssemblySpec if one is available. This can happen if the LoadAssembly ended up
// invoking the custom AssemblyLoadContext implementation that returned a reference to an assembly bound to a different
// AssemblyLoadContext implementation.
@@ -6163,7 +6150,6 @@ DomainAssembly * Module::LoadAssembly(
{
spec.SetBindingContext(pBindingContext);
}
-#endif // defined(FEATURE_CORECLR)
if (szWinRtTypeClassName != NULL)
{
spec.SetWindowsRuntimeType(szWinRtTypeNamespace, szWinRtTypeClassName);
@@ -15794,7 +15780,6 @@ LPCWSTR Module::GetPathForErrorMessages()
}
}
-#ifdef FEATURE_CORECLR
#ifndef DACCESS_COMPILE
BOOL IsVerifiableWrapper(MethodDesc* pMD)
{
@@ -15887,7 +15872,6 @@ void Module::VerifyAllMethods()
EEFileLoadException::Throw(GetFile(), COR_E_VERIFICATION);
#endif //DACCESS_COMPILE
}
-#endif //FEATURE_CORECLR
#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && !defined(CROSS_COMPILE)
diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h
index d15bd6b3d1..fad76a6594 100644
--- a/src/vm/ceeload.h
+++ b/src/vm/ceeload.h
@@ -95,7 +95,6 @@ class PersistentInlineTrackingMap;
#define GUID_TO_TYPE_HASH_BUCKETS 16
// The native symbol reader dll name
-#ifdef FEATURE_CORECLR
#if defined(_AMD64_)
#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.amd64.dll")
#elif defined(_X86_)
@@ -107,9 +106,6 @@ class PersistentInlineTrackingMap;
//#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.arm64.dll")
#define NATIVE_SYMBOL_READER_DLL W("diasymreader.dll")
#endif
-#else
-#define NATIVE_SYMBOL_READER_DLL W("diasymreader.dll")
-#endif
typedef DPTR(PersistentInlineTrackingMap) PTR_PersistentInlineTrackingMap;
@@ -3449,9 +3445,7 @@ public:
}
#endif // !DACCESS_COMPILE && FEATURE_CER
-#ifdef FEATURE_CORECLR
void VerifyAllMethods();
-#endif //FEATURE_CORECLR
CrstBase *GetLookupTableCrst()
{
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp
index ca819ecbfd..1fc086d3a4 100644
--- a/src/vm/ceemain.cpp
+++ b/src/vm/ceemain.cpp
@@ -213,10 +213,6 @@
#include "bbsweep.h"
-#ifndef FEATURE_CORECLR
-#include <metahost.h>
-#include "assemblyusagelogmanager.h"
-#endif
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
@@ -284,12 +280,6 @@ HRESULT PrepareExecuteDLLForThunk(HINSTANCE hInst,
DWORD dwReason,
LPVOID lpReserved);
#endif // FEATURE_MIXEDMODE
-#ifndef FEATURE_CORECLR
-BOOL STDMETHODCALLTYPE ExecuteDLL(HINSTANCE hInst,
- DWORD dwReason,
- LPVOID lpReserved,
- BOOL fFromThunk);
-#endif // !FEATURE_CORECLR
BOOL STDMETHODCALLTYPE ExecuteEXE(HMODULE hMod);
BOOL STDMETHODCALLTYPE ExecuteEXE(__in LPWSTR pImageNameIn);
@@ -305,12 +295,6 @@ extern "C" HRESULT __cdecl CorDBGetInterface(DebugInterface** rcInterface);
#endif // !CROSSGEN_COMPILE
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-
-// Pointer to the activated CLR interface provided by the shim.
-ICLRRuntimeInfo *g_pCLRRuntime = NULL;
-
-#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
extern "C" IExecutionEngine* __stdcall IEE();
@@ -391,7 +375,7 @@ HRESULT EnsureEEStarted(COINITIEE flags)
{
BEGIN_ENTRYPOINT_NOTHROW;
-#if defined(FEATURE_CORECLR) && defined(FEATURE_APPX) && !defined(CROSSGEN_COMPILE)
+#if defined(FEATURE_APPX) && !defined(CROSSGEN_COMPILE)
STARTUP_FLAGS startupFlags = CorHost2::GetStartupFlags();
// On CoreCLR, the host is in charge of determining whether the process is AppX or not.
AppX::SetIsAppXProcess(!!(startupFlags & STARTUP_APPX_APP_MODEL));
@@ -528,58 +512,7 @@ static BOOL WINAPI DbgCtrlCHandler(DWORD dwCtrlType)
// A host can specify that it only wants one version of hosting interface to be used.
BOOL g_singleVersionHosting;
-#ifndef FEATURE_CORECLR
-HRESULT STDMETHODCALLTYPE
-SetRuntimeInfo(
- IUnknown * pUnk,
- STARTUP_FLAGS dwStartupFlags,
- LPCWSTR pwzHostConfig,
- const CoreClrCallbacks ** ppClrCallbacks)
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- ENTRY_POINT;
- PRECONDITION(CheckPointer(pUnk));
- PRECONDITION(CheckPointer(pwzHostConfig, NULL_OK));
- } CONTRACTL_END;
-
- ICLRRuntimeInfo *pRuntime;
- HRESULT hr;
-
- IfFailGo(pUnk->QueryInterface(IID_ICLRRuntimeInfo, (LPVOID *)&pRuntime));
-
- IfFailGo(CorHost2::SetFlagsAndHostConfig(dwStartupFlags, pwzHostConfig, FALSE));
-
- if (InterlockedCompareExchangeT(&g_pCLRRuntime, pRuntime, NULL) != NULL)
- {
- // already set, release this one
- pRuntime->Release();
- }
- *ppClrCallbacks = &GetClrCallbacks();
-
-ErrExit:
- return hr;
-}
-#endif // !FEATURE_CORECLR
-
-#ifndef FEATURE_CORECLR
-HRESULT InitializeHostConfigFile()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(return E_OUTOFMEMORY);
- } CONTRACTL_END;
-
- g_pszHostConfigFile = CorHost2::GetHostConfigFile();
- g_dwHostConfigFile = (g_pszHostConfigFile == NULL ? 0 : wcslen(g_pszHostConfigFile));
- return S_OK;
-}
-#endif // !FEATURE_CORECLR
void InitializeStartupFlags()
{
@@ -591,54 +524,12 @@ void InitializeStartupFlags()
STARTUP_FLAGS flags = CorHost2::GetStartupFlags();
-#ifndef FEATURE_CORECLR
- // If we are running under a requested performance default mode, honor any changes to startup flags
- // In the future, we could make this conditional on the host telling us which subset of flags is
- // valid to override. See file:PerfDefaults.h
- flags = PerformanceDefaults::GetModifiedStartupFlags(flags);
-#endif // !FEATURE_CORECLR
if (flags & STARTUP_CONCURRENT_GC)
g_IGCconcurrent = 1;
else
g_IGCconcurrent = 0;
-#ifndef FEATURE_CORECLR // TODO: We can remove this. Retaining it now just to be safe
- if (flags & STARTUP_SINGLE_VERSION_HOSTING_INTERFACE)
- {
- g_singleVersionHosting = TRUE;
- }
-
-#ifndef FEATURE_CORECLR
- g_pConfig->SetDisableCommitThreadStack(!CLRHosted() || (flags & STARTUP_DISABLE_COMMITTHREADSTACK));
-#else
- g_pConfig->SetDisableCommitThreadStack(true);
-#endif
-
- if(flags & STARTUP_LEGACY_IMPERSONATION)
- g_pConfig->SetLegacyImpersonationPolicy();
-
- if(flags & STARTUP_ALWAYSFLOW_IMPERSONATION)
- g_pConfig->SetAlwaysFlowImpersonationPolicy();
-
- if(flags & STARTUP_HOARD_GC_VM)
- g_IGCHoardVM = 1;
- else
- g_IGCHoardVM = 0;
-
-#ifdef GCTRIMCOMMIT
- if (flags & STARTUP_TRIM_GC_COMMIT)
- g_IGCTrimCommit = 1;
- else
- g_IGCTrimCommit = 0;
-#endif
-
- if(flags & STARTUP_ETW)
- g_fEnableETW = TRUE;
-
- if(flags & STARTUP_ARM)
- g_fEnableARM = TRUE;
-#endif // !FEATURE_CORECLR
InitializeHeapType((flags & STARTUP_SERVER_GC) != 0);
@@ -740,37 +631,6 @@ void InitGSCookie()
}
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-void InitAssemblyUsageLogManager()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- g_pIAssemblyUsageLogGac = NULL;
-
- AssemblyUsageLogManager::Config config;
-
- config.wszLogDir = NULL;
- config.cLogBufferSize = 32768;
-#ifdef FEATURE_APPX
- config.uiLogRefreshInterval = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenAssemblyUsageLogRefreshInterval);
-#endif
-
- NewArrayHolder<WCHAR> szCustomLogDir(CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenAssemblyUsageLog));
- config.wszLogDir = szCustomLogDir;
-
- AssemblyUsageLogManager::Init(&config);
-
- // Once the logger is initialized, create a log object for logging GAC loads.
- AssemblyUsageLogManager::GetUsageLogForContext(W("fusion"), W("GAC"), &g_pIAssemblyUsageLogGac);
-}
-#endif
// ---------------------------------------------------------------------------
// %%Function: EEStartupHelper
@@ -845,10 +705,6 @@ void EEStartupHelper(COINITIEE fFlags)
if (!g_pConfig)
{
IfFailGo(EEConfig::Setup());
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- IfFailGo(InitializeHostConfigFile());
- IfFailGo(g_pConfig->SetupConfiguration());
-#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
}
#ifndef CROSSGEN_COMPILE
@@ -858,11 +714,6 @@ void EEStartupHelper(COINITIEE fFlags)
NumaNodeInfo::InitNumaNodeInfo();
CPUGroupInfo::EnsureInitialized();
-#ifndef FEATURE_CORECLR
- // Check in EEConfig whether a workload-specific set of performance defaults have been requested
- // This needs to be done before InitializeStartupFlags in case one is to be overridden
- PerformanceDefaults::InitializeForScenario(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerformanceScenario));
-#endif
// Initialize global configuration settings based on startup flags
// This needs to be done before the EE has started
@@ -897,10 +748,6 @@ void EEStartupHelper(COINITIEE fFlags)
#endif // CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- // Ensure initialization of Apphacks environment variables
- GetGlobalCompatibilityFlags();
-#endif // !FEATURE_CORECLR
#ifdef STRESS_LOG
if (REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_StressLog, g_pConfig->StressLog ()) != 0) {
@@ -988,16 +835,6 @@ void EEStartupHelper(COINITIEE fFlags)
#ifndef CROSSGEN_COMPILE
-#if defined(STRESS_HEAP) && defined(_DEBUG) && !defined(FEATURE_CORECLR)
- // TODO: is this still an issue?
- // There is a race that causes random AVs on dual proc boxes
- // that we suspect is due to memory coherancy problems (see Whidbey bug 2360)
- // Avoid the issue by making the box effectively single proc.
- if (GCStress<cfg_instr>::IsEnabled() &&
- g_SystemInfo.dwNumberOfProcessors > 1)
- SetProcessAffinityMask(GetCurrentProcess(),
- 1 << (DbgGetEXETimeStamp() % g_SystemInfo.dwNumberOfProcessors));
-#endif // STRESS_HEAP && _DEBUG && !FEATURE_CORECLR
#ifdef FEATURE_PREJIT
// Initialize the sweeper thread. THis is violating our rules with hosting
@@ -1099,10 +936,6 @@ void EEStartupHelper(COINITIEE fFlags)
GCInterface::m_MemoryPressureLock.Init(CrstGCMemoryPressure);
-#ifndef FEATURE_CORECLR
- // Initialize Assembly Usage Logger
- InitAssemblyUsageLogManager();
-#endif
#endif // CROSSGEN_COMPILE
@@ -1239,9 +1072,6 @@ void EEStartupHelper(COINITIEE fFlags)
SystemDomain::System()->PublishAppDomainAndInformDebugger(SystemDomain::System()->DefaultDomain());
#endif
-#ifndef FEATURE_CORECLR
- ExistingOobAssemblyList::Init();
-#endif
#endif // CROSSGEN_COMPILE
@@ -1329,12 +1159,10 @@ void EEStartupHelper(COINITIEE fFlags)
}
//For a similar reason, let's not run VerifyAllOnLoad either.
-#ifdef FEATURE_CORECLR
if (g_pConfig->VerifyModulesOnLoad())
{
SystemDomain::SystemModule()->VerifyAllMethods();
}
-#endif //FEATURE_CORECLR
// Perform mscorlib consistency check if requested
g_Mscorlib.CheckExtended();
@@ -1595,11 +1423,6 @@ static void ExternalShutdownHelper(int exitCode, ShutdownCompleteAction sca)
// process exit code. This can be modified by the app via System.SetExitCode().
SetLatchedExitCode(exitCode);
-#ifndef FEATURE_CORECLR // no shim
- // Bump up the ref-count on the module
- for (int i =0; i<6; i++)
- CLRLoadLibrary(MSCOREE_SHIM_W);
-#endif // FEATURE_CORECLR
ForceEEShutdown(sca);
@@ -1671,12 +1494,6 @@ BOOL IsRuntimeStarted(DWORD *pdwStartupFlags)
if (pdwStartupFlags != NULL) // this parameter is optional
{
*pdwStartupFlags = 0;
-#ifndef FEATURE_CORECLR
- if (g_fEEStarted)
- {
- *pdwStartupFlags = CorHost2::GetStartupFlags();
- }
-#endif
}
return g_fEEStarted;
}
@@ -1869,14 +1686,6 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
fFinalizeOK = FinalizerThread::FinalizerThreadWatchDog();
}
-#ifndef FEATURE_CORECLR
- if (!g_fFastExitProcess)
- {
- // Log usage data to disk. (Only do this in normal shutdown scenarios, and not involving ngen)
- if (!IsCompilationProcess())
- AssemblyUsageLogManager::GenerateLog(AssemblyUsageLogManager::GENERATE_LOG_FLAGS_NONE);
- }
-#endif
// Ok. Let's stop the EE.
if (!g_fProcessDetach)
@@ -1990,22 +1799,6 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
}
#endif // PROFILING_SUPPORTED
-#ifndef FEATURE_CORECLR
- // CoEEShutDownCOM moved to
- // the Finalizer thread. See bug 87809
- if (!g_fProcessDetach && !g_fFastExitProcess)
- {
- g_fEEShutDown |= ShutDown_COM;
- if (fFinalizeOK)
- {
- FinalizerThread::FinalizerThreadWatchDog();
- }
- }
-#ifdef _DEBUG
- else
- g_fEEShutDown |= ShutDown_COM;
-#endif
-#endif //FEATURE_CORECLR
#ifdef _DEBUG
g_fEEShutDown |= ShutDown_SyncBlock;
@@ -2662,75 +2455,6 @@ void STDMETHODCALLTYPE CoUninitializeEE(BOOL fIsDllUnloading)
}
-#ifndef FEATURE_CORECLR
-//*****************************************************************************
-// This entry point is called from the native DllMain of the loaded image.
-// This gives the COM+ loader the chance to dispatch the loader event. The
-// first call will cause the loader to look for the entry point in the user
-// image. Subsequent calls will dispatch to either the user's DllMain or
-// their Module derived class.
-//*****************************************************************************
-BOOL STDMETHODCALLTYPE _CorDllMain( // TRUE on success, FALSE on error.
- HINSTANCE hInst, // Instance handle of the loaded module.
- DWORD dwReason, // Reason for loading.
- LPVOID lpReserved // Unused.
- )
-{
- STATIC_CONTRACT_NOTHROW;
- //STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- //BEGIN_ENTRYPOINT_NOTHROW;
-
- struct Param
- {
- HINSTANCE hInst;
- DWORD dwReason;
- LPVOID lpReserved;
- BOOL retval;
- } param;
- param.hInst = hInst;
- param.dwReason = dwReason;
- param.lpReserved = lpReserved;
- param.retval = FALSE;
-
- // Can't use PAL_TRY/EX_TRY here as they access the ClrDebugState which gets blown away as part of the
- // PROCESS_DETACH path. Must use special PAL_TRY_FOR_DLLMAIN, passing the reason were in the DllMain.
- PAL_TRY_FOR_DLLMAIN(Param *, pParam, &param, pParam->dwReason)
- {
-#ifdef _DEBUG
- if (CLRTaskHosted() &&
- ((pParam->dwReason == DLL_PROCESS_ATTACH && pParam->lpReserved == NULL) || // LoadLibrary of a managed dll
- (pParam->dwReason == DLL_PROCESS_DETACH && pParam->lpReserved == NULL) // FreeLibrary of a managed dll
- )) {
- // OS loader lock is being held by the current thread. We can not allow the fiber
- // to be rescheduled here while processing DllMain for managed dll.
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTask *pTask = GetCurrentHostTask();
- if (pTask) {
- Thread *pThread = GetThread();
- _ASSERTE (pThread);
- _ASSERTE (pThread->HasThreadAffinity());
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
- }
-#endif
- // Since we're in _CorDllMain, we know that we were not called because of a
- // bootstrap thunk, since they will call CorDllMainForThunk. Because of this,
- // we can pass FALSE for the fFromThunk parameter.
- pParam->retval = ExecuteDLL(pParam->hInst,pParam->dwReason,pParam->lpReserved, FALSE);
- }
- PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- }
- PAL_ENDTRY;
-
- //END_ENTRYPOINT_NOTHROW;
-
- return param.retval;
-}
-
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_MIXEDMODE
//*****************************************************************************
@@ -2779,334 +2503,6 @@ void STDMETHODCALLTYPE CorDllMainForThunk(HINSTANCE hInst, HINSTANCE hInstShim)
#endif // FEATURE_MIXEDMODE
-#ifndef FEATURE_CORECLR
-
-// This function will do some additional PE Checks to make sure everything looks good.
-// We must do these before we run any managed code (that's why we can't do them in PEVerifier, as
-// managed code is used to determine the policy settings)
-HRESULT DoAdditionalPEChecks(HINSTANCE hInst)
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_TRIGGERS;
-
- struct Param
- {
- HINSTANCE hInst;
- HRESULT hr;
- } param;
- param.hInst = hInst;
- param.hr = S_OK;
-
- PAL_TRY(Param *, pParam, &param)
- {
- PEDecoder pe(pParam->hInst);
-
- if (!pe.CheckWillCreateGuardPage())
- pParam->hr = COR_E_BADIMAGEFORMAT;
- }
- PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- }
- PAL_ENDTRY
-
- return param.hr;
-}
-
-//*****************************************************************************
-// This entry point is called from the native entry point of the loaded
-// executable image. This simply calls into _CorExeMainInternal, the real
-// entry point inside a filter to trigger unhandled exception processing in the
-// event an exception goes unhandled, independent of the OS UEF mechanism.
-//*****************************************************************************
-__int32 STDMETHODCALLTYPE _CorExeMain( // Executable exit code.
- )
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
-
- // We really have nothing to share with our filter at this point.
- struct Param
- {
- PVOID pData;
- } param;
- param.pData = NULL;
-
- PAL_TRY(Param*, _pParam, &param)
- {
- // Call the real function that will invoke the managed entry point
- _CorExeMainInternal();
- }
- PAL_EXCEPT_FILTER(EntryPointFilter)
- {
- LOG((LF_STARTUP, LL_INFO10, "EntryPointFilter returned EXCEPTION_EXECUTE_HANDLER!"));
- }
- PAL_ENDTRY;
-
- return 0;
-}
-
-//*****************************************************************************
-// This entry point is called from _CorExeMain. If an exception goes unhandled
-// from here, we will trigger unhandled exception processing in _CorExeMain.
-//
-// The command line arguments and other entry point data
-// will be gathered here. The entry point for the user image will be found
-// and handled accordingly.
-//*****************************************************************************
-__int32 STDMETHODCALLTYPE _CorExeMainInternal( // Executable exit code.
- )
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- // Yes, CorExeMain needs throws. If an exception passes through here, it will cause the
- // "The application has generated an unhandled exception" dialog and offer to debug.
-
- BEGIN_ENTRYPOINT_THROWS;
-
- // Make sure PE file looks ok
- HRESULT hr;
- {
- // We are early in the process, if we get an SO here we will just rip
- CONTRACT_VIOLATION(SOToleranceViolation);
- if (FAILED(hr = DoAdditionalPEChecks(WszGetModuleHandle(NULL))))
- {
- GCX_PREEMP();
- VMDumpCOMErrors(hr);
- SetLatchedExitCode (-1);
- goto exit;
- }
- }
-
- g_fEEManagedEXEStartup = TRUE;
- // Before we initialize the EE, make sure we've snooped for all EE-specific
- // command line arguments that might guide our startup.
- WCHAR *pCmdLine = WszGetCommandLine();
- HRESULT result = CorCommandLine::SetArgvW(pCmdLine);
-
- if (SUCCEEDED(result))
- {
- g_fWeOwnProcess = TRUE;
- result = EnsureEEStarted(COINITEE_MAIN);
- }
-
- if (FAILED(result))
- {
- g_fWeOwnProcess = FALSE;
- GCX_PREEMP();
- VMDumpCOMErrors(result);
- SetLatchedExitCode (-1);
- goto exit;
- }
-
- INSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
- // This will be called from a EXE so this is a self referential file so I am going to call
- // ExecuteEXE which will do the work to make a EXE load.
-
- BOOL bretval = 0;
-
- bretval = ExecuteEXE(WszGetModuleHandle(NULL));
- if (!bretval) {
- // The only reason I've seen this type of error in the wild is bad
- // metadata file format versions and inadequate error handling for
- // partially signed assemblies. While this may happen during
- // development, our customers should not get here. This is a back-stop
- // to catch CLR bugs. If you see this, please try to find a better way
- // to handle your error, like throwing an unhandled exception.
- EEMessageBoxCatastrophic(IDS_EE_COREXEMAIN_FAILED_TEXT, IDS_EE_COREXEMAIN_FAILED_TITLE);
- SetLatchedExitCode (-1);
- }
-
- UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
-exit:
- STRESS_LOG1(LF_STARTUP, LL_ALWAYS, "Program exiting: return code = %d", GetLatchedExitCode());
-
- STRESS_LOG0(LF_STARTUP, LL_INFO10, "EEShutDown invoked from _CorExeMainInternal");
-
- EEPolicy::HandleExitProcess();
-
- END_ENTRYPOINT_THROWS;
-
- return 0;
-}
-
-
-static BOOL CacheCommandLine(__in LPWSTR pCmdLine, __in_opt LPWSTR* ArgvW)
-{
- CONTRACTL {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- PRECONDITION(CheckPointer(pCmdLine));
- PRECONDITION(CheckPointer(ArgvW));
- } CONTRACTL_END;
-
- if (pCmdLine) {
- size_t len = wcslen(pCmdLine);
-
- _ASSERT(g_pCachedCommandLine== NULL);
- g_pCachedCommandLine = new WCHAR[len+1];
- wcscpy_s(g_pCachedCommandLine, len+1, pCmdLine);
- }
-
- if (ArgvW != NULL && ArgvW[0] != NULL) {
- PathString wszModuleName;
- PathString wszCurDir;
- if (!WszGetCurrentDirectory(wszCurDir))
- return FALSE;
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable:25025)
-#endif
-
- // usage of PathCombine is safe if we ensure that buffer specified by
- // parameter1 can accomodate buffers specified by paramater2, parameter3
- // and one path separator
- COUNT_T wszModuleName_len = wszCurDir.GetCount() + lstrlenW(ArgvW[0]);
- WCHAR* wszModuleName_buf = wszModuleName.OpenUnicodeBuffer(wszModuleName_len);
-
- if (PathCombine(wszModuleName_buf, wszCurDir, ArgvW[0]) == NULL)
- return FALSE;
- wszModuleName.CloseBuffer();
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
- size_t len = wszModuleName.GetCount();
- _ASSERT(g_pCachedModuleFileName== NULL);
- g_pCachedModuleFileName = new WCHAR[len+1];
- wcscpy_s(g_pCachedModuleFileName, len+1, wszModuleName);
- }
-
- return TRUE;
-}
-
-//*****************************************************************************
-// This entry point is called from the native entry point of the loaded
-// executable image. The command line arguments and other entry point data
-// will be gathered here. The entry point for the user image will be found
-// and handled accordingly.
-//*****************************************************************************
-__int32 STDMETHODCALLTYPE _CorExeMain2( // Executable exit code.
- PBYTE pUnmappedPE, // -> memory mapped code
- DWORD cUnmappedPE, // Size of memory mapped code
- __in LPWSTR pImageNameIn, // -> Executable Name
- __in LPWSTR pLoadersFileName, // -> Loaders Name
- __in LPWSTR pCmdLine) // -> Command Line
-{
-
- // This entry point is used by clix
- BOOL bRetVal = 0;
-
- BEGIN_ENTRYPOINT_VOIDRET;
- {
- // Before we initialize the EE, make sure we've snooped for all EE-specific
- // command line arguments that might guide our startup.
- HRESULT result = CorCommandLine::SetArgvW(pCmdLine);
-
- if (!CacheCommandLine(pCmdLine, CorCommandLine::GetArgvW(NULL))) {
- LOG((LF_STARTUP, LL_INFO10, "Program exiting - CacheCommandLine failed\n"));
- bRetVal = -1;
- goto exit;
- }
-
- if (SUCCEEDED(result))
- result = InitializeEE(COINITEE_MAIN);
-
- if (FAILED(result)) {
- VMDumpCOMErrors(result);
- SetLatchedExitCode (-1);
- goto exit;
- }
-
- // Load the executable
- bRetVal = ExecuteEXE(pImageNameIn);
-
- if (!bRetVal) {
- // The only reason I've seen this type of error in the wild is bad
- // metadata file format versions and inadequate error handling for
- // partially signed assemblies. While this may happen during
- // development, our customers should not get here. This is a back-stop
- // to catch CLR bugs. If you see this, please try to find a better way
- // to handle your error, like throwing an unhandled exception.
- EEMessageBoxCatastrophic(IDS_EE_COREXEMAIN2_FAILED_TEXT, IDS_EE_COREXEMAIN2_FAILED_TITLE);
- SetLatchedExitCode (-1);
- }
-
-exit:
- STRESS_LOG1(LF_STARTUP, LL_ALWAYS, "Program exiting: return code = %d", GetLatchedExitCode());
-
- STRESS_LOG0(LF_STARTUP, LL_INFO10, "EEShutDown invoked from _CorExeMain2");
-
- EEPolicy::HandleExitProcess();
- }
- END_ENTRYPOINT_VOIDRET;
-
- return bRetVal;
-}
-
-//*****************************************************************************
-// This is the call point to wire up an EXE. In this case we have the HMODULE
-// and just need to make sure we do to correct self referantial things.
-//*****************************************************************************
-
-
-BOOL STDMETHODCALLTYPE ExecuteEXE(HMODULE hMod)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
-
- _ASSERTE(hMod);
- if (!hMod)
- return FALSE;
-
- ETWFireEvent(ExecExe_V1);
-
- struct Param
- {
- HMODULE hMod;
- } param;
- param.hMod = hMod;
-
- EX_TRY_NOCATCH(Param *, pParam, &param)
- {
- // Executables are part of the system domain
- SystemDomain::ExecuteMainMethod(pParam->hMod);
- }
- EX_END_NOCATCH;
-
- ETWFireEvent(ExecExeEnd_V1);
-
- return TRUE;
-}
-
-BOOL STDMETHODCALLTYPE ExecuteEXE(__in LPWSTR pImageNameIn)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
-
- EX_TRY_NOCATCH(LPWSTR, pImageNameInner, pImageNameIn)
- {
- WCHAR wzPath[MAX_LONGPATH];
- DWORD dwPathLength = 0;
-
- // get the path of executable
- dwPathLength = WszGetFullPathName(pImageNameInner, MAX_LONGPATH, wzPath, NULL);
-
- if (!dwPathLength || dwPathLength > MAX_LONGPATH)
- {
- ThrowWin32( !dwPathLength ? GetLastError() : ERROR_FILENAME_EXCED_RANGE);
- }
-
- SystemDomain::ExecuteMainMethod( NULL, (WCHAR *)wzPath );
- }
- EX_END_NOCATCH;
-
- return TRUE;
-}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_MIXEDMODE
@@ -3449,31 +2845,6 @@ BOOL ExecuteDLL_ReturnOrThrow(HRESULT hr, BOOL fFromThunk)
return SUCCEEDED(hr);
}
-#if !defined(FEATURE_CORECLR) && defined(_DEBUG)
-//*****************************************************************************
-// Factor some common debug code.
-//*****************************************************************************
-static void EnsureManagedThreadExistsForHostedThread()
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- } CONTRACTL_END;
-
- if (CLRTaskHosted()) {
- // If CLR is hosted, and this is on a thread that a host controls,
- // we must have created Thread object.
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTask *pHostTask = GetCurrentHostTask();
- if (pHostTask)
- {
- CONSISTENCY_CHECK(CheckPointer(GetThread()));
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
- }
-}
-#endif // !FEATURE_CORECLR && _DEBUG
#ifdef FEATURE_MIXEDMODE
//*****************************************************************************
@@ -3520,161 +2891,6 @@ HRESULT PrepareExecuteDLLForThunk(HINSTANCE hInst,
#endif // FEATURE_MIXEDMODE
-#ifndef FEATURE_CORECLR
-//*****************************************************************************
-// This is the call point to make a DLL that is already loaded into our address
-// space run. There will be other code to actually have us load a DLL due to a
-// class reference.
-//*****************************************************************************
-BOOL STDMETHODCALLTYPE ExecuteDLL(HINSTANCE hInst,
- DWORD dwReason,
- LPVOID lpReserved,
- BOOL fFromThunk)
-{
-
- CONTRACTL{
- THROWS;
- WRAPPER(GC_TRIGGERS);
- MODE_ANY;
- ENTRY_POINT;
- PRECONDITION(CheckPointer(lpReserved, NULL_OK));
- PRECONDITION(CheckPointer(hInst));
- PRECONDITION(GetThread() != NULL || !fFromThunk);
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BOOL fRetValue = FALSE;
-
- // This needs to be before the BEGIN_ENTRYPOINT_THROWS since
- // we can't call ReportStackOverflow if we're almost done with
- // shutdown and can't run managed code.
- if (!CanRunManagedCode(LoaderLockCheck::None))
- {
- return fRetValue;
- }
-
- BEGIN_ENTRYPOINT_THROWS;
-
- Thread *pThread = GetThread();
-
- if (!hInst)
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(E_FAIL, fFromThunk);
- goto Exit;
- }
-
- // Note that we always check fFromThunk before checking the dwReason value.
- // This is because the dwReason value is undefined in the case that we're
- // being invoked due to a bootstrap (because that is by definition outside
- // of the loader lock and there is no appropriate dwReason value).
- if (fFromThunk ||
- dwReason == DLL_PROCESS_ATTACH ||
- dwReason == DLL_THREAD_ATTACH)
- {
- INDEBUG(EnsureManagedThreadExistsForHostedThread();)
-
-
- // If necessary, start the runtime and create a managed thread object.
- if (fFromThunk || dwReason == DLL_PROCESS_ATTACH)
- {
- hr = EnsureEEStarted(COINITEE_DLL);
-
- if (SUCCEEDED(hr) && pThread == NULL)
- {
- pThread = SetupThreadNoThrow(&hr);
- }
-
- if(FAILED(hr))
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(hr, fFromThunk);
- goto Exit;
- }
- }
-
- // IJW assemblies cause the thread doing the process attach to
- // re-enter ExecuteDLL and do a thread attach. This happens when
- // CoInitializeEE() above executed
- else if (!(pThread &&
- pThread->GetDomain() &&
- CanRunManagedCode(LoaderLockCheck::None)))
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(S_OK, fFromThunk);
- goto Exit;
- }
-
- // we now have a thread setup - either the 1st if set it up, or
- // the else if ran if we didn't have a thread setup.
-
-#ifdef FEATURE_MIXEDMODE
-
- EX_TRY
- {
- hr = ExecuteDLLForAttach(hInst, dwReason, lpReserved, fFromThunk);
- }
- EX_CATCH
- {
- // We rethrow directly here instead of using ExecuteDLL_ReturnOrThrow() to
- // preserve the full exception information, rather than just the HRESULT
- if (fFromThunk)
- {
- EX_RETHROW;
- }
- else
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- if (FAILED(hr))
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(hr, fFromThunk);
- goto Exit;
- }
-#endif // FEATURE_MIXEDMODE
- }
- else
- {
- PEDecoder pe(hInst);
- if (pe.HasManagedEntryPoint())
- {
- // If the EE is still intact, then run user entry points. Otherwise
- // detach was handled when the app domain was stopped.
- //
- // Checks for the loader lock will occur within RunDllMain, if that's
- FAULT_NOT_FATAL();
- if (CanRunManagedCode(LoaderLockCheck::None))
- {
- hr = SystemDomain::RunDllMain(hInst, dwReason, lpReserved);
- }
- }
- // This does need to match the attach. We will only unload dll's
- // at the end and CoUninitialize will just bounce at 0. WHEN and IF we
- // get around to unloading IL DLL's during execution prior to
- // shutdown we will need to bump the reference one to compensate
- // for this call.
- if (dwReason == DLL_PROCESS_DETACH && !g_fForbidEnterEE)
- {
-#ifdef FEATURE_MIXEDMODE
- // If we're in a decent state, we need to free the memory associated
- // with the IJW thunk fixups.
- // we are not in a decent state if the process is terminating (lpReserved!=NULL)
- if (g_fEEStarted && !g_fEEShutDown && !lpReserved)
- {
- PEImage::UnloadIJWModule(hInst);
- }
-#endif // FEATURE_MIXEDMODE
- }
- }
-
- fRetValue = ExecuteDLL_ReturnOrThrow(hr, fFromThunk);
-
-Exit:
-
- END_ENTRYPOINT_THROWS;
- return fRetValue;
-}
-#endif // !FEATURE_CORECLR
Volatile<BOOL> g_bIsGarbageCollectorFullyInitialized = FALSE;
@@ -3803,15 +3019,6 @@ BOOL STDMETHODCALLTYPE EEDllMain( // TRUE on success, FALSE on error.
// Remember module instance
g_pMSCorEE = pParam->hInst;
-#ifndef FEATURE_CORECLR
- CoreClrCallbacks cccallbacks;
- cccallbacks.m_hmodCoreCLR = (HINSTANCE)g_pMSCorEE;
- cccallbacks.m_pfnIEE = IEE;
- cccallbacks.m_pfnGetCORSystemDirectory = GetCORSystemDirectoryInternaL;
- cccallbacks.m_pfnGetCLRFunction = GetCLRFunction;
-
- InitUtilcode(cccallbacks);
-#endif // !FEATURE_CORECLR
// Set callbacks so that LoadStringRC knows which language our
// threads are in so that it can return the proper localized string.
@@ -4124,7 +3331,6 @@ static void InitializeDebugger(void)
hr = g_pDebugInterface->Startup(); // throw on error
_ASSERTE(SUCCEEDED(hr));
-#ifdef FEATURE_CORECLR
//
// If the debug pack is not installed, Startup will return S_FALSE
// and we should cleanup and proceed without debugging support.
@@ -4133,31 +3339,8 @@ static void InitializeDebugger(void)
{
return;
}
-#endif // FEATURE_CORECLR
- }
-
-#if !defined(FEATURE_CORECLR) // simple hosting
- // If there's a DebuggerThreadControl interface, then we
- // need to update the DebuggerSpecialThread list.
- if (CorHost::GetDebuggerThreadControl())
- {
- hr = CorHost::RefreshDebuggerSpecialThreadList();
- _ASSERTE((SUCCEEDED(hr)) && (hr != S_FALSE));
-
- // So we don't think this will ever fail, but just in case...
- IfFailThrow(hr);
}
- // If there is a DebuggerThreadControl interface, then it was set before the debugger
- // was initialized and we need to provide this interface now. If debugging is already
- // initialized then the IDTC pointer is passed in when it is set through CorHost
- IDebuggerThreadControl *pDTC = CorHost::GetDebuggerThreadControl();
-
- if (pDTC != NULL)
- {
- g_pDebugInterface->SetIDbgThreadControl(pDTC);
- }
-#endif // !defined(FEATURE_CORECLR)
LOG((LF_CORDB, LL_INFO10, "Left-side debugging services setup.\n"));
@@ -4198,9 +3381,6 @@ static void TerminateDebugger(void)
g_CORDebuggerControlFlags = DBCF_NORMAL_OPERATION;
-#if !defined(FEATURE_CORECLR) // simple hosting
- CorHost::CleanupDebuggerThreadControl();
-#endif // !defined(FEATURE_CORECLR)
}
@@ -4825,172 +4005,6 @@ void ContractRegressionCheck()
#endif // ENABLE_CONTRACTS_IMPL
-#ifndef FEATURE_CORECLR
-//-------------------------------------------------------------------------
-// CorCommandLine state and methods
-//-------------------------------------------------------------------------
-// Class to encapsulate Cor Command line processing
-
-// Statics for the CorCommandLine class
-DWORD CorCommandLine::m_NumArgs = 0;
-LPWSTR *CorCommandLine::m_ArgvW = 0;
-
-LPWSTR CorCommandLine::m_pwszAppFullName = NULL;
-DWORD CorCommandLine::m_dwManifestPaths = 0;
-LPWSTR *CorCommandLine::m_ppwszManifestPaths = NULL;
-DWORD CorCommandLine::m_dwActivationData = 0;
-LPWSTR *CorCommandLine::m_ppwszActivationData = NULL;
-
-#ifdef _DEBUG
-LPCWSTR g_CommandLine;
-#endif
-
-// Set argvw from command line
-/* static */
-HRESULT CorCommandLine::SetArgvW(LPCWSTR lpCommandLine)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- INJECT_FAULT(return E_OUTOFMEMORY;);
-
- PRECONDITION(CheckPointer(lpCommandLine));
- }
- CONTRACTL_END
-
- HRESULT hr = S_OK;
- if(!m_ArgvW) {
- INDEBUG(g_CommandLine = lpCommandLine);
-
- InitializeLogging(); // This is so early, we may not be initialized
- LOG((LF_ALWAYS, LL_INFO10, "Executing program with command line '%S'\n", lpCommandLine));
-
- m_ArgvW = SegmentCommandLine(lpCommandLine, &m_NumArgs);
-
- if (!m_ArgvW)
- return E_OUTOFMEMORY;
-
- // Click once specific parsing
- hr = ReadClickOnceEnvVariables();
- }
-
- return hr;
-}
-
-// Retrieve the command line
-/* static */
-LPWSTR* CorCommandLine::GetArgvW(DWORD *pNumArgs)
-{
- LIMITED_METHOD_CONTRACT;
-
- if (pNumArgs != 0)
- *pNumArgs = m_NumArgs;
-
- return m_ArgvW;
-}
-
-HRESULT CorCommandLine::ReadClickOnceEnvVariables()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW);
-
- EX_TRY
- {
- // Find out if this is a ClickOnce application being activated.
- PathString m_pwszAppFullNameHolder;
- DWORD cAppFullName = WszGetEnvironmentVariable(g_pwzClickOnceEnv_FullName, m_pwszAppFullNameHolder);
- if (cAppFullName > 0) {
- // get the application full name.
- m_pwszAppFullName = m_pwszAppFullNameHolder.GetCopyOfUnicodeString();
-
- // reset the variable now that we read it so child processes
- // do not think they are a clickonce app.
- WszSetEnvironmentVariable(g_pwzClickOnceEnv_FullName, NULL);
-
- // see if we have application manifest files.
- DWORD dwManifestPaths = 0;
- while (1) {
- StackSString manifestFile(g_pwzClickOnceEnv_Manifest);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(dwManifestPaths, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- manifestFile.Append(buf);
- SString temp;
- if (WszGetEnvironmentVariable(manifestFile.GetUnicode(), temp) > 0)
- dwManifestPaths++;
- else
- break;
- }
- m_ppwszManifestPaths = new LPWSTR[dwManifestPaths];
- for (DWORD i=0; i<dwManifestPaths; i++) {
- StackSString manifestFile(g_pwzClickOnceEnv_Manifest);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(i, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- manifestFile.Append(buf);
- PathString m_ppwszManifestPathsHolder;
- DWORD cManifestPath = WszGetEnvironmentVariable(manifestFile.GetUnicode(), m_ppwszManifestPathsHolder);
- if (cManifestPath > 0) {
-
- m_ppwszManifestPaths[i] = m_ppwszManifestPathsHolder.GetCopyOfUnicodeString();
- WszSetEnvironmentVariable(manifestFile.GetUnicode(), NULL); // reset the env. variable.
- }
- }
- m_dwManifestPaths = dwManifestPaths;
-
- // see if we have activation data arguments.
- DWORD dwActivationData = 0;
- while (1) {
- StackSString activationData(g_pwzClickOnceEnv_Parameter);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(dwActivationData, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- activationData.Append(buf);
- SString temp;
- if (WszGetEnvironmentVariable(activationData.GetUnicode(), temp) > 0)
- dwActivationData++;
- else
- break;
- }
- m_ppwszActivationData = new LPWSTR[dwActivationData];
- for (DWORD i=0; i<dwActivationData; i++) {
- StackSString activationData(g_pwzClickOnceEnv_Parameter);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(i, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- activationData.Append(buf);
- PathString m_ppwszActivationDataHolder;
- DWORD cActivationData = WszGetEnvironmentVariable(activationData.GetUnicode(), m_ppwszActivationDataHolder);
- if (cActivationData > 0) {
- m_ppwszActivationData[i] = m_ppwszActivationDataHolder.GetCopyOfUnicodeString();
- WszSetEnvironmentVariable(activationData.GetUnicode(), NULL); // reset the env. variable.
- }
- }
- m_dwActivationData = dwActivationData;
- }
- }
- EX_CATCH_HRESULT(hr);
-
- END_SO_INTOLERANT_CODE;
-
- return hr;
-}
-
-#endif // !FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
@@ -5004,62 +4018,6 @@ HRESULT CorCommandLine::ReadClickOnceEnvVariables()
//
BOOL GetOSVersion(LPOSVERSIONINFO lposVer)
{
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
-
- //declared static to cache the version info
- static OSVERSIONINFOEX osvi = {0};
- BOOL ret = TRUE;
-
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return FALSE);
-
- //If not yet cached get the OS version info
- if(osvi.dwMajorVersion == 0)
- {
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
- ReleaseHolder<ICLRRuntimeHostInternal> pRuntimeHostInternal;
- //Get the interface
- HRESULT hr = g_pCLRRuntime->GetInterface(CLSID_CLRRuntimeHostInternal,
- IID_ICLRRuntimeHostInternal,
- &pRuntimeHostInternal);
-
- _ASSERT(SUCCEEDED(hr));
-
- //Call mscoree!GetVersionExWrapper() through mscoreei interface method
- hr = pRuntimeHostInternal->GetTrueOSVersion((LPOSVERSIONINFO)&osvi);
- if(!SUCCEEDED(hr))
- {
- osvi.dwMajorVersion = 0;
- ret = FALSE;
- goto FUNCEND;
- }
- }
-
- if(lposVer->dwOSVersionInfoSize==sizeof(OSVERSIONINFOEX)||lposVer->dwOSVersionInfoSize==sizeof(OSVERSIONINFO))
- {
- //Copy the cached version info to the return memory location
- memcpy(lposVer,&osvi, lposVer->dwOSVersionInfoSize);
- }
- else
- {
- //return failure if dwOSVersionInfoSize not set properly
- ret = FALSE;
- }
-
-FUNCEND:
- END_SO_INTOLERANT_CODE;
-
- return ret;
-#else
// Fix for warnings when building against WinBlue build 9444.0.130614-1739
// warning C4996: 'GetVersionExW': was declared deprecated
// externalapis\windows\winblue\sdk\inc\sysinfoapi.h(442)
@@ -5067,5 +4025,4 @@ FUNCEND:
#pragma warning( disable : 4996 )
return WszGetVersionEx(lposVer);
#pragma warning( default : 4996 )
-#endif
}
diff --git a/src/vm/ceemain.h b/src/vm/ceemain.h
index 37fc3dcddf..f3d4db5b00 100644
--- a/src/vm/ceemain.h
+++ b/src/vm/ceemain.h
@@ -210,44 +210,5 @@ INT32 GetLatchedExitCode (void);
// Stronger than IsGCHeapInitialized
BOOL IsGarbageCollectorFullyInitialized();
-#ifndef FEATURE_CORECLR
-//---------------------------------------------------------------------------------------
-//
-// Class to encapsulate Cor Command line processing
-//
-class CorCommandLine
-{
-public:
-
-//********** TYPES
-
- // Note: We don't bother with interlocked operations as we manipulate these bits,
- // because we don't anticipate free-threaded access. (Most of this is used only
- // during startup / shutdown).
-
-//********** DATA
-
- // Hold the current (possibly parsed) command line here
- static DWORD m_NumArgs;
- static LPWSTR *m_ArgvW;
-
- static LPWSTR m_pwszAppFullName;
- static DWORD m_dwManifestPaths;
- static LPWSTR *m_ppwszManifestPaths;
- static DWORD m_dwActivationData;
- static LPWSTR *m_ppwszActivationData;
-
-//********** METHODS
-
- // parse the command line
- static HRESULT SetArgvW(LPCWSTR lpCommandLine);
-
- // Retrieve the parsed command line
- static LPWSTR *GetArgvW(DWORD *pNumArgs);
-
-private:
- static HRESULT ReadClickOnceEnvVariables();
-};
-#endif // !FEATURE_CORECLR
#endif
diff --git a/src/vm/class.h b/src/vm/class.h
index 7517863278..3b7ff4490e 100644
--- a/src/vm/class.h
+++ b/src/vm/class.h
@@ -1360,9 +1360,6 @@ public:
_ASSERTE(HasCriticalTransparentInfo());
return (m_VMFlags & VMFLAG_TRANSPARENCY_MASK) == VMFLAG_TRANSPARENCY_ALLCRITICAL_TAS ||
(m_VMFlags & VMFLAG_TRANSPARENCY_MASK) == VMFLAG_TRANSPARENCY_TAS_NOTCRITICAL
-#ifndef FEATURE_CORECLR
- || (m_VMFlags & VMFLAG_TRANSPARENCY_MASK) == VMFLAG_TRANSPARENCY_CRITICAL_TAS
-#endif // !FEATURE_CORECLR;
;
}
@@ -1388,9 +1385,6 @@ public:
}
void SetCriticalTransparentInfo(
-#ifndef FEATURE_CORECLR
- BOOL fIsCritical,
-#endif // !FEATURE_CORECLR
BOOL fIsTreatAsSafe,
BOOL fIsAllTransparent,
BOOL fIsAllCritical)
@@ -1399,9 +1393,7 @@ public:
// TAS wihtout critical doesn't make sense - although it was allowed in the v2 desktop model,
// so we need to allow it for compatibility reasons on the desktop.
-#ifdef FEATURE_CORECLR
_ASSERTE(!fIsTreatAsSafe || fIsAllCritical);
-#endif // FEATURE_CORECLR
//if nothing is set, then we're transparent.
unsigned flags = VMFLAG_TRANSPARENCY_TRANSPARENT;
@@ -1415,13 +1407,6 @@ public:
flags = fIsTreatAsSafe ? VMFLAG_TRANSPARENCY_ALLCRITICAL_TAS :
VMFLAG_TRANSPARENCY_ALLCRITICAL;
}
-#ifndef FEATURE_CORECLR
- else if (fIsCritical)
- {
- flags = fIsTreatAsSafe ? VMFLAG_TRANSPARENCY_CRITICAL_TAS :
- VMFLAG_TRANSPARENCY_CRITICAL;
- }
-#endif // !FEATURE_CORECLR
else
{
flags = fIsTreatAsSafe ? VMFLAG_TRANSPARENCY_TAS_NOTCRITICAL :
diff --git a/src/vm/classnames.h b/src/vm/classnames.h
index 6b10da1e27..7664158afa 100644
--- a/src/vm/classnames.h
+++ b/src/vm/classnames.h
@@ -158,10 +158,6 @@
#define g_SecurityCriticalAttribute "System.Security.SecurityCriticalAttribute"
#define g_SecurityTransparentAttribute "System.Security.SecurityTransparentAttribute"
-#ifndef FEATURE_CORECLR
-#define g_SecurityTreatAsSafeAttribute "System.Security.SecurityTreatAsSafeAttribute"
-#define g_SecurityRulesAttribute "System.Security.SecurityRulesAttribute"
-#endif //FEATURE_CORECLR
#define g_SecuritySafeCriticalAttribute "System.Security.SecuritySafeCriticalAttribute"
diff --git a/src/vm/clrprivbinderwinrt.cpp b/src/vm/clrprivbinderwinrt.cpp
index b4fb45c083..5da5ed2967 100644
--- a/src/vm/clrprivbinderwinrt.cpp
+++ b/src/vm/clrprivbinderwinrt.cpp
@@ -11,9 +11,6 @@
#include "common.h" // precompiled header
-#ifndef FEATURE_CORECLR
-#include "assemblyusagelogmanager.h"
-#endif
#include "clr/fs/file.h"
#include "clrprivbinderwinrt.h"
#include "clrprivbinderutil.h"
@@ -33,14 +30,12 @@
#endif
#include <TypeResolution.h>
#include "delayloadhelpers.h"
-#ifdef FEATURE_CORECLR
#include "../binder/inc/applicationcontext.hpp"
#include "../binder/inc/assemblybinder.hpp"
#include "../binder/inc/assembly.hpp"
#include "../binder/inc/debuglog.hpp"
#include "../binder/inc/utils.hpp"
#include "../binder/inc/fusionassemblyname.hpp"
-#endif
#ifdef CROSSGEN_COMPILE
#include "crossgenroresolvenamespace.h"
@@ -138,10 +133,8 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT(
, m_fCanUseNativeImages(fCanUseNativeImages)
#endif
, m_fNamespaceResolutionKind(fNamespaceResolutionKind)
-#ifdef FEATURE_CORECLR
, m_pApplicationContext(nullptr)
, m_appLocalWinMDPath(nullptr)
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
, m_fCanSetLocalWinMDPath(TRUE)
#endif // FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
@@ -177,34 +170,6 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT(
m_rgAltPaths.GetRawArray() + iAltPath));
}
}
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
- else if (AppX::IsAppXNGen())
- {
- // If this is an NGen worker process for AppX, then the process doesn't actually run in the package,
- // and RoResolveNamespace won't work without some help. AppX::GetCurrentPackageInfo can give us the
- // package graph, which we can pass to RoResolveNamespace to make it work properly.
- UINT32 cbBuffer = 0;
- UINT32 nCount = 0;
- HRESULT hr = AppX::GetCurrentPackageInfo(PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, nullptr, nullptr);
- if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
- ThrowHR(hr);
-
- NewArrayHolder<BYTE> pbBuffer(new (nothrow) BYTE[cbBuffer]);
- IfNullThrow(pbBuffer);
- IfFailThrow(AppX::GetCurrentPackageInfo(PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, pbBuffer, &nCount));
-
- m_rgAltPaths.Allocate(nCount);
-
- PCPACKAGE_INFO pPackageInfo = reinterpret_cast<PCPACKAGE_INFO>(static_cast<PBYTE>(pbBuffer));
- for (UINT32 iAltPath = 0; iAltPath < nCount; iAltPath++)
- {
- IfFailThrow(WindowsCreateString(
- pPackageInfo[iAltPath].path,
- (UINT32)wcslen(pPackageInfo[iAltPath].path),
- m_rgAltPaths.GetRawArray() + iAltPath));
- }
- }
-#endif //FEATURE_APPX && !FEATURE_CORECLR
#endif //CROSSGEN_COMPILE
#ifdef FEATURE_FUSION
@@ -217,9 +182,6 @@ CLRPrivBinderWinRT::~CLRPrivBinderWinRT()
{
WRAPPER_NO_CONTRACT;
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- AssemblyUsageLogManager::UnRegisterBinderFromUsageLog((UINT_PTR)this);
-#endif
if (m_pTypeCache != nullptr)
{
m_pTypeCache->Release();
@@ -256,15 +218,6 @@ CLRPrivBinderWinRT::GetOrCreateBinder(
{
pBinder.SuppressRelease();
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- // Create and register WinRT usage log
- ReleaseHolder<IAssemblyUsageLog> pNewWinRTUsageLog;
- IfFailThrow(AssemblyUsageLogManager::GetUsageLogForContext(W("WinRT"), W("NotApp"), &pNewWinRTUsageLog));
-
- UINT_PTR winRTBinderId;
- IfFailThrow(pBinder->GetBinderID(&winRTBinderId));
- IfFailThrow(AssemblyUsageLogManager::RegisterBinderWithUsageLog(winRTBinderId, pNewWinRTUsageLog));
-#endif
}
_ASSERTE(s_pSingleton->m_fNamespaceResolutionKind == fNamespaceResolutionKind);
@@ -289,17 +242,10 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
HRESULT hr = S_OK;
ReleaseHolder<CLRPrivAssemblyWinRT> pAssembly;
LPWSTR wszFullTypeName = nullptr;
-#ifndef FEATURE_CORECLR
- NewArrayHolder<WCHAR> wszAssemblySimpleName;
-#endif
#ifndef CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- fusion::logging::StatusScope logStatus(0, ID_FUSLOG_BINDING_STATUS_WINRT, &hr);
-#else
BINDER_SPACE::BINDER_LOG_ENTER(W("CLRPrivBinderWinRT_CoreCLR::BindWinRTAssemblyByName"));
#endif
-#endif
VALIDATE_ARG_RET(pAssemblyName != nullptr);
VALIDATE_ARG_RET(ppAssembly != nullptr);
@@ -316,15 +262,11 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
IfFailGo(COR_E_PLATFORMNOTSUPPORTED);
}
-#ifndef FEATURE_CORECLR
- IfFailGo(fusion::util::GetProperty(pAssemblyName, ASM_NAME_NAME, &wszAssemblySimpleName));
-#else
WCHAR wszAssemblySimpleName[_MAX_PATH];
{
DWORD cchAssemblySimpleName = _MAX_PATH;
IfFailGo(pAssemblyName->GetName(&cchAssemblySimpleName, wszAssemblySimpleName));
}
-#endif
wszFullTypeName = wcschr(wszAssemblySimpleName, W('!'));
@@ -445,49 +387,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
pNewAssembly.SuppressRelease();
}
-#ifndef FEATURE_CORECLR
- if (fPreBind)
- {
- // We are pre-binding to this WinMD and do not want to open it
- // Compare the filename to the assembly simple name. This is legal to do with WinRT because at NGen time
- // we embed a WinRT dependency as assembly def name component plus a namespace and type from it.
- // At bind time, this type should still exist in the same assembly. If it doesn't, and has been moved,
- // the native image validation will fail anyway and we'll fall back to IL. This is because if the type has
- // been moved to another WinMD, it must have been removed from the first one because WinRT allows no duplicates.
- // See comment on CLRPrivBinderWinRT::PreBind for further details.
- if (!_wcsicmp(wszAssemblySimpleName, wszFileNameStripped))
- {
- *ppAssembly = pAssembly.Extract();
- return (hr = S_OK);
- }
- else
- {
- continue;
- }
- }
-#endif
- }
-#ifndef FEATURE_CORECLR
- else if (fPreBind)
- {
- // We are pre-binding to this WinMD and do not want to force it to be loaded into the runtime yet.
- // Compare the filename to the assembly simple name. This is legal to do with WinRT because at NGen time
- // we embed a WinRT dependency as assembly def name component plus a namespace and type from it.
- // At bind time, this type should still exist in the same assembly. If it doesn't, and has been moved,
- // the native image validation will fail anyway and we'll fall back to IL. This is because if the type has
- // been moved to another WinMD, it must have been removed from the first one because WinRT allows no duplicates.
- // See comment on CLRPrivBinderWinRT::PreBind for further details.
- if (!_wcsicmp(wszAssemblySimpleName, wszFileNameStripped))
- {
- *ppAssembly = pAssembly.Extract();
- return (hr = S_OK);
- }
- else
- {
- continue;
- }
}
-#endif
//
// Look to see if there's a native image available.
@@ -499,12 +399,8 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
if (hr == S_OK)
{ // The type we are looking for has been found in this assembly
#ifndef CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- fusion::logging::LogMessage(0, ID_FUSLOG_BINDING_STATUS_FOUND, wszFileName);
-#else
BINDER_SPACE::BINDER_LOG_LEAVE_HR(W("CLRPrivBinderWinRT_CoreCLR::BindWinRTAssemblyByName"), hr);
#endif
-#endif
*ppAssembly = pAssembly.Extract();
return (hr = S_OK);
}
@@ -516,9 +412,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
hr = CLR_E_BIND_TYPE_NOT_FOUND;
ErrExit:
-#ifdef FEATURE_CORECLR
BINDER_SPACE::BINDER_LOG_LEAVE_HR(W("CLRPrivBinderWinRT_CoreCLR::BindWinRTAssemblyByName"), hr);
-#endif
return hr;
} // CLRPrivBinderWinRT::BindWinRTAssemblyByName
@@ -659,7 +553,6 @@ HRESULT CLRPrivBinderWinRT::GetAssemblyAndTryFindNativeImage(SString &sWinmdFile
{
HRESULT hr = S_OK;
-#ifdef FEATURE_CORECLR
if (!m_pApplicationContext->IsTpaListProvided())
return COR_E_FILENOTFOUND;
@@ -732,24 +625,11 @@ HRESULT CLRPrivBinderWinRT::GetAssemblyAndTryFindNativeImage(SString &sWinmdFile
FALSE, /* fIsInGAC */
FALSE /* fExplicitBindToNativeImage */,
ppAssembly);
-#else
- ReleaseHolder<BINDER_SPACE::Assembly> pAssembly;
-
- // This codepath is used for desktop crossgen
- pAssembly = new BINDER_SPACE::Assembly();
-
- pAssembly->SetPEImage(PEImage::OpenImage(sWinmdFilename, MDInternalImport_Default));
-
- pAssembly->m_assemblyPath.Set(sWinmdFilename);
-
- *ppAssembly = pAssembly.Extract();
-#endif
return hr;
}
#endif // !FEATURE_FUSION
-#ifdef FEATURE_CORECLR
//=====================================================================================================================
HRESULT CLRPrivBinderWinRT::SetApplicationContext(BINDER_SPACE::ApplicationContext *pApplicationContext, SString &appLocalWinMD)
{
@@ -784,7 +664,6 @@ HRESULT CLRPrivBinderWinRT::SetApplicationContext(BINDER_SPACE::ApplicationConte
return hr;
}
-#endif //FEATURE_CORECLR
//=====================================================================================================================
// Implements interface method code:ICLRPrivBinder::BindAssemblyByName.
@@ -950,20 +829,7 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
LPWSTR wszWinMDPath = nullptr;
UINT32 cchWinMDPath = 0;
-#ifdef FEATURE_CORECLR
wszWinMDPath = m_appLocalWinMDPath;
-#else
- if (AppX::IsAdaptiveApp())
- {
- IfFailRet(AppX::GetWinMetadataDirForAdaptiveApps(&wszWinMDPath));
- }
-
- else if (AppX::IsAppXDesignMode() || IsNgenOffline())
- {
- wszWinMDPathConfig = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_WinMDPath);
- wszWinMDPath = wszWinMDPathConfig;
- }
-#endif // FEATURE_CORECLR
if (wszWinMDPath != nullptr)
{
@@ -981,7 +847,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
&rgFileNames,
nullptr, // pcDirectNamespaceChildren
nullptr); // rgDirectNamespaceChildren
-#ifdef FEATURE_CORECLR
// For CoreCLR, if the process is not AppX, deliver more appropriate error message
// when trying to bind to 3rd party WinMDs that is not confusing.
if (HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE) == hr)
@@ -991,7 +856,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
IfFailRet(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED));
}
}
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
// If we failed to find the requested name, but we have an application local probing path setup, then
@@ -1059,33 +923,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
&cchFileName);
BOOL fSkipFilename = FALSE;
-#ifndef FEATURE_CORECLR
- // If we have a specified path list. Be certain to only find filenames in that list.
- // NGen for AppX is an exception, where the path list contains the package graph, and we can
- // accept files found elsewhere (e.g., in the Windows WinMD directory).
- // On CoreCLR, we have no concept of an AppX package, so we want the passed in app
- // paths to additively contribute to the set of WinMDs the API can find.
- if (m_rgAltPaths.GetCount() > 0 && !AppX::IsAppXNGen())
- {
- fSkipFilename = TRUE;
- for (DWORD iAltPath = 0; iAltPath < m_rgAltPaths.GetCount(); iAltPath++)
- {
- UINT32 cchAltPath = 0;
- LPCWSTR wszAltPath = WindowsGetStringRawBuffer(
- m_rgAltPaths.GetAt(iAltPath),
- &cchAltPath);
-
- if (cchAltPath >= cchFileName)
- continue;
-
- if (wcsncmp(wszAltPath, wszFileName, cchAltPath) == 0)
- {
- fSkipFilename = FALSE;
- break;
- }
- }
- }
-#endif
if (!fSkipFilename)
hFileNameList.InsertTail(wszFileName);
}
@@ -1573,7 +1410,6 @@ HRESULT CLRPrivBinderWinRT::GetBinderID(
return S_OK;
}
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
//=====================================================================================================================
HRESULT CLRPrivBinderWinRT::FindWinRTAssemblyBySpec(
LPVOID pvAppDomain,
@@ -1584,7 +1420,6 @@ HRESULT CLRPrivBinderWinRT::FindWinRTAssemblyBySpec(
STATIC_CONTRACT_WRAPPER;
return E_FAIL;
}
-#endif
#ifdef FEATURE_FUSION
//=====================================================================================================================
diff --git a/src/vm/clrprivbinderwinrt.h b/src/vm/clrprivbinderwinrt.h
index caaefff6d2..34f8ef7a09 100644
--- a/src/vm/clrprivbinderwinrt.h
+++ b/src/vm/clrprivbinderwinrt.h
@@ -32,10 +32,8 @@ typedef CoreBindResult IBindResult;
// Forward declarations
class CLRPrivBinderWinRT;
class CLRPrivAssemblyWinRT;
-#ifdef FEATURE_CORECLR
class BINDER_SPACE::ApplicationContext;
class BINDER_SPACE::Assembly;
-#endif
typedef DPTR(CLRPrivBinderWinRT) PTR_CLRPrivBinderWinRT;
typedef DPTR(CLRPrivAssemblyWinRT) PTR_CLRPrivAssemblyWinRT;
@@ -242,12 +240,10 @@ public:
#ifndef FEATURE_FUSION
HRESULT GetAssemblyAndTryFindNativeImage(SString &sWinmdFilename, LPCWSTR pwzSimpleName, BINDER_SPACE::Assembly ** ppAssembly);
#endif
-#ifdef FEATURE_CORECLR
// On Phone the application's APP_PATH CoreCLR hosting config property is used as the app
// package graph for RoResolveNamespace to find 3rd party WinMDs. This method wires up
// the app paths so the WinRT binder will find 3rd party WinMDs.
HRESULT SetApplicationContext(BINDER_SPACE::ApplicationContext *pApplicationContext, SString &appLocalWinMD);
-#endif
// Finds assembly with WinRT type if it is already loaded
// Note: This method could implement interface code:ICLRPrivWinRtTypeBinder if it is ever needed
PTR_Assembly FindAssemblyForTypeIfLoaded(
@@ -331,10 +327,8 @@ private:
HRESULT GetParentIBindContext(IBindContext **ppIBindContext);
#endif //FEATURE_FUSION
-#ifdef FEATURE_CORECLR
BINDER_SPACE::ApplicationContext * m_pApplicationContext;
NewArrayHolder<WCHAR> m_appLocalWinMDPath;
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
// App-local location that can be probed for WinMD files
diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp
index fd7644ce98..5e136fb6a9 100644
--- a/src/vm/clsload.cpp
+++ b/src/vm/clsload.cpp
@@ -4620,24 +4620,7 @@ VOID ClassLoader::AddAvailableClassHaveLock(
// However, this used to be allowed in 1.0/1.1, and some third-party DLLs have
// been obfuscated so that they have duplicate private typedefs.
// We must allow this for old assemblies for app compat reasons
-#ifdef FEATURE_CORECLR
pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME);
-#else
- LPCSTR pszVersion = NULL;
- if (FAILED(pModule->GetMDImport()->GetVersionString(&pszVersion)))
- {
- pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME);
- }
-
- SString ssVersion(SString::Utf8, pszVersion);
- SString ssV1(SString::Literal, "v1.");
-
- AdjustImageRuntimeVersion(&ssVersion);
-
- // If not "v1.*", throw an exception
- if (!ssVersion.BeginsWith(ssV1))
- pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME);
-#endif
}
}
else {
@@ -4914,41 +4897,6 @@ bool StaticAccessCheckContext::IsCallerCritical()
}
-#ifndef FEATURE_CORECLR
-
-//******************************************************************************
-// This function determines whether a Type is accessible from
-// outside of the assembly it lives in.
-
-static BOOL IsTypeVisibleOutsideAssembly(MethodTable* pMT)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
- DWORD dwProtection;
- // check all types in nesting chain, while inner types are public
- while (IsTdPublic(dwProtection = pMT->GetClass()->GetProtection()) ||
- IsTdNestedPublic(dwProtection))
- {
- // if type is nested, check outer type, too
- if (IsTdNested(dwProtection))
- {
- pMT = GetEnclosingMethodTable(pMT);
- }
- // otherwise, type is visible outside of the assembly
- else
- {
- return TRUE;
- }
- }
- return FALSE;
-} // static BOOL IsTypeVisibleOutsideAssembly(MethodTable* pMT)
-
-#endif //!FEATURE_CORECLR
//******************************************************************************
@@ -5031,7 +4979,6 @@ BOOL AccessCheckOptions::DemandMemberAccess(AccessCheckContext *pContext, Method
BOOL canAccessTarget = FALSE;
#ifndef CROSSGEN_COMPILE
-#ifdef FEATURE_CORECLR
BOOL fAccessingFrameworkCode = FALSE;
@@ -5079,102 +5026,6 @@ BOOL AccessCheckOptions::DemandMemberAccess(AccessCheckContext *pContext, Method
ThrowAccessException(pContext, pTargetMT, NULL, fAccessingFrameworkCode);
}
-#else // FEATURE_CORECLR
-
- GCX_COOP();
-
- // Overriding the rules of visibility checks in Win8 immersive: no access is allowed to internal
- // code in the framework even in full trust, unless the caller is also framework code.
- if ( (m_accessCheckType == kUserCodeOnlyRestrictedMemberAccess ||
- m_accessCheckType == kUserCodeOnlyRestrictedMemberAccessNoTransparency) &&
- visibilityCheck )
- {
- IAssemblyName *pIAssemblyName = pTargetMT->GetAssembly()->GetFusionAssemblyName();
-
- HRESULT hr = Fusion::Util::IsAnyFrameworkAssembly(pIAssemblyName);
-
- // S_OK: pIAssemblyName is a framework assembly.
- // S_FALSE: pIAssemblyName is not a framework assembly.
- // Other values: pIAssemblyName is an invalid name.
- if (hr == S_OK)
- {
- if (pContext->IsCalledFromInterop())
- return TRUE;
-
- // If the caller method is NULL and we are not called from interop
- // this is not a normal method access check (e.g. a CA accessibility check)
- // The access check should fail in this case.
- hr = S_FALSE;
-
- MethodDesc* pCallerMD = pContext->GetCallerMethod();
- if (pCallerMD != NULL)
- {
- pIAssemblyName = pCallerMD->GetAssembly()->GetFusionAssemblyName();
- hr = Fusion::Util::IsAnyFrameworkAssembly(pIAssemblyName);
- }
-
- // The caller is not framework code.
- if (hr != S_OK)
- {
- if (m_fThrowIfTargetIsInaccessible)
- ThrowAccessException(pContext, pTargetMT, NULL, TRUE);
- else
- return FALSE;
- }
- }
- }
-
- EX_TRY
- {
- if (m_accessCheckType == kMemberAccess)
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, REFLECTION_MEMBER_ACCESS);
- }
- else
- {
- _ASSERTE(m_accessCheckType == kRestrictedMemberAccess ||
- m_accessCheckType == kUserCodeOnlyRestrictedMemberAccess ||
- (m_accessCheckType == kUserCodeOnlyRestrictedMemberAccessNoTransparency && visibilityCheck));
-
- // JIT guarantees that pTargetMT has been fully loaded and ready to execute by this point, but reflection doesn't.
- // So GetSecurityDescriptor could AV because the DomainAssembly cannot be found.
- // For now we avoid this by calling EnsureActive aggressively. We might want to move this to the reflection code in the future:
- // ReflectionInvocation::PerformVisibilityCheck, PerformSecurityCheckHelper, COMDelegate::BindToMethodName/Info, etc.
- // We don't need to call EnsureInstanceActive because we will be doing access check on all the generic arguments any way so
- // EnsureActive will be called on everyone of them if needed.
- pTargetMT->EnsureActive();
-
- IAssemblySecurityDescriptor * pTargetSecurityDescriptor = pTargetMT->GetModule()->GetSecurityDescriptor();
- _ASSERTE(pTargetSecurityDescriptor != NULL);
-
- if (m_pAccessContext != NULL)
- {
- // If we have a context, use it to do the demand
- Security::ReflectionTargetDemand(REFLECTION_MEMBER_ACCESS,
- pTargetSecurityDescriptor,
- m_pAccessContext);
- }
- else
- {
- // Just do a normal Demand
- Security::ReflectionTargetDemand(REFLECTION_MEMBER_ACCESS, pTargetSecurityDescriptor);
- }
- }
-
- canAccessTarget = TRUE;
- }
- EX_CATCH
- {
- canAccessTarget = FALSE;
-
- if (m_fThrowIfTargetIsInaccessible)
- {
- ThrowAccessException(pContext, pTargetMT, GET_EXCEPTION());
- }
- }
- EX_END_CATCH(RethrowTerminalExceptions);
-
-#endif // FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
return canAccessTarget;
@@ -5335,39 +5186,6 @@ void GetAccessExceptionAdditionalContextForSecurity(Assembly *pAccessingAssembly
pContextInformation->Append(accessingFrameworkCodeError);
}
-#ifndef FEATURE_CORECLR
- if (isTransparencyError)
- {
- ModuleSecurityDescriptor *pMSD = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pAccessingAssembly);
-
- // If the accessing assembly is APTCA and using level 2 transparency, then transparency errors may be
- // because APTCA newly opts assemblies into being all transparent.
- if (pMSD->IsMixedTransparency() && !pAccessingAssembly->GetSecurityTransparencyBehavior()->DoesUnsignedImplyAPTCA())
- {
- SString callerDisplayName;
- pAccessingAssembly->GetDisplayName(callerDisplayName);
-
- SString level2AptcaTransparencyError;
- EEException::GetResourceMessage(IDS_ACCESS_EXCEPTION_CONTEXT_LEVEL2_APTCA, level2AptcaTransparencyError, callerDisplayName);
-
- pContextInformation->Append(level2AptcaTransparencyError);
- }
-
- // If the assessing assembly is fully transparent and it is partially trusted, then transparency
- // errors may be because the CLR forced the assembly to be transparent due to its trust level.
- if (pMSD->IsAllTransparentDueToPartialTrust())
- {
- _ASSERTE(pMSD->IsAllTransparent());
- SString callerDisplayName;
- pAccessingAssembly->GetDisplayName(callerDisplayName);
-
- SString partialTrustTransparencyError;
- EEException::GetResourceMessage(IDS_ACCESS_EXCEPTION_CONTEXT_PT_TRANSPARENT, partialTrustTransparencyError, callerDisplayName);
-
- pContextInformation->Append(partialTrustTransparencyError);
- }
- }
-#endif // FEATURE_CORECLR
}
@@ -5675,18 +5493,6 @@ static BOOL CheckTransparentAccessToCriticalCode(
(pOptionalTargetField ? 1 : 0) +
(pOptionalTargetType ? 1 : 0)));
-#ifndef FEATURE_CORECLR
- if (pTargetMT->GetAssembly()->GetSecurityTransparencyBehavior()->DoesPublicImplyTreatAsSafe())
- {
- // @ telesto: public => TAS in non-coreclr only. The intent is to remove this ifdef and remove
- // public => TAS in all flavors/branches.
- // check if the Target member accessible outside the assembly
- if (IsMdPublic(dwMemberAccess) && IsTypeVisibleOutsideAssembly(pTargetMT))
- {
- return TRUE;
- }
- }
-#endif // !FEATURE_CORECLR
// if the caller [Method] is transparent, do special security checks
// check if security disallows access to target member
diff --git a/src/vm/clsload.hpp b/src/vm/clsload.hpp
index a3a0de3cf4..2ee6524a7b 100644
--- a/src/vm/clsload.hpp
+++ b/src/vm/clsload.hpp
@@ -408,19 +408,6 @@ public:
// CoreCLR: Do RestrictedMemberAcess visibility checks but bypass transparency checks.
kRestrictedMemberAccessNoTransparency,
-#ifndef FEATURE_CORECLR
- // Used by DynamicMethod with kRestrictedMemberAccess in Win8 immersive mode.
- // Desktop: Equals kNormalAccessibilityChecks for non-framework code calling framework code,
- // kRestrictedMemberAccess otherwise.
- kUserCodeOnlyRestrictedMemberAccess,
-
- // A variation of kUserCodeOnlyRestrictedMemberAccess, but without transparency checks.
- // This is used for reflection invocation in Win8 immersive when all domains on the call stack is full trust.
- // This is an optimization to avoid stackwalks for transparency checks in full trust.
- // Note that both kUserCodeOnlyRestrictedMemberAccess and kUserCodeOnlyRestrictedMemberAccessNoTransparency
- // are needed because we restrict user code from accessing framework internals in Win8 immersive even in full trust.
- kUserCodeOnlyRestrictedMemberAccessNoTransparency
-#endif
};
AccessCheckOptions(
@@ -472,11 +459,7 @@ public:
BOOL TransparencyCheckNeeded() const
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return (m_accessCheckType != kNormalAccessNoTransparency && m_accessCheckType != kRestrictedMemberAccessNoTransparency);
-#else //FEATURE_CORECLR
- return (m_accessCheckType != kUserCodeOnlyRestrictedMemberAccessNoTransparency);
-#endif //FEATURE_CORECLR
}
static AccessCheckOptions* s_pNormalAccessChecks;
diff --git a/src/vm/clsload.inl b/src/vm/clsload.inl
index a362d5a3db..991498ec9c 100644
--- a/src/vm/clsload.inl
+++ b/src/vm/clsload.inl
@@ -80,14 +80,8 @@ inline void AccessCheckOptions::Initialize(
!throwIfTargetIsInaccessible ||
((pTargetMT ? 1 : 0) + (pTargetMethod ? 1 : 0) + (pTargetField ? 1 : 0)) == 1);
// m_pAccessContext can only be set for kRestrictedMemberAccess
-#ifdef FEATURE_CORECLR
PRECONDITION(m_pAccessContext == NULL ||
accessCheckType == AccessCheckOptions::kRestrictedMemberAccess);
-#else
- PRECONDITION(m_pAccessContext == NULL ||
- accessCheckType == AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccess ||
- accessCheckType == AccessCheckOptions::kRestrictedMemberAccess);
-#endif
}
CONTRACTL_END;
diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp
index 8fc851d86b..0ae75ecaa6 100644
--- a/src/vm/codeman.cpp
+++ b/src/vm/codeman.cpp
@@ -31,9 +31,7 @@
#include "debuginfostore.h"
#include "strsafe.h"
-#ifdef FEATURE_CORECLR
#include "configuration.h"
-#endif
#ifdef _WIN64
#define CHECK_DUPLICATED_STRUCT_LAYOUTS
@@ -1397,7 +1395,7 @@ struct JIT_LOAD_DATA
// Here's the global data for JIT load and initialization state.
JIT_LOAD_DATA g_JitLoadData;
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
// Global that holds the path to custom JIT location
extern "C" LPCWSTR g_CLRJITPath = nullptr;
@@ -1439,7 +1437,6 @@ static void LoadAndInitializeJIT(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT I
HRESULT hr = E_FAIL;
-#ifdef FEATURE_CORECLR
PathString CoreClrFolderHolder;
extern HINSTANCE g_hThisInst;
bool havePath = false;
@@ -1482,9 +1479,6 @@ static void LoadAndInitializeJIT(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT I
}
}
-#else
- hr = g_pCLRRuntime->LoadLibrary(pwzJitName, phJit);
-#endif
if (SUCCEEDED(hr))
{
@@ -1493,25 +1487,9 @@ static void LoadAndInitializeJIT(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT I
EX_TRY
{
bool fContinueToLoadJIT = false;
-#if !defined(FEATURE_CORECLR)
- typedef void (__stdcall* psxsJitStartup) (CoreClrCallbacks const &);
- psxsJitStartup sxsJitStartupFn = (psxsJitStartup) GetProcAddress(*phJit, "sxsJitStartup");
-
- if (sxsJitStartupFn)
- {
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_GET_SXSJITSTARTUP;
-
- CoreClrCallbacks cccallbacks = GetClrCallbacks();
- (*sxsJitStartupFn) (cccallbacks);
-
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_SXSJITSTARTUP;
- fContinueToLoadJIT = true;
- }
-#else // FEATURE_CORECLR
// For CoreCLR, we never use "sxsJitStartup" as that is Desktop utilcode initialization
// specific. Thus, assume we always got
fContinueToLoadJIT = true;
-#endif // !defined(FEATURE_CORECLR)
if (fContinueToLoadJIT)
{
@@ -1644,7 +1622,7 @@ BOOL EEJitManager::LoadJIT()
// Set as a courtesy to code:CorCompileGetRuntimeDll
s_ngenCompilerDll = m_JITCompiler;
-#if (defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)) || (defined(_TARGET_X86_) && defined(FEATURE_CORECLR))
+#if defined(_TARGET_X86_)
// If COMPlus_UseLegacyJit=1, then we fall back to compatjit.dll.
//
// This fallback mechanism was introduced for Visual Studio "14" Preview, when JIT64 (the legacy JIT) was replaced with
@@ -1670,11 +1648,7 @@ BOOL EEJitManager::LoadJIT()
// Thus, the COMPlus_useLegacyJit=1 mechanism has been enabled for x86 CoreCLR. This scenario does not have the UseRyuJIT
// registry key, nor the AppX binder mode.
-#if defined(FEATURE_CORECLR)
bool fUseRyuJit = true;
-#else
- bool fUseRyuJit = UseRyuJit();
-#endif
if ((!IsCompilationProcess() || !fUseRyuJit) && // Use RyuJIT for all NGEN, unless we're falling back to JIT64 for everything.
(newJitCompiler != nullptr)) // the main JIT must successfully load before we try loading the fallback JIT
@@ -1688,11 +1662,7 @@ BOOL EEJitManager::LoadJIT()
if (!fUsingCompatJit)
{
-#if defined(FEATURE_CORECLR)
DWORD useLegacyJit = Configuration::GetKnobBooleanValue(W("System.JIT.UseWindowsX86CoreLegacyJit"), CLRConfig::EXTERNAL_UseWindowsX86CoreLegacyJit);
-#else
- DWORD useLegacyJit = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_UseLegacyJit); // uncached access, since this code is run no more than one time
-#endif
if (useLegacyJit == 1)
{
fUsingCompatJit = TRUE;
@@ -4404,7 +4374,6 @@ LPCWSTR ExecutionManager::GetJitName()
LPCWSTR pwzJitName = NULL;
-#if defined(FEATURE_CORECLR)
#if !defined(CROSSGEN_COMPILE)
if (g_CLRJITPath != nullptr)
{
@@ -4419,10 +4388,6 @@ LPCWSTR ExecutionManager::GetJitName()
}
}
#endif // !defined(CROSSGEN_COMPILE)
-#else // !FEATURE_CORECLR
- // Try to obtain a name for the jit library from the env. variable
- IfFailThrow(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_JitName, const_cast<LPWSTR *>(&pwzJitName)));
-#endif // !FEATURE_CORECLR
if (NULL == pwzJitName)
{
diff --git a/src/vm/comcallablewrapper.cpp b/src/vm/comcallablewrapper.cpp
index 17f0fb60aa..91e9afcda3 100644
--- a/src/vm/comcallablewrapper.cpp
+++ b/src/vm/comcallablewrapper.cpp
@@ -1774,12 +1774,10 @@ IUnknown* SimpleComCallWrapper::QIStandardInterface(Enum_StdInterfaces index)
else if (index == enum_IDispatchEx)
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
RETURN NULL;
}
-#endif // FEATURE_CORECLR
if (SupportsIReflect(m_pMT))
{
@@ -1988,9 +1986,6 @@ IUnknown* SimpleComCallWrapper::QIStandardInterface(REFIID riid)
// Keeping the Apollo behaviour also ensures that we allow SL 8.1 scenarios (which do not pass the AppX flag like the modern host)
// to use CorDispatcher for async, in the expected manner, as the OS implementation for CoreDispatcher expects objects to be Agile.
if (!IsAggregated()
-#if !defined(FEATURE_CORECLR)
- && AppX::IsAppXProcess()
-#endif // !defined(FEATURE_CORECLR)
)
{
ComCallWrapperTemplate *pTemplate = GetComCallWrapperTemplate();
@@ -3614,12 +3609,10 @@ IUnknown* ComCallWrapper::GetComIPFromCCW(ComCallWrapper *pWrap, REFIID riid, Me
}
if (IsIDispatch(riid))
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
RETURN NULL;
}
-#endif // FEATURE_CORECLR
// We don't do visibility checks on IUnknown.
RETURN pWrap->GetIDispatchIP();
@@ -4735,11 +4728,6 @@ BOOL ComMethodTable::LayOutInterfaceMethodTable(MethodTable* pClsMT)
SLOT *pComVtable;
unsigned i;
-#ifndef FEATURE_CORECLR
- // Skip this unnecessary expensive check for CoreCLR
- if (!CheckSigTypesCanBeLoaded(pItfClass))
- return FALSE;
-#endif
LOG((LF_INTEROP, LL_INFO1000, "LayOutInterfaceMethodTable: %s, this: %p\n", pItfClass->GetDebugClassName(), this));
diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp
index 4c85a0216e..ae65afcde0 100644
--- a/src/vm/comdelegate.cpp
+++ b/src/vm/comdelegate.cpp
@@ -1098,7 +1098,6 @@ void COMDelegate::BindToMethod(DELEGATEREF *pRefThis,
GCPROTECT_END();
}
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we don't allow non-fulltrust delegates to be marshaled out (or created: CorHost::CreateDelegate ensures that)
// This helper function checks if we have a full-trust delegate with AllowReversePInvokeCallsAttribute targets.
BOOL COMDelegate::IsFullTrustDelegate(DELEGATEREF pDelegate)
@@ -1218,7 +1217,6 @@ BOOL COMDelegate::IsMethodAllowedToSinkReversePInvoke(MethodDesc *pMD)
NULL));
#endif // FEATURE_WINDOWSPHONE
}
-#endif // FEATURE_CORECLR
// Marshals a managed method to an unmanaged callback provided the
// managed method is static and it's parameters require no marshalling.
@@ -1312,7 +1310,6 @@ LPVOID COMDelegate::ConvertToCallback(OBJECTREF pDelegateObj)
MethodTable* pMT = pDelegate->GetMethodTable();
DelegateEEClass* pClass = (DelegateEEClass*)(pMT->GetClass());
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we only allow marshaling out delegates that we can guarantee are full-trust delegates
if (!IsFullTrustDelegate(pDelegate))
{
@@ -1320,7 +1317,6 @@ LPVOID COMDelegate::ConvertToCallback(OBJECTREF pDelegateObj)
TypeString::AppendType(strDelegateType, pMT, TypeString::FormatNamespace | TypeString::FormatAngleBrackets| TypeString::FormatSignature);
COMPlusThrow(kSecurityException, IDS_E_DELEGATE_FULLTRUST_ARPIC_1, strDelegateType.GetUnicode());
}
-#endif
if (pMT->HasInstantiation())
COMPlusThrowArgumentException(W("delegate"), W("Argument_NeedNonGenericType"));
@@ -1502,13 +1498,11 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
if (pUMEntryThunk->GetDomainId() != GetAppDomain()->GetId())
COMPlusThrow(kNotSupportedException, W("NotSupported_DelegateMarshalToWrongDomain"));
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we only allow marshaling out delegates that we can guarantee are full-trust delegates
if (!IsFullTrustDelegate((DELEGATEREF)pDelegate))
{
COMPlusThrow(kSecurityException, IDS_E_DELEGATE_FULLTRUST_ARPIC_2);
}
-#endif
GCPROTECT_END();
return pDelegate;
@@ -1590,13 +1584,6 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
MethodDesc *pStubMD = pClass->m_pForwardStubMD;
_ASSERTE(pStubMD != NULL && pStubMD->IsILStub());
-#ifndef FEATURE_CORECLR
- if (pStubMD->AsDynamicMethodDesc()->HasCopyCtorArgs())
- {
- // static stub that gets its arguments in a thread-static field
- pInterceptStub = NDirect::GetStubForCopyCtor();
- }
-#endif // !FEATURE_CORECLR
#ifdef MDA_SUPPORTED
if (MDA_GET_ASSISTANT(PInvokeStackImbalance))
@@ -1630,13 +1617,11 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
GCPROTECT_END();
#endif // defined(_TARGET_X86_)
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we only allow marshaling out delegates that we can guarantee are full-trust delegates
if (!IsFullTrustDelegate(delObj))
{
COMPlusThrow(kSecurityException, IDS_E_DELEGATE_FULLTRUST_ARPIC_2);
}
-#endif
return delObj;
}
@@ -2182,17 +2167,6 @@ void COMDelegate::DoUnmanagedCodeAccessCheck(MethodDesc* pMeth)
{
// Check whether this is actually a SuppressUnmanagedCodePermission attribute and
// if so, don't do a demand
-#ifndef FEATURE_CORECLR
- MethodTable* pMTMeth = pMeth->GetMethodTable();
- if (pMTMeth->GetMDImport()->GetCustomAttributeByName(pMeth->GetMethodTable()->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK ||
- pMTMeth->GetMDImport()->GetCustomAttributeByName(pMeth->GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK)
-#endif
{
return;
}
@@ -3800,7 +3774,6 @@ BOOL COMDelegate::ValidateSecurityTransparency(MethodDesc *pFtn, MethodTable *pd
{
WRAPPER_NO_CONTRACT;
-#ifdef FEATURE_CORECLR
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
return TRUE;
@@ -3811,9 +3784,6 @@ BOOL COMDelegate::ValidateSecurityTransparency(MethodDesc *pFtn, MethodTable *pd
// 1. the delegate is critical and the target method is critical, or
// 2. the delegate is transparent/safecritical and the target method is transparent/safecritical
return (fCriticalDelegate == fCriticalTarget);
-#else
- return TRUE;
-#endif // !FEATURE_CORECLR
}
diff --git a/src/vm/comdelegate.h b/src/vm/comdelegate.h
index a562f88392..c8ebf377ba 100644
--- a/src/vm/comdelegate.h
+++ b/src/vm/comdelegate.h
@@ -131,14 +131,10 @@ public:
static BOOL IsTrueMulticastDelegate(OBJECTREF delegate);
-#ifdef FEATURE_CORECLR
static BOOL IsMethodAllowedToSinkReversePInvoke(MethodDesc *pMD);
-#endif
private:
-#ifdef FEATURE_CORECLR
static BOOL IsFullTrustDelegate(DELEGATEREF pDelegate);
-#endif
static Stub* SetupShuffleThunk(MethodTable * pDelMT, MethodDesc *pTargetMeth);
public:
diff --git a/src/vm/comdynamic.cpp b/src/vm/comdynamic.cpp
index 835b5cab3b..97e408ac32 100644
--- a/src/vm/comdynamic.cpp
+++ b/src/vm/comdynamic.cpp
@@ -714,33 +714,6 @@ INT32 QCALLTYPE COMDynamicWrite::SetParamInfo(QCall::ModuleHandle pModule, UINT3
return (INT32)retVal;
}
-#ifndef FEATURE_CORECLR
-/*============================CWSetMarshal============================
-**Action: Helper to set marshal information
-**Returns:
-**Arguments:
-**Exceptions:
-==============================================================================*/
-void QCALLTYPE COMDynamicWrite::SetFieldMarshal(QCall::ModuleHandle pModule, UINT32 tk, LPCBYTE pMarshal, INT32 cbMarshal)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- _ASSERTE(pMarshal);
-
- // Define the signature
- IfFailThrow(pRCW->GetEmitter()->SetFieldMarshal(
- tk,
- (PCCOR_SIGNATURE)pMarshal, // marshal blob
- cbMarshal)); // blob length
-
- END_QCALL;
-}
-#endif
/*============================SetConstantValue============================
**Action: Helper to set constant value to field or parameter
@@ -1103,275 +1076,6 @@ void ManagedBitnessFlagsToUnmanagedBitnessFlags(
*pPeFlags |= ICEE_CREATE_MACHINE_ARM|ICEE_CREATE_FILE_PE32;
}
-#ifndef FEATURE_CORECLR
-//=============================PreSavePEFile=====================================*/
-// PreSave the PEFile
-//==============================================================================*/
-void QCALLTYPE COMDynamicWrite::PreSavePEFile(QCall::ModuleHandle pModule, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter *pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow(pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags));
-
- ICeeFileGen *pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- // We should not have the on disk emitter yet
- if (pRCW->GetOnDiskEmitter() != NULL)
- pRCW->SetOnDiskEmitter(NULL);
-
- // Get the dispenser.
- SafeComHolderPreemp<IMetaDataDispenserEx> pDisp;
- IfFailThrow(MetaDataGetDispenser(CLSID_CorMetaDataDispenser, IID_IMetaDataDispenserEx, (void**)&pDisp));
-
- //Get the emitter and the importer
- IMetaDataImport *pImport = pRCW->GetRWImporter();
- IMetaDataEmit *pEmit = pRCW->GetEmitter();
- _ASSERTE((pEmit != NULL ) && (pImport != NULL));
-
- // Set the option on the dispenser turn on duplicate check for TypeDef and moduleRef
- VARIANT varOption;
- V_VT(&varOption) = VT_UI4;
- V_I4(&varOption) = MDDupDefault | MDDupTypeDef | MDDupModuleRef | MDDupExportedType | MDDupAssemblyRef | MDDupFile | MDDupAssembly;
- IfFailThrow(pDisp->SetOption(MetaDataCheckDuplicatesFor, &varOption));
-
- V_VT(&varOption) = VT_UI4;
- V_I4(&varOption) = MDRefToDefNone;
- IfFailThrow(pDisp->SetOption(MetaDataRefToDefCheck, &varOption));
-
- V_VT(&varOption) = VT_UI4;
- V_I4(&varOption) = MergeManifest;
- IfFailThrow(pDisp->SetOption(MetaDataMergerOptions, &varOption));
-
- //Define an empty scope
- SafeComHolderPreemp<IMetaDataEmit> pEmitNew;
- IfFailThrow(pDisp->DefineScope(CLSID_CorMetaDataRuntime, 0, IID_IMetaDataEmit, (IUnknown**)&pEmitNew));
-
- // Token can move upon merge. Get the IMapToken from the CeeFileGen that is created for save
- // and pass it to merge to receive token movement notification.
- // Note that this is not a long term fix. We are relying on the fact that those tokens embedded
- // in PE cannot move after the merge. These tokens are TypeDef, TypeRef, MethodDef, FieldDef, MemberRef,
- // TypeSpec, UserString. If this is no longer true, we can break!
- //
- // Note that we don't need to release pIMapToken because it is not AddRef'ed in the GetIMapTokenIfaceEx.
- //
- IUnknown *pUnknown = NULL;
- IfFailThrow(pCeeFileGen->GetIMapTokenIfaceEx(ceeFile, pEmit, &pUnknown));
-
- SafeComHolderPreemp<IMapToken> pIMapToken;
- IfFailThrow(SafeQueryInterfacePreemp(pUnknown, IID_IMapToken, (IUnknown**) &pIMapToken));
-
- // get the unmanaged writer.
- ISymUnmanagedWriter *pWriter = pModule->GetReflectionModule()->GetISymUnmanagedWriter();
- SafeComHolderPreemp<CSymMapToken> pSymMapToken(new CSymMapToken(pWriter, pIMapToken));
-
- //Merge the old tokens into the new (empty) scope
- //This is a copy.
- IfFailThrow(pEmitNew->Merge(pImport, pSymMapToken, NULL));
- IfFailThrow(pEmitNew->MergeEnd());
-
- // Update the Module name in the new scope.
- CQuickArray<WCHAR> cqModuleName;
- ULONG cchName;
-
- IfFailThrow(pImport->GetScopeProps(0, 0, &cchName, 0));
-
- cqModuleName.ReSizeThrows(cchName);
-
- IfFailThrow(pImport->GetScopeProps(cqModuleName.Ptr(), cchName, &cchName, 0));
- IfFailThrow(pEmitNew->SetModuleProps(cqModuleName.Ptr()));
-
- // cache the pEmitNew to RCW!!
- pRCW->SetOnDiskEmitter(pEmitNew);
-
- END_QCALL;
-} // COMDynamicWrite::PreSavePEFile
-
-//=============================SavePEFile=====================================*/
-// Save the PEFile to disk
-//==============================================================================*/
-void QCALLTYPE COMDynamicWrite::SavePEFile(QCall::ModuleHandle pModule, LPCWSTR wszPeName, UINT32 entryPoint, UINT32 fileKind, BOOL isManifestFile)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- HRESULT hr=S_OK;
- HCORENUM hTypeDefs=0;
- mdTypeDef td;
- ULONG count;
- IMetaDataImport *pImportNew = 0;
- ULONG newMethRVA;
- DWORD metaDataSize;
- BYTE *metaData;
- ULONG metaDataOffset;
- HCEESECTION pILSection;
- ISymUnmanagedWriter *pWriter = NULL;
-
- if (wszPeName==NULL)
- COMPlusThrow(kArgumentNullException, W("ArgumentNull_String"));
- if (wszPeName[0] == '\0')
- COMPlusThrow(kFormatException, W("Format_StringZeroLength"));
-
- Assembly * pAssembly = pModule->GetAssembly();
- _ASSERTE( pAssembly );
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- IMetaDataEmit * pEmitNew = pRCW->GetOnDiskEmitter();
- _ASSERTE(pEmitNew);
-
- //Get the emitter and the importer
-
- if (pAssembly->IsDynamic() && isManifestFile)
- {
- // manifest is stored in this file
-
- // Allocate space for a strong name signature if an originator was supplied
- // (this doesn't strong name the assembly, but it makes it possible to do so
- // as a post processing step).
- if (pAssembly->IsStrongNamed())
- IfFailGo(pAssembly->AllocateStrongNameSignature(pCeeFileGen, ceeFile));
- }
-
- //Set the Output FileName
- IfFailGo( pCeeFileGen->SetOutputFileName(ceeFile, (LPWSTR)wszPeName) );
-
- //Set the Entry Point or throw the dll switch if we're creating a dll.
- if (entryPoint!=0)
- {
- IfFailGo( pCeeFileGen->SetEntryPoint(ceeFile, entryPoint) );
- }
-
- switch (fileKind)
- {
- case Dll:
- {
- IfFailGo( pCeeFileGen->SetDllSwitch(ceeFile, true) );
- break;
- }
- case WindowApplication:
- {
- // window application. Set the SubSystem
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_GUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- break;
- }
- case ConsoleApplication:
- {
- // Console application. Set the SubSystem
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_CUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- break;
- }
- default:
- {
- _ASSERTE(!"Unknown file kind!");
- break;
- }
- }
-
- IfFailGo( pCeeFileGen->GetIlSection(ceeFile, &pILSection) );
- IfFailGo( pEmitNew->GetSaveSize(cssAccurate, &metaDataSize) );
- IfFailGo( pCeeFileGen->GetSectionBlock(pILSection, metaDataSize, sizeof(DWORD), (void**) &metaData) );
- IfFailGo( pCeeFileGen->GetSectionDataLen(pILSection, &metaDataOffset) );
- metaDataOffset -= metaDataSize;
-
- // get the unmanaged writer.
- pWriter = pModule->GetReflectionModule()->GetISymUnmanagedWriter();
- IfFailGo( EmitDebugInfoBegin(pModule, pCeeFileGen, ceeFile, pILSection, wszPeName, pWriter) );
-
- if (pAssembly->IsDynamic() && pRCW->m_ulResourceSize)
- {
- // There are manifest in this file
-
- IfFailGo( pCeeFileGen->GetMethodRVA(ceeFile, 0, &newMethRVA) );
-
- // Point to manifest resource
- IfFailGo( pCeeFileGen->SetManifestEntry( ceeFile, pRCW->m_ulResourceSize, newMethRVA ) );
- }
-
- IfFailGo( pCeeFileGen->LinkCeeFile(ceeFile) );
-
- // Get the import interface from the new Emit interface.
- IfFailGo( pEmitNew->QueryInterface(IID_IMetaDataImport, (void **)&pImportNew));
-
-
- //Enumerate the TypeDefs and update method RVAs.
- while ((hr = pImportNew->EnumTypeDefs( &hTypeDefs, &td, 1, &count)) == S_OK)
- {
- UpdateMethodRVAs(pEmitNew, pImportNew, pCeeFileGen, ceeFile, td, pModule->GetReflectionModule()->m_sdataSection);
- }
-
- if (hTypeDefs)
- {
- pImportNew->CloseEnum(hTypeDefs);
- }
- hTypeDefs=0;
-
- //Update Global Methods.
- UpdateMethodRVAs(pEmitNew, pImportNew, pCeeFileGen, ceeFile, 0, pModule->GetReflectionModule()->m_sdataSection);
-
-
- //Emit the MetaData
- // IfFailGo( pCeeFileGen->EmitMetaDataEx(ceeFile, pEmitNew));
- IfFailGo( pCeeFileGen->EmitMetaDataAt(ceeFile, pEmitNew, pILSection, metaDataOffset, metaData, metaDataSize) );
-
- // finish the debugging info emitting after the metadata save so that token remap will be caught correctly
- IfFailGo( EmitDebugInfoEnd(pModule, pCeeFileGen, ceeFile, pILSection, wszPeName, pWriter) );
-
- //Generate the CeeFile
- IfFailGo(pCeeFileGen->GenerateCeeFile(ceeFile) );
-
- // Strong name sign the resulting assembly if required.
- if (pAssembly->IsDynamic() && isManifestFile && pAssembly->IsStrongNamed())
- IfFailGo(pAssembly->SignWithStrongName((LPWSTR)wszPeName));
-
-ErrExit:
-
- pRCW->SetOnDiskEmitter(NULL);
-
- //Release the interfaces. This should free some of the associated resources.
- if (pImportNew)
- pImportNew->Release();
-
- //Release our interfaces if we allocated them to begin with
- pRCW->DestroyCeeFileGen();
-
- //Check all file IO errors. If so, throw IOException. Otherwise, just throw the hr.
- if (FAILED(hr))
- {
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- {
- if (IsWin32IOError(HRESULT_CODE(hr)))
- {
- SString hrMessage;
- GenerateTopLevelHRExceptionMessage(hr, hrMessage);
- COMPlusThrowHR(COR_E_IO, IDS_EE_GENERIC, hrMessage.GetUnicode());
- }
- else
- {
- COMPlusThrowHR(hr);
- }
- }
- COMPlusThrowHR(hr);
- }
-
- END_QCALL;
-}
-
-#endif // FEATURE_CORECLR
//=============================EmitDebugInfoBegin============================*/
// Phase 1 of emit debugging directory and symbol file.
@@ -1592,152 +1296,6 @@ ErrExit:
}
-#ifndef FEATURE_CORECLR
-//==============================================================================
-// Define external file for native resource.
-//==============================================================================
-void QCALLTYPE COMDynamicWrite::DefineNativeResourceFile(QCall::ModuleHandle pModule, LPCWSTR pwzFileName, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- // Set the resource file name.
- IfFailThrow( pCeeFileGen->SetResourceFileName(ceeFile, (LPWSTR)pwzFileName) );
-
- END_QCALL;
-} // void __stdcall COMDynamicWrite::DefineNativeResourceFile()
-
-//==============================================================================
-// Define array of bytes for native resource.
-//==============================================================================
-void QCALLTYPE COMDynamicWrite::DefineNativeResourceBytes(QCall::ModuleHandle pModule, LPCBYTE pbResource, INT32 cbResource, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- // Set the resource stream.
- HCEESECTION ceeSection = NULL;
- IfFailThrow( pCeeFileGen->GetSectionCreate(ceeFile, ".rsrc", sdReadOnly, &ceeSection) );
-
- void * pvResource;
- IfFailThrow( pCeeFileGen->GetSectionBlock(ceeSection, cbResource, 1, &pvResource) );
- memcpy(pvResource, pbResource, cbResource);
-
- END_QCALL;
-} // void __stdcall COMDynamicWrite::DefineNativeResourceBytes()
-
-//=============================AddResource=====================================*/
-// ecall for adding embedded resource to this module
-//==============================================================================*/
-void QCALLTYPE COMDynamicWrite::AddResource(QCall::ModuleHandle pModule, LPCWSTR pName, LPCBYTE pResBytes, INT32 resByteCount, UINT32 uFileTk, UINT32 iAttribute, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- Assembly * pAssembly = pModule->GetAssembly();
- _ASSERTE( pAssembly && pAssembly->IsDynamic() );
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- IMetaDataEmit * pOnDiskEmit = pRCW->GetOnDiskEmitter();
-
- // First, put it into .rdata section. The only reason that we choose .rdata section at
- // this moment is because this is the first section on the PE file. We don't need to deal with
- // reloc. Actually, I don't know how to deal with the reloc with CeeFileGen given that the reloc
- // position is not in the same file!
-
- // Get the .rdata section
- HCEESECTION hSection;
- IfFailThrow( pCeeFileGen->GetRdataSection(ceeFile, &hSection) );
-
- // the current section data length is the RVA
- ULONG ulOffset;
- IfFailThrow( pCeeFileGen->GetSectionDataLen(hSection, &ulOffset) );
-
- // Allocate a block of space fromt he .rdata section
- BYTE * pbBuffer;
- IfFailThrow( pCeeFileGen->GetSectionBlock(
- hSection, // from .rdata section
- resByteCount + sizeof(DWORD), // number of bytes that we need
- 1, // alignment
- (void**) &pbBuffer) );
-
- // now copy over the resource
- memcpy( pbBuffer, &resByteCount, sizeof(DWORD) );
- memcpy( pbBuffer + sizeof(DWORD), pResBytes, resByteCount );
-
- // track the total resource size so far. The size is actually the offset into the section
- // after writing the resource out
- IfFailThrow( pCeeFileGen->GetSectionDataLen(hSection, &pRCW->m_ulResourceSize) );
-
- mdFile tkFile = RidFromToken(uFileTk) ? uFileTk : mdFileNil;
- mdManifestResource mr;
-
- if (tkFile != mdFileNil)
- {
- SafeComHolderPreemp<IMetaDataAssemblyEmit> pOnDiskAssemblyEmit;
-
- IfFailThrow( pOnDiskEmit->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pOnDiskAssemblyEmit) );
-
- // The resource is stored in a file other than the manifest file
- IfFailThrow(pOnDiskAssemblyEmit->DefineManifestResource(
- pName,
- mdFileNil, // implementation -- should be file token of this module in the manifest
- ulOffset, // offset to this file -- need to be adjusted upon save
- iAttribute, // resource flag
- &mr)); // manifest resource token
- }
-
- // Add an entry into the ManifestResource table for this resource
- // The RVA is ulOffset
- SafeComHolderPreemp<IMetaDataAssemblyEmit> pAssemEmitter(pAssembly->GetOnDiskMDAssemblyEmitter());
- IfFailThrow(pAssemEmitter->DefineManifestResource(
- pName,
- tkFile, // implementation -- should be file token of this module in the manifest
- ulOffset, // offset to this file -- need to be adjusted upon save
- iAttribute, // resource flag
- &mr)); // manifest resource token
-
- pRCW->m_tkFile = tkFile;
-
- END_QCALL;
-}
-
-#endif // FEATURE_CORECLR
//============================AddDeclarativeSecurity============================*/
// Add a declarative security serialized blob and a security action code to a
diff --git a/src/vm/comdynamic.h b/src/vm/comdynamic.h
index 224e017330..a605fa19ba 100644
--- a/src/vm/comdynamic.h
+++ b/src/vm/comdynamic.h
@@ -90,16 +90,6 @@ public:
static
void QCALLTYPE SavePEFile(QCall::ModuleHandle pModule, LPCWSTR wszPeName, UINT32 entryPoint, UINT32 fileKind, BOOL isManifestFile);
-#ifndef FEATURE_CORECLR
- static
- void QCALLTYPE DefineNativeResourceFile(QCall::ModuleHandle pModule, LPCWSTR pwzFileName, INT32 portableExecutableKind, INT32 imageFileMachine);
-
- static
- void QCALLTYPE DefineNativeResourceBytes(QCall::ModuleHandle pModule, LPCBYTE pbResource, INT32 cbResource, INT32 portableExecutableKind, INT32 imageFileMachine);
-
- static
- void QCALLTYPE AddResource(QCall::ModuleHandle pModule, LPCWSTR pName, LPCBYTE pResBytes, INT32 resByteCount, UINT32 uFileTk, UINT32 iAttribute, INT32 portableExecutableKind, INT32 imageFileMachine);
-#endif // !FEATURE_CORECLR
// not an ecall!
static HRESULT EmitDebugInfoBegin(
@@ -160,11 +150,6 @@ public:
static
INT32 QCALLTYPE SetParamInfo(QCall::ModuleHandle pModule, UINT32 tkMethod, UINT32 iSequence, UINT32 iAttributes, LPCWSTR wszParamName);
-#ifndef FEATURE_CORECLR
- // functions to set FieldMarshal
- static
- void QCALLTYPE SetFieldMarshal(QCall::ModuleHandle pModule, UINT32 tk, LPCBYTE pMarshal, INT32 cbMarshal);
-#endif
// functions to set default value
static
void QCALLTYPE SetConstantValue(QCall::ModuleHandle pModule, UINT32 tk, DWORD valueType, LPVOID pValue);
diff --git a/src/vm/cominterfacemarshaler.cpp b/src/vm/cominterfacemarshaler.cpp
index 251beff352..0bd22a028b 100644
--- a/src/vm/cominterfacemarshaler.cpp
+++ b/src/vm/cominterfacemarshaler.cpp
@@ -389,20 +389,8 @@ OBJECTREF COMInterfaceMarshaler::HandleInProcManagedComponent()
}
else
{
-#ifdef FEATURE_CORECLR
_ASSERTE(!"NYI");
COMPlusThrowHR(COR_E_NOTSUPPORTED);
-#else // FEATURE_CORECLR
- // TODO: probably we can cache the object on a per App domain bases
- // using CCW as the key
- OBJECTREF pwrap = NULL;
- GCPROTECT_BEGIN(pwrap);
- {
- pwrap = GetCCWObject();
- oref = AppDomainHelper::CrossContextCopyFrom(m_dwServerDomainId, &pwrap);
- }
- GCPROTECT_END();
-#endif // FEATURE_CORECLR
}
return oref;
diff --git a/src/vm/comisolatedstorage.cpp b/src/vm/comisolatedstorage.cpp
index 2f4f4f69b3..36dd787e11 100644
--- a/src/vm/comisolatedstorage.cpp
+++ b/src/vm/comisolatedstorage.cpp
@@ -992,9 +992,6 @@ HRESULT AccountingInfo::Lock()
DWORD dwRet;
{
// m_hLock is a mutex
-#ifndef FEATURE_CORECLR
- Thread::BeginThreadAffinityAndCriticalRegion();
-#endif
dwRet = WaitForSingleObject(m_hLock, INFINITE);
}
@@ -1065,9 +1062,6 @@ void AccountingInfo::Unlock()
InterlockedDecrement((LPLONG)&m_dwNumLocks);
#endif
-#ifndef FEATURE_CORECLR
- Thread::EndThreadAffinityAndCriticalRegion();
-#endif
}
#endif
diff --git a/src/vm/commodule.cpp b/src/vm/commodule.cpp
index af6dc48d15..bb6da1d5e7 100644
--- a/src/vm/commodule.cpp
+++ b/src/vm/commodule.cpp
@@ -45,12 +45,6 @@ static ISymUnmanagedWriter **CreateISymWriterForDynamicModule(ReflectionModule *
//
ESymbolFormat symFormatToUse = eSymbolFormatILDB;
-#ifndef FEATURE_CORECLR // On desktop only we still use PDB format if the symbols are savable to disk
- if(mod->GetAssembly()->HasSaveAccess())
- {
- symFormatToUse = eSymbolFormatPDB;
- }
-#endif
static ConfigDWORD dbgForcePDBSymbols;
if(dbgForcePDBSymbols.val_DontUse_(W("DbgForcePDBSymbols"), 0) == 1)
@@ -951,13 +945,6 @@ void QCALLTYPE COMModule::GetFullyQualifiedName(QCall::ModuleHandle pModule, QCa
{
LPCWSTR fileName = pModule->GetPath();
if (*fileName != 0) {
-#ifndef FEATURE_CORECLR
- // workaround - lie about where mscorlib is. Mscorlib is now loaded out of the GAC,
- // but some apps query its location to find the system directory. (Notably CodeDOM)
- if (pModule->IsSystem())
- retString.Set(SystemDomain::System()->BaseLibrary());
- else
-#endif // !FEATURE_CORECLR
{
#ifdef FEATURE_WINDOWSPHONE
//
@@ -1248,7 +1235,6 @@ FCIMPL1(FC_BOOL_RET, COMModule::IsResource, ReflectModuleBaseObject* pModuleUNSA
}
FCIMPLEND
-#ifdef FEATURE_CORECLR
//---------------------------------------------------------------------
// Helper code for PunkSafeHandle class. This does the Release in the
@@ -1283,6 +1269,5 @@ FCIMPL0(void*, COMPunkSafeHandle::nGetDReleaseTarget)
return (void*)DReleaseTarget;
}
FCIMPLEND
-#endif //FEATURE_CORECLR
diff --git a/src/vm/commodule.h b/src/vm/commodule.h
index 255b22dfbf..b3598abf5a 100644
--- a/src/vm/commodule.h
+++ b/src/vm/commodule.h
@@ -135,9 +135,7 @@ public:
class COMPunkSafeHandle
{
public:
-#ifdef FEATURE_CORECLR
static FCDECL0(void*, nGetDReleaseTarget);
-#endif
};
#endif
diff --git a/src/vm/common.h b/src/vm/common.h
index 9de9f35141..45f2d62d61 100644
--- a/src/vm/common.h
+++ b/src/vm/common.h
@@ -99,9 +99,6 @@
#include "compatibilityflags.h"
extern BOOL GetCompatibilityFlag(CompatibilityFlag flag);
-#ifndef FEATURE_CORECLR
-extern DWORD* GetGlobalCompatibilityFlags();
-#endif // !FEATURE_CORECLR
#include "strongname.h"
#include "stdmacros.h"
@@ -399,11 +396,6 @@ inline VOID UnsafeEEEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_CAN_TAKE_LOCK;
-#ifndef FEATURE_CORECLR
- if (CLRTaskHosted()) {
- Thread::BeginThreadAffinity();
- }
-#endif // !FEATURE_CORECLR
UnsafeEnterCriticalSection(lpCriticalSection);
INCTHREADLOCKCOUNT();
}
@@ -415,11 +407,6 @@ inline VOID UnsafeEELeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
UnsafeLeaveCriticalSection(lpCriticalSection);
DECTHREADLOCKCOUNT();
-#ifndef FEATURE_CORECLR
- if (CLRTaskHosted()) {
- Thread::EndThreadAffinity();
- }
-#endif // !FEATURE_CORECLR
}
inline BOOL UnsafeEETryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index 724dd315be..8eaab5e222 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -27,9 +27,6 @@
#include "zapsig.h"
#include "gcrefmap.h"
-#ifndef FEATURE_CORECLR
-#include "corsym.h"
-#endif // FEATURE_CORECLR
#include "virtualcallstub.h"
#include "typeparse.h"
@@ -192,20 +189,14 @@ HRESULT CEECompileInfo::CreateDomain(ICorCompilationDomain **ppDomain,
ENTER_DOMAIN_PTR(pCompilationDomain,ADV_COMPILATION)
{
-#ifdef FEATURE_CORECLR
if (fForceFulltrustDomain)
((ApplicationSecurityDescriptor *)pCompilationDomain->GetSecurityDescriptor())->SetGrantedPermissionSet(NULL, NULL, 0xFFFFFFFF);
-#endif
#ifndef CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- pCompilationDomain->InitializeHashing(NULL);
-#endif // FEATURE_CORECLR
#endif
pCompilationDomain->InitializeDomainContext(TRUE, NULL, NULL);
#ifndef CROSSGEN_COMPILE
-#ifdef FEATURE_CORECLR
if (!NingenEnabled())
{
@@ -223,7 +214,6 @@ HRESULT CEECompileInfo::CreateDomain(ICorCompilationDomain **ppDomain,
initializeSecurity.Call(args);
GCPROTECT_END();
}
-#endif //FEATURE_CORECLR
#endif
{
@@ -393,14 +383,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath(
PEImageHolder pImage;
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // If the path is not absolute, look for the assembly on platform path list first
- if (wcschr(wzPath, '\\') == NULL || wcschr(wzPath, ':') == NULL || wcschr(wzPath, '/') == NULL)
- {
- CompilationDomain::FindImage(wzPath,
- fExplicitBindToNativeImage ? MDInternalImport_NoCache : MDInternalImport_Default, &pImage);
- }
-#endif
if (pImage == NULL)
{
@@ -521,10 +503,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath(
pDomain->AddAssemblyToCache(&spec, pDomainAssembly);
#endif
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- if (!IsReadyToRunCompilation())
- pDomain->ToCompilationDomain()->ComputeAssemblyHardBindList(pAssemblyHolder->GetPersistentMDImport());
-#endif
{
// Mark the assembly before it gets fully loaded and NGen image dependencies are verified. This is necessary
@@ -802,66 +780,6 @@ HRESULT CEECompileInfo::LoadAssemblyModule(
return S_OK;
}
-#ifndef FEATURE_CORECLR
-BOOL CEECompileInfo::SupportsAutoNGen(CORINFO_ASSEMBLY_HANDLE assembly)
-{
- STANDARD_VM_CONTRACT;
-
- Assembly *pAssembly = (Assembly*) assembly;
- return pAssembly->SupportsAutoNGen();
-}
-
-HRESULT CEECompileInfo::SetCachedSigningLevel(HANDLE hNI, HANDLE *pModules, COUNT_T nModules)
-{
- STANDARD_VM_CONTRACT;
-
- HRESULT hr = S_OK;
-
- HMODULE hKernel32 = WszLoadLibrary(W("kernel32.dll"));
- typedef BOOL (WINAPI *SetCachedSigningLevel_t)
- (__in_ecount(Count) PHANDLE SourceFiles, __in ULONG Count, __in ULONG Flags, __in HANDLE TargetFile);
- SetCachedSigningLevel_t SetCachedSigningLevel
- = (SetCachedSigningLevel_t)GetProcAddress(hKernel32, "SetCachedSigningLevel");
- if (SetCachedSigningLevel == NULL)
- {
- return S_OK;
- }
-
- StackSArray<PEImage*> images;
- PEImage::GetAll(images);
-
- StackSArray<HANDLE> handles;
- for (StackSArray<PEImage*>::Iterator i = images.Begin(), end = images.End(); i != end; i++)
- {
- if (!(*i)->IsFile())
- {
- continue;
- }
- HANDLE hFile = (*i)->GetFileHandleLocking();
- handles.Append(hFile);
- }
-
- if (!SetCachedSigningLevel(handles.GetElements(), handles.GetCount(), 0, hNI))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- _ASSERTE(FAILED(hr));
- goto ErrExit;
- }
-
- for (COUNT_T i = 0; i < nModules; i++)
- {
- if (!SetCachedSigningLevel(handles.GetElements(), handles.GetCount(), 0, pModules[i]))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- _ASSERTE(FAILED(hr));
- goto ErrExit;
- }
- }
-
-ErrExit:
- return hr;
-}
-#endif
BOOL CEECompileInfo::CheckAssemblyZap(
CORINFO_ASSEMBLY_HANDLE assembly,
@@ -2910,11 +2828,7 @@ public:
LIMITED_METHOD_CONTRACT;
}
-#ifdef FEATURE_CORECLR
#define WRITER_LOAD_ERROR_MESSAGE W("Unable to load ") NATIVE_SYMBOL_READER_DLL W(". Please ensure that ") NATIVE_SYMBOL_READER_DLL W(" is on the path. Error='%d'\n")
-#else
-#define WRITER_LOAD_ERROR_MESSAGE W("Unable to load diasymreader.dll. Please ensure that version 11 or greater of diasymreader.dll is on the path. You can typically find this DLL in the desktop .NET install directory for 4.5 or greater. Error='%d'\n")
-#endif
HRESULT Load(LPCWSTR wszDiasymreaderPath = nullptr)
{
@@ -2942,11 +2856,7 @@ public:
{
hr = FakeCoCreateInstanceEx(
CLSID_CorSymBinder_SxS,
-#ifdef FEATURE_CORECLR
wszDiasymreaderPath != nullptr ? wszDiasymreaderPath : (LPCWSTR)NATIVE_SYMBOL_READER_DLL,
-#else
- wszDiasymreaderPath,
-#endif
IID_ISymUnmanagedBinder,
(void**)&m_pBinder,
NULL);
@@ -4952,9 +4862,6 @@ void CEECompileInfo::SetAssemblyHardBindList(
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_CORECLR // hardbinding
- GetAppDomain()->ToCompilationDomain()->SetAssemblyHardBindList(pHardBindList, cHardBindList);
-#endif
}
HRESULT CEECompileInfo::SetVerboseLevel(
@@ -7254,11 +7161,6 @@ CompilationDomain::CompilationDomain(BOOL fForceDebug,
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_CORECLR // hardbinding
- m_hardBoundModules.Init(FALSE, NULL);
- m_cantHardBindModules.Init(FALSE, NULL);
- m_useHardBindList = FALSE;
-#endif
}
void CompilationDomain::ReleaseDependencyEmitter()
@@ -7307,11 +7209,6 @@ void CompilationDomain::Init()
Security::SetDefaultAppDomainProperty(GetSecurityDescriptor());
SetCompilationDomain();
-#ifndef FEATURE_CORECLR
- // We need the Compilation Domain to be homogeneous. We've already forced everything to be full trust.
- // However, CheckZapSecurity needs this to be set, so set it here.
- GetSecurityDescriptor()->SetHomogeneousFlag(TRUE);
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
g_pConfig->DisableGenerateStubForHost();
@@ -7381,12 +7278,8 @@ HRESULT CompilationDomain::AddDependencyEntry(PEAssembly *pFile,
// Note that this can trigger an assembly load (of mscorlib)
pAssembly->GetOptimizedIdentitySignature(&pDependency->signAssemblyDef);
-#if !defined(FEATURE_CORECLR)
- ReleaseHolder<IMDInternalImport> pAssemblyMD(pFile->GetMDImportWithRef());
-#endif
-#ifdef FEATURE_CORECLR // hardbinding
//
// This is done in CompilationDomain::CanEagerBindToZapFile with full support for hardbinding
//
@@ -7395,59 +7288,7 @@ HRESULT CompilationDomain::AddDependencyEntry(PEAssembly *pFile,
CORCOMPILE_VERSION_INFO * pNativeVersion = pFile->GetLoadedNative()->GetNativeVersionInfo();
pDependency->signNativeImage = pNativeVersion->signature;
}
-#endif
-
-#ifndef FEATURE_CORECLR
- // Find the architecture of the dependency, using algorithm from Fusion GetRuntimeVersionForAssembly.
- // Normally, when an assembly is loaded at runtime, Fusion determines its architecture based on the
- // metadata. However, if assembly load is skipped due to presence of native image, then Fusion needs
- // to get assembly architecture from another source. For assemblies in GAC, the GAC structure provides
- // architecture data. For assemblies outside of GAC, however, no other source of info is available.
- // So we calculate the architecture now and store it in the native image, to make it available to Fusion.
- // The algorithm here must exactly match the algorithm in GetRuntimeVersionForAssembly.
- LPCSTR pszPERuntime;
- IfFailThrow(pAssemblyMD->GetVersionString(&pszPERuntime));
-
- if (SString::_strnicmp(pszPERuntime, "v1.0", 4) != 0 &&
- SString::_strnicmp(pszPERuntime, "v1.1", 4) != 0 &&
- SString::_stricmp(pszPERuntime, "Standard CLI 2002") != 0)
- {
- // Get the PE architecture of this dependency, similar to PEAssembly::GetFusionProcessorArchitecture.
- // The difference is when NI is loaded, PEAssembly::GetFusionProcessorArchitecture returns the
- // architecture of the NI (which is never processor neutral), but we want the architecture
- // associated with the IL image.
- DWORD dwPEKind, dwMachine;
- if (pFile->HasNativeImage())
- {
- // CrossGen can load an NI without loading the corresponding IL image, in which case
- // PEAssembly::GetILImage() actually returns an NI. Thus we need specific code to handle NI.
- PEImageHolder pImage(pFile->GetNativeImageWithRef());
- pImage->GetNativeILPEKindAndMachine(&dwPEKind, &dwMachine);
- }
- else
- {
- pFile->GetILimage()->GetPEKindAndMachine(&dwPEKind, &dwMachine);
- }
- DWORD dwAssemblyFlags = 0;
- IfFailThrow(pAssemblyMD->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- NULL, NULL, NULL,
- NULL, NULL, &dwAssemblyFlags));
-
- PEKIND peKind;
- if (SUCCEEDED(TranslatePEToArchitectureType(
- (CorPEKind)dwPEKind,
- dwMachine,
- dwAssemblyFlags,
- &peKind)))
- {
- CorCompileDependencyInfo peKindShifted = CorCompileDependencyInfo(peKind << CORCOMPILE_DEPENDENCY_PEKIND_SHIFT);
- _ASSERTE(peKindShifted == (peKindShifted & CORCOMPILE_DEPENDENCY_PEKIND_MASK));
- pDependency->dependencyInfo = CorCompileDependencyInfo(pDependency->dependencyInfo
- | (peKindShifted & CORCOMPILE_DEPENDENCY_PEKIND_MASK));
- }
- }
-#endif //FEATURE_FUSION
}
return S_OK;
@@ -7619,68 +7460,6 @@ AssemblySpec* CompilationDomain::FindAssemblyRefSpecForDefSpec(
return (pEntry != NULL) ? pEntry->m_pRef : NULL;
}
-#ifndef FEATURE_CORECLR // hardbinding
-//----------------------------------------------------------------------------
-// Was the assembly asked to be hard-bound to?
-
-BOOL CompilationDomain::IsInHardBindRequestList(Assembly * pAssembly)
-{
- return IsInHardBindRequestList(pAssembly->GetManifestFile());
-}
-
-BOOL CompilationDomain::IsInHardBindRequestList(PEAssembly * pAssembly)
-{
- if (!m_useHardBindList)
- return FALSE;
-
- StackSString displayName;
- pAssembly->GetDisplayName(displayName);
-
- for (COUNT_T i = 0; i < m_assemblyHardBindList.GetCount(); i++)
- {
- if (displayName.Equals(m_assemblyHardBindList[i]))
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOL CompilationDomain::IsSafeToHardBindTo(PEAssembly * pAssembly)
-{
- WRAPPER_NO_CONTRACT;
- // The dependency worker does not have m_useHardBindList set.
- // We do want to allow all possible native images to be loaded in this case.
- if (!m_useHardBindList)
- return TRUE;
-
- if (CompilationDomain::IsInHardBindRequestList(pAssembly))
- return TRUE;
-
- return FALSE;
-}
-
-PtrHashMap::PtrIterator CompilationDomain::IterateHardBoundModules()
-{
- WRAPPER_NO_CONTRACT;
- return m_hardBoundModules.begin();
-}
-
-void CompilationDomain::SetAssemblyHardBindList(
- __in_ecount( cHardBindList )
- LPWSTR *pHardBindList,
- DWORD cHardBindList)
-{
- m_assemblyHardBindList.SetCount(0);
-
- for (DWORD i = 0; i < cHardBindList; i++)
- {
- SString s(pHardBindList[i]);
- m_assemblyHardBindList.Append(s);
- }
-
- m_useHardBindList = TRUE;
-}
-#endif // FEATURE_CORECLR
//----------------------------------------------------------------------------
// Is it OK to embed direct pointers to an ngen dependency?
@@ -7703,261 +7482,13 @@ BOOL CompilationDomain::CanEagerBindToZapFile(Module *targetModule, BOOL limitTo
return TRUE;
}
-#ifdef FEATURE_CORECLR // hardbinding
//
// CoreCLR does not have attributes for fine grained eager binding control.
// We hard bind to mscorlib.dll only.
//
return targetModule->IsSystem();
-#else
- // Now, look up the hashtables to avoid doing the heavy-duty work everytime
-
- if (m_cantHardBindModules.LookupValue((UPTR)targetModule, targetModule) !=
- LPVOID(INVALIDENTRY))
- {
- return FALSE;
- }
-
- if (m_hardBoundModules.LookupValue((UPTR)targetModule, targetModule) !=
- LPVOID(INVALIDENTRY))
- {
- return TRUE;
- }
-
- const char * logMsg = NULL;
-
- EEConfig::NgenHardBindType ngenHardBindConfig = g_pConfig->NgenHardBind();
-
- if (ngenHardBindConfig == EEConfig::NGEN_HARD_BIND_NONE)
- {
- logMsg = "COMPlus_HardPrejitEnabled=0 is specified";
- goto CANNOT_HARD_BIND;
- }
-
- if (ngenHardBindConfig == EEConfig::NGEN_HARD_BIND_ALL)
- {
- // COMPlus_HardPrejitEnabled=2 is specified
- limitToHardBindList = FALSE;
- }
-
- if (!targetModule->HasNativeImage())
- {
- logMsg = "dependency does not have a native image (check FusLogVw for reason)";
- goto CANNOT_HARD_BIND;
- }
-
- // The loader/Fusion cannot currently guarantee that a non-manifest module of a
- // hardbound dependency gets eagerly loaded.
- if (!targetModule->GetFile()->IsAssembly())
- {
- logMsg = "dependency is a non-manifest module";
- goto CANNOT_HARD_BIND;
- }
-
- // Don't hard bind to modules not on the list
- if (limitToHardBindList && m_useHardBindList)
- {
- if (!IsInHardBindRequestList(targetModule->GetAssembly()))
- {
- logMsg = "dependency was not found in m_assemblyHardBindList";
- goto CANNOT_HARD_BIND;
- }
- }
-
- // Mark targetModule as a hard dependency
- //
- m_hardBoundModules.InsertValue((UPTR)targetModule, targetModule);
-
- // Update m_pDependencies for the corresponding assembly, to reflect the fact
- // that we are hard-binding to its native image
- //
- PEAssembly * pTargetAssembly;
- pTargetAssembly = targetModule->GetFile()->GetAssembly();
- UpdateDependencyEntryForHardBind(pTargetAssembly);
-
- logMsg = "new dependency";
-
- // Try to hardbind to the hardbound dependency closure as there is
- // no extra cost in doing so
- IncludeHardBindClosure(pTargetAssembly);
-
- LOG((LF_ZAP, LL_INFO100, "Success CanEagerBindToZapFile: %S (%s)\n",
- targetModule->GetDebugName(), logMsg));
-
- return TRUE;
-
-CANNOT_HARD_BIND:
-
- m_cantHardBindModules.InsertValue((UPTR)targetModule, targetModule);
-
- // If we have a hard binding list, check if this module is on the list.
- if (targetModule->GetFile()->IsAssembly() &&
- IsInHardBindRequestList(targetModule->GetAssembly()))
- {
- StackSString displayName;
- targetModule->GetAssembly()->GetDisplayName(displayName);
-
- GetSvcLogger()->Printf(LogLevel_Warning, W("WARNING: Cannot hardbind to %s because %S\n"),
- displayName.GetUnicode(), logMsg);
- }
-
- if (logMsg)
- {
- LOG((LF_ZAP, LL_INFO100, "Failure CanEagerBindToZapFile: %S (%s)\n",
- targetModule->GetDebugName(), logMsg));
- }
-
- return FALSE;
-#endif // FEATURE_CORECLR
-}
-
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-
-SArray<LPCWSTR> * s_pPlatformAssembliesPaths;
-
-void ZapperSetPlatformAssembliesPaths(SString &platformAssembliesPaths)
-{
- STANDARD_VM_CONTRACT;
-
- _ASSERTE(s_pPlatformAssembliesPaths == NULL);
- s_pPlatformAssembliesPaths = new SArray<LPCWSTR>();
-
- SString strPaths(platformAssembliesPaths);
- if (strPaths.IsEmpty())
- return;
-
- for (SString::Iterator i = strPaths.Begin(); i != strPaths.End(); )
- {
- // Skip any leading spaces or semicolons
- if (strPaths.Skip(i, W(';')))
- {
- continue;
- }
-
- SString::Iterator iEnd = i; // Where current assembly name ends
- SString::Iterator iNext; // Where next assembly name starts
- if (strPaths.Find(iEnd, W(';')))
- {
- iNext = iEnd + 1;
- }
- else
- {
- iNext = iEnd = strPaths.End();
- }
-
- _ASSERTE(i < iEnd);
- if(i != iEnd)
- {
- SString strPath(strPaths, i, iEnd);
-
- SString strFullPath;
- Clr::Util::Win32::GetFullPathName(strPath, strFullPath, NULL);
-
- NewArrayHolder<WCHAR> wszFullPath = DuplicateStringThrowing(strFullPath.GetUnicode());
- s_pPlatformAssembliesPaths->Append(wszFullPath);
- wszFullPath.SuppressRelease();
- }
- i = iNext;
- }
}
-BOOL CompilationDomain::FindImage(const SString& fileName, MDInternalImportFlags flags, PEImage ** ppImage)
-{
- if (s_pPlatformAssembliesPaths == NULL)
- return FALSE;
-
- for (COUNT_T i = 0; i < s_pPlatformAssembliesPaths->GetCount(); i++)
- {
- SString sPath((*s_pPlatformAssembliesPaths)[i]);
- if (sPath[sPath.GetCount() - 1] != '\\')
- sPath.Append(W("\\"));
- sPath.Append(fileName);
-
- if (!FileExists(sPath))
- continue;
-
- // Normalize the path to maintain identity
- SString sFullPath;
- Clr::Util::Win32::GetFullPathName(sPath, sFullPath, NULL);
-
- PEImageHolder image(PEImage::OpenImage(sFullPath, flags));
-
- PEImageLayoutHolder pLayout(image->GetLayout(
- (flags == MDInternalImport_NoCache) ? PEImageLayout::LAYOUT_FLAT : PEImageLayout::LAYOUT_MAPPED,
- PEImage::LAYOUT_CREATEIFNEEDED));
-
- if (!pLayout->HasNTHeaders())
- continue;
-
- if (!pLayout->IsNativeMachineFormat())
- {
- // Check for platform agnostic IL
- if (!pLayout->IsPlatformNeutral())
- continue;
- }
-
- *ppImage = image.Extract();
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOL CompilationDomain::IsInHardBindList(SString& simpleName)
-{
- for (COUNT_T i = 0; i < m_assemblyHardBindList.GetCount(); i++)
- {
- if (simpleName.Equals(m_assemblyHardBindList[i]))
- return TRUE;
- }
-
- return FALSE;
-}
-
-void CompilationDomain::ComputeAssemblyHardBindList(IMDInternalImport * pImport)
-{
- AssemblyForLoadHint assembly(pImport);
-
- HENUMInternalHolder hEnum(pImport);
- hEnum.EnumAllInit(mdtAssemblyRef);
-
- mdAssembly token;
- while (pImport->EnumNext(&hEnum, &token))
- {
- LPCSTR pszName;
- IfFailThrow(pImport->GetAssemblyRefProps(token, NULL, NULL,
- &pszName, NULL,
- NULL, NULL, NULL));
-
- SString sSimpleName(SString::Utf8, pszName);
-
- SString sFileName(sSimpleName, W(".dll"));
-
- PEImageHolder pDependencyImage;
-
- if (!FindImage(sFileName, MDInternalImport_Default, &pDependencyImage))
- continue;
-
- AssemblyForLoadHint assemblyDependency(pDependencyImage->GetMDImport());
-
- LoadHintEnum loadHint;
- ::GetLoadHint(&assembly, &assemblyDependency, &loadHint);
-
- if (loadHint == LoadAlways)
- {
- GetSvcLogger()->Printf(W("Hardbinding to %s\n"), sSimpleName.GetUnicode());
-
- if (!IsInHardBindList(sSimpleName))
- {
- m_assemblyHardBindList.Append(sSimpleName);
- }
- }
- }
-
- // Note that we are not setting m_useHardBindList to TRUE here. When we load the NGen image, we are good to hardbind.
- // m_useHardBindList = TRUE;
-}
-#endif
void CompilationDomain::SetTarget(Assembly *pAssembly, Module *pModule)
{
@@ -7977,7 +7508,6 @@ void CompilationDomain::SetTargetImage(DataImage *pImage, CEEPreloader * pPreloa
_ASSERTE(pImage->GetModule() == GetTargetModule());
}
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
void ReportMissingDependency(Exception * e)
{
// Avoid duplicate error messages
@@ -7991,7 +7521,6 @@ void ReportMissingDependency(Exception * e)
g_hrFatalError = COR_E_FILELOAD;
}
-#endif
PEAssembly *CompilationDomain::BindAssemblySpec(
AssemblySpec *pSpec,
@@ -8022,13 +7551,11 @@ PEAssembly *CompilationDomain::BindAssemblySpec(
}
EX_HOOK
{
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
if (!g_fNGenMissingDependenciesOk)
{
ReportMissingDependency(GET_EXCEPTION());
EX_RETHROW;
}
-#endif
//
// Record missing dependencies
@@ -8127,199 +7654,6 @@ void CompilationDomain::SetDependencyEmitter(IMetaDataAssemblyEmit *pEmit)
m_pDependencyRefSpecs = new AssemblySpecHash();
}
-#ifndef FEATURE_CORECLR // hardbinding
-/* Update m_pDependencies for the corresponding assembly, to reflect the fact
- that we are hard-binding to its native image
- */
-
-void CompilationDomain::UpdateDependencyEntryForHardBind(PEAssembly * pDependencyAssembly)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(pDependencyAssembly->HasBindableIdentity()); // Currently no hard deps on WinMD files.
- }
- CONTRACTL_END;
- AssemblySpec assemblySpec;
- assemblySpec.InitializeSpec(pDependencyAssembly);
-
- mdAssemblyRef defToken;
- IfFailThrow(assemblySpec.EmitToken(m_pEmit, &defToken));
-
- CORCOMPILE_DEPENDENCY * pDep = m_pDependencies;
-
- for (unsigned i = 0; i < m_cDependenciesCount; i++, pDep++)
- {
- if (pDep->dwAssemblyDef == defToken)
- {
- PEImage * pNativeImage = pDependencyAssembly->GetPersistentNativeImage();
- CORCOMPILE_VERSION_INFO * pNativeVersion = pNativeImage->GetLoadedLayout()->GetNativeVersionInfo();
- _ASSERTE(pDep->signNativeImage == INVALID_NGEN_SIGNATURE ||
- pDep->signNativeImage == pNativeVersion->signature);
- pDep->signNativeImage = pNativeVersion->signature;
- return;
- }
- }
-
- // We should have found and updated the corresponding dependency
- _ASSERTE(!"This should be unreachable");
-}
-
-// pAssembly is a hardbound ngen dependency of m_pTargetModule.
-// Try to hardbind to the hardbound dependency closure as there is
-// no extra cost in doing so, and it will help generate better code
-//
-
-void CompilationDomain::IncludeHardBindClosure(PEAssembly * pAssembly)
-{
- CONTRACTL {
- PRECONDITION(pAssembly->GetPersistentNativeImage() != NULL);
- } CONTRACTL_END;
-
- PEImageLayout *pNativeImage = pAssembly->GetLoadedNative();
- COUNT_T cDependencies;
- CORCOMPILE_DEPENDENCY *pDependencies = pNativeImage->GetNativeDependencies(&cDependencies);
- CORCOMPILE_DEPENDENCY *pDependenciesEnd = pDependencies + cDependencies;
-
- for (/**/; pDependencies < pDependenciesEnd; pDependencies++)
- {
- // Ignore "soft" dependencies
-
- if (pDependencies->signNativeImage == INVALID_NGEN_SIGNATURE)
- continue;
-
- // Load the manifest file for the given hardbound name-assembly-spec.
-
- AssemblySpec name;
- name.InitializeSpec(pDependencies->dwAssemblyRef,
- pAssembly->GetPersistentNativeImage()->GetNativeMDImport(),
- FindAssembly(pAssembly),
- FALSE);
-
- DomainAssembly * pDependency = name.LoadDomainAssembly(FILE_LOADED);
-
- // Since pAssembly hardbinds to pDependency, pDependency better
- // have a native image
- _ASSERTE(pDependency->GetFile()->HasNativeImage());
-
- //
- // Now add pDependency as a hard dependency of m_pTargetModule.
- // We pass in limitToHardBindList=FALSE as it is OK to hardbind even if
- // pDependency is not in the hardbound list.
- //
-
- CanEagerBindToZapFile(pDependency->GetLoadedModule(), FALSE);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Check if we were successfully able to hardbind to the requested dependency
-
-void CompilationDomain::CheckHardBindToZapFile(SString dependencyNameFromCA)
-{
- // First check if we were successfully able to hard-bind
-
- for (PtrHashMap::PtrIterator hbItr = m_hardBoundModules.begin(); !hbItr.end(); ++hbItr)
- {
- Module * pModule = (Module*) hbItr.GetValue();
-
- if (IsAssemblySpecifiedInCA(pModule->GetAssembly(), dependencyNameFromCA))
- {
- // We did successfully use "dependencyNameFromCA"
- return;
- }
- }
-
- // Next, check if we failed to hard-bind. CompilationDomain::CanEagerBindToZapFile()
- // would have logged a warning message with the cause of the soft-bind
-
- for (PtrHashMap::PtrIterator sbItr = m_cantHardBindModules.begin(); !sbItr.end(); ++sbItr)
- {
- Module * pModule = (Module*) sbItr.GetValue();
-
- if (IsAssemblySpecifiedInCA(pModule->GetAssembly(), dependencyNameFromCA))
- {
- if (!IsInHardBindRequestList(pModule->GetAssembly()))
- {
- // CompilationDomain::CanEagerBindToZapFile() does not give a warning
- // message for the cyclic dependency case, since the NGEN service
- // breaks the cycle by overriding the CA. So give a message here instead.
- GetSvcLogger()->Printf(LogLevel_Warning, W("WARNING: Dependency attribute for %s is being ignored, possibly because of cyclic dependencies.\n"),
- dependencyNameFromCA.GetUnicode());
- }
- return;
- }
- }
-
- // Finally, it looks like the assembly was either not loaded, or that
- // there was no reason to even try to hard-bind.
-
- GetSvcLogger()->Printf(LogLevel_Warning, W("WARNING: Cannot hardbind to %s because it is not loaded\n"),
- dependencyNameFromCA.GetUnicode());
-}
-
-//-----------------------------------------------------------------------------
-// Check if we were successfully able to hardbind to all the requested
-// dependencies.
-
-void CompilationDomain::CheckLoadHints()
-{
- if (!m_useHardBindList)
- return;
-
- if (g_pConfig->NgenHardBind() == EEConfig::NGEN_HARD_BIND_NONE)
- return;
-
- // Look for the binding custom attribute
-
- IMDInternalImport * pImport = m_pTargetAssembly->GetManifestImport();
- _ASSERTE(pImport);
-
- MDEnumHolder hEnum(pImport); // Enumerator for custom attributes
- if (FAILED(pImport->EnumCustomAttributeByNameInit(m_pTargetAssembly->GetManifestToken(),
- DEPENDENCY_TYPE,
- &hEnum)))
- {
- return;
- }
-
- mdCustomAttribute tkAttribute; // A custom attribute on this assembly.
- const BYTE *pbAttr; // Custom attribute data as a BYTE*.
- ULONG cbAttr; // Size of custom attribute data.
-
- while (pImport->EnumNext(&hEnum, &tkAttribute))
- { // Get raw custom attribute.
- IfFailThrow(pImport->GetCustomAttributeAsBlob(tkAttribute, (const void**)&pbAttr, &cbAttr));
-
- CustomAttributeParser cap(pbAttr, cbAttr);
- if (FAILED(cap.ValidateProlog()))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, m_pTargetAssembly->GetManifestModule());
- }
-
- LPCUTF8 szString;
- ULONG cbString;
- if (FAILED(cap.GetNonNullString(&szString, &cbString)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_STRING, m_pTargetAssembly->GetManifestModule());
- }
-
- UINT32 u4;
- IfFailThrow(cap.GetU4(&u4));
- LoadHintEnum loadHint = (LoadHintEnum)u4;
-
- if (loadHint != LoadAlways)
- continue;
-
- // Convert the string to Unicode.
- StackSString dependencyNameFromCA(SString::Utf8, szString, cbString);
-
- CheckHardBindToZapFile(dependencyNameFromCA);
- }
-}
-#endif // FEATURE_CORECLR
HRESULT
CompilationDomain::GetDependencies(CORCOMPILE_DEPENDENCY **ppDependencies,
@@ -8327,9 +7661,6 @@ HRESULT
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_CORECLR // hardbinding
- CheckLoadHints();
-#endif
//
// Return the bindings.
@@ -8412,16 +7743,5 @@ HRESULT CompilationDomain::SetPlatformWinmdPaths(LPCWSTR pwzPlatformWinmdPaths)
}
#endif // CROSSGEN_COMPILE
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
-bool UseRyuJit()
-{
-#ifdef CROSSGEN_COMPILE
- return true;
-#else
- static ConfigDWORD useRyuJitValue;
- return useRyuJitValue.val(CLRConfig::INTERNAL_UseRyuJit) == 1 || IsNgenOffline();
-#endif
-}
-#endif
#endif // FEATURE_PREJIT
diff --git a/src/vm/compile.h b/src/vm/compile.h
index 8ee66dbec8..140a62fcb0 100644
--- a/src/vm/compile.h
+++ b/src/vm/compile.h
@@ -235,12 +235,6 @@ class CEECompileInfo : public ICorCompileInfo
mdFile file,
CORINFO_MODULE_HANDLE *pHandle);
-#ifndef FEATURE_CORECLR
- // Check if the assembly supports automatic NGen
- BOOL SupportsAutoNGen(CORINFO_ASSEMBLY_HANDLE assembly);
-
- HRESULT SetCachedSigningLevel(HANDLE hNI, HANDLE *pModules, COUNT_T nModules);
-#endif
BOOL CheckAssemblyZap(
CORINFO_ASSEMBLY_HANDLE assembly,
@@ -757,9 +751,6 @@ typedef SHash<AssemblySpecDefRefMapTraits> AssemblySpecMapDefRefMapTable;
class CompilationDomain : public AppDomain,
public ICorCompilationDomain
{
-#ifndef FEATURE_CORECLR
- VPTR_MULTI_VTABLE_CLASS(CompilationDomain, AppDomain);
-#endif
public:
BOOL m_fForceDebug;
@@ -796,14 +787,6 @@ class CompilationDomain : public AppDomain,
HRESULT AddDependencyEntry(PEAssembly *pFile, mdAssemblyRef ref,mdAssemblyRef def);
void ReleaseDependencyEmitter();
-#ifndef FEATURE_CORECLR // hardbinding
- PtrHashMap m_hardBoundModules; // Hard dependency on native image of these dependency modules
- PtrHashMap m_cantHardBindModules;
- void UpdateDependencyEntryForHardBind(PEAssembly * pDependencyAssembly);
- void IncludeHardBindClosure(PEAssembly * pDependencyAssembly);
- void CheckHardBindToZapFile(SString dependencyNameFromCustomAttribute);
- void CheckLoadHints();
-#endif
public:
@@ -831,28 +814,7 @@ class CompilationDomain : public AppDomain,
BOOL CanEagerBindToZapFile(Module *targetModule, BOOL limitToHardBindList = TRUE);
-#ifndef FEATURE_CORECLR // hardbinding
- PtrHashMap::PtrIterator IterateHardBoundModules();
-
- // List of full display names of assemblies to hard-bind to
- SArray<SString,FALSE> m_assemblyHardBindList;
- BOOL m_useHardBindList;
- BOOL IsInHardBindRequestList(Assembly * pAssembly);
- BOOL IsInHardBindRequestList(PEAssembly * pAssembly);
- BOOL IsSafeToHardBindTo(PEAssembly * pAssembly);
- void SetAssemblyHardBindList(
- __in_ecount( cHardBindList )
- LPWSTR *pHardBindList,
- DWORD cHardBindList);
-#endif
-
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- void ComputeAssemblyHardBindList(IMDInternalImport * pImport);
- BOOL IsInHardBindList(SString& simpleName);
-
- static BOOL FindImage(const SString& fileName, MDInternalImportFlags flags, PEImage ** ppImage);
-#endif
// Returns NULL on out-of-memory
RefCache *GetRefCache(Module *pModule)
diff --git a/src/vm/comsynchronizable.cpp b/src/vm/comsynchronizable.cpp
index b486687752..9a45c9cb7a 100644
--- a/src/vm/comsynchronizable.cpp
+++ b/src/vm/comsynchronizable.cpp
@@ -607,59 +607,6 @@ FCIMPL1(void, ThreadNative::ResetAbort, ThreadBaseObject* pThis)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-// You can only suspend a running thread.
-FCIMPL1(void, ThreadNative::Suspend, ThreadBaseObject* pThisUNSAFE)
-{
- FCALL_CONTRACT;
-
- if (pThisUNSAFE == NULL)
- FCThrowResVoid(kNullReferenceException, W("NullReference_This"));
-
- Thread *thread = pThisUNSAFE->GetInternal();
-
- HELPER_METHOD_FRAME_BEGIN_0();
-
-#ifdef MDA_SUPPORTED
- MDA_TRIGGER_ASSISTANT(DangerousThreadingAPI, ReportViolation(W("System.Threading.Thread.Suspend")));
-#endif
-
- if (!ThreadIsRunning(thread))
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_SUSPEND_NON_RUNNING);
-
- thread->UserSuspendThread();
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-// You can only resume a thread that is in the user-suspended state. (This puts a large
-// burden on the app developer, but we want him to be thinking carefully about race
-// conditions. Precise errors give him a hope of sorting out his logic).
-FCIMPL1(void, ThreadNative::Resume, ThreadBaseObject* pThisUNSAFE)
-{
- FCALL_CONTRACT;
-
- if (pThisUNSAFE == NULL)
- FCThrowResVoid(kNullReferenceException, W("NullReference_This"));
-
- Thread *thread = pThisUNSAFE->GetInternal();
-
- HELPER_METHOD_FRAME_BEGIN_0();
-
- // UserResumeThread() will return 0 if there isn't a user suspension for us to
- // clear.
- if (!ThreadIsRunning(thread))
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_RESUME_NON_RUNNING);
-
- if (thread->UserResumeThread() == 0)
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_RESUME_NON_USER_SUSPEND);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-#endif // FEATURE_CORECLR
// Note that you can manipulate the priority of a thread that hasn't started yet,
// or one that is running. But you get an exception if you manipulate the priority
@@ -1913,41 +1860,6 @@ UINT64 QCALLTYPE ThreadNative::GetProcessDefaultStackSize()
return (UINT64)reserve;
}
-#ifndef FEATURE_CORECLR
-FCIMPL0(void, ThreadNative::BeginCriticalRegion)
-{
- FCALL_CONTRACT;
- if (CLRHosted())
- {
- GetThread()->BeginCriticalRegion_NoCheck();
- }
-}
-FCIMPLEND
-
-FCIMPL0(void, ThreadNative::EndCriticalRegion)
-{
- FCALL_CONTRACT;
- if (CLRHosted())
- {
- GetThread()->EndCriticalRegion_NoCheck();
- }
-}
-FCIMPLEND
-
-FCIMPL0(void, ThreadNative::BeginThreadAffinity)
-{
- FCALL_CONTRACT;
- Thread::BeginThreadAffinity();
-}
-FCIMPLEND
-
-FCIMPL0(void, ThreadNative::EndThreadAffinity)
-{
- FCALL_CONTRACT;
- Thread::EndThreadAffinity();
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL1(FC_BOOL_RET, ThreadNative::IsThreadpoolThread, ThreadBaseObject* thread)
@@ -2128,69 +2040,6 @@ FCIMPL2(void, ThreadNative::SetAbortReason, ThreadBaseObject* pThisUNSAFE, Objec
}
FCIMPLEND
-#ifndef FEATURE_CORECLR // core clr does not support abort reason
-FCIMPL1(Object*, ThreadNative::GetAbortReason, ThreadBaseObject *pThisUNSAFE)
-{
- FCALL_CONTRACT;
-
- if (pThisUNSAFE==NULL)
- FCThrowRes(kNullReferenceException, W("NullReference_This"));
-
- OBJECTREF refRetVal = NULL;
- Thread *pThread = pThisUNSAFE->GetInternal();
-
- // Set up a frame in case of GC or EH
- HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal)
-
- if (pThread == NULL)
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_CANNOT_GET);
-
- // While the ExceptionInfo probably will be *set* from a different
- // thread, it should only be *read* from the current thread.
- _ASSERTE(GetThread() == pThread);
-
- // Set cooperative mode, to avoid AD unload while we're working.
- GCX_COOP();
-
- OBJECTHANDLE oh=NULL;
- ADID adid;
- // Scope the lock to reading the two fields on the Thread object.
- { // Atomically get the OBJECTHANDLE and ADID of the object
- // NOTE: get the lock on this thread object, not on the executing thread.
- Thread::AbortRequestLockHolder lock(pThread);
- oh = pThread->m_AbortReason;
- adid = pThread->m_AbortReasonDomainID;
- }
-
- // If the OBJECTHANDLE is not 0...
- if (oh != 0)
- {
-
- AppDomain *pCurrentDomain = pThread->GetDomain();
- // See if the appdomain is equal to the appdomain of the currently running
- // thread.
-
- if (pCurrentDomain->GetId() == adid)
- { // Same appdomain; just return object from the OBJECTHANDLE
- refRetVal = ObjectFromHandle(oh);
- }
- else
- { // Otherwise, try to marshal the object from the other AppDomain
- ENTER_DOMAIN_ID(adid);
- CrossAppDomainClonerCallback cadcc;
- ObjectClone Cloner(&cadcc, CrossAppDomain, FALSE);
- refRetVal = Cloner.Clone(ObjectFromHandle(oh), GetAppDomain(), pCurrentDomain, NULL);
- Cloner.RemoveGCFrames();
- END_DOMAIN_TRANSITION;
- }
- }
-
- HELPER_METHOD_FRAME_END()
-
- return OBJECTREFToObject(refRetVal);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL1(void, ThreadNative::ClearAbortReason, ThreadBaseObject* pThisUNSAFE)
{
diff --git a/src/vm/comsynchronizable.h b/src/vm/comsynchronizable.h
index d9c2defd70..9a87d8eb67 100644
--- a/src/vm/comsynchronizable.h
+++ b/src/vm/comsynchronizable.h
@@ -69,10 +69,6 @@ public:
static FCDECL1(void, Abort, ThreadBaseObject* pThis);
static FCDECL1(void, ResetAbort, ThreadBaseObject* pThis);
static FCDECL2(void, Start, ThreadBaseObject* pThisUNSAFE, StackCrawlMark* pStackMark);
-#ifndef FEATURE_CORECLR
- static FCDECL1(void, Suspend, ThreadBaseObject* pThisUNSAFE);
- static FCDECL1(void, Resume, ThreadBaseObject* pThisUNSAFE);
-#endif // FEATURE_CORECLR
static FCDECL1(INT32, GetPriority, ThreadBaseObject* pThisUNSAFE);
static FCDECL2(void, SetPriority, ThreadBaseObject* pThisUNSAFE, INT32 iPriority);
static FCDECL1(void, Interrupt, ThreadBaseObject* pThisUNSAFE);
@@ -109,12 +105,6 @@ public:
UINT64 QCALLTYPE GetProcessDefaultStackSize();
static FCDECL1(INT32, GetManagedThreadId, ThreadBaseObject* th);
-#ifndef FEATURE_CORECLR
- static FCDECL0(void, BeginCriticalRegion);
- static FCDECL0(void, EndCriticalRegion);
- static FCDECL0(void, BeginThreadAffinity);
- static FCDECL0(void, EndThreadAffinity);
-#endif // !FEATURE_CORECLR
static FCDECL1(void, SpinWait, int iterations);
static BOOL QCALLTYPE YieldThread();
static FCDECL0(Object*, GetCurrentThread);
@@ -135,9 +125,6 @@ public:
static FCDECL1(void, SetIsThreadStaticsArray, Object* pObject);
static FCDECL2(void, SetAbortReason, ThreadBaseObject* pThisUNSAFE, Object* pObject);
-#ifndef FEATURE_CORECLR
- static FCDECL1(Object*, GetAbortReason, ThreadBaseObject* pThisUNSAFE);
-#endif
static FCDECL1(void, ClearAbortReason, ThreadBaseObject* pThisUNSAFE);
private:
diff --git a/src/vm/comthreadpool.cpp b/src/vm/comthreadpool.cpp
index a4c7e75064..c26242e85d 100644
--- a/src/vm/comthreadpool.cpp
+++ b/src/vm/comthreadpool.cpp
@@ -632,31 +632,6 @@ void SetAsyncResultProperties(
STATIC_CONTRACT_MODE_ANY;
STATIC_CONTRACT_SO_TOLERANT;
-#ifndef FEATURE_CORECLR
- ASYNCRESULTREF asyncResult = overlapped->m_asyncResult;
- // only filestream is expected to have a null delegate in which
- // case we do the necessary book-keeping here. However, for robustness
- // we should make sure that the asyncResult is indeed an instance of
- // FileStreamAsyncResult
- if (asyncResult->GetMethodTable() == g_pAsyncFileStream_AsyncResultClass)
- {
- // Handle reading from & writing to closed pipes. It's possible for
- // an async read on a pipe to be issued and then the pipe is closed,
- // returning this error. This may very well be necessary. -BG
- if (dwErrorCode == ERROR_BROKEN_PIPE || dwErrorCode == ERROR_NO_DATA)
- dwErrorCode = 0;
- asyncResult->SetErrorCode(dwErrorCode);
- asyncResult->SetNumBytes(dwNumBytes);
- asyncResult->SetCompletedAsynchronously();
- asyncResult->SetIsComplete();
-
- // Signal the event - the OS does not do this for us.
- WAITHANDLEREF waitHandle = asyncResult->GetWaitHandle();
- HANDLE h = waitHandle->GetWaitHandle();
- if ((h != NULL) && (h != (HANDLE) -1))
- UnsafeSetEvent(h);
- }
-#endif // !FEATURE_CORECLR
}
VOID BindIoCompletionCallBack_Worker(LPVOID args)
@@ -698,13 +673,6 @@ VOID BindIoCompletionCallBack_Worker(LPVOID args)
// no user delegate to callback
_ASSERTE((overlapped->m_iocbHelper == NULL) || !"This is benign, but should be optimized");
-#ifndef FEATURE_CORECLR
- // we cannot do this at threadpool initialization time since mscorlib may not have been loaded
- if (!g_pAsyncFileStream_AsyncResultClass)
- {
- g_pAsyncFileStream_AsyncResultClass = MscorlibBinder::GetClass(CLASS__FILESTREAM_ASYNCRESULT);
- }
-#endif // !FEATURE_CORECLR
SetAsyncResultProperties(overlapped, ErrorCode, numBytesTransferred);
}
diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp
index 0ef7460d37..04ad7a8c1a 100644
--- a/src/vm/comutilnative.cpp
+++ b/src/vm/comutilnative.cpp
@@ -777,48 +777,6 @@ FCIMPL1(FC_BOOL_RET, ExceptionNative::IsTransient, INT32 hresult)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-
-FCIMPL3(StringObject *, ExceptionNative::StripFileInfo, Object *orefExcepUNSAFE, StringObject *orefStrUNSAFE, CLR_BOOL isRemoteStackTrace)
-{
- FCALL_CONTRACT;
-
- OBJECTREF orefExcep = ObjectToOBJECTREF(orefExcepUNSAFE);
- STRINGREF orefStr = (STRINGREF)ObjectToOBJECTREF(orefStrUNSAFE);
-
- if (orefStr == NULL)
- {
- return NULL;
- }
-
- HELPER_METHOD_FRAME_BEGIN_RET_2(orefExcep, orefStr);
-
- if (isRemoteStackTrace)
- {
- if (!AppX::IsAppXProcess() && ExceptionTypeOverridesStackTraceGetter(orefExcep->GetMethodTable()))
- {
- // In classic processes, the remote stack trace could have been generated using a custom get_StackTrace
- // override which means that we would not be able to parse is - strip the whole string by returning NULL.
- orefStr = NULL;
- }
- }
-
- if (orefStr != NULL)
- {
- SString stackTrace;
- orefStr->GetSString(stackTrace);
-
- StripFileInfoFromStackTrace(stackTrace);
-
- orefStr = AllocateString(stackTrace);
- }
-
- HELPER_METHOD_FRAME_END();
- return (StringObject *)OBJECTREFToObject(orefStr);
-}
-FCIMPLEND
-
-#endif // !FEATURE_CORECLR
#if defined(FEATURE_EXCEPTIONDISPATCHINFO)
// This FCall sets a flag against the thread exception state to indicate to
@@ -2847,67 +2805,8 @@ FCIMPL1(INT32, ValueTypeHelper::GetHashCodeOfPtr, LPVOID ptr)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-FCIMPL1(OBJECTHANDLE, SizedRefHandle::Initialize, Object* _obj)
-{
- FCALL_CONTRACT;
-
- OBJECTHANDLE result = 0;
- OBJECTREF obj(_obj);
-
- HELPER_METHOD_FRAME_BEGIN_RET_0();
-
- result = GetAppDomain()->CreateSizedRefHandle(obj);
-
- HELPER_METHOD_FRAME_END();
-
- return result;
-}
-FCIMPLEND
-
-FCIMPL1(VOID, SizedRefHandle::Free, OBJECTHANDLE handle)
-{
- FCALL_CONTRACT;
-
- _ASSERTE(handle != NULL);
-
- HELPER_METHOD_FRAME_BEGIN_0();
-
- DestroySizedRefHandle(handle);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-FCIMPL1(LPVOID, SizedRefHandle::GetTarget, OBJECTHANDLE handle)
-{
- FCALL_CONTRACT;
-
- _ASSERTE(handle != NULL);
-
- OBJECTREF objRef = NULL;
-
- objRef = ObjectFromHandle(handle);
-
- FCUnique(0x33);
- return *((LPVOID*)&objRef);
-}
-FCIMPLEND
-
-FCIMPL1(INT64, SizedRefHandle::GetApproximateSize, OBJECTHANDLE handle)
-{
- FCALL_CONTRACT;
-
- _ASSERTE(handle != NULL);
-
- return (INT64)HndGetHandleExtraInfo(handle);
-}
-FCIMPLEND
-#endif //!FEATURE_CORECLR
-#ifdef FEATURE_CORECLR
COMNlsHashProvider COMNlsHashProvider::s_NlsHashProvider;
-#endif // FEATURE_CORECLR
COMNlsHashProvider::COMNlsHashProvider()
diff --git a/src/vm/comutilnative.h b/src/vm/comutilnative.h
index dce7ec600b..32c1c2eef3 100644
--- a/src/vm/comutilnative.h
+++ b/src/vm/comutilnative.h
@@ -26,9 +26,6 @@
#include "windows.h"
#undef GetCurrentTime
-#ifndef FEATURE_CORECLR
-#include <winnls.h>
-#endif
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
#pragma warning(push)
@@ -249,35 +246,6 @@ public:
static FCDECL1(INT32, GetHashCodeOfPtr, LPVOID ptr);
};
-#ifndef FEATURE_CORECLR
-class SizedRefHandle
-{
-public:
- static FCDECL1(OBJECTHANDLE, Initialize, Object* _obj);
- static FCDECL1(VOID, Free, OBJECTHANDLE handle);
- static FCDECL1(LPVOID, GetTarget, OBJECTHANDLE handle);
- static FCDECL1(INT64, GetApproximateSize, OBJECTHANDLE handle);
-};
-
-typedef BOOL (*PFN_IS_NLS_DEFINED_STRING)(NLS_FUNCTION, DWORD, LPNLSVERSIONINFO, LPCWSTR, INT);
-typedef INT (*PFN_COMPARE_STRING_EX)(LPCWSTR, DWORD, LPCWSTR, INT, LPCWSTR, INT, LPNLSVERSIONINFO, LPVOID, LPARAM);
-typedef INT (*PFN_LC_MAP_STRING_EX)(LPCWSTR, DWORD, LPCWSTR, INT, LPWSTR, INT, LPNLSVERSIONINFO, LPVOID, LPARAM);
-typedef INT (*PFN_FIND_NLS_STRING_EX)(LPCWSTR, DWORD, LPCWSTR, INT, LPCWSTR, INT, LPINT, LPNLSVERSIONINFO, LPVOID, LPARAM);
-typedef INT (*PFN_COMPARE_STRING_ORDINAL)(LPCWSTR, INT, LPCWSTR, INT, BOOL);
-typedef BOOL (*PFN_GET_NLS_VERSION_EX)(NLS_FUNCTION, LPCWSTR, LPNLSVERSIONINFOEX);
-typedef INT (*PFN_FIND_STRING_ORDINAL)(DWORD, LPCWSTR, INT, LPCWSTR, INT, BOOL);
-
-class COMNlsCustomSortLibrary {
-public:
- PFN_IS_NLS_DEFINED_STRING pIsNLSDefinedString;
- PFN_COMPARE_STRING_EX pCompareStringEx;
- PFN_LC_MAP_STRING_EX pLCMapStringEx;
- PFN_FIND_NLS_STRING_EX pFindNLSStringEx;
- PFN_COMPARE_STRING_ORDINAL pCompareStringOrdinal;
- PFN_GET_NLS_VERSION_EX pGetNLSVersionEx;
- PFN_FIND_STRING_ORDINAL pFindStringOrdinal;
-};
-#endif //!FEATURE_CORECLR
typedef const BYTE * PCBYTE;
@@ -289,9 +257,7 @@ public:
INT32 HashSortKey(PCBYTE pSrc, SIZE_T cbSrc, BOOL forceRandomHashing, INT64 additionalEntropy);
INT32 HashiStringKnownLower80(LPCWSTR lpszStr, INT32 strLen, BOOL forceRandomHashing, INT64 additionalEntropy);
-#ifdef FEATURE_CORECLR
static COMNlsHashProvider s_NlsHashProvider;
-#endif // FEATURE_CORECLR
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
void SetUseRandomHashing(BOOL useRandomHashing) { LIMITED_METHOD_CONTRACT; bUseRandomHashing = useRandomHashing; }
diff --git a/src/vm/comwaithandle.cpp b/src/vm/comwaithandle.cpp
index 13886c3de8..7b15ae5acd 100644
--- a/src/vm/comwaithandle.cpp
+++ b/src/vm/comwaithandle.cpp
@@ -181,11 +181,6 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitOneNative, SafeHandle* safeWaitHandleUNS
Context* defaultContext;
defaultContext = pThread->GetDomain()->GetDefaultContext();
_ASSERTE(defaultContext);
-#ifndef FEATURE_CORECLR
- // DoAppropriateWait calls LeaveRuntime/EnterRuntime which may cause the current
- // fiber to be re-scheduled.
- ThreadAffinityAndCriticalRegionHolder affinityAndCriticalRegionHolder(hasThreadAffinity);
-#endif
SafeHandleHolder shh(&sh);
// Note that SafeHandle is a GC object, and RequestCallback and
// DoAppropriateWait work on an array of handles. Don't pass the address
@@ -222,18 +217,6 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitOneNative, SafeHandle* safeWaitHandleUNS
retVal = res;
-#ifndef FEATURE_CORECLR
- if (res == WAIT_OBJECT_0 && hasThreadAffinity) {
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
- else if(res == WAIT_ABANDONED_0) {
- // WAIT_ABANDONED means the specified object is a mutex object that was not released by the thread
- // that owned the mutex object before the owning thread terminated.
- // Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled.
- _ASSERTE(hasThreadAffinity);
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
-#endif
HELPER_METHOD_FRAME_END();
return retVal;
@@ -263,22 +246,12 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitMultipleNative, Object* waitObjectsUNSAF
// on CoreCLR we won't break anyone.
// Perhaps in a future release we can fix this, if we aren't quite so concerned about
// compatibility....
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- if (waitForAll && numWaiters > 1 && pThread->GetApartment() == Thread::AS_InSTA) {
- COMPlusThrow(kNotSupportedException, W("NotSupported_WaitAllSTAThread"));
- }
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
WaitHandleArrayHolder arrayHolder;
arrayHolder.Initialize(numWaiters, (PTRARRAYREF*) &waitObjects);
pWaitObjects = (PTRARRAYREF)waitObjects; // array of objects on which to wait
HANDLE* internalHandles = (HANDLE*) _alloca(numWaiters*sizeof(HANDLE));
-#ifndef FEATURE_CORECLR
- BOOL *hasThreadAffinity = (BOOL*) _alloca(numWaiters*sizeof(BOOL));
-
- BOOL mayRequireThreadAffinity = FALSE;
-#endif // !FEATURE_CORECLR
for (int i=0;i<numWaiters;i++)
{
WAITHANDLEREF waitObject = (WAITHANDLEREF) pWaitObjects->m_Array[i];
@@ -289,19 +262,9 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitMultipleNative, Object* waitObjectsUNSAF
// this behavior seems wrong but someone explicitly coded that condition so it must have been for a reason.
internalHandles[i] = waitObject->m_handle;
-#ifndef FEATURE_CORECLR
- // m_hasThreadAffinity is set for Mutex only
- hasThreadAffinity[i] = waitObject->m_hasThreadAffinity;
- if (hasThreadAffinity[i]) {
- mayRequireThreadAffinity = TRUE;
- }
-#endif // !FEATURE_CORECLR
}
DWORD res = (DWORD) -1;
-#ifndef FEATURE_CORECLR
- ThreadAffinityHolder affinityHolder(mayRequireThreadAffinity);
-#endif // !FEATURE_CORECLR
Context* targetContext;
targetContext = pThread->GetContext();
_ASSERTE(targetContext);
@@ -335,45 +298,6 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitMultipleNative, Object* waitObjectsUNSAF
}
}
-#ifndef FEATURE_CORECLR
- if (mayRequireThreadAffinity) {
- if (waitForAll) {
- if (res >= (DWORD) WAIT_OBJECT_0 && res < (DWORD) WAIT_OBJECT_0 + numWaiters) {
- for (int i = 0; i < numWaiters; i ++) {
- if (hasThreadAffinity[i]) {
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- }
- // If some mutex is abandoned
- else if (res >= (DWORD) WAIT_ABANDONED_0 && res < (DWORD) WAIT_ABANDONED_0+numWaiters) {
- for (int i = 0; i < numWaiters; i ++) {
- if (hasThreadAffinity[i])
- {
- if (WaitForSingleObject(internalHandles[i],0) == WAIT_OBJECT_0)
- {
- BOOL result;
- result = ReleaseMutex(internalHandles[i]);
- _ASSERTE (result);
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- }
- }
- }
- else {
- if ( res >= (DWORD)WAIT_OBJECT_0 && res < (DWORD)WAIT_OBJECT_0 + numWaiters) {
- if (hasThreadAffinity[res - WAIT_OBJECT_0]) {
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- else if (res >= (DWORD)WAIT_ABANDONED_0 && res < (DWORD)WAIT_ABANDONED_0 + numWaiters) {
- _ASSERTE (hasThreadAffinity[res - WAIT_ABANDONED_0]);
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- }
-#endif // !FEATURE_CORECLR
retVal = res;
@@ -415,11 +339,6 @@ FCIMPL5(INT32, WaitHandleNative::CorSignalAndWaitOneNative, SafeHandle* safeWait
Context* defaultContext = pThread->GetDomain()->GetDefaultContext();
_ASSERTE(defaultContext);
-#ifndef FEATURE_CORECLR
- // DoSignalAndWait calls LeaveRuntime/EnterRuntime which may cause the current
- // fiber to be re-scheduled.
- ThreadAffinityAndCriticalRegionHolder affinityAndCriticalRegionHolder(hasThreadAffinity);
-#endif // !FEATURE_CORECLR
SafeHandleHolder shhSignal(&shSignal);
SafeHandleHolder shhWait(&shWait);
@@ -444,15 +363,6 @@ FCIMPL5(INT32, WaitHandleNative::CorSignalAndWaitOneNative, SafeHandle* safeWait
res = pThread->DoSignalAndWait(handles,timeout,TRUE /*alertable*/);
}
-#ifndef FEATURE_CORECLR
- if (res == WAIT_OBJECT_0 && hasThreadAffinity) {
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
- else if(res == WAIT_ABANDONED_0) {
- _ASSERTE(hasThreadAffinity);
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
-#endif // !FEATURE_CORECLR
retVal = res;
diff --git a/src/vm/coreassemblyspec.cpp b/src/vm/coreassemblyspec.cpp
index 310c663392..a850bab487 100644
--- a/src/vm/coreassemblyspec.cpp
+++ b/src/vm/coreassemblyspec.cpp
@@ -595,104 +595,5 @@ VOID BaseAssemblySpec::GetFileOrDisplayName(DWORD flags, SString &result) const
result));
}
-#ifndef FEATURE_CORECLR
-
-//
-// Trivial assembly binder for desktop crossgen
-//
-
-VOID AssemblySpec::Bind(AppDomain *pAppDomain,
- BOOL fThrowOnFileNotFound,
- CoreBindResult *pResult,
- BOOL fNgenExplicitBind /* = FALSE */,
- BOOL fExplicitBindToNativeImage /* = FALSE */,
- StackCrawlMark *pCallerStackMark /* = NULL */)
-{
- PEImageHolder pImage;
- BOOL fNativeImage = FALSE;
-
- if (GetCodeBase() != NULL)
- {
- // Normalize the path to maintain identity
- SString sFullAssemblyPath;
- Clr::Util::Win32::GetFullPathName(GetCodeBase(), sFullAssemblyPath, NULL);
-
- pImage = PEImage::OpenImage(sFullAssemblyPath, MDInternalImport_Default);
- }
- else
- {
- SString sSimpleName(SString::Utf8, m_pAssemblyName);
-
- fNativeImage = !IsReadyToRunCompilation() && pAppDomain->ToCompilationDomain()->IsInHardBindList(sSimpleName);
-
- SString sFileName(sSimpleName, fNativeImage ? W(".ni.dll") : W(".dll"));
-
- if (!CompilationDomain::FindImage(sFileName,
- fNativeImage ? MDInternalImport_TrustedNativeImage : MDInternalImport_Default,
- &pImage))
- {
- sFileName.Set(sSimpleName, fNativeImage ? W(".ni.exe") : W(".exe"));
-
- if (!CompilationDomain::FindImage(sFileName,
- fNativeImage ? MDInternalImport_TrustedNativeImage : MDInternalImport_Default,
- &pImage))
- {
- EEFileLoadException::Throw(sSimpleName, COR_E_FILENOTFOUND);
- }
- }
- }
-
- GetSvcLogger()->Printf(W("Loading %s\n"), pImage->GetPath().GetUnicode());
-
- NewHolder<BINDER_SPACE::Assembly> pAssembly;
- pAssembly = new BINDER_SPACE::Assembly();
-
- pAssembly->m_assemblyPath.Set(pImage->GetPath());
-
- if (fNativeImage)
- pAssembly->SetNativePEImage(pImage.Extract());
- else
- pAssembly->SetPEImage(pImage.Extract());
-
- pResult->Init(pAssembly.Extract(), TRUE, TRUE);
-}
-
-VOID AssemblySpec::BindToSystem(BINDER_SPACE::Assembly** ppAssembly)
-{
- PEImageHolder pImage;
- BOOL fNativeImage = FALSE;
-
- _ASSERTE(ppAssembly != nullptr);
-
- if (g_fAllowNativeImages)
- {
- if (CompilationDomain::FindImage(W("mscorlib.ni.dll"), MDInternalImport_TrustedNativeImage, &pImage))
- fNativeImage = TRUE;
- }
-
- if (!fNativeImage)
- {
- if (!CompilationDomain::FindImage(W("mscorlib.dll"), MDInternalImport_Default, &pImage))
- {
- EEFileLoadException::Throw(W("mscorlib.dll"), COR_E_FILENOTFOUND);
- }
- }
-
- GetSvcLogger()->Printf(W("Loading %s\n"), pImage->GetPath().GetUnicode());
-
- NewHolder<BINDER_SPACE::Assembly> pAssembly;
- pAssembly = new BINDER_SPACE::Assembly();
-
- pAssembly->m_assemblyPath.Set(pImage->GetPath());
-
- if (fNativeImage)
- pAssembly->SetNativePEImage(pImage.Extract());
- else
- pAssembly->SetPEImage(pImage.Extract());
-
- *ppAssembly = pAssembly.Extract();
-}
-
-#endif // !FEATURE_CORECLR
#endif // FEATURE_FUSION
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index e00482168d..c71c2f9879 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -89,395 +89,9 @@ extern BOOL g_fEEHostedStartup;
INT64 g_PauseTime; // Total time in millisecond the CLR has been paused
Volatile<BOOL> g_IsPaused; // True if the runtime is paused (FAS)
CLREventStatic g_ClrResumeEvent; // Event that is fired at FAS Resuming
-#ifndef FEATURE_CORECLR
-CLREventStatic g_PauseCompletedEvent; // Set when Pause has completed its work on another thread.
-#endif
-#if defined(FEATURE_CORECLR)
extern BYTE g_rbTestKeyBuffer[];
-#endif
-
-#if !defined(FEATURE_CORECLR)
-//******************************************************************************
-// <TODO>TODO: ICorThreadpool: Move this into a separate file CorThreadpool.cpp
-// after the move to VBL </TODO>
-//******************************************************************************
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorRegisterWaitForSingleObject(PHANDLE phNewWaitObject,
- HANDLE hWaitObject,
- WAITORTIMERCALLBACK Callback,
- PVOID Context,
- ULONG timeout,
- BOOL executeOnlyOnce,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- ULONG flag = executeOnlyOnce ? WAIT_SINGLE_EXECUTION : 0;
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::RegisterWaitForSingleObject(phNewWaitObject,
- hWaitObject,
- Callback,
- Context,
- timeout,
- flag);
-
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorBindIoCompletionCallback(HANDLE fileHandle,
- LPOVERLAPPED_COMPLETION_ROUTINE callback)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL ret = FALSE;
- DWORD errCode = 0;
-
- EX_TRY
- {
- ret = ThreadpoolMgr::BindIoCompletionCallback(fileHandle,callback,0, errCode);
- hr = (ret ? S_OK : HRESULT_FROM_WIN32(errCode));
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorUnregisterWait(HANDLE hWaitObject,
- HANDLE CompletionEvent,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
-
- *pResult = ThreadpoolMgr::UnregisterWaitEx(hWaitObject,CompletionEvent);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,
- PVOID Context,BOOL executeOnlyOnce,
- BOOL* pResult )
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::QueueUserWorkItem(Function,Context,QUEUE_ONLY);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorCallOrQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,
- PVOID Context,
- BOOL* pResult )
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::QueueUserWorkItem(Function,Context,CALL_OR_QUEUE);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorCreateTimer(PHANDLE phNewTimer,
- WAITORTIMERCALLBACK Callback,
- PVOID Parameter,
- DWORD DueTime,
- DWORD Period,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::CreateTimerQueueTimer(phNewTimer,Callback,Parameter,DueTime,Period,0);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorDeleteTimer(HANDLE Timer, HANDLE CompletionEvent, BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::DeleteTimerQueueTimer(Timer,CompletionEvent);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorChangeTimer(HANDLE Timer,
- ULONG DueTime,
- ULONG Period,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- //CONTRACT_VIOLATION(ThrowsViolation);
- *pResult = ThreadpoolMgr::ChangeTimerQueueTimer(Timer,DueTime,Period);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorSetMaxThreads(DWORD MaxWorkerThreads,
- DWORD MaxIOCompletionThreads)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL result = FALSE;
- EX_TRY
- {
- result = ThreadpoolMgr::SetMaxThreads(MaxWorkerThreads, MaxIOCompletionThreads);
- hr = (result ? S_OK : E_FAIL);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorGetMaxThreads(DWORD *MaxWorkerThreads,
- DWORD *MaxIOCompletionThreads)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL result = FALSE;
- EX_TRY
- {
- result = ThreadpoolMgr::GetMaxThreads(MaxWorkerThreads, MaxIOCompletionThreads);
- hr = (result ? S_OK : E_FAIL);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorGetAvailableThreads(DWORD *AvailableWorkerThreads,
- DWORD *AvailableIOCompletionThreads)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL result = FALSE;
- EX_TRY
- {
- result = ThreadpoolMgr::GetAvailableThreads(AvailableWorkerThreads, AvailableIOCompletionThreads);
- hr = (result ? S_OK : E_FAIL);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-#endif // !defined(FEATURE_CORECLR)
//***************************************************************************
ULONG CorRuntimeHostBase::m_Version = 0;
@@ -666,102 +280,9 @@ CrstStatic CCLRDebugManager::m_lockConnectionNameTable;
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR) // simple hosting
-//*****************************************************************************
-// ICorRuntimeHost
-//*****************************************************************************
-extern BOOL g_singleVersionHosting;
-
-// *** ICorRuntimeHost methods ***
-// Returns an object for configuring the runtime prior to
-// it starting. If the runtime has been initialized this
-// routine returns an error. See ICorConfiguration.
-HRESULT CorHost::GetConfiguration(ICorConfiguration** pConfiguration)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
- HRESULT hr=E_FAIL;
- BEGIN_ENTRYPOINT_NOTHROW;
- if (CorHost::GetHostVersion() != 1)
- {
- hr=HOST_E_INVALIDOPERATION;
- }
- else
- if (!pConfiguration)
- hr= E_POINTER;
- else
- if (!m_Started)
- {
- *pConfiguration = (ICorConfiguration *) this;
- AddRef();
- hr=S_OK;
- }
- END_ENTRYPOINT_NOTHROW;
- // Cannot obtain configuration after the runtime is started
- return hr;
-}
-
-STDMETHODIMP CorHost::Start(void)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = CorRuntimeHostBase::Start();
-
- END_ENTRYPOINT_NOTHROW;
-
- if (hr == S_FALSE)
- {
- // This is to keep v1 behavior.
- hr = S_OK;
- }
- return(hr);
-}
-#endif // !defined(FEATURE_CORECLR)
// *** ICorRuntimeHost methods ***
-#ifndef FEATURE_CORECLR
-// Returns an object for configuring the runtime prior to
-// it starting. If the runtime has been initialized this
-// routine returns an error. See ICorConfiguration.
-HRESULT CorHost2::GetConfiguration(ICorConfiguration** pConfiguration)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (!pConfiguration)
- return E_POINTER;
- HRESULT hr=E_FAIL;
- BEGIN_ENTRYPOINT_NOTHROW;
- if (!m_Started)
- {
- *pConfiguration = (ICorConfiguration *) this;
- AddRef();
- hr=S_OK;
- }
- END_ENTRYPOINT_NOTHROW;
- // Cannot obtain configuration after the runtime is started
- return hr;
-}
-#endif // FEATURE_CORECLR
extern BOOL g_fWeOwnProcess;
@@ -769,11 +290,9 @@ CorHost2::CorHost2()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
m_fStarted = FALSE;
m_fFirstToLoadCLR = FALSE;
m_fAppDomainCreated = FALSE;
-#endif // FEATURE_CORECLR
}
static DangerousNonHostedSpinLock lockOnlyOneToInvokeStart;
@@ -791,7 +310,6 @@ STDMETHODIMP CorHost2::Start()
BEGIN_ENTRYPOINT_NOTHROW;
-#ifdef FEATURE_CORECLR
// Ensure that only one thread at a time gets in here
DangerousNonHostedSpinLockHolder lockHolder(&lockOnlyOneToInvokeStart);
@@ -821,7 +339,6 @@ STDMETHODIMP CorHost2::Start()
}
}
else
-#endif // FEATURE_CORECLR
{
// Using managed C++ libraries, its possible that when the runtime is already running,
// MC++ will use CorBindToRuntimeEx to make callbacks into specific appdomain of its
@@ -842,7 +359,6 @@ STDMETHODIMP CorHost2::Start()
hr = CorRuntimeHostBase::Start();
if (SUCCEEDED(hr))
{
-#ifdef FEATURE_CORECLR
// Set our flag that this host invoked the Start method.
m_fStarted = TRUE;
@@ -855,7 +371,6 @@ STDMETHODIMP CorHost2::Start()
// So, if you want to do that, just make sure you are the first host to load the
// specific version of CLR in memory AND start it.
m_fFirstToLoadCLR = TRUE;
-#endif // FEATURE_CORECLR
if (FastInterlockIncrement(&m_RefCount) != 1)
{
}
@@ -901,21 +416,6 @@ HRESULT CorRuntimeHostBase::Start()
return hr;
}
-#if !defined(FEATURE_CORECLR) // simple hosting
-HRESULT CorHost::Stop()
-{
- CONTRACTL
- {
- NOTHROW;
- ENTRY_POINT;
- if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
- }
- CONTRACTL_END;
-
- // This must remain this way (that is doing nothing) for backwards compat reasons.
- return S_OK;
-}
-#endif // !defined(FEATURE_CORECLR)
HRESULT CorHost2::Stop()
{
@@ -933,7 +433,6 @@ HRESULT CorHost2::Stop()
HRESULT hr=S_OK;
BEGIN_ENTRYPOINT_NOTHROW;
-#ifdef FEATURE_CORECLR
// Is this host eligible to invoke the Stop method?
if ((!m_fStarted) && (!m_fFirstToLoadCLR))
{
@@ -944,28 +443,21 @@ HRESULT CorHost2::Stop()
hr = HOST_E_CLRNOTAVAILABLE;
}
else
-#endif // FEATURE_CORECLR
{
while (TRUE)
{
LONG refCount = m_RefCount;
if (refCount == 0)
{
- #ifdef FEATURE_CORECLR
hr = HOST_E_CLRNOTAVAILABLE;
- #else // !FEATURE_CORECLR
- hr= E_UNEXPECTED;
- #endif // FEATURE_CORECLR
break;
}
else
if (FastInterlockCompareExchange(&m_RefCount, refCount - 1, refCount) == refCount)
{
- #ifdef FEATURE_CORECLR
// Indicate that we have got a Stop for a corresponding Start call from the
// Host. Semantically, CoreCLR has stopped for them.
m_fStarted = FALSE;
- #endif // FEATURE_CORECLR
if (refCount > 1)
{
@@ -979,125 +471,12 @@ HRESULT CorHost2::Stop()
}
}
}
-#ifndef FEATURE_CORECLR
- if (hr==S_OK)
- {
- EPolicyAction action = GetEEPolicy()->GetDefaultAction(OPR_ProcessExit, NULL);
- if (action > eExitProcess)
- {
- g_fFastExitProcess = 1;
- }
- EEShutDown(FALSE);
- }
-#endif // FEATURE_CORECLR
END_ENTRYPOINT_NOTHROW;
-#ifndef FEATURE_CORECLR
- if (hr == S_OK)
- {
- if (m_HostControl)
- {
- m_HostControl->Release();
- m_HostControl = NULL;
- }
- }
-#endif // FEATURE_CORECLR
return hr;
}
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-
-// Creates a domain in the runtime. The identity array is
-// a pointer to an array TYPE containing IIdentity objects defining
-// the security identity.
-HRESULT CorRuntimeHostBase::CreateDomain(LPCWSTR pwzFriendlyName,
- IUnknown* pIdentityArray, // Optional
- IUnknown ** pAppDomain)
-{
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_ENTRY_POINT;
-
- return CreateDomainEx(pwzFriendlyName,
- NULL,
- NULL,
- pAppDomain);
-}
-
-
-// Returns the default domain.
-HRESULT CorRuntimeHostBase::GetDefaultDomain(IUnknown ** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- } CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- if (!g_fEEStarted)
- return hr;
-
- if( pAppDomain == NULL)
- return E_POINTER;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- if (SystemDomain::System()) {
- AppDomain* pCom = SystemDomain::System()->DefaultDomain();
- if(pCom)
- hr = pCom->GetComIPForExposedObject(pAppDomain);
- }
-
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-// Returns the default domain.
-HRESULT CorRuntimeHostBase::CurrentDomain(IUnknown ** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- if (!g_fEEStarted)
- return hr;
-
- if( pAppDomain == NULL) return E_POINTER;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- AppDomain* pCom = ::GetAppDomain();
- if(pCom)
- hr = pCom->GetComIPForExposedObject(pAppDomain);
-
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-};
-
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
HRESULT CorHost2::GetCurrentAppDomainId(DWORD *pdwAppDomainId)
{
@@ -1113,9 +492,7 @@ HRESULT CorHost2::GetCurrentAppDomainId(DWORD *pdwAppDomainId)
// We use CanRunManagedCode() instead of IsRuntimeActive() because this allows us
// to specify test using the form that does not trigger a GC.
if (!(g_fEEStarted && CanRunManagedCode(LoaderLockCheck::None))
-#ifdef FEATURE_CORECLR
|| !m_fStarted
-#endif
)
{
return HOST_E_CLRNOTAVAILABLE;
@@ -1154,64 +531,9 @@ HRESULT CorHost2::ExecuteApplication(LPCWSTR pwzAppFullName,
LPCWSTR *ppwzActivationData,
int *pReturnValue)
{
-#ifndef FEATURE_CORECLR
- // This API should not be called when the EE has already been started.
- HRESULT hr = E_UNEXPECTED;
- if (g_fEEStarted)
- return hr;
-
- //
- // We will let unhandled exceptions in the activated application
- // propagate all the way up, so that ClickOnce semi-trusted apps
- // can participate in the Dr Watson program, etc...
- //
-
- CONTRACTL {
- THROWS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (!pwzAppFullName)
- IfFailGo(E_POINTER);
-
- // Set the information about the application to execute.
- CorCommandLine::m_pwszAppFullName = (LPWSTR) pwzAppFullName;
- CorCommandLine::m_dwManifestPaths = dwManifestPaths;
- CorCommandLine::m_ppwszManifestPaths = (LPWSTR*) ppwzManifestPaths;
- CorCommandLine::m_dwActivationData = dwActivationData;
- CorCommandLine::m_ppwszActivationData = (LPWSTR*) ppwzActivationData;
-
- // Start up the EE.
- IfFailGo(Start());
-
- Thread *pThread;
- pThread = GetThread();
- if (pThread == NULL)
- pThread = SetupThreadNoThrow(&hr);
- if (pThread == NULL)
- goto ErrExit;
-
- _ASSERTE (!pThread->PreemptiveGCDisabled());
-
- hr = S_OK;
-
- BEGIN_ENTRYPOINT_THROWS_WITH_THREAD(pThread);
- ENTER_DOMAIN_PTR(SystemDomain::System()->DefaultDomain(),ADV_DEFAULTAD)
-
- SystemDomain::ActivateApplication(pReturnValue);
-
- END_DOMAIN_TRANSITION;
- END_ENTRYPOINT_THROWS_WITH_THREAD;
-
-ErrExit:
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif
}
-#ifdef FEATURE_CORECLR
/*
* This method processes the arguments sent to the host which are then used
* to invoke the main method.
@@ -1363,7 +685,6 @@ ErrExit:
return hr;
}
-#endif
HRESULT CorHost2::ExecuteInDefaultAppDomain(LPCWSTR pwzAssemblyPath,
LPCWSTR pwzTypeName,
@@ -1380,98 +701,15 @@ HRESULT CorHost2::ExecuteInDefaultAppDomain(LPCWSTR pwzAssemblyPath,
// No point going further if the runtime is not running...
if (!IsRuntimeActive()
-#ifdef FEATURE_CORECLR
|| !m_fStarted
-#endif
)
{
return HOST_E_CLRNOTAVAILABLE;
}
-#ifndef FEATURE_CORECLR
- if(! (pwzAssemblyPath && pwzTypeName && pwzMethodName) )
- return E_POINTER;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- Thread *pThread = GetThread();
- if (pThread == NULL)
- {
- pThread = SetupThreadNoThrow(&hr);
- if (pThread == NULL)
- {
- goto ErrExit;
- }
- }
-
- _ASSERTE (!pThread->PreemptiveGCDisabled());
-
- EX_TRY
- {
- ENTER_DOMAIN_PTR(SystemDomain::System()->DefaultDomain(),ADV_DEFAULTAD)
-
- INSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
- Assembly *pAssembly = AssemblySpec::LoadAssembly(pwzAssemblyPath);
-
- SString szTypeName(pwzTypeName);
- StackScratchBuffer buff1;
- const char* szTypeNameUTF8 = szTypeName.GetUTF8(buff1);
- MethodTable *pMT = ClassLoader::LoadTypeByNameThrowing(pAssembly,
- NULL,
- szTypeNameUTF8).AsMethodTable();
-
- SString szMethodName(pwzMethodName);
- StackScratchBuffer buff;
- const char* szMethodNameUTF8 = szMethodName.GetUTF8(buff);
- MethodDesc *pMethodMD = MemberLoader::FindMethod(pMT, szMethodNameUTF8, &gsig_SM_Str_RetInt);
-
- if (!pMethodMD)
- {
- hr = COR_E_MISSINGMETHOD;
- }
- else
- {
- GCX_COOP();
-
- MethodDescCallSite method(pMethodMD);
-
- STRINGREF sref = NULL;
- GCPROTECT_BEGIN(sref);
-
- if (pwzArgument)
- sref = StringObject::NewString(pwzArgument);
-
- ARG_SLOT MethodArgs[] =
- {
- ObjToArgSlot(sref)
- };
- DWORD retval = method.Call_RetI4(MethodArgs);
- if (pReturnValue)
- {
- *pReturnValue = retval;
- }
-
- GCPROTECT_END();
- }
-
- UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
- END_DOMAIN_TRANSITION;
- }
- EX_CATCH_HRESULT(hr);
-
-ErrExit:
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-#else // FEATURE_CORECLR
// Ensure that code is not loaded in the Default AppDomain
return HOST_E_INVALIDOPERATION;
-#endif
}
HRESULT ExecuteInAppDomainHelper(FExecuteInAppDomainCallback pCallback,
@@ -1496,22 +734,18 @@ HRESULT CorHost2::ExecuteInAppDomain(DWORD dwAppDomainId,
// No point going further if the runtime is not running...
if (!IsRuntimeActive()
-#ifdef FEATURE_CORECLR
|| !m_fStarted
-#endif // FEATURE_CORECLR
)
{
return HOST_E_CLRNOTAVAILABLE;
}
-#ifdef FEATURE_CORECLR
if(!(m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN))
{
// Ensure that code is not loaded in the Default AppDomain
if (dwAppDomainId == DefaultADID)
return HOST_E_INVALIDOPERATION;
}
-#endif // FEATURE_CORECLR
// Moved this here since no point validating the pointer
// if the basic checks [above] fail
@@ -1555,9 +789,6 @@ HRESULT CorHost2::_CreateAppDomain(
int nProperties,
LPCWSTR* pPropertyNames,
LPCWSTR* pPropertyValues,
-#if !defined(FEATURE_CORECLR)
- ICLRPrivBinder* pBinder,
-#endif
DWORD* pAppDomainID)
{
CONTRACTL
@@ -1570,13 +801,11 @@ HRESULT CorHost2::_CreateAppDomain(
HRESULT hr=S_OK;
-#ifdef FEATURE_CORECLR
//cannot call the function more than once when single appDomain is allowed
if (m_fAppDomainCreated && (m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN))
{
return HOST_E_INVALIDOPERATION;
}
-#endif
//normalize empty strings
EMPTY_STRING_TO_NULL(wszFriendlyName);
@@ -1586,10 +815,8 @@ HRESULT CorHost2::_CreateAppDomain(
if(pAppDomainID==NULL)
return E_POINTER;
-#ifdef FEATURE_CORECLR
if (!m_fStarted)
return HOST_E_INVALIDOPERATION;
-#endif // FEATURE_CORECLR
if(wszFriendlyName == NULL)
return E_INVALIDARG;
@@ -1604,26 +831,22 @@ HRESULT CorHost2::_CreateAppDomain(
AppDomainCreationHolder<AppDomain> pDomain;
-#ifdef FEATURE_CORECLR
// If StartupFlag specifies single appDomain then return the default domain instead of creating new one
if(m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN)
{
pDomain.Assign(SystemDomain::System()->DefaultDomain());
}
else
-#endif
{
AppDomain::CreateUnmanagedObject(pDomain);
}
ETW::LoaderLog::DomainLoad(pDomain, (LPWSTR)wszFriendlyName);
-#ifdef FEATURE_CORECLR
if (dwFlags & APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS)
{
pDomain->SetIgnoreUnhandledExceptions();
}
-#endif // FEATURE_CORECLR
if (dwFlags & APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE)
pDomain->SetReversePInvokeCannotEnter();
@@ -1631,10 +854,6 @@ HRESULT CorHost2::_CreateAppDomain(
if (dwFlags & APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS)
pDomain->SetForceTrivialWaitOperations();
-#if !defined(FEATURE_CORECLR)
- if (pBinder != NULL)
- pDomain->SetLoadContextHostBinder(pBinder);
-#endif
#ifdef PROFILING_SUPPORTED
EX_TRY
@@ -1689,12 +908,8 @@ HRESULT CorHost2::_CreateAppDomain(
args[1]=ObjToArgSlot(NULL);
args[2]=ObjToArgSlot(NULL);
args[3]=ObjToArgSlot(NULL);
-#ifdef FEATURE_CORECLR
//CoreCLR shouldn't have dependencies on parent app domain.
args[4]=ObjToArgSlot(NULL);
-#else
- args[4]=PtrToArgSlot(GetAppDomain()->GetSecurityDescriptor());
-#endif //FEATURE_CORECLR
args[5]=ObjToArgSlot(_gc.sandboxName);
args[6]=ObjToArgSlot(_gc.propertyNames);
args[7]=ObjToArgSlot(_gc.propertyValues);
@@ -1707,12 +922,6 @@ HRESULT CorHost2::_CreateAppDomain(
PTRARRAYREF handleArrayObj = (PTRARRAYREF) ObjectToOBJECTREF(_gc.setupInfo);
_gc.adSetup = ObjectToOBJECTREF(handleArrayObj->GetAt(1));
-#ifndef FEATURE_CORECLR
- // We need to setup domain sorting before any other managed code runs in the domain, since that code
- // could end up caching data based on the sorting mode of the domain.
- pDomain->InitializeSorting(&_gc.adSetup);
- pDomain->InitializeHashing(&_gc.adSetup);
-#endif
pDomain->DoSetup(&_gc.setupInfo);
@@ -1722,13 +931,11 @@ HRESULT CorHost2::_CreateAppDomain(
*pAppDomainID=pDomain->GetId().m_dwId;
-#ifdef FEATURE_CORECLR
// If StartupFlag specifies single appDomain then set the flag that appdomain has already been created
if(m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN)
{
m_fAppDomainCreated = TRUE;
}
-#endif
}
#ifdef PROFILING_SUPPORTED
EX_HOOK
@@ -1798,7 +1005,6 @@ HRESULT CorHost2::_CreateDelegate(
if(wszMethodName == NULL)
return E_INVALIDARG;
-#ifdef FEATURE_CORECLR
if (!m_fStarted)
return HOST_E_INVALIDOPERATION;
@@ -1808,7 +1014,6 @@ HRESULT CorHost2::_CreateDelegate(
if (appDomainID == DefaultADID)
return HOST_E_INVALIDOPERATION;
}
-#endif
BEGIN_ENTRYPOINT_NOTHROW;
@@ -1856,11 +1061,9 @@ HRESULT CorHost2::_CreateDelegate(
if (pMD==NULL || !pMD->IsStatic() || pMD->ContainsGenericVariables())
ThrowHR(COR_E_MISSINGMETHOD);
-#ifdef FEATURE_CORECLR
// the target method must be decorated with AllowReversePInvokeCallsAttribute
if (!COMDelegate::IsMethodAllowedToSinkReversePInvoke(pMD))
ThrowHR(COR_E_SECURITY);
-#endif
UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
*fnPtr = (INT_PTR)pUMEntryThunk->GetCode();
@@ -1874,7 +1077,6 @@ HRESULT CorHost2::_CreateDelegate(
return hr;
}
-#ifdef FEATURE_CORECLR
HRESULT CorHost2::CreateAppDomainWithManager(
LPCWSTR wszFriendlyName,
DWORD dwFlags,
@@ -1957,70 +1159,7 @@ HRESULT CorHost2::SetStartupFlags(STARTUP_FLAGS flag)
return S_OK;
}
-#endif //FEATURE_CORECLR
-
-#ifndef FEATURE_CORECLR
-void PauseOneAppDomain(AppDomainIterator* pi)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- EX_TRY {
- ENTER_DOMAIN_PTR(pi->GetDomain(),ADV_ITERATOR);
-
- MethodDescCallSite(METHOD__APP_DOMAIN__PAUSE).Call(NULL);
-
- END_DOMAIN_TRANSITION;
- } EX_CATCH {
- } EX_END_CATCH(SwallowAllExceptions);
-}
-
-void ResumeOneAppDomain(AppDomainIterator* pi)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- EX_TRY {
- ENTER_DOMAIN_PTR(pi->GetDomain(),ADV_ITERATOR);
-
- MethodDescCallSite(METHOD__APP_DOMAIN__RESUME).Call(NULL);
-
- END_DOMAIN_TRANSITION;
- } EX_CATCH {
- } EX_END_CATCH(SwallowAllExceptions);
-}
-
-// see comments in SuspendEEFromPause
-DWORD WINAPI SuspendAndResumeForPause(LPVOID arg)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_ANY;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- ThreadSuspend::SuspendEE(ThreadSuspend::SUSPEND_OTHER);
-
- g_PauseCompletedEvent.Set();
- g_ClrResumeEvent.Wait(INFINITE, FALSE);
-
- ThreadSuspend::RestartEE(FALSE, TRUE);
- return 0;
-}
-#endif // !FEATURE_CORECLR
HRESULT SuspendEEForPause()
{
@@ -2034,33 +1173,9 @@ HRESULT SuspendEEForPause()
HRESULT hr = S_OK;
-#ifdef FEATURE_CORECLR
// In CoreCLR, we always resume from the same thread that paused. So we can simply suspend the EE from this thread,
// knowing we'll restart from the same thread.
ThreadSuspend::SuspendEE(ThreadSuspend::SUSPEND_OTHER);
-#else
- // In the CLR, we can resume from a different thread than the one that paused. We can't call SuspendEE directly,
- // because we can't call RestartEE from another thread. So we queue a workitem to the ThreadPool to call SuspendEE
- // and ResumeEE on our behalf.
-
- EX_TRY
- {
- if (!ThreadpoolMgr::QueueUserWorkItem(SuspendAndResumeForPause, NULL, QUEUE_ONLY))
- {
- hr = HRESULT_FROM_GetLastError();
- }
- else
- {
- // wait for SuspendEE to complete before returning.
- g_PauseCompletedEvent.Wait(INFINITE,FALSE);
- }
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-#endif
return hr;
}
@@ -2076,12 +1191,7 @@ HRESULT RestartEEFromPauseAndSetResumeEvent()
CONTRACTL_END;
// see comments in SuspendEEFromPause
-#ifdef FEATURE_CORECLR
ThreadSuspend::RestartEE(FALSE, TRUE);
-#else
- // setting the resume event below will restart the EE as well. We don't wait for the restart
- // to complete, because we'll sync with it next time we go to cooperative mode.
-#endif
_ASSERTE(g_ClrResumeEvent.IsValid());
g_ClrResumeEvent.Set();
@@ -2111,10 +1221,6 @@ HRESULT CorExecutionManager::Pause(DWORD dwAppDomainId, DWORD dwFlags)
HRESULT hr = S_OK;
-#ifndef FEATURE_CORECLR
- if (!IsRuntimeActive())
- return HOST_E_CLRNOTAVAILABLE;
-#endif
if(g_IsPaused)
return E_FAIL;
@@ -2126,12 +1232,6 @@ HRESULT CorExecutionManager::Pause(DWORD dwAppDomainId, DWORD dwFlags)
else
g_ClrResumeEvent.Reset();
-#ifndef FEATURE_CORECLR
- if (!g_PauseCompletedEvent.IsValid())
- g_PauseCompletedEvent.CreateManualEvent(FALSE);
- else
- g_PauseCompletedEvent.Reset();
-#endif
}
EX_CATCH_HRESULT(hr);
@@ -2142,20 +1242,6 @@ HRESULT CorExecutionManager::Pause(DWORD dwAppDomainId, DWORD dwFlags)
m_dwFlags = dwFlags;
-#ifndef FEATURE_CORECLR
- if ((m_dwFlags & PAUSE_APP_DOMAINS) != 0)
- {
- Thread* pThread = SetupThreadNoThrow(&hr);
- if (pThread != NULL)
- {
- GCX_COOP_THREAD_EXISTS(pThread);
-
- AppDomainIterator ai(/*bOnlyActive:*/ TRUE);
- while (ai.Next())
- PauseOneAppDomain(&ai);
- }
- }
-#endif
if (SUCCEEDED(hr))
{
@@ -2185,15 +1271,10 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
HRESULT hr = S_OK;
-#ifndef FEATURE_CORECLR
- if (!IsRuntimeActive())
- return HOST_E_CLRNOTAVAILABLE;
-#endif
if(!g_IsPaused)
return E_FAIL;
-#ifdef FEATURE_CORECLR
// GCThread is the thread that did the Pause. Resume should also happen on that same thread
Thread *pThread = GetThread();
if(pThread != ThreadSuspend::GetSuspensionThread())
@@ -2201,7 +1282,6 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
_ASSERTE(!"HOST BUG: The same thread that did Pause should do the Resume");
return E_FAIL;
}
-#endif
BEGIN_ENTRYPOINT_NOTHROW;
@@ -2215,23 +1295,6 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
hr = RestartEEFromPauseAndSetResumeEvent();
-#ifndef FEATURE_CORECLR
- if (SUCCEEDED(hr))
- {
- if ((m_dwFlags & PAUSE_APP_DOMAINS) != 0)
- {
- Thread* pThread = SetupThreadNoThrow(&hr);
- if (pThread != NULL)
- {
- GCX_COOP_THREAD_EXISTS(pThread);
-
- AppDomainIterator ai(/*bOnlyActive:*/ TRUE);
- while (ai.Next())
- ResumeOneAppDomain(&ai);
- }
- }
- }
-#endif
END_ENTRYPOINT_NOTHROW;
@@ -2241,7 +1304,6 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
#endif //!DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
#ifndef DACCESS_COMPILE
SVAL_IMPL(STARTUP_FLAGS, CorHost2, m_dwStartupFlags = STARTUP_CONCURRENT_GC);
#else
@@ -2252,347 +1314,9 @@ STARTUP_FLAGS CorHost2::GetStartupFlags()
{
return m_dwStartupFlags;
}
-#endif //FEATURE_CORECLR
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-/*************************************************************************************
- ** ICLRPrivRuntime Methods
- *************************************************************************************/
-
-HRESULT CorHost2::GetInterface(
- REFCLSID rclsid,
- REFIID riid,
- LPVOID * ppUnk)
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- EX_TRY
- {
- if (rclsid == __uuidof(CLRPrivAppXBinder))
- {
- CLRPrivBinderAppX * pBinder = CLRPrivBinderAppX::GetOrCreateBinder();
- hr = pBinder->QueryInterface(riid, ppUnk);
- }
- else
- {
- hr = E_NOINTERFACE;
- }
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
-HRESULT CorHost2::CreateAppDomain(
- LPCWSTR pwzFriendlyName,
- ICLRPrivBinder * pBinder,
- LPDWORD pdwAppDomainId)
-{
- return _CreateAppDomain(
- pwzFriendlyName,
- 0 /* default security */,
- nullptr, /* domain manager */
- nullptr, /* domain manager */
- 0, /* property count */
- nullptr, /* property names */
- nullptr, /* property values */
- pBinder,
- pdwAppDomainId);
-}
-
-HRESULT CorHost2::CreateDelegate(
- DWORD appDomainID,
- LPCWSTR wszAssemblyName,
- LPCWSTR wszClassName,
- LPCWSTR wszMethodName,
- LPVOID * ppvDelegate)
-{
- return _CreateDelegate(appDomainID, wszAssemblyName, wszClassName,
- wszMethodName, reinterpret_cast<INT_PTR*>(ppvDelegate));
-}
-
-// Flag indicating if the EE was started up by an managed exe. Defined in ceemain.cpp.
-extern BOOL g_fEEManagedEXEStartup;
-
-HRESULT CorHost2::ExecuteMain(
- ICLRPrivBinder * pBinder,
- int * pRetVal)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- HRESULT hr = S_OK;
-
- // If an exception passes through here, it will cause the
- // "The application has generated an unhandled exception" dialog and offer to debug.
- BEGIN_ENTRYPOINT_THROWS;
-
- // Indicates that the EE was started up by a managed exe.
- g_fEEManagedEXEStartup = TRUE;
-
- IfFailGo(CorCommandLine::SetArgvW(WszGetCommandLine()));
-
- IfFailGo(EnsureEEStarted(COINITEE_MAIN));
-
- INSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
- //
- // Look for the [STAThread] or [MTAThread] attribute
- // TODO delete this code when we move to the default AppDomain
- //
- HMODULE hMod = WszGetModuleHandle(NULL);
-
- PEImageHolder pTempImage(PEImage::LoadImage(hMod));
- PEFileHolder pTempFile(PEFile::Open(pTempImage.Extract()));
-
- // Check for CustomAttributes - Set up the DefaultDomain and the main thread
- // Note that this has to be done before ExplicitBind() as it
- // affects the bind
- mdToken tkEntryPoint = pTempFile->GetEntryPointToken();
- // <TODO>@TODO: What if the entrypoint is in another file of the assembly?</TODO>
- ReleaseHolder<IMDInternalImport> scope(pTempFile->GetMDImportWithRef());
- // In theory, we should have a valid executable image and scope should never be NULL, but we've been
- // getting Watson failures for AVs here due to ISVs modifying image headers and some new OS loader
- // checks (see Dev10# 718530 and Windows 7# 615596)
- if (scope == NULL)
- {
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
- Thread::ApartmentState state = Thread::AS_Unknown;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef)) {
- if (scope->IsValidToken(tkEntryPoint))
- state = SystemDomain::GetEntryPointThreadAptState(scope, tkEntryPoint);
- else
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
- BOOL fSetGlobalSharePolicyUsingAttribute = FALSE;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef))
- {
- // The global share policy needs to be set before initializing default domain
- // so that it is in place for loading of appdomain manager.
- fSetGlobalSharePolicyUsingAttribute = SystemDomain::SetGlobalSharePolicyUsingAttribute(scope, tkEntryPoint);
- }
-
- // If the entry point has an explicit thread apartment state, set it
- // before running the AppDomainManager initialization code.
- if (state == Thread::AS_InSTA || state == Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-
- // This can potentially run managed code.
- SystemDomain::InitializeDefaultDomain(FALSE, pBinder);
-
- // If we haven't set an explicit thread apartment state, set it after the
- // AppDomainManager has got a chance to go set it in InitializeNewDomain.
- if (state != Thread::AS_InSTA && state != Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-
- if (fSetGlobalSharePolicyUsingAttribute)
- SystemDomain::System()->DefaultDomain()->SetupLoaderOptimization(g_dwGlobalSharePolicy);
-
- ADID adId(DefaultADID);
-
- GCX_COOP();
-
- ENTER_DOMAIN_ID(adId)
- TESTHOOKCALL(EnteredAppDomain(adId.m_dwId));
- {
- GCX_PREEMP();
-
- AppDomain *pDomain = GetAppDomain();
- _ASSERTE(pDomain);
-
- PathString wzExeFileName;
-
- if (WszGetModuleFileName(nullptr, wzExeFileName) == 0)
- IfFailThrow(E_UNEXPECTED);
-
- LPWSTR wzExeSimpleFileName = nullptr;
- size_t cchExeSimpleFileName = 0;
- SplitPathInterior(
- wzExeFileName,
- nullptr, nullptr, // drive
- nullptr, nullptr, // dir
- (LPCWSTR*)&wzExeSimpleFileName, &cchExeSimpleFileName, // filename
- nullptr, nullptr); // ext
-
- // Remove the extension
- wzExeSimpleFileName[cchExeSimpleFileName] = W('\0');
-
- ReleaseHolder<IAssemblyName> pAssemblyName;
- IfFailThrow(CreateAssemblyNameObject(
- &pAssemblyName, // Returned IAssemblyName
- wzExeSimpleFileName, // Name of assembly
- CANOF_PARSE_DISPLAY_NAME, // Parse as display name
- nullptr)); // Reserved
-
- AssemblySpec specExe;
- specExe.InitializeSpec(pAssemblyName, nullptr, false);
-
- PEAssemblyHolder pPEAssembly = pDomain->BindAssemblySpec(&specExe, TRUE, FALSE);
-
- pDomain->SetRootAssembly(pDomain->LoadAssembly(NULL, pPEAssembly, FILE_ACTIVE));
-
- LOG((LF_CLASSLOADER | LF_CORDB,
- LL_INFO10,
- "Created domain for an executable at %p\n",
- (pDomain->GetRootAssembly()? pDomain->GetRootAssembly()->Parent() : NULL)));
- TESTHOOKCALL(RuntimeStarted(RTS_CALLINGENTRYPOINT));
-
- // Set the friendly name to indicate that this is an immersive domain.
- pDomain->SetFriendlyName(W("Immersive Application Domain"), TRUE);
-
- // Execute the main method
- // NOTE: we call the entry point with our entry point exception filter active
- // after the AppDomain transition which is a bit different from classic apps.
- // this is so that we have the correct context when notifying the debugger
- // or invoking WER on the main thread and mimics the behavior of classic apps.
- // the assumption is that AppX entry points are always invoked post-AD transition.
- ExecuteMainInner(pDomain->GetRootAssembly());
-
- // Get the global latched exit code instead of the return value from ExecuteMainMethod
- // because in the case of a "void Main" method the return code is always 0,
- // while the latched exit code is set in either case.
- *pRetVal = GetLatchedExitCode();
- }
- END_DOMAIN_TRANSITION;
- TESTHOOKCALL(LeftAppDomain(adId.m_dwId));
-
- UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
-ErrExit:
- END_ENTRYPOINT_THROWS;
-
- return hr;
-}
-
-VOID CorHost2::ExecuteMainInner(Assembly* pRootAssembly)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- struct Param
- {
- Assembly* pRootAssembly;
- } param;
-
- param.pRootAssembly = pRootAssembly;
-
- PAL_TRY(Param*, pParam, &param)
- {
- // since this is the thread 0 entry point for AppX apps we use
- // the EntryPointFilter so that an unhandled exception here will
- // trigger the same behavior as in classic apps.
- pParam->pRootAssembly->ExecuteMainMethod(NULL, TRUE /* waitForOtherThreads */);
- }
- PAL_EXCEPT_FILTER(EntryPointFilter)
- {
- LOG((LF_STARTUP, LL_INFO10, "EntryPointFilter returned EXCEPTION_EXECUTE_HANDLER!"));
- }
- PAL_ENDTRY
-}
-
-// static
-HRESULT CorHost2::SetFlagsAndHostConfig(STARTUP_FLAGS dwStartupFlags, LPCWSTR pwzHostConfigFile, BOOL fFinalize)
-{
- WRAPPER_NO_CONTRACT;
-
- HRESULT hr = E_INVALIDARG;
-
- if (pwzHostConfigFile == NULL)
- pwzHostConfigFile = W("");
-
- DangerousNonHostedSpinLockHolder lockHolder(&m_FlagsLock);
-
- if (m_dwFlagsFinalized)
- {
- // verify that flags and config file are the same
- if (dwStartupFlags == m_dwStartupFlags &&
- _wcsicmp(pwzHostConfigFile, m_wzHostConfigFile) == 0)
- {
- hr = S_OK;
- }
- }
- else
- {
- // overwrite the flags and config with the incoming values
- if (wcslen(pwzHostConfigFile) < COUNTOF(m_wzHostConfigFile))
- {
- VERIFY(wcscpy_s(m_wzHostConfigFile, COUNTOF(m_wzHostConfigFile), pwzHostConfigFile) == 0);
-
- // If they asked for the server gc but only have one processor, deny that option.
- // Keep this in sync with shim logic in ComputeStartupFlagsAndFlavor that also switches to
- // the workstation GC on uniprocessor boxes.
- if (g_SystemInfo.dwNumberOfProcessors == 1 && (dwStartupFlags & STARTUP_SERVER_GC))
- dwStartupFlags = (STARTUP_FLAGS)(dwStartupFlags & ~(STARTUP_SERVER_GC | STARTUP_CONCURRENT_GC));
-
- m_dwStartupFlags = dwStartupFlags;
-
- if (fFinalize)
- m_dwFlagsFinalized = TRUE;
-
- hr = S_OK;
- }
- }
-
- return hr;
-}
-
-// static
-STARTUP_FLAGS CorHost2::GetStartupFlags()
-{
- WRAPPER_NO_CONTRACT;
-
- if (!m_dwFlagsFinalized) // make sure we return consistent results
- {
- DangerousNonHostedSpinLockHolder lockHolder(&m_FlagsLock);
- m_dwFlagsFinalized = TRUE;
- }
-
- return m_dwStartupFlags;
-}
-
-// static
-LPCWSTR CorHost2::GetHostConfigFile()
-{
- WRAPPER_NO_CONTRACT;
-
- if (!m_dwFlagsFinalized) // make sure we return consistent results
- {
- DangerousNonHostedSpinLockHolder lockHolder(&m_FlagsLock);
- m_dwFlagsFinalized = TRUE;
- }
-
- return m_wzHostConfigFile;
-}
-
-// static
-void CorHost2::GetDefaultAppDomainProperties(StringArrayList **pPropertyNames, StringArrayList **pPropertyValues)
-{
- LIMITED_METHOD_CONTRACT;
-
- // We should only read these after the runtime has started to ensure that the host isn't modifying them
- // still
- _ASSERTE(g_fEEStarted || HasStarted());
-
- *pPropertyNames = &s_defaultDomainPropertyNames;
- *pPropertyValues = &s_defaultDomainPropertyValues;
-}
-
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
@@ -2644,370 +1368,12 @@ HRESULT GetCLRRuntimeHost(REFIID riid, IUnknown **ppUnk)
return CorHost2::CreateObject(riid, (void**)ppUnk);
}
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-
-HRESULT NextDomainWorker(AppDomainIterator *pEnum,
- IUnknown** pAppDomain)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW); // nothrow contract's fs:0 handler gets called before the C++ EH fs:0 handler which is pushed in the prolog
- GC_TRIGGERS;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- Thread *pThread = GetThread();
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, return COR_E_STACKOVERFLOW);
-
- EX_TRY
- {
- GCX_COOP_THREAD_EXISTS(pThread);
-
- if (pEnum->Next())
- {
- AppDomain* pDomain = pEnum->GetDomain();
- // Need to enter the AppDomain to synchronize access to the exposed
- // object properly (can't just take the system domain mutex since we
- // might need to run code that uses higher ranking crsts).
- ENTER_DOMAIN_PTR(pDomain,ADV_ITERATOR)
- {
-
- hr = pDomain->GetComIPForExposedObject(pAppDomain);
- }
- END_DOMAIN_TRANSITION;
- }
- else
- {
- hr = S_FALSE;
- }
- }
- EX_CATCH_HRESULT(hr);
-
- END_SO_INTOLERANT_CODE;
-
- return hr;
-}
-
-// Returns S_FALSE when there are no more domains. A domain
-// is passed out only when S_OK is returned.
-HRESULT CorRuntimeHostBase::NextDomain(HDOMAINENUM hEnum,
- IUnknown** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if(hEnum == NULL || pAppDomain == NULL)
- return E_POINTER;
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- HRESULT hr;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- AppDomainIterator *pEnum = (AppDomainIterator *) hEnum;
-
- do
- {
- hr = NextDomainWorker(pEnum, pAppDomain);
- // Might need to look at the next appdomain if we were attempting to get at
- // the exposed appdomain object and were chucked out as the result of an
- // appdomain unload.
- } while (hr == COR_E_APPDOMAINUNLOADED);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-// Creates a domain in the runtime. The identity array is
-// a pointer to an array TYPE containing IIdentity objects defining
-// the security identity.
-HRESULT CorRuntimeHostBase::CreateDomainEx(LPCWSTR pwzFriendlyName,
- IUnknown* pSetup, // Optional
- IUnknown* pEvidence, // Optional
- IUnknown ** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- if(!pwzFriendlyName) return E_POINTER;
- if(pAppDomain == NULL) return E_POINTER;
- if(!g_fEEStarted) return E_FAIL;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- struct _gc {
- STRINGREF pName;
- OBJECTREF pSetup;
- OBJECTREF pEvidence;
- APPDOMAINREF pDomain;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- if (FAILED(hr = EnsureComStartedNoThrow()))
- goto lDone;
-
- GCPROTECT_BEGIN(gc);
-
- gc.pName = StringObject::NewString(pwzFriendlyName);
-
- if(pSetup)
- GetObjectRefFromComIP(&gc.pSetup, pSetup);
- if(pEvidence)
- GetObjectRefFromComIP(&gc.pEvidence, pEvidence);
-
- MethodDescCallSite createDomain(METHOD__APP_DOMAIN__CREATE_DOMAIN);
-
- ARG_SLOT args[3] = {
- ObjToArgSlot(gc.pName),
- ObjToArgSlot(gc.pEvidence),
- ObjToArgSlot(gc.pSetup),
- };
-
- gc.pDomain = (APPDOMAINREF) createDomain.Call_RetOBJECTREF(args);
-
- *pAppDomain = GetComIPFromObjectRef((OBJECTREF*) &gc.pDomain);
-
- GCPROTECT_END();
-
-lDone: ;
- }
- END_EXTERNAL_ENTRYPOINT;
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-// Close the enumeration releasing resources
-HRESULT CorRuntimeHostBase::CloseEnum(HDOMAINENUM hEnum)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if(hEnum) {
- AppDomainIterator* pEnum = (AppDomainIterator*) hEnum;
- delete pEnum;
- }
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT CorRuntimeHostBase::CreateDomainSetup(IUnknown **pAppDomainSetup)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- MODE_PREEMPTIVE;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- if (!pAppDomainSetup)
- return E_POINTER;
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- // Create the domain.
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- struct _gc {
- OBJECTREF pSetup;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
- MethodTable* pMT = NULL;
-
- hr = EnsureComStartedNoThrow();
- if (FAILED(hr))
- goto lDone;
-
- pMT = MscorlibBinder::GetClass(CLASS__APPDOMAIN_SETUP);
-
- GCPROTECT_BEGIN(gc);
- gc.pSetup = AllocateObject(pMT);
- *pAppDomainSetup = GetComIPFromObjectRef((OBJECTREF*) &gc.pSetup);
- GCPROTECT_END();
-
-lDone: ;
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-HRESULT CorRuntimeHostBase::CreateEvidence(IUnknown **pEvidence)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- if (!pEvidence)
- return E_POINTER;
-
-#ifdef FEATURE_CAS_POLICY
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- // Create the domain.
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- struct _gc {
- OBJECTREF pEvidence;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- MethodTable* pMT = NULL;
-
- hr = EnsureComStartedNoThrow();
- if (FAILED(hr))
- goto lDone;
-
- pMT = MscorlibBinder::GetClass(CLASS__EVIDENCE);
-
- GCPROTECT_BEGIN(gc);
- gc.pEvidence = AllocateObject(pMT);
- MethodDescCallSite ctor(METHOD__EVIDENCE__CTOR, &(gc.pEvidence));
-
- // Call the Evidence class constructor.
- ARG_SLOT CtorArgs[] =
- {
- ObjToArgSlot(gc.pEvidence)
- };
- ctor.Call(CtorArgs);
-
- *pEvidence = GetComIPFromObjectRef((OBJECTREF*) &gc.pEvidence);
- GCPROTECT_END();
-
-lDone: ;
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-#else // !FEATURE_CAS_POLICY
- // There is no Evidence class support without CAS policy.
- return E_NOTIMPL;
-#endif // FEATURE_CAS_POLICY
-
- return hr;
-}
-
-HRESULT CorRuntimeHostBase::UnloadDomain(IUnknown *pUnkDomain)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- FORBID_FAULT;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (!pUnkDomain)
- return E_POINTER;
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- CONTRACT_VIOLATION(FaultViolation); // This entire function is full of OOM potential: must fix.
-
- HRESULT hr = S_OK;
- DWORD dwDomainId = 0;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- _ASSERTE (g_fComStarted);
-
- {
- SystemDomain::LockHolder lh;
-
- ComCallWrapper* pWrap = GetCCWFromIUnknown(pUnkDomain, FALSE);
- if (!pWrap)
- {
- hr = COR_E_APPDOMAINUNLOADED;
- }
- if (SUCCEEDED(hr))
- {
- dwDomainId = pWrap->GetDomainID().m_dwId;
- }
- }
- if (SUCCEEDED(hr))
- {
- hr = UnloadAppDomain(dwDomainId, TRUE);
- }
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
{
WRAPPER_NO_CONTRACT;
STATIC_CONTRACT_SO_TOLERANT;
-#ifdef FEATURE_CORECLR
if (!m_fStarted)
return HOST_E_INVALIDOPERATION;
@@ -3056,7 +1422,6 @@ STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
return hr;
}
else
-#endif // FEATURE_CORECLR
return CorRuntimeHostBase::UnloadAppDomain(dwDomainId, fWaitUntilDone);
}
@@ -3093,9 +1458,7 @@ HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fSync)
// for this scope only.
CONTRACT_VIOLATION(FaultViolation);
if (!IsRuntimeActive()
- #ifdef FEATURE_CORECLR
|| !m_fStarted
- #endif // FEATURE_CORECLR
)
{
return HOST_E_CLRNOTAVAILABLE;
@@ -3117,126 +1480,6 @@ HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fSync)
//*****************************************************************************
// Fiber Methods
//*****************************************************************************
-#if !defined(FEATURE_CORECLR) // simple hosting
-HRESULT CorHost::CreateLogicalThreadState()
-{
- CONTRACTL
- {
- NOTHROW;
- DISABLED(GC_TRIGGERS);
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
- if (CorHost::GetHostVersion() != 1)
- {
- hr=HOST_E_INVALIDOPERATION;
- }
- else
- {
- _ASSERTE (GetThread() == 0 || GetThread()->HasRightCacheStackBase());
- /* Thread *thread = */ SetupThreadNoThrow(&hr);
-
- }
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT CorHost::DeleteLogicalThreadState()
-{
- if (CorHost::GetHostVersion() != 1)
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- Thread *pThread = GetThread();
- if (!pThread)
- return E_UNEXPECTED;
-
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
- // We need to reset the TrapReturningThread count that was
- // set when a thread is requested to be aborted. Otherwise
- // every stub call is going to go through a slow path.
- if (pThread->IsAbortRequested())
- pThread->UnmarkThreadForAbort(Thread::TAR_ALL);
-
- // see code:Thread::OnThreadTerminate#ReportDeadOnThreadTerminate
- pThread->SetThreadState(Thread::TS_ReportDead);
-
- pThread->OnThreadTerminate(FALSE);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT CorHost::SwitchInLogicalThreadState(DWORD *pFiberCookie)
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_MODE_ANY;
- STATIC_CONTRACT_ENTRY_POINT;
-
- if (CorHost::GetHostVersion() != 1)
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- if (!pFiberCookie)
- {
- return E_POINTER;
- }
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- hr = ((Thread*)pFiberCookie)->SwitchIn(::GetCurrentThread());
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-
-}
-
-HRESULT CorHost::SwitchOutLogicalThreadState(DWORD **pFiberCookie)
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_MODE_ANY;
- STATIC_CONTRACT_ENTRY_POINT;
-
- if (CorHost::GetHostVersion() != 1)
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- if (!pFiberCookie)
- {
- return E_POINTER;
- }
-
- Thread *pThread = GetThread();
- if (!pThread)
- {
- return E_UNEXPECTED;
- }
-
- pThread->InternalSwitchOut();
- *pFiberCookie = (DWORD*)pThread;
-
- return S_OK;
-}
-#endif // !defined(FEATURE_CORECLR)
HRESULT CorRuntimeHostBase::LocksHeldByLogicalThread(DWORD *pCount)
{
@@ -3267,242 +1510,6 @@ HRESULT CorRuntimeHostBase::LocksHeldByLogicalThread(DWORD *pCount)
//*****************************************************************************
// ICorConfiguration
//*****************************************************************************
-#if !defined(FEATURE_CORECLR)
-IGCThreadControl *CorConfiguration::m_CachedGCThreadControl = 0;
-IGCHostControl *CorConfiguration::m_CachedGCHostControl = 0;
-IDebuggerThreadControl *CorConfiguration::m_CachedDebuggerThreadControl = 0;
-DWORD *CorConfiguration::m_DSTArray = 0;
-DWORD CorConfiguration::m_DSTCount = 0;
-DWORD CorConfiguration::m_DSTArraySize = 0;
-
-// *** ICorConfiguration methods ***
-
-
-HRESULT CorConfiguration::SetGCThreadControl(IGCThreadControl *pGCThreadControl)
-{
- if (!pGCThreadControl)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if (m_CachedGCThreadControl)
- m_CachedGCThreadControl->Release();
-
- m_CachedGCThreadControl = pGCThreadControl;
-
- if (m_CachedGCThreadControl)
- m_CachedGCThreadControl->AddRef();
-
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
-}
-
-HRESULT CorConfiguration::SetGCHostControl(IGCHostControl *pGCHostControl)
-{
- if (!pGCHostControl)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if (m_CachedGCHostControl)
- m_CachedGCHostControl->Release();
-
- m_CachedGCHostControl = pGCHostControl;
-
- if (m_CachedGCHostControl)
- m_CachedGCHostControl->AddRef();
-
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
-}
-
-HRESULT CorConfiguration::SetDebuggerThreadControl(IDebuggerThreadControl *pDebuggerThreadControl)
-{
- if (!pDebuggerThreadControl)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
-#ifdef DEBUGGING_SUPPORTED
- // Can't change the debugger thread control object once its been set.
- if (m_CachedDebuggerThreadControl != NULL)
- IfFailGo(E_INVALIDARG);
-
- m_CachedDebuggerThreadControl = pDebuggerThreadControl;
-
- // If debugging is already initialized then provide this interface pointer to it.
- // It will also addref the new one and release the old one.
- if (g_pDebugInterface)
- g_pDebugInterface->SetIDbgThreadControl(pDebuggerThreadControl);
-
- if (m_CachedDebuggerThreadControl)
- m_CachedDebuggerThreadControl->AddRef();
-
- hr = S_OK;
-#else // !DEBUGGING_SUPPORTED
- hr = E_NOTIMPL;
-#endif // !DEBUGGING_SUPPORTED
-
-ErrExit:
- END_ENTRYPOINT_NOTHROW;
- return hr;
-
-}
-
-
-HRESULT CorConfiguration::AddDebuggerSpecialThread(DWORD dwSpecialThreadId)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT; // debugging not hardened for SO
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
-
-#ifdef DEBUGGING_SUPPORTED
- // If it's already in the list, don't add it again.
- if (IsDebuggerSpecialThread(dwSpecialThreadId))
- {
- hr = S_OK;
- goto ErrExit;
- }
- // Grow the array if necessary.
- if (m_DSTCount >= m_DSTArraySize)
- {
- // There's probably only ever gonna be one or two of these
- // things, so we'll start small.
- DWORD newSize = (m_DSTArraySize == 0) ? 2 : m_DSTArraySize * 2;
-
- DWORD *newArray = new (nothrow) DWORD[newSize];
- IfNullGo(newArray);
-
- // If we're growing instead of starting, then copy the old array.
- if (m_DSTArray)
- {
- memcpy(newArray, m_DSTArray, m_DSTArraySize * sizeof(DWORD));
- delete [] m_DSTArray;
- }
-
- // Update to the new array and size.
- m_DSTArray = newArray;
- m_DSTArraySize = newSize;
- }
-
- // Save the new thread ID.
- m_DSTArray[m_DSTCount++] = dwSpecialThreadId;
-
- hr = (RefreshDebuggerSpecialThreadList());
-#else // !DEBUGGING_SUPPORTED
- hr = E_NOTIMPL;
-#endif // !DEBUGGING_SUPPORTED
-ErrExit:
- END_ENTRYPOINT_NOTHROW;
- return hr;
-
-}
-// Helper function to update the thread list in the debugger control block
-HRESULT CorConfiguration::RefreshDebuggerSpecialThreadList()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
-#ifdef DEBUGGING_SUPPORTED
- HRESULT hr = S_OK;
-
- if (g_pDebugInterface)
- {
- // Inform the debugger services that this list has changed
- hr = g_pDebugInterface->UpdateSpecialThreadList(
- m_DSTCount, m_DSTArray);
-
- _ASSERTE(SUCCEEDED(hr));
- }
-
- return (hr);
-#else // !DEBUGGING_SUPPORTED
- return E_NOTIMPL;
-#endif // !DEBUGGING_SUPPORTED
-}
-
-
-// Helper func that returns true if the thread is in the debugger special thread list
-BOOL CorConfiguration::IsDebuggerSpecialThread(DWORD dwThreadId)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- for (DWORD i = 0; i < m_DSTCount; i++)
- {
- if (m_DSTArray[i] == dwThreadId)
- return (TRUE);
- }
-
- return (FALSE);
-}
-
-
-// Clean up any debugger thread control object we may be holding, called at shutdown.
-void CorConfiguration::CleanupDebuggerThreadControl()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- if (m_CachedDebuggerThreadControl != NULL)
- {
- // Note: we don't release the IDebuggerThreadControl object if we're cleaning up from
- // our DllMain. The DLL that implements the object may already have been unloaded.
- // Leaking the object is okay... the PDM doesn't care.
- if (!IsAtProcessExit())
- m_CachedDebuggerThreadControl->Release();
-
- m_CachedDebuggerThreadControl = NULL;
- }
-}
-#endif // !defined(FEATURE_CORECLR)
//*****************************************************************************
// IUnknown
@@ -3520,20 +1527,6 @@ ULONG CorRuntimeHostBase::AddRef()
return InterlockedIncrement(&m_cRef);
}
-#if !defined(FEATURE_CORECLR) // simple hosting
-ULONG CorHost::Release()
-{
- LIMITED_METHOD_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
-
- ULONG cRef = InterlockedDecrement(&m_cRef);
- if (!cRef) {
- delete this;
- }
-
- return (cRef);
-}
-#endif // !defined(FEATURE_CORECLR)
ULONG CorHost2::Release()
{
@@ -3551,62 +1544,6 @@ ULONG CorHost2::Release()
return (cRef);
}
-#if !defined(FEATURE_CORECLR) // simple hosting
-HRESULT CorHost::QueryInterface(REFIID riid, void **ppUnk)
-{
- if (!ppUnk)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT; // no global state updates that need guarding.
- }
- CONTRACTL_END;
-
- if (ppUnk == NULL)
- {
- return E_POINTER;
- }
-
- *ppUnk = 0;
-
- // Deliberately do NOT hand out ICorConfiguration. They must explicitly call
- // GetConfiguration to obtain that interface.
- if (riid == IID_IUnknown)
- *ppUnk = (IUnknown *) (ICorRuntimeHost *) this;
- else if (riid == IID_ICorRuntimeHost)
- {
- ULONG version = 1;
- if (m_Version == 0)
- FastInterlockCompareExchange((LONG*)&m_Version, version, 0);
-
- if (m_Version != version && (g_singleVersionHosting || !g_fEEStarted))
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- *ppUnk = (ICorRuntimeHost *) this;
- }
- else if (riid == IID_ICorThreadpool)
- *ppUnk = (ICorThreadpool *) this;
- else if (riid == IID_IGCHost)
- *ppUnk = (IGCHost *) this;
- else if (riid == IID_IGCHost2)
- *ppUnk = (IGCHost2 *) this;
- else if (riid == IID_IValidator)
- *ppUnk = (IValidator *) this;
- else if (riid == IID_IDebuggerInfo)
- *ppUnk = (IDebuggerInfo *) this;
- else if (riid == IID_ICLRExecutionManager)
- *ppUnk = (ICLRExecutionManager *) this;
- else
- return (E_NOINTERFACE);
- AddRef();
- return (S_OK);
-}
-#endif // !defined(FEATURE_CORECLR)
HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
@@ -3633,7 +1570,6 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
// GetConfiguration to obtain that interface.
if (riid == IID_IUnknown)
*ppUnk = static_cast<IUnknown *>(static_cast<ICLRRuntimeHost *>(this));
-#ifdef FEATURE_CORECLR // CoreCLR only supports IID_ICLRRuntimeHost2
else if (riid == IID_ICLRRuntimeHost2)
{
ULONG version = 2;
@@ -3642,16 +1578,6 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
*ppUnk = static_cast<ICLRRuntimeHost2 *>(this);
}
-#else // DesktopCLR only supports IID_ICLRRuntimeHost
- else if (riid == IID_ICLRRuntimeHost)
- {
- ULONG version = 2;
- if (m_Version == 0)
- FastInterlockCompareExchange((LONG*)&m_Version, version, 0);
-
- *ppUnk = static_cast<ICLRRuntimeHost *>(this);
- }
-#endif // FEATURE_CORECLR
else if (riid == IID_ICLRExecutionManager)
{
ULONG version = 2;
@@ -3660,79 +1586,18 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
*ppUnk = static_cast<ICLRExecutionManager *>(this);
}
-#if !defined(FEATURE_CORECLR)
- else if (riid == __uuidof(ICLRPrivRuntime))
- {
- ULONG version = 2;
- if (m_Version == 0)
- FastInterlockCompareExchange((LONG*)&m_Version, version, 0);
-
- *ppUnk = static_cast<ICLRPrivRuntime *>(this);
- }
-#endif
#ifndef FEATURE_PAL
else if (riid == IID_IPrivateManagedExceptionReporting)
{
*ppUnk = static_cast<IPrivateManagedExceptionReporting *>(this);
}
#endif // !FEATURE_PAL
-#ifndef FEATURE_CORECLR
- else if (riid == IID_ICorThreadpool)
- *ppUnk = static_cast<ICorThreadpool *>(this);
- // TODO: wwl Remove this after SQL uses new interface.
- else if (riid == IID_IGCHost &&
- GetHostVersion() == 3)
- *ppUnk = static_cast<IGCHost *>(this);
- else if (riid == IID_ICLRValidator)
- *ppUnk = static_cast<ICLRValidator *>(this);
- else if (riid == IID_IDebuggerInfo)
- *ppUnk = static_cast<IDebuggerInfo *>(this);
-#ifdef FEATURE_TESTHOOKS
- else if (riid == IID_ICLRTestHookManager)
- {
- *ppUnk=CLRTestHookManager::Start();
- if(*ppUnk==NULL)
- return E_OUTOFMEMORY;
- }
-#endif // FEATURE_TESTHOOKS
-#endif // FEATURE_CORECLR
else
return (E_NOINTERFACE);
AddRef();
return (S_OK);
}
-#ifndef FEATURE_CORECLR // CorHost isn't exposed externally
-//*****************************************************************************
-// Called by the class factory template to create a new instance of this object.
-//*****************************************************************************
-HRESULT CorHost::CreateObject(REFIID riid, void **ppUnk)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- CorHost *pCorHost = new (nothrow) CorHost();
- if (!pCorHost)
- {
- hr = E_OUTOFMEMORY;
- }
- else
- {
- hr = pCorHost->QueryInterface(riid, ppUnk);
-
- if (FAILED(hr))
- delete pCorHost;
- }
- return (hr);
-}
-#endif // FEATURE_CORECLR
#ifndef FEATURE_PAL
HRESULT CorHost2::GetBucketParametersForCurrentException(BucketParameters *pParams)
@@ -3849,34 +1714,6 @@ HRESULT CorRuntimeHostBase::MapFile(HANDLE hFile, HMODULE* phHandle)
///////////////////////////////////////////////////////////////////////////////
// IDebuggerInfo::IsDebuggerAttached
-#if !defined(FEATURE_CORECLR)
-HRESULT CorDebuggerInfo::IsDebuggerAttached(BOOL *pbAttached)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if (pbAttached == NULL)
- hr = E_INVALIDARG;
- else
-#ifdef DEBUGGING_SUPPORTED
- *pbAttached = (CORDebuggerAttached() != 0);
-#else
- *pbAttached = FALSE;
-#endif
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-#endif // !defined(FEATURE_CORECLR)
LONG CorHost2::m_RefCount = 0;
@@ -3886,440 +1723,6 @@ LPCWSTR CorHost2::s_wszAppDomainManagerAsm = NULL;
LPCWSTR CorHost2::s_wszAppDomainManagerType = NULL;
EInitializeNewDomainFlags CorHost2::s_dwDomainManagerInitFlags = eInitializeNewDomainFlags_None;
-#ifndef FEATURE_CORECLR // not supported
-
-StringArrayList CorHost2::s_defaultDomainPropertyNames;
-StringArrayList CorHost2::s_defaultDomainPropertyValues;
-
-IHostMemoryManager *CorHost2::m_HostMemoryManager = NULL;
-IHostMalloc *CorHost2::m_HostMalloc = NULL;
-IHostTaskManager *CorHost2::m_HostTaskManager = NULL;
-IHostThreadpoolManager *CorHost2::m_HostThreadpoolManager = NULL;
-IHostIoCompletionManager *CorHost2::m_HostIoCompletionManager = NULL;
-IHostSyncManager *CorHost2::m_HostSyncManager = NULL;
-IHostAssemblyManager *CorHost2::m_HostAssemblyManager = NULL;
-IHostGCManager *CorHost2::m_HostGCManager = NULL;
-IHostSecurityManager *CorHost2::m_HostSecurityManager = NULL;
-IHostPolicyManager *CorHost2::m_HostPolicyManager = NULL;
-int CorHost2::m_HostOverlappedExtensionSize = -1;
-
-STARTUP_FLAGS CorHost2::m_dwStartupFlags = STARTUP_CONCURRENT_GC;
-WCHAR CorHost2::m_wzHostConfigFile[_MAX_PATH] = { 0 };
-
-BOOL CorHost2::m_dwFlagsFinalized = FALSE;
-DangerousNonHostedSpinLock CorHost2::m_FlagsLock;
-
-class CCLRMemoryNotificationCallback: public ICLRMemoryNotificationCallback
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE OnMemoryNotification(EMemoryAvailable eMemoryAvailable) {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- // We have not started runtime yet.
- if (!g_fEEStarted)
- return S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- switch (eMemoryAvailable)
- {
- case eMemoryAvailableLow:
- STRESS_LOG0(LF_GC, LL_INFO100, "Host delivers memory notification: Low\n");
- break;
- case eMemoryAvailableNeutral:
- STRESS_LOG0(LF_GC, LL_INFO100, "Host delivers memory notification: Neutral\n");
- break;
- case eMemoryAvailableHigh:
- STRESS_LOG0(LF_GC, LL_INFO100, "Host delivers memory notification: High\n");
- break;
- }
- static DWORD lastTime = (DWORD)-1;
- if (eMemoryAvailable == eMemoryAvailableLow)
- {
- FastInterlockIncrement ((LONG *)&g_bLowMemoryFromHost);
- DWORD curTime = GetTickCount();
- if (curTime < lastTime || curTime - lastTime >= 0x2000)
- {
- lastTime = curTime;
- FinalizerThread::EnableFinalization();
- }
- }
- else
- {
- FastInterlockExchange ((LONG *)&g_bLowMemoryFromHost, FALSE);
- }
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
- {
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRMemoryNotificationCallback && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-};
-
-static CCLRMemoryNotificationCallback s_MemoryNotification;
-
-class CLRTaskManager : public ICLRTaskManager
-{
-public:
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) {
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRTaskManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual HRESULT STDMETHODCALLTYPE CreateTask(ICLRTask **pTask)
- {
- CONTRACTL
- {
- NOTHROW;
- DISABLED(GC_NOTRIGGER);
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
-#ifdef _DEBUG
- _ASSERTE (!CLRTaskHosted() || GetCurrentHostTask());
-#endif
- _ASSERTE (GetThread() == NULL);
- Thread *pThread = NULL;
- pThread = SetupThreadNoThrow(&hr);
- *pTask = pThread;
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE GetCurrentTask(ICLRTask **pTask)
- {
- // This function may be called due SQL SwitchIn/Out. Contract may
- // force memory allocation which is not allowed during Switch.
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_SO_TOLERANT;
- STATIC_CONTRACT_ENTRY_POINT;
-
- *pTask = GetThread();
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE SetUILocale(LCID lcid)
- {
- Thread *pThread = GetThread();
- if (pThread == NULL)
- return HOST_E_INVALIDOPERATION;
-
- CONTRACTL
- {
- GC_TRIGGERS;
- NOTHROW;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- //BEGIN_ENTRYPOINT_NOTHROW;
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- {
- pThread->SetCultureId(lcid,TRUE);
- }
- END_EXTERNAL_ENTRYPOINT;
- //END_ENTRYPOINT_NOTHROW;
-
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE SetLocale(LCID lcid)
- {
- Thread *pThread = GetThread();
- if (pThread == NULL)
- return HOST_E_INVALIDOPERATION;
-
- CONTRACTL
- {
- GC_TRIGGERS;
- NOTHROW;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- //BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- {
- pThread->SetCultureId(lcid,FALSE);
- }
- END_EXTERNAL_ENTRYPOINT;
- //END_ENTRYPOINT_NOTHROW;
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE GetCurrentTaskType(ETaskType *pTaskType)
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
- *pTaskType = ::GetCurrentTaskType();
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
- }
-};
-
-static CLRTaskManager s_CLRTaskManager;
-
-class CLRSyncManager : public ICLRSyncManager
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE GetMonitorOwner(SIZE_T Cookie,
- IHostTask **ppOwnerHostTask)
- {
- CONTRACTL
- {
- NOTHROW;
- MODE_PREEMPTIVE;
- GC_NOTRIGGER;
- ENTRY_POINT;;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- // Cookie is the SyncBlock
- // <TODO>TODO: Lifetime of Cookie?</TODO>
- AwareLock* pAwareLock = (AwareLock*)Cookie;
- IHostTask *pTask = NULL;
- Thread *pThread = pAwareLock->GetOwningThread();
- if (pThread)
- {
- ThreadStoreLockHolder tsLock;
- pThread = pAwareLock->GetOwningThread();
- if (pThread)
- {
- // See if the lock is orphaned, and the Thread object has been deleted
- Thread *pWalk = NULL;
- while ((pWalk = ThreadStore::GetAllThreadList(pWalk, 0, 0)) != NULL)
- {
- if (pWalk == pThread)
- {
- pTask = pThread->GetHostTaskWithAddRef();
- break;
- }
- }
- }
- }
-
- *ppOwnerHostTask = pTask;
-
- END_ENTRYPOINT_NOTHROW;
-
-
- return S_OK;
- }
- virtual HRESULT STDMETHODCALLTYPE CreateRWLockOwnerIterator(SIZE_T Cookie,
- SIZE_T *pIterator) {
- Thread *pThread = GetThread();
-
- // We may open a window for GC here.
- // A host should not hijack a coop thread to do deadlock detection.
- if (pThread && pThread->PreemptiveGCDisabled())
- return HOST_E_INVALIDOPERATION;
-
- CONTRACTL
- {
- NOTHROW;
- MODE_PREEMPTIVE;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_FAIL;
-
-#ifdef FEATURE_RWLOCK
- BEGIN_ENTRYPOINT_NOTHROW;
- ThreadStoreLockHolder tsLock;
- // Cookie is a weak handle. We need to make sure that the object is not moving.
- CRWLock *pRWLock = *(CRWLock **) Cookie;
- *pIterator = NULL;
- if (pRWLock == NULL)
- {
- hr = S_OK;
- }
- else
- {
- hr = pRWLock->CreateOwnerIterator(pIterator);
- }
- END_ENTRYPOINT_NOTHROW;
-#endif // FEATURE_RWLOCK
-
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE GetRWLockOwnerNext(SIZE_T Iterator,
- IHostTask **ppOwnerHostTask)
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
-#ifdef FEATURE_RWLOCK
- BEGIN_ENTRYPOINT_NOTHROW;
- CRWLock::GetNextOwner(Iterator,ppOwnerHostTask);
- END_ENTRYPOINT_NOTHROW;
-#endif // FEATURE_RWLOCK
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE DeleteRWLockOwnerIterator(SIZE_T Iterator)
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
-#ifdef FEATURE_RWLOCK
- BEGIN_ENTRYPOINT_NOTHROW;
- CRWLock::DeleteOwnerIterator(Iterator);
- END_ENTRYPOINT_NOTHROW;
-#endif // FEATURE_RWLOCK
-
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
- {
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRSyncManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-};
-
-static CLRSyncManager s_CLRSyncManager;
-
-extern void HostIOCompletionCallback(DWORD ErrorCode,
- DWORD numBytesTransferred,
- LPOVERLAPPED lpOverlapped);
-class CCLRIoCompletionManager :public ICLRIoCompletionManager
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE OnComplete(DWORD dwErrorCode,
- DWORD NumberOfBytesTransferred,
- void* pvOverlapped)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_ENTRY_POINT;
-
- if (pvOverlapped)
- {
- BEGIN_ENTRYPOINT_NOTHROW;
- HostIOCompletionCallback (dwErrorCode, NumberOfBytesTransferred, (LPOVERLAPPED)pvOverlapped);
- END_ENTRYPOINT_NOTHROW;
- }
-
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
- BEGIN_INTERFACE HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRIoCompletionManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-};
-
-static CCLRIoCompletionManager s_CLRIoCompletionManager;
-#endif // FEATURE_CORECLR
#ifdef _DEBUG
extern void ValidateHostInterface();
@@ -4375,181 +1778,9 @@ HRESULT CorHost2::SetHostControl(IHostControl* pHostControl)
while (FastInterlockExchange((LONG*)&fOneOnly, 1) == 1)
{
- #ifndef FEATURE_CORECLR
- if (m_HostTaskManager != NULL)
- {
- m_HostTaskManager->SwitchToTask(0);
- }
- else
- {
- IHostTaskManager *pHostTaskManager = NULL;
- if (pHostControl->GetHostManager(IID_IHostTaskManager, (void**)&pHostTaskManager) == S_OK &&
- pHostTaskManager != NULL)
- {
- pHostTaskManager->SwitchToTask(0);
- pHostTaskManager->Release();
- }
- else
- {
- __SwitchToThread(0, ++dwSwitchCount);
- }
- }
- #else
__SwitchToThread(0, ++dwSwitchCount);
- #endif // FEATURE_CORECLR
}
-#ifndef FEATURE_CORECLR
-
-#ifdef _DEBUG
- ValidateHostInterface();
-#endif
-
-#ifdef _DEBUG
- DWORD dbg_HostManagerConfig = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_HostManagerConfig);
-#endif
-
- IHostMemoryManager *memoryManager = NULL;
- IHostTaskManager *taskManager = NULL;
- IHostThreadpoolManager *threadpoolManager = NULL;
- IHostIoCompletionManager *ioCompletionManager = NULL;
- IHostSyncManager *syncManager = NULL;
- IHostAssemblyManager *assemblyManager = NULL;
- IHostGCManager *gcManager = NULL;
- IHostSecurityManager *securityManager = NULL;
- IHostPolicyManager *policyManager = NULL;
-
- if (m_HostMemoryManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRMEMORYHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostMemoryManager,(void**)&memoryManager) == S_OK &&
- memoryManager != NULL) {
- if (m_HostMalloc == NULL)
- {
- hr = memoryManager->CreateMalloc (MALLOC_THREADSAFE, &m_HostMalloc);
- if (hr == S_OK)
- {
- memoryManager->RegisterMemoryNotificationCallback(&s_MemoryNotification);
- }
- else
- {
- memoryManager->Release();
- IfFailGo(E_UNEXPECTED);
- }
- }
- m_HostMemoryManager = memoryManager;
- g_fHostConfig |= CLRMEMORYHOSTED;
- }
-
- if (m_HostTaskManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRTASKHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostTaskManager,(void**)&taskManager) == S_OK &&
- taskManager != NULL) {
-#ifdef _TARGET_ARM_ // @ARMTODO: re-enable once we support hosted p/invokes.
- IfFailGo(E_NOTIMPL);
-#endif
- m_HostTaskManager = taskManager;
- m_HostTaskManager->SetCLRTaskManager(&s_CLRTaskManager);
- g_fHostConfig |= CLRTASKHOSTED;
- }
-
- if (m_HostThreadpoolManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRTHREADPOOLHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostThreadpoolManager,(void**)&threadpoolManager) == S_OK &&
- threadpoolManager != NULL) {
- m_HostThreadpoolManager = threadpoolManager;
- g_fHostConfig |= CLRTHREADPOOLHOSTED;
- }
-
- if (m_HostIoCompletionManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRIOCOMPLETIONHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostIoCompletionManager,(void**)&ioCompletionManager) == S_OK &&
- ioCompletionManager != NULL) {
- DWORD hostSize;
- hr = ioCompletionManager->GetHostOverlappedSize(&hostSize);
- if (FAILED(hr))
- {
- ioCompletionManager->Release();
- IfFailGo(E_UNEXPECTED);
- }
- m_HostOverlappedExtensionSize = (int)hostSize;
- m_HostIoCompletionManager = ioCompletionManager;
- m_HostIoCompletionManager->SetCLRIoCompletionManager(&s_CLRIoCompletionManager);
- g_fHostConfig |= CLRIOCOMPLETIONHOSTED;
- }
-
- if (m_HostSyncManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRSYNCHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostSyncManager,(void**)&syncManager) == S_OK &&
- syncManager != NULL) {
- m_HostSyncManager = syncManager;
- m_HostSyncManager->SetCLRSyncManager(&s_CLRSyncManager);
- g_fHostConfig |= CLRSYNCHOSTED;
- }
-
- if (m_HostAssemblyManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRASSEMBLYHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostAssemblyManager,(void**)&assemblyManager) == S_OK &&
- assemblyManager != NULL) {
-
- assemblyManager->GetAssemblyStore(&g_pHostAssemblyStore);
-
- hr = assemblyManager->GetNonHostStoreAssemblies(&g_pHostAsmList);
- if (FAILED(hr))
- {
- assemblyManager->Release();
- IfFailGo(hr);
- }
-
- if (g_pHostAssemblyStore || g_pHostAsmList)
- g_bFusionHosted = TRUE;
- m_HostAssemblyManager = assemblyManager;
- g_fHostConfig |= CLRASSEMBLYHOSTED;
- }
-
- if (m_HostGCManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRGCHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostGCManager,
- (void**)&gcManager) == S_OK &&
- gcManager != NULL) {
- m_HostGCManager = gcManager;
- g_fHostConfig |= CLRGCHOSTED;
- }
-
- if (m_HostSecurityManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRSECURITYHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostSecurityManager,
- (void**)&securityManager) == S_OK &&
- securityManager != NULL) {
- g_fHostConfig |= CLRSECURITYHOSTED;
- m_HostSecurityManager = securityManager;
-#ifdef FEATURE_CAS_POLICY
- HostExecutionContextManager::InitializeRestrictedContext();
-#endif // #ifdef FEATURE_CAS_POLICY
- }
-
- if (m_HostPolicyManager == NULL &&
- pHostControl->GetHostManager(IID_IHostPolicyManager,
- (void**)&policyManager) == S_OK &&
- policyManager != NULL) {
- m_HostPolicyManager = policyManager;
- }
-#endif //!FEATURE_CORECLR
if (m_HostControl == NULL)
{
@@ -4574,64 +1805,28 @@ public:
EPolicyAction action)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetDefaultAction(operation, action);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetTimeout(EClrOperation operation,
DWORD dwMilliseconds)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetTimeout(operation,dwMilliseconds);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetActionOnTimeout(EClrOperation operation,
EPolicyAction action)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetActionOnTimeout(operation,action);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetTimeoutAndAction(EClrOperation operation, DWORD dwMilliseconds,
EPolicyAction action)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_SO_TOLERANT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetTimeoutAndAction(operation,dwMilliseconds,action);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetActionOnFailure(EClrFailure failure,
@@ -4642,7 +1837,6 @@ public:
STATIC_CONTRACT_ENTRY_POINT;
LIMITED_METHOD_CONTRACT;
HRESULT hr;
-#ifdef FEATURE_CORECLR
// For CoreCLR, this method just supports FAIL_AccessViolation as a valid
// failure input arg. The validation of the specified action for the failure
// will be done in EEPolicy::IsValidActionForFailure.
@@ -4650,7 +1844,6 @@ public:
{
return E_INVALIDARG;
}
-#endif // FEATURE_CORECLR
BEGIN_ENTRYPOINT_NOTHROW;
hr = GetEEPolicy()->SetActionOnFailure(failure,action);
END_ENTRYPOINT_NOTHROW;
@@ -4660,16 +1853,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE SetUnhandledExceptionPolicy(EClrUnhandledException policy)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetUnhandledExceptionPolicy(policy);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual ULONG STDMETHODCALLTYPE AddRef(void)
@@ -4705,427 +1889,22 @@ public:
static CCLRPolicyManager s_PolicyManager;
-#ifndef FEATURE_CORECLR // not supported
-class CCLROnEventManager: public ICLROnEventManager
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE RegisterActionOnEvent(EClrEvent event,
- IActionOnCLREvent *pAction)
- {
- CONTRACTL
- {
- GC_TRIGGERS;
- NOTHROW;
- ENTRY_POINT;
-
- // This function is always called from outside the Runtime. So, we assert that we either don't have a
- // managed thread, or if we do, that we're in preemptive GC mode.
- PRECONDITION((GetThread() == NULL) || !GetThread()->PreemptiveGCDisabled());
- }
- CONTRACTL_END;
-
- if (event >= MaxClrEvent || pAction == NULL || event < (EClrEvent)0)
- return E_INVALIDARG;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- // Note: its only safe to use a straight ReleaseHolder from within the VM directory when we know we're
- // called from outside the Runtime. We assert that above, just to be sure.
- ReleaseHolder<IActionOnCLREvent> actionHolder(pAction);
- pAction->AddRef();
-
- CrstHolderWithState ch(m_pLock);
-
- DWORD dwSwitchCount = 0;
- while (m_ProcessEvent != 0)
- {
- ch.Release();
- __SwitchToThread(0, ++dwSwitchCount);
- ch.Acquire();
- }
-
- if (m_pAction[event] == NULL)
- {
- m_pAction[event] = new (nothrow)ActionNode;
- if (m_pAction[event] == NULL)
- hr = E_OUTOFMEMORY;
- }
-
- if (SUCCEEDED(hr))
- {
- ActionNode *walk = m_pAction[event];
- while (TRUE)
- {
- int n = 0;
- for ( ; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n] == NULL)
- {
- walk->pAction[n] = pAction;
- actionHolder.SuppressRelease();
- hr = S_OK;
- break;
- }
- }
- if (n < ActionNode::ActionArraySize)
- {
- break;
- }
- if (walk->pNext == NULL)
- {
- walk->pNext = new (nothrow) ActionNode;
- if (walk->pNext == NULL)
- {
- hr = E_OUTOFMEMORY;
- break;
- }
- }
- walk = walk->pNext;
- }
- }
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE UnregisterActionOnEvent(EClrEvent event,
- IActionOnCLREvent *pAction)
- {
- CONTRACTL
- {
- GC_NOTRIGGER;
- NOTHROW;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (event == Event_StackOverflow)
- {
- // We don't want to take a lock when we process StackOverflow event, because we may
- // not have enough stack to do it.
- // So we do not release our cache of the callback in order to avoid race.
- return HOST_E_INVALIDOPERATION;
- }
-
- HRESULT hr = S_OK;
-
- ActionNode *walk = NULL;
- ActionNode *prev = NULL;
-
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- CrstHolderWithState ch(m_pLock);
-
- DWORD dwSwitchCount = 0;
- while (m_ProcessEvent != 0)
- {
- ch.Release();
- __SwitchToThread(0, ++dwSwitchCount);
- ch.Acquire();
- }
-
- if (m_pAction[event] == NULL)
- IfFailGo(HOST_E_INVALIDOPERATION);
-
- walk = m_pAction[event];
- while (walk)
- {
- BOOL fInUse = FALSE;
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (prev && !fInUse && walk->pAction[n])
- fInUse = TRUE;
- if (walk->pAction[n] == pAction)
- {
- walk->pAction[n] = NULL;
- ch.Release();
- pAction->Release();
- hr = S_OK;
- goto ErrExit;
- }
- }
- if (prev && !fInUse)
- {
- prev->pNext = walk->pNext;
- delete walk;
- walk = prev;
- }
- prev = walk;
- walk = walk->pNext;
- }
- hr = HOST_E_INVALIDOPERATION;
-ErrExit:
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppUnk)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLROnEventManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppUnk = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- // This function is to work around an issue in scan.exe.
- // scan.exe is not smart to handle that if (){} else {}.
- void ProcessSOEvent(void *data)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- WRAPPER_NO_CONTRACT;
-
- if (m_pLock == NULL)
- return;
-
- ActionNode *walk = m_pAction[Event_StackOverflow];
-
- while (walk)
- {
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n])
- {
- walk->pAction[n]->OnEvent(Event_StackOverflow,data);
- }
- }
- walk = walk->pNext;
- }
- }
-
- void ProcessEvent(EClrEvent event, void *data)
- {
- WRAPPER_NO_CONTRACT;
-
- if (m_pLock == NULL)
- {
- return;
- }
-
- _ASSERTE (event != Event_StackOverflow);
-
- {
- CrstHolder ch(m_pLock);
-
- if (event == Event_ClrDisabled)
- {
- if (m_CLRDisabled)
- {
- return;
- }
- m_CLRDisabled = TRUE;
- }
- m_ProcessEvent ++;
-
- // Release the lock around the call into the host. Is this correct?
- // It seems that we need to hold the lock except for the actual callback itself.
- }
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- {
- ActionNode *walk = m_pAction[event];
- while (walk)
- {
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n])
- {
- walk->pAction[n]->OnEvent(event,data);
- }
- }
- walk = walk->pNext;
- }
- }
- END_SO_TOLERANT_CODE_CALLING_HOST;
-
- {
- CrstHolder ch(m_pLock);
- m_ProcessEvent --;
- }
- }
-
- BOOL IsActionRegisteredForEvent(EClrEvent event)
- {
- WRAPPER_NO_CONTRACT;
-
- // Check to see if the event manager has been set up.
- if (m_pLock == NULL)
- return FALSE;
-
- CrstHolder ch(m_pLock);
-
- ActionNode *walk = m_pAction[event];
- while (walk)
- {
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n] != NULL)
- {
- // We found an action registered for this event.
- return TRUE;
- }
- }
- walk = walk->pNext;
- }
-
- // There weren't any actions registered.
- return FALSE;
- }
-
- HRESULT Init()
- {
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_MODE_ANY;
- STATIC_CONTRACT_SO_TOLERANT;
-
- HRESULT hr = S_OK;
- if (m_pLock == NULL)
- {
- EX_TRY
- {
- BEGIN_SO_INTOLERANT_CODE(GetThread());
- {
- InitHelper();
- }
- END_SO_INTOLERANT_CODE;
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
- }
-
- return hr;
- }
-
-#if 0
- // We do not need this one. We have one instance of this class
- // and it is static.
- CCLROnEventManager()
- {
- LIMITED_METHOD_CONTRACT;
- for (int n = 0; n < MaxClrEvent; n ++)
- m_pAction[n] = NULL;
- }
-#endif
-
-private:
- struct ActionNode
- {
- static const int ActionArraySize = 8;
-
- IActionOnCLREvent *pAction[ActionArraySize];
- ActionNode *pNext;
-
- ActionNode ()
- : pNext(NULL)
- {
- LIMITED_METHOD_CONTRACT;
-
- for (int n = 0; n < ActionArraySize; n ++)
- pAction[n] = 0;
- }
- };
- ActionNode *m_pAction[MaxClrEvent];
-
- Crst* m_pLock;
-
- BOOL m_CLRDisabled;
-
- // We can not call out into host while holding the lock. At the same time
- // we need to make our data consistent. Therefore, m_ProcessEvent is a marker
- // to forbid touching the data structure from Register and UnRegister.
- DWORD m_ProcessEvent;
-
- void InitHelper()
- {
- CONTRACTL
- {
- GC_NOTRIGGER;
- THROWS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- m_ProcessEvent = 0;
-
- Crst* tmp = new Crst(CrstOnEventManager, CrstFlags(CRST_DEFAULT | CRST_DEBUGGER_THREAD));
- if (FastInterlockCompareExchangePointer(&m_pLock, tmp, NULL) != NULL)
- delete tmp;
- }
-};
-
-static CCLROnEventManager s_OnEventManager;
-#endif // FEATURE_CORECLR
void ProcessEventForHost(EClrEvent event, void *data)
{
-#ifndef FEATURE_CORECLR
- WRAPPER_NO_CONTRACT;
-
- _ASSERTE (event != Event_StackOverflow);
-
- GCX_PREEMP();
-
- s_OnEventManager.ProcessEvent(event,data);
-#endif // FEATURE_CORECLR
}
// We do not call ProcessEventForHost for stack overflow, since we have limit stack
// and we should avoid calling GCX_PREEMPT
void ProcessSOEventForHost(EXCEPTION_POINTERS *pExceptionInfo, BOOL fInSoTolerant)
{
-#ifndef FEATURE_CORECLR
- WRAPPER_NO_CONTRACT;
-
- StackOverflowInfo soInfo;
- if (fInSoTolerant)
- {
- soInfo.soType = SO_Managed;
- }
- else if (pExceptionInfo == NULL || IsIPInModule(g_pMSCorEE, GetIP(pExceptionInfo->ContextRecord)))
- {
- soInfo.soType = SO_ClrEngine;
- }
- else
- {
- soInfo.soType = SO_Other;
- }
-
- soInfo.pExceptionInfo = pExceptionInfo;
- s_OnEventManager.ProcessSOEvent(&soInfo);
-#endif // FEATURE_CORECLR
}
BOOL IsHostRegisteredForEvent(EClrEvent event)
{
WRAPPER_NO_CONTRACT;
-#ifdef FEATURE_CORECLR
return FALSE;
-#else // FEATURE_CORECLR
- return s_OnEventManager.IsActionRegisteredForEvent(event);
-#endif // FEATURE_CORECLR
}
inline size_t SizeInKBytes(size_t cbSize)
@@ -5154,7 +1933,7 @@ void UpdateGCSettingFromHost ()
}
}
-#if !defined(FEATURE_CORECLR) || defined(FEATURE_WINDOWSPHONE)
+#if defined(FEATURE_WINDOWSPHONE)
class CCLRGCManager: public ICLRGCManager2
{
public:
@@ -5562,17 +2341,7 @@ public:
if (ppObject == NULL)
return E_INVALIDARG;
-#ifndef FEATURE_CORECLR
- // ErrorReportingManager is allowed, even if runtime is started, so
- // make this check first.
- // Host must call release on CLRErrorReportingManager after this call
- if (riid == IID_ICLRErrorReportingManager)
- {
- *ppObject = &g_CLRErrorReportingManager;
- return S_OK;
- }
- else
-#elif defined(FEATURE_WINDOWSPHONE)
+#if defined(FEATURE_WINDOWSPHONE)
if (riid == IID_ICLRErrorReportingManager2)
{
*ppObject = &g_CLRErrorReportingManager;
@@ -5585,12 +2354,6 @@ public:
// If runtime has been started, do not allow user to obtain CLR managers.
return HOST_E_INVALIDOPERATION;
}
-#ifndef FEATURE_CORECLR
- else if (riid == IID_ICLRTaskManager) {
- *ppObject = &s_CLRTaskManager;
- return S_OK;
- }
-#endif // !FEATURE_CORECLR
// CoreCLR supports ICLRPolicyManager since it allows the host
// to specify the policy for AccessViolation.
@@ -5599,30 +2362,8 @@ public:
FastInterlockExchange((LONG*)&g_CLRPolicyRequested, TRUE);
return S_OK;
}
-#ifndef FEATURE_CORECLR
- else if (riid == IID_ICLRHostProtectionManager) {
- *ppObject = GetHostProtectionManager();
- return S_OK;
- }
-
- // Host must call release on CLRDebugManager after this call
- else if (riid == IID_ICLRDebugManager)
- {
- *ppObject = &s_CLRDebugManager;
- return S_OK;
- }
-
- else if (riid == IID_ICLROnEventManager)
- {
- HRESULT hr = s_OnEventManager.Init();
- if (FAILED(hr))
- return hr;
- *ppObject = &s_OnEventManager;
- return S_OK;
- }
-#endif // !FEATURE_CORECLR
-#if !defined(FEATURE_CORECLR) || defined(FEATURE_WINDOWSPHONE)
+#if defined(FEATURE_WINDOWSPHONE)
else if ((riid == IID_ICLRGCManager) || (riid == IID_ICLRGCManager2))
{
*ppObject = &s_GCManager;
@@ -5646,29 +2387,9 @@ public:
LPCWSTR pwzAppDomainManagerAssembly,
LPCWSTR pwzAppDomainManagerType)
{
-#ifndef FEATURE_CORECLR
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT; // no global state updates
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- hr = CorHost2::SetAppDomainManagerType(pwzAppDomainManagerAssembly,
- pwzAppDomainManagerType,
- eInitializeNewDomainFlags_None);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
// CoreCLR does not support this method
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual ULONG STDMETHODCALLTYPE AddRef(void)
@@ -5713,9 +2434,6 @@ private:
// After CLR starts, we give out s_CorCLRControlLimited which allows limited access to managers.
static CCorCLRControl s_CorCLRControl;
-#ifndef FEATURE_CORECLR
-static CCorCLRControl s_CorCLRControlLimited;
-#endif // FEATURE_CORECLR
///////////////////////////////////////////////////////////////////////////////
// ICLRRuntimeHost::GetCLRControl
@@ -5740,11 +2458,6 @@ HRESULT CorHost2::GetCLRControl(ICLRControl** pCLRControl)
}
else
{
-#ifndef FEATURE_CORECLR
- // Even CLR is hosted by v1 hosting interface, we still allow part of CLRControl, like IID_ICLRErrorReportingManager.
- s_CorCLRControlLimited.SetAccess(FALSE);
- *pCLRControl = &s_CorCLRControlLimited;
-#else // FEATURE_CORECLR
// If :
// 1) request comes for interface other than ICLRControl*, OR
// 2) runtime has already started, OR
@@ -5761,175 +2474,30 @@ HRESULT CorHost2::GetCLRControl(ICLRControl** pCLRControl)
{
hr = E_NOTIMPL;
}
-#endif // !FEATURE_CORECLR
}
END_ENTRYPOINT_NOTHROW;
return hr;
}
-#ifndef FEATURE_CORECLR
-
-// static
-HRESULT CorHost2::SetPropertiesForDefaultAppDomain(DWORD nProperties,
- __in_ecount(nProperties) LPCWSTR *pwszPropertyNames,
- __in_ecount(nProperties) LPCWSTR *pwszPropertyValues)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- // Default domain properties can only be set before the CLR has started
- if (g_fEEStarted || HasStarted())
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- // If the host is specifying properties, they should be there
- if (nProperties > 0 && (pwszPropertyNames == NULL || pwszPropertyValues == NULL))
- {
- return E_POINTER;
- }
-
- // v4 - since this property is being added late in the cycle to address a specific scenario, we
- // reject any attempt to set anything but a single well known property name. This restriction
- // can be removed in the future.
- for (DWORD iProperty = 0; iProperty < nProperties; ++iProperty)
- {
- if (pwszPropertyNames[iProperty] == NULL)
- {
- return E_POINTER;
- }
- if (pwszPropertyValues[iProperty] == NULL)
- {
- return E_POINTER;
- }
- if (wcscmp(PARTIAL_TRUST_VISIBLE_ASSEMBLIES_PROPERTY, pwszPropertyNames[iProperty]) != 0)
- {
- return HRESULT_FROM_WIN32(ERROR_UNKNOWN_PROPERTY);
- }
- }
-
- HRESULT hr = S_OK;
-
- EX_TRY
- {
- for (DWORD iProperty = 0; iProperty < nProperties; ++iProperty)
- {
- SString propertyName(pwszPropertyNames[iProperty]);
- s_defaultDomainPropertyNames.Append(propertyName);
-
- SString propertyValue(pwszPropertyValues[iProperty]);
- s_defaultDomainPropertyValues.Append(propertyValue);
- }
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
-// static
-HRESULT CorHost2::SetAppDomainManagerType(LPCWSTR wszAppDomainManagerAssembly,
- LPCWSTR wszAppDomainManagerType,
- EInitializeNewDomainFlags dwInitializeDomainFlags)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- // The AppDomainManger can only be set by the host before the CLR has started
- if (g_fEEStarted || HasStarted())
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- // Both the type and assembly must be specified
- if (wszAppDomainManagerAssembly == NULL || wszAppDomainManagerType == NULL)
- {
- return E_INVALIDARG;
- }
-
- // Make sure we understand the incoming flags
- const EInitializeNewDomainFlags knownFlags = eInitializeNewDomainFlags_NoSecurityChanges;
- if ((dwInitializeDomainFlags & (~knownFlags)) != eInitializeNewDomainFlags_None)
- {
- return E_INVALIDARG;
- }
-
- // Get a copy of the AppDomainManager assembly
- size_t cchAsm = wcslen(wszAppDomainManagerAssembly) + 1;
- NewArrayHolder<WCHAR> wszAppDomainManagerAssemblyCopy(new (nothrow) WCHAR[cchAsm]);
- if (wszAppDomainManagerAssemblyCopy == NULL)
- {
- return E_OUTOFMEMORY;
- }
- wcsncpy_s(wszAppDomainManagerAssemblyCopy, cchAsm, wszAppDomainManagerAssembly, cchAsm - 1);
-
- // And of the AppDomainManagerType
- size_t cchType = wcslen(wszAppDomainManagerType) + 1;
- NewArrayHolder<WCHAR> wszAppDomainManagerTypeCopy(new (nothrow) WCHAR[cchType]);
- if (wszAppDomainManagerTypeCopy == NULL)
- {
- return E_OUTOFMEMORY;
- }
- wcsncpy_s(wszAppDomainManagerTypeCopy, cchType, wszAppDomainManagerType, cchType - 1);
-
- LPCWSTR wszOldAsmValue = FastInterlockCompareExchangePointer(&s_wszAppDomainManagerAsm,
- static_cast<LPCWSTR>(wszAppDomainManagerAssemblyCopy.GetValue()),
- NULL);
- if (wszOldAsmValue != NULL)
- {
- // We've tried to setup an AppDomainManager twice ... that's not allowed
- return HOST_E_INVALIDOPERATION;
- }
-
- s_wszAppDomainManagerType = wszAppDomainManagerTypeCopy;
- s_dwDomainManagerInitFlags = dwInitializeDomainFlags;
-
- wszAppDomainManagerAssemblyCopy.SuppressRelease();
- wszAppDomainManagerTypeCopy.SuppressRelease();
- return S_OK;
-}
-#endif // !FEATURE_CORECLR
LPCWSTR CorHost2::GetAppDomainManagerAsm()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- _ASSERTE (g_fEEStarted);
- return s_wszAppDomainManagerAsm;
-#endif // FEATURE_CORECLR
}
LPCWSTR CorHost2::GetAppDomainManagerType()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- _ASSERTE (g_fEEStarted);
- return s_wszAppDomainManagerType;
-#endif // FEATURE_CORECLR
}
// static
EInitializeNewDomainFlags CorHost2::GetAppDomainManagerInitializeNewDomainFlags()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return eInitializeNewDomainFlags_None;
-#else // FEAUTRE_CORECLR
- _ASSERTE (g_fEEStarted);
- return s_dwDomainManagerInitFlags;
-#endif // FEATURE_CORECLR
}
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
@@ -7229,9 +3797,6 @@ struct ClrTlsInfo
#define DataToClrTlsInfo(a) (a)?(ClrTlsInfo*)((BYTE*)a - offsetof(ClrTlsInfo, data)):NULL
-#if !defined(FEATURE_CORECLR)
-#define HAS_FLS_SUPPORT 1
-#endif
#ifdef HAS_FLS_SUPPORT
@@ -8338,7 +4903,7 @@ SIZE_T STDMETHODCALLTYPE CExecutionEngine::ClrVirtualQuery(LPCVOID lpAddress,
}
#define ClrVirtualQuery EEVirtualQuery
-#if defined(_DEBUG) && defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if defined(_DEBUG) && !defined(FEATURE_PAL)
static VolatilePtr<BYTE> s_pStartOfUEFSection = NULL;
static VolatilePtr<BYTE> s_pEndOfUEFSectionBoundary = NULL;
static Volatile<DWORD> s_dwProtection = 0;
@@ -8388,7 +4953,7 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrVirtualProtect(LPVOID lpAddress,
//
// We assert if either of the two conditions above are true.
-#if defined(_DEBUG) && defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if defined(_DEBUG) && !defined(FEATURE_PAL)
// We do this check in debug/checked builds only
// Do we have the UEF details?
@@ -8569,7 +5134,6 @@ LocaleID RuntimeGetFileSystemLocale()
};
#endif
-#ifdef FEATURE_CORECLR
HRESULT CorHost2::DllGetActivationFactory(DWORD appDomainID, LPCWSTR wszTypeName, IActivationFactory ** factory)
{
#ifdef FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION
@@ -8599,7 +5163,6 @@ HRESULT CorHost2::DllGetActivationFactory(DWORD appDomainID, LPCWSTR wszTypeName
return E_NOTIMPL;
#endif
}
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION
@@ -8624,16 +5187,6 @@ HRESULT STDMETHODCALLTYPE DllGetActivationFactoryImpl(LPCWSTR wszAssemblyName,
AppDomain* pDomain = SystemDomain::System()->DefaultDomain();
_ASSERTE(pDomain);
-#ifndef FEATURE_CORECLR // coreclr uses winrt binder which does not allow redirects
- {
- BaseDomain::LockHolder lh(pDomain);
- if (!pDomain->HasLoadContextHostBinder())
- {
- // don't allow redirects
- SystemDomain::InitializeDefaultDomain(FALSE);
- }
- }
-#endif
BEGIN_EXTERNAL_ENTRYPOINT(&hr);
{
diff --git a/src/vm/crossgencompile.cpp b/src/vm/crossgencompile.cpp
index ffb025adb0..d214aa6152 100644
--- a/src/vm/crossgencompile.cpp
+++ b/src/vm/crossgencompile.cpp
@@ -461,12 +461,10 @@ void AppDomain::RaiseLoadingAssemblyEvent(DomainAssembly *pAssembly)
{
}
-#ifdef FEATURE_CORECLR
BOOL AppDomain::BindingByManifestFile()
{
return FALSE;
}
-#endif
ReJitManager::ReJitManager()
{
diff --git a/src/vm/crst.cpp b/src/vm/crst.cpp
index 7bf9bd65da..a1a9a9f71f 100644
--- a/src/vm/crst.cpp
+++ b/src/vm/crst.cpp
@@ -202,62 +202,6 @@ void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CH
#else // !DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-// Slower spin enter path after first attemp failed
-void CrstBase::SpinEnter()
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_CAN_TAKE_LOCK;
-
- // We only reach this routine when first attemp failed, so time to fire ETW event (fyuan)
-
- // Fire an ETW event to mark the beginning of native contention
- FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::NativeContention, GetClrInstanceId());
-
- // Try spinning and yielding before eventually blocking.
- // The limit of dwRepetitions = 10 is largely arbitrary - feel free to tune if you have evidence
- // you're making things better.
-
- for (DWORD iter = 0; iter < g_SpinConstants.dwRepetitions; iter++)
- {
- DWORD i = g_SpinConstants.dwInitialDuration;
-
- do
- {
- if ( (m_criticalsection.LockCount == -1 ||
- (size_t)m_criticalsection.OwningThread == (size_t) GetCurrentThreadId())
- && UnsafeTryEnterCriticalSection(&m_criticalsection))
- {
- return;
- }
-
- if (g_SystemInfo.dwNumberOfProcessors <= 1)
- {
- break;
- }
-
- // Delay by approximately 2*i clock cycles (Pentium III).
- // This is brittle code - future processors may of course execute this
- // faster or slower, and future code generators may eliminate the loop altogether.
- // The precise value of the delay is not critical, however, and can't think
- // of a better way that isn't machine-dependent.
-
- for (int delayCount = i; --delayCount; )
- {
- YieldProcessor(); // indicate to the processor that we are spining
- }
-
- // exponential backoff: wait a factor longer in the next iteration
- i *= g_SpinConstants.dwBackoffFactor;
- } while (i < g_SpinConstants.dwMaximumDuration);
-
- __SwitchToThread(0, CALLER_LIMITS_SPINNING);
- }
-
- UnsafeEnterCriticalSection(& m_criticalsection);
-}
-#endif // FEATURE_CORECLR
void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CHECK*/))
@@ -438,10 +382,6 @@ void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CH
if (! fIsCriticalSectionEnteredAfterFailingOnce)
{
-#ifndef FEATURE_CORECLR
- // Fire an ETW event to mark the beginning of native contention
- FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::NativeContention, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
fIsCriticalSectionEnteredAfterFailingOnce = TRUE;
hr = m_pHostCrst->Enter(option);
@@ -465,36 +405,13 @@ void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CH
Thread::BeginThreadAffinity();
}
-#ifdef FEATURE_CORECLR
UnsafeEnterCriticalSection(&m_criticalsection);
-#else
- // Try entering the critical section once, if we fail we contend
- // and fire the contention start ETW event
- if ((m_criticalsection.LockCount == -1 || (size_t)m_criticalsection.OwningThread == (size_t) GetCurrentThreadId())
- && UnsafeTryEnterCriticalSection(& m_criticalsection))
- {
- }
- else
- {
- SpinEnter();
-
- fIsCriticalSectionEnteredAfterFailingOnce = TRUE;
- }
-#endif
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
INCTHREADLOCKCOUNTTHREAD(pThread);
#endif
}
-#ifndef FEATURE_CORECLR
- // Fire an ETW event to mark the end of native contention
- // This we do only when we have fired a contention start event before
- if (fIsCriticalSectionEnteredAfterFailingOnce)
- {
- FireEtwContentionStop(ETW::ContentionLog::ContentionStructs::NativeContention, GetClrInstanceId());
- }
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
PostEnter();
diff --git a/src/vm/dangerousapis.h b/src/vm/dangerousapis.h
index 13122b7e8d..51686135e8 100644
--- a/src/vm/dangerousapis.h
+++ b/src/vm/dangerousapis.h
@@ -48,20 +48,6 @@ DEFINE_DANGEROUS_API(EVENT_INFO, API_NAMES("AddEventHandler", "Re
DEFINE_DANGEROUS_API(EVENT, API_NAMES("AddEventHandler", "RemoveEventHandler", "ToString"))
DEFINE_DANGEROUS_API(RESOURCE_MANAGER, API_NAMES("GetResourceSet", "InternalGetResourceSet", ".ctor"))
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-// The COM interfaces implemented by the reflection types.
-// The IDispatch Invoke methods are not included here because they are not implemented in mscorlib.
-DEFINE_DANGEROUS_API(ITYPE, API_NAMES("InvokeMember"))
-DEFINE_DANGEROUS_API(IASSEMBLY, API_NAMES("CreateInstance"))
-DEFINE_DANGEROUS_API(IMETHODBASE, API_NAMES("Invoke"))
-DEFINE_DANGEROUS_API(IMETHODINFO, API_NAMES("Invoke"))
-DEFINE_DANGEROUS_API(ICONSTRUCTORINFO, API_NAMES("Invoke", "Invoke_2", "Invoke_3", "Invoke_4", "Invoke_5"))
-DEFINE_DANGEROUS_API(IFIELDINFO, API_NAMES("GetValue", "SetValue"))
-DEFINE_DANGEROUS_API(IPROPERTYINFO, API_NAMES("GetValue", "SetValue"))
-DEFINE_DANGEROUS_API(IEVENTINFO, API_NAMES("AddEventHandler", "RemoveEventHandler"))
-DEFINE_DANGEROUS_API(IAPPDOMAIN, API_NAMES("CreateInstance", "CreateInstanceFrom", "DefineDynamicAssembly", "Load"))
-DEFINE_DANGEROUS_API(IREFLECT, API_NAMES("InvokeMember"))
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
diff --git a/src/vm/dataimage.cpp b/src/vm/dataimage.cpp
index e90c7e6a0e..df1ef30291 100644
--- a/src/vm/dataimage.cpp
+++ b/src/vm/dataimage.cpp
@@ -128,11 +128,7 @@ DataImage::DataImage(Module *module, CEEPreloader *preloader)
m_pInternedStructures = new InternedStructureHashTable();
-#ifdef FEATURE_CORECLR
m_inlineTrackingMap = NULL;
-#else
- m_inlineTrackingMap = new InlineTrackingMap();
-#endif
}
DataImage::~DataImage()
diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp
index c8b76bf6dc..098bdfdd4e 100644
--- a/src/vm/debugdebugger.cpp
+++ b/src/vm/debugdebugger.cpp
@@ -102,61 +102,6 @@ UINT_PTR FindMostRecentUserCodeOnStack(void)
return address;
}
-#ifndef FEATURE_CORECLR
-// Call into the unhandled-exception processing code to launch Watson.
-//
-// Arguments:
-// address - address to distinguish callsite of break.
-//
-// Notes:
-// Invokes a watson dialog in response to a user break (Debug.Break).
-// Assumes that caller has already enforced any policy it cares about related to whether a debugger is attached.
-void DoWatsonForUserBreak(UINT_PTR address)
-{
- CONTRACTL
- {
- MODE_ANY;
- GC_TRIGGERS;
- THROWS;
- PRECONDITION(address != NULL);
- }
- CONTRACTL_END;
-
- CONTEXT context;
- EXCEPTION_RECORD exceptionRecord;
- EXCEPTION_POINTERS exceptionPointers;
-
- ZeroMemory(&context, sizeof(context));
- ZeroMemory(&exceptionRecord, sizeof(exceptionRecord));
- ZeroMemory(&exceptionPointers, sizeof(exceptionPointers));
-
- // Try to locate the user managed code invoking System.Diagnostics.Debugger.Break
- UINT_PTR userCodeAddress = FindMostRecentUserCodeOnStack();
- if (userCodeAddress != NULL)
- {
- address = userCodeAddress;
- }
-
- LOG((LF_EH, LL_INFO10, "DoDebugBreak: break at %0p\n", address));
-
- exceptionRecord.ExceptionAddress = reinterpret_cast< PVOID >(address);
- exceptionPointers.ExceptionRecord = &exceptionRecord;
- exceptionPointers.ContextRecord = &context;
-
- Thread *pThread = GetThread();
- PTR_EHWatsonBucketTracker pUEWatsonBucketTracker = pThread->GetExceptionState()->GetUEWatsonBucketTracker();
- _ASSERTE(pUEWatsonBucketTracker != NULL);
- pUEWatsonBucketTracker->SaveIpForWatsonBucket(address);
- pUEWatsonBucketTracker->CaptureUnhandledInfoForWatson(TypeOfReportedError::UserBreakpoint, pThread, NULL);
- if (pUEWatsonBucketTracker->RetrieveWatsonBuckets() == NULL)
- {
- pUEWatsonBucketTracker->ClearWatsonBucketDetails();
- }
-
- WatsonLastChance(GetThread(), &exceptionPointers, TypeOfReportedError::UserBreakpoint);
-
-} // void DoDebugBreak()
-#endif // !FEATURE_CORECLR
// This does a user break, triggered by System.Diagnostics.Debugger.Break, or the IL opcode for break.
//
@@ -210,12 +155,6 @@ FCIMPL0(void, DebugDebugger::Break)
}
else
{
-#ifndef FEATURE_CORECLR
- // No debugger attached -- Watson up.
-
- // The HelperMethodFrame knows how to get the return address.
- DoWatsonForUserBreak(HELPER_METHOD_FRAME_GET_RETURN_ADDRESS());
-#endif //FEATURE_CORECLR
}
HELPER_METHOD_FRAME_END();
diff --git a/src/vm/disassembler.h b/src/vm/disassembler.h
index 1b3bf46e0e..5a7976a44f 100644
--- a/src/vm/disassembler.h
+++ b/src/vm/disassembler.h
@@ -10,7 +10,6 @@
#define USE_COREDISTOOLS_DISASSEMBLER 0
#define USE_MSVC_DISASSEMBLER 0
#ifdef HAVE_GCCOVER
- #if defined(FEATURE_CORECLR)
// COREDISTOOLS disassembler only supports amd64 and x86, so if this is
// CoreCLR but not amd64 and not x86, we will fall out of this check and not
// set USE_DISASSEMBLER.
@@ -18,10 +17,6 @@
#undef USE_COREDISTOOLS_DISASSEMBLER
#define USE_COREDISTOOLS_DISASSEMBLER 1
#endif
- #elif defined(_TARGET_AMD64_) || defined(_TARGET_X86_)
- #undef USE_MSVC_DISASSEMBLER
- #define USE_MSVC_DISASSEMBLER 1
- #endif // defined(FEATURE_CORECLR) || defined(_TARGET_AMD64_) || defined(_TARGET_X86_)
#endif // HAVE_GCCOVER
#if USE_COREDISTOOLS_DISASSEMBLER
diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp
index d2d8c96694..98e58c60c7 100644
--- a/src/vm/dllimport.cpp
+++ b/src/vm/dllimport.cpp
@@ -50,10 +50,6 @@
#include "eventtrace.h"
-#ifndef FEATURE_CORECLR
-#define NEEDDATA
-#include "fxretarget.h"
-#endif
#include "clr/fs/path.h"
using namespace clr::fs;
@@ -913,7 +909,6 @@ public:
}
#endif // MDA_SUPPORTED
-#ifdef FEATURE_CORECLR
// For CoreClr, clear the last error before calling the target that returns last error.
// There isn't always a way to know the function have failed without checking last error,
// in particular on Unix.
@@ -921,7 +916,6 @@ public:
{
pcsDispatch->EmitCALL(METHOD__STUBHELPERS__CLEAR_LAST_ERROR, 0, 0);
}
-#endif // FEATURE_CORECLR
// Invoke the target (calli, call method, call delegate, get/set field, etc.)
EmitInvokeTarget(pStubMD);
@@ -1158,178 +1152,8 @@ public:
LOG((LF_STUBS, LL_INFO1000, "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"));
#endif // LOGGING
-#ifndef FEATURE_CORECLR
- //
- // Publish ETW events for IL stubs
- //
-
- // If the category and the event is enabled...
- if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, ILStubGenerated))
- {
- EtwOnILStubGenerated(
- pStubMD,
- pbLocalSig,
- cbSig,
- jitFlags,
- &convertToHRTryCatch,
- &cleanupTryFinally,
- maxStack,
- (DWORD)cbCode
- );
- }
-#endif // !FEATURE_CORECLR
}
-#ifndef FEATURE_CORECLR
- //---------------------------------------------------------------------------------------
- //
- void
- EtwOnILStubGenerated(
- MethodDesc * pStubMD,
- PCCOR_SIGNATURE pbLocalSig,
- DWORD cbSig,
- CORJIT_FLAGS jitFlags,
- ILStubEHClause * pConvertToHRTryCatchBounds,
- ILStubEHClause * pCleanupTryFinallyBounds,
- DWORD maxStack,
- DWORD cbCode)
- {
- STANDARD_VM_CONTRACT;
-
- //
- // Interop Method Information
- //
- MethodDesc *pTargetMD = m_slIL.GetTargetMD();
- SString strNamespaceOrClassName, strMethodName, strMethodSignature;
- UINT64 uModuleId = 0;
-
- if (pTargetMD)
- {
- pTargetMD->GetMethodInfoWithNewSig(strNamespaceOrClassName, strMethodName, strMethodSignature);
- uModuleId = (UINT64)pTargetMD->GetModule()->GetAddrModuleID();
- }
-
- //
- // Stub Method Signature
- //
- SString stubNamespaceOrClassName, stubMethodName, stubMethodSignature;
- pStubMD->GetMethodInfoWithNewSig(stubNamespaceOrClassName, stubMethodName, stubMethodSignature);
-
- IMDInternalImport *pStubImport = pStubMD->GetModule()->GetMDImport();
-
- CQuickBytes qbLocal;
- PrettyPrintSig(pbLocalSig, (DWORD)cbSig, NULL, &qbLocal, pStubImport, NULL);
-
- SString strLocalSig(SString::Utf8, (LPCUTF8)qbLocal.Ptr());
-
- //
- // Native Signature
- //
- SString strNativeSignature(SString::Utf8);
- if (m_dwStubFlags & NDIRECTSTUB_FL_REVERSE_INTEROP)
- {
- // Reverse interop. Use StubSignature
- strNativeSignature = stubMethodSignature;
- }
- else
- {
- // Forward interop. Use StubTarget siganture
- PCCOR_SIGNATURE pCallTargetSig = GetStubTargetMethodSig();
- DWORD cCallTargetSig = GetStubTargetMethodSigLength();
-
- CQuickBytes qbCallTargetSig;
-
- PrettyPrintSig(pCallTargetSig, cCallTargetSig, "", &qbCallTargetSig, pStubImport, NULL);
-
- strNativeSignature.SetUTF8((LPCUTF8)qbCallTargetSig.Ptr());
- }
-
- //
- // Dump IL stub code
- //
- SString strILStubCode;
- strILStubCode.Preallocate(4096); // Preallocate 4K bytes to avoid unnecessary growth
-
- SString codeSizeFormat;
- codeSizeFormat.LoadResource(CCompRC::Optional, IDS_EE_INTEROP_CODE_SIZE_COMMENT);
- strILStubCode.AppendPrintf(W("// %s\t%d (0x%04x)\n"), codeSizeFormat.GetUnicode(), cbCode, cbCode);
- strILStubCode.AppendPrintf(W(".maxstack %d \n"), maxStack);
- strILStubCode.AppendPrintf(W(".locals %s\n"), strLocalSig.GetUnicode());
-
- m_slIL.LogILStub(jitFlags, &strILStubCode);
-
- if (pConvertToHRTryCatchBounds->cbTryLength != 0 && pConvertToHRTryCatchBounds->cbHandlerLength != 0)
- {
- strILStubCode.AppendPrintf(
- W(".try IL_%04x to IL_%04x catch handler IL_%04x to IL_%04x\n"),
- pConvertToHRTryCatchBounds->dwTryBeginOffset,
- pConvertToHRTryCatchBounds->dwTryBeginOffset + pConvertToHRTryCatchBounds->cbTryLength,
- pConvertToHRTryCatchBounds->dwHandlerBeginOffset,
- pConvertToHRTryCatchBounds->dwHandlerBeginOffset + pConvertToHRTryCatchBounds->cbHandlerLength);
- }
-
- if (pCleanupTryFinallyBounds->cbTryLength != 0 && pCleanupTryFinallyBounds->cbHandlerLength != 0)
- {
- strILStubCode.AppendPrintf(
- W(".try IL_%04x to IL_%04x finally handler IL_%04x to IL_%04x\n"),
- pCleanupTryFinallyBounds->dwTryBeginOffset,
- pCleanupTryFinallyBounds->dwTryBeginOffset + pCleanupTryFinallyBounds->cbTryLength,
- pCleanupTryFinallyBounds->dwHandlerBeginOffset,
- pCleanupTryFinallyBounds->dwHandlerBeginOffset + pCleanupTryFinallyBounds->cbHandlerLength);
- }
-
- //
- // Fire the event
- //
- DWORD dwFlags = 0;
- if (m_dwStubFlags & NDIRECTSTUB_FL_REVERSE_INTEROP)
- dwFlags |= ETW_IL_STUB_FLAGS_REVERSE_INTEROP;
-#ifdef FEATURE_COMINTEROP
- if (m_dwStubFlags & NDIRECTSTUB_FL_COM)
- dwFlags |= ETW_IL_STUB_FLAGS_COM_INTEROP;
-#endif // FEATURE_COMINTEROP
- if (m_dwStubFlags & NDIRECTSTUB_FL_NGENEDSTUB)
- dwFlags |= ETW_IL_STUB_FLAGS_NGENED_STUB;
- if (m_dwStubFlags & NDIRECTSTUB_FL_DELEGATE)
- dwFlags |= ETW_IL_STUB_FLAGS_DELEGATE;
- if (m_dwStubFlags & NDIRECTSTUB_FL_CONVSIGASVARARG)
- dwFlags |= ETW_IL_STUB_FLAGS_VARARG;
- if (m_dwStubFlags & NDIRECTSTUB_FL_UNMANAGED_CALLI)
- dwFlags |= ETW_IL_STUB_FLAGS_UNMANAGED_CALLI;
-
- DWORD dwToken = 0;
- if (pTargetMD)
- dwToken = pTargetMD->GetMemberDef();
-
-
- //
- // Truncate string fields. Make sure the whole event is less than 64KB
- //
- TruncateUnicodeString(strNamespaceOrClassName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strNativeSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(stubMethodSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strILStubCode, ETW_IL_STUB_EVENT_CODE_STRING_FIELD_MAXSIZE);
-
- //
- // Fire ETW event
- //
- FireEtwILStubGenerated(
- GetClrInstanceId(), // ClrInstanceId
- uModuleId, // ModuleIdentifier
- (UINT64)pStubMD, // StubMethodIdentifier
- dwFlags, // StubFlags
- dwToken, // ManagedInteropMethodToken
- strNamespaceOrClassName.GetUnicode(), // ManagedInteropMethodNamespace
- strMethodName.GetUnicode(), // ManagedInteropMethodName
- strMethodSignature.GetUnicode(), // ManagedInteropMethodSignature
- strNativeSignature.GetUnicode(), // NativeSignature
- stubMethodSignature.GetUnicode(), // StubMethodSigature
- strILStubCode.GetUnicode() // StubMethodILCode
- );
- } // EtwOnILStubGenerated
-#endif // !FEATURE_CORECLR
#ifdef LOGGING
//---------------------------------------------------------------------------------------
@@ -1790,10 +1614,6 @@ NDirectStubLinker::NDirectStubLinker(
m_dwThreadLocalNum(-1),
m_dwCleanupWorkListLocalNum(-1),
m_dwRetValLocalNum(-1),
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- m_dwFirstCopyCtorCookieLocalNum(-1),
- m_dwLastCopyCtorCookieLocalNum(-1),
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
m_ErrorResID(-1),
m_ErrorParamIdx(-1),
m_iLCIDParamIdx(iLCIDParamIdx),
@@ -2218,46 +2038,6 @@ void NDirectStubLinker::LoadCleanupWorkList(ILCodeStream* pcsEmit)
pcsEmit->EmitLDLOCA(GetCleanupWorkListLocalNum());
}
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
-
-BOOL NDirectStubLinker::IsCopyCtorStubNeeded()
-{
- LIMITED_METHOD_CONTRACT;
- return (m_dwFirstCopyCtorCookieLocalNum != (DWORD)-1);
-}
-
-DWORD NDirectStubLinker::CreateCopyCtorCookie(ILCodeStream* pcsEmit)
-{
- STANDARD_VM_CONTRACT;
-
- MethodTable *pCookieMT = MscorlibBinder::GetClass(CLASS__COPYCTORSTUBCOOKIE);
-
- LocalDesc desc(pCookieMT);
- DWORD dwCookieLocalNum = pcsEmit->NewLocal(desc);
-
- // <dwCookieLocalNum> = new CopyCtorStubCookie()
- pcsEmit->EmitLDLOCA(dwCookieLocalNum);
- pcsEmit->EmitINITOBJ(pcsEmit->GetToken(pCookieMT));
-
- if (m_dwLastCopyCtorCookieLocalNum == (DWORD)-1)
- {
- // this is the first cookie in this stub
- m_dwFirstCopyCtorCookieLocalNum = dwCookieLocalNum;
- }
- else
- {
- // this is not the first cookie - build a linked list
- // <m_dwLastCopyCtorCookieLocalNum>.SetNext(&<dwCookieLocalNum>)
- pcsEmit->EmitLDLOCA(m_dwLastCopyCtorCookieLocalNum);
- pcsEmit->EmitLDLOCA(dwCookieLocalNum);
- pcsEmit->EmitCALL(METHOD__COPYCTORSTUBCOOKIE__SET_NEXT, 2, 0);
- }
-
- m_dwLastCopyCtorCookieLocalNum = dwCookieLocalNum;
- return dwCookieLocalNum;
-}
-
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
void NDirectStubLinker::Begin(DWORD dwStubFlags)
{
@@ -2292,23 +2072,6 @@ void NDirectStubLinker::Begin(DWORD dwStubFlags)
if (SF_IsForwardStub(dwStubFlags))
{
-#ifndef FEATURE_CORECLR // CAS
- // we may need to demand security permission
- if (SF_IsStubWithDemand(dwStubFlags))
- {
- if (SF_IsCOMStub(dwStubFlags) || SF_IsDelegateStub(dwStubFlags))
- {
- // pass NULL NDirectMethodDesc for COM and delegate P/Invoke
- m_pcsSetup->EmitLoadNullPtr();
- }
- else
- {
- // pass the real MD for direct P/Invoke
- EmitLoadStubContext(m_pcsSetup, dwStubFlags);
- }
- m_pcsSetup->EmitCALL(METHOD__STUBHELPERS__DEMAND_PERMISSION, 1, 0);
- }
-#endif // !FEATURE_CORECLR
if (SF_IsStubWithCctorTrigger(dwStubFlags))
{
@@ -2327,7 +2090,7 @@ void NDirectStubLinker::Begin(DWORD dwStubFlags)
if (SF_IsDelegateStub(dwStubFlags))
{
-#if defined(MDA_SUPPORTED) || (defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR))
+#if defined(MDA_SUPPORTED)
// GC was induced (gcUnmanagedToManagedMDA), arguments have been marshaled, and we are about
// to touch the UMEntryThunk and extract the delegate target from it so this is the right time
// to do the collected delegate MDA check.
@@ -2469,38 +2232,6 @@ void NDirectStubLinker::DoNDirect(ILCodeStream *pcsEmit, DWORD dwStubFlags, Meth
STANDARD_VM_CONTRACT;
if (SF_IsForwardStub(dwStubFlags)) // managed-to-native
{
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- // set the copy ctor cookie chain if needed
- if (IsCopyCtorStubNeeded())
- {
- // StubHelpers.SetCopyCtorCookieChain(pStubArg, pUnmngThis, dwStubFlags, &<m_dwFirstCopyCtorCookieLocalNum>)
- if (SF_IsDelegateStub(dwStubFlags))
- {
- // for forward delegate P/Invoke load the target from 'this'
- pcsEmit->EmitLoadThis();
- pcsEmit->EmitLDFLD(pcsEmit->GetToken(MscorlibBinder::GetField(FIELD__DELEGATE__METHOD_PTR_AUX)));
- }
- else
- {
- // otherwise load the secret argument
- EmitLoadStubContext(pcsEmit, dwStubFlags);
- }
-
- if (SF_IsCOMStub(dwStubFlags))
- {
- // for forward COM load the unmanaged interface pointer
- pcsEmit->EmitLDLOC(m_dwTargetInterfacePointerLocalNum);
- }
- else
- {
- // otherwise load 0
- pcsEmit->EmitLoadNullPtr();
- }
- pcsEmit->EmitLDC(dwStubFlags);
- pcsEmit->EmitLDLOCA(m_dwFirstCopyCtorCookieLocalNum);
- pcsEmit->EmitCALL(METHOD__STUBHELPERS__SET_COPY_CTOR_COOKIE_CHAIN, 4, 0);
- }
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
if (SF_IsDelegateStub(dwStubFlags)) // delegate invocation
{
@@ -2529,15 +2260,6 @@ void NDirectStubLinker::DoNDirect(ILCodeStream *pcsEmit, DWORD dwStubFlags, Meth
#ifdef _TARGET_X86_
-#ifndef FEATURE_CORECLR
- if (IsCopyCtorStubNeeded())
- {
- // if we need to call copy ctor(s), we go to the copy ctor stub
- Stub *pCopyCtorStub = NDirect::GetStubForCopyCtor();
- pcsEmit->EmitLDC((DWORD_PTR)pCopyCtorStub->GetEntryPoint());
- }
- else
-#endif // !FEATURE_CORECLR
{
// for managed-to-unmanaged CALLI that requires marshaling, the target is passed
// as the secret argument to the stub by GenericPInvokeCalliHelper (asmhelpers.asm)
@@ -4217,16 +3939,6 @@ static void CreateNDirectStubWorker(StubState* pss,
fMarshalReturnValueFirst = HasRetBuffArg(&msig);
#endif
-#if defined(_TARGET_AMD64_) && defined(_WIN64) && !defined(FEATURE_CORECLR)
- // JIT64 (which is only used on the Windows Desktop CLR) has a problem generating code
- // for the pinvoke ILStubs which do a return using a struct type. Therefore, we
- // change the signature of calli to return void and make the return buffer as first argument.
- // This matches the ABI i.e. return buffer is passed as first arg. So native target will get
- // the return buffer in correct register.
- // Ideally we only want to set it for JIT64 and not ryujit but currently there isn't a fast way
- // to determine that at runtime.
- fMarshalReturnValueFirst = HasRetBuffArg(&msig);
-#endif
}
if (fMarshalReturnValueFirst)
@@ -4388,12 +4100,6 @@ static void CreateNDirectStubWorker(StubState* pss,
COMPlusThrow(kMarshalDirectiveException, IDS_EE_NDIRECT_BADNATL_THISCALL);
}
-#ifndef FEATURE_CORECLR
- if (info.GetMarshalType() == MarshalInfo::MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR)
- {
- fHasCopyCtorArgs = true;
- }
-#endif // !FEATURE_CORECLR
argidx++;
}
@@ -6206,15 +5912,6 @@ VOID NDirectMethodDesc::SetNDirectTarget(LPVOID pTarget)
#ifdef _TARGET_X86_
-#ifndef FEATURE_CORECLR
- if (HasCopyCtorArgs())
- {
- _ASSERTE(pInterceptStub == NULL);
-
- // static stub that gets its arguments in a thread-static field
- pInterceptStub = NDirect::GetStubForCopyCtor();
- }
-#endif // !FEATURE_CORECLR
#ifdef MDA_SUPPORTED
if (!IsQCall() && MDA_GET_ASSISTANT(PInvokeStackImbalance))
@@ -6263,39 +5960,6 @@ VOID NDirectMethodDesc::SetNDirectTarget(LPVOID pTarget)
}
}
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
-
-// Returns a small stub whose purpose is to record current ESP and call code:CopyCtorCallStubWorker
-// to invoke copy constructors and destructors as appropriate. This stub operates on arguments
-// already pushed to the stack by JITted IL stub and must not create a new frame, i.e. it must
-// tail call to the target for it to see the arguments that copy ctors have been called on.
-//
-// As a consequence, the stub doesn't take any extra secret arguments and the description of the
-// ctors/dtors to call is passed "out-of-band" in a thread static field. The worker returns
-// address of the real target (also passed out of band) which enables us to have only one static
-// stub in i386\asmhelpers.asm.
-
-// static
-Stub *NDirect::GetStubForCopyCtor()
-{
- STANDARD_VM_CONTRACT;
-
- static Stub *s_pStub = NULL;
-
- if (s_pStub == NULL)
- {
- Stub *pStub = Stub::NewStub(GetEEFuncEntryPoint(CopyCtorCallStub));
- if (InterlockedCompareExchangeT(&s_pStub, pStub, NULL) != NULL)
- {
- pStub->DecRef();
- }
- }
-
- s_pStub->IncRef();
- return s_pStub;
-}
-
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
BOOL NDirect::IsHostHookEnabled()
@@ -6354,147 +6018,6 @@ EXTERN_C VOID __stdcall PInvokeStackImbalanceWorker(StackImbalanceCookie *pSICoo
}
#endif // _TARGET_X86_ && MDA_SUPPORTED
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
-struct CopyCtorStubCookie // same layout as StubHelpers.CopyCtorStubCookie
-{
- LPVOID m_srcInstancePtr;
- DWORD m_dstStackOffset;
- LPVOID m_ctorPtr; // managed method ptr
- LPVOID m_dtorPtr; // managed method ptr
-
- CopyCtorStubCookie *m_pNext;
-};
-
-struct CopyCtorStubDesc // same layout as StubHelpers.CopyCtorStubDesc
-{
- CopyCtorStubCookie *m_pCookie;
- LPVOID m_pTarget;
-};
-
-// Called by CopyCtorCallStub after we have already transitioned to unmanaged. Invokes copy ctor(s)
-// and dtor(s) using reverse P/Invoke which has some perf impact but provides all the debugging and
-// profiling support. An alternative solution would be CallDescr or some optimized variant of it
-// which would probably result in confusing call stacks.
-EXTERN_C LPVOID __stdcall CopyCtorCallStubWorker(BYTE *pESP)
-{
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_MODE_PREEMPTIVE; // we've already switched to preemptive
-
- CopyCtorStubCookie *pCookie;
- LPVOID pTarget;
- {
- GCX_COOP();
- // get address of the thread-static field
- FieldDesc *pFD = MscorlibBinder::GetField(FIELD__STUBHELPERS__COPY_CTOR_STUB_DESC);
-
- CopyCtorStubDesc *pStubDesc = (CopyCtorStubDesc *)Thread::GetStaticFieldAddress(pFD);
-
- // read the fields in cooperative mode
- pCookie = pStubDesc->m_pCookie;
- pTarget = pStubDesc->m_pTarget;
-
- _ASSERTE(pCookie != NULL && pTarget != NULL);
-
- // make sure we ASSERT/AV reliably if we are called by mistake
- pStubDesc->m_pCookie = NULL;
- pStubDesc->m_pTarget = NULL;
- }
-
- while (pCookie != NULL)
- {
- if (pCookie->m_ctorPtr != NULL)
- {
- // get reverse P/Invoke to the copy ctor (cache on AD)
- MethodDesc *pMD = Entry2MethodDesc((PCODE)pCookie->m_ctorPtr, NULL);
- UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
-
- // GetUMEntryThunk always returns stdcall-able function pointers for ordinary managed methods
- // but the ctor can be a P/Invoke (pre-Whidbey MC++ only)
- typedef void (__stdcall *CtorFnPtr_StdCall) (LPVOID dst, LPVOID src);
- typedef void (__thiscall *CtorFnPtr_ThisCall)(LPVOID dst, LPVOID src);
- typedef void (__cdecl *CtorFnPtr_Cdecl) (LPVOID dst, LPVOID src);
-
- // call the copy ctor using the right calling convention
- UMThunkMarshInfo *pMarshInfo = pUMEntryThunk->GetUMThunkMarshInfo();
- pMarshInfo->RunTimeInit();
-
- switch (pMarshInfo->GetCallingConvention() & pmCallConvMask)
- {
- case pmCallConvStdcall:
- case pmCallConvWinapi:
- {
- CtorFnPtr_StdCall fnPtr = (CtorFnPtr_StdCall)pUMEntryThunk->GetCode();
- fnPtr(pESP + pCookie->m_dstStackOffset, pCookie->m_srcInstancePtr);
- break;
- }
-
- case pmCallConvThiscall:
- {
- CtorFnPtr_ThisCall fnPtr = (CtorFnPtr_ThisCall)pUMEntryThunk->GetCode();
- fnPtr(pESP + pCookie->m_dstStackOffset, pCookie->m_srcInstancePtr);
- break;
- }
-
- default:
- {
- _ASSERTE((pMarshInfo->GetCallingConvention() & pmCallConvMask) == pmCallConvCdecl);
-
- CtorFnPtr_Cdecl fnPtr = (CtorFnPtr_Cdecl)pUMEntryThunk->GetCode();
- fnPtr(pESP + pCookie->m_dstStackOffset, pCookie->m_srcInstancePtr);
- break;
- }
- }
- }
- if (pCookie->m_dtorPtr != NULL)
- {
- // get reverse P/Invoke to the dtor (cache on AD)
- MethodDesc *pMD = Entry2MethodDesc((PCODE)pCookie->m_dtorPtr, NULL);
- UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
-
- // GetUMEntryThunk always returns stdcall-able function pointers for ordinary managed methods
- // but the dtor can be a P/Invoke (pre-Whidbey MC++ only)
- typedef void (__stdcall *DtorFnPtr_StdCall) (LPVOID src);
- typedef void (__thiscall *DtorFnPtr_ThisCall)(LPVOID src);
- typedef void (__cdecl *DtorFnPtr_Cdecl) (LPVOID src);
-
- // call the dtor using the right calling convention
- UMThunkMarshInfo *pMarshInfo = pUMEntryThunk->GetUMThunkMarshInfo();
- pMarshInfo->RunTimeInit();
-
- switch (pMarshInfo->GetCallingConvention() & pmCallConvMask)
- {
- case pmCallConvStdcall:
- case pmCallConvWinapi:
- {
- DtorFnPtr_StdCall fnPtr = (DtorFnPtr_StdCall)pUMEntryThunk->GetCode();
- fnPtr(pCookie->m_srcInstancePtr);
- break;
- }
-
- case pmCallConvThiscall:
- {
- DtorFnPtr_ThisCall fnPtr = (DtorFnPtr_ThisCall)pUMEntryThunk->GetCode();
- fnPtr(pCookie->m_srcInstancePtr);
- break;
- }
-
- default:
- {
- _ASSERTE((pMarshInfo->GetCallingConvention() & pmCallConvMask) == pmCallConvCdecl);
-
- DtorFnPtr_Cdecl fnPtr = (DtorFnPtr_Cdecl)pUMEntryThunk->GetCode();
- fnPtr(pCookie->m_srcInstancePtr);
- break;
- }
- }
- }
- pCookie = pCookie->m_pNext;
- }
-
- return pTarget;
-}
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
// Preserving good error info from DllImport-driven LoadLibrary is tricky because we keep loading from different places
// if earlier loads fail and those later loads obliterate error codes.
@@ -6662,79 +6185,6 @@ static HMODULE LocalLoadLibraryDirectHelper(LPCWSTR name, DWORD flags, LoadLibEr
#define TOLOWER(a) (((a) >= W('A') && (a) <= W('Z')) ? (W('a') + (a - W('A'))) : (a))
#define TOHEX(a) ((a)>=10 ? W('a')+(a)-10 : W('0')+(a))
-#ifndef FEATURE_CORECLR
-/*static*/
-VOID NDirect::CheckUnificationList(NDirectMethodDesc * pMD, DWORD * pDllImportSearchPathFlag, BOOL * pSearchAssemblyDirectory)
-{
- CONTRACTL
- {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- // If neither assembly and method have the attribute, check the unification list.
- Assembly *pAssembly = pMD->GetAssembly();
-
- if (!pAssembly->IsStrongNamed())
- return;
-
- const char * simpleName = pAssembly->GetSimpleName();
-
- StringHashIterator(it, g_arFxPolicy, simpleName);
-
- int pos;
-
- while ((pos = it.GetNext()) >= 0)
- {
- const FrameworkConfig & config = g_arFxPolicy[pos];
-
- FixedSizeString<char> asmName;
-
- config.GetFxAssemblyName(asmName);
-
- if (_stricmp(asmName, simpleName) == 0)
- {
- DWORD cbPublicKey = 0;
- const void *pbPublicKey = NULL;
- pbPublicKey = pAssembly->GetPublicKey(&cbPublicKey);
-
- //
- // StrongNameTokenFromPublicKey is potentially expensive operation. Do it only once we got a match on the simple name.
- //
- StrongNameBufferHolder<BYTE> pbStrongNameToken;
- DWORD cbStrongNameToken;
-
- if (StrongNameTokenFromPublicKey((BYTE*) pbPublicKey,cbPublicKey,&pbStrongNameToken,&cbStrongNameToken))
- {
- BOOL pktIsEqual = TRUE;
-
- LPCWSTR pwzPKT = config.GetPKT();
-
- for (UINT j = 0; j < cbStrongNameToken; j++)
- {
- WCHAR firstChar = TOHEX(pbStrongNameToken[j] / 16);
- WCHAR secondChar = TOHEX(pbStrongNameToken[j] % 16);
-
- if (firstChar != TOLOWER(pwzPKT[j*2]) || secondChar != TOLOWER(pwzPKT[j*2+1]))
- {
- pktIsEqual = FALSE;
- break;
- }
- }
-
- if (pktIsEqual)
- {
- *pDllImportSearchPathFlag = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS;
- *pSearchAssemblyDirectory = TRUE;
- break;
- }
- }
- }
- }
-}
-#endif // !FEATURE_CORECLR
// static
HMODULE NDirect::LoadLibraryFromPath(LPCWSTR libraryPath)
@@ -6878,7 +6328,6 @@ HMODULE NDirect::LoadFromPInvokeAssemblyDirectory(Assembly *pAssembly, LPCWSTR l
return hmod;
}
-#ifdef FEATURE_CORECLR
// Try to load the module from the native DLL search directories
HMODULE NDirect::LoadFromNativeDllSearchDirectories(AppDomain* pDomain, LPCWSTR libName, DWORD flags, LoadLibErrorTracker *pErrorTracker)
{
@@ -6902,7 +6351,6 @@ HMODULE NDirect::LoadFromNativeDllSearchDirectories(AppDomain* pDomain, LPCWSTR
return hmod;
}
-#endif // FEATURE_CORECLR
HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracker * pErrorTracker)
{
@@ -6970,13 +6418,11 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke
}
#endif // FEATURE_CORESYSTEM && !FEATURE_PAL
-#ifdef FEATURE_CORECLR
if (hmod == NULL)
{
// NATIVE_DLL_SEARCH_DIRECTORIES set by host is considered well known path
hmod = LoadFromNativeDllSearchDirectories(pDomain, wszLibName, loadWithAlteredPathFlags, pErrorTracker);
}
-#endif // FEATURE_CORECLR
DWORD dllImportSearchPathFlag = 0;
BOOL searchAssemblyDirectory = TRUE;
@@ -7007,12 +6453,6 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke
}
}
-#ifndef FEATURE_CORECLR
- if (!attributeIsFound)
- {
- CheckUnificationList(pMD, &dllImportSearchPathFlag, &searchAssemblyDirectory);
- }
-#endif
if (!libNameIsRelativePath)
{
@@ -7031,68 +6471,6 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke
Assembly* pAssembly = pMD->GetMethodTable()->GetAssembly();
hmod = LoadFromPInvokeAssemblyDirectory(pAssembly, wszLibName, loadWithAlteredPathFlags | dllImportSearchPathFlag, pErrorTracker);
-#ifndef FEATURE_CORECLR
- if (hmod == NULL)
- {
- // Try to load the DLL alongside the assembly where the PInvoke was
- // declared using the codebase of the assembly. This is required for download
- // and shadow copy scenarios.
- const WCHAR* ptr;
- SString codebase;
- pAssembly->GetCodeBase(codebase);
- DWORD dwCodebaseLength = codebase.GetCount();
-
- // Strip off the protocol
- for (ptr = codebase.GetUnicode(); *ptr && *ptr != W(':'); ptr++);
-
- // If we have a code base then prepend it to the library name
- if (*ptr)
- {
- SString pathFromCodebase;
-
- // After finding the colon move forward until no more forward slashes
- for (ptr++; *ptr && *ptr == W('/'); ptr++);
- if (*ptr)
- {
- // Calculate the number of characters we are interested in
- if (dwCodebaseLength > (DWORD)(ptr - codebase.GetUnicode()) )
- {
- // Back up to the last slash (forward or backwards)
- const WCHAR* tail;
-
- for (tail = codebase.GetUnicode() + (dwCodebaseLength - 1); tail > ptr && *tail != W('/') && *tail != W('\\'); tail--);
-
- if (tail > ptr)
- {
- for (;ptr <= tail; ptr++)
- {
- if (*ptr == W('/'))
- pathFromCodebase.Append(W('\\'));
- else
- pathFromCodebase.Append(*ptr);
- }
- }
- }
- }
-
- pathFromCodebase.Append(wszLibName);
-
- SString path = pAssembly->GetManifestFile()->GetPath();
- SString::Iterator i = path.End();
- if (PEAssembly::FindLastPathSeparator(path, i))
- {
- i++;
- path.Truncate(i);
- path.Append(wszLibName);
- }
-
- if (!pathFromCodebase.EqualsCaseInsensitive(path, PEImage::GetFileSystemLocale()))
- {
- hmod = LocalLoadLibraryHelper(pathFromCodebase, loadWithAlteredPathFlags | dllImportSearchPathFlag, pErrorTracker);
- }
- }
- }
-#endif // !FEATURE_CORECLR
}
}
@@ -7291,25 +6669,6 @@ VOID NDirect::NDirectLink(NDirectMethodDesc *pMD)
}
CONTRACTL_END;
-#if !defined(FEATURE_CORECLR)
- // Generate a table of some well known native dlls
- s_pWellKnownNativeModules = ::new PtrHashMap();
- s_pWellKnownNativeModules->Init(sizeof(wellKnownModules)/sizeof(LPCWSTR), CompareLibNames, TRUE, NULL);
- for (int index = 0; index < sizeof(wellKnownModules)/sizeof(LPCWSTR); index++)
- {
- s_pWellKnownNativeModules->InsertValue((UPTR) HashiString(wellKnownModules[index]), (LPVOID)wellKnownModules[index]);
- }
-
- // Check if the OS supports the new secure LoadLibraryEx flags introduced in KB2533623
- HMODULE hMod = CLRGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- _ASSERTE(hMod != NULL);
-
- if (GetProcAddress(hMod, "AddDllDirectory") != NULL)
- {
- // The AddDllDirectory export was added in KB2533623 together with the new flag support
- s_fSecureLoadLibrarySupported = true;
- }
-#endif // !FEATURE_CORECLR
}
diff --git a/src/vm/dllimport.h b/src/vm/dllimport.h
index a989af35ff..ca046614f0 100644
--- a/src/vm/dllimport.h
+++ b/src/vm/dllimport.h
@@ -80,9 +80,6 @@ public:
static HMODULE LoadLibraryFromPath(LPCWSTR libraryPath);
static HINSTANCE LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracker *pErrorTracker);
-#ifndef FEATURE_CORECLR
- static VOID CheckUnificationList(NDirectMethodDesc * pMD, DWORD * pDllImportSearchPathFlag, BOOL * pSearchAssemblyDirectory);
-#endif // !FEATURE_CORECLR
static VOID NDirectLink(NDirectMethodDesc *pMD);
@@ -121,9 +118,6 @@ public:
inline static ILStubCache* GetILStubCache(NDirectStubParameters* pParams);
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- static Stub* GetStubForCopyCtor();
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
static BOOL IsHostHookEnabled();
@@ -132,9 +126,7 @@ public:
private:
NDirect() {LIMITED_METHOD_CONTRACT;}; // prevent "new"'s on this class
-#ifdef FEATURE_CORECLR
static HMODULE LoadFromNativeDllSearchDirectories(AppDomain* pDomain, LPCWSTR libName, DWORD flags, LoadLibErrorTracker *pErrorTracker);
-#endif
static HMODULE LoadFromPInvokeAssemblyDirectory(Assembly *pAssembly, LPCWSTR libName, DWORD flags, LoadLibErrorTracker *pErrorTracker);
#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER)
@@ -493,9 +485,6 @@ public:
void GetCleanupFinallyOffsets(ILStubEHClause * pClause);
void AdjustTargetStackDeltaForReverseInteropHRESULTSwapping();
void AdjustTargetStackDeltaForExtraParam();
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- DWORD CreateCopyCtorCookie(ILCodeStream* pcsEmit);
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
void SetInteropParamExceptionInfo(UINT resID, UINT paramIdx);
bool HasInteropParamExceptionInfo();
@@ -535,9 +524,6 @@ protected:
void InitCleanupCode();
void InitExceptionCleanupCode();
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- BOOL IsCopyCtorStubNeeded();
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
ILCodeStream* m_pcsSetup;
@@ -569,10 +555,6 @@ protected:
DWORD m_dwCleanupWorkListLocalNum;
DWORD m_dwRetValLocalNum;
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- DWORD m_dwFirstCopyCtorCookieLocalNum; // list head passed to SetCopyCtorCookieChain
- DWORD m_dwLastCopyCtorCookieLocalNum; // used for chaining the cookies into a linked list
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
UINT m_ErrorResID;
UINT m_ErrorParamIdx;
diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp
index 6842accba1..b482dafcbf 100644
--- a/src/vm/domainfile.cpp
+++ b/src/vm/domainfile.cpp
@@ -33,9 +33,6 @@
#include "umthunkhash.h"
#include "peimagelayout.inl"
-#if !defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
-#include "policy.h" // for fusion::util::isanyframeworkassembly
-#endif
#include "winrthelpers.h"
#ifdef FEATURE_PERFMAP
@@ -743,7 +740,6 @@ void DomainFile::VerifyNativeImageDependencies(bool verifyOnly)
if (pDependency->signNativeImage == INVALID_NGEN_SIGNATURE)
continue;
-#ifdef FEATURE_CORECLR // hardbinding
//
// CoreCLR hard binds to mscorlib.dll only. Avoid going through the full load.
@@ -759,51 +755,6 @@ void DomainFile::VerifyNativeImageDependencies(bool verifyOnly)
PEAssembly * pDependencyFile = SystemDomain::SystemFile();
-#else // FEATURE_CORECLR
-
- //
- // Load the manifest file for the given name assembly spec.
- //
-
- AssemblySpec name;
- name.InitializeSpec(pDependency->dwAssemblyRef,
- ((pManifestNativeImage != NULL) ? pManifestNativeImage : pNativeImage)->GetNativeMDImport(),
- GetDomainAssembly());
-
- if (this->GetAppDomain()->IsCompilationDomain())
- {
- //
- // Allow transitive closure of hardbound dependecies to be loaded during ngen.
- //
-
- DomainAssembly * pDependencyAssembly = name.LoadDomainAssembly(FILE_LOAD_FIND_NATIVE_IMAGE);
- pDependencyAssembly->GetFile()->SetSafeToHardBindTo();
- }
-
- DomainAssembly * pDependencyAssembly = NULL;
- {
- // We are about to validate the hard-bound dependencies of the assembly being loaded. The invariant of being hard-bound states
- // that each hard-bound dependency must have its NI image to be valid and available for loading and this is done recursively for each
- // hard-bound dependency.
- //
- // The validity (and presence) of the NI image happens in FILE_LOAD_ALLOCATE stage of assembly load, which is the next stage in assembly loading,
- // and not the current stage (FILE_LOAD_VERIFY_NATIVE_DEPENDENCIES). In FILE_LOAD_ALLOCATE, we do sharing checks, closure validation, redirection policy application, etc
- // before computing if a NI is available and if it is, whether it is valid or not.
- //
- // However, we need to know about validity of NI in the current(and earlier) stage. As a result, we will temporarily set the assembly load limit (defined as the maximum
- // load level till which recursive assembly load can execute) to be FILE_LOAD_ALLOCATE if we have been invoked to validate the NI dependencies for the first time.
- //
- // A valid concern at this point is that we would allow to load a dependency at a load stage higher than its dependent assembly as it could crete cycles. This concern is
- // alleviated since we are doing this override (of the load stage) only for hard-bound dependencies and NGEN is responsible for ensuring that there are no cycles.
- //
- // As a result, once the dependency load returns, we will know for sure if the dependency has a valid NI or not.
- OVERRIDE_LOAD_LEVEL_LIMIT(verifyOnly ? FILE_LOADED : FILE_LOAD_ALLOCATE);
- pDependencyAssembly = name.LoadDomainAssembly(FILE_LOADED);
- }
-
- PEAssembly * pDependencyFile = pDependencyAssembly->GetFile();
-
-#endif // FEATURE_CORECLR
ReleaseHolder<PEImage> pDependencyNativeImage = pDependencyFile->GetNativeImageWithRef();
if (pDependencyNativeImage == NULL)
@@ -1175,52 +1126,9 @@ void DomainFile::AddDependencies()
#ifdef FEATURE_PREJIT
-#ifdef FEATURE_CORECLR // hardbinding
//
// CoreCLR hard binds to mscorlib.dll only. No need to track hardbound dependencies.
//
-#else
- // Add hard bindings as unconditional dependencies
- if (GetFile()->HasNativeImage() && GetCurrentModule()->HasNativeImage() && IsAssembly())
- {
- PEImage *pNativeImage = GetFile()->GetPersistentNativeImage();
- PEImageLayout *pNativeLayout = pNativeImage->GetLoadedLayout();
-
- COUNT_T cDependencies;
- CORCOMPILE_DEPENDENCY *pDependencies = pNativeLayout->GetNativeDependencies(&cDependencies);
- CORCOMPILE_DEPENDENCY *pDependenciesEnd = pDependencies + cDependencies;
-
- while (pDependencies < pDependenciesEnd)
- {
- if (pDependencies->signNativeImage != INVALID_NGEN_SIGNATURE)
- {
-
- //
- // Load the manifest file for the given name assembly spec.
- //
-
- AssemblySpec name;
- name.InitializeSpec(pDependencies->dwAssemblyRef,
- pNativeImage->GetNativeMDImport(),
- GetDomainAssembly());
-
- DomainAssembly *pDependency = name.LoadDomainAssembly(FILE_LOADED);
-
- // Right now we only support hard binding to other manifest modules so we don't
- // need to consider the other module cases
- Module *pModule = pDependency->GetModule();
-
- // Add hard binding as an unconditional active dependency
- STRESS_LOG4(LF_CODESHARING,LL_INFO100,"unconditional dependency %p %p %i %i\n",
- GetFile(),GetCurrentModule(),GetFile()->HasNativeImage(),GetCurrentModule()->HasNativeImage());
- if(!pModule->IsSystem())
- GetCurrentModule()->AddActiveDependency(pModule, TRUE);
- }
-
- pDependencies++;
- }
- }
-#endif // FEATURE_CORECLR
#endif // FEATURE_PREJIT
}
@@ -1315,7 +1223,7 @@ void DomainFile::FinishLoad()
// Are we absolutely required to use a native image?
CheckZapRequired();
-#if defined(FEATURE_CORECLR) && defined(FEATURE_COMINTEROP)
+#if defined(FEATURE_COMINTEROP)
// If this is a winmd file, ensure that the ngen reference namespace is loadable.
// This is necessary as on the phone we don't check ngen image dependencies, and thus we can get in a situation
// where a winmd is loaded as a dependency of an ngen image, but the type used to build cross module references
@@ -1499,12 +1407,10 @@ void DomainFile::Activate()
m_bDisableActivationCheck=TRUE;
pMT->CheckRunClassInitThrowing();
}
-#ifdef FEATURE_CORECLR
if (g_pConfig->VerifyModulesOnLoad())
{
m_pModule->VerifyAllMethods();
}
-#endif //FEATURE_CORECLR
#ifdef _DEBUG
if (g_pConfig->ExpandModulesOnLoad())
{
@@ -2201,13 +2107,11 @@ BOOL DomainAssembly::MissingDependenciesCheckDone()
return m_MissingDependenciesCheckStatus != CMD_Unknown;
}
-#ifdef FEATURE_CORECLR
CMD_State DomainAssembly::CheckMissingDependencies()
{
//CoreCLR simply doesn't share if dependencies are missing
return CMD_NotNeeded;
}
-#endif // FEATURE_CORECLR
#endif // FEATURE_LOADER_OPTIMIZATION
@@ -2305,24 +2209,6 @@ void DomainAssembly::FindNativeImage()
}
#endif // FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS
-#ifndef FEATURE_CORECLR // hardbinding
- // The IsSafeToHardBindTo() check is only for use during the ngen compilation phase. It discards ngen images for
- // assemblies that aren't hard-bound to (as this would cause all such assemblies be loaded eagerly.)
- if (!IsSystem() && this->GetAppDomain()->IsCompilationDomain() && !GetFile()->IsSafeToHardBindTo())
- {
- if (!this->GetAppDomain()->ToCompilationDomain()->IsSafeToHardBindTo(GetFile()))
- {
- GetFile()->SetCannotUseNativeImage();
-
- if (GetFile()->HasNativeImage())
- GetFile()->ClearNativeImage();
-
- return;
- }
-
- GetFile()->SetSafeToHardBindTo();
- }
-#endif
#ifdef FEATURE_FUSION
DomainAssembly * pDomainAssembly = GetDomainAssembly();
@@ -2340,7 +2226,7 @@ void DomainAssembly::FindNativeImage()
if (GetFile()->HasNativeImage())
{
-#if defined(_DEBUG) && defined(FEATURE_CORECLR)
+#if defined(_DEBUG)
if (g_pConfig->ForbidZap(GetSimpleName()))
{
SString sbuf;
@@ -2489,7 +2375,6 @@ void DomainAssembly::FindNativeImage()
}
}
-#if defined(FEATURE_CORECLR)
if (!GetFile()->HasNativeImage())
{
//
@@ -2504,7 +2389,6 @@ void DomainAssembly::FindNativeImage()
GetAppDomain()->CheckForMismatchedNativeImages(&spec, &mvid);
}
-#endif
CheckZapRequired();
}
@@ -2529,65 +2413,6 @@ BOOL DomainAssembly::ShouldLoadDomainNeutralHelper()
#ifdef FEATURE_LOADER_OPTIMIZATION
-#ifndef FEATURE_CORECLR
-
- BOOL fIsShareableHostAssembly = FALSE;
- if (GetFile()->HasHostAssembly())
- {
- IfFailThrow(GetFile()->GetHostAssembly()->IsShareable(&fIsShareableHostAssembly));
- }
-
-#ifdef FEATURE_FUSION
- // Only use domain neutral code for normal assembly loads
- if ((GetFile()->GetFusionAssembly() == NULL) && !fIsShareableHostAssembly)
- {
- return FALSE;
- }
-#endif
-
-#ifdef FEATURE_REFLECTION_ONLY_LOAD
- // Introspection only does not use domain neutral code
- if (IsIntrospectionOnly())
- return FALSE;
-#endif
-
-#ifdef FEATURE_FUSION
- // use domain neutral code only for Load context, as the
- // required eager binding interferes with LoadFrom binding semantics
- if (!GetFile()->IsContextLoad() && !fIsShareableHostAssembly)
- return FALSE;
-#endif
-
- // Check app domain policy...
- if (this->GetAppDomain()->ApplySharePolicy(this))
- {
- if (IsSystem())
- return TRUE;
-
- // if not the default AD, ensure that the closure is filled in
- if (this->GetAppDomain() != SystemDomain::System()->DefaultDomain())
- GetAssemblyBindingClosure(LEVEL_COMPLETE);
-
-
- // Can be domain neutral only if we aren't binding any missing dependencies with
- // the assembly resolve event
- if ((this->GetAppDomain() != SystemDomain::System()->DefaultDomain()) &&
- (CheckMissingDependencies() == CMD_Resolved))
- {
- return FALSE;
- }
-
- // Ensure that all security conditions are met for code sharing
- if (!Security::CanShareAssembly(this))
- {
- return FALSE;
- }
-
- return TRUE;
- }
- return FALSE;
-
-#else // FEATURE_CORECLR
if (IsSystem())
return TRUE;
@@ -2620,7 +2445,6 @@ BOOL DomainAssembly::ShouldLoadDomainNeutralHelper()
return FALSE; // No meaning in doing costly closure walk for CoreCLR.
-#endif // FEATURE_CORECLR
#else // FEATURE_LOADER_OPTIMIZATION
return IsSystem();
@@ -3155,52 +2979,7 @@ void GetTimeStampsForNativeImage(CORCOMPILE_VERSION_INFO * pNativeVersionInfo)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// Do not store runtime timestamps into NGen image for cross-platform NGen determinism
-#else
- // fill in pRuntimeDllInfo
- CORCOMPILE_RUNTIME_DLL_INFO *pRuntimeDllInfo = pNativeVersionInfo->runtimeDllInfo;
-
- for (DWORD index = 0; index < NUM_RUNTIME_DLLS; index++)
- {
-#ifdef CROSSGEN_COMPILE
- SString sFileName(SString::Utf8, CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index));
-
- PEImageHolder pImage;
- if (!GetAppDomain()->ToCompilationDomain()->FindImage(sFileName, MDInternalImport_NoCache, &pImage))
- {
- EEFileLoadException::Throw(sFileName, COR_E_FILENOTFOUND);
- }
-
- PEImageLayoutHolder pLayout(pImage->GetLayout(PEImageLayout::LAYOUT_FLAT,PEImage::LAYOUT_CREATEIFNEEDED));
- pRuntimeDllInfo[index].timeStamp = pLayout->GetTimeDateStamp();
- pRuntimeDllInfo[index].virtualSize = pLayout->GetVirtualSize();
-
-#else // CROSSGEN_COMPILE
-
- HMODULE hMod = CorCompileGetRuntimeDll((CorCompileRuntimeDlls)index);
-
- if (hMod == NULL)
- {
- _ASSERTE((CorCompileRuntimeDlls)index == NGEN_COMPILER_INFO);
-
- LPCWSTR wszDllName = CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index);
- if (FAILED(g_pCLRRuntime->LoadLibrary(wszDllName, &hMod)))
- {
- EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("Unable to load CLR DLL during ngen"));
- }
- }
-
- _ASSERTE(hMod != NULL);
-
- PEDecoder pe(hMod);
-
- pRuntimeDllInfo[index].timeStamp = pe.GetTimeDateStamp();
- pRuntimeDllInfo[index].virtualSize = pe.GetVirtualSize();
-#endif // CROSSGEN_COMPILE
-
- }
-#endif // FEATURE_CORECLR
}
//
@@ -3215,7 +2994,6 @@ void GetNGenCpuInfo(CORINFO_CPU * cpuInfo)
#ifdef _TARGET_X86_
-#ifdef FEATURE_CORECLR
static CORINFO_CPU ngenCpuInfo =
{
(CPU_X86_PENTIUM_PRO << 8), // dwCPUType
@@ -3225,26 +3003,6 @@ void GetNGenCpuInfo(CORINFO_CPU * cpuInfo)
// We always generate P3-compatible code on CoreCLR
*cpuInfo = ngenCpuInfo;
-#else // FEATURE_CORECLR
- static CORINFO_CPU ngenCpuInfo =
- {
- (CPU_X86_PENTIUM_4 << 8), // dwCPUType
- 0x00008001, // dwFeatures
- 0 // dwExtendedFeatures
- };
-
-#ifndef CROSSGEN_COMPILE
- GetSpecificCpuInfo(cpuInfo);
- if (!IsCompatibleCpuInfo(cpuInfo, &ngenCpuInfo))
- {
- // Use the actual cpuInfo if the platform is not compatible
- // with the "recommended" processor. We expect most platforms to be compatible
- return;
- }
-#endif
-
- *cpuInfo = ngenCpuInfo;
-#endif // FEATURE_CORECLR
#else // _TARGET_X86_
cpuInfo->dwCPUType = 0;
@@ -3373,12 +3131,6 @@ void DomainAssembly::GetCurrentVersionInfo(CORCOMPILE_VERSION_INFO *pNativeVersi
pNativeVersionInfo->wConfigFlags |= CORCOMPILE_CONFIG_INSTRUMENTATION_NONE;
}
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
- if (UseRyuJit())
- {
- pNativeVersionInfo->wCodegenFlags |= CORCOMPILE_CODEGEN_USE_RYUJIT;
- }
-#endif
GetTimeStampsForNativeImage(pNativeVersionInfo);
@@ -3449,7 +3201,6 @@ BOOL DomainAssembly::CheckZapDependencyIdentities(PEImage *pNativeImage)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
AssemblySpec spec;
spec.InitializeSpec(this->GetFile());
@@ -3496,7 +3247,6 @@ BOOL DomainAssembly::CheckZapDependencyIdentities(PEImage *pNativeImage)
pDependencies++;
}
-#endif
return TRUE;
}
@@ -3510,82 +3260,7 @@ BOOL DomainAssembly::CheckZapSecurity(PEImage *pNativeImage)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
return TRUE;
-#else
-
- //
- // System libraries are a special case, the security info's always OK.
- //
-
- if (IsSystem())
- return TRUE;
-
-#ifdef FEATURE_NATIVE_IMAGE_GENERATION
- //
- // If we're just loading files as part of PDB generation, we're not executing code,
- // so no need to do security checks
- //
-
- if (IsNgenPDBCompilationProcess())
- return TRUE;
-#endif
-
- ETWOnStartup (SecurityCatchCall_V1, SecurityCatchCallEnd_V1);
-
-#ifdef CROSSGEN_COMPILE
- return TRUE;
-#else
-
-
- GCX_COOP();
-
- BOOL fHostProtectionOK = FALSE;
- BOOL fImageAndDependenciesAreFullTrust = FALSE;
-
- EX_TRY
- {
- // Check the HostProtection settings.
- EApiCategories eRequestedProtectedCategories = GetHostProtectionManager()->GetProtectedCategories();
- if (eRequestedProtectedCategories == eNoChecks)
- fHostProtectionOK = TRUE;
-
- // Due to native code generated for one IL image being more agressively put into another
- // assembly's native image, we're disabling partial trust NGEN images. If the current
- // domain can only have fully trusted assemblies, then we can load this image, or if the current
- // assembly and its closure are all in the GAC we can also use it. Otherwise, we'll conservatively
- // disable the use of this image.
- IApplicationSecurityDescriptor *pAppDomainSecurity = this->GetAppDomain()->GetSecurityDescriptor();
- if (pAppDomainSecurity->IsFullyTrusted() && pAppDomainSecurity->IsHomogeneous())
- {
- // A fully trusted homogenous domain can only have full trust assemblies, therefore this assembly
- // and all its dependencies must be full trust
- fImageAndDependenciesAreFullTrust = TRUE;
- }
- else if (IsClosedInGAC())
- {
- // The domain allows partial trust assemblies to be loaded into it. However, this assembly and
- // all of its dependencies came from the GAC, so we know that they must all be trusted even if
- // other code in this domain is not.
- fImageAndDependenciesAreFullTrust = TRUE;
- }
- else
- {
- // The domain allows partial trust assemblies and we cannot prove that the closure of
- // dependencies of this assembly will all be fully trusted. Conservatively throw away this NGEN
- // image.
- fImageAndDependenciesAreFullTrust = FALSE;
- }
- }
- EX_CATCH
- {
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- return fHostProtectionOK && fImageAndDependenciesAreFullTrust;
-#endif // CROSSGEN_COMPILE
-
-#endif // FEATURE_CORECLR
}
#endif // FEATURE_PREJIT
diff --git a/src/vm/dwbucketmanager.hpp b/src/vm/dwbucketmanager.hpp
index a3aef9b2a8..2e37e1be5e 100644
--- a/src/vm/dwbucketmanager.hpp
+++ b/src/vm/dwbucketmanager.hpp
@@ -887,27 +887,7 @@ void BaseBucketParamsManager::GetPackageMoniker(__out_ecount(maxLength) WCHAR* t
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- bool success = false;
- EX_TRY
- {
- wcsncpy_s(targetParam, maxLength, AppX::GetHeadPackageMoniker(), _TRUNCATE);
- success = true;
- }
- EX_CATCH
- {
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- if (!success)
- {
- // should this ever legitimately fail??
- _ASSERTE(!"failed to get package moniker for watson");
- wcsncpy_s(targetParam, maxLength, W("missing"), _TRUNCATE);
- }
-#else
_ASSERTE(!"AppX support NYI for CoreCLR");
-#endif // FEATURE_CORECLR
}
void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
@@ -920,25 +900,7 @@ void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetPara
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- LPCWSTR pPraid = NULL;
- if (SUCCEEDED(AppX::GetApplicationId(pPraid)))
- {
- _snwprintf_s(targetParam,
- maxLength,
- _TRUNCATE,
- W("praid:%s"),
- pPraid);
- }
- else
- {
- // should this ever legitimately fail??
- _ASSERTE(!"failed to get PRAID for watson");
- wcsncpy_s(targetParam, maxLength, W("missing"), _TRUNCATE);
- }
-#else
_ASSERTE(!"PRAID support NYI for CoreCLR");
-#endif
}
void BaseBucketParamsManager::GetIlRva(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
@@ -1475,11 +1437,6 @@ WatsonBucketType GetWatsonBucketType()
}
CONTRACTL_END;
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
- if (AppX::IsAppXProcess() && !AppX::IsAppXNGen())
- return MoCrash;
- else
-#endif // FEATURE_APPX
#ifdef FEATURE_WINDOWSPHONE
return WinPhoneCrash;
diff --git a/src/vm/dwreport.cpp b/src/vm/dwreport.cpp
index 67a9fb66b2..e119fa7301 100644
--- a/src/vm/dwreport.cpp
+++ b/src/vm/dwreport.cpp
@@ -1484,19 +1484,6 @@ BOOL RunWatson(
{
- #if !defined(FEATURE_CORECLR)
- // Use the version of DW20.exe that lives in the system directory.
- DWORD ret;
-
- if (FAILED(GetCORSystemDirectoryInternaL(watsonAppName)))
- {
- hr = E_FAIL;
- break;
- }
- watsonCommandLine.Set(watsonAppName);
- watsonCommandLine.Append(kWatsonImageNameOnVista);
-
- #else // FEATURE_CORECLR
HKEYHolder hKey;
// Look for key \\HKLM\Software\Microsoft\PCHealth\ErrorReporting\DW\Installed"
DWORD ret = WszRegOpenKeyEx(HKEY_LOCAL_MACHINE,
@@ -1517,7 +1504,6 @@ BOOL RunWatson(
ClrRegReadString(hKey, kWatsonValue, watsonAppName);
- #endif // ! FEATURE_CORECLR
COUNT_T len = watsonCommandLine.GetCount();
WCHAR* buffer = watsonCommandLine.OpenUnicodeBuffer(len);
@@ -1895,14 +1881,6 @@ HRESULT GetManagedBucketParametersForIp(
}
WatsonBucketType bucketType = GetWatsonBucketType();
-#ifndef FEATURE_CORECLR
- if (bucketType == MoCrash)
- {
- MoCrashBucketParamsManager moCrashManager(pGenericModeBlock, tore, currentPC, pThread, pThrowable);
- moCrashManager.PopulateBucketParameters();
- }
- else
-#endif // !FEATURE_CORECLR
{
#ifdef FEATURE_WINDOWSPHONE
_ASSERTE(bucketType == WinPhoneCrash);
@@ -2041,11 +2019,9 @@ HRESULT RetrieveManagedBucketParameters(
#if defined(PRESERVE_WATSON_ACROSS_CONTEXTS)
GenericModeBlock *pBuckets = NULL;
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
if (pThread != NULL)
{
@@ -3082,7 +3058,6 @@ FaultReportResult DoFaultReport( // Was Watson attempted, successful?
Thread *pThread = GetThread();
-#ifdef FEATURE_CORECLR
// If watson isn't available (eg. in Silverlight), then use a simple dialog box instead
if (!IsWatsonEnabled())
{
@@ -3121,7 +3096,6 @@ FaultReportResult DoFaultReport( // Was Watson attempted, successful?
return fri.m_faultReportResult;
}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_UEF_CHAINMANAGER
if (g_pUEFManager && !tore.IsUserBreakpoint())
diff --git a/src/vm/ecall.h b/src/vm/ecall.h
index 768b8a9698..c4fed1ff42 100644
--- a/src/vm/ecall.h
+++ b/src/vm/ecall.h
@@ -16,16 +16,8 @@
class MethodDesc;
-#ifndef FEATURE_CORECLR
-// Every program tends to use only a subset of ~1000 FCalls. Even big apps like
-// VS do not usually hit more than 300. Pick a size of the hashtable that's sufficient
-// for the typical case. It is ok to have some colisions in the rare case. Note that
-// the size of the table should be prime.
-#define FCALL_HASH_SIZE 257
-#else
// CoreCLR defines fewer FCalls so make the hashtable even smaller.
#define FCALL_HASH_SIZE 127
-#endif
typedef DPTR(struct ECHash) PTR_ECHash;
diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h
index 587f6f9132..b427d6311d 100644
--- a/src/vm/ecalllist.h
+++ b/src/vm/ecalllist.h
@@ -112,14 +112,6 @@ FCFuncStart(gDependentHandleFuncs)
FCFuncElement("nSetSecondary", DependentHandle::nSetSecondary)
FCFuncEnd()
-#ifndef FEATURE_CORECLR
-FCFuncStart(gSizedRefHandleFuncs)
- FCFuncElement("CreateSizedRef", SizedRefHandle::Initialize)
- FCFuncElement("FreeSizedRef", SizedRefHandle::Free)
- FCFuncElement("GetTargetOfSizedRef", SizedRefHandle::GetTarget)
- FCFuncElement("GetApproximateSizeOfSizedRef", SizedRefHandle::GetApproximateSize)
-FCFuncEnd()
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_RWLOCK
FCFuncStart(gRWLockFuncs)
@@ -178,11 +170,9 @@ FCFuncStart(gStackBuilderSinkFuncs)
FCFuncEnd()
#endif
-#ifdef FEATURE_CORECLR
FCFuncStart(gSymWrapperCodePunkSafeHandleFuncs)
FCFuncElement("nGetDReleaseTarget", COMPunkSafeHandle::nGetDReleaseTarget)
FCFuncEnd()
-#endif //FEATURE_CORECLR
FCFuncStart(gParseNumbersFuncs)
FCFuncElement("IntToString", ParseNumbers::IntToString)
@@ -191,11 +181,6 @@ FCFuncStart(gParseNumbersFuncs)
FCFuncElement("StringToLong", ParseNumbers::StringToLong)
FCFuncEnd()
-#ifndef FEATURE_CORECLR // FCalls used by System.TimeSpan
-FCFuncStart(gTimeSpanFuncs)
- FCFuncElement("LegacyFormatMode", SystemNative::LegacyFormatMode)
-FCFuncEnd()
-#endif // !FEATURE_CORECLR
FCFuncStart(gObjectFuncs)
FCIntrinsic("GetType", ObjectNative::GetClass, CORINFO_INTRINSIC_Object_GetType)
@@ -267,10 +252,6 @@ FCFuncEnd()
FCFuncStart(gDateTimeFuncs)
FCFuncElement("GetSystemTimeAsFileTime", SystemNative::__GetSystemTimeAsFileTime)
-#ifndef FEATURE_CORECLR
- QCFuncElement("LegacyParseMode", SystemNative::LegacyDateTimeParseMode)
- QCFuncElement("EnableAmPmParseAdjustment", SystemNative::EnableAmPmParseAdjustment)
-#endif
FCFuncEnd()
FCFuncStart(gEnvironmentFuncs)
@@ -282,35 +263,18 @@ FCFuncStart(gEnvironmentFuncs)
FCFuncElement("get_ExitCode", SystemNative::GetExitCode)
FCFuncElement("get_HasShutdownStarted", SystemNative::HasShutdownStarted)
QCFuncElement("GetProcessorCount", SystemNative::GetProcessorCount)
-#ifndef FEATURE_CORECLR
- FCFuncElement("nativeGetEnvironmentVariable", SystemNative::_GetEnvironmentVariable)
- FCFuncElement("GetCompatibilityFlag", SystemNative::_GetCompatibilityFlag)
- QCFuncElement("GetCommandLine", SystemNative::_GetCommandLine)
- FCFuncElement("GetResourceFromDefault", GetResourceFromDefault)
-#endif // !FEATURE_CORECLR
FCFuncElement("GetCommandLineArgsNative", SystemNative::GetCommandLineArgs)
FCFuncElement("get_CurrentProcessorNumber", SystemNative::GetCurrentProcessorNumber)
FCFuncElementSig("FailFast", &gsig_SM_Str_RetVoid, SystemNative::FailFast)
FCFuncElementSig("FailFast", &gsig_SM_Str_Exception_RetVoid, SystemNative::FailFastWithException)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetIsCLRHosted", SystemNative::IsCLRHosted)
- QCFuncElement("TriggerCodeContractFailure", SystemNative::TriggerCodeContractFailure)
-#endif // !FEATURE_CORECLR
FCFuncEnd()
FCFuncStart(gRuntimeEnvironmentFuncs)
FCFuncElement("GetModuleFileName", SystemNative::_GetModuleFileName)
-#ifndef FEATURE_CORECLR
- QCFuncElement("_GetSystemVersion", SystemNative::_GetSystemVersion)
-#endif
FCFuncEnd()
FCFuncStart(gSerializationFuncs)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetEnableUnsafeTypeForwarders", ReflectionSerialization::GetEnableUnsafeTypeForwarders)
- FCFuncElement("nativeGetSafeUninitializedObject", ReflectionSerialization::GetSafeUninitializedObject)
-#endif
FCFuncElement("nativeGetUninitializedObject", ReflectionSerialization::GetUninitializedObject)
FCFuncEnd()
@@ -318,9 +282,6 @@ FCFuncStart(gExceptionFuncs)
FCFuncElement("IsImmutableAgileException", ExceptionNative::IsImmutableAgileException)
FCFuncElement("nIsTransient", ExceptionNative::IsTransient)
FCFuncElement("GetMethodFromStackTrace", SystemNative::GetMethodFromStackTrace)
-#ifndef FEATURE_CORECLR
- FCFuncElement("StripFileInfo", ExceptionNative::StripFileInfo)
-#endif
QCFuncElement("GetMessageFromNativeResources", ExceptionNative::GetMessageFromNativeResources)
#if defined(FEATURE_EXCEPTIONDISPATCHINFO)
FCFuncElement("PrepareForForeignExceptionRaise", ExceptionNative::PrepareForForeignExceptionRaise)
@@ -453,10 +414,6 @@ FCFuncStart(gCOMTypeHandleFuncs)
FCFuncElement("Allocate", RuntimeTypeHandle::Allocate) //for A.CI
FCFuncElement("CompareCanonicalHandles", RuntimeTypeHandle::CompareCanonicalHandles)
FCIntrinsic("GetValueInternal", RuntimeTypeHandle::GetValueInternal, CORINFO_INTRINSIC_RTH_GetValueInternal)
-#ifndef FEATURE_CORECLR
- FCFuncElement("IsEquivalentTo", RuntimeTypeHandle::IsEquivalentTo)
- FCFuncElement("IsEquivalentType", RuntimeTypeHandle::IsEquivalentType)
-#endif // FEATURE_CORECLR
FCFuncEnd()
FCFuncStart(gMetaDataImport)
@@ -520,11 +477,6 @@ FCFuncStart(gRuntimeMethodHandle)
FCFuncElement("GetMethodFromCanonical", RuntimeMethodHandle::GetMethodFromCanonical)
FCFuncElement("IsDynamicMethod", RuntimeMethodHandle::IsDynamicMethod)
FCFuncElement("GetMethodBody", RuntimeMethodHandle::GetMethodBody)
-#ifndef FEATURE_CORECLR
- FCFuncElement("_IsTokenSecurityTransparent", RuntimeMethodHandle::IsTokenSecurityTransparent)
- QCFuncElement("_IsSecurityCritical", RuntimeMethodHandle::IsSecurityCritical)
- QCFuncElement("_IsSecuritySafeCritical", RuntimeMethodHandle::IsSecuritySafeCritical)
-#endif // FEATURE_CORECLR
QCFuncElement("_IsSecurityTransparent", RuntimeMethodHandle::IsSecurityTransparent)
FCFuncElement("CheckLinktimeDemands", RuntimeMethodHandle::CheckLinktimeDemands)
QCFuncElement("IsCAVisibleFromDecoratedType", RuntimeMethodHandle::IsCAVisibleFromDecoratedType)
@@ -533,10 +485,6 @@ FCFuncStart(gRuntimeMethodHandle)
FCFuncElement("GetResolver", RuntimeMethodHandle::GetResolver)
FCFuncElement("GetLoaderAllocator", RuntimeMethodHandle::GetLoaderAllocator)
FCFuncElement("GetSpecialSecurityFlags", ReflectionInvocation::GetSpecialSecurityFlags)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetCallerType", RuntimeMethodHandle::GetCallerType)
- FCFuncElement("PerformSecurityCheck", ReflectionInvocation::PerformSecurityCheck)
-#endif // FEATURE_CORECLR
FCFuncEnd()
FCFuncStart(gCOMDefaultBinderFuncs)
@@ -596,9 +544,6 @@ FCFuncStart(gCOMModuleHandleFuncs)
QCFuncElement("ResolveMethod", ModuleHandle::ResolveMethod)
QCFuncElement("_ContainsPropertyMatchingHash", ModuleHandle::ContainsPropertyMatchingHash)
QCFuncElement("ResolveField", ModuleHandle::ResolveField)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetAssembly", ModuleHandle::GetAssembly)
-#endif // FEATURE_CORECLR
QCFuncElement("GetPEKind", ModuleHandle::GetPEKind)
FCFuncElement("GetMDStreamVersion", ModuleHandle::GetMDStreamVersion)
FCFuncEnd()
@@ -634,9 +579,6 @@ FCFuncStart(gCOMClassWriter)
QCFuncElement("SetParamInfo", COMDynamicWrite::SetParamInfo)
QCFuncElement("SetConstantValue", COMDynamicWrite::SetConstantValue)
QCFuncElement("DefineCustomAttribute", COMDynamicWrite::DefineCustomAttribute)
-#ifndef FEATURE_CORECLR
- QCFuncElement("AddDeclarativeSecurity", COMDynamicWrite::AddDeclarativeSecurity)
-#endif // FEATURE_CORECLR
FCFuncEnd()
#ifdef FEATURE_METHOD_RENTAL
@@ -668,12 +610,6 @@ FCFuncStart(gAppDomainSetupFuncs)
FCFuncEnd()
#endif // FEATURE_FUSION
-#ifndef FEATURE_CORECLR
-FCFuncStart(gWindowsRuntimeContextFuncs)
- QCFuncElement("CreateDesignerContext", AppDomainNative::CreateDesignerContext)
- QCFuncElement("SetCurrentContext", AppDomainNative::SetCurrentDesignerContext)
-FCFuncEnd()
-#endif // FEATURE_CORECLR
FCFuncStart(gAppDomainFuncs)
#ifdef FEATURE_REMOTING
@@ -699,11 +635,6 @@ FCFuncStart(gAppDomainFuncs)
QCFuncElement("GetAppDomainManagerType", AppDomainNative::GetAppDomainManagerType)
QCFuncElement("SetAppDomainManagerType", AppDomainNative::SetAppDomainManagerType)
FCFuncElement("nGetFriendlyName", AppDomainNative::GetFriendlyName)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetSecurityDescriptor", AppDomainNative::GetSecurityDescriptor)
- FCFuncElement("nIsDefaultAppDomainForEvidence", AppDomainNative::IsDefaultAppDomainForEvidence)
- FCFuncElement("nGetAssemblies", AppDomainNative::GetAssemblies)
-#endif
QCFuncElement("SetSecurityHomogeneousFlag", AppDomainNative::SetSecurityHomogeneousFlag)
QCFuncElement("SetupDomainSecurity", AppDomainNative::SetupDomainSecurity)
FCFuncElement("nSetupFriendlyName", AppDomainNative::SetupFriendlyName)
@@ -725,10 +656,8 @@ FCFuncStart(gAppDomainFuncs)
FCFuncElement("IsDomainIdValid", AppDomainNative::IsDomainIdValid)
FCFuncElement("nApplyPolicy", AppDomainNative::nApplyPolicy)
#endif // FEATURE_REMOTING
-#ifdef FEATURE_CORECLR
QCFuncElement("nSetupBindingPaths", AppDomainNative::SetupBindingPaths)
QCFuncElement("nSetNativeDllSearchDirectories", AppDomainNative::SetNativeDllSearchDirectories)
-#endif
FCFuncElement("IsFinalizingForUnload", AppDomainNative::IsFinalizingForUnload)
FCFuncElement("PublishAnonymouslyHostedDynamicMethodsAssembly", AppDomainNative::PublishAnonymouslyHostedDynamicMethodsAssembly)
#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
@@ -742,12 +671,6 @@ FCFuncStart(gAppDomainFuncs)
#endif //FEATURE_APPDOMAIN_RESOURCE_MONITORING
FCFuncEnd()
-#if defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
-FCFuncStart(gProfileOptimizationFuncs)
- QCFuncElement("InternalSetProfileRoot", MultiCoreJITNative::InternalSetProfileRoot)
- QCFuncElement("InternalStartProfile", MultiCoreJITNative::InternalStartProfile)
-FCFuncEnd()
-#endif // defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
FCFuncStart(gUtf8String)
FCFuncElement("EqualsCaseSensitive", Utf8String::EqualsCaseSensitive)
@@ -799,26 +722,13 @@ FCFuncStart(gAssemblyFuncs)
QCFuncElement("GetHashAlgorithm", AssemblyNative::GetHashAlgorithm)
QCFuncElement("GetLocale", AssemblyNative::GetLocale)
QCFuncElement("GetPublicKey", AssemblyNative::GetPublicKey)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetSecurityRuleSet", AssemblyNative::GetSecurityRuleSet)
-#endif // !FEATURE_CORECLR
QCFuncElement("GetSimpleName", AssemblyNative::GetSimpleName)
QCFuncElement("GetVersion", AssemblyNative::GetVersion)
FCFuncElement("FCallIsDynamic", AssemblyNative::IsDynamic)
FCFuncElement("_nLoad", AssemblyNative::Load)
-#ifndef FEATURE_CORECLR
- FCFuncElement("IsFrameworkAssembly", AssemblyNative::IsFrameworkAssembly)
- FCFuncElement("IsNewPortableAssembly", AssemblyNative::IsNewPortableAssembly)
-#endif
FCFuncElement("nLoadImage", AssemblyNative::LoadImage)
-#ifndef FEATURE_CORECLR
- QCFuncElement("LoadModule", AssemblyNative::LoadModule)
-#endif // FEATURE_CORECLR
QCFuncElement("GetType", AssemblyNative::GetType)
QCFuncElement("GetManifestResourceInfo", AssemblyNative::GetManifestResourceInfo)
-#ifndef FEATURE_CORECLR
- QCFuncElement("UseRelativeBindForSatellites", AssemblyNative::UseRelativeBindForSatellites)
-#endif
QCFuncElement("GetModules", AssemblyNative::GetModules)
QCFuncElement("GetModule", AssemblyNative::GetModule)
FCFuncElement("GetReferencedAssemblies", AssemblyNative::GetReferencedAssemblies)
@@ -827,22 +737,15 @@ FCFuncStart(gAssemblyFuncs)
QCFuncElement("GetEntryPoint", AssemblyNative::GetEntryPoint)
QCFuncElement("IsAllSecurityTransparent", AssemblyNative::IsAllSecurityTransparent)
QCFuncElement("IsAllSecurityCritical", AssemblyNative::IsAllSecurityCritical)
-#ifndef FEATURE_CORECLR
- QCFuncElement("IsAllSecuritySafeCritical", AssemblyNative::IsAllSecuritySafeCritical)
- QCFuncElement("IsAllPublicAreaSecuritySafeCritical", AssemblyNative::IsAllPublicAreaSecuritySafeCritical)
- QCFuncElement("GetGrantSet", AssemblyNative::GetGrantSet)
-#endif // !FEATURE_CORECLR
QCFuncElement("GetImageRuntimeVersion", AssemblyNative::GetImageRuntimeVersion)
FCFuncElement("IsReflectionOnly", AssemblyNative::IsReflectionOnly)
FCFuncElement("GetManifestModule", AssemblyHandle::GetManifestModule)
FCFuncElement("GetToken", AssemblyHandle::GetToken)
FCFuncEnd()
-#ifdef FEATURE_CORECLR
FCFuncStart(gAssemblyExtensionsFuncs)
QCFuncElement("InternalTryGetRawMetadata", AssemblyNative::InternalTryGetRawMetadata)
FCFuncEnd()
-#endif
#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER)
FCFuncStart(gAssemblyLoadContextFuncs)
@@ -865,9 +768,6 @@ FCFuncStart(gAssemblyNameFuncs)
FCFuncElement("nInit", AssemblyNameNative::Init)
FCFuncElement("nToString", AssemblyNameNative::ToString)
FCFuncElement("nGetPublicKeyToken", AssemblyNameNative::GetPublicKeyToken)
-#ifndef FEATURE_CORECLR
- FCFuncElement("EscapeCodeBase", AssemblyNameNative::EscapeCodeBase)
-#endif // !FEATURE_CORECLR
FCFuncElement("ReferenceMatchesDefinitionInternal", AssemblyNameNative::ReferenceMatchesDefinition)
FCFuncElement("nGetFileInformation", AssemblyNameNative::GetFileInformation)
FCFuncEnd()
@@ -879,21 +779,6 @@ FCFuncEnd()
FCFuncStart(gAssemblyBuilderFuncs)
FCFuncElement("nCreateDynamicAssembly", AppDomainNative::CreateDynamicAssembly)
FCFuncElement("GetInMemoryAssemblyModule", AssemblyNative::GetInMemoryAssemblyModule)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetOnDiskAssemblyModule", AssemblyNative::GetOnDiskAssemblyModule)
-#ifdef FEATURE_MULTIMODULE_ASSEMBLIES
- QCFuncElement("DefineDynamicModule", COMModule::DefineDynamicModule)
-#endif // FEATURE_MULTIMODULE_ASSEMBLIES
- QCFuncElement("PrepareForSavingManifestToDisk", AssemblyNative::PrepareForSavingManifestToDisk)
- QCFuncElement("SaveManifestToDisk", AssemblyNative::SaveManifestToDisk)
- QCFuncElement("AddFile", AssemblyNative::AddFile)
- QCFuncElement("SetFileHashValue", AssemblyNative::SetFileHashValue)
- QCFuncElement("AddStandAloneResource", AssemblyNative::AddStandAloneResource)
- QCFuncElement("AddExportedTypeOnDisk", AssemblyNative::AddExportedTypeOnDisk)
- QCFuncElement("AddExportedTypeInMemory", AssemblyNative::AddExportedTypeInMemory)
- QCFuncElement("AddDeclarativeSecurity", AssemblyNative::AddDeclarativeSecurity)
- QCFuncElement("CreateVersionInfoResource", AssemblyNative::CreateVersionInfoResource)
-#endif // !FEATURE_CORECLR
FCFuncEnd()
#ifdef MDA_SUPPORTED
@@ -997,10 +882,6 @@ FCFuncEnd()
FCFuncStart(gThreadFuncs)
FCDynamic("InternalGetCurrentThread", CORINFO_INTRINSIC_Illegal, ECall::InternalGetCurrentThread)
FCFuncElement("StartInternal", ThreadNative::Start)
-#ifndef FEATURE_CORECLR
- FCFuncElement("SuspendInternal", ThreadNative::Suspend)
- FCFuncElement("ResumeInternal", ThreadNative::Resume)
-#endif
#ifdef FEATURE_LEAK_CULTURE_INFO
FCFuncElement("nativeGetSafeCulture", ThreadNative::nativeGetSafeCulture)
#else
@@ -1019,16 +900,6 @@ FCFuncStart(gThreadFuncs)
FCFuncElement("InternalCrossContextCallback", ThreadNative::InternalCrossContextCallback)
#endif
QCFuncElement("InformThreadNameChange", ThreadNative::InformThreadNameChange)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetProcessDefaultStackSize", ThreadNative::GetProcessDefaultStackSize)
- FCFuncElement("BeginCriticalRegion", ThreadNative::BeginCriticalRegion)
- FCFuncElement("EndCriticalRegion", ThreadNative::EndCriticalRegion)
- FCFuncElement("BeginThreadAffinity", ThreadNative::BeginThreadAffinity)
- FCFuncElement("EndThreadAffinity", ThreadNative::EndThreadAffinity)
-#endif // FEATURE_CORECLR
-#ifndef FEATURE_CORECLR
- FCFuncElement("ResetAbortNative", ThreadNative::ResetAbort)
-#endif // FEATURE_CORECLR
FCFuncElement("SpinWaitInternal", ThreadNative::SpinWait)
QCFuncElement("YieldInternal", ThreadNative::YieldThread)
FCIntrinsic("GetCurrentThreadNative", ThreadNative::GetCurrentThread, CORINFO_INTRINSIC_GetCurrentManagedThread)
@@ -1041,11 +912,6 @@ FCFuncStart(gThreadFuncs)
FCFuncElement("StartupSetApartmentStateInternal", ThreadNative::StartupSetApartmentState)
#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
FCIntrinsic("MemoryBarrier", ThreadNative::FCMemoryBarrier, CORINFO_INTRINSIC_MemoryBarrier)
-#ifndef FEATURE_CORECLR // coreclr does not support abort reason
- FCFuncElement("SetAbortReason", ThreadNative::SetAbortReason)
- FCFuncElement("GetAbortReason", ThreadNative::GetAbortReason)
- FCFuncElement("ClearAbortReason", ThreadNative::ClearAbortReason)
-#endif
FCFuncEnd()
FCFuncStart(gThreadPoolFuncs)
@@ -1093,9 +959,6 @@ FCFuncStart(gNumberFuncs)
FCFuncElement("FormatInt64", COMNumber::FormatInt64)
FCFuncElement("FormatUInt64", COMNumber::FormatUInt64)
FCFuncElement("FormatSingle", COMNumber::FormatSingle)
-#if !defined(FEATURE_CORECLR)
- FCFuncElement("FormatNumberBuffer", COMNumber::FormatNumberBuffer)
-#endif // !FEATURE_CORECLR
FCFuncElement("NumberBufferToDecimal", COMNumber::NumberBufferToDecimal)
FCFuncElement("NumberBufferToDouble", COMNumber::NumberBufferToDouble)
FCFuncEnd()
@@ -1138,12 +1001,6 @@ FCFuncStart(gCurrencyFuncs)
FCFuncElement("FCallToDecimal", COMCurrency::DoToDecimal)
FCFuncEnd()
-#ifndef FEATURE_CORECLR
-FCFuncStart(gCLRConfigFuncs)
- FCFuncElement("CheckLegacyManagedDeflateStream", SystemNative::CheckLegacyManagedDeflateStream)
- FCFuncElement("CheckThrowUnobservedTaskExceptions", SystemNative::CheckThrowUnobservedTaskExceptions)
-FCFuncEnd()
-#endif // ifndef FEATURE_CORECLR
#if !defined(FEATURE_COREFX_GLOBALIZATION)
FCFuncStart(gCompareInfoFuncs)
@@ -1153,9 +1010,6 @@ FCFuncStart(gCompareInfoFuncs)
QCFuncElement("NativeInternalInitSortHandle", COMNlsInfo::InternalInitSortHandle)
QCFuncElement("InternalIsSortable", COMNlsInfo::InternalIsSortable)
QCFuncElement("InternalGetSortKey", COMNlsInfo::InternalGetSortKey)
-#ifndef FEATURE_CORECLR
- QCFuncElement("InternalGetSortVersion", COMNlsInfo::InternalGetSortVersion)
-#endif
QCFuncElement("InternalGetNlsVersionEx", COMNlsInfo::InternalGetNlsVersionEx)
FCFuncEnd()
@@ -1190,9 +1044,7 @@ FCFuncStart(gCultureInfoFuncs)
QCFuncElement("InternalGetUserDefaultUILanguage", COMNlsInfo::InternalGetUserDefaultUILanguage)
QCFuncElement("InternalGetSystemDefaultUILanguage", COMNlsInfo::InternalGetSystemDefaultUILanguage)
// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#ifdef FEATURE_CORECLR
FCFuncElement("nativeGetResourceFallbackArray", COMNlsInfo::nativeGetResourceFallbackArray)
-#endif
FCFuncEnd()
FCFuncStart(gTextInfoFuncs)
@@ -1286,13 +1138,6 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("UnsafeAddrOfPinnedArrayElement", MarshalNative::FCUnsafeAddrOfPinnedArrayElement)
FCFuncElement("GetExceptionCode", ExceptionNative::GetExceptionCode)
QCFuncElement("GetHINSTANCE", COMModule::GetHINSTANCE)
-#ifndef FEATURE_CORECLR
- QCFuncElement("InternalNumParamBytes", MarshalNative::NumParamBytes)
- FCFuncElement("GetExceptionPointers", ExceptionNative::GetExceptionPointers)
- FCFuncElement("GetUnmanagedThunkForManagedMethodPtr", MarshalNative::GetUnmanagedThunkForManagedMethodPtr)
- FCFuncElement("GetManagedThunkForUnmanagedMethodPtr", MarshalNative::GetManagedThunkForUnmanagedMethodPtr)
- FCFuncElement("InternalGetThreadFromFiberCookie", MarshalNative::GetThreadFromFiberCookie)
-#endif
FCFuncElement("OffsetOfHelper", MarshalNative::OffsetOfHelper)
FCFuncElement("SizeOfType", SafeBuffer::SizeOfType)
@@ -1328,9 +1173,6 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("GetNativeActivationFactory", MarshalNative::GetNativeActivationFactory)
FCFuncElement("GetIUnknownForObjectNative", MarshalNative::GetIUnknownForObjectNative)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetIDispatchForObjectNative", MarshalNative::GetIDispatchForObjectNative)
-#endif // FEATURE_CORECLR
FCFuncElement("GetComInterfaceForObjectNative", MarshalNative::GetComInterfaceForObjectNative)
FCFuncElement("InternalReleaseComObject", MarshalNative::ReleaseComObject)
FCFuncElement("Release", MarshalNative::Release)
@@ -1338,26 +1180,6 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("GetTypedObjectForIUnknown", MarshalNative::GetTypedObjectForIUnknown)
FCFuncElement("ChangeWrapperHandleStrength", MarshalNative::ChangeWrapperHandleStrength)
FCFuncElement("CleanupUnusedObjectsInCurrentContext", MarshalNative::CleanupUnusedObjectsInCurrentContext)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetLoadedTypeForGUID", MarshalNative::GetLoadedTypeForGUID)
- FCFuncElement("GetITypeInfoForType", MarshalNative::GetITypeInfoForType)
- FCFuncElement("IsTypeVisibleFromCom", MarshalNative::IsTypeVisibleFromCom)
- FCFuncElement("FCallGenerateGuidForType", MarshalNative::DoGenerateGuidForType)
- FCFuncElement("FCallGetTypeLibGuid", MarshalNative::DoGetTypeLibGuid)
- FCFuncElement("GetTypeLibLcid", MarshalNative::GetTypeLibLcid)
- FCFuncElement("GetTypeLibVersion", MarshalNative::GetTypeLibVersion)
- FCFuncElement("FCallGetTypeInfoGuid", MarshalNative::DoGetTypeInfoGuid)
- FCFuncElement("FCallGetTypeLibGuidForAssembly", MarshalNative::DoGetTypeLibGuidForAssembly)
- FCFuncElement("_GetTypeLibVersionForAssembly", MarshalNative::GetTypeLibVersionForAssembly)
- FCFuncElement("GetEndComSlot", MarshalNative::GetEndComSlot)
- FCFuncElement("GetMethodInfoForComSlot", MarshalNative::GetMethodInfoForComSlot)
- FCFuncElement("InternalGetComSlotForMethodInfo", MarshalNative::GetComSlotForMethodInfo)
- FCFuncElement("InternalSwitchCCW", MarshalNative::SwitchCCW)
- FCFuncElement("InternalWrapIUnknownWithComObject", MarshalNative::WrapIUnknownWithComObject)
- QCFuncElement("_GetInspectableIids", MarshalNative::GetInspectableIIDs)
- QCFuncElement("_GetCachedWinRTTypes", MarshalNative::GetCachedWinRTTypes)
- QCFuncElement("_GetCachedWinRTTypeByIid", MarshalNative::GetCachedWinRTTypeByIID)
-#endif // FEATURE_CORECLR
#endif // FEATURE_COMINTEROP
FCFuncEnd()
@@ -1367,11 +1189,6 @@ FCFuncEnd()
#ifdef FEATURE_COMINTEROP
-#ifndef FEATURE_CORECLR
-FCFuncStart(gExtensibleClassFactoryFuncs)
- FCFuncElement("RegisterObjectCreationCallback", RegisterObjectCreationCallback)
-FCFuncEnd()
-#endif
#ifdef FEATURE_COMINTEROP_TLB_SUPPORT
@@ -1458,13 +1275,7 @@ FCFuncStart(gCompilerFuncs)
FCIntrinsic("InitializeArray", ArrayNative::InitializeArray, CORINFO_INTRINSIC_InitializeArray)
FCFuncElement("_RunClassConstructor", ReflectionInvocation::RunClassConstructor)
FCFuncElement("_RunModuleConstructor", ReflectionInvocation::RunModuleConstructor)
-#ifndef FEATURE_CORECLR
- FCFuncElement("_PrepareMethod", ReflectionInvocation::PrepareMethod)
-#endif // !FEATURE_CORECLR
QCFuncElement("_CompileMethod", ReflectionInvocation::CompileMethod)
-#ifndef FEATURE_CORECLR
- FCFuncElement("PrepareDelegate", ReflectionInvocation::PrepareDelegate)
-#endif // !FEATURE_CORECLR
FCFuncElement("PrepareContractedDelegate", ReflectionInvocation::PrepareContractedDelegate)
FCFuncElement("ProbeForSufficientStack", ReflectionInvocation::ProbeForSufficientStack)
FCFuncElement("ExecuteCodeWithGuaranteedCleanup", ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup)
@@ -1562,20 +1373,12 @@ FCFuncStart(gMngdRefCustomMarshalerFuncs)
FCFuncEnd()
FCFuncStart(gStubHelperFuncs)
-#ifndef FEATURE_CORECLR
-#ifndef _WIN64
- FCFuncElement("GetFinalStubTarget", StubHelpers::GetFinalStubTarget)
-#endif // !_WIN64
- FCFuncElement("DemandPermission", StubHelpers::DemandPermission)
-#endif // !FEATURE_CORECLR
FCFuncElement("IsQCall", StubHelpers::IsQCall)
FCFuncElement("InitDeclaringType", StubHelpers::InitDeclaringType)
FCIntrinsic("GetNDirectTarget", StubHelpers::GetNDirectTarget, CORINFO_INTRINSIC_StubHelpers_GetNDirectTarget)
FCFuncElement("GetDelegateTarget", StubHelpers::GetDelegateTarget)
FCFuncElement("SetLastError", StubHelpers::SetLastError)
-#ifdef FEATURE_CORECLR
FCFuncElement("ClearLastError", StubHelpers::ClearLastError)
-#endif
FCFuncElement("ThrowInteropParamException", StubHelpers::ThrowInteropParamException)
FCFuncElement("InternalGetHRExceptionObject", StubHelpers::GetHRExceptionObject)
#ifdef FEATURE_COMINTEROP
@@ -1645,11 +1448,6 @@ FCFuncStart(gGCHandleFuncs)
FCFuncElement("InternalCheckDomain", MarshalNative::GCHandleInternalCheckDomain)
FCFuncEnd()
-#ifndef FEATURE_CORECLR
-FCFuncStart(gConsoleFuncs)
- QCFuncElement("GetTitleNative", ConsoleNative::GetTitle)
-FCFuncEnd()
-#endif // ifndef FEATURE_CORECLR
FCFuncStart(gVersioningHelperFuncs)
FCFuncElement("GetRuntimeId", GetRuntimeId_Wrapper)
@@ -1750,9 +1548,7 @@ FCClassElement("Array", "System", gArrayFuncs)
FCClassElement("ArrayWithOffset", "System.Runtime.InteropServices", gArrayWithOffsetFuncs)
FCClassElement("AssemblyBuilder", "System.Reflection.Emit", gAssemblyBuilderFuncs)
-#ifdef FEATURE_CORECLR
FCClassElement("AssemblyExtensions", "System.Reflection.Metadata", gAssemblyExtensionsFuncs)
-#endif
#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER)
FCClassElement("AssemblyLoadContext", "System.Runtime.Loader", gAssemblyLoadContextFuncs)
@@ -1762,22 +1558,11 @@ FCClassElement("AssemblyName", "System.Reflection", gAssemblyNameFuncs)
FCClassElement("Assert", "System.Diagnostics", gDiagnosticsAssert)
FCClassElement("BCLDebug", "System", gBCLDebugFuncs)
FCClassElement("Buffer", "System", gBufferFuncs)
-#ifndef FEATURE_CORECLR
-// Since the 2nd letter of the classname is capital, we need to sort this before all class names
-// that start with Cx where x is any small letter (strcmp is used for verification).
-FCClassElement("CLRConfig", "System", gCLRConfigFuncs)
-#endif // FEATURE_CORECLR
#if !defined(FEATURE_COREFX_GLOBALIZATION)
FCClassElement("CalendarData", "System.Globalization", gCalendarDataFuncs)
#endif // !defined(FEATURE_COREFX_GLOBALIZATION)
-#ifndef FEATURE_CORECLR
-FCClassElement("ChannelServices", "System.Runtime.Remoting.Channels", gChannelServicesFuncs)
-#endif // FEATURE_CORECLR
FCClassElement("CompareInfo", "System.Globalization", gCompareInfoFuncs)
FCClassElement("CompatibilitySwitch", "System.Runtime.Versioning", gCompatibilitySwitchFuncs)
-#ifndef FEATURE_CORECLR
-FCClassElement("Console", "System", gConsoleFuncs)
-#endif // ifndef FEATURE_CORECLR
#ifdef FEATURE_REMOTING
FCClassElement("Context", "System.Runtime.Remoting.Contexts", gContextFuncs)
#endif
@@ -1805,9 +1590,6 @@ FCClassElement("Environment", "System", gEnvironmentFuncs)
FCClassElement("EventArgsMarshaler", "System.StubHelpers", gEventArgsMarshalerFuncs)
#endif // FEATURE_COMINTEROP
FCClassElement("Exception", "System", gExceptionFuncs)
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-FCClassElement("ExtensibleClassFactory", "System.Runtime.InteropServices", gExtensibleClassFactoryFuncs)
-#endif
FCClassElement("FileLoadException", "System.IO", gFileLoadExceptionFuncs)
FCClassElement("FormatterServices", "System.Runtime.Serialization", gSerializationFuncs)
FCClassElement("GC", "System", gGCInterfaceFuncs)
@@ -1871,20 +1653,9 @@ FCClassElement("ObjectMarshaler", "System.StubHelpers", gObjectMarshalerFuncs)
#endif
FCClassElement("OverlappedData", "System.Threading", gOverlappedFuncs)
FCClassElement("ParseNumbers", "System", gParseNumbersFuncs)
-#ifndef FEATURE_CORECLR
-FCClassElement("PasswordDeriveBytes", "System.Security.Cryptography", gPasswordDeriveBytesFuncs)
-#endif
-#if defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
-FCClassElement("ProfileOptimization", "System.Runtime", gProfileOptimizationFuncs)
-#endif // defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
-#ifdef FEATURE_CORECLR
FCClassElement("PunkSafeHandle", "System.Reflection.Emit", gSymWrapperCodePunkSafeHandleFuncs)
-#endif
-#ifndef FEATURE_CORECLR
-FCClassElement("RNGCryptoServiceProvider", "System.Security.Cryptography", gRNGCryptoServiceProviderFuncs)
-#endif
#ifdef FEATURE_RWLOCK
FCClassElement("ReaderWriterLock", "System.Threading", gRWLockFuncs)
#endif // FEATURE_RWLOCK
@@ -1919,9 +1690,6 @@ FCClassElement("SafeHandle", "System.Runtime.InteropServices", gSafeHandleFuncs)
FCClassElement("SafeTypeNameParserHandle", "System", gSafeTypeNameParserHandle)
FCClassElement("Signature", "System", gSignatureNative)
-#ifndef FEATURE_CORECLR
-FCClassElement("SizedReference", "System", gSizedRefHandleFuncs)
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_REMOTING
FCClassElement("StackBuilderSink", "System.Runtime.Remoting.Messaging", gStackBuilderSinkFuncs)
#endif
@@ -1938,9 +1706,6 @@ FCClassElement("TextInfo", "System.Globalization", gTextInfoFuncs)
#endif // !defined(FEATURE_COREFX_GLOBALIZATION)
FCClassElement("Thread", "System.Threading", gThreadFuncs)
FCClassElement("ThreadPool", "System.Threading", gThreadPoolFuncs)
-#ifndef FEATURE_CORECLR
-FCClassElement("TimeSpan", "System", gTimeSpanFuncs)
-#endif // !FEATURE_CORECLR
FCClassElement("TimerQueue", "System.Threading", gTimerFuncs)
FCClassElement("Type", "System", gSystem_Type)
FCClassElement("TypeBuilder", "System.Reflection.Emit", gCOMClassWriter)
@@ -1973,9 +1738,6 @@ FCClassElement("WinRTTypeNameConverter", "System.StubHelpers", gWinRTTypeNameCon
FCClassElement("WindowsRuntimeBufferHelper", "System.Runtime.InteropServices.WindowsRuntime", gWindowsRuntimeBufferHelperFuncs)
#endif
-#ifndef FEATURE_CORECLR
-FCClassElement("WindowsRuntimeDesignerContext", "System.Runtime.DesignerServices", gWindowsRuntimeContextFuncs)
-#endif
#if defined(FEATURE_COMINTEROP) && defined(FEATURE_REFLECTION_ONLY_LOAD)
FCClassElement("WindowsRuntimeMetadata", "System.Runtime.InteropServices.WindowsRuntime", gWindowsRuntimeMetadata)
diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp
index 91b9e64a78..4abfcc7dc7 100644
--- a/src/vm/eeconfig.cpp
+++ b/src/vm/eeconfig.cpp
@@ -16,11 +16,6 @@
#endif
#include "eeconfig.h"
#include "method.hpp"
-#ifndef FEATURE_CORECLR
-#include <xmlparser.h>
-#include <mscorcfg.h>
-#include "eeconfigfactory.h"
-#endif
#ifdef FEATURE_FUSION
#include "fusionsetup.h"
#endif
@@ -33,9 +28,7 @@
#ifdef FEATURE_WIN_DB_APPCOMPAT
#include "QuirksApi.h"
#endif
-#ifdef FEATURE_CORECLR
#include "configuration.h"
-#endif
using namespace clr;
@@ -294,9 +287,7 @@ HRESULT EEConfig::Init()
INDEBUG(fStressLog = true;)
-#ifdef FEATURE_CORECLR
fVerifyAllOnLoad = false;
-#endif
#ifdef _DEBUG
fExpandAllOnLoad = false;
fDebuggable = false;
@@ -798,14 +789,12 @@ HRESULT EEConfig::sync()
}
bool gcConcurrentWasForced = false;
-#ifdef FEATURE_CORECLR
// The CLRConfig value for UNSUPPORTED_gcConcurrent defaults to -1, and treats any
// positive value as 'forcing' concurrent GC to be on. Because the standard logic
// for mapping a DWORD CLRConfig to a boolean configuration treats -1 as true (just
// like any other nonzero value), we will explicitly check the DWORD later if this
// check returns false.
gcConcurrentWasForced = Configuration::GetKnobBooleanValue(W("System.GC.Concurrent"), false);
-#endif
int gcConcurrentConfigVal = 0;
if (!gcConcurrentWasForced)
@@ -975,14 +964,9 @@ HRESULT EEConfig::sync()
#endif
iGCForceCompact = GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_gcForceCompact, iGCForceCompact);
-#ifdef FEATURE_CORECLR
iGCNoAffinitize = Configuration::GetKnobBooleanValue(W("System.GC.NoAffinitize"),
CLRConfig::UNSUPPORTED_GCNoAffinitize);
iGCHeapCount = Configuration::GetKnobDWORDValue(W("System.GC.HeapCount"), CLRConfig::UNSUPPORTED_GCHeapCount);
-#else
- iGCNoAffinitize = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_GCNoAffinitize);
- iGCHeapCount = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_GCHeapCount);
-#endif
fStressLog = GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_StressLog, fStressLog) != 0;
fForceEnc = GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_ForceEnc, fForceEnc) != 0;
@@ -1137,59 +1121,6 @@ HRESULT EEConfig::sync()
fPInvokeRestoreEsp = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Jit_NetFx40PInvokeStackResilience);
#endif
-#ifndef FEATURE_CORECLR
- // These two values respect the Shim's policy of favoring config files over registry settings.
- fLegacyNullReferenceExceptionPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::UNSUPPORTED_legacyNullReferenceExceptionPolicy,
- fLegacyNullReferenceExceptionPolicy) != 0);
- fLegacyUnhandledExceptionPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::UNSUPPORTED_legacyUnhandledExceptionPolicy,
- fLegacyUnhandledExceptionPolicy) != 0);
-
-#ifdef FEATURE_CORRUPTING_EXCEPTIONS
- // Check if the user has overriden how Corrupted State Exceptions (CSE) will be handled. If the
- // <runtime> section of app.exe.config has "legacyCorruptedStateExceptionsPolicy" set to 1, then
- // V4 runtime will treat CSE in the same fashion as V2.
- fLegacyCorruptedStateExceptionsPolicy = (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_legacyCorruptedStateExceptionsPolicy) != 0);
-#endif // FEATURE_CORRUPTING_EXCEPTIONS
-
- fLegacyVirtualMethodCallVerification = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyVirtualMethodCallVerification,
- fLegacyVirtualMethodCallVerification,
- REGUTIL::COR_CONFIG_ALL, TRUE,
- CONFIG_SYSTEMONLY) != 0);
-
- fLegacyApartmentInitPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyApartmentInitPolicy,
- fLegacyApartmentInitPolicy) != 0);
-
- fLegacyComHierarchyVisibility = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyComHierarchyVisibility,
- fLegacyComHierarchyVisibility) != 0);
-
- fLegacyComVTableLayout = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyComVTableLayout,
- fLegacyComVTableLayout) != 0);
- fNewComVTableLayout = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_newComVTableLayout,
- fNewComVTableLayout) != 0);
-
- if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_legacyImpersonationPolicy) != 0)
- iImpersonationPolicy = IMP_NOFLOW;
- else if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_alwaysFlowImpersonationPolicy) != 0)
- iImpersonationPolicy = IMP_ALWAYSFLOW;
-
- fLegacyLoadMscorsnOnStartup = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::UNSUPPORTED_legacyLoadMscorsnOnStartup,
- fLegacyLoadMscorsnOnStartup) != 0);
- fBypassStrongNameVerification = (GetConfigDWORDFavoringConfigFile_DontUse_(W("bypassTrustedAppStrongNames"), fBypassStrongNameVerification) != 0) && // App opted in
- (GetConfigDWORD_DontUse_(SN_CONFIG_BYPASS_POLICY_W, TRUE, REGUTIL::COR_CONFIG_MACHINE) != 0); // And the machine policy allows for bypass
- fGeneratePublisherEvidence = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_generatePublisherEvidence, fGeneratePublisherEvidence) != 0);
- fEnforceFIPSPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_enforceFIPSPolicy, fEnforceFIPSPolicy) != 0);
- fLegacyHMACMode = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyHMACMode, fLegacyHMACMode) != 0);
-
- fCacheBindingFailures = !(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_disableCachingBindingFailures));
- fUseLegacyIdentityFormat =
-#ifdef FEATURE_APPX
- AppX::IsAppXProcess() ||
-#endif
- (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_useLegacyIdentityFormat) != 0);
- fDisableFusionUpdatesFromADManager = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_disableFusionUpdatesFromADManager) != 0);
- fDisableCommitThreadStack = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_disableCommitThreadStack, fDisableCommitThreadStack) != 0);
- fProbeForStackOverflow = !(CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_disableStackOverflowProbing));
-#endif // FEATURE_CORECLR
#ifdef _DEBUG
fDebuggable = (GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_JitDebuggable, fDebuggable) != 0);
@@ -1264,10 +1195,8 @@ HRESULT EEConfig::sync()
fEnableRCWCleanupOnSTAShutdown = (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EnableRCWCleanupOnSTAShutdown) != 0);
#endif // FEATURE_COMINTEROP
-#ifdef FEATURE_CORECLR
//Eager verification of all assemblies.
fVerifyAllOnLoad = (GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_VerifyAllOnLoad, fVerifyAllOnLoad) != 0);
-#endif //FEATURE_CORECLR
#ifdef _DEBUG
fExpandAllOnLoad = (GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_ExpandAllOnLoad, fExpandAllOnLoad) != 0);
@@ -1367,12 +1296,6 @@ HRESULT EEConfig::sync()
m_fInteropLogArguments = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InteropLogArguments) != 0);
#ifdef FEATURE_PREJIT
-#ifndef FEATURE_CORECLR
- DWORD iNgenHardBindOverride = GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_HardPrejitEnabled, iNgenHardBind);
- _ASSERTE(iNgenHardBindOverride < NGEN_HARD_BIND_COUNT);
- if (iNgenHardBindOverride < NGEN_HARD_BIND_COUNT)
- iNgenHardBind = NgenHardBindType(iNgenHardBindOverride);
-#endif
#ifdef _DEBUG
dwNgenForceFailureMask = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NgenForceFailureMask);
dwNgenForceFailureCount = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NgenForceFailureCount);
@@ -1565,305 +1488,6 @@ SIZE_T EEConfig::GetSizeOfProcessBindingFile()
return g_dwHostConfigFile;
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) // unimpactful install --> no config files
-
-/**************************************************************/
-static void MessageBoxParseError(HRESULT hr, __in_z LPCWSTR wszFile);
-
-#define IfFailParseError(FILE, ISAPPCONFIG, ...) \
- do \
- { \
- /* On error, always show an error dialog and return an error result when process is immersive; */ \
- /* otherwise show dialog (conditionally for App config) and swallow error. */ \
- if (FAILED(hr = (__VA_ARGS__)) && (!(ISAPPCONFIG) || AppX::IsAppXProcess() || GetConfigDWORDInternal_DontUse_(CLRConfig::EXTERNAL_NotifyBadAppCfg,false))) \
- { \
- MessageBoxParseError(hr, FILE); \
- if (AppX::IsAppXProcess()) \
- { /* Fail on bad config in AppX process. */ \
- return hr; \
- } \
- else \
- { \
- hr = S_FALSE; \
- } \
- } \
- } while (false)
-
-/**************************************************************/
-HRESULT EEConfig::SetupConfiguration()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_ANY;
- } CONTRACTL_END;
-
- WCHAR version[_MAX_PATH];
- DWORD dwVersion = _MAX_PATH;
-
- HRESULT hr = S_OK;
- // Get the version location
- IfFailRet(GetCORVersionInternal(version, _MAX_PATH, & dwVersion));
-
- // See if the environment has specified an XML file
- NewArrayHolder<WCHAR> file(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CONFIG));
- if(file != NULL)
- {
- IfFailParseError(file, false, AppendConfigurationFile(file, version));
- }
-
- // We need to read configuration information from 3 sources... the app config file, the
- // host supplied config file, and the machine.config file. The order in which we
- // read them are very import. If the different config sources specify the same config
- // setting, we will use the setting of the first one read.
- //
- // In the pecking order, machine.config should always have the final say. The host supplied config
- // file should follow, and lastly, the app config file.
- //
- // Note: the order we read them is not the order they are published. Need to read the AppConfig
- // first so that we can decide if we should import machine.config (yes in Classic, typically no
- // in AppX). We still publish in the order required as described above.
-
- enum
- {
- MachineConfig = 0,
- HostConfig = 1,
- AppConfig = 2,
- NumConfig = 3,
- };
-
- ConfigSource * rgpSources[NumConfig] = { nullptr };
-
- // Create ConfigSource objects for all config files.
- for (size_t i = 0; i < NumConfig; ++i)
- {
- rgpSources[i] = new (nothrow) ConfigSource();
- if (rgpSources[i] == NULL)
- {
- while (i != 0)
- {
- --i;
- delete rgpSources[i];
- rgpSources[i] = nullptr;
- }
- return E_OUTOFMEMORY;
- }
- }
-
- // Publish ConfigSource objects in required order. It's ok that the file contents are imported below,
- // since we're in EEStartup and this data cannot be accessed by any other threads yet.
- for (size_t i = 0; i < NumConfig; ++i)
- {
- m_Configuration.Append(rgpSources[i]);
- }
-
- // ----------------------------------------------------
- // Import the app.config file, or in the case of an
- // AppX process check to make sure no app.config file
- // exists unless launched with AO_DESIGNMODE.
- // ----------------------------------------------------
-
- do
- {
- size_t cchProcExe=0;
- PathString wzProcExe;
- EX_TRY
- {
-
-
-
- // Get name of file used to create process
- if (g_pCachedModuleFileName)
- {
- wzProcExe.Set(g_pCachedModuleFileName);
- cchProcExe = wzProcExe.GetCount();
- }
- else
- {
- cchProcExe = WszGetModuleFileName(NULL, wzProcExe);
-
- if (cchProcExe == 0)
- {
- hr = HRESULT_FROM_GetLastError();
- break;
- }
- }
-
- if (cchProcExe != 0)
- {
- wzProcExe.Append(CONFIGURATION_EXTENSION);
-
- if (AppX::IsAppXProcess() && !AppX::IsAppXDesignMode())
- {
- if (clr::fs::Path::Exists(wzProcExe))
- {
- hr = CLR_E_APP_CONFIG_NOT_ALLOWED_IN_APPX_PROCESS;
- break;
- }
- }
- }
- }
- EX_CATCH_HRESULT(hr);
- if (cchProcExe != 0)
- {
- IfFailParseError(wzProcExe, true, AppendConfigurationFile(wzProcExe, version));
-
- // We really should return a failure hresult if the app config file is bad, but that
- // would be a breaking change. Not sure if it's worth it yet.
- hr = S_OK;
- break;
- }
- } while (false);
-
-
- if (hr != S_OK)
- return hr;
- // ----------------------------------------------------
- // Import machine.config, if needed.
- // ----------------------------------------------------
- if (!AppX::IsAppXProcess() || AppX::IsAppXDesignMode())
- {
- WCHAR wzSystemDir[_MAX_PATH];
- DWORD cchSystemDir = COUNTOF(wzSystemDir);
- IfFailRet(GetInternalSystemDirectory(wzSystemDir, &cchSystemDir));
-
- // cchSystemDir already includes the NULL
- if(cchSystemDir + StrLen(MACHINE_CONFIGURATION_FILE) <= _MAX_PATH)
- {
- IfFailRet(StringCchCat(wzSystemDir, COUNTOF(wzSystemDir), MACHINE_CONFIGURATION_FILE));
-
- // CLR_STARTUP_OPT:
- // The machine.config file can be very large. We cannot afford
- // to parse all of it at CLR startup time.
- //
- // Accordingly, we instruct the XML parser to stop parsing the
- // machine.config file when it sees the end of the
- // <runtime>...</runtime> section that holds our data (if any).
- //
- // By construction, this section is now placed near the top
- // of machine.config.
- //
- IfFailParseError(wzSystemDir, false, ImportConfigurationFile(
- rgpSources[MachineConfig]->Table(), wzSystemDir, version, stopAfterRuntimeSection));
-
- if (hr == S_FALSE) // means that we couldn't find machine.config
- hr = S_OK;
- }
- }
-
- // ----------------------------------------------------
- // Import the host supplied config file, if needed.
- // ----------------------------------------------------
- // Cannot host an AppX managed process, so no need to check devModeEnabled.
- if (!AppX::IsAppXProcess())
- {
- if (GetProcessBindingFile() != NULL && GetSizeOfProcessBindingFile() > 0)
- {
- IfFailRet(ImportConfigurationFile(
- rgpSources[HostConfig]->Table(), GetProcessBindingFile(), version));
- }
- }
-
- return hr;
-}
-
-//
-// There was an error 'hr' parsing the file 'wszFile'.
-// Pop up a MessageBox reporting the error, unless the config setting
-// 'NoGuiFromShim' is in effect.
-//
-static void MessageBoxParseError(HRESULT hr, __in_z LPCWSTR wszFile)
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(FAILED(hr));
- } CONTRACTL_END;
-
- if (!REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_NoGuiFromShim, FALSE))
- {
- EEMessageBoxCatastrophic(IDS_EE_CONFIGPARSER_ERROR, IDS_EE_CONFIGPARSER_ERROR_CAPTION, wszFile, hr);
- }
-}
-
-/**************************************************************/
-
-STDAPI GetXMLObjectEx(IXMLParser **ppv);
-
-HRESULT EEConfig::ImportConfigurationFile(
- ConfigStringHashtable* pTable,
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl)
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- PRECONDITION(CheckPointer(pTable));
- PRECONDITION(CheckPointer(pszFileName));
- PRECONDITION(CheckPointer(version));
- INJECT_FAULT(return E_OUTOFMEMORY);
- } CONTRACTL_END;
-
- NonVMComHolder<IXMLParser> pIXMLParser(NULL);
- NonVMComHolder<IStream> pFile(NULL);
- NonVMComHolder<EEConfigFactory> factory(NULL);
-
- HRESULT hr = CreateConfigStreamHelper(pszFileName, &pFile);
- if(FAILED(hr)) goto Exit;
-
- hr = GetXMLObjectEx(&pIXMLParser);
- if(FAILED(hr)) goto Exit;
-
- factory = new (nothrow) EEConfigFactory(pTable, version, parseCtl);
-
- if ( ! factory) {
- hr = E_OUTOFMEMORY;
- goto Exit;
- }
- factory->AddRef(); // RefCount = 1
-
-
- hr = pIXMLParser->SetInput(pFile); // filestream's RefCount=2
- if ( ! SUCCEEDED(hr))
- goto Exit;
-
- hr = pIXMLParser->SetFactory(factory); // factory's RefCount=2
- if ( ! SUCCEEDED(hr))
- goto Exit;
-
- {
- CONTRACT_VIOLATION(ThrowsViolation); // @todo: Run() throws!
- hr = pIXMLParser->Run(-1);
- }
-
-Exit:
- if (hr == (HRESULT) XML_E_MISSINGROOT)
- hr = S_OK;
- else if (Assembly::FileNotFound(hr))
- hr = S_FALSE;
-
- return hr;
-}
-
-HRESULT EEConfig::AppendConfigurationFile(
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl)
-{
- LIMITED_METHOD_CONTRACT;
- HRESULT hr = S_OK;
-
- ConfigStringHashtable* pTable = m_Configuration.Append();
- IfNullRet(pTable);
-
- return ImportConfigurationFile(pTable, pszFileName, version, parseCtl);
-}
-
-
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
bool EEConfig::RequireZap(LPCUTF8 assemblyName) const
{
diff --git a/src/vm/eeconfig.h b/src/vm/eeconfig.h
index 338a97268b..8e21c445da 100644
--- a/src/vm/eeconfig.h
+++ b/src/vm/eeconfig.h
@@ -510,9 +510,7 @@ public:
}
#endif // FEATURE_COMINTEROP
-#ifdef FEATURE_CORECLR
bool VerifyModulesOnLoad(void) const { LIMITED_METHOD_CONTRACT; return fVerifyAllOnLoad; }
-#endif
#ifdef _DEBUG
bool ExpandModulesOnLoad(void) const { LIMITED_METHOD_CONTRACT; return fExpandAllOnLoad; }
#endif //_DEBUG
@@ -1008,9 +1006,7 @@ private: //----------------------------------------------------------------
bool m_fDeveloperInstallation; // We are on a developers machine
bool fAppDomainUnload; // Enable appdomain unloading
-#ifdef FEATURE_CORECLR
bool fVerifyAllOnLoad; // True if we want to verify all methods in an assembly at load time.
-#endif //FEATURE_CORECLR
DWORD dwADURetryCount;
@@ -1197,20 +1193,6 @@ private: //----------------------------------------------------------------
#endif
public:
-#ifndef FEATURE_CORECLR // unimpactful install --> no config files
- HRESULT ImportConfigurationFile(
- ConfigStringHashtable* pTable,
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl = parseAll);
-
- HRESULT AppendConfigurationFile(
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl = parseAll);
-
- HRESULT SetupConfiguration();
-#endif // FEATURE_CORECLR
HRESULT GetConfiguration_DontUse_(__in_z LPCWSTR pKey, ConfigSearch direction, __deref_out_opt LPCWSTR* value);
LPCWSTR GetProcessBindingFile(); // All flavors must support this method
diff --git a/src/vm/eepolicy.cpp b/src/vm/eepolicy.cpp
index 236f5afd6e..b35e9e9864 100644
--- a/src/vm/eepolicy.cpp
+++ b/src/vm/eepolicy.cpp
@@ -70,12 +70,10 @@ EEPolicy::EEPolicy ()
m_ActionOnFailure[FAIL_NonCriticalResource] = eThrowException;
m_ActionOnFailure[FAIL_OrphanedLock] = eNoAction;
m_ActionOnFailure[FAIL_FatalRuntime] = eRudeExitProcess;
-#ifdef FEATURE_CORECLR
// For CoreCLR, initialize the default action for AV processing to all
// all kind of code to catch AV exception. If the host wants, they can
// specify a different action for this.
m_ActionOnFailure[FAIL_AccessViolation] = eNoAction;
-#endif // FEATURE_CORECLR
m_ActionOnFailure[FAIL_StackOverflow] = eRudeExitProcess;
m_ActionOnFailure[FAIL_CodeContract] = eThrowException;
m_unhandledExceptionPolicy = eRuntimeDeterminedPolicy;
@@ -178,22 +176,10 @@ BOOL EEPolicy::IsValidActionForFailure(EClrFailure failure, EPolicyAction action
return action >= eUnloadAppDomain &&
action < MaxPolicyAction;
case FAIL_AccessViolation:
-#ifdef FEATURE_CORECLR
// Allowed actions on failure are:
//
// eNoAction or eRudeExitProcess.
return ((action == eNoAction) || (action == eRudeExitProcess));
-#else // !FEATURE_CORECLR
- // FAIL_AccessViolation is defined for the desktop so that
- // if any more definitions are added after it, their value
- // should remain constant irrespective of whether its the
- // desktop CLR or CoreCLR.
- //
- // That said, currently, Desktop CLR does not support
- // FAIL_AccessViolation. Thus, any calls which use
- // this failure are not allowed.
- return FALSE;
-#endif // FEATURE_CORECLR
case FAIL_StackOverflow:
return action >= eRudeUnloadAppDomain &&
action < MaxPolicyAction;
@@ -602,21 +588,6 @@ void EEPolicy::ExitProcessViaShim(UINT exitCode)
// runtime in a process with many. We need to give the other runtimes a chance to exit
// cleanly. If we can't make the call, or if the call fails for some reason, then we
// simply exit the process here, which is rude to the others, but the best we can do.
-#if !defined(FEATURE_CORECLR)
- {
- ReleaseHolder<ICLRRuntimeHostInternal> pRuntimeHostInternal;
-
- HRESULT hr = g_pCLRRuntime->GetInterface(CLSID_CLRRuntimeHostInternal,
- IID_ICLRRuntimeHostInternal,
- &pRuntimeHostInternal);
-
- if (SUCCEEDED(hr))
- {
- pRuntimeHostInternal->ShutdownAllRuntimesThenExit(exitCode);
- LOG((LF_EH, LL_INFO10, "ExitProcessViaShim: shim returned... exiting now.\n"));
- }
- }
-#endif // !FEATURE_CORECLR
ExitProcess(exitCode);
}
diff --git a/src/vm/eventreporter.cpp b/src/vm/eventreporter.cpp
index 6ef767c424..e10aed9441 100644
--- a/src/vm/eventreporter.cpp
+++ b/src/vm/eventreporter.cpp
@@ -20,9 +20,7 @@
#include "../dlls/mscorrc/resource.h"
-#if defined(FEATURE_CORECLR)
#include "getproductversionnumber.h"
-#endif // FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -84,30 +82,13 @@ EventReporter::EventReporter(EventReporterType type)
ssMessage.Clear();
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_FRAMEWORK_VERSION))
-#ifndef FEATURE_CORECLR
- m_Description.Append(W("Framework Version: "));
-#else // FEATURE_CORECLR
m_Description.Append(W("CoreCLR Version: "));
-#endif // !FEATURE_CORECLR
else
{
m_Description.Append(ssMessage);
}
BOOL fHasVersion = FALSE;
-#ifndef FEATURE_CORECLR
- if (GetCLRModule() != NULL)
- {
- WCHAR buffer[80];
- DWORD length;
- if (SUCCEEDED(GetCORVersionInternal(buffer, 80, &length)))
- {
- m_Description.Append(buffer);
- m_Description.Append(W("\n"));
- fHasVersion = TRUE;
- }
- }
-#else // FEATURE_CORECLR
DWORD dwMajorVersion = 0;
DWORD dwMinorVersion = 0;
DWORD dwBuild = 0;
@@ -115,7 +96,6 @@ EventReporter::EventReporter(EventReporterType type)
EventReporter::GetCoreCLRInstanceProductVersion(&dwMajorVersion, &dwMinorVersion, &dwBuild, &dwRevision);
m_Description.AppendPrintf(W("%lu.%lu.%lu.%lu\n"),dwMajorVersion, dwMinorVersion, dwBuild, dwRevision);
fHasVersion = TRUE;
-#endif // !FEATURE_CORECLR
if (!fHasVersion)
{
@@ -674,7 +654,6 @@ void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
gc.throwable = pThread->GetThrowable();
_ASSERTE(gc.throwable != NULL);
-#ifdef FEATURE_CORECLR
// On CoreCLR, managed code execution happens in non-default AppDomains and all threads have an AD transition
// at their base from DefaultDomain to the target Domain before they start executing managed code. Thus, when
// an exception goes unhandled in a non-default AppDomain on a reverse pinvoke thread, the original exception details are copied
@@ -716,7 +695,6 @@ void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
}
}
else
-#endif // FEATURE_CORECLR
{
if (IsException(gc.throwable->GetMethodTable()))
{
@@ -771,7 +749,6 @@ void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
}
}
-#if defined(FEATURE_CORECLR)
// This function will return the product version of CoreCLR
// instance we are executing in.
void EventReporter::GetCoreCLRInstanceProductVersion(DWORD * pdwMajor, DWORD * pdwMinor, DWORD * pdwBuild, DWORD * pdwRevision)
@@ -809,4 +786,3 @@ void EventReporter::GetCoreCLRInstanceProductVersion(DWORD * pdwMajor, DWORD * p
LOG((LF_CORDB, LL_INFO100, "GetCoreCLRInstanceVersion: Unable to get CoreCLR version.\n"));
}
}
-#endif // FEATURE_CORECLR
diff --git a/src/vm/eventreporter.h b/src/vm/eventreporter.h
index ecbc9d1382..54317133dd 100644
--- a/src/vm/eventreporter.h
+++ b/src/vm/eventreporter.h
@@ -49,9 +49,7 @@ private:
// Flag to indicate if the buffer is full
BOOL fBufferFull;
-#ifdef FEATURE_CORECLR
static void GetCoreCLRInstanceProductVersion(DWORD * pdwMajor, DWORD * pdwMinor, DWORD * pdwBuild, DWORD * pdwRevision);
-#endif // FEATURE_CORECLR
public:
// Construct
diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp
index fb5d9b0090..4285f6e5b4 100644
--- a/src/vm/eventtrace.cpp
+++ b/src/vm/eventtrace.cpp
@@ -4316,16 +4316,10 @@ HRESULT ETW::CEtwTracer::Register()
EventRegisterMicrosoft_Windows_DotNETRuntimeRundown();
// Stress Log ETW events are available only on the desktop version of the runtime
-#ifndef FEATURE_CORECLR
- EventRegisterMicrosoft_Windows_DotNETRuntimeStress();
-#endif // !FEATURE_CORECLR
MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimeHandle;
MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimePrivateHandle;
MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimeRundownHandle;
-#ifndef FEATURE_CORECLR
- MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimeStressHandle;
-#endif // !FEATURE_CORECLR
return S_OK;
}
@@ -4351,9 +4345,6 @@ HRESULT ETW::CEtwTracer::UnRegister()
EventUnregisterMicrosoft_Windows_DotNETRuntime();
EventUnregisterMicrosoft_Windows_DotNETRuntimePrivate();
EventUnregisterMicrosoft_Windows_DotNETRuntimeRundown();
-#ifndef FEATURE_CORECLR
- EventUnregisterMicrosoft_Windows_DotNETRuntimeStress();
-#endif // !FEATURE_CORECLR
return S_OK;
}
@@ -4903,11 +4894,7 @@ VOID ETW::InfoLog::RuntimeInformation(INT32 type)
g_fEEComActivatedStartup || //CLR started as a COM object
g_fEEOtherStartup ); //In case none of the 4 above mentioned cases are true for example ngen, ildasm then we asssume its a "other" startup
-#ifdef FEATURE_CORECLR
Sku = ETW::InfoLog::InfoStructs::CoreCLR;
-#else
- Sku = ETW::InfoLog::InfoStructs::DesktopCLR;
-#endif //FEATURE_CORECLR
//version info for clr.dll
USHORT vmMajorVersion = VER_MAJORVERSION;
@@ -4926,30 +4913,6 @@ VOID ETW::InfoLog::RuntimeInformation(INT32 type)
PCWSTR lpwszCommandLine = W("");
-#ifndef FEATURE_CORECLR
- startupFlags = CorHost2::GetStartupFlags();
-
- // Some of the options specified by the startup flags can be overwritten by config files.
- // Strictly speaking since the field in this event is called StartupFlags there's nothing
- // wrong with just showing the actual startup flags but it makes it less useful (a more
- // appropriate name for the field is StartupOptions).
- startupFlags &= ~STARTUP_CONCURRENT_GC;
- if (g_pConfig->GetGCconcurrent())
- startupFlags |= STARTUP_CONCURRENT_GC;
-
- if (g_pConfig->DefaultSharePolicy() != AppDomain::SHARE_POLICY_UNSPECIFIED)
- {
- startupFlags &= ~STARTUP_LOADER_OPTIMIZATION_MASK;
- startupFlags |= g_pConfig->DefaultSharePolicy() << 1;
- }
-
- startupFlags &= ~STARTUP_LEGACY_IMPERSONATION;
- startupFlags &= ~STARTUP_ALWAYSFLOW_IMPERSONATION;
- if (g_pConfig->ImpersonationMode() == IMP_NOFLOW)
- startupFlags |= STARTUP_LEGACY_IMPERSONATION;
- else if (g_pConfig->ImpersonationMode() == IMP_ALWAYSFLOW)
- startupFlags |= STARTUP_ALWAYSFLOW_IMPERSONATION;
-#endif //!FEATURE_CORECLR
// Determine the startupmode
if(g_fEEIJWStartup)
@@ -5457,9 +5420,6 @@ VOID ETW::MethodLog::MethodTableRestored(MethodTable *pMethodTable)
VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
-#ifndef FEATURE_CORECLR
- FireEtwStrongNameVerificationStart_V1(dwInFlags, 0, strFullyQualifiedAssemblyName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
}
@@ -5469,9 +5429,6 @@ VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR
VOID ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
-#ifndef FEATURE_CORECLR
- FireEtwStrongNameVerificationStop_V1(dwInFlags, result, strFullyQualifiedAssemblyName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
}
/****************************************************************************/
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp
index 262414cd6c..3a4685eb11 100644
--- a/src/vm/excep.cpp
+++ b/src/vm/excep.cpp
@@ -4125,32 +4125,6 @@ void DisableOSWatson(void)
SetErrorMode(lastErrorMode | SEM_NOGPFAULTERRORBOX);
LOG((LF_EH, LL_INFO100, "DisableOSWatson: SetErrorMode = 0x%x\n", lastErrorMode | SEM_NOGPFAULTERRORBOX));
-#ifndef FEATURE_CORECLR
- // CoreCLR is always hosted and so this condition is always false
- if (RunningOnWin7() && !CLRHosted())
- {
- typedef DWORD (WINAPI * GetThreadErrorModeFnPtr)(void);
- typedef BOOL (WINAPI * SetThreadErrorModeFnPtr)(DWORD, LPDWORD);
- GetThreadErrorModeFnPtr pFnGetThreadErrorMode;
- SetThreadErrorModeFnPtr pFnSetThreadErrorMode;
-
- HINSTANCE hKernel32 = WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if (hKernel32 != NULL)
- {
- pFnGetThreadErrorMode = (GetThreadErrorModeFnPtr)GetProcAddress(hKernel32, "GetThreadErrorMode");
- pFnSetThreadErrorMode = (SetThreadErrorModeFnPtr)GetProcAddress(hKernel32, "SetThreadErrorMode");
-
- // GetThreadErrorMode and SetThreadErrorMode should be available on Win7.
- _ASSERTE((pFnGetThreadErrorMode != NULL) && (pFnSetThreadErrorMode != NULL));
- if ((pFnGetThreadErrorMode != NULL) && (pFnSetThreadErrorMode != NULL))
- {
- DWORD dwOldMode = (*pFnGetThreadErrorMode)();
- (*pFnSetThreadErrorMode)(dwOldMode | SEM_NOGPFAULTERRORBOX, &dwOldMode);
- LOG((LF_EH, LL_INFO100, "DisableOSWatson: SetThreadErrorMode = 0x%x\n", dwOldMode | SEM_NOGPFAULTERRORBOX));
- }
- }
- }
-#endif // FEATURE_CORECLR
}
@@ -4858,7 +4832,6 @@ LONG DefaultCatchNoSwallowFilter(EXCEPTION_POINTERS *ep, PVOID pv)
return EXCEPTION_CONTINUE_SEARCH;
} // LONG DefaultCatchNoSwallowFilter()
-#if defined(FEATURE_CORECLR)
// Note: This is used only for CoreCLR on WLC.
//
// We keep a pointer to the previous unhandled exception filter. After we install, we use
@@ -4871,7 +4844,6 @@ LONG DefaultCatchNoSwallowFilter(EXCEPTION_POINTERS *ep, PVOID pv)
// yet and having installed it but the original handler was NULL.
static LPTOP_LEVEL_EXCEPTION_FILTER g_pOriginalUnhandledExceptionFilter = (LPTOP_LEVEL_EXCEPTION_FILTER)-1;
#define FILTER_NOT_INSTALLED (LPTOP_LEVEL_EXCEPTION_FILTER) -1
-#endif // defined(FEATURE_CORECLR)
BOOL InstallUnhandledExceptionFilter() {
@@ -5222,7 +5194,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
//
if (pThread && (pThread->HasThreadStateNC(Thread::TSNC_ProcessedUnhandledException) || pThread->HasThreadStateNC(Thread::TSNC_AppDomainContainUnhandled)))
{
-#ifdef FEATURE_CORECLR
// This assert shouldnt be hit in CoreCLR since:
//
// 1) It has no concept of managed entry point that is invoked by the shim. You can
@@ -5236,7 +5207,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
{
_ASSERTE(!"How come a thread with TSNC_ProcessedUnhandledException state entered the UEF on CoreCLR?");
}
-#endif // FEATURE_CORECLR
LOG((LF_EH, LL_INFO100, "InternalUnhandledExceptionFilter_Worker: have already processed unhandled exception for this thread.\n"));
return EXCEPTION_CONTINUE_SEARCH;
@@ -5318,7 +5288,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
{
BOOL fIsProcessTerminating = TRUE;
-#ifdef FEATURE_CORECLR
// In CoreCLR, we can be asked to not let an exception go unhandled on managed threads in a given AppDomain.
// If the exception reaches the top of the thread's stack, we simply deliver AppDomain's UnhandledException event and
// return back to the filter, instead of letting the process terminate because of unhandled exception.
@@ -5342,7 +5311,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
fIsProcessTerminating = !(pParam->pThread->GetDomain()->IgnoreUnhandledExceptions());
else
fIsProcessTerminating = !(pParam->pThread->HasThreadStateNC(Thread::TSNC_IgnoreUnhandledExceptions));
-#endif // FEATURE_CORECLR
#ifndef FEATURE_PAL
// Setup the watson bucketing details for UE processing.
@@ -5354,14 +5322,12 @@ LONG InternalUnhandledExceptionFilter_Worker(
// Send notifications to the AppDomains.
NotifyAppDomainsOfUnhandledException(pParam->pExceptionInfo, NULL, useLastThrownObject, fIsProcessTerminating /*isTerminating*/);
-#ifdef FEATURE_CORECLR
// If the process is not terminating, then return back to the filter and ask it to execute
if (!fIsProcessTerminating)
{
pParam->retval = EXCEPTION_EXECUTE_HANDLER;
goto lDone;
}
-#endif // FEATURE_CORECLR
}
else
{
@@ -5547,7 +5513,6 @@ LONG InternalUnhandledExceptionFilter(
//
// Note: Also see the conditional UEF registration with the OS in EEStartupHelper.
-#ifdef FEATURE_CORECLR
// We would be here only on CoreCLR for WLC since we dont register
// the UEF with the OS for SL.
if (g_pOriginalUnhandledExceptionFilter != FILTER_NOT_INSTALLED
@@ -5555,7 +5520,6 @@ LONG InternalUnhandledExceptionFilter(
{
STRESS_LOG1(LF_EH, LL_INFO100, "InternalUnhandledExceptionFilter: Not chaining back to previous UEF at address %p on CoreCLR!\n", g_pOriginalUnhandledExceptionFilter);
}
-#endif // FEATURE_CORECLR
return retval;
@@ -5623,7 +5587,7 @@ LONG EntryPointFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID _pData)
// Returns
// the result of calling InternalUnhandledExceptionFilter
//------------------------------------------------------------------------------
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
#pragma code_seg(push, uef, CLR_UEF_SECTION_NAME)
#endif // FEATURE_CORECLR && !FEATURE_PAL
LONG __stdcall COMUnhandledExceptionFilter( // EXCEPTION_CONTINUE_SEARCH or EXCEPTION_CONTINUE_EXECUTION
@@ -5653,47 +5617,6 @@ LONG __stdcall COMUnhandledExceptionFilter( // EXCEPTION_CONTINUE_SEARCH or
return retVal;
}
-#ifndef FEATURE_CORECLR
-#ifdef _DEBUG
- // V4 onwards, we will reach here in the UEF only on the following conditions:
- //
- // 1) Faulting address is in native code on a reverse pinvoke thread. An example is an exception that escaped
- // out of the reverse pinvoke thread but was caught in the native part of the thread. The native part then
- // had another exception that went unhandled. The difference between this and (3) below is that
- // we have a thread object here but not in (3).
- //
- // An exception from PInvoke, that is never caught/rethrown in managed code and goes unhandled, also falls
- // in this category.
- //
- // 2) The exception escaped out of a reverse pinvoke thread and went unhandled.
- //
- // 3) Faulting thread was never seen by the runtime. An example is a another native thread
- // which the user code created that had unhandled exception.
- //
- // 4) A corrupting exception may become unhandled.
- //
- // This is not applicable to CoreCLR, as this unhandled exception filter is always set up, and all hardware exceptions in
- // managed code, including those that are not process-corrupting, such as integer division by zero, will end up here.
-
- // Assert these conditions here - we shouldnt be here for any other unhandled exception processing.
- Thread *pThread = GetThread();
- if ((pThread != NULL) && // condition 3
- !(pThread->GetExceptionState()->IsExceptionInProgress() &&
- pThread->GetExceptionState()->GetFlags()->ReversePInvokeEscapingException()) && // condition 2
- (ExecutionManager::IsManagedCode((PCODE)pExceptionInfo->ExceptionRecord->ExceptionAddress))) // condition 1
- {
-#ifdef FEATURE_CORRUPTING_EXCEPTIONS
- if (!CEHelper::IsProcessCorruptedStateException(pExceptionInfo->ExceptionRecord->ExceptionCode)) // condition 4
- {
- GCX_COOP();
- _ASSERTE(CEHelper::IsProcessCorruptedStateException(pThread->GetThrowable())); // condition 4
- }
-#else // !FEATURE_CORRUPTING_EXCEPTIONS
- _ASSERTE(false);
-#endif // FEATURE_CORRUPTING_EXCEPTIONS
- }
-#endif // _DEBUG
-#endif // !FEATURE_CORECLR
retVal = InternalUnhandledExceptionFilter(pExceptionInfo);
@@ -5706,7 +5629,7 @@ LONG __stdcall COMUnhandledExceptionFilter( // EXCEPTION_CONTINUE_SEARCH or
return retVal;
} // LONG __stdcall COMUnhandledExceptionFilter()
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
#pragma code_seg(pop, uef)
#endif // FEATURE_CORECLR && !FEATURE_PAL
@@ -6802,10 +6725,8 @@ exit:
#ifndef FEATURE_PAL
-#ifdef FEATURE_CORECLR
// Only proceed if Watson is enabled - CoreCLR may have it disabled.
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
BOOL fClearUEWatsonBucketTracker = TRUE;
PTR_EHWatsonBucketTracker pUEWatsonBucketTracker = pThread->GetExceptionState()->GetUEWatsonBucketTracker();
@@ -7108,7 +7029,7 @@ bool IsInterceptableException(Thread *pThread)
// appropriate exception code, or zero if the code is not a GC marker.
DWORD GetGcMarkerExceptionCode(LPVOID ip)
{
-#if defined(HAVE_GCCOVER) && defined(FEATURE_CORECLR)
+#if defined(HAVE_GCCOVER)
WRAPPER_NO_CONTRACT;
if (GCStress<cfg_any>::IsEnabled() && IsGcCoverageInterrupt(ip))
@@ -9322,13 +9243,11 @@ BOOL SetupWatsonBucketsForNonPreallocatedExceptions(OBJECTREF oThrowable /* = NU
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// CoreCLR may have watson bucketing conditionally enabled.
if (!IsWatsonEnabled())
{
return FALSE;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -9441,13 +9360,11 @@ BOOL SetupWatsonBucketsForEscapingPreallocatedExceptions()
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// CoreCLR may have watson bucketing conditionally enabled.
if (!IsWatsonEnabled())
{
return FALSE;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -9572,13 +9489,11 @@ void SetupWatsonBucketsForUEF(BOOL fUseLastThrownObject)
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// CoreCLR may have watson bucketing conditionally enabled.
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -10028,14 +9943,12 @@ BOOL SetupWatsonBucketsForFailFast(EXCEPTIONREF refException)
BOOL fResult = TRUE;
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (!IsWatsonEnabled())
{
return fResult;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -10290,14 +10203,12 @@ void SetupInitialThrowBucketDetails(UINT_PTR adjustedIp)
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -10901,14 +10812,12 @@ void SetStateForWatsonBucketing(BOOL fIsRethrownException, OBJECTHANDLE ohOrigin
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -11364,7 +11273,7 @@ UINT_PTR EHWatsonBucketTracker::RetrieveWatsonBucketIp()
// This is *also* invoked from the DAC when buckets are requested.
PTR_VOID EHWatsonBucketTracker::RetrieveWatsonBuckets()
{
-#if defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE)
+#if !defined(DACCESS_COMPILE)
if (!IsWatsonEnabled())
{
return NULL;
@@ -11390,12 +11299,10 @@ void EHWatsonBucketTracker::ClearWatsonBucketDetails()
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
diff --git a/src/vm/excep.h b/src/vm/excep.h
index 53fa20160a..6057c551a5 100644
--- a/src/vm/excep.h
+++ b/src/vm/excep.h
@@ -174,7 +174,7 @@ BOOL IsCOMPlusExceptionHandlerInstalled();
BOOL InstallUnhandledExceptionFilter();
void UninstallUnhandledExceptionFilter();
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
// Section naming is a strategy by itself. Ideally, we could have named the UEF section
// ".text$zzz" (lowercase after $ is important). What the linker does is look for the sections
// that has the same name before '$' sign. It combines them together but sorted in an alphabetical
diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp
index 262d3526eb..63192a2146 100644
--- a/src/vm/exceptionhandling.cpp
+++ b/src/vm/exceptionhandling.cpp
@@ -966,7 +966,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
}
#endif // FEATURE_CORRUPTING_EXCEPTIONS
-#ifdef FEATURE_CORECLR
{
// Switch to COOP mode since we are going to work
// with throwable
@@ -1009,7 +1008,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
}
}
}
-#endif // FEATURE_CORECLR
#ifndef FEATURE_PAL // Watson is on Windows only
// Setup bucketing details for nested exceptions (rethrow and non-rethrow) only if we are in the first pass
diff --git a/src/vm/finalizerthread.cpp b/src/vm/finalizerthread.cpp
index 4c0f5acbf9..d52d599db2 100644
--- a/src/vm/finalizerthread.cpp
+++ b/src/vm/finalizerthread.cpp
@@ -1408,12 +1408,10 @@ BOOL FinalizerThread::FinalizerThreadWatchDogHelper()
}
#endif // PROFILING_SUPPORTED
-#ifdef FEATURE_CORECLR
// This change was added late in Windows Phone 8, so we want to keep it minimal.
// We should consider refactoring this later, as we've got a lot of dead code here now on CoreCLR.
dwTimeout = INFINITE;
maxTotalWait = INFINITE;
-#endif // FEATURE_CORECLR
while (1) {
struct Param
diff --git a/src/vm/frames.h b/src/vm/frames.h
index e37f980b9f..2c9ddb4ab0 100644
--- a/src/vm/frames.h
+++ b/src/vm/frames.h
@@ -3203,9 +3203,6 @@ private:
PTR_Object m_LastThrownObjectInParentContext;
ULONG_PTR m_LockCount; // Number of locks the thread takes
// before the transition.
-#ifndef FEATURE_CORECLR
- ULONG_PTR m_CriticalRegionCount;
-#endif // !FEATURE_CORECLR
VPTR_VTABLE_CLASS(ContextTransitionFrame, Frame)
public:
@@ -3244,18 +3241,6 @@ public:
return (DWORD) m_LockCount;
}
-#ifndef FEATURE_CORECLR
- void SetCriticalRegionCount(DWORD criticalRegionCount)
- {
- LIMITED_METHOD_CONTRACT;
- m_CriticalRegionCount = criticalRegionCount;
- }
- DWORD GetCriticalRegionCount()
- {
- LIMITED_METHOD_CONTRACT;
- return (DWORD) m_CriticalRegionCount;
- }
-#endif // !FEATURE_CORECLR
// Let debugger know that we're transitioning between AppDomains.
ETransitionType GetTransitionType()
@@ -3270,9 +3255,6 @@ public:
, m_ReturnExecutionContext(NULL)
, m_LastThrownObjectInParentContext(NULL)
, m_LockCount(0)
-#ifndef FEATURE_CORECLR
- , m_CriticalRegionCount(0)
-#endif // !FEATURE_CORECLR
{
LIMITED_METHOD_CONTRACT;
}
diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp
index f61d042092..29f912ce41 100644
--- a/src/vm/gcenv.os.cpp
+++ b/src/vm/gcenv.os.cpp
@@ -378,11 +378,7 @@ static size_t GetRestrictedPhysicalMemoryLimit()
size_t job_physical_memory_limit = (size_t)MAX_PTR;
BOOL in_job_p = FALSE;
-#ifdef FEATURE_CORECLR
HINSTANCE hinstKernel32 = 0;
-#else
- HINSTANCE hinstPsapi = 0;
-#endif
PIS_PROCESS_IN_JOB GCIsProcessInJob = 0;
PQUERY_INFORMATION_JOB_OBJECT GCQueryInformationJobObject = 0;
@@ -394,21 +390,11 @@ static size_t GetRestrictedPhysicalMemoryLimit()
if (in_job_p)
{
-#ifdef FEATURE_CORECLR
hinstKernel32 = WszLoadLibrary(L"kernel32.dll");
if (!hinstKernel32)
goto exit;
GCGetProcessMemoryInfo = (PGET_PROCESS_MEMORY_INFO)GetProcAddress(hinstKernel32, "K32GetProcessMemoryInfo");
-#else
- // We need a way to get the working set in a job object and GetProcessMemoryInfo
- // is the way to get that. According to MSDN, we should use GetProcessMemoryInfo In order to
- // compensate for the incompatibility that psapi.dll introduced we are getting this dynamically.
- hinstPsapi = WszLoadLibrary(L"psapi.dll");
- if (!hinstPsapi)
- return 0;
- GCGetProcessMemoryInfo = (PGET_PROCESS_MEMORY_INFO)GetProcAddress(hinstPsapi, "GetProcessMemoryInfo");
-#endif
if (!GCGetProcessMemoryInfo)
goto exit;
@@ -460,11 +446,7 @@ exit:
{
job_physical_memory_limit = 0;
-#ifdef FEATURE_CORECLR
FreeLibrary(hinstKernel32);
-#else
- FreeLibrary(hinstPsapi);
-#endif
}
VolatileStore(&g_RestrictedPhysicalMemoryLimit, job_physical_memory_limit);
diff --git a/src/vm/gchost.cpp b/src/vm/gchost.cpp
index b51f2459fd..af213c27be 100644
--- a/src/vm/gchost.cpp
+++ b/src/vm/gchost.cpp
@@ -24,253 +24,5 @@
#include "field.h"
#include "gcheaputilities.h"
-#if !defined(FEATURE_CORECLR)
-inline size_t SizeInKBytes(size_t cbSize)
-{
- LIMITED_METHOD_CONTRACT;
-
- size_t cb = (cbSize % 1024) ? 1 : 0;
- return ((cbSize / 1024) + cb);
-}
-
-// IGCController
-
-HRESULT CorGCHost::_SetGCSegmentSize(SIZE_T SegmentSize)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Sanity check the value, it must be a power of two and big enough.
- if (!GCHeapUtilities::GetGCHeap()->IsValidSegmentSize(SegmentSize))
- {
- hr = E_INVALIDARG;
- }
- else
- {
- Host_SegmentSize = SegmentSize;
- Host_fSegmentSizeSet = TRUE;
- }
-
- return (hr);
-}
-
-HRESULT CorGCHost::_SetGCMaxGen0Size(SIZE_T MaxGen0Size)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Sanity check the value is at least large enough.
- if (!GCHeapUtilities::GetGCHeap()->IsValidGen0MaxSize(MaxGen0Size))
- {
- hr = E_INVALIDARG;
- }
- else
- {
- Host_MaxGen0Size = MaxGen0Size;
- Host_fMaxGen0SizeSet = TRUE;
- }
-
- return (hr);
-}
-
-HRESULT CorGCHost::SetGCStartupLimits(
- DWORD SegmentSize,
- DWORD MaxGen0Size)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Set default overrides if specified by caller.
- if (SegmentSize != (DWORD) ~0 && SegmentSize > 0)
- {
- hr = _SetGCSegmentSize(SegmentSize);
- }
-
- if (SUCCEEDED(hr) && MaxGen0Size != (DWORD) ~0 && MaxGen0Size > 0)
- {
- hr = _SetGCMaxGen0Size(MaxGen0Size);
- }
-
- return (hr);
-}
-
-HRESULT CorGCHost::SetGCStartupLimitsEx(
- SIZE_T SegmentSize,
- SIZE_T MaxGen0Size)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Set default overrides if specified by caller.
- if (SegmentSize != (SIZE_T) ~0 && SegmentSize > 0)
- {
- hr = _SetGCSegmentSize(SegmentSize);
- }
-
- if (SUCCEEDED(hr) && MaxGen0Size != (SIZE_T) ~0 && MaxGen0Size > 0)
- {
- hr = _SetGCMaxGen0Size(MaxGen0Size);
- }
-
- return (hr);
-}
-
-// Collect the requested generation.
-HRESULT CorGCHost::Collect(
- LONG Generation)
-{
- STATIC_CONTRACT_SO_TOLERANT;
-
- HRESULT hr = E_FAIL;
-
- if (Generation > (int) GCHeapUtilities::GetGCHeap()->GetMaxGeneration())
- hr = E_INVALIDARG;
- else
- {
- // Set up a Thread object if this is called on a native thread.
- Thread *pThread;
- pThread = GetThread();
- if (pThread == NULL)
- pThread = SetupThreadNoThrow(&hr);
-
- if (pThread != NULL)
- {
- // Put thread into co-operative mode, which is how GC must run.
- GCX_COOP();
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW);
-
- EX_TRY
- {
- hr = GCHeapUtilities::GetGCHeap()->GarbageCollect(Generation);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_SO_INTOLERANT_CODE;
- }
- }
- return (hr);
-}
-
-
-// Return GC counters in the gchost format.
-HRESULT CorGCHost::GetStats(
- COR_GC_STATS *pStats)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
-#if defined(ENABLE_PERF_COUNTERS)
-
- Perf_GC *pgc = &GetPerfCounters().m_GC;
-
- if (!pStats)
- return (E_INVALIDARG);
-
- if (pStats->Flags & COR_GC_COUNTS)
- {
- pStats->ExplicitGCCount = pgc->cInducedGCs;
- for (int idx=0; idx<3; idx++)
- {
- pStats->GenCollectionsTaken[idx] = pgc->cGenCollections[idx];
- }
- }
-
- if (pStats->Flags & COR_GC_MEMORYUSAGE)
- {
- pStats->CommittedKBytes = SizeInKBytes(pgc->cTotalCommittedBytes);
- pStats->ReservedKBytes = SizeInKBytes(pgc->cTotalReservedBytes);
- pStats->Gen0HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[0]);
- pStats->Gen1HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[1]);
- pStats->Gen2HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[2]);
- pStats->LargeObjectHeapSizeKBytes = SizeInKBytes(pgc->cLrgObjSize);
- pStats->KBytesPromotedFromGen0 = SizeInKBytes(pgc->cbPromotedMem[0]);
- pStats->KBytesPromotedFromGen1 = SizeInKBytes(pgc->cbPromotedMem[1]);
- }
- return (S_OK);
-#else
- return (E_NOTIMPL);
-#endif // ENABLE_PERF_COUNTERS
-}
-
-// Return per-thread allocation information.
-HRESULT CorGCHost::GetThreadStats(
- DWORD *pFiberCookie,
- COR_GC_THREAD_STATS *pStats)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- Thread *pThread;
-
- // Get the thread from the caller or the current thread.
- if (!pFiberCookie)
- pThread = GetThread();
- else
- pThread = (Thread *) pFiberCookie;
- if (!pThread)
- return (E_INVALIDARG);
-
- return pThread->GetMemStats (pStats);
-}
-
-// Return per-thread allocation information.
-HRESULT CorGCHost::SetVirtualMemLimit(
- SIZE_T sztMaxVirtualMemMB)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- GCHeapUtilities::GetGCHeap()->SetReservedVMLimit (sztMaxVirtualMemMB);
- return (S_OK);
-}
-#endif // !defined(FEATURE_CORECLR)
diff --git a/src/vm/hosting.cpp b/src/vm/hosting.cpp
index 4dd6a59729..a76d6af867 100644
--- a/src/vm/hosting.cpp
+++ b/src/vm/hosting.cpp
@@ -197,15 +197,6 @@ BOOL GlobalAllocStore::m_Disabled = FALSE;
#endif
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
-// The helper thread can't call regular new / delete b/c of interop-debugging deadlocks.
-// It must use the (InteropSafe) heap from debugger.h, you also can't allocate normally
-// when we have any other thread hard-suspended.
-
-// Telesto doesn't support interop-debugging, so this won't be an issue.
-
-void AssertAllocationAllowed();
-#endif
HANDLE g_ExecutableHeapHandle = NULL;
@@ -225,9 +216,6 @@ LPVOID EEVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, D
return NULL;
#endif
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- AssertAllocationAllowed();
-#endif
#ifdef _DEBUG
if (g_fEEStarted) {
@@ -570,9 +558,6 @@ LPVOID EEHeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
return NULL;
#endif
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- AssertAllocationAllowed();
-#endif
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
IHostMalloc *pHM = CorHost2::GetHostMalloc();
@@ -644,9 +629,6 @@ BOOL EEHeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem)
// @todo - Need a backout validation here.
CONTRACT_VIOLATION(SOToleranceViolation);
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- AssertAllocationAllowed();
-#endif
BOOL retVal = FALSE;
@@ -745,7 +727,6 @@ HANDLE EEGetProcessExecutableHeap() {
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
-#ifdef FEATURE_CORECLR
#ifndef FEATURE_PAL
@@ -780,18 +761,6 @@ HANDLE EEGetProcessExecutableHeap() {
UNREACHABLE();
#endif // !FEATURE_PAL
-#else // FEATURE_CORECLR
-
- //
- // Use process executable heap created by the shim
- //
- if (g_ExecutableHeapHandle == NULL)
- {
- extern HANDLE GetProcessExecutableHeap();
- g_ExecutableHeapHandle = GetProcessExecutableHeap();
- }
-
-#endif // FEATURE_CORECLR
// TODO: implement hosted executable heap
return g_ExecutableHeapHandle;
diff --git a/src/vm/i386/asmconstants.h b/src/vm/i386/asmconstants.h
index ce648518f9..0d5237bd5a 100644
--- a/src/vm/i386/asmconstants.h
+++ b/src/vm/i386/asmconstants.h
@@ -34,12 +34,7 @@
#endif
//***************************************************************************
-#if defined(_DEBUG) && defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- #define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 1
- #define TRACK_CXX_EXCEPTION_CODE_HACK
-#else
#define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 0
-#endif
#define INITIAL_SUCCESS_COUNT 0x100
diff --git a/src/vm/i386/cgencpu.h b/src/vm/i386/cgencpu.h
index 2e47a6af90..6dc53beb92 100644
--- a/src/vm/i386/cgencpu.h
+++ b/src/vm/i386/cgencpu.h
@@ -39,9 +39,6 @@ Stub * GenerateInitPInvokeFrameHelper();
EXTERN_C void STDCALL PInvokeStackImbalanceHelper(void);
#endif // MDA_SUPPORTED
-#ifndef FEATURE_CORECLR
-EXTERN_C void STDCALL CopyCtorCallStub(void);
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_STUBS_AS_IL
EXTERN_C void SinglecastDelegateInvokeStub();
diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp
index b860800943..7c93963aad 100644
--- a/src/vm/i386/excepx86.cpp
+++ b/src/vm/i386/excepx86.cpp
@@ -1095,7 +1095,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc.
}
#endif // FEATURE_CORRUPTING_EXCEPTIONS
-#ifdef FEATURE_CORECLR
// Check if we are dealing with AV or not and if we are,
// ensure that this is a real AV and not managed AV exception
BOOL fIsThrownExceptionAV = FALSE;
@@ -1124,7 +1123,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc.
EEPOLICY_HANDLE_FATAL_ERROR(COR_E_SECURITY);
}
}
-#endif // FEATURE_CORECLR
// If we're out of memory, then we figure there's probably not memory to maintain a stack trace, so we skip it.
// If we've got a stack overflow, then we figure the stack will be so huge as to make tracking the stack trace
diff --git a/src/vm/ilmarshalers.cpp b/src/vm/ilmarshalers.cpp
index c44e561df3..a72276ef4a 100644
--- a/src/vm/ilmarshalers.cpp
+++ b/src/vm/ilmarshalers.cpp
@@ -3305,135 +3305,6 @@ ILCriticalHandleMarshaler::ReturnOverride(
return OVERRIDDEN;
} // ILCriticalHandleMarshaler::ReturnOverride
-#ifndef FEATURE_CORECLR
-//---------------------------------------------------------------------------------------
-//
-MarshalerOverrideStatus ILBlittableValueClassWithCopyCtorMarshaler::ArgumentOverride(NDirectStubLinker* psl,
- BOOL byref,
- BOOL fin,
- BOOL fout,
- BOOL fManagedToNative,
- OverrideProcArgs* pargs,
- UINT* pResID,
- UINT argidx,
- UINT nativeStackOffset)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- ILCodeStream* pslIL = psl->GetMarshalCodeStream();
- ILCodeStream* pslILDispatch = psl->GetDispatchCodeStream();
-
- if (byref)
- {
- *pResID = IDS_EE_BADMARSHAL_COPYCTORRESTRICTION;
- return DISALLOWED;
- }
-
- if (fManagedToNative)
- {
-#ifdef _TARGET_X86_
- _ASSERTE(nativeStackOffset != (UINT)-1);
-
- // get a new copy ctor cookie
- DWORD dwCookieLocalNum = psl->CreateCopyCtorCookie(pslIL);
-
- // and initialize it with our values
- pslIL->EmitLDLOCA(dwCookieLocalNum);
- pslIL->EmitLDARG(argidx);
- pslIL->EmitLDC(nativeStackOffset);
-
- // SetData takes pointers to managed methods although code:CopyCtorCallStubWorker
- // currently calls them via reverse P/Invokes
- if (pargs->mm.m_pCopyCtor)
- {
- pslIL->EmitLDFTN(pslIL->GetToken(pargs->mm.m_pCopyCtor));
- }
- else
- {
- pslIL->EmitLoadNullPtr();
- }
-
- if (pargs->mm.m_pDtor)
- {
- pslIL->EmitLDFTN(pslIL->GetToken(pargs->mm.m_pDtor));
- }
- else
- {
- pslIL->EmitLoadNullPtr();
- }
-
- // <dwCookieLocalNum>.SetData(<argidx>, <nativeStackOffset>, ctorPtr, dtorPtr)
- pslIL->EmitCALL(METHOD__COPYCTORSTUBCOOKIE__SET_DATA, 5, 0);
-
- LocalDesc locDesc(pargs->mm.m_pMT);
- pslIL->SetStubTargetArgType(&locDesc); // native type is the value type
-
- pslILDispatch->EmitLDARG(argidx); // we load the argument directly
- pslILDispatch->EmitLDOBJ(pslILDispatch->GetToken(pargs->mm.m_pMT));
-#else // _TARGET_X86_
- // On WIN64 platforms, copy-constructed arguments are actually passed by reference.
- // This is the same calling convention as used by managed code, but to maintain parity,
- // we mimic the x86 behaviour:
- //
- // 1) create new native value type local
- // 2) run new->CopyCtor(old)
- // 3) run old->Dtor()
-
- LocalDesc locDesc(pargs->mm.m_pMT);
-
- DWORD dwNewValueTypeLocal;
-
- // Step 1
- dwNewValueTypeLocal = pslIL->NewLocal(locDesc);
-
- // Step 2
- if (pargs->mm.m_pCopyCtor)
- {
- pslIL->EmitLDLOCA(dwNewValueTypeLocal);
- pslIL->EmitLDARG(argidx);
- pslIL->EmitCALL(pslIL->GetToken(pargs->mm.m_pCopyCtor), 2, 0);
- }
- else
- {
- pslIL->EmitLDARG(argidx);
- pslIL->EmitLDOBJ(pslIL->GetToken(pargs->mm.m_pMT));
- pslIL->EmitSTLOC(dwNewValueTypeLocal);
- }
-
- // Step 3
- if (pargs->mm.m_pDtor)
- {
- pslIL->EmitLDARG(argidx);
- pslIL->EmitCALL(pslIL->GetToken(pargs->mm.m_pDtor), 1, 0);
- }
-
- pslIL->SetStubTargetArgType(ELEMENT_TYPE_I); // native type is a pointer
- pslILDispatch->EmitLDLOCA(dwNewValueTypeLocal);
-#endif // _TARGET_X86_
-
- return OVERRIDDEN;
- }
- else
- {
- // nothing to do but pass the value along
- // note that on x86 the argument comes by-value but is converted to pointer by the UM thunk
- // so that we don't make copies that would not be accounted for by copy ctors
- LocalDesc locDesc(pargs->mm.m_pMT);
- locDesc.MakeCopyConstructedPointer();
-
- pslIL->SetStubTargetArgType(&locDesc); // native type is a pointer
- pslILDispatch->EmitLDARG(argidx);
-
- return OVERRIDDEN;
- }
-}
-#endif // FEATURE_CORECLR
LocalDesc ILArgIteratorMarshaler::GetNativeType()
{
diff --git a/src/vm/ilmarshalers.h b/src/vm/ilmarshalers.h
index 5337b081c6..7c7f9a6553 100644
--- a/src/vm/ilmarshalers.h
+++ b/src/vm/ilmarshalers.h
@@ -600,7 +600,7 @@ public:
nativeSize = wNativeSize;
}
-#if defined(_TARGET_X86_) || (defined(_TARGET_AMD64_) && defined(_WIN64) && !defined(FEATURE_CORECLR))
+#if defined(_TARGET_X86_)
// JIT32 and JIT64 (which is only used on the Windows Desktop CLR) has a problem generating
// code for the pinvoke ILStubs which do a return using a struct type. Therefore, we
// change the signature of calli to return void and make the return buffer as first argument.
@@ -2716,42 +2716,6 @@ protected:
};
-#ifndef FEATURE_CORECLR
-class ILBlittableValueClassWithCopyCtorMarshaler : public ILMarshaler
-{
-public:
- enum
- {
- c_fInOnly = TRUE,
- c_nativeSize = VARIABLESIZE,
- c_CLRSize = sizeof(OBJECTREF),
- };
-
- LocalDesc GetManagedType()
- {
- LIMITED_METHOD_CONTRACT;
- return LocalDesc();
- }
-
- LocalDesc GetNativeType()
- {
- LIMITED_METHOD_CONTRACT;
- return LocalDesc();
- }
-
- static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
- BOOL byref,
- BOOL fin,
- BOOL fout,
- BOOL fManagedToNative,
- OverrideProcArgs* pargs,
- UINT* pResID,
- UINT argidx,
- UINT nativeStackOffset);
-
-
-};
-#endif // !FEATURE_CORECLR
class ILArgIteratorMarshaler : public ILMarshaler
diff --git a/src/vm/ilstubcache.cpp b/src/vm/ilstubcache.cpp
index 9cd904aec7..ff6bdc0335 100644
--- a/src/vm/ilstubcache.cpp
+++ b/src/vm/ilstubcache.cpp
@@ -531,47 +531,6 @@ MethodDesc* ILStubCache::GetStubMethodDesc(
}
}
-#ifndef FEATURE_CORECLR
- //
- // Publish ETW events for IL stubs
- //
- if (bFireETWCacheHitEvent)
- {
- if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, ILStubCacheHit))
- {
-
- SString strNamespaceOrClassName, strMethodName, strMethodSignature;
- UINT64 uModuleId = 0;
-
- if (pTargetMD)
- {
- pTargetMD->GetMethodInfoWithNewSig(strNamespaceOrClassName, strMethodName, strMethodSignature);
- uModuleId = (UINT64)pTargetMD->GetModule()->GetAddrModuleID();
- }
-
- DWORD dwToken = 0;
- if (pTargetMD)
- dwToken = pTargetMD->GetMemberDef();
-
- //
- // Truncate string fields. Make sure the whole event is less than 64KB
- //
- TruncateUnicodeString(strNamespaceOrClassName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
-
- FireEtwILStubCacheHit(
- GetClrInstanceId(), // ClrInstanceId
- uModuleId, // ModuleIdentifier
- (UINT64)pMD, // StubMethodIdentifier
- dwToken, // ManagedInteropMethodToken
- strNamespaceOrClassName.GetUnicode(), // ManagedInteropMethodNamespace
- strMethodName.GetUnicode(), // ManagedInteropMethodName
- strMethodSignature.GetUnicode() // ManagedInteropMethodSignature
- );
- }
- }
-#endif // !FEATURE_CORECLR
if (!pMD)
{
diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp
index b367dff45f..f4dc236b80 100644
--- a/src/vm/interoputil.cpp
+++ b/src/vm/interoputil.cpp
@@ -294,7 +294,6 @@ static const BinderMethodID s_stubsDisposableToClosable[] =
METHOD__IDISPOSABLE_TO_ICLOSABLE_ADAPTER__CLOSE
};
-#ifdef FEATURE_CORECLR
DEFINE_ASM_QUAL_TYPE_NAME(NCCWINRT_ASM_QUAL_TYPE_NAME, g_INotifyCollectionChanged_WinRTName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCMA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToManagedAdapterName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCWA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToWinRTAdapterName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
@@ -306,20 +305,6 @@ DEFINE_ASM_QUAL_TYPE_NAME(CMDMA_ASM_QUAL_TYPE_NAME, g_ICommandToManagedAdapterNa
DEFINE_ASM_QUAL_TYPE_NAME(CMDWA_ASM_QUAL_TYPE_NAME, g_ICommandToWinRTAdapterName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCEHWINRT_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventHandler_WinRT, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(PCEHWINRT_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventHandler_WinRT_Name, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#else
-DEFINE_ASM_QUAL_TYPE_NAME(NCCWINRT_ASM_QUAL_TYPE_NAME, g_INotifyCollectionChanged_WinRTName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NCCMA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToManagedAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NCCWA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToWinRTAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NPCWINRT_ASM_QUAL_TYPE_NAME, g_INotifyPropertyChanged_WinRTName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NPCMA_ASM_QUAL_TYPE_NAME, g_NotifyPropertyChangedToManagedAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NPCWA_ASM_QUAL_TYPE_NAME, g_NotifyPropertyChangedToWinRTAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(CMDWINRT_ASM_QUAL_TYPE_NAME, g_ICommand_WinRTName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(CMDMA_ASM_QUAL_TYPE_NAME, g_ICommandToManagedAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(CMDWA_ASM_QUAL_TYPE_NAME, g_ICommandToWinRTAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NCCEHWINRT_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventHandler_WinRT, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(PCEHWINRT_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventHandler_WinRT_Name, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-
-#endif
const WinRTInterfaceRedirector::NonMscorlibRedirectedInterfaceInfo WinRTInterfaceRedirector::s_rNonMscorlibInterfaceInfos[3] =
{
@@ -6942,12 +6927,6 @@ TypeHandle GetClassFromIInspectable(IUnknown* pUnk, bool *pfSupportsIInspectable
LPCWSTR pwszClassName = winrtClassName.GetRawBuffer(&cchClassName);
SString ssClassName(SString::Literal, pwszClassName, cchClassName);
-#ifndef FEATURE_CORECLR
- if (ETW_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATE_DYNAMICTYPEUSAGE_KEYWORD))
- {
- FireEtwIInspectableRuntimeClassName(pwszClassName, GetClrInstanceId());
- }
-#endif
// Check a cache to see if this has already been looked up.
AppDomain *pDomain = GetAppDomain();
diff --git a/src/vm/invokeutil.cpp b/src/vm/invokeutil.cpp
index f53c8fe546..63979a3b21 100644
--- a/src/vm/invokeutil.cpp
+++ b/src/vm/invokeutil.cpp
@@ -1551,14 +1551,6 @@ void InvokeUtil::CanAccessClass(RefSecContext* pCtx,
InvokeUtil::CheckAccessClass(pCtx, pClass, checkAccessForImplicitValueTypeCtor);
-#ifndef FEATURE_CORECLR
- // Reflection invocation should turn critical method access into a full demand of full trust
- // for level 2 assemblies.
- if (InvokeUtil::IsCriticalWithConversionToFullDemand(pClass))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST);
- }
-#endif //FEATURE_CORECLR
}
#ifndef DACCESS_COMPILE
@@ -1579,30 +1571,12 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess() && !pParentMT->GetAssembly()->IsDisabledPrivateReflection())
- return;
-#endif // FEATURE_CORECLR
InvokeUtil::CheckAccessMethod(pSCtx,
pParentMT,
pInstanceMT,
pMeth);
-#ifndef FEATURE_CORECLR
- // Reflection invocation should turn critical method access into a full demand of full trust
- // for level 2 assemblies.
- if (fCriticalToFullDemand && InvokeUtil::IsCriticalWithConversionToFullDemand(pMeth, pParentMT))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST);
-
- // No need to do any more checks if a full trust full demand has succeeded.
- return;
- }
-#endif //FEATURE_CORECLR
if (pMeth->RequiresLinktimeCheck())
{
@@ -1648,7 +1622,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
GCPROTECT_END();
-#ifdef FEATURE_CORECLR
if (pMeth->IsNDirect() ||
(pMeth->IsComPlusCall() && !pMeth->IsInterface()))
{
@@ -1664,27 +1637,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
}
}
-#else // FEATURE_CORECLR
- // We perform automatic linktime checks for UnmanagedCode in three cases:
- // o P/Invoke calls.
- // o Calls through an interface that have a suppress runtime check
- // attribute on them (these are almost certainly interop calls).
- // o Interop calls made through method impls.
- if (pMeth->IsNDirect() ||
- (pMeth->IsInterface() &&
- (pMeth->GetMDImport()->GetCustomAttributeByName(pParentMT->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK ||
- pMeth->GetMDImport()->GetCustomAttributeByName(pMeth->GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK) ) ||
- (pMeth->IsComPlusCall() && !pMeth->IsInterface()))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_UNMANAGED_CODE);
- }
-#endif // FEATURE_CORECLR
}
// @todo:
@@ -1712,9 +1664,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
}
}
-#ifndef FEATURE_CORECLR
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_SKIP_VER);
-#endif // !FEATURE_CORECLR
}
}
#endif // #ifndef DACCESS_COMPILE
@@ -1734,14 +1683,6 @@ void InvokeUtil::CanAccessField(RefSecContext* pCtx,
InvokeUtil::CheckAccessField(pCtx, pTargetMT, pInstanceMT, pTargetField);
-#ifndef FEATURE_CORECLR
- // Reflection invocation should turn critical method access into a full demand of full trust
- // for level 2 assemblies.
- if (InvokeUtil::IsCriticalWithConversionToFullDemand(pTargetField, pInstanceMT))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST);
- }
-#endif //FEATURE_CORECLR
}
//
@@ -1990,7 +1931,6 @@ AccessCheckOptions::AccessCheckType InvokeUtil::GetInvocationAccessCheckType(BOO
AppDomain * pAppDomain = GetAppDomain();
-#ifdef FEATURE_CORECLR
if (pAppDomain->GetSecurityDescriptor()->IsFullyTrusted())
// Ignore transparency so that reflection invocation is consistenct with LCG.
@@ -1999,14 +1939,6 @@ AccessCheckOptions::AccessCheckType InvokeUtil::GetInvocationAccessCheckType(BOO
return AccessCheckOptions::kMemberAccess;
-#else // !FEATURE_CORECLR
- return
- AppX::IsAppXProcess() ?
- (Security::AllDomainsOnStackFullyTrusted() ?
- AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccessNoTransparency :
- AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccess) :
- AccessCheckOptions::kRestrictedMemberAccess;
-#endif //FEATURE_CORECLR
}
#endif // CROSSGEN_COMPILE
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index c96b68ba63..6d4fd897c4 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -63,9 +63,7 @@
#include "gccover.h"
#endif // HAVE_GCCOVER
-#ifdef FEATURE_CORECLR
#include "runtimehandles.h"
-#endif
//========================================================================
//
@@ -5830,13 +5828,11 @@ HCIMPL2(void, JIT_DelegateSecurityCheck, CORINFO_CLASS_HANDLE delegateHnd, CORIN
{
FCALL_CONTRACT;
-#ifdef FEATURE_CORECLR
// If we're in full trust, then we don't enforce the delegate binding rules
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
{
return;
}
-#endif // FEATURE_CORECLR
// Tailcall to the real implementation
ENDFORBIDGC();
@@ -6107,16 +6103,9 @@ NOINLINE HCIMPL1(void, JIT_VerificationRuntimeCheck_Internal, CORINFO_METHOD_HAN
HELPER_METHOD_FRAME_BEGIN_NOPOLL();
{
-#ifdef FEATURE_CORECLR
// Transparent methods that contains unverifiable code is not allowed.
MethodDesc *pMethod = GetMethod(methHnd_);
SecurityTransparent::ThrowMethodAccessException(pMethod);
-#else // FEATURE_CORECLR
- //
- // inject a full-demand for unmanaged code permission at runtime
- // around methods in transparent assembly that contains unverifiable code
- Security::SpecialDemand(SSWT_DECLARATIVE_DEMAND, SECURITY_UNMANAGED_CODE);
-#endif // FEATURE_CORECLR
}
HELPER_METHOD_FRAME_END_POLL();
}
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index f710dcf3eb..8ea9016179 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -160,11 +160,9 @@ BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver,
{
*pAccessCheckType = AccessCheckOptions::kRestrictedMemberAccess;
-#ifdef FEATURE_CORECLR
// For compatibility, don't do transparency checks from dynamic methods in FT CoreCLR.
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
*pAccessCheckType = AccessCheckOptions::kRestrictedMemberAccessNoTransparency;
-#endif // FEATURE_CORECLR
#ifdef FEATURE_COMPRESSEDSTACK
if (dwSecurityFlags & DynamicResolver::HasCreationContext)
@@ -173,11 +171,9 @@ BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver,
}
else
{
-#ifdef FEATURE_CORECLR
// For compatibility, don't do transparency checks from dynamic methods in FT CoreCLR.
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
*pAccessCheckType = AccessCheckOptions::kNormalAccessNoTransparency;
-#endif // FEATURE_CORECLR
}
return doAccessCheck;
@@ -537,14 +533,12 @@ CEEInfo::ConvToJitSig(
IfFailThrow(sig.GetCallingConvInfo(&data));
sigRet->callConv = (CorInfoCallConv) data;
-#if defined(FEATURE_CORECLR)
if ((isCallConv(sigRet->callConv, IMAGE_CEE_CS_CALLCONV_VARARG)) ||
(isCallConv(sigRet->callConv, IMAGE_CEE_CS_CALLCONV_NATIVEVARARG)))
{
// This signature corresponds to a method that uses varargs, which are not supported.
COMPlusThrow(kInvalidProgramException, IDS_EE_VARARG_NOT_SUPPORTED);
}
-#endif // FEATURE_CORECLR
// Skip number of type arguments
if (sigRet->callConv & IMAGE_CEE_CS_CALLCONV_GENERIC)
@@ -5588,11 +5582,9 @@ void CEEInfo::getCallInfo(
//This just throws.
if (pCalleeForSecurity->RequiresLinktimeCheck())
{
-#ifdef FEATURE_CORECLR
//hostProtectionAttribute(HPA) can be removed for coreclr mscorlib.dll
//So if the call to LinktimeCheckMethod() is only b'coz of HPA then skip it
if (!pCalleeForSecurity->RequiresLinkTimeCheckHostProtectionOnly())
-#endif
Security::LinktimeCheckMethod(pCallerForSecurity->GetAssembly(), pCalleeForSecurity);
}
@@ -5630,11 +5622,7 @@ void CEEInfo::getCallInfo(
pCalleeForSecurity,
NULL,
accessCheckOptions,
-#ifdef FEATURE_CORECLR
FALSE,
-#else
- TRUE,
-#endif //FEATURE_CORECLR
TRUE
);
@@ -5691,7 +5679,6 @@ void CEEInfo::getCallInfo(
{
BOOL fNeedsTransparencyCheck = TRUE;
-#ifdef FEATURE_CORECLR
// All LCG methods are transparent in CoreCLR. When we switch from PT
// to FT most user assemblies will become opportunistically critical.
// If a LCG method calls a method in such an assembly it will stop working.
@@ -5704,7 +5691,6 @@ void CEEInfo::getCallInfo(
// See also AccessCheckOptions::DemandMemberAccess.
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted() && pCallerForSecurity->IsLCGMethod())
fNeedsTransparencyCheck = FALSE;
-#endif // FEATURE_CORECLR
if (fNeedsTransparencyCheck)
{
@@ -5818,9 +5804,7 @@ BOOL CEEInfo::canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
doCheck = ModifyCheckForDynamicMethod(GetMethod(hCaller)->AsDynamicMethodDesc()->GetResolver(),
&accessingType, &accessCheckOptions, &pIgnored);
if (accessCheckOptions == AccessCheckOptions::kRestrictedMemberAccess
-#ifdef FEATURE_CORECLR
|| accessCheckOptions == AccessCheckOptions::kRestrictedMemberAccessNoTransparency
-#endif //FEATURE_CORECLR
)
doCheck = FALSE;
}
@@ -9784,11 +9768,7 @@ void CEEInfo::getEEInfo(CORINFO_EE_INFO *pEEInfoOut)
pEEInfoOut->osPageSize = OS_PAGE_SIZE;
pEEInfoOut->maxUncheckedOffsetForNullObject = MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT;
-#if defined(FEATURE_CORECLR)
pEEInfoOut->targetAbi = CORINFO_CORECLR_ABI;
-#else
- pEEInfoOut->targetAbi = CORINFO_DESKTOP_ABI;
-#endif
OSVERSIONINFO sVerInfo;
sVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -11803,10 +11783,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
CorJitResult ret = CORJIT_SKIPPED; // Note that CORJIT_SKIPPED is an error exit status code
-#if !defined(FEATURE_CORECLR)
- // Ask the JIT to generate desktop-quirk-compatible code.
- jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_DESKTOP_QUIRKS);
-#endif
comp->setJitFlags(jitFlags);
@@ -11818,14 +11794,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
BEGIN_SO_TOLERANT_CODE(GetThread());
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- ret = getJit()->compileMethod( comp,
- info,
- CORJIT_FLAGS::CORJIT_FLAG_CALL_GETJITFLAGS,
- nativeEntry,
- nativeSizeOfCode);
-
-#else // defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#if defined(ALLOW_SXS_JIT) && !defined(CROSSGEN_COMPILE)
if (FAILED(ret) && jitMgr->m_alternateJit
@@ -11923,7 +11891,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
}
#endif // !defined(CROSSGEN_COMPILE)
-#endif // defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#if defined(FEATURE_GDBJIT)
if (SUCCEEDED(ret) && *nativeEntry != NULL)
@@ -12130,12 +12097,10 @@ CORJIT_FLAGS GetDebuggerCompileFlags(Module* pModule, CORJIT_FLAGS flags)
{
STANDARD_VM_CONTRACT;
-#ifdef FEATURE_CORECLR
//Right now if we don't have a debug interface on CoreCLR, we can't generate debug info. So, in those
//cases don't attempt it.
if (!g_pDebugInterface)
return flags;
-#endif //FEATURE_CORECLR
#ifdef DEBUGGING_SUPPORTED
diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h
index df9e1d764c..d6dd5d2e65 100644
--- a/src/vm/jitinterface.h
+++ b/src/vm/jitinterface.h
@@ -413,59 +413,11 @@ extern "C"
void STDCALL JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle);
};
-#ifndef FEATURE_CORECLR
-//
-// Obfluscators that are hacking into the JIT expect certain methods to exist in certain places of CEEInfo vtable. Add artifical slots
-// to the vtable to avoid breaking apps by .NET 4.5 in-place update.
-//
-
-class ICorMethodInfo_Hack
-{
-public:
- virtual const char* __stdcall ICorMethodInfo_Hack_getMethodName (CORINFO_METHOD_HANDLE ftnHnd, const char** scopeName) = 0;
-};
-
-class ICorModuleInfo_Hack
-{
-public:
- virtual void ICorModuleInfo_Hack_dummy() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
-};
-
-class ICorClassInfo_Hack
-{
-public:
- virtual void ICorClassInfo_Hack_dummy1() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy2() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy3() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy4() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy5() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy6() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy7() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy8() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy9() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy10() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy11() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy12() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy13() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy14() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
-
- virtual mdMethodDef __stdcall ICorClassInfo_Hack_getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod) = 0;
-};
-
-class ICorStaticInfo_Hack : public virtual ICorMethodInfo_Hack, public virtual ICorModuleInfo_Hack, public virtual ICorClassInfo_Hack
-{
- virtual void ICorStaticInfo_Hack_dummy() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
-};
-
-#endif // FEATURE_CORECLR
/*********************************************************************/
/*********************************************************************/
class CEEInfo : public ICorJitInfo
-#ifndef FEATURE_CORECLR
- , public virtual ICorStaticInfo_Hack
-#endif
{
friend class CEEDynamicCodeInfo;
diff --git a/src/vm/metasig.h b/src/vm/metasig.h
index d4443e9c47..d317b421d6 100644
--- a/src/vm/metasig.h
+++ b/src/vm/metasig.h
@@ -339,10 +339,6 @@ DEFINE_METASIG_T(SM(RefDateTimeOffset_RefDateTimeNative_RetVoid, r(g(DATE_TIME_O
DEFINE_METASIG_T(SM(RealProxy_Class_RetBool, C(REAL_PROXY) C(CLASS), F))
#endif
-#ifndef FEATURE_CORECLR
-DEFINE_METASIG_T(SM(ExecutionContext_ContextCallback_Object_Bool_RetVoid, \
- C(EXECUTIONCONTEXT) C(CONTEXTCALLBACK) j F, v))
-#endif
#if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
DEFINE_METASIG_T(SM(SecurityContext_ContextCallback_Object_RetVoid, \
C(SECURITYCONTEXT) C(CONTEXTCALLBACK) j, v))
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index 07636d6950..c38128118d 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -31,9 +31,6 @@
#include "jitinterface.h"
#include "runtimehandles.h"
#include "eventtrace.h"
-#ifndef FEATURE_CORECLR
-#include "fxretarget.h"
-#endif
#include "interoputil.h"
#include "prettyprintsig.h"
#include "formattype.h"
@@ -5227,36 +5224,6 @@ LPVOID NDirectMethodDesc::FindEntryPoint(HINSTANCE hMod) const
DWORD nbytes = (DWORD)(strlen(GetEntrypointName()) + 1);
szAnsiEntrypointName[nbytes] = '\0'; // Add an extra '\0'.
-#if !defined(FEATURE_CORECLR) && defined(_WIN64)
- //
- // Forward {Get|Set}{Window|Class}Long to their corresponding Ptr version
- //
-
- // LONG SetWindowLong( HWND hWnd, int nIndex, LONG dwNewLong);
- // LONG_PTR SetWindowLongPtr(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
- //
- // LONG GetWindowLong( HWND hWnd, int nIndex);
- // LONG_PTR GetWindowLongPtr(HWND hWnd, int nIndex);
- //
- // DWORD GetClassLong( HWND hWnd, int nIndex);
- // ULONG_PTR GetClassLongPtr( HWND hWnd, int nIndex);
- //
- // DWORD SetClassLong( HWND hWnd, int nIndex, LONG dwNewLong);
- // ULONG_PTR SetClassLongPtr( HWND hWnd, int nIndex, LONG_PTR dwNewLong);
-
- if (!SString::_stricmp(GetEntrypointName(), "SetWindowLong") ||
- !SString::_stricmp(GetEntrypointName(), "GetWindowLong") ||
- !SString::_stricmp(GetEntrypointName(), "SetClassLong") ||
- !SString::_stricmp(GetEntrypointName(), "GetClassLong"))
- {
- szAnsiEntrypointName[nbytes-1] = 'P';
- szAnsiEntrypointName[nbytes+0] = 't';
- szAnsiEntrypointName[nbytes+1] = 'r';
- szAnsiEntrypointName[nbytes+2] = '\0';
- szAnsiEntrypointName[nbytes+3] = '\0';
- nbytes += 3;
- }
-#endif // !FEATURE_CORECLR && _WIN64
// If the program wants the ANSI api or if Unicode APIs are unavailable.
if (IsNativeAnsi())
@@ -5279,25 +5246,6 @@ LPVOID NDirectMethodDesc::FindEntryPoint(HINSTANCE hMod) const
if (!pFunc)
{
-#if !defined(FEATURE_CORECLR)
- if (hMod == CLRGetModuleHandle(W("kernel32.dll")))
- {
- szAnsiEntrypointName[nbytes-1] = '\0';
- if (0==strcmp(szAnsiEntrypointName, "MoveMemory") ||
- 0==strcmp(szAnsiEntrypointName, "CopyMemory"))
- {
- pFunc = GetProcAddress(hMod, funcName = "RtlMoveMemory");
- }
- else if (0==strcmp(szAnsiEntrypointName, funcName = "FillMemory"))
- {
- pFunc = GetProcAddress(hMod, funcName = "RtlFillMemory");
- }
- else if (0==strcmp(szAnsiEntrypointName, funcName = "ZeroMemory"))
- {
- pFunc = GetProcAddress(hMod, funcName = "RtlZeroMemory");
- }
- }
-#endif // !FEATURE_CORECLR
#if defined(_TARGET_X86_)
/* try mangled names only for __stdcalls */
@@ -5365,29 +5313,6 @@ void MethodDesc::ComputeSuppressUnmanagedCodeAccessAttr(IMDInternalImport *pImpo
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- // We only care about this bit for NDirect and ComPlusCall
- if (!IsNDirect() && !IsComPlusCall())
- return;
-
- BOOL hasAttr = FALSE;
- HRESULT hr = pImport->GetCustomAttributeByName(GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL);
- IfFailThrow(hr);
- hasAttr = (hr == S_OK);
-
-
- if (IsNDirect())
- ((NDirectMethodDesc*)this)->SetSuppressUnmanagedCodeAccessAttr(hasAttr);
-
-#ifdef FEATURE_COMINTEROP
- if (IsComPlusCall())
- ((ComPlusCallMethodDesc*)this)->SetSuppressUnmanagedCodeAccessAttr(hasAttr);
-#endif
-
-#endif // FEATURE_COMINTEROP
}
//*******************************************************************************
@@ -5402,7 +5327,6 @@ BOOL MethodDesc::HasNativeCallableAttribute()
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
HRESULT hr = GetMDImport()->GetCustomAttributeByName(GetMemberDef(),
g_NativeCallableAttribute,
NULL,
@@ -5411,7 +5335,6 @@ BOOL MethodDesc::HasNativeCallableAttribute()
{
return TRUE;
}
-#endif //FEATURE_CORECLR
return FALSE;
}
@@ -5421,27 +5344,7 @@ BOOL MethodDesc::HasSuppressUnmanagedCodeAccessAttr()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return TRUE;
-#else // FEATURE_CORECLR
-
- // In AppX processes, there is only one full trust AppDomain, so there is never any need to do a security
- // callout on interop stubs
- if (AppX::IsAppXProcess())
- {
- return TRUE;
- }
-
- if (IsNDirect())
- return ((NDirectMethodDesc*)this)->HasSuppressUnmanagedCodeAccessAttr();
-#ifdef FEATURE_COMINTEROP
- else if (IsComPlusCall())
- return ((ComPlusCallMethodDesc*)this)->HasSuppressUnmanagedCodeAccessAttr();
-#endif // FEATURE_COMINTEROP
- else
- return FALSE;
-
-#endif // FEATURE_CORECLR
}
#ifdef FEATURE_COMINTEROP
diff --git a/src/vm/method.hpp b/src/vm/method.hpp
index 499112d149..75ff246dc3 100644
--- a/src/vm/method.hpp
+++ b/src/vm/method.hpp
@@ -2673,22 +2673,6 @@ public:
return (ndirect.m_wFlags & kNativeNoMangle) != 0;
}
-#ifndef FEATURE_CORECLR
- BOOL HasSuppressUnmanagedCodeAccessAttr() const
- {
- LIMITED_METHOD_CONTRACT;
-
- return (ndirect.m_wFlags & kHasSuppressUnmanagedCodeAccess) != 0;
- }
-
- void SetSuppressUnmanagedCodeAccessAttr(BOOL value)
- {
- LIMITED_METHOD_CONTRACT;
-
- if (value)
- ndirect.m_wFlags |= kHasSuppressUnmanagedCodeAccess;
- }
-#endif
DWORD GetECallID() const
{
@@ -3101,32 +3085,6 @@ public:
return m_pComPlusCallInfo->m_pEventProviderMD;
}
-#ifndef FEATURE_CORECLR
-
- BOOL HasSuppressUnmanagedCodeAccessAttr()
- {
- LIMITED_METHOD_CONTRACT;
-
- if (m_pComPlusCallInfo != NULL)
- {
- return (m_pComPlusCallInfo->m_flags & ComPlusCallInfo::kHasSuppressUnmanagedCodeAccess) != 0;
- }
-
- // it is possible that somebody will call this before we initialized m_pComPlusCallInfo
- return (GetMDImport()->GetCustomAttributeByName(GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK);
- }
-
- void SetSuppressUnmanagedCodeAccessAttr(BOOL value)
- {
- LIMITED_METHOD_CONTRACT;
-
- if (value)
- FastInterlockOr(reinterpret_cast<DWORD *>(&m_pComPlusCallInfo->m_flags), ComPlusCallInfo::kHasSuppressUnmanagedCodeAccess);
- }
-#endif // FEATURE_CORECLR
BOOL RequiresArgumentWrapping()
{
diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp
index 6fee50b9b1..1c3deb5995 100644
--- a/src/vm/methodtable.cpp
+++ b/src/vm/methodtable.cpp
@@ -9785,23 +9785,7 @@ bool MethodTable::ClassRequiresUnmanagedCodeCheck()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return false;
-#else
- // all WinRT types have an imaginary [SuppressUnmanagedCodeSecurity] attribute on them
- if (IsProjectedFromWinRT())
- return false;
-
- // In AppX processes, there is only one full trust AppDomain, so there is never any need to do a security
- // callout on interop stubs
- if (AppX::IsAppXProcess())
- return false;
-
- return GetMDImport()->GetCustomAttributeByName(GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_FALSE;
-#endif // FEATURE_CORECLR
}
#endif // !DACCESS_COMPILE
diff --git a/src/vm/methodtable.inl b/src/vm/methodtable.inl
index d91d52ca6e..cf79ffe2e0 100644
--- a/src/vm/methodtable.inl
+++ b/src/vm/methodtable.inl
@@ -373,26 +373,18 @@ inline BOOL MethodTable::HasFieldsWhichMustBeInited()
inline BOOL MethodTable::SupportsAutoNGen()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return GetAssembly()->SupportsAutoNGen();
-#else
return FALSE;
-#endif
}
//==========================================================================================
inline BOOL MethodTable::RunCCTorAsIfNGenImageExists()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return this->SupportsAutoNGen();
-#else
#ifdef FEATURE_CORESYSTEM
return TRUE; // On our coresystem builds we will always be using triton in the customer scenario.
#else
return FALSE;
#endif
-#endif
}
//==========================================================================================
diff --git a/src/vm/mlinfo.cpp b/src/vm/mlinfo.cpp
index 74bd536969..e5138db97f 100644
--- a/src/vm/mlinfo.cpp
+++ b/src/vm/mlinfo.cpp
@@ -52,19 +52,11 @@
DEFINE_ASM_QUAL_TYPE_NAME(URI_ASM_QUAL_TYPE_NAME, g_SystemUriClassName, g_SystemRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_FXKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCEVENTARGS_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventArgsName, g_ObjectModelAsmName, VER_ASSEMBLYVERSION_STR, g_FXKeyToken);
-#ifdef FEATURE_CORECLR
DEFINE_ASM_QUAL_TYPE_NAME(NCCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventArgsMarshalerName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#else
- DEFINE_ASM_QUAL_TYPE_NAME(NCCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventArgsMarshalerName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#endif
DEFINE_ASM_QUAL_TYPE_NAME(PCEVENTARGS_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventArgsName, g_ObjectModelAsmName, VER_ASSEMBLYVERSION_STR, g_FXKeyToken);
-#ifdef FEATURE_CORECLR
DEFINE_ASM_QUAL_TYPE_NAME(PCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventArgsMarshalerName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#else
- DEFINE_ASM_QUAL_TYPE_NAME(PCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventArgsMarshalerName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#endif
#define OLECOLOR_TO_SYSTEMCOLOR_METH_NAME "FromOle"
@@ -1523,9 +1515,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
CorNativeType nativeType = NATIVE_TYPE_DEFAULT;
Assembly *pAssembly = pModule->GetAssembly();
-#ifndef FEATURE_CORECLR
- BOOL fNeedsCopyCtor = FALSE;
-#endif // !FEATURE_CORECLR
m_BestFit = BestFit;
m_ThrowOnUnmappableChar = ThrowOnUnmappableChar;
m_ms = ms;
@@ -1636,23 +1625,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
IfFailGoto(sig.GetElemType(NULL), lFail);
mtype = sig.PeekElemTypeNormalized(pModule, pTypeContext);
-#ifndef FEATURE_CORECLR // no copy ctor support in CoreCLR
- // Check for Copy Constructor Modifier - peek closed elem type here to prevent ELEMENT_TYPE_VALUETYPE
- // turning into a primitive.
- if (sig.PeekElemTypeClosed(pModule, pTypeContext) == ELEMENT_TYPE_VALUETYPE)
- {
- // Skip ET_BYREF
- IfFailGoto(sigtmp.GetByte(NULL), lFail);
-
- if (sigtmp.HasCustomModifier(pModule, "Microsoft.VisualC.NeedsCopyConstructorModifier", ELEMENT_TYPE_CMOD_REQD) ||
- sigtmp.HasCustomModifier(pModule, "System.Runtime.CompilerServices.IsCopyConstructed", ELEMENT_TYPE_CMOD_REQD) )
- {
- mtype = ELEMENT_TYPE_VALUETYPE;
- fNeedsCopyCtor = TRUE;
- m_byref = FALSE;
- }
- }
-#endif // !FEATURE_CORECLR
}
else
{
@@ -1695,21 +1667,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
IfFailGoto(E_FAIL, lFail);
}
-#ifndef FEATURE_CORECLR
- // Check for Copy Constructor Modifier
- if (sigtmp.HasCustomModifier(pModule, "Microsoft.VisualC.NeedsCopyConstructorModifier", ELEMENT_TYPE_CMOD_REQD) ||
- sigtmp.HasCustomModifier(pModule, "System.Runtime.CompilerServices.IsCopyConstructed", ELEMENT_TYPE_CMOD_REQD) )
- {
- mtype = mtype2;
-
- // Keep the sig pointer in sync with mtype (skip ELEMENT_TYPE_PTR) because for the rest
- // of this method we are pretending that the parameter is a value type passed by-value.
- IfFailGoto(sig.GetElemType(NULL), lFail);
-
- fNeedsCopyCtor = TRUE;
- m_byref = FALSE;
- }
-#endif // !FEATURE_CORECLR
}
}
else
@@ -2804,29 +2761,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
}
else
{
-#ifndef FEATURE_CORECLR
- if (fNeedsCopyCtor)
- {
- if (m_ms == MARSHAL_SCENARIO_WINRT)
- {
- // our WinRT-optimized GetCOMIPFromRCW helpers don't support copy
- // constructor stubs so make sure that this marshaler will not be used
- m_resID = IDS_EE_BADMARSHAL_WINRT_COPYCTOR;
- IfFailGoto(E_FAIL, lFail);
- }
-
- MethodDesc *pCopyCtor;
- MethodDesc *pDtor;
- FindCopyCtor(pModule, m_pMT, &pCopyCtor);
- FindDtor(pModule, m_pMT, &pDtor);
-
- m_args.mm.m_pMT = m_pMT;
- m_args.mm.m_pCopyCtor = pCopyCtor;
- m_args.mm.m_pDtor = pDtor;
- m_type = MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR;
- }
- else
-#endif // !FEATURE_CORECLR
#ifdef _TARGET_X86_
// JIT64 is not aware of normalized value types and this optimization
// (returning small value types by value in registers) is already done in JIT64.
@@ -2908,7 +2842,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
lExit:
#ifdef FEATURE_COMINTEROP
-#ifdef FEATURE_CORECLR
//Field scenario is not blocked here because we don't want to block loading structs that
//have the types which we are blocking, but never pass it to Interop.
@@ -2948,7 +2881,6 @@ lExit:
COMPlusThrow(kPlatformNotSupportedException, m_resID);
}
-#endif // FEATURE_CORECLR
if (IsWinRTScenario() && !IsSupportedForWinRT(m_type))
{
@@ -3559,9 +3491,6 @@ UINT16 MarshalInfo::GetNativeSize(MarshalType mtype, MarshalScenario ms)
{
case MARSHAL_TYPE_BLITTABLEVALUECLASS:
case MARSHAL_TYPE_VALUECLASS:
-#ifndef FEATURE_CORECLR
- case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
-#endif // !FEATURE_CORECLR
return (UINT16) m_pMT->GetNativeSize();
default:
@@ -4213,9 +4142,6 @@ DispParamMarshaler *MarshalInfo::GenerateDispParamMarshaler()
case MARSHAL_TYPE_BLITTABLEVALUECLASS:
case MARSHAL_TYPE_BLITTABLEPTR:
case MARSHAL_TYPE_LAYOUTCLASSPTR:
-#ifndef FEATURE_CORECLR
- case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
-#endif
pDispParamMarshaler = new DispParamRecordMarshaler(m_pMT);
break;
@@ -4519,11 +4445,6 @@ VOID MarshalInfo::MarshalTypeToString(SString& strMarshalType, BOOL fSizeIsSpeci
case MARSHAL_TYPE_ARGITERATOR:
strRetVal = W("ArgIterator");
break;
-#ifndef FEATURE_CORECLR
- case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
- strRetVal = W("blittable value class with copy constructor");
- break;
-#endif // FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
case MARSHAL_TYPE_OBJECT:
strRetVal = W("VARIANT");
@@ -5269,7 +5190,6 @@ void ArrayMarshalInfo::InitElementInfo(CorNativeType arrayNativeType, MarshalInf
}
}
-#ifdef FEATURE_CORECLR
// Avoid throwing exceptions for any managed structs that have layouts and have types of fields that gets default to those banned types by default
// We don't know if they will be passed to native code anyway, and the right place to make the check is in the marshallers
if (AppX::IsAppXProcess() && ms != MarshalInfo::MARSHAL_SCENARIO_FIELD)
@@ -5286,7 +5206,6 @@ void ArrayMarshalInfo::InitElementInfo(CorNativeType arrayNativeType, MarshalInf
if (set_error)
COMPlusThrow(kPlatformNotSupportedException, m_resID);
}
-#endif // FEATURE_CORECLR
// If we are exporting, we need to substitute the VTHACK_* VARTYPE with the actual
// types as expressed in the type library.
diff --git a/src/vm/mlinfo.h b/src/vm/mlinfo.h
index f66c9c6bd8..d1b46065e4 100644
--- a/src/vm/mlinfo.h
+++ b/src/vm/mlinfo.h
@@ -301,14 +301,6 @@ public:
return m_pWinRTPCEventArgsToSystemPCEventArgsMD;
}
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsEventArgsHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return (pMD == m_pSystemNCCEventArgsToWinRTNCCEventArgsMD || pMD == m_pWinRTNCCEventArgsToSystemNCCEventArgsMD ||
- pMD == m_pSystemPCEventArgsToWinRTPCEventArgsMD || pMD == m_pWinRTPCEventArgsToSystemPCEventArgsMD);
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
private:
TypeHandle m_hndSystemNCCEventArgsType;
@@ -384,13 +376,6 @@ public:
return m_SystemUriOriginalStringGetterMD;
}
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsUriHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return pMD == m_SystemUriCtorMD || pMD == m_SystemUriOriginalStringGetterMD;
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
private:
TypeHandle m_hndSystemUriType;
@@ -429,13 +414,6 @@ public:
return m_SystemColorToOleColorMD;
}
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsOleColorHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return pMD == m_OleColorToSystemColorMD || pMD == m_SystemColorToOleColorMD;
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
private:
TypeHandle m_hndColorType;
@@ -470,25 +448,6 @@ public:
UriMarshalingInfo *GetUriMarshalingInfo();
EventArgsMarshalingInfo *GetEventArgsMarshalingInfo();
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsOleColorHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return m_pOleColorInfo != NULL && m_pOleColorInfo->IsOleColorHelperMethod(pMD);
- }
-
- BOOL IsUriHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return m_pUriInfo != NULL && m_pUriInfo->IsUriHelperMethod(pMD);
- }
-
- BOOL IsEventArgsHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return m_pEventArgsInfo != NULL && m_pEventArgsInfo->IsEventArgsHelperMethod(pMD);
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
#endif // FEATURE_COMINTEROP
diff --git a/src/vm/mtypes.h b/src/vm/mtypes.h
index 603409b3dc..71241efa78 100644
--- a/src/vm/mtypes.h
+++ b/src/vm/mtypes.h
@@ -56,7 +56,7 @@ DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPWSTR_BUFFER, WSTRBufferMarshaler,
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPSTR_BUFFER, CSTRBufferMarshaler, false)
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_UTF8_BUFFER, UTF8BufferMarshaler, false)
-#if defined(FEATURE_COMINTEROP) || !defined(FEATURE_CORECLR)
+#if defined(FEATURE_COMINTEROP)
// CoreCLR doesn't have any support for marshalling interface pointers.
// Not even support for fake CCWs.
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_INTERFACE, InterfaceMarshaler, true)
@@ -89,9 +89,6 @@ DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VALUECLASS, ValueClassMa
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_REFERENCECUSTOMMARSHALER, ReferenceCustomMarshaler, false)
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ARGITERATOR, ArgIteratorMarshaler, false)
-#ifndef FEATURE_CORECLR
-DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR, BlittableValueClassWithCopyCtorMarshaler, false)
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_OBJECT, ObjectMarshaler, false)
diff --git a/src/vm/multicorejit.cpp b/src/vm/multicorejit.cpp
index 7660fd1895..98b290ec82 100644
--- a/src/vm/multicorejit.cpp
+++ b/src/vm/multicorejit.cpp
@@ -356,12 +356,8 @@ ModuleRecord::ModuleRecord(unsigned lenName, unsigned lenAsmName)
wLoadLevel = 0;
// Extra data
lenModuleName = (unsigned short) lenName;
-#if defined(FEATURE_CORECLR)
lenAssemblyName = (unsigned short) lenAsmName;
recordID += RoundUp(lenModuleName) + RoundUp(lenAssemblyName);
-#else
- recordID += RoundUp(lenModuleName);
-#endif
}
@@ -375,7 +371,6 @@ bool RecorderModuleInfo::SetModule(Module * pMod)
unsigned lenModuleName = (unsigned) strlen(pModuleName);
simpleName.Set((const BYTE *) pModuleName, lenModuleName); // SBuffer::Set copies over name
-#if defined(FEATURE_CORECLR)
SString sAssemblyName;
StackScratchBuffer scratch;
pMod->GetAssembly()->GetManifestFile()->GetDisplayName(sAssemblyName);
@@ -383,7 +378,6 @@ bool RecorderModuleInfo::SetModule(Module * pMod)
LPCUTF8 pAssemblyName = sAssemblyName.GetUTF8(scratch);
unsigned lenAssemblyName = sAssemblyName.GetCount();
assemblyName.Set((const BYTE *) pAssemblyName, lenAssemblyName);
-#endif
#if defined(FEATURE_APPX_BINDER)
@@ -422,12 +416,8 @@ HRESULT MulticoreJitRecorder::WriteModuleRecord(IStream * pStream, const Recorde
const void * pModuleName = module.simpleName;
unsigned lenModuleName = module.simpleName.GetSize();
-#if defined(FEATURE_CORECLR)
const void * pAssemblyName = module.assemblyName;
unsigned lenAssemblyName = module.assemblyName.GetSize();
-#else
- unsigned lenAssemblyName = 0;
-#endif
ModuleRecord mod(lenModuleName, lenAssemblyName);
@@ -442,12 +432,10 @@ HRESULT MulticoreJitRecorder::WriteModuleRecord(IStream * pStream, const Recorde
{
hr = WriteString(pModuleName, lenModuleName, pStream);
-#if defined(FEATURE_CORECLR)
if (SUCCEEDED(hr))
{
hr = WriteString(pAssemblyName, lenAssemblyName, pStream);
}
-#endif
}
return hr;
@@ -719,9 +707,6 @@ HRESULT MulticoreJitModuleEnumerator::EnumerateLoadedModules(AppDomain * pDomain
while (appIt.Next(pDomainAssembly.This()) && SUCCEEDED(hr))
{
-#if !defined(FEATURE_CORECLR)
- if (! pDomainAssembly->IsSystem())
-#endif
{
hr = HandleAssembly(pDomainAssembly);
}
@@ -854,9 +839,6 @@ void MulticoreJitRecorder::PreRecordFirstMethod()
// When running under Appx or CoreCLR for K, AppDomain is normally not shut down properly (CLR in hybrid case, or Alt-F4 shutdown),
// So we only allow writing out after profileWriteTimeout seconds
-#if !defined(FEATURE_CORECLR)
- if (m_fAppxMode)
-#endif
{
// Get the timeout in seconds.
int profileWriteTimeout = (int)CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MultiCoreJitProfileWriteDelay);
@@ -1061,11 +1043,7 @@ HRESULT MulticoreJitRecorder::StartProfile(const wchar_t * pRoot, const wchar_t
NewHolder<MulticoreJitProfilePlayer> player(new (nothrow) MulticoreJitProfilePlayer(
m_pDomain,
-#if defined(FEATURE_CORECLR)
m_pBinderContext,
-#else
- NULL,
-#endif
nSession,
m_fAppxMode));
@@ -1235,11 +1213,7 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, ICLRPrivBinder *pBin
{
MulticoreJitRecorder * pRecorder = new (nothrow) MulticoreJitRecorder(
pDomain,
-#if defined(FEATURE_CORECLR)
pBinderContext,
-#else
- NULL,
-#endif
m_fAppxMode);
if (pRecorder != NULL)
@@ -1473,17 +1447,6 @@ void MulticoreJitManager::RecordModuleLoad(Module * pModule, FileLoadLevel loadL
STANDARD_VM_CONTRACT;
-#if defined(FEATURE_APPX_BINDER) && !defined(FEATURE_CORECLR)
- // When running under Appx, allow framework assembly / first party winmd to load
- // load-level change not allowed in the background thread, unless for resource DLL (loaded for exception throwing), but this could still happen.
- _ASSERTE(! GetThread()->HasThreadStateNC(Thread::TSNC_CallingManagedCodeDisabled) || ModuleHasNoCode(pModule)
- || m_fAppxMode && IsLoadOkay(pModule));
-
-#elif !defined(FEATURE_CORECLR)
-
- _ASSERTE(! GetThread()->HasThreadStateNC(Thread::TSNC_CallingManagedCodeDisabled) || ModuleHasNoCode(pModule));
-
-#endif
if (m_fRecorderActive)
{
diff --git a/src/vm/multicorejitimpl.h b/src/vm/multicorejitimpl.h
index 58a9df7827..d7152a729b 100644
--- a/src/vm/multicorejitimpl.h
+++ b/src/vm/multicorejitimpl.h
@@ -179,9 +179,7 @@ public:
unsigned short flags;
unsigned short wLoadLevel;
unsigned short lenModuleName;
-#if defined(FEATURE_CORECLR)
unsigned short lenAssemblyName;
-#endif
ModuleRecord(unsigned lenName = 0, unsigned lenAssemblyName = 0);
@@ -201,7 +199,6 @@ public:
return (const char *) (this + 1); // after this record
}
-#if defined(FEATURE_CORECLR)
unsigned AssemblyNameLen() const
{
LIMITED_METHOD_CONTRACT;
@@ -213,7 +210,6 @@ public:
{
return GetModuleName() + RoundUp(lenModuleName); // after the module name
}
-#endif
void SetLoadLevel(FileLoadLevel loadLevel)
{
@@ -250,9 +246,7 @@ friend class MulticoreJitRecorder;
private:
ADID m_DomainID;
-#if defined(FEATURE_CORECLR)
ICLRPrivBinder * m_pBinderContext;
-#endif
LONG m_nMySession;
unsigned m_nStartTime;
BYTE * m_pFileBuffer;
@@ -300,9 +294,7 @@ private:
HRESULT ReadCheckFile(const wchar_t * pFileName);
-#if defined(FEATURE_CORECLR)
DomainAssembly * LoadAssembly(SString & assemblyName);
-#endif
public:
@@ -344,9 +336,7 @@ class MulticoreJitRecorder
{
private:
AppDomain * m_pDomain; // AutoStartProfile could be called from SystemDomain
-#if defined(FEATURE_CORECLR)
ICLRPrivBinder * m_pBinderContext;
-#endif
SString m_fullFileName;
MulticoreJitPlayerStat & m_stats;
@@ -393,9 +383,7 @@ public:
LIMITED_METHOD_CONTRACT;
m_pDomain = pDomain;
-#if defined(FEATURE_CORECLR)
m_pBinderContext = pBinderContext;
-#endif
m_JitInfoCount = 0;
m_ModuleCount = 0;
m_ModuleDepCount = 0;
diff --git a/src/vm/multicorejitplayer.cpp b/src/vm/multicorejitplayer.cpp
index 7d13bbc462..adf7a381f4 100644
--- a/src/vm/multicorejitplayer.cpp
+++ b/src/vm/multicorejitplayer.cpp
@@ -373,9 +373,7 @@ MulticoreJitProfilePlayer::MulticoreJitProfilePlayer(AppDomain * pDomain, ICLRPr
LIMITED_METHOD_CONTRACT;
m_DomainID = pDomain->GetId();
-#if defined(FEATURE_CORECLR)
m_pBinderContext = pBinderContext;
-#endif
m_nMySession = nSession;
m_moduleCount = 0;
m_headerModuleCount = 0;
@@ -464,12 +462,10 @@ bool MulticoreJitManager::IsSupportedModule(Module * pModule, bool fMethodJit, b
return false;
}
-#if defined(FEATURE_CORECLR)
if (pFile->GetPath().IsEmpty()) // Ignore in-memory modules
{
return false;
}
-#endif
if (! fMethodJit)
@@ -550,10 +546,8 @@ bool MulticoreJitProfilePlayer::CompileMethodDesc(Module * pModule, MethodDesc *
m_stats.m_nTryCompiling ++;
-#if defined(FEATURE_CORECLR)
// Reset the flag to allow managed code to be called in multicore JIT background thread from this routine
ThreadStateNCStackHolder holder(-1, Thread::TSNC_CallingManagedCodeDisabled);
-#endif
// MakeJitWorker calls back to MulticoreJitCodeStorage::StoreMethodCode under MethodDesc lock
pMD->MakeJitWorker(& header, CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND));
@@ -886,7 +880,6 @@ bool MulticoreJitProfilePlayer::HandleModuleDependency(unsigned jitInfo)
PlayerModuleInfo & mod = m_pModules[moduleTo];
-#if defined(FEATURE_CORECLR)
// Load the module if necessary.
if (!mod.m_pModule)
{
@@ -927,7 +920,6 @@ bool MulticoreJitProfilePlayer::HandleModuleDependency(unsigned jitInfo)
}
}
}
-#endif
if (mod.UpdateNeedLevel((FileLoadLevel) level))
{
@@ -941,7 +933,6 @@ bool MulticoreJitProfilePlayer::HandleModuleDependency(unsigned jitInfo)
return true;
}
-#if defined(FEATURE_CORECLR)
DomainAssembly * MulticoreJitProfilePlayer::LoadAssembly(SString & assemblyName)
{
STANDARD_VM_CONTRACT;
@@ -992,7 +983,6 @@ DomainAssembly * MulticoreJitProfilePlayer::LoadAssembly(SString & assemblyName)
return pDomainAssembly;
}
-#endif
inline bool MethodJifInfo(unsigned inst)
@@ -1052,17 +1042,6 @@ HRESULT MulticoreJitProfilePlayer::HandleMethodRecord(unsigned * buffer, int cou
}
else
{
-#if !defined(FEATURE_CORECLR)
- if (m_nBlockingCount != 0)
- {
- if (! GroupWaitForModuleLoad(m_stats.m_nTotalMethod + pos)) // wait for blocking modules
- {
- goto Abort;
- }
-
- _ASSERTE(m_nBlockingCount == 0);
- }
-#endif
// To reduce contention with foreground thread, walk backward within the group of methods Jittable methods, not broken apart by dependency
{
@@ -1093,11 +1072,7 @@ HRESULT MulticoreJitProfilePlayer::HandleMethodRecord(unsigned * buffer, int cou
PlayerModuleInfo & mod = m_pModules[inst >> 24];
-#if defined(FEATURE_CORECLR)
_ASSERTE(mod.IsModuleLoaded());
-#else
- _ASSERTE(mod.IsModuleLoaded() && ! mod.IsLowerLevel());
-#endif
if (mod.m_enableJit)
{
@@ -1313,9 +1288,7 @@ HRESULT MulticoreJitProfilePlayer::PlayProfile()
const ModuleRecord * pRec = (const ModuleRecord * ) pBuffer;
if (((unsigned)(pRec->lenModuleName
-#if defined(FEATURE_CORECLR)
+ pRec->lenAssemblyName
-#endif
) > (rcdLen - sizeof(ModuleRecord))) ||
(m_moduleCount >= m_headerModuleCount))
{
diff --git a/src/vm/nativeoverlapped.cpp b/src/vm/nativeoverlapped.cpp
index d0afbb648a..1f622275c6 100644
--- a/src/vm/nativeoverlapped.cpp
+++ b/src/vm/nativeoverlapped.cpp
@@ -61,13 +61,6 @@ FCIMPL3(void, CheckVMForIOPacket, LPOVERLAPPED* lpOverlapped, DWORD* errorCode,
// no user delegate to callback
_ASSERTE((overlapped->m_iocbHelper == NULL) || !"This is benign, but should be optimized");
-#ifndef FEATURE_CORECLR
- if (g_pAsyncFileStream_AsyncResultClass)
- {
- SetAsyncResultProperties(overlapped, *errorCode, *numBytes);
- }
- else
-#endif // !FEATURE_CORECLR
{
//We're not initialized yet, go back to the Vm, and process the packet there.
ThreadpoolMgr::StoreOverlappedInfoInThread(pThread, *errorCode, *numBytes, key, *lpOverlapped);
diff --git a/src/vm/ngenoptout.cpp b/src/vm/ngenoptout.cpp
index b192c4a5f0..50b47782a9 100644
--- a/src/vm/ngenoptout.cpp
+++ b/src/vm/ngenoptout.cpp
@@ -10,28 +10,3 @@
#include "common.h"
-#ifndef FEATURE_CORECLR
-#include "ngenoptout.h"
-#include "assemblynamelist.h"
-
-AssemblyNameList g_NgenOptoutList;
-
-BOOL IsNativeImageOptedOut(IAssemblyName* pName)
-{
- WRAPPER_NO_CONTRACT
- return g_NgenOptoutList.Lookup(pName) != NULL;
-}
-
-void AddNativeImageOptOut(IAssemblyName* pName)
-{
- WRAPPER_NO_CONTRACT
- pName->AddRef();
- g_NgenOptoutList.Add(pName);
-}
-// HRESULT
-HRESULT RuntimeIsNativeImageOptedOut(IAssemblyName* pName)
-{
- WRAPPER_NO_CONTRACT
- return IsNativeImageOptedOut(pName) ? S_OK :S_FALSE;
-}
-#endif // FEATURE_CORECLR
diff --git a/src/vm/object.cpp b/src/vm/object.cpp
index b219eb9e50..ba5610d377 100644
--- a/src/vm/object.cpp
+++ b/src/vm/object.cpp
@@ -1393,9 +1393,6 @@ void Object::ValidateHeap(Object *from, BOOL bDeep)
#ifdef FEATURE_REMOTING
this == OBJECTREFToObject(((ThreadBaseObject *)from)->m_ExposedContext) ||
#endif
-#ifndef FEATURE_CORECLR
- this == OBJECTREFToObject(((ThreadBaseObject *)from)->m_ExecutionContext) ||
-#endif
false))
{
if (((ThreadBaseObject *)from)->m_InternalThread)
diff --git a/src/vm/object.h b/src/vm/object.h
index f45cdbd9dd..f6a8f9b1ab 100644
--- a/src/vm/object.h
+++ b/src/vm/object.h
@@ -1731,79 +1731,6 @@ typedef LogicalCallContextObject* LOGICALCALLCONTEXTREF;
#endif // FEATURE_REMOTING
-#ifndef FEATURE_CORECLR
-class ExecutionContextObject : public Object
-{
- friend class MscorlibBinder;
-
- // These fields are also defined in the managed representation. (ExecutionContext.cs) If you
- // add or change these fields you must also change the managed code so that
- // it matches these. This is necessary so that the object is the proper
- // size.
-private :
-#ifdef FEATURE_CAS_POLICY
- OBJECTREF _hostExecutionContext;
-#endif // FEATURE_CAS_POLICY
- OBJECTREF _syncContext;
- OBJECTREF _syncContextNoFlow;
-#if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
- SECURITYCONTEXTREF _securityContext;
-#endif // #if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
-#ifdef FEATURE_REMOTING
- LOGICALCALLCONTEXTREF _logicalCallContext;
- OBJECTREF _illogicalCallContext;
-#endif // #ifdef FEATURE_REMOTING
- INT32 _flags;
- OBJECTREF _localValues;
- OBJECTREF _localChangeNotifications;
-
-public:
- OBJECTREF GetSynchronizationContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _syncContext;
- }
-#if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
- SECURITYCONTEXTREF GetSecurityContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _securityContext;
- }
-#endif // #if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
-#ifdef FEATURE_REMOTING
- LOGICALCALLCONTEXTREF GetLogicalCallContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _logicalCallContext;
- }
- void SetLogicalCallContext(LOGICALCALLCONTEXTREF ref)
- {
- WRAPPER_NO_CONTRACT;
- SetObjectReferenceUnchecked((OBJECTREF*)&_logicalCallContext, (OBJECTREF)ref);
- }
- OBJECTREF GetIllogicalCallContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _illogicalCallContext;
- }
- void SetIllogicalCallContext(OBJECTREF ref)
- {
- WRAPPER_NO_CONTRACT;
- SetObjectReferenceUnchecked((OBJECTREF*)&_illogicalCallContext, ref);
- }
-#endif //#ifdef FEATURE_REMOTING
-#ifdef FEATURE_COMPRESSEDSTACK
- COMPRESSEDSTACKREF GetCompressedStack()
- {
- WRAPPER_NO_CONTRACT;
- if (_securityContext != NULL)
- return _securityContext->GetCompressedStack();
- return NULL;
- }
-#endif // #ifdef FEATURE_COMPRESSEDSTACK
-
-};
-#endif //FEATURE_CORECLR
@@ -1821,9 +1748,6 @@ typedef REF<ArrayBase> ARRAYBASEREF;
#ifdef FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
typedef SynchronizationContextObject* SYNCHRONIZATIONCONTEXTREF;
#endif // FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
-#ifndef FEATURE_CORECLR
-typedef ExecutionContextObject* EXECUTIONCONTEXTREF;
-#endif
typedef CultureInfoBaseObject* CULTUREINFOBASEREF;
typedef PTR_ArrayBase ARRAYBASEREF;
#endif
@@ -1849,9 +1773,6 @@ class CultureInfoBaseObject : public Object
private:
OBJECTREF compareInfo;
OBJECTREF textInfo;
-#ifndef FEATURE_CORECLR
- OBJECTREF regionInfo;
-#endif // !FEATURE_CORECLR
OBJECTREF numInfo;
OBJECTREF dateTimeInfo;
OBJECTREF calendar;
@@ -2064,12 +1985,8 @@ private:
#ifdef FEATURE_REMOTING
OBJECTREF m_ExposedContext;
#endif
-#ifdef FEATURE_CORECLR
OBJECTREF m_ExecutionContext;
OBJECTREF m_SynchronizationContext;
-#else
- EXECUTIONCONTEXTREF m_ExecutionContext;
-#endif
OBJECTREF m_Name;
OBJECTREF m_Delegate;
#ifdef FEATURE_LEAK_CULTURE_INFO
@@ -2193,37 +2110,13 @@ public:
#endif // FEATURE_LEAK_CULTURE_INFO
#ifdef FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
-#ifdef FEATURE_CORECLR
OBJECTREF GetSynchronizationContext()
{
LIMITED_METHOD_CONTRACT;
return m_SynchronizationContext;
}
-#else // !FEATURE_CORECLR
- OBJECTREF GetSynchronizationContext()
- {
- LIMITED_METHOD_CONTRACT;
- if (m_ExecutionContext != NULL)
- {
- return m_ExecutionContext->GetSynchronizationContext();
- }
- return NULL;
- }
-#endif // FEATURE_CORECLR
#endif // FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
-#ifndef FEATURE_CORECLR
- OBJECTREF GetExecutionContext()
- {
- LIMITED_METHOD_CONTRACT;
- return (OBJECTREF)m_ExecutionContext;
- }
- void SetExecutionContext(OBJECTREF ref)
- {
- LIMITED_METHOD_CONTRACT;
- SetObjectReferenceUnchecked((OBJECTREF*)&m_ExecutionContext, ref);
- }
-#endif //!FEATURE_CORECLR
#ifdef FEATURE_COMPRESSEDSTACK
COMPRESSEDSTACKREF GetCompressedStack()
{
@@ -2497,46 +2390,6 @@ class AppDomainBaseObject : public MarshalByRefObjectBaseObject
#endif // FEATURE_EXCEPTION_NOTIFICATIONS
};
-#ifndef FEATURE_CORECLR
-// The managed definition of AppDomainSortingSetupInfo is in BCL\System\Globalization\AppDomainSortingSetupInfo.cs
-class AppDomainSortingSetupInfoObject : public Object
-{
- friend class MscorlibBinder;
-
- protected:
- INT_PTR m_pfnIsNLSDefinedString;
- INT_PTR m_pfnCompareStringEx;
- INT_PTR m_pfnLCMapStringEx;
- INT_PTR m_pfnFindNLSStringEx;
- INT_PTR m_pfnCompareStringOrdinal;
- INT_PTR m_pfnGetNLSVersionEx;
- INT_PTR m_pfnFindStringOrdinal;
- CLR_BOOL m_useV2LegacySorting;
- CLR_BOOL m_useV4LegacySorting;
-
- protected:
- AppDomainSortingSetupInfoObject() { LIMITED_METHOD_CONTRACT; }
- ~AppDomainSortingSetupInfoObject() { LIMITED_METHOD_CONTRACT; }
-
- public:
- CLR_BOOL UseV2LegacySorting() { LIMITED_METHOD_CONTRACT; return m_useV2LegacySorting; }
- CLR_BOOL UseV4LegacySorting() { LIMITED_METHOD_CONTRACT; return m_useV4LegacySorting; }
-
- INT_PTR GetPFNIsNLSDefinedString() { LIMITED_METHOD_CONTRACT; return m_pfnIsNLSDefinedString; }
- INT_PTR GetPFNCompareStringEx() { LIMITED_METHOD_CONTRACT; return m_pfnCompareStringEx; }
- INT_PTR GetPFNLCMapStringEx() { LIMITED_METHOD_CONTRACT; return m_pfnLCMapStringEx; }
- INT_PTR GetPFNFindNLSStringEx() { LIMITED_METHOD_CONTRACT; return m_pfnFindNLSStringEx; }
- INT_PTR GetPFNCompareStringOrdinal() { LIMITED_METHOD_CONTRACT; return m_pfnCompareStringOrdinal; }
- INT_PTR GetPFNGetNLSVersionEx() { LIMITED_METHOD_CONTRACT; return m_pfnGetNLSVersionEx; }
- INT_PTR GetPFNFindStringOrdinal() { LIMITED_METHOD_CONTRACT; return m_pfnFindStringOrdinal; }
-};
-typedef DPTR(AppDomainSortingSetupInfoObject) PTR_AppDomainSortingSetupInfoObject;
-#ifdef USE_CHECKED_OBJECTREFS
-typedef REF<AppDomainSortingSetupInfoObject> APPDOMAINSORTINGSETUPINFOREF;
-#else
-typedef AppDomainSortingSetupInfoObject* APPDOMAINSORTINGSETUPINFOREF;
-#endif // USE_CHECKED_OBJECTREFS
-#endif // FEATURE_CORECLR
// The managed definition of AppDomainSetup is in BCL\System\AppDomainSetup.cs
class AppDomainSetupObject : public Object
@@ -2557,9 +2410,6 @@ class AppDomainSetupObject : public Object
STRINGREF m_AppDomainManagerType;
OBJECTREF m_CompatFlags;
STRINGREF m_TargetFrameworkName;
-#ifndef FEATURE_CORECLR
- APPDOMAINSORTINGSETUPINFOREF m_AppDomainSortingSetupInfo;
-#endif // FEATURE_CORECLR
INT32 m_LoaderOptimization;
#ifdef FEATURE_COMINTEROP
CLR_BOOL m_DisableInterfaceCache;
@@ -2575,9 +2425,6 @@ class AppDomainSetupObject : public Object
~AppDomainSetupObject() { LIMITED_METHOD_CONTRACT; }
public:
-#ifndef FEATURE_CORECLR
- APPDOMAINSORTINGSETUPINFOREF GetAppDomainSortingSetupInfo() { LIMITED_METHOD_CONTRACT; return m_AppDomainSortingSetupInfo; }
-#endif // FEATURE_CORECLR
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
BOOL UseRandomizedStringHashing() { LIMITED_METHOD_CONTRACT; return (BOOL) m_UseRandomizedStringHashing; }
#endif // FEATURE_RANDOMIZED_STRING_HASHING
diff --git a/src/vm/olevariant.cpp b/src/vm/olevariant.cpp
index 75483fd5fe..a15a1979e2 100644
--- a/src/vm/olevariant.cpp
+++ b/src/vm/olevariant.cpp
@@ -2729,12 +2729,10 @@ void OleVariant::MarshalOleVariantForObject(OBJECTREF * const & pObj, VARIANT *p
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_BADMARSHAL_TYPE_VARIANTASOBJECT);
}
-#endif // FEATURE_CORECLR
SafeVariantClear(pOle);
@@ -2859,12 +2857,10 @@ void OleVariant::MarshalOleRefVariantForObject(OBJECTREF *pObj, VARIANT *pOle)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_BADMARSHAL_TYPE_VARIANTASOBJECT);
}
-#endif // FEATURE_CORECLR
HRESULT hr = MarshalCommonOleRefVariantForObject(pObj, pOle);
@@ -3084,12 +3080,10 @@ void OleVariant::MarshalObjectForOleVariant(const VARIANT * pOle, OBJECTREF * co
}
CONTRACT_END;
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_BADMARSHAL_TYPE_VARIANTASOBJECT);
}
-#endif // FEATURE_CORECLR
#ifdef MDA_SUPPORTED
MdaInvalidVariant* pProbe = MDA_GET_ASSISTANT(InvalidVariant);
diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp
index 86785e2417..4cc8859f98 100644
--- a/src/vm/pefile.cpp
+++ b/src/vm/pefile.cpp
@@ -83,10 +83,6 @@ PEFile::PEFile(PEImage *identity, BOOL fCheckAuthenticodeSignature/*=TRUE*/) :
m_pMDImport(NULL),
m_pImporter(NULL),
m_pEmitter(NULL),
-#ifndef FEATURE_CORECLR
- m_pAssemblyImporter(NULL),
- m_pAssemblyEmitter(NULL),
-#endif
m_pMetadataLock(::new SimpleRWLock(PREEMPTIVE, LOCK_TYPE_DEFAULT)),
m_refCount(1),
m_hash(NULL),
@@ -945,42 +941,6 @@ CHECK PEFile::CheckLoaded(BOOL bAllowNativeSkip/*=TRUE*/)
CHECK_OK;
}
-#ifndef FEATURE_CORECLR
-// ------------------------------------------------------------
-// Hash support
-// ------------------------------------------------------------
-
-#ifndef SHA1_HASH_SIZE
-#define SHA1_HASH_SIZE 20
-#endif
-
-void PEFile::GetSHA1Hash(SBuffer &result)
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- PRECONDITION(CheckValue(result));
- THROWS;
- MODE_ANY;
- GC_TRIGGERS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- // Cache the SHA1 hash in a buffer
- if (m_hash == NULL)
- {
- // We shouldn't have to compute a SHA1 hash in any scenarios
- // where the image opening should be suppressed.
- EnsureImageOpened();
-
- m_hash = new InlineSBuffer<SHA1_HASH_SIZE>();
- GetILimage()->ComputeHash(CALG_SHA1, *m_hash);
- }
-
- result.Set(*m_hash);
-}
-#endif // FEATURE_CORECLR
// ------------------------------------------------------------
// Metadata access
@@ -1242,9 +1202,7 @@ void PEFile::OpenMDImport_Unsafe()
return;
#ifdef FEATURE_PREJIT
if (m_nativeImage != NULL
-#ifdef FEATURE_CORECLR
&& m_nativeImage->GetMDImport() != NULL
-#endif
)
{
// Use native image for metadata
@@ -1297,58 +1255,6 @@ void PEFile::OpenEmitter()
pIMDEmit->Release();
}
-#ifndef FEATURE_CORECLR
-void PEFile::OpenAssemblyImporter()
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- // Make sure internal MD is in RW format.
- ConvertMDInternalToReadWrite();
-
- // Get the interface
- IMetaDataAssemblyImport *pIMDAImport = NULL;
- IfFailThrow(GetMetaDataPublicInterfaceFromInternal((void*)GetPersistentMDImport(),
- IID_IMetaDataAssemblyImport,
- (void **)&pIMDAImport));
-
- // Atomically swap it into the field (release it if we lose the race)
- if (FastInterlockCompareExchangePointer(&m_pAssemblyImporter, pIMDAImport, NULL) != NULL)
- pIMDAImport->Release();
-}
-
-void PEFile::OpenAssemblyEmitter()
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- // Make sure internal MD is in RW format.
- ConvertMDInternalToReadWrite();
-
- IMetaDataAssemblyEmit *pIMDAssemblyEmit = NULL;
- IfFailThrow(GetMetaDataPublicInterfaceFromInternal((void*)GetPersistentMDImport(),
- IID_IMetaDataAssemblyEmit,
- (void **)&pIMDAssemblyEmit));
-
- // Atomically swap it into the field (release it if we lose the race)
- if (FastInterlockCompareExchangePointer(&m_pAssemblyEmitter, pIMDAssemblyEmit, NULL) != NULL)
- pIMDAssemblyEmit->Release();
-}
-#endif // FEATURE_CORECLR
void PEFile::ReleaseMetadataInterfaces(BOOL bDestructor, BOOL bKeepNativeData/*=FALSE*/)
{
@@ -1362,18 +1268,6 @@ void PEFile::ReleaseMetadataInterfaces(BOOL bDestructor, BOOL bKeepNativeData/*=
}
CONTRACTL_END;
_ASSERTE(bDestructor || !m_bHasPersistentMDImport);
-#ifndef FEATURE_CORECLR
- if (m_pAssemblyImporter != NULL)
- {
- m_pAssemblyImporter->Release();
- m_pAssemblyImporter = NULL;
- }
- if(m_pAssemblyEmitter)
- {
- m_pAssemblyEmitter->Release();
- m_pAssemblyEmitter=NULL;
- }
-#endif
if (m_pImporter != NULL)
{
@@ -1440,10 +1334,6 @@ void PEFile::CheckAuthenticodeSignature()
// Failing to find a signature is OK.
LPWSTR pFileName = (LPWSTR) GetPath().GetUnicode();
DWORD dwAuthFlags = COR_NOUI|COR_NOPOLICY;
-#ifndef FEATURE_CORECLR
- // Authenticode Verification Start
- FireEtwAuthenticodeVerificationStart_V1(dwAuthFlags, 0, pFileName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
HRESULT hr = ::GetPublisher(pFileName,
NULL,
@@ -1451,10 +1341,6 @@ void PEFile::CheckAuthenticodeSignature()
&pCor,
&size);
-#ifndef FEATURE_CORECLR
- // Authenticode Verification End
- FireEtwAuthenticodeVerificationStop_V1(dwAuthFlags, (ULONG)hr, pFileName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
if( SUCCEEDED(hr) ) {
DWORD index = 0;
@@ -1743,17 +1629,10 @@ static void RuntimeVerifyLog(DWORD level, LoggableAssembly *pLogAsm, const WCHAR
static const LPCWSTR CorCompileRuntimeDllNames[NUM_RUNTIME_DLLS] =
{
-#ifdef FEATURE_CORECLR
MAKEDLLNAME_W(W("coreclr")),
-#else
- MAKEDLLNAME_W(W("CLR")),
-#endif
MAKEDLLNAME_W(W("clrjit"))
};
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-static LPCWSTR s_ngenCompilerDllName = NULL;
-#endif //!FEATURE_CORECLR && !CROSSGEN_COMPILE
LPCWSTR CorCompileGetRuntimeDllName(CorCompileRuntimeDlls id)
{
@@ -1767,36 +1646,6 @@ LPCWSTR CorCompileGetRuntimeDllName(CorCompileRuntimeDlls id)
}
CONTRACTL_END;
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- if (id == NGEN_COMPILER_INFO)
- {
- // The NGen compiler needs to be handled differently as it can be customized,
- // unlike the other runtime DLLs.
-
- if (s_ngenCompilerDllName == NULL)
- {
- // Check if there is an override for the compiler DLL
- LPCWSTR ngenCompilerOverride = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NGen_JitName);
-
- if (ngenCompilerOverride == NULL)
- {
- s_ngenCompilerDllName = DEFAULT_NGEN_COMPILER_DLL_NAME;
- }
- else
- {
- if (wcsstr(ngenCompilerOverride, W(".dll")) == NULL)
- {
- EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE,
- NGEN_COMPILER_OVERRIDE_KEY W(" should have a .DLL suffix"));
- }
-
- s_ngenCompilerDllName = ngenCompilerOverride;
- }
- }
-
- return s_ngenCompilerDllName;
- }
-#endif //!FEATURE_CORECLR && !CROSSGEN_COMPILE
return CorCompileRuntimeDllNames[id];
}
@@ -1823,33 +1672,17 @@ extern HMODULE CorCompileGetRuntimeDll(CorCompileRuntimeDlls id)
CONTRACTL_END;
// Currently special cased for every entry.
-#ifdef FEATURE_CORECLR
static_assert_no_msg(NUM_RUNTIME_DLLS == 2);
static_assert_no_msg(CORECLR_INFO == 0);
-#else // !FEATURE_CORECLR
- static_assert_no_msg(NUM_RUNTIME_DLLS == 2);
- static_assert_no_msg(CLR_INFO == 0);
- static_assert_no_msg(NGEN_COMPILER_INFO == 1);
-#endif // else FEATURE_CORECLR
HMODULE hMod = NULL;
// Try to load the correct DLL
switch (id)
{
-#ifdef FEATURE_CORECLR
case CORECLR_INFO:
hMod = GetCLRModule();
break;
-#else // !FEATURE_CORECLR
- case CLR_INFO:
- hMod = GetCLRModule();
- break;
-
- case NGEN_COMPILER_INFO:
- hMod = s_ngenCompilerDll;
- break;
-#endif // else FEATURE_CORECLR
default:
COMPlusThrowNonLocalized(kExecutionEngineException,
@@ -1869,68 +1702,6 @@ static BOOL RuntimeVerifyNativeImageTimestamps(const CORCOMPILE_VERSION_INFO *in
{
STANDARD_VM_CONTRACT;
-#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- //
- // We will automatically fail any zap files which were compiled with different runtime dlls.
- // This is so that we don't load bad ngen images after recompiling or patching the runtime.
- //
-
- for (DWORD index = 0; index < NUM_RUNTIME_DLLS; index++)
- {
- HMODULE hMod = CorCompileGetRuntimeDll((CorCompileRuntimeDlls)index);
-
- if (hMod == NULL)
- {
- // Unless this is an NGen worker process, we don't want to load JIT compiler just to do a timestamp check.
- // In an ideal case, all assemblies have native images, and JIT compiler never needs to be loaded at runtime.
- // Loading JIT compiler just to check its timestamp would reduce the benefits of have native images.
- // Since CLR and JIT are intended to be serviced together, the possibility of accidentally using native
- // images created by an older JIT is very small, and is deemed an acceptable risk.
- // Note that when multiple JIT compilers are used (e.g., clrjit.dll and compatjit.dll on x64 in .NET 4.6),
- // they must all be in the same patch family.
- if (!IsCompilationProcess())
- continue;
-
- // If we are doing ngen, then eagerly make sure all the system
- // dependencies are loaded. Else ICorCompileInfo::CheckAssemblyZap()
- // will not work correctly.
-
- LPCWSTR wszDllName = CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index);
- if (FAILED(g_pCLRRuntime->LoadLibrary(wszDllName, &hMod)))
- {
- EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("Unable to load CLR DLL during ngen"));
- }
- }
-
- _ASSERTE(hMod != NULL);
-
- PEDecoder pe(hMod);
-
- // Match NT header timestamp and checksum to test DLL identity
-
- if ((info->runtimeDllInfo[index].timeStamp == pe.GetTimeDateStamp()
- || info->runtimeDllInfo[index].timeStamp == 0)
- && (info->runtimeDllInfo[index].virtualSize == pe.GetVirtualSize()
- || info->runtimeDllInfo[index].virtualSize == 0))
- {
- continue;
- }
-
- {
- // set "ComPlus_CheckNGenImageTimeStamp" to 0 to ignore time-stamp-checking
- static ConfigDWORD checkNGenImageTimeStamp;
- BOOL enforceCheck = checkNGenImageTimeStamp.val(CLRConfig::EXTERNAL_CheckNGenImageTimeStamp);
-
- RuntimeVerifyLog(enforceCheck ? LL_ERROR : LL_WARNING,
- pLogAsm,
- W("Compiled with different CLR DLL (%s). Exact match expected."),
- CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index));
-
- if (enforceCheck)
- return FALSE;
- }
- }
-#endif // !CROSSGEN_COMPILE && !FEATURE_CORECLR
return TRUE;
}
@@ -1955,12 +1726,8 @@ BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
if (!image->CheckNativeHeaderVersion())
{
-#ifdef FEATURE_CORECLR
// Wrong native image version is fatal error on CoreCLR
ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
-#else
- return FALSE;
-#endif
}
CORCOMPILE_VERSION_INFO *info = image->GetNativeVersionInfo();
@@ -1970,15 +1737,10 @@ BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
LoggablePEAssembly logAsm(this);
if (!RuntimeVerifyNativeImageVersion(info, &logAsm))
{
-#ifdef FEATURE_CORECLR
// Wrong native image version is fatal error on CoreCLR
ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
-#else
- return FALSE;
-#endif
}
-#ifdef FEATURE_CORECLR
CorCompileConfigFlags configFlags = PEFile::GetNativeImageConfigFlagsWithOverrides();
if (IsSystem())
@@ -1999,36 +1761,10 @@ BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
{
return FALSE;
}
-#else
- //
- // Check image flavor. Skip this check in RuntimeVerifyNativeImageVersion called from fusion - fusion is responsible for choosing the right flavor.
- //
- if (!RuntimeVerifyNativeImageFlavor(info, &logAsm))
- {
- return FALSE;
- }
-#endif
return TRUE;
}
-#ifndef FEATURE_CORECLR
-//===========================================================================================================
-// Validates that an NI matches the required flavor (debug, instrumented, etc.)
-//
-//===========================================================================================================
-BOOL RuntimeVerifyNativeImageFlavor(const CORCOMPILE_VERSION_INFO *info, LoggableAssembly *pLogAsm)
-{
- STANDARD_VM_CONTRACT;
-
- CorCompileConfigFlags configFlags = PEFile::GetNativeImageConfigFlagsWithOverrides();
-
- if ((info->wConfigFlags & configFlags) != configFlags)
- return FALSE;
-
- return TRUE;
-}
-#endif
//===========================================================================================================
// Validates that an NI matches the running CLR, OS, CPU, etc.
@@ -2100,18 +1836,6 @@ BOOL RuntimeVerifyNativeImageVersion(const CORCOMPILE_VERSION_INFO *info, Loggab
}
#endif // CROSSGEN_COMPILE
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
- //
- // Check the right JIT compiler
- //
-
- bool nativeImageBuiltWithRyuJit = ((info->wCodegenFlags & CORCOMPILE_CODEGEN_USE_RYUJIT) != 0);
- if (UseRyuJit() != nativeImageBuiltWithRyuJit)
- {
- RuntimeVerifyLog(LL_ERROR, pLogAsm, W("JIT compiler used to generate native image doesn't match current JIT compiler."));
- return FALSE;
- }
-#endif
//
// The zap is up to date.
@@ -2990,11 +2714,7 @@ PEAssembly::PEAssembly(
m_creator(clr::SafeAddRef(creator)),
m_bIsFromGAC(FALSE),
m_bIsOnTpaList(FALSE)
-#ifdef FEATURE_CORECLR
,m_fProfileAssembly(0)
-#else
- ,m_fStrongNameBypassed(FALSE)
-#endif
{
CONTRACTL
{
@@ -3621,18 +3341,6 @@ PEAssembly *PEAssembly::DoOpenMemory(
if (!image->CheckILFormat())
ThrowHR(COR_E_BADIMAGEFORMAT, BFA_BAD_IL);
-#if !defined(FEATURE_CORECLR)
- if(pBinderToUse != NULL && !isIntrospectionOnly)
- {
- ReleaseHolder<ICLRPrivAssembly> pAsm;
- ReleaseHolder<IAssemblyName> pAssemblyName;
- IfFailThrow(pBinderToUse->BindAssemblyExplicit(image, &pAssemblyName, &pAsm));
- PEAssembly* pFile = nullptr;
- IfFailThrow(GetAppDomain()->BindHostedPrivAssembly(pParentAssembly, pAsm, pAssemblyName, &pFile));
- _ASSERTE(pFile);
- RETURN pFile;
- }
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_FUSION
RETURN new PEAssembly(image, NULL, NULL, NULL, NULL, NULL, NULL, pParentAssembly, FALSE, isIntrospectionOnly);
@@ -4203,35 +3911,13 @@ void PEAssembly::VerifyStrongName()
// checked, to handle the case where we are not loading m_image.
EnsureImageOpened();
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- if (IsWindowsRuntime())
- {
- // Winmd files are always loaded in full trust.
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- m_fStrongNameVerified = TRUE;
- return;
- }
-#endif
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
if (m_nativeImage == NULL && !GetILimage()->IsTrustedNativeImage())
-#else
- if (!GetILimage()->IsTrustedNativeImage())
-#endif
{
if (!GetILimage()->CheckILFormat())
ThrowHR(COR_E_BADIMAGEFORMAT);
}
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // Do not validate strong name signature during CrossGen. This is necessary
- // to make build-lab scenarios to work.
- if (IsCompilationProcess())
- {
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- }
- else
-#endif
// Check the strong name if present.
if (IsIntrospectionOnly())
{
@@ -4239,59 +3925,16 @@ void PEAssembly::VerifyStrongName()
// need to do module hash checks.
m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
}
-#if !defined(FEATURE_CORECLR)
- //We do this to early out for WinMD files that are unsigned but have NI images as well.
- else if (!HasStrongNameSignature())
- {
-#ifdef FEATURE_CAS_POLICY
- // We only check module hashes if there is a strong name or Authenticode signature
- if (m_certificate == NULL)
- {
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- }
-#endif
- }
-#endif // !defined(FEATURE_CORECLR)
else
{
-#ifdef FEATURE_CORECLR
// Runtime policy on CoreCLR is to skip verification of ALL assemblies
m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
m_fStrongNameVerified = TRUE;
-#else
- DWORD verifyOutputFlags = 0;
- HRESULT hr = GetILimage()->VerifyStrongName(&verifyOutputFlags);
-
- if (SUCCEEDED(hr))
- {
- // Strong name verified or delay sign OK'ed.
- // We will skip verification of modules in the delay signed case.
-
- if ((verifyOutputFlags & SN_OUTFLAG_WAS_VERIFIED) == 0)
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- }
- else
- {
- // Strong name missing or error. Throw in the latter case.
- if (hr != CORSEC_E_MISSING_STRONGNAME)
- ThrowHR(hr);
-
-#ifdef FEATURE_CAS_POLICY
- // Since we are not strong named, don't check module hashes.
- // (Unless we have a security certificate, in which case check anyway.)
-
- if (m_certificate == NULL)
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
-#endif
- }
-
-#endif // FEATURE_CORECLR
}
m_fStrongNameVerified = TRUE;
}
-#ifdef FEATURE_CORECLR
BOOL PEAssembly::IsProfileAssembly()
{
CONTRACTL
@@ -4324,7 +3967,6 @@ BOOL PEAssembly::IsProfileAssembly()
m_fProfileAssembly = bProfileAssembly ? 1 : -1;
return bProfileAssembly;
}
-#endif // FEATURE_CORECLR
// ------------------------------------------------------------
// Descriptive strings
@@ -5097,26 +4739,6 @@ LPCWSTR PEFile::GetPathForErrorMessages()
}
}
-#ifndef FEATURE_CORECLR
-BOOL PEAssembly::IsReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
- BOOL fReported = TRUE;
-
- if (!IsDynamic())
- fReported = m_identity->IsReportedToUsageLog();
-
- return fReported;
-}
-
-void PEAssembly::SetReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
-
- if (!IsDynamic())
- m_identity->SetReportedToUsageLog();
-}
-#endif // !FEATURE_CORECLR
#ifdef DACCESS_COMPILE
TADDR PEFile::GetMDInternalRWAddress()
@@ -5149,12 +4771,10 @@ PTR_ICLRPrivBinder PEFile::GetBindingContext()
PTR_ICLRPrivBinder pBindingContext = NULL;
-#if defined(FEATURE_CORECLR)
// Mscorlib is always bound in context of the TPA Binder. However, since it gets loaded and published
// during EEStartup *before* TPAbinder is initialized, we dont have a binding context to publish against.
// Thus, we will always return NULL for its binding context.
if (!IsSystem())
-#endif // defined(FEATURE_CORECLR)
{
pBindingContext = dac_cast<PTR_ICLRPrivBinder>(GetHostAssembly());
}
diff --git a/src/vm/pefile.h b/src/vm/pefile.h
index 413d08c185..7bb13a7977 100644
--- a/src/vm/pefile.h
+++ b/src/vm/pefile.h
@@ -194,9 +194,6 @@ public:
BOOL Equals(PEImage *pImage);
#endif // DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
- BOOL IsShareable();
-#endif
void GetMVID(GUID *pMvid);
@@ -572,10 +569,6 @@ protected:
#endif
IMetaDataImport2 *m_pImporter;
IMetaDataEmit *m_pEmitter;
-#ifndef FEATURE_CORECLR
- IMetaDataAssemblyImport *m_pAssemblyImporter;
- IMetaDataAssemblyEmit *m_pAssemblyEmitter;
-#endif
SimpleRWLock *m_pMetadataLock;
Volatile<LONG> m_refCount;
SBuffer *m_hash; // cached SHA1 hash value
@@ -728,19 +721,6 @@ class PEAssembly : public PEFile
// Public API
// ------------------------------------------------------------
-#if !defined(FEATURE_CORECLR)
- static PEAssembly * Open(
- PEAssembly * pParentAssembly,
- PEImage * pPEImageIL,
- PEImage * pPEImageNI,
- ICLRPrivAssembly * pHostAssembly,
- BOOL fIsIntrospectionOnly);
-
- static PEAssembly * Open(
- PEAssembly * pParentAssembly,
- PEImage * pPEImageIL,
- BOOL isIntrospectionOnly = FALSE);
-#else //!FEATURE_CORECLR
// CoreCLR's PrivBinder PEAssembly creation entrypoint
static PEAssembly * Open(
PEAssembly * pParent,
@@ -748,7 +728,6 @@ class PEAssembly : public PEFile
PEImage * pPEImageNI,
ICLRPrivAssembly * pHostAssembly,
BOOL fIsIntrospectionOnly = FALSE);
-#endif //!FEATURE_CORECLR
// This opens the canonical mscorlib.dll
#ifdef FEATURE_FUSION
@@ -846,9 +825,7 @@ class PEAssembly : public PEFile
// ------------------------------------------------------------
BOOL IsSourceGAC();
-#ifdef FEATURE_CORECLR
BOOL IsProfileAssembly();
-#endif // FEATURE_CORECLR
ULONG HashIdentity();
#ifdef FEATURE_FUSION
@@ -968,10 +945,6 @@ class PEAssembly : public PEFile
#endif
#endif
-#ifndef FEATURE_CORECLR
- BOOL IsReportedToUsageLog();
- void SetReportedToUsageLog();
-#endif // !FEATURE_CORECLR
protected:
@@ -1067,11 +1040,7 @@ class PEAssembly : public PEFile
// things
SString m_sTextualIdentity;
#endif
-#ifdef FEATURE_CORECLR
int m_fProfileAssembly; // Tri-state cache
-#else
- BOOL m_fStrongNameBypassed;
-#endif
public:
PTR_PEFile GetCreator()
diff --git a/src/vm/pefile.inl b/src/vm/pefile.inl
index 09cb89f548..76040e3551 100644
--- a/src/vm/pefile.inl
+++ b/src/vm/pefile.inl
@@ -179,23 +179,6 @@ inline BOOL PEFile::IsMarkedAsContentTypeWindowsRuntime()
return (IsAfContentType_WindowsRuntime(GetFlags()));
}
-#ifndef FEATURE_CORECLR
-inline BOOL PEFile::IsShareable()
-{
- CONTRACTL
- {
- PRECONDITION(CheckPointer(m_identity));
- MODE_ANY;
- THROWS;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- if (!m_identity->HasID())
- return FALSE;
- return TRUE ;
-}
-#endif
inline void PEFile::GetMVID(GUID *pMvid)
{
@@ -525,9 +508,6 @@ inline IMDInternalImport* PEFile::GetPersistentMDImport()
CONTRACT_END;
*/
SUPPORTS_DAC;
-#ifndef FEATURE_CORECLR
-_ASSERTE(m_bHasPersistentMDImport);
-#endif
#if !defined(__GNUC__)
_ASSERTE(!IsResource());
@@ -624,46 +604,6 @@ inline IMetaDataEmit *PEFile::GetEmitter()
RETURN m_pEmitter;
}
-#ifndef FEATURE_CORECLR
-inline IMetaDataAssemblyImport *PEFile::GetAssemblyImporter()
-{
- CONTRACT(IMetaDataAssemblyImport *)
- {
- INSTANCE_CHECK;
- MODE_ANY;
- GC_NOTRIGGER;
- PRECONDITION(!IsResource());
- POSTCONDITION(CheckPointer(RETVAL));
- PRECONDITION(m_bHasPersistentMDImport);
- THROWS;
- }
- CONTRACT_END;
-
- if (m_pAssemblyImporter == NULL)
- OpenAssemblyImporter();
-
- RETURN m_pAssemblyImporter;
-}
-
-inline IMetaDataAssemblyEmit *PEFile::GetAssemblyEmitter()
-{
- CONTRACT(IMetaDataAssemblyEmit *)
- {
- INSTANCE_CHECK;
- MODE_ANY;
- GC_NOTRIGGER;
- PRECONDITION(!IsResource());
- POSTCONDITION(CheckPointer(RETVAL));
- PRECONDITION(m_bHasPersistentMDImport);
- }
- CONTRACT_END;
-
- if (m_pAssemblyEmitter == NULL)
- OpenAssemblyEmitter();
-
- RETURN m_pAssemblyEmitter;
-}
-#endif // FEATURE_CORECLR
#endif // DACCESS_COMPILE
@@ -1391,7 +1331,7 @@ inline BOOL PEFile::IsPtrInILImage(PTR_CVOID data)
if (HasOpenedILimage())
{
-#if defined(FEATURE_PREJIT) && defined(FEATURE_CORECLR)
+#if defined(FEATURE_PREJIT)
if (m_openedILimage == m_nativeImage)
{
// On Apollo builds, we sometimes open the native image into the slot
@@ -1946,25 +1886,6 @@ inline BOOL PEAssembly::IsFullySigned()
}
}
-#ifndef FEATURE_CORECLR
-//---------------------------------------------------------------------------------------
-//
-// Mark that an assembly has had its strong name verification bypassed
-//
-
-inline void PEAssembly::SetStrongNameBypassed()
-{
- LIMITED_METHOD_CONTRACT;
- m_fStrongNameBypassed = TRUE;
-}
-
-inline BOOL PEAssembly::NeedsModuleHashChecks()
-{
- LIMITED_METHOD_CONTRACT;
-
- return ((m_flags & PEFILE_SKIP_MODULE_HASH_CHECKS) == 0) && !m_fStrongNameBypassed;
-}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_CAS_POLICY
//---------------------------------------------------------------------------------------
diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp
index 09b4176e22..1bb479c486 100644
--- a/src/vm/peimage.cpp
+++ b/src/vm/peimage.cpp
@@ -475,103 +475,13 @@ BOOL PEImage::Equals(PEImage *pImage)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// PEImage is always unique on CoreCLR so a simple pointer check is sufficient
_ASSERTE(m_bInHashMap || GetPath().IsEmpty());
_ASSERTE(pImage->m_bInHashMap || pImage->GetPath().IsEmpty());
return dac_cast<TADDR>(pImage) == dac_cast<TADDR>(this);
-#else // FEATURE_CORECLR
- if (pImage == this)
- return TRUE;
-
- if (GetPath().IsEmpty())
- {
-#ifdef FEATURE_FUSION
- if (m_fIsIStream && pImage->m_fIsIStream)
- {
- return (m_StreamAsmId == pImage->m_StreamAsmId) && (m_dwStreamModuleId == pImage->m_dwStreamModuleId);
- }
-#endif
-
- return FALSE;
- }
- else
- {
- BOOL ret = FALSE;
- HRESULT hr;
- EX_TRY
- {
- if (PathEquals(GetPath(), pImage->GetPath()))
- ret = TRUE;
- }
- EX_CATCH_HRESULT(hr); //<TODO>ignores failure!</TODO>
- return ret;
- }
-#endif // FEATURE_CORECLR
}
-#ifndef FEATURE_CORECLR
-void PEImage::ComputeHash(ALG_ID algorithm, SBuffer &result)
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- PRECONDITION(CheckStartup());
- PRECONDITION(CheckValue(result));
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- PEImageLayoutHolder pview(GetLayout(PEImageLayout::LAYOUT_FLAT,PEImage::LAYOUT_CREATEIFNEEDED));
-
- if (algorithm == CALG_SHA1)
- {
- SHA1Hash hasher;
- hasher.AddData((BYTE *) pview->GetBase(), pview->GetSize());
- result.Set(hasher.GetHash(), SHA1_HASH_SIZE);
- return;
- }
-
- DWORD size = 0;
- if(!StrongNameHashSize(algorithm, &size))
- {
- ThrowHR(StrongNameErrorInfo());
- }
-
- BYTE *buffer = result.OpenRawBuffer(size);
-
- DWORD hashSize;
- IfFailThrow(GetHashFromBlob((BYTE *) pview->GetBase(), pview->GetSize(), &algorithm, buffer, size, &hashSize));
-
- _ASSERTE(size == hashSize);
-
- result.CloseRawBuffer(hashSize);
-}
-
-CHECK PEImage::CheckHash(ALG_ID algorithm, const void *pbHash, COUNT_T cbHash)
-{
- CONTRACT_CHECK
- {
- INSTANCE_CHECK;
- PRECONDITION(CheckStartup());
- INSTANCE_CHECK;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACT_CHECK_END;
-
- StackSBuffer hash;
- ComputeHash(algorithm, hash);
-
- CHECK(hash.Equals((const BYTE *) pbHash, cbHash));
-
- CHECK_OK;
-}
-#endif // FEATURE_CORECLR
IMDInternalImport* PEImage::GetMDImport()
{
@@ -1419,9 +1329,6 @@ PEImage::PEImage():
m_bIsTrustedNativeImage(FALSE),
m_bIsNativeImageInstall(FALSE),
m_bPassiveDomainOnly(FALSE),
-#ifndef FEATURE_CORECLR
- m_fReportedToUsageLog(FALSE),
-#endif // !FEATURE_CORECLR
m_bInHashMap(FALSE),
#ifdef METADATATRACKER_DATA
m_pMDTracker(NULL),
@@ -1523,34 +1430,12 @@ PTR_PEImageLayout PEImage::GetLayoutInternal(DWORD imageLayoutMask,DWORD flags)
{
PEImageLayout * pLoadLayout = NULL;
-#ifdef FEATURE_CORECLR
if (m_bIsTrustedNativeImage || IsFile())
{
// For CoreCLR, try to load all files via LoadLibrary first. If LoadLibrary did not work, retry using
// regular mapping - but not for native images.
pLoadLayout = PEImageLayout::Load(this, TRUE /* bNTSafeLoad */, m_bIsTrustedNativeImage /* bThrowOnError */);
}
-#else
- if (m_bIsTrustedNativeImage)
- {
- pLoadLayout = PEImageLayout::Load(this, FALSE);
- }
- else if (m_bIsNativeImageInstall)
- {
- // When ESB (extended secure boot) is enabled, a native image that is being installed can
- // only be loaded flat.
- PEImageLayout* pFlatLayout=PEImageLayout::LoadFlat(GetFileHandle(),this);
- SetLayout(IMAGE_FLAT,pFlatLayout);
- pLoadLayout = new ConvertedImageLayout(pFlatLayout);
- }
-#ifdef FEATURE_READYTORUN
- else if (ReadyToRunInfo::IsReadyToRunEnabled() && IsFile())
- {
- pLoadLayout = PEImageLayout::Load(this, FALSE, FALSE);
- }
-#endif // FEATURE_READYTORUN
-
-#endif // FEATURE_CORECLR
if (pLoadLayout != NULL)
{
@@ -1569,46 +1454,9 @@ PTR_PEImageLayout PEImage::GetLayoutInternal(DWORD imageLayoutMask,DWORD flags)
// since LoadLibrary is needed if we are to actually load code.
if (pLayout->HasCorHeader() && pLayout->IsILOnly())
{
-#ifdef FEATURE_CORECLR
// For CoreCLR, IL only images will always be mapped. We also dont bother doing the conversion of PE header on 64bit,
// as done below for the desktop case, as there is no appcompat burden for CoreCLR on 64bit to have that conversion done.
fMarkAnyCpuImageAsLoaded = true;
-#else // !FEATURE_CORECLR
-
-#ifdef _WIN64
- // When attempting to load an assembly using LoadLibrary on x64,
- // the execution will go via the shell-shim that will try to determine
- // if the assembly is ILOnly with Pe32 header (i.e. built as anycpu). If it is,
- // it will convert the in-memory PEheader of the image to be PE32+ (i.e. mark it as 64bit image).
- //
- // Since we are trying to avoid mapping twice for ILOnly images by simply memory mapping them,
- // we should emulate the shell-shim behaviour for 64bit. This will allow inproc-components (e.g. ASP.NET),
- // which check for Pe32+ header, to continue working as expected.
- //
- // If we fail for some reason to change the header, in retail build, we will simply fallback to the double-loading behaviour without
- // any functional problems.
- if (pLayout->Has32BitNTHeaders())
- {
- fMarkAnyCpuImageAsLoaded = pLayout->ConvertILOnlyPE32ToPE64();
- }
- else
- {
- // Before assuming that PE32+ file can be loaded, confirm that
- // it is the expected machine type. This will ensure AMD64 does not load ARM64 or IA64 assemblies (and likewise).
- // If the machine type does not match, the Loader will fail the load at a later point.
- if (pLayout->GetMachine() == IMAGE_FILE_MACHINE_NATIVE)
- {
- fMarkAnyCpuImageAsLoaded = true; // PE32+ (aka native 64bit) binaries dont require any extra processing.
- }
- }
-#else // !_WIN64
- // Why can we not blindly assume that on 32bit OS, image should always be loaded? This is because it is possible to load
- // PE32+ image and map it to the 32bit process in WOW64.
- if (pLayout->Has32BitNTHeaders())
- fMarkAnyCpuImageAsLoaded = true;
-#endif // _WIN64
-
-#endif // FEATURE_CORECLR
}
pLayout.SuppressRelease();
@@ -1717,36 +1565,8 @@ void PEImage::Load()
}
else
{
-#ifdef FEATURE_CORECLR
if(m_pLayouts[IMAGE_LOADED]==NULL)
SetLayout(IMAGE_LOADED,PEImageLayout::Load(this,TRUE));
-#else
-
- //as part of Load() call we may initialize loaded image in DllMain
- //so we have to leave the lock and be prepared that when PEImageLayout::Load returns
- //m_pLayouts[IMAGE_LOADED] is set to something else
- lock.Release();
-
- FileHandleHolder pProtect=GetProtectingFileHandle(FALSE);
-
- // if the image is IL-only, try to load it in the safe manner
-
- // using the Internal function here because we are under the writer lock
- PEImageLayoutHolder pLayout=GetLayoutInternal(PEImageLayout::LAYOUT_ANY,0);
- BOOL bPreferSafeLoad=(pLayout && pLayout->IsILOnly());
-
- // Always use safe load during NGen to avoid running unmanaged code in IJW assemblies
- if (IsCompilationProcess())
- bPreferSafeLoad = TRUE;
-
- PEImageLayoutHolder pLoaded(PEImageLayout::Load(this,bPreferSafeLoad));
-
- lock.Acquire();
-
- if(m_pLayouts[IMAGE_LOADED]==NULL)
- SetLayout(IMAGE_LOADED,pLoaded.Extract());
-
-#endif // FEATURE_CORECLR
}
}
diff --git a/src/vm/peimage.h b/src/vm/peimage.h
index a7fe50e1e4..4a153b9304 100644
--- a/src/vm/peimage.h
+++ b/src/vm/peimage.h
@@ -261,13 +261,6 @@ public:
void VerifyIsAssembly();
void VerifyIsNIAssembly();
-#ifndef FEATURE_CORECLR
- BOOL IsReportedToUsageLog();
- void SetReportedToUsageLog();
-#ifndef DACCESS_COMPILE
- HRESULT GetILFingerprint(IILFingerprint **ppFingerprint);
-#endif //!DACCESS_COMPILE
-#endif //!FEATURE_CORECLR
static void GetAll(SArray<PEImage*> &images);
@@ -359,9 +352,6 @@ private:
BOOL m_bIsTrustedNativeImage;
BOOL m_bIsNativeImageInstall;
BOOL m_bPassiveDomainOnly;
-#ifndef FEATURE_CORECLR
- BOOL m_fReportedToUsageLog;
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_LAZY_COW_PAGES
BOOL m_bAllocatedLazyCOWPages;
#endif // FEATURE_LAZY_COW_PAGES
diff --git a/src/vm/peimage.inl b/src/vm/peimage.inl
index 4d913ea02b..6a0b3a07fb 100644
--- a/src/vm/peimage.inl
+++ b/src/vm/peimage.inl
@@ -405,47 +405,6 @@ inline const BOOL PEImage::HasStrongNameSignature()
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-inline const HRESULT PEImage::VerifyStrongName(DWORD* verifyOutputFlags)
-{
- WRAPPER_NO_CONTRACT;
- _ASSERTE(verifyOutputFlags);
- if (m_bSignatureInfoCached)
- {
- if (SUCCEEDED(m_hrSignatureInfoStatus))
- *verifyOutputFlags=m_dwSignatureInfo;
- return m_hrSignatureInfoStatus;
- }
-
- BOOL result = FALSE;
-
- PEImageLayoutHolder pLayout(GetLayout(PEImageLayout::LAYOUT_FLAT,0));
- if(pLayout!=NULL)
- {
- result = StrongNameSignatureVerificationFromImage((BYTE *) pLayout->GetBase(), pLayout->GetSize(),
- SN_INFLAG_INSTALL|SN_INFLAG_ALL_ACCESS,
- verifyOutputFlags);
- }
- else
- {
- CONSISTENCY_CHECK(!GetPath().IsEmpty());
- _ASSERTE(IsFileLocked());
- result = StrongNameSignatureVerification(GetPath(),
- SN_INFLAG_INSTALL|SN_INFLAG_ALL_ACCESS|SN_INFLAG_RUNTIME,
- verifyOutputFlags);
- }
-
- HRESULT hr=result?S_OK: StrongNameErrorInfo();
-
- if (SUCCEEDED(hr) || !Exception::IsTransient(hr))
- {
- m_hrSignatureInfoStatus=hr;
- m_dwSignatureInfo=*verifyOutputFlags;
- m_bSignatureInfoCached=TRUE;
- }
- return hr;
-}
-#endif // !FEATURE_CORECLR
#endif // !DACCESS_COMPILE
@@ -579,59 +538,6 @@ inline void PEImage::Init(LPCWSTR pPath)
}
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-/*static*/
-inline PTR_PEImage PEImage::FindByLongPath(LPCWSTR pPath)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(s_hashLock.OwnedByCurrentThread());
- }
- CONTRACTL_END;
-
- PathString sLongPath;
- COUNT_T nLen = WszGetLongPathName(pPath, sLongPath);
-
- // Check for any kind of error other than an insufficient buffer result.
- if (nLen == 0)
- {
- HRESULT hr=HRESULT_FROM_WIN32(GetLastError());
- if(Exception::IsTransient(hr))
- ThrowHR(hr);
- return (PEImage*)INVALIDENTRY;
- }
- return FindByPath(sLongPath.GetUnicode());
-}
-
-/*static*/
-inline PTR_PEImage PEImage::FindByShortPath(LPCWSTR pPath)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(s_hashLock.OwnedByCurrentThread());
- }
- CONTRACTL_END;
-
- PathString sShortPath;
- COUNT_T nLen = WszGetShortPathName(pPath, sShortPath);
-
- // Check for any kind of error other than an insufficient buffer result.
- if (nLen == 0)
- {
- HRESULT hr=HRESULT_FROM_WIN32(GetLastError());
- if(Exception::IsTransient(hr))
- ThrowHR(hr);
- return (PEImage*)INVALIDENTRY;
- }
- return FindByPath(sShortPath.GetUnicode());
-}
-#endif // !FEATURE_CORECLR
/*static*/
inline PTR_PEImage PEImage::FindByPath(LPCWSTR pPath)
@@ -673,13 +579,6 @@ inline PTR_PEImage PEImage::OpenImage(LPCWSTR pPath, MDInternalImportFlags flags
PEImage* found = FindByPath(pPath);
-#if !defined(FEATURE_CORECLR)
- if(found == (PEImage*) INVALIDENTRY && (flags & MDInternalImport_CheckLongPath))
- found=FindByLongPath(pPath);
-
- if(found == (PEImage*) INVALIDENTRY && (flags & MDInternalImport_CheckShortPath))
- found=FindByShortPath(pPath);
-#endif
if (found == (PEImage*) INVALIDENTRY)
{
@@ -874,19 +773,6 @@ inline void PEImage::GetPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine)
}
-#ifndef FEATURE_CORECLR
-inline BOOL PEImage::IsReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
- return m_fReportedToUsageLog;
-}
-
-inline void PEImage::SetReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
- m_fReportedToUsageLog = TRUE;
-}
-#endif // !FEATURE_CORECLR
#ifndef DACCESS_COMPILE
inline void PEImage::AllocateLazyCOWPages()
diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp
index 2b50adefb8..a84136a5bc 100644
--- a/src/vm/peimagelayout.cpp
+++ b/src/vm/peimagelayout.cpp
@@ -258,47 +258,6 @@ void PEImageLayout::ApplyBaseRelocations()
}
#endif // FEATURE_PREJIT
-#ifndef FEATURE_CORECLR
-// Event Tracing for Windows is used to log data for performance and functional testing purposes.
-// The events in this structure are used to measure the time taken by PE image mapping. This is useful to reliably measure the
-// performance of the assembly loader by subtracting the time taken by the possibly I/O-intensive work of PE image mapping.
-struct ETWLoaderMappingPhaseHolder { // Special-purpose holder structure to ensure the LoaderMappingPhaseEnd ETW event is fired when returning from a function.
- StackSString ETWCodeBase;
- DWORD _dwAppDomainId;
- BOOL initialized;
-
- ETWLoaderMappingPhaseHolder(){
- LIMITED_METHOD_CONTRACT;
- _dwAppDomainId = ETWAppDomainIdNotAvailable;
- initialized = FALSE;
- }
-
- void Init(DWORD dwAppDomainId, SString wszCodeBase) {
- _dwAppDomainId = dwAppDomainId;
-
- EX_TRY
- {
- ETWCodeBase.Append(wszCodeBase);
- ETWCodeBase.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- EX_CATCH
- {
- ETWCodeBase.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- FireEtwLoaderMappingPhaseStart(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, NULL, GetClrInstanceId());
-
- initialized = TRUE;
- }
-
- ~ETWLoaderMappingPhaseHolder() {
- if (initialized) {
- FireEtwLoaderMappingPhaseEnd(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, NULL, GetClrInstanceId());
- }
- }
-};
-#endif // FEATURE_CORECLR
RawImageLayout::RawImageLayout(const void *flat, COUNT_T size,PEImage* pOwner)
{
@@ -316,12 +275,6 @@ RawImageLayout::RawImageLayout(const void *flat, COUNT_T size,PEImage* pOwner)
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
if (size)
{
@@ -355,12 +308,6 @@ RawImageLayout::RawImageLayout(const void *mapped, PEImage* pOwner, BOOL bTakeOw
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
if (bTakeOwnership)
{
@@ -392,12 +339,6 @@ ConvertedImageLayout::ConvertedImageLayout(PEImageLayout* source)
PEFingerprintVerificationHolder verifyHolder(source->m_pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
if (!source->HasNTHeaders())
EEFileLoadException::Throw(GetPath(), COR_E_BADIMAGEFORMAT);
@@ -447,12 +388,6 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner)
#ifndef FEATURE_PAL
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
// Let OS map file for us
@@ -461,23 +396,12 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner)
if (m_FileMap == NULL)
{
#ifndef CROSSGEN_COMPILE
-#ifdef FEATURE_CORECLR
// There is no reflection-only load on CoreCLR and so we can always throw an error here.
// It is important on Windows Phone. All assemblies that we load must have SEC_IMAGE set
// so that the OS can perform signature verification.
ThrowLastError();
-#else // FEATURE_CORECLR
-
- // We need to ensure any signature validation errors are caught if Extended Secure Boot (ESB) is on.
- // Also, we have to always throw here during NGen to ensure that the signature validation is never skipped.
- if (GetLastError() != ERROR_BAD_EXE_FORMAT || IsCompilationProcess())
- {
- ThrowLastError();
- }
-
-#endif // FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
return;
@@ -624,12 +548,6 @@ LoadedImageLayout::LoadedImageLayout(PEImage* pOwner, BOOL bNTSafeLoad, BOOL bTh
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
DWORD dwFlags = GetLoadWithAlteredSearchPathFlag();
if (bNTSafeLoad)
@@ -667,12 +585,6 @@ FlatImageLayout::FlatImageLayout(HANDLE hFile, PEImage* pOwner)
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
COUNT_T size = SafeGetFileSize(hFile, NULL);
if (size == 0xffffffff && GetLastError() != NOERROR)
@@ -710,12 +622,6 @@ StreamImageLayout::StreamImageLayout(IStream* pIStream,PEImage* pOwner)
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
STATSTG statStg;
IfFailThrow(pIStream->Stat(&statStg, STATFLAG_NONAME));
diff --git a/src/vm/profilinghelper.cpp b/src/vm/profilinghelper.cpp
index 1dd60b47e1..b1fb228acb 100644
--- a/src/vm/profilinghelper.cpp
+++ b/src/vm/profilinghelper.cpp
@@ -138,9 +138,6 @@
#include "profilinghelper.inl"
#include "eemessagebox.h"
-#if defined(FEATURE_PROFAPI_EVENT_LOGGING) && !defined(FEATURE_CORECLR)
-#include <eventmsg.h>
-#endif // FEATURE_PROFAPI_EVENT_LOGGING) && !FEATURE_CORECLR
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
#include "profattach.h"
@@ -398,30 +395,8 @@ void ProfilingAPIUtility::LogProfEventVA(
AppendSupplementaryInformation(iStringResourceID, &messageToLog);
-#if defined(FEATURE_CORECLR)
// CoreCLR on Windows ouputs debug strings for diagnostic messages.
WszOutputDebugString(messageToLog);
-#else
- // Get the user SID for the current process, so it can be provided to the event
- // logging API, which will then fill out the "User" field in the event log entry. If
- // this fails, that's not fatal. We can just pass NULL for the PSID, and the "User"
- // field will be left blank.
- PSID psid = NULL;
- HRESULT hr = GetCurrentProcessUserSid(&psid);
- if (FAILED(hr))
- {
- // No biggie. Just pass in a NULL psid, and the User field will be empty
- _ASSERTE(psid == NULL);
- }
-
- // On desktop CLR builds, the profiling API uses the event log for end-user-friendly
- // diagnostic messages.
- ReportEventCLR(wEventType, // wType
- 0, // wCategory
- COR_Profiler, // dwEventID
- psid, // lpUserSid
- &messageToLog); // uh duh
-#endif // FEATURE_CORECLR
#endif // FEATURE_PROFAPI_EVENT_LOGGING
}
@@ -732,11 +707,7 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
// Find out if profiling is enabled
DWORD fProfEnabled = 0;
-#ifdef FEATURE_CORECLR
fProfEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_ENABLE_PROFILING);
-#else //FEATURE_CORECLR
- fProfEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_ENABLE_PROFILING);
-#endif //FEATURE_CORECLR
// If profiling is not enabled, return.
if (fProfEnabled == 0)
@@ -751,7 +722,6 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
NewArrayHolder<WCHAR> wszClsid(NULL);
NewArrayHolder<WCHAR> wszProfilerDLL(NULL);
-#ifdef FEATURE_CORECLR
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER, &wszClsid));
#if defined(_TARGET_X86_)
@@ -763,19 +733,6 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
{
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH, &wszProfilerDLL));
}
-#else // FEATURE_CORECLR
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER, &wszClsid));
-
-#if defined(_TARGET_X86_)
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH_32, &wszProfilerDLL));
-#elif defined(_TARGET_AMD64_)
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH_64, &wszProfilerDLL));
-#endif
- if(wszProfilerDLL == NULL)
- {
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH, &wszProfilerDLL));
- }
-#endif // FEATURE_CORECLR
// If the environment variable doesn't exist, profiling is not enabled.
if (wszClsid == NULL)
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp
index da66dbde44..18702d7b60 100644
--- a/src/vm/proftoeeinterfaceimpl.cpp
+++ b/src/vm/proftoeeinterfaceimpl.cpp
@@ -4727,16 +4727,10 @@ HRESULT ProfToEEInterfaceImpl::SetILInstrumentedCodeMap(FunctionID functionId,
if (!pMethodDesc ->IsRestored())
return CORPROF_E_DATAINCOMPLETE;
-#ifdef FEATURE_CORECLR
if (g_pDebugInterface == NULL)
{
return CORPROF_E_DEBUGGING_DISABLED;
}
-#else
- // g_pDebugInterface is initialized on startup on desktop CLR, regardless of whether a debugger
- // or profiler is loaded. So it should always be available.
- _ASSERTE(g_pDebugInterface != NULL);
-#endif // FEATURE_CORECLR
COR_IL_MAP * rgNewILMapEntries = new (nothrow) COR_IL_MAP[cILMapEntries];
@@ -5181,16 +5175,10 @@ HRESULT ProfToEEInterfaceImpl::GetILToNativeMapping2(FunctionID functionId,
return E_INVALIDARG;
}
-#ifdef FEATURE_CORECLR
if (g_pDebugInterface == NULL)
{
return CORPROF_E_DEBUGGING_DISABLED;
}
-#else
- // g_pDebugInterface is initialized on startup on desktop CLR, regardless of whether a debugger
- // or profiler is loaded. So it should always be available.
- _ASSERTE(g_pDebugInterface != NULL);
-#endif // FEATURE_CORECLR
return (g_pDebugInterface->GetILToNativeMapping(pMD, cMap, pcMap, map));
#else
@@ -8681,11 +8669,7 @@ HRESULT ProfToEEInterfaceImpl::GetRuntimeInformation(USHORT * pClrInstanceId,
if (pRuntimeType != NULL)
{
-#ifdef FEATURE_CORECLR
*pRuntimeType = COR_PRF_CORE_CLR;
-#else // FEATURE_CORECLR
- *pRuntimeType = COR_PRF_DESKTOP_CLR;
-#endif // FEATURE_CORECLR
}
if (pMajorVersion != NULL)
diff --git a/src/vm/readytoruninfo.cpp b/src/vm/readytoruninfo.cpp
index a0e44ceaf3..b1be026a6c 100644
--- a/src/vm/readytoruninfo.cpp
+++ b/src/vm/readytoruninfo.cpp
@@ -491,13 +491,8 @@ PTR_ReadyToRunInfo ReadyToRunInfo::Initialize(Module * pModule, AllocMemTracker
if (!pLayout->IsNativeMachineFormat())
{
-#ifdef FEATURE_CORECLR
// For CoreCLR, be strict about disallowing machine mismatches.
COMPlusThrowHR(COR_E_BADIMAGEFORMAT);
-#else
- DoLog("Ready to Run disabled - mismatched architecture");
- return NULL;
-#endif
}
#ifdef FEATURE_NATIVE_IMAGE_GENERATION
diff --git a/src/vm/reflectclasswriter.h b/src/vm/reflectclasswriter.h
index 486a25a78f..afd33c067b 100644
--- a/src/vm/reflectclasswriter.h
+++ b/src/vm/reflectclasswriter.h
@@ -91,11 +91,6 @@ public:
m_pOnDiskEmitter = pOnDiskEmitter;
}
-#ifndef FEATURE_CORECLR
- //HRESULT EnsureCeeFileGenCreated(DWORD corhFlags = COMIMAGE_FLAGS_ILONLY, DWORD peFlags = ICEE_CREATE_FILE_PURE_IL);
- HRESULT EnsureCeeFileGenCreated(DWORD corhFlags, DWORD peFlags);
- HRESULT DestroyCeeFileGen();
-#endif
~RefClassWriter();
};
diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp
index 4a2be35581..6311bdf65d 100644
--- a/src/vm/reflectioninvocation.cpp
+++ b/src/vm/reflectioninvocation.cpp
@@ -234,13 +234,6 @@ FCIMPL5(void, ReflectionInvocation::PerformVisibilityCheckOnField, FieldDesc *pF
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess())
- return;
-#endif
REFLECTCLASSBASEREF refDeclaringType = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(pDeclaringTypeUNSAFE);
@@ -262,9 +255,6 @@ FCIMPL5(void, ReflectionInvocation::PerformVisibilityCheckOnField, FieldDesc *pF
bool targetRemoted = FALSE;
-#ifndef FEATURE_CORECLR
- targetRemoted = targetObj != NULL && InvokeUtil::IsTargetRemoted(pFieldDesc, targetObj->GetMethodTable());
-#endif //FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
@@ -593,16 +583,6 @@ FCIMPL6(Object*, RuntimeTypeHandle::CreateInstance, ReflectClassBaseObject* refT
if (!securityOff)
{
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess())
- {
- bNeedAccessCheck = false;
- }
- else
-#endif //FEATURE_CORECLR
{
// Public critical types cannot be accessed by transparent callers
bNeedAccessCheck = !pVMT->IsExternallyVisible() || Security::TypeRequiresTransparencyCheck(pVMT);
@@ -871,109 +851,6 @@ FCIMPL1(DWORD, ReflectionInvocation::GetSpecialSecurityFlags, ReflectMethodObjec
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-
-// Can not inline this function.
-#ifdef _MSC_VER
-__declspec(noinline)
-#endif
-void PerformSecurityCheckHelper(Object *targetUnsafe, MethodDesc *pMeth, MethodTable* pParentMT, DWORD dwFlags)
-{
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
-
- PRECONDITION(CheckPointer(pMeth));
- }
- CONTRACTL_END;
-
- OBJECTREF target (targetUnsafe);
- GCPROTECT_BEGIN (target);
- FrameWithCookie<DebuggerSecurityCodeMarkFrame> __dbgSecFrame;
-
- bool targetRemoted = false;
-
-#ifndef FEATURE_CORECLR
- targetRemoted = target != NULL && InvokeUtil::IsTargetRemoted(pMeth, target->GetMethodTable());
-#endif //FEATURE_CORECLR
-
- RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
-
- MethodTable* pInstanceMT = NULL;
- if (target != NULL) {
- if (!target->GetTypeHandle().IsTypeDesc())
- pInstanceMT = target->GetTypeHandle().AsMethodTable();
- }
-
-#ifdef FEATURE_CORECLR
- if (dwFlags & (INVOCATION_FLAGS_RISKY_METHOD|INVOCATION_FLAGS_IS_DELEGATE_CTOR))
- {
- // On CoreCLR we assert that "dangerous" methods (see IsDangerousMethods) can only
- // be reflection-invoked by platform code (C or SC).
-
- // Also, for delegates, in desktop we used to demand unmanaged
- // code permission for this since it's hard to validate the target address.
- // Here we just restrict access to Critical code.
- MethodDesc *pCallerMD = sCtx.GetCallerMethod();
-
- if (pCallerMD && Security::IsMethodTransparent(pCallerMD))
- {
- ThrowMethodAccessException(pCallerMD, pMeth, FALSE, IDS_E_TRANSPARENT_REFLECTION);
- }
- }
-
- if (dwFlags & (INVOCATION_FLAGS_NEED_SECURITY|INVOCATION_FLAGS_CONSTRUCTOR_INVOKE))
-#endif
- {
-
- if (dwFlags & INVOCATION_FLAGS_CONSTRUCTOR_INVOKE)
- InvokeUtil::CanAccessMethod(pMeth,
- pParentMT,
- pInstanceMT,
- &sCtx,
- TRUE /*fCriticalToFullDemand*/);
- else
- InvokeUtil::CanAccessMethod(pMeth,
- pParentMT,
- pInstanceMT,
- &sCtx,
- TRUE /*fCriticalToFullDemand*/,
- (dwFlags & INVOCATION_FLAGS_IS_CTOR) != 0 /*checkSkipVer*/);
- }
-
- __dbgSecFrame.Pop();
- GCPROTECT_END();
-}
-
-FCIMPL4(void, ReflectionInvocation::PerformSecurityCheck, Object *target, MethodDesc *pMeth, ReflectClassBaseObject *pParentUNSAFE, DWORD dwFlags) {
- CONTRACTL {
- FCALL_CHECK;
- PRECONDITION(CheckPointer(pMeth));
- }
- CONTRACTL_END;
-
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess())
- return;
-#endif
-
- REFLECTCLASSBASEREF refParent = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(pParentUNSAFE);
-
- HELPER_METHOD_FRAME_BEGIN_1(refParent);
- //CAUTION: PerformSecurityCheckHelper could trigger GC!
-
- TypeHandle parent = refParent != NULL ? refParent->GetType() : TypeHandle();
- PerformSecurityCheckHelper(target,pMeth,parent.GetMethodTable(),dwFlags);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-#endif // FEATURE_CORECLR
/****************************************************************************/
/* boxed Nullable<T> are represented as a boxed T, so there is no unboxed
@@ -1207,9 +1084,7 @@ void DECLSPEC_NORETURN ThrowInvokeMethodException(MethodDesc * pMethod, OBJECTRE
GCPROTECT_BEGIN(targetException);
#if defined(_DEBUG) && !defined(FEATURE_PAL)
-#ifdef FEATURE_CORECLR
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
if (!CLRException::IsPreallocatedExceptionObject(targetException))
{
@@ -1258,9 +1133,7 @@ void DECLSPEC_NORETURN ThrowInvokeMethodException(MethodDesc * pMethod, OBJECTRE
OBJECTREF except = InvokeUtil::CreateTargetExcept(&targetException);
#ifndef FEATURE_PAL
-#ifdef FEATURE_CORECLR
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
struct
{
@@ -1961,9 +1834,6 @@ FCIMPL4(Object*, RuntimeFieldHandle::GetValueDirect, ReflectFieldObject *pFieldU
bool targetRemoted = false;
-#ifndef FEATURE_CORECLR
- targetRemoted = !targetType.IsNull() && InvokeUtil::IsTargetRemoted(pField, targetType.AsMethodTable());
-#endif //FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
@@ -2144,9 +2014,6 @@ FCIMPL5(void, RuntimeFieldHandle::SetValueDirect, ReflectFieldObject *pFieldUNSA
// security and consistency checks
bool targetRemoted = false;
-#ifndef FEATURE_CORECLR
- targetRemoted = targetType.IsNull() && InvokeUtil::IsTargetRemoted(pField, targetType.AsMethodTable());
-#endif //FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
@@ -2344,10 +2211,8 @@ FCIMPL1(void, ReflectionInvocation::RunClassConstructor, ReflectClassBaseObject
HELPER_METHOD_FRAME_BEGIN_1(refType);
// We perform the access check only on CoreCLR for backward compatibility.
-#ifdef FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType());
InvokeUtil::CanAccessClass(&sCtx, pMT);
-#endif //FEATURE_CORECLR
pMT->CheckRestore();
pMT->EnsureInstanceActive();
@@ -2389,116 +2254,6 @@ FCIMPL1(void, ReflectionInvocation::RunModuleConstructor, ReflectModuleBaseObjec
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-// This method triggers a given method to be jitted
-FCIMPL3(void, ReflectionInvocation::PrepareMethod, ReflectMethodObject* pMethodUNSAFE, TypeHandle *pInstantiation, UINT32 cInstantiation)
-{
- CONTRACTL {
- FCALL_CHECK;
- PRECONDITION(CheckPointer(pMethodUNSAFE, NULL_OK));
- PRECONDITION(CheckPointer(pInstantiation, NULL_OK));
- }
- CONTRACTL_END;
-
- REFLECTMETHODREF refMethod = (REFLECTMETHODREF)ObjectToOBJECTREF(pMethodUNSAFE);
-
- if (refMethod == NULL)
- FCThrowArgumentVoidEx(kArgumentException, NULL, W("InvalidOperation_HandleIsNotInitialized"));
-
- MethodDesc *pMD = refMethod->GetMethod();
-
- HELPER_METHOD_FRAME_BEGIN_1(refMethod);
-
- if (pMD->IsAbstract())
- COMPlusThrowArgumentNull(W("method"), W("Argument_CannotPrepareAbstract"));
-
- pMD->CheckRestore();
-
- MethodTable * pExactMT = pMD->GetMethodTable();
- if (pInstantiation != NULL)
- {
- // We were handed an instantiation, check that the method expects it and the right number of types has been provided (the
- // caller supplies one array containing the class instantiation immediately followed by the method instantiation).
- if (cInstantiation != (pMD->GetNumGenericMethodArgs() + pMD->GetNumGenericClassArgs()))
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
-
- // We need to find the actual class and/or method instantiations, even though we've been passed them. This is an issue of
- // lifetime -- the instantiation passed in will go away at some point whereas preparation of the method has the potential to
- // persist a copy of the instantiation pointer. By finding the actual instantiation we get a stable pointer whose lifetime
- // is at least as long as the data generated by preparation.
-
- // Check we've got a reasonable looking instantiation.
- if (!Generics::CheckInstantiation(Instantiation(pInstantiation, cInstantiation)))
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
- for (ULONG i = 0; i < cInstantiation; i++)
- if (pInstantiation[i].ContainsGenericVariables())
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
-
- // Load the exact type of the method if it needs to be instantiated (because it's a generic type definition, e.g. C<T>, or a
- // shared type instantiation, e.g. C<Object>).
- if (pExactMT->IsGenericTypeDefinition() || pExactMT->IsSharedByGenericInstantiations())
- {
- TypeHandle thExactType = ClassLoader::LoadGenericInstantiationThrowing(pMD->GetModule(),
- pMD->GetMethodTable()->GetCl(),
- Instantiation(pInstantiation, pMD->GetNumGenericClassArgs()));
- pExactMT = thExactType.AsMethodTable();
- }
-
- // As for the class we might need to find a method desc with an exact instantiation if the one we have is too vague.
- // Note: IsGenericMethodDefinition implies ContainsGenericVariables so there's no need to check it separately.
- if (pMD->IsSharedByGenericInstantiations() || pMD->ContainsGenericVariables())
- pMD = MethodDesc::FindOrCreateAssociatedMethodDesc(pMD,
- pExactMT,
- FALSE,
- Instantiation(&pInstantiation[pMD->GetNumGenericClassArgs()], pMD->GetNumGenericMethodArgs()),
- FALSE);
- }
- else
- {
- // No instantiation provided, the method better not be expecting one.
-
- // Methods that are generic definitions (e.g. C.Foo<U>) and those that are shared (e.g. C<Object>.Foo, C.Foo<Object>) need
- // extra instantiation data.
- // Note: IsGenericMethodDefinition implies ContainsGenericVariables so there's no need to check it separately.
- if (pMD->IsSharedByGenericInstantiations() || pMD->ContainsGenericVariables())
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
-
- // The rest of the cases (non-generics related methods, instantiating stubs, methods instantiated over non-shared types
- // etc.) should be able to provide their instantiation for us as necessary.
- }
-
- // Go prepare the method at the specified instantiation.
- PrepareMethodDesc(pMD, pExactMT->GetInstantiation(), pMD->GetMethodInstantiation());
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-// This method triggers a given delegate to be prepared. This involves preparing the
-// delegate's Invoke method and preparing the target of that Invoke. In the case of
-// a multi-cast delegate, we rely on the fact that each individual component was prepared
-// prior to the Combine. If our event sinks perform the Combine, this is always true.
-// If the client calls Combine himself, he is responsible for his own preparation.
-FCIMPL1(void, ReflectionInvocation::PrepareDelegate, Object* delegateUNSAFE)
-{
- CONTRACTL {
- FCALL_CHECK;
- PRECONDITION(CheckPointer(delegateUNSAFE, NULL_OK));
- }
- CONTRACTL_END;
-
- if (delegateUNSAFE == NULL)
- return;
-
- OBJECTREF delegate = ObjectToOBJECTREF(delegateUNSAFE);
- HELPER_METHOD_FRAME_BEGIN_1(delegate);
-
- PrepareDelegateHelper(&delegate, FALSE);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL1(void, ReflectionInvocation::PrepareContractedDelegate, Object * delegateUNSAFE)
{
diff --git a/src/vm/reflectioninvocation.h b/src/vm/reflectioninvocation.h
index 7f72b61cd8..a05a202e87 100644
--- a/src/vm/reflectioninvocation.h
+++ b/src/vm/reflectioninvocation.h
@@ -50,10 +50,6 @@ public:
static FCDECL1(void, RunClassConstructor, ReflectClassBaseObject *pTypeUNSAFE);
static FCDECL1(void, RunModuleConstructor, ReflectModuleBaseObject *pModuleUNSAFE);
-#ifndef FEATURE_CORECLR
- static FCDECL3(void, PrepareMethod, ReflectMethodObject* pMethodUNSAFE, TypeHandle *pInstantiation, UINT32 cInstantiation);
- static FCDECL1(void, PrepareDelegate, Object* delegateUNSAFE);
-#endif // !FEATURE_CORECLR
static FCDECL1(void, PrepareContractedDelegate, Object* delegateUNSAFE);
static FCDECL0(void, ProbeForSufficientStack);
static FCDECL0(void, EnsureSufficientExecutionStack);
diff --git a/src/vm/rejit.cpp b/src/vm/rejit.cpp
index 0b6e922831..7bbd0e2f71 100644
--- a/src/vm/rejit.cpp
+++ b/src/vm/rejit.cpp
@@ -447,16 +447,10 @@ HRESULT ProfilerFunctionControl::SetILInstrumentedCodeMap(ULONG cILMapEntries, C
return E_INVALIDARG;
}
-#ifdef FEATURE_CORECLR
if (g_pDebugInterface == NULL)
{
return CORPROF_E_DEBUGGING_DISABLED;
}
-#else
- // g_pDebugInterface is initialized on startup on desktop CLR, regardless of whether a debugger
- // or profiler is loaded. So it should always be available.
- _ASSERTE(g_pDebugInterface != NULL);
-#endif // FEATURE_CORECLR
// copy the il map and il map entries into the corresponding fields.
diff --git a/src/vm/rexcep.h b/src/vm/rexcep.h
index 3ff4963996..2089c27172 100644
--- a/src/vm/rexcep.h
+++ b/src/vm/rexcep.h
@@ -109,12 +109,8 @@
//
DEFINE_EXCEPTION(g_ReflectionNS, AmbiguousMatchException, false, COR_E_AMBIGUOUSMATCH)
-#ifdef FEATURE_CORECLR
// ApplicationException is removed in CoreCLR
#define kApplicationException kException
-#else
-DEFINE_EXCEPTION(g_SystemNS, ApplicationException, false, COR_E_APPLICATION)
-#endif // FEATURE_CORECLR
DEFINE_EXCEPTION(g_SystemNS, AppDomainUnloadedException, false, COR_E_APPDOMAINUNLOADED)
DEFINE_EXCEPTION(g_SystemNS, ArithmeticException, false, COR_E_ARITHMETIC)
@@ -142,12 +138,8 @@ DEFINE_EXCEPTION(g_SystemNS, BadImageFormatException, true,
META_E_BAD_SIGNATURE,
COR_E_LOADING_WINMD_REFERENCE_ASSEMBLY)
-#ifdef FEATURE_CORECLR
// CannotUnloadAppDomainException is removed in CoreCLR
#define kCannotUnloadAppDomainException kException
-#else
-DEFINE_EXCEPTION(g_SystemNS, CannotUnloadAppDomainException, false, COR_E_CANNOTUNLOADAPPDOMAIN)
-#endif // FEATURE_CORECLR
DEFINE_EXCEPTION(g_CodeContractsNS, ContractException, false, COR_E_CODECONTRACTFAILED)
@@ -160,9 +152,6 @@ DEFINE_EXCEPTION(g_ReflectionNS, CustomAttributeFormatException, false, C
#if defined(FEATURE_X509) || defined(FEATURE_CRYPTO)
DEFINE_EXCEPTION(g_CryptographyNS, CryptographicException, false, CORSEC_E_CRYPTO)
#endif // FEATURE_X509 || FEATURE_CRYPTO
-#ifndef FEATURE_CORECLR
-DEFINE_EXCEPTION(g_CryptographyNS, CryptographicUnexpectedOperationException, false, CORSEC_E_CRYPTO_UNEX_OPER)
-#endif // FEATURE_CORECLR
DEFINE_EXCEPTION(g_SystemNS, DataMisalignedException, false, COR_E_DATAMISALIGNED)
@@ -327,9 +316,7 @@ DEFINE_EXCEPTION(g_SystemNS, NotImplementedException, false, E
DEFINE_EXCEPTION(g_SystemNS, OutOfMemoryException, false, E_OUTOFMEMORY, CTL_E_OUTOFMEMORY, STD_CTL_SCODE(31001))
-#ifdef FEATURE_CORECLR
DEFINE_EXCEPTION(g_SystemNS, CrossAppDomainMarshaledException, false, E_FAIL)
-#endif //FEATURE_CORECLR
#ifdef FEATURE_ISOSTORE
DEFINE_EXCEPTION(g_IsolatedStorageNS, IsolatedStorageException, true,
diff --git a/src/vm/runtimecallablewrapper.cpp b/src/vm/runtimecallablewrapper.cpp
index 29999a7dad..dace892bf7 100644
--- a/src/vm/runtimecallablewrapper.cpp
+++ b/src/vm/runtimecallablewrapper.cpp
@@ -541,49 +541,9 @@ IClassFactory *ComClassFactory::GetIClassFactory()
StackSString ssServer;
if (FAILED(Clr::Util::Com::FindServerUsingCLSID(m_rclsid, ssServer)))
{
-#ifndef FEATURE_CORECLR
- // If there is no server entry, then that implies the CLSID could be implemented by CLR.DLL itself,
- // if the CLSID is one of the special ones implemented by the CLR. We need to check against the
- // specific list of CLSIDs here because CLR.DLL-implemented CLSIDs and managed class-implemented
- // CLSIDs look the same until you start interating the subkeys. For now, the set of CLSIDs implemented
- // by CLR.DLL is a short and tractable list, but at some point it might become worthwhile to move over
- // to the more generalized solution of looking for the entries that identify when the CLSID is
- // implemented by a managed type to avoid having to maintain the hardcoded list.
- if (IsClrHostedLegacyComObject(m_rclsid))
- {
- PDllGetClassObject pFN = NULL;
- hr = g_pCLRRuntime->GetProcAddress("DllGetClassObjectInternal", reinterpret_cast<void**>(&pFN));
-
- if (FAILED(hr))
- hr = g_pCLRRuntime->GetProcAddress("DllGetClassObject", reinterpret_cast<void**>(&pFN));
-
- if (SUCCEEDED(hr))
- hr = pFN(m_rclsid, IID_IClassFactory, (void**)&pClassFactory);
- }
-#endif
}
else
{
-#ifndef FEATURE_CORECLR
- // @CORESYSTODO: ?
-
- // There is a SxS DLL that implements this CLSID.
- // NOTE: It is standard practise for RCWs and P/Invokes to leak their module handles,
- // as there is no automated mechanism for the runtime to call CanUnloadDllNow.
- HMODULE hServer = NULL;
- if (SUCCEEDED(hr = g_pCLRRuntime->LoadLibrary(ssServer.GetUnicode(), &hServer)))
- {
- PDllGetClassObject pFN = reinterpret_cast<PDllGetClassObject>(GetProcAddress(hServer, "DllGetClassObject"));
- if (pFN != NULL)
- {
- hr = pFN(m_rclsid, IID_IClassFactory, (void**)&pClassFactory);
- }
- else
- {
- hr = HRESULT_FROM_GetLastError();
- }
- }
-#endif
}
}
#endif // FEATURE_CLASSIC_COMINTEROP
@@ -3107,12 +3067,10 @@ IUnknown *RCW::GetWellKnownInterface(REFIID riid)
// make sure it is on the right thread
IDispatch *RCW::GetIDispatch()
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_ERROR_IDISPATCH);
}
-#endif // FEATURE_CORECLR
WRAPPER_NO_CONTRACT;
return (IDispatch *)GetWellKnownInterface(IID_IDispatch);
@@ -4574,9 +4532,7 @@ bool RCW::SupportsMngStdInterface(MethodTable *pItfMT)
if (pItfMT == MscorlibBinder::GetExistingClass(CLASS__IENUMERABLE))
{
SafeComHolder<IDispatch> pDisp = NULL;
-#ifdef FEATURE_CORECLR
if (!AppX::IsAppXProcess())
-#endif // FEATURE_CORECLR
{
// Get the IDispatch on the current thread.
pDisp = GetIDispatch();
diff --git a/src/vm/runtimehandles.cpp b/src/vm/runtimehandles.cpp
index 65aeb45f97..32a9674da5 100644
--- a/src/vm/runtimehandles.cpp
+++ b/src/vm/runtimehandles.cpp
@@ -352,13 +352,6 @@ FCIMPL3(void, RuntimeMethodHandle::CheckLinktimeDemands, ReflectMethodObject *pM
}
}
-#ifndef FEATURE_CORECLR
- if (pCallee->RequiresLinktimeCheck())
- {
- Module *pModule = refModule->GetModule();
- Security::LinktimeCheckMethod(pDecoratedModule->GetAssembly(), pCallee);
- }
-#endif // !FEATURE_CORECLR
}
HELPER_METHOD_FRAME_END();
}
@@ -568,43 +561,6 @@ FCIMPLEND
-#ifndef FEATURE_CORECLR
-FCIMPL2(FC_BOOL_RET, RuntimeTypeHandle::IsEquivalentTo, ReflectClassBaseObject *rtType1UNSAFE, ReflectClassBaseObject *rtType2UNSAFE)
-{
- FCALL_CONTRACT;
-
- BOOL bResult = FALSE;
-
- REFLECTCLASSBASEREF rtType1 = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(rtType1UNSAFE);
- REFLECTCLASSBASEREF rtType2 = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(rtType2UNSAFE);
-
- HELPER_METHOD_FRAME_BEGIN_RET_2(rtType1, rtType2);
- if (rtType1 == NULL)
- COMPlusThrowArgumentNull(W("rtType1"));
- if (rtType2 == NULL)
- COMPlusThrowArgumentNull(W("rtType2"));
-
- bResult = rtType1->GetType().IsEquivalentTo(rtType2->GetType());
- HELPER_METHOD_FRAME_END();
-
- FC_RETURN_BOOL(bResult);
-}
-FCIMPLEND
-
-FCIMPL1(FC_BOOL_RET, RuntimeTypeHandle::IsEquivalentType, ReflectClassBaseObject *rtTypeUNSAFE)
-{
- FCALL_CONTRACT;
-
- BOOL bResult = FALSE;
-
- TypeHandle typeHandle = rtTypeUNSAFE->GetType();
- if (!typeHandle.IsTypeDesc())
- bResult = typeHandle.AsMethodTable()->GetClass()->IsEquivalentType();
-
- FC_RETURN_BOOL(bResult);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
FCIMPL1(FC_BOOL_RET, RuntimeTypeHandle::IsWindowsRuntimeObjectType, ReflectClassBaseObject *rtTypeUNSAFE)
diff --git a/src/vm/runtimehandles.h b/src/vm/runtimehandles.h
index e203bd02ba..bd3dc49f88 100644
--- a/src/vm/runtimehandles.h
+++ b/src/vm/runtimehandles.h
@@ -158,10 +158,6 @@ public:
static FCDECL2(FC_BOOL_RET, TypeEQ, Object* left, Object* right);
static FCDECL2(FC_BOOL_RET, TypeNEQ, Object* left, Object* right);
-#ifndef FEATURE_CORECLR
- static FCDECL2(FC_BOOL_RET, IsEquivalentTo, ReflectClassBaseObject *rtType1UNSAFE, ReflectClassBaseObject *rtType2UNSAFE);
- static FCDECL1(FC_BOOL_RET, IsEquivalentType, ReflectClassBaseObject *rtTypeUNSAFE);
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
static FCDECL1(FC_BOOL_RET, IsWindowsRuntimeObjectType, ReflectClassBaseObject *rtTypeUNSAFE);
diff --git a/src/vm/security.cpp b/src/vm/security.cpp
index 95c16bf5cd..2afb946467 100644
--- a/src/vm/security.cpp
+++ b/src/vm/security.cpp
@@ -41,31 +41,13 @@ void Security::DeleteSharedSecurityDescriptor(ISharedSecurityDescriptor *descrip
delete static_cast<SharedSecurityDescriptor *>(descriptor);
}
-#ifndef FEATURE_CORECLR
-IPEFileSecurityDescriptor* Security::CreatePEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile)
-{
- WRAPPER_NO_CONTRACT;
-
- return static_cast<IPEFileSecurityDescriptor*>(new PEFileSecurityDescriptor(pDomain, pPEFile));
-}
-#endif
BOOL Security::IsTransparencyEnforcementEnabled()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
// No transparency enforcement in .NET Core
return FALSE;
-#else
-
-#ifdef _DEBUG
- if (g_pConfig->DisableTransparencyEnforcement())
- return FALSE;
-#endif
-
- return TRUE;
-#endif // FEATURE_CORECLR
}
//---------------------------------------------------------------------------------------
diff --git a/src/vm/security.h b/src/vm/security.h
index 9b87d98f28..2f91e66aba 100644
--- a/src/vm/security.h
+++ b/src/vm/security.h
@@ -160,9 +160,6 @@ namespace Security
IAssemblySecurityDescriptor* CreateAssemblySecurityDescriptor(AppDomain *pDomain, DomainAssembly *pAssembly, LoaderAllocator *pLoaderAllocator);
ISharedSecurityDescriptor* CreateSharedSecurityDescriptor(Assembly* pAssembly);
void DeleteSharedSecurityDescriptor(ISharedSecurityDescriptor *descriptor);
-#ifndef FEATURE_CORECLR
- IPEFileSecurityDescriptor* CreatePEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile);
-#endif
inline void SetDefaultAppDomainProperty(IApplicationSecurityDescriptor* pASD);
inline void SetDefaultAppDomainEvidenceProperty(IApplicationSecurityDescriptor* pASD);
@@ -326,9 +323,6 @@ public:
virtual void PropagatePermissionSet(OBJECTREF GrantedPermissionSet, OBJECTREF DeniedPermissionSet, DWORD dwSpecialFlags) = 0;
-#ifndef FEATURE_CORECLR
- virtual BOOL AllowApplicationSpecifiedAppDomainManager() = 0;
-#endif
// Check to make sure that security will allow this assembly to load. Throw an exception if the
// assembly should be forbidden from loading for security related purposes
@@ -345,13 +339,6 @@ public:
virtual Assembly* GetAssembly() = 0;
};
-#ifndef FEATURE_CORECLR
-class IPEFileSecurityDescriptor : public ISecurityDescriptor
-{
-public:
- virtual BOOL AllowBindingRedirects() = 0;
-};
-#endif
#include "security.inl"
#include "securitydeclarative.inl"
diff --git a/src/vm/security.inl b/src/vm/security.inl
index aa8c57087b..0d5bf24019 100644
--- a/src/vm/security.inl
+++ b/src/vm/security.inl
@@ -538,43 +538,8 @@ inline BOOL Security::CanSkipVerification(MethodDesc * pMD)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// Always skip verification on CoreCLR
return TRUE;
-#else
-
- // Special case the System.Object..ctor:
- // System.Object..ctor is not verifiable according to current verifier rules (that require to call the base
- // class ctor). But since we want System.Object..ctor() to be marked transparent, it cannot be unverifiable
- // (v4 security rules prohibit transparent code from being unverifiable)
-
-#ifndef DACCESS_COMPILE
- if (g_pObjectCtorMD == pMD)
- return TRUE;
-#endif
-
- // In AppX, all dynamic code (dynamic assemblies and dynamic methods) should be verified..
- if (AppX::IsAppXProcess() && !AppX::IsAppXDesignMode())
- {
- if (pMD->IsLCGMethod() || pMD->GetAssembly()->IsDynamic())
- return FALSE;
- }
-
- BOOL fCanSkipVerification = Security::CanSkipVerification(pMD->GetAssembly()->GetDomainAssembly());
- if (fCanSkipVerification)
- {
- // check for transparency
- if (SecurityTransparent::IsMethodTransparent(pMD))
- {
- ModuleSecurityDescriptor *pModuleSecDesc = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly());
- if (!pModuleSecDesc->CanTransparentCodeSkipVerification())
- {
- return FALSE;
- }
- }
- }
- return fCanSkipVerification;
-#endif // !FEATURE_CORECLR
}
#endif //!DACCESS_COMPILE
diff --git a/src/vm/securitydeclarative.cpp b/src/vm/securitydeclarative.cpp
index 0cff572d42..3fd96d56dc 100644
--- a/src/vm/securitydeclarative.cpp
+++ b/src/vm/securitydeclarative.cpp
@@ -269,14 +269,7 @@ DeclActionInfo* SecurityDeclarative::DetectDeclActions(MethodDesc *pMeth, DWORD
if (pClass->HasSuppressUnmanagedCodeAccessAttr())
{
-#ifdef FEATURE_CORECLR
hr = S_OK;
-#else
- hr = pInternalImport->GetCustomAttributeByName(pMT->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL);
-#endif // FEATURE_CORECLR
if (hr != S_OK)
{
g_IBCLogger.LogEEClassCOWTableAccess(pMT);
@@ -536,15 +529,7 @@ HRESULT SecurityDeclarative::GetDeclarationFlags(IMDInternalImport *pInternalImp
BOOL hasSuppressUnmanagedCodeAccessAttr;
if (pfHasSuppressUnmanagedCodeAccessAttr == NULL)
{
-#ifdef FEATURE_CORECLR
hasSuppressUnmanagedCodeAccessAttr = TRUE;
-#else
- hasSuppressUnmanagedCodeAccessAttr =
- (pInternalImport->GetCustomAttributeByName(token,
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK);
-#endif
}
else
hasSuppressUnmanagedCodeAccessAttr = *pfHasSuppressUnmanagedCodeAccessAttr;
@@ -1049,29 +1034,6 @@ void SecurityDeclarative::CheckLinkDemandAgainstAppDomain(MethodDesc *pMD)
if (gc.refMethodNonCasDemands != NULL)
CheckNonCasDemand(&gc.refMethodNonCasDemands);
-#ifndef FEATURE_CORECLR
- // On CORECLR, we do this from the JIT callouts if the caller is transparent: if caller is critical, no checks needed
-
- // We perform automatic linktime checks for UnmanagedCode in three cases:
- // o P/Invoke calls (shouldn't get these here, but let's be paranoid).
- // o Calls through an interface that have a suppress runtime check
- // attribute on them (these are almost certainly interop calls).
- // o Interop calls made through method impls.
- // Just walk the stack in these cases, they'll be extremely rare and the
- // perf delta isn't that huge.
- if (pMD->IsNDirect() ||
- (pMD->IsInterface() &&
- (pMD->GetMDImport()->GetCustomAttributeByName(pMD->GetMethodTable()->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK ||
- pMD->GetMDImport()->GetCustomAttributeByName(pMD->GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK) ) ||
- (pMD->IsComPlusCall() && !pMD->IsInterface()))
- SecurityStackWalk::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_UNMANAGED_CODE);
-#endif // FEATURE_CORECLR
GCPROTECT_END();
}
diff --git a/src/vm/securitydescriptor.cpp b/src/vm/securitydescriptor.cpp
index a14095a981..d8af752e2e 100644
--- a/src/vm/securitydescriptor.cpp
+++ b/src/vm/securitydescriptor.cpp
@@ -270,157 +270,5 @@ OBJECTREF PEFileSecurityDescriptor::BuildEvidence(PEFile *pPEFile, const OBJECTR
#endif // FEATURE_CAS_POLICY
-#ifndef FEATURE_CORECLR
-BOOL PEFileSecurityDescriptor::QuickIsFullyTrusted()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
-#ifdef CROSSGEN_COMPILE
- return TRUE;
-#else
- if (!m_pAppDomain->GetSecurityDescriptor()->IsLegacyCasPolicyEnabled())
- {
- return TRUE;
- }
- else if (m_pAppDomain->IsCompilationDomain())
- {
- return TRUE;
- }
- else
- {
- return CheckQuickCache(SecurityConfig::FullTrustAll, GetZone());
- }
-#endif
-}
-
-#ifndef CROSSGEN_COMPILE
-//---------------------------------------------------------------------------------------
-//
-// Get the evidence for this PE file
-//
-
-OBJECTREF PEFileSecurityDescriptor::GetEvidence()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- PRECONDITION(m_pAppDomain == GetAppDomain());
- INJECT_FAULT(COMPlusThrowOM());
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- // If we already have evidence, then just return that
- if (IsEvidenceComputed())
- return ObjectFromLazyHandle(m_hAdditionalEvidence, m_pLoaderAllocator);
-
- struct
- {
- OBJECTREF objHostProvidedEvidence;
- OBJECTREF objEvidence;
- }
- gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
- BEGIN_SO_INTOLERANT_CODE(GetThread());
-
-#if CHECK_APP_DOMAIN_LEAKS
- if (g_pConfig->AppDomainLeaks())
- _ASSERTE(gc.objHostProvidedEvidence == NULL || GetAppDomain() == gc.objHostProvidedEvidence->GetAppDomain());
-#endif // CHECK_APP_DOMAIN_LEAKS
-
- gc.objHostProvidedEvidence = ObjectFromLazyHandle(m_hAdditionalEvidence, m_pLoaderAllocator);
- gc.objEvidence = PEFileSecurityDescriptor::BuildEvidence(m_pPEFile, gc.objHostProvidedEvidence);
- SetEvidence(gc.objEvidence);
-
-#if CHECK_APP_DOMAIN_LEAKS
- if (g_pConfig->AppDomainLeaks())
- _ASSERTE(gc.objEvidence == NULL || GetAppDomain() == gc.objEvidence->GetAppDomain());
-#endif // CHECK_APP_DOMAIN_LEAKS
-
- END_SO_INTOLERANT_CODE;
-
- GCPROTECT_END();
-
- return gc.objEvidence;
-}
-
-DWORD PEFileSecurityDescriptor::GetZone()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- PRECONDITION(m_pAppDomain->GetSecurityDescriptor()->IsLegacyCasPolicyEnabled());
- }
- CONTRACTL_END;
-
- SecZone dwZone = NoZone;
- BEGIN_SO_INTOLERANT_CODE(GetThread());
-
- StackSString codebase;
- BYTE rbUniqueID[MAX_SIZE_SECURITY_ID];
- DWORD cbUniqueID = sizeof(rbUniqueID);
-
- m_pPEFile->GetSecurityIdentity(codebase, &dwZone, 0, rbUniqueID, &cbUniqueID);
- END_SO_INTOLERANT_CODE;
- return dwZone;
-}
-#endif // !CROSSGEN_COMPILE
-
-void PEFileSecurityDescriptor::Resolve()
-{
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- INJECT_FAULT(COMPlusThrowOM(););
- } CONTRACTL_END;
-
- if (IsResolved())
- return;
- ResolveWorker();
-}
-
-void PEFileSecurityDescriptor::ResolveWorker()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- SetGrantedPermissionSet(NULL, NULL, 0xFFFFFFFF);
-}
-
-BOOL PEFileSecurityDescriptor::AllowBindingRedirects()
-{
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- PRECONDITION(IsResolved());
- } CONTRACTL_END;
-
- ETWOnStartup (AllowBindingRedirs_V1, AllowBindingRedirsEnd_V1);
-
- return CheckSpecialFlag(1 << SECURITY_BINDING_REDIRECTS);
-}
-
-#endif // FEATURE_CORECLR
#endif // !DACCESS_COMPILE
diff --git a/src/vm/securitydescriptor.h b/src/vm/securitydescriptor.h
index 06c096f4ee..26e46633dc 100644
--- a/src/vm/securitydescriptor.h
+++ b/src/vm/securitydescriptor.h
@@ -168,32 +168,6 @@ public:
#endif
};
-#ifndef FEATURE_CORECLR
-class PEFileSecurityDescriptor : public SecurityDescriptorBase<IPEFileSecurityDescriptor>
-{
-public:
- virtual BOOL AllowBindingRedirects();
- BOOL QuickIsFullyTrusted();
- virtual VOID Resolve();
-
-#ifndef DACCESS_COMPILE
- inline PEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile);
-#endif
-
-#ifdef FEATURE_CAS_POLICY
- virtual OBJECTREF GetEvidence();
- DWORD GetZone();
-#endif // FEATURE_CAS_POLICY
-
-
-#ifdef FEATURE_CAS_POLICY
- static
- OBJECTREF BuildEvidence(PEFile *pPEFile, const OBJECTREF& objHostSuppliedEvidence);
-#endif // FEATURE_CAS_POLICY
-private:
- VOID ResolveWorker();
-};
-#endif // !FEATURE_CORECLR
#include "securitydescriptor.inl"
diff --git a/src/vm/securitydescriptor.inl b/src/vm/securitydescriptor.inl
index 8d571f9fa1..8351389ef4 100644
--- a/src/vm/securitydescriptor.inl
+++ b/src/vm/securitydescriptor.inl
@@ -94,16 +94,5 @@ inline SecurityDescriptorBase<IT>::SecurityDescriptorBase(AppDomain *pAppDomain,
}
#endif // !DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
-
-#ifndef DACCESS_COMPILE
-inline PEFileSecurityDescriptor::PEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile) :
- SecurityDescriptorBase<IPEFileSecurityDescriptor>(pDomain, NULL,pPEFile, pDomain->GetLoaderAllocator())
-{
- LIMITED_METHOD_CONTRACT
-}
-#endif // !DACCESS_COMPILE
-
-#endif // !FEATURE_CORECLR
#endif // #define __SECURITYDESCRIPTOR_INL__
diff --git a/src/vm/securitydescriptorappdomain.cpp b/src/vm/securitydescriptorappdomain.cpp
index a09276bf20..e50db588f0 100644
--- a/src/vm/securitydescriptorappdomain.cpp
+++ b/src/vm/securitydescriptorappdomain.cpp
@@ -321,9 +321,6 @@ BOOL ApplicationSecurityDescriptor::IsDefaultAppDomain() const
{
LIMITED_METHOD_CONTRACT;
return m_fIsDefaultAppdomain
-#ifndef FEATURE_CORECLR
- && !m_fHomogeneous
-#endif // FEATURE_CORECLR
;
}
diff --git a/src/vm/securitydescriptorassembly.cpp b/src/vm/securitydescriptorassembly.cpp
index 715d956123..be9e70e5aa 100644
--- a/src/vm/securitydescriptorassembly.cpp
+++ b/src/vm/securitydescriptorassembly.cpp
@@ -613,15 +613,6 @@ OBJECTREF AssemblySecurityDescriptor::GetAdditionalEvidence()
}
#endif // FEATURE_CAS_POLICY
-#ifndef FEATURE_CORECLR
-BOOL AssemblySecurityDescriptor::AllowApplicationSpecifiedAppDomainManager()
-{
- WRAPPER_NO_CONTRACT;
-
- // Only fully trusted assemblies are allowed to specify their AppDomainManager in a config file
- return this->IsFullyTrusted();
-}
-#endif // FEATURE_CORECLR
// Check to make sure that security will allow this assembly to load. Throw an exception if the assembly
// should be forbidden from loading for security related purposes
diff --git a/src/vm/securitydescriptorassembly.h b/src/vm/securitydescriptorassembly.h
index 1db30bb13e..68023d670b 100644
--- a/src/vm/securitydescriptorassembly.h
+++ b/src/vm/securitydescriptorassembly.h
@@ -123,9 +123,6 @@ public:
#endif // !DACCESS_COMPILE
#endif // FEATURE_CAS_POLICY
-#ifndef FEATURE_CORECLR
- virtual BOOL AllowApplicationSpecifiedAppDomainManager();
-#endif // !FEATURE_CORECLR
virtual void CheckAllowAssemblyLoad();
diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp
index 3101416bae..dcb2eb765f 100644
--- a/src/vm/securitymeta.cpp
+++ b/src/vm/securitymeta.cpp
@@ -56,9 +56,6 @@ void FieldSecurityDescriptor::VerifyDataComputed()
return;
}
-#ifndef FEATURE_CORECLR
- FieldSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
// If we've setup a breakpoint when we compute the transparency of this field, then stop in the debugger
@@ -283,9 +280,6 @@ void MethodSecurityDescriptor::ComputeCriticalTransparentInfo()
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- MethodSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
MethodTable* pMT = m_pMD->GetMethodTable();
@@ -739,72 +733,6 @@ void MethodSecurityDescriptor::InvokeInheritanceChecks(MethodDesc *pChildMD)
}
}
-#ifndef FEATURE_CORECLR
- // Check CAS Inheritance
-
- // Early out if we're fully trusted
- if (SecurityDeclarative::FullTrustCheckForLinkOrInheritanceDemand(pChildMD->GetAssembly()))
- {
- return;
- }
-
- if (HasInheritanceDeclarativeSecurity())
- {
-#ifdef CROSSGEN_COMPILE
- // NGen is always full trust. This path should be unreachable.
- CrossGenNotSupported("HasInheritanceDeclarativeSecurity()");
-#else // CROSSGEN_COMPILE
- GCX_COOP();
-
- OBJECTREF refCasDemands = NULL;
- PsetCacheEntry* pCasDemands = NULL;
-
- HRESULT hr = GetDeclaredPermissionsWithCache(dclInheritanceCheck, &refCasDemands, &pCasDemands);
- if (refCasDemands != NULL)
- {
- _ASSERTE(pCasDemands != NULL);
-
- // See if inheritor's assembly has passed this demand before
- AssemblySecurityDescriptor *pInheritorAssem = static_cast<AssemblySecurityDescriptor*>(pChildMD->GetAssembly()->GetSecurityDescriptor());
- BOOL fSkipCheck = pInheritorAssem->AlreadyPassedDemand(pCasDemands);
-
- if (!fSkipCheck)
- {
- GCPROTECT_BEGIN(refCasDemands);
-
- // Perform the check (it's really just a LinkDemand)
- SecurityStackWalk::LinkOrInheritanceCheck(pChildMD->GetAssembly()->GetSecurityDescriptor(), refCasDemands, pChildMD->GetAssembly(), dclInheritanceCheck);
-
- // Demand passed. Add it to the Inheritor's assembly's list of passed demands
- pInheritorAssem->TryCachePassedDemand(pCasDemands);
-
- GCPROTECT_END();
- }
- }
-
- // @todo -- non cas shouldn't be used for inheritance demands...
-
- // Check non-CAS Inheritance
- OBJECTREF refNonCasDemands = NULL;
- hr = GetDeclaredPermissionsWithCache( dclNonCasInheritance, &refNonCasDemands, NULL);
- if (refNonCasDemands != NULL)
- {
- _ASSERTE(((PERMISSIONSETREF)refNonCasDemands)->CheckedForNonCas() && "Declarative permissions should have been checked for nonCAS in PermissionSet.CreateSerialized");
- if (((PERMISSIONSETREF)refNonCasDemands)->ContainsNonCas())
- {
- GCPROTECT_BEGIN(refNonCasDemands);
-
- // Perform the check
- MethodDescCallSite demand(METHOD__PERMISSION_SET__DEMAND_NON_CAS, &refNonCasDemands);
- ARG_SLOT arg = ObjToArgSlot(refNonCasDemands);
- demand.Call(&arg);
-
- GCPROTECT_END();
- }
- }
-#endif // CROSSGEN_COMPILE
- }
-#endif // FEATURE_CORECLR
}
MethodSecurityDescriptor::MethodImplementationIterator::MethodImplementationIterator(MethodDesc *pMD)
@@ -1099,9 +1027,6 @@ void TypeSecurityDescriptor::ComputeCriticalTransparentInfo()
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- TypeSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
// If we've setup a breakpoint when we compute the transparency of this type, then stop in the debugger now
@@ -1240,9 +1165,6 @@ void TypeSecurityDescriptor::ComputeCriticalTransparentInfo()
// Update the cached values in the EE Class.
g_IBCLogger.LogEEClassCOWTableAccess(m_pMT);
pClass->SetCriticalTransparentInfo(
-#ifndef FEATURE_CORECLR
- typeFlags & (TypeSecurityDescriptorFlags_IsCritical | TypeSecurityDescriptorFlags_IsAllCritical),
-#endif // FEATURE_CORECLR
typeFlags & TypeSecurityDescriptorFlags_IsTreatAsSafe,
typeFlags & TypeSecurityDescriptorFlags_IsAllTransparent,
typeFlags & TypeSecurityDescriptorFlags_IsAllCritical);
@@ -1484,73 +1406,6 @@ void TypeSecurityDescriptor::InvokeInheritanceChecks(MethodTable* pChildMT)
}
}
-#ifndef FEATURE_CORECLR
- // Fast path check
- if (SecurityDeclarative::FullTrustCheckForLinkOrInheritanceDemand(pChildMT->GetAssembly()))
- {
- return;
- }
-
- if (HasInheritanceDeclarativeSecurity())
- {
-#ifdef CROSSGEN_COMPILE
- // NGen is always full trust. This path should be unreachable.
- CrossGenNotSupported("HasInheritanceDeclarativeSecurity()");
-#else // CROSSGEN_COMPILE
- GCX_COOP();
-
- // If we have a class that requires inheritance checks,
- // then we require a thread to perform the checks.
- // We won't have a thread when some of the system classes
- // are preloaded, so make sure that none of them have
- // inheritance checks.
- _ASSERTE(GetThread() != NULL);
-
- struct
- {
- OBJECTREF refCasDemands;
- OBJECTREF refNonCasDemands;
- }
- gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
-
- EEClass *pClass = m_pMT->GetClass();
- if (pClass->RequiresCasInheritanceCheck())
- {
- GetDeclaredPermissionsWithCache(dclInheritanceCheck, &gc.refCasDemands, NULL);
- }
-
- if (pClass->RequiresNonCasInheritanceCheck())
- {
- GetDeclaredPermissionsWithCache(dclNonCasInheritance, &gc.refNonCasDemands, NULL);
- }
-
- if (gc.refCasDemands != NULL)
- {
- SecurityStackWalk::LinkOrInheritanceCheck(pChildMT->GetAssembly()->GetSecurityDescriptor(),
- gc.refCasDemands,
- pChildMT->GetAssembly(),
- dclInheritanceCheck);
- }
-
- if (gc.refNonCasDemands != NULL)
- {
- _ASSERTE(((PERMISSIONSETREF)gc.refNonCasDemands)->CheckedForNonCas() && "Declarative permissions should have been checked for nonCAS in PermissionSet.CreateSerialized");
- if(((PERMISSIONSETREF)gc.refNonCasDemands)->ContainsNonCas())
- {
- MethodDescCallSite demand(METHOD__PERMISSION_SET__DEMAND_NON_CAS, &gc.refNonCasDemands);
-
- ARG_SLOT arg = ObjToArgSlot(gc.refNonCasDemands);
- demand.Call(&arg);
- }
- }
-
- GCPROTECT_END();
-#endif // CROSSGEN_COMPILE
- }
-#endif // FEATURE_CORECLR
}
// Module security descriptor contains static security information about the module
@@ -1571,9 +1426,6 @@ void ModuleSecurityDescriptor::VerifyDataComputed()
return;
}
-#ifndef FEATURE_CORECLR
- ModuleSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
// Read the security attributes from the assembly
Assembly *pAssembly = m_pModule->GetAssembly();
@@ -1584,17 +1436,6 @@ void ModuleSecurityDescriptor::VerifyDataComputed()
TokenSecurityDescriptorFlags tokenFlags = GetTokenFlags();
-#ifndef FEATURE_CORECLR
- // Make sure we understand the security rule set being asked for
- if (GetSecurityRuleSet() < SecurityRuleSet_Min || GetSecurityRuleSet() > SecurityRuleSet_Max)
- {
- // Unknown rule set - fail to load this module
- SString strAssemblyName;
- pAssembly->GetDisplayName(strAssemblyName);
- COMPlusThrow(kFileLoadException, IDS_E_UNKNOWN_SECURITY_RULESET, strAssemblyName.GetUnicode());
- }
-
-#endif // !FEATURE_CORECLR
// Get a transparency behavior object for the assembly.
const SecurityTransparencyBehavior *pTransparencyBehavior =
@@ -1707,40 +1548,6 @@ void ModuleSecurityDescriptor::VerifyDataComputed()
_ASSERTE(m_flags == moduleFlags);
}
-#ifndef FEATURE_CORECLR
-
-// Determine if this assembly was build against a version of the runtime that only supported legacy transparency
-BOOL ModuleSecurityDescriptor::AssemblyVersionRequiresLegacyTransparency()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- BOOL fIsLegacyAssembly = FALSE;
-
- // Check the manifest version number to see if we're a v1 or v2 assembly. We specifically check for the
- // manifest version to come back as a string that starts with either v1 or v2; if we get anything
- // unexpected, we'll just use the default transparency implementation
- LPCSTR szVersion = NULL;
- IMDInternalImport *pmdImport = m_pModule->GetAssembly()->GetManifestImport();
- if (SUCCEEDED(pmdImport->GetVersionString(&szVersion)))
- {
- if (szVersion != NULL && strlen(szVersion) > 2)
- {
- fIsLegacyAssembly = szVersion[0] == 'v' &&
- (szVersion[1] == '1' || szVersion[1] == '2');
- }
- }
-
- return fIsLegacyAssembly;
-}
-
-#endif // !FEATURE_CORECLR
ModuleSecurityDescriptor* ModuleSecurityDescriptor::GetModuleSecurityDescriptor(Assembly *pAssembly)
{
@@ -1938,31 +1745,6 @@ TokenSecurityDescriptorFlags TokenSecurityDescriptor::ReadSecurityAttributes(IMD
{
flags |= TokenSecurityDescriptorFlags_Critical;
-#ifndef FEATURE_CORECLR
- // Check the SecurityCriticalScope parameter
- const BYTE *pbAttributeBlob;
- ULONG cbAttributeBlob;
-
- if (FAILED(pmdImport->GetCustomAttributeAsBlob(
- currentAttribute,
- reinterpret_cast<const void **>(&pbAttributeBlob),
- &cbAttributeBlob)))
- {
- continue;
- }
- CustomAttributeParser cap(pbAttributeBlob, cbAttributeBlob);
- if (SUCCEEDED(cap.SkipProlog()))
- {
- UINT32 dwCriticalFlags;
- if (SUCCEEDED(cap.GetU4(&dwCriticalFlags)))
- {
- if (dwCriticalFlags == SecurityCriticalFlags_All)
- {
- flags |= TokenSecurityDescriptorFlags_AllCritical;
- }
- }
- }
-#endif // !FEATURE_CORECLR
}
else if (strcmp(g_SecuritySafeCriticalAttribute + sizeof(g_SecurityNS), szAttributeName) == 0)
{
@@ -1972,30 +1754,6 @@ TokenSecurityDescriptorFlags TokenSecurityDescriptor::ReadSecurityAttributes(IMD
{
flags |= TokenSecurityDescriptorFlags_Transparent;
}
-#ifndef FEATURE_CORECLR
- else if (strcmp(g_SecurityRulesAttribute + sizeof(g_SecurityNS), szAttributeName) == 0)
- {
- const BYTE *pbAttributeBlob;
- ULONG cbAttributeBlob;
-
- if (FAILED(pmdImport->GetCustomAttributeAsBlob(
- currentAttribute,
- reinterpret_cast<const void **>(&pbAttributeBlob),
- &cbAttributeBlob)))
- {
- continue;
- }
-
- TokenSecurityDescriptorFlags securityRulesFlags =
- ParseSecurityRulesAttribute(pbAttributeBlob, cbAttributeBlob);
-
- flags |= securityRulesFlags;
- }
- else if (strcmp(g_SecurityTreatAsSafeAttribute + sizeof(g_SecurityNS), szAttributeName) == 0)
- {
- flags |= TokenSecurityDescriptorFlags_TreatAsSafe;
- }
-#endif // !FEATURE_CORECLR
}
}
@@ -2023,9 +1781,6 @@ void TokenSecurityDescriptor::VerifySemanticDataComputed()
return;
}
-#ifndef FEATURE_CORECLR
- TokenSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
bool fIsSemanticallyCritical = false;
bool fIsSemanticallyTreatAsSafe = false;
diff --git a/src/vm/securitymeta.h b/src/vm/securitymeta.h
index d2e3743cbe..403133cf74 100644
--- a/src/vm/securitymeta.h
+++ b/src/vm/securitymeta.h
@@ -629,17 +629,10 @@ public:
// Get the rule set the assembly uses
inline SecurityRuleSet GetSecurityRuleSet();
-#ifndef FEATURE_CORECLR
- // Can fully trusted transparent code bypass verification
- inline BOOL CanTransparentCodeSkipVerification();
-#endif // !FEATURE_CORECLR
// Does the assembly allow partially trusted callers
inline BOOL IsAPTCA();
-#ifndef FEATURE_CORECLR
- BOOL AssemblyVersionRequiresLegacyTransparency();
-#endif // !FEATURE_CORECLR
private:
// Helper class which fires transparency calculation begin/end ETW events
diff --git a/src/vm/securitymeta.inl b/src/vm/securitymeta.inl
index 6eb488d78c..11da444841 100644
--- a/src/vm/securitymeta.inl
+++ b/src/vm/securitymeta.inl
@@ -411,30 +411,8 @@ inline BOOL MethodSecurityDescriptor::IsDeclSecurityCASDemandsOnly(DWORD dwMethD
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// Non-CAS demands are not supported in CoreCLR
return TRUE;
-#else
- GCX_COOP();
-
- PsetCacheEntry *tokenSetIndexes[dclMaximumValue + 1];
- SecurityDeclarative::DetectDeclActionsOnToken(_mdToken, dwMethDeclFlags, tokenSetIndexes, pInternalImport);
- SecurityProperties sp(dwMethDeclFlags);
- if (!sp.FDemandsOnly())
- return FALSE;
-
- DWORD dwLocalAction;
- bool builtInCASPermsOnly = true;
- for (dwLocalAction = 0; dwLocalAction <= dclMaximumValue && builtInCASPermsOnly; dwLocalAction++)
- {
- if (tokenSetIndexes[dwLocalAction] != NULL)
- {
- builtInCASPermsOnly = builtInCASPermsOnly && (tokenSetIndexes[dwLocalAction]->ContainsBuiltinCASPermsOnly(dwLocalAction));
- }
- }
-
- return (builtInCASPermsOnly); // we only get here if there are only demands...so it suffices to return this value directly
-#endif
}
#ifndef DACCESS_COMPILE
@@ -632,9 +610,6 @@ inline BOOL TypeSecurityDescriptor::IsCritical()
}
return pClass->IsAllCritical()
-#ifndef FEATURE_CORECLR
- || pClass->IsCritical()
-#endif // !FEATURE_CORECLR
;
}
@@ -1101,16 +1076,6 @@ inline BOOL ModuleSecurityDescriptor::IsMixedTransparency()
return !IsAllCritical() && !IsAllTransparent();
}
-#ifndef FEATURE_CORECLR
-
-inline BOOL ModuleSecurityDescriptor::CanTransparentCodeSkipVerification()
-{
- WRAPPER_NO_CONTRACT;
- VerifyDataComputed();
- return !!(m_flags & ModuleSecurityDescriptorFlags_SkipFullTrustVerification);
-}
-
-#endif // !FEATURE_CORECLR
#if defined(FEATURE_CORESYSTEM)
inline BOOL ModuleSecurityDescriptor::IsAPTCA()
@@ -1139,12 +1104,6 @@ inline SecurityRuleSet ModuleSecurityDescriptor::GetSecurityRuleSet()
{
return ::GetSecurityRuleSet(tokenFlags);
}
-#ifndef FEATURE_CORECLR
- else if (AssemblyVersionRequiresLegacyTransparency())
- {
- return SecurityRuleSet_Level1;
- }
-#endif // !FEATURE_CORECLR
else
{
// The assembly hasn't specified the rule set that it needs to use. We'll just use the default rule
diff --git a/src/vm/securitypolicy.cpp b/src/vm/securitypolicy.cpp
index fe1da90b8d..03910a2311 100644
--- a/src/vm/securitypolicy.cpp
+++ b/src/vm/securitypolicy.cpp
@@ -790,34 +790,6 @@ void QCALLTYPE SecurityPolicy::GetDeviceName(LPCWSTR wszDriveLetter, QCall::Stri
{
QCALL_CONTRACT;
-#if !defined(FEATURE_CORECLR)
- BEGIN_QCALL;
-
- WCHAR networkName[MAX_LONGPATH];
- DWORD networkNameSize = MAX_LONGPATH;
- ZeroMemory( networkName, sizeof( networkName ) );
-
- UINT driveType = WszGetDriveType( wszDriveLetter );
- if (driveType == DRIVE_REMOVABLE ||
- driveType == DRIVE_FIXED ||
- driveType == DRIVE_CDROM ||
- driveType == DRIVE_RAMDISK)
- {
- retDeviceName.Set( wszDriveLetter );
- goto lExit;
- }
-
- if (WszWNetGetConnection(wszDriveLetter, networkName, &networkNameSize) != NO_ERROR)
- {
- goto lExit;
- }
-
- retDeviceName.Set( networkName );
-
-lExit: ;
-
- END_QCALL;
-#endif // !FEATURE_CORECLR
}
#ifdef FEATURE_CAS_POLICY
diff --git a/src/vm/securitypolicy.h b/src/vm/securitypolicy.h
index d22eceb11e..3166f7fd24 100644
--- a/src/vm/securitypolicy.h
+++ b/src/vm/securitypolicy.h
@@ -36,9 +36,6 @@ class SystemNative;
class NDirect;
class SystemDomain;
class AssemblySecurityDescriptor;
-#ifndef FEATURE_CORECLR
-class PEFileSecurityDescriptor;
-#endif
class SharedSecurityDescriptor;
class SecurityStackWalkData;
class DemandStackWalk;
diff --git a/src/vm/securitytransparentassembly.cpp b/src/vm/securitytransparentassembly.cpp
index f798df159f..c1823fc034 100644
--- a/src/vm/securitytransparentassembly.cpp
+++ b/src/vm/securitytransparentassembly.cpp
@@ -324,7 +324,6 @@ BOOL SecurityTransparent::CheckCriticalAccess(AccessCheckContext* pContext,
return TRUE;
}
-#ifdef FEATURE_CORECLR
// On the coreCLR, a method can be transparent even if the containing type is marked Critical.
// This will happen when that method is an override of a base transparent method, and the type that
// contains the override is marked Critical. And that's the only case it can happen.
@@ -334,7 +333,6 @@ BOOL SecurityTransparent::CheckCriticalAccess(AccessCheckContext* pContext,
{
return TRUE;
}
-#endif // FEATURE_CORECLR
// an attached profiler may wish to have these checks suppressed
if (Security::BypassSecurityChecksForProfiler(pCurrentMD))
@@ -395,41 +393,9 @@ BOOL SecurityTransparent::IsAllowedToAssert(MethodDesc *pMD)
return TRUE;
}
-#ifdef FEATURE_CORECLR
// On CoreCLR only critical code may ever assert - there are no compatibility reasons to allow
// transparent asserts.
return FALSE;
-#else // !FEATURE_CORECLR
- // We must be in a heterogenous AppDomain for transparent asserts to work
- if (GetAppDomain()->GetSecurityDescriptor()->IsHomogeneous())
- {
- return FALSE;
- }
-
- ModuleSecurityDescriptor *pMSD = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly());
-
- // Only assemblies whose version requires them to use legacy transparency (rather than assemblies which
- // get legacy transparency via RuleSet.Level1) can assert from transparent code
- if (!pMSD->AssemblyVersionRequiresLegacyTransparency())
- {
- return FALSE;
- }
-
- // Finally, the assembly must not have had any of the transparency attributes on it
- const TokenSecurityDescriptorFlags transparencyAwareFlags =
- TokenSecurityDescriptorFlags_AllCritical | // [SecurityCritical(SecurityCriticalScope.All)]
- TokenSecurityDescriptorFlags_Critical | // [SecurityCritical]
- TokenSecurityDescriptorFlags_SafeCritical | // [SecuritySafeCritical]
- TokenSecurityDescriptorFlags_Transparent | // [SecurityTransparent]
- TokenSecurityDescriptorFlags_TreatAsSafe; // [SecurityTreatAsSafe]
- TokenSecurityDescriptorFlags moduleAttributes = pMSD->GetTokenFlags();
- if ((moduleAttributes & transparencyAwareFlags) != TokenSecurityDescriptorFlags_None)
- {
- return FALSE;
- }
-
- return TRUE;
-#endif // FEATURE_CORECLR
}
// Functor class to aid in determining if a type requires a transparency check
@@ -528,40 +494,6 @@ CorInfoCanSkipVerificationResult SecurityTransparent::JITCanSkipVerification(Met
CorInfoCanSkipVerificationResult canSkipVerif = hasSkipVerificationPermisson ? CORINFO_VERIFICATION_CAN_SKIP : CORINFO_VERIFICATION_CANNOT_SKIP;
-#ifndef FEATURE_CORECLR
- // also check to see if the method is marked transparent
- if (hasSkipVerificationPermisson)
- {
- if (pDomainAssembly == GetAppDomain()->GetAnonymouslyHostedDynamicMethodsAssembly())
- {
- // This assembly is FullTrust. However, it cannot contain unverifiable code.
- // The JIT compiler is not hardened to deal with invalid code. Hence, we cannot
- // return CORINFO_VERIFICATION_RUNTIME_CHECK for IL that could have been generated
- // by a low-trust assembly.
- canSkipVerif = CORINFO_VERIFICATION_CANNOT_SKIP;
- }
- // also check to see if the method is marked transparent
- else if (SecurityTransparent::IsMethodTransparent(pMD))
- {
- // If the assembly requested that even its transparent members not be verified, then we can skip
- // verification. Otherwise, we need to either inject a runtime demand in the v2 model, or fail
- // verification in the v4 model.
- ModuleSecurityDescriptor *pModuleSecDesc = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly());
- if (pModuleSecDesc->CanTransparentCodeSkipVerification())
- {
- canSkipVerif = CORINFO_VERIFICATION_CAN_SKIP;
- }
- else if (pMD->GetAssembly()->GetSecurityTransparencyBehavior()->CanTransparentCodeSkipVerification())
- {
- canSkipVerif = CORINFO_VERIFICATION_RUNTIME_CHECK;
- }
- else
- {
- canSkipVerif = CORINFO_VERIFICATION_CANNOT_SKIP;
- }
- }
- }
-#endif //FEATURE_CORECLR
return canSkipVerif;
}
@@ -587,14 +519,6 @@ CorInfoCanSkipVerificationResult SecurityTransparent::JITCanSkipVerification(Dom
{
// In CoreCLR, do not enable transparency checks here. We depend on this method being "honest" in
// JITCanSkipVerification to skip transparency checks on profile assemblies.
-#ifndef FEATURE_CORECLR
- ModuleSecurityDescriptor *pMsd = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pAssembly->GetAssembly());
- if (pMsd->IsAllTransparent() &&
- pAssembly->GetAssembly()->GetSecurityTransparencyBehavior()->CanTransparentCodeSkipVerification())
- {
- canSkipVerif = CORINFO_VERIFICATION_RUNTIME_CHECK;
- }
-#endif // !FEATURE_CORECLR
}
return canSkipVerif;
@@ -620,34 +544,6 @@ bool SecurityTransparent::SecurityCalloutQuickCheck(MethodDesc *pCallerMD)
// In coreclr, we modified the logic in the callout to also do some transparency method access checks
// These checks need to happen regardless of trust level and we shouldn't be bailing out early
// just because we happen to be in Full Trust
-#ifndef FEATURE_CORECLR
- // See if we need to process this callout for real, or if we can bail out early before setting up a HMF,
- // and spending a lot of time processing the transparency evaluation. The simplest case where we can do
- // this is if the caller is critical. In that case, we know that the caller is allowed to do whatever
- // it wants, so we quit out.
- //
- // Additionally, if the caller is using SecurityRuleSet.Level1, which turns transparency violations into
- // security demands, we can bail out early if we know for sure all demands will succeed on the current
- // call stack. (Note: this remains true as long as we don't start generating callouts for transparent
- // level 1 calling critical level 1, or transparent level 1 doing an assert, which are the only two
- // violations which do not succeed in the face of a successful demand).
- if (pCallerMD->IsCritical())
- {
- return true;
- }
- else
- {
- // The caller is transparent, so let's see if demands can cause transparency violations to succeed,
- // and also if all demands issued from this context will succeed.
- const SecurityTransparencyBehavior *pCallerTransparency = pCallerMD->GetAssembly()->TryGetSecurityTransparencyBehavior();
- if (pCallerTransparency != NULL &&
- pCallerTransparency->CanTransparentCodeCallLinkDemandMethods() &&
- SecurityStackWalk::HasFlagsOrFullyTrustedIgnoreMode(0))
- {
- return true;
- }
- }
-#endif // !FEATURE_CORECLR
return false;
}
@@ -947,7 +843,6 @@ VOID SecurityTransparent::EnforceTransparentDelegateChecks(MethodTable* pDelegat
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// We only enforce delegate binding rules in partial trust
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
return;
@@ -958,7 +853,6 @@ VOID SecurityTransparent::EnforceTransparentDelegateChecks(MethodTable* pDelegat
TypeString::AppendType(strDelegateType, pDelegateMT, TypeString::FormatNamespace | TypeString::FormatAngleBrackets| TypeString::FormatSignature);
COMPlusThrowHR(COR_E_METHODACCESS, IDS_E_DELEGATE_BINDING_TRANSPARENCY, strDelegateType.GetUnicode(), strMethod.GetUnicode());
-#endif // FEATURE_CORECLR
}
#endif // CROSSGEN_COMPILE
@@ -1482,199 +1376,6 @@ public:
}
};
-#ifndef FEATURE_CORECLR
-
-//---------------------------------------------------------------------------------------
-//
-// Transparency behavior implementation for v2 assemblies
-//
-
-class LegacyTransparencyBehaviorImpl : public ISecurityTransparencyImpl
-{
-public:
- // Get bits that indicate how transparency should behave in different situations
- virtual SecurityTransparencyBehaviorFlags GetBehaviorFlags() const
- {
- LIMITED_METHOD_CONTRACT;
- return SecurityTransparencyBehaviorFlags_IntroducedCriticalsMayAddTreatAsSafe |
- SecurityTransparencyBehaviorFlags_OpportunisticIsSafeCriticalMethods |
- SecurityTransparencyBehaviorFlags_PartialTrustImpliesAllTransparent |
- SecurityTransparencyBehaviorFlags_PublicImpliesTreatAsSafe |
- SecurityTransparencyBehaviorFlags_TransparentCodeCanCallLinkDemand |
- SecurityTransaprencyBehaviorFlags_TransparentCodeCanCallUnmanagedCode |
- SecurityTransparencyBehaviorFlags_TransparentCodeCanSkipVerification |
- SecurityTransparencyBehaviorFlags_UnsignedImpliesAPTCA;
- }
-
- // Legacy transparency field behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // Critical (any) Critical
- // SafeCritical Safe critical
- // TAS (no critical) No effect
- // TAS (with any critical) Safe critical
- virtual FieldSecurityDescriptorFlags MapFieldAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- WRAPPER_NO_CONTRACT;
-
- // Legacy transparency behaves the same for fields as the current transparency model, so we just forward
- // this call to that implementation.
- TransparencyBehaviorImpl forwardImpl;
- return forwardImpl.MapFieldAttributes(tokenFlags);
- }
-
-
- // Legacy transparency method behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // Critical (any) Critical
- // SafeCritical Safe critical
- // TAS (no critical) No effect
- // TAS (with any critical) Safe critical
- virtual MethodSecurityDescriptorFlags MapMethodAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- WRAPPER_NO_CONTRACT;
-
- // Legacy transparency behaves the same for methods as the current transparency model, so we just forward
- // this call to that implementation.
- TransparencyBehaviorImpl forwardImpl;
- return forwardImpl.MapMethodAttributes(tokenFlags);
- }
-
- // Legacy transparency module behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // APTCA APTCA
- // ConditionlAPTCA Exception
- // Critical (scoped) Mixed transparency
- // Critical (all) All critical
- // SafeCritical All safe critical
- // TAS (no critical) No effect
- // TAS (with scoped critical) No effect
- // TAS (with all critical) All safe critical
- // Transparent All transparent
- //
- // Having no transparent, critical, or safe critical attributes means that the assembly should have all
- // transparent types and all safe critical methods.
- virtual ModuleSecurityDescriptorFlags MapModuleAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- ModuleSecurityDescriptorFlags moduleFlags = ModuleSecurityDescriptorFlags_None;
- bool fShouldBeOpportunisticallyCritical = true;
-
- if (tokenFlags & TokenSecurityDescriptorFlags_APTCA)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAPTCA;
- }
-
- if (tokenFlags & TokenSecurityDescriptorFlags_Transparent)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAllTransparent;
- fShouldBeOpportunisticallyCritical = false;
- }
-
- if (tokenFlags & TokenSecurityDescriptorFlags_Critical)
- {
- fShouldBeOpportunisticallyCritical = false;
-
- // If we're critical, but not all critical that means we're mixed.
- if (tokenFlags & TokenSecurityDescriptorFlags_AllCritical)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAllCritical;
-
- // If we're all critical and treat as safe, that means we're safe critical
- if (tokenFlags & TokenSecurityDescriptorFlags_TreatAsSafe)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsTreatAsSafe;
- }
- }
- }
-
- // SafeCritical always means Critical + TreatAsSafe; we can get in this case for legacy assemblies if the
- // assembly is actually a v4 assembly which is using the Legacy attribute.
- if (tokenFlags & TokenSecurityDescriptorFlags_SafeCritical)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAllCritical |
- ModuleSecurityDescriptorFlags_IsTreatAsSafe;
- fShouldBeOpportunisticallyCritical = false;
- }
-
- // If we didn't find an attribute that indicates the assembly cares about transparency, then it is
- // opportunistically critical.
- if (fShouldBeOpportunisticallyCritical)
- {
- _ASSERTE(!(moduleFlags & ModuleSecurityDescriptorFlags_IsAllTransparent));
- _ASSERTE(!(moduleFlags & ModuleSecurityDescriptorFlags_IsAllCritical));
-
- moduleFlags |= ModuleSecurityDescriptorFlags_IsOpportunisticallyCritical;
- }
-
- // If the token asks to not have IL verification done in full trust, propigate that to the module
- if (tokenFlags & TokenSecurityDescriptorFlags_SkipFullTrustVerification)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_SkipFullTrustVerification;
- }
-
- return moduleFlags;
- }
-
- // Legacy transparency type behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // Critical (scoped) Critical, but not all critical
- // Critical (all) All critical
- // SafeCritical All safe critical
- // TAS (no critical) No effect on the type, but save TAS bit for members of the type
- // TAS (with scoped critical) SafeCritical, but not all critical
- // TAS (with all critical) All SafeCritical
- virtual TypeSecurityDescriptorFlags MapTypeAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- TypeSecurityDescriptorFlags typeFlags = TypeSecurityDescriptorFlags_None;
-
- if (tokenFlags & TokenSecurityDescriptorFlags_Critical)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsCritical;
-
- // We only consider all critical if the critical attribute was present
- if (tokenFlags & TokenSecurityDescriptorFlags_AllCritical)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsAllCritical;
- }
- }
-
- // SafeCritical always means all critical + TAS
- if (tokenFlags & TokenSecurityDescriptorFlags_SafeCritical)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsCritical |
- TypeSecurityDescriptorFlags_IsAllCritical |
- TypeSecurityDescriptorFlags_IsTreatAsSafe;
- }
-
- if (tokenFlags & TokenSecurityDescriptorFlags_TreatAsSafe)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsTreatAsSafe;
- }
-
- return typeFlags;
- }
-};
-
-#endif // !FEATURE_CORECLR
//
// Shared transparency behavior objects
@@ -1720,13 +1421,6 @@ const SecurityTransparencyBehavior *GetOrCreateTransparencyBehavior(SecurityTran
// static
SecurityTransparencyBehavior *SecurityTransparencyBehavior::s_pStandardTransparencyBehavior = NULL;
-#ifndef FEATURE_CORECLR
-
-// Transpraency behavior object for v2 transparent assemblies
-// static
-SecurityTransparencyBehavior *SecurityTransparencyBehavior::s_pLegacyTransparencyBehavior = NULL;
-
-#endif // !FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -1749,14 +1443,6 @@ const SecurityTransparencyBehavior *SecurityTransparencyBehavior::GetTransparenc
}
CONTRACT_END;
-#ifndef FEATURE_CORECLR
- if (ruleSet == SecurityRuleSet_Level1)
- {
- // Level 1 rules - v2.0 behavior
- RETURN(GetOrCreateTransparencyBehavior<LegacyTransparencyBehaviorImpl>(&s_pLegacyTransparencyBehavior));
- }
- else
-#endif // FEATURE_CORECLR;
{
// Level 2 rules - v4.0 behavior
RETURN(GetOrCreateTransparencyBehavior<TransparencyBehaviorImpl>(&s_pStandardTransparencyBehavior));
diff --git a/src/vm/sha1.h b/src/vm/sha1.h
index 0dd70f64a7..23ea8d2c3e 100644
--- a/src/vm/sha1.h
+++ b/src/vm/sha1.h
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
//
-#if defined(FEATURE_CORECLR)
#ifndef SHA1_H_
#define SHA1_H_
@@ -49,6 +48,3 @@ public:
};
#endif // SHA1_H_
-#else // !defined(FEATURE_CORECLR)
-#include "crypto/sha1.h"
-#endif // defined(FEATURE_CORECLR)
diff --git a/src/vm/stdinterfaces.cpp b/src/vm/stdinterfaces.cpp
index c80ec3fe22..2765b2e223 100644
--- a/src/vm/stdinterfaces.cpp
+++ b/src/vm/stdinterfaces.cpp
@@ -626,219 +626,8 @@ HRESULT GetITypeLibForAssembly(Assembly *pAssembly, ITypeLib **ppTLB, int bAutoC
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
//@CORESYSTODO: what to do?
return E_FAIL;
-#else
-
- HRESULT hr = S_OK; // A result.
- CQuickWSTRBase rName; // Library (scope) or file name.
- int bResize=false; // If true, had to resize the buffer to hold the name.
- LPCWSTR szModule=0; // The module name.
- GUID guid; // A GUID.
- ITypeLib *pITLB=0; // The TypeLib.
- Module *pModule; // The assembly's module.
- WCHAR rcDrive[_MAX_DRIVE]; // Module's drive letter.
- WCHAR rcDir[_MAX_DIR]; // Module's directory.
- WCHAR rcFname[_MAX_FNAME]; // Module's file name.
- USHORT wMajor; // Major version number.
- USHORT wMinor; // Minor version number.
-
- rName.Init();
-
- // Check to see if we have a cached copy.
- pITLB = pAssembly->GetTypeLib();
- if (pITLB)
- {
- // Check to see if the cached value is -1. This indicate that we tried
- // to export the typelib but that the export failed.
- if (pITLB == (ITypeLib*)-1)
- {
- hr = E_FAIL;
- goto ReturnHR;
- }
-
- // We have a cached copy so return it.
- *ppTLB = pITLB;
- hr = S_OK;
- goto ReturnHR;
- }
-
- // Retrieve the name of the module.
- pModule = pAssembly->GetManifestModule();
-
- EX_TRY
- {
- // SString::ConvertToUnicode is THROW_UNLESS_NORMALIZED
- szModule = pModule->GetPath();
- }
- EX_CATCH_HRESULT(hr);
- IfFailGo(hr);
-
- // Retrieve the guid for typelib that would be generated from the assembly.
- IfFailGo(GetTypeLibGuidForAssembly(pAssembly, &guid));
-
- // If the typelib is for the runtime library, we'd better know where it is.
- if (guid == LIBID_ComPlusRuntime)
- {
- ULONG dwSize = (ULONG)rName.MaxSize();
- while (FAILED(GetInternalSystemDirectory(rName.Ptr(), &dwSize)))
- {
- IfFailGo(rName.ReSizeNoThrow(dwSize=(ULONG)rName.MaxSize()*2));
- }
-
- IfFailGo(rName.ReSizeNoThrow(dwSize + wcslen(g_pwBaseLibraryTLB) + 3));
- wcscat_s(rName.Ptr(), rName.Size(), g_pwBaseLibraryTLB);
- hr = LoadTypeLibExWithFlags(rName.Ptr(), flags, &pITLB);
- goto ErrExit;
- }
-
- // Retrieve the major and minor version number.
- IfFailGo(GetTypeLibVersionForAssembly(pAssembly, &wMajor, &wMinor));
-
- // Maybe the module was imported from COM, and we can get the libid of the existing typelib.
- if (pAssembly->IsImportedFromTypeLib())
- {
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // Try just the Assembly version
- pAssembly->GetVersion(&wMajor, &wMinor, NULL, NULL);
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // Try loading the highest registered version.
- hr = LoadRegTypeLibWithFlags(guid, -1, -1, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // The module is known to be imported, so no need to try conversion.
-
- // Set the error info for most callers.
- VMPostError(TLBX_E_CIRCULAR_EXPORT2, szModule);
-
- // Set the hr for the case where we're trying to load a type library to
- // resolve a type reference from another library. The error message will
- // be posted where more information is available.
- if (hr == TYPE_E_LIBNOTREGISTERED)
- hr = TLBX_W_LIBNOTREGISTERED;
- else
- hr = TLBX_E_CANTLOADLIBRARY;
-
- IfFailGo(hr);
- }
-
- // Try to load the registered typelib.
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if(hr == S_OK)
- goto ErrExit;
-
- // Try just the Assembly version
- pAssembly->GetVersion(&wMajor, &wMinor, NULL, NULL);
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // If that fails, try loading the highest registered version.
- hr = LoadRegTypeLibWithFlags(guid, -1, -1, flags, &pITLB);
- if(hr == S_OK)
- goto ErrExit;
-
- // If caller only wants registered typelibs, exit now, with error from prior call.
- if (flags & TlbExporter_OnlyReferenceRegistered)
- goto ErrExit;
-
- // If we haven't managed to find the typelib so far try and load the typelib by name.
- hr = LoadTypeLibExWithFlags(szModule, flags, &pITLB);
- if(hr == S_OK)
- {
- // Check libid.
- TLIBATTR *pTlibAttr;
- int bMatch;
-
- IfFailGo(pITLB->GetLibAttr(&pTlibAttr));
- bMatch = pTlibAttr->guid == guid;
- pITLB->ReleaseTLibAttr(pTlibAttr);
-
- if (bMatch)
- {
- goto ErrExit;
- }
- else
- {
- SafeReleasePreemp(pITLB);
- pITLB = NULL;
- hr = TLBX_E_CANTLOADLIBRARY;
- }
- }
-
- // Add a ".tlb" extension and try again.
- IfFailGo(rName.ReSizeNoThrow((int)(wcslen(szModule) + 5)));
- // Check if szModule already has an extension.
- LPCWSTR ext;
- size_t extSize;
- SplitPathInterior(szModule, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &ext, &extSize);
- if (ext != nullptr)
- {
- // szModule already has an extension. Make a copy without the extension.
- wcsncpy_s(rName.Ptr(), rName.Size(), szModule, ext - szModule);
- }
- else
- {
- // szModule does not have an extension. Copy the whole string.
- wcscpy_s(rName.Ptr(), rName.Size(), szModule);
- }
- wcscat_s(rName.Ptr(), rName.Size(), W(".tlb"));
-
- hr = LoadTypeLibExWithFlags(rName.Ptr(), flags, &pITLB);
- if(hr == S_OK)
- {
- // Check libid.
- TLIBATTR *pTlibAttr;
- int bMatch;
- IfFailGo(pITLB->GetLibAttr(&pTlibAttr));
- bMatch = pTlibAttr->guid == guid;
- pITLB->ReleaseTLibAttr(pTlibAttr);
- if (bMatch)
- {
- goto ErrExit;
- }
- else
- {
- SafeReleasePreemp(pITLB);
- pITLB = NULL;
- hr = TLBX_E_CANTLOADLIBRARY;
- }
- }
-
- // If the auto create flag is set then try and export the typelib from the module.
- if (bAutoCreate)
- {
- // Try to export the typelib right now.
- // This is FTL export (Fractionally Too Late).
- hr = ExportTypeLibFromLoadedAssemblyNoThrow(pAssembly, 0, &pITLB, 0, flags);
- if (FAILED(hr))
- {
- // If the export failed then remember it failed by setting the typelib
- // to -1 on the assembly.
- pAssembly->SetTypeLib((ITypeLib *)-1);
- IfFailGo(hr);
- }
- }
-
-ErrExit:
- // If we successfully opened (or created) the typelib, cache a pointer, and return it to caller.
- if (pITLB)
- {
- pAssembly->SetTypeLib(pITLB);
- *ppTLB = pITLB;
- }
-ReturnHR:
- rName.Destroy();
- return hr;
-#endif //FEATURE_CORECLR
} // HRESULT GetITypeLibForAssembly()
@@ -2764,13 +2553,6 @@ HRESULT GetSpecialMarshaler(IMarshal* pMarsh, SimpleComCallWrapper* pSimpleWrap,
// In case of APPX process we always use the standard marshaller.
// In Non-APPX process use standard marshalling for everything except in-proc servers.
// In case of CoreCLR, we always use the standard marshaller as well.
-#if !defined(FEATURE_CORECLR)
- if (!AppX::IsAppXProcess() && (dwDestContext == MSHCTX_INPROC))
- {
- *ppMarshalRet = NULL;
- return S_OK;
- }
-#endif // !FEATURE_CORECLR
SafeComHolderPreemp<IUnknown> pMarshalerObj = NULL;
IfFailRet(CoCreateFreeThreadedMarshaler(NULL, &pMarshalerObj));
@@ -3084,49 +2866,8 @@ HRESULT __stdcall ManagedObject_GetSerializedBuffer(IManagedObject *pManaged,
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
_ASSERTE(!"NYI");
return E_NOTIMPL;
-#else // FEATURE_CORECLR
-
- HRESULT hr = S_OK;
- if (pBStr == NULL)
- return E_POINTER;
-
- *pBStr = NULL;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- SimpleComCallWrapper *pSimpleWrap = SimpleComCallWrapper::GetWrapperFromIP( pManaged );
- ComCallWrapper *pComCallWrap = pSimpleWrap->GetMainWrapper();
-
- _ASSERTE(pComCallWrap != NULL);
-
- //@todo don't allow serialization of Configured objects through DCOM
- _ASSERTE(GetThread()->GetDomain()->GetId() == pSimpleWrap->GetDomainID());
-
- BOOL fLegacyMode = (GetAppDomain()->GetComOrRemotingFlag() == COMorRemoting_LegacyMode);
-
- OBJECTREF oref = pComCallWrap->GetObjectRef();
- GCPROTECT_BEGIN(oref)
- {
- // GetSerializedBuffer is only called in cross-runtime/cross-process scenarios so we pass
- // fCrossRuntime=TRUE unless we are in legacy mode
- if (!ConvertObjectToBSTR(&oref, !fLegacyMode, pBStr))
- {
- // ConvertObjectToBSTR returning FALSE is equivalent to throwing SerializationException
- hr = COR_E_SERIALIZATION;
- }
- }
- GCPROTECT_END();
- }
- END_EXTERNAL_ENTRYPOINT;
-
- return hr;
-
-#endif // FEATURE_CORECLR
}
//------------------------------------------------------------------------------------------
diff --git a/src/vm/stubhelpers.cpp b/src/vm/stubhelpers.cpp
index cbe1d37c94..20f76cdc5e 100644
--- a/src/vm/stubhelpers.cpp
+++ b/src/vm/stubhelpers.cpp
@@ -373,42 +373,6 @@ FORCEINLINE static void *GetCOMIPFromRCW_GetTarget(IUnknown *pUnk, ComPlusCallIn
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
-#ifdef _TARGET_X86_
- // m_pInterceptStub is either NULL if we never called on this method, -1 if we're not
- // hosted, or the host hook stub if we are hosted. The stub will extract the real target
- // from the 'this' argument.
- PVOID pInterceptStub = VolatileLoadWithoutBarrier(&pComInfo->m_pInterceptStub);
-
- if (pInterceptStub != (LPVOID)-1)
- {
- if (pInterceptStub != NULL)
- {
- return pInterceptStub;
- }
-
- if (NDirect::IsHostHookEnabled() || pComInfo->HasCopyCtorArgs())
- {
- return NULL;
- }
-
- if (!EnsureWritablePagesNoThrow(&pComInfo->m_pInterceptStub, sizeof(pComInfo->m_pInterceptStub)))
- {
- return NULL;
- }
-
- pComInfo->m_pInterceptStub = (LPVOID)-1;
- }
-#else // _TARGET_X86_
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- if (NDirect::IsHostHookEnabled())
- {
- // There's one static stub on !_TARGET_X86_.
- return (LPVOID)GetEEFuncEntryPoint(PInvokeStubForHost);
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-#endif // _TARGET_X86_
-#endif // FEATURE_CORECLR
LPVOID *lpVtbl = *(LPVOID **)pUnk;
return lpVtbl[pComInfo->m_cachedComSlot];
@@ -435,44 +399,6 @@ NOINLINE static IUnknown* GetCOMIPFromRCWHelper(LPVOID pFCall, OBJECTREF pSrc, M
pRetUnk.Release();
}
-#ifndef FEATURE_CORECLR
-#ifdef _TARGET_X86_
- GCX_PREEMP();
- Stub *pInterceptStub = NULL;
-
- if (pComInfo->m_pInterceptStub == NULL)
- {
- if (pComInfo->HasCopyCtorArgs())
- {
- // static stub that gets its arguments in a thread-static field
- pInterceptStub = NDirect::GetStubForCopyCtor();
- }
-
- if (NDirect::IsHostHookEnabled())
- {
- pInterceptStub = pComInfo->GenerateStubForHost(
- pMD->GetDomain()->GetLoaderAllocator()->GetStubHeap(),
- pInterceptStub);
- }
-
- EnsureWritablePages(&pComInfo->m_pInterceptStub);
-
- if (pInterceptStub != NULL)
- {
- if (InterlockedCompareExchangeT(&pComInfo->m_pInterceptStub,
- (LPVOID)pInterceptStub->GetEntryPoint(),
- NULL) != NULL)
- {
- pInterceptStub->DecRef();
- }
- }
- else
- {
- pComInfo->m_pInterceptStub = (LPVOID)-1;
- }
- }
-#endif // _TARGET_X86_
-#endif // !FEATURE_CORECLR
*ppTarget = GetCOMIPFromRCW_GetTarget(pRetUnk, pComInfo);
_ASSERTE(*ppTarget != NULL);
@@ -1285,109 +1211,7 @@ FCIMPL2(void*, StubHelpers::GetDelegateTarget, DelegateObject *pThisUNSAFE, UINT
}
FCIMPLEND
-#ifndef FEATURE_CORECLR // CAS
-static void DoDeclarativeActionsForPInvoke(MethodDesc* pCurrent)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- THROWS;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- MethodSecurityDescriptor MDSecDesc(pCurrent);
- MethodSecurityDescriptor::LookupOrCreateMethodSecurityDescriptor(&MDSecDesc);
-
- DeclActionInfo* pRuntimeDeclActionInfo = MDSecDesc.GetRuntimeDeclActionInfo();
- if (pRuntimeDeclActionInfo != NULL)
- {
- // Tell the debugger not to start on any managed code that we call in this method
- FrameWithCookie<DebuggerSecurityCodeMarkFrame> __dbgSecFrame;
-
- Security::DoDeclarativeActions(pCurrent, pRuntimeDeclActionInfo, NULL, &MDSecDesc);
-
- // Pop the debugger frame
- __dbgSecFrame.Pop();
- }
-}
-#endif // FEATURE_CORECLR
-
-#ifndef FEATURE_CORECLR
-#ifndef _WIN64
-FCIMPL3(void*, StubHelpers::GetFinalStubTarget, LPVOID pStubArg, LPVOID pUnmngThis, DWORD dwFlags)
-{
- CONTRACTL
- {
- FCALL_CHECK;
- PRECONDITION(SF_IsForwardStub(dwFlags));
- }
- CONTRACTL_END;
-
- if (SF_IsCALLIStub(dwFlags))
- {
- // stub argument is the target
- return pStubArg;
- }
- else if (SF_IsDelegateStub(dwFlags))
- {
- // stub argument is not used but we pass _methodPtrAux which is the target
- return pStubArg;
- }
- else if (SF_IsCOMStub(dwFlags))
- {
- // stub argument is a ComPlusCallMethodDesc
- ComPlusCallMethodDesc *pCMD = (ComPlusCallMethodDesc *)pStubArg;
- LPVOID *lpVtbl = *(LPVOID **)pUnmngThis;
- return lpVtbl[pCMD->m_pComPlusCallInfo->m_cachedComSlot];
- }
- else // P/Invoke
- {
- // secret stub argument is an NDirectMethodDesc
- NDirectMethodDesc *pNMD = (NDirectMethodDesc *)pStubArg;
- return pNMD->GetNativeNDirectTarget();
- }
-}
-FCIMPLEND
-#endif // !_WIN64
-
-FCIMPL1(void, StubHelpers::DemandPermission, NDirectMethodDesc *pNMD)
-{
- FCALL_CONTRACT;
- // ETWOnStartup (SecurityCatchCall, SecurityCatchCallEnd); // this is messing up HMF below
-
- if (pNMD != NULL)
- {
- g_IBCLogger.LogMethodDescAccess(pNMD);
-
- if (pNMD->IsInterceptedForDeclSecurity())
- {
- if (pNMD->IsInterceptedForDeclSecurityCASDemandsOnly() &&
- SecurityStackWalk::HasFlagsOrFullyTrusted(1 << SECURITY_UNMANAGED_CODE))
- {
- // Track perfmon counters. Runtime security checks.
- Security::IncrementSecurityPerfCounter();
- }
- else
- {
- HELPER_METHOD_FRAME_BEGIN_0();
- DoDeclarativeActionsForPInvoke(pNMD);
- HELPER_METHOD_FRAME_END();
- }
- }
- }
- else
- {
- // This is either CLR->COM or delegate P/Invoke (we don't call this helper for CALLI).
- HELPER_METHOD_FRAME_BEGIN_0();
- SecurityStackWalk::SpecialDemand(SSWT_DECLARATIVE_DEMAND, SECURITY_UNMANAGED_CODE);
- HELPER_METHOD_FRAME_END();
- }
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL2(void, StubHelpers::ThrowInteropParamException, UINT resID, UINT paramIdx)
{
diff --git a/src/vm/stubhelpers.h b/src/vm/stubhelpers.h
index b64d2868d8..f7577d7a44 100644
--- a/src/vm/stubhelpers.h
+++ b/src/vm/stubhelpers.h
@@ -95,12 +95,6 @@ public:
static FCDECL1(void*, GetNDirectTarget, NDirectMethodDesc* pNMD);
static FCDECL2(void*, GetDelegateTarget, DelegateObject *pThisUNSAFE, UINT_PTR *ppStubArg);
-#ifndef FEATURE_CORECLR
-#ifndef _WIN64
- static FCDECL3(void*, GetFinalStubTarget, LPVOID pStubArg, LPVOID pUnmngThis, DWORD dwFlags);
-#endif // !_WIN64
- static FCDECL1(void, DemandPermission, NDirectMethodDesc *pNMD);
-#endif // !FEATURE_CORECLR
static FCDECL2(void, ThrowInteropParamException, UINT resID, UINT paramIdx);
static FCDECL1(Object*, GetHRExceptionObject, HRESULT hr);
diff --git a/src/vm/syncblk.cpp b/src/vm/syncblk.cpp
index 171a8d3bb7..826507e535 100644
--- a/src/vm/syncblk.cpp
+++ b/src/vm/syncblk.cpp
@@ -3298,10 +3298,6 @@ bool AwareLock::Contention(INT32 timeOut)
COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cContention++);
-#ifndef FEATURE_CORECLR
- // Fire a contention start event for a managed contention
- FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
LogContention();
Thread *pCurThread = GetThread();
@@ -3406,9 +3402,6 @@ entered: ;
Enter();
bEntered = TRUE;
}
-#ifndef FEATURE_CORECLR
- FireEtwContentionStop(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
return bEntered;
}
diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp
index 5bb9bf35d7..3c90c87c1e 100644
--- a/src/vm/threads.cpp
+++ b/src/vm/threads.cpp
@@ -612,14 +612,6 @@ void Thread::ChooseThreadCPUGroupAffinity()
if (!CPUGroupInfo::CanEnableGCCPUGroups() || !CPUGroupInfo::CanEnableThreadUseAllCpuGroups())
return;
-#ifndef FEATURE_CORECLR
- // We only handle the non-hosted case here. If CLR is hosted, the hosting
- // process controls the physical OS Threads. If CLR is not hosted, we can
- // set thread group affinity on OS threads directly.
- HostComHolder<IHostTask> pHostTask (GetHostTaskWithAddRef());
- if (pHostTask != NULL)
- return;
-#endif //!FEATURE_CORECLR
//Borrow the ThreadStore Lock here: Lock ThreadStore before distributing threads
ThreadStoreLockHolder TSLockHolder(TRUE);
@@ -652,14 +644,6 @@ void Thread::ClearThreadCPUGroupAffinity()
if (!CPUGroupInfo::CanEnableGCCPUGroups() || !CPUGroupInfo::CanEnableThreadUseAllCpuGroups())
return;
-#ifndef FEATURE_CORECLR
- // We only handle the non-hosted case here. If CLR is hosted, the hosting
- // process controls the physical OS Threads. If CLR is not hosted, we can
- // set thread group affinity on OS threads directly.
- HostComHolder<IHostTask> pHostTask (GetHostTaskWithAddRef());
- if (pHostTask != NULL)
- return;
-#endif //!FEATURE_CORECLR
ThreadStoreLockHolder TSLockHolder(TRUE);
@@ -1919,11 +1903,6 @@ Thread::Thread()
m_dwLockCount = 0;
m_dwBeginLockCount = 0;
-#ifndef FEATURE_CORECLR
- m_dwBeginCriticalRegionCount = 0;
- m_dwCriticalRegionCount = 0;
- m_dwThreadAffinityCount = 0;
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
dbg_m_cSuspendedThreads = 0;
@@ -2898,106 +2877,6 @@ HANDLE Thread::CreateUtilityThread(Thread::StackSizeBucket stackSizeBucket, LPTH
return hThread;
}
-#ifndef FEATURE_CORECLR
-/*
- The following are copied from MSDN:
- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/thread_stack_size.asp
-
- To change the initially committed stack space, use the dwStackSize parameter of the CreateThread,
- CreateRemoteThread, or CreateFiber function. This value is rounded up to the nearest page.
- Generally, the reserve size is the default reserve size specified in the executable header.
- However, if the initially committed size specified by dwStackSize is larger than the default reserve size,
- the reserve size is this new commit size rounded up to the nearest multiple of 1 MB.
-
- To change the reserved stack size, set the dwCreationFlags parameter of CreateThread or CreateRemoteThread
- to STACK_SIZE_PARAM_IS_A_RESERVATION and use the dwStackSize parameter. In this case, the initially
- committed size is the default size specified in the executable header.
-
-*/
-BOOL Thread::CheckThreadStackSize(SIZE_T *pSizeToCommitOrReserve,
- BOOL isSizeToReserve // When TRUE, the previous argument is the stack size to reserve.
- // Otherwise, it is the size to commit.
- )
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- //g_SystemInfo is global pointer to SYSTEM_INFO struct
- SIZE_T dwAllocSize = (SIZE_T)g_SystemInfo.dwAllocationGranularity;
- SIZE_T dwPageSize = (SIZE_T)g_SystemInfo.dwPageSize;
-
- //Don't want users creating threads
- // with a stackSize request < 256K
- //This value may change up or down as we see fit so don't doc to user
- //
- if(isSizeToReserve && 0x40000 > (*pSizeToCommitOrReserve))
- {
- *pSizeToCommitOrReserve = 0x40000;
- }
-
- *pSizeToCommitOrReserve = ALIGN(*pSizeToCommitOrReserve, dwAllocSize);
-
- //
- // Let's get the stack sizes from the PE file that started process.
- //
- SIZE_T ExeSizeOfStackReserve = 0;
- SIZE_T ExeSizeOfStackCommit = 0;
-
- if (!GetProcessDefaultStackSize(&ExeSizeOfStackReserve, &ExeSizeOfStackCommit))
- return FALSE;
-
- // Now let's decide which sizes OS are going to use.
- SIZE_T sizeToReserve = 0;
- SIZE_T sizeToCommit = 0;
-
- if (isSizeToReserve) {
- // The passed-in *pSizeToCommitOrReserve is the stack size to reserve.
- sizeToReserve = *pSizeToCommitOrReserve;
- // OS will use ExeSizeOfStackCommit as the commited size.
- sizeToCommit = ExeSizeOfStackCommit;
- }
- else {
- // The passed-in *pSizeToCommitOrReserve is the stack size to commit.
- sizeToCommit = *pSizeToCommitOrReserve;
- // OS will use ExeSizeOfStackReserve as the reserved size.
- sizeToReserve = ExeSizeOfStackReserve;
-
- // However, if the initially committed size specified by dwStackSize is larger than
- // the default reserve size, the reserve size is this new commit size rounded up to
- // the nearest multiple of 1 MB.
- if (sizeToCommit > ExeSizeOfStackReserve) {
- sizeToReserve = ALIGN(sizeToCommit, 0x1000000);
- }
-
- if (!g_pConfig->GetDisableCommitThreadStack())
- {
- // We will commit the full stack when a thread starts. But if the PageFile is full, we may hit
- // stack overflow at random places during startup.
- // Therefore if we are unlikely to obtain space from PageFile, we will fail creation of a thread.
-
- *pSizeToCommitOrReserve = sizeToReserve - HARD_GUARD_REGION_SIZE;
-
- // OS's behavior is not consistent on if guard page is marked when we ask OS to commit the stack
- // up to 2nd to last page.
- // On Win2k3, the 2nd to last page is marked with guard bit.
- // On WinXP, the 2nd to last page is not marked with guard bit.
- // To be safe, we will not commit the 2nd to last page.
- *pSizeToCommitOrReserve -= HARD_GUARD_REGION_SIZE;
- // To make it more interesting, on X64, if we request to commit stack except the last two pages,
- // OS commit the whole stack, and mark the last two pages as guard page.
- *pSizeToCommitOrReserve -= 2*HARD_GUARD_REGION_SIZE;
- }
- }
-
- // Ok, we now know what sizes OS will use to create the thread.
- // Check to see if we have the room for guard pages.
- return ThreadWillCreateGuardPage(sizeToReserve, sizeToCommit);
-}
-#endif // FEATURE_CORECLR
BOOL Thread::GetProcessDefaultStackSize(SIZE_T* reserveSize, SIZE_T* commitSize)
{
@@ -3059,7 +2938,6 @@ BOOL Thread::CreateNewOSThread(SIZE_T sizeToCommitOrReserve, LPTHREAD_START_ROUT
HANDLE h = NULL;
DWORD dwCreationFlags = CREATE_SUSPENDED;
-#ifdef FEATURE_CORECLR
dwCreationFlags |= STACK_SIZE_PARAM_IS_A_RESERVATION;
#ifndef FEATURE_PAL // the PAL does its own adjustments as necessary
@@ -3070,29 +2948,6 @@ BOOL Thread::CreateNewOSThread(SIZE_T sizeToCommitOrReserve, LPTHREAD_START_ROUT
sizeToCommitOrReserve = OS_PAGE_SIZE + 1;
}
#endif // !FEATURE_PAL
-#else
- if(sizeToCommitOrReserve != 0)
- {
- dwCreationFlags |= STACK_SIZE_PARAM_IS_A_RESERVATION;
-
- //
- // In this case we also force CommitThreadStack to commit the whole stack, even if we're configured not to do so.
- // The config value is used to reduce the resource usage for default stack allocations; for non-default allocations,
- // we assume the user has given us the correct size (and they're really going to need it). This way we don't
- // need to offer a Thread constructor that takes a confusing "stack size param is a commit size" parameter.
- //
- SetThreadStateNC(TSNC_ForceStackCommit);
- }
-
- // Check that we will have (reserved and never committed) guard pages at the end of the stack.
- // If this call returns false then it will lead to an OOM exception on return.
- // This is reasonable since a large stack was requested and we couldn't get it.
- if(!CheckThreadStackSize(&sizeToCommitOrReserve,
- (sizeToCommitOrReserve != 0)))
- {
- return FALSE;
- }
-#endif
intermediateThreadParam* lpThreadArgs = new (nothrow) intermediateThreadParam;
if (lpThreadArgs == NULL)
@@ -4236,10 +4091,6 @@ DWORD MsgWaitHelper(int numWaiters, HANDLE* phEvent, BOOL bWaitAll, DWORD millis
// So on CoreCLR (where FEATURE_COMINTEROP is not currently defined) we can actually reach this point.
// We can't fix this, because it's a breaking change, so we just won't assert here.
// The result is that WaitAll on an STA thread in CoreCLR will behave stragely, as described above.
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- else
- _ASSERTE(!"WaitAll in an STA with more than one handle will deadlock");
-#endif
}
if (bWaitAll)
@@ -7707,81 +7558,6 @@ __declspec(noinline) void AllocateSomeStack(){
BOOL Thread::CommitThreadStack(Thread* pThreadOptional)
{
-#ifndef FEATURE_CORECLR
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- if (FAILED(CLRSetThreadStackGuarantee(STSGuarantee_Force)))
- return FALSE;
-
- if (g_pConfig->GetDisableCommitThreadStack() && (pThreadOptional == NULL || !pThreadOptional->HasThreadStateNC(TSNC_ForceStackCommit)))
- return TRUE;
-
-
- // This is a temporary fix for VSWhidbey 259155. In CommitThreadStack() we determine the bounds of the
- // region between the guard page and the hard guard region for a thread's stack and then commit that
- // region. Sometimes we cross a page boundary while calculating the bounds or doing the commit (in
- // VirtualQuery or VirtualAlloc), such that the guard page is moved after we've already gotten it's
- // location. When that happens we commit too many pages and destroy the guard page. To fix this we
- // do a small stack allocation that ensures that we have enough stack space for all of the
- // CommitThreadStack() work
-
- AllocateSomeStack();
-
- // Grab the info about the first region of the stack. First, we grab the region where we are now (&tmpMBI),
- // then we use the allocation base of that to grab the first region.
- MEMORY_BASIC_INFORMATION tmpMBI;
- SIZE_T dwRes;
-
- dwRes = ClrVirtualQuery((const void *)&tmpMBI, &tmpMBI, sizeof(MEMORY_BASIC_INFORMATION));
-
- if (sizeof(MEMORY_BASIC_INFORMATION) != dwRes)
- {
- return FALSE;
- }
-
- dwRes = ClrVirtualQuery((const void *)((BYTE*)tmpMBI.AllocationBase + HARD_GUARD_REGION_SIZE), &tmpMBI, sizeof(MEMORY_BASIC_INFORMATION));
-
- if (sizeof(MEMORY_BASIC_INFORMATION) != dwRes)
- {
- return FALSE;
- }
-
- // We commit the reserved part of the stack, if necessary, minus one page for the "hard" guard page.
- if (tmpMBI.State == MEM_RESERVE)
- {
- // Note: we leave the "hard" guard region uncommitted.
- void *base = (BYTE*)tmpMBI.AllocationBase + HARD_GUARD_REGION_SIZE;
-
- // We are committing a page on stack. If we call host for this operation,
- // host needs to avoid adding it to the memory consumption. Therefore
- // we call into OS directly.
-#undef VirtualAlloc
- void *p = VirtualAlloc(base,
- tmpMBI.RegionSize,
- MEM_COMMIT,
- PAGE_READWRITE);
-#define VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect) \
- Dont_Use_VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect)
-
- if (p != base )
- {
- DWORD err = GetLastError();
- STRESS_LOG2(LF_EH, LL_ALWAYS,
- "Thread::CommitThreadStack: failed to commit stack for TID 0x%x with error 0x%x\n",
- ::GetCurrentThreadId(), err);
-
- return FALSE;
- }
- }
-
- INDEBUG(DebugLogStackMBIs());
-
-#endif
return TRUE;
}
@@ -8802,10 +8578,6 @@ void Thread::EnterContextRestricted(Context *pContext, ContextTransitionFrame *p
{
pFrame->SetLockCount(m_dwBeginLockCount);
m_dwBeginLockCount = m_dwLockCount;
-#ifndef FEATURE_CORECLR
- pFrame->SetCriticalRegionCount(m_dwBeginCriticalRegionCount);
- m_dwBeginCriticalRegionCount = m_dwCriticalRegionCount;
-#endif // !FEATURE_CORECLR
}
if (m_Context == pContext) {
@@ -8849,22 +8621,6 @@ void Thread::EnterContextRestricted(Context *pContext, ContextTransitionFrame *p
PushDomain(pDomain->GetId());
STRESS_LOG1(LF_APPDOMAIN, LL_INFO100000, "Entering into ADID=%d\n", pDomain->GetId().m_dwId);
-#ifndef FEATURE_CORECLR
- //
- // Push execution contexts (that could contain call context) into frame to avoid leaks
- //
-
- if (IsExposedObjectSet())
- {
- THREADBASEREF ref = (THREADBASEREF) ObjectFromHandle(m_ExposedObject);
- _ASSERTE(ref != NULL);
- if (ref->GetExecutionContext() != NULL)
- {
- pFrame->SetReturnExecutionContext(ref->GetExecutionContext());
- ref->SetExecutionContext(NULL);
- }
- }
-#endif //!FEATURE_CORECLR
//
// Store the last thrown object in the ContextTransitionFrame before we null it out
@@ -8989,10 +8745,6 @@ void Thread::ReturnToContext(ContextTransitionFrame *pFrame)
m_dwLockCount = m_dwBeginLockCount;
m_dwBeginLockCount = pFrame->GetLockCount();
-#ifndef FEATURE_CORECLR
- m_dwCriticalRegionCount = m_dwBeginCriticalRegionCount;
- m_dwBeginCriticalRegionCount = pFrame->GetCriticalRegionCount();
-#endif // !FEATURE_CORECLR
}
@@ -9068,18 +8820,6 @@ void Thread::ReturnToContext(ContextTransitionFrame *pFrame)
if (fChangedDomains)
{
-#ifndef FEATURE_CORECLR
- //
- // Pop execution contexts (could contain call context) from frame if applicable
- //
-
- if (IsExposedObjectSet())
- {
- THREADBASEREF ref = (THREADBASEREF) ObjectFromHandle(m_ExposedObject);
- _ASSERTE(ref != NULL);
- ref->SetExecutionContext(pFrame->GetReturnExecutionContext());
- }
-#endif //!FEATURE_CORECLR
// Do this last so that thread is not labeled as out of the domain until all cleanup is done.
ADID adid=pCurrentDomain->GetId();
@@ -9192,11 +8932,9 @@ void Thread::RaiseCrossContextExceptionHelper(Exception* pEx, ContextTransitionF
// Ensure that IP for WatsonBucketing has been collected if the exception is preallocated.
#ifdef _DEBUG
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
if (CLRException::IsPreallocatedExceptionObject(CLRException::GetThrowableFromException(pEx)))
{
@@ -9491,11 +9229,7 @@ void DECLSPEC_NORETURN Thread::RaiseCrossContextException(Exception* pExOrig, Co
switch (kind)
{
case kLastException:
-#ifdef FEATURE_CORECLR
gc.pMarshaledThrowable = gc.orBlob;
-#else
- AppDomainHelper::UnmarshalObject(GetAppDomain(), &gc.orBlob, &gc.pMarshaledThrowable);
-#endif //FEATURE_CORECLR
break;
case kOutOfMemoryException:
@@ -10225,7 +9959,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO
{
_ASSERTE(flags == MTCSF_NormalBase);
-#ifdef FEATURE_CORECLR
if(!IsSingleAppDomain())
{
// This assert shouldnt be hit in CoreCLR since:
@@ -10239,11 +9972,9 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO
// So, if this is hit, something is not right!
_ASSERTE(!"How come a managed thread in CoreCLR has suffered unhandled exception in DefaultDomain?");
}
-#endif // FEATURE_CORECLR
LOG((LF_EH, LL_INFO100, "ThreadBaseRedirectingFilter: setting TSNC_ProcessedUnhandledException\n"));
-#if defined(FEATURE_CORECLR)
//
// In the default domain, when an exception goes unhandled on a managed thread whose threadbase is in the VM (e.g. explicitly spawned threads,
// ThreadPool threads, finalizer thread, etc), CLR can end up in the unhandled exception processing path twice.
@@ -10271,7 +10002,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO
// will fail to honor the host policy (e.g. swallow unhandled exception). Thus, the 2nd unhandled exception may end up crashing the app when it should not.
//
if (IsSingleAppDomain() && (ret != EXCEPTION_EXECUTE_HANDLER))
-#endif // defined(FEATURE_CORECLR)
{
// Since we have already done unhandled exception processing for it, we dont want it
// to happen again if our UEF gets invoked upon returning back to the OS.
@@ -10321,9 +10051,7 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
TryParam *pTryParam;
Thread *pThread;
-#ifdef FEATURE_CORECLR
BOOL *pfHadException;
-#endif // FEATURE_CORECLR
#ifdef WIN64EXCEPTIONS
Frame *pFrame;
@@ -10333,10 +10061,8 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
args.pTryParam = &param;
args.pThread = pThread;
-#ifdef FEATURE_CORECLR
BOOL fHadException = TRUE;
args.pfHadException = &fHadException;
-#endif // FEATURE_CORECLR
#ifdef WIN64EXCEPTIONS
args.pFrame = pFrame;
@@ -10368,13 +10094,10 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
}
PAL_ENDTRY;
-#ifdef FEATURE_CORECLR
*(pArgs->pfHadException) = FALSE;
-#endif // FEATURE_CORECLR
}
PAL_FINALLY
{
-#ifdef FEATURE_CORECLR
// If we had a breakpoint exception that has gone unhandled,
// then switch to the correct AD context. Its fine to do this
// here because:
@@ -10386,7 +10109,6 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
{
ReturnToPreviousAppDomain();
}
-#endif // FEATURE_CORECLR
catchFrame.Pop();
}
PAL_ENDTRY;
@@ -11720,13 +11442,6 @@ void Thread::InternalReset(BOOL fFull, BOOL fNotFinalizerThread, BOOL fThreadObj
FullResetThread();
}
-#ifndef FEATURE_CORECLR
- _ASSERTE (m_dwCriticalRegionCount == 0);
- m_dwCriticalRegionCount = 0;
-
- _ASSERTE (m_dwThreadAffinityCount == 0);
- m_dwThreadAffinityCount = 0;
-#endif // !FEATURE_CORECLR
//m_MarshalAlloc.Collapse(NULL);
@@ -11850,9 +11565,6 @@ HRESULT Thread::Reset(BOOL fFull)
ResetThreadStateNC(TSNC_UnbalancedLocks);
m_dwLockCount = 0;
-#ifndef FEATURE_CORECLR
- m_dwCriticalRegionCount = 0;
-#endif // !FEATURE_CORECLR
InternalSwitchOut();
m_OSThreadId = SWITCHED_OUT_FIBER_OSID;
@@ -12227,9 +11939,6 @@ HRESULT Thread::LocksHeld(SIZE_T *pLockCount)
LIMITED_METHOD_CONTRACT;
*pLockCount = m_dwLockCount;
-#ifndef FEATURE_CORECLR
- *pLockCount += m_dwCriticalRegionCount;
-#endif // !FEATURE_CORECLR
return S_OK;
}
@@ -12823,37 +12532,6 @@ void Thread::BeginThreadAffinity()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- if (!CLRTaskHosted())
- {
- return;
- }
-
- if (IsGCSpecialThread() || IsDbgHelperSpecialThread())
- {
- return;
- }
-
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTaskManager *pManager = CorHost2::GetHostTaskManager();
-
- HRESULT hr;
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- hr = pManager->BeginThreadAffinity();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- _ASSERTE (hr == S_OK);
- Thread *pThread = GetThread();
-
- if (pThread)
- {
- pThread->IncThreadAffinityCount();
-#ifdef _DEBUG
- pThread->AddFiberInfo(Thread::ThreadTrackInfo_Affinity);
-#endif
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-#endif // !FEATURE_CORECLR
}
@@ -12862,40 +12540,6 @@ void Thread::EndThreadAffinity()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- if (!CLRTaskHosted())
- {
- return;
- }
-
- if (IsGCSpecialThread() || IsDbgHelperSpecialThread())
- {
- return;
- }
-
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTaskManager *pManager = CorHost2::GetHostTaskManager();
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-
- Thread *pThread = GetThread();
- if (pThread)
- {
- pThread->DecThreadAffinityCount ();
-#ifdef _DEBUG
- pThread->AddFiberInfo(Thread::ThreadTrackInfo_Affinity);
-#endif
- }
-
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- HRESULT hr = S_OK;
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- hr = pManager->EndThreadAffinity();
- END_SO_TOLERANT_CODE_CALLING_HOST;
-
- _ASSERTE (hr == S_OK);
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-#endif // !FEATURE_CORECLR
}
void Thread::SetupThreadForHost()
diff --git a/src/vm/threads.h b/src/vm/threads.h
index 0d0dd30cae..a7f400e7dc 100644
--- a/src/vm/threads.h
+++ b/src/vm/threads.h
@@ -585,12 +585,7 @@ inline Thread* GetThreadNULLOk()
#endif
//***************************************************************************
-#if defined(_DEBUG) && defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- #define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 1
- #define TRACK_CXX_EXCEPTION_CODE_HACK
-#else
#define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 0
-#endif
// manifest constant for waiting in the exposed classlibs
const INT32 INFINITE_TIMEOUT = -1;
@@ -1641,13 +1636,6 @@ public:
// in the object header to store it.
DWORD m_ThreadId;
- #if HAS_TRACK_CXX_EXCEPTION_CODE_HACK // do we have C++ exception code tracking?
- // It's very hard to deal with SEH properly using C++ catch handlers. The
- // following field is updated with the correct SEH exception whenever a C++
- // __CxxFrameHandler3 call is made on this thread. If you grab it at the
- // top of a C++ catch(...), it's likely to be correct.
- DWORD m_LastCxxSEHExceptionCode;
- #endif // HAS_TRACK_CXX_EXCEPTION_CODE_HACK
// RWLock state
LockEntry *m_pHead;
@@ -1790,12 +1778,6 @@ public:
private:
DWORD m_dwBeginLockCount; // lock count when the thread enters current domain
-#ifndef FEATURE_CORECLR
- DWORD m_dwBeginCriticalRegionCount; // lock count when the thread enters current domain
- DWORD m_dwCriticalRegionCount;
-
- DWORD m_dwThreadAffinityCount;
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
DWORD dbg_m_cSuspendedThreads;
@@ -1888,68 +1870,19 @@ public:
LIMITED_METHOD_CONTRACT;
_ASSERTE(m_dwLockCount >= m_dwBeginLockCount);
-#ifndef FEATURE_CORECLR
- _ASSERTE(m_dwCriticalRegionCount >= m_dwBeginCriticalRegionCount);
-#endif // !FEATURE_CORECLR
// Equivalent to (m_dwLockCount != m_dwBeginLockCount ||
// m_dwCriticalRegionCount ! m_dwBeginCriticalRegionCount),
// but without branching instructions
BOOL fHasLock = (m_dwLockCount ^ m_dwBeginLockCount);
-#ifndef FEATURE_CORECLR
- fHasLock |= (m_dwCriticalRegionCount ^ m_dwBeginCriticalRegionCount);
-#endif // !FEATURE_CORECLR
return fHasLock;
}
-#ifndef FEATURE_CORECLR
- inline void BeginCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- if (CLRHosted())
- {
- m_dwCriticalRegionCount ++;
- _ASSERTE (m_dwCriticalRegionCount != 0);
- }
- }
-
- inline void EndCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- if (CLRHosted())
- {
- _ASSERTE (m_dwCriticalRegionCount > 0);
- m_dwCriticalRegionCount --;
- }
- }
-
- inline void BeginCriticalRegion_NoCheck()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- m_dwCriticalRegionCount ++;
- _ASSERTE (m_dwCriticalRegionCount != 0);
- }
-
- inline void EndCriticalRegion_NoCheck()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- _ASSERTE (m_dwCriticalRegionCount > 0);
- m_dwCriticalRegionCount --;
- }
-#endif // !FEATURE_CORECLR
inline BOOL HasCriticalRegion()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return m_dwCriticalRegionCount != 0;
-#else
return FALSE;
-#endif
}
inline DWORD GetNewHashCode()
@@ -2000,45 +1933,11 @@ public:
static void BeginThreadAffinity();
static void EndThreadAffinity();
-#ifndef FEATURE_CORECLR
- inline void IncThreadAffinityCount()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- m_dwThreadAffinityCount++;
- _ASSERTE (m_dwThreadAffinityCount > 0);
- }
- inline void DecThreadAffinityCount()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- _ASSERTE (m_dwThreadAffinityCount > 0);
- m_dwThreadAffinityCount --;
- }
-
- static void BeginThreadAffinityAndCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- BeginThreadAffinity();
- GetThread()->BeginCriticalRegion();
- }
-
- static void EndThreadAffinityAndCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- GetThread()->EndCriticalRegion();
- EndThreadAffinity();
- }
-#endif // !FEATURE_CORECLR
BOOL HasThreadAffinity()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return m_dwThreadAffinityCount > 0;
-#else
return FALSE;
-#endif
}
private:
@@ -2636,11 +2535,7 @@ private:
//
// In Telesto, we don't support true appdomain marshaling so the "orBlob" is in fact an
// agile wrapper object whose ToString() echoes the original exception's ToString().
-#ifdef FEATURE_CORECLR
typedef OBJECTREF ORBLOBREF;
-#else
- typedef U1ARRAYREF ORBLOBREF;
-#endif
RaiseCrossContextResult TryRaiseCrossContextException(Exception **ppExOrig,
Exception *pException,
@@ -3007,10 +2902,6 @@ public:
static bool SysStartSuspendForDebug(AppDomain *pAppDomain);
static bool SysSweepThreadsForDebug(bool forceSync);
static void SysResumeFromDebug(AppDomain *pAppDomain);
-#ifndef FEATURE_CORECLR
- void UserSuspendThread();
- BOOL UserResumeThread();
-#endif // FEATURE_CORECLR
void UserSleep(INT32 time);
@@ -3983,9 +3874,6 @@ private:
// For getting a thread to a safe point. A client waits on the event, which is
// set by the thread when it reaches a safe spot.
-#ifndef FEATURE_CORECLR
- void FinishSuspendingThread();
-#endif // FEATURE_CORECLR
void SetSafeEvent();
public:
@@ -5605,10 +5493,6 @@ public:
LCID GetThreadCultureIdNoThrow(Thread *pThread, BOOL bUICulture);
-#ifndef FEATURE_CORECLR
-// Request/Remove Thread Affinity for the current thread
-typedef StateHolder<Thread::BeginThreadAffinityAndCriticalRegion, Thread::EndThreadAffinityAndCriticalRegion> ThreadAffinityAndCriticalRegionHolder;
-#endif // !FEATURE_CORECLR
typedef StateHolder<Thread::BeginThreadAffinity, Thread::EndThreadAffinity> ThreadAffinityHolder;
typedef Thread::ForbidSuspendThreadHolder ForbidSuspendThreadHolder;
diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp
index cdfbd79497..d65f3a3af9 100644
--- a/src/vm/threadsuspend.cpp
+++ b/src/vm/threadsuspend.cpp
@@ -3328,32 +3328,6 @@ void Thread::RareDisablePreemptiveGC()
#endif // PROFILING_SUPPORTED
-#if !defined(FEATURE_CORECLR) // simple hosting
- // First, check to see if there's an IDbgThreadControl interface that needs
- // notification of the suspension
- if (m_State & TS_DebugSuspendPending)
- {
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->ThreadIsBlockingForDebugger();
-
- }
-
- if (CLRGCHosted())
- {
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->ThreadIsBlockingForSuspension();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-
- // If not, check to see if there's an IGCThreadControl interface that needs
- // notification of the suspension
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- pGCThreadControl->ThreadIsBlockingForSuspension();
-#endif // !defined(FEATURE_CORECLR)
DWORD status = S_OK;
SetThreadStateNC(TSNC_WaitUntilGCFinished);
@@ -3453,32 +3427,6 @@ void Thread::RareDisablePreemptiveGC()
#endif // PROFILING_SUPPORTED
-#if !defined(FEATURE_CORECLR) // simple hosting
- // First, check to see if there's an IDbgThreadControl interface that needs
- // notification of the suspension
- if (m_State & TS_DebugSuspendPending)
- {
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->ThreadIsBlockingForDebugger();
-
- }
-
- if (CLRGCHosted())
- {
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->ThreadIsBlockingForSuspension();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-
- // If not, check to see if there's an IGCThreadControl interface that needs
- // notification of the suspension
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- pGCThreadControl->ThreadIsBlockingForSuspension();
-#endif // !defined(FEATURE_CORECLR)
// The thread is blocked for shutdown. We do not concern for GC violation.
CONTRACT_VIOLATION(GCViolation);
@@ -3819,34 +3767,12 @@ void Thread::RareEnablePreemptiveGC()
// Life's much simpler this way...
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Check to see if there's an IDbgThreadControl interface that needs
- // notification of the suspension
- if (m_State & TS_DebugSuspendPending)
- {
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->ThreadIsBlockingForDebugger();
-
- }
-#endif // !defined(FEATURE_CORECLR)
#endif // DEBUGGING_SUPPORTED
#ifdef LOGGING
-#if !defined(FEATURE_CORECLR) // simple hosting
- if (!CorHost::IsDebuggerSpecialThread(GetThreadId()))
-#endif // !defined(FEATURE_CORECLR)
{
LOG((LF_CORDB, LL_INFO1000, "[0x%x] SUSPEND: suspended while enabling gc.\n", GetThreadId()));
}
-#if !defined(FEATURE_CORECLR) // simple hosting
- else
- {
- LOG((LF_CORDB, LL_INFO1000,
- "[0x%x] ALERT: debugger special thread did not suspend while enabling gc.\n", GetThreadId()));
- }
-#endif // !defined(FEATURE_CORECLR)
#endif
WaitSuspendEvents(); // sets bits, too
@@ -4186,20 +4112,8 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason)
// Notify the interface of the pending suspension
switch (reason) {
case RedirectReason_GCSuspension:
-#if !defined(FEATURE_CORECLR) // simple hosting
- if (CorHost::GetGCThreadControl())
- CorHost::GetGCThreadControl()->ThreadIsBlockingForSuspension();
- if (CLRGCHosted())
- {
- NotifyHostOnGCSuspension();
- }
-#endif // !defined(FEATURE_CORECLR)
break;
case RedirectReason_DebugSuspension:
-#if !defined(FEATURE_CORECLR) // simple hosting
- if (CorHost::GetDebuggerThreadControl() && CorHost::IsDebuggerSpecialThread(pThread->GetThreadId()))
- CorHost::GetDebuggerThreadControl()->ThreadIsBlockingForDebugger();
-#endif // !defined(FEATURE_CORECLR)
break;
case RedirectReason_UserSuspension:
// Do nothing;
@@ -4857,21 +4771,6 @@ HRESULT ThreadSuspend::SuspendRuntime(ThreadSuspend::SUSPEND_REASON reason)
STRESS_LOG1(LF_SYNC, LL_INFO1000, "Thread::SuspendRuntime(reason=0x%x)\n", reason);
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Alert the host that a GC is starting, in case the host is scheduling threads
- // for non-runtime tasks during GC.
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- pGCThreadControl->SuspensionStarting();
-
- if (CLRGCHosted())
- {
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->SuspensionStarting();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-#endif // !defined(FEATURE_CORECLR)
#ifdef PROFILING_SUPPORTED
// If the profiler desires information about GCs, then let it know that one
@@ -5562,33 +5461,6 @@ void ThreadSuspend::ResumeRuntime(BOOL bFinishedGC, BOOL SuspendSucceded)
// Notify everyone who cares, that this suspension is over, and this thread is going to go do other things.
//
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Alert the host that a GC is ending, in case the host is scheduling threads
- // for non-runtime tasks during GC.
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- {
- // If we the suspension was for a GC, tell the host what generation GC.
- DWORD Generation = (bFinishedGC
- ? GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration()
- : ~0U);
-
- pGCThreadControl->SuspensionEnding(Generation);
- }
-
- if (CLRGCHosted())
- {
- // If we the suspension was for a GC, tell the host what generation GC.
- DWORD Generation = (bFinishedGC
- ? GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration()
- : ~0U);
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->SuspensionEnding(Generation);
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-#endif // !defined(FEATURE_CORECLR)
#ifdef PROFILING_SUPPORTED
// Need to give resume event for the GC thread
@@ -5961,13 +5833,6 @@ bool Thread::SysStartSuspendForDebug(AppDomain *pAppDomain)
// Caller is expected to be holding the ThreadStore lock
_ASSERTE(ThreadStore::HoldingThreadStore() || IsAtProcessExit());
-#if !defined(FEATURE_CORECLR) // simple hosting
- // If there is a debugging thread control object, tell it we're suspending the Runtime.
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->StartBlockingForDebugger(0);
-#endif // !defined(FEATURE_CORECLR)
// NOTE::NOTE::NOTE::NOTE::NOTE
// This function has parallel logic in SuspendRuntime. Please make
@@ -6341,16 +6206,6 @@ void Thread::SysResumeFromDebug(AppDomain *pAppDomain)
LOG((LF_CORDB, LL_INFO1000, "RESUME: starting resume AD:0x%x.\n", pAppDomain));
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Notify the client that it should release any threads that it had doing work
- // while the runtime was debugger-suspended.
- IDebuggerThreadControl *pIDTC = CorHost::GetDebuggerThreadControl();
- if (pIDTC)
- {
- LOG((LF_CORDB, LL_INFO1000, "RESUME: notifying IDebuggerThreadControl client.\n"));
- pIDTC->ReleaseAllRuntimeThreads();
- }
-#endif // !defined(FEATURE_CORECLR)
// Make sure we completed the previous sync
_ASSERTE(m_DebugWillSyncCount == -1);
@@ -6407,321 +6262,6 @@ void Thread::SysResumeFromDebug(AppDomain *pAppDomain)
LOG((LF_CORDB, LL_INFO1000, "RESUME: resume complete. Trap count: %d\n", g_TrapReturningThreads.Load()));
}
-#ifndef FEATURE_CORECLR
-
-// Suspend a thread at the system level. We distinguish between user suspensions,
-// and system suspensions so that a VB program cannot resume a thread we have
-// suspended for GC.
-//
-// This service won't return until the suspension is complete. This deserves some
-// explanation. The thread is considered to be suspended if it can make no further
-// progress within the EE. For example, a thread that has exited the EE via
-// COM Interop or N/Direct is considered suspended -- if we've arranged it so that
-// the thread cannot return back to the EE without blocking.
-void Thread::UserSuspendThread()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- // Read the general comments on thread suspension earlier, to understand why we
- // take these locks.
-
- // GC can occur in here:
- STRESS_LOG0(LF_SYNC, LL_INFO100, "UserSuspendThread obtain lock\n");
- ThreadStoreLockHolder tsl;
-
- // User suspensions (e.g. from VB and C#) are distinguished from internal
- // suspensions so a poorly behaved program cannot resume a thread that the system
- // has suspended for GC.
- if (m_State & TS_UserSuspendPending)
- {
- // This thread is already experiencing a user suspension, so ignore the
- // new request.
- _ASSERTE(!ThreadStore::HoldingThreadStore(this));
- }
- else
- if (this != GetThread())
- {
- // First suspension of a thread other than the current one.
- if (m_State & TS_Unstarted)
- {
- // There is an important window in here. T1 can call T2.Start() and then
- // T2.Suspend(). Suspend is disallowed on an unstarted thread. But from T1's
- // point of view, T2 is started. In reality, T2 hasn't been scheduled by the
- // OS, so it is still an unstarted thread. We don't want to perform a normal
- // suspension on it in this case, because it is currently contributing to the
- // PendingThreadCount. We want to get it fully started before we suspend it.
- // This is particularly important if its background status is changing
- // underneath us because otherwise we might not detect that the process should
- // be exited at the right time.
- //
- // It turns out that this is a simple situation to implement. We are holding
- // the ThreadStoreLock. TransferStartedThread will likewise acquire that
- // lock. So if we detect it, we simply set a bit telling the thread to
- // suspend itself. This is NOT the normal suspension request because we don't
- // want the thread to suspend until it has fully started.
- FastInterlockOr((ULONG *) &m_State, TS_SuspendUnstarted);
- }
- else if (m_State & (TS_Detached | TS_Dead))
- {
- return;
- }
- else
- {
- // We just want to trap this thread if it comes back into cooperative mode
- SetupForSuspension(TS_UserSuspendPending);
- m_SafeEvent.Reset();
-
- // Pause it so we can operate on it without it squirming under us.
-RetrySuspension:
- // We can not allocate memory after we suspend a thread.
- // Otherwise, we may deadlock the process when CLR is hosted.
- ThreadStore::AllocateOSContext();
-
- SuspendThreadResult str = SuspendThread();
-
- // The only safe place to suspend a thread asynchronously is if it is in
- // fully interruptible cooperative JIT code. Preemptive mode can hold all
- // kinds of locks that make it unsafe to suspend. All other cases are
- // handled somewhat synchronously (e.g. through hijacks, GC mode toggles, etc.)
- //
- // For example, on a SMP if the thread is blocked waiting for the ThreadStore
- // lock, it can cause a deadlock if we suspend it (even though it is in
- // preemptive mode).
- //
- // If a thread is in preemptive mode (including the tricky optimized N/Direct
- // case), we can just mark it for suspension. It will make no further progress
- // in the EE.
- if (str == STR_NoStressLog)
- {
- // We annot assume anything about the thread's current state.
- goto RetrySuspension;
- }
- else if (!m_fPreemptiveGCDisabled)
- {
- MarkForSuspension(TS_UserSuspendPending);
-
- // Let the thread run until it reaches a safe spot.
- if (str == STR_Success)
- {
- ResumeThread();
- }
- }
- else if (str == STR_Failure || str == STR_UnstartedOrDead)
- {
- // The thread cannot be unstarted, as we have already
- // checked for that above.
- _ASSERTE(!(m_State & TS_Unstarted));
-
- // Nothing to do if the thread has already terminated.
- }
- else if (str == STR_SwitchedOut)
- {
- goto RetrySuspension;
- }
- else
- {
- _ASSERTE(str == STR_Success);
-#if defined(FEATURE_HIJACK) && !defined(PLATFORM_UNIX)
- WorkingOnThreadContextHolder workingOnThreadContext(this);
- if (workingOnThreadContext.Acquired() && HandledJITCase())
- {
- _ASSERTE(m_fPreemptiveGCDisabled);
- // Redirect thread so we can capture a good thread context
- // (GetThreadContext is not sufficient, due to an OS bug).
- // If we don't succeed (should only happen on Win9X, due to
- // a different OS bug), we must resume the thread and try
- // again.
- if (!CheckForAndDoRedirectForUserSuspend())
- {
- ResumeThread();
- goto RetrySuspension;
- }
- }
-#endif // FEATURE_HIJACK && !PLATFORM_UNIX
-
- // Thread is executing in cooperative mode. We're going to have to
- // move it to a safe spot.
- MarkForSuspension(TS_UserSuspendPending);
-
- // Let the thread run until it reaches a safe spot.
- ResumeThread();
-
- // wait until it leaves cooperative GC mode or is JIT suspended
- FinishSuspendingThread();
- }
- }
- }
- else
- {
- GCX_PREEMP();
- SetupForSuspension(TS_UserSuspendPending);
- MarkForSuspension(TS_UserSuspendPending);
-
- // prepare to block ourselves
- tsl.Release();
- _ASSERTE(!ThreadStore::HoldingThreadStore(this));
-
- WaitSuspendEvents();
- }
-}
-
-
-// if the only suspension of this thread is user imposed, resume it. But don't
-// resume from any system suspensions (like GC).
-BOOL Thread::UserResumeThread()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- // If we are attempting to resume when we aren't in a user suspension,
- // its an error.
- BOOL res = FALSE;
-
- // Note that the model does not count. In other words, you can call Thread.Suspend()
- // five times and Thread.Resume() once. The result is that the thread resumes.
-
- STRESS_LOG0(LF_SYNC, INFO3, "UserResumeThread obtain lock\n");
- ThreadStoreLockHolder TSLockHolder;
-
- // If we have marked a thread for suspension, while that thread is still starting
- // up, simply remove the bit to resume it.
- if (m_State & TS_SuspendUnstarted)
- {
- _ASSERTE((m_State & TS_UserSuspendPending) == 0);
- FastInterlockAnd((ULONG *) &m_State, ~TS_SuspendUnstarted);
- res = TRUE;
- }
-
- // If we are still trying to suspend the thread, forget about it.
- if (m_State & TS_UserSuspendPending)
- {
- ReleaseFromSuspension(TS_UserSuspendPending);
- SetSafeEvent();
- res = TRUE;
- }
-
- return res;
-}
-
-
-// We are asynchronously trying to suspend this thread. Stay here until we achieve
-// that goal (in fully interruptible JIT code), or the thread dies, or it leaves
-// the EE (in which case the Pending flag will cause it to synchronously suspend
-// itself later, or if the thread tells us it is going to synchronously suspend
-// itself because of hijack activity, etc.
-void Thread::FinishSuspendingThread()
-{
- CONTRACTL {
- NOTHROW;
- if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
- }
- CONTRACTL_END;
-
- DWORD res;
-
- // There are two threads of interest -- the current thread and the thread we are
- // going to wait for. Since the current thread is about to wait, it's important
- // that it be in preemptive mode at this time.
-
-#if _DEBUG
- DWORD dbgTotalTimeout = 0;
-#endif
-
- // Wait for us to enter the ping period, then check if we are in interruptible
- // JIT code.
- while (TRUE)
- {
- ThreadSuspend::UnlockThreadStore();
- res = m_SafeEvent.Wait(PING_JIT_TIMEOUT,FALSE);
- STRESS_LOG0(LF_SYNC, INFO3, "FinishSuspendingThread obtain lock\n");
- ThreadSuspend::LockThreadStore(ThreadSuspend::SUSPEND_OTHER);
-
- if (res == WAIT_TIMEOUT)
- {
-#ifdef _DEBUG
- if ((dbgTotalTimeout += PING_JIT_TIMEOUT) >= g_pConfig->SuspendDeadlockTimeout())
- {
- _ASSERTE(!"Timeout detected trying to synchronously suspend a thread");
- dbgTotalTimeout = 0;
- }
-#endif
- // Suspend the thread and see if we are in interruptible code (placing
- // a hijack if warranted).
-#if defined(FEATURE_HIJACK) && !defined(PLATFORM_UNIX)
- RetrySuspension:
-#endif
- // The thread is detached/dead. Suspend is no op.
- if (m_State & (TS_Detached | TS_Dead))
- {
- return;
- }
-
- // We can not allocate memory after we suspend a thread.
- // Otherwise, we may deadlock the process when CLR is hosted.
- ThreadStore::AllocateOSContext();
-
- SuspendThreadResult str = SuspendThread();
-
- if (m_fPreemptiveGCDisabled && str == STR_Success)
- {
-#if defined(FEATURE_HIJACK) && !defined(PLATFORM_UNIX)
- WorkingOnThreadContextHolder workingOnThreadContext(this);
- if (workingOnThreadContext.Acquired() && HandledJITCase())
- {
- _ASSERTE(m_State & TS_UserSuspendPending);
- // Redirect thread so we can capture a good thread context
- // (GetThreadContext is not sufficient, due to an OS bug).
- // If we don't succeed (should only happen on Win9X, due to
- // a different OS bug), we must resume the thread and try
- // again.
- if (!CheckForAndDoRedirectForUserSuspend())
- {
- ResumeThread();
- goto RetrySuspension;
- }
- }
-#endif // FEATURE_HIJACK && !PLATFORM_UNIX
- // Keep trying...
- ResumeThread();
- }
- else if (!m_fPreemptiveGCDisabled)
- {
- // The thread has transitioned out of the EE. It can't get back in
- // without synchronously suspending itself. We can now return to our
- // caller since this thread cannot make further progress within the
- // EE.
- if (str == STR_Success)
- {
- ResumeThread();
- }
- break;
- }
- else if (str == STR_SwitchedOut)
- {
- // The task has been switched out while in Cooperative GC mode.
- // We will wait for the thread again.
- }
- }
- else
- {
- // SafeEvent has been set so we don't need to actually suspend. Either
- // the thread died, or it will enter a synchronous suspension based on
- // the UserSuspendPending bit.
- _ASSERTE(res == WAIT_OBJECT_0);
- _ASSERTE(!ThreadStore::HoldingThreadStore(this));
- break;
- }
- }
-}
-
-#endif // FEATURE_CORECLR
void Thread::SetSafeEvent()
@@ -7008,12 +6548,6 @@ StackWalkAction SWCB_GetExecutionState(CrawlFrame *pCF, VOID *pData)
else
#endif // FEATURE_CONSERVATIVE_GC
{
-#ifndef HIJACK_NONINTERRUPTIBLE_THREADS
- if (!pES->m_IsInterruptible)
- {
- notJittedCase = true;
- }
-#else // HIJACK_NONINTERRUPTIBLE_THREADS
// if we're not interruptible right here, we need to determine the
// return address for hijacking.
if (!pES->m_IsInterruptible)
@@ -7087,7 +6621,6 @@ StackWalkAction SWCB_GetExecutionState(CrawlFrame *pCF, VOID *pData)
action = SWA_CONTINUE;
#endif // !WIN64EXCEPTIONS
}
-#endif // HIJACK_NONINTERRUPTIBLE_THREADS
}
// else we are successfully out of here with SWA_ABORT
}
@@ -7162,7 +6695,6 @@ void STDCALL OnHijackWorker(HijackArgs * pArgs)
}
CONTRACTL_END;
-#ifdef HIJACK_NONINTERRUPTIBLE_THREADS
Thread *thread = GetThread();
#ifdef FEATURE_STACK_PROBE
@@ -7205,9 +6737,6 @@ void STDCALL OnHijackWorker(HijackArgs * pArgs)
#endif // _DEBUG
frame.Pop();
-#else
- PORTABILITY_ASSERT("OnHijackWorker not implemented on this platform.");
-#endif // HIJACK_NONINTERRUPTIBLE_THREADS
}
ReturnKind GetReturnKindFromMethodTable(Thread *pThread, EECodeInfo *codeInfo)
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index 28546642a1..ac0da8d3de 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -2455,13 +2455,6 @@ HMODULE CLRGetCurrentModuleHandle()
return hMod;
}
-#ifndef FEATURE_CORECLR
-static ICLRRuntimeInfo *GetCLRRuntime()
-{
- LIMITED_METHOD_CONTRACT;
- return g_pCLRRuntime;
-}
-#endif // !FEATURE_CORECLR
#endif // !FEATURE_PAL
@@ -2486,12 +2479,6 @@ void * __stdcall GetCLRFunction(LPCSTR FunctionName)
{
func = (void*)EEHeapFreeInProcessHeap;
}
-#ifndef FEATURE_CORECLR
- else if (strcmp(FunctionName, "GetCLRRuntime") == 0)
- {
- func = (void*)GetCLRRuntime;
- }
-#endif // !FEATURE_CORECLR
else if (strcmp(FunctionName, "ShutdownRuntimeWithoutExiting") == 0)
{
func = (void*)ShutdownRuntimeWithoutExiting;
diff --git a/src/vm/util.hpp b/src/vm/util.hpp
index d81eedb0df..4a213b7e75 100644
--- a/src/vm/util.hpp
+++ b/src/vm/util.hpp
@@ -1294,35 +1294,7 @@ public:
extern LONG g_OLEAUT32_Loaded;
-#ifndef FEATURE_CORECLR
-#define ENSURE_OLEAUT32_LOADED() \
-{ \
- /* Should only be used in FCALL */ \
- _ASSERTE (__me != 0); \
- if (g_OLEAUT32_Loaded == 0) \
- { \
- /* CLRLoadLibrary/CLRFreeLibrary claim they trigger, but this */ \
- /* isn't really true in this case because we're loading oleaut32 */ \
- /* which we know doesn't contain any managed code in its DLLMain */ \
- CONTRACT_VIOLATION(GCViolation|SOToleranceViolation); \
- HMODULE hMod = CLRLoadLibrary(W("oleaut32")); \
- if (hMod == NULL) \
- { \
- __FCThrow(__me, kOutOfMemoryException, 0, 0, 0, 0); \
- } \
- else \
- { \
- if (FastInterlockExchange(&g_OLEAUT32_Loaded, 1) == 1) \
- { \
- CLRFreeLibrary(hMod); \
- } \
- } \
- } \
-} \
-INDEBUG(DisableDelayLoadCheckForOleaut32 _disableOleaut32Check);
-#else // !FEATURE_CORECLR
#define ENSURE_OLEAUT32_LOADED()
-#endif // !FEATURE_CORECLR
BOOL DbgIsExecutable(LPVOID lpMem, SIZE_T length);
diff --git a/src/vm/vars.cpp b/src/vm/vars.cpp
index cc1662b618..37538752c6 100644
--- a/src/vm/vars.cpp
+++ b/src/vm/vars.cpp
@@ -85,9 +85,6 @@ GPTR_IMPL(MethodTable, g_pThreadClass);
#ifdef FEATURE_CER
GPTR_IMPL(MethodTable, g_pCriticalFinalizerObjectClass);
#endif
-#ifndef FEATURE_CORECLR
-GPTR_IMPL(MethodTable, g_pAsyncFileStream_AsyncResultClass);
-#endif // !FEATURE_CORECLR
GPTR_IMPL(MethodTable, g_pFreeObjectMethodTable);
GPTR_IMPL(MethodTable, g_pOverlappedDataClass);
@@ -138,9 +135,6 @@ GPTR_IMPL(RCWCleanupList,g_pRCWCleanupList);
// <TODO> @TODO Remove eventually - </TODO> determines whether the verifier throws an exception when something fails
bool g_fVerifierOff;
-#ifndef FEATURE_CORECLR
-IAssemblyUsageLog *g_pIAssemblyUsageLogGac;
-#endif
// <TODO> @TODO - PROMOTE. </TODO>
OBJECTHANDLE g_pPreallocatedOutOfMemoryException;
diff --git a/src/vm/vars.hpp b/src/vm/vars.hpp
index cad41d7442..d586e31a6d 100644
--- a/src/vm/vars.hpp
+++ b/src/vm/vars.hpp
@@ -66,9 +66,6 @@ typedef unsigned short wchar_t;
#include <corpriv.h>
#include <cordbpriv.h>
-#ifndef FEATURE_CORECLR
-#include <metahost.h>
-#endif // !FEATURE_CORECLR
#include "eeprofinterfaces.h"
#include "eehash.h"
@@ -416,9 +413,6 @@ GPTR_DECL(MethodTable, g_pThreadClass);
#ifdef FEATURE_CER
GPTR_DECL(MethodTable, g_pCriticalFinalizerObjectClass);
#endif
-#ifndef FEATURE_CORECLR
-GPTR_DECL(MethodTable, g_pAsyncFileStream_AsyncResultClass);
-#endif // !FEATURE_CORECLR
GPTR_DECL(MethodTable, g_pOverlappedDataClass);
GPTR_DECL(MethodTable, g_TypedReferenceMT);
@@ -445,9 +439,6 @@ GPTR_DECL(MethodDesc, g_pObjectFinalizerMD);
//<TODO> @TODO Remove eventually - determines whether the verifier throws an exception when something fails</TODO>
EXTERN bool g_fVerifierOff;
-#ifndef FEATURE_CORECLR
-EXTERN IAssemblyUsageLog *g_pIAssemblyUsageLogGac;
-#endif
// Global System Information
extern SYSTEM_INFO g_SystemInfo;
@@ -567,12 +558,6 @@ EXTERN Volatile<BOOL> g_fEEStarted;
EXTERN BOOL g_fComStarted;
#endif
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-//
-// Pointer to the activated CLR interface provided by the shim.
-//
-EXTERN ICLRRuntimeInfo *g_pCLRRuntime;
-#endif
//
// Global state variables indicating which stage of shutdown we are in
diff --git a/src/zap/common.h b/src/zap/common.h
index b3db657f87..777c4e9b94 100644
--- a/src/zap/common.h
+++ b/src/zap/common.h
@@ -50,9 +50,6 @@
#include "guidfromname.h"
#include "../dlls/mscorrc/resource.h"
#include "zaplog.h"
-#ifndef FEATURE_CORECLR
-#include "eventmsg.h"
-#endif // FEATURE_CORECLR
#include "ndpversion.h"
#include "loaderheap.h"
diff --git a/src/zap/svcworker.cpp b/src/zap/svcworker.cpp
index 001345ce1c..e5ddcf9f08 100644
--- a/src/zap/svcworker.cpp
+++ b/src/zap/svcworker.cpp
@@ -201,60 +201,6 @@ ICorSvcLogger* SvcLogger::GetSvcLogger()
return pCorSvcLogger;
}
-#ifndef FEATURE_CORECLR
-
-void InitNGenOptions(NGenOptions *ngo,
- NGenPrivateAttributes ngenPrivateAttributes,
- OptimizationScenario optScenario = ScenarioDefault,
- LPCWSTR lpszRepositoryDir = NULL, RepositoryFlags repositoryFlags = RepositoryDefault)
-{
- ULONG_PTR pScenario = (ULONG_PTR) optScenario;
-
- ngo->dwSize = sizeof(NGenOptions);
-
- // V1
- //
- ngo->fDebug = (pScenario & ScenarioDebug) ? true : false;
- ngo->fDebugOpt = false;
- ngo->fProf = (pScenario & ScenarioProfile) ? true : false;
- ngo->fSilent = false;
- ngo->lpszExecutableFileName = NULL;
-
- // V2 (Whidbey)
- //
- ngo->fInstrument = (pScenario & ScenarioTuningDataCollection) ? true : false;
- ngo->fWholeProgram = false;
- ngo->fProfInfo = (pScenario & ScenarioProfileInfo) ? true : false;
-
- ngo->lpszRepositoryDir = lpszRepositoryDir;
- ngo->repositoryFlags = repositoryFlags;
-
- ngo->dtRequested = DT_NIL;
- ngo->lpszDebugDir = NULL;
-
- ngo->fNoInstall = false;
- ngo->fEmitFixups = false;
- ngo->fFatHeaders = false;
- ngo->fVerbose = false;
-
- // This should be a value from the StatOptions enumeration
- ngo->uStats = ngenPrivateAttributes.ZapStats;
- ngo->dtRequested = (ngenPrivateAttributes.Flags & DbgTypePdb) ? DT_PDB : DT_NIL;
- ngo->lpszDebugDir = ngenPrivateAttributes.DbgDir;
-
-
- // V4
- //
- ngo->fNgenLastRetry = (pScenario & ScenarioNgenLastRetry) ? true : false;
-
- // V4.5
- ngo->fAutoNGen = (pScenario & ScenarioAutoNGen) ? true : false;
-
- // Blue
- ngo->fRepositoryOnly = (pScenario & ScenarioRepositoryOnly) ? true : false;
-}
-
-#endif // !FEATURE_CORECLR
namespace
{
@@ -288,769 +234,3 @@ void SetSvcLogger(ICorSvcLogger *pCorSvcLogger)
}
#endif
-#ifndef FEATURE_CORECLR
-
-//*****************************************************************************
-// ICorSvcDependencies is used to enumerate the dependencies of an
-// IL image. It is used by the native image service.
-//*****************************************************************************[
-class CCorSvcDependencies : public ICorSvcDependencies
-{
-public:
- CCorSvcDependencies()
- {
- _cRef = 0;
- zapper = NULL;
-
- g_pLocalServerLifetime->AddRefServerProcess();
- }
-
- ~CCorSvcDependencies()
- {
- if (zapper != NULL)
- {
- delete zapper;
- }
-
- g_pLocalServerLifetime->ReleaseServerProcess();
- }
-
- void Initialize(BSTR pApplicationName, OptimizationScenario scenario)
- {
- NGenOptions opt = {0};
- NGenPrivateAttributesClass ngenPrivateAttributesClass;
- InitNGenOptions(&opt, ngenPrivateAttributesClass, scenario);
- opt.lpszExecutableFileName = pApplicationName;
- zapper = Zapper::NewZapper(&opt, true);
- zapper->CreateDependenciesLookupDomain();
- }
-
- STDMETHOD (GetAssemblyDependencies)(
- BSTR pAssemblyName,
- SAFEARRAY **pDependencies,
- DWORD *assemblyNGenSetting,
- BSTR *pNativeImageIdentity,
- BSTR *pAssemblyDisplayName,
- SAFEARRAY **pDependencyLoadSetting,
- SAFEARRAY **pDependencyNGenSetting
- )
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- _ASSERTE(zapper != NULL);
- _ASSERTE(pNativeImageIdentity);
-
- HRESULT hr = S_OK;
- EX_TRY
- {
- GUID nativeImageSign = INVALID_NGEN_SIGNATURE;
- zapper->ComputeDependencies(pAssemblyName, &nativeImageSign);
-
- BSTRHolder displayNameHolder(::SysAllocString(zapper->m_assemblyDependencies.GetDisplayName()));
-
- *pDependencies = zapper->m_assemblyDependencies.GetSAFEARRAY();
- *assemblyNGenSetting = zapper->m_assemblyDependencies.GetNGenHint();
- *pDependencyLoadSetting = zapper->m_assemblyDependencies.GetLoadHintSAFEARRAY();
- *pDependencyNGenSetting = zapper->m_assemblyDependencies.GetNGenHintSAFEARRAY();
-
- if (nativeImageSign != INVALID_NGEN_SIGNATURE)
- {
- WCHAR szGuid[64];
- if (GuidToLPWSTR(nativeImageSign, szGuid, sizeof(szGuid) / sizeof(WCHAR)) == 0)
- {
- ThrowHR(E_UNEXPECTED);
- }
- *pNativeImageIdentity = ::SysAllocString(szGuid);
- }
-
- *pAssemblyDisplayName = displayNameHolder.Extract();
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHODIMP_(ULONG) AddRef()
- {
- return InterlockedIncrement (&_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release()
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- ULONG lRet = InterlockedDecrement (&_cRef);
- if (!lRet)
- delete this;
- return lRet;
- }
-
- STDMETHODIMP QueryInterface(REFIID riid,void ** ppv)
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- if (!ppv)
- return E_POINTER;
-
- if (IsEqualIID(riid, IID_IUnknown) ||
- IsEqualIID(riid, IID_ICorSvcDependencies))
- {
- *ppv = static_cast<ICorSvcDependencies*> (this);
- AddRef();
- return S_OK;
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- }
-
-private:
- LONG _cRef;
- Zapper *zapper;
-};
-
-//*****************************************************************************
-// CCorSvcCreatePdbWorker is used to load the CLR, initialize an appdomain,
-// load the given assembly and create a PDB for it.
-//*****************************************************************************
-class CCorSvcCreatePdbWorker {
-
-public:
-
- CCorSvcCreatePdbWorker()
- : m_pZapper(NULL)
- {
- }
-
- ~CCorSvcCreatePdbWorker()
- {
- if (m_pZapper)
- delete m_pZapper;
- }
-
- void Initialize(BSTR pAppBaseOrConfig, OptimizationScenario scenario)
- {
- _ASSERTE(m_pZapper == NULL);
-
- NGenOptions options = {0};
- NGenPrivateAttributesClass privateAttributesClass;
-
- InitNGenOptions(&options, privateAttributesClass, scenario);
- options.lpszExecutableFileName = pAppBaseOrConfig;
- m_pZapper = Zapper::NewZapper(&options, true);
- m_pZapper->CreateDependenciesLookupDomain();
- }
-
-
- HRESULT CreatePdb(BSTR pAssemblyName, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath)
- {
- SO_NOT_MAINLINE_FUNCTION;
- _ASSERTE(m_pZapper);
-
- HRESULT hr = S_OK;
- EX_TRY {
-
- m_pZapper->CreatePdb(pAssemblyName, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath);
-
- } EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
-private:
-
- Zapper *m_pZapper;
-
-};
-
-#ifdef _DEBUG
- inline void DoFreeEnvironmentStrings(LPTCH lpszEnvironmentBlock)
- {
- WszFreeEnvironmentStrings(lpszEnvironmentBlock);
- }
- typedef Wrapper<LPTCH, DoNothing, DoFreeEnvironmentStrings> EnvHolder;
-#endif //_DEBUG
-
-//*****************************************************************************
-// ICorSvcWorker contains methods for generating native images and enumerating
-// their dependencies.
-//*****************************************************************************[
-class CCorSvcWorker :
- public ICorSvcWorker3,
- public ICorSvcRepository,
- public ICorSvcSetPrivateAttributes,
-#ifdef FEATURE_APPX
- public ICorSvcAppX,
-#endif
- public ICorSvcPooledWorker
-{
-public:
- CCorSvcWorker() :
- _cRef(0),
- repositoryDir(NULL),
- repositoryFlags(RepositoryDefault),
- ngenPrivateAttributesClass()
-
-#ifdef FEATURE_FUSION
- ,
- pAssemblyCache(NULL)
-#endif
- {
- g_pLocalServerLifetime->AddRefServerProcess();
- }
-
- ~CCorSvcWorker()
- {
-#ifdef FEATURE_FUSION
- if (pAssemblyCache != NULL)
- {
- pAssemblyCache->Release();
- pAssemblyCache = NULL;
- }
-#endif
-
- GetSvcLogger()->ReleaseLogger();
-
- g_pLocalServerLifetime->ReleaseServerProcess();
- }
-
- STDMETHOD (SetPriority)(
- /*[in]*/ SvcWorkerPriority priority
- )
- {
- HRESULT hr = E_FAIL;
-
- // Set ourselves to the priority
- if (::SetPriorityClass(GetCurrentProcess(), priority.dwPriorityClass) == FALSE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto DONE;
- }
-
- hr = S_OK;
- DONE:
- return hr;
- }
-
-#ifdef _DEBUG
- void Debug_CheckPPLProcessStatus(
- LPCWSTR wszAssemblyName)
- {
- size_t cchAssemblyName = wcslen(wszAssemblyName);
-
- // Check if we are in PPL (Protected Process Lightweight) by checking existence of LOCALAPPDATA env. var. (it is not present in PPL)
- BOOL fIsProcessPPL = TRUE;
- EnvHolder pEnvironmentStrings(WszGetEnvironmentStrings());
- for (LPTCH pEnv = pEnvironmentStrings; ((pEnv != NULL) && (*pEnv != W('\0'))); pEnv += wcslen(pEnv) + 1)
- {
- static const WCHAR const_wszLocalAppData[] = W("LOCALAPPDATA=");
- static const size_t const_cchLocalAppData = _countof(const_wszLocalAppData) - 1;
- if (_wcsnicmp(pEnv, const_wszLocalAppData, const_cchLocalAppData) == 0)
- { // LOCALAPPDATA is never set in PPL process
- fIsProcessPPL = FALSE;
- break;
- }
- }
-
- // Semicolon-separated list of names that should assert a failure
- NewArrayHolder<WCHAR> wszAssertList = NULL;
- if (fIsProcessPPL)
- { // If we are in PPL, we should assert for assemblies that are fobidden to be ngen'd in PPL
- CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenProtectedProcess_ForbiddenList, &wszAssertList);
- }
- else
- { // If we are not in PPL, we should assert for assemblies that require to be ngen'd in PPL
- CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenProtectedProcess_RequiredList, &wszAssertList);
- }
-
- if ((wszAssertList != NULL) && (*wszAssertList != W('\0')))
- {
- LPCWSTR pAssertListName = wszAssertList;
- for (;;)
- {
- LPCWSTR pAssertListNameEnd = wcschr(pAssertListName, W(';'));
- size_t cchAssertListName;
- if (pAssertListNameEnd == NULL)
- { // There is not another semicolon
- cchAssertListName = wcslen(pAssertListName);
- }
- else
- {
- cchAssertListName = pAssertListNameEnd - pAssertListName;
- }
-
- if ((cchAssertListName > 0) && (cchAssertListName <= cchAssemblyName))
- {
- // Check prefix or suffix of assembly name (which is either file name or assembly identity name)
- if ((_wcsnicmp(wszAssemblyName, pAssertListName, cchAssertListName) == 0) ||
- (_wcsnicmp(wszAssemblyName + cchAssemblyName - cchAssertListName, pAssertListName, cchAssertListName) == 0))
- {
- if (fIsProcessPPL)
- {
- _ASSERTE_MSG(FALSE, "Assembly that is in NGenProtectedProcess_ForbiddenList is ngen'd in PPL process!");
- }
- else
- {
- _ASSERTE_MSG(FALSE, "Assembly that is in NGenProtectedProcess_RequiredList is ngen'd in normal (non-PPL) process!");
- }
- }
- }
-
- if (pAssertListNameEnd == NULL)
- { // There are no more names in the semicolon-separated list
- break;
- }
-
- // Move to next item in the semicolon-separated list (skip also the semicolon)
- pAssertListName = pAssertListNameEnd + 1;
- }
- }
- } // Debug_CheckPPLProcessStatus
-#endif //_DEBUG
-
- STDMETHOD (OptimizeAssembly)(
- BSTR pAssemblyName,
- BSTR pApplicationName,
- OptimizationScenario scenario,
- SAFEARRAY *loadAlwaysList,
- SAFEARRAY *loadSometimesList,
- SAFEARRAY *loadNeverList,
- BSTR *pNativeImageIdentity
- )
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- INDEBUG(Debug_CheckPPLProcessStatus(pAssemblyName);)
-
- HRESULT hr = S_OK;
- EX_TRY
- {
-#if defined(_DEBUG) || defined(ALLOW_LOCAL_WORKER)
- // Make sure optimize is called only once per process
- static int OptimizeCount = 0;
-#ifdef ALLOW_LOCAL_WORKER
- if (OptimizeCount != 0)
- {
- GetSvcLogger()->Printf(W("You cannot call OptimizeAssembly twice. If you are using COMPlus_NgenLocalWorker, make sure you are only optimizing one assembly.\r\n"));
- ThrowHR(E_FAIL);
- }
-#else // _DEBUG
- _ASSERTE(OptimizeCount == 0);
-#endif
- OptimizeCount++;
-#endif
-
- NGenOptions opt = {0};
- InitNGenOptions(&opt, ngenPrivateAttributesClass, scenario, repositoryDir, repositoryFlags);
- opt.lpszExecutableFileName = pApplicationName;
-
- GUID nativeImageSign;
- bool hasProfileData;
-
- hr = ZapperCompileWrapper(pAssemblyName, &opt, &nativeImageSign,
- loadAlwaysList, loadSometimesList, loadNeverList,
- true, &hasProfileData);
-#if 0
- // Unfotunately we can't perform a retry here as the Zapper currently
- // allocates and initializes some things once CompilationDomain and
- // thus some of this stuff will leak from the failed complation.
- //
- if (FAILED(hr) && hasProfileData && retryNgenFailures)
- {
- hr = ZapperCompileWrapper(pAssemblyName, &opt, &nativeImageSign,
- loadAlwaysList, loadSometimesList, loadNeverList,
- false, NULL);
- if (SUCCEEDED(hr))
- {
- StackSString msg;
- msg.Printf(W("The compile failed when the profile data was used and ")
- W("the compile succeeded when the profile data was ignored."));
- GetSvcLogger()->Log(msg, LogLevel_Info);
- }
- }
-#endif
- IfFailThrow(hr);
-
- _ASSERTE(nativeImageSign != INVALID_NGEN_SIGNATURE || opt.fRepositoryOnly);
-
- _ASSERTE(pNativeImageIdentity);
- if (nativeImageSign != INVALID_NGEN_SIGNATURE)
- {
- WCHAR szGuid[64];
- if (GuidToLPWSTR(nativeImageSign, szGuid, sizeof(szGuid) / sizeof(WCHAR)) == 0)
- ThrowHR(E_UNEXPECTED);
- *pNativeImageIdentity = ::SysAllocString(szGuid);
- }
- else
- {
- *pNativeImageIdentity = NULL;
- }
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHOD (DeleteNativeImage)(
- BSTR pAssemblyName,
- BSTR pNativeImage
- )
- {
- // The caller must either specify both parameters, or specify neither.
- _ASSERTE((pAssemblyName == NULL && pNativeImage == NULL) ||
- (pAssemblyName != NULL && pNativeImage != NULL));
-
- HRESULT hr = S_OK;
- EX_TRY
- {
- NGenOptions opt = {0};
- InitNGenOptions(&opt, ngenPrivateAttributesClass);
- NewHolder<Zapper> zapper = Zapper::NewZapper(&opt, true);
- _ASSERTE(zapper != NULL);
-
- GUID *pNativeImageMVID = NULL;
- GUID nativeImageMVID;
-
- if (pNativeImage)
- {
- StackSString nativeImageString(pNativeImage);
- StackScratchBuffer buffer;
- LPCSTR pstr = nativeImageString.GetANSI(buffer);
- IfFailThrow(LPCSTRToGuid((LPCSTR) pstr, &nativeImageMVID));
- pNativeImageMVID = &nativeImageMVID;
- }
-
-#ifdef FEATURE_FUSION
- if (pAssemblyName != NULL && pNativeImageMVID != NULL)
- {
- // Deleting a specific native image.
- zapper->DeleteFusionCacheEntry(pAssemblyName, pNativeImageMVID);
- }
- else if (pAssemblyName != NULL || pNativeImageMVID != NULL)
- {
- hr = E_UNEXPECTED;
- }
- else
- {
- // Not deleting a specific native image. Need to enumerate NIC.
- IfFailThrow(zapper->EnumerateFusionCache(NULL, false, true, NULL));
- }
-#else //FEATURE_FUSION
- _ASSERTE(!"NYI");
-#endif //FEATURE_FUSION
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHOD (DisplayNativeImages)(BSTR pAssemblyName)
- {
-#ifdef FEATURE_FUSION
- HRESULT hr = S_OK;
- EX_TRY
- {
- NGenOptions opt = {0};
- InitNGenOptions(&opt, ngenPrivateAttributesClass);
- NewHolder<Zapper> zapper = Zapper::NewZapper(&opt, true);
- _ASSERTE(zapper != NULL);
-
- IfFailThrow(zapper->EnumerateFusionCache(pAssemblyName, true, false, NULL));
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
-#else //FEATURE_FUSION
- return E_NOTIMPL;
-#endif //FEATURE_FUSION
- }
-
- STDMETHOD(GetCorSvcDependencies)(
- BSTR pApplicationName,
- OptimizationScenario scenario,
- ICorSvcDependencies **ppCorSvcDependencies
- )
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- HRESULT hr = S_OK;
- EX_TRY
- {
- NewHolder<CCorSvcDependencies> pCorSvcDependencies(new CCorSvcDependencies());
- pCorSvcDependencies->Initialize(pApplicationName, scenario);
- IfFailThrow(pCorSvcDependencies->QueryInterface(IID_ICorSvcDependencies, (void **) ppCorSvcDependencies));
- pCorSvcDependencies.SuppressRelease();
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHOD(Stop)()
- {
- return S_OK;
- }
-
- STDMETHOD(CreatePdb)(__in BSTR pAssemblyName,
- __in BSTR pAppBaseOrConfig,
- __in OptimizationScenario scenario,
- __in BSTR pNativeImagePath,
- __in BSTR pPdbPath)
- {
- return CreatePdb2(
- pAssemblyName,
- pAppBaseOrConfig,
- scenario,
- pNativeImagePath,
- pPdbPath,
- FALSE,
- NULL);
- }
-
- STDMETHOD(CreatePdb2)(__in BSTR pAssemblyName,
- __in BSTR pAppBaseOrConfig,
- __in OptimizationScenario scenario,
- __in BSTR pNativeImagePath,
- __in BSTR pPdbPath,
- __in BOOL pdbLines,
- __in BSTR pManagedPdbSearchPath)
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- HRESULT hr = S_OK;
-
- EX_TRY {
-
- CCorSvcCreatePdbWorker worker;
- worker.Initialize(pAppBaseOrConfig, scenario);
- hr = worker.CreatePdb(pAssemblyName, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath);
-
- } EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
-#ifdef FEATURE_APPX
- STDMETHOD(SetPackage)(__in BSTR pPackageFullName)
- {
- return AppX::SetCurrentPackageForNGen(pPackageFullName);
- }
-
- STDMETHOD(SetLocalAppDataDirectory)(__in BSTR pLocalAppDataDirectory)
- {
- return Clr::Util::SetLocalAppDataDirectory(pLocalAppDataDirectory);
- }
-#endif
-
- STDMETHOD (SetRepository)(
- BSTR pRepositoryDir,
- RepositoryFlags flags
- )
- {
- _ASSERTE(repositoryFlags == RepositoryDefault);
- _ASSERTE(repositoryDir == NULL);
-
- repositoryDir = ::SysAllocString(pRepositoryDir);
- repositoryFlags = flags;
-
- return S_OK;
- }
-
- STDMETHOD (SetNGenPrivateAttributes)(
- NGenPrivateAttributes ngenPrivateAttributes
- )
- {
- _ASSERTE(ngenPrivateAttributesClass.Flags == 0);
- _ASSERTE(ngenPrivateAttributesClass.ZapStats == 0);
-
- ngenPrivateAttributesClass.Flags = ngenPrivateAttributes.Flags;
- ngenPrivateAttributesClass.ZapStats = ngenPrivateAttributes.ZapStats;
-
- if (ngenPrivateAttributes.DbgDir)
- {
- _ASSERTE(ngenPrivateAttributesClass.DbgDir == NULL);
- ngenPrivateAttributesClass.DbgDir = ::SysAllocString(ngenPrivateAttributes.DbgDir);
- }
-
- return S_OK;
- }
-
- STDMETHOD (CanReuseProcess)(
- OptimizationScenario scenario,
- ICorSvcLogger *pCorSvcLogger,
- BOOL *pCanContinue)
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- HRESULT hr = S_OK;
-
- _ASSERTE(pCanContinue != NULL);
- *pCanContinue = FALSE;
-
- return hr;
- }
-
- static HRESULT CreateObject(REFIID riid, void **ppUnk)
- {
- HRESULT hr;
- CCorSvcWorker *pCorSvcWorker = new (nothrow) CCorSvcWorker();
-
- if (pCorSvcWorker == 0)
- return (E_OUTOFMEMORY);
-
- hr = pCorSvcWorker->QueryInterface(riid, ppUnk);
- if (FAILED(hr))
- delete pCorSvcWorker;
- return (hr);
- }
-
- STDMETHODIMP_(ULONG) AddRef()
- {
- return InterlockedIncrement (&_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release()
- {
- ULONG lRet = InterlockedDecrement (&_cRef);
- if (!lRet)
- delete this;
- return lRet;
- }
-
- STDMETHODIMP QueryInterface(REFIID riid,void ** ppv)
- {
- if (!ppv)
- return E_POINTER;
-
- if (IsEqualIID(riid, IID_IUnknown) ||
- IsEqualIID(riid, IID_ICorSvcWorker))
- {
- *ppv = static_cast<ICorSvcWorker*> (this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcWorker2))
- {
- *ppv = static_cast<ICorSvcWorker2 *>(this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcWorker3))
- {
- *ppv = static_cast<ICorSvcWorker3 *>(this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcRepository))
- {
- *ppv = static_cast<ICorSvcRepository*> (this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcSetPrivateAttributes))
- {
- *ppv = static_cast<ICorSvcSetPrivateAttributes *> (this);
- AddRef();
- return S_OK;
- }
-#ifdef FEATURE_APPX
- else if (IsEqualIID(riid, IID_ICorSvcAppX))
- {
- *ppv = static_cast<ICorSvcAppX *> (this);
- AddRef();
- return S_OK;
- }
-#endif
- else if (IsEqualIID(riid, IID_ICorSvcPooledWorker))
- {
- *ppv = static_cast<ICorSvcPooledWorker *> (this);
- AddRef();
- return S_OK;
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- }
-
-private:
- HRESULT ZapperCompileWrapper(BSTR pAssemblyName,
- NGenOptions * pOpt,
- GUID * pNativeImageSign,
- SAFEARRAY * loadAlwaysList,
- SAFEARRAY * loadSometimesList,
- SAFEARRAY * loadNeverList,
- bool useProfileData,
- bool * pHasProfileData)
- {
- NewHolder<Zapper> zapper(Zapper::NewZapper(pOpt, true));
-
- *pNativeImageSign = INVALID_NGEN_SIGNATURE;
-
- // Push the load lists to the zapper
- zapper->SetLoadLists(loadAlwaysList, loadSometimesList, loadNeverList);
- if (useProfileData == false)
- {
- zapper->DontUseProfileData();
- }
-
- HRESULT hr = zapper->Compile(pAssemblyName, pNativeImageSign);
-
- if (pHasProfileData != NULL)
- {
- *pHasProfileData = zapper->HasProfileData();
- }
-
- if (!FAILED(hr) && (*pNativeImageSign == INVALID_NGEN_SIGNATURE) && !pOpt->fRepositoryOnly)
- {
- // Unfortunately we can get a passing HR when an EE exception was
- // thrown because the zapper EH logic can't get the correct HR
- // out of the EE exception. This will be fixed, but for now we
- // should also return E_FAIL in that case.
-
- hr = E_FAIL;
- }
-
- return hr;
- }
-
-private:
- LONG _cRef;
-
- BSTRHolder repositoryDir;
- RepositoryFlags repositoryFlags;
-
- NGenPrivateAttributesClass ngenPrivateAttributesClass;
-
-#ifdef FEATURE_FUSION
- IAssemblyCache *pAssemblyCache;
-#endif // FEATURE_FUSION
-};
-
-STDAPI NGenCreateNGenWorker(ICorSvcWorker **pCorSvcWorker, ILocalServerLifetime *pLocalServerLifetime, ICorSvcLogger *pCorSvcLogger)
-{
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- EX_TRY
- {
- _ASSERTE(pLocalServerLifetime);
- //_ASSERTE(g_pLocalServerLifetime == NULL);
-
- g_pLocalServerLifetime = pLocalServerLifetime;
-
- GetSvcLogger()->SetSvcLogger(pCorSvcLogger);
-
- IfFailThrow(CCorSvcWorker::CreateObject(IID_ICorSvcWorker, (void **) pCorSvcWorker));
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-#endif // !FEATURE_CORECLR
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp
index 347718a76c..f285b97e98 100644
--- a/src/zap/zapimage.cpp
+++ b/src/zap/zapimage.cpp
@@ -41,10 +41,6 @@ ZapImage::ZapImage(Zapper *zapper)
: m_zapper(zapper)
/* Everything else is initialized to 0 by default */
{
-#ifndef FEATURE_CORECLR
- if (m_zapper->m_pOpt->m_statOptions)
- m_stats = new ZapperStats();
-#endif
}
ZapImage::~ZapImage()
@@ -57,10 +53,6 @@ ZapImage::~ZapImage()
//
// Clean up.
//
-#ifndef FEATURE_CORECLR
- if (m_stats != NULL)
- delete m_stats;
-#endif
if (m_pModuleFileName != NULL)
delete [] m_pModuleFileName;
@@ -172,9 +164,7 @@ void ZapImage::InitializeSections()
m_pHelperThunks = new (GetHeap()) ZapNode * [CORINFO_HELP_COUNT];
-#ifdef FEATURE_CORECLR
if (!m_zapper->m_pOpt->m_fNoMetaData)
-#endif
{
m_pILMetaData = new (GetHeap()) ZapILMetaData(this);
m_pILMetaDataSection->Place(m_pILMetaData);
@@ -226,11 +216,7 @@ void ZapImage::InitializeSectionsForReadyToRun()
m_pHeaderSection->Place(m_pImportSectionsTable);
{
-#ifdef FEATURE_CORECLR
#define COMPILER_NAME "CoreCLR"
-#else
-#define COMPILER_NAME "CLR"
-#endif
const char * pCompilerIdentifier = COMPILER_NAME " " FX_FILEVERSION_STR " " QUOTE_MACRO(__BUILDMACHINE__);
ZapBlob * pCompilerIdentifierBlob = new (GetHeap()) ZapBlobPtr((PVOID)pCompilerIdentifier, strlen(pCompilerIdentifier) + 1);
@@ -1186,10 +1172,6 @@ HANDLE ZapImage::SaveImage(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATURE
HANDLE hFile = GenerateFile(wszOutputFileName, pNativeImageSig);
-#ifndef FEATURE_CORECLR
- if (m_stats != NULL)
- PrintStats(wszOutputFileName);
-#endif
#ifdef FEATURE_FUSION
CompressFile(wszOutputFileName[0], hFile);
@@ -1354,10 +1336,6 @@ void ZapImage::CalculateZapBaseAddress()
//
// CoreCLR currently always loads both the IL and the native image, so
// move the native image out of the way.
-#ifndef FEATURE_CORECLR
- if (!m_ModuleDecoder.IsDll() || // exes always get loaded to their preferred base address
- !m_ModuleDecoder.IsILOnly()) // since the IL (IJW) image will be loaded first
-#endif // !FEATURE_CORECLR
{
baseAddress += m_ModuleDecoder.GetVirtualSize();
}
@@ -1498,54 +1476,6 @@ void ZapImage::Open(CORINFO_MODULE_HANDLE hModule,
CalculateZapBaseAddress();
}
-#if !defined(FEATURE_CORECLR)
-
-#if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-
-typedef struct _WIN32_MEMORY_RANGE_ENTRY {
-
- PVOID VirtualAddress;
- SIZE_T NumberOfBytes;
-
-} WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY;
-
-#endif
-
-typedef BOOL
-(WINAPI *PfnPrefetchVirtualMemory)(
- _In_ HANDLE hProcess,
- _In_ ULONG_PTR NumberOfEntries,
- _In_reads_(NumberOfEntries) PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses,
- _In_ ULONG Flags
- );
-
-
-void PrefetchVM(void * pStartAddress, SIZE_T size)
-{
- static PfnPrefetchVirtualMemory s_pfnPrefetchVirtualMemory = NULL;
-
- if (s_pfnPrefetchVirtualMemory == NULL)
- {
- s_pfnPrefetchVirtualMemory = (PfnPrefetchVirtualMemory) GetProcAddress(WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W), "PrefetchVirtualMemory");
-
- if (s_pfnPrefetchVirtualMemory == NULL)
- {
- s_pfnPrefetchVirtualMemory = (PfnPrefetchVirtualMemory) (1);
- }
- }
-
- if (s_pfnPrefetchVirtualMemory > (PfnPrefetchVirtualMemory) (1))
- {
- WIN32_MEMORY_RANGE_ENTRY range;
-
- range.VirtualAddress = pStartAddress;
- range.NumberOfBytes = size;
-
- s_pfnPrefetchVirtualMemory(GetCurrentProcess(), 1, & range, 0);
- }
-}
-
-#endif
@@ -1555,10 +1485,6 @@ void PrefetchVM(void * pStartAddress, SIZE_T size)
void ZapImage::Preload()
{
-#if !defined(FEATURE_CORECLR)
- // Prefetch the whole IL image into memory to avoid small reads (usually 16kb blocks)
- PrefetchVM(m_ModuleDecoder.GetBase(), m_ModuleDecoder.GetSize());
-#endif
CorProfileData * pProfileData = NewProfileData();
m_pPreloader = m_zapper->m_pEECompileInfo->PreloadModule(m_hModule, this, pProfileData);
@@ -1698,14 +1624,6 @@ void ZapImage::OutputTables()
if (IsReadyToRunCompilation())
{
-#ifndef FEATURE_CORECLR
- // Some older versions of Windows (e.g., Win7) can incorrectly fixup
- // relocations if IsDll is not set. In CoreCLR, we handle this by
- // always using the default value of IsDll, which is true. We can't
- // use the same fix in desktop CLR, since in this case the ReadyToRun
- // image can be used to create processes.
- SetIsDll(m_ModuleDecoder.IsDll());
-#endif
SetSizeOfStackReserve(m_ModuleDecoder.GetSizeOfStackReserve());
SetSizeOfStackCommit(m_ModuleDecoder.GetSizeOfStackCommit());
@@ -1714,7 +1632,7 @@ void ZapImage::OutputTables()
#if defined(FEATURE_PAL)
// PAL library requires native image sections to align to page bounaries.
SetFileAlignment(0x1000);
-#elif defined(_TARGET_ARM_) && defined(FEATURE_CORECLR)
+#elif defined(_TARGET_ARM_)
if (!IsReadyToRunCompilation())
{
// On ARM CoreSys builds, crossgen will use 4k file alignment, as requested by Phone perf team
@@ -2627,15 +2545,6 @@ HRESULT ZapImage::parseProfileData()
}
// CoreCLR should never be presented with V1 IBC data.
-#ifndef FEATURE_CORECLR
- if ((fileHeader->Version == CORBBTPROF_V1_VERSION) && CanConvertIbcData())
- {
- // Read and convert V1 data
- m_zapper->Info(W("Converting V1 IBC data to latest format.\n"));
- convertFromV1 = true;
- }
- else
-#endif
if (fileHeader->Version == CORBBTPROF_V3_VERSION)
{
CORBBTPROF_FILE_OPTIONAL_HEADER *optionalHeader =
@@ -3576,23 +3485,17 @@ void ZapImage::FileNotFoundError(LPCWSTR pszMessage)
level = CORZAP_LOGLEVEL_ERROR;
#endif
-#ifndef FEATURE_CORECLR
- m_zapper->Print(level, W("Warning: %s. If this assembly is found during runtime of an application, then the native image currently being generated will not be used.\n"), pszMessage);
-#else
m_zapper->Print(level, W("Warning: %s.\n"), pszMessage);
-#endif
fileNotFoundErrorsTable.Append(message);
}
void ZapImage::Error(mdToken token, HRESULT hr, LPCWSTR message)
{
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
// Missing dependencies are reported as fatal errors in code:CompilationDomain::BindAssemblySpec.
// Avoid printing redundant error message for them.
if (FAILED(g_hrFatalError))
ThrowHR(g_hrFatalError);
-#endif
CorZapLogLevel level = CORZAP_LOGLEVEL_ERROR;
diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp
index d2362d4b90..4b2f39a264 100644
--- a/src/zap/zapinfo.cpp
+++ b/src/zap/zapinfo.cpp
@@ -466,10 +466,6 @@ void ZapInfo::CompileMethod()
return;
}
-#if !defined(FEATURE_CORECLR)
- // Ask the JIT to generate desktop-quirk-compatible code.
- m_jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_DESKTOP_QUIRKS);
-#endif
if (m_pImage->m_stats)
{
@@ -1239,9 +1235,6 @@ int ZapInfo::canHandleException(struct _EXCEPTION_POINTERS *pExceptionPointers)
int ZapInfo::doAssert(const char* szFile, int iLine, const char* szExpr)
{
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- ThrowHR(COR_E_INVALIDPROGRAM);
-#else
#if defined(_DEBUG)
return(_DbgBreakCheck(szFile, iLine, szExpr));
@@ -1249,7 +1242,6 @@ int ZapInfo::doAssert(const char* szFile, int iLine, const char* szExpr)
return(true); // break into debugger
#endif
-#endif
}
void ZapInfo::reportFatalError(CorJitResult result)
{
@@ -2574,9 +2566,6 @@ void ZapInfo::recordRelocation(void *location, void *target,
break;
case IMAGE_REL_BASED_PTR:
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
- _ASSERTE(!"Why we are not using RIP relative address?");
-#endif
*(UNALIGNED TADDR *)location = (TADDR)targetOffset;
break;
@@ -3277,15 +3266,6 @@ size_t ZapInfo::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MOD
// if the fixups were exclusively based on the moduleforstatics lookup
cls = NULL;
-#ifndef FEATURE_CORECLR
-
- // Is this mscorlib.dll (which has ModuleDomainId of 0 (tagged == 1), then you don't need a fixup
- if (moduleId == (size_t) 1)
- {
- *ppIndirection = NULL;
- return (size_t) 1;
- }
-#endif
if (module == m_pImage->m_hModule)
{
@@ -3643,15 +3623,6 @@ void ZapInfo::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
const char * reason)
{
-#ifndef FEATURE_CORECLR
- if (!dontInline(inlineResult) && inlineeHnd != NULL)
- {
- // We deliberately report m_currentMethodHandle (not inlinerHnd) as inliner, because
- // if m_currentMethodHandle != inlinerHnd, it simply means that inlinerHnd is intermediate link
- // in inlining into m_currentMethodHandle, and we have no interest to track those intermediate links now.
- m_pImage->m_pPreloader->ReportInlining(m_currentMethodHandle, inlineeHnd);
- }
-#endif //FEATURE_CORECLR
return m_pEEJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, reason);
}
diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp
index 2c7023a400..b8b674d99b 100644
--- a/src/zap/zapper.cpp
+++ b/src/zap/zapper.cpp
@@ -13,14 +13,8 @@
#include "metahost.h"
#endif
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
-#include "AppXUtil.h"
-#include "AssemblyUsageLogManager.h"
-#endif
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
#include "coregen.h"
-#endif
#include "clr/fs/dir.h"
#ifdef FEATURE_FUSION
@@ -55,21 +49,14 @@ extern "C" HRESULT STDMETHODCALLTYPE InitializeFusion();
extern const WCHAR g_pwBaseLibrary[];
extern bool g_fAllowNativeImages;
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
bool g_fNGenMissingDependenciesOk;
-#endif
bool g_fNGenWinMDResilient;
-#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-extern int g_ningenState;
-#endif
#ifdef FEATURE_READYTORUN_COMPILER
bool g_fReadyToRunCompilation;
#endif
-#ifdef FEATURE_CORECLR
static bool s_fNGenNoMetaData;
-#endif
// Event logging helper
void Zapper::ReportEventNGEN(WORD wType, DWORD dwEventID, LPCWSTR format, ...)
@@ -140,7 +127,6 @@ static HRESULT GetAssemblyName(
// For side by side issues, it's best to use the exported API calls to generate a
// Zapper Object instead of creating one on your own.
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL, LPCWSTR pwzPlatformWinmdPaths=NULL, ICorSvcLogger *pLogger = NULL, LPCWSTR pwszCLRJITPath = nullptr)
{
@@ -185,9 +171,7 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl
ngo.fNgenLastRetry = false;
-#ifdef FEATURE_CORECLR
s_fNGenNoMetaData = (dwFlags & NGENWORKER_FLAGS_NO_METADATA) != 0;
-#endif
zap = Zapper::NewZapper(&ngo);
@@ -209,7 +193,7 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl
if (pwzPlatformWinmdPaths != nullptr)
zap->SetPlatformWinmdPaths(pwzPlatformWinmdPaths);
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
if (pwszCLRJITPath != nullptr)
zap->SetCLRJITPath(pwszCLRJITPath);
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -255,7 +239,7 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
zap = Zapper::NewZapper(&ngo);
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
zap->SetDontLoadJit();
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -277,7 +261,7 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
if (pwzPlatformWinmdPaths != nullptr)
zap->SetPlatformWinmdPaths(pwzPlatformWinmdPaths);
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
if (pwzDiasymreaderPath != nullptr)
zap->SetDiasymreaderPath(pwzDiasymreaderPath);
#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
@@ -310,100 +294,6 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
return hr;
}
-#else // FEATURE_CORECLR || CROSSGEN_COMPILE
-
-STDAPI LegacyNGenCreateZapper(HANDLE* hZapper, NGenOptions* opt)
-{
- if (hZapper == NULL)
- return E_POINTER;
-
- HRESULT hr = S_OK;
- Zapper* zap = NULL;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
-
- EX_TRY
- {
- zap = Zapper::NewZapper(opt);
- }
- EX_CATCH_HRESULT(hr);
-
- END_ENTRYPOINT_NOTHROW;
-
- IfFailRet(hr);
-
- if (zap == NULL)
- return E_OUTOFMEMORY;
-
- zap->SetLegacyMode();
-
- *hZapper = (HANDLE)zap;
-
- return S_OK;
-}// NGenCreateZapper
-
-STDAPI LegacyNGenFreeZapper(HANDLE hZapper)
-{
- if (hZapper == NULL || hZapper == INVALID_HANDLE_VALUE)
- return E_HANDLE;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- Zapper *zapper = (Zapper*)hZapper;
- delete zapper;
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
-}// NGenFreeZapper
-
-#ifdef FEATURE_FUSION
-STDAPI LegacyNGenTryEnumerateFusionCache(HANDLE hZapper, LPCWSTR assemblyName, bool fPrint, bool fDelete)
-{
-
- HRESULT hr = S_OK;
- if (hZapper == NULL || hZapper == INVALID_HANDLE_VALUE)
- return E_HANDLE;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- Zapper *zapper = (Zapper*)hZapper;
- hr = zapper->TryEnumerateFusionCache(assemblyName, fPrint, fDelete);
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-
-}// NGenTryEnumerateFusionCache
-#endif //FEATURE_FUSION
-
-STDAPI_(BOOL) LegacyNGenCompile(HANDLE hZapper, LPCWSTR path)
-{
- CONTRACTL{
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (hZapper == NULL || hZapper == INVALID_HANDLE_VALUE)
- return FALSE;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_VOIDRET;
-
- Zapper *zapper = (Zapper*)hZapper;
-
- EX_TRY
- {
- hr = zapper->Compile(path);
- }
- EX_CATCH_HRESULT(hr);
-
- END_ENTRYPOINT_VOIDRET;
-
- return (hr == S_OK) ? TRUE : FALSE;
-}// NGenCompile
-
-#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
/* --------------------------------------------------------------------------- *
* Options class
@@ -427,9 +317,7 @@ ZapperOptions::ZapperOptions() :
m_fNGenLastRetry(false),
m_compilerFlags(),
m_legacyMode(false)
-#ifdef FEATURE_CORECLR
,m_fNoMetaData(s_fNGenNoMetaData)
-#endif
{
m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_RELOC);
m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_PREJIT);
@@ -691,7 +579,7 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions)
_ASSERTE(SUCCEEDED(hr));
#endif
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
m_fDontLoadJit = false;
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -719,13 +607,12 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi
HRESULT hr = E_FAIL;
-#if defined(FEATURE_CORECLR) || defined(FEATURE_MERGE_JIT_AND_ENGINE)
// Note: FEATURE_MERGE_JIT_AND_ENGINE is defined for the Desktop crossgen compilation as well.
//
PathString CoreClrFolder;
extern HINSTANCE g_hThisInst;
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
if (m_fDontLoadJit)
{
return;
@@ -761,9 +648,6 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi
hr = S_OK;
}
}
-#else
- hr = g_pCLRRuntime->LoadLibrary(pwzJitName, phJit);
-#endif
if (FAILED(hr))
{
@@ -771,7 +655,7 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi
ThrowLastError();
}
-#if (defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST)) && !defined(CROSSGEN_COMPILE)
+#if !defined(CROSSGEN_COMPILE)
typedef void (__stdcall* pSxsJitStartup) (CoreClrCallbacks const & cccallbacks);
pSxsJitStartup sxsJitStartupFn = (pSxsJitStartup) GetProcAddress(*phJit, "sxsJitStartup");
if (sxsJitStartupFn == NULL)
@@ -898,39 +782,11 @@ void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument)
CorCompileRuntimeDlls ngenDllId;
-#if !defined(FEATURE_CORECLR)
- ngenDllId = NGEN_COMPILER_INFO;
-#else // FEATURE_CORECLR
ngenDllId = CROSSGEN_COMPILER_INFO;
-#endif
LPCWSTR pwzJitName = CorCompileGetRuntimeDllName(ngenDllId);
LoadAndInitializeJITForNgen(pwzJitName, &m_hJitLib, &m_pJitCompiler);
-#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // For reasons related to servicing, and RyuJIT rollout on .NET 4.6 and beyond, we only use RyuJIT when the registry
- // value UseRyuJIT (type DWORD), under key HKLM\SOFTWARE\Microsoft\.NETFramework, is set to 1. Otherwise, we fall back
- // to JIT64.
- //
- // See the document "RyuJIT Compatibility Fallback Specification.docx" for details.
- //
- // Also see the code and comments in EEJitManager::LoadJIT().
-
- if (!UseRyuJit()) // Do we need to fall back to JIT64 for NGEN?
- {
- LPCWSTR pwzJitName = MAKEDLLNAME_W(L"compatjit");
-
- // Note: if the compatjit fails to load, we ignore it, and continue to use the main JIT for
- // everything. You can imagine a policy where if the user requests the compatjit, and we fail
- // to load it, that we fail noisily. We don't do that currently.
- ICorJitCompiler* fallbackICorJitCompiler;
- LoadAndInitializeJITForNgen(pwzJitName, &m_hJitLegacy, &fallbackICorJitCompiler);
-
- // Tell the main JIT to fall back to the "fallback" JIT compiler, in case some
- // obfuscator tries to directly call the main JIT's getJit() function.
- m_pJitCompiler->setRealJit(fallbackICorJitCompiler);
- }
-#endif // defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#endif // FEATURE_MERGE_JIT_AND_ENGINE
#ifdef ALLOW_SXS_JIT_NGEN
@@ -2029,21 +1885,11 @@ void Zapper::CreateDependenciesLookupDomainInCurrentDomain()
SetContextInfo();
}
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-void ZapperSetPlatformAssembliesPaths(SString &platformAssembliesPaths);
-#endif
-#ifdef FEATURE_CORECLR
void ZapperSetBindingPaths(ICorCompilationDomain *pDomain, SString &trustedPlatformAssemblies, SString &platformResourceRoots, SString &appPaths, SString &appNiPaths);
-#endif
void Zapper::CreateCompilationDomain()
{
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // Platform assemblies paths have to be set before appdomain is setup so that
- // mscorlib.dll can be loaded from them.
- ZapperSetPlatformAssembliesPaths(m_platformAssembliesPaths);
-#endif
BOOL fForceDebug = FALSE;
if (!m_pOpt->m_autodebug)
@@ -2069,7 +1915,6 @@ void Zapper::CreateCompilationDomain()
IfFailThrow(m_pDomain->SetPlatformWinmdPaths(m_platformWinmdPaths));
#endif
-#ifdef FEATURE_CORECLR
// we support only TPA binding on CoreCLR
if (!m_trustedPlatformAssemblies.IsEmpty())
@@ -2078,7 +1923,6 @@ void Zapper::CreateCompilationDomain()
// Add the trusted paths and apppath to the binding list
ZapperSetBindingPaths(m_pDomain, m_trustedPlatformAssemblies, m_platformResourceRoots, m_appPaths, m_appNiPaths);
}
-#endif
}
void Zapper::CreateDependenciesLookupDomain()
@@ -2249,7 +2093,7 @@ void Zapper::CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImag
}
LPCWSTR pDiasymreaderPath = nullptr;
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
if (m_DiasymreaderPath.GetCount() > 0)
{
pDiasymreaderPath = m_DiasymreaderPath.GetUnicode();
@@ -2321,29 +2165,6 @@ void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMP
}
else
{
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
- if (m_pOpt->m_fAutoNGen)
- {
- // Make sure we're not been spoofed into loading an assembly that might be unsafe to load.
- // Loading by path so we better be AppX or a WinMD
- StackSString s(pAssemblyString);
- SString literalWinMD(SString::Literal, W(".winmd"));
- BOOL isWinMD = (s.GetCount() > 6) && s.MatchCaseInsensitive(s.End() - 6, literalWinMD);
- if (!AppX::IsAppXProcess() && !isWinMD)
- {
- Error(W("Cannot load assembly %s for automatic NGen.\n"), pAssemblyString);
- ThrowHR(E_FAIL);
- }
-
- // Is AppX NGen disabled?
- if ((AssemblyUsageLogManager::GetUsageLogFlags() & AssemblyUsageLogManager::ASSEMBLY_USAGE_LOG_FLAGS_APPLOCALNGENDISABLED) != 0)
- {
- memset(pNativeImageSig, 0, sizeof(*pNativeImageSig)); // Fake NI signature to disable NGen.
- Warning(W("NGen disabled for this application.\n"));
- return;
- }
- }
-#endif
hr = m_pEECompileInfo->LoadAssemblyByPath(pAssemblyString,
FALSE, // fExplicitBindToNativeImage
@@ -2363,13 +2184,6 @@ void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMP
IfFailThrow(hr);
}
-#ifndef FEATURE_CORECLR
- if (m_pOpt->m_fAutoNGen && !m_pEECompileInfo->SupportsAutoNGen(hAssembly))
- {
- Error(W("Assembly %s does not support automatic NGen.\n"), pAssemblyString);
- ThrowHR(E_FAIL);
- }
-#endif // FEATURE_CORECLR
//
// Check if we have a native image already, and if so get its GUID
@@ -2603,25 +2417,8 @@ HRESULT Zapper::Compile(LPCWSTR string, CORCOMPILE_NGEN_SIGNATURE * pNativeImage
{
fMscorlib = true;
}
-#ifndef FEATURE_CORECLR
- else
- if (_wcsnicmp(fileName, W("mscorlib"), 8) == 0 && (wcslen(fileName) == 8 || fileName[8] == W(',')))
- {
- fMscorlib = true;
- }
-#endif
-#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- if (fMscorlib)
- {
- //
- // Enable ningen by default for mscorlib to get identical images between ngen and crossgen
- //
- g_ningenState = 1;
- }
-#endif
-#if defined(CROSSGEN_COMPILE) || defined(FEATURE_CORECLR)
if (fMscorlib)
{
//
@@ -2629,7 +2426,6 @@ HRESULT Zapper::Compile(LPCWSTR string, CORCOMPILE_NGEN_SIGNATURE * pNativeImage
//
g_fAllowNativeImages = false;
}
-#endif
// the errors in CreateCompilationDomain are fatal - propogate them up
CreateCompilationDomain();
@@ -2680,11 +2476,6 @@ void Zapper::CompileInCurrentDomain(__in LPCWSTR string, CORCOMPILE_NGEN_SIGNATU
BEGIN_ENTRYPOINT_VOIDRET;
-#ifndef FEATURE_CORECLR
- // Set the hard binding list. This needs to be done early, before we attempt to use any
- // softbound native images, in order to ensure NGen determinism.
- SetAssemblyHardBindList();
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_FUSION
// Set the context info for the current domain
@@ -3382,15 +3173,8 @@ void Zapper::InitializeCompilerFlags(CORCOMPILE_VERSION_INFO * pVersionInfo)
m_pOpt->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_FCOMI);
}
-#if !defined(FEATURE_CORECLR)
- if (CPU_X86_USE_SSE2(pVersionInfo->cpuInfo.dwFeatures))
- {
- m_pOpt->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_SSE2);
- }
-#else
// .NET Core requires SSE2.
m_pOpt->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_SSE2);
-#endif // !defined(FEATURE_CORECLR)
#endif // _TARGET_X86_
@@ -4079,7 +3863,7 @@ void Zapper::PrintErrorMessage(CorZapLogLevel level, HRESULT hr)
Print(level, W("%s"), message.GetUnicode());
}
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
void Zapper::SetCLRJITPath(LPCWSTR pwszCLRJITPath)
{
m_CLRJITPath.Set(pwszCLRJITPath);
@@ -4091,14 +3875,13 @@ void Zapper::SetDontLoadJit()
}
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
void Zapper::SetDiasymreaderPath(LPCWSTR pwzDiasymreaderPath)
{
m_DiasymreaderPath.Set(pwzDiasymreaderPath);
}
#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
void Zapper::SetPlatformAssembliesPaths(LPCWSTR pwzPlatformAssembliesPaths)
{
@@ -4135,7 +3918,6 @@ void Zapper::SetForceFullTrust(bool val)
m_fForceFullTrust = val;
}
-#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
void Zapper::SetOutputFilename(LPCWSTR pwzOutputFilename)