mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 04:49:42 +01:00
* the cygwin1.dll messes with the console mode so store and restore the console mode if necessary
git-svn-id: trunk@7218 -
This commit is contained in:
parent
63c49a1555
commit
91cdcff845
11
ide/fp.pas
11
ide/fp.pas
@ -30,6 +30,9 @@ program FP;
|
||||
(**********************************************************************)
|
||||
|
||||
uses
|
||||
{$ifdef Windows}
|
||||
windows,
|
||||
{$endif Windows}
|
||||
{$ifndef NODEBUG}
|
||||
{$ifdef Windows}
|
||||
fpcygwin,
|
||||
@ -523,9 +526,13 @@ BEGIN
|
||||
{$ifdef VESA}
|
||||
DoneVESAScreenModes;
|
||||
{$endif}
|
||||
{$ifdef unix}
|
||||
{$if defined(unix)}
|
||||
Keyboard.RestoreStartMode;
|
||||
{$endif unix}
|
||||
{$endif defined(unix)}
|
||||
{$if defined(windows)}
|
||||
writeln(hexstr(StartupConsoleMode,8));
|
||||
SetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)),StartupConsoleMode);
|
||||
{$endif defined(windows)}
|
||||
StreamError:=nil;
|
||||
{$ifdef DEBUG}
|
||||
if CloseImmediately then
|
||||
|
||||
@ -28,6 +28,12 @@ unit sysinitcyg;
|
||||
procedure Cygwin_crt0(p : pointer);cdecl;external name 'cygwin_crt0';
|
||||
procedure __main;cdecl;external name '__main';
|
||||
|
||||
const
|
||||
STD_INPUT_HANDLE = dword(-10);
|
||||
|
||||
function GetStdHandle(nStdHandle:DWORD) : THandle; stdcall; external 'kernel32' name 'GetStdHandle';
|
||||
function GetConsoleMode(hConsoleHandle: THandle; var lpMode: DWORD): Boolean; stdcall; external 'kernel32' name 'GetConsoleMode';
|
||||
|
||||
procedure CMainEXE;cdecl;
|
||||
begin
|
||||
asm
|
||||
@ -57,6 +63,10 @@ unit sysinitcyg;
|
||||
subl $0x8,%esp
|
||||
andl $0xfffffff0,%esp
|
||||
end;
|
||||
{ it seems cygwin messed around with the console mode so we've to
|
||||
store the startup console mode before cygwin can do anything (FK)
|
||||
}
|
||||
GetConsoleMode(GetStdHandle((Std_Input_Handle)),StartupConsoleMode);
|
||||
Cygwin_crt0(@CMainEXE);
|
||||
end;
|
||||
|
||||
|
||||
@ -95,6 +95,8 @@ var
|
||||
MainInstance,
|
||||
cmdshow : longint;
|
||||
DLLreason,DLLparam:longint;
|
||||
StartupConsoleMode : DWORD;
|
||||
|
||||
type
|
||||
TDLL_Process_Entry_Hook = function (dllparam : longint) : longbool;
|
||||
TDLL_Entry_Hook = procedure (dllparam : longint);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user