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 


[TUT][v1] DLL's
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Wed Jul 09, 2008 2:31 pm    Post subject: Reply with quote

Quote:
And I use MessageBoxA, cuz the others will not compile in a dll. I dont know about other people....


Huh..? The W version should compile fine in a DLL. Here's a quick example DLL:

Code:
#include <windows.h>

DWORD ThreadProc( LPVOID lpThreadParameter )
{
   MessageBoxW( 0, L"This is our message.", L"Caption", MB_OK );
   return 0;
}

BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID lpReason )
{
   switch( dwReason )
   {
   case DLL_PROCESS_ATTACH:
      DisableThreadLibraryCalls( hModule );
      CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)ThreadProc, 0, 0, 0 );
      return TRUE;
   }
   return FALSE;
}


Not using _T( .. ) macro to avoid adding another include just for example. Anyway, works perfectly fine for me. You might have forgotten to set the strings correctly as a string using just " " is not unicode friendly.

Unicode strings either need L in front of the quotes, or you can include TCHAR.h and use _T( .. ) macro or define it yourself. (Theres also the TEXT( ) macro as well.)

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

Joined: 14 Aug 2007
Posts: 372

PostPosted: Wed Jul 09, 2008 3:18 pm    Post subject: Reply with quote

I didn't really try the unicode (no reason), but I did regular and works for .exe but not .dll for me. I am going to try to get rid of some of the errors... But today I want a break from programming and play some MS or Gears.
Back to top
View user's profile Send private message
homer_simpson
Grandmaster Cheater
Reputation: 0

Joined: 25 Feb 2007
Posts: 596

PostPosted: Thu Jul 10, 2008 6:29 am    Post subject: Reply with quote

Edit: nvm

Last edited by homer_simpson on Thu Jul 10, 2008 7:54 am; edited 1 time in total
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 10, 2008 7:53 am    Post subject: Reply with quote

You would put them inside a thread.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Dark Gigabyte
Advanced Cheater
Reputation: 0

Joined: 13 Feb 2008
Posts: 72

PostPosted: Thu Jul 10, 2008 11:58 am    Post subject: Reply with quote

Instead of this:

Code:
   switch (reason)
    {
      case DLL_PROCESS_ATTACH:
      DisableThreadLibraryCalls( hInst );
      MessageBoxA (NULL, "Success!", "", MB_OK);
      Func();
      break;

      case DLL_PROCESS_DETACH:
        break;

      /*case DLL_THREAD_ATTACH:
        break;

      case DLL_THREAD_DETACH:
        break;*/
   }


I believe you can just put a MessageBoxA underneath:

Code:
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)MainLoop,0,NULL,&dwThreadID);


if you put a loop or you can change the dllmain block to this:

Code:
BOOL WINAPI DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved) {
   if(ul_reason_for_call==DLL_PROCESS_ATTACH) {
      ATTACHED = true;
      MessageBoxA(0, "Injection successfull", "My DLL", MB_ICONEXCLAMATION | MB_OK);
      CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)MainLoop,0,NULL,&dwThreadID);
   }
    return true;
}


That should simply make an information box with an ok that will have the title My DLL and say injection successfull.
Back to top
View user's profile Send private message Send e-mail
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Thu Jul 10, 2008 1:20 pm    Post subject: Reply with quote

Yeah that works, but if it is below CreateThread, you also know if the thread was created correctly...

I am going to update my tut this after I rest from soccer.... It will include creat thread, and the last GUI part... Hopefully.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Thu Jul 10, 2008 2:26 pm    Post subject: Re: [TUT][v1] DLL's Reply with quote

Chaosis13 wrote:
With ASM you do this:
Code:
__asm mov dword ptr ds:[0x0046F08C],0x9090

Simple, yet powerful! I will not teach you ASM here, so deal! But you can be a leacher and use that code if you want.
Here is the deactivation:
Code:
__asm mov dword ptr ds:[0x0046F08C],0x1C74

Remember the bytes are reversed still. ^

That was the first part of the guide. I hope you learn something, but try to learn some more about pointers or ASM if that was confusing.


You might want to try moving a word instead of a dword. 0x9090 is a word, not a dword. Each "number" represents not a byte, but a nibble.
Back to top
View user's profile Send private message
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Fri Jul 11, 2008 8:03 am    Post subject: Reply with quote

Ik about all that but using dword doesn't make a difference, and if someone copyed my code there is less of a chance they will complain and message me abunch. I may explain that in there later... But they all should know hex and about bytes....
Back to top
View user's profile Send private message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

PostPosted: Sat Jul 12, 2008 12:49 pm    Post subject: Reply with quote

It said tomorow forever! :\
_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Sat Jul 12, 2008 4:50 pm    Post subject: Reply with quote

I am lazy. And I am working on that new program I showed you. I will most likely have it done today/tomarrow. (I was busyer than I thought today...)
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sun Jul 13, 2008 4:24 am    Post subject: Reply with quote

Chaosis13 wrote:
Ik about all that but using dword doesn't make a difference, and if someone copyed my code there is less of a chance they will complain and message me abunch. I may explain that in there later... But they all should know hex and about bytes....

I think you'll find there are going to be 2 bytes that are zeroed out unnecessarily possibly leading to future crashes.
Back to top
View user's profile Send private message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

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

You have said tomorrow for about 2 weeks now :\
_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Fri Jul 25, 2008 5:27 pm    Post subject: Reply with quote

Yeah.... I know. I am really busy with homework... And making my website, and C++ UCE.

But... I guess I will do it when I get back from vacation. 1 more week. Very Happy

You can just look it up on MSDN... I think.
Back to top
View user's profile Send private message
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Thu Aug 07, 2008 2:15 pm    Post subject: Reply with quote

Aren't your vacation over now? Razz. Anyways we still need a GGCRC to be able to use these trainers right? I have my own but i'm getting HAD when I'm injecting it to Maple.
Back to top
View user's profile Send private message
Hieroglyphics
I post too much
Reputation: 0

Joined: 06 Dec 2007
Posts: 2007
Location: Your bedroom

PostPosted: Thu Aug 14, 2008 9:12 am    Post subject: Reply with quote

when is tommorow Sad
_________________

Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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