WinXP和WinVista中都存在一个所有用户都具有写权限的文件夹吗? [英] Is there a folder in both WinXP and WinVista to which all users have writing permissions?

查看:92
本文介绍了WinXP和WinVista中都存在一个所有用户都具有写权限的文件夹吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个.NET应用程序,该应用程序已安装到Program Files文件夹中. 该应用程序本身会写入一些文件,并在其应用程序文件夹中创建一些目录. 但是,当普通Windows用户尝试使用我们的应用程序时,它会崩溃,因为该用户无权写入应用程序文件夹. WinXP和WinVista中是否都存在所有用户默认都具有写权限的文件夹?所有用户文件夹还是类似的东西?

We have a NET app that gets installed to the Program Files folder. The app itself writes some files and creates some directories to its app folder. But when a normal windows user tries to use our application it crashes because that user does not have permission to write to app folder. Is there any folder in both WinXP and WinVista to which all users have writing permissions by default? All User folder or something like that?

推荐答案

没有这样的文件夹.

但是您可以创建一个.

有CSIDL_COMMON_APPDATA,它在Vista中映射到%ProgramData%(c:\ ProgramData),在XP中映射到c:\ Documents and Settings \ AllUsers \ Application Data

There is CSIDL_COMMON_APPDATA which in Vista maps to %ProgramData% (c:\ProgramData) and in XP maps to c:\Documents and Settings\AllUsers\Application Data

可以在安装程序中随意创建一个文件夹并设置ACL,以便每个人都可以写入该文件夹.

Feel free to create a folder there in your installer and set the ACL so that everyone can write to that folder.

请记住,COMMON_APPDATA是在公共控件库的版本5中实现的,这意味着它在Windows 2000及更高版本中可用.在NT4中,您可以在安装目录中以及Windows 98及以下版本中创建该文件夹,因为这些系统始终没有权限系统,因此无论如何都没有关系.

Keep in mind that COMMON_APPDATA was implemented in Version 5 of the common controls library which means that it's available in Windows 2000 and later. In NT4, you can create that folder in your installation directory and in Windows 98 and below it doesn't matter anyways due to these systems not having a permission system anyways.

以下是创建该文件夹的一些示例InnoSetup代码:

Here is some sample InnoSetup code to create that folder:

[Dirs]
Name: {code:getDBPath}; Flags: uninsalwaysuninstall; Permissions: authusers-modify

[Code]


function getDBPath(Param: String): String;
var
   Version: TWindowsVersion;
begin
  Result := ExpandConstant('{app}\data');
  GetWindowsVersionEx(Version);
  if (Version.Major >= 5) then begin
    Result := ExpandConstant('{commonappdata}\myprog');
  end;
end;

这篇关于WinXP和WinVista中都存在一个所有用户都具有写权限的文件夹吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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