need some help with function detouring

Keinshen1

New Member
Joined
Nov 3, 2019
Messages
3
Likes
0
Points
1
Location
Uganda
1
#1
Hi,
I new in this so sorry if I act silly...

I've tried to recall "addMessageToChatWindow" from s0beit(or d3d9.dll module)
[ SCREENSHOTS IN THE ATTACHMENTS ]

I wrote this on my blank CPP project:
Code:
#include <Windows.h>
#include <iostream>

void Main()
{
    DWORD dwS0b = (DWORD)GetModuleHandleA("d3d9.dll");

    while (true) {
        if (GetAsyncKeyState(VK_INSERT))
            ((void(__cdecl*)(const char* a1))(dwS0b + 0x83550))("Test 123");
    }
}

BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) {
    static HANDLE hThread;

    switch (dwReason)
    {
    case DLL_PROCESS_DETACH:
        if (hThread)
            TerminateThread(hThread, 0);
        break;

    case DLL_PROCESS_ATTACH:
        DisableThreadLibraryCalls(hModule);
        hThread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Main, 0, 0, 0);
        break;
    }
    return TRUE;
}
And seems like it's crashing...
Can someone tell me why or give me an example of how it should be ?
 

Attachments

OP
OP
Keinshen1

Keinshen1

New Member
Joined
Nov 3, 2019
Messages
3
Likes
0
Points
1
Location
Uganda
1
#3

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,060
Likes
105
Points
208
#6
Where do you get the THIS pointer? Your class? Or exactly the same as in your linked CChat.cpp?
Please post a crashlog.
 
Top