summaryrefslogtreecommitdiff
path: root/src/ilasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/ilasm')
-rw-r--r--src/ilasm/asmman.cpp263
-rw-r--r--src/ilasm/asmman.hpp10
-rw-r--r--src/ilasm/asmtemplates.h49
-rw-r--r--src/ilasm/assem.cpp14
-rw-r--r--src/ilasm/assembler.cpp31
-rw-r--r--src/ilasm/assembler.h7
-rw-r--r--src/ilasm/grammar_after.cpp11
-rw-r--r--src/ilasm/grammar_before.cpp12
-rw-r--r--src/ilasm/main.cpp28
-rw-r--r--src/ilasm/method.cpp20
-rw-r--r--src/ilasm/writer.cpp230
-rw-r--r--src/ilasm/writer_enc.cpp59
12 files changed, 0 insertions, 734 deletions
diff --git a/src/ilasm/asmman.cpp b/src/ilasm/asmman.cpp
index dba481faf2..4f594d67cb 100644
--- a/src/ilasm/asmman.cpp
+++ b/src/ilasm/asmman.cpp
@@ -10,9 +10,6 @@
#include "assembler.h"
#include "strongname.h"
-#ifndef FEATURE_CORECLR
-#include "LegacyActivationShim.h"
-#endif
#include <limits.h>
#include <fusion.h>
@@ -154,76 +151,6 @@ void AsmMan::SetModuleName(__inout_opt __nullterminated char* szName)
}
//==============================================================================================================
// Borrowed from VM\assembly.cpp
-#ifndef FEATURE_CORECLR
-HRESULT GetHash(__in LPWSTR moduleName,
- ALG_ID iHashAlg,
- BYTE** pbCurrentValue, // should be NULL
- DWORD *cbCurrentValue)
-{
- HRESULT hr = E_FAIL;
- HCRYPTPROV hProv = 0;
- HCRYPTHASH hHash = 0;
- DWORD dwCount = sizeof(DWORD);
- PBYTE pbBuffer = NULL;
- DWORD dwBufferLen;
- HANDLE hFile = INVALID_HANDLE_VALUE;
- HANDLE hMapFile = NULL;
-
- hFile = WszCreateFile(moduleName, GENERIC_READ, FILE_SHARE_READ,
- 0, OPEN_EXISTING, 0, 0);
- if (hFile == INVALID_HANDLE_VALUE) return E_FAIL;
-
- dwBufferLen = SafeGetFileSize(hFile,NULL);
- if (dwBufferLen == 0xffffffff)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto exit;
- }
- hMapFile = WszCreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (hMapFile == NULL) goto exit;
-
- pbBuffer = (PBYTE) MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
- if (pbBuffer == NULL) goto exit;
-
- // No need to late bind this stuff, all these crypto API entry points happen
- // to live in ADVAPI32.
-
- if ((!WszCryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) ||
- (!CryptCreateHash(hProv, iHashAlg, 0, 0, &hHash)) ||
- (!CryptHashData(hHash, pbBuffer, dwBufferLen, 0)) ||
- (!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE *) cbCurrentValue,
- &dwCount, 0))) {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto exit;
- }
-
- *pbCurrentValue = new BYTE[*cbCurrentValue];
- if (!(*pbCurrentValue)) {
- hr = E_OUTOFMEMORY;
- goto exit;
- }
-
- if(!CryptGetHashParam(hHash, HP_HASHVAL, *pbCurrentValue, cbCurrentValue, 0)) {
- hr = HRESULT_FROM_WIN32(GetLastError());
- delete[] *pbCurrentValue;
- *pbCurrentValue = 0;
- goto exit;
- }
-
- hr = S_OK;
-
- exit:
- if (pbBuffer) UnmapViewOfFile(pbBuffer);
- if (hMapFile) CloseHandle(hMapFile);
- CloseHandle(hFile);
- if (hHash)
- CryptDestroyHash(hHash);
- if (hProv)
- CryptReleaseContext(hProv, 0);
-
- return hr;
-}
-#endif // !FEATURE_CORECLR
//==============================================================================================================
void AsmMan::AddFile(__in __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob)
@@ -277,13 +204,6 @@ void AsmMan::EmitFiles()
if(m_pAssembly // and assembly is defined
&& m_pAssembly->ulHashAlgorithm) // and hash algorithm is defined...
{ // then try to compute it
-#ifndef FEATURE_CORECLR
- if(SUCCEEDED(GetHash(wzUniBuf,(ALG_ID)(m_pAssembly->ulHashAlgorithm),&pHash,&cbHash)))
- {
- tmp->pHash = new BinStr(pHash,cbHash);
- }
- else
-#endif // !FEATURE_CORECLR
{
pHash = NULL;
cbHash = 0;
@@ -449,145 +369,6 @@ void AsmMan::EndAssembly()
m_pCurAsmRef = NULL;
return;
}
-#ifndef FEATURE_CORECLR
- if(m_pCurAsmRef->isAutodetect)
- {
- IAssemblyName* pIAsmName;
- HRESULT hr;
- // Convert name to Unicode
- WszMultiByteToWideChar(g_uCodePage,0,m_pCurAsmRef->szName,-1,wzUniBuf,dwUniBuf);
- hr = CreateAssemblyNameObject(&pIAsmName,wzUniBuf,CANOF_PARSE_DISPLAY_NAME,NULL);
- if(SUCCEEDED(hr))
- {
- // set enumeration criteria: what is known about AsmRef (besides name)
- if(m_pCurAsmRef->usVerMajor != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_MAJOR_VERSION,&(m_pCurAsmRef->usVerMajor),2);
- if(m_pCurAsmRef->usVerMinor != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_MINOR_VERSION,&(m_pCurAsmRef->usVerMinor),2);
- if(m_pCurAsmRef->usBuild != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_BUILD_NUMBER,&(m_pCurAsmRef->usBuild),2);
- if(m_pCurAsmRef->usRevision != (USHORT)0xFFFF)
- pIAsmName->SetProperty(ASM_NAME_REVISION_NUMBER,&(m_pCurAsmRef->usRevision),2);
- if(m_pCurAsmRef->pPublicKeyToken)
- pIAsmName->SetProperty(ASM_NAME_PUBLIC_KEY_TOKEN,
- m_pCurAsmRef->pPublicKeyToken->ptr(),
- m_pCurAsmRef->pPublicKeyToken->length());
- if(m_pCurAsmRef->pLocale)
- pIAsmName->SetProperty(ASM_NAME_CULTURE,
- m_pCurAsmRef->pLocale->ptr(),
- m_pCurAsmRef->pLocale->length());
-
- // enumerate assemblies
- IAssemblyEnum* pIAsmEnum = NULL;
- hr = CreateAssemblyEnum(&pIAsmEnum, NULL, pIAsmName, ASM_CACHE_GAC, NULL);
- if(SUCCEEDED(hr))
- {
- IAssemblyName* pIAsmNameFound;
- IAssemblyName* pIAsmNameLatestVer = NULL;
- ULONGLONG ullVer=0, ullVerLatest=0;
- DWORD dwVerHi, dwVerLo;
-
- // find the latest and greatest, if any
- for(;;)
- {
- pIAsmNameFound = NULL;
- hr = pIAsmEnum->GetNextAssembly(NULL,&pIAsmNameFound,0);
- if(SUCCEEDED(hr) && pIAsmNameFound)
- {
-
- pIAsmNameFound->GetVersion(&dwVerHi,&dwVerLo);
- ullVer = (ULONGLONG)dwVerHi;
- ullVer <<= sizeof(DWORD);
- ullVer |= dwVerLo;
- if(ullVer > ullVerLatest)
- {
- if(pIAsmNameLatestVer)
- pIAsmNameLatestVer->Release();
- ullVerLatest = ullVer;
- pIAsmNameLatestVer = pIAsmNameFound;
- }
- else
- pIAsmNameFound->Release();
- }
- else break;
- }
- // if found, fill the gaps
- if(pIAsmNameLatestVer)
- {
- DWORD cbSize=0;
- USHORT usDummy=0;
-
- if(m_pCurAsmRef->pPublicKeyToken == NULL)
- {
- cbSize = 1024;
- pIAsmNameLatestVer->GetProperty(ASM_NAME_PUBLIC_KEY_TOKEN,
- wzUniBuf, &cbSize);
- if(cbSize)
- {
- if((m_pCurAsmRef->pPublicKeyToken = new BinStr()))
- memcpy(m_pCurAsmRef->pPublicKeyToken->getBuff(cbSize),
- wzUniBuf, cbSize);
- }
- }
-
- if(m_pCurAsmRef->usVerMajor == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_MAJOR_VERSION,
- &usDummy, &cbSize);
- m_pCurAsmRef->usVerMajor = usDummy;
- }
- if(m_pCurAsmRef->usVerMinor == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_MINOR_VERSION,
- &usDummy, &cbSize);
- m_pCurAsmRef->usVerMinor = usDummy;
- }
- if(m_pCurAsmRef->usBuild == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_BUILD_NUMBER,
- &usDummy, &cbSize);
- m_pCurAsmRef->usBuild = usDummy;
- }
- if(m_pCurAsmRef->usRevision == (USHORT)0xFFFF)
- {
- cbSize = (DWORD)sizeof(WORD);
- pIAsmNameLatestVer->GetProperty(ASM_NAME_REVISION_NUMBER,
- &usDummy, &cbSize);
- m_pCurAsmRef->usRevision = usDummy;
- }
-
- if(m_pCurAsmRef->pLocale == NULL)
- {
- cbSize = 1024;
- pIAsmNameLatestVer->GetProperty(ASM_NAME_CULTURE,
- wzUniBuf, &cbSize);
-
- if(cbSize > (DWORD)sizeof(WCHAR))
- {
- if((m_pCurAsmRef->pLocale = new BinStr()))
- memcpy(m_pCurAsmRef->pLocale->getBuff(cbSize),
- wzUniBuf, cbSize);
- }
- }
- pIAsmNameLatestVer->Release();
- }
- else
- report->warn("Failed to autodetect assembly '%s'\n",m_pCurAsmRef->szName);
- // if no assembly found, leave it as is, it might be not a GAC assembly
-
- pIAsmEnum->Release();
- }
- else
- report->error("Failed to enum assemblies %S, hr=0x%08X\n",wzUniBuf,hr);
- pIAsmName->Release();
- }
- else
- report->error("Failed to create assembly name object for %S, hr=0x%08X\n",wzUniBuf,hr);
- } // end if isAutodetect
-#endif // !FEATURE_CORECLR
m_AsmRefLst.PUSH(m_pCurAsmRef);
m_pCurAsmRef->tkTok = TokenFromRid(m_AsmRefLst.COUNT(),mdtAssemblyRef);
}
@@ -608,29 +389,9 @@ void AsmMan::EndAssembly()
// character of the source ('@' for container).
if (*(((Assembler*)m_pAssembler)->m_wzKeySourceName) == L'@')
{
-#ifdef FEATURE_CORECLR
report->error("Error: ilasm on CoreCLR does not support getting public key from container.\n");
m_pCurAsmRef = NULL;
return;
-#else
- // Extract public key from container (works whether
- // container has just a public key or an entire key
- // pair).
- m_sStrongName.m_wzKeyContainer = &((Assembler*)m_pAssembler)->m_wzKeySourceName[1];
- if (FAILED(hr = LegacyActivationShim::StrongNameGetPublicKey_HRESULT(
- m_sStrongName.m_wzKeyContainer,
- NULL,
- 0,
- &m_sStrongName.m_pbPublicKey,
- &m_sStrongName.m_cbPublicKey)))
- {
- report->error("Failed to extract public key from '%S': 0x%08X\n",m_sStrongName.m_wzKeyContainer,hr);
- m_pCurAsmRef = NULL;
- return;
- }
- m_sStrongName.m_fFullSign = TRUE;
- m_sStrongName.m_dwPublicKeyAllocated = AsmManStrongName::AllocatedBySNApi;
-#endif // FEATURE_CORECLR
}
else
{
@@ -696,33 +457,9 @@ void AsmMan::EndAssembly()
// from a consistent place.
if (m_sStrongName.m_fFullSign)
{
-#ifdef FEATURE_CORECLR
report->error("Error: ilasm on CoreCLR does not support full sign.\n");
m_pCurAsmRef = NULL;
return;
-#else
- m_sStrongName.m_pbPrivateKey = m_sStrongName.m_pbPublicKey;
- m_sStrongName.m_cbPrivateKey = m_sStrongName.m_cbPublicKey;
-
- m_sStrongName.m_pbPublicKey = NULL;
- m_sStrongName.m_cbPublicKey = NULL;
- m_sStrongName.m_dwPublicKeyAllocated = AsmManStrongName::NotAllocated;
-
- // Retrieve the public key portion as a byte blob.
- if (FAILED(hr = LegacyActivationShim::StrongNameGetPublicKey_HRESULT(
- NULL,
- m_sStrongName.m_pbPrivateKey,
- m_sStrongName.m_cbPrivateKey,
- &m_sStrongName.m_pbPublicKey,
- &m_sStrongName.m_cbPublicKey)))
- {
- report->error("Failed to extract public key: 0x%08X\n",hr);
- m_pCurAsmRef = NULL;
- return;
- }
-
- m_sStrongName.m_dwPublicKeyAllocated = AsmManStrongName::AllocatedBySNApi;
-#endif // FEATURE_CORECLR
}
}
}
diff --git a/src/ilasm/asmman.hpp b/src/ilasm/asmman.hpp
index 35d8fdc0bc..0ee875b805 100644
--- a/src/ilasm/asmman.hpp
+++ b/src/ilasm/asmman.hpp
@@ -9,9 +9,6 @@
#define ASMMAN_HPP
#include "strongname.h"
-#ifndef FEATURE_CORECLR
-#include "LegacyActivationShim.h"
-#endif
#include "specstrings.h"
struct AsmManFile
@@ -173,13 +170,6 @@ struct AsmManStrongName
AsmManStrongName() { ZeroMemory(this, sizeof(*this)); }
~AsmManStrongName()
{
-#ifndef FEATURE_CORECLR
- if (m_dwPublicKeyAllocated == AllocatedBySNApi)
- {
- LegacyActivationShim::StrongNameFreeBuffer(m_pbPublicKey);
- }
- else
-#endif
if (m_dwPublicKeyAllocated == AllocatedByNew)
delete [] m_pbPublicKey;
diff --git a/src/ilasm/asmtemplates.h b/src/ilasm/asmtemplates.h
index eb2b413abf..b7d3025f02 100644
--- a/src/ilasm/asmtemplates.h
+++ b/src/ilasm/asmtemplates.h
@@ -60,54 +60,6 @@ private:
};
-#if (0)
-template <class T>
-class FIFO
-{
-public:
- inline FIFO() { m_pHead = m_pTail = NULL; m_ulCount = 0;};
- inline ~FIFO() {T *val; while(val = POP()) delete val; };
- void PUSH(T *item)
- {
- m_pTemp = new LIST_EL <T>(item);
- if(m_pTail) m_pTail->m_Next = m_pTemp;
- m_pTail = m_pTemp;
- if(m_pHead == NULL) m_pHead = m_pTemp;
- m_ulCount++;
- };
- T* POP()
- {
- T* ret = NULL;
- if(m_pTemp = m_pHead)
- {
- m_pHead = m_pHead->m_Next;
- ret = m_pTemp->m_Ptr;
- delete m_pTemp;
- if(m_pHead == NULL) m_pTail = NULL;
- m_ulCount--;
- }
- return ret;
- };
- ULONG COUNT() { return m_ulCount; };
- T* PEEK(ULONG idx)
- {
- T* ret = NULL;
- ULONG i;
- if(idx < m_ulCount)
- {
- if(idx == m_ulCount-1) m_pTemp = m_pTail;
- else for(m_pTemp = m_pHead, i = 0; i < idx; m_pTemp = m_pTemp->m_Next, i++);
- ret = m_pTemp->m_Ptr;
- }
- return ret;
- };
-private:
- LIST_EL <T> *m_pHead;
- LIST_EL <T> *m_pTail;
- LIST_EL <T> *m_pTemp;
- ULONG m_ulCount;
-};
-#else
template <class T>
class FIFO
{
@@ -180,7 +132,6 @@ private:
ULONG m_ulOffset;
ULONG m_ulArrLen;
};
-#endif
template <class T> struct Indx256
diff --git a/src/ilasm/assem.cpp b/src/ilasm/assem.cpp
index 18247621f9..6416dfe5c7 100644
--- a/src/ilasm/assem.cpp
+++ b/src/ilasm/assem.cpp
@@ -231,24 +231,18 @@ Assembler::~Assembler()
m_pDisp = NULL;
}
-#ifdef FEATURE_CORECLR
#ifdef FEATURE_PAL
if (g_loader != NULL)
{
g_loader->Finish();
}
#endif
-#else
- if (m_fDidCoInitialise)
- CoUninitialize();
-#endif // FEATURE_CORECLR
}
BOOL Assembler::Init()
{
-#ifdef FEATURE_CORECLR
#ifdef FEATURE_PAL
g_loader = CoreCLRLoader::Create(g_pszExeFile);
if (g_loader == NULL)
@@ -259,14 +253,6 @@ BOOL Assembler::Init()
#else
metaDataGetDispenser = (MetaDataGetDispenserFunc)MetaDataGetDispenser;
#endif // FEATURE_PAL
-#else
- if(!m_fDidCoInitialise)
- {
- if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
- return FALSE;
- m_fDidCoInitialise = TRUE;
- }
-#endif // FEATURE_CORECLR
if (m_pCeeFileGen != NULL) {
if (m_pCeeFile)
m_pCeeFileGen->DestroyCeeFile(&m_pCeeFile);
diff --git a/src/ilasm/assembler.cpp b/src/ilasm/assembler.cpp
index 49d4ee9712..92fd681af6 100644
--- a/src/ilasm/assembler.cpp
+++ b/src/ilasm/assembler.cpp
@@ -99,17 +99,6 @@ mdToken Assembler::ResolveClassRef(mdToken tkResScope, __in __nullterminated con
mdToken *ptkSpecial = NULL;
if(pszFullClassName == NULL) return mdTokenNil;
-#if (0)
- if (m_fInitialisedMetaData == FALSE)
- {
- if (FAILED(InitMetaData())) // impl. see WRITER.CPP
- {
- _ASSERTE(0);
- if(ppClass) *ppClass = NULL;
- return mdTokenNil;
- }
- }
-#endif
switch(strlen(pszFullClassName))
{
@@ -2213,26 +2202,6 @@ void Assembler::EmitBytes(BYTE *p, unsigned len)
BinStr* Assembler::EncodeSecAttr(__in __nullterminated char* szReflName, BinStr* pbsSecAttrBlob, unsigned nProps)
{
unsigned cnt;
-#if (0)
- // Emit MemberRef for .ctor
- mdToken tkMscorlib = m_fIsMscorlib ? 1 : GetAsmRef("mscorlib");
- char buffer[64];
- BinStr *pbsSig = new BinStr();
-
- strcpy(buffer,"System.Security.Permissions.SecurityAction");
- mdToken tkSecAction = ResolveClassRef(tkMscorlib,buffer, NULL);
-
- pbsSig->appendInt8(IMAGE_CEE_CS_CALLCONV_HASTHIS);
- pbsSig->appendInt8(1); //corEmitInt(pbsSig,1);
- pbsSig->appendInt8(ELEMENT_TYPE_VOID);
- pbsSig->appendInt8(ELEMENT_TYPE_VALUETYPE);
- cnt = CorSigCompressToken(tkSecAction, pbsSig->getBuff(5));
- pbsSig->remove(5 - cnt);
-
- char* szName = new char[16];
- strcpy(szName,".ctor");
- MakeMemberRef(tkSecAttr,szName,pbsSig);
-#endif
// build the blob As BinStr
unsigned L = (unsigned) strlen(szReflName);
diff --git a/src/ilasm/assembler.h b/src/ilasm/assembler.h
index 1c211bc3c5..2e3404f7d3 100644
--- a/src/ilasm/assembler.h
+++ b/src/ilasm/assembler.h
@@ -1049,10 +1049,6 @@ public:
void EmitSecurityInfo(mdToken token,
PermissionDecl* pPermissions,
PermissionSetDecl*pPermissionSets);
-#ifndef FEATURE_CORECLR
- HRESULT AllocateStrongNameSignature();
- HRESULT StrongNameSign();
-#endif
BinStr* EncodeSecAttr(__in __nullterminated char* szReflName, BinStr* pbsSecAttrBlob, unsigned nProps);
// Custom values paraphernalia:
@@ -1189,9 +1185,6 @@ public:
unsigned NumTypeDefs() {return m_TypeDefDList.COUNT();};
private:
HRESULT GetCAName(mdToken tkCA, __out LPWSTR *ppszName);
-#ifndef FEATURE_CORECLR
- HRESULT GetSignatureKey();
-#endif
};
#endif // Assember_h
diff --git a/src/ilasm/grammar_after.cpp b/src/ilasm/grammar_after.cpp
index c8634801c7..344e504f05 100644
--- a/src/ilasm/grammar_after.cpp
+++ b/src/ilasm/grammar_after.cpp
@@ -372,16 +372,6 @@ static void AppendStringWithLength(BinStr* pbs, __in __nullterminated char* sz)
/* fetch the next token, and return it Also set the yylval.union if the
lexical token also has a value */
-#if (0)
-
-#define IsAlpha(x) ((('A' <= (x))&&((x) <= 'Z'))||(('a' <= (x))&&((x) <= 'z')))
-#define IsDigit(x) (('0' <= (x))&&((x) <= '9'))
-#define IsAlNum(x) (IsAlpha(x) || IsDigit(x))
-#define IsValidStartingSymbol(x) (IsAlpha(x)||((x)=='#')||((x)=='_')||((x)=='@')||((x)=='$'))
-#define IsValidContinuingSymbol(x) (IsAlNum(x)||((x)=='_')||((x)=='@')||((x)=='$')||((x)=='?'))
-void SetSymbolTables() { ; }
-
-#else
BOOL _Alpha[128];
BOOL _Digit[128];
@@ -433,7 +423,6 @@ BOOL IsAlNum(unsigned x) { return (x < 128)&&_AlNum[x]; }
BOOL IsValidStartingSymbol(unsigned x) { return (x < 128)&&_ValidSS[x]; }
BOOL IsValidContinuingSymbol(unsigned x) { return (x < 128)&&_ValidCS[x]; }
-#endif
char* nextBlank(__in __nullterminated char* curPos)
{
diff --git a/src/ilasm/grammar_before.cpp b/src/ilasm/grammar_before.cpp
index 42d2927fa5..dd30416bae 100644
--- a/src/ilasm/grammar_before.cpp
+++ b/src/ilasm/grammar_before.cpp
@@ -29,17 +29,6 @@ static AsmParse* parser = 0;
#define PASMM (parser->assem->m_pManifest)
#define PENV (parser->penv)
-#if (0)
-
-#define nextchar parser->penv->pfn_nextchar
-#define Sym parser->penv->pfn_Sym
-#define NewStrFromToken parser->penv->pfn_NewStrFromToken
-#define NewStaticStrFromToken parser->penv->pfn_NewStaticStrFromToken
-#define GetDouble parser->penv->pfn_GetDouble
-
-void SetFunctionPtrs() {;}
-
-#else
PFN_NEXTCHAR nextchar;
@@ -57,7 +46,6 @@ void SetFunctionPtrs()
GetDouble = PENV->pfn_GetDouble;
}
-#endif
static char* newStringWDel(__in __nullterminated char* str1, char delimiter, __in __nullterminated char* str3 = 0);
static char* newString(__in __nullterminated const char* str1);
diff --git a/src/ilasm/main.cpp b/src/ilasm/main.cpp
index 2bef40dd47..35f4545a05 100644
--- a/src/ilasm/main.cpp
+++ b/src/ilasm/main.cpp
@@ -248,12 +248,8 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
else if (!_stricmp(szOpt, "DEB"))
{
pAsm->m_dwIncludeDebugInfo = 0x101;
-#ifdef FEATURE_CORECLR
// PDB is ignored under 'DEB' option for ilasm on CoreCLR.
// https://github.com/dotnet/coreclr/issues/2982
-#else
- pAsm->m_fGeneratePDB = TRUE;
-#endif
bNoDebug = FALSE;
WCHAR *pStr = EqualOrColon(argv[i]);
@@ -281,12 +277,8 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
}
else if (!_stricmp(szOpt, "PDB"))
{
-#ifdef FEATURE_CORECLR
// 'PDB' option is ignored for ilasm on CoreCLR.
// https://github.com/dotnet/coreclr/issues/2982
-#else
- pAsm->m_fGeneratePDB = TRUE;
-#endif
bNoDebug = FALSE;
}
else if (!_stricmp(szOpt, "CLO"))
@@ -746,21 +738,8 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
exitval = 1;
pParser->msg("Failed to write output file, error code=0x%08X\n",hr);
}
-#ifndef FEATURE_CORECLR
- else if (pAsm->m_pManifest->m_sStrongName.m_fFullSign)
- {
- // Strong name sign the resultant assembly.
- if(pAsm->m_fReportProgress) pParser->msg("Signing file with strong name\n");
- if (FAILED(hr=pAsm->StrongNameSign()))
- {
- exitval = 1;
- pParser->msg("Failed to strong name sign output file, error code=0x%08X\n",hr);
- }
- }
-#endif
if(bClock) cw.cEnd = GetTickCount();
#define ENC_ENABLED
-#ifdef ENC_ENABLED
if(exitval==0)
{
pAsm->m_fENCMode = TRUE;
@@ -857,7 +836,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
}
} // end for(iFile)
} // end if(exitval==0)
-#endif
}
}
@@ -922,12 +900,6 @@ extern "C" int _cdecl wmain(int argc, __in WCHAR **argv)
#pragma warning(pop)
#endif
-#ifndef FEATURE_CORECLR
-HINSTANCE GetModuleInst()
-{
- return (NULL);
-}
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_PAL
int main(int argc, char* str[])
diff --git a/src/ilasm/method.cpp b/src/ilasm/method.cpp
index 18f6c47b00..8fc300c23a 100644
--- a/src/ilasm/method.cpp
+++ b/src/ilasm/method.cpp
@@ -93,16 +93,6 @@ void Method::OpenScope()
{
psc->dwStart = m_pAssembler->m_CurPC;
psc->pSuperScope = m_pCurrScope;
-#if(0)
- LinePC *pLPC = new LinePC;
- if(pLPC)
- {
- pLPC->Line = m_pAssembler->m_ulCurLine;
- pLPC->Column = m_pAssembler->m_ulCurColumn;
- pLPC->PC = m_pAssembler->m_CurPC;
- m_LinePCList.PUSH(pLPC);
- }
-#endif
m_pCurrScope->SubScope.PUSH(psc);
m_pCurrScope = psc;
}
@@ -116,16 +106,6 @@ void Method::CloseScope()
if((pVD = m_Locals.PEEK(pAN->dwAttr))) pVD->bInScope = FALSE;
}
m_pCurrScope->dwEnd = m_pAssembler->m_CurPC;
-#if(0)
- LinePC *pLPC = new LinePC;
- if(pLPC)
- {
- pLPC->Line = m_pAssembler->m_ulCurLine;
- pLPC->Column = m_pAssembler->m_ulCurColumn;
- pLPC->PC = m_pAssembler->m_CurPC;
- m_LinePCList.PUSH(pLPC);
- }
-#endif
m_pCurrScope = m_pCurrScope->pSuperScope;
}
diff --git a/src/ilasm/writer.cpp b/src/ilasm/writer.cpp
index b5b87ce1ad..85f29af5e7 100644
--- a/src/ilasm/writer.cpp
+++ b/src/ilasm/writer.cpp
@@ -10,10 +10,6 @@
#include "assembler.h"
#include "ceefilegenwriter.h"
-#ifndef FEATURE_CORECLR
-#include "strongname.h"
-#include "LegacyActivationShim.h"
-#endif
#ifndef _MSC_VER
//cloned definition from ntimage.h that is removed for non MSVC builds
@@ -34,17 +30,8 @@ HRESULT Assembler::InitMetaData()
if(bClock) bClock->cMDInitBegin = GetTickCount();
-#ifdef FEATURE_CORECLR
hr = metaDataGetDispenser(CLSID_CorMetaDataDispenser,
IID_IMetaDataDispenserEx, (void **)&m_pDisp);
-#else
- hr = LegacyActivationShim::ClrCoCreateInstance(
- CLSID_CorMetaDataDispenser,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_IMetaDataDispenserEx,
- (void **)&m_pDisp);
-#endif
if (FAILED(hr))
goto exit;
@@ -66,25 +53,6 @@ HRESULT Assembler::InitMetaData()
if(FAILED(hr = m_pEmitter->QueryInterface(IID_IMetaDataImport2, (void**)&m_pImporter)))
goto exit;
-#ifndef FEATURE_CORECLR
- hr = CoCreateInstance(CLSID_CorSymWriter_SxS,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_ISymUnmanagedWriter,
- (void **)&m_pSymWriter);
- if(SUCCEEDED(hr))
- {
- if(m_pSymWriter) m_pSymWriter->Initialize((IUnknown*)m_pEmitter,
- m_wzOutputFileName,
- NULL,
- TRUE);
- }
- else
- {
- fprintf(stderr, "Error: QueryInterface(IID_ISymUnmanagedWriter) returns %X\n",hr);
- m_pSymWriter = NULL;
- }
-#endif // !FEATURE_CORECLR
//m_Parser = new AsmParse(m_pEmitter);
m_fInitialisedMetaData = TRUE;
@@ -687,197 +655,6 @@ BYTE HexToByte (CHAR wc)
return (BYTE) (wc - L'a' + 10);
}
-#ifndef FEATURE_CORECLR
-bool GetBytesFromHex (LPCSTR szPublicKeyHexString, ULONG cchPublicKeyHexString, BYTE** buffer, ULONG *cbBufferSize)
-{
- ULONG cchHex = cchPublicKeyHexString;
- if (cchHex % 2 != 0)
- return false;
- *cbBufferSize = cchHex / 2;
-
- *buffer = new BYTE[*cbBufferSize];
- if (!*buffer)
- return false;
-
- for (ULONG i = 0; i < *cbBufferSize; i++)
- {
- BYTE msn = HexToByte(*szPublicKeyHexString);
- BYTE lsn = HexToByte(*(szPublicKeyHexString + 1));
- if (msn == 0xFF || lsn == 0xFF)
- {
- delete[] *buffer;
- return false;
- }
-
- (*buffer)[i] = (BYTE) ( (msn << 4) | lsn );
- szPublicKeyHexString += 2;
- }
-
- return true;
-}
-
-HRESULT Assembler::GetSignatureKey()
-{
- HRESULT hr = S_OK;
- ULONG cbSize = 0;
- void * pvData = NULL;
- LPWSTR pName = NULL;
-
- CustomDescrList* pCDList = &m_pManifest->m_pAssembly->m_CustomDescrList;
-
- for (ULONG i = 0;i < pCDList->COUNT(); i++)
- {
- CustomDescr* pCD = pCDList->PEEK(i);
-
- if(pCD->pBlob)
- {
- pvData = (void *)(pCD->pBlob->ptr());
- cbSize = pCD->pBlob->length();
- pCD->tkOwner = m_pManifest->m_pAssembly->tkTok;
- mdToken tkOwnerType, tkTypeType = TypeFromToken(pCD->tkType);
-
- if (GetCAName(pCD->tkType, &pName) != S_OK)
- continue;
-
- if (wcscmp(pName, L"System.Reflection.AssemblySignatureKeyAttribute") == 0)
- {
- if (cbSize < sizeof(WORD) || GET_UNALIGNED_VAL16(pvData) != 1)
- {
- hr = E_FAIL;
- break;;
- }
- pvData = (unsigned char *)pvData + sizeof(WORD);
- cbSize -= sizeof(WORD);
-
- // String is stored as compressed length, UTF8.
- if (*(const BYTE*)pvData != 0xFF)
- {
- PCCOR_SIGNATURE sig = (PCCOR_SIGNATURE)pvData;
- cbSize -= CorSigUncompressedDataSize(sig);
- DWORD len = CorSigUncompressData(sig);
- pvData = (void *)sig;
- if (cbSize < len)
- {
- hr = E_FAIL;
- break;
- }
-
- AsmManStrongName *pSN = &m_pManifest->m_sStrongName;
- GetBytesFromHex((LPCSTR)pvData, len, &pSN->m_pbSignatureKey, &pSN->m_cbSignatureKey);
- }
-
- break;
- }
-
- if (pName)
- {
- delete pName;
- pName = NULL;
- }
- }
- }
-
- if (pName)
- delete pName;
- return hr;
-}
-
-HRESULT Assembler::AllocateStrongNameSignature()
-{
- HRESULT hr = S_OK;
- HCEESECTION hSection;
- DWORD dwDataLength;
- DWORD dwDataOffset;
- DWORD dwDataRVA;
- VOID *pvBuffer;
- AsmManStrongName *pSN = &m_pManifest->m_sStrongName;
-
- // Pulls the AssemblySignatureKey attribute from m_CustomDescrList
- // If present, populate the pSN->m_pbSignatureKey from the AssemblySignatureKeyAttribute blob
- if (FAILED(hr = GetSignatureKey()))
- {
- return hr;
- }
-
- // Determine size of signature blob.
- if (pSN->m_pbSignatureKey != NULL)
- {
- // If m_pbSignatureKey present use it, else fall back to using identity key.
- if (FAILED(hr = LegacyActivationShim::StrongNameSignatureSize_HRESULT(
- pSN->m_pbSignatureKey,
- pSN->m_cbSignatureKey,
- &dwDataLength)))
- {
- return hr;
- }
- }
- else if (FAILED(hr = LegacyActivationShim::StrongNameSignatureSize_HRESULT(
- pSN->m_pbPublicKey,
- pSN->m_cbPublicKey,
- &dwDataLength)))
- {
- return hr;
- }
-
- // Grab memory in the section for our stuff.
- if (FAILED(hr = m_pCeeFileGen->GetIlSection(m_pCeeFile,
- &hSection)))
- return hr;
-
- if (FAILED(hr = m_pCeeFileGen->GetSectionBlock(hSection,
- dwDataLength,
- 4,
- &pvBuffer)))
- return hr;
-
- // Where did we get that memory?
- if (FAILED(hr = m_pCeeFileGen->GetSectionDataLen(hSection,
- &dwDataOffset)))
- return hr;
-
- dwDataOffset -= dwDataLength;
-
- // Convert to an RVA.
- if (FAILED(hr = m_pCeeFileGen->GetMethodRVA(m_pCeeFile,
- dwDataOffset,
- &dwDataRVA)))
- return hr;
-
- // Emit the directory entry.
- if (FAILED(hr = m_pCeeFileGen->SetStrongNameEntry(m_pCeeFile,
- dwDataLength,
- dwDataRVA)))
- return hr;
-
- return S_OK;
-}
-
-HRESULT Assembler::StrongNameSign()
-{
- LPWSTR wszOutputFile;
- HRESULT hr = S_OK;
- AsmManStrongName *pSN = &m_pManifest->m_sStrongName;
-
- // Determine what the ouput PE was called.
- if (FAILED(hr = m_pCeeFileGen->GetOutputFileName(m_pCeeFile,
- &wszOutputFile)))
- return hr;
-
- // Update the output PE image with a strong name signature.
- if (FAILED(hr = LegacyActivationShim::StrongNameSignatureGeneration_HRESULT(
- wszOutputFile,
- pSN->m_wzKeyContainer,
- pSN->m_pbPrivateKey,
- pSN->m_cbPrivateKey,
- NULL,
- NULL)))
- {
- return hr;
- }
-
- return S_OK;
-}
-#endif // !FEATURE_CORECLR
BOOL Assembler::EmitFieldsMethods(Class* pClass)
{
@@ -1231,13 +1008,6 @@ HRESULT Assembler::CreatePEFile(__in __nullterminated WCHAR *pwzOutputFilename)
if(bClock) bClock->cMDEmit1 = GetTickCount();
-#ifndef FEATURE_CORECLR
- // Allocate space for a strong name signature if we're delay or full
- // signing the assembly.
- if (m_pManifest->m_sStrongName.m_pbPublicKey)
- if (FAILED(hr = AllocateStrongNameSignature()))
- goto exit;
-#endif
if(bClock) bClock->cMDEmit2 = GetTickCount();
diff --git a/src/ilasm/writer_enc.cpp b/src/ilasm/writer_enc.cpp
index 055b2edca9..eee9c00a0a 100644
--- a/src/ilasm/writer_enc.cpp
+++ b/src/ilasm/writer_enc.cpp
@@ -70,28 +70,6 @@ HRESULT Assembler::InitMetaDataForENC(__in __nullterminated WCHAR* wzOrigFileNam
if(!Init()) goto exit; // close and re-open CeeFileGen and CeeFile
hr = S_OK;
-#ifndef FEATURE_CORECLR
- hr = CoCreateInstance(CLSID_CorSymWriter_SxS,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_ISymUnmanagedWriter,
- (void **)&m_pSymWriter);
- if(SUCCEEDED(hr))
- {
- WCHAR* pwc = &wzOrigFileName[wcslen(wzOrigFileName)];
- wcscat_s(wzOrigFileName,MAX_SCOPE_LENGTH,W(".pdb"));
- if(m_pSymWriter) m_pSymWriter->Initialize((IUnknown*)m_pEmitter,
- wzOrigFileName,
- NULL,
- TRUE);
- *pwc = 0;
- }
- else
- {
- fprintf(stderr, "Error: CoCreateInstance(IID_ISymUnmanagedWriter) returns %X\n",hr);
- m_pSymWriter = NULL;
- }
-#endif
exit:
return hr;
@@ -453,43 +431,6 @@ REPT_STEP
pBaseMDEmit->Release();
}
-#if(0)
-//===================================================================================
- // release SymWriter interfaces
- if (m_pSymWriter != NULL)
- {
- m_pSymWriter->Close();
- m_pSymWriter->Release();
- m_pSymWriter = NULL;
- }
-
- hr = CoCreateInstance(CLSID_CorSymWriter_SxS,
- NULL,
- CLSCTX_INPROC_SERVER,
- IID_ISymUnmanagedWriter,
- (void **)&m_pSymWriter);
- if(SUCCEEDED(hr))
- {
- WCHAR* pwc = &pwzOutputFilename[wcslen(pwzOutputFilename)];
- wcscat(pwzOutputFilename,L".pdb");
- if(m_pSymWriter) m_pSymWriter->Initialize((IUnknown*)m_pEmitter,
- pwzOutputFilename,
- NULL,
- TRUE);
- *pwc = 0;
- }
- else
- {
- fprintf(stderr, "Error: CoCreateInstance(IID_ISymUnmanagedWriter) returns %X\n",hr);
- m_pSymWriter = NULL;
- }
-
- m_fENCMode = FALSE;
- if(FAILED(hr=CreatePEFile(pwzOutputFilename)))
- report->msg("Could not create output file, error code=0x%08X\n",hr);
- m_fENCMode = TRUE;
-//=====================================================================================
-#endif
// release all interfaces
if (m_pSymWriter != NULL)