title: Having trouble with microsoft detours
body: <p>I'm trying to do some basic hooking with microsoft detours and I can't get it to work. I've used essentially the code that was posted in this thread:</p>
  
  <p><a href="https://stackoverflow.com/questions/873658/how-can-i-hook-windows-functions-in-c-c">How can I hook Windows functions in C/C++?</a></p>
  
  <p>but no dice. I updated the send/receive functions in the DLL code to simply log the data to a file, and I tried having the main program hook into the "internet checkers" program, but a log file never gets created, so it appears that the dll wasn't injected.</p>
  
  <p>I'm running Windows 7 64-bit, Visual Studio 10.0, Detours 3.0 (my environment appears to be set up correctly, no issues building or anything). I created a DLL project, pasted in the DLL code from the link above, with send/recv updated as such:</p>
  
  <pre><code>FILE * pSendLogFile;
  fopen_s(&amp;pSendLogFile, "C:\\SendLog.txt", "a+");
  fprintf(pSendLogFile, "%s\n", buf);
  fclose(pSendLogFile);
  </code></pre>
  
  <p>and compiled. Then created another project, pasted in the main code from the link above, set it to look for the <code>chkrzm.exe</code> program (checkers), and hardcoded the DLL path to:</p>
  
  <pre><code>fullPath = "C:\\Users\\PM\\Documents\\Programs\\C Code\\Test\\DLLTester2\\Debug\\DLLTester2.dll";
  </code></pre>
  
  <p>and ran it, but no dice. Any idea why I can't get this to work?</p>