conpty: Make sure ConDrv is loaded before doing ConPTY things#19901
Merged
conpty: Make sure ConDrv is loaded before doing ConPTY things#19901
Conversation
# 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
This comment has been minimized.
This comment has been minimized.
DHowett
commented
Feb 24, 2026
src/server/WinNTControl.cpp
Outdated
| _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")))) |
Member
Author
There was a problem hiding this comment.
i'm gonna simplify this and put the ntdll LL/GPA directly into winconpty.
lhecker
reviewed
Feb 24, 2026
src/winconpty/winconpty.cpp
Outdated
| static void _EnsureDriverIsLoaded() noexcept | ||
| { | ||
| #ifndef __INSIDE_WINDOWS | ||
| static HMODULE ntdll{ LoadLibraryExW(L"ntdll.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32) }; |
Member
There was a problem hiding this comment.
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.
lhecker
approved these changes
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4750