如何创建虚拟 Windows 驱动器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1096788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:47:17  来源:igfitidea点击:

How to Create a Virtual Windows Drive

.netwindowswinapivirtualdrive

提问by HyLian

I'm trying to create a Windows Virtual Drive ( like c:\ ) to map a remote storage. The main purpose is to do it in a clear way to the user. Therefore the user wouldn't know that he is writing/reading from another site.

我正在尝试创建一个 Windows 虚拟驱动器(如 c:\ )来映射远程存储。主要目的是以清晰的方式向用户进行操作。因此,用户不会知道他正在从另一个站点写入/读取。

I was searching for available products, and i find that FUSE is not an option in Windows and WebDAV maps directly the drive, and i would like to build a middle layer between windows and remote storage to implement some kind of services. Another alternatives exists, such as Dokan, that is very expensive, and System.IO.IsolatedStorage Namespace, that doesn't seem to explicity create a new Windows Drive.

我在搜索可用的产品,我发现Windows中没有FUSE选项,WebDAV直接映射驱动器,我想在Windows和远程存储之间建立一个中间层来实现某种服务。存在另一种替代方案,例如非常昂贵的 Dokan 和 System.IO.IsolatedStorage Namespace,它似乎没有明确创建新的 Windows 驱动器。

Probably pismo ( http://www.pismotechnic.com/) is the thing that mostly matches my requirements but I would know if there is another alternative, including some Windows ( C++ or .NET ) native API to do that.

可能 pismo ( http://www.pismotechnic.com/) 是最符合我的要求的东西,但我想知道是否有另一种选择,包括一些 Windows ( C++ 或 .NET ) 本机 API 来做到这一点。

Thanks for reading :)

谢谢阅读 :)

采纳答案by HyLian

As I see, there are several options to implement this.

正如我所见,有几种选择可以实现这一点。

The "native" one is creating a custom driver (.sys file) that intercepts the I/O operations. Microsoft calls it MiniFilter. This option is the toughest one but allows you full control.

“本机”正在创建一个自定义驱动程序(.sys 文件)来拦截 I/O 操作。微软称之为 MiniFilter。此选项是最难的选项,但可让您完全控制。

The coward's ;) option is to use a existing library to do this, examples of this are Dokan, GPL (dokan-dev.net/en), Pismo, free (www.pismotechnic.com) or Callback File System (www.eldos.com).

懦夫的 ;) 选项是使用现有的库来做到这一点,例如 Dokan、GPL ( dokan-dev.net/en)、Pismo、免费 ( www.pismotechnic.com) 或回调文件系统 ( www.eldos) .com)。

However if you don't have Windows as main target, you can use FUSE which is a pretty good option.

但是,如果您没有将 Windows 作为主要目标,则可以使用 FUSE,这是一个不错的选择。

回答by saulius2

If you (or someone else) still mind coding the driver itself, there are several opensource and working prototypes already:

如果您(或其他人)仍然介意编写驱动程序本身,那么已经有几个开源和工作原型:

回答by Jonathan

to use the SUBSTcommand in a script launched by your app could be an option.

在您的应用程序启动的脚本中使用SUBST命令可能是一种选择。

回答by Paul-Jan

You could write a Shell NameSpace Extension, allowing you to represent anythingas a drive (with subfolders, files, custom menus and whatnot), but you'd have to build all functionality from scratch. The upside is there are a lot of samples on the net, like thisone.

您可以编写 Shell NameSpace 扩展,允许您将任何内容表示为驱动器(包括子文件夹、文件、自定义菜单等),但您必须从头开始构建所有功能。好处是网上有很多样本,比如这个

回答by MMH

Have a look at this article. This is done using SUBST.exe present in Windows OS.

看看这篇文章。这是使用 Windows 操作系统中的 SUBST.exe 完成的。

http://code-in-action.blogspot.com/2013/11/create-virtual-drive-through-command.html

http://code-in-action.blogspot.com/2013/11/create-virtual-drive-through-command.html

回答by Umesh Joshi

回答by Eugene Mayevski 'Callback

Our Callback File System, as mentioned above, is a supported product with a comprehensive feature set, samples and support. We also offer free non-commercial licenses.

如上所述,我们的回调文件系统是受支持的产品,具有全面的功能集、示例和支持。我们还提供免费的非商业许可证。