vb.net readprocessmemory...windows7 64bit

12/28/2009 12:35 Unbenannt#1
Hi ich habe ein Problem mit der api funktion readprocessmemory...seitdem ich windows7 64bit drauf habe scheint die funktion nichtmehr zu funktionieren unter google habe ich gefunden, das man eine alte Kernel32.dll benutzen kann, was bei mir aber nicht funktioniert hat. Da ich aber gerade die api brauche müsste ich eine alternative/lösung finden...

How can i use the ReadProcessMemory-API in Windows7 64bit?


Quote:
Public Class Form1
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Public Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer

Public myProcesses As Process() = Process.GetProcessesByName("...")
Public processid As Integer = myProcesses(0).Id
Public processHandle = OpenProcess(16, True, processid)

Dim RestlicheHp As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ReadProcessMemory(processHandle, &H..., RestlicheHp, 4, 0)
MsgBox(RestlicheHp)
End Sub




End Class
01/07/2010 18:01 Chefes#2
bumb... i have the same problem
01/07/2010 21:08 ^darkwing#3
tried GetLastError() ? Maybe OpenProcess or RPM fails and you could see which error code & fix it.