Win License Help
Win License Help
Foreword 0
Part I WinLicense
6
................................................................................................................................... 7 1 Why use WinLicense?
.......................................................................................................................................................... 7 Scenarios for using WinLicense
.......................................................................................................................................................... 8 Comparing WinLicense with other protectors/licensing systems
................................................................................................................................... 9 2 User Interface
.......................................................................................................................................................... 9 WinLicense GUI overview
................................................................................................................................... 11 3 Protecting an application
.......................................................................................................................................................... 12 Application Information
.......................................................................................................................................................... 13 Protection Options
.......................................................................................................................................................... 16 CodeReplace
.......................................................................................................................................................... 20 Virtual Machine
.......................................................................................................................................................... 23 Trial Settings
.......................................................................................................................................................... 25 Registration
.......................................................................................................................................................... 27 Hardware Lock
.......................................................................................................................................................... 29 Password protection
.......................................................................................................................................................... 31 Advanced Options
.......................................................................................................................................................... 33 Customized Dialogs
.......................................................................................................................................................... 39 Protect Now
.......................................................................................................................................................... 41 Protecting through the command line
................................................................................................................................... 43 4 SecureEngine Macros
.......................................................................................................................................................... 44 Using macros in your programming language
.......................................................................................................................................................... 47 VM macro
.......................................................................................................................................................... 49 CodeReplace macro
.......................................................................................................................................................... 50 Encode macro
.......................................................................................................................................................... 53 Clear macro
.......................................................................................................................................................... 54 Registered macro
.......................................................................................................................................................... 54 RegisteredVM macro
.......................................................................................................................................................... 55 Unregistered macro
.......................................................................................................................................................... 56 Unprotected macro
.......................................................................................................................................................... 57 CheckProtection macro
.......................................................................................................................................................... 59 CheckCodeIntegrity macro
.......................................................................................................................................................... 61 CheckRegistration macro
.......................................................................................................................................................... 62 CheckVirtualPC macro
.......................................................................................................................................................... 63 Which Macros should I use?
................................................................................................................................... 64 5 Licensing with WinLicense
.......................................................................................................................................................... 65 Overview
.......................................................................................................................................................... 65 File keys
.......................................................................................................................................................... 66 Registry keys
.......................................................................................................................................................... 66 Text keys
.......................................................................................................................................................... 67 SmartActivate keys
.......................................................................................................................................................... 67 Generating licenses
.......................................................................................................................................................... 68 Setting license restrictions
.......................................................................................................................................................... 68 Customizing features in licenses
................................................................................................................................... 69 6 WinLicense SDK
.......................................................................................................................................................... 69 Trial Functions
I Contents
I
2010 Oreans Technologies
......................................................................................................................................................... 71 WLTrialCustomCounter
......................................................................................................................................................... 72 WLTrialCustomCounterDec
......................................................................................................................................................... 73 WLTrialCustomCounterInc
......................................................................................................................................................... 74 WLTrialCustomCounterSet
......................................................................................................................................................... 75 WLTrialDateDaysLeft
......................................................................................................................................................... 76 WLTrialDaysLeft
......................................................................................................................................................... 77 WLTrialDebugCheck
......................................................................................................................................................... 77 WLTrialExecutionsLeft
......................................................................................................................................................... 78 WLTrialExpirationDate
......................................................................................................................................................... 79 WLTrialExpirationTimestamp
......................................................................................................................................................... 80 WLTrialExpireTrial
......................................................................................................................................................... 81 WLTrialExtendExpiration
......................................................................................................................................................... 82 WLTrialExtGetLevel
......................................................................................................................................................... 83 WLTrialExtGetStatus
......................................................................................................................................................... 84 WLTrialFirstRun
......................................................................................................................................................... 84 WLTrialGetStatus
......................................................................................................................................................... 86 WLTrialGlobalTimeLeft
......................................................................................................................................................... 86 WLTrialLockedCountry
......................................................................................................................................................... 87 WLTrialRuntimeLeft
......................................................................................................................................................... 88 WLTrialStringRead
......................................................................................................................................................... 89 WLTrialStringReadW
......................................................................................................................................................... 90 WLTrialStringWrite
......................................................................................................................................................... 92 WLTrialStringWriteW
......................................................................................................................................................... 93 WLTrialTotalDays
......................................................................................................................................................... 93 WLTrialTotalExecutions
.......................................................................................................................................................... 94 Registration Functions
......................................................................................................................................................... 96 WLRegCheckMachineLocked
......................................................................................................................................................... 96 WLRegDateDaysLeft
......................................................................................................................................................... 97 WLRegDaysLeft
......................................................................................................................................................... 98 WLRegDisableCurrentKey
......................................................................................................................................................... 99 WLRegDisableKeyInCurrentInstance
......................................................................................................................................................... 100 WLRegExecutionsLeft
......................................................................................................................................................... 101 WLRegExpirationDate
......................................................................................................................................................... 102 WLRegExpirationTimestamp
......................................................................................................................................................... 102 WLRegFirstRun
......................................................................................................................................................... 103 WLRegGetDynSmartKey
......................................................................................................................................................... 104 WLRegGetLicenseHardwareID
......................................................................................................................................................... 105 WLRegGetLicenseInfo
......................................................................................................................................................... 106 WLRegGetLicenseInfoW
......................................................................................................................................................... 107 WLRegGetLicenseRestrictions
......................................................................................................................................................... 109 WLRegGetLicenseType
......................................................................................................................................................... 109 WLRegGetStatus
......................................................................................................................................................... 111 WLRegGlobalTimeLeft
......................................................................................................................................................... 112 WLRegLicenseCreationDate
......................................................................................................................................................... 113 WLRegLicenseName
......................................................................................................................................................... 114 WLRegLockedCountry
......................................................................................................................................................... 114 WLRegNetInstancesGet
......................................................................................................................................................... 115 WLRegNetInstancesMax
......................................................................................................................................................... 116 WLRegNormalKeyCheck
......................................................................................................................................................... 117 WLRegNormalKeyCheckW
......................................................................................................................................................... 118 WLRegNormalKeyInstallToFile
......................................................................................................................................................... 119 WLRegNormalKeyInstallToFileW
......................................................................................................................................................... 120 WLRegNormalKeyInstallToRegistry
......................................................................................................................................................... 121 WLRegNormalKeyInstallToRegistryW
WinLicense Help File II
2010 Oreans Technologies
......................................................................................................................................................... 121 WLRegRemoveCurrentKey
......................................................................................................................................................... 122 WLRegRuntimeLeft
......................................................................................................................................................... 123 WLRegSmartKeyCheck
......................................................................................................................................................... 125 WLRegSmartKeyCheckW
......................................................................................................................................................... 126 WLRegSmartKeyInstallToFile
......................................................................................................................................................... 127 WLRegSmartKeyInstallToFileW
......................................................................................................................................................... 129 WLRegSmartKeyInstallToFileInFolder
......................................................................................................................................................... 130 WLRegSmartKeyInstallToRegistry
......................................................................................................................................................... 132 WLRegSmartKeyInstallToRegistryW
......................................................................................................................................................... 133 WLRegTotalDays
......................................................................................................................................................... 134 WLRegTotalExecutions
.......................................................................................................................................................... 135 Generators Functions
......................................................................................................................................................... 136 WLGenLicenseFileKey
......................................................................................................................................................... 140 WLGenLicenseFileKeyEx
......................................................................................................................................................... 143 WLGenLicenseRegistryKey
......................................................................................................................................................... 147 WLGenLicenseRegistryKeyEx
......................................................................................................................................................... 150 WLGenLicenseTextKey
......................................................................................................................................................... 154 WLGenLicenseTextKeyEx
......................................................................................................................................................... 157 WLGenLicenseDynSmartKey
......................................................................................................................................................... 159 WLGenLicenseSmartKey
......................................................................................................................................................... 163 WLGenPassword
......................................................................................................................................................... 164 WLGenTrialExtensionFileKey
......................................................................................................................................................... 166 WLGenTrialExtensionRegistryKey
......................................................................................................................................................... 169 Custom WinLicense SDK
......................................................................................................................................................... 174 sLicenseFeatures Definition
.......................................................................................................................................................... 176 Miscellaneous Functions
......................................................................................................................................................... 177 WLBufferCrypt
......................................................................................................................................................... 178 WLBufferDecrypt
......................................................................................................................................................... 179 WLGetCurrentCountry
......................................................................................................................................................... 182 WLGetVersion
......................................................................................................................................................... 182 WLGetProtectionDate
......................................................................................................................................................... 183 WLHardwareCheckID
......................................................................................................................................................... 184 WLHardwareGetFormattedID
......................................................................................................................................................... 185 WLHardwareGetID
......................................................................................................................................................... 186 WLHardwareGetIdType
......................................................................................................................................................... 187 WLHardwareRuntimeCheckU3
......................................................................................................................................................... 188 WLLoadWinlicenseDll
......................................................................................................................................................... 189 WLPasswordCheck
......................................................................................................................................................... 190 WLProtectCheckDebugger
......................................................................................................................................................... 190 WLProtectCheckCodeIntegrity
......................................................................................................................................................... 191 WLRestartApplication
......................................................................................................................................................... 192 WLRestartApplicationArgs
......................................................................................................................................................... 193 WLSplashHide
......................................................................................................................................................... 194 WLStringDecrypt
.......................................................................................................................................................... 194 Testing in an unprotected state
................................................................................................................................... 195 7 WinLicense Managers
.......................................................................................................................................................... 196 Project Manager
.......................................................................................................................................................... 197 Software Manager
.......................................................................................................................................................... 199 Customers Manager
.......................................................................................................................................................... 200 License Manager
.......................................................................................................................................................... 206 Password Manager
.......................................................................................................................................................... 208 Trial Extension Manager
................................................................................................................................... 211 8 WinLicense DLL Control
III Contents
III
2010 Oreans Technologies
.......................................................................................................................................................... 211 WinLicense DLL Control Features
.......................................................................................................................................................... 212 WinLicense DLL Control in runtime
.......................................................................................................................................................... 213 Inserting WinLicense DLL Control inside your application
.......................................................................................................................................................... 214 WinLicense DLL Control SDK
......................................................................................................................................................... 215 WDC_Initialize
......................................................................................................................................................... 216 WDC_ProcessHardwareID
......................................................................................................................................................... 217 WDC_FirstRunTrial
......................................................................................................................................................... 217 WDC_FirstRunLicense
......................................................................................................................................................... 218 WDC_GetLicenseInfo
......................................................................................................................................................... 219 WDC_GetApplicationStatus
......................................................................................................................................................... 221 WDC_DoRegistration
......................................................................................................................................................... 221 WDC_Finalize
................................................................................................................................... 222 9 SecureEngine Technology
.......................................................................................................................................................... 223 AntiAPISpyer
.......................................................................................................................................................... 224 AntiBreakpoints
.......................................................................................................................................................... 224 AntiCrackTools
.......................................................................................................................................................... 224 AntiDumperPro
.......................................................................................................................................................... 226 ClearCode
.......................................................................................................................................................... 227 CodeEncrypt
.......................................................................................................................................................... 228 CodeReplace
.......................................................................................................................................................... 228 DebuggerGuard
.......................................................................................................................................................... 229 DynamicEncryption
.......................................................................................................................................................... 229 GarbageCode
.......................................................................................................................................................... 230 intDebugShield
.......................................................................................................................................................... 231 InteractiveEngine
.......................................................................................................................................................... 231 MemoryGuard
.......................................................................................................................................................... 232 MonitorBlocker
.......................................................................................................................................................... 233 MutatorEngine
.......................................................................................................................................................... 234 PasswordProtect
.......................................................................................................................................................... 234 PolymorphicLayers
.......................................................................................................................................................... 236 RealTimeSpy
.......................................................................................................................................................... 237 SecureAPIWrapper
.......................................................................................................................................................... 237 SecureEntryPoint
.......................................................................................................................................................... 238 SmartCompression
.......................................................................................................................................................... 239 SmartMetamorph
.......................................................................................................................................................... 240 ThreadEngine
.......................................................................................................................................................... 241 VirtualMachine
................................................................................................................................... 242 10 FAQ
.......................................................................................................................................................... 244 Is WinLicense the ultimate solution against cracking?
.......................................................................................................................................................... 244 I'm using a Dongle protection on top of my application protected with WinLicense, but my application crashes. What should I do?
.......................................................................................................................................................... 245 Can I protect my .NET applications with WinLicense?
.......................................................................................................................................................... 245 When I protect my application with WinLicense, it crashes or exits silenty
.......................................................................................................................................................... 246 When I protect my application with WinLicense, the size is increased by 500Kb!
.......................................................................................................................................................... 246 I have inserted ENCODE and CLEAR macros in my DLL, but my DLL crashes
.......................................................................................................................................................... 247 Can I protect my Windows NT system service with WinLicense?
.......................................................................................................................................................... 248 I want to include WinLicense in my build system. Does WinLicense support command line protection?
.......................................................................................................................................................... 248 I would like to include the same protection options and custom dialogs in all my applications. Can I apply the same settings to all my applications?
.......................................................................................................................................................... 248 I need a special WinLicense build with extended protection options for my application. Can you make one for me?
.......................................................................................................................................................... 249 I have a suggestion about a new protection feature for WinLicense. Will you implement it?
.......................................................................................................................................................... 249 I bought a WinLicense license to protect my applications. My friend needs to protect his application. Can I protect his software with WinLicense?
.......................................................................................................................................................... 250 Is it possible to lock my application to a specific machine?
.......................................................................................................................................................... 250 I don't want my application to be executed unless a valid license key is present. How can I do that?
.......................................................................................................................................................... 250 How can I use a single license to registered all my products?
WinLicense Help File IV
2010 Oreans Technologies
.......................................................................................................................................................... 251 I have 2 programs but I want each to have a specific license key. How can I do that?
.......................................................................................................................................................... 251 I can see several kinds of licenses to register my application (Single file, registry, text file..). Which one should I use to make my application more robust against cracking?
.......................................................................................................................................................... 253 What are SmartActivate keys?
.......................................................................................................................................................... 253 How can I get extended information about current licenses for my application?
.......................................................................................................................................................... 253 Is it possible to implement a feature that prohibits my application from being run with a permanent key? In my application all keys must expire.
.......................................................................................................................................................... 254 I have received a report about a stolen license key. How can I block it?
.......................................................................................................................................................... 254 How do I check a SmartKey?
.......................................................................................................................................................... 255 Can I only use locked keys to register my application?
.......................................................................................................................................................... 255 I'm still lost about how to use SmartActivate keys, can you give me some examples?
.......................................................................................................................................................... 256 Can I include different trial restrictions in a single application?
.......................................................................................................................................................... 256 My trial extensions keys do not seem to be working to extend the trial period in my application
.......................................................................................................................................................... 256 How can I clear the trial information when I release a new version?
.......................................................................................................................................................... 257 I'm going to release a new version of my application with a bug fix, but I want the trial period to continue as it was for each client. How can I keep the trial period for my new protected application?
.......................................................................................................................................................... 257 What are these Custom Counters? How can I use them?
.......................................................................................................................................................... 258 How does the Password protection work?
.......................................................................................................................................................... 258 Is it possible to customize the password dialog displayed by WinLicense?
.......................................................................................................................................................... 258 Can you tell me how WinLicense subscriptions work?
.......................................................................................................................................................... 259 Are there localized versions of WinLicense to support other languages?
.......................................................................................................................................................... 259 What programming language was WinLicense created with?
................................................................................................................................... 260 11 Order
.......................................................................................................................................................... 260 Prices and subscriptions
................................................................................................................................... 261 12 Support
.......................................................................................................................................................... 261 Support
Part II XBundler
261
................................................................................................................................... 262 1 Overview
.......................................................................................................................................................... 262 What is XBundler?
.......................................................................................................................................................... 262 Scenarios for using XBundler
.......................................................................................................................................................... 263 Using XBundler
.......................................................................................................................................................... 265 Installing XBundler
................................................................................................................................... 265 2 FAQ
.......................................................................................................................................................... 266 Can I use XBundler separately from Themida/WinLicense?
.......................................................................................................................................................... 266 Can I protect my DLLs with another protector and use XBundler to inject them inside my application protected with Themida/WinLicense?
.......................................................................................................................................................... 267 Can I protect my DLL with Themida/WinLicense and embed it with XBundler?
.......................................................................................................................................................... 267 If I embed my data files and DLLs with XBundler, can someone use an hex editor to extract my embedded files?
.......................................................................................................................................................... 267 My application does not work when I use XBundler on it. What's happening?
.......................................................................................................................................................... 268 Do I need to make changes in my source code to use XBundler?
.......................................................................................................................................................... 268 If I select the "Never write to disk" option for my data file, can I write to it from my application?
.......................................................................................................................................................... 268 I have an MP3 file that I don't want anyone to get it. Can XBundler help me with that?
.......................................................................................................................................................... 269 I have an idea to be added to XBundler, can you implement it?
.......................................................................................................................................................... 269 If I buy XBundler, will I keep receiving updates?
.......................................................................................................................................................... 269 Can I use XBundler in my .NET application?
.......................................................................................................................................................... 269 Can XBundler help me to be protected against crackers?
................................................................................................................................... 270 3 Order
.......................................................................................................................................................... 270 Registration and prices
................................................................................................................................... 271 4 Support
.......................................................................................................................................................... 271 Support
Index 272
V Contents
V
2010 Oreans Technologies
WinLicense Help File 6
2010 Oreans Technologies
1 WinLicense
WinLicense
WinLicense is a powerful software protection system and licensing manager designed for software developers
who wish to protect their applications against advanced reverse engineering and software cracking. WinLicense
uses the SecureEngine protection system to achieve its goals, making it really difficult to break using the
traditional and newest cracking tools.
WinLicense has been designed to completely stop novice and advanced crackers from cracking an application.
This will avoid a considerable loss of revenue from the distribution of cracked applications. Developers do not
need any source code changes or programming experience to protect their applications with WinLicense.
WinLicense also offers a wide rage of powerful and flexible techniques that allow developers to securely
distribute trial versions of their applications.
This document explains the advantages of using WinLicense. You will learn how to use it to protect and license
your applications with the most secure techniques available against advanced cracking.
WhyuseWinLicense?
UserInterface
Protectinganapplication
SecureEngineMacros
LicensingwithWinLicense
WinLicenseSDK
WinLicenseManagers
WinLicenseDLLControl
SecureEngineTechnology
FAQ
Order
Support
2010 Oreans Technologies. All rights reserved
WinLicense 7
2010 Oreans Technologies
1.1 Why use WinLicense?
Why use WinLicense?
WinLicense has been designed with the newest and most powerful technology in software protections and
trial/licensing control, SecureEngine.
From the attacker point of view, WinLicense is completely different to traditional software protectors, due to its
complex protection engine and its high priority code that allows supervising the whole system against possible
attackers. From the software developer's point of view, WinLicense is quite easy to use and easily adapts its
protection techniques and trial/licensing control to suit a developer's needs.
The following sections give a detailed explanation about the benefits of using WinLicense to protect/license
your software.
ScenariosforusingWinLicense
ComparingWinLicensewithotherprotectors/licensingsystems
2010 Oreans Technologies. All rights reserved
1.1.1 Scenarios for using WinLicense
Scenarios for using WinLicense
WinLicense uses the SecureEngine protection system to cover a wide range of scenarios. SecureEngine is
the ideal solution in the following situations:
Protecting an application against modifications and software piracy: SecureEngine protects
the integrity of an application by encrypting and decrypting its code at runtime, using revolutionary
techniques that defeats any of the traditional or newest cracking tools.
Protecting an application against reverse engineering: SecureEngine uses a wide range of
techniques to prevent reverse engineering. An attacker will not be able to use cracking tools to
analyze the code of a protected application.
Protecting an application against unauthorized access: SecureEngine allows a developer to
include password protection in an application. The application can only be executed with a valid User-
Password. The SecureEngine SDK offers external functions that allow developers to handle the
management of new users and passwords.
Protecting an application against monitoring tools: SecureEngine includes the most advanced
techniques to detect registry and file monitoring tools. Developers choose the desired option to finish
the execution of their applications upon the detection of monitoring tools.
Making trial versions for an application: WinLicense offers powerful and flexible techniques that
allow developers to securely distribute trial version of their applications, allowing developers to
interact with the trial status of their applications via an extended API.
WinLicense Help File 8
2010 Oreans Technologies
Licensing an application: WinLicense offers a flexible and powerful licensing system that allow
developers to create a wide range of registration system into their applications. WinLicense provides
an extended API that offers total freedom to manage license keys.
2010 Oreans Technologies. All rights reserved
1.1.2 Comparing WinLicense with other protectors/licensing systems
Comparing WinLicense with other protectors/licensing systems
Other software protectors and licensing system have important vulnerabilities, which prevent them from being
a perfect solution to protect an application against reverse engineering or cracking. The following section
identifies some of those vulnerabilities and shows how WinLicense resolves them.
Obsolete protection techniques
Most modern software protection systems use already broken techniques that are quite easy to bypass.
Normally, an attacker will reuse the same proven tools that have been used over years to break protection
systems. Often the attacker will release a global technique to attack every application protected by a specific
protection system.
SecureEngine uses new technology in software protection to ensure each protected application is unique thus
preventing any cracking tool from being used to create a universal crack to your application.
Attackers are one step ahead of the protection system
When a software protection system has been broken, their authors implement patches to avoid a specific
attack from being used again on new versions. Typically attackers will inspect the new changes that have been
applied in the new version and will easily bypass them again. In this common scenario, attackers are always
one step ahead from the protection system because the new applied patches can easily be identified and
defeated.
SecureEngine has a different approach to avoid this. If vulnerability is found the vulnerable object is quickly
changed (due to the mutable technology used in SecureEngine) instead of releasing a patch against the specific
threat. The new object, joined with the rest of the SecureEngine objects, creates a completely new protection
system. The benefits of this, when compared to common software protectors, is that attackers will have to
reexamine the whole protection code to bypass the new changes.
Static trial and licensing control
Most of the other trial systems do not include a wide range of APIs to interact with the licensing system or to
check and extend the current status of the trial period in a protected application. This makes developers
narrow their creativity to create a flexible trial/licensing system for their customers and forces them to use a
rigid registration system for their application.
WinLicense comes with an extensive SDK to satisfy developers' needs, giving developers the freedom to hande
WinLicense 9
2010 Oreans Technologies
all those situations that they want and leaving to WinLicense the hard work of those situations not handled by
the developer.
Trial periods are easy to reset by attackers
Most of the current licensing systems store the current trial status (days left, executions left, etc.) in places
which are easy to find by attackers. Normally, the trial information is stored in the Windows registry and/or
files. In this scenario, an attacker will use specific tools to compare the registry/files before and after executing
a protected application. This shows them where the trial information is stored in the system and therefore, how
to reset the trial period for an application.
WinLicense comes with the Trial Storing Manager which is a specialized technology to store the trial information
of a protected application in random and special locations in the system. This makes the trial period of
protected applications very difficult to reset.
2010 Oreans Technologies. All rights reserved
1.2 User Interface
User Interface
WinLicense provides a flexible and easy to use user interface (GUI) to help you to protect your applications.
WinLicense uses the classical project file approach to help you save and restore your settings each time you
want to protect an application.
The following sections give an overview about how the WinLicense GUI is structured and how to upgrade to the
latest version.
WinLicenseGUIoverview
2010 Oreans Technologies. All rights reserved
1.2.1 WinLicense GUI overview
WinLicense GUI overview
WinLicense Help File 10
2010 Oreans Technologies
The Toolbars Menu
The toolbars menu helps you to manage your projects, softwares, customers, licenses and protect your
application.
Every time that you make changes to your protection settings, you can save those changes into a project. That
project can be loaded at a later time to restore the current protection settings and protect another software.
The Options Panel
The option panel shows the different settings that are required to protect an application and customize the
different protection options that you want to include in your application.
The ApplicationInformation option allows you to set up the general information settings about the
application that you are going to protect.
The ProtectionOptions option allows you to select the different protection options that will be
included in your application.
The CodeReplace option helps you to set up and simulate your application using the CodeReplace
technology.
The VirtualMachine option allows you to set up all protections related with the Virtual Machine
WinLicense 11
2010 Oreans Technologies
technology.
The TrialSettings option allows you to select the different trial settings that will be included in your
application.
The Registration option allows you to select the different registration settings that will be able to
register your application.
The HardwareLock option allows you to specify which hardware settings will be included in your
hardware dependent keys.
The PasswordProtection option allows you to set up password protection in your applications.
The CustomizedDialogs option allows you to customize the different messages that are shown
when a certain event occurs while your protected application is running.
The Help Panel
The help panel gives you access to the WinLicense Help file to get more information about specific topics.
The Main Panel
This panel shows the main information for every option in the Options Panel. All the information that is set in
the Main Panel can be saved and restored using project files.
2010 Oreans Technologies. All rights reserved
1.3 Protecting an application
Protecting an application
The following sections will guide you through the different stages to protect your application with WinLicense.
ApplicationInformation
ProtectionOptions
CodeReplace
VirtualMachine
TrialSettings
WinLicense Help File 12
2010 Oreans Technologies
Registration
HardwareLock
PasswordProtection
AdvancedOptions
CustomizedDialogs
ProtectNow
Protectingthroughthecommandline
2010 Oreans Technologies. All rights reserved
1.3.1 Application Information
Application Information
WinLicense 13
2010 Oreans Technologies
The first step to protecting an application is selecting the application that you want to protect by choosing a
software from the Software Database. After selecting the software that you want to protect, related
information about your software will be displayed in the Application Information panel. To manage the software
database refer to
The File Size and File Information windows display information about the application that is going to be
protected. The details include file size, type of file, the compiler used to generate the application and number
of SecureEngine macros detected.
2010 Oreans Technologies. All rights reserved
1.3.2 Protection Options
Protection Options
WinLicense Help File 14
2010 Oreans Technologies
In the Protection Options panel you can select the different protection options that you want to include in your
application. By default all the protection options are enabled. If a specific protection option is not needed for
your application it can be removed to speed up the execution of your application and make the protection code
smaller.
Anti-Debugger Detection
This option will enable anti-debugger detections inside the protected application, detecting when a kernel or
software debugger is debugging a protected application. Notice that "Ultra" detection can cause some
incompatibilities with systems that are infected by viruses or have a Rootkit installed, also it might be
incompatible with non Windows platforms (like Wine, ReactOS)
Antidumpers
One of the most dangerous tools against protected applications, are memory dumpers. Crackers to dump
decrypted code or data from memory to disk allowing them to reconstruct an exact image of the original
program (before protection) thus removing the protection wrapper use these tools. SecureEngine has many
ways to avoid these tools that are usually included in a protected program. This option forces SecureEngine
to enable the most powerful techniques against memory dumping and protect your program from being
dumped from memory to disk. If you want to know more about how this technique works, read here.
EntryPoint Obfuscation
If this option is enabled, SecureEngine will blend your application entry point, the first instructions executed
in an application, with the SecureEngine code. With this in place an attacker will not be able to retrieve the
entry point of your application and making it much harder to attack. For more information about how this
WinLicense 15
2010 Oreans Technologies
technique works, read here.
Resources Encryption
When this option is enabled, the resources used by your application will be encrypted. This option ensures that
a cracker cannot monitor or alter important structures used by your application. SecureEngine encrypts all
your application resources and only decrypts them when they are needed by your application, keeping them
secure from an attacker.
Advance API-Wrapping
This option will enable advanced API-Wrapping techniques that keep an attacker from identifying the different
APIs that are used by a protected application. You can select the API-Wrapper level, which will obscure more
the process of hiding a specific API. Notice that a higher level will require more CPU processing to boot up your
application. For more information about how this technique works, read here.
Anti-Patching
This options detects when a modification has been done to the protected application from an external source
(like a virus, cracker or any other application). If you are planning to put another compressor on top of your
protected application or do some external modifications to the protected file on disk, you should select None
to avoid that WinLicense detects the modification and finishes the execution of your application.
If you select File Patching, WinLicense will detect any alteration of your protected application on disk. If a
modification is detected, WinLicense will display an error message (MsgId4 in CustomizedDialogs) and stop
the execution of your protected application.
Metamorph Security
This technique allows SecureEngine to completely change the protection code that is added to an application.
This technique mutates original instructions into similar ones so an attacker will not recognize specific blocks of
code to study its purpose. To learn more about how this technique works, read here.
Advanced Debugger Monitors
When this option is enabled, SecureEngine will insert advanced anti-debugging techniques into your
application ensuring that a possible attacker cannot use any kind debugger to study your protected application.
SecureEngine has very powerful techniques that will detect all debuggers running in memory, even the most
powerful kernel debuggers. To find out more about how this technique works, read here.
Compression
When SecureEngine protects an application, it adds a large amount of protection code that increases the size
of your application. To prevent your program from getting bigger in size when protected you can compress
your application code, resources and the protection code that is added into your application. SecureEngine
uses a very fast decompression algorithm that will not affect the performance of your application when loading
it into memory. If you want to know more about how this technique works, read here.
Monitor Blockers
If your application accesses several files or registry keys and you want to hide this from a possible attacker,
SecureEngine includes very powerful techniques to do so. Regardless of what monitor tools an attacker uses,
they will not be able to accurately supervise any file or registry entry accessed by your application. A common
scenario is when you include trial periods in your application and you store the current trial state in files or
registry keys. To find out more about how this technique works, read here.
Delphi/BCB form protection
WinLicense Help File 16
2010 Oreans Technologies
If your program is compiled with Delphi or Borland C++ Builder, you can protect your forms enabling this
option. SecureEngine will defeat cracking tools that try to extract the Delphi/BCB forms when your
application is running.
When Debugger Found
This option allows you to choose the desired option to perform when a debugger or cracking tool has been
found in memory while your protected application is running. The recommended options are Display Message
or Exit Silently. If you select Display Message you can use the CustomizedDialogs panel to customize the
message.
Ring-0 Protection
This option will enable Trial and Licensing protections in Ring-0, which will enhance the way that trial
information is stored in the system. If you check this option, a device driver (oreans32.sys) will be embedded
and extracted automatically when your application runs.
Notice that the Hardware ID is different if you enable or disable this option.
2010 Oreans Technologies. All rights reserved
1.3.3 CodeReplace
CodeReplace
WinLicense 17
2010 Oreans Technologies
The Code Replace panel allows you to integrate the CodeReplace technology into your application. If you want
to know more information about how this technique works, read here.
Selecting blocks of code to be protected by CodeReplace
There are three ways to choose which blocks of code will be protected by CodeReplace: Manual, Automatic,
MAP file.
In Manual insertion, you have to include CodeReplace macros inside your application source code. When your
press the Read functions from SDK button, SecureEngine will find all CodeReplace macros and they will be
included in the list of functions to apply the CodeReplace technology to. Note that by default WinLicense will
read your CodeReplace macros when your application is loaded into the GUI.
In Automatic insertion, you do not need to include CodeReplace macros inside your application source code.
When you press the Read functions automatically button, SecureEngine will inspect your compiled
application searching for possible routines to apply the CodeReplace technology to.
In MAP file insertion, WinLicense will scan the MAP file that your compiler generated for your application. You
can select any function that was defined inside of your application using an easy to use interface. Please, read
the following section to learn how to insert your CodeReplace functions through your MAP file.
Once that you have chosen the blocks of code to apply the CodeReplace technology to, you can click on any
function to view its disassembled code. This disassembled code is where the CodeReplace technology will be
applied.
Inserting CodeReplace functions from a MAP file
WinLicense Help File 18
2010 Oreans Technologies
To insert CodeReplace functions from a MAP file, just click on the Select functions from MAP file button. The
following screenshots shows the two equivalent ways that WinLicense offers to select the functions that you
want to CodeReplace.
WinLicense 19
2010 Oreans Technologies
You can insert/remove functions to CodeReplace by clicking on the name of the function. The Advanced
Selection panel gives you more control to insert the functions to CodeReplace and displays the assembly code
of the selected function. You can also use the Functions Filter panel to search for specific functions.
The Basic Selection panel is a simplified version of the Advanced Selection panel, and it allows you to easily
insert/remove functions to CodeReplace.
Simulating an application with CodeReplace included
When you insert the CodeReplace technology into your application, you should make sure that the application
is working correctly and its performance has not decreased due to the insertion of the CodeReplace technology
in critical parts of your application.
On some rare occasions when SecureEngine tries to automatically find possible routines to apply
CodeReplace, the found routine is invalid (like self-modifying code) or the routine is executed many times per
second (decreasing the application performance). Therefore, it is very important to simulate your application
when you select Automatic insertion.
To simulate your application with the CodeReplace technology included, you have to press the Start
Simulation button. After that you will see your application running while the CodeReplace simulator is
constantly updating the information about the number of times that each block is executed.
When you select Automatic insertion, you should ensure that most of your application code is executed in
simulation. By doing so you will be helping SecureEngine get a better understanding of how your program is
executed, get a better analysis after finishing the simulation and give you better advise to optimize your
program's performance.
You can stop the simulation process either by closing your application or pressing Cancel in the simulation
WinLicense Help File 20
2010 Oreans Technologies
screen. After finishing the simulation, SecureEngine will inspect how many times each block of code was
executed and advise you about which block of code should be removed to obtain a high performance in your
protected application. You can also see the number of times that each block was executed and warning colors
that indicate if the block is suitable to be included in the CodeReplace engine.
2010 Oreans Technologies. All rights reserved
1.3.4 Virtual Machine
Virtual Machine
WinLicense 21
2010 Oreans Technologies
The Virtual Machine panel allows you to integrate the Virtual Machine technology into your application. If you
want to know more information about how this technique works, read here.
Virtual API-Wrapper
The virtual API-Wrapper allows you to select which API calls inside your application will be protected with the
Virtual Machine technology. This technology "emulates" the execution of an API and defeat any current API
tracers. You can also select the API Virtualization Level which will allow you to obfuscate more or less the
"emulation" of the API.
The Import and Export buttons facilitates the importation/exportation of the selected API names into a text file
to be loaded by another project file.
Entry Point Virtualization
This option will execute your application entry point inside the Virtual Machine technology. This is a powerful
technique to avoid the reconstruction of the original entry point of your applications. You can select the number
of instructions taken from the entry point (from 0 to 100). We recommend you to put a high number of
instructions (even 100 instructions) but make sure that your application boots up OK when you select a big
amount of instructions in your application entry point.
Please, notice that some applications re-execute code at the entry point, causing a crash if the entry point has
been virtualized. In those cases, we recommend you to reduce the amount of instructions taken from the entry
point.
Multi Branch Technology
This option will insert multiple conditional branch instructions inside your unique virtual machine. The Multi
Branch Technology makes much harder for a cracker the analysis of your virtual machine because he needs to
know when a specific branch is taken or not to continue analyzing your unique virtual machine. Notice this
option can increase the size of your final protected application a few dozen of Kbs.
Processor Specifications
You can define your own processor and opcodes for the selected processor as desired, making your unique
virtual machine as complex as you want. WinLicense will display an approximation in complexity, size and
speed for the current defined processor, helping developers to get an idea about the performance and security
of their protected applications.
Processor Type:
Mutable CISC Processor: This processor is based in CISC technology, where the size of each
instruction is different. Each generated CISC processor will be totally different and unique (mutable)
for each protected application to avoid a general attack over the embedded virtual machine. CISC
processors run faster and with smaller size than RISC processors, though the complexity (security)
level is bigger in RISC processors.
Mutable CISC-2 Processor (New): This processor is based in CISC technology, where the size of
each instruction is different. Each generated CISC-2 processor will be totally different and unique
(mutable) for each protected application to avoid a general attack over the embedded virtual
machine. CISC-2 processors have a similar design than the above CISC processor but the internal
microinstructions are more complex, this requires a bigger size in the generated virtual opcodes,
producing a bigger final application but with higher security level than CISC processors. Notice that
if you insert many VM / CodeReplace macros, this processor can produce a bigger size in your
application than RISC processors.
Mutable RISC-64 Processor: This processor is based in RISC technology, where the size of each
instruction is equal to 64 bits. Each generated RISC-64 processor will be totally different and unique
(mutable) for each protected application to avoid a general attack over the embedded virtual
machine. The RISC-64 processor is a complex processor with higher security than CISC processors
but the size and execution speed are not as optimum as for CISC processors.
WinLicense Help File 22
2010 Oreans Technologies
Mutable RISC-128 Processor: This processor is based in RISC technology, where the size of each
instruction is equal to 128 bits. Each generated RISC-128 processor will be totally different and
unique (mutable) for each protected application to avoid a general attack over the embedded
virtual machine. The RISC-128 processor offers higher complexity level than CISC and RISC-64
processors, but the execution performance is lower.
Multiprocessor:
This option is only available for CISC processors. You can define how many CISC processors you want
to include inside your protected application. The more processors you include inside your protected
application, the bigger the complexity level (security) will be in your application. That is, an attacker
will have to fight against each different embedded processor, making the cracking process a very
tedious task.
Opcode Type:
You can define the opcodes complexity level for your selected processor, incresing or decreasing the
complexity level of your generated virtual machine. Note that the opcode complexity has a direct
impact in the final size and execution speed of your application
Dynamic Opcodes:
When you include VM macros inside your application, you can define the percent of dynamic opcodes
that will be inserted between your real opcodes to emulate. That is, your real code (x86 opcodes) will
be mixed with random opcodes and they are all converted into virtual machine opcodes, making the
execution of your VM macros more complex. Note that performance of your VM macros can be
lowered by increasing the Dynamic Opcodes parameter.
NOTE: The displayed speed for the selected processor configuration is not real but relative from each
processor configuration. As each processor is mutable, the speed can vary slightly for two instances of a
protected application with the same processor settings.
Guidelines to create your own processor
Developers might feel confused about how to define their own processor in order to get the desired security for
their applications. To help developers we display three blue bars which shows the complexity, speed and size
for the current configuration, indicating how the application will run after protected.
The first thing that developers have to decide is if they want a fast and small virtual machine (CISC
processors) to reduce the final size of their applications or if they want a more complex and strong virtual
machine (RISC processors) sacrificing the size and execution speed of their final applications.
If you want a virtual machine with high complexity (security) and you can afford the size and execution speed
of RISC processors, you should select a RISC-64 processor or a RISC-128 processor for even higher security.
If your application cannot afford the size and execution speed of RISC processors but you still want a very high
security level, you should select a CISC processor with 4-8 multiprocessors and selecting "Opcode Type" and
"Dynamic Opcode" to the maximum level.
The standard configuration for a good security in your application can be:
Mutable RISC-64 processor, Metamorphic Level 1, Dynamic Opcode = 40%
Mutable CISC with 4 processors, Metamorphic Level 3, Dynamic Opcode = 60%
2010 Oreans Technologies. All rights reserved
WinLicense 23
2010 Oreans Technologies
1.3.5 Trial Settings
Trial settings
The Trial Settings panel allows you to select different restrictions when your application runs in trial mode.
WinLicense offers a wide range of combinations to limit the trial period in your protected application. As
opposed to other licensing systems, WinLicense allows you to include several types of restrictions in a single
application.
Trial restrictions
The following trial restriction options can be included before protecting an application:
Days Expiration: This option sets a trial period to a certain amount of days, which is calculated from
the day when an application is started on a computer for the first time. Users will not be able to run
the application after its trial period has expired, until a trial extension or license key is present.
Date Expiration: This option sets an exact date for the end of the trial period. After this date the
user will not be able to run the application, until a trial extension or license key is present.
Executions: This option sets an exact number of executions allowed for an application. Each time the
user executes the protected application, the internal counter decreases by one. When the counter
reaches zero, the user will not be able to run the application, until a trial extension or license key is
present.
WinLicense Help File 24
2010 Oreans Technologies
Run time (execution): This option sets an exact amount of time (in minutes) that an application can
stay in memory. WinLicense will terminate the application after the time has run out. The internal
timer will reset on application restart.
Global time: This option sets an exact amount of total time (in minutes) that an application can run
during all Windows sessions. The internal timer will not reset on restart of operating system. When
the global time expires, the application will not be able to run again, until a trial extension or license
key is present.
Unlimited: This option allows an application to run in trial mode without any restrictions added by
WinLicense. This option is intended to be used to disable internal functionality in the protected
application when it runs in trial mode.
NOTE: If an application has been protected with only some types of expiration, then only the chosen
restrictions will be able to be extended with a trialextension key. For example, if only "Executions" has been
set up as a trial limitation, only extension keys with an Executions extension will be able to extend the current
trial state.
Clock Change
WinLicense can detect clock back changes to prevent your application from being used indefinitely. In order to
give more flexibility to your customers to adapt to clock changes and different time zones when traveling, you
can specify the margin of change that you allow putting the clock back:
Any clock change: WinLicense will detect any clock back change. This is the more restricted option
to avoid putting the clock back.
1 hour clock back: The user can put the clock back for one hour and WinLicense will not detect the
change. This is the recommended option for most situations.
1 day clock back: The user can put the clock back for one day and WinLicense will not detect the
change.
Lock Trial to User Language
This option allows an application to be locked to specific country when it runs in trial mode. To lock the
application to a country, a country must be selected from the country list. Worldwide selection will allow the
protected application to be run in any country.
Trial Extension
The Trial Extension Manager allows users to extend the trial period of an application with special trialextension
keys. If the trial extension option is not enabled, there is not way to extend the trial period in an application
after expiring.
Extension Key distribution options
WinLicense offers two different ways to extend the trial period in a protected application:
With single file: This option sets the name of a trial extension file to be searched by WinLicense
when the application is being started. If the extension file is found, it will be checked for validity and
accepted only if it is a valid extension key for the application and it contains a proper date for the trial
period's end. Otherwise, WinLicense will discard the extension file and will not extend the trial period.
Registry: This option is used to allow distribution of extension keys as Windows Registry key files
(*.reg by default). User will have to double-click on the received reg-file and agree to import the key
into his Registry. WinLicense will search the selected Registry section in order to find the trial
extension information. If such information is found, it will be checked for validity to extend the current
trial period.
NOTE: both options can be used at the same time. WinLicense will search for valid key files and for Registry
entries in order to find extension information.
WinLicense 25
2010 Oreans Technologies
Maximum Extensions
The Maximum extensions allowed option limits the amount of trial extensions that an application can be
extended. Every time an user adds a new extension key, WinLicense will keep track of it. Users will not be able
to extend the trial period when an application has been extended for the specified amount of times.
2010 Oreans Technologies. All rights reserved
1.3.6 Registration
Registration
The Registration panel allows an application to be registered. This means that no trial limitations, which were
set on the Trialsettings panel, will affect the execution of the registered application. To avoid an application
WinLicense Help File 26
2010 Oreans Technologies
being registered in any way, this panel should be skipped.
WinLicense license keys
WinLicense accepts different types of license keys in order to satisfy different user's needs. You can select
different types of licensing for a single application. The following types of licenses can be used to register a
protected application:
File licenses: To allow single file license keys you have to check the Single file option and enter the
name of the file that will hold the license information when an application is going to be registered.
When a user executes a protected application, WinLicense will search for the specified file name in
order to registered the application. If the specific license file is found, it will be checked to see if it is a
valid license file. You can specify one of the defined WinLicense directory constants to place your
licenses in different Windows common folders, like:
%userdocs% : Specifies the current user documents folder (!My Documents).
%userappdata% : Specifies the current user application data folder (!{user
name}\Application Data)
%commonappdata% : Specifies the common application data for all users (!All
Users\Application Data)
%localappdata% : Specifies the local application data for the current user (!{user
name}\Local Settings\Application Data (non roaming))
Notice that the above constanst are case sensitive. You can specify subdirectories with any of the
above constants. Example: %userdocs%\MyApplication\Licences\license.dat
You can also specify a dynamic license key name based on the name of your Software. The string
%SOFT_NAME% in the license name is replaced by the current Software name (This is useful when
you reuse a single project file for several software titles and each one is registered with its own
specific license key).
Registry licenses: If you want to register your application using Windows Registry key files (*.reg
by default), you have to check the Registry option. Users will have to double-click on the received
".reg" file and agree to import the key in the Windows Registry. You have to enter the Registry
information where your license information will be stored. WinLicense will search the selected Registry
information to find the registration data.
SmartActivate licenses: If you want to include professional and elegant licensing control into your
application, you have to check the Enable SmartActivate System for user-side generated keys
option. The SmartActivate System allows an application to be licensed using a valid activation code
that can be inserted in a dedicated form in your application. To learn more about the SmartActivate
System, refer to the section below.
Text keys: The last supported way to license an application is through text keys. Text keys are in fact
file keys in ASCII format to allow licensing an application from a custom form. WinLicense exports
several functions to validate and install a text key in the system in order to register an application.
The following functions are used with text keys: WLRegNormalKeyCheck,
WLRegNormalKeyInstallToFile, WLRegNormalKeyInstallToRegistry.
The SmartActivate System
For professional and elegant licensing control, WinLicense offers the SmartActivate System. This technology
allows an application to be registered using SmartActivate keys, which are composed of the following fields:
Registration Name, Company and Custom data.
Valid Activation code (I.e, "F5D80C4E-AF3C3B88-D1D2ACF0-EB46BD91-96E29D36-9E35C4DC-
75DC")
The Activation code will contain information related to license expiration, Hardware ID (specifies in which
computer the license can be accepted) and checksums that validate the Registration information (Name,
WinLicense 27
2010 Oreans Technologies
Company and Custom data).
The disadvantages of using SmartActivate keys is the requirement to create a special form in your
application to enter the SmartActivate information and a bit ofdecrease in the security level for registration
keys (due to limits in Activation code length).
When the SmartActivate key system is enabled, you can select between StaticorDynamic SmartActivate keys,
so, your application will be ready to accept a SmartActivate key type or another. We recommend just selecting
Dynamic SmartActivate keys, as they offer more security and flexibility than Static SmartActivate keys.
Security Options
WinLicense offers a set of security options to allow developers to control how an application can be registered
and actions to take after that. The different security options are the follows:
Allow only hardware dependent (locked) registrations: This option restricts the use of
registration keys to a specific computer. As each computer has an unique machine ID (processor type,
hard disk and BIOS serial), WinLicense can lock a registration key to that specific machine. Please,
refer to HardwareLock panel to get additional information.
Accept only temporary keys (that expire): This option denies the use of "time unlimited"
registration keys and forces WinLicense to accept only temporary registration keys. This option is used
as a protection against a developer accidentally releasing a "time unlimited" key for his application.
Application only runs when registered: This option allows user to run an application only in the
presence of a valid registration key. WinLicense will terminate the application if no key is found or if it
is invalid. This option is intended to be used by developers that only allow the execution of their
application in registered mode.
Clear trial info when registered: The purpose of this option is to clear the trial information from a
computer once an user receives a valid registration key and registers an application. If the user
decides to remove the registration key or it expires, the trial period will restart from zero.
License Key Signature
This option allows you to sign your license files with strong cryptographic algorithms to avoid an attacker
bruteforcing and creating license keys for your application. The signature level that you select will determine
the complexity in the algorithm which signs and verifies a license.
2010 Oreans Technologies. All rights reserved
1.3.7 Hardware Lock
Hardware Lock
WinLicense Help File 28
2010 Oreans Technologies
The Hardware Lock panel is designed to prevent the use of a single registration key with different computers.
Even if a registration key is leaked or stolen, that key will not work on other computers. In this panel you can
select the different parameters that WinLicense will use to lock machine dependent keys to a computer.
NOTE: To get the Machine ID of your customers, you will have to send them a special application that retrieves
their Hardware ID. This Machine ID will be set in a specific field in the license key. You could also customized
all this processing by making a special server that communicates with your application in order to retrieve your
customer's Machine ID transparently.
Custom Hardware Items
The Machine ID for a specific computer can be taken from several hardware items. WinLicense allows you to
select which hardware items will be included to create the final Machine ID for a specific computer. The
following hardware items can be included to create the final Machine ID for a specific computer:
CPU: This option uses the CPU features for the current computer. Note that the CPU features are the
same for all computers with the same CPU. It is not a good idea to use only this option to generate
the final Machine ID.
BIOS: This option uses the BIOS serial number for the current computer. This serial number should
be unique among computers, unless the BIOS serial number has been manipulated from flash.
MAC Address: This option uses the MAC address for the current computer. MAC address should be
unique among computers. Be careful including this option if your customers usually change their
network cards.
WinLicense 29
2010 Oreans Technologies
HDD Serial: This option uses the primary hard drive serial number for the current computer. This
serial number should be unique among computers.
When a machine dependent license key is going to be registered in the system, the Machine ID in the license
key must match the current Machine ID. Once the license is validated and registered, hardware changes will be
possible. To allow your customers to change their hardware components, you can select how many hardware
changes are allowed for each hardware item. Each time a user replaces a hardware item, its internal counter is
decreased by one. When one of these counters reach zero and a new hardware change happens, WinLicense
will show a custom message to indicate that no more hardware changes are allowed.
External Hardware
WinLicense can also lock licenses to a specific external hardware. At the moment, only U3 USB hardware
locking is available for external hardware, acting as a hardware dongle.
U3 USB devices have an internal and unique serial number that can be used by WinLicense to generate licenses
locked to a specific U3 USB device, giving the customer the chance to move the protected application (with
hardware locked license) across different computers.
When a license is locked to a specific U3 USB device, WinLicense requires that the U3 USB device is present
when the protected application is launched. If the customer wants to move to a new or different computer, he
just needs to plug the U3 USB device into the new computer.
Please, notice that U3 USB hardware locking is not available under Windows 9x/Me systems, a protected
application will return a null U3 USB hardware ID under Windows 9x/Me.
NOTE: Under Windows Vista, a U3 USB device takes about 10 to 15 seconds when it is plugged for the first
time after the system is restarted. If the U3 USB device has not returned the serial number in 2 seconds,
WinLicense will display the "MSGID37: Checking U3 USB device" (in Customized Dialogs panel) until the
serial number is fully retrieved (the message box is closed automatically). Of course, as any other message in
the customized dialog panel, you can change the text in the message or handle it via Control-Message-DLL or
disable it from being displayed.
How to get the Hardware ID
You can easily get the Hardware ID of any of your customers' PC:
1) Create an application which calls the WLHardwareGetId API. You can create a standalone application
which just calls that API or call it from inside your main application.
2) Select if you are going to lock your license to PC Hardware or External Hardware
3) Protect the above application. When the protected application is running, the WLGetHardwareId API
will return the real Hardware ID for the current machine.
2010 Oreans Technologies. All rights reserved
1.3.8 Password protection
Password protection
WinLicense Help File 30
2010 Oreans Technologies
This Password Protection form allows an application to be protected with user/password protection. WinLicense
will ask for a valid user/password to run the protected application.
Password Action
If you want to add extra protection when you add password protection into your protected application, you can
select the Encrypt EXE using the password hash option. This option adds additional hardness for possible
attackers to encrypt your application with user password. Your application will be encrypted with your Unique
Password hash that you selected in the SoftwareManager. In the unlikely event that a cracker patches the
password checking routine, your software will be decrypted with an wrong password and invalid data will be
decrypted. Note that this options can only be accepted if WinLicense handles your passwords when your
application is password protected in trial mode and registered mode.
You can select when and how a password will be requested when your application is running in trial (or normal)
mode and in registered mode. The following options are available for each kind of execution mode:
Never ask for password: This option prohibits WinLicense from displaying a password dialog when it
runs in the current mode.
I will ask for a password manually: If this option is enabled, you will take care of asking for a
valid user/name in order to continue executing your application. To check if an entered user/password
is correct you can make use of the WLPasswordCheck function.
Automatically, ask for a password only the first time: This option forces WinLicense to display a
dialog to request a valid user/password to continue running the protected application. The
user/password will be stored in the Windows Registry to avoid being re-entered every time.
Automatically, always ask for a password: This option forces WinLicense to display a dialog to
WinLicense 31
2010 Oreans Technologies
request a valid user/password to continue running the protected application. Every time that the
application is launched, a valid user/password will be requested.
2010 Oreans Technologies. All rights reserved
1.3.9 Advanced Options
Advanced Options
The Advanced Options panel allows you set up some options which are mainly relevant to some specific
applications and should be only modified by applications with special needs.
Encrypt Application
WinLicense Help File 32
2010 Oreans Technologies
This option will keep your protected application encrypted all the time till it is going to be executed. You should
always leave this option checked at least that you are doing special debugging over your protected application
to try to find some bugs.
Protect as DLL Plugin
Some DLLs are executed as plugin for third party applications and need special settings in most cases to be
able to cooperate correctly with the host application. If your DLL is used by a third party application, you
should enable this option in case that your protected DLL is not working correctly with the host application.
Export Specific Generators
This option will generate a specific license generator (in the application folder) when your protected application
is protected with Registration options.
Keep Trial Running
This option will keep your application running in trial mode is an invalid or expired license is found.
Launch Application when Trial Expired
This option will make WinLicense to launch an external application (located in the same folder as the protected
application) when the trial is expired. This option helps you to implement any desired action when an
application is expired, like running an external application which contact with your subscription server.
You can also invoke shell commands as name of the application to launch, like: start www.yourwebsite.com
Hide from PE Scanners
PE Scanners help an attacker to know which compressor/protector was used in an application. This option
change the common structure of WinLicense protected applications, making it harder for PE Scanners to detect
that an application was protected with Winicense. You can select between different obfuscation types to be
applied to your protected application.
.NET assemblies
This option is only valid for .NET applications. When this option is checked, SecureEngine will make more
checks over the assemblies of your application in order to detect any possible alteration of any of your
assemblies.
Active Context
Active Context DLLs do some special processing in their DLL main. This option should be always unchecked at
least that we recommend you to enable it in case that your DLL is incompatible with the protection system.
Custom Event
You can define a custom event to exclude the initialization of several protected applications at the same time.
This option is suitable when your application is launched many times per minute and you want to avoid any
side effects in the trial period of your application (like trial by number of executions)
Add Manifest
This option allows you to insert a manifest file or manifest information inside the protected application. You
should not use this option if your application does not really need the manifest information as it could generate
a non working application.
WinLicense 33
2010 Oreans Technologies
Splash screen settings
SecureEngine allows you to display a splash screen (in BMP-8 format) meanwhile the protection code is being
executed and your application is not yet started. The splash screen is ideal when the protection code takes
some time to boots up your application, displaying your splash screen meanwhile SecureEngine boots up your
application.
Localization
This option allows you to select the language for WinLicense user interface. Once you choose a different
language, you have to restart WinLicense to update the user interface to the selected language.
2010 Oreans Technologies. All rights reserved
1.3.10 Customized Dialogs
Customized Dialogs
WinLicense Help File 34
2010 Oreans Technologies
The Customized Dialog window allows changing the messages that may be shown by SecureEngine when
certain situations occur.
Changing a custom message
To change a custom message, double-click on a message. Note that the title on each MessageID is the context
in which the message could be shown.
Besides the custom message text, the icon that will appear when the message is shown on the screen could be
changed.
Changing the general caption for all messages
All messages are shown with a general caption that can also be customized. The general caption message is
the first message on the list, MsgId0: Global Caption. This caption message can be customized in the same
way as the rest of the messages, by double clicking it.
WinLicense 35
2010 Oreans Technologies
Importing and exporting your customized messages
WinLicense offers the possibility to export your customized messages to a single file so they can be imported in
other project files without the need of retype all the messages again. To export all your messages to a file you
just need to press the Export button and select the name of the file in which your messages will be saved.
When you want to import your customized messages to the current project file, just press the Import button
and select where the file with all your customized messages is located.
All messages are able to be edited. Each message has a global caption, its own text and one of Windows
standard message pictures: Error, Exclamation, and Information or has no picture.
Internal WinLicense Messages
The following table shows the description for each internal WinLicense message:
Message ID Description
WinLicense Help File 36
2010 Oreans Technologies
MsgID0: Global Caption Sets the default global caption for all messages
displayed by WinLicense.
MsgID1: Debugger found This message will be displayed when a
debugger is present in memory.
MsgID2: Monitor software found This message will be displayed when file or
registry monitoring software is detected in
memory.
MsgID3: Cracking tool found This message will be displayed when a
recognised cracking tool is detected in memory.
MsgID4: File corrupted This message will be displayed when a
protected application has tampering detected.
MsgID6: Cannot update oreans.sys driver (admin
rights)
This message will be displayed in case of failure
updating the WinLicense driver for Windows NT
platform. A common reason for this error is
insufficient system rights: the user needs to
have administrator's rights when the application
is launched by the first time.
MsgID7: Cannot open oreans.vxd driver (already in
use)
This message will be displayed in case of failure
when loading the WinLicense driver for Windows
9x systems.
MsgID8: Driver cannot be updated This message means that a protected program
is running in memory and it is using the
WinLicense driver. User will be prompted to
reboot the computer in order to finish the
installation of the driver. Another way to update
the driver is to find and close the protected
application that locked the driver.
MsgID9: Computer needs to be reset to install driver This message will appear in very early versions
of Windows NT, when the computer needs to be
rebooted to finish the installation of the
WinLicense driver.
MsgID10: Cannot write oreans.vxd (already in use) This message will be displayed when the
WinLicense driver is already in use by another
protected application in Windows 9x systems.
MsgID12: Internal exception occurred This message will be displayed in case of
unrecoverable internal error. Please, report
"(Address: 0x%x)" string inside the message to
help with bug fixing.
MsgID13: Virtual Machine Detected This message will be displayed when the
protected application is running under a virtual
machine system like VMware or VirtuaPC.
Trial/Registration Messages
[OPTION: Will be displayed by WinLicense / Displayed by SDK or not displayed]
For each possible trial/registration message, you can select which message will be handled by WinLicense and
which one does not need to be handled or you handle it from your application (using WinLicense SDK). We
recommend you check each message one by one and enable/disable handling for them. After that, save your
configuration into your current project.
The following table shows the description for each trial/registration message:
Message ID Description
WinLicense 37
2010 Oreans Technologies
MsgID14: Trial nag screen (reminder) This message will be displayed every time users
start your application while it is running in trial
mode.
MsgID15: Trial days expired This message is displayed by WinLicense when
the trial period (number trial days) of your
application has expired.
MsgID16: Trial executions expired This message is displayed by WinLicense when
the trial period (number of executions allowed)
of your application has expired.
MsgID17: Trial date expired This message is displayed by WinLicense when
the trial period (expiration date) of your
application has expired.
MsgID18: Trial runtime expired This message is displayed by WinLicense when
your application has stayed in memory for a
previously limited number of minutes.
MsgID19: Trial global time expired This message is displayed by WinLicense when
your application has been executed for
previously limited number of minutes.
MsgID20: Trial locked to different country This message is displayed by WinLicense if you
have locked your application to a specific
country and the user tries to start it from
another country.
MsgID21: Trial extension key corrupted This message is displayed by WinLicense when
an invalid trial extension key is found.
MsgID22: No more trial extensions allowed This message is displayed by WinLicense to
inform the user that he has exhausted all trial
extensions available. New trial extension keys
will be discarded.
MsgID23: Show registration info (only first time when
registered)
This message is displayed by WinLicense the
first time an application is registered.
MsgID24: License days expired This message is displayed by WinLicense when
a valid license key has expired (no days left).
The application will run in trial mode after this
condition and it can be registered again with a
new license key.
MsgID25: License executions expired This message is displayed by WinLicense when
a valid license key has expired (no executions
left). The application will run in trial mode after
this condition and it can be registered again
with a new license key.
MsgID26: License date expired This message is displayed by WinLicense when
a valid license key has expired (expiration date
arrived). The application will run in trial mode
after this condition and it can be registered
again with a new license key.
MsgID27: License global time expired This message is displayed by WinLicense when
a valid license key has expired (no more
minutes left). The application will run in trial
mode after this condition and it can be
registered again with a new license key.
MsgID28: License key corrupted This message is displayed by WinLicense when
a corrupted license key found.
MsgID29: License locked to different machine This message is displayed by WinLicense when
a previously locked license is running in an
unauthorized computer.
MsgID30: License without machine locking This message is displayed by WinLicense when
an application is going to be registered using a
non machine dependent key. This message is
WinLicense Help File 38
2010 Oreans Technologies
Variables in WinLicense messages
In all trial/registration messages you can insert the following variables that will be replaced with corresponding
values:
Variable Name Description
%daysleft Number of days left for current trial period.
%execleft Number of executions left for current trial
period.
%totaldays Total days for current trial period.
%totalexec Total executions for current trial period.
%expdate Expiration date for current trial period.
Displayed date format is "dd/mm/yyyy".
%name Registered user's name for current license key.
%company Registered user's company for current license
key.
%machineid Current Hardware ID for current machine.
NOTE: All variables must go in lowercase.
Control Messages from External DLL
WinLicense gives you the chance to fully control each specific message and do the action that you consider
when a message is going to be displayed. You just need to create a DLL which exports at least a function that
will be called by WinLicense when a message is going to be displayed. The function that will handle your
messages must be selected in the Functions Handlers (SE_ProcessMessage) panel, so WinLicense will know
which function needs to be called in runtime.
WinLicense will embed your DLL inside the protected application and it will be never written to disk, so you
don't have to ship your DLL separately, keeping it hidden from the prying eyes.
The possibilities to do from your function handler in your DLL are countless. For example, you can customize
all the message for different languages, send an email when a specific message is displayed, etc.
The exported function to handle your messages from your DLL must have the following prototype:
STDCALL bool MsgHandler(
int MsgI d,
char* MsgBody);
function MsgHandler(
MsgI d: Integer;
MsgBody: PChar
):Boolean; stdcall;
Parameters
MsgId
[in] Identifier for the message that is going to be displayed. The message ID is the one that appears on
the left for each specific message in the Customized Dialog panel.
MsgBody
[in] Pointer to a null-terminated string with the message that is going to be displayed.
WinLicense 39
2010 Oreans Technologies
Return Values
If the function handles the message, you should return True, so WinLicense will not display the message.
If the function does not handle the message or you want WinLicense to display the message, you should return
False.
Remarks
When the protection engine is going to start, WinLicense will call your message handler function with "MsgId =
-1, MsgBody = null", so, you have the chance to do any initialization task that you need (or simply display your
own splash screen). When WinLicense has finished initializing the protection and your application is going to
take control of the CPU, WinLicense will call your message handler function with "MsgId = -2, MsgBody = null",
in case that you require any finalization task.
2010 Oreans Technologies. All rights reserved
1.3.11 Protect Now
Protect Now
When you are done setting your protection options all you need to do is press the Protect button in the main
toolbar to start the protection phase. A new window will appear to show you the current progress of the
protection phase.
You can cancel or resume the protection phase at any time and launch the protected application directly from
this window in order to test if the protected application works as desired.
WinLicense Help File 40
2010 Oreans Technologies
Export specific generators to App. folder
If you don't want to create your license, trial extension and password keys using the WinLicense user interface
or a custom license generator, you can check the "Export specific generators to App. folder" option and
WinLicense will generate a folder in the same directory where the protected application resides. The name of
this folder is Specific Generators and it contains the following subfolders:
EXE (folder): This folder contains an already compiled application that will generate valid keys only
for your application. You can carry this application to any other computer to generate your license
keys. The advantages of using this generated application is that you don't have to use the WinLicense
user interface to generate your keys and it also saves you from creating a specific license generators
using the WinlicenseSDK.dll file.
DLL (folder): This folder contains a special DLL called CustomWinLicenseSDK.dll which is in fact the
same DLL as WinLicenseSDK.dll but with all your application hashes (trial, registration, password)
included. So, you don't have to pass your hashes to the generatorsfunctions but just omit that
parameter. That means that all generatorfunctions receive one parameter less (the first parameter
is omit).
Trial in debug Mode (for testing purposes)
WinLicense has a sophisticated system (Trial Storing Manager) to store the current trial information in a
WinLicense 41
2010 Oreans Technologies
computer. The Trial Storing Manager will protect against a possible attacker reseting the trial period in a
protected application in order to extend the usage of it. For each protected application, the Trial Storing
Manager stores different amount of information in the computer where the protected application is running.
To avoid making use of the sophisticated Trial Storing Manager storing unnecessary information in your system
while you are testing your protected application before the final release, you should check the option "Trial in
Debug Mode". When you are going to release your application to the public, you must uncheck this option
to enable the Trial Storing Manager in your application.
2010 Oreans Technologies. All rights reserved
1.3.12 Protecting through the command line
Protecting through the command line
WinLicense can be used to protect your files through the command line in order to include the protection of
your application on all of your build systems.
First you need to create a WinLicense project from the user interface. To create this project file, you need to
start the WinLicense user interface and set up the protection options that you want to include in your
application. After that you can invoke the following command in the command line to protect your application:
WinLicense /protect Your Pr oj ect
One of the following codes will be returned:
0 protection was successful.
1 Project file does not exist or invalid.
2 File to protect cannot be opened.
3 File already protected.
4 Error in inserted SecureEngine macros.
5 Fatal error while protecting file.
6 Cannot write protected file to disk.
Note: When command line protection is invoked under Windows XP, you will be able to see information about
each protection stage in the current console.
Protecting in Trial Debug mode
If you want to protect your applications from the command line with Trial Debug mode (for testing purposes) ,
you have to specify the /trialdebug option. Example:
WinLicense /trialdebug /protect Your Pr oj ect
Load a project file from the command line
WinLicense also allows you to load a project into the user interface through the command line. To do this you
have to invoke WinLicense in the following way:
WinLicense Help File 42
2010 Oreans Technologies
WinLicense Your Pr oj ect
After this, WinLicense user interface will appear with all the information contained in your project file and is
ready to protect your applications.
Protecting a different application from the one in a project file
You can specify a different input and output application from the one that is stored in your project file when
protecting via command line. Example:
WinLicense /protect Your Pr oj ect Fi l e / i nput f i l e YourInputApplication.exe
/ out put f i l e YourProtectedApplication.exe
Protecting a different software from the one in a project file
You can specify a different software from the one that is stored in your project file when protecting via
command line. Example:
WinLicense /protect Your Pr oj ect Fi l e / sof t war e YourSoftware / ver si on 1.0
If you don't have a version number in your software, do not include the "/version" switch in the command line.
Protecting an application with a configuration INI file
You can specify a .INI file to set up each protection option from the command line. It's still require that you
pass a project file but all the options in the .INI file will override the options in the project file. Notice that
WinLicense creates a .INI file (with all customized options) each time that you save your project file. Example:
WinLicense /protect YourProjectFile /inifile Path_IniFile
Protecting an application with an XML project file
In WinLicense, you can export your current project into XML format (in top menu "Project --> Export to XML
file"). You can edit your XML project file as desired and protect it via command line. Example:
WinLicense /protect YourProject.xml
WinLicense detects your XML project file from the ".xml" extension. You must leave the '.xml' extension in
order to be recognized by WinLicense as a XML project file.
Example of command line processing in a BAT file
The following example shows a BAT file that can be included in your build system to protect your applications
through the command line:
WinLicense 43
2010 Oreans Technologies
@echo off
start /w WinLicense /protect Your Pr oj ect
if errorlevel 3 goto 3
if errorlevel 2 goto 2
if errorlevel 1 goto 1
if errorlevel 0 goto 0
goto done
:0
echo Application protected successfully
goto done
:1
echo ERROR: File already protected
goto done
:2
echo ERROR: File to protect cannot be opened
goto done
:3
echo ERROR: An internal error occurred while protecting
:done
2010 Oreans Technologies. All rights reserved
1.4 SecureEngine Macros
SecureEngine macros
The SecureEngine Macros allow you to interact with your application using SecureEngine, making your
application and SecureEngine run as a single unit.
To include SecureEngine Macros into your application, you need to specify these macros in your application
source code. When SecureEngine is going to protect your application, it will find these macros inside your
application and apply the required action to each specific macro.
The different macros that SecureEngine offers to software developers are the following:
Usingmacrosinyourprogramminglanguage
VMmacro
CodeReplacemacro
Encodemacro
Clearmacro
WinLicense Help File 44
2010 Oreans Technologies
Registeredmacro
RegisteredVMmacro
Unregisteredmacro
Unprotectedmacro
CheckProtectionmacro
CheckCodeIntegritymacro
CheckRegistrationmacro
CheckVirtualPCmacro
WhichMacrosshouldIuse?
2010 Oreans Technologies. All rights reserved
1.4.1 Using macros in your programming language
Using macros in your programming language
The current version of WinLicense supports macros for the following programming languages: C/C++, Delphi
and Visual Basic. Please note that these macros are not available for .NET languages or Visual Basic compiled
in PCode mode.
To apply a macro to a specific block of code, you have to mark the beginning of the block with the
"MacroName_START" delimiter and the end of the block using the "MacroName_END" delimiter.
Restrictions
A few conditions need to be satisfied in order to successfully insert SecureEngine macros into your
application. If any of these conditions are not fulfilled, WinLicense will show an error message when opening
the file to be protected. The conditions are the following:
Macros cannot be nested, that is, a macro cannot be inserted inside another macro.
Each macro needs to have each corresponding "MacroName_END" delimiter.
No more than 1500 macros of each type can be inserted in a single application.
The code inside the macro must be at least 4 bytes in size.
Usage for specific programming languages
For Delphi, SecureEngine macros appear as an external include file that will inserted with a parameter
directive, {$I filename}. The included file will insert a special sequence of assembly code right after the {$I
WinLicense 45
2010 Oreans Technologies
filename} directive. That sequence of assembly code will be detected and replaced by SecureEngine in the
protection phase.
These include files are already defined in the "WinLicense include" directory and you can copy them to your
application directory or provide the full path to your WinLicense installation directory where they are located.
In the following we present a real example of how to use SecureEngine macros in your Delphi application.
function TfmMain.GetCRC32(FileName: string): string;
begin
{$I Encode_Start.inc} // the following block of code is protected
with an "Encode" macro
BuildCRCTable;
CRC := $FFFFFFFF;
AssignFile(F, FileName);
FileMode := 0;
Reset(F);
{$I Encode_End.inc} // end of "Encode" macro
GetMem(Buffer, SizeOf(B));
{$I CodeReplace_Start.inc} // the following block of code is protected
with a "CodeReplace" macro
repeat
FillChar(b, SizeOf(b), 0);
BlockRead(F, b, SizeOf(b), e);
for i := 0 to (e-1) do
CRC := RecountCRC(b[i], CRC);
until (e < 255) or (IOresult <> 0);
{$I CodeReplace_End.inc} // end of "CodeReplace" macro
{$I Encode_Start.inc} // the following block of code is protected
with an "Encode" macro
FreeMem(Buffer, SizeOf(B));
CloseFile(F);
CRC := Not CRC;
Result := '$' + HextL(CRC);
{$I Encode_End.inc} // end of "Encode" macro
end;
For the C/C++ language these macros are defined as a "#define" clause that will emit a special sequence of
assembly code that will be detected by SecureEngine in the protection phase. To insert these macros, you
need to include the "WinLicenseSDK.h" in your application source code. This file can be found in the "include"
subdirectory in your WinLicense installation directory.
Following will demonstrate a real example of how to use SecureEngine macros in your C/C++ application.
WinLicense Help File 46
2010 Oreans Technologies
LRESULT CALLBACK MainHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{
switch (message)
{
case WM_INITDIALOG:
CODEREPLACE_START // the following block of code
is protected with a "CodeReplace" macro
if (WLRegGetStatus(NULL) == 1)
{
WLRegGetLicenseInfo(Name, Company, ExtraData);
SetDlgItemText(hDlg, IDC_NAMEEDIT, Name);
SetDlgItemText(hDlg, IDC_COMPANYNAME, Company);
SetDlgItemText(hDlg, IDC_EXTRAEDIT, ExtraData);
}
CODEREPLACE_END // end of "CodeReplace" macro
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDCANCEL)
{
ENCODE_START // the following block of code
is protected with an "Encode" macro
EndDialog(hDlg, LOWORD(wParam));
ENCODE_END // end of "Encode" macro
return TRUE;
}
break;
}
return FALSE;
}
For Visual Basic these macros appear as a special Visual Basic instruction that will be detected by
SecureEngine during the protection phase. Note that the name of the macro must go in uppercase in order to
be recognized by SecureEngine.
In the following we present a real example of how to use SecureEngine macros in your Visual Basic
application.
WinLicense 47
2010 Oreans Technologies
Private Sub CheckStatusButton_Click()
If AppStatus <> 1 Then
Call VarPtr("CODEREPLACE_START")
TrialDaysLeftLabel.Caption = WLTrialDaysLeft
TrialExecLeftLabel.Caption = WLTrialExecutionsLeft
MinutesLabel.Caption = WLTrialGlobalTimeLeft
RuntimeLabel.Caption = WLTrialRuntimeLeft
Call VarPtr("CODEREPLACE_END")
Else
Call VarPtr("ENCODE_START")
WLRegGetLicenseInfo RegName, RegCompany, RegCustom
NameEdit.Text = RegName
CompanyEdit.Text = RegCompany
CustomEdit.Text = RegCustom
RegDaysLeftLabel.Caption = WLRegDaysLeft
RegExecLeftLabel.Caption = WLRegExecutionsLeft
Call VarPtr("ENCODE_END")
End If
End Sub
2010 Oreans Technologies. All rights reserved
1.4.2 VM macro
VM macro
The VM macro allows you to mark regions of code that will be executed inside the SecureEngine Virtual
Machine. When the CPU is going to execute the code inside your VM macro, SecureEngine will take control
and will emulate the original code inside the macro with virtual opcodes that only the SecureEngine Virtual
machine can understand.
We strongly recommend the use of this macro whenever possible, due to its flexibility and continuos
improvement in the internal protection of these macros.
The VM macro can be used in DLLs without having to worry about the relocations problem that is introduced
with the other macros (ENCODE, CLEAR...). The internal virtual machine is able to handle all relocations data
that is inside a VM macro.
WinLicense Help File 48
2010 Oreans Technologies
The VM macro can have "return" (C/C++), "Exit" (Delphi) statements inside the macro.
NOTE: The current version of SecureEgine does not support this macro for .NET languages or Visual Basic
compiled in PCode mode.
{$I VM_Start.inc}
// your code goes here
{$I VM_End.inc}
VM_START
// your code goes here
VM_END
Call VarPtr("VM_START")
' your code goes here
Call VarPtr("VM_END")
Remarks
To make sure that you have inserted a VM macro in a right place in your application, you should be aware of
the following details:
To avoid a decrease in your program performance when protected the code inside the macro, you
should avoid tight loops (FOR, WHILE, DO...) inside the VM macro.
Switch statements inside the macro might not work properly in some compiled applications. Notice
that Switch statements are named in a different way in different programming languages ("Case" -->
Delphi, "Select Case" --> VB, etc).
Exception handling inside the macro will not work properly. You should avoid putting VM macros
around try-except clauses. For Visual Basic, "try-except" clauses corresponds to "On Error"
statements.
VM Macros with custom Virtualization Level
If you want to make things much harder for an attacker, you can specify the virtualization level for each
macro. This virtualization level will mutate the original instructions inside the VM markers and will convert the
mutated code into virtual machine opcodes. The use of the virtualization level is not necessary as the current
virtual machine implementation is hard enough for an attacker, but if you really desire to make things much
harder you can specify a virtualization level for specific macros.
The Virtualization Level can be set from 0 to 255. If you set it to 0, the result will be exactly the same as using
the VM_START macro. We do not recommend to use virtualization levels bigger than 20 as the generated
virtual machine code will make your protected application bigger. Of course, everything depends on the size of
the code inside the markers and the number of macros that you desire to virtualize.
The following example shows the use of the VM macro with virtualization level.
WinLicense 49
2010 Oreans Technologies
VM_START_WITHLEVEL(5)
' the code here will be mutated with level 5 and converted into virtual machine
code
VM_END
VM_START_WITHLEVEL(12)
' the code here will be mutated with level 12 and converted into virtual
machine code
VM_END
VM_START_WITHLEVEL(0)
' The code here is converted into virtual machine code directly, this is like
the VM_START macro
VM_END
Remarks
To enable the VM macro with Virtualization Level, you must activate the option "Dynamic Opcodes" in the
Virtual Machine Panel. If you don't activate that option, the virtualization level will be set to 0, no matter which
level you set.
2010 Oreans Technologies. All rights reserved
1.4.3 CodeReplace macro
CodeReplace Macro
The CODEREPLACE macro allows you to mark sections of code that will replaced by the
CodeReplacetechnology.
When your application is going to be protected, SecureEngine will find all the CodeReplace macros that you
inserted into your application. All of these macros can be seen in the CodeReplacepanel and you will be able
to set and unset them to be processed by the CodeReplace technology.
In newer versions, the CodeReplace macro is quite similar to the VM macro, so it has all the benefits and
restrictions as VMmacros have.
NOTE: The current version of SecureEgine does not support this for .NET languages or Visual Basic compiled
in PCode mode.
{$I CodeReplace_Start.inc}
// your code goes here
{$I CodeReplace_End.inc}
WinLicense Help File 50
2010 Oreans Technologies
CODEREPLACE_START
// your code goes here
CODEREPLACE_END
Call VarPtr("CODEREPLACE_START")
' your code goes here
Call VarPtr("CODEREPLACE_END")
2010 Oreans Technologies. All rights reserved
1.4.4 Encode macro
Encode macro
The ENCODE macro allows you to mark regions of code that will be encrypted until that code is going to be
executed. When the CPU is going to execute the code inside your ENCODE macro, SecureEngine will take
control and decrypt the code inside the macro. Once the code inside the macro is executed, SecureEngine
will take the control of the CPU to encrypt it again.
To learn more about how this technology works, read CodeEncrypttechnology.
NOTE: The current version of SecureEgine does not support this for .NET languages or Visual Basic compiled
in PCode mode.
{$I Encode_Start.inc}
// your code goes here
{$I Encode_End.inc}
ENCODE_START
// your code goes here
ENCODE_END
Call VarPtr("ENCODE_START")
' your code goes here
Call VarPtr("ENCODE_END")
WinLicense 51
2010 Oreans Technologies
Remarks
To make sure that you have inserted an Encode macro in a right place in your application, you should be aware
of the following details:
To avoid a decrease in your program performance when protected the code inside the macro should
not be executed multiple times per second. As different from VM and CodeReplace macros, you can
include tight loops inside ENCODE macros.
This macro can be used in DLLs when there are no relocated references inside the macro. To avoid
this restriction for DLLs, you should use VMmacros instead.
You have to make sure that every time that the code inside the macro is executed, the
ENCODE_END macro is alse executed (to encrypt the code again). In the next section you can see
an example of this restriction.
This macro is not thread-safe.
Bad Insertion of an Encode macro
Consider the following example:
function MyFunction(MyParam1:Integer);
begin
....
....
{$I Encode_Start.inc} // The ENCODE_START macro will decrypt the code inside
ENCODE_START - ENCODE_END
if (MyParam1 = 2) then begin
Return := 1;
Exit; // <--- ERROR, we transfer the control outside the macro
and
// ENCODE_END clause is not executed
end
else begin
Result := MyParam1:Integer;
end;
{$I Encode_End.inc} // The ENCODE_END macro will encrypt again the code
inside ENCODE_START - ENCODE_END
...
...
end;
WinLicense Help File 52
2010 Oreans Technologies
int MyFunction(int MyParam1)
{
int Result;
...
...
ENCODE_START // The ENCODE_START macro will decrypt the code inside
ENCODE_START - ENCODE_END
if (MyParam1 == 2)
{
return 1; // <--- ERROR, we transfer the control outside the macro and
ENCODE_END clause is not executed
}
else
{
Result = MyParam1 * 6;
}
ENCODE_END // The ENCODE_END macro will encrypt again the code inside
ENCODE_START - ENCODE_END
...
...
}
Public Function MyFunction(ByVal MyParam1 As Integer) As Integer
...
...
Call VarPtr("ENCODE_START") ' The ENCODE_START macro will decrypt the code inside
ENCODE_START - ENCODE_END
If MyParam1 = 2 Then
MyFunction = 1
Exit Function ' <--- ERROR, we transfer the control outside the macro
and ENCODE_END clause is not executed
Else
MyFunction = MyParam1 * 6
End If
Call VarPtr("ENCODE_END") ' The ENCODE_END macro will encrypt again the code inside
ENCODE_START - ENCODE_END
...
...
End Function
As you can see, the instruction "Exit" in Delphi (or "return 1;" in C/C++, or "Exit Function" in Visual Basic)
will return the control outside the macro, avoiding the execution of the ENCODE_END macro. In this case, the
code inside the macro will not be encrypted again, leaving it decrypted. In case that the control of the CPU is
transfered again to that macro, the ENCODE_START macro will try to decrypt the alreadydecrypted code,
leaving the code invalid and causing possible exceptions in the execution of your application.
If you want to use Exit/return statements inside the macro, you should use VMmacros instead.
WinLicense 53
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.4.5 Clear macro
Clear macro
The CLEAR macro allows you to mark regions of code that will be encrypted and removed when they have
been executed. These macros are extremely good at preventing the re-construction of blocks of code that has
already been executed by your application.
These macros should only be placed in regions of code that are executed once in your application. If the macro
is re-executed, the code inside the macro will not be executed anymore and it will be "jumped" instead (to
avoid execution of the destroyed code after first execution). These macros could be used to protect
initialization/termination/create/destroy events of class objects which are executed only once during the life of
each object.
You should avoid this macro to be used in DLLs due to the relocations problem, you should use VMmacros
instead.
To learn more about how this technology works, ClearCodetechnology.
NOTE:The current version of SecureEgine does not support this function to be called for .NET languages or
Visual Basic compiled in PCode mode.
{$I Clear_Start.inc}
// your code goes here
{$I Clear_End.inc}
CLEAR_START
// your code goes here
CLEAR_END
Call VarPtr("CLEAR_START")
' your code goes here
Call VarPtr("CLEAR_END")
2010 Oreans Technologies. All rights reserved
WinLicense Help File 54
2010 Oreans Technologies
1.4.6 Registered macro
Registered macro
The REGISTERED macro allows you to mark regions of code that will be executed when your application is
registered. If your application is not registered, these regions of code will be kept encrypted. When your
application is registered and one of these regions of code is going to be executed, SecureEngine will decrypt
that region of code with the registration information from the present license key. This macro offers a strong
technique to avoid attackers from retrieving the encrypted block without having a valid license key.
NOTE:The current version of SecureEgine does not support this function to be called for .NET languages or
Visual Basic compiled in PCode mode.
{$I Registered_Start.inc}
// your code goes here
{$I Registered_End.inc}
REGISTERED_START
// your code goes here
REGISTERED_END
Call VarPtr("REGISTERED_START")
' your code goes here
Call VarPtr("REGISTERED_END")
2010 Oreans Technologies. All rights reserved
1.4.7 RegisteredVM macro
RegisteredVM macro
The REGISTEREDVM macro allows you to mark regions of code that will be executed when your application is
registered. If your application is not registered your application will hang or crash when the macro is
executing. You should make sure that your application is registered (using WLRegGetStatus) before executing
code inside this macro. This macro is a double check for hidden attacks against the registration status.
The code inside the macro is executed inside the Virtual Machine, so you should avoid tight loops or critical
code (executed many times per second) inside the macro.
NOTE:The current version of SecureEgine does not support this function to be called for .NET languages or
WinLicense 55
2010 Oreans Technologies
Visual Basic compiled in PCode mode.
if Registered then
begin
{$I RegisteredVM_Start.inc}
// your code goes here
{$I RegisteredVM_End.inc}
end;
if (Registered)
{
REGISTEREDVM_START
// your code goes here
REGISTEREDVM_END
}
If Registered Then
Call VarPtr("REGISTEREDVM_START")
' your code goes here
Call VarPtr("REGISTEREDVM_END")
End If
2010 Oreans Technologies. All rights reserved
1.4.8 Unregistered macro
Unregistered macro
The UNREGISTERED macro allows you to mark regions of code that will be executed when your application is
running in trial mode. If your application is registered, these regions of code will be kept encrypted. When your
application is running in trial mode and one of these regions of code is going to be executed, SecureEngine
will decrypt that region of code.
NOTE:The current version of SecureEgine does not support this function to be called for .NET languages or
Visual Basic compiled in PCode mode.
WinLicense Help File 56
2010 Oreans Technologies
{$I Unegistered_Start.inc}
// your code goes here
{$I Unegistered_End.inc}
UNREGISTERED_START
// your code goes here
UNREGISTERED_END
Call VarPtr("UNREGISTERED_START")
' your code goes here
Call VarPtr("UNREGISTERED_END")
2010 Oreans Technologies. All rights reserved
1.4.9 Unprotected macro
Unprotected macro
The UNPROTECTED macro allows you to mark regions of code that will be ONLY executed when your
application is not yet protected. Once your application is protected, the code inside the macro will not be
executed. This macro is only necessary to avoid releasing unprotected applications by mistake.
NOTE:The current version of SecureEgine does not support this function to be called for .NET languages or
Visual Basic applications.
{$I Unprotected_Start.inc}
// your code goes here
{$I Unprotected_End.inc}
UNPROTECTED_START
// your code goes here
UNPROTECTED_END
WinLicense 57
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.4.10 CheckProtection macro
CheckProtection macro
The CHECK_PROTECTION macro allows you to check if your application has been partially unpacked or some
protection engines have been attacked by a cracker. This macro offers communication between the protected
application and the SecureEngine protection.
NOTE: The current version of SecureEgine does not support this macro for .NET languages or Visual Basic
applications.
The CHECK_PROTECTION macro can be called from inside other macros. In fact, it's highly recommend to call
the CHECK_PROTECTION macro from inside VM or CodeReplace macros.
The CHECK_PROTECTION macro has a special syntax:
CHECK_PROTECTION (user_variable, user_value)
Where "user_variable" is any local or global variable in the application and "user_value" is any immediate
value (constant value). The way that it works is the following:
The CHECK_PROTECTION macro is called.
SecureEngine takes control of the processor and make special checks to know if the application has
been tampered.
If the application is not tampered, SecureEngine sets "user_variable" equal to "user_value".
If the application is tampered, SecureEngine sets "user_variable" to something different from
"user_value".
SecureEngine returns control to the protected application. The protected application should check the
value of "user_variable" and execute the desired action if the application has been tampered.
If you detect that your application has been tampered, please, consider the following practices:
Avoid taking an immediate action, like displaying a message or crashing the application. If you take
an immediate action, the cracker will know where the problematic code is located and will focus all his
attention at that point, trying to figure out the root of the problem in that code.
Avoid displaying messages saying that the application has been tampered. Instead, make a "late"
crash (see below) or display a strange error message at a later point in your application.
Produce a "late crash" or malfunction. That is, if you detect that your application has been tampered,
you mark special variables (or similar action) in your code. At a later point in your application, you
crash your application or initialize further structures in a wrong way, so, your application won't work
as expected. For example, suppose that you are protecting a CD burning application. When your
application is initializing, you call "CHECK_PROTECTION" macro to determine if the application is
tampered or not. If it's tampered, you won't take any action yet, but instead, you will wait for the CD
recording process to burn random or incorrect data into the CD.
Use VM or CodeReplace macros in all those places where you call CHECK_PROTECTION and where
you check if the application was tampered. Also, if you decide to produce a "late" crash or
malfunction, that code which produces the crash or malfunction should go inside VM or CodeReplace
macros.
WinLicense Help File 58
2010 Oreans Technologies
int MyCheckVar;
VM_START
// your code goes here
CHECK_PROTECTION(MyCheckVar, 0x12345678)
// your code goes here
if (MyCheckVar != 0x12345678)
printf("We are tampered!");
VM_END
var
MyCheckVar: Integer;
begin
{$I VM_Start.inc}
// your code goes here
{$I CheckProtection_Prolog.inc}
asm
push 11111111 // 11111111 is our special constant
pop MyCheckVar // SecureEngine will set "MyCheckVar" to
11111111 if protection is OK
end;
{$I CheckProtection_Epilog.inc}
// your code goes here
if MyCheckVar <> 11111111 then
ShowMessage("We are tampered!");
{$I VM_End.inc}
Advises about how to use this macro
Put the CHECK_PROTECTION macro inside VM or CodeReplace macros.
Think always that the first attack from a cracker is just directly jump over your VM / CodeReplace
macro (that is, the code inside the macro is not executed), so you should make sure that inside the
macro you put code that is necessary for your application to run correctly.
You don't have to call the CHECK_PROTECTION macro periodically, just make sure that it's executed
at any time in your application.
You can put as many CHECK_PROTECTION macros as desired, but we recommend you just putting a
few of them (about 5 of them) in different routines in your application.
2010 Oreans Technologies. All rights reserved
WinLicense 59
2010 Oreans Technologies
1.4.11 CheckCodeIntegrity macro
CheckCodeIntegrity macro
The CHECK_CODE_INTEGRITY macro allows you to check if the code section of your protected application
has been patched in runtime (using for example an memory patcher). This macro offers communication
between the protected application and the SecureEngine protection.
NOTE: The current version of SecureEgine does not support this macro for .NET languages or Visual Basic
applications.
The CHECK_CODE_INTEGRITY macro can be called from inside other macros. In fact, it's highly recommend to
call the CHECK_CODE_INTEGRITY macro from inside VM or CodeReplace macros.
The CHECK_CODE_INTEGRITY macro has a special syntax:
CHECK_CODE_INTEGRITY (user_variable, user_value)
Where "user_variable" is any local or global variable in the application and "user_value" is any immediate
value (constant value). The way that it works is the following:
The CHECK_CODE_INTEGRITY macro is called.
SecureEngine takes control of the processor and make special checks to know if the code section of
your application has been patched.
If the code section of the application is not patched, SecureEngine sets "user_variable" equal to
"user_value".
If the application is patched, SecureEngine sets "user_variable" to something different from
"user_value".
SecureEngine returns control to the protected application. The protected application should check the
value of "user_variable" and execute the desired action if the code section of the application has been
patched.
If you detect that the code section of your application has been tampered, please, consider the following
practices:
Avoid taking an immediate action, like displaying a message or crashing the application. If you take
an immediate action, the cracker will know where the problematic code is located and will focus all his
attention at that point, trying to figure out the root of the problem in that code.
Avoid displaying messages saying that the application has been tampered. Instead, make a "late"
crash (see below) or display a strange error message at a later point in your application.
Produce a "late crash" or malfunction. That is, if you detect that your application has been tampered,
you mark special variables (or similar action) in your code. At a later point in your application, you
crash your application or initialize further structures in a wrong way, so, your application won't work
as expected. For example, suppose that you are protecting a CD burning application. When your
application is initializing, you call "CHECK_CODE_INTEGRITY" macro to determine if the application
code is patched or not. If it's patched, you won't take any action yet, but instead, you will wait for the
CD recording process to burn random or incorrect data into the CD.
Use VM or CodeReplace macros in all those places where you call CHECK_CODE_INTEGRITY and
where you check if the application code was patched. Also, if you decide to produce a "late" crash or
malfunction, that code which produces the crash or malfunction should go inside VM or CodeReplace
macros.
WinLicense Help File 60
2010 Oreans Technologies
int MyCheckVar;
VM_START
// your code goes here
CHECK_CODE_INTEGRITY(MyCheckVar, 0x12345678)
// your code goes here
if (MyCheckVar != 0x12345678)
printf("Application code is patched!");
VM_END
var
MyCheckVar: Integer;
begin
{$I VM_Start.inc}
// your code goes here
{$I CheckCodeIntegrity_Prolog.inc}
asm
push 11111111 // 11111111 is our special constant
pop MyCheckVar // SecureEngine will set "MyCheckVar" to
11111111 if protection is OK
end;
{$I CheckCodeIntegrity_Epilog.inc}
// your code goes here
if MyCheckVar <> 11111111 then
ShowMessage("We are tampered!");
{$I VM_End.inc}
Advises about how to use this macro
Put the CHECK_CODE_INTEGRITY macro inside VM or CodeReplace macros.
You should call the CHECK_CODE_INTEGRITY at specific points in your application code. You could
also call it from a thread which calls that macro once every few (10-20) seconds.
2010 Oreans Technologies. All rights reserved
WinLicense 61
2010 Oreans Technologies
1.4.12 CheckRegistration macro
CheckRegistration macro
The CHECK_REGISTRATION macro allows you to check if your application has been registered with a valid
license key. You can also know if your application is registered via WLRegGetStatus. The
CHECK_REGISTRATION macro can be used as a double check to make sure that your application has not been
tampered.
NOTE: The current version of SecureEgine does not support this macro for .NET languages or Visual Basic
applications.
The CHECK_REGISTRATION macro can be called from inside other macros. In fact, it's highly recommend to
call the CHECK_REGISTRATION macro from inside VM or CodeReplace macros.
The CHECK_REGISTRATION macro has a special syntax:
CHECK_REGISTRATION (user_variable, user_value)
Where "user_variable" is any local or global variable in the application and "user_value" is any immediate
value (constant value). The way that it works is the following:
The CHECK_REGISTRATION macro is called.
SecureEngine takes control of the processor and make special checks to know if your application is
correctly registered.
If your application is correctly registered, SecureEngine sets "user_variable" equal to "user_value".
If the application is not registered, SecureEngine sets "user_variable" to something different from
"user_value".
SecureEngine returns control to the protected application. The protected application should check the
value of "user_variable" and execute the desired action if the application is not registered.
int MyCheckVar;
VM_START
// your code goes here
CHECK_REGISTRATION(MyCheckVar, 0x12345678)
// your code goes here
if (MyCheckVar != 0x12345678)
printf("Application is not registered");
VM_END
WinLicense Help File 62
2010 Oreans Technologies
var
MyCheckVar: Integer;
begin
{$I VM_Start.inc}
// your code goes here
{$I CheckRegistration_Prolog.inc}
asm
push 11111111 // 11111111 is our special constant
pop MyCheckVar // SecureEngine will set "MyCheckVar" to
11111111 if application is registered
end;
{$I CheckRegistration_Epilog.inc}
// your code goes here
if MyCheckVar <> 11111111 then
ShowMessage("Application is not registered!");
{$I VM_End.inc}
2010 Oreans Technologies. All rights reserved
1.4.13 CheckVirtualPC macro
CheckVirtualPC macro
The CHECK_VIRTUAL_PC macro allows you to check if your application is running under VMWare/VirtualPC.
NOTE: The current version of SecureEgine does not support this macro for .NET languages or Visual Basic
applications.
The CHECK_VIRTUAL_PC macro can be called from inside other macros.
The CHECK_VIRTUAL_PC macro has a special syntax:
CHECK_VIRTUAL_PC (user_variable, user_value)
Where "user_variable" is any local or global variable in the application and "user_value" is any immediate
value (constant value). The way that it works is the following:
The CHECK_VIRTUAL_PC macro is called.
SecureEngine takes control of the processor and make special checks to know if your application is
running under VMWare/VirtualPC.
If your application is not running under VMWare/VirtualPC, SecureEngine sets "user_variable" equal
to "user_value".
If the application is running under VMWare/VirtualPC, SecureEngine sets "user_variable" to something
different from "user_value".
SecureEngine returns control to the protected application. The protected application should check the
WinLicense 63
2010 Oreans Technologies
value of "user_variable" and execute the desired action if the application is running under
VMWare/VirtualPC.
int MyCheckVar;
VM_START
// your code goes here
CHECK_VIRTUAL_PC(MyCheckVar, 0x12345678)
// your code goes here
if (MyCheckVar != 0x12345678)
printf("Application is running under VMWare/VirtualPC");
VM_END
var
MyCheckVar: Integer;
begin
{$I VM_Start.inc}
// your code goes here
{$I CheckVirtualPC_Prolog.inc}
asm
push 11111111 // 11111111 is our special constant
pop MyCheckVar // SecureEngine will set "MyCheckVar" to
11111111 if VMWare not present
end;
{$I CheckVirtualPC_Epilog.inc}
// your code goes here
if MyCheckVar <> 11111111 then
ShowMessage("Application is running under VMWare/VirtualPC!");
{$I VM_End.inc}
2010 Oreans Technologies. All rights reserved
1.4.14 Which Macros should I use?
Which Macros should I use?
It is normal that a programmer feel lost when deciding which macros he/she should use. Here we try to clarify
that decision for you.
VMmacros and CodeReplacemacros are the strongest ones in security
WinLicense Help File 64
2010 Oreans Technologies
Encodemacros are not so strong but they have good performance when you have tight loops inside a
macro
VM macros and CodeReplace can be used with no problems in DLLs, instead Encode and Clear macros
might crash on DLLs (due to relocations)
VM Macros and CodeReplace macros are converted into internal virtual code, slightly increasing the
size of each macro. If you use about 100 VM macros, the size of your application could be increased a
few dozens of Kilobytes
VM macros and CodeReplace can support declaration of variables inside macro and "return" (C/C++)
/ "Exit" (Delphi) statements inside the macro. This is not valid for Encode macros
VM macros and CodeReplace macros cannot be used with exception handling. Encode / Clear macros
should work fine with exception handling.
VM and CodeReplace macros cannot have nested macros inside. Encode/Clear macros can have any
nesting level inside them
Some numbers to help
We recommend you to put an equivalent number of macros according to the size of your unprotected
application. About 10 macros / Megabyte should be a good protection for your application. So, if your
application has 3 Mb size, you should put 30 macros on it.
About which macros you should insert, a possible estimation could be 70% of VM macros, 20% for
CodeReplace macros and 10% for Encode macros.
2010 Oreans Technologies. All rights reserved
1.5 Licensing with WinLicense
Licensing with WinLicense
WinLicense provides a flexible licensing system to satisfy most developers' needs. The following sections
describe the different registration ways to register a protected application.
Overview
Filekeys
Registrykeys
Textkeys
SmartActivatekeys
Generatinglicenses
Settinglicenserestrictions
Customizingfeaturesinlicenses
WinLicense 65
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.5.1 Overview
Overview
WinLicense offers several ways to register an application, giving total freedom to developers to decide which
registration scheme prefer to register their applications. At first glance, it could be a bit confusing for new
WinLicense user how to use WinLicense to register their protected applications.
Basically, an application can be register with a File key or a Registry key (the license names can be
customized in the Registrationpanel). The protection strength is totally the same in either File or Registry
keys, it's up to developer to select the type of key that he prefers for his application (or select both types if
desired)
WinLicense also offers two other methods to license an application (Text Keys and SmartActivate keys) but
at the end, Text and SmartActivate keys need to be converted into a File or Registry key programmatically
(using the WinLicenseSDK) to fully register an application.
2010 Oreans Technologies. All rights reserved
1.5.2 File keys
File keys
File keys is one of the basic ways to register an application with WinLicense. If you decide to register your
application with a File key, your customers have to place the file key in the same folder as your protected
application (you can also change the folder where your application expects the File key).
In the Registration panel, you can select the name of the expected File key (Single File edit box). Notice that
you can also use special folder constants to specify a different folder to search for your File keys. The current
defined constants are:
%userdocs% : Specifies the current user documents folder (!My Documents).
%userappdata% : Specifies the current user application data folder (!{user
name}\Application Data)
%commonappdata% : Specifies the common application data for all users (!All
Users\Application Data)
%localappdata% : Specifies the local application data for the current user (!{user
name}\Local Settings\Application Data (non roaming))
Notice that the above constants are case sensitive. You can specify subdirectories with any of the above
constants. Example: %userdocs%\MyApplication\Licences\license.dat
Once that a File key is present in the same folder as your protected application (or a different folder that you
select), WinLicense will check the File key when your application boots up and will try to register your
application if the File key is correct and it's not expired (in case that expiration options were introduced in the
File key).
WinLicense Help File 66
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.5.3 Registry keys
Registry keys
Registry keys is one of the basic ways to register an application with WinLicense. If you decide to register your
application with a Registry key, you have to ship a .reg file which will contain the Registry key information.
Your customers can double click in the .reg file and the Registry key information will be inserted into the
Windows Registry automatically.
In the Registration panel, you can select the Registry key name and Value name where the Registry key
information will be stored in the Windows Registry. Notice that you can select to install the license in either
HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. If you select HKEY_LOCAL_MACHINE, the license will be
inserted for all users in a specific computer, but the user must have administrator's rights to install the license
into the Windows Registry. If you select HKEY_CURRENT_USER, the license will be inserted for just the current
user but it will not require administrator's rights to install the license.
Once that a Registry key is fully installed into the Windows Registry, WinLicense will check the Registry key
when your application boots up and will try to register your application if the Registry key is correct and it's not
expired (in case that expiration options were introduced in the Registry key).
2010 Oreans Technologies. All rights reserved
1.5.4 Text keys
Text keys
Text keys is a more complex way to license an application, but it gives much transparency for the final user,
who installs the license.
The problem with File or Registry keys is that for File keys, the final user needs to explicitly place the File key
into the same folder as your protected application and for Registry keys, the user needs to double-click on a
.reg file to insert the license information into the Registry.
To solve the above problems, WinLicense introduces Text keys. Text keys are given in ASCII format and give
the developer the chance to create a Registration form in his application where the Text key can be introduced.
The final user will insert the Text key in the Registration form and the developer will call the WinLicense SDK
function WLRegNormalKeyCheck to check if the introduced Text key is correct.
Once that the Text key has been checked and it's correct, the developer can either insert the Text key as File
key (calling WLRegNormalKeyInstallToFile) or as Registry key (calling WLRegNormalKeyInstallToRegistry).
Notice that if you decide to install a Text key as File key, you have to enable the option "Single file" in the
Registration panel and if you decide to install the Text key as Registry key, you have to enable the option
"Registry" in the Registration panel.
Basically, what we are doing with Text keys is to avoid the final user to place a File key or a Registry key into a
specific place, so you do all those steps from inside your application, giving the final user more transparency to
register your applications.
WinLicense 67
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.5.5 SmartActivate keys
SmartActivate keys
SmartActivate keys have the same transparency for the final user as Textkeys but they produce a small
registration code, which is suitable for many developers when they want to send their licenses via SMS, FAX,
etc, or they just prefer a short code registration serial.
SmartActivate keys are given as a serial number in ASCII format. The SmartActivate key can be inserted into
your Registration form by your customers when they are going to register your application. Once that the
SmartActivate key is inserted, the developer will call the WinLicense SDK function WLRegSmartKeyCheck to
check if the introduced SmartActivate key is correct.
Once that the SmartActivate key has been checked and it's correct, the developer can either insert the
SmartActivate key as File key (calling WLRegSmartKeyInstallToFile) or as Registry key (calling
WLRegSmartKeyInstallToRegistry). Notice that if you decide to install a SmartActivate key as File key, you
have to enable the option "Single file" in the Registration panel and if you decide to install the SmartActivate
key as Registry key, you have to enable the option "Registry" in the Registration panel.
WinLicense offers two types of SmartActivate keys:
Static SmartActivate keys: They are SmartActivate keys with a fix and short length. These keys
cannot include all possible license restrictions offered by WinLicense (like runtime expiration, country
locking, Network instances, etc) and they are not as strong as Dynamic SmartActivate keys.
Dynamic SmartActivate keys: They offer a stronger security layer (based in elliptic curves and
other crypto algorithms) and can include all type of license restrictions offered by WinLicense. They
size of these keys are larger than Static SmartActivate keys and they are also length-variable
(depending on restrictions inserted in the license)
Dynamic SmartActivate keys were introduced in WinLicense 2.0 and we recommend you to select them instead
of Static SmartActivate keys, to get more security and flexibility in your SmartActivate keys.
2010 Oreans Technologies. All rights reserved
1.5.6 Generating licenses
Generating licenses
WinLicense offers several ways to generate licenses for your protected applications. The current version of
WinLicense supports the following ways:
Via the WinLicense License Manager: You can create licenses for your applications from the License
Manager panel in WinLicense.
Via WinLicense SDK functions: You can use the WinLicenseSDK APIs in WinLicenseSDK.dll to
generate licenses for your application.
Via Custom WinLicense SDK functions: When you protect your application, WinLicense will
generate a specificgeneratorDLL to help you generating licenses for your application.
WinLicense Help File 68
2010 Oreans Technologies
Via Exported Generator application: When you protect your application, WinLicense will create a
smallapplication (with database support) to help you manage your licenses and customers.
Via our C ANSI source code generator: Our customers can get access to our C ANSI source code
generator to generate licenses under any platform (Windows, UNIX, Linux, Mac, etc).
2010 Oreans Technologies. All rights reserved
1.5.7 Setting license restrictions
Setting license restrictions
WinLicense offers multiple types of restrictions for your licenses. You can set one or more restrictions for each
license that you generate. The current restrictions that WinLicense offers are:
Number of days: Number of days that a license can be used.
Number of executions: Number of executions that a license can be used.
Date expiration: Specify the date till the license can be used.
Runtime expiration: Specify the number of minutes that each instance can be running in memory.
Global time expiration: Specify the number of minutes that a license can be running in memory.
Country locking: Specify the country where the license can be used.
Network instances: Restrict the number of instances in a network.
Installation date: Specify the last day that a license is accepted to be installed.
2010 Oreans Technologies. All rights reserved
1.5.8 Customizing features in licenses
Customizing features in licenses
A common question by developers when using WinLicense is how they can set up specific options for each
license that they generate. For example, a developer sells different types of licenses to allow some features to
be present or not depending on the type of license. He wants to create licenses to put the application in Basic
Mode, Advance Mode and Enterprise Mode. Most licensing systems on the market allow doing that by setting
special bits when creating the license, so the developer has to interpret which bits are active in the current
license to know which type of license is present.
WinLicense offers a more flexible approach and allows you to insert a buffer (ASCII or UNICODE) of up to 6400
bytes when generating the license (in the Custom Data field). You can put any information that you want and
WinLicense 69
2010 Oreans Technologies
you can check it in runtime by calling the function WLRegGetLicenseInfo. There are not restrictions about the
format of the Custom Data information that you insert. The information that you set in the Custom Data when
creating the license, it's the one that it's returned by the WLRegGetLicenseInfo function.
2010 Oreans Technologies. All rights reserved
1.6 WinLicense SDK
WinLicense API
The WinLicense SDK allows Software Developers to interact with WinLicense and retrieve/set information to
manage your licenses/trial periods, create license keys, etc.
To be able to use the WinLicense API, an application must link with the Winlicense SDK library (WinlicenseSDK
lib/dll).
NOTE: The WinlicenseSDK.dll is needed at protection time only. The WinlicenseSDK.dll must not be
released with your protected program.
The different types of functions in the WinLicense SDK are the followings:
TrialFunctions
RegistrationFunctions
GeneratorsFunctions
MiscellaneousFunctions
2010 Oreans Technologies. All rights reserved
1.6.1 Trial Functions
Trial Functions
The following functions can be used to handle the trial period in an application.
WinLicense Help File 70
2010 Oreans Technologies
Function Description
WLTrialCustomCounter Retrieves the value of a specific counter
WLTrialCustomCounterDec Decrements a custom counter by a specific
value
WLTrialCustomCounterInc Increments a custom counter by a specific
value
WLTrialCustomCounterSet Sets a specific value to a custom counter
WLTrialDateDaysLeft Retrieves the number of trial days left when you
are protecting with the option Date Expiration
WLTrialDaysLeft Retrieves the number of trial days left before
expiring.
WLTrialDebugCheck Checks if the application was protected with the
option "Trial Debug Mode" enabled
WLTrialExecutionsLeft Retrieves the number of trial executions left
before expiring.
WLTrialExpirationDate Retrieves the trial expiration date in an
application.
WLTrialExpirationTimestamp Retrieves the exact expiration timestamp when
an application is protected with trial days
expiration
WLTrialExpireTrial Expires the trial period in the current application
WLTrialExtendExpiration Allows extending the current trial period.
WLTrialExtGetLevel Retrieves the current trial extension level.
WLTrialExtGetStatus Retrieves information about a possible trial
extension in the current application.
WLTrialFirstRun Determines if an application is running in trial
mode for the first time.
WLTrialGetStatus Retrieves the trial status in the current
application.
WLTrialGlobalTimeLeft Retrieves the number of minutes left an
application can be executed before expiring.
WLTrialLockedCountry Retrieves the country code in which an
application can be executed in trial mode.
WLTrialRuntimeLeft Retrieves the runtime left an application can be
running in memory.
WLTrialStringRead Reads a custom string from the Registry.
WLTrialStringReadW Reads a custom string (in UNICODE) from the
Registry.
WLTrialStringWrite Writes a custom string to the Registry.
WLTrialStringWriteW Writes a custom string (in UNICODE) to the
Registry.
WLTrialTotalDays Retrieves the total number of trial days an
application can be executed.
WLTrialTotalExecutions Retrieves the total number of trial executions
an application can be executed.
WinLicense 71
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.1 WLTrialCustomCounter
WLTrialCustomCounter
The WLTrialCustomCounter function retrieves the value of a specific counter. This is a general-purpose
function used by applications that need a global counter to maintain the count of an expirable resource. For
example, it can be used in an application that allows sending a maximum of 20 emails in trial period. Call this
function to know how many emails have been sent.
int WLTrialCustomCounter(
int CounterID
);
function WLTrialCustomCounter(
CounterID:Integer
):Integer; stdcall;
Public Declare Function WLTrialCustomCounter Lib "WinLicenseSDK.dll" (
ByVal CounterID As Integer
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialCustomCounter", [in/out] CounterID, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialCustomCounter", [in/out] CounterID, 100)
Parameters
CounterID
This parameter specifies the counter ID to retrieve the value from.
The current version of WinLicense allows 3 different IDs (0, 1, 2). Each CounterID has its own local
counter.
Return Values
If the function succeeds, the return value is the current value of the specified counter.
If the function fails, the return value is -1 (Invalid counter ID).
See Also
WLTrialCustomCounterInc, WLTrialCustomCounterDec, WLTrialCustomCounterSet
WinLicense Help File 72
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.2 WLTrialCustomCounterDec
WLTrialCustomCounterDec
The WLTrialCustomCounterDec function decrements a custom counter by a specific value. This is a general-
purpose function that can be used by applications that needs a global counter to maintain the count of an
expirable resource.
int WLTrialCustomCounterDec(
int Value,
int CounterID
);
function WLTrialCustomCounterDec(
Value:Integer;
CounterID:Integer
):Integer; stdcall;
Public Declare Function WLTrialCustomCounterDec Lib "WinLicenseSDK.dll" (
ByVal Value As Integer,
ByVal CounterID As Integer
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialCustomCounterDec", [in/out] CounterID,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialCustomCounterDec", [in/out] CounterID, 100)
Parameters
Value
This parameter specifies the value to decrement a specific counter ID.
CounterID
This parameter specifies the counter ID to decrement.
The current version of WinLicense allows 3 different IDs (0, 1, 2). Each CounterID has its own local
counter.
Return Values
If the function succeeds, the return value is zero.
If the function fails, the return value is wlInvalidCounter.
See Also
WLTrialCustomCounterInc, WLTrialCustomCounter, WLTrialCustomCounterSet
WinLicense 73
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.3 WLTrialCustomCounterInc
WLTrialCustomCounterInc
The WLTrialCustomCounterInc function increments a custom counter by a specific value. This is a general-
purpose function that can be used by applications that needs a global counter to maintain the count of an
expirable resource. For example, it can be used in an application that allows sending a maximum of 20 emails
in trial period. Calling this function every time that an email has been sent.
int WLTrialCustomCounterInc(
int Value,
int CounterID
);
function WLTrialCustomCounterInc(
Value:Integer;
CounterID:Integer
):Integer; stdcall;
Public Declare Function WLTrialCustomCounterInc Lib "WinLicenseSDK.dll" (
ByVal Value As Integer,
ByVal CounterID As Integer
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialCustomCounterInc", [in/out] CounterID,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialCustomCounterInc", [in/out] CounterID, 100)
Parameters
Value
This parameter specifies the value to increment a specific counter ID.
CounterID
This parameter specifies the counter ID to increment.
The current version of WinLicense allows 3 different IDs (0, 1, 2). Each CounterID has its own local
counter.
Return Values
If the function succeeds, the return value is zero.
If the function fails, the return value is wlInvalidCounter.
See Also
WLTrialCustomCounterDec, WLTrialCustomCounter, WLTrialCustomCounterSet
WinLicense Help File 74
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.4 WLTrialCustomCounterSet
WLTrialCustomCounterSet
The WLTrialCustomCounterSet function sets a specific value in a counter. This is a general-purpose function
that can be used by applications that needs a global counter to maintain the count of an expirable resource.
int WLTrialCustomCounterSet(
int Value,
int CounterID
);
function WLTrialCustomCounterSet(
Value:Integer;
CounterID:Integer
):Integer; stdcall;
Public Declare Function WLTrialCustomCounterSet Lib "WinLicenseSDK.dll" (
ByVal Value As Integer,
ByVal CounterID As Integer
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialCustomCounterSet", [in/out] CounterID,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialCustomCounterSet", [in/out] CounterID, 100)
Parameters
Value
This parameter specifies the value to set in counter.
CounterID
This parameter specifies the counter ID to set.
The current version of WinLicense allows 3 different IDs (0, 1, 2). Each CounterID has its own local
counter.
Return Values
If the function succeeds, the return value is zero.
If the function fails, the return value is wlInvalidCounter.
See Also
WinLicense 75
2010 Oreans Technologies
WLTrialCustomCounterDec, WLTrialCustomCounter, WLTrialCustomCounterInc
2010 Oreans Technologies. All rights reserved
1.6.1.5 WLTrialDateDaysLeft
WLTrialDateDaysLeft
The WLTrialDateDaysLeft function retrieves the number of trial days left when you are protecting with the
option Date Expiration.
int WLTrialDateDaysLeft(void);
function WLTrialDateDaysLeft():Integer; stdcall;
Public Declare Function WLTrialDateDaysLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialDateDaysLeft", [out] DaysLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialDateDaysLeft", [out] DaysLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of trial days left before expiring.
If the current application does not have trial expiration date, the return value is wlNoTrialDate.
Remarks
Please, notice that this function returns the number of days left when you enable the trial Date Expiration
option. If you are protecting your application with Days Expiration and you want to know the number of days
left, you have to use the function WLTrialDaysLeft.
WinLicense Help File 76
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.6 WLTrialDaysLeft
WLTrialDaysLeft
The WLTrialDaysLeft function retrieves the number of trial days left before expiring.
int WLTrialDaysLeft(void);
function WLTrialDaysLeft():Integer; stdcall;
Public Declare Function WLTrialDaysLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialDaysLeft", [out] DaysLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialDaysLeft", [out] DaysLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of trial days left before expiring.
If the trial has been manipulated by a user or the function is called without adding the Days Expiration option
to the protected application, the return value is -1.
Remarks
Before calling WLTrialDaysLeft, you should call the function WLTrialGetStatus, to know the status of the trial
(expired, manipulated, etc).
Please, notice that this function returns the number of days left when you enable the trial Days Expiration
option. If you are protecting your application with Date Expiration and you want to know the number of days
left, you have to use the function WLTrialDateDaysLeft.
See Also
WLTrialTotalDays
WinLicense 77
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.7 WLTrialDebugCheck
WLTrialDebugCheck
The WLTrialDebugCheck function checks if the application was protected with the option "Trial Debug Mode"
enabled. This function allows you to check from your application that you are not releasing an application
protected in "Trial Debug Mode" by mistake.
bool WLTrialDebugCheck();
function WLTrialDebugCheck():Boolean;
Public Declare Function WLTrialDebugCheck Lib "WinLicenseSDK.dll" () As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLTrialDebugCheck", [out] BuffTrialDebugCheck,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialDebugCheck", [out] BuffTrialDebugCheck, 100)
Parameters
This function has no parameters.
Return Values
If the application was protected with option "Trial Debug Mode" checked, the return value is True.
If the application was protected with option "Trial Debug Mode" unchecked, the return value is False.
2010 Oreans Technologies. All rights reserved
1.6.1.8 WLTrialExecutionsLeft
WLTrialExecutionsLeft
The WLTrialExecutionsLeft function retrieves the number of trial executions left before expiring.
int WLTrialExecutionsLeft(void);
WinLicense Help File 78
2010 Oreans Technologies
function WLTrialExecutionsLeft():Integer; stdcall;
Public Declare Function WLTrialExecutionsLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialExecutionsLeft", [out] ExecutionsLeft,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialExecutionsLeft", [out] ExecutionsLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of trial executions left before expiring.
If the application was protected without Trial executions, the return value is -1.
See Also
WLTrialTotalExecutions
2010 Oreans Technologies. All rights reserved
1.6.1.9 WLTrialExpirationDate
WLTrialExpirationDate
The WLTrialExpirationDate function retrieves the trial expiration date in an application.
int WLTrialExpirationDate(
SYSTEMTIME* pExpDate
);
function WLTrialExpirationDate(
var pExpDate:SYSTEMTIME
):Integer; stdcall;
WinLicense 79
2010 Oreans Technologies
Public Declare Function WLTrialExpirationDate Lib "WinLicenseSDK.dll" (
pExpDate As Any
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialExpirationDate", [out] ExpirationDate,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialExpirationDate", [out] ExpirationDate, 100)
Parameters
pExpDate
[out] Pointer to a SYSTEMTIME structure that receives the trial expiration date.
Return Values
If the function success the return value is zero.
If the current application does not have trial expiration date, the return value is wlNoTrialDate.
Remarks
Before calling WLTrialExpirationDate, you should call the function WLTrialGetStatus, to know the status of the
trial (expired, manipulated, etc).
2010 Oreans Technologies. All rights reserved
1.6.1.10 WLTrialExpirationTimestamp
WLTrialExpirationTimestamp
The WLTrialExpirationTimestamp function gets the exact expiration timestamp when an application is
protected with trial days expiration. This function can be called when an application has been protected with
trial days expiration to know the exact date and time that the trial will expire.
bool WLTrialExpirationTimestamp(
FILETIME* pFileTime
);
function WLTrialExpirationTimestamp(
var pFileTime:FILETIME
):Boolean; stdcall;
WinLicense Help File 80
2010 Oreans Technologies
Public Declare Function WLTrialExpirationTimestamp Lib "WinLicenseSDK.dll" (
pExpDate As Any
) As Boolean
Parameters
pFileTime
[out] Pointer to a FILETIME structure that receives the expiration timestamp.
Return Values
If the function success the return value is True.
If the current application is not protected with trial days expiration, the return value is False.
Remarks
This function only works when the application is protected with trial days expiration. In other cases, it will
always return False.
2010 Oreans Technologies. All rights reserved
1.6.1.11 WLTrialExpireTrial
WLTrialExpireTrial
The WLTrialExpireTrial function expires the trial period in the current application. This function is rarely
called by some applications to abnormally finish the trial period when a critical situation has been found. When
this function is called, the next time that an application is executed, its trial period will be expired.
bool WLTrialExpireTrial(void);
function WLTrialExpireTrial():Boolean; stdcall;
Public Declare Function WLTrialExpireTrial Lib "WinLicenseSDK.dll" () As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLTrialExpireTrial", [out] ExpireTrial, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialExpireTrial", [out] ExpireTrial, 100)
Parameters
This function has no parameters.
WinLicense 81
2010 Oreans Technologies
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
2010 Oreans Technologies. All rights reserved
1.6.1.12 WLTrialExtendExpiration
WLTrialExtendExpiration
The WLTrialExtendExpiration function allows extending the current trial period. To extend the trial period in
an application, we recommend using Trial Extension keys (Generated by WinLicense). The
WLTrialExtendExpiration function is suitable for those applications which cannot accept WinLicense trial
extension keys by design.
bool WLTrialExtendExpiration(
int NumDays,
int NumExec,
SYSTEMTIME* pExpDate,
int Runtime,
int GlobalTime
);
function WLTrialExtendExpiration(
NumDays: Integer;
NumExec: Integer;
pExpDate: Pointer;
Runtime: Integer;
GlobalTime: Integer
):Boolean; stdcall;
Public Declare Function WLTrialExtendExpiration Lib "WinLicenseSDK.dll" (
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pExpDate As Any,
ByVal Runtime As Integer,
ByVal GlobalTime As Integer
) As Boolean
Parameters
NumDays
This parameter specifies the number of days to extend the trial.
WinLicense Help File 82
2010 Oreans Technologies
NumExec
This parameter specifies the number of executions to extend the trial.
pExpDate
This parameter specifies a pointer to a SYSTEMTIME structure with the new expiration date.
Runtime
This parameter specifies the new runtime expiration to extend in trial mode.
GlobalTime
This parameter specifies the number of minutes to extend the usage of the protected application in trial
mode.
Return Values
If the function succeeds, the return value is true.
If the function fails, the return value is false.
2010 Oreans Technologies. All rights reserved
1.6.1.13 WLTrialExtGetLevel
WLTrialExtGetLevel
The WLTrialExtGetLevel function retrieves the current trial extension level.
int WLTrialExtGetLevel(void);
function WLTrialExtGetLevel():Integer; stdcall;
Public Declare Function WLTrialExtGetLevel Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialExtGetLevel", [out] TrialExtStatus, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialExtGetLevel", [out] TrialExtStatus, 100)
Parameters
This function has no parameters.
Return Values
The return value is the current trial extension level. If no trial extension is found, the return value is zero.
WinLicense 83
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.14 WLTrialExtGetStatus
WLTrialExtGetStatus
The WLTrialExtGetStatus function retrieves information about a possible trial extension in the current
application.
int WLTrialExtGetStatus(void);
function WLTrialExtGetStatus():Integer; stdcall;
Public Declare Function WLTrialExtGetStatus Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialExtGetStatus", [out] TrialExtStatus, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialExtGetStatus", [out] TrialExtStatus, 100)
Parameters
This function has no parameters.
Return Values
The return value is the trial extension status in the current application. The possible values are the followings:
wlNoTrialExt when the trial extension key not present.
wlAppExtended when the application is extended with trial extension key.
wlInvalidTrialExt when a trial extension key is invalid.
wlNoMoreExt when no more extension keys are allowed.
See Also
WLTrialGetStatus
WinLicense Help File 84
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.15 WLTrialFirstRun
WLTrialFirstRun
The WLTrialFirstRun function determines if an application is running in Trial mode for the first time.
bool WLTrialFirstRun(void);
function WLTrialFirstRun():Boolean; stdcall;
Public Declare Function WLTrialFirstRun Lib "WinLicenseSDK.dll" () As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLTrialFirstRun", [out] TrialFirstTime, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialFirstRun", [out] TrialFirstTime, 100)
Parameters
This function has no parameters.
Return Values
If the application is launched for the first time and it's running in Trial mode, the return value is True,
otherwise it returns False.
See Also
WLRegFirstRun
2010 Oreans Technologies. All rights reserved
1.6.1.16 WLTrialGetStatus
WLTrialGetStatus
The WLTrialGetStatus function retrieves the trial status in the current application.
WinLicense 85
2010 Oreans Technologies
int WLTrialGetStatus(
int* Reserved
);
function WLTrialGetStatus(
var Reserved:Integer
):Integer; stdcall;
Public Declare Function WLTrialGetStatus Lib "WinLicenseSDK.dll" (
Reserved As Any
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialGetStatus", [out] TrialStatus, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialGetStatus", [out] TrialStatus, 100)
Parameters
Reserved
This parameter contains a special code with extra information about the status of the trial. This
parameter is reserved in current versions of WinLicense.
Return Values
The return value is the trial status in the current application. The possible values are the followings:
wlTrialOk when trial OK.
349 EUR
WinLicense Professional
399 EUR
Packages contain 9 months of free upgrades.
Subscriptions
If you are a WinLicense customer and your free upgrading period expires, you can join one of our subscription
programs whenever you want.
Description Price
Biannual Subscription This subscription allows you to be upgraded for six
months.
59 EUR
Annual Subscription This subscription allows you to be upgraded for one year. 99 EUR
WinLicense 261
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.12 Support
1.12.1 Support
Support
If you have any technical problems using WinLicense or need a special feature to be included in a next release,
please feel free to contact us at [email protected].
In case of technical problems with WinLicense, ensure that you are using the latest version available. You can
download the latest version of our products from http://www.oreans.com.
2010 Oreans Technologies. All rights reserved
2 XBundler
XBundler
XBundler is a special plugin for Themida/WinLicense that allows DLLs and data files to be embedded inside the
protected application, simplifying the distribution of your application to your customers and avoiding your DLLs
and data files being used by third party software.
This help file explains the main features of XBundler and how to use it to successfully embed your DLLs and
data files into your applications protected with Themida/WinLicense.
Overview
FAQ
Order
Support
2010 Oreans Technologies. All rights reserved
WinLicense Help File 262
2010 Oreans Technologies
2.1 Overview
2.1.1 What is XBundler?
What is XBundler?
XBundler is a special plugin for Themida/WinLicense that allows DLLs and data files to be embedded inside the
protected application, simplifying the distribution of your application to your customers and avoiding your DLLs
and data files being used by third party software. Xbundler compresses and encrypts all of the embedded files
without affecting the ability of your application to function correctly and with no additional coding.
When your application wants to access your embedded DLLs and/or data files, XBundler will not write the
embedded files to disk. Instead, XBundler uses a special mechanism that detects when an application is
accessing embedded DLLs and/or data files and will decrypt/encrypt the required block of data.
Due to the fact that XBundler works in conjunction with Themida/WinLicense, your main application and all the
embedded files will be totally protected by XBundler and these powerful protection engines.
2010 Oreans Technologies. All rights reserved
2.1.2 Scenarios for using XBundler
Scenarios for using XBundler
XBundler can be used in many scenarios. The most common ones are:
Protect your DLLs from being reused by third party software: When you select not to write your
files to disk, XBundler will keep your files totally encrypted and will access them directly in memory
after decrypting the necessary blocks of data. Given that your DLLs are not written to disk, third party
software cannot reuse your DLLs for their own benefits.
Solve "DLL Hell" issues: XBundler will guarantee that your application is always using your
embedded DLLs. This will avoid users and applications from modifying/deleting your DLLs hence
stopping your application from working.
Protect your DLLs against reverse engineering: XBundler encrypts your DLL and/or data files to
prevent them from being extracted directly from your application. Besides, Themida/WinLicense will
seat on top of XBundler supervising the system against any cracking activity, protecting your embedded
DLLs and your main application with the latest technology in software protection.
Compress your DLLs and data files: XBundler will compress all of your embedded DLLs and data
files reducing their size by 35-60% and using a very fast decompression algorithm which does not
decrease your applications performance.
Protect your media files: If your application uses exclusive designs with graphics, music, video, etc.
XBundler can embed all of these media files with your application to avoid other people directly viewing
them, or using them for their own software.
XBundler 263
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
2.1.3 Using XBundler
Using XBundler
XBundler appears as an external option for Themida/WinLicense. In the Themida/WinLicense control panel you
can find an option to access the XBundler panel. The following screen shows how XBundler appears under
WinLicense:
Adding a file to "bundle"
To add files to be embedded inside your final protected application, you can either drag the file to the XBundler
panel or select a file using the Add File button. The file will appear in the list if it has not already been
included.
Select extraction attributes
For each embedded file, you can choose if the file will be extracted to disk in runtime or will be totally
embedded without being written to disk. The available options are:
Never write to disk (recommended): This option avoids the selected file from being written to disk.
XBundler will keep your embedded files totally encrypted inside of your protected application. When
WinLicense Help File 264
2010 Oreans Technologies
your application tries to access the embedded file, XBundler will decrypt and re-encrypt the necessary
blocks of data in the memory, but never write them to disk. This process is totally transparent for your
application.
Write if file not present: This options is suitable when you want to install your embedded files the
first time that your application is executed. Once that they are written to disk, XBundler will never re-
write them in future executions of your application. This option is suitable for files like databases that
cannot be overwritten to avoid losing the current content of the database.
Overwrite always: This option ensures that your application will run with the exact copy of the
DLLs/files that were embedded in protection time. This option avoids your application running with
manipulated DLLs and/or data files.
Overwrite if older version found: This option ensures that your application is using the latest
versions of your DLLs and/or data files when running. This options is suitable when you want to update
a DLL that is used by all your applications installed in the system.
Extraction Path
In case that you decide to write your embedded files to disk, you can specify the path where your embedded
files will be extracted. In the case that no path is selected, XBundler will decompress the file into your
application directory. Note that all paths must be relative to your application directory, except with the
following restrictions:
%WINDIR%: If you specify the %WINDIR% (case sensitive) string, XBundler will extract your files
into the Windows directory.
%WINSYSDIR%: If you specify the %WINSYSDIR% (case sensitive) string, XBundler will extract
your files into the Windows System directory. Normally, the system directory for Windows NT platforms
is /SYSTEM32 and for Windows 9x platforms it is /SYSTEM.
%userdocs% : Specifies the current user documents folder (!My Documents).
%userappdata% : Specifies the current user application data folder (!{user name}\Application Data)
%commonappdata% : Specifies the common application data for all users (!All Users\Application
Data)
%localappdata% : Specifies the local application data for the current user (!{user name}\Local
Settings\Application Data (non roaming))
%environment variable%: You can specify any environment variable which is defined in the system.
Example: %temp%, %tmp%.
Adding files with relative paths
To add files that are located in parent folders of the protected application, you can add them with relative
paths. To do that, please follow the next steps:
1.- Check the option "Allow bundling from any directory".
2.- Drag and drop files from Windows Explorer but holding the CTRL key (either left or right) while
dragging the file into the XBundler panel. After that, you can see that the file is added with relative
paths.
Make Files visible to OpenDialog
If you want to make your embedded files visible to Wndows Shell Dialogs or you want to enumerate your
embedded files from inside your application (using FindFirstFile, FindNextFile, etc.) you have to select the
option "Make Files visible to OpenDialog". Note that even if you see your embedded files from inside your
application when you select this option, your embedded files will NOT be visible to users and other applications.
XBundler 265
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
2.1.4 Installing XBundler
Installing XBundler
XBundler is shipped as a zip file (XBundler.zip). To install it, you need to decompress XBundler.zip in the same
directory where you have Themida/WinLicense installed. After that, you just restart Themida/WinLicense and
XBundler should be present in the Themida/WinLicense options panel.
2010 Oreans Technologies. All rights reserved
2.2 FAQ
FAQ
In this section you will find the answers to the most frequently asked questions. We have an up to date
Knowledge Base with all frecuently asked questions at http://www.oreans.com/kb
CanIuseXBundlerseparatelyfromThemida/WinLicense?
CanIprotectmyDLLswithanotherprotectoranduseXBundlertoinjecttheminsidemya
pplicationprotectedwithThemida/WinLicense?
CanIprotectmyDLLwithThemida/WinLicenseandembeditwithXBundler?
IfIembedmydatafilesandDLLswithXBundler,cansomeoneuseanhexeditortoextrac
tmyembeddedfiles?
MyapplicationdoesnotworkwhenIuseXBundleronit.What'shappening?
DoIneedtomakechangesinmysourcecodetouseXBundler?
IfIselectthe"Neverwritetodisk"optionformydatafile,canIwritetoitfrommyapplic
ation?
IhaveanMP3filethatIdon'twantanyonetogetit.CanXBundlerhelpmewiththat?
WinLicense Help File 266
2010 Oreans Technologies
IhaveanideatobeaddedtoXBundler,canyouimplementit?
IfIbuyXBundler,willIkeepreceivingupdates?
CanIuseXBundlerinmy.NETapplication?
CanXBundlerhelpmetobeprotectedagainstcrackers?
2010 Oreans Technologies. All rights reserved
2.2.1 Can I use XBundler separately from Themida/WinLicense?
Can I use XBundler separately from Themida/WinLicense?
No, XBundler works as a plugin for Themida/WinLicense. XBundler makes use of the protection engines offered
by Themida/WinLicense in order to fully protect your embedded DLLs and data files.
2010 Oreans Technologies. All rights reserved
2.2.2 Can I protect my DLLs with another protector and use XBundler to inject
them inside my application protected with Themida/WinLicense?
Can I protect my DLLs with another protector and use XBundler to
inject them inside my application protected with
Themida/WinLicense?
Yes, there is no problems with that.
2010 Oreans Technologies. All rights reserved
XBundler 267
2010 Oreans Technologies
2.2.3 Can I protect my DLL with Themida/WinLicense and embed it with XBundler?
Can I protect my DLL with Themida/WinLicense and embed it with
XBundler?
Yes, it's possible. The only requirement is that you load your DLL using the LoadLibrary API, without statically
linking with it.
2010 Oreans Technologies. All rights reserved
2.2.4 If I embed my data files and DLLs with XBundler, can someone use an hex
editor to extract my embedded files?
If I embed my data files and DLLs with XBundler, can someone use
an hex editor to extract my embedded files?
No, XBundler uses strong encryption on your embedded data. Besides, Themida/WinLicense will re-encrypt all
the embedded data like it were application code.
2010 Oreans Technologies. All rights reserved
2.2.5 My application does not work when I use XBundler on it. What's happening?
My application does not work when I use XBundler on it. What's
happening?
XBundler has been successfully tested with many applications. If your application does not work, please send it
to us and we will fix it as soon as possible. All of your files that you send to us will be kept private and deleted
after fixing your problem.
2010 Oreans Technologies. All rights reserved
WinLicense Help File 268
2010 Oreans Technologies
2.2.6 Do I need to make changes in my source code to use XBundler?
Do I need to make changes in my source code to use XBundler?
No, XBundler works totally transparent for your application. Your application will behave in the same manner
when using XBundler or not.
2010 Oreans Technologies. All rights reserved
2.2.7 If I select the "Never write to disk" option for my data file, can I write to it
from my application?
If I select the "Never write to disk" option for my data file, can I
write to it from my application?
No, DLLs and data files that are marked with the "Never write to disk" option are read-only. If you want to
write to your embedded data, you have to select another extraction option like "Write if file not present". In
this case, your embedded file will be extracted to disk and you can modify it. Of course, this option allows
other people to see the extracted file.
2010 Oreans Technologies. All rights reserved
2.2.8 I have an MP3 file that I don't want anyone to get it. Can XBundler help me
with that?
I have an MP3 file that I don't want anyone to get it. Can XBundler
help me with that?
Sure, that's the main purpose of XBundler, to keep DLLs and data files embedded into your application without
writing them to disk.
2010 Oreans Technologies. All rights reserved
XBundler 269
2010 Oreans Technologies
2.2.9 I have an idea to be added to XBundler, can you implement it?
I have an idea to be added to XBundler, can you implement it?
Sure, we are very happy to hear from you and make XBundler the perfect tool for you. Just contact us at
[email protected] and tell us what you need.
2010 Oreans Technologies. All rights reserved
2.2.10 If I buy XBundler, will I keep receiving updates?
If I buy XBundler, will I keep receiving updates?
Yes, you will continue receiving updates for the license that you bought without any extra fees.
2010 Oreans Technologies. All rights reserved
2.2.11 Can I use XBundler in my .NET application?
Can I use XBundler in my .NET application?
Yes, you just need to get a license for XBundler .NET. The current version supports .NET Framework 1.0, 1.1,
2.0.
2010 Oreans Technologies. All rights reserved
2.2.12 Can XBundler help me to be protected against crackers?
Can XBundler help me to be protected against crackers?
Definitely! XBundler works under Themida/WinLicense which are very robust protectors against advanced
cracking. XBundler combined with Themida/WinLicense is the perfect solution to keep your main application
and all its external files fully protected.
WinLicense Help File 270
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
2.3 Order
2.3.1 Registration and prices
Registration and prices
To order a license for XBundler, please visit http://www.oreans.com.
Prices
Embed DLLs Embed Data Files .NET support Price Single Developer
License
XBundler Standard
79 EUR
(orderviaShareit)
XBundler .NET
119 EUR
(orderviaShareit)
To register XBundler you can do it using any of the multiple payment options that we have:
Shareit
Paypal
Western Union
Wire transfer
Please, contact us at [email protected] for any related questions about registration.
XBundler 271
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
2.4 Support
2.4.1 Support
Support
If you have any technical problems using XBundler or any question or comments, please contact us at
[email protected].
2010 Oreans Technologies. All rights reserved
Index
- . -
.reg file 251
- A -
Advance API-Wrapping 13
Advanced Debugger Monitors 13
AntiAPISpyer 223
AntiBreakpoints 224
AntiCrackTools 224
AntiDumperPro 224
Antidumpers 13
- C -
Clear macro 53
ClearCode 226
CodeEncrypt 227
CodeReplace 16
CodeReplace Macro 49
Command line 41
Compression 13
Customer Manager 199
Customized Dialogs 33
- D -
Debug Interrupts 13
DebuggerGuard 228
Delphi/BCB form protection 13
Dialogs 33
DynamicEncryption 229
- E -
Encode macro 50
EntryPoint Obfuscation 13
- F -
FAQ 242
- G -
GarbageCode 229
Generators Functions 135
Generators SDK 135
- H -
Hardware Lock 27
- I -
IntDebugShield 230
InteractiveEngine 231
- L -
License Manager 200
- M -
Memory Patchers 13
MemoryGuard 231
Metamorph Security 13
Miscellaneous functions 176
Monitor Blockers 13
MonitorBlocker 232
- N -
NumDays 143
NumExec 136
- P -
Password 29
Password Manager 206
Password protection 29
PasswordProtect 234
PolymorphicLayers 234
WinLicense Help File 272
2010 Oreans Technologies
Prices 260
Project Manager 196
Protect 39
Protect Now 39
Protecting an application 11
CodeReplace 16
Customized Dialogs 33
Protection Options 13
Themida GUI overview 9
Protection Options 13
pUserName 154
- R -
RealTimeSpy 236
Registration 25
Registration Functions 94
Registration SDK 94
Resources Encryption 13
Runtime 150
- S -
SDK 69
SecureAPIWrapper 237
SecureEngine features 222
SecureEngine macros 43
SecureEnginefeatures 228
SecureEntryPoint 237
Selecting blocks of code to be protected by
CodeReplace 16
Simulating an application with CodeReplace included
16
SmartCompression 238
SmartMetamorph 239
Software Manager 197
software protectors 7
Support 261
- T -
ThreadEngine 240
Trial Extension Manager 208
Trial Function 69
Trial SDK 69
Trial Settings 23
- U -
Unprotected State 194
use themida 7
- V -
Virtual Machine Emulator 13
VirtualMachine 241
VM macro 47
vulnerabilities 7
- W -
When Debugger Found 13
WinLicense GUI overview 9
WinLicense SDK 69
WLRegGetLicenseInfo 94
WLRegNormalKeyCheckW 117
Index
273
2010 Oreans Technologies