This job requires Windows expertise (and creativity) in the areas of DLL injection, code patching, and sockets. Here's the background: a DLL is being injected into the address space of a program for which we have no source code (this part is already implemented and working). The DLL needs to make a socket connection to a database elsewhere on the LAN as the program is starting up. This is the problem we need help solving, because the socket API is in another DLL ([url removed, login to view]) and MSDN says it's not safe to call into a DLL other than [url removed, login to view] from a DllMain (see MSDN quote in attachment). So there's a catch-22: the connection must be made at startup time but the only hook we have at startup time is DllMain which is not allowed to make a socket connection.
One idea might be for the DllMain to find the address of the main() function and modify it to call an initialization routine within the DLL as described above. This would be very flexible because at the point of entry to main() everything would be initialized and we could do anything we want. However, there may be other ways. We're looking for someone with the expertise to solve this elegantly and robustly.
1) An MSVC project written in C (not C++) containing a simple hello-world type test program and a DLL. The test program should link with the DLL but not use any functions from it directly. The DLL should connect to a socket at program startup time, get some information from it, and print that data to standard output. It does not matter what data it gets. For instance it could connect to port 80 of any webserver in the world and read back the error message, e.g.
% telnet [url removed, login to view] 80
# Method Not Allowed
The requested method HELLO is not allowed for the URL /.
* * *
Apache Server at [url removed, login to view] Port 80 Connection to [url removed, login to view] closed by foreign host. The important thing is to demonstrate the ability to use Winsock under control of the DLL via its startup routine as the test program is starting up, without the test program having to do anything explicitly. The method used must be able to work with any precompiled Win32 program (not just the test prog). Note that in actual use the DLL will be injected but it's sufficient for the test project to link with it explicitly. 2) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
3) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
4) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
Windows XP and up. Preferably Windows 2000 too.