EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Handle FileRename in Callback

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#28463
Posted: 02/19/2014 08:10:01
by Volodymyr Zinin (EldoS Corp.)

ReplaceIfExists is processed internally by CBFS. The processing of the OnRenameOrMove callback always expects that the file/directory will be renamed.
#28471
Posted: 02/20/2014 02:18:58
by Theodor Kleynhans (Standard support level)
Joined: 10/29/2013
Posts: 10

That is the way it currently works, but it is technically incorrect.
The rename/move must fail if the ReplaceIfExists is false.
Currently we have no way of knowing the value of ReplaceIfExists.
#28474
Posted: 02/20/2014 03:11:57
by Volodymyr Zinin (EldoS Corp.)

CBFS knows whether the file being renaming exists or not and correctly processes the ReplaceIfExists flag. It gets the info about the file either from its metadata cache or from the OnGetFileInfo call.
The OnRenameOrMoveFile callback is called only if the file replace is required.
#28679
Posted: 03/05/2014 07:36:45
by Theodor Kleynhans (Standard support level)
Joined: 10/29/2013
Posts: 10

Then I think there must be a bug.
I tested as follows:
* Copy an image called Untitled.png to the callback disk.
* Right-click on the file and click "Rotate Clockwise".
* We get OnGetFileInfo("~ntitled.tmp"), and we return fileExists = false.
* We get OnCreateFile("~ntitled.tmp"), so we create the file.
* We get OnGetFileInfo("Untitled.png~RFf36fa64.TMP"), and we return fileExists = false.
* We get OnCreateFile("Untitled.png~RFf36fa64.TMP"), so we create the file.
* We get OnRenameOrMoveFile("Untitled.png", "Untitled.png~RFf36fa64.TMP"), but in this case "Untitled.png~RFf36fa64.TMP" already exists.
#28680
Posted: 03/05/2014 09:13:31
by Volodymyr Zinin (EldoS Corp.)

Quote
Theodor Kleynhans wrote:
We get OnRenameOrMoveFile("Untitled.png", "Untitled.png~RFf36fa64.TMP"), but in this case "Untitled.png~RFf36fa64.TMP" already exists.

So just rename it. It seems the ReplaceIfExists flag is set in this case.
By calling the OnRenameOrMoveFile callback CBFS expects that the file will always be renamed not depending whether the destination file exists or not.

BTW you can use Process Monitor from sysinternals.com to see what requests come to CBFS in this case. In order to minimize logs set there a filter, something like "Path"->"begins with"->"X:" (where "X:" is a drive letter for your virtual disk).
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

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