mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 05:12:55 +00:00
- RChangeServiceConfigA/W: Update the service group properly and fix the ANSI to Unicode string conversion.
This fixes one winetest. svn path=/trunk/; revision=44733
This commit is contained in:
parent
05ea3194c6
commit
211c79ac94
2 changed files with 29 additions and 11 deletions
|
@ -30,6 +30,15 @@ ScmSetServiceGroup(PSERVICE lpService,
|
||||||
PLIST_ENTRY GroupEntry;
|
PLIST_ENTRY GroupEntry;
|
||||||
PSERVICE_GROUP lpGroup;
|
PSERVICE_GROUP lpGroup;
|
||||||
|
|
||||||
|
DPRINT("ScmSetServiceGroup(%S)\n", lpGroupName);
|
||||||
|
|
||||||
|
if (lpService->lpGroup != NULL)
|
||||||
|
{
|
||||||
|
lpService->lpGroup->dwRefCount--;
|
||||||
|
|
||||||
|
/* FIXME: What do we have to do when dwRefCount is 0? */
|
||||||
|
}
|
||||||
|
|
||||||
GroupEntry = GroupListHead.Flink;
|
GroupEntry = GroupListHead.Flink;
|
||||||
while (GroupEntry != &GroupListHead)
|
while (GroupEntry != &GroupListHead)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1282,7 +1282,11 @@ DWORD RChangeServiceConfigW(
|
||||||
(wcslen(lpLoadOrderGroup) + 1) * sizeof(WCHAR));
|
(wcslen(lpLoadOrderGroup) + 1) * sizeof(WCHAR));
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
/* FIXME: Update lpService->lpServiceGroup */
|
|
||||||
|
dwError = ScmSetServiceGroup(lpService,
|
||||||
|
lpLoadOrderGroup);
|
||||||
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpdwTagId != NULL)
|
if (lpdwTagId != NULL)
|
||||||
|
@ -3058,7 +3062,7 @@ DWORD RChangeServiceConfigA(
|
||||||
if (lpBinaryPathName != NULL && *lpBinaryPathName != 0)
|
if (lpBinaryPathName != NULL && *lpBinaryPathName != 0)
|
||||||
{
|
{
|
||||||
lpBinaryPathNameW=HeapAlloc(GetProcessHeap(),0, (strlen(lpBinaryPathName)+1) * sizeof(WCHAR));
|
lpBinaryPathNameW=HeapAlloc(GetProcessHeap(),0, (strlen(lpBinaryPathName)+1) * sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpBinaryPathName, -1, lpBinaryPathNameW, wcslen(lpBinaryPathNameW)+1);
|
MultiByteToWideChar(CP_ACP, 0, lpBinaryPathName, -1, lpBinaryPathNameW, strlen(lpBinaryPathName)+1);
|
||||||
dwError = RegSetValueExW(hServiceKey,
|
dwError = RegSetValueExW(hServiceKey,
|
||||||
L"ImagePath",
|
L"ImagePath",
|
||||||
0,
|
0,
|
||||||
|
@ -3090,7 +3094,7 @@ DWORD RChangeServiceConfigA(
|
||||||
{
|
{
|
||||||
lpLoadOrderGroupW = HeapAlloc(GetProcessHeap(),
|
lpLoadOrderGroupW = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
(strlen(lpLoadOrderGroup)+1) * sizeof(WCHAR));
|
(strlen(lpLoadOrderGroup) + 1) * sizeof(WCHAR));
|
||||||
if (lpLoadOrderGroupW == NULL)
|
if (lpLoadOrderGroupW == NULL)
|
||||||
{
|
{
|
||||||
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
@ -3102,7 +3106,7 @@ DWORD RChangeServiceConfigA(
|
||||||
lpLoadOrderGroup,
|
lpLoadOrderGroup,
|
||||||
-1,
|
-1,
|
||||||
lpLoadOrderGroupW,
|
lpLoadOrderGroupW,
|
||||||
wcslen(lpLoadOrderGroupW) + 1);
|
strlen(lpLoadOrderGroup) + 1);
|
||||||
|
|
||||||
dwError = RegSetValueExW(hServiceKey,
|
dwError = RegSetValueExW(hServiceKey,
|
||||||
L"Group",
|
L"Group",
|
||||||
|
@ -3111,11 +3115,18 @@ DWORD RChangeServiceConfigA(
|
||||||
(LPBYTE)lpLoadOrderGroupW,
|
(LPBYTE)lpLoadOrderGroupW,
|
||||||
(wcslen(lpLoadOrderGroupW) + 1) * sizeof(WCHAR));
|
(wcslen(lpLoadOrderGroupW) + 1) * sizeof(WCHAR));
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: Update lpService->lpServiceGroup */
|
dwError = ScmSetServiceGroup(lpService,
|
||||||
|
lpLoadOrderGroupW);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW);
|
HeapFree(GetProcessHeap(), 0, lpLoadOrderGroupW);
|
||||||
|
|
||||||
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpdwTagId != NULL)
|
if (lpdwTagId != NULL)
|
||||||
|
@ -3141,7 +3152,7 @@ DWORD RChangeServiceConfigA(
|
||||||
{
|
{
|
||||||
lpDependenciesW = HeapAlloc(GetProcessHeap(),
|
lpDependenciesW = HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
(strlen(lpDependencies)+1) * sizeof(WCHAR));
|
(strlen(lpDependencies) + 1) * sizeof(WCHAR));
|
||||||
if (lpDependenciesW == NULL)
|
if (lpDependenciesW == NULL)
|
||||||
{
|
{
|
||||||
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
dwError = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
|
@ -3153,7 +3164,7 @@ DWORD RChangeServiceConfigA(
|
||||||
lpDependencies,
|
lpDependencies,
|
||||||
dwDependSize,
|
dwDependSize,
|
||||||
lpDependenciesW,
|
lpDependenciesW,
|
||||||
wcslen(lpDependenciesW)+1);
|
strlen(lpDependencies) + 1);
|
||||||
|
|
||||||
dwError = ScmWriteDependencies(hServiceKey,
|
dwError = ScmWriteDependencies(hServiceKey,
|
||||||
(LPWSTR)lpDependenciesW,
|
(LPWSTR)lpDependenciesW,
|
||||||
|
@ -3469,8 +3480,7 @@ DWORD ROpenSCManagerA(
|
||||||
RtlCreateUnicodeStringFromAsciiz(&DatabaseName,
|
RtlCreateUnicodeStringFromAsciiz(&DatabaseName,
|
||||||
lpDatabaseName);
|
lpDatabaseName);
|
||||||
|
|
||||||
dwError = ROpenSCManagerW(//BindingHandle,
|
dwError = ROpenSCManagerW(lpMachineName ? MachineName.Buffer : NULL,
|
||||||
lpMachineName ? MachineName.Buffer : NULL,
|
|
||||||
lpDatabaseName ? DatabaseName.Buffer : NULL,
|
lpDatabaseName ? DatabaseName.Buffer : NULL,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
lpScHandle);
|
lpScHandle);
|
||||||
|
@ -3501,8 +3511,7 @@ DWORD ROpenServiceA(
|
||||||
RtlCreateUnicodeStringFromAsciiz(&ServiceName,
|
RtlCreateUnicodeStringFromAsciiz(&ServiceName,
|
||||||
lpServiceName);
|
lpServiceName);
|
||||||
|
|
||||||
dwError = ROpenServiceW(//BindingHandle,
|
dwError = ROpenServiceW(hSCManager,
|
||||||
hSCManager,
|
|
||||||
lpServiceName ? ServiceName.Buffer : NULL,
|
lpServiceName ? ServiceName.Buffer : NULL,
|
||||||
dwDesiredAccess,
|
dwDesiredAccess,
|
||||||
lpServiceHandle);
|
lpServiceHandle);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue