'---------------------------------------------------------------------------------------
' Module    : mBeingDebugged
' Author    : Karcrack
' Now$      : 23/08/2009  18:42
' Used for? : Know if being debugged
' Reference :
'           http://www.codeproject.com/KB/security/AntiReverseEngineering.aspx
' Tested On :
'       - OllyDbg 1/2
'---------------------------------------------------------------------------------------

Option Explicit
'NTDLL
Private Declare Function NtQueryInformationProcess Lib "ntdll.dll" (ByVal hProcess As Long, ByVal ProcessInformationClass As Long, ProcessInformation As Any, ByVal ProcessInformationLength As Long, ReturnLength As Long) As Long

Public Function ImBeingDebugged() As Boolean
    Call NtQueryInformationProcess(-1, &H1E, ImBeingDebugged, ByVal 4, ByVal 0&)
End Function