From: Elinor Fung <47805090+elinor-fung@users.noreply.github.com> Date: Fri, 1 Nov 2019 02:34:48 +0000 (-0700) Subject: Remove unused functions on IAssemblyName (dotnet/coreclr#27592) X-Git-Tag: submit/tizen/20210909.063632~11030^2~164 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=10b535d6dda5279c374c6c6284e7a18ef70024af;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Remove unused functions on IAssemblyName (dotnet/coreclr#27592) Commit migrated from https://github.com/dotnet/coreclr/commit/24b4e11161cf217672fcd3c62158b12c93822e18 --- diff --git a/src/coreclr/src/binder/assemblyname.cpp b/src/coreclr/src/binder/assemblyname.cpp index 005c51d..948c299 100644 --- a/src/coreclr/src/binder/assemblyname.cpp +++ b/src/coreclr/src/binder/assemblyname.cpp @@ -304,73 +304,6 @@ namespace BINDER_SPACE Exit: return hr; } - - HRESULT AssemblyName::CreateFusionName(IAssemblyName **ppIAssemblyName) - { - HRESULT hr = S_OK; - ReleaseHolder 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(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() { @@ -530,21 +463,6 @@ Exit: 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, DWORD dwIncludeFlags) { diff --git a/src/coreclr/src/binder/fusionassemblyname.cpp b/src/coreclr/src/binder/fusionassemblyname.cpp index 28832be..560c9d7 100644 --- a/src/coreclr/src/binder/fusionassemblyname.cpp +++ b/src/coreclr/src/binder/fusionassemblyname.cpp @@ -296,207 +296,6 @@ CAssemblyName::GetProperty(DWORD PropertyId, } // --------------------------------------------------------------------------- -// CAssemblyName::Finalize -// --------------------------------------------------------------------------- -STDMETHODIMP -CAssemblyName::Finalize() -{ - BEGIN_ENTRYPOINT_NOTHROW; - - _fIsFinalized = TRUE; - END_ENTRYPOINT_NOTHROW; - - return S_OK; -} -// --------------------------------------------------------------------------- -// CAssemblyName::GetDisplayName -// --------------------------------------------------------------------------- -STDMETHODIMP -CAssemblyName::GetDisplayName( __out_ecount_opt(*pccDisplayName) LPOLESTR szDisplayName, - __inout LPDWORD pccDisplayName, - DWORD dwDisplayFlags) -{ - HRESULT hr = S_OK; - - BEGIN_ENTRYPOINT_NOTHROW; - - if (!dwDisplayFlags) { - dwDisplayFlags = ASM_DISPLAYF_DEFAULT; - } - - // Validate input buffer. - if(!pccDisplayName || (!szDisplayName && *pccDisplayName)) { - hr = E_INVALIDARG; - goto exit; - } - - EX_TRY - { - NewHolder pAssemblyIdentity = new BINDER_SPACE::AssemblyIdentity(); - FusionProperty prop; - StackSString textualIdentity; - - // Name required - prop = _rProp[ASM_NAME_NAME]; - if (prop.cb == 0) { - hr = FUSION_E_INVALID_NAME; - goto exit; - } - else { - _ASSERTE(prop.cb >= sizeof(WCHAR)); - - pAssemblyIdentity->m_simpleName.Set((const WCHAR *) prop.pv, - (prop.cb - sizeof(WCHAR)) / sizeof(WCHAR)); - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_SIMPLE_NAME); - } - - // Display version - if (dwDisplayFlags & ASM_DISPLAYF_VERSION) { - prop = _rProp[ASM_NAME_MAJOR_VERSION]; - - // Set version if we have it - if (prop.cb != 0) { - DWORD dwVersionParts[4]; - - for(DWORD i = 0; i < 4; i++) { - prop = _rProp[ASM_NAME_MAJOR_VERSION + i]; - - // Normalize non-existing version parts to zero - if (prop.cb == sizeof(WORD)) { - dwVersionParts[i] = (DWORD) (* ((WORD *) prop.pv)); - } - else { - dwVersionParts[i] = 0; - } - } - - pAssemblyIdentity->m_version.SetFeatureVersion(dwVersionParts[0], dwVersionParts[1]); - pAssemblyIdentity->m_version.SetServiceVersion(dwVersionParts[2], dwVersionParts[3]); - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_VERSION); - } - } - - // Display culture - if (dwDisplayFlags & ASM_DISPLAYF_CULTURE) { - prop = _rProp[ASM_NAME_CULTURE]; - - if (prop.cb != 0) { - _ASSERTE(prop.cb >= sizeof(WCHAR)); - - if (((const WCHAR *) prop.pv)[0] != 0x00) { - pAssemblyIdentity->m_cultureOrLanguage. - Set((const WCHAR *) prop.pv, - (prop.cb - sizeof(WCHAR)) / sizeof(WCHAR)); - } - - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_CULTURE); - } - } - - // Display public key token - if ((dwDisplayFlags & ASM_DISPLAYF_PUBLIC_KEY_TOKEN) && _fPublicKeyToken) { - prop = _rProp[ASM_NAME_PUBLIC_KEY_TOKEN]; - - if (prop.cb != 0) { - pAssemblyIdentity->m_publicKeyOrTokenBLOB.Set((const BYTE *) prop.pv, prop.cb); - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY_TOKEN); - } - else { - pAssemblyIdentity-> - SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_PUBLIC_KEY_TOKEN_NULL); - } - } - - // Display processor architecture - if (dwDisplayFlags & ASM_DISPLAYF_PROCESSORARCHITECTURE) { - if (_rProp[ASM_NAME_ARCHITECTURE].cb != 0) { - DWORD PeKind = *((LPDWORD)_rProp[ASM_NAME_ARCHITECTURE].pv); - - if (PeKind != peNone) { - pAssemblyIdentity->m_kProcessorArchitecture = (PEKIND) PeKind; - pAssemblyIdentity-> - SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_PROCESSOR_ARCHITECTURE); - } - } - } - - // Display retarget flag - if (dwDisplayFlags & ASM_DISPLAYF_RETARGET) { - prop = _rProp[ASM_NAME_RETARGET]; - - if (prop.cb != 0) { - BOOL fRetarget = *((LPBOOL) prop.pv); - - if (fRetarget) - { - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_RETARGETABLE); - } - } - } - - // Display content type - if (dwDisplayFlags & ASM_DISPLAYF_CONTENT_TYPE) - { - prop = _rProp[ASM_NAME_CONTENT_TYPE]; - if (prop.cb != 0) - { - DWORD dwContentType = *((LPDWORD)prop.pv); - if (dwContentType != AssemblyContentType_Default) - { - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_CONTENT_TYPE); - pAssemblyIdentity->m_kContentType = (AssemblyContentType)dwContentType; - } - } - } - - // Display custom flag - if ((dwDisplayFlags & ASM_DISPLAYF_CUSTOM) && _fCustom) { - prop = _rProp[ASM_NAME_CUSTOM]; - - if (prop.cb != 0) { - pAssemblyIdentity->m_customBLOB.Set((const BYTE *) prop.pv, prop.cb); - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_CUSTOM); - } - else { - pAssemblyIdentity->SetHave(BINDER_SPACE::AssemblyIdentity::IDENTITY_FLAG_CUSTOM_NULL); - } - } - - // Create the textual identity - hr = BINDER_SPACE::TextualIdentityParser::ToString(pAssemblyIdentity, - pAssemblyIdentity->m_dwIdentityFlags, - textualIdentity); - if (FAILED(hr)) { - goto exit; - } - - // Determine required buffer size - DWORD dwGivenSize = *pccDisplayName; - DWORD dwRequiredSize = textualIdentity.GetCount() + 1; - - *pccDisplayName = dwRequiredSize; - - if (dwRequiredSize > dwGivenSize) { - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); - - if (szDisplayName) { - szDisplayName[0] = 0x00; - } - goto exit; - } - else { - hr = S_OK; - memcpy(szDisplayName, textualIdentity.GetUnicode(), dwRequiredSize * sizeof(WCHAR)); - } - } - EX_CATCH_HRESULT(hr); - - exit: - END_ENTRYPOINT_NOTHROW; - return hr; -} - -// --------------------------------------------------------------------------- // CAssemblyName::GetName // --------------------------------------------------------------------------- STDMETHODIMP @@ -516,380 +315,6 @@ CAssemblyName::GetName( } // --------------------------------------------------------------------------- -// CAssemblyName::GetVersion -// --------------------------------------------------------------------------- -STDMETHODIMP -CAssemblyName::GetVersion( - /* [out] */ LPDWORD pdwVersionHi, - /* [out] */ LPDWORD pdwVersionLow) -{ - HRESULT hr = S_OK; - BEGIN_ENTRYPOINT_NOTHROW; - - // Get Assembly Version - hr = GetVersion( ASM_NAME_MAJOR_VERSION, pdwVersionHi, pdwVersionLow); - - END_ENTRYPOINT_NOTHROW; - return hr; -} - -// --------------------------------------------------------------------------- -// CAssemblyName::IsEqual -// --------------------------------------------------------------------------- -STDMETHODIMP -CAssemblyName::IsEqual(LPASSEMBLYNAME pName, DWORD dwCmpFlags) -{ - HRESULT hr = S_OK; - - BEGIN_ENTRYPOINT_NOTHROW; - - DWORD dwPartialCmpMask = 0; - BOOL fIsPartial = FALSE; - CAssemblyName *pCName = static_cast(pName); - - const DWORD SIMPLE_VERSION_MASK = ASM_CMPF_VERSION; - - FusionProperty propThis; - FusionProperty propPara; - - if(!pName) { - hr = S_FALSE; - goto Exit; - } - - // Get the ref partial comparison mask, if any. - fIsPartial = CAssemblyName::IsPartial(this, &dwPartialCmpMask); - - if (dwCmpFlags == ASM_CMPF_DEFAULT) { - // Set all comparison flags. - dwCmpFlags = ASM_CMPF_IL_ALL | ASM_CMPF_ARCHITECTURE; - - // don't compare architecture if ref does not have architecture. - if (!(dwPartialCmpMask & ASM_CMPF_ARCHITECTURE)) { - dwCmpFlags &= ~ASM_CMPF_ARCHITECTURE; - } - - // Otherwise, if ref is simple (possibly partial) - // we mask off all version bits. - if (!CAssemblyName::IsStronglyNamed(this)) - { - // we don't have a public key token, but we don't know - // it is because we are simply named assembly or we are - // just partial on public key token. - if (dwPartialCmpMask & ASM_CMPF_PUBLIC_KEY_TOKEN) - { - // now we know we are simply named assembly since we - // have a public key token, but it is NULL. - dwCmpFlags &= ~SIMPLE_VERSION_MASK; - } - // If neither of these two cases then public key token - // is not set in ref , but def may be simple or strong. - // The comparison mask is chosen based on def. - else - { - if (!CAssemblyName::IsStronglyNamed(pName)) - dwCmpFlags &= ~SIMPLE_VERSION_MASK; - } - } - } - - // Mask off flags (either passed in or generated - // by default flag with the comparison mask generated - // from the ref. - dwCmpFlags &= dwPartialCmpMask; - - - // The individual name fields can now be compared.. - - // Compare name - - if (dwCmpFlags & ASM_CMPF_NAME) - { - propThis = _rProp[ASM_NAME_NAME]; - propPara = pCName->_rProp[ASM_NAME_NAME]; - - if (propThis.cb != propPara.cb) - { - hr = S_FALSE; - goto Exit; - } - - if (propThis.cb && FusionCompareStringI((LPWSTR)propThis.pv, (LPWSTR)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - // Compare version - - if (dwCmpFlags & ASM_CMPF_MAJOR_VERSION) - { - propThis = _rProp[ASM_NAME_MAJOR_VERSION]; - propPara = pCName->_rProp[ASM_NAME_MAJOR_VERSION]; - - if (*((LPWORD) propThis.pv) != *((LPWORD)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - if (dwCmpFlags & ASM_CMPF_MINOR_VERSION) - { - propThis = _rProp[ASM_NAME_MINOR_VERSION]; - propPara = pCName->_rProp[ASM_NAME_MINOR_VERSION]; - - if (*((LPWORD) propThis.pv) != *((LPWORD)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - if (dwCmpFlags & ASM_CMPF_REVISION_NUMBER) - { - propThis = _rProp[ASM_NAME_REVISION_NUMBER]; - propPara = pCName->_rProp[ASM_NAME_REVISION_NUMBER]; - - if (*((LPWORD) propThis.pv) != *((LPWORD)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - if (dwCmpFlags & ASM_CMPF_BUILD_NUMBER) - { - propThis = _rProp[ASM_NAME_BUILD_NUMBER]; - propPara = pCName->_rProp[ASM_NAME_BUILD_NUMBER]; - - if (*((LPWORD) propThis.pv) != *((LPWORD)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - // Compare public key token - - if (dwCmpFlags & ASM_CMPF_PUBLIC_KEY_TOKEN) - { - // compare public key if both of them have public key set. - propThis = _rProp[ASM_NAME_PUBLIC_KEY]; - propPara = pCName->_rProp[ASM_NAME_PUBLIC_KEY]; - if (!propThis.cb || !propPara.cb) { - // otherwise, compare public key token - propThis = _rProp[ASM_NAME_PUBLIC_KEY_TOKEN]; - propPara = pCName->_rProp[ASM_NAME_PUBLIC_KEY_TOKEN]; - } - - if (propThis.cb != propPara.cb) { - hr = S_FALSE; - goto Exit; - } - - if (propThis.cb && memcmp(propThis.pv, propPara.pv, propThis.cb)) { - hr = S_FALSE; - goto Exit; - } - } - - // Compare Culture - - if (dwCmpFlags & ASM_CMPF_CULTURE) - { - propThis = _rProp[ASM_NAME_CULTURE]; - propPara = pCName->_rProp[ASM_NAME_CULTURE]; - - if (propThis.cb != propPara.cb) - { - hr = S_FALSE; - goto Exit; - } - - if (propThis.cb && FusionCompareStringI((LPWSTR)propThis.pv, (LPWSTR)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - // Compare Custom attribute. - - if (dwCmpFlags & ASM_CMPF_CUSTOM) - { - propThis = _rProp[ASM_NAME_PUBLIC_KEY_TOKEN]; - propPara = pCName->_rProp[ASM_NAME_PUBLIC_KEY_TOKEN]; - - if (propThis.cb != propPara.cb) { - hr = S_FALSE; - goto Exit; - } - - if (propThis.cb && memcmp(propThis.pv, propPara.pv, propThis.cb)) { - hr = S_FALSE; - goto Exit; - } - } - - // Compare Retarget flag - if (dwCmpFlags & ASM_CMPF_RETARGET) - { - propThis = _rProp[ASM_NAME_RETARGET]; - propPara = pCName->_rProp[ASM_NAME_RETARGET]; - - if (*((LPDWORD) propThis.pv) != *((LPDWORD)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - // compare config mask - if (dwCmpFlags & ASM_CMPF_CONFIG_MASK) - { - propThis = _rProp[ASM_NAME_CONFIG_MASK]; - propPara = pCName->_rProp[ASM_NAME_CONFIG_MASK]; - - if (*((LPDWORD) propThis.pv) != *((LPDWORD)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - - } - - // compare architecture - if (dwCmpFlags & ASM_CMPF_ARCHITECTURE) - { - propThis = _rProp[ASM_NAME_ARCHITECTURE]; - propPara = pCName->_rProp[ASM_NAME_ARCHITECTURE]; - - if (propThis.cb != propPara.cb) { - hr = S_FALSE; - goto Exit; - } - - if (propThis.cb) { - if (*((LPDWORD) propThis.pv) != *((LPDWORD)propPara.pv)) { - hr = S_FALSE; - goto Exit; - } - } - } - - // Compare content type - if (dwCmpFlags & ASM_CMPF_CONTENT_TYPE) - { - propThis = _rProp[ASM_NAME_CONTENT_TYPE]; - propPara = pCName->_rProp[ASM_NAME_CONTENT_TYPE]; - - if (*((LPDWORD)propThis.pv) != *((LPDWORD)propPara.pv)) - { - hr = S_FALSE; - goto Exit; - } - } - - // compare MVID - if (dwCmpFlags & ASM_CMPF_MVID) - { - propThis = _rProp[ASM_NAME_MVID]; - propPara = pCName->_rProp[ASM_NAME_MVID]; - - if (propThis.cb != propPara.cb) { - hr = S_FALSE; - goto Exit; - } - - if (propThis.cb && memcmp(propThis.pv, propPara.pv, propThis.cb)) { - hr = S_FALSE; - goto Exit; - } - } - - // compare Signature - if (dwCmpFlags & ASM_CMPF_SIGNATURE) - { - propThis = _rProp[ASM_NAME_SIGNATURE_BLOB]; - propPara = pCName->_rProp[ASM_NAME_SIGNATURE_BLOB]; - - if (propThis.cb != propPara.cb) { - hr = S_FALSE; - goto Exit; - } - - if (propThis.cb && memcmp(propThis.pv, propPara.pv, propThis.cb)) { - hr = S_FALSE; - goto Exit; - } - } - - hr = S_OK; -Exit: - END_ENTRYPOINT_NOTHROW; - return hr; -} - -// --------------------------------------------------------------------------- -// CAssemblyName::Reserved -// --------------------------------------------------------------------------- -STDMETHODIMP -CAssemblyName::Reserved( - /* in */ REFIID refIID, - /* in */ IUnknown *pUnkBindSink, - /* in */ IUnknown *pUnkAppCtx, - /* in */ LPCOLESTR szCodebaseIn, - /* in */ LONGLONG llFlags, - /* in */ LPVOID pvReserved, - /* in */ DWORD cbReserved, - /* out */ VOID **ppv) -{ - return E_NOTIMPL; -} - -// --------------------------------------------------------------------------- -// CAssemblyName::Clone -// --------------------------------------------------------------------------- -HRESULT CAssemblyName::Clone(IAssemblyName **ppName) -{ - HRESULT hr = S_OK; - - BEGIN_ENTRYPOINT_NOTHROW; - - CAssemblyName *pClone = NULL; - - if (!ppName) { - hr = E_INVALIDARG; - goto Exit; - } - - *ppName = NULL; - - pClone = NEW(CAssemblyName); - if( !pClone ) { - hr = E_OUTOFMEMORY; - goto Exit; - } - - hr = CopyProperties(this, pClone, NULL, 0); - if (FAILED(hr)) { - goto Exit; - } - - *ppName = pClone; - (*ppName)->AddRef(); - -Exit: - SAFERELEASE(pClone); - - END_ENTRYPOINT_NOTHROW; - - return hr; -} - -// --------------------------------------------------------------------------- // CAssemblyName::SetPropertyInternal // --------------------------------------------------------------------------- HRESULT CAssemblyName::SetPropertyInternal(DWORD PropertyId, @@ -900,14 +325,6 @@ HRESULT CAssemblyName::SetPropertyInternal(DWORD PropertyId, LPBYTE pbSN = NULL; DWORD cbSN = 0; - // Fail if finalized. - if (_fIsFinalized) - { - _ASSERTE(!"SetProperty on a IAssemblyName while the name is finalized!"); - hr = E_UNEXPECTED; - goto exit; - } - if (PropertyId >= ASM_NAME_MAX_PARAMS || (!pvProperty && cbProperty)) { @@ -1032,62 +449,6 @@ exit: return hr; } - - -// --------------------------------------------------------------------------- -// CheckFieldsForFriendAssembly -// --------------------------------------------------------------------------- -STDAPI -CheckFieldsForFriendAssembly( - LPASSEMBLYNAME pAssemblyName) -{ - HRESULT hr = S_OK; - DWORD dwSize=0; - - // Let's look at the information they gave us in the friends declaration. - // If they put in a Processor Architecture, Culture, or Version, then we'll return an error. - - if (FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_MAJOR_VERSION, NULL, &dwSize)) || - FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_MINOR_VERSION, NULL, &dwSize)) || - FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_BUILD_NUMBER, NULL, &dwSize)) || - FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_REVISION_NUMBER, NULL, &dwSize)) || - FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_CULTURE, NULL, &dwSize)) || - FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_ARCHITECTURE, NULL, &dwSize))) - { - // If any of these calls failed due to an insufficient buffer, then that means - // the assembly name contained them - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - hr = META_E_CA_BAD_FRIENDS_ARGS; - } else { - if (FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_PUBLIC_KEY_TOKEN, NULL, &dwSize))) { - - // - // Public Key token should not be passed to InternalsVisibleTo - // attribute. This translates to the ASM_NAME_PUBLIC_KEY_TOKEN - // property being set, while the full public key is not. - // - - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) { - - dwSize = 0; - - if (FAILED(hr = pAssemblyName->GetProperty(ASM_NAME_PUBLIC_KEY, NULL, &dwSize))) { - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - hr = S_OK; - } else { - hr = META_E_CA_BAD_FRIENDS_ARGS; - } - - } - } else { - hr = S_OK; - } - } - - - return hr; -} - // --------------------------------------------------------------------------- // CreateAssemblyNameObject // --------------------------------------------------------------------------- @@ -1097,8 +458,7 @@ STDAPI CreateAssemblyNameObject( LPASSEMBLYNAME *ppAssemblyName, LPCOLESTR szAssemblyName, - DWORD dwFlags, - LPVOID pvReserved) + bool parseDisplayName) { HRESULT hr = S_OK; @@ -1120,7 +480,7 @@ CreateAssemblyNameObject( goto exit; } - if (dwFlags & CANOF_PARSE_DISPLAY_NAME) + if (parseDisplayName) { hr = pName->Init(NULL, NULL); if (FAILED(hr)) { @@ -1134,13 +494,6 @@ CreateAssemblyNameObject( hr = pName->Init(szAssemblyName, NULL); } - - if (SUCCEEDED(hr) && ((dwFlags & CANOF_VERIFY_FRIEND_ASSEMBLYNAME))) - { - hr = CheckFieldsForFriendAssembly(pName); - } - - if (FAILED(hr)) { SAFERELEASE(pName); @@ -1161,8 +514,7 @@ STDAPI CreateAssemblyNameObjectFromMetaData( LPASSEMBLYNAME *ppAssemblyName, LPCOLESTR szAssemblyName, - ASSEMBLYMETADATA *pamd, - LPVOID pvReserved) + ASSEMBLYMETADATA *pamd) { HRESULT hr = S_OK; @@ -1195,7 +547,6 @@ exit: CAssemblyName::CAssemblyName() { _dwSig = 0x454d414e; /* 'EMAN' */ - _fIsFinalized = FALSE; _fPublicKeyToken = FALSE; _fCustom = TRUE; _cRef = 1; @@ -1215,97 +566,6 @@ CAssemblyName::~CAssemblyName() } // --------------------------------------------------------------------------- -// CAssemblyName::IsStronglyNamed -// --------------------------------------------------------------------------- -BOOL CAssemblyName::IsStronglyNamed(IAssemblyName *pName) -{ - CAssemblyName *pCName = static_cast (pName); - _ASSERTE(pCName); - - return (pCName->_rProp[ASM_NAME_PUBLIC_KEY_TOKEN].cb != 0); -} - -// --------------------------------------------------------------------------- -// CAssemblyName::IsPartial -// --------------------------------------------------------------------------- -BOOL CAssemblyName::IsPartial(IAssemblyName *pIName, - LPDWORD pdwCmpMask) -{ - DWORD dwCmpMask = 0; - BOOL fPartial = FALSE; - - static const ASM_NAME rNameFlags[] ={ASM_NAME_NAME, - ASM_NAME_CULTURE, - ASM_NAME_PUBLIC_KEY_TOKEN, - ASM_NAME_MAJOR_VERSION, - ASM_NAME_MINOR_VERSION, - ASM_NAME_BUILD_NUMBER, - ASM_NAME_REVISION_NUMBER, - ASM_NAME_CUSTOM - }; - - static const ASM_CMP_FLAGS rCmpFlags[] = {ASM_CMPF_NAME, - ASM_CMPF_CULTURE, - ASM_CMPF_PUBLIC_KEY_TOKEN, - ASM_CMPF_MAJOR_VERSION, - ASM_CMPF_MINOR_VERSION, - ASM_CMPF_BUILD_NUMBER, - ASM_CMPF_REVISION_NUMBER, - ASM_CMPF_CUSTOM - }; - - CAssemblyName *pName = static_cast (pIName); // dynamic_cast - _ASSERTE(pName); - - DWORD iNumOfComparison = sizeof(rNameFlags) / sizeof(rNameFlags[0]); - - for (DWORD i = 0; i < iNumOfComparison; i++) - { - if (pName->_rProp[rNameFlags[i]].cb - || (rNameFlags[i] == ASM_NAME_PUBLIC_KEY_TOKEN - && pName->_fPublicKeyToken) - || (rNameFlags[i] == ASM_NAME_CUSTOM - && pName->_fCustom)) - { - dwCmpMask |= rCmpFlags[i]; - } - else { - fPartial = TRUE; - } - } - - if(pName->_rProp[ASM_NAME_ARCHITECTURE].cb) { - dwCmpMask |= ASM_CMPF_ARCHITECTURE; - } - - if (pName->_rProp[ASM_NAME_RETARGET].cb) { - dwCmpMask |= ASM_CMPF_RETARGET; - } - - if (pName->_rProp[ASM_NAME_CONTENT_TYPE].cb != 0) - { - dwCmpMask |= ASM_CMPF_CONTENT_TYPE; - } - - if (pName->_rProp[ASM_NAME_CONFIG_MASK].cb) { - dwCmpMask |= ASM_CMPF_CONFIG_MASK; - } - - if (pName->_rProp[ASM_NAME_MVID].cb) { - dwCmpMask |= ASM_CMPF_MVID; - } - - if (pName->_rProp[ASM_NAME_SIGNATURE_BLOB].cb) { - dwCmpMask |= ASM_CMPF_SIGNATURE; - } - - if (pdwCmpMask) - *pdwCmpMask = dwCmpMask; - - return fPartial; -} - -// --------------------------------------------------------------------------- // CAssemblyName::Init // --------------------------------------------------------------------------- HRESULT @@ -1502,171 +762,6 @@ HRESULT CAssemblyName::Parse(__in_z LPCWSTR szDisplayName) return hr; } -// --------------------------------------------------------------------------- -// CAssemblyName::GetVersion -// --------------------------------------------------------------------------- -HRESULT -CAssemblyName::GetVersion( - /* [in] */ DWORD dwMajorVersionEnumValue, - /* [out] */ LPDWORD pdwVersionHi, - /* [out] */ LPDWORD pdwVersionLow) -{ - HRESULT hr = S_OK; - DWORD cb = sizeof(WORD); - WORD wVerMajor = 0, wVerMinor = 0, wRevNo = 0, wBldNo = 0; - - if(!pdwVersionHi || !pdwVersionLow) { - hr = E_INVALIDARG; - goto Exit; - } - - *pdwVersionHi = *pdwVersionLow = 0; - - if(FAILED( (hr = GetProperty(dwMajorVersionEnumValue, &wVerMajor, &(cb = sizeof(WORD)))))) - goto Exit; - if (cb == 0) { - hr = FUSION_E_INVALID_NAME; - goto Exit; - } - - if(FAILED( (hr = GetProperty(dwMajorVersionEnumValue+1, &wVerMinor, &(cb = sizeof(WORD)))))) - goto Exit; - - if (cb == 0) { - hr = FUSION_E_INVALID_NAME; - goto Exit; - } - - if(FAILED( (hr = GetProperty(dwMajorVersionEnumValue+2, &wBldNo, &(cb = sizeof(WORD)))))) - goto Exit; - if (cb == 0) { - hr = FUSION_E_INVALID_NAME; - goto Exit; - } - - if(FAILED( (hr = GetProperty(dwMajorVersionEnumValue+3, &wRevNo, &(cb = sizeof(WORD)))))) - goto Exit; - - if (cb == 0) { - hr = FUSION_E_INVALID_NAME; - goto Exit; - } - - *pdwVersionHi = MAKELONG(wVerMinor, wVerMajor); - *pdwVersionLow = MAKELONG(wRevNo, wBldNo); - -Exit: - return hr; -} - -// --------------------------------------------------------------------------- -// CAssemblyName::CopyProperties -// --------------------------------------------------------------------------- -HRESULT -CAssemblyName::CopyProperties(CAssemblyName *pSource, - CAssemblyName *pTarget, - const DWORD properties[], - DWORD dwSize) -{ - HRESULT hr = S_OK; - DWORD i = 0; - FusionProperty prop; - - _ASSERTE(pSource && pTarget); - - if (!dwSize) { - for( i = 0; i < ASM_NAME_MAX_PARAMS; i ++) { - prop = pSource->_rProp[i]; - - if (prop.cb) { - if (FAILED(hr = pTarget->SetProperty(i, prop.pv, prop.cb))) { - goto Exit; - } - } - } - } - else { - for (i = 0; i_rProp[properties[i]]; - if (prop.cb) { - if (FAILED(hr = pTarget->SetProperty(properties[i], prop.pv, prop.cb))) { - goto Exit; - } - } - } - } - - pTarget->_fPublicKeyToken = pSource->_fPublicKeyToken; - pTarget->_fCustom = pSource->_fCustom; - - if (pSource->_pwzPathModifier) { - pTarget->_pwzPathModifier = WSTRDupDynamic(pSource->_pwzPathModifier); - if(!pTarget->_pwzPathModifier) { - hr = E_OUTOFMEMORY; - goto Exit; - } - } - -Exit: - return hr; -} - -namespace LegacyFusion -{ - HRESULT SetStringProperty(IAssemblyName *pIAssemblyName, - DWORD dwPropertyId, - SString &value) - { - CAssemblyName *pAssemblyName = static_cast(pIAssemblyName); - const WCHAR *pValue = value.GetUnicode(); - DWORD dwCBValue = (value.GetCount() + 1) * sizeof(WCHAR); - - return pAssemblyName->SetPropertyInternal(dwPropertyId, - const_cast(pValue), - dwCBValue); - } - - HRESULT SetBufferProperty(IAssemblyName *pIAssemblyName, - DWORD dwPropertyId, - SBuffer &value) - { - CAssemblyName *pAssemblyName = static_cast(pIAssemblyName); - const BYTE *pValue = value; // special operator - DWORD dwCBValue = value.GetSize() * sizeof(BYTE); - - return pAssemblyName->SetPropertyInternal(dwPropertyId, - const_cast(pValue), - dwCBValue); - } - - HRESULT SetWordProperty(IAssemblyName *pIAssemblyName, - DWORD dwPropertyId, - DWORD dwValue) - { - CAssemblyName *pAssemblyName = static_cast(pIAssemblyName); - WORD wValue = static_cast(dwValue); - DWORD wCBValue = sizeof(WORD); - - // This file-internal function is and must be only used to set version fields - PREFIX_ASSUME((dwPropertyId == ASM_NAME_MAJOR_VERSION) || - (dwPropertyId == ASM_NAME_MINOR_VERSION) || - (dwPropertyId == ASM_NAME_BUILD_NUMBER) || - (dwPropertyId == ASM_NAME_REVISION_NUMBER)); - - return pAssemblyName->SetPropertyInternal(dwPropertyId, &wValue, wCBValue); - } - - HRESULT SetDwordProperty(IAssemblyName *pIAssemblyName, - DWORD dwPropertyId, - DWORD dwValue) - { - CAssemblyName *pAssemblyName = static_cast(pIAssemblyName); - DWORD dwCBValue = sizeof(DWORD); - - return pAssemblyName->SetPropertyInternal(dwPropertyId, &dwValue, dwCBValue); - } -}; namespace fusion { namespace util @@ -1849,8 +944,6 @@ namespace fusion IfFailRet(hr); return hr; } - - } } diff --git a/src/coreclr/src/binder/inc/assemblyidentity.hpp b/src/coreclr/src/binder/inc/assemblyidentity.hpp index 16a4484..a757475 100644 --- a/src/coreclr/src/binder/inc/assemblyidentity.hpp +++ b/src/coreclr/src/binder/inc/assemblyidentity.hpp @@ -78,20 +78,6 @@ namespace BINDER_SPACE 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; AssemblyVersion m_version; SString m_cultureOrLanguage; diff --git a/src/coreclr/src/binder/inc/assemblyname.hpp b/src/coreclr/src/binder/inc/assemblyname.hpp index 591f424..ef121d1 100644 --- a/src/coreclr/src/binder/inc/assemblyname.hpp +++ b/src/coreclr/src/binder/inc/assemblyname.hpp @@ -43,7 +43,6 @@ namespace BINDER_SPACE /* in */ BOOL fIsDefinition = TRUE); HRESULT Init(/* in */ SString &assemblyDisplayName); HRESULT Init(/* in */ IAssemblyName *pIAssemblyName); - HRESULT CreateFusionName(/* out */ IAssemblyName **ppIAssemblyName); ULONG AddRef(); ULONG Release(); @@ -75,8 +74,6 @@ namespace BINDER_SPACE BOOL Equals(/* in */ AssemblyName *pAssemblyName, /* in */ DWORD dwIncludeFlags); - HRESULT Clone(/* out */ AssemblyName **ppAssemblyName); - void GetDisplayName(/* out */ PathString &displayName, /* in */ DWORD dwIncludeFlags); diff --git a/src/coreclr/src/binder/inc/fusionassemblyname.hpp b/src/coreclr/src/binder/inc/fusionassemblyname.hpp index e2d70c7..55599b6 100644 --- a/src/coreclr/src/binder/inc/fusionassemblyname.hpp +++ b/src/coreclr/src/binder/inc/fusionassemblyname.hpp @@ -45,7 +45,6 @@ private: DWORD _dwSig; Volatile _cRef; CPropertyArray _rProp; - BOOL _fIsFinalized; BOOL _fPublicKeyToken; BOOL _fCustom; LPWSTR _pwzPathModifier; @@ -69,37 +68,10 @@ public: /* out */ LPVOID pvProperty, /* in out */ LPDWORD pcbProperty); - STDMETHOD(Finalize)(); - - STDMETHOD(GetDisplayName)( - __out_ecount_opt(*pccDisplayName) LPOLESTR szDisplayName, - __inout LPDWORD pccDisplayName, - __in DWORD dwDisplayFlags); - STDMETHOD(GetName)( __inout LPDWORD lpcwBuffer, __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, /* in */ LPCVOID pvProperty, /* in */ DWORD cbProperty); @@ -109,51 +81,19 @@ public: HRESULT Init(LPCTSTR pszAssemblyName, ASSEMBLYMETADATA *pamd); 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 CreateAssemblyNameObject( LPASSEMBLYNAME *ppAssemblyName, LPCOLESTR szAssemblyName, - DWORD dwFlags, - LPVOID pvReserved); + bool parseDisplayName); STDAPI CreateAssemblyNameObjectFromMetaData( LPASSEMBLYNAME *ppAssemblyName, LPCOLESTR szAssemblyName, - 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); -}; + ASSEMBLYMETADATA *pamd); namespace fusion { diff --git a/src/coreclr/src/binder/inc/fusionhelpers.hpp b/src/coreclr/src/binder/inc/fusionhelpers.hpp index 18beba7..01e4384 100644 --- a/src/coreclr/src/binder/inc/fusionhelpers.hpp +++ b/src/coreclr/src/binder/inc/fusionhelpers.hpp @@ -54,23 +54,6 @@ #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 // bit mask macro helpers diff --git a/src/coreclr/src/inc/fusion.idl b/src/coreclr/src/inc/fusion.idl index 4056d16..71322a6 100644 --- a/src/coreclr/src/inc/fusion.idl +++ b/src/coreclr/src/inc/fusion.idl @@ -32,28 +32,6 @@ cpp_quote("#pragma once") 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 { AssemblyContentType_Default = 0x00000000, @@ -81,14 +59,7 @@ cpp_quote("EXTERN_GUID(IID_IAssemblyName, 0xCD193BC0, 0xB4BC, 0x11d2, 0x98, 0x33 interface IAssemblyName: IUnknown { 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 { ASM_NAME_PUBLIC_KEY = 0, // 0 @@ -153,43 +124,6 @@ interface IAssemblyName: IUnknown | ASM_DISPLAYF_PROCESSORARCHITECTURE | ASM_DISPLAYF_CONTENT_TYPE, } 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( [in] DWORD PropertyId, @@ -201,42 +135,8 @@ interface IAssemblyName: IUnknown [out] LPVOID pvProperty, [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( [in, out, annotation("_Inout_")] LPDWORD lpcwBuffer, [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); ") - diff --git a/src/coreclr/src/pal/prebuilt/inc/fusion.h b/src/coreclr/src/pal/prebuilt/inc/fusion.h index b7a5770..b8d17a3 100644 --- a/src/coreclr/src/pal/prebuilt/inc/fusion.h +++ b/src/coreclr/src/pal/prebuilt/inc/fusion.h @@ -7,7 +7,7 @@ /* 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( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ @@ -23,7 +23,7 @@ #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of -#endif // __RPCNDR_H_VERSION__ +#endif /* __RPCNDR_H_VERSION__ */ #ifndef COM_NO_WINDOWS_H #include "windows.h" @@ -68,26 +68,6 @@ extern "C"{ #ifdef _MSC_VER #pragma once #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 enum _tagAssemblyContentType { @@ -114,15 +94,6 @@ typedef /* [unique] */ IAssemblyName *LPASSEMBLYNAME; typedef /* [public] */ 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_TOKEN = ( ASM_NAME_PUBLIC_KEY + 1 ) , ASM_NAME_HASH_VALUE = ( ASM_NAME_PUBLIC_KEY_TOKEN + 1 ) , @@ -156,7 +127,7 @@ enum __MIDL_IAssemblyName_0002 } ASM_NAME; typedef /* [public] */ -enum __MIDL_IAssemblyName_0003 +enum __MIDL_IAssemblyName_0002 { ASM_DISPLAYF_VERSION = 0x1, ASM_DISPLAYF_CULTURE = 0x2, @@ -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_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; @@ -214,41 +162,12 @@ EXTERN_C const IID IID_IAssemblyName; /* [out] */ LPVOID pvProperty, /* [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( /* [annotation][out][in] */ _Inout_ LPDWORD lpcwBuffer, /* [annotation][out] */ _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; /* [out] */ LPVOID pvProperty, /* [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 )( IAssemblyName * This, /* [annotation][out][in] */ @@ -310,20 +208,6 @@ EXTERN_C const IID IID_IAssemblyName; /* [annotation][out] */ _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 } IAssemblyNameVtbl; @@ -353,27 +237,9 @@ EXTERN_C const IID IID_IAssemblyName; #define IAssemblyName_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) \ ( (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 */ @@ -385,15 +251,6 @@ EXTERN_C const IID IID_IAssemblyName; #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 */ /* end of Additional Prototypes */ diff --git a/src/coreclr/src/vm/assemblynamelist.h b/src/coreclr/src/vm/assemblynamelist.h deleted file mode 100644 index aba55e0..0000000 --- a/src/coreclr/src/vm/assemblynamelist.h +++ /dev/null @@ -1,110 +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. -// 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 > -{ -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(nullptr), &cbSize); - if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) - dwMask |= ASM_CMPF_VERSION; - - cbSize = 0; - hr = pIAssemblyNameInMap->GetProperty(ASM_NAME_ARCHITECTURE, static_cast(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(dwHash); - } -}; - - -typedef SHash AssemblyNameList; - -#endif // ASSEMBLYNAMELISTHASHTRAITS_H diff --git a/src/coreclr/src/vm/baseassemblyspec.cpp b/src/coreclr/src/vm/baseassemblyspec.cpp index f6859d4..b817364 100644 --- a/src/coreclr/src/vm/baseassemblyspec.cpp +++ b/src/coreclr/src/vm/baseassemblyspec.cpp @@ -14,6 +14,8 @@ #include "common.h" #include "thekey.h" +#include "../binder/inc/fusionassemblyname.hpp" + VOID BaseAssemblySpec::CloneFieldsToStackingAllocator( StackingAllocator* alloc) { CONTRACTL @@ -618,7 +620,7 @@ HRESULT BaseAssemblySpec::CreateFusionName( SmallStackSString ssAssemblyName; fMustBeBindable ? GetEncodedName(ssAssemblyName) : GetName(ssAssemblyName); - IfFailGo(CreateAssemblyNameObject(&pFusionAssemblyName, ssAssemblyName.GetUnicode(), 0, NULL)); + IfFailGo(CreateAssemblyNameObject(&pFusionAssemblyName, ssAssemblyName.GetUnicode(), false /*parseDisplayName*/)); holder = pFusionAssemblyName; diff --git a/src/coreclr/src/vm/clrprivbinderwinrt.cpp b/src/coreclr/src/vm/clrprivbinderwinrt.cpp index a282caa..09c1716 100644 --- a/src/coreclr/src/vm/clrprivbinderwinrt.cpp +++ b/src/coreclr/src/vm/clrprivbinderwinrt.cpp @@ -203,8 +203,7 @@ STDAPI CreateAssemblyNameObjectFromMetaData( LPASSEMBLYNAME *ppAssemblyName, LPCOLESTR szAssemblyName, - ASSEMBLYMETADATA *pamd, - LPVOID pvReserved); + ASSEMBLYMETADATA *pamd); //===================================================================================================================== HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( @@ -311,7 +310,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName( // assembly def row. // See comment on CLRPrivBinderWinRT::PreBind for further details about NGEN binding and WinMDs. ASSEMBLYMETADATA asmd = { 0 }; - IfFailGo(CreateAssemblyNameObjectFromMetaData(&pAssemblyDefName, wszFileNameStripped, &asmd, NULL)); + IfFailGo(CreateAssemblyNameObjectFromMetaData(&pAssemblyDefName, wszFileNameStripped, &asmd)); DWORD dwAsmContentType = AssemblyContentType_WindowsRuntime; IfFailGo(pAssemblyDefName->SetProperty(ASM_NAME_CONTENT_TYPE, (LPBYTE)&dwAsmContentType, sizeof(dwAsmContentType))); diff --git a/src/coreclr/src/vm/coreassemblyspec.cpp b/src/coreclr/src/vm/coreassemblyspec.cpp index 4dc61ec..effc034 100644 --- a/src/coreclr/src/vm/coreassemblyspec.cpp +++ b/src/coreclr/src/vm/coreassemblyspec.cpp @@ -164,7 +164,7 @@ VOID AssemblySpec::Bind(AppDomain *pAppDomain, // For name based binding these arguments shouldn't have been changed from default _ASSERTE(!fNgenExplicitBind && !fExplicitBindToNativeImage); SafeComHolder pName; - hr = CreateAssemblyNameObject(&pName, assemblyDisplayName, CANOF_PARSE_DISPLAY_NAME, NULL); + hr = CreateAssemblyNameObject(&pName, assemblyDisplayName, true /*parseDisplayName*/); if (SUCCEEDED(hr)) { hr = pBinder->BindAssemblyByName(pName, &pPrivAsm);