Possible Duplicate:
Detect if program is running with full administrator rights
How to check what rights the user?
I need to chek write access to C:/Windows/SomeFolder
Possible Duplicate:
Detect if program is running with full administrator rights
How to check what rights the user?
I need to chek write access to C:/Windows/SomeFolder
The best way to do it is to write to that folder (i.e. create a file in there or whatever your end-goal is). If that fails, the error code should indicate what went wrong — you might not have enough rights or no disk space left etc. Checking for privileges before doing something is like asking if you can ask — it is always better to just ask. Not to mention the race condition where you could have rights to write and it's gone before you actually do write.