C:
NTSTATUS Read_Physical_memory(LONGLONG Address, PVOID buffer, SIZE_T bitetoread)
{
PVOID Pool = ExAllocatePoolWithTag(0, bitetoread, 'Tag');
if (Pool == NULL) return STATUS_UNSUCCESSFUL;
else
{
PHYSICAL_ADDRESS ad;
ad.QuadPart = Address;
PVOID MemoryMap = MmMapIoSpaceEx(ad, bitetoread, PAGE_READONLY);
if (MemoryMap == NULL) return STATUS_UNSUCCESSFUL;
else
{
MM_COPY_ADDRESS copyaddress;
copyaddress.VirtualAddress = MemoryMap;
SIZE_T counter;
MmCopyMemory(buffer, copyaddress, bitetoread, MM_COPY_MEMORY_VIRTUAL, &counter);
MmUnmapIoSpace(MemoryMap, bitetoread);
ExFreePoolWithTag(Pool, 'Tag');
return STATUS_SUCCESS;
}
}
}
я новичок в разработке драйверов так что не судите строго за ошибки)