SERVICE_STATUS_PROCESS

来源:互联网 发布:日本行知学园熟官网 编辑:程序博客网 时间:2024/06/05 15:36

SERVICE_STATUS_PROCESS

The SERVICE_STATUS_PROCESS structure contains information about a service. The EnumServicesStatusEx and QueryServiceStatusEx functions use this structure to return information about a service.

typedef struct _SERVICE_STATUS_PROCESS {
DWORD dwServiceType;
DWORD dwCurrentState;
DWORD dwControlsAccepted;
DWORD dwWin32ExitCode;
DWORD dwServiceSpecificExitCode;
DWORD dwCheckPoint;
DWORD dwWaitHint;
DWORD dwProcessId;
DWORD dwServiceFlags;} SERVICE_STATUS_PROCESS,
*LPSERVICE_STATUS_PROCESS;

Members

dwServiceType
Type of service. This member can be one of the following values. ValueMeaningSERVICE_FILE_SYSTEM_DRIVER
0x00000002The service is a file system driver.SERVICE_KERNEL_DRIVER
0x00000001The service is a device driver.SERVICE_WIN32_OWN_PROCESS
0x00000010The service runs in its own process.SERVICE_WIN32_SHARE_PROCESS
0x00000020The service shares a process with other services.

If the service type is either SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS, and the service is running in the context of the LocalSystem account, the following type may also be specified.

ValueMeaningSERVICE_INTERACTIVE_PROCESSThe service can interact with the desktop.

For more information, see Interactive Services.

dwCurrentState
Current state of the service. This member can be one of the following values. ValueMeaningSERVICE_CONTINUE_PENDING
0x00000005The service continue is pending.SERVICE_PAUSE_PENDING
0x00000006The service pause is pending.SERVICE_PAUSED
0x00000007The service is paused.SERVICE_RUNNING
0x00000004The service is running.SERVICE_START_PENDING
0x00000002The service is starting.SERVICE_STOP_PENDING
0x00000003The service is stopping.SERVICE_STOPPED
0x00000001The service is not running.
dwControlsAccepted
Control codes the service accepts and processes in its handler function (see Handler and HandlerEx). A user interface process can control a service by specifying a control command in the ControlService function. By default, all services accept the SERVICE_CONTROL_INTERROGATE value.

The following are the control codes.

Control codeMeaningSERVICE_ACCEPT_NETBINDCHANGE
0x00000010The service is a network component that can accept changes in its binding without being stopped and restarted.

This control code allows the service to receive SERVICE_CONTROL_NETBINDADD, SERVICE_CONTROL_NETBINDREMOVE, SERVICE_CONTROL_NETBINDENABLE, and SERVICE_CONTROL_NETBINDDISABLE notifications.

Windows NT:  This value is not supported.
SERVICE_ACCEPT_PARAMCHANGE
0x00000008The service can reread its startup parameters without being stopped and restarted.

This control code allows the service to receive SERVICE_CONTROL_PARAMCHANGE notifications.

Windows NT:  This value is not supported.
SERVICE_ACCEPT_PAUSE_CONTINUE
0x00000002The service can be paused and continued.

This control code allows the service to receive SERVICE_CONTROL_PAUSE and SERVICE_CONTROL_CONTINUE notifications.

SERVICE_ACCEPT_SHUTDOWN
0x00000004The service is notified when system shutdown occurs.

This control code allows the service to receive SERVICE_CONTROL_SHUTDOWN notifications. Note that ControlService cannot send this notification; only the system can send it.

SERVICE_ACCEPT_STOP
0x00000001The service can be stopped.

This control code allows the service to receive SERVICE_CONTROL_STOP notifications.

This value can also contain the following extended control codes, which are supported only by HandlerEx. (Note that these control codes cannot be sent by ControlService.)

Control codeMeaningSERVICE_ACCEPT_HARDWAREPROFILECHANGE
0x00000020The service is notified when the computer's hardware profile has changed. This enables the system to send SERVICE_CONTROL_HARDWAREPROFILECHANGE notifications to the service.
Windows NT:  This value is not supported.
SERVICE_ACCEPT_POWEREVENT
0x00000040The service is notified when the computer's power status has changed. This enables the system to send SERVICE_CONTROL_POWEREVENT notifications to the service.
Windows NT:  This value is not supported.
SERVICE_ACCEPT_SESSIONCHANGE
0x00000080The service is notified when the computer's session status has changed. This enables the system to send SERVICE_CONTROL_SESSIONCHANGE notifications to the service.
Windows 2000/NT:  This value is not supported.
dwWin32ExitCode
Error code that the service uses to report an error that occurs when it is starting or stopping. To return an error code specific to the service, the service must set this value to ERROR_SERVICE_SPECIFIC_ERROR to indicate that the dwServiceSpecificExitCode member contains the error code. The service should set this value to NO_ERROR when it is running and when it terminates normally.
dwServiceSpecificExitCode
Service-specific error code that the service returns when an error occurs while the service is starting or stopping. This value is ignored unless the dwWin32ExitCode member is set to ERROR_SERVICE_SPECIFIC_ERROR.
dwCheckPoint
Check-point value that the service increments periodically to report its progress during a lengthy start, stop, pause, or continue operation. For example, the service should increment this value as it completes each step of its initialization when it is starting up. The user interface program that invoked the operation on the service uses this value to track the progress of the service during a lengthy operation. This value is not valid and should be zero when the service does not have a start, stop, pause, or continue operation pending.
dwWaitHint
Estimated time required for a pending start, stop, pause, or continue operation, in milliseconds. Before the specified amount of time has elapsed, the service should make its next call to the SetServiceStatus function with either an incremented dwCheckPoint value or a change in dwCurrentState. If the amount of time specified by dwWaitHint passes, and dwCheckPoint has not been incremented or dwCurrentState has not changed, the service control manager or service control program can assume that an error has occurred and the service should be stopped.
dwProcessId
Process identifier of the service.
dwServiceFlags
This member can be one of the following values. ValueMeaning0The service is running in a process that is not a system process, or it is not running.

If the service is running in a process that is not a system process, dwProcessId is nonzero. If the service is not running, dwProcessId is zero.

SERVICE_RUNS_IN_SYSTEM_PROCESS
0x00000001The service runs in a system process that must always be running.

Requirements

ClientRequires Windows XP or Windows 2000 Professional.ServerRequires Windows Server 2003 or Windows 2000 Server.Header

Declared in Winsvc.h; include Windows.h.

原创粉丝点击