#include "w32time.h"
#include <debug.h>
#include <strsafe.h>
Go to the source code of this file.
◆ ControlHandler()
Definition at line 214 of file w32time.c.
220 DPRINT(
"Stopping W32Time Service\n");
SERVICE_STATUS ServiceStatus
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
SERVICE_STATUS_HANDLE hStatus
#define SERVICE_CONTROL_STOP
#define SERVICE_STOP_PENDING
#define SERVICE_CONTROL_SHUTDOWN
Referenced by W32TmServiceMain().
◆ DllMain()
Definition at line 326 of file w32time.c.
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
#define DLL_PROCESS_ATTACH
#define DLL_PROCESS_DETACH
◆ GetIntervalSetting()
Definition at line 125 of file w32time.c.
134 L"SYSTEM\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpClient",
147 L"SpecialPollInterval",
static HANDLE ULONG_PTR dwData
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
#define RegCloseKey(hKey)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
#define HKEY_LOCAL_MACHINE
Referenced by W32TmServiceMain().
◆ InitService()
◆ SetTime()
Definition at line 163 of file w32time.c.
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");
static DWORD UpdateSystemTime(ULONG ulTime)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
#define ERROR_INVALID_DATA
ULONG GetServerTime(LPWSTR lpAddress)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
#define ERROR_GEN_FAILURE
#define RegCloseKey(hKey)
#define HKEY_LOCAL_MACHINE
Referenced by DECLARE_INTERFACE_(), W32TimeSyncNow(), and W32TmServiceMain().
◆ SystemSetTime()
Definition at line 21 of file w32time.c.
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI SetSystemTime(IN CONST SYSTEMTIME *lpSystemTime)
DWORD WINAPI GetLastError(VOID)
#define SE_PRIVILEGE_ENABLED
#define SE_SYSTEMTIME_NAME
#define GetCurrentProcess()
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)
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
#define TOKEN_ADJUST_PRIVILEGES
Referenced by UpdateSystemTime().
◆ UpdateSystemTime()
Definition at line 83 of file w32time.c.
DWORD WINAPI GetLastError(VOID)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
BOOL SystemSetTime(LPSYSTEMTIME lpSystemTime)
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Referenced by SetTime().
◆ W32TimeSyncNow()
◆ W32TmServiceMain()
Definition at line 240 of file w32time.c.
288 DPRINT(
"W32Time Service failed to set clock.\n");
290 DPRINT(
"W32Time Service successfully set clock.\n");
316 DPRINT(
"Stopped W32Time Service\n");
#define UNREFERENCED_PARAMETER(P)
#define SERVICE_ACCEPT_STOP
SERVICE_STATUS ServiceStatus
DWORD WINAPI GetLastError(VOID)
#define SERVICE_START_PENDING
DWORD dwServiceSpecificExitCode
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
SERVICE_STATUS_HANDLE hStatus
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
static WCHAR ServiceName[]
VOID WINAPI ControlHandler(DWORD request)
#define SERVICE_ACCEPT_SHUTDOWN
static DWORD GetIntervalSetting(VOID)
◆ hStatus
◆ hStopEvent
◆ ServiceName
WCHAR ServiceName[] = L"W32Time" |
|
static |
◆ ServiceStatus