Hamumu Software Hamumu Software Hamumu Software
Password Register
Latest Journal update: Nov 2, 2017

Go Back   Hamumu Forum > General > General Blabber

Thread Tools Display Modes
Old 12-23-2015, 02:44 AM   #1
Question the trends!
REACTOR's Avatar
Join Date: Apr 2011
Location: Malaysia
Posts: 1,162
Question Writing An Installer From Scratch

Hello, I'm wondering whether there are any tutorials on writing your own windows application installer (it doesn't have to be graphical, it can be run using a terminal) in C?
REACTOR is offline   Reply With Quote
Old 01-01-2016, 01:37 AM   #2
Veteran Programmer
SpaceManiac's Avatar
Join Date: Oct 2007
Posts: 3,078
Default Re: Writing An Installer From Scratch

I don't know of and wasn't able to find any real tutorials on this, but from experience I can give you some starting information about the components of a full-featured installer:

1. Present a UI to allow choosing the install path
This is pretty easy if you've already admitted a console-mode installer is fine. In this case, you can just ask the user to type a path, or use a default one like "C:\Program Files\YourProgram".

2. Package the program and data inside the installer .exe file
This one is the most tricky, and there are lots of ways to do it. I can't provide a comprehensive reference, but here's an article describing the use of "xxd" and "ld" to embed data in a C program. If your installer installs multiple files, you'll have to do some extra work in managing them, by either including multiple binary blobs or including a single blob that's a zip file and extracting that (look up "self-extracting archives").

3. Copy the data from the .exe file into the install path
If you know how to write binary data to files, it's a simple matter of accessing the data you embedded in step 2 and writing the right data to the right files.

4. Add start menu or desktop shortcuts if the user chooses
Shortcuts are actually just normal files (with the extension ".lnk") that Windows interprets in a special way. It should be possible to find information about how to create shortcuts from a C program.

If you mean the installer to be serious rather than a learning experience, you should also:

4. Create an uninstaller and install it with the program
If your application is important enough to need an installer (rather than just a .zip file) it should really include an uninstaller too. This is usually a simple program that removes all the files and registry keys the installer created, and is installed by the installer.

5. Set Windows registry keys
Your installer should set the appropriate Windows registry keys so that it appears in the Windows "Add/Remove Programs" Control Panel screen, and can be uninstalled from there. Search around, there's information about this online.

I'm no authority on this topic, but I hope this has been helpful.
SpaceManiac is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I downloaded the Supreme With Cheese installer... a1125 Dr. Lunatic 5 07-26-2012 08:56 PM
Art and writing. fourwind General Blabber 0 07-06-2009 01:17 AM
Short Fuse installer question (Jamul, please) Julian Our Other Games 3 01-06-2008 05:38 AM
Scratch! The easiest programming language ever! ElMikkino Total Mayhem 10 10-16-2007 05:28 AM
Im writing a book...... regeneratorizer General Blabber 23 08-05-2006 03:04 AM

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.
Site Map
Copyright 2017, Hamumu Games Inc.