WIX-MSI:如果msiexec被杀死,则启用密码的卸载失败

时间:2019-03-28 13:35:15

标签: wix password-protection custom-action msiexec wix3.11

我们有一个wix msi项目和自定义操作dll。卸载时,它将启动自定义操作,要求用户输入密码并验证密码以允许卸载。

自定义操作

<CustomAction Id="CA_Uninstall"
              BinaryKey="BIN"
              DllEntry="ValidatePassword"
              Execute="immediate"
              Impersonate="yes"
              Return="check" />

自定义操作调用

<Custom Action="CA_ProtectUninstall" After="InstallInitialize">
<![CDATA[Uninstalling = "true"]]>
</Custom>

自定义操作在内部创建MFC对话框并验证密码。 自定义操作的一部分

    UINT er = ERROR_INSTALL_FAILURE;

    // launch MFC dialog and validates password
    int ret = dlg.DoModal(hParent);

    er = ret == IDOK ? ERROR_SUCCESS : ERROR_INSTALL_USEREXIT;
    return WcaFinalize(er);

问题: 此自定义操作可以正常运行,并且可以正确验证密码。每当卸载开始时,Windows就会在用户上下文中启动进程msiexec.exe。现在有2个msiexec.exe进程,系统中有1个,用户上下文中有1个。 卸载时,显示密码对话框时,如果用户从用户上下文中杀死msiexec进程,则密码对话框将关闭,并且无需验证密码即可成功卸载。

任何人都可以帮助我解决此问题吗?请随时提出任何更好的选择来处理受密码保护的卸载。

卸载日志以执行自定义操作

MSI (s) (B4:A8) [16:21:20:873]: Doing action: CA_Uninstall
MSI (s) (B4:A8) [16:21:20:873]: Note: 1: 2205 2:  3: ActionText 
Action ended 16:21:20: InstallInitialize. Return value 1.
MSI (s) (B4:90) [16:21:20:885]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI4913.tmp, Entrypoint: ValidatePassword
Action start 16:21:20: CA_Uninstall.
MSI (s) (B4:90) [16:21:29:686]: Leaked MSIHANDLE (252) of type 790541 for thread 20604
MSI (s) (B4:90) [16:21:29:686]: Note: 1: 2769 2: CA_Uninstall 3: 1 
MSI (s) (B4:90) [16:21:29:686]: Note: 1: 2205 2:  3: Error 
MSI (s) (B4:90) [16:21:29:686]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2769 
ValidatePassword:  ValidatePassword: UILevel=3
DEBUG: Error 2769:  Custom Action CA_Uninstall did not close 1 MSIHANDLEs.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769. The arguments are: CA_Uninstall, 1, 

0 个答案:

没有答案