Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix activation context generation for conhost #12653

Merged
1 commit merged into from
Mar 10, 2022
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
8 changes: 5 additions & 3 deletions src/host/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ void InitSideBySide()
actctx.cbSize = sizeof(actctx);
// We set ACTCTX_FLAG_HMODULE_VALID, but leave hModule as nullptr.
// A nullptr HMODULE refers to the current process/executable.
actctx.dwFlags = ACTCTX_FLAG_SET_PROCESS_DEFAULT | ACTCTX_FLAG_HMODULE_VALID;
actctx.lpResourceName = MAKEINTRESOURCE(IDR_SYSTEM_MANIFEST);
actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_SET_PROCESS_DEFAULT | ACTCTX_FLAG_HMODULE_VALID;

HANDLE const hActCtx = CreateActCtxW(&actctx);

Expand All @@ -44,8 +45,9 @@ void InitSideBySide()
{
auto const error = GetLastError();

// Don't log if it's already set. This whole ordeal is to make sure one is set if there isn't one already.
// If one is already set... good!
// OpenConsole ships with a single manifest at ID 1, while conhost ships with 2 at ID 1
// and IDR_SYSTEM_MANIFEST. If we call CreateActCtxW() with IDR_SYSTEM_MANIFEST inside
// OpenConsole anyways, nothing happens and we get ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET.
if (ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET != error)
{
RIPMSG1(RIP_WARNING, "InitSideBySide failed create an activation context. Error: %d\r\n", error);
Expand Down