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 


C++ postmessage

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

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Mon Apr 07, 2008 4:21 am    Post subject: C++ postmessage Reply with quote

so i've patched my function:
Code:
DWORD dwPM = (DWORD)GetProcAddress( LoadLibrary( _T("user32.dll") ), "PostMessageA" ) + 5;
_declspec(naked) BOOL WINAPI PMX( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
   _asm
   {
      mov edi,edi
      push ebp
      mov ebp,esp
      jmp dword ptr ds:[dwPM]
   }
}


then made a function for it
Code:
void sendshit(INT key)
{
   mswin = FindWindowW(L"MapleStoryClass", NULL);
   lParam = MapVirtualKey(key,0);
   lParam <<= 16;

   PMX(mswin,WM_KEYDOWN,key,lParam);
   Sleep(10);
   PMX(mswin,WM_KEYUP,key,lParam);
}


and when i try sendshit(0x5A) or (0x11); maplestory dies, anyone know why this would be happening? im stuck

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Apr 07, 2008 5:13 am    Post subject: Reply with quote

From looking at the other posts about this, shouldn't the MapVirtualKey call look like this instead?:

Code:
int iMappedKey = (MapVirtualKey(lParam, 0) << 16) & 0x00FF0000;


lParam being the keycode.

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

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Mon Apr 07, 2008 5:17 am    Post subject: Reply with quote

ahh, will try that, but whats the 0x00FF0000 for?
_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Apr 07, 2008 6:05 am    Post subject: Reply with quote

If I recall correctly from what I read somewhere it deals with the 'state' of the key. 0x00FF0000 being the 'down' state. (I don't remember for sure so don't quote me on that.)
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Mon Apr 07, 2008 6:15 am    Post subject: Reply with quote

ok, i tried it though, still closes maple instantly
_________________
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: Mon Apr 07, 2008 8:42 am    Post subject: Reply with quote

Wiccaan wrote:
If I recall correctly from what I read somewhere it deals with the 'state' of the key. 0x00FF0000 being the 'down' state. (I don't remember for sure so don't quote me on that.)

Isn't it 0x80000000 for 'key down'?
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Tue Apr 08, 2008 5:08 am    Post subject: Reply with quote

well i tried that too, still closes maple, this makes no fucking sense
_________________
Back to top
View user's profile Send private message
4ng3licDew
Cheater
Reputation: 0

Joined: 14 Feb 2008
Posts: 28

PostPosted: Wed Apr 09, 2008 9:56 am    Post subject: Reply with quote

I coded my program using Microsoft Visual Studio C++ 6, windows XP SP2 32bits, and it works.

You use FindWindowW. I looked it up and it is for Windows 95/98/Me.

Here is my code which I have posted a while back on this forum.
Code:

#include <windows.h>

#define LENGTH 30
#define ID_TIMER1 2
#define ID_LABEL1 3
#define ID_LABEL2 4
#define ID_LABEL3 5
#define ID_LABEL4 6
#define ID_EDIT 7
#define VK_T 84



const char *ClsName = "AutoClickApp";
const char *WndName = "AutoClick for MapleStory";
const char *MsgOn = "On";
const char *MsgOff = "Off";


HINSTANCE hInstApp = NULL; // handle to application instance
HINSTANCE m_hInst; // Instance of user32 DLL
DWORD DLLFunc;
//static const FARPROC origPMA =(FARPROC)((DWORD)GetProcAddress(GetModuleHandle("user32.dll"), "PostMessageA")+5);

HWND cHandle; // Windows handle to MapleStory
UINT nIDHotKey; // Hot key identifier
int nTimer1on; // Flag indicating timer1 is on/off
POINT Pos; // Mouse pointer position

HWND hLabel1; // Interval label
HWND hLabel2; // Hot key label
HWND hLabel3; // Status label
HWND hLabel4; // Status on/off
HWND hEdit; // Interval input text box

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
            WPARAM wParam, LPARAM lParam);
 


INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
               LPSTR lpCmdLine, int nCmdShow)
{
   MSG Msg;
   HWND hWnd;
   WNDCLASSEX WndClsEx;

   hInstApp = hInstance;

   // Create the application window
   WndClsEx.cbSize        = sizeof(WNDCLASSEX);
   WndClsEx.style         = CS_HREDRAW | CS_VREDRAW;
   WndClsEx.lpfnWndProc   = WndProcedure;
   WndClsEx.cbClsExtra    = 0;
   WndClsEx.cbWndExtra    = 0;
   WndClsEx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
   WndClsEx.hCursor       = LoadCursor(NULL, IDC_ARROW);
   WndClsEx.hbrBackground = (HBRUSH)GetStockObject(SYSTEM_FONT);
   WndClsEx.lpszMenuName  = NULL;
   WndClsEx.lpszClassName = ClsName;
   WndClsEx.hInstance     = hInstance;
   WndClsEx.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

   // Register the application
   if (!RegisterClassEx(&WndClsEx)) {
      MessageBox(0, "Error Registering Class!", "Error!", MB_ICONSTOP | MB_OK);
      return 0;
   }

   // Create the window object
   hWnd = CreateWindow(ClsName,   // registered class name
           WndName,            // window name
           WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,   // window style
           CW_USEDEFAULT,      // horizontal position of window
           CW_USEDEFAULT,      // vertical position of window
           325,               // window width
           87,               // window height
           NULL,               // handle to parent or owner window
           NULL,               // menu handle or child identifier
           hInstance,         // handle to application instance
           NULL);            // window-creation data

   // Find out if the window was created
   // If the window was not created,
   // stop the application
   if( !hWnd ) {
      MessageBox(0, "Error Creating Window!", "Error!", MB_ICONSTOP | MB_OK);
      return 0;
   }

   // Display the window to the user
   ShowWindow(hWnd, SW_SHOWNORMAL);
   UpdateWindow(hWnd);

   // Decode and treat the messages
   // as long as the application is running
   while( GetMessage(&Msg, NULL, 0, 0) )
   {
      TranslateMessage(&Msg);
      DispatchMessage(&Msg);
   }

   return Msg.wParam;

}

__declspec(naked) BOOL WINAPI myPostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
   __asm
   {
      mov  edi, edi
      push ebp
      mov  ebp, esp
      jmp dword ptr ds:[DLLFunc]

   }
}
/*
int myPost (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
   myPostMessageA();

   return 0;
}
*/
LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
            WPARAM wParam, LPARAM lParam)
{
   char buffer[LENGTH];
   int  interval;
   UINT scancode;
   LPARAM lparam;

   switch(Msg)
   {

      case WM_CREATE:

         m_hInst = LoadLibrary("user32.dll");
         DLLFunc = NULL;
         if (m_hInst != NULL) {
            DLLFunc = (DWORD)GetProcAddress(m_hInst, "PostMessageA") + 5;
         }

         // Register "Ctrl + F11" as my hot key
         nIDHotKey = GlobalAddAtom("AutoClick");
         RegisterHotKey(hWnd, nIDHotKey, MOD_CONTROL, VK_F10);

         // Create label
         hLabel1 = CreateWindow("STATIC", "Interval (mSec):", WS_CHILD | WS_VISIBLE,
                              5, 5, 105, 20, hWnd, (HMENU)ID_LABEL1, hInstApp, NULL);

         // Create text box input
         hEdit = CreateWindow("EDIT", "250", WS_CHILD | WS_VISIBLE | WS_BORDER ,
                              110, 5, 70, 20, hWnd, (HMENU)ID_EDIT, hInstApp, NULL);

         // Create label
         hLabel2 = CreateWindow("STATIC", "Hot Key (Ctrl + F10)", WS_CHILD | WS_VISIBLE,
                              185, 5, 128, 20, hWnd, (HMENU)ID_LABEL2, hInstApp, NULL);

         // Create label
         hLabel3 = CreateWindow("STATIC", "Status:", WS_CHILD | WS_VISIBLE,
                              5, 30, 105, 20, hWnd, (HMENU)ID_LABEL3, hInstApp, NULL);

         // Create label
         hLabel4 = CreateWindow("EDIT", "Off", WS_CHILD | WS_VISIBLE | WS_BORDER ,
                              110, 30, 70, 20, hWnd, (HMENU)ID_LABEL4, hInstApp, NULL);

         // Set timer1 flag to off
         nTimer1on = 0;


         // Get window handle on MapleStory
         cHandle = FindWindow("MapleStoryClass", NULL);


         break;

      case WM_HOTKEY:

         if (wParam == nIDHotKey) {

            if (nTimer1on == 0) {

               nTimer1on = 1;

               // Update label status to On
               SendMessage(hLabel4, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)MsgOn);

               // Get interval value from text box input
               SendMessage(hEdit, WM_GETTEXT, LENGTH, (LPARAM)&buffer);
               interval = atoi(buffer);

               // Create timer
               SetTimer(hWnd, ID_TIMER1, interval, NULL);

            } else {

               nTimer1on = 0;

               // Update label status to Off
               SendMessage(hLabel4, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)MsgOff);
               
               // Destroy timer
               KillTimer(hWnd, ID_TIMER1);
            }
         }
         break;

     case WM_TIMER:
      
       if(wParam == ID_TIMER1) {

          if (cHandle == NULL) {
            // Get window handle on MapleStory
            cHandle = FindWindow("MapleStoryClass", NULL);
          }

         if ((cHandle != NULL) && (DLLFunc != NULL)) {

            // 0x54 is virtual key code for 't' in hexidecimal
            // or 84 in decimal
            //scancode = MapVirtualKey(VK_T, 0);
            //scancode = MapVirtualKey(VkKeyScan('t'), 0);

            // Use this scancode to generate Control key down event
            scancode = MapVirtualKey(VK_CONTROL, 0);

            // The scancode value is in the low 16 bits
            // need to shift it to the left 16 bits.
            // + 1 is the number of repetition.
            lparam = (scancode << 16) + 1;

            myPostMessageA(cHandle, WM_KEYDOWN, NULL, lparam);
            //phhPostMessageA(cHandle, WM_KEYDOWN, NULL, lparam);
            

            // This call will only generate key press t in textboxes
            //phhPostMessageA(cHandle, WM_KEYDOWN, 0x54, NULL);

            // This call will generate key press t in both textboxes
            // and the graphic screen.
            //phhPostMessageA(cHandle, WM_KEYDOWN, 0x54, lparam);         


            // Code to generate mouse click events
            //GetCursorPos(&Pos);
            //phhPostMessageA(cHandle, WM_LBUTTONDBLCLK, NULL,   (LPARAM)&Pos);
            //phhPostMessageA(cHandle, WM_LBUTTONUP, NULL, (LPARAM)&Pos);
         }
         }

         break;

      // If the user wants to close the application
      case WM_DESTROY:

         // Un-Register my hot key
         UnregisterHotKey(hWnd, nIDHotKey);

         if (nTimer1on == 1) {
            // Destroy timer1
            KillTimer(hWnd, ID_TIMER1);
         }

         if (m_hInst != NULL) {
            // Un-Load DLL
            ::FreeLibrary(m_hInst);
            m_hInst = NULL;
         }

         // then close it
         PostQuitMessage(WM_QUIT);
         break;
      
      default:

         // Process the left-over messages
         return DefWindowProc(hWnd, Msg, wParam, lParam);
   }

    // If something was not done, let it go
    return 0;
}
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Apr 09, 2008 11:52 am    Post subject: Reply with quote

4ng3licDew wrote:
I coded my program using Microsoft Visual Studio C++ 6, windows XP SP2 32bits, and it works.

You use FindWindowW. I looked it up and it is for Windows 95/98/Me.


W is for wide-character, it's unicode.
Back to top
View user's profile Send private message
4ng3licDew
Cheater
Reputation: 0

Joined: 14 Feb 2008
Posts: 28

PostPosted: Thu Apr 10, 2008 4:44 am    Post subject: Reply with quote

I just created a dll called myHookHop.dll using Microsoft Visual Studio C++ 6

Here is the code for file myHookHop.cpp:

Code:

// myHookHop.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"

HINSTANCE hInst; // Instance of user32 DLL
DWORD DLLFunc;

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                )
{
   if (ul_reason_for_call == DLL_PROCESS_ATTACH) {

      hInst = LoadLibrary("user32.dll");

      DLLFunc = NULL;
      if (hInst != NULL) {
         DLLFunc = (DWORD)GetProcAddress(hInst, "PostMessageA") + 5;
      }

   } else if (ul_reason_for_call == DLL_PROCESS_DETACH) {
      
      if (hInst != NULL) {
         // Un-Load DLL
         ::FreeLibrary(hInst);
         hInst = NULL;
      }   
   }

    return TRUE;
}

__declspec(naked) BOOL WINAPI myPostMessageA(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
   __asm
   {
      mov  edi, edi
      push ebp
      mov  ebp, esp
      jmp dword ptr ds:[DLLFunc]

   }
}


Here is code for myHookHop.def:
Code:

LIBRARY myHookHop
DESCRIPTION "PostMessageA bypass"
EXPORTS
   myPostMessageA @1


To use myHookHop.dll, here is the modified example code from above:

Code:

#include <windows.h>

#define LENGTH 30
#define ID_TIMER1 2
#define ID_LABEL1 3
#define ID_LABEL2 4
#define ID_LABEL3 5
#define ID_LABEL4 6
#define ID_EDIT 7
#define VK_T 84


const char *ClsName = "AutoClickApp";
const char *WndName = "AutoClick for MapleStory";
const char *MsgOn = "On";
const char *MsgOff = "Off";

// Function pointer type for myPostMessageA in myHookHop DLL
typedef int (__stdcall *HHPtr) (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

HINSTANCE hInstApp = NULL; // handle to application instance
HINSTANCE hInstHH; // Instance of hookHop DLL
HHPtr phhPostMessageA; // Function pointer to hhPostMessageA

HWND cHandle; // Windows handle to MapleStory
UINT nIDHotKey; // Hot key identifier
int nTimer1on; // Flag indicating timer1 is on/off
POINT Pos; // Mouse pointer position

HWND hLabel1; // Interval label
HWND hLabel2; // Hot key label
HWND hLabel3; // Status label
HWND hLabel4; // Status on/off
HWND hEdit; // Interval input text box

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg,
            WPARAM wParam, LPARAM lParam);
 


INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
               LPSTR lpCmdLine, int nCmdShow)
{
   MSG Msg;
   HWND hWnd;
   WNDCLASSEX WndClsEx;

   hInstApp = hInstance;

   // Create the application window
   WndClsEx.cbSize        = sizeof(WNDCLASSEX);
   WndClsEx.style         = CS_HREDRAW | CS_VREDRAW;
   WndClsEx.lpfnWndProc   = WndProcedure;
   WndClsEx.cbClsExtra    = 0;
   WndClsEx.cbWndExtra    = 0;
   WndClsEx.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
   WndClsEx.hCursor       = LoadCursor(NULL, IDC_ARROW);
   WndClsEx.hbrBackground = (HBRUSH)GetStockObject(SYSTEM_FONT);
   WndClsEx.lpszMenuName  = NULL;
   WndClsEx.lpszClassName = ClsName;
   WndClsEx.hInstance     = hInstance;
   WndClsEx.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

   // Register the application
   if (!RegisterClassEx(&WndClsEx)) {
      MessageBox(0, "Error Registering Class!", "Error!", MB_ICONSTOP | MB_OK);
      return 0;
   }

   // Create the window object
   hWnd = CreateWindow(ClsName,   // registered class name
           WndName,            // window name
           WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,   // window style
           CW_USEDEFAULT,      // horizontal position of window
           CW_USEDEFAULT,      // vertical position of window
           325,               // window width
           87,               // window height
           NULL,               // handle to parent or owner window
           NULL,               // menu handle or child identifier
           hInstance,         // handle to application instance
           NULL);            // window-creation data

   // Find out if the window was created
   // If the window was not created,
   // stop the application
   if( !hWnd ) {
      MessageBox(0, "Error Creating Window!", "Error!", MB_ICONSTOP | MB_OK);
      return 0;
   }

   // Display the window to the user
   ShowWindow(hWnd, SW_SHOWNORMAL);
   UpdateWindow(hWnd);

   // Decode and treat the messages
   // as long as the application is running
   while( GetMessage(&Msg, NULL, 0, 0) )
   {
             TranslateMessage(&Msg);
             DispatchMessage(&Msg);
   }

   return Msg.wParam;

}

LRESULT CALLBACK WndProcedure(HWND hWnd, UINT Msg,
            WPARAM wParam, LPARAM lParam)
{
   char buffer[LENGTH];
   int  interval;
   UINT scancode;
   LPARAM lparam;

   switch(Msg)
   {

      case WM_CREATE:

         // Register "Ctrl + F10" as my hot key
         nIDHotKey = GlobalAddAtom("AutoClick");
         RegisterHotKey(hWnd, nIDHotKey, MOD_CONTROL, VK_F10);

         // Create label
         hLabel1 = CreateWindow("STATIC", "Interval (mSec):", WS_CHILD | WS_VISIBLE,
                              5, 5, 105, 20, hWnd, (HMENU)ID_LABEL1, hInstApp, NULL);

         // Create text box input
         hEdit = CreateWindow("EDIT", "250", WS_CHILD | WS_VISIBLE | WS_BORDER ,
                              110, 5, 70, 20, hWnd, (HMENU)ID_EDIT, hInstApp, NULL);

         // Create label
         hLabel2 = CreateWindow("STATIC", "Hot Key (Ctrl + F10)", WS_CHILD | WS_VISIBLE,
                              185, 5, 128, 20, hWnd, (HMENU)ID_LABEL2, hInstApp, NULL);

         // Create label
         hLabel3 = CreateWindow("STATIC", "Status:", WS_CHILD | WS_VISIBLE,
                              5, 30, 105, 20, hWnd, (HMENU)ID_LABEL3, hInstApp, NULL);

         // Create label
         hLabel4 = CreateWindow("EDIT", "Off", WS_CHILD | WS_VISIBLE | WS_BORDER ,
                              110, 30, 70, 20, hWnd, (HMENU)ID_LABEL4, hInstApp, NULL);

         // Set timer1 flag to off
         nTimer1on = 0;


         // Get window handle on MapleStory
         cHandle = FindWindow("MapleStoryClass", NULL);

         // Load hookHop DLL
         hInstHH = LoadLibrary("myHookHop.dll");

         if (hInstHH != NULL) {
            // Get function pointer to hhPostMessageA
            phhPostMessageA = (HHPtr)GetProcAddress(hInstHH, "myPostMessageA");
         }

         break;

      case WM_HOTKEY:

         if (wParam == nIDHotKey) {

            if (nTimer1on == 0) {

               nTimer1on = 1;

               // Update label status to On
               SendMessage(hLabel4, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)MsgOn);

               // Get interval value from text box input
               SendMessage(hEdit, WM_GETTEXT, LENGTH, (LPARAM)&buffer);
               interval = atoi(buffer);

               // Create timer
               SetTimer(hWnd, ID_TIMER1, interval, NULL);

            } else {

               nTimer1on = 0;

               // Update label status to Off
               SendMessage(hLabel4, WM_SETTEXT, 0, (LPARAM)(LPCTSTR)MsgOff);
               
               // Destroy timer
               KillTimer(hWnd, ID_TIMER1);
            }
         }
         break;

     case WM_TIMER:
      
       if(wParam == ID_TIMER1) {

          if (cHandle == NULL) {
            // Get window handle on MapleStory
            cHandle = FindWindow("MapleStoryClass", NULL);
          }

         if ((cHandle != NULL) && (phhPostMessageA != NULL)) {

            // 0x54 is virtual key code for 't' in hexidecimal
            // or 84 in decimal
            //scancode = MapVirtualKey(VK_T, 0);
            scancode = MapVirtualKey(VkKeyScan('t'), 0);

            // Use this scancode to generate Control key down event
            //scancode = MapVirtualKey(VK_CONTROL, 0);

            // The scancode value is in the low 16 bits
            // need to shift it to the left 16 bits.
            // + 1 is the number of repetition.
            lparam = (scancode << 16) + 1;

            phhPostMessageA(cHandle, WM_KEYDOWN, NULL, lparam);

            // This call will only generate key press t in textboxes
            //phhPostMessageA(cHandle, WM_KEYDOWN, 0x54, NULL);

            // This call will generate key press t in both textboxes
            // and the graphic screen.
            //phhPostMessageA(cHandle, WM_KEYDOWN, 0x54, lparam);         


            // Code to generate mouse click events
            //GetCursorPos(&Pos);
            //phhPostMessageA(cHandle, WM_LBUTTONDBLCLK, NULL,   (LPARAM)&Pos);
            //phhPostMessageA(cHandle, WM_LBUTTONUP, NULL, (LPARAM)&Pos);
         }
         }

         break;

      // If the user wants to close the application
      case WM_DESTROY:

         // Un-Register my hot key
         UnregisterHotKey(hWnd, nIDHotKey);

         if (hInstHH != NULL) {
            // Un-Load hookHop DLL
            FreeLibrary(hInstHH);
            hInstHH = NULL;
         }

         if (nTimer1on == 1) {
            // Destroy timer1
            KillTimer(hWnd, ID_TIMER1);
         }

         // then close it
         PostQuitMessage(WM_QUIT);
         break;
      
      default:

         // Process the left-over messages
         return DefWindowProc(hWnd, Msg, wParam, lParam);
   }

    // If something was not done, let it go
    return 0;
}



Attached to this message is the source code for myHookHop.dll and AutoClick.
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Fri Apr 11, 2008 9:00 pm    Post subject: Reply with quote

well im not after a dll, or auto-clicker, but thanks

it still doesn't work though, now i've got:
Code:

HWND mswin;
CHAR key;
UINT scancode;
LPARAM lparam;


void sendshit(CHAR key)
{
   mswin = FindWindow(L"MapleStoryClass", NULL);
   //scancode = MapVirtualKeyW(key, 0);
    scancode = MapVirtualKey(VkKeyScan('t'), 0);

   lparam = (scancode << 16) + 1;

   PMX(mswin, WM_KEYDOWN, 0x54, lparam);;
   Sleep(10);
}



void AutoAttack(void) // Auto Attack Thread
{
   for(;;) // Main loop
   {
     sendshit('t');
      Sleep(7000);
      if (on == 0){
         ExitThread(0);
      }
   }
}

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

Joined: 14 Feb 2008
Posts: 28

PostPosted: Sun Apr 13, 2008 4:48 am    Post subject: Reply with quote

I just re-read your first post again:
Quote:

and when i try sendshit(0x5A) or (0x11); maplestory dies, anyone know why this would be happening? im stuck


When I wrote my PostMessage + 5 Bypass, these 3 lines gave me problems:

1)
Code:

DWORD dwPM = (DWORD)GetProcAddress( LoadLibrary( _T("user32.dll") ), "PostMessageA" ) + 5;


2)
Code:

_declspec(naked) BOOL WINAPI PMX( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )


3)
Code:

      jmp dword ptr ds:[dwPM]


These lines are compiler dependent.

You need to give more information like:
1) The C++ compiler you are using.
2) What program you are trying to write. (From your other thread, I assume that you are writing a DLL and then inject this into MapleStory). My code is just a simple autoclick program.
3) What operation system you are using.

When my autoclick program crashed, I rebuild it in Debug version and then run it again. When it crashes Window XP shows me the error message. I did not understand the terminologies so I googled for for information.

To cut the long story short. I has to debug my autoclick program using the debugger.

Here are some aternative coding to the above 3 lines that I have found using google. They don't work for me:

C++ from cheatengine t=160907
Code:

ULONG reentry_address = GetProcAddress( LoadLibrary("user32.dll"), "PostMessageA" ) + 5;
__declspec(naked) void myPostMessageA(void)
{
   __asm
   {
      mov edi,edi
      push ebp
      mov ebp,esp
      jmp [reentry_address]
   }
}


C++ from pastebin(dot)com/m715fb8b9
Code:

DWORD Hooked = (DWORD)GetProcAddress(LoadLibrary("user32.dll"),"PostMessageA")+5;

__declspec(naked) void PMX(
   HWND hWnd,
   UINT Msg,
   WPARAM wParam,
   LPARAM lParam)
{
   __asm
   {
      mov edi,edi
      push ebp
      mov ebp,esp
      jmp [Hooked]
   }
}


C++ from pastebin(dot)ca/774824
Code:

static const FARPROC origPMA =(FARPROC)((DWORD)GetProcAddress(GetModuleHandle("user32.dll"), "PostMessageA")+5);

_declspec(naked) BOOL WINAPI _postMsg(HWND hWnd, INT Msg, WPARAM wParam, LPARAM lParam)
{
   __asm
   {
      mov edi,edi
      push ebp
      mov ebp,esp
      jmp origPMA
   }
}


I hope you get the idea (I only know C/C++ syntax and Object Oriented. I have not use inline assembler language in C++ before). So what I did was alot of try and error.
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