EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CanFileBeDeleted anomoly

Posted: 12/02/2013 13:18:36
by Andy Key (Standard support level)
Joined: 11/12/2013
Posts: 16

I previously implemented CanFileBeDeleted to answer TRUE in all cases.
My DeleteFile was called.

I now want to introduce a safety feature whereby the user can mount my storage in a read only manner, and I throw exceptions from methods which try to change the data, such as OpenFile with GENERIC_WRITE.

So when read only, I make CanFileBeDeleted answer FALSE.
As a result, DeleteFile is not called.

The confusing thing is that the delete appears not to encounter any error, and yet is ineffective :-

c:\ak\mtx\cpmcbfs>type z:x

c:\ak\mtx\cpmcbfs>del z:x

c:\ak\mtx\cpmcbfs>type z:x


Any idea whats going on?

CbFS 5 release version.

{{{ Andy
Posted: 12/02/2013 13:21:58
by Eugene Mayevski (Team)

The behavior is by design. Please see the knowledgebase article: https://www.eldos.com/cbfs/articles/7968.php

Sincerely yours
Eugene Mayevski
Posted: 12/02/2013 13:42:37
by Andy Key (Standard support level)
Joined: 11/12/2013
Posts: 16

Hmm, somewhat surprising.

Ok, so what I now do now is fabricate FILE_ATTRIBUTE_READONLY from EnumerateDirectory and GetFileInfo.
The delete encounters an error when trying to del the file.
The following attrib -r file also encounters an error.
This seems to provide the protection I'm looking for, and reasonable user feedback.

Thanks for the quick reply.

{{{ Andy



Topic viewed 1486 times

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


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!