On Tue, 23 Feb 2010 22:57:30 +0200
Tor Lillqvist <tml@...> wrote:
> >> Run the program from cmd.exe and you will see a more helpful
> > I did and the program worked correctly!
> Oh? Even if it was called "patcher.exe"? I expected you to get a UAC
> (User Account Control) dialog in that case. ("Do you want to let this
> program from an unknown publisher make changes to this computer" or
> something like that.)
I just tried it and that's what happened. When you answer yes/allow,
the program works correctly.
> That is what happens for me, if I have a program called
> When run from MSYS I just get "Bad file number", from cmd.exe the UAC
> dialog. Possibly some caching is involved, if you have been renaming
> files back and forth Windows might be confused by now;)
> What a program *actually* does, what code it contains, is irrelevant
> for the triggering of the UAC dialog as far as I know, it is just the
> *name* that matters.
I didn't think the problem had anything to do with my code
(particularly, when a do-nothing program has the same problem).
> Note that if you have a program with some random
> "safe" name and it tries to do some "administrative" operations to
> computer, you won't get this dialog when you run it, but if you run
> without administrative privileges such operations won't succeed, of
> I.e. my point was that the name "patcher" makes Windows assume it is
> program that needs administrative privileges and thus Windows
> helpfully asks for permission to provide them to the program; for
> reason this doesn't happen when the program is run from the MSYS
> shell. Anyway, the way around this "useful" feature is to provide a
> .manifest file for the program that tells Windows that no privilege
> elevation is necessary (i.e. even if the program name contains
> it doesn't actually do anything that would require administrative
> The .manifest file should look like this:
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <assembly xmlns="urn:schemas-microsoft-com:asm.v1"
> <v3:trustInfo xmlns:v3="urn:schemas-microsoft-com:asm.v3">
> <v3:requestedExecutionLevel level="asInvoker" />
> and for patcher.exe, it should be called patcher.exe.manifest . I had
> to create such files for MSYS's install.exe and patch.exe back when I
> switched to Windows 7 from XP. (By now presumably MSYS presumably
> comes with manifests for these exes?) And also for a program called
> gtk-update-icon-info.exe for instance.
I never suspected the file name had anything to do with it. If that's
the case, then it seems easiest just to rename the file to something
that doesn't contain "patch".