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 


Problems with DLL_PROCESS_ATTACH.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sat Mar 31, 2007 4:17 pm    Post subject: Problems with DLL_PROCESS_ATTACH. Reply with quote

Hello,

Lately I have been messing around with .dll injection. The problem is not the injector itself, Process Explorer says the .dll is injected, its the .dll I am injecting.

Now background reading has told me that when I call LoadLibrary() on a .dll it should send DLL_PROCESS_ATTACH to it. So in theory injecting this simple .dll should do the trick:

Code:
#include <windows.h>

BOOL APIENTRY DllMain(HANDLE hModule, DWORD call, LPVOID lpReserved)
{
if (call == DLL_PROCESS_ATTACH)
{
MessageBox(0,"The dll has been injected.","Hello",0);
}

return TRUE;
}


It however does absolutely nothing. I have tried other .dll's made by other people that are just for testing/example purposes, to no avail. As I said before, the injector is not the problem (I even tried CE to inject the .dll's and still nothing happens).

Any help would be appreciated.

- Flyte

P.S. Using Bloodshed compiler.
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Mar 31, 2007 5:25 pm    Post subject: Reply with quote

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
_________________
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sat Mar 31, 2007 6:05 pm    Post subject: Reply with quote

appalsap wrote:
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)


I have also tried that as the entry point function before. It still does absolutely nothing. Thanks anyways Appalsap.
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Mar 31, 2007 6:11 pm    Post subject: Reply with quote

Copied that straight from my trainer, it works.
_________________
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sat Mar 31, 2007 6:24 pm    Post subject: Reply with quote

appalsap wrote:
Copied that straight from my trainer, it works.


It just doesn't.

I am using the CreateRemoteThread method to tell the process to load the .dll if it makes any difference (which it should not). As I have said before, I have tried using dummy .dll's made by other people for example purposes, and nothing happens.
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Mar 31, 2007 6:29 pm    Post subject: Reply with quote

well then this is not a problem with the code, why post it in the programming section?!
_________________
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sat Mar 31, 2007 6:36 pm    Post subject: Reply with quote

appalsap wrote:
well then this is not a problem with the code, why post it in the programming section?!


I thought it was a problem with the code, which would be why I posted it. Now if it is not something wrong with the code then this should work on my other computer. I will post back if it works or not.

Oh, and any idea's on what the problem could be?

Thanks,

Flyte

Edit: Again, absolutely nothing happened. Has anybody else had this problem before?
Back to top
View user's profile Send private message
Robotex
Master Cheater
Reputation: 0

Joined: 05 Sep 2006
Posts: 378
Location: The pizza country!

PostPosted: Sun Apr 01, 2007 3:06 am    Post subject: Reply with quote

Code:
bool WINAPI DllMain(HMODULE hModule, DWORD dwReason, PVOID pvReserved)
{
   if(dwReason == DLL_PROCESS_ATTACH)
   {
      MessageBox(NULL,"DLL Loaded!","DLL",MB_OK);
   }
   else if(dwReason == DLL_PROCESS_DETACH)
   {
      MessageBox(NULL,"DLL Unloaded!","DLL",MB_OK);
   }
   return true;
}

I'm using that, if it still doesn't work, try changing compiler

_________________

ASM/C++ Coder
Project Speranza lead developer
Back to top
View user's profile Send private message
benlue
Moderator
Reputation: 0

Joined: 09 Oct 2006
Posts: 2142

PostPosted: Sun Apr 01, 2007 5:34 am    Post subject: Reply with quote

I doubt changing compiler will fix anything . That script you posted will probably work .
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Sun Apr 01, 2007 5:35 pm    Post subject: Reply with quote

I actually changed compliers right after my last post. It works now. For some reason Bloodshed doesn't want to compile it properly.
Back to top
View user's profile Send private message
benlue
Moderator
Reputation: 0

Joined: 09 Oct 2006
Posts: 2142

PostPosted: Mon Apr 02, 2007 6:46 am    Post subject: Reply with quote

Flyte wrote:
I actually changed compliers right after my last post. It works now. For some reason Bloodshed doesn't want to compile it properly.
Bloodshed is trustworthy to me , what compiler are you using now ?
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Tue Apr 03, 2007 8:30 am    Post subject: Reply with quote

benlue wrote:
Flyte wrote:
I actually changed compliers right after my last post. It works now. For some reason Bloodshed doesn't want to compile it properly.
Bloodshed is trustworthy to me , what compiler are you using now ?


VC++ 5.0 - I got it from school and never bothered taking it off. Found it lying around on my hard drive.
Back to top
View user's profile Send private message
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Thu Apr 12, 2007 6:09 pm    Post subject: Reply with quote

Bloodshed.net is the best free compiler out there.
Try it.
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