Windows 7 是否像 Vista 一样限制文件夹访问? [英] Does Windows 7 restrict folder access as Vista does?

查看:20
本文介绍了Windows 7 是否像 Vista 一样限制文件夹访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在我的应用程序中,大多数兼容性问题都是由某些文件夹的拒绝访问"引起的,例如:

I noticed that in my application, most compatibility problems were caused by 'access denied' for some folders, such as:

Application Data [C:ProgramData]
Desktop [C:UsersPublicDesktop]
Documents [C:UsersPublicDocuments]
Favorites [C:UsersPublicFavorites]
Start Menu [C:ProgramDataMicrosoftWindowsStart Menu]
Templates [C:ProgramDataMicrosoftWindowsTemplates]

Windows 7 和 Vista 有同样的问题吗?在 Stack Overflow 成员的帮助下,我知道在 Vista 上我可以使用 CSIDL_APPDATA 来启用文件访问,而不会出现 UAC 问题或拒绝访问"错误.这也适用于 Windows 7 吗?

Does Windows 7 have the same problem as Vista? With help from the members of Stack Overflow, I know that on Vista I can use CSIDL_APPDATA to enable the file access without UAC problems or 'access denied' errors. Is this also valid for Windows 7?

推荐答案

这不是一个问题",而是一个功能.它被称为 用户帐户控制 (UAC),这是在 Windows Vista 下加强系统安全性的方式之一.Windows 7 确实保留了类似的安全模型.

It's not a "problem", it's a feature. It's called User Account Control (UAC), and it's one of the ways that system security was tightened under Windows Vista. Windows 7 indeed retains a similar security model.

您的应用程序完全没有理由首先需要弄乱系统文件夹.正如您已经了解到的,Windows 为应用程序提供了许多临时和永久存储数据的位置.Microsoft 长期以来一直建议您利用这些文件夹:即使在以前版本的 Windows 下,它们也是存储数据的首选位置.事实上,你忽略了这个建议,但你的应用程序继续工作,实际上是错误.更高版本的 Windows 最终关闭了该安全漏洞,从而破坏了您的应用程序,这一事实既不应出乎意料,也不应受到重视.

There's absolutely no reason that your application should need to mess with system folders in the first place. As you've already learned, Windows provides a number of locations for applications to store data, both temporarily and permanently. Microsoft has been recommending for a long time that you take advantage of these folders: they were the preferred location for storing data even under previous versions of Windows. The fact that you ignored this advice, yet your application continued to work, was actually the bug. The fact that later versions of Windows finally closed that security vulnerability, thus breaking your application, should be neither unexpected nor unappreciated.

您可以在在此页面上找到有关数据存储位置的更多信息.另请参阅 这篇博客文章,它试图将一系列技术文档汇总到一个方便的表格中.和往常一样,Raymond Chen 提供了一个简单的,但具有启发性,概述了位置之间的差异:

You can find more information about where to store your data on this page. Also see this blog article, which attempts to summarize the array of technical documentation into a handy table. And as always, Raymond Chen provides a simple, yet instructive, overview of the differences between the locations:

我的文档和应用程序数据之间最重要的区别在于,我的文档是用户存储文件的地方,而应用程序数据是程序存储文件的地方.

The most important difference between My Documents and Application Data is that My Documents is where users store their files, whereas Application Data is where programs store their files.

换句话说,如果您在 CSIDL_MYDOCUMENTS(我的文档)中放入一些内容,您应该期望用户对其进行重命名、移动、删除、发送电子邮件对他们的朋友,用户对他们的文件所做的各种事情.因此,放在那里的文件应该是用户会识别为他们的东西"的东西.他们创建的文档、下载的音乐等等.

In other words, if you put something in CSIDL_MYDOCUMENTS (My Documents), you should expect the user to be renaming it, moving it, deleting it, emailing it to their friends, all the sorts of things users do with their files. Therefore, files that go there should be things that users will recognize as "their stuff". Documents they've created, music they've downloaded, that sort of thing.

另一方面,如果您在 CSIDL_APPDATA(应用程序数据)中放入一些内容,用户就不太可能弄乱它.这是您放置程序的支持数据的地方,这些数据并不是您真正希望用户弄乱的东西,但仍应与用户相关联.高分表、程序设置、自定义、拼写检查异常...

On the other hand, if you put something in CSIDL_APPDATA (Application Data), the user is less likely to be messing with it. This is where you put your program's supporting data that isn't really something you want the user messing with, but which should still be associated with the user. High score tables, program settings, customizations, spell check exceptions...

还有一个名为 CSIDL_LOCAL_APPDATA (Local SettingsApplication Data) 的目录,它的作用类似于 CSIDL_APPDATA,但它不会被复制,如果用户配置文件漫游.(本地设置"分支不会作为漫游用户配置文件的一部分进行复制.)将其视为每用户每机器的存储位置.缓存和类似的非必要数据应该保存在这里,特别是如果它们很大的话.非漫游每用户数据的其他示例是您的 %TEMP% 和 Internet 临时文件目录.

There is another directory called CSIDL_LOCAL_APPDATA (Local SettingsApplication Data) which acts like CSIDL_APPDATA, except that it does not get copied if the user profile roams. (The "Local Settings" branch is not copied as part of the roaming user profile.) Think of it as a per-user-per-machine storage location. Caches and similar non-essential data should be kept here, especially if they are large. Other examples of non-roaming per-user data are your %TEMP% and Temporary Internet Files directories.

这篇关于Windows 7 是否像 Vista 一样限制文件夹访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