Reading from memory

General FreeBASIC programming questions.
Post Reply
baddzs
Posts: 22
Joined: Jul 28, 2006 14:18

Reading from memory

Post by baddzs »

Hi!
I would like to read from memory, how can I do this in FB?
for ex: There are a program in memory with an integer, and I would like to read this int with another program.
Thanks!
Fragmeister
Posts: 545
Joined: Nov 08, 2005 14:36

Post by Fragmeister »

you'd need the memory address of the integer, and once you had it, you could do this (I think, it may or may not actually work)

Code: Select all

dim i as integer ptr
'set i to the memory address of that integer
print *i
'-or-
print i[0]
D.J.Peters
Posts: 8585
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

Hello baddzs
every running programm has its own virtual address space if prog A has an integer 100 on address 12345 an second prog b has it's own adress 12345 and can't read the value 100 from other prog.

You can use shareable memory but this are OS depended.

You can talk to an other program with pipes or sockets this are simple in FB and works on Lin and Win.

What do you will do with the address space from other program?

Joshy
baddzs
Posts: 22
Joined: Jul 28, 2006 14:18

Post by baddzs »

D.J.Peters wrote:Hello baddzs
every running programm has its own virtual address space if prog A has an integer 100 on address 12345 an second prog b has it's own adress 12345 and can't read the value 100 from other prog.

You can use shareable memory but this are OS depended.

You can talk to an other program with pipes or sockets this are simple in FB and works on Lin and Win.

What do you will do with the address space from other program?

Joshy
I would like to read the speed of my car from a racing simulator game (TOCA race drive) about 100times per sec. I have same other prog, and that can make a memory dump.(HwDirect).
Is it impossible in fb?
Thanks!
voodooattack
Posts: 605
Joined: Feb 18, 2006 13:30
Location: Alexandria / Egypt
Contact:

Post by voodooattack »

here:
http://www.freebasic.net/forum/viewtopi ... 38&start=0

you still need to know the address you want to read though :)
baddzs
Posts: 22
Joined: Jul 28, 2006 14:18

Post by baddzs »

voodooattack wrote:here:
http://www.freebasic.net/forum/viewtopi ... 38&start=0

you still need to know the address you want to read though :)
I don't understand this code, but thank you,
and how can i read from memory? X-)
voodooattack
Posts: 605
Joined: Feb 18, 2006 13:30
Location: Alexandria / Egypt
Contact:

Post by voodooattack »

if you choose the DLL injection method, you can access pointers normally:

Code: Select all

Const myWellKnownAddress as Integer = &H7777777

Dim myPtr as ubyte ptr = Cast(ubyte ptr, myWellKnownAddress)
*myPtr = 255
otherwise, you can simply use WriteProcessMemory() and ReadProcessMemory() to access the memory of the remote process :)

NOTICE: the address must be a well known address, and you need a memory editor to obtain it (by searching & sieving)
Cajaka
Posts: 21
Joined: Mar 26, 2006 3:31
Location: This space for rent

Post by Cajaka »

For help finding the address of the speed variable you would want to look up on the net how to make a ,"game trainer" I cann't seem to find the site I used last fall for doing that so i cann't point you to it. *edit* The site was hacked so its not long online http://www.extalia.com/home/index.php seems decent. *edit* I would suggest working with Artmoney to find the location in memory.

Also if anyone feels up to doing conversiont here is a VB 5/6 program template for making game trainers. I have no clue who the original author is but it was on the site I found last fall for public use.

http://www.geocities.com/rakhus2000/Tra ... mplate.zip *


Just out of personal curiosty why do you need access to the speed? Are you doing your own real world instument display, keeping record of how fast you went or is it somethig else?

* I do not plan to have this on my site that long.
Post Reply