0

i am currently stuck in the process of trying to create a wrapper DLL for another DLL which i want to replace but then include in my own created DLL.

When the dll is getting attached by the main program i would load the original DLL and then setup a hook function that let's me decide what i want to send to the original DLL function.

I already have the basic structure to import the dll, but my problem is that i don't really know what the best way of doing it is, because i only want to hook one function and the others should still just work normally without me doing anything.

Is there an easier solution than defining every function and just redirecting it to the original DLL? And also how would i even make it that my DLL function is exactly the same as the original one? I got a basic prototype but i don't know if i need anything else:

typedef int(__cdecl *PROC_cef_parse_url)(
    const cef_string_t* url,
    cef_urlparts_t* parts
);

And i can call it probably like this:

PROC_cef_parse_url _cef_parse_url = (PROC_cef_parse_url) GetProcAddress(hModule, "cef_parse_url");

But because i actually have no idea if this works or not and have no experience in DLL creation and stuff like this, i wanted to ask if i need something else, or if someone can provide me with an easy example.

Leon Marzahn
  • 341
  • 4
  • 15
  • https://stackoverflow.com/q/4507581/17034 – Hans Passant Feb 23 '18 at 07:22
  • You always build CEF from source. Proper way to do it is to change the source. – Hans Passant Feb 23 '18 at 07:30
  • @HansPassant Yeah, that would be possible, but i would like to make the modification as small as possible. I would prefer to just inject something and then i can hook this function in particular. Essentally i just want to change the return of this function. – Leon Marzahn Feb 23 '18 at 07:34

0 Answers0