次の方法で共有


IOCTL_SERVICE_REGISTER_SOCKADDR (Compact 2013)

3/26/2014

This I/O control message is passed as an input parameter along with the sockaddr structure when Servicesd.exe calls the xxx_IOControl (Servicesd.exe) function to register a service. Send this message with DeviceIoControl.

Syntax

BOOL DeviceIoControl(
    HANDLE hDevice,          // handle to the device
    DWORD dwIoControlCode,   // use IOCTL_SERVICE_REGISTER_SOCKADDR
    LPVOID lpInBuffer,       // pointer to input buffer
    DWORD nInBufferSize,     // input buffer size
    LPVOID lpOutBuffer,      // pointer to output buffer
    DWORD nOutBufferSize,    // output buffer size
    LPDWORD lpBytesReturned, // number of bytes returned
    OVERLAPPED lpOverlapped  // pointer to OVERLAPPED structure
);

Parameters

  • hDevice
    [in] Handle to the device.
  • dwIoControlCode
    [in] The control code for the operation. Use IOCTL_SERVICE_REGISTER_SOCKADDR for this operation.
  • lpInBuffer
    [in] Pointer to a sockaddr structure specifying the protocol, port, and optionally the address that should be used for listening for a particular service.

Return Values

Returns TRUE if successful; otherwise, returns FALSE. To obtain extended error information, call the SetLastError function.

Remarks

Before Servicesd.exe listens on an incoming socket for a service, it will call the service's xxx_IOControl function with this IOCTL and with the sockaddr as the input parameters. If the service is willing to accept connections on this sockaddr, it will return TRUE. Otherwise, the service will return FALSE and the connection will not be processed.

The first time Servicesd.exe initializes a super service, it sets the input parameter to NULL to determine whether the service can support super services. The function returns TRUE if the service can support super services, and FALSE if it cannot. Sockets for super services are configured through the registry or a call to the ServiceAddPort function.

Requirements

Header

service.h

See Also

Reference

Servicesd.exe IOCTLS
xxx_IOControl (Servicesd.exe)
ServiceAddPort

Other Resources

sockaddr