EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Rename file notification

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#9472
Posted: 03/31/2009 05:09:26
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

Thanks for the information, I have downloaded the latest prerelease and the rename does now work correctly.

However, on my first test, I have noticed that if I create a file in a specific directory using windows explorer all is well and I get a notification, if I create a file in the same directory using a .NET application I do not get any notification. Is there any reason why this would be? We need to use an automated application to prove the filter is up to the job we intend it for but if there is some reason why I can't get notified of creates from applications such as the test app I wonder what else could be missed.

The app code which creates the files is as follows:
Code
using( FileStream fs = new FileStream("<path to watched folder\test.txt", FileMode.Create) )
{
    fs.Close();
}


If I create "<path to watched folder\test.txt" from Windows Explorer I do get the notification so the filter path and setup seems correct.
#9473
Posted: 03/31/2009 05:13:53
by Vladimir Cherniga (EldoS Corp.)

Quote
Dan Cooper wrote:
Also, the CanFileBeDeleted call does not guarantee that DeleteFile will actually be deleted does it?

It will not be deleted until the last close request will be done.
#9474
Posted: 03/31/2009 05:22:03
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

OK, thanks for the info. I'm fine with that, I can use the CanFileBeDeleted notification and check when the file is deleted.

I am more worried about the fact I don't get create notifications from my test app, any ideas why this might be?
#9480
Posted: 03/31/2009 06:56:53
by Vladimir Cherniga (EldoS Corp.)

Quote
Dan Cooper wrote:
The app code which creates the files is as follows: Code

using( FileStream fs = new FileStream("<path to watched folder\test.txt", FileMode.Create) ){fs.Close();}



If I create "<path to watched folder\test.txt" from Windows Explorer I do get the notification so the filter path and setup seems correct.


May be there is a syntaxis error. This code should be written as
Code
using( FileStream fs = new FileStream(@"<path to watched folder\test.txt", FileMode.Create) ){fs.Close();}


The next thing. When you utilize using keyword, code withing {} brackets invokes Dispose() method for the initialized object, so there is no need to invoke fs.Close() method.
#9486
Posted: 03/31/2009 08:05:07
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

The files are created fine, the single backslash was a typo when I changed the folder name. Close is in fact required inside a using block as it is not implicitly called by Dispose().

Anyway, the files definitely get created so there is no problem with that code but I still don't get notifications.
#9490
Posted: 03/31/2009 11:52:43
by Vladimir Cherniga (EldoS Corp.)

I just have tested your code with a BaseFilter sample and receive 2 notification events: OpenFile and CloseFile. It was interpreted as OpenFile request( not CreateFile)cause of disposition for this request was FILE_OVERWRITE_IF( look at MSDN about this flags), not clear FILE_CREATE.

Quote
Dan Cooper wrote:
Close is in fact required inside a using block as it is not implicitly called by Dispose().


As far as i know method Close() from FileStream class just calls internally Dispose(). Dispose() should release all taken system resources( handles, connections, etc).
#9496
Posted: 04/01/2009 02:18:43
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

Is this something that will be changed in the future? We do not plan on monitoring open and close notifications as there will be so many and they are not required for our application. Thanks.
#9497
Posted: 04/01/2009 07:36:48
by Vladimir Cherniga (EldoS Corp.)

In my test i just have added 3 rules to monitor: Create/Open/Close. You could include any filters in your application, but in the case when you wish to monitor all create requests you should add open filter rule too, cause some of the open requests can lead to the totally new file creation, it depends on CreateDisposition parameter ,specified during CreateFile() winapi call.
#9498
Posted: 04/01/2009 07:54:44
by Dan Cooper (Basic support level)
Joined: 06/27/2007
Posts: 125

OK, but I don't seem to get notified of the CreateDisposition flags in the callback. What should I be looking for in the case of a create in the Open callback?
#9499
Posted: 04/01/2009 12:02:09
by Vladimir Cherniga (EldoS Corp.)

CreateDisposition flag is hidden into the cbfltapi callback mechanism. All create requests come from filter driver in the one path. But depends on CreateDisposition parameter, this path is divided into the Create or Open callbacks. When CreateDisposition is equal to the one of:
FILE_OPEN,
FILE_OPEN_IF,
FILE_OVERWRITE,
FILE_OVERWRITE_IF,
FILE_SUPERSEDE
this request interpreted as OpenFile
when this parameter set to:
FILE_CREATE
this request interpreted as CreateFile.
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

Topic viewed 20684 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!