Keep the GUI as the index writer for now; mutex, named pipe, and opt-in logon autostart prepare Explorer.Host.exe without two SQLite writers. Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
764 B
C#
29 lines
764 B
C#
using System.Security.Principal;
|
|
using Explorer.Application;
|
|
|
|
namespace Explorer.Windows;
|
|
|
|
public sealed class WindowsElevatedScanService : IElevatedScanService
|
|
{
|
|
public bool IsElevated
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
using var identity = WindowsIdentity.GetCurrent();
|
|
return new WindowsPrincipal(identity).IsInRole(WindowsBuiltInRole.Administrator);
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Queue, index writer, and watchers stay in the user session. Elevation is never requested.
|
|
public bool CanRequestElevation => false;
|
|
|
|
public string ProtectedContentHint => "Protected content requires administrator privileges.";
|
|
}
|