禁用 UAC 虚拟化后恢复文件

发布于 2024-10-21 19:33:58 字数 254 浏览 1 评论 0原文

我们终于开始将软件的文档从程序自己的目录移到“我的文档”中。我们还在清单中添加了“requestedPrivileges”行,以防止虚拟化出现进一步的问题。

然而,如果我们只这样做,那么任何在 Vista/7 中运行旧版本的人都可能在更新后丢失隐藏 VirtualStore 目录中某处的工作。那么进入 21 世纪的首选方式是什么?

坦率地说,我对复制文件有点谨慎,特别是因为我似乎找不到一种获取影子目录的编程方式,但想必很多其他人在我们之前也遇到过同样的问题。

We're finally getting around to moving our software's documents out of the program's own directory and into "My Documents". We're also adding a "requestedPrivileges" line to the manifest to prevent further trouble with virtualization.

However if we only did that then anyone who had been running the old versions in Vista/7 is likely to lose their work somewhere within the hidden VirtualStore directory after updating. So what's the preferred way of migrating into the 21st century?

Frankly I'm a little wary of copying files around, especially as I can't seem to find a programmatic way of getting at the shadow directory, but presumably plenty of other people must have had the same problem before us.

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

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

发布评论

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

评论(1

欢你一世 2024-10-28 19:33:58

不要添加requestedPrivileges,除非您合法地需要管理权限才能使您的程序运行 - 您的描述中没有任何内容表明您这样做。 应该还允许您在第一次启动时简单地复制文件,就好像它们仍在程序目录中一样,因为任何虚拟化仍然有效。

但是,如果您绝对必须在不启用 UAC 的情况下进行迁移,则可以在 %LOCALAPPDATA%\VirtualStore\path\to\file 中找到您的文件。例如,如果您的文件存储在 C:\Program Files\OurApp\ 中,那么您将在 %LOCALAPPDATA%\VirtualStore\Program Files\OurApp\

要获取 %LOCALAPPDATA% 的路径,可以使用 SHGetSpecialFolderPath,其中 CSIDL_LOCAL_APPDATA 作为 CSIDL 参数。

Don't add requestedPrivileges unless you legitimately need administrative rights in order for your program to work - nothing in your description suggests that you do. That should also let you simply copy the files on the first boot as if they were still in your program directory, because any virtualization would still be in effect.

However, if you absolutely must do the migration without UAC enabled, you can find your files in %LOCALAPPDATA%\VirtualStore\path\to\file. For example, if your file would have been stored in C:\Program Files\OurApp\, you'll find it in %LOCALAPPDATA%\VirtualStore\Program Files\OurApp\.

To get the path to %LOCALAPPDATA%, you can use SHGetSpecialFolderPath with CSIDL_LOCAL_APPDATA as the CSIDL parameter.

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