21 Jan 2009 @ 9:27 PM 

I created this class to facilitate some routine tasks when modding or hooking software. If you dont know what hooking is or how to use .dll’s it is of no use to your. It also bridges the gap between oop and asm a little, I try to give you the best of asm in a oop format.

Features

  • Console – debugging console similar to cmd, it provides a easy i/o for target application data or information you need from your .dll
  • jmpPatch – most people know what a jmp patch is, this has your generic one
  • stripJmpPatch – this will place a jmpPatch to functions that are members of a class, they dont have to be naked.
  • keyhook – you can easily hook the window class or you can use getasynckeystate. You just pass it your function.
  • other stuff – message boxes and such

In a Nutshell

This class does all the work for you, just create the project and pass a function into the constructor and it will take care of the threading. The function you pass to it is the main function of the thread that is started, in this function you can handle key input or whatever manipulations you wish.

How to use

This is for use with Visual Studio, as I use masm syntax in the inline asm. Basically you make a VS c++ project of “.dll” type, then you include modtoolz.h class. If you dont know how to do that, just stop now. If you want a in depth “noob” tutorial, I wrote one here.

add these to your stdafx.h

#include <stdio.h>
#include <iostream>
#include <io.h>
#include <stdio.h>
#include <fstream>
using namespace std;

Everything happens when you call the constructor (as it should with oop). So in your main.cpp you could call the constructor like this

#include ModTools.h
// other stuff
// modtools constructor one
ModTools mt("window name", &myEngine);

If you did it like that you would have to have a function “myFunction” that you could handle events and keys. The function you pass into it with this constructor gets started in the thread, so when that function terminates, so does the thread. You need a while loop and some stuff like so

1
2
3
4
5
6
7
8
9
10
long WINAPI myEngine(long lparam)
{
while(1){																		// this goes forever, so your thread stays alive
Sleep(10);																// ~10 millisecond delay so it dont lag
// if they hit f12 turn on the console
if(GetAsyncKeyState(VK_F12) == -32767)
{
mt.Console();
}
}// end the while loop

that function would toggle the console on/off with the press of F12. Of course you could make it do any action based on any keys, for instance call a function inside the program, or change a memory value inside the program. Since you are inside the program in your .dll you can change anything or call the programs functions.

The above method is easy and does work fine; however, there is another constructor that you can also use which is more efficent. The second constructor (that you can use) hooks directly into the window, this allows you to handle key input better.

You can use the second constructor like so

1
2
3
#include ModTools.h
// second constructor
ModTools mt("brood war", &amp;KeyHandler);

In this case you can only pass it a keyhandler, anything that takes time to process that is in this “keyhandler” function will lag the target application instantly. If you wish to do heavy processing and queues and such either make a new thread or jmpPatch to another function in your code.

Anyway this is what a keyhandler function looks like

1
2
3
4
5
6
7
8
9
bool KeyHandler(int keyCode)
{
// Is key ~ pressed?
if (keyCode == VK_OEM_3)
{
// DO SOMETHING
}
return FALSE;
}

This second constructor is more advanced and I do not recommend you use it unless you know what you are doing. That said, the second constructor is the way to go if you want to make really good applications.

If you are still confused I made a tutorial on another site that is pretty informational. You can acess that here. In that tut I show how to use the modtools.h class to do stuff with the game starcraft.

You can download modtools.h here modtools-v02

Posted By: Michael
Last Edit: 21 Jan 2009 @ 09:27 PM

EmailPermalinkComments (0)
Tags
 21 Jan 2009 @ 9:27 PM 

I created this class to facilitate some routine tasks when modding or hooking software. If you dont know what hooking is or how to use .dll’s it is of no use to your. It also bridges the gap between oop and asm a little, I try to give you the best of asm in a oop format.

Features

  • Console – debugging console similar to cmd, it provides a easy i/o for target application data or information you need from your .dll
  • jmpPatch – most people know what a jmp patch is, this has your generic one
  • stripJmpPatch – this will place a jmpPatch to functions that are members of a class, they dont have to be naked.
  • keyhook – you can easily hook the window class or you can use getasynckeystate. You just pass it your function.
  • other stuff – message boxes and such

In a Nutshell

This class does all the work for you, just create the project and pass a function into the constructor and it will take care of the threading. The function you pass to it is the main function of the thread that is started, in this function you can handle key input or whatever manipulations you wish.

How to use

This is for use with Visual Studio, as I use masm syntax in the inline asm. Basically you make a VS c++ project of “.dll” type, then you include modtoolz.h class. If you dont know how to do that, just stop now. If you want a in depth “noob” tutorial, I wrote one here.

add these to your stdafx.h

#include <stdio.h>
#include <iostream>
#include <io.h>
#include <stdio.h>
#include <fstream>
using namespace std;

Everything happens when you call the constructor (as it should with oop). So in your main.cpp you could call the constructor like this

#include ModTools.h
// other stuff
// modtools constructor one
ModTools mt("window name", &myEngine);

If you did it like that you would have to have a function “myFunction” that you could handle events and keys. The function you pass into it with this constructor gets started in the thread, so when that function terminates, so does the thread. You need a while loop and some stuff like so

1
2
3
4
5
6
7
8
9
10
long WINAPI myEngine(long lparam)
{
while(1){																		// this goes forever, so your thread stays alive
Sleep(10);																// ~10 millisecond delay so it dont lag
// if they hit f12 turn on the console
if(GetAsyncKeyState(VK_F12) == -32767)
{
mt.Console();
}
}// end the while loop

that function would toggle the console on/off with the press of F12. Of course you could make it do any action based on any keys, for instance call a function inside the program, or change a memory value inside the program. Since you are inside the program in your .dll you can change anything or call the programs functions.

The above method is easy and does work fine; however, there is another constructor that you can also use which is more efficent. The second constructor (that you can use) hooks directly into the window, this allows you to handle key input better.

You can use the second constructor like so

1
2
3
#include ModTools.h
// second constructor
ModTools mt("brood war", &amp;KeyHandler);

In this case you can only pass it a keyhandler, anything that takes time to process that is in this “keyhandler” function will lag the target application instantly. If you wish to do heavy processing and queues and such either make a new thread or jmpPatch to another function in your code.

Anyway this is what a keyhandler function looks like

1
2
3
4
5
6
7
8
9
bool KeyHandler(int keyCode)
{
// Is key ~ pressed?
if (keyCode == VK_OEM_3)
{
// DO SOMETHING
}
return FALSE;
}

This second constructor is more advanced and I do not recommend you use it unless you know what you are doing. That said, the second constructor is the way to go if you want to make really good applications.

If you are still confused I made a tutorial on another site that is pretty informational. You can acess that here. In that tut I show how to use the modtools.h class to do stuff with the game starcraft.

You can download modtools.h here modtools-v02

Posted By: admin
Last Edit: 21 Jan 2009 @ 09:27 PM

EmailPermalinkComments (0)
Tags
Change Theme...
  • Users » 5
  • Posts/Pages » 71
  • Comments » 62
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Contact Me



    No Child Pages.

Front



    No Child Pages.