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 


[Q] Memory Writing ..

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
mOnSoOn
Expert Cheater
Reputation: 0

Joined: 05 Jul 2007
Posts: 203

PostPosted: Tue Oct 20, 2009 5:19 pm    Post subject: [Q] Memory Writing .. Reply with quote

Hi,

I stopped programming like 8 month ago and I forogt a lot. Anyway,
I want to inject my dll to a process (which is something I know). After the dll injected I want to write the process I injected memroy through the dll.

How can I write FROM the dll to the process' memory?

Another question...
Is there anyway to open from the dll (that injected) a form with some lists that I can add to them things from the process (which includes reading from the process...)?

thanks Smile
Back to top
View user's profile Send private message MSN Messenger
igoticecream
Grandmaster Cheater Supreme
Reputation: 0

Joined: 23 Apr 2006
Posts: 1807
Location: 0x00400000

PostPosted: Tue Oct 20, 2009 8:42 pm    Post subject: Reply with quote

Since you are in the context of the target process memory, you can do things like

*(DWORD*)0xBADFOOD = 0x90909090;

you are writting four nops at address 0xBADFOOD, of course 0xBADFOOD belongs to the target process memory

_________________
+~
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Oct 20, 2009 10:21 pm    Post subject: Re: [Q] Memory Writing .. Reply with quote

mOnSoOn wrote:
How can I write FROM the dll to the process' memory


you can just use a pointer to it or use memcpy, dead simple.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Oct 21, 2009 3:13 am    Post subject: Reply with quote

igoticecream wrote:
Since you are in the context of the target process memory, you can do things like

*(DWORD*)0xBADFOOD = 0x90909090;

you are writting four nops at address 0xBADFOOD, of course 0xBADFOOD belongs to the target process memory


don't forget to make the memory writable first

_________________
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
igoticecream
Grandmaster Cheater Supreme
Reputation: 0

Joined: 23 Apr 2006
Posts: 1807
Location: 0x00400000

PostPosted: Wed Oct 21, 2009 5:57 am    Post subject: Reply with quote

Dark Byte wrote:
igoticecream wrote:
Since you are in the context of the target process memory, you can do things like

*(DWORD*)0xBADFOOD = 0x90909090;

you are writting four nops at address 0xBADFOOD, of course 0xBADFOOD belongs to the target process memory


don't forget to make the memory writable first


Yea, sometimes the code section is not writeable and you may find exeption 0xc0000005. Use virtualprotect

_________________
+~
Back to top
View user's profile Send private message
mOnSoOn
Expert Cheater
Reputation: 0

Joined: 05 Jul 2007
Posts: 203

PostPosted: Wed Oct 21, 2009 8:06 am    Post subject: Reply with quote

Thanks..

edit:
If I want to hook something like not just changing the address' aobs.

Code:
004D1E22:
jmp lolFunc

void __declspec (naked) lolFunc(int s)
{
  _asm
  {
    mov eax,ebx
    jmp 004D1E24
  }
}

How can I do something like this? Do I need to caclculates the lolFunc aobs or something?

If anyone got a dll source that hooks in an adress and change some addresses, It would be helpful!!
Thanks.
Back to top
View user's profile Send private message MSN Messenger
igoticecream
Grandmaster Cheater Supreme
Reputation: 0

Joined: 23 Apr 2006
Posts: 1807
Location: 0x00400000

PostPosted: Wed Oct 21, 2009 8:47 pm    Post subject: Reply with quote

#define JMP(frm, to) (int)(((int)to - (int)frm) - 5)

*(BYTE *)Address = 0xE8;
*(DWORD*)(Address+1) = JMP(Address,SCRIPT);

notice that 0xE8 represent a call, the jmp byte is 0xE9

_________________
+~
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Thu Oct 22, 2009 8:55 am    Post subject: Reply with quote

Code:
_asm

jmp (opcode)



doesnt compile
Back to top
View user's profile Send private message
Guy
Expert Cheater
Reputation: 0

Joined: 30 May 2009
Posts: 187

PostPosted: Thu Oct 22, 2009 12:39 pm    Post subject: Reply with quote

NoMercy wrote:
Code:
_asm

jmp (opcode)



doesnt compile


Use the MASM-syntax:

Code:

__asm {
 JMP DWORD PTR [EAX]
}


Jumping to where EAX points to.

Code:

__asm {
 JMP EAX
}


Jumping to the value stored in EAX.



Though, note, by using inline ASM with MSVS, you're removing x64-compatibility. I recommend injecting shellcode, or using Windows API functions, or even the MSVS-exclusive Intrinsics.

_________________
Has anyone seen Hitler around..? If so, PM me!
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 programming 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