134 L"SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpClient",
147 L"SpecialPollInterval",
169 DWORD cbName =
sizeof(szData);
171 DPRINT(
"Entered SetTime.\n");
174 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DateTime\\Servers",
186 cbName =
sizeof(szData);
192 DPRINT(
"Time Server is '%S'.\n", szData);
195 if (cbName == 0 || szData[0] ==
'\0')
197 DPRINT(
"The time NTP server couldn't be found, the string is empty!\n");
220 DPRINT(
"Stopping W32Time Service\n");
292 L"SYSTEM\\CurrentControlSet\\Services\\W32Time\\Parameters",
297 cbData =
sizeof(szData);
300 bNoSync = (
_wcsicmp(szData,
L"NoSync") == 0);
309 DPRINT(
"W32Time Service failed to set clock: 0x%08lX\n",
error);
333 DPRINT(
"Stopped W32Time Service\n");
368 DPRINT(
"W32TimeSyncNow failed and clock not set.\n");
372 DPRINT(
"W32TimeSyncNow succeeded and clock set.\n");
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
#define DLL_PROCESS_ATTACH
#define DLL_PROCESS_DETACH
#define GetCurrentProcess()
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
BOOL WINAPI SetSystemTime(IN CONST SYSTEMTIME *lpSystemTime)
static IN DWORD IN LPVOID lpvReserved
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static HANDLE ULONG_PTR dwData
#define UNREFERENCED_PARAMETER(P)
ULONG GetServerTime(LPWSTR lpAddress)
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc)
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
DWORD dwServiceSpecificExitCode
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
static WCHAR ServiceName[]
DWORD WINAPI W32TimeSyncNow(LPCWSTR cmdline, UINT blocking, UINT flags)
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
SERVICE_STATUS_HANDLE hStatus
static DWORD GetIntervalSetting(VOID)
static DWORD UpdateSystemTime(ULONG ulTime)
VOID WINAPI ControlHandler(DWORD request)
VOID WINAPI W32TmServiceMain(DWORD argc, LPWSTR *argv)
SERVICE_STATUS ServiceStatus
BOOL SystemSetTime(LPSYSTEMTIME lpSystemTime)
#define W32TIME_POLL_INTERVAL
DWORD WINAPI GetLastError(void)
#define ERROR_GEN_FAILURE
#define ERROR_INVALID_DATA
#define SE_SYSTEMTIME_NAME
#define HKEY_LOCAL_MACHINE
#define SERVICE_ACCEPT_STOP
#define SERVICE_STOP_PENDING
#define SERVICE_CONTROL_SHUTDOWN
#define SERVICE_START_PENDING
#define SERVICE_CONTROL_STOP
#define SERVICE_ACCEPT_SHUTDOWN
#define TOKEN_ADJUST_PRIVILEGES
#define SE_PRIVILEGE_ENABLED