Windows Media Center Application and UAC

248 Views Asked by At

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?

2

There are 2 best solutions below

0
On BEST ANSWER

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

0
On

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.