Problem When two user applications calls CreateFile

Hi,

If am developing a file system filter driver which locks files and folders
with password.
There are two applications a)password app b)main GUI
Currently I stuck up with following problem.

  1. The two applications are calling api CreateFile and both should run
    simultaneously.
  2. Now the problem is that the application which first calls the
    CreateFile api gets the valid Handle .The next application which
    running simultaneously gets invalid Handle if the handle is not
    closed by the first app. So the next app stops functioning.
  3. My question is that is it possible for two applications to call
    CreateFile on a same device object using same device name and symbolic
    link name.Is there
    any extra parameters to be mentioned in CreateFile api. I had used it
    in following manner.

hDevice = CreateFile( FILESPY_W32_DEVICE_NAME,
/*Symbolic Link*/
GENERIC_READ | GENERIC_WRITE, /*Desired Access*/
FILE_SHARE_DELETE, /*share Mode*/ (Even using this I am not able to do it)
NULL, OPEN_EXISTING,
/*Creation Disposition*/
0, NULL);

We will be thankful to you if you help us in this issue.

Thanks
Gaurav

Hi Gaurav,

Is this YOUR device object that you are opening? If so, are you
specifying exclusive access mode? That would cause a problem like the
one that you describe.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Gaurav Waikar
Sent: Thursday, August 05, 2004 8:59 AM
To: ntfsd redirect
Subject: [ntfsd] Problem When two user applications calls CreateFile

Hi,

If am developing a file system filter driver which locks files and
folders
with password.
There are two applications a)password app b)main GUI
Currently I stuck up with following problem.

  1. The two applications are calling api CreateFile and both should run
    simultaneously.
  2. Now the problem is that the application which first calls the
    CreateFile api gets the valid Handle .The next application which
    running simultaneously gets invalid Handle if the handle is not
    closed by the first app. So the next app stops functioning.
  3. My question is that is it possible for two applications to call
    CreateFile on a same device object using same device name and symbolic
    link name.Is there
    any extra parameters to be mentioned in CreateFile api. I had used
    it
    in following manner.

hDevice = CreateFile( FILESPY_W32_DEVICE_NAME,
/*Symbolic Link*/
GENERIC_READ | GENERIC_WRITE, /*Desired Access*/
FILE_SHARE_DELETE, /*share Mode*/ (Even using this I am not able to do
it)
NULL, OPEN_EXISTING,

/*Creation Disposition*/
0, NULL);

We will be thankful to you if you help us in this issue.

Thanks
Gaurav


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

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

Surely it is possible, just set Exclusive to FALSE in IoCreateDevice which
creates this device.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Gaurav Waikar”
To: “Windows File Systems Devs Interest List”
Sent: Thursday, August 05, 2004 4:59 PM
Subject: [ntfsd] Problem When two user applications calls CreateFile

> Hi,
>
> If am developing a file system filter driver which locks files and folders
> with password.
> There are two applications a)password app b)main GUI
> Currently I stuck up with following problem.
> 1) The two applications are calling api CreateFile and both should run
> simultaneously.
> 2) Now the problem is that the application which first calls the
> CreateFile api gets the valid Handle .The next application which
> running simultaneously gets invalid Handle if the handle is not
> closed by the first app. So the next app stops functioning.
> 4) My question is that is it possible for two applications to call
> CreateFile on a same device object using same device name and symbolic
> link name.Is there
> any extra parameters to be mentioned in CreateFile api. I had used it
> in following manner.
>
> hDevice = CreateFile( FILESPY_W32_DEVICE_NAME,
> /Symbolic Link/
> GENERIC_READ | GENERIC_WRITE, /Desired Access/
> FILE_SHARE_DELETE, /share Mode/ (Even using this I am not able to do it)
> NULL, OPEN_EXISTING,
> /Creation Disposition/
> 0, NULL);
>
> We will be thankful to you if you help us in this issue.
>
> Thanks
> Gaurav
>
>
> —
> Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com