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 


[Help] Memory Saver [Visual Basic 6.0]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed Jul 30, 2008 10:25 am    Post subject: [Help] Memory Saver [Visual Basic 6.0] Reply with quote

Don't Flame.
This program I made is suppose to be able to create a exe from the process in the memory that is identical to it.
I have included the program here.

So It basically loops through the memory and stores it into a byte array then saving it later. But after I checked the binary of the file I discover that the file length is different between the 2 files and some bytes are corrupt.

This is made in visual basic. So see if you can get this to work.

Oh sorry forgot to include source...



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.

Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Wed Jul 30, 2008 2:04 pm    Post subject: Reply with quote

It's because the PE loader has to fix the imports, fix relocation (if there is any) and align the sections. The .exe in the process is no where near the same as the image on disk.

In order to make a dump of the process you have to reverse all of those operations.
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed Jul 30, 2008 2:46 pm    Post subject: Reply with quote

Hmm. Guess I excluded alot of those things.Cause I only compared the first like 10 bytes... o.o
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Wed Jul 30, 2008 2:51 pm    Post subject: Reply with quote

dnsi0 wrote:
Hmm. Guess I excluded alot of those things.Cause I only compared the first like 10 bytes... o.o


The first few bytes will always be the same since it is just the DOS/NT header.
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Wed Jul 30, 2008 3:00 pm    Post subject: Reply with quote

Yea the THis cannot be run under dos thingy.
Back to top
View user's profile Send private message
Ksbunker
Advanced Cheater
Reputation: 0

Joined: 18 Oct 2006
Posts: 88

PostPosted: Wed Jul 30, 2008 5:30 pm    Post subject: re: Reply with quote

Easiest way would be to use MapFileAndCheckSumA (in imagehlp.dll)... what this does is compute a checksum using the array of bytes from the .TEXT (i.e. the code) section.

Once you have this dword, you can read the PE Header offset CheckSum, whose checksum is calculated using the same API that you just used (i.e. MapFileAndCheckSum). If there's a difference, modfied, if same, perfect.

To obtain the dword from PE header, its as simple as (assuming eax=imagebase);

Code:
mov edx, eax                    ;00400000
mov ecx, [edx+3Ch]          ;Offset to PE signature
add ecx, edx                      ;ecx=PE Header
add ecx, 58h                       ;ecx=CheckSum
mov eax, dword ptr [ecx]      ;
mov PECheckSum, eax          ;save contents to PECheckSum


http://www.rohitab.com/discuss/index.php?showtopic=28822&hl=MapFileAndCheckSum
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