services: Save service dependencies.
This commit is contained in:
parent
c125fc1502
commit
eae2cf56cb
|
@ -154,6 +154,25 @@ static DWORD reg_set_string_value(HKEY hKey, LPCWSTR value_name, LPCWSTR string)
|
||||||
return RegSetValueExW(hKey, value_name, 0, REG_SZ, (const BYTE*)string, sizeof(WCHAR)*(strlenW(string) + 1));
|
return RegSetValueExW(hKey, value_name, 0, REG_SZ, (const BYTE*)string, sizeof(WCHAR)*(strlenW(string) + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DWORD reg_set_multisz_value(HKEY hKey, LPCWSTR value_name, LPCWSTR string)
|
||||||
|
{
|
||||||
|
const WCHAR *ptr;
|
||||||
|
|
||||||
|
if (!string)
|
||||||
|
{
|
||||||
|
DWORD err;
|
||||||
|
err = RegDeleteValueW(hKey, value_name);
|
||||||
|
if (err != ERROR_FILE_NOT_FOUND)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = string;
|
||||||
|
while (*ptr) ptr += strlenW(ptr) + 1;
|
||||||
|
return RegSetValueExW(hKey, value_name, 0, REG_MULTI_SZ, (const BYTE*)string, sizeof(WCHAR)*(ptr - string + 1));
|
||||||
|
}
|
||||||
|
|
||||||
DWORD save_service_config(struct service_entry *entry)
|
DWORD save_service_config(struct service_entry *entry)
|
||||||
{
|
{
|
||||||
DWORD err;
|
DWORD err;
|
||||||
|
@ -173,6 +192,10 @@ DWORD save_service_config(struct service_entry *entry)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if ((err = reg_set_string_value(hKey, SZ_DESCRIPTION, entry->description)) != 0)
|
if ((err = reg_set_string_value(hKey, SZ_DESCRIPTION, entry->description)) != 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
if ((err = reg_set_multisz_value(hKey, SZ_DEPEND_ON_SERVICE, entry->dependOnServices)) != 0)
|
||||||
|
goto cleanup;
|
||||||
|
if ((err = reg_set_multisz_value(hKey, SZ_DEPEND_ON_GROUP, entry->dependOnGroups)) != 0)
|
||||||
|
goto cleanup;
|
||||||
if ((err = RegSetValueExW(hKey, SZ_START, 0, REG_DWORD, (LPBYTE)&entry->config.dwStartType, sizeof(DWORD))) != 0)
|
if ((err = RegSetValueExW(hKey, SZ_START, 0, REG_DWORD, (LPBYTE)&entry->config.dwStartType, sizeof(DWORD))) != 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if ((err = RegSetValueExW(hKey, SZ_ERROR, 0, REG_DWORD, (LPBYTE)&entry->config.dwErrorControl, sizeof(DWORD))) != 0)
|
if ((err = RegSetValueExW(hKey, SZ_ERROR, 0, REG_DWORD, (LPBYTE)&entry->config.dwErrorControl, sizeof(DWORD))) != 0)
|
||||||
|
|
Loading…
Reference in New Issue