rtlvolumedevicetodosname problem again...

Hi all,
I’m trying to use Rtlvolumedevicetodosname() to get the drive letter.
I have a handle to an object and obtain the object pointer using
ObReferenceObjectByHandle(). I then pass
(((FILE_OBJECT *)Object)->DeviceObject) as the first argument to
RtlVolume…().
However, using this KPI results in a blue screen on my system, with a
KMode_exception_not_handled.(most of the times)
The actual call is listed below…

>>
ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Object,NULL);
>>> if(ntstatus==STATUS_SUCCESS)
>>> ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
*)Object)->DeviceObject,&DriveName);

Am i doing this correctly?? i browsed through the ntfsd archives but was not
able to find a reason for this to happen…except perhaps that the Object
returned by ObReference…() may not be a file object and so the system
crashes. If so, is there a method to verify if the object returned is of the
required type or not?
Thanks for any help…
Regards,
Samarth

The code looks fine (except for a missing left parentheses, but I’m sure
that’s just an email typo) - we need more information. Where did
‘Handle’ come from? Can you double-check that Object and ((FILE_OBJECT
*) Object)->DeviceObject are non-NULL? Are you sure you’re running at
passive level? Can you send us the !analyze -v from WinDbg?

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Wednesday, June 04, 2003 1:44 AM
To: NT Developers Interest List
Subject: [ntdev] rtlvolumedevicetodosname problem again…

Hi all,
I’m trying to use Rtlvolumedevicetodosname() to get the drive
letter. I have a handle to an object and obtain the object
pointer using ObReferenceObjectByHandle(). I then pass
(((FILE_OBJECT *)Object)->DeviceObject) as the first argument
to RtlVolume…(). However, using this KPI results in a blue
screen on my system, with a KMode_exception_not_handled.(most
of the times) The actual call is listed below…

>>>
ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
ct,NULL);
>>> if(ntstatus==STATUS_SUCCESS)
>>> ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
*)Object)->DeviceObject,&DriveName);

Am i doing this correctly?? i browsed through the ntfsd
archives but was not able to find a reason for this to
happen…except perhaps that the Object returned by
ObReference…() may not be a file object and so the system
crashes. If so, is there a method to verify if the object
returned is of the required type or not? Thanks for any
help… Regards, Samarth


You are currently subscribed to ntdev as: xxxxx@nryan.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,
Well i double checked for the pointers being Non-NULL.that didn’t work…I am
sure that i’m running at IRQL==Passive…The
‘Handle’ can be a handle to a registry key or a file or a socket or anything
else basically. Therefore, i’m not too certain if it would be a FILE_OBJECT.
However, i do a ZwQueryInformationFile() just before the given code and that
code gets executed only if the ZwQuery…() succeeds.
Also, the interesting part is that my driver usually crashes when DbgView is
running on the system. It seems a behave a little better on other occasions.
Does this give any clue to the problem??
I’m having a little problem with WinDbg. Will send the !analyze -v soon.
Thanks,
Samarth

“Nick Ryan” wrote in message news:xxxxx@ntdev…
>
> The code looks fine (except for a missing left parentheses, but I’m sure
> that’s just an email typo) - we need more information. Where did
> ‘Handle’ come from? Can you double-check that Object and ((FILE_OBJECT
> *) Object)->DeviceObject are non-NULL? Are you sure you’re running at
> passive level? Can you send us the !analyze -v from WinDbg?
>
> - Nick Ryan
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
> > Sent: Wednesday, June 04, 2003 1:44 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> >
> >
> > Hi all,
> > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > letter. I have a handle to an object and obtain the object
> > pointer using ObReferenceObjectByHandle(). I then pass
> > (((FILE_OBJECT *)Object)->DeviceObject) as the first argument
> > to RtlVolume…(). However, using this KPI results in a blue
> > screen on my system, with a KMode_exception_not_handled.(most
> > of the times) The actual call is listed below…
> >
> > >>>
> > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > ct,NULL);
> > >>> if(ntstatus==STATUS_SUCCESS)
> > >>> ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > *)Object)->DeviceObject,&DriveName);
> >
> > Am i doing this correctly?? i browsed through the ntfsd
> > archives but was not able to find a reason for this to
> > happen…except perhaps that the Object returned by
> > ObReference…() may not be a file object and so the system
> > crashes. If so, is there a method to verify if the object
> > returned is of the required type or not? Thanks for any
> > help… Regards, Samarth
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nryan.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
>

