Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15243

TrickAdvancedTools

$
0
0
Thanks Trick for the hooking function of these API. I added a few more by guessing.

Is there any way to list the parameters for these procedures, from the vba6 dll module?
For example I guessed that SetModuleName had a param for the name, and it works, but otherwise it crashes with any other params. Thanks again!
Code:

  pfnTipSetModuleName = GetProcAddress(hVba, "TipSetModuleName")
  If pfnTipSetModuleName = 0 Then Exit Function
  If Not HookFunction(pfnTipSetModuleName, AddressOf TipSetModuleName_user) Then
      Exit Function
  End If
  pfnTipDeleteModule = GetProcAddress(hVba, "TipDeleteModule")
  If pfnTipDeleteModule = 0 Then Exit Function
  If Not HookFunction(pfnTipDeleteModule, AddressOf TipDeleteModule_user) Then
      Exit Function
  End If
  pfnTipCompileModule = GetProcAddress(hVba, "TipCompileModule")
  If pfnTipCompileModule = 0 Then Exit Function
  If Not HookFunction(pfnTipCompileModule, AddressOf TipCompileModule_user) Then
      Exit Function
  End If

Code:

Public pfnTipCompileModule      As Long
Public pfnTipSetModuleName      As Long
Public pfnTipDeleteModule        As Long
Public Function TipSetModuleName_user(ByVal pVBProjectNative As Long, ByVal lpName As Long) As Long '
  On Error GoTo error_handler
  PauseHook pfnTipSetModuleName
 
  TipSetModuleName_user = CallByPointer(pfnTipSetModuleName, vbLong, pVBProjectNative, lpName)
 
  ResumeHook pfnTipSetModuleName
  Exit Function
error_handler:
  ErrorLog "modCallBack::TipSetModuleName_user"
End Function
Public Function TipDeleteModule_user(ByVal pVBProjectNative As Long) As Long '
  On Error GoTo error_handler
  PauseHook pfnTipDeleteModule

  MsgBox " deleting module: " & " " & pfnTipDeleteModule

  TipDeleteModule_user = CallByPointer(pfnTipDeleteModule, vbLong, pVBProjectNative)

  ResumeHook pfnTipDeleteModule
  Exit Function
error_handler:
  ErrorLog "modCallBack::TipDeleteModule_user"
End Function
Public Function TipCompileModule_user(ByVal pVBProjectNative As Long) As Long
  On Error GoTo error_handler
  PauseHook pfnTipCompileModule
  ' MakeEvent pVBProjectNative, "CompBefore"
  TipCompileModule_user = CallByPointer(pfnTipCompileModule, vbLong, pVBProjectNative)
 
  MsgBox " compile Module: " & TipCompileModule_user
 
  'MakeEvent pVBProjectNative, "CompAfter"
  ResumeHook pfnTipCompileModule
  Exit Function
error_handler:
  ErrorLog "modCallBack::TipCompileModule_user"
End Function


Viewing all articles
Browse latest Browse all 15243

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>