@@ -51,6 +51,7 @@ public static WindowsImage IdentifyWindowsNT(WindowsInstallProviderInterface ins
5151 string kernelPath = "" ;
5252 string softwareHivePath = "" ;
5353 string systemHivePath = "" ;
54+ string userPath = "" ;
5455
5556 var kernelEntry = fileentries . FirstOrDefault ( x =>
5657 x . EndsWith (
@@ -76,9 +77,16 @@ public static WindowsImage IdentifyWindowsNT(WindowsInstallProviderInterface ins
7677 systemHivePath = installProvider . ExpandFile ( systemHiveEntry ) ;
7778 }
7879
80+ var userEntry = fileentries . FirstOrDefault ( x => x . EndsWith ( @"\system32\user.exe" , StringComparison . InvariantCultureIgnoreCase ) ) ;
81+ if ( userEntry != null )
82+ {
83+ userPath = installProvider . ExpandFile ( userEntry ) ;
84+ }
85+
7986 #region Version Gathering
8087 VersionInfo1 info = new VersionInfo1 ( ) ;
8188 VersionInfo2 info2 = new VersionInfo2 ( ) ;
89+ VersionInfo1 info3 = new VersionInfo1 ( ) ;
8290
8391 if ( ! string . IsNullOrEmpty ( kernelPath ) )
8492 {
@@ -97,11 +105,18 @@ public static WindowsImage IdentifyWindowsNT(WindowsInstallProviderInterface ins
97105 info2 = ExtractVersionInfo2 ( softwareHivePath , systemHivePath ) ;
98106 }
99107
108+ if ( ! string . IsNullOrEmpty ( userPath ) )
109+ {
110+ Console . WriteLine ( "Extracting version information from the image 3" ) ;
111+ info3 = ExtractVersionInfo ( userPath ) ;
112+ }
113+
100114 report . Tag = info2 . Tag ;
101115 report . Licensing = info2 . Licensing ;
102116 report . LanguageCodes = info2 . LanguageCodes ;
103117
104118 WindowsVersion correctVersion = Common . GetGreaterVersion ( info . version , info2 . version ) ;
119+ correctVersion = Common . GetGreaterVersion ( correctVersion , info3 . version ) ;
105120
106121 if ( correctVersion != null )
107122 {
@@ -163,6 +178,13 @@ public static WindowsImage IdentifyWindowsNT(WindowsInstallProviderInterface ins
163178 if ( ! string . IsNullOrEmpty ( systemHivePath ) )
164179 File . Delete ( systemHivePath ) ;
165180
181+ report = FixSkuNames ( report , IsUnstaged ) ;
182+
183+ return report ;
184+ }
185+
186+ public static WindowsImage FixSkuNames ( WindowsImage report , bool IsUnstaged )
187+ {
166188 if ( ! string . IsNullOrEmpty ( report . Sku ) )
167189 {
168190 if ( report . BuildNumber > 2195 )
@@ -255,7 +277,14 @@ private static VersionInfo1 ExtractVersionInfo(string kernelPath)
255277
256278 FileVersionInfo info = FileVersionInfo . GetVersionInfo ( kernelPath ) ;
257279
258- result . Architecture = Common . GetMachineTypeFromFile ( new FileStream ( kernelPath , FileMode . Open ) ) ;
280+ try
281+ {
282+ result . Architecture = Common . GetMachineTypeFromFile ( new FileStream ( kernelPath , FileMode . Open ) ) ;
283+ }
284+ catch
285+ {
286+
287+ }
259288
260289 var ver = info . FileVersion ;
261290
0 commit comments