Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Failure allocating memory near "address". need hel

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 138

PostPosted: Sun Feb 05, 2023 12:05 pm    Post subject: Failure allocating memory near "address". need hel Reply with quote

hi. i have been using CE over 10 years and never had this issue before.
i made simple hacks for game that i play and saved the list. i have been playing for 3 days and table has worked just fine. game have not had any updates and its single player only.

today i load up the game and table as always and only 1 out of 5 hacks i made works, rest dont enable. CE freezes for few seconds and nothing happens.

so i manually searched for the instruction and used auto assembler > template > AOB injection (this is how i always write my hacks) and it auto-generates injectable code. i didn't modify it and pressed "execute"

then i get error "failure allocating memory near xxxxxxxx".



i then searched on google and found only 1 topic on ce forum about it, but it wasn't exactly same as my issue. someone there mentioned something about "mono game", which i have no idea about. never heard of this before, it must be some "next gen" memory allocation system or something?
anyway NOT important, at this point i'm not interested to learn what mono is.

i just wanted to say that in CE i enabled mono features and then the addresses in memory view changed. instead of .dll or .exe names, i now see game-related terms, like "helmetoff.gui" something.

so i thought i try once again with mono enabled and i repeated the first steps again. i used template and > AOB injection, it generates code and when i click on "execute" i now get this error:


code on image is generated by CE, why does it generate code that cannot be injected? i thought whole idea of template is that it generates fully working code like without mono features? is CE broken, is this some known bug?


all i need to know, is how to fix this. how can i inject my code again?
why was it working for 3 days and all the sudden it stops working?
i did notice that my RAM usage was around 92%, i'm not sure but i dont remember seeing it that high before when playing this game.
could it be that memory is simply full and that causes the error? if so, how do i bypass it? how can i force CE to free up memory?
please note that i'm not expert at coding so please dont say something like "write your code here > jump there > blah blah here > done". i need fully working example that i can copy, paste and then slightly modify. if i was expert programmer i would not be asking help here. thank you



e2.JPG
 Description:
 Filesize:  32.22 KB
 Viewed:  11276 Time(s)

e2.JPG



e1.jpg
 Description:
 Filesize:  19.5 KB
 Viewed:  11275 Time(s)

e1.jpg


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Sun Feb 05, 2023 2:09 pm    Post subject: Reply with quote

"Failure allocating memory near XXXX" sometimes (maybe most of the time?) means there's no free memory near that address. Go to Memory Viewer -> View -> Memory regions and see what's around that address.

See the final part of this post that says "In rare cases, `alloc` might fail..." for more information:
https://forum.cheatengine.org/viewtopic.php?t=620587

Post the code around the injection point if you want more help. (the big comment at the end of the AOB Injection template is good).

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25785
Location: The netherlands

PostPosted: Sun Feb 05, 2023 3:13 pm    Post subject: Reply with quote

for the je instruction being bad, try
Code:

js "HelmetGUI:OnChanged_Hunger"+64

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 138

PostPosted: Sun Feb 05, 2023 4:04 pm    Post subject: Reply with quote

ParkourPenguin wrote:
"Failure allocating memory near XXXX" sometimes (maybe most of the time?) means there's no free memory near that address. Go to Memory Viewer -> View -> Memory regions and see what's around that address.

See the final part of this post that says "In rare cases, `alloc` might fail..." for more information:
https://forum.cheatengine.org/viewtopic.php?t=620587

Post the code around the injection point if you want more help. (the big comment at the end of the AOB Injection template is good).


hmm, what should i use instead of alloc then?
also do you know or can you speculate why its been working for 3 days and now all the sudden it stopped working? there have not been any game updates and i havent updated CE either. just outta blue it stopped working and is giving me this error.

i will try the forced 14 byte jump you mentioned in that other post if it keeps giving me this error.
here's my entire script, but i highly doubt it helps cos as i said. it worked fine for 3 days and then stopped working. opcodes are same as game did not have update, on some reason injection just fails with the error shown above in my first post.

Code:
[ENABLE]

aobscan(findfood,18 48 8B 40 78 48 8B C8 83 39 00 F3 0F 10 40 20)
alloc(newmem,$1000,findfood)
alloc(_currentfood,8)
registersymbol(_currentfood)
label(return)

newmem:

push rbx
mov rbx,_currentfood
mov [rbx],rax
pop rbx
  movss xmm0,[rax+20]
  jmp return

findfood+0B:
  jmp newmem
return:
registersymbol(findfood)

[DISABLE]

findfood+0B:
  db F3 0F 10 40 20

unregistersymbol(findfood)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: 18A69888E71

18A69888E50: 55                       - push rbp
18A69888E51: 48 8B EC                 - mov rbp,rsp
18A69888E54: 48 83 EC 40              - sub rsp,40
18A69888E58: 48 89 75 F8              - mov [rbp-08],rsi
18A69888E5C: 48 8B F1                 - mov rsi,rcx
18A69888E5F: 48 8B 56 20              - mov rdx,[rsi+20]
18A69888E63: 48 8B 46 18              - mov rax,[rsi+18]
18A69888E67: 48 8B 40 78              - mov rax,[rax+78]
18A69888E6B: 48 8B C8                 - mov rcx,rax
18A69888E6E: 83 39 00                 - cmp dword ptr [rcx],00
// ---------- INJECTING HERE ----------
18A69888E71: F3 0F 10 40 20           - movss xmm0,[rax+20]
// ---------- DONE INJECTING  ----------
18A69888E76: F3 0F 5A C0              - cvtss2sd xmm0,xmm0
18A69888E7A: F2 0F 5A E8              - cvtsd2ss xmm5,xmm0
18A69888E7E: F3 0F 11 6D F4           - movss [rbp-0C],xmm5
18A69888E83: F3 0F 10 45 F4           - movss xmm0,[rbp-0C]
18A69888E88: F3 0F 5A C0              - cvtss2sd xmm0,xmm0
18A69888E8C: F3 0F 10 0D 7C 00 00 00  - movss xmm1,[18A69888F10]
18A69888E94: F3 0F 5A C9              - cvtss2sd xmm1,xmm1
18A69888E98: F2 0F 5E C1              - divsd xmm0,xmm1
18A69888E9C: 48 8B CE                 - mov rcx,rsi
18A69888E9F: F2 0F 10 D0              - movsd xmm2,xmm0
}


Dark Byte wrote:
for the je instruction being bad, try
Code:

js "HelmetGUI:OnChanged_Hunger"+64


thanks, will give it a go next time i play. its just bit confusing that CE would auto generate a template that cannot be compiled.


UPDATE: i just launched game to try and now it works again. what the freeking heck is going on? any idea what might cause this? i havent shut pc down for 2+ days. only other programs i have started and closed are game itself, CE and chrome. i have never had issues with CE not being able to inject stuff because i have differnet programs running on background.

game itself has been in development for like 4-5 years so i cant say its some new method to try and save ram. in fact this game eats more ram than anything else ive played, so perhaps bad coding? thanks again
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Sun Feb 05, 2023 5:00 pm    Post subject: Reply with quote

Memory layout is random. Helps protect against certain kinds of attacks.

That's not the same script. The injection point is completely different.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 138

PostPosted: Mon Feb 06, 2023 12:25 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Memory layout is random. Helps protect against certain kinds of attacks.

That's not the same script. The injection point is completely different.


memory layout is random? so that causes memory to be read only? i dont understand where you going at with this? RAM = random access memory, entire RAM is random to begin with, not related to my issue not being able to write into memory.

same script with what? this is the script that was working for 3 days and then stopped working and then started working again. what you mean same? same as your script? can i see your script please? maybe yours works better. thanks.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Mon Feb 06, 2023 2:29 pm    Post subject: Reply with quote

Do you know what a virtual address space is? If not, start with that.

By "memory layout is random", I mean memory will be allocated to a random address by default. In this case, sometimes there might be a small gap where CE can allocate memory, and sometimes there may not be.

This is the original code in your first post:
Code:
sbb [rax-75],cl
js "HelmetGUI:OnChanged_Hunger"+64
This is the original code in your second post:
Code:
movss xmm0,[rax+20]
Do you see how they're different?

If you want someone to do this work for you, you'll have better luck asking elsewhere. If you want to learn to do it yourself, it's going to take time and effort. Good luck.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 138

PostPosted: Tue Feb 07, 2023 12:01 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Do you know what a virtual address space is? If not, start with that.

By "memory layout is random", I mean memory will be allocated to a random address by default. In this case, sometimes there might be a small gap where CE can allocate memory, and sometimes there may not be.

This is the original code in your first post:
Code:
sbb [rax-75],cl
js "HelmetGUI:OnChanged_Hunger"+64
This is the original code in your second post:
Code:
movss xmm0,[rax+20]
Do you see how they're different?

If you want someone to do this work for you, you'll have better luck asking elsewhere. If you want to learn to do it yourself, it's going to take time and effort. Good luck.


no i dont know what it is, that's why i'm asking for help. i have hacked lot of games but i have never seen such mechanic ever before and this is not a new game. well its in early access, but its been in development since like 2016 or 2017. any ideas why this game is so different and weird?
its not even online game, it's single player. i think they plan on adding coop with friends, but nothing more.

surely they haven't made it to prevent cheating?
either way, how do i bypass it?

