How can I differ between two handles in my driver operations.

Hi all,

My question is very simple. If I have a driver and an
application gets a handle for it calling CreateFile API, my driver I
receive IRP_MJ_CREATE. But if the same application gets another handle
calling CreateFile API again, how can I differ between theses handles
when I receive IRP_MJ_READ for example?

Thanks in advance,
Fernando Roberto da Silva.

I think you can store some context information in
IO_STACK_LOCATION->FileObject->FsContext pointer when you get a
IRP_MJ_CREATE and then use this information in you other routines to
differentiate them.

On 7/1/05, Fernando Roberto wrote:
>
> Hi all,
>
> My question is very simple. If I have a driver and an application gets a
> handle for it calling CreateFile API, my driver I receive IRP_MJ_CREATE. But
> if the same application gets another handle calling CreateFile API again,
> how can I differ between theses handles when I receive IRP_MJ_READ for
> example?
>
> Thanks in advance,
>
> Fernando Roberto da Silva.
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
>
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Fernando

The file object contains two context pointers: fscontext1 and
fscontext2.

Fscontext1 points to the common FCB header and is the same for all
FILE_OBJECTS that reference the same file. If you want to distinguish
between instances of the same file, use fscontext2.

Regards

Mark


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anees M
Sent: 01 July 2005 13:40
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How can I differ between two handles in my driver
operations.

I think you can store some context information in
IO_STACK_LOCATION->FileObject->FsContext pointer when you get a
IRP_MJ_CREATE and then use this information in you other routines to
differentiate them.

On 7/1/05, Fernando Roberto wrote:

Hi all,

My question is very simple. If I have a driver and an
application gets a handle for it calling CreateFile API, my driver I
receive IRP_MJ_CREATE. But if the same application gets another handle
calling CreateFile API again, how can I differ between theses handles
when I receive IRP_MJ_READ for example?

Thanks in advance,

Fernando Roberto da Silva.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed
to ntdev as: unknown lmsubst tag argument: ‘’ To unsubscribe send a
blank email to xxxxx@lists.osr.com

The file objects will be different. So differentiate using the file objects.

-Kiran


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fernando Roberto
Sent: Friday, July 01, 2005 5:56 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How can I differ between two handles in my driver
operations.

Hi all,

My question is very simple. If I have a driver and an
application gets a handle for it calling CreateFile API, my driver I receive
IRP_MJ_CREATE. But if the same application gets another handle calling
CreateFile API again, how can I differ between theses handles when I receive
IRP_MJ_READ for example?

Thanks in advance,
Fernando Roberto da Silva.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com