Вы находитесь на странице: 1из 273

Table of Contents

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.

wlTrialDaysExpired when the trial days expired.


wlTrialExecExpired when the trial executions expired.
wlTrialDateExpired when the trial date expired.
wlTrialRuntimExpired when the runtime trial expired.
wlTrialGlobalExpired when the global trial time expired.
wlTrialInvalidCountry when the Trial does not run on the current language/country.
wlTrialManipulated when the clock has been turned back or a user has tried to cheat the trial period in
your application.
See Also
WLTrialExtGetStatus, WLRegGetStatus
WinLicense Help File 86
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.17 WLTrialGlobalTimeLeft
WLTrialGlobalTimeLeft
The WLTrialGlobalTimeLeft function retrieves the number of minutes left that an application can be executed
before expiring.
int WLTrialGlobalTimeLeft(void);
function WLTrialGlobalTimeLeft():Integer; stdcall;
Public Declare Function WLTrialGlobalTimeLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialGlobalTimeLeft", [out] GlobalTimeLeft,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialGlobalTimeLeft", [out] GlobalTimeLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of minutes left before expiring.
2010 Oreans Technologies. All rights reserved
1.6.1.18 WLTrialLockedCountry
WLTrialLockedCountry
WinLicense 87
2010 Oreans Technologies
The WLTrialLockedCountry function retrieves the country code in which an application can be executed in
trial mode.
int WLTrialLockedCountry(void);
function WLTrialLockedCountry():Integer; stdcall;
Public Declare Function WLTrialLockedCountry Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialLockedCountry", [out] LockedCountry, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialLockedCountry", [out] LockedCountry, 100)
Parameters
This function has no parameters.
Return Values
The return value is the country code of the locked trial. To see a list of the possible country codes, check the
country codes list.
2010 Oreans Technologies. All rights reserved
1.6.1.19 WLTrialRuntimeLeft
WLTrialRuntimeLeft
The WLTrialRuntimeLeft function retrieves the runtime left that an application can be running in memory.
int WLTrialRuntimeLeft(void);

function WLTrialRuntimeLeft():Integer; stdcall;
WinLicense Help File 88
2010 Oreans Technologies
Public Declare Function WLTrialRuntimeLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialRuntimeLeft", [out] RuntimeLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialRuntimeLeft", [out] RuntimeLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the runtime left in minutes.
2010 Oreans Technologies. All rights reserved
1.6.1.20 WLTrialStringRead
WLTrialStringRead
The WLTrialStringRead function reads a custom string from the Registry. The string is stored using
encryption algorithms and the location of the string is different for each computer.
The location of the string also depends on the "Trial Unique Key" in the protected software. If you change the
"Trial Unique Key" in your Software and protect again, the strings will be stored in a different Registry location.
NOTE: If StringName starts with "!", the custom string will be stored under HKEY_LOCAL_MACHINE, otherwise
it will be stored under HKEY_CURRENT_USER in the Windows Registry.
bool WLTrialStringRead(
char* pStringName,
char * pStringValue
);

function WLTrialStringRead(
pStringName:PAnsiChar;
pStringValue:PAnsiChar;
):Boolean; stdcall;
WinLicense 89
2010 Oreans Technologies
Public Declare Function WLTrialStringRead Lib "WinLicenseSDK.dll" (
ByVal pStringName As String,
ByVal pStringValue As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLTrialStringRead", [in/out] StringName, 255);
[Visual Basic]
GetEnvironmentVariable("WLTrialStringRead", [in/out] StringName, 255)
Parameters
pStringName
[in] Name of the string to be accessed.
pStringValue
[out] Value of the string stored under StringName.
Return Values
If the function succeeds, the return value is True.
If the StringName does not exist, the return value is False. Notice that if you have a value stored under
"StringName" and you change the Trial Unique Key, the location of "StringName" will be different, hence this
function will return False as the location for "StringName" is empty.
See Also
WLTrialStringWrite
2010 Oreans Technologies. All rights reserved
1.6.1.21 WLTrialStringReadW
WLTrialStringReadW
The WLTrialStringReadW function reads a custom string from the Registry. The string is stored using
encryption algorithms and the location of the string is different for each computer.
The location of the string also depends on the "Trial Unique Key" in the protected software. If you change the
"Trial Unique Key" in your Software and protect again, the strings will be stored in a different Registry location.
NOTE: If StringName starts with "!", the custom string will be stored under HKEY_LOCAL_MACHINE, otherwise
it will be stored under HKEY_CURRENT_USER in the Windows Registry.
WinLicense Help File 90
2010 Oreans Technologies
bool WLTrialStringRead(
wchar_t* pStringName,
wchar_t* pStringValue
);

function WLTrialStringRead(
pStringName:PWideChar;
pStringValue:PWideChar;
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariable("WLTrialStringReadW", [in/out]
StringName:StringValue, 255);
[Visual Basic]
GetEnvironmentVariable("WLTrialStringReadW", [in/out] StringName:StringValue, 255)
Parameters
pStringName
[in] Name of the string to be accessed.
pStringValue
[out] Value of the string stored under StringName.
Return Values
If the function succeeds, the return value is True.
If the StringName does not exist, the return value is False. Notice that if you have a value stored under
"StringName" and you change the Trial Unique Key, the location of "StringName" will be different, hence this
function will return False as the location for "StringName" is empty.
See Also
WLTrialStringWriteW
2010 Oreans Technologies. All rights reserved
1.6.1.22 WLTrialStringWrite
WLTrialStringWrite
The WLTrialStringWrite function writes a custom string to the Registry. The string is stored using encryption
algorithms and the location of the string is different for each computer.
WinLicense 91
2010 Oreans Technologies
The location of the string also depends on the "Trial Unique Key" in the protected software. If you change the
"Trial Unique Key" in your Software and protect again, the strings will be stored in a different Registry location.
NOTE: If StringName starts with "!", the custom string will be stored under HKEY_LOCAL_MACHINE, otherwise
it will be stored under HKEY_CURRENT_USER in the Windows Registry.
bool WLTrialStringWrite(
char* pStringName,
char * pStringValue
);

function WLTrialStringWrite(
pStringName:PAnsiChar;
pStringValue:PAnsiChar;
):Boolean; stdcall;
Public Declare Function WLTrialStringWrite Lib "WinLicenseSDK.dll" (
ByVal pStringName As String,
ByVal pStringValue As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLTrialStringWrite", [in/out]
"StringName,StringValue", 255);
[Visual Basic]
GetEnvironmentVariable("WLTrialStringWrite", [in/out] "StringName,StringValue",
255)
Parameters
pStringName
[in] Name of the string to be accessed.
pStringValue
[in] Value of the string to be stored under StringName.
Return Values
If the function succeeds, the return value is True.
If the writing to the Registry fails, the return value is False.
See Also
WLTrialStringRead
WinLicense Help File 92
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.23 WLTrialStringWriteW
WLTrialStringWriteW
The WLTrialStringWriteW function writes a custom string to the Registry. The string is stored using
encryption algorithms and the location of the string is different for each computer.
The location of the string also depends on the "Trial Unique Key" in the protected software. If you change the
"Trial Unique Key" in your Software and protect again, the strings will be stored in a different Registry location.
NOTE: If StringName starts with "!", the custom string will be stored under HKEY_LOCAL_MACHINE, otherwise
it will be stored under HKEY_CURRENT_USER in the Windows Registry.
bool WLTrialStringWriteW(
wchar_t* pStringName,
wchar_t* pStringValue
);

function WLTrialStringWriteW(
pStringName:PWideChar;
pStringValue:PWideChar;
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariable("WLTrialStringWriteW", [in/out]
"StringName,StringValue", 255);
[Visual Basic]
GetEnvironmentVariable("WLTrialStringWriteW", [in/out] "StringName,StringValue",
255)
Parameters
pStringName
[in] Name of the string to be accessed.
pStringValue
[in] Value of the string to be stored under StringName.
Return Values
If the function succeeds, the return value is True.
If the writing to the Registry fails, the return value is False.
See Also
WLTrialStringReadW
WinLicense 93
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.1.24 WLTrialTotalDays
WLTrialTotalDays
The WLTrialTotalDays function retrieves the total number of trial days that an application can be executed.
int WLTrialTotalDays(void);

function WLTrialTotalDays():Integer; stdcall;
Public Declare Function WLTrialTotalDays Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialTotalDays", [out] TotalDays, 100);
[Visual Basic]
GetEnvironmentVariable("WLTrialTotalDays", [out] TotalDays, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of total trial days that an application can be executed.
See Also
WLTrialDaysLeft
2010 Oreans Technologies. All rights reserved
1.6.1.25 WLTrialTotalExecutions
WLTrialTotalExecutions
The WLTrialTotalExecutions function retrieves the total number of trial executions that an application can be
executed.
WinLicense Help File 94
2010 Oreans Technologies
int WLTrialTotalExecutions(void);
function WLTrialTotalExecutions():Integer; stdcall;
Public Declare Function WLTrialTotalExecutions Lib "WinLicenseSDK.dll" () As
Integer
[C#]
Kernel32.GetEnvironmentVariable("WLTrialTotalExecutions", [out] TotalExecutions,
100);
[Visual Basic]
GetEnvironmentVariable("WLTrialTotalExecutions", [out] TotalExecutions, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of total trial executions that an application can be executed.
See Also
WLTrialExecutionsLeft
2010 Oreans Technologies. All rights reserved
1.6.2 Registration Functions
Registration Functions
The following functions can be used to handle the registration information in an application.
Function Description
WinLicense 95
2010 Oreans Technologies
WLRegCheckMachineLocked Determines if the current license is locked to a
specific machine.
WLRegDateDaysLeft Retrieves the number of days left in the current
license when the license has Date Expiration.
WLRegDaysLeft Retrieves the number of days left in the current
license key.
WLRegDisableCurrentKey Marks the current license key as stolen or
invalid.
WLRegDisableKeyInCurrentInstance Disables the current installed key for the
specific application which calls the function.
WLRegExecutionsLeft Retrieves the number of executions left in the
current license key.
WLRegExpirationDate Retrieves the expiration date in a license key.
WLRegExpirationTimestamp Retrieves the exact expiration timestamp for a
license key with days expiration.
WLRegFirstRun Determines if an application is just registered
with a valid license key.
WLRegGetDynSmartKey Retrieves the Dynamic SmartActivate key that
was inserted to register an application.
WLRegGetLicenseHardwareID Retrieves the hardware ID in the current license
key.
WLRegGetLicenseInfo Retrieves the registration information for the
current license.
WLRegGetLicenseInfoW Retrieves the registration information (in
UNICODE) for the current license.
WLRegGetLicenseRestrictions Retrieves the restrictions included in the current
license.
WLRegGetStatus Retrieves information about the licensing status
in the current application.
WLRegGlobalTimeLeft Retrieves the number of minutes left in the
current license key.
WLRegLicenseCreationDate Retrieves the creation date in a license key.
WLRegLicenseName Retrieves the license file and registry names for
the expected registration license.
WLRegLockedCountry Retrieves the country code in the current
license key.
WLRegNetInstancesGet Retrieves the current number of instances
running in a network.
WLRegNetInstancesMax Retrieves the maximum number of instances
allowed in the current license.
WLRegNormalKeyCheck Validates a text key.
WLRegNormalKeyCheckW Validates a text key (UNICODE).
WLRegNormalKeyInstallToFile Installs a license text key into a file.
WLRegNormalKeyInstallToFileW Installs a license text key into a file (UNICODE).
WLRegNormalKeyInstallToRegistry Installs a license text key into a Windows
registry key.
WLRegNormalKeyInstallToRegistryW Installs a license text key into a Windows
registry key (UNICODE).
WLRegRemoveCurrentKey Removes the current license key from the
system.
WinLicense Help File 96
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.2.1 WLRegCheckMachineLocked
WLRegCheckMachineLocked
The WLRegCheckMachineLocked function determines if the current license is locked to a specific machine.
bool WLRegCheckMachineLocked(void);

function WLRegCheckMachineLocked():Boolean; stdcall;
Public Declare Function WLRegCheckMachineLocked Lib "WinLicenseSDK.dll" () As
Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegCheckMachineLocked", [out] IsMachineLocked,
100);
[Visual Basic]
GetEnvironmentVariable("WLRegCheckMachineLocked", [out] IsMachineLocked, 100)
Parameters
This function has no parameters.
Return Values
If the current license key is locked to a specific machine, the return value is True.
If the application is not licensed or the current license is not locked to a specific machine, the return value is
False.
2010 Oreans Technologies. All rights reserved
1.6.2.2 WLRegDateDaysLeft
WLRegDateDaysLeft
The WLRegDateDaysLeft function retrieves the number of days left in the current license when the license
has Date Expiration.
int WLRegDateDaysLeft(void);
WinLicense 97
2010 Oreans Technologies
function WLRegDateDaysLeft():Integer; stdcall;
Public Declare Function WLRegDateDaysLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegDateDaysLeft", [out] DaysLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegDateDaysLeft", [out] DaysLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of days left in the current license key.
Remarks
Please, notice that this function returns the number of days left when the license has Date Expiration. If the
license has Days Expiration and you want to know the number of days left, you have to use the function
WLRegDaysLeft.
2010 Oreans Technologies. All rights reserved
1.6.2.3 WLRegDaysLeft
WLRegDaysLeft
The WLRegDaysLeft function retrieves the number of days left in the current license key.
int WLRegDaysLeft(void);

function WLRegDaysLeft():Integer; stdcall;
Public Declare Function WLRegDaysLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegDaysLeft", [out] DaysLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegDaysLeft", [out] DaysLeft, 100)
WinLicense Help File 98
2010 Oreans Technologies
Parameters
This function has no parameters.
Return Values
The return value is the number of days left in the current license key.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
See Also
WLRegTotalDays
2010 Oreans Technologies. All rights reserved
1.6.2.4 WLRegDisableCurrentKey
WLRegDisableCurrentKey
The WLRegDisableCurrentKey function marks the current license key as stolen or invalid. This function can
be used when an application, with internet access, detects that the current key has been stolen. Winlicense will
block the license key in runtime and will prevent the application from running again with that license key.
bool WLRegDisableCurrentKey (
int DisableFlags
);

function WLRegDisableCurrentKey (
DisableFlags:Integer
):Boolean; stdcall;
Public Declare Function WLRegDisableCurrentKey Lib "WinLicenseSDK.dll" (
ByVal DisableFlags As Integer
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegDisableCurrentKey", [in/out] DisableFlags,
100);
[Visual Basic]
GetEnvironmentVariable("WLRegDisableCurrentKey", [in/out] DisableFlags, 100)
Parameters
WinLicense 99
2010 Oreans Technologies
DisableFlags
This parameter specifies the status to set up in the current license key.
The current version of WinLicense allows the following values for DisableFlags:
wlMarkStolenKey to mark a key as stolen.
wlMarkInvalidKey to mark a key as invalid.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegRemoveCurrentKey
2010 Oreans Technologies. All rights reserved
1.6.2.5 WLRegDisableKeyInCurrentInstance
WLRegDisableKeyInCurrentInstance
The WLRegDisableKeyInCurrentInstance function disables the current installed key for the specific
application which calls WLRegDisableKeyInCurrentInstance. That is, if you have 2 versions of your
application and one of them calls WLRegDisableKeyInCurrentInstance, then the current installed license will not
be valid for that specific instance (the "MsgID42 : License disabled in current instance" from
CustomizedDialogs will be displayed). Your other protected version will work fine with the current installed
license.
A typical case example is when you sell a product and your customers need to pay for a subscription after
some time. So, your customers will have access to your latest release versions. When the subscription expires
for a customer (for example, you store the subscription expiration date in the "Custom Data" inside a license),
you call WLRegDisableKeyInCurrentInstance and the license will not be valid for that specific version
which called that function. If your customer runs previous versions of your application, the license will be
recognized and your customer can keep using previous versions of your application, but he won't be able to
run the version which called WLRegDisableKeyInCurrentInstance.
bool WLRegDisableKeyInCurrentInstance();

function WLRegDisableKeyInCurrentInstance():Boolean; stdcall;
Public Declare Function WLRegDisableKeyInCurrentInstance Lib "WinLicenseSDK.dll"
() As Boolean
WinLicense Help File 100
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLRegDisableKeyInCurrentInstance", [out]
BufferOut, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegDisableKeyInCurrentInstance", [out] BufferOut, 100)
Parameters
This function has no parameters.
Return Values
If the license was successfully disabled, the return value is True.
If the function fails, the return value is False.
2010 Oreans Technologies. All rights reserved
1.6.2.6 WLRegExecutionsLeft
WLRegExecutionsLeft
The WLRegExecutionsLeft function retrieves the number of executions left in the current license key.
int WLRegExecutionsLeft(void);

function WLRegExecutionsLeft():Integer; stdcall;
Public Declare Function WLRegExecutionsLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegExecutionsLeft", [out] ExecutionsLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegExecutionsLeft", [out] ExecutionsLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of executions left in the current license key.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
WinLicense 101
2010 Oreans Technologies
See Also
WLRegTotalExecutions
2010 Oreans Technologies. All rights reserved
1.6.2.7 WLRegExpirationDate
WLRegExpirationDate
The WLRegExpirationDate function retrieves the expiration date in a license key.
int WLRegExpirationDate(
SYSTEMTIME* pExpDate
);

function WLRegExpirationDate(
var pExpDate:SYSTEMTIME
):Integer; stdcall;
Public Declare Function WLRegExpirationDate Lib "WinLicenseSDK.dll" (
pExpDate As Any
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegExpirationDate", [out] ExpirationDate, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegExpirationDate", [out] ExpirationDate, 100)
Parameters
pExpDate
[out] Pointer to a SYSTEMTIME structure that receives the license expiration date.
Return Values
If the function succeeds the return value is zero.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
WinLicense Help File 102
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.2.8 WLRegExpirationTimestamp
WLRegExpirationTimestamp
The WLRegExpirationTimestamp function gets the exact expiration timestamp for a license key with days
expiration. This function can be called when a license with days expiration is present to know the exact date
and time that the license will expire.
bool WLRegExpirationTimestamp(
FILETIME* pFileTime
);

function WLRegExpirationTimestamp(
var pFileTime:FILETIME
):Boolean; stdcall;
Public Declare Function WLRegExpirationTimestamp 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 registered with a license with expiration days, the return value is False.
Remarks
This function only works with licenses with expiration days. In other cases, it will always return False.
2010 Oreans Technologies. All rights reserved
1.6.2.9 WLRegFirstRun
WLRegFirstRun
The WLRegFirstRun function determines if an application is running in Registered mode for the first time.
WinLicense 103
2010 Oreans Technologies
bool WLRegFirstRun(void);

function WLRegFirstRun():Boolean; stdcall;
Public Declare Function WLRegFirstRun Lib "WinLicenseSDK.dll" () As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegFirstRun", [out] RegFirstTime, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegFirstRun", [out] RegFirstTime, 100)
Parameters
This function has no parameters.
Return Values
When an application is just licensed, the return value is True. Notice that if an application is licensed again with
a different license key, the return value will be True.
See Also
WLTrialFirstRun
2010 Oreans Technologies. All rights reserved
1.6.2.10 WLRegGetDynSmartKey
WLRegGetDynSmartKey
The WLRegGetDynSmartKey retrieves the Dynamic SmartActivate key that was inserted by the customer to
register a protected application.
bool WLRegGetDynSmartKey (
char* pDynSmartKey);

function WLRegGetDynSmartKey (
pDynSmartKey:PAnsiChar
):Boolean; stdcall;
WinLicense Help File 104
2010 Oreans Technologies
Public Declare Function WLRegGetDynSmartKey Lib "WinLicenseSDK.dll" (
ByVal pDynSmartKey As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegGetDynSmartKey", [out] DynSmartKey, 1024);
[Visual Basic]
GetEnvironmentVariable("WLRegGetDynSmartKey", [out] DynSmartKey, 1024)
Parameters
pDynSmartKey
[out] Pointer to a buffer that receives the registration Dynamic SmartActivate key.
Return Values
If the current license was registered with a Dynamic SmartActivate key, the return value is True.
If the current license was not registered with a Dynamic SmartActivate key, the return value is False.
2010 Oreans Technologies. All rights reserved
1.6.2.11 WLRegGetLicenseHardwareID
WLRegGetLicenseHardwareID (Not currently available)
The WLRegGetLicenseHardwareID retrieves the hardware ID in the current license key.
bool WLRegGetLicenseHardwareID (
char* pHardwareId);

function WLRegGetLicenseHardwareID (
pHardwareId:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegGetLicenseHardwareID Lib "WinLicenseSDK.dll" (
ByVal pHardwareId As String
) As Boolean
WinLicense 105
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLRegGetLicenseHardwareID", [out] HardwareID,
100);
[Visual Basic]
GetEnvironmentVariable("WLRegGetLicenseHardwareID", [out] HardwareID, 100)
Parameters
pHardwareId
[out] Pointer to a buffer that will receive a null-terminated string with the hardware ID in the current
license key.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLHardwareGetID, WLHardwareCheckID, WLHardwareGetFormattedID
2010 Oreans Technologies. All rights reserved
1.6.2.12 WLRegGetLicenseInfo
WLRegGetLicenseInfo
The WLRegGetLicenseInfo function retrieves the registration information for the current license.
bool WLRegGetLicenseInfo(
char* pName,
char* pCompanyName,
char* pCustomData
);

function WLRegGetLicenseInfo(
pName:PAnsiChar;
pCompanyName:PAnsiChar;
pCustomData:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegGetLicenseInfo Lib "WinLicenseSDK.dll" (
ByVal pName As String,
ByVal pCompanyName As String,
ByVal pCustomData As String
) As Boolean
WinLicense Help File 106
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLRegGetLicenseInfo", [out] CustomerInfo, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegGetLicenseInfo", [out] CustomerInfo, 500)
Parameters
pName
[out] Pointer to a string that will receive the registration name in the current license key.
pCompanyName
[out] Pointer to a string that will receive the company name in the current license key.
pCustomData
[out] Pointer to a string that will receive the custom data in the current license key.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegGetStatus
2010 Oreans Technologies. All rights reserved
1.6.2.13 WLRegGetLicenseInfoW
WLRegGetLicenseInfoW
The WLRegGetLicenseInfoW function retrieves the registration information (in UNICODE) for the current
license.
bool WLRegGetLicenseInfoW(
wchar_t* pName,
wchar_t* pCompanyName,
wchar_t* pCustomData
);

WinLicense 107
2010 Oreans Technologies
function WLRegGetLicenseInfoW(
pName:PWideChar;
pCompanyName:PWideChar;
pCustomData:PWideChar
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariable("WLRegGetLicenseInfoW", [out] CustomerInfo, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegGetLicenseInfoW", [out] CustomerInfo, 500)
Parameters
pName
[out] Pointer to a string that will receive the registration name in the current license key.
pCompanyName
[out] Pointer to a string that will receive the company name in the current license key.
pCustomData
[out] Pointer to a string that will receive the custom data in the current license key.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegGetStatus
2010 Oreans Technologies. All rights reserved
1.6.2.14 WLRegGetLicenseRestrictions
WLRegGetLicenseRestrictions
The WLRegGetLicenseRestrictions function retrieves a bit mask with the restrictions included in the current
license. This function is suitable when you are registering your application with licenses with different
registration restrictions (days expiration, executions, date expiration, etc) to know which WinLicense SDK
functions you should call for each specific license.
int WLRegGetLicenseRestrictions(void);
WinLicense Help File 108
2010 Oreans Technologies
function WLRegGetLicenseRestrictions():Integer; stdcall;
Public Declare Function WLRegGetLicenseRestrictions Lib "WinLicenseSDK.dll" () As
Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegGetLicenseRestrictions", [out]
LicenseRestrictions, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegGetLicenseRestrictions", [out] LicenseRestrictions,
100)
Parameters
This function has no parameters.
Return Values
The return value is a bit mask with the license restrictions included in the current license. Current supported
values:

Value Meaning
wlRegRestrictionDays
0x0001
Days expiration is enabled
wlRegRestrictionExec
0x0002
Executions expiration is enabled
wlRegRestrictionDate
0x0004
Date expiration is enabled
wlRegRestrictionRuntime
0x0008
Runtime restriction is enabled
wlRegRestrictionGlobalTime
0x0010
Global time restriction is enabled
wlRegRestrictionCountry
0x0020
Country restriction is enabled
wlRegRestrictionHardwareId
0x0040
License has hardware ID restriction
wlRegRestrictionNetwork
0x0080
Network instances restriction is enabled
wlRegRestrictionInstallDate
0x0100
Install before specific date is enabled
wlRegRestrictionCreationDate
0x0200
License has its own creation date embedded
wlRegRestrictionEmbedUserInfo
0x0400
License information is included inside SmarKey
license (for Dynamic SmartKeys only)
WinLicense 109
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.2.15 WLRegGetLicenseType
WLRegGetLicenseType
The WLRegGetLicenseType function retrieves a bitmask with the location (File or Registry) and type (Normal
Key, Static SmartKey, Dynamic SmartKey) of the current license.
int WLRegGetLicenseType(void);
function WLRegGetLicenseType():Integer; stdcall;
Public Declare Function WLRegGetLicenseType Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegGetLicenseType", [out] LicenseRestrictions,
100);
[Visual Basic]
GetEnvironmentVariable("WLRegGetLicenseType", [out] LicenseRestrictions, 100)
Parameters
This function has no parameters.
Return Values
The return value is a bit mask with the the location and type of the current key:
Bit 0: Location of license:
0: License is located in a file.
1: License is located in the Registry.
Bits 1-2: Type of license:
01: Normal license.
10: Static SmartKey.
11: Dynamic SmartKey.
2010 Oreans Technologies. All rights reserved
1.6.2.16 WLRegGetStatus
WLRegGetStatus
WinLicense Help File 110
2010 Oreans Technologies
The WLRegGetStatus function retrieves information about the licensing status of the current application.
int WLRegGetStatus(
int* pExtendedInfo
);

function WLRegGetStatus(
var pExtendedInfo:Integer
):Integer; stdcall;
Public Declare Function WLRegGetStatus Lib "WinLicenseSDK.dll" (
pExtendedInfo As Any
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegGetStatus", [out] RegStatus, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegGetStatus", [out] RegStatus, 100)
Parameters
pExtendedInfo
[out] Pointer to a variable that will receive extended information about the application status.
The returned extended information can be:
wlLicenseDaysExpired when a license is expired on days.
wlLicenseExecExpired when a license is expired on executions.
wlLicenseDateExpired when a license is expired on date.
wlLicenseGlobalExpired when the global time in a license has expired.
wlLicenseRuntimeExpired when license runtime has expired.
Return Values
The return value is the licensing status in the current application. The possible values are the followings:
wlIsTrial when an application is running in trial mode (not registered).
wlIsRegistered when an application is registered with a valid license key.
wlInvalidLicense when a license key is invalid.
wlInvalidHardwareLicense when the machine ID, inside a license key, is invalid for current machine.
wlNoMoreHwdChanges when no more machine ID changes are allowed in the current license key.
wlLicenseExpired when a license key has expired. Check pExtendedInfo to retrieve extra information.
wlInvalidCountryLicense when a license is locked to different country.
wlLicenseStolen when a license key is stolen.
wlWrongLicenseExp when a license key is a permanent key and only licenses that expire are allowed
WinLicense 111
2010 Oreans Technologies
in an application.
wlWrongLicenseHardware when the current license key does not have machine ID information (and
machine ID is required in an application).
wlNoMoreInstancesAllowed when the protected application has reached the maximum number of
instances in a network.
wlNetworkNoServerRunning when a network license is locked to a server and the server is not
running the protected application.
wlInstallLicenseDateExpired when a license has been installed after a specific installation date.
wlLicenseDisabledInstance when a license has been disabled for a specific application (When calling
the function WLRegDisableKeyInCurrentInstance).
See Also
WLTrialGetStatus
2010 Oreans Technologies. All rights reserved
1.6.2.17 WLRegGlobalTimeLeft
WLRegGlobalTimeLeft
The WLRegGlobalTimeLeft function retrieves the number of minutes left in the current license key.
int WLRegGlobalTimeLeft(void);
function WLRegGlobalTimeLeft():Integer; stdcall;
Public Declare Function WLRegGlobalTimeLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegGlobalTimeLeft", [out] GlobalTimeLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegGlobalTimeLeft", [out] GlobalTimeLeft, 100)
Parameters
This function has no parameters.
WinLicense Help File 112
2010 Oreans Technologies
Return Values
The return value is the number of minutes left in the current license key.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
2010 Oreans Technologies. All rights reserved
1.6.2.18 WLRegLicenseCreationDate
WLRegLicenseCreationDate
The WLRegLicenseCreationDate function retrieves the date when the license was created.
bool WLRegLicenseCreationDate(
SYSTEMTIME* pCreationDate
);

function WLRegLicenseCreationDate(
var pCreationDate:SYSTEMTIME
):Integer; stdcall;
Public Declare Function WLRegLicenseCreationDate Lib "WinLicenseSDK.dll" (
pCreationDate As Any
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegLicenseCreationDate", [out] pCreationDate,
100);
[Visual Basic]
GetEnvironmentVariable("WLRegLicenseCreationDate", [out] pCreationDate, 100)
Parameters
pCreationDate
[out] Pointer to a SYSTEMTIME structure that receives the license creation date.
Return Values
If the function succeeds the return value is zero.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
WinLicense 113
2010 Oreans Technologies
1.6.2.19 WLRegLicenseName
WLRegLicenseName
The WLRegLicenseName function retrieves the license file and registry names for the expected registration
license.
void WLRegLicenseName(
char* pFileKeyName,
char* pRegKeyName,
char* pRegKeyValueName
);

procedure WLRegLicenseName(
pFileKeyName: PAnsiChar;
pRegKeyName: PAnsiChar;
pRegKeyValueName: PAnsiChar
); stdcall;
Public Declare Function WLRegLicenseName Lib "WinLicenseSDK.dll" (
ByVal pFileKeyName As String,
ByVal pRegKeyName As String,
ByVal pRegKeyValueName As String
) As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegLicenseName", [out] KeyNames, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegLicenseName", [out] KeyNames, 100)
Parameters
pFileKeyName
[out] Pointer to a buffer that will receive the name of the file key expected.
pRegKeyName
[out] Pointer to a buffer that will receive the name of the registry key expected.
RegKeyValueName
[out] Pointer to a buffer that will receive the name of the registry value key expected.
Return Values
The function has no return values.
WinLicense Help File 114
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.2.20 WLRegLockedCountry
WLRegLockedCountry
The WLRegLockedCountry function retrieves the country code in the current license key. The application will
be locked to that country when registered.
int WLRegLockedCountry(void);
function WLRegLockedCountry():Integer; stdcall;
Public Declare Function WLRegLockedCountry Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegLockedCountry", [out] LockedCountry, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegLockedCountry", [out] LockedCountry, 100)
Parameters
This function has no parameters.
Return Values
If the function succeeds the return value is the country code in the current license key. To see a list of the
possible country codes, check the country codes list.
If a license key has not been installed, the return value is wlNoKey.
2010 Oreans Technologies. All rights reserved
1.6.2.21 WLRegNetInstancesGet
WLRegNetInstancesGet
The WLRegNetInstancesGet function retrieves the current number of instances running in a network.
int WLRegNetInstancesGet(void);
WinLicense 115
2010 Oreans Technologies

function WLRegNetInstancesGet():Integer; stdcall;
Public Declare Function WLRegNetInstancesGet Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegNetInstancesGet", [out] NumInstances, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegNetInstancesGet", [out] NumInstances, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of of instances running in a network.
Restrictions
If the application is registered with a license with no network instances limit, the return value is zero.
If the application is registered with a license with network instances limit and a firewall is blocking the network
communication for the protected application, the return value is zero.
2010 Oreans Technologies. All rights reserved
1.6.2.22 WLRegNetInstancesMax
WLRegNetInstancesMax
The WLRegNetInstancesMax function retrieves the maximum number of instances allowed in the current
license.
int WLRegNetInstancesMax(void);

function WLRegNetInstancesMax():Integer; stdcall;
Public Declare Function WLRegNetInstancesMax Lib "WinLicenseSDK.dll" () As Integer
WinLicense Help File 116
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLRegNetInstancesMax", [out] NumInstances, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegNetInstancesMax", [out] NumInstances, 100)
Parameters
This function has no parameters.
Return Values
The return value is the maximum number of of instances allowed in the current license.
If the license has no network instances limit, the return value is zero.
2010 Oreans Technologies. All rights reserved
1.6.2.23 WLRegNormalKeyCheck
WLRegNormalKeyCheck
The WLRegNormalKeyCheck validates a text key. This function should be called before installing a text key
into the system.
bool WLRegNormalKeyCheck(
const char* pTextKey);

