ronantakizawa/codereview-bench huggingface dataset:
Repository: files-community/Files
File: src/Files.App/Actions/FileSystem/Transfer/BaseTransferItemAction.cs (C#)

Code before:

				dataPackage.Properties.PackageFamilyName = Windows.ApplicationModel.Package.Current.Id.FamilyName;
				dataPackage.SetStorageItems(items, false);

				Clipboard.SetContent(dataPackage);
			}
			catch (Exception ex)
			{
				dataPackage = default;

				if ((FileSystemStatusCode)ex.HResult is FileSystemStatusCode.Unauthorized)
				{
					string[] filePaths = ContentPageContext.SelectedItems.Select(x => x.ItemPath).ToArray();
					await FileOperationsHelpers.SetClipboard(filePaths, type);

					return;
				}

				// Reset cut mode
				ContentPageContext.ShellPage.SlimContentPage.ItemManipulationModel.RefreshItemsOpacity();

				return;
			}
			finally
			{
				if (statusCenterItem is not null)
					StatusCenterViewModel.RemoveItem(statusCenterItem);
			}
		}

		private void ContentPageContext_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			if (e.PropertyName is nameof(IContentPageContext.HasSelection))
				OnPropertyChanged(nameof(IsExecutable));
		}
	}
}


Review comment (suggestion):
@hishitetsu I’m wondering if the app should report the produced exception since this try-catch may throw IOException (and others in WinRT APIs) before returning.

Code after:
					return;

				dataPackage.Properties.PackageFamilyName = Windows.ApplicationModel.Package.Current.Id.FamilyName;
				dataPackage.SetStorageItems(items, false);

				Clipboard.SetContent(dataPackage);
			}
			catch (Exception ex)
			{
				dataPackage = default;

				if (ex is not IOException)
					App.Logger.LogWarning(ex, "Failed to process cutting/copying due to an unknown error.");

				if ((FileSystemStatusCode)ex.HResult is FileSystemStatusCode.Unauthorized)
				{
					string[] filePaths = ContentPageContext.SelectedItems.Select(x => x.ItemPath).ToArray();
					await FileOperationsHelpers.SetClipboard(filePaths, type);

					return;
				}

				// Reset cut mode
				ContentPageContext.ShellPage.SlimContentPage.ItemManipulationModel.RefreshItemsOpacity();

				return;
			}
			finally
			{
				if (statusCenterItem is not null)
					StatusCenterViewModel.RemoveItem(statusCenterItem);
			}
		}

		private void ContentPageContext_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			if (e.PropertyName is nameof(IContentPageContext.HasSelection))
				OnPropertyChanged(nameof(IsExecutable));
		}
	}
}
Repository: files-community/Files
File: src/Files.App.OpenDialog/FilesOpenDialog.cpp (C++)

Code before:
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

// Abstract:
//  Implementation of CFilesOpenDialog.

#include "pch.h"
#include <shlobj.h>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <locale>
#include <codecvt>
#include "FilesOpenDialog.h"

//#define SYSTEMDIALOG

using std::cout;
using std::wcout;
using std::endl;

CComPtr<IFileOpenDialog> GetSystemDialog()
{
	WCHAR comdlg32Path[MAX_PATH];
	ExpandEnvironmentStrings(L"%SYSTEMDRIVE%\\Windows\\System32\\comdlg32.dll", comdlg32Path, MAX_PATH - 1);

	HINSTANCE lib = CoLoadLibrary(comdlg32Path, false);
	BOOL(WINAPI* dllGetClassObject)(REFCLSID, REFIID, LPVOID*) = 
		(BOOL(WINAPI*)(REFCLSID, REFIID, LPVOID*))GetProcAddress(lib, "DllGetClassObject");
	CComPtr<IClassFactory> pClassFactory;
	dllGetClassObject(CLSID_FileOpenDialog, IID_IClassFactory, (void**)&pClassFactory);
	CComPtr<IFileOpenDialog> systemDialog;
	pClassFactory->CreateInstance(NULL, IID_IFileOpenDialog, (void**)&systemDialog);
	//CoFreeLibrary(lib);
	return systemDialog;
}

