# Integrating to application

In the several steps described below we will create a test application that queries the licensing system: provides serial numbers to it, receives the status of a serial number and its contents. On the first stage, we use the license system in the test mode; one the second stage we use it as it would be used in actual practice.

Work modes of the licensing system

Building protection always goes through two main steps: development and release. As for licensing, at first you create an application, integrate protection into it, then add checks and functional limitations. And only after thorough testing you can make the product available to users and begin the second stage. Testing of a protected application is a complex process, because you need to make sure all checks and conditional jumps operate correctly. Making "real" serial numbers for all possible test cases is inconvenient. That is why the licensing system offers the "developer mode" (AKA "test mode") as well. In this work mode, no protection is applied to the app, and reaction of the system to supplied serial numbers is adjusted in the configuration file. When the application is free from bugs and it correctly works with the licensing system, VMProtect replaces the "test" licensing module with the real one that do perform real serial number checking. This is done when the application is protected, so you can't avoid this step by mistake.

Stage 1: Test mode

In the test mode, all reactions of the licensing system (statuses and data it returns) to supplied serial numbers is described in the configuration file. The file is called VMPLicense.ini and should be located in the working folder of the application. In 10 steps provided below we will go from creating the simplest application to full-featured use of the licensing system in the test mode with hardware locking and limiting the period of free upgrades.

- Step 1.1: Creating a protected application
- Step 1.2: Adding the license checking code
- Step 1.3: Retrieving serial number status flags
- Step 1.4: Retrieving the name and the e-mail of a user
- Step 1.5: Checking the expiration date of the serial number
- Step 1.6: Limiting the operation time of the program
- Step 1.7: Limiting the free upgrades period
- Step 1.8: Serial numbers in the black list
- Step 1.9: Hardware lock
- Step 1.10: User data

Stage 2: Real mode

In the real mode VMProtect licensing system puts a special licensing module to the protected application. This module carries out the same functions as the test one in the SDK, but works with contents of a serial number instead of the configuration ini-file. The next five steps illustrate the process of protecting a simple application with a full-featured protection based on VMProtect and the licensing system.

- Step 2.1: Creating a new protected application
- Step 2.2: Creating a VMProtect protection project
- Step 2.3: First start of the protected product
- Step 2.4: Testing the results
- Step 2.5: Locking the code to a serial number

Additional information

Values of all bit flags, structure formats and function call parameters can be found in the Licensing system API section of this help file. Use this section as a reference, while Steps provided above help to easily implement a typical ready-to-use protection.

© 2006-2015 Copyright VMProtect Software