EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ECBFSError not working for file deletion

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#37356
Posted: 08/01/2016 21:05:10
by Handaya  (Priority Standard support level)
Joined: 08/01/2016
Posts: 3

I'm trying to throw an error when deleting certain file. Based on some checking on the forum, I'm aware that I should use the throw inside CbFsCanFileBeDeleted, not in CbFsDeleteFile. However, after some trials with several errors (ERROR_SHARING_VIOLATION, ERROR_ACCESS_DENIED, ERROR_FILE_EXISTS, ERROR_FILE_NOT_FOUND), none of them showing any error. Could anyone please advise me on how to work with this matter? Another matter, when I tried to delete an opened file, it showed ERROR_SHARING_VIOLATION message. Could anyone please tell me which method threw this error? Thank you in advance.
#37357
Posted: 08/02/2016 02:02:58
by William Levra-Juillet (Priority Standard support level)
Joined: 09/05/2013
Posts: 49

Hi,

We return the following errors, and it works as expected:
ERROR_ACCESS_DENIED
ERROR_DIR_NOT_EMPTY
ERROR_PATH_NOT_FOUND
ERROR_FILE_NOT_FOUND

Must be something in your implementation.
Did you try to modify the mapper sample and see how it behaves?
#37358
Posted: 08/02/2016 04:05:29
by Volodymyr Zinin (EldoS Corp.)

Thank you for interesting of our product. Try the problem with one of the CBFS samples. Also read this article https://www.eldos.com/cbfs/articles/7966.php Perhaps it will shed a light on the problem.

Quote
cyberboy wrote:
Another matter, when I tried to delete an opened file, it showed ERROR_SHARING_VIOLATION message.

If a file was already opened without FILE_SHARE_DELETE then the next opening of the file with the "delete" access throws ERROR_SHARING_VIOLATION.
#37359
Posted: 08/02/2016 04:20:02
by Handaya  (Priority Standard support level)
Joined: 08/01/2016
Posts: 3

I tried with original cpp sample, modified it a bit by forcing the throw at the first place CbFsCanFileBeDeleted and CbFsDeleteFile were called. Putting the break point over there, I confirmed that the method were called and program stopped at the break point during debugging. I don't see the reason why the throw didn't work. By the way, the file of course remains undeleted.

Below is how I did it.
void CbFsCanFileBeDeleted(CallbackFileSystem* Sender, CbFsFileInfo* FileInfo, CbFsHandleInfo* HandleInfo, BOOL* CanBeDeleted)
{
throw ECBFSError(ERROR_FILE_NOT_FOUND);
*CanBeDeleted = TRUE;
}

When I put the throw in other method like CbFsEnumerateDirectory, error message was displayed.

Could you please tell me where the problem lies?
Thank you in advance.
#37363
Posted: 08/02/2016 04:51:32
by William Levra-Juillet (Priority Standard support level)
Joined: 09/05/2013
Posts: 49

Quote
cyberboy wrote:
{
throw ECBFSError(ERROR_FILE_NOT_FOUND);
*CanBeDeleted = TRUE;
}

Set CanBeDeleted to FALSE before throwing the error?
#37364
Posted: 08/02/2016 04:57:44
by Volodymyr Zinin (EldoS Corp.)

Please read the article I specified above. It seems the file is deleted by means of the second variant.
#37367
Posted: 08/02/2016 08:30:04
by Handaya  (Priority Standard support level)
Joined: 08/01/2016
Posts: 3

Thank you all for the responses.

Volodymyr Zinin:
I firstly created the file from command line using echo command (echo test > test.txt). After that I executed delete command also from command line (del test.txt).
Here, only CbFsCanFileBeDeleted method was called. The sample program ended after throw ECBFSError(ERROR_FILE_NOT_FOUND); but there was no error shown, meaning, the throw was ignored in some way and the file was not deleted.

William Levra-Juillet:
Already tried setting it to false, but it still didn't give any error.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

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