Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista General

Vista - Programmatically "elevate" my app for a particular task.

Reply
 
Old 11-07-2007   #1 (permalink)
Ricardo Vazquez


 
 

Programmatically "elevate" my app for a particular task.

Hi there!

I developed a MFC/VC++ 6.0 program that has to run at startup.
It monitors some Services which I also developed, giving the user
information on how they are running, and letting him or her start/stop this
Services.
The problem is that to start/stop a service I have to invoke ::OpenService
with SERVICE_START | SERVICE_QUERY_STATUS access: If I run the program as
administrator (elevated), then this works; but if I run it the standard way,
then the function returns "access denied".
I wouldn't mind to check the app so that it would always run as
administrator; but then, when I restart the computer, Windows Defender
"eats" my startup application: no elevated app can be placed at startup.
Windows Defender documentation then suggests to contact the software company
to see if they already have the same app with no need to have elevated
permisions!

A solution for me would be that my app starts as the standard user; BUT when
the person clicks on "stop sevice" UAC prompts him to approve the action!
This is: I would need to be able to programmatically get the UAC promt and
so elevate my app permisions from that moment on.
Is this possible? Which are the API functions I should need?
Can you think of any other solution to my problem?

Thank you very much!!

Cheers,

Ricardo Vazquez.
Madrid, Spain.



My System SpecsSystem Spec
Old 11-07-2007   #2 (permalink)
Robert Kochem


 
 

Re: Programmatically "elevate" my app for a particular task.

Ricardo Vazquez schrieb:
Quote:

> This is: I would need to be able to programmatically get the UAC promt and
> so elevate my app permisions from that moment on.
> Is this possible? Which are the API functions I should need?
May be this article helps you:

"Teach Your Apps To Play Nicely With Windows Vista User Account Control"
http://msdn.microsoft.com/msdnmag/is...lt.aspx?loc=en

Robert
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Task scheduler - redundant settings "Enabled" and "Stop task if... Vista General
Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" Vista General
Programmatically "elevate" my app for a particular task. Vista account administration
Programmatically "elevate" my app for a particular task. Vista security
When Vista "Explorer" freezes, cannot open task manager, who needs flip? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46