title: How can I hook Windows functions in C/C++?
body: <p>If I have a function <code>foo()</code> that windows has implemented in kernel32.dll and it always returns true, can I have my program: "bar.exe" hook/detour that Windows function and make it return false for all processes instead?</p>
  
  <p>So, if my svchost, for example, calls <code>foo()</code>, it will return false instead of true. The same action should be expected for all other processes currently running.</p>
  
  <p>If so, how? I guess I'm looking for a system-wide hook or something.</p>