mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
- Read a services optional display name from the registry.
- Fix return size bugs in GetServiceDisplayNameW and GetServiceKeyNameW. svn path=/trunk/; revision=19030
This commit is contained in:
parent
316bd9523e
commit
a7bb0605ae
3 changed files with 29 additions and 5 deletions
|
@ -592,6 +592,8 @@ GetServiceDisplayNameW(SC_HANDLE hSCManager,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*lpcchBuffer)--;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,6 +646,8 @@ GetServiceKeyNameW(SC_HANDLE hSCManager,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*lpcchBuffer)--;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ CreateGroupOrderListRoutine(PWSTR ValueName,
|
||||||
{
|
{
|
||||||
PSERVICE_GROUP Group;
|
PSERVICE_GROUP Group;
|
||||||
|
|
||||||
DPRINT("IopGetGroupOrderList(%S, %x, %x, %x, %x, %x)\n",
|
DPRINT("CreateGroupOrderListRoutine(%S, %x, %x, %x, %x, %x)\n",
|
||||||
ValueName, ValueType, ValueData, ValueLength, Context, EntryContext);
|
ValueName, ValueType, ValueData, ValueLength, Context, EntryContext);
|
||||||
|
|
||||||
if (ValueType == REG_BINARY &&
|
if (ValueType == REG_BINARY &&
|
||||||
|
@ -253,6 +253,7 @@ CreateServiceListEntry(LPWSTR lpServiceName,
|
||||||
HKEY hServiceKey)
|
HKEY hServiceKey)
|
||||||
{
|
{
|
||||||
PSERVICE lpService = NULL;
|
PSERVICE lpService = NULL;
|
||||||
|
LPWSTR lpDisplayName = NULL;
|
||||||
LPWSTR lpGroup = NULL;
|
LPWSTR lpGroup = NULL;
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
@ -326,6 +327,14 @@ CreateServiceListEntry(LPWSTR lpServiceName,
|
||||||
|
|
||||||
DPRINT("Group: %S\n", lpGroup);
|
DPRINT("Group: %S\n", lpGroup);
|
||||||
|
|
||||||
|
dwError = ScmReadString(hServiceKey,
|
||||||
|
L"DisplayName",
|
||||||
|
&lpDisplayName);
|
||||||
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
lpDisplayName = NULL;
|
||||||
|
|
||||||
|
DPRINT("Display name: %S\n", lpDisplayName);
|
||||||
|
|
||||||
dwError = ScmCreateNewServiceRecord(lpServiceName,
|
dwError = ScmCreateNewServiceRecord(lpServiceName,
|
||||||
&lpService);
|
&lpService);
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
@ -342,6 +351,12 @@ CreateServiceListEntry(LPWSTR lpServiceName,
|
||||||
lpGroup = NULL;
|
lpGroup = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lpDisplayName != NULL)
|
||||||
|
{
|
||||||
|
lpService->lpDisplayName = lpDisplayName;
|
||||||
|
lpDisplayName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("ServiceName: '%S'\n", lpService->lpServiceName);
|
DPRINT("ServiceName: '%S'\n", lpService->lpServiceName);
|
||||||
DPRINT("Group: '%S'\n", lpService->lpServiceGroup);
|
DPRINT("Group: '%S'\n", lpService->lpServiceGroup);
|
||||||
DPRINT("Start %lx Type %lx Tag %lx ErrorControl %lx\n",
|
DPRINT("Start %lx Type %lx Tag %lx ErrorControl %lx\n",
|
||||||
|
@ -357,6 +372,9 @@ done:;
|
||||||
if (lpGroup != NULL)
|
if (lpGroup != NULL)
|
||||||
HeapFree(GetProcessHeap(), 0, lpGroup);
|
HeapFree(GetProcessHeap(), 0, lpGroup);
|
||||||
|
|
||||||
|
if (lpDisplayName != NULL)
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpDisplayName);
|
||||||
|
|
||||||
return dwError;
|
return dwError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,6 +474,8 @@ ScmCreateServiceDatabase(VOID)
|
||||||
|
|
||||||
RegCloseKey(hServicesKey);
|
RegCloseKey(hServicesKey);
|
||||||
|
|
||||||
|
/* FIXME: Delete services that are marked for delete */
|
||||||
|
|
||||||
DPRINT("ScmCreateServiceDatabase() done\n");
|
DPRINT("ScmCreateServiceDatabase() done\n");
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
|
|
@ -969,10 +969,10 @@ ScmrGetServiceDisplayNameW(handle_t BindingHandle,
|
||||||
return ERROR_SERVICE_DOES_NOT_EXIST;
|
return ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = wcslen(lpService->lpDisplayName);
|
dwLength = wcslen(lpService->lpDisplayName) + 1;
|
||||||
|
|
||||||
if (lpDisplayName != NULL &&
|
if (lpDisplayName != NULL &&
|
||||||
*lpcchBuffer > dwLength)
|
*lpcchBuffer >= dwLength)
|
||||||
{
|
{
|
||||||
wcscpy(lpDisplayName, lpService->lpDisplayName);
|
wcscpy(lpDisplayName, lpService->lpDisplayName);
|
||||||
}
|
}
|
||||||
|
@ -1019,10 +1019,10 @@ ScmrGetServiceKeyNameW(handle_t BindingHandle,
|
||||||
return ERROR_SERVICE_DOES_NOT_EXIST;
|
return ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwLength = wcslen(lpService->lpServiceName);
|
dwLength = wcslen(lpService->lpServiceName) + 1;
|
||||||
|
|
||||||
if (lpServiceName != NULL &&
|
if (lpServiceName != NULL &&
|
||||||
*lpcchBuffer > dwLength)
|
*lpcchBuffer >= dwLength)
|
||||||
{
|
{
|
||||||
wcscpy(lpServiceName, lpService->lpServiceName);
|
wcscpy(lpServiceName, lpService->lpServiceName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue