mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-10 14:46:02 +02:00
* merged consolemode fix
This commit is contained in:
parent
59cb901446
commit
cfe59822da
@ -15,6 +15,9 @@ interface
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
windows;
|
||||||
|
|
||||||
{$i textrec.inc}
|
{$i textrec.inc}
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +56,6 @@ const
|
|||||||
STD_OUTPUT_HANDLE = $fffffff5;
|
STD_OUTPUT_HANDLE = $fffffff5;
|
||||||
STD_ERROR_HANDLE = $fffffff4;
|
STD_ERROR_HANDLE = $fffffff4;
|
||||||
|
|
||||||
function GetStdHandle(nStdHandle:DWORD):longint;external 'kernel32' name 'GetStdHandle';
|
|
||||||
|
|
||||||
procedure UpdateStdHandle(var t:TextRec;var stdHandle:longint;newHandle:longint);
|
procedure UpdateStdHandle(var t:TextRec;var stdHandle:longint;newHandle:longint);
|
||||||
{ Check if the stdHandle is the same as the one in the TextRec, then
|
{ Check if the stdHandle is the same as the one in the TextRec, then
|
||||||
@ -69,12 +71,19 @@ begin
|
|||||||
longjmp(entryjmpbuf,1);
|
longjmp(entryjmpbuf,1);
|
||||||
entry:=0;
|
entry:=0;
|
||||||
end;
|
end;
|
||||||
|
var
|
||||||
|
ConsoleMode: DWORD;
|
||||||
|
ConsoleModeValid : boolean;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
ConsoleModeValid:=GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), @ConsoleMode);
|
||||||
if setjmp(entryjmpbuf)=0 then
|
if setjmp(entryjmpbuf)=0 then
|
||||||
begin
|
begin
|
||||||
cygwin_crt0(@entry);
|
cygwin_crt0(@entry);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if ConsoleModeValid then
|
||||||
|
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ConsoleMode);
|
||||||
{ Reinitialize std handles that can be changed }
|
{ Reinitialize std handles that can be changed }
|
||||||
UpdateStdHandle(TextRec(Input),StdInputHandle,GetStdHandle(STD_INPUT_HANDLE));
|
UpdateStdHandle(TextRec(Input),StdInputHandle,GetStdHandle(STD_INPUT_HANDLE));
|
||||||
UpdateStdHandle(TextRec(Output),StdOutputHandle,GetStdHandle(STD_OUTPUT_HANDLE));
|
UpdateStdHandle(TextRec(Output),StdOutputHandle,GetStdHandle(STD_OUTPUT_HANDLE));
|
||||||
@ -96,7 +105,10 @@ if setjmp(exitjmpbuf)=0 then
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 2001-09-22 11:15:31 peter
|
Revision 1.6 2001-09-30 21:46:34 peter
|
||||||
|
* merged consolemode fix
|
||||||
|
|
||||||
|
Revision 1.5 2001/09/22 11:15:31 peter
|
||||||
* merged v10 version for exit fixes
|
* merged v10 version for exit fixes
|
||||||
|
|
||||||
Revision 1.1.2.4 2001/09/19 15:23:39 pierre
|
Revision 1.1.2.4 2001/09/19 15:23:39 pierre
|
||||||
|
Loading…
Reference in New Issue
Block a user