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-C++]Including dll in exe .

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

Joined: 21 Sep 2006
Posts: 653

PostPosted: Tue Jul 22, 2008 1:41 pm    Post subject: [Q-C++]Including dll in exe . Reply with quote

I made a dll and an injector , after injecting the dll dialog appear and allows to scan memory etc..
Its obvious that i am using a dll , Is there a way to include the dll[or its source] inside the injector , so it looks like i am using an exe ?
and make it hard for crackers?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Tue Jul 22, 2008 1:49 pm    Post subject: Reply with quote

You can add the DLL as a resource and extract it at runtime.

API Needed:
- FindResource
- LoadResource
- LockResource
- SizeofResource
- CreateFile
- WriteFile
- CloseHandle

It's not too hard to figure out. And there are various examples on the net.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Tue Jul 22, 2008 9:11 pm    Post subject: Reply with quote

You can get a hex editor and copy the entire DLL into your source.

Code:


static BYTE incDLL[] =
{

0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0x00, 0x00, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4,
0x09, 0xCD, 0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20,

bla bla bla, it will be bloody long

}

and then do

Code:

   f.open( DLLPath, ios::binary | ios::in | ios::out );
   f.write((PCHAR)incDLL, sizeof(incDLL));
   f.close();


EDIT: After thinking about it, I think you don't have to do the second part. You can just directly link to incDLL in your inject function.
Back to top
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Wed Jul 23, 2008 7:34 am    Post subject: Reply with quote

Zand wrote:


EDIT: After thinking about it, I think you don't have to do the second part. You can just directly link to incDLL in your inject function.


How?
Back to top
View user's profile Send private message Send e-mail
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Wed Jul 23, 2008 9:14 am    Post subject: Reply with quote

Or u can use xbundle & any public exe/dll/resource bundler
_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
b6ooy
Grandmaster Cheater
Reputation: 0

Joined: 21 Sep 2006
Posts: 653

PostPosted: Wed Jul 23, 2008 11:45 am    Post subject: Reply with quote

I had problems extracting the dll from the resource ..
so i did the same method that Zand wrote , but using static DWORD ..
and in my dllinject func. wpm incDLL , the injector writes the dll in the allocated region but nothing happen ?? [ dll doesn't load ]
Then i used creat/writefile to extract the dll then write it in the allocated memory and it worked ..
I just don't know why writing it directly didn't work ? thats what i wan't .
extracting it in the same folder is useless Confused
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Wed Jul 23, 2008 12:08 pm    Post subject: Reply with quote

Zand wrote:
You can get a hex editor and copy the entire DLL into your source.

Code:


static BYTE incDLL[] =
{

0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0x00, 0x00, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4,
0x09, 0xCD, 0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20,

bla bla bla, it will be bloody long

}

and then do

Code:

   f.open( DLLPath, ios::binary | ios::in | ios::out );
   f.write((PCHAR)incDLL, sizeof(incDLL));
   f.close();


EDIT: After thinking about it, I think you don't have to do the second part. You can just directly link to incDLL in your inject function.


No real point in making a huge header to hold this. You can just include the DLL inside a resource file and extract it during runtime. A lot easier. Either way, the DLL is going to be created on the disk, so worrying about people getting their hands on it is nothing to even consider. (Just saying that in reference not saying that you said that.)

No need for extra programs to do it either. You can do it yourself. And if you need to compress, use a packer. There are tons of em that are free and will compress resources.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Jul 23, 2008 9:53 pm    Post subject: Reply with quote

Wiccaan wrote:
Zand wrote:
You can get a hex editor and copy the entire DLL into your source.

Code:


static BYTE incDLL[] =
{

0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF,
0x00, 0x00, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x48, 0x02, 0x00, 0x00, 0x0E, 0x1F, 0xBA, 0x0E, 0x00, 0xB4,
0x09, 0xCD, 0x21, 0xB8, 0x01, 0x4C, 0xCD, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20,

bla bla bla, it will be bloody long

}

and then do

Code:

   f.open( DLLPath, ios::binary | ios::in | ios::out );
   f.write((PCHAR)incDLL, sizeof(incDLL));
   f.close();


EDIT: After thinking about it, I think you don't have to do the second part. You can just directly link to incDLL in your inject function.


No real point in making a huge header to hold this. You can just include the DLL inside a resource file and extract it during runtime. A lot easier. Either way, the DLL is going to be created on the disk, so worrying about people getting their hands on it is nothing to even consider. (Just saying that in reference not saying that you said that.)

No need for extra programs to do it either. You can do it yourself. And if you need to compress, use a packer. There are tons of em that are free and will compress resources.


At first I thought the DLL had to be created on the disc before injecting. But after thinking again, can't you just directly copy the DLL from the injector's memory into the target program's memory. You would have to change your injecting method though...

They could still take a dump of the memory to get your DLL

Take a look at ManualMap by Darawk and alter it slightly
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Thu Jul 24, 2008 11:13 pm    Post subject: Reply with quote

Quote:
At first I thought the DLL had to be created on the disc before injecting. But after thinking again, can't you just directly copy the DLL from the injector's memory into the target program's memory. You would have to change your injecting method though...

They could still take a dump of the memory to get your DLL

Take a look at ManualMap by Darawk and alter it slightly


Yes, you can. All depends on how you want to do it really, I find it easier to just create it to the disk.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Fri Jul 25, 2008 9:11 am    Post subject: Reply with quote

You could always just do a huge WriteProcessMemory() call and CreateRemoteThread on it, right?
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Fri Jul 25, 2008 11:17 am    Post subject: Reply with quote

Can't you code the DLL in the EXE project and then use WriteProcessMemory to inject the whole module?
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Tue Jul 29, 2008 2:38 pm    Post subject: Reply with quote

Yea keep the dll in your program as hex then wpm it into your own memory like injecting it into a process.
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