Firehacker or Trick, how do I use TipGetArgCount? If we can get the number of parameters the entire VBA6.dll processing can be monitored in one automated swoop.
I started to document some of these as you can see. They can also be neatly exposed as events for a useful extensibility addin without the limitation that existing object model yields.
Play the video slowly to see more detail in HD.
I used something like this to create the code seen in the video above (semi-automated):
This method works relatively well but takes some trial and error/crashes only because the number of parameters is simply unknown.Code:Public Sub DynamicInterface() On Error Resume Next Dim i As Long Dim txt As String Dim mcode As String Dim s() As String ReDim s(0) Open App.Path & "\eb.txt" For Input As #1 Dim inp As String Do While Not EOF(1) Line Input #1, inp ' Your code here ReDim Preserve s(UBound(s) + 1) s(UBound(s)) = inp Loop Close #1 MsgBox UBound(s) For i = 1 To UBound(s) txt = s(i) 'Public pfnTipFinishExe2 As Long mcode = mcode & "Public pfn" & txt & " As Long" & vbCrLf Next mcode = mcode & vbCrLf For i = 1 To UBound(s) txt = s(i) ' cHook.UnhookFunction pfnTipMakeExe2 mcode = mcode & "cHook.UnhookFunction pfn" & txt & vbCrLf Next mcode = mcode & vbCrLf For i = 1 To UBound(s) txt = s(i) mcode = mcode & "pfn" & txt & " = apiGetProcAddress(hVba, " & Chr(34) & txt & Chr(34) & ")" & vbCrLf mcode = mcode & "If pfn" & txt & " = 0 Then Exit Function" & vbCrLf mcode = mcode & "If cHook.HookFunction(pfn" & txt & ", AddressOf " & txt & "_user) = False Then" & vbCrLf mcode = mcode & " Exit Function" & vbCrLf mcode = mcode & "End If" & vbCrLf Next mcode = mcode & vbCrLf For i = 1 To UBound(s) txt = s(i) mcode = mcode & "Public Function " & txt & "_user(ByVal pVBProjectNative As Long, ByVal lUnused1 As Long, ByVal lUnused2 As Long, ByVal lUnused3 As Long, ByVal lUnused4 As Long) As Long" & vbCrLf mcode = mcode & " 'cHook.PauseHook pfn" & txt & vbCrLf mcode = mcode & " writelog " & Chr(34) & txt & Chr(34) & " " & Chr(38) & " pVBProjectNative " & Chr(38) & " lUnused1 " & Chr(38) & " lUnused2 " & Chr(38) & " lUnused3 " & Chr(38) & " lUnused4" & vbCrLf mcode = mcode & " " & txt & "_user = cHook.CallByPointer(pfn" & txt & ", vbLong, pVBProjectNative, lUnused1, lUnused2, lUnused3, lUnused4)" & vbCrLf mcode = mcode & " 'cHook.ResumeHook pfn" & txt & vbCrLf mcode = mcode & "End Function " & vbCrLf Next Clipboard.SetText (mcode) End Sub




Reply With Quote