Making Trainers Using C++ And ASM [Maple Story]

Posts 115 of 18 · Page 1 of 2
Making Trainers Using C++ And ASM [Maple Story]
So yea guys, I'm bored.

Well most of you want to make trainers, but you must know that in the beggining it's hard to learn the syntax of a language.
I wanted to become a good coder but I usually had no way to start, So I know how it feels...

That's why I am writing this tutorial for those of you who want to create/make trainers.

In this part (Part 1) I will be covering the injection method that I use to inject trainers into MapleStory. In the end of this tutorial you should be able to inject your .DLL into MapleStory process using any Injector program.

Okey, Let's start:
First you need to download

Visual C++ 2010

After you have it downloaded

Run your Visual C++ 2010 And select this:



After the selection of New Project.. you should see this window:



Select Win32 Project and name it whatever you want, for this tutorial I will be using:

"Tutorial" as project name or namespace.

After clicking next, should pop-up a window with "Previous", "Next", "Finish", "Cancel", click Next.

Select .DLL and Empty Project like this:




And click "Finish"

If all went right you should have something like this:



Right Click > Source Files > Add > New Item > And Select A .cpp type, name it MainDLL

This will be your Main DLL, the thing that will inject your trainer into MapleStory Process.

Now, Right Click > Header Files > Add > New Item > New Form, name it Form1 and proceed, a new window should pop up. Click YES

If all went right you should have something like this:




To keep it neat and clean, I usually move Form1.cpp to Source Files.

Anyway, Let's start with our code.

Double click Main DLL & add this:

Code:
#include <windows.h>

extern void Main(void);

::BOOL WINAPI DllWork ( __in ::HMODULE hModule )
{
 Main();
 return true;
}

::BOOL WINAPI DllMain ( __in ::HMODULE hModule, __in ::DWORD dwReason, __in __reserved ::LPVOID lpvReserved )
{
 ::HANDLE hThread = NULL;
if ( dwReason == DLL_PROCESS_ATTACH ) 
 {
  if (( hThread = ::CreateThread(NULL, 0, (::LPTHREAD_START_ROUTINE)&DllWork, (::HMODULE)hModule, 0, NULL) ) == NULL ) 
  {
   return FALSE;
  }
  if ( ::CloseHandle(hThread) == FALSE )
  {
                      //do nothing
  }
 }
 return TRUE;
}

This will be your code to inject into MapleStory Process, now move to your Form1.h > Right Click > View Code

Under #pragma once, write

Code:
#include <Windows.h>
This will call our Windows API for Win32 Projects.

Now Double click your Form1.cpp and add this under #include "Form1.h":

Code:
using namespace Tutorial; // Your Project Name

void Main(void)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew Form1); // Your Form Name
Application::Exit();
}


Now press F7 and If everything went fine, you should have a .DLL file in your Release Folder of your project.

Pick it up, inject into MapleStory Process and it should pop up normally .
Part 2
In this tutorial, I will cover how to implement simple scripts of ASM into C++ (with db operation).

Now your asking, what is db operation?

Well as you can see db is define bytes, it's a script that has bytes to enable instead of opcodes. Normally, bytes can replace all the opcodes.

Anyway, open your project,

Right Click Header Files > Add > New Item.. > Header File (.h) name it "Hacks" for this tutorial.

Anyway after adding Hacks.h to your Header Files, write this code:

Code:
#include <Windows.h>
Now Right click your Header Files again > Add > New Item.. > Header File (.h) name it "Functions" for this tutorial.

As you did in hacks.h you should add this:

Code:
#include <Windows.h>
To your functions.h

If everything went fine you'll have this now:



Open your Functions.h and put this code:

Code:
void WriteMemory( unsigned long ulAddress, unsigned char ucAmount, ...)   
{ 
     DWORD dwOldProtect; 
     VirtualProtect((void*)ulAddress, ucAmount, PAGE_EXECUTE_READWRITE, &dwOldProtect);
 
   va_list* va = new va_list; 
   va_start(*va, ucAmount); 
 
   for (unsigned char ByteToWrite = va_arg(*va, unsigned char), ucIndex = 0; ucIndex < ucAmount; ucIndex++, ByteToWrite = va_arg(*va, unsigned char)) 
   { 
      *(unsigned char*)(ulAddress + ucIndex) = ByteToWrite; 
   } 
 
   va_end(*va); 
   delete va; 
 
   VirtualProtect((void*)ulAddress, ucAmount, dwOldProtect, &dwOldProtect);
}
This will be the code to read and protect your ASM Script.

Protect is used to make your hack-non-crashable, Able to write memory.


Anyway, now let's pick our ASM Script.

I will be using my LBGM Script with dBytes instead of opcodes.

