예제 #1
0
파일: cceegen.cpp 프로젝트: ArildF/masters
STDMETHODIMP CCeeGen::GetSectionBlock ( 
		HCEESECTION section, 
		ULONG len, 
		ULONG align, 
		void **ppBytes)
{
    CeeSection *pSection = (CeeSection*) section;
    *ppBytes = (BYTE *)pSection->getBlock(len, align);
    if (*ppBytes == 0)
        return E_OUTOFMEMORY;
	return NOERROR;
}
예제 #2
0
HRESULT CeeFileGenWriter::setVTableEntry(ULONG size, ULONG offset)
{
    if (offset && size)
    {
		void * pv;
        CeeSection TextSection = getTextSection();
        getMethodRVA(TextSection.dataLen(), &m_dwVTableRVA);
        if((pv = TextSection.getBlock(size)))
			memcpy(pv,(void *)offset,size);
		else return E_OUTOFMEMORY;
        m_dwVTableSize = size;
    }

    return S_OK;
} // HRESULT CeeFileGenWriter::setVTableEntry()
예제 #3
0
파일: cceegen.cpp 프로젝트: ArildF/masters
// Create the COM header - it goes at front of .meta section
// Need to do this before the meta data is copied in, but don't do at
// the same time because may not have metadata
HRESULT CCeeGen::allocateCorHeader()
{
	HRESULT hr = S_OK;
	CeeSection *corHeaderSection;
	if (m_corHdrIdx < 0) {
		hr = getSectionCreate(".text0", sdExecute, &corHeaderSection, &m_corHdrIdx);
		TESTANDRETURNHR(hr);
	}

	m_corHeaderOffset = corHeaderSection->dataLen();
    m_corHeader = (IMAGE_COR20_HEADER*)corHeaderSection->getBlock(sizeof(IMAGE_COR20_HEADER));
	if (! m_corHeader)
		return E_OUTOFMEMORY;
    memset(m_corHeader, 0, sizeof(IMAGE_COR20_HEADER));
    return S_OK;
}