楼上的大哥,两个问题,第一,你上面那种做法有能力读到0x01000000的物理地址内容吗(或者换句话说,有能力访问4G以内包括windows kernel程序驻留内存的内容吗?)
其次,贴代码:
#pragma PAGEDCODE
NTSTATUS KeMapPhysicalMemoryToLinearSpace(PVOID pPhysAddress,ULONG PhysMemSizeInBytes,
PVOID *PhysMemLin){
KdPrint(("Enter MapPhysicalMemoryToLinearSpace entry\n"));
pTagPhyicalAddressStruct pTagphystruct = (pTagPhyicalAddressStruct)MmAllocateNonCachedMemory(sizeof(TagPhyicalAddressStruct));
if(!pTagphystruct){
KdPrint(("Not enough memory to create target allocation list"));
return STATUS_INSUFFICIENT_RESOURCES;
}
pTagphystruct->Mdl = NULL;
pTagphystruct->SystemVirtualAddress = NULL;
pTagphystruct->UserVirtualAddress = NULL;
PHYSICAL_ADDRESS pStartPhysAddress;
pStartPhysAddress.QuadPart = (ULONGLONG)pPhysAddress;
__try{
pTagphystruct->SystemVirtualAddress = MmMapIoSpace(pStartPhysAddress,PhysMemSizeInBytes,MmNonCached);
if(!pTagphystruct->SystemVirtualAddress){ //MmMapIoSpace return NULL indicate function failed.
KdPrint(("MmMapIoSpace failed\n"));
return STATUS_INVALID_PARAMETER;
}
.
.
.
省略尚未执行代码若干...
KdPrint(("Leave MapPhysicalMemoryToLinearSpace with successful return\n"));
return STATUS_SUCCESS;
}
很让人愤怒的..输入0x01000000地址的时候(其实4G以内大多数地址好使的),返回"MmMapIoSpace failed;大爷这啥都还米做呢!求楼上大哥指教