Szerkesztés

Megosztás a következőn keresztül:


ServiceInstall Table

The ServiceInstall table is used to install a service and has the following columns.

Column Type Key Nullable
ServiceInstall Identifier Y N
Name Formatted N N
DisplayName Formatted N Y
ServiceType DoubleInteger N N
StartType DoubleInteger N N
ErrorControl DoubleInteger N N
LoadOrderGroup Formatted N Y
Dependencies Formatted N Y
StartName Formatted N Y
Password Formatted N Y
Arguments Formatted N Y
Component_ Identifier N N
Description Formatted N Y

 

Columns

ServiceInstall

This is the primary key for the table.

Name

This column is the string that gives the service name to install. The string has a maximum length of 256 characters. The service control manager database preserves the case of the characters in the service name, but comparisons of service names are case insensitive. Forward-slash (/) and back-slash (\) are invalid service name characters.

DisplayName

This column is the localizable string that user interface programs use to identify the service. The string has a maximum length of 256 characters. The service control manager preserves the case of the display name, but display name comparisons are case insensitive.

ServiceType

This column is a set of bit flags that specify the type of service. One of the following service types must be specified in this column.

Type of service Value Description
SERVICE_WIN32_OWN_PROCESS 0x00000010 A Microsoft Win32 service that runs its own process.
SERVICE_WIN32_SHARE_PROCESS 0x00000020 A Win32 service that shares a process.
SERVICE_INTERACTIVE_PROCESS 0x00000100 A Win32 service that interacts with the desktop. This value cannot be used alone and must be added to one of the two previous types.The StartName column must be set to LocalSystem or null when using this flag.

 

The following types of service are unsupported.

Type of service Value Description
SERVICE_KERNEL_DRIVER 0x00000001 A driver service.
SERVICE_FILE_SYSTEM_DRIVER 0x00000002 A file system driver service.

 

StartType

This column is a set of bit flags that specify when to start the service. One of the following types of service start must be specified in this column.

Type of service start Value Description
SERVICE_AUTO_START 0x00000002 A service start during startup of the system.
SERVICE_DEMAND_START 0x00000003 A service start when the service control manager calls the StartService function.
SERVICE_DISABLED 0x00000004 Specifies a service that can no longer be started.

 

The Windows Installer cannot use the SERVICE_BOOT_START and SERVICE_SYSTEM_START options.

ErrorControl

This column specifies the action taken by the startup program if the service fails to start during startup. These values affect the ServiceControl StartService events for installed services. One of the following error control flags must be specified in this column.

Adding the constant msidbServiceInstallErrorControlVital (value = 0x08000) to the flags in the following table specifies that the overall install should fail if the service cannot be installed into the system.

Error control flag Value Startup program's action
SERVICE_ERROR_IGNORE 0x00000000 Logs the error and continues with the startup operation.
SERVICE_ERROR_NORMAL 0x00000001 Logs the error, displays a message box and continues the startup operation.
SERVICE_ERROR_CRITICAL 0x00000003 Logs the error if it is possible and the system is restarted with the last configuration known to be good. If the last-known-good configuration is being started, the startup operation fails.

 

LoadOrderGroup

This column contains the string that names the load ordering group of which this service is a member. Specify null or an empty string if the service does not belong to a group.

Dependencies

This column is a list of names of services or load ordering groups that the system must start before this service. Separate names in the list by Nulls. If the service has no dependencies, then specify Null or an empty string. Use the syntax [~] to insert a Null. 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.

For example, to require that the system start service1 and service2, before starting the service listed in the ServiceInstall column, enter service1[~]service2[~][~] into the Dependencies column. The identifiers service1 and service2 must either occur in the primary key of the table or be the name of the service that is already installed.

You must prefix group names with + so that they can be distinguished from a service name. To require that the system start service1 and at least one member of the ordering group MyGroup before starting the service listed in the ServiceInstall column, enter service1[~]+MyGroup[~][~].

StartName

The service is logged on as the name given by the string in this column. If the service type is SERVICE_WIN32_OWN_PROCESS use an account name in the form: DomainName\UserName. If the account belongs to the built-in domain it is permitted to specify .\UserName. The LocalSystem account must be used if the type of service is SERVICE_WIN32_SHARE_PROCESS or SERVICE_INTERACTIVE_PROCESS. The CreateService function uses the LocalSystem account if StartName is specified as null and most services therefore leave this column blank.

Password

This string is the password to the account name specified in the StartName column. Note that the user must have permissions to log on as a service. The service has no password if StartName is null or an empty string. The Startname of LocalSystem is null, and therefore the password in this instance is null, so most services leave this column blank.

Note that after deleting a service that was installed with a user name and password, the installer cannot rollback the service without first using a custom action to get the password. The installer can acquire all the necessary information about the service except the password, which is stored in a protected part of the system. The custom action acquires the password by prompting the user, reading a property from the database, or reading a file. The custom action must then call ChangeServiceConfig, to supply the password, before reinstalling the service.

Windows Installer does not write the value entered into the Password field into the log file.

Arguments

This column contains any command line arguments or properties required to run the service.

Component_

External key to column one of the Component Table. Note that to install this service using the InstallService table, the KeyPath for this component must be the executable file for the service.

Description

This column contains a localizable description for the service being configured. If this column is left blank the installer uses the existing description of the service if one exists. For more information, see SERVICE_DESCRIPTION in the Microsoft Windows Software Development Kit (SDK). To erase an existing description enter "[~]" in this column. This results in a blank description for either a new or existing service.

Remarks

The InstallServices action in sequence tables processes the information in this table. For information about using sequence tables, see Using a Sequence Table.

This table has most of the parameters to the Win32 CreateService function.

Although it is possible to use the user interface to specify that a service be installed as run-from-source, the installer does not actually support this type of installation. Services that run with the privilege level of the local system must be installed to run from the local hard drive. Avoid installing services that impersonate the privileges of a particular user because this may write security data into a log or the system registry. This can potentially create a security problem, password conflict, or the loss of configuration data when the system is restarted.

To delete a service during an uninstallation, there must be a corresponding record for the service in the ServiceControl table and the msidbServiceControlEventUninstallDelete flag must appear in the Event column. The installer does not delete a service in the ServiceInstall table during uninstallation without this entry in the ServiceControl table.

For information on how to secure a service see the MsiLockPermissionsEx Table.

Validation

ICE03
ICE06
ICE32
ICE45
ICE46
ICE66
ICE69