Windows中是否可以将部分内存用作虚拟文件

发布于 2024-11-01 06:03:29 字数 112 浏览 1 评论 0原文

我正在使用命令行工具对文件进行一些处理。问题是这个文件不应该存储在磁盘上(安全原因)。所以我想知道在Windows中是否可以使用一部分内存作为虚拟文件,可以通过命令行工具访问它,就像它是一个真正的物理文件一样。

I'm using a commandline tool to do some processing on a file. The thing is that this file should not be stored on disk (security reasons). So I was wondering whether it's possible in Windows to use a part of memory as a virtual file that is accessible bu the commandline tool as if it was a real physical file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

后eg是否自 2024-11-08 06:03:29

是的,通常称为“ramdisk”的东西是可能的。 superuser.com 上的 Windows 上最好的 ramdisk 是什么? 有一些链接。

Yes, it's possible with things referred to as "ramdisks" usually. What's the best ramdisk for Windows? over at superuser.com has some links.

一场春暖 2024-11-08 06:03:29

您自己编写了命令行工具吗?如果是这样,您只需为程序分配一段内存并在处理中使用它即可。没有理由欺骗应用程序认为它正在使用物理磁盘上的文件。具体如何执行此操作取决于您的应用程序所使用的语言。

如果不是,您将需要创建一个 RAM 磁盘并告诉程序使用该磁盘。在 Windows 上使用 RAM 磁盘需要第三方软件; 超级用户提供了完整的选项列表。

但请注意,使用 RAM 磁盘或将所有数据存储在内存中都不会使其更安全。存储在 RAM 中的信息与保存在硬盘上的数据一样容易被窥探和恶意应用程序访问。可能比从硬盘删除的数据还要多。

Have you written the command line tool yourself? If so, you can simply allocate a section of memory to your program and use it in your processing. There's little reason to trick the app into thinking it's using a file on a physical disk. The specifics on how to do so depend on what language your app is written in.

If not, you'll need to create a RAM disk and tell the program to use that. Using a RAM disk on Windows requires third-party software; a comprehensive list of options is available here on Super User.

Note, though, neither using a RAM disk nor storing all of your data in memory will make it more secure. The information stored in RAM is just as accessible to prying eyes and malicious applications as data that is saved on the hard disk. Probably more so than data that has been deleted from the hard disk.

千と千尋 2024-11-08 06:03:29

如果您需要一个现成的应用程序,市场上有几个 ramdisk 应用程序(包括免费的),那么您在这里的问题就离题了。如果您需要在代码中执行此操作,请使用我们的虚拟存储产品之一(SolFS、 CallbackDisk(回调文件系统)将起作用,回调文件系统有一个在内存中存储文件的示例项目。

If you need a ready to use application, there are several ramdisk applications (including free ones) on the market, and then your question here is offtopic. If you need to do this in code, than one of our virtual storage products (SolFS, CallbackDisk, Callback File System) will work, and Callback File System has a sample project that stores files in memory.

黑色毁心梦 2024-11-08 06:03:29

如果您使用 .NET,您可以查看 内存流

不过,请注意科迪·格雷的回答,只要内存中存在某些内容并不能保证它不会受到损害,这个答案就太正确了。尽管在这个问题上意见不同。大多数人会认为写入磁盘更不安全,尤其是在磨损均衡时代,控制删除和不删除的内容实际上是不可能的。
RAM 有其自身的缺点,但从积极的方面来看,过去的就过去了:-)

If you're using .NET, you might look into MemoryStream.

Note Cody Gray's answer though, which is only too true insofar as having something in memory does not guarantee that it can't be compromised. Though opinions differ on this subject. Most people would argue that writing to disk is even less secure, especially in the age of wear-levelling where controlling what is deleted and what is not is practically impossible.
RAM has its own disadvantages, but on the positive side, what's gone is gone :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文