Click here to Skip to main content
15,610,563 members
Articles / Programming Languages / C++
Posted 31 May 2013

Tagged as


6 bookmarked

IPDefend Toolkit plugin for Code::Blocks IDE

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
31 May 2013CPOL3 min read
Short guide to create licensed applications using the Code::Blocks IDE incorporating the IPDefend Toolkit plugin.

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.


This guide is aimed to make introduction to IPDefend Toolkit plugin for Code::Blocks IDE. His purpose is to allow for users of this excellent IDE to create licensed binary images such as EXEs, DLLs and native plugins for this IDE.

The Code::Blocks IDE 

For those who are not familiar or never heard about Code::Blocks IDE is an open source IDE for software development written in C++ using wxWidgets library.


Till nowadays was this IDE lacking of capability to enable creation of licensed executable images in easy way. We decided to change this and have create simple plugin + necessary supporting tools.  Here described solution does not require strict usage of this IDE but it is more comfortable than using raw command line version only. Binaries required for this framework found at Code::Blocks website and IPDefend Toolkit plugin website.

The IPDefend Toolkit 

is a wizard class plugin. The Code::Blocks IDE allows to extend his capability via plugins. The wizard class plugins are helpers which can build basic skeletons of build targets. You can create skeletons for these binary images:

Image 1
Console application
Image 2
Win32 GUI application
Image 3
wxWidgets application
Image 4
Dynamic linked library
Image 5
Code::Blocks plugin

Step by step 

In present discussion some steps of the wizard are intentionally skipped and we focus on those that relates to licensing part.

First prerequisite is that Code::Blocks IDE and IPDefend Toolkit are already installed. When this is met initiate new project creation via menu bar. 

IPDefend Toolkit step

Image 6

Product ID:

Unique identifier of your application for licensing system

Default features:

This field has custom format and must be parsed by the target application. Its intent is to enumerate features provided by the license. As his caption describes it is used only when otherwise not specified.

Default expiration:

Number of days license is valid. This is also default value and used only when otherwise not specified during license data generation.

Registry key:  

All licenses are saved in the Windows registry.  Key to which registry path relates.  User can select between HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER.

Registry path: 

Path to registry location where license information is stored. 

Naturally we people want always everything to change.  Way to for updating these information is leads via project/target options

Image 7

Here we must make mention about Encryption keys Update checkbox. This updates license data encryption keys stored in license template file so as is written in red text older releases will not recognize licenses created after this update.

The license dependence

Most important part of licensed application is make some parts of target code license dependent. To achieve this we use blocks of code that are specially marked for example:   

if(ipdValidateLicense() == 0)

    if(ipdGetLicenseInfo(LT_CUSTOMER, &info) == 0)
      customer = wxString::From8BitData((const char *)info.value, info.length);
      customer = _T("could not get customer info");

    days = ipdGetExpiryDays();
    if(days == 0)
      expiration = _T("has expired");
    else if(days < 0)
      expiration = _T("expires never");
      expiration.Printf(_T("expires in %u days"), days);


                customer.c_str(), expiration.c_str());
      // hide license entry controls
      wxSizerItem *item = GetSizer()->GetItem(4);

The licensed blocks markers are:

  • IPD_CRYPT_START - start of licensed block
  • IPD_CRYPT_END - end of licensed block 

Blocks marked in this way are encoded by ipdconde.exe tool. When execution enters into such block then the licensed code is decrypted before execution and encrypted after it.

These markers must be surrounded by  

if(ipdValidateLicense() == 0)

  // the licensed code goes here


to prevent execution attempt for case when there is no license present or it is invalid. Use as much as you need of these blocks. The IPD_CRYPT_START and IPD_CRYPT_END in non-encoded (plain) file acts as empty command ; in C/C++. To utilize effect of licensing/protection the plain file must encoded with ipdencode.exe tool. This is appended to target post-build step:

Image 8

The license data

are used to active certain features in your target file. These data consists from serial number and key. To obtain these data use ipdlicgen.exe tool at command line or integrate provided ipdlicgen CGI version with your web server to automate the license generation process.

License entry dialog

Your software must be equipped with license data entry interface which can for example look like this:

Image 9

Points of Interest

Why does Windows still need the MS-DOS header? One can think this is some obsolete part of file but the OS makes funny things inside it when a process starts.


  • 2012/8/21-1.0 
  • 2013/5/31-1.1


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
Slovakia Slovakia
Code::Blocks developer, wxWidgets developer, Debugger developer, Embedded developer, Hardware engineer, Amiga fan, FPGA developer, Video card developer

Comments and Discussions

-- There are no messages in this forum --