Skip to content

Commit c020bb8

Browse files
committed
BuildTools: Fix showing incorrect windows version for the current build
1 parent 3ce7bdc commit c020bb8

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

tools/CustomBuildTool/Utils.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,23 +173,18 @@ public static string GetKernelVersion()
173173
{
174174
try
175175
{
176-
string filePath = null;
176+
string filePath = GetEnvironmentVariable("%SystemRoot%\\System32\\ntoskrnl.exe");
177177

178-
if (Environment.Is64BitProcess)
179-
filePath = GetEnvironmentVariable("%SystemRoot%\\System32\\ntoskrnl.exe");
180-
else
178+
if (!File.Exists(filePath))
181179
filePath = GetEnvironmentVariable("%SystemRoot%\\Sysnative\\ntoskrnl.exe");
182180

183-
if (!string.IsNullOrWhiteSpace(filePath))
181+
if (File.Exists(filePath))
184182
{
185183
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(filePath);
186184
return versionInfo.FileVersion ?? string.Empty;
187185
}
188186
}
189-
catch (Exception ex)
190-
{
191-
Console.WriteLine(ex.ToString());
192-
}
187+
catch (Exception) { }
193188

194189
return string.Empty;
195190
}
Binary file not shown.

0 commit comments

Comments
 (0)