function WLRegNormalKeyCheck(
pTextKey:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegNormalKeyCheck Lib "WinLicenseSDK.dll" (
ByVal pTextKey As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegNormalKeyCheck", [in/out] TextKey, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegNormalKeyCheck", [in/out] TextKey, 500)
Parameters
pTextKey
[in] Pointer to a null-terminated string that specifies the text key to validate.
WinLicense 117
2010 Oreans Technologies
Return Values
If the text key is valid, the return value is True.
If the text key is invalid, the return value is False.
See Also
WLRegNormalKeyInstallToRegistry, WLRegNormalKeyInstallToFile, WLGenLicenseTextKey
2010 Oreans Technologies. All rights reserved
1.6.2.24 WLRegNormalKeyCheckW
WLRegNormalKeyCheckW
The WLRegNormalKeyCheckW validates a text key (given as UNICODE). This function should be called
before installing a text key into the system.
bool WLRegNormalKeyCheckW(
const wchar_t* pTextKey);

function WLRegNormalKeyCheckW(
pTextKey:PWideChar
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariableW("WLRegNormalKeyCheckW", [in/out] TextKey, 500);
[Visual Basic]
GetEnvironmentVariableW("WLRegNormalKeyCheckW", [in/out] TextKey, 500)
Parameters
pTextKey
[in] Pointer to a null-terminated string that specifies the text key to validate.
Return Values
If the text key is valid, the return value is True.
If the text key is invalid, the return value is False.
See Also
WLRegNormalKeyInstallToRegistryW, WLRegNormalKeyInstallToFileW, WLGenLicenseTextKey
WinLicense Help File 118
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.2.25 WLRegNormalKeyInstallToFile
WLRegNormalKeyInstallToFile
The WLRegNormalKeyInstallToFile installs a license text key into a file. When this function is called, a
license file (selected in the Winlicense user interface) will be created. This license file will be able to register the
application the next time that is started.
bool WLRegNormalKeyInstallToFile(
const char* pTextKey);

function WLRegNormalKeyInstallToFile(
pTextKey:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegNormalKeyInstallToFile Lib "WinLicenseSDK.dll" (
ByVal pTextKey As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegNormalKeyInstallToFile", [in/out] TextKey,
500);
[Visual Basic]
GetEnvironmentVariable("WLRegNormalKeyInstallToFile", [in/out] TextKey, 500)
Parameters
pTextKey
[in] Pointer to a null-terminated string that specifies the text key to install into a license file.
The name of the license file can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegNormalKeyInstallToRegistry, WLRegNormalKeyCheck, WLGenLicenseTextKey
WinLicense 119
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.2.26 WLRegNormalKeyInstallToFileW
WLRegNormalKeyInstallToFileW
The WLRegNormalKeyInstallToFileW installs a license text key into a file. When this function is called, a
license file (selected in the Winlicense user interface) will be created. This license file will be able to register the
application the next time that is started.
bool WLRegNormalKeyInstallToFileW(
const wchar_t* pTextKey);

function WLRegNormalKeyInstallToFile(
pTextKey:PWideChar
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariableW("WLRegNormalKeyInstallToFileW", [in/out] TextKey,
500);
[Visual Basic]
GetEnvironmentVariableW("WLRegNormalKeyInstallToFileW", [in/out] TextKey, 500)
Parameters
pTextKey
[in] Pointer to a null-terminated string that specifies the text key to install into a license file.
The name of the license file can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegNormalKeyInstallToRegistryW, WLRegNormalKeyCheckW, WLGenLicenseTextKey
2010 Oreans Technologies. All rights reserved
WinLicense Help File 120
2010 Oreans Technologies
1.6.2.27 WLRegNormalKeyInstallToRegistry
WLRegNormalKeyInstallToRegistry
The WLRegNormalKeyInstallToRegistry installs a license text key into a Windows registry key. When this
function is called, a Windows registry key (selected in the Winlicense user interface) will be created. This
registry key will be able to register the application the next time that is started.
bool WLRegNormalKeyInstallToRegistry(
const char* pTextKey);

function WLRegNormalKeyInstallToRegistry(
pTextKey:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegNormalKeyInstallToRegistry Lib "WinLicenseSDK.dll" (
ByVal pTextKey As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegNormalKeyInstallToRegistry", [in/out]
TextKey, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegNormalKeyInstallToRegistry", [in/out] TextKey, 500)
Parameters
pTextKey
[in] Pointer to a null-terminated string that specifies the text key to install into the Windows registry.
The name of the Windows registry key can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegNormalKeyInstallToFile, WLRegNormalKeyCheck, WLGenLicenseTextKey
2010 Oreans Technologies. All rights reserved
WinLicense 121
2010 Oreans Technologies
1.6.2.28 WLRegNormalKeyInstallToRegistryW
WLRegNormalKeyInstallToRegistryW
The WLRegNormalKeyInstallToRegistryW installs a license text key into a Windows registry key. When this
function is called, a Windows registry key (selected in the Winlicense user interface) will be created. This
registry key will be able to register the application the next time that is started.
bool WLRegNormalKeyInstallToRegistryW(
const wchar_t* pTextKey);

function WLRegNormalKeyInstallToRegistryW(
pTextKey:PWideChar
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariableW("WLRegNormalKeyInstallToRegistryW", [in/out]
TextKey, 500);
[Visual Basic]
GetEnvironmentVariableW("WLRegNormalKeyInstallToRegistryW", [in/out] TextKey, 500)
Parameters
pTextKey
[in] Pointer to a null-terminated string that specifies the text key to install into the Windows registry.
The name of the Windows registry key can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegNormalKeyInstallToFileW, WLRegNormalKeyCheckW, WLGenLicenseTextKey
2010 Oreans Technologies. All rights reserved
1.6.2.29 WLRegRemoveCurrentKey
WLRegRemoveCurrentKey
WinLicense Help File 122
2010 Oreans Technologies
The WLRegRemoveCurrentKey function removes the current license key from the system. This function
deletes the current license from the system (file or registry license), making an application not to be registered
the next time that is executed. Notice that this function will not block the current license.
bool WLRegRemoveCurrentKey(void);

function WLRegRemoveCurrentKey():Boolean; stdcall;
Public Declare Function WLRegRemoveCurrentKey Lib "WinLicenseSDK.dll" () As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegRemoveCurrentKey", [out] RemoveKeyStatus,
100);
[Visual Basic]
GetEnvironmentVariable("WLRegRemoveCurrentKey", [out] RemoveKeyStatus, 100)
Parameters
This function has no parameters.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegDisableCurrentKey
2010 Oreans Technologies. All rights reserved
1.6.2.30 WLRegRuntimeLeft
WLRegRuntimeLeft
The WLRegRuntimeLeft function retrieves the runtime left that a registered application can be running in
memory.
int WLRegRuntimeLeft(void);

WinLicense 123
2010 Oreans Technologies
function WLRegRuntimeLeft():Integer; stdcall;
Public Declare Function WLRegRuntimeLeft Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegRuntimeLeft", [out] RuntimeLeft, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegRuntimeLeft", [out] RuntimeLeft, 100)
Parameters
This function has no parameters.
Return Values
The return value is the runtime left in minutes.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
2010 Oreans Technologies. All rights reserved
1.6.2.31 WLRegSmartKeyCheck
WLRegSmartKeyCheck
The WLRegSmartKeyCheck validates a SmartActivate key. This function should be called before installing a
SmartActivate key into the system.
bool WLRegSmartKeyCheck(
const char* pUserName,
const char* pOrganization,
const char* pCustomData,
const char* pSmartKey
);

function WLRegSmartKeyCheck(
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pSmartKey:PAnsiChar
):Boolean; stdcall;
WinLicense Help File 124
2010 Oreans Technologies
Public Declare Function WLRegSmartKeyCheck Lib "WinLicenseSDK.dll" (
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pSmartKey As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegSmartKeyCheck", [in/out] SmartKeyInfo, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegSmartKeyCheck", [in/out] SmartKeyInfo, 500)
Parameters
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the SmartActivate key
to validate.
If this parameter is zero, it means that the SmartActivate key does not have user name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the SmartActivate key
to validate.
If this parameter is zero, it means that the SmartActivate key does not have organization information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the SmartActivate key to
validate.
If this parameter is zero, it means that the SmartActivate key does not have custom information.
pSmartKey
[in] Pointer to a null-terminated string that specifies the SmartActivate key to validate.
Return Values
If the SmartActivate key is valid, the return value is True.
If the SmartActivate key is invalid, the return value is False.
See Also
wLRegSmartKeyInstallToRegistry, wLRegSmartKeyInstallToFile, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
WinLicense 125
2010 Oreans Technologies
1.6.2.32 WLRegSmartKeyCheckW
WLRegSmartKeyCheckW
The WLRegSmartKeyCheckW validates a SmartActivate key. This function should be called before
installing a SmartActivate key into the system.
This function should be used when a license has been generated with UNICODE functions.
bool WLRegSmartKeyCheckW(
const wchar_t* pUserName,
const wchar_t* pOrganization,
const wchar_t* pCustomData,
const wchar_t* pSmartKey
);

function WLRegSmartKeyCheckW(
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pSmartKey:PWideChar
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariableW("WLRegSmartKeyCheckW", [in/out] SmartKeyInfo,
500);
[Visual Basic]
GetEnvironmentVariableW("WLRegSmartKeyCheckW", [in/out] SmartKeyInfo, 500)
Parameters
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the SmartActivate key
to validate.
If this parameter is zero, it means that the SmartActivate key does not have user name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the SmartActivate key
to validate.
If this parameter is zero, it means that the SmartActivate key does not have organization information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the SmartActivate key to
validate.
If this parameter is zero, it means that the SmartActivate key does not have custom information.
pSmartKey
[in] Pointer to a null-terminated string that specifies the SmartActivate key to validate.
Return Values
If the SmartActivate key is valid, the return value is True.
If the SmartActivate key is invalid, the return value is False.
WinLicense Help File 126
2010 Oreans Technologies
See Also
wLRegSmartKeyInstallToRegistryW, wLRegSmartKeyInstallToFileW, WLGenLicenseSmartKeyW
2010 Oreans Technologies. All rights reserved
1.6.2.33 WLRegSmartKeyInstallToFile
WLRegSmartKeyInstallToFile
The WLRegSmartKeyInstallToFile installs a SmartActivate key into a file. When this function is called, a
license file (selected in the Winlicense user interface) will be created. This license file will be able to register the
application the next time that it is started.
bool WLRegSmartKeyInstallToFile(
const char* pUserName,
const char* pOrganization,
const char* pCustomData,
const char* pSmartKey
);

function WLRegSmartKeyInstallToFile(
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pSmartKey:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegSmartKeyInstallToFile Lib "WinLicenseSDK.dll" (
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pSmartKey As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegSmartKeyInstallToFile", [in/out]
SmartKeyInfo, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegSmartKeyInstallToFile", [in/out] SmartKeyInfo, 500)
Parameters
pUserName
WinLicense 127
2010 Oreans Technologies
[in] Pointer to a null-terminated string that specifies the registration name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have registration name
information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have organization name
information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the SmartActivate key to
install.
If this parameter is zero, the generated SmartActivate key will not have custom data information.
pSmartKey
[in] Pointer to a null-terminated string that specifies the SmartActivate key to install into a license file.
The name of the license file can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegSmartKeyInstallToRegistry, WLRegSmartKeyCheck, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
1.6.2.34 WLRegSmartKeyInstallToFileW
WLRegSmartKeyInstallToFileW
The WLRegSmartKeyInstallToFileW installs a SmartActivate key into a file. When this function is called, a
license file (selected in the Winlicense user interface) will be created. This license file will be able to register the
application the next time that it is started.
This function should be used when a license has been generated with UNICODE functions.
WinLicense Help File 128
2010 Oreans Technologies
bool WLRegSmartKeyInstallToFileW(
const wchar_t* pUserName,
const wchar_t* pOrganization,
const wchar_t* pCustomData,
const wchar_t* pSmartKey
);

function WLRegSmartKeyInstallToFileW(
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pSmartKey:PWideChar
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariableW("WLRegSmartKeyInstallToFileW", [in/out]
SmartKeyInfo, 500);
[Visual Basic]
GetEnvironmentVariableW("WLRegSmartKeyInstallToFileW", [in/out] SmartKeyInfo, 500)
Parameters
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have registration name
information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have organization name
information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the SmartActivate key to
install.
If this parameter is zero, the generated SmartActivate key will not have custom data information.
pSmartKey
[in] Pointer to a null-terminated string that specifies the SmartActivate key to install into a license file.
The name of the license file can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegSmartKeyInstallToRegistryW, WLRegSmartKeyCheckW, WLGenLicenseSmartKeyW
WinLicense 129
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.2.35 WLRegSmartKeyInstallToFileInFolder
WLRegSmartKeyInstallToFileInFolder
The WLRegSmartKeyInstallToFileInFolder installs a SmartActivate key into a file in a specific folder.
When this function is called, a license file (selected in the Winlicense user interface) will be created. This license
file will be able to register the application the next time that it is started.
WinLicense will always search for the generated file license in the same folder as the protected application. This
function is rarely used but it could be used in specific situations where the license needs to be created in a
different drive (like a USB drive) from where the application needs to run.
bool WLRegSmartKeyInstallToFileInFolder(
const char* pUserName,
const char* pOrganization,
const char* pCustomData,
const char* pSmartKey,
const char* pFolderPath
);

function WLRegSmartKeyInstallToFileInFolder(
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pSmartKey:PAnsiChar;
pFolderPath:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegSmartKeyInstallToFileInFolder Lib "WinLicenseSDK.dll"
(
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pSmartKey As String,
ByVal pFolderPath As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegSmartKeyInstallToFileInFolder", [in/out]
SmartKeyInfo, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegSmartKeyInstallToFileInFolder", [in/out]
SmartKeyInfo, 500)
Parameters
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the SmartActivate key
to install.
WinLicense Help File 130
2010 Oreans Technologies
If this parameter is zero, the generated SmartActivate key will not have registration name
information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have organization name
information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the SmartActivate key to
install.
If this parameter is zero, the generated SmartActivate key will not have custom data information.
pSmartKey
[in] Pointer to a null-terminated string that specifies the SmartActivate key to install into a license file.
The name of the license file can be set up in the Winlicense user interface.
pFolderPath
[in] Pointer to a null-terminated string that specifies the folder where the file key will be created.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLRegSmartKeyInstallToRegistry, WLRegSmartKeyCheck, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
1.6.2.36 WLRegSmartKeyInstallToRegistry
WLRegSmartKeyInstallToRegistry
The WLRegSmartKeyInstallToRegistry installs a SmartActivate key into a Windows registry key. When
this function is called, a Windows registry key (selected in the Winlicense user interface) will be created. This
Windows registry key will be able to register the application the next time that is started.
WinLicense 131
2010 Oreans Technologies
bool WLRegSmartKeyInstallToRegistry(
const char* pUserName,
const char* pOrganization,
const char* pCustomData,
const char* pSmartKey
);

function WLRegSmartKeyInstallToRegistry(
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pSmartKey:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRegSmartKeyInstallToRegistry Lib "WinLicenseSDK.dll" (
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pSmartKey As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRegSmartKeyInstallToRegistry", [in/out]
SmartKeyInfo, 500);
[Visual Basic]
GetEnvironmentVariable("WLRegSmartKeyInstallToRegistry", [in/out] SmartKeyInfo,
500)
Parameters
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have registration name
information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have organization name
information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the SmartActivate key to
install.
If this parameter is zero, the generated SmartActivate key will not have custom data information.
pSmartKey
[in] Pointer to a null-terminated string that specifies the SmartActivate key to install into a Windows
registry key.
The name of the Windows registry key can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
WinLicense Help File 132
2010 Oreans Technologies
If the function fails, the return value is False.
See Also
wLRegSmartKeyInstallToFile, WLRegSmartKeyCheck, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
1.6.2.37 WLRegSmartKeyInstallToRegistryW
WLRegSmartKeyInstallToRegistryW
The WLRegSmartKeyInstallToRegistryW installs a SmartActivate key into a Windows registry key. When
this function is called, a Windows registry key (selected in the Winlicense user interface) will be created. This
Windows registry key will be able to register the application the next time that is started.
This function should be used when a license has been generated with UNICODE functions.
bool WLRegSmartKeyInstallToRegistryW(
const wchar_t* pUserName,
const wchar_t* pOrganization,
const wchar_t* pCustomData,
const wchar_t* pSmartKey
);

function WLRegSmartKeyInstallToRegistryW(
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pSmartKey:PWideChar
):Boolean; stdcall;
[C#]
Kernel32.GetEnvironmentVariableW("WLRegSmartKeyInstallToRegistryW", [in/out]
SmartKeyInfo, 500);
[Visual Basic]
GetEnvironmentVariableW("WLRegSmartKeyInstallToRegistryW", [in/out] SmartKeyInfo,
500)
Parameters
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the SmartActivate key
to install.
WinLicense 133
2010 Oreans Technologies
If this parameter is zero, the generated SmartActivate key will not have registration name
information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the SmartActivate key
to install.
If this parameter is zero, the generated SmartActivate key will not have organization name
information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the SmartActivate key to
install.
If this parameter is zero, the generated SmartActivate key will not have custom data information.
pSmartKey
[in] Pointer to a null-terminated string that specifies the SmartActivate key to install into a Windows
registry key.
The name of the Windows registry key can be set up in the Winlicense user interface.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
wLRegSmartKeyInstallToFile, WLRegSmartKeyCheck, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
1.6.2.38 WLRegTotalDays
WLRegTotalDays
The WLRegTotalDays function retrieves the total number of days in the current license key.
int WLRegTotalDays(void);
function WLRegTotalDays():Integer; stdcall;
Public Declare Function WLRegTotalDays Lib "WinLicenseSDK.dll" () As Integer
WinLicense Help File 134
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLRegTotalDays", [out] TotalDays, 100);
[Visual Basic]
GetEnvironmentVariable("WLRegTotalDays", [out] TotalDays, 100)
Parameters
This function has no parameters.
Return Values
The return value is the number of total days in the current license key.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
See Also
WLRegDaysLeft
2010 Oreans Technologies. All rights reserved
1.6.2.39 WLRegTotalExecutions
WLRegTotalExecutions
The WLRegTotalExecutions function retrieves the total number of executions in the current license key.
int WLRegTotalExecutions(void);
function WLRegTotalExecutions():Integer; stdcall;
Public Declare Function WLRegTotalExecutions Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLRegTotalExecutions", [out] TotalExecutions,
100);
[Visual Basic]
GetEnvironmentVariable("WLRegTotalExecutions", [out] TotalExecutions, 100)
WinLicense 135
2010 Oreans Technologies
Parameters
This function has no parameters.
Return Values
The return value is the number of total executions in the current license key.
If the license key is a permanent key the return value is wlPermKey.
If a license key has not been installed, the return value is wlNoKey.
See Also
WLRegExecutionsLeft
2010 Oreans Technologies. All rights reserved
1.6.3 Generators Functions
Generators Functions
Software Developers can use the embedded passwords/licenses generator in the Winlicense user interface to
control the management of new clients. There are some situations where a specific password/license generator
needs to be used to satisfy special needs. For example, when a software developer decides to automatically
handle the creation of new licenses through an authentication system. In those cases, Winlicense exports an
API to create custom password/license managers.
The following functions can be used to generate custom passwords and licenses managers.
Function Description
WinLicense Help File 136
2010 Oreans Technologies
WLGenLicenseFileKey Generates a license FILE key to register a
specific application.
WLGenLicenseFileKeyEx Generates a license key that will work in a
specific application.
WLGenLicenseRegistryKey Generates a license REGISTRY key to register a
specific application.
WLGenLicenseRegistryKeyEx Generates a license key that will work in a
specific application.
WLGenLicenseTextKey Generates a license TEXT key to register a
specific application.
WLGenLicenseTextKeyEx Generates a license key that will work in a
specific application.
WLGenLicenseDynSmartKey Generates a license key that will work in a
specific application.
WLGenLicenseSmartKey Generates a license SmartActivate key to
register a specific application.
WLGenPassword Generates a specific password for a given user
name.
WLGenTrialExtensionFileKey Generates a trial extension FILE key to extend
the current trial period in a specific application.
WLGenTrialExtensionRegistryKey Generates a trial extension REGISTRY key to
extend the current trial period in a specific
application.
2010 Oreans Technologies. All rights reserved
1.6.3.1 WLGenLicenseFileKey
WLGenLicenseFileKey
The WLGenLicenseFileKey function generates a license key that will work in a specific application. The
generated license key should be copied directly into a file, making it the license file to register a specific
application.
This function is also implemented in UNICODE as WLGenLicenseFileKeyW (See definition below)
WinLicense 137
2010 Oreans Technologies
int WLGenLicenseFileKey(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
int WLGenLicenseFileKeyW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
function WLGenLicenseFileKey(
pLicenseHash:PChar;
pUserName:PChar;
pOrganization:PChar;
pCustomData:PChar;
pMachineID:PChar;
NumDays:Integer;
NumExec:Integer;
pNewDate:Pointer;
CountryId:Integer;
Runtime:Integer;
GlobalTime:Integer;
pBufferOut:PChar
):Integer; stdcall;
function WLGenLicenseFileKeyW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
NumDays:Integer;
NumExec:Integer;
pNewDate:Pointer;
CountryId:Integer;
Runtime:Integer;
GlobalTime:Integer;
pBufferOut:PChar
):Integer; stdcall;
WinLicense Help File 138
2010 Oreans Technologies
Public Declare Function WLGenLicenseFileKey Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pNewDate As Any,
ByVal CountryId As Integer,
ByVal Runtime As Integer,
ByVal GlobalTime As Integer,
ByVal pBufferOut As String
) As Integer

class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseFileKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseFileKey(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
byte[] pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseFileKeyW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseFileKeyW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
byte[] pBufferOut);
}
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
WinLicense 139
2010 Oreans Technologies
for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
NumDays
[in] Number of days to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have days restrictions.
NumExec
[in] Number of executions to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have executions restrictions.
pNewDate
[in] Pointer to a SYSTEMTIME struct that holds the expiration date for the generated license key.
If this parameter is zero, the generated license key will not have date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}
CountryId
[in] Country ID value to restrict the generated license key to a specific country.
If this parameter is zero, the generated license key will work in every country.
Runtime
[in] Runtime restriction in minutes for the generated license key. The registered application will only run
Runtime minutes in every instance in memory.
WinLicense Help File 140
2010 Oreans Technologies
If this parameter is zero, the generated license key will not have runtime restriction.
GlobalTime
[in] Global time restriction in minutes for the generated license key. The registered application cannot
be executed more than GlobalTime minutes in general.
If this parameter is zero, the generated license key will not have global time restriction.
pBufferOut
[out] Pointer to a buffer that will hold the generated license key.
This buffer should be copied directly into a file, making it the license key that will activate a specific
application.
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
See Also
WLGenLicenseRegistryKey, WLGenLicenseTextKey, WLGenLicenseSmartKey,
WLGenLicenseFileKeyEx
2010 Oreans Technologies. All rights reserved
1.6.3.2 WLGenLicenseFileKeyEx
WLGenLicenseFileKeyEx
The WLGenLicenseFileKeyEx function generates a license key in the same manner as WLGenLicenseFileKey.
WinLicense 2.0 introduces this new function to cope with new license restrictions (not present in
WLGenLicenseFileKey) and allow extending the license restrictions in future versions of WinLicense without
breaking the function definition for WLGenLicenseFileKeyEx.
The WLGenLicenseInfoFileKeyEx requires as parameter a structure (sLicenseFeatures) which contains all the
license restrictions.
WinLicense 141
2010 Oreans Technologies
int WLGenLicenseFileKeyEx(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
sLi censeFeat ur es* pLicenseFeatures,
char* pBufferOut
);
int WLGenLicenseFileKeyExW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
sLi censeFeat ur es* pLicenseFeatures,
char* pBufferOut
);
function WLGenLicenseFileKeyEx(
pLicenseHash:PAnsiChar;
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pMachineID:PAnsiChar;
var pLicenseFeatures: sLicenseFeatures;
pBufferOut:PAnsiChar
):Integer; stdcall;
function WLGenLicenseFileKeyExW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
var pLicenseFeatures: sLi censeFeat ur es;
pBufferOut:PChar
):Integer; stdcall;
Public Declare Function WLGenLicenseFileKeyEx Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
pLicenseFeatures As Any,
ByVal pBufferOut As String
) As Integer
WinLicense Help File 142
2010 Oreans Technologies
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseFileKeyEx",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseFileKeyEx(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
byte[] pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseFileKeyExW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseFileKeyExW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
byte[] pBufferOut);
}
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
pLicenseFeatures
[in] Pointer to a sLicenseFeatures structure which contains the license restrictions.
WinLicense 143
2010 Oreans Technologies
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
See Also
WLGenLicenseFileKey, WLGenLicenseRegistryKey, WLGenLicenseTextKey, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
1.6.3.3 WLGenLicenseRegistryKey
WLGenLicenseRegistryKey
The WLGenLicenseRegistryKey function generates a license key that will work in a specific application. The
generated license key should be directly copied into a .reg file. When a user clicks on the .reg file, the license
information will be inserted in a custom registry key to register an specific application.
int WLGenLicenseRegistryKey(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pKeyName,
char* pKeyValueName,
char* pBufferOut
);
int WLGenLicenseRegistryKeyW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
wchar_t* pKeyName,
wchar_t* pKeyValueName,
char* pBufferOut
);

WinLicense Help File 144
2010 Oreans Technologies
function WLGenLicenseRegistryKey(
pLicenseHash:PAnsiChar;
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pMachineID:PAnsiChar;
NumDays:Integer;
NumExec:Integer;
var pNewDate:SYSTEMTIME;
CountryId:Integer;
Runtime:Integer;
GlobalTime:Integer;
pKeyName:PAnsiChar;
pKeyValueName:PAnsiChar;
pBufferOut:PAnsiChar
):Integer; stdcall;
function WLGenLicenseRegistryKeyW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
NumDays:Integer;
NumExec:Integer;
pNewDate:Pointer;
CountryId:Integer;
Runtime:Integer;
GlobalTime:Integer;
pKeyName:PWideChar;
pKeyValueName:PWideChar;
pBufferOut:PChar
):Integer; stdcall;
Public Declare Function WLGenLicenseRegistryKey Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pNewDate As Any,
ByVal CountryId As Integer,
ByVal Runtime As Integer,
ByVal GlobalTime As Integer,
ByVal pKeyName As String,
ByVal pKeyValueName As String,
ByVal pBufferOut As String
) As Integer
WinLicense 145
2010 Oreans Technologies
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseRegistryKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseRegistryKey(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
string pKeyName,
string pKeyValueName,
byte[] pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseRegistryKeyW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseRegistryKeyW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
string pKeyName,
string pKeyValueName,
byte[] pBufferOut);
}
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
generate.
If this parameter is zero, the generated key will not have organization name information.
WinLicense Help File 146
2010 Oreans Technologies
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
NumDays
[in] Number of days to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have days restrictions.
NumExec
[in] Number of executions to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have executions restrictions.
pNewDate
[in] Pointer to a SYSTEMTIME struct that holds the expiration date for the generated license key.
If this parameter is zero, the generated license key will not have date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}
CountryId
[in] Country ID value to restrict the generated license key to a specific country.
If this parameter is zero, the generated license key will work in every country.
Runtime
[in] Runtime restriction in minutes for the generated license key. The registered application will only run
Runtime minutes in every instance in memory.
If this parameter is zero, the generated license key will not have a runtime restriction.
GlobalTime
[in] Global time restriction in minutes for the generated license key. The registered application cannot
be executed more than GlobalTime minutes in general.
If this parameter is zero, the generated license key will not have a global time restriction.
pKeyName
[in] Pointer to a string that holds the registry key name where the license key is stored.
pKeyValueName
[in] Pointer to a string that holds the registry key value name where the license key is stored.
WinLicense 147
2010 Oreans Technologies
pBufferOut
[out] Pointer to a buffer that will hold the generated license key.
This buffer should be copied directly into a .reg file, making it the license key that will activate when a
user clicks on this .reg file.
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
See Also
WLGenLicenseFileKey, WLGenLicenseTextKey, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
1.6.3.4 WLGenLicenseRegistryKeyEx
WLGenLicenseRegistryKeyEx
The WLGenLicenseRegistryKeyEx function generates a license key that will work in a specific application.
The generated license key should be directly copied into a .reg file. When a user clicks on the .reg file, the
license information will be inserted in a custom registry key to register an specific application.
int WLGenLicenseRegistryKeyEx(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
sLicenseFeatures* pLicenseFeatures,
char* pKeyName,
char* pKeyValueName,
char* pBufferOut
);
int WLGenLicenseRegistryKeyExW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
sLicenseFeatures* pLicenseFeatures,
wchar_t* pKeyName,
wchar_t* pKeyValueName,
wchar_t* pBufferOut
);

WinLicense Help File 148
2010 Oreans Technologies
function WLGenLicenseRegistryKeyEx(
pLicenseHash:PAnsiChar;
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pMachineID:PAnsiChar;
var pLicenseFeatures: sLicenseFeatures;
pKeyName:PAnsiChar;
pKeyValueName:PAnsiChar;
pBufferOut:PAnsiChar
):Integer; stdcall;
function WLGenLicenseRegistryKeyExW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
var pLicenseFeatures: sLicenseFeatures;
pKeyName:PWideChar;
pKeyValueName:PWideChar;
pBufferOut:PWideChar
):Integer; stdcall;
Public Declare Function WLGenLicenseRegistryKeyEx Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
pLicenseFeatures As Any,
ByVal pKeyName As String,
ByVal pKeyValueName As String,
ByVal pBufferOut As String
) As Integer
WinLicense 149
2010 Oreans Technologies
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseRegistryKeyEx",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseRegistryKeyEx(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
string pKeyName,
string pKeyValueName,
byte[] pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseRegistryKeyExW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseRegistryKeyExW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
string pKeyName,
string pKeyValueName,
byte[] pBufferOut);
}
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
WinLicense Help File 150
2010 Oreans Technologies
pLicenseFeatures
[in] Pointer to a sLicenseFeatures structure which contains the license restrictions.
pKeyName
[in] Pointer to a string that holds the registry key name where the license key is stored.
pKeyValueName
[in] Pointer to a string that holds the registry key value name where the license key is stored.
pBufferOut
[out] Pointer to a buffer that will hold the generated license key.
This buffer should be copied directly into a .reg file, making it the license key that will activate when a
user clicks on this .reg file.
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
See Also
WLGenLicenseRegistryKey, WLGenLicenseFileKey, WLGenLicenseTextKey, WLGenLicenseSmartKey
2010 Oreans Technologies. All rights reserved
1.6.3.5 WLGenLicenseTextKey
WLGenLicenseTextKey
The WLGenLicenseTextKey function generates a license key that will work in a specific application. The
generated text key should be passed as a parameter to the function WLRegInstallTextKeyToFile or
WLRegInstallTextKeyToRegistry to register a specific application.
WinLicense 151
2010 Oreans Technologies
int WLGenLicenseTextKey(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
int WLGenLicenseTextKeyW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
wchar_t* pBufferOut
);

function WLGenLicenseTextKey(
pLicenseHash:PAnsiChar;
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pMachineID:PAnsiChar;
NumDays:Integer;
NumExec:Integer;
var pNewDate:SYSTEMTIME;
CountryId:Integer;
Runtime:Integer;
GlobalTime:Integer;
pBufferOut:PAnsiChar
):Integer; stdcall;
function WLGenLicenseTextKeyW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
NumDays:Integer;
NumExec:Integer;
var pNewDate:SYSTEMTIME;
CountryId:Integer;
Runtime:Integer;
GlobalTime:Integer;
pBufferOut:PWideChar
):Integer; stdcall;
WinLicense Help File 152
2010 Oreans Technologies
Public Declare Function WLGenLicenseTextKey Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pNewDate As Any,
ByVal CountryId As Integer,
ByVal Runtime As Integer,
ByVal GlobalTime As Integer,
ByVal pBufferOut As String
) As Integer

class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseTextKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseTextKey(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
StringBuilder pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseTextKeyW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseTextKeyW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
StringBuilder pBufferOut);
}
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
for an application.
WinLicense 153
2010 Oreans Technologies
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
NumDays
[in] Number of days to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have a days restrictions.
NumExec
[in] Number of executions to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have an executions restrictions.
pNewDate
[in] Pointer to a SYSTEMTIME struct that holds the expiration date for the generated license key.
If this parameter is zero, the generated license key will not have a date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}
CountryId
[in] Country ID value to restrict the generated license key to a specific country.
If this parameter is zero, the generated license key will work in every country.
Runtime
[in] Runtime restriction in minutes for the generated license key. The registered application will only run
Runtime minutes in every instance in memory.
If this parameter is zero, the generated license key will not have a runtime restriction.
WinLicense Help File 154
2010 Oreans Technologies
GlobalTime
[in] Global time restriction in minutes for the generated license key. The registered application cannot
be executed more than GlobalTime minutes in general.
If this parameter is zero, the generated license key will not have a global time restriction.
pBufferOut
[out] Pointer to a buffer that will hold the generated license key.
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
See Also
WLRegNormalKeyInstallToFile, WLRegNormalKeyInstallToRegistry, WLRegNormalKeyCheck,
WLGenLicenseRegistryKey, WLGenLicenseSmartKey, WLGenLicenseFileKey
2010 Oreans Technologies. All rights reserved
1.6.3.6 WLGenLicenseTextKeyEx
WLGenLicenseTextKeyEx
The WLGenLicenseTextKeyEx function generates a license key that will work in a specific application. The
generated text key should be passed as a parameter to the function WLRegInstallTextKeyToFile or
WLRegInstallTextKeyToRegistry to register a specific application.
int WLGenLicenseTextKeyEx(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
sLicenseFeatures* pLicenseFeatures,
char* pBufferOut
);
int WLGenLicenseTextKeyExW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
sLicenseFeatures* pLicenseFeatures,
wchar_t* pBufferOut
);
WinLicense 155
2010 Oreans Technologies

function WLGenLicenseTextKeyEx(
pLicenseHash:PAnsiChar;
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pMachineID:PAnsiChar;
var pLicenseFeatures: sLicenseFeatures;
pBufferOut:PAnsiChar
):Integer; stdcall;
function WLGenLicenseTextKeyExW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
var pLicenseFeatures: sLicenseFeatures;
pBufferOut:PWideChar
):Integer; stdcall;
Public Declare Function WLGenLicenseTextKeyEx Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
pLicenseFeatures As Any,
ByVal pBufferOut As String
) As Integer
Public Declare Function WLGenLicenseTextKeyExW Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
pLicenseFeatures As Any,
ByVal pBufferOut As String
) As Integer
WinLicense Help File 156
2010 Oreans Technologies
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseTextKeyEx",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseTextKeyEx(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
StringBuilder pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseTextKeyExW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseTextKeyExW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
StringBuilder pBufferOut);
}
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
pLicenseFeatures
[in] Pointer to a sLicenseFeatures structure which contains the license restrictions.
pBufferOut
WinLicense 157
2010 Oreans Technologies
[out] Pointer to a buffer that will hold the generated license key.
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
See Also
WLGenLicenseTextKey, WLRegNormalKeyInstallToFile, WLRegNormalKeyInstallToRegistry,
WLRegNormalKeyCheck, WLGenLicenseRegistryKey, WLGenLicenseSmartKey,
WLGenLicenseFileKey
2010 Oreans Technologies. All rights reserved
1.6.3.7 WLGenLicenseDynSmartKey
WLGenLicenseDynSmartKey
The WLGenLicenseDynSmartKey function generates a license key that will work in a specific application.
The generated license key should be copied directly into a file, making it the license file to register a specific
application.
This function is also implemented in UNICODE as WLGenLicenseDynSmartKeyW (See definition below)
int WLGenLicenseDynSmartKey(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
sLi censeFeat ur es* pLicenseFeatures,
char* pBufferOut
);
int WLGenLicenseDynSmartKeyW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
sLi censeFeat ur es* pLicenseFeatures,
wchar_t* pBufferOut
);
WinLicense Help File 158
2010 Oreans Technologies
function WLGenLicenseDynSmartKey(
pLicenseHash:PAnsiChar;
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pMachineID:PAnsiChar;
var pLicenseFeatures: sLicenseFeatures;
pBufferOut:PAnsiChar
):Integer; stdcall;
function WLGenLicenseDynSmartKeyW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
var pLicenseFeatures: sLicenseFeatures;
pBufferOut:PWideChar
):Integer; stdcall;
Public Declare Function WLGenLicenseDynSmartKey Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
pLicenseFeatures As Any,
ByVal pBufferOut As String
) As Integer

