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

Guidelines for Securing Custom Actions

· 52CE 我爱测

To help maintain secure a software installation, adhere to these guidelines when authoring a Windows Installer custom action.

Adherence to the following guidelines when authoring a Windows Installer package with custom actions helps maintain a secure environment during installation:

  • Secure any additional files written by your custom action.
  • Check buffer lengths and validity of all data read by your custom action. This includes properties that may supply data to your custom action, particularly those that use public properties provided by a user.
  • Do not rely on external DLLs that are not trusted by the system on all platforms on which your installation package is intended to run.
  • Carefully consider whether to use custom actions that use elevated privileges or impersonation. Custom actions such as “open a URL after installation is completed,” “launch the software after installation is complete,” or “launch ReadMe after installation is complete” would not usually require elevated privileges to function. If your custom action must run with elevated privileges, be sure that the custom action code guards against buffer overruns and inadvertent loading of unsafe code. Note that during the execution phase of the installation, the installer passes information to a process with elevated privileges and runs the script. Any custom actions that run during the execution phase may run with elevated privileges.
  • Gather all information provided by the user during the UI sequence. Do not prompt the user for any information that can't be set using a public property.
  • If your script custom action expands properties, take precautions that the custom action is secured against the possibility of script injection. Script may be logged in clear text.

See also Custom Action Security.

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)

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

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