I’ve developed a videogame some time ago, when WinXP were the current Windows version. The game needed to install its own font to the system if it wasn’t already present. I don’t remember how exactly I went about that in the code, I think I either used a specific WinAPI function, or I simply copied the font file into the Fonts folder – either way, it worked OK at the time.
However, when someone runs the game on Win7 now, the game cannot install the font unless the user runs it as an administrator. The game works, but uses a horrible default font instead, so as the result the user doesn’t even realise that something’s wrong and just thinks that the game looks terrible.
So what I need is to make the exe file always demand to be run as an administrator. I could recompile the game and setup the build so that the exe file would always demand the administrator rights, but I don’t have some of the SDKs that I’ve used anymore and so a rebuild would probably be somewhat difficult.
So what I would like to do is: Can I simply modify the .exe file somehow, without the source code, so that it would always demand to be run as an administrator?
I’ve found that I would need to put this in the manifest:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
but can I edit an exe file’s manifest? I’ve tried XN Resource Editor that I used to work with the resources, but that doesn’t seem to be able to edit the manifest.
Is it possible to do this?
Thanks.
You can create the manifest as an external XML file, and put it in the same folder as your executable. Name it
YourAppName.exe.manifest(replacing the obvious with your actual executable name, of course), and it should work just like an embedded resource.An example of the external file: