Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++MFC
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 5-Dec-12 16:58pm
Comments
Albert Holguin at 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
good
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.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 600
1 Tadit Dash 295
2 Sergey Alexandrovich Kryukov 250
3 Peter Leow 190
4 OriginalGriff 158
0 Sergey Alexandrovich Kryukov 9,395
1 OriginalGriff 5,473
2 Peter Leow 4,150
3 Maciej Los 3,540
4 Abhinav S 3,333


Advertise | Privacy | Mobile
Web02 | 2.8.140415.2 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid