EldoS | Feel safer!

Software components for data protection, secure storage and transfer

How to Cancel CreateFile event

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#7722
Posted: 09/26/2008 08:33:31
by Khayralla AL-Athari (Standard support level)
Joined: 09/23/2008
Posts: 75

Hi

In some conditions, I don't want to copy a subfolder to another folder.
So I throw an error while CbFsRenameOrMoveFile (moving) event, but this event is always followed by another event that copy the subfolder to the new place.

Now, how can I cancel the second event (CbFsCreateFile)?

I think this is a C# concept, however, may be some body can help.

thanks

Khayralla.
#7726
Posted: 09/26/2008 10:51:50
by Eugene Mayevski (EldoS Corp.)

I am not sure that I understand your question. Let me explain in brief what CBFS does and how this stuff works.

When some application uses certain Win32 API function such as CreateFile or MoveFile or DeleteFile, the request is transformed to kernel-mode request and passed to the file system. In most cases there exists a one-to-one correspondence between API calls made by the application and the callbacks that you get from CBFS.

So what you see (first RenameOrMove callback, then CreateFile callback) is a sequence of calls made by the application. We can't influence this sequence. You get all calls and it's your responsibility to track the operations and prevent some of them by throwing the exception.


Sincerely yours
Eugene Mayevski
#7728
Posted: 09/26/2008 11:14:33
by Khayralla AL-Athari (Standard support level)
Joined: 09/23/2008
Posts: 75

thanks Eugene

I fully understand you.

If I launch Windows Explorer.
When you try to drag and drop a file from one place (C:\) to the control panel, the mouse pointer will be changed to show you this moving is illegal before you dropping.
Can I make same behavior ?


thanks

Khayralla
#7729
Posted: 09/26/2008 11:34:21
by Eugene Mayevski (EldoS Corp.)

You can't do this with Callback File System because what you see is Explorer and it's interfaces, not the file system activity. The operation of drag'n'drop is performed by Explorer and when you move the cursor, explorer checks with it's namespace extension (which provides Explorer-like interface for Control Panel) whether certain operation (in your case drag'n'drop) is allowed. File System is not involved in this process. Only when you drop the file(s) to the window, then, in case when drag'n'drop is allowed, Explorer notifices the shell extension that drop operation happened.


Sincerely yours
Eugene Mayevski

Reply

Statistics

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