If you downloaded the
Xmas edition of the XsX cursor package on Xmas day, you most likely downloaded a file named
xsx-alphablendedcursors-v1.1.exe. I fixed this soon after by editing the original blog post and filename to
xsx-alphablendedcursors-setup-v1.1.exe. You might be wondering why I would do something like that.
The main reason is due to UAC heuristics built into Vista. If you launch a program with "install" or "setup" somewhere in the name of the executable, most of the time Vista will ask you if you would like to run the program with elevated rights. I say "most" of the time because application builders can override this behavior if they want, which brings me to the overall reason of this post.
If you ran the original Xmas release as a standard user under Vista, the installation of the cursors would fail due to a lack of permissions to write to
%windir%\Cursors.
Even though UAC heuristics are nice, if you rename the package to not include 'setup' in the filename, we are back the original issue. I figured I would use this as an opportunity to show people how to fix the problem a better way.
You can create a .manifest file to describe to the OS how to handle executables, among other things. Some people might remember using .manifest files to enable XP themes under XP for non-XP programs. With Vista, you can also tell the OS if the program needs administrative rights or not.
I wanted to keep everything wrapped up as single package, and I didn't want people to have to download more than one file. Instructing people to download a .manifest file didn't appeal to me. Thankfully, you can embed the manifest into the executable by using a program that is included in the Windows SDK, called
mt.exe.
I was able to embed the manifest by running
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe" -manifest xsx-alphablendedcursors-v1.1.exe.manifest -outputresource:xsx-alphablendedcursors-v1.1.exe
The path to mt.exe will change depending on what version of the SDK you have installed. In my case, I have the
Vista SDK (v6.0A) installed.
Using
Resource Hacker, you can see that mt.exe has inserted the manifest file as a resource inside the executable.
As of a few days ago, I updated the v1.1 executable package to include the manifest file, so that normal users under Vista will be prompted for elevation properly, even if the setup file is renamed.
Hopefully people will find this information helpful, because you can use this technique as a 'shim' for abandoned/unsupported applications under Vista without using the
Application Compatibility Toolkit (ACT).
If you want to read more about this or see other examples, check out the sites
here,
here and
here.