STDMETHODIMP CCeeGen::GetSectionDataLen ( HCEESECTION section, ULONG *dataLen) { CeeSection *pSection = (CeeSection*) section; *dataLen = pSection->dataLen(); return NOERROR; }
STDMETHODIMP CCeeGen::GetSectionDataLen ( HCEESECTION section, ULONG *dataLen) { BEGIN_ENTRYPOINT_NOTHROW; CeeSection *pSection = (CeeSection*) section; *dataLen = pSection->dataLen(); END_ENTRYPOINT_NOTHROW; return NOERROR; }
HRESULT CeeFileGenWriter::setManifestEntry(ULONG size, ULONG offset) { if (offset) m_dwManifestRVA = offset; else { CeeSection TextSection = getTextSection(); getMethodRVA(TextSection.dataLen() - size, &m_dwManifestRVA); } m_dwManifestSize = size; return S_OK; } // HRESULT CeeFileGenWriter::setManifestEntry()
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()
// 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; }