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/C++] Auto move in MapleStory
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
4ng3licDew
Cheater
Reputation: 0

Joined: 14 Feb 2008
Posts: 28

PostPosted: Sun Sep 07, 2008 9:34 pm    Post subject: Reply with quote

The answer for this problem is in the first post.

1. Buy a cheap USB joystick, plug it into your computer.

2. Download joytokey.
http://www.oneswitch.org.uk/2/I/JoyToKey/JoyToKey.htm

3. Write a DLL and inject it into joytokey.exe

Here is an example of a dll:
Code:

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

#include "stdafx.h"
#include <stdlib.h>

#define LENGTH 30
#define ID_TIMER1 42
#define ID_TIMER2 43
#define ID_TIMER3 43
#define ID_LABEL1 4
#define ID_LABEL2 5
#define ID_LABEL3 6
#define ID_LABEL4 7
#define ID_LABEL5 8
#define ID_LABEL6 9
#define ID_LABEL7 10
#define ID_LABEL8 11
#define ID_EDIT 20
#define ID_EDIT2 21

#define DIK_LEFT            0xCB    /* LeftArrow on arrow keypad */
#define DIK_RIGHT           0xCD    /* RightArrow on arrow keypad */
#define VK_LEFT            0x25    /* LeftArrow on arrow keypad */
#define VK_RIGHT         0x27    /* RightArrow on arrow keypad */

const char *ClsName = "JoyToKeyApp";
const char *WndName = "JoyToKey";
const char *MsgOn = "On";
const char *MsgOff = "Off";
const char *MsgOnRight = "On-Right";
const char *MsgOnLeft = "On-Left";

HINSTANCE hInstApp = NULL;   // handle to application instance

UINT nIDHotKey; // Hot key identifier
bool bTimer1on; // Flag indicating timer1 is on/off

HWND hLabel1;   // Interval label
HWND hLabel2;   // Hot key label
HWND hLabel3;   // Change label
HWND hLabel4;   // Status label
HWND hLabel5;   // Status on/off
HWND hLabel6;   // Auto Move L / R label
HWND hLabel7;   // Connection status label
HWND hLabel8;   // Hot key label
HWND hEdit;      // Interval input text box
HWND hEdit2;   // Change input text box

BYTE virtual_key = VK_LEFT;
BYTE scan_key = DIK_LEFT;
ULONG  change;   // Time to move in one direction

LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
void CreateLabels(HWND hWnd);
void autoLeftRight(void);
void _CreateWindow(HANDLE hModule);

BOOL APIENTRY DllMain( HANDLE hModule,
                        DWORD  ul_reason_for_call,
                        LPVOID lpReserved)
{
    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        hInstApp = (HINSTANCE) hModule;
        CreateThread(0, 0, (LPTHREAD_START_ROUTINE)_CreateWindow, 0, 0, 0);
   }
    return TRUE;
}

void _CreateWindow(void)
{
    // the handle for the window, filled by a function
    HWND hWnd;
    // this struct holds information for the window class
    WNDCLASSEX wc;

    // clear out the window class for use
    ZeroMemory(&wc, sizeof(WNDCLASSEX));

    // Create the application window
    wc.cbSize        = sizeof(WNDCLASSEX);
    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = (WNDPROC) WindowProc;
    wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
    wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground = (HBRUSH)COLOR_WINDOW;
    wc.lpszClassName = ClsName;
    wc.hInstance     = hInstApp;
    wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

    // Register the application
    if (!RegisterClassEx(&wc))
    {
        MessageBox(0, "Error Registering Class!", "Error!", MB_ICONSTOP | MB_OK);
   }
   
    // create the window and use the result as the handle
    hWnd = CreateWindowEx(NULL,
                ClsName,            // registered class name
                WndName,            // title of the window
                WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU,   // window style
                CW_USEDEFAULT,         // x position of window
                CW_USEDEFAULT,         // y position of window
                325,               // window width
                80,               // window height
                NULL,               // no parent window, NULL
                NULL,               // no menus, NULL
                hInstApp,            // handle to application instance
                NULL);               // used with multiple windows, NULL

    // 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);
    }

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

    // this struct holds Windows event messages
    MSG msg;

    // enter the main loop:
    // wait for the next message in the queue, store the result in 'msg'
    while (GetMessage(&msg, NULL, 0, 0))
    {
        // translate keystroke messages into the right format
        TranslateMessage(&msg);
      
        // send the message to the WindowProc function
        DispatchMessage(&msg);
    }
}

// this is the main message handler for the program
LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
    char buffer[LENGTH];

    // sort through and find what code to run for the message given
    switch (Msg)
    {
        case WM_CREATE:

            // Register "Ctrl + F5" as my hot key
            nIDHotKey = GlobalAddAtom("AutoMove");
            RegisterHotKey(hWnd, nIDHotKey, MOD_CONTROL, VK_F5);

            CreateLabels(hWnd);

            // Set flags to off
            bTimer1on = false;

            break;
           
        case WM_HOTKEY:

            if (wParam == nIDHotKey)
            {
                if (!bTimer1on)
                {
                    bTimer1on = true;

                    // Set scan code to LeftArrow on arrow keypad
                    scan_key = DIK_LEFT;
                    virtual_key = VK_LEFT;

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

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

                    // Create timer
                    CreateThread(0, 0, (LPTHREAD_START_ROUTINE)autoLeftRight, 0, 0, 0);
                }
                else
                {
                    bTimer1on = false;

                    // Update label status to Off
                    SendMessage(hLabel5, WM_SETTEXT, 0, (LPARAM) MsgOff);   
                }
            }

            break;

        // this message is read when the window is closed
        case WM_DESTROY:

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

            if (bTimer1on)
            {
                // Destroy timer1
                //KillTimer(hWnd, ID_TIMER1);
                bTimer1on = false;
            }

            // close the application entirely
            PostQuitMessage(WM_QUIT);
            break;

        default:

            // Handle any messages the switch statement didn't
            return DefWindowProc(hWnd, Msg, wParam, lParam);
    }

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

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

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

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

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

    // Create label
    hLabel5 = CreateWindow("STATIC", "Off", WS_CHILD | WS_VISIBLE | WS_BORDER ,
                            110, 30, 70, 20, hWnd, (HMENU)ID_LABEL5, hInstApp, NULL);

    // Create label
    hLabel6 = CreateWindow("STATIC", "Auto Move L / R", WS_CHILD | WS_VISIBLE,
                            185, 30, 128, 20, hWnd, (HMENU)ID_LABEL6, hInstApp, NULL);
}

void autoLeftRight(void)
{
    DWORD starting_point;
    while (bTimer1on)
    {
        // find out the starting time of each loop
        starting_point = GetTickCount();
      
        // press key
        //keybd_event(virtual_key, scan_key, 0, 0);
        keybd_event(virtual_key, 0, 0, 0);

        // wait
        while (((GetTickCount() - starting_point) < change) && bTimer1on)
        {
            Sleep(10);   
        }
      
        // release key
        //keybd_event(virtual_key, scan_key, KEYEVENTF_KEYUP, 0);
        keybd_event(virtual_key, 0, KEYEVENTF_KEYUP, 0);

        if (virtual_key == VK_LEFT)
        {
            virtual_key = VK_RIGHT;
            scan_key = DIK_RIGHT;
        }
        else
        {
            virtual_key = VK_LEFT;
            scan_key = DIK_LEFT;
        }
    }
}
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Mon Sep 08, 2008 4:23 am    Post subject: Reply with quote

lol there are better methods than buying a USB joystick when bypassing keybd_event.

and btw, looking through ur source codes, i think most of them are really inefficient.

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
4ng3licDew
Cheater
Reputation: 0

Joined: 14 Feb 2008
Posts: 28

PostPosted: Mon Sep 08, 2008 6:20 am    Post subject: Reply with quote

@Bizarro: I had enough with people like you. If you have a better solution then let everyone hear it. All you are doing is putting people down. You are full of shit.

School bully will be severely punish!
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Mon Sep 08, 2008 11:40 am    Post subject: Reply with quote

4ng3licDew wrote:
@Bizarro: I had enough with people like you. If you have a better solution then let everyone hear it. All you are doing is putting people down. You are full of shit.

School bully will be severely punish!


Well, aren't you just the cutest thing to have ever congealed in a gutter.

By the way, abusing JoyToKey is nothing new.
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Mon Sep 08, 2008 5:30 pm    Post subject: Reply with quote

@4ng3licDew

I was a lil too lazy/stupid to figure it out myself, thanks for your explanation. An interesting approach but I'll stick with the port writing method. ^^
Back to top
View user's profile Send private message
4ng3licDew
Cheater
Reputation: 0

Joined: 14 Feb 2008
Posts: 28

PostPosted: Mon Sep 08, 2008 11:04 pm    Post subject: Reply with quote

@Flyte: If you have read all the links I provided in my first post. You would have known that I knew exploiting JoyToKey is nothing new.

For all people out there, you can inject your dll into another program and it will work. For example "On-Screen Keyboard".
In windows xp it is located at: C:\WINDOWS\system32\osk.exe
In windows 2000 it is located at: C:\WINNT\system32\osk.exe
(use your imagination, to find alternative programs to inject into)

A bit about myself, a few months ago I helped a kid to remove a virus from his computer. Through that interaction, he introduced me to the online game MapleStory. I thought to myself would it be nice to have a bot to help me level. So I set out to write a bot to play Maplestory. Today my bot is functional. It can move, attack, loot, use potions if need, and use skills. I would be lying if I say I did it on my own. The first people I would like to thanks are all the software engineers working at Microsoft because my bot make heavy use of the windows API and Detours.

On another topic: If you guys have studied at university level computer science you will know that nothing mentioned here at CEF is new. Now that's a big revelation.... not.

My next project is going to be kernel mode hooking and to create a gameguard bypass. Should be easy. I will not release my research results here because you guys are selfish and full of hot air.

Constructive criticism are welcome. Other useless comments will only prove to educated people that you are a Bloody Idiot.
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Mon Sep 08, 2008 11:39 pm    Post subject: Reply with quote

Welcome to the internet lol. For every person that appreciates your contribution there will be 3 more to flame you, tell you it's old and point out that you are noob, and they are awesome. Don't let it get to you.

GL with your next project.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Tue Sep 09, 2008 12:32 am    Post subject: Reply with quote

4ng3licDew wrote:
My next project is going to be kernel mode hooking and to create a gameguard bypass. Should be easy. I will not release my research results here because you guys are selfish and full of hot air.


You try too hard at pretending you know what the fuck you are talking about. I will enjoy watching you fail miserably, since it is easy as hell to tell when someone is "full of hot air". Also, anyone who studied "university level computer science" would know that keybd_event is a wrapper for SendInput(). Hell, anyone with a brain can see just how horrible your code example is.
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Tue Sep 09, 2008 2:26 am    Post subject: Reply with quote

Quote:
Constructive criticism are welcome. Other useless comments will only prove to educated people that you are a Bloody Idiot.

Bloody idiot? I sure hope you aren't referring to yourself. Educated people? You just proved that you aren't a member of this very elite group.
Posting your life story here? Please, it wouldn't even be worth a read in RS.
According to you, the DLL can be injected into any random process ie.
explorer.exe ntoskrnl.exe. If so, what's the point of using JoyToKey?
Quote:

On another topic: If you guys have studied at university level computer science you will know that nothing mentioned here at CEF is new. Now that's a big revelation.... not.

But of course, everything mentioned here, for example using PCOMDebug to inject a DLL in MS, has already been documented by engineers at Microsoft.
Quote:
My next project is going to be kernel mode hooking and to create a gameguard bypass. Should be easy. I will not release my research results here because you guys are selfish and full of hot air.

Yes, we will be terribly sorry for the loss of some second-rate, dangerous code. Not to mention, the thought of any random person being able to bypass GameGuard, would mean that iNCA would be out of business, and subsequently, bankrupt. Sure, it should be terribly easy for someone of your standard to make a GameGuard bypass.
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
Goto page Previous  1, 2
Page 2 of 2

 
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