45 SC_HANDLE hServiceManager =
NULL;
46 SC_HANDLE hService =
NULL;
50 DWORD dwDisposition, dwError;
54 DPRINT(
"RegisterService()\n");
57 if (hServiceManager ==
NULL)
59 DPRINT1(
"OpenSCManager() failed!\n");
65 if (pszDisplayName ==
NULL)
67 DPRINT1(
"ReadString(IDS_DISPLAYNAME) failed!\n");
73 if (pszDescription ==
NULL)
75 DPRINT1(
"ReadString(IDS_DESCRIPTION) failed!\n");
87 L"%SystemRoot%\\system32\\svchost.exe -k netsvcs",
91 DPRINT1(
"CreateService() failed!\n");
99 &ServiceDescription) ==
FALSE)
101 DPRINT1(
"ChangeServiceConfig2() failed!\n");
107 L"System\\CurrentControlSet\\Services\\W32Time\\Parameters",
117 DPRINT1(
"RegCreateKeyEx() failed!\n");
122 pszValue =
L"%SystemRoot%\\system32\\w32time.dll";
131 DPRINT1(
"RegSetValueEx() failed!\n");
136 pszValue =
L"SvchostEntry_W32Time";
145 DPRINT1(
"RegSetValueEx() failed!\n");
176 DWORD dwDisposition, dwError;
180 L"System\\CurrentControlSet\\Services\\W32Time\\Parameters",
190 DPRINT1(
"RegCreateKeyEx() failed!\n");
203 DPRINT1(
"RegSetValueEx() failed!\n");
221 DWORD dwDisposition, dwError;
225 L"System\\CurrentControlSet\\Services\\W32Time\\TimeProviders\\NtpClient",
235 DPRINT1(
"RegCreateKeyEx() failed!\n");
241 L"SpecialPollInterval",
248 DPRINT1(
"RegSetValueEx() failed!\n");
284 DPRINT1(
"DllUnregisterServer()\n");
static HRESULT SetNtpClientValues(VOID)
static HRESULT RegisterService(VOID)
static PWSTR ReadString(_In_ UINT uID)
static HRESULT SetParametersValues(VOID)
STDAPI DllRegisterServer(void)
STDAPI DllUnregisterServer(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)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_OPTION_NON_VOLATILE
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, 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)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define W32TIME_POLL_INTERVAL
_In_ DWORD _In_ DWORD _Out_writes_to_opt_ pcchString LPSTR pszString
#define HKEY_LOCAL_MACHINE
#define SERVICE_CONFIG_DESCRIPTION
#define SC_MANAGER_CREATE_SERVICE
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SERVICE_WIN32_SHARE_PROCESS
#define SERVICE_AUTO_START
#define SERVICE_ERROR_NORMAL