GetProcAddress Usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • huckjam
    New Member
    • Mar 2008
    • 1

    GetProcAddress Usage

    Well I have this code so far:
    Code:
    Public Declare Function GetProcAddress Lib "kernel32" (ByVal ModuleHandle As Integer, ByVal ProcName As String) As Integer
    Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
    Public Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
    
    Dim xCreateProcess As Long
    Dim xWriteProcessMemory As Long
    Dim xReadProcessMemory As Long
    Dim xVirtualAllocEx As Long
    Dim xVirtualProtectEx As Long
    
    Private Sub LoadAPIs()
     Dim xHandle As Long
     xHandle = LoadLibrary("kernel32.dll")
      xCreateProcess = GetProcAddress(xHandle, "CreateProcessA")
      xWriteProcessMemory = GetProcAddress(xHandle, "WriteProcessMemory")
      xReadProcessMemory = GetProcAddress(xHandle, "ReadProcessMemory")
      xVirtualAllocEx = GetProcAddress(xHandle, "VirtualAllocEx")
      xVirtualProtectEx = GetProcAddress(xHandle, "VirtualProtectEx")
     FreeLibrary (xHandle)
    End Sub
    In Delphi this would make etc. xCreateProcess work like CreateProcess.
    How would I get this working in VB6?
Working...