37 0 4MB
Contents
I
Table of Contents Foreword
Part I WinLicense
0
6
1 Why use WinLicense? ................................................................................................................................... 7 Scenarios for using .......................................................................................................................................................... WinLicense 7 Comparing WinLicense .......................................................................................................................................................... with other protectors/licensing systems 8
2 User Interface................................................................................................................................... 9 WinLicense GUI .......................................................................................................................................................... overview 9
3 Protecting an................................................................................................................................... application 11 Application Information .......................................................................................................................................................... 12 Protection Options .......................................................................................................................................................... 13 CodeReplace.......................................................................................................................................................... 16 Virtual Machine .......................................................................................................................................................... 20 Trial Settings.......................................................................................................................................................... 23 Registration .......................................................................................................................................................... 25 Hardware Lock .......................................................................................................................................................... 27 Password protection .......................................................................................................................................................... 29 Advanced Options .......................................................................................................................................................... 31 Customized Dialogs .......................................................................................................................................................... 33 Protect Now .......................................................................................................................................................... 39 Protecting through .......................................................................................................................................................... the command line 41
4 SecureEngine® ................................................................................................................................... Macros 43 Using macros.......................................................................................................................................................... in your programming language 44 VM macro .......................................................................................................................................................... 47 CodeReplace.......................................................................................................................................................... macro 49 Encode macro .......................................................................................................................................................... 50 Clear macro .......................................................................................................................................................... 53 Registered macro .......................................................................................................................................................... 54 RegisteredVM.......................................................................................................................................................... macro 54 Unregistered .......................................................................................................................................................... macro 55 Unprotected macro .......................................................................................................................................................... 56 CheckProtection .......................................................................................................................................................... macro 57 CheckCodeIntegrity .......................................................................................................................................................... macro 59 CheckRegistration .......................................................................................................................................................... macro 61 CheckVirtualPC .......................................................................................................................................................... macro 62 Which Macros.......................................................................................................................................................... should I use? 63
5 Licensing with ................................................................................................................................... WinLicense 64 Overview .......................................................................................................................................................... 65 File keys .......................................................................................................................................................... 65 Registry keys.......................................................................................................................................................... 66 Text keys .......................................................................................................................................................... 66 SmartActivate.......................................................................................................................................................... keys 67 Generating licenses .......................................................................................................................................................... 67 Setting license .......................................................................................................................................................... restrictions 68 Customizing features .......................................................................................................................................................... in licenses 68
6 WinLicense SDK ................................................................................................................................... 69 Trial Functions .......................................................................................................................................................... 69 © 2010 Oreans Technologies
II
WinLicense Help File WLTrialCustomCounter ......................................................................................................................................................... 71 WLTrialCustomCounterDec ......................................................................................................................................................... 72 WLTrialCustomCounterInc ......................................................................................................................................................... 73 WLTrialCustomCounterSet ......................................................................................................................................................... 74 WLTrialDateDaysLeft ......................................................................................................................................................... 75 WLTrialDaysLeft ......................................................................................................................................................... 76 WLTrialDebugCheck ......................................................................................................................................................... 77 WLTrialExecutionsLeft ......................................................................................................................................................... 77 WLTrialExpirationDate ......................................................................................................................................................... 78 WLTrialExpirationTimestamp ......................................................................................................................................................... 79 WLTrialExpireTrial ......................................................................................................................................................... 80 WLTrialExtendExpiration ......................................................................................................................................................... 81 WLTrialExtGetLevel ......................................................................................................................................................... 82 WLTrialExtGetStatus ......................................................................................................................................................... 83 WLTrialFirstRun ......................................................................................................................................................... 84 WLTrialGetStatus ......................................................................................................................................................... 84 WLTrialGlobalTimeLeft ......................................................................................................................................................... 86 WLTrialLockedCountry ......................................................................................................................................................... 86 WLTrialRuntimeLeft ......................................................................................................................................................... 87 WLTrialStringRead ......................................................................................................................................................... 88 WLTrialStringReadW ......................................................................................................................................................... 89 WLTrialStringWrite ......................................................................................................................................................... 90 WLTrialStringWriteW ......................................................................................................................................................... 92 WLTrialTotalDays ......................................................................................................................................................... 93 WLTrialTotalExecutions ......................................................................................................................................................... 93 Registration Functions .......................................................................................................................................................... 94 WLRegCheckMachineLocked ......................................................................................................................................................... 96 WLRegDateDaysLeft ......................................................................................................................................................... 96 WLRegDaysLeft ......................................................................................................................................................... 97 WLRegDisableCurrentKey ......................................................................................................................................................... 98 WLRegDisableKeyInCurrentInstance ......................................................................................................................................................... 99 WLRegExecutionsLeft ......................................................................................................................................................... 100 WLRegExpirationDate ......................................................................................................................................................... 101 WLRegExpirationTimestamp ......................................................................................................................................................... 102 WLRegFirstRun ......................................................................................................................................................... 102 WLRegGetDynSmartKey ......................................................................................................................................................... 103 WLRegGetLicenseHardwareID ......................................................................................................................................................... 104 WLRegGetLicenseInfo ......................................................................................................................................................... 105 WLRegGetLicenseInfoW ......................................................................................................................................................... 106 WLRegGetLicenseRestrictions ......................................................................................................................................................... 107 WLRegGetLicenseType ......................................................................................................................................................... 109 WLRegGetStatus ......................................................................................................................................................... 109 WLRegGlobalTimeLeft ......................................................................................................................................................... 111 WLRegLicenseCreationDate ......................................................................................................................................................... 112 WLRegLicenseName ......................................................................................................................................................... 113 WLRegLockedCountry ......................................................................................................................................................... 114 WLRegNetInstancesGet ......................................................................................................................................................... 114 WLRegNetInstancesMax ......................................................................................................................................................... 115 WLRegNormalKeyCheck ......................................................................................................................................................... 116 WLRegNormalKeyCheckW ......................................................................................................................................................... 117 WLRegNormalKeyInstallToFile ......................................................................................................................................................... 118 WLRegNormalKeyInstallToFileW ......................................................................................................................................................... 119 WLRegNormalKeyInstallToRegistry ......................................................................................................................................................... 120 WLRegNormalKeyInstallToRegistryW ......................................................................................................................................................... 121 © 2010 Oreans Technologies
Contents
III
WLRegRemoveCurrentKey ......................................................................................................................................................... 121 WLRegRuntimeLeft ......................................................................................................................................................... 122 WLRegSmartKeyCheck ......................................................................................................................................................... 123 WLRegSmartKeyCheckW ......................................................................................................................................................... 125 WLRegSmartKeyInstallToFile ......................................................................................................................................................... 126 WLRegSmartKeyInstallToFileW ......................................................................................................................................................... 127 WLRegSmartKeyInstallToFileInFolder ......................................................................................................................................................... 129 WLRegSmartKeyInstallToRegistry ......................................................................................................................................................... 130 WLRegSmartKeyInstallToRegistryW ......................................................................................................................................................... 132 WLRegTotalDays ......................................................................................................................................................... 133 WLRegTotalExecutions ......................................................................................................................................................... 134 Generators Functions .......................................................................................................................................................... 135 WLGenLicenseFileKey ......................................................................................................................................................... 136 WLGenLicenseFileKeyEx ......................................................................................................................................................... 140 WLGenLicenseRegistryKey ......................................................................................................................................................... 143 WLGenLicenseRegistryKeyEx ......................................................................................................................................................... 147 WLGenLicenseTextKey ......................................................................................................................................................... 150 WLGenLicenseTextKeyEx ......................................................................................................................................................... 154 WLGenLicenseDynSmartKey ......................................................................................................................................................... 157 WLGenLicenseSmartKey ......................................................................................................................................................... 159 WLGenPassword ......................................................................................................................................................... 163 WLGenTrialExtensionFileKey ......................................................................................................................................................... 164 WLGenTrialExtensionRegistryKey ......................................................................................................................................................... 166 Custom ......................................................................................................................................................... WinLicense SDK 169 sLicenseFeatures ......................................................................................................................................................... Definition 174 Miscellaneous .......................................................................................................................................................... Functions 176 WLBufferCrypt ......................................................................................................................................................... 177 WLBufferDecrypt ......................................................................................................................................................... 178 WLGetCurrentCountry ......................................................................................................................................................... 179 WLGetVersion ......................................................................................................................................................... 182 WLGetProtectionDate ......................................................................................................................................................... 182 WLHardwareCheckID ......................................................................................................................................................... 183 WLHardwareGetFormattedID ......................................................................................................................................................... 184 WLHardwareGetID ......................................................................................................................................................... 185 WLHardwareGetIdType ......................................................................................................................................................... 186 WLHardwareRuntimeCheckU3 ......................................................................................................................................................... 187 WLLoadWinlicenseDll ......................................................................................................................................................... 188 WLPasswordCheck ......................................................................................................................................................... 189 WLProtectCheckDebugger ......................................................................................................................................................... 190 WLProtectCheckCodeIntegrity ......................................................................................................................................................... 190 WLRestartApplication ......................................................................................................................................................... 191 WLRestartApplicationArgs ......................................................................................................................................................... 192 WLSplashHide ......................................................................................................................................................... 193 WLStringDecrypt ......................................................................................................................................................... 194 Testing in an.......................................................................................................................................................... unprotected state 194
7 WinLicense................................................................................................................................... Managers 195 Project Manager .......................................................................................................................................................... 196 Software Manager .......................................................................................................................................................... 197 Customers Manager .......................................................................................................................................................... 199 License Manager .......................................................................................................................................................... 200 Password Manager .......................................................................................................................................................... 206 Trial Extension .......................................................................................................................................................... Manager 208
8 WinLicense................................................................................................................................... DLL Control 211 © 2010 Oreans Technologies
IV
WinLicense Help File WinLicense .......................................................................................................................................................... DLL Control Features 211 WinLicense .......................................................................................................................................................... DLL Control in runtime 212 Inserting WinLicense .......................................................................................................................................................... DLL Control inside your application 213 WinLicense .......................................................................................................................................................... DLL Control SDK 214 WDC_Initialize ......................................................................................................................................................... 215 WDC_ProcessHardwareID ......................................................................................................................................................... 216 WDC_FirstRunTrial ......................................................................................................................................................... 217 WDC_FirstRunLicense ......................................................................................................................................................... 217 WDC_GetLicenseInfo ......................................................................................................................................................... 218 WDC_GetApplicationStatus ......................................................................................................................................................... 219 WDC_DoRegistration ......................................................................................................................................................... 221 WDC_Finalize ......................................................................................................................................................... 221
9 SecureEngine® ................................................................................................................................... Technology 222 AntiAPISpyer.......................................................................................................................................................... 223 AntiBreakpoints .......................................................................................................................................................... 224 AntiCrackTools .......................................................................................................................................................... 224 AntiDumperPro .......................................................................................................................................................... 224 ClearCode .......................................................................................................................................................... 226 CodeEncrypt.......................................................................................................................................................... 227 CodeReplace .......................................................................................................................................................... 228 DebuggerGuard .......................................................................................................................................................... 228 DynamicEncryption .......................................................................................................................................................... 229 GarbageCode .......................................................................................................................................................... 229 intDebugShield .......................................................................................................................................................... 230 InteractiveEngine .......................................................................................................................................................... 231 MemoryGuard .......................................................................................................................................................... 231 MonitorBlocker .......................................................................................................................................................... 232 MutatorEngine .......................................................................................................................................................... 233 PasswordProtect .......................................................................................................................................................... 234 PolymorphicLayers .......................................................................................................................................................... 234 RealTimeSpy.......................................................................................................................................................... 236 SecureAPIWrapper .......................................................................................................................................................... 237 SecureEntryPoint .......................................................................................................................................................... 237 SmartCompression .......................................................................................................................................................... 238 SmartMetamorph .......................................................................................................................................................... 239 ThreadEngine .......................................................................................................................................................... 240 VirtualMachine .......................................................................................................................................................... 241
10 FAQ
................................................................................................................................... 242
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. 244 What should Can I protect.......................................................................................................................................................... my .NET applications with WinLicense? 245 When I protect .......................................................................................................................................................... my application with WinLicense, it crashes or exits silenty 245 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 246 Can I protect.......................................................................................................................................................... my Windows NT system service with WinLicense? 247 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 apply248 the same settings I need a special .......................................................................................................................................................... WinLicense build with extended protection options for my application. Can you make one248 for me? 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. Can249 I protect his softw 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? 250
© 2010 Oreans Technologies
Contents
V
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 251 I use to make 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 253 my application a I have received .......................................................................................................................................................... a report about a stolen license key. How can I block it? 254 How do I check .......................................................................................................................................................... a SmartKey? 254 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? 255 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? 256 I'm going to .......................................................................................................................................................... release a new version of my application with a bug fix, but I want the trial period to continue 257 as it was for each What are these .......................................................................................................................................................... Custom Counters? How can I use them? 257 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? 258 Are there localized .......................................................................................................................................................... versions of WinLicense to support other languages? 259 What programming .......................................................................................................................................................... language was WinLicense created with? 259
11 Order
................................................................................................................................... 260
Prices and subscriptions .......................................................................................................................................................... 260
12 Support
................................................................................................................................... 261
Support
.......................................................................................................................................................... 261
Part II XBundler
261
1 Overview ................................................................................................................................... 262 What is XBundler? .......................................................................................................................................................... 262 Scenarios for .......................................................................................................................................................... using XBundler 262 Using XBundler .......................................................................................................................................................... 263 Installing XBundler .......................................................................................................................................................... 265
2 FAQ
................................................................................................................................... 265
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 266 with Themida 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 embedded267 files? My application .......................................................................................................................................................... does not work when I use XBundler on it. What's happening? 267 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? 268 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? 269
3 Order
................................................................................................................................... 270
Registration.......................................................................................................................................................... and prices 270
4 Support Support
Index
© 2010 Oreans Technologies
................................................................................................................................... 271 .......................................................................................................................................................... 271
272
6
1
WinLicense Help File
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.
· Why use WinLicense? · User Interface · Protecting an application · SecureEngine® Macros · Licensing with WinLicense · WinLicense SDK · WinLicense Managers · WinLicense DLL Control · SecureEngine® Technology · FAQ · Order · Support
© 2010 Oreans Technologies. All rights reserved
© 2010 Oreans Technologies
WinLicense
1.1
7
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.
· Scenarios for using WinLicense · Comparing WinLicense with other protectors/licensing systems
© 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 UserPassword. 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.
© 2010 Oreans Technologies
8
WinLicense Help File
· 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
© 2010 Oreans Technologies
WinLicense
9
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.
· WinLicense GUI overview
© 2010 Oreans Technologies. All rights reserved
1.2.1
WinLicense GUI overview WinLicense GUI overview
© 2010 Oreans Technologies
10
WinLicense Help File
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 Application Information option allows you to set up the general information settings about the application that you are going to protect. · The Protection Options option allows you to select the different protection options that will be included in your application. · The Code Replace option helps you to set up and simulate your application using the CodeReplace technology. · The Virtual Machine option allows you to set up all protections related with the Virtual Machine
© 2010 Oreans Technologies
WinLicense
11
technology. · The Trial Settings 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 Hardware Lock option allows you to specify which hardware settings will be included in your hardware dependent keys. · The Password Protection option allows you to set up password protection in your applications. · The Customized Dialogs 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.
· Application Information · Protection Options · CodeReplace · Virtual Machine · Trial Settings © 2010 Oreans Technologies
12
WinLicense Help File
· Registration · Hardware Lock · Password Protection · Advanced Options · Customized Dialogs · Protect Now · Protecting through the command line
© 2010 Oreans Technologies. All rights reserved
1.3.1
Application Information Application Information
© 2010 Oreans Technologies
WinLicense
13
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
© 2010 Oreans Technologies
14
WinLicense Help File
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
© 2010 Oreans Technologies
WinLicense
15
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 Customized Dialogs) 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
© 2010 Oreans Technologies
16
WinLicense Help File
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 Customized Dialogs 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
© 2010 Oreans Technologies
WinLicense
17
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
© 2010 Oreans Technologies
18
WinLicense Help File
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.
© 2010 Oreans Technologies
WinLicense
19
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
© 2010 Oreans Technologies
20
WinLicense Help File
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
© 2010 Oreans Technologies
WinLicense
21
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.
© 2010 Oreans Technologies
22
WinLicense Help File
· 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
© 2010 Oreans Technologies
WinLicense
1.3.5
23
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. © 2010 Oreans Technologies
24
WinLicense Help File
· 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 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.
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 trial extension 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.
© 2010 Oreans Technologies
WinLicense
25
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 Trial settings panel, will affect the execution of the registered application. To avoid an application © 2010 Oreans Technologies
26
WinLicense Help File
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-9E35C4DC75DC") 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,
© 2010 Oreans Technologies
WinLicense
27
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 Static or Dynamic 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 Hardware Lock 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
© 2010 Oreans Technologies
28
WinLicense Help File
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.
© 2010 Oreans Technologies
WinLicense
29
· 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
© 2010 Oreans Technologies
30
WinLicense Help File
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 Software Manager. 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 © 2010 Oreans Technologies
WinLicense
31
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
© 2010 Oreans Technologies
32
WinLicense Help File
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.
© 2010 Oreans Technologies
WinLicense
33
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
© 2010 Oreans Technologies
34
WinLicense Help File
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.
© 2010 Oreans Technologies
WinLicense
35
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
© 2010 Oreans Technologies
Description
36
WinLicense Help File
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
© 2010 Oreans Technologies
WinLicense
37
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
© 2010 Oreans Technologies
38
WinLicense Help File
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 MsgId, char* MsgBody);
function MsgHandler( MsgId: 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.
© 2010 Oreans Technologies
WinLicense
39
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.
© 2010 Oreans Technologies
40
WinLicense Help File
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 generators functions but just omit that parameter. That means that all generator functions 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
© 2010 Oreans Technologies
WinLicense
41
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 YourProject 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 YourProject 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:
© 2010 Oreans Technologies
42
WinLicense Help File
WinLicense YourProject 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 YourProjectFile /inputfile YourInputApplication.exe /outputfile 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 YourProjectFile /software YourSoftware /version 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:
© 2010 Oreans Technologies
WinLicense
43
@echo off start /w WinLicense /protect YourProject if errorlevel if errorlevel if errorlevel if errorlevel goto done
3 2 1 0
goto goto goto goto
3 2 1 0
: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:
· Using macros in your programming language · VM macro · CodeReplace macro · Encode macro · Clear macro © 2010 Oreans Technologies
44
WinLicense Help File
· Registered macro · RegisteredVM macro · Unregistered macro · Unprotected macro · CheckProtection macro · CheckCodeIntegrity macro · CheckRegistration macro · CheckVirtualPC macro · Which Macros should I use?
© 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
© 2010 Oreans Technologies
WinLicense
45
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} with an "Encode" macro
// the following block of code is protected
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} with a "CodeReplace" macro
// the following block of code is protected
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} {$I Encode_Start.inc} with an "Encode" macro
// end of "CodeReplace" macro // the following block of code is protected
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.
© 2010 Oreans Technologies
46
WinLicense Help File
LRESULT CALLBACK MainHandler(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: CODEREPLACE_START is protected with a "CodeReplace" macro
// the following block of code
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 is protected with an "Encode" macro
// the following block of code
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.
© 2010 Oreans Technologies
WinLicense
47
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.
© 2010 Oreans Technologies
48
WinLicense Help File
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.
© 2010 Oreans Technologies
WinLicense
49
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 CodeReplace technology. 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 CodeReplace panel 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 VM macros 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}
© 2010 Oreans Technologies
50
WinLicense Help File
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 CodeEncrypt technology. 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")
© 2010 Oreans Technologies
WinLicense
51
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 VM macros 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} ENCODE_START - ENCODE_END
// The ENCODE_START macro will decrypt the code inside
if (MyParam1 = 2) then begin Return := 1; Exit;
//