Click here to Skip to main content
11,928,569 members (50,164 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ MFC

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 5-Dec-12 17:58pm
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100