Hello, I have the problem of reading and writing values ​​in addresses of a process of the type "7FFFFFFFFFFFF" that exceeds the maximum capacity of long

For this I use "ReadProcessMemory" and "writeProcessMemory", which does not present any problem for 32-bit processes. Since the LongLong datatype is not available for vb6, I have confirmed from vba that "ReadProcessMemory" and "writeProcessMemory" work using longlong with no problem.

Since I need to address this in vb6, I have found out that by using a "variant" and using "VariantChangeTypeEx" we can transform our data type to a longlong without problems (Verified with vartype = 20)

My problem is that in the declaration of the read write function I don't know how to carry the longlong transformed for lpBaseAddress.


If I try to declare it like this, vb6 closes.

"Private Declare Function ReadProcessMem Lib" kernel32 "Alias" ReadProcessMemory "(ByVal hProcess As Long, ByVal lpBaseAddress As Variant, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long"
Also in this way

"Private Declare Function ReadProcessMem Lib" kernel32 "Alias" ReadProcessMemory "(ByVal hProcess As Long, ByVal lpBaseAddress, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long"
Name:  Img3.jpg
Views: 698
Size:  37.7 KB

From vba (vb7) check that the previous statements do not make it work, however if we define it as longlong it works.

Name:  img2.jpg
Views: 661
Size:  31.6 KB
Name:  img1.jpg
Views: 707
Size:  32.8 KB

I found a class module that allows me to create longlong variables, but I also can't find a way to write the declaration as "lpBaseAddress as LongLong"
since it asks me to create the object and I can't use new on the same line.

Name:  Img4.jpg
Views: 719
Size:  23.1 KB

Could this have a solution? or another alternative to read and write values ​​to 64-bit process addresses that exceed the long.

Thanks!