MODULE Kernel32;
IMPORT SYSTEM;
CONST
NULL* = 0;
False* = NULL; True* = 1;
InvalidHandleValue* = -1; STDInput* = -10; STDOutput* = -11;
STDError* = -12;
GenericWrite* = 30; GenericRead* = 31;
FileShareRead* = 0; FileShareWrite* = 1;
CreateAlways* = 2; OpenExisting* = 3;
FileAttributeReadonly* = 0; FileAttributeHidden* = 1;
FileAttributeSystem* = 2; FileAttributeDirectory* = 4;
FileAttributeArchive* = 5; FileAttributeEncrypted* = 6;
FileAttributeNormal* = 7; FileAttributeTemporary* = 8;
FileAttributeSparseFILE* = 9; FileAttributeReparsePoint* = 10;
FileAttributeCompressed* = 11; FileAttributeOffline* = 12;
FileAttributeNotContentIndexed* = 13;
FileFlagDeleteOnClose*=26;
FileFlagRandomAccess* = 28;
FileFlagWriteThrough*= 31;
FileBegin* = 0;
MoveFileReplaceExisting* = 0; MoveFileCopyAllowed* = 1; MoveFileWriteThrough*= 3;
MEMCommit* = 12; MEMReserve* = 13; MEMDecommit* = 14;
MEMRelease* = 15; CreateSuspended* = 2; TLSOutOfIndexes* = -1;
PageReadWrite* = 2; PageExecuteReadWrite* = 6;
GMemMoveable* = 1; GMemShare* = 13;
GMemDDEShare* = GMemShare;
MaxPath* = 260;
DriveUnknown* = 0; DriveNoRootDir* = 1; DriveRemovable* = 2;
DriveFixed* = 3; DriveRemote* = 4; DriveCDRom* = 5;
DriveRamDisk* = 6; Infinite* = -1; WaitObject0* = 0;
SizeOf80387Registers* = 80; ExceptionMaximumParameters* = 15;
ExceptionGuardPage* = LONGINT(080000001H);
ExceptionBreakPoint* = LONGINT(080000003H);
ExceptionSingleStep* = LONGINT(080000004H);
ExceptionAccessViolation* = LONGINT(0C0000005H);
ExceptionIllegalInstruction* = LONGINT(0C000001DH);
ExceptionArrayBoundsExceeded* = LONGINT(0C000008CH);
ExceptionFltDenormalOperand* = LONGINT(0C000008DH);
ExceptionFltDivideByZero* = LONGINT(0C000008EH);
ExceptionFltInexactResult* = LONGINT(0C000008FH);
ExceptionFltInvalidOperation* = LONGINT(0C0000090H);
ExceptionFltOverflow* = LONGINT(0C0000091H);
ExceptionFltStackCheck* = LONGINT(0C0000092H);
ExceptionFltUndeflow* = LONGINT(0C0000093H);
ExceptionIntDivideByZero* = LONGINT(0C0000094H);
ExceptionIntOverflow* =LONGINT(0C0000095H);
ExceptionPrivInstruction* = LONGINT(0C0000096H);
ExceptionStackOverflow* = LONGINT(0C00000FDH);
ContextIntel = 16;
ContextControl* = {0, ContextIntel};
ContextInteger* = {1, ContextIntel};
ContextSegments* = {2, ContextIntel};
ContextFloatingPoint* = {3, ContextIntel};
ContextDebugRegisters* = {4, ContextIntel};
ContextFull* = ContextControl + ContextInteger + ContextSegments;
ExceptionContinueExecution* = -1; ExceptionContinueSearch* = 0;
ExceptionExecuteHandler* = 1;
ThreadPriorityIdle* = -15; ThreadPriorityBelowNormal* = -1;
ThreadPriorityNormal* = 0; ThreadPriorityAboveNormal* = 1; ThreadPriorityHighest* = 2;
ThreadPriorityTimeCritical* = 15; ThreadPriorityErrorReturn* = MAX( LONGINT );
WaitTimeout* = 0102H;
SEMFailCriticalErrors* = 0;
DuplicateCloseSource* = 0; DuplicateSameAccess* = 1;
StartFUseShowWindow* = 0; StartFUseSize* = 1; StartFUsePosition* = 2;
VerPlatformWin32s* = 0; VerPlatformWin32Windows* = 1;
VerPlatformWin32NT* = 2;
SETXOFF* = 1; SETXON* = 2; SETRTS* = 3; CLRRTS* = 4; SETDTR* = 5;
CLRDTR* = 6; RESETDEV* = 7; SETBREAK* = 8; CLRBREAK* = 9;
PurgeTXAbort* = 0; PurgeRXAbort* = 1; PurgeTXClear* = 2;
PurgeRXClear* = 3;
EVRXChar* = 0; EVRXFlag* = 1; EVTXEmpty* = 2; EVCTS* = 3;
EVDSR* = 4; EVRLSD* = 5; EVBreak* = 6; EVErr* = 7; EVRing* = 8;
EVPErr* = 9; EVRX80Full* = 10; EVEvent1* = 11; EVEvent2* = 12;
MSCTSOn* = 4; MSDSROn* = 5; MSRingOn* = 6; MSRLSDOn* = 7;
NoParity* = 0X; OddParity* = 1X; EvenParity* = 2X; MarkParity* = 3X;
SpaceParity* = 4X; OneStopBit* = 0X; One5StopBits* = 1X;
TwoStopBits* = 2X;
ErrorSuccess* = 0; ErrorFileNotFound* = 2; ErrorAccessDenied* = 5;
ErrorInvalidParameter* = 87;
TYPE
BOOL* = LONGINT;
ADDRESS* = LONGINT; HANDLE* = ADDRESS; HMODULE* = ADDRESS;
HINSTANCE* = ADDRESS; ATOM* = INTEGER; HGLOBAL* = HANDLE;
LPSTR* = ADDRESS;
FileTime* = RECORD
dwLowDateTime*, dwHighDateTime*: LONGINT
END;
FindData* = RECORD
dwFileAttributes*: SET;
ftCreationTime*, ftLastAccessTime*, ftLastWriteTime*: FileTime;
nFileSizeHigh*, nFileSizeLow*: LONGINT;
dwReserved0*, dwReserved1*: LONGINT;
cFileName*: ARRAY MaxPath OF CHAR;
cAlternateFileName*: ARRAY 14 OF CHAR
END;
SystemTime* = RECORD
wYear*, wMonth*, wDayOfWeek*, wDay*: INTEGER;
wHour*, wMinute*, wSecond*, wMilliseconds*: INTEGER
END;
SmallRect* = RECORD
left*, top*, right*, bottom*: INTEGER
END;
CriticalSection* = RECORD
a, b, c, d, e, f: LONGINT
END;
FloatingSaveArea* = RECORD
ControlWord*, StatusWord*, TagWord*, ErrorOffset*, ErrorSelector*, DataOffset*, DataSelector*: LONGINT;
RegisterArea*: ARRAY SizeOf80387Registers OF SYSTEM.BYTE;
Cr0NpxState*: LONGINT
END;
Context* = RECORD
ContextFlags*: SET;
DR0*, DR1*, DR2*, DR3*, DR6*, DR7*: LONGINT;
FloatSave*: FloatingSaveArea;
GS*, FS*, ES*, DS*: LONGINT;
EDI*, ESI*, EBX*, EDX*, ECX*, EAX*: LONGINT;
BP*, PC*, CS*, FLAGS*, SP*, SS*: LONGINT;
END;
ExceptionRecordPtr* = POINTER TO ExceptionRecord;
ExceptionRecord* = RECORD
ExceptionCode*, ExceptionFlags*: LONGINT;
nextExceptionRecord*: ExceptionRecordPtr;
ExceptionAddress*: ADDRESS;
NumberParameters*: LONGINT;
ExceptionInformation*: ARRAY ExceptionMaximumParameters OF LONGINT
END;
ExcpFrmPtr* = ADDRESS;
ExcpFrmHandler* = PROCEDURE {WINAPI} ( VAR excpRec: ExceptionRecord;
excpFrame: ExcpFrmPtr;
VAR context: Context;
dispatch: LONGINT ): LONGINT;
ExcpFrm* = RECORD
link*: ExcpFrmPtr;
handler*: ExcpFrmHandler
END;
Object* = POINTER TO RECORD
handle*: HANDLE
END;
LargeInteger* = RECORD
LowPart*, HighPart*: LONGINT
END;
ULargeInteger* = LargeInteger;
MemoryStatusEx* = RECORD
dwLength*: LONGINT;
dwMemoryLoad*: LONGINT;
ullTotalPhys*: HUGEINT;
ullAvailPhys*: HUGEINT;
ullTotalPageFile*: HUGEINT;
ullAvailPageFile*: HUGEINT;
ullTotalVirtual*: HUGEINT;
ullAvailVirtual*: HUGEINT;
ullAvailExtendedVirtual*: HUGEINT;
END;
ThreadProc* = PROCEDURE {WINAPI} ( lpParameter: ANY ): LONGINT;
ProcessInformation* = RECORD
hProcess*, hThread*: HANDLE;
dwProcessId*, dwThreadId*: LONGINT
END;
StartupInfo* = RECORD
cb*: LONGINT;
lpReserved*, lpDesktop*, lpTitle*: LPSTR;
dwX*, dwY*, dwXSize*, dwYSize*: LONGINT;
dwXCountChars*, dwYCountChars*: LONGINT;
dwFillAttribute*: LONGINT;
dwFlags*: SET;
wShowWindow*, cbReserved2*: INTEGER;
lpReserved2*: ADDRESS;
hStdInput*, hStdOutput*, hStdError*: HANDLE
END;
OSVersionInfo* = RECORD
dwOSVersionInfoSize*, dwMajorVersion*, dwMinorVersion*, dwBuildNumber*, dwPlatformId*: LONGINT;
szCSDVersion*: ARRAY 128 OF CHAR
END;
Exception* = RECORD
exc*: ExceptionRecord;
cont*: Context
END;
CommTimeouts* = RECORD
ReadIntervalTimeout*, ReadTotalTimeoutMultiplier*, ReadTotalTimeoutConstant*, WriteTotalTimeoutMultiplier*, WriteTotalTimeoutConstant*: LONGINT
END;
DCB* = RECORD
DCBlength*, BaudRate*: LONGINT;
flags*: SET;
wReserved*, XonLim*, XoffLim*: INTEGER;
ByteSize*, Parity*, StopBits*, XonChar*, XoffChar*, ErrorChar*, EofChar*, EvtChar*: CHAR;
wReserved1*: INTEGER
END;
ComStat* = RECORD
status*: SET;
cbInQue*, cbOutQue*: LONGINT
END;
SystemInfo* = RECORD
wProcessorArchitecture*: INTEGER;
wReserved: INTEGER;
dwPageSize*: LONGINT;
lpMinimumApplicationAddress*: LONGINT;
lpMaximumApplicationAddress*: LONGINT;
dwActiveProcessorMask*: LONGINT;
dwNumberOfProcessors*: LONGINT;
dwProcessorType*: LONGINT;
dwAllocationGranularity*: LONGINT;
wProcessorLevel*: INTEGER;
wProcessorRevision*: INTEGER;
END;
TimeZoneInformation* = RECORD
Bias*: LONGINT;
StandardName*: ARRAY 32 OF INTEGER;
StandardDate*: SystemTime;
StandardBias*: LONGINT;
DaylightName*: ARRAY 32 OF INTEGER;
DaylightDate*: SystemTime;
DaylightBias*: LONGINT;
END;
VAR
getProcAddress-: PROCEDURE {WINAPI} ( hModule: LONGINT; CONST lpProcName: ARRAY OF CHAR ): ADDRESS;
LoadLibrary-: PROCEDURE {WINAPI} ( CONST lpLibFileName: ARRAY OF CHAR ): HINSTANCE;
AllocConsole-: PROCEDURE {WINAPI} ( ): BOOL;
Beep-: PROCEDURE {WINAPI} ( dwFreq, dwDuration: LONGINT ): BOOL;
ClearCommBreak-: PROCEDURE {WINAPI} ( hFile: HANDLE ): BOOL;
ClearCommError-: PROCEDURE {WINAPI} ( hFile: HANDLE; VAR lpErrors: SET; VAR lpStat: ComStat ): BOOL;
CloseHandle-: PROCEDURE {WINAPI} ( hObject: HANDLE ): BOOL;
CopyFile-: PROCEDURE {WINAPI} ( VAR lpExistingFileName, lpNewFileName: ARRAY OF CHAR; bFailIfExists: BOOL ): BOOL;
CreateDirectory-: PROCEDURE {WINAPI} ( VAR lpPathName: ARRAY OF CHAR;
lpSecurityAttributes: ANY ): BOOL;
CreateEvent-: PROCEDURE {WINAPI} ( lpEventAttributes: ANY;
bManualReset, bInitialState: BOOL;
CONST lpName: ARRAY OF CHAR ): HANDLE;
CreateFile-: PROCEDURE {WINAPI} ( CONST lpFileName: ARRAY OF CHAR;
dwDesiredAccess, dwShareMode: SET;
lpSecurityAttributes: ANY;
dwCreationDistribution: LONGINT;
dwFlagsAndAttributes: SET;
hTemplateFile: HANDLE ): HANDLE;
CreateProcess-: PROCEDURE {WINAPI} ( CONST lpApplicationName, lpCommandLine: ARRAY OF CHAR;
lpProcessAttributes, lpThreadAttributes: ANY;
bInheritHandles: BOOL;
dwCreationFlags: LONGINT;
lpEnvironment: ANY;
VAR lpCurrentDirectory: ARRAY OF CHAR;
VAR lpStartupInfo: StartupInfo;
VAR lpProcessInformation: ProcessInformation ): BOOL;
CreateThread-: PROCEDURE {WINAPI} ( lpThreadAttributes: ADDRESS;
dwStackSize: LONGINT;
lpStartAddress: ThreadProc;
lpParameter: ANY; dwCreationFlags: SET;
VAR lpThreadId: LONGINT ): HANDLE;
DeleteCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection );
DeleteFile-: PROCEDURE {WINAPI} ( VAR lpFileName: ARRAY OF CHAR ): BOOL;
DisableThreadLibraryCalls-: PROCEDURE {WINAPI} ( hLibModule: HMODULE ): BOOL;
DuplicateHandle-: PROCEDURE {WINAPI} ( hSourceProcessHandle, hSourceHandle, hTargetProcessHandle: HANDLE;
VAR lpTargetHandle: HANDLE;
dwDesiredAccess: SET;
bInheritHandle: BOOL;
dwOptions: SET ): BOOL;
EnterCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection );
EscapeCommFunction-: PROCEDURE {WINAPI} ( hFile: HANDLE;
dwFunc: LONGINT ): BOOL;
ExitProcess-: PROCEDURE {WINAPI} ( uExitCode: LONGINT );
ExitThread-: PROCEDURE {WINAPI} ( dwExitCode: LONGINT );
FileTimeToLocalFileTime-: PROCEDURE {WINAPI} ( VAR lpFileTime: FileTime;
VAR lpLocalFileTime: FileTime ): BOOL;
FileTimeToSystemTime-: PROCEDURE {WINAPI} ( VAR lpFileTime: FileTime;
VAR lpSystemTime: SystemTime ): BOOL;
FindClose-: PROCEDURE {WINAPI} ( hFindFile: HANDLE ): BOOL;
FindFirstFile-: PROCEDURE {WINAPI} ( VAR lpFileName: ARRAY OF CHAR;
VAR lpFindFileDate: FindData ): HANDLE;
FindNextFile-: PROCEDURE {WINAPI} ( hFindFile: HANDLE;
VAR lpFindFileDate: FindData ): BOOL;
FlushFileBuffers-: PROCEDURE {WINAPI} ( hFile: HANDLE ): BOOL;
FreeConsole-: PROCEDURE {WINAPI} ( ): BOOL;
FreeLibrary-: PROCEDURE {WINAPI} ( hLibModule: HMODULE ): BOOL;
GetCommandLine-: PROCEDURE {WINAPI} ( ): LPSTR;
GetCommModemStatus-: PROCEDURE {WINAPI} ( hFile: HANDLE;
VAR lpModemStat: SET ): BOOL;
GetCommState-: PROCEDURE {WINAPI} ( hFile: HANDLE;
VAR lpDCB: DCB ): BOOL;
GetComputerName-: PROCEDURE {WINAPI} ( VAR lpBuffer: ARRAY OF CHAR;
VAR lpnSize: LONGINT ): BOOL;
GetCurrentDirectory-: PROCEDURE {WINAPI} ( nBufferLength: LONGINT;
VAR lpBuffer: ARRAY OF CHAR ): LONGINT;
GetCurrentProcess-: PROCEDURE {WINAPI} ( ): HANDLE;
GetCurrentProcessId-: PROCEDURE {WINAPI} ( ): LONGINT;
GetCurrentThread-: PROCEDURE {WINAPI} ( ): HANDLE;
GetCurrentThreadId-: PROCEDURE {WINAPI} ( ): LONGINT;
GetDiskFreeSpace-: PROCEDURE {WINAPI} ( VAR lpRootPathName: ARRAY OF CHAR;
VAR lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: LONGINT ): BOOL;
GetDriveType-: PROCEDURE {WINAPI} ( VAR lpRootPathName: ARRAY OF CHAR ): LONGINT;
GetExitCodeProcess-: PROCEDURE {WINAPI} ( hProcess: HANDLE;
VAR lpExitCode: LONGINT ): BOOL;
GetFileAttributes-: PROCEDURE {WINAPI} ( VAR lpFileName: ARRAY OF CHAR ): SET;
GetFileSize-: PROCEDURE {WINAPI} ( hFile: HANDLE; VAR lpFileSizeHigh: LONGINT ): LONGINT;
GetFileTime-: PROCEDURE {WINAPI} ( hFile: HANDLE;
VAR lpCreationTime, lpLastAccessTime, lpLastWriteTime: FileTime ): BOOL;
GetFullPathName-: PROCEDURE {WINAPI} ( CONST lpFileName: ARRAY OF CHAR;
nBufferLength: LONGINT;
VAR lpBuffer: ARRAY OF CHAR;
lpFilePart: LPSTR ): LONGINT;
GetLastError-: PROCEDURE {WINAPI} ( ): LONGINT;
GetLocalTime-: PROCEDURE {WINAPI} ( VAR lpSystemTime: SystemTime );
GetLogicalDriveStrings-: PROCEDURE {WINAPI} ( nBufferLength: LONGINT;
VAR lpBuffer: ARRAY OF CHAR ): LONGINT;
GetLogicalDrives-: PROCEDURE ( ): SET;
GetModuleFileName-: PROCEDURE {WINAPI} ( hModule: HMODULE;
VAR lpFileName: ARRAY OF CHAR;
nSize: LONGINT ): LONGINT;
GetModuleHandle-: PROCEDURE {WINAPI} ( CONST lpModuleName: ARRAY OF CHAR ): HMODULE;
GetPrivateProfileString-: PROCEDURE {WINAPI} ( CONST lpAppName: ARRAY OF CHAR;
CONST lpKeyName: ARRAY OF CHAR;
CONST lpDefault: ARRAY OF CHAR;
CONST lpReturnedString: ARRAY OF CHAR;
nSize: LONGINT;
CONST lpFileName: ARRAY OF CHAR): LONGINT;
GetProcessTimes- : PROCEDURE {WINAPI} (CONST hProcess: HANDLE; VAR lpCreationTime, lpExitTime, lpKernelTime, lpUserTime: FileTime ): LONGINT;
GetStartupInfo-: PROCEDURE {WINAPI} ( VAR lpStartupInfo: StartupInfo );
GetSystemInfo-: PROCEDURE {WINAPI} ( VAR lpSystemInfo: SystemInfo );
GetStdHandle-: PROCEDURE {WINAPI} ( nStdHandle: LONGINT ): HANDLE;
GetSystemTime-: PROCEDURE {WINAPI} ( VAR lpSystemTime: SystemTime );
GetTempFileName-: PROCEDURE {WINAPI} ( VAR lpPathName, lpPrefixName: ARRAY OF CHAR;
uUnique: LONGINT;
VAR lpTempFileName: ARRAY OF CHAR ): LONGINT;
GetTempPath-: PROCEDURE {WINAPI} ( nBufferLength: LONGINT;
VAR lpBuffer: ARRAY OF CHAR ): LONGINT;
GetThreadContext-: PROCEDURE {WINAPI} ( hThread: HANDLE;
VAR lpContext: Context ): BOOL;
GetThreadPriority-: PROCEDURE {WINAPI} ( hThread: HANDLE ): LONGINT;
GetThreadTimes-: PROCEDURE {WINAPI} ( hThread: HANDLE;
VAR lpCreationTime, lpExitTime, lpKernelTime, lpUserTime: FileTime ): LONGINT;
GetTickCount-: PROCEDURE {WINAPI} ( ): LONGINT;
GetTimeZoneInformation-: PROCEDURE {WINAPI} ( VAR lpTimeZoneInformation: TimeZoneInformation ): LONGINT;
GetWindowsDirectory-: PROCEDURE {WINAPI} ( VAR lpBuffer: ARRAY OF CHAR; nBufferLength: LONGINT ): LONGINT;
GetVersion-: PROCEDURE {WINAPI} ( ): LONGINT;
GetVersionEx-: PROCEDURE {WINAPI} ( VAR lpVersionInfo: OSVersionInfo ): BOOL;
GetVolumeInformation-: PROCEDURE {WINAPI} ( VAR lpRootPathName: ARRAY OF CHAR;
VAR lpVolumeNameBuffer: ARRAY OF CHAR;
nVolumeNameSize: LONGINT;
VAR lpVolumeSerialNumber: LONGINT;
VAR lpMaximumComponentLength: LONGINT;
VAR lpFileSystemFlags: LONGINT;
VAR lpFileSystemNameBuffer: ARRAY OF CHAR;
nFileSystemNameSize: LONGINT ): LONGINT;
GlobalAddAtom-: PROCEDURE {WINAPI} ( VAR lpString: ARRAY OF CHAR ): ATOM;
GlobalAlloc-: PROCEDURE {WINAPI} ( uFlags: SET; dwBytes: LONGINT ): HGLOBAL;
GlobalDeleteAtom-: PROCEDURE {WINAPI} ( nAtom: ATOM ): ATOM;
GlobalLock-: PROCEDURE {WINAPI} ( hMem: HGLOBAL ): ADDRESS;
GlobalMemoryStatusEx-: PROCEDURE {WINAPI} (VAR lpBuffer: MemoryStatusEx): BOOL;
GlobalReAlloc-: PROCEDURE {WINAPI} ( hMem: HGLOBAL; dwBytes: LONGINT;
uFlags: SET ): HGLOBAL;
GlobalSize-: PROCEDURE {WINAPI} ( hMem: HGLOBAL ): LONGINT;
GlobalUnlock-: PROCEDURE {WINAPI} ( hMem: HGLOBAL ): BOOL;
InitializeCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection );
InterlockedDecrement-: PROCEDURE {WINAPI} ( VAR lpAddend: LONGINT ): LONGINT;
InterlockedIncrement-: PROCEDURE {WINAPI} ( VAR lpAddend: LONGINT ): LONGINT;
LeaveCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection );
LocalFileTimeToFileTime-: PROCEDURE {WINAPI} ( VAR lpLocalFileTime: FileTime;
VAR lpFileTime: FileTime ): BOOL;
MoveFileEx-: PROCEDURE {WINAPI} ( VAR lpExistingFileName, lpNewFileName: ARRAY OF CHAR;
dwFlags: SET ): BOOL;
outputDebugString-: PROCEDURE {WINAPI} ( CONST lpOutputString: ARRAY OF CHAR );
IsDebuggerPresent-: PROCEDURE {WINAPI}(): BOOL;
PurgeComm-: PROCEDURE {WINAPI} ( hFile: HANDLE; dwFlags: SET ): BOOL;
QueryDosDevice-: PROCEDURE {WINAPI} ( lpDeviceName: ARRAY OF CHAR;
VAR lpTargetPath: ARRAY OF CHAR;
ucchMax: LONGINT ): LONGINT;
QueryPerformanceCounter-: PROCEDURE {WINAPI} ( VAR lpPerformaceCount: LargeInteger ): BOOL;
QueryPerformanceFrequency-: PROCEDURE {WINAPI} ( VAR lpFrequency: LargeInteger ): BOOL;
QueryThreadCycleTime- : PROCEDURE {WINAPI} (hThread : HANDLE; VAR cycleTime : HUGEINT) : BOOL;
ReadFile-: PROCEDURE {WINAPI} ( hFile: HANDLE;
VAR lpBuffer: ARRAY OF SYSTEM.BYTE;
nNumberOfBytesToRead: LONGINT;
VAR lpNumberOfBytesRead: LONGINT;
lpOverlapped: ANY ): BOOL;
ReadProcessMemory-: PROCEDURE {WINAPI} ( hProcess: HANDLE;
lpBaseAddress: ADDRESS;
VAR lpBuffer: ARRAY OF SYSTEM.BYTE;
nSize: LONGINT;
VAR lpNumberOfBytesRead: LONGINT ): BOOL;
RemoveDirectory-: PROCEDURE {WINAPI} ( VAR lpPathName: ARRAY OF CHAR ): BOOL;
ResetEvent-: PROCEDURE {WINAPI} ( hEvent: HANDLE ): BOOL;
ResumeThread-: PROCEDURE {WINAPI} ( hThread: HANDLE ): LONGINT;
SearchPath-: PROCEDURE {WINAPI} ( CONST lpPath, lpFileName, lpExtension: ARRAY OF CHAR;
nBufferLength: LONGINT;
VAR lpBuffer: ARRAY OF CHAR;
VAR lpFilePart: LPSTR ): LONGINT;
SetCommBreak-: PROCEDURE {WINAPI} ( hFile: HANDLE ): BOOL;
SetCommMask-: PROCEDURE {WINAPI} ( hFile: HANDLE; dwEvtMask: SET ): BOOL;
SetCommState-: PROCEDURE {WINAPI} ( hFile: HANDLE;
VAR lpDCB: DCB ): BOOL;
SetCommTimeouts-: PROCEDURE {WINAPI} ( hFile: HANDLE;
VAR lpCommTimeouts: CommTimeouts ): BOOL;
SetConsoleCursorPosition-: PROCEDURE {WINAPI} ( hConsoleOutput: HANDLE; dwCursorPosition: LONGINT ): BOOL;
SetConsoleScreenBufferSize-: PROCEDURE {WINAPI} ( hConsoleOuput: HANDLE;
dwSize: LONGINT ): BOOL;
SetConsoleTitle-: PROCEDURE {WINAPI} ( VAR lpConsoleTitle: ARRAY OF CHAR ): BOOL;
SetConsoleWindowInfo-: PROCEDURE {WINAPI} ( hConsoleOuput: HANDLE;
bAbsolute: BOOL;
VAR lpConsoleWindow: SmallRect ): BOOL;
SetCurrentDirectory-: PROCEDURE {WINAPI} ( VAR lpPathName: ARRAY OF CHAR ): BOOL;
SetErrorMode-: PROCEDURE {WINAPI} ( uMode: SET ): SET;
SetEndOfFile-: PROCEDURE {WINAPI} ( hFile: HANDLE ): BOOL;
SetEvent-: PROCEDURE {WINAPI} ( hEvent: HANDLE ): BOOL;
SetFileAttributes-: PROCEDURE {WINAPI} ( VAR lpFileName: ARRAY OF CHAR;
dwFileAttributes: SET ): BOOL;
SetFilePointer-: PROCEDURE {WINAPI} ( hFile: HANDLE; lDistanceToMove: LONGINT;
VAR lpDistanceToMoveHigh: LONGINT;
dwMoveMethod: LONGINT ): LONGINT;
SetFileTime-: PROCEDURE {WINAPI} ( hFile: HANDLE;
VAR lpCreationTime, lpLastAccessTime, lpLastWriteTime: FileTime ): BOOL;
SetLocalTime-: PROCEDURE {WINAPI} ( VAR lpSystemTime: SystemTime ): BOOL;
SetThreadContext-: PROCEDURE {WINAPI} ( hThread: HANDLE;
VAR lpContext: Context ): BOOL;
SetThreadPriority-: PROCEDURE {WINAPI} ( hThread: HANDLE;
nPriority: LONGINT ): BOOL;
SetupComm-: PROCEDURE {WINAPI} ( hFile: HANDLE;
dwInQueue, dwOutQueue: LONGINT ): BOOL;
Sleep-: PROCEDURE {WINAPI} ( dwMilliseconds: LONGINT );
SuspendThread-: PROCEDURE {WINAPI} ( hThread: HANDLE ): LONGINT;
SystemTimeToFileTime-: PROCEDURE {WINAPI} ( VAR lpSystemTime: SystemTime;
VAR lpFileTime: FileTime ): BOOL;
TerminateThread-: PROCEDURE {WINAPI} ( hThread: HANDLE;
dwExitCode: LONGINT ): BOOL;
TlsAlloc-: PROCEDURE {WINAPI} ( ): LONGINT;
TlsFree-: PROCEDURE {WINAPI} ( dwTlsIndex: LONGINT ): BOOL;
TlsGetValue-: PROCEDURE {WINAPI} ( dwTlsIndex: LONGINT ): LONGINT;
TlsSetValue-: PROCEDURE {WINAPI} ( dwTlsIndex, lpTlsValue: LONGINT ): BOOL;
TryEnterCriticalSection-: PROCEDURE {WINAPI} ( VAR lpCriticalSection: CriticalSection ): BOOL;
VirtualAlloc-: PROCEDURE {WINAPI} ( lpAddress: ADDRESS; dwSize: LONGINT;
flAllocationType, flProtect: SET ): ADDRESS;
VirtualFree-: PROCEDURE {WINAPI} ( lpAddress: ADDRESS; dwSize: LONGINT;
dwFreeType: SET ): BOOL;
WaitForSingleObject-: PROCEDURE {WINAPI} ( hHandle: HANDLE;
dwMilliseconds: LONGINT ): LONGINT;
WriteFile-: PROCEDURE {WINAPI} ( hFile: HANDLE;
CONST lpBuffer: ARRAY OF SYSTEM.BYTE;
nNumberOfBytesToWrite: LONGINT;
VAR lpNumberOfBytesWritten: LONGINT;
lpOverlapped: ANY ): BOOL;
OutputString*: PROCEDURE ( CONST a: ARRAY OF CHAR );
Shutdown*: PROCEDURE ( code: LONGINT );
PROCEDURE GetProcAddress*( hModule: HMODULE; procName: ARRAY OF CHAR; VAR adr: ADDRESS );
BEGIN
adr := getProcAddress( hModule, procName )
END GetProcAddress;
PROCEDURE CopyString*( lpString: LPSTR; VAR str: ARRAY OF CHAR );
VAR i: LONGINT; ch: CHAR;
BEGIN
i := 0;
IF lpString # NULL THEN
SYSTEM.GET( lpString, ch );
WHILE ch # 0X DO
str[i] := ch; INC( i ); INC( lpString ); SYSTEM.GET( lpString, ch )
END
END;
str[i] := 0X
END CopyString;
PROCEDURE OutputDebugString*( CONST str: ARRAY OF CHAR );
BEGIN
outputDebugString( str );
END OutputDebugString;
PROCEDURE NoOutputString(CONST str: ARRAY OF CHAR);
BEGIN
END NoOutputString;
PROCEDURE SendToDebugger*(str: ARRAY OF CHAR; x: LONGINT );
VAR s: ARRAY 16 OF CHAR;
d, i: LONGINT;
BEGIN
outputDebugString( str ); s[8] := 0X;
FOR i := 7 TO 0 BY -1 DO
d := x MOD 16;
IF d < 10 THEN s[i] := CHR( d + ORD( "0" ) ) ELSE s[i] := CHR( d - 10 + ORD( "A" ) ) END;
x := x DIV 16
END;
outputDebugString( s ); s[0] := 0AX; s[1] := 0X; outputDebugString( s )
END SendToDebugger;
PROCEDURE ShutdownP(l: LONGINT);
BEGIN
outputDebugString("Kernel32.Shutdown");
ExitProcess(l);
END ShutdownP;
PROCEDURE Init;
VAR mod: HMODULE;
str: ARRAY 64 OF CHAR;
BEGIN
Shutdown := ShutdownP;
str := "Kernel32.DLL";
mod := LoadLibrary(str);
GetProcAddress(mod, "AllocConsole",SYSTEM.VAL(ADDRESS,AllocConsole));
GetProcAddress(mod, "Beep",SYSTEM.VAL(ADDRESS,Beep));
GetProcAddress(mod, "ClearCommBreak",SYSTEM.VAL(ADDRESS,ClearCommBreak));
GetProcAddress(mod, "ClearCommError",SYSTEM.VAL(ADDRESS,ClearCommError));
GetProcAddress(mod, "CloseHandle",SYSTEM.VAL(ADDRESS,CloseHandle));
GetProcAddress(mod, "CopyFileA",SYSTEM.VAL(ADDRESS,CopyFile));
GetProcAddress(mod, "CreateDirectoryA",SYSTEM.VAL(ADDRESS,CreateDirectory));
GetProcAddress(mod, "CreateEventA",SYSTEM.VAL(ADDRESS,CreateEvent));
GetProcAddress(mod, "CreateFileA",SYSTEM.VAL(ADDRESS,CreateFile));
GetProcAddress(mod, "CreateProcessA",SYSTEM.VAL(ADDRESS,CreateProcess));
GetProcAddress(mod, "CreateThread",SYSTEM.VAL(ADDRESS,CreateThread));
GetProcAddress(mod, "DeleteCriticalSection",SYSTEM.VAL(ADDRESS,DeleteCriticalSection));
GetProcAddress(mod, "DeleteFileA",SYSTEM.VAL(ADDRESS,DeleteFile));
GetProcAddress(mod, "DisableThreadLibraryCalls",SYSTEM.VAL(ADDRESS,DisableThreadLibraryCalls));
GetProcAddress(mod, "DuplicateHandle",SYSTEM.VAL(ADDRESS,DuplicateHandle));
GetProcAddress(mod, "EnterCriticalSection",SYSTEM.VAL(ADDRESS,EnterCriticalSection));
GetProcAddress(mod, "EscapeCommFunction",SYSTEM.VAL(ADDRESS,EscapeCommFunction));
GetProcAddress(mod, "ExitProcess",SYSTEM.VAL(ADDRESS,ExitProcess));
GetProcAddress(mod, "ExitThread",SYSTEM.VAL(ADDRESS,ExitThread));
GetProcAddress(mod, "FindClose",SYSTEM.VAL(ADDRESS,FindClose));
GetProcAddress(mod, "FileTimeToLocalFileTime",SYSTEM.VAL(ADDRESS,FileTimeToLocalFileTime));
GetProcAddress(mod, "FileTimeToSystemTime",SYSTEM.VAL(ADDRESS,FileTimeToSystemTime));
GetProcAddress(mod, "FindFirstFileA",SYSTEM.VAL(ADDRESS,FindFirstFile));
GetProcAddress(mod, "FindNextFileA",SYSTEM.VAL(ADDRESS,FindNextFile));
GetProcAddress(mod, "FlushFileBuffers",SYSTEM.VAL(ADDRESS,FlushFileBuffers));
GetProcAddress(mod, "FreeConsole",SYSTEM.VAL(ADDRESS,FreeConsole));
GetProcAddress(mod, "FreeLibrary",SYSTEM.VAL(ADDRESS,FreeLibrary));
GetProcAddress(mod, "GetCommandLineA",SYSTEM.VAL(ADDRESS,GetCommandLine));
GetProcAddress(mod, "GetCommModemStatus",SYSTEM.VAL(ADDRESS,GetCommModemStatus));
GetProcAddress(mod, "GetCommState",SYSTEM.VAL(ADDRESS,GetCommState));
GetProcAddress(mod, "GetComputerNameA",SYSTEM.VAL(ADDRESS,GetComputerName));
GetProcAddress(mod, "GetCurrentDirectoryA",SYSTEM.VAL(ADDRESS,GetCurrentDirectory));
GetProcAddress(mod, "GetCurrentProcess",SYSTEM.VAL(ADDRESS,GetCurrentProcess));
GetProcAddress(mod, "GetCurrentProcessId",SYSTEM.VAL(ADDRESS,GetCurrentProcessId));
GetProcAddress(mod, "GetCurrentThread",SYSTEM.VAL(ADDRESS,GetCurrentThread));
GetProcAddress(mod, "GetCurrentThreadId",SYSTEM.VAL(ADDRESS,GetCurrentThreadId));
GetProcAddress(mod, "GetDiskFreeSpaceA",SYSTEM.VAL(ADDRESS,GetDiskFreeSpace));
GetProcAddress(mod, "GetDriveTypeA",SYSTEM.VAL(ADDRESS,GetDriveType));
GetProcAddress(mod, "GetExitCodeProcess",SYSTEM.VAL(ADDRESS,GetExitCodeProcess));
GetProcAddress(mod, "GetFileAttributesA",SYSTEM.VAL(ADDRESS,GetFileAttributes));
GetProcAddress(mod, "GetFileSize",SYSTEM.VAL(ADDRESS,GetFileSize));
GetProcAddress(mod, "GetFileTime",SYSTEM.VAL(ADDRESS,GetFileTime));
GetProcAddress(mod, "GetFullPathNameA",SYSTEM.VAL(ADDRESS,GetFullPathName));
GetProcAddress(mod, "GetLastError",SYSTEM.VAL(ADDRESS,GetLastError));
GetProcAddress(mod, "GetLocalTime",SYSTEM.VAL(ADDRESS,GetLocalTime));
GetProcAddress(mod, "GetLogicalDriveStringsA",SYSTEM.VAL(ADDRESS,GetLogicalDriveStrings));
GetProcAddress(mod, "GetLogicalDrives",SYSTEM.VAL(ADDRESS,GetLogicalDrives));
GetProcAddress(mod, "GetModuleFileNameA",SYSTEM.VAL(ADDRESS,GetModuleFileName));
GetProcAddress(mod, "GetModuleHandleA",SYSTEM.VAL(ADDRESS,GetModuleHandle));
GetProcAddress(mod, "GetPrivateProfileStringA",SYSTEM.VAL(ADDRESS,GetPrivateProfileString));
GetProcAddress(mod, "GetProcessTimes", SYSTEM.VAL(ADDRESS, GetProcessTimes));
GetProcAddress(mod, "GetStartupInfoA",SYSTEM.VAL(ADDRESS,GetStartupInfo));
GetProcAddress(mod, "GetStdHandle",SYSTEM.VAL(ADDRESS,GetStdHandle));
GetProcAddress(mod, "GetSystemInfo",SYSTEM.VAL(ADDRESS,GetSystemInfo));
GetProcAddress(mod, "GetSystemTime",SYSTEM.VAL(ADDRESS,GetSystemTime));
GetProcAddress(mod, "GetTempFileNameA",SYSTEM.VAL(ADDRESS,GetTempFileName));
GetProcAddress(mod, "GetTempPathA",SYSTEM.VAL(ADDRESS,GetTempPath));
GetProcAddress(mod, "GetThreadContext",SYSTEM.VAL(ADDRESS,GetThreadContext));
GetProcAddress(mod, "GetThreadPriority",SYSTEM.VAL(ADDRESS,GetThreadPriority));
GetProcAddress(mod, "GetThreadTimes",SYSTEM.VAL(ADDRESS,GetThreadTimes));
GetProcAddress(mod, "GetTickCount",SYSTEM.VAL(ADDRESS,GetTickCount));
GetProcAddress(mod, "GetWindowsDirectoryA",SYSTEM.VAL(ADDRESS,GetWindowsDirectory));
GetProcAddress(mod, "GetTimeZoneInformation",SYSTEM.VAL(ADDRESS,GetTimeZoneInformation));
GetProcAddress(mod, "GetVersion",SYSTEM.VAL(ADDRESS,GetVersion));
GetProcAddress(mod, "GetVersionExA",SYSTEM.VAL(ADDRESS,GetVersionEx));
GetProcAddress(mod, "GetVolumeInformationA",SYSTEM.VAL(ADDRESS,GetVolumeInformation));
GetProcAddress(mod, "GlobalAddAtomA",SYSTEM.VAL(ADDRESS,GlobalAddAtom));
GetProcAddress(mod, "GlobalAlloc",SYSTEM.VAL(ADDRESS,GlobalAlloc));
GetProcAddress(mod, "GlobalDeleteAtom",SYSTEM.VAL(ADDRESS,GlobalDeleteAtom));
GetProcAddress(mod, "GlobalLock",SYSTEM.VAL(ADDRESS,GlobalLock));
GetProcAddress(mod, "GlobalReAlloc",SYSTEM.VAL(ADDRESS,GlobalReAlloc));
GetProcAddress(mod, "GlobalSize",SYSTEM.VAL(ADDRESS,GlobalSize));
GetProcAddress(mod, "GlobalUnlock",SYSTEM.VAL(ADDRESS,GlobalUnlock));
GetProcAddress(mod, "InitializeCriticalSection",SYSTEM.VAL(ADDRESS,InitializeCriticalSection));
GetProcAddress(mod, "InterlockedDecrement",SYSTEM.VAL(ADDRESS,InterlockedDecrement));
GetProcAddress(mod, "InterlockedIncrement",SYSTEM.VAL(ADDRESS,InterlockedIncrement));
GetProcAddress(mod, "IsDebuggerPresent",SYSTEM.VAL(ADDRESS,IsDebuggerPresent));
GetProcAddress(mod, "LeaveCriticalSection",SYSTEM.VAL(ADDRESS,LeaveCriticalSection));
GetProcAddress(mod, "LocalFileTimeToFileTime",SYSTEM.VAL(ADDRESS,LocalFileTimeToFileTime));
GetProcAddress(mod, "MoveFileExA",SYSTEM.VAL(ADDRESS,MoveFileEx));
GetProcAddress(mod, "OutputDebugStringA",SYSTEM.VAL(ADDRESS,outputDebugString));
GetProcAddress(mod, "PurgeComm",SYSTEM.VAL(ADDRESS,PurgeComm));
GetProcAddress(mod, "QueryDosDeviceA",SYSTEM.VAL(ADDRESS,QueryDosDevice));
GetProcAddress(mod, "QueryPerformanceCounter",SYSTEM.VAL(ADDRESS,QueryPerformanceCounter));
GetProcAddress(mod, "QueryPerformanceFrequency",SYSTEM.VAL(ADDRESS,QueryPerformanceFrequency));
GetProcAddress(mod, "QueryThreadCycleTime", SYSTEM.VAL(ADDRESS, QueryThreadCycleTime));
GetProcAddress(mod, "ReadFile",SYSTEM.VAL(ADDRESS,ReadFile));
GetProcAddress(mod, "ReadProcessMemory",SYSTEM.VAL(ADDRESS,ReadProcessMemory));
GetProcAddress(mod, "RemoveDirectoryA",SYSTEM.VAL(ADDRESS,RemoveDirectory));
GetProcAddress(mod, "ResetEvent",SYSTEM.VAL(ADDRESS,ResetEvent));
GetProcAddress(mod, "ResumeThread",SYSTEM.VAL(ADDRESS,ResumeThread));
GetProcAddress(mod, "SearchPathA",SYSTEM.VAL(ADDRESS,SearchPath));
GetProcAddress(mod, "SetCommBreak",SYSTEM.VAL(ADDRESS,SetCommBreak));
GetProcAddress(mod, "SetCommMask",SYSTEM.VAL(ADDRESS,SetCommMask));
GetProcAddress(mod, "SetCommState",SYSTEM.VAL(ADDRESS,SetCommState));
GetProcAddress(mod, "SetCommTimeouts",SYSTEM.VAL(ADDRESS,SetCommTimeouts));
GetProcAddress(mod, "SetConsoleCursorPosition",SYSTEM.VAL(ADDRESS,SetConsoleCursorPosition));
GetProcAddress(mod, "SetConsoleScreenBufferSize",SYSTEM.VAL(ADDRESS,SetConsoleScreenBufferSize));
GetProcAddress(mod, "SetConsoleTitleA",SYSTEM.VAL(ADDRESS,SetConsoleTitle));
GetProcAddress(mod, "SetConsoleWindowInfo",SYSTEM.VAL(ADDRESS,SetConsoleWindowInfo));
GetProcAddress(mod, "SetCurrentDirectoryA",SYSTEM.VAL(ADDRESS,SetCurrentDirectory));
GetProcAddress(mod, "SetEndOfFile",SYSTEM.VAL(ADDRESS,SetEndOfFile));
GetProcAddress(mod, "SetErrorMode",SYSTEM.VAL(ADDRESS,SetErrorMode));
GetProcAddress(mod, "SetEvent",SYSTEM.VAL(ADDRESS,SetEvent));
GetProcAddress(mod, "SetFileAttributesA",SYSTEM.VAL(ADDRESS,SetFileAttributes));
GetProcAddress(mod, "SetFilePointer",SYSTEM.VAL(ADDRESS,SetFilePointer));
GetProcAddress(mod, "SetFileTime",SYSTEM.VAL(ADDRESS,SetFileTime));
GetProcAddress(mod, "SetLocalTime",SYSTEM.VAL(ADDRESS,SetLocalTime));
GetProcAddress(mod, "SetThreadContext",SYSTEM.VAL(ADDRESS,SetThreadContext));
GetProcAddress(mod, "SetThreadPriority",SYSTEM.VAL(ADDRESS,SetThreadPriority));
GetProcAddress(mod, "SetupComm",SYSTEM.VAL(ADDRESS,SetupComm));
GetProcAddress(mod, "Sleep",SYSTEM.VAL(ADDRESS,Sleep));
GetProcAddress(mod, "SuspendThread",SYSTEM.VAL(ADDRESS,SuspendThread));
GetProcAddress(mod, "SystemTimeToFileTime",SYSTEM.VAL(ADDRESS,SystemTimeToFileTime));
GetProcAddress(mod, "TerminateThread",SYSTEM.VAL(ADDRESS,TerminateThread));
GetProcAddress(mod, "TlsAlloc",SYSTEM.VAL(ADDRESS,TlsAlloc));
GetProcAddress(mod, "TlsFree",SYSTEM.VAL(ADDRESS,TlsFree));
GetProcAddress(mod, "TlsGetValue",SYSTEM.VAL(ADDRESS,TlsGetValue));
GetProcAddress(mod, "TlsSetValue",SYSTEM.VAL(ADDRESS,TlsSetValue));
GetProcAddress(mod, "TryEnterCriticalSection", SYSTEM.VAL(ADDRESS, TryEnterCriticalSection));
GetProcAddress(mod, "VirtualAlloc",SYSTEM.VAL(ADDRESS,VirtualAlloc));
GetProcAddress(mod, "VirtualFree",SYSTEM.VAL(ADDRESS,VirtualFree));
GetProcAddress(mod, "WaitForSingleObject",SYSTEM.VAL(ADDRESS,WaitForSingleObject));
GetProcAddress(mod, "WriteFile",SYSTEM.VAL(ADDRESS,WriteFile));
GetProcAddress(mod, "GlobalMemoryStatusEx",SYSTEM.VAL(ADDRESS,GlobalMemoryStatusEx));
END Init;
BEGIN
Init;
IF IsDebuggerPresent()=True THEN
OutputString := OutputDebugString
ELSE
OutputString := NoOutputString
END;
END Kernel32.