How to call a function from an already injected dll(c++)?

Asked

Viewed 100 times

1

how do I call a function within a DLL already injected into the process? example: I would like when I press a button on the form I created, to call the asmFunction() function; if I call the function inside the main_thread works very well, but I doubt to do it Here is the code of my dll.

#include <Windows.h>
extern int UiMain();
DWORD WINAPI Main_Thread(LPVOID lpParam) {
    UiMain();
    return S_OK;
}
void asmFunction(DWORD x,DWORD y,DWORD adressToCall) {
    __asm {
        push x
            push y
            call adressToCall
    };
}
BOOL APIENTRY DllMain(HMODULE hModule,DWORD _reason,LPVOID lpReserved) {
    if (_reason == DLL_PROCESS_ATTACH) {
        CreateThread(0, 0x1000, &Main_Thread, 0, 0, NULL);
    }
    return TRUE;
}
  • 1

    you just need to reference the function and call it somewhere in the code. The same is done with the .h

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.