File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -173,23 +173,18 @@ public static string GetKernelVersion()
173
173
{
174
174
try
175
175
{
176
- string filePath = null ;
176
+ string filePath = GetEnvironmentVariable ( "%SystemRoot% \\ System32 \\ ntoskrnl.exe" ) ;
177
177
178
- if ( Environment . Is64BitProcess )
179
- filePath = GetEnvironmentVariable ( "%SystemRoot%\\ System32\\ ntoskrnl.exe" ) ;
180
- else
178
+ if ( ! File . Exists ( filePath ) )
181
179
filePath = GetEnvironmentVariable ( "%SystemRoot%\\ Sysnative\\ ntoskrnl.exe" ) ;
182
180
183
- if ( ! string . IsNullOrWhiteSpace ( filePath ) )
181
+ if ( File . Exists ( filePath ) )
184
182
{
185
183
FileVersionInfo versionInfo = FileVersionInfo . GetVersionInfo ( filePath ) ;
186
184
return versionInfo . FileVersion ?? string . Empty ;
187
185
}
188
186
}
189
- catch ( Exception ex )
190
- {
191
- Console . WriteLine ( ex . ToString ( ) ) ;
192
- }
187
+ catch ( Exception ) { }
193
188
194
189
return string . Empty ;
195
190
}
You can’t perform that action at this time.
0 commit comments