diff options
author | danmosemsft <danmose@microsoft.com> | 2017-02-12 16:51:48 -0800 |
---|---|---|
committer | danmosemsft <danmose@microsoft.com> | 2017-02-12 17:00:53 -0800 |
commit | b9f410b7b85d3948aece3aa009885df244f11e41 (patch) | |
tree | 4adbb4ae045896b11f373794e79b572e26d2def1 | |
parent | 206b6a7efbc2e947eff900f448b86573b77ae392 (diff) | |
download | coreclr-b9f410b7b85d3948aece3aa009885df244f11e41.tar.gz coreclr-b9f410b7b85d3948aece3aa009885df244f11e41.tar.bz2 coreclr-b9f410b7b85d3948aece3aa009885df244f11e41.zip |
Remove never defined FEATURE_FUSION
94 files changed, 0 insertions, 17777 deletions
diff --git a/clr.defines.targets b/clr.defines.targets index bcfdcdc4b8..61ee17a419 100644 --- a/clr.defines.targets +++ b/clr.defines.targets @@ -22,7 +22,6 @@ <CDefines Condition="'$(FeatureEventTrace)' == 'true'">$(CDefines);FEATURE_EVENT_TRACE</CDefines> <CDefines Condition="'$(FeatureXplatEventSource)' == 'true'">$(CDefines);FEATURE_EVENTSOURCE_XPLAT</CDefines> <CDefines Condition="'$(FeatureFullNGen)' == 'true'">$(CDefines);FEATURE_FULL_NGEN</CDefines> - <CDefines Condition="'$(FeatureFusion)' == 'true'">$(CDefines);FEATURE_FUSION</CDefines> <CDefines Condition="'$(FeatureHijack)' == 'true'">$(CDefines);FEATURE_HIJACK</CDefines> <CDefines Condition="'$(FeatureImpersonation)' == 'true'">$(CDefines);FEATURE_IMPERSONATION</CDefines> <CDefines Condition="'$(FeatureIncludeAllInterfaces)' == 'true'">$(CDefines);FEATURE_INCLUDE_ALL_INTERFACES</CDefines> @@ -99,7 +98,6 @@ <DefineConstants Condition="'$(FeatureCoreFxGlobalization)' == 'true'">$(DefineConstants);FEATURE_COREFX_GLOBALIZATION</DefineConstants> <DefineConstants Condition="'$(FeatureDisplayCultureInfo)' == 'true'">$(DefineConstants);FEATURE_DISPLAY_CULTURE_INFO</DefineConstants> <DefineConstants Condition="'$(FeatureDisplayRegionInfo)' == 'true'">$(DefineConstants);FEATURE_DISPLAY_REGION_INFO</DefineConstants> - <DefineConstants Condition="'$(FeatureFusion)' == 'true'">$(DefineConstants);FEATURE_FUSION</DefineConstants> <DefineConstants Condition="'$(FeatureHosting)' == 'true'">$(DefineConstants);FEATURE_HOSTING</DefineConstants> <DefineConstants Condition="'$(FeatureIdentityReference)' == 'true'">$(DefineConstants);FEATURE_IDENTITY_REFERENCE</DefineConstants> <DefineConstants Condition="'$(FeatureImpersonation)' == 'true'">$(DefineConstants);FEATURE_IMPERSONATION</DefineConstants> diff --git a/src/binder/inc/assembly.hpp b/src/binder/inc/assembly.hpp index 335bce861c..425e80567e 100644 --- a/src/binder/inc/assembly.hpp +++ b/src/binder/inc/assembly.hpp @@ -21,9 +21,7 @@ #include "corpriv.h" #include "clrprivbinding.h" -#if !defined(FEATURE_FUSION) #include "clrprivbindercoreclr.h" -#endif // !defined(FEATURE_FUSION) #if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) #include "clrprivbinderassemblyloadcontext.h" @@ -203,9 +201,7 @@ public: return m_pBinder; } -#if !defined(FEATURE_FUSION) friend class ::CLRPrivBinderCoreCLR; -#endif // !defined(FEATURE_FUSION) #if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) friend class ::CLRPrivBinderAssemblyLoadContext; diff --git a/src/classlibnative/bcltype/system.cpp b/src/classlibnative/bcltype/system.cpp index c1d85c45e9..78775f2371 100644 --- a/src/classlibnative/bcltype/system.cpp +++ b/src/classlibnative/bcltype/system.cpp @@ -295,24 +295,7 @@ FCIMPLEND FCIMPL0(StringObject*, SystemNative::GetDeveloperPath) { -#ifdef FEATURE_FUSION - FCALL_CONTRACT; - - STRINGREF refDevPath = NULL; - LPWSTR pPath = NULL; - DWORD lgth = 0; - - HELPER_METHOD_FRAME_BEGIN_RET_1(refDevPath); - - SystemDomain::System()->GetDevpathW(&pPath, &lgth); - if(lgth) - refDevPath = StringObject::NewString(pPath, lgth); - - HELPER_METHOD_FRAME_END(); - return (StringObject*)OBJECTREFToObject(refDevPath); -#else return NULL; -#endif } FCIMPLEND diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp index 35ab5a0814..5caf54585a 100644 --- a/src/debug/daccess/request.cpp +++ b/src/debug/daccess/request.cpp @@ -2295,10 +2295,6 @@ ClrDataAccess::GetFailedAssemblyData(CLRDATA_ADDRESS assembly, unsigned int *pCo } else { -#ifdef FEATURE_FUSION - if (pContext) - *pContext = pAssembly->context; -#endif if (pResult) *pResult = pAssembly->error; } @@ -2679,10 +2675,6 @@ ClrDataAccess::GetAssemblyData(CLRDATA_ADDRESS cdBaseDomainPtr, CLRDATA_ADDRESS if (pAssembly->GetManifestFile()) { -#ifdef FEATURE_FUSION - assemblyData->LoadContext = pAssembly->GetManifestFile()->GetLoadContext(); - assemblyData->dwLocationFlags = pAssembly->GetManifestFile()->GetLocationFlags(); -#endif } diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index 143c44c921..df2e9a444e 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -9587,23 +9587,6 @@ void Debugger::LoadModule(Module* pRuntimeModule, SENDIPCEVENT_BEGIN(this, pThread); -#ifdef FEATURE_FUSION - // Fix for issue Whidbey - 106398 - // Populate the pdb to fusion cache. - - // - if (pRuntimeModule->IsIStream() == FALSE) - { - SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - - HRESULT hrCopy = S_OK; - EX_TRY - { - pRuntimeModule->FusionCopyPDBs(pRuntimeModule->GetPath()); - } - EX_CATCH_HRESULT(hrCopy); // ignore failures - } -#endif // FEATURE_FUSION DebuggerIPCEvent* ipce = NULL; @@ -9802,7 +9785,6 @@ void Debugger::LoadModuleFinished(Module * pRuntimeModule, AppDomain * pAppDomai // Use code:Debugger.SendUpdateModuleSymsEventAndBlock for that. void Debugger::SendRawUpdateModuleSymsEvent(Module *pRuntimeModule, AppDomain *pAppDomain) { -// @telest - do we need an #ifdef FEATURE_FUSION here? CONTRACTL { NOTHROW; @@ -14962,21 +14944,6 @@ HRESULT Debugger::CopyModulePdb(Module* pRuntimeModule) } HRESULT hr = S_OK; -#ifdef FEATURE_FUSION - // - // Populate the pdb to fusion cache. - // - if (pRuntimeModule->IsIStream() == FALSE) - { - SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE; - - EX_TRY - { - pRuntimeModule->FusionCopyPDBs(pRuntimeModule->GetPath()); - } - EX_CATCH_HRESULT(hr); // ignore failures - } -#endif // FEATURE_FUSION return hr; } diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 8ec460eedd..f33f0955e4 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -383,30 +383,6 @@ STDAPI ReOpenMetaDataWithMemoryEx( return hr; } -#ifdef FEATURE_FUSION -// --------------------------------------------------------------------------- -// %%Function: GetAssemblyMDImport -// This function gets the IMDAssemblyImport given the filename -// --------------------------------------------------------------------------- -STDAPI GetAssemblyMDImport( // Return code. - LPCWSTR szFileName, // [in] The scope to open. - REFIID riid, // [in] The interface desired. - IUnknown **ppIUnk) // [out] Return interface on success. -{ - CONTRACTL - { - NOTHROW; - ENTRY_POINT; - } - CONTRACTL_END; - HRESULT hr=S_OK; - BEGIN_ENTRYPOINT_NOTHROW; - - hr=GetAssemblyMDInternalImport(szFileName, riid, ppIUnk); - END_ENTRYPOINT_NOTHROW; - return hr; -} -#endif #ifndef CROSSGEN_COMPILE // --------------------------------------------------------------------------- diff --git a/src/dlls/mscorrc/fuslog.rc b/src/dlls/mscorrc/fuslog.rc index 8a106fa084..c02d1b692b 100644 --- a/src/dlls/mscorrc/fuslog.rc +++ b/src/dlls/mscorrc/fuslog.rc @@ -3,295 +3,6 @@ // See the LICENSE file in the project root for more information. #include "fusres.h" -#ifdef FEATURE_FUSION - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_ASSEMBLY_CREATION_FAILURE L"WRN: Found match in cache, but cannot create assembly from the cache information." - ID_FUSLOG_ASSEMBLY_LOOKUP_FAILURE L"LOG: GAC Lookup was unsuccessful." - ID_FUSLOG_ISEQUAL_DIFF_NAME L"WRN: Comparing the assembly name resulted in the mismatch: NAME" - ID_FUSLOG_ISEQUAL_DIFF_VERSION_MAJOR L"WRN: Comparing the assembly name resulted in the mismatch: Major Version" - ID_FUSLOG_ISEQUAL_DIFF_VERSION_MINOR L"WRN: Comparing the assembly name resulted in the mismatch: Minor Version" - ID_FUSLOG_ISEQUAL_DIFF_VERSION_REVISION L"WRN: Comparing the assembly name resulted in the mismatch: Revision Number" - ID_FUSLOG_ISEQUAL_DIFF_VERSION_BUILD L"WRN: Comparing the assembly name resulted in the mismatch: Build Number" - ID_FUSLOG_ISEQUAL_DIFF_PUBLIC_KEY_TOKEN L"WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN" - ID_FUSLOG_ISEQUAL_DIFF_CULTURE L"WRN: Comparing the assembly name resulted in the mismatch: CULTURE" - ID_FUSLOG_ISEQUAL_DIFF_CUSTOM L"WRN: Comparing the assembly name resulted in the mismatch: CUSTOM" - ID_FUSLOG_CANONICALIZATION_ERROR L"ERR: Fatal error occurred attempting to canonicalize the codebase for this bind." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_POLICY_CACHE_FAILURE L"LOG: Unable to prepare policy cache object." - ID_FUSLOG_APP_CFG_PIGGYBACK L"LOG: Download of application configuration file is already in progress." - ID_FUSLOG_PREBIND_INFO_START L"=== Pre-bind state information ===" - ID_FUSLOG_PREBIND_INFO_DISPLAY_NAME L"LOG: DisplayName = %ws\n (%ws)" - ID_FUSLOG_PREBIND_INFO_WHERE_REF L"LOG: Where-ref bind. Location = %ws" - ID_FUSLOG_PREBIND_INFO_APPBASE L"LOG: Appbase = %ws" - ID_FUSLOG_PREBIND_INFO_PRIVATE_PATH L"LOG: Initial PrivatePath = %ws" - ID_FUSLOG_PREBIND_INFO_DYNAMIC_BASE L"LOG: Dynamic Base = %ws" - ID_FUSLOG_PREBIND_INFO_CACHE_BASE L"LOG: Cache Base = %ws" - ID_FUSLOG_PREBIND_INFO_APP_NAME L"LOG: AppName = %ws" - ID_FUSLOG_PREBIND_INFO_END L"===" - ID_FUSLOG_APP_CFG_DOWNLOAD L"LOG: Attempting application configuration file download." - ID_FUSLOG_APP_CFG_DOWNLOAD_LOCATION L"LOG: Download of application configuration file was attempted from %ws." - ID_FUSLOG_CFG_NOT_EXIST L"LOG: Configuration file %ws does not exist." - ID_FUSLOG_APP_CFG_FOUND L"LOG: Found application configuration file (%ws)." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_DEVOVERRIDE_REF_DEF_MISMATCH L"LOG: Found assembly in DEVOVERRIDE location [%ws], but the assembly reference did not match the assembly definition found." - ID_FUSLOG_DEVOVERRIDE_SIGNATURE_CHECK_FAILED L"LOG: Found assembly in DEVOVERRIDE location [%ws], but signature validation failed." - ID_FUSLOG_XML_PRIVATE_ASM_REDIRECT L"WRN: Binding redirects specified for assemblies without strong names are ignored." - ID_FUSLOG_XML_PARSE_ERROR_CODE L"ERR: There was an error parsing XML (hr = 0x%x)." - ID_FUSLOG_XML_ASSEMBLYIDENTITY_MISSING_NAME L"WRN: The assemblyIdentity was not processed because the name attribute was missing." - ID_FUSLOG_XML_BINDINGREDIRECT_INSUFFICIENT_DATA L"WRN: bindingRedirect tag not processed due to insufficient data." - ID_FUSLOG_XML_CODEBASE_HREF_MISSING L"WRN: codeBase tag not processed because href not present." - ID_FUSLOG_XML_MULTIPLE_IDENTITIES L"WRN: Invalid XML. Encountered more than 1 assemblyIdentity inside single dependentAssembly. Ignoring." - ID_FUSLOG_PRIVATE_PATH_DUPLICATE L"WRN: Private path set. Ignoring duplicate entry." - ID_FUSLOG_POLICY_NOT_APPLIED L"LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind)." - ID_FUSLOG_NO_APP_CONFIG_FILE L"LOG: No application configuration file found." - ID_FUSLOG_APP_CONFIG_FILE L"LOG: Using application configuration file: %ws" - ID_FUSLOG_HOST_CONFIG_FILE L"LOG: Using host configuration file: %ws" - ID_FUSLOG_HOST_CONFIG_FILE_MISSING L"LOG: Host configuration file not found." - ID_FUSLOG_XML_INVALID_PROCESSORARCHITECTURE L"WRN: Invalid processor architecture is specified in assemblyIdentity. Valid processor architectures are neutral/x86/IA64/AMD64." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_HOST_CFG_REDIRECT L"LOG: Redirect found in host configuration file: %ws redirected to %ws." - ID_FUSLOG_HOST_CFG_NO_REDIRECT L"LOG: No redirect found in host configuration file." - ID_FUSLOG_APP_CFG_REDIRECT L"LOG: Redirect found in application configuration file: %ws redirected to %ws." - ID_FUSLOG_APP_CFG_SAFE_MODE L"LOG: Safe mode is set (publisher policy disallowed)." - ID_FUSLOG_PUB_CFG_MISSING L"LOG: Publisher policy file is not found." - ID_FUSLOG_PUB_CFG_FOUND L"LOG: Publisher policy file is found at %ws." - ID_FUSLOG_PUB_CFG_REDIRECT L"LOG: Publisher policy file redirect is found: %ws redirected to %ws." - ID_FUSLOG_PUBLISHER_POLICY_CONFIG_MISSING L"ERR: Publisher policy assembly is found, but there is no config file." - ID_FUSLOG_MACHINE_CFG_MISSING L"LOG: Machine configuration file does not exist at %ws." - ID_FUSLOG_MACHINE_CFG_FOUND L"LOG: Using machine configuration file from %ws." - ID_FUSLOG_MACHINE_CFG_REDIRECT L"LOG: Machine configuration policy file redirect found: %ws redirected to %ws." - ID_FUSLOG_REDIRECT_NO_CODEBASE L"WRN: Binding redirect encountered, but could not retrieve codebase." - ID_FUSLOG_POLICY_CODEBASE L"LOG: Using codebase from policy file: %ws." - ID_FUSLOG_POST_POLICY_REFERENCE L"LOG: Post-policy reference: %ws" - ID_FUSLOG_APPLY_POLICY_FAILED L"ERR: Failed to apply policy (hr = 0x%x)." - ID_FUSLOG_CFG_PRIVATE_PATH L"LOG: Private path hint found in configuration file: %s." - ID_FUSLOG_CAB_ASM_NOT_FOUND L"LOG: Unable to find target assembly in CAB file." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_XML_PARSE_ERROR_FILE L"WRN: Error parsing XML file %ws. Ignoring." - ID_FUSLOG_CODEBASE_RETRIEVE_FAILURE L"ERR: A fatal error occurred when retrieving next codebase for download (hr = 0x%x)." - ID_FUSLOG_ATTEMPT_NEW_DOWNLOAD L"LOG: Attempting download of new URL %ws." - ID_FUSLOG_LOADER_PERMISSION_CHECK_FAILURE L"ERR: Loader location access permission check failed for URL %ws (hr = 0x%x)." - ID_FUSLOG_PROBE_FAIL_BUT_ASM_FOUND L"LOG: Probing in application directory failed, but assembly bind was still able to complete." - ID_FUSLOG_ASM_SETUP_FAILURE L"ERR: Failed to complete setup of assembly (hr = 0x%x). Probing terminated." - ID_FUSLOG_PREDOWNLOAD_FAILURE L"ERR: Unrecoverable error occurred during pre-download check (hr = 0x%x)." - ID_FUSLOG_URLMON_MISSING L"WRN: Unable to find URLMON.DLL. Assemblies cannot be downloaded." - ID_FUSLOG_DOWNLOAD_PIGGYBACK L"LOG: Duplicate download found. Re-using the download in progress." - ID_FUSLOG_DOWNLOAD_SUCCESS L"LOG: Assembly download was successful. Attempting setup of file: %ws" - ID_FUSLOG_LAST_MOD_FAILURE L"ERR: Unable to extract last modified time from %ws." - ID_FUSLOG_MSI_CODEBASE_UNSUPPORTED L"WRN: Current version does not support CODEBASEs to .MSI files. Setup is unable to complete." - ID_FUSLOG_FAILED_PROBING L"LOG: All probing URLs attempted and failed." - ID_FUSLOG_PARTIAL_GAC_UNSUPPORTED L"ERR: Partial binds to assemblies in the global assembly cache are not supported." - ID_FUSLOG_GAC_LOOKUP_SUCCESS L"LOG: Lookup in global assembly cache succeeded." - ID_FUSLOG_MSI_INSTALL_ATTEMPT L"LOG: Attempting to install assembly using Windows Installer." - ID_FUSLOG_PREVIOUS_FAILED L"LOG: The same bind was seen before, and was failed with hr = 0x%x." -END - - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_MSI_ASM_INSTALL_SUCCESS L"LOG: Successfully installed assembly using Windows Installer." - ID_FUSLOG_POLICY_CACHE_INSERT_FAILURE L"ERR: Error inserting entry into policy cache." - ID_FUSLOG_MSI_SUCCESS_FUSION_SETUP_FAIL L"WRN: Windows Installer was able to provide the requested assembly, but setup of resulting file failed." - ID_FUSLOG_SETUP_RUN_FROM_SOURCE L"LOG: Entering run-from-source setup phase." - ID_FUSLOG_SETUP_RUN_FROM_SOURCE_FAILURE L"ERR: Run-from-source setup phase failed with hr = 0x%x." - ID_FUSLOG_MODULE_INTEGRITY_CHECK_FAILURE L"ERR: Module integrity check failed." - ID_FUSLOG_SETUP_DOWNLOAD_CACHE L"LOG: Entering download cache setup phase." - ID_FUSLOG_REF_DEF_MISMATCH L"ERR: The assembly reference did not match the assembly definition found." - ID_FUSLOG_SETUP_FAILURE L"ERR: Setup failed with hr = 0x%x." - ID_FUSLOG_IGNORE_INVALID_PROBE L"WRN: Not probing location %ws, because the location falls outside of the appbase." - ID_FUSLOG_CACHE_LOOKUP_SUCCESS L"LOG: Found assembly by looking in the GAC." - ID_FUSLOG_PREJIT_NOT_FOUND L"ERR: Expected to find a pre-jit assembly in cache, but assembly was not found." - ID_FUSLOG_CODEBASE_CONSTRUCTION_FAILURE L"ERR: Error occurred constructing the probing codebase list." - ID_FUSLOG_CODEBASE_UNAVAILABLE L"ERR: No codebases found to download from." - ID_FUSLOG_DOWNLOAD_CACHE_LOOKUP_SUCCESS L"LOG: Found assembly by looking in the download cache." - ID_FUSLOG_SETUP_CAB L"LOG: Setting up CAB file." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_TEMP_DIR_CREATE_FAILURE L"ERR: Unable to create a temporary directory (hr = 0x%x)." - ID_FUSLOG_CAB_EXTRACT_FAILURE L"ERR: Unable to extract the CAB file (hr = 0x%x)." - ID_FUSLOG_CAB_ASM_FOUND L"LOG: Found matching assembly from CAB file: %ws." - ID_FUSLOG_CAB_EXTRACT_SUCCESS L"LOG: Successfully extracted assembly from CAB file." - ID_FUSLOG_DOWNLOAD_CACHE_CREATE_FAILURE L"ERR: Unable to create assembly in download cache (hr = 0x%x)." - ID_FUSLOG_CAB_ASM_NOT_FOUND_EXTRACTED L"LOG: Unable to find assembly from extracted CAB location: %ws." - ID_FUSLOG_TEMP_DIR_REMOVE_FAILURE L"ERR: Unable to remove temporary directory: %ws." - ID_FUSLOG_MANIFEST_EXTRACT_FAILURE L"ERR: Error extracting manifest import from file (hr = 0x%x)." - ID_FUSLOG_NAME_DEF_EXTRACT_FAILURE L"ERR: Error retrieving assembly name definition from manifest import (hr = 0x%x)." - ID_FUSLOG_INVALID_ASM_PLATFORM L"ERR: Invalid assembly platform or ContentType in file (hr = 0x%x)." - ID_FUSLOG_INVALID_PRIVATE_ASM_LOCATION L"LOG: Private assembly found in invalid location." - ID_FUSLOG_PARTIAL_ASM_IN_APP_DIR L"LOG: A partially-specified assembly bind succeeded from the application directory. Need to re-apply policy." - ID_FUSLOG_LOADFROM_DEFAULT_MISMATCH L"LOG: Assembly in default load context is loaded from a different location than the one in LoadFrom context." - ID_FUSLOG_WHERE_REF_APPLY_POLICY L"LOG: Re-apply policy for where-ref bind." - ID_FUSLOG_WHERE_REF_GAC_MATCH L"LOG: Codebase matches assembly in GAC." - ID_FUSLOG_WHERE_REF_GAC_MISMATCH L"LOG: Codebase does not match assembly in GAC." - ID_FUSLOG_WHERE_REF_LOAD_CONTEXT_MATCH L"LOG: Where-ref bind Codebase matches what is found in default context. Keep the result in default context." - ID_FUSLOG_WHERE_REF_LOAD_CONTEXT_MISMATCH L"LOG: Where-ref bind Codebase does not match what is found in default context. Keep the result in LoadFrom context." - ID_FUSLOG_REPROBE_REQUIRED L"LOG: The post-policy assembly reference requires probing again." - ID_FUSLOG_SWITCH_TO_DEFAULT_CONTEXT L"LOG: Switch from LoadFrom context to default context." - ID_FUSLOG_SWITCH_TO_LOADFROM_CONTEXT L"LOG: Switch from default context to LoadFrom context." - ID_FUSLOG_DUPLICATE_ASM_COMMIT L"WRN: A duplicate assembly was found while copying the assembly item to the cache." - ID_FUSLOG_COPY_FILE_FAILURE L"ERR: Unable to copy file to cache location." - ID_FUSLOG_INVALID_LOCATION_INFO L"ERR: The private assembly was located outside of appbase. Source Url = %ws." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_ASYNC_CFG_DOWNLOAD_SUCCESS L"LOG: The asynchronous application configuration file download successful. Download location %ws" - ID_FUSLOG_ASYNC_CFG_DOWNLOAD_FAILURE L"LOG: The asynchronous configuration file download unsuccessful." - ID_FUSLOG_CACHE_ITEM_CREATE_FAILURE L"ERR: Unable to create assembly cache item (hr = 0x%x)." - ID_FUSLOG_CACHE_ITEM_COMMIT_FAILURE L"ERR: Unable to commit cache item. Attempt to put assembly in cache unsuccessful (hr = 0x%x)." - ID_FUSLOG_LOADCTX_HIT L"LOG: Reusing an assembly instance that was previously loaded (%ws)." - ID_FUSLOG_BIND_SUCCESS L"LOG: Binding succeeds. Returns assembly from %ws." - ID_FUSLOG_ASSEMBLY_NAME_DEF L"LOG: Assembly Name is: %ws" -END - - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_OPERATION_SUCCESSFUL L"The operation was successful." - ID_FUSLOG_OPERATION_FAILED L"The operation failed." - ID_FUSLOG_DETAILED_LOG L"--- A detailed error log follows. \n" - ID_FUSLOG_HEADER_TEXT L"*** Assembly Binder Log Entry " - ID_FUSLOG_BIND_RESULT_TEXT L"Bind result: hr = 0x%x. %ws" - ID_FUSLOG_NO_DESCRIPTION L"No description available.\n" - ID_FUSLOG_FUSION_DLL_PATH L"Assembly manager loaded from: " - ID_FUSLOG_EXECUTABLE L"Running under executable " - ID_FUSLOG_QUALIFIED_ASSEMBLY L"LOG: Partial reference qualified from config file. New reference: %ws." - ID_FUSLOG_CALLING_ASSEMBLY L"Calling assembly : %ws." - ID_FUSLOG_CFG_ASSEMBLY_STORE L"LOG: AssemblyStore path = %ws" - END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_PARTIAL_BIND_DEBUG L"ERR: Partial GAC binds disallowed. [Partial Name = %ws : Calling Assembly = %ws : EXE Name = %ws]." - ID_FUSLOG_DISALLOW_APPLY_PUB_POLICY L"WRN: Application configuration file safe mode disallowed." - ID_FUSLOG_DISALLOW_APP_BINDING_REDIRECTS L"WRN: Application configuration file binding redirects disallowed." - ID_FUSLOG_PREBIND_INFO_DEVOVERRIDE_GLOBAL L"LOG: Global DEVOVERRIDE path = %ws" - ID_FUSLOG_PREBIND_INFO_DEVOVERRIDE_LOCAL L"LOG: Local DEVOVERRIDE path = %ws" - ID_FUSLOG_DEVOVERRIDE_FOUND L"LOG: Found assembly in DEVOVERRIDE path %ws" - ID_FUSLOG_DEVOVERRIDE_MISS L"LOG: Did not find assembly in DEVOVERRIDE path %ws" - ID_FUSLOG_PREBIND_INFO_DEVPATH L"LOG: DEVPATH = %ws" - ID_FUSLOG_ASSEMBLYSTORE_DUPLICATE L"WRN: assemblyStore has already been set. Ignoring duplicate entry." - ID_FUSLOG_DEVOVERRIDE_DUPLICATE L"WRN: devOverridePath has already been set. Ignoring duplicate entry." - ID_FUSLOG_DISALLOW_APP_BASE_PROBING L"WRN: App base probing is disallowed." - ID_FUSLOG_INSPECTION_ONLY L"LOG: This is an inspection only bind." - ID_FUSLOG_SHOW_START_LOAD_CONTEXT L"LOG: This bind starts in %ws load context." - ID_FUSLOG_SHOW_RESULT_LOAD_CONTEXT L"LOG: Assembly is loaded in %ws load context." - ID_FUSLOG_LOAD_CONTEXT_PA_MISMATCH L"ERR: An assembly with different processor architecture is already loaded." - ID_FUSLOG_INCOMPATIBLE_PROCESSOR_ARCHITECTURE L"ERR: Attempt to load an assembly with ProcessorArchitecture incompatible with the running process." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_ISEQUAL_DIFF_RETARGET L"WRN: Comparing the assembly name resulted in the mismatch: Retargetable flag" - ID_FUSLOG_ISEQUAL_DIFF_PROCESSOR_ARCHITECTURE L"WRN: Comparing the assembly name resulted in mismatch of Processor Architecture: Ref %ws, Def %ws." - ID_FUSLOG_ISEQUAL_DIFF_CONTENT_TYPE L"WRN: Comparing the assembly name resulted in the mismatch: Content Type" - ID_FUSLOG_RETARGET_CFG_MISSING L"LOG: Retarget policy is not found." - ID_FUSLOG_RETARGET_CFG_NAME_REDIRECT L"LOG: Name redirect found in retarget config: %ws redirected to %ws." - ID_FUSLOG_RETARGET_CFG_VER_REDIRECT L"LOG: Version redirect found in retarget config: %ws redirected to %ws." - ID_FUSLOG_RETARGET_CFG_PKT_REDIRECT L"LOG: PublicKeyToken redirect found in retarget config: %ws redirected to %ws." - ID_FUSLOG_XML_PARSE_ERROR_MEMORY L"ERR: Parse XML memory stream failed." - ID_FUSLOG_XML_BINDINGRETARGET_INSUFFICIENT_DATA L"ERR: bindingRetarget tag is not processed due to insufficient data." - ID_FUSLOG_FX_CFG_MISSING L"Log: framework config is not found." - ID_FUSLOG_FX_CFG_VER_REDIRECT L"LOG: Version redirect found in framework config: %ws redirected to %ws." - ID_FUSLOG_APPLIESTO_DUPLICATE L"WRN: appliesTo has already been set. Ignoring duplicate appliesTo." - ID_FUSLOG_PORTABILITY_CFG_NAME_REDIRECT L"LOG: Name redirect found in portability config: %ws redirected to %ws." - ID_FUSLOG_PORTABILITY_CFG_VER_REDIRECT L"LOG: Version redirect found in portability config: %ws redirected to %ws." - ID_FUSLOG_PORTABILITY_CFG_PKT_REDIRECT L"LOG: PublicKeyToken redirect found in portability config: %ws redirected to %ws." - ID_FUSLOG_WARNING_SUPPORTPORTABILITY_MISSING_PKT L"WRN: supportPortability tag is not processed due to missing PKT attribute." - ID_FUSLOG_WARNING_SUPPORTPORTABILITY_MISSING_ENABLE L"WRN: supportPortability tag is not processed due to missing enable attribute." - ID_FUSLOG_WARNING_SUPPORTPORTABILITY_INVALID_ENABLE L"WRN: supportPortability tag is not processed due to enable attribute not being 'true' or 'false'." - -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_LOADCTX_HIT_HOST L"LOG: Reusing a host assembly instance that was previously loaded." - ID_FUSLOG_HOST_RESOLVED L"LOG: Assembly binding is resolved by the host." - ID_FUSLOG_ADMIN_CFG_POLICY_CODEBASE L"LOG: Codebase hint found in machine config file: %ws" - ID_FUSLOG_PROCESSOR_ARCHITECTURE_LOCKED L"LOG: ProcessorArchitecture is locked to %ws." - ID_FUSLOG_CHECK_HOST L"LOG: Fusion is hosted. Check host about this assembly." - ID_FUSLOG_NOT_IN_CLR_LOADED_LIST L"LOG: Assembly is not in CLR Loaded list. Asking host assembly store." - ID_FUSLOG_IN_CLR_LOADED_LIST L"LOG: Assembly is in CLR Loaded list. Proceed to normal probing." - ID_FUSLOG_HOST_STORE_NOT_AVAILABLE L"WRN: Host did not provide an assembly store." - ID_FUSLOG_HOST_STORE_RESOLVE_TRY L"LOG: Try host assembly store with assembly %ws." - ID_FUSLOG_HOST_STORE_RESOLVE_FAILED L"WRN: Host assembly store does not contain this assembly." - ID_FUSLOG_HOST_STORE_PARTIAL_NAME_SKIP L"LOG: Input is partial name. Skip host assembly store lookup." - ID_FUSLOG_HOST_GAC_ASM_MISMATCH L"WRN: The assembly returned from host store has different signature from the one in GAC." - ID_FUSLOG_HOST_RESULT L"LOG: Host store returns assembly stream with id = %I64u, context = %I64u." - ID_FUSLOG_HOST_NO_DEBUG_STREAM L"LOG: Host store does not provide debug stream." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_EXPLICIT_BIND_IJW L"LOG: IJW explicit bind. File path:%ws." - ID_FUSLOG_EXPLICIT_BIND_EXE L"LOG: EXE explicit bind. File path:%ws." - ID_FUSLOG_EXPLICIT_BIND_IJW_BIND_FAIL L"ERR: IJW assembly bind failure. hr = 0x%x." - ID_FUSLOG_EXPLICIT_BIND_IJW_PATH_DIFF L"LOG: IJW assembly bind returned a different path: %ws. Use the file provided." - ID_FUSLOG_EXPLICIT_BIND_IJW_PATH_MATCH L"LOG: IJW assembly bind returned the same manifest path." - ID_FUSLOG_EXPLICIT_BIND_IJW_NOT_FOUND L"LOG: IJW assembly bind returned file not found." - ID_FUSLOG_EXPLICIT_BIND_EXE_LOADCONTEXT_COLLISION L"ERR: Assembly with the same identity has already been loaded." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_LOG_TURNED_OFF L"WRN: Assembly binding logging is turned OFF." - ID_FUSLOG_LOG_TURN_ON_HKLM L"To enable assembly bind failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1." - ID_FUSLOG_LOG_PERF_WARNING L"Note: There is some performance penalty associated with assembly bind failure logging." - ID_FUSLOG_LOG_TURN_OFF_HKLM L"To turn this feature off, remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog]." - ID_FUSLOG_UNSUPPORTED_LINKED_CONFIGURATION L"ERR: Unsupported linked configuration location: %ws" - ID_FUSLOG_LINKED_CONFIGURATION_PARSE_ERROR L"ERR: Error processing linked configurations (hr = 0x%x)" - ID_FUSLOG_LINKED_CONFIGURATION_DUPLICATE L"WRN: Ignoring duplicate linked configuration" - ID_FUSLOG_PROCESSING_LINKED_CONFIGURATION L"LOG: Processing linked configuration: %ws" - ID_FUSLOG_MISSING_CACHE_FILE L"ERR: Downloaded file was not cached. The web server may be configured to expire content immediately." - ID_FUSLOG_NO_PARTIAL_NAME_FOR_HOST_APPBASE_COMMON_ASM L"ERR: Partial Name Binding is not allowed when the same assembly exists in both the host assembly store and application base." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_WARNING_PARTIAL_NAME_HEADER L"WRN: Partial binding information was supplied for an assembly:" - ID_FUSLOG_WARNING_PARTIAL_NAME_DETAIL L"WRN: A partial bind occurs when only part of the assembly display name is provided.\r\nWRN: This might result in the binder loading an incorrect assembly.\r\nWRN: It is recommended to provide a fully specified textual identity for the assembly,\r\nWRN: that consists of the simple name, version, culture, and public key token.\r\nWRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue." - ID_FUSLOG_WARNING_PARTIAL_NAME_INSTANCE L"WRN: Assembly Name: %s | Domain ID: %d" - ID_FUSLOG_WARNING_MULTIPLE_VERSIONS_HEADER L"WRN: Multiple versions of the same assembly were loaded into one context of an application domain:" - ID_FUSLOG_WARNING_MULTIPLE_VERSIONS_DETAIL L"WRN: This might lead to runtime failures.\r\nWRN: It is recommended that you remove the dependency on multiple versions, and change the app.config file to point to the required version of the assembly only.\r\nWRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information." - ID_FUSLOG_WARNING_MULTIPLE_VERSIONS_INSTANCE L"WRN: Context: %s | Domain ID: %d | Assembly Name: %s" - ID_FUSLOG_WARNING_MULTIPLE_CONTEXTS_HEADER L"WRN: The same assembly was loaded into multiple contexts of an application domain:" - ID_FUSLOG_WARNING_MULTIPLE_CONTEXTS_DETAIL L"WRN: This might lead to runtime failures.\r\nWRN: It is recommended to inspect your application on whether this is intentional or not.\r\nWRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue." -END - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_BINDING_STATUS_BEGIN L"BEGIN : %s" - ID_FUSLOG_BINDING_STATUS_END L"END" - ID_FUSLOG_BINDING_STATUS_END_HR L"END : %s" - ID_FUSLOG_BINDING_STATUS_NATIVE_DEPENDENCY L"Native image dependency bind." - ID_FUSLOG_BINDING_STATUS_IMMERSIVE L"Immersive bind." - ID_FUSLOG_BINDING_STATUS_FRAMEWORK L"Framework bind." - ID_FUSLOG_BINDING_STATUS_FX_ASSEMBLY_BLOCKED L"Found .NET Framework assembly is not supported in AppX." - ID_FUSLOG_BINDING_STATUS_LOAD_FILE L"Assembly.LoadFile bind." - ID_FUSLOG_BINDING_STATUS_WINRT L"Windows Runtime Type bind." - ID_FUSLOG_BINDING_DEPENDENCY_NAME L"Dependency name: %s" - ID_FUSLOG_BINDING_STATUS_FOUND L"Found: %s" - ID_FUSLOG_BINDING_STATUS_IL_IMAGE L"IL image bind." - ID_FUSLOG_BINDING_STATUS_NATIVE_IMAGE L"Native image bind." -END - -#else // FEATURE_FUSION STRINGTABLE DISCARDABLE BEGIN @@ -346,4 +57,3 @@ BEGIN ID_FUSLOG_BINDING_HEADER_END L"--- A detailed log follows." END -#endif // FEATURE_FUSION diff --git a/src/dlls/mscorrc/fusres.h b/src/dlls/mscorrc/fusres.h index 6d3e1b2216..6d6ddd1e9f 100644 --- a/src/dlls/mscorrc/fusres.h +++ b/src/dlls/mscorrc/fusres.h @@ -4,254 +4,6 @@ #ifndef __FUSION_RESOURCE_H_ #define __FUSION_RESOURCE_H_ -#ifdef FEATURE_FUSION - -#define ID_FUSLOG_ASSEMBLY_CREATION_FAILURE 10000 -#define ID_FUSLOG_ASSEMBLY_LOOKUP_FAILURE 10001 -#define ID_FUSLOG_ISEQUAL_DIFF_NAME 10005 -#define ID_FUSLOG_ISEQUAL_DIFF_VERSION_MAJOR 10006 -#define ID_FUSLOG_ISEQUAL_DIFF_VERSION_MINOR 10007 -#define ID_FUSLOG_ISEQUAL_DIFF_VERSION_REVISION 10008 -#define ID_FUSLOG_ISEQUAL_DIFF_VERSION_BUILD 10009 -#define ID_FUSLOG_ISEQUAL_DIFF_PUBLIC_KEY_TOKEN 10010 -#define ID_FUSLOG_ISEQUAL_DIFF_CULTURE 10011 -#define ID_FUSLOG_ISEQUAL_DIFF_CUSTOM 10012 -#define ID_FUSLOG_CANONICALIZATION_ERROR 10014 -#define ID_FUSLOG_POLICY_CACHE_FAILURE 10016 -#define ID_FUSLOG_APP_CFG_PIGGYBACK 10017 -#define ID_FUSLOG_PREBIND_INFO_START 10018 -#define ID_FUSLOG_PREBIND_INFO_DISPLAY_NAME 10019 -#define ID_FUSLOG_PREBIND_INFO_WHERE_REF 10020 -#define ID_FUSLOG_PREBIND_INFO_APPBASE 10021 -#define ID_FUSLOG_PREBIND_INFO_PRIVATE_PATH 10023 -#define ID_FUSLOG_PREBIND_INFO_DYNAMIC_BASE 10024 -#define ID_FUSLOG_PREBIND_INFO_CACHE_BASE 10025 -#define ID_FUSLOG_PREBIND_INFO_APP_NAME 10026 -#define ID_FUSLOG_PREBIND_INFO_END 10027 -#define ID_FUSLOG_APP_CFG_DOWNLOAD 10028 -#define ID_FUSLOG_APP_CFG_DOWNLOAD_LOCATION 10029 -#define ID_FUSLOG_LOADCTX_HIT 10030 -#define ID_FUSLOG_CFG_NOT_EXIST 10031 -#define ID_FUSLOG_APP_CFG_FOUND 10032 -#define ID_FUSLOG_DEVOVERRIDE_REF_DEF_MISMATCH 10036 -#define ID_FUSLOG_DEVOVERRIDE_SIGNATURE_CHECK_FAILED 10037 -#define ID_FUSLOG_XML_PRIVATE_ASM_REDIRECT 10039 -#define ID_FUSLOG_XML_PARSE_ERROR_CODE 10041 -#define ID_FUSLOG_XML_ASSEMBLYIDENTITY_MISSING_NAME 10042 -#define ID_FUSLOG_XML_BINDINGREDIRECT_INSUFFICIENT_DATA 10043 -#define ID_FUSLOG_XML_CODEBASE_HREF_MISSING 10044 -#define ID_FUSLOG_XML_MULTIPLE_IDENTITIES 10045 -#define ID_FUSLOG_PRIVATE_PATH_DUPLICATE 10046 -#define ID_FUSLOG_POLICY_NOT_APPLIED 10047 -#define ID_FUSLOG_HOST_CONFIG_FILE 10048 -#define ID_FUSLOG_HOST_CONFIG_FILE_MISSING 10049 -#define ID_FUSLOG_HOST_CFG_REDIRECT 10051 -#define ID_FUSLOG_HOST_CFG_NO_REDIRECT 10052 -#define ID_FUSLOG_APP_CFG_REDIRECT 10053 -#define ID_FUSLOG_APP_CFG_SAFE_MODE 10054 -#define ID_FUSLOG_PUB_CFG_MISSING 10055 -#define ID_FUSLOG_PUB_CFG_FOUND 10056 -#define ID_FUSLOG_PUB_CFG_REDIRECT 10057 -#define ID_FUSLOG_MACHINE_CFG_MISSING 10058 -#define ID_FUSLOG_MACHINE_CFG_FOUND 10059 -#define ID_FUSLOG_MACHINE_CFG_REDIRECT 10060 -#define ID_FUSLOG_REDIRECT_NO_CODEBASE 10061 -#define ID_FUSLOG_POLICY_CODEBASE 10062 -#define ID_FUSLOG_POST_POLICY_REFERENCE 10063 -#define ID_FUSLOG_APPLY_POLICY_FAILED 10064 -#define ID_FUSLOG_CFG_PRIVATE_PATH 10065 -#define ID_FUSLOG_XML_PARSE_ERROR_FILE 10066 -#define ID_FUSLOG_CODEBASE_RETRIEVE_FAILURE 10067 -#define ID_FUSLOG_ATTEMPT_NEW_DOWNLOAD 10068 -#define ID_FUSLOG_PROBE_FAIL_BUT_ASM_FOUND 10069 -#define ID_FUSLOG_ASM_SETUP_FAILURE 10070 -#define ID_FUSLOG_PREDOWNLOAD_FAILURE 10071 -#define ID_FUSLOG_URLMON_MISSING 10072 -#define ID_FUSLOG_DOWNLOAD_PIGGYBACK 10073 -#define ID_FUSLOG_DOWNLOAD_SUCCESS 10074 -#define ID_FUSLOG_LAST_MOD_FAILURE 10075 -#define ID_FUSLOG_MSI_CODEBASE_UNSUPPORTED 10076 -#define ID_FUSLOG_CAB_ASM_NOT_FOUND_EXTRACTED 10077 -#define ID_FUSLOG_FAILED_PROBING 10078 -#define ID_FUSLOG_PARTIAL_GAC_UNSUPPORTED 10079 -#define ID_FUSLOG_GAC_LOOKUP_SUCCESS 10080 -#define ID_FUSLOG_MSI_INSTALL_ATTEMPT 10081 -#define ID_FUSLOG_MSI_ASM_INSTALL_SUCCESS 10082 -#define ID_FUSLOG_POLICY_CACHE_INSERT_FAILURE 10084 -#define ID_FUSLOG_MSI_SUCCESS_FUSION_SETUP_FAIL 10085 -#define ID_FUSLOG_SETUP_RUN_FROM_SOURCE 10086 -#define ID_FUSLOG_MODULE_INTEGRITY_CHECK_FAILURE 10087 -#define ID_FUSLOG_SETUP_DOWNLOAD_CACHE 10088 -#define ID_FUSLOG_REF_DEF_MISMATCH 10089 -#define ID_FUSLOG_SETUP_FAILURE 10090 -#define ID_FUSLOG_IGNORE_INVALID_PROBE 10091 -#define ID_FUSLOG_CACHE_LOOKUP_SUCCESS 10092 -#define ID_FUSLOG_PREJIT_NOT_FOUND 10093 -#define ID_FUSLOG_CODEBASE_CONSTRUCTION_FAILURE 10094 -#define ID_FUSLOG_CODEBASE_UNAVAILABLE 10095 -#define ID_FUSLOG_DOWNLOAD_CACHE_LOOKUP_SUCCESS 10096 -#define ID_FUSLOG_SETUP_CAB 10097 -#define ID_FUSLOG_TEMP_DIR_CREATE_FAILURE 10098 -#define ID_FUSLOG_CAB_EXTRACT_FAILURE 10099 -#define ID_FUSLOG_CAB_ASM_FOUND 10100 -#define ID_FUSLOG_CAB_EXTRACT_SUCCESS 10101 -#define ID_FUSLOG_DOWNLOAD_CACHE_CREATE_FAILURE 10102 -#define ID_FUSLOG_CAB_ASM_NOT_FOUND 10103 -#define ID_FUSLOG_TEMP_DIR_REMOVE_FAILURE 10104 -#define ID_FUSLOG_MANIFEST_EXTRACT_FAILURE 10105 -#define ID_FUSLOG_NAME_DEF_EXTRACT_FAILURE 10106 -#define ID_FUSLOG_INVALID_PRIVATE_ASM_LOCATION 10107 -#define ID_FUSLOG_PARTIAL_ASM_IN_APP_DIR 10108 -#define ID_FUSLOG_REPROBE_REQUIRED 10109 -#define ID_FUSLOG_DUPLICATE_ASM_COMMIT 10110 -#define ID_FUSLOG_INVALID_ASM_PLATFORM 10111 -#define ID_FUSLOG_COPY_FILE_FAILURE 10112 -#define ID_FUSLOG_INVALID_LOCATION_INFO 10113 -#define ID_FUSLOG_ASYNC_CFG_DOWNLOAD_SUCCESS 10114 -#define ID_FUSLOG_ASYNC_CFG_DOWNLOAD_FAILURE 10115 -#define ID_FUSLOG_CACHE_ITEM_CREATE_FAILURE 10116 -#define ID_FUSLOG_CACHE_ITEM_COMMIT_FAILURE 10117 - - -#define ID_FUSLOG_OPERATION_SUCCESSFUL 10118 -#define ID_FUSLOG_OPERATION_FAILED 10119 -#define ID_FUSLOG_DETAILED_LOG 10120 -#define ID_FUSLOG_HEADER_TEXT 10121 -#define ID_FUSLOG_BIND_RESULT_TEXT 10122 -#define ID_FUSLOG_NO_DESCRIPTION 10123 -#define ID_FUSLOG_FUSION_DLL_PATH 10124 -#define ID_FUSLOG_EXECUTABLE 10125 - -#define ID_FUSLOG_QUALIFIED_ASSEMBLY 10126 -#define ID_FUSLOG_CALLING_ASSEMBLY 10127 - -#define ID_FUSLOG_CFG_ASSEMBLY_STORE 10128 -#define ID_FUSLOG_SETUP_RUN_FROM_SOURCE_FAILURE 10129 - -#define ID_FUSLOG_ISEQUAL_DIFF_RETARGET 10130 -#define ID_FUSLOG_RETARGET_CFG_MISSING 10131 -#define ID_FUSLOG_RETARGET_CFG_NAME_REDIRECT 10132 -#define ID_FUSLOG_RETARGET_CFG_VER_REDIRECT 10133 -#define ID_FUSLOG_RETARGET_CFG_PKT_REDIRECT 10134 -#define ID_FUSLOG_XML_PARSE_ERROR_MEMORY 10135 -#define ID_FUSLOG_XML_BINDINGRETARGET_INSUFFICIENT_DATA 10136 -#define ID_FUSLOG_XML_INVALID_PROCESSORARCHITECTURE 10137 - -#define ID_FUSLOG_BIND_SUCCESS 10139 - -#define ID_FUSLOG_CROSS_SITE_REDIRECT 10140 -#define ID_FUSLOG_DISALLOW_APPLY_PUB_POLICY 10141 -#define ID_FUSLOG_DISALLOW_APP_BINDING_REDIRECTS 10142 -#define ID_FUSLOG_DISALLOW_APP_BASE_PROBING 10143 -#define ID_FUSLOG_INSPECTION_ONLY 10144 -#define ID_FUSLOG_SHOW_START_LOAD_CONTEXT 10145 -#define ID_FUSLOG_SHOW_RESULT_LOAD_CONTEXT 10146 -#define ID_FUSLOG_LOAD_CONTEXT_PA_MISMATCH 10147 - -#define ID_FUSLOG_FX_CFG_MISSING 10150 -#define ID_FUSLOG_FX_CFG_VER_REDIRECT 10151 -#define ID_FUSLOG_APPLIESTO_DUPLICATE 10152 - -#define ID_FUSLOG_PREBIND_INFO_DEVOVERRIDE_GLOBAL 10153 -#define ID_FUSLOG_PREBIND_INFO_DEVOVERRIDE_LOCAL 10154 -#define ID_FUSLOG_DEVOVERRIDE_FOUND 10155 -#define ID_FUSLOG_DEVOVERRIDE_MISS 10156 -#define ID_FUSLOG_PREBIND_INFO_DEVPATH 10157 -#define ID_FUSLOG_ASSEMBLYSTORE_DUPLICATE 10158 -#define ID_FUSLOG_DEVOVERRIDE_DUPLICATE 10159 - -#define ID_FUSLOG_LOADCTX_HIT_HOST 10160 -#define ID_FUSLOG_HOST_RESOLVED 10161 -#define ID_FUSLOG_ADMIN_CFG_POLICY_CODEBASE 10162 -#define ID_FUSLOG_PROCESSOR_ARCHITECTURE_LOCKED 10163 -#define ID_FUSLOG_CHECK_HOST 10164 -#define ID_FUSLOG_NOT_IN_CLR_LOADED_LIST 10165 -#define ID_FUSLOG_IN_CLR_LOADED_LIST 10166 -#define ID_FUSLOG_HOST_STORE_RESOLVE_TRY 10167 -#define ID_FUSLOG_HOST_STORE_RESOLVE_FAILED 10168 -#define ID_FUSLOG_HOST_STORE_NOT_AVAILABLE 10169 - -// 10170 - 10211 used by native binder - -#define ID_FUSLOG_EXPLICIT_BIND_IJW 10220 -#define ID_FUSLOG_EXPLICIT_BIND_EXE 10221 -#define ID_FUSLOG_EXPLICIT_BIND_IJW_BIND_FAIL 10222 -#define ID_FUSLOG_EXPLICIT_BIND_IJW_PATH_DIFF 10223 -#define ID_FUSLOG_EXPLICIT_BIND_IJW_PATH_MATCH 10224 -#define ID_FUSLOG_EXPLICIT_BIND_IJW_NOT_FOUND 10225 -#define ID_FUSLOG_EXPLICIT_BIND_EXE_LOADCONTEXT_COLLISION 10226 - -#define ID_FUSLOG_PUBLISHER_POLICY_CONFIG_MISSING 10231 - -#define ID_FUSLOG_UNSUPPORTED_LINKED_CONFIGURATION 10300 -#define ID_FUSLOG_LINKED_CONFIGURATION_PARSE_ERROR 10301 -#define ID_FUSLOG_LINKED_CONFIGURATION_DUPLICATE 10302 -#define ID_FUSLOG_PROCESSING_LINKED_CONFIGURATION 10303 - -#define ID_FUSLOG_ISEQUAL_DIFF_PROCESSOR_ARCHITECTURE 10310 -#define ID_FUSLOG_ISEQUAL_DIFF_CONTENT_TYPE 10311 - -#define ID_FUSLOG_WHERE_REF_APPLY_POLICY 10320 -#define ID_FUSLOG_SWITCH_TO_DEFAULT_CONTEXT 10321 -#define ID_FUSLOG_SWITCH_TO_LOADFROM_CONTEXT 10322 -#define ID_FUSLOG_WHERE_REF_GAC_MATCH 10323 -#define ID_FUSLOG_WHERE_REF_GAC_MISMATCH 10324 -#define ID_FUSLOG_WHERE_REF_LOAD_CONTEXT_MATCH 10325 -#define ID_FUSLOG_WHERE_REF_LOAD_CONTEXT_MISMATCH 10326 -#define ID_FUSLOG_HOST_STORE_PARTIAL_NAME_SKIP 10327 -#define ID_FUSLOG_MISSING_CACHE_FILE 10328 -#define ID_FUSLOG_HOST_GAC_ASM_MISMATCH 10329 -#define ID_FUSLOG_HOST_RESULT 10330 -#define ID_FUSLOG_HOST_NO_DEBUG_STREAM 10331 -#define ID_FUSLOG_APP_CONFIG_FILE 10332 -#define ID_FUSLOG_NO_APP_CONFIG_FILE 10333 -#define ID_FUSLOG_ASSEMBLY_NAME_DEF 10334 -#define ID_FUSLOG_PREVIOUS_FAILED 10335 -#define ID_FUSLOG_LOADFROM_DEFAULT_MISMATCH 10336 -#define ID_FUSLOG_LOADER_PERMISSION_CHECK_FAILURE 10337 -#define ID_FUSLOG_INCOMPATIBLE_PROCESSOR_ARCHITECTURE 10338 -#define ID_FUSLOG_NO_PARTIAL_NAME_FOR_HOST_APPBASE_COMMON_ASM 10339 - -// 10400 - 10500 used by native binder - -#define ID_FUSLOG_LOG_TURNED_OFF 10990 -#define ID_FUSLOG_LOG_TURN_ON_HKLM 10991 -#define ID_FUSLOG_LOG_PERF_WARNING 10992 -#define ID_FUSLOG_LOG_TURN_OFF_HKLM 10993 - -#define ID_FUSLOG_PARTIAL_BIND_DEBUG 11000 - -#define ID_FUSLOG_WARNING_PARTIAL_NAME_HEADER 11001 -#define ID_FUSLOG_WARNING_PARTIAL_NAME_DETAIL 11002 -#define ID_FUSLOG_WARNING_PARTIAL_NAME_INSTANCE 11003 -#define ID_FUSLOG_WARNING_MULTIPLE_VERSIONS_HEADER 11004 -#define ID_FUSLOG_WARNING_MULTIPLE_VERSIONS_DETAIL 11005 -#define ID_FUSLOG_WARNING_MULTIPLE_VERSIONS_INSTANCE 11006 -#define ID_FUSLOG_WARNING_MULTIPLE_CONTEXTS_HEADER 11007 -#define ID_FUSLOG_WARNING_MULTIPLE_CONTEXTS_DETAIL 11008 - -#define ID_FUSLOG_PORTABILITY_CFG_NAME_REDIRECT 11011 -#define ID_FUSLOG_PORTABILITY_CFG_VER_REDIRECT 11012 -#define ID_FUSLOG_PORTABILITY_CFG_PKT_REDIRECT 11013 -#define ID_FUSLOG_WARNING_SUPPORTPORTABILITY_MISSING_PKT 11014 -#define ID_FUSLOG_WARNING_SUPPORTPORTABILITY_MISSING_ENABLE 11015 -#define ID_FUSLOG_WARNING_SUPPORTPORTABILITY_INVALID_ENABLE 11016 - -#define ID_FUSLOG_BINDING_STATUS_BEGIN 11020 -#define ID_FUSLOG_BINDING_STATUS_END 11021 -#define ID_FUSLOG_BINDING_STATUS_END_HR 11022 -#define ID_FUSLOG_BINDING_STATUS_NATIVE_DEPENDENCY 11023 -#define ID_FUSLOG_BINDING_STATUS_IMMERSIVE 11024 -#define ID_FUSLOG_BINDING_STATUS_FRAMEWORK 11025 -#define ID_FUSLOG_BINDING_STATUS_LOAD_FILE 11026 -#define ID_FUSLOG_BINDING_STATUS_WINRT 11027 -#define ID_FUSLOG_BINDING_DEPENDENCY_NAME 11028 -#define ID_FUSLOG_BINDING_STATUS_FOUND 11029 -#define ID_FUSLOG_BINDING_STATUS_IL_IMAGE 11030 -#define ID_FUSLOG_BINDING_STATUS_NATIVE_IMAGE 11031 -#define ID_FUSLOG_BINDING_STATUS_FX_ASSEMBLY_BLOCKED 11032 - -#else //!FEATURE_FUSION // we have 10000 to 10125 available (and more) // Used are 10000 to 10042 @@ -305,6 +57,5 @@ #define ID_FUSLOG_BINDING_HEADER_BIND_RESULT_ERROR 10041 #define ID_FUSLOG_BINDING_HEADER_END 10042 -#endif //!FEATURE_FUSION #endif // __FUSION_RESOURCE_H_ diff --git a/src/dlls/mscorrc/include.rc b/src/dlls/mscorrc/include.rc index ee46940871..50c7c779ae 100644 --- a/src/dlls/mscorrc/include.rc +++ b/src/dlls/mscorrc/include.rc @@ -4,4 +4,3 @@ #include "mscorrc.rc" #include "fuslog.rc" -#include "nativelog.rc" diff --git a/src/dlls/mscorrc/nativelog.rc b/src/dlls/mscorrc/nativelog.rc deleted file mode 100644 index 33e94dc129..0000000000 --- a/src/dlls/mscorrc/nativelog.rc +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -#include "nativeres.h" - -#ifdef FEATURE_FUSION - -STRINGTABLE DISCARDABLE -BEGIN - ID_FUSLOG_NGEN_BIND_IL_PROVIDED L"LOG: IL assembly loaded from %ws." - ID_FUSLOG_NGEN_BIND_LOADFROM_NOT_ALLOWED L"WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load()." - ID_FUSLOG_NGEN_BIND_SUCCESS L"LOG: Bind to native image succeeded." - ID_FUSLOG_NGEN_BIND_FAIL L"ERR: Error encountered when binding to native image assembly. (hr = 0x%x)." - ID_FUSLOG_NGEN_BIND_NO_MATCH L"WRN: No matching native image found." - ID_FUSLOG_NGEN_BIND_NGEN_REJECT_CONFIG_MASK L"WRN: Native image compile options do not match request. Looking for next native image." - ID_FUSLOG_NGEN_BIND_NI_DEPEND_START L"LOG: [Level %d]Start validating native image dependency %ws." - ID_FUSLOG_NGEN_BIND_IL_DEPEND_START L"LOG: [Level %d]Start validating IL dependency %ws." - ID_FUSLOG_NGEN_BIND_VALIDATE_DEPENDENCIES L"LOG: Start validating all the dependencies." - ID_FUSLOG_NGEN_BIND_VALIDATE_DEPENDENCIES_SUCCESS L"LOG: Validation of dependencies succeeded." - ID_FUSLOG_NGEN_BIND_REJECT_IL_NOT_FOUND L"WRN: Cannot load IL assembly. (hr = 0x%x)." - ID_FUSLOG_NGEN_BIND_MISSING_FOUND L"WRN: Dependency assembly was not found at ngen time, but is found at binding time. Disallow using this native image." - ID_FUSLOG_NGEN_BIND_AUXCORRUPTION_GENERAL L"ERR: Rejecting native image due to corrupted or missing .aux file (%ws)." - ID_FUSLOG_NGEN_BIND_AUX_REOPTIMIZED L"LOG: Successfully updated stale timestamp in .aux file (%ws)." - ID_FUSLOG_NGEN_BIND_REJECT_SIG L"WRN: Signature of the IL assembly does not match record in .aux file. Validation stops." - ID_FUSLOG_NGEN_BIND_REJECT_TP L"WRN: TPBand of the IL assembly does not match record in .aux file. Validation stops." - ID_FUSLOG_NGEN_BIND_REJECT_TIMESTAMP_SIGFALLBACK L"WRN: Timestamp of the IL assembly does not match record in .aux file. Loading IL to compare signature." - ID_FUSLOG_NGEN_BIND_REJECT_TIMESTAMP_TPFALLBACK L"WRN: Timestamp of the IL assembly does not match record in .aux file. Loading IL to compare TPBand." - ID_FUSLOG_NGEN_BIND_CHANGED_BINDING_POLICY L"WRN: Assembly resolved to a different version or identity than expected. Check if binding policy changed since native image built." - ID_FUSLOG_NGEN_BIND_REJECT_OPTOUT L"WRN: The application has opted out of using native images for this assembly." -END - -#endif // FEATURE_FUSION diff --git a/src/dlls/mscorrc/nativeres.h b/src/dlls/mscorrc/nativeres.h deleted file mode 100644 index d1315176f8..0000000000 --- a/src/dlls/mscorrc/nativeres.h +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -#ifndef __NATIVE_BINDER_RESOURCE_H_ -#define __NATIVE_BINDER_RESOURCE_H_ - -#ifdef FEATURE_FUSION - -#define ID_FUSLOG_NGEN_BIND_IL_PROVIDED 10204 -#define ID_FUSLOG_NGEN_BIND_LOADFROM_NOT_ALLOWED 10174 -#define ID_FUSLOG_NGEN_BIND_SUCCESS 10171 -#define ID_FUSLOG_NGEN_BIND_FAIL 10172 -#define ID_FUSLOG_NGEN_BIND_NO_MATCH 10179 -#define ID_FUSLOG_NGEN_BIND_NGEN_REJECT_CONFIG_MASK 10178 -#define ID_FUSLOG_NGEN_BIND_NI_DEPEND_START 10206 -#define ID_FUSLOG_NGEN_BIND_IL_DEPEND_START 10207 -#define ID_FUSLOG_NGEN_BIND_VALIDATE_DEPENDENCIES 10197 -#define ID_FUSLOG_NGEN_BIND_VALIDATE_DEPENDENCIES_SUCCESS 10200 -#define ID_FUSLOG_NGEN_BIND_REJECT_IL_NOT_FOUND 10183 -#define ID_FUSLOG_NGEN_BIND_MISSING_FOUND 10209 - -// Ids 10400 - 10500 reserved for new native binder messages -// If more ids are needed, reserve them in fusres.h -#define ID_FUSLOG_NGEN_BIND_AUXCORRUPTION_GENERAL 10400 -#define ID_FUSLOG_NGEN_BIND_AUX_REOPTIMIZED 10401 -#define ID_FUSLOG_NGEN_BIND_REJECT_SIG 10402 -#define ID_FUSLOG_NGEN_BIND_REJECT_TP 10403 -#define ID_FUSLOG_NGEN_BIND_REJECT_TIMESTAMP_SIGFALLBACK 10404 -#define ID_FUSLOG_NGEN_BIND_REJECT_TIMESTAMP_TPFALLBACK 10405 -#define ID_FUSLOG_NGEN_BIND_CHANGED_BINDING_POLICY 10406 -#define ID_FUSLOG_NGEN_BIND_REJECT_OPTOUT 10407 - -#endif // FEATURE_FUSION - -#endif // __NATIVE_BINDER_RESOURCE_H_ diff --git a/src/inc/CMakeLists.txt b/src/inc/CMakeLists.txt index d38fa40773..40499b44ea 100644 --- a/src/inc/CMakeLists.txt +++ b/src/inc/CMakeLists.txt @@ -9,7 +9,6 @@ set( CORGUIDS_IDL_SOURCES ivalidator.idl ivehandler.idl gchost.idl - fusionpriv.idl mscorsvc.idl tlbimpexp.idl clrprivappxhosting.idl diff --git a/src/inc/binderngen.idl b/src/inc/binderngen.idl index d20cf93701..f3d41cd6a6 100644 --- a/src/inc/binderngen.idl +++ b/src/inc/binderngen.idl @@ -36,7 +36,6 @@ cpp_quote("#endif") // interface IAssemblyName defined in fusion.idl // interface IAssemblyEnum defined in fusion.idl -// interface IFusionBindLog defined in fusionpriv.idl // interface ICorSvcLogger defined in mscorsvc.idl interface IAssemblyLocation; diff --git a/src/inc/clrprivbinderutil.h b/src/inc/clrprivbinderutil.h index 129e90388e..1a645dccc0 100644 --- a/src/inc/clrprivbinderutil.h +++ b/src/inc/clrprivbinderutil.h @@ -11,9 +11,6 @@ #include "holder.h" #include "internalunknownimpl.h" -#ifdef FEATURE_FUSION -#include "fusion.h" -#endif #include "clrprivbinding.h" #include "slist.h" #ifdef FEATURE_COMINTEROP @@ -89,125 +86,6 @@ namespace CLRPrivBinderUtil } //===================================================================================================================== -#ifdef FEATURE_FUSION - class CLRPrivAssemblyBindResultWrapper : - public IUnknownCommon< - IBindResult, - IAssemblyLocation> - { - public: - //----------------------------------------------------------------------------------------------------------------- - CLRPrivAssemblyBindResultWrapper( - IAssemblyName *pIAssemblyName, - PCWSTR wzAssemblyPath, - IILFingerprintFactory *pILFingerprintFactory - ); - - //----------------------------------------------------------------------------------------------------------------- - ~CLRPrivAssemblyBindResultWrapper(); - - protected: - //================================================================================================================= - // IBindResult methods - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetAssemblyNameDef)( - /*out*/ IAssemblyName **ppIAssemblyNameDef); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetNextAssemblyModuleName)( - /*in*/ DWORD dwNIndex, - __inout_ecount(*pdwCCModuleName) LPWSTR pwzModuleName, - /*in, out, annotation("__inout")*/ LPDWORD pdwCCModuleName); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetAssemblyLocation)( - /*out*/ IAssemblyLocation **ppIAssemblyLocation); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetNativeImage)( - /*out*/ IBindResult **ppIBindResultNI, - /*out*/ BOOL *pfIBindResultNIProbed); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(SetNativeImage)( - /*in*/ IBindResult *pIBindResultNI, - /*out*/ IBindResult **ppIBindResultNIFinal); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(IsEqual)( - /*in*/ IUnknown *pIUnk); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetNextAssemblyNameRef)( - /*in*/ DWORD dwNIndex, - /*out*/ IAssemblyName **ppIAssemblyNameRef); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetNextDependentAssembly)( - /*in*/ DWORD dwNIndex, - /*out*/ IUnknown **ppIUnknownAssembly); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetAssemblyLocationOfILImage)( - /*out*/ IAssemblyLocation **ppAssemblyLocation); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetILFingerprint)( - /*out*/ IILFingerprint **ppFingerprint); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetSourceILTimestamp)( - /*out*/ FILETIME* pFileTime); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetSourceILSize)( - /*out*/ DWORD* pSize); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetNIInfo)( - /*out*/ INativeImageInstallInfo** pInfo); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetFlags)( - /*out*/ DWORD * pdwFlags); - - //================================================================================================================= - // IAssemblyLocation methods - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetLocationType)( - /*out*/DWORD *pdwLocationType); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetPath)( - __inout_ecount(*pdwccAssemblyPath) LPWSTR pwzAssemblyPath, - /*in, annotation("__inout")*/ LPDWORD pdwccAssemblyPath); - - //----------------------------------------------------------------------------------------------------------------- - STDMETHOD(GetHostID)( - /*out*/ UINT64 *puiHostID); - - private: - inline PCWSTR GetILAssemblyPath() - { LIMITED_METHOD_CONTRACT; return m_wzAssemblyPath; } - - NewArrayHolder<WCHAR> m_wzAssemblyPath; - IAssemblyName * m_pIAssemblyName; - - // Since m_bIBindResultNISet and m_pIBindResultNI are separate data, they both need - // to be treated as volatile, making sure to always fetch m_bIBindResultNISet first - // and only read m_pIBindResultNI if m_bIBindResultNISet is true. - Volatile<bool> m_bIBindResultNISet; - VolatilePtr<IBindResult> m_pIBindResultNI; - - IILFingerprint * m_pIILFingerprint; - ReleaseHolder<IILFingerprintFactory> m_pILFingerprintFactory; - - // Used as a leaf lock for publishing, such as m_pIBindResultNI. - Crst m_lock; - }; // class CLRPrivAssemblyBindResultWrapper -#endif // FEATURE_FUSION //================================================================================================================= // Used to create an identity-only ICLRPrivAssembly from an ICLRPrivBinder. This is currently used when diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h index 9a8c6b0f8b..e2d3c05d82 100644 --- a/src/inc/corcompile.h +++ b/src/inc/corcompile.h @@ -32,11 +32,6 @@ #include <corhdr.h> #include <corinfo.h> #include <corjit.h> -#ifdef FEATURE_FUSION -#include <fusion.h> -#include <fusionpriv.h> -#include <binderngen.h> -#endif //FEATURE_FUSION #include <sstring.h> #include <shash.h> #include <daccess.h> @@ -1408,13 +1403,6 @@ class ICorCompilationDomain DWORD *cDependencies ) = 0; -#ifdef FEATURE_FUSION - // Use to retrieve the IBindContext to be used by the native binder. - // This is typically passed into InstallNativeAssembly. - virtual HRESULT GetIBindContext( - IBindContext **ppBindCtx - ) = 0; -#endif #ifdef CROSSGEN_COMPILE virtual HRESULT SetPlatformWinmdPaths( @@ -1493,34 +1481,6 @@ class ICorCompileInfo CORINFO_ASSEMBLY_HANDLE *pHandle ) = 0; -#ifdef FEATURE_FUSION - // Loads an assembly via fusion into the EE - // and returns a handle to it. - virtual HRESULT LoadAssemblyByName( - LPCWSTR wzName, - CORINFO_ASSEMBLY_HANDLE *pHandle - ) = 0; - - // Loads an assembly via ref into the EE - // and returns a handle to it. The last parameter - // optionally allows an IAssemblyName for the ref - // (pre-policy) to be returned - virtual HRESULT LoadAssemblyRef( - IMDInternalImport *pAssemblyImport, - mdAssemblyRef ref, - CORINFO_ASSEMBLY_HANDLE *pHandle, - IAssemblyName **refAssemblyName = NULL - ) = 0; - - // Loads an assembly via its IAssemblyName. This is - // used by NGEN createpdb when generating PDBs for AutoNGENd images (it reads the - // IAssemblyName from the AUX file). - virtual HRESULT LoadAssemblyByIAssemblyName( - IAssemblyName *pAssemblyName, - CORINFO_ASSEMBLY_HANDLE *pHandle - ) = 0; - -#endif //FEATURE_FUSION #ifdef FEATURE_COMINTEROP // Loads a WinRT typeref into the EE and returns @@ -1560,22 +1520,6 @@ class ICorCompileInfo CORINFO_MODULE_HANDLE module ) = 0; -#ifdef FEATURE_FUSION - enum GetAssemblyNameFlags - { - GANF_Default = 0, - GANF_Simple = 1, - }; - - // Returns the fusion name of an assembly - virtual HRESULT GetAssemblyName( - CORINFO_ASSEMBLY_HANDLE hAssembly, - DWORD dwFlags, - __out_ecount(*cchAssemblyName) - __out_z LPWSTR wzAssemblyName, - LPDWORD cchAssemblyName - ) = 0; -#endif //FEATURE_FUSION // Returns the dependency load setting for an assembly ref virtual HRESULT GetLoadHint( diff --git a/src/inc/corhost.h b/src/inc/corhost.h index 8c634a926b..ada1757514 100644 --- a/src/inc/corhost.h +++ b/src/inc/corhost.h @@ -28,9 +28,6 @@ #include "ivehandler.h" #include "ivalidator.h" -#ifdef FEATURE_FUSION -#include "fusion.h" -#endif #include "holder.h" #include "clrprivhosting.h" diff --git a/src/inc/corpriv.h b/src/inc/corpriv.h index 197c7793d9..c422351402 100644 --- a/src/inc/corpriv.h +++ b/src/inc/corpriv.h @@ -469,153 +469,6 @@ struct CORCOMPILE_VERSION_INFO; struct CORCOMPILE_DEPENDENCY; typedef GUID CORCOMPILE_NGEN_SIGNATURE; -#ifdef FEATURE_FUSION -//********************************************************************** -// Gets the dependancies of a native image. If these change, then -// the native image cannot be used. -// -// IMetaDataImport::GetAssemblyRefProps() can be used to obtain information about -// the mdAssemblyRefs. -//***************************************************************************** - -// {814C9E35-3F3F-4975-977A-371F0A878AC7} -EXTERN_GUID(IID_INativeImageDependency, 0x814c9e35, 0x3f3f, 0x4975, 0x97, 0x7a, 0x37, 0x1f, 0xa, 0x87, 0x8a, 0xc7); - -DECLARE_INTERFACE_(INativeImageDependency, IUnknown) -{ - // Get the referenced assembly - STDMETHOD (GetILAssemblyRef) ( - mdAssemblyRef * pAssemblyRef // [OUT] - ) PURE; - - // Get the post-policy assembly actually used - STDMETHOD (GetILAssemblyDef) ( - mdAssemblyRef * ppAssemblyDef, // [OUT] - CORCOMPILE_ASSEMBLY_SIGNATURE * pSign // [OUT] - ) PURE; - - // Get the native image corresponding to GetILAssemblyDef() IF - // there is a hard-bound (directly-referenced) native dependancy - // - // We do not need the configStrig because configStrings have to - // be an exact part. Any partial matches are factored out into GetConfigMask() - STDMETHOD (GetNativeAssemblyDef) ( - CORCOMPILE_NGEN_SIGNATURE * pNativeSign // [OUT] INVALID_NGEN_SIGNATURE if there is no hard-bound dependancy - ) PURE; - - // Get PEKIND of the referenced assembly - STDMETHOD (GetPEKind) ( - PEKIND * CorPEKind // [OUT] - ) PURE; - -}; // INativeImageDependency - -//***************************************************************************** -// -// Fusion uses IFusionNativeImageInfo to obtain (and cache) informaton -// about a native image being installed into the native image cache. -// This allows Fusion to bind directly to native images -// without requiring (expensively) binding to the IL assembly first. -// -// IMetaDataAssemblyImport can be queried for this interface -// -//***************************************************************************** -// {0EA273D0-B4DA-4008-A60D-8D6EFFDD6E91} -EXTERN_GUID(IID_INativeImageInstallInfo, 0xea273d0, 0xb4da, 0x4008, 0xa6, 0xd, 0x8d, 0x6e, 0xff, 0xdd, 0x6e, 0x91); - -DECLARE_INTERFACE_(INativeImageInstallInfo, IUnknown) -{ - // Signature of the ngen image - // This matches the argument type of INativeImageDependency::GetNativeAssemblyDef - - STDMETHOD (GetSignature) ( - CORCOMPILE_NGEN_SIGNATURE * pNgenSign // [OUT] - ) PURE; - - - // CLR timestamp, CPU, compile options, OS type and other attributes of the - // NI image. This can be used to verify that the NI image was built - // with the running CLR. - - STDMETHOD (GetVersionInfo) ( - CORCOMPILE_VERSION_INFO * pVersionInfo // [OUT] - ) PURE; - - - // Signature of the source IL assembly. This can be used to - // verify that the IL image matches a candidate ngen image. - // This matches the argument type of IAssemblyRuntimeSignature::CheckSignature - // - - STDMETHOD (GetILSignature) ( - CORCOMPILE_ASSEMBLY_SIGNATURE * pILSign // [OUT] - ) PURE; - - // A partial match is allowed for the current NativeImage to be valid - - STDMETHOD (GetConfigMask) ( - DWORD * pConfigMask // [OUT] - ) PURE; - - // - // Dependancy assemblies. The native image is only valid - // if the dependancies have not changed. - // - - STDMETHOD (EnumDependencies) ( - HCORENUM * phEnum, // [IN/OUT] - Pointer to the enum - INativeImageDependency *rDeps[], // [OUT] - ULONG cMax, // [IN] Max dependancies to enumerate in this iteration - DWORD * pdwCount // [OUT] - Number of dependancies actually enumerated - ) PURE; - - - // Retrieve a specific dependency by the ngen signature. - - STDMETHOD (GetDependency) ( - const CORCOMPILE_NGEN_SIGNATURE *pcngenSign, // [IN] ngenSig of dependency you want - CORCOMPILE_DEPENDENCY *pDep // [OUT] matching dependency - ) PURE; - -}; // INativeImageInstallInfo - -//***************************************************************************** -// -// Runtime callback made by Fusion into the CLR to determine if the NativeAssembly -// can be used. The pUnkBindSink argument of CAssemblyName::BindToObject() can -// be queried for this interface -// -//***************************************************************************** -// {065AA013-9BDC-447c-922F-FEE929908447} -EXTERN_GUID(IID_INativeImageEvaluate, 0x65aa013, 0x9bdc, 0x447c, 0x92, 0x2f, 0xfe, 0xe9, 0x29, 0x90, 0x84, 0x47); - -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:28718) -#endif //_PREFAST_ - -interface IAssembly; - -#ifdef _PREFAST_ -#pragma warning(pop) -#endif //_PREFAST_ - - -DECLARE_INTERFACE_(INativeImageEvaluate, IUnknown) -{ - // This will be called before the assemblies are actually loaded. - // - // Returns S_FALSE if the native-image cannot be used. - - STDMETHOD (Evaluate) ( - IAssembly *pILAssembly, // [IN] IL assembly in question - IAssembly *pNativeAssembly, // [IN] NGen image we are trying to use for pILAssembly - BYTE * pbCachedData, // [IN] Data cached when the native-image was generated - DWORD dwDataSize // [IN] Size of the pbCachedData buffer - ) PURE; -}; // INativeImageEvaluate - -#endif // FEATURE_FUSION //********************************************************************** // Internal versions of shim functions for use by the CLR. @@ -665,10 +518,6 @@ STDAPI GetRequestedRuntimeInfoInternal(LPCWSTR pExe, // and is shared by the desktop and coreclr's which have separate native binders. // Hence, this interface inherits a lot of "baggage." -#ifdef FEATURE_FUSION -interface IFusionBindLog; -interface IAssemblyName; -#endif // FEATURE_FUSION // A small shim around PEAssemblies/IBindResult that allow us to write Fusion/CLR-agnostic code @@ -683,10 +532,6 @@ class LoggableAssembly { public: virtual SString DisplayString() = 0; // Returns an unspecified representation suitable for injecting into log messages. -#ifdef FEATURE_FUSION - virtual IAssemblyName* FusionAssemblyName() = 0; // Can return NULL. Caller must NOT release result. - virtual IFusionBindLog* FusionBindLog() = 0; // Can return NULL. Caller must NOT release result. -#endif // FEATURE_FUSION }; diff --git a/src/inc/fusion.idl b/src/inc/fusion.idl index 317e690fe6..4056d168ba 100644 --- a/src/inc/fusion.idl +++ b/src/inc/fusion.idl @@ -37,16 +37,6 @@ interface IAssemblyCacheItem; interface IAssemblyName; interface IAssemblyEnum; -#ifdef FEATURE_FUSION -typedef enum -{ - ASM_CACHE_ZAP = 0x1, - ASM_CACHE_GAC = 0x2, - ASM_CACHE_DOWNLOAD = 0x4, - ASM_CACHE_ROOT = 0x8, //This is only meaningful on GetCachePath. - ASM_CACHE_ROOT_EX = 0x80 // Only valid when used with GetCachePath. -} ASM_CACHE_FLAGS; -#endif cpp_quote("#ifndef PEKIND_ENUM_DEFINED") cpp_quote("#define PEKIND_ENUM_DEFINED") @@ -71,160 +61,6 @@ typedef enum _tagAssemblyContentType AssemblyContentType_Invalid = 0xffffffff } AssemblyContentType; -#ifdef FEATURE_FUSION -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyCache -// -/////////////////////////////////////////////////////////////////////////////// - -cpp_quote("// {E707DCDE-D1CD-11D2-BAB9-00C04F8ECEAE}") -cpp_quote("EXTERN_GUID(IID_IAssemblyCache, 0xE707DCDE, 0xD1CD, 0x11D2, 0xBA, 0xB9, 0x00, 0xC0, 0x4F, 0x8E, 0xCE, 0xAE);") - -[ - local, - object, - uuid(e707dcde-d1cd-11d2-bab9-00c04f8eceae), - pointer_default(unique) -] -interface IAssemblyCache : IUnknown -{ - cpp_quote("// {8cedc215-ac4b-488b-93c0-a50a49cb2fb8}") - cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_UNINSTALL_SUBKEY_GUID, 0x8cedc215, 0xac4b, 0x488b, 0x93, 0xc0, 0xa5, 0x0a, 0x49, 0xcb, 0x2f, 0xb8);") - cpp_quote("") - cpp_quote("// {b02f9d65-fb77-4f7a-afa5-b391309f11c9}") - cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_FILEPATH_GUID, 0xb02f9d65, 0xfb77, 0x4f7a, 0xaf, 0xa5, 0xb3, 0x91, 0x30, 0x9f, 0x11, 0xc9);") - cpp_quote("") - cpp_quote("// {2ec93463-b0c3-45e1-8364-327e96aea856}") - cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_OPAQUE_STRING_GUID, 0x2ec93463, 0xb0c3, 0x45e1, 0x83, 0x64, 0x32, 0x7e, 0x96, 0xae, 0xa8, 0x56);") - - cpp_quote(" // {25df0fc1-7f97-4070-add7-4b13bbfd7cb8} // this GUID cannot be used for installing into GAC.") - cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_MSI_GUID, 0x25df0fc1, 0x7f97, 0x4070, 0xad, 0xd7, 0x4b, 0x13, 0xbb, 0xfd, 0x7c, 0xb8); ") - - cpp_quote(" // {d16d444c-56d8-11d5-882d-0080c847b195}") - cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_OSINSTALL_GUID, 0xd16d444c, 0x56d8, 0x11d5, 0x88, 0x2d, 0x00, 0x80, 0xc8, 0x47, 0xb1, 0x95); ") - - typedef struct _FUSION_INSTALL_REFERENCE_ - { - DWORD cbSize; - DWORD dwFlags; - GUID guidScheme; // contains one of the pre-defined guids. - LPCWSTR szIdentifier; // unique identifier for app installing this assembly. - LPCWSTR szNonCannonicalData; // data is description; relevent to the guid above - } FUSION_INSTALL_REFERENCE, *LPFUSION_INSTALL_REFERENCE; - - typedef const FUSION_INSTALL_REFERENCE *LPCFUSION_INSTALL_REFERENCE; - - - typedef struct _ASSEMBLY_INFO - { - ULONG cbAssemblyInfo; // size of this structure for future expansion - DWORD dwAssemblyFlags; - ULARGE_INTEGER uliAssemblySizeInKB; - LPWSTR pszCurrentAssemblyPathBuf; - ULONG cchBuf; // size of path buf. - } ASSEMBLY_INFO; - - cpp_quote("#define IASSEMBLYCACHE_INSTALL_FLAG_REFRESH (0x00000001)") - cpp_quote("#define IASSEMBLYCACHE_INSTALL_FLAG_FORCE_REFRESH (0x00000002)") - - cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED (1)") - cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_STILL_IN_USE (2)") - cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED (3)") - cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_DELETE_PENDING (4)") - cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_HAS_INSTALL_REFERENCES (5)") - cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_REFERENCE_NOT_FOUND (6)") - - cpp_quote("#define QUERYASMINFO_FLAG_VALIDATE (0x00000001)") - cpp_quote("#define QUERYASMINFO_FLAG_GETSIZE (0x00000002)") - - // these flags are for dwAssemblyFlags field in struct _ASSEMBLY_INFO - cpp_quote("#define ASSEMBLYINFO_FLAG_INSTALLED (0x00000001)") - cpp_quote("#define ASSEMBLYINFO_FLAG_PAYLOADRESIDENT (0x00000002)") - - HRESULT UninstallAssembly( - [in] DWORD dwFlags, - [in] LPCWSTR pszAssemblyName, - [in] LPCFUSION_INSTALL_REFERENCE pRefData, - [out, optional] ULONG *pulDisposition - ); - - HRESULT QueryAssemblyInfo( - [in] DWORD dwFlags, - [in] LPCWSTR pszAssemblyName, - [in, out] ASSEMBLY_INFO *pAsmInfo - ); - - HRESULT CreateAssemblyCacheItem( - [in] DWORD dwFlags, - [in] PVOID pvReserved, - [out] IAssemblyCacheItem **ppAsmItem, - [in, optional] LPCWSTR pszAssemblyName // uncanonicalized, comma separted name=value pairs. - ); - - HRESULT CreateAssemblyScavenger - ( - [out] IUnknown **ppUnkReserved - ); - - HRESULT InstallAssembly( // if you use this, fusion will do the streaming & commit. - [in] DWORD dwFlags, - [in] LPCWSTR pszManifestFilePath, - [in] LPCFUSION_INSTALL_REFERENCE pRefData - ); - -} - - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyCacheItem -// -/////////////////////////////////////////////////////////////////////////////// - -cpp_quote("// {9e3aaeb4-d1cd-11d2-bab9-00c04f8eceae}") -cpp_quote("EXTERN_GUID(IID_IAssemblyCacheItem, 0x9e3aaeb4,0xd1cd,0x11d2,0xba,0xb9,0x00,0xc0,0x4f,0x8e,0xce,0xae);") - -[ - local, - object, - uuid(9e3aaeb4-d1cd-11d2-bab9-00c04f8eceae), - pointer_default(unique) -] -interface IAssemblyCacheItem : IUnknown -{ - cpp_quote("#define STREAM_FORMAT_COMPLIB_MODULE 0") - cpp_quote("#define STREAM_FORMAT_COMPLIB_MANIFEST 1") - cpp_quote("#define STREAM_FORMAT_WIN32_MODULE 2") - cpp_quote("#define STREAM_FORMAT_WIN32_MANIFEST 4") - - cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_FLAG_REFRESH (0x00000001)") - cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_FLAG_FORCE_REFRESH (0x00000002)") - - cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_INSTALLED (1)") // first time install - cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_REFRESHED (2)") // overwrite, if existing - cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_ALREADY_INSTALLED (3)") // existing, - - - HRESULT CreateStream( - [in] DWORD dwFlags, // For general API flags - [in] LPCWSTR pszStreamName, // Name of the stream to be passed in - [in] DWORD dwFormat, // format of the file to be streamed in. - [in] DWORD dwFormatFlags, // format-specific flags - [out] IStream **ppIStream, - [in, optional] ULARGE_INTEGER *puliMaxSize // Max size of the Stream. - ); - - HRESULT Commit - ( - [in] DWORD dwFlags, // For general API flags like IASSEMBLYCACHEITEM _COMMIT_FLAG_REFRESH - [out, optional] ULONG *pulDisposition - ); - - HRESULT AbortItem(); // If you have created IAssemblyCacheItem and don't plan to use it, its good idea to call AbortItem before releasing it. - -} -#endif // FEATURE_FUSION /////////////////////////////////////////////////////////////////////////////// // @@ -401,125 +237,6 @@ interface IAssemblyName: IUnknown } -#ifdef FEATURE_FUSION -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyEnum -// -/////////////////////////////////////////////////////////////////////////////// -cpp_quote("// {21B8916C-F28E-11D2-A473-00C04F8EF448}") -cpp_quote("EXTERN_GUID(IID_IAssemblyEnum, 0x21B8916C,0xF28E,0x11D2,0xA4,0x73,0x00,0xC0,0x4F,0x8E,0xF4,0x48);") - -[ - local, - object, - uuid(21b8916c-f28e-11d2-a473-00c04f8ef448), - pointer_default(unique) -] -interface IAssemblyEnum : IUnknown -{ - - HRESULT GetNextAssembly - ( - [in] LPVOID pvReserved, - [out] IAssemblyName **ppName, - [in] DWORD dwFlags - ); - - HRESULT Reset(void); - - HRESULT Clone - ( - [out] IAssemblyEnum **ppEnum - ); - -} - - -/////////////////////////////////////////////////////////////////////////////// -// -// IInstallReferenceItem -// -/////////////////////////////////////////////////////////////////////////////// - -cpp_quote("// {582dac66-e678-449f-aba6-6faaec8a9394}") -cpp_quote("EXTERN_GUID(IID_IInstallReferenceItem, 0x582dac66,0xe678,0x449f,0xab,0xa6,0x6f,0xaa,0xec,0x8a,0x93,0x94);") - -[ - local, - object, - uuid(582dac66-e678-449f-aba6-6faaec8a9394), - pointer_default(unique) -] -interface IInstallReferenceItem : IUnknown -{ - HRESULT GetReference - ( - [out] LPFUSION_INSTALL_REFERENCE *ppRefData, - [in] DWORD dwFlags, - [in] LPVOID pvReserved - ); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IInstallReferenceEnum -// -/////////////////////////////////////////////////////////////////////////////// - -cpp_quote("// {56b1a988-7c0c-4aa2-8639-c3eb5a90226f}") -cpp_quote("EXTERN_GUID(IID_IInstallReferenceEnum, 0x56b1a988,0x7c0c,0x4aa2,0x86,0x39,0xc3,0xeb,0x5a,0x90,0x22,0x6f);") - -[ - local, - object, - uuid(56b1a988-7c0c-4aa2-8639-c3eb5a90226f), - pointer_default(unique) -] -interface IInstallReferenceEnum : IUnknown -{ - HRESULT GetNextInstallReferenceItem - ( - [out] IInstallReferenceItem **ppRefItem, - [in] DWORD dwFlags, - [in] LPVOID pvReserved - ); -} - -typedef enum _tagAssemblyComparisonResult -{ - ACR_Unknown, // Unknown - ACR_EquivalentFullMatch, // all fields match - ACR_EquivalentWeakNamed, // match based on weak-name, version numbers ignored - ACR_EquivalentFXUnified, // match based on FX-unification of version numbers - ACR_EquivalentUnified, // match based on legacy-unification of version numbers - ACR_NonEquivalentVersion, // all fields match except version field - ACR_NonEquivalent, // no match - - ACR_EquivalentPartialMatch, - ACR_EquivalentPartialWeakNamed, - ACR_EquivalentPartialUnified, - ACR_EquivalentPartialFXUnified, - ACR_NonEquivalentPartialVersion -} AssemblyComparisonResult; - - -#pragma midl_echo("STDAPI CreateAssemblyConfigCookie(LPCWSTR wzConfigFilePath, struct AssemblyConfig **ppAssemblyConfigOut);") -#pragma midl_echo("STDAPI DestroyAssemblyConfigCookie(struct AssemblyConfig *pAssemblyConfig);") - -#pragma midl_echo("STDAPI CompareAssemblyIdentity(LPCWSTR pwzAssemblyIdentity1, BOOL fUnified1, LPCWSTR pwzAssemblyIdentity2, BOOL fUnified2, BOOL *pfEquivalent, AssemblyComparisonResult *pResult); ") -#pragma midl_echo("STDAPI CompareAssemblyIdentityWithConfig(LPCWSTR pwzAssemblyIdentity1, BOOL fUnified1, LPCWSTR pwzAssemblyIdentity2, BOOL fUnified2, struct AssemblyConfig *pAssemblyConfig, BOOL *pfEquivalent, AssemblyComparisonResult *pResult); ") -#pragma midl_echo("STDAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum, IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved); ") -#pragma midl_echo("STDAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved); ") -#endif // FEATURE_FUSION #pragma midl_echo("STDAPI CreateAssemblyNameObject(LPASSEMBLYNAME *ppAssemblyNameObj, LPCWSTR szAssemblyName, DWORD dwFlags, LPVOID pvReserved); ") -#ifdef FEATURE_FUSION -#pragma midl_echo("STDAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved); ") -#pragma midl_echo("STDAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, _Out_writes_to_(*pcchPath,*pcchPath) LPWSTR pwzCachePath, PDWORD pcchPath); ") -#pragma midl_echo("STDAPI GetAssemblyIdentityFromFile(LPCWSTR pwzFilePAth, REFIID riid, IUnknown **ppIdentity); ") -#pragma midl_echo("STDAPI ClearDownloadCache();") -#pragma midl_echo("typedef unsigned long MSIHANDLE;") -#pragma midl_echo("STDAPI SetMSIHandleForLogging(MSIHANDLE hMSIHandle);") -#endif // FEATURE_FUSION diff --git a/src/inc/fusionbind.h b/src/inc/fusionbind.h deleted file mode 100644 index 8628d3f9ce..0000000000 --- a/src/inc/fusionbind.h +++ /dev/null @@ -1,316 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - - -/*============================================================ -** -** Header: FusionBind.hpp -** -** Purpose: Implements FusionBind (loader domain) architecture -** -** -===========================================================*/ -#ifndef _FUSIONBIND_H -#define _FUSIONBIND_H - -#ifndef FEATURE_FUSION -#error FEATURE_FUSION is not enabled, please do not include fusionbind.h -#endif - -#include <fusion.h> -#include <fusionpriv.h> -#include "metadata.h" -#include "fusionsink.h" -#include "utilcode.h" -#include "loaderheap.h" -#include "fusionsetup.h" -#include "sstring.h" -#include "ex.h" -#ifdef PAL_STDCPP_COMPAT -#include <type_traits> -#else -#include "clr_std/type_traits" -#endif - -#include "binderngen.h" -#include "clrprivbinding.h" - -class FusionBind -{ -public: - - //**************************************************************************************** - // - - static HRESULT GetVersion(__out_ecount(*pdwVersion) LPWSTR pVersion, __inout DWORD* pdwVersion); - - - //**************************************************************************************** - // - // Creates a fusion context for the application domain. All ApplicationContext properties - // must be set in the AppDomain store prior to this call. Any changes or additions to the - // AppDomain store are ignored. - static HRESULT CreateFusionContext(LPCWSTR pzName, IApplicationContext** ppFusionContext); - - - //**************************************************************************************** - // - // Loads an environmental value into the fusion context - static HRESULT AddEnvironmentProperty(__in LPCWSTR variable, - __in LPCWSTR pProperty, - IApplicationContext* pFusionContext); - - //**************************************************************************************** - // - static HRESULT SetupFusionContext(LPCWSTR szAppBase, - LPCWSTR szPrivateBin, - IApplicationContext** ppFusionContext); - - // Starts remote load of an assembly. The thread is parked on - // an event waiting for fusion to report success or failure. - static HRESULT RemoteLoad(IApplicationContext * pFusionContext, - FusionSink* pSink, - IAssemblyName *pName, - IAssembly *pParentAssembly, - LPCWSTR pCodeBase, - IAssembly** ppIAssembly, - IHostAssembly** ppIHostAssembly, - IBindResult** ppNativeFusionAssembly, - BOOL fForIntrospectionOnly, - BOOL fSuppressSecurityChecks); - - static HRESULT RemoteLoadModule(IApplicationContext * pFusionContext, - IAssemblyModuleImport* pModule, - FusionSink *pSink, - IAssemblyModuleImport** pResult); - - static BOOL VerifyBindingStringW(LPCWSTR pwStr) { - WRAPPER_NO_CONTRACT; - if (wcschr(pwStr, '\\') || - wcschr(pwStr, '/') || - wcschr(pwStr, ':')) - return FALSE; - - return TRUE; - } - - static HRESULT VerifyBindingString(LPCSTR pName) { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - DWORD dwStrLen = WszMultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, pName, -1, NULL, NULL); - CQuickBytes qb; - LPWSTR pwStr = (LPWSTR) qb.AllocNoThrow(dwStrLen*sizeof(WCHAR)); - if (!pwStr) - return E_OUTOFMEMORY; - - if(!WszMultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, pName, -1, pwStr, dwStrLen)) - return HRESULT_FROM_GetLastError(); - - if (VerifyBindingStringW(pwStr)) - return S_OK; - else - return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } - - static void GetAssemblyManifestModulePath(IAssembly *pFusionAssembly, SString &result) - { - CONTRACTL - { - THROWS; - INJECT_FAULT(ThrowOutOfMemory()); - } - CONTRACTL_END; - - DWORD dwSize = 0; - LPWSTR buffer = NULL; - COUNT_T allocation = result.GetUnicodeAllocation(); - if (allocation > 0) { - // pass in the buffer if we got one - dwSize = allocation + 1; - buffer = result.OpenUnicodeBuffer(allocation); - } - HRESULT hr = pFusionAssembly->GetManifestModulePath(buffer, &dwSize); - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - if (buffer != NULL) - result.CloseBuffer(0); - buffer = result.OpenUnicodeBuffer(dwSize-1); - hr = pFusionAssembly->GetManifestModulePath(buffer, &dwSize); - } - if (buffer != NULL) - result.CloseBuffer((SUCCEEDED(hr) && dwSize >= 1) ? (dwSize-1) : 0); - IfFailThrow(hr); - } - - static SString& GetAssemblyNameDisplayName( - IAssemblyName *pName, - SString &result, - DWORD flags = 0 /* default */) - { - CONTRACTL - { - GC_NOTRIGGER; - THROWS; - INJECT_FAULT(ThrowOutOfMemory()); - } - CONTRACTL_END; - - DWORD dwSize = 0; - LPWSTR buffer = NULL; - COUNT_T allocation = result.GetUnicodeAllocation(); - if (allocation > 0) - { - // pass in the buffer if we got one - dwSize = allocation + 1; - buffer = result.OpenUnicodeBuffer(allocation); - } - - HRESULT hr = pName->GetDisplayName(buffer, &dwSize, flags); - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - if (buffer != NULL) - result.CloseBuffer(0); - buffer = result.OpenUnicodeBuffer(dwSize-1); - hr = pName->GetDisplayName(buffer, &dwSize, flags); - } - - if (buffer != NULL) - { - result.CloseBuffer((SUCCEEDED(hr) && dwSize >= 1) ? (dwSize-1) : 0); - } - - IfFailThrow(hr); - return result; - } - - static BOOL GetAssemblyNameStringProperty(IAssemblyName *pName, DWORD property, SString &result) - { - CONTRACTL - { - THROWS; - INJECT_FAULT(ThrowOutOfMemory()); - } - CONTRACTL_END; - - DWORD dwSize = 0; - LPWSTR buffer = NULL; - COUNT_T allocation = result.GetUnicodeAllocation(); - if (allocation > 0) { - // pass in the buffer if we got one - dwSize = (allocation + 1) * sizeof(WCHAR); - buffer = result.OpenUnicodeBuffer(allocation); - } - HRESULT hr = pName->GetProperty(property, (LPVOID)buffer, &dwSize); - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - if (buffer != NULL) - result.CloseBuffer(0); - buffer = result.OpenUnicodeBuffer(dwSize/sizeof(WCHAR) - 1); - hr = pName->GetProperty(property, (LPVOID)buffer, &dwSize); - } - if (buffer != NULL) - result.CloseBuffer((SUCCEEDED(hr) && dwSize >= sizeof(WCHAR)) ? (dwSize/sizeof(WCHAR)-1) : 0); - if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - { - return FALSE; - } - IfFailThrow(hr); - - return TRUE; - } - - static BOOL GetApplicationContextStringProperty(IApplicationContext *pContext, - LPCWSTR property, SString &result) - { - CONTRACTL - { - THROWS; - INJECT_FAULT(ThrowOutOfMemory()); - } - CONTRACTL_END; - - DWORD dwSize = 0; - LPWSTR buffer = NULL; - COUNT_T allocation = result.GetUnicodeAllocation(); - if (allocation > 0) { - // pass in the buffer if we got one - dwSize = (allocation + 1) * sizeof(WCHAR); - buffer = result.OpenUnicodeBuffer(allocation); - } - HRESULT hr = pContext->Get(property, (LPVOID)buffer, &dwSize, 0); - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - if (buffer != NULL) - result.CloseBuffer(0); - buffer = result.OpenUnicodeBuffer(dwSize/sizeof(WCHAR) - 1); - hr = pContext->Get(property, (LPVOID)buffer, &dwSize, 0); - } - if (buffer != NULL) - result.CloseBuffer((SUCCEEDED(hr) && dwSize >= sizeof(WCHAR)) ? (dwSize/sizeof(WCHAR)-1) : 0); - if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - { - return FALSE; - } - IfFailThrow(hr); - - return TRUE; - } - - static BOOL GetApplicationContextDWORDProperty(IApplicationContext *pContext, - LPCWSTR property, DWORD *result) - { - CONTRACTL - { - THROWS; - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - DWORD dwSize = sizeof(DWORD); - HRESULT hr = pContext->Get(property, result, &dwSize, 0); - if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - return FALSE; - - IfFailThrow(hr); - - return TRUE; - } - - static void SetApplicationContextStringProperty(IApplicationContext *pContext, LPCWSTR property, - SString &value) - { - CONTRACTL - { - THROWS; - INJECT_FAULT(ThrowOutOfMemory()); - } - CONTRACTL_END; - - IfFailThrow(pContext->Set(property, (void *) value.GetUnicode(), - (value.GetCount()+1)*sizeof(WCHAR), 0)); - } - - static void SetApplicationContextDWORDProperty(IApplicationContext *pContext, LPCWSTR property, - DWORD value) - { - CONTRACTL - { - THROWS; - INJECT_FAULT(ThrowOutOfMemory()); - } - CONTRACTL_END; - - IfFailThrow(pContext->Set(property, &value, sizeof(value), 0)); - } -}; - -#endif - diff --git a/src/inc/fusionpriv.idl b/src/inc/fusionpriv.idl deleted file mode 100644 index a988539f52..0000000000 --- a/src/inc/fusionpriv.idl +++ /dev/null @@ -1,954 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -//+--------------------------------------------------------------------------- -// -// Microsoft Windows -// File: fusionpriv.idl -// -// Contents: Fusion Interfaces -// -// Classes: -// -// Functions: -// -// -//---------------------------------------------------------------------------- -cpp_quote("//=--------------------------------------------------------------------------=") -cpp_quote("// fusionpriv.h") -cpp_quote("//=--------------------------------------------------------------------------=") -cpp_quote("// Licensed to the .NET Foundation under one or more agreements.") -cpp_quote("// The .NET Foundation licenses this file to you under the MIT license.") -cpp_quote("// See the LICENSE file in the project root for more information.") -cpp_quote("//=--------------------------------------------------------------------------=") -cpp_quote("") -cpp_quote("#ifdef _MSC_VER") -cpp_quote("#pragma comment(lib,\"uuid.lib\")") -cpp_quote("#endif") -cpp_quote("") -cpp_quote("//---------------------------------------------------------------------------=") -cpp_quote("// Fusion Interfaces.") -cpp_quote("") - -cpp_quote("#if defined(_CLR_BLD) && !defined(FEATURE_FUSION)") -cpp_quote("#error FEATURE_FUSION is not enabled, please do not include fusionpriv.h") -cpp_quote("#endif") - - -import "objidl.idl"; -import "oleidl.idl"; -import "fusion.idl"; - - -cpp_quote("#ifdef _MSC_VER") -cpp_quote("#pragma once") -cpp_quote("#endif") - -interface IAssembly; -interface IAssemblyBindSink; -interface IAssemblyBinding; -interface IAssemblyManifestImport; -interface IAssemblyModuleImport; -interface IAssemblyBindingClosure; - -interface IAssemblyNameBinder; -interface IHistoryAssembly; -interface IHistoryReader; -interface IFusionBindLog; - -interface IAssemblyScavenger; - -interface IHostAssembly; -interface IHostAssemblyModuleImport; - -interface IMetaDataAssemblyImport; -#pragma midl_echo("struct IMetaDataAssemblyImport;") - -struct AssemblyReferenceClosureWalkContextForProfAPI; - -cpp_quote("EXTERN_C const IID IID_IApplicationContext; ") -cpp_quote("EXTERN_C const IID IID_IAssembly; ") -cpp_quote("EXTERN_C const IID IID_IAssemblyBindSink; ") -cpp_quote("EXTERN_C const IID IID_IAssemblyBinding; ") -cpp_quote("EXTERN_C const IID IID_IAssemblyManifestImport;") -cpp_quote("EXTERN_C const IID IID_IAssemblyModuleImport; ") - -cpp_quote("EXTERN_C const IID IID_IHistoryAssembly; ") -cpp_quote("EXTERN_C const IID IID_IHistoryReader; ") -cpp_quote("EXTERN_C const IID IID_IMetaDataAssemblyImportControl; ") - -cpp_quote("EXTERN_C const IID IID_IAssemblyScavenger; ") - -cpp_quote("EXTERN_C const IID IID_IHostAssembly; ") -cpp_quote("EXTERN_C const IID IID_IHostAssemblyModuleImport; ") -// -// Bind flags for IAssemblyName::BindToObject -// -// External caller of IAssemblyName::BindToObject should only use ASM_BINDF_PARENT_ASM_HINT/ASM_BINDF_NONE/ASM_BINDF_INSPECTION_ONLY. -// The rest is used internally by fusion. They can(and should) be set via IApplicationContext::Set. -// -typedef enum -{ - ASM_BINDF_NONE = 0x0, - ASM_BINDF_FORCE_CACHE_INSTALL = 0x1, - ASM_BINDF_RFS_INTEGRITY_CHECK = 0x2, - ASM_BINDF_RFS_MODULE_CHECK = 0x4, - ASM_BINDF_BINPATH_PROBE_ONLY = 0x8, - //ASM_BINDF_SHARED_BINPATH_HINT = 0x10, - ASM_BINDF_PARENT_ASM_HINT = 0x20, - ASM_BINDF_DISALLOW_APPLYPUBLISHERPOLICY = 0x40, - ASM_BINDF_DISALLOW_APPBINDINGREDIRECTS = 0x80, - ASM_BINDF_DISABLE_FX_UNIFICATION = 0x100, - ASM_BINDF_DO_NOT_PROBE_NATIVE_IMAGE = 0x200, - ASM_BINDF_DISABLE_DOWNLOAD = 0x400, - ASM_BINDF_INSPECTION_ONLY = 0x800, - ASM_BINDF_DISALLOW_APP_BASE_PROBING = 0x1000, - ASM_BINDF_SUPPRESS_SECURITY_CHECKS = 0x2000 -} ASM_BIND_FLAGS; - -typedef enum tagDEVOVERRIDEMODE { - DEVOVERRIDE_LOCAL = 0x1, - DEVOVERRIDE_GLOBAL = 0x2 -} DEVOVERRIDEMODE; - -typedef enum tagWALK_LEVEL -{ - LEVEL_STARTING, // only basic info - LEVEL_WINRTCHECK, // WinRT specific checks - LEVEL_GACCHECK, // until find something outside of the GAC - LEVEL_COMPLETE, // no reason to request higher than this - LEVEL_FXPREDICTED, // full walk, but FX assemblies were predicted - LEVEL_FXPROBED // full walk, but FX assemblies could not be predicted -} WALK_LEVEL; - -/////////////////////////////////////////////////////////////////////////////// -// -// IHistoryAssembly -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(e6096a07-e188-4a49-8d50-2a0172a0d205), - pointer_default(unique) -] -interface IHistoryAssembly : IUnknown -{ - HRESULT GetAssemblyName - ( - [out, annotation("__out")] LPWSTR wzAsmName, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetPublicKeyToken - ( - [out, annotation("__out")] LPWSTR wzPublicKeyToken, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetCulture - ( - [out, annotation("__out")] LPWSTR wzCulture, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetReferenceVersion - ( - [out, annotation("__out")] LPWSTR wzVerRef, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetActivationDate - ( - [out, annotation("__out")] LPWSTR wzActivationDate, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetAppCfgVersion - ( - [out, annotation("__out")] LPWSTR pwzVerAppCfg, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetPublisherCfgVersion - ( - [out, annotation("__out")] LPWSTR pwzVerPublisherCfg, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetAdminCfgVersion - ( - [out, annotation("__out")] LPWSTR pwzAdminCfg, - [in, out, annotation("__inout")] DWORD *pdwSize - ); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IHistoryReader -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(1d23df4d-a1e2-4b8b-93d6-6ea3dc285a54), - pointer_default(unique) -] -interface IHistoryReader : IUnknown -{ - HRESULT GetFilePath - ( - [out, annotation("__out")] LPWSTR wzFilePath, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetApplicationName - ( - [out, annotation("__out")] LPWSTR wzAppName, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetEXEModulePath - ( - [out, annotation("__out")] LPWSTR wzExePath, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - - HRESULT GetNumActivations - ( - [out] DWORD *pdwNumActivations - ); - - HRESULT GetActivationDate - ( - [in] DWORD dwIdx, - [out] FILETIME *pftDate - ); - - HRESULT GetRunTimeVersion - ( - [in] FILETIME *pftActivationDate, - [out, annotation("__out")] LPWSTR wzRunTimeVersion, - [in, out, annotation("__inout")] DWORD *pdwSize - ); - - HRESULT GetNumAssemblies - ( - [in] FILETIME *pftActivationDate, - [out] DWORD *pdwNumAsms - ); - - HRESULT GetHistoryAssembly - ( - [in] FILETIME *pftActivationDate, - [in] DWORD dwIdx, - [out] IHistoryAssembly **ppHistAsm - ); -} - -typedef enum { - LOADCTX_TYPE_DEFAULT, - LOADCTX_TYPE_LOADFROM, - LOADCTX_TYPE_UNKNOWN, - LOADCTX_TYPE_HOSTED, // Assembly bind was provided by hosted binder. -} LOADCTX_TYPE; - -// Log for normal assembly binding -cpp_quote("#define FUSION_BIND_LOG_CATEGORY_DEFAULT 0") -// Log for native image binding -cpp_quote("#define FUSION_BIND_LOG_CATEGORY_NGEN 1") -// max entry for bind log kinds. Should always point to the biggest one -cpp_quote("#define FUSION_BIND_LOG_CATEGORY_MAX 2") - -/////////////////////////////////////////////////////////////////////////////// -// -// IFusionBindLog -// -/////////////////////////////////////////////////////////////////////////////// - -[ - local, - object, - uuid(67E9F87D-8B8A-4a90-9D3E-85ED5B2DCC83), - pointer_default(unique) -] -interface IFusionBindLog : IUnknown -{ - HRESULT SetResultCode - ( - [in] DWORD dwLogCategory, - [in] HRESULT hr - ); - - HRESULT GetResultCode - ( - [in] DWORD dwLogCategory, - [out] HRESULT *pHr - ); - - HRESULT GetBindLog - ( - [in] DWORD dwDetailLevel, - [in] DWORD dwLogCategory, - [out, annotation("__out_opt")] LPWSTR pwzDebugLog, - [in, out, annotation("__inout")] DWORD *pcbDebugLog - ); - - HRESULT LogMessage - ( - [in] DWORD dwDetailLevel, - [in] DWORD dwLogCategory, - [in] LPCWSTR pwzDebugLog - ); - - HRESULT Flush - ( - [in] DWORD dwDetailLevel, - [in] DWORD dwLogCategory - ); - - HRESULT GetBindingID - ( - [out] ULONGLONG *pullBindingID - ); - - HRESULT ETWTraceLogMessage - ( - [in] DWORD dwETWLogCategory, - [in] IAssemblyName *pAsm - ); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyManifestImport -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid( de9a68ba-0fa2-11d3-94aa-00c04fc308ff), - pointer_default(unique) -] -interface IAssemblyManifestImport: IUnknown -{ - typedef [unique] IAssemblyManifestImport *LPASSEMBLY_MANIFEST_IMPORT; - - HRESULT GetAssemblyNameDef( - [out] IAssemblyName **ppAssemblyName); - - HRESULT GetNextAssemblyNameRef( - [in] DWORD nIndex, - [out] IAssemblyName ** ppAssemblyName); - - HRESULT GetNextAssemblyModule( - [in] DWORD nIndex, - [out] IAssemblyModuleImport **ppImport); - - HRESULT GetModuleByName( - [in] LPCOLESTR szModuleName, - [out] IAssemblyModuleImport **ppModImport); - - HRESULT GetManifestModulePath( - [out, size_is(*pccModulePath), annotation("__out_ecount_full(*pccModulePath)")] LPOLESTR szModulePath, - [in, out] LPDWORD pccModulePath); - - HRESULT GetInternalMDImport( - [out] IMetaDataAssemblyImport **ppMDImport); - - HRESULT LoadDataFromMDImport( - [in] IMetaDataAssemblyImport *ppMDImport); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IApplicationContext -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(7c23ff90-33af-11d3-95da-00a024a85b51), - pointer_default(unique) -] -interface IApplicationContext: IUnknown -{ - cpp_quote("// App context configuration variables") - cpp_quote("#define ACTAG_APP_BASE_URL L\"APPBASE\"") - cpp_quote("#define ACTAG_MACHINE_CONFIG L\"MACHINE_CONFIG\"") - cpp_quote("#define ACTAG_APP_PRIVATE_BINPATH L\"PRIVATE_BINPATH\"") - cpp_quote("#define ACTAG_APP_SHARED_BINPATH L\"SHARED_BINPATH\"") - cpp_quote("#define ACTAG_APP_SNAPSHOT_ID L\"SNAPSHOT_ID\"") - cpp_quote("#define ACTAG_APP_CONFIG_FILE L\"APP_CONFIG_FILE\"") - cpp_quote("#define ACTAG_APP_ID L\"APPLICATION_ID\"") - cpp_quote("#define ACTAG_APP_SHADOW_COPY_DIRS L\"SHADOW_COPY_DIRS\"") - cpp_quote("#define ACTAG_APP_DYNAMIC_BASE L\"DYNAMIC_BASE\"") - cpp_quote("#define ACTAG_APP_CACHE_BASE L\"CACHE_BASE\"") - cpp_quote("#define ACTAG_APP_NAME L\"APP_NAME\"") - cpp_quote("#define ACTAG_DEV_PATH L\"DEV_PATH\"") - cpp_quote("#define ACTAG_HOST_CONFIG_FILE L\"HOST_CONFIG\"") - cpp_quote("#define ACTAG_SXS_ACTIVATION_CONTEXT L\"SXS\"") - cpp_quote("#define ACTAG_APP_CFG_LOCAL_FILEPATH L\"APP_CFG_LOCAL_FILEPATH\"") - cpp_quote("#define ACTAG_ZAP_STRING L\"ZAP_STRING\"") - cpp_quote("#define ACTAG_ZAP_CONFIG_FLAGS L\"ZAP_CONFIG_FLAGS\"") - cpp_quote("#define ACTAG_APP_DOMAIN_ID L\"APPDOMAIN_ID\"") - cpp_quote("#define ACTAG_APP_CONFIG_BLOB L\"APP_CONFIG_BLOB\"") - cpp_quote("#define ACTAG_FX_ONLY L\"FX_ONLY\"") - - cpp_quote("// App context flag overrides") - cpp_quote("#define ACTAG_FORCE_CACHE_INSTALL L\"FORCE_CACHE_INSTALL\"") - cpp_quote("#define ACTAG_RFS_INTEGRITY_CHECK L\"RFS_INTEGRITY_CHECK\"") - cpp_quote("#define ACTAG_RFS_MODULE_CHECK L\"RFS_MODULE_CHECK\"") - cpp_quote("#define ACTAG_BINPATH_PROBE_ONLY L\"BINPATH_PROBE_ONLY\"") - cpp_quote("#define ACTAG_DISALLOW_APPLYPUBLISHERPOLICY L\"DISALLOW_APP\"") - cpp_quote("#define ACTAG_DISALLOW_APP_BINDING_REDIRECTS L\"DISALLOW_APP_REDIRECTS\"") - cpp_quote("#define ACTAG_DISALLOW_APP_BASE_PROBING L\"DISALLOW_APP_BASE_PROBING\"") - cpp_quote("#define ACTAG_CODE_DOWNLOAD_DISABLED L\"CODE_DOWNLOAD_DISABLED\"") - cpp_quote("#define ACTAG_DISABLE_FX_ASM_UNIFICATION L\"DISABLE_FX_ASM_UNIFICATION\"") - - typedef [unique] IApplicationContext *LPAPPLICATIONCONTEXT; - - typedef enum - { - APP_CTX_FLAGS_INTERFACE = 0x1 - } APP_FLAGS; - - HRESULT SetContextNameObject( - [in] LPASSEMBLYNAME pName); - - HRESULT GetContextNameObject( - [out] LPASSEMBLYNAME * ppName); - - - HRESULT Set( - [in] LPCOLESTR szName, - [in] LPVOID pvValue, - [in] DWORD cbValue, - [in] DWORD dwFlags); - - HRESULT Get( - [in] LPCOLESTR szName, - [out] LPVOID pvValue, - [in, out] LPDWORD pcbValue, - [in] DWORD dwFlags); - - HRESULT GetDynamicDirectory( - [out, annotation("__out_ecount_opt(*pdwSize)")] LPWSTR wzDynamicDir, - [in, out] LPDWORD pdwSize); - - HRESULT GetAppCacheDirectory( - [out, annotation("__out_ecount_opt(*pdwSize)")] LPWSTR wzAppCacheDir, - [in, out] LPDWORD pdwSize); - - HRESULT RegisterKnownAssembly( - [in] IAssemblyName *pName, - [in] LPCWSTR pwzAsmURL, - [out] IAssembly **ppAsmOut); - - HRESULT PrefetchAppConfigFile(); - - // This will give a IAssemblyBindingClosure object without really walking - // the closure. Any of the APIs on IAssemblyBindingClosure may trigger a - // real walking. - // - // This closure is not cached in fusion. Caller is responsible to cache the closure. - // - // pUnk is the result of a previous bind within the same application context. - // It could be IHostAssembly or IAssembly. The assembly has to be strongly named. - // - // dwSharingFlags cannot be 0 now. - HRESULT GetAssemblyBindingClosure( - [in] IUnknown *pUnk, - [in] LPCWSTR pwzNativeImagePath, - [out] IAssemblyBindingClosure **ppAsmClosure - ); -} - -[ - local, - object, - uuid(56972d9d-0f6c-47de-a038-e82d5de3a777), - pointer_default(unique) -] -interface IAssemblyNameBinder : IUnknown -{ - HRESULT BindToObject( - [in] REFIID refIID, - [in] IUnknown *pUnkSink, - [in] IUnknown *pUnkContext, - [in] LPCOLESTR szCodeBase, - [in] LONGLONG llFlags, - [in] LPVOID pParentAssembly, - [in] DWORD cbReserved, - [out] LPVOID *ppv, - [out] LPVOID *ppvNI); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssembly -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(ff08d7d4-04c2-11d3-94aa-00c04fc308ff), - pointer_default(unique) -] -interface IAssembly : IUnknown -{ - typedef [unique] IAssembly *LPASSEMBLY; - - cpp_quote("#define ASMLOC_LOCATION_MASK 0x0000001B") - cpp_quote("#define ASMLOC_UNKNOWN 0x00000000") - cpp_quote("#define ASMLOC_GAC 0x00000001") - cpp_quote("#define ASMLOC_DOWNLOAD_CACHE 0x00000002") - cpp_quote("#define ASMLOC_RUN_FROM_SOURCE 0x00000003") - cpp_quote("#define ASMLOC_CODEBASE_HINT 0x00000004") - cpp_quote("#define ASMLOC_ZAP 0x00000008") - cpp_quote("#define ASMLOC_DEV_OVERRIDE 0x00000010") - - HRESULT GetAssemblyNameDef( - [out] IAssemblyName **ppAssemblyName); - - HRESULT GetNextAssemblyNameRef( - [in] DWORD nIndex, - [out] IAssemblyName **ppAssemblyName); - - HRESULT GetNextAssemblyModule( - [in] DWORD nIndex, - [out] IAssemblyModuleImport **ppModImport); - - HRESULT GetModuleByName( - [in] LPCOLESTR szModuleName, - [out] IAssemblyModuleImport **ppModImport); - - HRESULT GetManifestModulePath( - [out, size_is(*pccModulePath), annotation("__out_ecount_full_opt(*pccModulePath)")] LPOLESTR szModulePath, - [in, out] LPDWORD pccModulePath); - - HRESULT GetAssemblyPath( - [out, size_is(*lpcwBuffer), annotation("__out_ecount_full_opt(*lpcwBuffer)")] LPOLESTR pStr, - [in, out] LPDWORD lpcwBuffer); - - HRESULT GetAssemblyLocation( - [out] DWORD *pdwAsmLocation); - - LOADCTX_TYPE GetFusionLoadContext(); - - HRESULT GetNextHardBoundDependency( - [in] DWORD dwIndex, - [out] IAssembly **ppILAsm, - [out] IAssembly **ppNIAsm); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyBindingClosureEnumerator -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(b3f1e4ed-cb09-4b85-9a1b-6809582f1ebc), - pointer_default(unique) -] -interface IAssemblyBindingClosureEnumerator : IUnknown -{ - // Get the next assembly in the closure's path - HRESULT GetNextAssemblyPath( - [out] LPCOLESTR *ppPath, - [out] LPCOLESTR *ppniPath); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyBindingClosure -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(415c226a-e513-41ba-9651-9c48e97aa5de), - pointer_default(unique) -] -interface IAssemblyBindingClosure : IUnknown -{ - // Test if all the assemblies in the closure are in GAC. - // return: - // S_OK all assemblies are in GAC. - // S_FALSE not all assemblies are in GAC. - // otherwise failure. - HRESULT IsAllAssembliesInGAC(); - - // Test to see if two closures are semantically the same - // under the specified sharing context. - // return: - // S_OK Equal. - // S_FALSE Not Equal. - // otherwise failure. - HRESULT IsEqual( - [in] IAssemblyBindingClosure *pAssemblyClosure - ); - - HRESULT GetNextFailureAssembly( - [in] DWORD dwIndex, - [out] IAssemblyName **ppName, - [out] HRESULT *pHResult); - - // ensure enough data is available - HRESULT EnsureWalked( - [in] IUnknown *pStartingAssembly, - [in] IApplicationContext *pAppCtx, - [in] WALK_LEVEL level); - - // Iterate over assembly paths in the closure - HRESULT EnumerateAssemblies( - [out] IAssemblyBindingClosureEnumerator **ppEnumerator); - - HRESULT HasBeenWalked([in] WALK_LEVEL level); - - // Test if the assembly might have unknonwn dependecies because of WinRT - // return: - // S_OK May. - // S_FALSE No, all dependecies are traceable or FX. - // otherwise failure. - HRESULT MayHaveUnknownDependencies(); - - - // The closure walker asks the profiler (when present) for any additional - // assembly references the profiler wishes to add. This method is then called - // back by the profiler for each such assembly reference. - HRESULT AddProfilerAssemblyReference( - [in] LPVOID pbPublicKeyOrToken, - [in] ULONG cbPublicKeyOrToken, - [in] LPCWSTR szName, - [in] LPVOID pMetaData, - [in] void *pbHashValue, - [in] ULONG cbHashValue, - [in] DWORD dwAssemblyRefFlags, - [in] struct AssemblyReferenceClosureWalkContextForProfAPI * pContext); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyBindSink -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(af0bc960-0b9a-11d3-95ca-00a024a85b51), - pointer_default(unique) -] -interface IAssemblyBindSink : IUnknown -{ - typedef [unique] IAssemblyBindSink *LPASSEMBLY_BIND_SINK; - - typedef struct _tagFusionBindInfo - { - IFusionBindLog *pdbglog; - IAssemblyName *pNamePolicy; - DWORD dwPoliciesApplied; - } FusionBindInfo; - - typedef enum - { - ASM_NOTIFICATION_START, - ASM_NOTIFICATION_PROGRESS, - ASM_NOTIFICATION_SUSPEND, - ASM_NOTIFICATION_ATTEMPT_NEXT_CODEBASE, - ASM_NOTIFICATION_BIND_INFO, - ASM_NOTIFICATION_DONE, - ASM_NOTIFICATION_NATIVE_IMAGE_DONE - } ASM_NOTIFICATION; - - - HRESULT OnProgress( - [in] DWORD dwNotification, - [in] HRESULT hrNotification, - [in] LPCWSTR szNotification, - [in] DWORD dwProgress, - [in] DWORD dwProgressMax, - [in] LPVOID pvBindInfo, - [in] IUnknown *pUnk); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyBinding -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(cfe52a80-12bd-11d3-95ca-00a024a85b51), - pointer_default(unique) -] -interface IAssemblyBinding : IUnknown -{ - typedef [unique] IAssemblyBinding *LPASSEMBLY_BINDINDING; - - HRESULT Control( - [in] HRESULT hrControl); - - HRESULT DoDefaultUI( - [in] HWND hWnd, - [in] DWORD dwFlags); -} - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyModuleImport -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(da0cd4b0-1117-11d3-95ca-00a024a85b51), - pointer_default(unique) -] -interface IAssemblyModuleImport : IStream -{ - typedef [unique] IAssemblyModuleImport *LPASSEMBLY_MODULE_IMPORT; - - HRESULT GetModuleName( - [out, size_is(*pccModuleName), annotation("__out_ecount_full_opt(*pccModuleName)")] LPOLESTR szModuleName, - [in, out] LPDWORD pccModuleName); - - HRESULT GetHashAlgId( - [out] LPDWORD pdwHashAlgId); - - HRESULT GetHashValue( - [out, size_is(*pcbHashValue)] BYTE *pbHashValue, - [in, out] LPDWORD pcbHashValue); - - HRESULT GetFlags( - [out] LPDWORD pdwFlags); - - HRESULT GetModulePath( - [out, size_is(*pccModulePath), annotation("__out_ecount_full_opt(*pccModulePath)")] LPOLESTR szModulePath, - [in, out] LPDWORD pccModulePath); - - BOOL IsAvailable(); - - HRESULT BindToObject( - [in] IAssemblyBindSink *pBindSink, - [in] IApplicationContext *pAppCtx, - [in] LONGLONG llFlags, - [out] LPVOID *ppv); -} - - -/////////////////////////////////////////////////////////////////////////////// -// -// IAssemblyScavenger -// -/////////////////////////////////////////////////////////////////////////////// -[ - local, - object, - uuid(21b8916c-f28e-11d2-a473-00ccff8ef448), - pointer_default(unique) -] -interface IAssemblyScavenger : IUnknown -{ - - HRESULT ScavengeAssemblyCache - ( - ); - - HRESULT GetCacheDiskQuotas - ( - [out] DWORD *pdwZapQuotaInGAC, - [out] DWORD *pdwDownloadQuotaAdmin, - [out] DWORD *pdwDownloadQuotaUser - ); - - HRESULT SetCacheDiskQuotas - ( - [in] DWORD dwZapQuotaInGAC, - [in] DWORD dwDownloadQuotaAdmin, - [in] DWORD dwDownloadQuotaUser - ); - - HRESULT GetCurrentCacheUsage - ( - [out] DWORD *dwZapUsage, - [out] DWORD *dwDownloadUsage - ); -} - - -/////////////////////////////////////////////////////////////////////////////// - -[ - local, - object, - uuid(D8FB9BD6-3969-11d3-B4AF-00C04F8ECB26), - pointer_default(unique) -] -interface ICodebaseList : IUnknown -{ - HRESULT AddCodebase - ( - [in] LPCWSTR wzCodebase, - [in] DWORD dwFlags - ); - - HRESULT RemoveCodebase - ( - [in] DWORD dwIndex - ); - - HRESULT RemoveAll(); - - HRESULT GetCount - ( - [out] DWORD *pdwCount - ); - - HRESULT GetCodebase - ( - [in] DWORD dwIndex, - [out] DWORD *pdwFlags, - [out, annotation("__out_ecount_opt(*pcbCodebase)")] - LPWSTR wzCodebase, - [in, out] DWORD *pcbCodebase - ); -} - -[ - local, - object, - uuid(0A6F16F8-ACD7-11d3-B4ED-00C04F8ECB26), - pointer_default(unique) -] -interface IDownloadMgr : IUnknown -{ - HRESULT PreDownloadCheck - ( - [out] void **ppv, - [out] void **ppvNI - ); - - HRESULT DoSetup - ( - [in] LPCWSTR wzSourceUrl, - [in] LPCWSTR wzFilePath, - [in] const FILETIME *pftLastMod, - [out] IUnknown **ppUnk, - [out] IUnknown **ppAsmNI - ); - - HRESULT ProbeFailed - ( - [out] IUnknown **ppUnk - ); - - HRESULT IsDuplicate - ( - [out] IDownloadMgr *ppDLMgr - ); - - HRESULT LogResult(); - - HRESULT DownloadEnabled - ( - [out] BOOL *pbEnabled - ); - - HRESULT GetBindInfo - ( - [out] FusionBindInfo *pBindInfo - ); - - HRESULT CacheBindingResult - ( - [in] HRESULT hrResult - ); -} - - -[ - local, - object, - uuid(711f7c2d-8234-4505-b02f-7554f46cbf29), - pointer_default(unique) -] -interface IHostAssembly : IUnknown -{ - typedef [unique] IHostAssembly *LPHOSTASSEMBLY; - - HRESULT GetAssemblyNameDef( - [out] IAssemblyName **ppAssemblyName); - - HRESULT GetNextAssemblyNameRef( - [in] DWORD nIndex, - [out] IAssemblyName **ppAssemblyName); - - HRESULT GetNextAssemblyModule( - [in] DWORD nIndex, - [out] IHostAssemblyModuleImport **ppModImport); - - HRESULT GetModuleByName( - [in] LPCOLESTR szModuleName, - [out] IHostAssemblyModuleImport **ppModImport); - - // Always release the copy in fusion - HRESULT GetAssemblyStream( - [out] IStream **ppStreamAsm); - - HRESULT GetAssemblyId( - [out] UINT64 *pAssemblyId); - - // Always release the copy in fusion - HRESULT GetAssemblyDebugStream( - [out] IStream **ppDebugStream); - - LOADCTX_TYPE GetFusionLoadContext( - ); - - HRESULT GetAssemblyContext( - [out] UINT64 *pdwAssemblyContext); -} - -[ - local, - object, - uuid(b6f2729d-6c0f-4944-b692-e5a2ce2c6e7a), - pointer_default(unique) -] -interface IHostAssemblyModuleImport : IUnknown -{ - typedef [unique] IHostAssemblyModuleImport *LPHOSTASSEMBLY_MODULE_IMPORT; - - HRESULT GetModuleName( - [out, size_is(*pccModuleName), annotation("__out_ecount_full(*pccModuleName)")] LPOLESTR szModuleName, - [in, out] LPDWORD pccModuleName); - - HRESULT GetModuleStream( - [out] IStream **ppStreamModule); - - HRESULT GetModuleId( - [out] DWORD *pdwModuleId); - - HRESULT GetModuleDebugStream( - [out] IStream **ppDebugStream); -} - - -#pragma midl_echo("STDAPI CreateHistoryReader(LPCWSTR wzFilePath, IHistoryReader **ppHistReader);") -#pragma midl_echo("STDAPI LookupHistoryAssembly(LPCWSTR pwzFilePath, FILETIME *pftActivationDate, LPCWSTR pwzAsmName, LPCWSTR pwzPublicKeyToken, LPCWSTR wzCulture, LPCWSTR pwzVerRef, IHistoryAssembly **pHistAsm);") -#pragma midl_echo("STDAPI GetHistoryFileDirectory(__out_ecount_opt(*pdwSize) LPWSTR wzDir, DWORD *pdwSize);") -#pragma midl_echo("STDAPI PreBindAssembly(IApplicationContext *pAppCtx, IAssemblyName *pName, IAssembly *pAsmParent, IAssemblyName **ppNamePostPolicy, LPVOID pvReserved); ") - -#pragma midl_echo("STDAPI CreateApplicationContext(IAssemblyName *pName, LPAPPLICATIONCONTEXT *ppCtx); ") -#pragma midl_echo("STDAPI IsRetargetableAssembly(IAssemblyName *pName, BOOL *pbIsRetargetable); ") -#pragma midl_echo("STDAPI IsOptionallyRetargetableAssembly(IAssemblyName *pName, BOOL *pbIsRetargetable); ") - - -cpp_quote("#define EXPLICITBIND_FLAGS_NON_BINDABLE 0x0") -cpp_quote("#define EXPLICITBIND_FLAGS_EXE 0x1") - diff --git a/src/inc/fusionsink.h b/src/inc/fusionsink.h deleted file mode 100644 index adf88d4cd4..0000000000 --- a/src/inc/fusionsink.h +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - - -/*============================================================ -** -** Header: FusionSink.hpp -** -** Purpose: Implements FusionSink -** -** -===========================================================*/ -#ifndef _FUSIONSINK_H -#define _FUSIONSINK_H - -#include <fusion.h> -#include <fusionpriv.h> -#include "corhlpr.h" -#include "corpriv.h" - -class FusionSink : public IAssemblyBindSink, public INativeImageEvaluate -{ -public: - - FusionSink() : - m_punk(NULL), - m_pNIunk(NULL), - m_pAbortUnk(NULL), - m_pFusionLog(NULL), - m_cRef(1), - m_hEvent(NULL), - m_LastResult(S_OK) - { - WRAPPER_NO_CONTRACT; - } - - virtual void Reset() - { - CONTRACTL - { - INSTANCE_CHECK; - NOTHROW; - } - CONTRACTL_END; - - if(m_pAbortUnk) { - m_pAbortUnk->Release(); - m_pAbortUnk = NULL; - } - - if(m_punk) { - m_punk->Release(); - m_punk = NULL; - } - - if(m_pNIunk) { - m_pNIunk->Release(); - m_pNIunk = NULL; - } - - if(m_pFusionLog) { - m_pFusionLog->Release(); - m_pFusionLog = NULL; - } - - m_LastResult = S_OK; - } - - ~FusionSink() - { - CONTRACTL - { - DESTRUCTOR_CHECK; - NOTHROW; - } - CONTRACTL_END; - - if(m_hEvent) { - delete m_hEvent; - m_hEvent = NULL; - } - - Reset(); - } - - HRESULT AssemblyResetEvent(); - HRESULT LastResult() - { - LIMITED_METHOD_CONTRACT; - return m_LastResult; - } - - STDMETHODIMP QueryInterface(REFIID riid, void **ppInterface); - ULONG STDMETHODCALLTYPE AddRef(void); - ULONG STDMETHODCALLTYPE Release(void); - - STDMETHODIMP OnProgress(DWORD dwNotification, - HRESULT hrNotification, - LPCWSTR szNotification, - DWORD dwProgress, - DWORD dwProgressMax, - LPVOID pvBindInfo, - IUnknown* punk); - - // Wait on the event. - virtual HRESULT Wait(); - - STDMETHODIMP Evaluate( - IAssembly *pILAssembly, - IAssembly *pNativeAssembly, - BYTE * pbCachedData, - DWORD dwDataSize); - - IUnknown* m_punk; // Getting an assembly - IUnknown* m_pNIunk; // Getting an assembly - IUnknown* m_pAbortUnk; // pUnk for aborting a bind - IFusionBindLog *m_pFusionLog; - -protected: - HRESULT AssemblyCreateEvent(); - - LONG m_cRef; // Ref count. - Event *m_hEvent; // Event to block thread. - HRESULT m_LastResult; // Last notification result -}; - -#endif // _FUSIONSINK_H diff --git a/src/inc/holder.h b/src/inc/holder.h index cb0040549d..a92eeabaab 100644 --- a/src/inc/holder.h +++ b/src/inc/holder.h @@ -65,12 +65,6 @@ #ifdef _DEBUG -#ifdef FEATURE_FUSION -namespace NATIVE_BINDER_SPACE -{ - class NativeAssembly; -} -#endif //FEATURE_FUSION //------------------------------------------------------------------------------------------------ // This is used to make Visual Studio autoexp.dat work sensibly with holders again. @@ -95,18 +89,6 @@ struct AutoExpVisibleValue union { // Only include a class name here if it is customarily referred to through an abstract interface. -#ifdef FEATURE_FUSION - const class CAssemblyName *_asCAssemblyName; - const class CAssembly *_asCAssembly; - const class CAssemblyManifestImport *_asCAssemblyManifestImport; - const class CAssemblyModuleImport *_asCAssemblyModuleImport; - const class CHostAssembly *_asCHostAssembly; - const class CHostAssemblyModuleImport *_asCHostAssemblyModuleImport; - const class BindResult *_asBindResult; - const class BindContext *_asBindContext; - const class NATIVE_BINDER_SPACE::NativeAssembly *_asNativeAssembly; - const class AssemblyLocation *_asAssemblyLocation; -#endif //FEATURE_FUSION #if defined(FEATURE_APPX) const class AppXBindResultImpl *_asAppXBindResultImpl; diff --git a/src/inc/vptr_list.h b/src/inc/vptr_list.h index 11c91bba03..86c12aec35 100644 --- a/src/inc/vptr_list.h +++ b/src/inc/vptr_list.h @@ -65,9 +65,6 @@ VPTR_CLASS(MappedImageLayout) VPTR_CLASS(LoadedImageLayout) #endif // !CROSSGEN_COMPILE && !FEATURE_PAL VPTR_CLASS(FlatImageLayout) -#ifdef FEATURE_FUSION -VPTR_CLASS(StreamImageLayout) -#endif #ifdef FEATURE_COMINTEROP VPTR_CLASS(ComMethodFrame) VPTR_CLASS(ComPlusMethodFrame) diff --git a/src/inc/zapper.h b/src/inc/zapper.h index 26ac7e8f14..80229fc528 100644 --- a/src/inc/zapper.h +++ b/src/inc/zapper.h @@ -18,9 +18,6 @@ #include "shash.h" #include "utilcode.h" #include "corjit.h" -#ifdef FEATURE_FUSION -#include "binderngen.h" -#endif #include "corcompile.h" #include "corhlprpriv.h" #include "ngen.h" @@ -294,30 +291,6 @@ class Zapper void InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument); void LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT ICorJitCompiler** ppICorJitCompiler); -#ifdef FEATURE_FUSION - HRESULT TryEnumerateFusionCache(LPCWSTR assemblyName, bool fPrint, bool fDelete); - int EnumerateFusionCache(LPCWSTR assemblyName, bool fPrint, bool fDelete, - CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig = NULL); - void PrintFusionCacheEntry(CorSvcLogLevel logLevel, IAssemblyName *pZapAssemblyName); - void DeleteFusionCacheEntry(IAssemblyName *pZapAssemblyName); - void DeleteFusionCacheEntry(LPCWSTR assemblyName, CORCOMPILE_NGEN_SIGNATURE *pNativeImageSig); - - void PrintDependencies( - IMetaDataAssemblyImport * pAssemblyImport, - CORCOMPILE_DEPENDENCY * pDependencies, - COUNT_T cDependencies, - SString &s); - BOOL VerifyDependencies( - IMDInternalImport * pAssemblyImport, - CORCOMPILE_DEPENDENCY * pDependencies, - COUNT_T cDependencies); - - void PrintAssemblyVersionInfo(IAssemblyName *pZapAssemblyName, SString &s); - - IAssemblyName *GetAssemblyFusionName(IMetaDataAssemblyImport *pImport); - IAssemblyName *GetAssemblyRefFusionName(IMetaDataAssemblyImport *pImport, - mdAssemblyRef ar); -#endif //FEATURE_FUSION BOOL IsAssembly(LPCWSTR path); diff --git a/src/md/compiler/mdsighelper.h b/src/md/compiler/mdsighelper.h index 0d089729bb..49c0752fe3 100644 --- a/src/md/compiler/mdsighelper.h +++ b/src/md/compiler/mdsighelper.h @@ -104,13 +104,7 @@ class UnifiedAssemblySigComparer : public MDSigComparer::MDSigComparerBaseType protected: RegMeta *m_pRegMeta; -#ifdef FEATURE_FUSION - HRESULT _CreateIAssemblyNameFromAssemblyRef( - mdToken tkAsmRef, - IAssemblyName **ppAsmName); -#else HRESULT _CompareAssemblies(mdToken tkAsmRef1,mdToken tkAsmRef2, BOOL* pfEquivalent); -#endif HRESULT _CreateTypeNameFromTypeRef( mdToken tkTypeRef, diff --git a/src/md/compiler/mdvalidator.cpp b/src/md/compiler/mdvalidator.cpp index adcfd51eb3..0b86738cfb 100644 --- a/src/md/compiler/mdvalidator.cpp +++ b/src/md/compiler/mdvalidator.cpp @@ -19,9 +19,6 @@ #include "pedecoder.h" #include "stgio.h" #include "corhost.h" -#ifdef FEATURE_FUSION -#include "fusion.h" -#endif #include "sstring.h" #include "nsutilpriv.h" #include "holder.h" @@ -7185,123 +7182,7 @@ MDSigComparer::_CompareMethodSignatureHeader( //***************************************************************************** //***************************************************************************** -#ifdef FEATURE_FUSION -HRESULT -UnifiedAssemblySigComparer::_CreateIAssemblyNameFromAssemblyRef( - mdToken tkAsmRef, - IAssemblyName **ppAsmName) -{ - HRESULT hr; - - void const * pvPublicKey; - ULONG cbPublicKey; - ULONG cchName; - ASSEMBLYMETADATA amd; - void const * pvHashValue; - ULONG cbHashValue; - DWORD dwFlags; - - ZeroMemory(&amd, sizeof(amd)); - - IfFailRet(m_pRegMeta->GetAssemblyRefProps(tkAsmRef, - NULL, - NULL, - NULL, - 0, - &cchName, - &amd, - NULL, - NULL, - NULL)); - - StackSString ssName; - StackSString ssLocale; - amd.szLocale = ssLocale.OpenUnicodeBuffer(amd.cbLocale); - - IfFailRet(m_pRegMeta->GetAssemblyRefProps(tkAsmRef, - &pvPublicKey, - &cbPublicKey, - ssName.OpenUnicodeBuffer(cchName), - cchName, - &cchName, - &amd, - &pvHashValue, - &cbHashValue, - &dwFlags)); - - ssName.CloseBuffer(); - ssLocale.CloseBuffer(); - - IAssemblyName *pAsmName = NULL; - - IfFailRet(CreateAssemblyNameObject(&pAsmName, - ssName.GetUnicode(), - CANOF_SET_DEFAULT_VALUES, - NULL)); - - // Set the public key token - IfFailRet(pAsmName->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, - (LPVOID)pvPublicKey, - cbPublicKey)); - // Set the culture - if (amd.cbLocale == 0 || amd.szLocale == NULL) - { - IfFailRet(pAsmName->SetProperty(ASM_NAME_CULTURE, - W("Neutral"), - sizeof(W("Neutral")))); - } - else - { - IfFailRet(pAsmName->SetProperty(ASM_NAME_CULTURE, - amd.szLocale, - amd.cbLocale)); - } - - // Set the major version - IfFailRet(pAsmName->SetProperty(ASM_NAME_MAJOR_VERSION, - &amd.usMajorVersion, - sizeof(amd.usMajorVersion))); - - // Set the minor version - IfFailRet(pAsmName->SetProperty(ASM_NAME_MINOR_VERSION, - &amd.usMinorVersion, - sizeof(amd.usMinorVersion))); - - // Set the build number - IfFailRet(pAsmName->SetProperty(ASM_NAME_BUILD_NUMBER, - &amd.usBuildNumber, - sizeof(amd.usBuildNumber))); - - // Set the revision number - IfFailRet(pAsmName->SetProperty(ASM_NAME_REVISION_NUMBER, - &amd.usRevisionNumber, - sizeof(amd.usRevisionNumber))); - - *ppAsmName = pAsmName; - - return S_OK; -} - -//***************************************************************************** -// Define holder to release IAssemblyName on exception. -//***************************************************************************** -void UnifiedAssemblySigComparer_IAssemblyNameRelease(IAssemblyName *value) -{ - if (value != NULL) - { - value->Release(); - } -} - -typedef Holder<IAssemblyName*, - DoNothing<IAssemblyName*>, - &UnifiedAssemblySigComparer_IAssemblyNameRelease, - NULL> UnifiedAssemblySigComparer_IAssemblyNameHolder; - -#endif // FEATURE_FUSION - -#ifndef FEATURE_FUSION HRESULT UnifiedAssemblySigComparer::_CompareAssemblies(mdToken tkAsmRef1,mdToken tkAsmRef2, BOOL* pfEquivalent) { @@ -7417,7 +7298,6 @@ HRESULT UnifiedAssemblySigComparer::_CompareAssemblies(mdToken tkAsmRef1,mdToken return S_OK; }; -#endif // FEATURE_FUSION //***************************************************************************** //***************************************************************************** @@ -7523,38 +7403,8 @@ UnifiedAssemblySigComparer::CompareToken( } BOOL fEquivalent; -#ifdef FEATURE_FUSION //move into _CompareAssemblies - IAssemblyName *pAsmName1 = NULL; - IfFailRet(_CreateIAssemblyNameFromAssemblyRef(tkParent1, &pAsmName1)); - UnifiedAssemblySigComparer_IAssemblyNameHolder anh1(pAsmName1); - - IAssemblyName *pAsmName2 = NULL; - IfFailRet(_CreateIAssemblyNameFromAssemblyRef(tkParent2, &pAsmName2)); - UnifiedAssemblySigComparer_IAssemblyNameHolder anh2(pAsmName2); - - DWORD cchDisplayName = 0; - - StackSString ssDisplayName1; - pAsmName1->GetDisplayName(NULL, &cchDisplayName, NULL); - IfFailRet(pAsmName1->GetDisplayName(ssDisplayName1.OpenUnicodeBuffer(cchDisplayName), &cchDisplayName, NULL)); - ssDisplayName1.CloseBuffer(); - - StackSString ssDisplayName2; - pAsmName2->GetDisplayName(NULL, &cchDisplayName, NULL); - IfFailRet(pAsmName2->GetDisplayName(ssDisplayName2.OpenUnicodeBuffer(cchDisplayName), &cchDisplayName, NULL)); - ssDisplayName2.CloseBuffer(); - - AssemblyComparisonResult res; - IfFailRet(CompareAssemblyIdentity(ssDisplayName1.GetUnicode(), - TRUE, - ssDisplayName2.GetUnicode(), - TRUE, - &fEquivalent, - &res)); -#else // no redirects supported IfFailRet(_CompareAssemblies(tkParent1,tkParent2,&fEquivalent)); -#endif if (!fEquivalent) { diff --git a/src/md/compiler/regmeta.h b/src/md/compiler/regmeta.h index f9967d79c0..5a003ec0a9 100644 --- a/src/md/compiler/regmeta.h +++ b/src/md/compiler/regmeta.h @@ -27,9 +27,6 @@ #include <ivehandler.h> #include "sigparser.h" -#ifdef FEATURE_FUSION -#include "fusion.h" -#endif #include "winmdinterfaces.h" diff --git a/src/md/inc/assemblymdinternaldisp.h b/src/md/inc/assemblymdinternaldisp.h index 91b7d2cc29..8e8017ee9b 100644 --- a/src/md/inc/assemblymdinternaldisp.h +++ b/src/md/inc/assemblymdinternaldisp.h @@ -14,710 +14,5 @@ #include "../runtime/mdinternalro.h" -#ifdef FEATURE_FUSION - -#include "fusionpriv.h" - -struct CORCOMPILE_VERSION_INFO; -struct CORCOMPILE_DEPENDENCY; - -//***************************************************************************** -// This class can support the IMetaDataAssemblyImport and some funcationalities -// of IMetaDataImport on the internal import interface (IMDInternalImport). -//***************************************************************************** -class AssemblyMDInternalImport : - public IMetaDataAssemblyImport, - public IMetaDataImport2, -#ifdef FEATURE_PREJIT - public IGetIMDInternalImport, -#endif //FEATURE_PREJIT - public ISNAssemblySignature -#ifdef FEATURE_PREJIT - , public INativeImageInstallInfo -#endif // FEATURE_PREJIT -{ -public: - AssemblyMDInternalImport(IMDInternalImport *pMDInternalImport); - ~AssemblyMDInternalImport(); - - // *** IUnknown methods *** - STDMETHODIMP QueryInterface(REFIID riid, void** ppUnk); - STDMETHODIMP_(ULONG) AddRef(void); - STDMETHODIMP_(ULONG) Release(void); - - // *** IMetaDataAssemblyImport methods *** - STDMETHODIMP GetAssemblyProps ( // S_OK or error. - mdAssembly mda, // [IN] The Assembly for which to get the properties. - const void **ppbPublicKey, // [OUT] Pointer to the public key. - ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key. - ULONG *pulHashAlgId, // [OUT] Hash Algorithm. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData. - DWORD *pdwAssemblyFlags); // [OUT] Flags. - - STDMETHODIMP GetAssemblyRefProps ( // S_OK or error. - mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties. - const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token. - ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData. - const void **ppbHashValue, // [OUT] Hash blob. - ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob. - DWORD *pdwAssemblyRefFlags); // [OUT] Flags. - - STDMETHODIMP GetFileProps ( // S_OK or error. - mdFile mdf, // [IN] The File for which to get the properties. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob. - ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob. - DWORD *pdwFileFlags); // [OUT] Flags. - - STDMETHODIMP GetExportedTypeProps ( // S_OK or error. - mdExportedType mdct, // [IN] The ExportedType for which to get the properties. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType. - mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file. - DWORD *pdwExportedTypeFlags); // [OUT] Flags. - - STDMETHODIMP GetManifestResourceProps ( // S_OK or error. - mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource. - DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file. - DWORD *pdwResourceFlags); // [OUT] Flags. - - STDMETHODIMP EnumAssemblyRefs ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here. - ULONG cMax, // [IN] Max AssemblyRefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHODIMP EnumFiles ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdFile rFiles[], // [OUT] Put Files here. - ULONG cMax, // [IN] Max Files to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHODIMP EnumExportedTypes ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here. - ULONG cMax, // [IN] Max ExportedTypes to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHODIMP EnumManifestResources ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here. - ULONG cMax, // [IN] Max Resources to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHODIMP GetAssemblyFromScope ( // S_OK or error - mdAssembly *ptkAssembly); // [OUT] Put token here. - - STDMETHODIMP FindExportedTypeByName ( // S_OK or error - LPCWSTR szName, // [IN] Name of the ExportedType. - mdToken mdtExportedType, // [IN] ExportedType for the enclosing class. - mdExportedType *ptkExportedType); // [OUT] Put the ExportedType token here. - - STDMETHODIMP FindManifestResourceByName ( // S_OK or error - LPCWSTR szName, // [IN] Name of the ManifestResource. - mdManifestResource *ptkManifestResource); // [OUT] Put the ManifestResource token here. - - STDMETHOD_(void, CloseEnum)( - HCORENUM hEnum); // Enum to be closed. - - STDMETHODIMP FindAssembliesByName ( // S_OK or error - LPCWSTR szAppBase, // [IN] optional - can be NULL - LPCWSTR szPrivateBin, // [IN] optional - can be NULL - LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting - IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here - ULONG cMax, // [IN] The max number to put - ULONG *pcAssemblies); // [OUT] The number of assemblies returned. - - // *** IMetaDataImport methods *** - STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount); - STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos); - STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[], - ULONG cMax, ULONG *pcTypeDefs); - STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td, - mdInterfaceImpl rImpls[], ULONG cMax, - ULONG* pcImpls); - STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[], - ULONG cMax, ULONG* pcTypeRefs); - - STDMETHOD(FindTypeDefByName)( // S_OK or error. - LPCWSTR szTypeDef, // [IN] Name of the Type. - mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class. - mdTypeDef *ptd); // [OUT] Put the TypeDef token here. - - STDMETHOD(GetScopeProps)( - __out_ecount_part_opt(cchName, *pchName) - LPWSTR wszName, // [OUT] Put the name here. - ULONG cchName, // [IN] Size of name buffer in wide chars. - ULONG * pchName, // [OUT] Put size of name (wide chars) here. - GUID * pMvid); // [OUT, OPTIONAL] Put MVID here. - - STDMETHOD(GetModuleFromScope)( // S_OK. - mdModule *pmd); // [OUT] Put mdModule token here. - - STDMETHOD(GetTypeDefProps)( - mdTypeDef td, // [IN] TypeDef token for inquiry. - __out_ecount_part_opt(cchTypeDef, *pchTypeDef) - LPWSTR wszTypeDef, // [OUT] Put name here. - ULONG cchTypeDef, // [IN] size of name buffer in wide chars. - ULONG * pchTypeDef, // [OUT] put size of name (wide chars) here. - DWORD * pdwTypeDefFlags, // [OUT] Put flags here. - mdToken * ptkExtends); // [OUT] Put base class TypeDef/TypeRef here. - - STDMETHOD(GetInterfaceImplProps)( // S_OK or error. - mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token. - mdTypeDef *pClass, // [OUT] Put implementing class token here. - mdToken *ptkIface); // [OUT] Put implemented interface token here. - - STDMETHOD(GetTypeRefProps)( - mdTypeRef tr, // [IN] TypeRef token. - mdToken * ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef. - __out_ecount_part_opt(cchName, *pchName) - LPWSTR wszName, // [OUT] Name of the TypeRef. - ULONG cchName, // [IN] Size of buffer. - ULONG * pchName); // [OUT] Size of Name. - - STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd); - - STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - mdToken rMembers[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - LPCWSTR szName, // [IN] Limit results to those with this name. - mdToken rMembers[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - mdMethodDef rMethods[], // [OUT] Put MethodDefs here. - ULONG cMax, // [IN] Max MethodDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - LPCWSTR szName, // [IN] Limit results to those with this name. - mdMethodDef rMethods[], // [OU] Put MethodDefs here. - ULONG cMax, // [IN] Max MethodDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - mdFieldDef rFields[], // [OUT] Put FieldDefs here. - ULONG cMax, // [IN] Max FieldDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - LPCWSTR szName, // [IN] Limit results to those with this name. - mdFieldDef rFields[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - - STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdMethodDef mb, // [IN] MethodDef to scope the enumeration. - mdParamDef rParams[], // [OUT] Put ParamDefs here. - ULONG cMax, // [IN] Max ParamDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tkParent, // [IN] Parent token to scope the enumeration. - mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here. - ULONG cMax, // [IN] Max MemberRefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef td, // [IN] TypeDef to scope the enumeration. - mdToken rMethodBody[], // [OUT] Put Method Body tokens here. - mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here. - ULONG cMax, // [IN] Max tokens to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tk, // [IN] if !NIL, token to scope the enumeration. - DWORD dwActions, // [IN] if !0, return only these actions. - mdPermission rPermission[], // [OUT] Put Permissions here. - ULONG cMax, // [IN] Max Permissions to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(FindMember)( - mdTypeDef td, // [IN] given typedef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdToken *pmb); // [OUT] matching memberdef - - STDMETHOD(FindMethod)( - mdTypeDef td, // [IN] given typedef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdMethodDef *pmb); // [OUT] matching memberdef - - STDMETHOD(FindField)( - mdTypeDef td, // [IN] given typedef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdFieldDef *pmb); // [OUT] matching memberdef - - STDMETHOD(FindMemberRef)( - mdTypeRef td, // [IN] given typeRef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdMemberRef *pmr); // [OUT] matching memberref - - STDMETHOD (GetMethodProps)( - mdMethodDef mb, // The method for which to get props. - mdTypeDef * pClass, // Put method's class here. - __out_ecount_part_opt(cchMethod, *pchMethod) - LPWSTR wszMethod, // Put method's name here. - ULONG cchMethod, // Size of szMethod buffer in wide chars. - ULONG * pchMethod, // Put actual size here. - DWORD * pdwAttr, // Put flags here. - PCCOR_SIGNATURE * ppvSigBlob, // [OUT] point to the blob value of meta data - ULONG * pcbSigBlob, // [OUT] actual size of signature blob - ULONG * pulCodeRVA, // [OUT] codeRVA - DWORD * pdwImplFlags); // [OUT] Impl. Flags - - STDMETHOD(GetMemberRefProps)( - mdMemberRef mr, // [IN] given memberref - mdToken * ptk, // [OUT] Put classref or classdef here. - __out_ecount_part_opt(cchMember, *pchMember) - LPWSTR wszMember, // [OUT] buffer to fill for member's name - ULONG cchMember, // [IN] the count of char of szMember - ULONG * pchMember, // [OUT] actual count of char in member name - PCCOR_SIGNATURE * ppvSigBlob, // [OUT] point to meta data blob value - ULONG * pbSig); // [OUT] actual size of signature blob - - STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef td, // [IN] TypeDef to scope the enumeration. - mdProperty rProperties[], // [OUT] Put Properties here. - ULONG cMax, // [IN] Max properties to put. - ULONG *pcProperties); // [OUT] Put # put here. - - STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef td, // [IN] TypeDef to scope the enumeration. - mdEvent rEvents[], // [OUT] Put events here. - ULONG cMax, // [IN] Max events to put. - ULONG *pcEvents); // [OUT] Put # put here. - - STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error. - mdEvent ev, // [IN] event token - mdTypeDef *pClass, // [OUT] typedef containing the event declarion. - LPCWSTR szEvent, // [OUT] Event name - ULONG cchEvent, // [IN] the count of wchar of szEvent - ULONG *pchEvent, // [OUT] actual count of wchar for event's name - DWORD *pdwEventFlags, // [OUT] Event flags. - mdToken *ptkEventType, // [OUT] EventType class - mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event - mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event - mdMethodDef *pmdFire, // [OUT] Fire method of the event - mdMethodDef rmdOtherMethod[], // [OUT] other method of the event - ULONG cMax, // [IN] size of rmdOtherMethod - ULONG *pcOtherMethod); // [OUT] total number of other method of this event - - STDMETHOD(EnumMethodSemantics)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdMethodDef mb, // [IN] MethodDef to scope the enumeration. - mdToken rEventProp[], // [OUT] Put Event/Property here. - ULONG cMax, // [IN] Max properties to put. - ULONG *pcEventProp); // [OUT] Put # put here. - - STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error. - mdMethodDef mb, // [IN] method token - mdToken tkEventProp, // [IN] event/property token. - DWORD *pdwSemanticsFlags); // [OUT] the role flags for the method/propevent pair - - STDMETHOD(GetClassLayout) ( - mdTypeDef td, // [IN] give typedef - DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16 - COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array - ULONG cMax, // [IN] size of the array - ULONG *pcFieldOffset, // [OUT] needed array size - ULONG *pulClassSize); // [OUT] the size of the class - - STDMETHOD(GetFieldMarshal) ( - mdToken tk, // [IN] given a field's memberdef - PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field - ULONG *pcbNativeType); // [OUT] the count of bytes of *ppvNativeType - - STDMETHOD(GetRVA)( // S_OK or error. - mdToken tk, // Member for which to set offset - ULONG *pulCodeRVA, // The offset - DWORD *pdwImplFlags); // the implementation flags - - STDMETHOD(GetPermissionSetProps) ( - mdPermission pm, // [IN] the permission token. - DWORD *pdwAction, // [OUT] CorDeclSecurity. - void const **ppvPermission, // [OUT] permission blob. - ULONG *pcbPermission); // [OUT] count of bytes of pvPermission. - - STDMETHOD(GetSigFromToken)( // S_OK or error. - mdSignature mdSig, // [IN] Signature token. - PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token. - ULONG *pcbSig); // [OUT] return size of signature. - - STDMETHOD(GetModuleRefProps)( - mdModuleRef mur, // [IN] moduleref token. - __out_ecount_part_opt(cchName, *pchName) - LPWSTR wszName, // [OUT] buffer to fill with the moduleref name. - ULONG cchName, // [IN] size of szName in wide characters. - ULONG * pchName); // [OUT] actual count of characters in the name. - - STDMETHOD(EnumModuleRefs)( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] pointer to the enum. - mdModuleRef rModuleRefs[], // [OUT] put modulerefs here. - ULONG cmax, // [IN] max memberrefs to put. - ULONG *pcModuleRefs); // [OUT] put # put here. - - STDMETHOD(GetTypeSpecFromToken)( // S_OK or error. - mdTypeSpec typespec, // [IN] TypeSpec token. - PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature - ULONG *pcbSig); // [OUT] return size of signature. - - STDMETHOD(GetNameFromToken)( // <TODO>Not Recommended! May be removed!</TODO> - mdToken tk, // [IN] Token to get name from. Must have a name. - MDUTF8CSTR *pszUtf8NamePtr); // [OUT] Return pointer to UTF8 name in heap. - - STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken rMethods[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens); // [OUT] Put # put here. - - STDMETHOD(GetUserString)( - mdString stk, // [IN] String token. - __out_ecount_part_opt(cchString, *pchString) - LPWSTR wszString, // [OUT] Copy of string. - ULONG cchString, // [IN] Max chars of room in szString. - ULONG * pchString); // [OUT] How many chars in actual string. - - STDMETHOD(GetPinvokeMap)( - mdToken tk, // [IN] FieldDef or MethodDef. - DWORD * pdwMappingFlags, // [OUT] Flags used for mapping. - __out_ecount_part_opt(cchImportName, *pchImportName) - LPWSTR wszImportName, // [OUT] Import name. - ULONG cchImportName, // [IN] Size of the name buffer. - ULONG * pchImportName, // [OUT] Actual number of characters stored. - mdModuleRef * pmrImportDLL); // [OUT] ModuleRef token for the target DLL. - - STDMETHOD(EnumSignatures)( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] pointer to the enum. - mdSignature rSignatures[], // [OUT] put signatures here. - ULONG cmax, // [IN] max signatures to put. - ULONG *pcSignatures); // [OUT] put # put here. - - STDMETHOD(EnumTypeSpecs)( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] pointer to the enum. - mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here. - ULONG cmax, // [IN] max TypeSpecs to put. - ULONG *pcTypeSpecs); // [OUT] put # put here. - - STDMETHOD(EnumUserStrings)( // S_OK or error. - HCORENUM *phEnum, // [IN/OUT] pointer to the enum. - mdString rStrings[], // [OUT] put Strings here. - ULONG cmax, // [IN] max Strings to put. - ULONG *pcStrings); // [OUT] put # put here. - - STDMETHOD(GetParamForMethodIndex)( // S_OK or error. - mdMethodDef md, // [IN] Method token. - ULONG ulParamSeq, // [IN] Parameter sequence. - mdParamDef *ppd); // [IN] Put Param token here. - - STDMETHOD(EnumCustomAttributes)( // S_OK or error. - HCORENUM *phEnum, // [IN, OUT] COR enumerator. - mdToken tk, // [IN] Token to scope the enumeration, 0 for all. - mdToken tkType, // [IN] Type of interest, 0 for all. - mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here. - ULONG cMax, // [IN] Size of rCustomAttributes. - ULONG *pcCustomAttributes); // [OUT, OPTIONAL] Put count of token values here. - - STDMETHOD(GetCustomAttributeProps)( // S_OK or error. - mdCustomAttribute cv, // [IN] CustomAttribute token. - mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here. - mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here. - void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here. - ULONG *pcbSize); // [OUT, OPTIONAL] Put size of date here. - - STDMETHOD(FindTypeRef)( - mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef. - LPCWSTR szName, // [IN] TypeRef Name. - mdTypeRef *ptr); // [OUT] matching TypeRef. - - STDMETHOD(GetMemberProps)( - mdToken mb, // The member for which to get props. - mdTypeDef * pClass, // Put member's class here. - __out_ecount_part_opt(cchMember, *pchMember) - LPWSTR wszMember, // Put member's name here. - ULONG cchMember, // Size of szMember buffer in wide chars. - ULONG * pchMember, // Put actual size here - DWORD * pdwAttr, // Put flags here. - PCCOR_SIGNATURE * ppvSigBlob, // [OUT] point to the blob value of meta data - ULONG * pcbSigBlob, // [OUT] actual size of signature blob - ULONG * pulCodeRVA, // [OUT] codeRVA - DWORD * pdwImplFlags, // [OUT] Impl. Flags - DWORD * pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* - UVCP_CONSTANT * ppValue, // [OUT] constant value - ULONG * pcchValue); // [OUT] size of constant string in chars, 0 for non-strings. - - STDMETHOD(GetFieldProps)( - mdFieldDef mb, // The field for which to get props. - mdTypeDef * pClass, // Put field's class here. - __out_ecount_part_opt(cchField, *pchField) - LPWSTR szField, // Put field's name here. - ULONG cchField, // Size of szField buffer in wide chars. - ULONG * pchField, // Put actual size here. - DWORD * pdwAttr, // Put flags here. - PCCOR_SIGNATURE * ppvSigBlob, // [OUT] point to the blob value of meta data. - ULONG * pcbSigBlob, // [OUT] actual size of signature blob. - DWORD * pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*. - UVCP_CONSTANT * ppValue, // [OUT] constant value. - ULONG * pcchValue); // [OUT] size of constant string in chars, 0 for non-strings. - - STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error. - mdProperty prop, // [IN] property token - mdTypeDef *pClass, // [OUT] typedef containing the property declarion. - LPCWSTR szProperty, // [OUT] Property name - ULONG cchProperty, // [IN] the count of wchar of szProperty - ULONG *pchProperty, // [OUT] actual count of wchar for property name - DWORD *pdwPropFlags, // [OUT] property flags. - PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob - ULONG *pbSig, // [OUT] count of bytes in *ppvSig - DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* - UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value - ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings. - mdMethodDef *pmdSetter, // [OUT] setter method of the property - mdMethodDef *pmdGetter, // [OUT] getter method of the property - mdMethodDef rmdOtherMethod[], // [OUT] other method of the property - ULONG cMax, // [IN] size of rmdOtherMethod - ULONG *pcOtherMethod); // [OUT] total number of other method of this property - - STDMETHOD(GetParamProps)( - mdParamDef tk, // [IN]The Parameter. - mdMethodDef * pmd, // [OUT] Parent Method token. - ULONG * pulSequence, // [OUT] Parameter sequence. - __out_ecount_part_opt(cchName, *pchName) - LPWSTR wszName, // [OUT] Put name here. - ULONG cchName, // [OUT] Size of name buffer. - ULONG * pchName, // [OUT] Put actual size of name here. - DWORD * pdwAttr, // [OUT] Put flags here. - DWORD * pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*. - UVCP_CONSTANT * ppValue, // [OUT] Constant value. - ULONG * pcchValue); // [OUT] size of constant string in chars, 0 for non-strings. - - STDMETHOD(GetCustomAttributeByName)( // S_OK or error. - mdToken tkObj, // [IN] Object with Custom Attribute. - LPCWSTR szName, // [IN] Name of desired Custom Attribute. - const void **ppData, // [OUT] Put pointer to data here. - ULONG *pcbData); // [OUT] Put size of data here. - - STDMETHOD_(BOOL, IsValidToken)( // True or False. - mdToken tk); // [IN] Given token. - - STDMETHOD(GetNestedClassProps)( // S_OK or error. - mdTypeDef tdNestedClass, // [IN] NestedClass token. - mdTypeDef *ptdEnclosingClass); // [OUT] EnclosingClass token. - - STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error. - void const *pvSig, // [IN] Pointer to signature. - ULONG cbSig, // [IN] Count of signature bytes. - ULONG *pCallConv); // [OUT] Put calling conv here (see CorPinvokemap). - - STDMETHOD(IsGlobal)( // S_OK or error. - mdToken pd, // [IN] Type, Field, or Method token. - int *pbGlobal); // [OUT] Put 1 if global, 0 otherwise. - -//***************************************************************************** -// IMetaDataImport2 methods -//***************************************************************************** - STDMETHOD(GetMethodSpecProps)( - mdMethodSpec mi, // [IN] The method instantiation - mdToken *tkParent, // [OUT] MethodDef or MemberRef - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data - ULONG *pcbSigBlob); // [OUT] actual size of signature blob - - STDMETHOD(GetGenericParamProps)( - mdGenericParam gp, // [IN] GenericParam - ULONG * pulParamSeq, // [OUT] Index of the type parameter - DWORD * pdwParamFlags, // [OUT] Flags, for future use (e.g. variance) - mdToken * ptOwner, // [OUT] Owner (TypeDef or MethodDef) - DWORD * pdwReserved, // [OUT] For future use (e.g. non-type parameters) - __out_ecount_part_opt(cchName, *pchName) - LPWSTR wszName, // [OUT] Put name here - ULONG cchName, // [IN] Size of buffer - ULONG * pchName); // [OUT] Put size of name (wide chars) here. - - STDMETHOD(GetGenericParamConstraintProps)( // S_OK or error. - mdGenericParamConstraint gpc, // [IN] GenericParamConstraint - mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained - mdToken *ptkConstraintType); // [OUT] TypeDef/Ref/Spec constraint - - STDMETHOD(EnumGenericParams)( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested - mdGenericParam rGenericParams[], // [OUT] Put GenericParams here. - ULONG cMax, // [IN] Max GenericParams to put. - ULONG *pcGenericParams); // [OUT] Put # put here. - - STDMETHOD(EnumGenericParamConstraints)( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdGenericParam tk, // [IN] GenericParam whose constraints are requested - mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here. - ULONG cMax, // [IN] Max GenericParamConstraints to put. - ULONG *pcGenericParamConstraints); // [OUT] Put # put here. - - STDMETHOD(EnumMethodSpecs)( - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested - mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here. - ULONG cMax, // [IN] Max tokens to put. - ULONG *pcMethodSpecs); // [OUT] Put actual count here. - - STDMETHOD(GetPEKind)( // S_OK or error. - DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE) - DWORD* pdwMachine); // [OUT] Machine as defined in NT header - - STDMETHOD(GetVersionString)( - __out_ecount_part_opt(ccBufSize, *pccBufSize) - LPWSTR pwzBuf, // Put version string here. - DWORD ccBufSize, // [in] Size of the buffer, in wide chars. - DWORD * pccBufSize); // [out] Size of the version string, wide chars, including terminating nul. - - - // *** ISNAssemblySignature methods *** - - STDMETHOD(GetSNAssemblySignature)( // S_OK or error. - BYTE *pbSig, // [IN, OUT] Buffer to write signature - DWORD *pcbSig); // [IN, OUT] Size of buffer, bytes written - - -#ifdef FEATURE_PREJIT - // *** IGetIMDInternalImport methods *** - - STDMETHOD(GetIMDInternalImport) ( - IMDInternalImport ** ppIMDInternalImport); - - // *** INativeImageInstallInfo *** - - STDMETHOD (GetSignature) ( - CORCOMPILE_NGEN_SIGNATURE * pNgenSign - ); - - STDMETHOD (GetVersionInfo) ( - CORCOMPILE_VERSION_INFO * pVersionInfo - ); - - - STDMETHOD (GetILSignature) ( - CORCOMPILE_ASSEMBLY_SIGNATURE * pILSign - ); - - STDMETHOD (GetConfigMask) ( - DWORD * pConfigMask - ); - - STDMETHOD (EnumDependencies) ( - HCORENUM * phEnum, - INativeImageDependency *rDeps[], - ULONG cMax, - DWORD * pdwCount - ); - - STDMETHOD (GetDependency) ( - const CORCOMPILE_NGEN_SIGNATURE *pcngenSign, - CORCOMPILE_DEPENDENCY *pDep - ); - - -#endif // FEATURE_PREJIT - - //------------ setters for privates ----------- - void SetHandle(HCORMODULE hHandle) - { - RuntimeAddRefHandle(hHandle); - m_pHandle = hHandle; - } - - void SetPEKind(DWORD dwPEKind) - { - m_dwPEKind = dwPEKind; - } - - void SetMachine(DWORD dwMachine) - { - m_dwMachine = dwMachine; - } - - void SetVersionString(const char* szVersionString) - { - m_szVersionString = szVersionString; - } - - void SetBase(LPVOID base) - { - m_pBase = base; - } - -#ifdef FEATURE_PREJIT - void SetZapVersionInfo(CORCOMPILE_VERSION_INFO * info, CORCOMPILE_DEPENDENCY * pDeps, COUNT_T cDeps) - { - m_pZapVersionInfo = info; - m_pZapDependencies = pDeps; - m_cZapDependencies = cDeps; - } -#endif // FEATURE_PREJIT - -private: - LONG m_cRef; - HCORMODULE m_pHandle; // Handle to a cached PE image - LPVOID m_pBase; // File mapping (if runtime is not inited) -#ifdef FEATURE_PREJIT - struct CORCOMPILE_VERSION_INFO * m_pZapVersionInfo; // Zap image information - struct CORCOMPILE_DEPENDENCY * m_pZapDependencies; // Zap Dependancies directory - COUNT_T m_cZapDependencies; -#endif // FEATURE_PREJIT - IMDInternalImport * m_pMDInternalImport; - DWORD m_dwPEKind; - DWORD m_dwMachine; - const char * m_szVersionString; -#ifdef _DEBUG - IMetaDataAssemblyImport * m_pDebugMDImport; -#endif //_DEBUG -}; - -#endif // FEATURE_FUSION #endif // __AssemblyMDInternalDispenser__h__ diff --git a/src/md/runtime/mdinternaldisp.cpp b/src/md/runtime/mdinternaldisp.cpp index 1f5725ff01..34ea0205b3 100644 --- a/src/md/runtime/mdinternaldisp.cpp +++ b/src/md/runtime/mdinternaldisp.cpp @@ -228,1607 +228,5 @@ ErrExit: } // GetMDInternalInterface -#ifdef FEATURE_FUSION - -#ifndef DACCESS_COMPILE - -//***************************************************************************** -// GetAssemblyMDInternalImport. -// Instantiating an instance of AssemblyMDInternalImport. -// This class can support the IMetaDataAssemblyImport and some functionalities -// of IMetaDataImport on the internal import interface (IMDInternalImport). -//***************************************************************************** -STDAPI GetAssemblyMDInternalImport( // Return code. - LPCWSTR szFileName, // [in] The scope to open. - REFIID riid, // [in] The interface desired. - IUnknown **ppIUnk) // [out] Return interface on success. -{ - return GetAssemblyMDInternalImportEx(szFileName, riid, MDInternalImport_Default, ppIUnk); -} - -STDAPI GetAssemblyMDInternalImportEx( // Return code. - LPCWSTR szFileName, // [in] The scope to open. - REFIID riid, // [in] The interface desired. - MDInternalImportFlags flags, // [in] Flags to control opening the assembly - IUnknown **ppIUnk, // [out] Return interface on success. - HANDLE hFile) -{ - HRESULT hr; - - if (!szFileName || !szFileName[0] || !ppIUnk) - return E_INVALIDARG; - - // Sanity check the name. - if (wcslen(szFileName) >= _MAX_PATH) - return E_INVALIDARG; - - if (memcmp(szFileName, W("file:"), 10) == 0) - szFileName = &szFileName[5]; - - HCORMODULEHolder hModule; - DWORD dwFileLength; - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - - IfFailGoto(RuntimeOpenImageInternal(szFileName, &hModule, &dwFileLength, flags, hFile), ErrAsmExpected); - - IfFailGo(GetAssemblyMDInternalImportHelper(hModule, riid, flags, ppIUnk)); - - -ErrAsmExpected: - if(hr == COR_E_BADIMAGEFORMAT) - hr = COR_E_ASSEMBLYEXPECTED; - -ErrExit: -; - END_SO_INTOLERANT_CODE; - - return hr; -} - -HRESULT GetAssemblyMDInternalImportFromImage( - HCORMODULE hImage, - REFIID riid, - IUnknown **ppIUnk) -{ - - HRESULT hr; - - IfFailGo(GetAssemblyMDInternalImportHelper(hImage, riid, MDInternalImport_Default, ppIUnk)); - -ErrExit: - return hr; -} - -STDAPI GetAssemblyMDInternalImportByStream( // Return code. - IStream *pIStream, // [in] The IStream for the file - UINT64 AssemblyId, // [in] Unique Id for the assembly - REFIID riid, // [in] The interface desired. - IUnknown **ppIUnk) // [out] Return interface on success. -{ - return GetAssemblyMDInternalImportByStreamEx(pIStream, AssemblyId, riid, MDInternalImport_Default, ppIUnk); -} - -STDAPI GetAssemblyMDInternalImportByStreamEx( // Return code. - IStream *pIStream, // [in] The IStream for the file - UINT64 AssemblyId, // [in] Unique Id for the assembly - REFIID riid, // [in] The interface desired. - MDInternalImportFlags flags, // [in[ Flags to control opening the assembly - IUnknown **ppIUnk) // [out] Return interface on success. -{ - if (!pIStream || !ppIUnk) - return E_INVALIDARG; - - HRESULT hr; - DWORD dwFileLength; - HCORMODULEHolder hModule; - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - - IfFailGoto(RuntimeOpenImageByStream(pIStream, AssemblyId, 0, &hModule, &dwFileLength, flags), ErrAsmExpected); - - IfFailGo(GetAssemblyMDInternalImportHelper(hModule, riid, flags, ppIUnk)); - - -ErrAsmExpected: - if(hr == COR_E_BADIMAGEFORMAT) - hr = COR_E_ASSEMBLYEXPECTED; - -ErrExit: - ; - END_SO_INTOLERANT_CODE; - - return hr; -} - - -HRESULT GetAssemblyMDInternalImportHelper(HCORMODULE hModule, - REFIID riid, - MDInternalImportFlags flags, - IUnknown **ppIUnk) -{ - AssemblyMDInternalImport *pAssemblyMDInternalImport = NULL; - HRESULT hr; - LPVOID base; - PEDecoder pe; - IfFailGoto(RuntimeGetImageBase(hModule,&base,TRUE,NULL), ErrAsmExpected); - - if (base!=NULL) - IfFailGoto(pe.Init(base), ErrAsmExpected); - else - { - COUNT_T lgth; - IfFailGoto(RuntimeGetImageBase(hModule,&base,FALSE,&lgth), ErrAsmExpected); - pe.Init(base, lgth); - } - - // Both of these need to pass. - if (!pe.HasCorHeader() || !pe.CheckCorHeader()) - IfFailGo(COR_E_ASSEMBLYEXPECTED); - // Only one of these needs to. - if (!pe.CheckILFormat() && !pe.CheckNativeFormat()) - IfFailGo(COR_E_BADIMAGEFORMAT); - - COUNT_T cbMetaData; - LPCVOID pMetaData; - pMetaData = pe.GetMetadata(&cbMetaData); - - // Get the IL metadata. - IMDInternalImport *pMDInternalImport; - IfFailGo(RuntimeGetMDInternalImport(hModule, flags, &pMDInternalImport)); - if (pMDInternalImport == NULL) - IfFailGo(E_OUTOFMEMORY); - - _ASSERTE(pMDInternalImport); - pAssemblyMDInternalImport = new (nothrow) AssemblyMDInternalImport (pMDInternalImport); - if (!pAssemblyMDInternalImport) { - pMDInternalImport->Release(); - IfFailGo(E_OUTOFMEMORY); - } - - { // identify PE kind and machine type, plus the version string location - DWORD dwKind=0; - DWORD dwMachine=0; - RuntimeGetImageKind(hModule,&dwKind,&dwMachine); - pAssemblyMDInternalImport->SetPEKind(dwKind); - pAssemblyMDInternalImport->SetMachine(dwMachine); - - { - LPCSTR pString = NULL; - IfFailGo(GetImageRuntimeVersionString((PVOID)pMetaData, &pString)); - - pAssemblyMDInternalImport->SetVersionString(pString); - } - - } - - pAssemblyMDInternalImport->SetHandle(hModule); - -#ifdef FEATURE_PREJIT - // Check for zap header for INativeImageInstallInfo - // Dont do this if we are returning the IL metadata as CORCOMPILE_DEPENDENCY - // references the native image metadata, not the IL metadata. - - if (pe.HasNativeHeader() && !(flags & MDInternalImport_ILMetaData)) - { - CORCOMPILE_VERSION_INFO *pNativeVersionInfo = pe.GetNativeVersionInfo(); - - COUNT_T cDeps; - CORCOMPILE_DEPENDENCY *pDeps = pe.GetNativeDependencies(&cDeps); - - pAssemblyMDInternalImport->SetZapVersionInfo(pNativeVersionInfo, pDeps, cDeps); - } -#endif // FEATURE_PREJIT - - IfFailGo(pAssemblyMDInternalImport->QueryInterface(riid, (void**)ppIUnk)); - - return hr; - -ErrAsmExpected: - if(hr == COR_E_BADIMAGEFORMAT) - hr = COR_E_ASSEMBLYEXPECTED; - -ErrExit: - - if (pAssemblyMDInternalImport) - delete pAssemblyMDInternalImport; - - return hr; -} - -AssemblyMDInternalImport::AssemblyMDInternalImport (IMDInternalImport *pMDInternalImport) -: m_cRef(0), - m_pHandle(0), - m_pBase(NULL), -#ifdef FEATURE_PREJIT - m_pZapVersionInfo(NULL), -#endif // FEATURE_PREJIT - m_pMDInternalImport(pMDInternalImport), - m_dwPEKind(0), - m_dwMachine(0), - m_szVersionString("") -{ - _ASSERTE(m_pMDInternalImport); -} // AssemblyMDInternalImport - -AssemblyMDInternalImport::~AssemblyMDInternalImport () -{ - m_pMDInternalImport->Release(); - - if (m_pBase) - { - UnmapViewOfFile(m_pBase); - m_pBase = NULL; - CloseHandle(m_pHandle); - } - else if(m_pHandle) - { - HRESULT hr; - hr = RuntimeReleaseHandle(m_pHandle); - _ASSERTE(SUCCEEDED(hr)); - } - - m_pHandle = NULL; -} - -ULONG AssemblyMDInternalImport::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} // ULONG AssemblyMDInternalImport::AddRef() - -ULONG AssemblyMDInternalImport::Release() -{ - ULONG cRef = InterlockedDecrement(&m_cRef); - if (!cRef) - { - VALIDATE_BACKOUT_STACK_CONSUMPTION; - delete this; - } - return (cRef); -} // ULONG AssemblyMDInternalImport::Release() - -HRESULT AssemblyMDInternalImport::QueryInterface(REFIID riid, void **ppUnk) -{ - *ppUnk = 0; - - if (riid == IID_IUnknown) - *ppUnk = (IUnknown *) (IMetaDataAssemblyImport *) this; - else if (riid == IID_IMetaDataAssemblyImport) - *ppUnk = (IMetaDataAssemblyImport *) this; - else if (riid == IID_IMetaDataImport) - *ppUnk = (IMetaDataImport *) this; - else if (riid == IID_IMetaDataImport2) - *ppUnk = (IMetaDataImport2 *) this; - else if (riid == IID_ISNAssemblySignature) - *ppUnk = (ISNAssemblySignature *) this; -#ifdef FEATURE_PREJIT - else if (riid == IID_IGetIMDInternalImport) - *ppUnk = (IGetIMDInternalImport *) this; - else if (riid == IID_INativeImageInstallInfo && m_pZapVersionInfo) - *ppUnk = (INativeImageInstallInfo *) this; -#endif // FEATURE_PREJIT - else - return (E_NOINTERFACE); - AddRef(); - return (S_OK); -} - - -STDMETHODIMP AssemblyMDInternalImport::GetAssemblyProps ( // S_OK or error. - mdAssembly mda, // [IN] The Assembly for which to get the properties. - const void **ppbPublicKey, // [OUT] Pointer to the public key. - ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key. - ULONG *pulHashAlgId, // [OUT] Hash Algorithm. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData. - DWORD *pdwAssemblyFlags) // [OUT] Flags. -{ - HRESULT hr; - LPCSTR _szName; - AssemblyMetaDataInternal _AssemblyMetaData; - - _AssemblyMetaData.ulProcessor = 0; - _AssemblyMetaData.ulOS = 0; - - IfFailRet(m_pMDInternalImport->GetAssemblyProps( - mda, // [IN] The Assembly for which to get the properties. - ppbPublicKey, // [OUT] Pointer to the public key. - pcbPublicKey, // [OUT] Count of bytes in the public key. - pulHashAlgId, // [OUT] Hash Algorithm. - &_szName, // [OUT] Buffer to fill with name. - &_AssemblyMetaData, // [OUT] Assembly MetaData. - pdwAssemblyFlags)); // [OUT] Flags. - - if (pchName != NULL) - { - *pchName = WszMultiByteToWideChar(CP_UTF8, 0, _szName, -1, szName, cchName); - if (*pchName == 0) - { - return HRESULT_FROM_GetLastError(); - } - } - - if (pMetaData) - { - pMetaData->usMajorVersion = _AssemblyMetaData.usMajorVersion; - pMetaData->usMinorVersion = _AssemblyMetaData.usMinorVersion; - pMetaData->usBuildNumber = _AssemblyMetaData.usBuildNumber; - pMetaData->usRevisionNumber = _AssemblyMetaData.usRevisionNumber; - pMetaData->ulProcessor = 0; - pMetaData->ulOS = 0; - - pMetaData->cbLocale = WszMultiByteToWideChar(CP_UTF8, 0, _AssemblyMetaData.szLocale, -1, pMetaData->szLocale, pMetaData->cbLocale); - if (pMetaData->cbLocale == 0) - { - return HRESULT_FROM_GetLastError(); - } - } - - return S_OK; -} - -STDMETHODIMP AssemblyMDInternalImport::GetAssemblyRefProps ( // S_OK or error. - mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties. - const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token. - ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData. - const void **ppbHashValue, // [OUT] Hash blob. - ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob. - DWORD *pdwAssemblyRefFlags) // [OUT] Flags. -{ - HRESULT hr; - LPCSTR _szName; - AssemblyMetaDataInternal _AssemblyMetaData; - - _AssemblyMetaData.ulProcessor = 0; - _AssemblyMetaData.ulOS = 0; - - IfFailRet(m_pMDInternalImport->GetAssemblyRefProps( - mdar, // [IN] The Assembly for which to get the properties. - ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token. - pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token. - &_szName, // [OUT] Buffer to fill with name. - &_AssemblyMetaData, // [OUT] Assembly MetaData. - ppbHashValue, // [OUT] Hash blob. - pcbHashValue, // [OUT] Count of bytes in the hash blob. - pdwAssemblyRefFlags)); // [OUT] Flags. - - if (pchName != NULL) - { - *pchName = WszMultiByteToWideChar(CP_UTF8, 0, _szName, -1, szName, cchName); - if (*pchName == 0) - { - return HRESULT_FROM_GetLastError(); - } - } - - pMetaData->usMajorVersion = _AssemblyMetaData.usMajorVersion; - pMetaData->usMinorVersion = _AssemblyMetaData.usMinorVersion; - pMetaData->usBuildNumber = _AssemblyMetaData.usBuildNumber; - pMetaData->usRevisionNumber = _AssemblyMetaData.usRevisionNumber; - pMetaData->ulProcessor = 0; - pMetaData->ulOS = 0; - - pMetaData->cbLocale = WszMultiByteToWideChar(CP_UTF8, 0, _AssemblyMetaData.szLocale, -1, pMetaData->szLocale, pMetaData->cbLocale); - if (pMetaData->cbLocale == 0) - { - return HRESULT_FROM_GetLastError(); - } - - return S_OK; -} - -STDMETHODIMP AssemblyMDInternalImport::GetFileProps ( // S_OK or error. - mdFile mdf, // [IN] The File for which to get the properties. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob. - ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob. - DWORD *pdwFileFlags) // [OUT] Flags. -{ - HRESULT hr; - LPCSTR _szName; - IfFailRet(m_pMDInternalImport->GetFileProps( - mdf, - &_szName, - ppbHashValue, - pcbHashValue, - pdwFileFlags)); - - if (pchName != NULL) - { - *pchName = WszMultiByteToWideChar(CP_UTF8, 0, _szName, -1, szName, cchName); - if (*pchName == 0) - { - return HRESULT_FROM_GetLastError(); - } - } - - return S_OK; -} - -STDMETHODIMP AssemblyMDInternalImport::GetExportedTypeProps ( // S_OK or error. - mdExportedType mdct, // [IN] The ExportedType for which to get the properties. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType. - mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file. - DWORD *pdwExportedTypeFlags) // [OUT] Flags. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetManifestResourceProps ( // S_OK or error. - mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties. - __out_ecount (cchName) LPWSTR szName, // [OUT] Buffer to fill with name. - ULONG cchName, // [IN] Size of buffer in wide chars. - ULONG *pchName, // [OUT] Actual # of wide chars in name. - mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource. - DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file. - DWORD *pdwResourceFlags) // [OUT] Flags. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumAssemblyRefs ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here. - ULONG cMax, // [IN] Max AssemblyRefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - HENUMInternal **ppmdEnum = reinterpret_cast<HENUMInternal **> (phEnum); - HRESULT hr = NOERROR; - HENUMInternal *pEnum; - - if (*ppmdEnum == NULL) - { - // create the enumerator. - IfFailGo(HENUMInternal::CreateSimpleEnum( - mdtAssemblyRef, - 0, - 1, - &pEnum)); - - IfFailGo(m_pMDInternalImport->EnumInit(mdtAssemblyRef, 0, pEnum)); - - // set the output parameter. - *ppmdEnum = pEnum; - } - else - { - pEnum = *ppmdEnum; - } - - // we can only fill the minimum of what the caller asked for or what we have left. - IfFailGo(HENUMInternal::EnumWithCount(pEnum, cMax, rAssemblyRefs, pcTokens)); -ErrExit: - HENUMInternal::DestroyEnumIfEmpty(ppmdEnum); - - return hr; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumFiles ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdFile rFiles[], // [OUT] Put Files here. - ULONG cMax, // [IN] Max Files to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - HENUMInternal **ppmdEnum = reinterpret_cast<HENUMInternal **> (phEnum); - HRESULT hr = NOERROR; - HENUMInternal *pEnum; - - if (*ppmdEnum == NULL) - { - // create the enumerator. - IfFailGo(HENUMInternal::CreateSimpleEnum( - mdtFile, - 0, - 1, - &pEnum)); - - IfFailGo(m_pMDInternalImport->EnumInit(mdtFile, 0, pEnum)); - - // set the output parameter. - *ppmdEnum = pEnum; - } - else - { - pEnum = *ppmdEnum; - } - - // we can only fill the minimum of what the caller asked for or what we have left. - IfFailGo(HENUMInternal::EnumWithCount(pEnum, cMax, rFiles, pcTokens)); - -ErrExit: - HENUMInternal::DestroyEnumIfEmpty(ppmdEnum); - return hr; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumExportedTypes ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here. - ULONG cMax, // [IN] Max ExportedTypes to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumManifestResources ( // S_OK or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here. - ULONG cMax, // [IN] Max Resources to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetAssemblyFromScope ( // S_OK or error - mdAssembly *ptkAssembly) // [OUT] Put token here. -{ - return m_pMDInternalImport->GetAssemblyFromScope (ptkAssembly); -} - -STDMETHODIMP AssemblyMDInternalImport::FindExportedTypeByName (// S_OK or error - LPCWSTR szName, // [IN] Name of the ExportedType. - mdToken mdtExportedType, // [IN] ExportedType for the enclosing class. - mdExportedType *ptkExportedType) // [OUT] Put the ExportedType token here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::FindManifestResourceByName ( // S_OK or error - LPCWSTR szName, // [IN] Name of the ManifestResource. - mdManifestResource *ptkManifestResource) // [OUT] Put the ManifestResource token here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -void AssemblyMDInternalImport::CloseEnum ( - HCORENUM hEnum) // Enum to be closed. -{ - HENUMInternal *pmdEnum = reinterpret_cast<HENUMInternal *> (hEnum); - - if (pmdEnum == NULL) - return; - - HENUMInternal::DestroyEnum(pmdEnum); -} - -STDMETHODIMP AssemblyMDInternalImport::FindAssembliesByName ( // S_OK or error - LPCWSTR szAppBase, // [IN] optional - can be NULL - LPCWSTR szPrivateBin, // [IN] optional - can be NULL - LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting - IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here - ULONG cMax, // [IN] The max number to put - ULONG *pcAssemblies) // [OUT] The number of assemblies returned. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::CountEnum (HCORENUM hEnum, ULONG *pulCount) -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::ResetEnum (HCORENUM hEnum, ULONG ulPos) -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumTypeDefs (HCORENUM *phEnum, mdTypeDef rTypeDefs[], - ULONG cMax, ULONG *pcTypeDefs) -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumInterfaceImpls (HCORENUM *phEnum, mdTypeDef td, - mdInterfaceImpl rImpls[], ULONG cMax, - ULONG* pcImpls) -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumTypeRefs (HCORENUM *phEnum, mdTypeRef rTypeRefs[], - ULONG cMax, ULONG* pcTypeRefs) -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::FindTypeDefByName ( // S_OK or error. - LPCWSTR szTypeDef, // [IN] Name of the Type. - mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class. - mdTypeDef *ptd) // [OUT] Put the TypeDef token here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetScopeProps ( // S_OK or error. - __out_ecount (cchName) LPWSTR szName, // [OUT] Put the name here. - ULONG cchName, // [IN] Size of name buffer in wide chars. - ULONG *pchName, // [OUT] Put size of name (wide chars) here. - GUID *pmvid) // [OUT, OPTIONAL] Put MVID here. -{ - HRESULT hr; - LPCSTR _szName; - - if (!m_pMDInternalImport->IsValidToken(m_pMDInternalImport->GetModuleFromScope())) - return COR_E_BADIMAGEFORMAT; - - IfFailRet(m_pMDInternalImport->GetScopeProps(&_szName, pmvid)); - - if (pchName != NULL) - { - *pchName = WszMultiByteToWideChar(CP_UTF8, 0, _szName, -1, szName, cchName); - if (*pchName == 0) - { - return HRESULT_FROM_GetLastError(); - } - } - - return S_OK; - -} - -STDMETHODIMP AssemblyMDInternalImport::GetModuleFromScope ( // S_OK. - mdModule *pmd) // [OUT] Put mdModule token here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetTypeDefProps ( // S_OK or error. - mdTypeDef td, // [IN] TypeDef token for inquiry. - __out_ecount (cchTypeDef) LPWSTR szTypeDef, // [OUT] Put name here. - ULONG cchTypeDef, // [IN] size of name buffer in wide chars. - ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here. - DWORD *pdwTypeDefFlags, // [OUT] Put flags here. - mdToken *ptkExtends) // [OUT] Put base class TypeDef/TypeRef here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetInterfaceImplProps ( // S_OK or error. - mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token. - mdTypeDef *pClass, // [OUT] Put implementing class token here. - mdToken *ptkIface) // [OUT] Put implemented interface token here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetTypeRefProps ( // S_OK or error. - mdTypeRef tr, // [IN] TypeRef token. - mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef. - __out_ecount (cchName) LPWSTR szName, // [OUT] Name of the TypeRef. - ULONG cchName, // [IN] Size of buffer. - ULONG *pchName) // [OUT] Size of Name. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::ResolveTypeRef (mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd) -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMembers ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - mdToken rMembers[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMembersWithName ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - LPCWSTR szName, // [IN] Limit results to those with this name. - mdToken rMembers[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMethods ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - mdMethodDef rMethods[], // [OUT] Put MethodDefs here. - ULONG cMax, // [IN] Max MethodDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMethodsWithName ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - LPCWSTR szName, // [IN] Limit results to those with this name. - mdMethodDef rMethods[], // [OU] Put MethodDefs here. - ULONG cMax, // [IN] Max MethodDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumFields ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - mdFieldDef rFields[], // [OUT] Put FieldDefs here. - ULONG cMax, // [IN] Max FieldDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumFieldsWithName ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef cl, // [IN] TypeDef to scope the enumeration. - LPCWSTR szName, // [IN] Limit results to those with this name. - mdFieldDef rFields[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - - -STDMETHODIMP AssemblyMDInternalImport::EnumParams ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdMethodDef mb, // [IN] MethodDef to scope the enumeration. - mdParamDef rParams[], // [OUT] Put ParamDefs here. - ULONG cMax, // [IN] Max ParamDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMemberRefs ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tkParent, // [IN] Parent token to scope the enumeration. - mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here. - ULONG cMax, // [IN] Max MemberRefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMethodImpls ( // S_OK, S_FALSE, or error - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef td, // [IN] TypeDef to scope the enumeration. - mdToken rMethodBody[], // [OUT] Put Method Body tokens here. - mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here. - ULONG cMax, // [IN] Max tokens to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumPermissionSets ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tk, // [IN] if !NIL, token to scope the enumeration. - DWORD dwActions, // [IN] if !0, return only these actions. - mdPermission rPermission[], // [OUT] Put Permissions here. - ULONG cMax, // [IN] Max Permissions to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::FindMember ( - mdTypeDef td, // [IN] given typedef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdToken *pmb) // [OUT] matching memberdef -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::FindMethod ( - mdTypeDef td, // [IN] given typedef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdMethodDef *pmb) // [OUT] matching memberdef -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::FindField ( - mdTypeDef td, // [IN] given typedef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdFieldDef *pmb) // [OUT] matching memberdef -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::FindMemberRef ( - mdTypeRef td, // [IN] given typeRef - LPCWSTR szName, // [IN] member name - PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature - ULONG cbSigBlob, // [IN] count of bytes in the signature blob - mdMemberRef *pmr) // [OUT] matching memberref -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetMethodProps ( - mdMethodDef mb, // The method for which to get props. - mdTypeDef *pClass, // Put method's class here. - __out_ecount (cchMethod) LPWSTR szMethod, // Put method's name here. - ULONG cchMethod, // Size of szMethod buffer in wide chars. - ULONG *pchMethod, // Put actual size here - DWORD *pdwAttr, // Put flags here. - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data - ULONG *pcbSigBlob, // [OUT] actual size of signature blob - ULONG *pulCodeRVA, // [OUT] codeRVA - DWORD *pdwImplFlags) // [OUT] Impl. Flags -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetMemberRefProps ( // S_OK or error. - mdMemberRef mr, // [IN] given memberref - mdToken *ptk, // [OUT] Put classref or classdef here. - __out_ecount (cchMember) LPWSTR szMember, // [OUT] buffer to fill for member's name - ULONG cchMember, // [IN] the count of char of szMember - ULONG *pchMember, // [OUT] actual count of char in member name - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value - ULONG *pbSig) // [OUT] actual size of signature blob -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumProperties ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef td, // [IN] TypeDef to scope the enumeration. - mdProperty rProperties[], // [OUT] Put Properties here. - ULONG cMax, // [IN] Max properties to put. - ULONG *pcProperties) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumEvents ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdTypeDef td, // [IN] TypeDef to scope the enumeration. - mdEvent rEvents[], // [OUT] Put events here. - ULONG cMax, // [IN] Max events to put. - ULONG *pcEvents) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetEventProps ( // S_OK, S_FALSE, or error. - mdEvent ev, // [IN] event token - mdTypeDef *pClass, // [OUT] typedef containing the event declarion. - LPCWSTR szEvent, // [OUT] Event name - ULONG cchEvent, // [IN] the count of wchar of szEvent - ULONG *pchEvent, // [OUT] actual count of wchar for event's name - DWORD *pdwEventFlags, // [OUT] Event flags. - mdToken *ptkEventType, // [OUT] EventType class - mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event - mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event - mdMethodDef *pmdFire, // [OUT] Fire method of the event - mdMethodDef rmdOtherMethod[], // [OUT] other method of the event - ULONG cMax, // [IN] size of rmdOtherMethod - ULONG *pcOtherMethod) // [OUT] total number of other method of this event -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMethodSemantics ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdMethodDef mb, // [IN] MethodDef to scope the enumeration. - mdToken rEventProp[], // [OUT] Put Event/Property here. - ULONG cMax, // [IN] Max properties to put. - ULONG *pcEventProp) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetMethodSemantics ( // S_OK, S_FALSE, or error. - mdMethodDef mb, // [IN] method token - mdToken tkEventProp, // [IN] event/property token. - DWORD *pdwSemanticsFlags) // [OUT] the role flags for the method/propevent pair -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetClassLayout ( - mdTypeDef td, // [IN] give typedef - DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16 - COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array - ULONG cMax, // [IN] size of the array - ULONG *pcFieldOffset, // [OUT] needed array size - ULONG *pulClassSize) // [OUT] the size of the class -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetFieldMarshal ( - mdToken tk, // [IN] given a field's memberdef - PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field - ULONG *pcbNativeType) // [OUT] the count of bytes of *ppvNativeType -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetRVA ( // S_OK or error. - mdToken tk, // Member for which to set offset - ULONG *pulCodeRVA, // The offset - DWORD *pdwImplFlags) // the implementation flags -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetPermissionSetProps ( - mdPermission pm, // [IN] the permission token. - DWORD *pdwAction, // [OUT] CorDeclSecurity. - void const **ppvPermission, // [OUT] permission blob. - ULONG *pcbPermission) // [OUT] count of bytes of pvPermission. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetSigFromToken ( // S_OK or error. - mdSignature mdSig, // [IN] Signature token. - PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token. - ULONG *pcbSig) // [OUT] return size of signature. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetModuleRefProps ( // S_OK or error. - mdModuleRef mur, // [IN] moduleref token. - __out_ecount (cchName) LPWSTR szName, // [OUT] buffer to fill with the moduleref name. - ULONG cchName, // [IN] size of szName in wide characters. - ULONG *pchName) // [OUT] actual count of characters in the name. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumModuleRefs ( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] pointer to the enum. - mdModuleRef rModuleRefs[], // [OUT] put modulerefs here. - ULONG cmax, // [IN] max memberrefs to put. - ULONG *pcModuleRefs) // [OUT] put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetTypeSpecFromToken ( // S_OK or error. - mdTypeSpec typespec, // [IN] TypeSpec token. - PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature - ULONG *pcbSig) // [OUT] return size of signature. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetNameFromToken ( // Not Recommended! May be removed! - mdToken tk, // [IN] Token to get name from. Must have a name. - MDUTF8CSTR *pszUtf8NamePtr) // [OUT] Return pointer to UTF8 name in heap. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumUnresolvedMethods ( // S_OK, S_FALSE, or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken rMethods[], // [OUT] Put MemberDefs here. - ULONG cMax, // [IN] Max MemberDefs to put. - ULONG *pcTokens) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetUserString ( // S_OK or error. - mdString stk, // [IN] String token. - __out_ecount (cchString) LPWSTR szString, // [OUT] Copy of string. - ULONG cchString, // [IN] Max chars of room in szString. - ULONG *pchString) // [OUT] How many chars in actual string. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetPinvokeMap ( // S_OK or error. - mdToken tk, // [IN] FieldDef or MethodDef. - DWORD *pdwMappingFlags, // [OUT] Flags used for mapping. - __out_ecount (cchImportName) LPWSTR szImportName, // [OUT] Import name. - ULONG cchImportName, // [IN] Size of the name buffer. - ULONG *pchImportName, // [OUT] Actual number of characters stored. - mdModuleRef *pmrImportDLL) // [OUT] ModuleRef token for the target DLL. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumSignatures ( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] pointer to the enum. - mdSignature rSignatures[], // [OUT] put signatures here. - ULONG cmax, // [IN] max signatures to put. - ULONG *pcSignatures) // [OUT] put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumTypeSpecs ( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] pointer to the enum. - mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here. - ULONG cmax, // [IN] max TypeSpecs to put. - ULONG *pcTypeSpecs) // [OUT] put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumUserStrings ( // S_OK or error. - HCORENUM *phEnum, // [IN/OUT] pointer to the enum. - mdString rStrings[], // [OUT] put Strings here. - ULONG cmax, // [IN] max Strings to put. - ULONG *pcStrings) // [OUT] put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetParamForMethodIndex ( // S_OK or error. - mdMethodDef md, // [IN] Method token. - ULONG ulParamSeq, // [IN] Parameter sequence. - mdParamDef *ppd) // [IN] Put Param token here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumCustomAttributes ( // S_OK or error. - HCORENUM *phEnum, // [IN, OUT] COR enumerator. - mdToken tk, // [IN] Token to scope the enumeration, 0 for all. - mdToken tkType, // [IN] Type of interest, 0 for all. - mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here. - ULONG cMax, // [IN] Size of rCustomAttributes. - ULONG *pcCustomAttributes) // [OUT, OPTIONAL] Put count of token values here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetCustomAttributeProps ( // S_OK or error. - mdCustomAttribute cv, // [IN] CustomAttribute token. - mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here. - mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here. - void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here. - ULONG *pcbSize) // [OUT, OPTIONAL] Put size of date here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::FindTypeRef ( - mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef. - LPCWSTR szName, // [IN] TypeRef Name. - mdTypeRef *ptr) // [OUT] matching TypeRef. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetMemberProps ( - mdToken mb, // The member for which to get props. - mdTypeDef *pClass, // Put member's class here. - __out_ecount (cchMember) LPWSTR szMember, // Put member's name here. - ULONG cchMember, // Size of szMember buffer in wide chars. - ULONG *pchMember, // Put actual size here - DWORD *pdwAttr, // Put flags here. - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data - ULONG *pcbSigBlob, // [OUT] actual size of signature blob - ULONG *pulCodeRVA, // [OUT] codeRVA - DWORD *pdwImplFlags, // [OUT] Impl. Flags - DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* - UVCP_CONSTANT *ppValue, // [OUT] constant value - ULONG *pcchValue) // [OUT] size of constant string in chars, 0 for non-strings. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetFieldProps ( - mdFieldDef mb, // The field for which to get props. - mdTypeDef *pClass, // Put field's class here. - __out_ecount (cchField) LPWSTR szField, // Put field's name here. - ULONG cchField, // Size of szField buffer in wide chars. - ULONG *pchField, // Put actual size here - DWORD *pdwAttr, // Put flags here. - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data - ULONG *pcbSigBlob, // [OUT] actual size of signature blob - DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* - UVCP_CONSTANT *ppValue, // [OUT] constant value - ULONG *pcchValue) // [OUT] size of constant string in chars, 0 for non-strings. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetPropertyProps ( // S_OK, S_FALSE, or error. - mdProperty prop, // [IN] property token - mdTypeDef *pClass, // [OUT] typedef containing the property declarion. - LPCWSTR szProperty, // [OUT] Property name - ULONG cchProperty, // [IN] the count of wchar of szProperty - ULONG *pchProperty, // [OUT] actual count of wchar for property name - DWORD *pdwPropFlags, // [OUT] property flags. - PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob - ULONG *pbSig, // [OUT] count of bytes in *ppvSig - DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* - UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value - ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings. - mdMethodDef *pmdSetter, // [OUT] setter method of the property - mdMethodDef *pmdGetter, // [OUT] getter method of the property - mdMethodDef rmdOtherMethod[], // [OUT] other method of the property - ULONG cMax, // [IN] size of rmdOtherMethod - ULONG *pcOtherMethod) // [OUT] total number of other method of this property -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetParamProps ( // S_OK or error. - mdParamDef tk, // [IN]The Parameter. - mdMethodDef *pmd, // [OUT] Parent Method token. - ULONG *pulSequence, // [OUT] Parameter sequence. - __out_ecount (cchName) LPWSTR szName, // [OUT] Put name here. - ULONG cchName, // [OUT] Size of name buffer. - ULONG *pchName, // [OUT] Put actual size of name here. - DWORD *pdwAttr, // [OUT] Put flags here. - DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*. - UVCP_CONSTANT *ppValue, // [OUT] Constant value. - ULONG *pcchValue) // [OUT] size of constant string in chars, 0 for non-strings. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetCustomAttributeByName ( // S_OK or error. - mdToken tkObj, // [IN] Object with Custom Attribute. - LPCWSTR szName, // [IN] Name of desired Custom Attribute. - const void **ppData, // [OUT] Put pointer to data here. - ULONG *pcbData) // [OUT] Put size of data here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -BOOL AssemblyMDInternalImport::IsValidToken ( // True or False. - mdToken tk) // [IN] Given token. -{ - _ASSERTE(!"NYI"); - return FALSE; -} - -STDMETHODIMP AssemblyMDInternalImport::GetNestedClassProps ( // S_OK or error. - mdTypeDef tdNestedClass, // [IN] NestedClass token. - mdTypeDef *ptdEnclosingClass) // [OUT] EnclosingClass token. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetNativeCallConvFromSig ( // S_OK or error. - void const *pvSig, // [IN] Pointer to signature. - ULONG cbSig, // [IN] Count of signature bytes. - ULONG *pCallConv) // [OUT] Put calling conv here (see CorPinvokemap). -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::IsGlobal ( // S_OK or error. - mdToken pd, // [IN] Type, Field, or Method token. - int *pbGlobal) // [OUT] Put 1 if global, 0 otherwise. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetMethodSpecProps( - mdMethodSpec mi, // [IN] The method instantiation - mdToken *tkParent, // [OUT] MethodDef or MemberRef - PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data - ULONG *pcbSigBlob) // [OUT] actual size of signature blob -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -// *** ISNAssemblySignature methods *** - -STDMETHODIMP AssemblyMDInternalImport::GetSNAssemblySignature( - BYTE *pbSig, // [IN, OUT] Buffer to write signature - DWORD *pcbSig) // [IN, OUT] Size of buffer, bytes written -{ - return RuntimeGetAssemblyStrongNameHashForModule(m_pHandle, this, pbSig, pcbSig); -} - - -#include "strongname.h" - -#ifdef FEATURE_PREJIT -// *** IGetIMDInternalImport *** -STDMETHODIMP AssemblyMDInternalImport::GetIMDInternalImport( - IMDInternalImport ** pIMDInternalImport) -{ - m_pMDInternalImport->AddRef(); - *pIMDInternalImport = m_pMDInternalImport; - return S_OK; -} - - - -// =========================================================================== - -class CNativeImageDependency : public INativeImageDependency -{ -public: - CNativeImageDependency(CORCOMPILE_DEPENDENCY * pDependency) - : m_cRef(1), m_pDependency(pDependency) - { - } - - ~CNativeImageDependency() - { - } - - // - // IUnknown - // - - STDMETHODIMP_(ULONG) AddRef() - { - return InterlockedIncrement(&m_cRef); - } - - STDMETHODIMP_(ULONG) Release() - { - ULONG cRef = InterlockedDecrement(&m_cRef); - if (!cRef) - delete this; - return (cRef); - } - - STDMETHODIMP QueryInterface(REFIID riid, void **ppUnk) - { - *ppUnk = 0; - - if (riid == IID_IUnknown) - *ppUnk = (IUnknown *) (IMetaDataAssemblyImport *) this; - else if (riid == IID_INativeImageDependency) - *ppUnk = (INativeImageDependency *) this; - else - return (E_NOINTERFACE); - AddRef(); - return (S_OK); - } - - // - // INativeImageDependency - // - - STDMETHODIMP GetILAssemblyRef(mdAssemblyRef * pAssemblyRef) - { - BEGIN_ENTRYPOINT_NOTHROW; - - *pAssemblyRef = m_pDependency->dwAssemblyRef; - END_ENTRYPOINT_NOTHROW; - - return S_OK; - } - - STDMETHODIMP GetILAssemblyDef( - mdAssemblyRef * ppAssemblyDef, - CORCOMPILE_ASSEMBLY_SIGNATURE * pSign) - { - BEGIN_ENTRYPOINT_NOTHROW; - - *ppAssemblyDef = m_pDependency->dwAssemblyDef; - *pSign = m_pDependency->signAssemblyDef; - END_ENTRYPOINT_NOTHROW; - - return S_OK; - } - - STDMETHODIMP GetNativeAssemblyDef(CORCOMPILE_NGEN_SIGNATURE * pNativeSign) - { - BEGIN_ENTRYPOINT_NOTHROW; - - *pNativeSign = m_pDependency->signNativeImage; - END_ENTRYPOINT_NOTHROW; - - return S_OK; - } - - STDMETHODIMP GetPEKind(PEKIND *pPEKind) - { - BEGIN_ENTRYPOINT_NOTHROW; - - *pPEKind = PEKIND((m_pDependency->dependencyInfo & CORCOMPILE_DEPENDENCY_PEKIND_MASK) >> CORCOMPILE_DEPENDENCY_PEKIND_SHIFT); - END_ENTRYPOINT_NOTHROW; - - return S_OK; - } - -protected: - - LONG m_cRef; - CORCOMPILE_DEPENDENCY * m_pDependency; -}; - -// =========================================================================== -// *** INativeImageInstallInfo *** -// =========================================================================== - -STDMETHODIMP AssemblyMDInternalImport::GetSignature(CORCOMPILE_NGEN_SIGNATURE * pNgenSign) -{ - BEGIN_ENTRYPOINT_NOTHROW; - - *pNgenSign = m_pZapVersionInfo->signature; - END_ENTRYPOINT_NOTHROW; - - return S_OK; -} - -STDMETHODIMP AssemblyMDInternalImport::GetVersionInfo(CORCOMPILE_VERSION_INFO * pVersionInfo) -{ - BEGIN_ENTRYPOINT_NOTHROW; - - *pVersionInfo = *m_pZapVersionInfo; - END_ENTRYPOINT_NOTHROW; - return S_OK; -} - - - -STDMETHODIMP AssemblyMDInternalImport::GetILSignature(CORCOMPILE_ASSEMBLY_SIGNATURE * pILSign) -{ - BEGIN_ENTRYPOINT_NOTHROW; - - *pILSign = m_pZapVersionInfo->sourceAssembly; - END_ENTRYPOINT_NOTHROW; - return S_OK; -} - -STDMETHODIMP AssemblyMDInternalImport::GetConfigMask(DWORD * pConfigMask) -{ - BEGIN_ENTRYPOINT_NOTHROW; - - *pConfigMask = m_pZapVersionInfo->wConfigFlags; - END_ENTRYPOINT_NOTHROW; - - return S_OK; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumDependencies ( - HCORENUM * phEnum, // [IN/OUT] - Pointer to the enum - INativeImageDependency *rDeps[], // [OUT] - ULONG cMax, // Max dependancies to enumerate in this iteration - DWORD * pdwCount // [OUT] - Number of dependancies actually enumerated - ) -{ - HRESULT hr = S_OK; - - BEGIN_ENTRYPOINT_NOTHROW; - - CORCOMPILE_DEPENDENCY * pDependenciesEnd = m_pZapDependencies + m_cZapDependencies; - - CORCOMPILE_DEPENDENCY * pNextDependency; - - // Is the enum just being initialized, or are we walking an existing one? - if ((*phEnum) == NULL) - pNextDependency = m_pZapDependencies; - else - pNextDependency = (CORCOMPILE_DEPENDENCY *)(*phEnum); - - DWORD count; - for (count = 0; - pNextDependency < pDependenciesEnd && count < cMax; - count++, pNextDependency++) - { - CNativeImageDependency * pDep = new (nothrow) CNativeImageDependency(pNextDependency); - IfNullGo( pDep ); - - rDeps[count] = pDep; - } - - *phEnum = (HCORENUM)(pNextDependency < pDependenciesEnd) ? pNextDependency : NULL; - *pdwCount = count; - -ErrExit: - END_ENTRYPOINT_NOTHROW; - - return hr; -} - - -STDMETHODIMP AssemblyMDInternalImport::GetDependency ( - const CORCOMPILE_NGEN_SIGNATURE *pcngenSign, // [IN] ngenSig of dependency you want - CORCOMPILE_DEPENDENCY *pDep // [OUT] matching dependency - ) -{ - HRESULT hr = S_OK; - - BEGIN_ENTRYPOINT_NOTHROW; - - _ASSERTE(pcngenSign != NULL); - _ASSERTE(*pcngenSign != INVALID_NGEN_SIGNATURE); - _ASSERTE(pDep != NULL); - - CORCOMPILE_DEPENDENCY * pDependenciesEnd = m_pZapDependencies + m_cZapDependencies; - CORCOMPILE_DEPENDENCY * pNextDependency = m_pZapDependencies; - while (pNextDependency != pDependenciesEnd) - { - if (pNextDependency->signNativeImage == *pcngenSign) - { - *pDep = *pNextDependency; - hr = S_OK; - goto ErrExit; - } - pNextDependency++; - } - hr = S_FALSE; - -ErrExit: - END_ENTRYPOINT_NOTHROW; - - return hr; -} - - -#endif // FEATURE_PREJIT - - -//***************************************************************************** -// IMetaDataImport2 methods -//***************************************************************************** -STDMETHODIMP AssemblyMDInternalImport::GetGenericParamProps( // S_OK or error. - mdGenericParam gp, // [IN] GenericParam - ULONG *pulParamSeq, // [OUT] Index of the type parameter - DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance) - mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef) - DWORD *reserved, // [OUT] For future use (e.g. non-type parameters) - __out_ecount (cchName) LPWSTR wzname, // [OUT] Put name here - ULONG cchName, // [IN] Size of buffer - ULONG *pchName) // [OUT] Put size of name (wide chars) here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetGenericParamConstraintProps( // S_OK or error. - mdGenericParamConstraint gpc, // [IN] GenericParamConstraint - mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained - mdToken *ptkConstraintType) // [OUT] TypeDef/Ref/Spec constraint -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumGenericParams( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested - mdGenericParam rGenericParams[], // [OUT] Put GenericParams here. - ULONG cMax, // [IN] Max GenericParams to put. - ULONG *pcGenericParams) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumGenericParamConstraints( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdGenericParam tk, // [IN] GenericParam whose constraints are requested - mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here. - ULONG cMax, // [IN] Max GenericParamConstraints to put. - ULONG *pcGenericParamConstraints) // [OUT] Put # put here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::EnumMethodSpecs( // S_OK or error. - HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. - mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested - mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here. - ULONG cMax, // [IN] Max tokens to put. - ULONG *pcMethodSpecs) // [OUT] Put actual count here. -{ - _ASSERTE(!"NYI"); - return E_NOTIMPL; -} - -STDMETHODIMP AssemblyMDInternalImport::GetPEKind( // S_OK or error. - DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE) - DWORD* pdwMachine) // [OUT] Machine as defined in NT header -{ - HRESULT hr = S_OK; - if(pdwPEKind) *pdwPEKind = m_dwPEKind; - if(pdwMachine) *pdwMachine = m_dwMachine; - return hr; -} - -STDMETHODIMP AssemblyMDInternalImport::GetVersionString( // S_OK or error. - __out_ecount (ccBufSize) LPWSTR pwzBuf, // Put version string here. - DWORD ccBufSize, // [in] size of the buffer, in wide chars - DWORD *pccBufSize) // [out] Size of the version string, wide chars, including terminating nul. -{ - HRESULT hr=S_OK; - DWORD L = WszMultiByteToWideChar(CP_UTF8,0,m_szVersionString,-1,pwzBuf,ccBufSize); - if(ccBufSize < L) - hr = HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW); - - if(pccBufSize) *pccBufSize = L; - return hr; -} - -#endif //!DACCESS_COMPILE - -#endif // FEATURE_FUSION #endif //FEATURE_METADATA_INTERNAL_APIS diff --git a/src/mscorlib/src/System/AppDomainSetup.cs b/src/mscorlib/src/System/AppDomainSetup.cs index 0d19ad237f..284650480b 100644 --- a/src/mscorlib/src/System/AppDomainSetup.cs +++ b/src/mscorlib/src/System/AppDomainSetup.cs @@ -56,27 +56,8 @@ namespace System // Constants from fusionsetup.h. private const string LOADER_OPTIMIZATION = "LOADER_OPTIMIZATION"; private const string CONFIGURATION_EXTENSION = ".config"; - private const string APPENV_RELATIVEPATH = "RELPATH"; - private const string MACHINE_CONFIGURATION_FILE = "config\\machine.config"; - private const string ACTAG_HOST_CONFIG_FILE = "HOST_CONFIG"; - // Constants from fusionpriv.h - private const string ACTAG_APP_CONFIG_FILE = "APP_CONFIG_FILE"; - private const string ACTAG_MACHINE_CONFIG = "MACHINE_CONFIG"; private const string ACTAG_APP_BASE_URL = "APPBASE"; - private const string ACTAG_APP_NAME = "APP_NAME"; - private const string ACTAG_BINPATH_PROBE_ONLY = "BINPATH_PROBE_ONLY"; - private const string ACTAG_APP_CACHE_BASE = "CACHE_BASE"; - private const string ACTAG_DEV_PATH = "DEV_PATH"; - private const string ACTAG_APP_DYNAMIC_BASE = "DYNAMIC_BASE"; - private const string ACTAG_FORCE_CACHE_INSTALL = "FORCE_CACHE_INSTALL"; - private const string ACTAG_APP_PRIVATE_BINPATH = "PRIVATE_BINPATH"; - private const string ACTAG_APP_SHADOW_COPY_DIRS = "SHADOW_COPY_DIRS"; - private const string ACTAG_DISALLOW_APPLYPUBLISHERPOLICY = "DISALLOW_APP"; - private const string ACTAG_CODE_DOWNLOAD_DISABLED = "CODE_DOWNLOAD_DISABLED"; - private const string ACTAG_DISALLOW_APP_BINDING_REDIRECTS = "DISALLOW_APP_REDIRECTS"; - private const string ACTAG_DISALLOW_APP_BASE_PROBING = "DISALLOW_APP_BASE_PROBING"; - private const string ACTAG_APP_CONFIG_BLOB = "APP_CONFIG_BLOB"; // This class has an unmanaged representation so be aware you will need to make edits in vm\object.h if you change the order // of these fields or add new ones. diff --git a/src/pal/prebuilt/inc/fusionpriv.h b/src/pal/prebuilt/inc/fusionpriv.h deleted file mode 100644 index b0bca9e1f4..0000000000 --- a/src/pal/prebuilt/inc/fusionpriv.h +++ /dev/null @@ -1,2919 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - - - -/* 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 __fusionpriv_h__ -#define __fusionpriv_h__ - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -#pragma once -#endif - -/* Forward Declarations */ - -#ifndef __IHistoryAssembly_FWD_DEFINED__ -#define __IHistoryAssembly_FWD_DEFINED__ -typedef interface IHistoryAssembly IHistoryAssembly; - -#endif /* __IHistoryAssembly_FWD_DEFINED__ */ - - -#ifndef __IHistoryReader_FWD_DEFINED__ -#define __IHistoryReader_FWD_DEFINED__ -typedef interface IHistoryReader IHistoryReader; - -#endif /* __IHistoryReader_FWD_DEFINED__ */ - - -#ifndef __IFusionBindLog_FWD_DEFINED__ -#define __IFusionBindLog_FWD_DEFINED__ -typedef interface IFusionBindLog IFusionBindLog; - -#endif /* __IFusionBindLog_FWD_DEFINED__ */ - - -#ifndef __IAssemblyManifestImport_FWD_DEFINED__ -#define __IAssemblyManifestImport_FWD_DEFINED__ -typedef interface IAssemblyManifestImport IAssemblyManifestImport; - -#endif /* __IAssemblyManifestImport_FWD_DEFINED__ */ - - -#ifndef __IApplicationContext_FWD_DEFINED__ -#define __IApplicationContext_FWD_DEFINED__ -typedef interface IApplicationContext IApplicationContext; - -#endif /* __IApplicationContext_FWD_DEFINED__ */ - - -#ifndef __IAssemblyNameBinder_FWD_DEFINED__ -#define __IAssemblyNameBinder_FWD_DEFINED__ -typedef interface IAssemblyNameBinder IAssemblyNameBinder; - -#endif /* __IAssemblyNameBinder_FWD_DEFINED__ */ - - -#ifndef __IAssembly_FWD_DEFINED__ -#define __IAssembly_FWD_DEFINED__ -typedef interface IAssembly IAssembly; - -#endif /* __IAssembly_FWD_DEFINED__ */ - - -#ifndef __IAssemblyBindingClosureEnumerator_FWD_DEFINED__ -#define __IAssemblyBindingClosureEnumerator_FWD_DEFINED__ -typedef interface IAssemblyBindingClosureEnumerator IAssemblyBindingClosureEnumerator; - -#endif /* __IAssemblyBindingClosureEnumerator_FWD_DEFINED__ */ - - -#ifndef __IAssemblyBindingClosure_FWD_DEFINED__ -#define __IAssemblyBindingClosure_FWD_DEFINED__ -typedef interface IAssemblyBindingClosure IAssemblyBindingClosure; - -#endif /* __IAssemblyBindingClosure_FWD_DEFINED__ */ - - -#ifndef __IAssemblyBindSink_FWD_DEFINED__ -#define __IAssemblyBindSink_FWD_DEFINED__ -typedef interface IAssemblyBindSink IAssemblyBindSink; - -#endif /* __IAssemblyBindSink_FWD_DEFINED__ */ - - -#ifndef __IAssemblyBinding_FWD_DEFINED__ -#define __IAssemblyBinding_FWD_DEFINED__ -typedef interface IAssemblyBinding IAssemblyBinding; - -#endif /* __IAssemblyBinding_FWD_DEFINED__ */ - - -#ifndef __IAssemblyModuleImport_FWD_DEFINED__ -#define __IAssemblyModuleImport_FWD_DEFINED__ -typedef interface IAssemblyModuleImport IAssemblyModuleImport; - -#endif /* __IAssemblyModuleImport_FWD_DEFINED__ */ - - -#ifndef __IAssemblyScavenger_FWD_DEFINED__ -#define __IAssemblyScavenger_FWD_DEFINED__ -typedef interface IAssemblyScavenger IAssemblyScavenger; - -#endif /* __IAssemblyScavenger_FWD_DEFINED__ */ - - -#ifndef __ICodebaseList_FWD_DEFINED__ -#define __ICodebaseList_FWD_DEFINED__ -typedef interface ICodebaseList ICodebaseList; - -#endif /* __ICodebaseList_FWD_DEFINED__ */ - - -#ifndef __IDownloadMgr_FWD_DEFINED__ -#define __IDownloadMgr_FWD_DEFINED__ -typedef interface IDownloadMgr IDownloadMgr; - -#endif /* __IDownloadMgr_FWD_DEFINED__ */ - - -#ifndef __IHostAssembly_FWD_DEFINED__ -#define __IHostAssembly_FWD_DEFINED__ -typedef interface IHostAssembly IHostAssembly; - -#endif /* __IHostAssembly_FWD_DEFINED__ */ - - -#ifndef __IHostAssemblyModuleImport_FWD_DEFINED__ -#define __IHostAssemblyModuleImport_FWD_DEFINED__ -typedef interface IHostAssemblyModuleImport IHostAssemblyModuleImport; - -#endif /* __IHostAssemblyModuleImport_FWD_DEFINED__ */ - - -/* header files for imported files */ -#include "objidl.h" -#include "oleidl.h" -#include "fusion.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/* interface __MIDL_itf_fusionpriv_0000_0000 */ -/* [local] */ - -//=--------------------------------------------------------------------------= -// fusionpriv.h -//=--------------------------------------------------------------------------= - -// -// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF -// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A -// PARTICULAR PURPOSE. -//=--------------------------------------------------------------------------= - -#ifdef _MSC_VER -#pragma comment(lib,"uuid.lib") -#endif - -//---------------------------------------------------------------------------= -// Fusion Interfaces. - -#if defined(_CLR_BLD) && !defined(FEATURE_FUSION) -#error FEATURE_FUSION is not enabled, please do not include fusionpriv.h -#endif -#ifdef _MSC_VER -#pragma once -#endif - - - - - - - - - - - - - - -struct IMetaDataAssemblyImport; - -EXTERN_C const IID IID_IApplicationContext; -EXTERN_C const IID IID_IAssembly; -EXTERN_C const IID IID_IAssemblyBindSink; -EXTERN_C const IID IID_IAssemblyBinding; -EXTERN_C const IID IID_IAssemblyManifestImport; -EXTERN_C const IID IID_IAssemblyModuleImport; -EXTERN_C const IID IID_IHistoryAssembly; -EXTERN_C const IID IID_IHistoryReader; -EXTERN_C const IID IID_IMetaDataAssemblyImportControl; -EXTERN_C const IID IID_IAssemblyScavenger; -EXTERN_C const IID IID_IHostAssembly; -EXTERN_C const IID IID_IHostAssemblyModuleImport; -typedef /* [public] */ -enum __MIDL___MIDL_itf_fusionpriv_0000_0000_0001 - { - ASM_BINDF_NONE = 0, - ASM_BINDF_FORCE_CACHE_INSTALL = 0x1, - ASM_BINDF_RFS_INTEGRITY_CHECK = 0x2, - ASM_BINDF_RFS_MODULE_CHECK = 0x4, - ASM_BINDF_BINPATH_PROBE_ONLY = 0x8, - ASM_BINDF_PARENT_ASM_HINT = 0x20, - ASM_BINDF_DISALLOW_APPLYPUBLISHERPOLICY = 0x40, - ASM_BINDF_DISALLOW_APPBINDINGREDIRECTS = 0x80, - ASM_BINDF_DISABLE_FX_UNIFICATION = 0x100, - ASM_BINDF_DO_NOT_PROBE_NATIVE_IMAGE = 0x200, - ASM_BINDF_DISABLE_DOWNLOAD = 0x400, - ASM_BINDF_INSPECTION_ONLY = 0x800, - ASM_BINDF_DISALLOW_APP_BASE_PROBING = 0x1000, - ASM_BINDF_SUPPRESS_SECURITY_CHECKS = 0x2000 - } ASM_BIND_FLAGS; - -typedef -enum tagDEVOVERRIDEMODE - { - DEVOVERRIDE_LOCAL = 0x1, - DEVOVERRIDE_GLOBAL = 0x2 - } DEVOVERRIDEMODE; - -typedef -enum tagWALK_LEVEL - { - LEVEL_STARTING = 0, - LEVEL_WINRTCHECK = ( LEVEL_STARTING + 1 ) , - LEVEL_GACCHECK = ( LEVEL_WINRTCHECK + 1 ) , - LEVEL_COMPLETE = ( LEVEL_GACCHECK + 1 ) , - LEVEL_FXPREDICTED = ( LEVEL_COMPLETE + 1 ) , - LEVEL_FXPROBED = ( LEVEL_FXPREDICTED + 1 ) - } WALK_LEVEL; - - - -extern RPC_IF_HANDLE __MIDL_itf_fusionpriv_0000_0000_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_fusionpriv_0000_0000_v0_0_s_ifspec; - -#ifndef __IHistoryAssembly_INTERFACE_DEFINED__ -#define __IHistoryAssembly_INTERFACE_DEFINED__ - -/* interface IHistoryAssembly */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IHistoryAssembly; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("e6096a07-e188-4a49-8d50-2a0172a0d205") - IHistoryAssembly : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetAssemblyName( - /* [annotation][out] */ - __out LPWSTR wzAsmName, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPublicKeyToken( - /* [annotation][out] */ - __out LPWSTR wzPublicKeyToken, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCulture( - /* [annotation][out] */ - __out LPWSTR wzCulture, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetReferenceVersion( - /* [annotation][out] */ - __out LPWSTR wzVerRef, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetActivationDate( - /* [annotation][out] */ - __out LPWSTR wzActivationDate, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppCfgVersion( - /* [annotation][out] */ - __out LPWSTR pwzVerAppCfg, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPublisherCfgVersion( - /* [annotation][out] */ - __out LPWSTR pwzVerPublisherCfg, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAdminCfgVersion( - /* [annotation][out] */ - __out LPWSTR pwzAdminCfg, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IHistoryAssemblyVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IHistoryAssembly * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IHistoryAssembly * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IHistoryAssembly * This); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyName )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR wzAsmName, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetPublicKeyToken )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR wzPublicKeyToken, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetCulture )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR wzCulture, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetReferenceVersion )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR wzVerRef, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetActivationDate )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR wzActivationDate, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetAppCfgVersion )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR pwzVerAppCfg, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetPublisherCfgVersion )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR pwzVerPublisherCfg, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetAdminCfgVersion )( - IHistoryAssembly * This, - /* [annotation][out] */ - __out LPWSTR pwzAdminCfg, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - END_INTERFACE - } IHistoryAssemblyVtbl; - - interface IHistoryAssembly - { - CONST_VTBL struct IHistoryAssemblyVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IHistoryAssembly_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IHistoryAssembly_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IHistoryAssembly_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IHistoryAssembly_GetAssemblyName(This,wzAsmName,pdwSize) \ - ( (This)->lpVtbl -> GetAssemblyName(This,wzAsmName,pdwSize) ) - -#define IHistoryAssembly_GetPublicKeyToken(This,wzPublicKeyToken,pdwSize) \ - ( (This)->lpVtbl -> GetPublicKeyToken(This,wzPublicKeyToken,pdwSize) ) - -#define IHistoryAssembly_GetCulture(This,wzCulture,pdwSize) \ - ( (This)->lpVtbl -> GetCulture(This,wzCulture,pdwSize) ) - -#define IHistoryAssembly_GetReferenceVersion(This,wzVerRef,pdwSize) \ - ( (This)->lpVtbl -> GetReferenceVersion(This,wzVerRef,pdwSize) ) - -#define IHistoryAssembly_GetActivationDate(This,wzActivationDate,pdwSize) \ - ( (This)->lpVtbl -> GetActivationDate(This,wzActivationDate,pdwSize) ) - -#define IHistoryAssembly_GetAppCfgVersion(This,pwzVerAppCfg,pdwSize) \ - ( (This)->lpVtbl -> GetAppCfgVersion(This,pwzVerAppCfg,pdwSize) ) - -#define IHistoryAssembly_GetPublisherCfgVersion(This,pwzVerPublisherCfg,pdwSize) \ - ( (This)->lpVtbl -> GetPublisherCfgVersion(This,pwzVerPublisherCfg,pdwSize) ) - -#define IHistoryAssembly_GetAdminCfgVersion(This,pwzAdminCfg,pdwSize) \ - ( (This)->lpVtbl -> GetAdminCfgVersion(This,pwzAdminCfg,pdwSize) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IHistoryAssembly_INTERFACE_DEFINED__ */ - - -#ifndef __IHistoryReader_INTERFACE_DEFINED__ -#define __IHistoryReader_INTERFACE_DEFINED__ - -/* interface IHistoryReader */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IHistoryReader; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("1d23df4d-a1e2-4b8b-93d6-6ea3dc285a54") - IHistoryReader : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetFilePath( - /* [annotation][out] */ - __out LPWSTR wzFilePath, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetApplicationName( - /* [annotation][out] */ - __out LPWSTR wzAppName, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetEXEModulePath( - /* [annotation][out] */ - __out LPWSTR wzExePath, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNumActivations( - /* [out] */ DWORD *pdwNumActivations) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetActivationDate( - /* [in] */ DWORD dwIdx, - /* [out] */ FILETIME *pftDate) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRunTimeVersion( - /* [in] */ FILETIME *pftActivationDate, - /* [annotation][out] */ - __out LPWSTR wzRunTimeVersion, - /* [annotation][out][in] */ - __inout DWORD *pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNumAssemblies( - /* [in] */ FILETIME *pftActivationDate, - /* [out] */ DWORD *pdwNumAsms) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHistoryAssembly( - /* [in] */ FILETIME *pftActivationDate, - /* [in] */ DWORD dwIdx, - /* [out] */ IHistoryAssembly **ppHistAsm) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IHistoryReaderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IHistoryReader * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IHistoryReader * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IHistoryReader * This); - - HRESULT ( STDMETHODCALLTYPE *GetFilePath )( - IHistoryReader * This, - /* [annotation][out] */ - __out LPWSTR wzFilePath, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetApplicationName )( - IHistoryReader * This, - /* [annotation][out] */ - __out LPWSTR wzAppName, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetEXEModulePath )( - IHistoryReader * This, - /* [annotation][out] */ - __out LPWSTR wzExePath, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetNumActivations )( - IHistoryReader * This, - /* [out] */ DWORD *pdwNumActivations); - - HRESULT ( STDMETHODCALLTYPE *GetActivationDate )( - IHistoryReader * This, - /* [in] */ DWORD dwIdx, - /* [out] */ FILETIME *pftDate); - - HRESULT ( STDMETHODCALLTYPE *GetRunTimeVersion )( - IHistoryReader * This, - /* [in] */ FILETIME *pftActivationDate, - /* [annotation][out] */ - __out LPWSTR wzRunTimeVersion, - /* [annotation][out][in] */ - __inout DWORD *pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetNumAssemblies )( - IHistoryReader * This, - /* [in] */ FILETIME *pftActivationDate, - /* [out] */ DWORD *pdwNumAsms); - - HRESULT ( STDMETHODCALLTYPE *GetHistoryAssembly )( - IHistoryReader * This, - /* [in] */ FILETIME *pftActivationDate, - /* [in] */ DWORD dwIdx, - /* [out] */ IHistoryAssembly **ppHistAsm); - - END_INTERFACE - } IHistoryReaderVtbl; - - interface IHistoryReader - { - CONST_VTBL struct IHistoryReaderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IHistoryReader_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IHistoryReader_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IHistoryReader_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IHistoryReader_GetFilePath(This,wzFilePath,pdwSize) \ - ( (This)->lpVtbl -> GetFilePath(This,wzFilePath,pdwSize) ) - -#define IHistoryReader_GetApplicationName(This,wzAppName,pdwSize) \ - ( (This)->lpVtbl -> GetApplicationName(This,wzAppName,pdwSize) ) - -#define IHistoryReader_GetEXEModulePath(This,wzExePath,pdwSize) \ - ( (This)->lpVtbl -> GetEXEModulePath(This,wzExePath,pdwSize) ) - -#define IHistoryReader_GetNumActivations(This,pdwNumActivations) \ - ( (This)->lpVtbl -> GetNumActivations(This,pdwNumActivations) ) - -#define IHistoryReader_GetActivationDate(This,dwIdx,pftDate) \ - ( (This)->lpVtbl -> GetActivationDate(This,dwIdx,pftDate) ) - -#define IHistoryReader_GetRunTimeVersion(This,pftActivationDate,wzRunTimeVersion,pdwSize) \ - ( (This)->lpVtbl -> GetRunTimeVersion(This,pftActivationDate,wzRunTimeVersion,pdwSize) ) - -#define IHistoryReader_GetNumAssemblies(This,pftActivationDate,pdwNumAsms) \ - ( (This)->lpVtbl -> GetNumAssemblies(This,pftActivationDate,pdwNumAsms) ) - -#define IHistoryReader_GetHistoryAssembly(This,pftActivationDate,dwIdx,ppHistAsm) \ - ( (This)->lpVtbl -> GetHistoryAssembly(This,pftActivationDate,dwIdx,ppHistAsm) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IHistoryReader_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_fusionpriv_0000_0002 */ -/* [local] */ - -typedef /* [public][public][public] */ -enum __MIDL___MIDL_itf_fusionpriv_0000_0002_0001 - { - LOADCTX_TYPE_DEFAULT = 0, - LOADCTX_TYPE_LOADFROM = ( LOADCTX_TYPE_DEFAULT + 1 ) , - LOADCTX_TYPE_UNKNOWN = ( LOADCTX_TYPE_LOADFROM + 1 ) , - LOADCTX_TYPE_HOSTED = ( LOADCTX_TYPE_UNKNOWN + 1 ) - } LOADCTX_TYPE; - -#define FUSION_BIND_LOG_CATEGORY_DEFAULT 0 -#define FUSION_BIND_LOG_CATEGORY_NGEN 1 -#define FUSION_BIND_LOG_CATEGORY_MAX 2 - - -extern RPC_IF_HANDLE __MIDL_itf_fusionpriv_0000_0002_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_fusionpriv_0000_0002_v0_0_s_ifspec; - -#ifndef __IFusionBindLog_INTERFACE_DEFINED__ -#define __IFusionBindLog_INTERFACE_DEFINED__ - -/* interface IFusionBindLog */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IFusionBindLog; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("67E9F87D-8B8A-4a90-9D3E-85ED5B2DCC83") - IFusionBindLog : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetResultCode( - /* [in] */ DWORD dwLogCategory, - /* [in] */ HRESULT hr) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetResultCode( - /* [in] */ DWORD dwLogCategory, - /* [out] */ HRESULT *pHr) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBindLog( - /* [in] */ DWORD dwDetailLevel, - /* [in] */ DWORD dwLogCategory, - /* [annotation][out] */ - __out_opt LPWSTR pwzDebugLog, - /* [annotation][out][in] */ - __inout DWORD *pcbDebugLog) = 0; - - virtual HRESULT STDMETHODCALLTYPE LogMessage( - /* [in] */ DWORD dwDetailLevel, - /* [in] */ DWORD dwLogCategory, - /* [in] */ LPCWSTR pwzDebugLog) = 0; - - virtual HRESULT STDMETHODCALLTYPE Flush( - /* [in] */ DWORD dwDetailLevel, - /* [in] */ DWORD dwLogCategory) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBindingID( - /* [out] */ ULONGLONG *pullBindingID) = 0; - - virtual HRESULT STDMETHODCALLTYPE ETWTraceLogMessage( - /* [in] */ DWORD dwETWLogCategory, - /* [in] */ IAssemblyName *pAsm) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IFusionBindLogVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IFusionBindLog * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IFusionBindLog * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IFusionBindLog * This); - - HRESULT ( STDMETHODCALLTYPE *SetResultCode )( - IFusionBindLog * This, - /* [in] */ DWORD dwLogCategory, - /* [in] */ HRESULT hr); - - HRESULT ( STDMETHODCALLTYPE *GetResultCode )( - IFusionBindLog * This, - /* [in] */ DWORD dwLogCategory, - /* [out] */ HRESULT *pHr); - - HRESULT ( STDMETHODCALLTYPE *GetBindLog )( - IFusionBindLog * This, - /* [in] */ DWORD dwDetailLevel, - /* [in] */ DWORD dwLogCategory, - /* [annotation][out] */ - __out_opt LPWSTR pwzDebugLog, - /* [annotation][out][in] */ - __inout DWORD *pcbDebugLog); - - HRESULT ( STDMETHODCALLTYPE *LogMessage )( - IFusionBindLog * This, - /* [in] */ DWORD dwDetailLevel, - /* [in] */ DWORD dwLogCategory, - /* [in] */ LPCWSTR pwzDebugLog); - - HRESULT ( STDMETHODCALLTYPE *Flush )( - IFusionBindLog * This, - /* [in] */ DWORD dwDetailLevel, - /* [in] */ DWORD dwLogCategory); - - HRESULT ( STDMETHODCALLTYPE *GetBindingID )( - IFusionBindLog * This, - /* [out] */ ULONGLONG *pullBindingID); - - HRESULT ( STDMETHODCALLTYPE *ETWTraceLogMessage )( - IFusionBindLog * This, - /* [in] */ DWORD dwETWLogCategory, - /* [in] */ IAssemblyName *pAsm); - - END_INTERFACE - } IFusionBindLogVtbl; - - interface IFusionBindLog - { - CONST_VTBL struct IFusionBindLogVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IFusionBindLog_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IFusionBindLog_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IFusionBindLog_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IFusionBindLog_SetResultCode(This,dwLogCategory,hr) \ - ( (This)->lpVtbl -> SetResultCode(This,dwLogCategory,hr) ) - -#define IFusionBindLog_GetResultCode(This,dwLogCategory,pHr) \ - ( (This)->lpVtbl -> GetResultCode(This,dwLogCategory,pHr) ) - -#define IFusionBindLog_GetBindLog(This,dwDetailLevel,dwLogCategory,pwzDebugLog,pcbDebugLog) \ - ( (This)->lpVtbl -> GetBindLog(This,dwDetailLevel,dwLogCategory,pwzDebugLog,pcbDebugLog) ) - -#define IFusionBindLog_LogMessage(This,dwDetailLevel,dwLogCategory,pwzDebugLog) \ - ( (This)->lpVtbl -> LogMessage(This,dwDetailLevel,dwLogCategory,pwzDebugLog) ) - -#define IFusionBindLog_Flush(This,dwDetailLevel,dwLogCategory) \ - ( (This)->lpVtbl -> Flush(This,dwDetailLevel,dwLogCategory) ) - -#define IFusionBindLog_GetBindingID(This,pullBindingID) \ - ( (This)->lpVtbl -> GetBindingID(This,pullBindingID) ) - -#define IFusionBindLog_ETWTraceLogMessage(This,dwETWLogCategory,pAsm) \ - ( (This)->lpVtbl -> ETWTraceLogMessage(This,dwETWLogCategory,pAsm) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IFusionBindLog_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyManifestImport_INTERFACE_DEFINED__ -#define __IAssemblyManifestImport_INTERFACE_DEFINED__ - -/* interface IAssemblyManifestImport */ -/* [unique][uuid][object][local] */ - -typedef /* [unique] */ IAssemblyManifestImport *LPASSEMBLY_MANIFEST_IMPORT; - - -EXTERN_C const IID IID_IAssemblyManifestImport; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("de9a68ba-0fa2-11d3-94aa-00c04fc308ff") - IAssemblyManifestImport : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetAssemblyNameDef( - /* [out] */ IAssemblyName **ppAssemblyName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextAssemblyNameRef( - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyName **ppAssemblyName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextAssemblyModule( - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyModuleImport **ppImport) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleByName( - /* [in] */ LPCOLESTR szModuleName, - /* [out] */ IAssemblyModuleImport **ppModImport) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetManifestModulePath( - /* [annotation][size_is][out] */ - __out_ecount_full(*pccModulePath) LPOLESTR szModulePath, - /* [out][in] */ LPDWORD pccModulePath) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInternalMDImport( - /* [out] */ IMetaDataAssemblyImport **ppMDImport) = 0; - - virtual HRESULT STDMETHODCALLTYPE LoadDataFromMDImport( - /* [in] */ IMetaDataAssemblyImport *ppMDImport) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyManifestImportVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyManifestImport * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyManifestImport * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyManifestImport * This); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyNameDef )( - IAssemblyManifestImport * This, - /* [out] */ IAssemblyName **ppAssemblyName); - - HRESULT ( STDMETHODCALLTYPE *GetNextAssemblyNameRef )( - IAssemblyManifestImport * This, - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyName **ppAssemblyName); - - HRESULT ( STDMETHODCALLTYPE *GetNextAssemblyModule )( - IAssemblyManifestImport * This, - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyModuleImport **ppImport); - - HRESULT ( STDMETHODCALLTYPE *GetModuleByName )( - IAssemblyManifestImport * This, - /* [in] */ LPCOLESTR szModuleName, - /* [out] */ IAssemblyModuleImport **ppModImport); - - HRESULT ( STDMETHODCALLTYPE *GetManifestModulePath )( - IAssemblyManifestImport * This, - /* [annotation][size_is][out] */ - __out_ecount_full(*pccModulePath) LPOLESTR szModulePath, - /* [out][in] */ LPDWORD pccModulePath); - - HRESULT ( STDMETHODCALLTYPE *GetInternalMDImport )( - IAssemblyManifestImport * This, - /* [out] */ IMetaDataAssemblyImport **ppMDImport); - - HRESULT ( STDMETHODCALLTYPE *LoadDataFromMDImport )( - IAssemblyManifestImport * This, - /* [in] */ IMetaDataAssemblyImport *ppMDImport); - - END_INTERFACE - } IAssemblyManifestImportVtbl; - - interface IAssemblyManifestImport - { - CONST_VTBL struct IAssemblyManifestImportVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyManifestImport_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyManifestImport_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyManifestImport_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyManifestImport_GetAssemblyNameDef(This,ppAssemblyName) \ - ( (This)->lpVtbl -> GetAssemblyNameDef(This,ppAssemblyName) ) - -#define IAssemblyManifestImport_GetNextAssemblyNameRef(This,nIndex,ppAssemblyName) \ - ( (This)->lpVtbl -> GetNextAssemblyNameRef(This,nIndex,ppAssemblyName) ) - -#define IAssemblyManifestImport_GetNextAssemblyModule(This,nIndex,ppImport) \ - ( (This)->lpVtbl -> GetNextAssemblyModule(This,nIndex,ppImport) ) - -#define IAssemblyManifestImport_GetModuleByName(This,szModuleName,ppModImport) \ - ( (This)->lpVtbl -> GetModuleByName(This,szModuleName,ppModImport) ) - -#define IAssemblyManifestImport_GetManifestModulePath(This,szModulePath,pccModulePath) \ - ( (This)->lpVtbl -> GetManifestModulePath(This,szModulePath,pccModulePath) ) - -#define IAssemblyManifestImport_GetInternalMDImport(This,ppMDImport) \ - ( (This)->lpVtbl -> GetInternalMDImport(This,ppMDImport) ) - -#define IAssemblyManifestImport_LoadDataFromMDImport(This,ppMDImport) \ - ( (This)->lpVtbl -> LoadDataFromMDImport(This,ppMDImport) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyManifestImport_INTERFACE_DEFINED__ */ - - -#ifndef __IApplicationContext_INTERFACE_DEFINED__ -#define __IApplicationContext_INTERFACE_DEFINED__ - -/* interface IApplicationContext */ -/* [unique][uuid][object][local] */ - -// App context configuration variables -#define ACTAG_APP_BASE_URL L"APPBASE" -#define ACTAG_MACHINE_CONFIG L"MACHINE_CONFIG" -#define ACTAG_APP_PRIVATE_BINPATH L"PRIVATE_BINPATH" -#define ACTAG_APP_SHARED_BINPATH L"SHARED_BINPATH" -#define ACTAG_APP_SNAPSHOT_ID L"SNAPSHOT_ID" -#define ACTAG_APP_CONFIG_FILE L"APP_CONFIG_FILE" -#define ACTAG_APP_ID L"APPLICATION_ID" -#define ACTAG_APP_SHADOW_COPY_DIRS L"SHADOW_COPY_DIRS" -#define ACTAG_APP_DYNAMIC_BASE L"DYNAMIC_BASE" -#define ACTAG_APP_CACHE_BASE L"CACHE_BASE" -#define ACTAG_APP_NAME L"APP_NAME" -#define ACTAG_DEV_PATH L"DEV_PATH" -#define ACTAG_HOST_CONFIG_FILE L"HOST_CONFIG" -#define ACTAG_SXS_ACTIVATION_CONTEXT L"SXS" -#define ACTAG_APP_CFG_LOCAL_FILEPATH L"APP_CFG_LOCAL_FILEPATH" -#define ACTAG_ZAP_STRING L"ZAP_STRING" -#define ACTAG_ZAP_CONFIG_FLAGS L"ZAP_CONFIG_FLAGS" -#define ACTAG_APP_DOMAIN_ID L"APPDOMAIN_ID" -#define ACTAG_APP_CONFIG_BLOB L"APP_CONFIG_BLOB" -#define ACTAG_FX_ONLY L"FX_ONLY" -// App context flag overrides -#define ACTAG_FORCE_CACHE_INSTALL L"FORCE_CACHE_INSTALL" -#define ACTAG_RFS_INTEGRITY_CHECK L"RFS_INTEGRITY_CHECK" -#define ACTAG_RFS_MODULE_CHECK L"RFS_MODULE_CHECK" -#define ACTAG_BINPATH_PROBE_ONLY L"BINPATH_PROBE_ONLY" -#define ACTAG_DISALLOW_APPLYPUBLISHERPOLICY L"DISALLOW_APP" -#define ACTAG_DISALLOW_APP_BINDING_REDIRECTS L"DISALLOW_APP_REDIRECTS" -#define ACTAG_DISALLOW_APP_BASE_PROBING L"DISALLOW_APP_BASE_PROBING" -#define ACTAG_CODE_DOWNLOAD_DISABLED L"CODE_DOWNLOAD_DISABLED" -#define ACTAG_DISABLE_FX_ASM_UNIFICATION L"DISABLE_FX_ASM_UNIFICATION" -typedef /* [unique] */ IApplicationContext *LPAPPLICATIONCONTEXT; - -typedef /* [public] */ -enum __MIDL_IApplicationContext_0001 - { - APP_CTX_FLAGS_INTERFACE = 0x1 - } APP_FLAGS; - - -EXTERN_C const IID IID_IApplicationContext; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("7c23ff90-33af-11d3-95da-00a024a85b51") - IApplicationContext : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE SetContextNameObject( - /* [in] */ LPASSEMBLYNAME pName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetContextNameObject( - /* [out] */ LPASSEMBLYNAME *ppName) = 0; - - virtual HRESULT STDMETHODCALLTYPE Set( - /* [in] */ LPCOLESTR szName, - /* [in] */ LPVOID pvValue, - /* [in] */ DWORD cbValue, - /* [in] */ DWORD dwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE Get( - /* [in] */ LPCOLESTR szName, - /* [out] */ LPVOID pvValue, - /* [out][in] */ LPDWORD pcbValue, - /* [in] */ DWORD dwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDynamicDirectory( - /* [annotation][out] */ - __out_ecount_opt(*pdwSize) LPWSTR wzDynamicDir, - /* [out][in] */ LPDWORD pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAppCacheDirectory( - /* [annotation][out] */ - __out_ecount_opt(*pdwSize) LPWSTR wzAppCacheDir, - /* [out][in] */ LPDWORD pdwSize) = 0; - - virtual HRESULT STDMETHODCALLTYPE RegisterKnownAssembly( - /* [in] */ IAssemblyName *pName, - /* [in] */ LPCWSTR pwzAsmURL, - /* [out] */ IAssembly **ppAsmOut) = 0; - - virtual HRESULT STDMETHODCALLTYPE PrefetchAppConfigFile( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyBindingClosure( - /* [in] */ IUnknown *pUnk, - /* [in] */ LPCWSTR pwzNativeImagePath, - /* [out] */ IAssemblyBindingClosure **ppAsmClosure) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IApplicationContextVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IApplicationContext * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IApplicationContext * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IApplicationContext * This); - - HRESULT ( STDMETHODCALLTYPE *SetContextNameObject )( - IApplicationContext * This, - /* [in] */ LPASSEMBLYNAME pName); - - HRESULT ( STDMETHODCALLTYPE *GetContextNameObject )( - IApplicationContext * This, - /* [out] */ LPASSEMBLYNAME *ppName); - - HRESULT ( STDMETHODCALLTYPE *Set )( - IApplicationContext * This, - /* [in] */ LPCOLESTR szName, - /* [in] */ LPVOID pvValue, - /* [in] */ DWORD cbValue, - /* [in] */ DWORD dwFlags); - - HRESULT ( STDMETHODCALLTYPE *Get )( - IApplicationContext * This, - /* [in] */ LPCOLESTR szName, - /* [out] */ LPVOID pvValue, - /* [out][in] */ LPDWORD pcbValue, - /* [in] */ DWORD dwFlags); - - HRESULT ( STDMETHODCALLTYPE *GetDynamicDirectory )( - IApplicationContext * This, - /* [annotation][out] */ - __out_ecount_opt(*pdwSize) LPWSTR wzDynamicDir, - /* [out][in] */ LPDWORD pdwSize); - - HRESULT ( STDMETHODCALLTYPE *GetAppCacheDirectory )( - IApplicationContext * This, - /* [annotation][out] */ - __out_ecount_opt(*pdwSize) LPWSTR wzAppCacheDir, - /* [out][in] */ LPDWORD pdwSize); - - HRESULT ( STDMETHODCALLTYPE *RegisterKnownAssembly )( - IApplicationContext * This, - /* [in] */ IAssemblyName *pName, - /* [in] */ LPCWSTR pwzAsmURL, - /* [out] */ IAssembly **ppAsmOut); - - HRESULT ( STDMETHODCALLTYPE *PrefetchAppConfigFile )( - IApplicationContext * This); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyBindingClosure )( - IApplicationContext * This, - /* [in] */ IUnknown *pUnk, - /* [in] */ LPCWSTR pwzNativeImagePath, - /* [out] */ IAssemblyBindingClosure **ppAsmClosure); - - END_INTERFACE - } IApplicationContextVtbl; - - interface IApplicationContext - { - CONST_VTBL struct IApplicationContextVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IApplicationContext_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IApplicationContext_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IApplicationContext_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IApplicationContext_SetContextNameObject(This,pName) \ - ( (This)->lpVtbl -> SetContextNameObject(This,pName) ) - -#define IApplicationContext_GetContextNameObject(This,ppName) \ - ( (This)->lpVtbl -> GetContextNameObject(This,ppName) ) - -#define IApplicationContext_Set(This,szName,pvValue,cbValue,dwFlags) \ - ( (This)->lpVtbl -> Set(This,szName,pvValue,cbValue,dwFlags) ) - -#define IApplicationContext_Get(This,szName,pvValue,pcbValue,dwFlags) \ - ( (This)->lpVtbl -> Get(This,szName,pvValue,pcbValue,dwFlags) ) - -#define IApplicationContext_GetDynamicDirectory(This,wzDynamicDir,pdwSize) \ - ( (This)->lpVtbl -> GetDynamicDirectory(This,wzDynamicDir,pdwSize) ) - -#define IApplicationContext_GetAppCacheDirectory(This,wzAppCacheDir,pdwSize) \ - ( (This)->lpVtbl -> GetAppCacheDirectory(This,wzAppCacheDir,pdwSize) ) - -#define IApplicationContext_RegisterKnownAssembly(This,pName,pwzAsmURL,ppAsmOut) \ - ( (This)->lpVtbl -> RegisterKnownAssembly(This,pName,pwzAsmURL,ppAsmOut) ) - -#define IApplicationContext_PrefetchAppConfigFile(This) \ - ( (This)->lpVtbl -> PrefetchAppConfigFile(This) ) - -#define IApplicationContext_GetAssemblyBindingClosure(This,pUnk,pwzNativeImagePath,ppAsmClosure) \ - ( (This)->lpVtbl -> GetAssemblyBindingClosure(This,pUnk,pwzNativeImagePath,ppAsmClosure) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IApplicationContext_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyNameBinder_INTERFACE_DEFINED__ -#define __IAssemblyNameBinder_INTERFACE_DEFINED__ - -/* interface IAssemblyNameBinder */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IAssemblyNameBinder; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("56972d9d-0f6c-47de-a038-e82d5de3a777") - IAssemblyNameBinder : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE BindToObject( - /* [in] */ REFIID refIID, - /* [in] */ IUnknown *pUnkSink, - /* [in] */ IUnknown *pUnkContext, - /* [in] */ LPCOLESTR szCodeBase, - /* [in] */ LONGLONG llFlags, - /* [in] */ LPVOID pParentAssembly, - /* [in] */ DWORD cbReserved, - /* [out] */ LPVOID *ppv, - /* [out] */ LPVOID *ppvNI) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyNameBinderVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyNameBinder * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyNameBinder * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyNameBinder * This); - - HRESULT ( STDMETHODCALLTYPE *BindToObject )( - IAssemblyNameBinder * This, - /* [in] */ REFIID refIID, - /* [in] */ IUnknown *pUnkSink, - /* [in] */ IUnknown *pUnkContext, - /* [in] */ LPCOLESTR szCodeBase, - /* [in] */ LONGLONG llFlags, - /* [in] */ LPVOID pParentAssembly, - /* [in] */ DWORD cbReserved, - /* [out] */ LPVOID *ppv, - /* [out] */ LPVOID *ppvNI); - - END_INTERFACE - } IAssemblyNameBinderVtbl; - - interface IAssemblyNameBinder - { - CONST_VTBL struct IAssemblyNameBinderVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyNameBinder_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyNameBinder_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyNameBinder_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyNameBinder_BindToObject(This,refIID,pUnkSink,pUnkContext,szCodeBase,llFlags,pParentAssembly,cbReserved,ppv,ppvNI) \ - ( (This)->lpVtbl -> BindToObject(This,refIID,pUnkSink,pUnkContext,szCodeBase,llFlags,pParentAssembly,cbReserved,ppv,ppvNI) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyNameBinder_INTERFACE_DEFINED__ */ - - -#ifndef __IAssembly_INTERFACE_DEFINED__ -#define __IAssembly_INTERFACE_DEFINED__ - -/* interface IAssembly */ -/* [unique][uuid][object][local] */ - -typedef /* [unique] */ IAssembly *LPASSEMBLY; - -#define ASMLOC_LOCATION_MASK 0x0000001B -#define ASMLOC_UNKNOWN 0x00000000 -#define ASMLOC_GAC 0x00000001 -#define ASMLOC_DOWNLOAD_CACHE 0x00000002 -#define ASMLOC_RUN_FROM_SOURCE 0x00000003 -#define ASMLOC_CODEBASE_HINT 0x00000004 -#define ASMLOC_ZAP 0x00000008 -#define ASMLOC_DEV_OVERRIDE 0x00000010 - -EXTERN_C const IID IID_IAssembly; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("ff08d7d4-04c2-11d3-94aa-00c04fc308ff") - IAssembly : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetAssemblyNameDef( - /* [out] */ IAssemblyName **ppAssemblyName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextAssemblyNameRef( - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyName **ppAssemblyName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextAssemblyModule( - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyModuleImport **ppModImport) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleByName( - /* [in] */ LPCOLESTR szModuleName, - /* [out] */ IAssemblyModuleImport **ppModImport) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetManifestModulePath( - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*pccModulePath) LPOLESTR szModulePath, - /* [out][in] */ LPDWORD pccModulePath) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyPath( - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*lpcwBuffer) LPOLESTR pStr, - /* [out][in] */ LPDWORD lpcwBuffer) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation( - /* [out] */ DWORD *pdwAsmLocation) = 0; - - virtual LOADCTX_TYPE STDMETHODCALLTYPE GetFusionLoadContext( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextHardBoundDependency( - /* [in] */ DWORD dwIndex, - /* [out] */ IAssembly **ppILAsm, - /* [out] */ IAssembly **ppNIAsm) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssembly * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssembly * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssembly * This); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyNameDef )( - IAssembly * This, - /* [out] */ IAssemblyName **ppAssemblyName); - - HRESULT ( STDMETHODCALLTYPE *GetNextAssemblyNameRef )( - IAssembly * This, - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyName **ppAssemblyName); - - HRESULT ( STDMETHODCALLTYPE *GetNextAssemblyModule )( - IAssembly * This, - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyModuleImport **ppModImport); - - HRESULT ( STDMETHODCALLTYPE *GetModuleByName )( - IAssembly * This, - /* [in] */ LPCOLESTR szModuleName, - /* [out] */ IAssemblyModuleImport **ppModImport); - - HRESULT ( STDMETHODCALLTYPE *GetManifestModulePath )( - IAssembly * This, - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*pccModulePath) LPOLESTR szModulePath, - /* [out][in] */ LPDWORD pccModulePath); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyPath )( - IAssembly * This, - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*lpcwBuffer) LPOLESTR pStr, - /* [out][in] */ LPDWORD lpcwBuffer); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyLocation )( - IAssembly * This, - /* [out] */ DWORD *pdwAsmLocation); - - LOADCTX_TYPE ( STDMETHODCALLTYPE *GetFusionLoadContext )( - IAssembly * This); - - HRESULT ( STDMETHODCALLTYPE *GetNextHardBoundDependency )( - IAssembly * This, - /* [in] */ DWORD dwIndex, - /* [out] */ IAssembly **ppILAsm, - /* [out] */ IAssembly **ppNIAsm); - - END_INTERFACE - } IAssemblyVtbl; - - interface IAssembly - { - CONST_VTBL struct IAssemblyVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssembly_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssembly_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssembly_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssembly_GetAssemblyNameDef(This,ppAssemblyName) \ - ( (This)->lpVtbl -> GetAssemblyNameDef(This,ppAssemblyName) ) - -#define IAssembly_GetNextAssemblyNameRef(This,nIndex,ppAssemblyName) \ - ( (This)->lpVtbl -> GetNextAssemblyNameRef(This,nIndex,ppAssemblyName) ) - -#define IAssembly_GetNextAssemblyModule(This,nIndex,ppModImport) \ - ( (This)->lpVtbl -> GetNextAssemblyModule(This,nIndex,ppModImport) ) - -#define IAssembly_GetModuleByName(This,szModuleName,ppModImport) \ - ( (This)->lpVtbl -> GetModuleByName(This,szModuleName,ppModImport) ) - -#define IAssembly_GetManifestModulePath(This,szModulePath,pccModulePath) \ - ( (This)->lpVtbl -> GetManifestModulePath(This,szModulePath,pccModulePath) ) - -#define IAssembly_GetAssemblyPath(This,pStr,lpcwBuffer) \ - ( (This)->lpVtbl -> GetAssemblyPath(This,pStr,lpcwBuffer) ) - -#define IAssembly_GetAssemblyLocation(This,pdwAsmLocation) \ - ( (This)->lpVtbl -> GetAssemblyLocation(This,pdwAsmLocation) ) - -#define IAssembly_GetFusionLoadContext(This) \ - ( (This)->lpVtbl -> GetFusionLoadContext(This) ) - -#define IAssembly_GetNextHardBoundDependency(This,dwIndex,ppILAsm,ppNIAsm) \ - ( (This)->lpVtbl -> GetNextHardBoundDependency(This,dwIndex,ppILAsm,ppNIAsm) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssembly_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyBindingClosureEnumerator_INTERFACE_DEFINED__ -#define __IAssemblyBindingClosureEnumerator_INTERFACE_DEFINED__ - -/* interface IAssemblyBindingClosureEnumerator */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IAssemblyBindingClosureEnumerator; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("b3f1e4ed-cb09-4b85-9a1b-6809582f1ebc") - IAssemblyBindingClosureEnumerator : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetNextAssemblyPath( - /* [out] */ LPCOLESTR *ppPath, - /* [out] */ LPCOLESTR *ppniPath) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyBindingClosureEnumeratorVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyBindingClosureEnumerator * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyBindingClosureEnumerator * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyBindingClosureEnumerator * This); - - HRESULT ( STDMETHODCALLTYPE *GetNextAssemblyPath )( - IAssemblyBindingClosureEnumerator * This, - /* [out] */ LPCOLESTR *ppPath, - /* [out] */ LPCOLESTR *ppniPath); - - END_INTERFACE - } IAssemblyBindingClosureEnumeratorVtbl; - - interface IAssemblyBindingClosureEnumerator - { - CONST_VTBL struct IAssemblyBindingClosureEnumeratorVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyBindingClosureEnumerator_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyBindingClosureEnumerator_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyBindingClosureEnumerator_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyBindingClosureEnumerator_GetNextAssemblyPath(This,ppPath,ppniPath) \ - ( (This)->lpVtbl -> GetNextAssemblyPath(This,ppPath,ppniPath) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyBindingClosureEnumerator_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyBindingClosure_INTERFACE_DEFINED__ -#define __IAssemblyBindingClosure_INTERFACE_DEFINED__ - -/* interface IAssemblyBindingClosure */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IAssemblyBindingClosure; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("415c226a-e513-41ba-9651-9c48e97aa5de") - IAssemblyBindingClosure : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE IsAllAssembliesInGAC( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsEqual( - /* [in] */ IAssemblyBindingClosure *pAssemblyClosure) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextFailureAssembly( - /* [in] */ DWORD dwIndex, - /* [out] */ IAssemblyName **ppName, - /* [out] */ HRESULT *pHResult) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnsureWalked( - /* [in] */ IUnknown *pStartingAssembly, - /* [in] */ IApplicationContext *pAppCtx, - /* [in] */ WALK_LEVEL level) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnumerateAssemblies( - /* [out] */ IAssemblyBindingClosureEnumerator **ppEnumerator) = 0; - - virtual HRESULT STDMETHODCALLTYPE HasBeenWalked( - /* [in] */ WALK_LEVEL level) = 0; - - virtual HRESULT STDMETHODCALLTYPE MayHaveUnknownDependencies( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddProfilerAssemblyReference( - /* [in] */ LPVOID pbPublicKeyOrToken, - /* [in] */ ULONG cbPublicKeyOrToken, - /* [in] */ LPCWSTR szName, - /* [in] */ LPVOID pMetaData, - /* [in] */ void *pbHashValue, - /* [in] */ ULONG cbHashValue, - /* [in] */ DWORD dwAssemblyRefFlags, - /* [in] */ struct AssemblyReferenceClosureWalkContextForProfAPI *pContext) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyBindingClosureVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyBindingClosure * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyBindingClosure * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyBindingClosure * This); - - HRESULT ( STDMETHODCALLTYPE *IsAllAssembliesInGAC )( - IAssemblyBindingClosure * This); - - HRESULT ( STDMETHODCALLTYPE *IsEqual )( - IAssemblyBindingClosure * This, - /* [in] */ IAssemblyBindingClosure *pAssemblyClosure); - - HRESULT ( STDMETHODCALLTYPE *GetNextFailureAssembly )( - IAssemblyBindingClosure * This, - /* [in] */ DWORD dwIndex, - /* [out] */ IAssemblyName **ppName, - /* [out] */ HRESULT *pHResult); - - HRESULT ( STDMETHODCALLTYPE *EnsureWalked )( - IAssemblyBindingClosure * This, - /* [in] */ IUnknown *pStartingAssembly, - /* [in] */ IApplicationContext *pAppCtx, - /* [in] */ WALK_LEVEL level); - - HRESULT ( STDMETHODCALLTYPE *EnumerateAssemblies )( - IAssemblyBindingClosure * This, - /* [out] */ IAssemblyBindingClosureEnumerator **ppEnumerator); - - HRESULT ( STDMETHODCALLTYPE *HasBeenWalked )( - IAssemblyBindingClosure * This, - /* [in] */ WALK_LEVEL level); - - HRESULT ( STDMETHODCALLTYPE *MayHaveUnknownDependencies )( - IAssemblyBindingClosure * This); - - HRESULT ( STDMETHODCALLTYPE *AddProfilerAssemblyReference )( - IAssemblyBindingClosure * This, - /* [in] */ LPVOID pbPublicKeyOrToken, - /* [in] */ ULONG cbPublicKeyOrToken, - /* [in] */ LPCWSTR szName, - /* [in] */ LPVOID pMetaData, - /* [in] */ void *pbHashValue, - /* [in] */ ULONG cbHashValue, - /* [in] */ DWORD dwAssemblyRefFlags, - /* [in] */ struct AssemblyReferenceClosureWalkContextForProfAPI *pContext); - - END_INTERFACE - } IAssemblyBindingClosureVtbl; - - interface IAssemblyBindingClosure - { - CONST_VTBL struct IAssemblyBindingClosureVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyBindingClosure_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyBindingClosure_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyBindingClosure_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyBindingClosure_IsAllAssembliesInGAC(This) \ - ( (This)->lpVtbl -> IsAllAssembliesInGAC(This) ) - -#define IAssemblyBindingClosure_IsEqual(This,pAssemblyClosure) \ - ( (This)->lpVtbl -> IsEqual(This,pAssemblyClosure) ) - -#define IAssemblyBindingClosure_GetNextFailureAssembly(This,dwIndex,ppName,pHResult) \ - ( (This)->lpVtbl -> GetNextFailureAssembly(This,dwIndex,ppName,pHResult) ) - -#define IAssemblyBindingClosure_EnsureWalked(This,pStartingAssembly,pAppCtx,level) \ - ( (This)->lpVtbl -> EnsureWalked(This,pStartingAssembly,pAppCtx,level) ) - -#define IAssemblyBindingClosure_EnumerateAssemblies(This,ppEnumerator) \ - ( (This)->lpVtbl -> EnumerateAssemblies(This,ppEnumerator) ) - -#define IAssemblyBindingClosure_HasBeenWalked(This,level) \ - ( (This)->lpVtbl -> HasBeenWalked(This,level) ) - -#define IAssemblyBindingClosure_MayHaveUnknownDependencies(This) \ - ( (This)->lpVtbl -> MayHaveUnknownDependencies(This) ) - -#define IAssemblyBindingClosure_AddProfilerAssemblyReference(This,pbPublicKeyOrToken,cbPublicKeyOrToken,szName,pMetaData,pbHashValue,cbHashValue,dwAssemblyRefFlags,pContext) \ - ( (This)->lpVtbl -> AddProfilerAssemblyReference(This,pbPublicKeyOrToken,cbPublicKeyOrToken,szName,pMetaData,pbHashValue,cbHashValue,dwAssemblyRefFlags,pContext) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyBindingClosure_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyBindSink_INTERFACE_DEFINED__ -#define __IAssemblyBindSink_INTERFACE_DEFINED__ - -/* interface IAssemblyBindSink */ -/* [unique][uuid][object][local] */ - -typedef /* [unique] */ IAssemblyBindSink *LPASSEMBLY_BIND_SINK; - -typedef struct _tagFusionBindInfo - { - IFusionBindLog *pdbglog; - IAssemblyName *pNamePolicy; - DWORD dwPoliciesApplied; - } FusionBindInfo; - -typedef /* [public] */ -enum __MIDL_IAssemblyBindSink_0001 - { - ASM_NOTIFICATION_START = 0, - ASM_NOTIFICATION_PROGRESS = ( ASM_NOTIFICATION_START + 1 ) , - ASM_NOTIFICATION_SUSPEND = ( ASM_NOTIFICATION_PROGRESS + 1 ) , - ASM_NOTIFICATION_ATTEMPT_NEXT_CODEBASE = ( ASM_NOTIFICATION_SUSPEND + 1 ) , - ASM_NOTIFICATION_BIND_INFO = ( ASM_NOTIFICATION_ATTEMPT_NEXT_CODEBASE + 1 ) , - ASM_NOTIFICATION_DONE = ( ASM_NOTIFICATION_BIND_INFO + 1 ) , - ASM_NOTIFICATION_NATIVE_IMAGE_DONE = ( ASM_NOTIFICATION_DONE + 1 ) - } ASM_NOTIFICATION; - - -EXTERN_C const IID IID_IAssemblyBindSink; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("af0bc960-0b9a-11d3-95ca-00a024a85b51") - IAssemblyBindSink : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE OnProgress( - /* [in] */ DWORD dwNotification, - /* [in] */ HRESULT hrNotification, - /* [in] */ LPCWSTR szNotification, - /* [in] */ DWORD dwProgress, - /* [in] */ DWORD dwProgressMax, - /* [in] */ LPVOID pvBindInfo, - /* [in] */ IUnknown *pUnk) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyBindSinkVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyBindSink * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyBindSink * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyBindSink * This); - - HRESULT ( STDMETHODCALLTYPE *OnProgress )( - IAssemblyBindSink * This, - /* [in] */ DWORD dwNotification, - /* [in] */ HRESULT hrNotification, - /* [in] */ LPCWSTR szNotification, - /* [in] */ DWORD dwProgress, - /* [in] */ DWORD dwProgressMax, - /* [in] */ LPVOID pvBindInfo, - /* [in] */ IUnknown *pUnk); - - END_INTERFACE - } IAssemblyBindSinkVtbl; - - interface IAssemblyBindSink - { - CONST_VTBL struct IAssemblyBindSinkVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyBindSink_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyBindSink_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyBindSink_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyBindSink_OnProgress(This,dwNotification,hrNotification,szNotification,dwProgress,dwProgressMax,pvBindInfo,pUnk) \ - ( (This)->lpVtbl -> OnProgress(This,dwNotification,hrNotification,szNotification,dwProgress,dwProgressMax,pvBindInfo,pUnk) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyBindSink_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyBinding_INTERFACE_DEFINED__ -#define __IAssemblyBinding_INTERFACE_DEFINED__ - -/* interface IAssemblyBinding */ -/* [unique][uuid][object][local] */ - -typedef /* [unique] */ IAssemblyBinding *LPASSEMBLY_BINDINDING; - - -EXTERN_C const IID IID_IAssemblyBinding; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("cfe52a80-12bd-11d3-95ca-00a024a85b51") - IAssemblyBinding : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE Control( - /* [in] */ HRESULT hrControl) = 0; - - virtual HRESULT STDMETHODCALLTYPE DoDefaultUI( - /* [in] */ HWND hWnd, - /* [in] */ DWORD dwFlags) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyBindingVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyBinding * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyBinding * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyBinding * This); - - HRESULT ( STDMETHODCALLTYPE *Control )( - IAssemblyBinding * This, - /* [in] */ HRESULT hrControl); - - HRESULT ( STDMETHODCALLTYPE *DoDefaultUI )( - IAssemblyBinding * This, - /* [in] */ HWND hWnd, - /* [in] */ DWORD dwFlags); - - END_INTERFACE - } IAssemblyBindingVtbl; - - interface IAssemblyBinding - { - CONST_VTBL struct IAssemblyBindingVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyBinding_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyBinding_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyBinding_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyBinding_Control(This,hrControl) \ - ( (This)->lpVtbl -> Control(This,hrControl) ) - -#define IAssemblyBinding_DoDefaultUI(This,hWnd,dwFlags) \ - ( (This)->lpVtbl -> DoDefaultUI(This,hWnd,dwFlags) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyBinding_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyModuleImport_INTERFACE_DEFINED__ -#define __IAssemblyModuleImport_INTERFACE_DEFINED__ - -/* interface IAssemblyModuleImport */ -/* [unique][uuid][object][local] */ - -typedef /* [unique] */ IAssemblyModuleImport *LPASSEMBLY_MODULE_IMPORT; - - -EXTERN_C const IID IID_IAssemblyModuleImport; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("da0cd4b0-1117-11d3-95ca-00a024a85b51") - IAssemblyModuleImport : public IStream - { - public: - virtual HRESULT STDMETHODCALLTYPE GetModuleName( - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*pccModuleName) LPOLESTR szModuleName, - /* [out][in] */ LPDWORD pccModuleName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHashAlgId( - /* [out] */ LPDWORD pdwHashAlgId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetHashValue( - /* [size_is][out] */ BYTE *pbHashValue, - /* [out][in] */ LPDWORD pcbHashValue) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFlags( - /* [out] */ LPDWORD pdwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModulePath( - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*pccModulePath) LPOLESTR szModulePath, - /* [out][in] */ LPDWORD pccModulePath) = 0; - - virtual BOOL STDMETHODCALLTYPE IsAvailable( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE BindToObject( - /* [in] */ IAssemblyBindSink *pBindSink, - /* [in] */ IApplicationContext *pAppCtx, - /* [in] */ LONGLONG llFlags, - /* [out] */ LPVOID *ppv) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyModuleImportVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyModuleImport * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyModuleImport * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyModuleImport * This); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Read )( - IAssemblyModuleImport * This, - /* [annotation] */ - _Out_writes_bytes_to_(cb, *pcbRead) void *pv, - /* [annotation][in] */ - _In_ ULONG cb, - /* [annotation] */ - _Out_opt_ ULONG *pcbRead); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Write )( - IAssemblyModuleImport * This, - /* [annotation] */ - _In_reads_bytes_(cb) const void *pv, - /* [annotation][in] */ - _In_ ULONG cb, - /* [annotation] */ - _Out_opt_ ULONG *pcbWritten); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *Seek )( - IAssemblyModuleImport * This, - /* [in] */ LARGE_INTEGER dlibMove, - /* [in] */ DWORD dwOrigin, - /* [annotation] */ - _Out_opt_ ULARGE_INTEGER *plibNewPosition); - - HRESULT ( STDMETHODCALLTYPE *SetSize )( - IAssemblyModuleImport * This, - /* [in] */ ULARGE_INTEGER libNewSize); - - /* [local] */ HRESULT ( STDMETHODCALLTYPE *CopyTo )( - IAssemblyModuleImport * This, - /* [annotation][unique][in] */ - _In_ IStream *pstm, - /* [in] */ ULARGE_INTEGER cb, - /* [annotation] */ - _Out_opt_ ULARGE_INTEGER *pcbRead, - /* [annotation] */ - _Out_opt_ ULARGE_INTEGER *pcbWritten); - - HRESULT ( STDMETHODCALLTYPE *Commit )( - IAssemblyModuleImport * This, - /* [in] */ DWORD grfCommitFlags); - - HRESULT ( STDMETHODCALLTYPE *Revert )( - IAssemblyModuleImport * This); - - HRESULT ( STDMETHODCALLTYPE *LockRegion )( - IAssemblyModuleImport * This, - /* [in] */ ULARGE_INTEGER libOffset, - /* [in] */ ULARGE_INTEGER cb, - /* [in] */ DWORD dwLockType); - - HRESULT ( STDMETHODCALLTYPE *UnlockRegion )( - IAssemblyModuleImport * This, - /* [in] */ ULARGE_INTEGER libOffset, - /* [in] */ ULARGE_INTEGER cb, - /* [in] */ DWORD dwLockType); - - HRESULT ( STDMETHODCALLTYPE *Stat )( - IAssemblyModuleImport * This, - /* [out] */ STATSTG *pstatstg, - /* [in] */ DWORD grfStatFlag); - - HRESULT ( STDMETHODCALLTYPE *Clone )( - IAssemblyModuleImport * This, - /* [out] */ IStream **ppstm); - - HRESULT ( STDMETHODCALLTYPE *GetModuleName )( - IAssemblyModuleImport * This, - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*pccModuleName) LPOLESTR szModuleName, - /* [out][in] */ LPDWORD pccModuleName); - - HRESULT ( STDMETHODCALLTYPE *GetHashAlgId )( - IAssemblyModuleImport * This, - /* [out] */ LPDWORD pdwHashAlgId); - - HRESULT ( STDMETHODCALLTYPE *GetHashValue )( - IAssemblyModuleImport * This, - /* [size_is][out] */ BYTE *pbHashValue, - /* [out][in] */ LPDWORD pcbHashValue); - - HRESULT ( STDMETHODCALLTYPE *GetFlags )( - IAssemblyModuleImport * This, - /* [out] */ LPDWORD pdwFlags); - - HRESULT ( STDMETHODCALLTYPE *GetModulePath )( - IAssemblyModuleImport * This, - /* [annotation][size_is][out] */ - __out_ecount_full_opt(*pccModulePath) LPOLESTR szModulePath, - /* [out][in] */ LPDWORD pccModulePath); - - BOOL ( STDMETHODCALLTYPE *IsAvailable )( - IAssemblyModuleImport * This); - - HRESULT ( STDMETHODCALLTYPE *BindToObject )( - IAssemblyModuleImport * This, - /* [in] */ IAssemblyBindSink *pBindSink, - /* [in] */ IApplicationContext *pAppCtx, - /* [in] */ LONGLONG llFlags, - /* [out] */ LPVOID *ppv); - - END_INTERFACE - } IAssemblyModuleImportVtbl; - - interface IAssemblyModuleImport - { - CONST_VTBL struct IAssemblyModuleImportVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyModuleImport_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyModuleImport_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyModuleImport_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyModuleImport_Read(This,pv,cb,pcbRead) \ - ( (This)->lpVtbl -> Read(This,pv,cb,pcbRead) ) - -#define IAssemblyModuleImport_Write(This,pv,cb,pcbWritten) \ - ( (This)->lpVtbl -> Write(This,pv,cb,pcbWritten) ) - - -#define IAssemblyModuleImport_Seek(This,dlibMove,dwOrigin,plibNewPosition) \ - ( (This)->lpVtbl -> Seek(This,dlibMove,dwOrigin,plibNewPosition) ) - -#define IAssemblyModuleImport_SetSize(This,libNewSize) \ - ( (This)->lpVtbl -> SetSize(This,libNewSize) ) - -#define IAssemblyModuleImport_CopyTo(This,pstm,cb,pcbRead,pcbWritten) \ - ( (This)->lpVtbl -> CopyTo(This,pstm,cb,pcbRead,pcbWritten) ) - -#define IAssemblyModuleImport_Commit(This,grfCommitFlags) \ - ( (This)->lpVtbl -> Commit(This,grfCommitFlags) ) - -#define IAssemblyModuleImport_Revert(This) \ - ( (This)->lpVtbl -> Revert(This) ) - -#define IAssemblyModuleImport_LockRegion(This,libOffset,cb,dwLockType) \ - ( (This)->lpVtbl -> LockRegion(This,libOffset,cb,dwLockType) ) - -#define IAssemblyModuleImport_UnlockRegion(This,libOffset,cb,dwLockType) \ - ( (This)->lpVtbl -> UnlockRegion(This,libOffset,cb,dwLockType) ) - -#define IAssemblyModuleImport_Stat(This,pstatstg,grfStatFlag) \ - ( (This)->lpVtbl -> Stat(This,pstatstg,grfStatFlag) ) - -#define IAssemblyModuleImport_Clone(This,ppstm) \ - ( (This)->lpVtbl -> Clone(This,ppstm) ) - - -#define IAssemblyModuleImport_GetModuleName(This,szModuleName,pccModuleName) \ - ( (This)->lpVtbl -> GetModuleName(This,szModuleName,pccModuleName) ) - -#define IAssemblyModuleImport_GetHashAlgId(This,pdwHashAlgId) \ - ( (This)->lpVtbl -> GetHashAlgId(This,pdwHashAlgId) ) - -#define IAssemblyModuleImport_GetHashValue(This,pbHashValue,pcbHashValue) \ - ( (This)->lpVtbl -> GetHashValue(This,pbHashValue,pcbHashValue) ) - -#define IAssemblyModuleImport_GetFlags(This,pdwFlags) \ - ( (This)->lpVtbl -> GetFlags(This,pdwFlags) ) - -#define IAssemblyModuleImport_GetModulePath(This,szModulePath,pccModulePath) \ - ( (This)->lpVtbl -> GetModulePath(This,szModulePath,pccModulePath) ) - -#define IAssemblyModuleImport_IsAvailable(This) \ - ( (This)->lpVtbl -> IsAvailable(This) ) - -#define IAssemblyModuleImport_BindToObject(This,pBindSink,pAppCtx,llFlags,ppv) \ - ( (This)->lpVtbl -> BindToObject(This,pBindSink,pAppCtx,llFlags,ppv) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyModuleImport_INTERFACE_DEFINED__ */ - - -#ifndef __IAssemblyScavenger_INTERFACE_DEFINED__ -#define __IAssemblyScavenger_INTERFACE_DEFINED__ - -/* interface IAssemblyScavenger */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IAssemblyScavenger; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("21b8916c-f28e-11d2-a473-00ccff8ef448") - IAssemblyScavenger : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE ScavengeAssemblyCache( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCacheDiskQuotas( - /* [out] */ DWORD *pdwZapQuotaInGAC, - /* [out] */ DWORD *pdwDownloadQuotaAdmin, - /* [out] */ DWORD *pdwDownloadQuotaUser) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetCacheDiskQuotas( - /* [in] */ DWORD dwZapQuotaInGAC, - /* [in] */ DWORD dwDownloadQuotaAdmin, - /* [in] */ DWORD dwDownloadQuotaUser) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCurrentCacheUsage( - /* [out] */ DWORD *dwZapUsage, - /* [out] */ DWORD *dwDownloadUsage) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IAssemblyScavengerVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IAssemblyScavenger * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IAssemblyScavenger * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IAssemblyScavenger * This); - - HRESULT ( STDMETHODCALLTYPE *ScavengeAssemblyCache )( - IAssemblyScavenger * This); - - HRESULT ( STDMETHODCALLTYPE *GetCacheDiskQuotas )( - IAssemblyScavenger * This, - /* [out] */ DWORD *pdwZapQuotaInGAC, - /* [out] */ DWORD *pdwDownloadQuotaAdmin, - /* [out] */ DWORD *pdwDownloadQuotaUser); - - HRESULT ( STDMETHODCALLTYPE *SetCacheDiskQuotas )( - IAssemblyScavenger * This, - /* [in] */ DWORD dwZapQuotaInGAC, - /* [in] */ DWORD dwDownloadQuotaAdmin, - /* [in] */ DWORD dwDownloadQuotaUser); - - HRESULT ( STDMETHODCALLTYPE *GetCurrentCacheUsage )( - IAssemblyScavenger * This, - /* [out] */ DWORD *dwZapUsage, - /* [out] */ DWORD *dwDownloadUsage); - - END_INTERFACE - } IAssemblyScavengerVtbl; - - interface IAssemblyScavenger - { - CONST_VTBL struct IAssemblyScavengerVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IAssemblyScavenger_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IAssemblyScavenger_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IAssemblyScavenger_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IAssemblyScavenger_ScavengeAssemblyCache(This) \ - ( (This)->lpVtbl -> ScavengeAssemblyCache(This) ) - -#define IAssemblyScavenger_GetCacheDiskQuotas(This,pdwZapQuotaInGAC,pdwDownloadQuotaAdmin,pdwDownloadQuotaUser) \ - ( (This)->lpVtbl -> GetCacheDiskQuotas(This,pdwZapQuotaInGAC,pdwDownloadQuotaAdmin,pdwDownloadQuotaUser) ) - -#define IAssemblyScavenger_SetCacheDiskQuotas(This,dwZapQuotaInGAC,dwDownloadQuotaAdmin,dwDownloadQuotaUser) \ - ( (This)->lpVtbl -> SetCacheDiskQuotas(This,dwZapQuotaInGAC,dwDownloadQuotaAdmin,dwDownloadQuotaUser) ) - -#define IAssemblyScavenger_GetCurrentCacheUsage(This,dwZapUsage,dwDownloadUsage) \ - ( (This)->lpVtbl -> GetCurrentCacheUsage(This,dwZapUsage,dwDownloadUsage) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IAssemblyScavenger_INTERFACE_DEFINED__ */ - - -#ifndef __ICodebaseList_INTERFACE_DEFINED__ -#define __ICodebaseList_INTERFACE_DEFINED__ - -/* interface ICodebaseList */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_ICodebaseList; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("D8FB9BD6-3969-11d3-B4AF-00C04F8ECB26") - ICodebaseList : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE AddCodebase( - /* [in] */ LPCWSTR wzCodebase, - /* [in] */ DWORD dwFlags) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveCodebase( - /* [in] */ DWORD dwIndex) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveAll( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCount( - /* [out] */ DWORD *pdwCount) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetCodebase( - /* [in] */ DWORD dwIndex, - /* [out] */ DWORD *pdwFlags, - /* [annotation][out] */ - __out_ecount_opt(*pcbCodebase) LPWSTR wzCodebase, - /* [out][in] */ DWORD *pcbCodebase) = 0; - - }; - - -#else /* C style interface */ - - typedef struct ICodebaseListVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - ICodebaseList * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - ICodebaseList * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - ICodebaseList * This); - - HRESULT ( STDMETHODCALLTYPE *AddCodebase )( - ICodebaseList * This, - /* [in] */ LPCWSTR wzCodebase, - /* [in] */ DWORD dwFlags); - - HRESULT ( STDMETHODCALLTYPE *RemoveCodebase )( - ICodebaseList * This, - /* [in] */ DWORD dwIndex); - - HRESULT ( STDMETHODCALLTYPE *RemoveAll )( - ICodebaseList * This); - - HRESULT ( STDMETHODCALLTYPE *GetCount )( - ICodebaseList * This, - /* [out] */ DWORD *pdwCount); - - HRESULT ( STDMETHODCALLTYPE *GetCodebase )( - ICodebaseList * This, - /* [in] */ DWORD dwIndex, - /* [out] */ DWORD *pdwFlags, - /* [annotation][out] */ - __out_ecount_opt(*pcbCodebase) LPWSTR wzCodebase, - /* [out][in] */ DWORD *pcbCodebase); - - END_INTERFACE - } ICodebaseListVtbl; - - interface ICodebaseList - { - CONST_VTBL struct ICodebaseListVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define ICodebaseList_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define ICodebaseList_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define ICodebaseList_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define ICodebaseList_AddCodebase(This,wzCodebase,dwFlags) \ - ( (This)->lpVtbl -> AddCodebase(This,wzCodebase,dwFlags) ) - -#define ICodebaseList_RemoveCodebase(This,dwIndex) \ - ( (This)->lpVtbl -> RemoveCodebase(This,dwIndex) ) - -#define ICodebaseList_RemoveAll(This) \ - ( (This)->lpVtbl -> RemoveAll(This) ) - -#define ICodebaseList_GetCount(This,pdwCount) \ - ( (This)->lpVtbl -> GetCount(This,pdwCount) ) - -#define ICodebaseList_GetCodebase(This,dwIndex,pdwFlags,wzCodebase,pcbCodebase) \ - ( (This)->lpVtbl -> GetCodebase(This,dwIndex,pdwFlags,wzCodebase,pcbCodebase) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __ICodebaseList_INTERFACE_DEFINED__ */ - - -#ifndef __IDownloadMgr_INTERFACE_DEFINED__ -#define __IDownloadMgr_INTERFACE_DEFINED__ - -/* interface IDownloadMgr */ -/* [unique][uuid][object][local] */ - - -EXTERN_C const IID IID_IDownloadMgr; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("0A6F16F8-ACD7-11d3-B4ED-00C04F8ECB26") - IDownloadMgr : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE PreDownloadCheck( - /* [out] */ void **ppv, - /* [out] */ void **ppvNI) = 0; - - virtual HRESULT STDMETHODCALLTYPE DoSetup( - /* [in] */ LPCWSTR wzSourceUrl, - /* [in] */ LPCWSTR wzFilePath, - /* [in] */ const FILETIME *pftLastMod, - /* [out] */ IUnknown **ppUnk, - /* [out] */ IUnknown **ppAsmNI) = 0; - - virtual HRESULT STDMETHODCALLTYPE ProbeFailed( - /* [out] */ IUnknown **ppUnk) = 0; - - virtual HRESULT STDMETHODCALLTYPE IsDuplicate( - /* [out] */ IDownloadMgr *ppDLMgr) = 0; - - virtual HRESULT STDMETHODCALLTYPE LogResult( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE DownloadEnabled( - /* [out] */ BOOL *pbEnabled) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetBindInfo( - /* [out] */ FusionBindInfo *pBindInfo) = 0; - - virtual HRESULT STDMETHODCALLTYPE CacheBindingResult( - /* [in] */ HRESULT hrResult) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IDownloadMgrVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IDownloadMgr * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IDownloadMgr * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IDownloadMgr * This); - - HRESULT ( STDMETHODCALLTYPE *PreDownloadCheck )( - IDownloadMgr * This, - /* [out] */ void **ppv, - /* [out] */ void **ppvNI); - - HRESULT ( STDMETHODCALLTYPE *DoSetup )( - IDownloadMgr * This, - /* [in] */ LPCWSTR wzSourceUrl, - /* [in] */ LPCWSTR wzFilePath, - /* [in] */ const FILETIME *pftLastMod, - /* [out] */ IUnknown **ppUnk, - /* [out] */ IUnknown **ppAsmNI); - - HRESULT ( STDMETHODCALLTYPE *ProbeFailed )( - IDownloadMgr * This, - /* [out] */ IUnknown **ppUnk); - - HRESULT ( STDMETHODCALLTYPE *IsDuplicate )( - IDownloadMgr * This, - /* [out] */ IDownloadMgr *ppDLMgr); - - HRESULT ( STDMETHODCALLTYPE *LogResult )( - IDownloadMgr * This); - - HRESULT ( STDMETHODCALLTYPE *DownloadEnabled )( - IDownloadMgr * This, - /* [out] */ BOOL *pbEnabled); - - HRESULT ( STDMETHODCALLTYPE *GetBindInfo )( - IDownloadMgr * This, - /* [out] */ FusionBindInfo *pBindInfo); - - HRESULT ( STDMETHODCALLTYPE *CacheBindingResult )( - IDownloadMgr * This, - /* [in] */ HRESULT hrResult); - - END_INTERFACE - } IDownloadMgrVtbl; - - interface IDownloadMgr - { - CONST_VTBL struct IDownloadMgrVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IDownloadMgr_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IDownloadMgr_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IDownloadMgr_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IDownloadMgr_PreDownloadCheck(This,ppv,ppvNI) \ - ( (This)->lpVtbl -> PreDownloadCheck(This,ppv,ppvNI) ) - -#define IDownloadMgr_DoSetup(This,wzSourceUrl,wzFilePath,pftLastMod,ppUnk,ppAsmNI) \ - ( (This)->lpVtbl -> DoSetup(This,wzSourceUrl,wzFilePath,pftLastMod,ppUnk,ppAsmNI) ) - -#define IDownloadMgr_ProbeFailed(This,ppUnk) \ - ( (This)->lpVtbl -> ProbeFailed(This,ppUnk) ) - -#define IDownloadMgr_IsDuplicate(This,ppDLMgr) \ - ( (This)->lpVtbl -> IsDuplicate(This,ppDLMgr) ) - -#define IDownloadMgr_LogResult(This) \ - ( (This)->lpVtbl -> LogResult(This) ) - -#define IDownloadMgr_DownloadEnabled(This,pbEnabled) \ - ( (This)->lpVtbl -> DownloadEnabled(This,pbEnabled) ) - -#define IDownloadMgr_GetBindInfo(This,pBindInfo) \ - ( (This)->lpVtbl -> GetBindInfo(This,pBindInfo) ) - -#define IDownloadMgr_CacheBindingResult(This,hrResult) \ - ( (This)->lpVtbl -> CacheBindingResult(This,hrResult) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IDownloadMgr_INTERFACE_DEFINED__ */ - - -#ifndef __IHostAssembly_INTERFACE_DEFINED__ -#define __IHostAssembly_INTERFACE_DEFINED__ - -/* interface IHostAssembly */ -/* [unique][uuid][object][local] */ - -typedef /* [unique] */ IHostAssembly *LPHOSTASSEMBLY; - - -EXTERN_C const IID IID_IHostAssembly; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("711f7c2d-8234-4505-b02f-7554f46cbf29") - IHostAssembly : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetAssemblyNameDef( - /* [out] */ IAssemblyName **ppAssemblyName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextAssemblyNameRef( - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyName **ppAssemblyName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetNextAssemblyModule( - /* [in] */ DWORD nIndex, - /* [out] */ IHostAssemblyModuleImport **ppModImport) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleByName( - /* [in] */ LPCOLESTR szModuleName, - /* [out] */ IHostAssemblyModuleImport **ppModImport) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyStream( - /* [out] */ IStream **ppStreamAsm) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyId( - /* [out] */ UINT64 *pAssemblyId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyDebugStream( - /* [out] */ IStream **ppDebugStream) = 0; - - virtual LOADCTX_TYPE STDMETHODCALLTYPE GetFusionLoadContext( void) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAssemblyContext( - /* [out] */ UINT64 *pdwAssemblyContext) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IHostAssemblyVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IHostAssembly * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IHostAssembly * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IHostAssembly * This); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyNameDef )( - IHostAssembly * This, - /* [out] */ IAssemblyName **ppAssemblyName); - - HRESULT ( STDMETHODCALLTYPE *GetNextAssemblyNameRef )( - IHostAssembly * This, - /* [in] */ DWORD nIndex, - /* [out] */ IAssemblyName **ppAssemblyName); - - HRESULT ( STDMETHODCALLTYPE *GetNextAssemblyModule )( - IHostAssembly * This, - /* [in] */ DWORD nIndex, - /* [out] */ IHostAssemblyModuleImport **ppModImport); - - HRESULT ( STDMETHODCALLTYPE *GetModuleByName )( - IHostAssembly * This, - /* [in] */ LPCOLESTR szModuleName, - /* [out] */ IHostAssemblyModuleImport **ppModImport); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyStream )( - IHostAssembly * This, - /* [out] */ IStream **ppStreamAsm); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyId )( - IHostAssembly * This, - /* [out] */ UINT64 *pAssemblyId); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyDebugStream )( - IHostAssembly * This, - /* [out] */ IStream **ppDebugStream); - - LOADCTX_TYPE ( STDMETHODCALLTYPE *GetFusionLoadContext )( - IHostAssembly * This); - - HRESULT ( STDMETHODCALLTYPE *GetAssemblyContext )( - IHostAssembly * This, - /* [out] */ UINT64 *pdwAssemblyContext); - - END_INTERFACE - } IHostAssemblyVtbl; - - interface IHostAssembly - { - CONST_VTBL struct IHostAssemblyVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IHostAssembly_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IHostAssembly_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IHostAssembly_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IHostAssembly_GetAssemblyNameDef(This,ppAssemblyName) \ - ( (This)->lpVtbl -> GetAssemblyNameDef(This,ppAssemblyName) ) - -#define IHostAssembly_GetNextAssemblyNameRef(This,nIndex,ppAssemblyName) \ - ( (This)->lpVtbl -> GetNextAssemblyNameRef(This,nIndex,ppAssemblyName) ) - -#define IHostAssembly_GetNextAssemblyModule(This,nIndex,ppModImport) \ - ( (This)->lpVtbl -> GetNextAssemblyModule(This,nIndex,ppModImport) ) - -#define IHostAssembly_GetModuleByName(This,szModuleName,ppModImport) \ - ( (This)->lpVtbl -> GetModuleByName(This,szModuleName,ppModImport) ) - -#define IHostAssembly_GetAssemblyStream(This,ppStreamAsm) \ - ( (This)->lpVtbl -> GetAssemblyStream(This,ppStreamAsm) ) - -#define IHostAssembly_GetAssemblyId(This,pAssemblyId) \ - ( (This)->lpVtbl -> GetAssemblyId(This,pAssemblyId) ) - -#define IHostAssembly_GetAssemblyDebugStream(This,ppDebugStream) \ - ( (This)->lpVtbl -> GetAssemblyDebugStream(This,ppDebugStream) ) - -#define IHostAssembly_GetFusionLoadContext(This) \ - ( (This)->lpVtbl -> GetFusionLoadContext(This) ) - -#define IHostAssembly_GetAssemblyContext(This,pdwAssemblyContext) \ - ( (This)->lpVtbl -> GetAssemblyContext(This,pdwAssemblyContext) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IHostAssembly_INTERFACE_DEFINED__ */ - - -#ifndef __IHostAssemblyModuleImport_INTERFACE_DEFINED__ -#define __IHostAssemblyModuleImport_INTERFACE_DEFINED__ - -/* interface IHostAssemblyModuleImport */ -/* [unique][uuid][object][local] */ - -typedef /* [unique] */ IHostAssemblyModuleImport *LPHOSTASSEMBLY_MODULE_IMPORT; - - -EXTERN_C const IID IID_IHostAssemblyModuleImport; - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("b6f2729d-6c0f-4944-b692-e5a2ce2c6e7a") - IHostAssemblyModuleImport : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE GetModuleName( - /* [annotation][size_is][out] */ - __out_ecount_full(*pccModuleName) LPOLESTR szModuleName, - /* [out][in] */ LPDWORD pccModuleName) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleStream( - /* [out] */ IStream **ppStreamModule) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleId( - /* [out] */ DWORD *pdwModuleId) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetModuleDebugStream( - /* [out] */ IStream **ppDebugStream) = 0; - - }; - - -#else /* C style interface */ - - typedef struct IHostAssemblyModuleImportVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( - IHostAssemblyModuleImport * This, - /* [in] */ REFIID riid, - /* [annotation][iid_is][out] */ - _COM_Outptr_ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( - IHostAssemblyModuleImport * This); - - ULONG ( STDMETHODCALLTYPE *Release )( - IHostAssemblyModuleImport * This); - - HRESULT ( STDMETHODCALLTYPE *GetModuleName )( - IHostAssemblyModuleImport * This, - /* [annotation][size_is][out] */ - __out_ecount_full(*pccModuleName) LPOLESTR szModuleName, - /* [out][in] */ LPDWORD pccModuleName); - - HRESULT ( STDMETHODCALLTYPE *GetModuleStream )( - IHostAssemblyModuleImport * This, - /* [out] */ IStream **ppStreamModule); - - HRESULT ( STDMETHODCALLTYPE *GetModuleId )( - IHostAssemblyModuleImport * This, - /* [out] */ DWORD *pdwModuleId); - - HRESULT ( STDMETHODCALLTYPE *GetModuleDebugStream )( - IHostAssemblyModuleImport * This, - /* [out] */ IStream **ppDebugStream); - - END_INTERFACE - } IHostAssemblyModuleImportVtbl; - - interface IHostAssemblyModuleImport - { - CONST_VTBL struct IHostAssemblyModuleImportVtbl *lpVtbl; - }; - - - -#ifdef COBJMACROS - - -#define IHostAssemblyModuleImport_QueryInterface(This,riid,ppvObject) \ - ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) - -#define IHostAssemblyModuleImport_AddRef(This) \ - ( (This)->lpVtbl -> AddRef(This) ) - -#define IHostAssemblyModuleImport_Release(This) \ - ( (This)->lpVtbl -> Release(This) ) - - -#define IHostAssemblyModuleImport_GetModuleName(This,szModuleName,pccModuleName) \ - ( (This)->lpVtbl -> GetModuleName(This,szModuleName,pccModuleName) ) - -#define IHostAssemblyModuleImport_GetModuleStream(This,ppStreamModule) \ - ( (This)->lpVtbl -> GetModuleStream(This,ppStreamModule) ) - -#define IHostAssemblyModuleImport_GetModuleId(This,pdwModuleId) \ - ( (This)->lpVtbl -> GetModuleId(This,pdwModuleId) ) - -#define IHostAssemblyModuleImport_GetModuleDebugStream(This,ppDebugStream) \ - ( (This)->lpVtbl -> GetModuleDebugStream(This,ppDebugStream) ) - -#endif /* COBJMACROS */ - - -#endif /* C style interface */ - - - - -#endif /* __IHostAssemblyModuleImport_INTERFACE_DEFINED__ */ - - -/* interface __MIDL_itf_fusionpriv_0000_0017 */ -/* [local] */ - -STDAPI CreateHistoryReader(LPCWSTR wzFilePath, IHistoryReader **ppHistReader); -STDAPI LookupHistoryAssembly(LPCWSTR pwzFilePath, FILETIME *pftActivationDate, LPCWSTR pwzAsmName, LPCWSTR pwzPublicKeyToken, LPCWSTR wzCulture, LPCWSTR pwzVerRef, IHistoryAssembly **pHistAsm); -STDAPI GetHistoryFileDirectory(__out_ecount_opt(*pdwSize) LPWSTR wzDir, DWORD *pdwSize); -STDAPI PreBindAssembly(IApplicationContext *pAppCtx, IAssemblyName *pName, IAssembly *pAsmParent, IAssemblyName **ppNamePostPolicy, LPVOID pvReserved); -STDAPI CreateApplicationContext(IAssemblyName *pName, LPAPPLICATIONCONTEXT *ppCtx); -STDAPI IsRetargetableAssembly(IAssemblyName *pName, BOOL *pbIsRetargetable); -STDAPI IsOptionallyRetargetableAssembly(IAssemblyName *pName, BOOL *pbIsRetargetable); -#define EXPLICITBIND_FLAGS_NON_BINDABLE 0x0 -#define EXPLICITBIND_FLAGS_EXE 0x1 - - -extern RPC_IF_HANDLE __MIDL_itf_fusionpriv_0000_0017_v0_0_c_ifspec; -extern RPC_IF_HANDLE __MIDL_itf_fusionpriv_0000_0017_v0_0_s_ifspec; - -/* Additional Prototypes for ALL interfaces */ - -/* end of Additional Prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/src/utilcode/peinformation.cpp b/src/utilcode/peinformation.cpp index 948948a4da..20a9fe18b0 100644 --- a/src/utilcode/peinformation.cpp +++ b/src/utilcode/peinformation.cpp @@ -11,100 +11,6 @@ #include "utilcode.h" #include "peinformation.h" -#if defined(FEATURE_FUSION) && !defined(DACCESS_COMPILE) - -extern BOOL g_fWow64Process; // Wow64 Process - -PEKIND GetCurrentRealProcessorPEKIND() -{ - PEKIND curProcessorPEKind = TargetNativePEKIND(); - -#ifdef _TARGET_X86_ - if (g_fWow64Process) - { - SYSTEM_INFO si = {0}; - - GetNativeSystemInfo(&si); - switch (si.wProcessorArchitecture) - { - case PROCESSOR_ARCHITECTURE_AMD64: - curProcessorPEKind = peAMD64; - break; - default: - _ASSERTE(FALSE); - curProcessorPEKind = peInvalid; - break; - } - } -#endif // _TARGET_X86_ - - return curProcessorPEKind; -} - -HRESULT RuntimeIsValidAssemblyOnThisPlatform_CheckProcessorArchitecture(PEKIND processorArchitecture, BOOL bForInstall) -{ - LIMITED_METHOD_CONTRACT; - - HRESULT hr = S_OK; - - // MSIL / legacy images always allowed - if (IsPEMSIL(processorArchitecture) || (processorArchitecture == peNone)) - { - goto Exit; - } - else if (IsPE32(processorArchitecture)) - { -#ifdef _TARGET_ARM_ - // ARM can use only native ones - if (processorArchitecture != TargetNativePEKIND()) - { - hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); - goto Exit; - } - -#else //!_TARGET_ARM_ - //ARM assemblies can be installed only on ARM - if (processorArchitecture == peARM) - { - hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); - goto Exit; - } -#endif //!_TARGET_ARM_ - - if (bForInstall) - { - goto Exit; - } - else - { - // won't allow bind to x86 while in 64 bit process. - if (!IsProcess32()) - { - hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); - } - goto Exit; - } - } - // 64 bit images must match processor type - else if(IsPE64(processorArchitecture)) - { - if (!IsProcess32() && (processorArchitecture == TargetNativePEKIND())) - { - goto Exit; - } - else if (bForInstall && (GetCurrentRealProcessorPEKIND() == processorArchitecture)) - { - goto Exit; - } - } - - // Everything else, fails match - hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT); - -Exit: - return hr; -} -#endif // FEATURE_FUSION && !DACCESS_COMPILE HRESULT TranslatePEToArchitectureType(CorPEKind CLRPeKind, DWORD dwImageType, PEKIND * pPeKind) { diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 0386c5f431..e6d4ed1b4b 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -14,12 +14,6 @@ #include "eeconfig.h" #include "gcheaputilities.h" #include "eventtrace.h" -#ifdef FEATURE_FUSION -#include "assemblysink.h" -#include "fusion.h" -#include "fusionbind.h" -#include "fusionlogging.h" -#endif #include "perfcounters.h" #include "assemblyname.hpp" #include "eeprofinterfaces.h" @@ -2549,10 +2543,6 @@ void SystemDomain::Init() // Finish loading mscorlib now. m_pSystemAssembly->GetDomainAssembly()->EnsureActive(); -#ifdef FEATURE_FUSION - // disable fusion log for m_pSystemFile, because m_pSystemFile will get reused - m_pSystemFile->DisableFusionLogging(); -#endif } #ifdef _DEBUG @@ -2785,15 +2775,7 @@ void SystemDomain::LoadBaseSystemClasses() ETWOnStartup(LdSysBases_V1, LdSysBasesEnd_V1); { -#ifdef FEATURE_FUSION - ETWOnStartup (FusionAppCtx_V1, FusionAppCtxEnd_V1); - // Setup fusion context for the system domain - this is used for binding mscorlib. - IfFailThrow(FusionBind::SetupFusionContext(m_SystemDirectory, NULL, &m_pFusionContext)); - - m_pSystemFile = PEAssembly::OpenSystem(m_pFusionContext); -#else m_pSystemFile = PEAssembly::OpenSystem(NULL); -#endif // FEATURE_FUSION } // Only partially load the system assembly. Other parts of the code will want to access // the globals in this function before finishing the load. @@ -3280,31 +3262,6 @@ BOOL SystemDomain::SetGlobalSharePolicyUsingAttribute(IMDInternalImport* pScope, { STANDARD_VM_CONTRACT; -#ifdef FEATURE_FUSION - HRESULT hr; - - // - // Check to see if the assembly has the LoaderOptimization attribute set. - // - - DWORD cbVal; - BYTE *pVal; - IfFailThrow(hr = pScope->GetCustomAttributeByName(mdMethod, - DEFAULTDOMAIN_LOADEROPTIMIZATION_TYPE, - (const void**)&pVal, &cbVal)); - - if (hr == S_OK) { - CustomAttributeParser cap(pVal, cbVal); - IfFailThrow(cap.SkipProlog()); - - UINT8 u1; - IfFailThrow(cap.GetU1(&u1)); - - g_dwGlobalSharePolicy = u1 & AppDomain::SHARE_POLICY_MASK; - - return TRUE; - } -#endif return FALSE; } @@ -3386,49 +3343,6 @@ void SystemDomain::InitializeDefaultDomain( ETWOnStartup (InitDefaultDomain_V1, InitDefaultDomainEnd_V1); -#if defined(FEATURE_FUSION) // SxS - // Determine the application base and the configuration file name - CQuickWSTR sPathName; - CQuickWSTR sConfigName; - - SIZE_T dwSize; - HRESULT hr = GetConfigFileFromWin32Manifest(sConfigName.Ptr(), - sConfigName.MaxSize(), - &dwSize); - if(FAILED(hr)) - { - if(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - sConfigName.ReSizeThrows(dwSize); - hr = GetConfigFileFromWin32Manifest(sConfigName.Ptr(), - sConfigName.MaxSize(), - &dwSize); - } - IfFailThrow(hr); - } - else - sConfigName.ReSizeThrows(dwSize); - - hr = GetApplicationPathFromWin32Manifest(sPathName.Ptr(), - sPathName.MaxSize(), - &dwSize); - if(FAILED(hr)) - { - if(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - sPathName.ReSizeThrows(dwSize); - hr = GetApplicationPathFromWin32Manifest(sPathName.Ptr(), - sPathName.MaxSize(), - &dwSize); - } - IfFailThrow(hr); - } - else - sPathName.ReSizeThrows(dwSize); - - pwsConfig = (sConfigName.Size() > 0 ? sConfigName.Ptr() : NULL); - pwsPath = (sPathName.Size() > 0 ? sPathName.Ptr() : NULL); -#endif // defined(FEATURE_FUSION) // SxS // Setup the default AppDomain. @@ -4309,106 +4223,6 @@ HRESULT SystemDomain::NotifyProfilerShutdown() } #endif // PROFILING_SUPPORTED -#ifdef FEATURE_FUSION -static HRESULT GetVersionPath(HKEY root, __in LPWSTR key, __out LPWSTR* pDevpath, DWORD* pdwDevpath) -{ - CONTRACTL - { - MODE_PREEMPTIVE; - NOTHROW; - GC_NOTRIGGER; - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - DWORD rtn; - RegKeyHolder versionKey; - rtn = WszRegOpenKeyEx(root, key, 0, KEY_READ, &versionKey); - if(rtn == ERROR_SUCCESS) { - DWORD type; - DWORD cbDevpath; - if(WszRegQueryValueEx(versionKey, W("devpath"), 0, &type, (LPBYTE) NULL, &cbDevpath) == ERROR_SUCCESS && type == REG_SZ) { - *pDevpath = (LPWSTR) new (nothrow) BYTE[cbDevpath]; - if(*pDevpath == NULL) - return E_OUTOFMEMORY; - else { - rtn = WszRegQueryValueEx(versionKey, W("devpath"), 0, &type, (LPBYTE) *pDevpath, &cbDevpath); - if ((rtn == ERROR_SUCCESS) && (type == REG_SZ)) - *pdwDevpath = (DWORD) wcslen(*pDevpath); - } - } - else - return REGDB_E_INVALIDVALUE; - } - - return HRESULT_FROM_WIN32(rtn); -} - -// Get the developers path from the environment. This can only be set through the environment and -// cannot be added through configuration files, registry etc. This would make it to easy for -// developers to deploy apps that are not side by side. The environment variable should only -// be used on developers machines where exact matching to versions makes build and testing to -// difficult. -void SystemDomain::GetDevpathW(__out_ecount_opt(1) LPWSTR* pDevpath, DWORD* pdwDevpath) -{ - CONTRACTL - { - THROWS; - MODE_ANY; - GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - GCX_PREEMP(); - - if(g_pConfig->DeveloperInstallation() && m_fDevpath == FALSE) { - - LockHolder lh; - - if(m_fDevpath == FALSE) { - DWORD dwPath = 0; - PathString m_pwDevpathholder; - dwPath = WszGetEnvironmentVariable(APPENV_DEVPATH, m_pwDevpathholder); - if(dwPath) { - m_pwDevpath = m_pwDevpathholder.GetCopyOfUnicodeString(); - } - else { - RegKeyHolder userKey; - RegKeyHolder machineKey; - - WCHAR pVersion[MAX_PATH_FNAME]; - DWORD dwVersion = MAX_PATH_FNAME; - HRESULT hr = S_OK; - hr = FusionBind::GetVersion(pVersion, &dwVersion); - if(SUCCEEDED(hr)) { - LONG rslt; - rslt = WszRegOpenKeyEx(HKEY_CURRENT_USER, FRAMEWORK_REGISTRY_KEY_W,0,KEY_READ, &userKey); - hr = HRESULT_FROM_WIN32(rslt); - if (SUCCEEDED(hr)) { - hr = GetVersionPath(userKey, pVersion, &m_pwDevpath, &m_dwDevpath); - } - - if (FAILED(hr) && WszRegOpenKeyEx(HKEY_LOCAL_MACHINE, FRAMEWORK_REGISTRY_KEY_W,0,KEY_READ, &machineKey) == ERROR_SUCCESS) { - hr = GetVersionPath(machineKey, pVersion, &m_pwDevpath, &m_dwDevpath); - } - } - if (Assembly::FileNotFound(hr)) - hr = S_FALSE; - else - IfFailThrow(hr); - } - - m_fDevpath = TRUE; - } - // lh out of scope here - } - - if(pDevpath) *pDevpath = m_pwDevpath; - if(pdwDevpath) *pdwDevpath = m_dwDevpath; - return; -} -#endif // FEATURE_FUSION #ifdef _DEBUG struct AppDomain::ThreadTrackInfo { @@ -4974,13 +4788,6 @@ void AppDomain::Terminate() #endif // FEATURE_COMINTEROP -#ifdef FEATURE_FUSION - if(m_pAsyncPool != NULL) - { - delete m_pAsyncPool; - m_pAsyncPool = NULL; - } -#endif if (!IsAtProcessExit()) { @@ -6771,13 +6578,6 @@ void AppDomain::SetSharePolicy(SharePolicy policy) #ifdef FEATURE_PREJIT -#ifdef FEATURE_FUSION - GCX_PREEMP(); - - // Update the native image config flags - FusionBind::SetApplicationContextDWORDProperty(m_pFusionContext, ACTAG_ZAP_CONFIG_FLAGS, - PEFile::GetNativeImageConfigFlags()); -#endif //FEATURE_FUSION #endif // FEATURE_PREJIT @@ -6787,49 +6587,6 @@ void AppDomain::SetSharePolicy(SharePolicy policy) return; } -#ifdef FEATURE_FUSION -BOOL AppDomain::ReduceSharePolicyFromAlways() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - // We may have already committed to always sharing - this is the case if - // we have already loaded non-GAC-bound assemblies as domain neutral. - - if (GetSharePolicy() == SHARE_POLICY_ALWAYS) - { - AppDomain::AssemblyIterator i = IterateAssembliesEx((AssemblyIterationFlags)(kIncludeLoaded | kIncludeLoading | kIncludeExecution)); - CollectibleAssemblyHolder<DomainAssembly *> pDomainAssembly; - - // If we have loaded any non-GAC assemblies, we cannot set app domain policy as we have - // already committed to the process-wide policy. - - while (i.Next(pDomainAssembly.This())) - { - if (pDomainAssembly->GetAssembly() && - pDomainAssembly->GetAssembly()->IsDomainNeutral() && - !pDomainAssembly->IsClosedInGAC()) - { - // This assembly has been loaded domain neutral because of SHARE_POLICY_ALWAYS. We - // can't reverse that decision now, so we have to fail the sharing policy change. - return FALSE; - } - } - - // We haven't loaded any non-GAC assemblies yet - scale back to SHARE_POLICY_GAC so - // future non-GAC assemblies won't be loaded as domain neutral. - SetSharePolicy(SHARE_POLICY_GAC); - } - - return TRUE; -} -#endif // FEATURE_FUSION AppDomain::SharePolicy AppDomain::GetSharePolicy() { @@ -7292,33 +7049,6 @@ void AppDomain::CacheStringsForDAC() // If the application base, private bin paths, and configuration file are // available, cache them so DAC can read them out of memory // -#ifdef FEATURE_FUSION - if (m_pFusionContext) - { - CQuickBytes qb; - LPWSTR ssz = (LPWSTR) qb.AllocThrows(MAX_URL_LENGTH * sizeof(WCHAR)); - - DWORD dwSize; - - // application base - ssz[0] = '\0'; - dwSize = MAX_URL_LENGTH * sizeof(WCHAR); - m_pFusionContext->Get(ACTAG_APP_BASE_URL, ssz, &dwSize, 0); - m_applicationBase.Set(ssz); - - // private bin paths - ssz[0] = '\0'; - dwSize = MAX_URL_LENGTH * sizeof(WCHAR); - m_pFusionContext->Get(ACTAG_APP_PRIVATE_BINPATH, ssz, &dwSize, 0); - m_privateBinPaths.Set(ssz); - - // configuration file - ssz[0] = '\0'; - dwSize = MAX_URL_LENGTH * sizeof(WCHAR); - m_pFusionContext->Get(ACTAG_APP_CONFIG_FILE, ssz, &dwSize, 0); - m_configFile.Set(ssz); - } -#endif // FEATURE_FUSION } #ifndef DACCESS_COMPILE @@ -7373,17 +7103,6 @@ BOOL AppDomain::AddAssemblyToCache(AssemblySpec* pSpec, DomainAssembly *pAssembl CrstHolder holder(&m_DomainCacheCrst); // !!! suppress exceptions BOOL bRetVal = m_AssemblyCache.StoreAssembly(pSpec, pAssembly); -#ifdef FEATURE_FUSION - // check for context propagation - if (bRetVal && pSpec->GetParentLoadContext() == LOADCTX_TYPE_LOADFROM && pAssembly->GetFile()->GetLoadContext() == LOADCTX_TYPE_DEFAULT) - { - // LoadFrom propagation occurred, store it in a way reachable by Load() (the "post-policy" one) - AssemblySpec loadSpec; - loadSpec.CopyFrom(pSpec); - loadSpec.SetParentAssembly(NULL); - bRetVal = m_AssemblyCache.StoreAssembly(&loadSpec, pAssembly); - } -#endif return bRetVal; } @@ -7511,26 +7230,6 @@ BOOL AppDomain::PostBindResolveAssembly(AssemblySpec *pPrePolicySpec, BOOL fFailure = TRUE; *ppFailedSpec = pPrePolicySpec; -#ifdef FEATURE_FUSION - // Fusion policy could have been applied, - // so failed assembly could be not exactly what we ordered - - IAssemblyName *pIPostPolicyName = pPrePolicySpec->GetNameAfterPolicy(); - - // Get post-policy assembly name - if (pIPostPolicyName != NULL) - { - pPostPolicySpec->InitializeSpec(pIPostPolicyName, - NULL, - pPrePolicySpec->IsIntrospectionOnly()); - pPrePolicySpec->ReleaseNameAfterPolicy(); - - if (!pPostPolicySpec->CompareEx(pPrePolicySpec)) - { - *ppFailedSpec = pPostPolicySpec; - } - } -#endif //FEATURE_FUSION PEAssemblyHolder result; @@ -7726,19 +7425,6 @@ HRESULT AppDomain::BindAssemblySpecForHostedBinder( HRESULT hr = S_OK; -#ifdef FEATURE_FUSION - StackSString wszAssemblyName; - - if (fusion::logging::LoggingEnabled()) - { // Don't perform computation if logging is not enabled. - FusionBind::GetAssemblyNameDisplayName(pAssemblyName, wszAssemblyName, ASM_DISPLAYF_FULL); - } - - // Fire ETW Start event. - FireEtwBindingPhaseStart( - GetId().m_dwId, LOADCTX_TYPE_HOSTED, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, - pSpec->m_wszCodeBase, wszAssemblyName.GetUnicode(), GetClrInstanceId()); -#endif // The Fusion binder can throw (to preserve compat, since it will actually perform an assembly // load as part of it's bind), so we need to be careful here to catch any FileNotFoundException @@ -7752,13 +7438,6 @@ HRESULT AppDomain::BindAssemblySpecForHostedBinder( IfFailRet(BindHostedPrivAssembly(nullptr, pPrivAssembly, pAssemblyName, ppAssembly)); -#ifdef FEATURE_FUSION - // Fire ETW End event. - FireEtwBindingPhaseEnd( - GetId().m_dwId, LOADCTX_TYPE_HOSTED, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, - pSpec->m_wszCodeBase, wszAssemblyName.GetUnicode(), GetClrInstanceId()); - - #endif return S_OK; } @@ -7830,11 +7509,6 @@ AppDomain::BindHostedPrivAssembly( // Create a PEAssembly using the IL and NI images. PEAssemblyHolder pPEAssembly = PEAssembly::Open(pParentAssembly, pPEImageIL, pPEImageNI, pPrivAssembly, fIsIntrospectionOnly); -#ifdef FEATURE_FUSION - // Ensure that the assembly found can be loaded for execution in the process. - if (!fIsIntrospectionOnly) - IfFailRet(RuntimeIsValidAssemblyOnThisPlatform_CheckProcessorArchitecture(pPEAssembly->GetFusionProcessorArchitecture(), FALSE)); -#endif // Ask the binder to verify. IfFailRet(VerifyBindHelper(pPrivAssembly, pAssemblyName, pPEAssembly)); @@ -7877,10 +7551,6 @@ PEAssembly * AppDomain::BindAssemblySpec( IfFailThrow(pSpec->CreateFusionName(&pAssemblyName, TRUE, TRUE)); -#ifdef FEATURE_FUSION - // Create new binding scope for fusion logging. - fusion::logging::BindingScope defaultScope(pAssemblyName, FUSION_BIND_LOG_CATEGORY_DEFAULT); -#endif PEAssemblyHolder pAssembly; @@ -7904,11 +7574,7 @@ EndTry2:; { _ASSERTE(fThrowOnFileNotFound); // Uses defaultScope -#ifdef FEATURE_FUSION - EEFileLoadException::Throw(pSpec, fusion::logging::GetCurrentFusionBindLog(), hr); -#else EEFileLoadException::Throw(pSpec, hr); -#endif // FEATURE_FUSION } // WinRT type bind failures @@ -8011,88 +7677,11 @@ EndTry2:; if (!IsCached(pSpec)) { -#ifdef FEATURE_FUSION - if (fRaisePrebindEvents - && (result = TryResolveAssembly(pSpec, TRUE /*fPreBind*/)) != NULL - && result->CanUseWithBindingCache()) - { - // Failure to add simply means someone else beat us to it. In that case - // the FindCachedFile call below (after catch block) will update result - // to the cached value. - AddFileToCache(pSpec, result, TRUE /*fAllowFailure*/); - } - else -#endif { bool fAddFileToCache = false; BOOL fIsWellKnown = FALSE; -#ifdef FEATURE_FUSION - SafeComHolderPreemp<IAssembly> pIAssembly; - SafeComHolderPreemp<IBindResult> pNativeFusionAssembly; - SafeComHolderPreemp<IHostAssembly> pIHostAssembly; - SafeComHolderPreemp<IFusionBindLog> pFusionLog; - - // Event Tracing for Windows is used to log data for performance and functional testing purposes. - // The events below are used to measure the performance of assembly binding as a whole. - FireEtwBindingPhaseStart(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, pSpec->m_wszCodeBase, NULL, GetClrInstanceId()); - fIsWellKnown = pSpec->FindAssemblyFile(this, - fThrowOnFileNotFound, - &pIAssembly, - &pIHostAssembly, - &pNativeFusionAssembly, - &pFusionLog, - &hrBindResult, - pCallerStackMark, - pLoadSecurity); - FireEtwBindingPhaseEnd(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, pSpec->m_wszCodeBase, NULL, GetClrInstanceId()); - if (pIAssembly || pIHostAssembly) - { - - if (fIsWellKnown && - m_pRootAssembly && - pIAssembly == m_pRootAssembly->GetFusionAssembly()) - { - // This is a shortcut to avoid opening another copy of the process exe. - // In fact, we have other similar cases where we've called - // ExplicitBind() rather than normal binding, which aren't covered here. - - // <TODO>@todo: It would be nice to populate the cache with those assemblies - // to avoid getting in this situation.</TODO> - - result = m_pRootAssembly->GetManifestFile(); - result.SuppressRelease(); // Didn't get a refcount - } - else - { - BOOL isSystemAssembly = pSpec->IsMscorlib(); // can use SystemDomain::m_pSystemAssembly - BOOL isIntrospectionOnly = pSpec->IsIntrospectionOnly(); - if (pIAssembly) - result = PEAssembly::Open(pIAssembly, pNativeFusionAssembly, pFusionLog, - isSystemAssembly, isIntrospectionOnly); - else - result = PEAssembly::Open(pIHostAssembly, isSystemAssembly, - isIntrospectionOnly); - } - fAddFileToCache = true; - } - else if (!fIsWellKnown) - { - // Trigger the resolve event also for non-throw situation. - // However, this code path will behave as if the resolve handler has thrown, - // that is, not trigger an MDA. - _ASSERTE(fThrowOnFileNotFound == FALSE); - - AssemblySpec NewSpec(this); - AssemblySpec *pFailedSpec = NULL; - - fForceReThrow = TRUE; // Managed resolve event handler can throw - - // Purposly ignore return value - PostBindResolveAssembly(pSpec, &NewSpec, hrBindResult, &pFailedSpec); - } -#else //!FEATURE_FUSION // Use CoreClr's fusion alternative CoreBindResult bindResult; @@ -8121,7 +7710,6 @@ EndTry2:; pSpec->SetBindingContext(pBinder); } -#endif //!FEATURE_FUSION if (fAddFileToCache) { @@ -8475,85 +8063,6 @@ PEAssembly *AppDomain::TryResolveAssembly(AssemblySpec *pSpec, BOOL fPreBind) return result; } -#ifdef FEATURE_FUSION -void AppDomain::GetFileFromFusion(IAssembly *pIAssembly, LPCWSTR wszModuleName, - SString &path) -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - INJECT_FAULT(COMPlusThrowOM()); - } - CONTRACTL_END; - - SafeComHolder<IAssemblyModuleImport> pImport; - IfFailThrow(pIAssembly->GetModuleByName(wszModuleName, &pImport)); - - if (!pImport->IsAvailable()) { - AssemblySink* pSink = AllocateAssemblySink(NULL); - SafeComHolder<IAssemblyBindSink> sinkholder(pSink); - SafeComHolder<IAssemblyModuleImport> pResult; - - IfFailThrow(FusionBind::RemoteLoadModule(GetFusionContext(), - pImport, - pSink, - &pResult)); - pResult->AddRef(); - pImport.Assign(pResult); - } - - DWORD dwPath = 0; - pImport->GetModulePath(NULL, &dwPath); - - LPWSTR buffer = path.OpenUnicodeBuffer(dwPath-1); - IfFailThrow(pImport->GetModulePath(buffer, &dwPath)); - path.CloseBuffer(); -} - -PEAssembly *AppDomain::BindExplicitAssembly(HMODULE hMod, BOOL bindable) -{ - CONTRACT(PEAssembly *) - { - PRECONDITION(CheckPointer(hMod)); - GC_TRIGGERS; - THROWS; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - - SafeComHolder<IAssembly> pFusionAssembly; - SafeComHolder<IBindResult> pNativeFusionAssembly; - SafeComHolder<IFusionBindLog> pFusionLog; - - StackSString path; - PEImage::GetPathFromDll(hMod, path); - - HRESULT hr = ExplicitBind(path, GetFusionContext(), - bindable ? EXPLICITBIND_FLAGS_EXE : EXPLICITBIND_FLAGS_NON_BINDABLE, - NULL, &pFusionAssembly, &pNativeFusionAssembly,&pFusionLog); - if (FAILED(hr)) - EEFileLoadException::Throw(path, hr); - - RETURN PEAssembly::OpenHMODULE(hMod, pFusionAssembly,pNativeFusionAssembly, pFusionLog, FALSE); -} - -Assembly *AppDomain::LoadExplicitAssembly(HMODULE hMod, BOOL bindable) -{ - CONTRACT(Assembly *) - { - PRECONDITION(CheckPointer(hMod)); - GC_TRIGGERS; - THROWS; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - - PEAssemblyHolder pFile(BindExplicitAssembly(hMod, bindable)); - - RETURN LoadAssembly(NULL, pFile, FILE_ACTIVE); -} -#endif // FEATURE_FUSION ULONG AppDomain::AddRef() { @@ -8583,26 +8092,6 @@ ULONG AppDomain::Release() return (cRef); } -#ifdef FEATURE_FUSION -AssemblySink* AppDomain::AllocateAssemblySink(AssemblySpec* pSpec) -{ - CONTRACT(AssemblySink *) - { - THROWS; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - - AssemblySink* ret = FastInterlockExchangePointer(&m_pAsyncPool, NULL); - - if(ret == NULL) - ret = new AssemblySink(this); - else - ret->AddRef(); - ret->SetAssemblySpec(pSpec); - RETURN ret; -} -#endif AppDomain* AppDomain::s_pAppDomainToRaiseUnloadEvent; BOOL AppDomain::s_fProcessUnloadDomainEvent = FALSE; @@ -8996,9 +8485,6 @@ void AppDomain::InitializeDomainContext(BOOL allowRedirects, if (NingenEnabled()) { -#ifdef FEATURE_FUSION - CreateFusionContext(); -#endif // FEATURE_FUSION CreateFusionContext(); @@ -9048,207 +8534,6 @@ void AppDomain::InitializeDomainContext(BOOL allowRedirects, #endif // CROSSGEN_COMPILE } -#ifdef FEATURE_FUSION - -void AppDomain::SetupLoaderOptimization(DWORD optimization) -{ - STANDARD_VM_CONTRACT; - - GCX_COOP(); - - if ((GetExposedObject()) != NULL) - { - MethodDescCallSite setupLoaderOptimization(METHOD__APP_DOMAIN__SETUP_LOADER_OPTIMIZATION); - - ARG_SLOT args[2] = - { - ObjToArgSlot(GetExposedObject()), - optimization - }; - setupLoaderOptimization.Call(args); - } -} - -// The fusion context should only be null when appdomain is being setup -// and there should be no reason to protect the creation. -IApplicationContext *AppDomain::CreateFusionContext() -{ - CONTRACT(IApplicationContext *) - { - GC_TRIGGERS; - THROWS; - MODE_ANY; - POSTCONDITION(CheckPointer(RETVAL)); - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - - if (m_pFusionContext == NULL) - { - ETWOnStartup (FusionAppCtx_V1, FusionAppCtxEnd_V1); - - GCX_PREEMP(); - - SafeComHolderPreemp<IApplicationContext> pFusionContext; - - IfFailThrow(FusionBind::CreateFusionContext(NULL, &pFusionContext)); - - -#ifdef FEATURE_PREJIT - if (NGENImagesAllowed()) - { - // Set the native image settings so fusion will bind native images - SString zapString(g_pConfig->ZapSet()); - FusionBind::SetApplicationContextStringProperty(pFusionContext, ACTAG_ZAP_STRING, zapString); - FusionBind::SetApplicationContextDWORDProperty(pFusionContext, ACTAG_ZAP_CONFIG_FLAGS, - PEFile::GetNativeImageConfigFlags()); - } -#endif // FEATURE_PREJIT - - pFusionContext.SuppressRelease(); - m_pFusionContext = pFusionContext; - - DWORD dwId = m_dwId.m_dwId; - IfFailThrow(m_pFusionContext->Set(ACTAG_APP_DOMAIN_ID, &dwId, sizeof(DWORD), 0)); - - if (HasLoadContextHostBinder()) - FusionBind::SetApplicationContextDWORDProperty(pFusionContext, ACTAG_FX_ONLY,1); - - } - - RETURN m_pFusionContext; -} - -void AppDomain::TurnOnBindingRedirects() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - - if ((GetExposedObject()) != NULL) - { - MethodDescCallSite turnOnBindingRedirects(METHOD__APP_DOMAIN__TURN_ON_BINDING_REDIRECTS); - ARG_SLOT args[1] = - { - ObjToArgSlot(GetExposedObject()), - }; - turnOnBindingRedirects.Call(args); - } - - IfFailThrow(m_pFusionContext->Set(ACTAG_DISALLOW_APP_BINDING_REDIRECTS, - NULL, - 0, - 0)); -} - -void AppDomain::SetupExecutableFusionContext(LPCWSTR exePath) -{ - CONTRACTL - { - STANDARD_VM_CHECK; - PRECONDITION(GetAppDomain() == this); - } - CONTRACTL_END; - - GCX_COOP(); - - struct _gc { - STRINGREF pFilePath; - OBJECTREF ref; - } gc; - ZeroMemory(&gc, sizeof(gc)); - - GCPROTECT_BEGIN(gc); - gc.pFilePath = StringObject::NewString(exePath); - - if ((gc.ref = GetExposedObject()) != NULL) - { - MethodDescCallSite setDomainContext(METHOD__APP_DOMAIN__SET_DOMAIN_CONTEXT, &gc.ref); - ARG_SLOT args[2] = - { - ObjToArgSlot(gc.ref), - ObjToArgSlot(gc.pFilePath), - }; - setDomainContext.Call(args); - } - - GCPROTECT_END(); - -} - -BOOL AppDomain::SetContextProperty(IApplicationContext* pFusionContext, - LPCWSTR pProperty, OBJECTREF* obj) - -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_COOPERATIVE; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - if (GetAppDomain()->HasLoadContextHostBinder()) - COMPlusThrow(kNotSupportedException); - - - if(obj) { - if ((*obj) != NULL){ - MethodTable* pMT = (*obj)->GetMethodTable(); - DWORD lgth; - - if(MscorlibBinder::IsClass(pMT, CLASS__STRING)) { - - lgth = (ObjectToSTRINGREF(*(StringObject**)obj))->GetStringLength(); - CQuickBytes qb; - LPWSTR wszValue = (LPWSTR) qb.AllocThrows((lgth+1)*sizeof(WCHAR)); - memcpy(wszValue, (ObjectToSTRINGREF(*(StringObject**)obj))->GetBuffer(), lgth*sizeof(WCHAR)); - if(lgth > 0 && wszValue[lgth-1] == '/') - lgth--; - wszValue[lgth] = W('\0'); - - LOG((LF_LOADER, - LL_INFO10, - "Set: %S: *%S*.\n", - pProperty, wszValue)); - - IfFailThrow(pFusionContext->Set(pProperty, - wszValue, - (lgth+1) * sizeof(WCHAR), - 0)); - } - else { - // Pin byte array for loading - Wrapper<OBJECTHANDLE, DoNothing, DestroyPinningHandle> handle( - GetAppDomain()->CreatePinningHandle(*obj)); - - const BYTE *pbArray = ((U1ARRAYREF)(*obj))->GetDirectConstPointerToNonObjectElements(); - DWORD cbArray = (*obj)->GetNumComponents(); - - IfFailThrow(pFusionContext->Set(pProperty, - (LPVOID) pbArray, - cbArray, - 0)); - } - } - else { // Un-set the property - IfFailThrow(pFusionContext->Set(pProperty, - NULL, - 0, - 0)); - } - } - - return TRUE; -} -#endif // FEATURE_FUSION IUnknown *AppDomain::CreateFusionContext() { @@ -9281,48 +8566,6 @@ IUnknown *AppDomain::CreateFusionContext() RETURN m_pFusionContext; } -#ifdef FEATURE_FUSION -LPWSTR AppDomain::GetDynamicDir() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - if (m_pwDynamicDir == NULL) { - - BaseDomain::LockHolder lh(this); - - if(m_pwDynamicDir == NULL) { - IApplicationContext* pFusionContext = GetFusionContext(); - _ASSERTE(pFusionContext); - - HRESULT hr = S_OK; - DWORD dwSize = 0; - hr = pFusionContext->GetDynamicDirectory(NULL, &dwSize); - AllocMemHolder<WCHAR> tempDynamicDir; - - if(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) { - tempDynamicDir = GetLowFrequencyHeap()->AllocMem(S_SIZE_T(dwSize) * S_SIZE_T(sizeof(WCHAR))); - hr = pFusionContext->GetDynamicDirectory(tempDynamicDir, &dwSize); - } - if(hr==HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - return NULL; - IfFailThrow(hr); - - tempDynamicDir.SuppressRelease(); - m_pwDynamicDir = tempDynamicDir; - } - // lh out of scope here - } - - return m_pwDynamicDir;; -} -#endif //FEATURE_FUSION //--------------------------------------------------------------------------------------- diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp index f785bf0718..f698c8fe9f 100644 --- a/src/vm/appdomain.hpp +++ b/src/vm/appdomain.hpp @@ -19,9 +19,6 @@ #include "assembly.hpp" #include "clsload.hpp" #include "eehash.h" -#ifdef FEATURE_FUSION -#include "fusion.h" -#endif #include "arraylist.h" #include "comreflectioncache.hpp" #include "comutilnative.h" @@ -1332,14 +1329,10 @@ public: BOOL ContainsOBJECTHANDLE(OBJECTHANDLE handle); -#ifdef FEATURE_FUSION - IApplicationContext *GetFusionContext() {LIMITED_METHOD_CONTRACT; return m_pFusionContext; } -#else IUnknown *GetFusionContext() {LIMITED_METHOD_CONTRACT; return m_pFusionContext; } CLRPrivBinderCoreCLR *GetTPABinderContext() {LIMITED_METHOD_CONTRACT; return m_pTPABinderContext; } -#endif CrstExplicitInit * GetLoaderAllocatorReferencesLock() { @@ -1384,14 +1377,10 @@ protected: // Fusion context, used for adding assemblies to the is domain. It defines // fusion properties for finding assemblyies such as SharedBinPath, // PrivateBinPath, Application Directory, etc. -#ifdef FEATURE_FUSION - IApplicationContext* m_pFusionContext; // Binding context for the domain -#else IUnknown *m_pFusionContext; // Current binding context for the domain CLRPrivBinderCoreCLR *m_pTPABinderContext; // Reference to the binding context that holds TPA list details -#endif HandleTableBucket *m_hHandleTableBucket; @@ -1793,9 +1782,6 @@ protected: struct FailedAssembly { SString displayName; SString location; -#ifdef FEATURE_FUSION - LOADCTX_TYPE context; -#endif HRESULT error; void Initialize(AssemblySpec *pSpec, Exception *ex) @@ -1818,9 +1804,6 @@ struct FailedAssembly { // If the parent hasn't been set but the code base has, use LoadFrom. // Otherwise, use the default. // -#ifdef FEATURE_FUSION - context = pSpec->GetParentIAssembly() ? pSpec->GetParentIAssembly()->GetFusionLoadContext() : LOADCTX_TYPE_LOADFROM; -#endif // FEATURE_FUSION } }; @@ -2390,12 +2373,6 @@ public: DomainFile *LoadDomainNeutralModuleDependency(Module *pModule, FileLoadLevel targetLevel); #endif -#ifdef FEATURE_FUSION - PEAssembly *BindExplicitAssembly(HMODULE hMod, BOOL bindable); - Assembly *LoadExplicitAssembly(HMODULE hMod, BOOL bindable); - void GetFileFromFusion(IAssembly *pIAssembly, LPCWSTR wszModuleName, - SString &path); -#endif // private: void LoadSystemAssemblies(); @@ -2550,19 +2527,11 @@ public: //**************************************************************************************** // -#ifdef FEATURE_FUSION - static BOOL SetContextProperty(IApplicationContext* pFusionContext, - LPCWSTR pProperty, - OBJECTREF* obj); -#endif //**************************************************************************************** // // Uses the first assembly to add an application base to the Context. This is done // in a lazy fashion so executables do not take the perf hit unless the load other // assemblies -#ifdef FEATURE_FUSION - LPWSTR GetDynamicDir(); -#endif #ifndef DACCESS_COMPILE void OnAssemblyLoad(Assembly *assem); void OnAssemblyLoadUnlocked(Assembly *assem); @@ -2757,10 +2726,6 @@ public: void InitializeDomainContext(BOOL allowRedirects, LPCWSTR pwszPath, LPCWSTR pwszConfig); -#ifdef FEATURE_FUSION - IApplicationContext *CreateFusionContext(); - void SetupLoaderOptimization(DWORD optimization); -#endif IUnknown *CreateFusionContext(); void OverrideDefaultContextBinder(IUnknown *pOverrideBinder) @@ -2791,9 +2756,6 @@ public: //**************************************************************************************** // Manage a pool of asyncrhonous objects used to fetch assemblies. When a sink is released // it places itself back on the pool list. Only one object is kept in the pool. -#ifdef FEATURE_FUSION - AssemblySink* AllocateAssemblySink(AssemblySpec* pSpec); -#endif void SetIsUserCreatedDomain() { LIMITED_METHOD_CONTRACT; @@ -3762,9 +3724,6 @@ private: // Stub caches for Method stubs //--------------------------------------------------------- -#ifdef FEATURE_FUSION - void TurnOnBindingRedirects(); -#endif public: private: @@ -4386,9 +4345,6 @@ public: //**************************************************************************************** // return the dev path -#ifdef FEATURE_FUSION - void GetDevpathW(__out_ecount_opt(1) LPWSTR* pPath, DWORD* pSize); -#endif #ifndef DACCESS_COMPILE void IncrementNumAppDomains () diff --git a/src/vm/appdomainnative.cpp b/src/vm/appdomainnative.cpp index 0c32baf3c4..47509d731f 100644 --- a/src/vm/appdomainnative.cpp +++ b/src/vm/appdomainnative.cpp @@ -278,28 +278,6 @@ void QCALLTYPE AppDomainNative::SetupDomainSecurity(QCall::AppDomainHandle pDoma // We need to downgrade sharing level if the AppDomain is homogeneous and not fully trusted, or the // AppDomain is in legacy mode. Effectively, we need to be sure that all assemblies loaded into the // domain must be fully trusted in order to allow non-GAC sharing. -#ifdef FEATURE_FUSION - if (pDomain->GetSharePolicy() == AppDomain::SHARE_POLICY_ALWAYS) - { - bool fSandboxedHomogenousDomain = false; - if (pSecDesc->IsHomogeneous()) - { - pSecDesc->Resolve(); - fSandboxedHomogenousDomain = !pSecDesc->IsFullyTrusted(); - } - - if (fSandboxedHomogenousDomain || pSecDesc->IsLegacyCasPolicyEnabled()) - { - // We may not be able to reduce sharing policy at this point, if we have already loaded - // some non-GAC assemblies as domain neutral. For this case we must regrettably fail - // the whole operation. - if (!pDomain->ReduceSharePolicyFromAlways()) - { - ThrowHR(COR_E_CANNOT_SET_POLICY); - } - } - } -#endif // Now finish the initialization. pSecDesc->FinishInitialization(); @@ -400,25 +378,6 @@ FCIMPLEND #endif // FEATURE_COMINTEROP -#ifdef FEATURE_FUSION -FCIMPL1(LPVOID, AppDomainNative::GetFusionContext, AppDomainBaseObject* refThis) -{ - FCALL_CONTRACT; - - LPVOID rv = NULL; - - HELPER_METHOD_FRAME_BEGIN_RET_1(rv); - - AppDomain* pApp = ValidateArg((APPDOMAINREF)refThis); - - rv = pApp->CreateFusionContext(); - - HELPER_METHOD_FRAME_END(); - - return rv; -} -FCIMPLEND -#endif FCIMPL1(void*, AppDomainNative::GetSecurityDescriptor, AppDomainBaseObject* refThisUNSAFE) { @@ -453,49 +412,6 @@ FCIMPL2(void, AppDomainNative::UpdateLoaderOptimization, AppDomainBaseObject* re FCIMPLEND #endif // FEATURE_LOADER_OPTIMIZATION -#ifdef FEATURE_FUSION -FCIMPL3(void, AppDomainNative::UpdateContextProperty, LPVOID fusionContext, StringObject* keyUNSAFE, Object* valueUNSAFE) -{ - FCALL_CONTRACT; - - struct _gc - { - STRINGREF key; - OBJECTREF value; - } gc; - - gc.key = ObjectToSTRINGREF(keyUNSAFE); - gc.value = ObjectToOBJECTREF(valueUNSAFE); - _ASSERTE(gc.key != NULL); - - HELPER_METHOD_FRAME_BEGIN_PROTECT(gc); - - IApplicationContext* pContext = (IApplicationContext*) fusionContext; - - BOOL fFXOnly; - DWORD size = sizeof(fFXOnly); - HRESULT hr = pContext->Get(ACTAG_FX_ONLY, &fFXOnly, &size, 0); - if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) - { - fFXOnly = FALSE; - hr = S_FALSE; - } - IfFailThrow(hr); - - if (!fFXOnly) - { - DWORD lgth = gc.key->GetStringLength(); - CQuickBytes qb; - LPWSTR key = (LPWSTR) qb.AllocThrows((lgth+1)*sizeof(WCHAR)); - memcpy(key, gc.key->GetBuffer(), lgth*sizeof(WCHAR)); - key[lgth] = W('\0'); - - AppDomain::SetContextProperty(pContext, key, &gc.value); - } - HELPER_METHOD_FRAME_END(); -} -FCIMPLEND -#endif // FEATURE_FUSION FCIMPL1(void, AppDomainNative::CreateContext, @@ -989,18 +905,6 @@ FCIMPL1(void, AppDomainNative::ChangeSecurityPolicy, AppDomainBaseObject* refThi HELPER_METHOD_FRAME_BEGIN_1(refThis); AppDomain* pApp = ValidateArg(refThis); -#ifdef FEATURE_FUSION - - // We do not support sharing behavior of ALWAYS when using app-domain local security config - if (pApp->GetSharePolicy() == AppDomain::SHARE_POLICY_ALWAYS) - { - // We may not be able to reduce sharing policy at this point, if we have already loaded - // some non-GAC assemblies as domain neutral. For this case we must regrettably fail - // the whole operation. - if (!pApp->ReduceSharePolicyFromAlways()) - ThrowHR(COR_E_CANNOT_SET_POLICY); - } -#endif pApp->GetSecurityDescriptor()->SetPolicyLevelFlag(); HELPER_METHOD_FRAME_END(); @@ -1066,14 +970,6 @@ FCIMPL1(Object*, AppDomainNative::GetDynamicDir, AppDomainBaseObject* refThisUNS FCALL_CONTRACT; STRINGREF str = NULL; -#ifdef FEATURE_FUSION - APPDOMAINREF refThis = (APPDOMAINREF) refThisUNSAFE; - HELPER_METHOD_FRAME_BEGIN_RET_1(refThis); - - AppDomain *pDomain = ValidateArg(refThis); - str = StringObject::NewString(pDomain->GetDynamicDir()); - HELPER_METHOD_FRAME_END(); -#endif return OBJECTREFToObject(str); } FCIMPLEND @@ -1170,29 +1066,7 @@ FCIMPL2(StringObject*, AppDomainNative::nApplyPolicy, AppDomainBaseObject* refTh StackSString sDisplayName; -#ifdef FEATURE_FUSION - { - GCX_PREEMP(); - - SafeComHolderPreemp<IAssemblyName> pAssemblyName(NULL); - SafeComHolderPreemp<IAssemblyName> pBoundName(NULL); - IfFailThrow(spec.CreateFusionName(&pAssemblyName)); - HRESULT hr = PreBindAssembly(pDomain->GetFusionContext(), - pAssemblyName, - NULL, // pAsmParent (only needed to see if parent is loadfrom - in this case, we always want it to load in the normal ctx) - &pBoundName, - NULL // pvReserved - ); - if (FAILED(hr) && hr != FUSION_E_REF_DEF_MISMATCH) - { - ThrowHR(hr); - } - - FusionBind::GetAssemblyNameDisplayName(pBoundName, /*modifies*/sDisplayName, 0 /*flags*/); - } -#else spec.GetFileOrDisplayName(0,sDisplayName); -#endif gc.rv = StringObject::NewString(sDisplayName); diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp index dd8aaf88f7..3e1745b23d 100644 --- a/src/vm/assembly.cpp +++ b/src/vm/assembly.cpp @@ -22,11 +22,6 @@ #include "perfcounters.h" #include "assemblyname.hpp" -#ifdef FEATURE_FUSION -#include "fusion.h" -#include "assemblysink.h" -#include "ngenoptout.h" -#endif #include "eeprofinterfaces.h" @@ -152,9 +147,6 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pFile, DebuggerAssemblyContr m_fIsDomainNeutral(pDomain == SharedDomain::GetDomain()), #ifdef FEATURE_LOADER_OPTIMIZATION m_bMissingDependenciesCheckDone(FALSE), -#ifdef FEATURE_FUSION - m_pBindingClosure(NULL), -#endif #endif // FEATURE_LOADER_OPTIMIZATION m_debuggerFlags(debuggerFlags), m_fTerminated(FALSE), @@ -365,12 +357,6 @@ Assembly::~Assembly() if (m_pAllowedFiles) delete(m_pAllowedFiles); #endif -#ifdef FEATURE_FUSION - if (m_pBindingClosure) - { - m_pBindingClosure->Release(); - } -#endif if (IsDynamic()) { if (m_pOnDiskManifest) // clear the on disk manifest if it is not cleared yet. @@ -2674,20 +2660,6 @@ PEModule * Assembly::LoadModule_AddRef(mdFile kFile, BOOL fLoadResource) { GCX_PREEMP(); -#ifdef FEATURE_FUSION // specific to remote modules - if (GetFusionAssembly()) { - StackSString path; - ::GetAppDomain()->GetFileFromFusion(GetFusionAssembly(), - (LPCWSTR)name, path); - pModule = PEModule::Open(m_pManifestFile, kFile, path); - goto lDone; - } - - if (GetIHostAssembly()) { - pModule = PEModule::Open(m_pManifestFile, kFile, name); - goto lDone; - } -#endif if (!m_pManifestFile->GetPath().IsEmpty()) { StackSString path = m_pManifestFile->GetPath(); @@ -2699,9 +2671,6 @@ PEModule * Assembly::LoadModule_AddRef(mdFile kFile, BOOL fLoadResource) } pModule = PEModule::Open(m_pManifestFile, kFile, path); } -#ifdef FEATURE_FUSION - lDone: ; -#endif } EX_CATCH { @@ -3045,186 +3014,6 @@ BOOL Assembly::MissingDependenciesCheckDone() }; -#ifdef FEATURE_FUSION -void Assembly::SetBindingClosure(IAssemblyBindingClosure* pClosure) // Addrefs. It is assumed the caller did not addref pClosure for us. -{ - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - _ASSERTE(m_pBindingClosure == NULL); - _ASSERTE(pClosure != NULL); - - m_pBindingClosure = pClosure; - pClosure->AddRef(); // It is assumed the caller did not addref pBindingClosure for us. -} - -IAssemblyBindingClosure * Assembly::GetBindingClosure() -{ - LIMITED_METHOD_CONTRACT; - return m_pBindingClosure; -} - - -// The shared module list is effectively an extension of the shared domain assembly hash table. -// It is the canonical list and aribiter of modules loaded from this assembly by any app domain. -// Modules are stored here immediately on creating (to prevent duplicate creation), as opposed to -// in the rid map, where they are only placed upon load completion. - -BOOL Assembly::CanBeShared(DomainAssembly *pDomainAssembly) -{ - CONTRACTL - { - PRECONDITION(CheckPointer(pDomainAssembly)); - THROWS; - GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - LOG((LF_CODESHARING, - LL_INFO100, - "Checking if we can share: \"%S\" in domain 0x%x.\n", - GetDebugName(), pDomainAssembly->GetAppDomain())); - - STRESS_LOG2(LF_CODESHARING, LL_INFO1000,"Checking whether DomainAssembly %p is compatible with Assembly %p", - pDomainAssembly,this); - - // We must always share the same system assemblies - if (IsSystem()) - { - STRESS_LOG0(LF_CODESHARING, LL_INFO1000,"System assembly - sharing"); - return TRUE; - } - - if ((pDomainAssembly->GetDebuggerInfoBits()&~(DACF_PDBS_COPIED|DACF_IGNORE_PDBS|DACF_OBSOLETE_TRACK_JIT_INFO)) - != (m_debuggerFlags&~(DACF_PDBS_COPIED|DACF_IGNORE_PDBS|DACF_OBSOLETE_TRACK_JIT_INFO))) - { - LOG((LF_CODESHARING, - LL_INFO100, - "We can't share it, desired debugging flags %x are different than %x\n", - pDomainAssembly->GetDebuggerInfoBits(), (m_debuggerFlags&~(DACF_PDBS_COPIED|DACF_IGNORE_PDBS|DACF_OBSOLETE_TRACK_JIT_INFO)))); - STRESS_LOG2(LF_CODESHARING, LL_INFO100,"Flags diff= %08x [%08x/%08x]",pDomainAssembly->GetDebuggerInfoBits(), - m_debuggerFlags); - g_dwLoaderReasonForNotSharing = ReasonForNotSharing_DebuggerFlagMismatch; - return FALSE; - } - - PEAssembly * pDomainAssemblyFile = pDomainAssembly->GetFile(); - if (pDomainAssemblyFile == NULL) - { - g_dwLoaderReasonForNotSharing = ReasonForNotSharing_NullPeassembly; - return FALSE; - } - - IAssemblyBindingClosure * pContext = GetBindingClosure(); - if (pContext == NULL) - { - STRESS_LOG1(LF_CODESHARING, LL_INFO1000,"No context 1 - status=%d",pDomainAssemblyFile->IsSystem()); - if (pDomainAssemblyFile->IsSystem()) - return TRUE; - else - { - g_dwLoaderReasonForNotSharing = ReasonForNotSharing_MissingAssemblyClosure1; - return FALSE; - } - } - - IAssemblyBindingClosure * pCurrentContext = pDomainAssembly->GetAssemblyBindingClosure(LEVEL_STARTING); - if (pCurrentContext == NULL) - { - STRESS_LOG1(LF_CODESHARING, LL_INFO1000,"No context 2 - status=%d",pDomainAssemblyFile->IsSystem()); - if (pDomainAssemblyFile->IsSystem()) - return TRUE; - else - { - g_dwLoaderReasonForNotSharing = ReasonForNotSharing_MissingAssemblyClosure2; - return FALSE; - } - } - - // ensure the closures are walked - { - ReleaseHolder<IBindResult> pWinRTBindResult; - - IUnknown * pUnk; - if (pDomainAssembly->GetFile()->IsWindowsRuntime()) - { // It is .winmd file (WinRT assembly) - IfFailThrow(CLRPrivAssemblyWinRT::GetIBindResult(pDomainAssembly->GetFile()->GetHostAssembly(), &pWinRTBindResult)); - pUnk = pWinRTBindResult; - } - else - { - pUnk = pDomainAssembly->GetFile()->GetFusionAssembly(); - } - - GCX_PREEMP(); - IfFailThrow(pCurrentContext->EnsureWalked(pUnk, ::GetAppDomain()->GetFusionContext(), LEVEL_COMPLETE)); - } - - if ((pContext->HasBeenWalked(LEVEL_COMPLETE) != S_OK) || !MissingDependenciesCheckDone()) - { - GCX_COOP(); - - BOOL fMissingDependenciesResolved = FALSE; - - ENTER_DOMAIN_PTR(SystemDomain::System()->DefaultDomain(), ADV_DEFAULTAD); - { - { - ReleaseHolder<IBindResult> pWinRTBindResult; - - IUnknown * pUnk; - if (GetManifestFile()->IsWindowsRuntime()) - { // It is .winmd file (WinRT assembly) - IfFailThrow(CLRPrivAssemblyWinRT::GetIBindResult(GetManifestFile()->GetHostAssembly(), &pWinRTBindResult)); - pUnk = pWinRTBindResult; - } - else - { - pUnk = GetManifestFile()->GetFusionAssembly(); - } - - GCX_PREEMP(); - IfFailThrow(pContext->EnsureWalked(pUnk, ::GetAppDomain()->GetFusionContext(), LEVEL_COMPLETE)); - } - DomainAssembly * domainAssembly = ::GetAppDomain()->FindDomainAssembly(this); - if (domainAssembly != NULL) - { - if (domainAssembly->CheckMissingDependencies() == CMD_Resolved) - { - //cannot share - fMissingDependenciesResolved = TRUE; - } - } - } - END_DOMAIN_TRANSITION; - - if (fMissingDependenciesResolved) - { - STRESS_LOG0(LF_CODESHARING, LL_INFO1000,"Missing dependencies resolved - not sharing"); - g_dwLoaderReasonForNotSharing = ReasonForNotSharing_MissingDependenciesResolved; - return FALSE; - } - } - - HRESULT hr = pContext->IsEqual(pCurrentContext); - IfFailThrow(hr); - if (hr != S_OK) - { - STRESS_LOG1(LF_CODESHARING, LL_INFO1000,"Closure comparison returned %08x - not sharing",hr); - g_dwLoaderReasonForNotSharing = ReasonForNotSharing_ClosureComparisonFailed; - return FALSE; - } - - LOG((LF_CODESHARING, LL_INFO100, "We can share it : \"%S\"\n", GetDebugName())); - STRESS_LOG0(LF_CODESHARING, LL_INFO1000,"Everything is fine - sharing"); - return TRUE; -} -#endif BOOL Assembly::CanBeShared(DomainAssembly *pDomainAssembly) @@ -3586,11 +3375,7 @@ FriendAssemblyDescriptor::~FriendAssemblyDescriptor() while (itFullAccessAssemblies.Next()) { FriendAssemblyName_t *pFriendAssemblyName = static_cast<FriendAssemblyName_t *>(itFullAccessAssemblies.GetElement()); -#ifdef FEATURE_FUSION - pFriendAssemblyName->Release(); -#else // FEATURE_FUSION delete pFriendAssemblyName; -#endif // FEATURE_FUSION } } @@ -3675,9 +3460,6 @@ FriendAssemblyDescriptor *FriendAssemblyDescriptor::CreateFriendAssemblyDescript // Create an AssemblyNameObject from the string. FriendAssemblyNameHolder pFriendAssemblyName; -#ifdef FEATURE_FUSION - hr = CreateAssemblyNameObject(&pFriendAssemblyName, displayName.GetUnicode(), CANOF_PARSE_FRIEND_DISPLAY_NAME, NULL); -#else // FEATURE_FUSION StackScratchBuffer buffer; pFriendAssemblyName = new FriendAssemblyName_t; hr = pFriendAssemblyName->Init(displayName.GetUTF8(buffer)); @@ -3686,7 +3468,6 @@ FriendAssemblyDescriptor *FriendAssemblyDescriptor::CreateFriendAssemblyDescript { hr = pFriendAssemblyName->CheckFriendAssemblyName(); } -#endif // FEATURE_FUSION if (FAILED(hr)) { @@ -3765,23 +3546,14 @@ bool FriendAssemblyDescriptor::IsAssemblyOnList(PEAssembly *pAssembly, const Arr } CONTRACTL_END; -#ifndef FEATURE_FUSION AssemblySpec asmDef; asmDef.InitializeSpec(pAssembly); -#endif ArrayList::ConstIterator itAssemblyNames = alAssemblyNames.Iterate(); while (itAssemblyNames.Next()) { const FriendAssemblyName_t *pFriendAssemblyName = static_cast<const FriendAssemblyName_t *>(itAssemblyNames.GetElement()); -#ifdef FEATURE_FUSION - // This is a const operation on the pointer, but Fusion is not const-correct. - // @TODO - propigate const correctness through Fusion and remove this cast - HRESULT hr = const_cast<FriendAssemblyName_t *>(pFriendAssemblyName)->IsEqual(pAssembly->GetFusionAssemblyName(), ASM_CMPF_DEFAULT); - IfFailThrow(hr); -#else HRESULT hr = AssemblySpec::RefMatchesDef(pFriendAssemblyName, &asmDef) ? S_OK : S_FALSE; -#endif if (hr == S_OK) { diff --git a/src/vm/assembly.hpp b/src/vm/assembly.hpp index 7dde928125..da82001b32 100644 --- a/src/vm/assembly.hpp +++ b/src/vm/assembly.hpp @@ -18,10 +18,6 @@ #include "ceeload.h" #include "exceptmacros.h" #include "clsload.hpp" -#ifdef FEATURE_FUSION -#include "fusion.h" -#include "fusionbind.h" -#endif #include "eehash.h" #include "listlock.h" #include "iceefilegen.h" @@ -565,10 +561,6 @@ public: #ifdef FEATURE_LOADER_OPTIMIZATION BOOL MissingDependenciesCheckDone(); void SetMissingDependenciesCheckDone(); -#ifdef FEATURE_FUSION - void SetBindingClosure(IAssemblyBindingClosure* pClosure); // Addrefs. It is assumed the caller did not addref pClosure for us. - IAssemblyBindingClosure* GetBindingClosure(); -#endif #endif // FEATURE_LOADER_OPTIMIZATION void SetDomainNeutral() { LIMITED_METHOD_CONTRACT; m_fIsDomainNeutral = TRUE; } @@ -585,31 +577,6 @@ public: HCEEFILE ceeFile); HRESULT SignWithStrongName(LPCWSTR wszFileName); -#ifdef FEATURE_FUSION - IAssembly* GetFusionAssembly() - { - WRAPPER_NO_CONTRACT; - return m_pManifestFile->GetFusionAssembly(); - } - - IAssemblyName* GetFusionAssemblyName() - { - WRAPPER_NO_CONTRACT; - return m_pManifestFile->GetFusionAssemblyName(); - } - - IAssemblyName* GetFusionAssemblyNameNoCreate() - { - WRAPPER_NO_CONTRACT; - return m_pManifestFile->GetFusionAssemblyNameNoCreate(); - } - - IHostAssembly* GetIHostAssembly() - { - WRAPPER_NO_CONTRACT; - return m_pManifestFile->GetIHostAssembly(); - } -#endif// FEATURE_FUSION #ifdef FEATURE_COMINTEROP // Get any cached ITypeLib* for the assembly. @@ -824,9 +791,6 @@ private: BOOL m_fIsDomainNeutral; #ifdef FEATURE_LOADER_OPTIMIZATION BOOL m_bMissingDependenciesCheckDone; -#ifdef FEATURE_FUSION - IAssemblyBindingClosure * m_pBindingClosure; -#endif #endif // FEATURE_LOADER_OPTIMIZATION DebuggerAssemblyControlFlags m_debuggerFlags; @@ -895,13 +859,8 @@ public: } private: -#ifdef FEATURE_FUSION - typedef IAssemblyName FriendAssemblyName_t; - typedef NonVMComHolder<IAssemblyName> FriendAssemblyNameHolder; -#else // FEATURE_FUSION typedef AssemblySpec FriendAssemblyName_t; typedef NewHolder<AssemblySpec> FriendAssemblyNameHolder; -#endif // FEATURE_FUSION ArrayList m_alFullAccessFriendAssemblies; // Friend assemblies which have access to all internals ArrayList m_subjectAssemblies; // Subject assemblies which we will not perform access checks against diff --git a/src/vm/assemblyname.cpp b/src/vm/assemblyname.cpp index 686527f8c2..a7cf2ec250 100644 --- a/src/vm/assemblyname.cpp +++ b/src/vm/assemblyname.cpp @@ -22,9 +22,6 @@ #include "assemblyname.hpp" #include "security.h" #include "field.h" -#ifdef FEATURE_FUSION -#include "fusion.h" -#endif #include "strongname.h" #include "eeconfig.h" @@ -106,14 +103,10 @@ FCIMPL1(Object*, AssemblyNameNative::ToString, Object* refThisUNSAFE) spec.InitializeSpec(&(pThread->m_MarshalAlloc), (ASSEMBLYNAMEREF*) &pThis, FALSE, FALSE); StackSString name; -#ifndef FEATURE_FUSION spec.GetFileOrDisplayName(ASM_DISPLAYF_VERSION | ASM_DISPLAYF_CULTURE | ASM_DISPLAYF_PUBLIC_KEY_TOKEN, name); -#else - spec.GetFileOrDisplayName(0, name); -#endif // FEATURE_FUSION pObj = (OBJECTREF) StringObject::NewString(name); @@ -242,18 +235,7 @@ FCIMPL3(FC_BOOL_RET, AssemblyNameNative::ReferenceMatchesDefinition, AssemblyNam AssemblySpec defSpec; defSpec.InitializeSpec(&(pThread->m_MarshalAlloc), (ASSEMBLYNAMEREF*) &gc.pDef, fParse, FALSE); -#ifdef FEATURE_FUSION - SafeComHolder<IAssemblyName> pRefName (NULL); - IfFailThrow(refSpec.CreateFusionName(&pRefName, FALSE)); - - SafeComHolder <IAssemblyName> pDefName (NULL); - IfFailThrow(defSpec.CreateFusionName(&pDefName, FALSE)); - - // Order matters: Ref->IsEqual(Def) - result = (S_OK == pRefName->IsEqual(pDefName, ASM_CMPF_IL_ALL)); -#else result=AssemblySpec::RefMatchesDef(&refSpec,&defSpec); -#endif HELPER_METHOD_FRAME_END(); FC_RETURN_BOOL(result); } diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index a896313943..7175b156f0 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -18,11 +18,6 @@ #include <shlwapi.h> #include <stdlib.h> -#ifdef FEATURE_FUSION -#include "actasm.h" -#include "appctx.h" -#include "asm.h" -#endif #include "assemblynative.hpp" #include "dllimport.h" #include "field.h" @@ -37,94 +32,11 @@ #include "appdomainhelper.h" #endif #include "stackprobe.h" -#ifdef FEATURE_FUSION -#include "dbglog.h" -#include "bindinglog.hpp" -#include "policy.h" -#endif #include "appdomainnative.hpp" #include "../binder/inc/clrprivbindercoreclr.h" -#ifdef FEATURE_FUSION -//---------------------------------------------------------------------------------------------------- -// Allows managed code in mscorlib to find out whether an assembly name corresponds to mscorlib, -// a .NET Framework assembly found in the unification list (see fxretarget.h), or a portable assembly (see portabilityPolicy.cpp) -// See Fusion::Util::IsAnyFrameworkAssembly for more details. -// The NGEN task uses this function (via System.Reflection.RuntimeAssembly.IsFrameworkAssembly) -FCIMPL1(FC_BOOL_RET, AssemblyNative::IsFrameworkAssembly, AssemblyNameBaseObject* refAssemblyNameUNSAFE) -{ - FCALL_CONTRACT; - - struct _gc - { - ASSEMBLYNAMEREF assemblyName; - } gc; - gc.assemblyName = (ASSEMBLYNAMEREF) refAssemblyNameUNSAFE; - - BOOL bIsFxAssembly = FALSE; - - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - AssemblySpec spec; - - Thread *pThread = GetThread(); - CheckPointHolder cph(pThread->m_MarshalAlloc.GetCheckpoint()); //hold checkpoint for autorelease - - spec.InitializeSpec(&(pThread->m_MarshalAlloc), - &gc.assemblyName, - FALSE, /*fIsStringized*/ - FALSE /*fForIntrospection*/ - ); - ReleaseHolder<IAssemblyName> pIAssemblyName; - IfFailThrow(spec.CreateFusionName(&pIAssemblyName,FALSE)); - - bIsFxAssembly = (IfFailThrow(Fusion::Util::IsAnyFrameworkAssembly(pIAssemblyName)) == S_OK); - HELPER_METHOD_FRAME_END(); - - FC_RETURN_BOOL(bIsFxAssembly); -} -FCIMPLEND -#endif // FEATURE_FUSION - -#ifdef FEATURE_FUSION -//---------------------------------------------------------------------------------------------------- -FCIMPL1(FC_BOOL_RET, AssemblyNative::IsNewPortableAssembly, AssemblyNameBaseObject* refAssemblyNameUNSAFE) -{ - FCALL_CONTRACT; - - struct _gc - { - ASSEMBLYNAMEREF assemblyName; - } gc; - gc.assemblyName = (ASSEMBLYNAMEREF) refAssemblyNameUNSAFE; - - BOOL fIsPortable = FALSE; - - HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc); - - AssemblySpec spec; - Thread *pThread = GetThread(); - CheckPointHolder cph(pThread->m_MarshalAlloc.GetCheckpoint()); //hold checkpoint for autorelease - - { - GCX_COOP(); - spec.InitializeSpec(&(pThread->m_MarshalAlloc), - &gc.assemblyName, - FALSE, /*fIsStringized*/ - FALSE /*fForIntrospection*/); - } - - ReleaseHolder<IAssemblyName> pIAssemblyName; - IfFailThrow(spec.CreateFusionName(&pIAssemblyName,FALSE)); - - fIsPortable = (IfFailThrow(Fusion::Util::IsNewPortableAssembly(pIAssemblyName)) == S_OK); - HELPER_METHOD_FRAME_END(); - - FC_RETURN_BOOL(fIsPortable); -} -FCIMPLEND -#endif // FEATURE_FUSION FCIMPL10(Object*, AssemblyNative::Load, AssemblyNameBaseObject* assemblyNameUNSAFE, StringObject* codeBaseUNSAFE, @@ -501,12 +413,6 @@ FCIMPL6(Object*, AssemblyNative::LoadImage, U1Array* PEByteArrayUNSAFE, pAssembly = LoadFromBuffer(fForIntrospection, pbImage, cbImage, pbSyms, cbSyms, stackMark, OBJECTREFToObject(gc.security), securityContextSource); } -#ifdef FEATURE_FUSION - if (!fForIntrospection && IsLoggingNeeded()) - { - BinderLogging::BindingLog::LogLoadByteArray(GetAppDomain()->GetFusionContext(), pAssembly); - } -#endif if (pAssembly != NULL) gc.refRetVal = pAssembly->GetExposedObject(); @@ -542,67 +448,7 @@ FCIMPL2(Object*, AssemblyNative::LoadFile, StringObject* pathUNSAFE, Object* sec StackSString path; gc.strPath->GetSString(path); -#ifdef FEATURE_FUSION // use BindResult for abstraction - // Event Tracing for Windows is used to log data for performance and functional testing purposes. - // The events in this function are used to help measure the performance of assembly loading as a whole when loading directly from a file, - // of binding to an assembly, as well as of lookup scenarios such as from a host store. - FireEtwLoaderPhaseStart(ETWAppDomainIdNotAvailable, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderDynamicLoad, path, NULL, GetClrInstanceId()); - SafeComHolder<IAssembly> pFusionAssembly; - SafeComHolder<IBindResult> pNativeFusionAssembly; - SafeComHolder<IFusionBindLog> pFusionLog; - - PEAssemblyHolder pFile; - FireEtwBindingPhaseStart(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, path, NULL, GetClrInstanceId()); - - if(GetAppDomain()->HasLoadContextHostBinder()) - { - GCX_PREEMP(); - CLRPrivBinderLoadFile* pLFBinder = CLRPrivBinderLoadFile::GetOrCreateBinder(); - ReleaseHolder<PEImage> pImage(PEImage::OpenImage(path)); - ReleaseHolder<ICLRPrivAssembly> pAsm; - ReleaseHolder<IAssemblyName> pAssemblyName; - IfFailThrow(pLFBinder->BindAssemblyExplicit(pImage, &pAssemblyName, &pAsm)); - IfFailThrow(GetAppDomain()->BindHostedPrivAssembly(nullptr, pAsm, pAssemblyName, &pFile)); - _ASSERTE(pFile); - } - else - { - GCX_PREEMP(); - IfFailThrow(ExplicitBind(path, GetAppDomain()->GetFusionContext(), - EXPLICITBIND_FLAGS_NON_BINDABLE, - NULL, &pFusionAssembly, &pNativeFusionAssembly, &pFusionLog)); - pFile.Assign(PEAssembly::Open(pFusionAssembly, pNativeFusionAssembly, pFusionLog, FALSE, FALSE)); - } - - FireEtwBindingLookupAndProbingPhaseEnd(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, path, NULL, GetClrInstanceId()); - - FireEtwBindingPhaseEnd(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, path, NULL, GetClrInstanceId()); - - AssemblyLoadSecurity loadSecurity; - loadSecurity.m_pAdditionalEvidence = &gc.refSecurity; - loadSecurity.m_fCheckLoadFromRemoteSource = true; - - // If we're in an APPX domain, then all loads from the application will find themselves within the APPX package - // graph or from a trusted location. However, assemblies within the package may have been marked by Windows as - // not being from the MyComputer zone, which can trip the LoadFromRemoteSources check. Since we do not need to - // defend against accidental loads from HTTP for APPX applications, we simply suppress the remote load check. - if (AppX::IsAppXProcess()) - { - loadSecurity.m_fCheckLoadFromRemoteSource = false; - } - - Assembly *pAssembly = GetPostPolicyAssembly(pFile, FALSE, &loadSecurity); - - FireEtwLoaderPhaseEnd(ETWAppDomainIdNotAvailable, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderDynamicLoad, path, NULL, GetClrInstanceId()); - - if (IsLoggingNeeded()) - { - BinderLogging::BindingLog::LogLoadFile(GetAppDomain()->GetFusionContext(), path, pAssembly); - } - -#else // FEATURE_FUSION Assembly *pAssembly = AssemblySpec::LoadAssembly(path); -#endif // FEATURE_FUSION LOG((LF_CLASSLOADER, LL_INFO100, @@ -917,60 +763,6 @@ Assembly* AssemblyNative::GetPostPolicyAssembly(PEAssembly *pFile, GCX_PREEMP(); -#ifdef FEATURE_FUSION - if (!fForIntrospection && !GetAppDomain()->HasLoadContextHostBinder()) { - DWORD dwSize = 0; - // if strongly named and not an exempt - BOOL bOptionallyRetargetable; - - IfFailThrow(IsOptionallyRetargetableAssembly(pFile->GetFusionAssemblyName(), &bOptionallyRetargetable)); - if ( !bOptionallyRetargetable && pFile->GetFusionAssemblyName()->GetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, NULL, &dwSize) == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) { - - SafeComHolder<IAssemblyName> pPostPolicyName(NULL); - HRESULT hr = PreBindAssembly(GetAppDomain()->GetFusionContext(), - pFile->GetFusionAssemblyName(), - NULL, // pAsmParent - &pPostPolicyName, - NULL); // pvReserved - if (FAILED(hr)) { - if (hr == FUSION_E_REF_DEF_MISMATCH) { - // Policy redirects to another version - AssemblySpec spec; - spec.InitializeSpec(pPostPolicyName, FALSE); - RETURN spec.LoadAssembly(FILE_LOADED, pLoadSecurity); - } - else - ThrowHR(hr); - } - else { - ReleaseHolder<IAssembly> pAsm; - - SafeComHolder<IAssemblyCache> pIAsmCache (NULL); - IfFailThrow(CreateAssemblyCache(&pIAsmCache, 0)); - - DWORD dwFlags = ASM_DISPLAYF_FULL; - - if (pFile->IsMarkedAsNoPlatform()) { // No Platform implies that the assembly is not tied to a specific machine architecture, which means we need to do full GAC probing. - hr = CreateAssemblyFromCacheLookup(GetAppDomain()->GetFusionContext(), pFile->GetFusionAssemblyName(), TRUE, &pAsm, NULL); - } - else { - SString sourceDisplay; - FusionBind::GetAssemblyNameDisplayName(pFile->GetFusionAssemblyName(), sourceDisplay, dwFlags); - hr = pIAsmCache->QueryAssemblyInfo(0, sourceDisplay, NULL); - } - - if (SUCCEEDED(hr)) { - // It's in the GAC - AssemblySpec spec; - spec.InitializeSpec(pFile->GetFusionAssemblyName(), FALSE); - RETURN spec.LoadAssembly(FILE_LOADED, pLoadSecurity); - } - else if (hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) - ThrowHR(hr); - } - } - } -#else // FEATURE_FUSION if (fIsLoadByteArray) { PEImage *pPEImage = pFile->GetILimage(); @@ -995,7 +787,6 @@ Assembly* AssemblyNative::GetPostPolicyAssembly(PEAssembly *pFile, ThrowHR(hr); } } -#endif // FEATURE_FUSION RETURN GetAppDomain()->LoadAssembly(NULL, pFile, FILE_LOADED, pLoadSecurity); } @@ -2062,26 +1853,6 @@ void QCALLTYPE AssemblyNative::GetImageRuntimeVersion(QCall::AssemblyHandle pAss END_QCALL; } -#ifdef FEATURE_FUSION -INT64 QCALLTYPE AssemblyNative::GetHostContext(QCall::AssemblyHandle pAssembly) -{ - QCALL_CONTRACT; - - UINT64 Context = 0; - - BEGIN_QCALL; - - IHostAssembly *pIHostAssembly = pAssembly->GetFile()->GetIHostAssembly(); - if (pIHostAssembly != NULL) - { - IfFailThrow(pIHostAssembly->GetAssemblyContext(&Context)); - } - - END_QCALL; - - return Context; -} -#endif // FEATURE_FUSION #ifdef FEATURE_APPX diff --git a/src/vm/assemblysink.cpp b/src/vm/assemblysink.cpp deleted file mode 100644 index 8fe33f5bf4..0000000000 --- a/src/vm/assemblysink.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Header: AssemblySink.cpp -** -** Purpose: Implements AssemblySink, event objects that block -** the current thread waiting for an asynchronous load -** of an assembly to succeed. -** -** - - -** -===========================================================*/ - -#include "common.h" -#ifdef FEATURE_FUSION -#include <stdlib.h> -#include "assemblysink.h" -#include "assemblyspec.hpp" -#include "corpriv.h" -#include "appdomain.inl" - -AssemblySink::AssemblySink(AppDomain* pDomain) -{ - WRAPPER_NO_CONTRACT; - m_Domain=pDomain->GetId(); - m_pSpec=NULL; - m_CheckCodebase = FALSE; -} - -void AssemblySink::Reset() -{ - CONTRACTL - { - INSTANCE_CHECK; - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - m_CheckCodebase = FALSE; - FusionSink::Reset(); -} - -ULONG AssemblySink::Release() -{ - CONTRACTL - { - INSTANCE_CHECK; - NOTHROW; - if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_TRIGGERS);} - MODE_ANY; - PRECONDITION(CheckPointer(this)); - } CONTRACTL_END; - - - ULONG cRef = InterlockedDecrement(&m_cRef); - if (!cRef) { - Reset(); - AssemblySink* ret = this; - // If we have a domain we keep a pool of one around. If we get an entry - // back from the pool then we were not added to the pool and need to be deleted. - // If we do not have a pool then we need to delete it. - - - - - // TODO: SetupThread may throw. What do we do with Release? - HRESULT hr = S_OK; - SetupThreadNoThrow(&hr); - { - GCX_COOP(); - - if(m_Domain.m_dwId) { - AppDomainFromIDHolder AD(m_Domain, TRUE); - if (!AD.IsUnloaded()) - ret = FastInterlockCompareExchangePointer(&(AD->m_pAsyncPool), - this, - NULL); - - } - } - - if(ret != NULL) - delete this; - } - return (cRef); -} - - - -STDMETHODIMP AssemblySink::OnProgress(DWORD dwNotification, - HRESULT hrNotification, - LPCWSTR szNotification, - DWORD dwProgress, - DWORD dwProgressMax, - LPVOID pvBindInfo, - IUnknown* punk) -{ - STATIC_CONTRACT_NOTHROW; - - HRESULT hr = S_OK; - - switch(dwNotification) { - - case ASM_NOTIFICATION_BIND_INFO: - FusionBindInfo *pBindInfo; - - pBindInfo = (FusionBindInfo *)pvBindInfo; - - if (pBindInfo && pBindInfo->pNamePolicy && m_pSpec) { - pBindInfo->pNamePolicy->AddRef(); - m_pSpec->SetNameAfterPolicy(pBindInfo->pNamePolicy); - } - break; - - default: - break; - } - - if (SUCCEEDED(hr)) - hr = FusionSink::OnProgress(dwNotification, hrNotification, szNotification, - dwProgress, dwProgressMax, pvBindInfo, punk); - - return hr; -} - - -HRESULT AssemblySink::Wait() -{ - STATIC_CONTRACT_NOTHROW; - - HRESULT hr = FusionSink::Wait(); - - if (FAILED(hr)) { - // If we get an exception then we will just release this sink. It may be the - // case that the appdomain was terminated. Other exceptions will cause the - // sink to be scavenged but this is ok. A new one will be generated for the - // next bind. - m_Domain.m_dwId = 0; - // The AssemblySpec passed is stack allocated in some cases. - // Remove reference to it to prevent AV in delayed fusion bind notifications. - m_pSpec = NULL; - } - - return hr; -} -#endif diff --git a/src/vm/assemblysink.h b/src/vm/assemblysink.h deleted file mode 100644 index 9293a65b11..0000000000 --- a/src/vm/assemblysink.h +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Header: AssemblySink.hpp -** -** Purpose: Asynchronous call back for loading classes -** -** - - -** -===========================================================*/ -#ifndef _ASSEMBLYSINK_H -#define _ASSEMBLYSINK_H - -#ifndef FEATURE_FUSION -#error FEATURE_FUSION is not enabled, please do not include assemblysink.h -#endif - -class AppDomain; - -class AssemblySink : public FusionSink -{ -public: - AssemblySink(AppDomain* pDomain); - ~AssemblySink() { WRAPPER_NO_CONTRACT; }; - - void Reset(); - - ULONG STDMETHODCALLTYPE Release(void); - - STDMETHODIMP OnProgress(DWORD dwNotification, - HRESULT hrNotification, - LPCWSTR szNotification, - DWORD dwProgress, - DWORD dwProgressMax, - LPVOID pvBindInfo, - IUnknown* punk); - - virtual HRESULT Wait(); - - void RequireCodebaseSecurityCheck() {LIMITED_METHOD_CONTRACT; m_CheckCodebase = TRUE;} - BOOL DoCodebaseSecurityCheck() {LIMITED_METHOD_CONTRACT; return m_CheckCodebase;} - void SetAssemblySpec(AssemblySpec* pSpec) - { - LIMITED_METHOD_CONTRACT; - m_pSpec=pSpec; - } - -private: - ADID m_Domain; // Which domain (index) do I belong to - AssemblySpec* m_pSpec; - BOOL m_CheckCodebase; -}; - -#endif diff --git a/src/vm/assemblyspec.cpp b/src/vm/assemblyspec.cpp index 00f0efd18f..13b1992b4a 100644 --- a/src/vm/assemblyspec.cpp +++ b/src/vm/assemblyspec.cpp @@ -18,21 +18,11 @@ #include <stdlib.h> -#ifdef FEATURE_FUSION -#include "actasm.h" -#include "appctx.h" -#endif #include "assemblyspec.hpp" #include "security.h" #include "eeconfig.h" #include "strongname.h" #include "strongnameholders.h" -#ifdef FEATURE_FUSION -#include "assemblysink.h" -#include "dbglog.h" -#include "bindinglog.hpp" -#include "assemblyfilehash.h" -#endif #include "mdaassistants.h" #include "eventtrace.h" @@ -261,41 +251,6 @@ HRESULT AssemblySpec::InitializeSpecInternal(mdToken kAssemblyToken, return hr; } // AssemblySpec::InitializeSpecInternal -#ifdef FEATURE_FUSION -void AssemblySpec::InitializeSpec(IAssemblyName *pName, - DomainAssembly *pStaticParent /*=NULL*/ , - BOOL fIntrospectionOnly /*=FALSE*/ ) -{ - CONTRACTL - { - INSTANCE_CHECK; - GC_TRIGGERS; - THROWS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - // Normalize this boolean as it tends to be used for comparisons - m_fIntrospectionOnly = !!fIntrospectionOnly; - IfFailThrow(Init(pName)); - - // For static binds, we cannot reference a strongly named assembly from a weakly named one. - // (Note that this constraint doesn't apply to dynamic binds which is why this check is - // not farther down the stack.) - - if (pStaticParent != NULL) { - if (pStaticParent->GetFile()->IsStrongNamed() && !IsStrongNamed()) - { - EEFileLoadException::Throw(this, FUSION_E_PRIVATE_ASM_DISALLOWED); - } - SetParentAssembly(pStaticParent); - } - - // Extract embedded WinRT name, if present. - ParseEncodedName(); -} -#endif //FEATURE_FUSION #ifdef FEATURE_MIXEDMODE void AssemblySpec::InitializeSpec(HMODULE hMod, @@ -388,146 +343,6 @@ void AssemblySpec::InitializeSpec(PEAssembly * pFile) #ifndef CROSSGEN_COMPILE // This uses thread storage to allocate space. Please use Checkpoint and release it. -#ifdef FEATURE_FUSION -HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* pName, - BOOL fParse /*=TRUE*/, BOOL fIntrospectionOnly /*=FALSE*/) -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - MODE_COOPERATIVE; - GC_TRIGGERS; - PRECONDITION(CheckPointer(alloc)); - PRECONDITION(CheckPointer(pName)); - PRECONDITION(IsProtectedByGCFrame(pName)); - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - // Simple name - if ((*pName)->GetSimpleName() != NULL) { - WCHAR* pString; - int iString; - ((STRINGREF) (*pName)->GetSimpleName())->RefInterpretGetStringValuesDangerousForGC(&pString, &iString); - DWORD lgth = WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, NULL, 0, NULL, NULL); - if (lgth + 1 < lgth) - ThrowHR(E_INVALIDARG); - LPSTR lpName = (LPSTR) alloc->Alloc(S_UINT32(lgth) + S_UINT32(1)); - WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, - lpName, lgth+1, NULL, NULL); - lpName[lgth] = '\0'; - m_pAssemblyName = lpName; - } - - if (fParse) { - HRESULT hr = ParseName(); - // Sometimes Fusion flags invalid characters in the name, sometimes it doesn't - // depending on where the invalid characters are - // We want to Raise the assembly resolve event on all invalid characters - // but calling ParseName before checking for invalid characters gives Fusion a chance to - // parse the rest of the name (to get a public key token, etc.) - if ((hr == FUSION_E_INVALID_NAME) || (!IsValidAssemblyName())) { - // This is the only case where we do not throw on an error - // We don't want to throw so as to give the caller a chance to call RaiseAssemblyResolveEvent - // The only caller that cares is System.Reflection.Assembly.InternalLoad which calls us through - // AssemblyNameNative::Init - return FUSION_E_INVALID_NAME; - } - else - IfFailThrow(hr); - } - else { - // Flags - m_dwFlags = (*pName)->GetFlags(); - - // Version - VERSIONREF version = (VERSIONREF) (*pName)->GetVersion(); - if(version == NULL) { - m_context.usMajorVersion = (USHORT)-1; - m_context.usMinorVersion = (USHORT)-1; - m_context.usBuildNumber = (USHORT)-1; - m_context.usRevisionNumber = (USHORT)-1; - } - else { - m_context.usMajorVersion = (USHORT)version->GetMajor(); - m_context.usMinorVersion = (USHORT)version->GetMinor(); - m_context.usBuildNumber = (USHORT)version->GetBuild(); - m_context.usRevisionNumber = (USHORT)version->GetRevision(); - } - - m_context.szLocale = 0; - - if ((*pName)->GetCultureInfo() != NULL) - { - struct _gc { - OBJECTREF cultureinfo; - STRINGREF pString; - } gc; - - gc.cultureinfo = (*pName)->GetCultureInfo(); - gc.pString = NULL; - - GCPROTECT_BEGIN(gc); - - MethodDescCallSite getName(METHOD__CULTURE_INFO__GET_NAME, &gc.cultureinfo); - - ARG_SLOT args[] = { - ObjToArgSlot(gc.cultureinfo) - }; - gc.pString = getName.Call_RetSTRINGREF(args); - if (gc.pString != NULL) { - WCHAR* pString; - int iString; - gc.pString->RefInterpretGetStringValuesDangerousForGC(&pString, &iString); - DWORD lgth = WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, NULL, 0, NULL, NULL); - LPSTR lpLocale = (LPSTR) alloc->Alloc(S_UINT32(lgth) + S_UINT32(1)); - WszWideCharToMultiByte(CP_UTF8, 0, pString, iString, - lpLocale, lgth+1, NULL, NULL); - lpLocale[lgth] = '\0'; - m_context.szLocale = lpLocale; - } - GCPROTECT_END(); - } - - // Strong name - // Note that we prefer to take a public key token if present, - // even if flags indicate a full public key - if ((*pName)->GetPublicKeyToken() != NULL) { - m_dwFlags &= ~afPublicKey; - PBYTE pArray = NULL; - pArray = (*pName)->GetPublicKeyToken()->GetDirectPointerToNonObjectElements(); - m_cbPublicKeyOrToken = (*pName)->GetPublicKeyToken()->GetNumComponents(); - m_pbPublicKeyOrToken = new (alloc) BYTE[m_cbPublicKeyOrToken]; - memcpy(m_pbPublicKeyOrToken, pArray, m_cbPublicKeyOrToken); - } - else if ((*pName)->GetPublicKey() != NULL) { - m_dwFlags |= afPublicKey; - PBYTE pArray = NULL; - pArray = (*pName)->GetPublicKey()->GetDirectPointerToNonObjectElements(); - m_cbPublicKeyOrToken = (*pName)->GetPublicKey()->GetNumComponents(); - m_pbPublicKeyOrToken = new (alloc) BYTE[m_cbPublicKeyOrToken]; - memcpy(m_pbPublicKeyOrToken, pArray, m_cbPublicKeyOrToken); - } - } - - // Hash for control - // <TODO>@TODO cts, can we use unsafe in this case!!!</TODO> - if ((*pName)->GetHashForControl() != NULL) - SetHashForControl((*pName)->GetHashForControl()->GetDataPtr(), - (*pName)->GetHashForControl()->GetNumComponents(), - (*pName)->GetHashAlgorithmForControl()); - - // Normalize this boolean as it tends to be used for comparisons - m_fIntrospectionOnly = !!fIntrospectionOnly; - - // Extract embedded WinRT name, if present. - ParseEncodedName(); - - return S_OK; -} - -#else // FEATURE_FUSION HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* pName, BOOL fParse /*=TRUE*/, BOOL fIntrospectionOnly /*=FALSE*/) { @@ -687,7 +502,6 @@ HRESULT AssemblySpec::InitializeSpec(StackingAllocator* alloc, ASSEMBLYNAMEREF* return S_OK; } -#endif // FEATURE_FUSION void AssemblySpec::AssemblyNameInit(ASSEMBLYNAMEREF* pAsmName, PEImage* pImageInfo) { @@ -851,213 +665,6 @@ void AssemblySpec::SetCodeBase(StackingAllocator* alloc, STRINGREF *pCodeBase) #endif // CROSSGEN_COMPILE -#ifdef FEATURE_FUSION - -/* static */ -void AssemblySpec::DemandFileIOPermission(PEAssembly *pFile) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(CheckPointer(pFile)); - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - // should have already checked permission if the codebase is set - if (!GetCodeBase()) { - - if (pFile->IsBindingCodeBase()) { - if (pFile->IsSourceDownloadCache()) { - StackSString check; - pFile->GetCodeBase(check); - - DemandFileIOPermission(check, FALSE, FILE_WEBPERM); - } - else - DemandFileIOPermission(pFile->GetPath(), TRUE, FILE_READANDPATHDISC); - } - } -} - -STDAPI RuntimeCheckLocationAccess(LPCWSTR wszLocation) -{ - - if (GetThread()==NULL) - return S_FALSE; - - CONTRACTL - { - NOTHROW; - MODE_ANY; - GC_TRIGGERS; - PRECONDITION(CheckPointer(wszLocation)); - } - CONTRACTL_END; - OVERRIDE_LOAD_LEVEL_LIMIT(FILE_ACTIVE); - HRESULT hr=S_OK; - DWORD dwDemand = 0; - - if (SString::_wcsnicmp(wszLocation, W("file"), 4)) - dwDemand = AssemblySpec::FILE_WEBPERM; - else - dwDemand = AssemblySpec::FILE_READANDPATHDISC; - - EX_TRY - { - AssemblySpec::DemandFileIOPermission(wszLocation, - FALSE, - dwDemand); - } - EX_CATCH_HRESULT(hr); - return hr; - -} - -/* static */ -void AssemblySpec::DemandFileIOPermission(LPCWSTR wszCodeBase, - BOOL fHavePath, - DWORD dwDemandFlag) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(CheckPointer(wszCodeBase)); - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - GCX_COOP(); - - MethodDescCallSite demandPermission(METHOD__ASSEMBLY__DEMAND_PERMISSION); - - STRINGREF codeBase = NULL; - GCPROTECT_BEGIN(codeBase); - - codeBase = StringObject::NewString(wszCodeBase); - ARG_SLOT args[3] = - { - ObjToArgSlot(codeBase), - BoolToArgSlot(fHavePath), - dwDemandFlag - }; - demandPermission.Call(args); - GCPROTECT_END(); -} - -BOOL AssemblySpec::FindAssemblyFile(AppDomain* pAppDomain, BOOL fThrowOnFileNotFound, - IAssembly** ppIAssembly, IHostAssembly **ppIHostAssembly, IBindResult** ppNativeFusionAssembly, - IFusionBindLog** ppFusionLog, HRESULT *pHRBindResult, StackCrawlMark *pCallerStackMark /* = NULL */, - AssemblyLoadSecurity *pLoadSecurity /* = NULL */) -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - MODE_ANY; - PRECONDITION(CheckPointer(pAppDomain)); - PRECONDITION(CheckPointer(pHRBindResult)); - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - GCX_PREEMP(); - - IApplicationContext *pFusionContext = pAppDomain->GetFusionContext(); - - AssemblySink* pSink = pAppDomain->AllocateAssemblySink(this); - SafeComHolderPreemp<IAssemblyBindSink> sinkholder(pSink); - - BOOL fSuppressSecurityChecks = pLoadSecurity != NULL && pLoadSecurity->m_fSuppressSecurityChecks; - - if (!GetCodeBase() && !fSuppressSecurityChecks) - pSink->RequireCodebaseSecurityCheck(); - - BOOL fIsWellKnown = FALSE; - HRESULT hr = S_OK; - - IfFailGo(AssemblySpec::LoadAssembly(pFusionContext, - pSink, - ppIAssembly, - ppIHostAssembly, - ppNativeFusionAssembly, - IsIntrospectionOnly(), - fSuppressSecurityChecks)); - - // Host should have already done appropriate permission demand - if (!(*ppIHostAssembly)) { - DWORD dwLocation; - IfFailGo((*ppIAssembly)->GetAssemblyLocation(&dwLocation)); - - fIsWellKnown = (dwLocation == ASMLOC_UNKNOWN); - - // check if it was cached, where a codebase had originally loaded it - if (pSink->DoCodebaseSecurityCheck() && - !fSuppressSecurityChecks && - (dwLocation & ASMLOC_CODEBASE_HINT)) { - if ((dwLocation & ASMLOC_LOCATION_MASK) == ASMLOC_DOWNLOAD_CACHE) { - StackSString codeBase; - SafeComHolderPreemp<IAssemblyName> pNameDef; - - // <TODO>We could be caching the IAssemblyName and codebase</TODO> - IfFailGo((*ppIAssembly)->GetAssemblyNameDef(&pNameDef)); - - FusionBind::GetAssemblyNameStringProperty(pNameDef, ASM_NAME_CODEBASE_URL, codeBase); - - DemandFileIOPermission(codeBase, FALSE, FILE_WEBPERM); - } - else if ((dwLocation & ASMLOC_LOCATION_MASK) != ASMLOC_GAC) { - StackSString path; - FusionBind::GetAssemblyManifestModulePath((*ppIAssembly), path); - - DemandFileIOPermission(path, TRUE, FILE_READANDPATHDISC); - } - } - - // Verify control hash - if (m_HashForControl.GetSize() > 0) { - StackSString path; - - FusionBind::GetAssemblyManifestModulePath((*ppIAssembly), path); - - AssemblyFileHash fileHash; - IfFailGo(fileHash.SetFileName(path)); - IfFailGo(fileHash.CalculateHash(m_dwHashAlg)); - - if (!m_HashForControl.Equals(fileHash.GetHash(), fileHash.GetHashSize())) - IfFailGo(FUSION_E_REF_DEF_MISMATCH); - } - } - -#ifdef MDA_SUPPORTED - MdaLoadFromContext* pProbe = MDA_GET_ASSISTANT(LoadFromContext); - if (pProbe) { - pProbe->NowLoading(ppIAssembly, pCallerStackMark); - } -#endif - - *ppFusionLog = pSink->m_pFusionLog; - if (*ppFusionLog) - (*ppFusionLog)->AddRef(); - return fIsWellKnown; - - ErrExit: - { - - *pHRBindResult = hr; - - if (fThrowOnFileNotFound || (!Assembly::FileNotFound(hr))) - EEFileLoadException::Throw(this, pSink->m_pFusionLog, hr); - } - - return FALSE; -} -#endif // FEATURE_FUSION void AssemblySpec::MatchRetargetedPublicKeys(Assembly *pAssembly) { @@ -1070,28 +677,6 @@ void AssemblySpec::MatchRetargetedPublicKeys(Assembly *pAssembly) PRECONDITION(CheckPointer(pAssembly)); } CONTRACTL_END; -#ifdef FEATURE_FUSION - GCX_PREEMP(); - - // Manually apply fusion policy to obtain retargeted public key - SafeComHolderPreemp<IAssemblyName> pRequestedAssemblyName(NULL); - SafeComHolderPreemp<IAssemblyName> pPostPolicyAssemblyName(NULL); - IfFailThrow(CreateFusionName(&pRequestedAssemblyName)); - HRESULT hr = PreBindAssembly(GetAppDomain()->GetFusionContext(), - pRequestedAssemblyName, - NULL, // pAsmParent - &pPostPolicyAssemblyName, - NULL // pvReserved - ); - if (SUCCEEDED(hr) - || (FAILED(hr) && (hr == FUSION_E_REF_DEF_MISMATCH))) { - IAssemblyName *pResultAssemblyName = pAssembly->GetFusionAssemblyName(); - if (pResultAssemblyName - && pPostPolicyAssemblyName - && pResultAssemblyName->IsEqual(pPostPolicyAssemblyName, ASM_CMPF_PUBLIC_KEY_TOKEN) == S_OK) - return; - } -#endif // FEATURE_FUSION ThrowHR(FUSION_E_REF_DEF_MISMATCH); } @@ -1164,11 +749,6 @@ PEAssembly *AssemblySpec::ResolveAssemblyFile(AppDomain *pDomain, BOOL fPreBind) Assembly *pAssembly = pDomain->RaiseAssemblyResolveEvent(this, IsIntrospectionOnly(), fPreBind); if (pAssembly != NULL) { -#ifdef FEATURE_FUSION - if (!IsIntrospectionOnly() && IsLoggingNeeded()) { - BinderLogging::BindingLog::CacheResultOfAssemblyResolveEvent(pDomain->GetFusionContext(), GetParentLoadContext(), pAssembly); - } -#endif PEAssembly *pFile = pAssembly->GetManifestFile(); pFile->AddRef(); @@ -1457,7 +1037,6 @@ Assembly *AssemblySpec::LoadAssembly(LPCWSTR pFilePath) RETURN spec.LoadAssembly(FILE_LOADED); } -#ifndef FEATURE_FUSION HRESULT AssemblySpec::CheckFriendAssemblyName() { WRAPPER_NO_CONTRACT; @@ -1475,7 +1054,6 @@ HRESULT AssemblySpec::CheckFriendAssemblyName() return S_OK; } } -#endif //FEATURE_FUSION HRESULT AssemblySpec::EmitToken( IMetaDataAssemblyEmit *pEmit, @@ -2241,12 +1819,6 @@ BOOL DomainAssemblyCache::CompareBindingSpec(UPTR spec1, UPTR spec2) AssemblySpec* pSpec1 = (AssemblySpec*) (spec1 << 1); AssemblyEntry* pEntry2 = (AssemblyEntry*) spec2; -#if defined(FEATURE_FUSION) - AssemblySpec* pSpec2 = &pEntry2->spec; - _ASSERTE(pSpec1->GetAppDomain() == pSpec2->GetAppDomain()); - if (pSpec1->GetAppDomain()->HasLoadContextHostBinder()) - return (CLRPrivBinderUtil::CompareHostBinderSpecs(pSpec1,pSpec2)); -#endif if ((!pSpec1->CompareEx(&pEntry2->spec)) || @@ -2324,31 +1896,6 @@ VOID DomainAssemblyCache::InsertEntry(AssemblySpec* pSpec, LPVOID pData1, LPVOID } -#ifdef FEATURE_FUSION - -IAssembly * AssemblySpec::GetParentIAssembly() -{ - LIMITED_METHOD_CONTRACT; - if(m_pParentAssembly) - return m_pParentAssembly->GetFile()->GetFusionAssembly(); - - return NULL; -} - -LPCVOID AssemblySpec::GetParentAssemblyPtr() -{ - LIMITED_METHOD_CONTRACT; - if(m_pParentAssembly) - { - if (m_pParentAssembly->GetFile()->HasHostAssembly()) - return m_pParentAssembly->GetFile()->GetHostAssembly(); - else - return m_pParentAssembly->GetFile()->GetFusionAssembly(); - } - return NULL; -} - -#endif //FEATURE_FUSION diff --git a/src/vm/assemblyspec.hpp b/src/vm/assemblyspec.hpp index d2e2ab604b..48a6b459e2 100644 --- a/src/vm/assemblyspec.hpp +++ b/src/vm/assemblyspec.hpp @@ -17,9 +17,6 @@ #define _ASSEMBLYSPEC_H #include "hash.h" #include "memorypool.h" -#ifdef FEATURE_FUSION -#include "fusionbind.h" -#endif #include "assemblyspecbase.h" #include "domainfile.h" #include "genericstackprobe.h" @@ -90,11 +87,6 @@ class AssemblySpec : public BaseAssemblySpec } -#ifdef FEATURE_FUSION - virtual IAssembly* GetParentIAssembly(); - - virtual LPCVOID GetParentAssemblyPtr(); -#endif DomainAssembly* GetParentAssembly(); @@ -121,11 +113,6 @@ class AssemblySpec : public BaseAssemblySpec EEFileLoadException::Throw(this,hr); }; -#ifdef FEATURE_FUSION - void InitializeSpec(IAssemblyName *pName, - DomainAssembly *pStaticParent = NULL, - BOOL fIntrospectionOnly = FALSE); -#endif // FEATURE_FUSION void InitializeSpec(PEAssembly *pFile); HRESULT InitializeSpec(StackingAllocator* alloc, @@ -158,15 +145,6 @@ class AssemblySpec : public BaseAssemblySpec CONTRACTL_END; m_pParentAssembly = pAssembly; -#ifdef FEATURE_FUSION - if (pAssembly) - { - _ASSERTE(GetHostBinder() == nullptr); - m_fParentLoadContext=pAssembly->GetFile()->GetLoadContext(); - } - else - m_fParentLoadContext = LOADCTX_TYPE_DEFAULT; -#endif } void SetFallbackLoadContextBinderForRequestingAssembly(ICLRPrivBinder *pFallbackLoadContextBinder) @@ -222,9 +200,7 @@ class AssemblySpec : public BaseAssemblySpec } -#ifndef FEATURE_FUSION HRESULT CheckFriendAssemblyName(); -#endif // FEATURE_FUSION HRESULT EmitToken(IMetaDataAssemblyEmit *pEmit, @@ -240,15 +216,8 @@ class AssemblySpec : public BaseAssemblySpec FILE_WEBPERM = 0x3 }; -#ifdef FEATURE_FUSION - static void DemandFileIOPermission(LPCWSTR wszCodeBase, - BOOL fHavePath, - DWORD dwDemandFlag); - void DemandFileIOPermission(PEAssembly *pFile); -#endif -#ifndef FEATURE_FUSION VOID Bind( AppDomain* pAppDomain, BOOL fThrowOnFileNotFound, @@ -256,7 +225,6 @@ class AssemblySpec : public BaseAssemblySpec BOOL fNgenExplicitBind = FALSE, BOOL fExplicitBindToNativeImage = FALSE, StackCrawlMark *pCallerStackMark = NULL ); -#endif Assembly *LoadAssembly(FileLoadLevel targetLevel, AssemblyLoadSecurity *pLoadSecurity = NULL, @@ -278,27 +246,10 @@ class AssemblySpec : public BaseAssemblySpec DWORD cbPublicKeyOrToken, DWORD dwFlags); -#ifdef FEATURE_FUSION - //**************************************************************************************** - // - HRESULT LoadAssembly(IApplicationContext *pFusionContext, - FusionSink *pSink, - IAssembly** ppIAssembly, - IHostAssembly** ppIHostAssembly, - IBindResult **ppNativeFusionAssembly, - BOOL fForIntrospectionOnly, - BOOL fSuppressSecurityChecks); -#endif // Load an assembly based on an explicit path static Assembly *LoadAssembly(LPCWSTR pFilePath); -#ifdef FEATURE_FUSION - BOOL FindAssemblyFile(AppDomain *pAppDomain, BOOL fThrowOnFileNotFound, - IAssembly** ppIAssembly, IHostAssembly **ppIHostAssembly, IBindResult** pNativeFusionAssembly, - IFusionBindLog **ppFusionLog, HRESULT *pHRBindResult, StackCrawlMark *pCallerStackMark = NULL, - AssemblyLoadSecurity *pLoadSecurity = NULL); -#endif // FEATURE_FUSION private: void MatchRetargetedPublicKeys(Assembly *pAssembly); diff --git a/src/vm/assemblyspecbase.h b/src/vm/assemblyspecbase.h index a52df06009..3442c9184e 100644 --- a/src/vm/assemblyspecbase.h +++ b/src/vm/assemblyspecbase.h @@ -16,11 +16,9 @@ #ifndef __ASSEMBLY_SPEC_BASE_H__ #define __ASSEMBLY_SPEC_BASE_H__ -#ifndef FEATURE_FUSION #include "coreclr/corebindresult.h" #include "coreclr/corebindresult.inl" #include "../binder/inc/assembly.hpp" -#endif // FEATURE_FUSION #include "baseassemblyspec.h" #include "baseassemblyspec.inl" diff --git a/src/vm/baseassemblyspec.cpp b/src/vm/baseassemblyspec.cpp index 09297f6db7..fdaa981523 100644 --- a/src/vm/baseassemblyspec.cpp +++ b/src/vm/baseassemblyspec.cpp @@ -228,7 +228,6 @@ VOID BaseAssemblySpec::ConvertPublicKeyToToken() m_dwFlags &= ~afPublicKey; } -#ifndef FEATURE_FUSION // Similar to BaseAssemblySpec::CompareEx, but allows the ref to be partially specified // Returns TRUE if ref matches def, FALSE otherwise. // @@ -358,7 +357,6 @@ BOOL BaseAssemblySpec::RefMatchesDef(const BaseAssemblySpec* pRef, const BaseAss return (CompareStrings(pRef->GetName(), pDef->GetName())==0); } } -#endif // FEATURE_FUSION //=========================================================================================== // This function may embed additional information, if required. @@ -679,21 +677,9 @@ HRESULT BaseAssemblySpec::CreateFusionName( } } else { -#ifdef FEATURE_FUSION - IfFailGo(pFusionAssemblyName->SetProperty(ASM_NAME_NULL_PUBLIC_KEY_TOKEN, - NULL, 0)); -#endif } } -#ifdef FEATURE_FUSION - // See if the assembly[ref] is retargetable (ie, for a generic assembly). - if (IsAfRetargetable(m_dwFlags)) { - BOOL bTrue = TRUE; - IfFailGo(pFusionAssemblyName->SetProperty(ASM_NAME_RETARGET, - &bTrue, sizeof(bTrue))); - } -#endif // Set the Processor Architecture (if any) { @@ -719,15 +705,7 @@ HRESULT BaseAssemblySpec::CreateFusionName( } } -#ifdef FEATURE_FUSION - if (fIncludeCodeBase && m_wszCodeBase) { - IfFailGo(pFusionAssemblyName->SetProperty(ASM_NAME_CODEBASE_URL, - (void*)m_wszCodeBase, - (DWORD)(wcslen(m_wszCodeBase)+1) * sizeof(WCHAR))); - } -#else _ASSERTE(m_wszCodeBase == NULL); -#endif *ppName = pFusionAssemblyName; diff --git a/src/vm/baseassemblyspec.h b/src/vm/baseassemblyspec.h index d27c90fb98..9381157f7a 100644 --- a/src/vm/baseassemblyspec.h +++ b/src/vm/baseassemblyspec.h @@ -27,10 +27,6 @@ protected: DWORD m_cbPublicKeyOrToken; DWORD m_dwFlags; // CorAssemblyFlags LPCWSTR m_wszCodeBase; // URL to the code -#ifdef FEATURE_FUSION - LOADCTX_TYPE m_fParentLoadContext; // m_pParentAssembly->GetFusionLoadContext() - ReleaseHolder<IAssemblyName> m_pNameAfterPolicy; -#endif LPCSTR m_szWinRtTypeNamespace; LPCSTR m_szWinRtTypeClassName; ICLRPrivBinder *m_pHostBinder; @@ -146,19 +142,6 @@ public: BOOL fIncludeCodeBase = TRUE, /* Used by fusion only */ BOOL fMustBeBindable = FALSE) const; -#ifdef FEATURE_FUSION - // for fusion binding - virtual IAssembly* GetParentIAssembly() =0; - - // for identity comparison - virtual LPCVOID GetParentAssemblyPtr() =0; - - inline LOADCTX_TYPE GetParentLoadContext() - { - LIMITED_METHOD_CONTRACT; - return m_fParentLoadContext; - } -#endif BOOL IsIntrospectionOnly() { @@ -249,48 +232,6 @@ public: return IsAfRetargetable(m_dwFlags); } -#ifdef FEATURE_FUSION - inline IAssemblyName* GetNameAfterPolicy() const - { - LIMITED_METHOD_CONTRACT; - return m_pNameAfterPolicy; - } - - inline void ReleaseNameAfterPolicy() - { - LIMITED_METHOD_CONTRACT; - m_pNameAfterPolicy=NULL; - } - - inline void SetNameAfterPolicy(IAssemblyName* pName) - { - LIMITED_METHOD_CONTRACT; - m_pNameAfterPolicy=pName; - } - - - void SetPEKIND(PEKIND peKind) - { - LIMITED_METHOD_CONTRACT; - C_ASSERT(afPA_None == PAFlag(peNone)); - C_ASSERT(afPA_MSIL == PAFlag(peMSIL)); - C_ASSERT(afPA_x86 == PAFlag(peI386)); - C_ASSERT(afPA_IA64 == PAFlag(peIA64)); - C_ASSERT(afPA_AMD64 == PAFlag(peAMD64)); - C_ASSERT(afPA_ARM == PAFlag(peARM)); - - _ASSERTE((peKind <= peARM) || (peKind == peInvalid)); - - m_dwFlags &= ~afPA_FullMask; - m_dwFlags |= PAFlag(peKind); - } - - PEKIND GetPEKIND() const - { - LIMITED_METHOD_CONTRACT; - return static_cast<PEKIND>(PAIndex(m_dwFlags)); - } -#endif //FEATURE_FUSION protected: static BOOL CompareRefToDef(const BaseAssemblySpec *pRef, const BaseAssemblySpec *pDef); diff --git a/src/vm/baseassemblyspec.inl b/src/vm/baseassemblyspec.inl index 63107c6208..5205056c14 100644 --- a/src/vm/baseassemblyspec.inl +++ b/src/vm/baseassemblyspec.inl @@ -265,14 +265,6 @@ inline void BaseAssemblySpec::CopyFrom(const BaseAssemblySpec *pSpec) m_ownedFlags |= BAD_NAME_OWNED; } -#ifdef FEATURE_FUSION - IAssemblyName* pNameAfterPolicy=pSpec->GetNameAfterPolicy(); - if (pNameAfterPolicy) - { - pNameAfterPolicy->AddRef(); - SetNameAfterPolicy(pNameAfterPolicy); - } -#endif m_pBindingContext = pSpec->m_pBindingContext; @@ -339,9 +331,6 @@ inline DWORD BaseAssemblySpec::Hash() hash = _rotl(hash, 4); } -#ifdef FEATURE_FUSION - hash ^= (m_fParentLoadContext == LOADCTX_TYPE_LOADFROM); -#endif return hash; } @@ -360,12 +349,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare } // Compare fields -#ifdef FEATURE_FUSION - BOOL fIsInLoadFromContext = (m_fParentLoadContext == LOADCTX_TYPE_LOADFROM); - BOOL fSpecIsInLoadFromContext = (pSpec->m_fParentLoadContext == LOADCTX_TYPE_LOADFROM); - if (fIsInLoadFromContext != fSpecIsInLoadFromContext) - return FALSE; -#endif if (m_pAssemblyName != pSpec->m_pAssemblyName && (m_pAssemblyName == NULL || pSpec->m_pAssemblyName == NULL @@ -403,19 +386,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare || strcmp(m_context.szLocale, pSpec->m_context.szLocale))) return FALSE; -#ifdef FEATURE_FUSION - if (!IsIntrospectionOnly() && !pSpec->IsIntrospectionOnly()) { - // Post-policy load-neither binds can be picked up by nobody - // except their own parent assembly. This only applies to executable assemblies. - BOOL bParentsMustMatch; - - // doesn't need the check if one is in load context - bParentsMustMatch = (m_fParentLoadContext == LOADCTX_TYPE_UNKNOWN && pSpec->m_fParentLoadContext == LOADCTX_TYPE_UNKNOWN); - - if ( bParentsMustMatch && GetParentAssemblyPtr() != pSpec->GetParentAssemblyPtr()) - return FALSE; - } -#endif // If the assemblySpec contains the binding context, then check if they match. if (!(pSpec->IsAssemblySpecForMscorlib() && IsAssemblySpecForMscorlib())) diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index ea1a0402ee..4a03927ee4 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -3842,103 +3842,6 @@ void Module::ReleaseILData(void) } -#ifdef FEATURE_FUSION - -// -// Module::FusionCopyPDBs asks Fusion to copy PDBs for a given -// assembly if they need to be copied. This is for the case where a PE -// file is shadow copied to the Fusion cache. Fusion needs to be told -// to take the time to copy the PDB, too. -// -STDAPI CopyPDBs(IAssembly *pAsm); // private fusion API -void Module::FusionCopyPDBs(LPCWSTR moduleName) -{ - CONTRACTL - { - INSTANCE_CHECK; - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - Assembly *pAssembly = GetAssembly(); - - // Just return if we've already done this for this Module's - // Assembly. - if ((pAssembly->GetDebuggerInfoBits() & DACF_PDBS_COPIED) || - (pAssembly->GetFusionAssembly() == NULL)) - { - LOG((LF_CORDB, LL_INFO10, - "Don't need to copy PDB's for module %S\n", - moduleName)); - - return; - } - - LOG((LF_CORDB, LL_INFO10, - "Attempting to copy PDB's for module %S\n", moduleName)); - - HRESULT hr; - hr = CopyPDBs(pAssembly->GetFusionAssembly()); - LOG((LF_CORDB, LL_INFO10, - "Fusion.dll!CopyPDBs returned hr=0x%08x for module 0x%08x\n", - hr, this)); - - // Remember that we've copied the PDBs for this assembly. - pAssembly->SetCopiedPDBs(); -} - -// This function will return PDB stream if exist. -// It is the caller responsibility to call release on *ppStream after a successful -// result. -// We will first check to see if we have a cached pdb stream available. If not, -// we will ask fusion which in terms to ask host vis HostProvideAssembly. Host may -// decide to provide one or not. -// -HRESULT Module::GetHostPdbStream(IStream **ppStream) -{ - CONTRACTL - { - NOTHROW; - if(GetThread()) {GC_TRIGGERS;} else {GC_NOTRIGGER;} - } - CONTRACTL_END - - HRESULT hr = NOERROR; - - _ASSERTE(ppStream); - - *ppStream = NULL; - - if (m_file->IsIStream() == false) - { - // not a host stream - return E_FAIL; - } - - // Maybe fusion can ask our host. This will give us back a PDB stream if - // host decides to provide one. - // - if (m_file->IsAssembly()) - { - GCX_PREEMP(); - hr = ((PEAssembly*)m_file)->GetIHostAssembly()->GetAssemblyDebugStream(ppStream); - } - else - { - _ASSERTE(m_file->IsModule()); - IHostAssemblyModuleImport *pIHAMI; - MAKE_WIDEPTR_FROMUTF8_NOTHROW(pName, m_file->GetSimpleName()); - if (pName == NULL) - return E_OUTOFMEMORY; - IfFailRet(m_file->GetAssembly()->GetIHostAssembly()->GetModuleByName(pName, &pIHAMI)); - hr = pIHAMI->GetModuleDebugStream(ppStream); - } - return hr; -} - -#endif //--------------------------------------------------------------------------------------- // @@ -4273,18 +4176,6 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void) pIStream->AddRef(); } } -#ifdef FEATURE_FUSION - else - { - // Verified this above. - _ASSERTE(m_file->IsIStream()); - - // Case 2: get assembly from host. - // This commonly would be cached already as GetInMemorySymbolStream() in code:Module.FetchPdbsFromHost, - // but may not be cached if the host didn't provide the PDBs at the time. - hr = GetHostPdbStream(&pIStream); - } -#endif if (SUCCEEDED(hr)) { hr = pBinder->GetReaderFromStream(GetRWImporter(), pIStream, &pReader); @@ -4298,9 +4189,6 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void) // Call Fusion to ensure that any PDB's are shadow copied before // trying to get a symbol reader. This has to be done once per // Assembly. -#ifdef FEATURE_FUSION - FusionCopyPDBs(path); -#endif // for this to work with winmds we cannot simply call GetRWImporter() as winmds are RO // and thus don't implement the RW interface. so we call this wrapper function which knows // how to get a IMetaDataImport interface regardless of the underlying module type. @@ -5813,10 +5701,6 @@ Module::GetAssemblyIfLoaded( BOOL eligibleForAdditionalChecks = TRUE; if (szWinRtNamespace != NULL) eligibleForAdditionalChecks = FALSE; // WinRT binds do not support this scan -#ifdef FEATURE_FUSION - else if ((this->GetAssembly()->GetManifestFile()->GetLoadContext() != LOADCTX_TYPE_DEFAULT) && (this->GetAssembly()->GetManifestFile()->GetLoadContext() != LOADCTX_TYPE_HOSTED)) - eligibleForAdditionalChecks = FALSE; // Only load and hosted context binds support this kind of discovery. -#endif // FEATURE_FUSION else if (this->GetAssembly()->GetManifestFile()->IsDesignerBindingContext()) { eligibleForAdditionalChecks = FALSE; @@ -7354,84 +7238,6 @@ void Module::UpdateDynamicMetadataIfNeeded() #ifdef DEBUGGING_SUPPORTED -#ifdef FEATURE_FUSION - -// Fetch Pdbs from the host -// -// Returns: -// No explicit return value. -// Caches the pdb stream on the module instance if available. -// Does nothing if not hosted or if the host does not provide a stream. -// Throws on exception if the host does provide a stream, but we can't copy it out. -// -// Notes: -// This fetches PDBs from the host and caches them so that they are available for when the debugger attaches. -// This lets Arrowhead tools run against Whidbey hosts in a compatibility mode. -// We expect to add a hosting knob that will allow a host to disable this eager fetching and not run in -// compat mode. -void Module::FetchPdbsFromHost() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - HRESULT hr; - - ReleaseHolder<IStream> pHostStream; - - hr = GetHostPdbStream(&pHostStream); // addrefs, holder will release - if (pHostStream == NULL) - { - // Common failure case, we're either not hosted, or the host doesn't have a stream. - return; - } - // pHostStream is a stream implemented by the host, so be extra cautious about methods failing, - // especially with E_NOTIMPL. - - SafeComHolder<CGrowableStream> pStream(new CGrowableStream()); // throws - - // - // Copy from pHostStream (owned by host) to CGrowableStream (owned by CLR, and visible to debugger from OOP). - // - - // Get number of bytes to copy. - STATSTG SizeData = {0}; - hr = pHostStream->Stat(&SizeData, STATFLAG_NONAME); - IfFailThrow(hr); - ULARGE_INTEGER streamSize = SizeData.cbSize; - - if (streamSize.u.HighPart > 0) - { - // Too big. We shouldn't have a PDB larger than 4gb. - ThrowHR(E_OUTOFMEMORY); - } - ULONG cbRequest = streamSize.u.LowPart; - - - // Allocate - hr = pStream->SetSize(streamSize); - IfFailThrow(hr); - - _ASSERTE(pStream->GetRawBuffer().Size() == cbRequest); - - // Do the actual copy - ULONG cbActualRead = 0; - hr = pHostStream->Read(pStream->GetRawBuffer().StartAddress(), cbRequest, &cbActualRead); - IfFailThrow(hr); - if (cbRequest != cbActualRead) - { - ThrowWin32(ERROR_READ_FAULT); - } - - // We now have a full copy of the PDB provided from the host. - // This addrefs pStream, which lets it survive past the holder's scope. - SetInMemorySymbolStream(pStream, eSymbolFormatPDB); -} -#endif // FEATURE_FUSION #endif // DEBUGGING_SUPPORTED @@ -7450,16 +7256,6 @@ BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainFile * pDomainFile, in pModule->UpdateDynamicMetadataIfNeeded(); } -#ifdef FEATURE_FUSION - // Eagerly fetch pdbs for hosted modules. - // This is only needed for debugging, so errors are not fatal in normal cases. - HRESULT hrFetchPdbs = S_OK; - EX_TRY - { - FetchPdbsFromHost(); - } - EX_CATCH_HRESULT(hrFetchPdbs); -#endif // FEATURE_FUSION // // Remaining work is only needed if a debugger is attached diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h index af06363e39..42023b3ec1 100644 --- a/src/vm/ceeload.h +++ b/src/vm/ceeload.h @@ -13,9 +13,6 @@ #define CEELOAD_H_ #include "common.h" -#ifdef FEATURE_FUSION -#include <fusion.h> -#endif #include "vars.hpp" // for LPCUTF8 #include "hash.h" #include "clsload.hpp" @@ -2181,11 +2178,6 @@ protected: virtual void ReleaseILData(); -#ifdef FEATURE_FUSION - void FusionCopyPDBs(LPCWSTR moduleName); - // This function will return PDB stream if exist. - HRESULT GetHostPdbStream(IStream **ppStream); -#endif // FEATURE_FUSION #endif // DACCESS_COMPILE diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 5b291965bc..850bee3f08 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -240,9 +240,7 @@ #include "interpreter.h" #endif // FEATURE_INTERPRETER -#ifndef FEATURE_FUSION #include "../binder/inc/coreclrbindercommon.h" -#endif // !FEATURE_FUSION #ifdef FEATURE_UEF_CHAINMANAGER // This is required to register our UEF callback with the UEF chain manager @@ -271,9 +269,6 @@ static HRESULT GetThreadUICultureNames(__inout StringArrayList* pCultureNames); #endif // !CROSSGEN_COMPILE HRESULT EEStartup(COINITIEE fFlags); -#ifdef FEATURE_FUSION -extern "C" HRESULT STDMETHODCALLTYPE InitializeFusion(); -#endif #ifdef FEATURE_MIXEDMODE HRESULT PrepareExecuteDLLForThunk(HINSTANCE hInst, @@ -782,15 +777,8 @@ void EEStartupHelper(COINITIEE fFlags) #endif // Fusion -#ifdef FEATURE_FUSION - { - ETWOnStartup (FusionInit_V1, FusionInitEnd_V1); - IfFailGoLog(InitializeFusion()); - } -#else // FEATURE_FUSION // Initialize the general Assembly Binder infrastructure IfFailGoLog(CCoreCLRBinderHelper::Init()); -#endif // FEATURE_FUSION if (g_pConfig != NULL) { diff --git a/src/vm/clrex.cpp b/src/vm/clrex.cpp index c8fc2f3886..6f8c157541 100644 --- a/src/vm/clrex.cpp +++ b/src/vm/clrex.cpp @@ -1717,11 +1717,7 @@ OBJECTREF EETypeLoadException::CreateThrowable() // EEFileLoadException is an EE exception subclass representing a file loading // error // --------------------------------------------------------------------------- -#ifdef FEATURE_FUSION -EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, IFusionBindLog *pFusionLog, Exception *pInnerException/* = NULL*/) -#else EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, void *pFusionLog, Exception *pInnerException/* = NULL*/) -#endif : EEException(GetFileLoadKind(hr)), m_name(name), m_pFusionLog(pFusionLog), @@ -1753,10 +1749,6 @@ EEFileLoadException::EEFileLoadException(const SString &name, HRESULT hr, void * m_name.Set(wszTemplate); } -#ifdef FEATURE_FUSION - if (m_pFusionLog != NULL) - m_pFusionLog->AddRef(); -#endif } @@ -1765,10 +1757,6 @@ EEFileLoadException::~EEFileLoadException() STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_GC_NOTRIGGER; -#ifdef FEATURE_FUSION - if (m_pFusionLog) - m_pFusionLog->Release(); -#endif } @@ -1880,19 +1868,6 @@ OBJECTREF EEFileLoadException::CreateThrowable() // Fetch any log info from the fusion log SString logText; -#ifdef FEATURE_FUSION - if (m_pFusionLog != NULL) - { - DWORD dwSize = 0; - HRESULT hr = m_pFusionLog->GetBindLog(0,0,NULL,&dwSize); - if (hr==HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - WCHAR *buffer = logText.OpenUnicodeBuffer(dwSize); - hr=m_pFusionLog->GetBindLog(0,0,buffer, &dwSize); - logText.CloseBuffer(); - } - } -#endif struct _gc { OBJECTREF pNewException; STRINGREF pNewFileString; @@ -1958,33 +1933,6 @@ BOOL EEFileLoadException::CheckType(Exception* ex) // <TODO>@todo: ideally we would use inner exceptions with these routines</TODO> /* static */ -#ifdef FEATURE_FUSION -void DECLSPEC_NORETURN EEFileLoadException::Throw(AssemblySpec *pSpec, IFusionBindLog *pFusionLog, HRESULT hr, Exception *pInnerException/* = NULL*/) -{ - CONTRACTL - { - GC_TRIGGERS; - THROWS; - MODE_ANY; - } - CONTRACTL_END; - - if (hr == COR_E_THREADABORTED) - COMPlusThrow(kThreadAbortException); - if (hr == E_OUTOFMEMORY) - COMPlusThrowOM(); -#ifdef FEATURE_COMINTEROP - if ((hr == RO_E_METADATA_NAME_NOT_FOUND) || (hr == CLR_E_BIND_TYPE_NOT_FOUND)) - { // These error codes behave like FileNotFound, but are exposed as TypeLoadException - EX_THROW_WITH_INNER(EETypeLoadException, (pSpec->GetWinRtTypeNamespace(), pSpec->GetWinRtTypeClassName(), nullptr, nullptr, IDS_EE_WINRT_LOADFAILURE), pInnerException); - } -#endif //FEATURE_COMINTEROP - - StackSString name; - pSpec->GetFileOrDisplayName(0, name); - EX_THROW_WITH_INNER(EEFileLoadException, (name, hr, pFusionLog), pInnerException); -} -#endif //FEATURE_FUSION /* static */ void DECLSPEC_NORETURN EEFileLoadException::Throw(AssemblySpec *pSpec, HRESULT hr, Exception *pInnerException/* = NULL*/) @@ -2070,41 +2018,6 @@ void DECLSPEC_NORETURN EEFileLoadException::Throw(LPCWSTR path, HRESULT hr, Exce } /* static */ -#ifdef FEATURE_FUSION -void DECLSPEC_NORETURN EEFileLoadException::Throw(IAssembly *pIAssembly, IHostAssembly *pIHostAssembly, HRESULT hr, Exception *pInnerException/* = NULL*/) -{ - CONTRACTL - { - GC_TRIGGERS; - THROWS; - MODE_ANY; - } - CONTRACTL_END; - - if (hr == COR_E_THREADABORTED) - COMPlusThrow(kThreadAbortException); - if (hr == E_OUTOFMEMORY || hr == HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY)) - COMPlusThrowOM(); - - StackSString name; - - { - SafeComHolder<IAssemblyName> pName; - - HRESULT newHr; - - if (pIAssembly) - newHr = pIAssembly->GetAssemblyNameDef(&pName); - else - newHr = pIHostAssembly->GetAssemblyNameDef(&pName); - - if (SUCCEEDED(newHr)) - FusionBind::GetAssemblyNameDisplayName(pName, name, 0); - } - - EX_THROW_WITH_INNER(EEFileLoadException, (name, hr), pInnerException); -} -#endif /* static */ void DECLSPEC_NORETURN EEFileLoadException::Throw(PEAssembly *parent, const void *memory, COUNT_T size, HRESULT hr, Exception *pInnerException/* = NULL*/) diff --git a/src/vm/clrex.h b/src/vm/clrex.h index 42cdf58825..15d1071fb9 100644 --- a/src/vm/clrex.h +++ b/src/vm/clrex.h @@ -679,21 +679,13 @@ class EEFileLoadException : public EEException private: SString m_name; -#ifdef FEATURE_FUSION - IFusionBindLog *m_pFusionLog; -#else void *m_pFusionLog; -#endif HRESULT m_hr; public: -#ifdef FEATURE_FUSION - EEFileLoadException(const SString &name, HRESULT hr, IFusionBindLog *pFusionLog = NULL, Exception *pInnerException = NULL); -#else EEFileLoadException(const SString &name, HRESULT hr, void *pFusionLog = NULL, Exception *pInnerException = NULL); -#endif ~EEFileLoadException(); // virtual overrides @@ -707,10 +699,6 @@ class EEFileLoadException : public EEException OBJECTREF CreateThrowable(); static RuntimeExceptionKind GetFileLoadKind(HRESULT hr); -#ifdef FEATURE_FUSION - static void DECLSPEC_NORETURN Throw(AssemblySpec *pSpec, IFusionBindLog *pFusionLog, HRESULT hr, Exception *pInnerException = NULL); - static void DECLSPEC_NORETURN Throw(IAssembly *pIAssembly, IHostAssembly *pIHostAssembly, HRESULT hr, Exception *pInnerException = NULL); -#endif static void DECLSPEC_NORETURN Throw(AssemblySpec *pSpec, HRESULT hr, Exception *pInnerException = NULL); static void DECLSPEC_NORETURN Throw(PEFile *pFile, HRESULT hr, Exception *pInnerException = NULL); static void DECLSPEC_NORETURN Throw(LPCWSTR path, HRESULT hr, Exception *pInnerException = NULL); diff --git a/src/vm/clrprivbinderappx.cpp b/src/vm/clrprivbinderappx.cpp index b55ece4556..2e5ca8580a 100644 --- a/src/vm/clrprivbinderappx.cpp +++ b/src/vm/clrprivbinderappx.cpp @@ -68,9 +68,6 @@ CLRPrivBinderAppX::CLRPrivBinderAppX(LPCWSTR * rgwzAltPath, UINT cAltPaths) } } -#ifdef FEATURE_FUSION - IfFailThrow(RuntimeCreateCachingILFingerprintFactory(&m_pFingerprintFactory)); -#endif } //===================================================================================================================== diff --git a/src/vm/clrprivbinderappx.h b/src/vm/clrprivbinderappx.h index 4b241e0cc5..db1ebec743 100644 --- a/src/vm/clrprivbinderappx.h +++ b/src/vm/clrprivbinderappx.h @@ -234,10 +234,6 @@ private: NewArrayHolder< WCHAR* > m_rgAltPaths; UINT m_cAltPaths; -#ifdef FEATURE_FUSION - BOOL m_fCanUseNativeImages; - ReleaseHolder<IILFingerprintFactory> m_pFingerprintFactory; -#endif //--------------------------------------------------------------------------------------------- // ParentBinder is set only in designer binding context (forms a chain of binders) diff --git a/src/vm/clrprivbinderutil.cpp b/src/vm/clrprivbinderutil.cpp index 46d50f1552..0eccf508c5 100644 --- a/src/vm/clrprivbinderutil.cpp +++ b/src/vm/clrprivbinderutil.cpp @@ -39,327 +39,6 @@ LPWSTR CopyStringThrowing( namespace CLRPrivBinderUtil { -#ifdef FEATURE_FUSION - //----------------------------------------------------------------------------------------------------------------- - CLRPrivAssemblyBindResultWrapper::CLRPrivAssemblyBindResultWrapper( - IAssemblyName *pIAssemblyName, - PCWSTR wzAssemblyPath, - IILFingerprintFactory *pILFingerprintFactory - ) : - m_wzAssemblyPath(DuplicateStringThrowing(wzAssemblyPath)), - m_pIAssemblyName(clr::SafeAddRef(pIAssemblyName)), - m_bIBindResultNISet(false), - m_pIBindResultNI(nullptr), - m_pIILFingerprint(nullptr), - m_pILFingerprintFactory(clr::SafeAddRef(pILFingerprintFactory)), - m_lock(CrstLeafLock) - { - STANDARD_VM_CONTRACT; - VALIDATE_ARG_THROW(pIAssemblyName != nullptr && wzAssemblyPath != nullptr); - } - - //----------------------------------------------------------------------------------------------------------------- - CLRPrivAssemblyBindResultWrapper::~CLRPrivAssemblyBindResultWrapper() - { - clr::SafeRelease(m_pIAssemblyName); - clr::SafeRelease(m_pIILFingerprint); - clr::SafeRelease(m_pIBindResultNI); - } - - //================================================================================================================= - // IBindResult methods - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetAssemblyNameDef( - /*out*/ IAssemblyName **ppIAssemblyNameDef) - { - LIMITED_METHOD_CONTRACT; - - VALIDATE_ARG_RET(ppIAssemblyNameDef != nullptr); - *ppIAssemblyNameDef = clr::SafeAddRef(m_pIAssemblyName); - return S_OK; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetNextAssemblyModuleName( - /*in*/ DWORD dwNIndex, - __inout_ecount(*pdwCCModuleName) LPWSTR pwzModuleName, - /*in, out, annotation("__inout")*/ LPDWORD pdwCCModuleName) - { - STANDARD_BIND_CONTRACT; - _ASSERTE(!("E_NOTIMPL: " __FUNCTION__)); - return E_NOTIMPL; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetAssemblyLocation( - /*out*/ IAssemblyLocation **ppIAssemblyLocation) - { - STANDARD_BIND_CONTRACT; - VALIDATE_ARG_RET(ppIAssemblyLocation != nullptr); - return this->QueryInterface(ppIAssemblyLocation); - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetNativeImage( - /*out*/ IBindResult **ppIBindResultNI, - /*out*/ BOOL *pfIBindResultNIProbed) - { - LIMITED_METHOD_CONTRACT; - - // m_bIBindResultNISet must always be read *before* m_pIBindResultNI - bool bIBindResultNISet = m_bIBindResultNISet; - - if (pfIBindResultNIProbed != nullptr) - *pfIBindResultNIProbed = bIBindResultNISet; - - if (bIBindResultNISet && ppIBindResultNI != nullptr) - *ppIBindResultNI = clr::SafeAddRef(m_pIBindResultNI); - - return S_OK; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::SetNativeImage( - /*in*/ IBindResult *pIBindResultNI, - /*out*/ IBindResult **ppIBindResultNIFinal) - { - STANDARD_BIND_CONTRACT; - HRESULT hr = S_OK; - - EX_TRY - { - // Native Binder needs S_FALSE returned if it loses the race. - hr = S_FALSE; - - if (!m_bIBindResultNISet) - { - CrstHolder lock(&m_lock); - if (!m_bIBindResultNISet) - { - m_pIBindResultNI = clr::SafeAddRef(pIBindResultNI); - m_bIBindResultNISet = true; - - // Won the race! - hr = S_OK; - } - } - } - EX_CATCH_HRESULT(hr); - - if (ppIBindResultNIFinal != nullptr) - *ppIBindResultNIFinal = clr::SafeAddRef(m_pIBindResultNI); - - return hr; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::IsEqual( - /*in*/ IUnknown *pIUnk) - { - STANDARD_BIND_CONTRACT; - HRESULT hr = S_OK; - - VALIDATE_ARG_RET(pIUnk != nullptr); - - ReleaseHolder<IBindResult> pIBindResult; - - hr = pIUnk->QueryInterface(__uuidof(IBindResult), (void **)&pIBindResult); - if (SUCCEEDED(hr)) - { - hr = pIBindResult == static_cast<IBindResult*>(this) ? S_OK : S_FALSE; - } - else if (hr == E_NOINTERFACE) - { - hr = S_FALSE; - } - - return hr; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetNextAssemblyNameRef( - /*in*/ DWORD dwNIndex, - /*out*/ IAssemblyName **ppIAssemblyNameRef) - { - STANDARD_BIND_CONTRACT; - _ASSERTE(!("E_UNEXPECTED: " __FUNCTION__)); - return E_UNEXPECTED; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetNextDependentAssembly( - /*in*/ DWORD dwNIndex, - /*out*/ IUnknown **ppIUnknownAssembly) - { - STANDARD_BIND_CONTRACT; - _ASSERTE(!("E_UNEXPECTED: " __FUNCTION__)); - return E_UNEXPECTED; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetAssemblyLocationOfILImage( - /*out*/ IAssemblyLocation **ppAssemblyLocation) - { - LIMITED_METHOD_CONTRACT; - return this->QueryInterface(ppAssemblyLocation); - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetILFingerprint( - /*out*/ IILFingerprint **ppFingerprint) - { - STANDARD_BIND_CONTRACT; - HRESULT hr = S_OK; - - VALIDATE_ARG_RET(ppFingerprint != nullptr); - - EX_TRY - { - *ppFingerprint = m_pIILFingerprint; - if (*ppFingerprint == nullptr) - { - ReleaseHolder<IILFingerprint> pFingerprint; - if (SUCCEEDED(hr = m_pILFingerprintFactory->GetILFingerprintForPath(GetILAssemblyPath(), &pFingerprint))) - { - if (InterlockedCompareExchangeT<IILFingerprint>(&m_pIILFingerprint, pFingerprint, nullptr) == nullptr) - { - pFingerprint.SuppressRelease(); - } - } - } - *ppFingerprint = clr::SafeAddRef(m_pIILFingerprint); - } - EX_CATCH_HRESULT(hr); - - return hr; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetSourceILTimestamp( - /*out*/ FILETIME* pFileTime) - { - STANDARD_BIND_CONTRACT; - HRESULT hr = S_OK; - - VALIDATE_ARG_RET(pFileTime != nullptr); - - EX_TRY - { - WIN32_FILE_ATTRIBUTE_DATA wfd; - if (!WszGetFileAttributesEx(GetILAssemblyPath(), GetFileExInfoStandard, &wfd)) - ThrowLastError(); - *pFileTime = wfd.ftLastWriteTime; - } - EX_CATCH_HRESULT(hr); - - return hr; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetSourceILSize( - /*out*/ DWORD* pSize) - { - STANDARD_BIND_CONTRACT; - HRESULT hr = S_OK; - - VALIDATE_ARG_RET(pSize != nullptr); - - EX_TRY - { - WIN32_FILE_ATTRIBUTE_DATA wfd; - if (!WszGetFileAttributesEx(GetILAssemblyPath(), GetFileExInfoStandard, &wfd)) - ThrowLastError(); - if(wfd.nFileSizeHigh != 0) - ThrowHR(COR_E_OVERFLOW); - *pSize = wfd.nFileSizeLow; - } - EX_CATCH_HRESULT(hr); - - return hr; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetNIInfo( - /*out*/ INativeImageInstallInfo** pInfo) - { - STANDARD_BIND_CONTRACT; - _ASSERTE(!("E_UNEXPECTED: " __FUNCTION__)); - return E_UNEXPECTED; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetFlags( - /*out*/ DWORD * pdwFlags) - { - STANDARD_BIND_CONTRACT; - PRECONDITION(CheckPointer(pdwFlags)); - if (pdwFlags == nullptr) - { - return E_POINTER; - } - - // Currently, no effort is made to open assemblies and build a full IAssemblyName - this currently - // only contains the simple name. Since AppX packages cannot be in-place updated we can be confident - // that the binding environment will remain unchanged between NGEN and runtime. As such, return the - // flag to indicate that the native image binder should skip self assembly definition validation. - *pdwFlags = IBindResultFlag_AssemblyNameDefIncomplete; - - return S_OK; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetLocationType( - /*out*/DWORD *pdwLocationType) - { - LIMITED_METHOD_CONTRACT; - VALIDATE_ARG_RET(pdwLocationType != nullptr); - - if (pdwLocationType == nullptr) - return E_INVALIDARG; - *pdwLocationType = ASSEMBLY_LOCATION_PATH; - return S_OK; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetPath( - __inout_ecount(*pdwccAssemblyPath) LPWSTR pwzAssemblyPath, - /*in, annotation("__inout")*/ LPDWORD pdwccAssemblyPath) - { - STANDARD_BIND_CONTRACT; - HRESULT hr = S_OK; - - VALIDATE_ARG_RET(pdwccAssemblyPath != nullptr); - - EX_TRY - { - DWORD cchILAssemblyPath = static_cast<DWORD>(wcslen(GetILAssemblyPath())) + 1; - if (pwzAssemblyPath != nullptr && cchILAssemblyPath <= *pdwccAssemblyPath) - { - IfFailThrow(StringCchCopy(pwzAssemblyPath, *pdwccAssemblyPath, GetILAssemblyPath())); - *pdwccAssemblyPath = cchILAssemblyPath; - hr = S_OK; - } - else - { - *pdwccAssemblyPath = cchILAssemblyPath; - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - } - EX_CATCH_HRESULT(hr); - - return hr; - } - - //----------------------------------------------------------------------------------------------------------------- - HRESULT CLRPrivAssemblyBindResultWrapper::GetHostID( - /*out*/ UINT64 *puiHostID) - { - STANDARD_BIND_CONTRACT; - _ASSERTE(!("E_UNEXPECTED: " __FUNCTION__)); - return E_UNEXPECTED; - } -#endif //FEATURE_FUSION //----------------------------------------------------------------------------------------------------------------- HRESULT VerifyBind( @@ -661,49 +340,6 @@ namespace CLRPrivBinderUtil return hr; } -#ifdef FEATURE_FUSION - //===================================================================================================================== - HRESULT AssemblyIdentity::Initialize( - AssemblySpec * pSpec) - { - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - FORBID_FAULT; - MODE_ANY; - CAN_TAKE_LOCK; - } - CONTRACTL_END - - HRESULT hr = S_OK; - - if (0 == WszMultiByteToWideChar( - CP_UTF8, 0 /*flags*/, pSpec->GetName(), -1, Name, (int) (sizeof(Name) / sizeof(Name[0])))) - { - return HRESULT_FROM_GetLastError(); - } - - AssemblyMetaDataInternal * pAMDI = pSpec->GetContext(); - if (pAMDI != nullptr) - { - Version.wMajor = pAMDI->usMajorVersion; - Version.wMinor = pAMDI->usMinorVersion; - Version.wBuild = pAMDI->usBuildNumber; - Version.wRevision = pAMDI->usRevisionNumber; - } - - if (pSpec->HasPublicKeyToken()) - { - PBYTE pbKey; - DWORD cbKey; - pSpec->GetPublicKeyToken(&pbKey, &cbKey); - IfFailRet(KeyToken.Initialize(pbKey, cbKey)); - } - - return hr; - } -#endif //===================================================================================================================== diff --git a/src/vm/clrprivbinderwinrt.cpp b/src/vm/clrprivbinderwinrt.cpp index 6f6a608e53..b682000bc3 100644 --- a/src/vm/clrprivbinderwinrt.cpp +++ b/src/vm/clrprivbinderwinrt.cpp @@ -19,12 +19,6 @@ //===================================================================================================================== #include "sstring.h" -#ifdef FEATURE_FUSION -#include "fusionlogging.h" -#include "policy.h" -#include "imprthelpers.h" // in fusion/inc -#include "asmimprt.h" -#endif #ifdef FEATURE_APPX #include "appxutil.h" #endif @@ -129,9 +123,6 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT( BOOL fCanUseNativeImages) : m_pTypeCache(clr::SafeAddRef(pWinRtTypeCache)) , m_pParentBinder(pParentBinder) // Do not addref, lifetime directly tied to parent. -#ifdef FEATURE_FUSION - , m_fCanUseNativeImages(fCanUseNativeImages) -#endif , m_fNamespaceResolutionKind(fNamespaceResolutionKind) , m_pApplicationContext(nullptr) , m_appLocalWinMDPath(nullptr) @@ -166,9 +157,6 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT( } #endif //CROSSGEN_COMPILE -#ifdef FEATURE_FUSION - IfFailThrow(RuntimeCreateCachingILFingerprintFactory(&m_pFingerprintFactory)); -#endif } //===================================================================================================================== @@ -347,10 +335,6 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( // IfFailGo(pAssemblyDefName->SetProperty(ASM_NAME_NAME, wszFileNameStripped, (lstrlenW(wszFileNameStripped) + 1) * sizeof(WCHAR))); -#ifdef FEATURE_FUSION - NewHolder<CLRPrivAssemblyBindResultWrapper> pBindResult( - new CLRPrivAssemblyBindResultWrapper(pAssemblyDefName, wszFileName, m_pFingerprintFactory)); -#else NewHolder<CoreBindResult> pBindResult(new CoreBindResult()); StackSString sAssemblyPath(pResource->GetPath()); ReleaseHolder<BINDER_SPACE::Assembly> pBinderAssembly; @@ -360,7 +344,6 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( // We have set bInGac to TRUE here because the plan is full trust for WinRT. If this changes, we may need to check with // AppDomain to verify trust based on the WinMD's path pBindResult->Init(pBinderAssembly, TRUE); -#endif NewHolder<CLRPrivAssemblyWinRT> pNewAssembly( new CLRPrivAssemblyWinRT(this, pResource, pBindResult, fIsWindowsNamespace)); @@ -407,63 +390,6 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( return hr; } // CLRPrivBinderWinRT::BindWinRTAssemblyByName -#ifdef FEATURE_FUSION -//===================================================================================================================== -HRESULT CLRPrivBinderWinRT::BindAssemblyToNativeAssembly(CLRPrivAssemblyWinRT *pAssembly) -{ - HRESULT hr = S_OK; - - if (!m_fCanUseNativeImages) - return hr; - - ReleaseHolder<IBindResult> pIBindResultIL; - IfFailRet(pAssembly->GetIBindResult(&pIBindResultIL)); - _ASSERTE(pIBindResultIL != nullptr); - - NewArrayHolder<WCHAR> wzZapSet = DuplicateStringThrowing(g_pConfig->ZapSet()); - NativeConfigData cfgData = { - wzZapSet, - PEFile::GetNativeImageConfigFlags() - }; - - ReleaseHolder<IBindContext> pIBindContext; - IfFailRet(GetParentIBindContext(&pIBindContext)); - - // Fire BindingNgenPhaseStart ETW event if enabled. - { - InlineSString<_MAX_PATH> ssAssemblyName; - FireEtwBindingNgenPhaseStart( - (AppDomain::GetCurrentDomain()->GetId().m_dwId), - LOADCTX_TYPE_HOSTED, - ETWFieldUnused, - ETWLoaderLoadTypeNotAvailable, - NULL, - pAssembly->m_pResourceIL->GetPath(), - GetClrInstanceId()); - } - - IfFailRet(BindToNativeAssembly(pIBindResultIL, &cfgData, pIBindContext, fusion::logging::GetCurrentFusionBindLog())); - - // Fire BindingNgenPhaseEnd ETW event if enabled. - { - InlineSString<_MAX_PATH> ssAssemblyName; - FireEtwBindingNgenPhaseEnd( - (AppDomain::GetCurrentDomain()->GetId().m_dwId), - LOADCTX_TYPE_HOSTED, - ETWFieldUnused, - ETWLoaderLoadTypeNotAvailable, - NULL, - pAssembly->m_pResourceIL->GetPath(), - GetClrInstanceId()); - } - - // BindToNativeAssembly can return S_FALSE, but this could be misleading. - if (hr == S_FALSE) - hr = S_OK; - - return hr; -} -#endif //===================================================================================================================== @@ -501,7 +427,6 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( return hr; } -#ifndef FEATURE_FUSION // // This method opens the assembly using the CoreCLR Binder, which has logic supporting opening either the IL or // even just the native image without IL present. @@ -587,7 +512,6 @@ HRESULT CLRPrivBinderWinRT::GetAssemblyAndTryFindNativeImage(SString &sWinmdFile return hr; } -#endif // !FEATURE_FUSION //===================================================================================================================== HRESULT CLRPrivBinderWinRT::SetApplicationContext(BINDER_SPACE::ApplicationContext *pApplicationContext, SString &appLocalWinMD) @@ -1056,60 +980,6 @@ CLRPrivBinderWinRT::FindAssemblyForTypeIfLoaded( #ifndef DACCESS_COMPILE -#ifdef FEATURE_FUSION -//===================================================================================================================== -// Implements interface method code:IBindContext::PreBind. -// -// Prebinding to WinMD files follows a special contract. We want to avoid loading the actual target assembly -// and we need to validate that all dependencies of the file remain equivalent to that which was available at ngen time -// We do this by comparing the filename to the assembly simple name. This is legal to do with WinRT because at NGen time -// we embed a WinRT dependency as assembly def name component plus a namespace and type from it. -// At bind time, this type should still exist in the same assembly. If it doesn't, and has been moved, -// the native image validation will fail anyway and we'll fall back to IL. This is because if the type has -// been moved to another WinMD, it must have been removed from the first one because WinRT allows no duplicates. -// This no duplicate rule is obviously not actually gauranteed by the WinRT runtime for 3rd party assemblies, -// but violating the rule is known to cause a number of binding behavior errors that we do not attempt to protect against. -HRESULT -CLRPrivBinderWinRT::PreBind( - IAssemblyName * pAssemblyName, - DWORD dwPreBindFlags, - IBindResult ** ppIBindResult) -{ - STANDARD_VM_CONTRACT; - HRESULT hr = S_OK; - - // Assert that we are only working with a binder that supports native images - _ASSERTE(m_fCanUseNativeImages); - - ReleaseHolder<IBindContext> pIBindContext; - IfFailRet(GetParentIBindContext(&pIBindContext)); - - DWORD dwContentType = AssemblyContentType_Default; - DWORD cbContentTypeSize = sizeof(dwContentType); - IfFailRet(pAssemblyName->GetProperty(ASM_NAME_CONTENT_TYPE, &dwContentType, &cbContentTypeSize)); - - if (dwContentType == AssemblyContentType_Default) - { - hr = pIBindContext->PreBind(pAssemblyName, dwPreBindFlags, ppIBindResult); - } - else - { - hr = BindWinRTAssemblyByName(pAssemblyName, ppIBindResult, TRUE); - } - - return hr; -} - -//===================================================================================================================== -// Implements interface method code:IBindContext::IsDefaultContext. -// -HRESULT -CLRPrivBinderWinRT::IsDefaultContext() -{ - LIMITED_METHOD_CONTRACT; - return S_OK; -} -#endif //===================================================================================================================== CLRPrivAssemblyWinRT::CLRPrivAssemblyWinRT( @@ -1217,21 +1087,6 @@ HRESULT CLRPrivAssemblyWinRT::GetAvailableImageTypes( return hr; } -#ifdef FEATURE_FUSION -static ICLRPrivResource * GetResourceForBindResult( - IBindResult * pIBindResult) -{ - STANDARD_VM_CONTRACT; - VALIDATE_ARG_THROW(pIBindResult != nullptr); - - WCHAR wzPath[_MAX_PATH]; - DWORD cchPath = NumItems(wzPath); - ReleaseHolder<IAssemblyLocation> pIAssemLoc; - IfFailThrow(pIBindResult->GetAssemblyLocation(&pIAssemLoc)); - IfFailThrow(pIAssemLoc->GetPath(wzPath, &cchPath)); - return ToInterface<ICLRPrivResource>(new CLRPrivResourcePathImpl(wzPath)); -} -#endif //===================================================================================================================== // Implements interface method code:ICLRPrivAssembly::GetImageResource. @@ -1331,66 +1186,6 @@ HRESULT CLRPrivBinderWinRT::FindWinRTAssemblyBySpec( return E_FAIL; } -#ifdef FEATURE_FUSION -//===================================================================================================================== -HRESULT CLRPrivBinderWinRT::FindWinRTAssemblyBySpec( - LPVOID pvAppDomain, - LPVOID pvAssemblySpec, - HRESULT * pResult, - ICLRPrivAssembly ** ppAssembly) -{ - LIMITED_METHOD_CONTRACT;; - HRESULT hr = S_OK; - - AppDomain* pAppDomain = reinterpret_cast<AppDomain*>(pvAppDomain); - AssemblySpec* pAssemblySpec = reinterpret_cast<AssemblySpec*>(pvAssemblySpec); - VALIDATE_PTR_RET(pAppDomain); - VALIDATE_PTR_RET(pAssemblySpec); - VALIDATE_PTR_RET(pResult); - VALIDATE_PTR_RET(ppAssembly); - - if (pAssemblySpec->IsContentType_WindowsRuntime()) - { - // FindAssemblyBySpec is not supported by this binder. - *pResult = CLR_E_BIND_TYPE_NOT_FOUND; - *ppAssembly = nullptr; - return S_OK; - } - else - { - return CLR_E_BIND_UNRECOGNIZED_IDENTITY_FORMAT; - } -} - -//===================================================================================================================== -HRESULT CLRPrivBinderWinRT::GetParentIBindContext( - IBindContext **ppIBindContext) -{ - STANDARD_BIND_CONTRACT; - VALIDATE_ARG_RET(ppIBindContext != nullptr); - - HRESULT hr = S_OK; - - if (m_pParentBinder != nullptr) - { - _ASSERTE(AppX::IsAppXProcess()); - IfFailRet(m_pParentBinder->QueryInterface(__uuidof(IBindContext), (void**)ppIBindContext)); - } - else - { - _ASSERTE(!AppX::IsAppXProcess()); - EX_TRY - { - AppDomain* pDomain = AppDomain::GetCurrentDomain(); - hr = GetBindContextFromApplicationContext(pDomain->CreateFusionContext(), ppIBindContext); - } - EX_CATCH_HRESULT(hr); - } - - _ASSERTE(FAILED(hr) || *ppIBindContext != nullptr); - return hr; -} -#endif //===================================================================================================================== HRESULT CLRPrivAssemblyWinRT::GetIBindResult( @@ -1417,29 +1212,14 @@ HRESULT CLRPrivAssemblyWinRT::EnsureAvailableImageTypes() // If image types has not yet been set, attempt to bind to native assembly if (dwImageTypesLocal == 0) { -#ifdef FEATURE_FUSION - CLRPrivBinderWinRT *pBinder = m_pBinder; - IfFailGo(pBinder->BindAssemblyToNativeAssembly(this)); -#endif if (m_pIResourceNI == nullptr) { -#ifdef FEATURE_FUSION - ReleaseHolder<IBindResult> pIBindResultNI; - - if (SUCCEEDED(hr = m_pIBindResult->GetNativeImage(&pIBindResultNI, nullptr)) && pIBindResultNI != nullptr) - { - ReleaseHolder<ICLRPrivResource> pResourceNI = GetResourceForBindResult(pIBindResultNI); - if (InterlockedCompareExchangeT<ICLRPrivResource *>(&m_pIResourceNI, pResourceNI, nullptr) == nullptr) - pResourceNI.SuppressRelease(); - } -#else if (m_pIBindResult->HasNativeImage()) { SString sPath = m_pIBindResult->GetNativeImage()->GetPath(); m_pIResourceNI = new CLRPrivResourcePathImpl(sPath.GetUnicode()); m_pIResourceNI->AddRef(); } -#endif IfFailGo(hr); } diff --git a/src/vm/clrprivbinderwinrt.h b/src/vm/clrprivbinderwinrt.h index f8e3cad977..14c467044b 100644 --- a/src/vm/clrprivbinderwinrt.h +++ b/src/vm/clrprivbinderwinrt.h @@ -21,12 +21,10 @@ #include "winrt/windowsstring.h" #include "appxutil.h" -#ifndef FEATURE_FUSION #include "coreclr/corebindresult.h" // IBindResult maps directly to its one and only implementation on CoreCLR. typedef CoreBindResult IBindResult; -#endif // FEATURE_FUSION //===================================================================================================================== // Forward declarations @@ -46,9 +44,6 @@ IsWindowsNamespace(const char * wszNamespace); //===================================================================================================================== class CLRPrivBinderWinRT : public IUnknownCommon<ICLRPrivBinder -#ifdef FEATURE_FUSION - , IBindContext -#endif //FEATURE_FUSION > { friend class CLRPrivAssemblyWinRT; @@ -187,19 +182,6 @@ public: HRESULT * pResult, ICLRPrivAssembly ** ppAssembly); -#ifdef FEATURE_FUSION - //============================================================================================= - // IBindContext interface methods - - // Implements interface method code:IBindContext::PreBind. - STDMETHOD(PreBind)( - IAssemblyName * pIAssemblyName, - DWORD dwPreBindFlags, - IBindResult ** ppIBindResult); - - // Implements interface method code:IBindContext::IsDefaultContext. - STDMETHOD(IsDefaultContext)(); -#endif //FEATURE_FUSION //============================================================================================= // Class methods @@ -237,9 +219,7 @@ public: IBindResult ** ppIBindResult, BOOL fPreBind = FALSE); -#ifndef FEATURE_FUSION HRESULT GetAssemblyAndTryFindNativeImage(SString &sWinmdFilename, LPCWSTR pwzSimpleName, BINDER_SPACE::Assembly ** ppAssembly); -#endif // On Phone the application's APP_PATH CoreCLR hosting config property is used as the app // package graph for RoResolveNamespace to find 3rd party WinMDs. This method wires up // the app paths so the WinRT binder will find 3rd party WinMDs. @@ -279,9 +259,6 @@ private: CLRPrivBinderUtil::WStringList * pFileNameList, CLRPrivBinderUtil::WStringList ** ppFileNameList); -#ifdef FEATURE_FUSION - HRESULT BindAssemblyToNativeAssembly(CLRPrivAssemblyWinRT *pAssembly); -#endif private: //============================================================================================= @@ -313,16 +290,7 @@ private: CLRPrivBinderUtil::HSTRINGArrayHolder m_rgAltPaths; #endif -#ifdef FEATURE_FUSION - // Native binder assisting logic - BOOL m_fCanUseNativeImages; - - ReleaseHolder<IILFingerprintFactory> m_pFingerprintFactory; -#endif -#ifdef FEATURE_FUSION - HRESULT GetParentIBindContext(IBindContext **ppIBindContext); -#endif //FEATURE_FUSION BINDER_SPACE::ApplicationContext * m_pApplicationContext; NewArrayHolder<WCHAR> m_appLocalWinMDPath; diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp index 5e136fb6a9..7802521228 100644 --- a/src/vm/clsload.cpp +++ b/src/vm/clsload.cpp @@ -52,9 +52,6 @@ #include "virtualcallstub.h" #include "stringarraylist.h" -#if defined(FEATURE_FUSION) && !defined(DACCESS_COMPILE) -#include "policy.h" // For Fusion::Util::IsAnyFrameworkAssembly -#endif // This method determines the "loader module" for an instantiated type // or method. The rule must ensure that any types involved in the diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index 097c90ba5a..8aca2ad6df 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -204,28 +204,9 @@ HRESULT CEECompileInfo::CreateDomain(ICorCompilationDomain **ppDomain, // We load assemblies as domain-bound (However, they're compiled as domain neutral) #ifdef FEATURE_LOADER_OPTIMIZATION -#ifdef FEATURE_FUSION - if (NingenEnabled()) - { - pCompilationDomain->SetSharePolicy(AppDomain::SHARE_POLICY_NEVER); - } - else - { - pCompilationDomain->SetupLoaderOptimization(AppDomain::SHARE_POLICY_NEVER); - } -#else //FEATURE_FUSION pCompilationDomain->SetSharePolicy(AppDomain::SHARE_POLICY_NEVER); -#endif //FEATURE_FUSION #endif // FEATURE_LOADER_OPTIMIZATION -#ifdef FEATURE_FUSION - CorCompileConfigFlags flags = PEFile::GetNativeImageConfigFlags(pCompilationDomain->m_fForceDebug, - pCompilationDomain->m_fForceProfiling, - pCompilationDomain->m_fForceInstrument); - - FusionBind::SetApplicationContextDWORDProperty(GetAppDomain()->GetFusionContext(), - ACTAG_ZAP_CONFIG_FLAGS, flags); -#endif //FEATURE_FUSION } pCompilationDomain->SetFriendlyName(W("Compilation Domain")); @@ -442,16 +423,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( } else { -#ifdef FEATURE_FUSION - SafeComHolder<IBindResult> pNativeFusionAssembly; - SafeComHolder<IFusionBindLog> pFusionLog; - SafeComHolder<IAssembly> pFusionAssembly; - - IfFailThrow(ExplicitBind(wzPath, pDomain->GetFusionContext(), EXPLICITBIND_FLAGS_EXE, - NULL, &pFusionAssembly, &pNativeFusionAssembly, &pFusionLog)); - - pAssemblyHolder = PEAssembly::Open(pFusionAssembly, pNativeFusionAssembly, pFusionLog, FALSE, FALSE); -#else //FEATURE_FUSION //ExplicitBind CoreBindResult bindResult; spec.SetCodeBase(pImage->GetPath()); @@ -475,7 +446,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( fExplicitBindToNativeImage ); pAssemblyHolder = PEAssembly::Open(&bindResult,FALSE,FALSE); -#endif //FEATURE_FUSION } // Now load assembly into domain. @@ -515,156 +485,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( return hr; } -#ifdef FEATURE_FUSION - -// Simple helper that factors out code common to LoadAssemblyByIAssemblyName and -// LoadAssemblyByName -static HRESULT LoadAssemblyByIAssemblyNameWorker( - IAssemblyName *pAssemblyName, - CORINFO_ASSEMBLY_HANDLE *pHandle) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - Assembly *pAssembly; - - AssemblySpec spec; - spec.InitializeSpec(pAssemblyName, NULL, FALSE); - - if (spec.IsMscorlib()) - { - pAssembly = SystemDomain::System()->SystemAssembly(); - } - else - { - - DomainAssembly * pDomainAssembly = spec.LoadDomainAssembly(FILE_LOAD_BEGIN); - - // Mark the assembly before it gets fully loaded and NGen image dependencies are verified. This is necessary - // to allow skipping compilation if there is NGen image already. - pDomainAssembly->GetFile()->SetSafeToHardBindTo(); - - pAssembly = spec.LoadAssembly(FILE_LOADED); - } - - // - // Return the module handle - // - - *pHandle = CORINFO_ASSEMBLY_HANDLE(pAssembly); - - return S_OK; -} - -HRESULT CEECompileInfo::LoadAssemblyByName( - LPCWSTR wzName, - CORINFO_ASSEMBLY_HANDLE *pHandle) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - - COOPERATIVE_TRANSITION_BEGIN(); - - EX_TRY - { - ReleaseHolder<IAssemblyName> pAssemblyName; - IfFailThrow(CreateAssemblyNameObject(&pAssemblyName, wzName, CANOF_PARSE_DISPLAY_NAME, NULL)); - IfFailThrow(LoadAssemblyByIAssemblyNameWorker(pAssemblyName, pHandle)); - } - EX_CATCH_HRESULT(hr); - - COOPERATIVE_TRANSITION_END(); - - return hr; -} - -HRESULT CEECompileInfo::LoadAssemblyRef( - IMDInternalImport *pAssemblyImport, - mdAssemblyRef ref, - CORINFO_ASSEMBLY_HANDLE *pHandle, - IAssemblyName **refAssemblyName /*=NULL*/) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - - ReleaseHolder<IAssemblyName> pAssemblyName; - - COOPERATIVE_TRANSITION_BEGIN(); - - EX_TRY - { - Assembly *pAssembly; - - if (refAssemblyName) - *refAssemblyName = NULL; - - AssemblySpec spec; - spec.InitializeSpec(ref, pAssemblyImport, NULL, FALSE); - - if (spec.HasBindableIdentity()) - { - if (refAssemblyName) - { - IfFailThrow(spec.CreateFusionName(&pAssemblyName)); - } - - pAssembly = spec.LoadAssembly(FILE_LOADED); - - // - // Return the module handle - // - - *pHandle = CORINFO_ASSEMBLY_HANDLE(pAssembly); - } - else - { // Cannot load assembly refs with non-unique id. - hr = S_FALSE; - } - } - EX_CATCH_HRESULT(hr); - - COOPERATIVE_TRANSITION_END(); - - if (refAssemblyName != NULL && pAssemblyName != NULL) - { - *refAssemblyName = pAssemblyName.Extract(); - } - - return hr; -} - -HRESULT CEECompileInfo::LoadAssemblyByIAssemblyName( - IAssemblyName *pAssemblyName, - CORINFO_ASSEMBLY_HANDLE *pHandle - ) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - - COOPERATIVE_TRANSITION_BEGIN(); - - EX_TRY - { - IfFailThrow(LoadAssemblyByIAssemblyNameWorker(pAssemblyName, pHandle)); - } - EX_CATCH_HRESULT(hr); - - COOPERATIVE_TRANSITION_END(); - - return hr; -} - -#endif //FEATURE_FUSION #ifdef FEATURE_COMINTEROP HRESULT CEECompileInfo::LoadTypeRefWinRT( @@ -944,42 +764,6 @@ CORINFO_ASSEMBLY_HANDLE return (CORINFO_ASSEMBLY_HANDLE) GetModule(module)->GetAssembly(); } -#ifdef FEATURE_FUSION -HRESULT CEECompileInfo::GetAssemblyName( - CORINFO_ASSEMBLY_HANDLE hAssembly, - DWORD dwFlags, - __out_z LPWSTR wzAssemblyName, - LPDWORD pcchAssemblyName) -{ - STANDARD_VM_CONTRACT; - - _ASSERTE(hAssembly != NULL); - if (hAssembly == NULL) - { - return E_INVALIDARG; - } - - HRESULT hr = S_OK; - EX_TRY - { - Assembly *pAssembly = (Assembly *) hAssembly; - IAssemblyName * pAssemblyName = pAssembly->GetFusionAssemblyName(); - if (dwFlags == GANF_Default) - { - hr = pAssemblyName->GetDisplayName(wzAssemblyName, pcchAssemblyName, 0); - } - else if (dwFlags == GANF_Simple) - { - DWORD cbAssemblyName = *pcchAssemblyName * sizeof(WCHAR); - hr = pAssemblyName->GetProperty(ASM_NAME_NAME, (LPVOID)wzAssemblyName, &cbAssemblyName); - *pcchAssemblyName = cbAssemblyName / sizeof(WCHAR); - } - } - EX_CATCH_HRESULT(hr); - - return hr; -} -#endif //FEATURE_FUSION #ifdef CROSSGEN_COMPILE // @@ -7566,56 +7350,6 @@ HRESULT COOPERATIVE_TRANSITION_BEGIN(); -#ifdef FEATURE_FUSION - if (isExe) - { - if (NingenEnabled()) - { - WCHAR buf[MAX_LONGPATH + sizeof(CONFIGURATION_EXTENSION)/sizeof(WCHAR) + 1]; - if (0 != wcscpy_s(buf, sizeof(buf)/sizeof(*buf), path)) - { - COMPlusThrowHR(COR_E_PATHTOOLONG); - } - WCHAR *pSlash = wcsrchr(buf, W('\\')); - if (!pSlash) - { - COMPlusThrowHR(COR_E_BAD_PATHNAME); - } - - *(pSlash + 1) = W('\0'); - hr = m_pFusionContext->Set(ACTAG_APP_BASE_URL, buf, (DWORD)((wcslen(buf) + 1) * sizeof(WCHAR)), 0); - if (FAILED(hr)) - { - COMPlusThrowHR(hr); - } - - if (0 != wcscpy_s(buf, sizeof(buf)/sizeof(*buf), path + (pSlash - buf) + 1)) - { - COMPlusThrowHR(COR_E_PATHTOOLONG); - } - - if (0 != wcscat_s(buf, sizeof(buf)/sizeof(*buf), CONFIGURATION_EXTENSION)) - { - COMPlusThrowHR(COR_E_PATHTOOLONG); - } - hr = m_pFusionContext->Set(ACTAG_APP_CONFIG_FILE, buf, (DWORD)((wcslen(buf) + 1) * sizeof(WCHAR)), 0); - if (FAILED(hr)) - { - COMPlusThrowHR(hr); - } - } - else - { - SetupExecutableFusionContext(path); - } - } - else - { - hr = m_pFusionContext->Set(ACTAG_APP_BASE_URL, - (void*) path, (DWORD) ((wcslen(path)+1) * sizeof(WCHAR)), - 0); - } -#endif //FEATURE_FUSION COOPERATIVE_TRANSITION_END(); @@ -7653,27 +7387,6 @@ HRESULT return S_OK; } -#ifdef FEATURE_FUSION -HRESULT - CompilationDomain::GetIBindContext(IBindContext **ppBindCtx) -{ - LIMITED_METHOD_CONTRACT; - HRESULT hr = S_OK; - - ReleaseHolder<IBindContext> pBindCtx; - if (HasLoadContextHostBinder()) - { - IfFailRet(GetCurrentLoadContextHostBinder()->QueryInterface(__uuidof(IBindContext), &pBindCtx)); - } - else - { - GetBindContextFromApplicationContext(BaseDomain::GetFusionContext(), &pBindCtx); // Can't fail - } - - *ppBindCtx = pBindCtx.Extract(); - return S_OK; -} -#endif #ifdef CROSSGEN_COMPILE HRESULT CompilationDomain::SetPlatformWinmdPaths(LPCWSTR pwzPlatformWinmdPaths) diff --git a/src/vm/compile.h b/src/vm/compile.h index 140a62fcb0..7aeef31b6c 100644 --- a/src/vm/compile.h +++ b/src/vm/compile.h @@ -207,21 +207,6 @@ class CEECompileInfo : public ICorCompileInfo BOOL fExplicitBindToNativeImage, CORINFO_ASSEMBLY_HANDLE *pHandle); -#ifdef FEATURE_FUSION - HRESULT LoadAssemblyByName(LPCWSTR wzName, - CORINFO_ASSEMBLY_HANDLE *pHandle); - - HRESULT LoadAssemblyRef(IMDInternalImport *pAssemblyImport, - mdAssemblyRef ref, - CORINFO_ASSEMBLY_HANDLE *pHandle, - IAssemblyName **refAssemblyName = NULL); - - HRESULT LoadAssemblyByIAssemblyName( - IAssemblyName *pAssemblyName, - CORINFO_ASSEMBLY_HANDLE *pHandle - ); - -#endif //FEATURE_FUSION #ifdef FEATURE_COMINTEROP HRESULT LoadTypeRefWinRT(IMDInternalImport *pAssemblyImport, @@ -337,13 +322,6 @@ class CEECompileInfo : public ICorCompileInfo ICorCompileDataStore *pData, CorProfileData *profileData); -#ifdef FEATURE_FUSION - HRESULT GetAssemblyName( - CORINFO_ASSEMBLY_HANDLE hAssembly, - DWORD dwFlags, - __out_z LPWSTR wzAssemblyName, - LPDWORD cchAssemblyName); -#endif //FEATURE_FUSION HRESULT GetLoadHint(CORINFO_ASSEMBLY_HANDLE hAssembly, CORINFO_ASSEMBLY_HANDLE hAssemblyDependency, @@ -860,9 +838,6 @@ class CompilationDomain : public AppDomain, HRESULT SetContextInfo(LPCWSTR exePath, BOOL isExe) DAC_EMPTY_RET(E_FAIL); HRESULT GetDependencies(CORCOMPILE_DEPENDENCY **ppDependencies, DWORD *cDependencies) DAC_EMPTY_RET(E_FAIL); -#ifdef FEATURE_FUSION - HRESULT GetIBindContext(IBindContext **ppBindCtx) DAC_EMPTY_RET(E_FAIL); -#endif #ifdef CROSSGEN_COMPILE HRESULT SetPlatformWinmdPaths(LPCWSTR pwzPlatformWinmdPaths) DAC_EMPTY_RET(E_FAIL); diff --git a/src/vm/coreassemblyspec.cpp b/src/vm/coreassemblyspec.cpp index 33499e5f4c..7cb1f56315 100644 --- a/src/vm/coreassemblyspec.cpp +++ b/src/vm/coreassemblyspec.cpp @@ -24,7 +24,6 @@ #include "compile.h" #endif -#ifndef FEATURE_FUSION #include "../binder/inc/textualidentityparser.hpp" #include "../binder/inc/assemblyidentity.hpp" @@ -594,4 +593,3 @@ VOID BaseAssemblySpec::GetFileOrDisplayName(DWORD flags, SString &result) const } -#endif // FEATURE_FUSION diff --git a/src/vm/corebindresult.cpp b/src/vm/corebindresult.cpp index 68803e24b9..3013264ade 100644 --- a/src/vm/corebindresult.cpp +++ b/src/vm/corebindresult.cpp @@ -15,7 +15,6 @@ #include "../binder/inc/assembly.hpp" -#ifndef FEATURE_FUSION #ifndef DACCESS_COMPILE STDMETHODIMP CoreBindResult::QueryInterface(REFIID riid, @@ -63,4 +62,3 @@ STDMETHODIMP_(ULONG) CoreBindResult::Release() #endif // DACCES_COMPILE -#endif // FEATURE_FUSION diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index f342933899..c50c3c4d86 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -766,7 +766,6 @@ void DomainFile::VerifyNativeImageDependencies(bool verifyOnly) goto NativeImageRejected; } -#ifndef FEATURE_FUSION // Fusion does this verification at native binding time. PTR_PEImageLayout pDependencyNativeLayout = pDependencyNativeImage->GetLoadedLayout(); // Assert that the native image signature is as expected // Fusion will ensure this @@ -776,7 +775,6 @@ void DomainFile::VerifyNativeImageDependencies(bool verifyOnly) LoggablePEAssembly logAsm(pDependencyFile); if (!RuntimeVerifyNativeImageDependency(pDependency, pDependencyNativeVersion, &logAsm)) goto NativeImageRejected; -#endif } LOG((LF_ZAP, LL_INFO100, "ZAP: Native image dependencies for %S OK.\n", pNativeImage->GetPath().GetUnicode())); @@ -1190,27 +1188,6 @@ void DomainFile::FinishLoad() if (m_pFile->HasNativeImage()) { -#ifdef FEATURE_FUSION - // <REVISIT_TODO>Because of bug 112034, we may commit to a native image even though - // we should not have.</REVISIT_TODO> - -// #ifdef _DEBUG - - // Verify that the native image dependencies are still valid - // Since we had already committed to using a native image, they cannot - // be invalidated - VerifyNativeImageDependencies(true); - _ASSERTE(m_pFile->HasNativeImage()); - - if (!m_pFile->HasNativeImage()) - { - STRESS_LOG1(LF_CODESHARING, LL_FATALERROR, "Incorrectly committed to using native image for %S", - m_pFile->GetPath().GetUnicode()); - EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); - } -// #endif - -#endif // FEATURE_FUSION LOG((LF_ZAP, LL_INFO10, "Using native image %S.\n", m_pFile->GetPersistentNativeImage()->GetPath().GetUnicode())); ExternalLog(LL_INFO10, "Native image successfully used."); @@ -1605,9 +1582,6 @@ DomainAssembly::DomainAssembly(AppDomain *pDomain, PEFile *pFile, AssemblyLoadSe : DomainFile(pDomain, pFile), m_pAssembly(NULL), m_debuggerFlags(DACF_NONE), -#ifdef FEATURE_FUSION - m_pAssemblyBindingClosure(NULL), -#endif m_MissingDependenciesCheckStatus(CMD_Unknown), m_fSkipPolicyResolution(pLoadSecurity != NULL && !pLoadSecurity->ShouldResolvePolicy()), m_fDebuggerUnloadStarted(FALSE), @@ -1652,26 +1626,6 @@ DomainAssembly::DomainAssembly(AppDomain *pDomain, PEFile *pFile, AssemblyLoadSe } else { -#ifdef FEATURE_FUSION - // We do not support sharing behavior of ALWAYS when using evidence to load assemblies - if (pDomain->GetSharePolicy() == AppDomain::SHARE_POLICY_ALWAYS - && ShouldLoadDomainNeutral()) - { - // Just because we have information about the loaded assembly's security doesn't mean that - // we're trying to override evidence, make sure we're not just trying to push a grant set - if (((pLoadSecurity->m_pEvidence != NULL) && (*pLoadSecurity->m_pEvidence != NULL)) || - ((pLoadSecurity->m_pAdditionalEvidence != NULL) && (*pLoadSecurity->m_pAdditionalEvidence != NULL))) - { - // We may not be able to reduce sharing policy at this point, if we have already loaded - // some non-GAC assemblies as domain neutral. For this case we must regrettably fail - // the whole operation. - if (!pDomain->ReduceSharePolicyFromAlways()) - { - ThrowHR(COR_E_CANNOT_SPECIFY_EVIDENCE); - } - } - } -#endif { GCX_COOP(); @@ -1739,10 +1693,6 @@ void DomainAssembly::ReleaseFiles() if(m_pAssembly) m_pAssembly->StartUnload(); -#ifdef FEATURE_FUSION - // release the old closure from the holder - m_pAssemblyBindingClosure=NULL; -#endif ModuleIterator i = IterateModules(kModIterIncludeLoading); while (i.Next()) { @@ -1881,131 +1831,6 @@ OBJECTREF DomainAssembly::GetExposedAssemblyObject() #ifdef FEATURE_LOADER_OPTIMIZATION -#ifdef FEATURE_FUSION -// This inner method exists to avoid EX_TRY calling _alloca repeatedly in the for loop below. -DomainAssembly::CMDI_Result DomainAssembly::CheckMissingDependencyInner(IAssemblyBindingClosure* pClosure, DWORD idx) -{ - CONTRACTL { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - } CONTRACTL_END; - - SafeComHolder<IAssemblyName> pAssemblyName; - HRESULT hrBindFailure = S_OK; - HRESULT hr = pClosure->GetNextFailureAssembly(idx, &pAssemblyName, &hrBindFailure); - if (hr == HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)) - { - return CMDI_End; - } - - IfFailThrow(hr); - - CMDI_Result ret = CMDI_AssemblyResolveFailed; - AssemblySpec spec; - PEAssemblyHolder result; - - EX_TRY - { - spec.InitializeSpec(pAssemblyName, this, FALSE); - result = this->GetAppDomain()->TryResolveAssembly(&spec,FALSE); - - if (result && result->CanUseWithBindingCache()) - { - this->GetAppDomain()->AddFileToCache(&spec, result); - ret = CMDI_AssemblyResolveSucceeded; - } - else - { - _ASSERTE(FAILED(hrBindFailure)); - - StackSString name; - spec.GetFileOrDisplayName(0, name); - NewHolder<EEFileLoadException> pEx(new EEFileLoadException(name, hrBindFailure)); - this->GetAppDomain()->AddExceptionToCache(&spec, pEx); - } - } - EX_CATCH - { - // For compat reasons, we don't want to throw right now but make sure that we - // cache the exception so that it can be thrown if/when we try to load the - // further down the road. See VSW 528532 for more details. - } - EX_END_CATCH(RethrowTransientExceptions); - - return ret; -} - - -// CheckMissingDependencies returns FALSE if any missing dependency would -// successfully bind with an AssemblyResolve event. When this is the case, we -// want to avoid sharing this assembly, since AssemblyResolve events are not -// under our control, and therefore not predictable. -CMD_State DomainAssembly::CheckMissingDependencies() -{ - CONTRACTL { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - } CONTRACTL_END; - - if (MissingDependenciesCheckDone()) - return m_MissingDependenciesCheckStatus; - - if (this->GetAppDomain()->IsCompilationDomain()) - { - // Compilation domains will never have resolve events. Plus, this path - // will sidestep the compilation domain's bind override, which will make - // us skip over some dependencies. - m_MissingDependenciesCheckStatus = CMD_NotNeeded; - return m_MissingDependenciesCheckStatus; - } - - if (IsSystem()) - { - m_MissingDependenciesCheckStatus = CMD_NotNeeded; - return m_MissingDependenciesCheckStatus; - } - - GCX_PREEMP(); - IAssemblyBindingClosure * pClosure = GetAssemblyBindingClosure(LEVEL_COMPLETE); - - if(pClosure == NULL) - { - // If the closure is empty, no need to iterate them. - m_MissingDependenciesCheckStatus = CMD_NotNeeded; - return m_MissingDependenciesCheckStatus; - } - - for (DWORD idx = 0;;idx++) - { - switch (CheckMissingDependencyInner(pClosure, idx)) - { - case CMDI_AssemblyResolveSucceeded: - { - STRESS_LOG1(LF_CODESHARING,LL_INFO100,"Missing dependencies check FAILED, DomainAssembly=%p",this); - m_MissingDependenciesCheckStatus = CMD_Resolved; - return m_MissingDependenciesCheckStatus; - break; - } - - case CMDI_End: - { - STRESS_LOG1(LF_CODESHARING,LL_INFO100,"Missing dependencies check SUCCESSFUL, DomainAssembly=%p",this); - m_MissingDependenciesCheckStatus = CMD_IndeedMissing; - return m_MissingDependenciesCheckStatus; - break; - } - - case CMDI_AssemblyResolveFailed: - { - // Don't take any action, just continue the loop. - break; - } - } - } -} -#endif // FEATURE_FUSION BOOL DomainAssembly::MissingDependenciesCheckDone() { @@ -2115,15 +1940,6 @@ void DomainAssembly::FindNativeImage() #endif // FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS -#ifdef FEATURE_FUSION - DomainAssembly * pDomainAssembly = GetDomainAssembly(); - if (pDomainAssembly->GetSecurityDescriptor()->HasAdditionalEvidence() || - !(pDomainAssembly->GetFile()->IsContextLoad() || - pDomainAssembly->GetFile()->HasHostAssembly())) - { - m_pFile->SetCannotUseNativeImage(); - } -#endif //FEATURE_FUSION ClearNativeImageStress(); @@ -2148,10 +1964,6 @@ void DomainAssembly::FindNativeImage() m_dwReasonForRejectingNativeImage = ReasonForRejectingNativeImage_MscorlibNotNative; STRESS_LOG2(LF_ZAP,LL_INFO100,"Rejecting native file %p, because mscolib has not NI - reason 0x%x\n",pNativeImage.GetValue(),m_dwReasonForRejectingNativeImage); ExternalLog(LL_ERROR, "Rejecting native image because mscorlib does not have native image"); -#ifdef FEATURE_FUSION - if(GetFile()) - GetFile()->ETWTraceLogMessage(ETW::BinderLog::BinderStructs::NGEN_BIND_SYSTEM_ASSEMBLY_NATIVEIMAGE_NOT_AVAILABLE, NULL); -#endif GetFile()->ClearNativeImage(); #ifdef FEATURE_WINDOWSPHONE @@ -2168,10 +1980,6 @@ void DomainAssembly::FindNativeImage() "The assembly's permissions must have changed since the time it was ngenned, " "or it is running with a different security context."); -#ifdef FEATURE_FUSION - if(GetFile()) - GetFile()->ETWTraceLogMessage(ETW::BinderLog::BinderStructs::NGEN_BIND_ASSEMBLY_HAS_DIFFERENT_GRANT, NULL); -#endif GetFile()->ClearNativeImage(); #ifdef FEATURE_WINDOWSPHONE @@ -2188,10 +1996,6 @@ void DomainAssembly::FindNativeImage() "with one or more of its assembly dependencies. The assembly needs " "to be ngenned again"); -#ifdef FEATURE_FUSION - if(GetFile()) - GetFile()->ETWTraceLogMessage(ETW::BinderLog::BinderStructs::NGEN_BIND_DEPENDENCY_HAS_DIFFERENT_IDENTITY, NULL); -#endif GetFile()->ClearNativeImage(); #ifdef FEATURE_WINDOWSPHONE @@ -2220,15 +2024,6 @@ void DomainAssembly::FindNativeImage() { GetFile()->SetNativeImageUsedExclusively(); } -#ifdef FEATURE_FUSION - else - { - if (!IsSystem()) - { - GetFile()->SetNativeImageClosure(GetAssemblyBindingClosure(LEVEL_STARTING)); - } - } -#endif //FEATURE_FUSION PEAssembly * pFile = (PEAssembly *)FastInterlockCompareExchangePointer((void **)ppNativeFile, (void *)GetFile(), (void *)NULL); STRESS_LOG3(LF_ZAP,LL_INFO100,"Attempted to set new native file %p, old file was %p, location in the image=%p\n",GetFile(),pFile,ppNativeFile); @@ -2237,9 +2032,6 @@ void DomainAssembly::FindNativeImage() ( !bExpectedToBeShared || pFile == PEFile::Dummy() || pFile->IsNativeImageUsedExclusively() || -#ifdef FEATURE_FUSION - !pFile->HasEqualNativeClosure(this) || -#endif //FEATURE_FUSION !(GetFile()->GetPath().Equals(pFile->GetPath()))) ) @@ -2256,10 +2048,6 @@ void DomainAssembly::FindNativeImage() "- abandoning ngen image. The assembly will be JIT-compiled in " "the second appdomain. See System.LoaderOptimization.MultiDomain " "for information about domain-neutral loading."); -#ifdef FEATURE_FUSION - if(GetFile()) - GetFile()->ETWTraceLogMessage(ETW::BinderLog::BinderStructs::NGEN_BIND_ASSEMBLY_NOT_DOMAIN_NEUTRAL, NULL); -#endif GetFile()->ClearNativeImage(); // We only support a (non-shared) native image to be used from a single @@ -2363,55 +2151,6 @@ BOOL DomainAssembly::ShouldSkipPolicyResolution() } -#if defined(FEATURE_LOADER_OPTIMIZATION) && defined(FEATURE_FUSION) -// -// Returns TRUE if the attempt to steal ownership of the native image succeeded, or if there are other -// reasons for retrying load of the native image in the current appdomain. -// -// Returns FALSE if the native image should be rejected in the current appdomain. -// -static BOOL TryToStealSharedNativeImageOwnership(PEFile ** ppNativeImage, PEFile * pNativeFile, PEFile * pFile) -{ - STANDARD_VM_CONTRACT; - - if (pNativeFile == PEFile::Dummy()) - { - // Nothing to steal anymore. Loading of the native image failed elsewhere. - return FALSE; - } - - _ASSERTE(!pNativeFile->IsNativeImageUsedExclusively()); - _ASSERTE(!pFile->IsNativeImageUsedExclusively()); - - SharedDomain * pSharedDomain = SharedDomain::GetDomain(); - - // Take the lock so that nobody steals or creates Assembly object for this native image while we are stealing it - SharedFileLockHolder pNativeFileLock(pSharedDomain, pNativeFile, TRUE); - - if (pNativeFile != VolatileLoad(ppNativeImage)) - { - // The ownership changed before we got a chance. Retry. - return TRUE; - } - - SharedAssemblyLocator locator(pNativeFile->AsAssembly(), SharedAssemblyLocator::PEASSEMBLYEXACT); - if (pSharedDomain->FindShareableAssembly(&locator)) - { - // Another shared assembly (with different binding closure) uses this image, therefore we cannot use it - return FALSE; - } - - BOOL success = InterlockedCompareExchangeT(ppNativeImage, pFile, pNativeFile) == pNativeFile; - - // If others can reuse us, we cannot go away - if (success) - pFile->AddRef(); - - STRESS_LOG3(LF_ZAP,LL_INFO100,"Attempt to steal ownership from native file %p by %p success %d\n", pNativeFile, pFile, success); - - return TRUE; -} -#endif // FEATURE_LOADER_OPTIMIZATION && FEATURE_FUSION // This is where the decision whether an assembly is DomainNeutral (shared) nor not is made. void DomainAssembly::Allocate() @@ -2446,9 +2185,6 @@ void DomainAssembly::Allocate() #ifdef FEATURE_LOADER_OPTIMIZATION -#ifdef FEATURE_FUSION -Retry: -#endif // Try to find an existing shared version of the assembly which // is compatible with our domain. @@ -2478,54 +2214,6 @@ Retry: if (pAssembly == NULL) { -#ifdef FEATURE_FUSION - // Final verification that we can use the ngen image. - // - // code:DomainAssembly::FindNativeImage checks the binding closures before declaring the native image as shareable candidate, - // but the ultimate decisions about sharing happens inside code:Assembly::CanBeShared called from FindShareableAssembly above. - // code:Assembly::CanBeShared checks more conditions than just binding closures. In particular, it also checks whether AssemblyResolve - // event resolves any missing dependencies found in the binding closure - the assembly cannot be shared if it is the case. - // The end result is that same ngen image can get here in multiple domains in parallel, but it may not be shareable between all of them. - // - // We reconcile this conflict by checking whether there is somebody else conflicting with us. If it is, we will try to steal - // the ownership of the native image from the other guy and retry. The retry logic is required to prevent a perfectly valid - // native image being dropped on the floor just because of multiple appdomains raced to load it. - { - ReleaseHolder<PEImage> pNativeImage = GetFile()->GetNativeImageWithRef(); - if ((pNativeImage != NULL) && (pNativeImage->GetLoadedLayout() != NULL)) - { - Module * pNativeModule = pNativeImage->GetLoadedLayout()->GetPersistedModuleImage(); - if (pNativeModule != NULL) - { - // The owner of the native module was set thread-safe in code:DomainAssembly::FindNativeImage - // However the final decision if we can share the native image is done in this function (see usage of code:FindShareableAssembly above) - PEFile ** ppNativeFile = (PEFile **) (PBYTE(pNativeModule) + Module::GetFileOffset()); - PEFile * pNativeFile = VolatileLoad(ppNativeFile); - if (pNativeFile != GetFile()) - { - pFileLock.Release(); - - // Ensures that multiple threads won't fight with each other indefinitely - __SwitchToThread(0, ++dwSwitchCount); - - if (!TryToStealSharedNativeImageOwnership(ppNativeFile, pNativeFile, GetFile())) - { - // If a shared assembly got loaded in the mean time, retry all lookups again - if (pSharedDomain->GetShareableAssemblyCount() != nInitialShareableAssemblyCount) - goto Retry; - - m_dwReasonForRejectingNativeImage = ReasonForRejectingNativeImage_NiAlreadyUsedInAnotherSharedAssembly; - STRESS_LOG3(LF_ZAP,LL_INFO100,"Rejecting native file %p, because it is already used by shared file %p - reason 0x%x\n",GetFile(),pNativeFile,m_dwReasonForRejectingNativeImage); - GetFile()->ClearNativeImage(); - GetFile()->SetCannotUseNativeImage(); - } - - goto Retry; - } - } - } - } -#endif // FEATURE_FUSION // We can now rely on the fact that our MDImport will not change so we can stop refcounting it. GetFile()->MakeMDImportPersistent(); @@ -2551,13 +2239,6 @@ Retry: // This is because the resulting shared assembly that we will depend on // DOES have those dependencies, but we won't be able to validly share that // assembly unless we match all of ITS dependencies, too. -#ifdef FEATURE_FUSION - if ((this->GetAppDomain()->GetFusionContext() != NULL) && !IsSystem()) - { - IAssemblyBindingClosure* pClosure = GetAssemblyBindingClosure(LEVEL_STARTING); - pAssembly->SetBindingClosure(pClosure); - } -#endif // FEATURE_FUSION // Sets the tenured bit atomically with the hash insert. pSharedDomain->AddShareableAssembly(pAssembly); } @@ -2613,9 +2294,6 @@ Retry: // Insert AssemblyDef details into AssemblySpecBindingCache if appropriate -#ifdef FEATURE_FUSION - fInsertIntoAssemblySpecBindingCache = GetFile()->GetLoadContext() == LOADCTX_TYPE_DEFAULT; -#endif fInsertIntoAssemblySpecBindingCache = fInsertIntoAssemblySpecBindingCache && GetFile()->CanUseWithBindingCache(); @@ -3165,125 +2843,6 @@ BOOL DomainAssembly::CheckZapSecurity(PEImage *pNativeImage) -#ifdef FEATURE_FUSION -IAssemblyBindingClosure* DomainAssembly::GetAssemblyBindingClosure(WALK_LEVEL level) -{ - CONTRACT(IAssemblyBindingClosure *) - { - INSTANCE_CHECK; - POSTCONDITION(CheckPointer(RETVAL,NULL_OK)); - //we could return NULL instead of asserting but hitting code paths that call this for mscorlib is just wasting of cycles anyhow - PRECONDITION(!IsSystem()); - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - - if (m_pAssemblyBindingClosure == NULL || m_pAssemblyBindingClosure->HasBeenWalked(level) == S_FALSE) - { - SafeComHolder<IAssemblyBindingClosure> pClosure; - if (this->GetAppDomain()->GetFusionContext() == NULL) - { - _ASSERTE(IsSystem()); - RETURN NULL; - } - - GCX_PREEMP(); - - ReleaseHolder<IBindResult> pWinRTBindResult; - IUnknown * pUnk; - - if (GetFile()->IsIStream()) - { - pUnk = GetFile()->GetIHostAssembly(); - } - else if (GetFile()->IsWindowsRuntime()) - { // It is .winmd file (WinRT assembly) - IfFailThrow(CLRPrivAssemblyWinRT::GetIBindResult(GetFile()->GetHostAssembly(), &pWinRTBindResult)); - pUnk = pWinRTBindResult; - } - else - { - pUnk = GetFile()->GetFusionAssembly(); - } - - if (m_pAssemblyBindingClosure == NULL) - { - IfFailThrow(this->GetAppDomain()->GetFusionContext()->GetAssemblyBindingClosure(pUnk, NULL, &pClosure)); - if (FastInterlockCompareExchangePointer<IAssemblyBindingClosure*>(&m_pAssemblyBindingClosure, pClosure.GetValue(), NULL) == NULL) - { - pClosure.SuppressRelease(); - } - } - IfFailThrow(m_pAssemblyBindingClosure->EnsureWalked(pUnk, this->GetAppDomain()->GetFusionContext(), level)); - } - RETURN m_pAssemblyBindingClosure; -} - -// This is used to determine if the binding closure of the assembly in question is in the GAC. Amongst other uses, -// this is the MULTI_DOMAIN_HOST scenario. -BOOL DomainAssembly::IsClosedInGAC() -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - if (IsSystem()) - return TRUE; - - BOOL fIsWindowsRuntime = GetFile()->IsWindowsRuntime(); - - if (!GetFile()->IsSourceGAC() && !fIsWindowsRuntime) - return FALSE; - - // Do a binding closure that will help us determine if all the dependencies are in the GAC or not. - IAssemblyBindingClosure * pClosure = GetAssemblyBindingClosure(LEVEL_GACCHECK); - if (pClosure == NULL) - return FALSE; - - // Once the closure is complete, determine if the dependencies are closed in the GAC (or not). - HRESULT hr = pClosure->IsAllAssembliesInGAC(); - IfFailThrow(hr); - - return (hr == S_OK); -} - -BOOL DomainAssembly::MayHaveUnknownDependencies() -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - if (IsSystem()) - return FALSE; - - // Perform the binding closure walk to initialize state that will help us - // determine if we have dependencies that could prevent code-sharing. - IAssemblyBindingClosure * pClosure = GetAssemblyBindingClosure(LEVEL_WINRTCHECK); - if (pClosure == NULL) - return FALSE; - - HRESULT hr = pClosure->MayHaveUnknownDependencies(); - IfFailThrow(hr); - - return (hr == S_OK); -} - -#endif // FEATURE_FUSION // <TODO>@todo Find a better place for these</TODO> diff --git a/src/vm/domainfile.h b/src/vm/domainfile.h index a468c0a7d9..e91077425d 100644 --- a/src/vm/domainfile.h +++ b/src/vm/domainfile.h @@ -521,11 +521,6 @@ public: return PTR_PEAssembly(m_pFile); } -#ifdef FEATURE_FUSION - IAssemblyBindingClosure* GetAssemblyBindingClosure(WALK_LEVEL level); - BOOL IsClosedInGAC(); - BOOL MayHaveUnknownDependencies(); -#endif // Returns security information for the assembly based on the codebase void GetSecurityIdentity(SString &codebase, SecZone *pdwZone, DWORD dwFlags, BYTE *pbUniqueID, DWORD *pcbUniqueID); @@ -537,19 +532,6 @@ public: } #ifdef FEATURE_LOADER_OPTIMIZATION -#ifdef FEATURE_FUSION -private: - enum CMDI_Result - { - CMDI_End, - CMDI_AssemblyResolveSucceeded, - CMDI_AssemblyResolveFailed - }; - - CMDI_Result CheckMissingDependencyInner(IAssemblyBindingClosure* pClosure, DWORD idx); - - -#endif public: CMD_State CheckMissingDependencies(); BOOL MissingDependenciesCheckDone(); @@ -824,9 +806,6 @@ private: PTR_IAssemblySecurityDescriptor m_pSecurityDescriptor; PTR_Assembly m_pAssembly; DebuggerAssemblyControlFlags m_debuggerFlags; -#ifdef FEATURE_FUSION - ReleaseHolder<IAssemblyBindingClosure> m_pAssemblyBindingClosure; -#endif CMD_State m_MissingDependenciesCheckStatus; ArrayList m_Modules; BOOL m_fSkipPolicyResolution; diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index 297cb8d55d..abf79802b5 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -601,20 +601,12 @@ FCFuncStart(gAppDomainManagerFuncs) QCFuncElement("GetEntryAssembly", AssemblyNative::GetEntryAssembly) FCFuncEnd() -#ifdef FEATURE_FUSION -FCFuncStart(gAppDomainSetupFuncs) - FCFuncElement("UpdateContextProperty", AppDomainNative::UpdateContextProperty) -FCFuncEnd() -#endif // FEATURE_FUSION FCFuncStart(gAppDomainFuncs) #ifdef FEATURE_REMOTING FCFuncElement("GetDefaultDomain", AppDomainNative::GetDefaultDomain) #endif -#ifdef FEATURE_FUSION - FCFuncElement("GetFusionContext", AppDomainNative::GetFusionContext) -#endif // FEATURE_FUSION FCFuncElement("IsStringInterned", AppDomainNative::IsStringInterned) FCFuncElement("IsUnloadingForcedFinalize", AppDomainNative::IsUnloadingForcedFinalize) #ifdef FEATURE_REMOTING @@ -1524,9 +1516,6 @@ FCFuncEnd() FCClassElement("AppDomain", "System", gAppDomainFuncs) FCClassElement("AppDomainManager", "System", gAppDomainManagerFuncs) -#ifdef FEATURE_FUSION -FCClassElement("AppDomainSetup", "System", gAppDomainSetupFuncs) -#endif // FEATURE_FUSION FCClassElement("ArgIterator", "System", gVarArgFuncs) FCClassElement("Array", "System", gArrayFuncs) FCClassElement("ArrayWithOffset", "System.Runtime.InteropServices", gArrayWithOffsetFuncs) diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp index 4abfcc7dc7..f7301531b4 100644 --- a/src/vm/eeconfig.cpp +++ b/src/vm/eeconfig.cpp @@ -16,9 +16,6 @@ #endif #include "eeconfig.h" #include "method.hpp" -#ifdef FEATURE_FUSION -#include "fusionsetup.h" -#endif #include "eventtrace.h" #include "eehash.h" #include "eemessagebox.h" @@ -1068,26 +1065,6 @@ HRESULT EEConfig::sync() g_IBCLogger.DisableAllInstr(); #endif -#ifdef FEATURE_FUSION - IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_ZapSet, (LPWSTR*)&pZapSet)); - - m_fFreepZapSet = true; - - if (pZapSet == NULL) - { - m_fFreepZapSet = false; - pZapSet = W(""); - } - if (wcslen(pZapSet) > 3) - { - _ASSERTE(!"Zap Set String must be less than 3 chars"); - delete[] pZapSet; - m_fFreepZapSet = false; - pZapSet = W(""); - } - - fNgenBindOptimizeNonGac = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NgenBind_OptimizeNonGac) != 0; -#endif dwDisableStackwalkCache = GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_DisableStackwalkCache, dwDisableStackwalkCache); @@ -1202,17 +1179,6 @@ HRESULT EEConfig::sync() fExpandAllOnLoad = (GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_ExpandAllOnLoad, fExpandAllOnLoad) != 0); #endif //_DEBUG -#ifdef FEATURE_FUSION - if(g_pConfig) { - LPCWSTR result = NULL; - if(SUCCEEDED(g_pConfig->GetConfiguration_DontUse_(CLRConfig::EXTERNAL_developerInstallation, CONFIG_SYSTEM, &result)) && result) - { - // <TODO> CTS, add addtional checks to ensure this is an SDK installation </TODO> - if(SString::_wcsicmp(result, W("true")) == 0) - m_fDeveloperInstallation = true; - } - } -#endif #ifdef AD_NO_UNLOAD fAppDomainUnload = (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_AppDomainNoUnload) == 0); diff --git a/src/vm/eetoprofinterfaceimpl.cpp b/src/vm/eetoprofinterfaceimpl.cpp index e96a9e58d3..ca35717bec 100644 --- a/src/vm/eetoprofinterfaceimpl.cpp +++ b/src/vm/eetoprofinterfaceimpl.cpp @@ -6282,116 +6282,6 @@ HRESULT EEToProfInterfaceImpl::ProfilerDetachSucceeded() } } -#ifdef FEATURE_FUSION - -// Minimal wrappers so that Fusion can call the GetAssemblyReferences profiler callback -// without needing a ton of profapi includes. - -BOOL ShouldCallGetAssemblyReferencesProfilerCallback() -{ - return CORProfilerAddsAssemblyReferences(); -} - -void CallGetAssemblyReferencesProfilerCallbackIfNecessary(LPCWSTR wszAssemblyPath, IAssemblyBindingClosure * pClosure, AssemblyReferenceClosureWalkContextForProfAPI * pContext) -{ - BEGIN_PIN_PROFILER(CORProfilerAddsAssemblyReferences()); - g_profControlBlock.pProfInterface->GetAssemblyReferences(wszAssemblyPath, pClosure, pContext); - END_PIN_PROFILER(); -} - -// Implementation of ICorProfilerAssemblyReferenceProvider, which is given to the profiler so -// that it can call back into the CLR with extra assembly references that should be considered -// while Fusion performs its assembly reference closure walk. -class ProfilerAssemblyReferenceProvider : public ICorProfilerAssemblyReferenceProvider -{ -public: - // IUnknown functions - virtual HRESULT __stdcall QueryInterface(REFIID id, void** pInterface) - { - LIMITED_METHOD_CONTRACT; - - if (id == IID_IUnknown) - { - *pInterface = static_cast<IUnknown *>(this); - } - else if (id == IID_ICorProfilerAssemblyReferenceProvider) - { - *pInterface = static_cast<ICorProfilerAssemblyReferenceProvider *>(this); - } - else - { - *pInterface = NULL; - return E_NOINTERFACE; - } - - AddRef(); - return S_OK; - } - - virtual ULONG __stdcall AddRef() - { - LIMITED_METHOD_CONTRACT; - return InterlockedIncrement(&m_refCount); - } - - virtual ULONG __stdcall Release() - { - LIMITED_METHOD_CONTRACT; - - ULONG refCount = InterlockedDecrement(&m_refCount); - - if (0 == refCount) - { - delete this; - } - - return refCount; - } - - // ICorProfilerAssemblyReferenceProvider functions - - // This is what the profiler calls to tell us about an assembly reference we should include - // when Fusion performs its closure walk. When this is called, the walk is already underway, - // and is sitting on our stack already. - virtual HRESULT __stdcall AddAssemblyReference(const COR_PRF_ASSEMBLY_REFERENCE_INFO * pAssemblyRefInfo) - { - _ASSERTE(m_pClosure != NULL); - - return m_pClosure->AddProfilerAssemblyReference( - pAssemblyRefInfo->pbPublicKeyOrToken, - pAssemblyRefInfo->cbPublicKeyOrToken, - pAssemblyRefInfo->szName, - pAssemblyRefInfo->pMetaData, - pAssemblyRefInfo->pbHashValue, - pAssemblyRefInfo->cbHashValue, - pAssemblyRefInfo->dwAssemblyRefFlags, - m_pContext); - } - - // Implementation - ProfilerAssemblyReferenceProvider(IAssemblyBindingClosure * pClosure, AssemblyReferenceClosureWalkContextForProfAPI * pContext) : - m_refCount(1), - m_pClosure(pClosure), - m_pContext(pContext) - { - LIMITED_METHOD_CONTRACT; - m_pClosure->AddRef(); - } - -protected: - Volatile<LONG> m_refCount; - - // Our interface into Fusion's closure walk. We use this to inform Fusion about - // the assembly reference the profiler gave us. - ReleaseHolder<IAssemblyBindingClosure> m_pClosure; - - // Extra context built up by fusion's closure walk that we need to remember. The - // walk is already in action by the time we're called, and this structure remembers - // the lists that are getting built up by the walk - AssemblyReferenceClosureWalkContextForProfAPI * m_pContext; -}; - -#endif // FEATURE_FUSION HRESULT EEToProfInterfaceImpl::GetAssemblyReferences(LPCWSTR wszAssemblyPath, IAssemblyBindingClosure * pClosure, AssemblyReferenceClosureWalkContextForProfAPI * pContext) @@ -6421,30 +6311,6 @@ HRESULT EEToProfInterfaceImpl::GetAssemblyReferences(LPCWSTR wszAssemblyPath, IA )); HRESULT hr = S_OK; -#ifdef FEATURE_FUSION - - SString sPath; - _ASSERTE(IsCallback6Supported()); - - // Create an instance of the class implementing the interface we pass back to the profiler, - // feeding it the context we're currently at in Fusion's closure walk - ReleaseHolder<ProfilerAssemblyReferenceProvider> pReferenceProvider = - new (nothrow) ProfilerAssemblyReferenceProvider(pClosure, pContext); - if (pReferenceProvider == NULL) - { - return E_OUTOFMEMORY; - } - - { - // All callbacks are really NOTHROW, but that's enforced partially by the profiler, - // whose try/catch blocks aren't visible to the contract system - PERMANENT_CONTRACT_VIOLATION(ThrowsViolation, ReasonProfilerCallout); - hr = m_pCallback6->GetAssemblyReferences( - wszAssemblyPath, - static_cast<ICorProfilerAssemblyReferenceProvider *>(pReferenceProvider)); - } - -#endif // FEATURE_FUSION return hr; } diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp index ba2f3dae57..c40797effb 100644 --- a/src/vm/eventtrace.cpp +++ b/src/vm/eventtrace.cpp @@ -5789,9 +5789,6 @@ VOID ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions ULONGLONG ullAssemblyId = (ULONGLONG)pAssembly; ULONGLONG ullDomainId = (ULONGLONG)pAssembly->GetDomain(); ULONGLONG ullBindingID = 0; -#if (defined FEATURE_PREJIT) && (defined FEATURE_FUSION) - ullBindingID = pAssembly->GetManifestFile()->GetBindingID(); -#endif ULONG ulAssemblyFlags = ((bIsDomainNeutral ? ETW::LoaderLog::LoaderStructs::DomainNeutralAssembly : 0) | (bIsDynamicAssembly ? ETW::LoaderLog::LoaderStructs::DynamicAssembly : 0) | (bHasNativeImage ? ETW::LoaderLog::LoaderStructs::NativeAssembly : 0) | diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 7a7b55b8e9..a7117c2ead 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -13728,24 +13728,6 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrowSO() // Throw an InvalidCastException //========================================================================== -#ifdef FEATURE_FUSION -static const WCHAR *GetContextName(LOADCTX_TYPE kLoadContext, - BOOL fIntrospectionOnly) -{ - LIMITED_METHOD_CONTRACT; - - // Context names are treated as symbols and therefore not localized - switch (kLoadContext) - { - case LOADCTX_TYPE_DEFAULT: - return W("Default"); - case LOADCTX_TYPE_LOADFROM: - return W("LoadFrom"); - default: - return (fIntrospectionOnly ? W("InspectionContext") : W("LoadNeither")); - } -} -#endif VOID GetAssemblyDetailInfo(SString &sType, SString &sAssemblyDisplayName, @@ -13755,12 +13737,7 @@ VOID GetAssemblyDetailInfo(SString &sType, WRAPPER_NO_CONTRACT; InlineSString<MAX_LONGPATH> sFormat; -#ifdef FEATURE_FUSION - const WCHAR *pwzLoadContext = GetContextName(pPEAssembly->GetLoadContext(), - pPEAssembly->IsIntrospectionOnly()); -#else const WCHAR *pwzLoadContext = W("Default"); -#endif if (pPEAssembly->GetPath().IsEmpty()) { diff --git a/src/vm/fusionbind.cpp b/src/vm/fusionbind.cpp deleted file mode 100644 index 0a337796bb..0000000000 --- a/src/vm/fusionbind.cpp +++ /dev/null @@ -1,661 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Header: FusionBind.cpp -** -** Purpose: Implements fusion interface -** -** - - -===========================================================*/ - -#include "common.h" - -#include <stdlib.h> -#include "fusionbind.h" -#include "shimload.h" -#include "eventtrace.h" -#include "strongnameholders.h" - -HRESULT BaseAssemblySpec::ParseName() -{ - CONTRACTL - { - INSTANCE_CHECK; - GC_NOTRIGGER; - NOTHROW; - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - HRESULT hr = S_OK; - - if (!m_pAssemblyName) - return S_OK; - - CQuickBytes ssName; - - hr = ssName.ConvertUtf8_UnicodeNoThrow(m_pAssemblyName); - - if (SUCCEEDED(hr)) - { - NonVMComHolder<IAssemblyName> pName; - - IfFailRet(CreateAssemblyNameObject(&pName, (LPCWSTR) ssName.Ptr(), CANOF_PARSE_DISPLAY_NAME, NULL)); - - if (m_ownedFlags & NAME_OWNED) - delete [] m_pAssemblyName; - m_pAssemblyName = NULL; - - hr = Init(pName); - } - - return hr; -} - -void BaseAssemblySpec::GetFileOrDisplayName(DWORD flags, SString &result) const -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - INJECT_FAULT(ThrowOutOfMemory()); - PRECONDITION(CheckValue(result)); - PRECONDITION(result.IsEmpty()); - } - CONTRACTL_END; - - if (m_pAssemblyName != NULL) { - NonVMComHolder<IAssemblyName> pFusionName; - IfFailThrow(CreateFusionName(&pFusionName)); - - FusionBind::GetAssemblyNameDisplayName(pFusionName, result, flags); - } - else - result.Set(m_wszCodeBase); -} - -HRESULT AssemblySpec::LoadAssembly(IApplicationContext* pFusionContext, - FusionSink *pSink, - IAssembly** ppIAssembly, - IHostAssembly** ppIHostAssembly, - IBindResult** ppNativeFusionAssembly, - BOOL fForIntrospectionOnly, - BOOL fSuppressSecurityChecks) -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - MODE_PREEMPTIVE; - INJECT_FAULT(ThrowOutOfMemory()); - } - CONTRACTL_END; - - HRESULT hr = E_FAIL; - - if (!IsAfContentType_Default(m_dwFlags)) - { // Fusion can process only Default ContentType (non-WindowsRuntime) - IfFailThrow(COR_E_BADIMAGEFORMAT); - } - - NonVMComHolder<IAssembly> pIAssembly(NULL); - NonVMComHolder<IBindResult> pNativeFusionAssembly(NULL); - NonVMComHolder<IHostAssembly> pIHostAssembly(NULL); - NonVMComHolder<IAssemblyName> pSpecName; - NonVMComHolder<IAssemblyName> pCodeBaseName; - - - BOOL fFXOnly = FALSE; - DWORD size = sizeof(fFXOnly); - - hr = pFusionContext->Get(ACTAG_FX_ONLY, &fFXOnly, &size, 0); - if(FAILED(hr)) - { - /// just in case it corrupted fFXOnly - fFXOnly = FALSE; - } - - // reset hr - hr = E_FAIL; - - // Make sure we don't have malformed names - - if (m_pAssemblyName) - IfFailGo(FusionBind::VerifyBindingString(m_pAssemblyName)); - - if (m_context.szLocale) - IfFailGo(FusionBind::VerifyBindingString(m_context.szLocale)); - - // If we have assembly name info, first bind using that - if (m_pAssemblyName != NULL) { - IfFailGo(CreateFusionName(&pSpecName, FALSE)); - - if(m_fParentLoadContext == LOADCTX_TYPE_UNKNOWN) - { - BOOL bOptionallyRetargetable; - IfFailGo(IsOptionallyRetargetableAssembly(pSpecName, &bOptionallyRetargetable)); - if (bOptionallyRetargetable) - return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); // do not propagate to load, let the event handle - } - - hr = FusionBind::RemoteLoad(pFusionContext, pSink, - pSpecName, GetParentIAssembly(), NULL, - &pIAssembly, &pIHostAssembly, &pNativeFusionAssembly, fForIntrospectionOnly, fSuppressSecurityChecks); - } - - - // Now, bind using the codebase. - if (FAILED(hr) && !fFXOnly && m_wszCodeBase) { - // No resolution by code base for SQL-hosted environment, except for introspection - if((!fForIntrospectionOnly) && CorHost2::IsLoadFromBlocked()) - { - hr = FUSION_E_LOADFROM_BLOCKED; - goto ErrExit; - } - IfFailGo(CreateAssemblyNameObject(&pCodeBaseName, NULL, 0, NULL)); - - IfFailGo(pCodeBaseName->SetProperty(ASM_NAME_CODEBASE_URL, - (void*)m_wszCodeBase, - (DWORD)(wcslen(m_wszCodeBase) + 1) * sizeof(WCHAR))); - - // Note that we cannot bind a native image using a codebase, as it will - // always be in the LoadFrom context which does not support native images. - - pSink->Reset(); - hr = FusionBind::RemoteLoad(pFusionContext, pSink, - pCodeBaseName, NULL, m_wszCodeBase, - &pIAssembly, &pIHostAssembly, &pNativeFusionAssembly, fForIntrospectionOnly, fSuppressSecurityChecks); - - // If we had both name info and codebase, make sure they are consistent. - if (SUCCEEDED(hr) && m_pAssemblyName != NULL) { - - NonVMComHolder<IAssemblyName> pPolicyRefName(NULL); - if (!fForIntrospectionOnly) { - // Get post-policy ref, because we'll be comparing - // it against a post-policy def - HRESULT policyHr = PreBindAssembly(pFusionContext, - pSpecName, - NULL, // pAsmParent - &pPolicyRefName, - NULL); // pvReserved - if (FAILED(policyHr) && (policyHr != FUSION_E_REF_DEF_MISMATCH) && - (policyHr != E_INVALIDARG)) // partial ref - IfFailGo(policyHr); - } - - NonVMComHolder<IAssemblyName> pBoundName; - if (pIAssembly == NULL) - IfFailGo(pIHostAssembly->GetAssemblyNameDef(&pBoundName)); - else - IfFailGo(pIAssembly->GetAssemblyNameDef(&pBoundName)); - - // Order matters: Ref->IsEqual(Def) - HRESULT equalHr; - if (pPolicyRefName) - equalHr = pPolicyRefName->IsEqual(pBoundName, ASM_CMPF_DEFAULT); - else - equalHr = pSpecName->IsEqual(pBoundName, ASM_CMPF_DEFAULT); - if (equalHr != S_OK) - { - // post-policy name is pBoundName and it's not correct for the - // original name, so we need to clear it - ReleaseNameAfterPolicy(); - IfFailGo(FUSION_E_REF_DEF_MISMATCH); - } - } - } - - // We should have found an assembly by now. - IfFailGo(hr); - - // <NOTE> Comment about the comment below. The work is done in fusion now. - // But we still keep the comment here to illustrate the problem. </NOTE> - - // Until we can create multiple Assembly objects for a single HMODULE - // we can only store one IAssembly* per Assembly. It is very important - // to maintain the IAssembly* for an image that is in the load-context. - // An Assembly in the load-from-context can bind to an assembly in the - // load-context but not visa-versa. Therefore, if we every get an IAssembly - // from the load-from-context we must make sure that it will never be - // found using a load. If it did then we could end up with Assembly dependencies - // that are wrong. For example, if I do a LoadFrom() on an assembly in the GAC - // and it requires another Assembly that I have preloaded in the load-from-context - // then that dependency gets burnt into the Jitted code. Later on a Load() is - // done on the assembly in the GAC and we single instance it back to the one - // we have gotten from the load-from-context because the HMODULES are the same. - // Now the dependency is wrong because it would not have the preloaded assembly - // if the order was reversed. - -#if 0 - if (!fForIntrospectionOnly) - { - NonVMComHolder<IFusionLoadContext> pLoadContext; - if (pIAssembly == NULL) - IfFailGo(pIHostAssembly->GetFusionLoadContext(&pLoadContext)); - else - IfFailGo(pIAssembly->GetFusionLoadContext(&pLoadContext)); - - if (pLoadContext->GetContextType() == LOADCTX_TYPE_LOADFROM) { - _ASSERTE(pIAssembly != NULL); - HRESULT hrLocal; - - NonVMComHolder<IAssemblyName> pBoundName; - pIAssembly->GetAssemblyNameDef(&pBoundName); - - // We need to copy the bound name to modify it - IAssemblyName *pClone; - IfFailGo(pBoundName->Clone(&pClone)); - pBoundName.Release(); - pBoundName = pClone; - - // Null out the architecture for the second bind - IfFailGo(pBoundName->SetProperty(ASM_NAME_ARCHITECTURE, NULL, 0)); - - NonVMComHolder<IAssembly> pAliasingAssembly; - NonVMComHolder<IHostAssembly> pIHA; - pSink->Reset(); - hrLocal = FusionBind::RemoteLoad(pFusionContext, pSink, - pBoundName, NULL, NULL, - &pAliasingAssembly, &pIHA, fForIntrospectionOnly); - - if(SUCCEEDED(hrLocal)) { - // If the paths are the same or the loadfrom assembly is in the GAC, - // then use the non-LoadFrom assembly as the result. - - DWORD location; - hrLocal = pIAssembly->GetAssemblyLocation(&location); - BOOL alias = (SUCCEEDED(hrLocal) && location == ASMLOC_GAC); - - if (!alias) { - SString boundPath; - GetAssemblyManifestModulePath(pIAssembly, boundPath); - - SString aliasingPath; - GetAssemblyManifestModulePath(pAliasingAssembly, aliasingPath); - - alias = SString::_wcsicmp(boundPath, aliasingPath) == 0; - } - - // Keep the default context's IAssembly if the paths are the same - if (alias) - pIAssembly = pAliasingAssembly.Extract(); - } - } - } -#endif - - if (SUCCEEDED(hr)) { - if (pIAssembly == NULL) - *ppIHostAssembly = pIHostAssembly.Extract(); - else - *ppIAssembly = pIAssembly.Extract(); - if (ppNativeFusionAssembly) { - *ppNativeFusionAssembly = pNativeFusionAssembly.Extract(); - } - } - - ErrExit: - return hr; -} - - -/* static */ -HRESULT FusionBind::RemoteLoad(IApplicationContext* pFusionContext, - FusionSink *pSink, - IAssemblyName *pName, - IAssembly *pParentAssembly, - LPCWSTR pCodeBase, - IAssembly** ppIAssembly, - IHostAssembly** ppIHostAssembly, - IBindResult **ppNativeFusionAssembly, - BOOL fForIntrospectionOnly, - BOOL fSuppressSecurityChecks) -{ - CONTRACTL - { - THROWS; - MODE_PREEMPTIVE; - // The resulting IP must be held so the assembly will not be scavenged. - PRECONDITION(CheckPointer(ppIAssembly)); - PRECONDITION(CheckPointer(ppIHostAssembly)); - - PRECONDITION(CheckPointer(pName)); - INJECT_FAULT(return E_OUTOFMEMORY;); - } CONTRACTL_END; - - ETWOnStartup (FusionBinding_V1, FusionBindingEnd_V1); - - HRESULT hr; - ASM_BIND_FLAGS dwFlags = ASM_BINDF_NONE; - DWORD dwReserved = 0; - LPVOID pReserved = NULL; - - // Event Tracing for Windows is used to log data for performance and functional testing purposes. - // The events below are used to help measure the performance of the download phase of assembly binding (be it download of a remote file or accessing a local file on disk), - // as well as of lookup scenarios such as from a host store. - DWORD dwAppDomainId = ETWAppDomainIdNotAvailable; - if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) { - DWORD cbValue = sizeof(dwAppDomainId); - // Gather data used by ETW events later in this function. - if (pFusionContext == NULL || FAILED(pFusionContext->Get(ACTAG_APP_DOMAIN_ID, &dwAppDomainId, &cbValue, 0))) { - dwAppDomainId = ETWAppDomainIdNotAvailable; - } - } - - NonVMComHolder< IUnknown > pSinkIUnknown(NULL); - NonVMComHolder< IAssemblyNameBinder> pBinder(NULL); - *ppNativeFusionAssembly=NULL; - - if(pParentAssembly != NULL) { - // Only use a parent assembly hint when the parent assembly has a load context. - // Assemblies in anonymous context are not dicoverable by loader's binding rules, - // thus loader can't find their dependencies. - // Loader will only try to locate dependencies in default load context. - if (pParentAssembly->GetFusionLoadContext() != LOADCTX_TYPE_UNKNOWN) { - dwReserved = sizeof(IAssembly*); - pReserved = (LPVOID) pParentAssembly; - dwFlags = ASM_BINDF_PARENT_ASM_HINT; - } - } - - IfFailRet(pSink->AssemblyResetEvent()); - IfFailRet(pSink->QueryInterface(IID_IUnknown, (void**)&pSinkIUnknown)); - IUnknown *pFusionAssembly=NULL; - IUnknown *pNativeAssembly=NULL; - BOOL fCached = TRUE; - - - if (fForIntrospectionOnly) - { - dwFlags = (ASM_BIND_FLAGS)(dwFlags | ASM_BINDF_INSPECTION_ONLY); - } - - if (fSuppressSecurityChecks) - { - dwFlags = (ASM_BIND_FLAGS)(dwFlags | ASM_BINDF_SUPPRESS_SECURITY_CHECKS); - } - - IfFailRet(pName->QueryInterface(IID_IAssemblyNameBinder, (void **)&pBinder)); - { - // In SQL, this can call back into the runtime - CONTRACT_VIOLATION(ThrowsViolation); - hr = pBinder->BindToObject(IID_IAssembly, - pSinkIUnknown, - pFusionContext, - pCodeBase, - dwFlags, - pReserved, - dwReserved, - (void**) &pFusionAssembly, - (void**)&pNativeAssembly); - } - - if(hr == E_PENDING) { - // If there is an assembly IP then we were successful. - hr = pSink->Wait(); - if (SUCCEEDED(hr)) - hr = pSink->LastResult(); - if(SUCCEEDED(hr)) { - if(pSink->m_punk) { - if (pSink->m_pNIunk) - pNativeAssembly=pSink->m_pNIunk; - pFusionAssembly = pSink->m_punk; - fCached = FALSE; - } - else - hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } - } - - FireEtwBindingDownloadPhaseEnd(dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, pCodeBase, NULL, GetClrInstanceId()); - - FireEtwBindingLookupAndProbingPhaseEnd(dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, pCodeBase, NULL, GetClrInstanceId()); - - if (SUCCEEDED(hr)) { - // Keep a handle to ensure it does not disappear from the cache - // and allow access to modules associated with the assembly. - hr = pFusionAssembly->QueryInterface(IID_IAssembly, - (void**) ppIAssembly); - if (hr == E_NOINTERFACE) // IStream assembly - hr = pFusionAssembly->QueryInterface(IID_IHostAssembly, - (void**) ppIHostAssembly); - if (SUCCEEDED(hr) && pNativeAssembly) - hr=pNativeAssembly->QueryInterface(IID_IBindResult, - (void**)ppNativeFusionAssembly); - - if (fCached) - { - pFusionAssembly->Release(); - if(pNativeAssembly) - pNativeAssembly->Release(); - } - } - - return hr; -} - -/* static */ -HRESULT FusionBind::RemoteLoadModule(IApplicationContext * pFusionContext, - IAssemblyModuleImport* pModule, - FusionSink *pSink, - IAssemblyModuleImport** pResult) -{ - - CONTRACTL - { - NOTHROW; - PRECONDITION(CheckPointer(pFusionContext)); - PRECONDITION(CheckPointer(pModule)); - PRECONDITION(CheckPointer(pSink)); - PRECONDITION(CheckPointer(pResult)); - INJECT_FAULT(return E_OUTOFMEMORY;); - } CONTRACTL_END; - - ETWOnStartup (FusionBinding_V1, FusionBindingEnd_V1); - - HRESULT hr; - IfFailGo(pSink->AssemblyResetEvent()); - hr = pModule->BindToObject(pSink, - pFusionContext, - ASM_BINDF_NONE, - (void**) pResult); - if(hr == E_PENDING) { - // If there is an assembly IP then we were successful. - hr = pSink->Wait(); - if (SUCCEEDED(hr)) - hr = pSink->LastResult(); - if (SUCCEEDED(hr)) { - if(pSink->m_punk) - hr = pSink->m_punk->QueryInterface(IID_IAssemblyModuleImport, - (void**) pResult); - else - hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); - } - } - - ErrExit: - return hr; -} - - -/* static */ -HRESULT FusionBind::AddEnvironmentProperty(__in LPCWSTR variable, - __in LPCWSTR pProperty, - IApplicationContext* pFusionContext) -{ - CONTRACTL - { - NOTHROW; - PRECONDITION(CheckPointer(pProperty)); - PRECONDITION(CheckPointer(variable)); - PRECONDITION(CheckPointer(pFusionContext)); - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - DWORD size = _MAX_PATH; - WCHAR rcValue[_MAX_PATH]; // Buffer for the directory. - WCHAR *pValue = &(rcValue[0]); - size = WszGetEnvironmentVariable(variable, pValue, size); - if(size > _MAX_PATH) { - pValue = (WCHAR*) _alloca(size * sizeof(WCHAR)); - size = WszGetEnvironmentVariable(variable, pValue, size); - size++; // Add in the null terminator - } - - if(size) - return pFusionContext->Set(pProperty, - pValue, - size * sizeof(WCHAR), - 0); - else - return S_FALSE; // no variable found -} - -// Fusion uses a context class to drive resolution of assemblies. -// Each application has properties that can be pushed into the -// fusion context (see fusionp.h). The public api is part of -// application domains. -/* static */ -HRESULT FusionBind::SetupFusionContext(LPCWSTR szAppBase, - LPCWSTR szPrivateBin, - IApplicationContext** ppFusionContext) -{ - CONTRACTL - { - NOTHROW; - PRECONDITION(CheckPointer(ppFusionContext)); - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - HRESULT hr; - NonVMComHolder <IApplicationContext> pFusionContext; - - LPCWSTR pBase; - // if the appbase is null then use the current directory - if (szAppBase == NULL) { - pBase = (LPCWSTR) _alloca(_MAX_PATH * sizeof(WCHAR)); - if(!WszGetCurrentDirectory(_MAX_PATH, (LPWSTR) pBase)) - IfFailGo(HRESULT_FROM_GetLastError()); - } - else - pBase = szAppBase; - - - IfFailGo(CreateFusionContext(pBase, &pFusionContext)); - - - IfFailGo((pFusionContext)->Set(ACTAG_APP_BASE_URL, - (void*) pBase, - (DWORD)(wcslen(pBase) + 1) * sizeof(WCHAR), - 0)); - - if (szPrivateBin) - IfFailGo((pFusionContext)->Set(ACTAG_APP_PRIVATE_BINPATH, - (void*) szPrivateBin, - (DWORD)(wcslen(szPrivateBin) + 1) * sizeof(WCHAR), - 0)); - else - IfFailGo(AddEnvironmentProperty(APPENV_RELATIVEPATH, ACTAG_APP_PRIVATE_BINPATH, pFusionContext)); - - *ppFusionContext=pFusionContext; - pFusionContext.SuppressRelease(); - -ErrExit: - return hr; -} - -/* static */ -HRESULT FusionBind::CreateFusionContext(LPCWSTR pzName, IApplicationContext** ppFusionContext) -{ - CONTRACTL - { - NOTHROW; - PRECONDITION(CheckPointer(ppFusionContext)); - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - // This is a file name not a namespace - LPCWSTR contextName = NULL; - - if(pzName) { - contextName = wcsrchr( pzName, W('\\') ); - if(contextName) - contextName++; - else - contextName = pzName; - } - // We go off and create a fusion context for this application domain. - // Note, once it is made it can not be modified. - NonVMComHolder<IAssemblyName> pFusionAssemblyName; - HRESULT hr = CreateAssemblyNameObject(&pFusionAssemblyName, contextName, 0, NULL); - - if(SUCCEEDED(hr)) - hr = CreateApplicationContext(pFusionAssemblyName, ppFusionContext); - - return hr; -} - -/* static */ -HRESULT FusionBind::GetVersion(__out_ecount(*pdwVersion) LPWSTR pVersion, __inout DWORD* pdwVersion) -{ - CONTRACTL - { - NOTHROW; - PRECONDITION(CheckPointer(pdwVersion)); - PRECONDITION(pdwVersion>0 && CheckPointer(pVersion)); - INJECT_FAULT(return E_OUTOFMEMORY;); - } - CONTRACTL_END; - - DWORD dwCORSystem = 0; - - LPCWSTR pCORSystem = GetInternalSystemDirectory(&dwCORSystem); - - if (dwCORSystem == 0) - return E_FAIL; - - dwCORSystem--; // remove the null character - if (dwCORSystem && pCORSystem[dwCORSystem-1] == W('\\')) - dwCORSystem--; // and the trailing slash if it exists - - if (dwCORSystem==0) - return E_FAIL; - - const WCHAR* pSeparator; - const WCHAR* pTail = pCORSystem + dwCORSystem; - - for (pSeparator = pCORSystem+dwCORSystem-1; pSeparator > pCORSystem && *pSeparator != W('\\');pSeparator--); - - if (*pSeparator == W('\\')) - pSeparator++; - - DWORD lgth = (DWORD)(pTail - pSeparator); - - if (lgth > *pdwVersion) { - *pdwVersion = lgth+1; - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - -#ifdef _PREFAST_ -#pragma warning(push) -#pragma warning(disable:26000) // "Disable PREFast/espX warning about buffer overflow" -#endif - while(pSeparator < pTail) - *pVersion++ = *pSeparator++; - - *pVersion = W('\0'); -#ifdef _PREFAST_ -#pragma warning(pop) -#endif - - return S_OK; -} // FusionBind::GetVersion - diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index 35fcb2c1ee..1389f8f0b5 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -29,9 +29,6 @@ #endif #ifdef FEATURE_COMINTEROP -#ifdef FEATURE_FUSION -#include "policy.h" -#endif #endif //******************************************************************************* @@ -204,13 +201,6 @@ MethodTableBuilder::CreateClass( Module *pModule, // On CoreCLR, however, we do allow non-FX assemblies to have this attribute. This enables scenarios where we can // activate 3rd-party WinRT components outside AppContainer - 1st party WinRT components are already allowed // to be activated outside AppContainer (on both Desktop and CoreCLR). -#ifdef FEATURE_FUSION - if (!pAssembly->IsWinMD() && - Fusion::Util::IsAnyFrameworkAssembly(pAssembly->GetFusionAssemblyName()) != S_OK) - { - pAssembly->ThrowTypeLoadException(pModule->GetMDImport(), cl, IDS_EE_WINRT_TYPE_IN_ORDINARY_ASSEMBLY); - } -#endif pEEClass->SetProjectedFromWinRT(); } diff --git a/src/vm/mscorlib.h b/src/vm/mscorlib.h index 3b57f9c8f9..f466c2f20c 100644 --- a/src/vm/mscorlib.h +++ b/src/vm/mscorlib.h @@ -114,10 +114,6 @@ DEFINE_METHOD(APP_DOMAIN, ENABLE_RESOLVE_ASSEMBLIES_FOR_INTROSPECTION, DEFINE_METHOD(APP_DOMAIN, ON_DESIGNER_NAMESPACE_RESOLVE, OnDesignerNamespaceResolveEvent, IM_Str_RetArrStr) #endif //FEATURE_COMINTEROP DEFINE_METHOD(APP_DOMAIN, SETUP_DOMAIN, SetupDomain, IM_Bool_Str_Str_ArrStr_ArrStr_RetVoid) -#ifdef FEATURE_FUSION -DEFINE_METHOD(APP_DOMAIN, SETUP_LOADER_OPTIMIZATION,SetupLoaderOptimization, IM_LoaderOptimization_RetVoid) -DEFINE_METHOD(APP_DOMAIN, SET_DOMAIN_CONTEXT, InternalSetDomainContext, IM_Str_RetVoid) -#endif // FEATURE_FUSION #ifdef FEATURE_REMOTING DEFINE_METHOD(APP_DOMAIN, CREATE_DOMAIN, CreateDomain, SM_Str_Evidence_AppDomainSetup_RetAppDomain) DEFINE_METHOD(APP_DOMAIN, VAL_CREATE_DOMAIN, InternalCreateDomain, SM_Str_RetAppDomain) @@ -128,9 +124,6 @@ DEFINE_METHOD(APP_DOMAIN, MARSHAL_OBJECTS, MarshalObjects, DEFINE_METHOD(APP_DOMAIN, UNMARSHAL_OBJECT, UnmarshalObject, SM_ArrByte_RetObj) DEFINE_METHOD(APP_DOMAIN, UNMARSHAL_OBJECTS, UnmarshalObjects, SM_ArrByte_ArrByte_RefObj_RetObj) #endif -#ifdef FEATURE_FUSION -DEFINE_METHOD(APP_DOMAIN, TURN_ON_BINDING_REDIRECTS, TurnOnBindingRedirects, IM_RetVoid) -#endif // FEATURE_FUSION DEFINE_METHOD(APP_DOMAIN, CREATE_APP_DOMAIN_MANAGER, CreateAppDomainManager, IM_RetVoid) DEFINE_METHOD(APP_DOMAIN, INITIALIZE_COMPATIBILITY_FLAGS, InitializeCompatibilityFlags, IM_RetVoid) DEFINE_METHOD(APP_DOMAIN, INITIALIZE_DOMAIN_SECURITY, InitializeDomainSecurity, IM_Evidence_Evidence_Bool_IntPtr_Bool_RetVoid) @@ -239,13 +232,7 @@ DEFINE_FIELD_U(m_assembly, AssemblyBaseObject, m_pAssembly) DEFINE_CLASS(ASSEMBLY, Reflection, RuntimeAssembly) DEFINE_FIELD(ASSEMBLY, HANDLE, m_assembly) DEFINE_METHOD(ASSEMBLY, GET_NAME, GetName, IM_RetAssemblyName) -#ifdef FEATURE_FUSION -DEFINE_METHOD(ASSEMBLY, LOAD_WITH_PARTIAL_NAME_HACK, LoadWithPartialNameHack, SM_Str_Bool_RetAssembly) -#endif // FEATURE_FUSION DEFINE_METHOD(ASSEMBLY, ON_MODULE_RESOLVE, OnModuleResolveEvent, IM_Str_RetModule) -#ifdef FEATURE_FUSION -DEFINE_METHOD(ASSEMBLY, DEMAND_PERMISSION, DemandPermission, SM_Str_Bool_Int_RetV) -#endif #ifdef FEATURE_REMOTING DEFINE_CLASS(ACTIVATION_SERVICES, Activation, ActivationServices) diff --git a/src/vm/multicorejit.cpp b/src/vm/multicorejit.cpp index fccfd98aa7..4ad5447950 100644 --- a/src/vm/multicorejit.cpp +++ b/src/vm/multicorejit.cpp @@ -284,14 +284,6 @@ bool ModuleVersion::GetModuleVersion(Module * pModule) } // If the load context is LOADFROM, store it in the flags. -#ifdef FEATURE_FUSION - Assembly * pAssembly = pModule->GetAssembly(); - LOADCTX_TYPE loadCtx = pAssembly->GetManifestFile()->GetLoadContext(); - if(LOADCTX_TYPE_LOADFROM == loadCtx) - { - versionFlags |= VERSIONFLAG_LOADCTX_LOADFROM; - } -#endif } EX_CATCH { diff --git a/src/vm/multicorejitplayer.cpp b/src/vm/multicorejitplayer.cpp index 290cc8b076..69868578d9 100644 --- a/src/vm/multicorejitplayer.cpp +++ b/src/vm/multicorejitplayer.cpp @@ -478,18 +478,9 @@ bool MulticoreJitManager::IsSupportedModule(Module * pModule, bool fMethodJit, b Assembly * pAssembly = pModule->GetAssembly(); -#ifdef FEATURE_FUSION - - LOADCTX_TYPE context = pAssembly->GetManifestFile()->GetLoadContext(); - - - return ((context == LOADCTX_TYPE_DEFAULT) || (context == LOADCTX_TYPE_LOADFROM)); - -#else return true; -#endif } diff --git a/src/vm/objectclone.cpp b/src/vm/objectclone.cpp index b4ad314165..93c9d3c30f 100644 --- a/src/vm/objectclone.cpp +++ b/src/vm/objectclone.cpp @@ -1740,10 +1740,6 @@ TypeHandle ObjectClone::GetType(const SString &ssTypeName, const SString &ssAsse } DomainAssembly *pDomainAssembly = NULL; -#ifdef FEATURE_FUSION - // If the normal load fails then try loading from a partial assembly name (relaxed serializer rules). - pDomainAssembly = LoadAssemblyFromPartialNameHack((SString*)&ssAssemName, TRUE); -#endif // FEATURE_FUSION if (pDomainAssembly == NULL) COMPlusThrow(kSerializationException, IDS_SERIALIZATION_UNRESOLVED_TYPE, ssTypeName.GetUnicode(), ssAssemName.GetUnicode()); diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp index c02dc2b281..f833a17c36 100644 --- a/src/vm/pefile.cpp +++ b/src/vm/pefile.cpp @@ -15,10 +15,6 @@ #include "eecontract.h" #include "apithreadstress.h" #include "eeconfig.h" -#ifdef FEATURE_FUSION -#include "fusionpriv.h" -#include "shlwapi.h" -#endif #include "product_version.h" #include "eventtrace.h" #include "security.h" @@ -34,10 +30,8 @@ #include "../binder/inc/applicationcontext.hpp" -#ifndef FEATURE_FUSION #include "clrprivbinderutil.h" #include "../binder/inc/coreclrbindercommon.h" -#endif #ifdef FEATURE_PREJIT @@ -50,11 +44,6 @@ SVAL_IMPL_INIT(DWORD, PEFile, s_NGENDebugFlags, 0); #include "sha1.h" -#if defined(FEATURE_FUSION) -#include "clrprivbinderfusion.h" -#include "clrprivbinderappx.h" -#include "clrprivbinderloadfile.h" -#endif #ifndef DACCESS_COMPILE @@ -1331,19 +1320,6 @@ static void RuntimeVerifyVLog(DWORD level, LoggableAssembly *pLogAsm, const WCHA WszOutputDebugString(W("\n")); } -#ifdef FEATURE_FUSION - IFusionBindLog *pFusionBindLog = pLogAsm->FusionBindLog(); - if (pFusionBindLog) - { - pFusionBindLog->LogMessage(0, FUSION_BIND_LOG_CATEGORY_NGEN, message); - - if (level == LL_ERROR) { - pFusionBindLog->SetResultCode(FUSION_BIND_LOG_CATEGORY_NGEN, E_FAIL); - pFusionBindLog->Flush(g_dwLogLevel, FUSION_BIND_LOG_CATEGORY_NGEN); - pFusionBindLog->Flush(g_dwLogLevel, FUSION_BIND_LOG_CATEGORY_DEFAULT); - } - } -#endif //FEATURE_FUSION } @@ -1357,9 +1333,6 @@ static void RuntimeVerifyLog(DWORD level, LoggableAssembly *pLogAsm, const WCHAR // Avoid calling RuntimeVerifyVLog unless logging is on if ( ((level == LL_ERROR) && IsDebuggerPresent()) || LoggingOn(LF_ZAP, level) -#ifdef FEATURE_FUSION - || (pLogAsm->FusionBindLog() != NULL) -#endif ) { va_list args; @@ -1710,15 +1683,6 @@ BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_NGEN_SIGNATURE &ngenSig W("Rejecting native image because native image dependency %s ") W("had a different identity than expected"), displayString.GetUnicode()); -#if (defined FEATURE_PREJIT) && (defined FEATURE_FUSION) - if (pLogAsm->FusionBindLog()) - { - if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEFUSION_KEYWORD)) - { - pLogAsm->FusionBindLog()->ETWTraceLogMessage(ETW::BinderLog::BinderStructs::NGEN_BIND_DEPENDENCY_HAS_DIFFERENT_IDENTITY, pLogAsm->FusionAssemblyName()); - } - } -#endif return FALSE; } @@ -2247,169 +2211,6 @@ void PEAssembly::Attach() STANDARD_VM_CONTRACT; } -#ifdef FEATURE_FUSION -PEAssembly::PEAssembly(PEImage *image, - IMetaDataEmit *pEmit, - IAssembly *pIAssembly, - IBindResult *pNativeFusionAssembly, - PEImage *pPEImageNI, - IFusionBindLog *pFusionLog, - IHostAssembly *pIHostAssembly, - PEFile *creator, - BOOL system, - BOOL introspectionOnly/*=FALSE*/, - ICLRPrivAssembly * pHostAssembly) - : PEFile(image, FALSE), - m_creator(NULL), - m_pFusionAssemblyName(NULL), - m_pFusionAssembly(NULL), - m_pFusionLog(NULL), - m_bFusionLogEnabled(TRUE), - m_pIHostAssembly(NULL), - m_pNativeAssemblyLocation(NULL), - m_pNativeImageClosure(NULL), - m_fStrongNameBypassed(FALSE) -{ - CONTRACTL - { - CONSTRUCTOR_CHECK; - PRECONDITION(CheckPointer(image, NULL_OK)); - PRECONDITION(CheckPointer(pEmit, NULL_OK)); - PRECONDITION(image != NULL || pEmit != NULL); - PRECONDITION(CheckPointer(pIAssembly, NULL_OK)); - PRECONDITION(CheckPointer(pFusionLog, NULL_OK)); - PRECONDITION(CheckPointer(pIHostAssembly, NULL_OK)); - PRECONDITION(CheckPointer(creator, NULL_OK)); - STANDARD_VM_CHECK; - } - CONTRACTL_END; - - if (introspectionOnly) - { - if (!system) // Implementation restriction: mscorlib.dll cannot be loaded as introspection. The architecture depends on there being exactly one mscorlib. - { - m_flags |= PEFILE_INTROSPECTIONONLY; -#ifdef FEATURE_PREJIT - SetCannotUseNativeImage(); -#endif // FEATURE_PREJIT - } - } - - if (pIAssembly) - { - m_pFusionAssembly = pIAssembly; - pIAssembly->AddRef(); - - IfFailThrow(pIAssembly->GetAssemblyNameDef(&m_pFusionAssemblyName)); - } - else if (pIHostAssembly) - { - m_flags |= PEFILE_ISTREAM; -#ifdef FEATURE_PREJIT - m_fCanUseNativeImage = FALSE; -#endif // FEATURE_PREJIT - - m_pIHostAssembly = pIHostAssembly; - pIHostAssembly->AddRef(); - - IfFailThrow(pIHostAssembly->GetAssemblyNameDef(&m_pFusionAssemblyName)); - } - - if (pFusionLog) - { - m_pFusionLog = pFusionLog; - pFusionLog->AddRef(); - } - - if (creator) - { - m_creator = creator; - creator->AddRef(); - } - - m_flags |= PEFILE_ASSEMBLY; - if (system) - m_flags |= PEFILE_SYSTEM; - -#ifdef FEATURE_PREJIT - // Find the native image - if (pIAssembly) - { - if (pNativeFusionAssembly != NULL) - SetNativeImage(pNativeFusionAssembly); - } - // Only one of pNativeFusionAssembly and pPEImageNI may be set. - _ASSERTE(!(pNativeFusionAssembly && pPEImageNI)); - - if (pPEImageNI != NULL) - this->PEFile::SetNativeImage(pPEImageNI); -#endif // FEATURE_PREJIT - - // If we have no native image, we require a mapping for the file. - if (!HasNativeImage() || !IsILOnly()) - EnsureImageOpened(); - - // Open metadata eagerly to minimize failure windows - if (pEmit == NULL) - OpenMDImport_Unsafe(); //constructor, cannot race with anything - else - { - _ASSERTE(!m_bHasPersistentMDImport); - IfFailThrow(GetMetaDataInternalInterfaceFromPublic(pEmit, IID_IMDInternalImport, - (void **)&m_pMDImport)); - m_pEmitter = pEmit; - pEmit->AddRef(); - m_bHasPersistentMDImport=TRUE; - m_MDImportIsRW_Debugger_Use_Only = TRUE; - } - - // m_pMDImport can be external - // Make sure this is an assembly - if (!m_pMDImport->IsValidToken(TokenFromRid(1, mdtAssembly))) - ThrowHR(COR_E_ASSEMBLYEXPECTED); - - // Make sure we perform security checks after we've obtained IMDInternalImport interface - DoLoadSignatureChecks(); - - // Verify name eagerly - LPCUTF8 szName = GetSimpleName(); - if (!*szName) - { - ThrowHR(COR_E_BADIMAGEFORMAT, BFA_EMPTY_ASSEMDEF_NAME); - } - -#ifdef FEATURE_PREJIT - if (IsResource() || IsDynamic()) - m_fCanUseNativeImage = FALSE; -#endif // FEATURE_PREJIT - - if (m_pFusionAssembly) - { - m_loadContext = m_pFusionAssembly->GetFusionLoadContext(); - m_pFusionAssembly->GetAssemblyLocation(&m_dwLocationFlags); - } - else if (pHostAssembly != nullptr) - { - m_loadContext = LOADCTX_TYPE_HOSTED; - m_dwLocationFlags = ASMLOC_UNKNOWN; - m_pHostAssembly = clr::SafeAddRef(pHostAssembly); // Should use SetHostAssembly(pHostAssembly) here - } - else - { - m_loadContext = LOADCTX_TYPE_UNKNOWN; - m_dwLocationFlags = ASMLOC_UNKNOWN; - } - - TESTHOOKCALL(CompletedNativeImageBind(image,szName,HasNativeImage())); - -#if _DEBUG - GetCodeBaseOrName(m_debugName); - m_debugName.Normalize(); - m_pDebugName = m_debugName; -#endif -} - -#else // FEATURE_FUSION PEAssembly::PEAssembly( CoreBindResult* pBindResultInfo, @@ -2532,58 +2333,8 @@ PEAssembly::PEAssembly( m_sTextualIdentity); #endif } -#endif // FEATURE_FUSION - - -#ifdef FEATURE_FUSION - -PEAssembly *PEAssembly::Open( - PEAssembly *pParentAssembly, - PEImage *pPEImageIL, - BOOL isIntrospectionOnly) -{ - STANDARD_VM_CONTRACT; - PEAssembly * pPEAssembly = new PEAssembly( - pPEImageIL, // PEImage - nullptr, // IMetaDataEmit - nullptr, // IAssembly - nullptr, // IBindResult pNativeFusionAssembly - nullptr, // PEImage *pNIImage - nullptr, // IFusionBindLog - nullptr, // IHostAssembly - pParentAssembly, // creator - FALSE, // isSystem - isIntrospectionOnly, // isIntrospectionOnly - NULL); - - return pPEAssembly; -} -PEAssembly *PEAssembly::Open( - PEAssembly * pParent, - PEImage * pPEImageIL, - PEImage * pPEImageNI, - ICLRPrivAssembly * pHostAssembly, - BOOL fIsIntrospectionOnly) -{ - STANDARD_VM_CONTRACT; - PEAssembly * pPEAssembly = new PEAssembly( - pPEImageIL, // PEImage - nullptr, // IMetaDataEmit - nullptr, // IAssembly - nullptr, // IBindResult pNativeFusionAssembly - pPEImageNI, // Native Image PEImage - nullptr, // IFusionBindLog - nullptr, // IHostAssembly - pParent, // creator - FALSE, // isSystem - fIsIntrospectionOnly, - pHostAssembly); - - return pPEAssembly; -} -#else //FEATURE_FUSION PEAssembly *PEAssembly::Open( PEAssembly * pParent, @@ -2607,7 +2358,6 @@ PEAssembly *PEAssembly::Open( return pPEAssembly; } -#endif // FEATURE_FUSION PEAssembly::~PEAssembly() { @@ -2621,22 +2371,6 @@ PEAssembly::~PEAssembly() CONTRACTL_END; GCX_PREEMP(); -#ifdef FEATURE_FUSION - if (m_pFusionAssemblyName != NULL) - m_pFusionAssemblyName->Release(); - if (m_pFusionAssembly != NULL) - m_pFusionAssembly->Release(); - if (m_pIHostAssembly != NULL) - m_pIHostAssembly->Release(); - if (m_pNativeAssemblyLocation != NULL) - { - m_pNativeAssemblyLocation->Release(); - } - if (m_pNativeImageClosure!=NULL) - m_pNativeImageClosure->Release(); - if (m_pFusionLog != NULL) - m_pFusionLog->Release(); -#endif // FEATURE_FUSION if (m_creator != NULL) m_creator->Release(); @@ -2655,35 +2389,6 @@ void PEAssembly::ReleaseIL() CONTRACTL_END; GCX_PREEMP(); -#ifdef FEATURE_FUSION - if (m_pFusionAssemblyName != NULL) - { - m_pFusionAssemblyName->Release(); - m_pFusionAssemblyName=NULL; - } - if (m_pFusionAssembly != NULL) - { - m_pFusionAssembly->Release(); - m_pFusionAssembly=NULL; - } - if (m_pIHostAssembly != NULL) - { - m_pIHostAssembly->Release(); - m_pIHostAssembly=NULL; - } - if (m_pNativeAssemblyLocation != NULL) - { - m_pNativeAssemblyLocation->Release(); - m_pNativeAssemblyLocation=NULL; - } - _ASSERTE(m_pNativeImageClosure==NULL); - - if (m_pFusionLog != NULL) - { - m_pFusionLog->Release(); - m_pFusionLog=NULL; - } -#endif // FEATURE_FUSION if (m_creator != NULL) { m_creator->Release(); @@ -2696,11 +2401,7 @@ void PEAssembly::ReleaseIL() /* static */ -#ifdef FEATURE_FUSION -PEAssembly *PEAssembly::OpenSystem(IApplicationContext * pAppCtx) -#else PEAssembly *PEAssembly::OpenSystem(IUnknown * pAppCtx) -#endif { STANDARD_VM_CONTRACT; @@ -2725,11 +2426,7 @@ PEAssembly *PEAssembly::OpenSystem(IUnknown * pAppCtx) } /* static */ -#ifdef FEATURE_FUSION -PEAssembly *PEAssembly::DoOpenSystem(IApplicationContext * pAppCtx) -#else PEAssembly *PEAssembly::DoOpenSystem(IUnknown * pAppCtx) -#endif { CONTRACT(PEAssembly *) { @@ -2738,74 +2435,6 @@ PEAssembly *PEAssembly::DoOpenSystem(IUnknown * pAppCtx) } CONTRACT_END; -#ifdef FEATURE_FUSION - SafeComHolder<IAssemblyName> pName; - IfFailThrow(CreateAssemblyNameObject(&pName, W("mscorlib"), 0, NULL)); - - UINT64 publicKeyValue = I64(CONCAT_MACRO(0x, VER_ECMA_PUBLICKEY)); - BYTE publicKeyToken[8] = - { - (BYTE) (publicKeyValue>>56), - (BYTE) (publicKeyValue>>48), - (BYTE) (publicKeyValue>>40), - (BYTE) (publicKeyValue>>32), - (BYTE) (publicKeyValue>>24), - (BYTE) (publicKeyValue>>16), - (BYTE) (publicKeyValue>>8), - (BYTE) (publicKeyValue), - }; - - IfFailThrow(pName->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, publicKeyToken, sizeof(publicKeyToken))); - - USHORT version = VER_ASSEMBLYMAJORVERSION; - IfFailThrow(pName->SetProperty(ASM_NAME_MAJOR_VERSION, &version, sizeof(version))); - version = VER_ASSEMBLYMINORVERSION; - IfFailThrow(pName->SetProperty(ASM_NAME_MINOR_VERSION, &version, sizeof(version))); - version = VER_ASSEMBLYBUILD; - IfFailThrow(pName->SetProperty(ASM_NAME_BUILD_NUMBER, &version, sizeof(version))); - version = VER_ASSEMBLYBUILD_QFE; - IfFailThrow(pName->SetProperty(ASM_NAME_REVISION_NUMBER, &version, sizeof(version))); - - IfFailThrow(pName->SetProperty(ASM_NAME_CULTURE, W(""), sizeof(WCHAR))); - -#ifdef FEATURE_PREJIT -#ifdef PROFILING_SUPPORTED - if (NGENImagesAllowed()) - { - // Binding flags, zap string - CorCompileConfigFlags configFlags = PEFile::GetNativeImageConfigFlagsWithOverrides(); - IfFailThrow(pName->SetProperty(ASM_NAME_CONFIG_MASK, &configFlags, sizeof(configFlags))); - - LPCWSTR configString = g_pConfig->ZapSet(); - IfFailThrow(pName->SetProperty(ASM_NAME_CUSTOM, (PVOID)configString, - (DWORD) (wcslen(configString)+1)*sizeof(WCHAR))); - - // @TODO: Need some fuslogvw logging here - } -#endif //PROFILING_SUPPORTED -#endif // FEATURE_PREJIT - - SafeComHolder<IAssembly> pIAssembly; - SafeComHolder<IBindResult> pNativeFusionAssembly; - SafeComHolder<IFusionBindLog> pFusionLog; - - { - ETWOnStartup (FusionBinding_V1, FusionBindingEnd_V1); - IfFailThrow(BindToSystem(pName, SystemDomain::System()->SystemDirectory(), NULL, pAppCtx, &pIAssembly, &pNativeFusionAssembly, &pFusionLog)); - } - - StackSString path; - FusionBind::GetAssemblyManifestModulePath(pIAssembly, path); - - // Open the image with no required mapping. This will be - // promoted to a real open if we don't have a native image. - PEImageHolder image (PEImage::OpenImage(path)); - - PEAssembly* pPEAssembly = new PEAssembly(image, NULL, pIAssembly,pNativeFusionAssembly, NULL, pFusionLog, NULL, NULL, TRUE, FALSE); - - - RETURN pPEAssembly; -#else // FEATURE_FUSION ETWOnStartup (FusionBinding_V1, FusionBindingEnd_V1); CoreBindResult bindResult; ReleaseHolder<ICLRPrivAssembly> pPrivAsm; @@ -2816,153 +2445,8 @@ PEAssembly *PEAssembly::DoOpenSystem(IUnknown * pAppCtx) } RETURN new PEAssembly(&bindResult, NULL, NULL, TRUE, FALSE); -#endif // FEATURE_FUSION } -#ifdef FEATURE_FUSION -/* static */ -PEAssembly *PEAssembly::Open(IAssembly *pIAssembly, - IBindResult *pNativeFusionAssembly, - IFusionBindLog *pFusionLog/*=NULL*/, - BOOL isSystemAssembly/*=FALSE*/, - BOOL isIntrospectionOnly/*=FALSE*/) -{ - STANDARD_VM_CONTRACT; - - PEAssembly *result = NULL; - EX_TRY - { - result = DoOpen(pIAssembly, pNativeFusionAssembly, pFusionLog, isSystemAssembly, isIntrospectionOnly); - } - EX_HOOK - { - Exception *ex = GET_EXCEPTION(); - - // Rethrow non-transient exceptions as file load exceptions with proper - // context - if (!ex->IsTransient()) - EEFileLoadException::Throw(pIAssembly, NULL, ex->GetHR(), ex); - } - EX_END_HOOK; - - return result; -} - -// Thread stress -class DoOpenIAssemblyStress : APIThreadStress -{ -public: - IAssembly *pIAssembly; - IBindResult *pNativeFusionAssembly; - IFusionBindLog *pFusionLog; - DoOpenIAssemblyStress(IAssembly *pIAssembly, IBindResult *pNativeFusionAssembly, IFusionBindLog *pFusionLog) - : pIAssembly(pIAssembly), pNativeFusionAssembly(pNativeFusionAssembly),pFusionLog(pFusionLog) {LIMITED_METHOD_CONTRACT;} - void Invoke() - { - WRAPPER_NO_CONTRACT; - PEAssemblyHolder result (PEAssembly::Open(pIAssembly, pNativeFusionAssembly, pFusionLog, FALSE, FALSE)); - } -}; - -/* static */ -PEAssembly *PEAssembly::DoOpen(IAssembly *pIAssembly, - IBindResult *pNativeFusionAssembly, - IFusionBindLog *pFusionLog, - BOOL isSystemAssembly, - BOOL isIntrospectionOnly/*=FALSE*/) -{ - CONTRACT(PEAssembly *) - { - PRECONDITION(CheckPointer(pIAssembly)); - POSTCONDITION(CheckPointer(RETVAL)); - STANDARD_VM_CHECK; - } - CONTRACT_END; - - DoOpenIAssemblyStress ts(pIAssembly,pNativeFusionAssembly,pFusionLog); - - PEImageHolder image; - - StackSString path; - FusionBind::GetAssemblyManifestModulePath(pIAssembly, path); - - // Open the image with no required mapping. This will be - // promoted to a real open if we don't have a native image. - image = PEImage::OpenImage(path, MDInternalImport_NoCache); // "identity" does not need to be cached - - PEAssemblyHolder assembly (new PEAssembly(image, NULL, pIAssembly, pNativeFusionAssembly, NULL, pFusionLog, - NULL, NULL, isSystemAssembly, isIntrospectionOnly)); - - RETURN assembly.Extract(); -} - -/* static */ -PEAssembly *PEAssembly::Open(IHostAssembly *pIHostAssembly, BOOL isSystemAssembly, BOOL isIntrospectionOnly) -{ - STANDARD_VM_CONTRACT; - - PEAssembly *result = NULL; - - EX_TRY - { - result = DoOpen(pIHostAssembly, isSystemAssembly, isIntrospectionOnly); - } - EX_HOOK - { - Exception *ex = GET_EXCEPTION(); - - // Rethrow non-transient exceptions as file load exceptions with proper - // context - - if (!ex->IsTransient()) - EEFileLoadException::Throw(NULL, pIHostAssembly, ex->GetHR(), ex); - } - EX_END_HOOK; - return result; -} - -// Thread stress -class DoOpenIHostAssemblyStress : APIThreadStress -{ -public: - IHostAssembly *pIHostAssembly; - DoOpenIHostAssemblyStress(IHostAssembly *pIHostAssembly) : - pIHostAssembly(pIHostAssembly) {LIMITED_METHOD_CONTRACT;} - void Invoke() - { - WRAPPER_NO_CONTRACT; - PEAssemblyHolder result (PEAssembly::Open(pIHostAssembly, FALSE, FALSE)); - } -}; - -/* static */ -PEAssembly *PEAssembly::DoOpen(IHostAssembly *pIHostAssembly, BOOL isSystemAssembly, - BOOL isIntrospectionOnly) -{ - CONTRACT(PEAssembly *) - { - PRECONDITION(CheckPointer(pIHostAssembly)); - POSTCONDITION(CheckPointer(RETVAL)); - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - - DoOpenIHostAssemblyStress ts(pIHostAssembly); - - UINT64 AssemblyId; - IfFailThrow(pIHostAssembly->GetAssemblyId(&AssemblyId)); - - PEImageHolder image(PEImage::FindById(AssemblyId, 0)); - - PEAssemblyHolder assembly (new PEAssembly(image, NULL, NULL, NULL, NULL, NULL, - pIHostAssembly, NULL, isSystemAssembly, isIntrospectionOnly)); - - RETURN assembly.Extract(); -} -#endif // FEATURE_FUSION #ifndef CROSSGEN_COMPILE /* static */ @@ -3045,16 +2529,12 @@ PEAssembly *PEAssembly::DoOpenMemory( ThrowHR(COR_E_BADIMAGEFORMAT, BFA_BAD_IL); -#ifdef FEATURE_FUSION - RETURN new PEAssembly(image, NULL, NULL, NULL, NULL, NULL, NULL, pParentAssembly, FALSE, isIntrospectionOnly); -#else CoreBindResult bindResult; ReleaseHolder<ICLRPrivAssembly> assembly; IfFailThrow(CCoreCLRBinderHelper::GetAssemblyFromImage(image, NULL, &assembly)); bindResult.Init(assembly,FALSE,FALSE); RETURN new PEAssembly(&bindResult, NULL, pParentAssembly, FALSE, isIntrospectionOnly); -#endif } #endif // !CROSSGEN_COMPILE @@ -3139,7 +2619,6 @@ PEAssembly *PEAssembly::DoOpenHMODULE(HMODULE hMod, #endif // FEATURE_MIXEDMODE && !CROSSGEN_COMPILE -#ifndef FEATURE_FUSION PEAssembly* PEAssembly::Open(CoreBindResult* pBindResult, BOOL isSystem, BOOL isIntrospectionOnly) { @@ -3147,7 +2626,6 @@ PEAssembly* PEAssembly::Open(CoreBindResult* pBindResult, return new PEAssembly(pBindResult,NULL,NULL,isSystem,isIntrospectionOnly); }; -#endif /* static */ PEAssembly *PEAssembly::Create(PEAssembly *pParentAssembly, @@ -3167,99 +2645,14 @@ PEAssembly *PEAssembly::Create(PEAssembly *pParentAssembly, // we have.) SafeComHolder<IMetaDataEmit> pEmit; pAssemblyEmit->QueryInterface(IID_IMetaDataEmit, (void **)&pEmit); -#ifdef FEATURE_FUSION - ReleaseHolder<ICLRPrivAssembly> pPrivAssembly; - if (pParentAssembly->HasHostAssembly()) - { - // Dynamic assemblies in AppX use their parent's ICLRPrivAssembly as the binding context. - pPrivAssembly = clr::SafeAddRef(new CLRPrivBinderUtil::CLRPrivBinderAsAssemblyWrapper( - pParentAssembly->GetHostAssembly())); - } - - PEAssemblyHolder pFile(new PEAssembly( - NULL, pEmit, NULL, NULL, NULL, NULL, NULL, pParentAssembly, - FALSE, bIsIntrospectionOnly, - pPrivAssembly)); -#else PEAssemblyHolder pFile(new PEAssembly(NULL, pEmit, pParentAssembly, FALSE, bIsIntrospectionOnly)); -#endif RETURN pFile.Extract(); } #ifdef FEATURE_PREJIT -#ifdef FEATURE_FUSION -BOOL PEAssembly::HasEqualNativeClosure(DomainAssembly * pDomainAssembly) -{ - CONTRACTL - { - GC_TRIGGERS; - THROWS; - MODE_ANY; - PRECONDITION(CheckPointer(pDomainAssembly)); - } - CONTRACTL_END; - if (IsSystem()) - return TRUE; - HRESULT hr = S_OK; - - - if (m_pNativeImageClosure == NULL) - return FALSE; - - // ensure theclosures are walked - IAssemblyBindingClosure * pClosure = pDomainAssembly->GetAssemblyBindingClosure(LEVEL_COMPLETE); - _ASSERTE(pClosure != NULL); - - if (m_pNativeImageClosure->HasBeenWalked(LEVEL_COMPLETE) != S_OK ) - { - GCX_COOP(); - - ENTER_DOMAIN_PTR(SystemDomain::System()->DefaultDomain(),ADV_DEFAULTAD); - { - GCX_PREEMP(); - IfFailThrow(m_pNativeImageClosure->EnsureWalked(GetFusionAssembly(),GetAppDomain()->GetFusionContext(),LEVEL_COMPLETE)); - } - END_DOMAIN_TRANSITION; - } - - - hr = pClosure->IsEqual(m_pNativeImageClosure); - IfFailThrow(hr); - return (hr == S_OK); -} -#endif //FEATURE_FUSION - -#ifdef FEATURE_FUSION -void PEAssembly::SetNativeImage(IBindResult *pNativeFusionAssembly) -{ - CONTRACTL - { - INSTANCE_CHECK; - STANDARD_VM_CHECK; - } - CONTRACTL_END; - - StackSString path; - WCHAR pwzPath[MAX_LONGPATH]; - DWORD dwCCPath = MAX_LONGPATH; - ReleaseHolder<IAssemblyLocation> pIAssemblyLocation; - - IfFailThrow(pNativeFusionAssembly->GetAssemblyLocation(&pIAssemblyLocation)); - IfFailThrow(pIAssemblyLocation->GetPath(pwzPath, &dwCCPath)); - path.Set(pwzPath); - - PEImageHolder image(PEImage::OpenImage(path)); - image->Load(); - // For desktop dev11, this verification is now done at native binding time. - _ASSERTE(CheckNativeImageVersion(image)); - - PEFile::SetNativeImage(image); - IfFailThrow(pNativeFusionAssembly->GetAssemblyLocation(&m_pNativeAssemblyLocation)); -} -#else //FEATURE_FUSION void PEAssembly::SetNativeImage(PEImage * image) { CONTRACTL @@ -3302,243 +2695,23 @@ void PEAssembly::SetNativeImage(PEImage * image) ExternalLog(LL_WARNING, "Native image is not correct version."); } } -#endif //FEATURE_FUSION - -#ifdef FEATURE_FUSION -void PEAssembly::ClearNativeImage() -{ - CONTRACT_VOID - { - INSTANCE_CHECK; - PRECONDITION(HasNativeImage()); - POSTCONDITION(!HasNativeImage()); - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - PEFile::ClearNativeImage(); - - if (m_pNativeAssemblyLocation != NULL) - m_pNativeAssemblyLocation->Release(); - m_pNativeAssemblyLocation = NULL; - if (m_pNativeImageClosure != NULL) - m_pNativeImageClosure->Release(); - m_pNativeImageClosure = NULL; - RETURN; -} -#endif //FEATURE_FUSION #endif // FEATURE_PREJIT -#ifdef FEATURE_FUSION -BOOL PEAssembly::IsBindingCodeBase() -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - if (m_pIHostAssembly != NULL) - return FALSE; - - if (m_pFusionAssembly == NULL) - return (!GetPath().IsEmpty()); - - if (m_dwLocationFlags == ASMLOC_UNKNOWN) - return FALSE; - - return ((m_dwLocationFlags & ASMLOC_CODEBASE_HINT) != 0); -} - -BOOL PEAssembly::IsSourceGAC() -{ - LIMITED_METHOD_CONTRACT; - - if ((m_pIHostAssembly != NULL) || (m_pFusionAssembly == NULL)) - { - return FALSE; - } - - return ((m_dwLocationFlags & ASMLOC_LOCATION_MASK) == ASMLOC_GAC); -} - -BOOL PEAssembly::IsSourceDownloadCache() -{ - LIMITED_METHOD_CONTRACT; - - if ((m_pIHostAssembly != NULL) || (m_pFusionAssembly == NULL)) - { - return FALSE; - } - - return ((m_dwLocationFlags & ASMLOC_LOCATION_MASK) == ASMLOC_DOWNLOAD_CACHE); -} - -#else // FEATURE_FUSION BOOL PEAssembly::IsSourceGAC() { WRAPPER_NO_CONTRACT; return m_bIsFromGAC; }; -#endif // FEATURE_FUSION #endif // #ifndef DACCESS_COMPILE -#ifdef FEATURE_FUSION -BOOL PEAssembly::IsContextLoad() -{ - LIMITED_METHOD_CONTRACT; - if ((m_pIHostAssembly != NULL) || (m_pFusionAssembly == NULL)) - { - return FALSE; - } - return (IsSystem() || (m_loadContext == LOADCTX_TYPE_DEFAULT)); -} - -LOADCTX_TYPE PEAssembly::GetLoadContext() -{ - LIMITED_METHOD_CONTRACT; - - return m_loadContext; -} - -DWORD PEAssembly::GetLocationFlags() -{ - LIMITED_METHOD_CONTRACT; - - return m_dwLocationFlags; -} - -#endif #ifndef DACCESS_COMPILE -#ifdef FEATURE_FUSION -PEKIND PEAssembly::GetFusionProcessorArchitecture() -{ - CONTRACTL - { - THROWS; - MODE_ANY; - GC_TRIGGERS; - } - CONTRACTL_END; - - PEImage * pImage = NULL; - -#ifdef FEATURE_PREJIT - pImage = m_nativeImage; -#endif - - if (pImage == NULL) - pImage = GetILimage(); - - return pImage->GetFusionProcessorArchitecture(); -} - -IAssemblyName * PEAssembly::GetFusionAssemblyName() -{ - CONTRACT(IAssemblyName *) - { - INSTANCE_CHECK; - POSTCONDITION(CheckPointer(RETVAL)); - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACT_END; - - if (m_pFusionAssemblyName == NULL) - { - AssemblySpec spec; - spec.InitializeSpec(this); - PEImage * pImage = GetILimage(); - -#ifdef FEATURE_PREJIT - if ((pImage != NULL) && !pImage->MDImportLoaded()) - pImage = m_nativeImage; -#endif - - if (pImage != NULL) - { - spec.SetPEKIND(pImage->GetFusionProcessorArchitecture()); - } - - GCX_PREEMP(); - - IfFailThrow(spec.CreateFusionName(&m_pFusionAssemblyName, FALSE)); - } - - RETURN m_pFusionAssemblyName; -} - -// This version of GetFusionAssemlyName that can be used to return the reference in a -// NOTHROW/NOTRIGGER fashion. This is useful for scenarios where you dont want to invoke the THROWS/GCTRIGGERS -// version when you know the name would have been created and is available. -IAssemblyName * PEAssembly::GetFusionAssemblyNameNoCreate() -{ - LIMITED_METHOD_CONTRACT; - - return m_pFusionAssemblyName; -} - -IAssembly *PEAssembly::GetFusionAssembly() -{ - CONTRACT(IAssembly *) - { - INSTANCE_CHECK; - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_END; - - RETURN m_pFusionAssembly; -} - -IHostAssembly *PEAssembly::GetIHostAssembly() -{ - CONTRACT(IHostAssembly *) - { - INSTANCE_CHECK; - POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_END; - - RETURN m_pIHostAssembly; -} - -IAssemblyLocation *PEAssembly::GetNativeAssemblyLocation() -{ - CONTRACT(IAssemblyLocation *) - { - INSTANCE_CHECK; - PRECONDITION(HasNativeImage()); - POSTCONDITION(CheckPointer(RETVAL)); - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_END; - - RETURN m_pNativeAssemblyLocation; -} -#endif // FEATURE_FUSION // ------------------------------------------------------------ // Hash support @@ -3562,13 +2735,8 @@ void PEAssembly::VerifyStrongName() return; } -#ifdef FEATURE_FUSION - // System and dynamic assemblies don't need hash checks - if (IsSystem() || IsDynamic()) -#else // Without FUSION/GAC, we need to verify SN on all assemblies, except dynamic assemblies. if (IsDynamic()) -#endif { m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS; @@ -3577,38 +2745,6 @@ void PEAssembly::VerifyStrongName() } // Next, verify the strong name, if necessary -#ifdef FEATURE_FUSION - // See if the assembly comes from a secure location - IAssembly *pFusionAssembly = GetAssembly()->GetFusionAssembly(); - if (pFusionAssembly) - { - DWORD dwLocation; - IfFailThrow(pFusionAssembly->GetAssemblyLocation(&dwLocation)); - - switch (dwLocation & ASMLOC_LOCATION_MASK) - { - case ASMLOC_GAC: - case ASMLOC_DOWNLOAD_CACHE: - case ASMLOC_DEV_OVERRIDE: - // Assemblies from the GAC or download cache have - // already been verified by Fusion. - m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS; - m_fStrongNameVerified = TRUE; - return; - - case ASMLOC_RUN_FROM_SOURCE: - case ASMLOC_UNKNOWN: - // For now, just verify these every time, we need to - // cache the fact that at least one verification has - // been performed (if strong name policy permits - // caching of verification results) - break; - - default: - UNREACHABLE(); - } - } -#endif // Check format of image. Note we must delay this until after the GAC status has been // checked, to handle the case where we are not loading m_image. @@ -3719,29 +2855,6 @@ void PEAssembly::GetCodeBase(SString &result, BOOL fCopiedName/*=FALSE*/) INJECT_FAULT(COMPlusThrowOM();); } CONTRACTL_END; -#ifdef FEATURE_FUSION - // For a copied name, we always use the actual file path rather than the fusion info - if (!fCopiedName && m_pFusionAssembly) - { - if ( ((m_dwLocationFlags & ASMLOC_LOCATION_MASK) == ASMLOC_RUN_FROM_SOURCE) || - ((m_dwLocationFlags & ASMLOC_LOCATION_MASK) == ASMLOC_DOWNLOAD_CACHE) ) - { - // Assemblies in the download cache or run from source should have - // a proper codebase set in them. - FusionBind::GetAssemblyNameStringProperty(GetFusionAssemblyName(), - ASM_NAME_CODEBASE_URL, - result); - return; - } - } - else if (m_pIHostAssembly) - { - FusionBind::GetAssemblyNameStringProperty(GetFusionAssemblyName(), - ASM_NAME_CODEBASE_URL, - result); - return; - } -#endif // All other cases use the file path. result.Set(GetEffectivePath()); @@ -3857,21 +2970,6 @@ void PEAssembly::ExternalVLog(DWORD facility, DWORD level, const WCHAR *fmt, va_ PEFile::ExternalVLog(facility, level, fmt, args); -#ifdef FEATURE_FUSION - if (FusionLoggingEnabled()) - { - DWORD dwLogCategory = (facility == LF_ZAP ? FUSION_BIND_LOG_CATEGORY_NGEN : FUSION_BIND_LOG_CATEGORY_DEFAULT); - - StackSString message; - message.VPrintf(fmt, args); - m_pFusionLog->LogMessage(0, dwLogCategory, message); - - if (level == LL_ERROR) { - m_pFusionLog->SetResultCode(dwLogCategory, E_FAIL); - FlushExternalLog(); - } - } -#endif //FEATURE_FUSION RETURN; } @@ -3885,12 +2983,6 @@ void PEAssembly::FlushExternalLog() } CONTRACT_END; -#ifdef FEATURE_FUSION - if (FusionLoggingEnabled()) { - m_pFusionLog->Flush(g_dwLogLevel, FUSION_BIND_LOG_CATEGORY_NGEN); - m_pFusionLog->Flush(g_dwLogLevel, FUSION_BIND_LOG_CATEGORY_DEFAULT); - } -#endif //FEATURE_FUSION RETURN; } @@ -4167,22 +3259,6 @@ PEModule *PEModule::DoOpen(PEAssembly *assembly, mdFile token, IfFailThrow(assembly->GetPersistentMDImport()->GetFileProps(token, NULL, NULL, NULL, &flags)); PEImageHolder image; -#ifdef FEATURE_FUSION - if (assembly->IsIStream()) - { - SafeComHolder<IHostAssemblyModuleImport> pModuleImport; - IfFailThrow(assembly->GetIHostAssembly()->GetModuleByName(fileName, &pModuleImport)); - - SafeComHolder<IStream> pIStream; - IfFailThrow(pModuleImport->GetModuleStream(&pIStream)); - - DWORD dwModuleId; - IfFailThrow(pModuleImport->GetModuleId(&dwModuleId)); - image = PEImage::OpenImage(pIStream, assembly->m_identity->m_StreamAsmId, - dwModuleId, (flags & ffContainsNoMetaData)); - } - else -#endif { image = PEImage::OpenImage(fileName); } diff --git a/src/vm/pefile.h b/src/vm/pefile.h index 31b7925dc3..2f244732e9 100644 --- a/src/vm/pefile.h +++ b/src/vm/pefile.h @@ -26,11 +26,6 @@ #include "loaderheap.h" #include "sstring.h" #include "ex.h" -#ifdef FEATURE_FUSION -#include <fusion.h> -#include <fusionbind.h> -#include "binderngen.h" -#endif #include "assemblyspecbase.h" #include "eecontract.h" #include "metadatatracker.h" @@ -710,66 +705,15 @@ class PEAssembly : public PEFile BOOL fIsIntrospectionOnly = FALSE); // This opens the canonical mscorlib.dll -#ifdef FEATURE_FUSION - static PEAssembly *OpenSystem(IApplicationContext *pAppCtx); -#else static PEAssembly *OpenSystem(IUnknown *pAppCtx); -#endif #ifdef DACCESS_COMPILE virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); #endif -#ifdef FEATURE_FUSION - static PEAssembly *Open( - IAssembly *pIAssembly, - IBindResult *pNativeFusionAssembly, - IFusionBindLog *pFusionLog = NULL, - BOOL isSystemAssembly = FALSE, - BOOL isIntrospectionOnly = FALSE); - - static PEAssembly *Open( - IHostAssembly *pIHostAssembly, - BOOL isSystemAssembly = FALSE, - BOOL isIntrospectionOnly = FALSE); - -#ifdef FEATURE_MIXEDMODE - // Use for main exe loading - // NOTE: This may also be used for "spontaneous" (IJW) dll loading where - // we need to deliver DllMain callbacks, but we should eliminate this case - - static PEAssembly *OpenHMODULE( - HMODULE hMod, - IAssembly *pFusionAssembly, - IBindResult *pNativeFusionAssembly, - IFusionBindLog *pFusionLog = NULL, - BOOL isIntrospectionOnly = FALSE); -#endif // FEATURE_MIXEDMODE - - static PEAssembly *DoOpen( - IAssembly *pIAssembly, - IBindResult *pNativeFusionAssembly, - IFusionBindLog *pFusionLog, - BOOL isSystemAssembly, - BOOL isIntrospectionOnly = FALSE); - - static PEAssembly *DoOpen( - IHostAssembly *pIHostAssembly, - BOOL isSystemAssembly, - BOOL isIntrospectionOnly = FALSE); -#ifdef FEATURE_MIXEDMODE - static PEAssembly *DoOpenHMODULE( - HMODULE hMod, - IAssembly *pFusionAssembly, - IBindResult *pNativeFusionAssembly, - IFusionBindLog *pFusionLog, - BOOL isIntrospectionOnly = FALSE); -#endif // FEATURE_MIXEDMODE -#else static PEAssembly *Open( CoreBindResult* pBindResult, BOOL isSystem, BOOL isIntrospectionOnly); -#endif // FEATURE_FUSION static PEAssembly *Create( PEAssembly *pParentAssembly, @@ -792,11 +736,7 @@ class PEAssembly : public PEFile private: // Private helpers for crufty exception handling reasons -#ifdef FEATURE_FUSION - static PEAssembly *DoOpenSystem(IApplicationContext *pAppCtx); -#else static PEAssembly *DoOpenSystem(IUnknown *pAppCtx); -#endif public: @@ -808,45 +748,6 @@ class PEAssembly : public PEFile BOOL IsProfileAssembly(); ULONG HashIdentity(); -#ifdef FEATURE_FUSION - - BOOL FusionLoggingEnabled() - { - LIMITED_METHOD_CONTRACT; - return m_bFusionLogEnabled && (m_pFusionLog != NULL); - }; - void DisableFusionLogging() - { - m_bFusionLogEnabled = FALSE; - }; - - IFusionBindLog *GetFusionBindLog() - { - LIMITED_METHOD_CONTRACT; -#ifdef FEATURE_FUSION - return (m_bFusionLogEnabled && (m_pFusionLog != NULL)) ? m_pFusionLog : NULL; -#else - return NULL; -#endif - } - - - BOOL IsBindingCodeBase(); - - BOOL IsSourceDownloadCache(); - - LOADCTX_TYPE GetLoadContext(); - BOOL IsContextLoad(); - - // Can we avoid exposing these? - IAssembly *GetFusionAssembly(); - IHostAssembly *GetIHostAssembly(); - IAssemblyName *GetFusionAssemblyName(); - IAssemblyName *GetFusionAssemblyNameNoCreate(); - IAssemblyLocation* GetNativeAssemblyLocation(); - DWORD GetLocationFlags(); - PEKIND GetFusionProcessorArchitecture(); -#endif #ifndef DACCESS_COMPILE virtual void ReleaseIL(); @@ -904,45 +805,12 @@ class PEAssembly : public PEFile #ifdef FEATURE_PREJIT void ExternalVLog(DWORD facility, DWORD level, const WCHAR *fmt, va_list args) DAC_EMPTY(); void FlushExternalLog() DAC_EMPTY(); -#ifdef FEATURE_FUSION - void ETWTraceLogMessage(DWORD dwETWLogCategory, PEAssembly *pAsm) - { - LIMITED_METHOD_CONTRACT - if (FusionLoggingEnabled() && - (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEFUSION_KEYWORD))) - { - m_pFusionLog->ETWTraceLogMessage(dwETWLogCategory, (pAsm?pAsm->m_pFusionAssemblyName:NULL)); - } - } - ULONGLONG GetBindingID() - { - LIMITED_METHOD_CONTRACT; - ULONGLONG ullBindingID = 0; - if (FusionLoggingEnabled()) - m_pFusionLog->GetBindingID(&ullBindingID); - return ullBindingID; - } -#endif #endif protected: #ifndef DACCESS_COMPILE -#ifdef FEATURE_FUSION - PEAssembly( - PEImage *image, - IMetaDataEmit *pEmit, - IAssembly *pIAssembly, - IBindResult *pNativeFusionAssembly, - PEImage *pNIImage, - IFusionBindLog *pFusionLog, - IHostAssembly *pIHostAssembly, - PEFile *creator, - BOOL system, - BOOL introspectionOnly = FALSE, - ICLRPrivAssembly * pHostAssembly = NULL); -#else PEAssembly( CoreBindResult* pBindResultInfo, IMetaDataEmit *pEmit, @@ -953,7 +821,6 @@ class PEAssembly : public PEFile PEImage * pPEImageNI = NULL, ICLRPrivAssembly * pHostAssembly = NULL ); -#endif virtual ~PEAssembly(); #endif @@ -964,28 +831,11 @@ class PEAssembly : public PEFile friend class DomainAssembly; #ifdef FEATURE_PREJIT -#ifdef FEATURE_FUSION - void SetNativeImage(IBindResult *pNativeFusionAssembly); -#else void SetNativeImage(PEImage *image); -#endif BOOL CheckNativeImageVersion(PEImage *image); -#ifdef FEATURE_FUSION - void ClearNativeImage(); - void SetNativeImageClosure(IAssemblyBindingClosure *pClosure) - { - LIMITED_METHOD_CONTRACT; - if (m_pNativeImageClosure!=NULL) - m_pNativeImageClosure->Release(); - if (pClosure) - pClosure->AddRef(); - m_pNativeImageClosure=pClosure; - }; - BOOL HasEqualNativeClosure(DomainAssembly* pDomainAssembly); -#endif //FEATURE_FUSION #endif // FEATURE_PREJIT @@ -1002,24 +852,12 @@ class PEAssembly : public PEFile // ------------------------------------------------------------ PTR_PEFile m_creator; -#ifdef FEATURE_FUSION - IAssemblyName *m_pFusionAssemblyName; - IAssembly *m_pFusionAssembly; - IFusionBindLog *m_pFusionLog; - BOOL m_bFusionLogEnabled; - IHostAssembly *m_pIHostAssembly; - IAssemblyLocation *m_pNativeAssemblyLocation; - IAssemblyBindingClosure *m_pNativeImageClosure; //present only for shared - LOADCTX_TYPE m_loadContext; - DWORD m_dwLocationFlags; -#else BOOL m_bIsFromGAC; BOOL m_bIsOnTpaList; // Using a separate entry and not m_pHostAssembly because otherwise // HasHostAssembly becomes true that trips various other code paths resulting in bad // things SString m_sTextualIdentity; -#endif int m_fProfileAssembly; // Tri-state cache public: @@ -1144,21 +982,6 @@ class LoggablePEAssembly : public LoggableAssembly return m_peAssembly->GetPath(); } -#ifdef FEATURE_FUSION - virtual IAssemblyName* FusionAssemblyName() - { - STANDARD_VM_CONTRACT; - - return m_peAssembly->GetFusionAssemblyName(); - } - - virtual IFusionBindLog* FusionBindLog() - { - STANDARD_VM_CONTRACT; - - return m_peAssembly->GetFusionBindLog(); - } -#endif // FEATURE_FUSION LoggablePEAssembly(PEAssembly *peAssembly) { diff --git a/src/vm/pefile.inl b/src/vm/pefile.inl index fb73e5df4a..3d5e946110 100644 --- a/src/vm/pefile.inl +++ b/src/vm/pefile.inl @@ -12,9 +12,6 @@ #include "strongname.h" #include "strongnameholders.h" -#ifdef FEATURE_FUSION -#include "fusionbind.h" -#endif #include "check.h" #include "simplerwlock.hpp" #include "eventtrace.h" @@ -1632,9 +1629,6 @@ inline void PEAssembly::GetDisplayName(SString &result, DWORD flags) #ifndef DACCESS_COMPILE -#ifdef FEATURE_FUSION - FusionBind::GetAssemblyNameDisplayName(GetFusionAssemblyName(), result, flags); -#else if ((flags == (ASM_DISPLAYF_VERSION | ASM_DISPLAYF_CULTURE | ASM_DISPLAYF_PUBLIC_KEY_TOKEN)) && !m_sTextualIdentity.IsEmpty()) { @@ -1646,7 +1640,6 @@ inline void PEAssembly::GetDisplayName(SString &result, DWORD flags) spec.InitializeSpec(this); spec.GetFileOrDisplayName(flags, result); } -#endif // FEATURE_FUSION #else IMDInternalImport *pImport = GetMDImport(); diff --git a/src/vm/pefingerprint.cpp b/src/vm/pefingerprint.cpp index 775966663f..b02e8a30bb 100644 --- a/src/vm/pefingerprint.cpp +++ b/src/vm/pefingerprint.cpp @@ -33,330 +33,6 @@ #include "pefile.h" #include "pefingerprint.h" -#ifdef FEATURE_FUSION - -static VOID ThrowTornState(LPCWSTR path); -static void FetchILTimestampAndSize(LPCWSTR path, FILETIME *pTimestamp, DWORD *pSize, HANDLE hFileHandleIfOpen = INVALID_HANDLE_VALUE); - - -const size_t PEFingerprint::s_offsets[] = -{ - offsetof(PEFingerprint, m_timeStamp), - offsetof(PEFingerprint, m_size), - offsetof(PEFingerprint, m_mvid), -}; - -const DWORD PEFingerprint::s_sizes[] = -{ - sizeof(((PEFingerprint *)NULL)->m_timeStamp), - sizeof(((PEFingerprint *)NULL)->m_size), - sizeof(((PEFingerprint *)NULL)->m_mvid), -}; - - - -//--------------------------------------------------------------- -// Ctor -//--------------------------------------------------------------- -PEFingerprint::PEFingerprint(PEImage *owner) : - m_pcrst(NULL) - ,m_peimage(owner) - ,m_commitMask(0) - ,m_alreadyLoaded(FALSE) - ,m_priorLockAndLoadFailure(S_OK) -{ - - LIMITED_METHOD_CONTRACT; - - _ASSERTE(owner); - - memset(&m_timeStamp, 0xcc, sizeof(m_timeStamp)); - memset(&m_size, 0xcc, sizeof(m_size)); - memset(&m_mvid, 0xcc, sizeof(m_mvid)); - - return; -} - - -//--------------------------------------------------------------- -// PEFingerprint factory -//--------------------------------------------------------------- -/*static*/ PEFingerprint *PEFingerprint::CreatePEFingerprint(PEImage *owner) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - - NewHolder<PEFingerprint> pPEFingerprint = new PEFingerprint(owner); - pPEFingerprint->m_pcrst = new Crst(CrstLeafLock); - - //--------------------------------------------------------------- - // Since obtaining the timestamp is cheap and doesn't need to open the - // file, go ahead and get it now and commit into the fingerprint. - // - // @review: Would it be better to lock the file right now to - // prevent overwriter for the life of the fingerprint? - //--------------------------------------------------------------- - LPCWSTR path = pPEFingerprint->m_peimage->GetPath(); - _ASSERTE(path); - - FILETIME lastWriteTime; - DWORD size; - FetchILTimestampAndSize(path, &lastWriteTime, &size); - - ILFingerprintComponent components[] = - { - { ILFTagTimestamp, &lastWriteTime }, - { ILFTagSize, &size }, - }; - BOOL success = pPEFingerprint->CommitAndCompareMulti(COUNTOF(components), components); - _ASSERTE(success); // No way this commit can fail - we own the only pointer! - return pPEFingerprint.Extract(); -} - - - -//--------------------------------------------------------------- -// Dtor -//--------------------------------------------------------------- -PEFingerprint::~PEFingerprint() -{ - LIMITED_METHOD_CONTRACT; - delete m_pcrst; - return; -} - -//--------------------------------------------------------------- -// AddRef -//--------------------------------------------------------------- -ULONG PEFingerprint::AddRef() -{ - LIMITED_METHOD_CONTRACT; - return m_peimage->AddRef(); -} - -//--------------------------------------------------------------- -// Release -//--------------------------------------------------------------- -ULONG PEFingerprint::Release() -{ - LIMITED_METHOD_CONTRACT; - STATIC_CONTRACT_GC_TRIGGERS; - STATIC_CONTRACT_CAN_TAKE_LOCK; - return m_peimage->Release(); -} - -//--------------------------------------------------------------------------------------------- -// Convenience fcn: equivalent to calling CommitAndCompareMulti() with one component. -//--------------------------------------------------------------------------------------------- -BOOL PEFingerprint::CommitAndCompare(ILFingerprintTag componentType, LPCVOID data) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - - ILFingerprintComponent c = {componentType, data}; - return CommitAndCompareMulti(1, &c); -} - - - //--------------------------------------------------------------------------------------------- - // CommitAndCompareMulti(): Atomically commits one or more fingerprint components into - // the fingerprint. Once a component is committed, its value can never change. - // - // An attempt to commit a component succeeds only if the component was not already committed - // or the prior value maches the new one exactly. - // - // Calling CommitAndCompare() multiple times is not equivalent to calling CommitAndCompareMulti(). - // CommitAndCompareMulti() is atomic - either all the commits happen or none of them do. - // - // Returns: - // TRUE: All passed components committed successful. - // FALSE: At leat one component failed to commit successfully. - //--------------------------------------------------------------------------------------------- -BOOL PEFingerprint::CommitAndCompareMulti(UINT numComponents, const ILFingerprintComponent *pComponents) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - - //------------------------------------------------------------------------------ - // See "Dev11 note on timing of torn state detection". This step should not be - // here but this is how we "verify" the MVID/SNHash on IL open. We wait until - // the first time someone attempts a commit on an opened file to do the check. - // The caller will think we did the check at file open time, even though we - // actually left a window of vulnerability. - //------------------------------------------------------------------------------ - if (!m_alreadyLoaded) - { - PEImageHolder pOpenedILimage; - m_peimage->Clone(MDInternalImport_OnlyLookInCache,&pOpenedILimage); - - if(pOpenedILimage != NULL && pOpenedILimage->IsOpened()) - { - - for (UINT j = 0; j < numComponents; j++) - { - // Don't open if we're just checking timestamp (forecloses possible reentrancy problems - // due to timestamp commits occurring within PEImage itself.) - ILFingerprintTag tag = pComponents[j]._tag; - if (tag == ILFTagMvid) - { - this->LockAndLoadIL(); - break; - } - - } - } - } - - //------------------------------------------------------------------------------ - // Inside the crit section, make sure all the components can successfully commit - // before commitng any of them. - //------------------------------------------------------------------------------ - CrstHolder ch(m_pcrst); - UINT i; - for (i = 0; i < numComponents; i++) - { - ILFingerprintTag tag = pComponents[i]._tag; - if (IsComponentCommitted(tag)) - { - if (0 != memcmp(pComponents[i]._data, TagDataStart(tag), TagDataSize(tag))) - return FALSE; - } - } - for (i = 0; i < numComponents; i++) - { - ILFingerprintTag tag = pComponents[i]._tag; - if (!IsComponentCommitted(tag)) - { - memcpy(TagDataStart(tag), pComponents[i]._data, TagDataSize(tag)); - SetComponentCommitted(tag); - } - } - - return TRUE; -} - - - -//--------------------------------------------------------------------------------------------- -// LockAndLoadIL() -// -// Forces the runtime to open the IL file and lock it against future overwrites. This -// is bad for working set so this should be avoided. -// -// Once opened and locked, this method extracts the actual fingerprint from the IL file -// and attempts to commit it into the ILFingerprint. If successful, all future commits -// will now be compared against this trusted data. If unsuccessful, this is a torn state -// situation and LockAndLoadIL() throws the torn state exception. -//--------------------------------------------------------------------------------------------- -void PEFingerprint::LockAndLoadIL() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - - //---------------------------------------------------------------------------------- - // If already loaded, return the prior result. - //---------------------------------------------------------------------------------- - if (m_alreadyLoaded) - { - if (FAILED(m_priorLockAndLoadFailure)) - { - ThrowHR(m_priorLockAndLoadFailure); - } - else - { - return; - } - } - PEImageHolder pOpenedILimage; - m_peimage->Clone(MDInternalImport_Default,&pOpenedILimage); - HRESULT hr = S_OK; - { - GCX_PREEMP(); - IfFailThrow(m_peimage->TryOpenFile()); - } - //---------------------------------------------------------------------------------- - // Force the file open (by requesting a metadata pointer to it.) - //---------------------------------------------------------------------------------- - IMDInternalImport *pMDImport = NULL; - EX_TRY - { - pMDImport = pOpenedILimage->GetMDImport(); - hr = S_OK; - } - EX_CATCH_HRESULT(hr); - if (Exception::IsTransient(hr)) - ThrowHR(hr); - if (FAILED(hr)) - { - m_priorLockAndLoadFailure = hr; - m_alreadyLoaded = TRUE; - ThrowHR(hr); - } - - m_alreadyLoaded = TRUE; - - //------------------------------------------------------------------------------ - // See "Dev11 note on timing of torn state detection". This step should not be - // here as the "right" design is to extract the actual MVID before we officially - // open the file. But since we don't do that in the current implementation, we do - // it now. - //------------------------------------------------------------------------------ - GUID mvid; - pOpenedILimage->GetMVID(&mvid); - - BOOL success = this->CommitAndCompare(ILFTagMvid, &mvid); - if (!success) - ThrowTornState(m_peimage->GetPath()); -} - - -//================================================================================== -// Helper for throwing a torn state exception. -//================================================================================== -static VOID ThrowTornState(LPCWSTR path) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - - COMPlusThrow(kFileLoadException, IDS_EE_TORNSTATE, path); -} - -#endif // FEATURE_FUSION @@ -384,240 +60,7 @@ PEFingerprintVerificationHolder::PEFingerprintVerificationHolder(PEImage *owner) } CONTRACTL_END -#ifdef FEATURE_FUSION - if (owner->IsTrustedNativeImage()) - return; // Waste of cycles to check timestamps for NI images. - - - LPCWSTR path = owner->GetPath(); - _ASSERTE(path); - - if (owner->IsOpened()) - return; // Not the first layout to be opened - no need to repeat the work in that case. - - // First, lock the file and verify that the timestamp hasn't changed. - TESTHOOKCALL(AboutToLockImage(path, IsCompilationProcess())); - m_fileHandle = WszCreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (m_fileHandle == INVALID_HANDLE_VALUE) - { - // @review: If this call to open the file fails, it sounds a bit risky to fail the PE open altogether - // just to do a torn state check. Let the torn state detection bake a bit before we take this step. - return; - } - - FILETIME lastWriteTime; - DWORD size; - FetchILTimestampAndSize(path, &lastWriteTime, &size, m_fileHandle); - ReleaseHolder<IILFingerprint> fingerPrint; - ILFingerprintComponent components[] = - { - { ILFTagTimestamp, &lastWriteTime }, - { ILFTagSize, &size }, - }; - IfFailThrow(owner->GetILFingerprint(&fingerPrint)); - if (!fingerPrint->CommitAndCompareMulti(COUNTOF(components), components)) - ThrowTornState(path); - - - // Now, verify that the MVID/SNHash/TPBand hasn't changed. - // Oh wait, where that'd code go? See "Dev11 note on timing of torn state detection". -#endif // FEATURE_FUSION - return; -} - -#ifdef FEATURE_FUSION -#ifndef DACCESS_COMPILE -class CachingILFingerprintFactory : public IILFingerprintFactory -{ -private: - LONG m_refCount; - Crst m_lock; - - // Hash Type ... NOTE! This is a case sensitive hash of a filename to an IL fingerprint. - // This is acceptable as duplicates are not errors, and chosen as case insensitive hashes - // are somewhat slower, and most hash lookups will actually match in case. If this is not - // the case, converting to a case-insensitive hash should be trivial. - typedef StringSHashWithCleanup< IILFingerprint, WCHAR > ILFingerprintHash; - typedef StringHashElement< IILFingerprint, WCHAR > ILFingerprintHashElement; - - ILFingerprintHash m_hash; - - ~CachingILFingerprintFactory() - { - } - -public: - - CachingILFingerprintFactory() : m_refCount(1), m_lock(CrstILFingerprintCache) - { - CONTRACTL - { - THROWS; - GC_TRIGGERS; - } - CONTRACTL_END; - } - - STDMETHOD_(ULONG, AddRef)() - { - CONTRACT(ULONG) - { - PRECONDITION(m_refCount>0 && m_refCount < COUNT_T_MAX); - NOTHROW; - GC_NOTRIGGER; - } - CONTRACT_END; - - RETURN (static_cast<ULONG>(FastInterlockIncrement(&m_refCount))); - } - - STDMETHOD_(ULONG, Release)() - { - CONTRACTL - { - DESTRUCTOR_CHECK; - NOTHROW; - MODE_ANY; - FORBID_FAULT; - } - CONTRACTL_END; - - ULONG result = 0; - result=FastInterlockDecrement(&m_refCount); - if (result == 0) - delete this; - - return result; - } - - STDMETHOD(GetILFingerprintForPath)( - LPCWSTR pwzPath, - IILFingerprint **ppFingerprint) - { - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - } - CONTRACTL_END; - HRESULT hr = S_OK; - - EX_TRY - { - CrstHolder ch(&m_lock); - // Lookup in cache - ILFingerprintHashElement *pCacheElement = m_hash.Lookup(pwzPath); - - // If that fails, run the parser, and populate the cache - if (pCacheElement != NULL) - { - *ppFingerprint = clr::SafeAddRef(pCacheElement->Object); - } - else - { - // Create new assembly name object; - ReleaseHolder<IILFingerprint> pFingerprint; - NewArrayHolder<WCHAR> pwzPathCopy; - IfFailThrow(RuntimeGetILFingerprintForPath(pwzPath, &pFingerprint)); - - // Create hash element object - NewHolder<ILFingerprintHashElement> pHashElem = new ILFingerprintHashElement(); - pwzPathCopy = DuplicateStringThrowing(pwzPath); - pHashElem->String = pwzPathCopy; - pHashElem->Object = pFingerprint; - - // Insert into hash table - m_hash.Add(pHashElem); - - *ppFingerprint = clr::SafeAddRef(pFingerprint); - - // Prevent disastrous cleanup - pwzPathCopy.SuppressRelease(); - pHashElem.SuppressRelease(); - pFingerprint.SuppressRelease(); - } - } - EX_CATCH_HRESULT(hr); - - return hr; - } -}; - -HRESULT RuntimeCreateCachingILFingerprintFactory(IILFingerprintFactory **ppILFingerprintFactory) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - } - CONTRACTL_END; - HRESULT hr = S_OK; - - EX_TRY - { - *ppILFingerprintFactory = new CachingILFingerprintFactory(); - } - EX_CATCH_HRESULT(hr); - - return hr; -} - -//------------------------------------------------------------------------------------------------------------- -// Common routine to fetch the IL file's timestamp and size. If the caller already has an open file handle, it should -// pass that as "hFileHandleIfOpen" to avoid the overhead of opening the file again. -//------------------------------------------------------------------------------------------------------------- -static void FetchILTimestampAndSize(LPCWSTR path, FILETIME *pTimestamp, DWORD *pSize, HANDLE hFileHandleIfOpen /* = INVALID_HANDLE_VALUE*/) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - - _ASSERTE(pTimestamp != NULL && pSize != NULL); - - if (hFileHandleIfOpen != INVALID_HANDLE_VALUE) - { - BY_HANDLE_FILE_INFORMATION info; - if (!GetFileInformationByHandle(hFileHandleIfOpen, &info)) - ThrowLastError(); - *pTimestamp = info.ftLastWriteTime; - *pSize = info.nFileSizeLow; - return; - } - - // For normal files, we can obtain the timestamp without opening the file - attempt to do so. - WIN32_FILE_ATTRIBUTE_DATA wfd; - if (!WszGetFileAttributesEx(path, GetFileExInfoStandard, &wfd)) - ThrowLastError(); - if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) - { - *pTimestamp = wfd.ftLastWriteTime; - *pSize = wfd.nFileSizeLow; - return; - } - - // If we got here, the original path pointed to a symbolic or some other form of reparse point. In such cases, GetFileAttributesEx - // may not return the same timestamp as GetFileInformationByHandle. (E.g. in the symbolic link case, GetFileAttributeEx returns - // the symbolic link's timestamp rather than the target's timestamp.) - // - // Since this is the uncommon case, we can justify the perf hit of opening the file so we get the timestamp - // on the actual target. - HandleHolder hFile(WszCreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); - if (hFile == INVALID_HANDLE_VALUE) - ThrowLastError(); - BY_HANDLE_FILE_INFORMATION info; - if (!GetFileInformationByHandle(hFile, &info)) - ThrowLastError(); - *pTimestamp = info.ftLastWriteTime; - *pSize = info.nFileSizeLow; return; } -#endif // !DACCESS_COMPILE -#endif // FEATURE_FUSION diff --git a/src/vm/pefingerprint.h b/src/vm/pefingerprint.h index 357351f4ae..8db8df729a 100644 --- a/src/vm/pefingerprint.h +++ b/src/vm/pefingerprint.h @@ -11,95 +11,6 @@ #define PEFINGERPRINT_H_ -#ifdef FEATURE_FUSION - -#include "corcompile.h" - -class PEImage; - -//================================================================================== -// This is the implementation of IILFingerprint object maintained by PEImage objects. -// IILFingerprint is described in detail in IILFingerprint.h -//================================================================================== -class PEFingerprint : public IILFingerprint -{ - public: - //---------------------------------------------------------------- - // IILFingerprint methods - //---------------------------------------------------------------- - STDMETHOD_(ULONG, AddRef)(); - STDMETHOD_(ULONG, Release)(); - STDMETHOD_(BOOL, CommitAndCompare)(ILFingerprintTag componentType, LPCVOID data); - STDMETHOD_(BOOL, CommitAndCompareMulti)(UINT numComponents, const ILFingerprintComponent *pComponents); - STDMETHOD_(void, LockAndLoadIL)(); - - //---------------------------------------------------------------- - // Non-interface public methods. - //---------------------------------------------------------------- - public: - static PEFingerprint* PEFingerprint::CreatePEFingerprint(PEImage *owner); - virtual ~PEFingerprint(); - - private: - PEFingerprint(PEImage *owner); - - //---------------------------------------------------------------- - // Private methods. - //---------------------------------------------------------------- - private: - - BOOL IsComponentCommitted(ILFingerprintTag tag) - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(tag < ILFTagCount); - return 0 != (m_commitMask & (1 << tag)); - } - - void SetComponentCommitted(ILFingerprintTag tag) - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(tag < ILFTagCount); - m_commitMask |= (1 << tag); - } - - LPVOID TagDataStart(ILFingerprintTag tag) - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(tag < ILFTagCount); - return (LPVOID)(((LPBYTE)this) + s_offsets[tag]); - } - - DWORD TagDataSize(ILFingerprintTag tag) - { - LIMITED_METHOD_CONTRACT; - _ASSERTE(tag < ILFTagCount); - return s_sizes[tag]; - } - - - //---------------------------------------------------------------- - // Private instance data - //---------------------------------------------------------------- - private: - Crst *m_pcrst; // Synchronizes updates to fingerprint - PEImage *m_peimage; // Backpointer to PEImage (for ref-counting purposes, the PEImage and PEFingerprint have the same identity) - DWORD m_commitMask; // Bitmask to indicate which components have been committed ( fCommitted = (m_commitMask & (1 << tag)) ) - FILETIME m_timeStamp; // Component: File system lastwrite Timestamp - DWORD m_size; // Component: File size - GUID m_mvid; // Component: Mvid - - BOOL m_alreadyLoaded; // Turns repeated attempts to LockAndLoadIL() into NOP's - HRESULT m_priorLockAndLoadFailure; // If LockAndLoadIL() failed the first time, return the same failure on subsequent attempts. - - //---------------------------------------------------------------- - // Private static data - //---------------------------------------------------------------- - private: - const static size_t s_offsets[ILFTagCount]; // static: Maps tags to offsets within PEFingerprint - const static DWORD s_sizes[ILFTagCount]; // static: Maps tag to expected data size -}; - -#endif // FEATURE_FUSION //================================================================================== diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp index 1bb479c486..ed1c77b203 100644 --- a/src/vm/peimage.cpp +++ b/src/vm/peimage.cpp @@ -65,13 +65,11 @@ void PEImage::Startup() s_ijwFixupDataHash->Init(CompareIJWDataBase, FALSE, &ijwLock); #endif PEImageLayout::Startup(); -#ifndef FEATURE_FUSION #ifdef FEATURE_USE_LCID g_lcid = MAKELCID(LOCALE_INVARIANT, SORT_DEFAULT); #else // FEATURE_USE_LCID g_lcid = NULL; // invariant #endif //FEATURE_USE_LCID -#endif END_SO_INTOLERANT_CODE; RETURN; @@ -226,9 +224,6 @@ PEImage::~PEImage() m_pMDTracker->Deactivate(); #endif // METADATATRACKER_ENABLED -#ifdef FEATURE_FUSION - delete m_pILFingerprint; -#endif // FEATURE_FUSION } #ifdef FEATURE_MIXEDMODE @@ -444,12 +439,6 @@ BOOL PEImage::CompareImage(UPTR u1, UPTR u2) // This is the value stored in the table PEImage *pImage = (PEImage *) u2; -#ifdef FEATURE_FUSION - if (pLocator->m_fIsIStream) - { - return pImage->m_fIsIStream && (pLocator->m_StreamAsmId == pImage->m_StreamAsmId) && (pLocator->m_dwStreamModuleId == pImage->m_dwStreamModuleId); - } -#endif BOOL ret = FALSE; HRESULT hr; @@ -743,297 +732,6 @@ void DECLSPEC_NORETURN PEImage::ThrowFormat(HRESULT hrError) EEFileLoadException::Throw(m_path, hrError); } -#ifdef FEATURE_FUSION -// -------------------------------------------------------------------------------- -// Exports for the metadata APIs for fusion. -// -------------------------------------------------------------------------------- - -HRESULT STDMETHODCALLTYPE RuntimeOpenImage(LPCWSTR pszFileName, HCORMODULE* hHandle) -{ - WRAPPER_NO_CONTRACT; - return RuntimeOpenImageInternal(pszFileName, hHandle, NULL, MDInternalImport_Default); -} - -HRESULT STDMETHODCALLTYPE RuntimeOpenImageInternal(LPCWSTR pszFileName, HCORMODULE* hHandle, DWORD *pdwLength, MDInternalImportFlags flags, HANDLE hFile) -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_SO_INTOLERANT; - HRESULT hr = S_OK; - ETWOnStartup (LoaderCatchCall_V1,LoaderCatchCallEnd_V1); - EX_TRY - { - PEImage::Startup(); - PEImageHolder pFile(PEImage::OpenImage(pszFileName, flags)); - if (hFile != INVALID_HANDLE_VALUE) - { - pFile->SetFileHandle(hFile); - } - if (pdwLength) - { - PEImageLayoutHolder pLayout(pFile->GetLayout(PEImageLayout::LAYOUT_MAPPED,PEImage::LAYOUT_CREATEIFNEEDED)); - pFile->CachePEKindAndMachine(); - *pdwLength = pLayout->GetSize(); - } - *hHandle = (HCORMODULE)pFile.Extract(); - } - EX_CATCH_HRESULT(hr); - return hr; -} - -HRESULT STDMETHODCALLTYPE RuntimeOpenImageByStream(IStream* pIStream, UINT64 AssemblyId, - DWORD dwModuleId, - HCORMODULE* hHandle, DWORD *pdwLength, MDInternalImportFlags flags) -{ - STATIC_CONTRACT_NOTHROW; - HRESULT hr = S_OK; - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - EX_TRY - { - PEImage::Startup(); - - PEImageHolder pFile(PEImage::OpenImage(pIStream, AssemblyId, dwModuleId, FALSE, flags)); - *hHandle = (HCORMODULE) pFile.Extract(); - if (pdwLength) - { - PEImageLayoutHolder pImage(pFile->GetLayout(PEImageLayout::LAYOUT_ANY,0)); - pFile->CachePEKindAndMachine(); - *pdwLength = pImage->GetSize(); - } - } - EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE; - - return hr; -} - -HRESULT STDMETHODCALLTYPE RuntimeReleaseHandle(HCORMODULE hHandle) -{ - STATIC_CONTRACT_NOTHROW; - HRESULT hr = S_OK; - - PEImage *pImage = (PEImage*)hHandle; - - if (pImage != NULL) - pImage->Release(); - - return hr; -} - -void RuntimeAddRefHandle(HCORMODULE hHandle) -{ - STATIC_CONTRACT_NOTHROW; - - PEImage *pImage = (PEImage*)hHandle; - - if (pImage != NULL) - pImage->AddRef(); -} - -HRESULT STDMETHODCALLTYPE RuntimeGetMDInternalImport(HCORMODULE hHandle, MDInternalImportFlags flags, IMDInternalImport** ppMDImport) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - SO_TOLERANT; - } - CONTRACTL_END; - PEImage* pImage=(PEImage*)hHandle; - HRESULT hr=S_OK; - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - EX_TRY - { - if (!pImage->HasNTHeaders() || !pImage->HasCorHeader()) - hr=HRESULT_FROM_WIN32(ERROR_FILE_INVALID); - else - { -#ifdef FEATURE_PREJIT - if (pImage->HasNativeHeader()) - { - if (!pImage->CheckNativeFormat()) - hr=COR_E_BADIMAGEFORMAT; - else - { - if (flags & MDInternalImport_ILMetaData) - goto OPEN_IL_METADATA; - - *ppMDImport=pImage->GetNativeMDImport(); - if (*ppMDImport) - (*ppMDImport)->AddRef(); - else - hr=COR_E_BADIMAGEFORMAT; - } - } - else -#endif //FEATURE_PREJIT - { - if (!pImage->CheckILFormat()) - hr=COR_E_BADIMAGEFORMAT; - else - { -#ifdef FEATURE_PREJIT - OPEN_IL_METADATA: -#endif - *ppMDImport=pImage->GetMDImport(); - if (*ppMDImport) - (*ppMDImport)->AddRef(); - else - hr=COR_E_BADIMAGEFORMAT; - } - } - } - } - EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE; - - return hr; -} - -HRESULT STDMETHODCALLTYPE RuntimeGetImageBase(HCORMODULE hHandle,LPVOID* base, BOOL bMapped, COUNT_T* dwSize) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - SO_TOLERANT; - } - CONTRACTL_END; - HRESULT hr=S_FALSE; - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - EX_TRY - { - PEImage* pImage=(PEImage*)hHandle; - *base=NULL; - if (!pImage->HasLoadedLayout()) - { - PEImageLayoutHolder pLayout(pImage->GetLayout(bMapped - ?PEImageLayout::LAYOUT_MAPPED - :PEImageLayout::LAYOUT_FLAT,0)); - if (pLayout!=NULL) - { - if(dwSize) - *dwSize=pLayout->GetSize(); - *base=pLayout->GetBase(); - hr=S_OK; - } - } - - if (hr==S_FALSE && pImage->HasLoadedLayout()) - { - BOOL bIsMapped=pImage->GetLoadedLayout()->IsMapped(); - if ((bIsMapped && bMapped) || (!bIsMapped && !bMapped)) - { - //the one we want - *base=pImage->GetLoadedLayout()->GetBase(); - if (dwSize) - *dwSize=pImage->GetLoadedLayout()->GetSize(); - hr=S_OK; - } - } - } - EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE; - - return hr; -} - -HRESULT STDMETHODCALLTYPE RuntimeGetImageKind(HCORMODULE hHandle,DWORD* pdwKind, DWORD* pdwMachine) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - MODE_ANY; - SO_TOLERANT; - } - CONTRACTL_END; - HRESULT hr=S_FALSE; - - PEImage* pImage=(PEImage*)hHandle; - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - EX_TRY - { - pImage->GetPEKindAndMachine(pdwKind, pdwMachine); - hr = S_OK; - } - EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE; - return hr; -} - -HRESULT STDMETHODCALLTYPE RuntimeOSHandle(HCORMODULE hHandle, HMODULE* hModule) -{ - LIMITED_METHOD_CONTRACT; - if(hHandle==NULL || hModule == NULL) - return E_POINTER; - PEImage* pImage= (PEImage*) hHandle; - if (!pImage->HasLoadedLayout()) - return HRESULT_FROM_WIN32(ERROR_NOT_FOUND); - *hModule=(HMODULE)pImage->GetLoadedLayout()->GetBase(); - return S_OK; -} - -HRESULT RuntimeGetAssemblyStrongNameHashForModule(HCORMODULE hModule, - IMetaDataImport * pMDImport, - BYTE *pbSNHash, - DWORD *pcbSNHash) -{ - STATIC_CONTRACT_NOTHROW; - HRESULT hr = S_OK; - - PEImage* pImage = (PEImage*)hModule; - - BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW); - EX_TRY - { - - if (pImage->HasStrongNameSignature()) - { - if (pImage->IsStrongNameSigned()) - { - SBuffer signature; - pImage->GetHashedStrongNameSignature(signature); - *pcbSNHash = min(signature.GetSize(), *pcbSNHash); - signature.Copy(pbSNHash, signature.Begin(), *pcbSNHash); - } - else - { - // This assembly is delay signed (in this limited scenario). - // We'll use the assembly MVID as the hash and leave assembly verification - // up to the loader to determine if delay signed assemblies are allowed. - // This allows us to fix the perf degrade observed with the hashing code and - // detailed in BUG 126760. - - // <TODO>@TODO:workaround: This is a workaround because Fusion is expecting at least 20 bytes of data.</TODO> - if (max(sizeof(GUID), 20) <= *pcbSNHash) - { - memset(pbSNHash, 0, *pcbSNHash); - hr = pMDImport->GetScopeProps(NULL, 0, NULL, (GUID *) pbSNHash); - } - else - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - - *pcbSNHash = max(sizeof(GUID), 20); - } - } - else - { - hr = CORSEC_E_MISSING_STRONGNAME; - } - } - EX_CATCH_HRESULT(hr); - END_SO_INTOLERANT_CODE; - - return hr; -} - -#endif // FEATURE_FUSION #if defined(FEATURE_MIXEDMODE) && !defined(CROSSGEN_COMPILE) @@ -1179,45 +877,6 @@ void PEImage::UnloadIJWModule(void *pBase) #endif // FEATURE_MIXEDMODE && !CROSSGEN_COMPILE -#ifdef FEATURE_FUSION -void PEImage::Init(IStream* pIStream, UINT64 uAsmStreamId, - DWORD dwModuleId, BOOL resourceFile) -{ - CONTRACT_VOID - { - CONSTRUCTOR_CHECK; - PRECONDITION(CheckStartup()); - STANDARD_VM_CHECK; - } - CONTRACT_END; - - m_StreamAsmId = uAsmStreamId; - m_dwStreamModuleId = dwModuleId; - m_fIsIStream = TRUE; - - LOG((LF_LOADER, LL_INFO100, "PEImage: Opening flat stream\n")); - - if (!pIStream) - ThrowHR(COR_E_FILELOAD); - - // Just copy bytes. - - PEImageLayoutHolder pFlatLayout(PEImageLayout::CreateFromStream(pIStream, this)); - - if (!resourceFile) { - if (!pFlatLayout->CheckCORFormat()) - ThrowFormat(COR_E_BADIMAGEFORMAT); - - if (!CheckLayoutFormat(pFlatLayout)) - ThrowHR(COR_E_NOTSUPPORTED); - } - - pFlatLayout.SuppressRelease(); - SetLayout(IMAGE_FLAT, pFlatLayout); - - RETURN; -} -#endif // FEATURE_FUSION #endif // #ifndef DACCESS_COMPILE @@ -1335,19 +994,11 @@ PEImage::PEImage(): #endif // METADATATRACKER_DATA m_pMDImport(NULL), m_pNativeMDImport(NULL), -#ifdef FEATURE_FUSION - m_StreamAsmId(0), - m_dwStreamModuleId(0), - m_fIsIStream(FALSE), -#endif m_hFile(INVALID_HANDLE_VALUE), m_bOwnHandle(true), m_bSignatureInfoCached(FALSE), m_hrSignatureInfoStatus(E_UNEXPECTED), m_dwSignatureInfo(0), -#ifdef FEATURE_FUSION - m_pILFingerprint(NULL), -#endif //FEATURE_FUSION m_dwPEKind(0), m_dwMachine(0), m_fCachedKindAndMachine(FALSE) @@ -1481,9 +1132,6 @@ PTR_PEImageLayout PEImage::GetLayoutInternal(DWORD imageLayoutMask,DWORD flags) else if (imageLayoutMask&PEImageLayout::LAYOUT_FLAT) { -#ifdef FEATURE_FUSION - _ASSERTE(!m_fIsIStream); //images created from streams should always have this one -#endif pRetVal=PEImageLayout::LoadFlat(GetFileHandle(),this); m_pLayouts[IMAGE_FLAT]=pRetVal; } @@ -1684,38 +1332,6 @@ LPCWSTR PEImage::GetPathForErrorMessages() return m_path; } -#ifdef FEATURE_FUSION -PEKIND PEImage::GetFusionProcessorArchitecture() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - DWORD dwPEKind, dwMachine; - GetPEKindAndMachine(&dwPEKind, &dwMachine); - - DWORD dwAssemblyFlags = 0; - - IfFailThrow(m_pMDImport->GetAssemblyProps(TokenFromRid(1, mdtAssembly), - NULL, NULL, NULL, - NULL, NULL, &dwAssemblyFlags)); - - PEKIND retval; - if (FAILED(TranslatePEToArchitectureType( - (CorPEKind)dwPEKind, - dwMachine, - dwAssemblyFlags, - &retval))) - { - return peInvalid; - } - return retval; -} -#endif //FEATURE_FUSION HANDLE PEImage::GetFileHandle() { @@ -1857,67 +1473,6 @@ BOOL PEImage::IsPtrInImage(PTR_CVOID data) return FALSE; } -#ifdef FEATURE_FUSION -#ifndef DACCESS_COMPILE -HRESULT PEImage::GetILFingerprint(IILFingerprint **ppFingerprint) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - } - CONTRACTL_END; - *ppFingerprint = NULL; - if (m_pILFingerprint == NULL) - { - HRESULT hr = S_OK; - NewHolder<PEFingerprint> pNewFingerprint; - EX_TRY - { - pNewFingerprint = PEFingerprint::CreatePEFingerprint(this); - hr = S_OK; - } - EX_CATCH_HRESULT(hr); - if (FAILED(hr)) - { - return hr; - } - - if (InterlockedCompareExchangeT(&m_pILFingerprint, (PEFingerprint*)(pNewFingerprint.GetValue()), NULL) == NULL) - { - pNewFingerprint.SuppressRelease(); // Won the race - } - } - - *ppFingerprint = m_pILFingerprint; - (*ppFingerprint)->AddRef(); - return S_OK; -} - -// NOTE: Performance critical codepaths should cache the result of this function. -HRESULT RuntimeGetILFingerprintForPath(LPCWSTR path, IILFingerprint **ppFingerprint) -{ - CONTRACTL - { - NOTHROW; - GC_TRIGGERS; - } - CONTRACTL_END; - - HRESULT hr; - HCORMODULE hCorModule; - IfFailGo(RuntimeOpenImageInternal(path, &hCorModule, NULL, MDInternalImport_NoCache)); - { - ReleaseHolder<PEImage> peImage((PEImage*)hCorModule); - IfFailGo(peImage->GetILFingerprint(ppFingerprint)); - } - hr = S_OK; - ErrExit: - return hr; -} - -#endif //!DACCESS_COMPILE -#endif //FEATURE_FUSION #if !defined(DACCESS_COMPILE) PEImage * PEImage::OpenImage( @@ -1953,18 +1508,6 @@ PEImage * PEImage::OpenImage( pPEImage = PEImage::LoadImage(hMod); } #endif // !FEATURE_PAL -#ifdef FEATURE_FUSION - else if (iidResource == __uuidof(ICLRPrivResourceStream)) - { - ReleaseHolder<ICLRPrivResourceStream> pIResourceStream; - IfFailThrow(pIResource->QueryInterface(__uuidof(ICLRPrivResourceStream), (LPVOID*)&pIResourceStream)); - ReleaseHolder<IStream> pStream; - IfFailThrow(pIResourceStream->GetStream(__uuidof(IStream), (LPVOID*)&pStream)); - UINT64 i64AssemblyId = static_cast<UINT64>(reinterpret_cast<UINT_PTR>(reinterpret_cast<ICLRPrivAssembly*>(pIResource))); - DWORD dwModuleId = static_cast<DWORD>(i64AssemblyId); - pPEImage = PEImage::OpenImage(pStream, i64AssemblyId, FALSE, dwModuleId, flags); - } -#endif else { ThrowHR(COR_E_BADIMAGEFORMAT); diff --git a/src/vm/peimage.h b/src/vm/peimage.h index 4a153b9304..4acd544155 100644 --- a/src/vm/peimage.h +++ b/src/vm/peimage.h @@ -111,14 +111,6 @@ public: LPCWSTR pPath, MDInternalImportFlags flags = MDInternalImport_Default); -#ifdef FEATURE_FUSION - static PTR_PEImage OpenImage( - IStream *pIStream, - UINT64 uStreamAsmId, - DWORD dwModuleId, - BOOL resourceFile, - MDInternalImportFlags flags = MDInternalImport_Default); -#endif // clones the image with new flags (this is pretty much about cached / noncached difference) void Clone(MDInternalImportFlags flags, PTR_PEImage* ppImage) @@ -286,33 +278,9 @@ private: struct PEImageLocator { -#ifdef FEATURE_FUSION - BOOL m_fIsIStream; - DWORD m_dwStreamModuleId; - UINT64 m_StreamAsmId; -#endif LPCWSTR m_pPath; -#ifdef FEATURE_FUSION - PEImageLocator(LPCWSTR pPath) - : m_fIsIStream(FALSE), m_pPath(pPath) - { - } - - PEImageLocator(UINT64 uStreamAsmId, DWORD dwModuleId) - : m_fIsIStream(TRUE), m_dwStreamModuleId(dwModuleId), m_StreamAsmId(uStreamAsmId) - { - } - - PEImageLocator(PEImage * pImage) - : m_fIsIStream(pImage->m_fIsIStream), - m_dwStreamModuleId(pImage->m_dwStreamModuleId), - m_StreamAsmId(pImage->m_StreamAsmId), - m_pPath(pImage->m_path.GetUnicode()) - { - } -#else // FEATURE_FUSION PEImageLocator(LPCWSTR pPath) : m_pPath(pPath) { @@ -322,7 +290,6 @@ private: : m_pPath(pImage->m_path.GetUnicode()) { } -#endif // FEATURE_FUSION }; static BOOL CompareImage(UPTR image1, UPTR image2); @@ -382,11 +349,6 @@ protected: IMDInternalImport* m_pMDImport; IMDInternalImport* m_pNativeMDImport; -#ifdef FEATURE_FUSION - UINT64 m_StreamAsmId; - DWORD m_dwStreamModuleId; - BOOL m_fIsIStream; -#endif private: @@ -454,16 +416,10 @@ private: BOOL m_fCachedKindAndMachine; -#ifdef FEATURE_FUSION - PEFingerprint *m_pILFingerprint; // has to be the real type (as opposed to an interface) so we can delete it -#endif // FEATURE_FUSION public: void CachePEKindAndMachine(); void GetPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine); -#ifdef FEATURE_FUSION - PEKIND GetFusionProcessorArchitecture(); -#endif }; diff --git a/src/vm/peimage.inl b/src/vm/peimage.inl index 6a0b3a07fb..954d8872f6 100644 --- a/src/vm/peimage.inl +++ b/src/vm/peimage.inl @@ -615,49 +615,6 @@ inline BOOL PEImage::IsFileLocked() #ifndef DACCESS_COMPILE -#ifdef FEATURE_FUSION -/* static */ -inline PTR_PEImage PEImage::FindById(UINT64 uStreamAsmId, DWORD dwModuleId) -{ - PEImageLocator locator(uStreamAsmId, dwModuleId); - CrstHolder holder(&s_hashLock); - PEImage* found = (PEImage *) s_Images->LookupValue(HashStreamIds(uStreamAsmId, dwModuleId), &locator); - if (found == (PEImage*) INVALIDENTRY) - return NULL; - found->AddRef(); - return dac_cast<PTR_PEImage>(found); -} - -/* static */ -inline PTR_PEImage PEImage::OpenImage(IStream *pIStream, UINT64 uStreamAsmId, - DWORD dwModuleId, BOOL resourceFile, MDInternalImportFlags flags /* = MDInternalImport_Default */) -{ - BOOL fUseCache = !((flags & MDInternalImport_NoCache) == MDInternalImport_NoCache); - - if (!fUseCache) - { - PEImageHolder pImage(new PEImage()); - pImage->Init(pIStream, uStreamAsmId, dwModuleId, resourceFile); - return dac_cast<PTR_PEImage>(pImage.Extract()); - } - - - DWORD hash = HashStreamIds(uStreamAsmId, dwModuleId); - PEImageLocator locator(uStreamAsmId,dwModuleId); - CrstHolder holder(&s_hashLock); - PEImage* found = (PEImage *) s_Images->LookupValue(hash, &locator); - if (found != (PEImage*) INVALIDENTRY) - { - found->AddRef(); - return dac_cast<PTR_PEImage>(found); - } - PEImageHolder pImage(new PEImage()); - pImage->Init(pIStream, uStreamAsmId, dwModuleId, resourceFile); - - pImage->AddToHashMap(); - return dac_cast<PTR_PEImage>(pImage.Extract()); -} -#endif // FEATURE_FUSION inline void PEImage::AddToHashMap() { @@ -695,10 +652,6 @@ inline BOOL PEImage::HasID() { LIMITED_METHOD_CONTRACT; -#ifdef FEATURE_FUSION - if (m_fIsIStream) - return TRUE; -#endif return !GetPath().IsEmpty(); } @@ -714,10 +667,6 @@ inline ULONG PEImage::GetIDHash() } CONTRACT_END; -#ifdef FEATURE_FUSION - if (m_fIsIStream) - RETURN HashStreamIds(m_StreamAsmId, m_dwStreamModuleId); -#endif #ifdef FEATURE_CASE_SENSITIVE_FILESYSTEM RETURN m_path.Hash(); diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp index a84136a5bc..9e258f4e8a 100644 --- a/src/vm/peimagelayout.cpp +++ b/src/vm/peimagelayout.cpp @@ -17,13 +17,6 @@ PEImageLayout* PEImageLayout::CreateFlat(const void *flat, COUNT_T size,PEImage* return new RawImageLayout(flat,size,pOwner); } -#ifdef FEATURE_FUSION -PEImageLayout* PEImageLayout::CreateFromStream(IStream* pIStream,PEImage* pOwner) -{ - STANDARD_VM_CONTRACT; - return new StreamImageLayout(pIStream,pOwner); -} -#endif PEImageLayout* PEImageLayout::CreateFromHMODULE(HMODULE hModule,PEImage* pOwner, BOOL bTakeOwnership) { @@ -607,51 +600,6 @@ FlatImageLayout::FlatImageLayout(HANDLE hFile, PEImage* pOwner) Init(m_FileView, size); } -#ifdef FEATURE_FUSION -StreamImageLayout::StreamImageLayout(IStream* pIStream,PEImage* pOwner) -{ - CONTRACTL - { - CONSTRUCTOR_CHECK; - STANDARD_VM_CHECK; - } - CONTRACTL_END; - - m_Layout=LAYOUT_FLAT; - m_pOwner=pOwner; - - PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it. - - - STATSTG statStg; - IfFailThrow(pIStream->Stat(&statStg, STATFLAG_NONAME)); - if (statStg.cbSize.u.HighPart > 0) - ThrowHR(COR_E_FILELOAD); - - DWORD cbRead = 0; - - // Resources files may have zero length (and would be mapped as FLAT) - if (statStg.cbSize.u.LowPart) { - m_FileMap.Assign(WszCreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, - statStg.cbSize.u.LowPart, NULL)); - if (m_FileMap == NULL) - ThrowWin32(GetLastError()); - - m_FileView.Assign(CLRMapViewOfFile(m_FileMap, FILE_MAP_ALL_ACCESS, 0, 0, 0)); - - if (m_FileView == NULL) - ThrowWin32(GetLastError()); - - HRESULT hr = pIStream->Read(m_FileView, statStg.cbSize.u.LowPart, &cbRead); - if (hr == S_FALSE) - hr = COR_E_FILELOAD; - - IfFailThrow(hr); - } - TESTHOOKCALL(ImageMapped(GetPath(),m_FileView,IM_FLAT)); - Init(m_FileView,(COUNT_T)cbRead); -} -#endif // FEATURE_FUSION #endif // !DACESS_COMPILE diff --git a/src/vm/peimagelayout.h b/src/vm/peimagelayout.h index 68d6315be4..d3949edc7a 100644 --- a/src/vm/peimagelayout.h +++ b/src/vm/peimagelayout.h @@ -176,20 +176,6 @@ public: }; -#ifdef FEATURE_FUSION -class StreamImageLayout: public PEImageLayout -{ - VPTR_VTABLE_CLASS(StreamImageLayout,PEImageLayout) - VPTR_UNIQUE(0x71) -protected: - HandleHolder m_FileMap; - CLRMapViewHolder m_FileView; -public: -#ifndef DACCESS_COMPILE - StreamImageLayout(IStream* pIStream,PEImage* pOwner); -#endif -}; -#endif // FEATURE_FUSION #endif // PEIMAGELAYOUT_H_ diff --git a/src/vm/securityattributes.cpp b/src/vm/securityattributes.cpp index 1f8e3e1d4d..798d8099a5 100644 --- a/src/vm/securityattributes.cpp +++ b/src/vm/securityattributes.cpp @@ -786,110 +786,12 @@ HRESULT GetFullyQualifiedTypeName(SString* pString, mdAssemblyRef tkAssemblyRef, (*pString) += W(", "); DWORD dwDisplayFlags = ASM_DISPLAYF_VERSION | ASM_DISPLAYF_PUBLIC_KEY_TOKEN | ASM_DISPLAYF_CULTURE; -#ifdef FEATURE_FUSION // why is Security accessing Fusion interfaces bypassing Loader? - // Retrieve size of assembly name - ASSEMBLYMETADATA sContext; - ZeroMemory(&sContext, sizeof(ASSEMBLYMETADATA)); - HRESULT hr = S_OK; - LPWSTR wszAssemblyName = NULL; - BYTE *pbPublicKeyOrToken = NULL; - DWORD cbPublicKeyOrToken = 0; - DWORD dwFlags = 0; - if(TypeFromToken(tkAssemblyRef) == mdtAssembly) - { - DWORD cchName; - hr = pImport->GetAssemblyProps(tkAssemblyRef, // [IN] The Assembly for which to get the properties. - NULL, // [OUT] Pointer to the public key or token. - NULL, // [OUT] Count of bytes in the public key or token. - NULL, // [OUT] Hash Algorithm - NULL, // [OUT] Buffer to fill with name. - NULL, // [IN] Size of buffer in wide chars. - &cchName, // [OUT] Actual # of wide chars in name. - &sContext, // [OUT] Assembly MetaData. - NULL); // [OUT] Flags. - if(FAILED(hr)) - return hr; - - // Get the assembly name other naming properties - wszAssemblyName = (LPWSTR)_alloca(cchName * sizeof(WCHAR)); - hr = pImport->GetAssemblyProps(tkAssemblyRef, - (const void **)&pbPublicKeyOrToken, - &cbPublicKeyOrToken, - NULL, - wszAssemblyName, - cchName, - &cchName, - &sContext, - &dwFlags); - if(FAILED(hr)) - return hr; - } - else if(TypeFromToken(tkAssemblyRef) == mdtAssemblyRef) - { - DWORD cchName; - hr = pImport->GetAssemblyRefProps(tkAssemblyRef, // [IN] The AssemblyRef for which to get the properties. - NULL, // [OUT] Pointer to the public key or token. - NULL, // [OUT] Count of bytes in the public key or token. - NULL, // [OUT] Buffer to fill with name. - NULL, // [IN] Size of buffer in wide chars. - &cchName, // [OUT] Actual # of wide chars in name. - &sContext, // [OUT] Assembly MetaData. - NULL, // [OUT] Hash blob. - NULL, // [OUT] Count of bytes in the hash blob. - NULL); // [OUT] Flags. - if(FAILED(hr)) - return hr; - - // Get the assembly name other naming properties - wszAssemblyName = (LPWSTR)_alloca(cchName * sizeof(WCHAR)); - hr = pImport->GetAssemblyRefProps(tkAssemblyRef, - (const void **)&pbPublicKeyOrToken, - &cbPublicKeyOrToken, - wszAssemblyName, - cchName, - &cchName, - &sContext, - NULL, - NULL, - &dwFlags); - if(FAILED(hr)) - return hr; - } - else - { - _ASSERTE(false && "unexpected token"); - } - - // Convert to an AssemblyNameObject - ReleaseHolder<IAssemblyName> pAssemblyNameObj; - hr = CreateAssemblyNameObject(&pAssemblyNameObj, wszAssemblyName, CANOF_PARSE_DISPLAY_NAME, NULL); - if(FAILED(hr)) - return hr; - _ASSERTE(pAssemblyNameObj && "assembly name object shouldn't be NULL"); - pAssemblyNameObj->SetProperty(ASM_NAME_MAJOR_VERSION, &sContext.usMajorVersion, sizeof(WORD)); - pAssemblyNameObj->SetProperty(ASM_NAME_MINOR_VERSION, &sContext.usMinorVersion, sizeof(WORD)); - pAssemblyNameObj->SetProperty(ASM_NAME_BUILD_NUMBER, &sContext.usBuildNumber, sizeof(WORD)); - pAssemblyNameObj->SetProperty(ASM_NAME_REVISION_NUMBER, &sContext.usRevisionNumber, sizeof(WORD)); - pAssemblyNameObj->SetProperty(ASM_NAME_CULTURE, W(""), sizeof(WCHAR)); - if(pbPublicKeyOrToken && cbPublicKeyOrToken > 0) - { - if(dwFlags & afPublicKey) - pAssemblyNameObj->SetProperty(ASM_NAME_PUBLIC_KEY, pbPublicKeyOrToken, cbPublicKeyOrToken); - else - pAssemblyNameObj->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, pbPublicKeyOrToken, cbPublicKeyOrToken); - } - - // Convert assembly name to an ole string - StackSString name; - FusionBind::GetAssemblyNameDisplayName(pAssemblyNameObj, name, dwDisplayFlags); -#else // FEATURE_FUSION HRESULT hr; AssemblySpec spec; StackSString name; IfFailRet(spec.Init((mdToken)tkAssemblyRef,pImport)); spec.GetFileOrDisplayName(dwDisplayFlags,name); -#endif // FEATURE_FUSION _ASSERTE(!name.IsEmpty() && "the assembly name should not be empty here"); (*pString) += name; diff --git a/src/vm/securitypolicy.cpp b/src/vm/securitypolicy.cpp index 8a2423bb06..e9eb4e3aed 100644 --- a/src/vm/securitypolicy.cpp +++ b/src/vm/securitypolicy.cpp @@ -397,34 +397,6 @@ FCIMPL0(void, SecurityPolicy::DecrementAssertCount) FCIMPLEND -#ifdef FEATURE_FUSION -static void GetFusionNameFromAssemblyQualifiedTypeName(LPCWSTR pAssemblyQualifedTypeName, IAssemblyName ** ppFusionName) -{ - STANDARD_VM_CONTRACT; - - StackSString ssAssemblyQualifedTypeName(pAssemblyQualifedTypeName); - StackSString ssAssemblyName; - - SString::Iterator iter = ssAssemblyQualifedTypeName.Begin(); - - if (ssAssemblyQualifedTypeName.Find( iter, ',' )) - { - iter++; - while (*iter == ' ' ) - iter++; - - ssAssemblyName.Set( ssAssemblyQualifedTypeName, - iter, - ssAssemblyQualifedTypeName.End() ); -} - - StackScratchBuffer sBuffer; - AssemblySpec spec; - spec.Init(ssAssemblyName.GetANSI(sBuffer)); - - IfFailThrow(spec.CreateFusionName(ppFusionName)); -} -#endif // FEATURE_FUSION BOOL QCALLTYPE SecurityPolicy::IsSameType(LPCWSTR pLeft, LPCWSTR pRight) { @@ -436,36 +408,7 @@ BOOL QCALLTYPE SecurityPolicy::IsSameType(LPCWSTR pLeft, LPCWSTR pRight) // @telesto: Is this #ifdef-#else-#endif required anymore? Used to be needed when security was bypassing // loader and accessing Fusion interfaces. Seems like that's been fixed to use GetFusionNameFrom... -#ifdef FEATURE_FUSION - - AppDomain* pDomain = GetAppDomain(); - IApplicationContext* pAppCtx = pDomain->GetFusionContext(); - - _ASSERTE( pAppCtx != NULL && "Fusion context not setup yet" ); - - SafeComHolderPreemp<IAssemblyName> pAssemblyNameLeft; - SafeComHolderPreemp<IAssemblyName> pAssemblyNameRight; - - GetFusionNameFromAssemblyQualifiedTypeName(pLeft, &pAssemblyNameLeft); - GetFusionNameFromAssemblyQualifiedTypeName(pRight, &pAssemblyNameRight); - - SafeComHolderPreemp<IAssemblyName> pAssemblyNamePostPolicyLeft; - SafeComHolderPreemp<IAssemblyName> pAssemblyNamePostPolicyRight; - - if (FAILED(PreBindAssembly(pAppCtx, pAssemblyNameLeft, NULL, &pAssemblyNamePostPolicyLeft, NULL)) || - FAILED(PreBindAssembly(pAppCtx, pAssemblyNameRight, NULL, &pAssemblyNamePostPolicyRight, NULL))) - { - // version-agnostic comparison. - bEqual = pAssemblyNameLeft->IsEqual(pAssemblyNameRight, ASM_CMPF_NAME | ASM_CMPF_PUBLIC_KEY_TOKEN | ASM_CMPF_CULTURE) == S_OK; - } - else - { - // version-agnostic comparison. - bEqual = pAssemblyNamePostPolicyLeft->IsEqual(pAssemblyNamePostPolicyRight, ASM_CMPF_NAME | ASM_CMPF_PUBLIC_KEY_TOKEN | ASM_CMPF_CULTURE) == S_OK; - } -#else // FEATURE_FUSION bEqual=TRUE; -#endif // FEATURE_FUSION END_QCALL; diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index b58cc04631..791a09fc42 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -37,9 +37,6 @@ #include "finalizerthread.h" #include "threadsuspend.h" -#ifdef FEATURE_FUSION -#include "fusion.h" -#endif #include "wrappers.h" #include "nativeoverlapped.h" diff --git a/src/vm/typeparse.cpp b/src/vm/typeparse.cpp index 2cd3b19873..68ff76273d 100644 --- a/src/vm/typeparse.cpp +++ b/src/vm/typeparse.cpp @@ -1570,15 +1570,6 @@ TypeHandle TypeName::GetTypeFromAsm(BOOL bForIntrospection) _ASSERTE(!"You must pass either a asm-qualified typename or an actual Assembly."); } -#ifdef FEATURE_FUSION - if (th.IsNull() && bLoadTypeFromPartialNameHack && GetAssembly() && !GetAssembly()->IsEmpty()) - { - DomainAssembly* pPartialBindAssemblyHack = LoadAssemblyFromPartialNameHack(GetAssembly()); - - if (pPartialBindAssemblyHack) - th = GetTypeHaveAssembly(pPartialBindAssemblyHack->GetAssembly(), bThrowIfNotFound, bIgnoreCase, NULL); - } -#endif // FEATURE_FUSION if (!th.IsNull() && (!m_genericArguments.IsEmpty() || !m_signature.IsEmpty())) { @@ -1819,46 +1810,6 @@ TypeName::GetTypeHaveAssemblyHelper( return th; } // TypeName::GetTypeHaveAssemblyHelper -#ifdef FEATURE_FUSION -DomainAssembly* LoadAssemblyFromPartialNameHack(SString* psszAssemblySpec, BOOL fCropPublicKey) -{ - CONTRACTL - { - MODE_COOPERATIVE; - THROWS; - GC_TRIGGERS; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - MethodDescCallSite loadWithPartialNameHack(METHOD__ASSEMBLY__LOAD_WITH_PARTIAL_NAME_HACK); - ARG_SLOT args[2]; - STRINGREF mszAssembly = NULL; - DomainAssembly* pPartialBindAssemblyHack = NULL; - GCPROTECT_BEGIN(mszAssembly); - { - mszAssembly = StringObject::NewString(psszAssemblySpec->GetUnicode()); - args[0] = ObjToArgSlot(mszAssembly); - args[1] = BoolToArgSlot(fCropPublicKey); - - ASSEMBLYREF assembly = (ASSEMBLYREF)loadWithPartialNameHack.Call_RetOBJECTREF(args); - - if (assembly != NULL) - { - pPartialBindAssemblyHack = (DomainAssembly*) assembly->GetDomainAssembly(); - - if (pPartialBindAssemblyHack->GetAssembly()->IsCollectible()) - { - // Should not be possible to reach - COMPlusThrow(kNotSupportedException, W("NotSupported_CollectibleAssemblyResolve")); - } - } - } - GCPROTECT_END(); - - return pPartialBindAssemblyHack; -} -#endif // FEATURE_FUSION DomainAssembly * LoadDomainAssembly( SString * psszAssemblySpec, diff --git a/src/vm/typeparse.h b/src/vm/typeparse.h index 00a3349ce2..bf5b010a62 100644 --- a/src/vm/typeparse.h +++ b/src/vm/typeparse.h @@ -44,9 +44,6 @@ bool inline IsTypeNameReservedChar(WCHAR ch) } } -#ifdef FEATURE_FUSION -DomainAssembly* LoadAssemblyFromPartialNameHack(SString* psszAssemblySpec, BOOL fCropPublicKey = FALSE); -#endif // FEATURE_FUSION DomainAssembly * LoadDomainAssembly( SString * psszAssemblySpec, diff --git a/src/zap/common.h b/src/zap/common.h index 777c4e9b94..0abb2ce751 100644 --- a/src/zap/common.h +++ b/src/zap/common.h @@ -32,9 +32,6 @@ #include "jithost.h" #include "corcompile.h" #include "iceefilegen.h" -#ifdef FEATURE_FUSION -#include "fusionbind.h" -#endif #include "corpriv.h" #include "holder.h" diff --git a/src/zap/svcworker.cpp b/src/zap/svcworker.cpp index e5ddcf9f08..eb7d8d92ac 100644 --- a/src/zap/svcworker.cpp +++ b/src/zap/svcworker.cpp @@ -25,9 +25,6 @@ NGenWorkerEmbedding() -- called when COM invoked the COM server with #include "common.h" -#ifdef FEATURE_FUSION -#include "binderngen.h" -#endif #ifdef FEATURE_APPX #include "AppXUtil.h" diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index 2fbeb03afb..24f081a6f9 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -1076,75 +1076,6 @@ HANDLE ZapImage::GenerateFile(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATU return hFile; } -#ifdef FEATURE_FUSION -#define WOF_PROVIDER_FILE (0x00000002) - -typedef BOOL (WINAPI *WofShouldCompressBinaries_t) ( - __in LPCWSTR Volume, - __out PULONG Algorithm - ); - -typedef HRESULT (WINAPI *WofSetFileDataLocation_t) ( - __in HANDLE hFile, - __in ULONG Provider, - __in PVOID FileInfo, - __in ULONG Length - ); - -typedef struct _WOF_FILE_COMPRESSION_INFO { - ULONG Algorithm; -} WOF_FILE_COMPRESSION_INFO, *PWOF_FILE_COMPRESSION_INFO; - -// Check if files on the volume identified by volumeLetter should be compressed. -// If yes, compress the file associated with hFile. -static void CompressFile(WCHAR volumeLetter, HANDLE hFile) -{ - if (IsNgenOffline()) - { - return; - } - - // Wofutil.dll is available on Windows 8.1 and above. Return on platforms without wofutil.dll. - HModuleHolder wofLibrary(WszLoadLibraryEx(L"wofutil.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32)); - if (wofLibrary == nullptr) - { - return; - } - - // WofShouldCompressBinaries is available on Windows 10 and above. - // Windows 8.1 version of wofutil.dll does not have this function. - WofShouldCompressBinaries_t WofShouldCompressBinaries - = (WofShouldCompressBinaries_t)GetProcAddress(wofLibrary, "WofShouldCompressBinaries"); - if (WofShouldCompressBinaries == nullptr) - { - return; - } - - WCHAR volume[4] = L"X:\\"; - volume[0] = volumeLetter; - ULONG algorithm = 0; - - bool compressionSuitable = (WofShouldCompressBinaries(volume, &algorithm) == TRUE); - if (compressionSuitable) - { - // WofSetFileDataLocation is available on Windows 8.1 and above, however, Windows 8.1 version - // of WofSetFileDataLocation works for WIM only, and Windows 10 is required for compression of - // normal files. This isn't a problem for us, since the check for WofShouldCompressBinaries - // above should have already returned on Windows 8.1. - WofSetFileDataLocation_t WofSetFileDataLocation = - (WofSetFileDataLocation_t)GetProcAddress(wofLibrary, "WofSetFileDataLocation"); - if (WofSetFileDataLocation == nullptr) - { - return; - } - - WOF_FILE_COMPRESSION_INFO fileInfo; - fileInfo.Algorithm = algorithm; - - WofSetFileDataLocation(hFile, WOF_PROVIDER_FILE, &fileInfo, sizeof(WOF_FILE_COMPRESSION_INFO)); - } -} -#endif HANDLE ZapImage::SaveImage(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) { @@ -1173,9 +1104,6 @@ HANDLE ZapImage::SaveImage(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATURE HANDLE hFile = GenerateFile(wszOutputFileName, pNativeImageSig); -#ifdef FEATURE_FUSION - CompressFile(wszOutputFileName[0], hFile); -#endif return hFile; } @@ -1392,28 +1320,6 @@ void ZapImage::Open(CORINFO_MODULE_HANDLE hModule, m_ModuleDecoder = *m_zapper->m_pEECompileInfo->GetModuleDecoder(hModule); -#ifdef FEATURE_FUSION - // If TranslatePEToArchitectureType fails then we have an invalid format - DWORD dwPEKind, dwMachine; - m_ModuleDecoder.GetPEKindAndMachine(&dwPEKind, &dwMachine); - - PEKIND PeKind; - IfFailThrow(TranslatePEToArchitectureType((CorPEKind)dwPEKind, dwMachine, &PeKind)); - - // Valid images for this platform are peMSIL and the native image for the platform - if (!(PeKind == peMSIL -#if defined(_TARGET_AMD64_) - || PeKind == peAMD64 -#elif defined(_TARGET_X86_) - || PeKind == peI386 -#elif defined(_TARGET_ARM_) - || PeKind == peARM -#endif - )) - { - ThrowHR(NGEN_E_EXE_MACHINE_TYPE_MISMATCH); - } -#endif // FEATURE_FUSION // // Get file name, and base address from module diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp index 4f4ba529c2..502e5935f6 100644 --- a/src/zap/zapper.cpp +++ b/src/zap/zapper.cpp @@ -5,9 +5,6 @@ #include "common.h" -#ifdef FEATURE_FUSION -#include "binderngen.h" -#endif #ifndef FEATURE_MERGE_JIT_AND_ENGINE #include "metahost.h" @@ -17,9 +14,6 @@ #include "coregen.h" #include "clr/fs/dir.h" -#ifdef FEATURE_FUSION -#include "ngenparser.inl" -#endif /* --------------------------------------------------------------------------- * * Error Macros @@ -38,9 +32,6 @@ BOOL g_fForceDebug, g_fForceProfile, g_fForceInstrument; #endif -#ifdef FEATURE_FUSION -extern "C" HRESULT STDMETHODCALLTYPE InitializeFusion(); -#endif #pragma warning(push) #pragma warning(disable: 4995) @@ -84,38 +75,6 @@ void Zapper::ReportEventNGEN(WORD wType, DWORD dwEventID, LPCWSTR format, ...) Warning(W("%s\n"), s.GetUnicode()); } -#ifdef FEATURE_FUSION -static HRESULT GetAssemblyName( - ICorCompileInfo * pCCI, - CORINFO_ASSEMBLY_HANDLE hAssembly, - SString & str, - DWORD dwFlags) -{ - DWORD dwSize = 0; - LPWSTR buffer = NULL; - COUNT_T allocation = str.GetUnicodeAllocation(); - if (allocation > 0) - { - // pass in the buffer if we got one - dwSize = allocation + 1; - buffer = str.OpenUnicodeBuffer(allocation); - } - HRESULT hr = pCCI->GetAssemblyName(hAssembly, dwFlags, buffer, &dwSize); - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - { - if (buffer != NULL) - str.CloseBuffer(0); - buffer = str.OpenUnicodeBuffer(dwSize-1); - hr = pCCI->GetAssemblyName(hAssembly, dwFlags, buffer, &dwSize); - } - if (buffer != NULL) - { - str.CloseBuffer((SUCCEEDED(hr) && dwSize >= 1) ? (dwSize-1) : 0); - } - - return hr; -} -#endif // FEATURE_FUSION /* --------------------------------------------------------------------------- * * Private fusion entry points @@ -427,47 +386,6 @@ Zapper::Zapper(NGenOptions *pOptions, bool fromDllHost) zo->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_PROF_ENTERLEAVE); } -#ifdef FEATURE_FUSION - if (pOptions->lpszRepositoryDir != NULL && pOptions->lpszRepositoryDir[0] != '\0') - { - size_t buflen = wcslen(pOptions->lpszRepositoryDir) + 1; - LPWSTR lpszDir = new WCHAR[buflen]; - wcscpy_s(lpszDir, buflen, pOptions->lpszRepositoryDir); - zo->m_repositoryDir = lpszDir; - } - else - { - zo->m_repositoryDir = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_RepositoryDir); - } - - if (pOptions->repositoryFlags != RepositoryDefault) - { - zo->m_repositoryFlags = pOptions->repositoryFlags; - } - else - { - zo->m_repositoryFlags = (RepositoryFlags)REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_RepositoryFlags, RepositoryDefault); - } - - // The default location of the repository is "repository" folder under framework version directory - if (zo->m_repositoryDir == NULL) - { - DWORD lgth = _MAX_PATH + 1; - WCHAR wszRepositoryDir[_MAX_PATH + 1]; - IfFailThrow(GetInternalSystemDirectory(wszRepositoryDir, &lgth)); - - wcscat_s(wszRepositoryDir, COUNTOF(wszRepositoryDir), W("repository")); - - size_t buflen = wcslen(wszRepositoryDir) + 1; - LPWSTR lpszDir = new WCHAR[buflen]; - wcscpy_s(lpszDir, buflen, wszRepositoryDir); - zo->m_repositoryDir = lpszDir; - - // Move the images by default - if (zo->m_repositoryFlags == RepositoryDefault) - zo->m_repositoryFlags = MoveFromRepository; - } -#endif //FEATURE_FUSION if (pOptions->fInstrument) zo->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_BBINSTR); @@ -574,10 +492,6 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions) hr = m_pMetaDataDispenser->SetOption(MetaDataCheckDuplicatesFor, &opt); _ASSERTE(SUCCEEDED(hr)); -#ifdef FEATURE_FUSION - hr = InitializeFusion(); - _ASSERTE(SUCCEEDED(hr)); -#endif #if !defined(FEATURE_MERGE_JIT_AND_ENGINE) m_fDontLoadJit = false; @@ -913,277 +827,6 @@ void Zapper::CleanupAssembly() } } -#ifdef FEATURE_FUSION -HRESULT Zapper::TryEnumerateFusionCache(LPCWSTR name, bool fPrint, bool fDelete) -{ - HRESULT hr = S_OK; - - EX_TRY - { - if (EnumerateFusionCache(name, fPrint, fDelete) == 0) - hr = S_FALSE; - } - EX_CATCH_HRESULT(hr); - - return hr; -} - -#define MAX_ZAP_STRING_SIZE 4 - -int Zapper::EnumerateFusionCache( - LPCWSTR name, - bool fPrint, bool fDelete, - CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) -{ - _ASSERTE(pNativeImageSig == NULL || (*pNativeImageSig) != INVALID_NGEN_SIGNATURE); - - int count = 0; - - NonVMComHolder<IAssemblyName> pName; - - // - // Decide whether the name is a file or assembly name - // - - DWORD attributes = -1; - - if (name != NULL) - attributes = WszGetFileAttributes(name); - - if (attributes == -1) - { - IfFailThrow(CreateAssemblyNameObject(&pName, name, - name == NULL ? 0 : - CANOF_PARSE_DISPLAY_NAME, NULL)); - } - else if (attributes & FILE_ATTRIBUTE_DIRECTORY) - { - ClrDirectoryEnumerator de(name); - - while (de.Next()) - { - StackSString fullName; - fullName.Set(name, W("\\"), de.GetFileName()); - - if (de.GetFileAttributes() & FILE_ATTRIBUTE_DIRECTORY) - { - count += EnumerateFusionCache(fullName, fPrint, fDelete); - } - else - if (IsAssembly(fullName)) - { - if (TryEnumerateFusionCache(fullName, fPrint, fDelete) == S_OK) - count++; - } - } - } - else - { - NonVMComHolder<IMetaDataAssemblyImport> pAssemblyImport; - IfFailThrow(m_pMetaDataDispenser->OpenScope(name, ofRead, - IID_IMetaDataAssemblyImport, - (IUnknown**)&pAssemblyImport)); - - pName = GetAssemblyFusionName(pAssemblyImport); - } - - if (pName != NULL) - { - pName->SetProperty(ASM_NAME_CUSTOM, NULL, 0); - - NonVMComHolder<IAssemblyEnum> pEnum; - HRESULT hr = CreateAssemblyEnum(&pEnum, NULL, pName, ASM_CACHE_ZAP, 0); - IfFailThrow(hr); - - pName.Clear(); - - if (hr == S_OK) - { - // - // Scope the iteration by the zap set - // - - LPCWSTR zapPrefix = m_pOpt->m_zapSet; - size_t zapPrefixSize = (zapPrefix != NULL) ? wcslen(zapPrefix) : 0; - - for (;;) - { - NonVMComHolder<IApplicationContext> pContext; - NonVMComHolder<IAssemblyName> pEntryName; - - if (pEnum->GetNextAssembly(&pContext, &pEntryName, 0) != S_OK) - break; - - // - // Only consider assemblies which have the proper zap string - // prefix. - // - if (zapPrefix != NULL) - { - WCHAR zapString[MAX_ZAP_STRING_SIZE]; - DWORD zapStringSize = sizeof(zapString); - - hr = pEntryName->GetProperty(ASM_NAME_CUSTOM, (void*) zapString, &zapStringSize); - if (hr != S_OK - || wcslen(zapString) < zapPrefixSize - || wcsncmp(zapString, zapPrefix, zapPrefixSize) != 0) - { - continue; - } - } - - count++; - - if (pNativeImageSig) - { - // If we are looking for a specific native image, - // check that the signatures match. - - CORCOMPILE_NGEN_SIGNATURE sign; - DWORD cbSign = sizeof(sign); - - IfFailThrow(pEntryName->GetProperty(ASM_NAME_MVID, &sign, &cbSign)); - _ASSERTE(cbSign == sizeof(sign)); - - if (cbSign != sizeof(sign) || *pNativeImageSig != sign) - continue; - } - - if (fPrint) - { - PrintFusionCacheEntry(LogLevel_Success, pEntryName); - } - - if (fDelete) - { - DeleteFusionCacheEntry(pEntryName); - } - } - } - - } - - return count; -} - -void Zapper::PrintFusionCacheEntry(CorSvcLogLevel logLevel, IAssemblyName *pName) -{ - StackSString ss; - FusionBind::GetAssemblyNameDisplayName(pName, ss, - ASM_DISPLAYF_VERSION | ASM_DISPLAYF_CULTURE | ASM_DISPLAYF_PUBLIC_KEY_TOKEN); - - GetSvcLogger()->Printf(logLevel, W("%s"), ss.GetUnicode()); - - // Get the custom string - WCHAR zapString[MAX_ZAP_STRING_SIZE]; - DWORD zapStringSize = sizeof(zapString); - - HRESULT hr = pName->GetProperty(ASM_NAME_CUSTOM, (void*) zapString, &zapStringSize); - IfFailThrow(hr); - IfFailThrow((zapStringSize != 0) ? S_OK : E_FAIL); - - // Get the config mask - - DWORD mask = 0; - DWORD maskSize = sizeof(mask); - - hr = pName->GetProperty(ASM_NAME_CONFIG_MASK, (void*) &mask, &maskSize); - IfFailThrow(hr); - - // Pretty-print the custom string and the config mask - - if (hr == S_OK) - { - DWORD maskStringLength; - IfFailThrow(GetNativeImageDescription(zapString, mask, NULL, &maskStringLength)); - - CQuickWSTR buffer; - buffer.ReSizeThrows(maskStringLength * sizeof(WCHAR)); - IfFailThrow(GetNativeImageDescription(zapString, mask, buffer.Ptr(), &maskStringLength)); - - GetSvcLogger()->Printf(logLevel, W("%s"), buffer.Ptr()); - } - - GetSvcLogger()->Printf(logLevel, W("\n")); - - StackSString s; - PrintAssemblyVersionInfo(pName, s); - - GetSvcLogger()->Log(s.GetUnicode(), LogLevel_Info); -} - -void Zapper::DeleteFusionCacheEntry(IAssemblyName *pName) -{ - IfFailThrow(UninstallNativeAssembly(pName, GetSvcLogger()->GetSvcLogger())); -} - -void Zapper::DeleteFusionCacheEntry(LPCWSTR assemblyName, CORCOMPILE_NGEN_SIGNATURE *pNativeImageSig) -{ - _ASSERTE(assemblyName != NULL && pNativeImageSig != NULL); - _ASSERTE(*pNativeImageSig != INVALID_NGEN_SIGNATURE); - // assemblyName must be a display name, not a file name. - _ASSERTE(WszGetFileAttributes(assemblyName) == INVALID_FILE_ATTRIBUTES); - - NonVMComHolder<IAssemblyName> pEntryName; - IfFailThrow(CreateAssemblyNameObject(&pEntryName, assemblyName, CANOF_PARSE_DISPLAY_NAME, NULL)); - - // Native Binder requires ASM_NAME_CUSTOM (zapset) not to be NULL while deleting a native image. - LPCWSTR zapSet = m_pOpt->m_zapSet != NULL ? m_pOpt->m_zapSet : W(""); - pEntryName->SetProperty(ASM_NAME_CUSTOM, zapSet, DWORD(sizeof(WCHAR) * (wcslen(zapSet) + 1))); - - pEntryName->SetProperty(ASM_NAME_MVID, pNativeImageSig, sizeof(*pNativeImageSig)); - - DeleteFusionCacheEntry(pEntryName); -} - -// @TODO: Use the default flags like CORCOMPILE_CONFIG_DEBUG_DEFAULT - -__success(SUCCEEDED(return)) -STDAPI GetNativeImageDescription(__in_z LPCWSTR customString, - DWORD dwConfigMask, - __inout_ecount(*pdwLength) LPWSTR pwzString, - LPDWORD pdwLength) -{ - _ASSERTE(pdwLength); - //_ASSERTE(pwzString == NULL || (pwzString[(*pdwLength) - 1], true)); - - #define ZAP_STRING_DEBUG W("<debug>") - #define ZAP_STRING_PROFILING W("<profiling>") - #define ZAP_STRING_INSTRUMENTED W("<instrumented>") - - StackSString ssBuff; - - if (customString[0] != W('\0')) - { - ssBuff.Append(W(" (set ")); - ssBuff.Append(customString); - ssBuff.Append(W(')')); - } - - if (dwConfigMask & CORCOMPILE_CONFIG_DEBUG) - ssBuff.Append(W(" ") ZAP_STRING_DEBUG); - - if (dwConfigMask & CORCOMPILE_CONFIG_PROFILING) - ssBuff.Append(W(" ") ZAP_STRING_PROFILING); - - if (dwConfigMask & CORCOMPILE_CONFIG_INSTRUMENTATION) - ssBuff.Append(W(" ") ZAP_STRING_INSTRUMENTED); - - DWORD length = (DWORD) ssBuff.GetCount() + 1; // +1 for the null terminating character - DWORD inputLength = *pdwLength; - - *pdwLength = length; - if (pwzString) - { - wcsncpy_s(pwzString, inputLength, ssBuff.GetUnicode(), _TRUNCATE); - - if (length > inputLength) - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - } - - return S_OK; -} -#endif // FEATURE_FUSION //********************************************************************** // Copy of vm\i386\cgenCpu.h @@ -1214,529 +857,6 @@ BOOL Runtime_Test_For_SSE2(); #endif -#ifdef FEATURE_FUSION -void Zapper::PrintDependencies( - IMetaDataAssemblyImport * pAssemblyImport, - CORCOMPILE_DEPENDENCY * pDependencies, - COUNT_T cDependencies, - SString &s) -{ - if (cDependencies == 0) - { - s.AppendPrintf("\tNo dependencies\n"); - return; - } - - s.AppendASCII("\tDependencies:\n"); - - CORCOMPILE_DEPENDENCY *pDepsEnd = pDependencies + cDependencies; - for(CORCOMPILE_DEPENDENCY *pDeps = pDependencies; pDeps < pDepsEnd; pDeps++) - { - mdAssemblyRef assem = pDeps->dwAssemblyDef; - if (assem == mdAssemblyRefNil) - assem = pDeps->dwAssemblyRef; - - NonVMComHolder<IAssemblyName> pNameHolder = - GetAssemblyRefFusionName(pAssemblyImport, assem); - - StackSString ss; - FusionBind::GetAssemblyNameDisplayName(pNameHolder, ss, ASM_DISPLAYF_FULL); - - s.AppendPrintf(W("\t\t%s:\n"), ss.GetUnicode()); - - if (pDeps->dwAssemblyDef == mdAssemblyRefNil) - { - s.AppendASCII("\t\t\t** Missing dependency assembly **\n"); - continue; - } - - // - // Dependency MVID/HASH - // - - WCHAR szGuid[64]; - GuidToLPWSTR(pDeps->signAssemblyDef.mvid, szGuid, NumItems(szGuid)); - s.AppendPrintf(W("\t\t\tGuid:%s\n"), szGuid); - - if (pDeps->dwAssemblyRef != pDeps->dwAssemblyDef) - { - // If there is a redirect, display the original dependency version - - NonVMComHolder<IAssemblyName> pOrigName = - GetAssemblyRefFusionName(pAssemblyImport, pDeps->dwAssemblyRef); - - StackSString ss; - FusionBind::GetAssemblyNameDisplayName(pOrigName, ss, ASM_DISPLAYF_VERSION); - - s.AppendPrintf(W("\t\t\tOriginal Ref: %s\n"), ss.GetUnicode()); - } - - if (pDeps->signNativeImage != INVALID_NGEN_SIGNATURE) - { - GuidToLPWSTR(pDeps->signNativeImage, szGuid, NumItems(szGuid)); - s.AppendPrintf(W("\t\t\tHardbound Guid:%s\n"), szGuid); - } - } - - s.AppendASCII("\n"); -} - - -BOOL Zapper::VerifyDependencies( - IMDInternalImport * pAssemblyImport, - CORCOMPILE_DEPENDENCY * pDependencies, - COUNT_T cDependencies) -{ - CORCOMPILE_DEPENDENCY *pDepsEnd = pDependencies + cDependencies; - for(CORCOMPILE_DEPENDENCY *pDeps = pDependencies; pDeps < pDepsEnd; pDeps++) - { - mdAssemblyRef assem = pDeps->dwAssemblyDef; - - // TODO: Better support for images with unresolved dependencies? - if (assem == mdAssemblyRefNil) - continue; - - CORINFO_ASSEMBLY_HANDLE hAssemblyRef; - if (m_pEECompileInfo->LoadAssemblyRef(pAssemblyImport, assem, &hAssemblyRef) != S_OK) - return FALSE; - - CORCOMPILE_VERSION_INFO sourceVersionInfo; - IfFailThrow(m_pEECompileInfo->GetAssemblyVersionInfo(hAssemblyRef, - &sourceVersionInfo)); - - // check the soft bound dependency - CORCOMPILE_ASSEMBLY_SIGNATURE * pSign1 = &pDeps->signAssemblyDef; - CORCOMPILE_ASSEMBLY_SIGNATURE * pSign2 = &sourceVersionInfo.sourceAssembly; - - if ( (pSign1->mvid != pSign2->mvid) - || (pSign1->timeStamp != pSign2->timeStamp) - || (pSign1->ilImageSize != pSign2->ilImageSize) ) - { - return FALSE; - } - - if (pDeps->signNativeImage != INVALID_NGEN_SIGNATURE) - { - // check the hardbound dependency - CORCOMPILE_NGEN_SIGNATURE nativeImageSig; - - if (!CheckAssemblyUpToDate(hAssemblyRef, &nativeImageSig)) - return FALSE; - - if (pDeps->signNativeImage != nativeImageSig) - return FALSE; - } - } - - return TRUE; -} - -void Zapper::PrintAssemblyVersionInfo(IAssemblyName *pName, SString &s) -{ - // - // Bind zap assembly to a path - // - - WCHAR szGuid[64]; - WCHAR path[MAX_LONGPATH]; - DWORD cPath = MAX_LONGPATH; - - IfFailThrow(QueryNativeAssemblyInfo(pName, path, &cPath)); - - // The LoadLibrary call fails occasionally in the lab due to sharing violation. Retry when needed. - const int SHARING_VIOLATION_RETRY_TIMES = 10; - const DWORD SHARING_VIOLATION_RETRY_WAITING_TIME = 100; - HModuleHolder hMod; - DWORD err; - for (int i = 0; i < SHARING_VIOLATION_RETRY_TIMES; i++) - { - hMod = ::WszLoadLibrary(path); - if (! hMod.IsNull()) - break; - // Save last error before ClrSleepEx overwrites it. - err = GetLastError(); - ClrSleepEx(SHARING_VIOLATION_RETRY_WAITING_TIME, FALSE); - } - if (hMod.IsNull()) - ThrowWin32(err); - - PEDecoder pedecoder(hMod); - - CORCOMPILE_VERSION_INFO *pVersionInfo = pedecoder.GetNativeVersionInfo(); - - COUNT_T cMeta; - const void *pMeta = pedecoder.GetNativeManifestMetadata(&cMeta); - - NonVMComHolder<IMetaDataAssemblyImport> pAssemblyImport; - IfFailThrow(m_pMetaDataDispenser->OpenScopeOnMemory(pMeta, cMeta, ofRead, - IID_IMetaDataAssemblyImport, - (IUnknown**)&pAssemblyImport)); - - NonVMComHolder<IMetaDataImport> pImport; - IfFailThrow(pAssemblyImport->QueryInterface(IID_IMetaDataImport, - (void**)&pImport)); - - // - // Source MVID - // - - GuidToLPWSTR(pVersionInfo->sourceAssembly.mvid, szGuid, NumItems(szGuid)); - s.AppendPrintf(W("\tSource MVID:\t%s\n"), szGuid); - - // - // Signature of generated ngen image - // - - GuidToLPWSTR(pVersionInfo->signature, szGuid, NumItems(szGuid)); - s.AppendPrintf(W("\tNGen GUID sign:\t%s\n"), szGuid); - - - s.AppendASCII("\tOS:\t\t"); - switch (pVersionInfo->wOSPlatformID) - { - case VER_PLATFORM_WIN32_NT: - s.AppendASCII("WinNT"); - break; - default: - s.AppendPrintf("<unknown> (%d)", pVersionInfo->wOSPlatformID); - break; - } - s.AppendASCII("\n"); - - // - // Processor - // - - s.AppendASCII("\tProcessor:\t"); - - CORINFO_CPU cpuInfo = pVersionInfo->cpuInfo; - - switch (pVersionInfo->wMachine) - { - case IMAGE_FILE_MACHINE_I386: - { - s.AppendASCII("x86"); - DWORD cpuType = cpuInfo.dwCPUType; -#ifdef _TARGET_X86_ - - // - // Specific processor ID - // - - switch (CPU_X86_FAMILY(cpuType)) - { - case CPU_X86_486: - s.AppendASCII("(486)"); - break; - - case CPU_X86_PENTIUM: - s.AppendASCII("(Pentium)"); - break; - - case CPU_X86_PENTIUM_PRO: - if(CPU_X86_MODEL(cpuType) == CPU_X86_MODEL_PENTIUM_PRO_BANIAS) - { - s.AppendASCII("(Pentium M)"); - } - else - { - s.AppendASCII("(PentiumPro)"); - } - break; - - case CPU_X86_PENTIUM_4: - s.AppendASCII("(Pentium 4)"); - break; - - default: - s.AppendPrintf("(Family %d, Model %d (%03x))", - CPU_X86_FAMILY(cpuType), CPU_X86_MODEL(cpuType), cpuType); - break; - } - - s.AppendPrintf(" (features: %08x)", cpuInfo.dwFeatures); - - break; - -#endif // _TARGET_X86_ - } - - case IMAGE_FILE_MACHINE_IA64: - s.AppendASCII("ia64"); - break; - - case IMAGE_FILE_MACHINE_AMD64: - s.AppendASCII("amd64"); - break; - - case IMAGE_FILE_MACHINE_ARMNT: - s.AppendASCII("arm"); - break; - } - s.AppendASCII("\n"); - - // - // EE version - // - - s.AppendPrintf("\tRuntime:\t%d.%d.%.d.%d\n", - pVersionInfo->wVersionMajor, pVersionInfo->wVersionMinor, - pVersionInfo->wVersionBuildNumber, pVersionInfo->wVersionPrivateBuildNumber); - - s.AppendPrintf("\tclr.dll:\tTimeStamp=%08X, VirtualSize=%08X\n", - pVersionInfo->runtimeDllInfo[CLR_INFO].timeStamp, - pVersionInfo->runtimeDllInfo[CLR_INFO].virtualSize); - - // - // Flags - // - - s.AppendASCII("\tFlags:\t\t"); - if (pVersionInfo->wBuild == CORCOMPILE_BUILD_CHECKED) - { - s.AppendASCII("<checked> "); - } - - if (pVersionInfo->wCodegenFlags & CORCOMPILE_CODEGEN_PROFILING) - { - s.AppendASCII("<profiling> "); - } - else if ((pVersionInfo->wCodegenFlags & CORCOMPILE_CODEGEN_DEBUGGING)) - { - s.AppendASCII("<debug> "); - } - - if (pVersionInfo->wCodegenFlags & CORCOMPILE_CODEGEN_PROF_INSTRUMENTING) - { - s.AppendASCII("<instrumenting> "); - } - s.AppendASCII("\n"); - - // - // Config - // - - s.AppendASCII("\tScenarios:\t\t"); - - if (pVersionInfo->wConfigFlags & CORCOMPILE_CONFIG_DEBUG_NONE) - { - s.AppendASCII("<no debug info> "); - } - if (pVersionInfo->wConfigFlags & CORCOMPILE_CONFIG_DEBUG) - { - s.AppendASCII("<debugger> "); - } - if (pVersionInfo->wConfigFlags & CORCOMPILE_CONFIG_DEBUG_DEFAULT) - { - s.AppendASCII("<no debugger> "); - } - - if (pVersionInfo->wConfigFlags & CORCOMPILE_CONFIG_PROFILING_NONE) - { - s.AppendASCII("<no profiler> "); - } - if (pVersionInfo->wConfigFlags & CORCOMPILE_CONFIG_PROFILING) - { - s.AppendASCII("<instrumenting profiler> "); - } - - if (pVersionInfo->wConfigFlags & CORCOMPILE_CONFIG_INSTRUMENTATION_NONE) - { - s.AppendASCII("<no instrumentation> "); - } - - if (pVersionInfo->wConfigFlags & CORCOMPILE_CONFIG_INSTRUMENTATION) - { - s.AppendASCII("<block instrumentation> "); - } - - s.AppendASCII("\n"); - - // - // Native image file name - // - - s.AppendPrintf(W("\tFile:\t\t%s\n"), path); - - // - // Dependencies - // - - COUNT_T cDependencies; - CORCOMPILE_DEPENDENCY *pDependencies = pedecoder.GetNativeDependencies(&cDependencies); - - PrintDependencies(pAssemblyImport, pDependencies, cDependencies, s); -} - -IAssemblyName *Zapper::GetAssemblyFusionName(IMetaDataAssemblyImport *pImport) -{ - IAssemblyName *pName; - - mdAssembly a; - IfFailThrow(pImport->GetAssemblyFromScope(&a)); - - ASSEMBLYMETADATA md = {0}; - LPWSTR szName; - ULONG cbName = 0; - const void *pbPublicKeyToken; - ULONG cbPublicKeyToken; - DWORD dwFlags; - - IfFailThrow(pImport->GetAssemblyProps(a, - NULL, NULL, NULL, - NULL, 0, &cbName, - &md, - NULL)); - - szName = (LPWSTR) _alloca(cbName * sizeof(WCHAR)); - md.szLocale = (LPWSTR) _alloca(md.cbLocale * sizeof(WCHAR)); - md.rProcessor = (DWORD *) _alloca(md.ulProcessor * sizeof(DWORD)); - md.rOS = (OSINFO *) _alloca(md.ulOS * sizeof(OSINFO)); - - IfFailThrow(pImport->GetAssemblyProps(a, - &pbPublicKeyToken, &cbPublicKeyToken, NULL, - szName, cbName, &cbName, - &md, - &dwFlags)); - - IfFailThrow(CreateAssemblyNameObject(&pName, szName, 0, NULL)); - - if (md.usMajorVersion != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_MAJOR_VERSION, - &md.usMajorVersion, - sizeof(USHORT))); - if (md.usMinorVersion != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_MINOR_VERSION, - &md.usMinorVersion, - sizeof(USHORT))); - if (md.usBuildNumber != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_BUILD_NUMBER, - &md.usBuildNumber, - sizeof(USHORT))); - if (md.usRevisionNumber != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_REVISION_NUMBER, - &md.usRevisionNumber, - sizeof(USHORT))); - if (md.ulProcessor > 0) - IfFailThrow(pName->SetProperty(ASM_NAME_PROCESSOR_ID_ARRAY, - &md.rProcessor, - md.ulProcessor*sizeof(DWORD))); - if (md.ulOS > 0) - IfFailThrow(pName->SetProperty(ASM_NAME_OSINFO_ARRAY, - &md.rOS, - md.ulOS*sizeof(OSINFO))); - if (md.cbLocale > 0) - IfFailThrow(pName->SetProperty(ASM_NAME_CULTURE, - md.szLocale, - md.cbLocale*sizeof(WCHAR))); - - if (cbPublicKeyToken > 0) - { - if (!StrongNameTokenFromPublicKey((BYTE*)pbPublicKeyToken, cbPublicKeyToken, - (BYTE**)&pbPublicKeyToken, &cbPublicKeyToken)) - IfFailThrow(StrongNameErrorInfo()); - - IfFailThrow(pName->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, - (void*)pbPublicKeyToken, - cbPublicKeyToken)); - - StrongNameFreeBuffer((BYTE*)pbPublicKeyToken); - } - - return pName; -} - -IAssemblyName *Zapper::GetAssemblyRefFusionName(IMetaDataAssemblyImport *pImport, - mdAssemblyRef ar) -{ - IAssemblyName *pName; - - ASSEMBLYMETADATA md = {0}; - LPWSTR szName; - ULONG cbName = 0; - const void *pbPublicKeyOrToken; - ULONG cbPublicKeyOrToken; - DWORD dwFlags; - - IfFailThrow(pImport->GetAssemblyRefProps(ar, - NULL, NULL, - NULL, 0, &cbName, - &md, - NULL, NULL, - NULL)); - - szName = (LPWSTR) _alloca(cbName * sizeof(WCHAR)); - md.szLocale = (LPWSTR) _alloca(md.cbLocale * sizeof(WCHAR)); - md.rProcessor = (DWORD *) _alloca(md.ulProcessor * sizeof(DWORD)); - md.rOS = (OSINFO *) _alloca(md.ulOS * sizeof(OSINFO)); - - IfFailThrow(pImport->GetAssemblyRefProps(ar, - &pbPublicKeyOrToken, &cbPublicKeyOrToken, - szName, cbName, &cbName, - &md, - NULL, NULL, - &dwFlags)); - - IfFailThrow(CreateAssemblyNameObject(&pName, szName, 0, NULL)); - - if (md.usMajorVersion != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_MAJOR_VERSION, - &md.usMajorVersion, - sizeof(USHORT))); - if (md.usMinorVersion != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_MINOR_VERSION, - &md.usMinorVersion, - sizeof(USHORT))); - if (md.usBuildNumber != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_BUILD_NUMBER, - &md.usBuildNumber, - sizeof(USHORT))); - if (md.usRevisionNumber != -1) - IfFailThrow(pName->SetProperty(ASM_NAME_REVISION_NUMBER, - &md.usRevisionNumber, - sizeof(USHORT))); - if (md.ulProcessor > 0) - IfFailThrow(pName->SetProperty(ASM_NAME_PROCESSOR_ID_ARRAY, - &md.rProcessor, - md.ulProcessor*sizeof(DWORD))); - if (md.ulOS > 0) - IfFailThrow(pName->SetProperty(ASM_NAME_OSINFO_ARRAY, - &md.rOS, - md.ulOS*sizeof(OSINFO))); - if (md.cbLocale > 0) - IfFailThrow(pName->SetProperty(ASM_NAME_CULTURE, - md.szLocale, - md.cbLocale*sizeof(WCHAR))); - - if (cbPublicKeyOrToken > 0) - { - if (dwFlags & afPublicKey) - IfFailThrow(pName->SetProperty(ASM_NAME_PUBLIC_KEY, - (void*)pbPublicKeyOrToken, - cbPublicKeyOrToken)); - else - IfFailThrow(pName->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, - (void*)pbPublicKeyOrToken, - cbPublicKeyOrToken)); - } - else - { - IfFailThrow(pName->SetProperty(ASM_NAME_NULL_PUBLIC_KEY_TOKEN, - NULL, 0)); - } - - // See if the assemblyref is retargetable (ie, for a generic assembly). - if (IsAfRetargetable(dwFlags)) - { - BOOL bTrue = TRUE; - IfFailThrow(pName->SetProperty(ASM_NAME_RETARGET, - &bTrue, - sizeof(bTrue))); - } - - return pName; -} -#endif //FEATURE_FUSION BOOL Zapper::IsAssembly(LPCWSTR path) { @@ -2000,64 +1120,6 @@ void Zapper::CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImag m_pEECompileInfo->SetIsGeneratingNgenPDB(TRUE); -#ifdef FEATURE_FUSION - ReleaseHolder<IAssemblyName> pAssemblyName(NULL); - HRESULT hr; - - if (pAssemblyPathOrName == NULL) - { - // No root was found, so we don't have an IL assembly path yet. Get IAssemblyName - // from the aux file next to pNativeImagePath, and load from that IAssemblyName - IfFailThrow(GetAssemblyNameFromNIPath(pNativeImagePath, &pAssemblyName)); - IfFailThrow(m_pEECompileInfo->LoadAssemblyByIAssemblyName(pAssemblyName, &hAssembly)); - } - else - { - DWORD attributes = WszGetFileAttributes(pAssemblyPathOrName); - if (attributes == INVALID_FILE_ATTRIBUTES || - ((attributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) - { - // pAssemblyPathOrName doesn't map to a valid file, so assume it's an - // assembly name that we can parse and generate an IAssemblyName from, and - // then load from the IAssemblyName - - IfFailThrow(m_pEECompileInfo->LoadAssemblyByName(pAssemblyPathOrName, &hAssembly)); - - } - else - { - // pAssemblyPathOrName DOES map to a valid file, so load it directly. - IfFailThrow(m_pEECompileInfo->LoadAssemblyByPath(pAssemblyPathOrName, - // fExplicitBindToNativeImage: On the phone, a path to the NI is specified - // explicitly (even with .ni. in the name). All other callers specify a path to - // the IL, and the NI is inferred, so this is normally FALSE in those other - // cases. - FALSE, - &hAssembly)); - } - } - - // Now is a good time to make sure pNativeImagePath is the same native image - // fusion loaded - { - WCHAR wzZapImagePath[MAX_LONGPATH] = {0}; - DWORD dwZapImagePathLength = MAX_LONGPATH; - - hr = E_FAIL; - if (m_pEECompileInfo->CheckAssemblyZap(hAssembly, wzZapImagePath, &dwZapImagePathLength)) - { - if (_wcsicmp(wzZapImagePath, pNativeImagePath) != 0) - { - GetSvcLogger()->Printf( - W("Unable to load '%s'. Please ensure that it is a native image and is up to date. Perhaps you meant to specify this native image instead: '%s'\n"), - pNativeImagePath, - wzZapImagePath); - - ThrowHR(E_FAIL); - } - } - } -#else // FEATURE_FUSION IfFailThrow(m_pEECompileInfo->LoadAssemblyByPath( pAssemblyPathOrName, @@ -2068,7 +1130,6 @@ void Zapper::CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImag TRUE, &hAssembly)); -#endif // FEATURE_FUSION // Ensure all modules belonging to this assembly get loaded. The CreatePdb() call @@ -2116,272 +1177,8 @@ void Zapper::CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImag void Zapper::ComputeDependencies(LPCWSTR pAssemblyName, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) { -#ifdef FEATURE_FUSION - class Callback : public DomainCallback - { - public: - Callback(Zapper *pZapper, LPCWSTR pAssemblyName, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) - { - this->pZapper = pZapper; - this->pAssemblyName = pAssemblyName; - this->pNativeImageSig = pNativeImageSig; - } - - virtual void doCallback() - { - pZapper->ComputeDependenciesInCurrentDomain(pAssemblyName, pNativeImageSig); - } - - Zapper* pZapper; - LPCWSTR pAssemblyName; - CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig; - }; - - _ASSERTE(m_pDomain); - Callback callback(this, pAssemblyName, pNativeImageSig); - InvokeDomainCallback(&callback); -#endif // FEATURE_FUSION } -#ifdef FEATURE_FUSION - -void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) -{ - // - // Load the assembly. - // - // "string" may be a path or assembly display name. - // To decide, we see if it is the name of a valid file. - // - - CORINFO_ASSEMBLY_HANDLE hAssembly; - HRESULT hr; - - DWORD attributes = WszGetFileAttributes(pAssemblyString); - if (attributes == INVALID_FILE_ATTRIBUTES || ((attributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) - { - IfFailThrow(m_pEECompileInfo->LoadAssemblyByName(pAssemblyString, - &hAssembly)); - } - else - { - - hr = m_pEECompileInfo->LoadAssemblyByPath(pAssemblyString, - FALSE, // fExplicitBindToNativeImage - &hAssembly); - if (hr == CLR_E_BIND_TYPE_NOT_FOUND) - { // This means we are ngen'ing WinMD file which does not have any public WinRT type - therefore cannot be ever used - // Note: It's comming from call to code:GetFirstWinRTTypeDef - - // Let's not create the ngen image - if (pNativeImageSig != NULL) - { - memset(pNativeImageSig, 0, sizeof(*pNativeImageSig)); // Fake NI signature to disable NGen. - } - Warning(W("NGen is not supported for empty WinMD files.\n")); - return; - } - IfFailThrow(hr); - } - - - // - // Check if we have a native image already, and if so get its GUID - // - - WCHAR zapManifestPath[MAX_LONGPATH]; - DWORD cZapManifestPath = MAX_LONGPATH; - if (pNativeImageSig && - m_pEECompileInfo->CheckAssemblyZap(hAssembly, zapManifestPath, &cZapManifestPath)) - { - NonVMComHolder<INativeImageInstallInfo> pNIInstallInfo; - - IfFailThrow(GetAssemblyMDInternalImport( - zapManifestPath, - IID_INativeImageInstallInfo, - (IUnknown **)&pNIInstallInfo)); - - IfFailThrow(pNIInstallInfo->GetSignature(pNativeImageSig)); - } - - // - // Set the display name for the assembly - // - - StackSString ss; - GetAssemblyName(m_pEECompileInfo, hAssembly, ss, ICorCompileInfo::GANF_Default); - - m_assemblyDependencies.SetDisplayName(ss.GetUnicode()); - - ComputeAssemblyDependencies(hAssembly); -} - -void Zapper::ComputeAssemblyDependencies(CORINFO_ASSEMBLY_HANDLE hAssembly) -{ - HRESULT hr = S_OK; - NonVMComHolder<IMDInternalImport> pAssemblyImport = m_pEECompileInfo->GetAssemblyMetaDataImport(hAssembly); - - EX_TRY - { - // - // Enumerate the dependencies - // - - HENUMInternalHolder hEnum(pAssemblyImport); - hEnum.EnumAllInit(mdtAssemblyRef); - - // Need to reinitialize the dependencies list, since we could have been called for other assemblies - // belonging to the same root. Zapper::ComputeAssemblyDependencies is first called for the root - // assembly, then called for each hard dependencies, and called for each soft dependencies unless - // /nodependencies switch is used. - m_assemblyDependencies.Reinitialize(); - - if (!CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NgenAllowMscorlibSoftbind)) - { - // Force all assemblies (other than mscorlib itself) to hardbind to mscorlib. - // This ensures that mscorlib is NGen'ed before all other assemblies. - CORINFO_ASSEMBLY_HANDLE hAssemblyMscorlib = m_pEECompileInfo->GetModuleAssembly(m_pEECompileInfo->GetLoaderModuleForMscorlib()); - if (hAssembly != hAssemblyMscorlib) - { - StackSString ss; - GetAssemblyName(m_pEECompileInfo, hAssemblyMscorlib, ss, ICorCompileInfo::GANF_Default); - - m_assemblyDependencies.Append(ss.GetUnicode(), LoadAlways, NGenDefault); - } - } - - mdAssembly token; - mdMethodDef md; - while (pAssemblyImport->EnumNext(&hEnum, &token)) - { - CORINFO_ASSEMBLY_HANDLE hAssemblyRef; - HRESULT hrLoad = m_pEECompileInfo->LoadAssemblyRef(pAssemblyImport, token, &hAssemblyRef); - if (FAILED(hrLoad)) - { - // Failed to load a dependency. Print a warning and move to the next dependency. - - LPCSTR pszName; - IfFailThrow(pAssemblyImport->GetAssemblyRefProps(token, NULL, NULL, - &pszName, NULL, - NULL, NULL, NULL)); - - StackSString sName(SString::Utf8, pszName); - - StackSString hrMsg; - GetHRMsg(hrLoad, hrMsg); - - Warning(W("Failed to load dependency %s of assembly %s because of the following error : %s\n"), - sName.GetUnicode(), - m_assemblyDependencies.GetDisplayName(), - hrMsg.GetUnicode()); - continue; - } - else if (hrLoad == S_OK) - { - _ASSERTE(hAssemblyRef != NULL); - - StackSString ss; - GetAssemblyName(m_pEECompileInfo, hAssemblyRef, ss, ICorCompileInfo::GANF_Default); - - LoadHintEnum loadHint = LoadDefault; - IfFailThrow(m_pEECompileInfo->GetLoadHint(hAssembly, hAssemblyRef, &loadHint)); - - NGenHintEnum ngenHint = NGenDefault; - // Not supported - //IfFailThrow(m_pEECompileInfo->GetNGenHint(hAssemblyRef, &ngenHint)); - m_assemblyDependencies.Append(ss.GetUnicode(), loadHint, ngenHint); - } - } - -#ifdef FEATURE_COMINTEROP - HENUMInternalHolder hTypeRefEnum(pAssemblyImport); - hTypeRefEnum.EnumAllInit(mdtTypeRef); - - mdTypeRef tkTypeRef; - while(pAssemblyImport->EnumNext(&hTypeRefEnum, &tkTypeRef)) - { - CORINFO_ASSEMBLY_HANDLE hAssemblyRef; - HRESULT hrLoad = m_pEECompileInfo->LoadTypeRefWinRT(pAssemblyImport, tkTypeRef, &hAssemblyRef); - if (FAILED(hrLoad)) - { - // Failed to load a dependency. Print a warning and move to the next dependency. - LPCSTR psznamespace; - LPCSTR pszname; - pAssemblyImport->GetNameOfTypeRef(tkTypeRef, &psznamespace, &pszname); - - StackSString sName(SString::Utf8, pszname); - StackSString sNamespace(SString::Utf8, psznamespace); - StackSString hrMsg; - GetHRMsg(hrLoad, hrMsg); - - Warning(W("Failed to load WinRT type dependency %s.%s of assembly %s because of the following error : %s\n"), - sNamespace.GetUnicode(), - sName.GetUnicode(), - m_assemblyDependencies.GetDisplayName(), - hrMsg.GetUnicode()); - continue; - } - else if (hrLoad == S_OK) - { - _ASSERTE(hAssemblyRef != NULL); - StackSString ss; - - CORINFO_MODULE_HANDLE hModule = m_pEECompileInfo->GetAssemblyModule(hAssemblyRef); - m_pEECompileInfo->GetModuleFileName(hModule, ss); - - LoadHintEnum loadHint = LoadDefault; - IfFailThrow(m_pEECompileInfo->GetLoadHint(hAssembly, hAssemblyRef, &loadHint)); - - NGenHintEnum ngenHint = NGenDefault; - - // Append verifies no duplicates - m_assemblyDependencies.Append(ss.GetUnicode(), loadHint, ngenHint); - } - } -#endif - // - // Get the default NGen setting for the assembly - // - - NGenHintEnum ngenHint = NGenDefault; - // Not supported - // IfFailThrow(m_pEECompileInfo->GetNGenHint(hAssembly, &ngenHint)); - m_assemblyDependencies.SetNGenHint(ngenHint); - } - EX_CATCH - { - hr = GET_EXCEPTION()->GetHR(); - RetailAssertIfExpectedClean(); - } - EX_END_CATCH(SwallowAllExceptions); - - IfFailThrow(hr); - - HangWorker(W("NGenDependencyWorkerHang"), W("NGenDependencyWorkerInsideHang")); -} - -void Zapper::HangWorker(LPCWSTR hangKey, LPCWSTR insideHangKey) -{ - if (REGUTIL::GetConfigDWORD_DontUse_(hangKey, 0) != 1) - { - return; - } - - RegKeyHolder hKey; - if (WszRegCreateKeyEx(HKEY_LOCAL_MACHINE, FRAMEWORK_REGISTRY_KEY_W, 0, - NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS) - { - DWORD dwValue = 1; - WszRegSetValueEx(hKey, insideHangKey, 0, REG_DWORD, - reinterpret_cast<BYTE *>(&dwValue), sizeof(dwValue)); - } - - while (true) - { - ClrSleepEx(1000, FALSE); - } -} -#endif // FEATURE_FUSION // // Compile a module by name @@ -2477,10 +1274,6 @@ void Zapper::CompileInCurrentDomain(__in LPCWSTR string, CORCOMPILE_NGEN_SIGNATU BEGIN_ENTRYPOINT_VOIDRET; -#ifdef FEATURE_FUSION - // Set the context info for the current domain - SetContextInfo(string); -#endif // // Load the assembly. @@ -2492,71 +1285,10 @@ void Zapper::CompileInCurrentDomain(__in LPCWSTR string, CORCOMPILE_NGEN_SIGNATU _ASSERTE(m_hAssembly == NULL); //without fusion, this has to be a file name -#ifdef FEATURE_FUSION - DWORD attributes = WszGetFileAttributes(string); - if (attributes == INVALID_FILE_ATTRIBUTES || ((attributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) - { - IfFailThrow(m_pEECompileInfo->LoadAssemblyByName(string, &m_hAssembly)); - - /* @TODO: If this is the first input, check if it is an EXE - using m_pEECompileInfo->GetAssemblyCodeBase(), and print a - warning that its better to use the EXE file name on the - command-line instead of the full assembly name, so that we - will pick the right runtime version from its config file - (if present). We could make this work even for full assembly name, - but that does not currently work, and this will not be an - issue once we require only one platform-runtime version - on the machine - */ - StackSString codeBase; - m_pEECompileInfo->GetAssemblyCodeBase(m_hAssembly, codeBase); - if (codeBase.GetCount() > 4) - { - SString::Iterator i = codeBase.End() - 4; - if (codeBase.MatchCaseInsensitive(i, SL(".exe"))) - Warning(W("Specify the input as a .EXE for ngen to pick up the config-file\n")); - } - } - else -#endif //FEATURE_FUSION { IfFailThrow(m_pEECompileInfo->LoadAssemblyByPath(string, FALSE /* fExplicitBindToNativeImage */, &m_hAssembly)); } -#ifdef FEATURE_FUSION - // - // Skip the compilation if the assembly is up to date - // - if (CheckAssemblyUpToDate(m_hAssembly, pNativeImageSig)) - { - Info(W("Assembly %s is up to date.\n"), string); - goto Exit; - } - - // - // Try to install native image from repository - // - if (TryToInstallFromRepository(m_hAssembly, pNativeImageSig)) - { - Success(W("Installed native image for assembly %s from repository.\n"), string); - goto Exit; - } - - if (m_pOpt->m_fRepositoryOnly) - { - Info(W("Unable to find native image for assembly %s in repository, skipping.\n"), string); - goto Exit; - } - - // - // Testing aid - // - if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NativeImageRequire) != 0) - { - Error(W("Failed to find native image for assembly %s in repository.\n"), string); - ThrowHR(E_FAIL); - } -#endif //FEATURE_FUSION // // Compile the assembly @@ -2571,524 +1303,6 @@ Exit: return; } -#ifdef FEATURE_FUSION -BOOL Zapper::CheckAssemblyUpToDate(CORINFO_ASSEMBLY_HANDLE hAssembly, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) -{ - WCHAR zapManifestPath[MAX_LONGPATH]; - DWORD cZapManifestPath = MAX_LONGPATH; - - if (!m_pEECompileInfo->CheckAssemblyZap( - hAssembly, - zapManifestPath, &cZapManifestPath)) - return FALSE; - - if (pNativeImageSig) - { - NonVMComHolder<INativeImageInstallInfo> pNIInstallInfo; - - IfFailThrow(GetAssemblyMDInternalImport( - zapManifestPath, - IID_INativeImageInstallInfo, - (IUnknown **)&pNIInstallInfo)); - - IfFailThrow(pNIInstallInfo->GetSignature(pNativeImageSig)); - } - - return TRUE; -} - -BOOL Zapper::TryToInstallFromRepository(CORINFO_ASSEMBLY_HANDLE hAssembly, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) -{ - BOOL fHitMismatchedVersion = FALSE; - BOOL fHitMismatchedDependencies = FALSE; - - if (!m_pOpt->m_repositoryDir || (m_pOpt->m_repositoryFlags & IgnoreRepository) != 0) - { - // No repository - return FALSE; - } - - StackSString strSimpleName; - GetAssemblyName(m_pEECompileInfo, hAssembly, strSimpleName, ICorCompileInfo::GANF_Simple); - - // First see if the NI is available in a folder named "NGen" under the CLR location. - // This folder is used by CBS to store build lab generated NIs. Moving files out of - // this folder might confuse CBS, so we hard link NIs from this folder into the NIC. - WCHAR wszNGenPath[MAX_LONGPATH]; - DWORD dwNGenPathLen = COUNTOF(wszNGenPath); - IfFailThrow(GetInternalSystemDirectory(wszNGenPath, &dwNGenPathLen)); - - wcscat_s(wszNGenPath, COUNTOF(wszNGenPath), W("NativeImages")); - if (TryToInstallFromRepositoryDir(StackSString(wszNGenPath), strSimpleName, - pNativeImageSig, &fHitMismatchedVersion, &fHitMismatchedDependencies, TRUE)) - { - return TRUE; - } - - // If we are moving files from repository, first try to look for the native image in the - // top-level directory of the repository. This is designed for scenarios where it is convenient - // to put all native images in a flat directory. We don't support this with CopyFromRepository - // switch, since it is tricky to figure out which files to copy. - if ((m_pOpt->m_repositoryFlags & MoveFromRepository) != 0 && - TryToInstallFromRepositoryDir(StackSString(m_pOpt->m_repositoryDir), strSimpleName, - pNativeImageSig, &fHitMismatchedVersion, &fHitMismatchedDependencies)) - { - // Try to remove the repository directory in case it has become empty. - // (Note that attempt to remove non-empty directory fails) - WszRemoveDirectory(m_pOpt->m_repositoryDir); - return TRUE; - } - - // Copied from fusion\asmcache\cacheUtils.cpp - // TODO: Clean this up -#define MAX_ZAP_NAME_LENGTH 20 -#define ZAP_ABBR_END_CHAR W('#') - StackSString strSubDirName; - if (strSimpleName.GetCount() > MAX_ZAP_NAME_LENGTH) - { - strSubDirName.Set(strSimpleName.GetUnicode(), MAX_ZAP_NAME_LENGTH-1); - strSubDirName.Append(ZAP_ABBR_END_CHAR); - } - else - strSubDirName.Set(strSimpleName); - - StackSString strRepositorySubDir(StackSString(m_pOpt->m_repositoryDir), SL(W("\\")), strSubDirName); - - DWORD attributes = WszGetFileAttributes(strRepositorySubDir); - if (attributes == INVALID_FILE_ATTRIBUTES || ((attributes & FILE_ATTRIBUTE_DIRECTORY) == 0)) - { - return FALSE; - } - - ClrDirectoryEnumerator de(strRepositorySubDir); - - // - // Try to find a matching native image - // - while (de.Next()) - { - StackSString strNativeImageDir; - strNativeImageDir.Set(strRepositorySubDir, SL("\\"), de.GetFileName()); - - if (TryToInstallFromRepositoryDir(strNativeImageDir, strSimpleName, - pNativeImageSig, &fHitMismatchedVersion, &fHitMismatchedDependencies)) - { - if (m_pOpt->m_repositoryFlags & MoveFromRepository) - { - // Close the iterator so that the directory can be deleted below - de.Close(); - - // Try to remove empty directories that are not needed anymore. - // (Note that attempt to remove non-empty directory fails) - if (WszRemoveDirectory(strNativeImageDir)) - { - if (WszRemoveDirectory(strRepositorySubDir)) - { - WszRemoveDirectory(m_pOpt->m_repositoryDir); - } - } - } - - return TRUE; - } - } - - if (fHitMismatchedVersion) - { - ReportEventNGEN(EVENTLOG_WARNING_TYPE, NGEN_REPOSITORY, W("Version or flavor did not match with repository: %s"), strSimpleName.GetUnicode()); - } - - if (fHitMismatchedDependencies) - { - ReportEventNGEN(EVENTLOG_WARNING_TYPE, NGEN_REPOSITORY, W("Dependencies did not match with repository: %s"), strSimpleName.GetUnicode()); - } - - return FALSE; -} - -BOOL Zapper::TryToInstallFromRepositoryDir( - SString &strNativeImageDir, SString &strSimpleName, - CORCOMPILE_NGEN_SIGNATURE *pNativeImageSig, BOOL *pfHitMismatchedVersion, BOOL *pfHitMismatchedDependencies, BOOL useHardLink) -{ - StackSString strNativeImageName; - StackSString strNativeImagePath; - - // probe for both .exe and .dll - static const LPCWSTR c_Suffixes[] = { W(".dll"), W(".exe"), W(".ni.dll"), W(".ni.exe") }; - - int suffix; - for (suffix = 0; suffix < NumItems(c_Suffixes); suffix++) - { - strNativeImageName.Set(strSimpleName, SL(c_Suffixes[suffix])); - strNativeImagePath.Set(strNativeImageDir, SL("\\"), strNativeImageName); - - if (WszGetFileAttributes(strNativeImagePath) != INVALID_FILE_ATTRIBUTES) - { - break; - } - } - if (suffix == NumItems(c_Suffixes)) - { - // No matching file - return FALSE; - } - - // Make sure the native image is unmapped before we try to install it - { - HModuleHolder hMod(::WszLoadLibrary(strNativeImagePath)); - if (hMod.IsNull()) - { - // Corrupted image or something - return FALSE; - } - - PEDecoder pedecoder(hMod); - - if (!pedecoder.CheckNativeHeader()) - { - // Corrupted image - return FALSE; - } - - class LoggableNativeImage : public LoggableAssembly - { - LPCWSTR m_lpszNativeImage; - - public: - LoggableNativeImage(LPCWSTR lpszNativeImage) - : m_lpszNativeImage(lpszNativeImage) - { - } - - virtual SString DisplayString() { return m_lpszNativeImage; } -#ifdef FEATURE_FUSION - virtual IAssemblyName* FusionAssemblyName() { return NULL; } - virtual IFusionBindLog* FusionBindLog() { return NULL; } -#endif // FEATURE_FUSION - } - loggableNativeImage(strNativeImagePath); - - // Does the version info of the native image match what we are looking for? - CORCOMPILE_VERSION_INFO *pVersionInfo = pedecoder.GetNativeVersionInfo(); - if (!RuntimeVerifyNativeImageVersion(pVersionInfo, &loggableNativeImage) || - !RuntimeVerifyNativeImageFlavor(pVersionInfo, &loggableNativeImage)) - { - // Version info does not match - *pfHitMismatchedVersion = TRUE; - return FALSE; - } - - COUNT_T cDependencies; - CORCOMPILE_DEPENDENCY *pDependencies = pedecoder.GetNativeDependencies(&cDependencies); - - COUNT_T cMeta; - const void *pMeta = pedecoder.GetNativeManifestMetadata(&cMeta); - - NonVMComHolder<IMDInternalImport> pAssemblyImport; - - IfFailThrow(GetMetaDataInternalInterface((void *) pMeta, - cMeta, - ofRead, - IID_IMDInternalImport, - (void **) &pAssemblyImport)); - - if (!VerifyDependencies(pAssemblyImport, pDependencies, cDependencies)) - { - // Dependencies does not match - *pfHitMismatchedDependencies = TRUE; - return FALSE; - } - } - - if (m_pOpt->m_repositoryFlags & MoveFromRepository && !useHardLink) - { - // Move files to save I/O bandwidth - InstallFromRepository(strNativeImagePath.GetUnicode(), pNativeImageSig); - } - else - { - // Copy files - CopyAndInstallFromRepository(strNativeImageDir.GetUnicode(), strNativeImageName.GetUnicode(), pNativeImageSig, useHardLink); - } - - ReportEventNGEN(EVENTLOG_SUCCESS, NGEN_REPOSITORY, W("Installed from repository: %s"), strSimpleName.GetUnicode()); - return TRUE; -} - -void Zapper::InstallFromRepository(LPCWSTR lpszNativeImage, - CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) -{ - // - // Get the zap string. - // - HRESULT hr = S_OK; - - NonVMComHolder<IAssemblyName> pName; - NonVMComHolder<IAssemblyLocation> pAssemblyLocation; - - ReleaseHolder<IBindContext> pBindCtx; - if (FAILED(hr = m_pDomain->GetIBindContext(&pBindCtx))) - { - Error(W("Failed to get binding context.\n")); - ThrowHR(hr); - } - - HRESULT hrInstallCustomAssembly = InstallNativeAssembly(lpszNativeImage, INVALID_HANDLE_VALUE, m_pOpt->m_zapSet, pBindCtx, &pName, &pAssemblyLocation); - if (FAILED(hrInstallCustomAssembly)) - { - Error(W("Failed to install native image %s from repository.\n"), lpszNativeImage); - ThrowHR(hrInstallCustomAssembly); - } - - // TODO: It would be nice to verify that the native image works by calling CheckAssemblyUpToDate. - // Unfortunately, it does not work since we have loaded the non-ngened image in this appdomain - // already in CompileInCurrentDomain. We would need to create a new appdomain for the verification. - - // - // Print a success message - // - if (!m_pOpt->m_silent) - { - PrintFusionCacheEntry(LogLevel_Info, pName); - } - - WCHAR zapManifestPath[MAX_LONGPATH]; - DWORD cPath = MAX_LONGPATH; - IfFailThrow(pAssemblyLocation->GetPath(zapManifestPath, &cPath)); - - if (pNativeImageSig) - { - NonVMComHolder<INativeImageInstallInfo> pNIInstallInfo; - - IfFailThrow(GetAssemblyMDInternalImport( - zapManifestPath, - IID_INativeImageInstallInfo, - (IUnknown **)&pNIInstallInfo)); - - IfFailThrow(pNIInstallInfo->GetSignature(pNativeImageSig)); - } -} - -void Zapper::CleanDirectory(LPCWSTR path) -{ - // Handle the case when we are given file instead of directory - DWORD dwAttributes = WszGetFileAttributes(path); - if (dwAttributes == INVALID_FILE_ATTRIBUTES) - { - // Directory does not exist - return; - } - - if (!(dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { - if (dwAttributes & FILE_ATTRIBUTE_READONLY) - WszSetFileAttributes(path, dwAttributes&~FILE_ATTRIBUTE_READONLY); - - if (!WszDeleteFile(path)) - { - Warning(W("Cannot delete file %s\n"), path); - ThrowLastError(); - } - return; - } - - { - ClrDirectoryEnumerator de(path); - - while (de.Next()) - { - StackSString fullName; - fullName.Set(path, W("\\"), de.GetFileName()); - - if (de.GetFileAttributes() & FILE_ATTRIBUTE_DIRECTORY) - { - CleanDirectory(fullName); - } - else - { - if (de.GetFileAttributes() & FILE_ATTRIBUTE_READONLY) - WszSetFileAttributes(fullName, de.GetFileAttributes()&~FILE_ATTRIBUTE_READONLY); - - if (!WszDeleteFile(fullName)) - { - Warning(W("Cannot delete file %s\n"), fullName.GetUnicode()); - ThrowLastError(); - } - } - } - } - - if (!WszRemoveDirectory(path)) - { - Warning(W("Cannot remove directory %s\n"), path); - ThrowLastError(); - } -} - -void Zapper::TryCleanDirectory(LPCWSTR path) -{ - EX_TRY - { - CleanDirectory(path); - } - EX_SWALLOW_NONTERMINAL; -} - -//------------------------------------------------------------------------------ - -// static -void Zapper::TryCleanDirectory(Zapper * pZapper) -{ - // @CONSIDER: If this fails, block for some time, and try again. - // This will give more time for programs like Anti-virus software - // to release the file handle. - pZapper->TryCleanDirectory(pZapper->m_outputPath); -} - -typedef Wrapper<Zapper*, DoNothing<Zapper*>, Zapper::TryCleanDirectory, NULL> - TryCleanDirectoryHolder; - -//------------------------------------------------------------------------------ -// Sets Zapper::m_outputPath to the folder where we should create the -// ngen images. -//------------------------------------------------------------------------------ - -void Zapper::GetOutputFolder() -{ - /* We create a temporary folder in the NativeImageCache (NIC) instead of using - WszGetTempPath(). This is because WszGetTempPath() is a private folder - for the current user. Files created in there will have ACLs allowing - accesses only to the current user. Later InstallCustomAssembly() - will move the files to the NIC preserving the security attributes. - Now other users cannot use the ngen images, which is bad. - */ - WCHAR tempFolder[MAX_LONGPATH]; - DWORD tempFolderLen = NumItems(tempFolder); - IfFailThrow(GetCachePath(ASM_CACHE_ZAP, tempFolder, &tempFolderLen)); - - // Create the folder "NIC" - - IfFailThrow(clr::fs::Dir::CreateRecursively(tempFolder)); - - // Create the folder "NIC\Temp" - - StackSString tempPath(tempFolder); - tempPath += W("\\Temp"); - if (!WszCreateDirectory(tempPath, NULL)) - { - if (GetLastError() != ERROR_ALREADY_EXISTS) - ThrowLastError(); - } - - // Create the folder "NIC\Temp\P-N", where P is the current process ID, and NN is a serial number. - // Start with N=0. If that directory name is already in use, clean up that directory (it can't be in - // active use because process ID is unique), increment N, and try again. Give up if N gets too large. - for (DWORD n = 0; ; n++) - { - m_outputPath.Printf(W("%s\\%x-%x"), (LPCWSTR)tempPath, GetCurrentProcessId(), n); - if (WszCreateDirectory(m_outputPath, NULL)) - break; - - if (GetLastError() != ERROR_ALREADY_EXISTS) - ThrowLastError(); - - TryCleanDirectory(m_outputPath); - - if (n >= 255) - { - Error(W("Unable to create working directory")); - ThrowHR(E_FAIL); - } - } -} - -//------------------------------------------------------------------------------ - -void Zapper::CopyAndInstallFromRepository(LPCWSTR lpszNativeImageDir, - LPCWSTR lpszNativeImageName, - CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig, - BOOL useHardLink) -{ - GetOutputFolder(); - - // Note that we do not want to fail if we cannot clean up the TEMP files. - // We have seen many issues where the Indexing service or AntiVirus software - // open the temporary files, and seem to hold onto them. We have been - // told that if ngen completes too fast, these other softwares may - // not be able to process the file fast enough, and may close the file - // sometime after we have tried to delete it. - TryCleanDirectoryHolder outputPathHolder(this); - - StackSString strTempNativeImage; - - //local variable fixes gcc overload resolution. - SString literalPathSep(SString::Literal, "\\"); - strTempNativeImage.Set(m_outputPath, literalPathSep, lpszNativeImageName); - - if (useHardLink) - { - // Don't support multi-module assemblies. The useHardLink flag is used in - // scenarios where the source directory has multiple native images, and we - // want to avoid the need to figure out which files are needed. - StackSString strSource(lpszNativeImageDir, literalPathSep, lpszNativeImageName); - - // Try to create hard link first. If that fails, try again with copy. - if (!WszCreateHardLink(strTempNativeImage.GetUnicode(), strSource.GetUnicode(), NULL) && - !WszCopyFile(strSource.GetUnicode(), strTempNativeImage.GetUnicode(), TRUE)) - { - ThrowLastError(); - } - } - else - { - // Copy everything in the directory over. Blindly copying everything over - // saves us from dealing with external modules. - CopyDirectory(lpszNativeImageDir, m_outputPath); - } - - InstallFromRepository(strTempNativeImage.GetUnicode(), pNativeImageSig); -} - -//------------------------------------------------------------------------------ - -void Zapper::CopyDirectory(LPCWSTR srcPath, LPCWSTR dstPath) -{ - ClrDirectoryEnumerator de(srcPath); - - while (de.Next()) - { - StackSString srcFile; - SString literalPathSep(SString::Literal, "\\"); - srcFile.Set(srcPath, literalPathSep, de.GetFileName()); - - StackSString dstFile; - dstFile.Set(dstPath, literalPathSep, de.GetFileName()); - - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenCopyFromRepository_SetCachedSigningLevel) != 0) - { - // The user wants the destination file to be vouched for. It would be a security hole to copy the file - // and then actually vouch for it. So we create a hard link instead. If the original file has the EA, - // the new link will also see the EA as it points to the same physical file. Note that the argument - // order is different between CreateHardLink and CopyFile. - if (WszCreateHardLink(dstFile.GetUnicode(), srcFile.GetUnicode(), NULL)) - { - continue; - } - - // If creation of hard link failed, issue an warning and fall back to copying. - HRESULT hr = HRESULT_FROM_WIN32(GetLastError()); - _ASSERTE(FAILED(hr)); - if (IsExeOrDllOrWinMD(srcFile.GetUnicode())) - { // Print the warning for executables for easier troubleshooting - Warning(W("CreateHardLink failed with HRESULT 0x%08x for file %s\n"), hr, srcFile.GetUnicode()); - } - } - - if (!WszCopyFile(srcFile.GetUnicode(), dstFile.GetUnicode(), TRUE)) - ThrowLastError(); - } -} -#endif // FEATURE_FUSION //------------------------------------------------------------------------------ @@ -3241,13 +1455,6 @@ void Zapper::DefineOutputAssembly(SString& strAssemblyName, ULONG * pHashAlgId) // GenerateFile() will fail later on. // VerifyBindingString is a Runtime requirement, but StringHasLegalFileNameChars // is a ngen restriction. -#ifdef FEATURE_FUSION - if (!FusionBind::VerifyBindingStringW(wszAssemblyName)) - { - Error(W("Error: Assembly name \"%s\" contains path separator and/or extension.\n"), wszAssemblyName); // VLDTR_E_AS_BADNAME - ThrowHR(HRESULT_FROM_WIN32(ERROR_INVALID_NAME)); - } -#endif //FEATURE_FUSION if (!StringHasLegalFileNameChars(wszAssemblyName)) { @@ -3296,17 +1503,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) // Set up the output path. // -#ifdef FEATURE_FUSION - GetOutputFolder(); - - // Note that we do not want to fail if we cannot clean up the TEMP files. - // We have seen many issues where the Indexing service or AntiVirus software - // open the temporary files, and seem to hold onto them. We have been - // told that if ngen completes too fast, these other softwares may - // not be able to process the file fast enough, and may close the file - // sometime after we have tried to delete it. - TryCleanDirectoryHolder outputPathHolder(this); -#else // FEATURE_FUSION // // If we don't have fusion, we just create the file right at the target. No need to do an install. // @@ -3329,7 +1525,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) m_outputPath.Set(W(".") DIRECTORY_SEPARATOR_STR_W); } } -#endif // FEATURE_FUSION // // Get the manifest metadata. @@ -3387,10 +1582,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) } // Write the main assembly module -#ifdef FEATURE_FUSION - strNativeImagePath.Set(m_outputPath, SL(DIRECTORY_SEPARATOR_STR_W), strAssemblyName, - pAssemblyModule->m_ModuleDecoder.IsDll() ? SL(W(".dll")) : SL(W(".exe"))); -#else // FEATURE_FUSION strNativeImagePath = GetOutputFileName(); if (strNativeImagePath.IsEmpty()) @@ -3398,7 +1589,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) strNativeImagePath.Set(m_outputPath, SL(DIRECTORY_SEPARATOR_STR_W), strAssemblyName, pAssemblyModule->m_ModuleDecoder.IsDll() ? SL(W(".ni.dll")) : SL(W(".ni.exe"))); } -#endif // FEATURE_FUSION pAssemblyModule->SetPdbFileName(SString(strAssemblyName, SL(W(".ni.pdb")))); @@ -3409,21 +1599,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) if (FAILED(g_hrFatalError)) ThrowHR(g_hrFatalError); -#ifdef FEATURE_FUSION - InstallCompiledAssembly(strAssemblyName.GetUnicode(), strNativeImagePath.GetUnicode(), hFile, hFiles); - - // - // Once we return from InstallCompiledAssembly, we're in a window where the native image file - // has been placed into the NIC, but none of the Ngen rootstore data structures have been set - // to indicate there is a native image for this assembly. Therefore, we MUST return to the - // Ngen process now without throwing an exception. - // If you need to add code below here before returning it cannot throw an exception or return - // failure. If it does, you must make sure the native image get uninstalled from disk before - // returning so we do not leak the NI file. - // - return; - -#else // FEATURE_FUSION // Close the file CloseHandle(hFile); @@ -3436,7 +1611,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) { GetSvcLogger()->Printf(W("Native image %s generated successfully.\n"), strNativeImagePath.GetUnicode()); } -#endif // FEATURE_FUSION } @@ -3639,107 +1813,6 @@ ZapImage * Zapper::CompileModule(CORINFO_MODULE_HANDLE hModule, return module.Extract(); } -#ifdef FEATURE_FUSION -void Zapper::InstallCompiledAssembly(LPCWSTR szAssemblyName, LPCWSTR szNativeImagePath, HANDLE hFile, SArray<HANDLE> &hFiles) -{ - HRESULT hr = S_OK; - - if ((m_pOpt->m_repositoryFlags & CopyToRepository) && m_pOpt->m_repositoryDir) - { - // - // Copy the native images back to repository. We require RepositoryDir itself to exists. - // - - StackSString strSimpleName(szAssemblyName); - StackSString strSubDirName; - - // Get subdirectory name from the assembly name - if (strSimpleName.GetCount() > MAX_ZAP_NAME_LENGTH) - { - strSubDirName.Set(strSimpleName.GetUnicode(), MAX_ZAP_NAME_LENGTH-1); - strSubDirName.Append(ZAP_ABBR_END_CHAR); - } - else - strSubDirName.Set(strSimpleName); - - StackSString destPath; - destPath.Set(m_pOpt->m_repositoryDir, SL(W("\\")), strSubDirName); - - if (!WszCreateDirectory(destPath, NULL)) - { - if (GetLastError() != ERROR_ALREADY_EXISTS) - ThrowLastError(); - } - - // Get unique subdirectory name from native image sig - GUID unique; - IfFailThrow(CoCreateGuid(&unique)); - static_assert_no_msg(sizeof(unique) == 16); - destPath.AppendPrintf(W("\\%08x%08x%08x%08x"), - ((LONG*)&unique)[0], ((LONG*)&unique)[1], - ((LONG*)&unique)[2], ((LONG*)&unique)[3]); - - if (!WszCreateDirectory(destPath, NULL)) - ThrowLastError(); - - CopyDirectory(m_outputPath, destPath); - } - - NonVMComHolder<IAssemblyName> pName; - NonVMComHolder<IAssemblyLocation> pAssemblyLocation; - - // If the NGenCompileWorkerHang key is set, we want to loop forever. This helps testing - // of termination of compilation workers on fast machines (where the compilation can finish - // before the worker has been terminated). - HangWorker(W("NGenCompileWorkerHang"), W("NGenCompileWorkerInsideHang")); - - ReleaseHolder<IBindContext> pBindCtx; - if (FAILED(hr = m_pDomain->GetIBindContext(&pBindCtx))) - { - Error(W("Failed to get binding context.\n")); - ThrowHR(hr); - } - if (FAILED(hr = InstallNativeAssembly(szNativeImagePath, hFile, m_pOpt->m_zapSet, pBindCtx, &pName, &pAssemblyLocation))) - { - Warning(W("Failed to install image to native image cache.\n")); - ThrowHR(hr); - } - - // - // The native image is now installed in the NIC. Any exception thrown before the end of this method - // will result in the native image being leaked but the rootstore being cleaned up, orphaning the NI. - // - EX_TRY - { - // Ignore errors if they happen - (void)m_pEECompileInfo->SetCachedSigningLevel(hFile, hFiles.GetElements(), hFiles.GetCount()); - - CloseHandle(hFile); - for (SArray<HANDLE>::Iterator i = hFiles.Begin(); i != hFiles.End(); ++i) - { - CloseHandle(*i); - } - - // - // Print a success message - // - - if (!m_pOpt->m_silent) - { - PrintFusionCacheEntry(LogLevel_Info, pName); - } - } - EX_CATCH - { - // Uninstall the native image and rethrow. Ignore all errors from UninstallNativeAssembly; we - // tried our best not to leak a native image and want to surface to original reason for - // failing anyway. - (void)UninstallNativeAssembly(pName, GetSvcLogger()->GetSvcLogger()); - EX_RETHROW; - } - EX_END_CATCH_UNREACHABLE; -} // Zapper::InstallCompiledAssembly -#endif // FEATURE_FUSION void Zapper::Success(LPCWSTR format, ...) { |