Physical memory access from C# in WinCE 6.0

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

I am using Windows CE 6.0, Compact Framework 2.0, and I want to access
physical memory from C#.

I have a driver and I can call it from C#, because it is loaded in boot time.

I have tried an IoControl, that does the following:

case IOCTL_FPGA_MAPPING:
PHYSICAL_ADDRESS FPGA_addr;
FPGA_addr.HighPart = 0;
FPGA_addr.LowPart = 0x110;
PVOID pFPGA;
pFPGA = MmMapIoSpace(FPGA_addr,0xA6,FALSE);
if (pFPGA == NULL) {
DEBUGMSG(ZONE_INIT,(L"MMA: MmMap Malament\r\n"));
} else {
DEBUGMSG(ZONE_INIT,(L"MMA: MmMap OK\r\n"));
}
pBufOut = (PBYTE)
VirtualAllocCopyEx((HANDLE)GetDirectCallerProcessId(),GetCurrentProcess(),pFPGA,0xA6,PAGE_READWRITE);
break;

What I pretend to do here is to map from 0x110 to 0x1B5, for the C#
application to use them.

I use the MmMapIoSpace to have a virtual address, and then I do a
VirtualAllocCopyEx to copy the virtual address pointer (pFPGA) to the out
pointer of the IoControl (pBufOut).

Could it work?

Thanks in advance, I am new to drivers in Windows in general and I feel
quite lost...

Albert

.