| View previous topic :: View next topic |
| Author |
Message |
bismult Cheater
Reputation: 0
Joined: 09 Mar 2022 Posts: 27
|
Posted: Fri Jan 05, 2024 1:34 am Post subject: Allocating memory when hooked into Physical Memory |
|
|
| I'm trying to make a script work when connected to Physical Memory, but every time I try to enable it, I get the following error: Failure allocating memory near XXXXXX. I've tried allocating nonpaged memory and specifying that location with the third parameter of alloc(), kalloc() in the auto assembler, and even globallalloc(). Everything results in the game either crashing or populating the aforementioned error. Any tips on how to fix this?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Fri Jan 05, 2024 3:02 am Post subject: |
|
|
memory addressing is relative to virtual memory, not physical memory. A physical address has no meaning to assembler code
you'll have to hook in the physical memory into the pagetale system of the target process and then use that entry to get the virtual address
_________________
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 |
|
 |
bismult Cheater
Reputation: 0
Joined: 09 Mar 2022 Posts: 27
|
Posted: Fri Jan 05, 2024 8:40 pm Post subject: |
|
|
| Dark Byte wrote: | memory addressing is relative to virtual memory, not physical memory. A physical address has no meaning to assembler code
you'll have to hook in the physical memory into the pagetale system of the target process and then use that entry to get the virtual address |
The virtual address is not the issue; I'm able to find that easily. The issue is that I'm not able to edit the memory region around that virtual address. When hooking into Physical Memory, I'm able to then edit the address along with the region around it. I'm only not able to allocate memory when hooked into Physical Memory.
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Sat Jan 06, 2024 5:49 am Post subject: |
|
|
Can you open the process normally and allocate memory in there before switching to the physical memory?
Otherwise you'll still have to find out the pagetables for this process and fill in the physical memory address yourself for the virtual address you like
_________________
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 |
|
 |
bismult Cheater
Reputation: 0
Joined: 09 Mar 2022 Posts: 27
|
Posted: Sat Jan 06, 2024 7:42 pm Post subject: |
|
|
| Dark Byte wrote: | | Can you open the process normally and allocate memory in there before switching to the physical memory? |
Yes, I believe so.
|
|
| Back to top |
|
 |
bismult Cheater
Reputation: 0
Joined: 09 Mar 2022 Posts: 27
|
Posted: Mon Jan 08, 2024 7:16 pm Post subject: |
|
|
| Dark Byte wrote: | | Can you open the process normally and allocate memory in there before switching to the physical memory? |
I was doing some testing with this, but the game keeps on crashing every time I enable the actual function of the script. Luckily, I'm able to allocate memory in the process normally before hooking into physical memory. Is there something I'm missing?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Tue Jan 09, 2024 12:31 am Post subject: |
|
|
Is the jmp instruction correct?
(You can't let CE generate the bytes for the jmp for you, you'll have to calculate it yourself based on the virtual address origin and virtual address destination (CE would pick the physical address origin which would be wrong)
or do a 14 byte 'jmp far as those are independent on location
_________________
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 |
|
 |
bismult Cheater
Reputation: 0
Joined: 09 Mar 2022 Posts: 27
|
Posted: Tue Jan 09, 2024 1:53 am Post subject: |
|
|
| Dark Byte wrote: | Is the jmp instruction correct?
(You can't let CE generate the bytes for the jmp for you, you'll have to calculate it yourself based on the virtual address origin and virtual address destination (CE would pick the physical address origin which would be wrong)
or do a 14 byte 'jmp far as those are independent on location |
14 byte jmp's cause me to crash as well. Since I can't allocate memory when hooked into physical memory, I'm hooking into the game, allocating memory at the physical address location, then hooking back into physical memory to activate the script. Is this causing issues?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25807 Location: The netherlands
|
Posted: Tue Jan 09, 2024 5:29 am Post subject: |
|
|
don't forget the jmp back to the original code as well as the jmp from the physical address will be different
and your code isn't going to jump to the physical address of the allocated memory but it has to jump to the virtual address
_________________
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 |
|
 |
bismult Cheater
Reputation: 0
Joined: 09 Mar 2022 Posts: 27
|
Posted: Tue Jan 09, 2024 1:45 pm Post subject: |
|
|
| Dark Byte wrote: | don't forget the jmp back to the original code as well as the jmp from the physical address will be different
and your code isn't going to jump to the physical address of the allocated memory but it has to jump to the virtual address |
So I have to allocate memory near the virtual address, hook into physical memory and jmp to the virtual address of the allocated memory, execute the code, and jmp back to the physical address?
|
|
| Back to top |
|
 |
|