Windows Installer InstallAware for Windows Installer Header Image Windows Installer without Rocket Science

  InstallAware Blog


Online Serial Key Validation with InstallAware, the Code Part

Hi all! It’s been a few days since my last post about wrapping our update mechanism around your application and it’s time for some web server code samples; but first, I wanted to make an enhancement to the update script.

If we want to change our “Run Program As” commands, we’ll have to edit multiple parts of the update script. At best, this is tedious; typically it will introduce errors with forgotten or misplaced commands. The solution is simple: we’ll use the Label and GoTo Label MSIcode commands to create a re-usable region of code. This way, we’ll remove all pairs of existing “Run Program As” and “Terminate Installation” commands, replacing them with a GoTo Label command that points to a new “Label” called “RunProgramSection“, with the “Run Program As” and “Terminate Installation” commands underneath.


So now, instead of making changes all over the place in the MSIcode script, I only have to make one change under the Label command. That way, I can re-use this code block in other projects:

I can also build in more sophisticated behavior, adding more MSIcode commands. Lets say you want to run two programs – one might be a tray application and the other one the “real” application.

Quite easily done. Extensibility and scalability are everything these days!

And now for some server side code. First, please make sure you’re familiar with a server side scripting language like PHP or ASPX. Please visit and if you need a jumpstart. I’ll assume that you’ve done your homework and that you can follow the simple scripts provided below.

First some PHP. If you remember, I pass some parameters from my MSIcode InstallAware setup/client script to the web/server script as URL parameters. In PHP, URL parameters are stored inside a predefined variable called $_GET, which is a global array. If you want to read a user’s serial number and your parameter is called serial, you can try the following:

$serial = strip_tags($_GET['serial']);

Now, the PHP script variable $serial has our parameter’s value. Let’s see if the serial number provided is actually valid:

if ( CheckIfLegimitate($serial) )
return “1,”.srand(time());
return “0,”.srand(time());

If the serial is valid, the PHP script above returns “1″, or “0″ otherwise. Either way, the return value is appended with a comma delimited random number. Back on the InstallAware setup/client side, I read this value using the “Download File” MSIcode command, and I then parse it using Parse String; which lets me obtain both the status code (“1″ or “0″), and of course the random number.

Next post: Database schema scripts and more code. It’s going to be the last post from these series so, stay tunned!

Panagiotis Kefalidis
Software Design Team Lead
InstallAware Software Corporation

2 Responses to “Online Serial Key Validation with InstallAware, the Code Part”

  1. Percy Fleisner Says:

    obviously like your web-site however you have to check the spelling on several of your posts. Several of them are rife with spelling problems and I to find it very bothersome to inform the reality however I’ll surely come again again.

  2. Says:

    dߋkumentasi otоmatіs, trаnsfᥱr fіlᥱ,
    laρoгаn, dan tοқⲟҺ-toҝοһ daⲣat mᥱngսгаngі
    աaкtᥙ Ԁan սang үang ⅾіhаbіκѕκan untuк layanan ⲣеncetaқаn ԁаn mᥱmᥙngкіnkаn untսκ ᴡɑκtս maкsіmսm սntuк dііnvеstаsіҝan paԁa mеlɑқᥙκan ɦаⅼ-һɑl
    yаng рenting ⅾɑгі
    ҝlіen dаn ρᥱnjᥙаlɑn ѕᥙԁut
    рandɑng . Ꭰuniа
    aԁаlaɦ sеmᥙɑ tᥱntang реrⅾaɡangɑn, Ԁan ρdrɗɑցangan рeгⅼᥙ ԁibaуаг қеmƄɑlі, taρі ⲟսtѕоᥙrсing ⅼayanan ⲣеngеmкbаngan աeЬ mеmbаntu оrang ɗi ѕuԀսt үang ƅеrⅼɑwanazn ɗɑгі
    ɗսniа untᥙқ mеmƄɑүaг ɗеngаn instɑn .

    Տtrᥙҝtսг Рᥱгіncian Κеrϳa (WBՏ) аdɑⅼaɦ аlat mаnajеmen ρrоуᥱк үɑng ᥙmսm ⅾіցᥙnkan үаng mеmЬantu tim рrοуᥱҝ mеndaраtκan ⲣеmɑҺɑmɑn tеnntɑng beгbagɑі јеniѕ pеҝегjaаn yɑng ⅾіbᥙtuһкan սntսκ menyeⅼеѕаікan sᥱbᥙa ргоүеκ .

Leave a Reply