The handle MUST be a handle to an open filesystem file.

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Wednesday, June 04, 2003 3:51 AM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Hi,
Well i double checked for the pointers being Non-NULL.that
didn’t work…I am sure that i’m running at IRQL==Passive…The
‘Handle’ can be a handle to a registry key or a file or a
socket or anything else basically. Therefore, i’m not too
certain if it would be a FILE_OBJECT. However, i do a
ZwQueryInformationFile() just before the given code and that
code gets executed only if the ZwQuery…() succeeds. Also,
the interesting part is that my driver usually crashes when
DbgView is running on the system. It seems a behave a little
better on other occasions. Does this give any clue to the
problem?? I’m having a little problem with WinDbg. Will send
the !analyze -v soon. Thanks, Samarth

“Nick Ryan” wrote in message news:xxxxx@ntdev…
> >
> > The code looks fine (except for a missing left parentheses, but I’m
> > sure that’s just an email typo) - we need more information.
> Where did
> > ‘Handle’ come from? Can you double-check that Object and
> ((FILE_OBJECT
> > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> running at
> > passive level? Can you send us the !analyze -v from WinDbg?
> >
> > - Nick Ryan
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > Sharma
> > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > >
> > >
> > > Hi all,
> > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > letter. I have a handle to an object and obtain the
> object pointer
> > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > *)Object)->DeviceObject) as the first argument to
> RtlVolume…().
> > > However, using this KPI results in a blue screen on my
> system, with
> > > a KMode_exception_not_handled.(most of the times) The
> actual call is
> > > listed below…
> > >
> > > >>>
> > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > ct,NULL);
> > > >>> if(ntstatus==STATUS_SUCCESS)
> > > >>>
> ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > *)Object)->DeviceObject,&DriveName);
> > >
> > > Am i doing this correctly?? i browsed through the ntfsd
> archives but
> > > was not able to find a reason for this to happen…except perhaps
> > > that the Object returned by
> > > ObReference…() may not be a file object and so the
> system crashes.
> > > If so, is there a method to verify if the object returned
> is of the
> > > required type or not? Thanks for any help… Regards, Samarth
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nryan.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Thanks for the info Nick…Is there any method of verifying whether the
object i receive is a valid FILE_OBJECT type object??
Regards,
Samarth
“Nick Ryan” wrote in message news:xxxxx@ntdev…
>
> The handle MUST be a handle to an open filesystem file.
>
> - Nick Ryan
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
> > Sent: Wednesday, June 04, 2003 3:51 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
> >
> >
> > Hi,
> > Well i double checked for the pointers being Non-NULL.that
> > didn’t work…I am sure that i’m running at IRQL==Passive…The
> > ‘Handle’ can be a handle to a registry key or a file or a
> > socket or anything else basically. Therefore, i’m not too
> > certain if it would be a FILE_OBJECT. However, i do a
> > ZwQueryInformationFile() just before the given code and that
> > code gets executed only if the ZwQuery…() succeeds. Also,
> > the interesting part is that my driver usually crashes when
> > DbgView is running on the system. It seems a behave a little
> > better on other occasions. Does this give any clue to the
> > problem?? I’m having a little problem with WinDbg. Will send
> > the !analyze -v soon. Thanks, Samarth
> >
> > “Nick Ryan” wrote in message news:xxxxx@ntdev…
> > >
> > > The code looks fine (except for a missing left parentheses, but I’m
> > > sure that’s just an email typo) - we need more information.
> > Where did
> > > ‘Handle’ come from? Can you double-check that Object and
> > ((FILE_OBJECT
> > > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> > running at
> > > passive level? Can you send us the !analyze -v from WinDbg?
> > >
> > > - Nick Ryan
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > > Sharma
> > > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > > >
> > > >
> > > > Hi all,
> > > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > > letter. I have a handle to an object and obtain the
> > object pointer
> > > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > > *)Object)->DeviceObject) as the first argument to
> > RtlVolume…().
> > > > However, using this KPI results in a blue screen on my
> > system, with
> > > > a KMode_exception_not_handled.(most of the times) The
> > actual call is
> > > > listed below…
> > > >
> > > > >>>
> > > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > > ct,NULL);
> > > > >>> if(ntstatus==STATUS_SUCCESS)
> > > > >>>
> > ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > > *)Object)->DeviceObject,&DriveName);
> > > >
> > > > Am i doing this correctly?? i browsed through the ntfsd
> > archives but
> > > > was not able to find a reason for this to happen…except perhaps
> > > > that the Object returned by
> > > > ObReference…() may not be a file object and so the
> > system crashes.
> > > > If so, is there a method to verify if the object returned
> > is of the
> > > > required type or not? Thanks for any help… Regards, Samarth
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nryan.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
>

Look at the description of the ObjectType parameter of
ObReferenceObjectByHandle in the DDK documentation.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Wednesday, June 04, 2003 9:54 PM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Thanks for the info Nick…Is there any method of verifying whether the
object i receive is a valid FILE_OBJECT type object??
Regards,
Samarth
“Nick Ryan” wrote in message news:xxxxx@ntdev…
>
> The handle MUST be a handle to an open filesystem file.
>
> - Nick Ryan
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > Sharma
> > Sent: Wednesday, June 04, 2003 3:51 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
> >
> >
> > Hi,
> > Well i double checked for the pointers being Non-NULL.that didn’t
> > work…I am sure that i’m running at IRQL==Passive…The ‘Handle’ can
> > be a handle to a registry key or a file or a socket or anything else

> > basically. Therefore, i’m not too certain if it would be a
> > FILE_OBJECT. However, i do a
> > ZwQueryInformationFile() just before the given code and that code
> > gets executed only if the ZwQuery…() succeeds. Also, the
> > interesting part is that my driver usually crashes when DbgView is
> > running on the system. It seems a behave a little better on other
> > occasions. Does this give any clue to the problem?? I’m having a
> > little problem with WinDbg. Will send the !analyze -v soon. Thanks,
> > Samarth
> >
> > “Nick Ryan” wrote in message news:xxxxx@ntdev…
> > >
> > > The code looks fine (except for a missing left parentheses, but
> > > I’m sure that’s just an email typo) - we need more information.
> > Where did
> > > ‘Handle’ come from? Can you double-check that Object and
> > ((FILE_OBJECT
> > > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> > running at
> > > passive level? Can you send us the !analyze -v from WinDbg?
> > >
> > > - Nick Ryan
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > > Sharma
> > > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > > >
> > > >
> > > > Hi all,
> > > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > > letter. I have a handle to an object and obtain the
> > object pointer
> > > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > > *)Object)->DeviceObject) as the first argument to
> > RtlVolume…().
> > > > However, using this KPI results in a blue screen on my
> > system, with
> > > > a KMode_exception_not_handled.(most of the times) The
> > actual call is
> > > > listed below…
> > > >
> > > > >>>
> > > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > > ct,NULL);
> > > > >>> if(ntstatus==STATUS_SUCCESS)
> > > > >>>
> > ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > > *)Object)->DeviceObject,&DriveName);
> > > >
> > > > Am i doing this correctly?? i browsed through the ntfsd
> > archives but
> > > > was not able to find a reason for this to happen…except perhaps

> > > > that the Object returned by
> > > > ObReference…() may not be a file object and so the
> > system crashes.
> > > > If so, is there a method to verify if the object returned
> > is of the
> > > > required type or not? Thanks for any help… Regards, Samarth
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > > unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,

Well i now use the following call…

>ntstatus=ObReferenceObjectByHandle(Handle,0,*IoFileObjectType,KernelMode,&
Object,NULL);

The handle is a valid handle and the call to RtlVolume…() is made only if
ObRef…() returns STATUS_SUCCESS.The code is executing at PASSIVE_LEVEL.

However, the driver still continues to crash.

I tried DbgPrint() before all the statements but was unable to detect any
problem. But the call to RtlVolume…() does sometimes return an error. Is
there any other method to strongly check that the parameters that i am
passing of RtlVolume…()
The system crashes with either KMODE_EXCEPTION_NOT_HANDLED or
PAGE_FAULT_IN_NONPAGED_AREA.

Thank you for any suggestions
Samarth

“Peter Wieland” wrote in message
news:xxxxx@ntdev…

Look at the description of the ObjectType parameter of
ObReferenceObjectByHandle in the DDK documentation.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Wednesday, June 04, 2003 9:54 PM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Thanks for the info Nick…Is there any method of verifying whether the
object i receive is a valid FILE_OBJECT type object??
Regards,
Samarth
“Nick Ryan” wrote in message news:xxxxx@ntdev…
>
> The handle MUST be a handle to an open filesystem file.
>
> - Nick Ryan
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > Sharma
> > Sent: Wednesday, June 04, 2003 3:51 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
> >
> >
> > Hi,
> > Well i double checked for the pointers being Non-NULL.that didn’t
> > work…I am sure that i’m running at IRQL==Passive…The ‘Handle’ can
> > be a handle to a registry key or a file or a socket or anything else

> > basically. Therefore, i’m not too certain if it would be a
> > FILE_OBJECT. However, i do a
> > ZwQueryInformationFile() just before the given code and that code
> > gets executed only if the ZwQuery…() succeeds. Also, the
> > interesting part is that my driver usually crashes when DbgView is
> > running on the system. It seems a behave a little better on other
> > occasions. Does this give any clue to the problem?? I’m having a
> > little problem with WinDbg. Will send the !analyze -v soon. Thanks,
> > Samarth
> >
> > “Nick Ryan” wrote in message news:xxxxx@ntdev…
> > >
> > > The code looks fine (except for a missing left parentheses, but
> > > I’m sure that’s just an email typo) - we need more information.
> > Where did
> > > ‘Handle’ come from? Can you double-check that Object and
> > ((FILE_OBJECT
> > > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> > running at
> > > passive level? Can you send us the !analyze -v from WinDbg?
> > >
> > > - Nick Ryan
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > > Sharma
> > > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > > >
> > > >
> > > > Hi all,
> > > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > > letter. I have a handle to an object and obtain the
> > object pointer
> > > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > > *)Object)->DeviceObject) as the first argument to
> > RtlVolume…().
> > > > However, using this KPI results in a blue screen on my
> > system, with
> > > > a KMode_exception_not_handled.(most of the times) The
> > actual call is
> > > > listed below…
> > > >
> > > > >>>
> > > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > > ct,NULL);
> > > > >>> if(ntstatus==STATUS_SUCCESS)
> > > > >>>
> > ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > > *)Object)->DeviceObject,&DriveName);
> > > >
> > > > Am i doing this correctly?? i browsed through the ntfsd
> > archives but
> > > > was not able to find a reason for this to happen…except perhaps

> > > > that the Object returned by
> > > > ObReference…() may not be a file object and so the
> > system crashes.
> > > > If so, is there a method to verify if the object returned
> > is of the
> > > > required type or not? Thanks for any help… Regards, Samarth
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > > unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

What process are you in the context of when you make this call? It may
be that the routine needs data from the PEB which may not be present in
the system process.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Thursday, June 05, 2003 3:02 AM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Hi,

Well i now use the following call…

>ntstatus=ObReferenceObjectByHandle(Handle,0,*IoFileObjectType,KernelMo
>de,&
Object,NULL);

The handle is a valid handle and the call to RtlVolume…() is made only
if
ObRef…() returns STATUS_SUCCESS.The code is executing at
PASSIVE_LEVEL.

However, the driver still continues to crash.

I tried DbgPrint() before all the statements but was unable to detect
any problem. But the call to RtlVolume…() does sometimes return an
error. Is there any other method to strongly check that the parameters
that i am passing of RtlVolume…() The system crashes with either
KMODE_EXCEPTION_NOT_HANDLED or PAGE_FAULT_IN_NONPAGED_AREA.

Thank you for any suggestions
Samarth

“Peter Wieland” wrote in message
news:xxxxx@ntdev…

Look at the description of the ObjectType parameter of
ObReferenceObjectByHandle in the DDK documentation.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Wednesday, June 04, 2003 9:54 PM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Thanks for the info Nick…Is there any method of verifying whether the
object i receive is a valid FILE_OBJECT type object??
Regards,
Samarth
“Nick Ryan” wrote in message news:xxxxx@ntdev…
>
> The handle MUST be a handle to an open filesystem file.
>
> - Nick Ryan
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > Sharma
> > Sent: Wednesday, June 04, 2003 3:51 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
> >
> >
> > Hi,
> > Well i double checked for the pointers being Non-NULL.that didn’t
> > work…I am sure that i’m running at IRQL==Passive…The ‘Handle’ can
> > be a handle to a registry key or a file or a socket or anything else

> > basically. Therefore, i’m not too certain if it would be a
> > FILE_OBJECT. However, i do a
> > ZwQueryInformationFile() just before the given code and that code
> > gets executed only if the ZwQuery…() succeeds. Also, the
> > interesting part is that my driver usually crashes when DbgView is
> > running on the system. It seems a behave a little better on other
> > occasions. Does this give any clue to the problem?? I’m having a
> > little problem with WinDbg. Will send the !analyze -v soon. Thanks,
> > Samarth
> >
> > “Nick Ryan” wrote in message news:xxxxx@ntdev…
> > >
> > > The code looks fine (except for a missing left parentheses, but
> > > I’m sure that’s just an email typo) - we need more information.
> > Where did
> > > ‘Handle’ come from? Can you double-check that Object and
> > ((FILE_OBJECT
> > > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> > running at
> > > passive level? Can you send us the !analyze -v from WinDbg?
> > >
> > > - Nick Ryan
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > > Sharma
> > > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > > >
> > > >
> > > > Hi all,
> > > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > > letter. I have a handle to an object and obtain the
> > object pointer
> > > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > > *)Object)->DeviceObject) as the first argument to
> > RtlVolume…().
> > > > However, using this KPI results in a blue screen on my
> > system, with
> > > > a KMode_exception_not_handled.(most of the times) The
> > actual call is
> > > > listed below…
> > > >
> > > > >>>
> > > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > > ct,NULL);
> > > > >>> if(ntstatus==STATUS_SUCCESS)
> > > > >>>
> > ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > > *)Object)->DeviceObject,&DriveName);
> > > >
> > > > Am i doing this correctly?? i browsed through the ntfsd
> > archives but
> > > > was not able to find a reason for this to happen…except perhaps

> > > > that the Object returned by
> > > > ObReference…() may not be a file object and so the
> > system crashes.
> > > > If so, is there a method to verify if the object returned
> > is of the
> > > > required type or not? Thanks for any help… Regards, Samarth
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > > unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Well since the call to ObReferenceObjectbyHandle() returns STATUS_SUCCESS, i
believe that i an in the context of the currently executing process. Handles
are valid only in the context of the executing process…rite??
I used PsGetCurrentProcessId(), and the handle-process pair seems to match
ok.
Should i raise my IRQL and then make the call to
RtlVolumeDevicetoDosName()…??
I’m pretty much stuck…:slight_smile:

Samarth

“Peter Wieland” wrote in message
news:xxxxx@ntdev…

What process are you in the context of when you make this call? It may
be that the routine needs data from the PEB which may not be present in
the system process.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Thursday, June 05, 2003 3:02 AM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Hi,

Well i now use the following call…

>>ntstatus=ObReferenceObjectByHandle(Handle,0,*IoFileObjectType,KernelMo
>>de,&
Object,NULL);

The handle is a valid handle and the call to RtlVolume…() is made only
if
ObRef…() returns STATUS_SUCCESS.The code is executing at
PASSIVE_LEVEL.

However, the driver still continues to crash.

I tried DbgPrint() before all the statements but was unable to detect
any problem. But the call to RtlVolume…() does sometimes return an
error. Is there any other method to strongly check that the parameters
that i am passing of RtlVolume…() The system crashes with either
KMODE_EXCEPTION_NOT_HANDLED or PAGE_FAULT_IN_NONPAGED_AREA.

Thank you for any suggestions
Samarth

“Peter Wieland” wrote in message
news:xxxxx@ntdev…

Look at the description of the ObjectType parameter of
ObReferenceObjectByHandle in the DDK documentation.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Wednesday, June 04, 2003 9:54 PM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Thanks for the info Nick…Is there any method of verifying whether the
object i receive is a valid FILE_OBJECT type object??
Regards,
Samarth
“Nick Ryan” wrote in message news:xxxxx@ntdev…
>
> The handle MUST be a handle to an open filesystem file.
>
> - Nick Ryan
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > Sharma
> > Sent: Wednesday, June 04, 2003 3:51 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
> >
> >
> > Hi,
> > Well i double checked for the pointers being Non-NULL.that didn’t
> > work…I am sure that i’m running at IRQL==Passive…The ‘Handle’ can
> > be a handle to a registry key or a file or a socket or anything else

> > basically. Therefore, i’m not too certain if it would be a
> > FILE_OBJECT. However, i do a
> > ZwQueryInformationFile() just before the given code and that code
> > gets executed only if the ZwQuery…() succeeds. Also, the
> > interesting part is that my driver usually crashes when DbgView is
> > running on the system. It seems a behave a little better on other
> > occasions. Does this give any clue to the problem?? I’m having a
> > little problem with WinDbg. Will send the !analyze -v soon. Thanks,
> > Samarth
> >
> > “Nick Ryan” wrote in message news:xxxxx@ntdev…
> > >
> > > The code looks fine (except for a missing left parentheses, but
> > > I’m sure that’s just an email typo) - we need more information.
> > Where did
> > > ‘Handle’ come from? Can you double-check that Object and
> > ((FILE_OBJECT
> > > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> > running at
> > > passive level? Can you send us the !analyze -v from WinDbg?
> > >
> > > - Nick Ryan
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > > Sharma
> > > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > > >
> > > >
> > > > Hi all,
> > > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > > letter. I have a handle to an object and obtain the
> > object pointer
> > > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > > *)Object)->DeviceObject) as the first argument to
> > RtlVolume…().
> > > > However, using this KPI results in a blue screen on my
> > system, with
> > > > a KMode_exception_not_handled.(most of the times) The
> > actual call is
> > > > listed below…
> > > >
> > > > >>>
> > > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > > ct,NULL);
> > > > >>> if(ntstatus==STATUS_SUCCESS)
> > > > >>>
> > ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > > *)Object)->DeviceObject,&DriveName);
> > > >
> > > > Am i doing this correctly?? i browsed through the ntfsd
> > archives but
> > > > was not able to find a reason for this to happen…except perhaps

> > > > that the Object returned by
> > > > ObReference…() may not be a file object and so the
> > system crashes.
> > > > If so, is there a method to verify if the object returned
> > is of the
> > > > required type or not? Thanks for any help… Regards, Samarth
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > > unsubscribe send a blank email to
> > > > xxxxx@lists.osr.com
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Handles opened with the OBJ_KERNEL_HANDLE flag are valid among all
processes (in kernel-mode). No, you should NOT raise the IRQL before
making that call. :slight_smile: Peter is suggesting that you verify that the handle
you are using was opened in the context of the current process. Are you
saying that you call PsGetCurrentProcessId() when you create the file,
and PsGetCurrentProcessId() again when you reference the handle, and
they match? Can you show us the code you use to open the file whose
handle you are using?

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Friday, June 06, 2003 2:11 AM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Well since the call to ObReferenceObjectbyHandle() returns
STATUS_SUCCESS, i believe that i an in the context of the
currently executing process. Handles are valid only in the
context of the executing process…rite?? I used
PsGetCurrentProcessId(), and the handle-process pair seems to
match ok. Should i raise my IRQL and then make the call to
RtlVolumeDevicetoDosName()…?? I’m pretty much stuck…:slight_smile:

Samarth

“Peter Wieland” wrote in
> message news:xxxxx@ntdev…
>
> What process are you in the context of when you make this
> call? It may be that the routine needs data from the PEB
> which may not be present in the system process.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
> Sent: Thursday, June 05, 2003 3:02 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
>
> Hi,
>
> Well i now use the following call…
>
>
> >>ntstatus=ObReferenceObjectByHandle(Handle,0,*IoFileObjectTyp
> e,KernelMo
> >>de,&
> Object,NULL);
>
> The handle is a valid handle and the call to RtlVolume…()
> is made only if
> ObRef…() returns STATUS_SUCCESS.The code is executing at
> PASSIVE_LEVEL.
>
> However, the driver still continues to crash.
>
> I tried DbgPrint() before all the statements but was unable
> to detect any problem. But the call to RtlVolume…() does
> sometimes return an error. Is there any other method to
> strongly check that the parameters that i am passing of
> RtlVolume…() The system crashes with either
> KMODE_EXCEPTION_NOT_HANDLED or PAGE_FAULT_IN_NONPAGED_AREA.
>
> Thank you for any suggestions
> Samarth
>
>
> “Peter Wieland” wrote in
> message news:xxxxx@ntdev…
>
> Look at the description of the ObjectType parameter of
> ObReferenceObjectByHandle in the DDK documentation.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
> Sent: Wednesday, June 04, 2003 9:54 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
>
> Thanks for the info Nick…Is there any method of verifying
> whether the object i receive is a valid FILE_OBJECT type
> object?? Regards, Samarth “Nick Ryan” wrote
> in message news:xxxxx@ntdev…
> >
> > The handle MUST be a handle to an open filesystem file.
> >
> > - Nick Ryan
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > Sharma
> > > Sent: Wednesday, June 04, 2003 3:51 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
> > >
> > >
> > > Hi,
> > > Well i double checked for the pointers being Non-NULL.that didn’t
> > > work…I am sure that i’m running at IRQL==Passive…The
> ‘Handle’ can
> > > be a handle to a registry key or a file or a socket or
> anything else
>
> > > basically. Therefore, i’m not too certain if it would be a
> > > FILE_OBJECT. However, i do a
> > > ZwQueryInformationFile() just before the given code and that code
> > > gets executed only if the ZwQuery…() succeeds. Also, the
> > > interesting part is that my driver usually crashes when
> DbgView is
> > > running on the system. It seems a behave a little better on other
> > > occasions. Does this give any clue to the problem?? I’m having a
> > > little problem with WinDbg. Will send the !analyze -v
> soon. Thanks,
> > > Samarth
> > >
> > > “Nick Ryan” wrote in message news:xxxxx@ntdev…
> > > >
> > > > The code looks fine (except for a missing left parentheses, but
> > > > I’m sure that’s just an email typo) - we need more information.
> > > Where did
> > > > ‘Handle’ come from? Can you double-check that Object and
> > > ((FILE_OBJECT
> > > > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> > > running at
> > > > passive level? Can you send us the !analyze -v from WinDbg?
> > > >
> > > > - Nick Ryan
> > > >
> > > > > -----Original Message-----
> > > > > From: xxxxx@lists.osr.com
> > > > > [mailto:xxxxx@lists.osr.com] On Behalf
> Of Samarth
> > > > > Sharma
> > > > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > > > To: NT Developers Interest List
> > > > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > > > >
> > > > >
> > > > > Hi all,
> > > > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > > > letter. I have a handle to an object and obtain the
> > > object pointer
> > > > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > > > *)Object)->DeviceObject) as the first argument to
> > > RtlVolume…().
> > > > > However, using this KPI results in a blue screen on my
> > > system, with
> > > > > a KMode_exception_not_handled.(most of the times) The
> > > actual call is
> > > > > listed below…
> > > > >
> > > > > >>>
> > > > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > > > ct,NULL);
> > > > > >>> if(ntstatus==STATUS_SUCCESS)
> > > > > >>>
> > > ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > > > *)Object)->DeviceObject,&DriveName);
> > > > >
> > > > > Am i doing this correctly?? i browsed through the ntfsd
> > > archives but
> > > > > was not able to find a reason for this to
> happen…except perhaps
>
> > > > > that the Object returned by
> > > > > ObReference…() may not be a file object and so the
> > > system crashes.
> > > > > If so, is there a method to verify if the object returned
> > > is of the
> > > > > required type or not? Thanks for any help… Regards, Samarth
> > > > >
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > > > unsubscribe send a blank email to
> > > > > xxxxx@lists.osr.com
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@microsoft.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
>
>
>
>
>
>
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@microsoft.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nryan.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

I think to get much farther we’ll need a stack trace and the !analyze
output.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nick Ryan
Sent: Friday, June 06, 2003 12:24 AM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Handles opened with the OBJ_KERNEL_HANDLE flag are valid among all
processes (in kernel-mode). No, you should NOT raise the IRQL before
making that call. :slight_smile: Peter is suggesting that you verify that the handle
you are using was opened in the context of the current process. Are you
saying that you call PsGetCurrentProcessId() when you create the file,
and PsGetCurrentProcessId() again when you reference the handle, and
they match? Can you show us the code you use to open the file whose
handle you are using?

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
Sent: Friday, June 06, 2003 2:11 AM
To: NT Developers Interest List
Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…

Well since the call to ObReferenceObjectbyHandle() returns
STATUS_SUCCESS, i believe that i an in the context of the currently
executing process. Handles are valid only in the context of the
executing process…rite?? I used PsGetCurrentProcessId(), and the
handle-process pair seems to match ok. Should i raise my IRQL and then

make the call to RtlVolumeDevicetoDosName()…?? I’m pretty much
stuck…:slight_smile:

Samarth

“Peter Wieland” wrote in message
> news:xxxxx@ntdev…
>
> What process are you in the context of when you make this call? It
> may be that the routine needs data from the PEB which may not be
> present in the system process.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
> Sent: Thursday, June 05, 2003 3:02 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
>
> Hi,
>
> Well i now use the following call…
>
>
> >>ntstatus=ObReferenceObjectByHandle(Handle,0,*IoFileObjectTyp
> e,KernelMo
> >>de,&
> Object,NULL);
>
> The handle is a valid handle and the call to RtlVolume…() is made
> only if
> ObRef…() returns STATUS_SUCCESS.The code is executing at
> PASSIVE_LEVEL.
>
> However, the driver still continues to crash.
>
> I tried DbgPrint() before all the statements but was unable to detect
> any problem. But the call to RtlVolume…() does sometimes return an
> error. Is there any other method to strongly check that the parameters

> that i am passing of
> RtlVolume…() The system crashes with either
> KMODE_EXCEPTION_NOT_HANDLED or PAGE_FAULT_IN_NONPAGED_AREA.
>
> Thank you for any suggestions
> Samarth
>
>
> “Peter Wieland” wrote in message
> news:xxxxx@ntdev…
>
> Look at the description of the ObjectType parameter of
> ObReferenceObjectByHandle in the DDK documentation.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth Sharma
> Sent: Wednesday, June 04, 2003 9:54 PM
> To: NT Developers Interest List
> Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
>
> Thanks for the info Nick…Is there any method of verifying whether the

> object i receive is a valid FILE_OBJECT type object?? Regards, Samarth

> “Nick Ryan” wrote in message news:xxxxx@ntdev…
> >
> > The handle MUST be a handle to an open filesystem file.
> >
> > - Nick Ryan
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Samarth
> > > Sharma
> > > Sent: Wednesday, June 04, 2003 3:51 AM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] Re: rtlvolumedevicetodosname problem again…
> > >
> > >
> > > Hi,
> > > Well i double checked for the pointers being Non-NULL.that didn’t
> > > work…I am sure that i’m running at IRQL==Passive…The
> ‘Handle’ can
> > > be a handle to a registry key or a file or a socket or
> anything else
>
> > > basically. Therefore, i’m not too certain if it would be a
> > > FILE_OBJECT. However, i do a
> > > ZwQueryInformationFile() just before the given code and that code
> > > gets executed only if the ZwQuery…() succeeds. Also, the
> > > interesting part is that my driver usually crashes when
> DbgView is
> > > running on the system. It seems a behave a little better on other
> > > occasions. Does this give any clue to the problem?? I’m having a
> > > little problem with WinDbg. Will send the !analyze -v
> soon. Thanks,
> > > Samarth
> > >
> > > “Nick Ryan” wrote in message news:xxxxx@ntdev…
> > > >
> > > > The code looks fine (except for a missing left parentheses, but
> > > > I’m sure that’s just an email typo) - we need more information.
> > > Where did
> > > > ‘Handle’ come from? Can you double-check that Object and
> > > ((FILE_OBJECT
> > > > *) Object)->DeviceObject are non-NULL? Are you sure you’re
> > > running at
> > > > passive level? Can you send us the !analyze -v from WinDbg?
> > > >
> > > > - Nick Ryan
> > > >
> > > > > -----Original Message-----
> > > > > From: xxxxx@lists.osr.com
> > > > > [mailto:xxxxx@lists.osr.com] On Behalf
> Of Samarth
> > > > > Sharma
> > > > > Sent: Wednesday, June 04, 2003 1:44 AM
> > > > > To: NT Developers Interest List
> > > > > Subject: [ntdev] rtlvolumedevicetodosname problem again…
> > > > >
> > > > >
> > > > > Hi all,
> > > > > I’m trying to use Rtlvolumedevicetodosname() to get the drive
> > > > > letter. I have a handle to an object and obtain the
> > > object pointer
> > > > > using ObReferenceObjectByHandle(). I then pass (((FILE_OBJECT
> > > > > *)Object)->DeviceObject) as the first argument to
> > > RtlVolume…().
> > > > > However, using this KPI results in a blue screen on my
> > > system, with
> > > > > a KMode_exception_not_handled.(most of the times) The
> > > actual call is
> > > > > listed below…
> > > > >
> > > > > >>>
> > > > > ntstatus=ObReferenceObjectByHandle(Handle,0,0,KernelMode,&Obje
> > > > > ct,NULL);
> > > > > >>> if(ntstatus==STATUS_SUCCESS)
> > > > > >>>
> > > ntstatus=RtlVolumeDeviceToDosName((FILE_OBJECT
> > > > > *)Object)->DeviceObject,&DriveName);
> > > > >
> > > > > Am i doing this correctly?? i browsed through the ntfsd
> > > archives but
> > > > > was not able to find a reason for this to
> happen…except perhaps
>
> > > > > that the Object returned by
> > > > > ObReference…() may not be a file object and so the
> > > system crashes.
> > > > > If so, is there a method to verify if the object returned
> > > is of the
> > > > > required type or not? Thanks for any help… Regards, Samarth
> > > > >
> > > > >
> > > > >
> > > > > —
> > > > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > > > unsubscribe send a blank email to
> > > > > xxxxx@lists.osr.com
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@nryan.com To
> > > unsubscribe send a blank email to xxxxx@lists.osr.com
> > >
> >
> >
> >
> >
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@microsoft.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
>
>
>
>
>
>
>
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@microsoft.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@nryan.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,
Sorry to reply so late. I debugged the driver and the problem was an
access violation during a read operation on a structure returned by
ZwQueryFile…() KPI.

However, this violation occurred only when the DbgPrint(“”) statement was
trying to read the structure. The driver works fine now when i have
removed the DbgPrint() statement. I now copy the structure contents into a
local array and then DbgPrint() this array. The system does not crash now.

But the reason is still not very clear. Anyways, thanks for all your help,
especially Peter and Nick

Regards,
Samarth