提交 10b535d6 编写于 作者: E Elinor Fung 提交者: GitHub

Remove unused functions on IAssemblyName (dotnet/coreclr#27592)



Commit migrated from https://github.com/dotnet/coreclr/commit/24b4e11161cf217672fcd3c62158b12c93822e18
上级 97bb2c99
...@@ -304,73 +304,6 @@ namespace BINDER_SPACE ...@@ -304,73 +304,6 @@ namespace BINDER_SPACE
Exit: Exit:
return hr; return hr;
} }
HRESULT AssemblyName::CreateFusionName(IAssemblyName **ppIAssemblyName)
{
HRESULT hr = S_OK;
ReleaseHolder<IAssemblyName> pIAssemblyName;
IF_FAIL_GO(CreateAssemblyNameObject(&pIAssemblyName, NULL, 0, NULL));
IF_FAIL_GO(LegacyFusion::SetStringProperty(pIAssemblyName, ASM_NAME_NAME, GetSimpleName()));
if (Have(AssemblyIdentity::IDENTITY_FLAG_VERSION))
{
AssemblyVersion *pAssemblyVersion = GetVersion();
IF_FAIL_GO(LegacyFusion::SetWordProperty(pIAssemblyName,
ASM_NAME_MAJOR_VERSION,
pAssemblyVersion->GetMajor()));
IF_FAIL_GO(LegacyFusion::SetWordProperty(pIAssemblyName,
ASM_NAME_MINOR_VERSION,
pAssemblyVersion->GetMinor()));
IF_FAIL_GO(LegacyFusion::SetWordProperty(pIAssemblyName,
ASM_NAME_BUILD_NUMBER,
pAssemblyVersion->GetBuild()));
IF_FAIL_GO(LegacyFusion::SetWordProperty(pIAssemblyName,
ASM_NAME_REVISION_NUMBER,
pAssemblyVersion->GetRevision()));
}
if (Have(AssemblyIdentity::IDENTITY_FLAG_CULTURE))
{
IF_FAIL_GO(LegacyFusion::SetStringProperty(pIAssemblyName, ASM_NAME_CULTURE, GetCulture()));
}
if (Have(AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY))
{
// GetPublicKeyTokenBLOB contains either PK or PKT.
IF_FAIL_GO(LegacyFusion::SetBufferProperty(pIAssemblyName,
ASM_NAME_PUBLIC_KEY,
GetPublicKeyTokenBLOB()));
}
else if (Have(AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY_TOKEN))
{
// GetPublicKeyTokenBLOB contains either PK or PKT.
IF_FAIL_GO(LegacyFusion::SetBufferProperty(pIAssemblyName,
ASM_NAME_PUBLIC_KEY_TOKEN,
GetPublicKeyTokenBLOB()));
}
if (Have(AssemblyIdentity::IDENTITY_FLAG_PROCESSOR_ARCHITECTURE))
{
IF_FAIL_GO(LegacyFusion::SetDwordProperty(pIAssemblyName,
ASM_NAME_ARCHITECTURE,
static_cast<DWORD>(GetArchitecture())));
}
if (Have(AssemblyIdentity::IDENTITY_FLAG_CONTENT_TYPE))
{
IF_FAIL_GO(LegacyFusion::SetDwordProperty(pIAssemblyName,
ASM_NAME_CONTENT_TYPE,
GetContentType()));
}
*ppIAssemblyName = pIAssemblyName.Extract();
Exit:
return hr;
}
ULONG AssemblyName::AddRef() ULONG AssemblyName::AddRef()
{ {
...@@ -530,21 +463,6 @@ Exit: ...@@ -530,21 +463,6 @@ Exit:
return fEquals; return fEquals;
} }
HRESULT AssemblyName::Clone(AssemblyName **ppAssemblyName)
{
HRESULT hr = S_OK;
AssemblyName *pClonedAssemblyName = NULL;
SAFE_NEW(pClonedAssemblyName, AssemblyName);
CloneInto(pClonedAssemblyName);
pClonedAssemblyName->m_dwNameFlags = m_dwNameFlags;
*ppAssemblyName = pClonedAssemblyName;
Exit:
return hr;
}
void AssemblyName::GetDisplayName(PathString &displayName, void AssemblyName::GetDisplayName(PathString &displayName,
DWORD dwIncludeFlags) DWORD dwIncludeFlags)
{ {
......
...@@ -78,20 +78,6 @@ namespace BINDER_SPACE ...@@ -78,20 +78,6 @@ namespace BINDER_SPACE
m_dwIdentityFlags &= ~dwIdentityFlags; m_dwIdentityFlags &= ~dwIdentityFlags;
} }
void CloneInto(AssemblyIdentity *pAssemblyIdentity)
{
pAssemblyIdentity->m_simpleName.Set(m_simpleName);
pAssemblyIdentity->m_simpleName.Normalize();
pAssemblyIdentity->m_version.SetVersion(&m_version);
pAssemblyIdentity->m_cultureOrLanguage.Set(m_cultureOrLanguage);
pAssemblyIdentity->m_cultureOrLanguage.Normalize();
pAssemblyIdentity->m_publicKeyOrTokenBLOB.Set(m_publicKeyOrTokenBLOB);
pAssemblyIdentity->m_kProcessorArchitecture = m_kProcessorArchitecture;
pAssemblyIdentity->m_kContentType = m_kContentType;
pAssemblyIdentity->m_customBLOB.Set(m_customBLOB);
pAssemblyIdentity->m_dwIdentityFlags = m_dwIdentityFlags;
}
SString m_simpleName; SString m_simpleName;
AssemblyVersion m_version; AssemblyVersion m_version;
SString m_cultureOrLanguage; SString m_cultureOrLanguage;
......
...@@ -43,7 +43,6 @@ namespace BINDER_SPACE ...@@ -43,7 +43,6 @@ namespace BINDER_SPACE
/* in */ BOOL fIsDefinition = TRUE); /* in */ BOOL fIsDefinition = TRUE);
HRESULT Init(/* in */ SString &assemblyDisplayName); HRESULT Init(/* in */ SString &assemblyDisplayName);
HRESULT Init(/* in */ IAssemblyName *pIAssemblyName); HRESULT Init(/* in */ IAssemblyName *pIAssemblyName);
HRESULT CreateFusionName(/* out */ IAssemblyName **ppIAssemblyName);
ULONG AddRef(); ULONG AddRef();
ULONG Release(); ULONG Release();
...@@ -75,8 +74,6 @@ namespace BINDER_SPACE ...@@ -75,8 +74,6 @@ namespace BINDER_SPACE
BOOL Equals(/* in */ AssemblyName *pAssemblyName, BOOL Equals(/* in */ AssemblyName *pAssemblyName,
/* in */ DWORD dwIncludeFlags); /* in */ DWORD dwIncludeFlags);
HRESULT Clone(/* out */ AssemblyName **ppAssemblyName);
void GetDisplayName(/* out */ PathString &displayName, void GetDisplayName(/* out */ PathString &displayName,
/* in */ DWORD dwIncludeFlags); /* in */ DWORD dwIncludeFlags);
......
...@@ -45,7 +45,6 @@ private: ...@@ -45,7 +45,6 @@ private:
DWORD _dwSig; DWORD _dwSig;
Volatile<LONG> _cRef; Volatile<LONG> _cRef;
CPropertyArray _rProp; CPropertyArray _rProp;
BOOL _fIsFinalized;
BOOL _fPublicKeyToken; BOOL _fPublicKeyToken;
BOOL _fCustom; BOOL _fCustom;
LPWSTR _pwzPathModifier; LPWSTR _pwzPathModifier;
...@@ -69,37 +68,10 @@ public: ...@@ -69,37 +68,10 @@ public:
/* out */ LPVOID pvProperty, /* out */ LPVOID pvProperty,
/* in out */ LPDWORD pcbProperty); /* in out */ LPDWORD pcbProperty);
STDMETHOD(Finalize)();
STDMETHOD(GetDisplayName)(
__out_ecount_opt(*pccDisplayName) LPOLESTR szDisplayName,
__inout LPDWORD pccDisplayName,
__in DWORD dwDisplayFlags);
STDMETHOD(GetName)( STDMETHOD(GetName)(
__inout LPDWORD lpcwBuffer, __inout LPDWORD lpcwBuffer,
__out_ecount_opt(*lpcwBuffer) LPOLESTR pwzBuffer); __out_ecount_opt(*lpcwBuffer) LPOLESTR pwzBuffer);
STDMETHOD(GetVersion)(
/* [out] */ LPDWORD pwVersionHi,
/* [out] */ LPDWORD pwVersionLow);
STDMETHOD (IsEqual)(
/* [in] */ LPASSEMBLYNAME pName,
/* [in] */ DWORD dwCmpFlags);
STDMETHOD(Reserved)(
/* in */ REFIID refIID,
/* in */ IUnknown *pUnkBindSink,
/* in */ IUnknown *pUnkAppCtx,
/* in */ LPCOLESTR szCodebase,
/* in */ LONGLONG llFlags,
/* in */ LPVOID pvReserved,
/* in */ DWORD cbReserved,
/* out */ VOID **ppv);
STDMETHODIMP Clone(IAssemblyName **ppName);
HRESULT SetPropertyInternal(/* in */ DWORD PropertyId, HRESULT SetPropertyInternal(/* in */ DWORD PropertyId,
/* in */ LPCVOID pvProperty, /* in */ LPCVOID pvProperty,
/* in */ DWORD cbProperty); /* in */ DWORD cbProperty);
...@@ -109,51 +81,19 @@ public: ...@@ -109,51 +81,19 @@ public:
HRESULT Init(LPCTSTR pszAssemblyName, ASSEMBLYMETADATA *pamd); HRESULT Init(LPCTSTR pszAssemblyName, ASSEMBLYMETADATA *pamd);
HRESULT Parse(LPCWSTR szDisplayName); HRESULT Parse(LPCWSTR szDisplayName);
static BOOL IsStronglyNamed(IAssemblyName *pName);
static BOOL IsPartial(IAssemblyName *pName,
LPDWORD pdwCmpMask = NULL);
protected:
HRESULT GetVersion(DWORD dwMajorVersionEnumValue,
LPDWORD pwVersionHi,
LPDWORD pwVersionLow);
HRESULT CopyProperties(CAssemblyName *pSource,
CAssemblyName *pTarget,
const DWORD properties[],
DWORD dwSize);
}; };
STDAPI STDAPI
CreateAssemblyNameObject( CreateAssemblyNameObject(
LPASSEMBLYNAME *ppAssemblyName, LPASSEMBLYNAME *ppAssemblyName,
LPCOLESTR szAssemblyName, LPCOLESTR szAssemblyName,
DWORD dwFlags, bool parseDisplayName);
LPVOID pvReserved);
STDAPI STDAPI
CreateAssemblyNameObjectFromMetaData( CreateAssemblyNameObjectFromMetaData(
LPASSEMBLYNAME *ppAssemblyName, LPASSEMBLYNAME *ppAssemblyName,
LPCOLESTR szAssemblyName, LPCOLESTR szAssemblyName,
ASSEMBLYMETADATA *pamd, ASSEMBLYMETADATA *pamd);
LPVOID pvReserved);
namespace LegacyFusion
{
HRESULT SetStringProperty(IAssemblyName *pIAssemblyName,
DWORD dwPropertyId,
SString &value);
HRESULT SetBufferProperty(IAssemblyName *pIAssemblyName,
DWORD dwPropertyId,
SBuffer &value);
HRESULT SetWordProperty(IAssemblyName *pIAssemblyName,
DWORD dwPropertyId,
DWORD dwValue);
HRESULT SetDwordProperty(IAssemblyName *pIAssemblyName,
DWORD dwPropertyId,
DWORD dwValue);
};
namespace fusion namespace fusion
{ {
......
...@@ -54,23 +54,6 @@ ...@@ -54,23 +54,6 @@
#define PUBLIC_KEY_TOKEN_LEN 8 #define PUBLIC_KEY_TOKEN_LEN 8
inline
WCHAR*
WSTRDupDynamic(LPCWSTR pwszSrc)
{
LPWSTR pwszDest = NULL;
if (pwszSrc != NULL)
{
const size_t dwLen = wcslen(pwszSrc) + 1;
pwszDest = FUSION_NEW_ARRAY(WCHAR, dwLen);
if( pwszDest )
memcpy(pwszDest, pwszSrc, dwLen * sizeof(WCHAR));
}
return pwszDest;
}
#define MAX_URL_LENGTH 2084 // same as INTERNET_MAX_URL_LENGTH #define MAX_URL_LENGTH 2084 // same as INTERNET_MAX_URL_LENGTH
// bit mask macro helpers // bit mask macro helpers
......
...@@ -32,28 +32,6 @@ cpp_quote("#pragma once") ...@@ -32,28 +32,6 @@ cpp_quote("#pragma once")
cpp_quote("#endif") cpp_quote("#endif")
interface IAssemblyCache;
interface IAssemblyCacheItem;
interface IAssemblyName;
interface IAssemblyEnum;
cpp_quote("#ifndef PEKIND_ENUM_DEFINED")
cpp_quote("#define PEKIND_ENUM_DEFINED")
// This must match the definition of pekind in peinformation.h
typedef enum _tagPEKIND
{
peNone = 0x00000000,
peMSIL = 0x00000001,
peI386 = 0x00000002,
peIA64 = 0x00000003,
peAMD64 = 0x00000004,
peARM = 0x00000005,
peARM64 = 0x00000006,
peInvalid = 0xffffffff
} PEKIND;
cpp_quote("#endif")
typedef enum _tagAssemblyContentType typedef enum _tagAssemblyContentType
{ {
AssemblyContentType_Default = 0x00000000, AssemblyContentType_Default = 0x00000000,
...@@ -81,14 +59,7 @@ cpp_quote("EXTERN_GUID(IID_IAssemblyName, 0xCD193BC0, 0xB4BC, 0x11d2, 0x98, 0x33 ...@@ -81,14 +59,7 @@ cpp_quote("EXTERN_GUID(IID_IAssemblyName, 0xCD193BC0, 0xB4BC, 0x11d2, 0x98, 0x33
interface IAssemblyName: IUnknown interface IAssemblyName: IUnknown
{ {
typedef [unique] IAssemblyName *LPASSEMBLYNAME; typedef [unique] IAssemblyName *LPASSEMBLYNAME;
typedef enum {
CANOF_PARSE_DISPLAY_NAME = 0x1,
CANOF_SET_DEFAULT_VALUES = 0x2,
CANOF_VERIFY_FRIEND_ASSEMBLYNAME = 0x4,
CANOF_PARSE_FRIEND_DISPLAY_NAME = CANOF_PARSE_DISPLAY_NAME | CANOF_VERIFY_FRIEND_ASSEMBLYNAME
} CREATE_ASM_NAME_OBJ_FLAGS;
typedef enum typedef enum
{ {
ASM_NAME_PUBLIC_KEY = 0, // 0 ASM_NAME_PUBLIC_KEY = 0, // 0
...@@ -153,43 +124,6 @@ interface IAssemblyName: IUnknown ...@@ -153,43 +124,6 @@ interface IAssemblyName: IUnknown
| ASM_DISPLAYF_PROCESSORARCHITECTURE | ASM_DISPLAYF_PROCESSORARCHITECTURE
| ASM_DISPLAYF_CONTENT_TYPE, | ASM_DISPLAYF_CONTENT_TYPE,
} ASM_DISPLAY_FLAGS; } ASM_DISPLAY_FLAGS;
typedef enum
{
ASM_CMPF_NAME = 0x1,
ASM_CMPF_MAJOR_VERSION = 0x2,
ASM_CMPF_MINOR_VERSION = 0x4,
ASM_CMPF_BUILD_NUMBER = 0x8,
ASM_CMPF_REVISION_NUMBER = 0x10,
ASM_CMPF_VERSION = ASM_CMPF_MAJOR_VERSION
|ASM_CMPF_MINOR_VERSION
|ASM_CMPF_BUILD_NUMBER
|ASM_CMPF_REVISION_NUMBER,
ASM_CMPF_PUBLIC_KEY_TOKEN = 0x20,
ASM_CMPF_CULTURE = 0x40,
ASM_CMPF_CUSTOM = 0x80,
ASM_CMPF_DEFAULT = 0x100,
ASM_CMPF_RETARGET = 0x200,
ASM_CMPF_ARCHITECTURE = 0x400,
ASM_CMPF_CONFIG_MASK = 0x800,
ASM_CMPF_MVID = 0x1000,
ASM_CMPF_SIGNATURE = 0x2000,
ASM_CMPF_CONTENT_TYPE = 0x4000,
ASM_CMPF_IL_ALL = ASM_CMPF_NAME
| ASM_CMPF_VERSION
| ASM_CMPF_PUBLIC_KEY_TOKEN
| ASM_CMPF_CULTURE,
ASM_CMPF_IL_NO_VERSION = ASM_CMPF_NAME
| ASM_CMPF_PUBLIC_KEY_TOKEN
| ASM_CMPF_CULTURE
} ASM_CMP_FLAGS;
HRESULT SetProperty( HRESULT SetProperty(
[in] DWORD PropertyId, [in] DWORD PropertyId,
...@@ -201,42 +135,8 @@ interface IAssemblyName: IUnknown ...@@ -201,42 +135,8 @@ interface IAssemblyName: IUnknown
[out] LPVOID pvProperty, [out] LPVOID pvProperty,
[in, out] LPDWORD pcbProperty); [in, out] LPDWORD pcbProperty);
HRESULT Finalize();
HRESULT GetDisplayName(
[out, annotation("_Out_writes_opt_(*pccDisplayName)")]
LPOLESTR szDisplayName,
[in, out] LPDWORD pccDisplayName,
[in] DWORD dwDisplayFlags);
HRESULT Reserved(
[in] REFIID refIID,
[in] IUnknown *pUnkReserved1,
[in] IUnknown *pUnkReserved2,
[in] LPCOLESTR szReserved,
[in] LONGLONG llReserved,
[in] LPVOID pvReserved,
[in] DWORD cbReserved,
[out] LPVOID *ppReserved);
HRESULT GetName( HRESULT GetName(
[in, out, annotation("_Inout_")] LPDWORD lpcwBuffer, [in, out, annotation("_Inout_")] LPDWORD lpcwBuffer,
[out, annotation("_Out_writes_opt_(*lpcwBuffer)")] WCHAR *pwzName); [out, annotation("_Out_writes_opt_(*lpcwBuffer)")] WCHAR *pwzName);
HRESULT GetVersion(
[out] LPDWORD pdwVersionHi,
[out] LPDWORD pdwVersionLow);
HRESULT IsEqual(
[in] IAssemblyName *pName,
[in] DWORD dwCmpFlags);
HRESULT Clone(
[out] IAssemblyName **pName);
} }
#pragma midl_echo("STDAPI CreateAssemblyNameObject(LPASSEMBLYNAME *ppAssemblyNameObj, LPCWSTR szAssemblyName, DWORD dwFlags, LPVOID pvReserved); ")
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 8.00.0603 */ /* File created by MIDL compiler version 8.01.0622 */
/* @@MIDL_FILE_HEADING( ) */ /* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */ #pragma warning( disable: 4049 ) /* more than 64k source lines */
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#ifndef __RPCNDR_H_VERSION__ #ifndef __RPCNDR_H_VERSION__
#error this stub requires an updated version of <rpcndr.h> #error this stub requires an updated version of <rpcndr.h>
#endif // __RPCNDR_H_VERSION__ #endif /* __RPCNDR_H_VERSION__ */
#ifndef COM_NO_WINDOWS_H #ifndef COM_NO_WINDOWS_H
#include "windows.h" #include "windows.h"
...@@ -68,26 +68,6 @@ extern "C"{ ...@@ -68,26 +68,6 @@ extern "C"{
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma once #pragma once
#endif #endif
#ifndef PEKIND_ENUM_DEFINED
#define PEKIND_ENUM_DEFINED
typedef
enum _tagPEKIND
{
peNone = 0,
peMSIL = 0x1,
peI386 = 0x2,
peIA64 = 0x3,
peAMD64 = 0x4,
peARM = 0x5,
peARM64 = 0x6,
peInvalid = 0xffffffff
} PEKIND;
#endif
typedef typedef
enum _tagAssemblyContentType enum _tagAssemblyContentType
{ {
...@@ -113,15 +93,6 @@ typedef /* [unique] */ IAssemblyName *LPASSEMBLYNAME; ...@@ -113,15 +93,6 @@ typedef /* [unique] */ IAssemblyName *LPASSEMBLYNAME;
typedef /* [public] */ typedef /* [public] */
enum __MIDL_IAssemblyName_0001 enum __MIDL_IAssemblyName_0001
{
CANOF_PARSE_DISPLAY_NAME = 0x1,
CANOF_SET_DEFAULT_VALUES = 0x2,
CANOF_VERIFY_FRIEND_ASSEMBLYNAME = 0x4,
CANOF_PARSE_FRIEND_DISPLAY_NAME = ( CANOF_PARSE_DISPLAY_NAME | CANOF_VERIFY_FRIEND_ASSEMBLYNAME )
} CREATE_ASM_NAME_OBJ_FLAGS;
typedef /* [public] */
enum __MIDL_IAssemblyName_0002
{ {
ASM_NAME_PUBLIC_KEY = 0, ASM_NAME_PUBLIC_KEY = 0,
ASM_NAME_PUBLIC_KEY_TOKEN = ( ASM_NAME_PUBLIC_KEY + 1 ) , ASM_NAME_PUBLIC_KEY_TOKEN = ( ASM_NAME_PUBLIC_KEY + 1 ) ,
...@@ -156,7 +127,7 @@ enum __MIDL_IAssemblyName_0002 ...@@ -156,7 +127,7 @@ enum __MIDL_IAssemblyName_0002
} ASM_NAME; } ASM_NAME;
typedef /* [public] */ typedef /* [public] */
enum __MIDL_IAssemblyName_0003 enum __MIDL_IAssemblyName_0002
{ {
ASM_DISPLAYF_VERSION = 0x1, ASM_DISPLAYF_VERSION = 0x1,
ASM_DISPLAYF_CULTURE = 0x2, ASM_DISPLAYF_CULTURE = 0x2,
...@@ -172,29 +143,6 @@ enum __MIDL_IAssemblyName_0003 ...@@ -172,29 +143,6 @@ enum __MIDL_IAssemblyName_0003
ASM_DISPLAYF_FULL = ( ( ( ( ( ASM_DISPLAYF_VERSION | ASM_DISPLAYF_CULTURE ) | ASM_DISPLAYF_PUBLIC_KEY_TOKEN ) | ASM_DISPLAYF_RETARGET ) | ASM_DISPLAYF_PROCESSORARCHITECTURE ) | ASM_DISPLAYF_CONTENT_TYPE ) ASM_DISPLAYF_FULL = ( ( ( ( ( ASM_DISPLAYF_VERSION | ASM_DISPLAYF_CULTURE ) | ASM_DISPLAYF_PUBLIC_KEY_TOKEN ) | ASM_DISPLAYF_RETARGET ) | ASM_DISPLAYF_PROCESSORARCHITECTURE ) | ASM_DISPLAYF_CONTENT_TYPE )
} ASM_DISPLAY_FLAGS; } ASM_DISPLAY_FLAGS;
typedef /* [public] */
enum __MIDL_IAssemblyName_0004
{
ASM_CMPF_NAME = 0x1,
ASM_CMPF_MAJOR_VERSION = 0x2,
ASM_CMPF_MINOR_VERSION = 0x4,
ASM_CMPF_BUILD_NUMBER = 0x8,
ASM_CMPF_REVISION_NUMBER = 0x10,
ASM_CMPF_VERSION = ( ( ( ASM_CMPF_MAJOR_VERSION | ASM_CMPF_MINOR_VERSION ) | ASM_CMPF_BUILD_NUMBER ) | ASM_CMPF_REVISION_NUMBER ) ,
ASM_CMPF_PUBLIC_KEY_TOKEN = 0x20,
ASM_CMPF_CULTURE = 0x40,
ASM_CMPF_CUSTOM = 0x80,
ASM_CMPF_DEFAULT = 0x100,
ASM_CMPF_RETARGET = 0x200,
ASM_CMPF_ARCHITECTURE = 0x400,
ASM_CMPF_CONFIG_MASK = 0x800,
ASM_CMPF_MVID = 0x1000,
ASM_CMPF_SIGNATURE = 0x2000,
ASM_CMPF_CONTENT_TYPE = 0x4000,
ASM_CMPF_IL_ALL = ( ( ( ASM_CMPF_NAME | ASM_CMPF_VERSION ) | ASM_CMPF_PUBLIC_KEY_TOKEN ) | ASM_CMPF_CULTURE ) ,
ASM_CMPF_IL_NO_VERSION = ( ( ASM_CMPF_NAME | ASM_CMPF_PUBLIC_KEY_TOKEN ) | ASM_CMPF_CULTURE )
} ASM_CMP_FLAGS;
EXTERN_C const IID IID_IAssemblyName; EXTERN_C const IID IID_IAssemblyName;
...@@ -214,41 +162,12 @@ EXTERN_C const IID IID_IAssemblyName; ...@@ -214,41 +162,12 @@ EXTERN_C const IID IID_IAssemblyName;
/* [out] */ LPVOID pvProperty, /* [out] */ LPVOID pvProperty,
/* [out][in] */ LPDWORD pcbProperty) = 0; /* [out][in] */ LPDWORD pcbProperty) = 0;
virtual HRESULT STDMETHODCALLTYPE Finalize( void) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDisplayName(
/* [annotation][out] */
_Out_writes_opt_(*pccDisplayName) LPOLESTR szDisplayName,
/* [out][in] */ LPDWORD pccDisplayName,
/* [in] */ DWORD dwDisplayFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE Reserved(
/* [in] */ REFIID refIID,
/* [in] */ IUnknown *pUnkReserved1,
/* [in] */ IUnknown *pUnkReserved2,
/* [in] */ LPCOLESTR szReserved,
/* [in] */ LONGLONG llReserved,
/* [in] */ LPVOID pvReserved,
/* [in] */ DWORD cbReserved,
/* [out] */ LPVOID *ppReserved) = 0;
virtual HRESULT STDMETHODCALLTYPE GetName( virtual HRESULT STDMETHODCALLTYPE GetName(
/* [annotation][out][in] */ /* [annotation][out][in] */
_Inout_ LPDWORD lpcwBuffer, _Inout_ LPDWORD lpcwBuffer,
/* [annotation][out] */ /* [annotation][out] */
_Out_writes_opt_(*lpcwBuffer) WCHAR *pwzName) = 0; _Out_writes_opt_(*lpcwBuffer) WCHAR *pwzName) = 0;
virtual HRESULT STDMETHODCALLTYPE GetVersion(
/* [out] */ LPDWORD pdwVersionHi,
/* [out] */ LPDWORD pdwVersionLow) = 0;
virtual HRESULT STDMETHODCALLTYPE IsEqual(
/* [in] */ IAssemblyName *pName,
/* [in] */ DWORD dwCmpFlags) = 0;
virtual HRESULT STDMETHODCALLTYPE Clone(
/* [out] */ IAssemblyName **pName) = 0;
}; };
...@@ -282,27 +201,6 @@ EXTERN_C const IID IID_IAssemblyName; ...@@ -282,27 +201,6 @@ EXTERN_C const IID IID_IAssemblyName;
/* [out] */ LPVOID pvProperty, /* [out] */ LPVOID pvProperty,
/* [out][in] */ LPDWORD pcbProperty); /* [out][in] */ LPDWORD pcbProperty);
HRESULT ( STDMETHODCALLTYPE *Finalize )(
IAssemblyName * This);
HRESULT ( STDMETHODCALLTYPE *GetDisplayName )(
IAssemblyName * This,
/* [annotation][out] */
_Out_writes_opt_(*pccDisplayName) LPOLESTR szDisplayName,
/* [out][in] */ LPDWORD pccDisplayName,
/* [in] */ DWORD dwDisplayFlags);
HRESULT ( STDMETHODCALLTYPE *Reserved )(
IAssemblyName * This,
/* [in] */ REFIID refIID,
/* [in] */ IUnknown *pUnkReserved1,
/* [in] */ IUnknown *pUnkReserved2,
/* [in] */ LPCOLESTR szReserved,
/* [in] */ LONGLONG llReserved,
/* [in] */ LPVOID pvReserved,
/* [in] */ DWORD cbReserved,
/* [out] */ LPVOID *ppReserved);
HRESULT ( STDMETHODCALLTYPE *GetName )( HRESULT ( STDMETHODCALLTYPE *GetName )(
IAssemblyName * This, IAssemblyName * This,
/* [annotation][out][in] */ /* [annotation][out][in] */
...@@ -310,20 +208,6 @@ EXTERN_C const IID IID_IAssemblyName; ...@@ -310,20 +208,6 @@ EXTERN_C const IID IID_IAssemblyName;
/* [annotation][out] */ /* [annotation][out] */
_Out_writes_opt_(*lpcwBuffer) WCHAR *pwzName); _Out_writes_opt_(*lpcwBuffer) WCHAR *pwzName);
HRESULT ( STDMETHODCALLTYPE *GetVersion )(
IAssemblyName * This,
/* [out] */ LPDWORD pdwVersionHi,
/* [out] */ LPDWORD pdwVersionLow);
HRESULT ( STDMETHODCALLTYPE *IsEqual )(
IAssemblyName * This,
/* [in] */ IAssemblyName *pName,
/* [in] */ DWORD dwCmpFlags);
HRESULT ( STDMETHODCALLTYPE *Clone )(
IAssemblyName * This,
/* [out] */ IAssemblyName **pName);
END_INTERFACE END_INTERFACE
} IAssemblyNameVtbl; } IAssemblyNameVtbl;
...@@ -353,27 +237,9 @@ EXTERN_C const IID IID_IAssemblyName; ...@@ -353,27 +237,9 @@ EXTERN_C const IID IID_IAssemblyName;
#define IAssemblyName_GetProperty(This,PropertyId,pvProperty,pcbProperty) \ #define IAssemblyName_GetProperty(This,PropertyId,pvProperty,pcbProperty) \
( (This)->lpVtbl -> GetProperty(This,PropertyId,pvProperty,pcbProperty) ) ( (This)->lpVtbl -> GetProperty(This,PropertyId,pvProperty,pcbProperty) )
#define IAssemblyName_Finalize(This) \
( (This)->lpVtbl -> Finalize(This) )
#define IAssemblyName_GetDisplayName(This,szDisplayName,pccDisplayName,dwDisplayFlags) \
( (This)->lpVtbl -> GetDisplayName(This,szDisplayName,pccDisplayName,dwDisplayFlags) )
#define IAssemblyName_Reserved(This,refIID,pUnkReserved1,pUnkReserved2,szReserved,llReserved,pvReserved,cbReserved,ppReserved) \
( (This)->lpVtbl -> Reserved(This,refIID,pUnkReserved1,pUnkReserved2,szReserved,llReserved,pvReserved,cbReserved,ppReserved) )
#define IAssemblyName_GetName(This,lpcwBuffer,pwzName) \ #define IAssemblyName_GetName(This,lpcwBuffer,pwzName) \
( (This)->lpVtbl -> GetName(This,lpcwBuffer,pwzName) ) ( (This)->lpVtbl -> GetName(This,lpcwBuffer,pwzName) )
#define IAssemblyName_GetVersion(This,pdwVersionHi,pdwVersionLow) \
( (This)->lpVtbl -> GetVersion(This,pdwVersionHi,pdwVersionLow) )
#define IAssemblyName_IsEqual(This,pName,dwCmpFlags) \
( (This)->lpVtbl -> IsEqual(This,pName,dwCmpFlags) )
#define IAssemblyName_Clone(This,pName) \
( (This)->lpVtbl -> Clone(This,pName) )
#endif /* COBJMACROS */ #endif /* COBJMACROS */
...@@ -385,15 +251,6 @@ EXTERN_C const IID IID_IAssemblyName; ...@@ -385,15 +251,6 @@ EXTERN_C const IID IID_IAssemblyName;
#endif /* __IAssemblyName_INTERFACE_DEFINED__ */ #endif /* __IAssemblyName_INTERFACE_DEFINED__ */
/* interface __MIDL_itf_fusion_0000_0001 */
/* [local] */
STDAPI CreateAssemblyNameObject(LPASSEMBLYNAME *ppAssemblyNameObj, LPCWSTR szAssemblyName, DWORD dwFlags, LPVOID pvReserved);
extern RPC_IF_HANDLE __MIDL_itf_fusion_0000_0001_v0_0_c_ifspec;
extern RPC_IF_HANDLE __MIDL_itf_fusion_0000_0001_v0_0_s_ifspec;
/* Additional Prototypes for ALL interfaces */ /* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */ /* end of Additional Prototypes */
......
// 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.
// assemblynamelist.h
//
//
//
/// provides class to implement lookups by assemby name.
/// always checks the simple name
/// never checks culture
///
/// ALSO: it leaks the stored assembly names, so currently can be used only in globals
///
/// checks version/pk/pa only if present in the one being looked up
#ifndef ASSEMBLYNAMELISTHASHTRAITS_H
#define ASSEMBLYNAMELISTHASHTRAITS_H
#include "naming.h"
class AssemblyNameListHashTraits : public NoRemoveSHashTraits<DefaultSHashTraits<IAssemblyName*> >
{
public:
typedef IAssemblyName* key_t;
static key_t GetKey(element_t pName)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
}
CONTRACTL_END;
return pName;
}
static const element_t Null()
{
LIMITED_METHOD_CONTRACT;
return NULL;
}
static bool IsNull(const element_t &name)
{
LIMITED_METHOD_CONTRACT;
return (name == NULL);
}
static BOOL Equals(key_t pIAssemblyNameInMap, key_t pIAssemblyNameToCheck)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
PRECONDITION(CheckPointer(pIAssemblyNameInMap));
PRECONDITION(CheckPointer(pIAssemblyNameToCheck));
}
CONTRACTL_END;
DWORD dwMask = ASM_CMPF_NAME;
if (CAssemblyName::IsStronglyNamed(pIAssemblyNameInMap))
dwMask |= ASM_CMPF_PUBLIC_KEY_TOKEN;
DWORD cbSize = 0;
HRESULT hr = pIAssemblyNameInMap->GetProperty(ASM_NAME_MAJOR_VERSION, static_cast<PBYTE>(nullptr), &cbSize);
if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
dwMask |= ASM_CMPF_VERSION;
cbSize = 0;
hr = pIAssemblyNameInMap->GetProperty(ASM_NAME_ARCHITECTURE, static_cast<PBYTE>(nullptr), &cbSize);
if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
dwMask |= ASM_CMPF_ARCHITECTURE;
hr = pIAssemblyNameToCheck->IsEqual(pIAssemblyNameInMap,
dwMask);
return (hr == S_OK);
}
static count_t Hash(key_t pIAssemblyName)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
PRECONDITION(CheckPointer(pIAssemblyName));
}
CONTRACTL_END;
DWORD dwHash = 0;
// use only simple name for hashing
if (FAILED(CAssemblyName::GetHash(pIAssemblyName,0,
0xffffffff,
&dwHash)))
{
// Returning bogus hash is safe; it will cause Equals to be called more often
dwHash = 0;
}
return static_cast<count_t>(dwHash);
}
};
typedef SHash<AssemblyNameListHashTraits> AssemblyNameList;
#endif // ASSEMBLYNAMELISTHASHTRAITS_H
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "common.h" #include "common.h"
#include "thekey.h" #include "thekey.h"
#include "../binder/inc/fusionassemblyname.hpp"
VOID BaseAssemblySpec::CloneFieldsToStackingAllocator( StackingAllocator* alloc) VOID BaseAssemblySpec::CloneFieldsToStackingAllocator( StackingAllocator* alloc)
{ {
CONTRACTL CONTRACTL
...@@ -618,7 +620,7 @@ HRESULT BaseAssemblySpec::CreateFusionName( ...@@ -618,7 +620,7 @@ HRESULT BaseAssemblySpec::CreateFusionName(
SmallStackSString ssAssemblyName; SmallStackSString ssAssemblyName;
fMustBeBindable ? GetEncodedName(ssAssemblyName) : GetName(ssAssemblyName); fMustBeBindable ? GetEncodedName(ssAssemblyName) : GetName(ssAssemblyName);
IfFailGo(CreateAssemblyNameObject(&pFusionAssemblyName, ssAssemblyName.GetUnicode(), 0, NULL)); IfFailGo(CreateAssemblyNameObject(&pFusionAssemblyName, ssAssemblyName.GetUnicode(), false /*parseDisplayName*/));
holder = pFusionAssemblyName; holder = pFusionAssemblyName;
......
...@@ -203,8 +203,7 @@ STDAPI ...@@ -203,8 +203,7 @@ STDAPI
CreateAssemblyNameObjectFromMetaData( CreateAssemblyNameObjectFromMetaData(
LPASSEMBLYNAME *ppAssemblyName, LPASSEMBLYNAME *ppAssemblyName,
LPCOLESTR szAssemblyName, LPCOLESTR szAssemblyName,
ASSEMBLYMETADATA *pamd, ASSEMBLYMETADATA *pamd);
LPVOID pvReserved);
//===================================================================================================================== //=====================================================================================================================
HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
...@@ -311,7 +310,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( ...@@ -311,7 +310,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
// assembly def row. // assembly def row.
// See comment on CLRPrivBinderWinRT::PreBind for further details about NGEN binding and WinMDs. // See comment on CLRPrivBinderWinRT::PreBind for further details about NGEN binding and WinMDs.
ASSEMBLYMETADATA asmd = { 0 }; ASSEMBLYMETADATA asmd = { 0 };
IfFailGo(CreateAssemblyNameObjectFromMetaData(&pAssemblyDefName, wszFileNameStripped, &asmd, NULL)); IfFailGo(CreateAssemblyNameObjectFromMetaData(&pAssemblyDefName, wszFileNameStripped, &asmd));
DWORD dwAsmContentType = AssemblyContentType_WindowsRuntime; DWORD dwAsmContentType = AssemblyContentType_WindowsRuntime;
IfFailGo(pAssemblyDefName->SetProperty(ASM_NAME_CONTENT_TYPE, (LPBYTE)&dwAsmContentType, sizeof(dwAsmContentType))); IfFailGo(pAssemblyDefName->SetProperty(ASM_NAME_CONTENT_TYPE, (LPBYTE)&dwAsmContentType, sizeof(dwAsmContentType)));
......
...@@ -164,7 +164,7 @@ VOID AssemblySpec::Bind(AppDomain *pAppDomain, ...@@ -164,7 +164,7 @@ VOID AssemblySpec::Bind(AppDomain *pAppDomain,
// For name based binding these arguments shouldn't have been changed from default // For name based binding these arguments shouldn't have been changed from default
_ASSERTE(!fNgenExplicitBind && !fExplicitBindToNativeImage); _ASSERTE(!fNgenExplicitBind && !fExplicitBindToNativeImage);
SafeComHolder<IAssemblyName> pName; SafeComHolder<IAssemblyName> pName;
hr = CreateAssemblyNameObject(&pName, assemblyDisplayName, CANOF_PARSE_DISPLAY_NAME, NULL); hr = CreateAssemblyNameObject(&pName, assemblyDisplayName, true /*parseDisplayName*/);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = pBinder->BindAssemblyByName(pName, &pPrivAsm); hr = pBinder->BindAssemblyByName(pName, &pPrivAsm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册