IShellItem* CloneShellItem(IShellItem* psi)
{
	IShellItem* item = NULL;
	if (psi)
	{
		PIDLIST_ABSOLUTE pidl;
		if (SUCCEEDED(SHGetIDListFromObject(psi, &pidl)))
		{
			SHCreateItemFromIDList(pidl, IID_IShellItem, (void**)&item);
			CoTaskMemFree(pidl);
		}
	}


Review comment (suggestion):
We want to specifically use Unicode version of APIs.
```suggestion
	ExpandEnvironmentStringsW(L"%SYSTEMDRIVE%\\Windows\\System32\\comdlg32.dll", comdlg32Path, MAX_PATH - 1);
```

Code after:
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

// Abstract:
//  Implementation of CFilesOpenDialog.

#include "pch.h"
#include <shlobj.h>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <locale>
#include <codecvt>
#include "FilesOpenDialog.h"

//#define SYSTEMDIALOG

using std::cout;
using std::wcout;
using std::endl;

CComPtr<IFileOpenDialog> GetSystemDialog()
{
	WCHAR comdlg32Path[MAX_PATH];
	ExpandEnvironmentStringsW(L"%WINDIR%\\System32\\comdlg32.dll", comdlg32Path, MAX_PATH - 1);

	HINSTANCE lib = CoLoadLibrary(comdlg32Path, false);
	BOOL(WINAPI* dllGetClassObject)(REFCLSID, REFIID, LPVOID*) = 
		(BOOL(WINAPI*)(REFCLSID, REFIID, LPVOID*))GetProcAddress(lib, "DllGetClassObject");
	CComPtr<IClassFactory> pClassFactory;
	dllGetClassObject(CLSID_FileOpenDialog, IID_IClassFactory, (void**)&pClassFactory);
	CComPtr<IFileOpenDialog> systemDialog;
	pClassFactory->CreateInstance(NULL, IID_IFileOpenDialog, (void**)&systemDialog);
	//CoFreeLibrary(lib);
	return systemDialog;
}

IShellItem* CloneShellItem(IShellItem* psi)
{
	IShellItem* item = NULL;
	if (psi)
	{
		PIDLIST_ABSOLUTE pidl;
		if (SUCCEEDED(SHGetIDListFromObject(psi, &pidl)))
		{
			SHCreateItemFromIDList(pidl, IID_IShellItem, (void**)&item);
			CoTaskMemFree(pidl);
		}
	}
Repository: files-community/Files
File: src/Files.App.SaveDialog/FilesSaveDialog.cpp (C++)

Code before:
// FilesSaveDialog.cpp: implementazione di CFilesSaveDialog

#include "pch.h"
#include "FilesDialogEvents.h"
#include "FilesSaveDialog.h"
#include <shlobj.h>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <locale>
#include <codecvt>

//#define SYSTEMDIALOG

using std::cout;
using std::wcout;
using std::endl;

// CFilesSaveDialog

CComPtr<IFileSaveDialog> GetSystemDialog()
{
	WCHAR comdlg32Path[MAX_PATH];
	ExpandEnvironmentStrings(L"%SYSTEMDRIVE%\\Windows\\System32\\comdlg32.dll", comdlg32Path, MAX_PATH - 1);

	HINSTANCE lib = CoLoadLibrary(comdlg32Path, false);
	BOOL(WINAPI* dllGetClassObject)(REFCLSID, REFIID, LPVOID*) =
		(BOOL(WINAPI*)(REFCLSID, REFIID, LPVOID*))GetProcAddress(lib, "DllGetClassObject");
	CComPtr<IClassFactory> pClassFactory;
	dllGetClassObject(CLSID_FileSaveDialog, IID_IClassFactory, (void**)&pClassFactory);
	CComPtr<IFileSaveDialog> systemDialog;
	pClassFactory->CreateInstance(NULL, IID_IFileSaveDialog, (void**)&systemDialog);
	//CoFreeLibrary(lib);
	return systemDialog;
}

IShellItem* CloneShellItem(IShellItem* psi)
{
	IShellItem* item = NULL;
	if (psi)
	{
		PIDLIST_ABSOLUTE pidl;
		if (SUCCEEDED(SHGetIDListFromObject(psi, &pidl)))
		{
			SHCreateItemFromIDList(pidl, IID_IShellItem, (void**)&item);
			CoTaskMemFree(pidl);
		}
	}
	return item;

Review comment (suggestion):
As above.
```suggestion
	ExpandEnvironmentStringsW(L"%SYSTEMDRIVE%\\Windows\\System32\\comdlg32.dll", comdlg32Path, MAX_PATH - 1);
```

Code after:
// FilesSaveDialog.cpp: implementazione di CFilesSaveDialog

#include "pch.h"
#include "FilesDialogEvents.h"
#include "FilesSaveDialog.h"
#include <shlobj.h>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <locale>
#include <codecvt>

//#define SYSTEMDIALOG

using std::cout;
using std::wcout;
using std::endl;

// CFilesSaveDialog

CComPtr<IFileSaveDialog> GetSystemDialog()
{
	WCHAR comdlg32Path[MAX_PATH];
	ExpandEnvironmentStringsW(L"%WINDIR%\\System32\\comdlg32.dll", comdlg32Path, MAX_PATH - 1);

	HINSTANCE lib = CoLoadLibrary(comdlg32Path, false);
	BOOL(WINAPI* dllGetClassObject)(REFCLSID, REFIID, LPVOID*) =
		(BOOL(WINAPI*)(REFCLSID, REFIID, LPVOID*))GetProcAddress(lib, "DllGetClassObject");
	CComPtr<IClassFactory> pClassFactory;
	dllGetClassObject(CLSID_FileSaveDialog, IID_IClassFactory, (void**)&pClassFactory);
	CComPtr<IFileSaveDialog> systemDialog;
	pClassFactory->CreateInstance(NULL, IID_IFileSaveDialog, (void**)&systemDialog);
	//CoFreeLibrary(lib);
	return systemDialog;
}

IShellItem* CloneShellItem(IShellItem* psi)
{
	IShellItem* item = NULL;
	if (psi)
	{
		PIDLIST_ABSOLUTE pidl;
		if (SUCCEEDED(SHGetIDListFromObject(psi, &pidl)))
		{
			SHCreateItemFromIDList(pidl, IID_IShellItem, (void**)&item);
			CoTaskMemFree(pidl);
		}
	}
	return item;
Repository: files-community/Files
File: src/Files.App/Data/Contracts/IWindowsWallpaperService.cs (C#)

Code before:
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Data.Contracts
{
	/// <summary>
	/// Provides service for manipulating shell wallpapers on Windows.
	/// </summary>
	public interface IWindowsWallpaperService
	{
		/// <summary>
		/// Sets desktop wallpaper using the specified image path.
		/// </summary>
		/// <param name="szPath">The image path to use to set as wallpaper.</param>
		void SetDesktopWallpaper(string szPath);

		/// <summary>
		/// Sets desktop slideshow using the specified image paths.
		/// </summary>
		/// <param name="aszPaths">The image paths to use to set as slideshow.</param>
		void SetDesktopSlideshow(string[] aszPaths);

		/// <summary>
		/// Gets lock screen wallpaper using the specified image path.
		/// </summary>
		/// <param name="szPath">The image path to use to set as lock screen wallpaper.</param>
		Task SetLockScreenWallpaper(string szPath);
	}
}


Review comment (suggestion):
```suggestion
		/// <param name="szPath">The image path to assign as the desktop wallpaper.</param>
```

Code after:
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Data.Contracts
{
	/// <summary>
	/// Provides service for manipulating shell wallpapers on Windows.
	/// </summary>
	public interface IWindowsWallpaperService
	{
		/// <summary>
		/// Sets desktop wallpaper using the specified image path.
		/// </summary>
		/// <param name="szPath">The image path to assign as the desktop wallpaper.</param>
		void SetDesktopWallpaper(string szPath);

		/// <summary>
		/// Sets desktop slideshow using the specified image paths.
		/// </summary>
		/// <param name="aszPaths">The image paths to use to set as slideshow.</param>
		void SetDesktopSlideshow(string[] aszPaths);

		/// <summary>
		/// Gets lock screen wallpaper using the specified image path.
		/// </summary>
		/// <param name="szPath">The image path to use to set as lock screen wallpaper.</param>
		Task SetLockScreenWallpaper(string szPath);
	}
}
Repository: files-community/Files
File: src/Files.App/Actions/Content/Background/SetAsWallpaperBackgroundAction.cs (C#)

Code before:
			=> "SetAsBackground".GetLocalizedResource();

		public override string Description
			=> "SetAsWallpaperBackgroundDescription".GetLocalizedResource();

		public override RichGlyph Glyph
			=> new("\uE91B");

		public override bool IsExecutable =>
			base.IsExecutable &&
			context.SelectedItem is not null;

		public override Task ExecuteAsync(object? parameter = null)
		{
			if (context.SelectedItem is null)
				return Task.CompletedTask;

			try
			{
				WindowsWallpaperService.SetDesktopWallpaper(context.SelectedItem.ItemPath);

				return Task.CompletedTask;
			}
			catch (Exception ex)
			{
				ShowErrorDialog(ex.Message);

				return Task.CompletedTask;
			}
		}
	}
}


Review comment (suggestion):
```suggestion
			try
			{
				WindowsWallpaperService.SetDesktopWallpaper(context.SelectedItem.ItemPath);
			}
			catch (Exception ex)
			{
				ShowErrorDialog(ex.Message);
			}
```

Code after:
			=> "SetAsBackground".GetLocalizedResource();

		public override string Description
			=> "SetAsWallpaperBackgroundDescription".GetLocalizedResource();

		public override RichGlyph Glyph
			=> new("\uE91B");

		public override bool IsExecutable =>
			base.IsExecutable &&
			context.SelectedItem is not null;

		public override Task ExecuteAsync(object? parameter = null)
		{
			if (context.SelectedItem is null)
				return Task.CompletedTask;

			try
			{
				WindowsWallpaperService.SetDesktopWallpaper(context.SelectedItem.ItemPath);
			}
			catch (Exception ex)
			{
				ShowErrorDialog(ex.Message);
			}

			return Task.CompletedTask;
		}
	}
}
Repository: files-community/Files
File: src/Files.App/Actions/Show/ToggleDotFilesSettingAction.cs (C#)

Code before:
﻿// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Actions
{
	internal sealed class ToggleDotFilesSettingAction : ObservableObject, IToggleAction
	{
		private readonly IFoldersSettingsService settings;

		public string Label
			=> "ShowDotFiles".GetLocalizedResource();

		public string Description
			=> "ToggleDotFilesSettingDescription".GetLocalizedResource();

		public bool IsOn
			=> settings.ShowDotFiles;

		public ToggleDotFilesSettingAction()
		{
			settings = Ioc.Default.GetRequiredService<IFoldersSettingsService>();

			settings.PropertyChanged += Settings_PropertyChanged;
		}

		public Task ExecuteAsync(object? parameter = null)
		{
			settings.ShowDotFiles = !settings.ShowDotFiles;

			return Task.CompletedTask;
		}

		private void Settings_PropertyChanged(object? sender, PropertyChangedEventArgs e)

Review comment (suggestion):
It'd be better to be like this: 
```suggestion
		private readonly IFoldersSettingsService FoldersSettingsService;
```

Code after:
﻿// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.

namespace Files.App.Actions
{
	internal sealed class ToggleDotFilesSettingAction : ObservableObject, IToggleAction
	{
		private readonly IFoldersSettingsService FoldersSettingsService;

		public string Label
			=> "ShowDotFiles".GetLocalizedResource();

		public string Description
			=> "ToggleDotFilesSettingDescription".GetLocalizedResource();

		public bool IsOn
			=> FoldersSettingsService.ShowDotFiles;

		public ToggleDotFilesSettingAction()
		{
			FoldersSettingsService = Ioc.Default.GetRequiredService<IFoldersSettingsService>();

			FoldersSettingsService.PropertyChanged += Settings_PropertyChanged;
		}

		public Task ExecuteAsync(object? parameter = null)
		{
			FoldersSettingsService.ShowDotFiles = !FoldersSettingsService.ShowDotFiles;

			return Task.CompletedTask;
		}

		private void Settings_PropertyChanged(object? sender, PropertyChangedEventArgs e)
Repository: files-community/Files
File: src/Files.App/Helpers/Application/AppLifecycleHelper.cs (C#)

Code before:
			}
			Process.GetCurrentProcess().Kill();
		}

		/// <summary>
		///	Checks if the taskbar is set to auto-hide.
		/// </summary>
		public static bool IsAutoHideTaskbarEnabled()
		{
			const string registryKey = @"Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3";
			const string valueName = "Settings";

			using var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(registryKey);

			var value = key?.GetValue(valueName) as byte[];

			// The least significant bit of the 9th byte controls the auto-hide setting																		
			return value != null && ((value[8] & 0x01) == 1);
		}

		/// <summary>
		/// Updates the visibility of the system tray icon
		/// </summary>
		private static void GeneralSettingsService_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			var generalSettingsService = Ioc.Default.GetRequiredService<IGeneralSettingsService>();

			if (e.PropertyName == nameof(IGeneralSettingsService.ShowSystemTrayIcon))
			{
				if (generalSettingsService.ShowSystemTrayIcon)
					App.SystemTrayIcon?.Show();
				else
					App.SystemTrayIcon?.Hide();
			}
		}
	}
}


Review comment (suggestion):
```suggestion
			if (sender is not IGeneralSettingsService generalSettingsService)
				return;
```

Code after:
			}
			Process.GetCurrentProcess().Kill();
		}

		/// <summary>
		///	Checks if the taskbar is set to auto-hide.
		/// </summary>
		public static bool IsAutoHideTaskbarEnabled()
		{
			const string registryKey = @"Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3";
			const string valueName = "Settings";

			using var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(registryKey);

			var value = key?.GetValue(valueName) as byte[];

			// The least significant bit of the 9th byte controls the auto-hide setting																		
			return value != null && ((value[8] & 0x01) == 1);
		}

		/// <summary>
		/// Updates the visibility of the system tray icon
		/// </summary>
		private static void GeneralSettingsService_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			if (sender is not IGeneralSettingsService generalSettingsService)
				return;

			if (e.PropertyName == nameof(IGeneralSettingsService.ShowSystemTrayIcon))
			{
				if (generalSettingsService.ShowSystemTrayIcon)
					App.SystemTrayIcon?.Show();
				else
					App.SystemTrayIcon?.Hide();
			}
		}
	}
}
Repository: files-community/Files
File: src/Files.App/Actions/Open/OpenClassicPropertiesAction.cs (C#)

Code before:

		public bool IsExecutable =>
			context.PageType is not ContentPageTypes.Home &&
			!(context.PageType is ContentPageTypes.SearchResults &&
			!context.HasSelection);

		public OpenClassicPropertiesAction()
		{
			context = Ioc.Default.GetRequiredService<IContentPageContext>();

			context.PropertyChanged += Context_PropertyChanged;
		}

		public Task ExecuteAsync(object? parameter = null)
		{
			if (context.HasSelection && context.SelectedItems is not null)
			{
				foreach (var item in context.SelectedItems)
				{
					ExecuteShellCommand(item.ItemPath);
				}
			}
			else if (context?.Folder?.ItemPath is not null)
			{
				ExecuteShellCommand(context.Folder.ItemPath);
			}

			return Task.CompletedTask;
		}

		private unsafe void ExecuteShellCommand(string itemPath)
		{
			SHELLEXECUTEINFOW info = default;
			info.cbSize = (uint)Marshal.SizeOf(info);

			var verb = "properties";
			fixed (char* cVerb = verb)
			{
				info.lpVerb = cVerb;
			}

			fixed (char* lpFile = itemPath)
			{
				info.lpFile = lpFile;
			}

			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			PInvoke.ShellExecuteEx(ref info);
		}

Review comment (suggestion):
```suggestion
			if (context.HasSelection && context.SelectedItems is not null)
			{
				foreach (var item in context.SelectedItems)
					ExecuteShellCommand(item.ItemPath);
			}
			else if (context?.Folder?.ItemPath is not null)
			{
				ExecuteShellCommand(context.Folder.ItemPath);
			}
```


Code after:

		public bool IsExecutable =>
			context.PageType is not ContentPageTypes.Home &&
			(context.HasSelection && context.SelectedItems.Count == 1 ||
			!context.HasSelection && context.PageType is not ContentPageTypes.SearchResults);

		public OpenClassicPropertiesAction()
		{
			context = Ioc.Default.GetRequiredService<IContentPageContext>();

			context.PropertyChanged += Context_PropertyChanged;
		}

		public Task ExecuteAsync(object? parameter = null)
		{
			if (context.HasSelection && context?.SelectedItem?.ItemPath is not null)
				ExecuteShellCommand(context.SelectedItem.ItemPath);
			else if (context?.Folder?.ItemPath is not null)
				ExecuteShellCommand(context.Folder.ItemPath);

			return Task.CompletedTask;
		}

		private unsafe void ExecuteShellCommand(string itemPath)
		{
			SHELLEXECUTEINFOW info = default;
			info.cbSize = (uint)Marshal.SizeOf(info);
			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			var verb = "properties";
			fixed (char* cVerb = verb)
				info.lpVerb = cVerb;

			fixed (char* lpFile = itemPath)
				info.lpFile = lpFile;

			PInvoke.ShellExecuteEx(ref info);
		}

		private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			switch (e.PropertyName)
			{
				case nameof(IContentPageContext.PageType):
				case nameof(IContentPageContext.HasSelection):
				case nameof(IContentPageContext.Folder):
					OnPropertyChanged(nameof(IsExecutable));
					break;
			}
		}
