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
0 thatraja 395
1 Sergey Alexandrovich Kryukov 295
2 Gihan Liyanage 261
3 kbrandwijk 204
4 CPallini 190
0 OriginalGriff 793
1 Sergey Alexandrovich Kryukov 604
2 Dnyaneshwar@Pune 604
3 Kornfeld Eliyahu Peter 530
4 thatraja 440


Advertise | Privacy | Mobile
Web02 | 2.8.140902.1 | Last Updated 20 Dec 2012
Copyright © CodeProject, 1999-2014
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