// Put all WinAPI definitions to single include file

Be independent from Delphi versions 7 and below, merge all imports (Delphi linker workaround).
This commit is contained in:
2021-01-16 06:26:56 +03:00
parent f3b9eb0296
commit 3317a0088d
8 changed files with 202 additions and 126 deletions

View File

@@ -73,11 +73,9 @@ procedure Delay(Milliseconds: LongWord);
implementation implementation
uses
{$IFDEF KolibriOS} {$IFDEF KolibriOS}
uses
KolibriOS; KolibriOS;
{$ELSE}
Windows;
{$ENDIF} {$ENDIF}
var var

View File

@@ -4,12 +4,6 @@
Copyright (c) 2021 Delphi SDK for KolibriOS team Copyright (c) 2021 Delphi SDK for KolibriOS team
*) *)
type
TConsoleFontInfo = packed record
Number: LongWord;
Size: TCoord;
end;
var var
// Console.obj defaults // Console.obj defaults
ScrSize: TCoord = (X: 80; Y: 300); ScrSize: TCoord = (X: 80; Y: 300);
@@ -18,27 +12,6 @@ var
SaveInputCP, SaveOutputCP: Word; SaveInputCP, SaveOutputCP: Word;
const
msvcrt = 'msvcrt.dll';
function GetCurrentConsoleFont(hConsole: THandle; MaximumWindow: LongBool; var Info: TConsoleFontInfo): LongBool; stdcall;
external kernel32 name 'GetCurrentConsoleFont';
function GetConsoleWindow: THandle; stdcall;
external kernel32 name 'GetConsoleWindow';
function _cgets_s(Buffer: PKolibriChar; Count: Cardinal; var Read: Cardinal): PKolibriChar; cdecl;
external msvcrt name '_cgets_s';
function _cputs(Str: PKolibriChar): Integer; cdecl;
external msvcrt name '_cputs';
function _getch: KolibriChar; cdecl;
external msvcrt name '_getch';
function gets: PKolibriChar; cdecl;
external msvcrt name 'gets';
function _kbhit: Integer; cdecl;
external msvcrt name '_kbhit';
function _cprintf(Fmt: PKolibriChar): Integer; cdecl varargs;
external msvcrt name '_cprintf';
procedure con_set_cursor_pos(X, Y: Integer); stdcall; forward; // call local proc from con_cls procedure con_set_cursor_pos(X, Y: Integer); stdcall; forward; // call local proc from con_cls
procedure con_cls; stdcall; procedure con_cls; stdcall;
@@ -62,7 +35,7 @@ begin
if not CloseWindow then if not CloseWindow then
begin begin
CursorOff; CursorOff;
_getch; getch;
end; end;
SetConsoleCP(SaveInputCP); SetConsoleCP(SaveInputCP);
@@ -84,8 +57,8 @@ begin
AllocConsole; AllocConsole;
{$ENDIF} {$ENDIF}
TTextRec(Input).Handle := System.GetStdHandle(STD_INPUT_HANDLE); TTextRec(Input).Handle := GetStdHandle(STD_INPUT_HANDLE);
TTextRec(Output).Handle := System.GetStdHandle(STD_OUTPUT_HANDLE); TTextRec(Output).Handle := GetStdHandle(STD_OUTPUT_HANDLE);
{$IFDEF Debug} {$IFDEF Debug}
SaveInputCP := GetConsoleCP; SaveInputCP := GetConsoleCP;
@@ -93,7 +66,7 @@ begin
SaveOutputCP := GetConsoleOutputCP; SaveOutputCP := GetConsoleOutputCP;
SetConsoleOutputCP(CP_KOLIBRIOS); SetConsoleOutputCP(CP_KOLIBRIOS);
SetConsoleTitleA(Title); SetConsoleTitle(Title);
if WndWidth <> LongWord(-1) then if WndWidth <> LongWord(-1) then
WndSize.X := WndWidth; WndSize.X := WndWidth;
@@ -102,8 +75,8 @@ begin
MainWindow := GetConsoleWindow; MainWindow := GetConsoleWindow;
GetCurrentConsoleFont(TTextRec(Output).Handle, False, Font); GetCurrentConsoleFont(TTextRec(Output).Handle, False, Font);
SetWindowPos(MainWindow, 0, WndPos.X, WndPos.Y, { SetWindowPos(MainWindow, 0, WndPos.X, WndPos.Y,
Font.Size.X * WndSize.X + GetSystemMetrics(SM_CXVSCROLL), Font.Size.Y * WndSize.Y + GetSystemMetrics(SM_CYHSCROLL), 0); Font.Size.X * WndSize.X + GetSystemMetrics(SM_CXVSCROLL), Font.Size.Y * WndSize.Y + GetSystemMetrics(SM_CYHSCROLL), 0);}
if ScrWidth <> LongWord(-1) then if ScrWidth <> LongWord(-1) then
ScrSize.X := ScrWidth; ScrSize.X := ScrWidth;
@@ -155,12 +128,12 @@ var
Font: TConsoleFontInfo; Font: TConsoleFontInfo;
begin begin
GetCurrentConsoleFont(TTextRec(Output).Handle, False, Font); GetCurrentConsoleFont(TTextRec(Output).Handle, False, Font);
Result := Font.Size.Y; Result := Font.dwFontSize.Y;
end; end;
function con_getch: KolibriChar; stdcall; function con_getch: KolibriChar; stdcall;
begin begin
Result := _getch; Result := getch;
end; end;
function con_gets(Str: PKolibriChar; Length: Integer): PKolibriChar; stdcall; function con_gets(Str: PKolibriChar; Length: Integer): PKolibriChar; stdcall;
@@ -168,8 +141,8 @@ var
LF: KolibriChar; LF: KolibriChar;
Read: Cardinal; Read: Cardinal;
begin begin
_cgets_s(Str, Length, Read); cgets_s(Str, Length, Read);
_cgets_s(@LF, SizeOf(LF), Read); cgets_s(@LF, SizeOf(LF), Read);
Result := Str; Result := Str;
end; end;
@@ -180,7 +153,7 @@ end;
function con_kbhit: Boolean; stdcall; function con_kbhit: Boolean; stdcall;
begin begin
Result := _kbhit <> 0; Result := kbhit <> 0;
end; end;
function con_set_cursor_height(Height: Integer): Integer; stdcall; function con_set_cursor_height(Height: Integer): Integer; stdcall;
@@ -212,14 +185,14 @@ end;
procedure con_write_string(Str: PKolibriChar; Length: LongWord); stdcall; procedure con_write_string(Str: PKolibriChar; Length: LongWord); stdcall;
var var
Written: Cardinal; Written: LongWord;
begin begin
System.WriteFile(TTextRec(Output).Handle, Str^, Length, Written, nil); WriteFile(TTextRec(Output).Handle, Str^, Length, Written, nil);
end; end;
procedure con_write_asciiz(Str: PKolibriChar); stdcall; procedure con_write_asciiz(Str: PKolibriChar); stdcall;
begin begin
_cputs(Str); cputs(Str);
end; end;
procedure Delay(Milliseconds: LongWord); procedure Delay(Milliseconds: LongWord);
@@ -240,11 +213,11 @@ begin
Pointer(@System.con_gets) := @con_gets; Pointer(@System.con_gets) := @con_gets;
Pointer(@System.con_gets2) := @con_gets2; Pointer(@System.con_gets2) := @con_gets2;
Pointer(@System.con_kbhit) := @con_kbhit; Pointer(@System.con_kbhit) := @con_kbhit;
Pointer(@System.con_printf) := @_cprintf; Pointer(@System.con_printf) := @cprintf;
Pointer(@System.con_set_cursor_height) := @con_set_cursor_height; Pointer(@System.con_set_cursor_height) := @con_set_cursor_height;
Pointer(@System.con_set_cursor_pos) := @con_set_cursor_pos; Pointer(@System.con_set_cursor_pos) := @con_set_cursor_pos;
Pointer(@System.con_set_flags) := @con_set_flags; Pointer(@System.con_set_flags) := @con_set_flags;
Pointer(@System.con_set_title) := @Windows.SetConsoleTitleA; Pointer(@System.con_set_title) := @SetConsoleTitle;
Pointer(@System.con_write_asciiz) := @con_write_asciiz; Pointer(@System.con_write_asciiz) := @con_write_asciiz;
Pointer(@System.con_write_string) := @con_write_string; Pointer(@System.con_write_string) := @con_write_string;
end; end;

View File

@@ -4,16 +4,6 @@
Copyright (c) 2021 Delphi SDK for KolibriOS team Copyright (c) 2021 Delphi SDK for KolibriOS team
*) *)
type
TOSVersionInfoA = packed record
dwOSVersionInfoSize: LongWord;
dwMajorVersion: LongWord;
dwMinorVersion: LongWord;
dwBuildNumber: LongWord;
dwPlatformId: LongWord;
szCSDVersion: array[0..127] of KolibriChar;
end;
const const
BoardLog = 'BOARDLOG.TXT'; BoardLog = 'BOARDLOG.TXT';
@@ -21,18 +11,11 @@ var
hBoard: THandle; hBoard: THandle;
DebugReadPos: UInt64; DebugReadPos: UInt64;
function GetFileSizeEx(hFile: THandle; var FileSize: UInt64): LongBool; stdcall;
external kernel32 name 'GetFileSizeEx';
function GetVersionExA(var Info: TOSVersionInfoA): LongBool; stdcall;
external kernel32 name 'GetVersionExA';
function SetFilePointerEx(hFile: THandle; Distance: Int64; NewFilePtr: PUInt64; Method: LongWord): LongBool; stdcall;
external kernel32 name 'SetFilePointerEx';
function InitBoard: Boolean; function InitBoard: Boolean;
begin begin
if hBoard = 0 then if hBoard = 0 then
begin begin
hBoard := CreateFileA(BoardLog, GENERIC_READ or GENERIC_WRITE, hBoard := CreateFile(BoardLog, GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_ALWAYS, 0, 0); FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_ALWAYS, 0, 0);
Result := hBoard <> INVALID_HANDLE_VALUE; Result := hBoard <> INVALID_HANDLE_VALUE;
end end
@@ -54,28 +37,28 @@ var
BytesWritten: LongWord; BytesWritten: LongWord;
begin begin
if not InitBoard or not SetFilePointerEx(hBoard, 0, nil, FILE_END) or if not InitBoard or not SetFilePointerEx(hBoard, 0, nil, FILE_END) or
not System.WriteFile(hBoard, Data, SizeOf(Data), BytesWritten, nil) or (BytesWritten = 0) not WriteFile(hBoard, Data, SizeOf(Data), BytesWritten, nil) or (BytesWritten = 0)
then then
RunError(ERROR_ACCESS_DENIED); RunError(ERROR_ACCESS_DENIED);
end; end;
procedure ExitThread; stdcall; procedure ExitThread; stdcall;
begin begin
Windows.ExitProcess(0); ExitProcess(0);
end; end;
function GetCurrentDirectory(Buffer: PKolibriChar; Count: LongWord): LongWord; function GetCurrentDirectory(Buffer: PKolibriChar; Count: LongWord): LongWord;
begin begin
Result := GetCurrentDirectoryA(Count, Buffer); Result := System.GetCurrentDirectory(Count, Buffer);
end; end;
procedure GetKernelVersion(var Buffer: TKernelVersion); procedure GetKernelVersion(var Buffer: TKernelVersion);
var var
Info: TOSVersionInfoA; Info: TOSVersionInfo;
begin begin
FillChar(Buffer, SizeOf(Buffer), 0); FillChar(Buffer, SizeOf(Buffer), 0);
Info.dwOSVersionInfoSize := SizeOf(Info); Info.dwOSVersionInfoSize := SizeOf(Info);
if GetVersionExA(Info) then if GetVersionEx(Info) then
with Buffer, Info do with Buffer, Info do
begin begin
A := dwMajorVersion; A := dwMajorVersion;
@@ -84,9 +67,9 @@ begin
end; end;
end; end;
function GetSystemDate: KolibriOS.TSystemDate; function GetSystemDate: TSystemDate;
var var
Date: Windows.TSystemTime; Date: System.TSystemTime;
begin begin
GetLocalTime(Date); GetLocalTime(Date);
with Result, Date do with Result, Date do
@@ -98,9 +81,9 @@ begin
end; end;
end; end;
function GetSystemTime: KolibriOS.TSystemTime; function GetSystemTime: TSystemTime;
var var
Time: Windows.TSystemTime; Time: System.TSystemTime;
begin begin
GetLocalTime(Time); GetLocalTime(Time);
with Result, Time do with Result, Time do
@@ -113,12 +96,12 @@ end;
function GetTickCount: LongWord; stdcall; function GetTickCount: LongWord; stdcall;
asm asm
JMP Windows.GetTickCount JMP System.GetTickCount
end; end;
function GetTickCount64: UInt64; stdcall; function GetTickCount64: UInt64; stdcall;
asm asm
CALL Windows.GetTickCount CALL System.GetTickCount
XOR EDX, EDX XOR EDX, EDX
end; end;
@@ -128,12 +111,12 @@ var
QSize: UInt64; QSize: UInt64;
Unpacked: Pointer; Unpacked: Pointer;
begin begin
hFile := CreateFileA(FileName, GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0); hFile := CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0);
if (hFile <> INVALID_HANDLE_VALUE) and GetFileSizeEx(hFile, QSize) then if (hFile <> INVALID_HANDLE_VALUE) and GetFileSizeEx(hFile, QSize) then
begin begin
Size := QSize; Size := QSize;
GetMem(Result, Size); GetMem(Result, Size);
Windows.ReadFile(hFile, Result^, Size, Size, nil); System.ReadFile(hFile, Result^, Size, Size, nil);
if PPackedFileHeader(Result).Signature = KPCK then if PPackedFileHeader(Result).Signature = KPCK then
begin begin
Size := PPackedFileHeader(Result).UnpackedSize; Size := PPackedFileHeader(Result).UnpackedSize;
@@ -149,11 +132,11 @@ begin
end; end;
procedure SetCurrentDirectory(Path: PKolibriChar); procedure SetCurrentDirectory(Path: PKolibriChar);
begin asm
SetCurrentDirectoryA(Path); JMP System.SetCurrentDirectory
end; end;
procedure Sleep(Time: LongWord); procedure Sleep(Time: LongWord);
begin begin
Windows.Sleep(Time * 10); System.Sleep(Time * 10);
end; end;

View File

@@ -4,43 +4,10 @@
Copyright (c) 2021 Delphi SDK for KolibriOS team Copyright (c) 2021 Delphi SDK for KolibriOS team
*) *)
type
HRESULT = type LongInt;
HINST = THandle;
HMODULE = THandle;
HRSRC = THandle;
var var
ExitCode: Integer; ExitCode: Integer;
MainWindow: THandle; MainWindow: HWnd;
const
kernel32 = 'kernel32.dll';
user32 = 'user32.dll';
procedure _Halt(ExitCode: Integer); procedure _Halt(ExitCode: Integer);
procedure ExitProcess(ExitCode: Cardinal); stdcall;
external kernel32 name 'ExitProcess';
function GetCommandLine: PKolibriChar; stdcall;
external kernel32 name 'GetCommandLineA';
function GetModuleFileName(hModule: THandle; Buffer: PKolibriChar; Count: Cardinal): Cardinal; stdcall;
external kernel32 name 'GetModuleFileNameA';
function GetProcessHeap: THandle; stdcall;
external kernel32 name 'GetProcessHeap';
function GetStdHandle(Code: LongWord): THandle; stdcall;
external kernel32 name 'GetStdHandle';
function HeapAlloc(hHeap: THandle; Flags, Bytes: Cardinal): Pointer; stdcall;
external kernel32 name 'HeapAlloc';
function HeapReAlloc(hHeap: THandle; Flags: Cardinal; Mem: Pointer; Bytes: Cardinal): Pointer; stdcall;
external kernel32 name 'HeapReAlloc';
function HeapFree(hHeap: THandle; Flags: Cardinal; Mem: Pointer): LongBool; stdcall;
external kernel32 name 'HeapFree';
function WriteFile(hFile: THandle; const Buffer; Count: Cardinal; var BytesWritten: Cardinal; Overlapped: Pointer): LongBool; stdcall;
external kernel32 name 'WriteFile';
procedure MessageBox(Wnd: THandle; Text, Caption: PKolibriChar; Flags: Cardinal); stdcall;
external user32 name 'MessageBoxA';
procedure __lldiv; procedure __lldiv;

View File

@@ -4,9 +4,6 @@
Copyright (c) 2021 Delphi SDK for KolibriOS team Copyright (c) 2021 Delphi SDK for KolibriOS team
*) *)
const
HEAP_NO_SERIALIZE = $00001;
var var
ModuleFileName: array[0..1023] of KolibriChar; ModuleFileName: array[0..1023] of KolibriChar;
HeapHandle: THandle; HeapHandle: THandle;
@@ -39,8 +36,6 @@ end;
procedure ErrorMessage(Msg: PKolibriChar; Count: Byte); procedure ErrorMessage(Msg: PKolibriChar; Count: Byte);
const const
MB_ICONERROR = $0010;
MB_TASKMODAL = $2000;
EOL: array[0..1] of KolibriChar = #13#10; EOL: array[0..1] of KolibriChar = #13#10;
var var
Buf: array[Low(Byte)..High(Byte) + 1] of KolibriChar; Buf: array[Low(Byte)..High(Byte) + 1] of KolibriChar;

164
Lib/KoW/WinAPI.inc Normal file
View File

@@ -0,0 +1,164 @@
type
HModule = type THandle;
HWnd = type THandle;
PCoord = ^TCoord;
TCoord = packed record
X, Y: SmallInt;
end;
PPoint = ^TPoint;
TPoint = packed record
X, Y: LongInt;
end;
PSmallRect = ^TSmallRect;
TSmallRect = packed record
Left, Top, Right, Bottom: SmallInt;
end;
PConsoleCursorInfo = ^TConsoleCursorInfo;
TConsoleCursorInfo = packed record
dwSize: LongWord;
bVisible: LongBool;
end;
PConsoleFontInfo = ^TConsoleFontInfo;
TConsoleFontInfo = packed record
nFont: LongWord;
dwFontSize: TCoord;
end;
PConsoleScreenBufferInfo = ^TConsoleScreenBufferInfo;
TConsoleScreenBufferInfo = packed record
dwSize: TCoord;
dwCursorPosition: TCoord;
wAttributes: Word;
srWindow: TSmallRect;
dwMaximumWindowSize: TCoord;
end;
PSystemTime = ^TSystemTime;
TSystemTime = record
wYear, wMonth, wDayOfWeek, wDay, wHour, wMinute, wSecond, wMilliseconds: Word;
end;
TOSVersionInfo = packed record
dwOSVersionInfoSize, dwMajorVersion, dwMinorVersion, dwBuildNumber, dwPlatformId: LongWord;
szCSDVersion: array[0..127] of AnsiChar;
end;
const
kernel32 = 'kernel32.dll';
user32 = 'user32.dll';
msvcrt = 'msvcrt.dll';
INVALID_HANDLE_VALUE = THandle(-1);
STD_INPUT_HANDLE = LongWord(-10);
STD_OUTPUT_HANDLE = LongWord(-11);
GENERIC_READ = LongWord($80000000);
GENERIC_WRITE = LongWord($40000000);
FILE_SHARE_READ = LongWord($1);
FILE_SHARE_WRITE = LongWord($2);
OPEN_EXISTING = 3;
OPEN_ALWAYS = 4;
FILE_BEGIN = 0;
FILE_CURRENT = 1;
FILE_END = 2;
HEAP_NO_SERIALIZE = LongWord($00001);
MB_ICONERROR = LongWord($0010);
MB_TASKMODAL = LongWord($2000);
function AllocConsole: LongBool; stdcall;
external kernel32 name 'AllocConsole';
function CreateFile(FileName: PAnsiChar; Access, ShareMode: LongWord; SecurityAttributes: Pointer; Disposition, FlagsAndAttributes: LongWord; hTemplateFile: THandle): THandle; stdcall;
external kernel32 name 'CreateFileA';
procedure ExitProcess(ExitCode: Cardinal); stdcall;
external kernel32 name 'ExitProcess';
function FillConsoleOutputCharacter(hConsoleOutput: THandle; Ch: AnsiChar; Count: LongWord; Coord: TCoord; var CharsWritten: LongWord): LongBool; stdcall;
external kernel32 name 'FillConsoleOutputCharacterA';
function GetCommandLine: PAnsiChar; stdcall;
external kernel32 name 'GetCommandLineA';
function GetConsoleCP: Cardinal; stdcall;
external kernel32 name 'GetConsoleCP';
function GetConsoleCursorInfo(hConsoleOutput: THandle; var Info: TConsoleCursorInfo): LongBool; stdcall;
external kernel32 name 'GetConsoleCursorInfo';
function GetConsoleOutputCP: Cardinal; stdcall;
external kernel32 name 'GetConsoleOutputCP';
function GetConsoleScreenBufferInfo(hConsoleOutput: THandle; var Info: TConsoleScreenBufferInfo): LongBool; stdcall;
external kernel32 name 'GetConsoleScreenBufferInfo';
function GetConsoleWindow: HWnd; stdcall;
external kernel32 name 'GetConsoleWindow';
function GetCurrentConsoleFont(hConsoleOutput: THandle; MaximumWindow: LongBool; var Info: TConsoleFontInfo): LongBool; stdcall;
external kernel32 name 'GetCurrentConsoleFont';
function GetCurrentDirectory(Count: LongWord; Buffer: PAnsiChar): LongWord; stdcall;
external kernel32 name 'GetCurrentDirectoryA';
function GetFileSizeEx(hFile: THandle; var FileSize: UInt64): LongBool; stdcall;
external kernel32 name 'GetFileSizeEx';
procedure GetLocalTime(var Time: TSystemTime); stdcall;
external kernel32 name 'GetLocalTime';
function GetModuleFileName(hModule: HModule; Buffer: PAnsiChar; Count: Cardinal): Cardinal; stdcall;
external kernel32 name 'GetModuleFileNameA';
function GetProcessHeap: THandle; stdcall;
external kernel32 name 'GetProcessHeap';
function GetStdHandle(Code: LongWord): THandle; stdcall;
external kernel32 name 'GetStdHandle';
function GetTickCount: LongWord; stdcall;
external kernel32 name 'GetStdHandle';
function GetVersionEx(var Info: TOSVersionInfo): LongBool; stdcall;
external kernel32 name 'GetVersionExA';
function HeapAlloc(hHeap: THandle; Flags, Bytes: Cardinal): Pointer; stdcall;
external kernel32 name 'HeapAlloc';
function HeapReAlloc(hHeap: THandle; Flags: Cardinal; Mem: Pointer; Bytes: Cardinal): Pointer; stdcall;
external kernel32 name 'HeapReAlloc';
function HeapFree(hHeap: THandle; Flags: Cardinal; Mem: Pointer): LongBool; stdcall;
external kernel32 name 'HeapFree';
function ReadFile(hFile: THandle; var Buffer; Count: LongWord; var BytesRead: LongWord; lpOverlapped: Pointer): LongBool; stdcall;
external kernel32 name 'ReadFile';
function SetConsoleCP(CodePage: Cardinal): LongBool; stdcall;
external kernel32 name 'SetConsoleCP';
function SetConsoleCursorInfo(hConsoleOutput: THandle; const Info: TConsoleCursorInfo): LongBool; stdcall;
external kernel32 name 'SetConsoleCursorInfo';
function SetConsoleCursorPosition(hConsoleOutput: THandle; Pos: TCoord): LongBool; stdcall;
external kernel32 name 'SetConsoleCursorPosition';
function SetConsoleOutputCP(CodePage: Cardinal): LongBool; stdcall;
external kernel32 name 'SetConsoleOutputCP';
function SetConsoleScreenBufferSize(hConsoleOutput: THandle; Size: TCoord): LongBool; stdcall;
external kernel32 name 'SetConsoleScreenBufferSize';
function SetConsoleTextAttribute(hConsoleOutput: THandle; Attr: Word): LongBool; stdcall;
external kernel32 name 'SetConsoleTextAttribute';
function SetConsoleTitle(Title: PAnsiChar): LongBool; stdcall;
external kernel32 name 'SetConsoleTitleA';
function SetConsoleWindowInfo(hConsoleOutput: THandle; Abs: LongBool; const Window: TSmallRect): LongBool; stdcall;
external kernel32 name 'SetConsoleWindowInfo';
function SetCurrentDirectory(Path: PAnsiChar): LongBool; stdcall;
external kernel32 name 'SetCurrentDirectoryA';
function SetFilePointerEx(hFile: THandle; Distance: Int64; NewFilePtr: PUInt64; Method: LongWord): LongBool; stdcall;
external kernel32 name 'SetFilePointerEx';
procedure Sleep(Milliseconds: LongWord); stdcall;
external kernel32 name 'Sleep';
function WriteFile(hFile: THandle; const Buffer; Count: LongWord; var BytesWritten: LongWord; Overlapped: Pointer): LongBool; stdcall;
external kernel32 name 'WriteFile';
procedure MessageBox(Wnd: HWnd; Text, Caption: PAnsiChar; Flags: Cardinal); stdcall;
external user32 name 'MessageBoxA';
function cgets_s(Buffer: PAnsiChar; Count: Cardinal; var Read: Cardinal): PAnsiChar; cdecl;
external msvcrt name '_cgets_s';
function cputs(Str: PAnsiChar): Integer; cdecl;
external msvcrt name '_cputs';
function getch: AnsiChar; cdecl;
external msvcrt name '_getch';
function gets: PAnsiChar; cdecl;
external msvcrt name 'gets';
function kbhit: Integer; cdecl;
external msvcrt name '_kbhit';
function cprintf(Fmt: PAnsiChar): Integer; cdecl varargs;
external msvcrt name '_cprintf';

View File

@@ -679,11 +679,6 @@ const
implementation implementation
{$IFNDEF KolibriOS}
uses
Windows;
{$ENDIF}
{$IFDEF KolibriOS} {$IFDEF KolibriOS}
procedure ExitThread; stdcall; procedure ExitThread; stdcall;

View File

@@ -327,6 +327,7 @@ const
con_write_string: procedure(Str: PKolibriChar; Length: LongWord); stdcall = nil; con_write_string: procedure(Str: PKolibriChar; Length: LongWord); stdcall = nil;
{$IFNDEF KolibriOS} {$IFNDEF KolibriOS}
{$I KoW\WinAPI.inc}
{$I KoW\SysAPI.inc} {$I KoW\SysAPI.inc}
{$ENDIF} {$ENDIF}