SERVICE_CONTROL_STATUS_REASON_PARAMSA structure (winsvc.h)

Contains service control parameters.

Syntax

typedef struct _SERVICE_CONTROL_STATUS_REASON_PARAMSA {
  DWORD                  dwReason;
  LPSTR                  pszComment;
  SERVICE_STATUS_PROCESS ServiceStatus;
} SERVICE_CONTROL_STATUS_REASON_PARAMSA, *PSERVICE_CONTROL_STATUS_REASON_PARAMSA;

Members

dwReason

The reason for changing the service status to SERVICE_CONTROL_STOP. If the current control code is not SERVICE_CONTROL_STOP, this member is ignored.

This member must be set to a combination of one general code, one major reason code, and one minor reason code.

The following are the general reason codes.

Value Meaning
SERVICE_STOP_REASON_FLAG_CUSTOM
0x20000000
The reason code is defined by the user. If this flag is not present, the reason code is defined by the system. If this flag is specified with a system reason code, the function call fails.

Users can create custom major reason codes in the range SERVICE_STOP_REASON_MAJOR_MIN_CUSTOM (0x00400000) through SERVICE_STOP_REASON_MAJOR_MAX_CUSTOM (0x00ff0000) and minor reason codes in the range SERVICE_STOP_REASON_MINOR_MIN_CUSTOM (0x00000100) through SERVICE_STOP_REASON_MINOR_MAX_CUSTOM (0x0000FFFF).

SERVICE_STOP_REASON_FLAG_PLANNED
0x40000000
The service stop was planned.
SERVICE_STOP_REASON_FLAG_UNPLANNED
0x10000000
The service stop was not planned.
 

The following are the major reason codes.

Value Meaning
SERVICE_STOP_REASON_MAJOR_APPLICATION
0x00050000
Application issue.
SERVICE_STOP_REASON_MAJOR_HARDWARE
0x00020000
Hardware issue.
SERVICE_STOP_REASON_MAJOR_NONE
0x00060000
No major reason.
SERVICE_STOP_REASON_MAJOR_OPERATINGSYSTEM
0x00030000
Operating system issue.
SERVICE_STOP_REASON_MAJOR_OTHER
0x00010000
Other issue.
SERVICE_STOP_REASON_MAJOR_SOFTWARE
0x00040000
Software issue.
 

The following are the minor reason codes.

Value Meaning
SERVICE_STOP_REASON_MINOR_DISK
0x00000008
Disk.
SERVICE_STOP_REASON_MINOR_ENVIRONMENT
0x0000000a
Environment.
SERVICE_STOP_REASON_MINOR_HARDWARE_DRIVER
0x0000000b
Driver.
SERVICE_STOP_REASON_MINOR_HUNG
0x00000006
Unresponsive.
SERVICE_STOP_REASON_MINOR_INSTALLATION
0x00000003
Installation.
SERVICE_STOP_REASON_MINOR_MAINTENANCE
0x00000002
Maintenance.
SERVICE_STOP_REASON_MINOR_MMC
0x00000016
MMC issue.
SERVICE_STOP_REASON_MINOR_NETWORK_CONNECTIVITY
0x00000011
Network connectivity.
SERVICE_STOP_REASON_MINOR_NETWORKCARD
0x00000009
Network card.
SERVICE_STOP_REASON_MINOR_NONE
0x00060000
No minor reason.
SERVICE_STOP_REASON_MINOR_OTHER
0x00000001
Other issue.
SERVICE_STOP_REASON_MINOR_OTHERDRIVER
0x0000000c
Other driver event.
SERVICE_STOP_REASON_MINOR_RECONFIG
0x00000005
Reconfigure.
SERVICE_STOP_REASON_MINOR_SECURITY
0x00000010
Security issue.
SERVICE_STOP_REASON_MINOR_SECURITYFIX
0x0000000f
Security update.
SERVICE_STOP_REASON_MINOR_SECURITYFIX_UNINSTALL
0x00000015
Security update uninstall.
SERVICE_STOP_REASON_MINOR_SERVICEPACK
0x0000000d
Service pack.
SERVICE_STOP_REASON_MINOR_SERVICEPACK_UNINSTALL
0x00000013
Service pack uninstall.
SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE
0x0000000e
Software update.
SERVICE_STOP_REASON_MINOR_SOFTWARE_UPDATE_UNINSTALL
0x0000000e
Software update uninstall.
SERVICE_STOP_REASON_MINOR_UNSTABLE
0x00000007
Unstable.
SERVICE_STOP_REASON_MINOR_UPGRADE
0x00000004
Upgrade.
SERVICE_STOP_REASON_MINOR_WMI
0x00000012
WMI issue.

pszComment

An optional string that provides additional information about the service stop. This string is stored in the event log along with the stop reason code. This member must be NULL or a valid string that is less than 128 characters, including the terminating null character.

ServiceStatus

A pointer to a SERVICE_STATUS_PROCESS structure that receives the latest service status information. The information returned reflects the most recent status that the service reported to the service control manager.

The service control manager fills in the structure only when ControlServiceEx returns one of the following error codes: NO_ERROR, ERROR_INVALID_SERVICE_CONTROL, ERROR_SERVICE_CANNOT_ACCEPT_CTRL, or ERROR_SERVICE_NOT_ACTIVE. Otherwise, the structure is not filled in.

Remarks

Note

The winsvc.h header defines SERVICE_CONTROL_STATUS_REASON_PARAMS as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header winsvc.h (include Windows.h)

See also

ControlServiceEx

SERVICE_STATUS_PROCESS