From 1aa7d6b8796f7e28a63162117c5bb16a207a472b Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Tue, 14 Feb 2017 21:13:22 -0800 Subject: Remove never defined FEATURE_MULTIMODULE_ASSEMBLIES --- src/zap/zapper.cpp | 140 ----------------------------------------------------- 1 file changed, 140 deletions(-) (limited to 'src/zap/zapper.cpp') diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp index 502e5935f6..904b9d1539 100644 --- a/src/zap/zapper.cpp +++ b/src/zap/zapper.cpp @@ -1558,9 +1558,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) // assembly to be ngen-ed. // -#ifdef FEATURE_MULTIMODULE_ASSEMBLIES - CompileNonManifestModules(hashAlgId, hFiles); -#endif // FEATURE_MULTIMODULE_ASSEMBLIES // // Record the version info @@ -1614,143 +1611,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) } -#ifdef FEATURE_MULTIMODULE_ASSEMBLIES -void * Zapper::GetMapViewOfFile( - HANDLE file, - DWORD * pdwFileLen) -{ - // - // Create a file-mapping to read the file contents - // - - DWORD dwFileLen = SafeGetFileSize(file, 0); - if (dwFileLen == INVALID_FILE_SIZE) - ThrowHR(HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY)); - - HandleHolder mapFile(WszCreateFileMapping( - file, // hFile - NULL, // lpAttributes - PAGE_READONLY, // flProtect - 0, // dwMaximumSizeHigh - 0, // dwMaximumSizeLow - NULL)); // lpName (of the mapping object) - if (mapFile == NULL) - ThrowLastError(); - - MapViewHolder mapView(MapViewOfFile(mapFile, // hFileMappingObject, - FILE_MAP_READ, // dwDesiredAccess, - 0, // dwFileOffsetHigh, - 0, // dwFileOffsetLow, - 0)); // dwNumberOfBytesToMap - if (mapView == NULL) - ThrowLastError(); - - *pdwFileLen = dwFileLen; - return mapView.Extract(); -} - -void Zapper::ComputeHashValue(HANDLE hFile, int iHashAlg, - BYTE **ppHashValue, DWORD *pcHashValue) -{ - - DWORD dwFileLen; - MapViewHolder mapView(GetMapViewOfFile(hFile, &dwFileLen)); - - BYTE * pbBuffer = (BYTE *) mapView.GetValue(); - - // - // Hash the file - // - - DWORD dwCount = sizeof(DWORD); - DWORD cbHashValue = 0; - NewArrayHolder pbHashValue; - - HandleCSPHolder hProv; - HandleHashHolder hHash; - - if ((!WszCryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) || - (!CryptCreateHash(hProv, iHashAlg, 0, 0, &hHash)) || - (!CryptHashData(hHash, pbBuffer, dwFileLen, 0)) || - (!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE *) &cbHashValue, &dwCount, 0))) - ThrowLastError(); - - pbHashValue = new BYTE[cbHashValue]; - - if(!CryptGetHashParam(hHash, HP_HASHVAL, pbHashValue, &cbHashValue, 0)) - ThrowLastError(); - - *ppHashValue = pbHashValue.Extract(); - *pcHashValue = cbHashValue; -} - -void Zapper::CompileNonManifestModules(ULONG hashAlgId, SArray &hFiles) -{ - // - // Iterate all non-manifest modules in the assembly, and compile them - // - - IMDInternalImport * pMDImport = m_pAssemblyImport; - - HENUMInternalHolder hEnum(pMDImport); - hEnum.EnumAllInit(mdtFile); - - mdFile tkFile; - while (pMDImport->EnumNext(&hEnum, &tkFile)) - { - LPCSTR szName; - DWORD flags; - IfFailThrow(pMDImport->GetFileProps(tkFile, &szName, NULL, NULL, &flags)); - - if (!IsFfContainsMetaData(flags)) - continue; - - SString strFileName(SString::Utf8, szName); - LPCWSTR wszFileName = strFileName.GetUnicode(); - - // - // We want to compile this file. - // - - CORINFO_MODULE_HANDLE hModule; - - IfFailThrow(m_pEECompileInfo->LoadAssemblyModule(m_hAssembly, - tkFile, &hModule)); - - SString strNativeImagePath; - HANDLE hFile; - - { - NewHolder pModule; - pModule = CompileModule(hModule, NULL); - - { - SString strFileNameWithoutExt(strFileName); - SString::CIterator fileNameIterator = strFileNameWithoutExt.End(); - if (!strFileNameWithoutExt.FindBack(fileNameIterator, '.')) - ThrowHR(E_FAIL); - strFileNameWithoutExt.Truncate(fileNameIterator.ConstCast()); - - pModule->SetPdbFileName(SString(strFileNameWithoutExt, SL(W(".ni.pdb")))); - - strNativeImagePath.Set(m_outputPath, SL(W("\\")), wszFileName); - - hFile = pModule->SaveImage(strNativeImagePath.GetUnicode(), NULL); - hFiles.Append(hFile); - } - } - - { - NewArrayHolder pbHashValue; - DWORD cbHashValue; - ComputeHashValue(hFile, hashAlgId, &pbHashValue, &cbHashValue); - - mdFile token; - IfFailThrow(m_pAssemblyEmit->DefineFile(wszFileName, pbHashValue, cbHashValue, 0, &token)); - } - } -} -#endif // FEATURE_MULTIMODULE_ASSEMBLIES ZapImage * Zapper::CompileModule(CORINFO_MODULE_HANDLE hModule, IMetaDataAssemblyEmit *pAssemblyEmit) -- cgit v1.2.3