次の方法で共有


Registering a Super Service Automatically (Windows Embedded CE 6.0)

1/6/2010

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 and port. Super services sockets can only be bound to TCP/IP ports. Both IPv4 and IPv6 are supported.

See Also

Reference

xxx_IOControl (Services.exe)
ActivateService
xxx_Init (Services.exe)

Concepts

Super Services

Other Resources

sockaddr