Sunday, April 12, 2009

Windows Vista, Manifests, and MinGW

"Mr. Max", who has been helping me with Windows-specific programming in Deadwood, pointed out that the correct way to have an application request for admin rights from Vista's UAC is to give the program a "manifest" that tells the UAC to do the make-the-screen-dark and ask-for-admin-rights thing.

However, doing some research, it looks like it's not possible to have the toolkit I use to build Deadwood, MinGW, add this manifest. The "manifest" the UAC looks for is meta-data in the .exe file; the tool to add this meta-data (mt.exe) is part of Microsoft's visual studio and I don't think Microsoft currently makes this a free download (they did a couple of years ago, but I think that program ended).

I should probably describe MinGW a little. MinGW is a set of programs that make a GNU (Linux-like) build environment available in Windows to make Windows applications. By using this toolkit, I can use the same source code and tools to build binaries both for Linux and for Windows. For various reasons I use an older version of this toolkit, and Windows Vista was only a glint in Bill Gates' eyes when the version of MinGW I use was released.

So, the toolkit I use to build Deadwood doesn't have a tool to add manifests for UAC. I don't think newer versions of MinGW do either; since MinGW is open-source software, software gets released when it is released and adding new features can be glacially slow.

The long and the short of it is this: I can't add a manifest to Deadwood.exe right now because I don't have the mt.exe tool to add this. I don't know how to download such a tool free and legally. I'm sure a version of it is avaiable over at TPB, but I don't want to go there for legal and ethical reasons (Yes, Microsoft's programmers should be compensated for their hard work).

So, for the time being, I will instruct Vista users to use the admin cmd prompt workaround to install Deadwood.