Repository: files-community/Files
File: src/Files.App/Actions/Open/OpenClassicPropertiesAction.cs (C#)

Code before:
			else if (context?.Folder?.ItemPath is not null)
			{
				ExecuteShellCommand(context.Folder.ItemPath);
			}

			return Task.CompletedTask;
		}

		private unsafe void ExecuteShellCommand(string itemPath)
		{
			SHELLEXECUTEINFOW info = default;
			info.cbSize = (uint)Marshal.SizeOf(info);

			var verb = "properties";
			fixed (char* cVerb = verb)
			{
				info.lpVerb = cVerb;
			}

			fixed (char* lpFile = itemPath)
			{
				info.lpFile = lpFile;
			}

			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			PInvoke.ShellExecuteEx(ref info);
		}

		private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			switch (e.PropertyName)
			{
				case nameof(IContentPageContext.PageType):
				case nameof(IContentPageContext.HasSelection):
				case nameof(IContentPageContext.Folder):
					OnPropertyChanged(nameof(IsExecutable));
					break;
			}
		}
	}
}


Review comment (suggestion):
```suggestion
			info.cbSize = (uint)Marshal.SizeOf(info);
			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			var verb = "properties";
			fixed (char* cVerb = verb)
				info.lpVerb = cVerb;

			fixed (char* lpFile = itemPath)
				info.lpFile = lpFile;
```


