Skip to content

Feature: Display "shield overall" indicating elevation is required #4845

Closed
@ADeltaX

Description

@ADeltaX

Windows Explorer displays an overlayed tiny shield icon for executables that requires an elevation.
image

Describe the solution
The following function will let you know if an elevation is required for a given executable file path.

[DllImport("shell32.dll", EntryPoint = "#865", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)] private static extern bool IsElevationRequired([MarshalAs(UnmanagedType.LPWStr)] string pszPath);

Usage:

var isElevationRequired = IsElevationRequired(@"C:\Windows\regedit.exe");

@yaichenbaum

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions