vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Mails senden, abrufen und decodieren - ganz easy ;-)  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

Fortgeschrittene Programmierung
Re: Speicher auslesen 
Autor: Caron
Datum: 28.08.10 16:54

Ok gut und schön

ich habe meinen Code nun Modifiziert bzw neu geschrieben. Trotzdem bekomme ich nicht zum gewünschten Ergebniss. Vielleicht kannst du mir ja weiter helfen.

Private Const PROCESS_ALL_ACCESS As Long = &H1F0FFF
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As _
  Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As _
Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As _
Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, _
lpNumberOfBytesWritten As Long) As Long
Private Declare Function WriteString Lib "kernel32" Alias "WriteProcessMemory" ( _
ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, _
ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As _
Long
 
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal _
  lpClassName As String, ByVal lpWindowName As String) As Long
Public handle As Long
 
 
Private Function ReadMemory(hWnd As Long, Address As Long, Bytes As Long, _
  Optional strReplaceWith As String) As String
    'Runs For Not Unicode Strings (VB-Strings)
    On Error Resume Next
    Dim pId As Long        ' Used to hold the Process Id
    Dim pHandle As Long    ' Holds the Process Handle
    Dim bytValue As Long   'Stores the value of a byte in the memory
    Dim i As Long
    Dim Text As String
 
    ' Get the ProcId of the Window
    GetWindowThreadProcessId hWnd, pId
 
    ' use the pId to get a handle
    pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pId)
 
    If (pHandle = 0) Then
         'MsgBox "Unable to open process!"
         Exit Function
    End If
    If Address = 0 Then Exit Function
 
    For i = 1 To Bytes Step 2
       ' Read Byte to Byte
       ReadProcessMemory pHandle, Address + i - 1, bytValue, 1, 0&
       'value now contains the long value of the byte located in [Address + i - 
       ' 1] pos.
       'ReadMemory is a string...
 
       ReadMemory = ReadMemory & Chr$(bytValue)
    Next
    'to write numeric values you can ..(Must) use WriteValue API
    If LenB(strReplaceWith) <> 0 Then
        'No Unicode!!
        WriteString pHandle, Address, StrPtr(strReplaceWith), LenB( _
          strReplaceWith), 0&
    End If
    'Close the Handle
    CloseHandle pHandle
End Function
 
Private Sub Command1_Click()
 
handle = FindWindow(vbNullString, "Solitär")
 
Dim str As String
 
str = ReadMemory(handle, &HA9D28&, 500)
 
Label1.Caption = handle
Label2.Caption = str
 
End Sub
Starte ich das Programm und betätige den button, bekomme ich das handle ausgegeben aber nicht den Inhalt der Adresse.
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Speicher auslesen2.297Caron27.08.10 10:30
Re: Speicher auslesen1.791Benutzername27.08.10 19:10
Re: Speicher auslesen1.671Caron28.08.10 16:54
Re: Speicher auslesen1.674Benutzername29.08.10 00:08
Re: Speicher auslesen1.648Caron29.08.10 12:28
Re: Speicher auslesen1.647mst54729.08.10 14:02
Re: Speicher auslesen1.631Caron29.08.10 15:46
Re: Speicher auslesen1.670Zimmersofts03.09.10 13:19
Re: Speicher auslesen1.610Caron05.09.10 11:43
Re: Speicher auslesen1.608mst54705.09.10 12:46
Re: Speicher auslesen1.600Caron05.09.10 13:26
Re: Speicher auslesen1.611mst54705.09.10 15:40

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel