do run control panel applet administrator

How do I run Control Panel Applet as Administrator.

Ok, I have a control panel applet that has a legitimate need to run as administrator. Via WMI it needs to write to settings to registry hive HKLM for an associated service. When I run it under a normal administrator account I get an 'Access Denied' error.
No problem, I'll just create a manifest and set the requireAdministrator requirement as follows:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity processorArchitecture="x86" version="3.0.16.0" type="win32" name="myapp.cpl"/> <description>My Application control panel applet</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86"/> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="true"/> </requestedPrivileges> </security> </trustInfo> </assembly>
Well, no dice! Now I get an error popup that reads 'Illegal value: requested run level'!!! What gives? I expected the LUA to prompt me about allowing elevation, but no such luck! Is this thing brain dead or am I? There doesn't seem to be a way around this. --------------------------------------------- Jean Cyr - Dillobits Software jcyr@dillobits.com - http://www.dillobits.com

On Mon, 03 Jul 2006 23:19:11 -0400, Jean Cyr wrote:

Well, no dice! Now I get an error popup that reads 'Illegal value: requested run level'!!! What gives? I expected the LUA to prompt me about allowing elevation, but no such luck! Is this thing brain dead or am I? There doesn't seem to be a way around this.

Follow up: Tried the CoCreateInstanceAsAdmin approach on the WMI locator object. No joy... The object doesn't support elevation. As a last ditch attempt to get past this roadblock and move on with further debugging I tried creating a patch using the Compatibility Administrator. Bump... doesn't elevate CPLs.
At
this point development is dead in the water for Vista preparations. Hope MS will see fit to clearing this up soon. :-(

IIRC, a cpl is just a DLL and runs in the control panel process, thus you can't elevate it. You need to rewrite (or separate the admin parts) as an exe or other external process that UAC can elevate.
"Jean Cyr" wrote in message

On Mon, 03 Jul 2006 23:19:11 -0400, Jean Cyr <jcyr@dillobits.com wrote:
Well, no dice! Now I get an error popup that reads 'Illegal value: requested run level'!!! What gives? I expected the LUA to prompt me about allowing elevation, but no such luck! Is this thing brain dead or am I? There doesn't seem to be a way around this.
Follow up: Tried the CoCreateInstanceAsAdmin approach on the WMI locator object. No joy... The object doesn't support elevation. As a last ditch attempt to get past this roadblock and move on with further debugging I tried creating a patch using the Compatibility Administrator. Bump... doesn't elevate CPLs.
At this point development is dead in the water for Vista preparations. Hope MS will see fit to clearing this up soon. :-(

Chris Altmann wrote:

IIRC, a cpl is just a DLL and runs in the control panel process, thus you can't elevate it. You need to rewrite (or separate the admin parts) as an exe or other external process that UAC can elevate.
There's an program called 'RunLegacyCPLElevated' that is essentially an

elevated rundll32 (you call it with the same parameters). I just put in an elevate button that reruns the cpl using that.. it'll do for the betas until MS put in a proper mechanism.
Tony

Windows Vista

Topic:


Nick: