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 


looking for a coder

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
sonexa
Newbie cheater
Reputation: 0

Joined: 19 Sep 2011
Posts: 16

PostPosted: Sat Apr 28, 2012 10:08 am    Post subject: looking for a coder Reply with quote

i'm looking for a coder, to place a breakpoint in an adress and when active change the EAX register, i'm pay with Paypal.
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sat Apr 28, 2012 11:02 am    Post subject: Reply with quote

We don't accept payment here.

Debugging a Running Process
Writing the Debugger's Main Loop
Vectored Exception Handling
Debugger flow control: Hardware breakpoints vs software breakpoints


Last edited by Innovation on Sat Apr 28, 2012 11:44 am; edited 3 times in total
Back to top
View user's profile Send private message
sonexa
Newbie cheater
Reputation: 0

Joined: 19 Sep 2011
Posts: 16

PostPosted: Sat Apr 28, 2012 11:16 am    Post subject: Reply with quote

I've tried and failed, i need it in a dll
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sat Apr 28, 2012 11:23 am    Post subject: Reply with quote

sonexa wrote:
I've tried and failed, i need it in a dll

See AddVectoredExceptionHandler.
Back to top
View user's profile Send private message
sonexa
Newbie cheater
Reputation: 0

Joined: 19 Sep 2011
Posts: 16

PostPosted: Sat Apr 28, 2012 11:30 am    Post subject: Reply with quote

can you say what i need to do?

AddVectoredExceptionHanler>??>??>??
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sat Apr 28, 2012 11:35 am    Post subject: Reply with quote

sonexa wrote:
can you say what i need to do?

AddVectoredExceptionHanler>??>??>??

It depends on which type of breakpoint you wish to set.
Back to top
View user's profile Send private message
sonexa
Newbie cheater
Reputation: 0

Joined: 19 Sep 2011
Posts: 16

PostPosted: Sat Apr 28, 2012 11:39 am    Post subject: Reply with quote

set the breakpoint at adress $000001
when active, change the EAX to $01
continue

what the breakpoint type i'll need?
Back to top
View user's profile Send private message
Innovation
Grandmaster Cheater
Reputation: 12

Joined: 14 Aug 2008
Posts: 617

PostPosted: Sat Apr 28, 2012 12:52 pm    Post subject: Reply with quote

sonexa wrote:
set the breakpoint at adress $000001
when active, change the EAX to $01
continue

what the breakpoint type i'll need?

Try a hardware breakpoint.

Untested example code:
Code:
// Made by Innovation of CEF
#define dwAddress 0x00000001
#define dwReturnAddress ?
#define dwValue 0x00000001

#include <windows.h>
#include <tchar.h>

PVOID hVectoredExceptionHandler = NULL;

bool HardwareBreakpoint(__in bool bEnable)
{
   DWORD dwProcessIdentifier = GetCurrentProcessId();
   DWORD dwThreadIdentifier = GetCurrentThreadId();
   HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
   if(hSnapshot != INVALID_HANDLE_VALUE)
   {
      THREADENTRY32 ThreadEntry32;
      ThreadEntry32.dwSize = sizeof(THREADENTRY32);
      if(Thread32First(hSnapshot, &ThreadEntry32))
      {
         CONTEXT Context;
         Context.ContextFlags = CONTEXT_DEBUG_REGISTERS;
         do
         {
            if((ThreadEntry32.th32OwnerProcessID == dwProcessIdentifier) && (ThreadEntry32.th32ThreadID != dwThreadIdentifier))
            {
               SuspendThread(ThreadEntry32.th32ThreadID);
               GetThreadContext(ThreadEntry32.th32ThreadID, &Context);
               if(bEnable)
               {
                  Context.Dr0 = dwAddress;
                  Context.Dr7 |= 0x00000001;
                  Context.Dr7 &= 0xFFF0FFFD; // ~((1 << 1) | (15 << 16))
               }
               else
               {
                  Context.Dr0 = 0;
                  Context.Dr7 &= 0xFFFFFFFC; // ~3
               }
               SetThreadContext(ThreadEntry32.th32ThreadID, &Context);
               ResumeThread(ThreadEntry32.th32ThreadID);
            }
         }
         while(Thread32Next(hSnapshot, &ThreadEntry32));
      }
      CloseHandle(hSnapshot);
      return true;
   }
   return false;
}

__declspec(naked) void WINAPI OriginalInstruction()
{
   __asm
   {
      /* Original Instruction */
      mov eax, dwValue
      jmp dword ptr ds:[dwReturnAddress]
   }
}

LONG CALLBACK VectoredExceptionHandler(__in PEXCEPTION_POINTERS pExceptionPointers)
{
   if((pExceptionPointers->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP) && (pExceptionPointers->ExceptionRecord->ExceptionAddress == dwAddress))
   {
      pExceptionPointers->ContextRecord->Eip = (DWORD)OriginalInstruction;
      return EXCEPTION_CONTINUE_EXECUTION;
   }
   return EXCEPTION_CONTINUE_SEARCH;
}

DWORD WINAPI Main(__in PVOID pParameter)
{
   hVectoredExceptionHandler = AddVectoredExceptionHandler(1, (PVECTORED_EXCEPTION_HANDLER)VectoredExceptionHandler);
   if(hVectoredExceptionHandler != NULL)
   {
      if(HardwareBreakpoint(true))
      {
         return 0;
      }
#ifdef _DEBUG
      else
      {
         OutputDebugString(_T("[Error] Failed to install hardware breakpoint."));
      }
#endif
   }
#ifdef _DEBUG
   else
   {
      OutputDebugString(_T("[Error] Failed to add vectored exception handler."));
   }
#endif
   return -1;
}

BOOL WINAPI DllMain(__in HMODULE hModule, __in DWORD dwReason, __in PVOID pReserved)
{
   if(dwReason == DLL_PROCESS_ATTACH)
   {
      DisableThreadLibraryCalls(hModule);
      if(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Main, NULL, 0, NULL) != NULL)
      {
         return TRUE;
      }
#ifdef _DEBUG
      else
      {
         OutputDebugString(_T("[Error] Failed to create main thread."));
      }
#endif 
   }
   else if(dwReason == DLL_PROCESS_DETACH)
   {
      if(HardwareBreakpoint(false))
      {
         if((hVectoredExceptionHandler != NULL) && (RemoveVectoredExceptionHandler(hVectoredExceptionHandler) != 0))
         {
            return TRUE;
         }
#ifdef _DEBUG
         else
         {
            OutputDebugString(_T("[Error] Failed to remove vectored exception handler.")); 
         }
#endif
      }
#ifdef _DEBUG
      else
      {
         OutputDebugString(_T("[Error] Failed to uninstall hardware breakpoint.")); 
      }
#endif
   }
   return FALSE;
}

It assumes that the first debug register is not already in use.


Last edited by Innovation on Fri May 25, 2012 10:57 pm; edited 9 times in total
Back to top
View user's profile Send private message
sonexa
Newbie cheater
Reputation: 0

Joined: 19 Sep 2011
Posts: 16

PostPosted: Sat Apr 28, 2012 1:18 pm    Post subject: Reply with quote

ok, i'll try port to delphi
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