SEBWIN-759, #606: Fixed bug in cursor path verification.

This commit is contained in:
Damian Büchel 2023-10-11 15:50:17 +02:00
parent f7479cd1a8
commit 2ef7c2c5ec

View file

@ -66,7 +66,7 @@ namespace SafeExamBrowser.Runtime.Operations
private bool VerifyCursorConfiguration() private bool VerifyCursorConfiguration()
{ {
var success = true; var success = true;
var systemPath = $@"{Environment.ExpandEnvironmentVariables("%SystemRoot%")}\cursors\"; var systemPath = $@"{Environment.ExpandEnvironmentVariables("%SystemRoot%")}\Cursors\";
logger.Info($"Attempting to verify cursor configuration..."); logger.Info($"Attempting to verify cursor configuration...");
@ -75,7 +75,7 @@ namespace SafeExamBrowser.Runtime.Operations
foreach (var cursor in cursors.Where(c => !string.IsNullOrWhiteSpace(c))) foreach (var cursor in cursors.Where(c => !string.IsNullOrWhiteSpace(c)))
{ {
success &= registry.TryRead(RegistryValue.UserHive.Cursors_Key, cursor, out var value); success &= registry.TryRead(RegistryValue.UserHive.Cursors_Key, cursor, out var value);
success &= value == default || !(value is string) || (value is string path && (string.IsNullOrWhiteSpace(path) || path.StartsWith(systemPath))); success &= value == default || !(value is string) || (value is string path && (string.IsNullOrWhiteSpace(path) || path.StartsWith(systemPath, StringComparison.OrdinalIgnoreCase)));
if (!success) if (!success)
{ {