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

1

How do I call a function inside a dll already injected into the process? example: I would like when I push a button on the form that I created, call the function asmFunction (); if I call the function inside the Main_Thread it works fine, but I have doubt to do this here is the code for 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;
}
    
asked by anonymous 22.01.2017 / 02:13

0 answers