EldoS | Feel safer!

Software components for data protection, secure storage and transfer

throw new ECBFltError(5) not Working

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 01/25/2015 01:39:26
by saharan lv (Basic support level)
Joined: 01/25/2015
Posts: 4

Code below

mFilter.OnCreateFileC = CbFltCreateFileC;
            mFilter.OnPostCreateFileC = CbFltPostCreateFileC;
            mFilter.OnRenameOrMoveFileC = CbFltRenameOrMoveFileC;
            mFilter.OnPostRenameOrMoveFileC = CbFltPostRenameOrMoveFileC;
            mFilter.OnWriteFileC = CbFltWriteFileC;
            mFilter.OnPostWriteFileC = CbFltPostWriteFileC;
            mFilter.OnSetFileSecurityC = CbFltSetFileSecurityC;
            mFilter.OnSetFileAttributesC = CbFltSetFileAttributesC;
            mFilter.OnSetAllocationSizeC = CbFltSetAllocationSizeC;

               CbFltCallbackFlags.WriteCallback |
               CbFltCallbackFlags.CreateCallback |
               CbFltCallbackFlags.RenameCallback |
               CbFltCallbackFlags.SetBasicInfoCallback |
               CbFltCallbackFlags.SetSizesCallback |
               CbFltCallbackFlags.PostWriteCallback |
               CbFltCallbackFlags.SetSecurityCallback |


    private static void CbFltCreateFileC(CallbackFilter Sender, string FileName, ref uint DesiredAccess, ref uint FileAttributes, ref ushort ShareMode, ref uint CreateOptions, ref ushort CreateDisposition, ref bool VirtualFile, ref bool ProcessRequest)
            ProcessRequest = false;
            throw new ECBFltError(ERROR_ACCESS_DENIED);


    private static void CbFltWriteFileC(CallbackFilter Sender, string FileName, ref long Position, byte[] Buffer, ref int BytesToWrite, bool Cached, ref IntPtr UserContext, ref bool ProcessRequest)
            ProcessRequest = false;
            throw new ECBFltError(ERROR_ACCESS_DENIED);


I use these code to prevent file Create and Write .
But when I execute another c# code :
               using (var fs = File.CreateText(string.Format("e:\\temp\\{0}.aaa.txt", DateTime.Now.Ticks)))
            catch (Exception exc)


A file still be created and some contents writed;
Posted: 01/25/2015 01:52:28
by Eugene Mayevski (Team)

By default CallbackFilter doesn't filter requests that originate from the same application that installs the filter. You just don't get the callback.

On a side note if you have a license, please link the license ticket to your user account before we continue. The ticket itself and the procedure of its use are specified in the registration e-mail that was sent to you upon license purchase. If you don't have the license ticket, please contact the person from which you have obtained the license key (the one in your source code) for a license ticket.

NOTE: please don't post license keys and license tickets to the forum. If you need to clarify something about your license, please use HelpDesk ( http://www.eldos.com/helpdesk/ ).

Sincerely yours
Eugene Mayevski
Posted: 01/25/2015 04:29:34
by saharan lv (Basic support level)
Joined: 01/25/2015
Posts: 4

Thanks Eugene
But I test the code in another application.And CallbackFilter fire the right events. but this can not prevent the new process to create and write .
Posted: 01/25/2015 07:30:38
by Vladimir Cherniga (Team)

You should add a handler for OnOpenFileC event and process it identically to OnCreateFileC.
Posted: 01/25/2015 18:50:01
by saharan lv (Basic support level)
Joined: 01/25/2015
Posts: 4

Thanks Vladimir ,
But I think this could not work.

When I use notepad to create a txt file,nodepad will be prevented .
But When I write a C# code ,a file created.

Perhaps you can paste a sample code to help me .
Posted: 01/26/2015 03:14:06
by Vladimir Cherniga (Team)

saharan lv wrote:
But When I write a C# code ,a file created.

Your own process in not filtered with default settings, because it may deadlock in recursive call to callback. Use this code from another process.
Posted: 01/28/2015 05:11:17
by saharan lv (Basic support level)
Joined: 01/25/2015
Posts: 4

Hi Vladimir , This is another exe not use callbackFilter.

@ Vladimir Cherniga can you test the code or give me a sample code.
This really not working.
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.



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