mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
Fix the client side of the ChangeServiceConfig2 RPC call to send the text in the lpDescription pointer of SERVICE_DESCRIPTION tagged onto the end of the struct.
This fixes setting service descriptions svn path=/trunk/; revision=28913
This commit is contained in:
parent
2dbf3f528e
commit
dae207d99a
1 changed files with 35 additions and 7 deletions
|
@ -139,20 +139,42 @@ ChangeServiceConfig2W(SC_HANDLE hService,
|
|||
DWORD dwInfoLevel,
|
||||
LPVOID lpInfo)
|
||||
{
|
||||
DWORD lpInfoSize;
|
||||
LPBYTE lpSendData = NULL;
|
||||
DWORD dwInfoSize;
|
||||
DWORD dwError;
|
||||
|
||||
DPRINT("ChangeServiceConfig2W() called\n");
|
||||
|
||||
/* Determine the length of the lpInfo parameter */
|
||||
switch (dwInfoLevel)
|
||||
{
|
||||
case SERVICE_CONFIG_DESCRIPTION:
|
||||
lpInfoSize = sizeof(SERVICE_DESCRIPTIONW);
|
||||
{
|
||||
LPSERVICE_DESCRIPTIONW lpServiceDescription = lpInfo;
|
||||
DWORD dwStringSize;
|
||||
|
||||
dwInfoSize = sizeof(SERVICE_DESCRIPTIONW);
|
||||
dwStringSize = (wcslen(lpServiceDescription->lpDescription) + 1) * sizeof(WCHAR);
|
||||
dwInfoSize += dwStringSize;
|
||||
|
||||
lpSendData = HeapAlloc(GetProcessHeap(), 0, dwInfoSize);
|
||||
if (lpSendData)
|
||||
{
|
||||
LPBYTE pt = lpSendData;
|
||||
|
||||
CopyMemory(pt, lpInfo, sizeof(SERVICE_DESCRIPTIONW));
|
||||
pt += sizeof(SERVICE_DESCRIPTIONW);
|
||||
CopyMemory(pt, lpServiceDescription->lpDescription, dwStringSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SERVICE_CONFIG_FAILURE_ACTIONS:
|
||||
lpInfoSize = sizeof(SERVICE_FAILURE_ACTIONSW);
|
||||
dwInfoSize = sizeof(SERVICE_FAILURE_ACTIONSW);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -162,15 +184,15 @@ ChangeServiceConfig2W(SC_HANDLE hService,
|
|||
}
|
||||
|
||||
if (lpInfo == NULL)
|
||||
return TRUE;
|
||||
goto done;
|
||||
|
||||
HandleBind();
|
||||
|
||||
dwError = ScmrChangeServiceConfig2W(BindingHandle,
|
||||
(unsigned int)hService,
|
||||
dwInfoLevel,
|
||||
lpInfo,
|
||||
lpInfoSize);
|
||||
lpSendData,
|
||||
dwInfoSize);
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT1("ScmrChangeServiceConfig2W() failed (Error %lu)\n", dwError);
|
||||
|
@ -178,6 +200,12 @@ ChangeServiceConfig2W(SC_HANDLE hService,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
done:
|
||||
if (lpSendData != NULL)
|
||||
HeapFree(GetProcessHeap(), 0, lpSendData);
|
||||
|
||||
DPRINT("ChangeServiceConfig2W() done\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue