Shared access to a device

Hello,
I have a kernel device that creates a device and a symbolic link so that
it is useable from Win32 applications.
I am in the need of accessing this device from two different applications at
the same time and even if both CreateFile calls specify a read and write
share access, only the first succeeds while the second fails with
access denied.
The question is how can I do that?
Thanks in advance,
Marco

check if u are setting exclusive bit while creating the device object.

chaitanya

----- Original Message -----
From: Fassiotto Marco
To: NT Developers Interest List
Sent: Wednesday, May 17, 2000 3:57 PM
Subject: [ntdev] Shared access to a device

> Hello,
> I have a kernel device that creates a device and a symbolic link so that
> it is useable from Win32 applications.
> I am in the need of accessing this device from two different applications
at
> the same time and even if both CreateFile calls specify a read and write
> share access, only the first succeeds while the second fails with
> access denied.
> The question is how can I do that?
> Thanks in advance,
> Marco
>
> —
> You are currently subscribed to ntdev as: xxxxx@cmcltd.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)

You will have to process the SHARE_ACCESS bits in IRP_MJ_CREATE, rejecting
with STATUS_SHARING_VIOLATION create requests that violate whatever rules
you want to impose.

However, it sounds like you perhaps don’t want to ever support more than one
open instance to your device at a time. In that case you should set the
exclusive bit in your device object - as the other reply suggested.

-----Original Message-----
From: Fassiotto Marco [mailto:xxxxx@olivettilexikon.com]
Sent: Wednesday, May 17, 2000 6:27 AM
To: NT Developers Interest List
Subject: [ntdev] Shared access to a device

Hello,
I have a kernel device that creates a device and a symbolic
link so that
it is useable from Win32 applications.
I am in the need of accessing this device from two different
applications at
the same time and even if both CreateFile calls specify a
read and write
share access, only the first succeeds while the second fails with
access denied.
The question is how can I do that?
Thanks in advance,
Marco


You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

> I am in the need of accessing this device from two different applications
at

the same time and even if both CreateFile calls specify a read and write
share access, only the first succeeds while the second fails with
access denied.

Exclusive parameter is TRUE in IoCreateDevice. This means - IO manager
cannot create more than one file object on it. AFAIK this is used by serial
port driver to prevent multiple opens.
Is it your intent? If not - change it to FALSE.

Max