Program exit code support in KoW

This commit is contained in:
Владислав Джавадов 2021-01-10 03:56:22 +03:00
parent d7a6530b18
commit fa788aeb37
3 changed files with 17 additions and 6 deletions

View File

@ -12,12 +12,15 @@ type
HRSRC = THandle;
var
ExitCode: Integer;
MainWindow: THandle;
const
kernel32 = 'kernel32.dll';
user32 = 'user32.dll';
procedure _Halt(ExitCode: Integer);
procedure ExitProcess(ExitCode: Cardinal); stdcall;
external kernel32 name 'ExitProcess';
function GetCommandLine: PKolibriChar; stdcall;

View File

@ -24,11 +24,17 @@ begin
HeapHandle := GetProcessHeap;
end;
procedure _Halt(ExitCode: Integer);
asm
CALL FinalizeUnits
PUSH ExitCode
CALL ExitProcess
end;
procedure _Halt0;
asm
PUSH EAX
CALL FinalizeUnits
CALL ExitProcess
MOV EAX, ExitCode
JMP _Halt
end;
procedure ErrorMessage(Msg: PKolibriChar; Count: Byte);

View File

@ -447,10 +447,12 @@ asm
SUB EDX, EAX
CALL ErrorMessage
{$IFNDEF KolibriOS}
POP EAX
{$ENDIF}
{$IFDEF KolibriOS}
JMP _Halt0
{$ELSE}
POP EAX
JMP _Halt
{$ENDIF}
end;
{$IFDEF KolibriOS}