mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-23 05:55:41 +02:00
GetProcAddress changes in ssh-shellhost to support Nano
This commit is contained in:
parent
5831b09b84
commit
fe82ce1d37
@ -50,6 +50,30 @@
|
|||||||
#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200
|
#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI *__t_SetCurrentConsoleFontEx)(
|
||||||
|
_In_ HANDLE hConsoleOutput,
|
||||||
|
_In_ BOOL bMaximumWindow,
|
||||||
|
_In_ PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx
|
||||||
|
);
|
||||||
|
__t_SetCurrentConsoleFontEx __SetCurrentConsoleFontEx;
|
||||||
|
|
||||||
|
typedef BOOL (WINAPI *__t_UnhookWinEvent)(
|
||||||
|
_In_ HWINEVENTHOOK hWinEventHook
|
||||||
|
);
|
||||||
|
__t_UnhookWinEvent __UnhookWinEvent;
|
||||||
|
|
||||||
|
typedef HWINEVENTHOOK (WINAPI *__t_SetWinEventHook)(
|
||||||
|
_In_ UINT eventMin,
|
||||||
|
_In_ UINT eventMax,
|
||||||
|
_In_ HMODULE hmodWinEventProc,
|
||||||
|
_In_ WINEVENTPROC lpfnWinEventProc,
|
||||||
|
_In_ DWORD idProcess,
|
||||||
|
_In_ DWORD idThread,
|
||||||
|
_In_ UINT dwflags
|
||||||
|
);
|
||||||
|
__t_SetWinEventHook __SetWinEventHook;
|
||||||
|
|
||||||
|
|
||||||
typedef struct consoleEvent {
|
typedef struct consoleEvent {
|
||||||
DWORD event;
|
DWORD event;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
@ -389,7 +413,7 @@ void SizeWindow(HANDLE hInput) {
|
|||||||
matchingFont.FontWeight = FW_NORMAL;
|
matchingFont.FontWeight = FW_NORMAL;
|
||||||
wcscpy(matchingFont.FaceName, L"Consolas");
|
wcscpy(matchingFont.FaceName, L"Consolas");
|
||||||
|
|
||||||
bSuccess = SetCurrentConsoleFontEx(child_out, FALSE, &matchingFont);
|
bSuccess = __SetCurrentConsoleFontEx(child_out, FALSE, &matchingFont);
|
||||||
|
|
||||||
// This information is the live screen
|
// This information is the live screen
|
||||||
ZeroMemory(&consoleInfo, sizeof(consoleInfo));
|
ZeroMemory(&consoleInfo, sizeof(consoleInfo));
|
||||||
@ -1057,6 +1081,14 @@ int start_with_pty(int ac, wchar_t **av) {
|
|||||||
DWORD dwMode;
|
DWORD dwMode;
|
||||||
DWORD dwStatus;
|
DWORD dwStatus;
|
||||||
HANDLE hEventHook = NULL;
|
HANDLE hEventHook = NULL;
|
||||||
|
HMODULE hm_kernel32 = NULL, hm_user32 = NULL;
|
||||||
|
|
||||||
|
if ((hm_kernel32 = LoadLibraryW(L"kernel32.dll")) == NULL ||
|
||||||
|
(hm_user32 = LoadLibraryW(L"user32.dll")) == NULL ||
|
||||||
|
(__SetCurrentConsoleFontEx = GetProcAddress(hm_kernel32, "SetCurrentConsoleFontEx")) == NULL ||
|
||||||
|
(__UnhookWinEvent = GetProcAddress(hm_user32, "UnhookWinEvent")) == NULL ||
|
||||||
|
(__SetWinEventHook = GetProcAddress(hm_user32, "SetWinEventHook")) == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
pipe_in = GetStdHandle(STD_INPUT_HANDLE);
|
pipe_in = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
pipe_out = GetStdHandle(STD_OUTPUT_HANDLE);
|
pipe_out = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
@ -1082,7 +1114,7 @@ int start_with_pty(int ac, wchar_t **av) {
|
|||||||
|
|
||||||
InitializeCriticalSection(&criticalSection);
|
InitializeCriticalSection(&criticalSection);
|
||||||
|
|
||||||
hEventHook = SetWinEventHook(EVENT_CONSOLE_CARET, EVENT_CONSOLE_LAYOUT, NULL,
|
hEventHook = __SetWinEventHook(EVENT_CONSOLE_CARET, EVENT_CONSOLE_LAYOUT, NULL,
|
||||||
ConsoleEventProc, 0, 0, WINEVENT_OUTOFCONTEXT);
|
ConsoleEventProc, 0, 0, WINEVENT_OUTOFCONTEXT);
|
||||||
|
|
||||||
memset(&si, 0, sizeof(STARTUPINFO));
|
memset(&si, 0, sizeof(STARTUPINFO));
|
||||||
@ -1157,7 +1189,7 @@ cleanup:
|
|||||||
if (ux_thread != INVALID_HANDLE_VALUE)
|
if (ux_thread != INVALID_HANDLE_VALUE)
|
||||||
TerminateThread(ux_thread, S_OK);
|
TerminateThread(ux_thread, S_OK);
|
||||||
if (hEventHook)
|
if (hEventHook)
|
||||||
UnhookWinEvent(hEventHook);
|
__UnhookWinEvent(hEventHook);
|
||||||
|
|
||||||
FreeConsole();
|
FreeConsole();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user