0

I'm having some trouble with my C# app that uses win32_networkingadapterconfig. The problem is that I can't use the altering functions in win32_networkingadapterconfig when I use the app on a user that dont have admin rights. I have tried to "run as administrator", but no luck. And I have tried to make a manifestfile with this content in the trustInfo part:

<security>
  <applicationRequestMinimum>
    <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
    <defaultAssemblyRequest permissionSetReference="Custom" />
  </applicationRequestMinimum>
  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">

    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

  </requestedPrivileges>
</security>

Enable clickone security settings are set to full trust. What am I doing wrong ?

Robert MacLean
  • 38,975
  • 25
  • 98
  • 152
Oppermann
  • 3
  • 1
  • 1
  • 3

2 Answers2

4

There's a "trustinfo" dangling in your snippet. Make it look like this:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</asmv1:assembly>
Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Yeah that was just a c/p fail when I had to add it here, sorry! – Oppermann Dec 05 '09 at 02:28
  • I'm pretty sure Windows also won't allow you to redirect standard input/output/error across the admin/non-admin security boundary. You'll have to find a different way to get output from the program running as admin - Reference: http://stackoverflow.com/a/8690661 – Kiquenet Aug 28 '14 at 09:20
  • 1
    Well, that would be one reason to want to use a manifest like this of course. – Hans Passant Aug 28 '14 at 09:24
2

There are a number of possible issues which I have listed in the order I suspect is most likely to less likely.

Possible Problem 1
What are your UAC settings? As detailed in Create and Embed an Application Manifest (UAC) if you have UAC disabled and you request administrator permissions the

Application might launch but will fail later

Possible Problem 2
There could be something wrong else where in the manifest as the assembly information is required. Posting your whole manifest would help.

Possible Problem 3
You have added the applicationRequestMinimum node which is not required for UAC escalation. It may be worth dropping that and trying again.

Robert MacLean
  • 38,975
  • 25
  • 98
  • 152
  • I'm pretty sure Windows also won't allow you to redirect standard input/output/error across the admin/non-admin security boundary. You'll have to find a different way to get output from the program running as admin - Reference: http://stackoverflow.com/a/8690661 – Kiquenet Aug 28 '14 at 09:28