EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Rename file notification

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#9508
Posted: 04/02/2009 02:01:33
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

OK, that makes sense but I am still not sure how I can tell when an open is a create. The file has been created by the time I get the open notification so how would I tell if it's a new file or simply opening an existing file?
#9512
Posted: 04/02/2009 04:18:58
by Vladimir Cherniga (EldoS Corp.)

The only way to determine if the file have existed before create notification occures is to do the check of file presence in precreate path. In this way file system checks in the IRP_MJ_CREATE request if the requested Disposition is compatible with presence of target file.
#9515
Posted: 04/02/2009 05:56:58
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

I don't understand what you mean. If I get an Open notification after the file has been created, how can I tell if the notification is for a new file and not an existing one? Checking if the file exists will always return true in this notification.
#9540
Posted: 04/03/2009 01:45:42
by Vladimir Cherniga (EldoS Corp.)

Quote
Dan Cooper wrote:
Checking if the file exists will always return true in this notification.

You are right. Notification event comes in the postcreate path. The only way to interrupt IRP_MJ_CREATE request before it will be processed by file system is to subscribe on PreCreateC callback.
#9543
Posted: 04/03/2009 03:37:33
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

There doesn't seem to be a PreCreateC callback, only PostCreateC. Am I missing something?
#9549
Posted: 04/03/2009 05:39:46
by Vladimir Cherniga (EldoS Corp.)

Yes, you are right. There is a CbFltCreateFileEventC event callback( it is invoked before IRP_MJ_CREATE request will be forwarded to the file system driver) and CbFltPostCreateFileEventC (which is invoked after the request have been processed by the file system driver).
#9550
Posted: 04/03/2009 05:41:13
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

Ah, OK. So the CreateFileEventC will be fired first. I will give that a try. Thanks.
#10052
Posted: 05/18/2009 10:12:39
by Phil Nash (Standard support level)
Joined: 05/18/2009
Posts: 10

This thread dropped off here, which is a shame as I am experiencing exactly the same problem.

I've registered for CbFltCreateFileEventC events, but I'm not getting called back on that when OpenOrCreate is used. I only get the "Open" callbacks or notifications.

I notice that the Open callbacks get passed a CreateOptions value, but this appears to be just the FILE_FLAGS_??? modes, and not the creation disposition.

So I'm still trying to work out if it is possible, as the API stands, to determine if an open request will, or at least may, create the file. If I can at least get that disposition flag I could test for the pre-existence of the file - but that would be too expensive to do on *every* open.

If this is not possible I'd also like to know if that's a limitation of the Eldos API, or of the file system filter API in general.

Many thanks in advance,

Phil
#10074
Posted: 05/20/2009 03:58:24
by Vladimir Cherniga (EldoS Corp.)

You should understand that CreateDisposition gives you nothing to know about file existence. In our filter we just suppose that file *may* be exist when Disposition parameter is not clear FILE_CREATE request. But this is can not be guaranteed. CreateDisposition parameter reflects a user request to file sytem driver and offers to deside what to do with this request if file already exists or not exists. As a result of this request, file system decides to satisfy this request or not.
There are may be to cases:
1. File already was open and in this case file system driver stores information about this file in internal structures and have ability to check does requested CreateDisposition parameter is compatible with existed file.

2. File wasn't open before and file system does't have information about requested file. In this case it shoud check the existence of directory entry for this file on disk storage and creates internal structures in order to support access to this file.
Quote

If I can at least get that disposition flag I could test for the pre-existence of the file - but that would be too expensive to do on *every* open.


To minimize unnecessary checks you could utilize UserContext input parameter to store file related information.
#10078
Posted: 05/20/2009 08:11:47
by Phil Nash (Standard support level)
Joined: 05/18/2009
Posts: 10

Thanks for the reply, Vladimir,

I understand that CreateDisposition would not tell me about file existence, but I'm expecting it to tell me if the intent of the caller was that the file should be created if it doesn't already exist. This would allow me to limit my file existence check to those cases only, rather than for *every* open.

As far as I can see the CreateDisposition flag is not available through your API. If you know any different, please let me know.

I'm not sure how the UserContext parameter helps. As far as I can see that is only available in the callbacks that happen *after* the file has been opened/ created.

Regards,

Phil
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 20700 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!