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.