Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Quality: Use LibraryImportAttribute at undocumented EntryPoint #15298

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Files.App/Helpers/Environment/ElevationHelpers.cs
yaira2 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

using System.Runtime.InteropServices;
using System.Security.Principal;

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

return Win32PInvoke._IsElevationRequired(filePath);
return Win32PInvoke.IsElevationRequired(filePath);
}

public static bool IsAppRunAsAdmin()
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Helpers/Win32/Win32PInvoke.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ public static extern int CompareStringEx(
int param
);

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

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