EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Renaming the file at virtual folder

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#32707
Posted: 03/23/2015 07:12:59
by Denis Araujo da Silva (Basic support level)
Joined: 02/10/2015
Posts: 6

Hello,

I would like to rename the file programmatically at the virtual folder. Like, on "real" disk like C:, I would have file.txt and at H: (CBFS), I would have fileCBFS.txt.

So in what method i have to do this ? When I create the file at WriteFile ?

Thank you in advance,
#32708
Posted: 03/23/2015 07:32:47
by Eugene Mayevski (EldoS Corp.)

Let's check if I understood your task right.

You are mapping something (disk C:) into virtual disk H: . During mapping you want to show c:\file.txt as H:\fileCBFS.txt . Is this correct?

For the operation I've described you need to change event handlers of OnEnumerateDirectory, OnGetFileInfo, OnOpenFile and OnCreateFile in order to translate file.txt into fileCBFS.txt and vice versa.


Sincerely yours
Eugene Mayevski
#32710
Posted: 03/23/2015 09:45:48
by Denis Araujo da Silva (Basic support level)
Joined: 02/10/2015
Posts: 6

Yes, that's it.

Would you mind to give me an example, only place that I see that I can change the Filename is in OnEnumerateDirectory, because FileName is passed as a reference.

Thanks for your help,
#32711
Posted: 03/23/2015 09:56:49
by Eugene Mayevski (EldoS Corp.)

There seems to be certain confusion here. CBFS doesn't do mapping of anything to the virtual filesystem, it's your code that does. In Mapper sample the mapping is done by the code of the sample. In your code it's the code that you write.

This means that your code can *return* (not change) whatever filename you want. Also your code must handle filesystem requests based on the filename you provided.

I.e. if your code tells the OS in OnEnumerateDirectory event handler that it has "filecbfs.txt", then the event handlers for OnGetFileInfo, OnFileCreate, OnFileOpen, OnFileDelete and OnFileRename must be ready to perform their action when "filecbfs.txt" is passed in the parameters.

There's Getting Started section in the help file which will help you understand how CBFS works. The help file is installed on your computer. It would be nice if you could review the help file as it will give you better understanding of the process.


Sincerely yours
Eugene Mayevski
#32718
Posted: 03/23/2015 13:18:35
by Denis Araujo da Silva (Basic support level)
Joined: 02/10/2015
Posts: 6

When I drop the file at H: (Cbfs driver) what is the method responsible for creating the file itself ? Because when I change the file name at OnEnumerateDirectory it changes the name at C:\ not at H:\ !

I already read all the help, but there are not many things are so clear.

Thanks for your help!
#32720
Posted: 03/23/2015 13:48:27
by Eugene Mayevski (EldoS Corp.)

Quote
Denis Araujo da Silva wrote:
When I drop the file at H: (Cbfs driver) what is the method responsible for creating the file itself ?


When the OS needs to create a file on the virtual disk, OnCreateFile event is fired.

Quote
Denis Araujo da Silva wrote:
when I change the file name at OnEnumerateDirectory it changes the name at C:\ not at H:\ !


Maybe it will be better if you stop looking at Mapper sample and look at VDisk sample instead. You are confused with the mapping. VDisk shows how to expose in-memory data as files on the virtual disk. It can be that this sample will be easier for you to deal with.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

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