About making memory writing dll.

Posts 1–7 of 7 · Page 1 of 1
About making memory writing dll.
Umm. Its like a dll that you inject into the process.
When you pressed something, it'll write the memory of process.
I've had tried to make trainers in Visual Basic and now i wanted to try to make a dll like it in C++ but NOT C# or other programming tools.
Any help? Please? I would be extremely grateful if some of you can help me.

PS: I've tried googling. Results = fail
helping you = giving you a source code to copy and paste ?
Quote Originally Posted by Biesi View Post
helping you = giving you a source code to copy and paste ?
Let's make him sad with pseudocode:

1. Get the baseaddress of the executable with GetModuleInformation

2. (optional) Get addresses from multi-level pointers

3. Write to memory with the power of ugly ass c casts

EDIT: So I wrote a simple dll memory hack for you...

This is the target source:

Code:
#include <windows.h>
#include <cstdio>

#pragma comment(lib, "User32.lib")

class Player
{
    public:
    int GetHP();
    void Hurt();
    Player();
    private:
    int HP;
};

int Player::GetHP()
{
    return HP;
}

void Player::Hurt()
{
    HP -= 3;
}

Player::Player()
{
    HP = 100;
}

int main()
{
    Player p;
    while(!GetAsyncKeyState(VK_ESCAPE))
    {
        printf("Health is at %d\n", p.GetHP());
        getchar();
        p.Hurt();
    }
    return 0;
}

And here is the source for the hack:

Code:
#include <windows.h>
#include <Psapi.h>

#pragma comment(lib, "Kernel32.lib")
#pragma comment(lib, "Psapi.lib")

void Hack()
{
    MODULEINFO mi;
    if(!GetModuleInformation(GetCurrentProcess(), GetModuleHandle(NULL), &mi, sizeof(MODULEINFO)))
    {
        ExitProcess(-1);
    }
    else
    {
        DWORD oldProtection;
        DWORD HPDecreaseAddress = (DWORD)mi.lpBaseOfDll + 0x101C;

        if(!VirtualProtect((LPVOID)HPDecreaseAddress, 3, PAGE_EXECUTE_READWRITE, &oldProtection))
        {
            ExitProcess(-1);
        }
        else
        {
            for(int n = 0; n < 3; n++)
            *(BYTE*)(HPDecreaseAddress + n) = 0x90;
        }
    }
}

BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:
            Hack();
            break;
    }
    return FALSE;
}


Um ya. I've got the base address and the offsets of all, and because I learned VB 1st, now its hard to learn this C++, and can you please just make 1 copy and paste source code for me like ReadWritingMemory.vb in C++?
Quote Originally Posted by buxkaizhe View Post
Um ya. I've got the base address and the offsets of all, and because I learned VB 1st, now its hard to learn this C++, and can you please just make 1 copy and paste source code for me like ReadWritingMemory.vb in C++?
I wrote a memory hack for you already. For further assistance please look here.
Why don't you just take your VB trainer and translate it to C/++?
How could you translate from a language you don't know, to another language you don't know. : p
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us