Skip to content

Commit 164096e

Browse files
authored
Code Quality: Use LibraryImportAttribute at undocumented EntryPoint (#15298)
1 parent c72fa98 commit 164096e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Files.App/Helpers/Environment/ElevationHelpers.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) 2024 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using System.Runtime.InteropServices;
54
using System.Security.Principal;
65

76
namespace Files.App.Helpers
@@ -13,7 +12,7 @@ public static bool IsElevationRequired(string filePath)
1312
if (string.IsNullOrEmpty(filePath))
1413
return false;
1514

16-
return Win32PInvoke._IsElevationRequired(filePath);
15+
return Win32PInvoke.IsElevationRequired(filePath);
1716
}
1817

1918
public static bool IsAppRunAsAdmin()

src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@ public static extern int CompareStringEx(
426426
int param
427427
);
428428

429-
[DllImport("shell32.dll", EntryPoint = "#865", CharSet = CharSet.Unicode, SetLastError = true)]
429+
[LibraryImport("shell32.dll", EntryPoint = "#865", SetLastError = true)]
430430
[return: MarshalAs(UnmanagedType.Bool)]
431-
public static extern bool _IsElevationRequired(
431+
public static partial bool IsElevationRequired(
432432
[MarshalAs(UnmanagedType.LPWStr)] string pszPath);
433433

434434
[DllImport("shlwapi.dll", CallingConvention = CallingConvention.StdCall, PreserveSig = true, CharSet = CharSet.Unicode)]

0 commit comments

Comments
 (0)