Skip to content
Merged
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
14 changes: 9 additions & 5 deletions src/Files.App/Shell/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ private void EnumMenuItems(
{
Debug.WriteLine("Item {0} ({1}): {2}", ii, mii.wID, mii.dwTypeData);

// Hackish workaround to avoid an AccessViolationException on some items,
// notably the "Run with graphic processor" menu item of NVidia cards
if (mii.wID - 1 > 5000)
{
container.Dispose();

continue;
}

menuItem.Label = mii.dwTypeData;
menuItem.CommandString = GetCommandString(cMenu, mii.wID - 1);

Expand Down Expand Up @@ -313,11 +322,6 @@ public async Task<bool> LoadSubMenu(List<Win32ContextMenuItem> subItems)

private static string? GetCommandString(Shell32.IContextMenu cMenu, uint offset, Shell32.GCS flags = Shell32.GCS.GCS_VERBW)
{
// Hackish workaround to avoid an AccessViolationException on some items,
// notably the "Run with graphic processor" menu item of NVidia cards
if (offset > 5000)
return null;

SafeCoTaskMemString? commandString = null;

try
Expand Down