dwError = ScmMarkServiceForDelete(lpService);
-Done:;
+Done:
/* Unlock the service database */
ScmUnlockDatabase();
lpService->dwRefCount = 1;
DPRINT("CreateService - lpService->dwRefCount %u\n", lpService->dwRefCount);
-done:;
+done:
/* Unlock the service database */
ScmUnlockDatabase();
*lpServiceHandle = (SC_RPC_HANDLE)hHandle;
DPRINT("*hService = %p\n", *lpServiceHandle);
-Done:;
+Done:
/* Unlock the service database */
ScmUnlockDatabase();
if (pcbBytesNeeded != NULL)
*pcbBytesNeeded = dwRequiredSize;
-Done:;
+Done:
/* Unlock the service database */
ScmUnlockDatabase();
LPBOUNDED_DWORD_256K lpResumeHandle)
{
LPENUM_SERVICE_STATUSW lpStatusPtrW = NULL;
+ LPENUM_SERVICE_STATUSW lpStatusPtrIncrW;
LPENUM_SERVICE_STATUSA lpStatusPtrA = NULL;
LPWSTR lpStringPtrW;
LPSTR lpStringPtrA;
if (*lpServicesReturned == 0)
goto Done;
+ lpStatusPtrIncrW = lpStatusPtrW;
lpStatusPtrA = (LPENUM_SERVICE_STATUSA)lpBuffer;
lpStringPtrA = (LPSTR)((ULONG_PTR)lpBuffer +
*lpServicesReturned * sizeof(ENUM_SERVICE_STATUSA));
/* Copy the status information */
memcpy(&lpStatusPtrA->ServiceStatus,
- &lpStatusPtrW->ServiceStatus,
+ &lpStatusPtrIncrW->ServiceStatus,
sizeof(SERVICE_STATUS));
+ lpStatusPtrIncrW++;
lpStatusPtrA++;
}
-Done:;
+Done:
if (lpStatusPtrW)
HeapFree(GetProcessHeap(), 0, lpStatusPtrW);
if (pcbBytesNeeded != NULL)
*pcbBytesNeeded = dwRequiredSize;
-Done:;
+Done:
/* Unlock the service database */
ScmUnlockDatabase();
*lpServicesReturned = 0;
if ((dwServiceType == 0) ||
- ((dwServiceType & ~(SERVICE_DRIVER | SERVICE_WIN32)) != 0))
+ ((dwServiceType & ~SERVICE_TYPE_ALL) != 0))
{
DPRINT("Not a valid Service Type!\n");
return ERROR_INVALID_PARAMETER;
}
- if ((dwServiceState != SERVICE_ACTIVE) &&
- (dwServiceState != SERVICE_INACTIVE) &&
- (dwServiceState != SERVICE_STATE_ALL))
+ if ((dwServiceState == 0) ||
+ ((dwServiceState & ~SERVICE_STATE_ALL) != 0))
{
DPRINT("Not a valid Service State!\n");
return ERROR_INVALID_PARAMETER;
if (Info.dwInfoLevel == SERVICE_CONFIG_DESCRIPTION)
{
- LPSERVICE_DESCRIPTIONW lpServiceDescription;
-
- lpServiceDescription = (LPSERVICE_DESCRIPTIONW)Info.psd;
+ LPSERVICE_DESCRIPTIONW lpServiceDescription = (LPSERVICE_DESCRIPTIONW)Info.psd;
+ /* Modify the service description, if specified */
if (lpServiceDescription != NULL &&
lpServiceDescription->lpDescription != NULL)
{
- DPRINT("Setting value %S\n", lpServiceDescription->lpDescription);
- dwError = RegSetValueExW(hServiceKey,
- L"Description",
- 0,
- REG_SZ,
- (LPBYTE)lpServiceDescription->lpDescription,
- (wcslen(lpServiceDescription->lpDescription) + 1) * sizeof(WCHAR));
- if (dwError != ERROR_SUCCESS)
- goto done;
+ /* If the description is "" then we delete it */
+ if (*lpServiceDescription->lpDescription == 0)
+ {
+ DPRINT("Delete service description\n");
+ dwError = RegDeleteValueW(hServiceKey, L"Description");
+
+ if (dwError == ERROR_FILE_NOT_FOUND)
+ dwError = ERROR_SUCCESS;
+ }
+ else
+ {
+ DPRINT("Setting service description value %S\n", lpServiceDescription->lpDescription);
+ dwError = RegSetValueExW(hServiceKey,
+ L"Description",
+ 0,
+ REG_SZ,
+ (LPBYTE)lpServiceDescription->lpDescription,
+ (wcslen(lpServiceDescription->lpDescription) + 1) * sizeof(WCHAR));
+ }
+ }
+ else
+ {
+ dwError = ERROR_SUCCESS;
}
}
else if (Info.dwInfoLevel == SERVICE_CONFIG_FAILURE_ACTIONS)
LPCSTR pszGroupName)
{
LPENUM_SERVICE_STATUS_PROCESSW lpStatusPtrW = NULL;
+ LPENUM_SERVICE_STATUS_PROCESSW lpStatusPtrIncrW;
LPENUM_SERVICE_STATUS_PROCESSA lpStatusPtrA = NULL;
LPWSTR lpStringPtrW;
LPSTR lpStringPtrA;
if (*lpServicesReturned == 0)
goto Done;
+ lpStatusPtrIncrW = lpStatusPtrW;
lpStatusPtrA = (LPENUM_SERVICE_STATUS_PROCESSA)lpBuffer;
lpStringPtrA = (LPSTR)((ULONG_PTR)lpBuffer +
*lpServicesReturned * sizeof(ENUM_SERVICE_STATUS_PROCESSA));
/* Copy the status information */
memcpy(&lpStatusPtrA->ServiceStatusProcess,
- &lpStatusPtrW->ServiceStatusProcess,
+ &lpStatusPtrIncrW->ServiceStatusProcess,
sizeof(SERVICE_STATUS));
- lpStatusPtrA->ServiceStatusProcess.dwProcessId = lpStatusPtrW->ServiceStatusProcess.dwProcessId; /* FIXME */
+ lpStatusPtrA->ServiceStatusProcess.dwProcessId = lpStatusPtrIncrW->ServiceStatusProcess.dwProcessId; /* FIXME */
lpStatusPtrA->ServiceStatusProcess.dwServiceFlags = 0; /* FIXME */
+
+ lpStatusPtrIncrW++;
lpStatusPtrA++;
}
-Done:;
+Done:
if (pszGroupNameW)
HeapFree(GetProcessHeap(), 0, pszGroupNameW);
*lpServicesReturned = 0;
if ((dwServiceType == 0) ||
- ((dwServiceType & ~(SERVICE_DRIVER | SERVICE_WIN32)) != 0))
+ ((dwServiceType & ~SERVICE_TYPE_ALL) != 0))
{
DPRINT("Not a valid Service Type!\n");
return ERROR_INVALID_PARAMETER;
}
- if ((dwServiceState != SERVICE_ACTIVE) &&
- (dwServiceState != SERVICE_INACTIVE) &&
- (dwServiceState != SERVICE_STATE_ALL))
+ if ((dwServiceState == 0) ||
+ ((dwServiceState & ~SERVICE_STATE_ALL) != 0))
{
DPRINT("Not a valid Service State!\n");
return ERROR_INVALID_PARAMETER;
*lpResumeIndex = 0;
}
-Done:;
+Done:
/* Unlock the service database */
ScmUnlockDatabase();