View previous topic :: View next topic |
Author |
Message |
tdr2012 Cheater
Reputation: 0
Joined: 02 Nov 2014 Posts: 26
|
Posted: Sat Nov 07, 2015 1:11 pm Post subject: Cannot get address from symbol name |
|
|
Code: |
shared=allocateSharedMemory("shared", 500)
registerSymbol("shared", shared)
getAddress("shared", true)
|
Whenever I use the method getAddress("shared", true), it returns this error message: Error:Failure determining what shared means
What I am trying to do is just read the address in which the string symbol "shared" contains. This should work, shouldn't it? Or am I missing something?
|
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Nov 07, 2015 1:32 pm Post subject: |
|
|
Are you sure you're not really looking for this?
Code: | autoAssemble("globalalloc(shared,500)") |
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 150
Joined: 06 Jul 2014 Posts: 4656
|
Posted: Sat Nov 07, 2015 1:33 pm Post subject: |
|
|
Leave off the true parameter on that getAddress(...) function, or just use false (the default value).
If you have that parameter set to true, then it tries to find the local symbols and module names in CE itself. From main.lua:
Quote: | getAddress(string, local OPTIONAL): ...set Local to true if you wish to querry the symboltable of the ce process
...
allocateSharedMemory(name, size): ...It then maps this shared memory block into the currently targeted process. |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
tdr2012 Cheater
Reputation: 0
Joined: 02 Nov 2014 Posts: 26
|
Posted: Sat Nov 07, 2015 1:53 pm Post subject: |
|
|
Zanzer wrote: | Are you sure you're not really looking for this?
Code: | autoAssemble("globalalloc(shared,500)") |
|
Wow, yes, this is how I should have done it in the first place. Now, its correctly getting the address without error.
But, now, when I get the address and print out the address using:
Code: |
autoAssemble([[globalalloc(shared,2000)]])
print(getAddress("shared"))
|
It prints out an address of 122880000, instead of the correct address 07530000 that the symbol "shared" holds.
Is there a way that this can be a 1:1 match? Do I need to parse 122880000 into a certain way?
|
|
Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 150
Joined: 06 Jul 2014 Posts: 4656
|
Posted: Sat Nov 07, 2015 2:00 pm Post subject: |
|
|
Code: | print(string.format("%X",getAddress("shared"))) |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
 |
tdr2012 Cheater
Reputation: 0
Joined: 02 Nov 2014 Posts: 26
|
Posted: Sat Nov 07, 2015 2:21 pm Post subject: |
|
|
ParkourPenguin wrote: | Leave off the true parameter on that getAddress(...) function, or just use false (the default value).
If you have that parameter set to true, then it tries to find the local symbols and module names in CE itself. From main.lua:
Quote: | getAddress(string, local OPTIONAL): ...set Local to true if you wish to querry the symboltable of the ce process
...
allocateSharedMemory(name, size): ...It then maps this shared memory block into the currently targeted process. |
|
Ah. Yes, I was a bit confused about this when I was reading it over. Thanks for making it clear for me.
ParkourPenguin wrote: | Code: | print(string.format("%X",getAddress("shared"))) |
|
Thanks a lot for this. It's now matching 1:1.
|
|
Back to top |
|
 |
|