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 


How to do code injection in C++

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
wulfcare
Advanced Cheater
Reputation: 0

Joined: 27 Feb 2023
Posts: 59

PostPosted: Mon Mar 27, 2023 1:44 pm    Post subject: How to do code injection in C++ Reply with quote

Hey guys,

How can I achieve the following code in C++? I believe I need to use VirtualAllocEx and I am aware that I cannot use __asm in 64-bit processes. However, I am looking for general guidance and suggestions for functions that I can use to accomplish this. Although I do not require any code to be written for me, I am wondering if WriteProcessMemory is my only option for this task.

Code:
alloc(newmem,2048,"game.exe"+165D88)
label(returnhere)
label(originalcode)
label(exit)

// Define a variable to store the value
alloc(value, 8)

newmem:
  // Save the value from R13+88 into R10
  mov r10,[r13+00000088]

  // Store the value from R10 into the variable
  mov [value], r10

  // Jump back to the original code
  jmp originalcode

originalcode:
  // Continue with the original code
  mov r10,[r13+00000088]

exit:
  jmp returnhere

"game.exe"+165D88:
  jmp newmem
  nop 2
returnhere:
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