From 8c2db15331291324573d752fb3b6a3a9dae73b31 Mon Sep 17 00:00:00 2001 From: mikedn Date: Mon, 16 Jan 2017 06:49:18 +0200 Subject: Remove mscorpe cruft (#8957) --- src/dlls/mscorpe/CMakeLists.txt | 4 - src/dlls/mscorpe/Native.rc | 8 -- src/dlls/mscorpe/ceefilegenwritertokens.cpp | 3 - src/dlls/mscorpe/mscorpe/mscorpe.def | 11 -- src/dlls/mscorpe/mscorpe/wrapper.cpp | 149 --------------------------- src/dlls/mscorpe/mscorpehost/mscorpehost.def | 12 --- src/dlls/mscorpe/utilcodeinit.cpp | 11 -- 7 files changed, 198 deletions(-) delete mode 100644 src/dlls/mscorpe/Native.rc delete mode 100644 src/dlls/mscorpe/mscorpe/mscorpe.def delete mode 100644 src/dlls/mscorpe/mscorpe/wrapper.cpp delete mode 100644 src/dlls/mscorpe/mscorpehost/mscorpehost.def delete mode 100644 src/dlls/mscorpe/utilcodeinit.cpp (limited to 'src/dlls/mscorpe') 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 -#include 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 - -#include -#include - -// 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 (\), - // 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(&pMetaHost))); - - IfFailGo(pMetaHost->GetRuntime( - wszVersion, - IID_ICLRRuntimeInfo, - reinterpret_cast(&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 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 - -EXTERN_C void __stdcall InitializeSxS(CoreClrCallbacks const & callbacks) -{ - InitUtilcode(callbacks); -} -- cgit v1.2.3