From ef1cefc5fd25bdbb898524a794706bd060edeff5 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:37:52 -0700 Subject: [PATCH] Fix correct method being loaded when not using conptydll Part of microsoft/vscode#224488 --- src/win/conpty.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/win/conpty.cc b/src/win/conpty.cc index 9586b6c49..69a5df6ea 100644 --- a/src/win/conpty.cc +++ b/src/win/conpty.cc @@ -461,7 +461,9 @@ static Napi::Value PtyResize(const Napi::CallbackInfo& info) { bool fLoadedDll = hLibrary != nullptr; if (fLoadedDll) { - PFNRESIZEPSEUDOCONSOLE const pfnResizePseudoConsole = (PFNRESIZEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ConptyResizePseudoConsole"); + PFNRESIZEPSEUDOCONSOLE const pfnResizePseudoConsole = (PFNRESIZEPSEUDOCONSOLE)GetProcAddress( + (HMODULE)hLibrary, + useConptyDll ? "ConptyResizePseudoConsole" : "ResizePseudoConsole"); if (pfnResizePseudoConsole) { COORD size = {cols, rows}; @@ -491,7 +493,9 @@ static Napi::Value PtyClear(const Napi::CallbackInfo& info) { // bool fLoadedDll = hLibrary != nullptr; // if (fLoadedDll) // { - // PFNCLEARPSEUDOCONSOLE const pfnClearPseudoConsole = (PFNCLEARPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ClearPseudoConsole"); + // PFNCLEARPSEUDOCONSOLE const pfnClearPseudoConsole = (PFNCLEARPSEUDOCONSOLE)GetProcAddress( + // (HMODULE)hLibrary, + // useConptyDll ? "ConptyClearPseudoConsole" : "ClearPseudoConsole"); // if (pfnClearPseudoConsole) // { // pfnClearPseudoConsole(handle->hpc); @@ -522,7 +526,9 @@ static Napi::Value PtyKill(const Napi::CallbackInfo& info) { bool fLoadedDll = hLibrary != nullptr; if (fLoadedDll) { - PFNCLOSEPSEUDOCONSOLE const pfnClosePseudoConsole = (PFNCLOSEPSEUDOCONSOLE)GetProcAddress((HMODULE)hLibrary, "ConptyClosePseudoConsole"); + PFNCLOSEPSEUDOCONSOLE const pfnClosePseudoConsole = (PFNCLOSEPSEUDOCONSOLE)GetProcAddress( + (HMODULE)hLibrary, + useConptyDll ? "ConptyClosePseudoConsole" : "ClosePseudoConsole"); if (pfnClosePseudoConsole) { pfnClosePseudoConsole(handle->hpc);