Question exception handling within kernel mode drivers.

Hi,

I want to ensure (within my kernel mode driver) if a memory address can be
accessed.
I read that therefore structured exception handling can be used and tried
the following code within my driver:
(within dispatch routine, I want to force an exception for testing)


__try
{
char* pTmp=(char*)1;
int itest = *pTmp;
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
DbgPrint( “turDecodeCommand: Exception\n” );
}

But somehow my exception block is not executed, instead the system (windows
xp prof. sp1)
displays a blue screen with the following bugcheck info:

Fehlercode war: 0x000000d1 (0x00000001, 0x00000002, 0x00000000, 0xf1299357).

what are the limitations of exception handling within kernel mode drivers,
and is there a dependency to the IRQ level?

Best Regards
Michael

At high irql, exception handlers are not allowed. I did not dwell into it,
but the obvious thing is either context swaping or allocation of paged
memory that might be required when exception infrastructure has to be
invoked…

Reference :
Writing Drivers for Reliability, Robustness and Fault Tolerant Systems –
at microsoft site states some of it …

-prokash
----- Original Message -----
From: “Michael Kurz”
To: “Windows System Software Devs Interest List”
Sent: Thursday, November 20, 2003 9:49 AM
Subject: [ntdev] Question exception handling within kernel mode drivers.

> Hi,
>
> I want to ensure (within my kernel mode driver) if a memory address can be
> accessed.
> I read that therefore structured exception handling can be used and tried
> the following code within my driver:
> (within dispatch routine, I want to force an exception for testing)
>
>
>
> __try
> {
> char* pTmp=(char*)1;
> int itest = *pTmp;
> }
>__except(EXCEPTION_EXECUTE_HANDLER)
> {
> DbgPrint( “turDecodeCommand: Exception\n” );
> }
>
>
> But somehow my exception block is not executed, instead the system
(windows
> xp prof. sp1)
> displays a blue screen with the following bugcheck info:
>
> Fehlercode war: 0x000000d1 (0x00000001, 0x00000002, 0x00000000,
0xf1299357).
>
> what are the limitations of exception handling within kernel mode drivers,
> and is there a dependency to the IRQ level?
>
>
> Best Regards
> Michael
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@garlic.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>