简体   繁体   English

使用.NET在Windows XP和Vista上读取使用中的文件和系统文件

[英]Reading files in use and system files on Windows XP & Vista using .NET

I have this idea for a free backup application. 我有一个免费备份应用程序的想法。

The largest problem I need to solve at the moment is how to access files which are being used or are system files. 我目前需要解决的最大问题是如何访问正在使用的文件或系统文件。 I would like the application to be able to perform a full backup of files (ie not on a disk sector by sector level). 我希望该应用程序能够执行文件的完整备份(即不在扇区级别的磁盘扇区上)。

I'll turn the server part of the application into a service. 我将把应用程序的服务器部分变成服务。 First of all this service will need to be run with administrative privileges I guess? 首先,我猜该服务需要以管理权限运行吗? And secondly, is it possible to access locked files and files used by the system? 其次,是否可以访问锁定的文件和系统使用的文件? Maybe take those files after the next reboot? 也许在下次重新启动后获取这些文件? (I've seen some anti virus applications work that way.) (我已经看到一些反病毒应用程序可以这样工作。)

I will use C# and the .NET platform, as it seems to be the easiest way to develop Windows applications these days. 我将使用C#和.NET平台,因为这似乎是当今开发Windows应用程序的最简单方法。

What you're looking for regarding the files in use is the " Volume Shadow Copy Service " which is available on Windows XP, Server 2003 and above. 关于正在使用的文件,您正在寻找的是“ 卷影复制服务 ”,该服务可在Windows XP,Server 2003及更高版本上使用。 This will allow you to copy files even when they are in use. 这将使您即使在使用文件时也可以复制文件。

I have found a CodeProject article " Volume Shadow Copies from .NET " which describes a simple Outlook PST backup application written against Volume Shadow Copy. 我发现了CodeProject文章“ .NET的卷影副本 ”,该文章描述了针对“ 卷影副本 ”编写的简单Outlook PST备份应用程序。

Do a Google on HoboCopy. 在HoboCopy上做一个Google。 It is an open source backup tool for windows that can backup files that are in use using Windows Volume Shadow Service. 它是Windows的开源备份工具,可以备份使用Windows Volume Shadow Service使用的文件。

Nothing in .NET that could do that directly AFAIK. .NET中没有什么可以直接做到这一点的。

I think you are looking for Volume Shadow Copy on XP/Vista which is designed for this kind of task. 我认为您正在XP / Vista上寻找用于这种任务的Volume Shadow Copy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM