Can a program write to the root directory of a disk when UAC is turned on without having admin privileges?

江枫思渺然 提交于 2019-12-04 06:38:08

问题


If I am not an Administrator and start a program which writes to C:\ some textfile - will I need admin rights...in Windows 7 or Vista? I see in XP there are no problems to write to any folder including system32 - but I am not sure if a program in say .NET will be able to do that without admin permissions.


回答1:


That depends on whether C:\ is a filesystem that supports permissions, and if so on the permissions set on the root directory, which can be modified by users with the correct privileges. Use GetTempPath() for temporary files, or SHGetFolderPath passing e.g. CSIDL_APPDATA




回答2:


No, you can't write to the root of disk even in Windows XP if you are not an administrator. It's just everyone works as administrator in XP; and this assumption is actually wrong.




回答3:


Yes. You won't be able to write to C:\Program Files\ or C:\Windows\, but just the root drive C:\ is fine.



来源:https://stackoverflow.com/questions/5206673/can-a-program-write-to-the-root-directory-of-a-disk-when-uac-is-turned-on-withou

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!