[Delphi Tutorial] Anti Sandboxie and Debugger 05-31-2015, 10:57 PM
#1
Hello Reality Forums, I have the flu and so I am extremely bored. Today I will be showing you how to protect you program from possible crackers/hackers.
***Note: I am using the old Delphi 7 IDE, don't judge >
***
Step 1:![[Image: 54vs4yA.png]](http://i.imgur.com/54vs4yA.png)
Hopefully you are intelligent enough to click the OK button afterwards.
Step 2: Add to the uses, "Windows" (no quotes) add a semicolon after it so you don't get a syntax error.
Step 3: add the below codes BEFORE the main begin end.
Now that we have added our functions we just need to use them in the begin-end (the run-time part)
Step 4: Add the code below.
If you don't know, or are new to Delphi, basically we are calling the functions we used earlier, specifically Boolean type functions so they will return ether True or False. If your application has a GUI then you can call Application.Terminate; instead of Halt(0); See This Link for more information about the two.
Now your done! Your program can't be run in sandboxie or be debugged by someone trying to crack your program.
Your final code should look similar to this:
![[Image: jXPpNCP.png]](http://i.imgur.com/jXPpNCP.png)
If you have any questions please ask them. Thanks for wasting part of your life by reading this simple tutorial. :p
***Note: I am using the old Delphi 7 IDE, don't judge >
***Step 1:
![[Image: 54vs4yA.png]](http://i.imgur.com/54vs4yA.png)
Hopefully you are intelligent enough to click the OK button afterwards.
Step 2: Add to the uses, "Windows" (no quotes) add a semicolon after it so you don't get a syntax error.
Step 3: add the below codes BEFORE the main begin end.
Code:
function IsSandboxie: boolean;
begin
Result := GetModuleHandle(pchar('SbieDll.dll')) > 0;
end;
//*********************************
function DebuggerPresent : boolean;
type
TDebugProc = function : boolean;
stdcall;
var
Kernel32: HMODULE;
DebugProc: TDebugProc;
begin
Result := False;
Kernel32 := GetModuleHandle('kernel32');
if Kernel32<>0 then
begin
@DebugProc := GetProcAddress(Kernel32, 'IsDebuggerPresent');
if Assigned(DebugProc) then
Result := DebugProc
end;
end;Now that we have added our functions we just need to use them in the begin-end (the run-time part)
Step 4: Add the code below.
Code:
if IsSandboxie = ture then begin
Halt(0);
end;
if DebuggerPresent = true then begin
Halt(0);
end;If you don't know, or are new to Delphi, basically we are calling the functions we used earlier, specifically Boolean type functions so they will return ether True or False. If your application has a GUI then you can call Application.Terminate; instead of Halt(0); See This Link for more information about the two.
Now your done! Your program can't be run in sandboxie or be debugged by someone trying to crack your program.
Your final code should look similar to this:
![[Image: jXPpNCP.png]](http://i.imgur.com/jXPpNCP.png)
If you have any questions please ask them. Thanks for wasting part of your life by reading this simple tutorial. :p

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)