Monday, November 24, 2008

patch.exe on vista - the workaround

Vista apparently thinks that any exe with 'patch' in it's name needs to be run with admin priviliges, probably to make a slew of pre-UAC install wizard patches work properly.

But this applies to good old unix:y 'patch' (which I have in windows-form) too!

Argh!

Update 2008-12-13: The patch.exe in the git-for-windows distribution (msysgit) seems to have the correct magic bits set to allow it to run without UAC getting in the way. So, try replacing your gnuwin32-patch (or whatever you're using) with that.

If that's not an option, here's how to do a workaround:




The trick is to rename patch.exe to pootch.exe (or whatever fancies you) and create a batch file call patch.cmd, with this content:

@"%~dp0\pootch" %*

That makes it work.

(I learn this when running the unit tests of buildbot, a pretty nice tool for distributing automated tests across compilers, computers & os:es!)

2 comments :

Johannes Schindelin said...

The way msysGit does it is to provide a manifest (patch.exe.manifest) telling Vista's UAC "No you do not have any business thinking that this program needs adminitrator privileges, just because it uses the name 'patch' which it has used _forever_."

I call it the Microsoft time tax, because whatever you do on Windows, you need to spend more time to get it working than anywhere else.

Macke said...

Ah. I didn't bother checking. :-P

I thought they had embedded the mainfest into the exe, which you can do with MSVS (project->properties->manifest).

Well, it's good to know you can apply this post-creation on any exe.