class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseDynSmartKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseDynSmartKey(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
StringBuilder pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseDynSmartKeyW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseDynSmartKeyW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
sLicenseFeatures pLicenseFeatures,
StringBuilder pBufferOut);
}
WinLicense 159
2010 Oreans Technologies
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
pLicenseFeatures
[in] Pointer to a sLicenseFeatures structure which contains the license restrictions.
pBufferOut
[out] Pointer to a buffer that will hold the generated license key.
This buffer should be copied directly into a file, making it the license key that will activate a specific
application.
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
See Also
WLGenLicenseSmartKey, WLRegSmartKeyInstallToFile, WLRegSmartKeyInstallToRegistry,
WLRegSmartKeyCheck, WLGenLicenseRegistryKey, WLGenLicenseFileKey
2010 Oreans Technologies. All rights reserved
1.6.3.8 WLGenLicenseSmartKey
WLGenLicenseSmartKey
The WLGenLicenseSmartKey function generates a license key that will work in a specific application. The
generated SmartActivate key should be passed as a parameter to the function
WinLicense Help File 160
2010 Oreans Technologies
WLRegInstallSmartKeyToFile or WLRegInstallSmartKeyToRegistry to register a specific application.
int WLGenLicenseSmartKey(
char* pLicenseHash,
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
char* pBufferOut
);
int WLGenLicenseSmartKeyW(
wchar_t* pLicenseHash,
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
wchar_t* pBufferOut
);

function WLGenLicenseSmartKey(
pLicenseHash:PAnsiChar;
pUserName:PAnsiChar;
pOrganization:PAnsiChar;
pCustomData:PAnsiChar;
pMachineID:PAnsiChar;
NumDays:Integer;
NumExec:Integer;
var pNewDate:SYSTEMTIME;
pBufferOut:PAnsiChar
):Integer; stdcall;
function WLGenLicenseSmartKeyW(
pLicenseHash:PWideChar;
pUserName:PWideChar;
pOrganization:PWideChar;
pCustomData:PWideChar;
pMachineID:PWideChar;
NumDays:Integer;
NumExec:Integer;
var pNewDate:SYSTEMTIME;
pBufferOut:PWideChar
):Integer; stdcall;
WinLicense 161
2010 Oreans Technologies
Public Declare Function WLGenLicenseSmartKey Lib "WinLicenseSDK.dll" (
ByVal pLicenseHash As String,
ByVal pUserName As String,
ByVal pOrganization As String,
ByVal pCustomData As String,
ByVal pMachineID As String,
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pNewDate As Any,
ByVal pBufferOut As String
) As Integer

class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="WLGenLicenseSmartKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenLicenseSmartKey(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
StringBuilder pBufferOut);
}
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", CharSet = CharSet.Unicode,
EntryPoint="WLGenLicenseSmartKeyW", CallingConvention =
CallingConvention.StdCall )]
public static extern int WLGenLicenseSmartKeyW(
string pLicenseHash,
string pUserName,
string pOrganization,
string pCustomData,
string pMachineID,
int NumDays,
int NumExec,
Syst emTi me pNewDate,
StringBuilder pBufferOut);
}
Parameters
pLicenseHash
[in] Pointer to a null-terminated string that specifies the unique License hash to generate specific keys
for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the registration name for the license key to
generate.
If this parameter is zero, the generated key will not have registration name information.
pOrganization
[in] Pointer to a null-terminated string that specifies the organization name for the license key to
WinLicense Help File 162
2010 Oreans Technologies
generate.
If this parameter is zero, the generated key will not have organization name information.
pCustomData
[in] Pointer to a null-terminated string that specifies the custom data for the license key to generate.
If this parameter is zero, the generated key will not have custom data information.
pMachineID
[in] Pointer to a null-terminated string that specifies the machine ID to lock the license key to a specific
computer.
If this parameter is zero, the generated key will work in every computer (no machine locking).
NumDays
[in] Number of days to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have a days restrictions.
NumExec
[in] Number of executions to restrict the use of the generated license key.
If this parameter is zero, the generated license key will not have an executions restrictions.
pNewDate
[in] Pointer to a SYSTEMTIME struct that holds the expiration date for the generated license key.
If this parameter is zero, the generated license key will not have a date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}
pBufferOut
[out] Pointer to a buffer that will hold the generated license key.
Return Values
If the function succeeds, the return value is the number of bytes in the generated license key.
If the function fails, the return value is 0.
Remarks
This function is also implemented as UNICODE: WLGenLicenseSmartKeyW
See Also
WLRegSmartKeyInstallToFile, WLRegSmartKeyInstallToRegistry, WLRegSmartKeyCheck,
WLGenLicenseRegistryKey, WLGenLicenseFileKey
WinLicense 163
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.3.9 WLGenPassword
WLGenPassword
The WLGenPassword function generates a specific password for a given user name.
int WLGenPassword(
char* pPassHash,
char* pUserName,
char* pBufferOut
);

function WLGenPassword(
pPassHash:PAnsiChar;
pUserName:PAnsiChar;
pBufferOut:PAnsiChar
):Integer; stdcall;
Public Declare Function WLGenPassword Lib "WinLicenseSDK.dll"(
ByVal pPassHash As String,
ByVal pUserName As String,
ByVal pBufferOut As String
) As Integer

class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="GenerateLicenseFileKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenPassword(
string pPassHash,
string pUserName,
byte[] pBufferOut);
}
Parameters
pPassHash
[in] Pointer to a null-terminated string that specifies the unique Password hash to generate specific
passwords for an application.
pUserName
[in] Pointer to a null-terminated string that specifies the user name for whom the password is
generated.
pBufferOut
[out] Pointer to a buffer that will hold the generated password for the specified user.
Return Values
If the function succeeds, the return value is the number of bytes in the generated password.
If the function fails, the return value is 0.
WinLicense Help File 164
2010 Oreans Technologies
See Also
WLValidatePassword
2010 Oreans Technologies. All rights reserved
1.6.3.10 WLGenTrialExtensionFileKey
WLGenTrialExtensionFileKey
The WLGenTrialExtensionFileKey function generates a trial extension key to extend the current trial period
in a specific application. The generated trial extension key should be copied directly into a file, making it the
trial extension file to extend the trial period in a specific application.
int WLGenTrialExtensionFileKey(
char* pTrialHash,
int Level,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int GlobalTime,
int Runtime,
char* pBufferOut
);

function WLGenTrialExtensionFileKey(
pTrialHash:PAnsiChar;
Level:Integer;
NumDays:Integer;
NumExec:Integer;
var pNewDate:SYSTEMTIME;
GlobalTime:Integer;
Runtime:Integer;
pBufferOut:PAnsiChar
):Integer; stdcall;
Public Declare Function WLGenTrialExtensionFileKey Lib "WinLicenseSDK.dll"(
ByVal pTrialHash As String,
ByVal Level As Integer,
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pNewDate As Any,
ByVal GlobalTime As Integer,
ByVal Runtime As Integer,
ByVal pBufferOut As String
) As Integer
WinLicense 165
2010 Oreans Technologies

class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="GenerateLicenseFileKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenTrialExtensionFileKey(
string pTrialHash,
int Level,
int NumDays,
int NumExec,
ref Syst emTi me pNewDate,
int GlobalMinutes,
int Runtime,
byte[] pBufferOut);
}
Parameters
pTrialHash
[in] Pointer to a null-terminated string that specifies the unique Trial hash to generate specific trial
extension keys for an application.
Level
[in] Trial extension key level.
The trial is extended by levels to allow developers a full control of the extended keys that they generate.
When a user asks for an extension key, the first level should be zero. If the same user asks again for an
extension key, only extension keys with levels greater than zero will work. In general, to allow a trial
period extension, only extended keys with a Level greater than a previous one will work. This will avoid
being cheated by users re-asking for a trial extension key.
NumDays
[in] Number of days to extend the trial period.
NumExec
[in] Number of executions to extend the trial period.
pNewDate
[in] Pointer to a SYSTEMTIME struct that holds the new trial expiration date.
If this parameter is zero, the generated license key will not have a date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}
GlobalTime
[in] Number of minutes to extend the Global time trial.
Runtime
WinLicense Help File 166
2010 Oreans Technologies
[in] Number of runtime minutes to extend the trial.
pBufferOut
[out] Pointer to a buffer that will hold the generated trial extension key.
This buffer should be copied directly into a file, making it the extension key that will extend the trial in a
specific application.
Return Values
If the function succeeds, the return value is the number of bytes in the generated trial extension key.
If the function fails, the return value is 0.
Remarks
Only the trial restriction fields that were included in the protection time can be extended. For example, if an
application has a trial restriction of 21 days, ONLY the number of expiration days can be extended. Any
attempt to extend any other trial restriction not included in the protection time will be ignored.
See Also
WLTrialGetExtensionStatus
2010 Oreans Technologies. All rights reserved
1.6.3.11 WLGenTrialExtensionRegistryKey
WLGenTrialExtensionRegistryKey
The WLGenTrialExtensionRegistryKey function generates a trial extension key to extend the current trial
period in a specific application. The generated extension key should be directly copied into a .reg file. When a
user clicks on the .reg file, the trial extension information will be inserted in a custom registry key to register
an specific application.
int WLGenTrialExtensionRegistryKey(
char* pTrialHash,
int Level,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int GlobalMinutes,
int Runtime,
char* pKeyName,
char* pKeyValueName,
char* pBufferOut
);
WinLicense 167
2010 Oreans Technologies

function WLGenTrialExtensionRegistryKey(
pTrialHash:PAnsiChar;
Level:Integer;
NumDays:Integer;
NumExec:Integer;
var pNewDate:SYSTEMTIME;
GlobalMinutes:Integer;
Runtime:Integer;
pKeyName: PAnsiChar;
pKeyValueName: PAnsiChar;
pBufferOut:PAnsiChar
):Integer; stdcall;
Public Declare Function WLGenTrialExtensionRegistryKey Lib "WinLicenseSDK.dll"(
ByVal pTrialHash As String,
ByVal Level As Integer,
ByVal NumDays As Integer,
ByVal NumExec As Integer,
pNewDate As Any,
ByVal GlobalMinutes As Integer,
ByVal Runtime As Integer,
ByVal pKeyName As String,
ByVal pKeyValueName As String,
ByVal pBufferOut As String
) As Integer

class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="GenerateLicenseFileKey",
CallingConvention = CallingConvention.StdCall )]
public static extern int WLGenTrialExtensionRegistryKey(
string pTrialHash,
int Level,
int NumDays,
int NumExec,
ref Syst emTi me pNewDate,
int GlobalMinutes,
int Runtime,
string pKeyName,
string pKeyValueName,
byte[] pBufferOut);
}
Parameters
pTrialHash
[in] Pointer to a null-terminated string that specifies the unique Trial hash to generate specific trial
extension keys for an application.
Level
[in] Trial extension key level.
The trial is extended by levels to allow developers a full control of the extended keys that they generate.
When a user asks for an extension key, the first level should be zero. If the same user asks again for an
extension key, only extension keys with levels greater than zero will work. In general, to allow a trial
period extension, only extended keys with a Level greater than a previous one will work. This will avoid
being cheated by users re-asking for a trial extension key.
WinLicense Help File 168
2010 Oreans Technologies
NumDays
[in] Number of days to extend the trial period.
NumExec
[in] Number of executions to extend the trial period.
pNewDate
[in] Pointer to a SYSTEMTIME struct that holds the new trial expiration date.
If this parameter is zero, the generated license key will not have date expiration restrictions.
The SYSTEMTIME struct is not supported by C#. You have to define it as follows:
[StructLayout(LayoutKind.Sequential)]
public class SystemTime
{
public short wYear;
public short wMonth;
public short wDayOfWeek;
public short wDay;
public short wHour;
public short wMinute;
public short wSecond;
public short wMilliseconds;
}
GlobalTime
[in] Number of minutes to extend the Global time trial.
Runtime
[in] Number of runtime minutes to extend the trial.
pKeyName
[in] Pointer to a string that holds the registry key name where the trial extension key is stored.
pKeyValueName
[in] Pointer to a string that holds the registry key value name where the trial extension key is stored.
pBufferOut
[out] Pointer to a buffer that will hold the generated trial extension key.
This buffer should be copied directly into a .reg file, making it the extension key that will extend the trial
when a user clicks on this .reg file.
Return Values
If the function succeeds, the return value is the number of bytes in the generated trial extension key.
If the function fails, the return value is 0.
Remarks
Only the trial restriction fields that were included in the protection time can be extended. For example, if an
application has a trial restriction of 21 days, ONLY the number of expiration days can be extended. Any
attempt to extend any other trial restriction not included in the protection time will be ignored.
See Also
WLTrialGetExtensionStatus
WinLicense 169
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.3.12 Custom WinLicense SDK
Custom WinLicense SDK
The Custom WinLicense SDK is a DLL that is created when your application is protected (when the option
"Export Specific Generators" in Advanced Options panel is checked). That DLL contains the license generator
functions (exactly as in WinLicenseSDK.dll) but the LicenseUniqueId parameter is omitted. Some users prefer
using the Custom WinLicense SDK DLL to avoid passing the LicenseUniqueId to each license generator
function.
The function prototypes in the Custom WinLicense SDK are:
int WLCustomGenLicenseFileKey(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
int WLCustomGenLicenseFileKeyW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
WinLicense Help File 170
2010 Oreans Technologies
int WLCustomGenLicenseFileKeyEx(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
sLi censeFeat ur es* pLicenseFeatures,
char* pBufferOut
);
int WLCustomGenLicenseFileKeyExW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
sLi censeFeat ur es* pLicenseFeatures,
char* pBufferOut
);
int WLCustomGenLicenseRegistryKey(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pKeyName,
char* pKeyValueName,
char* pBufferOut
);
int WLCustomGenLicenseRegistryKeyW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pKeyName,
wchar_t* pKeyValueName,
char* pBufferOut
);
WinLicense 171
2010 Oreans Technologies
int WLCustomGenLicenseRegistryKeyEx(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
sLicenseFeatures* pLicenseFeatures,
char* pKeyName,
char* pKeyValueName,
char* pBufferOut
);
int WLCustomGenLicenseRegistryKeyExW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
sLicenseFeatures* pLicenseFeatures,
wchar_t* pKeyName,
wchar_t* pKeyValueName,
char* pBufferOut
);
int WLCustomGenLicenseTextKey(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
int WLCustomGenLicenseTextKeyW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
WinLicense Help File 172
2010 Oreans Technologies
int WLCustomGenLicenseTextKeyEx(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
sLicenseFeatures* pLicenseFeatures,
char* pBufferOut
);
int WLCustomGenLicenseTextKeyExW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
sLicenseFeatures* pLicenseFeatures,
char* pBufferOut
);
int WLCustomGenLicenseDynSmartKey(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
char* pBufferOut
);
int WLCustomGenLicenseDynSmartKeyW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int CountryId,
int Runtime,
int GlobalTime,
wchar_t* pBufferOut
);
WinLicense 173
2010 Oreans Technologies
int WLCustomGenLicenseSmartKey(
char* pUserName,
char* pOrganization,
char* pCustomData,
char* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
char* pBufferOut
);
int WLCustomGenLicenseSmartKeyW(
wchar_t* pUserName,
wchar_t* pOrganization,
wchar_t* pCustomData,
wchar_t* pMachineID,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
wchar_t* pBufferOut
);
int WLCustomGenPassword(
char* pUserName,
char* pBufferOut
);
int WLCustomGenTrialExtensionFileKey(
int Level,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int GlobalTime,
int Runtime,
char* pBufferOut
);
int WLCustomGenTrialExtensionRegistryKey(
int Level,
int NumDays,
int NumExec,
SYSTEMTIME* pNewDate,
int GlobalMinutes,
int Runtime,
char* pKeyName,
char* pKeyValueName,
char* pBufferOut
);
WinLicense Help File 174
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.3.13 sLicenseFeatures Definition
sLicenseFeatures Definition
This structure is used in the new license generator functions (with the "Ex" postfix) to give more flexibility to
WinLicense to extend the restriction features in upcoming versions of WinLicense. Notice that all fields in the
structure are defined as 32-bit length (except the SYSTEMTIME fields) to simplify the migration of this
structure to non common compilers.
IMPORTANT: Before calling a license generator function which uses the sLicenseFeatures structure, you must
initialize the whole structure to ZERO and assign the sLicenseFeatures.cb field to the size of the structure itself.
If you don't initialize the structure to ZERO, it might contain spurious data from memory which could assign
non wanted restrictions to your licenses.
typedef struct _sLicenseFeatures
{
unsigned cb;
unsigned NumDays;
unsigned NumExec;
SYSTEMTIME ExpDate;
unsigned CountryId;
unsigned Runtime;
unsigned GlobalMinutes;
SYSTEMTIME InstallDate;
unsigned NetInstances;
unsigned EmbedLicenseInfoInKey;
unsigned EmbedCreationDate;
} sLicenseFeatures;
type
sLicenseFeatures = record
cb: LongWord;
NumDays: LongWord;
NumExec: LongWord;
ExpDate: SYSTEMTIME;
CountryId: LongWord;
Runtime: LongWord;
GlobalMinutes: LongWord;
InstallDate: SYSTEMTIME;
NetInstances: LongWord;
EmbedLicenseInfoInKey: LongWord;
EmbedCreationDate: LongWord
end;
WinLicense 175
2010 Oreans Technologies
Type sLicenseFeatures
cb As Integer;
NumDays As Integer;
NumExec As Integer;
ExpDate As SYSTEMTIME;
CountryId As Integer;
Runtime As Integer;
GlobalMinutes As Integer;
InstallDate As SYSTEMTIME;
NetInstances As Integer;
EmbedLicenseInfoInKey As Integer;
EmbedCreationDate As Integer;
End Type;
Structure sLicenseFeatures
Public cb As Integer
Public NumDays As Integer
Public NumExec As Integer
Public ExpDate As SYSTEMTIME
Public CountryId As Integer
Public Runtime As Integer
Public GlobalMinutes As Integer
Public InstallDate As SYSTEMTIME
Public NetInstances As Integer
Public EmbedLicenseInfoInKey As Integer
Public EmbedCreationDate As Integer
End Structure;
public class sLicenseFeatures
{
public unsigned cb;
public unsigned NumDays;
public unsigned NumExec;
public SYSTEMTIME ExpDate;
public unsigned CountryId;
public unsigned Runtime;
public unsigned GlobalMinutes;
public SYSTEMTIME InstallDate;
public unsigned NetInstances;
public unsigned EmbedLicenseInfoInKey;
public unsigned EmbedCreationDate;
}
Fields definition
cb
Contains the size in bytes of this structutre. This field MUST always contain the size of the
sLicenseFeatures structure to help WinLicense determine the number of features available when there
are different version of the sLicenseFeatures structure.
NumDays
Number of days to restrict the use of the generated license key.
If this field is zero, the generated license key will not have days expiration.
NumExec
WinLicense Help File 176
2010 Oreans Technologies
Number of executions to restrict the use of the generated license key.
If this field is zero, the generated license key will not have executions restrictions.
ExpDate
SYSTEMTIME struct that holds the expiration date for the generated license key.
If this struct is all zero, the generated license key will not have date expiration restrictions.
CountryId
Country ID value to restrict the generated license key to a specific country.
If this field is zero, the generated license key will work in every country.
Runtime
Runtime restriction in minutes for the generated license key. The registered application will only run
Runtime minutes in every instance in memory.
If this field is zero, the generated license key will not have a runtime restriction.
GlobalMinutes
Global time restriction in minutes for the generated license key. The registered application cannot be
executed more than GlobalTime minutes in general.
If this field is zero, the generated license key will not have a global time restriction.
InstallDate
Expiration date to install the license. The user must install the license before the specified InstallDate. If
a user tries to install a license after InstallDate the license will be rejected.
If this struct is all zero, the generated license key will not have install date restrictions.
NetInstances
Maximun number of instances running inside a network.
If this field is zero, the license will not have restriction inside a network.
EmbedLicenseInfoInKey
This field is only used by DynamicSmartActivate keys. When this field is set to 1, the generated
SmartActivate key will contain the user information embedded inside the SmartActivate serial number.
If this field is 0, the user information will not be embedded inside the SmartActivate serial number.
EmbedCreationDate
This field specifies if the license creation date will be embedded inside the license. The creation date of
the license can be obtained in runtime via the function WLRegLicenseCreationDate.
If this field is 1, the creation date will be inserted inside the generated license.
If this field is 0, the creation date is not inserted inside the license. In that case,
WLRegLicenseCreationDate will return false.
2010 Oreans Technologies. All rights reserved
1.6.4 Miscellaneous Functions
Miscellaneous Functions
The following set of functions can be used to set/get miscellaneous information from WinLicense.
WinLicense 177
2010 Oreans Technologies
Function Description
WLBufferCrypt Encrypts a buffer with a given password.
WLBufferDecrypt Decrypts a buffer with a given password.
WLGetCurrentCountry Gets the current country ID.
WLGetVersion Gets the WinLicense version that the application
was protected with.
WLGetProtectionDate Gets the date when the application was
protected.
WLHardwareCheckID Validates a given hardware ID.
WLHardwareGetFormattedID Retrieves a formatted hardware ID for the
current machine.
WLHardwareGetID Retrieves the current hardware ID for the
current machine.
WLHardwareGetIdType Retrieves the type of Hardware ID obtained
with the function WLHardwareGetID
WLHardwareRuntimeCheckU3 Checks if the U3 USB device which was locking
a license has been unplugged
WLLoadWinlicenseDll (.NET only) Used in DEBUG mode for .NET applications to
load the Winlicense SDK values from the
WinlicenseSDK.ini file.
WLPasswordCheck Validates a given user name and password.
WLProtectCheckCodeIntegrity Checks if the code section of your protected
application has been patched in runtime.
WLProtectCheckDebugger Detects the presence of a debugger in memory.
WLRestartApplication Closes the current application and restarts it
again.
WLRestartApplicationArgs Closes the current application and restarts it
again with arguments.
WLSplashHide Hides the custom splash.
WLStringDecrypt Decrypts a string that was previously encrypted
in protection time.
2010 Oreans Technologies. All rights reserved
1.6.4.1 WLBufferCrypt
WLBufferCrypt
WinLicense Help File 178
2010 Oreans Technologies
The WLBufferCrypt function encrypts a buffer with a given password.
void WLBufferCrypt(
void* pBuffer,
int BufferLength,
char* pPassword
);

