CreateFile for driver: Sharing problem

Hi!

I have a sharing problem when I call CreateFile to get handle for the
driver. I can’t do it twice in one process and in another process. Error
code is “Access denied”.

I used CreateFile this way:

CreateFile(device_name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

As you see I passed FILE_SHARE_READ | FILE_SHARE_WRITE flags to function.
But there’s no positive effect.

vlad-ntdev

Hello,

May be you have created exclusive device in your call to IoCreateDevice ()?

BR,
Vadim

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of vlad-ntdev
Sent: Tuesday, April 02, 2002 1:05 PM
To: NT Developers Interest List
Subject: [ntdev] CreateFile for driver: Sharing problem

Hi!

I have a sharing problem when I call CreateFile to get handle for the
driver. I can’t do it twice in one process and in another process. Error
code is “Access denied”.

I used CreateFile this way:

CreateFile(device_name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);

As you see I passed FILE_SHARE_READ | FILE_SHARE_WRITE flags to function.
But there’s no positive effect.

vlad-ntdev


You are currently subscribed to ntdev as: xxxxx@pcausa.com
To unsubscribe send a blank email to %%email.unsub%%

Oh, yes! Thanks!

and sorry for the stupid quistion…

vlad-ntdev

Hello,

May be you have created exclusive device in your call to IoCreateDevice
()?

BR,
Vadim