From c4522fd537e1a40dcff87c38752fbb3061d807ec Mon Sep 17 00:00:00 2001 From: laurentiu021 Date: Thu, 11 Jun 2026 15:56:39 +0300 Subject: [PATCH] refactor: use [LibraryImport] for SHEmptyRecycleBin --- SysManager/SysManager/Services/TuneUpService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SysManager/SysManager/Services/TuneUpService.cs b/SysManager/SysManager/Services/TuneUpService.cs index a861c23..632e2ee 100644 --- a/SysManager/SysManager/Services/TuneUpService.cs +++ b/SysManager/SysManager/Services/TuneUpService.cs @@ -19,7 +19,7 @@ namespace SysManager.Services; /// /// No admin required. No registry edits. No service changes. /// -public sealed class TuneUpService +public sealed partial class TuneUpService { private readonly ShortcutCleanerService _shortcuts; private readonly DiskHealthService _diskHealth; @@ -232,9 +232,9 @@ private static bool EmptyRecycleBin() } } - private static class NativeMethods + private static partial class NativeMethods { - [System.Runtime.InteropServices.DllImport("shell32.dll", CharSet = System.Runtime.InteropServices.CharSet.Unicode)] - internal static extern int SHEmptyRecycleBin(IntPtr hwnd, string? pszRootPath, uint dwFlags); + [System.Runtime.InteropServices.LibraryImport("shell32.dll", StringMarshalling = System.Runtime.InteropServices.StringMarshalling.Utf16, EntryPoint = "SHEmptyRecycleBinW")] + internal static partial int SHEmptyRecycleBin(IntPtr hwnd, string? pszRootPath, uint dwFlags); } }