23 PWSTR pszString, pszPtr;
34 if (pszString ==
NULL)
47 SC_HANDLE hServiceManager =
NULL;
48 SC_HANDLE hService =
NULL;
52 DWORD dwDisposition, dwError;
56 DPRINT(
"RegisterService()\n");
59 if (hServiceManager ==
NULL)
61 DPRINT1(
"OpenSCManager() failed!\n");
67 if (pszDisplayName ==
NULL)
69 DPRINT1(
"ReadString(IDS_DISPLAYNAME) failed!\n");
75 if (pszDescription ==
NULL)
77 DPRINT1(
"ReadString(IDS_DESCRIPTION) failed!\n");
89 L"%SystemRoot%\\system32\\svchost.exe -k netsvcs",
98 DPRINT1(
"CreateService() failed!\n");
106 &ServiceDescription) ==
FALSE)
108 DPRINT1(
"ChangeServiceConfig2() failed!\n");
114 L"System\\CurrentControlSet\\Services\\W32Time\\Parameters",
124 DPRINT1(
"RegCreateKeyEx() failed!\n");
129 pszValue =
L"%SystemRoot%\\system32\\w32time.dll";
138 DPRINT1(
"RegSetValueEx() failed!\n");
152 DPRINT1(
"RegSetValueEx() failed!\n");
183 DWORD dwDisposition, dwError;
187 L"System\\CurrentControlSet\\Services\\W32Time\\Parameters",
197 DPRINT1(
"RegCreateKeyEx() failed!\n");
210 DPRINT1(
"RegSetValueEx() failed!\n");
228 DWORD dwDisposition, dwError;
232 L"System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpClient",
242 DPRINT1(
"RegCreateKeyEx() failed!\n");
248 L"SpecialPollInterval",
255 DPRINT1(
"RegSetValueEx() failed!\n");
292 SC_HANDLE hServiceManager, hService;
295 if (!hServiceManager)
static HRESULT SetNtpClientValues(VOID)
static HRESULT RegisterService(VOID)
static PWSTR ReadString(_In_ UINT uID)
static UINT UnregisterService(VOID)
static HRESULT SetParametersValues(VOID)
#define RegCloseKey(hKey)
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
#define HeapFree(x, y, z)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
HRESULT WINAPI DllRegisterServer(void)
HRESULT WINAPI DllUnregisterServer(void)
#define REG_OPTION_NON_VOLATILE
_In_opt_ LPCSTR _In_opt_ LPCSTR pszValue
#define SERVICE_CONFIG_DESCRIPTION
#define SC_MANAGER_CREATE_SERVICE
#define SERVICE_CHANGE_CONFIG
BOOL WINAPI DeleteService(SC_HANDLE hService)
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
SC_HANDLE WINAPI CreateServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, LPCWSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword)
BOOL WINAPI ChangeServiceConfig2W(SC_HANDLE hService, DWORD dwInfoLevel, LPVOID lpInfo)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
#define W32TIME_POLL_INTERVAL
DWORD WINAPI GetLastError(void)
WINBASEAPI _In_ DWORD nLength
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
#define ERROR_SERVICE_MARKED_FOR_DELETE
#define ERROR_SERVICE_DOES_NOT_EXIST
#define ERROR_SERVICE_EXISTS
#define HKEY_LOCAL_MACHINE
#define SERVICE_WIN32_SHARE_PROCESS
#define SERVICE_AUTO_START
#define SERVICE_ERROR_NORMAL