Registering a Super Service Automatically (Windows CE 5.0)
It is possible for a super service to be started automatically on Services.exe initialization at system startup. It can also be started automatically when the ActivateService function is called on a given service. Services.exe will call the service xxx_IOControl (Services.exe) function and pass the IOCTL_SERVICE_REGISTER_SOCKADDR value after calling xxx_Init (Services.exe) if the SERVICE_INIT_STOPPED flag has been set in the Context registry value of the particular service. If the service has the potential to be run from a super service, xxx_IOControl will return TRUE, otherwise it will return FALSE and Services.exe will not proceed further.
If super service support exists, then the ports for the given service will be bound before any other services can be initialized. The protocols are listed as subkeys located in the registry under HKEY_LOCAL_MACHINE\Services\<Service>\Accept\. In the following example, a Telnet server is configured to listen on TCP ports 23 and 24.
[HKEY_LOCAL_MACHINE\Services\TELNETD]
"Context"=0x00000001 //SERVICE_INIT_STOPPED, use super server
[HKEY_LOCAL_MACHINE\Services\TELNETD\Accept\TCP-23]
; TCP port 23, default Telnet Port
"SockAddr"=hex:02,00,00,17,00,00,00,00,00,00,00,00,00,00,00,00
[HKEY_LOCAL_MACHINE\Services\TELNETD\Accept\TCP-24]
; Also listen on TCP port 24
"SockAddr"=hex:02,00,00,18,00,00,00,00,00,00,00,00,00,00,00,00
After each new socket has been bound successfully, the socket address associated with it will be passed to the service by a call to xxx_IOControl. If xxx_IOControl returns FALSE, then the socket will be closed.
The SockAddr is a hexadecimal value that specifies a sockaddr data structure. This contains the protocol, port, and optionally the address that should be used for listening for a particular service. Although in the previous example both ports are using TCP/IP, any protocol on the device that is supported through the Winsock interface may be bound to by using an appropriate SockAddr value.
See Also
Super Services | xxx_IOControl (Services.exe) | ActivateService | xxx_Init (Services.exe) | sockaddr
Send Feedback on this topic to the authors