mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:25:48 +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,
|
DWORD dwInfoLevel,
|
||||||
LPVOID lpInfo)
|
LPVOID lpInfo)
|
||||||
{
|
{
|
||||||
DWORD lpInfoSize;
|
LPBYTE lpSendData = NULL;
|
||||||
|
DWORD dwInfoSize;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
DPRINT("ChangeServiceConfig2W() called\n");
|
DPRINT("ChangeServiceConfig2W() called\n");
|
||||||
|
|
||||||
/* Determine the length of the lpInfo parameter */
|
|
||||||
switch (dwInfoLevel)
|
switch (dwInfoLevel)
|
||||||
{
|
{
|
||||||
case SERVICE_CONFIG_DESCRIPTION:
|
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;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SERVICE_CONFIG_FAILURE_ACTIONS:
|
case SERVICE_CONFIG_FAILURE_ACTIONS:
|
||||||
lpInfoSize = sizeof(SERVICE_FAILURE_ACTIONSW);
|
dwInfoSize = sizeof(SERVICE_FAILURE_ACTIONSW);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -162,15 +184,15 @@ ChangeServiceConfig2W(SC_HANDLE hService,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpInfo == NULL)
|
if (lpInfo == NULL)
|
||||||
return TRUE;
|
goto done;
|
||||||
|
|
||||||
HandleBind();
|
HandleBind();
|
||||||
|
|
||||||
dwError = ScmrChangeServiceConfig2W(BindingHandle,
|
dwError = ScmrChangeServiceConfig2W(BindingHandle,
|
||||||
(unsigned int)hService,
|
(unsigned int)hService,
|
||||||
dwInfoLevel,
|
dwInfoLevel,
|
||||||
lpInfo,
|
lpSendData,
|
||||||
lpInfoSize);
|
dwInfoSize);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("ScmrChangeServiceConfig2W() failed (Error %lu)\n", dwError);
|
DPRINT1("ScmrChangeServiceConfig2W() failed (Error %lu)\n", dwError);
|
||||||
|
@ -178,6 +200,12 @@ ChangeServiceConfig2W(SC_HANDLE hService,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (lpSendData != NULL)
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpSendData);
|
||||||
|
|
||||||
|
DPRINT("ChangeServiceConfig2W() done\n");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue