大网数据广告活动
安装更新与部署

Authoring the Custom Actions

· 52CE 我爱测

The table below lists the five custom actions used to meet the sample specifications: ProcessAccounts, UninstallAccounts, CreateAccounts, RemoveAccounts, and RollbackAccounts.

The table below lists the five custom actions used to meet the sample specifications: ProcessAccounts, UninstallAccounts, CreateAccounts, RemoveAccounts, and RollbackAccounts. All of these custom actions are in dynamic-link libraries stored in the Binary Table. The C++ source code for the dynamic-link libraries containing the sample custom actions are provided in the Windows Installer SDK. ProcessAccounts and UninstallAccounts are in the file Process.cpp. CreateAccount is in the file Create.cpp. RemoveAccount and RollbackAccount are in the file Remove.cpp. These source files can be used to create the files Process.dll, Create.dll, and Remove.dll.

Because the creation or removal of a user account requires elevated privileges, deferred execution custom actions that run in the context of the system must be used to create, remove, or roll back user accounts. The immediate execution custom actions, ProcessAccounts and UninstallAccounts, generate the deferred custom actions that create, remove, or rollback user accounts: CreateAccount, RemoveAccount, and RollbackAccount.

Because deferred custom actions cannot read information in database tables, ProcessAccounts and UninstallUserAccouts must set a CustomActionData property to pass the information in the UserAccounts table to the deferred custom actions as described in Obtaining Context Information for Deferred Execution Custom Actions. When the installer runs the execution script, the deferred custom actions handle user accounts according to the information in the CustomActionData property.

Because all the custom actions are in dynamic-link libraries stored in the Binary table, they all include the constants msidbCustomActionTypeDll and msidbCustomActionTypeBinaryData in their base numeric type. ProcessAccounts and UninstallAccounts are examples of pure Custom Action Type 1. For information on other custom action types see the Summary List of All Custom Action Types.

CreateAccount and RemoveAccount are deferred execution custom actions that do not allow services to impersonate particular users. These custom actions include the constants msidbCustomActionTypeInScript and msidbCustomActionTypeNoImpersonate to specify these custom action in-script execution options.

RollbackAccount is a rollback custom action that only removes user accounts during a rollback installation. RollbackAccount includes the constants msidbCustomActionTypeInScript and msidbCustomActionTypeRollback to specify these custom action in-script execution options.

These custom actions may handle sensitive data such as user passwords, which should not be written to the log file. The deferred custom actions should therefore include msidbCustomActionTypeHideTarget in the custom action type. The names of the deferred custom actions also need to be added to the MsiHiddenProperties property list in the Property table because of the way immediate custom actions pass data to deferred custom actions using the CustomActionData property.

Custom action DLL entry point Custom action type
ProcessAccounts ProcessUserAccounts in Process.dll. msidbCustomActionTypeDll + msidbCustomActionTypeBinaryData = 1
UninstallAccounts UninstallUserAccounts in Process.dll. msidbCustomActionTypeDll + msidbCustomActionTypeBinaryData = 1
CreateAccount CreateUserAccount in Create.dll. msidbCustomActionTypeDll + msidbCustomActionTypeBinaryData + msidbCustomActionTypeInScript + msidbCustomActionTypeNoImpersonate + msidbCustomActionTypeHideTarget = 11265.
RemoveAccount RemoveUserAccount in Remove.dll. msidbCustomActionTypeDll + msidbCustomActionTypeBinaryData + msidbCustomActionTypeInScript + msidbCustomActionTypeNoImpersonate + msidbCustomActionTypeHideTarget = 11265.
RollbackAccount RemoveUserAccount in Remove.dll. msidbCustomActionTypeDll + msidbCustomActionTypeBinaryData + msidbCustomActionTypeInScript + msidbCustomActionTypeRollback + msidbCustomActionTypeHideTarget = 9473.

Continue to Authoring the CustomAction Table.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。