Sign in to follow this  
Conoktra

Windows - Custom Installer in C++

Recommended Posts

Conoktra    144
Hello!

I am developing a video game, and am required to develop a web-based installer for said game. I have created a C++ application that is capable of downloading and extracting any number of archives to any number of locations (such as the Program Files folder). It is also capable of placing start menu and desktop links, and removing previous contents from extraction locations. Here is a screenshot: [url="http://img20.imageshack.us/img20/5013/installerss.jpg"]Click[/url].

The one thing I have left to implement is registering the program with Windows via the registry. On Windows XP this isn't even required, but on Windows 7 (and likely Vista) it complains that the program didn't properly install--and I suspect its because I am not registering it in the registry.

Does anyone know the process or procedure to go about registering a program with the Windows registry? Tutorials and/or code would be great if available =).

Thanks.

Share this post


Link to post
Share on other sites
lonewolff    1183
This is almost certainly a UAC permission thing.

You can trigger trigger UAC from within your application using a manifest file.

Something like;

[code]<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="UacDemo" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>[/code]
This way when you install the program it will give you the windows security popup box that was introduced in Vista. I am pretty confident this is why the app doesn't install correctly.

To confirm this, you can install your program using 'run as administrator'. If that works then this is definately the cause of the problem.

Share this post


Link to post
Share on other sites
Conoktra    144
lonewolf: Thank you! You solved my problem by pointing me in the right direction. Thanks so much :D.

Turns out it wasn't an issue with permissions, but instead an entry in the manifest that said Windows 7 was a supported OS. For those who also encounter this problem, add this to your programs manifest:



[code]<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="UacDemo" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>[/code]

Share this post


Link to post
Share on other sites
Amr0    2230
Curious. So all native programs which don't have a manifest which tells the OS that Vista and 7 are supported will cause the OS to raise such a complaint? Or is such a manifest required only if the application performs some specific operations like manipulating the registry?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this