views:

899

answers:

2

I have a WinForms .NET app that, according to the Vista Task Manager with UAC enabled, runs with virtualization "Disabled" even though I do not recall adding a manifest with "asInvoker" to the app. VS.NET (this project has gone through all four versions of VS.NET) must have added the \Properties\app.manifest file I see in Solution Explorer, but this file does not contain the trustinfo element I would have expected to disable virtualization. So I fired up Reflector to see what might be embedded into my actual executable, but I cannot find the app.manifest file. Should I be able to find the manifest or signs of it in the executable? According to VS 2008, the build action is BaseApplicationManifest, but does this mean it is not embedded in the exectable? Can someone explain why my app runs with Virtualization disabled if I did not ask it to and, once explained, can someone point me to where I find the artifact that causes this in my app via Reflector?

As a followup to the app.manifest being in my solution for who knows how long, it is filled up with all kinds of IPermissions that I'm not sure I need any more. What adds content to this file and can it contain permissions I no longer need? Should it be pruned or managed? Should I explicitly add trustinfo to it? I guess app.manifest is just a mystery that I need to learn more about.

Update: From this article, I learned I can use the SysInternals/Microsoft Sigcheck utility to see the following info, but I have no idea how my app got signed with MyApplication.app. Where is this happening in the build process?

c:\Users\Public\Programs\SysinternalsSuite>sigcheck.exe -m ceo.exe

sigcheck v1.54 - sigcheck
Copyright (C) 2004-2008 Mark Russinovich
Sysinternals - www.sysinternals.com

"c:\Users\Public\Programs\SysinternalsSuite\ceo.exe":
        Verified:       Unsigned
        File date:      1:47 PM 2/6/2009
        Publisher:      CEO Image Systems
        Description:    Main Menu
        Product:        Image Executive CEO
        Version:        2.0.0.0
        File version:   2.0.0.0
        Manifest:
<?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="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

Update 2: Looks like I will get there eventually. VS 2008 added a Manifest option on the executable's project page for which my project has "Embed manifest with default settings" selected. So this answers how it got there, but how can I see this in Reflector?

+2  A: 

Maybe it is a win32 resource and therefore can't be seen by Reflector? You could see win32 resources with a win32 resource editor like this one.

Lars Truijens
Yup, it is an unmanaged resource, which VS.NET can display just by opening up the executable (thanks to nobugz on that one).
flipdoubt
+2  A: 

Reflector doesn't let you see unmanaged resources. You don't need a special tool, just use Visual Studio's File + Open and select your .exe to browse the resources.

The C# and VB.NET compilers automatically generate a Vista compatible manifest. You can override this with the /win32manifest command line option. Which is what the IDE will do automatically when you use Project + Add New Item + Application Manifest File.

Hans Passant
You definitely get +1 for saying I can use VS.NET to see unmanaged resources.
flipdoubt