Code:
[enable]
009C2087:
db 83 C6 1E
[disable]
009C2087:
db 83 EE 1E
You can see that we have 3 bytes to enable and 3 bytes to disable.

So double click Hacks.h and write this:

Code:
#include "Functions.h"
And this:


Code:
DWORD BlinkGodmode = 0x009C2087;
This is a dword for your Address, DWORD = 4 Bytes always.
This will keep your Address as BlinkGodmode to use in your code later on.

Now you should assign your function,

Code:
void BlinkGodmodeFunction(bool fEnable)
{
 if(fEnable)
 {
WriteMemory(BlinkGodmode, 3, 0x83, 0xC6, 0x1E);
}
else
 { 
WriteMemory(BlinkGodmode, 3, 0x83, 0xEE, 0x1E);
 }
}
First we void the BlinkGodModeFunction to enable at Form1 Later on.
After voiding, we use the function "WriteMemory" To read the Address, the number of bytes and the bytes.

As you can see the Script has 3 bytes like I said before, so you do the DWORD named "BlinkGodMode" first then, numberofbytes, in this case their 3, then assign all the bytes with a "0x" before.

0x is used to represent a HEX value used to translate bytes into C++.

So let's see, if

83 is a byte, to translate to C++ we do:

0x83. Pretty simple.

Now move into your Form1.h Design mode.

Add a checkBox to your form and double click it, you'll have this:



Since we're going to use a body at Form1.cpp, destroy that body deleting those {} brackets (NOTE: Only those 2) and add ; after ) so it will be:



Get back to your Form1.cpp and include this:

Code:
#include "Hacks.h"
& void your checkBox like this:

Code:
void Form1::checkBox1_CheckedChanged(System::Object^  sender, System::EventArgs^  e)
{
          BlinkGodmodeFunction(this->checkBox1->Checked);
}
If you pay attention, this function is the one in your Hacks.h to enable the hack.

Build everything, inject and if you use a working bypass, It will work as Long Blink Godmode.


Credits : Novas
--RESERVED--
--RESERVED--
Looks very nice. I will read it after my class. Getting late for it. Thanks for mentioning the original author.
Quote Originally Posted by Hassan View Post
Looks very nice. I will read it after my class. Getting late for it. Thanks for mentioning the original author.
No probs. It's his work anyways
thanks for the tuts. Even though i dont play maple story it may be useful
Quote Originally Posted by ___guilherme___ View Post
thanks for the tuts. Even though i dont play maple story it may be useful
Mhmm.. You're learning programming? If you have any enquirers you can drop me an e-mail
Good job, but it is not the syntax that is hard to learn it is how you take the syntax and the rules you know to usage in a real world scenario like this one. Well in my opinion.
Thank you very much!
I was looking for that

Btw,how i can make a off function?
It will be same or different?
Could you tell me what LBGM Script is?

I want to make this for another game,but i dont know what that 3byte thingie is Oo

i only got adresses like
0x009C2087
can this also be used with v83, i just have to un update the source ritght?
Mine is always like this whenever i press F7 on part 1
1>------ Build started: Project: Maplestory Trainer, Configuration: Debug Win32 ------
1> Form1.cpp
1>Form1.cpp(3): error C2871: 'Tutorial' : a namespace with this name does not exist
1>Form1.cpp(7): error C2653: 'Application' : is not a class or namespace name
1>Form1.cpp(7): error C3861: 'EnableVisualStyles': identifier not found
1>Form1.cpp(8): error C2653: 'Application' : is not a class or namespace name
1>Form1.cpp(8): error C3861: 'SetCompatibleTextRenderingDefault': identifier not found
1>Form1.cpp(9): error C2653: 'Application' : is not a class or namespace name
1>Form1.cpp(9): error C2061: syntax error : identifier 'Form1'
1>Form1.cpp(9): error C3861: 'Run': identifier not found
1>Form1.cpp(10): error C2653: 'Application' : is not a class or namespace name
1>Form1.cpp(10): error C3861: 'Exit': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This looks intriguing, directly to the point of what I wanted: MAKING TRAINER FOR A GAME

I am a very impatient person, I could never learn C++ ,
but somehow I managed to pick up on HTML/CSS/Java script/CMD/.vbs and .bat files.
hold on let me check on those errors

c++ is much more how do i say, more things to take note off rather then Java/CSS and .bat
Quote Originally Posted by akimo360 View Post
hold on let me check on those errors

c++ is much more how do i say, more things to take note off rather then Java/CSS and .bat
My problem is I could never get Bloodshed dev-C++ compiler to even compile the example programs they had... IT was as if they messed up on it, or maybe it's an example to find where the problems are?
Posts 115 of 18 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?