QUERY_SERVICE_CONFIG

QUERY_SERVICE_CONFIG

The QUERY_SERVICE_CONFIG structure is used by the QueryServiceConfig function to return configuration information about an installed service.

typedef struct _QUERY_SERVICE_CONFIG {
DWORD dwServiceType;
DWORD dwStartType;
DWORD dwErrorControl;
LPTSTR lpBinaryPathName;
LPTSTR lpLoadOrderGroup;
DWORD dwTagId;
LPTSTR lpDependencies;
LPTSTR lpServiceStartName;
LPTSTR lpDisplayName; } QUERY_SERVICE_CONFIG,
*LPQUERY_SERVICE_CONFIG;
Members
dwServiceType
Type of service. This member can be one of the following values.
ValueMeaning
SERVICE_FILE_SYSTEM_DRIVER
0x00000002
File system driver service.
SERVICE_KERNEL_DRIVER
0x00000001
Driver service.
SERVICE_WIN32_OWN_PROCESS
0x00000010
Service that runs in its own process.
SERVICE_WIN32_SHARE_PROCESS
0x00000020
Service that shares a process with other services.

If the value is 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.

ValueMeaning
SERVICE_INTERACTIVE_PROCESS
0x00000100
The service can interact with the desktop.

For more information, see Interactive Services.

dwStartType
When to start the service. This member can be one of the following values.
ValueMeaning
SERVICE_AUTO_START
0x00000002
A service started automatically by the service control manager during system startup.
SERVICE_BOOT_START
0x00000000
A device driver started by the system loader. This value is valid only for driver services.
SERVICE_DEMAND_START
0x00000003
A service started by the service control manager when a process calls the StartService function.
SERVICE_DISABLED
0x00000004
A service that cannot be started. Attempts to start the service result in the error code ERROR_SERVICE_DISABLED.
SERVICE_SYSTEM_START
0x00000001
A device driver started by the IoInitSystem function. This value is valid only for driver services.
dwErrorControl
Severity of the error, and action taken, if this service fails to start. This member can be one of the following values.
ValueMeaning
SERVICE_ERROR_IGNORE
0x00000000
The startup (boot) program logs the error but continues the startup operation.
SERVICE_ERROR_NORMAL
0x00000001
The startup program logs the error and displays a message box pop-up but continues the startup operation.
SERVICE_ERROR_SEVERE
0x00000002
The startup program logs the error. 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 startup program logs the error, 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
Pointer to a null-terminated string that contains the fully qualified path to the service binary file.

The path can also include arguments for an auto-start service. These arguments are passed to the service entry point (typically the main function).

lpLoadOrderGroup
Pointer to a null-terminated string that names the load ordering group to which this service belongs. If the member is NULL or an empty string, the service does not belong to a load ordering group.

The startup program uses load ordering groups to load groups of services in a specified order with respect to the other groups. The list of load ordering groups is contained in the following registry value:

HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/ServiceGroupOrder

dwTagId
Unique tag value for this service in the group specified by the lpLoadOrderGroup parameter. A value of zero indicates that the service has not been assigned a tag. You can use a tag for ordering service startup within a load order group by specifying a tag order vector in the registry located at:

HKEY_LOCAL_MACHINE/System/CurrentControlSet/Control/GroupOrderList

Tags are only evaluated for SERVICE_KERNEL_DRIVER and SERVICE_FILE_SYSTEM_DRIVER type services that have SERVICE_BOOT_START or SERVICE_SYSTEM_START start types.

lpDependencies
Pointer to an array of null-separated names of services or load ordering groups that must start before this service. The array is doubly null-terminated. If the pointer is NULL or if it points to an empty string, the service has no dependencies. If a group name is specified, it must be prefixed by the SC_GROUP_IDENTIFIER (defined in Winsvc.h) character to differentiate it from a service name, because services and service groups share the same name space. 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
Pointer to a null-terminated string. If the service type is SERVICE_WIN32_OWN_PROCESS or SERVICE_WIN32_SHARE_PROCESS, this is the name of the account that the service process will be logged on as when it runs. This name can be of the form DomainName/Username". If the account belongs to the built-in domain, the name can be of the form "./Username". The name can also be "LocalSystem" if the process is running under the LocalSystem account.

If the service type is SERVICE_KERNEL_DRIVER or SERVICE_FILE_SYSTEM_DRIVER, this name is the driver object name (that is, /FileSystem/Rdr or /Driver/Xns) which the input and output (I/O) system uses to load the device driver. If this member is NULL, the driver is to be run with a default object name created by the I/O system, based on the service name.

lpDisplayName
Pointer to a null-terminated string that specifies the display name to be used by service control programs to identify the service. This string has a maximum length of 256 characters. The name is case-preserved in the service control manager. Display name comparisons are always case-insensitive.
Remarks

The configuration information for a service is initially specified when the service is created by a call to the CreateService function. The information can be modified by calling the ChangeServiceConfig function.

Requirements
ClientRequires Windows XP, Windows 2000 Professional, or Windows NT Workstation.
ServerRequires Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header

Declared in Winsvc.h; include Windows.h.

Unicode

Implemented as QUERY_SERVICE_CONFIGW (Unicode) and QUERY_SERVICE_CONFIGA (ANSI).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值