Contact Us | Buy Now |English Version|中文版

 

 



AntiDebugLIB Programming Guide

 

Introduction

        After your applications are developed normally with VC++. You should protect your codes unless your software is free.But the Cracker can crack your codes always,the main reason about the software application cracked is that it can be debuged by some programme debug tools,then it can be analysed statically and dynamically.So when your application is running,and if it can prevent all debuger tool from being executed normally,then it's almost impossible to be cracked without a debugger.In order to do this,you must study how the debugger works and to find how to prevent them from working,AntiDebugLIB can help you finish these heavy works and protect your codes from being cracked.
        A sample code is released in this article to show the usage of AntiDebugLIB.

How does it work?

     1. AntiDebugLIB offers some functions which need license and use the same function definition as in c++ .
     2. AntiDebugLIB offers custom function and encryption macro function,they can helps software developers encrypt their codes rapidly.
     3. AntiDebugLIB offers a powerful PE Protector tool--Eagle Protector.

     After your applications are developed normally with VC++,only four steps left as follows:

     Step 1

          Replace the c++ function with AntiDebugLIB's function simply in your non-sharing codes or key codes.

Show example

     Step 2

          Use AntiDebug LIB's custom functions to create self-engendered function codes.

     Step 3

          Insert AntiDebug LIB's encryption macros to mark regions of codes that need to be encrypted.          

     Step 4

          Rebuild project and encrypt the release PE file with Eagle Protector.

1.AntiDebugLIB Files


File Name

Comment

antidebug.h Function Library's header file.
antidebug.lib Function Library file.(included in ADL_Register.EXE)
gjglly.sys AntiDebugLIB driver file. included in ADL_Register.EXE)
ADL_Register.EXE AntiDebugLIB License generation tool and PE file protection tool.
AntiDebugLib.CHM AntiDebugLIB help file.
Start_ADL_Register.exe Using Start_ADL_Register to start your main program can give user a better experience.Download Start_ADL_Register sourcecode.


2.
Programme Developing Environment

OS: Windows XP/2003/Vista/2008/7 (32bit 64bit)

IDE:Microsoft Visual Studio 2008 / C++Builder / Delphi / VB6.0.

3.Illustration

    The follow steps will start from scratch to create a demo project to demonstrate usage of AntiDebugLIB.You can download antidebug_demo here firstly, rebuild it directly and get the first impression.You should refer to the article "How to build antidebug_demo project?" to solve the building problems.

Select the dirve and library files based on current Operating System platform

   We recommend using Start_ADL_Register start your main program in order to give user a better experience. You can change Start_ADL_Register name as you like. You can download Start_ADL_Register source code from our website.
NOTE:You must copy "C:\Windows\System32\bcdedit.exe" file to your own install directory for win64 version program.You can refer to our installation directory.

   32bit OS:

      antidebug_demo\Win32 Files\dirver\Gjglly.sys
      antidebug_demo\Win32 Files\lib\Multi-threaded DLL\antidebug.lib(Dynamic Link Library)
      or antidebug_demo\Win32 Files\lib\Multi-threaded \antidebug.lib(Static Link Library)

   64bit OS:

      antidebug_demo\Win64 Files\dirver\Gjglly.sys
      antidebug_demo\Win64 Files\lib\Multi-threaded DLL\antidebug.lib(Dynamic Link Library)
      or antidebug_demo\Win64 Files\lib\Multi-threaded\antidebug.lib(Static Link Library)

3.1 Programme Design

    (1) Open “Microsoft Visual Studio 2008”,select “File | New | Project” menu command ,popup “New Project” window,select Project types:“Visual C++ | MFC”,select Templates:“Visual Studio installed templates |MFC Application”,confirm the project's name is “antidebug_demo”,and select directory.

    (2) In the popup “MFC Application AppWinzard - Application Type” dialog box,select the type of application to “Single document”.

    (3) The follow steps,keep the default setting,at last click [Finish] button.

    (4) Add two menu command:"Display Hello World !" and "Display Hello AntiDebug !"

Show illustration

    (5) Map menu command function by Event Handler Wizard:
          void CAntidebug_demoDoc::OnDisplayHelloWorld().
          void CAntidebug_demoDoc::OnDisplayHelloAntidebug().

           Insert the following code:

Show Code

    (6) After finished,antidebug_demo can display two MessageBox :"Hello World ! " and "Hello AntiDebug ! ",it's free and no License.

 3.2 Encrypte Programme

    (1) Copy antidebug.h and antidebug.lib into the antidebug_demo project directory(\antidebug_demo\).

    (2) Select “Project | Protertys” menu command,Only set "Win32 Release" .

          Add "antidebug.lib setupapi.lib NETAPI32.LIB" into Linker's input Additional Dependencies edit box.

Show illustration

          Set "Buffer Security Check" to "NO(/GS)" .

Show illustration
          Set "Data Execution Prevention(DEP)" to "Default".

Show illustration

          Set "Randomized Base Address" to "Disable Image Randomization ".

Show illustration

          Set "UAC Execution Level " to "requireAdministrator".

Show illustration

    (3) Add codes into antidebug_demoDoc.h file:

Show Code

    (4) Add codes into antidebug_demoDoc.cpp file:

Show Code

    (5) Revise non-sharing function code .

Show Code

    (6) Select “Build | Rdbuild Solution” menu command to encrypt the antidebug_demo.Now,if you want to display "Hello AntiDebug !" MessageBox,must have the License which is generated by ADL_register.exe.

    (7) Custom Function

      As to the very important key codes ,we recommend you strongly to use AntiDebugLIB's custom function to create self-engendered functions quickly,then the key codes become a secret except you.

      There are three functions offered by AntiDebugLIB can do this job:

            GJ_encrypt_custom_function.
            GJ_load_custom_founction.
            GJ_free_custom_founction.

      GJ_encrypt_custom_function (or GJ_encrypt_custom_function_demo) is only used in another private project,the custom function is debuged and encrypted in that project.When GJ_encrypt_custom_function (or GJ_encrypt_custom_function_demo) return TRUE,it will generate "founction_name.h" file.The encrypted code of custom function is included in it.Then include this header file into the releasing project,invoke GJ_load_custom_founction (or GJ_load_custom_founction_demo) to decrypt the custom function code and execute,when the custom function is not invoked again,invoke GJ_free_custom_founction to clear the code of custom function.

      Now,we create another project named custom_function_demo in the same way just like antidebug_demo project does. The void __stdcall custom_function(...) function is the function that we want to encrypt.We can invoke void encrypt_custom_function() function to encrypt it and get a custom_function.h file which includes the encrypted code of custom_function(...).

Show void __stdcall custom_function() and void encrypt_custom_function() Code
            After we get the custom_function.h,we insert the clause #include "..\\antidebug_demo\\custom_function_demo\\custom_function.h" into antidebug_demoDoc.cpp which belongs to antidebug_demo project.
Show custom_function.h Code
Show CUSTOM FUNCTION TEST Code
                    For more information please refer to Atidebug_demo demo programme and Programming Self-generating Code for Windows Applications.           

Programming Self-generating Code for Windows Applications.--Executing VC++ codes in STACK or HEAP

.

    (8) Encryption Macro

            There are four encryption macros to help the developers encrypt their code rapidly.
            Only Registered Version supports the encryption macro
.

GJ_MACRO_INIT GJ_MACRO_END
GJ_ONCE_CODE_START GJ_ONCE_CODE_END
GJ_ENCRYPT_CODE_START GJ_ENCRYPT_CODE_END
GJ_ENCRYPT_CODE_WITH_LIC_START GJ_ENCRYPT_CODE_WITH_LIC_END

Show GJ_MACRO_INIT, GJ_MACRO_END Example Code
Show GJ_ONCE_CODE_START,GJ_ONCE_CODE_END Example Code
Show GJ_ENCRYPT_CODE_START,GJ_ENCRYPT_CODE_END Example Code
Show GJ_ENCRYPT_CODE_WITH_LIC_START,GJ_ENCRYPT_CODE_WITH_LIC_END Example Code

Show Usage of Encryption Macro

        For more information please refer to Atidebug_demo demo programme.

    (9) Insert some essential codes into Antidebug_demo's about dialog window for user to create the Serial Number expediently.

Show Code

    (10) At last antidebug_demo.exe should be Encrypted by Eagle Protector.

        Finally,Antidebug_demo can display three MessageBox :one free "Hello World ! " MessageBox, two non-free "Hello AntiDebug ! "and "Hello Cuntom function ! "MessageBox.
        Now,you can distribute trial versions of your applications with gjglly.sys securely.

        We recommend using Start_ADL_Register start your main program in order to give user a better experience. You can change Start_ADL_Register  name as you like. You can download Start_ADL_Register sourcecode from our website.
        NOTE:You must copy "C:\Windows\System32\bcdedit.exe" file to your own install directory for win64 version program.You can refer to our installation directory.

4.Gengerate License


    (1) Paste the Serial Number copyed from user's antidebug_demo's about dialog window into the ADL Register Serial Number Edit box.
    (2) Select antidebug_append.dat file for Appending Data.
    (3) Click <Generate ADL DEMO LICENSE> button.
    (4) Save As the LICENSE data into antidebuglib_demo.lic file and email it to the user.

5.End

    Above-mentioned antidebug_demo programme demonstrates the basic process and frame about how to use AntiDebug LIB to encrypt and protect application. If you have any technical problems using AntiDebug LIB or need a special feature to be included in a next release, please feel free to contact us at 86029535@qq.com,MSN:and leave your most valuable comments and suggestions. You can download the latest version of our products from http://www.antidebuglib.com.

Buy Now | Contact Us | ©2006- AntiDebugLIB International Inc All Rights Reserved