summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dlls/mscorpe/CMakeLists.txt4
-rw-r--r--src/dlls/mscorpe/Native.rc8
-rw-r--r--src/dlls/mscorpe/ceefilegenwritertokens.cpp3
-rw-r--r--src/dlls/mscorpe/mscorpe/mscorpe.def11
-rw-r--r--src/dlls/mscorpe/mscorpe/wrapper.cpp149
-rw-r--r--src/dlls/mscorpe/mscorpehost/mscorpehost.def12
-rw-r--r--src/dlls/mscorpe/utilcodeinit.cpp11
-rw-r--r--src/ilasm/MscorpeSxS.cpp23
-rw-r--r--src/ilasm/MscorpeSxS.h20
-rw-r--r--src/ilasm/assem.cpp22
-rw-r--r--src/inc/ceegen.h3
-rw-r--r--src/inc/iceefilegen.h17
-rw-r--r--src/inc/mscorpesxswrapper.h125
-rw-r--r--src/vm/dllimport.cpp56
-rw-r--r--src/vm/reflectclasswriter.cpp125
15 files changed, 9 insertions, 580 deletions
diff --git a/src/dlls/mscorpe/CMakeLists.txt b/src/dlls/mscorpe/CMakeLists.txt
index e8f22f2e9b..fd884b1c46 100644
--- a/src/dlls/mscorpe/CMakeLists.txt
+++ b/src/dlls/mscorpe/CMakeLists.txt
@@ -7,13 +7,9 @@ set(MSCORPE_SOURCES
ceefilegenwriter.cpp
pewriter.cpp
ceefilegenwritertokens.cpp
- utilcodeinit.cpp
)
if(WIN32)
- list(APPEND MSCORPE_SOURCES
- Native.rc
- )
else()
add_compile_options(-Wno-delete-non-virtual-dtor)
endif(WIN32)
diff --git a/src/dlls/mscorpe/Native.rc b/src/dlls/mscorpe/Native.rc
deleted file mode 100644
index e652bf3f1d..0000000000
--- a/src/dlls/mscorpe/Native.rc
+++ /dev/null
@@ -1,8 +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.
-
-#define FX_VER_FILEDESCRIPTION_STR "Microsoft .NET Runtime PE File Generator\0"
-
-#include <fxver.h>
-#include <fxver.rc>
diff --git a/src/dlls/mscorpe/ceefilegenwritertokens.cpp b/src/dlls/mscorpe/ceefilegenwritertokens.cpp
index e2d448552d..3503eaf67b 100644
--- a/src/dlls/mscorpe/ceefilegenwritertokens.cpp
+++ b/src/dlls/mscorpe/ceefilegenwritertokens.cpp
@@ -10,9 +10,6 @@
//*****************************************************************************
#include "stdafx.h"
#include "ceegen.h"
-#ifndef FEATURE_CORECLR
-#define DECLARE_DATA
-#endif
#include "../../ildasm/dasmenum.hpp"
#define MAX_CLASSNAME_LENGTH 1024
diff --git a/src/dlls/mscorpe/mscorpe/mscorpe.def b/src/dlls/mscorpe/mscorpe/mscorpe.def
deleted file mode 100644
index 875abc42a7..0000000000
--- a/src/dlls/mscorpe/mscorpe/mscorpe.def
+++ /dev/null
@@ -1,11 +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.
-;
-; mscorpe.def for mscorpe.dll (a simple wrapper around real implementation mscorpehost.dll - see
-; file:wrapper.cpp for more details)
-; PE file generator in EE
-
-EXPORTS
- CreateICeeFileGen
- DestroyICeeFileGen
diff --git a/src/dlls/mscorpe/mscorpe/wrapper.cpp b/src/dlls/mscorpe/mscorpe/wrapper.cpp
deleted file mode 100644
index d2f1701ec4..0000000000
--- a/src/dlls/mscorpe/mscorpe/wrapper.cpp
+++ /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.
-//
-// File: wrapper.cpp
-//
-
-//
-// This file implements a simple wrapper DLL (mscorpe.dll) which calls properly into mscorpehost.dll.
-// It exists because of compatibility with 1.x/2.0 apps running on CLR 4.0+. Such older apps could pass
-// full path to LoadLibrary() Windows API and get this DLL.
-//
-// Noone in CLR should ever try to load this DLL directly (using LoadLibrary API). Note that hosting APIs
-// and PInvoke redirect mscorpe.dll to mscorpehost.dll automatically.
-//
-
-#include <MscorpeSxSWrapper.h>
-
-#include <mscoree.h>
-#include <metahost.h>
-
-// Globals
-HINSTANCE g_hThisInst; // This library.
-
-//*****************************************************************************
-// Handle lifetime of loaded library.
-//*****************************************************************************
-extern "C"
-BOOL WINAPI
-DllMain(
- HINSTANCE hInstance,
- DWORD dwReason,
- LPVOID lpReserved)
-{
- switch (dwReason)
- {
- case DLL_PROCESS_ATTACH:
- { // Save the module handle.
- g_hThisInst = hInstance;
- DisableThreadLibraryCalls((HMODULE)hInstance);
- }
- break;
- case DLL_PROCESS_DETACH:
- break;
- }
-
- return TRUE;
-} // DllMain
-
-// Implementation for utilcode
-HINSTANCE
-GetModuleInst()
-{
- return g_hThisInst;
-} // GetModuleInst
-
-// Load correct SxS version of mscorpe.dll and initialize it (uses shim).
-HRESULT
-LoadMscorpe(HMODULE * phModule)
-{
- HRESULT hr = S_OK;
- ICLRMetaHost * pMetaHost = NULL;
- ICLRRuntimeInfo * pCLRRuntimeInfo = NULL;
-
- // Get full DLL path
- WCHAR wszPath[_MAX_PATH];
- DWORD dwLength = GetModuleFileName((HMODULE)g_hThisInst, wszPath, NumItems(wszPath));
-
- if ((dwLength == 0) ||
- ((dwLength == NumItems(wszPath)) &&
- (GetLastError() == ERROR_INSUFFICIENT_BUFFER)))
- {
- IfFailGo(CLR_E_SHIM_RUNTIMELOAD);
- }
-
- // Find start of '\mscorpe.dll'
- LPWSTR wszSeparator = wcsrchr(wszPath, L'\\');
- if (wszSeparator == NULL)
- {
- IfFailGo(CLR_E_SHIM_RUNTIMELOAD);
- }
- // Check the name of this DLL
- _ASSERTE(_wcsicmp(wszSeparator, L"\\mscorpe.dll") == 0);
- // Remove the DLL name
- *wszSeparator = 0;
-
- // Find start of last directory name (\<version>),
- // C:\Windows\Microsoft.NET\Framework\[[v4.0.12345]]\mscorpe.dll
- LPWSTR wszLastDirectoryName = wcsrchr(wszPath, L'\\');
- if (wszLastDirectoryName == NULL)
- {
- IfFailGo(CLR_E_SHIM_RUNTIMELOAD);
- }
- LPWSTR wszVersion = wszLastDirectoryName + 1;
-
- IfFailGo(CLRCreateInstance(
- CLSID_CLRMetaHost,
- IID_ICLRMetaHost,
- reinterpret_cast<LPVOID *>(&pMetaHost)));
-
- IfFailGo(pMetaHost->GetRuntime(
- wszVersion,
- IID_ICLRRuntimeInfo,
- reinterpret_cast<LPVOID *>(&pCLRRuntimeInfo)));
-
- // Shim will load correct SxS version of mscorpe.dll and will initialize it
- IfFailGo(pCLRRuntimeInfo->LoadLibrary(
- L"mscorpe.dll",
- phModule));
-
-ErrExit:
- if (pMetaHost != NULL)
- {
- pMetaHost->Release();
- pMetaHost = NULL;
- }
- if (pCLRRuntimeInfo != NULL)
- {
- pCLRRuntimeInfo->Release();
- pCLRRuntimeInfo = NULL;
- }
-
- if (FAILED(hr))
- {
- *phModule = NULL;
- }
-
- return hr;
-} // LoadMscorpe
-
-// SxS wrapper of mscorpe.dll entrypoints
-typedef MscorpeSxSWrapper<LoadMscorpe> MscorpeSxS;
-
-// Export of 'original' 1.x/2.0 mscorpe.dll
-EXTERN_C
-HRESULT __stdcall
-CreateICeeFileGen(
- ICeeFileGen ** ppCeeFileGen)
-{
- return MscorpeSxS::CreateICeeFileGen(ppCeeFileGen);
-}
-
-// Export of 'original' 1.x/2.0 mscorpe.dll
-EXTERN_C
-HRESULT __stdcall
-DestroyICeeFileGen(ICeeFileGen ** ppCeeFileGen)
-{
- return MscorpeSxS::DestroyICeeFileGen(ppCeeFileGen);
-}
diff --git a/src/dlls/mscorpe/mscorpehost/mscorpehost.def b/src/dlls/mscorpe/mscorpehost/mscorpehost.def
deleted file mode 100644
index 0cf870b17b..0000000000
--- a/src/dlls/mscorpe/mscorpehost/mscorpehost.def
+++ /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.
-;
-; PeWriter.def for PeWriter.dll
-; PE file generator in EE
-
-EXPORTS
- CreateICeeFileGen
- DestroyICeeFileGen
- InitializeSxS
-
diff --git a/src/dlls/mscorpe/utilcodeinit.cpp b/src/dlls/mscorpe/utilcodeinit.cpp
deleted file mode 100644
index 0e9fab9860..0000000000
--- a/src/dlls/mscorpe/utilcodeinit.cpp
+++ /dev/null
@@ -1,11 +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.
-
-#include "stdafx.h"
-#include <utilcode.h>
-
-EXTERN_C void __stdcall InitializeSxS(CoreClrCallbacks const & callbacks)
-{
- InitUtilcode(callbacks);
-}
diff --git a/src/ilasm/MscorpeSxS.cpp b/src/ilasm/MscorpeSxS.cpp
deleted file mode 100644
index b3b94f466b..0000000000
--- a/src/ilasm/MscorpeSxS.cpp
+++ /dev/null
@@ -1,23 +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.
-//
-// File: MscorpeSxS.cpp
-//
-
-//
-// This file defines a wrapper for SxS version of mscorpe.dll (dynamically loaded via shim).
-//
-#include "ilasmpch.h"
-
-#include "MscorpeSxS.h"
-
-#include <LegacyActivationShim.h>
-
-// Loads mscorpe.dll (uses shim)
-HRESULT
-LoadMscorpeDll(HMODULE * phModule)
-{
- // Load SxS version of mscorpe.dll (i.e. mscorpehost.dll) and initialize it
- return LegacyActivationShim::LoadLibraryShim(L"mscorpe.dll", NULL, NULL, phModule);
-}
diff --git a/src/ilasm/MscorpeSxS.h b/src/ilasm/MscorpeSxS.h
deleted file mode 100644
index 8cee9c49cd..0000000000
--- a/src/ilasm/MscorpeSxS.h
+++ /dev/null
@@ -1,20 +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.
-//
-// File: MscorpeSxS.h
-//
-
-//
-// This file defines a wrapper for SxS version of mscorpe.dll (dynamically loaded via shim).
-//
-
-#pragma once
-
-#include <MscorpeSxSWrapper.h>
-
-// Loads mscorpe.dll (uses shim)
-HRESULT LoadMscorpeDll(HMODULE * phModule);
-
-// Wrapper for mscorpe.dll calls
-typedef MscorpeSxSWrapper<LoadMscorpeDll> MscorpeSxS;
diff --git a/src/ilasm/assem.cpp b/src/ilasm/assem.cpp
index 8c56bdc047..18247621f9 100644
--- a/src/ilasm/assem.cpp
+++ b/src/ilasm/assem.cpp
@@ -15,15 +15,11 @@
#define DECLARE_DATA
#include "assembler.h"
-#ifdef FEATURE_CORECLR
#ifdef FEATURE_PAL
#include "coreclrloader.h"
CoreCLRLoader *g_loader;
#endif // FEATURE_PAL
MetaDataGetDispenserFunc metaDataGetDispenser;
-#else
-#include "MscorpeSxS.h"
-#endif // FEATURE_CORECLR
void indexKeywords(Indx* indx); // defined in asmparse.y
@@ -197,11 +193,9 @@ Assembler::~Assembler()
if (m_pCeeFileGen != NULL) {
if (m_pCeeFile)
m_pCeeFileGen->DestroyCeeFile(&m_pCeeFile);
-#ifdef FEATURE_CORECLR
+
DestroyICeeFileGen(&m_pCeeFileGen);
-#else
- MscorpeSxS::DestroyICeeFileGen(&m_pCeeFileGen);
-#endif
+
m_pCeeFileGen = NULL;
}
@@ -276,18 +270,14 @@ BOOL Assembler::Init()
if (m_pCeeFileGen != NULL) {
if (m_pCeeFile)
m_pCeeFileGen->DestroyCeeFile(&m_pCeeFile);
-#ifdef FEATURE_CORECLR
+
DestroyICeeFileGen(&m_pCeeFileGen);
-#else
- MscorpeSxS::DestroyICeeFileGen(&m_pCeeFileGen);
-#endif
+
m_pCeeFileGen = NULL;
}
-#ifdef FEATURE_CORECLR
+
if (FAILED(CreateICeeFileGen(&m_pCeeFileGen))) return FALSE;
-#else
- if (FAILED(MscorpeSxS::CreateICeeFileGen(&m_pCeeFileGen))) return FALSE;
-#endif
+
if (FAILED(m_pCeeFileGen->CreateCeeFileEx(&m_pCeeFile,(ULONG)m_dwCeeFileFlags))) return FALSE;
if (FAILED(m_pCeeFileGen->GetSectionCreate(m_pCeeFile, ".il", sdReadOnly, &m_pILSection))) return FALSE;
diff --git a/src/inc/ceegen.h b/src/inc/ceegen.h
index a2dfadfc00..c7d2af2615 100644
--- a/src/inc/ceegen.h
+++ b/src/inc/ceegen.h
@@ -45,9 +45,6 @@ typedef DWORD StringRef;
Has a bunch of methods to emit signatures, tokens, methods,
etc which are not implemented. These are left over from before
- CeeFileGenWriter, PEWriter and ICeeFileGen are implemented in mscorpe.dll.
- The other types live in mscorwks.dll (src\md\CeeFileGen)
-
+----------------------------+
| ICeeGen |
| |
diff --git a/src/inc/iceefilegen.h b/src/inc/iceefilegen.h
index 58c1ebc249..c33a7b12ee 100644
--- a/src/inc/iceefilegen.h
+++ b/src/inc/iceefilegen.h
@@ -10,8 +10,6 @@
** This will typically be used by compilers to generate their compiled **
** output executable. **
** **
- ** The implemenation lives in mscorpe.dll **
- ** **
*****************************************************************************/
/*
@@ -27,15 +25,8 @@
ICLRRuntimeInfo * pCLRRuntimeInfo;
pMetaHost->GetRuntime(wszClrVersion, IID_ICLRRuntimeInfo, &pCLRRuntimeInfo);
- // Step #2 ... Load mscorpe.dll and get its entrypoints
- HMODULE hModule;
- pCLRRuntimeInfo->LoadLibrary(L"mscorpe.dll", &hModule);
-
- PFN_CreateICeeFileGen pfnCreateICeeFileGen = (PFN_CreateICeeFileGen)::GetProcAddress("CreateICeeFileGen"); // Windows API
- PFN_DestroyICeeFileGen pfnDestroyICeeFileGen = (PFN_DestroyICeeFileGen)::GetProcAddress("DestroyICeeFileGen"); // Windows API
-
- // Step #3 ... Use mscorpe.dll APIs
- pfnCreateICeeFileGen(...); // Get a ICeeFileGen
+ // Step #2 ... use mscorpe APIs to create a file generator
+ CreateICeeFileGen(...); // Get a ICeeFileGen
CreateCeeFile(...); // Get a HCEEFILE (called for every output file needed)
SetOutputFileName(...); // Set the name for the output file
@@ -44,7 +35,7 @@
EmitMetaDataEx(pEmit); // Write out the metadata
GenerateCeeFile(...); // Write out the file. Implicitly calls LinkCeeFile and FixupCeeFile
- pfnDestroyICeeFileGen(...); // Release the ICeeFileGen object
+ DestroyICeeFileGen(...); // Release the ICeeFileGen object
*/
@@ -58,10 +49,8 @@ class ICeeFileGen;
typedef void *HCEEFILE;
-#ifdef FEATURE_CORECLR
EXTERN_C HRESULT __stdcall CreateICeeFileGen(ICeeFileGen** pCeeFileGen);
EXTERN_C HRESULT __stdcall DestroyICeeFileGen(ICeeFileGen ** ppCeeFileGen);
-#endif
typedef HRESULT (__stdcall * PFN_CreateICeeFileGen)(ICeeFileGen ** ceeFileGen); // call this to instantiate an ICeeFileGen interface
typedef HRESULT (__stdcall * PFN_DestroyICeeFileGen)(ICeeFileGen ** ceeFileGen); // call this to delete an ICeeFileGen
diff --git a/src/inc/mscorpesxswrapper.h b/src/inc/mscorpesxswrapper.h
deleted file mode 100644
index 52656f6711..0000000000
--- a/src/inc/mscorpesxswrapper.h
+++ /dev/null
@@ -1,125 +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.
-//
-// File: MscorpeSxSWrapper.h
-//
-
-//
-// This file defines a wrapper for SxS version of mscorpe.dll (dynamically loaded via shim).
-//
-
-#pragma once
-
-#include "utilcode.h"
-
-#include "iceefilegen.h"
-
-//
-// Wrapper for calls into mscorpehost.dll (SxS version of mscorpe.dll).
-// Template parameter will load the DLL as it is required in the context.
-//
-// Note that _LoadMscorpeDll method can be called more than once and in parallel from more threads if race
-// happens.
-//
-template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
-class MscorpeSxSWrapper
-{
-private:
- // mscorpehost.dll module, if not NULL, entry points are already initialized
- static Volatile<HMODULE> s_hModule;
- // mscorpehost.dll entry points
- static Volatile<PFN_CreateICeeFileGen> s_pfnCreateICeeFileGen;
- static Volatile<PFN_DestroyICeeFileGen> s_pfnDestroyICeeFileGen;
-
- // Loads the DLL and sets all statics
- static HRESULT Init();
-
-public:
-
- // Wrapper of file:ICeeFileGen.cpp#CreateICeeFileGen from mscorpehost.dll
- static HRESULT CreateICeeFileGen(ICeeFileGen ** ppCeeFileGen)
- {
- HRESULT hr = S_OK;
- IfFailGo(Init());
- hr = s_pfnCreateICeeFileGen(ppCeeFileGen);
- ErrExit:
- return hr;
- }
-
- // Wrapper of file:ICeeFileGen.cpp#DestroyICeeFileGen from mscorpehost.dll
- static HRESULT DestroyICeeFileGen(ICeeFileGen ** ppCeeFileGen)
- {
- HRESULT hr = S_OK;
- IfFailGo(Init());
- hr = s_pfnDestroyICeeFileGen(ppCeeFileGen);
- ErrExit:
- return hr;
- }
-
-#ifdef _DEBUG
- // Returns TRUE if the DLL has been already loaded
- static BOOL Debug_IsLoaded()
- {
- return (s_hModule != (HMODULE)NULL);
- }
-#endif //_DEBUG
-}; // class MscorpeSxS
-
-template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
-// code:MscorpeSxS statics initialization
-Volatile<HMODULE> MscorpeSxSWrapper<_LoadMscorpeDll>::s_hModule = NULL;
-
-template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
-Volatile<PFN_CreateICeeFileGen> MscorpeSxSWrapper<_LoadMscorpeDll>::s_pfnCreateICeeFileGen = NULL;
-
-template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
-Volatile<PFN_DestroyICeeFileGen> MscorpeSxSWrapper<_LoadMscorpeDll>::s_pfnDestroyICeeFileGen = NULL;
-
-// Loads the DLL and sets all statics
-//static
-template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
-HRESULT
-MscorpeSxSWrapper<_LoadMscorpeDll>::Init()
-{
- HRESULT hr = S_OK;
-
- if (s_hModule != (HMODULE)NULL)
- {
- return S_OK;
- }
-
- // Local mscorpehost.dll module
- HMODULE hModule = NULL;
- // Local mscorpehost.dll entry points
- PFN_CreateICeeFileGen pfnCreateICeeFileGen = NULL;
- PFN_DestroyICeeFileGen pfnDestroyICeeFileGen = NULL;
-
- // Load mscorpehost.dll and initialize it
- IfFailGo(_LoadMscorpeDll(&hModule));
- _ASSERTE(hModule != NULL);
-
- pfnCreateICeeFileGen = (PFN_CreateICeeFileGen)GetProcAddress(hModule, "CreateICeeFileGen");
- if (pfnCreateICeeFileGen == NULL)
- {
- IfFailGo(COR_E_EXECUTIONENGINE);
- }
-
- pfnDestroyICeeFileGen = (PFN_DestroyICeeFileGen)GetProcAddress(hModule, "DestroyICeeFileGen");
- if (pfnDestroyICeeFileGen == NULL)
- {
- IfFailGo(COR_E_EXECUTIONENGINE);
- }
-
-ErrExit:
- if (SUCCEEDED(hr))
- {
- // First publish mscorpehost.dll entry points
- s_pfnCreateICeeFileGen = pfnCreateICeeFileGen;
- s_pfnDestroyICeeFileGen = pfnDestroyICeeFileGen;
- // Then we can publish/initialize the mscorpehost.dll module
- s_hModule = hModule;
- }
-
- return hr;
-} // MscorpeSxSWrapper::Init
diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp
index a3f7f30d86..b7989e92bc 100644
--- a/src/vm/dllimport.cpp
+++ b/src/vm/dllimport.cpp
@@ -7010,62 +7010,6 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke
hmod = CheckForWellKnownModules(wszLibName, pErrorTracker);
#endif
-#ifndef FEATURE_CORECLR
- // Since fusion.dll has been incorporated into mscorwks.dll, we need to redirect
- // any PInvokes for fusion.dll over to this runtime module. In order to avoid picking
- // up invalid versions of fusion.dll, we perform this redirection first. Also redirect
- // PInvokes to mscorwks.dll and clr.dll to this runtime module (module rename back
- // compat and in-proc SxS correctness).
- if (hmod == NULL)
- {
- static LPCWSTR const rwszAliases[] =
- {
- W("fusion.dll"), W("mscorwks.dll"), W("clr.dll"),
- W("fusion"), W("mscorwks"), W("clr")
- };
-
- for (int i = 0; i < COUNTOF(rwszAliases); i++)
- {
- if (SString::_wcsicmp(wszLibName, rwszAliases[i]) == 0)
- {
- hmod = GetCLRModule();
- break;
- }
- }
- }
- // Some CLR DLLs cannot be directly PInvoked. They need in-proc SxS intialization - shim
- // (mscoreei.dll) takes care of that. Load such DLLs via shim.
- //
- // Note that we do not support PInvoking into the newly renamed SxS versions of DLLs directly.
- // For example mscorpe.dll functionality was moved to mscorpehost.dll in 4.0. When asked for
- // loading mscorpe.dll, shim will load mscorpehost.dll and will call its InitializeSxS function
- // first. However shim will not call InitializeSxS when asked for mscorpehost.dll directly.
- // As a result users cannot use mscorpehost.dll directly for PInvokes (by design), they can only
- // use the old mscorpe.dll name.
- if (hmod == NULL)
- {
- static LPCWSTR const rgSxSAwareDlls[] =
- {
- W("mscorpe.dll"), W("mscorpe")
- };
-
- for (int i = 0; i < COUNTOF(rgSxSAwareDlls); i++)
- {
- if (SString::_wcsicmp(wszLibName, rgSxSAwareDlls[i]) == 0)
- {
- // Load the DLL using shim (shim takes care of the DLL SxS initialization)
- HRESULT hr = g_pCLRRuntime->LoadLibrary(rgSxSAwareDlls[i], &hmod);
- if (FAILED(hr))
- { // We failed to load CLR DLL (probably corrupted installation)
- pErrorTracker->TrackHR_CouldNotLoad(hr);
- hmod = NULL;
- }
- break;
- }
- }
- }
-#endif //!FEATURE_CORECLR
-
#ifdef FEATURE_PAL
// In the PAL version of CoreCLR, the CLR module itself exports the functionality
// that the Windows version obtains from kernel32 and friends. In order to avoid
diff --git a/src/vm/reflectclasswriter.cpp b/src/vm/reflectclasswriter.cpp
index 09f6589fed..093d5f7d9c 100644
--- a/src/vm/reflectclasswriter.cpp
+++ b/src/vm/reflectclasswriter.cpp
@@ -119,129 +119,4 @@ RefClassWriter::~RefClassWriter()
m_pOnDiskEmitter->Release();
m_pOnDiskEmitter = NULL;
}
-
-
-#ifndef FEATURE_CORECLR
- DestroyCeeFileGen();
-#endif // FEATURE_CORECLR
-}
-
-#ifndef FEATURE_CORECLR
-
-#include <MscorpeSxSWrapper.h>
-
-// Loads mscorpe.dll (uses shim hosting API)
-HRESULT
-LoadMscorpeDll(HMODULE * phModule)
-{
- // Load SxS version of mscorpe.dll (i.e. mscorpehost.dll) and initialize it
- return g_pCLRRuntime->LoadLibrary(W("mscorpe.dll"), phModule);
}
-
-// Wrapper for mscorpe.dll calls
-typedef MscorpeSxSWrapper<LoadMscorpeDll> MscorpeSxS;
-
-//******************************************************
-//*
-//* Make sure that CeeFileGen for this module is created for emitting to disk
-//*
-//******************************************************
-HRESULT
-RefClassWriter::EnsureCeeFileGenCreated(
- DWORD corhFlags,
- DWORD peFlags)
-{
- CONTRACT(HRESULT) {
- NOTHROW;
- GC_TRIGGERS;
- // we know that the com implementation is ours so we use mode-any to simplify
- // having to switch mode
- MODE_ANY;
- INJECT_FAULT(CONTRACT_RETURN(E_OUTOFMEMORY));
-
- POSTCONDITION(SUCCEEDED(RETVAL) ? CheckPointer(m_pCeeFileGen) : (int)(m_pCeeFileGen == NULL));
- POSTCONDITION(SUCCEEDED(RETVAL) ? CheckPointer(m_ceeFile) : (int)(m_pCeeFileGen == NULL));
- }
- CONTRACT_END;
-
- HRESULT hr = NOERROR;
-
- if (m_pCeeFileGen == NULL)
- {
- EX_TRY
- {
- IfFailGo(MscorpeSxS::CreateICeeFileGen(&m_pCeeFileGen));
-
- IfFailGo(m_pCeeFileGen->CreateCeeFileFromICeeGen(m_pCeeGen, &m_ceeFile, peFlags));
-
- IfFailGo(m_pCeeFileGen->ClearComImageFlags(m_ceeFile, COMIMAGE_FLAGS_ILONLY));
-
- IfFailGo(m_pCeeFileGen->SetComImageFlags(m_ceeFile, corhFlags));
- ErrExit:
- ;
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- if (FAILED(hr))
- {
- DestroyCeeFileGen();
- }
- }
-
- RETURN(hr);
-} // RefClassWriter::EnsureCeeFileGenCreated
-
-
-//******************************************************
-//*
-//* Destroy the instance of CeeFileGen that we created
-//*
-//******************************************************
-HRESULT RefClassWriter::DestroyCeeFileGen()
-{
- CONTRACT(HRESULT) {
- NOTHROW;
- GC_TRIGGERS;
- // we know that the com implementation is ours so we use mode-any to simplify
- // having to switch mode
- MODE_ANY;
- FORBID_FAULT;
-
- POSTCONDITION(m_pCeeFileGen == NULL);
- POSTCONDITION(m_ceeFile == NULL);
- }
- CONTRACT_END;
-
- HRESULT hr = NOERROR;
-
- if (m_pCeeFileGen != NULL)
- {
- //Cleanup the HCEEFILE.
- if (m_ceeFile != NULL)
- {
- hr = m_pCeeFileGen->DestroyCeeFile(&m_ceeFile);
- _ASSERTE_MSG(SUCCEEDED(hr), "Destory CeeFile");
- m_ceeFile = NULL;
- }
-
- //Cleanup the ICeeFileGen.
- {
- CONTRACT_VIOLATION(ThrowsViolation);
-
- // code:EnsureCeeFileGenCreated already loaded the DLL
- _ASSERTE(MscorpeSxS::Debug_IsLoaded());
-
- hr = MscorpeSxS::DestroyICeeFileGen(&m_pCeeFileGen);
- }
- _ASSERTE_MSG(SUCCEEDED(hr), "Destroy ICeeFileGen");
- m_pCeeFileGen = NULL;
- }
-
- RETURN(hr);
-} // RefClassWriter::DestroyCeeFileGen
-
-#endif //!FEATURE_CORECLR