library/src/ELF/ELF32/BP-ELFExtraction.cc
// Extract actual sections from the full headers section list (no types)
Extract actual sections from the full headers section list (no types)
Extract actual sections from the full headers section list ( no types )
int ELF32_ExtractSections_File(P_ELF_32BIT_LOOKUP_TABLE fullHeader, FILE *elfFile){
	if(fullHeader == NULL)
		return ERR_FAILURE;
	if(fullHeader->sections == NULL)
		return ERR_FAILURE;
	P_ELF_SECTION_LIST_32BIT firstPtr = fullHeader->sections->first;
	for(fullHeader->sections = fullHeader->sections->first; \
		fullHeader->sections != NULL; \
		fullHeader->sections = fullHeader->sections->next){
			rewind(elfFile);
			fseek(elfFile, fullHeader->sections->section->offset, SEEK_SET);
			fullHeader->sections->data = (unsigned char *) bpmalloc(fullHeader->sections->section->size);
			fread(fullHeader->sections->data, 1, fullHeader->sections->section->size, elfFile);
			fullHeader->sections->dataSize = fullHeader->sections->section->size;
	}
	fullHeader->sections = 	firstPtr;
	return ERR_SUCCESS;
}
int ELF32_ExtractSections_File ( P_ELF_32BIT_LOOKUP_TABLE fullHeader , FILE * elfFile ) { if ( fullHeader == NULL ) return ERR_FAILURE ; if ( fullHeader -> sections == NULL ) return ERR_FAILURE ; P_ELF_SECTION_LIST_32BIT firstPtr = fullHeader -> sections -> first ; for ( fullHeader -> sections = fullHeader -> sections -> first ; fullHeader -> sections != NULL ; fullHeader -> sections = fullHeader -> sections -> next ) { rewind ( elfFile ) ; fseek ( elfFile , fullHeader -> sections -> section -> offset , SEEK_SET ) ; fullHeader -> sections -> data = ( unsigned char * ) bpmalloc ( fullHeader -> sections -> section -> size ) ; fread ( fullHeader -> sections -> data , 1 , fullHeader -> sections -> section -> size , elfFile ) ; fullHeader -> sections -> dataSize = fullHeader -> sections -> section -> size ; } fullHeader -> sections = firstPtr ; return ERR_SUCCESS ; }
Extract actual sections from the full headers section list (no types)
Extract actual sections from the full headers section list ( no types )
// Create space for section and read section into memory // Save Size // Reset pointer