Fandom

Visual Basic Wiki

AsmPatcher.bas/code

< AsmPatcher.bas

70pages on
this wiki
Add New Page
Talk0 Share

Attribute VB_Name = "AsmPatcher" Option Explicit

Private Declare Function GetSafeArrayAddress Lib "Kernel32" Alias "RtlMoveMemory" ( _

   Dest As Long, Source() As Long, ByVal Size As Long) As Long

Private Declare Function GetArrayDataAddress Lib "Kernel32" Alias "RtlMoveMemory" ( _

   Dest As Long, ByVal SafeArrayAdressPlus12 As Long, ByVal Size As Long) As Long
  1. If Not AsmPatcher_NoObj Then

Private Declare Function GetPointerToVtable Lib "Kernel32" Alias "RtlMoveMemory" ( _

   Dest As Long, ByVal Object As Object, ByVal Size As Long) As Long
  1. End If
  2. If Not AsmPatcher_NoAsm Then

Private Declare Function GetPointerToVtableAsm Lib "Kernel32" Alias "RtlMoveMemory" ( _

   Dest As Long, ByVal Object As Asm, ByVal Size As Long) As Long
  1. End If

Private Declare Function PointVtableEntryToArray Lib "Kernel32" Alias "RtlMoveMemory" ( _

   ByVal PointerToVtable As Long, FunctionPointer As Long, ByVal Size As Long) As Long
   
  1. If Not AsmPatcher_NoAsm Then

Public Asm As New Asm

Sub AsmFunction(ByVal Index As Long, Data() As Long) Dim A As Long, V As Long GetSafeArrayAddress A, Data, 4 GetArrayDataAddress A, A + 12, 4 GetPointerToVtableAsm V, Asm, 4 PointVtableEntryToArray 4 * Index + V + 24, A, 4 End Sub

  1. End If
  1. If Not AsmPatcher_NoObj Then

Sub AsmMethod(ByVal Object As Object, ByVal Index As Long, Data() As Long) Dim A As Long, V As Long GetSafeArrayAddress A, Data, 4 GetArrayDataAddress A, A + 12, 4 GetPointerToVtable V, Object, 4 PointVtableEntryToArray 4 * Index + V + 24, A, 4 End Sub

  1. End If

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.