home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Tools / ApiHooks 2.2 / examples / VB / NONSENS / Cap.bas < prev    next >
Encoding:
BASIC Source File  |  2000-04-09  |  1.0 KB  |  40 lines

  1. Attribute VB_Name = "MainModule"
  2. Option Explicit
  3.  
  4. Public Declare Function GetModuleHandle Lib "KERNEL32.dll" _
  5.     Alias "GetModuleHandleA" (ByVal Module As Any) As Long
  6.       
  7. Public ExcludeThem(5) As Long
  8. Public KnownBasDlls(4) As String
  9. Function GetFuncAddr(lpFuncAddr As Long) As Long
  10.  GetFuncAddr = lpFuncAddr
  11. End Function
  12. Function NewGetVersion() As Long
  13.  NewGetVersion = 9
  14. End Function
  15. Sub Main()
  16.  KnownBasDlls(0) = "cap.dll"
  17.  KnownBasDlls(1) = "apihooks.dll"
  18.  KnownBasDlls(2) = "msvbvm60.dll"
  19.  KnownBasDlls(3) = "ole32.dll"
  20.  KnownBasDlls(4) = "oleaut32.dll"
  21.  
  22.  Dim i As Long, j As Long
  23.  Dim hinst As Long
  24.  
  25.  For i = 0 To 4
  26.   hinst = GetModuleHandle(KnownBasDlls(i))
  27.   If hinst Then
  28.     ExcludeThem(j) = hinst
  29.     j = j + 1
  30.   End If
  31.  Next
  32.  ExcludeThem(j) = 0
  33.  
  34.  If HookApi("kernel32.dll", "GetVersion", HOOK_ALL, ALL_MODULES, 0&, GetFuncAddr(AddressOf NewGetVersion), 0&) = ErrorSuccess Then
  35.   MsgBox "GetVersion hooked!", vbOKOnly, "AH in VB"
  36.  Else
  37.   MsgBox "GetVersion not hooked!", vbOKOnly, "AH in VB"
  38.  End If
  39. End Sub
  40.