Hi,
I wrote an .NET C# application where I want to use the OpenFileDialog class for chosing a file for some actions. This program should also run on Windows PE.
On Windows PE when I try to open the OpenFileDialog an exception was raised:
“Retrieving the COM class factory for component with CLSID {DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7} failed due to the following error: 80040154. at System.Windows.Forms.OpenFileDialog.CreateVistaDialog() at System.Windows.Forms.FileDialog.RunDialogVista(IntPtr hWndOwner) at System.Windows.Forms.FileDialog.RunDialog(IntPtr hWndOwner) at System.Windows.Forms.CommonDialog.ShowDialog(IWin32Window owner) at System.Windows.Forms.CommonDialog.ShowDialog() at ScruffyDuck.AirportDesignEditor.MainForm.getOpenFileInfo(String initialDirectory, String filter)”
I started procmon to see what’s happend in background and found out that on Windows PE some DLL are not present:
The “ShellStyle.dll” is missing.
I’m went back to the computer where I created my the WinPE image and added also the ShellStyle.dll from this computer (Architecture and Buildnumber of WinPE and the of the Windows from where you copy ShellStyle.dll from should be the same) to the WinPE System32 Folder X:\Windows\System32
Also edputil.dll and ExplorerFrame.dll are also required, otherwise the OpenFileDialog opens but the folder view is empty.
For the ExplorerFrame.dll the class registration HKLM\Software\CLasses\CLSID\{AE054212-3535-4430-83ED-D501AA6680E6} must be created in Windows PE.
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{AE054212-3535-4430-83ED-D501AA6680E6}] @="Shell Name Space ListView" [HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{AE054212-3535-4430-83ED-D501AA6680E6}\InProcServer32] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\ 00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,65,00,78,00,\ 70,00,6c,00,6f,00,72,00,65,00,72,00,66,00,72,00,61,00,6d,00,65,00,2e,00,64,\ 00,6c,00,6c,00,00,00 "ThreadingModel"="Apartment"
During the creation of the Windows PE load the PE’s Software registry and add the missing key.
After adding the DLL’s to the system32 folder the application works as expected 🙂
Michael