Jump to content
YOUR-AD-HERE
HOSTING
TOOLS

Locked [VB6] GetApi Pointer (LoadLibrary / GetProcAddress Replace)


dEEpEst

Recommended Posts

With this code you can for example the Apis (GetProcAddress, LoadLibrary) replace in your CallApiByName function.

 

[LENGUAJE=vb]Option Explicit

 

'MSVBVM60

Private Declare Function DllFunctionCall Lib "MSVBVM60" (ByRef typeAPI As tAPICall) As Long

 

Private Type tAPICall

ptsLIB As Long ' Pointer to ANSI String that contains Library

ptsProc As Long ' Pointer to ANSI String that contains Procedure

lReserved As Long ' Just reserved...

lPointer As Long ' Pointer to the buffer that will contain temp variables from DllFunctionCall

lpBuffer(3) As Long ' Buffer that will contain temp variables

End Type

 

Public Function GetAPIPtr(ByVal sLib As String, ByVal sProc As String) As Long

Dim tAPI As tAPICall

Dim bvLib() As Byte

Dim bvMod() As Byte

 

Call Unicode2ANSI(sLib, bvLib)

Call Unicode2ANSI(sProc, bvMod)

 

With tAPI

.ptsLIB = VarPtr(bvLib(0))

.ptsProc = VarPtr(bvMod(0))

.lReserved = &H40000

.lPointer = VarPtr(.lpBuffer(0))

End With

 

GetAPIPtr = DllFunctionCall(tAPI)

End Function

 

'COBEIN (=

Private Sub Unicode2ANSI(ByVal sUNICODE As String, ByRef bvANSI() As Byte)

Dim i As Long

 

ReDim bvANSI(Len(sUNICODE))

For i = 1 To Len(sUNICODE)

bvANSI(i - 1) = Asc(Mid$(sUNICODE, i, 1))

Next i

End Sub[/LENGUAJE]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.