1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
BOOL success=0;
static PVOID vAddress; // virtual memory address returned
LARGE_INTEGER physAddr; // base physical address
ULONG length; // length to map in
BOOLEAN cacheEnable; // cache accesses to memory ?
physAddr.QuadPart = 0x0000FFFFF;
length = 1024;
cacheEnable = 0;
vAddress=RtMapMemory( physAddr, length, cacheEnable);
if (vAddress==NULL) {
printf("Failure on RtMapMemory( 0x%08X, %d, %d ).\n", physAddr.LowPart, length, cacheEnable );
}
else {
printf("Success on RtMapMemory( 0x%08X, %d, %d ).\n", physAddr.LowPart, length, cacheEnable );
printf("Virtual memory address = 0x%08X \n", vAddress);
success = RtUnmapMemory( vAddress);
if (!success) {
printf("Failure on RtUnmapMemory( 0x%08X)\t", vAddress);
}
else {
printf("Success on RtUnmapMemory( 0x%08X)\n\n", vAddress);
}
}
ExitProcess(0); |