char* RvaToRaw(char* pFile,DWORD rva) { IMAGE_DOS_HEADER* pdh=(IMAGE_DOS_HEADER*)pFile; IMAGE_NT_HEADERS* pnh=(IMAGE_NT_HEADERS*)(pFile+pdh->e_lfanew); DWORD sectionnum=pnh->FileHeader.NumberOfSections; IMAGE_SECTION_HEADER* psh=(IMAGE_SECTION_HEADER*)(pnh+1); for(DWORD i=0;i<sectionnum;i++) { if(psh[i].VirtualAddress<=rva&&rva<=(psh[i].VirtualAddress+psh[i].SizeOfRawData)) { DWORD radr=rva-psh[i].VirtualAddress+psh[i].PointerToRawData; return (pFile+radr); } } return NULL; }
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课