Code after:

		private unsafe void ExecuteShellCommand(string itemPath)
		{
			SHELLEXECUTEINFOW info = default;
			info.cbSize = (uint)Marshal.SizeOf(info);
			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			var verb = "properties";
			fixed (char* cVerb = verb)
				info.lpVerb = cVerb;

			fixed (char* lpFile = itemPath)
				info.lpFile = lpFile;

			PInvoke.ShellExecuteEx(ref info);
		}

		private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			switch (e.PropertyName)
			{
				case nameof(IContentPageContext.PageType):
				case nameof(IContentPageContext.HasSelection):
				case nameof(IContentPageContext.Folder):
					OnPropertyChanged(nameof(IsExecutable));
					break;
			}
		}
	}
}
Repository: files-community/Files
File: src/Files.App/Actions/Open/OpenClassicPropertiesAction.cs (C#)

Code before:
			{
				foreach (var item in context.SelectedItems)
					ExecuteShellCommand(item.ItemPath);
			}
			else if (context?.Folder?.ItemPath is not null)
			{
				ExecuteShellCommand(context.Folder.ItemPath);
			}

			return Task.CompletedTask;
		}

		private unsafe void ExecuteShellCommand(string itemPath)
		{
			SHELLEXECUTEINFOW info = default;
			info.cbSize = (uint)Marshal.SizeOf(info);

			var verb = "properties";
			fixed (char* cVerb = verb)
				info.lpVerb = cVerb;

			fixed (char* lpFile = itemPath)
				info.lpFile = lpFile;

			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			PInvoke.ShellExecuteEx(ref info);
		}

		private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			switch (e.PropertyName)
			{
				case nameof(IContentPageContext.PageType):
				case nameof(IContentPageContext.HasSelection):
				case nameof(IContentPageContext.Folder):
					OnPropertyChanged(nameof(IsExecutable));
					break;
			}
		}
	}
}


