123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- {%MainUnit ndk.pas}
- {
- Native Development Kit for Native NT
- This file is part of the Free Pascal run time library.
- This units contains some basic type definitions used by NT
- Copyright (c) 2010 by Sven Barth
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- type
- PVOID = Pointer;
- PPVOID = ^PVOID;
- HANDLE = THandle; // already defined in system unit
- PHANDLE = ^HANDLE;
- { Upper-Case Versions of Some Standard C Types }
- //CHAR = Char;
- SHORT = ShortInt;
- LONG = LongInt;
- //DOUBLE = Double;
- { Unsigned Types }
- UCHAR = Byte;
- PUCHAR = ^Byte;
- USHORT = Word;
- PUSHORT = ^Word;
- ULONG = LongWord;
- PULONG = PLongWord;
- PCUCHAR = ^UCHAR; { const }
- PCUSHORT = ^USHORT; { const }
- PCULONG = ^ULONG; { const }
- FCHAR = UCHAR;
- FSHORT = USHORT;
- FLONG = ULONG;
- { This type is originaly called BOOLEAN, but that might generate problems
- in SysUtils include files, so we prefix it with NT. Also it's originally
- defined as UCHAR, but ByteBool allows the use of True/False }
- NT_BOOLEAN = ByteBool;
- PNT_BOOLEAN = ^NT_BOOLEAN;
- LOGICAL = ULONG;
- PLOGICAL = ^ULONG;
- { Signed Types }
- PSHORT = ^SHORT;
- PLONG = ^LONG;
- NTSTATUS = LONG;
- PNTSTATUS = ^NTSTATUS;
- SCHAR = SmallInt;
- PSCHAR = ^SCHAR;
- { types from basetsd.h }
- ULONG_PTR = LongWord; // seems to really be a PtrUInt
- { Large Integer Unions }
- // using Int64 is an alternative (QWord might have unintended side effects)
- LARGE_INTEGER = packed record
- case Boolean of
- True:(u: record
- LowPart: LongWord;
- HighPart: LongInt;
- end);
- False:(QuadPart: Int64);
- end;
- PLARGE_INTEGER = ^LARGE_INTEGER;
- { Native API Return Value Macros }
- function NT_SUCCESS(Status: NTSTATUS): Boolean; inline; register;
- function NT_INFORMATION(Status: NTSTATUS): Boolean; inline; register;
- function NT_WARNING(Status: NTSTATUS): Boolean; inline; register;
- function NT_ERROR(Status: NTSTATUS): Boolean; inline; register;
- type
- { String Types }
- _UNICODE_STRING = packed record
- Length: Word; // used characters in buffer
- MaximumLength: Word; // maximum characters in buffer
- Buffer: PWideChar;
- end;
- UNICODE_STRING = _UNICODE_STRING;
- PUNICODE_STRING = ^UNICODE_STRING;
- // alias to differ from TUnicodeString
- TNtUnicodeString = UNICODE_STRING;
- PNtUnicodeString = ^TNtUnicodeString;
- { Object Attributes }
- POBJECT_ATTRIBUTES = ^OBJECT_ATTRIBUTES;
- _OBJECT_ATTRIBUTES = record
- Length: ULONG;
- RootDirectory: HANDLE;
- ObjectName: PUNICODE_STRING;
- Attributes: ULONG;
- SecurityDescriptor: PVOID; // PSECURITY_DESCRIPTOR
- SecurityQualityOfService: PVOID; // PSECURITY_QUALITY_OF_SERVICE
- end;
- OBJECT_ATTRIBUTES = _OBJECT_ATTRIBUTES;
- procedure InitializeObjectAttributes(var aObjectAttr: OBJECT_ATTRIBUTES;
- aName: PUNICODE_STRING; aAttributes: ULONG; aRootDir: HANDLE;
- aSecurity: Pointer {PSECURITY_DESCRIPTOR}); inline; register;
|