Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 7 - Displaying "Access denied" message when user tries to save file to a protected folder rather than save in virtual store

We want to restrict files being saved to the virtual store in Vista/Windows 7 if the user tries to save files from our application to a protected folder such as "Program files" - we want an "Access Denied" message displayed if the user tries to do this. Is there a way to do this from our Delphi 2009 app similarly to what MS Word etc. do?.

Thanks very much,

Paul

like image 354
PPower Avatar asked Sep 08 '10 23:09

PPower


People also ask

How do I fix access denied folders in Windows 7?

Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.

Why do I get an access denied message?

“Access Denied, you don't have permission to access (URL) on this server.” It prevents you from opening some specific websites on your browser. There could be several reasons behind this error like the server being taken down, VPN access could be blocked on that server, etc.


1 Answers

If you make your application "UAC aware", Windows will disable registry and file virtualization for your application. The OS will then return errors if your application tries to write to a protected area and the process does not have elevated admin rights.

You can do this by adding a manifest that requests a requestedExecutionLevel. There are numerous articles online that describe this process. Here are a couple of good ones:

Making Your Application UAC Aware http://www.codeproject.com/KB/vista-security/MakingAppsUACAware.aspx

UAC Virtualization – Allowing standard users to update a system protected area http://blogs.technet.com/b/mrsnrub/archive/2010/08/11/uac-virtualization-allowing-standard-users-to-update-a-system-protected-area.aspx

like image 133
Jon Robertson Avatar answered Oct 14 '22 23:10

Jon Robertson