Skip to content
Snippets Groups Projects
Commit 37766c22 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

We don't need to dynamically load [GS]etConsoleMode()

parent 3b7d4567
No related branches found
No related tags found
No related merge requests found
Pipeline #8161 passed
...@@ -59,6 +59,7 @@ ifndef win ...@@ -59,6 +59,7 @@ ifndef win
CIOLIB-MT_CFLAGS += -DDISABLE_X11=1 -DNO_X CIOLIB-MT_CFLAGS += -DDISABLE_X11=1 -DNO_X
endif endif
else else
CIOLIB-MT_LIBS += -lkernel32
NO_X := 1 NO_X := 1
CIOLIB-MT_CFLAGS += -DDISABLE_X11=1 -DNO_X CIOLIB-MT_CFLAGS += -DDISABLE_X11=1 -DNO_X
ifndef WITHOUT_GDI ifndef WITHOUT_GDI
......
...@@ -522,12 +522,6 @@ static CONSOLE_SCREEN_BUFFER_INFOEX orig_sbiex = { ...@@ -522,12 +522,6 @@ static CONSOLE_SCREEN_BUFFER_INFOEX orig_sbiex = {
}; };
static void * win32_suspendbuf=NULL; static void * win32_suspendbuf=NULL;
#ifndef CONSOLE_FULLSCREEN_MODE
/* SetConsoleDisplayMode parameter value */
#define CONSOLE_FULLSCREEN_MODE 1 // Text is displayed in full-screen mode.
#define CONSOLE_WINDOWED_MODE 2 // Text is displayed in a console window.
#endif
static DWORD orig_display_mode=0; static DWORD orig_display_mode=0;
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
...@@ -554,61 +548,16 @@ Remarks: ...@@ -554,61 +548,16 @@ Remarks:
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
BOOL NT_SetConsoleDisplayMode(HANDLE hOutputHandle, DWORD dwNewMode) BOOL NT_SetConsoleDisplayMode(HANDLE hOutputHandle, DWORD dwNewMode)
{ {
typedef BOOL (WINAPI *SCDMProc_t) (HANDLE, DWORD, LPDWORD); BOOL ret = SetConsoleDisplayMode(hOutputHandle, dwNewMode, NULL);
SCDMProc_t SetConsoleDisplayMode; dprintf("SetConsoleDisplayMode(%d) returned %d", dwNewMode, ret);
HMODULE hKernel32;
BOOL ret;
const char KERNEL32_NAME[] = "kernel32.dll";
hKernel32 = LoadLibraryA(KERNEL32_NAME);
if (hKernel32 == NULL)
return FALSE;
SetConsoleDisplayMode =
(SCDMProc_t)GetProcAddress(hKernel32, "SetConsoleDisplayMode");
if (SetConsoleDisplayMode == NULL)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
ret = FALSE;
}
else
{
DWORD dummy=0;
ret = SetConsoleDisplayMode(hOutputHandle, dwNewMode, &dummy);
dprintf("SetConsoleDisplayMode(%d) returned %d", dwNewMode, ret);
}
FreeLibrary(hKernel32);
return ret; return ret;
} }
BOOL NT_GetConsoleDisplayMode(DWORD* mode) BOOL NT_GetConsoleDisplayMode(DWORD* mode)
{ {
typedef BOOL (WINAPI *GCDMProc_t) (LPDWORD); BOOL ret = GetConsoleDisplayMode(mode);
GCDMProc_t GetConsoleDisplayMode; dprintf("GetConsoleDisplayMode() returned %d (%d)", ret, *mode);
HMODULE hKernel32;
BOOL ret;
const char KERNEL32_NAME[] = "kernel32.dll";
hKernel32 = LoadLibraryA(KERNEL32_NAME);
if (hKernel32 == NULL)
return FALSE;
GetConsoleDisplayMode =
(GCDMProc_t)GetProcAddress(hKernel32, "GetConsoleDisplayMode");
if (GetConsoleDisplayMode == NULL)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
ret = FALSE;
}
else
{
ret = GetConsoleDisplayMode(mode);
dprintf("GetConsoleDisplayMode() returned %d (%d)", ret, *mode);
}
FreeLibrary(hKernel32);
return ret; return ret;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment