summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vm/assemblynamesconfigfactory.cpp264
-rw-r--r--src/vm/assemblynamesconfigfactory.h72
-rw-r--r--src/vm/eeconfigfactory.cpp398
-rw-r--r--src/vm/eeconfigfactory.h149
-rw-r--r--src/vm/mda.cpp11
-rw-r--r--src/vm/mda.h1
-rw-r--r--src/vm/ngenoptout.cpp12
-rw-r--r--src/vm/ngenoptout.h34
8 files changed, 10 insertions, 931 deletions
diff --git a/src/vm/assemblynamesconfigfactory.cpp b/src/vm/assemblynamesconfigfactory.cpp
deleted file mode 100644
index ed5da9679b..0000000000
--- a/src/vm/assemblynamesconfigfactory.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// AssemblyNamesConfigFactory.cpp
-//
-
-//
-//
-// Parses XML files and adding runtime entries to assembly list
-// Abstract, derived classes need to override AddAssemblyName
-#include "common.h"
-#include "common.h"
-#include <xmlparser.h>
-#include <objbase.h>
-#include "parse.h"
-#include "assemblynamesconfigfactory.h"
-
-
-#define ISWHITE(ch) ((ch) >= 0x09 && (ch) <= 0x0D || (ch) == 0x20)
-
-#define CONST_STRING_AND_LEN(str) str, NumItems(str)-1
-
-extern int EEXMLStringCompare(const WCHAR *pStr1,
- DWORD cchStr1,
- const WCHAR *pStr2,
- DWORD cchStr2);
-extern HRESULT VersionFromString(LPCWSTR wzVersion, WORD *pwVerMajor, WORD *pwVerMinor,
- WORD *pwVerBld, WORD *pwVerRev);
-extern HRESULT MapProcessorArchitectureToPEKIND(LPCWSTR pwzProcArch, PEKIND *pe);
-
-AssemblyNamesConfigFactory::AssemblyNamesConfigFactory()
-{
- LIMITED_METHOD_CONTRACT;
- m_pAssemblyName = NULL;
- m_bCurrentEntryInvalid = TRUE;
- m_dwCurrentElementDepth = 0;
- m_dwProperty = ASM_NAME_MAX_PARAMS;
-}
-
-AssemblyNamesConfigFactory::~AssemblyNamesConfigFactory()
-{
- LIMITED_METHOD_CONTRACT;
-}
-
-
-HRESULT STDMETHODCALLTYPE AssemblyNamesConfigFactory::NotifyEvent(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODEFACTORY_EVENT iEvt)
-{
- LIMITED_METHOD_CONTRACT;
-
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE AssemblyNamesConfigFactory::BeginChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo)
-{
- LIMITED_METHOD_CONTRACT;
- m_dwCurrentElementDepth ++;
-
- return S_OK;
-}
-
-//---------------------------------------------------------------------------
-HRESULT STDMETHODCALLTYPE AssemblyNamesConfigFactory::EndChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ BOOL fEmptyNode,
- /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- EX_TRY
- {
- if (m_dwCurrentElementDepth == 1 && m_pAssemblyName != NULL)
- {
- if (!m_bCurrentEntryInvalid)
- {
- // publish
- AddAssemblyName(m_pAssemblyName);
- };
- m_pAssemblyName->Release();
- m_pAssemblyName = NULL;
- }
-
- if (!fEmptyNode)
- m_dwCurrentElementDepth --;
- }
- EX_CATCH_HRESULT(hr);
- return hr;
-}
-
-
-
-HRESULT STDMETHODCALLTYPE AssemblyNamesConfigFactory::CreateNode(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ PVOID pNode,
- /* [in] */ USHORT cNumRecs,
- /* [in] */ XML_NODE_INFO* __RPC_FAR * __RPC_FAR apNodeInfo)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END;
-
- if(m_dwCurrentElementDepth > 1)
- return S_OK;
-
- HRESULT hr = S_OK;
-
- for(DWORD i = 0; i < cNumRecs; i++) {
- CONTRACT_VIOLATION(ThrowsViolation); // Lots of stuff in here throws!
-
- if(apNodeInfo[i]->dwType == XML_ELEMENT ||
- apNodeInfo[i]->dwType == XML_ATTRIBUTE ||
- apNodeInfo[i]->dwType == XML_PCDATA)
- {
-
- DWORD dwStringSize = apNodeInfo[i]->ulLen;
- LPWSTR pszString = (WCHAR*) apNodeInfo[i]->pwcText;
- // Trim the value
-
- // we should never decrement lgth if it's 0, because it's unsigned
-
- for(;*pszString && ISWHITE(*pszString) && dwStringSize>0; pszString++, dwStringSize--);
- while( dwStringSize > 0 && ISWHITE(pszString[dwStringSize-1]))
- dwStringSize--;
- switch(apNodeInfo[i]->dwType)
- {
- case XML_ELEMENT :
- if(EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("assemblyIdentity"))) == 0)
- {
- // new entry
- _ASSERTE(m_pAssemblyName == NULL);
- IfFailRet(CreateAssemblyNameObject(&m_pAssemblyName, NULL,0,NULL));
- m_bCurrentEntryInvalid = FALSE;
- }
- else
- {
- m_bCurrentEntryInvalid = TRUE;
- }
-
- break;
-
-
- case XML_ATTRIBUTE :
- if(m_bCurrentEntryInvalid)
- break;
-
- if(EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("name"))) == 0)
- {
- m_dwProperty = ASM_NAME_NAME;
- }
- else
- if(EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("version"))) == 0)
- {
- m_dwProperty = ASM_NAME_MAJOR_VERSION;
- }
- else
- if(EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("publicKeyToken"))) == 0)
- {
- m_dwProperty = ASM_NAME_PUBLIC_KEY_TOKEN;
- }
- else
- if(EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("processorArchitecture"))) == 0)
- {
- m_dwProperty = ASM_NAME_ARCHITECTURE;
- }
- else
- {
- m_bCurrentEntryInvalid = TRUE;
- }
- break;
-
-
- case XML_PCDATA :
- if(m_bCurrentEntryInvalid)
- break;
-
- _ASSERTE(m_pAssemblyName!= NULL); // can only be null if m_bCurrentEntryInvalid
- switch(m_dwProperty)
- {
- case ASM_NAME_NAME:
- {
- StackSString s(pszString,dwStringSize);
- // takes number of bytes, thus *2
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_NAME, LPCWSTR(s), (dwStringSize+1)*sizeof(WCHAR)));
- }
- break;
- case ASM_NAME_MAJOR_VERSION:
- {
- StackSString s(pszString,dwStringSize);
- WORD wVerMajor = 0;
- WORD wVerMinor = 0;
- WORD wVerBld = 0;
- WORD wVerRev = 0;
- if (SUCCEEDED(VersionFromString(s, &wVerMajor, &wVerMinor, &wVerBld, &wVerRev)))
- {
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_MAJOR_VERSION, &wVerMajor, sizeof(WORD)));
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_MINOR_VERSION, &wVerMinor, sizeof(WORD)));
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_BUILD_NUMBER, &wVerBld, sizeof(WORD)));
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_REVISION_NUMBER, &wVerRev, sizeof(WORD)));
- }
- else
- m_bCurrentEntryInvalid = TRUE;
-
- }
- break;
- case ASM_NAME_ARCHITECTURE:
- {
- StackSString s(pszString,dwStringSize);
- PEKIND PeKind = peNone;
- if(SUCCEEDED(MapProcessorArchitectureToPEKIND(s, &PeKind)))
- {
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_ARCHITECTURE, (LPBYTE) &PeKind, sizeof(PeKind)));
- }
- else
- {
- m_bCurrentEntryInvalid = TRUE;
- }
-
- }
- break;
- case ASM_NAME_PUBLIC_KEY_TOKEN:
- {
- if(EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("null"))) == 0)
- {
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_NULL_PUBLIC_KEY_TOKEN, NULL, 0));
- }
- else
- {
- if (dwStringSize % 2 != 0)
- return FUSION_E_INVALID_NAME;
-
- DWORD cbProp = dwStringSize / 2;
- NewHolder<BYTE> pbProp = new BYTE[cbProp];
- CParseUtils::UnicodeHexToBin(pszString, dwStringSize, pbProp); //????
- IfFailRet(m_pAssemblyName->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, pbProp, cbProp));
- }
- break;
- }
-
- default:
- _ASSERTE(!"Invalid format");
- m_bCurrentEntryInvalid = TRUE;
- break;
- }
- break;
- }
-
- }
- }
- return S_OK;
-}
diff --git a/src/vm/assemblynamesconfigfactory.h b/src/vm/assemblynamesconfigfactory.h
deleted file mode 100644
index 234adb9208..0000000000
--- a/src/vm/assemblynamesconfigfactory.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// AssemblyNamesConfigFactory.h
-//
-
-//
-//
-// Parses XML files and adding runtime entries to assembly list
-// Abstract, derived classes need to override AddAssemblyName
-
-
-#ifndef ASSEMBLYNAMESCONFIGFACTORY_H
-#define ASSEMBLYNAMESCONFIGFACTORY_H
-
-#include "unknwn.h"
-#include "../xmlparser/_reference.h"
-#include "../xmlparser/_unknown.h"
-
-
-class AssemblyNamesConfigFactory : public _unknown<IXMLNodeFactory, &IID_IXMLNodeFactory>
-{
-
-public:
- AssemblyNamesConfigFactory ();
- ~AssemblyNamesConfigFactory ();
- HRESULT STDMETHODCALLTYPE NotifyEvent(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODEFACTORY_EVENT iEvt);
-
- HRESULT STDMETHODCALLTYPE BeginChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODE_INFO* __RPC_FAR pNodeInfo);
-
- HRESULT STDMETHODCALLTYPE EndChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ BOOL fEmptyNode,
- /* [in] */ XML_NODE_INFO* __RPC_FAR pNodeInfo);
-
- HRESULT STDMETHODCALLTYPE Error(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ HRESULT hrErrorCode,
- /* [in] */ USHORT cNumRecs,
- /* [in] */ XML_NODE_INFO* __RPC_FAR * __RPC_FAR apNodeInfo)
- {
- LIMITED_METHOD_CONTRACT;
- /*
- UNUSED(pSource);
- UNUSED(hrErrorCode);
- UNUSED(cNumRecs);
- UNUSED(apNodeInfo);
- */
- return hrErrorCode;
- }
-
- HRESULT STDMETHODCALLTYPE CreateNode(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ PVOID pNodeParent,
- /* [in] */ USHORT cNumRecs,
- /* [in] */ XML_NODE_INFO* __RPC_FAR * __RPC_FAR apNodeInfo);
-
- virtual void AddAssemblyName(IAssemblyName*) = 0;
-protected:
- IAssemblyName* m_pAssemblyName;
- BOOL m_bCurrentEntryInvalid;
- DWORD m_dwCurrentElementDepth;
- DWORD m_dwProperty;
-
-};
-
-
-#endif
diff --git a/src/vm/eeconfigfactory.cpp b/src/vm/eeconfigfactory.cpp
deleted file mode 100644
index a0eb927ce9..0000000000
--- a/src/vm/eeconfigfactory.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// EEConfigFactory.cpp
-//
-
-//
-// Factory used to with the XML parser to read configuration files
-//
-
-#include "common.h"
-#include "ngenoptout.h"
-#include "eeconfigfactory.h"
-
-
-#define ISWHITE(ch) ((ch) >= 0x09 && (ch) <= 0x0D || (ch) == 0x20)
-
-#define CONST_STRING_AND_LEN(str) str, NumItems(str)-1
-
-
-int EEXMLStringCompare(const WCHAR *pStr1,
- DWORD cchStr1,
- const WCHAR *pStr2,
- DWORD cchStr2)
-{
- LIMITED_METHOD_CONTRACT;
- if (cchStr1 != cchStr2)
- return -1;
-
- return wcsncmp(pStr1, pStr2, cchStr1);
-}// EEXMLStringCompare
-
-
-int EEXMLStringComparei(const WCHAR *pStr1,
- DWORD cchStr1,
- const WCHAR *pStr2,
- DWORD cchStr2)
-{
- WRAPPER_NO_CONTRACT;
- if (cchStr1 != cchStr2)
- return -1;
-
- return SString::_wcsnicmp(pStr1, pStr2, cchStr1);
-}// EEXMLStringCompare
-
-
-
-EEConfigFactory::EEConfigFactory(
- ConfigStringHashtable* pTable,
- LPCWSTR pString,
- ParseCtl parseCtl)
-{
- LIMITED_METHOD_CONTRACT;
- m_pTable = pTable;
- m_pVersion = pString;
- m_dwDepth = 0;
- m_fUnderRuntimeElement = FALSE;
- m_fDeveloperSettings = FALSE;
- m_fVersionedRuntime= FALSE;
- m_fOnEnabledAttribute = FALSE;
- m_fOnValueAttribute = FALSE;
- m_pCurrentRuntimeElement = m_pBuffer;
- m_dwCurrentRuntimeElement = 0;
- m_dwSize = CONFIG_KEY_SIZE;
- m_parseCtl = parseCtl;
- m_pActiveFactory = NULL;
-}
-
-EEConfigFactory::~EEConfigFactory()
-{
- LIMITED_METHOD_CONTRACT;
- DeleteKey();
-}
-
-HRESULT STDMETHODCALLTYPE EEConfigFactory::NotifyEvent(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODEFACTORY_EVENT iEvt)
-{
- LIMITED_METHOD_CONTRACT;
- if(iEvt == XMLNF_ENDDOCUMENT) {
- // <TODO> add error handling.</TODO>
- }
- if(m_pActiveFactory != NULL)
- return m_pActiveFactory->NotifyEvent(pSource, iEvt);
-
- return S_OK;
-}
-//---------------------------------------------------------------------------
-HRESULT STDMETHODCALLTYPE EEConfigFactory::BeginChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo)
-{
- LIMITED_METHOD_CONTRACT;
-
- m_dwDepth++;
- if(m_pActiveFactory != NULL)
- return m_pActiveFactory->BeginChildren(pSource, pNodeInfo);
- return S_OK;
-
-}
-//---------------------------------------------------------------------------
-HRESULT STDMETHODCALLTYPE EEConfigFactory::EndChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ BOOL fEmptyNode,
- /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo)
-{
- LIMITED_METHOD_CONTRACT;
- if ( fEmptyNode ) {
- m_fDeveloperSettings = FALSE;
- }
- else {
- m_dwDepth--;
- }
-
- if (m_pActiveFactory != NULL)
- {
- HRESULT hr = S_OK;
- IfFailRet(m_pActiveFactory->EndChildren(pSource, fEmptyNode, pNodeInfo));
-
-
- if(m_dwDepth == 2) // when generalizing: use the current active factory depth
- {
- m_pActiveFactory = NULL;
- }
-
- }
-
- if (m_fUnderRuntimeElement && wcscmp(pNodeInfo->pwcText, W("runtime")) == 0) {
- m_fUnderRuntimeElement = FALSE;
- m_fVersionedRuntime = FALSE;
- ClearKey();
- // CLR_STARTUP_OPT:
- // Early out if we only need to read <runtime> section.
- //
- if (m_parseCtl == stopAfterRuntimeSection)
- pSource->Abort(NULL/*unused*/);
- }
-
- return S_OK;
-}
-//---------------------------------------------------------------------------
-HRESULT STDMETHODCALLTYPE EEConfigFactory::CreateNode(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ PVOID pNode,
- /* [in] */ USHORT cNumRecs,
- /* [in] */ XML_NODE_INFO* __RPC_FAR * __RPC_FAR apNodeInfo)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END;
-
- if(m_pActiveFactory != NULL)
- return m_pActiveFactory->CreateNode(pSource, pNode, cNumRecs, apNodeInfo);
-
- if(m_dwDepth > 3)
- {
-
- return S_OK;
- }
-
- HRESULT hr = S_OK;
- DWORD dwStringSize = 0;
- WCHAR* pszString = NULL;
- DWORD i;
- BOOL fRuntimeKey = FALSE;
- BOOL fVersion = FALSE;
-
- for( i = 0; i < cNumRecs; i++) {
- CONTRACT_VIOLATION(ThrowsViolation); // Lots of stuff in here throws!
-
- if(apNodeInfo[i]->dwType == XML_ELEMENT ||
- apNodeInfo[i]->dwType == XML_ATTRIBUTE ||
- apNodeInfo[i]->dwType == XML_PCDATA) {
-
- dwStringSize = apNodeInfo[i]->ulLen;
- pszString = (WCHAR*) apNodeInfo[i]->pwcText;
- // Trim the value
-
- // we should never decrement lgth if it's 0, because it's unsigned
-
- for(;*pszString && ISWHITE(*pszString) && dwStringSize>0; pszString++, dwStringSize--);
- while( dwStringSize > 0 && ISWHITE(pszString[dwStringSize-1]))
- dwStringSize--;
-
- // NOTE: pszString is not guaranteed to be null terminated. Use EEXMLStringCompare to do
- // string comparisions on it
-
- switch(apNodeInfo[i]->dwType) {
- case XML_ELEMENT :
- fRuntimeKey = FALSE;
- ClearKey();
-
- if (m_dwDepth == 1 && EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("runtime"))) == 0) {
- m_fUnderRuntimeElement = TRUE;
- fRuntimeKey = TRUE;
- }
-
- if(m_dwDepth == 2 && m_fUnderRuntimeElement) {
-
- // Developer settings can look like
- // <runtime>
- // <developerSettings installationVersion="v2.0.40223.0" />
- //
- // or
- //
- // <developmentMode developerInstallation="true" />
- //
- // Neither one is your standard config setting.
- if (!EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("developerSettings"))) ||
- !EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("developmentMode"))))
- {
- m_fDeveloperSettings = TRUE;
- }
- else
- // when generalizing: use map of (string, depth) -> class
- if (!EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("disableNativeImageLoad"))))
- {
- m_pActiveFactory = new NativeImageOptOutConfigFactory();
- m_pActiveFactory->AddRef();
- }
- else
- {
- // This is a standard element under the runtime node.... it could look like this
- // <runtime>
- // <pszString enabled="1" />
-
- hr = CopyToKey(pszString, dwStringSize);
- if(FAILED(hr)) return hr;
- }
- }
- // If our depth isn't 2, and we're not under the runtime element....
- else
- ClearKey();
-
- break ;
-
- case XML_ATTRIBUTE :
- if(fRuntimeKey && EEXMLStringCompare(pszString, dwStringSize, CONST_STRING_AND_LEN(W("version"))) == 0) {
- fVersion = TRUE;
- }
- else
- {
- if (m_dwDepth == 2 && m_fUnderRuntimeElement)
- {
- if (!m_fDeveloperSettings)
- {
- _ASSERTE(m_dwCurrentRuntimeElement > 0);
-
- // The standard model for runtime config settings is as follows
- //
- // <runtime>
- // <m_pCurrentRuntimeElement enabled="true|false" />
- // or
- // <m_pCurrentRuntimeElement enabled="1|0" />
- // or
- // <m_pCurrentRuntimeElement value="string" />
-
- m_fOnEnabledAttribute = (EEXMLStringComparei(pszString, dwStringSize, CONST_STRING_AND_LEN(W("enabled"))) == 0);
- m_fOnValueAttribute = (EEXMLStringComparei(pszString, dwStringSize, CONST_STRING_AND_LEN(W("value"))) == 0);
- }
- else // We're looking at developer settings
- {
- // Developer settings look like
- // <developerSettings installationVersion="v2.0.40223.0" />
- //
- // or
- //
- // <developmentMode developerInstallation="true" />
- //
-
- // The key name will actually be the attribute name
-
- hr = CopyToKey(pszString, dwStringSize);
- if(FAILED(hr)) return hr;
- m_fOnEnabledAttribute = FALSE;
- m_fOnValueAttribute = FALSE;
- }
- }
- }
- break;
- case XML_PCDATA:
- if(fVersion) {
- // if this is not the right version
- // then we are not interested
- if(EEXMLStringCompare(pszString, dwStringSize, m_pVersion, (DWORD)wcslen(m_pVersion))) {
- m_fUnderRuntimeElement = FALSE;
- }
- else {
- // if it is the right version then overwrite
- // all entries that exist in the hash table
- m_fVersionedRuntime = TRUE;
- }
-
- fVersion = FALSE;
- }
- else if(fRuntimeKey) {
- break; // Ignore all other attributes on <runtime>
- }
-
- // m_dwCurrentRuntimeElement is set when we called CopyToKey in the XML_ELEMENT case
- // section above.
- else if(m_dwCurrentRuntimeElement > 0 && (m_fDeveloperSettings || m_fOnEnabledAttribute || m_fOnValueAttribute)) {
-
- // This means that, either we are working on attribute values for the developer settings,
- // or we've got what "enabled" is equal to, or we're reading a string for a value setting.
- //
- // <runtime>
- // <m_pwzCurrentElementUnderRuntimeElement m_pLastKey=pString />
-
- if (m_fOnEnabledAttribute) {
- // For the enabled settings, let's convert all trues to 1s and the falses to 0s
- if (EEXMLStringComparei(pszString, dwStringSize, CONST_STRING_AND_LEN(W("false"))) == 0) {
- pszString = W("0");
- dwStringSize = 1;
- }
- else if (EEXMLStringComparei(pszString, dwStringSize, CONST_STRING_AND_LEN(W("true"))) == 0) {
- pszString = W("1");
- dwStringSize = 1;
- }
-
- // <TODO> Right now, if pString isn't 0 or 1, then the XML schema is bad.
- // If we were to ever do schema validation, this would be a place to put it.
- // </TODO>
- }
-
- hr = AddKeyValuePair(pszString, dwStringSize, m_pCurrentRuntimeElement, m_dwCurrentRuntimeElement);
- if(FAILED(hr)) { return hr; }
- }
-
- break ;
- default:
- ;
- } // end of switch
- }
- }
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE EEConfigFactory::AddKeyValuePair(
- __in_ecount(dwStringSize) WCHAR * pszString,
- /* [in] */ DWORD dwStringSize,
- __in_ecount(m_dwCurrentRuntimeElement) WCHAR * m_pCurrentRuntimeElement,
- /* [in] */ DWORD m_dwCurrentRuntimeElement
- )
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // verify we the size fields don't overflow
- if (dwStringSize + 1 < dwStringSize) { return E_FAIL; }
- if (m_dwCurrentRuntimeElement < m_dwCurrentRuntimeElement - 1) { return E_FAIL; }
-
- EX_TRY
- {
- // Allocate memory that can store this setting
- NewArrayHolder<WCHAR> pStringToKeep(new WCHAR[dwStringSize+1]);
- wcsncpy_s(pStringToKeep, dwStringSize + 1, pszString, dwStringSize);
-
- // See if we've already picked up a value for this setting
- ConfigStringKeyValuePair * pair = m_pTable->Lookup(m_pCurrentRuntimeElement);
- if(pair != NULL) {
- // If this is a config section for this runtime version, then it's allowed to overwrite
- // previous settings that we've picked up
- if(m_fVersionedRuntime) {
- delete[] pair->value;
- pair->value = pStringToKeep;
- pStringToKeep.SuppressRelease();
- }
- }
- else {
- // We're adding a new config item
- NewArrayHolder<WCHAR> pKeyToKeep (new WCHAR[m_dwCurrentRuntimeElement]);
- wcsncpy_s(pKeyToKeep, m_dwCurrentRuntimeElement, m_pCurrentRuntimeElement, m_dwCurrentRuntimeElement - 1);
-
- ConfigStringKeyValuePair * newPair = new ConfigStringKeyValuePair();
- newPair->key = pKeyToKeep;
- newPair->value = pStringToKeep;
- m_pTable->Add(newPair);
- pKeyToKeep.SuppressRelease();
- pStringToKeep.SuppressRelease();
- }
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
diff --git a/src/vm/eeconfigfactory.h b/src/vm/eeconfigfactory.h
deleted file mode 100644
index 2554295268..0000000000
--- a/src/vm/eeconfigfactory.h
+++ /dev/null
@@ -1,149 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// EEConfigFactory.h
-//
-
-//
-// Parses XML files and adding runtime entries to the EEConfig list
-//
-
-
-#ifndef EECONFIGFACTORY_H
-#define EECONFIGFACTORY_H
-
-#include <xmlparser.h>
-#include <objbase.h>
-#include "unknwn.h"
-#include "../xmlparser/_reference.h"
-#include "../xmlparser/_unknown.h"
-#include "eehash.h"
-#include "eeconfig.h"
-
-#define CONFIG_KEY_SIZE 128
-
-class EEConfigFactory : public _unknown<IXMLNodeFactory, &IID_IXMLNodeFactory>
-{
-
-public:
- EEConfigFactory(
- ConfigStringHashtable* pTable,
- LPCWSTR,
- ParseCtl parseCtl = parseAll);
- ~EEConfigFactory();
- HRESULT STDMETHODCALLTYPE NotifyEvent(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODEFACTORY_EVENT iEvt);
-
- HRESULT STDMETHODCALLTYPE BeginChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ XML_NODE_INFO* __RPC_FAR pNodeInfo);
-
- HRESULT STDMETHODCALLTYPE EndChildren(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ BOOL fEmptyNode,
- /* [in] */ XML_NODE_INFO* __RPC_FAR pNodeInfo);
-
- HRESULT STDMETHODCALLTYPE Error(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ HRESULT hrErrorCode,
- /* [in] */ USHORT cNumRecs,
- /* [in] */ XML_NODE_INFO* __RPC_FAR * __RPC_FAR apNodeInfo)
- {
- LIMITED_METHOD_CONTRACT;
- /*
- UNUSED(pSource);
- UNUSED(hrErrorCode);
- UNUSED(cNumRecs);
- UNUSED(apNodeInfo);
- */
- return hrErrorCode;
- }
-
- HRESULT STDMETHODCALLTYPE CreateNode(
- /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
- /* [in] */ PVOID pNodeParent,
- /* [in] */ USHORT cNumRecs,
- /* [in] */ XML_NODE_INFO* __RPC_FAR * __RPC_FAR apNodeInfo);
-
-private:
-
- HRESULT GrowKey(DWORD dwSize)
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- INJECT_FAULT(return E_OUTOFMEMORY);
- }
- CONTRACTL_END;
-
- if(dwSize > m_dwSize) {
- DeleteKey();
- m_pCurrentRuntimeElement = new(nothrow) WCHAR[dwSize];
- if(m_pCurrentRuntimeElement == NULL) return E_OUTOFMEMORY;
- m_dwSize = dwSize;
- }
- return S_OK;
- }
-
- void ClearKey()
- {
- LIMITED_METHOD_CONTRACT;
-
- *m_pCurrentRuntimeElement = 0;
- m_dwCurrentRuntimeElement = 0;
- }
-
- void DeleteKey()
- {
- WRAPPER_NO_CONTRACT;
- if(m_pCurrentRuntimeElement != NULL && m_pCurrentRuntimeElement != m_pBuffer)
- delete [] m_pCurrentRuntimeElement;
- m_dwSize = 0;
- m_dwCurrentRuntimeElement = 0;
- }
-
- HRESULT CopyToKey(__in_z LPCWSTR pString, DWORD dwString)
- {
- WRAPPER_NO_CONTRACT;
- dwString++; // add in the null
- HRESULT hr = GrowKey(dwString);
- if(FAILED(hr)) return hr;
- wcsncpy_s(m_pCurrentRuntimeElement, m_dwSize, pString, dwString-1);
-
- m_dwCurrentRuntimeElement = dwString;
- return S_OK;
- }
-
- HRESULT STDMETHODCALLTYPE AddKeyValuePair(
- __in_ecount(dwStringSize) WCHAR * pszString,
- /* [in] */ DWORD dwStringSize,
- __in_ecount(m_dwCurrentRuntimeElement) WCHAR * m_pCurrentRuntimeElement,
- /* [in] */ DWORD m_dwCurrentRuntimeElement);
-
- HRESULT CopyVersion(LPCWSTR version, DWORD dwVersion);
-
- ConfigStringHashtable* m_pTable;
- BOOL m_fUnderRuntimeElement;
- BOOL m_fOnEnabledAttribute;
- BOOL m_fOnValueAttribute;
- BOOL m_fVersionedRuntime;
- BOOL m_fDeveloperSettings;
-
- LPCWSTR m_pVersion;
- LPWSTR m_pCurrentRuntimeElement;
- DWORD m_dwCurrentRuntimeElement;
-
- WCHAR m_pBuffer[CONFIG_KEY_SIZE];
- DWORD m_dwSize;
-
- DWORD m_dwDepth;
-
- bool m_bSafeMode; // If true, will ignore any settings that may compromise security
- ParseCtl m_parseCtl; // usually parseAll, sometimes stopAfterRuntimeSection
-
- ReleaseHolder<IXMLNodeFactory> m_pActiveFactory; // hold a factory responsible for parsing subnode
-};
-
-#endif
diff --git a/src/vm/mda.cpp b/src/vm/mda.cpp
index 77c26a993e..bea222a0c6 100644
--- a/src/vm/mda.cpp
+++ b/src/vm/mda.cpp
@@ -5,7 +5,16 @@
#include "common.h"
#include "eeconfig.h"
-#include "eeconfigfactory.h"
+
+#include <xmlparser.h>
+#include <objbase.h>
+#include "unknwn.h"
+#include "../xmlparser/_reference.h"
+#include "../xmlparser/_unknown.h"
+#include "eehash.h"
+#include "eeconfig.h"
+
+#define CONFIG_KEY_SIZE 128
#include "corhlpr.h"
#include <xmlparser.h>
#include <mscorcfg.h>
diff --git a/src/vm/mda.h b/src/vm/mda.h
index b52bd00d42..c711e8ae7f 100644
--- a/src/vm/mda.h
+++ b/src/vm/mda.h
@@ -295,7 +295,6 @@ private:
friend class MdaXmlMessage;
friend class MdaXmlIndustry;
friend class MdaConfigFactory;
- friend class EEConfigFactory;
friend class MdaFramework;
friend void EEStartupHelper(COINITIEE fFlags);
diff --git a/src/vm/ngenoptout.cpp b/src/vm/ngenoptout.cpp
deleted file mode 100644
index 50b47782a9..0000000000
--- a/src/vm/ngenoptout.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// ngenoptout.cpp
-//
-
-//
-//
-// Contains functionality to reject native images at runtime
-
-
-#include "common.h"
diff --git a/src/vm/ngenoptout.h b/src/vm/ngenoptout.h
deleted file mode 100644
index dbcc9b1f90..0000000000
--- a/src/vm/ngenoptout.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// ngenoptout.h
-//
-
-//
-//
-// Contains functionality to reject native images at runtime
-
-
-#ifndef NGENOPTOUT_H
-#define NGENOPTOUT_H
-
-#include "assemblynamesconfigfactory.h"
-
-// throwing
-BOOL IsNativeImageOptedOut(IAssemblyName* pName);
-void AddNativeImageOptOut(IAssemblyName* pName);
-
-// HRESULT
-HRESULT RuntimeIsNativeImageOptedOut(IAssemblyName* pName);
-
-
-class NativeImageOptOutConfigFactory : public AssemblyNamesConfigFactory
-{
- virtual void AddAssemblyName(IAssemblyName* pName)
- {
- WRAPPER_NO_CONTRACT;
- AddNativeImageOptOut(pName);
- }
-};
-
-#endif // NGENOPTOUT_H