Rafik Bari
Rafik Bari

Reputation: 5037

How to compare between two executable files?

I have a file which doesn't require UAC Warning. I copied the file to another location using C#.NET

 File.Copy("Original.exe", "Copy.exe");

Now i see that Copy.exe require UAC warning to run under windows 7/Vista.

How can i compare between Original.exe and Copy.exe to see exactly what happened to the file and change it manually so that it doesn't require UAC anymore. Which tool can i use to achieve that ?

enter image description here

BOTH EXECUTABLE ARE THE SAME FILE : How to know the difference between these two files ?

Upvotes: 7

Views: 2953

Answers (3)

max
max

Reputation: 34407

Windows Installer Detection Technology is the reason of such behavior. There is a set of conditions which force executable file to be considered as requiring administrator privileges:

  1. 32 bit executables
  2. Applications without a requestedExecutionLevel
  3. Interactive processes running as a Standard User with LUA enabled

Before a 32 bit process is created, the following attributes are checked to determine whether it is an installer:

  • Filename includes keywords like "install," "setup," "update," etc.
  • Keywords in the following Versioning Resource fields: Vendor, Company Name, Product Name, File Description, Original Filename, Internal Name, and Export Name.
  • Keywords in the side-by-side manifest embedded in the executable.
  • Keywords in specific StringTable entries linked in the executable.
  • Key attributes in the RC data linked in the executable.
  • Targeted sequences of bytes within the executable.

Related MSDN article: http://technet.microsoft.com/en-us/library/cc709628%28WS.10%29.aspx

Possible solutions:

  • If you are the author of executable, include manifest with specified requestedExecutionLevel
  • If you don't have access to source code - try to add or modify manifest using appropriate utilities (mt for example or maybe some generic resource editor)
  • Avoid keywords update, install and setup in executable file name

Upvotes: 6

user844541
user844541

Reputation: 2958

Afte copying the file try to set the file's acl like that:

var file = new FileInfo("copy.exe")
 var fileSecurity = file.GetAccessControl();
 fileSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null),
                                                                FileSystemRights.FullControl,
                                                                AccessControlType.Allow));
 file.SetAccessControl(fileSecurity);

Upvotes: 1

DeanOC
DeanOC

Reputation: 7262

You may find that the problem is to do with the location rather than the file. Win 7 is very fussy, especially if you try and change anything under Program Files.

Have you tried putting the original file in the new location to check if that also required UAC approval?

Upvotes: 0

Related Questions