EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Events not triggered when setting DeleteProtect AccessFlag

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#32343
Posted: 02/26/2015 06:38:12
by Gopal Malviy (Basic support level)
Joined: 02/26/2015
Posts: 10

Hi,

I've gone through your sample .NET application. It was very easy. Thanks.

But I've came across few points that needs to be understood and clarified.

I've applied DeleteProtect access flag (which you can see in screenshots)

On Delete:


On Rename:



  • Is there any solution to modify the prompt?
  • Why it's showing prompt when the file is renamed?
  • Why drag and drop of file is allowed but cut and paste is prevented?


Please resolve my queries.
Thanks
#32344
Posted: 02/26/2015 06:57:34
by Vladimir Cherniga (EldoS Corp.)

Quote
Gopal Malviy wrote:
Is there any solution to modify the prompt?

Screenshots is too small to see the prompt, but error code thrown by the filter driver is always the same and cannot be changed. In order to change error code you must handle create/open file callback and throw an appropriate ECBFltError exception.
Quote
Gopal Malviy wrote:
Why it's showing prompt when the file is renamed? Why drag and drop of file is allowed but cut and paste is prevented?

DeleteProtect access flag works in the next way - DesiredAccess parameter checked on file open request and if it has DELETE or FILE_DELETE_CHILD flag set then it complete request with a STATUS_ACCESS_DENIED error. rename/drag-and-drop/cut may work with a different windows api, some of them may set or not DELETE access flag. That is the reason of such results.
#32346
Posted: 02/26/2015 08:06:43
by Gopal Malviy (Basic support level)
Joined: 02/26/2015
Posts: 10

You may check the image by right clicking on it and click on "Open image in new tab".
I'm using Google Chrome.

Thanks.
#32347
Posted: 02/26/2015 08:28:39
by Gopal Malviy (Basic support level)
Joined: 02/26/2015
Posts: 10

I've tried handling OnCanFileBeDeletedC event. And typed
Code
DeleteFile = false;
which works pretty fine. The only issue is the file which was deleted is hides in explorer until user refreshes the window. Is there any other solution to this problem?
#32348
Posted: 02/26/2015 08:38:54
by Vladimir Cherniga (EldoS Corp.)

DeleteFile = false works as follow - it completes request silently without processing it by the file system. This is the same for all RequestAccepted = false in other callbacks (except Create/Open file callbacks). Explorer doesn't know that file is not deleted in your case. In order to complete request with error, you should throw an exception instead.
#32351
Posted: 02/26/2015 09:10:20
by Gopal Malviy (Basic support level)
Joined: 02/26/2015
Posts: 10

Actually I need to display same prompt as it was shown in the screenshot. But with custom message. I've tried throwing an exception. But it terminates the program. How can I display the message like that?
#32352
Posted: 02/26/2015 09:16:58
by Vladimir Cherniga (EldoS Corp.)

Custom message cannot be shown. You may experiment with different Win32 error codes throwing ECBFltError()exception from callback handler. It shouldn't terminates the program.
#32353
Posted: 02/26/2015 09:46:17
by Gopal Malviy (Basic support level)
Joined: 02/26/2015
Posts: 10

Code
        private void CbFltCanFileBeDeletedEventC(object Sender, string FileName, ref bool DeleteFile, ref IntPtr UserContext, ref bool ProcessRequest)
        {
            DeleteFile = false;
            ProcessRequest = false;
            //throw new ECBFltError("You cannot do this.");
            throw new ECBFltError(1);
        }


Is it what you're suggesting? The file is went into recycle bin and program crashes.
#32354
Posted: 02/26/2015 10:41:08
by Vladimir Cherniga (EldoS Corp.)

Quote
Gopal Malviy wrote:
The file is went into recycle bin and program crashes.

Does it run under debugger ?
#32376
Posted: 02/27/2015 06:58:00
by Gopal Malviy (Basic support level)
Joined: 02/26/2015
Posts: 10

Hey,

Thanks, I'm now able to handle CbFltCanFileBeDeletedEventC event but with the same prompt. Can I be able to use any other error codes from https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381%28v=vs.85%29.aspx ??
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

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