diff --git a/contrib/win32/openssh/config.h.vs b/contrib/win32/openssh/config.h.vs index 75b019997..8d1678f7c 100644 --- a/contrib/win32/openssh/config.h.vs +++ b/contrib/win32/openssh/config.h.vs @@ -1707,6 +1707,6 @@ #define _PATH_SFTP_SERVER "sftp-server.exe" #define _PATH_SSH_PROGRAM "ssh.exe" #define _PATH_LS "dir" -#define FORK_NOT_SUPPORTED 1 +#define FORK_NOT_SUPPORTED #define HAVE_FREEZERO #define FILESYSTEM_NO_BACKSLASH diff --git a/contrib/win32/win32compat/win32_pty.c b/contrib/win32/win32compat/win32_pty.c index 61b1bba00..16b0a316e 100644 --- a/contrib/win32/win32compat/win32_pty.c +++ b/contrib/win32/win32compat/win32_pty.c @@ -38,30 +38,21 @@ int is_conpty_supported() { - wchar_t system32_path[PATH_MAX] = { 0, }; - wchar_t kernel32_dll_path[PATH_MAX] = { 0, }; - HMODULE hm_kernelbase = NULL; + wchar_t *kernel32_dll_path = L"kernel32.dll"; + HMODULE hm_kernel32 = NULL; static int isConpty = -1; if (isConpty != -1) return isConpty; isConpty = 0; - if (!GetSystemDirectoryW(system32_path, PATH_MAX)) { - error("failed to get system directory"); + if ((hm_kernel32 = LoadLibraryExW(kernel32_dll_path, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32)) == NULL) { + error("failed to load %S dll", kernel32_dll_path); goto done; } - wcscat_s(kernel32_dll_path, PATH_MAX, system32_path); - wcscat_s(kernel32_dll_path, PATH_MAX, L"\\Kernel32.dll"); - - if ((hm_kernelbase = LoadLibraryW(kernel32_dll_path)) == NULL) { - error("failed to load kernerlbase dll:%s", kernel32_dll_path); - goto done; - } - - if (GetProcAddress(hm_kernelbase, "CreatePseudoConsole") == NULL) { - debug3("couldn't find CreatePseudoConsole() in kernerlbase dll"); + if (GetProcAddress(hm_kernel32, "CreatePseudoConsole") == NULL) { + debug3("couldn't find CreatePseudoConsole() in %S dll", kernel32_dll_path); goto done; }