Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect Windows Explorer copy operation

Is there any way to detect whenever a copy operation starts in Windows Explorer.

kind of like in SuperCopier : SuperCopier Website ?

and log files involved in the operation ? and such ?

I've browsed through Supercopier code and I can't find the part which deals with detecting the copy operation, as I'm not fluid in Delphi.

P.S : it seems they are using a Shell Extension ...not sure though.

like image 754
Attilah Avatar asked Oct 18 '09 17:10

Attilah


2 Answers

Yes, you can.

You have to implement a shell extension which has to hook the file copy operation. There are plenty of examples of how to do these things in C++ (using the native Win32 API) and also using C# or other .NET framework languages. I'm sure you can use Delphi too but I don't know the details involved in making the Win32 API calls..

Here's an article which details the implementation of a simple shell extension in C#.

Of course, you may also want to take a look at windows file I/O filters, although they only allow you to observe file operations such as creating, copying, changing or deleting. In .NET creating a file I/O filter is trivial using the System.IO.FileSystemWatcher class and if all you want is to detect and log such file copy operations it may be all you need to do.

NOTE If you decide to implement a shell extension in C#, you should know that it will only work on operating systems where the .NET framework has been installed (the version that you used to create the extension) - although most people now have at least .NET 1.1, and 2.0..

like image 80
Mike Dinescu Avatar answered Oct 12 '22 06:10

Mike Dinescu


Examples of creating a copy hook shell extension can be found in the installation delphi folder \Demos\ActiveX\ShellExt\copyhook.dpr

Here you have another additional example

  • A Copy Hook for Pascal Files

Bye.

like image 38
RRUZ Avatar answered Oct 12 '22 06:10

RRUZ