return ERROR_INVALID_PARAMETER;
}
+
DWORD
ScmCanonDriverImagePath(DWORD dwStartType,
const wchar_t *lpServiceName,
return ERROR_INVALID_HANDLE;
}
-
/* Check the service entry point */
lpService = hSvc->ServiceEntry;
if (lpService == NULL)
DesiredAccess))
return ERROR_ACCESS_DENIED;
+ /* Return the current service status information */
+ RtlCopyMemory(lpServiceStatus,
+ &lpService->Status,
+ sizeof(SERVICE_STATUS));
+
if (dwControl == SERVICE_CONTROL_STOP)
{
/* Check if the service has dependencies running as windows
dwControlsAccepted = lpService->Status.dwControlsAccepted;
dwCurrentState = lpService->Status.dwCurrentState;
+ /* Return ERROR_SERVICE_NOT_ACTIVE if the service has not been started */
+ if (lpService->lpImage == NULL || dwCurrentState == SERVICE_STOPPED)
+ return ERROR_SERVICE_NOT_ACTIVE;
+
/* Check the current state before sending a control request */
switch (dwCurrentState)
{
/* Unlock the service database */
ScmUnlockDatabase();
- /* check if it is marked for deletion */
+ /* Check if it is marked for deletion */
if (lpService->bDeleted)
return ERROR_SERVICE_MARKED_FOR_DELETE;
+
/* Return Error exist */
return ERROR_SERVICE_EXISTS;
}
*pcbBytesNeeded = 0;
*lpServicesReturned = 0;
- if ((dwServiceType!=SERVICE_DRIVER) && (dwServiceType!=SERVICE_WIN32))
+ if ((dwServiceType == 0) ||
+ ((dwServiceType & ~(SERVICE_DRIVER | SERVICE_WIN32)) != 0))
{
DPRINT("Not a valid Service Type!\n");
return ERROR_INVALID_PARAMETER;
}
- if ((dwServiceState<SERVICE_ACTIVE) || (dwServiceState>SERVICE_STATE_ALL))
+ if ((dwServiceState != SERVICE_ACTIVE) &&
+ (dwServiceState != SERVICE_INACTIVE) &&
+ (dwServiceState != SERVICE_STATE_ALL))
{
DPRINT("Not a valid Service State!\n");
return ERROR_INVALID_PARAMETER;