EldoS | Feel safer!

Software components for data protection, secure storage and transfer

FileMon not fire envnts

Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.
#18502
Posted: 12/17/2011 20:13:14
by Chanwoo Jung (Standard support level)
Joined: 12/17/2011
Posts: 5

I tested FileMon Sample with Delphi XE2.

All the cbfFilter...N events were fired.
but, cbfFilter...C events were not fired.

Did I mistake?
Let me know the basic usage of CallbackFilter.
I want to prevent copying, moving, deleting some file.
#18503
Posted: 12/18/2011 05:24:33
by Vladimir Cherniga (EldoS Corp.)

cbfFilter...C callbacks are not implemented in FileMon sample. You should add them manually. See the documentation for details.
#18584
Posted: 12/28/2011 09:43:58
by Chanwoo Jung (Standard support level)
Joined: 12/17/2011
Posts: 5

I coded "AddFilterCallbackRule" into your FileMon sample

Code
procedure TfrmMain.btnSetFilterClick(Sender: TObject);
begin
  cbfFilter.AddFilterCallbackRule('c:\temp\*.*',
    fltReadNotify or
    fltRenameNotify or
    fltDeleteNotify
  );
  cbfFilter.AttachFilter(0);
  cbfFilter.ReadWriteFileInPreCreatePath := false;
  cbfFilter.FlushFilesOnClose := false;
  UpdateAllButtons;
end;

procedure TfrmMain.cbfFilterCanFileBeDeletedC(Sender: TObject;
  FileName: TCBString; var DeleteFile: Boolean; var UserContext: Pointer;
  var ProcessRequest: Boolean);
begin
  AddToLog(Format('cbfFilterCanFileBeDeletedC %s', [FileName]));

end;

procedure TfrmMain.cbfFilterReadFileC(Sender: TObject; FileName: TCBString;
  var Position: Int64; Buffer: PByte; var BytesToRead: Cardinal;
  Cached: Boolean; var UserContext: Pointer; var ProcessRequest: Boolean);
begin
  AddToLog(Format('cbfFilterReadFileC %s', [FileName]));

end

procedure TfrmMain.cbfFilterRenameOrMoveFileC(Sender: TObject; FileName,
  NewFileName: TCBString; var UserContext: Pointer;
  var ProcessRequest: Boolean);
begin
  AddToLog(Format('cbfFilterRenameOrMoveFileC %s %s', [FileName, NewFileName]));
end;


But, I can't catch any event
Did I mistake?
#18585
Posted: 12/28/2011 10:34:29
by Eugene Mayevski (EldoS Corp.)

You have not enabled *C events -- see lines 4-6 of your code, only *N events are enabled there.


Sincerely yours
Eugene Mayevski
#18592
Posted: 12/29/2011 10:25:44
by Chanwoo Jung (Standard support level)
Joined: 12/17/2011
Posts: 5

OH~~
I just mistook the options.
thanks!
Also by EldoS: SecureBlackbox
200+ components and classes for digital security, signing, encryption and secure networking.

Reply

Statistics

Topic viewed 2053 times

Number of guests: 2, 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!