Browse Source

CoreCLR initializing under Windows

JoshEngebretson 10 years ago
parent
commit
50614154a3

+ 1 - 1
CMake/Modules/AtomicWindows.cmake

@@ -13,7 +13,7 @@ else()
     set (D3DCOMPILER_47_DLL ${CMAKE_SOURCE_DIR}/Build/Windows/Binaries/x86/D3DCompiler_47.dll)
     set (D3DCOMPILER_47_DLL ${CMAKE_SOURCE_DIR}/Build/Windows/Binaries/x86/D3DCompiler_47.dll)
 endif()
 endif()
 
 
-add_definitions(-DATOMIC_PLATFORM_WINDOWS -D_CRT_SECURE_NO_WARNINGS -DATOMIC_TBUI)
+add_definitions(-DATOMIC_PLATFORM_WINDOWS -D_CRT_SECURE_NO_WARNINGS -DATOMIC_TBUI -DATOMIC_DOTNET)
 
 
 list (APPEND ATOMIC_LINK_LIBRARIES MojoShader user32 gdi32 winmm imm32 ole32 oleaut32 version uuid Ws2_32)
 list (APPEND ATOMIC_LINK_LIBRARIES MojoShader user32 gdi32 winmm imm32 ole32 oleaut32 version uuid Ws2_32)
 
 

+ 2 - 0
CMakeLists.txt

