diff --git a/src/cascadia/ShellExtension/OpenTerminalHere.cpp b/src/cascadia/ShellExtension/OpenTerminalHere.cpp index 8091754832c..d5669e21f63 100644 --- a/src/cascadia/ShellExtension/OpenTerminalHere.cpp +++ b/src/cascadia/ShellExtension/OpenTerminalHere.cpp @@ -185,12 +185,17 @@ HRESULT OpenTerminalHere::GetState(IShellItemArray* /*psiItemArray*/, HRESULT OpenTerminalHere::GetIcon(IShellItemArray* /*psiItemArray*/, LPWSTR* ppszIcon) +try { - // the icon ref ("dll,-") is provided here, in this case none is provided - *ppszIcon = nullptr; - // TODO GH#6111: Return the Terminal icon here - return E_NOTIMPL; + std::filesystem::path modulePath{ wil::GetModuleFileNameW(wil::GetModuleInstanceHandle()) }; + modulePath.replace_filename(WindowsTerminalExe); + // WindowsTerminal.exe,-101 will be the first icon group in WT + // We're using WindowsTerminal here explicitly, and not wt (from _getExePath), because + // WindowsTerminal is the only one built with the right icons. + const auto resource{ modulePath.wstring() + L",-101" }; + return SHStrDupW(resource.c_str(), ppszIcon); } +CATCH_RETURN(); HRESULT OpenTerminalHere::GetFlags(EXPCMDFLAGS* pFlags) {