[Process Dumpen]Übersetzten von Vb.net zu Vb6

dr_pepper

Mitglied
Hey,
Ich bräuchte mal wieder etwas hilfe...
diesmal geht es darum, dass ich einen vb.net code in vb6 übersetzten möchte.

Vb.net Code:click me



soweit wie ich mit vb6 gekommen bin (könnte auch gut sein das man darin den ein oder anderen fehler findet...)
---->:

Visual Basic:
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function VirtualQueryEx Lib "kernel32" (ByVal hProcess As Long, lpAddress As Any, lpBuffer As MEMORY_BASIC_INFORMATION, ByVal dwLength As Long) As Long

Private Declare Function Process32First Lib "kernel32" (ByVal hSnapshot As Long, lppe As Processentry32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapshot As Long, lppe As Processentry32) As Long

Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Const PROCESS_VM_READ As Integer = &H10
Private Const TH32CS_SNAPPROCESS = &H2&

Private Type Processentry32
    dwSize As Long
    cntUsage As Long
    th32ProcessID As Long
    th32DefaultHeapID As Long
    th32ModuleID As Long
    cntThreads As Long
    th32ParentProcessID As Long
    pcPriClassBase As Long
    dwFlags As Long
    szExeFile As String * 260
End Type

Private Type MEMORY_BASIC_INFORMATION32
    BaseAdress As Interger
    AllocationBase As Integer
    AllocationProtect As Integer
    RegionSize As Integer
    State As Integer
    Protect As Integer
    lType As Integer
End Type



Public Function DumpMem(ByVal Process As Long) As Byte()
    
    
        Dim Info As MEMORY_BASIC_INFORMATION32
        
        Dim bigbuffer            As Byte
        Dim addr                 As Interger
        Dim pId                  As Long
        Dim bytescaptured        As Integer
        Dim mybuf                As Byte
        Dim targetProcess        As Integer

        addr = &H10000
        
        
        
        pId = GetProcessId(Process)
        targetProcess = OpenProcess(PROCESS_VM_READ, 1, pId)
        
        Call VirtualQueryEx(targetProcess, addr, Info, Len(Info))
        mybuf = Info.RegionSize
        
    
End Function






Public Function GetProcessId(ProcName As String) As Long


    Dim pe32 As Processentry32
    
    Dim hSnapshot   As Long
    Dim Retn        As Long
    Dim bSuccess    As Boolean
    Dim bSuccess2   As Boolean


    pe32.dwSize = Len(pe32)
    hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
    
        If hSnapshot = 0 Or hSnapshot = -1 Then
            GetProcessId = 0
            Exit Function
        End If

    bSuccess = Process32First(hSnapshot, pe32)
    
        If bSuccess = False Then
            GetProcessId = 0
            Exit Function
        End If

    bSuccess2 = True
    
        Do While (bSuccess2)
            bSuccess2 = Process32Next(hSnapshot, pe32)
                If InStr(pe32.szExeFile, ProcName) Then
                    hProcess = OpenProcess(PROCESS_ALL_ACCESS, _
                    False, pe32.th32ProcessID)
                    GetProcessId = pe32.th32ProcessID
                    Exit Function
                End If
            Sleep (20)
        Loop
        
End Function

weiss jemand weiter?

wäre dankebar! :)


falls ich das lieber in die vb.net section posten sollte - sagt bescheid.

grüsse

dr.pepper
 
Zuletzt bearbeitet:
Zurück