mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 12:14:32 +00:00
[SERVICES] Add basic support for setting lpServiceStartName via RChangeServiceConfigW().
This commit is contained in:
parent
a987856e71
commit
9d43950db7
1 changed files with 33 additions and 16 deletions
|
@ -2179,28 +2179,45 @@ RChangeServiceConfigW(
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpPassword != NULL)
|
/* Start name and password are only used by Win32 services */
|
||||||
|
if (lpService->Status.dwServiceType & SERVICE_WIN32)
|
||||||
{
|
{
|
||||||
if (*(LPWSTR)lpPassword != 0)
|
/* Write service start name */
|
||||||
|
if (lpServiceStartName != NULL && *lpServiceStartName != 0)
|
||||||
{
|
{
|
||||||
/* FIXME: Decrypt the password */
|
dwError = RegSetValueExW(hServiceKey,
|
||||||
|
L"ObjectName",
|
||||||
/* Write the password */
|
0,
|
||||||
dwError = ScmSetServicePassword(lpService->szServiceName,
|
REG_SZ,
|
||||||
(LPCWSTR)lpPassword);
|
(LPBYTE)lpServiceStartName,
|
||||||
|
(DWORD)((wcslen(lpServiceStartName) + 1) * sizeof(WCHAR)));
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Delete the password */
|
|
||||||
dwError = ScmSetServicePassword(lpService->szServiceName,
|
|
||||||
NULL);
|
|
||||||
if (dwError == ERROR_FILE_NOT_FOUND)
|
|
||||||
dwError = ERROR_SUCCESS;
|
|
||||||
|
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (lpPassword != NULL)
|
||||||
goto done;
|
{
|
||||||
|
if (*(LPWSTR)lpPassword != 0)
|
||||||
|
{
|
||||||
|
/* FIXME: Decrypt the password */
|
||||||
|
|
||||||
|
/* Write the password */
|
||||||
|
dwError = ScmSetServicePassword(lpService->szServiceName,
|
||||||
|
(LPCWSTR)lpPassword);
|
||||||
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Delete the password */
|
||||||
|
dwError = ScmSetServicePassword(lpService->szServiceName,
|
||||||
|
NULL);
|
||||||
|
if (dwError == ERROR_FILE_NOT_FOUND)
|
||||||
|
dwError = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue