From: Paolo M. <pao...@gm...> - 2008-07-11 12:05:32
|
Hi to all I'm writing a .SYS driver using mingw32. I have written the DriverEntry and DriverUnload routine and all is OK. Now I have added the IOCTL dispatcher. I have decided to use the METHOD_NEITHER because it is simplest and direct. The problem is that user space programs could pass a bad pointer to the kernel, so I would like to check the user pointer. This can be done with ProbeForRead and ProbeForWrite. My problem is that these functions raise and exception if the user pointer is bad and I am not able to manage exception in kernel-spacewith MinGW. I have read a lot on internet about this topic, including SEH. I have found a function GetExceptionCode() on MSDN but in MinGW I have found only > grep -r GetExceptionCode * include/rpc.h:#define RpcExceptionCode() GetExceptionCode() that is, there is not definition for GetExceptionCode(). I have found an example with #inclodue <excpt.h> __try1 / __except1 but I think that it works in userspace (in kernelspace I have a blue screen). Is there a simple way to detect the exception of ProbeForRead and ProbeForWrite in *kernel-space* ? Regards, Paolo |