Hi, I have the following issue.

I try to read the memory of processes that have their addresses over the maximum amount for a long of 32 bits (2,147,483,647)
of the style
"7FFFFFFFFFFFF"
which generates an overflow for a long variable in vb6.

I know we have this limitation in vb6 for long in 32 bits when trying to read 64 bit addresses, but I wonder if this can have a solution.

I leave an example code when reading the first character of my notepad (that if it would work for any process in 32 bits).

Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere 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 CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Private Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
Private Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Public Function ReadALong(Title As String, TheAddress As Long, TheValue As Long, bts As Long)
Dim WHwnd As Long
Dim GWTPI As Long
Dim SomeValue As Long
WHwnd = FindWindow(vbNullString, Title)
GetWindowThreadProcessId WHwnd, GWTPI
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, GWTPI)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem SomeValue, TheAddress, TheValue, bts, 0&
Text1 = TheValue
CloseHandle hProcess
End Function

Private Sub Command1_Click()
Call ReadALong("*Sin título: Bloc de notas", Val(1769725278928#), vbNull, 1)
End Sub
Name:  Test.jpg
Views: 343
Size:  35.5 KB

Regards!