Click here to Skip to main content
15,878,809 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello,

I have developed an MFC application to write in to the registry to disable few applications.It works fine when i logged in to a administrative system.But fails when i logged in to the system as a Standard user.

I even have changed the UAC Execution Level to requireAdministrator in my visual studio project properties.But still iam facing the same issue.Kindly can any one help me to solve this.

Thanks in Advance.
Posted
Comments
Albert Holguin 6-Dec-12 0:04am    
If I remember correctly, configuring the UAC setting in studio should be the only change you need. Did it come up and ask you if you allowed the application to run with elevated privileges when you ran it? Does it give you any errors?

1 solution

Unless you provided credentials or are actually logged in as an adminsitrator, then the account does not have permission to write those registry keys.

You can in your own program indicate that you need to write to a restricted area, ask the user for some credentials, login from your application and impersonate that user, write to registry, and then revert back to original self.

Otherwise, you can check for the registry open error to be access denied and politely tell user they must be an adminsitator to perform such funtion from within your program.

That's why it is called security - user accounts without permission don't write there.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900