Pelles C forum

C language => Windows questions => Topic started by: bitcoin on September 04, 2020, 02:03:37 AM

Title: Can you advise any WINAPI Hook lib?
Post by: bitcoin on September 04, 2020, 02:03:37 AM
Can you advise any Winapi hooking library?

I try Microsoft Detours, MinHook - but all this need C++ or C in Visual Studio..

How library can use with Pelles C?
Title: Re: Can you advise any WINAPI Hook lib?
Post by: John Z on September 04, 2020, 04:01:47 PM
Hi,

Have you looked at this one?
https://github.com/TsudaKageyu/minhook/releases

More details on it at
https://www.codeproject.com/Articles/44326/MinHook-The-Minimalistic-x-x-API-Hooking-Libra


Regards,
John Z
Title: Re: Can you advise any WINAPI Hook lib?
Post by: bitcoin on September 04, 2020, 09:31:35 PM
Hello,
I can't compile this code with Pelles , have error.
With VC++ it works good.
Title: Re: Can you advise any WINAPI Hook lib?
Post by: John Z on September 05, 2020, 02:30:02 PM
Hi,

Are you saying you can't compile the library or DLL sources or just the usage examples?
The DLL and Library sources are in straight C and even compile under MinGW so they do not need C++.

I can't compile this code with Pelles , have error.

Doesn't really give any information to be able to help you....

John Z
Title: Re: Can you advise any WINAPI Hook lib?
Post by: bitcoin on September 05, 2020, 03:22:16 PM
I compile DLL with VC++, because there are project (.sln) for Studio.
Then I try to build my DLL with .lib file , and have such error https://forum.pellesc.de/index.php?topic=9804.msg32897#msg32897

Can you give me a project (Pelles C), that works?

My code you can see in attach, it compile good, but not build!

Title: Re: Can you advise any WINAPI Hook lib?
Post by: algernon_77 on September 05, 2020, 11:47:23 PM
Hello there!

I compiled MinHook from sources using VS2019 Community, but changed a few thigs in projects properties (no function level linking, no linktime code generation, compile as C, and possibly more :-) )
Then I opened your project, copied MinHook dll and import library and it works now. You have both projects attached below. The initial linker error may have had something to do with COMDAT section from the default MinHook lib build, but I'm not sure, to be honest. Hope it helps!

 
Title: Re: Can you advise any WINAPI Hook lib?
Post by: bitcoin on September 06, 2020, 09:28:27 PM
algernon_77, thank you! This works good!