【问题标题】:WiX Burn Managed Bootstrapper fails to load - Errror 0x80040150WiX Burn Managed Bootstrapper 加载失败 - 错误 0x80040150
【发布时间】:2013-12-13 23:52:21
【问题描述】:

截至昨天,我的托管引导程序应用程序无法在某些机器上运行,并出现以下错误:

[07F4:13CC][2013-12-12T12:20:31]e000: Error 0x80040150: Failed to create the managed bootstrapper application. 
[07F4:13CC][2013-12-12T12:20:31]e000: Error 0x80040150: Failed to create UX.
[07F4:13CC][2013-12-12T12:20:31]e000: Error 0x80040150: Failed to load UX.
[07F4:13CC][2013-12-12T12:20:31]e000: Error 0x80040150: Failed while running
... 
...
[07F4:13CC][2013-12-12T12:20:31]e000: Error 0x80040150: Failed to run per-user mode.

显然,0x80040150 (2147746128) 是:REGDB_E_READREGDB: 无法从注册表中读取密钥

在事件日志中,我可以看到

Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards. No user action is required.  

 DETAIL - 
 7 user registry handles leaked from \Registry\User\S-1-5-21-4128267814-1525589554-1895505527-1113_Classes:
Process 4332 (\Device\HarddiskVolume4\Users\<username>\AppData\Roaming\<companyname>\<product>\<file>.exe) has opened key \REGISTRY\USER\S-1-5-21-4128267814-1525589554-1895505527-1113_CLASSES
Process 4332 (\Device\HarddiskVolume4\Users\<username>\AppData\Roaming\<companyname>\<product>\<file>.exe) has opened key \REGISTRY\USER\S-1-5-21-4128267814-1525589554-1895505527-1113_CLASSES
Process 6180 (\Device\HarddiskVolume4\Users\<username>\AppData\Roaming\<companyname>\<product>\<folder>\BurnBasedSetupKit.exe) has opened key \REGISTRY\USER\S-1-5-21-4128267814-1525589554-1895505527-1113_CLASSES
Process 6180 (\Device\HarddiskVolume4\Users\<username>\AppData\Roaming\<companyname>\<product>\<folder>\BurnBasedSetupKit.exe) has opened key \REGISTRY\USER\S-1-5-21-4128267814-1525589554-1895505527-1113_CLASSES
Process 3408 (\Device\HarddiskVolume4\Users\<username>\AppData\Roaming\<companyname>\<product>\<folder>\BurnBasedSetupKit.exe) has opened key \REGISTRY\USER\S-1-5-21-4128267814-1525589554-1895505527-1113_CLASSES
Process 3408 (\Device\HarddiskVolume4\Users\<username>\AppData\Roaming\<companyname>\<product>\<folder>\BurnBasedSetupKit.exe) has opened key \REGISTRY\USER\S-1-5-21-4128267814-1525589554-1895505527-1113_CLASSES
Process 4332 (\Device\HarddiskVolume4\Users\<username>\AppData\Roaming\<companyname>\<product>\<file>.exe) has opened key \REGISTRY\USER\S-1-5-21-4128267814-1525589554-1895505527-1113_CLASSES

值得一提的是,BurnBasedSetupKit.exe 是由使用 c# 代码的服务调用的:

Process proc = new Process();
proc.StartInfo.FileName = "BurnBasedSetupKit.exe";
proc.StartInfo.Arguments = string.Format("-s -l {0}", logFileName);
proc.StartInfo.Verb = "runas";
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.ErrorDialog = false;
proc.StartInfo.RedirectStandardOutput = true;    
proc.Start();
proc.WaitForExit();
if (proc.ExitCode != 0)
{
    throw new Exception(string.Format("Setup execution process exited with non-zero ExitCode: {0}", proc.ExitCode.ToString()));
}    

该服务在本地管理员组中的用户下运行。 BurnBasedSetupKit.exe 很可能在机器运行但没有用户登录时被服务调用。[注意:当交互调用 BurnBasedSetupKit.exe 工具包时,一切正常。]

我尝试升级到最新的稳定版 WiX 工具集,但同样的问题仍然存在。这似乎只在某些机器上表现出来。我的自定义托管引导程序代码库没有任何变化,该代码库已经完美运行了几个月。

我已确认我与遇到类似错误的其他人没有相同的问题(herehereherehere)。

如果有人能提供一些启示,将不胜感激。

更新

经过一些试验和错误,在启动设置工具包的调用开始之前重新启动启动设置工具包的服务时,从不同的进程空间开始,此问题不会发生。然而,它并不是完全确定的。

【问题讨论】:

    标签: c# wix installation bootstrapper burn


    【解决方案1】:

    我已将其缩小为两件事的组合,不一定相关:(a) 将孤立句柄留给用户注册表配置单元的服务和 (b) Windows 用户配置文件服务主动杀死任何用户注册表配置单元句柄服务已打开供引导程序使用。

    我相信通过在调用引导程序之前清除所有孤立的注册表句柄,重新启动服务似乎可以缓解这个问题。另一种解决方案可能是通过 P/Invoke 使用本机 C++ 调用创建进程并让子进程继承句柄(.NET 调用似乎不允许用户显式指定句柄的继承)。这应该防止用户配置文件服务将注册表句柄检测为孤立的,并允许引导程序根据需要使用用户配置文件的资源。此外,我还最终在调用设置工具包之前加载了服务身份的用户配置文件。这些步骤的组合解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 1970-01-01
      • 1970-01-01
      • 2014-01-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多