Modulo
Código: Seleccionar todo
'---------------------------------------------------------------------------------------
' Module : mDebugDetect
' DateTime : 02/10/2008 20:26
' Author : Cobein
' Mail : [email protected]
' WebPage : http://www.advancevb.com.ar
' Purpose : Int 2Dh debugger detection
' Usage : At your own risk
' Requirements: None
' Distribution: You can freely use this code in your own
' applications, but you may not reproduce
' or publish this code on any web site,
' online service, or distribute as source
' on any media without express permission.
'
' History : 02/10/2008 First Cut....................................................
'---------------------------------------------------------------------------------------
Option Explicit
Private Declare Function SetUnhandledExceptionFilter Lib "kernel32" (ByVal lpTopLevelExceptionFilter As Long) As Long
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal adr As Long, ByVal p1 As Long, ByVal p2 As Long, ByVal p3 As Long, ByVal p4 As Long) As Long
Public bDebug As Boolean
Public Sub TestDebug()
On Error Resume Next
Static bInitialized As Boolean
If Not bInitialized Then
Call SetUnhandledExceptionFilter(AddressOf Handler)
bInitialized = True
End If
Dim bvASM(8) As Byte
bvASM(0) = &H58: bvASM(1) = &H59: bvASM(2) = &H59
bvASM(3) = &H59: bvASM(4) = &H59: bvASM(5) = &H50
bvASM(6) = &HCD: bvASM(7) = &H2D: bvASM(8) = &HC3
bDebug = True
Call CallWindowProc(VarPtr(bvASM(0)), 0, 0, 0, 0)
End Sub
Public Function Handler(ByRef ExPtrs As Long) As Long
bDebug = False: Handler = True
End Function
Código: Seleccionar todo
Option Explicit
Private Sub Command1_Click()
Call TestDebug
If mDebugDetect.bDebug Then
MsgBox "Debugued"
Else
MsgBox "Not Debugued"
End If
End Sub