I'm using ShellExecute(NULL, L"open", szSomeDirectory, 0, 0, SW_SHOWDEFAULT)
to open a directory in explorer.
I'm trying to open a directory that I would normally be prompted with You currently do not have permission to access this folder.
and would give me option to get access and show a UAC prompt.
When I'm executing ShellExecute, Explorer gives me a error message saying Access Denied
.
My program is running with administrator privileges but that doesn't seem to matter.
How can I get access to open this folder?
Figured it out.
My user account didn't have access to the file.
My solution was to use AccessCheck
before ShellExecute
to see if I could access the file, and if I couldn't, use SetNamedSecurityInfo
to add an ACE for the logon user account with full access.