From 0a3bbace93ad4eea19e4f52e345e871000093566 Mon Sep 17 00:00:00 2001 From: Paul Tucker Date: Sat, 25 Mar 2000 12:49:29 +0000 Subject: [PATCH] Fix for gpf in Setmode() --- harbour/ChangeLog | 6 ++++++ harbour/source/rtl/gtwin/gtwin.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2aeb82ea1b..c8978ce43a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +20000325-07:50 EST Paul Tucker + * source/rtl/gtwin/gtwin.c + * correct handling of the screen buffers and fix a gpf when + calling SetMode() - only noticed under Win98 + * added a todo. (for me) + 20000325-04:58 EST Paul Tucker * source/rtl/diskspac.c * un-opted the small opt. (fixed hang) diff --git a/harbour/source/rtl/gtwin/gtwin.c b/harbour/source/rtl/gtwin/gtwin.c index 3952a4c08f..46200a5e3d 100644 --- a/harbour/source/rtl/gtwin/gtwin.c +++ b/harbour/source/rtl/gtwin/gtwin.c @@ -140,11 +140,6 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr ) HB_SYMBOL_UNUSED( iFilenoStderr ); s_HDOutput = INVALID_HANDLE_VALUE; - s_HOriginal = INVALID_HANDLE_VALUE; - s_HOutput = INVALID_HANDLE_VALUE; - s_HActive = INVALID_HANDLE_VALUE; - s_HInactive = INVALID_HANDLE_VALUE; - s_HInput = INVALID_HANDLE_VALUE; s_cNumRead = 0; s_cNumIndex = 0; @@ -1000,7 +995,6 @@ void hb_gt_DispEnd( void ) /* TOFIX: Violation of API calling rules! */ if( hb_gtDispCount() == 1 ) { - s_HOutput = s_HInactive; s_HInactive = s_HActive; s_HActive = s_HOutput; SetConsoleActiveScreenBuffer( s_HActive ); @@ -1041,12 +1035,22 @@ BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) /* console window first, then the buffer */ if( ( DWORD ) csbi.dwSize.X * csbi.dwSize.Y > ( DWORD ) uiCols * uiRows ) { + /* TODO: these calls are a temporary solution */ + SetConsoleWindowInfo( s_HActive, TRUE, &srWin ); + SetConsoleScreenBufferSize( s_HActive, coBuf ); + SetConsoleWindowInfo( s_HInactive, TRUE, &srWin ); + SetConsoleScreenBufferSize( s_HInactive, coBuf ); if( !SetConsoleWindowInfo( s_HOutput, TRUE, &srWin ) || !SetConsoleScreenBufferSize( s_HOutput, coBuf ) ) bRetVal = FALSE; } else if( ( DWORD ) csbi.dwSize.X * csbi.dwSize.Y < ( DWORD ) uiCols * uiRows ) { + /* TODO: these calls are a temporary solution */ + SetConsoleScreenBufferSize( s_HActive, coBuf ); + SetConsoleWindowInfo( s_HActive, TRUE, &srWin ); + SetConsoleScreenBufferSize( s_HInactive, coBuf ); + SetConsoleWindowInfo( s_HInactive, TRUE, &srWin ); if( !SetConsoleScreenBufferSize( s_HOutput, coBuf ) || !SetConsoleWindowInfo( s_HOutput, TRUE, &srWin ) ) bRetVal = FALSE;