且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检测Windows资源管理器复制操作

更新时间:2023-02-04 14:48:52

是的,你可以。



您必须实现 shell extension 必须挂钩文件复制操作。有很多例子说明如何使用C ++(使用本机Win32 API)以及使用C#或其他.NET框架语言执行这些操作。我相信你也可以使用Delphi,但是我不知道制作Win32 API调用的细节。



这是一篇文章,详细介绍了在C#中实现一个简单的shell扩展



当然,您可能还需要查看Windows文件I / O过滤器,尽管它们只允许您观察文件操作,如创建,复制,更改或删除。在.NET中,使用系统创建文件I / O过滤器是微不足道的.IO.FileSystemWatcher类,如果您想要的是检测日志这样的文件复制操作,可能是您需要做的所有。



注意如果您决定在C#中实现shell扩展,则应该知道它只适用于已安装.NET框架的操作系统(您用于创建扩展名的版本) - 尽管大多数人现在至少具有.NET 1.1和2.0 ..


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.

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..