Review comment (suggestion):
```suggestion
			info.cbSize = (uint)Marshal.SizeOf(info);
			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			var verb = "properties";
			fixed (char* cVerb = verb)
				info.lpVerb = cVerb;

			fixed (char* lpFile = itemPath)
				info.lpFile = lpFile;
```


Code after:
				ExecuteShellCommand(context.SelectedItem.ItemPath);
			else if (context?.Folder?.ItemPath is not null)
				ExecuteShellCommand(context.Folder.ItemPath);

			return Task.CompletedTask;
		}

		private unsafe void ExecuteShellCommand(string itemPath)
		{
			SHELLEXECUTEINFOW info = default;
			info.cbSize = (uint)Marshal.SizeOf(info);
			info.nShow = 5; // SW_SHOW
			info.fMask = 0x0000000C;

			var verb = "properties";
			fixed (char* cVerb = verb)
				info.lpVerb = cVerb;

			fixed (char* lpFile = itemPath)
				info.lpFile = lpFile;

			PInvoke.ShellExecuteEx(ref info);
		}

		private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
		{
			switch (e.PropertyName)
			{
				case nameof(IContentPageContext.PageType):
				case nameof(IContentPageContext.HasSelection):
				case nameof(IContentPageContext.Folder):
					OnPropertyChanged(nameof(IsExecutable));
					break;
			}
		}
	}
}