One of the things that Valve's Steam distribution platform is known for is its Custom Executable Generation system, which creates a unique copy of a program for each person that buys it.

I'm sure that Valve isn't the only company or person to have implemented or thought of implementing such a system, however. If I wanted to try and roll my own system that generated executable files on the server side that are unique to the downloader or their account, what would I need to know how to do? What are the basics of such a system in the first place?

2 Answers 2


For purposes of discussion, I am assuming that your program is written in C, compiled on unix, and that there is a small amount of customization done (only changing compile time constants). We start with a template, lets call it customer.c.templ

#include "customer.h"
const char custname="$$custname$$";
const int custnum=$$custnum$$;

and we write a simple script to do substitutions, say markup.pl

#!/usr/bin/perl -p

and have our sales guys give us some customer data

custname="Billy Bob's Clam Shack"

and a simple little script:

. customer_data
markup.pl <customer.c.tmpl >customer.c
make customer.o
make a.out
mv a.out $custnum.exe

and there you go. custom binary.

  • That's not too far off from my intended use case, actually. Written in C++, though, not C.
    – Joe Z.
    Commented Dec 12, 2013 at 0:47
  • 1
    You might want to watch out, the string constants (especially) get funky when you start replacing them and misaligning data. Padding the data of a struct out to the appropriate size and replacing the entire thing once identified may be safer.
    – user40980
    Commented Dec 12, 2013 at 0:53
  • @michaelT +1 long time ago I came across a antivirus program that put a CRC into a 'special' unused part of DOS .exe files. Can't remember the details and don't know if it will work in a modern OS but it might be a better approach than recompiling the app (and presumably the installer) for every customer.
    – jqa
    Commented Dec 12, 2013 at 3:26

Often you can implement the same functionality in lightly different ways.

Thts assume you have n functions for each you have have 2 different implementations (which are not to be the same assembly after compiling), than you can create 2ⁿ versions of your executable with the same functionality.

You can vary this aproach by changing the order of independent assembly commands, using more than 2 vaiands to choose between ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.