<< Click to Display Table of Contents >> Navigation: WinLicense > SecureEngine® Macros > Using macros in your programming language |
The current version of SecureEngine supports macros for native applications (developed with C/C++, Delphi, Visual Basic, etc.). 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" marker and the end of the block using the "MacroName_END" marker.
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. The following is an example of nesting macros:
void MyFunction(void) { VM_START
// your code
VM_START <--- nested!!!
// your code
VM_END
// your code
VM_END } |
•Each macro needs to have each corresponding "MacroName_END" delimiter.
•The code inside the macro must be at least 5 bytes in size.
Usage for specific programming languages
For Delphi, SecureEngine® macros can be inserted as a "assembly language" include file or linking with the SecureEngineSDK.pas file.
•Macros as "include files": In this case, macro markers appears 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 filename} directive. That sequence of assembly code will be detected and replaced by SecureEngine® in the protection phase. Notice that for 64-bit applications, Embarcadero RAD Studio for Delphi does not allow inline assembly to be inserted directly into your application. In this case, you have to insert the protection macros via function names.
•Macros as "function names": You can use the defined macros function names in the SecureEngineSDK.pas file in order to insert the different macro markers in your application. With this approach you are linking with the SecureEngineSDK.dll only in unprotected state, that is, your unprotected application will require the SecureEngineSDK.dll in order to run. Once that your application is protected, the linking with the SecureEngineSDK.dll is removed, so your protected application does not require the SecureEngineSDK.dll to run.
In the following we present a real example of how to use SecureEngine® macros in your Delphi application.
|
For the C/C++ language you have to include the "WinLicenseSDK.h" in your application source code, so you can put the different macro markers inside your source code. By default, the WinLicenseSDK.h file emits inline assembly for your C/C++ 32-bit applications and function names (from within the SecureEngineSDK.dll) for your C/C++ 64-bit applications. This means that your 64-bit applications require the SecureEngineSDK.dll when you run your application unprotected. Once that you protect your application, the linking with the SecureEngineSDK.dll is removed, so your protected application does not require that DLL.
Following will demonstrate a real example of how to use SecureEngine® macros in your C/C++ application.
|
For Visual Basic these macros appear as a special Visual Basic instruction that will be detected by SecureEngine® during the protection phase.
In the following we present a real example of how to use SecureEngine® macros in your Visual Basic application.
|