sry if you got confused about what i said. i said that i read some topic where someone mentioned "mono game" so i enabled mono features for testing purposes only and did the process again, but it still didn't work. its same exact code, one has mono enabled, other does not.

i have never used mono features before, it was just a test and not my code. it was never my code, it was a template auto generated by CE and it gave me an error. so i posted it as completely different issue from first as it developed due the first issue.i hope i have cleared the confusion for you now

id still like to know how do i bypass this random memory allocation thing? is there a way to allocate memory elsewhere? like force CE to allocate memory outside of game memory or it doesn't work this way? im just trying to fix the script. yesterday one cheat i made stopped working again, while others worked fine. i dont understand why this game uses some odd method. even some online games ive hacked dont have such complex mechanics. i would assume its to optimise the game, but game runs very bad, so clearly not part of optimisation. its so odd
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Tue Feb 07, 2023 12:39 pm    Post subject: Reply with quote

It seems to me like you want others to teach you how to fix this yourself, but you don't want to spend a lot of time learning and researching the relevant information. Again, if you want someone else to do this for you, be more direct about it and try asking elsewhere. i.e. a third party site:
https://forum.cheatengine.org/thirdparty.php

All the information you need is already available to you. Most of it being in this post:
https://forum.cheatengine.org/viewtopic.php?t=620587

The rest can be found by using a search engine.

As a brief overview: it's convenient if the memory CE allocates for a code injection is near the injection point. If there is no free memory near the injection point, that fails. Sometimes there might be free memory, other times there might not be. It's up to how Windows decides to randomly allocate memory.
Work around this by using `jmp far`. See the linked post.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 138

PostPosted: Fri Feb 10, 2023 11:54 am    Post subject: Reply with quote

ParkourPenguin wrote:
It seems to me like you want others to teach you how to fix this yourself, but you don't want to spend a lot of time learning and researching the relevant information. Again, if you want someone else to do this for you, be more direct about it and try asking elsewhere. i.e. a third party site:
https://forum.cheatengine.org/thirdparty.php

All the information you need is already available to you. Most of it being in this post:
https://forum.cheatengine.org/viewtopic.php?t=620587

The rest can be found by using a search engine.

As a brief overview: it's convenient if the memory CE allocates for a code injection is near the injection point. If there is no free memory near the injection point, that fails. Sometimes there might be free memory, other times there might not be. It's up to how Windows decides to randomly allocate memory.
Work around this by using `jmp far`. See the linked post.


i mean no disrespect, but i see programmers still acting big and mighty like always. im not a computer nerd who has time to sit behind pc 24/7. i came here to ask for help and you disrespect me only because you think you know it all. i would not be here if i wanted to waste months on learning how computers work

i dont even know where to place jmp far. i just know jmp stands for jump and it means code jumps to new location. i have no idea where i should place it in my code.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1069
Location: 0x90

PostPosted: Fri Feb 10, 2023 12:34 pm    Post subject: Reply with quote

mordax wrote:

i mean no disrespect, but i see programmers still acting big and mighty like always. im not a computer nerd who has time to sit behind pc 24/7. i came here to ask for help and you disrespect me only because you think you know it all. i would not be here if i wanted to waste months on learning how computers work

i dont even know where to place jmp far. i just know jmp stands for jump and it means code jumps to new location. i have no idea where i should place it in my code.


Firstly, it's quite disrespectful to imply that people who are knowledgeable in computing are nerds. People can learn about them without sitting in front of the computer 24/7. Even an hour a day over a period of time can help improve one's skills in computing. It still doesn't make them a nerd, only knowledgeable people.

Secondly, No one here has shown you disrespect at all. You think that because someone hasn't spoonfed the answer to you means it is disrespectful? You're wrong.

Thirdly, the people of this thread have asked that you put effort in as they have — that is a fair trade. Being put on the right path is something to be grateful for as no one here is obligated to take the time to reply to any question. They do so because they are kind people even if you think they are not.

Lastly, unless the replaced instructions exceed the required space the location of where you place the jump shouldn't change.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4697

PostPosted: Fri Feb 10, 2023 1:25 pm    Post subject: Reply with quote

mordax wrote:
i came here to ask for help and you disrespect me...
Any disrespect I'm showing you comes from you refusing the help you've been given.

mordax wrote:
i would not be here if i wanted to waste months on learning how computers work
That's fine. People have stuff going on in their life. Again, for the third time now, if you want someone else to do this for you, ask elsewhere. See the third party sites I linked in the previous post.

mordax wrote:
i dont even know where to place jmp far.
If only there were a tutorial that explains the problem and gives an example script as a solution... not like it's also being mentioned for the third time now.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites