steenpat
asked on
Check directory for write access by current user
How do use MFC to check if the current user has write access to a directory?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I would like to comment that RevertToSelf is necessary at the bottom of this function otherwise it keeps running in the context of the client and this is undesirable. It caused issues with my application until I figured this out. I called RevertToSelf, and then CloseHandle(hToken) and this resolved issues.
if one of above functions failed, check error reason using GetLastError() API to get error code.
if(GetLastError() == ERROR_ACCESS_DENIED) // or if(GetLastError() == 5)
//means that access denied
as "Wayside"s comment: quick and dirty way ;)
Regards