EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Change Filename in Directory Listing

Also by EldoS Corporation: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#25153
Posted: 06/01/2013 17:16:56
by david bennett (Standard support level)
Joined: 03/29/2013
Posts: 49

I just installed the latest Beta of version 3. I would like to alter the names of certain files under certain circumstances. I have been playing with the OnReparseFilename notification. It seemed that in the previous versions of the filter I was getting an event when the directory listing, but it seems that with the latest version this is no longer the case.

I switched to the latest version because the previous version was just renaming files even though I didn't do anything in the OnReparseFilename() function. Now I don't seem to get notified at all. I'm curious how it is supposed to work, and whether I am barking up the wrong tree. It seems there is no other way to filter the directory contents, which I imagine is something other people would want as well.

As an aside, the whole reparse mechanism seems more poorly documented in your documentation than other capabilities and I can't find any examples in your distribution.
#25160
Posted: 06/03/2013 06:10:00
by Vladimir Cherniga (EldoS Corp.)

Quote
It seemed that in the previous versions of the filter I was getting an event when the directory listing, but it seems that with the latest version this is no longer the case.

Reparse callback event not connected with directory enumeration request. It just happens on create/open file request, depends on reparse rule set previously. A reparse callback may be invoked in this case, based on the mask in AddCallbackFilterRule()

Quote
I switched to the latest version because the previous version was just renaming files even though I didn't do anything in the OnReparseFilename() function. Now I don't seem to get notified at all. I'm curious how it is supposed to work, and whether I am barking up the wrong tree. It seems there is no other way to filter the directory contents, which I imagine is something other people would want as well.


Reparse callback acts as a support routine for reparse rule. By default, it behave without changing anything in repase rule set before. If you need to breake the currently set reparse rule within callback event, you may just throw an ECBFltError exception with any value not equal to zero.
If you wish to alternate the default reparse path, specified in NewFileName parameter, then you must fill the output buffer with a string of full new file path, specifying a length in output parameter. As a side effect, if you specify output sting the same as input string, reparse rule will not work, and original request will be processed without reparsing.
#25174
Posted: 06/03/2013 14:44:07
by david bennett (Standard support level)
Joined: 03/29/2013
Posts: 49

So if I understand correctly (and my tests indicate this), AddReparseFileNameRule() really isn't supposed to work for directory enumeration at all. If that is the case, it seems to really limit its usefulness. If a user sees a file in a directory listing and tries to open it, only then does the name get reparsed.

Am I missing something? If I want the name of the file on disk to always be changed to something else for listing and opening, etc, is there any way to do this?
#25175
Posted: 06/03/2013 15:03:20
by Vladimir Cherniga (EldoS Corp.)

Reparse rule may be applied to directory name as well. Then, browsing target directory will reparse to another directory, based on reparse rule.
Changing the name of the file in directory listing is not a subject of reparse mechanism. Consider directories as a text file with a list of files included, that is requested during enumeration. Reparse works on a file open stage, filter change the requested name and STATUS_REPARSE returned to the io subsystem, then it opens another file from the path specified in reparse rule. It also may be applied to the directory name, not only to file name.
#25176
Posted: 06/03/2013 15:13:10
by david bennett (Standard support level)
Joined: 03/29/2013
Posts: 49

So theoretically, I could create a virtual directory with different filenames, then when those files got opened, I could map the open back to the original filenames for those I didn't want to change?

Sounds complicated but it might work. Do you see any holes in this idea?
#25177
Posted: 06/03/2013 15:30:06
by Vladimir Cherniga (EldoS Corp.)

If you want to redirect real file open to virtual file or vise versa with reparse rule then it should work. If you want to hide the real file under the virtual one directly, making virtual file exists in the same directory, then it will not work in current version. It will be possible in the next build soon. It will work in the next way - when you open real file, and return VirtualFile = true from callback, then virtual file will be created and opened over the real file.
#25178
Posted: 06/03/2013 15:41:33
by david bennett (Standard support level)
Joined: 03/29/2013
Posts: 49

i guess I didn't explain myself very clearly. What I'm thinking is that I will reparse the directory into a new directory that is a virtual directory. It will have all of the same files, but they will have the names I want them to have.

This is fairly complicated, but I think it would work, but I have what I think is probably a simpler solution. I am also a customer of your CallbackFileSystem. I am thinking that I can reparse the directory names into directory name that's in a CallbackFileSystem like your mapper example application except that it has changed some of the filenames. This seems to accomplish what I want, which is to change the names of some of the files in certain directories.

I just need to do both a callback filter to remap the directory name and a callback file system to be the target of the redirection.

Let me know if you see any problems with this.

Thanks,
#25185
Posted: 06/04/2013 05:45:23
by Vladimir Cherniga (EldoS Corp.)

I think it possible, using the redirection from source folder to another virtual one.
Also by EldoS Corporation: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

Topic viewed 1789 times

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




|

Back to top