Hy Nick, thx for the reply ppl.
I was just experimenting with __try __except with null pointers, it seems not to work.
But this is not the only trouble:)
I am dooing a hook for ZwOpenKey to make read-only a few keys in the registry.
So i am hooking system service 0x2E in the IDT like this:
(ntdll)NtOpenKey->int2e->[myhook]->standart_routine
if Service number EAX==0x00000067 (ZwOpenKey)
i am looking at the incoming data which is:
[edx] //HANDLE KeyHandle
[edx+4] //ULONG DesiredAccess
[edx+8] //POBJECT_ATTRIBUTES ObjectAttributes
Now ObjectAttributes->ObjectName - is the unicode string that contain the name of the key to be opened.
ok, now i can easily return to the user STATUS_ACCESS_DENIED.
All works just FINE…but sometimes when i’m trying to read data referenced by ObjectAttributes->ObjectName a kind of “exception handler” takes control wich is an interrupt (i think) because the control is returned back thru an IRETD intruction, and the control is returned in ntdll at the point the int2E(EAX=00000067)was called, with erroneus data and the calling user mode process just dies 
Now when I access data in the __try __except statement this “exception handler” is called no more and only the soft ice stops me from bugcheck (fault page in non paged area)
The question is how to read that deam string?? Soft ice displays its content witout problems, and i am in the calling thread, so i think i must have acces to that buffer…
I nociced that usualy all calls came with buffers at 0x0006F…, when error occurs the buffer is placed at 0x77E035…
ps:i am a begginer in the kernel mode programmin, so i can post a lot of stupid questions here 
I forgot NULL is below the 2GB boundary (nt!MmSystemRangeStart) and
therefore will throw. Dereferencing something bad > 2Gb like 0xFFFFFFFF
will bugcheck at all IRQLs, however.
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Alexei Jelvis
> Sent: Sunday, June 01, 2003 7:50 AM
> To: File Systems Developers
> Subject: [ntfsd] Re: __try __except in kernel mode
>
>
> > 1.I dont know why but the __try __except method does not work with
> > kernel
> drivers, in user mode it works perfectly, in kernel mode the
> system crashes, on any IRQL.
> > Maybe I missed up something.I used the following example:
> >
> > void TestException(void)
> > {
> > DWORD A = 100;
> > DWORD* B = 0;
> > DWORD C = 20;
> > __try
> > {
> > A=*B;
> > }__except(EXCEPTION_EXECUTE_HANDLER)
> > {
> > A=C;
> > }
> > }
> > And,is it possibile to use __try __except at
> IRQL>IRQL_PASSIVE_LEVEL
> > ??
>
> Dereferencing NULL pointer at IRQL >= DISPATCH_LEVEL doesn’t
> not raise an exception but generates bug check
> IRQL_NOT_LESS_OR_EQUAL. On IRQL < DISPATCH_LEVEL exception is
> generated and can be caught by exception handler; I don’t see
> any reason why the above example generates a bug check. You
> need to provide additional details like what the bug check
> code is and what is the output from !analyze -v when bug check occur.
>
> Alexei.
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@nryan.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
You are currently subscribed to ntfsd as: xxxxx@mail.md
To unsubscribe send a blank email to xxxxx@lists.osr.com
Get your free mail box @ http://www.mail.md