bmatzelle / gow

Unix command line utilities installer for Windows.
https://github.com/bmatzelle/gow/wiki
6.58k stars 365 forks source link

install.exe and patch.exe require the administrator privilege on Windows 7 #156

Open yjfvictor opened 10 years ago

yjfvictor commented 10 years ago

When you type install or patch command, the UAC dialog pops up to request for the administrator privilege, because Windows 7 thinks that any executable file including "install", "patch", "update" within its filename is a installer and therefore the administrator privilege is required. Please fix this bug.

yjfvictor commented 10 years ago

Solution

The solution is to write a manifest file listed below for the executables, in order to persuade UAC that it does not require administrative privilege.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <!-- Make sure that UAC believes
        that it does not require administrative privilege -->
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

The filenames of the manifest files should be install.exe.manifest and patch.exe.manifest, and then put them in the same folder as install.exe and patch.exe.

If the UAC prompt still pops up, change the timestamp of install.exe and patch.exe to persuade Windows to pick up the new manifest file.

iongion commented 9 years ago

created the manifest but an error appears afterwards: The requested operation requires elevation

iongion commented 9 years ago

Just placing the manifest is not enough, as explained here: http://math.nist.gov/oommf/software-patchsets/patch_on_Windows7.html

yjfvictor commented 9 years ago

Creating a manifest file is enough. The mt.exe command is not required. You can release two files. The mt.exe is just for someone who really wants to release only one single file.

What you need to do for prevent The requested operation requires elevation is to let the last modified time of the executable later than the manifest file. You can type touch patch.exe to update the last modified time of the executable.

Embedding the manifest file in the executable file via mt.exe is an alternative way, which can reduce the problem of the last modified time.