<< Click to Display Table of Contents >> Navigation: Themida > SecureEngine® Macros > CheckDebugger macro |
The CHECK_DEBUGGER macro checks if your application is running under a debugger.
NOTE: The current version of SecureEgine® does not support this macro for .NET languages or Visual Basic applications.
The CHECK_DEBUGGER macro can be called from inside other macros.
The CHECK_DEBUGGER macro has a special syntax:
CHECK_DEBUGGER (user_variable, user_value)
Where "user_variable" is any local or global variable in the application and "user_value" is any immediate value (constant value). The way that it works is the following:
•The CHECK_DEBUGGER macro is called.
•SecureEngine takes control of the processor and make special checks to know if your application is running under a debugger.
•If your application is not running under a debugger, SecureEngine sets "user_variable" equal to "user_value".
•If the application is running under a debugger, SecureEngine does not set "user_variable". You should take care of initializing "user_variable" to something else from "user_value".
•SecureEngine returns control to the protected application. The protected application should check the value of "user_variable" and execute the desired action if the application is running under a debugger.
int MyCheckVar;
VM_START
// your code goes here
CHECK_DEBUGGER(MyCheckVar, 0x12345678)
// your code goes here
if (MyCheckVar != 0x12345678) printf("Application is running under a debugger!");
VM_END |
var MyCheckVar: Integer;
begin
{$I VM_Start.inc}
// your code goes here
{$I CheckDebugger_Prolog.inc} asm push 11111111 // 11111111 is our special constant pop MyCheckVar // SecureEngine will set "MyCheckVar" to 11111111 if VMWare not present end; {$I CheckDebugger_Epilog.inc}
// your code goes here
if MyCheckVar <> 11111111 then ShowMessage("Application is running under a debugger!");
{$I VM_End.inc} |