다음을 통해 공유


Configuring the SNTP Service (Windows Embedded CE 6.0)

1/6/2010

You can use Input/Output Controls (IOCTLs) to configure and manage the SNTP service. These IOCTLs are defined in Service.h and provide a standard method for managing services in Windows Embedded CE using Services.exe. To send an IOCTL to the service, the application must call the DeviceIoControl function on an open service handle. DeviceIoControl then calls the service-related xxx_IOControl (Services.exe) function, and passes in the IOCTL as the dwCode parameter.

The following table shows the IOCTLs that SNTP supports.

IOCTL Implementation

IOCTL_SERVICE_START

Standard

IOCTL_SERVICE_STOP

Standard

IOCTL_SERVICE_REFRESH

Standard

IOCTL_SERVICE_STATUS

Standard

IOCTL_SERVICE_CONTROL

Custom

For more information about using IOCTLs to manage a service, see Controlling a Running Service.

SNTP defines a customized input parameter (dwInBufSize) for the IOCTL_SERVICE_CONTROL IOCTL. The dwInBufSize parameter contains the size of the string, in bytes, including the terminating '\0' value. The lpinBuffer parameter in DeviceIoControl points to this null-terminated Unicode string. The following table shows the values and descriptions of these strings.

Value Description

Sync

Synchronizes the system with the external NTP server, and sets the time according to the settings defined in the registry.

Set

Synchronizes the system with the external NTP server, and forces the system time to be set, regardless of any time differences between system and server.

Update

Specifies that an external time update has occurred. If multicast is enabled, the time change will be broadcast.

If a notification subsystem is present on your system, SNTP listens for system wakeups and time changes. For more information about implementing a notification subsystem, see Implementing Notifications.

If your OS design includes the IP Helper API Catalog item, SNTP also listens to notifications of IP address changes. SNTP attempts to synchronize as soon as a connection to the network has been established. For more information about IP Helper, see Internet Protocol Helper APIs.

See Also

Tasks

SNTP Service Configuration Code Sample

Reference

Services.exe IOCTLS
xxx_IOControl (Services.exe)

Concepts

Simple Network Time Protocol (SNTP) OS Design Development
SNTP Registry Settings
Services.exe Registry Settings
Controlling a Running Service
IOCTLs that are Sent by Applications

Other Resources

CreateFile
DeviceIoControl