From 751771a8976f909af772e35c167bd7e3ffbe44c8 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Fri, 10 Feb 2017 16:07:45 -0800 Subject: [PATCH] Remove always defined FEATURE_CORESYSTEM --- src/ToolBox/SOS/Strike/util.cpp | 6 -- src/binder/applicationcontext.cpp | 3 - src/classlibnative/nls/nlsinfo.cpp | 20 ---- src/debug/daccess/daccess.cpp | 12 --- src/debug/daccess/dacimpl.h | 5 - src/debug/daccess/nidump.cpp | 48 --------- src/debug/di/cordb.cpp | 9 -- src/debug/di/module.cpp | 2 +- src/debug/di/process.cpp | 37 +------ src/debug/di/publish.cpp | 18 ---- src/debug/di/rsmain.cpp | 12 --- src/debug/di/rspriv.h | 4 - src/debug/di/shimprocess.cpp | 149 ---------------------------- src/debug/di/windowspipeline.cpp | 127 ------------------------ src/debug/ee/rcthread.cpp | 23 +---- src/debug/inc/dbgipcevents.h | 23 ----- src/debug/shared/dbgtransportsession.cpp | 4 - src/dlls/dbgshim/dbgshim.cpp | 12 --- src/inc/bbsweep.h | 99 +------------------ src/inc/clrtypes.h | 2 +- src/inc/legacyactivationshim.h | 40 -------- src/inc/newapis.h | 89 ----------------- src/inc/ostype.h | 43 -------- src/inc/switches.h | 4 +- src/inc/winwrap.h | 6 +- src/pal/prebuilt/inc/asm_version.h | 7 -- src/strongname/api/strongname.cpp | 6 -- src/utilcode/securitywrapper.cpp | 122 ----------------------- src/utilcode/sstring.cpp | 8 -- src/utilcode/util.cpp | 53 ---------- src/utilcode/utilmessagebox.cpp | 165 ------------------------------- src/utilcode/winfix.cpp | 15 --- src/vm/assembly.cpp | 2 - src/vm/classnames.h | 2 - src/vm/comutilnative.cpp | 6 -- src/vm/dllimport.cpp | 64 +----------- src/vm/dllimport.h | 14 --- src/vm/domainfile.cpp | 106 -------------------- src/vm/dwreport.cpp | 12 --- src/vm/ecalllist.h | 3 - src/vm/eventreporter.cpp | 25 ----- src/vm/eventtrace.cpp | 20 ---- src/vm/excep.cpp | 12 --- src/vm/gcenv.os.cpp | 4 +- src/vm/i386/cgenx86.cpp | 58 ----------- src/vm/i386/stublinkerx86.cpp | 42 -------- src/vm/interoputil.cpp | 8 -- src/vm/jithelpers.cpp | 2 +- src/vm/jitinterface.cpp | 2 - src/vm/methodtablebuilder.cpp | 2 - src/vm/notifyexternals.cpp | 26 ----- src/vm/runtimecallablewrapper.cpp | 2 - src/vm/securitydeclarative.cpp | 2 - src/vm/securitymeta.cpp | 4 - src/vm/securitymeta.h | 2 - src/vm/securitytransparentassembly.cpp | 4 - src/vm/util.cpp | 81 --------------- src/vm/win32threadpool.cpp | 4 - src/zap/zapimage.cpp | 2 +- 59 files changed, 12 insertions(+), 1672 deletions(-) diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp index b6336fb..90574fc 100644 --- a/src/ToolBox/SOS/Strike/util.cpp +++ b/src/ToolBox/SOS/Strike/util.cpp @@ -4791,13 +4791,7 @@ HRESULT InitCorDebugInterface() // SOS now has a statically linked version of the loader code that is normally found in mscoree/mscoreei.dll // Its not much code and takes a big step towards 0 install dependencies // Need to pick the appropriate SKU of CLR to detect -#if defined(FEATURE_CORESYSTEM) GUID skuId = CLR_ID_ONECORE_CLR; -#elif defined(FEATURE_CORECLR) - GUID skuId = CLR_ID_CORECLR; -#else - GUID skuId = CLR_ID_V4_DESKTOP; -#endif CLRDebuggingImpl* pDebuggingImpl = new CLRDebuggingImpl(skuId); hr = pDebuggingImpl->QueryInterface(IID_ICLRDebugging, (LPVOID *)&pClrDebugging); if (FAILED(hr)) diff --git a/src/binder/applicationcontext.cpp b/src/binder/applicationcontext.cpp index e5c3025..2d41dc6 100644 --- a/src/binder/applicationcontext.cpp +++ b/src/binder/applicationcontext.cpp @@ -12,9 +12,6 @@ // // ============================================================ -#ifndef FEATURE_CORESYSTEM -#define DISABLE_BINDER_DEBUG_LOGGING -#endif #include "applicationcontext.hpp" #include "stringarraylist.h" diff --git a/src/classlibnative/nls/nlsinfo.cpp b/src/classlibnative/nls/nlsinfo.cpp index 0e034c4..d24e4b0 100644 --- a/src/classlibnative/nls/nlsinfo.cpp +++ b/src/classlibnative/nls/nlsinfo.cpp @@ -2369,26 +2369,6 @@ BOOL QCALLTYPE COMNlsInfo::InternalTryFindStringOrdinalIgnoreCase( else #endif { -#ifndef FEATURE_CORESYSTEM - // kernel function pointer - typedef int (WINAPI *PFNFindStringOrdinal)(DWORD, LPCWSTR, INT, LPCWSTR, INT, BOOL); - static PFNFindStringOrdinal FindStringOrdinal = NULL; - - // initizalize kernel32!FindStringOrdinal - if (FindStringOrdinal == NULL) - { - PFNFindStringOrdinal result = NULL; - - HMODULE hMod=WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W); - if(hMod != NULL) - result=(PFNFindStringOrdinal)GetProcAddress(hMod,"FindStringOrdinal"); - - FindStringOrdinal = (result != NULL) ? result : (PFNFindStringOrdinal)-1; - } - - // call into the kernel - if (FindStringOrdinal != (PFNFindStringOrdinal)-1) -#endif { *foundIndex = FindStringOrdinal( dwFindNLSStringFlags, diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp index 69167ab..c5781ae 100644 --- a/src/debug/daccess/daccess.cpp +++ b/src/debug/daccess/daccess.cpp @@ -6573,7 +6573,6 @@ bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEFile *peFile, return true; } -#if defined(FEATURE_CORESYSTEM) /* static */ // We extract "ni.dll or .ni.winmd" from the NGEM image name to obtain the IL image name. // In the end we add given ilExtension. @@ -6632,7 +6631,6 @@ bool ClrDataAccess::GetILImageNameFromNgenImage( LPCWSTR ilExtension, return false; } -#endif // FEATURE_CORESYSTEM void * ClrDataAccess::GetMetaDataFromHost(PEFile* peFile, @@ -6742,7 +6740,6 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile, goto ErrExit; } -#if defined(FEATURE_CORESYSTEM) const WCHAR* ilExtension[] = {W("dll"), W("winmd")}; WCHAR ngenImageName[MAX_LONGPATH] = {0}; if (wcscpy_s(ngenImageName, NumItems(ngenImageName), uniPath) != 0) @@ -6760,7 +6757,6 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile, { goto ErrExit; } -#endif//FEATURE_CORESYSTEM // RVA size in ngen image and IL image is the same. Because the only // different is in RVA. That is 4 bytes column fixed. @@ -6793,13 +6789,11 @@ ClrDataAccess::GetMetaDataFromHost(PEFile* peFile, (BYTE*)buffer, NULL); } -#if defined(FEATURE_CORESYSTEM) if (SUCCEEDED(hr)) { break; } } -#endif // FEATURE_CORESYSTEM } if (FAILED(hr)) @@ -6989,10 +6983,8 @@ bool ClrDataAccess::TargetConsistencyAssertsEnabled() return m_fEnableTargetConsistencyAsserts; } -#ifdef FEATURE_CORESYSTEM #define ctime_s _ctime32_s #define time_t __time32_t -#endif // // VerifyDlls - Validate that the mscorwks in the target matches this version of mscordacwks @@ -7532,11 +7524,7 @@ BOOL OutOfProcessExceptionEventGetProcessIdAndThreadId(HANDLE hProcess, HANDLE h *pPId = (DWORD)hProcess; *pThreadId = (DWORD)hThread; #else -#if !defined(FEATURE_CORESYSTEM) - HMODULE hKernel32 = WszGetModuleHandle(W("kernel32.dll")); -#else HMODULE hKernel32 = WszGetModuleHandle(W("api-ms-win-core-processthreads-l1-1-1.dll")); -#endif if (hKernel32 == NULL) { return FALSE; diff --git a/src/debug/daccess/dacimpl.h b/src/debug/daccess/dacimpl.h index 635be80..91722f5 100644 --- a/src/debug/daccess/dacimpl.h +++ b/src/debug/daccess/dacimpl.h @@ -14,14 +14,11 @@ #ifndef __DACIMPL_H__ #define __DACIMPL_H__ -#if defined(_TARGET_ARM_) || defined(FEATURE_CORESYSTEM) // @ARMTODO: STL breaks the build with current VC headers //--------------------------------------------------------------------------------------- // Setting DAC_HASHTABLE tells the DAC to use the hand rolled hashtable for // storing code:DAC_INSTANCE . Otherwise, the DAC uses the STL unordered_map to. #define DAC_HASHTABLE -#endif // _TARGET_ARM_|| FEATURE_CORESYSTEM - #ifndef DAC_HASHTABLE #pragma push_macro("return") #undef return @@ -1482,11 +1479,9 @@ public: DWORD &dwSize, __out_ecount(cchPath) LPWSTR wszPath, const DWORD cchPath); -#if defined(FEATURE_CORESYSTEM) static bool GetILImageNameFromNgenImage(LPCWSTR ilExtension, __out_ecount(cchFilePath) LPWSTR wszFilePath, const DWORD cchFilePath); -#endif // FEATURE_CORESYSTEM }; extern ClrDataAccess* g_dacImpl; diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp index 23e76c4..7a2a62f 100644 --- a/src/debug/daccess/nidump.cpp +++ b/src/debug/daccess/nidump.cpp @@ -15,9 +15,6 @@ #include #include -#if !defined(FEATURE_CORESYSTEM) -#include -#endif #include @@ -31,11 +28,6 @@ #include -#if !defined(FEATURE_CORESYSTEM) -#include -#undef _ASSERTE -#define _ASSERTE(x) assert(x) -#endif #include @@ -6073,16 +6065,6 @@ void NativeImageDumper::DumpTypes(PTR_Module module) //there may be duplicates in the list. Remove them before moving on. COUNT_T mtCount = m_discoveredMTs.GetCount(); -#if !defined(FEATURE_CORESYSTEM) // no STL right now - std::sort(&*m_discoveredMTs.Begin(), - (&*m_discoveredMTs.Begin()) - + (m_discoveredMTs.End() - m_discoveredMTs.Begin())); - PTR_MethodTable* newEnd = std::unique(&*m_discoveredMTs.Begin(), - (&*m_discoveredMTs.Begin()) - + (m_discoveredMTs.End() - - m_discoveredMTs.Begin())); - mtCount = (COUNT_T)(newEnd - &*m_discoveredMTs.Begin()); -#endif DisplayStartArray( "MethodTables", NULL, METHODTABLES ); for(COUNT_T i = 0; i < mtCount; ++i ) @@ -6098,15 +6080,6 @@ void NativeImageDumper::DumpTypes(PTR_Module module) DisplayStartArray( "MethodTableSlotChunks", NULL, METHODTABLES ); { COUNT_T slotChunkCount = m_discoveredSlotChunks.GetCount(); -#if !defined(FEATURE_CORESYSTEM) // no STL right now - std::sort(&*m_discoveredSlotChunks.Begin(), - (&*m_discoveredSlotChunks.Begin()) - + (m_discoveredSlotChunks.End() - m_discoveredSlotChunks.Begin())); - SlotChunk *newEndChunks = std::unique(&*m_discoveredSlotChunks.Begin(), - (&*m_discoveredSlotChunks.Begin()) - + (m_discoveredSlotChunks.End() - m_discoveredSlotChunks.Begin())); - slotChunkCount = (COUNT_T)(newEndChunks - &*m_discoveredSlotChunks.Begin()); -#endif for (COUNT_T i = 0; i < slotChunkCount; ++i) { @@ -6121,16 +6094,6 @@ void NativeImageDumper::DumpTypes(PTR_Module module) //there may be duplicates in the list. Remove them before moving on. COUNT_T clazzCount = m_discoveredClasses.GetCount(); -#if !defined(FEATURE_CORESYSTEM) // no STL right now - std::sort(&*m_discoveredClasses.Begin(), - (&*m_discoveredClasses.Begin()) - + (m_discoveredClasses.End() - m_discoveredClasses.Begin())); - PTR_MethodTable * newEndClazz = std::unique(&*m_discoveredClasses.Begin(), - (&*m_discoveredClasses.Begin()) - +(m_discoveredClasses.End() - -m_discoveredClasses.Begin())); - clazzCount = (COUNT_T)(newEndClazz - &*m_discoveredClasses.Begin()); -#endif for(COUNT_T i = 0; i < clazzCount; ++i ) { @@ -6149,17 +6112,6 @@ void NativeImageDumper::DumpTypes(PTR_Module module) //there may be duplicates in the list. Remove them before moving on. COUNT_T tdCount = m_discoveredTypeDescs.GetCount(); -#if !defined(FEATURE_CORESYSTEM) // no STL right now - std::sort(&*m_discoveredTypeDescs.Begin(), - (&*m_discoveredTypeDescs.Begin()) - + (m_discoveredTypeDescs.End() - - m_discoveredTypeDescs.Begin())); - PTR_TypeDesc* newEndTD = std::unique(&*m_discoveredTypeDescs.Begin(), - (&*m_discoveredTypeDescs.Begin()) - +(m_discoveredTypeDescs.End() - -m_discoveredTypeDescs.Begin())); - tdCount = (COUNT_T)(newEndTD - &*m_discoveredTypeDescs.Begin()); -#endif for(COUNT_T i = 0; i < tdCount; ++i ) { diff --git a/src/debug/di/cordb.cpp b/src/debug/di/cordb.cpp index 497225f..7f8c087 100644 --- a/src/debug/di/cordb.cpp +++ b/src/debug/di/cordb.cpp @@ -86,15 +86,6 @@ HINSTANCE g_hInst; // Instance handle to this piece of code //***************************************************************************** STDAPI CreateCordbObject(int iDebuggerVersion, IUnknown ** ppCordb) { -#if defined(FEATURE_CORECLR) && !defined(FEATURE_DBGIPC_TRANSPORT_DI) && !defined(FEATURE_CORESYSTEM) - // This API should not be called for Windows CoreCLR unless we are doing interop-debugging - // (which is only supported internally). Use code:CoreCLRCreateCordbObject instead. - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_DbgEnableMixedModeDebugging) == 0) - { - _ASSERTE(!"Deprecated entry point CreateCordbObject() is called on Windows CoreCLR\n"); - return E_NOTIMPL; - } -#endif // FEATURE_CORECLR && !FEATURE_DBGIPC_TRANSPORT_DI if (ppCordb == NULL) { diff --git a/src/debug/di/module.cpp b/src/debug/di/module.cpp index 36cc6f5..46487b9 100644 --- a/src/debug/di/module.cpp +++ b/src/debug/di/module.cpp @@ -5153,7 +5153,7 @@ HRESULT CordbNativeCode::GetReturnValueLiveOffsetImpl(Instantiation *currentInst int skipBytes = 0; -#if defined(DBG_TARGET_X86) && defined(FEATURE_CORESYSTEM) +#if defined(DBG_TARGET_X86) // Skip nop sleds on x86 coresystem. The JIT adds these instructions as a security measure, // and incorrectly reports to us the wrong offset of the call instruction. const BYTE nop_opcode = 0x90; diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp index a5496ee..53fb2ca 100644 --- a/src/debug/di/process.cpp +++ b/src/debug/di/process.cpp @@ -381,7 +381,6 @@ IMDInternalImport * CordbProcess::LookupMetaDataFromDebugger( WCHAR *mutableFilePath = (WCHAR *)filePath; -#if defined(FEATURE_CORESYSTEM) size_t pathLen = wcslen(mutableFilePath); const wchar_t *nidll = W(".ni.dll"); @@ -403,7 +402,6 @@ IMDInternalImport * CordbProcess::LookupMetaDataFromDebugger( { wcscpy_s(mutableFilePath+pathLen-winmdLen, winmdLen, W(".winmd")); } -#endif//FEATURE_CORESYSTEM ALLOW_DATATARGET_MISSING_MEMORY( pMDII = LookupMetaDataFromDebuggerForSingleFile(pModule, mutableFilePath, dwImageTimeStamp, dwImageSize); @@ -7605,27 +7603,7 @@ HRESULT CordbProcess::GetRuntimeOffsets() { -#if !defined FEATURE_CORESYSTEM - // kernel32!OpenThread does not exist on all platforms (missing on Win98). - // So we need to delay load it. - typedef HANDLE (WINAPI *FPOPENTHREAD)(DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwThreadId); - - - - HMODULE mod = WszGetModuleHandle(W("kernel32.dll")); - - _ASSERTE(mod != NULL); // can't fail since Kernel32.dll is already loaded. - - const FPOPENTHREAD pfnOpenThread = (FPOPENTHREAD)GetProcAddress(mod, "OpenThread"); - - if (pfnOpenThread != NULL) - { - m_hHelperThread = pfnOpenThread(SYNCHRONIZE, FALSE, dwHelperTid); - CONSISTENCY_CHECK_MSGF(m_hHelperThread != NULL, ("Failed to get helper-thread handle. tid=0x%x\n", dwHelperTid)); - } -#elif FEATURE_PAL +#if FEATURE_PAL m_hHelperThread = NULL; //RS is supposed to be able to live without a helper thread handle. #else m_hHelperThread = OpenThread(SYNCHRONIZE, FALSE, dwHelperTid); @@ -9798,13 +9776,11 @@ HRESULT CordbProcess::EnsureClrInstanceIdSet() if (m_clrInstanceId == 0) { -#ifdef FEATURE_CORESYSTEM if(m_cordb->GetTargetCLR() != 0) { m_clrInstanceId = PTR_TO_CORDB_ADDRESS(m_cordb->GetTargetCLR()); return S_OK; } -#endif // The only case in which we're allowed to request the "default" CLR instance // ID is when we're running in V2 mode. In V3, the client is required to pass @@ -14947,17 +14923,6 @@ HRESULT CordbProcess::IsReadyForDetach() // and hard detach failures (after which the process object is neutered). if (m_pShim != NULL) { -#if !defined(FEATURE_CORESYSTEM) // CORESYSTEM TODO - HModuleHolder hKernel32; - hKernel32 = WszLoadLibrary(W("kernel32")); - if (hKernel32 == NULL) - return HRESULT_FROM_GetLastError(); - typedef BOOL (*DebugActiveProcessStopSig) (DWORD); - DebugActiveProcessStopSig pDebugActiveProcessStop = - reinterpret_cast(GetProcAddress(hKernel32, "DebugActiveProcessStop")); - if (pDebugActiveProcessStop == NULL) - return COR_E_PLATFORMNOTSUPPORTED; -#endif } return S_OK; diff --git a/src/debug/di/publish.cpp b/src/debug/di/publish.cpp index 888988a..a7e2ebb 100644 --- a/src/debug/di/publish.cpp +++ b/src/debug/di/publish.cpp @@ -44,19 +44,6 @@ BOOL GetAllProcessesInSystem(DWORD *ProcessId, { HandleHolder hSnapshotHolder; -#if !defined(FEATURE_CORESYSTEM) - // Load the dll "kernel32.dll". - HModuleHolder hDll = WszLoadLibrary(W("kernel32")); - _ASSERTE(hDll != NULL); - - if (hDll == NULL) - { - LOG((LF_CORDB, LL_INFO1000, - "Unable to load the dll for enumerating processes. " - "LoadLibrary (kernel32.dll) failed.\n")); - return FALSE; - } -#else // Load the dll "api-ms-win-obsolete-kernel32-l1-1-0.dll". HModuleHolder hDll = WszLoadLibrary(W("api-ms-win-obsolete-kernel32-l1-1-0.dll")); _ASSERTE(hDll != NULL); @@ -68,7 +55,6 @@ BOOL GetAllProcessesInSystem(DWORD *ProcessId, "LoadLibrary (api-ms-win-obsolete-kernel32-l1-1-0.dll) failed.\n")); return FALSE; } -#endif // Create the Process' Snapshot @@ -183,11 +169,7 @@ CorpubPublish::CorpubPublish() { // Try to get psapi!GetModuleFileNameExW once, and then every process object can use it. // If we can't get it, then we'll fallback to getting information from the IPC block. -#if !defined(FEATURE_CORESYSTEM) - m_hPSAPIdll = WszLoadLibrary(W("psapi.dll")); -#else m_hPSAPIdll = WszLoadLibrary(W("api-ms-win-obsolete-psapi-l1-1-0.dll")); -#endif if (m_hPSAPIdll != NULL) { diff --git a/src/debug/di/rsmain.cpp b/src/debug/di/rsmain.cpp index 0f57787..6e0ccf8 100644 --- a/src/debug/di/rsmain.cpp +++ b/src/debug/di/rsmain.cpp @@ -864,10 +864,8 @@ Cordb::Cordb(CorDebugInterfaceVersion iDebuggerVersion) m_processes(11), m_initialized(false), m_debuggerSpecifiedVersion(iDebuggerVersion) -#ifdef FEATURE_CORESYSTEM , m_targetCLR(0) -#endif { g_pRSDebuggingInfo->m_Cordb = this; @@ -1314,9 +1312,7 @@ HRESULT Cordb::SetTargetCLR(HMODULE hmodTargetCLR) if (m_initialized) return E_FAIL; -#ifdef FEATURE_CORESYSTEM m_targetCLR = hmodTargetCLR; -#endif // @REVIEW: are we happy with this workaround? It allows us to use the existing // infrastructure for instance name decoration, but it really doesn't fit @@ -1425,14 +1421,6 @@ bool Cordb::IsInteropDebuggingSupported() // ICorDebug::SetUnmanagedHandler for details. #ifdef FEATURE_INTEROP_DEBUGGING -#if defined(FEATURE_CORECLR) && !defined(FEATURE_CORESYSTEM) - // Interop debugging is only supported internally on CoreCLR. - // Check if the special reg key is set. If not, then we don't allow interop debugging. - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_DbgEnableMixedModeDebugging) == 0) - { - return false; - } -#endif // FEATURE_CORECLR return true; #else diff --git a/src/debug/di/rspriv.h b/src/debug/di/rspriv.h index 8f369b7..1db784b 100644 --- a/src/debug/di/rspriv.h +++ b/src/debug/di/rspriv.h @@ -2317,9 +2317,7 @@ public: CorDebugInterfaceVersion GetDebuggerVersion() const; -#ifdef FEATURE_CORESYSTEM HMODULE GetTargetCLR() { return m_targetCLR; } -#endif private: bool IsCreateProcessSupported(); @@ -2339,9 +2337,7 @@ private: //Note - this code could be useful outside coresystem, but keeping the change localized // because we are late in the win8 release -#ifdef FEATURE_CORESYSTEM HMODULE m_targetCLR; -#endif }; diff --git a/src/debug/di/shimprocess.cpp b/src/debug/di/shimprocess.cpp index a6fc154..6572f2a 100644 --- a/src/debug/di/shimprocess.cpp +++ b/src/debug/di/shimprocess.cpp @@ -18,9 +18,6 @@ #include #include "shimpriv.h" -#if !defined(FEATURE_CORESYSTEM) -#include -#endif //--------------------------------------------------------------------------------------- // @@ -1082,114 +1079,8 @@ HRESULT ShimProcess::QueueFakeThreadAttachEventsNoOrder() // sends the threads in an arbitrary order. HRESULT ShimProcess::QueueFakeThreadAttachEventsNativeOrder() { -#ifdef FEATURE_CORESYSTEM _ASSERTE("NYI"); return E_FAIL; -#else - ICorDebugProcess * pProcess = GetProcess(); - - DWORD dwProcessId; - HRESULT hr = pProcess->GetID(&dwProcessId); - SIMPLIFYING_ASSUMPTION_SUCCEEDED(hr); - if (FAILED(hr)) - { - return hr; - } - - HANDLE hThreadSnap = INVALID_HANDLE_VALUE; - THREADENTRY32 te32; - - // Take a snapshot of all running threads - hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); - if (hThreadSnap == INVALID_HANDLE_VALUE) - { - hr = HRESULT_FROM_GetLastError(); - SIMPLIFYING_ASSUMPTION_SUCCEEDED(hr); - return hr; - } - // HandleHolder doesn't deal with INVALID_HANDLE_VALUE, so we only assign if we have a legal value. - HandleHolder hSnapshotHolder(hThreadSnap); - - // Fill in the size of the structure before using it. - te32.dwSize = sizeof(THREADENTRY32); - - // Retrieve information about the first thread, and exit if unsuccessful - if (!Thread32First(hThreadSnap, &te32)) - { - hr = HRESULT_FROM_GetLastError(); - return hr; - } - - // Now walk the thread list of the system, - // and display information about each thread - // associated with the specified process - do - { - if (te32.th32OwnerProcessID == dwProcessId) - { - RSExtSmartPtr pThread; - pProcess->GetThread(te32.th32ThreadID, &pThread); - if (pThread != NULL) - { - // If we fail to get the appdomain for some reason, then then - // we can't dispatch this thread callback. But we can still - // finish enumerating. - RSExtSmartPtr pAppDomain; - HRESULT hrGetAppDomain = pThread->GetAppDomain(&pAppDomain); - SIMPLIFYING_ASSUMPTION_SUCCEEDED(hrGetAppDomain); - if (pAppDomain != NULL) - { - GetShimCallback()->CreateThread(pAppDomain, pThread); - AddDuplicateCreationEvent(pThread); - - //fix for issue DevDiv2\DevDiv 77523 - threads are switched out in SQL don't get thread create notifications - // mark that this thread has queued a create event - CordbThread* pThreadInternal = static_cast(pThread.GetValue()); - pThreadInternal->SetCreateEventQueued(); - } - } - } - } while(Thread32Next(hThreadSnap, &te32)); - - - //fix for issue DevDiv2\DevDiv 77523 - threads are switched out in SQL don't get thread create notifications - // - - - // Threads which were switched out won't be present in the native thread order enumeration above. - // In order to not miss them we will enumerate all the managed thread objects and for any that we haven't - // already queued a notification for, we will queue a notification now. - RSExtSmartPtr pThreadEnum; - RSExtSmartPtr pThread; - hr = pProcess->EnumerateThreads(&pThreadEnum); - if (FAILED(hr)) - { - return hr; - } - - ULONG cDummy; - - while(SUCCEEDED(pThreadEnum->Next(1, &pThread, &cDummy)) && (pThread != NULL)) - { - RSExtSmartPtr pAppDomain; - hr = pThread->GetAppDomain(&pAppDomain); - CordbThread* pThreadInternal = static_cast(pThread.GetValue()); - - // Getting the appdomain shouldn't fail. If it does, we can't dispatch - // this callback, but we can still dispatch the other thread creates. - SIMPLIFYING_ASSUMPTION_SUCCEEDED(hr); - if (pAppDomain != NULL && !pThreadInternal->CreateEventWasQueued()) - { - GetShimCallback()->CreateThread(pAppDomain, pThread); - AddDuplicateCreationEvent(pThread); - pThreadInternal->SetCreateEventQueued(); - } - pThread.Clear(); - } - - - return S_OK; -#endif } //--------------------------------------------------------------------------------------- @@ -1477,15 +1368,9 @@ void ShimProcess::QueueFakeAttachEvents() // // Third, Queue all Threads // -#if !defined(FEATURE_DBGIPC_TRANSPORT_DI) && !defined(FEATURE_CORESYSTEM) - // Use OS thread enumeration facilities to ensure that the managed thread - // thread order is the same as the corresponding native thread order. - QueueFakeThreadAttachEventsNativeOrder(); -#else // Use ICorDebug to enumerate threads. The order of managed threads may // not match the order the threads were created in. QueueFakeThreadAttachEventsNoOrder(); -#endif // Forth, Queue all Connections. // Enumerate connections is not exposed through ICorDebug, so we need to go use a private hook on CordbProcess. @@ -1742,42 +1627,8 @@ CORDB_ADDRESS ShimProcess::GetCLRInstanceBaseAddress() CORDB_ADDRESS baseAddress = CORDB_ADDRESS(NULL); DWORD dwPid = m_pLiveDataTarget->GetPid(); -#if defined(FEATURE_CORESYSTEM) // Debugger attaching to CoreCLR via CoreCLRCreateCordbObject should have already specified CLR module address. // Code that help to find it now lives in dbgshim. -#else - // get a "snapshot" of all modules in the target - HandleHolder hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwPid); - MODULEENTRY32 moduleEntry = { 0 }; - - if (hSnapshot == INVALID_HANDLE_VALUE) - { - // we haven't got a loaded CLR yet - baseAddress = CORDB_ADDRESS(NULL); - } - else - { - // we need to loop through the modules until we find mscorwks.dll - moduleEntry.dwSize = sizeof(MODULEENTRY32); - - if (!Module32First(hSnapshot, &moduleEntry)) - { - baseAddress = CORDB_ADDRESS(NULL); - } - else - { - - do - { - if (!_wcsicmp(moduleEntry.szModule, MAKEDLLNAME_W(MAIN_CLR_MODULE_NAME_W))) - { - // we found it, so save the base address - baseAddress = PTR_TO_CORDB_ADDRESS(moduleEntry.modBaseAddr); - } - } while (Module32Next(hSnapshot, &moduleEntry)); - } - } -#endif return baseAddress; } // ShimProcess::GetCLRInstanceBaseAddress diff --git a/src/debug/di/windowspipeline.cpp b/src/debug/di/windowspipeline.cpp index c3050e3..073a412 100644 --- a/src/debug/di/windowspipeline.cpp +++ b/src/debug/di/windowspipeline.cpp @@ -134,36 +134,8 @@ BOOL WindowsNativePipeline::DebugSetProcessKillOnExit(bool fKillOnExit) // Enforces the bit set in code:WindowsNativePipeline::DebugSetProcessKillOnExit void WindowsNativePipeline::UpdateDebugSetProcessKillOnExit() { -#if !defined(FEATURE_CORESYSTEM) - // Late bind to DebugSetProcessKillOnExit - WinXP and above only - HModuleHolder hKernel32; - hKernel32 = WszLoadLibrary(W("kernel32")); - SIMPLIFYING_ASSUMPTION(hKernel32 != NULL); - if (hKernel32 == NULL) - return; - - typedef BOOL (*DebugSetProcessKillOnExitSig) (BOOL); - DebugSetProcessKillOnExitSig pDebugSetProcessKillOnExit = - reinterpret_cast(GetProcAddress(hKernel32, "DebugSetProcessKillOnExit")); - - // If the API doesn't exist (eg. Win2k) - there isn't anything we can do, just - // silently ignore the request. - if (pDebugSetProcessKillOnExit == NULL) - return; - - BOOL ret = pDebugSetProcessKillOnExit(m_fKillOnExit); - - // Not a good failure path here. - // 1) This shouldn't fail. - // 2) Even if it does, this is likely called after the debuggee - // has already been created, and if this API fails, most scenarios will - // be unaffected, so we don't want to fail the overall debugging session. - SIMPLIFYING_ASSUMPTION(ret); - -#else // The API doesn't exit on CoreSystem, just return return; -#endif } // Create an process under the debugger. @@ -249,69 +221,20 @@ HRESULT WindowsNativePipeline::DebugActiveProcess(MachineInfo machineInfo, DWORD // Determine (if possible) whether a debugger is attached to the target process HRESULT WindowsNativePipeline::IsRemoteDebuggerPresent(DWORD processId, BOOL* pfDebuggerPresent) { -#if !defined(FEATURE_CORESYSTEM) - - // Get a process handle for the process ID. - HandleHolder hProc = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, processId); - if (hProc == NULL) - return HRESULT_FROM_GetLastError(); - - // Delay-bind to CheckRemoteDebuggerPresent - WinXP SP1 and above only - HModuleHolder hKernel32; - hKernel32 = WszLoadLibrary(W("kernel32")); - if (hKernel32 == NULL) - return HRESULT_FROM_GetLastError(); - - typedef BOOL (*CheckRemoteDebuggerPresentSig) (HANDLE, PBOOL); - CheckRemoteDebuggerPresentSig pCheckRemoteDebuggerPresent = - reinterpret_cast(GetProcAddress(hKernel32, "CheckRemoteDebuggerPresent")); - if (pCheckRemoteDebuggerPresent == NULL) - return HRESULT_FROM_GetLastError(); - - // API exists - call it - if (!pCheckRemoteDebuggerPresent(hProc, pfDebuggerPresent)) - return HRESULT_FROM_GetLastError(); - - return S_OK; -#else //CoreSystem doesn't have this API return E_FAIL; -#endif } // Detach HRESULT WindowsNativePipeline::DebugActiveProcessStop(DWORD processId) { -#if !defined(FEATURE_CORESYSTEM) - // Late-bind to DebugActiveProcessStop since it's WinXP and above only - HModuleHolder hKernel32; - hKernel32 = WszLoadLibrary(W("kernel32")); - if (hKernel32 == NULL) - return HRESULT_FROM_GetLastError(); - - typedef BOOL (*DebugActiveProcessStopSig) (DWORD); - DebugActiveProcessStopSig pDebugActiveProcessStop = - reinterpret_cast(GetProcAddress(hKernel32, "DebugActiveProcessStop")); - - // Win2K will fail here - can't find DebugActiveProcessStop - if (pDebugActiveProcessStop == NULL) - return HRESULT_FROM_GetLastError(); - - // Ok, the API exists, call it - if (!pDebugActiveProcessStop(processId)) - { - // Detach itself failed - return HRESULT_FROM_GetLastError(); - } -#else // The API exists, call it if (!::DebugActiveProcessStop(processId)) { // Detach itself failed return HRESULT_FROM_GetLastError(); } -#endif return S_OK; } @@ -364,56 +287,6 @@ BOOL WindowsNativePipeline::TerminateProcess(UINT32 exitCode) // Resume any suspended threads (but just once) HRESULT WindowsNativePipeline::EnsureThreadsRunning() { -#ifdef FEATURE_CORESYSTEM _ASSERTE("NYI"); return E_FAIL; -#else - _ASSERTE(m_dwProcessId != 0); - - // Take a snapshot of all running threads (similar to ShimProcess::QueueFakeThreadAttachEventsNativeOrder) - // Alternately we could return thread creation/exit in WaitForDebugEvent. But we expect this to be used - // very rarely, so no need to complicate more common codepaths. - HANDLE hThreadSnap = INVALID_HANDLE_VALUE; - THREADENTRY32 te32; - - hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); - if (hThreadSnap == INVALID_HANDLE_VALUE) - return HRESULT_FROM_GetLastError(); - - // HandleHolder doesn't deal with INVALID_HANDLE_VALUE, so we only assign if we have a legal value. - HandleHolder hSnapshotHolder(hThreadSnap); - - // Fill in the size of the structure before using it. - te32.dwSize = sizeof(THREADENTRY32); - - // Retrieve information about the first thread, and exit if unsuccessful - if (!Thread32First(hThreadSnap, &te32)) - return HRESULT_FROM_GetLastError(); - - // Now walk the thread list of the system and attempt to resume any that are part of this process - // Ignore errors - this is a best effort (but ASSERT in CHK builds since we don't expect errors - // in practice - we expect the process to be frozen at a debug event, so no races etc.) - - HRESULT hr = S_FALSE; // no thread was resumed - do - { - if (te32.th32OwnerProcessID == m_dwProcessId) - { - HandleHolder hThread = ::OpenThread(THREAD_SUSPEND_RESUME, FALSE, te32.th32ThreadID); - _ASSERTE(hThread != NULL); - if (hThread != NULL) - { - // Resume each thread exactly once (if they were suspended multiple times, - // then EnsureThreadsRunning would need to be called multiple times until it - // returned S_FALSE. - DWORD prevCount = ::ResumeThread(hThread); - _ASSERTE(prevCount >= 0); - if (prevCount >= 1) - hr = S_OK; // some thread was resumed - } - } - } while(Thread32Next(hThreadSnap, &te32)); - - return hr; -#endif } diff --git a/src/debug/ee/rcthread.cpp b/src/debug/ee/rcthread.cpp index d4e707d..2244766 100644 --- a/src/debug/ee/rcthread.cpp +++ b/src/debug/ee/rcthread.cpp @@ -734,18 +734,7 @@ HRESULT DebuggerRCThread::SetupRuntimeOffsets(DebuggerIPCControlBlock * pDebugge pDebuggerRuntimeOffsets->m_excepNotForRuntimeBPAddr = (void*) ExceptionNotForRuntimeFlare; pDebuggerRuntimeOffsets->m_notifyRSOfSyncCompleteBPAddr = (void*) NotifyRightSideOfSyncCompleteFlare; -#if !defined(FEATURE_CORESYSTEM) - // Grab the address of RaiseException in kernel32 because we have to play some games with exceptions - // that are generated there (just another reason why mixed mode debugging is shady). See bug 476768. - HMODULE hModule = WszGetModuleHandle(W("kernel32.dll")); - _ASSERTE(hModule != NULL); - PREFAST_ASSUME(hModule != NULL); - pDebuggerRuntimeOffsets->m_raiseExceptionAddr = GetProcAddress(hModule, "RaiseException"); - _ASSERTE(pDebuggerRuntimeOffsets->m_raiseExceptionAddr != NULL); - hModule = NULL; -#else pDebuggerRuntimeOffsets->m_raiseExceptionAddr = NULL; -#endif #endif // FEATURE_INTEROP_DEBUGGING pDebuggerRuntimeOffsets->m_pPatches = DebuggerController::GetPatchTable(); @@ -801,7 +790,7 @@ static LONG _debugFilter(LPEXCEPTION_POINTERS ep, PVOID pv) SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; -#if defined(_DEBUG) || !defined(FEATURE_CORESYSTEM) +#if defined(_DEBUG) DebuggerIPCEvent *event = ((DebugFilterParam *)pv)->event; DWORD pid = GetCurrentProcessId(); @@ -840,16 +829,6 @@ static LONG _debugFilter(LPEXCEPTION_POINTERS ep, PVOID pv) #endif // this message box doesn't work well on coresystem... we actually get in a recursive exception handling loop -#ifndef FEATURE_CORESYSTEM - // We took an AV on the helper thread. This is a catastrophic situation so we can - // simply call the EE's catastrophic message box to display the error. - EEMessageBoxCatastrophic( - IDS_DEBUG_UNHANDLEDEXCEPTION_IPC, IDS_DEBUG_SERVICE_CAPTION, - type, - ep->ExceptionRecord->ExceptionCode, - GetIP(ep->ContextRecord), - pid, pid, tid, tid); -#endif // For debugging, we can change the behavior by manually setting eax. // EXCEPTION_EXECUTE_HANDLER=1, EXCEPTION_CONTINUE_SEARCH=0, EXCEPTION_CONTINUE_EXECUTION=-1 diff --git a/src/debug/inc/dbgipcevents.h b/src/debug/inc/dbgipcevents.h index 1b4dec7..8ab7971 100644 --- a/src/debug/inc/dbgipcevents.h +++ b/src/debug/inc/dbgipcevents.h @@ -364,29 +364,6 @@ struct MSLAYOUT DebuggerIPCControlBlockTransport #include "dbgtransportsession.h" #endif // defined(FEATURE_DBGIPC_TRANSPORT_VM) || defined(FEATURE_DBGIPC_TRANSPORT_DI) -#if defined(DBG_TARGET_X86) && !defined(FEATURE_CORESYSTEM) -// We have an versioning requirement. -// Certain portions of the v1.0 and v1.1 IPC block are shared. This is b/c a v1.1 debugger needs to be able -// to look at a v2.0 app enough to recognize the version mismatch. -// This check is only necessary for platforms that ran on v1.1 (Win32-x86) - -// Just to catch any potential illegal change in the IPC block, we assert the offsets against the offsets from v1.1. -// The constants here are pulled from v1.1. -// The RS will look at these versioning fields, so they absolutely must line up. -static_assert_no_msg(offsetof(DebuggerIPCControlBlock, m_leftSideProtocolCurrent) == 0x10); -static_assert_no_msg(offsetof(DebuggerIPCControlBlock, m_leftSideProtocolMinSupported) == 0x14); -static_assert_no_msg(offsetof(DebuggerIPCControlBlock, m_rightSideProtocolCurrent) == 0x18); -static_assert_no_msg(offsetof(DebuggerIPCControlBlock, m_rightSideProtocolMinSupported) == 0x1c); - -// Unfortunately, on detecting such failure, v1.1 will also null out LSEA, LSER and RSPH. -// If these get adjusted, a version-mismatch attach will effectively null out random fields. -static_assert_no_msg(offsetof(DebuggerIPCControlBlock, m_paddingObsoleteLSEA) == 0x30); -static_assert_no_msg(offsetof(DebuggerIPCControlBlock, m_paddingObsoleteLSER) == 0x34); -static_assert_no_msg(offsetof(DebuggerIPCControlBlock, m_rightSideProcessHandle) == 0x38); - - - -#endif #define INITIAL_APP_DOMAIN_INFO_LIST_SIZE 16 diff --git a/src/debug/shared/dbgtransportsession.cpp b/src/debug/shared/dbgtransportsession.cpp index 95fdf25..6369feb 100644 --- a/src/debug/shared/dbgtransportsession.cpp +++ b/src/debug/shared/dbgtransportsession.cpp @@ -2688,11 +2688,7 @@ bool DbgTransportSession::DbgTransportShouldInjectFault(DbgTransportFaultOp eOp, if (dwChance < (s_dwFaultInjection & DBG_TRANSPORT_FAULT_RATE_MASK)) { DbgTransportLog(LC_FaultInject, "Injected fault for %s operation", szOpName); -#if defined(FEATURE_CORESYSTEM) // not supported -#else - WSASetLastError(WSAEFAULT); -#endif // defined(FEATURE_CORESYSTEM) return true; } } diff --git a/src/dlls/dbgshim/dbgshim.cpp b/src/dlls/dbgshim/dbgshim.cpp index 5f15cab..9013101 100644 --- a/src/dlls/dbgshim/dbgshim.cpp +++ b/src/dlls/dbgshim/dbgshim.cpp @@ -1787,9 +1787,7 @@ GetContinueStartupEvent( #endif // !FEATURE_PAL -#if defined(FEATURE_CORESYSTEM) #include "debugshim.h" -#endif //----------------------------------------------------------------------------- // Public API. @@ -1808,7 +1806,6 @@ CLRCreateInstance( REFIID riid, LPVOID *ppInterface) { -#if defined(FEATURE_CORESYSTEM) if (ppInterface == NULL) return E_POINTER; @@ -1816,17 +1813,8 @@ CLRCreateInstance( if (clsid != CLSID_CLRDebugging || riid != IID_ICLRDebugging) return E_NOINTERFACE; -#if defined(FEATURE_CORESYSTEM) GUID skuId = CLR_ID_ONECORE_CLR; -#elif defined(FEATURE_CORECLR) - GUID skuId = CLR_ID_CORECLR; -#else - GUID skuId = CLR_ID_V4_DESKTOP; -#endif CLRDebuggingImpl *pDebuggingImpl = new CLRDebuggingImpl(skuId); return pDebuggingImpl->QueryInterface(riid, ppInterface); -#else - return E_NOTIMPL; -#endif } \ No newline at end of file diff --git a/src/inc/bbsweep.h b/src/inc/bbsweep.h index d5526d8..5787110 100644 --- a/src/inc/bbsweep.h +++ b/src/inc/bbsweep.h @@ -186,95 +186,6 @@ private: { SECURITY_ATTRIBUTES * pSecurityAttributes = NULL; -#ifndef FEATURE_CORESYSTEM // @CORESYSTEMTODO - PSECURITY_DESCRIPTOR pSD = NULL; - PSID pAdminSid = NULL; - HANDLE hToken = NULL; - PACL pACL = NULL; - LPVOID buffer = NULL; - - if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) - goto cleanup; - - // don't set pSecurityAttributes for Metro processes - if(!IsAppContainerProcess(hToken)) - { - SECURITY_ATTRIBUTES securityAttributes; - PSID pUserSid = NULL; - SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY; - DWORD retLength; - -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:6211) // PREfast warning: Leaking memory 'pSD' due to an exception. -#endif /*_PREFAST_ */ - pSD = (PSECURITY_DESCRIPTOR) new char[SECURITY_DESCRIPTOR_MIN_LENGTH]; - if (!pSD) - goto cleanup; - - if (GetTokenInformation(hToken, TokenOwner, NULL, 0, &retLength)) - goto cleanup; - - buffer = (LPVOID) new char[retLength]; - if (!buffer) - goto cleanup; -#ifdef _PREFAST_ -#pragma warning(pop) -#endif /*_PREFAST_*/ - - // Get the SID for the current user - if (!GetTokenInformation(hToken, TokenOwner, (LPVOID) buffer, retLength, &retLength)) - goto cleanup; - - pUserSid = ((TOKEN_OWNER *) buffer)->Owner; - - // Get the SID for the admin group - // Create a SID for the BUILTIN\Administrators group. - if(! AllocateAndInitializeSid(&SIDAuthNT, 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, - &pAdminSid)) - goto cleanup; - - EXPLICIT_ACCESS ea[2]; - ZeroMemory(ea, 2 * sizeof(EXPLICIT_ACCESS)); - - // Initialize an EXPLICIT_ACCESS structure for an ACE. - // The ACE will allow the current user full access - ea[0].grfAccessPermissions = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL; // KEY_ALL_ACCESS; - ea[0].grfAccessMode = SET_ACCESS; - ea[0].grfInheritance= NO_INHERITANCE; - ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID; - ea[0].Trustee.TrusteeType = TRUSTEE_IS_USER; - ea[0].Trustee.ptstrName = (LPTSTR) pUserSid; - - // Initialize an EXPLICIT_ACCESS structure for an ACE. - // The ACE will allow admins full access - ea[1].grfAccessPermissions = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL; //KEY_ALL_ACCESS; - ea[1].grfAccessMode = SET_ACCESS; - ea[1].grfInheritance= NO_INHERITANCE; - ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID; - ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP; - ea[1].Trustee.ptstrName = (LPTSTR) pAdminSid; - - if (SetEntriesInAcl(2, ea, NULL, &pACL) != ERROR_SUCCESS) - goto cleanup; - - if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)) - goto cleanup; - - if (!SetSecurityDescriptorDacl(pSD, TRUE, pACL, FALSE)) - goto cleanup; - - memset((void *) &securityAttributes, 0, sizeof(SECURITY_ATTRIBUTES)); - securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES); - securityAttributes.lpSecurityDescriptor = pSD; - securityAttributes.bInheritHandle = FALSE; - - pSecurityAttributes = &securityAttributes; - } -#endif // !FEATURE_CORESYSTEM WCHAR objectName[MAX_LONGPATH] = {0}; WCHAR objectNamePrefix[MAX_LONGPATH] = {0}; @@ -295,14 +206,6 @@ private: swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hProfWriterSemaphore"), objectNamePrefix); hProfWriterSemaphore = ::WszCreateSemaphore(pSecurityAttributes, MAX_COUNT, MAX_COUNT, objectName); -#ifndef FEATURE_CORESYSTEM // @CORESYSTEMTODO -cleanup: - if (pSD) delete [] ((char *) pSD); - if (pAdminSid) FreeSid(pAdminSid); - if (hToken) CloseHandle(hToken); - if (pACL) LocalFree(pACL); - if (buffer) delete [] ((char *) buffer); -#endif } bInitialized = hSweepMutex && @@ -382,7 +285,7 @@ cleanup: } else { -#if defined (FEATURE_CORESYSTEM) && !defined(CROSSGEN_COMPILE) && !defined(DACCESS_COMPILE) +#if !defined(CROSSGEN_COMPILE) && !defined(DACCESS_COMPILE) #define MODULE_NAME W("api-ms-win-security-appcontainer-l1-1-0.dll") #else #define MODULE_NAME W("kernel32.dll") diff --git a/src/inc/clrtypes.h b/src/inc/clrtypes.h index 5f9de0c..3b38bb3 100644 --- a/src/inc/clrtypes.h +++ b/src/inc/clrtypes.h @@ -12,7 +12,7 @@ #ifndef CLRTYPES_H_ #define CLRTYPES_H_ -#if defined(_MSC_VER) && !defined(SOURCE_FORMATTING) && (!defined(FEATURE_CORECLR) || defined(FEATURE_CORESYSTEM)) +#if defined(_MSC_VER) && !defined(SOURCE_FORMATTING) // Prefer intsafe.h when available, which defines many of the MAX/MIN // values below (which is why they are in #ifndef blocks). #include diff --git a/src/inc/legacyactivationshim.h b/src/inc/legacyactivationshim.h index 4d8eaa5..564ac95 100644 --- a/src/inc/legacyactivationshim.h +++ b/src/inc/legacyactivationshim.h @@ -819,46 +819,6 @@ namespace LegacyActivationShim #endif //LoadStringRC // Define this method only if it is not yet defined as macro (see ndp\clr\src\inc\UtilCode.h). -#if !defined(LoadStringRCEx) && !defined(FEATURE_CORESYSTEM) - // -------------------------------------------------------------------------------------------- - inline - HRESULT LoadStringRCEx( - LCID lcid, - UINT nResourceID, - __out_ecount(nMax) LPWSTR szBuffer, - int nMax, - int fQuiet, - int *pcwchUsed) - { - HRESULT hr = S_OK; - - if (Util::HasNewActivationAPIs()) - { - GET_CLRINFO(pInfo); - DWORD cchUsed = static_cast(nMax); - IfHrFailRet(pInfo->LoadErrorString(nResourceID, szBuffer, &cchUsed, lcid)); - *pcwchUsed = cchUsed; - } - else - { - CALL_LEGACY_API(LoadStringRCEx, - (LCID lcid, - UINT nResourceID, - LPWSTR szBuffer, - int nMax, - int fQuiet, - int *pcwchUsed), - (lcid, - nResourceID, - szBuffer, - nMax, - fQuiet, - pcwchUsed)); - } - - return hr; - } -#endif //LoadStringRCEx // -------------------------------------------------------------------------------------------- inline diff --git a/src/inc/newapis.h b/src/inc/newapis.h index dfe77a5..cdde784 100644 --- a/src/inc/newapis.h +++ b/src/inc/newapis.h @@ -150,7 +150,6 @@ typedef BOOL (CALLBACK* LOCALE_ENUMPROCEX)(LPWSTR, DWORD, LPARAM); namespace NewApis { -#if defined(FEATURE_CORESYSTEM) __inline bool IsWindows7Platform() { return true; @@ -166,94 +165,6 @@ namespace NewApis return false; } -#else - // Return true if we're on Windows 7 or up (ie: if we have neutral native support and sorting knows about versions) - __inline bool IsWindows7Platform() - { - static int isRunningOnWindows7 = -1; // -1 notinitialized, 0 not running on Windows 7, other value means running on Windows 7 - - if (isRunningOnWindows7 == -1) - { - OSVERSIONINFOEX sVer; - ZeroMemory(&sVer, sizeof(OSVERSIONINFOEX)); - sVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - sVer.dwMajorVersion = 6; - sVer.dwMinorVersion = 1; - sVer.dwPlatformId = VER_PLATFORM_WIN32_NT; - - DWORDLONG dwlConditionMask = 0; - VER_SET_CONDITION(dwlConditionMask, CLR_VER_MAJORVERSION, VER_GREATER_EQUAL); - VER_SET_CONDITION(dwlConditionMask, CLR_VER_MINORVERSION, VER_GREATER_EQUAL); - VER_SET_CONDITION(dwlConditionMask, CLR_VER_PLATFORMID, VER_EQUAL); - - if(VerifyVersionInfo(&sVer, CLR_VER_MAJORVERSION|CLR_VER_MINORVERSION|CLR_VER_PLATFORMID, dwlConditionMask)) - { - isRunningOnWindows7 = 1; - } - else - { - isRunningOnWindows7 = 0; - } - } - - return isRunningOnWindows7 == 1; - } - - // - // IsVistaPlatform return true if running on Vista and false if running on pre or post Vista - // - __inline BOOL IsVistaPlatform() - { - static int isRunningOnVista = -1; // -1 notinitialized, 0 not running on Vista, other value meanse running on Vista - - if (isRunningOnVista == -1) - { - OSVERSIONINFOEX sVer; - ZeroMemory(&sVer, sizeof(OSVERSIONINFOEX)); - sVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - sVer.dwMajorVersion = 6; - sVer.dwMinorVersion = 0; - sVer.dwPlatformId = VER_PLATFORM_WIN32_NT; - - DWORDLONG dwlConditionMask = 0; - VER_SET_CONDITION(dwlConditionMask, CLR_VER_MAJORVERSION, VER_EQUAL); - VER_SET_CONDITION(dwlConditionMask, CLR_VER_MINORVERSION, VER_EQUAL); - VER_SET_CONDITION(dwlConditionMask, CLR_VER_PLATFORMID, VER_EQUAL); - - if(VerifyVersionInfo(&sVer, CLR_VER_MAJORVERSION|CLR_VER_MINORVERSION|CLR_VER_PLATFORMID, dwlConditionMask)) - { - isRunningOnVista = 1; - } - else - { - isRunningOnVista = 0; - } - } - - return isRunningOnVista == 1; - } - - - __inline BOOL IsZhTwSku() - { - const INT32 LANGID_ZH_TW = 0x0404; - LPCWSTR DEFAULT_REGION_NAME_0404 = W("\x53f0\x7063"); - - if(::GetSystemDefaultUILanguage() == LANGID_ZH_TW) - { - WCHAR wszBuffer[32]; - int result = ::GetLocaleInfoW(LANGID_ZH_TW, LOCALE_SNATIVECTRYNAME, wszBuffer, 32); - if (result) - { - if (wcsncmp(wszBuffer, DEFAULT_REGION_NAME_0404, 3) != 0) - { - return true; - } - } - } - return false; - } -#endif // FEATURE_CORESYSTEM __inline BOOL NotLeakingFrameworkOnlyCultures(__in LPCWSTR lpLocaleName) { diff --git a/src/inc/ostype.h b/src/inc/ostype.h index c18d05a..91a0e77 100644 --- a/src/inc/ostype.h +++ b/src/inc/ostype.h @@ -38,19 +38,6 @@ extern BOOL gExInfoIsServer; void InitRunningOnVersionStatus(); -#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM) -typedef enum -{ - WINRT_STATUS_UNINITED = 0, - WINRT_STATUS_UNSUPPORTED, - WINRT_STATUS_SUPPORTED -} -WinRTStatusEnum; - -extern WinRTStatusEnum gWinRTStatus; - -void InitWinRTStatus(); -#endif // FEATURE_COMINTEROP && !FEATURE_CORESYSTEM //***************************************************************************** // @@ -71,16 +58,7 @@ void InitWinRTStatus(); inline BOOL RunningOnWin7() { WRAPPER_NO_CONTRACT; -#if defined(_ARM_) || defined(FEATURE_CORESYSTEM) return TRUE; -#else - if (gRunningOnStatus == RUNNING_ON_STATUS_UNINITED) - { - InitRunningOnVersionStatus(); - } - - return (gRunningOnStatus >= RUNNING_ON_WIN7) ? TRUE : FALSE; -#endif } //***************************************************************************** @@ -137,32 +115,11 @@ inline BOOL ExOSInfoRunningOnServer() #ifdef FEATURE_COMINTEROP -#ifdef FEATURE_CORESYSTEM inline BOOL WinRTSupported() { return RunningOnWin8(); } -#else -inline BOOL WinRTSupported() -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; - -#ifdef CROSSGEN_COMPILE - return TRUE; -#endif - - if (gWinRTStatus == WINRT_STATUS_UNINITED) - { - InitWinRTStatus(); - } - - return gWinRTStatus == WINRT_STATUS_SUPPORTED; -} -#endif // FEATURE_CORESYSTEM #endif // FEATURE_COMINTEROP diff --git a/src/inc/switches.h b/src/inc/switches.h index 762077a..9faf620 100644 --- a/src/inc/switches.h +++ b/src/inc/switches.h @@ -240,11 +240,9 @@ #define FEATURE_DOUBLE_ALIGNMENT_HINT #endif -#if defined(FEATURE_CORESYSTEM) #define FEATURE_MINIMETADATA_IN_TRIAGEDUMPS -#endif // defined(FEATURE_CORESYSTEM) -#if defined(FEATURE_PREJIT) && defined(FEATURE_CORECLR) && defined(FEATURE_CORESYSTEM) +#if defined(FEATURE_PREJIT) && defined(FEATURE_CORECLR) // 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. diff --git a/src/inc/winwrap.h b/src/inc/winwrap.h index 4a012d3..f44aae5 100644 --- a/src/inc/winwrap.h +++ b/src/inc/winwrap.h @@ -466,7 +466,7 @@ #define WszObjectDeleteAuditAlarm ObjectDeleteAuditAlarmW #define WszPrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmW #define WszIsBadStringPtr __DO_NOT_USE__WszIsBadStringPtr__ -#if !defined(FEATURE_CORESYSTEM) || defined(CROSSGEN_COMPILE) +#if defined(CROSSGEN_COMPILE) #define WszLookupAccountSid LookupAccountSidW #endif #define WszLookupAccountName LookupAccountNameW @@ -659,7 +659,6 @@ // winnetwk.h #define WszWNetGetConnection WNetGetConnectionW -#ifdef FEATURE_CORESYSTEM // CoreSystem has CreateSemaphoreExW but not CreateSemaphoreW. #undef WszCreateSemaphore @@ -671,7 +670,6 @@ #undef GetFileVersionInfoSize #define GetFileVersionInfoSize(_filename, _handle) GetFileVersionInfoSizeEx(0, (_filename), (_handle)) -#endif // FEATURE_CORESYSTEM #ifndef _T #define _T(str) W(str) @@ -1021,7 +1019,7 @@ inline int LateboundMessageBoxA(HWND hWnd, return LateboundMessageBoxW(hWnd, wszText, wszCaption, uType); } -#if defined(FEATURE_CORESYSTEM) && !defined(CROSSGEN_COMPILE) +#if !defined(CROSSGEN_COMPILE) #define MessageBoxW LateboundMessageBoxW #define MessageBoxA LateboundMessageBoxA diff --git a/src/pal/prebuilt/inc/asm_version.h b/src/pal/prebuilt/inc/asm_version.h index 977c8dd..f1f2b0a 100644 --- a/src/pal/prebuilt/inc/asm_version.h +++ b/src/pal/prebuilt/inc/asm_version.h @@ -2,18 +2,11 @@ // 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) -#if defined(FEATURE_CORESYSTEM) #define asm_rmj 4 #define asm_rmm 0 #define asm_rup 0 #define asm_rpt 0 #else -#define asm_rmj 5 -#define asm_rmm 0 -#define asm_rup 5 -#define asm_rpt 0 -#endif -#else #define asm_rmj 4 #define asm_rmm 0 #define asm_rup 0 diff --git a/src/strongname/api/strongname.cpp b/src/strongname/api/strongname.cpp index 00b1156..2562f4c 100644 --- a/src/strongname/api/strongname.cpp +++ b/src/strongname/api/strongname.cpp @@ -906,14 +906,8 @@ SNAPI StrongNameGetPublicKeyEx (LPCWSTR wszKeyContainer, // [in] desired ke 0, 0, &hKey)) goto Error; } else { -#if !defined(FEATURE_CORESYSTEM) - // Else fetch the signature key pair from the container. - if (!CryptGetUserKey(hProv, g_uKeySpec, &hKey)) - goto Error; -#else // FEATURE_CORESYSTEM SetLastError(E_NOTIMPL); goto Error; -#endif // !FEATURE_CORESYSTEM } // Determine the length of the public key part as a blob. diff --git a/src/utilcode/securitywrapper.cpp b/src/utilcode/securitywrapper.cpp index 0f146ab..c357ab6 100644 --- a/src/utilcode/securitywrapper.cpp +++ b/src/utilcode/securitywrapper.cpp @@ -207,116 +207,6 @@ exit: return hr; } -#ifndef FEATURE_CORESYSTEM -//----------------------------------------------------------------------------- -// get the sid of a given process id using WTSEnumerateProcesses -// @todo: Make this function fail when WTSEnumerateProcesses is not available -// Or is it always available on all of our platform? -// -// Caller remember to call delete on *ppSid -//----------------------------------------------------------------------------- -HRESULT GetSidFromProcessEXWorker(DWORD dwProcessId, PSID *ppSid) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - PRECONDITION(CheckPointer(ppSid)); - } - CONTRACTL_END; - - HRESULT hr = S_OK; - PWTS_PROCESS_INFOW rgProcessInfo = NULL; - DWORD dwNumProcesses; - DWORD iProc; - DWORD cbSid; - PSID pSid = NULL; - - LOG((LF_CORDB, LL_INFO10000, - "SecurityUtil::GetSidFromProcessEx: 0x%08x\n", - dwProcessId)); - - - *ppSid = NULL; - if (!WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, // use local server - 0, // Reserved must be zero - 1, // version must be 1 - &rgProcessInfo, // Receives pointer to process list - &dwNumProcesses)) - { - hr = HRESULT_FROM_GetLastError(); - goto exit; - } - - for (iProc = 0; iProc < dwNumProcesses; iProc++) - { - - if (rgProcessInfo[iProc].ProcessId == dwProcessId) - { - if (rgProcessInfo[iProc].pUserSid == NULL) - { - LOG((LF_CORDB, LL_INFO10000, - "SecurityUtil::GetSidFromProcessEx is not able to retreive SID\n")); - - // if there is no Sid for the user, don't call GetLengthSid. - // It will crash! It is ok to return E_FAIL as caller will ignore it. - hr = E_FAIL; - goto exit; - } - cbSid = GetLengthSid(rgProcessInfo[iProc].pUserSid); - pSid = new (nothrow) BYTE[cbSid]; - if (pSid == NULL) - { - hr = E_OUTOFMEMORY; - } - else - { - if (!CopySid(cbSid, pSid, rgProcessInfo[iProc].pUserSid)) - { - hr = HRESULT_FROM_GetLastError(); - } - else - { - // We are done. Go to exit - hr = S_OK; - } - } - - // we already find a match. Even if we fail from memory allocation of CopySid, still - // goto exit. - goto exit; - } - } - - // Walk the whole list and cannot find the matching PID - // Find a better error code. - hr = E_FAIL; - -exit: - - if (rgProcessInfo) - { - WTSFreeMemory(rgProcessInfo); - } - - if (FAILED(hr) && pSid) - { - delete [] (reinterpret_cast(pSid)); - } - - if (SUCCEEDED(hr)) - { - _ASSERTE(pSid); - *ppSid = pSid; - } - LOG((LF_CORDB, LL_INFO10000, - "SecurityUtil::GetSidFromProcessEx return hr : 0x%08x\n", - hr)); - - - return hr; -} -#endif // !FEATURE_CORESYSTEM //----------------------------------------------------------------------------- // The functions below initialize this SidBuffer instance with a Sid from @@ -362,12 +252,6 @@ HRESULT SidBuffer::InitFromProcessNoThrow(DWORD pid) _ASSERTE(m_pBuffer == NULL); HRESULT hr = GetSidFromProcessWorker(pid, kOwnerSid, (PSID *) &m_pBuffer); -#ifndef FEATURE_CORESYSTEM - if (FAILED(hr)) - { - hr = GetSidFromProcessEXWorker(pid, (PSID *) &m_pBuffer); - } -#endif // !FEATURE_CORESYSTEM if (FAILED(hr)) { return hr; @@ -527,12 +411,6 @@ HRESULT SidBuffer::InitFromProcessUserNoThrow(DWORD pid) _ASSERTE(m_pBuffer == NULL); HRESULT hr = GetSidFromProcessWorker(pid, kUserSid, (PSID *) &m_pBuffer); -#ifndef FEATURE_CORESYSTEM - if (FAILED(hr)) - { - hr = GetSidFromProcessEXWorker(pid, (PSID *) &m_pBuffer); - } -#endif // !FEATURE_CORESYSTEM if (FAILED(hr)) { return hr; diff --git a/src/utilcode/sstring.cpp b/src/utilcode/sstring.cpp index 7c332e0..cf495cc 100644 --- a/src/utilcode/sstring.cpp +++ b/src/utilcode/sstring.cpp @@ -2237,11 +2237,7 @@ void SString::PVPrintf(const WCHAR *format, va_list args) { // First, try to use the existing buffer va_copy(ap, args); -#if defined(FEATURE_CORESYSTEM) int result = _vsnwprintf_s(GetRawUnicode(), GetRawCount()+1, _TRUNCATE, format, ap); -#else - int result = _vswprintf_p(GetRawUnicode(), GetRawCount()+1, format, ap); -#endif va_end(ap); if (result >= 0) { @@ -2271,11 +2267,7 @@ void SString::PVPrintf(const WCHAR *format, va_list args) errno = 0; va_copy(ap, args); -#if defined(FEATURE_CORESYSTEM) int result = _vsnwprintf_s(GetRawUnicode(), GetRawCount()+1, _TRUNCATE, format, ap); -#else - int result = _vswprintf_p(GetRawUnicode(), GetRawCount()+1, format, ap); -#endif va_end(ap); if (result >= 0) diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp index 33722e5..45b5125 100644 --- a/src/utilcode/util.cpp +++ b/src/utilcode/util.cpp @@ -31,60 +31,7 @@ UINT32 g_nClrInstanceId = 0; //********** Code. ************************************************************ -#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM) -extern WinRTStatusEnum gWinRTStatus = WINRT_STATUS_UNINITED; -#endif // FEATURE_COMINTEROP && !FEATURE_CORESYSTEM -#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM) -//------------------------------------------------------------------------------ -// -// Attempt to detect the presense of Windows Runtime support on the current OS. -// Our algorithm to do this is to ensure that: -// 1. combase.dll exists -// 2. combase.dll contains a RoInitialize export -// - -void InitWinRTStatus() -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_CANNOT_TAKE_LOCK; - STATIC_CONTRACT_SO_TOLERANT; - - WinRTStatusEnum winRTStatus = WINRT_STATUS_UNSUPPORTED; - - const WCHAR wszComBaseDll[] = W("\\combase.dll"); - const SIZE_T cchComBaseDll = _countof(wszComBaseDll); - - WCHAR wszComBasePath[MAX_LONGPATH + 1]; - const SIZE_T cchComBasePath = _countof(wszComBasePath); - - ZeroMemory(wszComBasePath, cchComBasePath * sizeof(wszComBasePath[0])); - - UINT cchSystemDirectory = WszGetSystemDirectory(wszComBasePath, MAX_LONGPATH); - - // Make sure that we're only probing in the system directory. If we can't find the system directory, or - // we find it but combase.dll doesn't fit into it, we'll fall back to a safe default of saying that WinRT - // is simply not present. - if (cchSystemDirectory > 0 && cchComBasePath - cchSystemDirectory >= cchComBaseDll) - { - if (wcscat_s(wszComBasePath, wszComBaseDll) == 0) - { - HModuleHolder hComBase(WszLoadLibrary(wszComBasePath)); - if (hComBase != NULL) - { - FARPROC activateInstace = GetProcAddress(hComBase, "RoInitialize"); - if (activateInstace != NULL) - { - winRTStatus = WINRT_STATUS_SUPPORTED; - } - } - } - } - - gWinRTStatus = winRTStatus; -} -#endif // FEATURE_COMINTEROP && !FEATURE_CORESYSTEM //***************************************************************************** // Convert a string of hex digits into a hex value of the specified # of bytes. //***************************************************************************** diff --git a/src/utilcode/utilmessagebox.cpp b/src/utilcode/utilmessagebox.cpp index 4559d16..3d13489 100644 --- a/src/utilcode/utilmessagebox.cpp +++ b/src/utilcode/utilmessagebox.cpp @@ -18,11 +18,6 @@ #include "ndpversion.h" #include "../dlls/mscorrc/resource.h" #include "ex.h" -#if !defined(FEATURE_CORESYSTEM) -#undef NTDDI_VERSION -#define NTDDI_VERSION NTDDI_WIN7 -#include "commctrl.h" -#endif #if !defined(SELF_NO_HOST) && !defined(FEATURE_CORECLR) @@ -72,16 +67,6 @@ BOOL ShouldDisplayMsgBoxOnCriticalFailure() } -#if !defined(FEATURE_CORESYSTEM) && !defined(FEATURE_CORECLR) -enum ProbedTaskDialogIndirectState -{ - ProbedTaskDialogIndirectState_NotProbed = 0, - ProbedTaskDialogIndirectState_NotAvailable = 1, - ProbedTaskDialogIndirectState_Available = 2 -}; - -static ProbedTaskDialogIndirectState siProbedTaskDialogIndirect = ProbedTaskDialogIndirectState_NotProbed; -#endif // !FEATURE_CORESYSTEM && !FEATURE_CORECLR // We'd like to use TaskDialogIndirect for asserts coming from managed code in particular @@ -109,157 +94,7 @@ int MessageBoxImpl( } CONTRACTL_END; -#if defined(FEATURE_CORESYSTEM) || defined (FEATURE_CORECLR) return WszMessageBox(hWnd, message, title, uType); -#else - bool mustUseMessageBox = false; // Mac, Silverlight, pre-Vista? Do we support this type of message box? - decltype(TaskDialogIndirect)* pfnTaskDialogIndirect = NULL; - ULONG_PTR cookie = NULL; // For activation context. - bool activatedActivationContext = false; - HModuleHolder hmodComctl32; - HANDLE hActCtx = INVALID_HANDLE_VALUE; - - // Note: TaskDialogIndirect is only in the v6 and above versions of comctl32. Windows - // stores that library in the WinSxS directory in a directory with - // "Microsoft.Windows.Common-Controls" in the name. Your application can only see - // this library if the linker has added a manifest dependency on the V6 common controls - // to your application. Or, you can create an activation context to make this work, - // if your library also has the appropriate manifest dependency. - // Also, I'm not going to leave comctl32.dll mapped, to ensure it can't somehow - // interfere with older versions. Therefore, re-load comctl32.dll every time through - // this method. We will record whether TaskDialogIndirect is available though, so - // we can fall back to MessageBox faster. - - // We don't yet have a perfect mapping from all MessageBox behavior to TaskDialogIndirect behavior. - // Use MessageBox to avoid most of this complexity. - if (((uType & MB_ICONMASK) != MB_ICONWARNING) && (uType & MB_ICONMASK) != MB_ICONERROR || - (uType & MB_TYPEMASK) != MB_ABORTRETRYIGNORE || - (uType & MB_DEFMASK) != 0 || - (uType & MB_MODEMASK) != 0 || - (uType & MB_MISCMASK) != 0) - mustUseMessageBox = true; - else if (mustUseMessageBox || siProbedTaskDialogIndirect == ProbedTaskDialogIndirectState_NotAvailable) - mustUseMessageBox = true; - else { - // Replace our application's ActivationContext temporarily, load comctl32 - // & look for TaskDialogIndirect. Don't cache pointer. - // The following code was suggested by some Windows experts. We do not want - // to add a manifest to our library saying we use comctl32 v6, because that - // will mean loading a lot of extra libraries on startup (a significant perf hit). - // We could either store the manifest as a resource, or more creatively since - // we are effectively a Windows component, rely on %windir%\WindowsShell.manifest. - ACTCTX ctx = { sizeof(ACTCTX) }; - ctx.dwFlags = 0; - StackSString manifestPath; // Point this at %windir%\WindowsShell.manifest, for comctl32 version 6. - UINT numChars = WszGetWindowsDirectory(manifestPath.OpenUnicodeBuffer(MAX_PATH_FNAME), MAX_PATH_FNAME); - if (numChars == 0 || numChars >= MAX_PATH_FNAME) - { - _ASSERTE(0); // How did this fail? - } - else { - manifestPath.CloseBuffer(numChars); - if (manifestPath[manifestPath.GetCount() - 1] != W('\\')) - manifestPath.Append(W('\\')); - manifestPath.Append(W("WindowsShell.manifest")); // Other Windows components have already loaded this. - ctx.lpSource = manifestPath.GetUnicode(); - hActCtx = CreateActCtx(&ctx); - if (hActCtx != INVALID_HANDLE_VALUE) - { - if (!ActivateActCtx(hActCtx, &cookie)) - { - cookie = NULL; - _ASSERTE(0); // Why did ActivateActCtx fail? (We'll continue executing & cope with the failure.) - } - else { - activatedActivationContext = true; - // Activation context was replaced - now we can load comctl32 version 6. - hmodComctl32 = WszLoadLibrary(W("comctl32.dll")); - - if (hmodComctl32 != INVALID_HANDLE_VALUE) { - pfnTaskDialogIndirect = (decltype(TaskDialogIndirect)*)GetProcAddress(hmodComctl32, "TaskDialogIndirect"); - if (pfnTaskDialogIndirect == NULL) { - hmodComctl32.Release(); - } - } - } - } - } - - siProbedTaskDialogIndirect = (pfnTaskDialogIndirect == NULL) ? ProbedTaskDialogIndirectState_NotAvailable : ProbedTaskDialogIndirectState_Available; - mustUseMessageBox = (pfnTaskDialogIndirect == NULL); - } - - int result = MB_OK; - if (mustUseMessageBox) { - result = WszMessageBox(hWnd, message, title, uType); - } - else { - _ASSERTE(pfnTaskDialogIndirect != NULL); - int nButtonPressed = 0; - TASKDIALOGCONFIG config = {0}; - config.cbSize = sizeof(config); - config.hwndParent = hWnd; - config.dwCommonButtons = 0; - config.pszWindowTitle = title; - config.dwFlags = (uType & MB_RTLREADING) ? TDF_RTL_LAYOUT : 0; - - // Set the user-visible icon in the window. - _ASSERTE(((uType & MB_ICONMASK) == MB_ICONWARNING) || ((uType & MB_ICONMASK) == MB_ICONERROR)); - config.pszMainIcon = ((uType & MB_ICONMASK) == MB_ICONWARNING) ? TD_WARNING_ICON : TD_ERROR_ICON; - - config.pszMainInstruction = title; - config.pszContent = message; - config.pszExpandedInformation = detailedText; - - // Set up the buttons - // Note about button hot keys: Windows keeps track of of where the last input came from - // (ie, mouse or keyboard). If you use the mouse to interact w/ one dialog box and then use - // the keyboard, the next dialog will not include hot keys. This is a Windows feature to - // minimize clutter on the screen for mouse users. - _ASSERTE((uType & MB_TYPEMASK) == MB_ABORTRETRYIGNORE); - StackSString abortLabel, debugLabel, ignoreLabel; - const WCHAR *pAbortLabel, *pDebugLabel, *pIgnoreLabel; - - if (abortLabel.LoadResource(CCompRC::Optional, IDS_DIALOG_BOX_ABORT_BUTTON)) - pAbortLabel = abortLabel.GetUnicode(); - else - pAbortLabel = W("&Abort"); - if (debugLabel.LoadResource(CCompRC::Optional, IDS_DIALOG_BOX_DEBUG_BUTTON)) - pDebugLabel = debugLabel.GetUnicode(); - else - pDebugLabel = W("&Debug"); - if (ignoreLabel.LoadResource(CCompRC::Optional, IDS_DIALOG_BOX_IGNORE_BUTTON)) - pIgnoreLabel = ignoreLabel.GetUnicode(); - else - pIgnoreLabel = W("&Ignore"); - - const TASKDIALOG_BUTTON abortDebugIgnoreButtons[] = { - { IDOK, pAbortLabel }, - { IDRETRY, pDebugLabel }, - { IDIGNORE, pIgnoreLabel } - }; - config.pButtons = abortDebugIgnoreButtons; - config.cButtons = 3; - - HRESULT hr = pfnTaskDialogIndirect(&config, &nButtonPressed, NULL, NULL); - _ASSERTE(hr == S_OK); - if (hr == S_OK) { - result = nButtonPressed; - } - else { - result = IDOK; - } - - _ASSERTE(result == IDOK || result == IDRETRY || result == IDIGNORE); - } - - if (activatedActivationContext) { - DeactivateActCtx(0, cookie); - ReleaseActCtx(hActCtx); // perf isn't important so we won't bother caching the actctx - } - - return result; -#endif } int UtilMessageBoxVA( diff --git a/src/utilcode/winfix.cpp b/src/utilcode/winfix.cpp index 3a04486..d6bd59c 100644 --- a/src/utilcode/winfix.cpp +++ b/src/utilcode/winfix.cpp @@ -231,21 +231,6 @@ BOOL RunningInteractive() if (fInteractive != -1) return fInteractive != 0; -#if !defined(FEATURE_CORESYSTEM) - HWINSTA hwinsta = NULL; - - if ((hwinsta = GetProcessWindowStation() ) != NULL) - { - DWORD lengthNeeded; - USEROBJECTFLAGS flags; - - if (GetUserObjectInformationW (hwinsta, UOI_FLAGS, &flags, sizeof(flags), &lengthNeeded)) - { - if ((flags.dwFlags & WSF_VISIBLE) == 0) - fInteractive = 0; - } - } -#endif // !FEATURE_CORESYSTEM if (fInteractive != 0) fInteractive = 1; diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index 2db3e23..08792c9 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -4063,7 +4063,6 @@ BOOL Assembly::CanBeShared(DomainAssembly *pDomainAssembly) #endif // FEATURE_LOADER_OPTIMIZATION -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) BOOL Assembly::AllowUntrustedCaller() { CONTRACTL @@ -4076,7 +4075,6 @@ BOOL Assembly::AllowUntrustedCaller() return ModuleSecurityDescriptor::GetModuleSecurityDescriptor(this)->IsAPTCA(); } -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) void DECLSPEC_NORETURN Assembly::ThrowTypeLoadException(LPCUTF8 pszFullName, UINT resIDWhy) { diff --git a/src/vm/classnames.h b/src/vm/classnames.h index 47f1fec..6b10da1 100644 --- a/src/vm/classnames.h +++ b/src/vm/classnames.h @@ -165,11 +165,9 @@ #define g_SecuritySafeCriticalAttribute "System.Security.SecuritySafeCriticalAttribute" -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) #define g_SecurityAPTCA "System.Security.AllowPartiallyTrustedCallersAttribute" #define g_SecurityPartialTrustVisibilityLevel "System.Security.PartialTrustVisibilityLevel" #define g_PartialTrustVisibilityLevel "PartialTrustVisibilityLevel" -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) #define g_ReferenceAssemblyAttribute "System.Runtime.CompilerServices.ReferenceAssemblyAttribute" diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp index 41655cb..0ef7460 100644 --- a/src/vm/comutilnative.cpp +++ b/src/vm/comutilnative.cpp @@ -1542,12 +1542,6 @@ void QCALLTYPE Buffer::MemMove(void *dst, void *src, size_t length) { QCALL_CONTRACT; -#if defined(FEATURE_CORECLR) && !defined(FEATURE_CORESYSTEM) - // Callers of memcpy do expect and handle access violations in some scenarios. - // Access violations in the runtime dll are turned into fail fast by the vector exception handler by default. - // We need to supress this behavior for CoreCLR using AVInRuntimeImplOkayHolder because of memcpy is statically linked in. - AVInRuntimeImplOkayHolder avOk; -#endif memmove(dst, src, length); } diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp index b7989e9..d2d8c96 100644 --- a/src/vm/dllimport.cpp +++ b/src/vm/dllimport.cpp @@ -6606,9 +6606,6 @@ static HMODULE LocalLoadLibraryHelper( LPCWSTR name, DWORD flags, LoadLibErrorTr #ifndef FEATURE_PAL if ((flags & 0xFFFFFF00) != 0 -#ifndef FEATURE_CORESYSTEM - && NDirect::SecureLoadLibrarySupported() -#endif // !FEATURE_CORESYSTEM ) { hmod = CLRLoadLibraryEx(name, NULL, flags & 0xFFFFFF00); @@ -6661,62 +6658,6 @@ static HMODULE LocalLoadLibraryDirectHelper(LPCWSTR name, DWORD flags, LoadLibEr } -#if !defined(FEATURE_CORESYSTEM) - -#define NATIVE_DLL(d) L#d, L#d W(".dll") - -const LPCWSTR wellKnownModules[] = -{ - NATIVE_DLL(advapi32), - NATIVE_DLL(gdi32), - NATIVE_DLL(gdiplus), - NATIVE_DLL(kernel32), - NATIVE_DLL(mscoree), - NATIVE_DLL(ole32), - NATIVE_DLL(shfolder), - NATIVE_DLL(user32), - NATIVE_DLL(version) -}; - -BOOL CompareLibNames (UPTR val1, UPTR val2) -{ - CONTRACTL { - MODE_ANY; - NOTHROW; - GC_NOTRIGGER; - } - CONTRACTL_END; - - LPCWSTR wszStr1 = (LPCWSTR)(val1 << 1); - LPCWSTR wszStr2 = (LPCWSTR)val2; - - if (SString::_wcsicmp(wszStr1, wszStr2) == 0) - return TRUE; - - return FALSE; -} - -PtrHashMap * NDirect::s_pWellKnownNativeModules = NULL; -bool NDirect::s_fSecureLoadLibrarySupported = false; - -HINSTANCE NDirect::CheckForWellKnownModules(LPCWSTR wszLibName, LoadLibErrorTracker *pErrorTracker) -{ - STANDARD_VM_CONTRACT; - - ModuleHandleHolder hMod; - ULONG hash = HashiString(wszLibName); - LPCWSTR wszName = NULL; - wszName = (LPCWSTR) s_pWellKnownNativeModules->LookupValue((UPTR) hash, (LPVOID)wszLibName); - - if (wszName != (LPCWSTR)INVALIDENTRY) - { - hMod = LocalLoadLibraryHelper(wszLibName, 0, pErrorTracker); - } - - return hMod.Extract(); -} - -#endif // !FEATURE_CORESYSTEM #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)) @@ -7006,9 +6947,6 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke return hmod.Extract(); } -#if !defined(FEATURE_CORESYSTEM) - hmod = CheckForWellKnownModules(wszLibName, pErrorTracker); -#endif #ifdef FEATURE_PAL // In the PAL version of CoreCLR, the CLR module itself exports the functionality @@ -7020,7 +6958,7 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke hmod = GetCLRModule(); #endif // FEATURE_PAL -#if defined(FEATURE_CORESYSTEM) && !defined(PLATFORM_UNIX) +#if !defined(PLATFORM_UNIX) if (hmod == NULL) { // Try to go straight to System32 for Windows API sets. This is replicating quick check from diff --git a/src/vm/dllimport.h b/src/vm/dllimport.h index b393bf6..a989af3 100644 --- a/src/vm/dllimport.h +++ b/src/vm/dllimport.h @@ -141,20 +141,6 @@ private: static HMODULE LoadLibraryModuleViaHost(NDirectMethodDesc * pMD, AppDomain* pDomain, const wchar_t* wszLibName); #endif //defined(FEATURE_HOST_ASSEMBLY_RESOLVER) -#if !defined(FEATURE_CORESYSTEM) - static HINSTANCE CheckForWellKnownModules(LPCWSTR wszLibName, LoadLibErrorTracker *pErrorTracker); - static PtrHashMap *s_pWellKnownNativeModules; - - // Indicates if the OS supports the new secure LoadLibraryEx flags introduced in KB2533623 - static bool s_fSecureLoadLibrarySupported; - -public: - static bool SecureLoadLibrarySupported() - { - LIMITED_METHOD_CONTRACT; - return s_fSecureLoadLibrarySupported; - } -#endif // !FEATURE_CORESYSTEM }; //---------------------------------------------------------------- diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index bfb69cd..9a3b902 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -3837,113 +3837,7 @@ bool DomainAssembly::GetDebuggingOverrides(DWORD *pdwFlags) } CONTRACTL_END; -#if defined(DEBUGGING_SUPPORTED) && !defined(FEATURE_CORESYSTEM) - // TODO FIX in V5.0 - // Any touch of the file system is relatively expensive even in the warm case. - // - // Ideally we remove the .INI feature completely (if we need something put it in the .exe.config file) - // - // However because of compatibility concerns, we won't do this until the next side-by-side release - // In the mean time don't check in the case where we have already loaded the NGEN image, as the - // JIT overrides don't mean anything in that case as we won't be jitting anyway. - // This avoids doing these probes for framework DLLs right away. - if (GetFile()->HasNativeImage()) - return false; - - _ASSERTE(pdwFlags); - - bool fHasBits = false; - WCHAR *pFileName = NULL; - HRESULT hr = S_OK; - UINT cbExtOrValue = 4; - WCHAR *pTail = NULL; - size_t len = 0; - WCHAR *lpFileName = NULL; - - const WCHAR *wszFileName = GetFile()->GetPath(); - - if (wszFileName == NULL) - { - return false; - } - - // lpFileName is a copy of the original, and will be edited. - CQuickBytes qb; - len = wcslen(wszFileName); - size_t cchlpFileName = (len + 1); - lpFileName = (WCHAR*)qb.AllocThrows(cchlpFileName * sizeof(WCHAR)); - wcscpy_s(lpFileName, cchlpFileName, wszFileName); - - pFileName = wcsrchr(lpFileName, W('\\')); - - if (pFileName == NULL) - { - pFileName = lpFileName; - } - - if (*pFileName == W('\\')) - { - pFileName++; //move the pointer past the last '\' - } - - _ASSERTE(wcslen(W(".INI")) == cbExtOrValue); - - if (pFileName == NULL || (pTail=wcsrchr(pFileName, W('.'))) == NULL || (wcslen(pTail) WerModuleHolder; -#else #define WER_MODULE_NAME_W W("api-ms-win-core-windowserrorreporting-l1-1-0.dll") typedef SimpleModuleHolder WerModuleHolder; -#endif //------------------------------------------------------------------------------ // Description @@ -216,13 +211,11 @@ BOOL RegisterOutOfProcessWatsonCallbacks() WCHAR wszDACName[] = MAIN_DAC_MODULE_NAME_W W(".dll"); WerModuleHolder hWerModule(WER_MODULE_NAME_W); -#ifdef FEATURE_CORESYSTEM if ((hWerModule == NULL) && !RunningOnWin8()) { // If we are built for CoreSystemServer, but are running on Windows 7, we need to look elsewhere hWerModule = WerModuleHolder(W("Kernel32.dll")); } -#endif if (hWerModule == NULL) { @@ -264,15 +257,10 @@ BOOL RegisterOutOfProcessWatsonCallbacks() LL_ERROR, "WATSON support: failed to register DAC dll with WerRegisterRuntimeExceptionModule"); -#ifdef FEATURE_CORESYSTEM // For CoreSys we *could* be running on a platform that doesn't have Watson proper // (the APIs might exist but they just fail). // WerRegisterRuntimeExceptionModule may return E_NOIMPL. return TRUE; -#else // FEATURE_CORESYSTEM - _ASSERTE(! "WATSON support: failed to register DAC dll with WerRegisterRuntimeExceptionModule"); - return FALSE; -#endif // FEATURE_CORESYSTEM } STRESS_LOG0(LF_STARTUP, diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index ba05e99..a5031f3 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -291,9 +291,6 @@ FCFuncStart(gEnvironmentFuncs) FCFuncElement("GetCommandLineArgsNative", SystemNative::GetCommandLineArgs) FCFuncElement("get_CurrentProcessorNumber", SystemNative::GetCurrentProcessorNumber) -#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM) - QCFuncElement("WinRTSupported", SystemNative::WinRTSupported) -#endif // FEATURE_COMINTEROP FCFuncElementSig("FailFast", &gsig_SM_Str_RetVoid, SystemNative::FailFast) FCFuncElementSig("FailFast", &gsig_SM_Str_Exception_RetVoid, SystemNative::FailFastWithException) #ifndef FEATURE_CORECLR diff --git a/src/vm/eventreporter.cpp b/src/vm/eventreporter.cpp index 567f4f5..6ef767c 100644 --- a/src/vm/eventreporter.cpp +++ b/src/vm/eventreporter.cpp @@ -468,33 +468,8 @@ BOOL ShouldLogInEventLog() } CONTRACTL_END; -#ifndef FEATURE_CORESYSTEM - // If the process is being debugged, don't log - if ((CORDebuggerAttached() || IsDebuggerPresent()) -#ifdef _DEBUG - // Allow debug to be able to break in - && - CLRConfig::GetConfigValue(CLRConfig::INTERNAL_BreakOnUncaughtException) == 0 -#endif - ) - { - return FALSE; - } - - static LONG fOnce = 0; - if (fOnce == 1 || FastInterlockExchange(&fOnce, 1) == 1) - { - return FALSE; - } - - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_logFatalError) == 0) - return FALSE; - else - return TRUE; -#else // no event log on Apollo return FALSE; -#endif //!FEATURE_CORESYSTEM } //--------------------------------------------------------------------------------------- diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index 2bdd441..fb5d9b0 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -4310,26 +4310,6 @@ HRESULT ETW::CEtwTracer::Register() { WRAPPER_NO_CONTRACT; -#ifndef FEATURE_CORESYSTEM - OSVERSIONINFO osVer; - osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - if (GetOSVersion(&osVer) == FALSE) { - return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - else if (osVer.dwMajorVersion < ETW_SUPPORTED_MAJORVER) { - return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - } - - // if running on OS < Longhorn, skip registration unless reg key is set - // since ETW reg is expensive (in both time and working set) on older OSes - if (osVer.dwMajorVersion < ETW_ENABLED_MAJORVER && !g_fEnableETW && !CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PreVistaETWEnabled)) - return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); - - // If running on OS >= Longhorn, skip registration if ETW is not enabled - if (osVer.dwMajorVersion >= ETW_ENABLED_MAJORVER && !g_fEnableETW && !CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_VistaAndAboveETWEnabled)) - return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED); -#endif EventRegisterMicrosoft_Windows_DotNETRuntime(); EventRegisterMicrosoft_Windows_DotNETRuntimePrivate(); diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 78a8f0e..262414c 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -4175,18 +4175,6 @@ void RaiseFailFastExceptionOnWin7(PEXCEPTION_RECORD pExceptionRecord, PCONTEXT p LIMITED_METHOD_CONTRACT; _ASSERTE(RunningOnWin7()); -#ifndef FEATURE_CORESYSTEM - typedef void (WINAPI * RaiseFailFastExceptionFnPtr)(PEXCEPTION_RECORD, PCONTEXT, DWORD); - RaiseFailFastExceptionFnPtr RaiseFailFastException; - - HINSTANCE hKernel32 = WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W); - if (hKernel32 == NULL) - return; - - RaiseFailFastException = (RaiseFailFastExceptionFnPtr)GetProcAddress(hKernel32, "RaiseFailFastException"); - if (RaiseFailFastException == NULL) - return; -#endif // enable preemptive mode before call into OS to allow runtime suspend to finish GCX_PREEMP(); diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp index 52789b8..f61d042 100644 --- a/src/vm/gcenv.os.cpp +++ b/src/vm/gcenv.os.cpp @@ -71,9 +71,7 @@ bool GCToOSInterface::SetCurrentThreadIdealAffinity(GCThreadAffinity* affinity) bool success = true; -#if !defined(FEATURE_CORESYSTEM) - SetThreadIdealProcessor(GetCurrentThread(), (DWORD)affinity->Processor); -#elif !defined(FEATURE_PAL) +#if !defined(FEATURE_PAL) PROCESSOR_NUMBER proc; if (affinity->Group != -1) diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp index 528629c..1c6737b 100644 --- a/src/vm/i386/cgenx86.cpp +++ b/src/vm/i386/cgenx86.cpp @@ -94,65 +94,7 @@ void ClearRegDisplayArgumentAndScratchRegisters(REGDISPLAY * pRD) // BOOL Runtime_Test_For_SSE2() { -#ifdef FEATURE_CORESYSTEM return TRUE; -#else - - BOOL result = IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE); - - if (result == FALSE) - return FALSE; - - // ********************************************************************** - // *** *** - // *** IMPORTANT NOTE: *** - // *** *** - // *** All of these RunningOnXXX APIs return true when *** - // *** the OS that you are running on is that OS or later. *** - // *** For example RunningOnWin2003() will return true *** - // *** when you are running on Win2k3, Vista, Win7 or later. *** - // *** *** - // ********************************************************************** - - - // Windows 7 and later should alwys be using SSE2 instructions - // this is true for both for native and Wow64 - // - if (RunningOnWin7()) - return TRUE; - - if (RunningInWow64()) - { - // There is an issue with saving/restoring the SSE2 registers under wow64 - // So we figure out if we are running on an impacted OS and Service Pack level - // See DevDiv Bugs 89587 for the wow64 bug. - // - - _ASSERTE(ExOSInfoAvailable()); // This is always available on Vista and later - - // - // The issue is fixed in Windows Server 2008 or Vista/SP1 - // - // It is not fixed in Vista/RTM, so check for that case - // - if ((ExOSInfoRunningOnServer() == FALSE)) - { - OSVERSIONINFOEX osvi; - - ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - osvi.wServicePackMajor = 0; - - DWORDLONG dwlConditionMask = 0; - VER_SET_CONDITION( dwlConditionMask, CLR_VER_SERVICEPACKMAJOR, VER_EQUAL); - - if (VerifyVersionInfo(&osvi, CLR_VER_SERVICEPACKMAJOR, dwlConditionMask)) - result = FALSE; - } - } - - return result; -#endif } //--------------------------------------------------------------- diff --git a/src/vm/i386/stublinkerx86.cpp b/src/vm/i386/stublinkerx86.cpp index 63b9e87..6157746 100644 --- a/src/vm/i386/stublinkerx86.cpp +++ b/src/vm/i386/stublinkerx86.cpp @@ -3871,48 +3871,6 @@ VOID StubLinkerCPU::EmitDisable(CodeLabel *pForwardRef, BOOL fCallIn, X86Reg Thr // jnz RarePath X86EmitCondJump(pForwardRef, X86CondCode::kJNZ); -#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM) - // If we are checking whether the current thread holds the loader lock, vector - // such cases to the rare disable pathway, where we can check again. - if (fCallIn && ShouldCheckLoaderLock()) - { - X86EmitPushReg(kEAX); - X86EmitPushReg(kEDX); - - if (ThreadReg == kECX) - X86EmitPushReg(kECX); - - // BOOL AuxUlibIsDLLSynchronizationHeld(BOOL *IsHeld) - // - // So we need to be sure that both the return value and the passed BOOL are both TRUE. - // If either is FALSE, then the call failed or the lock is not held. Either way, the - // probe should not fire. - - X86EmitPushReg(kEDX); // BOOL temp - Emit8(0x54); // push ESP because arg is &temp - X86EmitCall(NewExternalCodeLabel((LPVOID) AuxUlibIsDLLSynchronizationHeld), 0); - - // callee has popped. - X86EmitPopReg(kEDX); // recover temp - - CodeLabel *pPopLabel = NewCodeLabel(); - - Emit16(0xc085); // test eax, eax - X86EmitCondJump(pPopLabel, X86CondCode::kJZ); - - Emit16(0xd285); // test edx, edx - - EmitLabel(pPopLabel); // retain the conditional flags across the pops - - if (ThreadReg == kECX) - X86EmitPopReg(kECX); - - X86EmitPopReg(kEDX); - X86EmitPopReg(kEAX); - - X86EmitCondJump(pForwardRef, X86CondCode::kJNZ); - } -#endif #ifdef _DEBUG if (ThreadReg != kECX) diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp index 6a0fbde..b367dff 100644 --- a/src/vm/interoputil.cpp +++ b/src/vm/interoputil.cpp @@ -2535,20 +2535,12 @@ HRESULT GetCLSIDFromProgID(__in_z WCHAR *strProgId, GUID *pGuid) HRESULT hr = S_OK; -#ifdef FEATURE_CORESYSTEM LeaveRuntimeHolderNoThrow lrh((size_t)CLSIDFromProgID); -#else - LeaveRuntimeHolderNoThrow lrh((size_t)CLSIDFromProgIDEx); -#endif hr = lrh.GetHR(); if (FAILED(hr)) return hr; -#ifdef FEATURE_CORESYSTEM return CLSIDFromProgID(strProgId, pGuid); -#else - return CLSIDFromProgIDEx(strProgId, pGuid); -#endif } #endif // FEATURE_CLASSIC_COMINTEROP diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp index 7b9389d..c96b68b 100644 --- a/src/vm/jithelpers.cpp +++ b/src/vm/jithelpers.cpp @@ -540,7 +540,7 @@ ftype BankersRound(ftype value) if ((value -(integerPart +0.5)) == 0.0) { // round to even -#if defined(_TARGET_ARM_) && defined(FEATURE_CORESYSTEM) +#if defined(_TARGET_ARM_) // @ARMTODO: On ARM when building on CoreSystem (where we link against the system CRT) an attempt to // use fmod(float, float) fails to link (apparently this is converted to a reference to fmodf, which // is not included in the system CRT). Use the double version instead. diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index e0c7143..f710dcf 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -12804,7 +12804,6 @@ PCODE UnsafeJitFunction(MethodDesc* ftn, COR_ILMETHOD_DECODER* ILHeader, CORJIT_ "Jitted Entry at" FMT_ADDR "method %s::%s %s\n", DBG_ADDR(nativeEntry), ftn->m_pszDebugClassName, ftn->m_pszDebugMethodName, ftn->m_pszDebugMethodSignature)); -#if defined(FEATURE_CORESYSTEM) #ifdef _DEBUG LPCUTF8 pszDebugClassName = ftn->m_pszDebugClassName; @@ -12819,7 +12818,6 @@ PCODE UnsafeJitFunction(MethodDesc* ftn, COR_ILMETHOD_DECODER* ILHeader, CORJIT_ //DbgPrintf("Jitted Entry at" FMT_ADDR "method %s::%s %s size %08x\n", DBG_ADDR(nativeEntry), // pszDebugClassName, pszDebugMethodName, pszDebugMethodSignature, sizeOfCode); -#endif ClrFlushInstructionCache(nativeEntry, sizeOfCode); ret = (PCODE)nativeEntry; diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index 303edc4..68148d7 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -5172,7 +5172,6 @@ void MethodTableBuilder::SetSecurityFlagsOnMethod(bmtRTMethod* pParentMethod, pNewMD->SetRequiresLinktimeCheck(); } -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) // All public methods on public types will do a link demand of // full trust, unless AllowUntrustedCaller attribute is set if ( @@ -5200,7 +5199,6 @@ void MethodTableBuilder::SetSecurityFlagsOnMethod(bmtRTMethod* pParentMethod, pNewMD->SetRequiresLinktimeCheck(); } } -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) // If it's a delegate BeginInvoke, we need to do a HostProtection check for synchronization if(!pNewMD->RequiresLinktimeCheck() && IsDelegate()) diff --git a/src/vm/notifyexternals.cpp b/src/vm/notifyexternals.cpp index df1cce4..1d69edf 100644 --- a/src/vm/notifyexternals.cpp +++ b/src/vm/notifyexternals.cpp @@ -30,32 +30,6 @@ BOOL ShouldCheckLoaderLock(BOOL fForMDA /*= TRUE*/) } CONTRACTL_END; -#ifdef FEATURE_CORESYSTEM // CoreSystem does not support this. return FALSE; -#else - // Because of how C++ generates code, we must use default initialization to - // 0 here. Any explicit initialization will result in thread-safety problems. - static BOOL fInited; - static BOOL fShouldCheck; - static BOOL fShouldCheck_ForMDA; - - if (VolatileLoad(&fInited) == FALSE) - { - fShouldCheck_ForMDA = FALSE; - - fShouldCheck = AuxUlibInitialize(); // may fail - -#ifdef MDA_SUPPORTED - if (fShouldCheck) - { - MdaLoaderLock* pProbe = MDA_GET_ASSISTANT(LoaderLock); - if (pProbe) - fShouldCheck_ForMDA = TRUE; - } -#endif // MDA_SUPPORTED - VolatileStore(&fInited, TRUE); - } - return (fForMDA ? fShouldCheck_ForMDA : fShouldCheck); -#endif // FEATURE_CORESYSTEM } diff --git a/src/vm/runtimecallablewrapper.cpp b/src/vm/runtimecallablewrapper.cpp index 359b689..29999a7 100644 --- a/src/vm/runtimecallablewrapper.cpp +++ b/src/vm/runtimecallablewrapper.cpp @@ -742,7 +742,6 @@ IUnknown *AppXComClassFactory::CreateInstanceInternal(IUnknown *pOuter, BOOL *pf HRESULT hr; -#ifdef FEATURE_CORESYSTEM // This works around a bug in the Windows 7 loader that prevents us from loading the // forwarder for this function typedef HRESULT (*CoCreateInstanceFromAppFnPtr) (REFCLSID rclsid, IUnknown *punkOuter, DWORD dwClsCtx, @@ -763,7 +762,6 @@ IUnknown *AppXComClassFactory::CreateInstanceInternal(IUnknown *pOuter, BOOL *pf _ASSERTE(false); IfFailThrow(E_FAIL); } -#endif LeaveRuntimeHolder lrh((size_t)CoCreateInstanceFromApp); diff --git a/src/vm/securitydeclarative.cpp b/src/vm/securitydeclarative.cpp index e0aff16..10abd55 100644 --- a/src/vm/securitydeclarative.cpp +++ b/src/vm/securitydeclarative.cpp @@ -841,7 +841,6 @@ LinktimeCheckReason SecurityDeclarative::GetLinktimeCheckReason(MethodDesc *pMD, LinktimeCheckReason reason = LinktimeCheckReason_None; -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) ModuleSecurityDescriptor *pMSD = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly()); // If the method does not allow partially trusted callers, then the check is because we need to ensure all @@ -850,7 +849,6 @@ LinktimeCheckReason SecurityDeclarative::GetLinktimeCheckReason(MethodDesc *pMD, { reason |= LinktimeCheckReason_AptcaCheck; } -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) // // If the method has a LinkDemand on it for either CAS or non-CAS permissions, get those and set the diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp index ff286dd..cc2f10a 100644 --- a/src/vm/securitymeta.cpp +++ b/src/vm/securitymeta.cpp @@ -1786,7 +1786,6 @@ VOID ModuleSecurityDescriptor::Fixup(DataImage *image) } #endif -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) //--------------------------------------------------------------------------------------- // @@ -1829,7 +1828,6 @@ TokenSecurityDescriptorFlags ParseAptcaAttribute(const BYTE *pbAptcaBlob, DWORD return aptcaFlags; } -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) //--------------------------------------------------------------------------------------- // @@ -1935,7 +1933,6 @@ TokenSecurityDescriptorFlags TokenSecurityDescriptor::ReadSecurityAttributes(IMD szAttributeNamespace != NULL && strcmp(g_SecurityNS, szAttributeNamespace) == 0) { -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) if (strcmp(g_SecurityAPTCA + sizeof(g_SecurityNS), szAttributeName) == 0) { // Check the visibility parameter @@ -1951,7 +1948,6 @@ TokenSecurityDescriptorFlags TokenSecurityDescriptor::ReadSecurityAttributes(IMD flags |= aptcaFlags; } else -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) if (strcmp(g_SecurityCriticalAttribute + sizeof(g_SecurityNS), szAttributeName) == 0) { flags |= TokenSecurityDescriptorFlags_Critical; diff --git a/src/vm/securitymeta.h b/src/vm/securitymeta.h index d78b7bd..dae8f73 100644 --- a/src/vm/securitymeta.h +++ b/src/vm/securitymeta.h @@ -641,10 +641,8 @@ public: inline BOOL CanTransparentCodeSkipVerification(); #endif // !FEATURE_CORECLR -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) // Does the assembly allow partially trusted callers inline BOOL IsAPTCA(); -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) #ifndef FEATURE_CORECLR BOOL AssemblyVersionRequiresLegacyTransparency(); diff --git a/src/vm/securitytransparentassembly.cpp b/src/vm/securitytransparentassembly.cpp index be13cab..3f3bef6 100644 --- a/src/vm/securitytransparentassembly.cpp +++ b/src/vm/securitytransparentassembly.cpp @@ -1443,12 +1443,10 @@ public: ModuleSecurityDescriptorFlags moduleFlags = ModuleSecurityDescriptorFlags_None; -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) if (tokenFlags & TokenSecurityDescriptorFlags_APTCA) { moduleFlags |= ModuleSecurityDescriptorFlags_IsAPTCA; } -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) if (tokenFlags & TokenSecurityDescriptorFlags_Critical) { @@ -1618,12 +1616,10 @@ public: ModuleSecurityDescriptorFlags moduleFlags = ModuleSecurityDescriptorFlags_None; bool fShouldBeOpportunisticallyCritical = true; -#if defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) if (tokenFlags & TokenSecurityDescriptorFlags_APTCA) { moduleFlags |= ModuleSecurityDescriptorFlags_IsAPTCA; } -#endif // defined(FEATURE_APTCA) || defined(FEATURE_CORESYSTEM) if (tokenFlags & TokenSecurityDescriptorFlags_Transparent) { diff --git a/src/vm/util.cpp b/src/vm/util.cpp index 2cf6f7f..2854664 100644 --- a/src/vm/util.cpp +++ b/src/vm/util.cpp @@ -369,20 +369,6 @@ void NPrintToHandleA(HANDLE Handle, const char *pszString, size_t BytesToWrite) DWORD dwChunkToWrite = (DWORD) min(BytesToWrite, maxWriteFileSize); // No CharNextExA on CoreSystem, we just assume no multi-byte characters (this code path shouldn't be // used in the production codepath for currently supported CoreSystem based products anyway). -#ifndef FEATURE_CORESYSTEM - if (dwChunkToWrite < BytesToWrite) { - break; - // must go by char to find biggest string that will fit, taking DBCS chars into account - //dwChunkToWrite = 0; - //const char *charNext = pszString; - //while (dwChunkToWrite < maxWriteFileSize-2 && charNext) { - // charNext = CharNextExA(0, pszString+dwChunkToWrite, 0); - // dwChunkToWrite = (DWORD)(charNext - pszString); - //} - //if (dwChunkToWrite == 0) - // break; - } -#endif // !FEATURE_CORESYSTEM // Try to write to handle. If this is not a CUI app, then this is probably // not going to work unless the dev took special pains to set their own console @@ -2243,78 +2229,11 @@ DWORD GetLogicalCpuCountFallback() if(LogicalNum > 1) { -#ifdef FEATURE_CORESYSTEM // CoreSystem doesn't expose GetProcessAffinityMask or SetProcessAffinityMask or anything // functionally equivalent. Just assume 1:1 mapping if we get here (in reality we shouldn't since // all CoreSystems support GetLogicalProcessorInformation so GetLogicalCpuCountFromOS should have // taken care of everything. goto fDone; -#else // FEATURE_CORESYSTEM - HANDLE hCurrentProcessHandle; - DWORD_PTR dwProcessAffinity; - DWORD_PTR dwSystemAffinity; - DWORD_PTR dwAffinityMask; - - // Calculate the appropriate shifts and mask based on the - // number of logical processors. - - BYTE i = 1, PHY_ID_MASK = 0xFF, PHY_ID_SHIFT = 0; - while (i < LogicalNum) - { - i *= 2; - PHY_ID_MASK <<= 1; - PHY_ID_SHIFT++; - } - hCurrentProcessHandle = GetCurrentProcess(); - - GetProcessAffinityMask(hCurrentProcessHandle, &dwProcessAffinity, &dwSystemAffinity); - - // Check if available process affinity mask is equal to the available system affinity mask - // If the masks are equal, then all the processors the OS utilizes are available to the - // application. - - if (dwProcessAffinity != dwSystemAffinity) - { - retVal = 0; - goto fDone; - } - - dwAffinityMask = 1; - - // loop over all processors, running APIC ID retrieval code starting - // with the first one by setting process affinity. - while (dwAffinityMask != 0 && dwAffinityMask <= dwProcessAffinity) - { - // Check if this CPU is available - if (dwAffinityMask & dwProcessAffinity) - { - if (SetProcessAffinityMask(hCurrentProcessHandle, dwAffinityMask)) - { - BYTE APIC_ID, LOG_ID, PHY_ID; - __SwitchToThread(0, CALLER_LIMITS_SPINNING); // Give OS time to switch CPU - - getextcpuid(0,1, buffer); //call cpuid with EAX=1 - - APIC_ID = (dwBuffer[1] & INITIAL_APIC_ID_BITS) >> 24; - LOG_ID = APIC_ID & ~PHY_ID_MASK; - PHY_ID = APIC_ID >> PHY_ID_SHIFT; - if (LOG_ID != 0) - lProcCounter++; - } - } - dwAffinityMask = dwAffinityMask << 1; - } - // Reset the processor affinity - - SetProcessAffinityMask(hCurrentProcessHandle, dwProcessAffinity); - - // Check if HT is enabled on all the processors - if(lProcCounter > 0 && (lProcCounter == (DWORD)(PhysicalNum / LogicalNum))) - { - retVal = lProcCounter; - goto fDone; - } -#endif // FEATURE_CORESYSTEM } } fDone: diff --git a/src/vm/win32threadpool.cpp b/src/vm/win32threadpool.cpp index e8a05c3..90be10a 100644 --- a/src/vm/win32threadpool.cpp +++ b/src/vm/win32threadpool.cpp @@ -495,11 +495,7 @@ void ThreadpoolMgr::InitPlatformVariables() CONTRACT_VIOLATION(GCViolation|FaultViolation); hNtDll = CLRLoadLibrary(W("ntdll.dll")); _ASSERTE(hNtDll); -#ifdef FEATURE_CORESYSTEM hCoreSynch = CLRLoadLibrary(W("api-ms-win-core-synch-l1-1-0.dll")); -#else - hCoreSynch = CLRLoadLibrary(W("kernel32.dll")); -#endif _ASSERTE(hCoreSynch); } diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index f39b8f8..347718a 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -1714,7 +1714,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) && defined(FEATURE_CORESYSTEM) +#elif defined(_TARGET_ARM_) && defined(FEATURE_CORECLR) if (!IsReadyToRunCompilation()) { // On ARM CoreSys builds, crossgen will use 4k file alignment, as requested by Phone perf team -- 2.7.4