1/2132位/64位WINDOWS驱动之物理地址读写内存方法4一、32位/64位WINDOWS驱动之物理地址读写内存方法4GetPhysicalAddress;自写函数通过PID切换到目标进程环境计算出物理地址ZwMapViewOfSection;把物理地址映射到当前进程不使用时需要用ZwUnmapViewOfSection取消映射BOOLEANReadPVirtualMemory(UINT64ProcessID,INPVOIDVBaseAddress,INUINT32nSize,OUTPVOIDpBuf);//转换成物理地址的方式读取进程虚拟地址BOOLEANWritePVirtualMemory(UINT64ProcessID,INPVOIDVBaseAddress,INUINT32nSize,INPVOIDpBuf);二、驱动层,过保护读写筛选器中添加通过物理地址读写目标进程内存
c代码如下:1#include"ntifs
h"2//#include"rwPhysicalMemory
h"3//#include"VMProtectDDK
h"45//InfoTypeArrayindexBitrangeInformation6//0x8000000800-7Physicaladdressbits7//0x8000000808-15Virtualaddressbits8//0x80000008016-31Reserved9//0x800000081-30-31Reserved1011UINT64g_maxPhysAddress=0;12//利用cpuid取出物理地址Bits13UINT64getg_maxPhysAddress(void)14{15if(g_maxPhysAddress==0)16{17intphysicalbits;18UINT32r[4];//四个整