Skip to content

Commit

Permalink
[New+]Don't override New actions from Explorer on Windows 10 (#36467)
Browse files Browse the repository at this point in the history
* [New+]Don't override New actions from Explorer

* Update src/modules/NewPlus/NewShellExtensionContextMenu.win10/shell_context_menu_win10.cpp

* Update src/modules/NewPlus/NewShellExtensionContextMenu.win10/shell_context_menu_win10.cpp

* Add pattern for learn.microsoft links

* Also only Query for context menu
  • Loading branch information
jaimecbernardo authored Dec 27, 2024
1 parent e4d2deb commit a720dd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/actions/spell-check/patterns.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ _mm_(?!dd)\w+

# hit-count: 4 file-count: 4
# microsoft
\b(?:https?://|)(?:(?:(?:blogs|download\.visualstudio|developer|docs|msdn2?|research)\.|)microsoft|blogs\.msdn)\.co(?:m|\.\w\w)/[-_a-zA-Z0-9()=./%]*
\b(?:https?://|)(?:(?:(?:blogs|download\.visualstudio|developer|docs|learn|msdn2?|research)\.|)microsoft|blogs\.msdn)\.co(?:m|\.\w\w)/[-_a-zA-Z0-9()=./%#]*

aka\.ms/[a-zA-Z0-9]+

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ IFACEMETHODIMP shell_context_menu_win10::QueryContextMenu(HMENU menu_handle, UIN
return E_FAIL;
}

if (menu_flags & CMF_DEFAULTONLY)
if (menu_flags & (CMF_DEFAULTONLY | CMF_VERBSONLY | CMF_OPTIMIZEFORINVOKE))
{
return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0);
return E_UNEXPECTED;
}

try
Expand Down Expand Up @@ -217,6 +217,13 @@ IFACEMETHODIMP shell_context_menu_win10::InvokeCommand(CMINVOKECOMMANDINFO* para
return E_FAIL;
}

if (HIWORD(params->lpVerb)!=0)
{
// Not a menu command. It's likely a string verb command from another menu.
// The logic to interpret lpVerb is explained here: https://learn.microsoft.com/en-us/previous-versions//bb776881(v=vs.85)#invokecommand-method
return E_FAIL;
}

// Get selected menu item (a template or the "Open templates" item)
const auto selected_menu_item_index = LOWORD(params->lpVerb) - 1;
if (selected_menu_item_index < 0)
Expand Down

0 comments on commit a720dd5

Please sign in to comment.