I have a .net program that requests admin privileges by default whenever I try to run it. I don’t know of any reason it NEEDS these privileges in my specific case, so I simply suspect lazy programming behind it (enforcing admin acces just in case it might eventually need it).
Is there any way I can force it to not try to elevate and run with the regular access rights? E.g. by modifying the embedded manifest or through some programmatic ways?
Running a regular app as administrator is pretty trivial, but is the reverse even possible?
Update:
I only have access to the compiled .exe, not to the source code or original manifest file. I’ve had a look at the embedded manifest of the .exe through ManifestView by Kenny Kerr and it definitely requests admin privileges as it includes the following:
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" />
</requestedPrivileges>
Is there any way to change the manifest of a compiled .exe assembly? E.g. any tool around to do that or info about how to do that programmatically?
I tried to create a small C# app to modify the embedded manifest so it wouldn’t request admin privileges. This is the solution I finally came up with, making a bunch of Win32 calls to extract the manifest and replace an existing manifest. It’s already long enough, so I omitted the part where I actually modify the manifest (just some basic XML operations).
There are two static methods here: LoadManifestResource, which loads the string representation of the embedded manifest of an executable and SaveManifestResource, which saves the string representation of a manifest resource in the specified executable, overwriting the old one.
This is a quick and dirty solution which worked just fine for me, but might very well not work in every case.