Skip to content

Commit 84a62bb

Browse files
authored
Fix: Fixed issue where some options were missing in the Google Drive context menu (#12935)
1 parent dae9d51 commit 84a62bb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Files.App/Utils/Shell/ContextMenu.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,6 @@ private void EnumMenuItems(HMENU hMenu, List<Win32ContextMenuItem> menuItemsResu
220220
{
221221
Debug.WriteLine("Item {0} ({1}): {2}", index, menuItemInfo.wID, menuItemInfo.dwTypeData);
222222

223-
// A workaround to avoid an AccessViolationException on some items,
224-
// notably the "Run with graphic processor" menu item of NVIDIA cards
225-
if (menuItemInfo.wID - 1 > 5000)
226-
{
227-
container.Dispose();
228-
continue;
229-
}
230-
231223
menuItem.Label = menuItemInfo.dwTypeData;
232224
menuItem.CommandString = GetCommandString(_cMenu, menuItemInfo.wID - 1);
233225

@@ -314,6 +306,13 @@ public Task<bool> LoadSubMenu(List<Win32ContextMenuItem> subItems)
314306

315307
private static string? GetCommandString(Shell32.IContextMenu cMenu, uint offset, Shell32.GCS flags = Shell32.GCS.GCS_VERBW)
316308
{
309+
// A workaround to avoid an AccessViolationException on some items,
310+
// notably the "Run with graphic processor" menu item of NVIDIA cards
311+
if (offset > 5000)
312+
{
313+
return null;
314+
}
315+
317316
SafeCoTaskMemString? commandString = null;
318317

319318
try
@@ -331,7 +330,6 @@ public Task<bool> LoadSubMenu(List<Win32ContextMenuItem> subItems)
331330

332331
return null;
333332
}
334-
335333
catch (Exception ex) when (ex is COMException or NotImplementedException)
336334
{
337335
// Not every item has an associated verb

0 commit comments

Comments
 (0)