StarSignLeo
StarSignLeo

Reputation: 266

Windows Media Center Application and UAC

I'm currently trying to write a Windows Media Center Application (Vista) that can restart a service with UAC enabled. Everything works fine when UAC is disabled but as soon as UAC is enabled I get an Access is Denied error.

I believe this is because the Window Media Center applications are running under the Windows Media Center process and as such would need to be started as Administrator for this to work. Does anyone know how I might achieve this with UAC enabled?

Upvotes: 1

Views: 243

Answers (2)

JohnnyJP
JohnnyJP

Reputation: 1246

You can mark your process as needing to be elevated by adding

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
   <assemblyIdentity version="1.0.0.0"  name="CheckForceElevation" type="win32"/>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
         <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator"/>
         </requestedPrivileges>
      </security>
   </trustInfo>
</assembly>

To the manifest.

Upvotes: 0

Mathew
Mathew

Reputation: 317

Check this out. Sounds like you'll need to flag the process to ask UAC for permission to continue:

http://technet.microsoft.com/en-us/magazine/cc138019.aspx

Upvotes: 0

Related Questions