Skip to content

Comments

conpty: Make sure ConDrv is loaded before doing ConPTY things#19901

Merged
DHowett merged 10 commits intomainfrom
dev/duhowett/load_condrv
Feb 24, 2026
Merged

conpty: Make sure ConDrv is loaded before doing ConPTY things#19901
DHowett merged 10 commits intomainfrom
dev/duhowett/load_condrv

Conversation

@DHowett
Copy link
Member

@DHowett DHowett commented Feb 24, 2026

Fixes #4750

DHowett and others added 5 commits May 3, 2020 17:41
# Conflicts:
#	.github/actions/spelling/advice.md
#	.github/actions/spelling/allow/allow.txt
#	.github/actions/spelling/allow/apis.txt
#	.github/actions/spelling/allow/chinese.txt
#	.github/actions/spelling/allow/colors.txt
#	.github/actions/spelling/allow/fonts.txt
#	.github/actions/spelling/allow/japanese.txt
#	.github/actions/spelling/allow/math.txt
#	.github/actions/spelling/allow/microsoft.txt
#	.github/actions/spelling/allow/names.txt
#	.github/actions/spelling/candidate.patterns
#	.github/actions/spelling/excludes.txt
#	.github/actions/spelling/expect/alphabet.txt
#	.github/actions/spelling/expect/expect.txt
#	.github/actions/spelling/expect/web.txt
#	.github/actions/spelling/line_forbidden.patterns
#	.github/actions/spelling/patterns/0_n.txt
#	.github/actions/spelling/patterns/0_r.txt
#	.github/actions/spelling/patterns/0_t.txt
#	.github/actions/spelling/patterns/patterns.txt
#	.github/actions/spelling/reject.txt
#	.github/workflows/spelling2.yml
#	src/server/WinNTControl.h
#	src/winconpty/winconpty.cpp
@github-actions

This comment has been minimized.

_NtDllDll(THROW_LAST_ERROR_IF_NULL(LoadLibraryExW(L"ntdll.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32))),
_NtOpenFile(reinterpret_cast<PfnNtOpenFile>(THROW_LAST_ERROR_IF_NULL(GetProcAddress(_NtDllDll.get(), "NtOpenFile"))))
_NtOpenFile(reinterpret_cast<PfnNtOpenFile>(THROW_LAST_ERROR_IF_NULL(GetProcAddress(_NtDllDll.get(), "NtOpenFile")))),
_NtSetSystemInformation(reinterpret_cast<PfnNtSetSystemInformation>(THROW_LAST_ERROR_IF_NULL(GetProcAddress(_NtDllDll.get(), "NtSetSystemInformation"))))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm gonna simplify this and put the ntdll LL/GPA directly into winconpty.

static void _EnsureDriverIsLoaded() noexcept
{
#ifndef __INSIDE_WINDOWS
static HMODULE ntdll{ LoadLibraryExW(L"ntdll.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32) };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under normal circumstances, I'm assuming that the load will not fail, because otherwise the host as a lot bigger issues than ConPTY. So, I think a static not needed here.

Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...with suggestions. :)

@github-project-automation github-project-automation bot moved this to To Cherry Pick in 1.23 Servicing Pipeline Feb 24, 2026
@github-project-automation github-project-automation bot moved this to To Cherry Pick in 1.24 Servicing Pipeline Feb 24, 2026
@DHowett DHowett enabled auto-merge (squash) February 24, 2026 19:46
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-Server Down in the muck of API call servicing, interprocess communication, eventing, etc. Priority-2 A description (P2) Product-Conpty For console issues specifically related to conpty labels Feb 24, 2026
@DHowett DHowett merged commit 0a3fbde into main Feb 24, 2026
18 of 20 checks passed
@DHowett DHowett deleted the dev/duhowett/load_condrv branch February 24, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Server Down in the muck of API call servicing, interprocess communication, eventing, etc. Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-2 A description (P2) Product-Conpty For console issues specifically related to conpty

Projects

Status: To Cherry Pick
Status: To Cherry Pick

Development

Successfully merging this pull request may close these issues.

Terminal can't create pseudoconsoles when condrv isn't loaded [Error 0xd000003a]

2 participants