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] Simple DLL Poker

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

Joined: 22 Feb 2008
Posts: 62

PostPosted: Thu Jun 12, 2008 9:20 am    Post subject: [Help] Simple DLL Poker Reply with quote

Ok, I'm making a simple dll that will "freeze" these addresses when a key is pressed. All the addresses are pointers. Here's the header file and the cpp file:

Code:
#ifndef Speed
#define Speed
#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <string.h>
#include <stdio.h>

unsigned long Weight = *(unsigned long*)((*(unsigned long*)0x89af6c)+0x44);
unsigned long BoosterSpeed = *(unsigned long*)((*(unsigned long*)0x89af58)+0x604);
unsigned long BoosterTime = *(unsigned long*)((*(unsigned long*)0x89af58)+0x960);
unsigned long MinSpeed = *(unsigned long*)((*(unsigned long*)0x89af58)+0x600);
unsigned long MaxSpeed = *(unsigned long*)((*(unsigned long*)0x89af58)+0x5fc);
int newvalue = 999;
int newvalue2 = 0;
int newvalue3 = 5000;
int onoff1 = 1;
int onoff2 = 1;

unsigned long nWeight = *(unsigned long*)((*(unsigned long*)0x89af6c)+0x44);
unsigned long nBoosterSpeed = *(unsigned long*)((*(unsigned long*)0x89af58)+0x604);
unsigned long nBoosterTime = *(unsigned long*)((*(unsigned long*)0x89af58)+0x960);
unsigned long nMinSpeed = *(unsigned long*)((*(unsigned long*)0x89af58)+0x600);
unsigned long nMaxSpeed = *(unsigned long*)((*(unsigned long*)0x89af58)+0x5fc);
#endif


The .cpp file:

Code:
#include "Speeder.h"

DWORD WINAPI KeyDetection(LPVOID lpParam);

BOOL APIENTRY DLLMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)

{
   if (ul_reason_for_call == DLL_PROCESS_ATTACH)
   {
      CreateThread(0,0,(LPTHREAD_START_ROUTINE)&KeyDetection,0,0,0);
   }
   return true;
}
   
DWORD WINAPI KeyDetection(LPVOID lpParam)
{

   for(;;)
   {
      Sleep(100);
      if(GetAsyncKeyState(VK_F10))
      {   

         if (onoff1==1)
         {
         memcpy((void*)Weight,(void*)newvalue2,sizeof(Weight));
         memcpy((void*)BoosterSpeed,(void*)newvalue,sizeof(BoosterSpeed));
         memcpy((void*)BoosterTime,(void*)newvalue,sizeof(BoosterTime));
         memcpy((void*)MinSpeed,(void*)newvalue2,sizeof(MinSpeed));
         memcpy((void*)MaxSpeed,(void*)newvalue,sizeof(MaxSpeed));
         onoff1 = 0;
         }
         else if(onoff1==0)
         {
            memcpy((void*)Weight,(void*)nWeight,sizeof(Weight));
            memcpy((void*)BoosterSpeed,(void*)nBoosterSpeed,sizeof(BoosterSpeed));
            memcpy((void*)BoosterTime,(void*)nBoosterTime,sizeof(BoosterTime));
            memcpy((void*)MinSpeed,(void*)nMinSpeed,sizeof(MinSpeed));
            memcpy((void*)MaxSpeed,(void*)nMaxSpeed,sizeof(MaxSpeed));
            onoff1 = 1;
         }
      }

      if(GetAsyncKeyState(VK_F11))
      {
         if(onoff2==1)
         {
            memcpy((void*)MaxSpeed,(void*)newvalue3,sizeof(MaxSpeed));
            onoff2 = 0;
         }
         else if(onoff2==0)
         {
            memcpy((void*)MaxSpeed,(void*)nMaxSpeed,sizeof(MaxSpeed));
            onoff2 = 1;
         }
         Sleep(100);
      }
      
   return TRUE;
}


I inject it and press f10 but nothing happens.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Jun 12, 2008 9:28 am    Post subject: Reply with quote

Check if your DLL was injected successfuly and that its looping.

Also, instead of GetAsyncKeyState, use RegisterHotKey, then you don't have to loop.
Back to top
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Thu Jun 12, 2008 11:03 am    Post subject: Reply with quote

This will only set it once when you press the hotkey. In order to freeze, you have to continuously right to that address.

Quote:
Also, instead of GetAsyncKeyState, use RegisterHotKey, then you don't have to loop.

Will register hotkey work if you don't make a window? And you'd still have to loop Getmessage, right? (Never used registerhotkey)

_________________
Back to top
View user's profile Send private message
Drops
Advanced Cheater
Reputation: 0

Joined: 22 Feb 2008
Posts: 62

PostPosted: Thu Jun 12, 2008 11:24 am    Post subject: Reply with quote

Okay, I think the problem is that the dll is not getting injected (I put a messagebox before the createthread). Can anyone see why?
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Jun 12, 2008 12:21 pm    Post subject: Reply with quote

HalfPrime wrote:
This will only set it once when you press the hotkey. In order to freeze, you have to continuously right to that address.

Quote:
Also, instead of GetAsyncKeyState, use RegisterHotKey, then you don't have to loop.

Will register hotkey work if you don't make a window? And you'd still have to loop Getmessage, right? (Never used registerhotkey)

I prefer making a window, instead of just using hotkeys to activate.

And it would be easier just to nop whatever writes to this address - find out using CE.
Back to top
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Thu Jun 12, 2008 12:29 pm    Post subject: Reply with quote

I don't think messagebox works in dllmain. Try putting it in your actual thread.
See http://msdn.microsoft.com/en-us/library/ms682583.aspx for details.

_________________
Back to top
View user's profile Send private message
Drops
Advanced Cheater
Reputation: 0

Joined: 22 Feb 2008
Posts: 62

PostPosted: Thu Jun 12, 2008 1:06 pm    Post subject: Reply with quote

I tried injecting it into notepad, and it failed, but when I inject into my game, it works. Thanks for all the help so far.
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