Author: janderwald Date: Sat Apr 18 19:14:49 2009 New Revision: 40582
URL: http://svn.reactos.org/svn/reactos?rev=40582&view=rev Log: - Partly implement SERVICE_CONFIG_FAILURE_ACTIONS in RQueryServiceConfig2W
Modified: trunk/reactos/base/system/services/rpcserver.c
Modified: trunk/reactos/base/system/services/rpcserver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcser... ============================================================================== --- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Sat Apr 18 19:14:49 2009 @@ -4333,6 +4333,8 @@ HKEY hServiceKey = NULL; DWORD dwRequiredSize; LPWSTR lpDescription = NULL; + LPWSTR lpFailureCommand = NULL; + LPWSTR lpRebootMessage = NULL;
DPRINT("RQueryServiceConfig2W() called\n");
@@ -4397,14 +4399,67 @@ } 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; }
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);