diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-08-14 06:34:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 06:34:34 -0700 |
commit | 0b5e0648bdaa1abacea803b90384f9b937af9fc3 (patch) | |
tree | 27c73836e0325589d38e6ce5dcd5c206c4d5e04f /src/vm | |
parent | 66b3197f69cf4669ba04a7a8121d33d9aa5d3c9d (diff) | |
download | coreclr-0b5e0648bdaa1abacea803b90384f9b937af9fc3.tar.gz coreclr-0b5e0648bdaa1abacea803b90384f9b937af9fc3.tar.bz2 coreclr-0b5e0648bdaa1abacea803b90384f9b937af9fc3.zip |
Delete dead code (#19452)
Unused strong name signing paths and related code
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/assemblynative.cpp | 95 | ||||
-rw-r--r-- | src/vm/assemblynative.hpp | 44 | ||||
-rw-r--r-- | src/vm/ceeload.cpp | 29 | ||||
-rw-r--r-- | src/vm/ceeload.h | 4 | ||||
-rw-r--r-- | src/vm/comdynamic.cpp | 536 | ||||
-rw-r--r-- | src/vm/comdynamic.h | 57 | ||||
-rw-r--r-- | src/vm/pefile.cpp | 65 | ||||
-rw-r--r-- | src/vm/pefile.h | 39 | ||||
-rw-r--r-- | src/vm/pefile.inl | 224 | ||||
-rw-r--r-- | src/vm/peimage.cpp | 64 | ||||
-rw-r--r-- | src/vm/peimage.h | 20 | ||||
-rw-r--r-- | src/vm/peimage.inl | 43 |
12 files changed, 4 insertions, 1216 deletions
diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp index 830cadffae..be1cbc39b9 100644 --- a/src/vm/assemblynative.cpp +++ b/src/vm/assemblynative.cpp @@ -1087,68 +1087,10 @@ void QCALLTYPE AssemblyNative::GetEntryPoint(QCall::AssemblyHandle pAssembly, QC //--------------------------------------------------------------------------------------- // -// Get the raw bytes making up this assembly -// -// Arguments: -// pAssembly - Assembly to get the data of -// retRawBytes - [out] raw bytes of the assembly -// - -// static -void QCALLTYPE AssemblyNative::GetRawBytes(QCall::AssemblyHandle pAssembly, - QCall::ObjectHandleOnStack retRawBytes) -{ - QCALL_CONTRACT; - BEGIN_QCALL; - - PEFile *pPEFile = pAssembly->GetFile(); - if (pPEFile != NULL) - { - PEImage *pPEImage = pPEFile->GetILimage(); - - if (pPEImage != NULL) - { - SBuffer dataBuffer; - pPEImage->GetImageBits(PEImageLayout::LAYOUT_FLAT, dataBuffer); - - if (dataBuffer.GetSize() > 0) - { - retRawBytes.SetByteArray(dataBuffer, dataBuffer.GetSize()); - } - } - } - - END_QCALL; -} - -//--------------------------------------------------------------------------------------- -// // Release QCALL for System.SafePEFileHandle // // -// static -void QCALLTYPE AssemblyNative::ReleaseSafePEFileHandle(PEFile *pPEFile) -{ - CONTRACTL - { - QCALL_CHECK; - PRECONDITION(CheckPointer(pPEFile)); - } - CONTRACTL_END; - - BEGIN_QCALL; - - pPEFile->Release(); - - END_QCALL; -} - -// save the manifest to disk! -extern void ManagedBitnessFlagsToUnmanagedBitnessFlags( - INT32 portableExecutableKind, INT32 imageFileMachine, - DWORD* pPeFlags, DWORD* pCorhFlags); - void QCALLTYPE AssemblyNative::GetFullName(QCall::AssemblyHandle pAssembly, QCall::StringHandleOnStack retString) { QCALL_CONTRACT; @@ -1203,22 +1145,6 @@ void QCALLTYPE AssemblyNative::GetEntryAssembly(QCall::ObjectHandleOnStack retAs return; } -// return the on disk assembly module for reflection emit. This only works for dynamic assembly. -FCIMPL1(ReflectModuleBaseObject *, AssemblyNative::GetOnDiskAssemblyModule, AssemblyBaseObject* pAssemblyUNSAFE) -{ - FCALL_CONTRACT; - - ASSEMBLYREF refAssembly = (ASSEMBLYREF)ObjectToOBJECTREF(pAssemblyUNSAFE); - - if (refAssembly == NULL) - FCThrowRes(kArgumentNullException, W("Arg_InvalidHandle")); - - DomainAssembly *pAssembly = refAssembly->GetDomainAssembly(); - - FC_RETURN_MODULE_OBJECT(pAssembly->GetCurrentAssembly()->GetOnDiskManifestModule(), refAssembly); -} -FCIMPLEND - // return the in memory assembly module for reflection emit. This only works for dynamic assembly. FCIMPL1(ReflectModuleBaseObject *, AssemblyNative::GetInMemoryAssemblyModule, AssemblyBaseObject* pAssemblyUNSAFE) { @@ -1257,27 +1183,6 @@ void QCALLTYPE AssemblyNative::GetImageRuntimeVersion(QCall::AssemblyHandle pAss END_QCALL; } - - -#ifdef FEATURE_APPX -/*static*/ -BOOL QCALLTYPE AssemblyNative::IsDesignerBindingContext(QCall::AssemblyHandle pAssembly) -{ - QCALL_CONTRACT; - - BOOL fRet = FALSE; - - BEGIN_QCALL; - - PEFile *pPEFile = pAssembly->GetFile(); - fRet = pPEFile->IsDesignerBindingContext(); - - END_QCALL; - - return fRet; -} -#endif // FEATURE_APPX - /*static*/ INT_PTR QCALLTYPE AssemblyNative::InitializeAssemblyLoadContext(INT_PTR ptrManagedAssemblyLoadContext, BOOL fRepresentsTPALoadContext) { diff --git a/src/vm/assemblynative.hpp b/src/vm/assemblynative.hpp index 3f7362188d..655f5c7ff4 100644 --- a/src/vm/assemblynative.hpp +++ b/src/vm/assemblynative.hpp @@ -81,13 +81,6 @@ public: static void QCALLTYPE GetVersion(QCall::AssemblyHandle pAssembly, INT32* pMajorVersion, INT32* pMinorVersion, INT32*pBuildNumber, INT32* pRevisionNumber); - static - void QCALLTYPE LoadModule(QCall::AssemblyHandle pAssembly, - LPCWSTR wszModuleName, - LPCBYTE pRawModule, INT32 cbModule, - LPCBYTE pRawSymbolStore, INT32 cbSymbolStore, - QCall::ObjectHandleOnStack retModule); - static void QCALLTYPE GetType(QCall::AssemblyHandle pAssembly, LPCWSTR wszName, BOOL bThrowOnError, BOOL bIgnoreCase, QCall::ObjectHandleOnStack retType, QCall::ObjectHandleOnStack keepAlive); @@ -97,9 +90,6 @@ public: static INT32 QCALLTYPE GetManifestResourceInfo(QCall::AssemblyHandle pAssembly, LPCWSTR wszName, QCall::ObjectHandleOnStack retAssembly, QCall::StringHandleOnStack retFileName, QCall::StackCrawlMarkHandle stackMark); - static - BOOL QCALLTYPE UseRelativeBindForSatellites(); - static void QCALLTYPE GetModules(QCall::AssemblyHandle pAssembly, BOOL fLoadIfNotFound, BOOL fGetResourceModules, QCall::ObjectHandleOnStack retModules); @@ -118,48 +108,14 @@ public: static void QCALLTYPE GetEntryPoint(QCall::AssemblyHandle pAssembly, QCall::ObjectHandleOnStack retMethod); - static FCDECL1(ReflectModuleBaseObject *, GetOnDiskAssemblyModule, AssemblyBaseObject * pAssemblyUNSAFE); static FCDECL1(ReflectModuleBaseObject *, GetInMemoryAssemblyModule, AssemblyBaseObject * pAssemblyUNSAFE); static void QCALLTYPE GetImageRuntimeVersion(QCall::AssemblyHandle pAssembly, QCall::StringHandleOnStack retString); - - // - // AssemblyBuilder FCALLs - // - - static - void QCALLTYPE PrepareForSavingManifestToDisk(QCall::AssemblyHandle pAssembly, QCall::ModuleHandle pAssemblyModule); - - - static - mdFile QCALLTYPE AddFile(QCall::AssemblyHandle pAssembly, LPCWSTR wszFileName); - - static - void QCALLTYPE SetFileHashValue(QCall::AssemblyHandle pAssembly, INT32 tkFile, LPCWSTR wszFullFileName); - - static - void QCALLTYPE AddStandAloneResource(QCall::AssemblyHandle pAssembly, LPCWSTR wszName, LPCWSTR wszFileName, LPCWSTR wszFullFileName, INT32 iAttribute); - - static - void QCALLTYPE AddDeclarativeSecurity(QCall::AssemblyHandle pAssembly, INT32 action, PVOID blob, INT32 length); - - - static - void QCALLTYPE GetRawBytes(QCall::AssemblyHandle pAssembly, QCall::ObjectHandleOnStack retRawBytes); - // // PEFile QCalls // - - static - void QCALLTYPE ReleaseSafePEFileHandle(PEFile *pPEFile); - -#ifdef FEATURE_APPX - static - BOOL QCALLTYPE IsDesignerBindingContext(QCall::AssemblyHandle pAssembly); -#endif static INT_PTR QCALLTYPE InitializeAssemblyLoadContext(INT_PTR ptrManagedAssemblyLoadContext, BOOL fRepresentsTPALoadContext); static BOOL QCALLTYPE OverrideDefaultAssemblyLoadContextForCurrentDomain(INT_PTR ptrNativeAssemblyLoadContext); diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 23fa8f6e8e..8aaaae4713 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -4394,21 +4394,6 @@ UINT32 Module::GetTlsIndex() return m_file->GetTlsIndex(); } -PCCOR_SIGNATURE Module::GetSignature(RVA signature) -{ - WRAPPER_NO_CONTRACT; - - return m_file->GetSignature(signature); -} - -RVA Module::GetSignatureRva(PCCOR_SIGNATURE signature) -{ - WRAPPER_NO_CONTRACT; - - return m_file->GetSignatureRva(signature); -} - - // In DAC builds this function was being called on host addresses which may or may not // have been marshalled from the target. Such addresses can't be reliably mapped back to @@ -4460,20 +4445,6 @@ StubMethodHashTable *Module::GetStubMethodHashTable() } #endif // FEATURE_PREJIT -CHECK Module::CheckSignatureRva(RVA signature) -{ - WRAPPER_NO_CONTRACT; - CHECK(m_file->CheckSignatureRva(signature)); - CHECK_OK; -} - -CHECK Module::CheckSignature(PCCOR_SIGNATURE signature) -{ - WRAPPER_NO_CONTRACT; - CHECK(m_file->CheckSignature(signature)); - CHECK_OK; -} - void Module::InitializeStringData(DWORD token, EEStringData *pstrData, CQuickBytes *pqb) { CONTRACTL diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h index 4b1f234920..73f1a8f145 100644 --- a/src/vm/ceeload.h +++ b/src/vm/ceeload.h @@ -2670,10 +2670,6 @@ public: UINT32 GetFieldTlsOffset(DWORD field); UINT32 GetTlsIndex(); - PCCOR_SIGNATURE GetSignature(RVA signature); - RVA GetSignatureRva(PCCOR_SIGNATURE signature); - CHECK CheckSignatureRva(RVA signature); - CHECK CheckSignature(PCCOR_SIGNATURE signature); BOOL IsSigInIL(PCCOR_SIGNATURE signature); mdToken GetEntryPointToken(); diff --git a/src/vm/comdynamic.cpp b/src/vm/comdynamic.cpp index 97e408ac32..432555917e 100644 --- a/src/vm/comdynamic.cpp +++ b/src/vm/comdynamic.cpp @@ -820,136 +820,6 @@ void QCALLTYPE COMDynamicWrite::SetClassLayout(QCall::ModuleHandle pModule, INT3 END_QCALL; } -/*===============================UpdateMethodRVAs=============================== -**Action: Update the RVAs in all of the methods associated with a particular typedef -** to prior to emitting them to a PE. -**Returns: Void -**Arguments: -**Exceptions: -==============================================================================*/ -void COMDynamicWrite::UpdateMethodRVAs(IMetaDataEmit *pEmitNew, - IMetaDataImport *pImportNew, - ICeeFileGen *pCeeFileGen, - HCEEFILE ceeFile, - mdTypeDef td, - HCEESECTION sdataSection) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - - HCORENUM hEnum=0; - ULONG methRVA; - ULONG newMethRVA; - ULONG sdataSectionRVA = 0; - mdMethodDef md; - mdFieldDef fd; - ULONG count; - DWORD dwFlags=0; - DWORD implFlags=0; - HRESULT hr; - - // Look at the typedef flags. Skip tdimport classes. - if (!IsNilToken(td)) - { - IfFailGo(pImportNew->GetTypeDefProps(td, 0,0,0, &dwFlags, 0)); - if (IsTdImport(dwFlags)) - goto ErrExit; - } - - //Get an enumerator and use it to walk all of the methods defined by td. - while ((hr = pImportNew->EnumMethods( - &hEnum, - td, - &md, - 1, - &count)) == S_OK) { - - IfFailGo( pImportNew->GetMethodProps( - md, - NULL, - NULL, // don't get method name - 0, - NULL, - &dwFlags, - NULL, - NULL, - &methRVA, - &implFlags) ); - - // If this method isn't implemented here, don't bother correcting it's RVA - // Otherwise, get the correct RVA from our ICeeFileGen and put it back into our local - // copy of the metadata - // - if ( IsMdAbstract(dwFlags) || IsMdPinvokeImpl(dwFlags) || - IsMiNative(implFlags) || IsMiRuntime(implFlags) || - IsMiForwardRef(implFlags)) - { - continue; - } - - IfFailGo( pCeeFileGen->GetMethodRVA(ceeFile, methRVA, &newMethRVA) ); - IfFailGo( pEmitNew->SetRVA(md, newMethRVA) ); - } - - if (hEnum) { - pImportNew->CloseEnum( hEnum); - } - hEnum = 0; - - // Walk through all of the Field belongs to this TypeDef. If field is marked as fdHasFieldRVA, we need to update the - // RVA value. - while ((hr = pImportNew->EnumFields( - &hEnum, - td, - &fd, - 1, - &count)) == S_OK) { - - IfFailGo( pImportNew->GetFieldProps( - fd, - NULL, // don't need the parent class - NULL, // don't get method name - 0, - NULL, - &dwFlags, // field flags - NULL, // don't need the signature - NULL, - NULL, // don't need the constant value - 0, - NULL) ); - - if ( IsFdHasFieldRVA(dwFlags) ) - { - if (sdataSectionRVA == 0) - { - IfFailGo( pCeeFileGen->GetSectionCreate (ceeFile, ".sdata", sdReadWrite, &(sdataSection)) ); - IfFailGo( pCeeFileGen->GetSectionRVA(sdataSection, &sdataSectionRVA) ); - } - - IfFailGo( pImportNew->GetRVA(fd, &methRVA, NULL) ); - newMethRVA = methRVA + sdataSectionRVA; - IfFailGo( pEmitNew->SetFieldRVA(fd, newMethRVA) ); - } - } - - if (hEnum) { - pImportNew->CloseEnum( hEnum); - } - hEnum = 0; - -ErrExit: - if (FAILED(hr)) { - _ASSERTE(!"UpdateRVA failed"); - COMPlusThrowHR(hr); - } -} - void QCALLTYPE COMDynamicWrite::DefineCustomAttribute(QCall::ModuleHandle pModule, INT32 token, INT32 conTok, LPCBYTE pBlob, INT32 cbBlob, BOOL toDisk, BOOL updateCompilerFlags) { QCALL_CONTRACT; @@ -1047,409 +917,3 @@ void QCALLTYPE COMDynamicWrite::DefineCustomAttribute(QCall::ModuleHandle pModul END_QCALL; } - -void ManagedBitnessFlagsToUnmanagedBitnessFlags( - INT32 portableExecutableKind, INT32 imageFileMachine, - DWORD* pPeFlags, DWORD* pCorhFlags) -{ - if (portableExecutableKind & peILonly) - *pCorhFlags |= COMIMAGE_FLAGS_ILONLY; - - if (portableExecutableKind & pe32BitPreferred) - COR_SET_32BIT_PREFERRED(*pCorhFlags); - - if (portableExecutableKind & pe32BitRequired) - COR_SET_32BIT_REQUIRED(*pCorhFlags); - - *pPeFlags |= ICEE_CREATE_FILE_CORMAIN_STUB; - - if (imageFileMachine == IMAGE_FILE_MACHINE_I386) - *pPeFlags |= ICEE_CREATE_MACHINE_I386|ICEE_CREATE_FILE_PE32; - - else if (imageFileMachine == IMAGE_FILE_MACHINE_IA64) - *pPeFlags |= ICEE_CREATE_MACHINE_IA64|ICEE_CREATE_FILE_PE64; - - else if (imageFileMachine == IMAGE_FILE_MACHINE_AMD64) - *pPeFlags |= ICEE_CREATE_MACHINE_AMD64|ICEE_CREATE_FILE_PE64; - - else if (imageFileMachine == IMAGE_FILE_MACHINE_ARMNT) - *pPeFlags |= ICEE_CREATE_MACHINE_ARM|ICEE_CREATE_FILE_PE32; -} - - -//=============================EmitDebugInfoBegin============================*/ -// Phase 1 of emit debugging directory and symbol file. -//===========================================================================*/ -HRESULT COMDynamicWrite::EmitDebugInfoBegin(Module *pModule, - ICeeFileGen *pCeeFileGen, - HCEEFILE ceeFile, - HCEESECTION pILSection, - const WCHAR *filename, - ISymUnmanagedWriter *pWriter) -{ - CONTRACT(HRESULT) { - NOTHROW; - GC_NOTRIGGER; - MODE_PREEMPTIVE; - INJECT_FAULT(COMPlusThrowOM()); - - PRECONDITION(CheckPointer(pWriter, NULL_OK)); - PRECONDITION(CheckPointer(pCeeFileGen)); - PRECONDITION(CheckPointer(pModule)); - - POSTCONDITION(SUCCEEDED(RETVAL)); - } - CONTRACT_END; - - HRESULT hr = S_OK; - - // If we were emitting symbols for this dynamic module, go ahead - // and fill out the debug directory and save off the symbols now. - if (pWriter != NULL) - { - IMAGE_DEBUG_DIRECTORY debugDirIDD = {0}; - DWORD debugDirDataSize; - BYTE *debugDirData; - - // Grab the debug info. - IfFailGo(pWriter->GetDebugInfo(NULL, 0, &debugDirDataSize, NULL)); - - - // Is there any debug info to emit? - if (debugDirDataSize > 0) - { - // Make some room for the data. - debugDirData = (BYTE*)_alloca(debugDirDataSize); - - // Actually get the data now. - IfFailGo(pWriter->GetDebugInfo(&debugDirIDD, - debugDirDataSize, - NULL, - debugDirData)); - - - // Grab the timestamp of the PE file. - DWORD fileTimeStamp; - - - IfFailGo(pCeeFileGen->GetFileTimeStamp(ceeFile, &fileTimeStamp)); - - - // Fill in the directory entry. - debugDirIDD.TimeDateStamp = VAL32(fileTimeStamp); - debugDirIDD.AddressOfRawData = 0; - - // Grab memory in the section for our stuff. - HCEESECTION sec = pILSection; - BYTE *de; - - IfFailGo(pCeeFileGen->GetSectionBlock(sec, - sizeof(debugDirIDD) + - debugDirDataSize, - 4, - (void**) &de) ); - - - // Where did we get that memory? - ULONG deOffset; - IfFailGo(pCeeFileGen->GetSectionDataLen(sec, &deOffset)); - - - deOffset -= (sizeof(debugDirIDD) + debugDirDataSize); - - // Setup a reloc so that the address of the raw data is - // setup correctly. - debugDirIDD.PointerToRawData = VAL32(deOffset + sizeof(debugDirIDD)); - - IfFailGo(pCeeFileGen->AddSectionReloc( - sec, - deOffset + - offsetof(IMAGE_DEBUG_DIRECTORY, PointerToRawData), - sec, srRelocFilePos)); - - - - // Emit the directory entry. - IfFailGo(pCeeFileGen->SetDirectoryEntry( - ceeFile, - sec, - IMAGE_DIRECTORY_ENTRY_DEBUG, - sizeof(debugDirIDD), - deOffset)); - - - // Copy the debug directory into the section. - memcpy(de, &debugDirIDD, sizeof(debugDirIDD)); - memcpy(de + sizeof(debugDirIDD), debugDirData, debugDirDataSize); - - } - } -ErrExit: - RETURN(hr); -} - - -//=============================EmitDebugInfoEnd==============================*/ -// Phase 2 of emit debugging directory and symbol file. -//===========================================================================*/ -HRESULT COMDynamicWrite::EmitDebugInfoEnd(Module *pModule, - ICeeFileGen *pCeeFileGen, - HCEEFILE ceeFile, - HCEESECTION pILSection, - const WCHAR *filename, - ISymUnmanagedWriter *pWriter) -{ - CONTRACT(HRESULT) { - NOTHROW; - GC_TRIGGERS; - MODE_PREEMPTIVE; - INJECT_FAULT(CONTRACT_RETURN(E_OUTOFMEMORY)); - - PRECONDITION(CheckPointer(pWriter, NULL_OK)); - PRECONDITION(CheckPointer(pCeeFileGen)); - PRECONDITION(CheckPointer(pModule)); - } - CONTRACT_END; - - HRESULT hr = S_OK; - - CGrowableStream *pStream = NULL; - - // If we were emitting symbols for this dynamic module, go ahead - // and fill out the debug directory and save off the symbols now. - if (pWriter != NULL) - { - // Now go ahead and save off the symbol file and release the - // writer. - IfFailGo( pWriter->Close() ); - - - - - // How big of a stream to we have now? - pStream = pModule->GetInMemorySymbolStream(); - _ASSERTE(pStream != NULL); - - STATSTG SizeData = {0}; - DWORD streamSize = 0; - - IfFailGo(pStream->Stat(&SizeData, STATFLAG_NONAME)); - - streamSize = SizeData.cbSize.u.LowPart; - - if (SizeData.cbSize.u.HighPart > 0) - { - IfFailGo( E_OUTOFMEMORY ); - - } - - SIZE_T fnLen = wcslen(filename); - const WCHAR *dot = wcsrchr(filename, W('.')); - SIZE_T dotOffset = dot ? dot - filename : fnLen; - - size_t len = dotOffset + 6; - WCHAR *fn = (WCHAR*)_alloca(len * sizeof(WCHAR)); - wcsncpy_s(fn, len, filename, dotOffset); - - fn[dotOffset] = W('.'); - fn[dotOffset + 1] = W('p'); - fn[dotOffset + 2] = W('d'); - fn[dotOffset + 3] = W('b'); - fn[dotOffset + 4] = W('\0'); - - HandleHolder pdbFile(WszCreateFile(fn, - GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL)); - - if (pdbFile != INVALID_HANDLE_VALUE) - { - DWORD dummy; - BOOL succ = WriteFile(pdbFile, - pStream->GetRawBuffer().StartAddress(), - streamSize, - &dummy, NULL); - - if (!succ) - { - IfFailGo( HRESULT_FROM_GetLastError() ); - - } - - } - else - { - IfFailGo( HRESULT_FROM_GetLastError() ); - - } - } - -ErrExit: - // No one else will ever need this writer again... - pModule->GetReflectionModule()->SetISymUnmanagedWriter(NULL); -// pModule->GetReflectionModule()->SetSymbolStream(NULL); - - RETURN(hr); -} - - - -//============================AddDeclarativeSecurity============================*/ -// Add a declarative security serialized blob and a security action code to a -// given parent (class or method). -//==============================================================================*/ -void QCALLTYPE COMDynamicWrite::AddDeclarativeSecurity(QCall::ModuleHandle pModule, INT32 tk, DWORD action, LPCBYTE pBlob, INT32 cbBlob) -{ - QCALL_CONTRACT; - - BEGIN_QCALL; - - RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter(); - - mdPermission tkPermission; - HRESULT hr = pRCW->GetEmitHelper()->AddDeclarativeSecurityHelper(tk, - action, - pBlob, - cbBlob, - &tkPermission); - IfFailThrow(hr); - - if (hr == META_S_DUPLICATE) - { - COMPlusThrow(kInvalidOperationException, IDS_EE_DUPLICATE_DECLSEC); - } - - END_QCALL; -} - - -CSymMapToken::CSymMapToken(ISymUnmanagedWriter *pWriter, IMapToken *pMapToken) -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - // we know that the com implementation is ours so we use mode-any to simplify - // having to switch mode - MODE_ANY; - FORBID_FAULT; - } - CONTRACTL_END; - - m_cRef = 1; - m_pWriter = pWriter; - m_pMapToken = pMapToken; - if (m_pWriter) - m_pWriter->AddRef(); - if (m_pMapToken) - m_pMapToken->AddRef(); -} // CSymMapToken::CSymMapToken() - - - -//********************************************************************* -// -// CSymMapToken's destructor -// -//********************************************************************* -CSymMapToken::~CSymMapToken() -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - // we know that the com implementation is ours so we use mode-any to simplify - // having to switch mode - MODE_ANY; - FORBID_FAULT; - } - CONTRACTL_END; - - if (m_pWriter) - m_pWriter->Release(); - if (m_pMapToken) - m_pMapToken->Release(); -} // CSymMapToken::~CMapToken() - - -ULONG CSymMapToken::AddRef() -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - FORBID_FAULT; - } - CONTRACTL_END; - - return InterlockedIncrement(&m_cRef); -} // CSymMapToken::AddRef() - - - -ULONG CSymMapToken::Release() -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - FORBID_FAULT; - } - CONTRACTL_END; - - ULONG cRef = InterlockedDecrement(&m_cRef); - if (!cRef) - delete this; - return (cRef); -} // CSymMapToken::Release() - - -HRESULT CSymMapToken::QueryInterface(REFIID riid, void **ppUnk) -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - FORBID_FAULT; - } - CONTRACTL_END; - - *ppUnk = 0; - - if (riid == IID_IMapToken) - *ppUnk = (IUnknown *) (IMapToken *) this; - else - return (E_NOINTERFACE); - AddRef(); - return (S_OK); -} // CSymMapToken::QueryInterface - - - -//********************************************************************* -// -// catching the token mapping -// -//********************************************************************* -HRESULT CSymMapToken::Map( - mdToken tkFrom, - mdToken tkTo) -{ - CONTRACTL { - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - FORBID_FAULT; - } - CONTRACTL_END; - - HRESULT hr = NOERROR; - if (m_pWriter) - IfFailGo( m_pWriter->RemapToken(tkFrom, tkTo) ); - if (m_pMapToken) - IfFailGo( m_pMapToken->Map(tkFrom, tkTo) ); -ErrExit: - return hr; -} - diff --git a/src/vm/comdynamic.h b/src/vm/comdynamic.h index a605fa19ba..21469865be 100644 --- a/src/vm/comdynamic.h +++ b/src/vm/comdynamic.h @@ -26,10 +26,6 @@ struct ExceptionInstance; // inside reflection. class COMDynamicWrite { -private: - - static void UpdateMethodRVAs(IMetaDataEmit*, IMetaDataImport*, ICeeFileGen *, HCEEFILE, mdTypeDef td, HCEESECTION sdataSection); - public: // This function will create the class's metadata definition static @@ -85,31 +81,6 @@ public: mdFieldDef QCALLTYPE DefineField(QCall::ModuleHandle pModule, INT32 tkParent, LPCWSTR wszName, LPCBYTE pSignature, INT32 sigLength, INT32 attr); static - void QCALLTYPE PreSavePEFile(QCall::ModuleHandle pModule, INT32 portableExecutableKind, INT32 imageFileMachine); - - static - void QCALLTYPE SavePEFile(QCall::ModuleHandle pModule, LPCWSTR wszPeName, UINT32 entryPoint, UINT32 fileKind, BOOL isManifestFile); - - - // not an ecall! - static HRESULT EmitDebugInfoBegin( - Module *pModule, - ICeeFileGen *pCeeFileGen, - HCEEFILE ceeFile, - HCEESECTION pILSection, - const WCHAR *filename, - ISymUnmanagedWriter *pWriter); - - // not an ecall! - static HRESULT EmitDebugInfoEnd( - Module *pModule, - ICeeFileGen *pCeeFileGen, - HCEEFILE ceeFile, - HCEESECTION pILSection, - const WCHAR *filename, - ISymUnmanagedWriter *pWriter); - - static void QCALLTYPE SetPInvokeData(QCall::ModuleHandle pModule, LPCWSTR wszDllName, LPCWSTR wszFunctionName, INT32 token, INT32 linkFlags); static @@ -153,34 +124,6 @@ public: // functions to set default value static void QCALLTYPE SetConstantValue(QCall::ModuleHandle pModule, UINT32 tk, DWORD valueType, LPVOID pValue); - - // functions to add declarative security - static - void QCALLTYPE AddDeclarativeSecurity(QCall::ModuleHandle pModule, INT32 tk, DWORD action, LPCBYTE pBlob, INT32 cbBlob); -}; - - - -//********************************************************************* -// -// This CSymMapToken class implemented the IMapToken. It is used in catching -// token remap information from Merge and send the notifcation to CeeFileGen -// and SymbolWriter -// -//********************************************************************* -class CSymMapToken : public IMapToken -{ -public: - STDMETHODIMP QueryInterface(REFIID riid, PVOID *pp); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - STDMETHODIMP Map(mdToken tkImp, mdToken tkEmit); - CSymMapToken(ISymUnmanagedWriter *pWriter, IMapToken *pMapToken); - virtual ~CSymMapToken(); -private: - LONG m_cRef; - ISymUnmanagedWriter *m_pWriter; - IMapToken *m_pMapToken; }; #endif // _COMDYNAMIC_H_ diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp index 7cfa05779a..d417545287 100644 --- a/src/vm/pefile.cpp +++ b/src/vm/pefile.cpp @@ -66,11 +66,9 @@ PEFile::PEFile(PEImage *identity, BOOL fCheckAuthenticodeSignature/*=TRUE*/) : m_pEmitter(NULL), m_pMetadataLock(::new SimpleRWLock(PREEMPTIVE, LOCK_TYPE_DEFAULT)), m_refCount(1), - m_hash(NULL), m_flags(0), - m_fStrongNameVerified(FALSE) - ,m_pHostAssembly(nullptr) - ,m_pFallbackLoadContextBinder(nullptr) + m_pHostAssembly(nullptr), + m_pFallbackLoadContextBinder(nullptr) { CONTRACTL { @@ -112,9 +110,6 @@ PEFile::~PEFile() ReleaseMetadataInterfaces(TRUE); - if (m_hash != NULL) - delete m_hash; - #ifdef FEATURE_PREJIT if (m_nativeImage != NULL) { @@ -1992,9 +1987,6 @@ PEAssembly::PEAssembly( m_bIsOnTpaList = pBindResultInfo->IsOnTpaList(); } - // Check security related stuff - VerifyStrongName(); - // Open metadata eagerly to minimize failure windows if (pEmit == NULL) OpenMDImport_Unsafe(); //constructor, cannot race with anything @@ -2311,9 +2303,6 @@ void PEAssembly::SetNativeImage(PEImage * image) //cache a bunch of PE metadata in the PEDecoder m_ILimage->CheckILFormat(); - //we also need some of metadata (for the public key), so cache this too - DWORD verifyOutputFlags; - m_ILimage->VerifyStrongName(&verifyOutputFlags); //fudge this by a few pages to make sure we can still mess with the PE headers const size_t fudgeSize = 4096 * 4; ClrVirtualProtect((void*)(((char *)layout->GetBase()) + fudgeSize), @@ -2344,56 +2333,6 @@ BOOL PEAssembly::IsSourceGAC() #ifndef DACCESS_COMPILE - -// ------------------------------------------------------------ -// Hash support -// ------------------------------------------------------------ - -void PEAssembly::VerifyStrongName() -{ - CONTRACTL - { - INSTANCE_CHECK; - THROWS; - GC_TRIGGERS; - MODE_ANY; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END; - - // If we've already done the signature checks, we don't need to do them again. - if (m_fStrongNameVerified) - { - return; - } - - // Without FUSION/GAC, we need to verify SN on all assemblies, except dynamic assemblies. - if (IsDynamic()) - { - - m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS; - m_fStrongNameVerified = TRUE; - return; - } - - // Next, verify the strong name, if necessary - - // 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. - EnsureImageOpened(); - - - if (m_nativeImage == NULL && !GetILimage()->IsTrustedNativeImage()) - { - if (!GetILimage()->CheckILFormat()) - ThrowHR(COR_E_BADIMAGEFORMAT); - } - - // Runtime policy on CoreCLR is to skip verification of ALL assemblies - m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS; - m_fStrongNameVerified = TRUE; -} - BOOL PEAssembly::IsProfileAssembly() { CONTRACTL diff --git a/src/vm/pefile.h b/src/vm/pefile.h index 66915bf81a..e79c94c954 100644 --- a/src/vm/pefile.h +++ b/src/vm/pefile.h @@ -222,18 +222,6 @@ public: PEAssembly *GetAssembly() const; // ------------------------------------------------------------ - // Hash support - // ------------------------------------------------------------ - -#ifndef DACCESS_COMPILE - void GetImageBits(SBuffer &result); - void GetHash(ALG_ID algorithm, SBuffer &result); -#endif // DACCESS_COMPILE - - void GetSHA1Hash(SBuffer &result); - CHECK CheckHash(ALG_ID algorithm, const void *hash, COUNT_T size); - - // ------------------------------------------------------------ // Metadata access // ------------------------------------------------------------ @@ -266,7 +254,6 @@ public: // PE file access // ------------------------------------------------------------ - BOOL HasSecurityDirectory(); BOOL IsIbcOptimized(); BOOL IsILImageReadyToRun(); WORD GetSubsystem(); @@ -284,11 +271,6 @@ public: CHECK CheckRvaField(RVA field); CHECK CheckRvaField(RVA field, COUNT_T size); - PCCOR_SIGNATURE GetSignature(RVA signature); - RVA GetSignatureRva(PCCOR_SIGNATURE signature); - CHECK CheckSignature(PCCOR_SIGNATURE signature); - CHECK CheckSignatureRva(RVA signature); - BOOL HasTls(); BOOL IsRvaFieldTls(RVA field); UINT32 GetFieldTlsOffset(RVA field); @@ -445,9 +427,7 @@ protected: PEFILE_SYSTEM = 0x01, PEFILE_ASSEMBLY = 0x02, PEFILE_MODULE = 0x04, - // = 0x08, - PEFILE_SKIP_MODULE_HASH_CHECKS= 0x10, - PEFILE_ISTREAM = 0x100, + #ifdef FEATURE_PREJIT PEFILE_HAS_NATIVE_IMAGE_METADATA = 0x200, PEFILE_NATIVE_IMAGE_USED_EXCLUSIVELY =0x1000, @@ -529,9 +509,7 @@ protected: IMetaDataEmit *m_pEmitter; SimpleRWLock *m_pMetadataLock; Volatile<LONG> m_refCount; - SBuffer *m_hash; // cached SHA1 hash value int m_flags; - BOOL m_fStrongNameVerified; #ifdef DEBUGGING_SUPPORTED #ifdef FEATURE_PREJIT @@ -723,13 +701,7 @@ class PEAssembly : public PEFile // Hash support // ------------------------------------------------------------ - BOOL NeedsModuleHashChecks(); - BOOL HasStrongNameSignature(); - BOOL IsFullySigned(); - - void SetStrongNameBypassed(); - void VerifyStrongName(); // ------------------------------------------------------------ // Descriptive strings @@ -800,18 +772,9 @@ class PEAssembly : public PEFile BOOL CheckNativeImageVersion(PEImage *image); - - #endif // FEATURE_PREJIT private: - // Check both the StrongName and Authenticode signature of an assembly. If the application is using - // strong name bypass, then this call may not result in a strong name verificaiton. VerifyStrongName - // should be called if a strong name must be forced to verify. - void DoLoadSignatureChecks(); - - - private: // ------------------------------------------------------------ // Instance fields // ------------------------------------------------------------ diff --git a/src/vm/pefile.inl b/src/vm/pefile.inl index c5c92a96c9..38b155ffac 100644 --- a/src/vm/pefile.inl +++ b/src/vm/pefile.inl @@ -325,7 +325,7 @@ inline BOOL PEFile::IsIStream() const { LIMITED_METHOD_CONTRACT; - return (m_flags & PEFILE_ISTREAM) != 0; + return FALSE; } inline PEAssembly *PEFile::GetAssembly() const @@ -337,74 +337,6 @@ inline PEAssembly *PEFile::GetAssembly() const } // ------------------------------------------------------------ -// Hash support -// ------------------------------------------------------------ - -#ifndef DACCESS_COMPILE -inline void PEFile::GetImageBits(SBuffer &result) -{ - CONTRACTL - { - INSTANCE_CHECK; - PRECONDITION(CheckValue(result)); - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - EnsureImageOpened(); - // We don't cache any other hashes right now. - if (!IsDynamic()) - GetILimage()->GetImageBits(PEImageLayout::LAYOUT_FLAT,result); -} - -inline void PEFile::GetHash(ALG_ID algorithm, SBuffer &result) -{ - CONTRACTL - { - INSTANCE_CHECK; - PRECONDITION(CheckValue(result)); - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACTL_END; - - if (algorithm == CALG_SHA1) - { - GetSHA1Hash(result); - } - else - { - EnsureImageOpened(); - // We don't cache any other hashes right now. - GetILimage()->ComputeHash(algorithm, result); - } -} - -inline CHECK PEFile::CheckHash(ALG_ID algorithm, const void *hash, COUNT_T size) -{ - CONTRACT_CHECK - { - INSTANCE_CHECK; - PRECONDITION(CheckPointer(hash)); - THROWS; - GC_TRIGGERS; - MODE_ANY; - } - CONTRACT_CHECK_END; - - StackSBuffer hashBuffer; - GetHash(algorithm, hashBuffer); - - CHECK(hashBuffer.Equals((const BYTE *)hash, size)); - - CHECK_OK; -} -#endif // DACCESS_COMPILE - -// ------------------------------------------------------------ // Metadata access // ------------------------------------------------------------ @@ -599,37 +531,6 @@ inline HRESULT PEFile::GetScopeName(LPCUTF8 * pszName) // PE file access // ------------------------------------------------------------ -inline BOOL PEFile::HasSecurityDirectory() -{ - WRAPPER_NO_CONTRACT; - - if (IsResource() || IsDynamic()) - return FALSE; - -#ifdef FEATURE_PREJIT - if (IsNativeLoaded()) - { - CONSISTENCY_CHECK(HasNativeImage()); - - return m_nativeImage->GetNativeILHasSecurityDirectory(); - } -#ifndef DACCESS_COMPILE - if (!HasOpenedILimage()) - { - //don't want to touch the IL image unless we already have - ReleaseHolder<PEImage> pNativeImage = GetNativeImageWithRef(); - if (pNativeImage) - return pNativeImage->GetNativeILHasSecurityDirectory(); - } -#endif // DACCESS_COMPILE -#endif // FEATURE_PREJIT - - if (!GetILimage()->HasNTHeaders()) - return FALSE; - - return GetOpenedILimage()->HasDirectoryEntry(IMAGE_DIRECTORY_ENTRY_SECURITY); -} - inline BOOL PEFile::IsIbcOptimized() { WRAPPER_NO_CONTRACT; @@ -1018,87 +919,6 @@ inline CHECK PEFile::CheckInternalPInvokeTarget(RVA target) CHECK_OK; } - -inline PCCOR_SIGNATURE PEFile::GetSignature(RVA signature) -{ - CONTRACT(PCCOR_SIGNATURE) - { - INSTANCE_CHECK; - PRECONDITION(!IsDynamic() || signature == 0); - PRECONDITION(!IsResource()); - PRECONDITION(CheckSignatureRva(signature)); - POSTCONDITION(CheckSignature(RETVAL)); - PRECONDITION(CheckLoaded()); - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_END; - - if (signature == 0) - RETURN NULL; - else - RETURN (PCCOR_SIGNATURE) GetLoadedIL()->GetRvaData(signature); -} - -inline RVA PEFile::GetSignatureRva(PCCOR_SIGNATURE signature) -{ - CONTRACT(RVA) - { - INSTANCE_CHECK; - PRECONDITION(!IsDynamic() || signature == NULL); - PRECONDITION(!IsResource()); - PRECONDITION(CheckSignature(signature)); - POSTCONDITION(CheckSignatureRva(RETVAL)); - PRECONDITION(CheckLoaded()); - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_END; - - if (signature == NULL) - RETURN 0; - else - RETURN GetLoadedIL()->GetDataRva( - dac_cast<TADDR>(signature)); -} - -inline CHECK PEFile::CheckSignature(PCCOR_SIGNATURE signature) -{ - CONTRACT_CHECK - { - INSTANCE_CHECK; - PRECONDITION(!IsDynamic() || signature == NULL); - PRECONDITION(!IsResource()); - PRECONDITION(CheckLoaded()); - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_CHECK_END; - - CHECK(GetLoadedIL()->CheckData(signature,NULL_OK)); - CHECK_OK; -} - -inline CHECK PEFile::CheckSignatureRva(RVA signature) -{ - CONTRACT_CHECK - { - INSTANCE_CHECK; - PRECONDITION(!IsDynamic() || signature == NULL); - PRECONDITION(!IsResource()); - PRECONDITION(CheckLoaded()); - NOTHROW; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACT_CHECK_END; - - CHECK(GetLoadedIL()->CheckRva(signature,NULL_OK)); - CHECK_OK; -} inline IMAGE_COR_VTABLEFIXUP *PEFile::GetVTableFixups(COUNT_T *pCount/*=NULL*/) { @@ -1657,12 +1477,6 @@ inline BOOL PEFile::IsStrongNamed() // Check to see if this assembly has had its strong name signature verified yet. // -inline BOOL PEFile::IsStrongNameVerified() -{ - LIMITED_METHOD_CONTRACT; - return m_fStrongNameVerified; -} - inline const void *PEFile::GetPublicKey(DWORD *pcbPK) { CONTRACTL @@ -1775,42 +1589,6 @@ inline BOOL PEAssembly::HasStrongNameSignature() return GetILimage()->HasStrongNameSignature(); } -//--------------------------------------------------------------------------------------- -// -// Check to see that an assembly is not delay or test signed -// - -inline BOOL PEAssembly::IsFullySigned() -{ - WRAPPER_NO_CONTRACT; - -#ifdef FEATURE_PREJIT - if (IsNativeLoaded()) - { - CONSISTENCY_CHECK(HasNativeImage()); - - // If we are strongly named and successfully strong named, then we consider ourselves fully - // signed since either our signature verified at ngen time, or skip verification was in effect - // The only code that differentiates between skip verification and fully signed is in the strong - // name verification path itself, and therefore we abstract that away at this level. - // - // Note that this is consistent with other abstractions at the PEFile level such as - // HasStrongNameSignature() - return IsStrongNamed(); - } else -#endif // FEATURE_PREJIT - if (HasOpenedILimage()) - { - return GetOpenedILimage()->IsStrongNameSigned(); - } - else - { - return FALSE; - } -} - - - // ------------------------------------------------------------ // Metadata access // ------------------------------------------------------------ diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp index 766d40bdc4..df9b07f565 100644 --- a/src/vm/peimage.cpp +++ b/src/vm/peimage.cpp @@ -159,26 +159,6 @@ void PEImage::GetAll(SArray<PEImage*> &images) } } -/* static */ -ULONG PEImage::HashStreamIds(UINT64 id1, DWORD id2) -{ - LIMITED_METHOD_CONTRACT; - - ULONG hash = 5381; - - hash ^= id2; - hash = _rotl(hash, 4); - - void *data = &id1; - hash ^= *(INT32 *) data; - - hash = _rotl(hash, 4); - ((INT32 *&)data)++; - hash ^= *(INT32 *) data; - - return hash; -} - PEImage::~PEImage() { CONTRACTL @@ -1279,23 +1259,6 @@ HANDLE PEImage::GetFileHandle() return m_hFile; } -// Like GetFileHandle, but can be called without the PEImage being locked for writing. -// Only intend to be called by NGen. -HANDLE PEImage::GetFileHandleLocking() -{ - CONTRACTL - { - STANDARD_VM_CHECK; - } - CONTRACTL_END; - - if (m_hFile!=INVALID_HANDLE_VALUE) - return m_hFile; - - SimpleWriteLockHolder lock(m_pLayoutLock); - return GetFileHandle(); -} - void PEImage::SetFileHandle(HANDLE hFile) { CONTRACTL @@ -1338,33 +1301,6 @@ HRESULT PEImage::TryOpenFile() } - -HANDLE PEImage::GetProtectingFileHandle(BOOL bProtectIfNotOpenedYet) -{ - STANDARD_VM_CONTRACT; - - if (m_hFile==INVALID_HANDLE_VALUE && !bProtectIfNotOpenedYet) - return INVALID_HANDLE_VALUE; - - HANDLE hRet=INVALID_HANDLE_VALUE; - { - ErrorModeHolder mode(SEM_NOOPENFILEERRORBOX|SEM_FAILCRITICALERRORS); - hRet=WszCreateFile((LPCWSTR) m_path, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - } - if (hRet == INVALID_HANDLE_VALUE) - ThrowLastError(); - if (m_hFile!=INVALID_HANDLE_VALUE && !CompareFiles(m_hFile,hRet)) - ThrowHR(FUSION_E_REF_DEF_MISMATCH); - - return hRet; -} - BOOL PEImage::IsPtrInImage(PTR_CVOID data) { CONTRACTL diff --git a/src/vm/peimage.h b/src/vm/peimage.h index e05f95dac8..22aed04b0e 100644 --- a/src/vm/peimage.h +++ b/src/vm/peimage.h @@ -153,27 +153,13 @@ public: const SString &GetPath(); BOOL IsFile(); HANDLE GetFileHandle(); - HANDLE GetFileHandleLocking(); void SetFileHandle(HANDLE hFile); HRESULT TryOpenFile(); - HANDLE GetProtectingFileHandle(BOOL bProtectIfNotOpenedYet); - LPCWSTR GetPathForErrorMessages(); // Equality BOOL Equals(PEImage *pImage); - static ULONG HashStreamIds(UINT64 id1, DWORD id2); - - // Hashing utilities. (These require a flat version of the file, and - // will open one if necessary.) - -#ifndef DACCESS_COMPILE - void GetImageBits(DWORD layout, SBuffer &result); -#endif - - void ComputeHash(ALG_ID algorithm, SBuffer &result); - CHECK CheckHash(ALG_ID algorithm, const void *pbHash, COUNT_T cbHash); void GetMVID(GUID *pMvid); const BOOL HasV1Metadata(); @@ -181,7 +167,6 @@ public: BOOL MDImportLoaded(); IMDInternalImport* GetNativeMDImport(BOOL loadAllowed = TRUE); - BOOL HasSecurityDirectory(); BOOL HasContents() ; BOOL HasNativeHeader() ; BOOL IsPtrInImage(PTR_CVOID data); @@ -220,7 +205,6 @@ public: BOOL PassiveDomainOnly(); BOOL IsReferenceAssembly(); #ifdef FEATURE_PREJIT - const BOOL GetNativeILHasSecurityDirectory(); const BOOL IsNativeILILOnly(); const BOOL IsNativeILDll(); void GetNativeILPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine); @@ -234,11 +218,7 @@ public: const WORD GetSubsystem(); BOOL IsFileLocked(); const BOOL HasStrongNameSignature(); -#ifndef DACCESS_COMPILE - const HRESULT VerifyStrongName(DWORD* verifyOutputFlags); -#endif - BOOL IsStrongNameSigned(); BOOL IsIbcOptimized(); BOOL Has32BitNTHeaders(); diff --git a/src/vm/peimage.inl b/src/vm/peimage.inl index 0e7410734e..57f5400855 100644 --- a/src/vm/peimage.inl +++ b/src/vm/peimage.inl @@ -223,21 +223,6 @@ inline BOOL PEImage::PassiveDomainOnly() return m_bPassiveDomainOnly; } -#ifdef FEATURE_PREJIT - -inline const BOOL PEImage::GetNativeILHasSecurityDirectory() -{ - WRAPPER_NO_CONTRACT; - if (HasLoadedLayout()) - return GetLoadedLayout()->GetNativeILHasSecurityDirectory(); - else - { - PEImageLayoutHolder pLayout(GetLayout(PEImageLayout::LAYOUT_ANY,LAYOUT_CREATEIFNEEDED)); - return pLayout->GetNativeILHasSecurityDirectory(); - } -} -#endif - inline const BOOL PEImage::HasDirectoryEntry(int entry) { WRAPPER_NO_CONTRACT; @@ -389,18 +374,6 @@ inline const BOOL PEImage::HasStrongNameSignature() #endif // !DACCESS_COMPILE -inline BOOL PEImage::IsStrongNameSigned() -{ - WRAPPER_NO_CONTRACT; - if (HasLoadedLayout()) - return GetLoadedLayout()->IsStrongNameSigned(); - else - { - PEImageLayoutHolder pLayout(GetLayout(PEImageLayout::LAYOUT_ANY,LAYOUT_CREATEIFNEEDED)); - return pLayout->IsStrongNameSigned(); - } -} - inline BOOL PEImage::IsIbcOptimized() { WRAPPER_NO_CONTRACT; @@ -413,22 +386,6 @@ inline BOOL PEImage::IsIbcOptimized() } } -#ifndef DACCESS_COMPILE - -inline void PEImage::GetImageBits(DWORD layout, SBuffer &result) -{ - WRAPPER_NO_CONTRACT; - PEImageLayoutHolder pLayout(GetLayout(layout,LAYOUT_CREATEIFNEEDED)); - BYTE* buffer=result.OpenRawBuffer(pLayout->GetSize()); - PREFIX_ASSUME(buffer != NULL); - memcpyNoGCRefs(buffer,pLayout->GetBase(),pLayout->GetSize()); - result.CloseRawBuffer(pLayout->GetSize()); -} - -#endif - - - #ifdef FEATURE_PREJIT inline PTR_CVOID PEImage::GetNativeManifestMetadata(COUNT_T *pSize) { |