When booting an elevated profile, UAC says that it's from an unknown publisher #16435

Closed
opened 2026-01-31 05:11:11 +00:00 by claunia · 2 comments
Owner

Originally created by @zadjii-msft on GitHub (Jan 18, 2022).

Originally assigned to: @zadjii-msft on GitHub.

image

You know what OneNote, I'm leaving it like this, I know what it means.

Originally created by @zadjii-msft on GitHub (Jan 18, 2022). Originally assigned to: @zadjii-msft on GitHub. ![image](https://user-images.githubusercontent.com/18356694/150029679-56b13100-ee05-4a81-9619-b11e38a00678.png) You know what OneNote, I'm leaving it like this, I know what it means.
Author
Owner

@zadjii-msft commented on GitHub (Jan 20, 2022):

Hmmm. This might be tricky to test. It seems like right-clicking on the taskbar and using that to spawn the dev build of the Terminal also reports an Unknown Publisher, when the Preview build doesn't. That makes me think there's no way for me to test this locally...

FWIW I think you can fix this with

diff --git a/src/cascadia/ElevateShim/elevate-shim.cpp b/src/cascadia/ElevateShim/elevate-shim.cpp
index e9b4d859c..5e7adb903 100644
--- a/src/cascadia/ElevateShim/elevate-shim.cpp
+++ b/src/cascadia/ElevateShim/elevate-shim.cpp
@@ -11,6 +11,13 @@
 #include <wil/win32_helpers.h>
 #include <shellapi.h>

+#include <winrt/Windows.ApplicationModel.h>^M
+^M
+// This file does't need all of til, but it does need:^M
+#define _TIL_INLINEPREFIX __declspec(noinline) inline^M
+#include "til/string.h"^M
+#include "../WinRTUtils/inc/WtExeUtils.h"^M
+^M
 // BODGY
 //
 // If we try to do this in the Terminal itself, then there's a bunch of weird
@@ -30,10 +37,8 @@ int __stdcall wWinMain(HINSTANCE, HINSTANCE, LPWSTR pCmdLine, int)
     // All of the args passed to us (something like `new-tab -p {guid}`) are in
     // pCmdLine

-    // Get the path to WindowsTerminal.exe, which should live next to us.
-    std::filesystem::path module{ wil::GetModuleFileNameW<std::wstring>(nullptr) };
-    // Swap elevate-shim.exe for WindowsTerminal.exe
-    module.replace_filename(L"WindowsTerminal.exe");
+    // Use GetWtExePath which should find the right packaged version of wt.exe^M
+    std::filesystem::path module{ GetWtExePath() };^M

     // Go!


but I need to figure out how now. See 49f31554c

@zadjii-msft commented on GitHub (Jan 20, 2022): Hmmm. This might be tricky to test. It seems like right-clicking on the taskbar and using that to spawn the dev build of the Terminal also reports an Unknown Publisher, when the Preview build doesn't. That makes me think there's no way for me to test this locally... FWIW I think you can fix this with ```diff diff --git a/src/cascadia/ElevateShim/elevate-shim.cpp b/src/cascadia/ElevateShim/elevate-shim.cpp index e9b4d859c..5e7adb903 100644 --- a/src/cascadia/ElevateShim/elevate-shim.cpp +++ b/src/cascadia/ElevateShim/elevate-shim.cpp @@ -11,6 +11,13 @@ #include <wil/win32_helpers.h> #include <shellapi.h> +#include <winrt/Windows.ApplicationModel.h>^M +^M +// This file does't need all of til, but it does need:^M +#define _TIL_INLINEPREFIX __declspec(noinline) inline^M +#include "til/string.h"^M +#include "../WinRTUtils/inc/WtExeUtils.h"^M +^M // BODGY // // If we try to do this in the Terminal itself, then there's a bunch of weird @@ -30,10 +37,8 @@ int __stdcall wWinMain(HINSTANCE, HINSTANCE, LPWSTR pCmdLine, int) // All of the args passed to us (something like `new-tab -p {guid}`) are in // pCmdLine - // Get the path to WindowsTerminal.exe, which should live next to us. - std::filesystem::path module{ wil::GetModuleFileNameW<std::wstring>(nullptr) }; - // Swap elevate-shim.exe for WindowsTerminal.exe - module.replace_filename(L"WindowsTerminal.exe"); + // Use GetWtExePath which should find the right packaged version of wt.exe^M + std::filesystem::path module{ GetWtExePath() };^M // Go! ``` but I need to figure out how now. See 49f31554c
Author
Owner

@zadjii-msft commented on GitHub (Apr 28, 2022):

I think this was fixed on the OS side, cause I can't repro this anymore.

@zadjii-msft commented on GitHub (Apr 28, 2022): I think this was fixed on the OS side, cause I can't repro this anymore.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16435