2013-12-13 34 views
1

我的管理引導器應用爲昨天無法在某些機器上運行,並出現以下錯誤:維克斯燒傷管理引導程序加載失敗 - Errror 0x80040150

[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由SERVIC調用e使用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工具集,同樣的問題仍然存在。這似乎只在某些機器上出現。我的自定義託管引導程序代碼庫沒有任何變化,它幾個月來一直運行得非常完美。

我確認我沒有遇到類似錯誤的其他人的相同問題(here,here,here,here)。

如果有人能夠說出一些亮點,我們將不勝感激。

UPDATE

一些試驗和錯誤後,當啓動安裝套件中的服務是安裝包的調用之前重新開始踢,從一個不同的進程空間的出現,則不會出現此問題。然而它不是確定性的。

回答

0

我已將其縮小爲兩件事情的組合,不一定相關:(a)離開用戶註冊表配置單元的孤立句柄的服務和(b)Windows用戶配置文件服務主動地殺死任何用戶註冊表配置單元句柄該服務已經開放供引導程序使用。

重新啓動服務似乎可以緩解這個問題,我相信通過在啓動引導程序之前清除掉任何孤立的註冊表句柄。另一種解決方案可能是通過P/Invoke使用本機C++調用來創建進程,並讓子進程繼承句柄(.NET調用似乎不允許用戶明確指定句柄的繼承)。這應該防止用戶配置文件服務將註冊表句柄檢測爲孤立,並允許引導程序根據需要使用用戶配置文件的資源。此外,我還最終在調用安裝工具包之前加載服務標識的用戶配置文件。這些步驟的組合解決了這個問題。

相關問題