@@ -11,6 +11,8 @@ add_definitions(-DATOMIC_ROOT_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -DATOMIC_ROOT_BUI
 
 
 add_definitions( -DATOMIC_API= -DATOMIC_STATIC_DEFINE -DATOMIC_ATOMIC2D -DATOMIC_LOGGING -DATOMIC_PROFILING)
 add_definitions( -DATOMIC_API= -DATOMIC_STATIC_DEFINE -DATOMIC_ATOMIC2D -DATOMIC_LOGGING -DATOMIC_PROFILING)
 
 
+add_definitions( -DPOCO_STATIC )
+
 if (NOT DEFINED ATOMIC_DEV_BUILD)
 if (NOT DEFINED ATOMIC_DEV_BUILD)
     set(ATOMIC_DEV_BUILD 1)
     set(ATOMIC_DEV_BUILD 1)
 ENDIF()
 ENDIF()

+ 1 - 1
Source/Atomic/Atomic3D/BillboardSet.h

@@ -35,7 +35,7 @@ class IndexBuffer;
 class VertexBuffer;
 class VertexBuffer;
 
 
 /// One billboard in the billboard set.
 /// One billboard in the billboard set.
-struct ATOMIC_API Billboard : public RefCounted
+class ATOMIC_API Billboard : public RefCounted
 {
 {
     friend class BillboardSet;
     friend class BillboardSet;
     friend class ParticleEmitter;
     friend class ParticleEmitter;

+ 8 - 1
Source/AtomicEditor/Application/AEEditorCommon.cpp

@@ -73,7 +73,14 @@ void AEEditorCommon::Setup()
     SharedPtr<NETCore> netCore (new NETCore(context_));
     SharedPtr<NETCore> netCore (new NETCore(context_));
     context_->RegisterSubsystem(netCore);
     context_->RegisterSubsystem(netCore);
     String netCoreErrorMsg;
     String netCoreErrorMsg;
-    if (!netCore->Initialize("/Users/josh/Desktop/OSX.x64.Debug/", netCoreErrorMsg))
+
+#ifdef ATOMIC_PLATFORM_WINDOWS
+    String coreCLRAbsPath = "C:/Dev/coreclr/x64/";
+#else
+    String coreCLRAbsPath = "/Users/josh/Desktop/OSX.x64.Debug/";
+#endif
+
+    if (!netCore->Initialize(coreCLRAbsPath, netCoreErrorMsg))
     {
     {
         LOGERRORF("NetCore: Unable to initialize! %s", netCoreErrorMsg.CString());
         LOGERRORF("NetCore: Unable to initialize! %s", netCoreErrorMsg.CString());
         context_->RemoveSubsystem(NETCore::GetTypeStatic());
         context_->RemoveSubsystem(NETCore::GetTypeStatic());

+ 1 - 1
Source/AtomicEditor/CMakeLists.txt

@@ -88,7 +88,7 @@ elseif(LINUX)
         WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
         WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
     endif()
     endif()
 else()
 else()
-    target_link_libraries(AtomicEditor libcurl Iphlpapi Wldap32)
+    target_link_libraries(AtomicEditor NETCore libcurl Iphlpapi Wldap32)
 
 
     # compile the editor scripts
     # compile the editor scripts
     add_custom_command (TARGET AtomicEditor POST_BUILD
     add_custom_command (TARGET AtomicEditor POST_BUILD

+ 3 - 1
Source/AtomicNET/NETCore/CMakeLists.txt

@@ -4,10 +4,12 @@ include_directories (${CMAKE_SOURCE_DIR}/Source/ThirdParty/rapidjson/include
                      ${CMAKE_SOURCE_DIR}/Source/ThirdParty/Assimp/include
                      ${CMAKE_SOURCE_DIR}/Source/ThirdParty/Assimp/include
                      ${CMAKE_SOURCE_DIR}/Source/ThirdParty/nativefiledialog)
                      ${CMAKE_SOURCE_DIR}/Source/ThirdParty/nativefiledialog)
 
 
-file (GLOB_RECURSE SOURCE_FILES *.cpp *.h)
+file (GLOB SOURCE_FILES *.cpp *.h)
 
 
 if (APPLE)
 if (APPLE)
     file (GLOB_RECURSE PLATFORM_SOURCE_FILES Platforms/Unix/*.cpp Platforms/Unix/*.h)
     file (GLOB_RECURSE PLATFORM_SOURCE_FILES Platforms/Unix/*.cpp Platforms/Unix/*.h)
+elseif(MSVC)
+    file (GLOB_RECURSE PLATFORM_SOURCE_FILES Platforms/Windows/*.cpp Platforms/Windows/*.h)
 endif()
 endif()
 
 
 add_library(NETCore ${SOURCE_FILES} ${PLATFORM_SOURCE_FILES})
 add_library(NETCore ${SOURCE_FILES} ${PLATFORM_SOURCE_FILES})

+ 21 - 3
Source/AtomicNET/NETCore/NETCore.cpp

@@ -12,6 +12,11 @@
 #include "NETManaged.h"
 #include "NETManaged.h"
 #include "NETAssemblyFile.h"
 #include "NETAssemblyFile.h"
 
 
+#ifdef ATOMIC_PLATFORM_WINDOWS
+#include "Platforms/Windows/NETHostWindows.h"
+#else
+#endif
+
 namespace Atomic
 namespace Atomic
 {
 {
 
 
@@ -24,6 +29,8 @@ export PAL_DBG_CHANNELS="+all.all"
 
 
 #ifdef ATOMIC_PLATFORM_OSX
 #ifdef ATOMIC_PLATFORM_OSX
 static const char * const sCoreClrDll = "libcoreclr.dylib";
 static const char * const sCoreClrDll = "libcoreclr.dylib";
+#elif ATOMIC_PLATFORM_WINDOWS
+static const char * const sCoreClrDll = "coreclr.dll";
 #else
 #else
 static const char * const sCoreClrDll = "libcoreclr.so";
 static const char * const sCoreClrDll = "libcoreclr.so";
 #endif
 #endif
@@ -202,7 +209,7 @@ extern "C"
 
 
 int csb_Atomic_Test(unsigned id)
 int csb_Atomic_Test(unsigned id)
 {
 {
-  printf("Flibberty Gibbets %u", id);
+  //printf("Flibberty Gibbets %u", id);
   return id;
   return id;
 }
 }
 
 
@@ -257,6 +264,15 @@ bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
 {
 {
     coreCLRFilesAbsPath_ = AddTrailingSlash(coreCLRFilesAbsPath);
     coreCLRFilesAbsPath_ = AddTrailingSlash(coreCLRFilesAbsPath);
 
 
+#ifdef ATOMIC_PLATFORM_WINDOWS
+    netHost_ = new NETHostWindows(context_);
+#else
+#endif
+
+    netHost_->Initialize(coreCLRFilesAbsPath_);
+
+#ifdef disabled
+
     if (!InitCoreCLRDLL(errorMsg))
     if (!InitCoreCLRDLL(errorMsg))
     {
     {
         Shutdown();
         Shutdown();
@@ -291,7 +307,7 @@ bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
     String tpaList;
     String tpaList;
     GenerateTPAList(tpaList);
     GenerateTPAList(tpaList);
 
 
-    String appPath = "/Users/josh/Desktop/";
+    String appPath = coreCLRFilesAbsPath_;// "/Users/josh/Desktop/";
     Vector<String> nativeSearch;
     Vector<String> nativeSearch;
     nativeSearch.Push(coreCLRFilesAbsPath_);
     nativeSearch.Push(coreCLRFilesAbsPath_);
     //nativeSearch.Push("/Users/josh/Dev/atomic/AtomicGameEngine-build/Source/AtomicNET/NETNative");
     //nativeSearch.Push("/Users/josh/Dev/atomic/AtomicGameEngine-build/Source/AtomicNET/NETNative");
@@ -314,7 +330,7 @@ bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
     };
     };
 
 
     int st = sInitializeCoreCLR(
     int st = sInitializeCoreCLR(
-                "AtomicEditor",
+                "AtomicEditor.exe",
                 "NETCore",
                 "NETCore",
                 sizeof(propertyKeys) / sizeof(propertyKeys[0]),
                 sizeof(propertyKeys) / sizeof(propertyKeys[0]),
                 propertyKeys,
                 propertyKeys,
@@ -441,6 +457,8 @@ bool NETCore::Initialize(const String &coreCLRFilesAbsPath, String& errorMsg)
 
 
     managed->Initialize();
     managed->Initialize();
 
 
+#endif
+
     return true;
     return true;
 
 
 }
 }

+ 4 - 0
Source/AtomicNET/NETCore/NETCore.h

@@ -28,6 +28,8 @@
 namespace Atomic
 namespace Atomic
 {
 {
 
 
+class NETHost;
+
 class ATOMIC_API NETCore : public Object
 class ATOMIC_API NETCore : public Object
 {
 {
 
 
@@ -60,6 +62,8 @@ private:
     void* hostHandle_;
     void* hostHandle_;
     unsigned domainId_;
     unsigned domainId_;
 
 
+    SharedPtr<NETHost> netHost_;
+
     /// weak local context ref, so avoid recursion in static GetContext call
     /// weak local context ref, so avoid recursion in static GetContext call
     static WeakPtr<Context> csContext_;
     static WeakPtr<Context> csContext_;
 
 

+ 18 - 0
Source/AtomicNET/NETCore/NETHost.cpp

@@ -0,0 +1,18 @@
+
+#include "NETHost.h"
+
+namespace Atomic
+{
+
+NETHost::NETHost(Context* context) :
+    Object(context)
+{
+
+}
+
+NETHost::~NETHost()
+{
+
+}
+
+}

+ 24 - 0
Source/AtomicNET/NETCore/NETHost.h

@@ -0,0 +1,24 @@
+
+#pragma once
+
+#include <Atomic/Core/Object.h>
+
+namespace Atomic
+{
+
+class ATOMIC_API NETHost : public Object
+{
+
+    OBJECT(NETHost);
+
+public:
+    /// Construct.
+    NETHost(Context* context);
+    /// Destruct.
+    virtual ~NETHost();
+
+    virtual bool Initialize(const String& coreCLRFilesAbsPath) = 0;
+
+};
+
+}

+ 376 - 0
Source/AtomicNET/NETCore/Platforms/Windows/NETHostWindows.cpp

@@ -0,0 +1,376 @@
+
+#include <Atomic/IO/Log.h>
+#include <Atomic/IO/FileSystem.h>
+
+#include "NETHostWindows.h"
+
+// https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/clr-configuration-knobs.md
+// set COMPLUS_LogEnable=1
+// set COMPLUS_LogToConsole=1
+// set COMPLUS_LogLevel=9
+// set COMPLUS_ManagedLogFacility=0x00001000
+
+namespace Atomic
+{
+
+NETHostWindows::NETHostWindows(Context* context) :
+    NETHost(context),
+    clrRuntimeHost_(0),
+    clrModule_(0)
+{
+
+}
+
+NETHostWindows::~NETHostWindows()
+{
+
+}
+
+bool NETHostWindows::Initialize(const String& coreCLRFilesAbsPath)
+{
+    // It is very important that this is the native path "\\" vs "/" as find files will return "/" or "\" depending
+    // on what you give it, which will result in the domain failing to initialize as coreclr can't handle "/" on init
+    coreCLRFilesAbsPath_ = GetNativePath(AddTrailingSlash(coreCLRFilesAbsPath));
+
+    if (!LoadCLRDLL())
+        return false;
+
+    if (!InitCLRRuntimeHost())
+        return false;
+
+    if (!CreateAppDomain())
+        return false;
+
+    return true;
+}
+
+bool NETHostWindows::LoadCLRDLL()
+{
+
+    WString wcoreCLRDLLPath(coreCLRFilesAbsPath_ + "coreclr.dll");
+
+    HMODULE result = ::LoadLibraryExW(wcoreCLRDLLPath.CString(), NULL, 0);
+
+    if (!result)
+    {
+        LOGERRORF("Unable to load CoreCLR from %s", (coreCLRFilesAbsPath_ + "coreclr.dll").CString() );
+        return false;
+    }
+
+    // Pin the module - CoreCLR.dll does not support being unloaded.
+    HMODULE dummy_coreCLRModule;
+    if (!::GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_PIN, wcoreCLRDLLPath.CString(), &dummy_coreCLRModule))
+    {
+        LOGERRORF("Unable to pin CoreCLR module: %s",  (coreCLRFilesAbsPath_ + "coreclr.dll").CString() );
+        return false;
+    }
+
+    clrModule_ = result;
+
+    return true;
+}
+
+bool NETHostWindows::CreateAppDomain()
+{
+
+    wchar_t appPath[MAX_LONGPATH] = W("C:\\Dev\\coreclr\\x64\\");
+    wchar_t appNiPath[MAX_LONGPATH * 2] = W("");
+
+    wcscpy_s(appNiPath, appPath);
+    wcscat_s(appNiPath, MAX_LONGPATH * 2, W(";"));
+    wcscat_s(appNiPath, MAX_LONGPATH * 2, appPath);
+
+    // Construct native search directory paths
+    wchar_t nativeDllSearchDirs[MAX_LONGPATH * 3];
+
+    wcscpy_s(nativeDllSearchDirs, appPath);
+    wcscat_s(nativeDllSearchDirs, MAX_LONGPATH * 3, W(";"));
+    wcscat_s(nativeDllSearchDirs, MAX_LONGPATH * 3, WString(coreCLRFilesAbsPath_).CString());
+
+    //-------------------------------------------------------------
+
+    // Create an AppDomain
+
+    // Allowed property names:
+    // APPBASE
+    // - The base path of the application from which the exe and other assemblies will be loaded
+    //
+    // TRUSTED_PLATFORM_ASSEMBLIES
+    // - The list of complete paths to each of the fully trusted assemblies
+    //
+    // APP_PATHS
+    // - The list of paths which will be probed by the assembly loader
+    //
+    // APP_NI_PATHS
+    // - The list of additional paths that the assembly loader will probe for ngen images
+    //
+    // NATIVE_DLL_SEARCH_DIRECTORIES
+    // - The list of paths that will be probed for native DLLs called by PInvoke
+    //
+
+
+    // IMPORTANT: ALL PATHS MUST USE "\" and not "/"
+
+    const wchar_t *property_keys[] = {
+        W("TRUSTED_PLATFORM_ASSEMBLIES"),
+        W("APP_PATHS"),
+        W("APP_NI_PATHS"),
+        W("NATIVE_DLL_SEARCH_DIRECTORIES"),
+        W("AppDomainCompatSwitch")
+    };
+    const wchar_t *property_values[] = {
+         // TRUSTED_PLATFORM_ASSEMBLIES
+         tpaList_.CStr(),
+        // APP_PATHS
+        appPath,
+        // APP_NI_PATHS
+        appNiPath,
+        // NATIVE_DLL_SEARCH_DIRECTORIES
+        nativeDllSearchDirs,
+        // AppDomainCompatSwitch
+        W("UseLatestBehaviorWhenTFMNotSpecified")
+    };
+
+    DWORD domainId;
+
+    HRESULT hr  = clrRuntimeHost_->CreateAppDomainWithManager(
+                W("HelloWorld.exe"),   // The friendly name of the AppDomain
+                // Flags:
+                // APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS
+                // - By default CoreCLR only allows platform neutral assembly to be run. To allow
+                //   assemblies marked as platform specific, include this flag
+                //
+                // APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP
+                // - Allows sandboxed applications to make P/Invoke calls and use COM interop
+                //
+                // APPDOMAIN_SECURITY_SANDBOXED
+                // - Enables sandboxing. If not set, the app is considered full trust
+                //
+                // APPDOMAIN_IGNORE_UNHANDLED_EXCEPTION
+                // - Prevents the application from being torn down if a managed exception is unhandled
+                //
+                APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS |
+                APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP |
+                APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT,
+                NULL,                // Name of the assembly that contains the AppDomainManager implementation
+                NULL,                    // The AppDomainManager implementation type name
+                sizeof(property_keys)/sizeof(wchar_t*),  // The number of properties
+                property_keys,
+                property_values,
+                &domainId);
+
+    if (FAILED(hr)) {
+        LOGERRORF("Failed call to CreateAppDomainWithManager. ERRORCODE:%u ",  hr);
+        return false;
+    }
+
+
+    return true;
+}
+
+bool NETHostWindows::InitCLRRuntimeHost()
+{
+    if (!clrModule_)
+        return false;
+
+    FnGetCLRRuntimeHost pfnGetCLRRuntimeHost =
+            (FnGetCLRRuntimeHost)::GetProcAddress(clrModule_, "GetCLRRuntimeHost");
+
+    if (!pfnGetCLRRuntimeHost)
+    {
+        LOGERRORF("Unable to get GetCLRRuntimeHost function from module: %s",  (coreCLRFilesAbsPath_ + "coreclr.dll").CString() );
+        return false;
+    }
+
+    HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost2, (IUnknown**)&clrRuntimeHost_);
+
+    if (FAILED(hr))
+    {
+        LOGERRORF("Failed to get ICLRRuntimeHost2 interface. ERRORCODE: %u", hr);
+        return false;
+    }
+
+    // Set up the startup flags for the clr runtime
+        STARTUP_FLAGS dwStartupFlags = (STARTUP_FLAGS)(
+            STARTUP_FLAGS::STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN |
+            STARTUP_FLAGS::STARTUP_SINGLE_APPDOMAIN /* |
+            STARTUP_FLAGS::STARTUP_SERVER_GC*/
+            );
+
+    // Default startup flags
+    hr = clrRuntimeHost_->SetStartupFlags(dwStartupFlags);
+
+    if (FAILED(hr))
+    {
+        LOGERRORF("Failed to set startup flags. ERRORCODE: %u", hr);
+        return false;
+    }
+
+    /*
+    // Authenticate with either CORECLR_HOST_AUTHENTICATION_KEY or CORECLR_HOST_AUTHENTICATION_KEY_NONGEN
+    hr = clrRuntimeHost_->Authenticate(CORECLR_HOST_AUTHENTICATION_KEY);
+
+    if (FAILED(hr))
+    {
+        LOGERRORF("CoreCLR failed to authenticate. ERRORCODE: %u", hr);
+        return false;
+    }
+    */
+
+
+    hr = clrRuntimeHost_->Start();
+
+    if (FAILED(hr))
+    {
+        LOGERRORF("Failed to start CoreCLR. ERRORCODE: %u", hr);
+        return false;
+    }
+
+    if (!GenerateTPAList())
+    {
+        LOGERRORF("Failed to generate TPA List");
+        return false;
+    }
+
+    return true;
+}
+
+bool NETHostWindows::TPAListContainsFile(wchar_t* fileNameWithoutExtension, wchar_t** rgTPAExtensions, int countExtensions)
+{
+    if (!tpaList_.CStr()) return false;
+
+    for (int iExtension = 0; iExtension < countExtensions; iExtension++)
+    {
+        wchar_t fileName[MAX_LONGPATH];
+        wcscpy_s(fileName, MAX_LONGPATH, W("\\")); // So that we don't match other files that end with the current file name
+        wcscat_s(fileName, MAX_LONGPATH, fileNameWithoutExtension);
+        wcscat_s(fileName, MAX_LONGPATH, rgTPAExtensions[iExtension] + 1);
+        wcscat_s(fileName, MAX_LONGPATH, W(";")); // So that we don't match other files that begin with the current file name
+
+        if (wcsstr(tpaList_.CStr(), fileName))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+
+void NETHostWindows::RemoveExtensionAndNi(wchar_t* fileName)
+{
+    // Remove extension, if it exists
+    wchar_t* extension = wcsrchr(fileName, W('.'));
+    if (extension != NULL)
+    {
+        extension[0] = W('\0');
+
+        // Check for .ni
+        size_t len = wcslen(fileName);
+        if (len > 3 &&
+                fileName[len - 1] == W('i') &&
+                fileName[len - 2] == W('n') &&
+                fileName[len - 3] == W('.') )
+        {
+            fileName[len - 3] = W('\0');
+        }
+    }
+}
+
+
+void NETHostWindows::AddFilesFromDirectoryToTPAList(const wchar_t* targetPath, wchar_t** rgTPAExtensions, int countExtensions)
+{
+
+    wchar_t assemblyPath[MAX_LONGPATH];
+
+    for (int iExtension = 0; iExtension < countExtensions; iExtension++)
+    {
+        wcscpy_s(assemblyPath, MAX_LONGPATH, targetPath);
+
+        const size_t dirLength = wcslen(targetPath);
+        wchar_t* const fileNameBuffer = assemblyPath + dirLength;
+        const size_t fileNameBufferSize = MAX_LONGPATH - dirLength;
+
+        wcscat_s(assemblyPath, rgTPAExtensions[iExtension]);
+        WIN32_FIND_DATA data;
+        HANDLE findHandle = FindFirstFile(assemblyPath, &data);
+
+        if (findHandle != INVALID_HANDLE_VALUE)
+        {
+            do
+            {
+                if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+                {
+                    // It seems that CoreCLR doesn't always use the first instance of an assembly on the TPA list (ni's may be preferred
+                    // over il, even if they appear later). So, only include the first instance of a simple assembly name to allow
+                    // users the opportunity to override Framework assemblies by placing dlls in %CORE_LIBRARIES%
+
+                    // ToLower for case-insensitive comparisons
+                    wchar_t* fileNameChar = data.cFileName;
+                    while (*fileNameChar)
+                    {
+                        *fileNameChar = towlower(*fileNameChar);
+                        fileNameChar++;
+                    }
+
+                    // Remove extension
+                    wchar_t fileNameWithoutExtension[MAX_LONGPATH];
+                    wcscpy_s(fileNameWithoutExtension, MAX_LONGPATH, data.cFileName);
+
+                    RemoveExtensionAndNi(fileNameWithoutExtension);
+
+                    // Add to the list if not already on it
+                    if (!TPAListContainsFile(fileNameWithoutExtension, rgTPAExtensions, countExtensions))
+                    {
+                        const size_t fileLength = wcslen(data.cFileName);
+                        const size_t assemblyPathLength = dirLength + fileLength;
+                        wcsncpy_s(fileNameBuffer, fileNameBufferSize, data.cFileName, fileLength);
+                        tpaList_.Append(assemblyPath, assemblyPathLength);
+                        tpaList_.Append(W(";"), 1);
+                    }
+                    else
+                    {
+                        LOGINFOF("NETHostWindows skipping assembly");
+                    }
+                }
+            } while (0 != FindNextFile(findHandle, &data));
+
+            FindClose(findHandle);
+        }
+    }
+}
+
+bool NETHostWindows::GenerateTPAList()
+{
+
+    wchar_t *rgTPAExtensions[] = {
+        W("*.ni.dll"),		// Probe for .ni.dll first so that it's preferred if ni and il coexist in the same dir
+        W("*.dll"),
+        W("*.ni.exe"),
+        W("*.exe"),
+    };
+
+    AddFilesFromDirectoryToTPAList(WString(coreCLRFilesAbsPath_).CString(), rgTPAExtensions, _countof(rgTPAExtensions));
+
+    return true;
+
+}
+
+
+}
+
+/*
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogEnable, W("LogEnable"), "Turns on the traditional CLR log.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFacility,  W("LogFacility"),  "Specifies a facility mask for CLR log. (See 'loglf.h'; VM interprets string value as hex number.) Also used by stresslog.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFacility2, W("LogFacility2"), "Specifies a facility mask for CLR log. (See 'loglf.h'; VM interprets string value as hex number.) Also used by stresslog.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_logFatalError, W("logFatalError"), 1, "Specifies whether EventReporter logs fatal errors in the Windows event log.")
+CONFIG_STRING_INFO_EX(INTERNAL_LogFile, W("LogFile"), "Specifies a file name for the CLR log.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFileAppend, W("LogFileAppend"), "Specifies whether to append to or replace the CLR log file.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFlushFile, W("LogFlushFile"), "Specifies whether to flush the CLR log file file on each write.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_LogLevel, W("LogLevel"), "4=10 msgs, 9=1000000, 10=everything")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_LogPath, W("LogPath"), "?Fusion debug log path.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogToConsole, W("LogToConsole"), "Writes the CLR log to console.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogToDebugger, W("LogToDebugger"), "Writes the CLR log to debugger (OutputDebugStringA).")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogToFile, W("LogToFile"), "Writes the CLR log to a file.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogWithPid, W("LogWithPid"), "Appends pid to filename for the CLR log.")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_FusionLogFileNamesIncludePid, W("FusionLogFileNamesIncludePid"), 0, "Fusion logging will append process id to log filenames.", CLRConfig::REGUTIL_default)
+*/

+ 89 - 0
Source/AtomicNET/NETCore/Platforms/Windows/NETHostWindows.h

@@ -0,0 +1,89 @@
+
+#pragma once
+
+#include "../../NETHost.h"
+
+#define UNICODE
+#include "windows.h"
+#include <stdio.h>
+#include "prebuilt/mscoree.h"
+#include "prebuilt/palclr.h"
+
+namespace Atomic
+{
+
+// Dynamically expanding string buffer to hold TPA list
+class TPAStringBuffer {
+    static const int m_defaultSize = 4096;
+    wchar_t* m_buffer;
+    size_t m_capacity;
+    size_t m_length;
+
+    TPAStringBuffer(const TPAStringBuffer&);
+    TPAStringBuffer& operator =(const TPAStringBuffer&);
+
+public:
+    TPAStringBuffer() : m_capacity(0), m_buffer(nullptr), m_length(0) {
+    }
+
+    ~TPAStringBuffer() {
+        delete[] m_buffer;
+    }
+
+    const wchar_t* CStr() const {
+        return m_buffer;
+    }
+
+    void Append(const wchar_t* str, size_t strLen) {
+        if (!m_buffer) {
+            m_buffer = new wchar_t[m_defaultSize];
+            m_capacity = m_defaultSize;
+        }
+        if (m_length + strLen + 1 > m_capacity) {
+            size_t newCapacity = m_capacity * 2;
+            wchar_t* newBuffer = new wchar_t[newCapacity];
+            wcsncpy_s(newBuffer, newCapacity, m_buffer, m_length);
+            delete[] m_buffer;
+            m_buffer = newBuffer;
+            m_capacity = newCapacity;
+        }
+        wcsncpy_s(m_buffer + m_length, m_capacity - m_length, str, strLen);
+        m_length += strLen;
+    }
+};
+
+class ATOMIC_API NETHostWindows : public NETHost
+{
+
+    OBJECT(NETHostWindows);
+
+public:
+    /// Construct.
+    NETHostWindows(Context* context);
+    /// Destruct.
+    virtual ~NETHostWindows();
+
+    bool Initialize(const String& coreCLRFilesAbsPath);
+
+private:
+
+    bool LoadCLRDLL();
+    bool InitCLRRuntimeHost();
+
+    bool TPAListContainsFile(wchar_t* fileNameWithoutExtension, wchar_t** rgTPAExtensions, int countExtensions);
+    void RemoveExtensionAndNi(wchar_t* fileName);
+    void AddFilesFromDirectoryToTPAList(const wchar_t* targetPath, wchar_t** rgTPAExtensions, int countExtensions);
+    bool GenerateTPAList();
+    bool CreateAppDomain();
+
+    // this path MUST use "\" and not "/" as CoreCLR requires "\" usage in init
+    String coreCLRFilesAbsPath_;
+
+    ICLRRuntimeHost2* clrRuntimeHost_;
+    HMODULE clrModule_;
+
+    TPAStringBuffer tpaList_;
+
+};
+
+}

+ 2930 - 0
Source/AtomicNET/NETCore/Platforms/Windows/prebuilt/mscoree.h

@@ -0,0 +1,2930 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information. 
+//
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 8.00.0603 */
+/* @@MIDL_FILE_HEADING(  ) */
+
+#pragma warning( disable: 4049 )  /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 475
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __mscoree_h__
+#define __mscoree_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */ 
+
+#ifndef __IDebuggerThreadControl_FWD_DEFINED__
+#define __IDebuggerThreadControl_FWD_DEFINED__
+typedef interface IDebuggerThreadControl IDebuggerThreadControl;
+
+#endif 	/* __IDebuggerThreadControl_FWD_DEFINED__ */
+
+
+#ifndef __IDebuggerInfo_FWD_DEFINED__
+#define __IDebuggerInfo_FWD_DEFINED__
+typedef interface IDebuggerInfo IDebuggerInfo;
+
+#endif 	/* __IDebuggerInfo_FWD_DEFINED__ */
+
+
+#ifndef __ICLRErrorReportingManager_FWD_DEFINED__
+#define __ICLRErrorReportingManager_FWD_DEFINED__
+typedef interface ICLRErrorReportingManager ICLRErrorReportingManager;
+
+#endif 	/* __ICLRErrorReportingManager_FWD_DEFINED__ */
+
+
+#ifndef __ICLRErrorReportingManager2_FWD_DEFINED__
+#define __ICLRErrorReportingManager2_FWD_DEFINED__
+typedef interface ICLRErrorReportingManager2 ICLRErrorReportingManager2;
+
+#endif 	/* __ICLRErrorReportingManager2_FWD_DEFINED__ */
+
+
+#ifndef __ICLRPolicyManager_FWD_DEFINED__
+#define __ICLRPolicyManager_FWD_DEFINED__
+typedef interface ICLRPolicyManager ICLRPolicyManager;
+
+#endif 	/* __ICLRPolicyManager_FWD_DEFINED__ */
+
+
+#ifndef __ICLRGCManager_FWD_DEFINED__
+#define __ICLRGCManager_FWD_DEFINED__
+typedef interface ICLRGCManager ICLRGCManager;
+
+#endif 	/* __ICLRGCManager_FWD_DEFINED__ */
+
+
+#ifndef __ICLRGCManager2_FWD_DEFINED__
+#define __ICLRGCManager2_FWD_DEFINED__
+typedef interface ICLRGCManager2 ICLRGCManager2;
+
+#endif 	/* __ICLRGCManager2_FWD_DEFINED__ */
+
+
+#ifndef __IHostControl_FWD_DEFINED__
+#define __IHostControl_FWD_DEFINED__
+typedef interface IHostControl IHostControl;
+
+#endif 	/* __IHostControl_FWD_DEFINED__ */
+
+
+#ifndef __ICLRControl_FWD_DEFINED__
+#define __ICLRControl_FWD_DEFINED__
+typedef interface ICLRControl ICLRControl;
+
+#endif 	/* __ICLRControl_FWD_DEFINED__ */
+
+
+#ifndef __ICLRRuntimeHost_FWD_DEFINED__
+#define __ICLRRuntimeHost_FWD_DEFINED__
+typedef interface ICLRRuntimeHost ICLRRuntimeHost;
+
+#endif 	/* __ICLRRuntimeHost_FWD_DEFINED__ */
+
+
+#ifndef __ICLRRuntimeHost2_FWD_DEFINED__
+#define __ICLRRuntimeHost2_FWD_DEFINED__
+typedef interface ICLRRuntimeHost2 ICLRRuntimeHost2;
+
+#endif 	/* __ICLRRuntimeHost2_FWD_DEFINED__ */
+
+
+#ifndef __ICLRExecutionManager_FWD_DEFINED__
+#define __ICLRExecutionManager_FWD_DEFINED__
+typedef interface ICLRExecutionManager ICLRExecutionManager;
+
+#endif 	/* __ICLRExecutionManager_FWD_DEFINED__ */
+
+
+#ifndef __IHostNetCFDebugControlManager_FWD_DEFINED__
+#define __IHostNetCFDebugControlManager_FWD_DEFINED__
+typedef interface IHostNetCFDebugControlManager IHostNetCFDebugControlManager;
+
+#endif 	/* __IHostNetCFDebugControlManager_FWD_DEFINED__ */
+
+
+#ifndef __ITypeName_FWD_DEFINED__
+#define __ITypeName_FWD_DEFINED__
+typedef interface ITypeName ITypeName;
+
+#endif 	/* __ITypeName_FWD_DEFINED__ */
+
+
+#ifndef __ITypeNameBuilder_FWD_DEFINED__
+#define __ITypeNameBuilder_FWD_DEFINED__
+typedef interface ITypeNameBuilder ITypeNameBuilder;
+
+#endif 	/* __ITypeNameBuilder_FWD_DEFINED__ */
+
+
+#ifndef __ITypeNameFactory_FWD_DEFINED__
+#define __ITypeNameFactory_FWD_DEFINED__
+typedef interface ITypeNameFactory ITypeNameFactory;
+
+#endif 	/* __ITypeNameFactory_FWD_DEFINED__ */
+
+
+#ifndef __IManagedObject_FWD_DEFINED__
+#define __IManagedObject_FWD_DEFINED__
+typedef interface IManagedObject IManagedObject;
+
+#endif 	/* __IManagedObject_FWD_DEFINED__ */
+
+
+#ifndef __ComCallUnmarshal_FWD_DEFINED__
+#define __ComCallUnmarshal_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class ComCallUnmarshal ComCallUnmarshal;
+#else
+typedef struct ComCallUnmarshal ComCallUnmarshal;
+#endif /* __cplusplus */
+
+#endif 	/* __ComCallUnmarshal_FWD_DEFINED__ */
+
+
+#ifndef __ComCallUnmarshalV4_FWD_DEFINED__
+#define __ComCallUnmarshalV4_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class ComCallUnmarshalV4 ComCallUnmarshalV4;
+#else
+typedef struct ComCallUnmarshalV4 ComCallUnmarshalV4;
+#endif /* __cplusplus */
+
+#endif 	/* __ComCallUnmarshalV4_FWD_DEFINED__ */
+
+
+#ifndef __CLRRuntimeHost_FWD_DEFINED__
+#define __CLRRuntimeHost_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class CLRRuntimeHost CLRRuntimeHost;
+#else
+typedef struct CLRRuntimeHost CLRRuntimeHost;
+#endif /* __cplusplus */
+
+#endif 	/* __CLRRuntimeHost_FWD_DEFINED__ */
+
+
+#ifndef __TypeNameFactory_FWD_DEFINED__
+#define __TypeNameFactory_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class TypeNameFactory TypeNameFactory;
+#else
+typedef struct TypeNameFactory TypeNameFactory;
+#endif /* __cplusplus */
+
+#endif 	/* __TypeNameFactory_FWD_DEFINED__ */
+
+
+#ifndef __ICLRAppDomainResourceMonitor_FWD_DEFINED__
+#define __ICLRAppDomainResourceMonitor_FWD_DEFINED__
+typedef interface ICLRAppDomainResourceMonitor ICLRAppDomainResourceMonitor;
+
+#endif 	/* __ICLRAppDomainResourceMonitor_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "unknwn.h"
+#include "gchost.h"
+#include "ivalidator.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif 
+
+
+/* interface __MIDL_itf_mscoree_0000_0000 */
+/* [local] */ 
+
+#define DECLARE_DEPRECATED 
+#define DEPRECATED_CLR_STDAPI STDAPI
+
+struct IActivationFactory;
+
+#define	CLR_MAJOR_VERSION	( 4 )
+
+#define	CLR_MINOR_VERSION	( 0 )
+
+#define	CLR_BUILD_VERSION	( 23203 )
+
+#define	CLR_ASSEMBLY_MAJOR_VERSION	( 4 )
+
+#define	CLR_ASSEMBLY_MINOR_VERSION	( 0 )
+
+#define	CLR_ASSEMBLY_BUILD_VERSION	( 0 )
+
+EXTERN_GUID(CLSID_TypeNameFactory, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x25);
+EXTERN_GUID(CLSID_ComCallUnmarshal, 0x3F281000,0xE95A,0x11d2,0x88,0x6B,0x00,0xC0,0x4F,0x86,0x9F,0x04);
+EXTERN_GUID(CLSID_ComCallUnmarshalV4, 0x45fb4600,0xe6e8,0x4928,0xb2,0x5e,0x50,0x47,0x6f,0xf7,0x94,0x25);
+EXTERN_GUID(IID_IManagedObject, 0xc3fcc19e, 0xa970, 0x11d2, 0x8b, 0x5a, 0x00, 0xa0, 0xc9, 0xb7, 0xc9, 0xc4);
+EXTERN_GUID(IID_ICLRAppDomainResourceMonitor, 0XC62DE18C, 0X2E23, 0X4AEA, 0X84, 0X23, 0XB4, 0X0C, 0X1F, 0XC5, 0X9E, 0XAE);
+EXTERN_GUID(IID_ICLRPolicyManager, 0x7D290010, 0xD781, 0x45da, 0xA6, 0xF8, 0xAA, 0x5D, 0x71, 0x1A, 0x73, 0x0E);
+EXTERN_GUID(IID_ICLRGCManager, 0x54D9007E, 0xA8E2, 0x4885, 0xB7, 0xBF, 0xF9, 0x98, 0xDE, 0xEE, 0x4F, 0x2A);
+EXTERN_GUID(IID_ICLRGCManager2, 0x0603B793, 0xA97A, 0x4712, 0x9C, 0xB4, 0x0C, 0xD1, 0xC7, 0x4C, 0x0F, 0x7C);
+EXTERN_GUID(IID_ICLRErrorReportingManager, 0x980d2f1a, 0xbf79, 0x4c08, 0x81, 0x2a, 0xbb, 0x97, 0x78, 0x92, 0x8f, 0x78);
+EXTERN_GUID(IID_ICLRErrorReportingManager2, 0xc68f63b1, 0x4d8b, 0x4e0b, 0x95, 0x64, 0x9d, 0x2e, 0xfe, 0x2f, 0xa1, 0x8c);
+EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02);
+EXTERN_GUID(IID_ICLRRuntimeHost2, 0x712AB73F, 0x2C22, 0x4807, 0xAD, 0x7E, 0xF5, 0x01, 0xD7, 0xb7, 0x2C, 0x2D);
+EXTERN_GUID(IID_ICLRExecutionManager, 0x1000A3E7, 0xB420, 0x4620, 0xAE, 0x30, 0xFB, 0x19, 0xB5, 0x87, 0xAD, 0x1D);
+EXTERN_GUID(IID_ITypeName, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x22);
+EXTERN_GUID(IID_ITypeNameBuilder, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x23);
+EXTERN_GUID(IID_ITypeNameFactory, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x21);
+DEPRECATED_CLR_STDAPI GetCORSystemDirectory(_Out_writes_to_(cchBuffer, *dwLength) LPWSTR pbuffer, DWORD  cchBuffer, DWORD* dwLength);
+DEPRECATED_CLR_STDAPI GetCORVersion(_Out_writes_to_(cchBuffer, *dwLength) LPWSTR pbBuffer, DWORD cchBuffer, DWORD* dwLength);
+DEPRECATED_CLR_STDAPI GetFileVersion(LPCWSTR szFilename, _Out_writes_to_opt_(cchBuffer, *dwLength) LPWSTR szBuffer, DWORD cchBuffer, DWORD* dwLength);
+DEPRECATED_CLR_STDAPI GetCORRequiredVersion(_Out_writes_to_(cchBuffer, *dwLength) LPWSTR pbuffer, DWORD cchBuffer, DWORD* dwLength);
+DEPRECATED_CLR_STDAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWSTR pConfigurationFile, DWORD startupFlags, DWORD runtimeInfoFlags, _Out_writes_opt_(dwDirectory) LPWSTR pDirectory, DWORD dwDirectory, _Out_opt_ DWORD *dwDirectoryLength, _Out_writes_opt_(cchBuffer) LPWSTR pVersion, DWORD cchBuffer, _Out_opt_ DWORD* dwlength);
+DEPRECATED_CLR_STDAPI GetRequestedRuntimeVersion(_In_ LPWSTR pExe, _Out_writes_to_(cchBuffer, *dwLength) LPWSTR pVersion, DWORD cchBuffer, _Out_ DWORD* dwLength);
+DEPRECATED_CLR_STDAPI CorBindToRuntimeHost(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, LPCWSTR pwszHostConfigFile, VOID* pReserved, DWORD startupFlags, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);
+DEPRECATED_CLR_STDAPI CorBindToRuntimeEx(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, DWORD startupFlags, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);
+DEPRECATED_CLR_STDAPI CorBindToRuntimeByCfg(IStream* pCfgStream, DWORD reserved, DWORD startupFlags, REFCLSID rclsid,REFIID riid, LPVOID FAR* ppv);
+DEPRECATED_CLR_STDAPI CorBindToRuntime(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);
+DEPRECATED_CLR_STDAPI CorBindToCurrentRuntime(LPCWSTR pwszFileName, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);
+DEPRECATED_CLR_STDAPI ClrCreateManagedInstance(LPCWSTR pTypeName, REFIID riid, void **ppObject);
+DECLARE_DEPRECATED void STDMETHODCALLTYPE CorMarkThreadInThreadPool();
+DEPRECATED_CLR_STDAPI RunDll32ShimW(HWND hwnd, HINSTANCE hinst, LPCWSTR lpszCmdLine, int nCmdShow);
+DEPRECATED_CLR_STDAPI LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll);
+DEPRECATED_CLR_STDAPI CallFunctionShim(LPCWSTR szDllName, LPCSTR szFunctionName, LPVOID lpvArgument1, LPVOID lpvArgument2, LPCWSTR szVersion, LPVOID pvReserved);
+DEPRECATED_CLR_STDAPI GetRealProcAddress(LPCSTR pwszProcName, VOID** ppv);
+DECLARE_DEPRECATED void STDMETHODCALLTYPE CorExitProcess(int exitCode);
+DEPRECATED_CLR_STDAPI LoadStringRC(UINT iResouceID, _Out_writes_z_(iMax) LPWSTR szBuffer, int iMax, int bQuiet);
+typedef HRESULT  (STDAPICALLTYPE *FnGetCLRRuntimeHost)(REFIID riid, IUnknown **pUnk);
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0000_0001
+    {
+        HOST_TYPE_DEFAULT	= 0,
+        HOST_TYPE_APPLAUNCH	= 0x1,
+        HOST_TYPE_CORFLAG	= 0x2
+    } 	HOST_TYPE;
+
+STDAPI CorLaunchApplication(HOST_TYPE dwClickOnceHost, LPCWSTR pwzAppFullName, DWORD dwManifestPaths, LPCWSTR* ppwzManifestPaths, DWORD dwActivationData, LPCWSTR* ppwzActivationData, LPPROCESS_INFORMATION lpProcessInformation);
+typedef HRESULT ( __stdcall *FExecuteInAppDomainCallback )( 
+    void *cookie);
+
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0000_0002
+    {
+        STARTUP_CONCURRENT_GC	= 0x1,
+        STARTUP_LOADER_OPTIMIZATION_MASK	= ( 0x3 << 1 ) ,
+        STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN	= ( 0x1 << 1 ) ,
+        STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN	= ( 0x2 << 1 ) ,
+        STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST	= ( 0x3 << 1 ) ,
+        STARTUP_LOADER_SAFEMODE	= 0x10,
+        STARTUP_LOADER_SETPREFERENCE	= 0x100,
+        STARTUP_SERVER_GC	= 0x1000,
+        STARTUP_HOARD_GC_VM	= 0x2000,
+        STARTUP_SINGLE_VERSION_HOSTING_INTERFACE	= 0x4000,
+        STARTUP_LEGACY_IMPERSONATION	= 0x10000,
+        STARTUP_DISABLE_COMMITTHREADSTACK	= 0x20000,
+        STARTUP_ALWAYSFLOW_IMPERSONATION	= 0x40000,
+        STARTUP_TRIM_GC_COMMIT	= 0x80000,
+        STARTUP_ETW	= 0x100000,
+        STARTUP_ARM	= 0x400000,
+        STARTUP_SINGLE_APPDOMAIN	= 0x800000,
+        STARTUP_APPX_APP_MODEL	= 0x1000000,
+        STARTUP_DISABLE_RANDOMIZED_STRING_HASHING	= 0x2000000
+    } 	STARTUP_FLAGS;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0000_0003
+    {
+        CLSID_RESOLUTION_DEFAULT	= 0,
+        CLSID_RESOLUTION_REGISTERED	= 0x1
+    } 	CLSID_RESOLUTION_FLAGS;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0000_0004
+    {
+        RUNTIME_INFO_UPGRADE_VERSION	= 0x1,
+        RUNTIME_INFO_REQUEST_IA64	= 0x2,
+        RUNTIME_INFO_REQUEST_AMD64	= 0x4,
+        RUNTIME_INFO_REQUEST_X86	= 0x8,
+        RUNTIME_INFO_DONT_RETURN_DIRECTORY	= 0x10,
+        RUNTIME_INFO_DONT_RETURN_VERSION	= 0x20,
+        RUNTIME_INFO_DONT_SHOW_ERROR_DIALOG	= 0x40,
+        RUNTIME_INFO_IGNORE_ERROR_MODE	= 0x1000
+    } 	RUNTIME_INFO_FLAGS;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0000_0005
+    {
+        APPDOMAIN_SECURITY_DEFAULT	= 0,
+        APPDOMAIN_SECURITY_SANDBOXED	= 0x1,
+        APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE	= 0x2,
+        APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS	= 0x4,
+        APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS	= 0x8,
+        APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP	= 0x10,
+        APPDOMAIN_SET_TEST_KEY	= 0x20,
+        APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS	= 0x40,
+        APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE	= 0x80,
+        APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT	= 0x100
+    } 	APPDOMAIN_SECURITY_FLAGS;
+
+STDAPI GetRequestedRuntimeVersionForCLSID(REFCLSID rclsid, _Out_writes_opt_(cchBuffer) LPWSTR pVersion, DWORD cchBuffer, _Out_opt_ DWORD* dwLength, CLSID_RESOLUTION_FLAGS dwResolutionFlags);
+EXTERN_GUID(IID_IDebuggerThreadControl, 0x23d86786, 0x0bb5, 0x4774, 0x8f, 0xb5, 0xe3, 0x52, 0x2a, 0xdd, 0x62, 0x46);
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0000_v0_0_s_ifspec;
+
+#ifndef __IDebuggerThreadControl_INTERFACE_DEFINED__
+#define __IDebuggerThreadControl_INTERFACE_DEFINED__
+
+/* interface IDebuggerThreadControl */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_IDebuggerThreadControl;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("23D86786-0BB5-4774-8FB5-E3522ADD6246")
+    IDebuggerThreadControl : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE ThreadIsBlockingForDebugger( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ReleaseAllRuntimeThreads( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE StartBlockingForDebugger( 
+            DWORD dwUnused) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct IDebuggerThreadControlVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IDebuggerThreadControl * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IDebuggerThreadControl * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IDebuggerThreadControl * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *ThreadIsBlockingForDebugger )( 
+            IDebuggerThreadControl * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *ReleaseAllRuntimeThreads )( 
+            IDebuggerThreadControl * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *StartBlockingForDebugger )( 
+            IDebuggerThreadControl * This,
+            DWORD dwUnused);
+        
+        END_INTERFACE
+    } IDebuggerThreadControlVtbl;
+
+    interface IDebuggerThreadControl
+    {
+        CONST_VTBL struct IDebuggerThreadControlVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IDebuggerThreadControl_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IDebuggerThreadControl_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IDebuggerThreadControl_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IDebuggerThreadControl_ThreadIsBlockingForDebugger(This)	\
+    ( (This)->lpVtbl -> ThreadIsBlockingForDebugger(This) ) 
+
+#define IDebuggerThreadControl_ReleaseAllRuntimeThreads(This)	\
+    ( (This)->lpVtbl -> ReleaseAllRuntimeThreads(This) ) 
+
+#define IDebuggerThreadControl_StartBlockingForDebugger(This,dwUnused)	\
+    ( (This)->lpVtbl -> StartBlockingForDebugger(This,dwUnused) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IDebuggerThreadControl_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0001 */
+/* [local] */ 
+
+EXTERN_GUID(IID_IDebuggerInfo, 0xbf24142d, 0xa47d, 0x4d24, 0xa6, 0x6d, 0x8c, 0x21, 0x41, 0x94, 0x4e, 0x44);
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0001_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0001_v0_0_s_ifspec;
+
+#ifndef __IDebuggerInfo_INTERFACE_DEFINED__
+#define __IDebuggerInfo_INTERFACE_DEFINED__
+
+/* interface IDebuggerInfo */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_IDebuggerInfo;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("BF24142D-A47D-4d24-A66D-8C2141944E44")
+    IDebuggerInfo : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE IsDebuggerAttached( 
+            /* [out] */ BOOL *pbAttached) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct IDebuggerInfoVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IDebuggerInfo * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IDebuggerInfo * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IDebuggerInfo * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *IsDebuggerAttached )( 
+            IDebuggerInfo * This,
+            /* [out] */ BOOL *pbAttached);
+        
+        END_INTERFACE
+    } IDebuggerInfoVtbl;
+
+    interface IDebuggerInfo
+    {
+        CONST_VTBL struct IDebuggerInfoVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IDebuggerInfo_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IDebuggerInfo_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IDebuggerInfo_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IDebuggerInfo_IsDebuggerAttached(This,pbAttached)	\
+    ( (This)->lpVtbl -> IsDebuggerAttached(This,pbAttached) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IDebuggerInfo_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0002 */
+/* [local] */ 
+
+typedef void *HDOMAINENUM;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0002_0001
+    {
+        eMemoryAvailableLow	= 1,
+        eMemoryAvailableNeutral	= 2,
+        eMemoryAvailableHigh	= 3
+    } 	EMemoryAvailable;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0002_0002
+    {
+        eTaskCritical	= 0,
+        eAppDomainCritical	= 1,
+        eProcessCritical	= 2
+    } 	EMemoryCriticalLevel;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0002_0003
+    {
+        WAIT_MSGPUMP	= 0x1,
+        WAIT_ALERTABLE	= 0x2,
+        WAIT_NOTINDEADLOCK	= 0x4
+    } 	WAIT_OPTION;
+
+typedef UINT64 TASKID;
+
+typedef DWORD CONNID;
+
+typedef 
+enum ETaskType
+    {
+        TT_DEBUGGERHELPER	= 0x1,
+        TT_GC	= 0x2,
+        TT_FINALIZER	= 0x4,
+        TT_THREADPOOL_TIMER	= 0x8,
+        TT_THREADPOOL_GATE	= 0x10,
+        TT_THREADPOOL_WORKER	= 0x20,
+        TT_THREADPOOL_IOCOMPLETION	= 0x40,
+        TT_ADUNLOAD	= 0x80,
+        TT_USER	= 0x100,
+        TT_THREADPOOL_WAIT	= 0x200,
+        TT_UNKNOWN	= 0x80000000
+    } 	ETaskType;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0002_0004
+    {
+        eSymbolReadingNever	= 0,
+        eSymbolReadingAlways	= 1,
+        eSymbolReadingFullTrustOnly	= 2
+    } 	ESymbolReadingPolicy;
+
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0002_0005
+    {
+        DUMP_FLAVOR_Mini	= 0,
+        DUMP_FLAVOR_CriticalCLRState	= 1,
+        DUMP_FLAVOR_NonHeapCLRState	= 2,
+        DUMP_FLAVOR_Default	= DUMP_FLAVOR_Mini
+    } 	ECustomDumpFlavor;
+
+typedef /* [public][public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0002_0006
+    {
+        DUMP_ITEM_None	= 0
+    } 	ECustomDumpItemKind;
+
+typedef /* [public][public] */ struct __MIDL___MIDL_itf_mscoree_0000_0002_0007
+    {
+    ECustomDumpItemKind itemKind;
+    union 
+        {
+        UINT_PTR pReserved;
+        } 	;
+    } 	CustomDumpItem;
+
+#define	BucketParamsCount	( 10 )
+
+#define	BucketParamLength	( 255 )
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0002_0009
+    {
+        Parameter1	= 0,
+        Parameter2	= ( Parameter1 + 1 ) ,
+        Parameter3	= ( Parameter2 + 1 ) ,
+        Parameter4	= ( Parameter3 + 1 ) ,
+        Parameter5	= ( Parameter4 + 1 ) ,
+        Parameter6	= ( Parameter5 + 1 ) ,
+        Parameter7	= ( Parameter6 + 1 ) ,
+        Parameter8	= ( Parameter7 + 1 ) ,
+        Parameter9	= ( Parameter8 + 1 ) ,
+        InvalidBucketParamIndex	= ( Parameter9 + 1 ) 
+    } 	BucketParameterIndex;
+
+typedef struct _BucketParameters
+    {
+    BOOL fInited;
+    WCHAR pszEventTypeName[ 255 ];
+    WCHAR pszParams[ 10 ][ 255 ];
+    } 	BucketParameters;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0002_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0002_v0_0_s_ifspec;
+
+#ifndef __ICLRErrorReportingManager_INTERFACE_DEFINED__
+#define __ICLRErrorReportingManager_INTERFACE_DEFINED__
+
+/* interface ICLRErrorReportingManager */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRErrorReportingManager;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("980D2F1A-BF79-4c08-812A-BB9778928F78")
+    ICLRErrorReportingManager : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetBucketParametersForCurrentException( 
+            /* [out] */ BucketParameters *pParams) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE BeginCustomDump( 
+            /* [in] */ ECustomDumpFlavor dwFlavor,
+            /* [in] */ DWORD dwNumItems,
+            /* [length_is][size_is][in] */ CustomDumpItem *items,
+            DWORD dwReserved) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE EndCustomDump( void) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRErrorReportingManagerVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRErrorReportingManager * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRErrorReportingManager * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRErrorReportingManager * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetBucketParametersForCurrentException )( 
+            ICLRErrorReportingManager * This,
+            /* [out] */ BucketParameters *pParams);
+        
+        HRESULT ( STDMETHODCALLTYPE *BeginCustomDump )( 
+            ICLRErrorReportingManager * This,
+            /* [in] */ ECustomDumpFlavor dwFlavor,
+            /* [in] */ DWORD dwNumItems,
+            /* [length_is][size_is][in] */ CustomDumpItem *items,
+            DWORD dwReserved);
+        
+        HRESULT ( STDMETHODCALLTYPE *EndCustomDump )( 
+            ICLRErrorReportingManager * This);
+        
+        END_INTERFACE
+    } ICLRErrorReportingManagerVtbl;
+
+    interface ICLRErrorReportingManager
+    {
+        CONST_VTBL struct ICLRErrorReportingManagerVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRErrorReportingManager_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRErrorReportingManager_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRErrorReportingManager_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRErrorReportingManager_GetBucketParametersForCurrentException(This,pParams)	\
+    ( (This)->lpVtbl -> GetBucketParametersForCurrentException(This,pParams) ) 
+
+#define ICLRErrorReportingManager_BeginCustomDump(This,dwFlavor,dwNumItems,items,dwReserved)	\
+    ( (This)->lpVtbl -> BeginCustomDump(This,dwFlavor,dwNumItems,items,dwReserved) ) 
+
+#define ICLRErrorReportingManager_EndCustomDump(This)	\
+    ( (This)->lpVtbl -> EndCustomDump(This) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRErrorReportingManager_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0003 */
+/* [local] */ 
+
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0003_0001
+    {
+        ApplicationID	= 0x1,
+        InstanceID	= 0x2
+    } 	ApplicationDataKey;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0003_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0003_v0_0_s_ifspec;
+
+#ifndef __ICLRErrorReportingManager2_INTERFACE_DEFINED__
+#define __ICLRErrorReportingManager2_INTERFACE_DEFINED__
+
+/* interface ICLRErrorReportingManager2 */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRErrorReportingManager2;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("C68F63B1-4D8B-4E0B-9564-9D2EFE2FA18C")
+    ICLRErrorReportingManager2 : public ICLRErrorReportingManager
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE SetApplicationData( 
+            /* [in] */ ApplicationDataKey key,
+            /* [in] */ const WCHAR *pValue) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetBucketParametersForUnhandledException( 
+            /* [in] */ const BucketParameters *pBucketParams,
+            /* [out] */ DWORD *pCountParams) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRErrorReportingManager2Vtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRErrorReportingManager2 * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRErrorReportingManager2 * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRErrorReportingManager2 * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetBucketParametersForCurrentException )( 
+            ICLRErrorReportingManager2 * This,
+            /* [out] */ BucketParameters *pParams);
+        
+        HRESULT ( STDMETHODCALLTYPE *BeginCustomDump )( 
+            ICLRErrorReportingManager2 * This,
+            /* [in] */ ECustomDumpFlavor dwFlavor,
+            /* [in] */ DWORD dwNumItems,
+            /* [length_is][size_is][in] */ CustomDumpItem *items,
+            DWORD dwReserved);
+        
+        HRESULT ( STDMETHODCALLTYPE *EndCustomDump )( 
+            ICLRErrorReportingManager2 * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetApplicationData )( 
+            ICLRErrorReportingManager2 * This,
+            /* [in] */ ApplicationDataKey key,
+            /* [in] */ const WCHAR *pValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetBucketParametersForUnhandledException )( 
+            ICLRErrorReportingManager2 * This,
+            /* [in] */ const BucketParameters *pBucketParams,
+            /* [out] */ DWORD *pCountParams);
+        
+        END_INTERFACE
+    } ICLRErrorReportingManager2Vtbl;
+
+    interface ICLRErrorReportingManager2
+    {
+        CONST_VTBL struct ICLRErrorReportingManager2Vtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRErrorReportingManager2_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRErrorReportingManager2_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRErrorReportingManager2_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRErrorReportingManager2_GetBucketParametersForCurrentException(This,pParams)	\
+    ( (This)->lpVtbl -> GetBucketParametersForCurrentException(This,pParams) ) 
+
+#define ICLRErrorReportingManager2_BeginCustomDump(This,dwFlavor,dwNumItems,items,dwReserved)	\
+    ( (This)->lpVtbl -> BeginCustomDump(This,dwFlavor,dwNumItems,items,dwReserved) ) 
+
+#define ICLRErrorReportingManager2_EndCustomDump(This)	\
+    ( (This)->lpVtbl -> EndCustomDump(This) ) 
+
+
+#define ICLRErrorReportingManager2_SetApplicationData(This,key,pValue)	\
+    ( (This)->lpVtbl -> SetApplicationData(This,key,pValue) ) 
+
+#define ICLRErrorReportingManager2_SetBucketParametersForUnhandledException(This,pBucketParams,pCountParams)	\
+    ( (This)->lpVtbl -> SetBucketParametersForUnhandledException(This,pBucketParams,pCountParams) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRErrorReportingManager2_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0004 */
+/* [local] */ 
+
+typedef /* [public][public][public][public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0004_0001
+    {
+        OPR_ThreadAbort	= 0,
+        OPR_ThreadRudeAbortInNonCriticalRegion	= ( OPR_ThreadAbort + 1 ) ,
+        OPR_ThreadRudeAbortInCriticalRegion	= ( OPR_ThreadRudeAbortInNonCriticalRegion + 1 ) ,
+        OPR_AppDomainUnload	= ( OPR_ThreadRudeAbortInCriticalRegion + 1 ) ,
+        OPR_AppDomainRudeUnload	= ( OPR_AppDomainUnload + 1 ) ,
+        OPR_ProcessExit	= ( OPR_AppDomainRudeUnload + 1 ) ,
+        OPR_FinalizerRun	= ( OPR_ProcessExit + 1 ) ,
+        MaxClrOperation	= ( OPR_FinalizerRun + 1 ) 
+    } 	EClrOperation;
+
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0004_0002
+    {
+        FAIL_NonCriticalResource	= 0,
+        FAIL_CriticalResource	= ( FAIL_NonCriticalResource + 1 ) ,
+        FAIL_FatalRuntime	= ( FAIL_CriticalResource + 1 ) ,
+        FAIL_OrphanedLock	= ( FAIL_FatalRuntime + 1 ) ,
+        FAIL_StackOverflow	= ( FAIL_OrphanedLock + 1 ) ,
+        FAIL_AccessViolation	= ( FAIL_StackOverflow + 1 ) ,
+        FAIL_CodeContract	= ( FAIL_AccessViolation + 1 ) ,
+        MaxClrFailure	= ( FAIL_CodeContract + 1 ) 
+    } 	EClrFailure;
+
+typedef /* [public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0004_0003
+    {
+        eRuntimeDeterminedPolicy	= 0,
+        eHostDeterminedPolicy	= ( eRuntimeDeterminedPolicy + 1 ) 
+    } 	EClrUnhandledException;
+
+typedef /* [public][public][public][public][public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0004_0004
+    {
+        eNoAction	= 0,
+        eThrowException	= ( eNoAction + 1 ) ,
+        eAbortThread	= ( eThrowException + 1 ) ,
+        eRudeAbortThread	= ( eAbortThread + 1 ) ,
+        eUnloadAppDomain	= ( eRudeAbortThread + 1 ) ,
+        eRudeUnloadAppDomain	= ( eUnloadAppDomain + 1 ) ,
+        eExitProcess	= ( eRudeUnloadAppDomain + 1 ) ,
+        eFastExitProcess	= ( eExitProcess + 1 ) ,
+        eRudeExitProcess	= ( eFastExitProcess + 1 ) ,
+        eDisableRuntime	= ( eRudeExitProcess + 1 ) ,
+        MaxPolicyAction	= ( eDisableRuntime + 1 ) 
+    } 	EPolicyAction;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0004_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0004_v0_0_s_ifspec;
+
+#ifndef __ICLRPolicyManager_INTERFACE_DEFINED__
+#define __ICLRPolicyManager_INTERFACE_DEFINED__
+
+/* interface ICLRPolicyManager */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRPolicyManager;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("7D290010-D781-45da-A6F8-AA5D711A730E")
+    ICLRPolicyManager : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE SetDefaultAction( 
+            /* [in] */ EClrOperation operation,
+            /* [in] */ EPolicyAction action) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetTimeout( 
+            /* [in] */ EClrOperation operation,
+            /* [in] */ DWORD dwMilliseconds) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetActionOnTimeout( 
+            /* [in] */ EClrOperation operation,
+            /* [in] */ EPolicyAction action) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetTimeoutAndAction( 
+            /* [in] */ EClrOperation operation,
+            /* [in] */ DWORD dwMilliseconds,
+            /* [in] */ EPolicyAction action) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetActionOnFailure( 
+            /* [in] */ EClrFailure failure,
+            /* [in] */ EPolicyAction action) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetUnhandledExceptionPolicy( 
+            /* [in] */ EClrUnhandledException policy) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRPolicyManagerVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRPolicyManager * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRPolicyManager * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRPolicyManager * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetDefaultAction )( 
+            ICLRPolicyManager * This,
+            /* [in] */ EClrOperation operation,
+            /* [in] */ EPolicyAction action);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetTimeout )( 
+            ICLRPolicyManager * This,
+            /* [in] */ EClrOperation operation,
+            /* [in] */ DWORD dwMilliseconds);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetActionOnTimeout )( 
+            ICLRPolicyManager * This,
+            /* [in] */ EClrOperation operation,
+            /* [in] */ EPolicyAction action);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetTimeoutAndAction )( 
+            ICLRPolicyManager * This,
+            /* [in] */ EClrOperation operation,
+            /* [in] */ DWORD dwMilliseconds,
+            /* [in] */ EPolicyAction action);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetActionOnFailure )( 
+            ICLRPolicyManager * This,
+            /* [in] */ EClrFailure failure,
+            /* [in] */ EPolicyAction action);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetUnhandledExceptionPolicy )( 
+            ICLRPolicyManager * This,
+            /* [in] */ EClrUnhandledException policy);
+        
+        END_INTERFACE
+    } ICLRPolicyManagerVtbl;
+
+    interface ICLRPolicyManager
+    {
+        CONST_VTBL struct ICLRPolicyManagerVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRPolicyManager_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRPolicyManager_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRPolicyManager_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRPolicyManager_SetDefaultAction(This,operation,action)	\
+    ( (This)->lpVtbl -> SetDefaultAction(This,operation,action) ) 
+
+#define ICLRPolicyManager_SetTimeout(This,operation,dwMilliseconds)	\
+    ( (This)->lpVtbl -> SetTimeout(This,operation,dwMilliseconds) ) 
+
+#define ICLRPolicyManager_SetActionOnTimeout(This,operation,action)	\
+    ( (This)->lpVtbl -> SetActionOnTimeout(This,operation,action) ) 
+
+#define ICLRPolicyManager_SetTimeoutAndAction(This,operation,dwMilliseconds,action)	\
+    ( (This)->lpVtbl -> SetTimeoutAndAction(This,operation,dwMilliseconds,action) ) 
+
+#define ICLRPolicyManager_SetActionOnFailure(This,failure,action)	\
+    ( (This)->lpVtbl -> SetActionOnFailure(This,failure,action) ) 
+
+#define ICLRPolicyManager_SetUnhandledExceptionPolicy(This,policy)	\
+    ( (This)->lpVtbl -> SetUnhandledExceptionPolicy(This,policy) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRPolicyManager_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0005 */
+/* [local] */ 
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0005_0001
+    {
+        Event_DomainUnload	= 0,
+        Event_ClrDisabled	= ( Event_DomainUnload + 1 ) ,
+        Event_MDAFired	= ( Event_ClrDisabled + 1 ) ,
+        Event_StackOverflow	= ( Event_MDAFired + 1 ) ,
+        MaxClrEvent	= ( Event_StackOverflow + 1 ) 
+    } 	EClrEvent;
+
+typedef struct _MDAInfo
+    {
+    LPCWSTR lpMDACaption;
+    LPCWSTR lpMDAMessage;
+    LPCWSTR lpStackTrace;
+    } 	MDAInfo;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0005_0002
+    {
+        SO_Managed	= 0,
+        SO_ClrEngine	= ( SO_Managed + 1 ) ,
+        SO_Other	= ( SO_ClrEngine + 1 ) 
+    } 	StackOverflowType;
+
+typedef struct _StackOverflowInfo
+{
+    StackOverflowType soType;
+    EXCEPTION_POINTERS *pExceptionInfo;
+} StackOverflowInfo;
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0005_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0005_v0_0_s_ifspec;
+
+#ifndef __ICLRGCManager_INTERFACE_DEFINED__
+#define __ICLRGCManager_INTERFACE_DEFINED__
+
+/* interface ICLRGCManager */
+/* [object][local][unique][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRGCManager;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("54D9007E-A8E2-4885-B7BF-F998DEEE4F2A")
+    ICLRGCManager : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Collect( 
+            /* [in] */ LONG Generation) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetStats( 
+            /* [out][in] */ COR_GC_STATS *pStats) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetGCStartupLimits( 
+            /* [in] */ DWORD SegmentSize,
+            /* [in] */ DWORD MaxGen0Size) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRGCManagerVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRGCManager * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRGCManager * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRGCManager * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Collect )( 
+            ICLRGCManager * This,
+            /* [in] */ LONG Generation);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetStats )( 
+            ICLRGCManager * This,
+            /* [out][in] */ COR_GC_STATS *pStats);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetGCStartupLimits )( 
+            ICLRGCManager * This,
+            /* [in] */ DWORD SegmentSize,
+            /* [in] */ DWORD MaxGen0Size);
+        
+        END_INTERFACE
+    } ICLRGCManagerVtbl;
+
+    interface ICLRGCManager
+    {
+        CONST_VTBL struct ICLRGCManagerVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRGCManager_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRGCManager_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRGCManager_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRGCManager_Collect(This,Generation)	\
+    ( (This)->lpVtbl -> Collect(This,Generation) ) 
+
+#define ICLRGCManager_GetStats(This,pStats)	\
+    ( (This)->lpVtbl -> GetStats(This,pStats) ) 
+
+#define ICLRGCManager_SetGCStartupLimits(This,SegmentSize,MaxGen0Size)	\
+    ( (This)->lpVtbl -> SetGCStartupLimits(This,SegmentSize,MaxGen0Size) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRGCManager_INTERFACE_DEFINED__ */
+
+
+#ifndef __ICLRGCManager2_INTERFACE_DEFINED__
+#define __ICLRGCManager2_INTERFACE_DEFINED__
+
+/* interface ICLRGCManager2 */
+/* [object][local][unique][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRGCManager2;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("0603B793-A97A-4712-9CB4-0CD1C74C0F7C")
+    ICLRGCManager2 : public ICLRGCManager
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE SetGCStartupLimitsEx( 
+            /* [in] */ SIZE_T SegmentSize,
+            /* [in] */ SIZE_T MaxGen0Size) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRGCManager2Vtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRGCManager2 * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRGCManager2 * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRGCManager2 * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Collect )( 
+            ICLRGCManager2 * This,
+            /* [in] */ LONG Generation);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetStats )( 
+            ICLRGCManager2 * This,
+            /* [out][in] */ COR_GC_STATS *pStats);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetGCStartupLimits )( 
+            ICLRGCManager2 * This,
+            /* [in] */ DWORD SegmentSize,
+            /* [in] */ DWORD MaxGen0Size);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetGCStartupLimitsEx )( 
+            ICLRGCManager2 * This,
+            /* [in] */ SIZE_T SegmentSize,
+            /* [in] */ SIZE_T MaxGen0Size);
+        
+        END_INTERFACE
+    } ICLRGCManager2Vtbl;
+
+    interface ICLRGCManager2
+    {
+        CONST_VTBL struct ICLRGCManager2Vtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRGCManager2_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRGCManager2_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRGCManager2_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRGCManager2_Collect(This,Generation)	\
+    ( (This)->lpVtbl -> Collect(This,Generation) ) 
+
+#define ICLRGCManager2_GetStats(This,pStats)	\
+    ( (This)->lpVtbl -> GetStats(This,pStats) ) 
+
+#define ICLRGCManager2_SetGCStartupLimits(This,SegmentSize,MaxGen0Size)	\
+    ( (This)->lpVtbl -> SetGCStartupLimits(This,SegmentSize,MaxGen0Size) ) 
+
+
+#define ICLRGCManager2_SetGCStartupLimitsEx(This,SegmentSize,MaxGen0Size)	\
+    ( (This)->lpVtbl -> SetGCStartupLimitsEx(This,SegmentSize,MaxGen0Size) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRGCManager2_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0007 */
+/* [local] */ 
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0007_0001
+    {
+        ePolicyLevelNone	= 0,
+        ePolicyLevelRetargetable	= 0x1,
+        ePolicyUnifiedToCLR	= 0x2,
+        ePolicyLevelApp	= 0x4,
+        ePolicyLevelPublisher	= 0x8,
+        ePolicyLevelHost	= 0x10,
+        ePolicyLevelAdmin	= 0x20,
+        ePolicyPortability	= 0x40
+    } 	EBindPolicyLevels;
+
+typedef struct _AssemblyBindInfo
+    {
+    DWORD dwAppDomainId;
+    LPCWSTR lpReferencedIdentity;
+    LPCWSTR lpPostPolicyIdentity;
+    DWORD ePolicyLevel;
+    } 	AssemblyBindInfo;
+
+typedef struct _ModuleBindInfo
+    {
+    DWORD dwAppDomainId;
+    LPCWSTR lpAssemblyIdentity;
+    LPCWSTR lpModuleName;
+    } 	ModuleBindInfo;
+
+typedef 
+enum _HostApplicationPolicy
+    {
+        HOST_APPLICATION_BINDING_POLICY	= 1
+    } 	EHostApplicationPolicy;
+
+STDAPI GetCLRIdentityManager(REFIID riid, IUnknown **ppManager);
+EXTERN_GUID(IID_IHostControl, 0x02CA073C, 0x7079, 0x4860, 0x88, 0x0A, 0xC2, 0xF7, 0xA4, 0x49, 0xC9, 0x91);
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0007_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0007_v0_0_s_ifspec;
+
+#ifndef __IHostControl_INTERFACE_DEFINED__
+#define __IHostControl_INTERFACE_DEFINED__
+
+/* interface IHostControl */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_IHostControl;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("02CA073C-7079-4860-880A-C2F7A449C991")
+    IHostControl : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetHostManager( 
+            /* [in] */ REFIID riid,
+            /* [out] */ void **ppObject) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetAppDomainManager( 
+            /* [in] */ DWORD dwAppDomainID,
+            /* [in] */ IUnknown *pUnkAppDomainManager) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct IHostControlVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IHostControl * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IHostControl * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IHostControl * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetHostManager )( 
+            IHostControl * This,
+            /* [in] */ REFIID riid,
+            /* [out] */ void **ppObject);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetAppDomainManager )( 
+            IHostControl * This,
+            /* [in] */ DWORD dwAppDomainID,
+            /* [in] */ IUnknown *pUnkAppDomainManager);
+        
+        END_INTERFACE
+    } IHostControlVtbl;
+
+    interface IHostControl
+    {
+        CONST_VTBL struct IHostControlVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IHostControl_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IHostControl_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IHostControl_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IHostControl_GetHostManager(This,riid,ppObject)	\
+    ( (This)->lpVtbl -> GetHostManager(This,riid,ppObject) ) 
+
+#define IHostControl_SetAppDomainManager(This,dwAppDomainID,pUnkAppDomainManager)	\
+    ( (This)->lpVtbl -> SetAppDomainManager(This,dwAppDomainID,pUnkAppDomainManager) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IHostControl_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0008 */
+/* [local] */ 
+
+EXTERN_GUID(IID_ICLRControl, 0x9065597E, 0xD1A1, 0x4fb2, 0xB6, 0xBA, 0x7E, 0x1F, 0xCE, 0x23, 0x0F, 0x61);
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0008_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0008_v0_0_s_ifspec;
+
+#ifndef __ICLRControl_INTERFACE_DEFINED__
+#define __ICLRControl_INTERFACE_DEFINED__
+
+/* interface ICLRControl */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRControl;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("9065597E-D1A1-4fb2-B6BA-7E1FCE230F61")
+    ICLRControl : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetCLRManager( 
+            /* [in] */ REFIID riid,
+            /* [out] */ void **ppObject) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetAppDomainManagerType( 
+            /* [in] */ LPCWSTR pwzAppDomainManagerAssembly,
+            /* [in] */ LPCWSTR pwzAppDomainManagerType) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRControlVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRControl * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRControl * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRControl * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCLRManager )( 
+            ICLRControl * This,
+            /* [in] */ REFIID riid,
+            /* [out] */ void **ppObject);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetAppDomainManagerType )( 
+            ICLRControl * This,
+            /* [in] */ LPCWSTR pwzAppDomainManagerAssembly,
+            /* [in] */ LPCWSTR pwzAppDomainManagerType);
+        
+        END_INTERFACE
+    } ICLRControlVtbl;
+
+    interface ICLRControl
+    {
+        CONST_VTBL struct ICLRControlVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRControl_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRControl_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRControl_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRControl_GetCLRManager(This,riid,ppObject)	\
+    ( (This)->lpVtbl -> GetCLRManager(This,riid,ppObject) ) 
+
+#define ICLRControl_SetAppDomainManagerType(This,pwzAppDomainManagerAssembly,pwzAppDomainManagerType)	\
+    ( (This)->lpVtbl -> SetAppDomainManagerType(This,pwzAppDomainManagerAssembly,pwzAppDomainManagerType) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRControl_INTERFACE_DEFINED__ */
+
+
+#ifndef __ICLRRuntimeHost_INTERFACE_DEFINED__
+#define __ICLRRuntimeHost_INTERFACE_DEFINED__
+
+/* interface ICLRRuntimeHost */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRRuntimeHost;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("90F1A06C-7712-4762-86B5-7A5EBA6BDB02")
+    ICLRRuntimeHost : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Start( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Stop( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetHostControl( 
+            /* [in] */ IHostControl *pHostControl) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetCLRControl( 
+            /* [out] */ ICLRControl **pCLRControl) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE UnloadAppDomain( 
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ BOOL fWaitUntilDone) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ExecuteInAppDomain( 
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ FExecuteInAppDomainCallback pCallback,
+            /* [in] */ void *cookie) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetCurrentAppDomainId( 
+            /* [out] */ DWORD *pdwAppDomainId) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ExecuteApplication( 
+            /* [in] */ LPCWSTR pwzAppFullName,
+            /* [in] */ DWORD dwManifestPaths,
+            /* [in] */ LPCWSTR *ppwzManifestPaths,
+            /* [in] */ DWORD dwActivationData,
+            /* [in] */ LPCWSTR *ppwzActivationData,
+            /* [out] */ int *pReturnValue) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ExecuteInDefaultAppDomain( 
+            /* [in] */ LPCWSTR pwzAssemblyPath,
+            /* [in] */ LPCWSTR pwzTypeName,
+            /* [in] */ LPCWSTR pwzMethodName,
+            /* [in] */ LPCWSTR pwzArgument,
+            /* [out] */ DWORD *pReturnValue) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRRuntimeHostVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRRuntimeHost * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRRuntimeHost * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRRuntimeHost * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Start )( 
+            ICLRRuntimeHost * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Stop )( 
+            ICLRRuntimeHost * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetHostControl )( 
+            ICLRRuntimeHost * This,
+            /* [in] */ IHostControl *pHostControl);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCLRControl )( 
+            ICLRRuntimeHost * This,
+            /* [out] */ ICLRControl **pCLRControl);
+        
+        HRESULT ( STDMETHODCALLTYPE *UnloadAppDomain )( 
+            ICLRRuntimeHost * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ BOOL fWaitUntilDone);
+        
+        HRESULT ( STDMETHODCALLTYPE *ExecuteInAppDomain )( 
+            ICLRRuntimeHost * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ FExecuteInAppDomainCallback pCallback,
+            /* [in] */ void *cookie);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCurrentAppDomainId )( 
+            ICLRRuntimeHost * This,
+            /* [out] */ DWORD *pdwAppDomainId);
+        
+        HRESULT ( STDMETHODCALLTYPE *ExecuteApplication )( 
+            ICLRRuntimeHost * This,
+            /* [in] */ LPCWSTR pwzAppFullName,
+            /* [in] */ DWORD dwManifestPaths,
+            /* [in] */ LPCWSTR *ppwzManifestPaths,
+            /* [in] */ DWORD dwActivationData,
+            /* [in] */ LPCWSTR *ppwzActivationData,
+            /* [out] */ int *pReturnValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *ExecuteInDefaultAppDomain )( 
+            ICLRRuntimeHost * This,
+            /* [in] */ LPCWSTR pwzAssemblyPath,
+            /* [in] */ LPCWSTR pwzTypeName,
+            /* [in] */ LPCWSTR pwzMethodName,
+            /* [in] */ LPCWSTR pwzArgument,
+            /* [out] */ DWORD *pReturnValue);
+        
+        END_INTERFACE
+    } ICLRRuntimeHostVtbl;
+
+    interface ICLRRuntimeHost
+    {
+        CONST_VTBL struct ICLRRuntimeHostVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRRuntimeHost_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRRuntimeHost_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRRuntimeHost_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRRuntimeHost_Start(This)	\
+    ( (This)->lpVtbl -> Start(This) ) 
+
+#define ICLRRuntimeHost_Stop(This)	\
+    ( (This)->lpVtbl -> Stop(This) ) 
+
+#define ICLRRuntimeHost_SetHostControl(This,pHostControl)	\
+    ( (This)->lpVtbl -> SetHostControl(This,pHostControl) ) 
+
+#define ICLRRuntimeHost_GetCLRControl(This,pCLRControl)	\
+    ( (This)->lpVtbl -> GetCLRControl(This,pCLRControl) ) 
+
+#define ICLRRuntimeHost_UnloadAppDomain(This,dwAppDomainId,fWaitUntilDone)	\
+    ( (This)->lpVtbl -> UnloadAppDomain(This,dwAppDomainId,fWaitUntilDone) ) 
+
+#define ICLRRuntimeHost_ExecuteInAppDomain(This,dwAppDomainId,pCallback,cookie)	\
+    ( (This)->lpVtbl -> ExecuteInAppDomain(This,dwAppDomainId,pCallback,cookie) ) 
+
+#define ICLRRuntimeHost_GetCurrentAppDomainId(This,pdwAppDomainId)	\
+    ( (This)->lpVtbl -> GetCurrentAppDomainId(This,pdwAppDomainId) ) 
+
+#define ICLRRuntimeHost_ExecuteApplication(This,pwzAppFullName,dwManifestPaths,ppwzManifestPaths,dwActivationData,ppwzActivationData,pReturnValue)	\
+    ( (This)->lpVtbl -> ExecuteApplication(This,pwzAppFullName,dwManifestPaths,ppwzManifestPaths,dwActivationData,ppwzActivationData,pReturnValue) ) 
+
+#define ICLRRuntimeHost_ExecuteInDefaultAppDomain(This,pwzAssemblyPath,pwzTypeName,pwzMethodName,pwzArgument,pReturnValue)	\
+    ( (This)->lpVtbl -> ExecuteInDefaultAppDomain(This,pwzAssemblyPath,pwzTypeName,pwzMethodName,pwzArgument,pReturnValue) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRRuntimeHost_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0010 */
+/* [local] */ 
+
+#define CORECLR_HOST_AUTHENTICATION_KEY 0x1C6CA6F94025800LL
+#define CORECLR_HOST_AUTHENTICATION_KEY_NONGEN 0x1C6CA6F94025801LL
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0010_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0010_v0_0_s_ifspec;
+
+#ifndef __ICLRRuntimeHost2_INTERFACE_DEFINED__
+#define __ICLRRuntimeHost2_INTERFACE_DEFINED__
+
+/* interface ICLRRuntimeHost2 */
+/* [local][unique][helpstring][version][uuid][object] */ 
+
+
+EXTERN_C const IID IID_ICLRRuntimeHost2;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("712AB73F-2C22-4807-AD7E-F501D7B72C2D")
+    ICLRRuntimeHost2 : public ICLRRuntimeHost
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE CreateAppDomainWithManager( 
+            /* [in] */ LPCWSTR wszFriendlyName,
+            /* [in] */ DWORD dwFlags,
+            /* [in] */ LPCWSTR wszAppDomainManagerAssemblyName,
+            /* [in] */ LPCWSTR wszAppDomainManagerTypeName,
+            /* [in] */ int nProperties,
+            /* [in] */ LPCWSTR *pPropertyNames,
+            /* [in] */ LPCWSTR *pPropertyValues,
+            /* [out] */ DWORD *pAppDomainID) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE CreateDelegate( 
+            /* [in] */ DWORD appDomainID,
+            /* [in] */ LPCWSTR wszAssemblyName,
+            /* [in] */ LPCWSTR wszClassName,
+            /* [in] */ LPCWSTR wszMethodName,
+            /* [out] */ INT_PTR *fnPtr) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Authenticate( 
+            /* [in] */ ULONGLONG authKey) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE RegisterMacEHPort( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE SetStartupFlags( 
+            /* [in] */ STARTUP_FLAGS dwFlags) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE DllGetActivationFactory( 
+            /* [in] */ DWORD appDomainID,
+            /* [in] */ LPCWSTR wszTypeName,
+            /* [out] */ IActivationFactory **factory) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ExecuteAssembly( 
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ LPCWSTR pwzAssemblyPath,
+            /* [in] */ int argc,
+            /* [in] */ LPCWSTR *argv,
+            /* [out] */ DWORD *pReturnValue) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRRuntimeHost2Vtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRRuntimeHost2 * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRRuntimeHost2 * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Start )( 
+            ICLRRuntimeHost2 * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Stop )( 
+            ICLRRuntimeHost2 * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetHostControl )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ IHostControl *pHostControl);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCLRControl )( 
+            ICLRRuntimeHost2 * This,
+            /* [out] */ ICLRControl **pCLRControl);
+        
+        HRESULT ( STDMETHODCALLTYPE *UnloadAppDomain )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ BOOL fWaitUntilDone);
+        
+        HRESULT ( STDMETHODCALLTYPE *ExecuteInAppDomain )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ FExecuteInAppDomainCallback pCallback,
+            /* [in] */ void *cookie);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCurrentAppDomainId )( 
+            ICLRRuntimeHost2 * This,
+            /* [out] */ DWORD *pdwAppDomainId);
+        
+        HRESULT ( STDMETHODCALLTYPE *ExecuteApplication )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ LPCWSTR pwzAppFullName,
+            /* [in] */ DWORD dwManifestPaths,
+            /* [in] */ LPCWSTR *ppwzManifestPaths,
+            /* [in] */ DWORD dwActivationData,
+            /* [in] */ LPCWSTR *ppwzActivationData,
+            /* [out] */ int *pReturnValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *ExecuteInDefaultAppDomain )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ LPCWSTR pwzAssemblyPath,
+            /* [in] */ LPCWSTR pwzTypeName,
+            /* [in] */ LPCWSTR pwzMethodName,
+            /* [in] */ LPCWSTR pwzArgument,
+            /* [out] */ DWORD *pReturnValue);
+        
+        HRESULT ( STDMETHODCALLTYPE *CreateAppDomainWithManager )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ LPCWSTR wszFriendlyName,
+            /* [in] */ DWORD dwFlags,
+            /* [in] */ LPCWSTR wszAppDomainManagerAssemblyName,
+            /* [in] */ LPCWSTR wszAppDomainManagerTypeName,
+            /* [in] */ int nProperties,
+            /* [in] */ LPCWSTR *pPropertyNames,
+            /* [in] */ LPCWSTR *pPropertyValues,
+            /* [out] */ DWORD *pAppDomainID);
+        
+        HRESULT ( STDMETHODCALLTYPE *CreateDelegate )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ DWORD appDomainID,
+            /* [in] */ LPCWSTR wszAssemblyName,
+            /* [in] */ LPCWSTR wszClassName,
+            /* [in] */ LPCWSTR wszMethodName,
+            /* [out] */ INT_PTR *fnPtr);
+        
+        HRESULT ( STDMETHODCALLTYPE *Authenticate )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ ULONGLONG authKey);
+        
+        HRESULT ( STDMETHODCALLTYPE *RegisterMacEHPort )( 
+            ICLRRuntimeHost2 * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *SetStartupFlags )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ STARTUP_FLAGS dwFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *DllGetActivationFactory )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ DWORD appDomainID,
+            /* [in] */ LPCWSTR wszTypeName,
+            /* [out] */ IActivationFactory **factory);
+        
+        HRESULT ( STDMETHODCALLTYPE *ExecuteAssembly )( 
+            ICLRRuntimeHost2 * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ LPCWSTR pwzAssemblyPath,
+            /* [in] */ int argc,
+            /* [in] */ LPCWSTR *argv,
+            /* [out] */ DWORD *pReturnValue);
+        
+        END_INTERFACE
+    } ICLRRuntimeHost2Vtbl;
+
+    interface ICLRRuntimeHost2
+    {
+        CONST_VTBL struct ICLRRuntimeHost2Vtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRRuntimeHost2_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRRuntimeHost2_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRRuntimeHost2_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRRuntimeHost2_Start(This)	\
+    ( (This)->lpVtbl -> Start(This) ) 
+
+#define ICLRRuntimeHost2_Stop(This)	\
+    ( (This)->lpVtbl -> Stop(This) ) 
+
+#define ICLRRuntimeHost2_SetHostControl(This,pHostControl)	\
+    ( (This)->lpVtbl -> SetHostControl(This,pHostControl) ) 
+
+#define ICLRRuntimeHost2_GetCLRControl(This,pCLRControl)	\
+    ( (This)->lpVtbl -> GetCLRControl(This,pCLRControl) ) 
+
+#define ICLRRuntimeHost2_UnloadAppDomain(This,dwAppDomainId,fWaitUntilDone)	\
+    ( (This)->lpVtbl -> UnloadAppDomain(This,dwAppDomainId,fWaitUntilDone) ) 
+
+#define ICLRRuntimeHost2_ExecuteInAppDomain(This,dwAppDomainId,pCallback,cookie)	\
+    ( (This)->lpVtbl -> ExecuteInAppDomain(This,dwAppDomainId,pCallback,cookie) ) 
+
+#define ICLRRuntimeHost2_GetCurrentAppDomainId(This,pdwAppDomainId)	\
+    ( (This)->lpVtbl -> GetCurrentAppDomainId(This,pdwAppDomainId) ) 
+
+#define ICLRRuntimeHost2_ExecuteApplication(This,pwzAppFullName,dwManifestPaths,ppwzManifestPaths,dwActivationData,ppwzActivationData,pReturnValue)	\
+    ( (This)->lpVtbl -> ExecuteApplication(This,pwzAppFullName,dwManifestPaths,ppwzManifestPaths,dwActivationData,ppwzActivationData,pReturnValue) ) 
+
+#define ICLRRuntimeHost2_ExecuteInDefaultAppDomain(This,pwzAssemblyPath,pwzTypeName,pwzMethodName,pwzArgument,pReturnValue)	\
+    ( (This)->lpVtbl -> ExecuteInDefaultAppDomain(This,pwzAssemblyPath,pwzTypeName,pwzMethodName,pwzArgument,pReturnValue) ) 
+
+
+#define ICLRRuntimeHost2_CreateAppDomainWithManager(This,wszFriendlyName,dwFlags,wszAppDomainManagerAssemblyName,wszAppDomainManagerTypeName,nProperties,pPropertyNames,pPropertyValues,pAppDomainID)	\
+    ( (This)->lpVtbl -> CreateAppDomainWithManager(This,wszFriendlyName,dwFlags,wszAppDomainManagerAssemblyName,wszAppDomainManagerTypeName,nProperties,pPropertyNames,pPropertyValues,pAppDomainID) ) 
+
+#define ICLRRuntimeHost2_CreateDelegate(This,appDomainID,wszAssemblyName,wszClassName,wszMethodName,fnPtr)	\
+    ( (This)->lpVtbl -> CreateDelegate(This,appDomainID,wszAssemblyName,wszClassName,wszMethodName,fnPtr) ) 
+
+#define ICLRRuntimeHost2_Authenticate(This,authKey)	\
+    ( (This)->lpVtbl -> Authenticate(This,authKey) ) 
+
+#define ICLRRuntimeHost2_RegisterMacEHPort(This)	\
+    ( (This)->lpVtbl -> RegisterMacEHPort(This) ) 
+
+#define ICLRRuntimeHost2_SetStartupFlags(This,dwFlags)	\
+    ( (This)->lpVtbl -> SetStartupFlags(This,dwFlags) ) 
+
+#define ICLRRuntimeHost2_DllGetActivationFactory(This,appDomainID,wszTypeName,factory)	\
+    ( (This)->lpVtbl -> DllGetActivationFactory(This,appDomainID,wszTypeName,factory) ) 
+
+#define ICLRRuntimeHost2_ExecuteAssembly(This,dwAppDomainId,pwzAssemblyPath,argc,argv,pReturnValue)	\
+    ( (This)->lpVtbl -> ExecuteAssembly(This,dwAppDomainId,pwzAssemblyPath,argc,argv,pReturnValue) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRRuntimeHost2_INTERFACE_DEFINED__ */
+
+
+#ifndef __ICLRExecutionManager_INTERFACE_DEFINED__
+#define __ICLRExecutionManager_INTERFACE_DEFINED__
+
+/* interface ICLRExecutionManager */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_ICLRExecutionManager;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("1000A3E7-B420-4620-AE30-FB19B587AD1D")
+    ICLRExecutionManager : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE Pause( 
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ DWORD dwFlags) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Resume( 
+            /* [in] */ DWORD dwAppDomainId) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRExecutionManagerVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRExecutionManager * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRExecutionManager * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRExecutionManager * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *Pause )( 
+            ICLRExecutionManager * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [in] */ DWORD dwFlags);
+        
+        HRESULT ( STDMETHODCALLTYPE *Resume )( 
+            ICLRExecutionManager * This,
+            /* [in] */ DWORD dwAppDomainId);
+        
+        END_INTERFACE
+    } ICLRExecutionManagerVtbl;
+
+    interface ICLRExecutionManager
+    {
+        CONST_VTBL struct ICLRExecutionManagerVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRExecutionManager_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRExecutionManager_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRExecutionManager_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRExecutionManager_Pause(This,dwAppDomainId,dwFlags)	\
+    ( (This)->lpVtbl -> Pause(This,dwAppDomainId,dwFlags) ) 
+
+#define ICLRExecutionManager_Resume(This,dwAppDomainId)	\
+    ( (This)->lpVtbl -> Resume(This,dwAppDomainId) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRExecutionManager_INTERFACE_DEFINED__ */
+
+
+#ifndef __IHostNetCFDebugControlManager_INTERFACE_DEFINED__
+#define __IHostNetCFDebugControlManager_INTERFACE_DEFINED__
+
+/* interface IHostNetCFDebugControlManager */
+/* [object][local][unique][helpstring][version][uuid] */ 
+
+
+EXTERN_C const IID IID_IHostNetCFDebugControlManager;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("F2833A0C-F944-48d8-940E-F59425EDBFCF")
+    IHostNetCFDebugControlManager : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE NotifyPause( 
+            DWORD dwReserved) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE NotifyResume( 
+            DWORD dwReserved) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct IHostNetCFDebugControlManagerVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IHostNetCFDebugControlManager * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IHostNetCFDebugControlManager * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IHostNetCFDebugControlManager * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *NotifyPause )( 
+            IHostNetCFDebugControlManager * This,
+            DWORD dwReserved);
+        
+        HRESULT ( STDMETHODCALLTYPE *NotifyResume )( 
+            IHostNetCFDebugControlManager * This,
+            DWORD dwReserved);
+        
+        END_INTERFACE
+    } IHostNetCFDebugControlManagerVtbl;
+
+    interface IHostNetCFDebugControlManager
+    {
+        CONST_VTBL struct IHostNetCFDebugControlManagerVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IHostNetCFDebugControlManager_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IHostNetCFDebugControlManager_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IHostNetCFDebugControlManager_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IHostNetCFDebugControlManager_NotifyPause(This,dwReserved)	\
+    ( (This)->lpVtbl -> NotifyPause(This,dwReserved) ) 
+
+#define IHostNetCFDebugControlManager_NotifyResume(This,dwReserved)	\
+    ( (This)->lpVtbl -> NotifyResume(This,dwReserved) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IHostNetCFDebugControlManager_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0013 */
+/* [local] */ 
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0013_0001
+    {
+        eNoChecks	= 0,
+        eSynchronization	= 0x1,
+        eSharedState	= 0x2,
+        eExternalProcessMgmt	= 0x4,
+        eSelfAffectingProcessMgmt	= 0x8,
+        eExternalThreading	= 0x10,
+        eSelfAffectingThreading	= 0x20,
+        eSecurityInfrastructure	= 0x40,
+        eUI	= 0x80,
+        eMayLeakOnAbort	= 0x100,
+        eAll	= 0x1ff
+    } 	EApiCategories;
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0013_0002
+    {
+        eInitializeNewDomainFlags_None	= 0,
+        eInitializeNewDomainFlags_NoSecurityChanges	= 0x2
+    } 	EInitializeNewDomainFlags;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0013_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0013_v0_0_s_ifspec;
+
+
+#ifndef __mscoree_LIBRARY_DEFINED__
+#define __mscoree_LIBRARY_DEFINED__
+
+/* library mscoree */
+/* [helpstring][version][uuid] */ 
+
+#define CCW_PTR int *
+
+EXTERN_C const IID LIBID_mscoree;
+
+#ifndef __ITypeName_INTERFACE_DEFINED__
+#define __ITypeName_INTERFACE_DEFINED__
+
+/* interface ITypeName */
+/* [unique][helpstring][uuid][oleautomation][object] */ 
+
+
+EXTERN_C const IID IID_ITypeName;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("B81FF171-20F3-11d2-8DCC-00A0C9B00522")
+    ITypeName : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetNameCount( 
+            /* [retval][out] */ DWORD *pCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetNames( 
+            /* [in] */ DWORD count,
+            /* [out] */ BSTR *rgbszNames,
+            /* [retval][out] */ DWORD *pCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetTypeArgumentCount( 
+            /* [retval][out] */ DWORD *pCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetTypeArguments( 
+            /* [in] */ DWORD count,
+            /* [out] */ ITypeName **rgpArguments,
+            /* [retval][out] */ DWORD *pCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetModifierLength( 
+            /* [retval][out] */ DWORD *pCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetModifiers( 
+            /* [in] */ DWORD count,
+            /* [out] */ DWORD *rgModifiers,
+            /* [retval][out] */ DWORD *pCount) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetAssemblyName( 
+            /* [retval][out] */ BSTR *rgbszAssemblyNames) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ITypeNameVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ITypeName * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ITypeName * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ITypeName * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetNameCount )( 
+            ITypeName * This,
+            /* [retval][out] */ DWORD *pCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetNames )( 
+            ITypeName * This,
+            /* [in] */ DWORD count,
+            /* [out] */ BSTR *rgbszNames,
+            /* [retval][out] */ DWORD *pCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetTypeArgumentCount )( 
+            ITypeName * This,
+            /* [retval][out] */ DWORD *pCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetTypeArguments )( 
+            ITypeName * This,
+            /* [in] */ DWORD count,
+            /* [out] */ ITypeName **rgpArguments,
+            /* [retval][out] */ DWORD *pCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetModifierLength )( 
+            ITypeName * This,
+            /* [retval][out] */ DWORD *pCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetModifiers )( 
+            ITypeName * This,
+            /* [in] */ DWORD count,
+            /* [out] */ DWORD *rgModifiers,
+            /* [retval][out] */ DWORD *pCount);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetAssemblyName )( 
+            ITypeName * This,
+            /* [retval][out] */ BSTR *rgbszAssemblyNames);
+        
+        END_INTERFACE
+    } ITypeNameVtbl;
+
+    interface ITypeName
+    {
+        CONST_VTBL struct ITypeNameVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ITypeName_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ITypeName_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ITypeName_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ITypeName_GetNameCount(This,pCount)	\
+    ( (This)->lpVtbl -> GetNameCount(This,pCount) ) 
+
+#define ITypeName_GetNames(This,count,rgbszNames,pCount)	\
+    ( (This)->lpVtbl -> GetNames(This,count,rgbszNames,pCount) ) 
+
+#define ITypeName_GetTypeArgumentCount(This,pCount)	\
+    ( (This)->lpVtbl -> GetTypeArgumentCount(This,pCount) ) 
+
+#define ITypeName_GetTypeArguments(This,count,rgpArguments,pCount)	\
+    ( (This)->lpVtbl -> GetTypeArguments(This,count,rgpArguments,pCount) ) 
+
+#define ITypeName_GetModifierLength(This,pCount)	\
+    ( (This)->lpVtbl -> GetModifierLength(This,pCount) ) 
+
+#define ITypeName_GetModifiers(This,count,rgModifiers,pCount)	\
+    ( (This)->lpVtbl -> GetModifiers(This,count,rgModifiers,pCount) ) 
+
+#define ITypeName_GetAssemblyName(This,rgbszAssemblyNames)	\
+    ( (This)->lpVtbl -> GetAssemblyName(This,rgbszAssemblyNames) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ITypeName_INTERFACE_DEFINED__ */
+
+
+#ifndef __ITypeNameBuilder_INTERFACE_DEFINED__
+#define __ITypeNameBuilder_INTERFACE_DEFINED__
+
+/* interface ITypeNameBuilder */
+/* [unique][helpstring][uuid][oleautomation][object] */ 
+
+
+EXTERN_C const IID IID_ITypeNameBuilder;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("B81FF171-20F3-11d2-8DCC-00A0C9B00523")
+    ITypeNameBuilder : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE OpenGenericArguments( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE CloseGenericArguments( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE OpenGenericArgument( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE CloseGenericArgument( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE AddName( 
+            /* [in] */ LPCWSTR szName) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE AddPointer( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE AddByRef( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE AddSzArray( void) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE AddArray( 
+            /* [in] */ DWORD rank) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE AddAssemblySpec( 
+            /* [in] */ LPCWSTR szAssemblySpec) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE ToString( 
+            /* [retval][out] */ BSTR *pszStringRepresentation) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE Clear( void) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ITypeNameBuilderVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ITypeNameBuilder * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ITypeNameBuilder * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *OpenGenericArguments )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *CloseGenericArguments )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *OpenGenericArgument )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *CloseGenericArgument )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *AddName )( 
+            ITypeNameBuilder * This,
+            /* [in] */ LPCWSTR szName);
+        
+        HRESULT ( STDMETHODCALLTYPE *AddPointer )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *AddByRef )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *AddSzArray )( 
+            ITypeNameBuilder * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *AddArray )( 
+            ITypeNameBuilder * This,
+            /* [in] */ DWORD rank);
+        
+        HRESULT ( STDMETHODCALLTYPE *AddAssemblySpec )( 
+            ITypeNameBuilder * This,
+            /* [in] */ LPCWSTR szAssemblySpec);
+        
+        HRESULT ( STDMETHODCALLTYPE *ToString )( 
+            ITypeNameBuilder * This,
+            /* [retval][out] */ BSTR *pszStringRepresentation);
+        
+        HRESULT ( STDMETHODCALLTYPE *Clear )( 
+            ITypeNameBuilder * This);
+        
+        END_INTERFACE
+    } ITypeNameBuilderVtbl;
+
+    interface ITypeNameBuilder
+    {
+        CONST_VTBL struct ITypeNameBuilderVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ITypeNameBuilder_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ITypeNameBuilder_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ITypeNameBuilder_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ITypeNameBuilder_OpenGenericArguments(This)	\
+    ( (This)->lpVtbl -> OpenGenericArguments(This) ) 
+
+#define ITypeNameBuilder_CloseGenericArguments(This)	\
+    ( (This)->lpVtbl -> CloseGenericArguments(This) ) 
+
+#define ITypeNameBuilder_OpenGenericArgument(This)	\
+    ( (This)->lpVtbl -> OpenGenericArgument(This) ) 
+
+#define ITypeNameBuilder_CloseGenericArgument(This)	\
+    ( (This)->lpVtbl -> CloseGenericArgument(This) ) 
+
+#define ITypeNameBuilder_AddName(This,szName)	\
+    ( (This)->lpVtbl -> AddName(This,szName) ) 
+
+#define ITypeNameBuilder_AddPointer(This)	\
+    ( (This)->lpVtbl -> AddPointer(This) ) 
+
+#define ITypeNameBuilder_AddByRef(This)	\
+    ( (This)->lpVtbl -> AddByRef(This) ) 
+
+#define ITypeNameBuilder_AddSzArray(This)	\
+    ( (This)->lpVtbl -> AddSzArray(This) ) 
+
+#define ITypeNameBuilder_AddArray(This,rank)	\
+    ( (This)->lpVtbl -> AddArray(This,rank) ) 
+
+#define ITypeNameBuilder_AddAssemblySpec(This,szAssemblySpec)	\
+    ( (This)->lpVtbl -> AddAssemblySpec(This,szAssemblySpec) ) 
+
+#define ITypeNameBuilder_ToString(This,pszStringRepresentation)	\
+    ( (This)->lpVtbl -> ToString(This,pszStringRepresentation) ) 
+
+#define ITypeNameBuilder_Clear(This)	\
+    ( (This)->lpVtbl -> Clear(This) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ITypeNameBuilder_INTERFACE_DEFINED__ */
+
+
+#ifndef __ITypeNameFactory_INTERFACE_DEFINED__
+#define __ITypeNameFactory_INTERFACE_DEFINED__
+
+/* interface ITypeNameFactory */
+/* [unique][helpstring][uuid][oleautomation][object] */ 
+
+
+EXTERN_C const IID IID_ITypeNameFactory;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("B81FF171-20F3-11d2-8DCC-00A0C9B00521")
+    ITypeNameFactory : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE ParseTypeName( 
+            /* [in] */ LPCWSTR szName,
+            /* [out] */ DWORD *pError,
+            /* [retval][out] */ ITypeName **ppTypeName) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetTypeNameBuilder( 
+            /* [retval][out] */ ITypeNameBuilder **ppTypeBuilder) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ITypeNameFactoryVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ITypeNameFactory * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ITypeNameFactory * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ITypeNameFactory * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *ParseTypeName )( 
+            ITypeNameFactory * This,
+            /* [in] */ LPCWSTR szName,
+            /* [out] */ DWORD *pError,
+            /* [retval][out] */ ITypeName **ppTypeName);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetTypeNameBuilder )( 
+            ITypeNameFactory * This,
+            /* [retval][out] */ ITypeNameBuilder **ppTypeBuilder);
+        
+        END_INTERFACE
+    } ITypeNameFactoryVtbl;
+
+    interface ITypeNameFactory
+    {
+        CONST_VTBL struct ITypeNameFactoryVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ITypeNameFactory_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ITypeNameFactory_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ITypeNameFactory_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ITypeNameFactory_ParseTypeName(This,szName,pError,ppTypeName)	\
+    ( (This)->lpVtbl -> ParseTypeName(This,szName,pError,ppTypeName) ) 
+
+#define ITypeNameFactory_GetTypeNameBuilder(This,ppTypeBuilder)	\
+    ( (This)->lpVtbl -> GetTypeNameBuilder(This,ppTypeBuilder) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ITypeNameFactory_INTERFACE_DEFINED__ */
+
+
+#ifndef __IManagedObject_INTERFACE_DEFINED__
+#define __IManagedObject_INTERFACE_DEFINED__
+
+/* interface IManagedObject */
+/* [proxy][unique][helpstring][uuid][oleautomation][object] */ 
+
+
+EXTERN_C const IID IID_IManagedObject;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("C3FCC19E-A970-11d2-8B5A-00A0C9B7C9C4")
+    IManagedObject : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetSerializedBuffer( 
+            /* [out] */ BSTR *pBSTR) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetObjectIdentity( 
+            /* [out] */ BSTR *pBSTRGUID,
+            /* [out] */ int *AppDomainID,
+            /* [out] */ int *pCCW) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct IManagedObjectVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            IManagedObject * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            IManagedObject * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            IManagedObject * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetSerializedBuffer )( 
+            IManagedObject * This,
+            /* [out] */ BSTR *pBSTR);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetObjectIdentity )( 
+            IManagedObject * This,
+            /* [out] */ BSTR *pBSTRGUID,
+            /* [out] */ int *AppDomainID,
+            /* [out] */ int *pCCW);
+        
+        END_INTERFACE
+    } IManagedObjectVtbl;
+
+    interface IManagedObject
+    {
+        CONST_VTBL struct IManagedObjectVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define IManagedObject_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define IManagedObject_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define IManagedObject_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define IManagedObject_GetSerializedBuffer(This,pBSTR)	\
+    ( (This)->lpVtbl -> GetSerializedBuffer(This,pBSTR) ) 
+
+#define IManagedObject_GetObjectIdentity(This,pBSTRGUID,AppDomainID,pCCW)	\
+    ( (This)->lpVtbl -> GetObjectIdentity(This,pBSTRGUID,AppDomainID,pCCW) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __IManagedObject_INTERFACE_DEFINED__ */
+
+
+EXTERN_C const CLSID CLSID_ComCallUnmarshal;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("3F281000-E95A-11d2-886B-00C04F869F04")
+ComCallUnmarshal;
+#endif
+
+EXTERN_C const CLSID CLSID_ComCallUnmarshalV4;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("45FB4600-E6E8-4928-B25E-50476FF79425")
+ComCallUnmarshalV4;
+#endif
+
+EXTERN_C const CLSID CLSID_CLRRuntimeHost;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("90F1A06E-7712-4762-86B5-7A5EBA6BDB02")
+CLRRuntimeHost;
+#endif
+
+EXTERN_C const CLSID CLSID_TypeNameFactory;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("B81FF171-20F3-11d2-8DCC-00A0C9B00525")
+TypeNameFactory;
+#endif
+#endif /* __mscoree_LIBRARY_DEFINED__ */
+
+/* interface __MIDL_itf_mscoree_0000_0014 */
+/* [local] */ 
+
+typedef /* [public] */ 
+enum __MIDL___MIDL_itf_mscoree_0000_0014_0001
+    {
+        eCurrentContext	= 0,
+        eRestrictedContext	= 0x1
+    } 	EContextType;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0014_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0014_v0_0_s_ifspec;
+
+#ifndef __ICLRAppDomainResourceMonitor_INTERFACE_DEFINED__
+#define __ICLRAppDomainResourceMonitor_INTERFACE_DEFINED__
+
+/* interface ICLRAppDomainResourceMonitor */
+/* [object][local][unique][helpstring][uuid][version] */ 
+
+
+EXTERN_C const IID IID_ICLRAppDomainResourceMonitor;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+    
+    MIDL_INTERFACE("c62de18c-2e23-4aea-8423-b40c1fc59eae")
+    ICLRAppDomainResourceMonitor : public IUnknown
+    {
+    public:
+        virtual HRESULT STDMETHODCALLTYPE GetCurrentAllocated( 
+            /* [in] */ DWORD dwAppDomainId,
+            /* [out] */ ULONGLONG *pBytesAllocated) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetCurrentSurvived( 
+            /* [in] */ DWORD dwAppDomainId,
+            /* [out] */ ULONGLONG *pAppDomainBytesSurvived,
+            /* [out] */ ULONGLONG *pTotalBytesSurvived) = 0;
+        
+        virtual HRESULT STDMETHODCALLTYPE GetCurrentCpuTime( 
+            /* [in] */ DWORD dwAppDomainId,
+            /* [out] */ ULONGLONG *pMilliseconds) = 0;
+        
+    };
+    
+    
+#else 	/* C style interface */
+
+    typedef struct ICLRAppDomainResourceMonitorVtbl
+    {
+        BEGIN_INTERFACE
+        
+        HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
+            ICLRAppDomainResourceMonitor * This,
+            /* [in] */ REFIID riid,
+            /* [annotation][iid_is][out] */ 
+            _COM_Outptr_  void **ppvObject);
+        
+        ULONG ( STDMETHODCALLTYPE *AddRef )( 
+            ICLRAppDomainResourceMonitor * This);
+        
+        ULONG ( STDMETHODCALLTYPE *Release )( 
+            ICLRAppDomainResourceMonitor * This);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCurrentAllocated )( 
+            ICLRAppDomainResourceMonitor * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [out] */ ULONGLONG *pBytesAllocated);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCurrentSurvived )( 
+            ICLRAppDomainResourceMonitor * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [out] */ ULONGLONG *pAppDomainBytesSurvived,
+            /* [out] */ ULONGLONG *pTotalBytesSurvived);
+        
+        HRESULT ( STDMETHODCALLTYPE *GetCurrentCpuTime )( 
+            ICLRAppDomainResourceMonitor * This,
+            /* [in] */ DWORD dwAppDomainId,
+            /* [out] */ ULONGLONG *pMilliseconds);
+        
+        END_INTERFACE
+    } ICLRAppDomainResourceMonitorVtbl;
+
+    interface ICLRAppDomainResourceMonitor
+    {
+        CONST_VTBL struct ICLRAppDomainResourceMonitorVtbl *lpVtbl;
+    };
+
+    
+
+#ifdef COBJMACROS
+
+
+#define ICLRAppDomainResourceMonitor_QueryInterface(This,riid,ppvObject)	\
+    ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) 
+
+#define ICLRAppDomainResourceMonitor_AddRef(This)	\
+    ( (This)->lpVtbl -> AddRef(This) ) 
+
+#define ICLRAppDomainResourceMonitor_Release(This)	\
+    ( (This)->lpVtbl -> Release(This) ) 
+
+
+#define ICLRAppDomainResourceMonitor_GetCurrentAllocated(This,dwAppDomainId,pBytesAllocated)	\
+    ( (This)->lpVtbl -> GetCurrentAllocated(This,dwAppDomainId,pBytesAllocated) ) 
+
+#define ICLRAppDomainResourceMonitor_GetCurrentSurvived(This,dwAppDomainId,pAppDomainBytesSurvived,pTotalBytesSurvived)	\
+    ( (This)->lpVtbl -> GetCurrentSurvived(This,dwAppDomainId,pAppDomainBytesSurvived,pTotalBytesSurvived) ) 
+
+#define ICLRAppDomainResourceMonitor_GetCurrentCpuTime(This,dwAppDomainId,pMilliseconds)	\
+    ( (This)->lpVtbl -> GetCurrentCpuTime(This,dwAppDomainId,pMilliseconds) ) 
+
+#endif /* COBJMACROS */
+
+
+#endif 	/* C style interface */
+
+
+
+
+#endif 	/* __ICLRAppDomainResourceMonitor_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_mscoree_0000_0015 */
+/* [local] */ 
+
+#undef DEPRECATED_CLR_STDAPI
+#undef DECLARE_DEPRECATED
+#undef DEPRECATED_CLR_API_MESG
+
+
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0015_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_mscoree_0000_0015_v0_0_s_ifspec;
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+

+ 615 - 0
Source/AtomicNET/NETCore/Platforms/Windows/prebuilt/palclr.h

@@ -0,0 +1,615 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+// ===========================================================================
+// File: palclr.h
+//
+// Various macros and constants that are necessary to make the CLR portable.
+//
+
+// ===========================================================================
+
+
+#if !defined(FEATURE_PAL)
+
+#ifndef __PALCLR_H__
+#define __PALCLR_H__
+
+// This macro is used to standardize the wide character string literals between UNIX and Windows.
+// Unix L"" is UTF32, and on windows it's UTF16.  Because of built-in assumptions on the size
+// of string literals, it's important to match behaviour between Unix and Windows.  Unix will be defined
+// as u"" (char16_t)
+#ifdef PLATFORM_UNIX
+#define W(str)  u##str
+#else // PLATFORM_UNIX
+#define W(str)  L##str
+#endif // PLATFORM_UNIX
+
+#include <windef.h>
+
+#if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+//
+// CPP_ASSERT() can be used within a class definition, to perform a
+// compile-time assertion involving private names within the class.
+//
+// MS compiler doesn't allow redefinition of the typedef within a template.
+// gcc doesn't allow redefinition of the typedef within a class, though 
+// it does at file scope.
+#define CPP_ASSERT(n, e) typedef char __C_ASSERT__##n[(e) ? 1 : -1];
+
+
+// PORTABILITY_ASSERT and PORTABILITY_WARNING macros are meant to be used to
+// mark places in the code that needs attention for portability. The usual
+// usage pattern is:
+//
+// int get_scratch_register() {
+// #if defined(_TARGET_X86_)
+//     return eax;
+// #elif defined(_TARGET_AMD64_)
+//     return rax;
+// #elif defined(_TARGET_ARM_)
+//     return r0;
+// #else
+//     PORTABILITY_ASSERT("scratch register");
+//     return 0;
+// #endif
+// }
+//
+// PORTABILITY_ASSERT is meant to be used inside functions/methods. It can
+// introduce compile-time and/or run-time errors.
+// PORTABILITY_WARNING is meant to be used outside functions/methods. It can
+// introduce compile-time errors or warnings only.
+//
+// People starting new ports will first define these to just cause run-time
+// errors. Once they fix all the places that need attention for portability,
+// they can define PORTABILITY_ASSERT and PORTABILITY_WARNING to cause
+// compile-time errors to make sure that they haven't missed anything.
+// 
+// If it is reasonably possible all codepaths containing PORTABILITY_ASSERT
+// should be compilable (e.g. functions should return NULL or something if
+// they are expected to return a value).
+//
+// The message in these two macros should not contain any keywords like TODO
+// or NYI. It should be just the brief description of the problem.
+
+#if defined(_TARGET_X86_)
+// Finished ports - compile-time errors
+#define PORTABILITY_WARNING(message)    NEED_TO_PORT_THIS_ONE(NEED_TO_PORT_THIS_ONE)
+#define PORTABILITY_ASSERT(message)     NEED_TO_PORT_THIS_ONE(NEED_TO_PORT_THIS_ONE)
+#else
+// Ports in progress - run-time asserts only
+#define PORTABILITY_WARNING(message)
+#define PORTABILITY_ASSERT(message)     _ASSERTE(false && message)
+#endif
+
+#define DIRECTORY_SEPARATOR_CHAR_A '\\'
+#define DIRECTORY_SEPARATOR_CHAR_W W('\\')
+#define DIRECTORY_SEPARATOR_STR_W W("\\")
+
+#define PATH_SEPARATOR_CHAR_W W(';')
+#define PATH_SEPARATOR_STR_W W(";")
+
+#define VOLUME_SEPARATOR_CHAR_W W(':')
+
+// PAL Macros
+// Not all compilers support fully anonymous aggregate types, so the
+// PAL provides names for those types. To allow existing definitions of
+// those types to continue to work, we provide macros that should be
+// used to reference fields within those types.
+
+#ifndef DECIMAL_SCALE
+#define DECIMAL_SCALE(dec)       ((dec).scale)
+#endif
+
+#ifndef DECIMAL_SIGN
+#define DECIMAL_SIGN(dec)        ((dec).sign)
+#endif
+
+#ifndef DECIMAL_SIGNSCALE
+#define DECIMAL_SIGNSCALE(dec)   ((dec).signscale)
+#endif
+
+#ifndef DECIMAL_LO32
+#define DECIMAL_LO32(dec)        ((dec).Lo32)
+#endif
+
+#ifndef DECIMAL_MID32
+#define DECIMAL_MID32(dec)       ((dec).Mid32)
+#endif
+
+#ifndef DECIMAL_HI32
+#define DECIMAL_HI32(dec)       ((dec).Hi32)
+#endif
+
+#ifndef DECIMAL_LO64_GET
+#define DECIMAL_LO64_GET(dec)       ((dec).Lo64)
+#endif
+
+#ifndef DECIMAL_LO64_SET
+#define DECIMAL_LO64_SET(dec,value)   {(dec).Lo64 = value; }
+#endif
+
+#ifndef IMAGE_RELOC_FIELD
+#define IMAGE_RELOC_FIELD(img, f)      ((img).f)
+#endif
+
+#ifndef IMAGE_IMPORT_DESC_FIELD
+#define IMAGE_IMPORT_DESC_FIELD(img, f)     ((img).f)
+#endif
+
+//Remove these "unanonymous" unions from newer builds for now.  Confirm that they were never needed when we
+//bring back Rotor.
+#define IMAGE_RDE_ID(img) ((img)->Id)
+#ifndef IMAGE_RDE_ID
+#define IMAGE_RDE_ID(img)        ((img)->Id)
+#endif
+
+#define IMAGE_RDE_NAME(img) ((img)->Name)
+#ifndef IMAGE_RDE_NAME
+#define IMAGE_RDE_NAME(img)      ((img)->Name)
+#endif
+
+#define IMAGE_RDE_OFFSET(img) ((img)->OffsetToData)
+#ifndef IMAGE_RDE_OFFSET
+#define IMAGE_RDE_OFFSET(img)    ((img)->OffsetToData)
+#endif
+
+#ifndef IMAGE_RDE_NAME_FIELD
+#define IMAGE_RDE_NAME_FIELD(img, f)    ((img)->f)
+#endif
+
+#define IMAGE_RDE_OFFSET_FIELD(img, f) ((img)->f)
+#ifndef IMAGE_RDE_OFFSET_FIELD
+#define IMAGE_RDE_OFFSET_FIELD(img, f)  ((img)->f)
+#endif
+
+#ifndef IMAGE_FE64_FIELD
+#define IMAGE_FE64_FIELD(img, f)    ((img).f)
+#endif
+
+#ifndef IMPORT_OBJ_HEADER_FIELD
+#define IMPORT_OBJ_HEADER_FIELD(obj, f)    ((obj).f)
+#endif
+
+#ifndef IMAGE_COR20_HEADER_FIELD
+#define IMAGE_COR20_HEADER_FIELD(obj, f)    ((obj).f)
+#endif
+
+
+// PAL Numbers
+// Used to ensure cross-compiler compatibility when declaring large
+// integer constants. 64-bit integer constants should be wrapped in the
+// declarations listed here.
+//
+// Each of the #defines here is wrapped to avoid conflicts with rotor_pal.h.
+
+#if defined(_MSC_VER)
+
+// MSVC's way of declaring large integer constants
+// If you define these in one step, without the _HELPER macros, you
+// get extra whitespace when composing these with other concatenating macros.
+#ifndef I64
+#define I64_HELPER(x) x ## i64
+#define I64(x)        I64_HELPER(x)
+#endif
+
+#ifndef UI64
+#define UI64_HELPER(x) x ## ui64
+#define UI64(x)        UI64_HELPER(x)
+#endif
+
+#else
+
+// GCC's way of declaring large integer constants
+// If you define these in one step, without the _HELPER macros, you
+// get extra whitespace when composing these with other concatenating macros.
+#ifndef I64
+#define I64_HELPER(x) x ## LL
+#define I64(x)        I64_HELPER(x)
+#endif
+
+#ifndef UI64
+#define UI64_HELPER(x) x ## ULL
+#define UI64(x)        UI64_HELPER(x)
+#endif
+
+#endif
+
+
+// PAL SEH
+// Macros for portable exception handling. The Win32 SEH is emulated using
+// these macros and setjmp/longjmp on Unix
+//
+// Usage notes:
+//
+// - The filter has to be a function taking two parameters:
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+//
+// - It is not possible to directly use the local variables in the filter.
+// All the local information that the filter has to need to know about should
+// be passed through pv parameter
+//  
+// - Do not use goto to jump out of the PAL_TRY block
+// (jumping out of the try block is not a good idea even on Win32, because of
+// it causes stack unwind)
+//
+// - It is not possible to directly use the local variables in the try block.
+// All the local information that the filter has to need to know about should
+// be passed through pv parameter
+//
+//
+// Simple examples:
+//
+// struct Param { ... local variables used in try block and filter ... } param;
+// PAL_TRY(Param *, pParam, &param) { // read as: Param *pParam = &param;
+//   ....
+// } PAL_FINALLY {
+//   ....
+// }
+// PAL_ENDTRY
+//
+//
+// struct Param { ... local variables used in try block and filter ... } param;
+// PAL_TRY(Param *, pParam, &param) {
+//   ....
+// } PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
+//   ....
+// }
+// PAL_ENDTRY
+// 
+//
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+// {
+// ...
+// }
+// PAL_TRY(void *, unused, NULL) {
+//   ....
+// } PAL_EXCEPT_FILTER(MyFilter) {
+//   ....
+// }
+// PAL_ENDTRY
+//
+//
+// Complex example:
+//
+// struct MyParams
+// {
+//     ...
+// } params;
+//
+// PAL_TRY(MyParams *, pMyParamsOuter, &params) {
+//   PAL_TRY(MyParams *, pMyParamsInnter, pMyParamsOuter) {
+//       ...
+//       if (error) goto Done;
+//       ...
+//   Done: ;
+//   } PAL_EXCEPT_FILTER(OtherFilter) {
+//   ...
+//   }
+//   PAL_ENDTRY
+// }
+// PAL_FINALLY {
+// }
+// PAL_ENDTRY
+//
+
+#include "staticcontract.h"
+
+// Note: PAL_SEH_RESTORE_GUARD_PAGE is only ever defined in clrex.h, so we only restore guard pages automatically
+// when these macros are used from within the VM.
+#define PAL_SEH_RESTORE_GUARD_PAGE
+
+#define PAL_TRY_NAKED                                                           \
+    {                                                                           \
+        bool __exHandled; __exHandled = false;                                  \
+        DWORD __exCode; __exCode = 0;                                           \
+        SCAN_EHMARKER();                                                        \
+        __try                                                                   \
+        {                                                                       \
+            SCAN_EHMARKER_TRY();
+
+#define PAL_EXCEPT_NAKED(Disposition)                                           \
+        }                                                                       \
+        __except(__exCode = GetExceptionCode(), Disposition)                    \
+        {                                                                       \
+            __exHandled = true;                                                 \
+            SCAN_EHMARKER_CATCH();                                              \
+            PAL_SEH_RESTORE_GUARD_PAGE
+
+#define PAL_EXCEPT_FILTER_NAKED(pfnFilter, param)                               \
+        }                                                                       \
+        __except(__exCode = GetExceptionCode(),                                 \
+                 pfnFilter(GetExceptionInformation(), param))                   \
+        {                                                                       \
+            __exHandled = true;                                                 \
+            SCAN_EHMARKER_CATCH();                                              \
+            PAL_SEH_RESTORE_GUARD_PAGE
+
+#define PAL_FINALLY_NAKED                                                       \
+        }                                                                       \
+        __finally                                                               \
+        {                                                                       \
+
+#define PAL_ENDTRY_NAKED                                                        \
+        }                                                                       \
+        PAL_ENDTRY_NAKED_DBG                                                    \
+    }                                                                           \
+
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE)
+//
+// In debug mode, compile the try body as a method of a local class.
+// This way, the compiler will check that the body is not directly
+// accessing any local variables and arguments.
+//
+#define PAL_TRY(__ParamType, __paramDef, __paramRef)                            \
+{                                                                               \
+    __ParamType __param = __paramRef;                                           \
+    __ParamType __paramToPassToFilter = __paramRef;                             \
+    class __Body                                                                \
+    {                                                                           \
+    public:                                                                     \
+        static void Run(__ParamType __paramDef)                                 \
+    {                                                                           \
+        PAL_TRY_HANDLER_DBG_BEGIN
+
+// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by
+// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods
+// as on PAL.
+#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef)                         \
+{                                                                               \
+    struct __HandlerData {                                                      \
+        __ParamType __param;                                                    \
+        COMPILER_INSTANCE *__ciPtr;                                             \
+    };                                                                          \
+    __HandlerData handlerData;                                                  \
+    handlerData.__param = __paramRef;                                           \
+    handlerData.__ciPtr = ciPtr;                                                \
+     __HandlerData* __param = &handlerData;                                     \
+    __ParamType __paramToPassToFilter = __paramRef;                             \
+    class __Body                                                                \
+    {                                                                           \
+    public:                                                                     \
+    static void Run(__HandlerData* __pHandlerData)                              \
+    {                                                                           \
+    PAL_TRY_HANDLER_DBG_BEGIN                                                   \
+        COMPILER_INSTANCE *ciPtr = __pHandlerData->__ciPtr;                     \
+        __ParamType __paramDef = __pHandlerData->__param;
+
+
+#define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason)      \
+{                                                                               \
+    __ParamType __param = __paramRef;                                           \
+    __ParamType __paramToPassToFilter = __paramRef;                             \
+    class __Body                                                                \
+    {                                                                           \
+    public:                                                                     \
+        static void Run(__ParamType __paramDef)                                 \
+    {                                                                           \
+            PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(__reason)
+ 
+#define PAL_EXCEPT(Disposition)                                                 \
+            PAL_TRY_HANDLER_DBG_END                                             \
+        }                                                                       \
+    };                                                                          \
+        PAL_TRY_NAKED                                                           \
+    __Body::Run(__param);                                                       \
+    PAL_EXCEPT_NAKED(Disposition)
+
+#define PAL_EXCEPT_FILTER(pfnFilter)                                            \
+            PAL_TRY_HANDLER_DBG_END                                             \
+        }                                                                       \
+    };                                                                          \
+    PAL_TRY_NAKED                                                               \
+    __Body::Run(__param);                                                       \
+    PAL_EXCEPT_FILTER_NAKED(pfnFilter, __paramToPassToFilter)
+
+#define PAL_FINALLY                                                             \
+            PAL_TRY_HANDLER_DBG_END                                             \
+        }                                                                       \
+    };                                                                          \
+    PAL_TRY_NAKED                                                               \
+    __Body::Run(__param);                                                       \
+    PAL_FINALLY_NAKED
+
+#define PAL_ENDTRY                                                              \
+    PAL_ENDTRY_NAKED                                                            \
+}
+
+#else // _DEBUG
+
+#define PAL_TRY(__ParamType, __paramDef, __paramRef)                            \
+{                                                                               \
+    __ParamType __param = __paramRef;                                           \
+    __ParamType __paramDef = __param;                                           \
+    PAL_TRY_NAKED                                                               \
+    PAL_TRY_HANDLER_DBG_BEGIN
+
+// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by
+// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods
+// as on PAL.
+#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef) PAL_TRY(__ParamType, __paramDef, __paramRef)
+
+#define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason)      \
+{                                                                               \
+    __ParamType __param = __paramRef;                                           \
+    __ParamType __paramDef; __paramDef = __param;                               \
+    PAL_TRY_NAKED                                                               \
+    PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(__reason)
+ 
+#define PAL_EXCEPT(Disposition)                                                 \
+        PAL_TRY_HANDLER_DBG_END                                                 \
+        PAL_EXCEPT_NAKED(Disposition)
+
+#define PAL_EXCEPT_FILTER(pfnFilter)                                            \
+        PAL_TRY_HANDLER_DBG_END                                                 \
+        PAL_EXCEPT_FILTER_NAKED(pfnFilter, __param)
+
+#define PAL_FINALLY                                                             \
+        PAL_TRY_HANDLER_DBG_END                                                 \
+        PAL_FINALLY_NAKED
+
+#define PAL_ENDTRY                                                              \
+    PAL_ENDTRY_NAKED                                                            \
+    }
+
+#endif // _DEBUG
+
+// Executes the handler if the specified exception code matches
+// the one in the exception. Otherwise, returns EXCEPTION_CONTINUE_SEARCH.
+#define PAL_EXCEPT_IF_EXCEPTION_CODE(dwExceptionCode) PAL_EXCEPT((GetExceptionCode() == dwExceptionCode)?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH)
+
+#define PAL_CPP_TRY try
+#define PAL_CPP_ENDTRY
+#define PAL_CPP_THROW(type, obj) do { SCAN_THROW_MARKER; throw obj; } while (false)
+#define PAL_CPP_RETHROW do { SCAN_THROW_MARKER; throw; } while (false)
+#define PAL_CPP_CATCH_DERIVED(type, obj) catch (type * obj)
+#define PAL_CPP_CATCH_ALL catch (...)
+#define PAL_CPP_CATCH_EXCEPTION_NOARG catch (Exception *)
+
+
+//  SELECTANY macro is intended to prevent duplication of static const
+//  arrays declared in .h files in binary modules.
+//  The problem is that const variables have static internal linkage
+//  in C++.  That means that if a const variable is declared in a .h file
+//  the compiler will emit it into every translation unit that uses that .h file.
+//  That will cause duplication of the data when those translation units
+//  are linked into a binary module.
+//  SELECTANY declares a variable as extern to give it external linkage
+//  and it provides __declspec(selectany) to instruct the linker to merge
+//  duplicate external const static data copies into one.
+//  
+#define SELECTANY extern __declspec(selectany)
+        
+
+#if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(JIT64_BUILD) && !defined(CROSS_COMPILE) && !defined(_TARGET_ARM_) // @ARMTODO: no contracts for speed
+#define PAL_TRY_HANDLER_DBG_BEGIN                                               \
+    BOOL ___oldOkayToThrowValue = FALSE;                                        \
+    SO_INFRASTRUCTURE_CODE(BOOL ___oldSOTolerantState = FALSE;)                \
+    ClrDebugState *___pState = ::GetClrDebugState();                            \
+    __try                                                                       \
+    {                                                                           \
+        ___oldOkayToThrowValue = ___pState->IsOkToThrow();                      \
+        SO_INFRASTRUCTURE_CODE(___oldSOTolerantState = ___pState->IsSOTolerant();) \
+        ___pState->SetOkToThrow();                                        \
+        PAL_ENTER_THROWS_REGION;
+
+// Special version that avoids touching the debug state after doing work in a DllMain for process or thread detach.
+#define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason)                              \
+    BOOL ___oldOkayToThrowValue = FALSE;                                        \
+    SO_INFRASTRUCTURE_CODE(BOOL ___oldSOTolerantState = FALSE;)                \
+    ClrDebugState *___pState = NULL;                                            \
+    if (_reason != DLL_PROCESS_ATTACH)                                          \
+        ___pState = CheckClrDebugState();                                       \
+    __try                                                                       \
+    {                                                                           \
+        if (___pState)                                                          \
+        {                                                                       \
+            ___oldOkayToThrowValue = ___pState->IsOkToThrow();                  \
+            SO_INFRASTRUCTURE_CODE(___oldSOTolerantState = ___pState->IsSOTolerant();) \
+            ___pState->SetOkToThrow();                                        \
+        }                                                                       \
+        if ((_reason == DLL_PROCESS_DETACH) || (_reason == DLL_THREAD_DETACH))  \
+        {                                                                       \
+            ___pState = NULL;                                                   \
+        }                                                                       \
+        PAL_ENTER_THROWS_REGION;
+
+#define PAL_TRY_HANDLER_DBG_END                                                 \
+        PAL_LEAVE_THROWS_REGION                                                 \
+    }                                                                           \
+    __finally                                                                   \
+    {                                                                           \
+        if (___pState != NULL)                                                  \
+        {                                                                       \
+            _ASSERTE(___pState == CheckClrDebugState());                        \
+            ___pState->SetOkToThrow( ___oldOkayToThrowValue );                \
+            SO_INFRASTRUCTURE_CODE(___pState->SetSOTolerance( ___oldSOTolerantState );) \
+        }                                                                       \
+    }
+
+#define PAL_ENDTRY_NAKED_DBG                                                    \
+    if (__exHandled)                                                            \
+    {                                                                           \
+        RESTORE_SO_TOLERANCE_STATE;                                             \
+    }                                                                           \
+    
+#else
+#define PAL_TRY_HANDLER_DBG_BEGIN                   ANNOTATION_TRY_BEGIN;
+#define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason)  ANNOTATION_TRY_BEGIN;
+#define PAL_TRY_HANDLER_DBG_END                     ANNOTATION_TRY_END;
+#define PAL_ENDTRY_NAKED_DBG                                                          
+#endif // defined(ENABLE_CONTRACTS_IMPL) && !defined(JIT64_BUILD)
+
+
+#if !BIGENDIAN
+// For little-endian machines, do nothing
+#define VAL16(x) x
+#define VAL32(x) x
+#define VAL64(x) x
+#define SwapString(x)
+#define SwapStringLength(x, y)
+#define SwapGuid(x)
+#endif  // !BIGENDIAN
+
+#ifdef _MSC_VER
+// Get Unaligned values from a potentially unaligned object
+#define GET_UNALIGNED_16(_pObject)  (*(UINT16 UNALIGNED *)(_pObject))
+#define GET_UNALIGNED_32(_pObject)  (*(UINT32 UNALIGNED *)(_pObject))
+#define GET_UNALIGNED_64(_pObject)  (*(UINT64 UNALIGNED *)(_pObject))
+
+// Set Value on an potentially unaligned object 
+#define SET_UNALIGNED_16(_pObject, _Value)  (*(UNALIGNED UINT16 *)(_pObject)) = (UINT16)(_Value)
+#define SET_UNALIGNED_32(_pObject, _Value)  (*(UNALIGNED UINT32 *)(_pObject)) = (UINT32)(_Value)
+#define SET_UNALIGNED_64(_pObject, _Value)  (*(UNALIGNED UINT64 *)(_pObject)) = (UINT64)(_Value) 
+
+// Get Unaligned values from a potentially unaligned object and swap the value
+#define GET_UNALIGNED_VAL16(_pObject) VAL16(GET_UNALIGNED_16(_pObject))
+#define GET_UNALIGNED_VAL32(_pObject) VAL32(GET_UNALIGNED_32(_pObject))
+#define GET_UNALIGNED_VAL64(_pObject) VAL64(GET_UNALIGNED_64(_pObject))
+
+// Set a swap Value on an potentially unaligned object 
+#define SET_UNALIGNED_VAL16(_pObject, _Value) SET_UNALIGNED_16(_pObject, VAL16((UINT16)_Value))
+#define SET_UNALIGNED_VAL32(_pObject, _Value) SET_UNALIGNED_32(_pObject, VAL32((UINT32)_Value))
+#define SET_UNALIGNED_VAL64(_pObject, _Value) SET_UNALIGNED_64(_pObject, VAL64((UINT64)_Value))
+#endif
+
+#ifdef _WIN64
+#define VALPTR(x) VAL64(x)
+#define GET_UNALIGNED_PTR(x) GET_UNALIGNED_64(x)
+#define GET_UNALIGNED_VALPTR(x) GET_UNALIGNED_VAL64(x)
+#define SET_UNALIGNED_PTR(p,x) SET_UNALIGNED_64(p,x)
+#define SET_UNALIGNED_VALPTR(p,x) SET_UNALIGNED_VAL64(p,x)
+#else
+#define VALPTR(x) VAL32(x)
+#define GET_UNALIGNED_PTR(x) GET_UNALIGNED_32(x)
+#define GET_UNALIGNED_VALPTR(x) GET_UNALIGNED_VAL32(x)
+#define SET_UNALIGNED_PTR(p,x) SET_UNALIGNED_32(p,x)
+#define SET_UNALIGNED_VALPTR(p,x) SET_UNALIGNED_VAL32(p,x)
+#endif
+
+#define MAKEDLLNAME_W(name) name W(".dll")
+#define MAKEDLLNAME_A(name) name  ".dll"
+
+#ifdef UNICODE
+#define MAKEDLLNAME(x) MAKEDLLNAME_W(x)
+#else
+#define MAKEDLLNAME(x) MAKEDLLNAME_A(x)
+#endif
+
+#if !defined(MAX_LONGPATH)
+#define MAX_LONGPATH   260 /* max. length of full pathname */
+#endif
+#if !defined(MAX_PATH_FNAME)
+#define MAX_PATH_FNAME   MAX_PATH /* max. length of full pathname */
+#endif
+
+#endif // __PALCLR_H__
+
+#include "palclr_win.h"
+
+#endif // !defined(FEATURE_PAL)

+ 216 - 0
Source/AtomicNET/NETCore/Platforms/Windows/prebuilt/palclr_win.h

@@ -0,0 +1,216 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+// ===========================================================================
+// File: palclr.h
+//
+// Various macros and constants that are necessary to make the CLR portable.
+//
+
+// ===========================================================================
+
+#ifndef __PALCLR_WIN_H__
+#define __PALCLR_WIN_H__
+
+// PAL SEH
+// Macros for portable exception handling. The Win32 SEH is emulated using
+// these macros and setjmp/longjmp on Unix
+//
+// Usage notes:
+//
+// - The filter has to be a function taking two parameters:
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+//
+// - It is not possible to directly use the local variables in the filter.
+// All the local information that the filter has to need to know about should
+// be passed through pv parameter
+//  
+// - Do not use goto to jump out of the PAL_TRY block
+// (jumping out of the try block is not a good idea even on Win32, because of
+// it causes stack unwind)
+//
+//
+// Simple examples:
+//
+// PAL_TRY {
+//   ....
+// } WIN_PAL_FINALLY {
+//   ....
+// }
+// WIN_PAL_ENDTRY
+//
+//
+// PAL_TRY {
+//   ....
+// } WIN_PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
+//   ....
+// }
+// WIN_PAL_ENDTRY
+// 
+//
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+// {
+// ...
+// }
+// PAL_TRY {
+//   ....
+// } WIN_PAL_EXCEPT_FILTER(MyFilter, NULL) {
+//   ....
+// }
+// WIN_PAL_ENDTRY
+//
+//
+// Complex example:
+//
+// struct MyParams
+// {
+//     ...
+// } params;
+//
+// PAL_TRY {
+//   PAL_TRY {
+//       ...
+//       if (error) goto Done;
+//       ...
+//   Done: ;
+//   } WIN_PAL_EXCEPT_FILTER(OtherFilter, &params) {
+//   ...
+//   }
+//   WIN_PAL_ENDTRY
+// }
+// WIN_PAL_FINALLY {
+// }
+// WIN_PAL_ENDTRY
+//
+
+#if !defined(FEATURE_CORECLR)
+
+#include "staticcontract.h"
+
+#define WIN_PAL_TRY_NAKED                                                       \
+    {                                                                           \
+        bool __exHandled; __exHandled = false;                                  \
+        DWORD __exCode; __exCode = 0;                                           \
+        __try                                                                   \
+        {
+
+#define WIN_PAL_TRY                                                             \
+    {                                                                           \
+        WIN_PAL_TRY_NAKED                                                       \
+        WIN_PAL_TRY_HANDLER_DBG_BEGIN
+
+#define WIN_PAL_TRY_FOR_DLLMAIN(_reason)                                        \
+    {                                                                           \
+        WIN_PAL_TRY_NAKED                                                       \
+        WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason)
+
+// Note: PAL_SEH_RESTORE_GUARD_PAGE is only ever defined in clrex.h, so we only restore guard pages automatically
+// when these macros are used from within the VM.
+#define WIN_PAL_SEH_RESTORE_GUARD_PAGE PAL_SEH_RESTORE_GUARD_PAGE
+ 
+#define WIN_PAL_EXCEPT_NAKED(Disposition)                                       \
+    } __except(__exCode = GetExceptionCode(), Disposition) {                    \
+        __exHandled = true;                                                     \
+        WIN_PAL_SEH_RESTORE_GUARD_PAGE
+
+#define WIN_PAL_EXCEPT(Disposition)                                             \
+        WIN_PAL_TRY_HANDLER_DBG_END                                             \
+        WIN_PAL_EXCEPT_NAKED(Disposition)
+
+#define WIN_PAL_EXCEPT_FILTER_NAKED(pfnFilter, pvFilterParameter)                                       \
+    } __except(__exCode = GetExceptionCode(), pfnFilter(GetExceptionInformation(), pvFilterParameter)) {  \
+        __exHandled = true;                                                     \
+        WIN_PAL_SEH_RESTORE_GUARD_PAGE
+
+#define WIN_PAL_EXCEPT_FILTER(pfnFilter, pvFilterParameter)                     \
+        WIN_PAL_TRY_HANDLER_DBG_END                                             \
+        WIN_PAL_EXCEPT_FILTER_NAKED(pfnFilter, pvFilterParameter)
+
+#define WIN_PAL_FINALLY_NAKED                                                   \
+    } __finally {                                                               \
+
+#define WIN_PAL_FINALLY                                                             \
+        WIN_PAL_TRY_HANDLER_DBG_END                                             \
+        WIN_PAL_FINALLY_NAKED
+
+#define WIN_PAL_ENDTRY_NAKED                                                    \
+        }                                                                       \
+    }                                                                           \
+
+#define WIN_PAL_ENDTRY                                                          \
+            }                                                                   \
+            WIN_PAL_ENDTRY_NAKED_DBG                                            \
+        }                                                                       \
+    }
+
+#define WIN_PAL_CPP_TRY try
+#define WIN_PAL_CPP_ENDTRY
+#define WIN_PAL_CPP_THROW(type, obj) throw obj;
+#define WIN_PAL_CPP_RETHROW throw;
+#define WIN_PAL_CPP_CATCH_EXCEPTION(obj) catch (Exception * obj)
+#define WIN_PAL_CPP_CATCH_DERIVED(type, obj) catch (type * obj)
+#define WIN_PAL_CPP_CATCH_ALL catch (...)
+#define WIN_PAL_CPP_CATCH_EXCEPTION_NOARG catch (Exception *)
+
+#endif // !PAL_WIN_SEH
+
+
+#if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(JIT64_BUILD) && !defined(_ARM_) // @ARMTODO
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN                                           \
+    BOOL ___oldOkayToThrowValue = FALSE;                                        \
+    BOOL ___oldSOTolerantState = FALSE;                                         \
+    ClrDebugState *___pState = GetClrDebugState();                              \
+    __try                                                                       \
+    {                                                                           \
+        ___oldOkayToThrowValue = ___pState->IsOkToThrow();                      \
+        ___oldSOTolerantState = ___pState->IsSOTolerant();                      \
+        ___pState->SetOkToThrow(TRUE);                                          \
+        ANNOTATION_TRY_BEGIN;
+
+// Special version that avoids touching the debug state after doing work in a DllMain for process or thread detach.
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason)                          \
+    BOOL ___oldOkayToThrowValue = FALSE;                                        \
+    BOOL ___oldSOTolerantState = FALSE;                                         \
+    ClrDebugState *___pState = CheckClrDebugState();                            \
+    __try                                                                       \
+    {                                                                           \
+        if (___pState)                                                          \
+        {                                                                       \
+            ___oldOkayToThrowValue = ___pState->IsOkToThrow();                  \
+            ___oldSOTolerantState = ___pState->IsSOTolerant();                  \
+            ___pState->SetOkToThrow(TRUE);                                      \
+        }                                                                       \
+        if ((_reason == DLL_PROCESS_DETACH) || (_reason == DLL_THREAD_DETACH))  \
+        {                                                                       \
+            ___pState = NULL;                                                   \
+        }                                                                       \
+        ANNOTATION_TRY_BEGIN;
+
+#define WIN_PAL_TRY_HANDLER_DBG_END                                             \
+        ANNOTATION_TRY_END;                                                     \
+    }                                                                           \
+    __finally                                                                   \
+    {                                                                           \
+        if (___pState != NULL)                                                  \
+        {                                                                       \
+            _ASSERTE(___pState == CheckClrDebugState());                        \
+            ___pState->SetOkToThrow(___oldOkayToThrowValue);                    \
+            ___pState->SetSOTolerance(___oldSOTolerantState);                   \
+        }                                                                       \
+    }
+
+#define WIN_PAL_ENDTRY_NAKED_DBG                                                \
+    if (__exHandled)                                                            \
+    {                                                                           \
+        RESTORE_SO_TOLERANCE_STATE;                                             \
+    }                                                                           \
+    
+#else
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN                   ANNOTATION_TRY_BEGIN;
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason)  ANNOTATION_TRY_BEGIN;
+#define WIN_PAL_TRY_HANDLER_DBG_END                     ANNOTATION_TRY_END;
+#define WIN_PAL_ENDTRY_NAKED_DBG                                                          
+#endif // defined(ENABLE_CONTRACTS_IMPL) && !defined(JIT64_BUILD)
+
+#endif	// __PALCLR_WIN_H__

+ 409 - 0
Source/AtomicNET/NETCore/Platforms/Windows/prebuilt/staticcontract.h

@@ -0,0 +1,409 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+// ---------------------------------------------------------------------------
+// StaticContract.h
+// ---------------------------------------------------------------------------
+
+
+#ifndef __STATIC_CONTRACT_H_
+#define __STATIC_CONTRACT_H_
+
+// Make sure we have the WCHAR defines available.
+#include "palclr.h"
+
+#define SCAN_WIDEN2(x) L ## x
+#define SCAN_WIDEN(x) SCAN_WIDEN2(x)
+
+//
+// PDB annotations for the static contract analysis tool. These are seperated
+// from Contract.h to allow their inclusion in any part of the system.
+//
+
+#if defined(_DEBUG) && defined(_TARGET_X86_)
+#define METHOD_CANNOT_BE_FOLDED_DEBUG                               \
+    static int _noFold = 0;                                         \
+    _noFold++;
+#else
+#define METHOD_CANNOT_BE_FOLDED_DEBUG
+#endif
+
+#ifdef _TARGET_X86_
+
+//
+// currently, only x86 has a static contract analysis tool, so let's not
+// bloat the PDBs of all the other architectures too..
+//
+#define ANNOTATION_TRY_BEGIN                __annotation(W("TRY_BEGIN"))
+#define ANNOTATION_TRY_END                  __annotation(W("TRY_END"))
+#define ANNOTATION_HANDLER_BEGIN            __annotation(W("HANDLER_BEGIN"))
+#define ANNOTATION_HANDLER_END              __annotation(W("HANDLER_END"))
+#define ANNOTATION_NOTHROW                  __annotation(W("NOTHROW"))
+#define ANNOTATION_CANNOT_TAKE_LOCK         __annotation(W("CANNOT_TAKE_LOCK"))
+#define ANNOTATION_WRAPPER                  __annotation(W("WRAPPER"))
+#define ANNOTATION_FAULT                    __annotation(W("FAULT"))
+#define ANNOTATION_FORBID_FAULT             __annotation(W("FORBID_FAULT"))
+#define ANNOTATION_COOPERATIVE              __annotation(W("MODE_COOPERATIVE"))
+#define ANNOTATION_MODE_COOPERATIVE         __annotation(W("MODE_PREEMPTIVE"))
+#define ANNOTATION_MODE_ANY                 __annotation(W("MODE_ANY"))
+#define ANNOTATION_GC_TRIGGERS              __annotation(W("GC_TRIGGERS"))
+#define ANNOTATION_IGNORE_THROW             __annotation(W("THROWS"), W("NOTHROW"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_LOCK              __annotation(W("CAN_TAKE_LOCK"), W("CANNOT_TAKE_LOCK"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_FAULT             __annotation(W("FAULT"), W("FORBID_FAULT"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_TRIGGER           __annotation(W("GC_TRIGGERS"), W("GC_NOTRIGGER"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_SO                __annotation(W("SO_TOLERANT"), W("SO_INTOLERANT"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_VIOLATION(violationmask) __annotation(W("VIOLATION(") L#violationmask W(")"))
+#define ANNOTATION_UNCHECKED(thecheck)      __annotation(W("UNCHECKED(") L#thecheck W(")"))
+
+#define ANNOTATION_MARK_BLOCK_ANNOTATION    __annotation(W("MARK"))
+#define ANNOTATION_USE_BLOCK_ANNOTATION     __annotation(W("USE"))
+#define ANNOTATION_END_USE_BLOCK_ANNOTATION __annotation(W("END_USE"))
+
+// here is the plan:
+//
+//  a special holder which implements a violation 
+//
+
+#define ANNOTATION_FN_SPECIAL_HOLDER_BEGIN  __annotation(W("SPECIAL_HOLDER_BEGIN ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_SPECIAL_HOLDER_END       __annotation(W("SPECIAL_HOLDER_END"))
+#define ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT __annotation(W("SPECIAL_HOLDER_DYNAMIC"))
+
+#define ANNOTATION_SO_PROBE_BEGIN(probeAmount) __annotation(W("SO_PROBE_BEGIN(") L#probeAmount W(")"))
+#define ANNOTATION_SO_PROBE_END             __annotation(W("SO_PROBE_END"))
+
+//
+// these annotations are all function-name qualified
+//
+#define ANNOTATION_FN_LEAF                  __annotation(W("LEAF ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_WRAPPER               __annotation(W("WRAPPER ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_THROWS                __annotation(W("THROWS ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_NOTHROW               __annotation(W("NOTHROW ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_CAN_TAKE_LOCK         __annotation(W("CAN_TAKE_LOCK ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_CANNOT_TAKE_LOCK      __annotation(W("CANNOT_TAKE_LOCK ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_FAULT                 __annotation(W("FAULT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_FORBID_FAULT          __annotation(W("FORBID_FAULT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_GC_TRIGGERS           __annotation(W("GC_TRIGGERS ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_GC_NOTRIGGER          __annotation(W("GC_NOTRIGGER ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_SO_TOLERANT           __annotation(W("SO_TOLERANT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_SO_INTOLERANT         __annotation(W("SO_INTOLERANT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_SO_NOT_MAINLINE       __annotation(W("SO_NOT_MAINLINE ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_MODE_COOPERATIVE      __annotation(W("MODE_COOPERATIVE ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_MODE_PREEMPTIVE       __annotation(W("MODE_PREEMPTIVE ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_MODE_ANY              __annotation(W("MODE_ANY ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_HOST_NOCALLS          __annotation(W("HOST_NOCALLS ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_HOST_CALLS            __annotation(W("HOST_CALLS ") SCAN_WIDEN(__FUNCTION__))
+
+#define ANNOTATION_ENTRY_POINT              __annotation(W("SO_EP ") SCAN_WIDEN(__FUNCTION__))  
+
+
+// for DacCop
+#define ANNOTATION_SUPPORTS_DAC             __annotation(W("SUPPORTS_DAC"))
+#define ANNOTATION_SUPPORTS_DAC_HOST_ONLY   __annotation(W("SUPPORTS_DAC_HOST_ONLY"))
+
+#ifdef _DEBUG
+// @todo : put correct annotation in and fixup the static analysis tool
+// This is used to flag debug-only functions that we want to ignore in our static analysis
+#define ANNOTATION_DEBUG_ONLY               __annotation(W("DBG_ONLY"))
+
+#endif
+
+#else // _TARGET_X86_
+
+#define ANNOTATION_TRY_BEGIN                { }
+#define ANNOTATION_TRY_END                  { }
+#define ANNOTATION_HANDLER_BEGIN            { }
+#define ANNOTATION_HANDLER_END              { }
+#define ANNOTATION_NOTHROW                  { }
+#define ANNOTATION_CANNOT_TAKE_LOCK         { }
+#define ANNOTATION_WRAPPER                  { }
+#define ANNOTATION_FAULT                    { }
+#define ANNOTATION_FORBID_FAULT             { }
+#define ANNOTATION_COOPERATIVE              { }
+#define ANNOTATION_MODE_COOPERATIVE         { }
+#define ANNOTATION_MODE_ANY                 { }
+#define ANNOTATION_GC_TRIGGERS              { }
+#define ANNOTATION_IGNORE_THROW             { }
+#define ANNOTATION_IGNORE_LOCK              { }
+#define ANNOTATION_IGNORE_FAULT             { }
+#define ANNOTATION_IGNORE_TRIGGER           { }
+#define ANNOTATION_IGNORE_SO                { }
+#define ANNOTATION_VIOLATION(violationmask) { }
+#define ANNOTATION_UNCHECKED(thecheck)      { }
+
+#define ANNOTATION_TRY_MARKER               { }
+#define ANNOTATION_CATCH_MARKER             { }
+
+#define ANNOTATION_FN_HOST_NOCALLS          { }
+#define ANNOTATION_FN_HOST_CALLS            { }
+
+#define ANNOTATION_FN_SPECIAL_HOLDER_BEGIN  { }
+#define ANNOTATION_SPECIAL_HOLDER_END       { }
+#define ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT { }
+
+#define ANNOTATION_FN_LEAF                  { }
+#define ANNOTATION_FN_WRAPPER               { }
+#define ANNOTATION_FN_THROWS                { }
+#define ANNOTATION_FN_NOTHROW               { }
+#define ANNOTATION_FN_CAN_TAKE_LOCK         { }
+#define ANNOTATION_FN_CANNOT_TAKE_LOCK      { }
+#define ANNOTATION_FN_FAULT                 { }
+#define ANNOTATION_FN_FORBID_FAULT          { }
+#define ANNOTATION_FN_GC_TRIGGERS           { }
+#define ANNOTATION_FN_GC_NOTRIGGER          { }
+#define ANNOTATION_FN_SO_TOLERANT           { }
+#define ANNOTATION_FN_SO_INTOLERANT         { }
+#define ANNOTATION_FN_SO_NOT_MAINLINE       { }
+#define ANNOTATION_FN_MODE_COOPERATIVE      { }
+#define ANNOTATION_FN_MODE_PREEMPTIVE       { }
+#define ANNOTATION_FN_MODE_ANY              { }
+#define ANNOTATION_FN_HOST_NOCALLS          { }
+#define ANNOTATION_FN_HOST_CALLS            { }
+
+#define ANNOTATION_SUPPORTS_DAC             { }
+#define ANNOTATION_SUPPORTS_DAC_HOST_ONLY   { }
+
+#define ANNOTATION_SO_PROBE_BEGIN(probeAmount) { }
+#define ANNOTATION_SO_PROBE_END             { }
+
+#define ANNOTATION_SO_TOLERANT              { }
+#define ANNOTATION_SO_INTOLERANT            { }
+#define ANNOTATION_SO_NOT_MAINLINE          { }
+#define ANNOTATION_SO_NOT_MAINLINE_BEGIN    { }
+#define ANNOTATION_SO_NOT_MAINLINE_END      { }
+#define ANNOTATION_ENTRY_POINT              { }
+#ifdef _DEBUG
+#define ANNOTATION_DEBUG_ONLY               { }
+#endif
+
+#endif // _TARGET_X86_
+
+#define STATIC_CONTRACT_THROWS              ANNOTATION_FN_THROWS
+#define STATIC_CONTRACT_NOTHROW             ANNOTATION_FN_NOTHROW
+#define STATIC_CONTRACT_CAN_TAKE_LOCK       ANNOTATION_FN_CAN_TAKE_LOCK
+#define STATIC_CONTRACT_CANNOT_TAKE_LOCK    ANNOTATION_FN_CANNOT_TAKE_LOCK
+#define STATIC_CONTRACT_FAULT               ANNOTATION_FN_FAULT
+#define STATIC_CONTRACT_FORBID_FAULT        ANNOTATION_FN_FORBID_FAULT
+#define STATIC_CONTRACT_GC_TRIGGERS         ANNOTATION_FN_GC_TRIGGERS
+#define STATIC_CONTRACT_GC_NOTRIGGER        ANNOTATION_FN_GC_NOTRIGGER
+#define STATIC_CONTRACT_HOST_NOCALLS        ANNOTATION_FN_HOST_NOCALLS
+#define STATIC_CONTRACT_HOST_CALLS          ANNOTATION_FN_HOST_CALLS 
+
+#define STATIC_CONTRACT_SUPPORTS_DAC        ANNOTATION_SUPPORTS_DAC
+#define STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY ANNOTATION_SUPPORTS_DAC_HOST_ONLY
+
+#define STATIC_CONTRACT_MODE_COOPERATIVE    ANNOTATION_FN_MODE_COOPERATIVE
+#define STATIC_CONTRACT_MODE_PREEMPTIVE     ANNOTATION_FN_MODE_PREEMPTIVE
+#define STATIC_CONTRACT_MODE_ANY            ANNOTATION_FN_MODE_ANY
+#define STATIC_CONTRACT_LEAF                ANNOTATION_FN_LEAF
+#define STATIC_CONTRACT_LIMITED_METHOD      ANNOTATION_FN_LEAF
+#define STATIC_CONTRACT_WRAPPER             ANNOTATION_FN_WRAPPER
+
+#ifdef FEATURE_STACK_PROBE // Static SO contracts only required when SO Infrastructure code is present
+#define STATIC_CONTRACT_SO_INTOLERANT       ANNOTATION_FN_SO_INTOLERANT
+#define STATIC_CONTRACT_SO_TOLERANT         ANNOTATION_FN_SO_TOLERANT
+#define STATIC_CONTRACT_SO_NOT_MAINLINE     ANNOTATION_FN_SO_NOT_MAINLINE
+
+#define STATIC_CONTRACT_ENTRY_POINT         ANNOTATION_ENTRY_POINT; ANNOTATION_FN_SO_TOLERANT
+#else // FEATURE_STACK_PROBE
+#define STATIC_CONTRACT_SO_INTOLERANT
+#define STATIC_CONTRACT_SO_TOLERANT
+#define STATIC_CONTRACT_SO_NOT_MAINLINE
+#define STATIC_CONTRACT_ENTRY_POINT
+#endif // FEATURE_STACK_PROBE
+
+#ifdef _DEBUG
+#define STATIC_CONTRACT_DEBUG_ONLY                                  \
+    ANNOTATION_DEBUG_ONLY;                                          \
+    STATIC_CONTRACT_CANNOT_TAKE_LOCK;                               \
+    ANNOTATION_VIOLATION(TakesLockViolation);                       \
+    ANNOTATION_FN_SO_NOT_MAINLINE;
+#else
+#define STATIC_CONTRACT_DEBUG_ONLY 
+#endif
+
+#define STATIC_CONTRACT_VIOLATION(mask)                             \
+    ANNOTATION_VIOLATION(mask)
+
+#define SCAN_SCOPE_BEGIN                                            \
+    METHOD_CANNOT_BE_FOLDED_DEBUG;                                  \
+    ANNOTATION_FN_SPECIAL_HOLDER_BEGIN;
+
+#define SCAN_SCOPE_END                                              \
+    METHOD_CANNOT_BE_FOLDED_DEBUG;                                  \
+    ANNOTATION_SPECIAL_HOLDER_END;
+
+namespace StaticContract
+{
+    struct ScanThrowMarkerStandard
+    {
+        __declspec(noinline) ScanThrowMarkerStandard()
+        {
+            METHOD_CANNOT_BE_FOLDED_DEBUG;
+            STATIC_CONTRACT_THROWS;
+            STATIC_CONTRACT_GC_NOTRIGGER;
+            STATIC_CONTRACT_SO_TOLERANT;
+        }
+
+        static void used()
+        {
+        }
+    };
+
+    struct ScanThrowMarkerTerminal
+    {
+        __declspec(noinline) ScanThrowMarkerTerminal()
+        {
+            METHOD_CANNOT_BE_FOLDED_DEBUG;
+        }
+
+        static void used()
+        {
+        }
+    };
+
+    struct ScanThrowMarkerIgnore
+    {
+        __declspec(noinline) ScanThrowMarkerIgnore()
+        {
+            METHOD_CANNOT_BE_FOLDED_DEBUG;
+        }
+
+        static void used()
+        {
+        }
+    };
+}
+typedef StaticContract::ScanThrowMarkerStandard ScanThrowMarker;
+
+// This is used to annotate code as throwing a terminal exception, and should
+// be used immediately before the throw so that infer that it can be inferred
+// that the block in which this annotation appears throws unconditionally.
+#define SCAN_THROW_MARKER do { ScanThrowMarker __throw_marker; } while (0)
+
+#define SCAN_IGNORE_THROW_MARKER                                    \
+    typedef StaticContract::ScanThrowMarkerIgnore ScanThrowMarker; if (0) ScanThrowMarker::used();
+
+// Terminal exceptions are asynchronous and cannot be included in THROWS contract
+// analysis. As such, this uses typedef to reassign the ScanThrowMarker to a
+// non-annotating struct so that SCAN does not see the block as throwing.
+#define STATIC_CONTRACT_THROWS_TERMINAL                             \
+    typedef StaticContract::ScanThrowMarkerTerminal ScanThrowMarker; if (0) ScanThrowMarker::used();
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && defined(FEATURE_STACK_PROBE) && !defined(_TARGET_ARM_) // @ARMTODO
+extern void EnsureSOIntolerantOK(const char *szFunction, const char *szFile, int lineNum);
+
+extern BOOL (*g_fpShouldValidateSOToleranceOnThisThread)();
+
+// @todo  Is there any checks we can do here?
+#define ENSURE_SHOULD_NOT_PROBE_FOR_SO
+
+#define CHECK_IF_SO_INTOLERANT_OK \
+    EnsureSOIntolerantOK(__FUNCTION__, __FILE__, __LINE__);
+
+// Even if we can't have a full-blown contract, we can at least check
+// if its ok to run an SO-Intolerant function.
+#undef STATIC_CONTRACT_SO_INTOLERANT                                           
+#define STATIC_CONTRACT_SO_INTOLERANT                                           \
+    ANNOTATION_FN_SO_INTOLERANT;                                                \
+    CHECK_IF_SO_INTOLERANT_OK;
+
+#undef STATIC_CONTRACT_SO_NOT_MAINLINE
+#define STATIC_CONTRACT_SO_NOT_MAINLINE                                         \
+    ENSURE_SHOULD_NOT_PROBE_FOR_SO                                              \
+    ANNOTATION_FN_SO_NOT_MAINLINE
+
+#else
+#define EnsureSOIntolerantOK(x,y,z)
+
+#endif
+
+
+#ifdef _MSC_VER
+#define SCAN_IGNORE_THROW                   typedef StaticContract::ScanThrowMarkerIgnore ScanThrowMarker; ANNOTATION_IGNORE_THROW
+#define SCAN_IGNORE_LOCK                    ANNOTATION_IGNORE_LOCK
+#define SCAN_IGNORE_FAULT                   ANNOTATION_IGNORE_FAULT
+#define SCAN_IGNORE_TRIGGER                 ANNOTATION_IGNORE_TRIGGER
+#define SCAN_IGNORE_SO                      ANNOTATION_IGNORE_SO
+#else
+#define SCAN_IGNORE_THROW
+#define SCAN_IGNORE_LOCK
+#define SCAN_IGNORE_FAULT
+#define SCAN_IGNORE_TRIGGER
+#define SCAN_IGNORE_SO
+#endif
+
+
+// we use BlockMarker's only for SCAN
+#if defined(_DEBUG) && defined(_TARGET_X86_) && !defined(DACCESS_COMPILE)
+
+template <UINT COUNT>
+class BlockMarker
+{
+public:
+    __declspec(noinline) void MarkBlock()
+    {
+        ANNOTATION_MARK_BLOCK_ANNOTATION;
+        METHOD_CANNOT_BE_FOLDED_DEBUG;
+        return;
+    }
+
+    __declspec(noinline) void UseMarkedBlockAnnotation()
+    {
+        ANNOTATION_USE_BLOCK_ANNOTATION;
+        METHOD_CANNOT_BE_FOLDED_DEBUG;
+        return;
+    }
+
+    __declspec(noinline) void EndUseMarkedBlockAnnotation()
+    {
+        ANNOTATION_END_USE_BLOCK_ANNOTATION;
+        METHOD_CANNOT_BE_FOLDED_DEBUG;
+        return;
+    }
+};
+
+#define SCAN_BLOCKMARKER()              BlockMarker<__COUNTER__> __blockMarker_onlyOneAllowedPerScope
+#define SCAN_BLOCKMARKER_MARK()         __blockMarker_onlyOneAllowedPerScope.MarkBlock()
+#define SCAN_BLOCKMARKER_USE()          __blockMarker_onlyOneAllowedPerScope.UseMarkedBlockAnnotation()
+#define SCAN_BLOCKMARKER_END_USE()      __blockMarker_onlyOneAllowedPerScope.EndUseMarkedBlockAnnotation()
+
+#define SCAN_BLOCKMARKER_N(num)         BlockMarker<__COUNTER__> __blockMarker_onlyOneAllowedPerScope##num
+#define SCAN_BLOCKMARKER_MARK_N(num)    __blockMarker_onlyOneAllowedPerScope##num.MarkBlock()
+#define SCAN_BLOCKMARKER_USE_N(num)     __blockMarker_onlyOneAllowedPerScope##num.UseMarkedBlockAnnotation()
+#define SCAN_BLOCKMARKER_END_USE_N(num) __blockMarker_onlyOneAllowedPerScope##num.EndUseMarkedBlockAnnotation()
+
+#define SCAN_EHMARKER()                 BlockMarker<__COUNTER__> __marker_onlyOneAllowedPerScope
+#define SCAN_EHMARKER_TRY()             __annotation(W("SCOPE(BLOCK);SCAN_TRY_BEGIN")); __marker_onlyOneAllowedPerScope.MarkBlock()
+#define SCAN_EHMARKER_END_TRY()         __annotation(W("SCOPE(BLOCK);SCAN_TRY_END"))
+#define SCAN_EHMARKER_CATCH()           __marker_onlyOneAllowedPerScope.UseMarkedBlockAnnotation()
+#define SCAN_EHMARKER_END_CATCH()       __marker_onlyOneAllowedPerScope.EndUseMarkedBlockAnnotation()
+
+#else
+
+#define SCAN_BLOCKMARKER()
+#define SCAN_BLOCKMARKER_MARK()
+#define SCAN_BLOCKMARKER_USE()
+#define SCAN_BLOCKMARKER_END_USE()
+
+#define SCAN_BLOCKMARKER_N(num)
+#define SCAN_BLOCKMARKER_MARK_N(num)
+#define SCAN_BLOCKMARKER_USE_N(num)
+#define SCAN_BLOCKMARKER_END_USE_N(num)
+
+#define SCAN_EHMARKER()
+#define SCAN_EHMARKER_TRY()
+#define SCAN_EHMARKER_END_TRY()
+#define SCAN_EHMARKER_CATCH()
+#define SCAN_EHMARKER_END_CATCH()
+
+#endif
+
+
+//
+// @todo remove this... if there really are cases where a function just shouldn't have a contract, then perhaps
+// we can add a more descriptive name for it...
+//
+#define CANNOT_HAVE_CONTRACT                __annotation(W("NO_CONTRACT"))
+
+#endif // __STATIC_CONTRACT_H_

+ 1 - 1
Source/ThirdParty/Poco/CMakeLists.txt

@@ -1,5 +1,5 @@
 
 
-add_definitions(-DHAVE_STDINT_H -DPOCO_STATIC)
+add_definitions(-DHAVE_STDINT_H )
 
 
 set (SOURCE_FILES
 set (SOURCE_FILES
     Foundation/src/Pipe.cpp
     Foundation/src/Pipe.cpp

+ 5 - 1
Source/ToolCore/JSBind/CSharp/CSPackageWriter.cpp

@@ -80,7 +80,10 @@ void CSPackageWriter::GenerateNativeHeader()
 {
 {
     String source = "// This file was autogenerated by AtomicTool, changes will be lost\n\n";
     String source = "// This file was autogenerated by AtomicTool, changes will be lost\n\n";
 
 
-    source += "#pragma once\n\n";
+    
+    source += "#pragma once\n\nnamespace Atomic\n{\n}\n";
+
+    /*
 
 
     if (package_->name_ != "Atomic")
     if (package_->name_ != "Atomic")
     {
     {
@@ -134,6 +137,7 @@ void CSPackageWriter::GenerateNativeHeader()
     Dedent();
     Dedent();
 
 
     source += "\n}\n";
     source += "\n}\n";
+    */
 
 
     JSBind* jsbind = package_->GetSubsystem<JSBind>();
     JSBind* jsbind = package_->GetSubsystem<JSBind>();