共用方式為


2.2.14 QUERY_SERVICE_CONFIGA

The QUERY_SERVICE_CONFIGA structure defines configuration information about an installed service. String values are stored in ANSI.

 typedef struct _QUERY_SERVICE_CONFIGA {
   DWORD dwServiceType;
   DWORD dwStartType;
   DWORD dwErrorControl;
   [string,range(0, 8 * 1024)] LPSTR lpBinaryPathName;
   [string,range(0, 8 * 1024)] LPSTR lpLoadOrderGroup;
   DWORD dwTagId;
   [string,range(0, 8 * 1024)] LPSTR lpDependencies;
   [string,range(0, 8 * 1024)] LPSTR lpServiceStartName;
   [string,range(0, 8 * 1024)] LPSTR lpDisplayName;
 } QUERY_SERVICE_CONFIGA,
  *LPQUERY_SERVICE_CONFIGA;

dwServiceType: The type of service. This member MUST be one of the following values.

Value

Meaning

SERVICE_KERNEL_DRIVER

0x00000001

A driver service. These are services that manage devices on the system.

SERVICE_FILE_SYSTEM_DRIVER

0x00000002

A file system driver service. These are services that manage file systems on the system.

SERVICE_WIN32_OWN_PROCESS

0x00000010

A service that runs in its own process.

SERVICE_WIN32_SHARE_PROCESS

0x00000020

A service that shares a process with other services.

dwStartType: Defines when to start the service. This member MUST be one of the following values.

Value

Meaning

SERVICE_BOOT_START

0x00000000

Starts the driver service when the system boots up. This value is valid only for driver services.

SERVICE_SYSTEM_START

0x00000001

Starts the driver service when the system boots up. This value is valid only for driver services. The services marked SERVICE_SYSTEM_START are started after all SERVICE_BOOT_START services have been started.

SERVICE_AUTO_START

0x00000002

A service started automatically by the SCM during system startup.

SERVICE_DEMAND_START

0x00000003

Starts the service when a client requests the SCM to start the service.

SERVICE_DISABLED

0x00000004

A service that cannot be started. Attempts to start the service result in the error code ERROR_SERVICE_DISABLED.

dwErrorControl: The severity of the error if this service fails to start during startup, and the action that the SCM takes if failure occurs.

Value

Meaning

SERVICE_ERROR_IGNORE

0x00000000

The SCM ignores the error and continues the startup operation.

SERVICE_ERROR_NORMAL

0x00000001

The SCM logs the error in the event log and continues the startup operation.

SERVICE_ERROR_SEVERE

0x00000002

The SCM logs the error in the event log. If the last-known good configuration is being started, the startup operation continues. Otherwise, the system is restarted with the last-known good configuration.

SERVICE_ERROR_CRITICAL

0x00000003

The SCM SHOULD log the error in the event log if possible. If the last-known good configuration is being started, the startup operation fails. Otherwise, the system is restarted with the last-known good configuration.

lpBinaryPathName: A pointer to a null-terminated string that contains the fully qualified path to the service binary file. The path MAY include arguments. If the path contains a space, it MUST be quoted so that it is correctly interpreted. For example, "d:\\my share\\myservice.exe" is specified as "\"d:\\my share\\myservice.exe\"".

lpLoadOrderGroup: A pointer to a null-terminated string that names the service group for load-ordering of which this service is a member. If the pointer is NULL or if it points to an empty string, the service does not belong to a group.

dwTagId: A unique tag value for this service within the service group specified by the lpLoadOrderGroup parameter. A value of 0 indicates that the service has not been assigned a tag.

lpDependencies: A pointer to an array of null-separated names of services or names of service groups that MUST start before this service. The array is doubly null-terminated. Service group names are prefixed with a "+" character (to distinguish them from service names). If the pointer is NULL or if it points to an empty string, the service has no dependencies. Cyclic dependency between services is not allowed. The character set is ANSI. Dependency on a service means that this service can only run if the service it depends on is running. Dependency on a group means that this service can run if at least one member of the group is running after an attempt to start all members of the group.

lpServiceStartName: A pointer to a null-terminated string that contains the service name.

lpDisplayName: A pointer to a null-terminated string that contains the service display name.