I am having difficulties reading my imports from a Windows platform pe...any experienced help would be greatly appreciated...
Code:int rva = header.OptionalHeader.DataDirectory[1].VirtualAddress; if(rva) { IMAGE_IMPORT_DESCRIPTOR temp, empty = {0}; fseek(pe, rva, SEEK_SET); while(1) { if(!fread(&temp, sizeof(IMAGE_IMPORT_DESCRIPTOR), 1, pe)) { out << "read error" << endl; break; } if(memcmp(&temp, &empty, sizeof(IMAGE_IMPORT_DESCRIPTOR))== 0) { break; } ++import_count; } if(import_count) { import = new IMAGE_IMPORT_DESCRIPTOR[import_count]; if(!import) { import_count = 0; out << "allocation error" << endl; } else { fseek(pe, rva, SEEK_SET); for(int i = 0; i < import_count; ++i) { fread(&import[i], sizeof(IMAGE_IMPORT_DESCRIPTOR), 1, pe)) } } } }



LinkBack URL
About LinkBacks


