170 lines
4.4 KiB
Plaintext
170 lines
4.4 KiB
Plaintext
|
(*
|
||
|
BSD 2-Clause License
|
||
|
|
||
|
Copyright (c) 2019-2020, Anton Krotov
|
||
|
All rights reserved.
|
||
|
*)
|
||
|
|
||
|
MODULE WINAPI;
|
||
|
|
||
|
IMPORT SYSTEM, API;
|
||
|
|
||
|
|
||
|
CONST
|
||
|
|
||
|
OFS_MAXPATHNAME* = 128;
|
||
|
|
||
|
|
||
|
TYPE
|
||
|
|
||
|
DLL_ENTRY* = API.DLL_ENTRY;
|
||
|
|
||
|
STRING = ARRAY 260 OF CHAR;
|
||
|
|
||
|
TCoord* = RECORD
|
||
|
|
||
|
X*, Y*: WCHAR
|
||
|
|
||
|
END;
|
||
|
|
||
|
TSmallRect* = RECORD
|
||
|
|
||
|
Left*, Top*, Right*, Bottom*: WCHAR
|
||
|
|
||
|
END;
|
||
|
|
||
|
TConsoleScreenBufferInfo* = RECORD
|
||
|
|
||
|
dwSize*: TCoord;
|
||
|
dwCursorPosition*: TCoord;
|
||
|
wAttributes*: WCHAR;
|
||
|
srWindow*: TSmallRect;
|
||
|
dwMaximumWindowSize*: TCoord
|
||
|
|
||
|
END;
|
||
|
|
||
|
TSystemTime* = RECORD
|
||
|
|
||
|
Year*,
|
||
|
Month*,
|
||
|
DayOfWeek*,
|
||
|
Day*,
|
||
|
Hour*,
|
||
|
Min*,
|
||
|
Sec*,
|
||
|
MSec*: WCHAR
|
||
|
|
||
|
END;
|
||
|
|
||
|
PSecurityAttributes* = POINTER TO TSecurityAttributes;
|
||
|
|
||
|
TSecurityAttributes* = RECORD
|
||
|
|
||
|
nLength*: INTEGER;
|
||
|
lpSecurityDescriptor*: INTEGER;
|
||
|
bInheritHandle*: INTEGER
|
||
|
|
||
|
END;
|
||
|
|
||
|
TFileTime* = RECORD
|
||
|
|
||
|
dwLowDateTime*,
|
||
|
dwHighDateTime*: INTEGER
|
||
|
|
||
|
END;
|
||
|
|
||
|
OFSTRUCT* = RECORD
|
||
|
|
||
|
cBytes*: CHAR;
|
||
|
fFixedDisk*: CHAR;
|
||
|
nErrCode*: WCHAR;
|
||
|
Reserved1*: WCHAR;
|
||
|
Reserved2*: WCHAR;
|
||
|
szPathName*: ARRAY OFS_MAXPATHNAME OF CHAR
|
||
|
|
||
|
END;
|
||
|
|
||
|
POverlapped* = POINTER TO OVERLAPPED;
|
||
|
|
||
|
OVERLAPPED* = RECORD
|
||
|
|
||
|
Internal*: INTEGER;
|
||
|
InternalHigh*: INTEGER;
|
||
|
Offset*: INTEGER;
|
||
|
OffsetHigh*: INTEGER;
|
||
|
hEvent*: INTEGER
|
||
|
|
||
|
END;
|
||
|
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "SetConsoleCursorPosition"]
|
||
|
SetConsoleCursorPosition* (hConsoleOutput, dwCursorPosition: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GetConsoleScreenBufferInfo"]
|
||
|
GetConsoleScreenBufferInfo* (hConsoleOutput: INTEGER; ConsoleScreenBufferInfo: TConsoleScreenBufferInfo): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "FillConsoleOutputCharacterA"]
|
||
|
FillConsoleOutputCharacter* (hConsoleOutput, cCaracter, nLength, dwWriteCoord, lpNumberOfCharsWritten: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "FillConsoleOutputAttribute"]
|
||
|
FillConsoleOutputAttribute* (hConsoleOutput, wAttribute, nLength, dwWriteCoord, lpNumberOfAttrsWritten: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "SetConsoleTextAttribute"]
|
||
|
SetConsoleTextAttribute* (hConsoleOutput, wAttributes: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GetStdHandle"]
|
||
|
GetStdHandle* (nStdHandle: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "CloseHandle"]
|
||
|
CloseHandle* (hObject: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "WriteFile"]
|
||
|
WriteFile* (hFile, Buffer, nNumberOfBytesToRead, lpNumberOfBytesRead: INTEGER; lpOverlapped: POverlapped): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "ReadFile"]
|
||
|
ReadFile* (hFile, Buffer, nNumberOfBytesToRead, lpNumberOfBytesRead: INTEGER; lpOverlapped: POverlapped): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GetCommandLineA"]
|
||
|
GetCommandLine* (): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GlobalAlloc"]
|
||
|
GlobalAlloc* (uFlags, dwBytes: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GlobalFree"]
|
||
|
GlobalFree* (hMem: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "ExitProcess"]
|
||
|
ExitProcess* (code: INTEGER);
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GetTickCount"]
|
||
|
GetTickCount* (): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "Sleep"]
|
||
|
Sleep* (dwMilliseconds: INTEGER);
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "FreeLibrary"]
|
||
|
FreeLibrary* (hLibModule: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GetProcAddress"]
|
||
|
GetProcAddress* (hModule, name: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "LoadLibraryA"]
|
||
|
LoadLibraryA* (name: INTEGER): INTEGER;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "AllocConsole"]
|
||
|
AllocConsole* (): BOOLEAN;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "FreeConsole"]
|
||
|
FreeConsole* (): BOOLEAN;
|
||
|
|
||
|
PROCEDURE [windows-, "kernel32.dll", "GetLocalTime"]
|
||
|
GetLocalTime* (T: TSystemTime);
|
||
|
|
||
|
|
||
|
PROCEDURE SetDllEntry* (process_detach, thread_detach, thread_attach: DLL_ENTRY);
|
||
|
BEGIN
|
||
|
API.SetDll(process_detach, thread_detach, thread_attach)
|
||
|
END SetDllEntry;
|
||
|
|
||
|
|
||
|
END WINAPI.
|