mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 15:38:37 +00:00
- Partly implement SERVICE_CONFIG_FAILURE_ACTIONS in RQueryServiceConfig2W
svn path=/trunk/; revision=40582
This commit is contained in:
parent
8bb9d180c0
commit
abaebc22ca
1 changed files with 56 additions and 1 deletions
|
@ -4333,6 +4333,8 @@ DWORD RQueryServiceConfig2W(
|
|||
HKEY hServiceKey = NULL;
|
||||
DWORD dwRequiredSize;
|
||||
LPWSTR lpDescription = NULL;
|
||||
LPWSTR lpFailureCommand = NULL;
|
||||
LPWSTR lpRebootMessage = NULL;
|
||||
|
||||
DPRINT("RQueryServiceConfig2W() called\n");
|
||||
|
||||
|
@ -4397,8 +4399,55 @@ DWORD RQueryServiceConfig2W(
|
|||
}
|
||||
else if (dwInfoLevel & SERVICE_CONFIG_FAILURE_ACTIONS)
|
||||
{
|
||||
LPWSTR lpStr;
|
||||
LPSERVICE_FAILURE_ACTIONSW lpFailureActions = (LPSERVICE_FAILURE_ACTIONSW)lpBuffer;
|
||||
|
||||
UNIMPLEMENTED;
|
||||
dwError = ERROR_CALL_NOT_IMPLEMENTED;
|
||||
|
||||
dwError = ScmReadString(hServiceKey,
|
||||
L"FailureCommand",
|
||||
&lpFailureCommand);
|
||||
|
||||
dwError = ScmReadString(hServiceKey,
|
||||
L"RebootMessage",
|
||||
&lpRebootMessage);
|
||||
|
||||
dwRequiredSize = sizeof(SERVICE_FAILURE_ACTIONSW);
|
||||
|
||||
if (lpFailureCommand)
|
||||
dwRequiredSize += (wcslen(lpFailureCommand) + 1) * sizeof(WCHAR);
|
||||
|
||||
if (lpRebootMessage)
|
||||
dwRequiredSize += (wcslen(lpRebootMessage) + 1) * sizeof(WCHAR);
|
||||
|
||||
if (cbBufSize < dwRequiredSize)
|
||||
{
|
||||
*pcbBytesNeeded = dwRequiredSize;
|
||||
dwError = ERROR_INSUFFICIENT_BUFFER;
|
||||
goto done;
|
||||
}
|
||||
|
||||
lpFailureActions->cActions = 0;
|
||||
lpFailureActions->dwResetPeriod = 0;
|
||||
lpFailureActions->lpCommand = NULL;
|
||||
lpFailureActions->lpRebootMsg = NULL;
|
||||
lpFailureActions->lpsaActions = NULL;
|
||||
|
||||
lpStr = (LPWSTR)(lpFailureActions + 1);
|
||||
if (lpRebootMessage)
|
||||
{
|
||||
wcscpy(lpStr, lpRebootMessage);
|
||||
lpFailureActions->lpRebootMsg = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpRebootMessage);
|
||||
lpStr += wcslen(lpRebootMessage) + 1;
|
||||
}
|
||||
|
||||
if (lpFailureCommand)
|
||||
{
|
||||
wcscpy(lpStr, lpFailureCommand);
|
||||
lpFailureActions->lpCommand = (LPWSTR)((ULONG_PTR)lpStr - (ULONG_PTR)lpFailureCommand);
|
||||
lpStr += wcslen(lpRebootMessage) + 1;
|
||||
}
|
||||
dwError = STATUS_SUCCESS;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -4406,6 +4455,12 @@ done:
|
|||
if (lpDescription != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, lpDescription);
|
||||
|
||||
if (lpRebootMessage != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, lpRebootMessage);
|
||||
|
||||
if (lpFailureCommand != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, lpFailureCommand);
|
||||
|
||||
if (hServiceKey != NULL)
|
||||
RegCloseKey(hServiceKey);
|
||||
|
||||
|
|
Loading…
Reference in a new issue