Re: Physical memory access from C# in WinCE 6.0



Hi again.

I am successfully performing physical memory accesses, as I have some LEDs
working depending on the address, and it seems to work quite fine.

However, sometimes I have some "Access Violations"...

As I did not know if it was because of the ioctl code or something external
to it, I decided to call the ReadFile function of coredll.lib from C#.

If I call the function 8 times inside a "for" loop, the eighth time it
crashes giving the access violation. It seems that if I call 1 function every
time 1 click one button, the error does not appear, but it does if IoControl
or Read are called inside a loop for a certain number of times.

I have been debugging the OS and it crashes exactly in:

C:\WINCE600\PRIVATE\WINCEOS\COREOS\DEVICE\DEVCORE\devfile.c

either in the DM_DevReadFile if I have called the ReadFile function or
DM_DevDeviceIoControl if I have called de DeviceIoControl function from C#.
In fact, it crashes after exiting those functions, but I am not able to see
the exact line of code... I have "shared source" but perhaps I could be
missing something? While debuggin, the yellow arrow disappears from the
devfile.c after exiting the function and after 2 or 3 steps then it is when
it crashes.

First-chance exception in MSCOREE2_0.DLL. (0xC0000005: Access Violation) is
the error message I got in a message box in the OS debugger.

Any ideas of what could be happening here?

Thanks in advance.

Best Regards
Albert
.