I want to intercept an API function call. I am writing a TCP/IP tunneling program and need to intercept all calls to winsock32.dll and then make those calls from with in my program. I do not want to use any 3d party utilities (like SoftICE) or replace the winsock32.dll. So how do I do this programmically? What can I do in C/C++ or ASM to intercept these or any other API calls before windows calls the code in the approiate DLL?
I remember using a program called AutoSOCKS that captured the TCP/IP information and automatically entered necessary proxy information so it appeared that your system was directly connected to the internet. They did not replace the winsock32.dll file to do this either.
If needed, I will add more points to the question.