How can I hook a windows api, any sample?
What do you mean by hooking a windows api? Can you tell what you have tried? Can you show code in language X which demonstrates what you want (of course mention the libraries you use there)?
in CSharp maybe:
[DllImport("user32.dll")]
public static extern int SetWindowsHookEx(
HookType idHook,
HookProc lpfn,
IntPtr hInstance,
int threadId
);
You code does not show what you actually want to achieve, but only how you import a function from a DLL (you are usign FFI). Since I never did FFI (on windows with rust) nor used WinAPI (in general), I used the terms "WinAPI" and "user32" to look something up on crates.io and discovered 2 crates, maybe they can help you:
The latter may be very low level though.
Cc @retep998