Jump to content

Call function from DLL


Recommended Posts

Well, I'll make a program that will serve as a GUI to make hooks. My program will inject a DLL made ​​in C ++ in a process. What I wanted to do is that when the hooked function was called the DLL somehow call a function in AutoIt with the parameters of the hooked function. 
In short I want the DLL call a function within my AutoIt program passing parameters.
Link to comment
Share on other sites

My DLL Code:

#include <windows.h>
#include <detours.h>
#include <stdio.h>

#define ADDRESS 0x4016B0
int (__cdecl* originalFunction)(int, int);

int hookedFunction(int a, int b)  
    // MyFunc(a, b); Example
    return originalFunction(a, b);

BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
    switch (dwReason)
        originalFunction = (int(__cdecl*)(int, int))DetourFunction((PBYTE)ADDRESS, (PBYTE)hookedFunction); //Magic
    return TRUE;

My AutoIt code:

Func MyFunc($a, $b)
   ConsoleWrite($a, $b)

While 1


could help me do this in my case?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...