Services.exe Request Handling
A version of this page is also available for
4/8/2010
Once a connect request has been received for a socket that has a particular service bound to it, Services.exe automatically calls the accept function and retrieves a connection socket. The retrieved socket is then passed to the service's exported xxx_IOControl (Services.exe) function for handling. The second parameter of this function, dwCode, is set to IOCTL_SERVICE_CONNECTION and the socket is passed in the third parameter, pBufIn. Services.exe will not close this socket. It is the service's responsibility to do this, even in the case that xxx_IOControl returns an error. Care must be taken to ensure that the socket is always closed inside the service.
Once a service handles an accepted socket using xxx_IOControl, the entire super services thread is blocked. The service should create a thread to handle a given request.