procedure WLBufferCrypt(
pBuffer:Pointer;
BufferLength:Integer;
pPassword:PAnsiChar
); stdcall;
Parameters
pBuffer
[in] Pointer to a buffer to encrypt.
BufferLength
[in] Size of buffer to encrypt.
pPassword
[in] Pointer to a null terminated string with the encryption password.
Return Values
This function has no return values.
Remarks
This function has not effect in unprotected state.
See Also
WLBufferDecrypt
2010 Oreans Technologies. All rights reserved
1.6.4.2 WLBufferDecrypt
WLBufferDecrypt
The WLBufferDecrypt function decrypts a buffer with a given password.
void WLBufferDecrypt(
void* pBuffer,
int BufferLength,
char* pPassword
);
WinLicense 179
2010 Oreans Technologies

procedure WLBufferDecrypt(
pBuffer:Pointer;
BufferLength:Integer;
pPassword:PAnsiChar
); stdcall;
Parameters
pBuffer
[in] Pointer to a buffer to decrypt.
BufferLength
[in] Size of buffer to decrypt.
pPassword
[in] Pointer to a null terminated string with the decryption password.
Return Values
This function has no return values.
Remarks
This function has not effect in unprotected state.
See Also
WLBufferCrypt
2010 Oreans Technologies. All rights reserved
1.6.4.3 WLGetCurrentCountry
WLGetCurrentCountry
The WLGetCurrentCountry function returns the current country ID.
int WLGetCurrentCountry (void);

function WLGetCurrentCountry ():Integer; stdcall;
Public Declare Function WLGetCurrentCountry Lib "WinLicenseSDK.dll" () As Integer
WinLicense Help File 180
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLGetCurrentCountry", [out] CountryId, 100);
[Visual Basic]
GetEnvironmentVariable("WLGetCurrentCountry", [out] CountryId, 100)
Parameters
This function has no parameters.
Return Values
The return value is the current country ID. The following list shows all recognized countries and their IDs:
WinLicense 181
2010 Oreans Technologies
Country ID Country ID
Albania 355 Liechtenstein 41
Algeria 213 Lithuania 370
Argentina 54 Luxembourg 352
Armenia 374 Macau S.A.R., PRC 853
Australia 61 Former Yugoslav
Republic of Macedonia
389
Austria 43 Malaysia 60
Azerbaijan 994 Maldives 960
Bahrain 973 Mexico 52
Belarus 375 Principality of Monaco 33
Belgium 32 Mongolia 976
Belize 501 Morocco 212
Bolivia 591 Netherlands 31
Brazil 55 New Zealand 64
Brunei Darussalam 673 Nicaragua 505
Bulgaria 359 Norway 47
Canada 2 Oman 968
Caribbean 1 Islamic Republic of
Pakistan
92
Chile 56 Panama 507
Colombia 57 Paraguay 595
Costa Rica 506 Peru 51
Croatia 385 Republic of the
Philippines
63
Czech Republic 420 Poland 48
Denmark 45 Portugal 351
Dominican Republic 1 People's Republic of
China
86
Ecuador 593 Puerto Rico 1
Egypt 20 Qatar 974
El Salvador 503 Romania 40
Estonia 372 Russia 7
Faeroe Islands 298 Saudi Arabia 966
Finland 358 Serbia 381
France 33 Singapore 65
Georgia 995 Slovak Republic 421
Germany 49 Slovenia 386
Greece 30 South Africa 27
Guatemala 502 Korea 82
Honduras 504 Spain 34
Hong Kong S.A.R., P.R.C. 852 Sweden 46
Hungary 36 Switzerland 41
WinLicense Help File 182
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.4.4 WLGetVersion
WLGetVersion
The WLGetVersion function gets the WinLicense version that the application was protected with.
void WLGetVersion(
char* pBuffer);

function WLGetVersion(
pBuffer:PAnsiChar
); stdcall;
[C#]
Kernel32.GetEnvironmentVariable("WLGetVersion", [out] pBuffer, 100);
[Visual Basic]
GetEnvironmentVariable("WLGetVersion", [out] pBuffer, 100)
Parameters
pBuffer
[out] Pointer to a buffer that receives the version number.
Return Values
This function has no return value.
2010 Oreans Technologies. All rights reserved
1.6.4.5 WLGetProtectionDate
WLGetProtectionDate
The WLGetProtectionDate function gets the date when the application was protected.
void WLGetProtectionDate(
SYSTEMTIME* pProtectionDate);

function WLGetProtectionDate(
var pProtectionDate:SYSTEMTIME
); stdcall;
WinLicense 183
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLGetProtectionDate", [out] pProtectionDate, 100);
[Visual Basic]
GetEnvironmentVariable("WLGetProtectionDate", [out] pProtectionDate, 100)
Parameters
pProtectionDate
[out] Pointer to a SYSTEMTIME structure that receives the protection date.
Return Values
This function has no return value.
2010 Oreans Technologies. All rights reserved
1.6.4.6 WLHardwareCheckID
WLHardwareCheckID
The WLHardwareCheckID validates a given hardware ID. This function is designed to know when a user
reports a fake or real hardware ID. This will avoid being cheated by users that reports the wrong typing in
their hardware ID.
bool WLHardwareCheckID (
char* pHardwareId);

function WLHardwareCheckID (
pHardwareId:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLHardwareCheckID Lib "WinLicenseSDK.dll" (
ByVal pHardwareId As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLHardwareCheckID", [in/out] HardwareId, 100);
[Visual Basic]
GetEnvironmentVariable("WLHardwareCheckID", [in/out] HardwareId, 100)
Parameters
pHardwareId
[in] Pointer to a null-terminated string that specifies the hardware ID to validate.
WinLicense Help File 184
2010 Oreans Technologies
Return Values
If the hardware ID is valid, the return value is True.
If the hardware ID is invalid, the return value is False.
See Also
WLHardwareGetID, WLHardwareGetFormattedID
2010 Oreans Technologies. All rights reserved
1.6.4.7 WLHardwareGetFormattedID
WLHardwareGetFormattedID
The WLHardwareGetFormattedID retrieves a formatted hardware ID for the current machine. This function
should be used instead of WLHardwareGetID when a developer needs a specially formatted hardware ID in
his application.
bool WLHardwareGetFormattedID (
int NumCharsToghether,
int Uppercase,
char* pHardwareId);

function WLHardwareGetFormattedID (
NumCharsTogether:Integer;
Uppercase:Integer;
pHardwareId:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLHardwareGetFormattedID Lib "WinLicenseSDK.dll" (
ByVal NumCharsToghether As Integer,
ByVal Uppercase As Integer,
ByVal pHardwareId As String
) As Boolean
WinLicense 185
2010 Oreans Technologies
[C#]
Kernel32.GetEnvironmentVariable("WLHardwareGetFormattedID", [in/out]
HardwareIdFormatted, 100);
[Visual Basic]
GetEnvironmentVariable("WLHardwareGetFormattedID", [in/out] HardwareIdFormatted,
100)
Parameters
NumCharsTogether
[in] This parameter specifies the number of characters between dashes ('-').
Uppercase
[in] This parameter specifies if the hardware ID must be given in uppercase.
pHardwareId
[out] Pointer to a buffer that will receive a null-terminated string with the formatted hardware ID for the
current machine.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
See Also
WLHardwareCheckID, WLHardwareGetID
2010 Oreans Technologies. All rights reserved
1.6.4.8 WLHardwareGetID
WLHardwareGetID
The WLHardwareGetID retrieves the current hardware ID for the current machine. This function should be
used to retrieve the hardware ID in a machine to create license keys that are locked to a specific machine.
bool WLHardwareGetID (
char* pHardwareId);

function WLHardwareGetID (
pHardwareId:PAnsiChar
):Boolean; stdcall;
WinLicense Help File 186
2010 Oreans Technologies
Public Declare Function WLHardwareGetID Lib "WinLicenseSDK.dll" (
ByVal pHardwareId As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLHardwareGetID", [out] HardwareID, 100);
[Visual Basic]
GetEnvironmentVariable("WLHardwareGetID", [out] HardwareID, 100)
Parameters
pHardwareId
[out] Pointer to a buffer that will receive a null-terminated string with the hardware ID for the current
machine.
Return Values
If the function succeeds, the return value is True.
If the function fails, the return value is False.
Remarks
The format of the hardware ID in the current implementation of WinLicense is as follows:
XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX (where 'X' can be [0-9, A-F])
See Also
WLHardwareCheckID, WLHardwareGetFormattedID
2010 Oreans Technologies. All rights reserved
1.6.4.9 WLHardwareGetIdType
The WLHardwareGetIdType function retrieves the type of Hardware ID obtained with the function
WLHardwareGetID. By default WinLicense always returns the PC Hardware except when the user selects
External Hardware in the HardwareLock panel or the user creates his own Hardware ID via
WinLicenseDLLControl.
int WLHardwareGetIdType (void);

function WLHardwareGetIdType ():Integer; stdcall;
WinLicense 187
2010 Oreans Technologies
Public Declare Function WLHardwareGetIdType Lib "WinLicenseSDK.dll" () As Integer
[C#]
Kernel32.GetEnvironmentVariable("WLHardwareGetIdType", [out] HardwareIdType, 100);
[Visual Basic]
GetEnvironmentVariable("WLGetCurrentCountry", [out] HardwareIdType, 100)
Parameters
This function has no parameters.
Return Values
The current returns values are:
wlHardwareTypePC for PC Hardware ID
wlHardwareTypeU3 for U3 USB Hardware ID
wlHardwareTypeCustom for Custome Hardware ID (via WinLicenseDLLControl)
2010 Oreans Technologies. All rights reserved
1.6.4.10 WLHardwareRuntimeCheckU3
WLHardwareRuntimeCheckU3
The WLHardwareRuntimeCheckU3 checks if the U3 USB device which was locking a license has been
unplugged. Notice that when a U3 USB is unplugged, WinLicense can take up to one minute to fully report the
disconnection. You should call this function periodically from a thread in case that you want to monitor if the
U3 USB device which locked a license has been unplugged.
NOTE: You must enable the option "Periodically check U3 device" (in HardwareLock panel) in case that you
want to call the function WLHardwareRuntimeCheckU3.
bool WLHardwareRuntimeCheckU3 (void);

function WLHardwareRuntimeCheckU3 ():Boolean; stdcall;
Public Declare Function WLHardwareRuntimeCheckU3 Lib "WinLicenseSDK.dll" () As
Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLHardwareRuntimeCheckU3", [out] BufferOut, 100);
[Visual Basic]
GetEnvironmentVariable("WLHardwareRuntimeCheckU3", [out] BufferOut, 100)
WinLicense Help File 188
2010 Oreans Technologies
Parameters
This function has no parameters.
Return Values
If the U3 device which was locking a license has been unplugged, the return value is False.
If the U3 device is plugged (or it was never plugged), the return value is True.
Remarks
You must enable the option "Periodically check U3 device" (in HardwareLock panel) in case that you want
to call the function WLHardwareRuntimeCheckU3.
2010 Oreans Technologies. All rights reserved
1.6.4.11 WLLoadWinlicenseDll
WLLoadWinlicenseDll (.NET users only)
The WLLoadWinlicenseDll is used in DEBUG mode for .NET applications to load the Winlicense SDK values
from the WinlicenseSDK.ini file. This function is intended for debugging purposes in an unprotected state and
must be removed when the application is going to be protected by WinLicense.
class WinlicenseSDK
{
[DllImport( "WinlicenseSDK.dll", EntryPoint="LoadWinlicenseDll",
CallingConvention = CallingConvention.StdCall )]
public static extern void LoadWinlicenseDll();
}
Parameters
This function has no parameters.
Return Values
The function has no return values.
Restrictions
The WLLoadWinlicenseDll is used in DEBUG mode for .NET applications to load the Winlicense SDK values
from the WinlicenseSDK.ini file. This function is intended for debugging purposes in an unprotected state and
must be removed when the application is going to be protected by WinLicense.
WinLicense 189
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.4.12 WLPasswordCheck
WLPasswordCheck
The WLPasswordCheck validates a given user name and password. This function should be called by
applications that handle their own password dialogs, not making use of the embedded WinLicense password
dialog.
bool WLPasswordCheck(
char* pUserName,
char* pPassword
);

function WLPasswordCheck(
pUserName:PAnsiChar;
pPassword:PAnsiChar
):Boolean; stdcall;
Public Declare Function WLPasswordCheck Lib "WinLicenseSDK.dll" (
ByVal pUserName As String,
ByVal pPassword As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLPasswordCheck", [in/out] PasswordInfo, 200);
[Visual Basic]
GetEnvironmentVariable("WLPasswordCheck", [in/out] PasswordInfo, 200)
Parameters
pUserName
[in] Pointer to a null-terminated string that specifies the user name from the password to validate.
pPassword
[in] Pointer to a null-terminated string that specifies the password to validate.
Return Values
If the password is valid, the return value is True.
If the password is invalid, the return value is False.
See Also
WLGenPassword
WinLicense Help File 190
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.6.4.13 WLProtectCheckDebugger
WLProtecCheckDebugger
The WLProtectCheckDebugger checks for the presence of a debugger in memory.
bool WLProtectCheckDebugger();

function WLProtectCheckDebugger():Boolean;
Public Declare Function WLProtectCheckDebugger Lib "WinLicenseSDK.dll" () As
Boolean
Parameters
This function has no parameters.
Return Values
If a debugger is present, the return value is True.
If a debugger is not present, the return value is False.
Remarks
This function can be called with the option "Anti-Debugger Detection" (in Protection Options panel) enabled or
disabled.
2010 Oreans Technologies. All rights reserved
1.6.4.14 WLProtectCheckCodeIntegrity
WLProtectCheckCodeIntegrity
The WLProtectCheckCodeIntegrity checks if the code section of your protected application has been
patched in runtime. This function is equivalent to the CHECK_CODE_INTEGRITY macro.
bool WLProtectCheckCodeIntegrity();

function WLProtectCheckCodeIntegrity():Boolean;
WinLicense 191
2010 Oreans Technologies
Public Declare Function WLProtectCheckCodeIntegrity Lib "WinLicenseSDK.dll" () As
Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLProtectCheckCodeIntegrity", [out]
pCodeIntegrity, 100);
[Visual Basic]
GetEnvironmentVariable("WLProtectCheckCodeIntegrity", [out] pCodeIntegrity, 100)
Parameters
This function has no parameters.
Return Values
If the protected application code is patched, the return value is True.
If the protected application code is not patched, the return value is False.
2010 Oreans Technologies. All rights reserved
1.6.4.15 WLRestartApplication
WLRestartApplication
The WLRestartApplication function closes the current application and restarts it again. This function should
be called when a text key or SmartActivate key has been installed (using WLRegInstallSmartKeyToFile,
WLRegInstallSmartKeyToRegistry, WLRegInstallTextKeyToFile, WLRegInstallTextKeyToRegistry)
and the application needs to be restarted to finish the WinLicense registration process.
bool WLRestartApplication (void);

function WLRestartApplication ():Boolean; stdcall;
Public Declare Function WLRestartApplication Lib "WinLicenseSDK.dll" () As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRestartApplication", [out] RestartStatus, 100);
[Visual Basic]
GetEnvironmentVariable("WLRestartApplication", [out] RestartStatus, 100)
Parameters
WinLicense Help File 192
2010 Oreans Technologies
This function has no parameters.
Return Values
If the function succeeds, the application is restarted.
If the function fails, the return value is zero.
Remarks
This function has not effect in unprotected state for .NET applications.
2010 Oreans Technologies. All rights reserved
1.6.4.16 WLRestartApplicationArgs
WLRestartApplicationArgs
The WLRestartApplicationArgs function closes the current application and restarts it again with arguments.
This function should be called when a text key or SmartActivate key has been installed (using
WLRegInstallSmartKeyToFile, WLRegInstallSmartKeyToRegistry, WLRegInstallTextKeyToFile,
WLRegInstallTextKeyToRegistry) and the application needs to be restarted to finish the WinLicense
registration process.
bool WLRestartApplicationArgs (
char* pArgs);

function WLRestartApplicationArgs (
pArgs: PAnsiChar
):Boolean; stdcall;
Public Declare Function WLRestartApplicationArgs Lib "WinLicenseSDK.dll" (
ByVal pArgs As String
) As Boolean
[C#]
Kernel32.GetEnvironmentVariable("WLRestartApplicationArgs", [in][out] pArgs, 100);
[Visual Basic]
GetEnvironmentVariable("WLRestartApplicationArgs", [in][out] pArgs, 100)
Parameters
pArgs
[in] Pointer to a null-terminated string that specifies the parameters that are going to be passed to the
application when it is restarted.
WinLicense 193
2010 Oreans Technologies
Return Values
If the function succeeds, the application is restarted.
If the function fails, the return value is zero.
Remarks
This function has not effect in unprotected state for .NET applications.
2010 Oreans Technologies. All rights reserved
1.6.4.17 WLSplashHide
WLSplashHide
The WLSplashHide function hides the splash screen that was displayed by WinLicense. When WinLicense
detects that the function WLSplashHide is called from inside your application, WinLicense will not close the
splash screen according to the values selected in the AdvancedOptions panel (Splash Settings). The splash will
be closed as soon as the WLSplashHide is called from the protected application.
NOTE: This function is not currently supported in .NET applications.
void WLSplashHide ();

procedure WLSplashHide ();
Parameters
This function has no parameters.
Remarks
This function has not effect in unprotected state.
2010 Oreans Technologies. All rights reserved
WinLicense Help File 194
2010 Oreans Technologies
1.6.4.18 WLStringDecrypt
WLStringDecrypt
The WLStringDecrypt function decrypts a string that was previously encrypted in protection time. WinLicense
will search for all the calls to the WLStringDecrypt function in protection time, and encrypt the string that it's
passed as parameter to that function. You can see which strings where recognised and encrypted by
WinLicense by looking into the "WLlog.txt" file (generated in the same folder as the application to protect)
NOTE: This function is not available for .NET and Visual Basic applications.
char* WLStringDecrypt (
char* pString
);

function WLStringDecrypt (
pString:PAnsiChar
):PChar; stdcall;
Parameters
pString
[in] Pointer to a null-terminated string to encrypt.
Remarks
WinLicense will only recognise strings to encrypt when pString is passed as a direct string, like
WLStringDecrypt("MyString"). If you pass a variable inside WLStringDecrypt, WinLicense will not be
able to recognise the string to encrypt.
This function is also implemented as UNICODE: WLStringDecryptW
Return Values
The function returns a pointer to the decrypted string.
Remarks
This function has not effect in unprotected state.
2010 Oreans Technologies. All rights reserved
1.6.5 Testing in an unprotected state
Testing in an unprotected state
Winlicense offers a fast way to test the different APIs that an application calls before being protected, helping
developers to quickly debug their programs as if they were already protected by WinLicense.
WinLicense gives the opportunity to set up the return values of all the APIs to allow a full testing of an
application before protecting it. The core of this technique is a configuration file called "WinlicenseSDK.ini" that
WinLicense 195
2010 Oreans Technologies
holds information about the licensing/trial status set up by the developer. For an example of this configuration
file, see example WinlicenseSDK.ini.
The WinlicenseSDK.ini file must be in the same directory as the WinLicenseSDK.dll.
2010 Oreans Technologies. All rights reserved
1.7 WinLicense Managers
WinLicense Managers
WinLicense Managers are designed for easy and convenient management of all information about applications,
customers, licenses, passwords etc. The user interfaces of all Managers was made with the objective to be
readily understood, however detailed descriptions were added to avoid any trouble with understanding the
purpose/usage of any Manager.
All the information used in each manager are stored inside the Winlicense database (winlicense.abs file). For
backing up purposes, you just need to backup the file winlicense.abs
The WinLicense Managers are:
Projectmanager
Softwaremanager
CustomersManager
Licensemanager
Passwordmanager
TrialExtensionmanager
2010 Oreans Technologies. All rights reserved
WinLicense Help File 196
2010 Oreans Technologies
1.7.1 Project Manager
Project Manager
In this section we explain the different options that are offered by WinLicense to manage your current projects.
WinLicense projects store information about different protection settings that can be applied to your
applications.
Managing projects
To create a new project you can either press the New button or Project > New option from the menu in the
main WinLicense window. By default WinLicense loads an empty project that will be used to store different
protection options for a specific software/s.
To open an existing project you can either press the Open button or Project > Open from the main menu in
the main WinLicense window. A list of all current projects in database will be displayed. To open a specific
project use the Open button when a project is selected or double-click in the desired project.
To save a project you must specify its Description or name in order to be included in the projects database. It
is recommended to use a convenient names to help you finding projects at a later time.
To delete a project from the projects database, just select the project to remove and press the Delete key.
WinLicense 197
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.7.2 Software Manager
Software Manager
In this section we explain the different options that are offered by WinLicense to manage your software
applications.
Managing softwares
WinLicense Help File 198
2010 Oreans Technologies
The Add button allows you to enter information about new software application to be added into the database.
The following fields are available for information about a new software application:
Application: This field is used to store the name of the application to protect. This is any name that
the developer considers appropriate.
Version: This field is used to store information about the current version of your software application.
Input Filename: This filed is used to specify the path were your software is located on disk. You can
either type the path manually or select your application path from the standard Windows open dialog.
Output Filename: This filed is used to specify the path were your protected software application will
be located on disk. If no output file is specified, your original application will be overwritten with the
protected one.
Input File Type: This field is used to specify the type of application to protect. Note that this field is
only to help keep track of your softwares in the database. WinLicense has its own internal
mechanisms to detect the type of application that is going to be protected.
License Unique Key: This field specifies the hash key that will be used to generate specific licenses
for the current software. If two applications are protected with different registration hash keys,
generated license keys for the first application will be invalid for the second application. In the same
manner, if several applications are protected with the same registration hash key, generated licensed
for a single application will be valid for the rest of applications with that hash key.
Trial Unique Key: This field specifies the hash key that will be used to store the trial information for
the current software. If you protect an application "A" with a trial hash and at a later time you protect
a new version of the application "A", the trial period will be reseted if the trial hash for the new
version is different from the original one. In the same way, if you leave a fix trial hash for all the
upcoming versions of application "A", the trial period for application "A" will continue where it was,
that is, if it was expired the new version will also be expired.
Password Unique Key: This field specifies the hash key that will be used to generate specific
passwords for the current software. If you protect several applications with the same password hash,
the same password will unlock all those applications. In the same way, if you select different password
WinLicense 199
2010 Oreans Technologies
hashes for several applications, each password will only be valid for a specific application.
To edit a software application entry you have to press the Edit button in the software manager window. This
action will open the selected software in a new window to allow further modifications.
To delete software from the database, just press the Delete button in the software manager window.
2010 Oreans Technologies. All rights reserved
1.7.3 Customers Manager
Customers Manager
In this section we explain the different options that are offered by WinLicense to manage your current
customer information.
WinLicense Help File 200
2010 Oreans Technologies
Managing customers
The Add button allows you to enter information about a new customer to be added into the customers'
database. The following fields are offered to introduce information about a new customer:
Name: This is the name of the new customer. This field is required to be entered
Company: This field is used to store information about the new customer's company. This field
should be entered.
Extra Details: This field is used to store additional information about the new customer. This field is
not required and it is only used to keep extra information about a specific customer. Please, do not
confuse this field with the Custom Data when creating a license key.
To edit a customer entry you have to press the Edit button in the customer manager window. This action will
open the selected customer in a new window to allow further modifications.
To delete a customer, just press the Delete button in the customer manager window.
2010 Oreans Technologies. All rights reserved
1.7.4 License Manager
License Manager
WinLicense 201
2010 Oreans Technologies
In this section we explain the different options that are offered by WinLicense to manage your current licenses.
In the License Manager main window, there are 4 different panels:
Software Panel: This panel shows all the current software in the WinLicense database. Selecting a
software application in this panel will affect in the information displayed in the Customers Panel.
Customer Panel: This panel shows information about all customers for the selected Software.
License Details Panel: This panel shows information about the selected customer in the Customer
Panel.
License Generation Panel: This panel allows you to enter information about where the generated
keys will be stored when the user clicks on the Create License Key button.
Managing a license
WinLicense Help File 202
2010 Oreans Technologies
The Add License button allows you to enter information about a new license to be added into the licenses
database. The following fields are offered to introduce information about a new license:
Customer: Customer for whom the license will be created.
Software: Software application for which the license will be created.
Hardware ID: This field allows you to create machine locked licenses. If you select the
Acceptonlyhardwaredependent(locked)registrations option, this field must be always filled.
Custom Data: This field allows you to insert extra information for the key that is being generated.
This field can be very useful to allow/restrict extra features in your application for some customers.
The WLRegGetLicenseInfo function allows you to retrieve the value of this field among others.
Days Expiration: This option is used to create a restricted license by a specific number of days.
WinLicense 203
2010 Oreans Technologies
Date Expiration: This option is used to create a restricted license by a specific date.
Executions: This option is used to create a restricted license by a specific number of uses
Run Time (execution): This option is used to create a restricted license by the number of minutes
that the software application can stay in memory.
Global Time: This option is used to create a restricted license that cannot be run more than a
specified number of minutes.
Install Before Date: This option allows you to limit the installation of a license before a specific date.
If your customer install the license after the specific date, WinLicense will display the "MsgId41:
License installation time-limit exceeded" (in CustomizedDialog panel)
Network Instances: This option is used to limit the number of instances inside a network. Please,
read below for detailed information about Network Instances.
Store Creation Date: This option will store the date when the license was created inside the license.
You can retrieve the license creation date using the function WLRegLicenseCreationDate.
Embed user info in key: This option is only for DynamicSmartActivatekeys. If you select that
option, the SmartActivate serial number will contain the user information as part of the serial number.
When you call the SmartKey functions (WLRegSmartKeyCheck, WLRegSmartKeyInstallToFile,
WLRegSmartKeyInstallToRegistry), you have to pass NULL for the user information parameters.
Example: WLRegSmartKeyCheck(NULL, NULL, NULL, pSmartKey)
Country Locking: This option is used to create a restricted license that can only be used in a specific
country.
The Edit License button allows the editing of the currently selected license. This action will open the selected
license in a new window to allow further modifications.
The Delete License button deletes the currently selected license from the licenses database.
The Mark as Stolen button will mark the licenses as stolen. After re-protecting the current software, these
license keys will be banned and no one will be able to use those stolen keys to register your new protected
application.
The Unmark Stolen button will switch a key from stolen to valid. We have to remind you that if an application
was protected with this key as stolen, you have to protect it again in order to allow authorization of this key.
Generating a new license
The License Generation panel specifies which keys and where those keys will be stored when the Create
License Key button is pressed. The directory where the generated keys can be stored can use some
predefined variables that will be changed by their corresponding values before generating the license on disk:
Variable Name Description
WinLicense Help File 204
2010 Oreans Technologies
%WinLicenseDir% Directory where WinLicense is installed.
%SoftwareName% Name of the current software application for
which the license will be created.
%SoftwareVersion% Version of the current software application for
which the license will be created.
%CustomerName% Name of the customer for whom the license will
be created.
%CustomerCompany% Company of the customer for whom the license
will be created.
Network Instances
You can limit the number of instances inside a network for a registered application. You just need to enter the
number of maximun instances in a network when creating your license key.
When a protected application runs with a license with Network Instances restrictions, the protected application
will survey the local network (which takes about 2 seconds) in order to get the number of running instances in
other computers on the network. If there are already as many instances running on the network as it appears
in the license, the application will refuse to start (displaying the MsgID38 : Network Instances: No more
Allowed in CustomizedDialog panel)
Network Instances + Hardware Locking
If you insert network instances limitation inside a license and you also lock the license to a specific Hardware
ID, the computer with that Hardware ID will become the Server. The Server must run (and leave in memory)
the protected application in order to allow Client computers to communicate with the protected application in
the Server and allow the execution in client machines.
If the Server is not running the protected application and a client launch the application, the MsgID39:
Network Instances: Server not running (in CustomizedDialog panel) will be displayed by WinLicense.
Firewall issues
When a protected application with network instances restrictions runs, the current installed firewall will prompt
the user if it allows access to the network to the protected application. If the users tells the firewall to block all
access to the network, the protected application will display the MsgID38 : Network Instances: No more
Allowed (in CustomizedDialog panel)
To successfully run protected applications with network instances restrictions on a network, the installed
firewall must allow network access to the application.
Network Instances in Static SmartKeys
The current format of the SmartKeys does not support Network Instances specifically (it's supported in
Dynamic SmartKeys). But there is a workaround to limit a Static SmartKey to a specific number of instances
inside a network.
If you put a network instances limit in a SmartKey, WinLicense will explicitly put a special string in the
beginning of the Custom Data field to identify the network instances limit in the SmartKey.
If you want to create SmartKeys with network instances limit from outside the WinLicense License Manager,
you have to enter the network instances limit as follow: *NL*%4x, that is, "*NL*" + four bytes number in
hexadecimal format, which specifies the number of instances in a network. If for example, you want to
generate a license with the "MODE:Test" string in the custom data and you also want to limit the SmartKey
with 12 instances in a network, you have to pass the following string in the Custom Data parameter to the
WLGenLicenseSmartKey API as follow:
*NL*000CMODE:Test
Where "*NL*000C" means 12 instances (000C hexadecimal = 12 decimal)
Note: When you call the API WLRegGetLicenseInfo, WinLicense will return the Custom Data information from
WinLicense 205
2010 Oreans Technologies
the license but without the "*NL*%4x" information.
Ban Hardware IDs
You can restrict your application from running REGISTERED on specific machines. This option is suitable if one
of your clients have migrated to a new machine and you want to block the execution of your application in his
old machine. Anyway, we recommed banning the old license instead of banning his computer ID.
You can add as many Hardware IDs are necessary. When you press the Done button, WinLicense will create a
file called "InvalidateHWid.txt" with the list of entered Hardware IDs to invalidate (You can manually modify
the InvalidateHWid.txt file).
When you protect your application, WinLicense will embed all the Hardware IDs from the InvalidateHWid.txt file
into the protected application. After that, your protected application will refuse to run in registered mode when
the current computer has a banned Hardware ID (displaying the MSGID32:Stolenlicensekey)
2010 Oreans Technologies. All rights reserved
WinLicense Help File 206
2010 Oreans Technologies
1.7.5 Password Manager
Password Manager
The Password Manager has been designed to manage information about all passwords assigned to your
customers.
Managing passwords
WinLicense 207
2010 Oreans Technologies
The Add button allows you to enter information to create a new user/password for your application. The
following fields are provided for information about the generated password:
Customer: Name of the customer for whom the password will be generated
Software: Software application for which the paired customer-password will be accepted.
Details: This field allows the insertion of additional information about the new password. This field is
not required and it is only used to keep extra information about a specific password.
The Edit button allows the editing of the currently selected password. This action will open the selected
password information in a new window to allow further modifications.
The Delete License button deletes the currently selected password from the passwords database.
Generating a new password
In the Password Generation panel you can specify the directory where generated passwords will be saved
after pressing the Generate Password button. The directory where the generated keys can be stored can use
some predefined variables that will be changed by their corresponding values before generating the license on
disk:
Variable Name Description
WinLicense Help File 208
2010 Oreans Technologies
%WinLicenseDir% Directory where WinLicense is installed.
%SoftwareName% Name of the current software application for
which the license will be created.
%SoftwareVersion% Version of the current software application for
which the license will be created.
%CustomerName% Name of the customer for whom the license will
be created.
2010 Oreans Technologies. All rights reserved
1.7.6 Trial Extension Manager
Trial Extension Manager
The Trial Extension Manager has been designed to manage information about trial extension keys for your
WinLicense 209
2010 Oreans Technologies
applications.
Managing extension keys
The Add button allows you to enter information about a new trial extension key to be added into the trial
extensions database. The following fields can be set up to enter specific trial extension information:
Software: Specifies the software application for which the generated trial extension key will be valid.
Level: Level for the trial extension key to generate. Refer to the section below to understand the use
of this field.
Days Expiration: This option is used to extend the current trial period by a specific number of days.
Date Expiration: This option is used to extend the current trial period by a specific date.
Executions: This option is used to extend the current trial period by a specific number of uses.
Run Time (execution): This option is used to extend the current trial period by number of minutes
that the software can stay in memory.
Global Time: This option is used to to extend the current trial period by a specified number of
minutes.
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 trial extension 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.
The Edit button allows the editing of the currently selected extension key. This action will open the selected
extension key in a new window to allow further modifications.
The Delete button deletes the currently selected extension key from the extension keys database.
WinLicense Help File 210
2010 Oreans Technologies
Use of the Level field in trial extension keys
The level field is used as security measurement to avoid giving more trial extensions keys that you planned for
your application. Suppose the following example:
"John protects his application allowing some trial extension on it. John has a customer called Smith who asks
John for his first trial extension key. John creates the trial extension key with level 1 because its in fact the first
extension created for Smith. In the future, Smith asks Jhon for a trial extension key but this time Smith tries to
cheat John an claim he never received an extension key (It's easy to forget this because John has hundreds of
customers) and asks for the first key again. John will create a trial extension key with Level 1 again for Smith,
but this time Smith will see that keys with Level 1 are already expired in John's application, forcing Smith to go
back to John again and tell John that what he needed was a trial extension key with Level 2 in order to
continue extending the trial."
Summing up, the level field allows you to keep control how many times a customer has extended the trial
period in your application and avoids mal-intentioned users from cheating you with trial extension keys.
The "Delete" button will delete the selected entry. WinLicense always asks confirmation for the entry deletion.
Generating a new trial extension key
In the Trial Extension Generation panel you can specify the directory where generated extension keys will
be saved after pressing the Generate Extension button. The directory where the generated extension keys
will be stored uses predefined variables that will be changed by their corresponding values before generating
the extension key on disk:
Variable Name Description
%WinLicenseDir% Directory where WinLicense is installed.
%SoftwareName% Name of the current software application for
which the license will be created.
%SoftwareVersion% Version of the current software application for
which the license will be created.
%Level% Level for the extension key to generate
2010 Oreans Technologies. All rights reserved
WinLicense 211
2010 Oreans Technologies
1.8 WinLicense DLL Control
WinLicense DLL Control
WinLicense DLL Control is a special plugin which enables full control of the protected application through a
custom DLL. WinLicense will send specific messages to the custom DLL, offering full control of the protected
application in runtime.
The DLL will be embedded inside the protected application and never written to disk, avoiding the possibility
of spying the DLL activity.
The following sections explain the main features of WinLicense DLL Control and how to use it inside your
applications:
WinLicenseDLLControlFeatures
WinLicenseDLLControlinruntime
InsertingWinLicenseDLLControlinsideyourapplication
WinLicenseDLLControlSDK
2010 Oreans Technologies. All rights reserved
1.8.1 WinLicense DLL Control Features
WinLicense DLL Control Features
With WinLicense DLL Control you can implement most of your ideas, like:
Execute specific tasks when the protected application is going to be launched
Execute specific tasks when WinLicense is going to pass control to the protected application
Change the hardware ID, to allow you inserting your own hardware ID from a dongle, flash memory,
etc.
Display complex dialogs before the protected application is executed
Receive information about the trial and licensing status of the protected application
Register an application before it runs
Display user information from a valid license key
WinLicense Help File 212
2010 Oreans Technologies
Create your own trial / licensing schemes
2010 Oreans Technologies. All rights reserved
1.8.2 WinLicense DLL Control in runtime
WinLicense DLL Control in runtime
In this section we are going to explain all the steps to use DLL Control in your protected applications.
Creating a DLL to be used in WinLicense DLL Control
You can create your DLL Control using any programming language; you just have to export to your DLL the
functions that you want to handle when the protected application is running.
Functions to export in your DLL Control
When your protected application is launched, WinLicense will call several functions in your DLL at different
loading stages of the protected application. The available functions are:
WDC_Initialize: WinLicense will call this function in your DLL when the protected application is going
to be loaded in memory. In this stage, you can do any type of initialization that you consider for the
protected application or you can handle your own trial/registration schemes at this stage.
WDC_ProcessHardwareID: WinLicense will call this function in your DLL when the hardware ID for
the current machine has been acquired. WinLicense will pass the current hardware ID to your DLL and
you are able to modify or re-create a new hardware ID from other devices, like for example, create a
new hardware ID from a dongle device that is attached to your application. If you create your own
hardware IDs from your DLL, you have to make sure of inserting the same hardware ID when
creating the license key for your customer, hence you need your own GetHardwareId application that
returns the same Hardware ID as your DLL Control. You can read more details here.
WDC_FirstRunTrial: WinLicense will call this function the first time that an application runs in trial
mode in the system. WinLicense will pass the current hardware ID and current trial information to
your DLL. This function might be useful to control when your application is launched in a system for
the first time and take any desired initialization action.
WDC_FirstRunLicense: WinLicense will call this function the first time that any license is registered
in the system. WinLicense will pass the current hardware ID and current registration information to
your DLL. This function might be useful to control when your application is registered and take any
desired action like for example, register the license in a web activation server.
WDC_GetLicenseInfo: WinLicense will call this function when a valid license key is present and the
application is fully registered. WinLicense will send the license information (Name, Company, Custom
Data) to your DLL. If the application is not properly licensed or not licensed at all, this function will
never be called by WinLicense.
WDC_GetApplicationStatus: WinLicense will call this function to report the current trial/licensing
status of the protected application. In this function you will receive detailed information about the trial
status of your application (days left, executions left, ...) and licensing related information (days left in
keys, hardware ID invalid, license key corrupted...)
WDC_DoRegistration: WinLicense will call this function in case that you want to offer the option of
registering the protected application before it gets executed. WinLicense will pass specific functions
WinLicense 213
2010 Oreans Technologies
pointers to your DLL in order to allow you using functions like WLRestartApplication,
WLRegNormalKeyCheck, WLRegNormalKeyInstallToFile, WLRegSmartKeyCheck, ...
WDC_Finalize: WinLicense will call this function when the protected application has been totally
loaded and decompressed into memory and it is ready to start its execution. You can do any desired
processing at this stage.
Processing to be done inside each DLL Control function
To offer total freedom, WinLicense does not require any specific processing in each DLL Control function. You
are free to process the function that you want and do whatever you require in each function. For example: you
can show a dialog when any function is called; you can skip the function by just returning from it or by not
selecting them in the WinLicense User Interface; you can just store the necessary values that WinLicense
passes to your DLL in each function for later processing, etc.
Order in which the DLL Control functions are called
WinLicense will call the DLL Control functions in the following order: WDC_Initialize, WDC_ProcessHardwareID,
WDC_FirstRunTrial, WDC_FirstRunLicense, WDC_GetLicenseInfo, WDC_GetApplicationStatus,
WDC_DoRegistration, WDC_Finalize.
Note that the function WDC_GetLicenseInfo is only called when the application is licensed as specified; If the
application is running in trial mode or not properly licensed, the function is not called. Functions like
WDC_FirstRunTrial and WDC_FirstRunLicense are only called when a trial or licensed application is running for
the first time. The rest of the functions are always called in any case.
2010 Oreans Technologies. All rights reserved
1.8.3 Inserting WinLicense DLL Control inside your application
Inserting WinLicense DLL Control inside your application
WinLicense Help File 214
2010 Oreans Technologies
The WinLicense DLL Control panel allows you to select which DLL file will be embedded inside the protected
application and receive the notification events from WinLicense.
In the Function Handlers panel you can select the name of the function from your DLL which will be called by
WinLicense. Note that each selected function should have the same parameter definitions as its equivalent in
the WinLicenseDLLControlSDK.
In case that you don't want to handle a specific function, you should leave it blank (leave it as "Click and select
here") and WinLicense will skip that function from being called.
2010 Oreans Technologies. All rights reserved
1.8.4 WinLicense DLL Control SDK
WinLicense DLL Control SDK
The WinLicense DLL Control SDK is composed by the following functions.
WinLicense 215
2010 Oreans Technologies
Function Description
WDC_Initialize Called when the protected application is going
to be loaded in memory
WDC_ProcessHardwareID Called to display, change or re-create the
current hardware ID
WDC_FirstRunTrial Called the first time that an application runs in
trial mode
WDC_FirstRunLicense Called the first time that any license is
registered in the system
WDC_GetLicenseInfo Called when license information is available
through a valid license key
WDC_GetApplicationStatus Called to report the current status of the
application (trial mode, expired trial, licensed...)
WDC_DoRegistration Called to allow registration of the protected
application before it starts
WDC_Finalize Called when the protected application is
decompressed and ready to start execution
Note that all functions must be defined as "cdecl", that is, functions parameters are not removed from stack
when the function exits.
2010 Oreans Technologies. All rights reserved
1.8.4.1 WDC_Initialize
WDC_Initialize
The WDC_Initialize function is called by WinLicense when the protected application is going to be launched
by the user...that is, when the application is still compressed and encrypted in memory.
In this function, you can process your own trial/licensing schemes in case you don't use the WinLicense
trial/licensing features and/or implement any other initialization routine that you need for your DLL.
bool _cdecl WDC_Initialize(void);

function WDC_Initialize():Boolean; cdecl;
Parameters
This function has no parameters.
Return Values
If the function returns True, WinLicense will continue running the protected application.
If the function returns False, WinLicense will terminate the protected application immediately.
WinLicense Help File 216
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.8.4.2 WDC_ProcessHardwareID
WDC_ProcessHardwareID
The WDC_ProcessHardwareID function is called by WinLicense when the internal Hardware ID has been
acquired. WinLicense will pass the obtained Hardware ID to the function WDC_ProcessHardwareID. In this
function you can store or change the hardware ID for your own one and WinLicense will continue executing the
protected application with the new hardware ID that you have returned.
If you plan to change the hardware ID for your own one, you have two choices:
Create your own hardware ID combining it with the one that WinLicense obtains
Create your own hardware ID without mixing it with the one that WinLicense obtains
NOTE: If you change your own hardware ID from WDC_ProcessHardwareID, you have to create the license
keys for your clients using the same hardware ID that you return from WDC_ProcessHardwareID.
bool _cdecl WDC_ProcessHardwareID(
char* pHardwareID);

function WDC_ProcessHardwareID(
pHardwareID:PChar):Boolean; cdecl;
Parameters
pHardwareID
[IN/OUT] This parameter specifies the hardware ID obtained by WinLicense. If you modify the hardware
ID, you have to change the buffer pointed by pHardwareID.
Return Values
If the function returns True, WinLicense will change the hardware ID by the one obtained from the
pHardwareID buffer.
If the function returns False, WinLicense will not change the hardware ID.
Remarks
The format of your hardware ID must be a set of ASCII chars that represent hexadecimal numbers (the chars
[0-9] and [A-F].
You can use any set of hyphens ('-') in your hardware ID. They are internally changed to the following format:
xxxx - xxxx - xxxx - xxxx - xxxx - xxxx - xxxx - xxxx. That means that you are free to represent the
hardware ID as you want. For example the hardware ID 111-1111-1-2222-3-3333-333-4444-555-566-66 will
be internally changed to 1111-1111-2222-3333-3333-4444-5555-6666.
If you change the hardware ID for your own one, the features in the hardwarelock panel will be disabled and
no hardware changes will be allowed.
WinLicense 217
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.8.4.3 WDC_FirstRunTrial
WDC_FirstRunTrial
The WDC_FirstRunTrial function is called by WinLicense the first time that an application runs in trial mode in
the system. Notice that if the trial is extended using a trial extension key, this function will not be called again.
bool _cdecl WDC_FirstRunTrial(
char* pHardwareID,
TTrialExpInfo* TrialExpInfo);

function WDC_FirstRunTrial(
pHardwareID:PChar;
TrialExpInfo:TTrialExpInfo):Boolean; cdecl;
Parameters
pHardwareId
This parameter specifies the hardware ID of the current machine.
TrialExpInfo
This parameter specifies a pointer to a TTrialExpInfo structure with information about the current trial
expiration (days, executions, date...)
Return Values
If the function returns True, WinLicense will continue running the protected application.
If the function returns False, WinLicense will terminate the protected application immediately. If the application
is launched again, the WDC_FirsRunTrial function will be called again until it returns True.
2010 Oreans Technologies. All rights reserved
1.8.4.4 WDC_FirstRunLicense
WDC_FirstRunLicense
The WDC_FirstRunLicense function is called by WinLicense when any license is installed in the system.
Notice that if a second license is installed in the system (replacing the current one) this function will be called
again.
bool _cdecl WDC_FirstRunLicense(
char* pHardwareID,
char* pRegName,
char* pCompany,
char* pCustomData
TRegExpInfo* RegExpInfo);
WinLicense Help File 218
2010 Oreans Technologies

function WDC_FirstRunLicense(
pHardwareID:PChar;
pRegName:PChar;
pCompany:PChar;
pCustomData:PChar
RegExpInfo:TRegExpInfo):Boolean; cdecl;
Parameters
pHardwareId
This parameter specifies the hardware ID of the current machine.
pRegName
This parameter specifies the registration name for the current license key.
pCompany
This parameter specifies the registration company for the current license key.
pCustomData
This parameter specifies the custom data for the current license key.
RegExpInfo
This parameter specifies a pointer to a TRegExpInfo structure with information about the current license
key expiration (days, executions, date...)
Return Values
If the function returns True, WinLicense will continue running the protected application.
If the function returns False, WinLicense will terminate the protected application immediately. If the application
is launched again, the WDC_FirsRunLicense function will be called again until it returns True.
2010 Oreans Technologies. All rights reserved
1.8.4.5 WDC_GetLicenseInfo
WDC_GetLicenseInfo
The WDC_GetLicenseInfo function is called by WinLicense when the protected application is properly
licensed. WinLicense will pass the registration information to this function, such as Registration Name,
Company and Custom Data.
WinLicense 219
2010 Oreans Technologies
void _cdecl WDC_GetLicenseInfo(
char* pRegName,
char* pCompany,
char* pCustomData);
UNICODE Support Enabled:
void _cdecl WDC_GetLicenseInfo(
wchar_t* pRegName,
wchar_t* pCompany,
wchar_t* pCustomData);

procedure WDC_GetLicenseInfo(
pRegName:PChar;
pCompany:PChar;
pCustomData:PChar); cdecl;
UNICODE Support Enabled:
procedure WDC_GetLicenseInfo(
pRegName:PWideChar;
pCompany:PWideChar;
pCustomData:PWideChar); cdecl;
Parameters
pRegName
This parameter specifies the registration name for the current license key.
pCompany
This parameter specifies the registration company for the current license key.
pCustomData
This parameter specifies the custom data for the current license key.
Return Values
This function has no return values.
2010 Oreans Technologies. All rights reserved
1.8.4.6 WDC_GetApplicationStatus
WDC_GetApplicationStatus
The WDC_GetApplicationStatus function is called by WinLicense to report the current application status. The
main status of an application is either Trial and Registered. You can also get extended status information
like: Trial Expired, Trial Manipulated, Invalid Hardware ID, Corrupted License Key, etc. through this function.
WinLicense Help File 220
2010 Oreans Technologies
void _cdecl WDC_GetApplicationStatus(
int ApplicationStatus,
int ExtendedStatus,
TTrialExpInfo* TrialExpInfo,
TRegExpInfo* RegExpInfo);

procedure WDC_GetApplicationStatus(
ApplicationStatus:Integer;
ExtendedStatus:Integer;
TrialExpInfo:TTrialExpInfo;
RegExpInfo:TRegExpInfo); cdecl;
Parameters
ApplicationStatus
This parameter specifies the status of the current application. The possible status are Trial and
Registered.
ExtendedStatus
This parameter contains extended information about the current status of an application. The current
extended status values are:
wdcNoError: The application runs in either Trial or Registered mode with no errors or expirations in
trial or registration
wdcInvalidLicense: The current installed license is invalid or corrupted
wdcInvalidHardwareLicense: The license is locked to another machine
wdcNoMoreHwdChanges: No more hardware IDs changes are allowed
wdcLicenseExpired: The current license key is expired. See RegExpInfo for more information about
expirations
wdcInvalidCountryLicense: The current license key is locked to a different country
wdcLicenseStolen: The current license key has been marked as stolen
wdcWrongLicenseExp: The current license key is a permanent key and only licenses that expire are
allowed in the protected application
wdcWrongLicenseHardware: The current license key does not have machine ID information (and
machine ID is required in the protected application)
wdcTrialExpired: The trial period has expired. See TrialExpInfo for more information about
expirations
wdcTrialManipulated: The trial period has been manipulated by external user/attacker
TrialExpInfo
This parameter specifies a pointer to a TTrialExpInfo structure with information about the current trial
expiration (days, executions, date...)
RegExpInfo
This parameter specifies a pointer to a TRegExpInfo structure with information about the current license
key expiration (days, executions, date...)
Return Values
This function has no return values.
WinLicense 221
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.8.4.7 WDC_DoRegistration
WDC_DoRegistration
The WDC_DoRegistration function is called by WinLicense to allow an application to be registered before it
gets executed. WinLicense will pass an array of functions pointers to allow calling all necessary functions to
register an application.
bool _cdecl WDC_DoRegistration(
TWDCfunctionsArray *pArrayFunctions);
Unicode Support Enabled:
bool _cdecl WDC_DoRegistration(
TWDCfunctionsArrayW *pArrayFunctions);

function WDC_DoRegistration(
var pArrayFunctions:TWDCfunctionsArray):Boolean; cdecl;
Unicode Support Enabled:
function WDC_DoRegistration(
var pArrayFunctions:TWDCfunctionsArrayW):Boolean; cdecl;
Parameters
pArrayFunctions
This parameter a specifies an array of functions (TWDCfunctionsArray) with pointers to specific
registration functions.
Return Values
If the function returns True, WinLicense will continue running the protected application.
If the function returns False, WinLicense will terminate the protected application immediately.
2010 Oreans Technologies. All rights reserved
1.8.4.8 WDC_Finalize
WDC_Finalize
The WDC_Finalize function is called by WinLicense when the protected application has been decompressed in
memory and partially decrypted and WinLicense is going to pass control to the protected application.
In this function, you can process any finalization routine before the protected application takes control of the
WinLicense Help File 222
2010 Oreans Technologies
processor.
bool _cdecl WDC_Finalize(void);

function WDC_Finalize():Boolean; cdecl;
Parameters
This function has no parameters.
Return Values
If the function returns True, WinLicense will pass control to the protected application.
If the function returns False, WinLicense will terminate the protected application immediately.
2010 Oreans Technologies. All rights reserved
1.9 SecureEngine Technology
SecureEngine Technology
SecureEngine is an innovative and revolutionary technology for protecting Microsoft Windows applications
against modern cracking. Its architecture and design is a completely new idea, never seen before in the
security-world. Other software protectors use normal application privileges, supervised and restricted by the
operating system kernel. Most of modern crackers tools are also running in the operating system (kernel) level
making it very easy to study and attack their protection routines, since they are running in a lower level
(application level).
SecureEngine has been designed with a different approach to avoid this common scenario. Its code is
running on the same level as the operating system (kernel) with all privileges enabled. That allows the
executing of any kind of protection technique without being restricted by the operating system. On the other
hand, current cracker tools are unable to detect, study and attack protection routines that have designed for
and run on the same level (kernel). This innovative technology is compatible with all popular Windows
versions, 98, ME, 2000, XP and 2003. Both of our products, WinLicense and WinLicense are enhanced with the
SecureEngine technology.
SecureEngine implements the following techniques to keep an application fully protected against advanced
reverse engineering and cracking.
WinLicense 223
2010 Oreans Technologies
AntiAPISpyer AntiBreakpoints
AntiCrackTools AntiDumperPro
ClearCode CodeEncrypt
CodeReplace DebuggerGuard
DynamicEncryption GarbageCode
intDebugShield InteractiveEngine
RealTimeSpy MemoryGuard
MonitorBlocker MutatorEngine
PasswordProtect PolymorphicLayers
SecureAPIWrapper SecureEntryPoint
SmartCompression SmartMetamorph
ThreadEngine VirtualMachine
2010 Oreans Technologies. All rights reserved
1.9.1 AntiAPISpyer
Often an attacker will try to study the APIs that are called by an application in order to see how it works and
subsequently bypass the protection. Many commonly available tools will allow an attacker to do this. To avoid
this kind of attack, SecureEngine offers AntiAPISpyer technology that makes "invisible" the APIs that are
called by a protected application.
2010 Oreans Technologies. All rights reserved
WinLicense Help File 224
2010 Oreans Technologies
1.9.2 AntiBreakpoints
Normally an attacker will use a debugger to set up breakpoints in an application. A breakpoint allows an
attacker to stop the execution of an application when a certain event occurs and study what the application is
doing at that point.
SecureEngine offers advanced techniques to detect any kind of breakpoints, bypassing them and finishing
the execution of the protected application.
Most of the current software protectors use weak techniques to detect breakpoints in a protected application.
For example, they check the first instructions on an API routine to see if a breakpoint has been inserted. To
bypass this technique, an attacker will put a breakpoint in the middle of the API where it will not be detected.
Moreover, most OS breakpoint detecting schemes can easily be bypassed using general cracking tools.
2010 Oreans Technologies. All rights reserved
1.9.3 AntiCrackTools
SecureEngine uses AntiCrackTools technology to detect any dangerous cracking tools running in memory and
stops the execution of the protected application or executes a custom protection routine when one of those
tools is detected.
The AntiCrackTools technology uses sophisticated techniques to detect cracking tools in memory. These new
techniques are implemented in kernel mode operation.
2010 Oreans Technologies. All rights reserved
1.9.4 AntiDumperPro
All software protectors keep the protected application encrypted before they run. When a protected application
WinLicense 225
2010 Oreans Technologies
is launched, the application must be decrypted in order for it to be executed by the CPU.
Many attackers have access to tools that allow them to dump a running application from memory to disk. If
successful the attacker will be able to reconstruct the original application with this technique.
SecureEngine implements never-seen-before techniques to avoid a protected application from being dumped
to disk. These techniques work against all kind of dumping tools, even the most powerful dumpers that run as
a device driver.
Most of the current software protectors use very weak techniques against memory dumpers such as destroying
the executable header at runtime. These techniques can easily be bypassed with newer dumping tools.
The following pictures show an example of an original application dumped from memory before and after being
protected with AntiDumperPro technology.
Figure 1: Memory dump of a non protected application
WinLicense Help File 226
2010 Oreans Technologies
Figure 2: Memory dump after protecting with AntiDumperPro technique
2010 Oreans Technologies. All rights reserved
1.9.5 ClearCode
ClearCode technology offers the ability to remove blocks of code after being executed. When an application is
running in memory, an attacker may use a dumping tool to dump the contents of the memory to disk.
ClearCode knows what code can be removed after being executed and deletes it from memory thus ensuring
that an attacker can not recompose dumped code.
2010 Oreans Technologies. All rights reserved
WinLicense 227
2010 Oreans Technologies
1.9.6 CodeEncrypt
The CodeEncrypt technology provides the ability to select blocks of code that will be encrypted all the time
while it is not executed. Once executed, the code gets encrypted again to avoid a possible reconstruction of
that code if an attacker manages to dump a protected application from memory to disk. SecureEngine uses
strong encryption algorithms to ensure that an attacker can not reconstruct an encoded block of code.
The following picture shows an example of a protected application when CodeEncrypt is applied in some
routines.
Figure 3: CodeEncrypt applied in specific locations
WinLicense Help File 228
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.9.7 CodeReplace
CodeReplace is a new technology that randomly takes some parts of an application code and replace them with
garbage code. SecureEngine encrypts and stores the real code in a secure place mixed with SecureEngine
itself. The real code is dynamically decrypted and executed only if the protection scheme is valid and present.
CodeReplace has specialized techniques to defeat all debuggers when the real code is executed. If an attacker
tries to recompose the original program he will get the garbage code instead of the real code. In the unlikely
event that an attacker totally removes the protection scheme, he will also remove the original code that has
become part of SecureEngine.
This technology is not implemented in other software protectors. Only a few software protectors try to use a
similar technology, but they are based in removing single instructions not big blocks of code as SecureEngie
does.
2010 Oreans Technologies. All rights reserved
1.9.8 DebuggerGuard
DebuggerGuard technology introduces revolutionary techniques to detect a debugger in memory. These
techniques cannot be bypassed by any known cracking tools and are almost impossible to bypass even if an
attacker knows how they work. This technology ensures that a protected application can only be run in safe
environments, without the presence of debugging tools.
Standard software protector use very well known tricks to detect the presence of debuggers in memory. These
tricks have been described in many documents, online and even in books. Now, due to the Windows NT
platform architecture, most of the classic techniques to detect debuggers cannot be applied causing most
software protectors to use weak techniques to detect debuggers.
2010 Oreans Technologies. All rights reserved
WinLicense 229
2010 Oreans Technologies
1.9.9 DynamicEncryption
When SecureEngine protects an application, it uses different encryption algorithms and keys, avoiding the
possibility that an attacker will find a generic way to decrypt all protected applications. These extremely strong
cryptographic algorithms fully protect against reverse engineering.
2010 Oreans Technologies. All rights reserved
1.9.10 GarbageCode
The GarbageCode feature mixes the real code in an algorithm with garbage code. After doing so, an attacker is
forced to deal with lots of garbage code when trying to study a specific routine. The GarbageCode technique
uses advanced algorithms to generate garbage code that is quite similar to the real one, making it almost
impossible to recognize which code is real and which is garbage. For example, if an attacker views a
disassembled application, they will have to study 8,000 instructions instead of the original 1,000 instructions.
Some software protectors use this technique but use a restricted set of garbage code to be mixed with the real
code, so an attacker can easily differentiate which code is real and which is not. Often only a few routines are
mixed with garbage code.
The following picture shows an example of a block of code and how that block of code is transformed after
applying the GarbageCode technique.
WinLicense Help File 230
2010 Oreans Technologies
Figure 4: Example of block of code with GarbageCode technique applied
2010 Oreans Technologies. All rights reserved
1.9.11 intDebugShield
The x86 architecture offers debugging capabilities to be used by software debuggers. Without those debugging
capabilities, software debuggers are unable to operate properly. SecureEngine takes full control of the x86
debugging capabilities in order to ensure that no debuggers are running when a protected application is run.
Traditional software protectors cannot implement this powerful technique, because they do not operate in
kernel mode thus the OS limits their operations.
WinLicense 231
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.9.12 InteractiveEngine
InteractiveEngine technology allows a two-way communication between SecureEngine and the protected
application. The protected application can "talk" at any time with SecureEngine to verify its presence in
memory and checks that there have not been any cracking attempts. With InteractiveEngine, SecureEngine
and the protected application work as a single unit.
If the protection scheme is removed by an attacker, the protected application will be notified about this and
finish the execution of the application in memory.
2010 Oreans Technologies. All rights reserved
1.9.13 MemoryGuard
In some situations an attacker will not try to reconstruct the original code of a protected application. Instead
he will change some of the data or code in memory to change the behavior of an application. This common
scenario is often found in computer games where an attacker will modify the behavior of the game to get extra
features.
SecureEngine uses a sophisticated protection technique to avoid an attacker from overwriting the data or
code of a protected application when it is running in memory.
Standard software protectors do not offer this kind of technology. There are a few programs that check if the
protected program code has been modified when the protected application is loaded in memory, but an
attacker can easily bypass them.
2010 Oreans Technologies. All rights reserved
WinLicense Help File 232
2010 Oreans Technologies
1.9.14 MonitorBlocker
Many attackers use file or registry monitors to see which files or registry keys are accessed by an application.
Many applications store their trial period information in files or registry keys. Attackers will detect those files or
registry keys that could give him clues about how to cheat the trial period of an application.
SecureEngine implements very advanced techniques to detect any kind of file or registry monitors running in
the system. These techniques are extremely strong and have not been used before in software protectors.
Most of the current protectors offer file or registry monitors detection techniques, like finding a specific window
class name registered in the system or detecting a specific executable running in memory. An attacker can
easily bypass these techniques if he has custom file or registry monitors.
The following pictures show how the MonitorBlocker technique affects Regmon, a well-known and powerful tool
used by crackers, to monitor access to the registry.
Figure 7: Regmon monitoring the system
WinLicense 233
2010 Oreans Technologies
Figure 8: Regmon gets blind when SecureEngine is running
2010 Oreans Technologies. All rights reserved
1.9.15 MutatorEngine
The MutatorEngine technique inspect specific instructions in the application to be protected and change them
with equivalent ones. This technique will avoid that a single application has the same code in each protected
instance and obfuscate specific blocks of code to make reverse engineering much harder.
WinLicense Help File 234
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.9.16 PasswordProtect
SecureEngine can add password protection to an application to avoid unauthorized running of the application.
This technique uses a highly secure cryptographic algorithm to encrypt and decrypt the protected application
with the given password. In unlikely event the password checking routine is bypassed by an attacker the
application will be decrypted with an incorrect password thus causing invalid instructions and other errors when
it is executed.
2010 Oreans Technologies. All rights reserved
1.9.17 PolymorphicLayers
To combat disassembly of the protection scheme or a protected application, SecureEngine uses encryption
layers. These encryption layers keep the code totally encrypted only decrypting the code when it needs to be
executed by the CPU.
To strengthen the encryption, SecureEngine uses polymorphic encryption layers. Each polymorphic layer has
a different algorithm and encryption key making it impossible to recognize where an encryption layer starts
and finishes.
The following pictures show two difference instances of a protected application with PolymorphicLayers. Every
time that an application is protected, the polymorphic layers are totally different in functionality and format.
WinLicense 235
2010 Oreans Technologies
Figure 9: Specific instance of application protected with PolymorphicLayers
WinLicense Help File 236
2010 Oreans Technologies
Figure 10: Another instance of application protected with PolymorphicLayers
2010 Oreans Technologies. All rights reserved
1.9.18 RealTimeSpy
The RealTimeSpy technique uses the power of the ThreadEngine to continually check that a protected
application is running in a safe environment and no attack has been attempted on the protected application.
Many software protectors leave the protected application running alone in memory after they have been fully
decrypted. This becomes a very weak point for those software protectors since an attacker can use certain
tools to reconstruct the decrypted application in memory.
WinLicense 237
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.9.19 SecureAPIWrapper
When an attacker tries to remove the protection scheme he needs to know which APIs are called by the
application. SecureAPIWrapper protects all the Windows APIs called from a protected application rendering all
cracking tools useless. If a protected application is partially dumped to disk, an attacker will not know which
APIs are called by the application because they are scrambled by the SecureAPIWrapper technology.
2010 Oreans Technologies. All rights reserved
1.9.20 SecureEntryPoint
When an application is going to be protected, SecureEngine removes the entry point of the application, the
first instructions that are executed in an application, and overwrites them with garbage code. The original
instructions are then scrambled and integrated into SecureEngine code. If an attacker finds the application
entry point, he will only get the garbage code.
The following picture graphically shows how this technique is implemented:
WinLicense Help File 238
2010 Oreans Technologies
Figure 11: Applying SecureEntryPoint to a specific application
2010 Oreans Technologies. All rights reserved
1.9.21 SmartCompression
SecureEngine uses a highly optimized algorithm to compress applications and their resources. It also allows
compressing the protection code that is inserted into an application and uses a very fast decompression
algorithm that does not decrease the application performance when loading into memory.
WinLicense 239
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.9.22 SmartMetamorph
SecureEngine adds a large amount of protection code to protect each application. In order to avoid that the
protection code looks the same in each application, SecureEngine uses SmartMetamorph technology that
mutates original instructions into different ones but with same functionality. This technology ensures that an
attacker will not easily recognize the protection code that is inserted into each protected application, forcing
him to independently study each protected application.
The newest software protectors also use this technology, but it is only applied to some specific routines and
not the main code, allowing an attacker to identify the main functionality of the protection code.
The following pictures show an example of how SmartMetamorph technology is applied to a block of code.
Figure 12: Applying SmartMetamorph to a block of code
WinLicense Help File 240
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.9.23 ThreadEngine
The ThreadEngine is a powerful technique that supervises and protects an application at runtime. The
ThreadEngine is composed by a "web" of threads that work cooperatively with the protected application
threads as a single unit. If an attacker threatens a thread, a neighboring thread will report an alert message to
the rest of the threads thus exiting the application from memory or executing a customized routine to stop the
attacker.
Only a few software protectors use a similar technique, but they do not use a strong communication protocol
between each thread and the protected application threads. In this scenario, each thread runs independently
making it easy for an attacker to attack each thread to bypass this protection technique.
WinLicense 241
2010 Oreans Technologies
Figure 13: Graphical example of application protected with the Thread Engine
2010 Oreans Technologies. All rights reserved
1.9.24 VirtualMachine
The SecureEngine VirtualMachine is a powerful technology that allows the execution of code compiled for an
WinLicense Help File 242
2010 Oreans Technologies
imaginary CPU. When this compiled code is executed, a cracker cannot recognize the code that is being
executed and cannot understand what a specific algorithm is doing.
We strongly recommend you to use this technology inside your application using the VirtualAPIwrapper option
and VMmacros (VM_START - VM_END) in your application source code.
2010 Oreans Technologies. All rights reserved
1.10 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
These questions are organized by groups to quickly help you finding solution to your problems:
IsWinLicensetheultimatesolutionagainstcracking?
I'musingaDongleprotectionontopofmyapplicationprotectedwithWinLicense,butmya
pplicationcrashes.WhatshouldIdo?
CanIprotectmy.NETapplicationswithWinLicense?
WhenIprotectmyapplicationwithWinLicense,itcrashesorexitssilently
WhenIprotectmyapplicationwithWinLicense,thesizeisincreasedby500Kb!
IhaveinsertedENCODEandCLEARmacrosinmyDLL,butmyDLLcrashes
CanIprotectmyWindowsNTsystemservicewithWinLicense?
IwanttoincludeWinLicenseinmybuildsystem.DoesWinLicensesupportcommandlinep
rotection?
Iwouldliketoincludethesameprotectionoptionsandcustomdialogsinallmyapplication
s.CanIapplythesamesettingstoallmyapplications?
IneedaspecialWinLicensebuildwithextendedprotectionoptionsformyapplication.Can
youmakeoneforme?
IhaveasuggestionaboutanewprotectionfeatureforWinLicense.Willyouimplementit?
IboughtaWinLicenselicensetoprotectmyapplications.Myfriendneedstoprotecthisap
plication.CanIprotecthissoftwarewithWinLicense?
WinLicense 243
2010 Oreans Technologies
Isitpossibletolockmyapplicationtoaspecificmachine?
Idon'twantmyapplicationtobeexecutedunlessavalidlicensekeyispresent.HowcanI
dothat?
HowcanIuseasinglelicensetoregisterallmyproducts?
Ihave2programsbutIwanteachtohaveaspecificlicensekey.HowcanIdothat?
Icanseeseveralkindsoflicensestoregistermyapplication(Singlefile,registry,textfile..
).WhichoneshouldIusetomakemyapplicationmorerobustagainstcracking?
WhatareSmartActivatekeys?
Isitpossibletoimplementafeaturethatprohibitsmyapplicationfrombeingrunwithape
rmanentkey?Inmyapplicationallkeysmustexpire.
Ihavereceivedareportaboutastolenlicensekey.HowcanIblockit?
HowcanIgetextendedinformationaboutcurrentlicensesformyapplication?
HowdoIcheckaSmartKey?
CanIonlyuselockedkeystoregistermyapplication?
I'mstilllostabouthowtouseSmartActivatekeys,canyougivemesomeexamples?
CanIincludedifferenttrialrestrictionsinasingleapplication?
Mytrialextensionskeysdonotseemtobeworkingtoextendthetrialperiodinmyapplicati
on
HowcanIclearthetrialinformationwhenIreleaseanewversion?
I'mgoingtoreleaseanewversionofmyapplicationwithabugfix,butIwantthetrialperio
dtocontinueasitwasforeachclient.HowcanIkeepthetrialperiodformynewprotected
application?
WhataretheseCustomCounters?HowcanIusethem?
HowdoesthePasswordprotectionwork?
IsitpossibletocustomizethepassworddialogdisplayedbyWinLicense?
CanyoutellmehowWinLicensesubscriptionswork?
AretherelocalizedversionsofWinLicensetosupportotherlanguages?
WhatprogramminglanguagewasWinLicensecreatedwith?
WinLicense Help File 244
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.1 Is WinLicense the ultimate solution against cracking?
Is WinLicense the ultimate solution against cracking?
Software developers know that there is nothing that is 100% effective to stop software cracking. Many
programmers confuse software protection with cryptographic algorithms. Software protectors can use the
strongest cryptographic algorithms in its code, but sooner or later that code needs to be decrypted to be able
to be executed by the CPU. It is in this phase where an attacker will start his work, dumping the decrypted
application from memory to disk and start its reconstruction in order to get the original application without the
protection scheme.
With WinLicense we are aware of those techniques used by crackers and avoid all possible attacks to an
application with the latest and newest technology against software cracking.
WinLicense uses a new technology not used before in traditional software protectors and we can guarantee
that it will stop most of the crackers from cracking an application protected with WinLicense.
2010 Oreans Technologies. All rights reserved
1.10.2 I'm using a Dongle protection on top of my application protected with
WinLicense, but my application crashes. What should I do?
I'm using a Dongle protection on top of my application protected
with WinLicense, but my application crashes. What should I do?
Most of the dongle protections use anti-debugger tricks to detect the presence of debuggers in memory.
Normally, those anti-debugger tricks are based on debugging interrupts checks that will interfere with
WinLicense since WinLicense is using the debugging interrupts. To enable dongle support with WinLicense you
should uncheck the option "Debug Interrupts" in the "Protection Options" panel before protecting your dongle
application.
2010 Oreans Technologies. All rights reserved
WinLicense 245
2010 Oreans Technologies
1.10.3 Can I protect my .NET applications with WinLicense?
Can I protect my .NET applications with WinLicense?
Yes. To do so, you need to acquire WinLicense Professional with .NET support. Only .NET Exe can be protected.
In a near future we will add support for .NET DLL protection.
2010 Oreans Technologies. All rights reserved
1.10.4 When I protect my application with WinLicense, it crashes or exits silenty
When I protect my application with WinLicense, it crashes or exits
silently
WinLicense has been successfully tested with many applications. If your application does not work when
protected, please follow the next steps:
1. Check that the original program, without protecting it, works OK.
2. Check that you are using the latest WinLicense version.
3. Go to the Virtual Machine panel and set the option "Entry Point Virtualization" to ZERO and
protect again.
4. If you have inserted SecureEngine Macros, temporally remove them and retest to determine if the
problem was due to the bad insertion of a macro.
5. If you have enabled the CodeReplace technology, temporally remove it and recheck if it works OK.
6. Check that the option "Entry Point Virtualization" in the "Virtual Machine" panel is not causing the
problem. Set it to zero and protect again.
7. Uncheck ALL protection options and try to find which one is causing the incompatibility with your
application.
If the problem persists or you want us to investigate your problem, please send your original program to
support@oreans.com. Your program will be kept in the strictest confidence and will be reviewed as soon as
possible.
WinLicense Help File 246
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.5 When I protect my application with WinLicense, the size is increased by
500Kb!
When I protect my application with WinLicense, the size is
increased by 500Kb!
When WinLicense protects an application, it adds protection code to make sure that your application will be
fully protected against all possible attacks. You can compress your application and its resources with
WinLicense although sometimes, applications are too small to be compressed and you will notice an increase in
its size.
Many programmers would complain about this possible increase in the size of their programs but it is not
possible to be protected with 20Kb of protection code. Crackers would easily study and crack those small
protectors within minutes.
2010 Oreans Technologies. All rights reserved
1.10.6 I have inserted ENCODE and CLEAR macros in my DLL, but my DLL crashes
I have inserted ENCODE and CLEAR macros in my DLL, but my DLL
crashes
Insertion of ENCODE and CLEAR macros in DLLs are a bit tricky. WinLicense inspects your application
searching for macros. Once a macro is found, it gets encrypted at protection time. The problem appears with
DLLs as they can be relocated in memory, so some references need to be fixed in the DLL at runtime thus
allowing the DLL be relocated in memory. Note: All of the references to be fixed are included in the relocation
section of a DLL. If one of those references to fix in the DLL were included in an ENCODE or CLEAR macro, the
reference will be fixed incorrectly, because all the code in the ENCODE/CLEAR macro is encrypted until it needs
to be executed.
To show an example of this situation, take a look at the following code:
WinLicense 247
2010 Oreans Technologies
void MyFunction
{
char *s;
int a = 0;
ENCODE_START
s = "Hello World";
for (int i = 0; i < 10; i++)
{
a = a * i;
}
ENCODE_END
}
The problem with the above code is the instruction: "s = "Hello World";". Have a look at its disassembly:
mov [ebp - 0xC], 0x403140
Where [ebp 0xC] is the value of "s" in the stack and 403140 points to the data section (string "Hello
World"). If the DLL is relocated, so it will be its data section. In our above example, the offset 0x403140 in
the instruction "mov [ebp 0xC], 0x403140" will not be relocated properly, because it is encrypted inside
the macro.
2010 Oreans Technologies. All rights reserved
1.10.7 Can I protect my Windows NT system service with WinLicense?
Can I protect my Windows NT system service with WinLicense?
Yes, WinLicense can detect which applications are Windows NT system services, so you can protect them just
like normal applications.
2010 Oreans Technologies. All rights reserved
WinLicense Help File 248
2010 Oreans Technologies
1.10.8 I want to include WinLicense in my build system. Does WinLicense support
command line protection?
I want to include WinLicense in my build system. Does WinLicense
support command line protection?
Yes! To do so, please refer to the following section Protectingthroughthecommandline.
2010 Oreans Technologies. All rights reserved
1.10.9 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?
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?
Yes, to do so just save a project file with all the protection options and your customized messages. After that
you just load your project file and change the name of the file to protect.
2010 Oreans Technologies. All rights reserved
1.10.10 I need a special WinLicense build with extended protection options for my
application. Can you make one for me?
I need a special WinLicense build with extended protection options
for my application. Can you make one for me?
Yes, we also offer services to make custom builds to satisfy special developer's needs. This service is offered
for a reasonable fee. Please, contact us at info@oreans.com and tell us about your needs.
WinLicense 249
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.11 I have a suggestion about a new protection feature for WinLicense. Will you
implement it?
I have a suggestion about a new protection feature for
WinLicense. Will you implement it?
We are happy to receive suggestions about possible protection features that you think should included in
WinLicense. We will try to implement your suggestions as soon as possible. New features can be implemented
immediately for a small fee. Regardless, please contact us at info@oreans.com
2010 Oreans Technologies. All rights reserved
1.10.12 I bought a WinLicense license to protect my applications. My friend needs to
protect his application. Can I protect his software with WinLicense?
I bought a WinLicense license to protect my applications. My
friend needs to protect his application. Can I protect his software
with WinLicense?
No, each license is private for the company/user that acquires it. Each protected application is watermarked
with the license key information to help us track about possible misuse in WinLicense license keys. In case that
we find a borrowed/stolen key, we will invalidate that license key for future updates.
2010 Oreans Technologies. All rights reserved
WinLicense Help File 250
2010 Oreans Technologies
1.10.13 Is it possible to lock my application to a specific machine?
Is it possible to lock my application to a specific machine?
Yes. The HardwareLock feature allows this type of restrictions. No one can use a hardware-locked license key
on a computer that has a different hardware configuration.
2010 Oreans Technologies. All rights reserved
1.10.14 I don't want my application to be executed unless a valid license key is
present. How can I do that?
I don't want my application to be executed unless a valid license
key is present. How can I do that?
This can be done using the Applicationonlyrunswhenregistered option. WinLicense will terminate the
application if no valid license key is present.
2010 Oreans Technologies. All rights reserved
1.10.15 How can I use a single license to registered all my products?
How can I use a single license to register all my products?
To do this, you must use the same license hash for all your software applications. This can be done with the
help of the SoftwareManager panel. You can copy/paste a registration hash from one software application to
another. After selecting the same hash, your application/s need to be protected again.
WinLicense 251
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.16 I have 2 programs but I want each to have a specific license key. How can I
do that?
I have 2 programs but I want each to have a specific license key.
How can I do that?
To do this, you have to use different license hashes for each software application. This can be done with the
help of the SoftwareManager panel. After changing your registration hash, your application needs to be
protected again.
2010 Oreans Technologies. All rights reserved
1.10.17 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?
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?
WinLicense offers different types of licenses to satisfy different developers' needs. In all types of licenses,
WinLicense offers a strong encryption algorithm to protect a license from being tampered with or faked.
The examples below show how each type of license looks:
Registry license key
Registry keys are very easy to install in the system, without requiring computer knowledge for your customers
and it's totally transparent for your application. To install a registry license, your customer has to double-click
on the .reg file (created by WinLicense) and accepts the standard Windows message box to install the key in
the Windows registry. After that, your application needs to be restarted in order to finish the registration
process for your application.
Example of registry license (*.reg file):
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Company\Product]
"reg_key"=hex:38,4A,0F,10,C0,DB,C1,5C,04,82,31,7C,8E,CC,5B,2E,78,39,74,7F,5E,DB,77,C7,DA,39,B4
,DD,F1,1E,10,70,1F,98,45,79,4F,57,94,03,96,A8,98,27,B1,9A,6A,B5,9E,31,29,6E,8F,F7,DD,A6,CD,11,
WinLicense Help File 252
2010 Oreans Technologies
88,43,A1,50,28,14,89,0F,D1,BD,88,D4,A9,90,97,8B,77,00,00,80,3F,9F,4F,27,13,DC,73,75,3F,E8,B7,A
1,1F,CC,19,B6,9D,8A,D2,1D,C7,A7,8D,98,95,8D,93,7A,71,7B,00,80,3F,9F,4F,27,13,89,96,71,D5,CD,DE
,62,02,BC,1A,B6,B9,88,0F,3D,61,30,17,0B,05,02,01,00,FE,FF,FF,FF,FE,FF,FF,FF,EF,30,AB,20,D7,BB,
98,08,97,2F,0F,CB,08,AF,11,A2,CC,32,57,9F,B1,49,0D,19,55,06,4C,FE,09,67,6F,AD,7D,C5,7A,FE,3C,F
0,5E,47,67,93,47,56,DC,32,3D,2D,08,CE,D5,35,C8,41,4C,F8,39,C1,4E,CF,FD,44,94,CC,E2,5B,4A,46,86
,18,89,2B,3A,79,AC,DA,AE,D7,B7,2B,6D,02,9C,74,98,A5,84,83,0D,45,7A,5A,39,E0,12,63,F9,53,89,25,
6A,D3,8B,FC,2E,57,D1,F9,13,6E,87,73,B7,2A,C6,58,6B,8B,E9,07,DF,E9,F4,58,9E,14,D9,A1,C9,B7,C1,B
0,3E,57,B7,87,6A,F2,4F,90,2A,66,C6,52,9B,E5,C8,29,5F,69,0E,27,44,80,C4,A0,E8,3C,03,86,9C,9D,26
,35,10,FC,31,86,CF,26,16,CF,FA,C9,FE,DD,6F,69,F4,B4,9B,04,8D,BD,5B,78,03,80,CC,F7,05,57,90,7B,
4B,54,75,92,01,CE,19,4F,40,B3,CD,AF,63,62,41,0E,6F,B3,00,39,53,FC,2B,DC,3B,0B,A0,7B,31,E2,CC,1
6,CA,EA,8C,8A,40,AD,FD,09,43,84,C1,8D,88,81,A6,A4,3E,FB
Text license Key
Text keys are convenient when you want to handle the registration of your application with a specific form
inside your application. Text keys can be easily sent by email to be copy/paste into your specific registration
form.
Example of text license key:
6DEA68EC78BD5B357EC6A4E8A91D018911A6B3F0691142B5EF65762145C7ADF7549B3F7FE39829E605F795C6C573BD
90D9282F6E8FF7DDA1417C3E9ECFE7F3F9FC084E6C0074777F900852602F170B0502803FCCE03394405CECC5295755
686FC516446605A88B8494F950E92F170B0502803F1F3D377E9BB537EC395855846D82F6BEDF6F371B0D0683FEFFFF
FFFEFFFFFFC3FC53DC913F1D4B80AF3DDDBD297C5114849630F716E28EDA20CC81A89E5314060B0824DDC29347D386
AD0F6DEB1703AB4E344E9ABE54E0D73893542E93AD331126F991F42FE384C2AD6A17201A1F27F7D1AA4AED95C41287
FA2E06C55D4B51B4CD6BE3F147AA5748A2C4362B3510950E3FFA87DCBC811A3A29362A11E1C14D07A5DB15A1094609
DF6C6254CEDC82E60B57C15A62B1DB3945442798284E118BF6CB981D54384D2D2BF0D85021B4F218BB185D0CF97B79
57E8EB99E92566D85D7CC0F23C5F533E9B425D288E10DBAF206E47643045FFEF533BC3091CD527740F138B905A02FB
B0EC3F75EF6096CF09407962559E
File license Key
File keys are special files that hold the licensing information for a specific application. To register your
application with a file key, your customer has to put the file key in the same folder as your application. After
that, your application needs to be restarted in order to finish the registration process for your application.
SmartActivate license key
The SmartActivate System allows an application to be licensed using a valid activation code that should be
inserted in a dedicated form in your application. It is very popular now to use such keys when almost all
registration data comes as plaintext and the key has a checksum for data and license restrictions.
Example of SmartActivate license key:
Name: John Smith
Company: J.S. Software Development
Custom Data: MODE: Advanced
Key: 286D0394-87716B52-BC59FA9A-CAA8DE87-4881A155-BF450169-C590
2010 Oreans Technologies. All rights reserved
WinLicense 253
2010 Oreans Technologies
1.10.18 What are SmartActivate keys?
What are SmartActivate keys?
SmartActivate Keys, also known as SmartKeys, are a special type of license keys accepted by WinLicense. The
SmartKey appears in the following manner:
Name: John Smith
Company: J.S. Software Development
Custom Data: MODE: Advanced
Key: 286D0394-87716B52-BC59FA9A-CAA8DE87-4881A155-BF450169-C590
It is very popular now to use such keys when almost all registration data comes as plaintext and the key has a
checksum for data and license restrictions. The SmartKey is quite short and contains only printable characters
so it will be easy to copy/paste for sending through e-mail, instant messengers etc.
2010 Oreans Technologies. All rights reserved
1.10.19 How can I get extended information about current licenses for my
application?
How can I get extended information about current licenses for my
application?
To do this, the WLGetRegStatus WinLicense function can be used. The return value will tell you whether the
license is correct, expired or if the current license key does not have machine ID information, etc. Please, refer
to the corresponding section to get extended information.
2010 Oreans Technologies. All rights reserved
1.10.20 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.
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.
WinLicense Help File 254
2010 Oreans Technologies
To force WinLicense to always check for an expirable license you have to check the
Acceptonlytemporarykeys(thatexpire) option in the Registration panel. WinLicense will discard license keys
that have an unlimited usage period.
2010 Oreans Technologies. All rights reserved
1.10.21 I have received a report about a stolen license key. How can I block it?
I have received a report about a stolen license key. How can I
block it?
This could be done with the help of the LicenseManager panel. Select the stolen license and press the
Markasstolen button. After doing this, your software must be protected again. The stolen keys will not work
in your new version.
2010 Oreans Technologies. All rights reserved
1.10.22 How do I check a SmartKey?
How do I check a SmartKey?
Use the WLRegSmartKeyCheck WinLicense function to check the validity of the current SmartKey. If the
SmartKey is valid, the return value is True, otherwise it will be False. Please, refer to the corresponding section
to get extended information.
If the SmartKey is valid, it must be installed either in the Windows Registry or in a file, to be referenced at a
later time by WinLicense. The following WinLicense functions help you on this:
WLRegSmartKeyInstallToFile
WLRegSmartKeyInstallToRegistry
WinLicense 255
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.23 Can I only use locked keys to register my application?
Can I only use locked keys to register my application?
Yes. To create locked license keys, you have to specify the machine ID before creating a new license key
(LicenseManager). If you want to make sure that your application will only accept machine locked license
keys, you can force WinLicense to check for them. To do so you have to go to the Registration panel and check
the option Allowonlyhardwaredependent(locked)registrations.
2010 Oreans Technologies. All rights reserved
1.10.24 I'm still lost about how to use SmartActivate keys, can you give me some
examples?
I'm still lost about how to use SmartActivate keys, can you give
me some examples?
As you might know, an application can be registered via a file key or a Registry key. SmartActivate keys is
another way to register an application but it's basically the same as a file or Registry key, though we have to
make use of some APIs in order to install the SmartActivate key as a file or Registry key.
The steps are the following:
1. In the Registrationpanel, we have to check the option Enable SmartActivate System for user-
side generated keys
2. We have to choose if we will finally install the SmartActivate key as file or Registry key, so we check
the option "Single File" (In the Registration panel) if we plan to finally install the SmartActivate key as
a file key
3. In your application, you have to implement a dialog where you allow a user to register the application
via SmartActivate keys (See examples in the WinLicense examples folder)
4. Protect your application
5. Let's create a SmartActivate key from the WinLicense LicenseManager. You have to give your client
the SmartActivate key information in order to register your application
6. When your customer inserts the SmartActivate key in the dialog where you allow the insertion of
SmartActivate keys, you have to call the API WLRegSmartKeyCheck and if it returns TRUE, you have
to install the SmartActivate key as file (or Registry) using WLRegSmartKeyInstallToFile (or
WLRegSmartKeyInstallToRegistry)
7. Restart your application and it should run as registered!
WinLicense Help File 256
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.25 Can I include different trial restrictions in a single application?
Can I include different trial restrictions in a single application?
Yes, WinLicense offers a flexible trial system that is able to include any combination of the trial restrictions of
your application. Please, refer to the TrialSettings panel for this.
2010 Oreans Technologies. All rights reserved
1.10.26 My trial extensions keys do not seem to be working to extend the trial period
in my application
My trial extensions keys do not seem to be working to extend the
trial period in my application
Please, make sure that you are following these requirements:
You have enabled the ExtensionKey distribution option.
Either file or registry extension keys are enabled in the TrialSettings panel.
You are extending a restriction that was included when your program was protected. That is, if you
have restricted your application by number of executions, ONLY the number of executions can be
extended with the trial extension keys.
2010 Oreans Technologies. All rights reserved
1.10.27 How can I clear the trial information when I release a new version?
How can I clear the trial information when I release a new
version?
The solution is to use another Trial Hash for the new version. This can be done from the SoftwareManager
panel. After selecting a new trial hash, the new version needs to be protected again.
WinLicense 257
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.28 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?
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?
To do this the same Trial Key must be used for both old and newer versions. Just copy the hash from old
version to the new one using the SoftwareManager panel.
2010 Oreans Technologies. All rights reserved
1.10.29 What are these Custom Counters? How can I use them?
What are these Custom Counters? How can I use them?
Custom counters are available for different developer needs. They can be freely used to keep the count of an
expirable resource in trial versions. For example, an image editing application needs to be restricted to save
only 100 edited images in trial version. A custom counter could be used in this case: after each save operation,
the corresponding counter must be increased.
WinLicense offers 3 basic functions to manipulate custom counters.
To get extended information about the Custom Counters WinLicense API, please refer to the following sections:
WLTrialCustomCounter
WLTrialCustomCounterDec
WLTrialCustomCounterInc
WinLicense Help File 258
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.10.30 How does the Password protection work?
How does the Password protection work?
When Passwordprotection is enabled, the protected application will be encrypted with the application password
hash. If desired, WinLicense can ask for a password to run the protected application. Note that if an incorrect
password is entered, the application will be decrypted with a wrong password, generating invalid decrypted
data. Thus, a cracker cannot patch the password checking routine, making this kind of protection very powerful
against cracking.
2010 Oreans Technologies. All rights reserved
1.10.31 Is it possible to customize the password dialog displayed by WinLicense?
Is it possible to customize the password dialog displayed by
WinLicense?
The current version of WinLicense does not support customization of the password dialog. Instead, you can
create your own password dialogs inside your application and use the WinLicense passwordrelatedfunctions to
verify the entered password. Of course, checking a password inside your own application is weaker than
leaving WinLicense to check for a password because WinLicense uses the password entered to decrypt your
application.
2010 Oreans Technologies. All rights reserved
1.10.32 Can you tell me how WinLicense subscriptions work?
Can you tell me how WinLicense subscriptions work?
When you purchase WinLicense, you will have 6 months of free upgrades (for Standard version) or 9 months
(for Professional version). In order to keep our projects alive and up dated we require a small amount of
capital to keep producing the updated versions. When your original subscription expires all you have to do is
purchase a new subscription.
WinLicense 259
2010 Oreans Technologies
We have 3 types of subscriptions: 3 days, Biannual and Annual. Please, check Pricesandsubscriptions for
more details.
You can get the latest version the following ways:
1. By entering your username and password at http://www.oreans.com.
2. Automatically using WebUpdate inside WinLicense user interface. The WebUpdate system will check if your
account has expired and it will automatically download the current version.
You will be notified via email and via WinLicense user interface when your account is about to expire so you
can order a new subscription.
2010 Oreans Technologies. All rights reserved
1.10.33 Are there localized versions of WinLicense to support other languages?
Are there localized versions of WinLicense to support other
languages?
We are planning to add localized versions in WinLicense very soon. If you want to contribute helping us
translating into your native language, please, contact us at info@oreans.com to discuss it.
2010 Oreans Technologies. All rights reserved
1.10.34 What programming language was WinLicense created with?
What programming language was WinLicense created with?
All the internal engines and SecureEngine itself have been coded in Win32 Assembly language. WinLicense
graphical user interface was developed with Borland Delphi.
WinLicense Help File 260
2010 Oreans Technologies
2010 Oreans Technologies. All rights reserved
1.11 Order
1.11.1 Prices and subscriptions
Order
To order a license for WinLicense, please visit http://www.oreans.com.
Prices
There are two types of versions available for WinLicense depending upon the type of files that they are able to
protect. The following table shows the difference between these two versions and the prices for each of them.
Win32 EXE Win32 DLL Win32 OCX NT services .NET EXE
Price Single
Developer License
WinLicense Standard

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 support@oreans.com.
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
info@oreans.com 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 info@oreans.com 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
support@oreans.com.
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

Вам также может понравиться