Ive been trying to grasp the idea of handle inheritance and application memory is shared on windows compared to unix.
Since windows does not provide a fork(), or anything similar in fact, ive been reading into createprocess and handles.
I still cant get my head around how new process can read the handles passed to them from their parents. Ive looked at the msdn docs and it seems like ReadFile is the answer here but not sure how to read it.
What im trying to do, is client/server with server passing on socket. Im using Winsock1 so WSAduplicate is not an option. I read that sockets cant be passed, but they can be duplicated. (http://tangentsoft.net/wskfaq/articles/passing-sockets.html)
So long story short, lets say i pass a handle value (ex. 0x0000070) as a command line argument, how do i have that converted into a valid handle (ie Socket).
Cheers,
**Update I know the approach is not ideal and threads are a much better way of tackling this. But it has been explicitly requested from us to create child processes instead of threading.