
{*******************************************************}
{                                                       }
{       Borland Delphi Run-time Library                 }
{       Win32 API Interface Unit                        }
{                                                       }
{       Copyright (c) 1996,98 Inprise Corporation       }
{                                                       }
{*******************************************************}

unit Windows;           

{$ALIGN ON}
{$MINENUMSIZE 4}
{$WEAKPACKAGEUNIT}

interface

(*$HPPEMIT '' *)
(*$HPPEMIT '// WINDOWS provides two definitions of BLOB: wtypes.h defines a' *)
(*$HPPEMIT '// BLOB as a tagBLOB struct whereas nspapi.h defines a BLOB as a _BLOB' *)
(*$HPPEMIT '// struct. Unfortunately, VCL does not use the portable BLOB type but' *)
(*$HPPEMIT '// rather relies on tagBLOB. So here we use a kludge to try to determine' *)
(*$HPPEMIT '// which flavour of BLOB we have (which is determined by the order of header' *)
(*$HPPEMIT '// inclusion by the compilation unit). If it is the _BLOB, we expose the' *)
(*$HPPEMIT '// tagBLOB type for VCL.' *)
(*$HPPEMIT '//' *)
(*$HPPEMIT '#if sizeof(_BLOB) == 8      // We know that BLOB is 8 bytes ' *)
(*$HPPEMIT 'typedef _BLOB tagBLOB;      // If unknown, _BLOB would be 4 ' *)
(*$HPPEMIT '#endif                      // tagBLOB Kludge' *)
(*$HPPEMIT '#if sizeof(tagBLOB) == 4    // tagBLOB has probably not been defined yet' *)
(*$HPPEMIT '#ifndef _tagBLOB_DEFINED' *)
(*$HPPEMIT '#define _tagBLOB_DEFINED' *)
(*$HPPEMIT '#define _BLOB_DEFINED' *)
(*$HPPEMIT '#define _LPBLOB_DEFINED' *)
(*$HPPEMIT 'typedef struct  tagBLOB' *)
(*$HPPEMIT '    {' *)
(*$HPPEMIT '    ULONG cbSize;' *)
(*$HPPEMIT '    /* [size_is] */ BYTE __RPC_FAR *pBlobData;' *)
(*$HPPEMIT '    }       BLOB;' *)
(*$HPPEMIT '' *)
(*$HPPEMIT 'typedef struct tagBLOB __RPC_FAR *LPBLOB;' *)
(*$HPPEMIT '#endif      //      _tagBLOB_DEFINED' *)
(*$HPPEMIT '#endif      //      sizeof(tagBLOB) == 4' *)
(*$HPPEMIT '' *)
(*$HPPEMIT '// Provide definition of DDE structures when LEAN_AND_MEAN is enabled' *)
(*$HPPEMIT '// to allow us to define new types relying on the DDE data structures' *)
(*$HPPEMIT '' *)
(*$HPPEMIT '#if defined(WIN32_LEAN_AND_MEAN)' *)
(*$HPPEMIT '' *)
(*$HPPEMIT 'typedef struct {' *)
(*$HPPEMIT '        unsigned short bAppReturnCode:8,' *)
(*$HPPEMIT '                 reserved:6,' *)
(*$HPPEMIT '                 fBusy:1,' *)
(*$HPPEMIT '             fAck:1;' *)
(*$HPPEMIT '} DDEACK;' *)
(*$HPPEMIT '' *)
(*$HPPEMIT 'typedef struct {' *)
(*$HPPEMIT '        unsigned short reserved:14,' *)
(*$HPPEMIT '                 fDeferUpd:1,' *)
(*$HPPEMIT '             fAckReq:1;' *)
(*$HPPEMIT '    short     cfFormat;' *)
(*$HPPEMIT '} DDEADVISE;' *)
(*$HPPEMIT '' *)
(*$HPPEMIT 'typedef struct {' *)
(*$HPPEMIT '    unsigned short unused:12,' *)
(*$HPPEMIT '                 fResponse:1,' *)
(*$HPPEMIT '                 fRelease:1,' *)
(*$HPPEMIT '                 reserved:1,' *)
(*$HPPEMIT '                 fAckReq:1;' *)
(*$HPPEMIT '    short    cfFormat;' *)
(*$HPPEMIT '    BYTE     Value[1];' *)
(*$HPPEMIT '} DDEDATA;' *)
(*$HPPEMIT '' *)
(*$HPPEMIT 'typedef struct {' *)
(*$HPPEMIT '    unsigned short unused:13, ' *)
(*$HPPEMIT '' *)
(*$HPPEMIT '             fRelease:1,' *)
(*$HPPEMIT '             fReserved:2;' *)
(*$HPPEMIT '    short    cfFormat;' *)
(*$HPPEMIT '    BYTE     Value[1];' *)
(*$HPPEMIT '' *)
(*$HPPEMIT '' *)
(*$HPPEMIT '} DDEPOKE;' *)
(*$HPPEMIT '' *)
(*$HPPEMIT '#endif      // WIN32_LEAN_AND_MEAN' *)
(*$HPPEMIT '' *)
(*$HPPEMIT 'typedef tagPOINT TPoint;'*)

type
{ Translated from WINDEF.H }

  {$EXTERNALSYM WCHAR}
  WCHAR = WideChar;
  PWChar = PWideChar;

  {$EXTERNALSYM LPSTR}
  LPSTR = PAnsiChar;
  PLPSTR = ^LPSTR;
  {$EXTERNALSYM LPCSTR}
  LPCSTR = PAnsiChar;
  {$EXTERNALSYM LPCTSTR}
  LPCTSTR = PAnsiChar; { should be PWideChar if UNICODE }
  {$EXTERNALSYM LPTSTR}
  LPTSTR = PAnsiChar; { should be PWideChar if UNICODE }
  {$EXTERNALSYM LPWSTR}
  LPWSTR = PWideChar;
  PLPWSTR = ^LPWSTR;
  {$EXTERNALSYM LPCWSTR}
  LPCWSTR = PWideChar;

  {$EXTERNALSYM DWORD}
  DWORD = LongWord;
  {$EXTERNALSYM BOOL}
  BOOL = LongBool;
  {$EXTERNALSYM PBOOL}
  PBOOL = ^BOOL;
  PByte = ^Byte;
  {$EXTERNALSYM PINT}
  PINT = ^Integer;
  PSingle = ^Single;
  {$EXTERNALSYM PWORD}
  PWORD = ^Word;
  {$EXTERNALSYM PDWORD}
  PDWORD = ^DWORD;
  {$EXTERNALSYM LPDWORD}
  LPDWORD = PDWORD;

  {$EXTERNALSYM UCHAR}
  UCHAR = Byte;
  {$EXTERNALSYM PUCHAR}
  PUCHAR = ^Byte;
  {$EXTERNALSYM SHORT}
  SHORT = Smallint;
  {$EXTERNALSYM UINT}
  UINT = LongWord;
  {$EXTERNALSYM PUINT}
  PUINT = ^UINT;
  {$EXTERNALSYM ULONG}
  ULONG = Cardinal;
  {$EXTERNALSYM PULONG}
  PULONG = ^ULONG;
  PLongint = ^Longint;
  PInteger = ^Integer;
  PLongWord = ^LongWord;
  PSmallInt = ^Smallint;
  PDouble = ^Double;
  PShortInt = ^ShortInt;

  {$EXTERNALSYM LCID}
  LCID = DWORD;
  {$EXTERNALSYM LANGID}
  LANGID = Word;

  THandle = LongWord;
  PHandle = ^THandle;

const
  {$EXTERNALSYM MAX_PATH}
  MAX_PATH = 260;


{ Translated from WINNT.H (only things needed for API calls) }

{line 190}
type
  {$EXTERNALSYM LONGLONG}
  LONGLONG = Int64;
  {$EXTERNALSYM PSID}
  PSID = Pointer;
  PLargeInteger = ^TLargeInteger;
  {$EXTERNALSYM _LARGE_INTEGER}
  _LARGE_INTEGER = record
    case Integer of
    0: (
      LowPart: DWORD;
      HighPart: Longint);
    1: (
      QuadPart: LONGLONG);
  end;
  TLargeInteger = Int64;
  {$EXTERNALSYM LARGE_INTEGER}
  LARGE_INTEGER = _LARGE_INTEGER;

  {$EXTERNALSYM ULARGE_INTEGER}
  ULARGE_INTEGER = record
    case Integer of
    0: (
      LowPart: DWORD;
      HighPart: DWORD);
    1: (
      QuadPart: LONGLONG);
  end;
  PULargeInteger = ^TULargeInteger;
  TULargeInteger = ULARGE_INTEGER;
  
{line 450}
  PListEntry = ^TListEntry;
  {$EXTERNALSYM _LIST_ENTRY}
  _LIST_ENTRY = record
    Flink: PListEntry;
    Blink: PListEntry;
  end;
  TListEntry = _LIST_ENTRY;
  {$EXTERNALSYM LIST_ENTRY}
  LIST_ENTRY = _LIST_ENTRY;

{line 490}
const
  {$EXTERNALSYM MINCHAR}
  MINCHAR = $80;
  {$EXTERNALSYM MAXCHAR}
  MAXCHAR = 127;
  {$EXTERNALSYM MINSHORT}
  MINSHORT = $8000;
  {$EXTERNALSYM MAXSHORT}
  MAXSHORT = 32767;
  {$EXTERNALSYM MINLONG}
  MINLONG = DWORD($80000000);
  {$EXTERNALSYM MAXLONG}
  MAXLONG = $7FFFFFFF;
  {$EXTERNALSYM MAXBYTE}
  MAXBYTE = 255;
  {$EXTERNALSYM MAXWORD}
  MAXWORD = 65535;
  {$EXTERNALSYM MAXDWORD}
  MAXDWORD = DWORD($FFFFFFFF);

{line 510}
(*
 *  Language IDs.
 *
 *  The following two combinations of primary language ID and
 *  sublanguage ID have special semantics:
 *
 *    Primary Language ID   Sublanguage ID      Result
 *    -------------------   ---------------     ------------------------
 *    LANG_NEUTRAL          SUBLANG_NEUTRAL     Language neutral
 *    LANG_NEUTRAL          SUBLANG_DEFAULT     User default language
 *    LANG_NEUTRAL          SUBLANG_SYS_DEFAULT System default language
 *)

const
{ Primary language IDs. }

  {$EXTERNALSYM LANG_NEUTRAL}
  LANG_NEUTRAL                         = $00;

  {$EXTERNALSYM LANG_AFRIKAANS}
  LANG_AFRIKAANS                       = $36;
  {$EXTERNALSYM LANG_ALBANIAN}
  LANG_ALBANIAN                        = $1c;
  {$EXTERNALSYM LANG_ARABIC}
  LANG_ARABIC                          = $01;
  {$EXTERNALSYM LANG_BASQUE}
  LANG_BASQUE                          = $2d;
  {$EXTERNALSYM LANG_BELARUSIAN}
  LANG_BELARUSIAN                      = $23;
  {$EXTERNALSYM LANG_BULGARIAN}
  LANG_BULGARIAN                       = $02;
  {$EXTERNALSYM LANG_CATALAN}
  LANG_CATALAN                         = $03;
  {$EXTERNALSYM LANG_CHINESE}
  LANG_CHINESE                         = $04;
  {$EXTERNALSYM LANG_CROATIAN}
  LANG_CROATIAN                        = $1a;
  {$EXTERNALSYM LANG_CZECH}
  LANG_CZECH                           = $05;
  {$EXTERNALSYM LANG_DANISH}
  LANG_DANISH                          = $06;
  {$EXTERNALSYM LANG_DUTCH}
  LANG_DUTCH                           = $13;
  {$EXTERNALSYM LANG_ENGLISH}
  LANG_ENGLISH                         = $09;
  {$EXTERNALSYM LANG_ESTONIAN}
  LANG_ESTONIAN                        = $25;
  {$EXTERNALSYM LANG_FAEROESE}
  LANG_FAEROESE                        = $38;
  {$EXTERNALSYM LANG_FARSI}
  LANG_FARSI                           = $29;
  {$EXTERNALSYM LANG_FINNISH}
  LANG_FINNISH                         = $0b;
  {$EXTERNALSYM LANG_FRENCH}
  LANG_FRENCH                          = $0c;
  {$EXTERNALSYM LANG_GERMAN}
  LANG_GERMAN                          = $07;
  {$EXTERNALSYM LANG_GREEK}
  LANG_GREEK                           = $08;
  {$EXTERNALSYM LANG_HEBREW}
  LANG_HEBREW                          = $0d;
  {$EXTERNALSYM LANG_HUNGARIAN}
  LANG_HUNGARIAN                       = $0e;
  {$EXTERNALSYM LANG_ICELANDIC}
  LANG_ICELANDIC                       = $0f;
  {$EXTERNALSYM LANG_INDONESIAN}
  LANG_INDONESIAN                      = $21;
  {$EXTERNALSYM LANG_ITALIAN}
  LANG_ITALIAN                         = $10;
  {$EXTERNALSYM LANG_JAPANESE}
  LANG_JAPANESE                        = $11;
  {$EXTERNALSYM LANG_KOREAN}
  LANG_KOREAN                          = $12;
  {$EXTERNALSYM LANG_LATVIAN}
  LANG_LATVIAN                         = $26;
  {$EXTERNALSYM LANG_LITHUANIAN}
  LANG_LITHUANIAN                      = $27;
  {$EXTERNALSYM LANG_NORWEGIAN}
  LANG_NORWEGIAN                       = $14;
  {$EXTERNALSYM LANG_POLISH}
  LANG_POLISH                          = $15;
  {$EXTERNALSYM LANG_PORTUGUESE}
  LANG_PORTUGUESE                      = $16;
  {$EXTERNALSYM LANG_ROMANIAN}
  LANG_ROMANIAN                        = $18;
  {$EXTERNALSYM LANG_RUSSIAN}
  LANG_RUSSIAN                         = $19;
  {$EXTERNALSYM LANG_SERBIAN}
  LANG_SERBIAN                         = $1a;
  {$EXTERNALSYM LANG_SLOVAK}
  LANG_SLOVAK                          = $1b;
  {$EXTERNALSYM LANG_SLOVENIAN}
  LANG_SLOVENIAN                       = $24;
  {$EXTERNALSYM LANG_SPANISH}
  LANG_SPANISH                         = $0a;
  {$EXTERNALSYM LANG_SWEDISH}
  LANG_SWEDISH                         = $1d;
  {$EXTERNALSYM LANG_THAI}
  LANG_THAI                            = $1e;
  {$EXTERNALSYM LANG_TURKISH}
  LANG_TURKISH                         = $1f;
  {$EXTERNALSYM LANG_UKRAINIAN}
  LANG_UKRAINIAN                       = $22;
  {$EXTERNALSYM LANG_VIETNAMESE}
  LANG_VIETNAMESE                      = $2a;


{ Sublanguage IDs. }

  { The name immediately following SUBLANG_ dictates which primary
    language ID that sublanguage ID can be combined with to form a
    valid language ID. }

  {$EXTERNALSYM SUBLANG_NEUTRAL}
  SUBLANG_NEUTRAL                      = $00;    { language neutral }
  {$EXTERNALSYM SUBLANG_DEFAULT}
  SUBLANG_DEFAULT                      = $01;    { user default }
  {$EXTERNALSYM SUBLANG_SYS_DEFAULT}
  SUBLANG_SYS_DEFAULT                  = $02;    { system default }

  {$EXTERNALSYM SUBLANG_ARABIC_SAUDI_ARABIA}
  SUBLANG_ARABIC_SAUDI_ARABIA          = $01;    { Arabic (Saudi Arabia) }
  {$EXTERNALSYM SUBLANG_ARABIC_IRAQ}
  SUBLANG_ARABIC_IRAQ                  = $02;    { Arabic (Iraq) }
  {$EXTERNALSYM SUBLANG_ARABIC_EGYPT}
  SUBLANG_ARABIC_EGYPT                 = $03;    { Arabic (Egypt) }
  {$EXTERNALSYM SUBLANG_ARABIC_LIBYA}
  SUBLANG_ARABIC_LIBYA                 = $04;    { Arabic (Libya) }
  {$EXTERNALSYM SUBLANG_ARABIC_ALGERIA}
  SUBLANG_ARABIC_ALGERIA               = $05;    { Arabic (Algeria) }
  {$EXTERNALSYM SUBLANG_ARABIC_MOROCCO}
  SUBLANG_ARABIC_MOROCCO               = $06;    { Arabic (Morocco) }
  {$EXTERNALSYM SUBLANG_ARABIC_TUNISIA}
  SUBLANG_ARABIC_TUNISIA               = $07;    { Arabic (Tunisia) }
  {$EXTERNALSYM SUBLANG_ARABIC_OMAN}
  SUBLANG_ARABIC_OMAN                  = $08;    { Arabic (Oman) }
  {$EXTERNALSYM SUBLANG_ARABIC_YEMEN}
  SUBLANG_ARABIC_YEMEN                 = $09;    { Arabic (Yemen) }
  {$EXTERNALSYM SUBLANG_ARABIC_SYRIA}
  SUBLANG_ARABIC_SYRIA                 = $0a;    { Arabic (Syria) }
  {$EXTERNALSYM SUBLANG_ARABIC_JORDAN}
  SUBLANG_ARABIC_JORDAN                = $0b;    { Arabic (Jordan) }
  {$EXTERNALSYM SUBLANG_ARABIC_LEBANON}
  SUBLANG_ARABIC_LEBANON               = $0c;    { Arabic (Lebanon) }
  {$EXTERNALSYM SUBLANG_ARABIC_KUWAIT}
  SUBLANG_ARABIC_KUWAIT                = $0d;    { Arabic (Kuwait) }
  {$EXTERNALSYM SUBLANG_ARABIC_UAE}
  SUBLANG_ARABIC_UAE                   = $0e;    { Arabic (U.A.E) }
  {$EXTERNALSYM SUBLANG_ARABIC_BAHRAIN}
  SUBLANG_ARABIC_BAHRAIN               = $0f;    { Arabic (Bahrain) }
  {$EXTERNALSYM SUBLANG_ARABIC_QATAR}
  SUBLANG_ARABIC_QATAR                 = $10;    { Arabic (Qatar) }
  {$EXTERNALSYM SUBLANG_CHINESE_TRADITIONAL}
  SUBLANG_CHINESE_TRADITIONAL          = $01;    { Chinese (Taiwan) }
  {$EXTERNALSYM SUBLANG_CHINESE_SIMPLIFIED}
  SUBLANG_CHINESE_SIMPLIFIED           = $02;    { Chinese (PR China) }
  {$EXTERNALSYM SUBLANG_CHINESE_HONGKONG}
  SUBLANG_CHINESE_HONGKONG             = $03;    { Chinese (Hong Kong) }
  {$EXTERNALSYM SUBLANG_CHINESE_SINGAPORE}
  SUBLANG_CHINESE_SINGAPORE            = $04;    { Chinese (Singapore) }
  {$EXTERNALSYM SUBLANG_DUTCH}
  SUBLANG_DUTCH                        = $01;    { Dutch }
  {$EXTERNALSYM SUBLANG_DUTCH_BELGIAN}
  SUBLANG_DUTCH_BELGIAN                = $02;    { Dutch (Belgian) }
  {$EXTERNALSYM SUBLANG_ENGLISH_US}
  SUBLANG_ENGLISH_US                   = $01;    { English (USA) }
  {$EXTERNALSYM SUBLANG_ENGLISH_UK}
  SUBLANG_ENGLISH_UK                   = $02;    { English (UK) }
  {$EXTERNALSYM SUBLANG_ENGLISH_AUS}
  SUBLANG_ENGLISH_AUS                  = $03;    { English (Australian) }
  {$EXTERNALSYM SUBLANG_ENGLISH_CAN}
  SUBLANG_ENGLISH_CAN                  = $04;    { English (Canadian) }
  {$EXTERNALSYM SUBLANG_ENGLISH_NZ}
  SUBLANG_ENGLISH_NZ                   = $05;    { English (New Zealand) }
  {$EXTERNALSYM SUBLANG_ENGLISH_EIRE}
  SUBLANG_ENGLISH_EIRE                 = $06;    { English (Irish) }
  {$EXTERNALSYM SUBLANG_ENGLISH_SOUTH_AFRICA}
  SUBLANG_ENGLISH_SOUTH_AFRICA         = $07;    { English (South Africa) }
  {$EXTERNALSYM SUBLANG_ENGLISH_JAMAICA}
  SUBLANG_ENGLISH_JAMAICA              = $08;    { English (Jamaica) }
  {$EXTERNALSYM SUBLANG_ENGLISH_CARIBBEAN}
  SUBLANG_ENGLISH_CARIBBEAN            = $09;    { English (Caribbean) }
  {$EXTERNALSYM SUBLANG_ENGLISH_BELIZE}
  SUBLANG_ENGLISH_BELIZE               = $0a;    { English (Belize) }
  {$EXTERNALSYM SUBLANG_ENGLISH_TRINIDAD}
  SUBLANG_ENGLISH_TRINIDAD             = $0b;    { English (Trinidad) }
  {$EXTERNALSYM SUBLANG_FRENCH}
  SUBLANG_FRENCH                       = $01;    { French }
  {$EXTERNALSYM SUBLANG_FRENCH_BELGIAN}
  SUBLANG_FRENCH_BELGIAN               = $02;    { French (Belgian) }
  {$EXTERNALSYM SUBLANG_FRENCH_CANADIAN}
  SUBLANG_FRENCH_CANADIAN              = $03;    { French (Canadian) }
  {$EXTERNALSYM SUBLANG_FRENCH_SWISS}
  SUBLANG_FRENCH_SWISS                 = $04;    { French (Swiss) }
  {$EXTERNALSYM SUBLANG_FRENCH_LUXEMBOURG}
  SUBLANG_FRENCH_LUXEMBOURG            = $05;    { French (Luxembourg) }
  {$EXTERNALSYM SUBLANG_GERMAN}
  SUBLANG_GERMAN                       = $01;    { German }
  {$EXTERNALSYM SUBLANG_GERMAN_SWISS}
  SUBLANG_GERMAN_SWISS                 = $02;    { German (Swiss) }
  {$EXTERNALSYM SUBLANG_GERMAN_AUSTRIAN}
  SUBLANG_GERMAN_AUSTRIAN              = $03;    { German (Austrian) }
  {$EXTERNALSYM SUBLANG_GERMAN_LUXEMBOURG}
  SUBLANG_GERMAN_LUXEMBOURG            = $04;    { German (Luxembourg) }
  {$EXTERNALSYM SUBLANG_GERMAN_LIECHTENSTEIN}
  SUBLANG_GERMAN_LIECHTENSTEIN         = $05;    { German (Liechtenstein) }
  {$EXTERNALSYM SUBLANG_ITALIAN}
  SUBLANG_ITALIAN                      = $01;    { Italian }
  {$EXTERNALSYM SUBLANG_ITALIAN_SWISS}
  SUBLANG_ITALIAN_SWISS                = $02;    { Italian (Swiss) }
  {$EXTERNALSYM SUBLANG_KOREAN}
  SUBLANG_KOREAN                       = $01;    { Korean (Extended Wansung) }
  {$EXTERNALSYM SUBLANG_KOREAN_JOHAB}
  SUBLANG_KOREAN_JOHAB                 = $02;    { Korean (Johab) }
  {$EXTERNALSYM SUBLANG_NORWEGIAN_BOKMAL}
  SUBLANG_NORWEGIAN_BOKMAL             = $01;    { Norwegian (Bokmal) }
  {$EXTERNALSYM SUBLANG_NORWEGIAN_NYNORSK}
  SUBLANG_NORWEGIAN_NYNORSK            = $02;    { Norwegian (Nynorsk) }
  {$EXTERNALSYM SUBLANG_PORTUGUESE}
  SUBLANG_PORTUGUESE                   = $02;    { Portuguese }
  {$EXTERNALSYM SUBLANG_PORTUGUESE_BRAZILIAN}
  SUBLANG_PORTUGUESE_BRAZILIAN         = $01;    { Portuguese (Brazilian) }
  {$EXTERNALSYM SUBLANG_SERBIAN_LATIN}
  SUBLANG_SERBIAN_LATIN                = $02;    { Serbian (Latin) }
  {$EXTERNALSYM SUBLANG_SERBIAN_CYRILLIC}
  SUBLANG_SERBIAN_CYRILLIC             = $03;    { Serbian (Cyrillic) }
  {$EXTERNALSYM SUBLANG_SPANISH}
  SUBLANG_SPANISH                      = $01;    { Spanish (Castilian) }
  {$EXTERNALSYM SUBLANG_SPANISH_MEXICAN}
  SUBLANG_SPANISH_MEXICAN              = $02;    { Spanish (Mexican) }
  {$EXTERNALSYM SUBLANG_SPANISH_MODERN}
  SUBLANG_SPANISH_MODERN               = $03;    { Spanish (Modern) }
  {$EXTERNALSYM SUBLANG_SPANISH_GUATEMALA}
  SUBLANG_SPANISH_GUATEMALA            = $04;    { Spanish (Guatemala) }
  {$EXTERNALSYM SUBLANG_SPANISH_COSTA_RICA}
  SUBLANG_SPANISH_COSTA_RICA           = $05;    { Spanish (Costa Rica) }
  {$EXTERNALSYM SUBLANG_SPANISH_PANAMA}
  SUBLANG_SPANISH_PANAMA               = $06;    { Spanish (Panama) }
  {$EXTERNALSYM SUBLANG_SPANISH_DOMINICAN_REPUBLIC}
  SUBLANG_SPANISH_DOMINICAN_REPUBLIC     = $07;  { Spanish (Dominican Republic) }
  {$EXTERNALSYM SUBLANG_SPANISH_VENEZUELA}
  SUBLANG_SPANISH_VENEZUELA            = $08;    { Spanish (Venezuela) }
  {$EXTERNALSYM SUBLANG_SPANISH_COLOMBIA}
  SUBLANG_SPANISH_COLOMBIA             = $09;    { Spanish (Colombia) }
  {$EXTERNALSYM SUBLANG_SPANISH_PERU}
  SUBLANG_SPANISH_PERU                 = $0a;    { Spanish (Peru) }
  {$EXTERNALSYM SUBLANG_SPANISH_ARGENTINA}
  SUBLANG_SPANISH_ARGENTINA            = $0b;    { Spanish (Argentina) }
  {$EXTERNALSYM SUBLANG_SPANISH_ECUADOR}
  SUBLANG_SPANISH_ECUADOR              = $0c;    { Spanish (Ecuador) }
  {$EXTERNALSYM SUBLANG_SPANISH_CHILE}
  SUBLANG_SPANISH_CHILE                = $0d;    { Spanish (Chile) }
  {$EXTERNALSYM SUBLANG_SPANISH_URUGUAY}
  SUBLANG_SPANISH_URUGUAY              = $0e;    { Spanish (Uruguay) }
  {$EXTERNALSYM SUBLANG_SPANISH_PARAGUAY}
  SUBLANG_SPANISH_PARAGUAY             = $0f;    { Spanish (Paraguay) }
  {$EXTERNALSYM SUBLANG_SPANISH_BOLIVIA}
  SUBLANG_SPANISH_BOLIVIA              = $10;    { Spanish (Bolivia) }
  {$EXTERNALSYM SUBLANG_SPANISH_EL_SALVADOR}
  SUBLANG_SPANISH_EL_SALVADOR          = $11;    { Spanish (El Salvador) }
  {$EXTERNALSYM SUBLANG_SPANISH_HONDURAS}
  SUBLANG_SPANISH_HONDURAS             = $12;    { Spanish (Honduras) }
  {$EXTERNALSYM SUBLANG_SPANISH_NICARAGUA}
  SUBLANG_SPANISH_NICARAGUA            = $13;    { Spanish (Nicaragua) }
  {$EXTERNALSYM SUBLANG_SPANISH_PUERTO_RICO}
  SUBLANG_SPANISH_PUERTO_RICO          = $14;    { Spanish (Puerto Rico) }
  {$EXTERNALSYM SUBLANG_SWEDISH}
  SUBLANG_SWEDISH                      = $01;    { Swedish }
  {$EXTERNALSYM SUBLANG_SWEDISH_FINLAND}
  SUBLANG_SWEDISH_FINLAND              = $02;    { Swedish (Finland) }


{ Sorting IDs. }

  {$EXTERNALSYM SORT_DEFAULT}
  SORT_DEFAULT                         = $0;     { sorting default }

  {$EXTERNALSYM SORT_JAPANESE_XJIS}
  SORT_JAPANESE_XJIS                   = $0;     { Japanese XJIS order }
  {$EXTERNALSYM SORT_JAPANESE_UNICODE}
  SORT_JAPANESE_UNICODE                = $1;     { Japanese Unicode order }

  {$EXTERNALSYM SORT_CHINESE_BIG5}
  SORT_CHINESE_BIG5                    = $0;     { Chinese BIG5 order }
  {$EXTERNALSYM SORT_CHINESE_PRCP}
  SORT_CHINESE_PRCP                    = $0;     { PRC Chinese Phonetic order }
  {$EXTERNALSYM SORT_CHINESE_UNICODE}
  SORT_CHINESE_UNICODE                 = $1;     { Chinese Unicode order }
  {$EXTERNALSYM SORT_CHINESE_PRC}
  SORT_CHINESE_PRC                     = $2;     { PRC Chinese Stroke Count order }

  {$EXTERNALSYM SORT_KOREAN_KSC}
  SORT_KOREAN_KSC                      = $0;     { Korean KSC order }
  {$EXTERNALSYM SORT_KOREAN_UNICODE}
  SORT_KOREAN_UNICODE                  = $1;     { Korean Unicode order }

  {$EXTERNALSYM SORT_GERMAN_PHONE_BOOK}
  SORT_GERMAN_PHONE_BOOK               = $1;     { German Phone Book order }


(*
 *  A language ID is a 16 bit value which is the combination of a
 *  primary language ID and a secondary language ID.  The bits are
 *  allocated as follows:
 *
 *       +-----------------------+-------------------------+
 *       |     Sublanguage ID    |   Primary Language ID   |
 *       +-----------------------+-------------------------+
 *        15                   10 9                       0   bit
 *
 *
 *
 *  A locale ID is a 32 bit value which is the combination of a
 *  language ID, a sort ID, and a reserved area.  The bits are
 *  allocated as follows:
 *
 *       +-------------+---------+-------------------------+
 *       |   Reserved  | Sort ID |      Language ID        |
 *       +-------------+---------+-------------------------+
 *        31         20 19     16 15                      0   bit
 *
 *)

{ Default System and User IDs for language and locale. }

  {$EXTERNALSYM LANG_SYSTEM_DEFAULT}
  LANG_SYSTEM_DEFAULT   = (SUBLANG_SYS_DEFAULT shl 10) or LANG_NEUTRAL;
  {$EXTERNALSYM LANG_USER_DEFAULT}
  LANG_USER_DEFAULT     = (SUBLANG_DEFAULT shl 10) or LANG_NEUTRAL;

  {$EXTERNALSYM LOCALE_SYSTEM_DEFAULT}
  LOCALE_SYSTEM_DEFAULT = (SORT_DEFAULT shl 16) or LANG_SYSTEM_DEFAULT;
  {$EXTERNALSYM LOCALE_USER_DEFAULT}
  LOCALE_USER_DEFAULT   = (SORT_DEFAULT shl 16) or LANG_USER_DEFAULT;


{line 724}
  {$EXTERNALSYM STATUS_WAIT_0}
  STATUS_WAIT_0                   = $00000000;
  {$EXTERNALSYM STATUS_ABANDONED_WAIT_0}
  STATUS_ABANDONED_WAIT_0         = $00000080;
  {$EXTERNALSYM STATUS_USER_APC}
  STATUS_USER_APC                 = $000000C0;
  {$EXTERNALSYM STATUS_TIMEOUT}
  STATUS_TIMEOUT                  = $00000102;
  {$EXTERNALSYM STATUS_PENDING}
  STATUS_PENDING                  = $00000103;
  {$EXTERNALSYM STATUS_SEGMENT_NOTIFICATION}
  STATUS_SEGMENT_NOTIFICATION     = $40000005;
  {$EXTERNALSYM STATUS_GUARD_PAGE_VIOLATION}
  STATUS_GUARD_PAGE_VIOLATION     = DWORD($80000001);
  {$EXTERNALSYM STATUS_DATATYPE_MISALIGNMENT}
  STATUS_DATATYPE_MISALIGNMENT    = DWORD($80000002);
  {$EXTERNALSYM STATUS_BREAKPOINT}
  STATUS_BREAKPOINT               = DWORD($80000003);
  {$EXTERNALSYM STATUS_SINGLE_STEP}
  STATUS_SINGLE_STEP              = DWORD($80000004);
  {$EXTERNALSYM STATUS_ACCESS_VIOLATION}
  STATUS_ACCESS_VIOLATION         = DWORD($C0000005);
  {$EXTERNALSYM STATUS_IN_PAGE_ERROR}
  STATUS_IN_PAGE_ERROR            = DWORD($C0000006);
  {$EXTERNALSYM STATUS_INVALID_HANDLE}
  STATUS_INVALID_HANDLE           = DWORD($C0000008);
  {$EXTERNALSYM STATUS_NO_MEMORY}
  STATUS_NO_MEMORY                = DWORD($C0000017);
  {$EXTERNALSYM STATUS_ILLEGAL_INSTRUCTION}
  STATUS_ILLEGAL_INSTRUCTION      = DWORD($C000001D);
  {$EXTERNALSYM STATUS_NONCONTINUABLE_EXCEPTION}
  STATUS_NONCONTINUABLE_EXCEPTION = DWORD($C0000025);
  {$EXTERNALSYM STATUS_INVALID_DISPOSITION}
  STATUS_INVALID_DISPOSITION      = DWORD($C0000026);
  {$EXTERNALSYM STATUS_ARRAY_BOUNDS_EXCEEDED}
  STATUS_ARRAY_BOUNDS_EXCEEDED    = DWORD($C000008C);
  {$EXTERNALSYM STATUS_FLOAT_DENORMAL_OPERAND}
  STATUS_FLOAT_DENORMAL_OPERAND   = DWORD($C000008D);
  {$EXTERNALSYM STATUS_FLOAT_DIVIDE_BY_ZERO}
  STATUS_FLOAT_DIVIDE_BY_ZERO     = DWORD($C000008E);
  {$EXTERNALSYM STATUS_FLOAT_INEXACT_RESULT}
  STATUS_FLOAT_INEXACT_RESULT     = DWORD($C000008F);
  {$EXTERNALSYM STATUS_FLOAT_INVALID_OPERATION}
  STATUS_FLOAT_INVALID_OPERATION  = DWORD($C0000090);
  {$EXTERNALSYM STATUS_FLOAT_OVERFLOW}
  STATUS_FLOAT_OVERFLOW           = DWORD($C0000091);
  {$EXTERNALSYM STATUS_FLOAT_STACK_CHECK}
  STATUS_FLOAT_STACK_CHECK        = DWORD($C0000092);
  {$EXTERNALSYM STATUS_FLOAT_UNDERFLOW}
  STATUS_FLOAT_UNDERFLOW          = DWORD($C0000093);
  {$EXTERNALSYM STATUS_INTEGER_DIVIDE_BY_ZERO}
  STATUS_INTEGER_DIVIDE_BY_ZERO   = DWORD($C0000094);
  {$EXTERNALSYM STATUS_INTEGER_OVERFLOW}
  STATUS_INTEGER_OVERFLOW         = DWORD($C0000095);
  {$EXTERNALSYM STATUS_PRIVILEGED_INSTRUCTION}
  STATUS_PRIVILEGED_INSTRUCTION   = DWORD($C0000096);
  {$EXTERNALSYM STATUS_STACK_OVERFLOW}
  STATUS_STACK_OVERFLOW           = DWORD($C00000FD);
  {$EXTERNALSYM STATUS_CONTROL_C_EXIT}
  STATUS_CONTROL_C_EXIT           = DWORD($C000013A);

  {$EXTERNALSYM MAXIMUM_WAIT_OBJECTS}
  MAXIMUM_WAIT_OBJECTS = 64;

{line 1280}
  {$EXTERNALSYM SIZE_OF_80387_REGISTERS}
  SIZE_OF_80387_REGISTERS = 80;

  { The following flags control the contents of the CONTEXT structure. }

  {$EXTERNALSYM CONTEXT_i386}
  CONTEXT_i386 = $10000;     { this assumes that i386 and }
  {$EXTERNALSYM CONTEXT_i486}
  CONTEXT_i486 = $10000;     { i486 have identical context records }

  {$EXTERNALSYM CONTEXT_CONTROL}
  CONTEXT_CONTROL         = (CONTEXT_i386 or $00000001); { SS:SP, CS:IP, FLAGS, BP }
  {$EXTERNALSYM CONTEXT_INTEGER}
  CONTEXT_INTEGER         = (CONTEXT_i386 or $00000002); { AX, BX, CX, DX, SI, DI }
  {$EXTERNALSYM CONTEXT_SEGMENTS}
  CONTEXT_SEGMENTS        = (CONTEXT_i386 or $00000004); { DS, ES, FS, GS }
  {$EXTERNALSYM CONTEXT_FLOATING_POINT}
  CONTEXT_FLOATING_POINT  = (CONTEXT_i386 or $00000008); { 387 state }
  {$EXTERNALSYM CONTEXT_DEBUG_REGISTERS}
  CONTEXT_DEBUG_REGISTERS = (CONTEXT_i386 or $00000010); { DB 0-3,6,7 }
  {$EXTERNALSYM CONTEXT_FULL}
  CONTEXT_FULL = (CONTEXT_CONTROL or CONTEXT_INTEGER or CONTEXT_SEGMENTS);

type
  PFloatingSaveArea = ^TFloatingSaveArea;
  {$EXTERNALSYM _FLOATING_SAVE_AREA}
  _FLOATING_SAVE_AREA = record
    ControlWord: DWORD;
    StatusWord: DWORD;
    TagWord: DWORD;
    ErrorOffset: DWORD;
    ErrorSelector: DWORD;
    DataOffset: DWORD;
    DataSelector: DWORD;
    RegisterArea: array[0..SIZE_OF_80387_REGISTERS - 1] of Byte;
    Cr0NpxState: DWORD;
  end;
  TFloatingSaveArea = _FLOATING_SAVE_AREA;
  {$EXTERNALSYM FLOATING_SAVE_AREA}
  FLOATING_SAVE_AREA = _FLOATING_SAVE_AREA;

{ This frame has a several purposes: 1) it is used as an argument to
  NtContinue, 2) is is used to constuct a call frame for APC delivery,
  and 3) it is used in the user level thread creation routines.
  The layout of the record conforms to a standard call frame. }

  PContext = ^TContext;
  {$EXTERNALSYM _CONTEXT}
  _CONTEXT = record

  { The flags values within this flag control the contents of
    a CONTEXT record.

    If the context record is used as an input parameter, then
    for each portion of the context record controlled by a flag
    whose value is set, it is assumed that that portion of the
    context record contains valid context. If the context record
    is being used to modify a threads context, then only that
    portion of the threads context will be modified.

    If the context record is used as an IN OUT parameter to capture
    the context of a thread, then only those portions of the thread's
    context corresponding to set flags will be returned.

    The context record is never used as an OUT only parameter. }

    ContextFlags: DWORD;

  { This section is specified/returned if CONTEXT_DEBUG_REGISTERS is
    set in ContextFlags.  Note that CONTEXT_DEBUG_REGISTERS is NOT
    included in CONTEXT_FULL. }

    Dr0: DWORD;
    Dr1: DWORD;
    Dr2: DWORD;
    Dr3: DWORD;
    Dr6: DWORD;
    Dr7: DWORD;

  { This section is specified/returned if the
    ContextFlags word contians the flag CONTEXT_FLOATING_POINT. }

    FloatSave: TFloatingSaveArea;

  { This section is specified/returned if the
    ContextFlags word contians the flag CONTEXT_SEGMENTS. }

    SegGs: DWORD;
    SegFs: DWORD;
    SegEs: DWORD;
    SegDs: DWORD;

  { This section is specified/returned if the
    ContextFlags word contians the flag CONTEXT_INTEGER. }

    Edi: DWORD;
    Esi: DWORD;
    Ebx: DWORD;
    Edx: DWORD;
    Ecx: DWORD;
    Eax: DWORD;

  { This section is specified/returned if the
    ContextFlags word contians the flag CONTEXT_CONTROL. }

    Ebp: DWORD;
    Eip: DWORD;
    SegCs: DWORD;
    EFlags: DWORD;
    Esp: DWORD;
    SegSs: DWORD;
  end;
  TContext = _CONTEXT;
  {$EXTERNALSYM CONTEXT}
  CONTEXT = _CONTEXT;

const
  { bitfield constants for Flags field of TLDTEntry }

  LDTF_BASEMID      = DWORD($FF000000);  {8}
  LDTF_TYPE_8       = $00F80000;  {5}
  LDTF_DPL          = $00060000;  {2}
  LDTF_PRES         = $00010000;  {1}
  LDTF_LIMITHI      = $0000F000;  {4}
  LDTF_SYS          = $00000800;  {1}
  LDTF_RESERVED_0   = $00000400;  {1}
  LDTF_DEFAULT_BIG  = $00000200;  {1}
  LDTF_GRANULARITY  = $00000100;  {1}
  LDTF_BASEHI       = $000000FF;  {8}


type
  PLDTEntry = ^TLDTEntry;
  {$EXTERNALSYM _LDT_ENTRY}
  _LDT_ENTRY = record
    LimitLow: Word;
    BaseLow: Word;
    case Integer of
      0: (
        BaseMid: Byte;
        Flags1: Byte;
        Flags2: Byte;
        BaseHi: Byte);
      1: (
        Flags: Longint);
  end;
  TLDTEntry = _LDT_ENTRY;
  {$EXTERNALSYM LDT_ENTRY}
  LDT_ENTRY = _LDT_ENTRY;

{line 2030}
const
  {$EXTERNALSYM EXCEPTION_NONCONTINUABLE}
  EXCEPTION_NONCONTINUABLE     = 1;    { Noncontinuable exception }
  {$EXTERNALSYM EXCEPTION_MAXIMUM_PARAMETERS}
  EXCEPTION_MAXIMUM_PARAMETERS = 15;   { maximum number of exception parameters }

type
  PExceptionRecord = ^TExceptionRecord;
  {$EXTERNALSYM _EXCEPTION_RECORD}
  _EXCEPTION_RECORD = record
    ExceptionCode: DWORD;
    ExceptionFlags: DWORD;
    ExceptionRecord: PExceptionRecord;
    ExceptionAddress: Pointer;
    NumberParameters: DWORD;
    ExceptionInformation: array[0..EXCEPTION_MAXIMUM_PARAMETERS - 1] of DWORD;
  end;
  TExceptionRecord = _EXCEPTION_RECORD;
  {$EXTERNALSYM EXCEPTION_RECORD}
  EXCEPTION_RECORD = _EXCEPTION_RECORD;

{ Typedef for pointer returned by exception_info() }

  {$EXTERNALSYM _EXCEPTION_POINTERS}
  _EXCEPTION_POINTERS = record
    ExceptionRecord : PExceptionRecord;
    ContextRecord : PContext;
  end;
  TExceptionPointers = _EXCEPTION_POINTERS;
  {$EXTERNALSYM EXCEPTION_POINTERS}
  EXCEPTION_POINTERS = _EXCEPTION_POINTERS;

{line 2100}
const
  {$EXTERNALSYM THREAD_BASE_PRIORITY_LOWRT}
  THREAD_BASE_PRIORITY_LOWRT = 15;  { value that gets a thread to LowRealtime-1 }
  {$EXTERNALSYM THREAD_BASE_PRIORITY_MAX}
  THREAD_BASE_PRIORITY_MAX = 2;     { maximum thread base priority boost }
  {$EXTERNALSYM THREAD_BASE_PRIORITY_MIN}
  THREAD_BASE_PRIORITY_MIN = -2;    { minimum thread base priority boost }
  {$EXTERNALSYM THREAD_BASE_PRIORITY_IDLE}
  THREAD_BASE_PRIORITY_IDLE = -15;  { value that gets a thread to idle }

  {$EXTERNALSYM SYNCHRONIZE}
  SYNCHRONIZE = $00100000;
  {$EXTERNALSYM STANDARD_RIGHTS_REQUIRED}
  STANDARD_RIGHTS_REQUIRED = $000F0000;
  {$EXTERNALSYM EVENT_MODIFY_STATE}
  EVENT_MODIFY_STATE = $0002;
  {$EXTERNALSYM EVENT_ALL_ACCESS}
  EVENT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or $3);
  {$EXTERNALSYM MUTANT_QUERY_STATE}
  MUTANT_QUERY_STATE = $0001;
  {$EXTERNALSYM MUTANT_ALL_ACCESS}
  MUTANT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or
    MUTANT_QUERY_STATE);

  {$EXTERNALSYM PROCESS_TERMINATE}
  PROCESS_TERMINATE         = $0001;
  {$EXTERNALSYM PROCESS_CREATE_THREAD}
  PROCESS_CREATE_THREAD     = $0002;
  {$EXTERNALSYM PROCESS_VM_OPERATION}
  PROCESS_VM_OPERATION      = $0008;
  {$EXTERNALSYM PROCESS_VM_READ}
  PROCESS_VM_READ           = $0010;
  {$EXTERNALSYM PROCESS_VM_WRITE}
  PROCESS_VM_WRITE          = $0020;
  {$EXTERNALSYM PROCESS_DUP_HANDLE}
  PROCESS_DUP_HANDLE        = $0040;
  {$EXTERNALSYM PROCESS_CREATE_PROCESS}
  PROCESS_CREATE_PROCESS    = $0080;
  {$EXTERNALSYM PROCESS_SET_QUOTA}
  PROCESS_SET_QUOTA         = $0100;
  {$EXTERNALSYM PROCESS_SET_INFORMATION}
  PROCESS_SET_INFORMATION   = $0200;
  {$EXTERNALSYM PROCESS_QUERY_INFORMATION}
  PROCESS_QUERY_INFORMATION = $0400;
  {$EXTERNALSYM PROCESS_ALL_ACCESS}
  PROCESS_ALL_ACCESS        = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or $FFF);

{line 2150}
type
  PMemoryBasicInformation = ^TMemoryBasicInformation;
  {$EXTERNALSYM _MEMORY_BASIC_INFORMATION}
  _MEMORY_BASIC_INFORMATION = record
    BaseAddress : Pointer;
    AllocationBase : Pointer;
    AllocationProtect : DWORD;
    RegionSize : DWORD;
    State : DWORD;
    Protect : DWORD;
    Type_9 : DWORD;
  end;
  TMemoryBasicInformation = _MEMORY_BASIC_INFORMATION;
  {$EXTERNALSYM MEMORY_BASIC_INFORMATION}
  MEMORY_BASIC_INFORMATION = _MEMORY_BASIC_INFORMATION;

const
  {$EXTERNALSYM SECTION_QUERY}
  SECTION_QUERY = 1;
  {$EXTERNALSYM SECTION_MAP_WRITE}
  SECTION_MAP_WRITE = 2;
  {$EXTERNALSYM SECTION_MAP_READ}
  SECTION_MAP_READ = 4;
  {$EXTERNALSYM SECTION_MAP_EXECUTE}
  SECTION_MAP_EXECUTE = 8;
  {$EXTERNALSYM SECTION_EXTEND_SIZE}
  SECTION_EXTEND_SIZE = $10;
  {$EXTERNALSYM SECTION_ALL_ACCESS}
  SECTION_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or
    SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE);

  {$EXTERNALSYM PAGE_NOACCESS}
  PAGE_NOACCESS = 1;
  {$EXTERNALSYM PAGE_READONLY}
  PAGE_READONLY = 2;
  {$EXTERNALSYM PAGE_READWRITE}
  PAGE_READWRITE = 4;
  {$EXTERNALSYM PAGE_WRITECOPY}
  PAGE_WRITECOPY = 8;
  {$EXTERNALSYM PAGE_EXECUTE}
  PAGE_EXECUTE = $10;
  {$EXTERNALSYM PAGE_EXECUTE_READ}
  PAGE_EXECUTE_READ = $20;
  {$EXTERNALSYM PAGE_EXECUTE_READWRITE}
  PAGE_EXECUTE_READWRITE = $40;
  {$EXTERNALSYM PAGE_EXECUTE_WRITECOPY}
  PAGE_EXECUTE_WRITECOPY = $80;
  {$EXTERNALSYM PAGE_GUARD}
  PAGE_GUARD = $100;
  {$EXTERNALSYM PAGE_NOCACHE}
  PAGE_NOCACHE = $200;
  {$EXTERNALSYM MEM_COMMIT}
  MEM_COMMIT = $1000;
  {$EXTERNALSYM MEM_RESERVE}
  MEM_RESERVE = $2000;
  {$EXTERNALSYM MEM_DECOMMIT}
  MEM_DECOMMIT = $4000;
  {$EXTERNALSYM MEM_RELEASE}
  MEM_RELEASE = $8000;
  {$EXTERNALSYM MEM_FREE}
  MEM_FREE = $10000;
  {$EXTERNALSYM MEM_PRIVATE}
  MEM_PRIVATE = $20000;
  {$EXTERNALSYM MEM_MAPPED}
  MEM_MAPPED = $40000;
  {$EXTERNALSYM MEM_RESET}
  MEM_RESET = $80000;
  {$EXTERNALSYM MEM_TOP_DOWN}
  MEM_TOP_DOWN = $100000;
  {$EXTERNALSYM SEC_FILE}
  SEC_FILE = $800000;
  {$EXTERNALSYM SEC_IMAGE}
  SEC_IMAGE = $1000000;
  {$EXTERNALSYM SEC_RESERVE}
  SEC_RESERVE = $4000000;
  {$EXTERNALSYM SEC_COMMIT}
  SEC_COMMIT = $8000000;
  {$EXTERNALSYM SEC_NOCACHE}
  SEC_NOCACHE = $10000000;
  {$EXTERNALSYM MEM_IMAGE}
  MEM_IMAGE = SEC_IMAGE;


{line 2250}
  {$EXTERNALSYM FILE_SHARE_READ}
  FILE_SHARE_READ                     = $00000001;
  {$EXTERNALSYM FILE_SHARE_WRITE}
  FILE_SHARE_WRITE                    = $00000002;
  {$EXTERNALSYM FILE_SHARE_DELETE}
  FILE_SHARE_DELETE                   = $00000004;
  {$EXTERNALSYM FILE_ATTRIBUTE_READONLY}
  FILE_ATTRIBUTE_READONLY             = $00000001;
  {$EXTERNALSYM FILE_ATTRIBUTE_HIDDEN}
  FILE_ATTRIBUTE_HIDDEN               = $00000002;
  {$EXTERNALSYM FILE_ATTRIBUTE_SYSTEM}
  FILE_ATTRIBUTE_SYSTEM               = $00000004;
  {$EXTERNALSYM FILE_ATTRIBUTE_DIRECTORY}
  FILE_ATTRIBUTE_DIRECTORY            = $00000010;
  {$EXTERNALSYM FILE_ATTRIBUTE_ARCHIVE}
  FILE_ATTRIBUTE_ARCHIVE              = $00000020;
  {$EXTERNALSYM FILE_ATTRIBUTE_NORMAL}
  FILE_ATTRIBUTE_NORMAL               = $00000080;
  {$EXTERNALSYM FILE_ATTRIBUTE_TEMPORARY}
  FILE_ATTRIBUTE_TEMPORARY            = $00000100;
  {$EXTERNALSYM FILE_ATTRIBUTE_COMPRESSED}
  FILE_ATTRIBUTE_COMPRESSED           = $00000800;
  {$EXTERNALSYM FILE_ATTRIBUTE_OFFLINE}
  FILE_ATTRIBUTE_OFFLINE              = $00001000;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_FILE_NAME}
  FILE_NOTIFY_CHANGE_FILE_NAME        = $00000001;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_DIR_NAME}
  FILE_NOTIFY_CHANGE_DIR_NAME         = $00000002;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_ATTRIBUTES}
  FILE_NOTIFY_CHANGE_ATTRIBUTES       = $00000004;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_SIZE}
  FILE_NOTIFY_CHANGE_SIZE             = $00000008;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_LAST_WRITE}
  FILE_NOTIFY_CHANGE_LAST_WRITE       = $00000010;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_LAST_ACCESS}
  FILE_NOTIFY_CHANGE_LAST_ACCESS      = $00000020;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_CREATION}
  FILE_NOTIFY_CHANGE_CREATION         = $00000040;
  {$EXTERNALSYM FILE_NOTIFY_CHANGE_SECURITY}
  FILE_NOTIFY_CHANGE_SECURITY         = $00000100;
  {$EXTERNALSYM FILE_ACTION_ADDED}
  FILE_ACTION_ADDED                   = $00000001;
  {$EXTERNALSYM FILE_ACTION_REMOVED}
  FILE_ACTION_REMOVED                 = $00000002;
  {$EXTERNALSYM FILE_ACTION_MODIFIED}
  FILE_ACTION_MODIFIED                = $00000003;
  {$EXTERNALSYM FILE_ACTION_RENAMED_OLD_NAME}
  FILE_ACTION_RENAMED_OLD_NAME        = $00000004;
  {$EXTERNALSYM FILE_ACTION_RENAMED_NEW_NAME}
  FILE_ACTION_RENAMED_NEW_NAME        = $00000005;
  {$EXTERNALSYM MAILSLOT_NO_MESSAGE}
  MAILSLOT_NO_MESSAGE                 = LongWord(-1);
  {$EXTERNALSYM MAILSLOT_WAIT_FOREVER}
  MAILSLOT_WAIT_FOREVER               = LongWord(-1);
  {$EXTERNALSYM FILE_CASE_SENSITIVE_SEARCH}
  FILE_CASE_SENSITIVE_SEARCH          = $00000001;
  {$EXTERNALSYM FILE_CASE_PRESERVED_NAMES}
  FILE_CASE_PRESERVED_NAMES           = $00000002;
  {$EXTERNALSYM FILE_UNICODE_ON_DISK}
  FILE_UNICODE_ON_DISK                = $00000004;
  {$EXTERNALSYM FILE_PERSISTENT_ACLS}
  FILE_PERSISTENT_ACLS                = $00000008;
  {$EXTERNALSYM FILE_FILE_COMPRESSION}
  FILE_FILE_COMPRESSION               = $00000010;
  {$EXTERNALSYM FILE_VOLUME_IS_COMPRESSED}
  FILE_VOLUME_IS_COMPRESSED           = $00008000;


{line 2300}
const
  {$EXTERNALSYM IO_COMPLETION_MODIFY_STATE}
  IO_COMPLETION_MODIFY_STATE = $0002;
  {$EXTERNALSYM IO_COMPLETION_ALL_ACCESS}
  IO_COMPLETION_ALL_ACCESS   = (STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 3);
  {$EXTERNALSYM DUPLICATE_CLOSE_SOURCE}
  DUPLICATE_CLOSE_SOURCE     = $00000001;
  {$EXTERNALSYM DUPLICATE_SAME_ACCESS}
  DUPLICATE_SAME_ACCESS      = $00000002;

type
  {$EXTERNALSYM PSECURITY_DESCRIPTOR}
  PSECURITY_DESCRIPTOR = Pointer;

  {$EXTERNALSYM ACCESS_MASK}
  ACCESS_MASK = DWORD;
  PACCESS_MASK = ^ACCESS_MASK;

const
  { The following are masks for the predefined standard access types }

  _DELETE                  = $00010000; { Renamed from DELETE }
  {$EXTERNALSYM READ_CONTROL}
  READ_CONTROL             = $00020000;
  {$EXTERNALSYM WRITE_DAC}
  WRITE_DAC                = $00040000;
  {$EXTERNALSYM WRITE_OWNER}
  WRITE_OWNER              = $00080000;
{ SYNCHRONIZE              = $00100000; defined above }
{ STANDARD_RIGHTS_REQUIRED = $000F0000; defined above }
  {$EXTERNALSYM STANDARD_RIGHTS_READ}
  STANDARD_RIGHTS_READ     = READ_CONTROL;
  {$EXTERNALSYM STANDARD_RIGHTS_WRITE}
  STANDARD_RIGHTS_WRITE    = READ_CONTROL;
  {$EXTERNALSYM STANDARD_RIGHTS_EXECUTE}
  STANDARD_RIGHTS_EXECUTE  = READ_CONTROL;
  {$EXTERNALSYM STANDARD_RIGHTS_ALL}
  STANDARD_RIGHTS_ALL      = $001F0000;
  {$EXTERNALSYM SPECIFIC_RIGHTS_ALL}
  SPECIFIC_RIGHTS_ALL      = $0000FFFF;
  {$EXTERNALSYM ACCESS_SYSTEM_SECURITY}
  ACCESS_SYSTEM_SECURITY   = $01000000;
  {$EXTERNALSYM MAXIMUM_ALLOWED}
  MAXIMUM_ALLOWED          = $02000000;
  {$EXTERNALSYM GENERIC_READ}
  GENERIC_READ             = DWORD($80000000);
  {$EXTERNALSYM GENERIC_WRITE}
  GENERIC_WRITE            = $40000000;
  {$EXTERNALSYM GENERIC_EXECUTE}
  GENERIC_EXECUTE          = $20000000;
  {$EXTERNALSYM GENERIC_ALL}
  GENERIC_ALL              = $10000000;

type
  { Define the generic mapping array.  This is used to denote the
    mapping of each generic access right to a specific access mask. }

  PGenericMapping = ^TGenericMapping;
  {$EXTERNALSYM _GENERIC_MAPPING}
  _GENERIC_MAPPING = record
    GenericRead: ACCESS_MASK;
    GenericWrite: ACCESS_MASK;
    GenericExecute: ACCESS_MASK;
    GenericAll: ACCESS_MASK;
  end;
  TGenericMapping = _GENERIC_MAPPING;
  {$EXTERNALSYM GENERIC_MAPPING}
  GENERIC_MAPPING = _GENERIC_MAPPING;

  PLUIDAndAttributes = ^TLUIDAndAttributes;
  {$EXTERNALSYM _LUID_AND_ATTRIBUTES}
  _LUID_AND_ATTRIBUTES = record
    Luid: TLargeInteger;
    Attributes: DWORD;
  end;
  TLUIDAndAttributes = _LUID_AND_ATTRIBUTES;
  {$EXTERNALSYM LUID_AND_ATTRIBUTES}
  LUID_AND_ATTRIBUTES = _LUID_AND_ATTRIBUTES;

{ ////////////////////////////////////////////////////////////////////// }
{                                                                    // }
{              Security Id     (SID)                                 // }
{                                                                    // }
{ ////////////////////////////////////////////////////////////////////// }


{ Pictorially the structure of an SID is as follows: }

{         1   1   1   1   1   1 }
{         5   4   3   2   1   0   9   8   7   6   5   4   3   2   1   0 }
{      +---------------------------------------------------------------+ }
{      |      SubAuthorityCount        |Reserved1 (SBZ)|   Revision    | }
{      +---------------------------------------------------------------+ }
{      |                   IdentifierAuthority[0]                      | }
{      +---------------------------------------------------------------+ }
{      |                   IdentifierAuthority[1]                      | }
{      +---------------------------------------------------------------+ }
{      |                   IdentifierAuthority[2]                      | }
{      +---------------------------------------------------------------+ }
{      |                                                               | }
{      +- -  -  -  -  -  -  -  SubAuthority[]  -  -  -  -  -  -  -  - -+ }
{      |                                                               | }
{      +---------------------------------------------------------------+ }

  PSIDIdentifierAuthority = ^TSIDIdentifierAuthority;
  {$EXTERNALSYM _SID_IDENTIFIER_AUTHORITY}
  _SID_IDENTIFIER_AUTHORITY = record
    Value: array[0..5] of Byte;
  end;
  TSIDIdentifierAuthority = _SID_IDENTIFIER_AUTHORITY;
  {$EXTERNALSYM SID_IDENTIFIER_AUTHORITY}
  SID_IDENTIFIER_AUTHORITY = _SID_IDENTIFIER_AUTHORITY;

const
  {$EXTERNALSYM SidTypeUser}
  SidTypeUser = 1;
  {$EXTERNALSYM SidTypeGroup}
  SidTypeGroup = 2;
  {$EXTERNALSYM SidTypeDomain}
  SidTypeDomain = 3;
  {$EXTERNALSYM SidTypeAlias}
  SidTypeAlias = 4;
  {$EXTERNALSYM SidTypeWellKnownGroup}
  SidTypeWellKnownGroup = 5;
  {$EXTERNALSYM SidTypeDeletedAccount}
  SidTypeDeletedAccount = 6;
  {$EXTERNALSYM SidTypeInvalid}
  SidTypeInvalid = 7;
  {$EXTERNALSYM SidTypeUnknown}
  SidTypeUnknown = 8;
type
  {$EXTERNALSYM SID_NAME_USE}
  SID_NAME_USE = DWORD;

  PSIDAndAttributes = ^TSIDAndAttributes;
  {$EXTERNALSYM _SID_AND_ATTRIBUTES}
  _SID_AND_ATTRIBUTES = record
    Sid: PSID;
    Attributes: DWORD;
  end;
  TSIDAndAttributes = _SID_AND_ATTRIBUTES;
  {$EXTERNALSYM SID_AND_ATTRIBUTES}
  SID_AND_ATTRIBUTES = _SID_AND_ATTRIBUTES;

{line 2700}
  {$EXTERNALSYM PACL}
  PACL = ^TACL;
  {$EXTERNALSYM _ACL}
  _ACL = record
    AclRevision: Byte;
    Sbz1: Byte;
    AclSize: Word;
    AceCount: Word;
    Sbz2: Word;
  end;
  TACL = _ACL;
  {$EXTERNALSYM ACL}
  ACL = _ACL;

{line 2850}
  { The following declarations are used for setting and querying information
    about and ACL.  First are the various information classes available to
    the user. }

  {$EXTERNALSYM TAclInformationClass}
  TAclInformationClass = (AclInfoPad, AclRevisionInformation, AclSizeInformation);

{line 2900}
{ Security Descriptor and related data types. }

const
  {$EXTERNALSYM SECURITY_DESCRIPTOR_REVISION}
  SECURITY_DESCRIPTOR_REVISION = 1;
  {$EXTERNALSYM SECURITY_DESCRIPTOR_REVISION1}
  SECURITY_DESCRIPTOR_REVISION1 = 1;
  {$EXTERNALSYM SECURITY_DESCRIPTOR_MIN_LENGTH}
  SECURITY_DESCRIPTOR_MIN_LENGTH = 20;
  {$EXTERNALSYM SE_OWNER_DEFAULTED}
  SE_OWNER_DEFAULTED = $0001;
  {$EXTERNALSYM SE_GROUP_DEFAULTED}
  SE_GROUP_DEFAULTED = $0002;
  {$EXTERNALSYM SE_DACL_PRESENT}
  SE_DACL_PRESENT    = $0004;
  {$EXTERNALSYM SE_DACL_DEFAULTED}
  SE_DACL_DEFAULTED  = $0008;
  {$EXTERNALSYM SE_SACL_PRESENT}
  SE_SACL_PRESENT    = $0010;
  {$EXTERNALSYM SE_SACL_DEFAULTED}
  SE_SACL_DEFAULTED  = $0020;
  {$EXTERNALSYM SE_DACL_AUTO_INHERIT_REQ}
  SE_DACL_AUTO_INHERIT_REQ = $0100;
  {$EXTERNALSYM SE_SACL_AUTO_INHERIT_REQ}
  SE_SACL_AUTO_INHERIT_REQ = $0200;
  {$EXTERNALSYM SE_DACL_AUTO_INHERITED}
  SE_DACL_AUTO_INHERITED = $0400;
  {$EXTERNALSYM SE_SACL_AUTO_INHERITED}
  SE_SACL_AUTO_INHERITED = $0800;
  {$EXTERNALSYM SE_DACL_PROTECTED}
  SE_DACL_PROTECTED = $1000;
  {$EXTERNALSYM SE_SACL_PROTECTED}
  SE_SACL_PROTECTED = $2000;

  {$EXTERNALSYM SE_SELF_RELATIVE}
  SE_SELF_RELATIVE   = $8000;

{  Where: }

{      SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the }
{          SID pointed to by the Owner field was provided by a }
{          defaulting mechanism rather than explicitly provided by the }
{          original provider of the security descriptor.  This may }
{          affect the treatment of the SID with respect to inheritence }
{          of an owner. }

{      SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the }
{          SID in the Group field was provided by a defaulting mechanism }
{          rather than explicitly provided by the original provider of }
{          the security descriptor.  This may affect the treatment of }
{          the SID with respect to inheritence of a primary group. }

{      SE_DACL_PRESENT - This boolean flag, when set, indicates that the }
{          security descriptor contains a discretionary ACL.  If this }
{          flag is set and the Dacl field of the SECURITY_DESCRIPTOR is }
{          null, then a null ACL is explicitly being specified. }

{      SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the }
{          ACL pointed to by the Dacl field was provided by a defaulting }
{          mechanism rather than explicitly provided by the original }
{          provider of the security descriptor.  This may affect the }
{          treatment of the ACL with respect to inheritence of an ACL. }
{          This flag is ignored if the DaclPresent flag is not set. }

{      SE_SACL_PRESENT - This boolean flag, when set,  indicates that the }
{          security descriptor contains a system ACL pointed to by the }
{          Sacl field.  If this flag is set and the Sacl field of the }
{          SECURITY_DESCRIPTOR is null, then an empty (but present) }
{          ACL is being specified. }

{      SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the }
{          ACL pointed to by the Sacl field was provided by a defaulting }
{          mechanism rather than explicitly provided by the original }
{          provider of the security descriptor.  This may affect the }
{          treatment of the ACL with respect to inheritence of an ACL. }
{          This flag is ignored if the SaclPresent flag is not set. }

{      SE_SELF_RELATIVE - This boolean flag, when set, indicates that the }
{          security descriptor is in self-relative form.  In this form, }
{          all fields of the security descriptor are contiguous in memory }
{          and all pointer fields are expressed as offsets from the }
{          beginning of the security descriptor.  This form is useful }
{          for treating security descriptors as opaque data structures }
{          for transmission in communication protocol or for storage on }
{          secondary media. }



{ Pictorially the structure of a security descriptor is as follows: }

{       3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 }
{       1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 }
{      +---------------------------------------------------------------+ }
{      |            Control            |Reserved1 (SBZ)|   Revision    | }
{      +---------------------------------------------------------------+ }
{      |                            Owner                              | }
{      +---------------------------------------------------------------+ }
{      |                            Group                              | }
{      +---------------------------------------------------------------+ }
{      |                            Sacl                               | }
{      +---------------------------------------------------------------+ }
{      |                            Dacl                               | }
{      +---------------------------------------------------------------+ }

{ In general, this data structure should be treated opaquely to ensure future }
{ compatibility. }


type
  {$EXTERNALSYM SECURITY_DESCRIPTOR_CONTROL}
  SECURITY_DESCRIPTOR_CONTROL = Word;
  {$EXTERNALSYM PSECURITY_DESCRIPTOR_CONTROL}
  PSECURITY_DESCRIPTOR_CONTROL = ^WORD;

  { In general, this data structure should be treated opaquely
    to ensure future compatibility. }

  PSecurityDescriptor = ^TSecurityDescriptor;
  {$EXTERNALSYM _SECURITY_DESCRIPTOR}
  _SECURITY_DESCRIPTOR = record
    Revision: Byte;
    Sbz1: Byte;
    Control: SECURITY_DESCRIPTOR_CONTROL;
    Owner: PSID;
    Group: PSID;
    Sacl: PACL;
    Dacl: PACL;
  end;
  TSecurityDescriptor = _SECURITY_DESCRIPTOR;
  {$EXTERNALSYM SECURITY_DESCRIPTOR}
  SECURITY_DESCRIPTOR = _SECURITY_DESCRIPTOR;

  PObjectTypeList = ^TObjectTypeList;
  {$EXTERNALSYM _OBJECT_TYPE_LIST}
  _OBJECT_TYPE_LIST = record
    Level: WORD;
    Sbz: WORD;
    ObjectType: PGUID;
  end;
  TObjectTypeList = _OBJECT_TYPE_LIST;
  {$EXTERNALSYM OBJECT_TYPE_LIST}
  OBJECT_TYPE_LIST = _OBJECT_TYPE_LIST;

const
  { DS values for Level }
  {$EXTERNALSYM ACCESS_OBJECT_GUID}
  ACCESS_OBJECT_GUID = 0;
  {$EXTERNALSYM ACCESS_PROPERTY_SET_GUID}
  ACCESS_PROPERTY_SET_GUID = 1;
  {$EXTERNALSYM ACCESS_PROPERTY_GUID}
  ACCESS_PROPERTY_GUID = 2;

  {$EXTERNALSYM ACCESS_MAX_LEVEL}
  ACCESS_MAX_LEVEL = 4;

type
  {$EXTERNALSYM AUDIT_EVENT_TYPE}
  AUDIT_EVENT_TYPE = DWORD;

const
  {$EXTERNALSYM AUDIT_ALLOW_NO_PRIVILEGE}
  AUDIT_ALLOW_NO_PRIVILEGE = $1;


{ Privilege Related Data Structures }

const
  { Privilege attributes }

  {$EXTERNALSYM SE_PRIVILEGE_ENABLED_BY_DEFAULT}
  SE_PRIVILEGE_ENABLED_BY_DEFAULT = $00000001;
  {$EXTERNALSYM SE_PRIVILEGE_ENABLED}
  SE_PRIVILEGE_ENABLED            = $00000002;
  {$EXTERNALSYM SE_PRIVILEGE_USED_FOR_ACCESS}
  SE_PRIVILEGE_USED_FOR_ACCESS    = DWORD($80000000);

  { Privilege Set Control flags }

  {$EXTERNALSYM PRIVILEGE_SET_ALL_NECESSARY}
  PRIVILEGE_SET_ALL_NECESSARY = 1;

  {  Privilege Set - This is defined for a privilege set of one.
                   If more than one privilege is needed, then this structure
                   will need to be allocated with more space.}
  {  Note: don't change this structure without fixing the INITIAL_PRIVILEGE_SET}

type
  PPrivilegeSet = ^TPrivilegeSet;
  {$EXTERNALSYM _PRIVILEGE_SET}
  _PRIVILEGE_SET = record
    PrivilegeCount: DWORD;
    Control: DWORD;
    Privilege: array[0..0] of TLUIDAndAttributes;
  end;
  TPrivilegeSet = _PRIVILEGE_SET;
  {$EXTERNALSYM PRIVILEGE_SET}
  PRIVILEGE_SET = _PRIVILEGE_SET;

{ line 3130 }
  {$EXTERNALSYM TSecurityImpersonationLevel}
  TSecurityImpersonationLevel = (SecurityAnonymous,
    SecurityIdentification, SecurityImpersonation, SecurityDelegation);

const
  {$EXTERNALSYM SECURITY_MAX_IMPERSONATION_LEVEL}
  SECURITY_MAX_IMPERSONATION_LEVEL     = SecurityDelegation;
  {$EXTERNALSYM DEFAULT_IMPERSONATION_LEVEL}
  DEFAULT_IMPERSONATION_LEVEL     = SecurityImpersonation;

const
  {$EXTERNALSYM TOKEN_ASSIGN_PRIMARY}
  TOKEN_ASSIGN_PRIMARY = $0001;
  {$EXTERNALSYM TOKEN_DUPLICATE}
  TOKEN_DUPLICATE = $0002;
  {$EXTERNALSYM TOKEN_IMPERSONATE}
  TOKEN_IMPERSONATE = $0004;
  {$EXTERNALSYM TOKEN_QUERY}
  TOKEN_QUERY = $0008;
  {$EXTERNALSYM TOKEN_QUERY_SOURCE}
  TOKEN_QUERY_SOURCE = $0010;
  {$EXTERNALSYM TOKEN_ADJUST_PRIVILEGES}
  TOKEN_ADJUST_PRIVILEGES = $0020;
  {$EXTERNALSYM TOKEN_ADJUST_GROUPS}
  TOKEN_ADJUST_GROUPS = $0040;
  {$EXTERNALSYM TOKEN_ADJUST_DEFAULT}
  TOKEN_ADJUST_DEFAULT = $0080;
  {$EXTERNALSYM TOKEN_ALL_ACCESS}
  TOKEN_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED or TOKEN_ASSIGN_PRIMARY or
    TOKEN_DUPLICATE or TOKEN_IMPERSONATE or TOKEN_QUERY or
    TOKEN_QUERY_SOURCE or TOKEN_ADJUST_PRIVILEGES or TOKEN_ADJUST_GROUPS or
    TOKEN_ADJUST_DEFAULT);
  {$EXTERNALSYM TOKEN_READ}
  TOKEN_READ = (STANDARD_RIGHTS_READ or TOKEN_QUERY);
  {$EXTERNALSYM TOKEN_WRITE}
  TOKEN_WRITE = (STANDARD_RIGHTS_WRITE or TOKEN_ADJUST_PRIVILEGES or
    TOKEN_ADJUST_GROUPS or TOKEN_ADJUST_DEFAULT);
  {$EXTERNALSYM TOKEN_EXECUTE}
  TOKEN_EXECUTE = STANDARD_RIGHTS_EXECUTE;

type
        {$EXTERNALSYM TTokenType}
        TTokenType = (TokenTPad, TokenPrimary, TokenImpersonation);

  {$EXTERNALSYM TTokenInformationClass}
  TTokenInformationClass = (TokenICPad, TokenUser, TokenGroups, TokenPrivileges,
    TokenOwner, TokenPrimaryGroup, TokenDefaultDacl, TokenSource, TokenType,
    TokenImpersonationLevel, TokenStatistics);

  PTokenGroups = ^TTokenGroups;
  {$EXTERNALSYM _TOKEN_GROUPS}
  _TOKEN_GROUPS = record
    GroupCount: DWORD;
    Groups: array[0..0] of TSIDAndAttributes;
  end;
  TTokenGroups = _TOKEN_GROUPS;
  {$EXTERNALSYM TOKEN_GROUPS}
  TOKEN_GROUPS = _TOKEN_GROUPS;

  PTokenPrivileges = ^TTokenPrivileges;
  {$EXTERNALSYM _TOKEN_PRIVILEGES}
  _TOKEN_PRIVILEGES = record
    PrivilegeCount: DWORD;
    Privileges: array[0..0] of TLUIDAndAttributes;
  end;
  TTokenPrivileges = _TOKEN_PRIVILEGES;
  {$EXTERNALSYM TOKEN_PRIVILEGES}
  TOKEN_PRIVILEGES = _TOKEN_PRIVILEGES;

const
  {$EXTERNALSYM SECURITY_DYNAMIC_TRACKING}
  SECURITY_DYNAMIC_TRACKING = True;
  {$EXTERNALSYM SECURITY_STATIC_TRACKING}
  SECURITY_STATIC_TRACKING  = False;

type
  {$EXTERNALSYM SECURITY_CONTEXT_TRACKING_MODE}
  SECURITY_CONTEXT_TRACKING_MODE = Boolean;

  PSecurityQualityOfService = ^TSecurityQualityOfService;
  {$EXTERNALSYM _SECURITY_QUALITY_OF_SERVICE}
  _SECURITY_QUALITY_OF_SERVICE = record
    Length: DWORD;
    ImpersonationLevel: TSecurityImpersonationLevel;
    ContextTrackingMode: SECURITY_CONTEXT_TRACKING_MODE;
    EffectiveOnly: Boolean;
  end;
  TSecurityQualityOfService = _SECURITY_QUALITY_OF_SERVICE;
  {$EXTERNALSYM SECURITY_QUALITY_OF_SERVICE}
  SECURITY_QUALITY_OF_SERVICE = _SECURITY_QUALITY_OF_SERVICE;

{line 3320}
  {$EXTERNALSYM SECURITY_INFORMATION}
  SECURITY_INFORMATION = DWORD;
  PSECURITY_INFORMATION = ^DWORD;

const
  {$EXTERNALSYM OWNER_SECURITY_INFORMATION}
  OWNER_SECURITY_INFORMATION =  $00000001;
  {$EXTERNALSYM GROUP_SECURITY_INFORMATION}
  GROUP_SECURITY_INFORMATION =  $00000002;
  {$EXTERNALSYM DACL_SECURITY_INFORMATION}
  DACL_SECURITY_INFORMATION  =  $00000004;
  {$EXTERNALSYM SACL_SECURITY_INFORMATION}
  SACL_SECURITY_INFORMATION  =  $00000008;

type
  TThreadStartRoutine = function(lpThreadParameter: Pointer): Integer stdcall;

{line 3337}
const
  {$EXTERNALSYM IMAGE_DOS_SIGNATURE}
  IMAGE_DOS_SIGNATURE                     = $5A4D;      { MZ }
  {$EXTERNALSYM IMAGE_OS2_SIGNATURE}
  IMAGE_OS2_SIGNATURE                     = $454E;      { NE }
  {$EXTERNALSYM IMAGE_OS2_SIGNATURE_LE}
  IMAGE_OS2_SIGNATURE_LE                  = $454C;      { LE }
  {$EXTERNALSYM IMAGE_VXD_SIGNATURE}
  IMAGE_VXD_SIGNATURE                     = $454C;      { LE }
  {$EXTERNALSYM IMAGE_NT_SIGNATURE}
  IMAGE_NT_SIGNATURE                      = $00004550;  { PE00 }

{line 3457}
{ File header format. }

type
  PImageFileHeader = ^TImageFileHeader;
  {$EXTERNALSYM _IMAGE_FILE_HEADER}
  _IMAGE_FILE_HEADER = packed record
    Machine: Word;
    NumberOfSections: Word;
    TimeDateStamp: DWORD;
    PointerToSymbolTable: DWORD;
    NumberOfSymbols: DWORD;
    SizeOfOptionalHeader: Word;
    Characteristics: Word;
  end;
  TImageFileHeader = _IMAGE_FILE_HEADER;
  {$EXTERNALSYM IMAGE_FILE_HEADER}
  IMAGE_FILE_HEADER = _IMAGE_FILE_HEADER;

const
  {$EXTERNALSYM IMAGE_SIZEOF_FILE_HEADER}
  IMAGE_SIZEOF_FILE_HEADER                 = 20;

  {$EXTERNALSYM IMAGE_FILE_RELOCS_STRIPPED}
  IMAGE_FILE_RELOCS_STRIPPED               = $0001;  { Relocation info stripped from file. }
  {$EXTERNALSYM IMAGE_FILE_EXECUTABLE_IMAGE}
  IMAGE_FILE_EXECUTABLE_IMAGE              = $0002;  { File is executable  (i.e. no unresolved externel references). }
  {$EXTERNALSYM IMAGE_FILE_LINE_NUMS_STRIPPED}
  IMAGE_FILE_LINE_NUMS_STRIPPED            = $0004;  { Line nunbers stripped from file. }
  {$EXTERNALSYM IMAGE_FILE_LOCAL_SYMS_STRIPPED}
  IMAGE_FILE_LOCAL_SYMS_STRIPPED           = $0008;  { Local symbols stripped from file. }
  {$EXTERNALSYM IMAGE_FILE_AGGRESIVE_WS_TRIM}
  IMAGE_FILE_AGGRESIVE_WS_TRIM             = $0010;  { Agressively trim working set }
  {$EXTERNALSYM IMAGE_FILE_BYTES_REVERSED_LO}
  IMAGE_FILE_BYTES_REVERSED_LO             = $0080;  { Bytes of machine word are reversed. }
  {$EXTERNALSYM IMAGE_FILE_32BIT_MACHINE}
  IMAGE_FILE_32BIT_MACHINE                 = $0100;  { 32 bit word machine. }
  {$EXTERNALSYM IMAGE_FILE_DEBUG_STRIPPED}
  IMAGE_FILE_DEBUG_STRIPPED                = $0200;  { Debugging info stripped from file in .DBG file }
  {$EXTERNALSYM IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP}
  IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP       = $0400;  { If Image is on removable media, copy and run from the swap file. }
  {$EXTERNALSYM IMAGE_FILE_NET_RUN_FROM_SWAP}
  IMAGE_FILE_NET_RUN_FROM_SWAP             = $0800;  { If Image is on Net, copy and run from the swap file. }
  {$EXTERNALSYM IMAGE_FILE_SYSTEM}
  IMAGE_FILE_SYSTEM                        = $1000;  { System File. }
  {$EXTERNALSYM IMAGE_FILE_DLL}
  IMAGE_FILE_DLL                           = $2000;  { File is a DLL. }
  {$EXTERNALSYM IMAGE_FILE_UP_SYSTEM_ONLY}
  IMAGE_FILE_UP_SYSTEM_ONLY                = $4000;  { File should only be run on a UP machine }
  {$EXTERNALSYM IMAGE_FILE_BYTES_REVERSED_HI}
  IMAGE_FILE_BYTES_REVERSED_HI             = $8000;  { Bytes of machine word are reversed. }

  {$EXTERNALSYM IMAGE_FILE_MACHINE_UNKNOWN}
  IMAGE_FILE_MACHINE_UNKNOWN               = 0;
  {$EXTERNALSYM IMAGE_FILE_MACHINE_I386}
  IMAGE_FILE_MACHINE_I386                  = $14c;   { Intel 386. }
  {$EXTERNALSYM IMAGE_FILE_MACHINE_R3000}
  IMAGE_FILE_MACHINE_R3000                 = $162;   { MIPS little-endian, 0x160 big-endian }
  {$EXTERNALSYM IMAGE_FILE_MACHINE_R4000}
  IMAGE_FILE_MACHINE_R4000                 = $166;   { MIPS little-endian }
  {$EXTERNALSYM IMAGE_FILE_MACHINE_R10000}
  IMAGE_FILE_MACHINE_R10000                = $168;   { MIPS little-endian }
  {$EXTERNALSYM IMAGE_FILE_MACHINE_ALPHA}
  IMAGE_FILE_MACHINE_ALPHA                 = $184;   { Alpha_AXP }
  {$EXTERNALSYM IMAGE_FILE_MACHINE_POWERPC}
  IMAGE_FILE_MACHINE_POWERPC               = $1F0;   { IBM PowerPC Little-Endian }

{ Directory format. }

type
  PImageDataDirectory = ^TImageDataDirectory;
  {$EXTERNALSYM _IMAGE_DATA_DIRECTORY}
  _IMAGE_DATA_DIRECTORY = record
    VirtualAddress: DWORD;
    Size: DWORD;
  end;
  TImageDataDirectory = _IMAGE_DATA_DIRECTORY;
  {$EXTERNALSYM IMAGE_DATA_DIRECTORY}
  IMAGE_DATA_DIRECTORY = _IMAGE_DATA_DIRECTORY;

const
  {$EXTERNALSYM IMAGE_NUMBEROF_DIRECTORY_ENTRIES}
  IMAGE_NUMBEROF_DIRECTORY_ENTRIES        = 16;

{ Optional header format. }

type
  PImageOptionalHeader = ^TImageOptionalHeader;
  {$EXTERNALSYM _IMAGE_OPTIONAL_HEADER}
  _IMAGE_OPTIONAL_HEADER = packed record
    { Standard fields. }
    Magic: Word;
    MajorLinkerVersion: Byte;
    MinorLinkerVersion: Byte;
    SizeOfCode: DWORD;
    SizeOfInitializedData: DWORD;
    SizeOfUninitializedData: DWORD;
    AddressOfEntryPoint: DWORD;
    BaseOfCode: DWORD;
    BaseOfData: DWORD;
    { NT additional fields. }
    ImageBase: DWORD;
    SectionAlignment: DWORD;
    FileAlignment: DWORD;
    MajorOperatingSystemVersion: Word;
    MinorOperatingSystemVersion: Word;
    MajorImageVersion: Word;
    MinorImageVersion: Word;
    MajorSubsystemVersion: Word;
    MinorSubsystemVersion: Word;
    Win32VersionValue: DWORD;
    SizeOfImage: DWORD;
    SizeOfHeaders: DWORD;
    CheckSum: DWORD;
    Subsystem: Word;
    DllCharacteristics: Word;
    SizeOfStackReserve: DWORD;
    SizeOfStackCommit: DWORD;
    SizeOfHeapReserve: DWORD;
    SizeOfHeapCommit: DWORD;
    LoaderFlags: DWORD;
    NumberOfRvaAndSizes: DWORD;
    DataDirectory: packed array[0..IMAGE_NUMBEROF_DIRECTORY_ENTRIES-1] of TImageDataDirectory;
  end;
  TImageOptionalHeader = _IMAGE_OPTIONAL_HEADER;
  {$EXTERNALSYM IMAGE_OPTIONAL_HEADER}
  IMAGE_OPTIONAL_HEADER = _IMAGE_OPTIONAL_HEADER;

  PImageRomOptionalHeader = ^TImageRomOptionalHeader;
  {$EXTERNALSYM _IMAGE_ROM_OPTIONAL_HEADER}
  _IMAGE_ROM_OPTIONAL_HEADER = packed record
    Magic: Word;
    MajorLinkerVersion: Byte;
    MinorLinkerVersion: Byte;
    SizeOfCode: DWORD;
    SizeOfInitializedData: DWORD;
    SizeOfUninitializedData: DWORD;
    AddressOfEntryPoint: DWORD;
    BaseOfCode: DWORD;
    BaseOfData: DWORD;
    BaseOfBss: DWORD;
    GprMask: DWORD;
    CprMask: packed array[0..3] of DWORD;
    GpValue: DWORD;
  end;
  TImageRomOptionalHeader = _IMAGE_ROM_OPTIONAL_HEADER;
  {$EXTERNALSYM IMAGE_ROM_OPTIONAL_HEADER}
  IMAGE_ROM_OPTIONAL_HEADER = _IMAGE_ROM_OPTIONAL_HEADER;


const
  {$EXTERNALSYM IMAGE_SIZEOF_ROM_OPTIONAL_HEADER}
  IMAGE_SIZEOF_ROM_OPTIONAL_HEADER       = 56;
  {$EXTERNALSYM IMAGE_SIZEOF_STD_OPTIONAL_HEADER}
  IMAGE_SIZEOF_STD_OPTIONAL_HEADER       = 28;
  {$EXTERNALSYM IMAGE_SIZEOF_NT_OPTIONAL_HEADER}
  IMAGE_SIZEOF_NT_OPTIONAL_HEADER        = 224;

  {$EXTERNALSYM IMAGE_NT_OPTIONAL_HDR_MAGIC}
  IMAGE_NT_OPTIONAL_HDR_MAGIC            = $010B;
  {$EXTERNALSYM IMAGE_ROM_OPTIONAL_HDR_MAGIC}
  IMAGE_ROM_OPTIONAL_HDR_MAGIC           = $0107;

type
  PImageNtHeaders = ^TImageNtHeaders;
  {$EXTERNALSYM _IMAGE_NT_HEADERS}
  _IMAGE_NT_HEADERS = packed record
    Signature: DWORD;
    FileHeader: TImageFileHeader;
    OptionalHeader: TImageOptionalHeader;
  end;
  TImageNtHeaders = _IMAGE_NT_HEADERS;
  {$EXTERNALSYM IMAGE_NT_HEADERS}
  IMAGE_NT_HEADERS = _IMAGE_NT_HEADERS;


  PImageRomHeaders = ^TImageRomHeaders;
  {$EXTERNALSYM _IMAGE_ROM_HEADERS}
  _IMAGE_ROM_HEADERS = packed record
    FileHeader: TImageFileHeader;
    OptionalHeader: TImageRomOptionalHeader;
  end;
  TImageRomHeaders = _IMAGE_ROM_HEADERS;
  {$EXTERNALSYM IMAGE_ROM_HEADERS}
  IMAGE_ROM_HEADERS = _IMAGE_ROM_HEADERS;


{ Subsystem Values }

const
  {$EXTERNALSYM IMAGE_SUBSYSTEM_UNKNOWN}
  IMAGE_SUBSYSTEM_UNKNOWN                  = 0;  { Unknown subsystem. }
  {$EXTERNALSYM IMAGE_SUBSYSTEM_NATIVE}
  IMAGE_SUBSYSTEM_NATIVE                   = 1;  { Image doesn't require a subsystem. }
  {$EXTERNALSYM IMAGE_SUBSYSTEM_WINDOWS_GUI}
  IMAGE_SUBSYSTEM_WINDOWS_GUI              = 2;  { Image runs in the Windows GUI subsystem. }
  {$EXTERNALSYM IMAGE_SUBSYSTEM_WINDOWS_CUI}
  IMAGE_SUBSYSTEM_WINDOWS_CUI              = 3;  { Image runs in the Windows character subsystem. }
  {$EXTERNALSYM IMAGE_SUBSYSTEM_OS2_CUI}
  IMAGE_SUBSYSTEM_OS2_CUI                  = 5;  { image runs in the OS/2 character subsystem. }
  {$EXTERNALSYM IMAGE_SUBSYSTEM_POSIX_CUI}
  IMAGE_SUBSYSTEM_POSIX_CUI                = 7;  { image run  in the Posix character subsystem. }
  {$EXTERNALSYM IMAGE_SUBSYSTEM_RESERVED8}
  IMAGE_SUBSYSTEM_RESERVED8                = 8;  { image run  in the 8 subsystem. }


{ Directory Entries }

  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_EXPORT}
  IMAGE_DIRECTORY_ENTRY_EXPORT             = 0;  { Export Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_IMPORT}
  IMAGE_DIRECTORY_ENTRY_IMPORT             = 1;  { Import Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_RESOURCE}
  IMAGE_DIRECTORY_ENTRY_RESOURCE           = 2;  { Resource Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_EXCEPTION}
  IMAGE_DIRECTORY_ENTRY_EXCEPTION          = 3;  { Exception Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_SECURITY}
  IMAGE_DIRECTORY_ENTRY_SECURITY           = 4;  { Security Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_BASERELOC}
  IMAGE_DIRECTORY_ENTRY_BASERELOC          = 5;  { Base Relocation Table }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_DEBUG}
  IMAGE_DIRECTORY_ENTRY_DEBUG              = 6;  { Debug Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_COPYRIGHT}
  IMAGE_DIRECTORY_ENTRY_COPYRIGHT          = 7;  { Description String }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_GLOBALPTR}
  IMAGE_DIRECTORY_ENTRY_GLOBALPTR          = 8;  { Machine Value (MIPS GP) }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_TLS}
  IMAGE_DIRECTORY_ENTRY_TLS                = 9;  { TLS Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG}
  IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG       = 10;  { Load Configuration Directory }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT}
  IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT      = 11;  { Bound Import Directory in headers }
  {$EXTERNALSYM IMAGE_DIRECTORY_ENTRY_IAT}
  IMAGE_DIRECTORY_ENTRY_IAT               = 12;  { Import Address Table }

{ Section header format. }

  {$EXTERNALSYM IMAGE_SIZEOF_SHORT_NAME}
  IMAGE_SIZEOF_SHORT_NAME                  = 8;

type
  TISHMisc = packed record
    case Integer of
      0: (PhysicalAddress: DWORD);
      1: (VirtualSize: DWORD);
  end;

  PImageSectionHeader = ^TImageSectionHeader;
  {$EXTERNALSYM _IMAGE_SECTION_HEADER}
  _IMAGE_SECTION_HEADER = packed record
    Name: packed array[0..IMAGE_SIZEOF_SHORT_NAME-1] of Byte;
    Misc: TISHMisc;
    VirtualAddress: DWORD;
    SizeOfRawData: DWORD;
    PointerToRawData: DWORD;
    PointerToRelocations: DWORD;
    PointerToLinenumbers: DWORD;
    NumberOfRelocations: Word;
    NumberOfLinenumbers: Word;
    Characteristics: DWORD;
  end;
  TImageSectionHeader = _IMAGE_SECTION_HEADER;
  {$EXTERNALSYM IMAGE_SECTION_HEADER}
  IMAGE_SECTION_HEADER = _IMAGE_SECTION_HEADER;


const
  {$EXTERNALSYM IMAGE_SIZEOF_SECTION_HEADER}
  IMAGE_SIZEOF_SECTION_HEADER              = 40;


{ Section characteristics. }

{      IMAGE_SCN_TYPE_REG                   0x00000000  // Reserved. }
{      IMAGE_SCN_TYPE_DSECT                 0x00000001  // Reserved. }
{      IMAGE_SCN_TYPE_NOLOAD                0x00000002  // Reserved. }
{      IMAGE_SCN_TYPE_GROUP                 0x00000004  // Reserved. }
  {$EXTERNALSYM IMAGE_SCN_TYPE_NO_PAD}
  IMAGE_SCN_TYPE_NO_PAD                    = $00000008;  { Reserved. }
{      IMAGE_SCN_TYPE_COPY                  0x00000010  // Reserved. }

  {$EXTERNALSYM IMAGE_SCN_CNT_CODE}
  IMAGE_SCN_CNT_CODE                       = $00000020;  { Section contains code. }
  {$EXTERNALSYM IMAGE_SCN_CNT_INITIALIZED_DATA}
  IMAGE_SCN_CNT_INITIALIZED_DATA           = $00000040;  { Section contains initialized data. }
  {$EXTERNALSYM IMAGE_SCN_CNT_UNINITIALIZED_DATA}
  IMAGE_SCN_CNT_UNINITIALIZED_DATA         = $00000080;  { Section contains uninitialized data. }

  {$EXTERNALSYM IMAGE_SCN_LNK_OTHER}
  IMAGE_SCN_LNK_OTHER                      = $00000100;  { Reserved. }
  {$EXTERNALSYM IMAGE_SCN_LNK_INFO}
  IMAGE_SCN_LNK_INFO                       = $00000200;  { Section contains comments or some other type of information. }
{      IMAGE_SCN_TYPE_OVER                  0x00000400  // Reserved. }
  {$EXTERNALSYM IMAGE_SCN_LNK_REMOVE}
  IMAGE_SCN_LNK_REMOVE                     = $00000800;  { Section contents will not become part of image. }
  {$EXTERNALSYM IMAGE_SCN_LNK_COMDAT}
  IMAGE_SCN_LNK_COMDAT                     = $00001000;  { Section contents comdat. }
{                                           0x00002000  // Reserved. }

{      IMAGE_SCN_MEM_PROTECTED - Obsolete   0x00004000 }
  {$EXTERNALSYM IMAGE_SCN_MEM_FARDATA}
  IMAGE_SCN_MEM_FARDATA                    = $00008000;
{      IMAGE_SCN_MEM_SYSHEAP  - Obsolete    0x00010000 }
  {$EXTERNALSYM IMAGE_SCN_MEM_PURGEABLE}
  IMAGE_SCN_MEM_PURGEABLE                  = $00020000;
  {$EXTERNALSYM IMAGE_SCN_MEM_16BIT}
  IMAGE_SCN_MEM_16BIT                      = $00020000;
  {$EXTERNALSYM IMAGE_SCN_MEM_LOCKED}
  IMAGE_SCN_MEM_LOCKED                     = $00040000;
  {$EXTERNALSYM IMAGE_SCN_MEM_PRELOAD}
  IMAGE_SCN_MEM_PRELOAD                    = $00080000;

  {$EXTERNALSYM IMAGE_SCN_ALIGN_1BYTES}
  IMAGE_SCN_ALIGN_1BYTES                   = $00100000;
  {$EXTERNALSYM IMAGE_SCN_ALIGN_2BYTES}
  IMAGE_SCN_ALIGN_2BYTES                   = $00200000;
  {$EXTERNALSYM IMAGE_SCN_ALIGN_4BYTES}
  IMAGE_SCN_ALIGN_4BYTES                   = $00300000;
  {$EXTERNALSYM IMAGE_SCN_ALIGN_8BYTES}
  IMAGE_SCN_ALIGN_8BYTES                   = $00400000;
  {$EXTERNALSYM IMAGE_SCN_ALIGN_16BYTES}
  IMAGE_SCN_ALIGN_16BYTES                  = $00500000;  { Default alignment if no others are specified. }
  {$EXTERNALSYM IMAGE_SCN_ALIGN_32BYTES}
  IMAGE_SCN_ALIGN_32BYTES                  = $00600000;
  {$EXTERNALSYM IMAGE_SCN_ALIGN_64BYTES}
  IMAGE_SCN_ALIGN_64BYTES                  = $00700000;
{ Unused                                    0x00800000 }

  {$EXTERNALSYM IMAGE_SCN_LNK_NRELOC_OVFL}
  IMAGE_SCN_LNK_NRELOC_OVFL                = $01000000;  { Section contains extended relocations. }
  {$EXTERNALSYM IMAGE_SCN_MEM_DISCARDABLE}
  IMAGE_SCN_MEM_DISCARDABLE                = $02000000;  { Section can be discarded. }
  {$EXTERNALSYM IMAGE_SCN_MEM_NOT_CACHED}
  IMAGE_SCN_MEM_NOT_CACHED                 = $04000000;  { Section is not cachable. }
  {$EXTERNALSYM IMAGE_SCN_MEM_NOT_PAGED}
  IMAGE_SCN_MEM_NOT_PAGED                  = $08000000;  { Section is not pageable. }
  {$EXTERNALSYM IMAGE_SCN_MEM_SHARED}
  IMAGE_SCN_MEM_SHARED                     = $10000000;  { Section is shareable. }
  {$EXTERNALSYM IMAGE_SCN_MEM_EXECUTE}
  IMAGE_SCN_MEM_EXECUTE                    = $20000000;  { Section is executable. }
  {$EXTERNALSYM IMAGE_SCN_MEM_READ}
  IMAGE_SCN_MEM_READ                       = $40000000;  { Section is readable. }
  {$EXTERNALSYM IMAGE_SCN_MEM_WRITE}
  IMAGE_SCN_MEM_WRITE                      = DWORD($80000000);  { Section is writeable. }


{line 4281}
type
  PImageLoadConfigDirectory = ^TImageLoadConfigDirectory;
  {$EXTERNALSYM _IMAGE_LOAD_CONFIG_DIRECTORY}
  _IMAGE_LOAD_CONFIG_DIRECTORY = packed record
    Characteristics: DWORD;
    TimeDateStamp: DWORD;
    MajorVersion: Word;
    MinorVersion: Word;
    GlobalFlagsClear: DWORD;
    GlobalFlagsSet: DWORD;
    CriticalSectionDefaultTimeout: DWORD;
    DeCommitFreeBlockThreshold: DWORD;
    DeCommitTotalFreeThreshold: DWORD;
    LockPrefixTable: Pointer;
    MaximumAllocationSize: DWORD;
    VirtualMemoryThreshold: DWORD;
    ProcessHeapFlags: DWORD;
    ProcessAffinityMask: DWORD;
    Reserved: array[0..2] of DWORD;
  end;
  TImageLoadConfigDirectory = _IMAGE_LOAD_CONFIG_DIRECTORY;
  {$EXTERNALSYM IMAGE_LOAD_CONFIG_DIRECTORY}
  IMAGE_LOAD_CONFIG_DIRECTORY = _IMAGE_LOAD_CONFIG_DIRECTORY;


// Function table entry format for MIPS/ALPHA images.  Function table is
// pointed to by the IMAGE_DIRECTORY_ENTRY_EXCEPTION directory entry.
// This definition duplicates ones in ntmips.h and ntalpha.h for use
// by portable image file mungers.

  PImageRuntimeFunctionEntry = ^TImageRuntimeFunctionEntry;
  {$EXTERNALSYM _IMAGE_RUNTIME_FUNCTION_ENTRY}
  _IMAGE_RUNTIME_FUNCTION_ENTRY = record
    BeginAddress: DWORD;
    EndAddress: DWORD;
    ExceptionHandler: Pointer;
    HandlerData: Pointer;
    PrologEndAddress: DWORD;
  end;
  TImageRuntimeFunctionEntry = _IMAGE_RUNTIME_FUNCTION_ENTRY;
  {$EXTERNALSYM IMAGE_RUNTIME_FUNCTION_ENTRY}
  IMAGE_RUNTIME_FUNCTION_ENTRY = _IMAGE_RUNTIME_FUNCTION_ENTRY;


//
// Debug Format
//

  PImageDebugDirectory = ^TImageDebugDirectory;
  {$EXTERNALSYM _IMAGE_DEBUG_DIRECTORY}
  _IMAGE_DEBUG_DIRECTORY = packed record
    Characteristics: DWORD;
    TimeDateStamp: DWORD;
    MajorVersion: Word;
    MinorVersion: Word;
    _Type: DWORD;
    SizeOfData: DWORD;
    AddressOfRawData: DWORD;
    PointerToRawData: DWORD;
  end;
  TImageDebugDirectory = _IMAGE_DEBUG_DIRECTORY;
  {$EXTERNALSYM IMAGE_DEBUG_DIRECTORY}
  IMAGE_DEBUG_DIRECTORY = _IMAGE_DEBUG_DIRECTORY;


const
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_UNKNOWN}
  IMAGE_DEBUG_TYPE_UNKNOWN          = 0;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_COFF}
  IMAGE_DEBUG_TYPE_COFF             = 1;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_CODEVIEW}
  IMAGE_DEBUG_TYPE_CODEVIEW         = 2;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_FPO}
  IMAGE_DEBUG_TYPE_FPO              = 3;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_MISC}
  IMAGE_DEBUG_TYPE_MISC             = 4;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_EXCEPTION}
  IMAGE_DEBUG_TYPE_EXCEPTION        = 5;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_FIXUP}
  IMAGE_DEBUG_TYPE_FIXUP            = 6;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_OMAP_TO_SRC}
  IMAGE_DEBUG_TYPE_OMAP_TO_SRC      = 7;
  {$EXTERNALSYM IMAGE_DEBUG_TYPE_OMAP_FROM_SRC}
  IMAGE_DEBUG_TYPE_OMAP_FROM_SRC    = 8;

type
  PImageCOFFSymbolsHeader = ^TImageCOFFSymbolsHeader;
  {$EXTERNALSYM _IMAGE_COFF_SYMBOLS_HEADER}
  _IMAGE_COFF_SYMBOLS_HEADER = record
    NumberOfSymbols: DWORD;
    LvaToFirstSymbol: DWORD;
    NumberOfLinenumbers: DWORD;
    LvaToFirstLinenumber: DWORD;
    RvaToFirstByteOfCode: DWORD;
    RvaToLastByteOfCode: DWORD;
    RvaToFirstByteOfData: DWORD;
    RvaToLastByteOfData: DWORD;
  end;
  TImageCOFFSymbolsHeader = _IMAGE_COFF_SYMBOLS_HEADER;
  {$EXTERNALSYM IMAGE_COFF_SYMBOLS_HEADER}
  IMAGE_COFF_SYMBOLS_HEADER = _IMAGE_COFF_SYMBOLS_HEADER;


const
  {$EXTERNALSYM FRAME_FPO}
  FRAME_FPO       = 0;
  {$EXTERNALSYM FRAME_TRAP}
  FRAME_TRAP      = 1;
  {$EXTERNALSYM FRAME_TSS}
  FRAME_TSS       = 2;
  {$EXTERNALSYM FRAME_NONFPO}
  FRAME_NONFPO    = 3;

type
  PFpoData = ^TFpoData;
  {$EXTERNALSYM _FPO_DATA}
  _FPO_DATA = packed record
    ulOffStart: DWORD;             // offset 1st byte of function code
    cbProcSize: DWORD;             // # bytes in function
    cdwLocals: DWORD;              // # bytes in locals/4
    cdwParams: Word;              // # bytes in params/4
{    WORD        cbProlog : 8;           // # bytes in prolog
     WORD        cbRegs   : 3;           // # regs saved
     WORD        fHasSEH  : 1;           // TRUE if SEH in func
     WORD        fUseBP   : 1;           // TRUE if EBP has been allocated
     WORD        reserved : 1;           // reserved for future use
     WORD        cbFrame  : 2;}           // frame type
     cbProlog: Byte;
     OtherStuff: Byte;
  end;
  TFpoData = _FPO_DATA;
  {$EXTERNALSYM FPO_DATA}
  FPO_DATA = _FPO_DATA;


const
  {$EXTERNALSYM SIZEOF_RFPO_DATA}
  SIZEOF_RFPO_DATA         = 16;
  {$EXTERNALSYM IMAGE_DEBUG_MISC_EXENAME}
  IMAGE_DEBUG_MISC_EXENAME = 1;

type
  PImageDebugMisc = ^TImageDebugMisc;
  {$EXTERNALSYM _IMAGE_DEBUG_MISC}
  _IMAGE_DEBUG_MISC = packed record
    DataType: DWORD;               // type of misc data, see defines
    Length: DWORD;                 // total length of record, rounded to four
                                   // byte multiple.
    Unicode: ByteBool;             // TRUE if data is unicode string
    Reserved: array[0..2] of Byte;
    Data: array[0..0] of Byte;     // Actual data
  end;
  TImageDebugMisc = _IMAGE_DEBUG_MISC;
  {$EXTERNALSYM IMAGE_DEBUG_MISC}
  IMAGE_DEBUG_MISC = _IMAGE_DEBUG_MISC;


//
// Function table extracted from MIPS/ALPHA images.  Does not contain
// information needed only for runtime support.  Just those fields for
// each entry needed by a debugger.
//
  PImageFunctionEntry = ^TImageFunctionEntry;
  {$EXTERNALSYM _IMAGE_FUNCTION_ENTRY}
  _IMAGE_FUNCTION_ENTRY = record
    StartingAddress: DWORD;
    EndingAddress: DWORD;
    EndOfPrologue: DWORD;
  end;
  TImageFunctionEntry = _IMAGE_FUNCTION_ENTRY;
  {$EXTERNALSYM IMAGE_FUNCTION_ENTRY}
  IMAGE_FUNCTION_ENTRY = _IMAGE_FUNCTION_ENTRY;


{line 4587}
type
  PRTLCriticalSection = ^TRTLCriticalSection;
  PRTLCriticalSectionDebug = ^TRTLCriticalSectionDebug;
  {$EXTERNALSYM _RTL_CRITICAL_SECTION_DEBUG}
  _RTL_CRITICAL_SECTION_DEBUG = record
    Type_18: Word;
    CreatorBackTraceIndex: Word;
    CriticalSection: PRTLCriticalSection;
    ProcessLocksList: TListEntry;
    EntryCount: DWORD;
    ContentionCount: DWORD;
    Spare: array[0..1] of DWORD;
  end;
  TRTLCriticalSectionDebug = _RTL_CRITICAL_SECTION_DEBUG;
  {$EXTERNALSYM RTL_CRITICAL_SECTION_DEBUG}
  RTL_CRITICAL_SECTION_DEBUG = _RTL_CRITICAL_SECTION_DEBUG;


  {$EXTERNALSYM _RTL_CRITICAL_SECTION}
  _RTL_CRITICAL_SECTION = record
    DebugInfo: PRTLCriticalSectionDebug;
    LockCount: Longint;
    RecursionCount: Longint;
    OwningThread: THandle;
    LockSemaphore: THandle;
    Reserved: DWORD;
  end;
  TRTLCriticalSection = _RTL_CRITICAL_SECTION;
  {$EXTERNALSYM RTL_CRITICAL_SECTION}
  RTL_CRITICAL_SECTION = _RTL_CRITICAL_SECTION;

const
  {$EXTERNALSYM RTL_CRITSECT_TYPE}
  RTL_CRITSECT_TYPE = 0;
  {$EXTERNALSYM RTL_RESOURCE_TYPE}
  RTL_RESOURCE_TYPE = 1;


  {$EXTERNALSYM DLL_PROCESS_ATTACH}
  DLL_PROCESS_ATTACH = 1;
  {$EXTERNALSYM DLL_THREAD_ATTACH}
  DLL_THREAD_ATTACH = 2;
  {$EXTERNALSYM DLL_THREAD_DETACH}
  DLL_THREAD_DETACH = 3;
  {$EXTERNALSYM DLL_PROCESS_DETACH}
  DLL_PROCESS_DETACH = 0;

{line 4630}

{ The types of events that can be logged. }

  {$EXTERNALSYM EVENTLOG_SUCCESS}
  EVENTLOG_SUCCESS          = $0000;
  {$EXTERNALSYM EVENTLOG_ERROR_TYPE}
  EVENTLOG_ERROR_TYPE       = $0001;
  {$EXTERNALSYM EVENTLOG_WARNING_TYPE}
  EVENTLOG_WARNING_TYPE     = $0002;
  {$EXTERNALSYM EVENTLOG_INFORMATION_TYPE}
  EVENTLOG_INFORMATION_TYPE = $0004;
  {$EXTERNALSYM EVENTLOG_AUDIT_SUCCESS}
  EVENTLOG_AUDIT_SUCCESS    = $0008;
  {$EXTERNALSYM EVENTLOG_AUDIT_FAILURE}
  EVENTLOG_AUDIT_FAILURE    = $0010;

{line 4700}

{ Registry Specific Access Rights. }

  {$EXTERNALSYM KEY_QUERY_VALUE}
  KEY_QUERY_VALUE    = $0001;
  {$EXTERNALSYM KEY_SET_VALUE}
  KEY_SET_VALUE      = $0002;
  {$EXTERNALSYM KEY_CREATE_SUB_KEY}
  KEY_CREATE_SUB_KEY = $0004;
  {$EXTERNALSYM KEY_ENUMERATE_SUB_KEYS}
  KEY_ENUMERATE_SUB_KEYS = $0008;
  {$EXTERNALSYM KEY_NOTIFY}
  KEY_NOTIFY         = $0010;
  {$EXTERNALSYM KEY_CREATE_LINK}
  KEY_CREATE_LINK    = $0020;


  {$EXTERNALSYM KEY_READ}
  KEY_READ           = (STANDARD_RIGHTS_READ or
                        KEY_QUERY_VALUE or
                        KEY_ENUMERATE_SUB_KEYS or
                        KEY_NOTIFY) and not
                        SYNCHRONIZE;



  {$EXTERNALSYM KEY_WRITE}
  KEY_WRITE          = (STANDARD_RIGHTS_WRITE or
                        KEY_SET_VALUE or
                        KEY_CREATE_SUB_KEY) and not
                        SYNCHRONIZE;

  {$EXTERNALSYM KEY_EXECUTE}
  KEY_EXECUTE        =  KEY_READ and not SYNCHRONIZE;


  {$EXTERNALSYM KEY_ALL_ACCESS}
  KEY_ALL_ACCESS     = (STANDARD_RIGHTS_ALL or
                        KEY_QUERY_VALUE or
                        KEY_SET_VALUE or
                        KEY_CREATE_SUB_KEY or
                        KEY_ENUMERATE_SUB_KEYS or
                        KEY_NOTIFY or
                        KEY_CREATE_LINK) and not
                        SYNCHRONIZE;

  { Registry Open/Create Options }

  {$EXTERNALSYM REG_OPTION_RESERVED}
  REG_OPTION_RESERVED     = ($00000000);    { Parameter is reserved }

  {$EXTERNALSYM REG_OPTION_NON_VOLATILE}
  REG_OPTION_NON_VOLATILE = ($00000000);    { Key is preserved }
                                            { when system is rebooted }

  {$EXTERNALSYM REG_OPTION_VOLATILE}
  REG_OPTION_VOLATILE     = ($00000001);    { Key is not preserved }
                                            { when system is rebooted }

  {$EXTERNALSYM REG_OPTION_CREATE_LINK}
  REG_OPTION_CREATE_LINK  = ($00000002);    { Created key is a }
                                            { symbolic link }

  {$EXTERNALSYM REG_OPTION_BACKUP_RESTORE}
  REG_OPTION_BACKUP_RESTORE = ($00000004);  { open for backup or restore }
                                            { special access rules }
                                            { privilege required   }

  {$EXTERNALSYM REG_LEGAL_OPTION}
  REG_LEGAL_OPTION  = (REG_OPTION_RESERVED or
                       REG_OPTION_NON_VOLATILE or
                       REG_OPTION_VOLATILE or
                       REG_OPTION_CREATE_LINK or
                       REG_OPTION_BACKUP_RESTORE);

  { Registry Key creation/open disposition }

  {$EXTERNALSYM REG_CREATED_NEW_KEY}
  REG_CREATED_NEW_KEY     = ($00000001);    { New Registry Key created }
  {$EXTERNALSYM REG_OPENED_EXISTING_KEY}
  REG_OPENED_EXISTING_KEY = ($00000002);    { Existing Key opened }

  { Registry Key restore flags }

  {$EXTERNALSYM REG_WHOLE_HIVE_VOLATILE}
  REG_WHOLE_HIVE_VOLATILE = ($00000001);    { Restore whole hive volatile }
  {$EXTERNALSYM REG_REFRESH_HIVE}
  REG_REFRESH_HIVE        = ($00000002);    { Unwind changes to last flush }

  { Registry Notify filter values }

  {$EXTERNALSYM REG_NOTIFY_CHANGE_NAME}
  REG_NOTIFY_CHANGE_NAME       = ($00000001); { Create or delete (child) }
  {$EXTERNALSYM REG_NOTIFY_CHANGE_ATTRIBUTES}
  REG_NOTIFY_CHANGE_ATTRIBUTES = ($00000002);
  {$EXTERNALSYM REG_NOTIFY_CHANGE_LAST_SET}
  REG_NOTIFY_CHANGE_LAST_SET   = ($00000004); { time stamp }
  {$EXTERNALSYM REG_NOTIFY_CHANGE_SECURITY}
  REG_NOTIFY_CHANGE_SECURITY   = ($00000008);

  {$EXTERNALSYM REG_LEGAL_CHANGE_FILTER}
  REG_LEGAL_CHANGE_FILTER = (REG_OPTION_RESERVED or
                             REG_NOTIFY_CHANGE_NAME or
                             REG_NOTIFY_CHANGE_ATTRIBUTES or
                             REG_NOTIFY_CHANGE_LAST_SET or
                             REG_NOTIFY_CHANGE_SECURITY);

  { Registry Predefined Value Types }

  {$EXTERNALSYM REG_NONE}
  REG_NONE                    = 0;
  {$EXTERNALSYM REG_SZ}
  REG_SZ                      = 1;
  {$EXTERNALSYM REG_EXPAND_SZ}
  REG_EXPAND_SZ               = 2;
  {$EXTERNALSYM REG_BINARY}
  REG_BINARY                  = 3;
  {$EXTERNALSYM REG_DWORD}
  REG_DWORD                   = 4;
  {$EXTERNALSYM REG_DWORD_LITTLE_ENDIAN}
  REG_DWORD_LITTLE_ENDIAN     = 4;
  {$EXTERNALSYM REG_DWORD_BIG_ENDIAN}
  REG_DWORD_BIG_ENDIAN        = 5;
  {$EXTERNALSYM REG_LINK}
  REG_LINK                    = 6;
  {$EXTERNALSYM REG_MULTI_SZ}
  REG_MULTI_SZ                = 7;
  {$EXTERNALSYM REG_RESOURCE_LIST}
  REG_RESOURCE_LIST           = 8;
  {$EXTERNALSYM REG_FULL_RESOURCE_DESCRIPTOR}
  REG_FULL_RESOURCE_DESCRIPTOR = 9;
  {$EXTERNALSYM REG_RESOURCE_REQUIREMENTS_LIST}
  REG_RESOURCE_REQUIREMENTS_LIST = 10;

{ END Translated from WINNT.H }

type
  {$EXTERNALSYM WPARAM}
  WPARAM = Longint;
  {$EXTERNALSYM LPARAM}
  LPARAM = Longint;
  {$EXTERNALSYM LRESULT}
  LRESULT = Longint;

function MakeWord(a, b: Byte): Word;
function MakeLong(a, b: Word): Longint;

type
  {$EXTERNALSYM LOWORD}
  LOWORD = Word;

function HiWord(l: DWORD): Word;

type
  {$EXTERNALSYM LOBYTE}
  LOBYTE = Byte;

function HiByte(W: Word): Byte;

type
  {$EXTERNALSYM HWND}
  HWND = type LongWord;
  {$EXTERNALSYM HHOOK}
  HHOOK = type LongWord;

  {$EXTERNALSYM ATOM}
  ATOM = Word;
  TAtom = Word;

  {$EXTERNALSYM HGLOBAL}
  HGLOBAL = THandle;
  {$EXTERNALSYM HLOCAL}
  HLOCAL = THandle;
  {$EXTERNALSYM FARPROC}
  FARPROC = Pointer;
  TFarProc = Pointer;
  PROC_22 = Pointer;


  {$EXTERNALSYM HGDIOBJ}
  HGDIOBJ = type LongWord;
  {$EXTERNALSYM HACCEL}
  HACCEL = type LongWord;
  {$EXTERNALSYM HBITMAP}
  HBITMAP = type LongWord;
  {$EXTERNALSYM HBRUSH}
  HBRUSH = type LongWord;
  {$EXTERNALSYM HCOLORSPACE}
  HCOLORSPACE = type LongWord;
  {$EXTERNALSYM HDC}
  HDC = type LongWord;
  {$EXTERNALSYM HGLRC}
  HGLRC = type LongWord;
  {$EXTERNALSYM HDESK}
  HDESK = type LongWord;
  {$EXTERNALSYM HENHMETAFILE}
  HENHMETAFILE = type LongWord;
  {$EXTERNALSYM HFONT}
  HFONT = type LongWord;
  {$EXTERNALSYM HICON}
  HICON = type LongWord;
  {$EXTERNALSYM HMENU}
  HMENU = type LongWord;
  {$EXTERNALSYM HMETAFILE}
  HMETAFILE = type LongWord;
  HINST = type LongWord;
  {$EXTERNALSYM HMODULE}
  HMODULE = HINST;              { HMODULEs can be used in place of HINSTs }
  {$EXTERNALSYM HPALETTE}
  HPALETTE = type LongWord;
  {$EXTERNALSYM HPEN}
  HPEN = type LongWord;
  {$EXTERNALSYM HRGN}
  HRGN = type LongWord;
  {$EXTERNALSYM HRSRC}
  HRSRC = type LongWord;
  {$EXTERNALSYM HSTR}
  HSTR = type LongWord;
  {$EXTERNALSYM HTASK}
  HTASK = type LongWord;
  {$EXTERNALSYM HWINSTA}
  HWINSTA = type LongWord;
  {$EXTERNALSYM HKL}
  HKL = type LongWord;


  {$EXTERNALSYM HFILE}
  HFILE = LongWord;
  {$EXTERNALSYM HCURSOR}
  HCURSOR = HICON;              { HICONs & HCURSORs are polymorphic }

  {$EXTERNALSYM COLORREF}
  COLORREF = DWORD;
  TColorRef = DWORD;

const
  {$EXTERNALSYM HFILE_ERROR}
  HFILE_ERROR = HFILE(-1);

type
  PPoint = ^TPoint;
  TPoint = record
    x: Longint;
    y: Longint;
  end;
  {$NODEFINE TPoint}
  tagPOINT = TPoint;
  {$NODEFINE tagPOINT}

  PRect = ^TRect;

  TRect = record
    case Integer of
      0: (Left, Top, Right, Bottom: Integer);
      1: (TopLeft, BottomRight: TPoint);
  end;
  {$NODEFINE TRect}

  (*$HPPEMIT 'namespace Windows'*)
  (*$HPPEMIT '{'*)
  (*$HPPEMIT '  struct TRect'*)
  (*$HPPEMIT '  {'*)
  (*$HPPEMIT '          TRect() {}'*)
  (*$HPPEMIT '          TRect(RECT& r)'*)
  (*$HPPEMIT '          {'*)
  (*$HPPEMIT '                  Left    = r.left;'*)
  (*$HPPEMIT '                  Top     = r.top;'*)
  (*$HPPEMIT '                  Right   = r.right;'*)
  (*$HPPEMIT '                  Bottom  = r.bottom;'*)
  (*$HPPEMIT '          }'*)
  (*$HPPEMIT '          operator RECT()'*)
  (*$HPPEMIT '          {'*)
  (*$HPPEMIT '                  RECT r;'*)
  (*$HPPEMIT '                  r.left     = Left;'*)
  (*$HPPEMIT '                  r.top      = Top;'*)
  (*$HPPEMIT '                  r.right    = Right;'*)
  (*$HPPEMIT '                  r.bottom   = Bottom;'*)
  (*$HPPEMIT '                  return r;'*)
  (*$HPPEMIT '          }'*)
  (*$HPPEMIT '          union'*)
  (*$HPPEMIT '          {'*)
  (*$HPPEMIT '                  struct'*)
  (*$HPPEMIT '                  {'*)
  (*$HPPEMIT '                          POINT TopLeft;'*)
  (*$HPPEMIT '                          POINT BottomRight;'*)
  (*$HPPEMIT '                  };'*)
  (*$HPPEMIT '                  struct'*)
  (*$HPPEMIT '                  {'*)
  (*$HPPEMIT '                          int Left;'*)
  (*$HPPEMIT '                          int Top;'*)
  (*$HPPEMIT '                          int Right;'*)
  (*$HPPEMIT '                          int Bottom;'*)
  (*$HPPEMIT '                  };'*)
  (*$HPPEMIT '          };'*)
  (*$HPPEMIT '  };'*)
  (*$HPPEMIT '} /* namespace Windows */'*)

  {$EXTERNALSYM _POINTL}
  _POINTL = packed record      { ptl }
    x: Longint;
    y: Longint;
  end;
  PPointL = ^TPointL;
  TPointL = _POINTL;

  PSize = ^TSize;
  {$EXTERNALSYM tagSIZE}
  tagSIZE = record
    cx: Longint;
    cy: Longint;
  end;
  TSize = tagSIZE;
  {$EXTERNALSYM SIZE}
  SIZE = tagSIZE;

  PSmallPoint = ^TSmallPoint;
  TSmallPoint = record
    x: SHORT;
    y: SHORT;
  end;

{ Translated from WINBASE.H }

{ Compatiblity functions and procedures }

{$EXTERNALSYM DefineHandleTable}
function DefineHandleTable(Offset: Word): Bool;
{$EXTERNALSYM LimitEmsPages}
procedure LimitEmsPages(Kbytes: Longint);
{$EXTERNALSYM SetSwapAreaSize}
function SetSwapAreaSize(Size: Word): Longint;
{$EXTERNALSYM LockSegment}
procedure LockSegment(Segment: THandle);
{$EXTERNALSYM UnlockSegment}
procedure UnlockSegment(Segment: THandle);
{$EXTERNALSYM GetCurrentTime}
function GetCurrentTime: Longint;
{$EXTERNALSYM Yield}
function Yield: Bool;

const
  {$EXTERNALSYM INVALID_HANDLE_VALUE}
  INVALID_HANDLE_VALUE = DWORD(-1);
  {$EXTERNALSYM INVALID_FILE_SIZE}
  INVALID_FILE_SIZE = DWORD($FFFFFFFF);

  {$EXTERNALSYM FILE_BEGIN}
  FILE_BEGIN = 0;
  {$EXTERNALSYM FILE_CURRENT}
  FILE_CURRENT = 1;
  {$EXTERNALSYM FILE_END}
  FILE_END = 2;

  {$EXTERNALSYM TIME_ZONE_ID_INVALID}
  TIME_ZONE_ID_INVALID = DWORD($FFFFFFFF);
  {$EXTERNALSYM TIME_ZONE_ID_UNKNOWN}
  TIME_ZONE_ID_UNKNOWN  = 0;
  {$EXTERNALSYM TIME_ZONE_ID_STANDARD}
  TIME_ZONE_ID_STANDARD = 1;
  {$EXTERNALSYM TIME_ZONE_ID_DAYLIGHT}
  TIME_ZONE_ID_DAYLIGHT = 2;


  {$EXTERNALSYM WAIT_FAILED}
  WAIT_FAILED  = DWORD($FFFFFFFF);
  {$EXTERNALSYM WAIT_OBJECT_0}
  WAIT_OBJECT_0 = ((STATUS_WAIT_0 ) + 0 );

  {$EXTERNALSYM WAIT_ABANDONED}
  WAIT_ABANDONED = ((STATUS_ABANDONED_WAIT_0 ) + 0 );
  {$EXTERNALSYM WAIT_ABANDONED_0}
  WAIT_ABANDONED_0 = ((STATUS_ABANDONED_WAIT_0 ) + 0 );

  {$EXTERNALSYM WAIT_TIMEOUT}
  WAIT_TIMEOUT = STATUS_TIMEOUT;
  {$EXTERNALSYM WAIT_IO_COMPLETION}
  WAIT_IO_COMPLETION = STATUS_USER_APC;
  {$EXTERNALSYM STILL_ACTIVE}
  STILL_ACTIVE = STATUS_PENDING;
  {$EXTERNALSYM EXCEPTION_ACCESS_VIOLATION}
  EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION;
  {$EXTERNALSYM EXCEPTION_DATATYPE_MISALIGNMENT}
  EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT;
  {$EXTERNALSYM EXCEPTION_BREAKPOINT}
  EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT;
  {$EXTERNALSYM EXCEPTION_SINGLE_STEP}
  EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP;
  {$EXTERNALSYM EXCEPTION_ARRAY_BOUNDS_EXCEEDED}
  EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED;
  {$EXTERNALSYM EXCEPTION_FLT_DENORMAL_OPERAND}
  EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND;
  {$EXTERNALSYM EXCEPTION_FLT_DIVIDE_BY_ZERO}
  EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO;
  {$EXTERNALSYM EXCEPTION_FLT_INEXACT_RESULT}
  EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT;
  {$EXTERNALSYM EXCEPTION_FLT_INVALID_OPERATION}
  EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION;
  {$EXTERNALSYM EXCEPTION_FLT_OVERFLOW}
  EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW;
  {$EXTERNALSYM EXCEPTION_FLT_STACK_CHECK}
  EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK;
  {$EXTERNALSYM EXCEPTION_FLT_UNDERFLOW}
  EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW;
  {$EXTERNALSYM EXCEPTION_INT_DIVIDE_BY_ZERO}
  EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO;
  {$EXTERNALSYM EXCEPTION_INT_OVERFLOW}
  EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW;
  {$EXTERNALSYM EXCEPTION_PRIV_INSTRUCTION}
  EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION;
  {$EXTERNALSYM EXCEPTION_IN_PAGE_ERROR}
  EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR;
  {$EXTERNALSYM EXCEPTION_ILLEGAL_INSTRUCTION}
  EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION;
  {$EXTERNALSYM EXCEPTION_NONCONTINUABLE_EXCEPTION}
  EXCEPTION_NONCONTINUABLE_EXCEPTION = STATUS_NONCONTINUABLE_EXCEPTION;
  {$EXTERNALSYM EXCEPTION_STACK_OVERFLOW}
  EXCEPTION_STACK_OVERFLOW = STATUS_STACK_OVERFLOW;
  {$EXTERNALSYM EXCEPTION_INVALID_DISPOSITION}
  EXCEPTION_INVALID_DISPOSITION = STATUS_INVALID_DISPOSITION;
  {$EXTERNALSYM EXCEPTION_GUARD_PAGE}
  EXCEPTION_GUARD_PAGE = STATUS_GUARD_PAGE_VIOLATION;
  {$EXTERNALSYM EXCEPTION_INVALID_HANDLE}
  EXCEPTION_INVALID_HANDLE = STATUS_INVALID_HANDLE;
  {$EXTERNALSYM CONTROL_C_EXIT}
  CONTROL_C_EXIT = STATUS_CONTROL_C_EXIT;

{$EXTERNALSYM MoveMemory}
procedure MoveMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
{$EXTERNALSYM CopyMemory}
procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
{$EXTERNALSYM FillMemory}
procedure FillMemory(Destination: Pointer; Length: DWORD; Fill: Byte);
{$EXTERNALSYM ZeroMemory}
procedure ZeroMemory(Destination: Pointer; Length: DWORD);

const
  { File creation flags must start at the high end since they }
  { are combined with the attributes}

  {$EXTERNALSYM FILE_FLAG_WRITE_THROUGH}
  FILE_FLAG_WRITE_THROUGH = DWORD($80000000);
  {$EXTERNALSYM FILE_FLAG_OVERLAPPED}
  FILE_FLAG_OVERLAPPED = $40000000;
  {$EXTERNALSYM FILE_FLAG_NO_BUFFERING}
  FILE_FLAG_NO_BUFFERING = $20000000;
  {$EXTERNALSYM FILE_FLAG_RANDOM_ACCESS}
  FILE_FLAG_RANDOM_ACCESS = $10000000;
  {$EXTERNALSYM FILE_FLAG_SEQUENTIAL_SCAN}
  FILE_FLAG_SEQUENTIAL_SCAN = $8000000;
  {$EXTERNALSYM FILE_FLAG_DELETE_ON_CLOSE}
  FILE_FLAG_DELETE_ON_CLOSE = $4000000;
  {$EXTERNALSYM FILE_FLAG_BACKUP_SEMANTICS}
  FILE_FLAG_BACKUP_SEMANTICS = $2000000;
  {$EXTERNALSYM FILE_FLAG_POSIX_SEMANTICS}
  FILE_FLAG_POSIX_SEMANTICS = $1000000;

  {$EXTERNALSYM CREATE_NEW}
  CREATE_NEW = 1;
  {$EXTERNALSYM CREATE_ALWAYS}
  CREATE_ALWAYS = 2;
  {$EXTERNALSYM OPEN_EXISTING}
  OPEN_EXISTING = 3;
  {$EXTERNALSYM OPEN_ALWAYS}
  OPEN_ALWAYS = 4;
  {$EXTERNALSYM TRUNCATE_EXISTING}
  TRUNCATE_EXISTING = 5;


{ Define possible return codes from the CopyFileEx callback routine }

  {$EXTERNALSYM PROGRESS_CONTINUE}
  PROGRESS_CONTINUE = 0;
  {$EXTERNALSYM PROGRESS_CANCEL}
  PROGRESS_CANCEL = 1;
  {$EXTERNALSYM PROGRESS_STOP}
  PROGRESS_STOP = 2;
  {$EXTERNALSYM PROGRESS_QUIET}
  PROGRESS_QUIET = 3;


{ Define CopyFileEx callback routine state change values }

  {$EXTERNALSYM CALLBACK_CHUNK_FINISHED}
  CALLBACK_CHUNK_FINISHED = $00000000;
  {$EXTERNALSYM CALLBACK_STREAM_SWITCH}
  CALLBACK_STREAM_SWITCH = $00000001;


{ Define CopyFileEx option flags }

  {$EXTERNALSYM COPY_FILE_FAIL_IF_EXISTS}
  COPY_FILE_FAIL_IF_EXISTS = $00000001;
  {$EXTERNALSYM COPY_FILE_RESTARTABLE}
  COPY_FILE_RESTARTABLE = $00000002;


{ Define the NamedPipe definitions}

  { Define the dwOpenMode values for CreateNamedPipe }

  {$EXTERNALSYM PIPE_ACCESS_INBOUND}
  PIPE_ACCESS_INBOUND = 1;
  {$EXTERNALSYM PIPE_ACCESS_OUTBOUND}
  PIPE_ACCESS_OUTBOUND = 2;
  {$EXTERNALSYM PIPE_ACCESS_DUPLEX}
  PIPE_ACCESS_DUPLEX = 3;

  { Define the Named Pipe End flags for GetNamedPipeInfo }

  {$EXTERNALSYM PIPE_CLIENT_END}
  PIPE_CLIENT_END = 0;
  {$EXTERNALSYM PIPE_SERVER_END}
  PIPE_SERVER_END = 1;

  { Define the dwPipeMode values for CreateNamedPipe }

  {$EXTERNALSYM PIPE_WAIT}
  PIPE_WAIT = 0;
  {$EXTERNALSYM PIPE_NOWAIT}
  PIPE_NOWAIT = 1;
  {$EXTERNALSYM PIPE_READMODE_BYTE}
  PIPE_READMODE_BYTE = 0;
  {$EXTERNALSYM PIPE_READMODE_MESSAGE}
  PIPE_READMODE_MESSAGE = 2;
  {$EXTERNALSYM PIPE_TYPE_BYTE}
  PIPE_TYPE_BYTE = 0;
  {$EXTERNALSYM PIPE_TYPE_MESSAGE}
  PIPE_TYPE_MESSAGE = 4;

  { Define the well known values for CreateNamedPipe nMaxInstances }

  {$EXTERNALSYM PIPE_UNLIMITED_INSTANCES}
  PIPE_UNLIMITED_INSTANCES = 255;

  { Define the Security Quality of Service bits to be passed into CreateFile }

  {$EXTERNALSYM SECURITY_ANONYMOUS}
  SECURITY_ANONYMOUS = (Ord(SecurityAnonymous) shl 16);
  {$EXTERNALSYM SECURITY_IDENTIFICATION}
  SECURITY_IDENTIFICATION = (Ord(SecurityIdentification) shl 16);
  {$EXTERNALSYM SECURITY_IMPERSONATION}
  SECURITY_IMPERSONATION = (Ord(SecurityImpersonation) shl 16);
  {$EXTERNALSYM SECURITY_DELEGATION}
  SECURITY_DELEGATION = (Ord(SecurityDelegation) shl 16);

  {$EXTERNALSYM SECURITY_CONTEXT_TRACKING}
  SECURITY_CONTEXT_TRACKING = $40000;
  {$EXTERNALSYM SECURITY_EFFECTIVE_ONLY}
  SECURITY_EFFECTIVE_ONLY = $80000;

  {$EXTERNALSYM SECURITY_SQOS_PRESENT}
  SECURITY_SQOS_PRESENT = $100000;
  {$EXTERNALSYM SECURITY_VALID_SQOS_FLAGS}
  SECURITY_VALID_SQOS_FLAGS = $1F0000;

{ File structures }

type
  POverlapped = ^TOverlapped;
  {$EXTERNALSYM _OVERLAPPED}
  _OVERLAPPED = record
    Internal: DWORD;
    InternalHigh: DWORD;
    Offset: DWORD;
    OffsetHigh: DWORD;
    hEvent: THandle;
  end;
  TOverlapped = _OVERLAPPED;
  {$EXTERNALSYM OVERLAPPED}
  OVERLAPPED = _OVERLAPPED;

  PSecurityAttributes = ^TSecurityAttributes;
  {$EXTERNALSYM _SECURITY_ATTRIBUTES}
  _SECURITY_ATTRIBUTES = record
    nLength: DWORD;
    lpSecurityDescriptor: Pointer;
    bInheritHandle: BOOL;
  end;
  TSecurityAttributes = _SECURITY_ATTRIBUTES;
  {$EXTERNALSYM SECURITY_ATTRIBUTES}
  SECURITY_ATTRIBUTES = _SECURITY_ATTRIBUTES;

  PProcessInformation = ^TProcessInformation;
  {$EXTERNALSYM _PROCESS_INFORMATION}
  _PROCESS_INFORMATION = record
    hProcess: THandle;
    hThread: THandle;
    dwProcessId: DWORD;
    dwThreadId: DWORD;
  end;
  TProcessInformation = _PROCESS_INFORMATION;
  {$EXTERNALSYM PROCESS_INFORMATION}
  PROCESS_INFORMATION = _PROCESS_INFORMATION;

  { File System time stamps are represented with the following structure: }
  PFileTime = ^TFileTime;
  {$EXTERNALSYM _FILETIME}
  _FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;
  TFileTime = _FILETIME;
  {$EXTERNALSYM FILETIME}
  FILETIME = _FILETIME;

  { System time is represented with the following structure: }
  PSystemTime = ^TSystemTime;
  {$EXTERNALSYM _SYSTEMTIME}
  _SYSTEMTIME = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;
  TSystemTime = _SYSTEMTIME;
  {$EXTERNALSYM SYSTEMTIME}
  SYSTEMTIME = _SYSTEMTIME;

  TFNThreadStartRoutine = TFarProc;
  TFNFiberStartRoutine = TFarProc;

const
  {$EXTERNALSYM MUTEX_MODIFY_STATE}
  MUTEX_MODIFY_STATE = MUTANT_QUERY_STATE;
  {$EXTERNALSYM MUTEX_ALL_ACCESS}
  MUTEX_ALL_ACCESS = MUTANT_ALL_ACCESS;

  { Serial provider type. }

  {$EXTERNALSYM SP_SERIALCOMM}
  SP_SERIALCOMM = $00000001;

  { Provider SubTypes }

  {$EXTERNALSYM PST_UNSPECIFIED}
  PST_UNSPECIFIED = $00000000;
  {$EXTERNALSYM PST_RS232}
  PST_RS232 = $00000001;
  {$EXTERNALSYM PST_PARALLELPORT}
  PST_PARALLELPORT = $00000002;
  {$EXTERNALSYM PST_RS422}
  PST_RS422 = $00000003;
  {$EXTERNALSYM PST_RS423}
  PST_RS423 = $00000004;
  {$EXTERNALSYM PST_RS449}
  PST_RS449 = $00000005;
  {$EXTERNALSYM PST_MODEM}
  PST_MODEM = $00000006;
  {$EXTERNALSYM PST_FAX}
  PST_FAX = $00000021;
  {$EXTERNALSYM PST_SCANNER}
  PST_SCANNER = $00000022;
  {$EXTERNALSYM PST_NETWORK_BRIDGE}
  PST_NETWORK_BRIDGE = $00000100;
  {$EXTERNALSYM PST_LAT}
  PST_LAT = $00000101;
  {$EXTERNALSYM PST_TCPIP_TELNET}
  PST_TCPIP_TELNET = $00000102;
  {$EXTERNALSYM PST_X25}
  PST_X25 = $00000103;

  { Provider capabilities flags. }

  {$EXTERNALSYM PCF_DTRDSR}
  PCF_DTRDSR = $0001;
  {$EXTERNALSYM PCF_RTSCTS}
  PCF_RTSCTS = $0002;
  {$EXTERNALSYM PCF_RLSD}
  PCF_RLSD = $0004;
  {$EXTERNALSYM PCF_PARITY_CHECK}
  PCF_PARITY_CHECK = $0008;
  {$EXTERNALSYM PCF_XONXOFF}
  PCF_XONXOFF = $0010;
  {$EXTERNALSYM PCF_SETXCHAR}
  PCF_SETXCHAR = $0020;
  {$EXTERNALSYM PCF_TOTALTIMEOUTS}
  PCF_TOTALTIMEOUTS = $0040;
  {$EXTERNALSYM PCF_INTTIMEOUTS}
  PCF_INTTIMEOUTS = $0080;
  {$EXTERNALSYM PCF_SPECIALCHARS}
  PCF_SPECIALCHARS = $0100;
  {$EXTERNALSYM PCF_16BITMODE}
  PCF_16BITMODE = $0200;

  { Comm provider settable parameters. }

  {$EXTERNALSYM SP_PARITY}
  SP_PARITY = $0001;
  {$EXTERNALSYM SP_BAUD}
  SP_BAUD = $0002;
  {$EXTERNALSYM SP_DATABITS}
  SP_DATABITS = $0004;
  {$EXTERNALSYM SP_STOPBITS}
  SP_STOPBITS = $0008;
  {$EXTERNALSYM SP_HANDSHAKING}
  SP_HANDSHAKING = $0010;
  {$EXTERNALSYM SP_PARITY_CHECK}
  SP_PARITY_CHECK = $0020;
  {$EXTERNALSYM SP_RLSD}
  SP_RLSD = $0040;

  { Settable baud rates in the provider. }

  {$EXTERNALSYM BAUD_075}
  BAUD_075 = $00000001;
  {$EXTERNALSYM BAUD_110}
  BAUD_110 = $00000002;
  {$EXTERNALSYM BAUD_134_5}
  BAUD_134_5 = $00000004;
  {$EXTERNALSYM BAUD_150}
  BAUD_150 = $00000008;
  {$EXTERNALSYM BAUD_300}
  BAUD_300 = $00000010;
  {$EXTERNALSYM BAUD_600}
  BAUD_600 = $00000020;
  {$EXTERNALSYM BAUD_1200}
  BAUD_1200 = $00000040;
  {$EXTERNALSYM BAUD_1800}
  BAUD_1800 = $00000080;
  {$EXTERNALSYM BAUD_2400}
  BAUD_2400 = $00000100;
  {$EXTERNALSYM BAUD_4800}
  BAUD_4800 = $00000200;
  {$EXTERNALSYM BAUD_7200}
  BAUD_7200 = $00000400;
  {$EXTERNALSYM BAUD_9600}
  BAUD_9600 = $00000800;
  {$EXTERNALSYM BAUD_14400}
  BAUD_14400 = $00001000;
  {$EXTERNALSYM BAUD_19200}
  BAUD_19200 = $00002000;
  {$EXTERNALSYM BAUD_38400}
  BAUD_38400 = $00004000;
  {$EXTERNALSYM BAUD_56K}
  BAUD_56K = $00008000;
  {$EXTERNALSYM BAUD_128K}
  BAUD_128K = $00010000;
  {$EXTERNALSYM BAUD_115200}
  BAUD_115200 = $00020000;
  {$EXTERNALSYM BAUD_57600}
  BAUD_57600 = $00040000;
  {$EXTERNALSYM BAUD_USER}
  BAUD_USER = $10000000;

  { Settable Data Bits }

  {$EXTERNALSYM DATABITS_5}
  DATABITS_5 = $0001;
  {$EXTERNALSYM DATABITS_6}
  DATABITS_6 = $0002;
  {$EXTERNALSYM DATABITS_7}
  DATABITS_7 = $0004;
  {$EXTERNALSYM DATABITS_8}
  DATABITS_8 = $0008;
  {$EXTERNALSYM DATABITS_16}
  DATABITS_16 = $0010;
  {$EXTERNALSYM DATABITS_16X}
  DATABITS_16X = $0020;

  { Settable Stop and Parity bits. }

  {$EXTERNALSYM STOPBITS_10}
  STOPBITS_10 = $0001;
  {$EXTERNALSYM STOPBITS_15}
  STOPBITS_15 = $0002;
  {$EXTERNALSYM STOPBITS_20}
  STOPBITS_20 = $0004;
  {$EXTERNALSYM PARITY_NONE}
  PARITY_NONE = $0100;
  {$EXTERNALSYM PARITY_ODD}
  PARITY_ODD = $0200;
  {$EXTERNALSYM PARITY_EVEN}
  PARITY_EVEN = $0400;
  {$EXTERNALSYM PARITY_MARK}
  PARITY_MARK = $0800;
  {$EXTERNALSYM PARITY_SPACE}
  PARITY_SPACE = $1000;

type
  PCommProp = ^TCommProp;
  {$EXTERNALSYM _COMMPROP}
  _COMMPROP = record
    wPacketLength: Word;
    wPacketVersion: Word;
    dwServiceMask: DWORD;
    dwReserved1: DWORD;
    dwMaxTxQueue: DWORD;
    dwMaxRxQueue: DWORD;
    dwMaxBaud: DWORD;
    dwProvSubType: DWORD;
    dwProvCapabilities: DWORD;
    dwSettableParams: DWORD;
    dwSettableBaud: DWORD;
    wSettableData: Word;
    wSettableStopParity: Word;
    dwCurrentTxQueue: DWORD;
    dwCurrentRxQueue: DWORD;
    dwProvSpec1: DWORD;
    dwProvSpec2: DWORD;
    wcProvChar: array[0..0] of WCHAR;
  end;
  TCommProp = _COMMPROP;
  {$EXTERNALSYM COMMPROP}
  COMMPROP = _COMMPROP;

  { Set dwProvSpec1 to COMMPROP_INITIALIZED to indicate that wPacketLength
    is valid before a call to GetCommProperties(). }
const
  {$EXTERNALSYM COMMPROP_INITIALIZED}
  COMMPROP_INITIALIZED = DWORD($E73CF52E);

type
  TComStateFlag = (fCtlHold, fDsrHold, fRlsHold, fXoffHold, fXOffSent, fEof,
    fTxim);  // not in Windows Headers
  TComStateFlags = set of TComStateFlag;
  {$EXTERNALSYM _COMSTAT}
  _COMSTAT = record
    Flags: TComStateFlags;
    Reserved: array[0..2] of Byte;
    cbInQue: DWORD;
    cbOutQue: DWORD;
  end;
  TComStat = _COMSTAT;
  {$EXTERNALSYM COMSTAT}
  COMSTAT = _COMSTAT;
  PComStat = ^TComStat;

const
  { DTR Control Flow Values. }
  {$EXTERNALSYM DTR_CONTROL_DISABLE}
  DTR_CONTROL_DISABLE = 0;
  {$EXTERNALSYM DTR_CONTROL_ENABLE}
  DTR_CONTROL_ENABLE = 1;
  {$EXTERNALSYM DTR_CONTROL_HANDSHAKE}
  DTR_CONTROL_HANDSHAKE = 2;

  { RTS Control Flow Values}
  {$EXTERNALSYM RTS_CONTROL_DISABLE}
  RTS_CONTROL_DISABLE = 0;
  {$EXTERNALSYM RTS_CONTROL_ENABLE}
  RTS_CONTROL_ENABLE = 1;
  {$EXTERNALSYM RTS_CONTROL_HANDSHAKE}
  RTS_CONTROL_HANDSHAKE = 2;
  {$EXTERNALSYM RTS_CONTROL_TOGGLE}
  RTS_CONTROL_TOGGLE = 3;

type
  {$EXTERNALSYM _DCB}
  _DCB = packed record
    DCBlength: DWORD;
    BaudRate: DWORD;
    Flags: Longint;
    wReserved: Word;
    XonLim: Word;
    XoffLim: Word;
    ByteSize: Byte;
    Parity: Byte;
    StopBits: Byte;
    XonChar: CHAR;
    XoffChar: CHAR;
    ErrorChar: CHAR;
    EofChar: CHAR;
    EvtChar: CHAR;
    wReserved1: Word;
  end;
  TDCB = _DCB;
  {$EXTERNALSYM DCB}
  DCB = _DCB;
  PDCB = ^TDCB;

  PCommTimeouts = ^TCommTimeouts;
  {$EXTERNALSYM _COMMTIMEOUTS}
  _COMMTIMEOUTS = record
    ReadIntervalTimeout: DWORD;
    ReadTotalTimeoutMultiplier: DWORD;
    ReadTotalTimeoutConstant: DWORD;
    WriteTotalTimeoutMultiplier: DWORD;
    WriteTotalTimeoutConstant: DWORD;
  end;
  TCommTimeouts = _COMMTIMEOUTS;
  {$EXTERNALSYM COMMTIMEOUTS}
  COMMTIMEOUTS = _COMMTIMEOUTS;

  PCommConfig = ^TCommConfig;
  {$EXTERNALSYM _COMMCONFIG}
  _COMMCONFIG = record
    dwSize: DWORD;
    wVersion: Word;
    wReserved: Word;
    dcb: TDCB;
    dwProviderSubType: DWORD;
    dwProviderOffset: DWORD;
    dwProviderSize: DWORD;
    wcProviderData: array[0..0] of WCHAR;
  end;
  TCommConfig = _COMMCONFIG;
  {$EXTERNALSYM COMMCONFIG}
  COMMCONFIG = _COMMCONFIG;

  PSystemInfo = ^TSystemInfo;
  {$EXTERNALSYM _SYSTEM_INFO}
  _SYSTEM_INFO = record
    case Integer of
      0: (
        dwOemId: DWORD);
      1: (
        wProcessorArchitecture: Word;
        wReserved: Word;
        dwPageSize: DWORD;
        lpMinimumApplicationAddress: Pointer;
        lpMaximumApplicationAddress: Pointer;
        dwActiveProcessorMask: DWORD;
        dwNumberOfProcessors: DWORD;
        dwProcessorType: DWORD;
        dwAllocationGranularity: DWORD;
        wProcessorLevel: Word;
        wProcessorRevision: Word);
  end;
  TSystemInfo = _SYSTEM_INFO;
  {$EXTERNALSYM SYSTEM_INFO}
  SYSTEM_INFO = _SYSTEM_INFO;

{$EXTERNALSYM FreeModule}
function FreeModule(var hLibModule: HINST): BOOL;
{$EXTERNALSYM MakeProcInstance}
function MakeProcInstance(Proc: FARPROC; Instance: THandle): FARPROC;
{$EXTERNALSYM FreeProcInstance}
procedure FreeProcInstance(Proc: FARPROC);


const
  { Global Memory Flags }

  {$EXTERNALSYM GMEM_FIXED}
  GMEM_FIXED = 0;
  {$EXTERNALSYM GMEM_MOVEABLE}
  GMEM_MOVEABLE = 2;
  {$EXTERNALSYM GMEM_NOCOMPACT}
  GMEM_NOCOMPACT = $10;
  {$EXTERNALSYM GMEM_NODISCARD}
  GMEM_NODISCARD = $20;
  {$EXTERNALSYM GMEM_ZEROINIT}
  GMEM_ZEROINIT = $40;
  {$EXTERNALSYM GMEM_MODIFY}
  GMEM_MODIFY = $80;
  {$EXTERNALSYM GMEM_DISCARDABLE}
  GMEM_DISCARDABLE = $100;
  {$EXTERNALSYM GMEM_NOT_BANKED}
  GMEM_NOT_BANKED = $1000;
  {$EXTERNALSYM GMEM_SHARE}
  GMEM_SHARE = $2000;
  {$EXTERNALSYM GMEM_DDESHARE}
  GMEM_DDESHARE = $2000;
  {$EXTERNALSYM GMEM_NOTIFY}
  GMEM_NOTIFY = $4000;
  {$EXTERNALSYM GMEM_LOWER}
  GMEM_LOWER = GMEM_NOT_BANKED;
  {$EXTERNALSYM GMEM_VALID_FLAGS}
  GMEM_VALID_FLAGS = 32626;
  {$EXTERNALSYM GMEM_INVALID_HANDLE}
  GMEM_INVALID_HANDLE = $8000;

  {$EXTERNALSYM GHND}
  GHND = GMEM_MOVEABLE or GMEM_ZEROINIT;
  {$EXTERNALSYM GPTR}
  GPTR = GMEM_FIXED or GMEM_ZEROINIT;

{$EXTERNALSYM GlobalLRUNewest}
function GlobalLRUNewest(h: THandle): THandle;
{$EXTERNALSYM GlobalLRUOldest}
function GlobalLRUOldest(h: THandle): THandle;
{$EXTERNALSYM GlobalDiscard}
function GlobalDiscard(h: THandle): THandle;

{$EXTERNALSYM GlobalAllocPtr}
function GlobalAllocPtr(Flags: Integer; Bytes: Longint): Pointer;
{$EXTERNALSYM GlobalReAllocPtr}
function GlobalReAllocPtr(P: Pointer; Bytes: Longint; Flags: Integer): Pointer;
{$EXTERNALSYM GlobalFreePtr}
function GlobalFreePtr(P: Pointer): THandle;

const
  { Flags returned by GlobalFlags (in addition to GMEM_DISCARDABLE) }
  {$EXTERNALSYM GMEM_DISCARDED}
  GMEM_DISCARDED = $4000;
  {$EXTERNALSYM GMEM_LOCKCOUNT}
  GMEM_LOCKCOUNT = 255;

type
  PMemoryStatus = ^TMemoryStatus;
  {$EXTERNALSYM _MEMORYSTATUS}
  _MEMORYSTATUS = record
    dwLength: DWORD;
    dwMemoryLoad: DWORD;
    dwTotalPhys: DWORD;
    dwAvailPhys: DWORD;
    dwTotalPageFile: DWORD;
    dwAvailPageFile: DWORD;
    dwTotalVirtual: DWORD;
    dwAvailVirtual: DWORD;
  end;
  TMemoryStatus = _MEMORYSTATUS;
  {$EXTERNALSYM MEMORYSTATUS}
  MEMORYSTATUS = _MEMORYSTATUS;

const
  { Local Memory Flags }

  {$EXTERNALSYM LMEM_FIXED}
  LMEM_FIXED = 0;
  {$EXTERNALSYM LMEM_MOVEABLE}
  LMEM_MOVEABLE = 2;
  {$EXTERNALSYM LMEM_NOCOMPACT}
  LMEM_NOCOMPACT = $10;
  {$EXTERNALSYM LMEM_NODISCARD}
  LMEM_NODISCARD = $20;
  {$EXTERNALSYM LMEM_ZEROINIT}
  LMEM_ZEROINIT = $40;
  {$EXTERNALSYM LMEM_MODIFY}
  LMEM_MODIFY = $80;
  {$EXTERNALSYM LMEM_DISCARDABLE}
  LMEM_DISCARDABLE = $F00;
  {$EXTERNALSYM LMEM_VALID_FLAGS}
  LMEM_VALID_FLAGS = $F72;
  {$EXTERNALSYM LMEM_INVALID_HANDLE}
  LMEM_INVALID_HANDLE = $8000;

  {$EXTERNALSYM LHND}
  LHND = LMEM_MOVEABLE or LMEM_ZEROINIT;
  {$EXTERNALSYM LPTR}
  LPTR = LMEM_FIXED or LMEM_ZEROINIT;

  {$EXTERNALSYM NONZEROLPTR}
  NONZEROLPTR = LMEM_FIXED;


{$EXTERNALSYM LocalDiscard}
function LocalDiscard(h: THandle): THandle;

const
  { Flags returned by LocalFlags (in addition to LMEM_DISCARDABLE) }

  {$EXTERNALSYM LMEM_DISCARDED}
  LMEM_DISCARDED = $4000;
  {$EXTERNALSYM LMEM_LOCKCOUNT}
  LMEM_LOCKCOUNT = 255;

  { dwCreationFlag values }

{ dwCreationFlag values }


  {$EXTERNALSYM DEBUG_PROCESS}
  DEBUG_PROCESS                   = $00000001;
  {$EXTERNALSYM DEBUG_ONLY_THIS_PROCESS}
  DEBUG_ONLY_THIS_PROCESS         = $00000002;

  {$EXTERNALSYM CREATE_SUSPENDED}
  CREATE_SUSPENDED                = $00000004;

  {$EXTERNALSYM DETACHED_PROCESS}
  DETACHED_PROCESS                = $00000008;

  {$EXTERNALSYM CREATE_NEW_CONSOLE}
  CREATE_NEW_CONSOLE              = $00000010;

  {$EXTERNALSYM NORMAL_PRIORITY_CLASS}
  NORMAL_PRIORITY_CLASS           = $00000020;
  {$EXTERNALSYM IDLE_PRIORITY_CLASS}
  IDLE_PRIORITY_CLASS             = $00000040;
  {$EXTERNALSYM HIGH_PRIORITY_CLASS}
  HIGH_PRIORITY_CLASS             = $00000080;
  {$EXTERNALSYM REALTIME_PRIORITY_CLASS}
  REALTIME_PRIORITY_CLASS         = $00000100;

  {$EXTERNALSYM CREATE_NEW_PROCESS_GROUP}
  CREATE_NEW_PROCESS_GROUP        = $00000200;
  {$EXTERNALSYM CREATE_UNICODE_ENVIRONMENT}
  CREATE_UNICODE_ENVIRONMENT      = $00000400;

  {$EXTERNALSYM CREATE_SEPARATE_WOW_VDM}
  CREATE_SEPARATE_WOW_VDM         = $00000800;
  {$EXTERNALSYM CREATE_SHARED_WOW_VDM}
  CREATE_SHARED_WOW_VDM           = $00001000;
  {$EXTERNALSYM CREATE_FORCEDOS}
  CREATE_FORCEDOS                 = $00002000;

  {$EXTERNALSYM CREATE_DEFAULT_ERROR_MODE}
  CREATE_DEFAULT_ERROR_MODE       = $04000000;
  {$EXTERNALSYM CREATE_NO_WINDOW}
  CREATE_NO_WINDOW                = $08000000;

  {$EXTERNALSYM PROFILE_USER}
  PROFILE_USER                    = $10000000;
  {$EXTERNALSYM PROFILE_KERNEL}
  PROFILE_KERNEL                  = $20000000;
  {$EXTERNALSYM PROFILE_SERVER}
  PROFILE_SERVER                  = $40000000;

  {$EXTERNALSYM THREAD_PRIORITY_LOWEST}
  THREAD_PRIORITY_LOWEST              = THREAD_BASE_PRIORITY_MIN;
  {$EXTERNALSYM THREAD_PRIORITY_BELOW_NORMAL}
  THREAD_PRIORITY_BELOW_NORMAL        = THREAD_PRIORITY_LOWEST + 1;
  {$EXTERNALSYM THREAD_PRIORITY_NORMAL}
  THREAD_PRIORITY_NORMAL              = 0;
  {$EXTERNALSYM THREAD_PRIORITY_HIGHEST}
  THREAD_PRIORITY_HIGHEST             = THREAD_BASE_PRIORITY_MAX;
  {$EXTERNALSYM THREAD_PRIORITY_ABOVE_NORMAL}
  THREAD_PRIORITY_ABOVE_NORMAL        = THREAD_PRIORITY_HIGHEST - 1;
  {$EXTERNALSYM THREAD_PRIORITY_ERROR_RETURN}
  THREAD_PRIORITY_ERROR_RETURN        = MAXLONG;

  {$EXTERNALSYM THREAD_PRIORITY_TIME_CRITICAL}
  THREAD_PRIORITY_TIME_CRITICAL       = THREAD_BASE_PRIORITY_LOWRT;
  {$EXTERNALSYM THREAD_PRIORITY_IDLE}
  THREAD_PRIORITY_IDLE                = THREAD_BASE_PRIORITY_IDLE;

{ Debug APIs }

  {$EXTERNALSYM EXCEPTION_DEBUG_EVENT}
  EXCEPTION_DEBUG_EVENT = 1;
  {$EXTERNALSYM CREATE_THREAD_DEBUG_EVENT}
  CREATE_THREAD_DEBUG_EVENT = 2;
  {$EXTERNALSYM CREATE_PROCESS_DEBUG_EVENT}
  CREATE_PROCESS_DEBUG_EVENT = 3;
  {$EXTERNALSYM EXIT_THREAD_DEBUG_EVENT}
  EXIT_THREAD_DEBUG_EVENT = 4;
  {$EXTERNALSYM EXIT_PROCESS_DEBUG_EVENT}
  EXIT_PROCESS_DEBUG_EVENT = 5;
  {$EXTERNALSYM LOAD_DLL_DEBUG_EVENT}
  LOAD_DLL_DEBUG_EVENT = 6;
  {$EXTERNALSYM UNLOAD_DLL_DEBUG_EVENT}
  UNLOAD_DLL_DEBUG_EVENT = 7;
  {$EXTERNALSYM OUTPUT_DEBUG_STRING_EVENT}
  OUTPUT_DEBUG_STRING_EVENT = 8;
  {$EXTERNALSYM RIP_EVENT}
  RIP_EVENT = 9;

type
  PExceptionDebugInfo = ^TExceptionDebugInfo;
  {$EXTERNALSYM _EXCEPTION_DEBUG_INFO}
  _EXCEPTION_DEBUG_INFO = record
    ExceptionRecord: TExceptionRecord;
    dwFirstChance: DWORD;
  end;
  TExceptionDebugInfo = _EXCEPTION_DEBUG_INFO;
  {$EXTERNALSYM EXCEPTION_DEBUG_INFO}
  EXCEPTION_DEBUG_INFO = _EXCEPTION_DEBUG_INFO;

  PCreateThreadDebugInfo = ^TCreateThreadDebugInfo;
  {$EXTERNALSYM _CREATE_THREAD_DEBUG_INFO}
  _CREATE_THREAD_DEBUG_INFO = record
    hThread: THandle;
    lpThreadLocalBase: Pointer;
    lpStartAddress: TFNThreadStartRoutine;
  end;
  TCreateThreadDebugInfo = _CREATE_THREAD_DEBUG_INFO;
  {$EXTERNALSYM CREATE_THREAD_DEBUG_INFO}
  CREATE_THREAD_DEBUG_INFO = _CREATE_THREAD_DEBUG_INFO;

  PCreateProcessDebugInfo = ^TCreateProcessDebugInfo;
  {$EXTERNALSYM _CREATE_PROCESS_DEBUG_INFO}
  _CREATE_PROCESS_DEBUG_INFO = record
    hFile: THandle;
    hProcess: THandle;
    hThread: THandle;
    lpBaseOfImage: Pointer;
    dwDebugInfoFileOffset: DWORD;
    nDebugInfoSize: DWORD;
    lpThreadLocalBase: Pointer;
    lpStartAddress: TFNThreadStartRoutine;
    lpImageName: Pointer;
    fUnicode: Word;
  end;
  TCreateProcessDebugInfo = _CREATE_PROCESS_DEBUG_INFO;
  {$EXTERNALSYM CREATE_PROCESS_DEBUG_INFO}
  CREATE_PROCESS_DEBUG_INFO = _CREATE_PROCESS_DEBUG_INFO;

  PExitThreadDebugInfo = ^TExitThreadDebugInfo;
  {$EXTERNALSYM _EXIT_THREAD_DEBUG_INFO}
  _EXIT_THREAD_DEBUG_INFO = record
    dwExitCode: DWORD;
  end;
  TExitThreadDebugInfo = _EXIT_THREAD_DEBUG_INFO;
  {$EXTERNALSYM EXIT_THREAD_DEBUG_INFO}
  EXIT_THREAD_DEBUG_INFO = _EXIT_THREAD_DEBUG_INFO;

  PExitProcessDebugInfo = ^TExitProcessDebugInfo;
  {$EXTERNALSYM _EXIT_PROCESS_DEBUG_INFO}
  _EXIT_PROCESS_DEBUG_INFO = record
    dwExitCode: DWORD;
  end;
  TExitProcessDebugInfo = _EXIT_PROCESS_DEBUG_INFO;
  {$EXTERNALSYM EXIT_PROCESS_DEBUG_INFO}
  EXIT_PROCESS_DEBUG_INFO = _EXIT_PROCESS_DEBUG_INFO;

  PLoadDLLDebugInfo = ^TLoadDLLDebugInfo;
  {$EXTERNALSYM _LOAD_DLL_DEBUG_INFO}
  _LOAD_DLL_DEBUG_INFO = record
    hFile: THandle;
    lpBaseOfDll: Pointer;
    dwDebugInfoFileOffset: DWORD;
    nDebugInfoSize: DWORD;
    lpImageName: Pointer;
    fUnicode: Word;
  end;
  TLoadDLLDebugInfo = _LOAD_DLL_DEBUG_INFO;
  {$EXTERNALSYM LOAD_DLL_DEBUG_INFO}
  LOAD_DLL_DEBUG_INFO = _LOAD_DLL_DEBUG_INFO;

  PUnloadDLLDebugInfo = ^TUnloadDLLDebugInfo;
  {$EXTERNALSYM _UNLOAD_DLL_DEBUG_INFO}
  _UNLOAD_DLL_DEBUG_INFO = record
    lpBaseOfDll: Pointer;
  end;
  TUnloadDLLDebugInfo = _UNLOAD_DLL_DEBUG_INFO;
  {$EXTERNALSYM UNLOAD_DLL_DEBUG_INFO}
  UNLOAD_DLL_DEBUG_INFO = _UNLOAD_DLL_DEBUG_INFO;

  POutputDebugStringInfo = ^TOutputDebugStringInfo;
  {$EXTERNALSYM _OUTPUT_DEBUG_STRING_INFO}
  _OUTPUT_DEBUG_STRING_INFO = record
    lpDebugStringData: LPSTR;
    fUnicode: Word;
    nDebugStringLength: Word;
  end;
  TOutputDebugStringInfo = _OUTPUT_DEBUG_STRING_INFO;
  {$EXTERNALSYM OUTPUT_DEBUG_STRING_INFO}
  OUTPUT_DEBUG_STRING_INFO = _OUTPUT_DEBUG_STRING_INFO;

  PRIPInfo = ^TRIPInfo;
  {$EXTERNALSYM _RIP_INFO}
  _RIP_INFO = record
    dwError: DWORD;
    dwType: DWORD;
  end;
  TRIPInfo = _RIP_INFO;
  {$EXTERNALSYM RIP_INFO}
  RIP_INFO = _RIP_INFO;

  PDebugEvent = ^TDebugEvent;
  {$EXTERNALSYM _DEBUG_EVENT}
  _DEBUG_EVENT = record
    dwDebugEventCode: DWORD;
    dwProcessId: DWORD;
    dwThreadId: DWORD;
    case Integer of
      0: (Exception: TExceptionDebugInfo);
      1: (CreateThread: TCreateThreadDebugInfo);
      2: (CreateProcessInfo: TCreateProcessDebugInfo);
      3: (ExitThread: TExitThreadDebugInfo);
      4: (ExitProcess: TExitThreadDebugInfo);
      5: (LoadDll: TLoadDLLDebugInfo);
      6: (UnloadDll: TUnloadDLLDebugInfo);
      7: (DebugString: TOutputDebugStringInfo);
      8: (RipInfo: TRIPInfo);
  end;
  TDebugEvent = _DEBUG_EVENT;
  {$EXTERNALSYM DEBUG_EVENT}
  DEBUG_EVENT = _DEBUG_EVENT;

const
  {$EXTERNALSYM DRIVE_UNKNOWN}
  DRIVE_UNKNOWN = 0;
  {$EXTERNALSYM DRIVE_NO_ROOT_DIR}
  DRIVE_NO_ROOT_DIR = 1;
  {$EXTERNALSYM DRIVE_REMOVABLE}
  DRIVE_REMOVABLE = 2;
  {$EXTERNALSYM DRIVE_FIXED}
  DRIVE_FIXED = 3;
  {$EXTERNALSYM DRIVE_REMOTE}
  DRIVE_REMOTE = 4;
  {$EXTERNALSYM DRIVE_CDROM}
  DRIVE_CDROM = 5;
  {$EXTERNALSYM DRIVE_RAMDISK}
  DRIVE_RAMDISK = 6;

{$EXTERNALSYM GetFreeSpace}
function GetFreeSpace(w: Word): DWORD;

const
  {$EXTERNALSYM FILE_TYPE_UNKNOWN}
  FILE_TYPE_UNKNOWN = 0;
  {$EXTERNALSYM FILE_TYPE_DISK}
  FILE_TYPE_DISK = 1;
  {$EXTERNALSYM FILE_TYPE_CHAR}
  FILE_TYPE_CHAR = 2;
  {$EXTERNALSYM FILE_TYPE_PIPE}
  FILE_TYPE_PIPE = 3;
  {$EXTERNALSYM FILE_TYPE_REMOTE}
  FILE_TYPE_REMOTE = $8000;

  {$EXTERNALSYM STD_INPUT_HANDLE}
  STD_INPUT_HANDLE = DWORD(-10);
  {$EXTERNALSYM STD_OUTPUT_HANDLE}
  STD_OUTPUT_HANDLE = DWORD(-11);
  {$EXTERNALSYM STD_ERROR_HANDLE}
  STD_ERROR_HANDLE = DWORD(-12);

  {$EXTERNALSYM NOPARITY}
  NOPARITY = 0;
  {$EXTERNALSYM ODDPARITY}
  ODDPARITY = 1;
  {$EXTERNALSYM EVENPARITY}
  EVENPARITY = 2;
  {$EXTERNALSYM MARKPARITY}
  MARKPARITY = 3;
  {$EXTERNALSYM SPACEPARITY}
  SPACEPARITY = 4;

  {$EXTERNALSYM ONESTOPBIT}
  ONESTOPBIT = 0;
  {$EXTERNALSYM ONE5STOPBITS}
  ONE5STOPBITS = 1;
  {$EXTERNALSYM TWOSTOPBITS}
  TWOSTOPBITS = 2;

  {$EXTERNALSYM IGNORE}
  IGNORE = 0;               { Ignore signal }
  {$EXTERNALSYM INFINITE}
  INFINITE = DWORD($FFFFFFFF);     { Infinite timeout }

  { Baud rates at which the communication device operates }

  {$EXTERNALSYM CBR_110}
  CBR_110 = 110;
  {$EXTERNALSYM CBR_300}
  CBR_300 = 300;
  {$EXTERNALSYM CBR_600}
  CBR_600 = 600;
  {$EXTERNALSYM CBR_1200}
  CBR_1200 = 1200;
  {$EXTERNALSYM CBR_2400}
  CBR_2400 = 2400;
  {$EXTERNALSYM CBR_4800}
  CBR_4800 = 4800;
  {$EXTERNALSYM CBR_9600}
  CBR_9600 = 9600;
  {$EXTERNALSYM CBR_14400}
  CBR_14400 = 14400;
  {$EXTERNALSYM CBR_19200}
  CBR_19200 = 19200;
  {$EXTERNALSYM CBR_38400}
  CBR_38400 = 38400;
  {$EXTERNALSYM CBR_56000}
  CBR_56000 = 56000;
  {$EXTERNALSYM CBR_57600}
  CBR_57600 = 57600;
  {$EXTERNALSYM CBR_115200}
  CBR_115200 = $1C200;
  {$EXTERNALSYM CBR_128000}
  CBR_128000 = $1F400;
  {$EXTERNALSYM CBR_256000}
  CBR_256000 = $3E800;

  { Error Flags }

  {$EXTERNALSYM CE_RXOVER}
  CE_RXOVER = 1;        { Receive Queue overflow }
  {$EXTERNALSYM CE_OVERRUN}
  CE_OVERRUN = 2;       { Receive Overrun Error }
  {$EXTERNALSYM CE_RXPARITY}
  CE_RXPARITY = 4;      { Receive Parity Error }
  {$EXTERNALSYM CE_FRAME}
  CE_FRAME = 8;         { Receive Framing error }
  {$EXTERNALSYM CE_BREAK}
  CE_BREAK = $10;       { Break Detected }
  {$EXTERNALSYM CE_TXFULL}
  CE_TXFULL = $100;     { TX Queue is full }
  {$EXTERNALSYM CE_PTO}
  CE_PTO = $200;        { LPTx Timeout }
  {$EXTERNALSYM CE_IOE}
  CE_IOE = $400;        { LPTx I/O Error }
  {$EXTERNALSYM CE_DNS}
  CE_DNS = $800;        { LPTx Device not selected }
  {$EXTERNALSYM CE_OOP}
  CE_OOP = $1000;       { LPTx Out-Of-Paper }
  {$EXTERNALSYM CE_MODE}
  CE_MODE = $8000;      { Requested mode unsupported }

  {$EXTERNALSYM IE_BADID}
  IE_BADID = LongWord(-1);        { Invalid or unsupported id }
  {$EXTERNALSYM IE_OPEN}
  IE_OPEN = LongWord(-2);         { Device Already Open }
  {$EXTERNALSYM IE_NOPEN}
  IE_NOPEN = LongWord(-3);        { Device Not Open }
  {$EXTERNALSYM IE_MEMORY}
  IE_MEMORY = LongWord(-4);       { Unable to allocate queues }
  {$EXTERNALSYM IE_DEFAULT}
  IE_DEFAULT = LongWord(-5);      { Error in default parameters }
  {$EXTERNALSYM IE_HARDWARE}
  IE_HARDWARE = LongWord(-10);    { Hardware Not Present }
  {$EXTERNALSYM IE_BYTESIZE}
  IE_BYTESIZE = LongWord(-11);    { Illegal Byte Size }
  {$EXTERNALSYM IE_BAUDRATE}
  IE_BAUDRATE = LongWord(-12);    { Unsupported BaudRate }

  { Events }

  {$EXTERNALSYM EV_RXCHAR}
  EV_RXCHAR = 1;        { Any Character received }
  {$EXTERNALSYM EV_RXFLAG}
  EV_RXFLAG = 2;        { Received certain character }
  {$EXTERNALSYM EV_TXEMPTY}
  EV_TXEMPTY = 4;       { Transmitt Queue Empty }
  {$EXTERNALSYM EV_CTS}
  EV_CTS = 8;           { CTS changed state }
  {$EXTERNALSYM EV_DSR}
  EV_DSR = $10;         { DSR changed state }
  {$EXTERNALSYM EV_RLSD}
  EV_RLSD = $20;        { RLSD changed state }
  {$EXTERNALSYM EV_BREAK}
  EV_BREAK = $40;       { BREAK received }
  {$EXTERNALSYM EV_ERR}
  EV_ERR = $80;         { Line status error occurred }
  {$EXTERNALSYM EV_RING}
  EV_RING = $100;       { Ring signal detected }
  {$EXTERNALSYM EV_PERR}
  EV_PERR = $200;       { Printer error occured }
  {$EXTERNALSYM EV_RX80FULL}
  EV_RX80FULL = $400;   { Receive buffer is 80 percent full }
  {$EXTERNALSYM EV_EVENT1}
  EV_EVENT1 = $800;     { Provider specific event 1 }
  {$EXTERNALSYM EV_EVENT2}
  EV_EVENT2 = $1000;    { Provider specific event 2 }

  { Escape functions }

  {$EXTERNALSYM SETXOFF}
  SETXOFF = 1;    { Simulate XOFF received }
  {$EXTERNALSYM SETXON}
  SETXON = 2;     { Simulate XON received }
  {$EXTERNALSYM SETRTS}
  SETRTS = 3;     { Set RTS high }
  {$EXTERNALSYM CLRRTS}
  CLRRTS = 4;     { Set RTS low }
  {$EXTERNALSYM SETDTR}
  SETDTR = 5;     { Set DTR high }
  {$EXTERNALSYM CLRDTR}
  CLRDTR = 6;     { Set DTR low }
  {$EXTERNALSYM RESETDEV}
  RESETDEV = 7;   { Reset device if possible }
  {$EXTERNALSYM SETBREAK}
  SETBREAK = 8;   { Set the device break line. }
  {$EXTERNALSYM CLRBREAK}
  CLRBREAK = 9;   { Clear the device break line. }

  { PURGE function flags. }

  {$EXTERNALSYM PURGE_TXABORT}
  PURGE_TXABORT = 1;     { Kill the pending/current writes to the comm port. }
  {$EXTERNALSYM PURGE_RXABORT}
  PURGE_RXABORT = 2;     { Kill the pending/current reads to the comm port. }
  {$EXTERNALSYM PURGE_TXCLEAR}
  PURGE_TXCLEAR = 4;     { Kill the transmit queue if there. }
  {$EXTERNALSYM PURGE_RXCLEAR}
  PURGE_RXCLEAR = 8;     { Kill the typeahead buffer if there. }

  {$EXTERNALSYM LPTx}
  LPTx = $80;     { Set if ID is for LPT device }

  { Modem Status Flags }

  {$EXTERNALSYM MS_CTS_ON}
  MS_CTS_ON = DWORD($0010);
  {$EXTERNALSYM MS_DSR_ON}
  MS_DSR_ON = DWORD($0020);
  {$EXTERNALSYM MS_RING_ON}
  MS_RING_ON = DWORD($0040);
  {$EXTERNALSYM MS_RLSD_ON}
  MS_RLSD_ON = DWORD($0080);

  { WaitSoundState() Constants }

  {$EXTERNALSYM S_QUEUEEMPTY}
  S_QUEUEEMPTY = 0;
  {$EXTERNALSYM S_THRESHOLD}
  S_THRESHOLD = 1;
  {$EXTERNALSYM S_ALLTHRESHOLD}
  S_ALLTHRESHOLD = 2;

  { Accent Modes }

  {$EXTERNALSYM S_NORMAL}
  S_NORMAL = 0;
  {$EXTERNALSYM S_LEGATO}
  S_LEGATO = 1;
  {$EXTERNALSYM S_STACCATO}
  S_STACCATO = 2;

  { SetSoundNoise() Sources }

  {$EXTERNALSYM S_PERIOD512}
  S_PERIOD512 = 0;     { Freq = N/512 high pitch, less coarse hiss }
  {$EXTERNALSYM S_PERIOD1024}
  S_PERIOD1024 = 1;    { Freq = N/1024 }
  {$EXTERNALSYM S_PERIOD2048}
  S_PERIOD2048 = 2;    { Freq = N/2048 low pitch, more coarse hiss }
  {$EXTERNALSYM S_PERIODVOICE}
  S_PERIODVOICE = 3;   { Source is frequency from voice channel (3) }
  {$EXTERNALSYM S_WHITE512}
  S_WHITE512 = 4;      { Freq = N/512 high pitch, less coarse hiss }
  {$EXTERNALSYM S_WHITE1024}
  S_WHITE1024 = 5;     { Freq = N/1024 }
  {$EXTERNALSYM S_WHITE2048}
  S_WHITE2048 = 6;     { Freq = N/2048 low pitch, more coarse hiss }
  {$EXTERNALSYM S_WHITEVOICE}
  S_WHITEVOICE = 7;    { Source is frequency from voice channel (3) }

  {$EXTERNALSYM S_SERDVNA}
  S_SERDVNA = LongWord(-1);     { Device not available  }
  {$EXTERNALSYM S_SEROFM}
  S_SEROFM = LongWord(-2);      { Out of memory }
  {$EXTERNALSYM S_SERMACT}
  S_SERMACT = LongWord(-3);     { Music active }
  {$EXTERNALSYM S_SERQFUL}
  S_SERQFUL = LongWord(-4);     { Queue full }
  {$EXTERNALSYM S_SERBDNT}
  S_SERBDNT = LongWord(-5);     { Invalid note }
  {$EXTERNALSYM S_SERDLN}
  S_SERDLN = LongWord(-6);      { Invalid note length }
  {$EXTERNALSYM S_SERDCC}
  S_SERDCC = LongWord(-7);      { Invalid note count }
  {$EXTERNALSYM S_SERDTP}
  S_SERDTP = LongWord(-8);      { Invalid tempo }
  {$EXTERNALSYM S_SERDVL}
  S_SERDVL = LongWord(-9);      { Invalid volume }
  {$EXTERNALSYM S_SERDMD}
  S_SERDMD = LongWord(-10);     { Invalid mode }
  {$EXTERNALSYM S_SERDSH}
  S_SERDSH = LongWord(-11);     { Invalid shape }
  {$EXTERNALSYM S_SERDPT}
  S_SERDPT = LongWord(-12);     { Invalid pitch }
  {$EXTERNALSYM S_SERDFQ}
  S_SERDFQ = LongWord(-13);     { Invalid frequency }
  {$EXTERNALSYM S_SERDDR}
  S_SERDDR = LongWord(-14);     { Invalid duration }
  {$EXTERNALSYM S_SERDSR}
  S_SERDSR = LongWord(-15);     { Invalid source }
  {$EXTERNALSYM S_SERDST}
  S_SERDST = LongWord(-16);     { Invalid state }

  {$EXTERNALSYM NMPWAIT_WAIT_FOREVER}
  NMPWAIT_WAIT_FOREVER = DWORD($FFFFFFFF);
  {$EXTERNALSYM NMPWAIT_NOWAIT}
  NMPWAIT_NOWAIT = 1;
  {$EXTERNALSYM NMPWAIT_USE_DEFAULT_WAIT}
  NMPWAIT_USE_DEFAULT_WAIT = 0;

  {$EXTERNALSYM FS_CASE_IS_PRESERVED}
  FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES;
  {$EXTERNALSYM FS_CASE_SENSITIVE}
  FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH;
  {$EXTERNALSYM FS_UNICODE_STORED_ON_DISK}
  FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK;
  {$EXTERNALSYM FS_PERSISTENT_ACLS}
  FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS;
  {$EXTERNALSYM FS_VOL_IS_COMPRESSED}
  FS_VOL_IS_COMPRESSED = FILE_VOLUME_IS_COMPRESSED;
  {$EXTERNALSYM FS_FILE_COMPRESSION}
  FS_FILE_COMPRESSION = FILE_FILE_COMPRESSION;

  {$EXTERNALSYM FILE_MAP_COPY}
  FILE_MAP_COPY = SECTION_QUERY;
  {$EXTERNALSYM FILE_MAP_WRITE}
  FILE_MAP_WRITE = SECTION_MAP_WRITE;
  {$EXTERNALSYM FILE_MAP_READ}
  FILE_MAP_READ = SECTION_MAP_READ;
  {$EXTERNALSYM FILE_MAP_ALL_ACCESS}
  FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS;

  {$EXTERNALSYM OF_READ}
  OF_READ = 0;
  {$EXTERNALSYM OF_WRITE}
  OF_WRITE = 1;
  {$EXTERNALSYM OF_READWRITE}
  OF_READWRITE = 2;
  {$EXTERNALSYM OF_SHARE_COMPAT}
  OF_SHARE_COMPAT = 0;
  {$EXTERNALSYM OF_SHARE_EXCLUSIVE}
  OF_SHARE_EXCLUSIVE = $10;
  {$EXTERNALSYM OF_SHARE_DENY_WRITE}
  OF_SHARE_DENY_WRITE = $20;
  {$EXTERNALSYM OF_SHARE_DENY_READ}
  OF_SHARE_DENY_READ = 48;
  {$EXTERNALSYM OF_SHARE_DENY_NONE}
  OF_SHARE_DENY_NONE = $40;
  {$EXTERNALSYM OF_PARSE}
  OF_PARSE = $100;
  {$EXTERNALSYM OF_DELETE}
  OF_DELETE = $200;
  {$EXTERNALSYM OF_VERIFY}
  OF_VERIFY = $400;
  {$EXTERNALSYM OF_CANCEL}
  OF_CANCEL = $800;
  {$EXTERNALSYM OF_CREATE}
  OF_CREATE = $1000;
  {$EXTERNALSYM OF_PROMPT}
  OF_PROMPT = $2000;
  {$EXTERNALSYM OF_EXIST}
  OF_EXIST = $4000;
  {$EXTERNALSYM OF_REOPEN}
  OF_REOPEN = $8000;

  {$EXTERNALSYM OFS_MAXPATHNAME}
  OFS_MAXPATHNAME = 128;
type
  POFStruct = ^TOFStruct;
  {$EXTERNALSYM _OFSTRUCT}
  _OFSTRUCT = record
    cBytes: Byte;
    fFixedDisk: Byte;
    nErrCode: Word;
    Reserved1: Word;
    Reserved2: Word;
    szPathName: array[0..OFS_MAXPATHNAME-1] of CHAR;
  end;
  TOFStruct = _OFSTRUCT;
  {$EXTERNALSYM OFSTRUCT}
  OFSTRUCT = _OFSTRUCT;

{$EXTERNALSYM InterlockedIncrement}
function InterlockedIncrement(var Addend: Integer): Integer; stdcall;
{$EXTERNALSYM InterlockedDecrement}
function InterlockedDecrement(var Addend: Integer): Integer; stdcall;
{$EXTERNALSYM InterlockedExchange}
function InterlockedExchange(var Target: Integer; Value: Integer): Integer; stdcall;
{$EXTERNALSYM InterlockedCompareExchange}
function InterlockedCompareExchange(var Destination: Pointer; Exchange: Pointer;
  Comperand: Pointer): Pointer stdcall;
{$EXTERNALSYM InterlockedExchangeAdd}
function InterlockedExchangeAdd(Addend: PLongint; Value: Longint): Longint stdcall;


{$EXTERNALSYM FreeResource}
function FreeResource(hResData: HGLOBAL): BOOL; stdcall;
{$EXTERNALSYM LockResource}
function LockResource(hResData: HGLOBAL): Pointer; stdcall;
{$EXTERNALSYM UnlockResource}
function UnlockResource(hResData: THandle): BOOL;

const
  {$EXTERNALSYM MAXINTATOM}
  MAXINTATOM = $C000;
  {$EXTERNALSYM INVALID_ATOM}
  INVALID_ATOM = 0;

type
  MakeIntAtomA = PAnsiChar;
  MakeIntAtomW = PWideChar;
  MakeIntAtom = MakeIntAtomA;

{$EXTERNALSYM FreeLibrary}
function FreeLibrary(hLibModule: HMODULE): BOOL; stdcall;
{$EXTERNALSYM FreeLibraryAndExitThread}
procedure FreeLibraryAndExitThread(hLibModule: HMODULE; dwExitCode: DWORD); stdcall;
{$EXTERNALSYM DisableThreadLibraryCalls}
function DisableThreadLibraryCalls(hLibModule: HMODULE): BOOL; stdcall;
{$EXTERNALSYM GetProcAddress}
function GetProcAddress(hModule: HMODULE; lpProcName: LPCSTR): FARPROC; stdcall;
{$EXTERNALSYM GetVersion}
function GetVersion: DWORD; stdcall;
{$EXTERNALSYM GlobalAlloc}
function GlobalAlloc(uFlags: UINT; dwBytes: DWORD): HGLOBAL; stdcall;
{$EXTERNALSYM GlobalReAlloc}
function GlobalReAlloc(hMem: HGLOBAL; dwBytes: DWORD; uFlags: UINT): HGLOBAL; stdcall;
{$EXTERNALSYM GlobalSize}
function GlobalSize(hMem: HGLOBAL): DWORD; stdcall;
{$EXTERNALSYM GlobalFlags}
function GlobalFlags(hMem: HGLOBAL): UINT; stdcall;
{$EXTERNALSYM GlobalLock}
function GlobalLock(hMem: HGLOBAL): Pointer; stdcall;
{$EXTERNALSYM GlobalHandle}
function GlobalHandle(Mem: Pointer): HGLOBAL; stdcall;
{$EXTERNALSYM GlobalUnlock}
function GlobalUnlock(hMem: HGLOBAL): BOOL; stdcall;
{$EXTERNALSYM GlobalFree}
function GlobalFree(hMem: HGLOBAL): HGLOBAL; stdcall;
{$EXTERNALSYM GlobalCompact}
function GlobalCompact(dwMinFree: DWORD): UINT; stdcall;
{$EXTERNALSYM GlobalFix}
procedure GlobalFix(hMem: HGLOBAL); stdcall;
{$EXTERNALSYM GlobalUnfix}
procedure GlobalUnfix(hMem: HGLOBAL); stdcall;
{$EXTERNALSYM GlobalWire}
function GlobalWire(hMem: HGLOBAL): Pointer; stdcall;
{$EXTERNALSYM GlobalUnWire}
function GlobalUnWire(hMem: HGLOBAL): BOOL; stdcall;
{$EXTERNALSYM GlobalMemoryStatus}
procedure GlobalMemoryStatus(var lpBuffer: TMemoryStatus); stdcall;
{$EXTERNALSYM LocalAlloc}
function LocalAlloc(uFlags, uBytes: UINT): HLOCAL; stdcall;
{$EXTERNALSYM LocalReAlloc}
function LocalReAlloc(hMem: HLOCAL; uBytes, uFlags: UINT): HLOCAL; stdcall;
{$EXTERNALSYM LocalLock}
function LocalLock(hMem: HLOCAL): Pointer; stdcall;
{$EXTERNALSYM LocalUnlock}
function LocalUnlock(hMem: HLOCAL): BOOL; stdcall;
{$EXTERNALSYM LocalSize}
function LocalSize(hMem: HLOCAL): UINT; stdcall;
{$EXTERNALSYM LocalFlags}
function LocalFlags(hMem: HLOCAL): UINT; stdcall;
{$EXTERNALSYM LocalFree}
function LocalFree(hMem: HLOCAL): HLOCAL; stdcall;
{$EXTERNALSYM LocalShrink}
function LocalShrink(hMem: HLOCAL; cbNewSize: UINT): UINT; stdcall;
{$EXTERNALSYM LocalCompact}
function LocalCompact(uMinFree: UINT): UINT; stdcall;
{$EXTERNALSYM FlushInstructionCache}
function FlushInstructionCache(hProcess: THandle;
  const lpBaseAddress: Pointer; dwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM VirtualAlloc}
function VirtualAlloc(lpvAddress: Pointer;
  dwSize, flAllocationType, flProtect: DWORD): Pointer; stdcall;
{$EXTERNALSYM VirtualFree}
function VirtualFree(lpAddress: Pointer; dwSize, dwFreeType: DWORD): BOOL; stdcall;
{$EXTERNALSYM VirtualProtect}
function VirtualProtect(lpAddress: Pointer; dwSize, flNewProtect: DWORD;
  lpflOldProtect: Pointer): BOOL; stdcall;
{$EXTERNALSYM VirtualQuery}
function VirtualQuery(lpAddress: Pointer;
  var lpBuffer: TMemoryBasicInformation; dwLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM VirtualAllocEx}
function VirtualAllocEx(hProcess: THandle; lpAddress: Pointer;
  dwSize, flAllocationType: DWORD; flProtect: DWORD): Pointer; stdcall;
{$EXTERNALSYM VirtualFreeEx}
function VirtualFreeEx(hProcess: THandle; lpAddress: Pointer;
        dwSize, dwFreeType: DWORD): Pointer; stdcall;
{$EXTERNALSYM VirtualProtectEx}
function VirtualProtectEx(hProcess: THandle; lpAddress: Pointer;
  dwSize, flNewProtect: DWORD; lpflOldProtect: Pointer): BOOL; stdcall;
{$EXTERNALSYM VirtualQueryEx}
function VirtualQueryEx(hProcess: THandle; lpAddress: Pointer;
  var lpBuffer: TMemoryBasicInformation; dwLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM HeapCreate}
function HeapCreate(flOptions, dwInitialSize, dwMaximumSize: DWORD): THandle; stdcall;
{$EXTERNALSYM HeapDestroy}
function HeapDestroy(hHeap: THandle): BOOL; stdcall;
{$EXTERNALSYM HeapAlloc}
function HeapAlloc(hHeap: THandle; dwFlags, dwBytes: DWORD): Pointer; stdcall;
{$EXTERNALSYM HeapReAlloc}
function HeapReAlloc(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer; dwBytes: DWORD): Pointer; stdcall;
{$EXTERNALSYM HeapFree}
function HeapFree(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer): BOOL; stdcall;
{$EXTERNALSYM HeapSize}
function HeapSize(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer): DWORD; stdcall;
{$EXTERNALSYM HeapValidate}
function HeapValidate(hHeap: THandle; dwFlags: DWORD; lpMem: Pointer): BOOL; stdcall;
{$EXTERNALSYM HeapCompact}
function HeapCompact(hHeap: THandle; dwFlags: DWORD): UINT; stdcall;
{$EXTERNALSYM GetProcessHeap}
function GetProcessHeap: THandle; stdcall;
{$EXTERNALSYM GetProcessHeaps}
function GetProcessHeaps(NumberOfHeaps: DWORD; var ProcessHeaps: THandle): DWORD; stdcall;

type
  PProcessHeapEntry = ^TProcessHeapEntry;
  {$EXTERNALSYM _PROCESS_HEAP_ENTRY}
  _PROCESS_HEAP_ENTRY = record
    lpData: Pointer;
    cbData: DWORD;
    cbOverhead: Byte;
    iRegionIndex: Byte;
    wFlags: Word;
    case Integer of
      0: (
        hMem: THandle);
      1: (
        dwCommittedSize: DWORD;
        dwUnCommittedSize: DWORD;
        lpFirstBlock: Pointer;
        lpLastBlock: Pointer);
  end;
  TProcessHeapEntry = _PROCESS_HEAP_ENTRY;
  {$EXTERNALSYM PROCESS_HEAP_ENTRY}
  PROCESS_HEAP_ENTRY = _PROCESS_HEAP_ENTRY;

const
  {$EXTERNALSYM PROCESS_HEAP_REGION}
  PROCESS_HEAP_REGION = 1;
  {$EXTERNALSYM PROCESS_HEAP_UNCOMMITTED_RANGE}
  PROCESS_HEAP_UNCOMMITTED_RANGE = 2;
  {$EXTERNALSYM PROCESS_HEAP_ENTRY_BUSY}
  PROCESS_HEAP_ENTRY_BUSY = 4;
  {$EXTERNALSYM PROCESS_HEAP_ENTRY_MOVEABLE}
  PROCESS_HEAP_ENTRY_MOVEABLE = $10;
  {$EXTERNALSYM PROCESS_HEAP_ENTRY_DDESHARE}
  PROCESS_HEAP_ENTRY_DDESHARE = $20;

{$EXTERNALSYM HeapLock}
function HeapLock(hHeap: THandle): BOOL; stdcall;
{$EXTERNALSYM HeapUnlock}
function HeapUnlock(hHeap: THandle): BOOL; stdcall;
{$EXTERNALSYM HeapWalk}
function HeapWalk(hHeap: THandle; var lpEntry: TProcessHeapEntry): BOOL; stdcall;


{ GetBinaryType return values.}

const
  {$EXTERNALSYM SCS_32BIT_BINARY}
  SCS_32BIT_BINARY = 0;
  {$EXTERNALSYM SCS_DOS_BINARY}
  SCS_DOS_BINARY = 1;
  {$EXTERNALSYM SCS_WOW_BINARY}
  SCS_WOW_BINARY = 2;
  {$EXTERNALSYM SCS_PIF_BINARY}
  SCS_PIF_BINARY = 3;
  {$EXTERNALSYM SCS_POSIX_BINARY}
  SCS_POSIX_BINARY = 4;
  {$EXTERNALSYM SCS_OS216_BINARY}
  SCS_OS216_BINARY = 5;

{$EXTERNALSYM GetBinaryTypeA}
function GetBinaryTypeA(lpApplicationName: PAnsiChar; var lpBinaryType: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetBinaryTypeW}
function GetBinaryTypeW(lpApplicationName: PWideChar; var lpBinaryType: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetBinaryType}
function GetBinaryType(lpApplicationName: PChar; var lpBinaryType: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetShortPathNameA}
function GetShortPathNameA(lpszLongPath: PAnsiChar; lpszShortPath: PAnsiChar;
  cchBuffer: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetShortPathNameW}
function GetShortPathNameW(lpszLongPath: PWideChar; lpszShortPath: PWideChar;
  cchBuffer: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetShortPathName}
function GetShortPathName(lpszLongPath: PChar; lpszShortPath: PChar;
  cchBuffer: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetProcessAffinityMask}
function GetProcessAffinityMask(hProcess: THandle;
  var lpProcessAffinityMask, lpSystemAffinityMask: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetProcessAffinityMask}
function SetProcessAffinityMask(hProcess: THandle;
  dwProcessAffinityMask: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetProcessTimes}
function GetProcessTimes(hProcess: THandle;
  var lpCreationTime, lpExitTime, lpKernelTime, lpUserTime: TFileTime): BOOL; stdcall;
{$EXTERNALSYM GetProcessWorkingSetSize}
function GetProcessWorkingSetSize(hProcess: THandle;
  var lpMinimumWorkingSetSize, lpMaximumWorkingSetSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetProcessWorkingSetSize}
function SetProcessWorkingSetSize(hProcess: THandle;
  dwMinimumWorkingSetSize, dwMaximumWorkingSetSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM OpenProcess}
function OpenProcess(dwDesiredAccess: DWORD; bInheritHandle: BOOL; dwProcessId: DWORD): THandle; stdcall;
{$EXTERNALSYM GetCurrentProcess}
function GetCurrentProcess: THandle; stdcall;
{$EXTERNALSYM GetCurrentProcessId}
function GetCurrentProcessId: DWORD; stdcall;
{$EXTERNALSYM ExitProcess}
procedure ExitProcess(uExitCode: UINT); stdcall;
{$EXTERNALSYM TerminateProcess}
function TerminateProcess(hProcess: THandle; uExitCode: UINT): BOOL; stdcall;
{$EXTERNALSYM GetExitCodeProcess}
function GetExitCodeProcess(hProcess: THandle; var lpExitCode: DWORD): BOOL; stdcall;
{$EXTERNALSYM FatalExit}
procedure FatalExit(ExitCode: Integer); stdcall;
{$EXTERNALSYM GetEnvironmentStringsA}
function GetEnvironmentStringsA: PAnsiChar; stdcall;
{$EXTERNALSYM GetEnvironmentStringsW}
function GetEnvironmentStringsW: PWideChar; stdcall;
{$EXTERNALSYM GetEnvironmentStrings}
function GetEnvironmentStrings: PChar; stdcall;
{$EXTERNALSYM FreeEnvironmentStringsA}
function FreeEnvironmentStringsA(p1: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM FreeEnvironmentStringsW}
function FreeEnvironmentStringsW(p1: PWideChar): BOOL; stdcall;
{$EXTERNALSYM FreeEnvironmentStrings}
function FreeEnvironmentStrings(p1: PChar): BOOL; stdcall;
{$EXTERNALSYM RaiseException}
procedure RaiseException(dwExceptionCode, dwExceptionFlags, nNumberOfArguments: DWORD;
  lpArguments: PDWORD); stdcall;
{$EXTERNALSYM UnhandledExceptionFilter}
function UnhandledExceptionFilter(const ExceptionInfo: TExceptionPointers): Longint; stdcall;
{$EXTERNALSYM CreateFiber}
function CreateFiber(dwStackSize: DWORD; lpStartAddress: TFNFiberStartRoutine;
  lpParameter: Pointer): BOOL; stdcall;
{$EXTERNALSYM DeleteFiber}
function DeleteFiber(lpFiber: Pointer): BOOL; stdcall;
{$EXTERNALSYM ConvertThreadToFiber}
function ConvertThreadToFiber(lpParameter: Pointer): BOOL; stdcall;
{$EXTERNALSYM SwitchToFiber}
function SwitchToFiber(lpFiber: Pointer): BOOL; stdcall;
{$EXTERNALSYM SwitchToThread}
function SwitchToThread: BOOL; stdcall;

type
  TFNTopLevelExceptionFilter = TFarProc;

{$EXTERNALSYM SetUnhandledExceptionFilter}
function SetUnhandledExceptionFilter(lpTopLevelExceptionFilter: TFNTopLevelExceptionFilter):
  TFNTopLevelExceptionFilter; stdcall;
{$EXTERNALSYM CreateThread}
function CreateThread(lpThreadAttributes: Pointer;
  dwStackSize: DWORD; lpStartAddress: TFNThreadStartRoutine;
  lpParameter: Pointer; dwCreationFlags: DWORD; var lpThreadId: DWORD): THandle; stdcall;
{$EXTERNALSYM CreateRemoteThread}
function CreateRemoteThread(hProcess: THandle; lpThreadAttributes: Pointer;
  dwStackSize: DWORD; lpStartAddress: TFNThreadStartRoutine; lpParameter: Pointer;
  dwCreationFlags: DWORD; var lpThreadId: DWORD): THandle; stdcall;
{$EXTERNALSYM GetCurrentThread}
function GetCurrentThread: THandle; stdcall;
{$EXTERNALSYM GetCurrentThreadId}
function GetCurrentThreadId: DWORD; stdcall;
{$EXTERNALSYM SetThreadAffinityMask}
function SetThreadAffinityMask(hThread: THandle; dwThreadAffinityMask: DWORD): DWORD; stdcall;
{$EXTERNALSYM SetThreadIdealProcessor}
function SetThreadIdealProcessor(hThread: THandle; dwIdealProcessor: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetProcessPriorityBoost}
function SetProcessPriorityBoost(hThread: THandle; DisablePriorityBoost: Bool): BOOL; stdcall;
{$EXTERNALSYM GetProcessPriorityBoost}
function GetProcessPriorityBoost(hThread: THandle; var DisablePriorityBoost: Bool): BOOL; stdcall;
{$EXTERNALSYM SetThreadPriority}
function SetThreadPriority(hThread: THandle; nPriority: Integer): BOOL; stdcall;
{$EXTERNALSYM GetThreadPriority}
function GetThreadPriority(hThread: THandle): Integer; stdcall;
{$EXTERNALSYM SetThreadPriorityBoost}
function SetThreadPriorityBoost(hThread: THandle; DisablePriorityBoost: Bool): BOOL; stdcall;
{$EXTERNALSYM GetThreadPriorityBoost}
function GetThreadPriorityBoost(hThread: THandle; var DisablePriorityBoost: Bool): BOOL; stdcall;
{$EXTERNALSYM GetThreadTimes}
function GetThreadTimes(hThread: THandle;
  var lpCreationTime, lpExitTime, lpKernelTime, lpUserTime: TFileTime): BOOL; stdcall;
{$EXTERNALSYM ExitThread}
procedure ExitThread(dwExitCode: DWORD); stdcall;
{$EXTERNALSYM TerminateThread}
function TerminateThread(hThread: THandle; dwExitCode: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetExitCodeThread}
function GetExitCodeThread(hThread: THandle; var lpExitCode: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetThreadSelectorEntry}
function GetThreadSelectorEntry(hThread: THandle; dwSelector: DWORD;
  var lpSelectorEntry: TLDTEntry): BOOL; stdcall;
{$EXTERNALSYM GetLastError}
function GetLastError: DWORD; stdcall;
{$EXTERNALSYM SetLastError}
procedure SetLastError(dwErrCode: DWORD); stdcall;
{$EXTERNALSYM GetOverlappedResult}
function GetOverlappedResult(hFile: THandle; const lpOverlapped: TOverlapped;
  var lpNumberOfBytesTransferred: DWORD; bWait: BOOL): BOOL; stdcall;
{$EXTERNALSYM CreateIoCompletionPort}
function CreateIoCompletionPort(FileHandle, ExistingCompletionPort: THandle;
  CompletionKey, NumberOfConcurrentThreads: DWORD): THandle; stdcall;
{$EXTERNALSYM GetQueuedCompletionStatus}
function GetQueuedCompletionStatus(CompletionPort: THandle;
  var lpNumberOfBytesTransferred, lpCompletionKey: DWORD;
  var lpOverlapped: POverlapped; dwMilliseconds: DWORD): BOOL; stdcall;
{$EXTERNALSYM PostQueuedCompletionStatus}
function PostQueuedCompletionStatus(CompletionPort: THandle; dwNumberOfBytesTransferred: DWORD;
  dwCompletionKey: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;

const
  {$EXTERNALSYM SEM_FAILCRITICALERRORS}
  SEM_FAILCRITICALERRORS = 1;
  {$EXTERNALSYM SEM_NOGPFAULTERRORBOX}
  SEM_NOGPFAULTERRORBOX = 2;
  {$EXTERNALSYM SEM_NOALIGNMENTFAULTEXCEPT}
  SEM_NOALIGNMENTFAULTEXCEPT = 4;
  {$EXTERNALSYM SEM_NOOPENFILEERRORBOX}
  SEM_NOOPENFILEERRORBOX = $8000;

{$EXTERNALSYM SetErrorMode}
function SetErrorMode(uMode: UINT): UINT; stdcall;
{$EXTERNALSYM ReadProcessMemory}
function ReadProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer; lpBuffer: Pointer;
  nSize: DWORD; var lpNumberOfBytesRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteProcessMemory}
function WriteProcessMemory(hProcess: THandle; const lpBaseAddress: Pointer; lpBuffer: Pointer;
  nSize: DWORD; var lpNumberOfBytesWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetThreadContext}
function GetThreadContext(hThread: THandle; var lpContext: TContext): BOOL; stdcall;
{$EXTERNALSYM SetThreadContext}
function SetThreadContext(hThread: THandle; const lpContext: TContext): BOOL; stdcall;
{$EXTERNALSYM SuspendThread}
function SuspendThread(hThread: THandle): DWORD; stdcall;
{$EXTERNALSYM ResumeThread}
function ResumeThread(hThread: THandle): DWORD; stdcall;

type
  TFNAPCProc = TFarProc;

{$EXTERNALSYM QueueUserAPC}
function QueueUserAPC(pfnAPC: TFNAPCProc; hThread: THandle; dwData: DWORD): BOOL; stdcall;
{$EXTERNALSYM DebugBreak}
procedure DebugBreak; stdcall;
{$EXTERNALSYM WaitForDebugEvent}
function WaitForDebugEvent(var lpDebugEvent: TDebugEvent; dwMilliseconds: DWORD): BOOL; stdcall;
{$EXTERNALSYM ContinueDebugEvent}
function ContinueDebugEvent(dwProcessId, dwThreadId, dwContinueStatus: DWORD): BOOL; stdcall;
{$EXTERNALSYM DebugActiveProcess}
function DebugActiveProcess(dwProcessId: DWORD): BOOL; stdcall;
{$EXTERNALSYM InitializeCriticalSection}
procedure InitializeCriticalSection(var lpCriticalSection: TRTLCriticalSection); stdcall;
{$EXTERNALSYM EnterCriticalSection}
procedure EnterCriticalSection(var lpCriticalSection: TRTLCriticalSection); stdcall;
{$EXTERNALSYM LeaveCriticalSection}
procedure LeaveCriticalSection(var lpCriticalSection: TRTLCriticalSection); stdcall;
{$EXTERNALSYM InitializeCriticalSectionAndSpinCount}
function InitializeCriticalSectionAndSpinCount(var lpCriticalSection: TRTLCriticalSection; dwSpinCount: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetCriticalSectionSpinCount}
function SetCriticalSectionSpinCount(var lpCriticalSection: TRTLCriticalSection; dwSpinCount: DWORD): DWORD; stdcall;
{$EXTERNALSYM TryEnterCriticalSection}
function TryEnterCriticalSection(var lpCriticalSection: TRTLCriticalSection): BOOL; stdcall;
{$EXTERNALSYM DeleteCriticalSection}
procedure DeleteCriticalSection(var lpCriticalSection: TRTLCriticalSection); stdcall;
{$EXTERNALSYM SetEvent}
function SetEvent(hEvent: THandle): BOOL; stdcall;
{$EXTERNALSYM ResetEvent}
function ResetEvent(hEvent: THandle): BOOL; stdcall;
{$EXTERNALSYM PulseEvent}
function PulseEvent(hEvent: THandle): BOOL; stdcall;
{$EXTERNALSYM ReleaseSemaphore}
function ReleaseSemaphore(hSemaphore: THandle; lReleaseCount: Longint;
  lpPreviousCount: Pointer): BOOL; stdcall;
{$EXTERNALSYM ReleaseMutex}
function ReleaseMutex(hMutex: THandle): BOOL; stdcall;
{$EXTERNALSYM WaitForSingleObject}
function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD; stdcall;

type
  TWOHandleArray = array[0..MAXIMUM_WAIT_OBJECTS - 1] of THandle;
  PWOHandleArray = ^TWOHandleArray;

{$EXTERNALSYM WaitForMultipleObjects}
function WaitForMultipleObjects(nCount: DWORD; lpHandles: PWOHandleArray;
  bWaitAll: BOOL; dwMilliseconds: DWORD): DWORD; stdcall;
{$EXTERNALSYM Sleep}
procedure Sleep(dwMilliseconds: DWORD); stdcall;
{$EXTERNALSYM LoadResource}
function LoadResource(hModule: HINST; hResInfo: HRSRC): HGLOBAL; stdcall;
{$EXTERNALSYM SizeofResource}
function SizeofResource(hModule: HINST; hResInfo: HRSRC): DWORD; stdcall;
{$EXTERNALSYM GlobalDeleteAtom}
function GlobalDeleteAtom(nAtom: ATOM): ATOM; stdcall;
{$EXTERNALSYM InitAtomTable}
function InitAtomTable(nSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM DeleteAtom}
function DeleteAtom(nAtom: ATOM): ATOM; stdcall;
{$EXTERNALSYM SetHandleCount}
function SetHandleCount(uNumber: UINT): UINT; stdcall;
{$EXTERNALSYM GetLogicalDrives}
function GetLogicalDrives: DWORD; stdcall;
{$EXTERNALSYM LockFile}
function LockFile(hFile: THandle; dwFileOffsetLow, dwFileOffsetHigh: DWORD;
  nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh: DWORD): BOOL; stdcall;
{$EXTERNALSYM UnlockFile}
function UnlockFile(hFile: THandle; dwFileOffsetLow, dwFileOffsetHigh: DWORD;
  nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh: DWORD): BOOL; stdcall;
{$EXTERNALSYM LockFileEx}
function LockFileEx(hFile: THandle; dwFlags, dwReserved: DWORD;
  nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh: DWORD;
  const lpOverlapped: TOverlapped): BOOL; stdcall;

const
  {$EXTERNALSYM LOCKFILE_FAIL_IMMEDIATELY}
  LOCKFILE_FAIL_IMMEDIATELY = 1;
  {$EXTERNALSYM LOCKFILE_EXCLUSIVE_LOCK}
  LOCKFILE_EXCLUSIVE_LOCK = 2;

{$EXTERNALSYM UnlockFileEx}
function UnlockFileEx(hFile: THandle; dwReserved, nNumberOfBytesToUnlockLow: DWORD;
  nNumberOfBytesToUnlockHigh: DWORD; const lpOverlapped: TOverlapped): BOOL; stdcall;

type
  PByHandleFileInformation = ^TByHandleFileInformation;
  {$EXTERNALSYM _BY_HANDLE_FILE_INFORMATION}
  _BY_HANDLE_FILE_INFORMATION = record
    dwFileAttributes: DWORD;
    ftCreationTime: TFileTime;
    ftLastAccessTime: TFileTime;
    ftLastWriteTime: TFileTime;
    dwVolumeSerialNumber: DWORD;
    nFileSizeHigh: DWORD;
    nFileSizeLow: DWORD;
    nNumberOfLinks: DWORD;
    nFileIndexHigh: DWORD;
    nFileIndexLow: DWORD;
  end;
  TByHandleFileInformation = _BY_HANDLE_FILE_INFORMATION;
  {$EXTERNALSYM BY_HANDLE_FILE_INFORMATION}
  BY_HANDLE_FILE_INFORMATION = _BY_HANDLE_FILE_INFORMATION;

{$EXTERNALSYM GetFileInformationByHandle}
function GetFileInformationByHandle(hFile: THandle;
  var lpFileInformation: TByHandleFileInformation): BOOL; stdcall;
{$EXTERNALSYM GetFileType}
function GetFileType(hFile: THandle): DWORD; stdcall;
{$EXTERNALSYM GetFileSize}
function GetFileSize(hFile: THandle; lpFileSizeHigh: Pointer): DWORD; stdcall;
{$EXTERNALSYM GetStdHandle}
function GetStdHandle(nStdHandle: DWORD): THandle; stdcall;
{$EXTERNALSYM SetStdHandle}
function SetStdHandle(nStdHandle: DWORD; hHandle: THandle): BOOL; stdcall;
{$EXTERNALSYM WriteFile}
function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD;
  var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;
{$EXTERNALSYM ReadFile}
function ReadFile(hFile: THandle; var Buffer; nNumberOfBytesToRead: DWORD;
  var lpNumberOfBytesRead: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;
{$EXTERNALSYM FlushFileBuffers}
function FlushFileBuffers(hFile: THandle): BOOL; stdcall;
{$EXTERNALSYM DeviceIoControl}
function DeviceIoControl(hDevice: THandle; dwIoControlCode: DWORD; lpInBuffer: Pointer;
  nInBufferSize: DWORD; lpOutBuffer: Pointer; nOutBufferSize: DWORD;
  var lpBytesReturned: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;
{$EXTERNALSYM SetEndOfFile}
function SetEndOfFile(hFile: THandle): BOOL; stdcall;
{$EXTERNALSYM SetFilePointer}
function SetFilePointer(hFile: THandle; lDistanceToMove: Longint;
  lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): DWORD; stdcall;
{$EXTERNALSYM FindClose}
function FindClose(hFindFile: THandle): BOOL; stdcall;
{$EXTERNALSYM GetFileTime}
function GetFileTime(hFile: THandle;
  lpCreationTime, lpLastAccessTime, lpLastWriteTime: PFileTime): BOOL; stdcall;
{$EXTERNALSYM SetFileTime}
function SetFileTime(hFile: THandle;
  lpCreationTime, lpLastAccessTime, lpLastWriteTime: PFileTime): BOOL; stdcall;
{$EXTERNALSYM CloseHandle}
function CloseHandle(hObject: THandle): BOOL; stdcall;
{$EXTERNALSYM DuplicateHandle}
function DuplicateHandle(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle: THandle;
  lpTargetHandle: PHandle; dwDesiredAccess: DWORD;
  bInheritHandle: BOOL; dwOptions: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetHandleInformation}
function GetHandleInformation(hObject: THandle; var lpdwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetHandleInformation}
function SetHandleInformation(hObject: THandle; dwMask: DWORD; dwFlags: DWORD): BOOL; stdcall;

const
  {$EXTERNALSYM HANDLE_FLAG_INHERIT}
  HANDLE_FLAG_INHERIT = 1;
  {$EXTERNALSYM HANDLE_FLAG_PROTECT_FROM_CLOSE}
  HANDLE_FLAG_PROTECT_FROM_CLOSE = 2;
  {$EXTERNALSYM HINSTANCE_ERROR}
  HINSTANCE_ERROR = $20;

{$EXTERNALSYM LoadModule}
function LoadModule(lpModuleName: LPCSTR; lpParameterBlock: Pointer): DWORD; stdcall;
{$EXTERNALSYM WinExec}
function WinExec(lpCmdLine: LPCSTR; uCmdShow: UINT): UINT; stdcall;
{$EXTERNALSYM ClearCommBreak}
function ClearCommBreak(hFile: THandle): BOOL; stdcall;
{$EXTERNALSYM ClearCommError}
function ClearCommError(hFile: THandle; var lpErrors: DWORD; lpStat: PComStat): BOOL; stdcall;
{$EXTERNALSYM SetupComm}
function SetupComm(hFile: THandle; dwInQueue, dwOutQueue: DWORD): BOOL; stdcall;
{$EXTERNALSYM EscapeCommFunction}
function EscapeCommFunction(hFile: THandle; dwFunc: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetCommConfig}
function GetCommConfig(hCommDev: THandle; var lpCC: TCommConfig; var lpdwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetCommMask}
function GetCommMask(hFile: THandle; var lpEvtMask: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetCommProperties}
function GetCommProperties(hFile: THandle; var lpCommProp: TCommProp): BOOL; stdcall;
{$EXTERNALSYM GetCommModemStatus}
function GetCommModemStatus(hFile: THandle; var lpModemStat: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetCommState}
function GetCommState(hFile: THandle; var lpDCB: TDCB): BOOL; stdcall;
{$EXTERNALSYM GetCommTimeouts}
function GetCommTimeouts(hFile: THandle; var lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
{$EXTERNALSYM PurgeComm}
function PurgeComm(hFile: THandle; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetCommBreak}
function SetCommBreak(hFile: THandle): BOOL; stdcall;
{$EXTERNALSYM SetCommConfig}
function SetCommConfig(hCommDev: THandle; const lpCC: TCommConfig; dwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetCommMask}
function SetCommMask(hFile: THandle; dwEvtMask: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetCommState}
function SetCommState(hFile: THandle; const lpDCB: TDCB): BOOL; stdcall;
{$EXTERNALSYM SetCommTimeouts}
function SetCommTimeouts(hFile: THandle; const lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
{$EXTERNALSYM TransmitCommChar}
function TransmitCommChar(hFile: THandle; cChar: CHAR): BOOL; stdcall;
{$EXTERNALSYM WaitCommEvent}
function WaitCommEvent(hFile: THandle; var lpEvtMask: DWORD; lpOverlapped: POverlapped): BOOL; stdcall;
{$EXTERNALSYM SetTapePosition}
function SetTapePosition(hDevice: THandle; dwPositionMethod, dwPartition: DWORD;
  dwOffsetLow, dwOffsetHigh: DWORD; bImmediate: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetTapePosition}
function GetTapePosition(hDevice: THandle; dwPositionType: DWORD;
  var lpdwPartition, lpdwOffsetLow: DWORD; lpdwOffsetHigh: Pointer): DWORD; stdcall;
{$EXTERNALSYM PrepareTape}
function PrepareTape(hDevice: THandle; dwOperation: DWORD; bImmediate: BOOL): DWORD; stdcall;
{$EXTERNALSYM EraseTape}
function EraseTape(hDevice: THandle; dwEraseType: DWORD; bImmediate: BOOL): DWORD; stdcall;
{$EXTERNALSYM CreateTapePartition}
function CreateTapePartition(hDevice: THandle; dwPartitionMethod, dwCount, dwSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WriteTapemark}
function WriteTapemark(hDevice: THandle;
  dwTapemarkType, dwTapemarkCount: DWORD; bImmediate: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetTapeStatus}
function GetTapeStatus(hDevice: THandle): DWORD; stdcall;
{$EXTERNALSYM GetTapeParameters}
function GetTapeParameters(hDevice: THandle; dwOperation: DWORD;
  var lpdwSize: DWORD; lpTapeInformation: Pointer): DWORD; stdcall;

const
  {$EXTERNALSYM GET_TAPE_MEDIA_INFORMATION}
  GET_TAPE_MEDIA_INFORMATION = 0;
  {$EXTERNALSYM GET_TAPE_DRIVE_INFORMATION}
  GET_TAPE_DRIVE_INFORMATION = 1;

{$EXTERNALSYM SetTapeParameters}
function SetTapeParameters(hDevice: THandle; dwOperation: DWORD;
  lpTapeInformation: Pointer): DWORD; stdcall;

const
  {$EXTERNALSYM SET_TAPE_MEDIA_INFORMATION}
  SET_TAPE_MEDIA_INFORMATION = 0;
  {$EXTERNALSYM SET_TAPE_DRIVE_INFORMATION}
  SET_TAPE_DRIVE_INFORMATION = 1;

{$EXTERNALSYM Beep}
function Beep(dwFreq, dwDuration: DWORD): BOOL; stdcall;
{$EXTERNALSYM MulDiv}
function MulDiv(nNumber, nNumerator, nDenominator: Integer): Integer; stdcall;
{$EXTERNALSYM GetSystemTime}
procedure GetSystemTime(var lpSystemTime: TSystemTime); stdcall;
{$EXTERNALSYM GetSystemTimeAsFileTime}
procedure GetSystemTimeAsFileTime(var lpSystemTimeAsFileTime: TFileTime); stdcall;
{$EXTERNALSYM SetSystemTime}
function SetSystemTime(const lpSystemTime: TSystemTime): BOOL; stdcall;
{$EXTERNALSYM GetLocalTime}
procedure GetLocalTime(var lpSystemTime: TSystemTime); stdcall;
{$EXTERNALSYM SetLocalTime}
function SetLocalTime(const lpSystemTime: TSystemTime): BOOL; stdcall;
{$EXTERNALSYM GetSystemInfo}
procedure GetSystemInfo(var lpSystemInfo: TSystemInfo); stdcall;
{$EXTERNALSYM IsProcessorFeaturePresent}
function IsProcessorFeaturePresent(ProcessorFeature: DWORD): BOOL; stdcall;


type
  PTimeZoneInformation = ^TTimeZoneInformation;
  {$EXTERNALSYM _TIME_ZONE_INFORMATION}
  _TIME_ZONE_INFORMATION = record
    Bias: Longint;
    StandardName: array[0..31] of WCHAR;
    StandardDate: TSystemTime;
    StandardBias: Longint;
    DaylightName: array[0..31] of WCHAR;
    DaylightDate: TSystemTime;
    DaylightBias: Longint;
  end;
  TTimeZoneInformation = _TIME_ZONE_INFORMATION;
  {$EXTERNALSYM TIME_ZONE_INFORMATION}
  TIME_ZONE_INFORMATION = _TIME_ZONE_INFORMATION;

{$EXTERNALSYM SystemTimeToTzSpecificLocalTime}
function SystemTimeToTzSpecificLocalTime(lpTimeZoneInformation: PTimeZoneInformation;
  var lpUniversalTime, lpLocalTime: TSystemTime): BOOL; stdcall;
{$EXTERNALSYM GetTimeZoneInformation}
function GetTimeZoneInformation(var lpTimeZoneInformation: TTimeZoneInformation): DWORD; stdcall;
{$EXTERNALSYM SetTimeZoneInformation}
function SetTimeZoneInformation(const lpTimeZoneInformation: TTimeZoneInformation): BOOL; stdcall;

{ Routines to convert back and forth between system time and file time }

{$EXTERNALSYM SystemTimeToFileTime}
function SystemTimeToFileTime(const lpSystemTime: TSystemTime; var lpFileTime: TFileTime): BOOL; stdcall;
{$EXTERNALSYM FileTimeToLocalFileTime}
function FileTimeToLocalFileTime(const lpFileTime: TFileTime; var lpLocalFileTime: TFileTime): BOOL; stdcall;
{$EXTERNALSYM LocalFileTimeToFileTime}
function LocalFileTimeToFileTime(const lpLocalFileTime: TFileTime; var lpFileTime: TFileTime): BOOL; stdcall;
{$EXTERNALSYM FileTimeToSystemTime}
function FileTimeToSystemTime(const lpFileTime: TFileTime; var lpSystemTime: TSystemTime): BOOL; stdcall;
{$EXTERNALSYM CompareFileTime}
function CompareFileTime(const lpFileTime1, lpFileTime2: TFileTime): Longint; stdcall;
{$EXTERNALSYM FileTimeToDosDateTime}
function FileTimeToDosDateTime(const lpFileTime: TFileTime;
  var lpFatDate, lpFatTime: Word): BOOL; stdcall;
{$EXTERNALSYM DosDateTimeToFileTime}
function DosDateTimeToFileTime(wFatDate, wFatTime: Word; var lpFileTime: TFileTime): BOOL; stdcall;
{$EXTERNALSYM GetTickCount}
function GetTickCount: DWORD; stdcall;
{$EXTERNALSYM SetSystemTimeAdjustment}
function SetSystemTimeAdjustment(dwTimeAdjustment: DWORD; bTimeAdjustmentDisabled: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetSystemTimeAdjustment}
function GetSystemTimeAdjustment(var lpTimeAdjustment, lpTimeIncrement: DWORD;
  var lpTimeAdjustmentDisabled: BOOL): BOOL; stdcall;
{$EXTERNALSYM FormatMessageA}
function FormatMessageA(dwFlags: DWORD; lpSource: Pointer; dwMessageId: DWORD; dwLanguageId: DWORD;
  lpBuffer: PAnsiChar; nSize: DWORD; Arguments: Pointer): DWORD; stdcall;
{$EXTERNALSYM FormatMessageW}
function FormatMessageW(dwFlags: DWORD; lpSource: Pointer; dwMessageId: DWORD; dwLanguageId: DWORD;
  lpBuffer: PWideChar; nSize: DWORD; Arguments: Pointer): DWORD; stdcall;
{$EXTERNALSYM FormatMessage}
function FormatMessage(dwFlags: DWORD; lpSource: Pointer; dwMessageId: DWORD; dwLanguageId: DWORD;
  lpBuffer: PChar; nSize: DWORD; Arguments: Pointer): DWORD; stdcall;

const
  {$EXTERNALSYM FORMAT_MESSAGE_ALLOCATE_BUFFER}
  FORMAT_MESSAGE_ALLOCATE_BUFFER = $100;
  {$EXTERNALSYM FORMAT_MESSAGE_IGNORE_INSERTS}
  FORMAT_MESSAGE_IGNORE_INSERTS = $200;
  {$EXTERNALSYM FORMAT_MESSAGE_FROM_STRING}
  FORMAT_MESSAGE_FROM_STRING = $400;
  {$EXTERNALSYM FORMAT_MESSAGE_FROM_HMODULE}
  FORMAT_MESSAGE_FROM_HMODULE = $800;
  {$EXTERNALSYM FORMAT_MESSAGE_FROM_SYSTEM}
  FORMAT_MESSAGE_FROM_SYSTEM = $1000;
  {$EXTERNALSYM FORMAT_MESSAGE_ARGUMENT_ARRAY}
  FORMAT_MESSAGE_ARGUMENT_ARRAY = $2000;
  {$EXTERNALSYM FORMAT_MESSAGE_MAX_WIDTH_MASK}
  FORMAT_MESSAGE_MAX_WIDTH_MASK = 255;

{$EXTERNALSYM CreatePipe}
function CreatePipe(var hReadPipe, hWritePipe: THandle;
  lpPipeAttributes: PSecurityAttributes; nSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM ConnectNamedPipe}
function ConnectNamedPipe(hNamedPipe: THandle; lpOverlapped: POverlapped): BOOL; stdcall;
{$EXTERNALSYM DisconnectNamedPipe}
function DisconnectNamedPipe(hNamedPipe: THandle): BOOL; stdcall;
{$EXTERNALSYM SetNamedPipeHandleState}
function SetNamedPipeHandleState(hNamedPipe: THandle; var lpMode: DWORD;
  lpMaxCollectionCount, lpCollectDataTimeout: Pointer): BOOL; stdcall;
{$EXTERNALSYM GetNamedPipeInfo}
function GetNamedPipeInfo(hNamedPipe: THandle; var lpFlags: DWORD;
  lpOutBufferSize, lpInBufferSize, lpMaxInstances: Pointer): BOOL; stdcall;
{$EXTERNALSYM PeekNamedPipe}
function PeekNamedPipe(hNamedPipe: THandle; lpBuffer: Pointer; nBufferSize: DWORD;
  lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage: Pointer): BOOL; stdcall;
{$EXTERNALSYM TransactNamedPipe}
function TransactNamedPipe(hNamedPipe: THandle; lpInBuffer: Pointer; nInBufferSize: DWORD;
  lpOutBuffer: Pointer; nOutBufferSize: DWORD; var lpBytesRead: DWORD;
  lpOverlapped: POverlapped): BOOL; stdcall;

{$EXTERNALSYM CreateMailslotA}
function CreateMailslotA(lpName: PAnsiChar; nMaxMessageSize: DWORD;
  lReadTimeout: DWORD; lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
{$EXTERNALSYM CreateMailslotW}
function CreateMailslotW(lpName: PWideChar; nMaxMessageSize: DWORD;
  lReadTimeout: DWORD; lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
{$EXTERNALSYM CreateMailslot}
function CreateMailslot(lpName: PChar; nMaxMessageSize: DWORD;
  lReadTimeout: DWORD; lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
{$EXTERNALSYM GetMailslotInfo}
function GetMailslotInfo(hMailslot: THandle; lpMaxMessageSize: Pointer;
  var lpNextSize: DWORD; lpMessageCount, lpReadTimeout: Pointer): BOOL; stdcall;
{$EXTERNALSYM SetMailslotInfo}
function SetMailslotInfo(hMailslot: THandle; lReadTimeout: DWORD): BOOL; stdcall;
{$EXTERNALSYM MapViewOfFile}
function MapViewOfFile(hFileMappingObject: THandle; dwDesiredAccess: DWORD;
  dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap: DWORD): Pointer; stdcall;
{$EXTERNALSYM FlushViewOfFile}
function FlushViewOfFile(const lpBaseAddress: Pointer; dwNumberOfBytesToFlush: DWORD): BOOL; stdcall;
{$EXTERNALSYM UnmapViewOfFile}
function UnmapViewOfFile(lpBaseAddress: Pointer): BOOL; stdcall;
{$EXTERNALSYM EncryptFileA}
function EncryptFileA(lpFilename: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM EncryptFileW}
function EncryptFileW(lpFilename: PWideChar): BOOL; stdcall;
{$EXTERNALSYM EncryptFile}
function EncryptFile(lpFilename: PChar): BOOL; stdcall;
{$EXTERNALSYM DecryptFileA}
function DecryptFileA(lpFilename: PAnsiChar; dwReserved: DWORD): BOOL; stdcall;
{$EXTERNALSYM DecryptFileW}
function DecryptFileW(lpFilename: PWideChar; dwReserved: DWORD): BOOL; stdcall;
{$EXTERNALSYM DecryptFile}
function DecryptFile(lpFilename: PChar; dwReserved: DWORD): BOOL; stdcall;

const
  { Currently defined recovery flags }
  {$EXTERNALSYM EFS_USE_RECOVERY_KEYS}
  EFS_USE_RECOVERY_KEYS = $1;

type
  TFNExportFunc = function (pbData, pvCallbackContext: Pointer; ulLength: ULONG): DWORD; stdcall;
  TFNImportFunc = function (pbData, pvCallbackContext: Pointer; ulLength: ULONG): DWORD; stdcall;

const
  { OpenRaw flag values }
  {$EXTERNALSYM CREATE_FOR_IMPORT}
  CREATE_FOR_IMPORT = 1;
  {$EXTERNALSYM CREATE_FOR_DIR}
  CREATE_FOR_DIR = 2;

{$EXTERNALSYM OpenRawA}
function OpenRawA(lpFilename: PAnsiChar; ulFlags: ULONG; pvContext: Pointer): DWORD; stdcall;
{$EXTERNALSYM OpenRawW}
function OpenRawW(lpFilename: PWideChar; ulFlags: ULONG; pvContext: Pointer): DWORD; stdcall;
{$EXTERNALSYM OpenRaw}
function OpenRaw(lpFilename: PChar; ulFlags: ULONG; pvContext: Pointer): DWORD; stdcall;
function ReadRaw(pfExportCallback: TFNExportFunc; pvCallbackContext, pvContext: Pointer): DWORD; stdcall;
function WriteRaw(pfExportCallback: TFNImportFunc; pvCallbackContext, pvContext: Pointer): DWORD; stdcall;
procedure CloseRaw(pvContext: Pointer); stdcall;

type
  PRecoveryAgentInformationA = ^TRecoveryAgentInformationA;
  PRecoveryAgentInformationW = ^TRecoveryAgentInformationW;
  PRecoveryAgentInformation = PRecoveryAgentInformationA;
  {$EXTERNALSYM _RECOVERY_AGENT_INFORMATIONA}
  _RECOVERY_AGENT_INFORMATIONA = record
    NextEntryOffset: DWORD;
    AgentNameLength: DWORD;
    AgentInformation: array[0..0] of CHAR;
  end;
  {$EXTERNALSYM _RECOVERY_AGENT_INFORMATIONW}
  _RECOVERY_AGENT_INFORMATIONW = record
    NextEntryOffset: DWORD;
    AgentNameLength: DWORD;
    AgentInformation: array[0..0] of CHAR;
  end;
  {$EXTERNALSYM _RECOVERY_AGENT_INFORMATION}
  _RECOVERY_AGENT_INFORMATION = _RECOVERY_AGENT_INFORMATIONA;
  TRecoveryAgentInformationA = _RECOVERY_AGENT_INFORMATIONA;
  TRecoveryAgentInformationW = _RECOVERY_AGENT_INFORMATIONW;
  TRecoveryAgentInformation = TRecoveryAgentInformationA;
  {$EXTERNALSYM RECOVERY_AGENT_INFORMATIONA}
  RECOVERY_AGENT_INFORMATIONA = _RECOVERY_AGENT_INFORMATIONA;
  {$EXTERNALSYM RECOVERY_AGENT_INFORMATIONW}
  RECOVERY_AGENT_INFORMATIONW = _RECOVERY_AGENT_INFORMATIONW;
  {$EXTERNALSYM RECOVERY_AGENT_INFORMATION}
  RECOVERY_AGENT_INFORMATION = RECOVERY_AGENT_INFORMATIONA;

{$EXTERNALSYM QueryRecoveryAgentsA}
function QueryRecoveryAgentsA(p1: PAnsiChar; var p2: Pointer; var p3: TRecoveryAgentInformationA): DWORD; stdcall;
{$EXTERNALSYM QueryRecoveryAgentsW}
function QueryRecoveryAgentsW(p1: PWideChar; var p2: Pointer; var p3: TRecoveryAgentInformationW): DWORD; stdcall;
{$EXTERNALSYM QueryRecoveryAgents}
function QueryRecoveryAgents(p1: PChar; var p2: Pointer; var p3: TRecoveryAgentInformation): DWORD; stdcall;

{ _l Compat Functions }

{$EXTERNALSYM lstrcmpA}
function lstrcmpA(lpString1, lpString2: PAnsiChar): Integer; stdcall;
{$EXTERNALSYM lstrcmpW}
function lstrcmpW(lpString1, lpString2: PWideChar): Integer; stdcall;
{$EXTERNALSYM lstrcmp}
function lstrcmp(lpString1, lpString2: PChar): Integer; stdcall;
{$EXTERNALSYM lstrcmpiA}
function lstrcmpiA(lpString1, lpString2: PAnsiChar): Integer; stdcall;
{$EXTERNALSYM lstrcmpiW}
function lstrcmpiW(lpString1, lpString2: PWideChar): Integer; stdcall;
{$EXTERNALSYM lstrcmpi}
function lstrcmpi(lpString1, lpString2: PChar): Integer; stdcall;
{$EXTERNALSYM lstrcpynA}
function lstrcpynA(lpString1, lpString2: PAnsiChar; iMaxLength: Integer): PAnsiChar; stdcall;
{$EXTERNALSYM lstrcpynW}
function lstrcpynW(lpString1, lpString2: PWideChar; iMaxLength: Integer): PWideChar; stdcall;
{$EXTERNALSYM lstrcpyn}
function lstrcpyn(lpString1, lpString2: PChar; iMaxLength: Integer): PChar; stdcall;
{$EXTERNALSYM lstrcpyA}
function lstrcpyA(lpString1, lpString2: PAnsiChar): PAnsiChar; stdcall;
{$EXTERNALSYM lstrcpyW}
function lstrcpyW(lpString1, lpString2: PWideChar): PWideChar; stdcall;
{$EXTERNALSYM lstrcpy}
function lstrcpy(lpString1, lpString2: PChar): PChar; stdcall;
{$EXTERNALSYM lstrcatA}
function lstrcatA(lpString1, lpString2: PAnsiChar): PAnsiChar; stdcall;
{$EXTERNALSYM lstrcatW}
function lstrcatW(lpString1, lpString2: PWideChar): PWideChar; stdcall;
{$EXTERNALSYM lstrcat}
function lstrcat(lpString1, lpString2: PChar): PChar; stdcall;
{$EXTERNALSYM lstrlenA}
function lstrlenA(lpString: PAnsiChar): Integer; stdcall;
{$EXTERNALSYM lstrlenW}
function lstrlenW(lpString: PWideChar): Integer; stdcall;
{$EXTERNALSYM lstrlen}
function lstrlen(lpString: PChar): Integer; stdcall;

{$EXTERNALSYM OpenFile}
function OpenFile(const lpFileName: LPCSTR; var lpReOpenBuff: TOFStruct; uStyle: UINT): HFILE; stdcall;
{$EXTERNALSYM _lopen}
function _lopen(const lpPathName: LPCSTR; iReadWrite: Integer): HFILE; stdcall;
{$EXTERNALSYM _lcreat}
function _lcreat(const lpPathName: LPCSTR; iAttribute: Integer): HFILE; stdcall;
{$EXTERNALSYM _lread}
function _lread(hFile: HFILE; lpBuffer: Pointer; uBytes: UINT): UINT; stdcall;
{$EXTERNALSYM _lwrite}
function _lwrite(hFile: HFILE; const lpBuffer: LPCSTR; uBytes: UINT): UINT; stdcall;
{$EXTERNALSYM _hread}
function _hread(hFile: HFILE; lpBuffer: Pointer; lBytes: Longint): Longint; stdcall;
{$EXTERNALSYM _hwrite}
function _hwrite(hFile: HFILE; lpBuffer: LPCSTR; lBytes: Longint): Longint; stdcall;
{$EXTERNALSYM _lclose}
function _lclose(hFile: HFILE): HFILE; stdcall;
{$EXTERNALSYM _llseek}
function _llseek(hFile: HFILE; lOffset: Longint; iOrigin: Integer): Longint; stdcall;
{$EXTERNALSYM IsTextUnicode}
function IsTextUnicode(lpBuffer: Pointer; cb: Integer; lpi: PINT): BOOL; stdcall;
{$EXTERNALSYM TlsAlloc}
function TlsAlloc: DWORD; stdcall;

const
  {$EXTERNALSYM TLS_OUT_OF_INDEXES}
  TLS_OUT_OF_INDEXES = DWORD($FFFFFFFF);

{$EXTERNALSYM TlsGetValue}
function TlsGetValue(dwTlsIndex: DWORD): Pointer; stdcall;
{$EXTERNALSYM TlsSetValue}
function TlsSetValue(dwTlsIndex: DWORD; lpTlsValue: Pointer): BOOL; stdcall;
{$EXTERNALSYM TlsFree}
function TlsFree(dwTlsIndex: DWORD): BOOL; stdcall;

type
  TPROverlappedCompletionRoutine = TFarProc;

{$EXTERNALSYM SleepEx}
function SleepEx(dwMilliseconds: DWORD; bAlertable: BOOL): DWORD; stdcall;
{$EXTERNALSYM WaitForSingleObjectEx}
function WaitForSingleObjectEx(hHandle: THandle; dwMilliseconds: DWORD; bAlertable: BOOL): DWORD; stdcall;
{$EXTERNALSYM WaitForMultipleObjectsEx}
function WaitForMultipleObjectsEx(nCount: DWORD; lpHandles: PWOHandleArray;
  bWaitAll: BOOL; dwMilliseconds: DWORD; bAlertable: BOOL): DWORD; stdcall;
{$EXTERNALSYM SignalObjectAndWait}
function SignalObjectAndWait(hObjectToSignal: THandle; hObjectToWaitOn: THandle;
  dwMilliseconds: DWORD; bAlertable: BOOL): BOOL; stdcall;
{$EXTERNALSYM ReadFileEx}
function ReadFileEx(hFile: THandle; lpBuffer: Pointer; nNumberOfBytesToRead: DWORD;
  lpOverlapped: POverlapped; lpCompletionRoutine: TPROverlappedCompletionRoutine): BOOL; stdcall;
{$EXTERNALSYM WriteFileEx}
function WriteFileEx(hFile: THandle; lpBuffer: Pointer; nNumberOfBytesToWrite: DWORD;
  const lpOverlapped: TOverlapped; lpCompletionRoutine: FARPROC): BOOL; stdcall;
{$EXTERNALSYM BackupRead}
function BackupRead(hFile: THandle; lpBuffer: PByte; nNumberOfBytesToRead: DWORD;
  var lpNumberOfBytesRead: DWORD; bAbort: BOOL;
  bProcessSecurity: BOOL; var lpContext: Pointer): BOOL; stdcall;
{$EXTERNALSYM BackupSeek}
function BackupSeek(hFile: THandle; dwLowBytesToSeek, dwHighBytesToSeek: DWORD;
  var lpdwLowByteSeeked, lpdwHighByteSeeked: DWORD; lpContext: Pointer): BOOL; stdcall;
{$EXTERNALSYM BackupWrite}
function BackupWrite(hFile: THandle; lpBuffer: PByte; nNumberOfBytesToWrite: DWORD;
  var lpNumberOfBytesWritten: DWORD; bAbort, bProcessSecurity: BOOL; var lpContext: Pointer): BOOL; stdcall;

type
  PWIN32StreamID = ^TWIN32StreamID;
  {$EXTERNALSYM _WIN32_STREAM_ID}
  _WIN32_STREAM_ID = record
    dwStreamId: DWORD;
    dwStreamAttributes: DWORD;
    Size: TLargeInteger;
    dwStreamNameSize: DWORD;
    cStreamName: array[0..0] of WCHAR;
  end;
  TWIN32StreamID = _WIN32_STREAM_ID;
  {$EXTERNALSYM WIN32_STREAM_ID}
  WIN32_STREAM_ID = _WIN32_STREAM_ID;

const
  { Stream IDs }
  {$EXTERNALSYM BACKUP_INVALID}
  BACKUP_INVALID = 0;
  {$EXTERNALSYM BACKUP_DATA}
  BACKUP_DATA = 1;
  {$EXTERNALSYM BACKUP_EA_DATA}
  BACKUP_EA_DATA = 2;
  {$EXTERNALSYM BACKUP_SECURITY_DATA}
  BACKUP_SECURITY_DATA = 3;
  {$EXTERNALSYM BACKUP_ALTERNATE_DATA}
  BACKUP_ALTERNATE_DATA = 4;
  {$EXTERNALSYM BACKUP_LINK}
  BACKUP_LINK = 5;
  {$EXTERNALSYM BACKUP_PROPERTY_DATA}
  BACKUP_PROPERTY_DATA = 6;

  { Stream Attributes}
  {$EXTERNALSYM STREAM_NORMAL_ATTRIBUTE}
  STREAM_NORMAL_ATTRIBUTE = 0;
  {$EXTERNALSYM STREAM_MODIFIED_WHEN_READ}
  STREAM_MODIFIED_WHEN_READ = 1;
  {$EXTERNALSYM STREAM_CONTAINS_SECURITY}
  STREAM_CONTAINS_SECURITY = 2;
  {$EXTERNALSYM STREAM_CONTAINS_PROPERTIES}
  STREAM_CONTAINS_PROPERTIES = 4;

  { Dual Mode API below this line. Dual Mode Structures also included. }
  {$EXTERNALSYM STARTF_USESHOWWINDOW}
  STARTF_USESHOWWINDOW = 1;
  {$EXTERNALSYM STARTF_USESIZE}
  STARTF_USESIZE = 2;
  {$EXTERNALSYM STARTF_USEPOSITION}
  STARTF_USEPOSITION = 4;
  {$EXTERNALSYM STARTF_USECOUNTCHARS}
  STARTF_USECOUNTCHARS = 8;
  {$EXTERNALSYM STARTF_USEFILLATTRIBUTE}
  STARTF_USEFILLATTRIBUTE = $10;
  {$EXTERNALSYM STARTF_RUNFULLSCREEN}
  STARTF_RUNFULLSCREEN = $20;  { ignored for non-x86 platforms }
  {$EXTERNALSYM STARTF_FORCEONFEEDBACK}
  STARTF_FORCEONFEEDBACK = $40;
  {$EXTERNALSYM STARTF_FORCEOFFFEEDBACK}
  STARTF_FORCEOFFFEEDBACK = $80;
  {$EXTERNALSYM STARTF_USESTDHANDLES}
  STARTF_USESTDHANDLES = $100;
  {$EXTERNALSYM STARTF_USEHOTKEY}
  STARTF_USEHOTKEY = $200;

type
  PStartupInfo = ^TStartupInfo;
  {$EXTERNALSYM _STARTUPINFOA}
  _STARTUPINFOA = record
    cb: DWORD;
    lpReserved: Pointer;
    lpDesktop: Pointer;
    lpTitle: Pointer;
    dwX: DWORD;
    dwY: DWORD;
    dwXSize: DWORD;
    dwYSize: DWORD;
    dwXCountChars: DWORD;
    dwYCountChars: DWORD;
    dwFillAttribute: DWORD;
    dwFlags: DWORD;
    wShowWindow: Word;
    cbReserved2: Word;
    lpReserved2: PByte;
    hStdInput: THandle;
    hStdOutput: THandle;
    hStdError: THandle;
  end;
  TStartupInfo = _STARTUPINFOA;
  {$EXTERNALSYM STARTUPINFO}
  STARTUPINFO = _STARTUPINFOA;

const
  {$EXTERNALSYM SHUTDOWN_NORETRY}
  SHUTDOWN_NORETRY = 1;

type
  PWin32FindDataA = ^TWin32FindDataA;
  PWin32FindDataW = ^TWin32FindDataW;
  PWin32FindData = PWin32FindDataA;
  {$EXTERNALSYM _WIN32_FIND_DATAA}
  _WIN32_FIND_DATAA = record
    dwFileAttributes: DWORD;
    ftCreationTime: TFileTime;
    ftLastAccessTime: TFileTime;
    ftLastWriteTime: TFileTime;
    nFileSizeHigh: DWORD;
    nFileSizeLow: DWORD;
    dwReserved0: DWORD;
    dwReserved1: DWORD;
    cFileName: array[0..MAX_PATH - 1] of AnsiChar;
    cAlternateFileName: array[0..13] of AnsiChar;
  end;
  {$EXTERNALSYM _WIN32_FIND_DATAW}
  _WIN32_FIND_DATAW = record
    dwFileAttributes: DWORD;
    ftCreationTime: TFileTime;
    ftLastAccessTime: TFileTime;
    ftLastWriteTime: TFileTime;
    nFileSizeHigh: DWORD;
    nFileSizeLow: DWORD;
    dwReserved0: DWORD;
    dwReserved1: DWORD;
    cFileName: array[0..MAX_PATH - 1] of WideChar;
    cAlternateFileName: array[0..13] of WideChar;
  end;
  {$EXTERNALSYM _WIN32_FIND_DATA}
  _WIN32_FIND_DATA = _WIN32_FIND_DATAA;
  TWin32FindDataA = _WIN32_FIND_DATAA;
  TWin32FindDataW = _WIN32_FIND_DATAW;
  TWin32FindData = TWin32FindDataA;
  {$EXTERNALSYM WIN32_FIND_DATAA}
  WIN32_FIND_DATAA = _WIN32_FIND_DATAA;
  {$EXTERNALSYM WIN32_FIND_DATAW}
  WIN32_FIND_DATAW = _WIN32_FIND_DATAW;
  {$EXTERNALSYM WIN32_FIND_DATA}
  WIN32_FIND_DATA = WIN32_FIND_DATAA;

  PWin32FileAttributeData = ^TWin32FileAttributeData;
  {$EXTERNALSYM _WIN32_FILE_ATTRIBUTE_DATA}
  _WIN32_FILE_ATTRIBUTE_DATA = record
    dwFileAttributes: DWORD;
    ftCreationTime: TFileTime;
    ftLastAccessTime: TFileTime;
    ftLastWriteTime: TFileTime;
    nFileSizeHigh: DWORD;
    nFileSizeLow: DWORD;
  end;
  TWin32FileAttributeData = _WIN32_FILE_ATTRIBUTE_DATA;
  {$EXTERNALSYM WIN32_FILE_ATTRIBUTE_DATA}
  WIN32_FILE_ATTRIBUTE_DATA = _WIN32_FILE_ATTRIBUTE_DATA;

{$EXTERNALSYM CreateMutexA}
function CreateMutexA(lpMutexAttributes: PSecurityAttributes;
  bInitialOwner: BOOL; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM CreateMutexW}
function CreateMutexW(lpMutexAttributes: PSecurityAttributes;
  bInitialOwner: BOOL; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM CreateMutex}
function CreateMutex(lpMutexAttributes: PSecurityAttributes;
  bInitialOwner: BOOL; lpName: PChar): THandle; stdcall;
{$EXTERNALSYM OpenMutexA}
function OpenMutexA(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM OpenMutexW}
function OpenMutexW(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM OpenMutex}
function OpenMutex(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PChar): THandle; stdcall;
{$EXTERNALSYM CreateEventA}
function CreateEventA(lpEventAttributes: PSecurityAttributes;
  bManualReset, bInitialState: BOOL; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM CreateEventW}
function CreateEventW(lpEventAttributes: PSecurityAttributes;
  bManualReset, bInitialState: BOOL; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM CreateEvent}
function CreateEvent(lpEventAttributes: PSecurityAttributes;
  bManualReset, bInitialState: BOOL; lpName: PChar): THandle; stdcall;
{$EXTERNALSYM OpenEventA}
function OpenEventA(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM OpenEventW}
function OpenEventW(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM OpenEvent}
function OpenEvent(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PChar): THandle; stdcall;
{$EXTERNALSYM CreateSemaphoreA}
function CreateSemaphoreA(lpSemaphoreAttributes: PSecurityAttributes;
  lInitialCount, lMaximumCount: Longint; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM CreateSemaphoreW}
function CreateSemaphoreW(lpSemaphoreAttributes: PSecurityAttributes;
  lInitialCount, lMaximumCount: Longint; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM CreateSemaphore}
function CreateSemaphore(lpSemaphoreAttributes: PSecurityAttributes;
  lInitialCount, lMaximumCount: Longint; lpName: PChar): THandle; stdcall;
{$EXTERNALSYM OpenSemaphoreA}
function OpenSemaphoreA(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM OpenSemaphoreW}
function OpenSemaphoreW(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM OpenSemaphore}
function OpenSemaphore(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PChar): THandle; stdcall;

type
  TFNTimerAPCRoutine = TFarProc;

{$EXTERNALSYM CreateWaitableTimerA}
function CreateWaitableTimerA(lpTimerAttributes: PSecurityAttributes;
  bManualReset: BOOL; lpTimerName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM CreateWaitableTimerW}
function CreateWaitableTimerW(lpTimerAttributes: PSecurityAttributes;
  bManualReset: BOOL; lpTimerName: PWideChar): THandle; stdcall;
{$EXTERNALSYM CreateWaitableTimer}
function CreateWaitableTimer(lpTimerAttributes: PSecurityAttributes;
  bManualReset: BOOL; lpTimerName: PChar): THandle; stdcall;
{$EXTERNALSYM OpenWaitableTimerA}
function OpenWaitableTimerA(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  lpTimerName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM OpenWaitableTimerW}
function OpenWaitableTimerW(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  lpTimerName: PWideChar): THandle; stdcall;
{$EXTERNALSYM OpenWaitableTimer}
function OpenWaitableTimer(dwDesiredAccess: DWORD; bInheritHandle: BOOL;
  lpTimerName: PChar): THandle; stdcall;
{$EXTERNALSYM SetWaitableTimer}
function SetWaitableTimer(hTimer: THandle; const lpDueTime: TLargeInteger;
  lPeriod: Longint; pfnCompletionRoutine: TFNTimerAPCRoutine;
  lpArgToCompletionRoutine: Pointer; fResume: BOOL): BOOL; stdcall;
{$EXTERNALSYM CancelWaitableTimer}
function CancelWaitableTimer(hTimer: THandle): BOOL; stdcall;
{$EXTERNALSYM CreateFileMappingA}
function CreateFileMappingA(hFile: THandle; lpFileMappingAttributes: PSecurityAttributes;
  flProtect, dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM CreateFileMappingW}
function CreateFileMappingW(hFile: THandle; lpFileMappingAttributes: PSecurityAttributes;
  flProtect, dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM CreateFileMapping}
function CreateFileMapping(hFile: THandle; lpFileMappingAttributes: PSecurityAttributes;
  flProtect, dwMaximumSizeHigh, dwMaximumSizeLow: DWORD; lpName: PChar): THandle; stdcall;
{$EXTERNALSYM OpenFileMappingA}
function OpenFileMappingA(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM OpenFileMappingW}
function OpenFileMappingW(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PWideChar): THandle; stdcall;
{$EXTERNALSYM OpenFileMapping}
function OpenFileMapping(dwDesiredAccess: DWORD; bInheritHandle: BOOL; lpName: PChar): THandle; stdcall;
{$EXTERNALSYM GetLogicalDriveStringsA}
function GetLogicalDriveStringsA(nBufferLength: DWORD; lpBuffer: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetLogicalDriveStringsW}
function GetLogicalDriveStringsW(nBufferLength: DWORD; lpBuffer: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetLogicalDriveStrings}
function GetLogicalDriveStrings(nBufferLength: DWORD; lpBuffer: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM LoadLibraryA}
function LoadLibraryA(lpLibFileName: PAnsiChar): HMODULE; stdcall;
{$EXTERNALSYM LoadLibraryW}
function LoadLibraryW(lpLibFileName: PWideChar): HMODULE; stdcall;
{$EXTERNALSYM LoadLibrary}
function LoadLibrary(lpLibFileName: PChar): HMODULE; stdcall;
{$EXTERNALSYM LoadLibraryExA}
function LoadLibraryExA(lpLibFileName: PAnsiChar; hFile: THandle; dwFlags: DWORD): HMODULE; stdcall;
{$EXTERNALSYM LoadLibraryExW}
function LoadLibraryExW(lpLibFileName: PWideChar; hFile: THandle; dwFlags: DWORD): HMODULE; stdcall;
{$EXTERNALSYM LoadLibraryEx}
function LoadLibraryEx(lpLibFileName: PChar; hFile: THandle; dwFlags: DWORD): HMODULE; stdcall;

const
  {$EXTERNALSYM DONT_RESOLVE_DLL_REFERENCES}
  DONT_RESOLVE_DLL_REFERENCES = 1;
  {$EXTERNALSYM LOAD_LIBRARY_AS_DATAFILE}
  LOAD_LIBRARY_AS_DATAFILE = 2;
  {$EXTERNALSYM LOAD_WITH_ALTERED_SEARCH_PATH}
  LOAD_WITH_ALTERED_SEARCH_PATH = 8;

{$EXTERNALSYM GetModuleFileNameA}
function GetModuleFileNameA(hModule: HINST; lpFilename: PAnsiChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetModuleFileNameW}
function GetModuleFileNameW(hModule: HINST; lpFilename: PWideChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetModuleFileName}
function GetModuleFileName(hModule: HINST; lpFilename: PChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetModuleHandleA}
function GetModuleHandleA(lpModuleName: PAnsiChar): HMODULE; stdcall;
{$EXTERNALSYM GetModuleHandleW}
function GetModuleHandleW(lpModuleName: PWideChar): HMODULE; stdcall;
{$EXTERNALSYM GetModuleHandle}
function GetModuleHandle(lpModuleName: PChar): HMODULE; stdcall;
{$EXTERNALSYM CreateProcessA}
function CreateProcessA(lpApplicationName: PAnsiChar; lpCommandLine: PAnsiChar;
  lpProcessAttributes, lpThreadAttributes: PSecurityAttributes;
  bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: Pointer;
  lpCurrentDirectory: PAnsiChar; const lpStartupInfo: TStartupInfo;
  var lpProcessInformation: TProcessInformation): BOOL; stdcall;
{$EXTERNALSYM CreateProcessW}
function CreateProcessW(lpApplicationName: PWideChar; lpCommandLine: PWideChar;
  lpProcessAttributes, lpThreadAttributes: PSecurityAttributes;
  bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: Pointer;
  lpCurrentDirectory: PWideChar; const lpStartupInfo: TStartupInfo;
  var lpProcessInformation: TProcessInformation): BOOL; stdcall;
{$EXTERNALSYM CreateProcess}
function CreateProcess(lpApplicationName: PChar; lpCommandLine: PChar;
  lpProcessAttributes, lpThreadAttributes: PSecurityAttributes;
  bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: Pointer;
  lpCurrentDirectory: PChar; const lpStartupInfo: TStartupInfo;
  var lpProcessInformation: TProcessInformation): BOOL; stdcall;
{$EXTERNALSYM SetProcessShutdownParameters}
function SetProcessShutdownParameters(dwLevel, dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetProcessShutdownParameters}
function GetProcessShutdownParameters(var lpdwLevel, lpdwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetProcessVersion}
function GetProcessVersion(ProcessId: DWORD): DWORD; stdcall;
{$EXTERNALSYM FatalAppExitA}
procedure FatalAppExitA(uAction: UINT; lpMessageText: PAnsiChar); stdcall;
{$EXTERNALSYM FatalAppExitW}
procedure FatalAppExitW(uAction: UINT; lpMessageText: PWideChar); stdcall;
{$EXTERNALSYM FatalAppExit}
procedure FatalAppExit(uAction: UINT; lpMessageText: PChar); stdcall;
{$EXTERNALSYM GetStartupInfoA}
procedure GetStartupInfoA(var lpStartupInfo: TStartupInfo); stdcall;
{$EXTERNALSYM GetStartupInfoW}
procedure GetStartupInfoW(var lpStartupInfo: TStartupInfo); stdcall;
{$EXTERNALSYM GetStartupInfo}
procedure GetStartupInfo(var lpStartupInfo: TStartupInfo); stdcall;
{$EXTERNALSYM GetCommandLineA}
function GetCommandLineA: PAnsiChar; stdcall;
{$EXTERNALSYM GetCommandLineW}
function GetCommandLineW: PWideChar; stdcall;
{$EXTERNALSYM GetCommandLine}
function GetCommandLine: PChar; stdcall;
{$EXTERNALSYM GetEnvironmentVariableA}
function GetEnvironmentVariableA(lpName: PAnsiChar; lpBuffer: PAnsiChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetEnvironmentVariableW}
function GetEnvironmentVariableW(lpName: PWideChar; lpBuffer: PWideChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetEnvironmentVariable}
function GetEnvironmentVariable(lpName: PChar; lpBuffer: PChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM SetEnvironmentVariableA}
function SetEnvironmentVariableA(lpName, lpValue: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetEnvironmentVariableW}
function SetEnvironmentVariableW(lpName, lpValue: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetEnvironmentVariable}
function SetEnvironmentVariable(lpName, lpValue: PChar): BOOL; stdcall;
{$EXTERNALSYM ExpandEnvironmentStringsA}
function ExpandEnvironmentStringsA(lpSrc: PAnsiChar; lpDst: PAnsiChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM ExpandEnvironmentStringsW}
function ExpandEnvironmentStringsW(lpSrc: PWideChar; lpDst: PWideChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM ExpandEnvironmentStrings}
function ExpandEnvironmentStrings(lpSrc: PChar; lpDst: PChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM OutputDebugStringA}
procedure OutputDebugStringA(lpOutputString: PAnsiChar); stdcall;
{$EXTERNALSYM OutputDebugStringW}
procedure OutputDebugStringW(lpOutputString: PWideChar); stdcall;
{$EXTERNALSYM OutputDebugString}
procedure OutputDebugString(lpOutputString: PChar); stdcall;
{$EXTERNALSYM FindResourceA}
function FindResourceA(hModule: HMODULE; lpName, lpType: PAnsiChar): HRSRC; stdcall;
{$EXTERNALSYM FindResourceW}
function FindResourceW(hModule: HMODULE; lpName, lpType: PWideChar): HRSRC; stdcall;
{$EXTERNALSYM FindResource}
function FindResource(hModule: HMODULE; lpName, lpType: PChar): HRSRC; stdcall;
{$EXTERNALSYM FindResourceExA}
function FindResourceExA(hModule: HMODULE; lpType, lpName: PAnsiChar; wLanguage: Word): HRSRC; stdcall;
{$EXTERNALSYM FindResourceExW}
function FindResourceExW(hModule: HMODULE; lpType, lpName: PWideChar; wLanguage: Word): HRSRC; stdcall;
{$EXTERNALSYM FindResourceEx}
function FindResourceEx(hModule: HMODULE; lpType, lpName: PChar; wLanguage: Word): HRSRC; stdcall;

type
  {$EXTERNALSYM ENUMRESTYPEPROC}
  ENUMRESTYPEPROC = FARPROC;
  {$EXTERNALSYM ENUMRESNAMEPROC}
  ENUMRESNAMEPROC = FARPROC;
  {$EXTERNALSYM ENUMRESLANGPROC}
  ENUMRESLANGPROC = FARPROC;

{$EXTERNALSYM EnumResourceTypesA}
function EnumResourceTypesA(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROC;
  lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceTypesW}
function EnumResourceTypesW(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROC;
  lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceTypes}
function EnumResourceTypes(hModule: HMODULE; lpEnumFunc: ENUMRESTYPEPROC;
  lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceNamesA}
function EnumResourceNamesA(hModule: HMODULE; lpType: PAnsiChar;
  lpEnumFunc: ENUMRESNAMEPROC; lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceNamesW}
function EnumResourceNamesW(hModule: HMODULE; lpType: PWideChar;
  lpEnumFunc: ENUMRESNAMEPROC; lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceNames}
function EnumResourceNames(hModule: HMODULE; lpType: PChar;
  lpEnumFunc: ENUMRESNAMEPROC; lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceLanguagesA}
function EnumResourceLanguagesA(hModule: HMODULE; lpType, lpName: PAnsiChar;
  lpEnumFunc: ENUMRESLANGPROC; lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceLanguagesW}
function EnumResourceLanguagesW(hModule: HMODULE; lpType, lpName: PWideChar;
  lpEnumFunc: ENUMRESLANGPROC; lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM EnumResourceLanguages}
function EnumResourceLanguages(hModule: HMODULE; lpType, lpName: PChar;
  lpEnumFunc: ENUMRESLANGPROC; lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM BeginUpdateResourceA}
function BeginUpdateResourceA(pFileName: PAnsiChar; bDeleteExistingResources: BOOL): THandle; stdcall;
{$EXTERNALSYM BeginUpdateResourceW}
function BeginUpdateResourceW(pFileName: PWideChar; bDeleteExistingResources: BOOL): THandle; stdcall;
{$EXTERNALSYM BeginUpdateResource}
function BeginUpdateResource(pFileName: PChar; bDeleteExistingResources: BOOL): THandle; stdcall;
{$EXTERNALSYM UpdateResourceA}
function UpdateResourceA(hUpdate: THandle; lpType, lpName: PAnsiChar;
  wLanguage: Word; lpData: Pointer; cbData: DWORD): BOOL; stdcall;
{$EXTERNALSYM UpdateResourceW}
function UpdateResourceW(hUpdate: THandle; lpType, lpName: PWideChar;
  wLanguage: Word; lpData: Pointer; cbData: DWORD): BOOL; stdcall;
{$EXTERNALSYM UpdateResource}
function UpdateResource(hUpdate: THandle; lpType, lpName: PChar;
  wLanguage: Word; lpData: Pointer; cbData: DWORD): BOOL; stdcall;
{$EXTERNALSYM EndUpdateResourceA}
function EndUpdateResourceA(hUpdate: THandle; fDiscard: BOOL): BOOL; stdcall;
{$EXTERNALSYM EndUpdateResourceW}
function EndUpdateResourceW(hUpdate: THandle; fDiscard: BOOL): BOOL; stdcall;
{$EXTERNALSYM EndUpdateResource}
function EndUpdateResource(hUpdate: THandle; fDiscard: BOOL): BOOL; stdcall;
{$EXTERNALSYM GlobalAddAtomA}
function GlobalAddAtomA(lpString: PAnsiChar): ATOM; stdcall;
{$EXTERNALSYM GlobalAddAtomW}
function GlobalAddAtomW(lpString: PWideChar): ATOM; stdcall;
{$EXTERNALSYM GlobalAddAtom}
function GlobalAddAtom(lpString: PChar): ATOM; stdcall;
{$EXTERNALSYM GlobalFindAtomA}
function GlobalFindAtomA(lpString: PAnsiChar): ATOM; stdcall;
{$EXTERNALSYM GlobalFindAtomW}
function GlobalFindAtomW(lpString: PWideChar): ATOM; stdcall;
{$EXTERNALSYM GlobalFindAtom}
function GlobalFindAtom(lpString: PChar): ATOM; stdcall;
{$EXTERNALSYM GlobalGetAtomNameA}
function GlobalGetAtomNameA(nAtom: ATOM; lpBuffer: PAnsiChar; nSize: Integer): UINT; stdcall;
{$EXTERNALSYM GlobalGetAtomNameW}
function GlobalGetAtomNameW(nAtom: ATOM; lpBuffer: PWideChar; nSize: Integer): UINT; stdcall;
{$EXTERNALSYM GlobalGetAtomName}
function GlobalGetAtomName(nAtom: ATOM; lpBuffer: PChar; nSize: Integer): UINT; stdcall;
{$EXTERNALSYM AddAtomA}
function AddAtomA(lpString: PAnsiChar): ATOM; stdcall;
{$EXTERNALSYM AddAtomW}
function AddAtomW(lpString: PWideChar): ATOM; stdcall;
{$EXTERNALSYM AddAtom}
function AddAtom(lpString: PChar): ATOM; stdcall;
{$EXTERNALSYM FindAtomA}
function FindAtomA(lpString: PAnsiChar): ATOM; stdcall;
{$EXTERNALSYM FindAtomW}
function FindAtomW(lpString: PWideChar): ATOM; stdcall;
{$EXTERNALSYM FindAtom}
function FindAtom(lpString: PChar): ATOM; stdcall;
{$EXTERNALSYM GetAtomNameA}
function GetAtomNameA(nAtom: ATOM; lpBuffer: PAnsiChar; nSize: Integer): UINT; stdcall;
{$EXTERNALSYM GetAtomNameW}
function GetAtomNameW(nAtom: ATOM; lpBuffer: PWideChar; nSize: Integer): UINT; stdcall;
{$EXTERNALSYM GetAtomName}
function GetAtomName(nAtom: ATOM; lpBuffer: PChar; nSize: Integer): UINT; stdcall;
{$EXTERNALSYM GetProfileIntA}
function GetProfileIntA(lpAppName, lpKeyName: PAnsiChar; nDefault: Integer): UINT; stdcall;
{$EXTERNALSYM GetProfileIntW}
function GetProfileIntW(lpAppName, lpKeyName: PWideChar; nDefault: Integer): UINT; stdcall;
{$EXTERNALSYM GetProfileInt}
function GetProfileInt(lpAppName, lpKeyName: PChar; nDefault: Integer): UINT; stdcall;
{$EXTERNALSYM GetProfileStringA}
function GetProfileStringA(lpAppName, lpKeyName, lpDefault: PAnsiChar;
  lpReturnedString: PAnsiChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetProfileStringW}
function GetProfileStringW(lpAppName, lpKeyName, lpDefault: PWideChar;
  lpReturnedString: PWideChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetProfileString}
function GetProfileString(lpAppName, lpKeyName, lpDefault: PChar;
  lpReturnedString: PChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WriteProfileStringA}
function WriteProfileStringA(lpAppName, lpKeyName, lpString: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM WriteProfileStringW}
function WriteProfileStringW(lpAppName, lpKeyName, lpString: PWideChar): BOOL; stdcall;
{$EXTERNALSYM WriteProfileString}
function WriteProfileString(lpAppName, lpKeyName, lpString: PChar): BOOL; stdcall;
{$EXTERNALSYM GetProfileSectionA}
function GetProfileSectionA(lpAppName: PAnsiChar; lpReturnedString: PAnsiChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetProfileSectionW}
function GetProfileSectionW(lpAppName: PWideChar; lpReturnedString: PWideChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetProfileSection}
function GetProfileSection(lpAppName: PChar; lpReturnedString: PChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WriteProfileSectionA}
function WriteProfileSectionA(lpAppName, lpString: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM WriteProfileSectionW}
function WriteProfileSectionW(lpAppName, lpString: PWideChar): BOOL; stdcall;
{$EXTERNALSYM WriteProfileSection}
function WriteProfileSection(lpAppName, lpString: PChar): BOOL; stdcall;
{$EXTERNALSYM GetPrivateProfileIntA}
function GetPrivateProfileIntA(lpAppName, lpKeyName: PAnsiChar;
  nDefault: Integer; lpFileName: PAnsiChar): UINT; stdcall;
{$EXTERNALSYM GetPrivateProfileIntW}
function GetPrivateProfileIntW(lpAppName, lpKeyName: PWideChar;
  nDefault: Integer; lpFileName: PWideChar): UINT; stdcall;
{$EXTERNALSYM GetPrivateProfileInt}
function GetPrivateProfileInt(lpAppName, lpKeyName: PChar;
  nDefault: Integer; lpFileName: PChar): UINT; stdcall;
{$EXTERNALSYM GetPrivateProfileStringA}
function GetPrivateProfileStringA(lpAppName, lpKeyName, lpDefault: PAnsiChar;
  lpReturnedString: PAnsiChar; nSize: DWORD; lpFileName: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetPrivateProfileStringW}
function GetPrivateProfileStringW(lpAppName, lpKeyName, lpDefault: PWideChar;
  lpReturnedString: PWideChar; nSize: DWORD; lpFileName: PWideChar): DWORD; stdcall;
{$EXTERNALSYM GetPrivateProfileString}
function GetPrivateProfileString(lpAppName, lpKeyName, lpDefault: PChar;
  lpReturnedString: PChar; nSize: DWORD; lpFileName: PChar): DWORD; stdcall;
{$EXTERNALSYM WritePrivateProfileStringA}
function WritePrivateProfileStringA(lpAppName, lpKeyName, lpString, lpFileName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM WritePrivateProfileStringW}
function WritePrivateProfileStringW(lpAppName, lpKeyName, lpString, lpFileName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM WritePrivateProfileString}
function WritePrivateProfileString(lpAppName, lpKeyName, lpString, lpFileName: PChar): BOOL; stdcall;
{$EXTERNALSYM GetPrivateProfileSectionA}
function GetPrivateProfileSectionA(lpAppName: PAnsiChar;
  lpReturnedString: PAnsiChar; nSize: DWORD; lpFileName: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetPrivateProfileSectionW}
function GetPrivateProfileSectionW(lpAppName: PWideChar;
  lpReturnedString: PWideChar; nSize: DWORD; lpFileName: PWideChar): DWORD; stdcall;
{$EXTERNALSYM GetPrivateProfileSection}
function GetPrivateProfileSection(lpAppName: PChar;
  lpReturnedString: PChar; nSize: DWORD; lpFileName: PChar): DWORD; stdcall;
{$EXTERNALSYM WritePrivateProfileSectionA}
function WritePrivateProfileSectionA(lpAppName, lpString, lpFileName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM WritePrivateProfileSectionW}
function WritePrivateProfileSectionW(lpAppName, lpString, lpFileName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM WritePrivateProfileSection}
function WritePrivateProfileSection(lpAppName, lpString, lpFileName: PChar): BOOL; stdcall;
{$EXTERNALSYM GetPrivateProfileSectionNamesA}
function GetPrivateProfileSectionNamesA(lpszReturnBuffer: PAnsiChar; nSize: DWORD; lpFileName: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetPrivateProfileSectionNamesW}
function GetPrivateProfileSectionNamesW(lpszReturnBuffer: PWideChar; nSize: DWORD; lpFileName: PWideChar): DWORD; stdcall;
{$EXTERNALSYM GetPrivateProfileSectionNames}
function GetPrivateProfileSectionNames(lpszReturnBuffer: PChar; nSize: DWORD; lpFileName: PChar): DWORD; stdcall;
{$EXTERNALSYM GetPrivateProfileStructA}
function GetPrivateProfileStructA(lpszSection, lpszKey: PAnsiChar;
  lpStruct: Pointer; uSizeStruct: UINT; szFile: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM GetPrivateProfileStructW}
function GetPrivateProfileStructW(lpszSection, lpszKey: PWideChar;
  lpStruct: Pointer; uSizeStruct: UINT; szFile: PWideChar): BOOL; stdcall;
{$EXTERNALSYM GetPrivateProfileStruct}
function GetPrivateProfileStruct(lpszSection, lpszKey: PChar;
  lpStruct: Pointer; uSizeStruct: UINT; szFile: PChar): BOOL; stdcall;
{$EXTERNALSYM WritePrivateProfileStructA}
function WritePrivateProfileStructA(lpszSection, lpszKey: PAnsiChar;
  lpStruct: Pointer; uSizeStruct: UINT; szFile: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM WritePrivateProfileStructW}
function WritePrivateProfileStructW(lpszSection, lpszKey: PWideChar;
  lpStruct: Pointer; uSizeStruct: UINT; szFile: PWideChar): BOOL; stdcall;
{$EXTERNALSYM WritePrivateProfileStruct}
function WritePrivateProfileStruct(lpszSection, lpszKey: PChar;
  lpStruct: Pointer; uSizeStruct: UINT; szFile: PChar): BOOL; stdcall;
{$EXTERNALSYM GetDriveTypeA}
function GetDriveTypeA(lpRootPathName: PAnsiChar): UINT; stdcall;
{$EXTERNALSYM GetDriveTypeW}
function GetDriveTypeW(lpRootPathName: PWideChar): UINT; stdcall;
{$EXTERNALSYM GetDriveType}
function GetDriveType(lpRootPathName: PChar): UINT; stdcall;
{$EXTERNALSYM GetSystemDirectoryA}
function GetSystemDirectoryA(lpBuffer: PAnsiChar; uSize: UINT): UINT; stdcall;
{$EXTERNALSYM GetSystemDirectoryW}
function GetSystemDirectoryW(lpBuffer: PWideChar; uSize: UINT): UINT; stdcall;
{$EXTERNALSYM GetSystemDirectory}
function GetSystemDirectory(lpBuffer: PChar; uSize: UINT): UINT; stdcall;
{$EXTERNALSYM GetTempPathA}
function GetTempPathA(nBufferLength: DWORD; lpBuffer: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetTempPathW}
function GetTempPathW(nBufferLength: DWORD; lpBuffer: PWideChar): DWORD; stdcall;
{$EXTERNALSYM GetTempPath}
function GetTempPath(nBufferLength: DWORD; lpBuffer: PChar): DWORD; stdcall;
{$EXTERNALSYM GetTempFileNameA}
function GetTempFileNameA(lpPathName, lpPrefixString: PAnsiChar;
  uUnique: UINT; lpTempFileName: PAnsiChar): UINT; stdcall;
{$EXTERNALSYM GetTempFileNameW}
function GetTempFileNameW(lpPathName, lpPrefixString: PWideChar;
  uUnique: UINT; lpTempFileName: PWideChar): UINT; stdcall;
{$EXTERNALSYM GetTempFileName}
function GetTempFileName(lpPathName, lpPrefixString: PChar;
  uUnique: UINT; lpTempFileName: PChar): UINT; stdcall;
{$EXTERNALSYM GetWindowsDirectoryA}
function GetWindowsDirectoryA(lpBuffer: PAnsiChar; uSize: UINT): UINT; stdcall;
{$EXTERNALSYM GetWindowsDirectoryW}
function GetWindowsDirectoryW(lpBuffer: PWideChar; uSize: UINT): UINT; stdcall;
{$EXTERNALSYM GetWindowsDirectory}
function GetWindowsDirectory(lpBuffer: PChar; uSize: UINT): UINT; stdcall;
{$EXTERNALSYM SetCurrentDirectoryA}
function SetCurrentDirectoryA(lpPathName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetCurrentDirectoryW}
function SetCurrentDirectoryW(lpPathName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetCurrentDirectory}
function SetCurrentDirectory(lpPathName: PChar): BOOL; stdcall;
{$EXTERNALSYM GetCurrentDirectoryA}
function GetCurrentDirectoryA(nBufferLength: DWORD; lpBuffer: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetCurrentDirectoryW}
function GetCurrentDirectoryW(nBufferLength: DWORD; lpBuffer: PWideChar): DWORD; stdcall;
{$EXTERNALSYM GetCurrentDirectory}
function GetCurrentDirectory(nBufferLength: DWORD; lpBuffer: PChar): DWORD; stdcall;
{$EXTERNALSYM GetDiskFreeSpaceA}
function GetDiskFreeSpaceA(lpRootPathName: PAnsiChar;
  var lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetDiskFreeSpaceW}
function GetDiskFreeSpaceW(lpRootPathName: PWideChar;
  var lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetDiskFreeSpace}
function GetDiskFreeSpace(lpRootPathName: PChar;
  var lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetDiskFreeSpaceExA}
function GetDiskFreeSpaceExA(lpDirectoryName: PAnsiChar;
  var lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes; lpTotalNumberOfFreeBytes: PLargeInteger): BOOL; stdcall;
{$EXTERNALSYM GetDiskFreeSpaceExW}
function GetDiskFreeSpaceExW(lpDirectoryName: PWideChar;
  var lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes; lpTotalNumberOfFreeBytes: PLargeInteger): BOOL; stdcall;
{$EXTERNALSYM GetDiskFreeSpaceEx}
function GetDiskFreeSpaceEx(lpDirectoryName: PChar;
  var lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes; lpTotalNumberOfFreeBytes: PLargeInteger): BOOL; stdcall;
{$EXTERNALSYM CreateDirectoryA}
function CreateDirectoryA(lpPathName: PAnsiChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateDirectoryW}
function CreateDirectoryW(lpPathName: PWideChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateDirectory}
function CreateDirectory(lpPathName: PChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateDirectoryExA}
function CreateDirectoryExA(lpTemplateDirectory, lpNewDirectory: PAnsiChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateDirectoryExW}
function CreateDirectoryExW(lpTemplateDirectory, lpNewDirectory: PWideChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateDirectoryEx}
function CreateDirectoryEx(lpTemplateDirectory, lpNewDirectory: PChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM RemoveDirectoryA}
function RemoveDirectoryA(lpPathName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM RemoveDirectoryW}
function RemoveDirectoryW(lpPathName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM RemoveDirectory}
function RemoveDirectory(lpPathName: PChar): BOOL; stdcall;
{$EXTERNALSYM GetFullPathNameA}
function GetFullPathNameA(lpFileName: PAnsiChar; nBufferLength: DWORD;
  lpBuffer: PAnsiChar; var lpFilePart: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetFullPathNameW}
function GetFullPathNameW(lpFileName: PWideChar; nBufferLength: DWORD;
  lpBuffer: PWideChar; var lpFilePart: PWideChar): DWORD; stdcall;
{$EXTERNALSYM GetFullPathName}
function GetFullPathName(lpFileName: PChar; nBufferLength: DWORD;
  lpBuffer: PChar; var lpFilePart: PChar): DWORD; stdcall;

const
  {$EXTERNALSYM DDD_RAW_TARGET_PATH}
  DDD_RAW_TARGET_PATH             = $00000001;
  {$EXTERNALSYM DDD_REMOVE_DEFINITION}
  DDD_REMOVE_DEFINITION           = $00000002;
  {$EXTERNALSYM DDD_EXACT_MATCH_ON_REMOVE}
  DDD_EXACT_MATCH_ON_REMOVE       = $00000004;
  {$EXTERNALSYM DDD_NO_BROADCAST_SYSTEM}
  DDD_NO_BROADCAST_SYSTEM         = $00000008;

{$EXTERNALSYM DefineDosDeviceA}
function DefineDosDeviceA(dwFlags: DWORD; lpDeviceName, lpTargetPath: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM DefineDosDeviceW}
function DefineDosDeviceW(dwFlags: DWORD; lpDeviceName, lpTargetPath: PWideChar): BOOL; stdcall;
{$EXTERNALSYM DefineDosDevice}
function DefineDosDevice(dwFlags: DWORD; lpDeviceName, lpTargetPath: PChar): BOOL; stdcall;
{$EXTERNALSYM QueryDosDeviceA}
function QueryDosDeviceA(lpDeviceName: PAnsiChar;
  lpTargetPath: PAnsiChar; ucchMax: DWORD): DWORD; stdcall;
{$EXTERNALSYM QueryDosDeviceW}
function QueryDosDeviceW(lpDeviceName: PWideChar;
  lpTargetPath: PWideChar; ucchMax: DWORD): DWORD; stdcall;
{$EXTERNALSYM QueryDosDevice}
function QueryDosDevice(lpDeviceName: PChar;
  lpTargetPath: PChar; ucchMax: DWORD): DWORD; stdcall;
{$EXTERNALSYM CreateFileA}
function CreateFileA(lpFileName: PAnsiChar; dwDesiredAccess, dwShareMode: DWORD;
  lpSecurityAttributes: PSecurityAttributes; dwCreationDisposition, dwFlagsAndAttributes: DWORD;
  hTemplateFile: THandle): THandle; stdcall;
{$EXTERNALSYM CreateFileW}
function CreateFileW(lpFileName: PWideChar; dwDesiredAccess, dwShareMode: DWORD;
  lpSecurityAttributes: PSecurityAttributes; dwCreationDisposition, dwFlagsAndAttributes: DWORD;
  hTemplateFile: THandle): THandle; stdcall;
{$EXTERNALSYM CreateFile}
function CreateFile(lpFileName: PChar; dwDesiredAccess, dwShareMode: DWORD;
  lpSecurityAttributes: PSecurityAttributes; dwCreationDisposition, dwFlagsAndAttributes: DWORD;
  hTemplateFile: THandle): THandle; stdcall;
{$EXTERNALSYM SetFileAttributesA}
function SetFileAttributesA(lpFileName: PAnsiChar; dwFileAttributes: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetFileAttributesW}
function SetFileAttributesW(lpFileName: PWideChar; dwFileAttributes: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetFileAttributes}
function SetFileAttributes(lpFileName: PChar; dwFileAttributes: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetFileAttributesA}
function GetFileAttributesA(lpFileName: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM GetFileAttributesW}
function GetFileAttributesW(lpFileName: PWideChar): DWORD; stdcall;
{$EXTERNALSYM GetFileAttributes}
function GetFileAttributes(lpFileName: PChar): DWORD; stdcall;
type
  {$EXTERNALSYM _GET_FILEEX_INFO_LEVELS}
  _GET_FILEEX_INFO_LEVELS = (GetFileExInfoStandard, GetFileExMaxInfoLevel);
  TGetFileExInfoLevels = _GET_FILEEX_INFO_LEVELS;
  {$EXTERNALSYM GET_FILEEX_INFO_LEVELS}
  GET_FILEEX_INFO_LEVELS = _GET_FILEEX_INFO_LEVELS;
{$EXTERNALSYM GetFileAttributesExA}
function GetFileAttributesExA(lpFileName: PAnsiChar;
  fInfoLevelId: TGetFileExInfoLevels; lpFileInformation: Pointer): BOOL; stdcall;
{$EXTERNALSYM GetFileAttributesExW}
function GetFileAttributesExW(lpFileName: PWideChar;
  fInfoLevelId: TGetFileExInfoLevels; lpFileInformation: Pointer): BOOL; stdcall;
{$EXTERNALSYM GetFileAttributesEx}
function GetFileAttributesEx(lpFileName: PChar;
  fInfoLevelId: TGetFileExInfoLevels; lpFileInformation: Pointer): BOOL; stdcall;
{$EXTERNALSYM GetCompressedFileSizeA}
function GetCompressedFileSizeA(lpFileName: PAnsiChar; lpFileSizeHigh: PDWORD): DWORD; stdcall;
{$EXTERNALSYM GetCompressedFileSizeW}
function GetCompressedFileSizeW(lpFileName: PWideChar; lpFileSizeHigh: PDWORD): DWORD; stdcall;
{$EXTERNALSYM GetCompressedFileSize}
function GetCompressedFileSize(lpFileName: PChar; lpFileSizeHigh: PDWORD): DWORD; stdcall;
{$EXTERNALSYM DeleteFileA}
function DeleteFileA(lpFileName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM DeleteFileW}
function DeleteFileW(lpFileName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM DeleteFile}
function DeleteFile(lpFileName: PChar): BOOL; stdcall;
type
  {$EXTERNALSYM _FINDEX_INFO_LEVELS}
  _FINDEX_INFO_LEVELS = (FindExInfoStandard, FindExInfoMaxInfoLevel);
  TFindexInfoLevels = _FINDEX_INFO_LEVELS;
  {$EXTERNALSYM FINDEX_INFO_LEVELS}
  FINDEX_INFO_LEVELS = _FINDEX_INFO_LEVELS;

  {$EXTERNALSYM _FINDEX_SEARCH_OPS}
  _FINDEX_SEARCH_OPS = (FindExSearchNameMatch, FindExSearchLimitToDirectories,
    FindExSearchLimitToDevices, FindExSearchMaxSearchOp);
  TFindexSearchOps = _FINDEX_SEARCH_OPS;
  {$EXTERNALSYM FINDEX_SEARCH_OPS}
  FINDEX_SEARCH_OPS = _FINDEX_SEARCH_OPS;
const
  {$EXTERNALSYM FIND_FIRST_EX_CASE_SENSITIVE}
  FIND_FIRST_EX_CASE_SENSITIVE = $00000001;

{$EXTERNALSYM FindFirstFileExA}
function FindFirstFileExA(lpFileName: PAnsiChar; fInfoLevelId: TFindexInfoLevels;
  lpFindFileData: Pointer; fSearchOp: TFindexSearchOps; lpSearchFilter: Pointer;
  dwAdditionalFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM FindFirstFileExW}
function FindFirstFileExW(lpFileName: PWideChar; fInfoLevelId: TFindexInfoLevels;
  lpFindFileData: Pointer; fSearchOp: TFindexSearchOps; lpSearchFilter: Pointer;
  dwAdditionalFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM FindFirstFileEx}
function FindFirstFileEx(lpFileName: PChar; fInfoLevelId: TFindexInfoLevels;
  lpFindFileData: Pointer; fSearchOp: TFindexSearchOps; lpSearchFilter: Pointer;
  dwAdditionalFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM FindFirstFileA}
function FindFirstFileA(lpFileName: PAnsiChar; var lpFindFileData: TWIN32FindDataA): THandle; stdcall;
{$EXTERNALSYM FindFirstFileW}
function FindFirstFileW(lpFileName: PWideChar; var lpFindFileData: TWIN32FindDataW): THandle; stdcall;
{$EXTERNALSYM FindFirstFile}
function FindFirstFile(lpFileName: PChar; var lpFindFileData: TWIN32FindData): THandle; stdcall;
{$EXTERNALSYM FindNextFileA}
function FindNextFileA(hFindFile: THandle; var lpFindFileData: TWIN32FindDataA): BOOL; stdcall;
{$EXTERNALSYM FindNextFileW}
function FindNextFileW(hFindFile: THandle; var lpFindFileData: TWIN32FindDataW): BOOL; stdcall;
{$EXTERNALSYM FindNextFile}
function FindNextFile(hFindFile: THandle; var lpFindFileData: TWIN32FindData): BOOL; stdcall;
{$EXTERNALSYM SearchPathA}
function SearchPathA(lpPath, lpFileName, lpExtension: PAnsiChar;
  nBufferLength: DWORD; lpBuffer: PAnsiChar; var lpFilePart: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM SearchPathW}
function SearchPathW(lpPath, lpFileName, lpExtension: PWideChar;
  nBufferLength: DWORD; lpBuffer: PWideChar; var lpFilePart: PWideChar): DWORD; stdcall;
{$EXTERNALSYM SearchPath}
function SearchPath(lpPath, lpFileName, lpExtension: PChar;
  nBufferLength: DWORD; lpBuffer: PChar; var lpFilePart: PChar): DWORD; stdcall;
{$EXTERNALSYM CopyFileA}
function CopyFileA(lpExistingFileName, lpNewFileName: PAnsiChar; bFailIfExists: BOOL): BOOL; stdcall;
{$EXTERNALSYM CopyFileW}
function CopyFileW(lpExistingFileName, lpNewFileName: PWideChar; bFailIfExists: BOOL): BOOL; stdcall;
{$EXTERNALSYM CopyFile}
function CopyFile(lpExistingFileName, lpNewFileName: PChar; bFailIfExists: BOOL): BOOL; stdcall;

type
  TFNProgressRoutine = TFarProc;

{$EXTERNALSYM CopyFileExA}
function CopyFileExA(lpExistingFileName, lpNewFileName: PAnsiChar;
  lpProgressRoutine: TFNProgressRoutine; lpData: Pointer; pbCancel: PBool;
  dwCopyFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM CopyFileExW}
function CopyFileExW(lpExistingFileName, lpNewFileName: PWideChar;
  lpProgressRoutine: TFNProgressRoutine; lpData: Pointer; pbCancel: PBool;
  dwCopyFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM CopyFileEx}
function CopyFileEx(lpExistingFileName, lpNewFileName: PChar;
  lpProgressRoutine: TFNProgressRoutine; lpData: Pointer; pbCancel: PBool;
  dwCopyFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM MoveFileA}
function MoveFileA(lpExistingFileName, lpNewFileName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM MoveFileW}
function MoveFileW(lpExistingFileName, lpNewFileName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM MoveFile}
function MoveFile(lpExistingFileName, lpNewFileName: PChar): BOOL; stdcall;
{$EXTERNALSYM MoveFileExA}
function MoveFileExA(lpExistingFileName, lpNewFileName: PAnsiChar; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM MoveFileExW}
function MoveFileExW(lpExistingFileName, lpNewFileName: PWideChar; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM MoveFileEx}
function MoveFileEx(lpExistingFileName, lpNewFileName: PChar; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM MoveFileWithProgressA}
function MoveFileWithProgressA(lpExistingFileName, lpNewFileName: PAnsiChar; lpProgressRoutine: TFNProgressRoutine;
  lpData: Pointer; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM MoveFileWithProgressW}
function MoveFileWithProgressW(lpExistingFileName, lpNewFileName: PWideChar; lpProgressRoutine: TFNProgressRoutine;
  lpData: Pointer; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM MoveFileWithProgress}
function MoveFileWithProgress(lpExistingFileName, lpNewFileName: PChar; lpProgressRoutine: TFNProgressRoutine;
  lpData: Pointer; dwFlags: DWORD): BOOL; stdcall;

const
  {$EXTERNALSYM MOVEFILE_REPLACE_EXISTING}
  MOVEFILE_REPLACE_EXISTING       = $00000001;
  {$EXTERNALSYM MOVEFILE_COPY_ALLOWED}
  MOVEFILE_COPY_ALLOWED           = $00000002;
  {$EXTERNALSYM MOVEFILE_DELAY_UNTIL_REBOOT}
  MOVEFILE_DELAY_UNTIL_REBOOT     = $00000004;
  {$EXTERNALSYM MOVEFILE_WRITE_THROUGH}
  MOVEFILE_WRITE_THROUGH          = $00000008;
  {$EXTERNALSYM MOVEFILE_CREATE_HARDLINK}
  MOVEFILE_CREATE_HARDLINK        = $00000010;
  {$EXTERNALSYM MOVEFILE_FAIL_IF_NOT_TRACKABLE}
  MOVEFILE_FAIL_IF_NOT_TRACKABLE  = $00000020;

{$EXTERNALSYM CreateHardLinkA}
function CreateHardLinkA(lpFileName, lpExistingFileName: PAnsiChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateHardLinkW}
function CreateHardLinkW(lpFileName, lpExistingFileName: PWideChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateHardLink}
function CreateHardLink(lpFileName, lpExistingFileName: PChar;
  lpSecurityAttributes: PSecurityAttributes): BOOL; stdcall;
{$EXTERNALSYM CreateNamedPipeA}
function CreateNamedPipeA(lpName: PAnsiChar;
  dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut: DWORD;
  lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
{$EXTERNALSYM CreateNamedPipeW}
function CreateNamedPipeW(lpName: PWideChar;
  dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut: DWORD;
  lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
{$EXTERNALSYM CreateNamedPipe}
function CreateNamedPipe(lpName: PChar;
  dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut: DWORD;
  lpSecurityAttributes: PSecurityAttributes): THandle; stdcall;
{$EXTERNALSYM GetNamedPipeHandleStateA}
function GetNamedPipeHandleStateA(hNamedPipe: THandle;
  lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout: PDWORD;
  lpUserName: PAnsiChar; nMaxUserNameSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetNamedPipeHandleStateW}
function GetNamedPipeHandleStateW(hNamedPipe: THandle;
  lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout: PDWORD;
  lpUserName: PWideChar; nMaxUserNameSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetNamedPipeHandleState}
function GetNamedPipeHandleState(hNamedPipe: THandle;
  lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout: PDWORD;
  lpUserName: PChar; nMaxUserNameSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM CallNamedPipeA}
function CallNamedPipeA(lpNamedPipeName: PAnsiChar; lpInBuffer: Pointer;
  nInBufferSize: DWORD; lpOutBuffer: Pointer; nOutBufferSize: DWORD;
  var lpBytesRead: DWORD; nTimeOut: DWORD): BOOL; stdcall;
{$EXTERNALSYM CallNamedPipeW}
function CallNamedPipeW(lpNamedPipeName: PWideChar; lpInBuffer: Pointer;
  nInBufferSize: DWORD; lpOutBuffer: Pointer; nOutBufferSize: DWORD;
  var lpBytesRead: DWORD; nTimeOut: DWORD): BOOL; stdcall;
{$EXTERNALSYM CallNamedPipe}
function CallNamedPipe(lpNamedPipeName: PChar; lpInBuffer: Pointer;
  nInBufferSize: DWORD; lpOutBuffer: Pointer; nOutBufferSize: DWORD;
  var lpBytesRead: DWORD; nTimeOut: DWORD): BOOL; stdcall;
{$EXTERNALSYM WaitNamedPipeA}
function WaitNamedPipeA(lpNamedPipeName: PAnsiChar; nTimeOut: DWORD): BOOL; stdcall;
{$EXTERNALSYM WaitNamedPipeW}
function WaitNamedPipeW(lpNamedPipeName: PWideChar; nTimeOut: DWORD): BOOL; stdcall;
{$EXTERNALSYM WaitNamedPipe}
function WaitNamedPipe(lpNamedPipeName: PChar; nTimeOut: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetVolumeLabelA}
function SetVolumeLabelA(lpRootPathName: PAnsiChar; lpVolumeName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetVolumeLabelW}
function SetVolumeLabelW(lpRootPathName: PWideChar; lpVolumeName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetVolumeLabel}
function SetVolumeLabel(lpRootPathName: PChar; lpVolumeName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetFileApisToOEM}
procedure SetFileApisToOEM; stdcall;
{$EXTERNALSYM SetFileApisToANSI}
procedure SetFileApisToANSI; stdcall;
{$EXTERNALSYM AreFileApisANSI}
function AreFileApisANSI: BOOL; stdcall;
{$EXTERNALSYM GetVolumeInformationA}
function GetVolumeInformationA(lpRootPathName: PAnsiChar;
  lpVolumeNameBuffer: PAnsiChar; nVolumeNameSize: DWORD; lpVolumeSerialNumber: PDWORD;
  var lpMaximumComponentLength, lpFileSystemFlags: DWORD;
  lpFileSystemNameBuffer: PAnsiChar; nFileSystemNameSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetVolumeInformationW}
function GetVolumeInformationW(lpRootPathName: PWideChar;
  lpVolumeNameBuffer: PWideChar; nVolumeNameSize: DWORD; lpVolumeSerialNumber: PDWORD;
  var lpMaximumComponentLength, lpFileSystemFlags: DWORD;
  lpFileSystemNameBuffer: PWideChar; nFileSystemNameSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetVolumeInformation}
function GetVolumeInformation(lpRootPathName: PChar;
  lpVolumeNameBuffer: PChar; nVolumeNameSize: DWORD; lpVolumeSerialNumber: PDWORD;
  var lpMaximumComponentLength, lpFileSystemFlags: DWORD;
  lpFileSystemNameBuffer: PChar; nFileSystemNameSize: DWORD): BOOL; stdcall;

{$EXTERNALSYM CancelIo}
function CancelIo(hFile: THandle): BOOL; stdcall;

{ Event logging APIs }

{$EXTERNALSYM ClearEventLogA}
function ClearEventLogA(hEventLog: THandle; lpBackupFileName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM ClearEventLogW}
function ClearEventLogW(hEventLog: THandle; lpBackupFileName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM ClearEventLog}
function ClearEventLog(hEventLog: THandle; lpBackupFileName: PChar): BOOL; stdcall;
{$EXTERNALSYM BackupEventLogA}
function BackupEventLogA(hEventLog: THandle; lpBackupFileName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM BackupEventLogW}
function BackupEventLogW(hEventLog: THandle; lpBackupFileName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM BackupEventLog}
function BackupEventLog(hEventLog: THandle; lpBackupFileName: PChar): BOOL; stdcall;
{$EXTERNALSYM CloseEventLog}
function CloseEventLog(hEventLog: THandle): BOOL; stdcall;
{$EXTERNALSYM DeregisterEventSource}
function DeregisterEventSource(hEventLog: THandle): BOOL; stdcall;
{$EXTERNALSYM NotifyChangeEventLog}
function NotifyChangeEventLog(hEventLog, hEvent: THandle): BOOL; stdcall;
{$EXTERNALSYM GetNumberOfEventLogRecords}
function GetNumberOfEventLogRecords(hEventLog: THandle; var NumberOfRecords: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetOldestEventLogRecord}
function GetOldestEventLogRecord(hEventLog: THandle; var OldestRecord: DWORD): BOOL; stdcall;
{$EXTERNALSYM OpenEventLogA}
function OpenEventLogA(lpUNCServerName, lpSourceName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM OpenEventLogW}
function OpenEventLogW(lpUNCServerName, lpSourceName: PWideChar): THandle; stdcall;
{$EXTERNALSYM OpenEventLog}
function OpenEventLog(lpUNCServerName, lpSourceName: PChar): THandle; stdcall;
{$EXTERNALSYM RegisterEventSourceA}
function RegisterEventSourceA(lpUNCServerName, lpSourceName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM RegisterEventSourceW}
function RegisterEventSourceW(lpUNCServerName, lpSourceName: PWideChar): THandle; stdcall;
{$EXTERNALSYM RegisterEventSource}
function RegisterEventSource(lpUNCServerName, lpSourceName: PChar): THandle; stdcall;
{$EXTERNALSYM OpenBackupEventLogA}
function OpenBackupEventLogA(lpUNCServerName, lpFileName: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM OpenBackupEventLogW}
function OpenBackupEventLogW(lpUNCServerName, lpFileName: PWideChar): THandle; stdcall;
{$EXTERNALSYM OpenBackupEventLog}
function OpenBackupEventLog(lpUNCServerName, lpFileName: PChar): THandle; stdcall;
{$EXTERNALSYM ReadEventLogA}
function ReadEventLogA(hEventLog: THandle; dwReadFlags, dwRecordOffset: DWORD;
  lpBuffer: Pointer; nNumberOfBytesToRead: DWORD;
  var pnBytesRead, pnMinNumberOfBytesNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadEventLogW}
function ReadEventLogW(hEventLog: THandle; dwReadFlags, dwRecordOffset: DWORD;
  lpBuffer: Pointer; nNumberOfBytesToRead: DWORD;
  var pnBytesRead, pnMinNumberOfBytesNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadEventLog}
function ReadEventLog(hEventLog: THandle; dwReadFlags, dwRecordOffset: DWORD;
  lpBuffer: Pointer; nNumberOfBytesToRead: DWORD;
  var pnBytesRead, pnMinNumberOfBytesNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReportEventA}
function ReportEventA(hEventLog: THandle; wType, wCategory: Word;
  dwEventID: DWORD; lpUserSid: Pointer; wNumStrings: Word;
  dwDataSize: DWORD; lpStrings, lpRawData: Pointer): BOOL; stdcall;
{$EXTERNALSYM ReportEventW}
function ReportEventW(hEventLog: THandle; wType, wCategory: Word;
  dwEventID: DWORD; lpUserSid: Pointer; wNumStrings: Word;
  dwDataSize: DWORD; lpStrings, lpRawData: Pointer): BOOL; stdcall;
{$EXTERNALSYM ReportEvent}
function ReportEvent(hEventLog: THandle; wType, wCategory: Word;
  dwEventID: DWORD; lpUserSid: Pointer; wNumStrings: Word;
  dwDataSize: DWORD; lpStrings, lpRawData: Pointer): BOOL; stdcall;

{ Security APIs }

{$EXTERNALSYM DuplicateToken}
function DuplicateToken(ExistingTokenHandle: THandle;
  ImpersonationLevel: TSecurityImpersonationLevel; DuplicateTokenHandle: PHandle): BOOL; stdcall;
{$EXTERNALSYM GetKernelObjectSecurity}
function GetKernelObjectSecurity(Handle: THandle; RequestedInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor; nLength: DWORD;
  var lpnLengthNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM ImpersonateNamedPipeClient}
function ImpersonateNamedPipeClient(hNamedPipe: THandle): BOOL; stdcall;
{$EXTERNALSYM ImpersonateSelf}
function ImpersonateSelf(ImpersonationLevel: TSecurityImpersonationLevel): BOOL; stdcall;
{$EXTERNALSYM RevertToSelf}
function RevertToSelf: BOOL; stdcall;
{$EXTERNALSYM SetThreadToken}
function SetThreadToken(Thread: PHandle; Token: THandle): BOOL; stdcall;
{$EXTERNALSYM AccessCheck}
function AccessCheck(pSecurityDescriptor: PSecurityDescriptor;
  ClientToken: THandle; DesiredAccess: DWORD; const GenericMapping: TGenericMapping;
  var PrivilegeSet: TPrivilegeSet; var PrivilegeSetLength: DWORD;
  var GrantedAccess: DWORD; var AccessStatus: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByType}
function AccessCheckByType(pSecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID;
  ClientToken: THandle; DesiredAccess: DWORD; ObjectTypeList: PObjectTypeList;
  const GenericMapping: TGenericMapping; ObjectTypeListLength: DWORD;
  var PrivilegeSet: TPrivilegeSet; var PrivilegeSetLength: DWORD;
  var GrantedAccess: DWORD; var AccessStatus: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByTypeResultList}
function AccessCheckByTypeResultList(pSecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID;
  ClientToken: THandle; DesiredAccess: DWORD; ObjectTypeList: PObjectTypeList;
  const GenericMapping: TGenericMapping; ObjectTypeListLength: DWORD;
  var PrivilegeSet: TPrivilegeSet; var PrivilegeSetLength: DWORD;
  var GrantedAccess: DWORD; var AccessStatusList: DWORD): BOOL; stdcall;
{$EXTERNALSYM OpenProcessToken}
function OpenProcessToken(ProcessHandle: THandle; DesiredAccess: DWORD;
  var TokenHandle: THandle): BOOL; stdcall;
{$EXTERNALSYM OpenThreadToken}
function OpenThreadToken(ThreadHandle: THandle; DesiredAccess: DWORD;
  OpenAsSelf: BOOL; var TokenHandle: THandle): BOOL; stdcall;
{$EXTERNALSYM GetTokenInformation}
function GetTokenInformation(TokenHandle: THandle;
  TokenInformationClass: TTokenInformationClass; TokenInformation: Pointer;
  TokenInformationLength: DWORD; var ReturnLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetTokenInformation}
function SetTokenInformation(TokenHandle: THandle;
  TokenInformationClass: TTokenInformationClass; TokenInformation: Pointer;
  TokenInformationLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM AdjustTokenPrivileges}
function AdjustTokenPrivileges(TokenHandle: THandle; DisableAllPrivileges: BOOL;
  const NewState: TTokenPrivileges; BufferLength: DWORD;
  var PreviousState: TTokenPrivileges; var ReturnLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM AdjustTokenGroups}
function AdjustTokenGroups(TokenHandle: THandle; ResetToDefault: BOOL;
  const NewState: TTokenGroups; BufferLength: DWORD;
  var PreviousState: TTokenGroups; var ReturnLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM PrivilegeCheck}
function PrivilegeCheck(ClientToken: THandle; const RequiredPrivileges: TPrivilegeSet;
  var pfResult: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckAndAuditAlarmA}
function AccessCheckAndAuditAlarmA(SubsystemName: PAnsiChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PAnsiChar;
  SecurityDescriptor: PSecurityDescriptor; DesiredAccess: DWORD;
  const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatus, pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckAndAuditAlarmW}
function AccessCheckAndAuditAlarmW(SubsystemName: PWideChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PWideChar;
  SecurityDescriptor: PSecurityDescriptor; DesiredAccess: DWORD;
  const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatus, pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckAndAuditAlarm}
function AccessCheckAndAuditAlarm(SubsystemName: PChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PChar;
  SecurityDescriptor: PSecurityDescriptor; DesiredAccess: DWORD;
  const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatus, pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByTypeAndAuditAlarmA}
function AccessCheckByTypeAndAuditAlarmA(SubsystemName: PAnsiChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PAnsiChar;
  SecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID; DesiredAccess: DWORD;
  AuditType: AUDIT_EVENT_TYPE; Flags: DWORD; ObjectTypeList: PObjectTypeList;
  ObjectTypeListLength: DWORD; const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatus, pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByTypeAndAuditAlarmW}
function AccessCheckByTypeAndAuditAlarmW(SubsystemName: PWideChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PWideChar;
  SecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID; DesiredAccess: DWORD;
  AuditType: AUDIT_EVENT_TYPE; Flags: DWORD; ObjectTypeList: PObjectTypeList;
  ObjectTypeListLength: DWORD; const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatus, pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByTypeAndAuditAlarm}
function AccessCheckByTypeAndAuditAlarm(SubsystemName: PChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PChar;
  SecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID; DesiredAccess: DWORD;
  AuditType: AUDIT_EVENT_TYPE; Flags: DWORD; ObjectTypeList: PObjectTypeList;
  ObjectTypeListLength: DWORD; const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatus, pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByTypeResultListAndAuditAlarmA}
function AccessCheckByTypeResultListAndAuditAlarmA(SubsystemName: PAnsiChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PAnsiChar;
  SecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID; DesiredAccess: DWORD;
  AuditType: AUDIT_EVENT_TYPE; Flags: DWORD; ObjectTypeList: PObjectTypeList;
  ObjectTypeListLength: DWORD; const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatusList: DWORD; var pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByTypeResultListAndAuditAlarmW}
function AccessCheckByTypeResultListAndAuditAlarmW(SubsystemName: PWideChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PWideChar;
  SecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID; DesiredAccess: DWORD;
  AuditType: AUDIT_EVENT_TYPE; Flags: DWORD; ObjectTypeList: PObjectTypeList;
  ObjectTypeListLength: DWORD; const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatusList: DWORD; var pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM AccessCheckByTypeResultListAndAuditAlarm}
function AccessCheckByTypeResultListAndAuditAlarm(SubsystemName: PChar;
  HandleId: Pointer; ObjectTypeName, ObjectName: PChar;
  SecurityDescriptor: PSecurityDescriptor; PrincipalSelfSid: PSID; DesiredAccess: DWORD;
  AuditType: AUDIT_EVENT_TYPE; Flags: DWORD; ObjectTypeList: PObjectTypeList;
  ObjectTypeListLength: DWORD; const GenericMapping: TGenericMapping;  ObjectCreation: BOOL;
  var GrantedAccess: DWORD; var AccessStatusList: DWORD; var pfGenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectOpenAuditAlarmA}
function ObjectOpenAuditAlarmA(SubsystemName: PAnsiChar; HandleId: Pointer;
  ObjectTypeName: PAnsiChar; ObjectName: PAnsiChar; pSecurityDescriptor: PSecurityDescriptor;
  ClientToken: THandle; DesiredAccess, GrantedAccess: DWORD;
  var Privileges: TPrivilegeSet; ObjectCreation, AccessGranted: BOOL;
  var GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectOpenAuditAlarmW}
function ObjectOpenAuditAlarmW(SubsystemName: PWideChar; HandleId: Pointer;
  ObjectTypeName: PWideChar; ObjectName: PWideChar; pSecurityDescriptor: PSecurityDescriptor;
  ClientToken: THandle; DesiredAccess, GrantedAccess: DWORD;
  var Privileges: TPrivilegeSet; ObjectCreation, AccessGranted: BOOL;
  var GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectOpenAuditAlarm}
function ObjectOpenAuditAlarm(SubsystemName: PChar; HandleId: Pointer;
  ObjectTypeName: PChar; ObjectName: PChar; pSecurityDescriptor: PSecurityDescriptor;
  ClientToken: THandle; DesiredAccess, GrantedAccess: DWORD;
  var Privileges: TPrivilegeSet; ObjectCreation, AccessGranted: BOOL;
  var GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectPrivilegeAuditAlarmA}
function ObjectPrivilegeAuditAlarmA(SubsystemName: PAnsiChar;
  HandleId: Pointer; ClientToken: THandle; DesiredAccess: DWORD;
  var Privileges: TPrivilegeSet; AccessGranted: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectPrivilegeAuditAlarmW}
function ObjectPrivilegeAuditAlarmW(SubsystemName: PWideChar;
  HandleId: Pointer; ClientToken: THandle; DesiredAccess: DWORD;
  var Privileges: TPrivilegeSet; AccessGranted: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectPrivilegeAuditAlarm}
function ObjectPrivilegeAuditAlarm(SubsystemName: PChar;
  HandleId: Pointer; ClientToken: THandle; DesiredAccess: DWORD;
  var Privileges: TPrivilegeSet; AccessGranted: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectCloseAuditAlarmA}
function ObjectCloseAuditAlarmA(SubsystemName: PAnsiChar;
  HandleId: Pointer; GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectCloseAuditAlarmW}
function ObjectCloseAuditAlarmW(SubsystemName: PWideChar;
  HandleId: Pointer; GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectCloseAuditAlarm}
function ObjectCloseAuditAlarm(SubsystemName: PChar;
  HandleId: Pointer; GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectDeleteAuditAlarmA}
function ObjectDeleteAuditAlarmA(SubsystemName: PAnsiChar;
  HandleId: Pointer; GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectDeleteAuditAlarmW}
function ObjectDeleteAuditAlarmW(SubsystemName: PWideChar;
  HandleId: Pointer; GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM ObjectDeleteAuditAlarm}
function ObjectDeleteAuditAlarm(SubsystemName: PChar;
  HandleId: Pointer; GenerateOnClose: BOOL): BOOL; stdcall;
{$EXTERNALSYM PrivilegedServiceAuditAlarmA}
function PrivilegedServiceAuditAlarmA(SubsystemName, ServiceName: PAnsiChar;
  ClientToken: THandle; var Privileges: TPrivilegeSet; AccessGranted: BOOL): BOOL; stdcall;
{$EXTERNALSYM PrivilegedServiceAuditAlarmW}
function PrivilegedServiceAuditAlarmW(SubsystemName, ServiceName: PWideChar;
  ClientToken: THandle; var Privileges: TPrivilegeSet; AccessGranted: BOOL): BOOL; stdcall;
{$EXTERNALSYM PrivilegedServiceAuditAlarm}
function PrivilegedServiceAuditAlarm(SubsystemName, ServiceName: PChar;
  ClientToken: THandle; var Privileges: TPrivilegeSet; AccessGranted: BOOL): BOOL; stdcall;
{$EXTERNALSYM IsValidSid}
function IsValidSid(pSid: Pointer): BOOL; stdcall;
{$EXTERNALSYM EqualSid}
function EqualSid(pSid1, pSid2: Pointer): BOOL; stdcall;
{$EXTERNALSYM EqualPrefixSid}
function EqualPrefixSid(pSid1, pSid2: Pointer): BOOL; stdcall;
{$EXTERNALSYM GetSidLengthRequired}
function GetSidLengthRequired(nSubAuthorityCount: UCHAR): DWORD; stdcall;
{$EXTERNALSYM AllocateAndInitializeSid}
function AllocateAndInitializeSid(const pIdentifierAuthority: TSIDIdentifierAuthority;
  nSubAuthorityCount: Byte; nSubAuthority0, nSubAuthority1: DWORD;
  nSubAuthority2, nSubAuthority3, nSubAuthority4: DWORD;
  nSubAuthority5, nSubAuthority6, nSubAuthority7: DWORD;
  var pSid: Pointer): BOOL; stdcall;
{$EXTERNALSYM FreeSid}
function FreeSid(pSid: Pointer): Pointer; stdcall;
{$EXTERNALSYM InitializeSid}
function InitializeSid(Sid: Pointer; const pIdentifierAuthority: TSIDIdentifierAuthority;
  nSubAuthorityCount: Byte): BOOL; stdcall;
{$EXTERNALSYM GetSidIdentifierAuthority}
function GetSidIdentifierAuthority(pSid: Pointer): PSIDIdentifierAuthority; stdcall;
{$EXTERNALSYM GetSidSubAuthority}
function GetSidSubAuthority(pSid: Pointer; nSubAuthority: DWORD): PDWORD; stdcall;
{$EXTERNALSYM GetSidSubAuthorityCount}
function GetSidSubAuthorityCount(pSid: Pointer): PUCHAR; stdcall;
{$EXTERNALSYM GetLengthSid}
function GetLengthSid(pSid: Pointer): DWORD; stdcall;
{$EXTERNALSYM CopySid}
function CopySid(nDestinationSidLength: DWORD;
  pDestinationSid, pSourceSid: Pointer): BOOL; stdcall;
{$EXTERNALSYM AreAllAccessesGranted}
function AreAllAccessesGranted(GrantedAccess, DesiredAccess: DWORD): BOOL; stdcall;
{$EXTERNALSYM AreAnyAccessesGranted}
function AreAnyAccessesGranted(GrantedAccess, DesiredAccess: DWORD): BOOL; stdcall;
{$EXTERNALSYM MapGenericMask}
procedure MapGenericMask(var AccessMask: DWORD; const GenericMapping: TGenericMapping); stdcall;
{$EXTERNALSYM IsValidAcl}
function IsValidAcl(const pAcl: TACL): BOOL; stdcall;
{$EXTERNALSYM InitializeAcl}
function InitializeAcl(var pAcl: TACL; nAclLength, dwAclRevision: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetAclInformation}
function GetAclInformation(const pAcl: TACL; pAclInformation: Pointer;
  nAclInformationLength: DWORD; dwAclInformationClass: TAclInformationClass): BOOL; stdcall;
{$EXTERNALSYM SetAclInformation}
function SetAclInformation(var pAcl: TACL; pAclInformation: Pointer;
  nAclInformationLength: DWORD; dwAclInformationClass: TAclInformationClass): BOOL; stdcall;
{$EXTERNALSYM AddAce}
function AddAce(var pAcl: TACL; dwAceRevision, dwStartingAceIndex: DWORD; pAceList: Pointer;
  nAceListLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM DeleteAce}
function DeleteAce(var pAcl: TACL; dwAceIndex: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetAce}
function GetAce(const pAcl: TACL; dwAceIndex: DWORD; var pAce: Pointer): BOOL; stdcall;
{$EXTERNALSYM AddAccessAllowedAce}
function AddAccessAllowedAce(var pAcl: TACL; dwAceRevision: DWORD;
  AccessMask: DWORD; pSid: PSID): BOOL; stdcall;
{$EXTERNALSYM AddAccessAllowedAceEx}
function AddAccessAllowedAceEx(var pAcl: TACL; dwAceRevision: DWORD;
  AceFlags: DWORD; AccessMask: DWORD; pSid: PSID): BOOL; stdcall;
{$EXTERNALSYM AddAccessDeniedAce}
function AddAccessDeniedAce(var pAcl: TACL; dwAceRevision: DWORD;
  AccessMask: DWORD; pSid: PSID): BOOL; stdcall;
{$EXTERNALSYM AddAccessDeniedAceEx}
function AddAccessDeniedAceEx(var pAcl: TACL; dwAceRevision: DWORD;
  ACEFlags: DWORD; AccessMask: DWORD; pSid: PSID): BOOL; stdcall;
{$EXTERNALSYM AddAuditAccessAce}
function AddAuditAccessAce(var pAcl: TACL; dwAceRevision: DWORD;
  dwAccessMask: DWORD; pSid: Pointer; bAuditSuccess, bAuditFailure: BOOL): BOOL; stdcall;
{$EXTERNALSYM AddAuditAccessAceEx}
function AddAuditAccessAceEx(var pAcl: TACL; dwAceRevision: DWORD;
  AceFlags: DWORD; dwAccessMask: DWORD; pSid: Pointer; bAuditSuccess, bAuditFailure: BOOL): BOOL; stdcall;
{$EXTERNALSYM AddAccessAllowedObjectAce}
function AddAccessAllowedObjectAce(var pAcl: TACL; dwAceRevision: DWORD;
  AceFlags: DWORD; AccessMask: DWORD; ObjectTypeGuid, InheritedObjectTypeGuid: PGuid; pSid: Pointer): BOOL; stdcall;
{$EXTERNALSYM AddAccessDeniedObjectAce}
function AddAccessDeniedObjectAce(var pAcl: TACL; dwAceRevision: DWORD;
  AceFlags: DWORD; AccessMask: DWORD; ObjectTypeGuid, InheritedObjectTypeGuid: PGuid; pSid: Pointer): BOOL; stdcall;
{$EXTERNALSYM AddAuditAccessObjectAce}
function AddAuditAccessObjectAce(var pAcl: TACL; dwAceRevision: DWORD;
  AceFlags: DWORD; AccessMask: DWORD; ObjectTypeGuid, InheritedObjectTypeGuid: PGuid; pSid: Pointer; bAuditSuccess, bAuditFailure: BOOL): BOOL; stdcall;
{$EXTERNALSYM FindFirstFreeAce}
function FindFirstFreeAce(var pAcl: TACL; var pAce: Pointer): BOOL; stdcall;
{$EXTERNALSYM InitializeSecurityDescriptor}
function InitializeSecurityDescriptor(pSecurityDescriptor: PSecurityDescriptor;
  dwRevision: DWORD): BOOL; stdcall;
{$EXTERNALSYM IsValidSecurityDescriptor}
function IsValidSecurityDescriptor(pSecurityDescriptor: PSecurityDescriptor): BOOL; stdcall;
{$EXTERNALSYM GetSecurityDescriptorLength}
function GetSecurityDescriptorLength(pSecurityDescriptor: PSecurityDescriptor): DWORD; stdcall;
{$EXTERNALSYM GetSecurityDescriptorControl}
function GetSecurityDescriptorControl(pSecurityDescriptor: PSecurityDescriptor;
  var pControl: SECURITY_DESCRIPTOR_CONTROL; var lpdwRevision: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetSecurityDescriptorControl}
function SetSecurityDescriptorControl(pSecurityDescriptor: PSecurityDescriptor;
  ControlBitsOfInterest, ControlBitsToSet: SECURITY_DESCRIPTOR_CONTROL): BOOL; stdcall;
{$EXTERNALSYM SetSecurityDescriptorDacl}
function SetSecurityDescriptorDacl(pSecurityDescriptor: PSecurityDescriptor;
  bDaclPresent: BOOL; pDacl: PACL; bDaclDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetSecurityDescriptorDacl}
function GetSecurityDescriptorDacl(pSecurityDescriptor: PSecurityDescriptor;
  var lpbDaclPresent: BOOL; var pDacl: PACL; var lpbDaclDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM SetSecurityDescriptorSacl}
function SetSecurityDescriptorSacl(pSecurityDescriptor: PSecurityDescriptor;
  bSaclPresent: BOOL; pSacl: PACL; bSaclDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetSecurityDescriptorSacl}
function GetSecurityDescriptorSacl(pSecurityDescriptor: PSecurityDescriptor;
  var lpbSaclPresent: BOOL; var pSacl: PACL; var lpbSaclDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM SetSecurityDescriptorOwner}
function SetSecurityDescriptorOwner(pSecurityDescriptor: PSecurityDescriptor;
  pOwner: PSID; bOwnerDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetSecurityDescriptorOwner}
function GetSecurityDescriptorOwner(pSecurityDescriptor: PSecurityDescriptor;
  var pOwner: PSID; var lpbOwnerDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM SetSecurityDescriptorGroup}
function SetSecurityDescriptorGroup(pSecurityDescriptor: PSecurityDescriptor;
  pGroup: PSID; bGroupDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetSecurityDescriptorGroup}
function GetSecurityDescriptorGroup(pSecurityDescriptor: PSecurityDescriptor;
  var pGroup: PSID; var lpbGroupDefaulted: BOOL): BOOL; stdcall;
{$EXTERNALSYM CreatePrivateObjectSecurity}
function CreatePrivateObjectSecurity(ParentDescriptor, CreatorDescriptor: PSecurityDescriptor;
  var NewDescriptor: PSecurityDescriptor; IsDirectoryObject: BOOL;
  Token: THandle; const GenericMapping: TGenericMapping): BOOL; stdcall;
{$EXTERNALSYM ConvertToAutoInheritPrivateObjectSecurity}
function ConvertToAutoInheritPrivateObjectSecurity(ParentDescriptor, CurrentSecurityDescriptor: PSecurityDescriptor;
  var NewDescriptor: PSecurityDescriptor; ObjectType: PGUID;
  IsDirectoryObject: BOOL; const GenericMapping: TGenericMapping): BOOL; stdcall;
{$EXTERNALSYM CreatePrivateObjectSecurityEx}
function CreatePrivateObjectSecurityEx(ParentDescriptor, CreatorDescriptor: PSecurityDescriptor;
  var NewDescriptor: PSecurityDescriptor; ObjectType: PGUID; IsContainerObject: BOOL;
  AutoInheritFlags: ULONG; Token: THandle; const GenericMapping: TGenericMapping): BOOL; stdcall;
{$EXTERNALSYM SetPrivateObjectSecurity}
function SetPrivateObjectSecurity(SecurityInformation: SECURITY_INFORMATION;
  ModificationDescriptor: PSecurityDescriptor; var ObjectsSecurityDescriptor: PSecurityDescriptor;
  const GenericMapping: TGenericMapping; Token: THandle): BOOL; stdcall;
{$EXTERNALSYM SetPrivateObjectSecurityEx}
function SetPrivateObjectSecurityEx(SecurityInformation: SECURITY_INFORMATION;
  ModificationDescriptor: PSecurityDescriptor; var ObjectsSecurityDescriptor: PSecurityDescriptor;
  AutoInheritFlags: ULONG; const GenericMapping: TGenericMapping; Token: THandle): BOOL; stdcall;
{$EXTERNALSYM GetPrivateObjectSecurity}
function GetPrivateObjectSecurity(ObjectDescriptor: PSecurityDescriptor;
  SecurityInformation: SECURITY_INFORMATION; ResultantDescriptor: PSecurityDescriptor;
  DescriptorLength: DWORD; var ReturnLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM DestroyPrivateObjectSecurity}
function DestroyPrivateObjectSecurity(var ObjectDescriptor: PSecurityDescriptor): BOOL; stdcall;
{$EXTERNALSYM MakeSelfRelativeSD}
function MakeSelfRelativeSD(pAbsoluteSecurityDescriptor: PSecurityDescriptor;
  pSelfRelativeSecurityDescriptor: PSecurityDescriptor; var lpdwBufferLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM MakeAbsoluteSD}
function MakeAbsoluteSD(pSelfRelativeSecurityDescriptor: PSecurityDescriptor;
  pAbsoluteSecurityDescriptor: PSecurityDescriptor; var lpdwAbsoluteSecurityDescriptorSi: DWORD;
  var pDacl: TACL; var lpdwDaclSize: DWORD; var pSacl: TACL;
  var lpdwSaclSize: DWORD; pOwner: PSID; var lpdwOwnerSize: DWORD;
  pPrimaryGroup: Pointer; var lpdwPrimaryGroupSize: DWORD): BOOL; stdcall;

{$EXTERNALSYM SetFileSecurityA}
function SetFileSecurityA(lpFileName: PAnsiChar; SecurityInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor): BOOL; stdcall;
{$EXTERNALSYM SetFileSecurityW}
function SetFileSecurityW(lpFileName: PWideChar; SecurityInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor): BOOL; stdcall;
{$EXTERNALSYM SetFileSecurity}
function SetFileSecurity(lpFileName: PChar; SecurityInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor): BOOL; stdcall;
{$EXTERNALSYM GetFileSecurityA}
function GetFileSecurityA(lpFileName: PAnsiChar; RequestedInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor; nLength: DWORD; var lpnLengthNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetFileSecurityW}
function GetFileSecurityW(lpFileName: PWideChar; RequestedInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor; nLength: DWORD; var lpnLengthNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetFileSecurity}
function GetFileSecurity(lpFileName: PChar; RequestedInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor; nLength: DWORD; var lpnLengthNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetKernelObjectSecurity}
function SetKernelObjectSecurity(Handle: THandle; SecurityInformation: SECURITY_INFORMATION;
  SecurityDescriptor: PSecurityDescriptor): BOOL; stdcall;
{$EXTERNALSYM FindFirstChangeNotificationA}
function FindFirstChangeNotificationA(lpPathName: PAnsiChar;
  bWatchSubtree: BOOL; dwNotifyFilter: DWORD): THandle; stdcall;
{$EXTERNALSYM FindFirstChangeNotificationW}
function FindFirstChangeNotificationW(lpPathName: PWideChar;
  bWatchSubtree: BOOL; dwNotifyFilter: DWORD): THandle; stdcall;
{$EXTERNALSYM FindFirstChangeNotification}
function FindFirstChangeNotification(lpPathName: PChar;
  bWatchSubtree: BOOL; dwNotifyFilter: DWORD): THandle; stdcall;
{$EXTERNALSYM FindNextChangeNotification}
function FindNextChangeNotification(hChangeHandle: THandle): BOOL; stdcall;
{$EXTERNALSYM FindCloseChangeNotification}
function FindCloseChangeNotification(hChangeHandle: THandle): BOOL; stdcall;
{$EXTERNALSYM ReadDirectoryChanges}
function ReadDirectoryChanges(hDirectory: THandle; lpBuffer: Pointer;
  nBufferLength: DWORD; bWatchSubtree: Bool; dwNotifyFilter: DWORD;
  lpBytesReturned: LPDWORD; lpOverlapped: POverlapped;
  lpCompletionRoutine: FARPROC): BOOL; stdcall;
{$EXTERNALSYM ReadDirectoryChangesW}
function ReadDirectoryChangesW(hDirectory: THandle; lpBuffer: Pointer;
  nBufferLength: DWORD; bWatchSubtree: Bool; dwNotifyFilter: DWORD;
  lpBytesReturned: LPDWORD; lpOverlapped: POverlapped;
  lpCompletionRoutine: FARPROC): BOOL; stdcall;
{$EXTERNALSYM VirtualLock}
function VirtualLock(lpAddress: Pointer; dwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM VirtualUnlock}
function VirtualUnlock(lpAddress: Pointer; dwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM MapViewOfFileEx}
function MapViewOfFileEx(hFileMappingObject: THandle;
  dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap: DWORD;
  lpBaseAddress: Pointer): Pointer; stdcall;
{$EXTERNALSYM SetPriorityClass}
function SetPriorityClass(hProcess: THandle; dwPriorityClass: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetPriorityClass}
function GetPriorityClass(hProcess: THandle): DWORD; stdcall;
{$EXTERNALSYM IsBadReadPtr}
function IsBadReadPtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
{$EXTERNALSYM IsBadWritePtr}
function IsBadWritePtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
{$EXTERNALSYM IsBadHugeReadPtr}
function IsBadHugeReadPtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
{$EXTERNALSYM IsBadHugeWritePtr}
function IsBadHugeWritePtr(lp: Pointer; ucb: UINT): BOOL; stdcall;
{$EXTERNALSYM IsBadCodePtr}
function IsBadCodePtr(lpfn: FARPROC): BOOL; stdcall;
{$EXTERNALSYM IsBadStringPtrA}
function IsBadStringPtrA(lpsz: PAnsiChar; ucchMax: UINT): BOOL; stdcall;
{$EXTERNALSYM IsBadStringPtrW}
function IsBadStringPtrW(lpsz: PWideChar; ucchMax: UINT): BOOL; stdcall;
{$EXTERNALSYM IsBadStringPtr}
function IsBadStringPtr(lpsz: PChar; ucchMax: UINT): BOOL; stdcall;
{$EXTERNALSYM LookupAccountSidA}
function LookupAccountSidA(lpSystemName: PAnsiChar; Sid: PSID;
  Name: PAnsiChar; var cbName: DWORD; ReferencedDomainName: PAnsiChar;
  var cbReferencedDomainName: DWORD; var peUse: SID_NAME_USE): BOOL; stdcall;
{$EXTERNALSYM LookupAccountSidW}
function LookupAccountSidW(lpSystemName: PWideChar; Sid: PSID;
  Name: PWideChar; var cbName: DWORD; ReferencedDomainName: PWideChar;
  var cbReferencedDomainName: DWORD; var peUse: SID_NAME_USE): BOOL; stdcall;
{$EXTERNALSYM LookupAccountSid}
function LookupAccountSid(lpSystemName: PChar; Sid: PSID;
  Name: PChar; var cbName: DWORD; ReferencedDomainName: PChar;
  var cbReferencedDomainName: DWORD; var peUse: SID_NAME_USE): BOOL; stdcall;
{$EXTERNALSYM LookupAccountNameA}
function LookupAccountNameA(lpSystemName, lpAccountName: PAnsiChar;
  Sid: PSID; var cbSid: DWORD; ReferencedDomainName: PAnsiChar;
  var cbReferencedDomainName: DWORD; var peUse: SID_NAME_USE): BOOL; stdcall;
{$EXTERNALSYM LookupAccountNameW}
function LookupAccountNameW(lpSystemName, lpAccountName: PWideChar;
  Sid: PSID; var cbSid: DWORD; ReferencedDomainName: PWideChar;
  var cbReferencedDomainName: DWORD; var peUse: SID_NAME_USE): BOOL; stdcall;
{$EXTERNALSYM LookupAccountName}
function LookupAccountName(lpSystemName, lpAccountName: PChar;
  Sid: PSID; var cbSid: DWORD; ReferencedDomainName: PChar;
  var cbReferencedDomainName: DWORD; var peUse: SID_NAME_USE): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeValueA}
function LookupPrivilegeValueA(lpSystemName, lpName: PAnsiChar;
  var lpLuid: TLargeInteger): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeValueW}
function LookupPrivilegeValueW(lpSystemName, lpName: PWideChar;
  var lpLuid: TLargeInteger): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeValue}
function LookupPrivilegeValue(lpSystemName, lpName: PChar;
  var lpLuid: TLargeInteger): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeNameA}
function LookupPrivilegeNameA(lpSystemName: PAnsiChar;
  var lpLuid: TLargeInteger; lpName: PAnsiChar; var cbName: DWORD): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeNameW}
function LookupPrivilegeNameW(lpSystemName: PWideChar;
  var lpLuid: TLargeInteger; lpName: PWideChar; var cbName: DWORD): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeName}
function LookupPrivilegeName(lpSystemName: PChar;
  var lpLuid: TLargeInteger; lpName: PChar; var cbName: DWORD): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeDisplayNameA}
function LookupPrivilegeDisplayNameA(lpSystemName, lpName: PAnsiChar;
  lpDisplayName: PAnsiChar; var cbDisplayName, lpLanguageId: DWORD): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeDisplayNameW}
function LookupPrivilegeDisplayNameW(lpSystemName, lpName: PAnsiChar;
  lpDisplayName: PWideChar; var cbDisplayName, lpLanguageId: DWORD): BOOL; stdcall;
{$EXTERNALSYM LookupPrivilegeDisplayName}
function LookupPrivilegeDisplayName(lpSystemName, lpName: PAnsiChar;
  lpDisplayName: PChar; var cbDisplayName, lpLanguageId: DWORD): BOOL; stdcall;
{$EXTERNALSYM AllocateLocallyUniqueId}
function AllocateLocallyUniqueId(var Luid: TLargeInteger): BOOL; stdcall;
{$EXTERNALSYM BuildCommDCBA}
function BuildCommDCBA(lpDef: PAnsiChar; var lpDCB: TDCB): BOOL; stdcall;
{$EXTERNALSYM BuildCommDCBW}
function BuildCommDCBW(lpDef: PWideChar; var lpDCB: TDCB): BOOL; stdcall;
{$EXTERNALSYM BuildCommDCB}
function BuildCommDCB(lpDef: PChar; var lpDCB: TDCB): BOOL; stdcall;
{$EXTERNALSYM BuildCommDCBAndTimeoutsA}
function BuildCommDCBAndTimeoutsA(lpDef: PAnsiChar; var lpDCB: TDCB;
  var lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
{$EXTERNALSYM BuildCommDCBAndTimeoutsW}
function BuildCommDCBAndTimeoutsW(lpDef: PWideChar; var lpDCB: TDCB;
  var lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
{$EXTERNALSYM BuildCommDCBAndTimeouts}
function BuildCommDCBAndTimeouts(lpDef: PChar; var lpDCB: TDCB;
  var lpCommTimeouts: TCommTimeouts): BOOL; stdcall;
{$EXTERNALSYM CommConfigDialogA}
function CommConfigDialogA(lpszName: PAnsiChar; hWnd: HWND; var lpCC: TCommConfig): BOOL; stdcall;
{$EXTERNALSYM CommConfigDialogW}
function CommConfigDialogW(lpszName: PWideChar; hWnd: HWND; var lpCC: TCommConfig): BOOL; stdcall;
{$EXTERNALSYM CommConfigDialog}
function CommConfigDialog(lpszName: PChar; hWnd: HWND; var lpCC: TCommConfig): BOOL; stdcall;
{$EXTERNALSYM GetDefaultCommConfigA}
function GetDefaultCommConfigA(lpszName: PAnsiChar;
  var lpCC: TCommConfig; var lpdwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetDefaultCommConfigW}
function GetDefaultCommConfigW(lpszName: PWideChar;
  var lpCC: TCommConfig; var lpdwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetDefaultCommConfig}
function GetDefaultCommConfig(lpszName: PChar;
  var lpCC: TCommConfig; var lpdwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetDefaultCommConfigA}
function SetDefaultCommConfigA(lpszName: PAnsiChar; lpCC: PCommConfig; dwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetDefaultCommConfigW}
function SetDefaultCommConfigW(lpszName: PWideChar; lpCC: PCommConfig; dwSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetDefaultCommConfig}
function SetDefaultCommConfig(lpszName: PChar; lpCC: PCommConfig; dwSize: DWORD): BOOL; stdcall;

const
  {$EXTERNALSYM MAX_COMPUTERNAME_LENGTH}
  MAX_COMPUTERNAME_LENGTH = 15;

{$EXTERNALSYM GetComputerNameA}
function GetComputerNameA(lpBuffer: PAnsiChar; var nSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetComputerNameW}
function GetComputerNameW(lpBuffer: PWideChar; var nSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetComputerName}
function GetComputerName(lpBuffer: PChar; var nSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetComputerNameA}
function SetComputerNameA(lpComputerName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetComputerNameW}
function SetComputerNameW(lpComputerName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetComputerName}
function SetComputerName(lpComputerName: PChar): BOOL; stdcall;
{$EXTERNALSYM GetUserNameA}
function GetUserNameA(lpBuffer: PAnsiChar; var nSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetUserNameW}
function GetUserNameW(lpBuffer: PWideChar; var nSize: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetUserName}
function GetUserName(lpBuffer: PChar; var nSize: DWORD): BOOL; stdcall;

{ Logon Support APIs }

const
  {$EXTERNALSYM LOGON32_LOGON_INTERACTIVE}
  LOGON32_LOGON_INTERACTIVE = 2;
  {$EXTERNALSYM LOGON32_LOGON_NETWORK}
  LOGON32_LOGON_NETWORK = 3;
  {$EXTERNALSYM LOGON32_LOGON_BATCH}
  LOGON32_LOGON_BATCH = 4;
  {$EXTERNALSYM LOGON32_LOGON_SERVICE}
  LOGON32_LOGON_SERVICE = 5;

  {$EXTERNALSYM LOGON32_PROVIDER_DEFAULT}
  LOGON32_PROVIDER_DEFAULT = 0;
  {$EXTERNALSYM LOGON32_PROVIDER_WINNT35}
  LOGON32_PROVIDER_WINNT35 = 1;
  {$EXTERNALSYM LOGON32_PROVIDER_WINNT40}
  LOGON32_PROVIDER_WINNT40 = 2;
  {$EXTERNALSYM LOGON32_PROVIDER_WINNT50}
  LOGON32_PROVIDER_WINNT50 = 3;

{$EXTERNALSYM LogonUserA}
function LogonUserA(lpszUsername, lpszDomain, lpszPassword: PAnsiChar;
  dwLogonType, dwLogonProvider: DWORD; var phToken: THandle): BOOL; stdcall;
{$EXTERNALSYM LogonUserW}
function LogonUserW(lpszUsername, lpszDomain, lpszPassword: PWideChar;
  dwLogonType, dwLogonProvider: DWORD; var phToken: THandle): BOOL; stdcall;
{$EXTERNALSYM LogonUser}
function LogonUser(lpszUsername, lpszDomain, lpszPassword: PChar;
  dwLogonType, dwLogonProvider: DWORD; var phToken: THandle): BOOL; stdcall;
{$EXTERNALSYM ImpersonateLoggedOnUser}
function ImpersonateLoggedOnUser(hToken: THandle): BOOL; stdcall;
{$EXTERNALSYM CreateProcessAsUserA}
function CreateProcessAsUserA(hToken: THandle; lpApplicationName: PAnsiChar;
  lpCommandLine: PAnsiChar; lpProcessAttributes: PSecurityAttributes;
  lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL;
  dwCreationFlags: DWORD; lpEnvironment: Pointer; lpCurrentDirectory: PAnsiChar;
  const lpStartupInfo: TStartupInfo; var lpProcessInformation: TProcessInformation): BOOL; stdcall;
{$EXTERNALSYM CreateProcessAsUserW}
function CreateProcessAsUserW(hToken: THandle; lpApplicationName: PWideChar;
  lpCommandLine: PWideChar; lpProcessAttributes: PSecurityAttributes;
  lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL;
  dwCreationFlags: DWORD; lpEnvironment: Pointer; lpCurrentDirectory: PWideChar;
  const lpStartupInfo: TStartupInfo; var lpProcessInformation: TProcessInformation): BOOL; stdcall;
{$EXTERNALSYM CreateProcessAsUser}
function CreateProcessAsUser(hToken: THandle; lpApplicationName: PChar;
  lpCommandLine: PChar; lpProcessAttributes: PSecurityAttributes;
  lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL;
  dwCreationFlags: DWORD; lpEnvironment: Pointer; lpCurrentDirectory: PChar;
  const lpStartupInfo: TStartupInfo; var lpProcessInformation: TProcessInformation): BOOL; stdcall;

{$EXTERNALSYM DuplicateTokenEx}
function DuplicateTokenEx(hExistingToken: THandle; dwDesiredAccess: DWORD;
  lpTokenAttributes: PSecurityAttributes;
  ImpersonationLevel: TSecurityImpersonationLevel; TokenType: TTokenType;
  var phNewToken: THandle): BOOL; stdcall;

{ Plug-and-Play API's }
const
  {$EXTERNALSYM HW_PROFILE_GUIDLEN}
  HW_PROFILE_GUIDLEN = 39;                 { 36-characters plus NULL terminator }
  {$EXTERNALSYM MAX_PROFILE_LEN}
  MAX_PROFILE_LEN = 80;

  {$EXTERNALSYM DOCKINFO_UNDOCKED}
  DOCKINFO_UNDOCKED = $1;
  {$EXTERNALSYM DOCKINFO_DOCKED}
  DOCKINFO_DOCKED = $2;
  {$EXTERNALSYM DOCKINFO_USER_SUPPLIED}
  DOCKINFO_USER_SUPPLIED = $4;
  {$EXTERNALSYM DOCKINFO_USER_UNDOCKED}
  DOCKINFO_USER_UNDOCKED = DOCKINFO_USER_SUPPLIED or DOCKINFO_UNDOCKED;
  {$EXTERNALSYM DOCKINFO_USER_DOCKED}
  DOCKINFO_USER_DOCKED = DOCKINFO_USER_SUPPLIED or DOCKINFO_DOCKED;

type
  PHWProfileInfoA = ^THWProfileInfoA;
  PHWProfileInfoW = ^THWProfileInfoW;
  PHWProfileInfo = PHWProfileInfoA;
  {$EXTERNALSYM tagHW_PROFILE_INFOA}
  tagHW_PROFILE_INFOA = packed record
    dwDockInfo: DWORD;
    szHwProfileGuid: packed array[0..HW_PROFILE_GUIDLEN-1] of AnsiChar;
    szHwProfileName: packed array[0..MAX_PROFILE_LEN-1] of AnsiChar;
  end;
  {$EXTERNALSYM tagHW_PROFILE_INFOW}
  tagHW_PROFILE_INFOW = packed record
    dwDockInfo: DWORD;
    szHwProfileGuid: packed array[0..HW_PROFILE_GUIDLEN-1] of WideChar;
    szHwProfileName: packed array[0..MAX_PROFILE_LEN-1] of WideChar;
  end;
  {$EXTERNALSYM tagHW_PROFILE_INFO}
  tagHW_PROFILE_INFO = tagHW_PROFILE_INFOA;
  THWProfileInfoA = tagHW_PROFILE_INFOA;
  THWProfileInfoW = tagHW_PROFILE_INFOW;
  THWProfileInfo = THWProfileInfoA;
  {$EXTERNALSYM HW_PROFILE_INFOA}
  HW_PROFILE_INFOA = tagHW_PROFILE_INFOA;
  {$EXTERNALSYM HW_PROFILE_INFOW}
  HW_PROFILE_INFOW = tagHW_PROFILE_INFOW;
  {$EXTERNALSYM HW_PROFILE_INFO}
  HW_PROFILE_INFO = HW_PROFILE_INFOA;

{$EXTERNALSYM GetCurrentHwProfileA}
function GetCurrentHwProfileA(var lpHwProfileInfo: THWProfileInfoA): BOOL; stdcall;
{$EXTERNALSYM GetCurrentHwProfileW}
function GetCurrentHwProfileW(var lpHwProfileInfo: THWProfileInfoW): BOOL; stdcall;
{$EXTERNALSYM GetCurrentHwProfile}
function GetCurrentHwProfile(var lpHwProfileInfo: THWProfileInfo): BOOL; stdcall;

{ Performance counter API's }

{$EXTERNALSYM QueryPerformanceCounter}
function QueryPerformanceCounter(var lpPerformanceCount: TLargeInteger): BOOL; stdcall;
{$EXTERNALSYM QueryPerformanceFrequency}
function QueryPerformanceFrequency(var lpFrequency: TLargeInteger): BOOL; stdcall;

type
  POSVersionInfoA = ^TOSVersionInfoA;
  POSVersionInfoW = ^TOSVersionInfoW;
  POSVersionInfo = POSVersionInfoA;
  {$EXTERNALSYM _OSVERSIONINFOA}
  _OSVERSIONINFOA = record
    dwOSVersionInfoSize: DWORD;
    dwMajorVersion: DWORD;
    dwMinorVersion: DWORD;
    dwBuildNumber: DWORD;
    dwPlatformId: DWORD;
    szCSDVersion: array[0..127] of AnsiChar; { Maintenance string for PSS usage }
  end;
  {$EXTERNALSYM _OSVERSIONINFOW}
  _OSVERSIONINFOW = record
    dwOSVersionInfoSize: DWORD;
    dwMajorVersion: DWORD;
    dwMinorVersion: DWORD;
    dwBuildNumber: DWORD;
    dwPlatformId: DWORD;
    szCSDVersion: array[0..127] of WideChar; { Maintenance string for PSS usage }
  end;
  {$EXTERNALSYM _OSVERSIONINFO}
  _OSVERSIONINFO = _OSVERSIONINFOA;
  TOSVersionInfoA = _OSVERSIONINFOA;
  TOSVersionInfoW = _OSVERSIONINFOW;
  TOSVersionInfo = TOSVersionInfoA;
  {$EXTERNALSYM OSVERSIONINFOA}
  OSVERSIONINFOA = _OSVERSIONINFOA;
  {$EXTERNALSYM OSVERSIONINFOW}
  OSVERSIONINFOW = _OSVERSIONINFOW;
  {$EXTERNALSYM OSVERSIONINFO}
  OSVERSIONINFO = OSVERSIONINFOA;

{ dwPlatformId defines }
const
  {$EXTERNALSYM VER_PLATFORM_WIN32s}
  VER_PLATFORM_WIN32s = 0;
  {$EXTERNALSYM VER_PLATFORM_WIN32_WINDOWS}
  VER_PLATFORM_WIN32_WINDOWS = 1;
  {$EXTERNALSYM VER_PLATFORM_WIN32_NT}
  VER_PLATFORM_WIN32_NT = 2;

{$EXTERNALSYM GetVersionExA}
function GetVersionExA(var lpVersionInformation: TOSVersionInfo): BOOL; stdcall;
{$EXTERNALSYM GetVersionExW}
function GetVersionExW(var lpVersionInformation: TOSVersionInfo): BOOL; stdcall;
{$EXTERNALSYM GetVersionEx}
function GetVersionEx(var lpVersionInformation: TOSVersionInfo): BOOL; stdcall;

{ DOS and OS/2 Compatible Error Code definitions returned by the Win32 Base
  API functions. }


{ Translated from WINERROR.H }
{ Error code definitions for the Win32 API functions }

(*
  Values are 32 bit values layed out as follows:
   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  +---+-+-+-----------------------+-------------------------------+
  |Sev|C|R|     Facility          |               Code            |
  +---+-+-+-----------------------+-------------------------------+

  where
      Sev - is the severity code
          00 - Success
          01 - Informational
          10 - Warning
          11 - Error

      C - is the Customer code flag
      R - is a reserved bit
      Facility - is the facility code
      Code - is the facility's status code
*)

{ Define the facility codes }

const
  {$EXTERNALSYM FACILITY_WINDOWS}
  FACILITY_WINDOWS                     = 8;
  {$EXTERNALSYM FACILITY_STORAGE}
  FACILITY_STORAGE                     = 3;
  {$EXTERNALSYM FACILITY_RPC}
  FACILITY_RPC                         = 1;
  {$EXTERNALSYM FACILITY_SSPI}
  FACILITY_SSPI                        = 9;
  {$EXTERNALSYM FACILITY_WIN32}
  FACILITY_WIN32                       = 7;
  {$EXTERNALSYM FACILITY_CONTROL}
  FACILITY_CONTROL                     = 10;
  {$EXTERNALSYM FACILITY_NULL}
  FACILITY_NULL                        = 0;
  {$EXTERNALSYM FACILITY_INTERNET}
  FACILITY_INTERNET                    = 12;
  {$EXTERNALSYM FACILITY_ITF}
  FACILITY_ITF                         = 4;
  {$EXTERNALSYM FACILITY_DISPATCH}
  FACILITY_DISPATCH                    = 2;
  {$EXTERNALSYM FACILITY_CERT}
  FACILITY_CERT                        = 11;


{ Define the severity codes }

  { The operation completed successfully. }
  {$EXTERNALSYM ERROR_SUCCESS}
  ERROR_SUCCESS = 0;
  {$EXTERNALSYM NO_ERROR}
  NO_ERROR = 0;   { dderror }

  { Incorrect function. }
  {$EXTERNALSYM ERROR_INVALID_FUNCTION}
  ERROR_INVALID_FUNCTION = 1;   { dderror }

  { The system cannot find the file specified. }
  {$EXTERNALSYM ERROR_FILE_NOT_FOUND}
  ERROR_FILE_NOT_FOUND = 2;

  { The system cannot find the path specified. }
  {$EXTERNALSYM ERROR_PATH_NOT_FOUND}
  ERROR_PATH_NOT_FOUND = 3;

  { The system cannot open the file. }
  {$EXTERNALSYM ERROR_TOO_MANY_OPEN_FILES}
  ERROR_TOO_MANY_OPEN_FILES = 4;

  { Access is denied. }
  {$EXTERNALSYM ERROR_ACCESS_DENIED}
  ERROR_ACCESS_DENIED = 5;

  { The handle is invalid. }
  {$EXTERNALSYM ERROR_INVALID_HANDLE}
  ERROR_INVALID_HANDLE = 6;

  { The storage control blocks were destroyed. }
  {$EXTERNALSYM ERROR_ARENA_TRASHED}
  ERROR_ARENA_TRASHED = 7;

  { Not enough storage is available to process this command. }
  {$EXTERNALSYM ERROR_NOT_ENOUGH_MEMORY}
  ERROR_NOT_ENOUGH_MEMORY = 8;   { dderror }

  { The storage control block address is invalid. }
  {$EXTERNALSYM ERROR_INVALID_BLOCK}
  ERROR_INVALID_BLOCK = 9;

  { The environment is incorrect. }
  {$EXTERNALSYM ERROR_BAD_ENVIRONMENT}
  ERROR_BAD_ENVIRONMENT = 10;

  { An attempt was made to load a program with an incorrect format. }
  {$EXTERNALSYM ERROR_BAD_FORMAT}
  ERROR_BAD_FORMAT = 11;

  { The access code is invalid. }
  {$EXTERNALSYM ERROR_INVALID_ACCESS}
  ERROR_INVALID_ACCESS = 12;

  { The data is invalid. }
  {$EXTERNALSYM ERROR_INVALID_DATA}
  ERROR_INVALID_DATA = 13;

  { Not enough storage is available to complete this operation. }
  {$EXTERNALSYM ERROR_OUTOFMEMORY}
  ERROR_OUTOFMEMORY = 14;

  { The system cannot find the drive specified. }
  {$EXTERNALSYM ERROR_INVALID_DRIVE}
  ERROR_INVALID_DRIVE = 15;

  { The directory cannot be removed. }
  {$EXTERNALSYM ERROR_CURRENT_DIRECTORY}
  ERROR_CURRENT_DIRECTORY = $10;

  { The system cannot move the file }
  { to a different disk drive. }
  {$EXTERNALSYM ERROR_NOT_SAME_DEVICE}
  ERROR_NOT_SAME_DEVICE = 17;

  { There are no more files. }
  {$EXTERNALSYM ERROR_NO_MORE_FILES}
  ERROR_NO_MORE_FILES = 18;

  { The media is write protected. }
  {$EXTERNALSYM ERROR_WRITE_PROTECT}
  ERROR_WRITE_PROTECT = 19;

  { The system cannot find the device specified. }
  {$EXTERNALSYM ERROR_BAD_UNIT}
  ERROR_BAD_UNIT = 20;

  { The device is not ready. }
  {$EXTERNALSYM ERROR_NOT_READY}
  ERROR_NOT_READY = 21;

  { The device does not recognize the command. }
  {$EXTERNALSYM ERROR_BAD_COMMAND}
  ERROR_BAD_COMMAND = 22;

  { Data error (cyclic redundancy check) }
  {$EXTERNALSYM ERROR_CRC}
  ERROR_CRC = 23;

  { The program issued a command but the command length is incorrect. }
  {$EXTERNALSYM ERROR_BAD_LENGTH}
  ERROR_BAD_LENGTH = 24;

  { The drive cannot locate a specific area or track on the disk. }
  {$EXTERNALSYM ERROR_SEEK}
  ERROR_SEEK = 25;

  { The specified disk or diskette cannot be accessed. }
  {$EXTERNALSYM ERROR_NOT_DOS_DISK}
  ERROR_NOT_DOS_DISK = 26;

  { The drive cannot find the sector requested. }
  {$EXTERNALSYM ERROR_SECTOR_NOT_FOUND}
  ERROR_SECTOR_NOT_FOUND = 27;

  { The printer is out of paper. }
  {$EXTERNALSYM ERROR_OUT_OF_PAPER}
  ERROR_OUT_OF_PAPER = 28;

  { The system cannot write to the specified device. }
  {$EXTERNALSYM ERROR_WRITE_FAULT}
  ERROR_WRITE_FAULT = 29;

  { The system cannot read from the specified device. }
  {$EXTERNALSYM ERROR_READ_FAULT}
  ERROR_READ_FAULT = 30;

  { A device attached to the system is not functioning. }
  {$EXTERNALSYM ERROR_GEN_FAILURE}
  ERROR_GEN_FAILURE = 31;

  { The process cannot access the file because it is being used by another process. }
  {$EXTERNALSYM ERROR_SHARING_VIOLATION}
  ERROR_SHARING_VIOLATION = $20;

  { The process cannot access the file because }
  { another process has locked a portion of the file. }
  {$EXTERNALSYM ERROR_LOCK_VIOLATION}
  ERROR_LOCK_VIOLATION = 33;

  { The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) }
  { into drive %1. }
  {$EXTERNALSYM ERROR_WRONG_DISK}
  ERROR_WRONG_DISK = 34;

  { Too many files opened for sharing. }
  {$EXTERNALSYM ERROR_SHARING_BUFFER_EXCEEDED}
  ERROR_SHARING_BUFFER_EXCEEDED = 36;

  { Reached end of file. }
  {$EXTERNALSYM ERROR_HANDLE_EOF}
  ERROR_HANDLE_EOF = 38;

  { The disk is full. }
  {$EXTERNALSYM ERROR_HANDLE_DISK_FULL}
  ERROR_HANDLE_DISK_FULL = 39;

  { The network request is not supported. }
  {$EXTERNALSYM ERROR_NOT_SUPPORTED}
  ERROR_NOT_SUPPORTED = 50;

  { The remote computer is not available. }
  {$EXTERNALSYM ERROR_REM_NOT_LIST}
  ERROR_REM_NOT_LIST = 51;

  { A duplicate name exists on the network. }
  {$EXTERNALSYM ERROR_DUP_NAME}
  ERROR_DUP_NAME = 52;

  { The network path was not found. }
  {$EXTERNALSYM ERROR_BAD_NETPATH}
  ERROR_BAD_NETPATH = 53;

  { The network is busy. }
  {$EXTERNALSYM ERROR_NETWORK_BUSY}
  ERROR_NETWORK_BUSY = 54;

  { The specified network resource or device is no longer }
  { available. }
  {$EXTERNALSYM ERROR_DEV_NOT_EXIST}
  ERROR_DEV_NOT_EXIST = 55;   { dderror }

  { The network BIOS command limit has been reached. }
  {$EXTERNALSYM ERROR_TOO_MANY_CMDS}
  ERROR_TOO_MANY_CMDS = 56;

  { A network adapter hardware error occurred. }
  {$EXTERNALSYM ERROR_ADAP_HDW_ERR}
  ERROR_ADAP_HDW_ERR = 57;

  { The specified server cannot perform the requested }
  { operation. }
  {$EXTERNALSYM ERROR_BAD_NET_RESP}
  ERROR_BAD_NET_RESP = 58;

  { An unexpected network error occurred. }
  {$EXTERNALSYM ERROR_UNEXP_NET_ERR}
  ERROR_UNEXP_NET_ERR = 59;

  { The remote adapter is not compatible. }
  {$EXTERNALSYM ERROR_BAD_REM_ADAP}
  ERROR_BAD_REM_ADAP = 60;

  { The printer queue is full. }
  {$EXTERNALSYM ERROR_PRINTQ_FULL}
  ERROR_PRINTQ_FULL = 61;

  { Space to store the file waiting to be printed is }
  { not available on the server. }
  {$EXTERNALSYM ERROR_NO_SPOOL_SPACE}
  ERROR_NO_SPOOL_SPACE = 62;

  { Your file waiting to be printed was deleted. }
  {$EXTERNALSYM ERROR_PRINT_CANCELLED}
  ERROR_PRINT_CANCELLED = 63;

  { The specified network name is no longer available. }
  {$EXTERNALSYM ERROR_NETNAME_DELETED}
  ERROR_NETNAME_DELETED = $40;

  { Network access is denied. }
  {$EXTERNALSYM ERROR_NETWORK_ACCESS_DENIED}
  ERROR_NETWORK_ACCESS_DENIED = 65;

  { The network resource type is not correct. }
  {$EXTERNALSYM ERROR_BAD_DEV_TYPE}
  ERROR_BAD_DEV_TYPE = 66;

  { The network name cannot be found. }
  {$EXTERNALSYM ERROR_BAD_NET_NAME}
  ERROR_BAD_NET_NAME = 67;

  { The name limit for the local computer network }
  { adapter card was exceeded. }
  {$EXTERNALSYM ERROR_TOO_MANY_NAMES}
  ERROR_TOO_MANY_NAMES = 68;

  { The network BIOS session limit was exceeded. }
  {$EXTERNALSYM ERROR_TOO_MANY_SESS}
  ERROR_TOO_MANY_SESS = 69;

  { The remote server has been paused or is in the }
  { process of being started. }
  {$EXTERNALSYM ERROR_SHARING_PAUSED}
  ERROR_SHARING_PAUSED = 70;

  { No more connections can be made to this remote computer at this time }
  { because there are already as many connections as the computer can accept. }
  {$EXTERNALSYM ERROR_REQ_NOT_ACCEP}
  ERROR_REQ_NOT_ACCEP = 71;

  { The specified printer or disk device has been paused. }
  {$EXTERNALSYM ERROR_REDIR_PAUSED}
  ERROR_REDIR_PAUSED = 72;

  { The file exists. }
  {$EXTERNALSYM ERROR_FILE_EXISTS}
  ERROR_FILE_EXISTS = 80;

  { The directory or file cannot be created. }
  {$EXTERNALSYM ERROR_CANNOT_MAKE}
  ERROR_CANNOT_MAKE = 82;

  { Fail on INT 24 }
  {$EXTERNALSYM ERROR_FAIL_I24}
  ERROR_FAIL_I24 = 83;

  { Storage to process this request is not available. }
  {$EXTERNALSYM ERROR_OUT_OF_STRUCTURES}
  ERROR_OUT_OF_STRUCTURES = 84;

  { The local device name is already in use. }
  {$EXTERNALSYM ERROR_ALREADY_ASSIGNED}
  ERROR_ALREADY_ASSIGNED = 85;

  { The specified network password is not correct. }
  {$EXTERNALSYM ERROR_INVALID_PASSWORD}
  ERROR_INVALID_PASSWORD = 86;

  { The parameter is incorrect. }
  {$EXTERNALSYM ERROR_INVALID_PARAMETER}
  ERROR_INVALID_PARAMETER = 87;   { dderror }

  { A write fault occurred on the network. }
  {$EXTERNALSYM ERROR_NET_WRITE_FAULT}
  ERROR_NET_WRITE_FAULT = 88;

  { The system cannot start another process at }
  { this time. }
  {$EXTERNALSYM ERROR_NO_PROC_SLOTS}
  ERROR_NO_PROC_SLOTS = 89;

  { Cannot create another system semaphore. }
  {$EXTERNALSYM ERROR_TOO_MANY_SEMAPHORES}
  ERROR_TOO_MANY_SEMAPHORES = 100;

  { The exclusive semaphore is owned by another process. }
  {$EXTERNALSYM ERROR_EXCL_SEM_ALREADY_OWNED}
  ERROR_EXCL_SEM_ALREADY_OWNED = 101;

  { The semaphore is set and cannot be closed. }
  {$EXTERNALSYM ERROR_SEM_IS_SET}
  ERROR_SEM_IS_SET = 102;

  { The semaphore cannot be set again. }
  {$EXTERNALSYM ERROR_TOO_MANY_SEM_REQUESTS}
  ERROR_TOO_MANY_SEM_REQUESTS = 103;

  { Cannot request exclusive semaphores at interrupt time. }
  {$EXTERNALSYM ERROR_INVALID_AT_INTERRUPT_TIME}
  ERROR_INVALID_AT_INTERRUPT_TIME = 104;

  { The previous ownership of this semaphore has ended. }
  {$EXTERNALSYM ERROR_SEM_OWNER_DIED}
  ERROR_SEM_OWNER_DIED = 105;

  { Insert the diskette for drive %1. }
  {$EXTERNALSYM ERROR_SEM_USER_LIMIT}
  ERROR_SEM_USER_LIMIT = 106;

  { Program stopped because alternate diskette was not inserted. }
  {$EXTERNALSYM ERROR_DISK_CHANGE}
  ERROR_DISK_CHANGE = 107;

  { The disk is in use or locked by }
  { another process. }
  {$EXTERNALSYM ERROR_DRIVE_LOCKED}
  ERROR_DRIVE_LOCKED = 108;

  { The pipe has been ended. }
  {$EXTERNALSYM ERROR_BROKEN_PIPE}
  ERROR_BROKEN_PIPE = 109;

  { The system cannot open the device or file specified. }
  {$EXTERNALSYM ERROR_OPEN_FAILED}
  ERROR_OPEN_FAILED = 110;

  { The file name is too long. }
  {$EXTERNALSYM ERROR_BUFFER_OVERFLOW}
  ERROR_BUFFER_OVERFLOW = 111;

  { There is not enough space on the disk. }
  {$EXTERNALSYM ERROR_DISK_FULL}
  ERROR_DISK_FULL = 112;

  { No more internal file identifiers available. }
  {$EXTERNALSYM ERROR_NO_MORE_SEARCH_HANDLES}
  ERROR_NO_MORE_SEARCH_HANDLES = 113;

  { The target internal file identifier is incorrect. }
  {$EXTERNALSYM ERROR_INVALID_TARGET_HANDLE}
  ERROR_INVALID_TARGET_HANDLE = 114;

  { The IOCTL call made by the application program is not correct. }
  {$EXTERNALSYM ERROR_INVALID_CATEGORY}
  ERROR_INVALID_CATEGORY = 117;

  { The verify-on-write switch parameter value is not correct. }
  {$EXTERNALSYM ERROR_INVALID_VERIFY_SWITCH}
  ERROR_INVALID_VERIFY_SWITCH = 118;

  { The system does not support the command requested. }
  {$EXTERNALSYM ERROR_BAD_DRIVER_LEVEL}
  ERROR_BAD_DRIVER_LEVEL = 119;

  { This function is only valid in Windows NT mode. }
  {$EXTERNALSYM ERROR_CALL_NOT_IMPLEMENTED}
  ERROR_CALL_NOT_IMPLEMENTED = 120;

  { The semaphore timeout period has expired. }
  {$EXTERNALSYM ERROR_SEM_TIMEOUT}
  ERROR_SEM_TIMEOUT = 121;

  { The data area passed to a system call is too small. }
  {$EXTERNALSYM ERROR_INSUFFICIENT_BUFFER}
  ERROR_INSUFFICIENT_BUFFER = 122;   { dderror }

  { The filename, directory name, or volume label syntax is incorrect. }
  {$EXTERNALSYM ERROR_INVALID_NAME}
  ERROR_INVALID_NAME = 123;

  { The system call level is not correct. }
  {$EXTERNALSYM ERROR_INVALID_LEVEL}
  ERROR_INVALID_LEVEL = 124;

  { The disk has no volume label. }
  {$EXTERNALSYM ERROR_NO_VOLUME_LABEL}
  ERROR_NO_VOLUME_LABEL = 125;

  { The specified module could not be found. }
  {$EXTERNALSYM ERROR_MOD_NOT_FOUND}
  ERROR_MOD_NOT_FOUND = 126;

  { The specified procedure could not be found. }
  {$EXTERNALSYM ERROR_PROC_NOT_FOUND}
  ERROR_PROC_NOT_FOUND = 127;

  { There are no child processes to wait for. }
  {$EXTERNALSYM ERROR_WAIT_NO_CHILDREN}
  ERROR_WAIT_NO_CHILDREN = $80;

  { The %1 application cannot be run in Windows NT mode. }
  {$EXTERNALSYM ERROR_CHILD_NOT_COMPLETE}
  ERROR_CHILD_NOT_COMPLETE = 129;

  { Attempt to use a file handle to an open disk partition for an }
  { operation other than raw disk I/O. }
  {$EXTERNALSYM ERROR_DIRECT_ACCESS_HANDLE}
  ERROR_DIRECT_ACCESS_HANDLE = 130;

  { An attempt was made to move the file pointer before the beginning of the file. }
  {$EXTERNALSYM ERROR_NEGATIVE_SEEK}
  ERROR_NEGATIVE_SEEK = 131;

  { The file pointer cannot be set on the specified device or file. }
  {$EXTERNALSYM ERROR_SEEK_ON_DEVICE}
  ERROR_SEEK_ON_DEVICE = 132;

  { A JOIN or SUBST command }
  { cannot be used for a drive that }
  { contains previously joined drives. }
  {$EXTERNALSYM ERROR_IS_JOIN_TARGET}
  ERROR_IS_JOIN_TARGET = 133;

  { An attempt was made to use a }
  { JOIN or SUBST command on a drive that has }
  { already been joined. }
  {$EXTERNALSYM ERROR_IS_JOINED}
  ERROR_IS_JOINED = 134;

  { An attempt was made to use a }
  { JOIN or SUBST command on a drive that has }
  { already been substituted. }
  {$EXTERNALSYM ERROR_IS_SUBSTED}
  ERROR_IS_SUBSTED = 135;

  { The system tried to delete }
  { the JOIN of a drive that is not joined. }
  {$EXTERNALSYM ERROR_NOT_JOINED}
  ERROR_NOT_JOINED = 136;

  { The system tried to delete the }
  { substitution of a drive that is not substituted. }
  {$EXTERNALSYM ERROR_NOT_SUBSTED}
  ERROR_NOT_SUBSTED = 137;

  { The system tried to join a drive to a directory on a joined drive. }
  {$EXTERNALSYM ERROR_JOIN_TO_JOIN}
  ERROR_JOIN_TO_JOIN = 138;

  { The system tried to substitute a drive to a directory on a substituted drive. }
  {$EXTERNALSYM ERROR_SUBST_TO_SUBST}
  ERROR_SUBST_TO_SUBST = 139;

  { The system tried to join a drive to a directory on a substituted drive. }
  {$EXTERNALSYM ERROR_JOIN_TO_SUBST}
  ERROR_JOIN_TO_SUBST = 140;

  { The system tried to SUBST a drive to a directory on a joined drive. }
  {$EXTERNALSYM ERROR_SUBST_TO_JOIN}
  ERROR_SUBST_TO_JOIN = 141;

  { The system cannot perform a JOIN or SUBST at this time. }
  {$EXTERNALSYM ERROR_BUSY_DRIVE}
  ERROR_BUSY_DRIVE = 142;

  { The system cannot join or substitute a }
  { drive to or for a directory on the same drive. }
  {$EXTERNALSYM ERROR_SAME_DRIVE}
  ERROR_SAME_DRIVE = 143;

  { The directory is not a subdirectory of the root directory. }
  {$EXTERNALSYM ERROR_DIR_NOT_ROOT}
  ERROR_DIR_NOT_ROOT = 144;

  { The directory is not empty. }
  {$EXTERNALSYM ERROR_DIR_NOT_EMPTY}
  ERROR_DIR_NOT_EMPTY = 145;

  { The path specified is being used in a substitute. }
  {$EXTERNALSYM ERROR_IS_SUBST_PATH}
  ERROR_IS_SUBST_PATH = 146;

  { Not enough resources are available to process this command. }
  {$EXTERNALSYM ERROR_IS_JOIN_PATH}
  ERROR_IS_JOIN_PATH = 147;

  { The path specified cannot be used at this time. }
  {$EXTERNALSYM ERROR_PATH_BUSY}
  ERROR_PATH_BUSY = 148;

  { An attempt was made to join or substitute a drive for which a directory }
  { on the drive is the target of a previous substitute. }
  {$EXTERNALSYM ERROR_IS_SUBST_TARGET}
  ERROR_IS_SUBST_TARGET = 149;

  { System trace information was not specified in your }
  { CONFIG.SYS file, or tracing is disallowed. }
  {$EXTERNALSYM ERROR_SYSTEM_TRACE}
  ERROR_SYSTEM_TRACE = 150;

  { The number of specified semaphore events for }
  { DosMuxSemWait is not correct. }
  {$EXTERNALSYM ERROR_INVALID_EVENT_COUNT}
  ERROR_INVALID_EVENT_COUNT = 151;

  { DosMuxSemWait did not execute; too many semaphores }
  { are already set. }
  {$EXTERNALSYM ERROR_TOO_MANY_MUXWAITERS}
  ERROR_TOO_MANY_MUXWAITERS = 152;

  { The DosMuxSemWait list is not correct. }
  {$EXTERNALSYM ERROR_INVALID_LIST_FORMAT}
  ERROR_INVALID_LIST_FORMAT = 153;

  {  The volume label you entered exceeds the label character }
  {  limit of the target file system. }
  {$EXTERNALSYM ERROR_LABEL_TOO_LONG}
  ERROR_LABEL_TOO_LONG = 154;

  { Cannot create another thread. }
  {$EXTERNALSYM ERROR_TOO_MANY_TCBS}
  ERROR_TOO_MANY_TCBS = 155;

  { The recipient process has refused the signal. }
  {$EXTERNALSYM ERROR_SIGNAL_REFUSED}
  ERROR_SIGNAL_REFUSED = 156;

  { The segment is already discarded and cannot be locked. }
  {$EXTERNALSYM ERROR_DISCARDED}
  ERROR_DISCARDED = 157;

  { The segment is already unlocked. }
  {$EXTERNALSYM ERROR_NOT_LOCKED}
  ERROR_NOT_LOCKED = 158;

  { The address for the thread ID is not correct. }
  {$EXTERNALSYM ERROR_BAD_THREADID_ADDR}
  ERROR_BAD_THREADID_ADDR = 159;

  { The argument string passed to DosExecPgm is not correct. }
  {$EXTERNALSYM ERROR_BAD_ARGUMENTS}
  ERROR_BAD_ARGUMENTS = 160;

  { The specified path is invalid. }
  {$EXTERNALSYM ERROR_BAD_PATHNAME}
  ERROR_BAD_PATHNAME = 161;

  { A signal is already pending. }
  {$EXTERNALSYM ERROR_SIGNAL_PENDING}
  ERROR_SIGNAL_PENDING = 162;

  { No more threads can be created in the system. }
  {$EXTERNALSYM ERROR_MAX_THRDS_REACHED}
  ERROR_MAX_THRDS_REACHED = 164;

  { Unable to lock a region of a file. }
  {$EXTERNALSYM ERROR_LOCK_FAILED}
  ERROR_LOCK_FAILED = 167;

  { The requested resource is in use. }
  {$EXTERNALSYM ERROR_BUSY}
  ERROR_BUSY = 170;

  { A lock request was not outstanding for the supplied cancel region. }
  {$EXTERNALSYM ERROR_CANCEL_VIOLATION}
  ERROR_CANCEL_VIOLATION = 173;

  { The file system does not support atomic changes to the lock type. }
  {$EXTERNALSYM ERROR_ATOMIC_LOCKS_NOT_SUPPORTED}
  ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174;

  { The system detected a segment number that was not correct. }
  {$EXTERNALSYM ERROR_INVALID_SEGMENT_NUMBER}
  ERROR_INVALID_SEGMENT_NUMBER = 180;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_INVALID_ORDINAL}
  ERROR_INVALID_ORDINAL = 182;

  { Cannot create a file when that file already exists. }
  {$EXTERNALSYM ERROR_ALREADY_EXISTS}
  ERROR_ALREADY_EXISTS = 183;

  { The flag passed is not correct. }
  {$EXTERNALSYM ERROR_INVALID_FLAG_NUMBER}
  ERROR_INVALID_FLAG_NUMBER = 186;

  { The specified system semaphore name was not found. }
  {$EXTERNALSYM ERROR_SEM_NOT_FOUND}
  ERROR_SEM_NOT_FOUND = 187;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_INVALID_STARTING_CODESEG}
  ERROR_INVALID_STARTING_CODESEG = 188;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_INVALID_STACKSEG}
  ERROR_INVALID_STACKSEG = 189;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_INVALID_MODULETYPE}
  ERROR_INVALID_MODULETYPE = 190;

  { Cannot run %1 in Windows NT mode. }
  {$EXTERNALSYM ERROR_INVALID_EXE_SIGNATURE}
  ERROR_INVALID_EXE_SIGNATURE = 191;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_EXE_MARKED_INVALID}
  ERROR_EXE_MARKED_INVALID = 192;

  { %1 is not a valid Windows NT application. }
  {$EXTERNALSYM ERROR_BAD_EXE_FORMAT}
  ERROR_BAD_EXE_FORMAT = 193;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_ITERATED_DATA_EXCEEDS_64k}
  ERROR_ITERATED_DATA_EXCEEDS_64k = 194;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_INVALID_MINALLOCSIZE}
  ERROR_INVALID_MINALLOCSIZE = 195;

  { The operating system cannot run this application program. }
  {$EXTERNALSYM ERROR_DYNLINK_FROM_INVALID_RING}
  ERROR_DYNLINK_FROM_INVALID_RING = 196;

  { The operating system is not presently configured to run this application. }
  {$EXTERNALSYM ERROR_IOPL_NOT_ENABLED}
  ERROR_IOPL_NOT_ENABLED = 197;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_INVALID_SEGDPL}
  ERROR_INVALID_SEGDPL = 198;

  { The operating system cannot run this }
  { application program. }
  {$EXTERNALSYM ERROR_AUTODATASEG_EXCEEDS_64k}
  ERROR_AUTODATASEG_EXCEEDS_64k = 199;

  { The code segment cannot be greater than or equal to 64KB. }
  {$EXTERNALSYM ERROR_RING2SEG_MUST_BE_MOVABLE}
  ERROR_RING2SEG_MUST_BE_MOVABLE = 200;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_RELOC_CHAIN_XEEDS_SEGLIM}
  ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201;

  { The operating system cannot run %1. }
  {$EXTERNALSYM ERROR_INFLOOP_IN_RELOC_CHAIN}
  ERROR_INFLOOP_IN_RELOC_CHAIN = 202;

  { The system could not find the environment option that was entered. }
  {$EXTERNALSYM ERROR_ENVVAR_NOT_FOUND}
  ERROR_ENVVAR_NOT_FOUND = 203;

  { No process in the command subtree has a signal handler. }
  {$EXTERNALSYM ERROR_NO_SIGNAL_SENT}
  ERROR_NO_SIGNAL_SENT = 205;

  { The filename or extension is too long. }
  {$EXTERNALSYM ERROR_FILENAME_EXCED_RANGE}
  ERROR_FILENAME_EXCED_RANGE = 206;

  { The ring 2 stack is in use. }
  {$EXTERNALSYM ERROR_RING2_STACK_IN_USE}
  ERROR_RING2_STACK_IN_USE = 207;

  { The global filename characters, * or ?, are entered }
  { incorrectly or too many global filename characters are specified. }
  {$EXTERNALSYM ERROR_META_EXPANSION_TOO_LONG}
  ERROR_META_EXPANSION_TOO_LONG = 208;

  { The signal being posted is not correct. }
  {$EXTERNALSYM ERROR_INVALID_SIGNAL_NUMBER}
  ERROR_INVALID_SIGNAL_NUMBER = 209;

  { The signal handler cannot be set. }
  {$EXTERNALSYM ERROR_THREAD_1_INACTIVE}
  ERROR_THREAD_1_INACTIVE = 210;

  { The segment is locked and cannot be reallocated. }
  {$EXTERNALSYM ERROR_LOCKED}
  ERROR_LOCKED = 212;

  { Too many dynamic link modules are attached to this }
  { program or dynamic link module. }
  {$EXTERNALSYM ERROR_TOO_MANY_MODULES}
  ERROR_TOO_MANY_MODULES = 214;

  { Can't nest calls to LoadModule. }
  {$EXTERNALSYM ERROR_NESTING_NOT_ALLOWED}
  ERROR_NESTING_NOT_ALLOWED = 215;

  {  The image file %1 is valid, but is for a machine type other }
  {  than the current machine. }
  {$EXTERNALSYM ERROR_EXE_MACHINE_TYPE_MISMATCH}
  ERROR_EXE_MACHINE_TYPE_MISMATCH = 216;

  { The pipe state is invalid. }
  {$EXTERNALSYM ERROR_BAD_PIPE}
  ERROR_BAD_PIPE = 230;

  { All pipe instances are busy. }
  {$EXTERNALSYM ERROR_PIPE_BUSY}
  ERROR_PIPE_BUSY = 231;

  { The pipe is being closed. }
  {$EXTERNALSYM ERROR_NO_DATA}
  ERROR_NO_DATA = 232;

  { No process is on the other end of the pipe. }
  {$EXTERNALSYM ERROR_PIPE_NOT_CONNECTED}
  ERROR_PIPE_NOT_CONNECTED = 233;

  { More data is available. }
  {$EXTERNALSYM ERROR_MORE_DATA}
  ERROR_MORE_DATA = 234;   { dderror }

  { The session was cancelled. }
  {$EXTERNALSYM ERROR_VC_DISCONNECTED}
  ERROR_VC_DISCONNECTED = 240;

  { The specified extended attribute name was invalid. }
  {$EXTERNALSYM ERROR_INVALID_EA_NAME}
  ERROR_INVALID_EA_NAME = 254;

  { The extended attributes are inconsistent. }
  {$EXTERNALSYM ERROR_EA_LIST_INCONSISTENT}
  ERROR_EA_LIST_INCONSISTENT = 255;

  { No more data is available. }
  {$EXTERNALSYM ERROR_NO_MORE_ITEMS}
  ERROR_NO_MORE_ITEMS = 259;

  { The Copy API cannot be used. }
  {$EXTERNALSYM ERROR_CANNOT_COPY}
  ERROR_CANNOT_COPY = 266;

  { The directory name is invalid. }
  {$EXTERNALSYM ERROR_DIRECTORY}
  ERROR_DIRECTORY = 267;

  { The extended attributes did not fit in the buffer. }
  {$EXTERNALSYM ERROR_EAS_DIDNT_FIT}
  ERROR_EAS_DIDNT_FIT = 275;

  { The extended attribute file on the mounted file system is corrupt. }
  {$EXTERNALSYM ERROR_EA_FILE_CORRUPT}
  ERROR_EA_FILE_CORRUPT = 276;

  { The extended attribute table file is full. }
  {$EXTERNALSYM ERROR_EA_TABLE_FULL}
  ERROR_EA_TABLE_FULL = 277;

  { The specified extended attribute handle is invalid. }
  {$EXTERNALSYM ERROR_INVALID_EA_HANDLE}
  ERROR_INVALID_EA_HANDLE = 278;

  { The mounted file system does not support extended attributes. }
  {$EXTERNALSYM ERROR_EAS_NOT_SUPPORTED}
  ERROR_EAS_NOT_SUPPORTED = 282;

  { Attempt to release mutex not owned by caller. }
  {$EXTERNALSYM ERROR_NOT_OWNER}
  ERROR_NOT_OWNER = 288;

  { Too many posts were made to a semaphore. }
  {$EXTERNALSYM ERROR_TOO_MANY_POSTS}
  ERROR_TOO_MANY_POSTS = 298;

  { Only part of a Read/WriteProcessMemory request was completed. }
  {$EXTERNALSYM ERROR_PARTIAL_COPY}
  ERROR_PARTIAL_COPY = 299;

  { The system cannot find message for message number $%1 }
  { in message file for %2. }
  {$EXTERNALSYM ERROR_MR_MID_NOT_FOUND}
  ERROR_MR_MID_NOT_FOUND = 317;

  { Attempt to access invalid address. }
  {$EXTERNALSYM ERROR_INVALID_ADDRESS}
  ERROR_INVALID_ADDRESS = 487;

  { Arithmetic result exceeded 32 bits. }
  {$EXTERNALSYM ERROR_ARITHMETIC_OVERFLOW}
  ERROR_ARITHMETIC_OVERFLOW = 534;

  { There is a process on other end of the pipe. }
  {$EXTERNALSYM ERROR_PIPE_CONNECTED}
  ERROR_PIPE_CONNECTED = 535;

  { Waiting for a process to open the other end of the pipe. }
  {$EXTERNALSYM ERROR_PIPE_LISTENING}
  ERROR_PIPE_LISTENING = 536;

  { Access to the extended attribute was denied. }
  {$EXTERNALSYM ERROR_EA_ACCESS_DENIED}
  ERROR_EA_ACCESS_DENIED = 994;

  { The I/O operation has been aborted because of either a thread exit }
  { or an application request. }
  {$EXTERNALSYM ERROR_OPERATION_ABORTED}
  ERROR_OPERATION_ABORTED = 995;

  { Overlapped I/O event is not in a signalled state. }
  {$EXTERNALSYM ERROR_IO_INCOMPLETE}
  ERROR_IO_INCOMPLETE = 996;

  { Overlapped I/O operation is in progress. }
  {$EXTERNALSYM ERROR_IO_PENDING}
  ERROR_IO_PENDING = 997;   { dderror }

  { Invalid access to memory location. }
  {$EXTERNALSYM ERROR_NOACCESS}
  ERROR_NOACCESS = 998;

  { Error performing inpage operation. }
  {$EXTERNALSYM ERROR_SWAPERROR}
  ERROR_SWAPERROR = 999;

  { Recursion too deep, stack overflowed. }
  {$EXTERNALSYM ERROR_STACK_OVERFLOW}
  ERROR_STACK_OVERFLOW = 1001;

  { The window cannot act on the sent message. }
  {$EXTERNALSYM ERROR_INVALID_MESSAGE}
  ERROR_INVALID_MESSAGE = 1002;

  { Cannot complete this function. }
  {$EXTERNALSYM ERROR_CAN_NOT_COMPLETE}
  ERROR_CAN_NOT_COMPLETE = 1003;

  { Invalid flags. }
  {$EXTERNALSYM ERROR_INVALID_FLAGS}
  ERROR_INVALID_FLAGS = 1004;

  { The volume does not contain a recognized file system. }
  { Please make sure that all required file system drivers are loaded and that the }
  { volume is not corrupt. }
  {$EXTERNALSYM ERROR_UNRECOGNIZED_VOLUME}
  ERROR_UNRECOGNIZED_VOLUME = 1005;

  { The volume for a file has been externally altered such that the }
  { opened file is no longer valid. }
  {$EXTERNALSYM ERROR_FILE_INVALID}
  ERROR_FILE_INVALID = 1006;

  { The requested operation cannot be performed in full-screen mode. }
  {$EXTERNALSYM ERROR_FULLSCREEN_MODE}
  ERROR_FULLSCREEN_MODE = 1007;

  { An attempt was made to reference a token that does not exist. }
  {$EXTERNALSYM ERROR_NO_TOKEN}
  ERROR_NO_TOKEN = 1008;

  { The configuration registry database is corrupt. }
  {$EXTERNALSYM ERROR_BADDB}
  ERROR_BADDB = 1009;

  { The configuration registry key is invalid. }
  {$EXTERNALSYM ERROR_BADKEY}
  ERROR_BADKEY = 1010;

  { The configuration registry key could not be opened. }
  {$EXTERNALSYM ERROR_CANTOPEN}
  ERROR_CANTOPEN = 1011;

  { The configuration registry key could not be read. }
  {$EXTERNALSYM ERROR_CANTREAD}
  ERROR_CANTREAD = 1012;

  { The configuration registry key could not be written. }
  {$EXTERNALSYM ERROR_CANTWRITE}
  ERROR_CANTWRITE = 1013;

  { One of the files in the Registry database had to be recovered }
  { by use of a log or alternate copy.  The recovery was successful. }
  {$EXTERNALSYM ERROR_REGISTRY_RECOVERED}
  ERROR_REGISTRY_RECOVERED = 1014;

  { The Registry is corrupt. The structure of one of the files that contains }
  { Registry data is corrupt, or the system's image of the file in memory }
  { is corrupt, or the file could not be recovered because the alternate }
  { copy or log was absent or corrupt. }
  {$EXTERNALSYM ERROR_REGISTRY_CORRUPT}
  ERROR_REGISTRY_CORRUPT = 1015;

  { An I/O operation initiated by the Registry failed unrecoverably. }
  { The Registry could not read in, or write out, or flush, one of the files }
  { that contain the system's image of the Registry. }
  {$EXTERNALSYM ERROR_REGISTRY_IO_FAILED}
  ERROR_REGISTRY_IO_FAILED = 1016;

  { The system has attempted to load or restore a file into the Registry, but the }
  { specified file is not in a Registry file format. }
  {$EXTERNALSYM ERROR_NOT_REGISTRY_FILE}
  ERROR_NOT_REGISTRY_FILE = 1017;

  { Illegal operation attempted on a Registry key which has been marked for deletion. }
  {$EXTERNALSYM ERROR_KEY_DELETED}
  ERROR_KEY_DELETED = 1018;

  { System could not allocate the required space in a Registry log. }
  {$EXTERNALSYM ERROR_NO_LOG_SPACE}
  ERROR_NO_LOG_SPACE = 1019;

  { Cannot create a symbolic link in a Registry key that already }
  { has subkeys or values. }
  {$EXTERNALSYM ERROR_KEY_HAS_CHILDREN}
  ERROR_KEY_HAS_CHILDREN = 1020;

  { Cannot create a stable subkey under a volatile parent key. }
  {$EXTERNALSYM ERROR_CHILD_MUST_BE_VOLATILE}
  ERROR_CHILD_MUST_BE_VOLATILE = 1021;

  { A notify change request is being completed and the information }
  { is not being returned in the caller's buffer. The caller now }
  { needs to enumerate the files to find the changes. }
  {$EXTERNALSYM ERROR_NOTIFY_ENUM_DIR}
  ERROR_NOTIFY_ENUM_DIR = 1022;

  { A stop control has been sent to a service which other running services }
  { are dependent on. }
  {$EXTERNALSYM ERROR_DEPENDENT_SERVICES_RUNNING}
  ERROR_DEPENDENT_SERVICES_RUNNING = 1051;

  { The requested control is not valid for this service }
  {$EXTERNALSYM ERROR_INVALID_SERVICE_CONTROL}
  ERROR_INVALID_SERVICE_CONTROL = 1052;

  { The service did not respond to the start or control request in a timely }
  { fashion. }
  {$EXTERNALSYM ERROR_SERVICE_REQUEST_TIMEOUT}
  ERROR_SERVICE_REQUEST_TIMEOUT = 1053;

  { A thread could not be created for the service. }
  {$EXTERNALSYM ERROR_SERVICE_NO_THREAD}
  ERROR_SERVICE_NO_THREAD = 1054;

  { The service database is locked. }
  {$EXTERNALSYM ERROR_SERVICE_DATABASE_LOCKED}
  ERROR_SERVICE_DATABASE_LOCKED = 1055;

  { An instance of the service is already running. }
  {$EXTERNALSYM ERROR_SERVICE_ALREADY_RUNNING}
  ERROR_SERVICE_ALREADY_RUNNING = 1056;

  { The account name is invalid or does not exist. }
  {$EXTERNALSYM ERROR_INVALID_SERVICE_ACCOUNT}
  ERROR_INVALID_SERVICE_ACCOUNT = 1057;

  { The specified service is disabled and cannot be started. }
  {$EXTERNALSYM ERROR_SERVICE_DISABLED}
  ERROR_SERVICE_DISABLED = 1058;

  { Circular service dependency was specified. }
  {$EXTERNALSYM ERROR_CIRCULAR_DEPENDENCY}
  ERROR_CIRCULAR_DEPENDENCY = 1059;

  { The specified service does not exist as an installed service. }
  {$EXTERNALSYM ERROR_SERVICE_DOES_NOT_EXIST}
  ERROR_SERVICE_DOES_NOT_EXIST = 1060;

  { The service cannot accept control messages at this time. }
  {$EXTERNALSYM ERROR_SERVICE_CANNOT_ACCEPT_CTRL}
  ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061;

  { The service has not been started. }
  {$EXTERNALSYM ERROR_SERVICE_NOT_ACTIVE}
  ERROR_SERVICE_NOT_ACTIVE = 1062;

  { The service process could not connect to the service controller. }
  {$EXTERNALSYM ERROR_FAILED_SERVICE_CONTROLLER_}
  ERROR_FAILED_SERVICE_CONTROLLER_ = 1063;

  { An exception occurred in the service when handling the control request. }
  {$EXTERNALSYM ERROR_EXCEPTION_IN_SERVICE}
  ERROR_EXCEPTION_IN_SERVICE = 1064;

  { The database specified does not exist. }
  {$EXTERNALSYM ERROR_DATABASE_DOES_NOT_EXIST}
  ERROR_DATABASE_DOES_NOT_EXIST = 1065;

  { The service has returned a service-specific error code. }
  {$EXTERNALSYM ERROR_SERVICE_SPECIFIC_ERROR}
  ERROR_SERVICE_SPECIFIC_ERROR = 1066;

  { The process terminated unexpectedly. }
  {$EXTERNALSYM ERROR_PROCESS_ABORTED}
  ERROR_PROCESS_ABORTED = 1067;

  { The dependency service or group failed to start. }
  {$EXTERNALSYM ERROR_SERVICE_DEPENDENCY_FAIL}
  ERROR_SERVICE_DEPENDENCY_FAIL = 1068;

  { The service did not start due to a logon failure. }
  {$EXTERNALSYM ERROR_SERVICE_LOGON_FAILED}
  ERROR_SERVICE_LOGON_FAILED = 1069;

  { After starting, the service hung in a start-pending state. }
  {$EXTERNALSYM ERROR_SERVICE_START_HANG}
  ERROR_SERVICE_START_HANG = 1070;

  { The specified service database lock is invalid. }
  {$EXTERNALSYM ERROR_INVALID_SERVICE_LOCK}
  ERROR_INVALID_SERVICE_LOCK = 1071;

  { The specified service has been marked for deletion. }
  {$EXTERNALSYM ERROR_SERVICE_MARKED_FOR_DELETE}
  ERROR_SERVICE_MARKED_FOR_DELETE = 1072;

  { The specified service already exists. }
  {$EXTERNALSYM ERROR_SERVICE_EXISTS}
  ERROR_SERVICE_EXISTS = 1073;

  { The system is currently running with the last-known-good configuration. }
  {$EXTERNALSYM ERROR_ALREADY_RUNNING_LKG}
  ERROR_ALREADY_RUNNING_LKG = 1074;

  { The dependency service does not exist or has been marked for }
  { deletion. }
  {$EXTERNALSYM ERROR_SERVICE_DEPENDENCY_DELETED}
  ERROR_SERVICE_DEPENDENCY_DELETED = 1075;

  { The current boot has already been accepted for use as the }
  { last-known-good control set. }
  {$EXTERNALSYM ERROR_BOOT_ALREADY_ACCEPTED}
  ERROR_BOOT_ALREADY_ACCEPTED = 1076;

  { No attempts to start the service have been made since the last boot. }
  {$EXTERNALSYM ERROR_SERVICE_NEVER_STARTED}
  ERROR_SERVICE_NEVER_STARTED = 1077;

  { The name is already in use as either a service name or a service display }
  { name. }
  {$EXTERNALSYM ERROR_DUPLICATE_SERVICE_NAME}
  ERROR_DUPLICATE_SERVICE_NAME = 1078;

  {  The account specified for this service is different from the account }
  {  specified for other services running in the same process. }
  {$EXTERNALSYM ERROR_DIFFERENT_SERVICE_ACCOUNT}
  ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079;

  { The physical end of the tape has been reached. }
  {$EXTERNALSYM ERROR_END_OF_MEDIA}
  ERROR_END_OF_MEDIA = 1100;

  { A tape access reached a filemark. }
  {$EXTERNALSYM ERROR_FILEMARK_DETECTED}
  ERROR_FILEMARK_DETECTED = 1101;

  { Beginning of tape or partition was encountered. }
  {$EXTERNALSYM ERROR_BEGINNING_OF_MEDIA}
  ERROR_BEGINNING_OF_MEDIA = 1102;

  { A tape access reached the end of a set of files. }
  {$EXTERNALSYM ERROR_SETMARK_DETECTED}
  ERROR_SETMARK_DETECTED = 1103;

  { No more data is on the tape. }
  {$EXTERNALSYM ERROR_NO_DATA_DETECTED}
  ERROR_NO_DATA_DETECTED = 1104;

  { Tape could not be partitioned. }
  {$EXTERNALSYM ERROR_PARTITION_FAILURE}
  ERROR_PARTITION_FAILURE = 1105;

  { When accessing a new tape of a multivolume partition, the current }
  { blocksize is incorrect. }
  {$EXTERNALSYM ERROR_INVALID_BLOCK_LENGTH}
  ERROR_INVALID_BLOCK_LENGTH = 1106;

  { Tape partition information could not be found when loading a tape. }
  {$EXTERNALSYM ERROR_DEVICE_NOT_PARTITIONED}
  ERROR_DEVICE_NOT_PARTITIONED = 1107;

  { Unable to lock the media eject mechanism. }
  {$EXTERNALSYM ERROR_UNABLE_TO_LOCK_MEDIA}
  ERROR_UNABLE_TO_LOCK_MEDIA = 1108;

  { Unable to unload the media. }
  {$EXTERNALSYM ERROR_UNABLE_TO_UNLOAD_MEDIA}
  ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109;

  { Media in drive may have changed. }
  {$EXTERNALSYM ERROR_MEDIA_CHANGED}
  ERROR_MEDIA_CHANGED = 1110;

  { The I/O bus was reset. }
  {$EXTERNALSYM ERROR_BUS_RESET}
  ERROR_BUS_RESET = 1111;

  { No media in drive. }
  {$EXTERNALSYM ERROR_NO_MEDIA_IN_DRIVE}
  ERROR_NO_MEDIA_IN_DRIVE = 1112;

  { No mapping for the Unicode character exists in the target multi-byte code page. }
  {$EXTERNALSYM ERROR_NO_UNICODE_TRANSLATION}
  ERROR_NO_UNICODE_TRANSLATION = 1113;

  { A dynamic link library (DLL) initialization routine failed. }
  {$EXTERNALSYM ERROR_DLL_INIT_FAILED}
  ERROR_DLL_INIT_FAILED = 1114;

  { A system shutdown is in progress. }
  {$EXTERNALSYM ERROR_SHUTDOWN_IN_PROGRESS}
  ERROR_SHUTDOWN_IN_PROGRESS = 1115;

  { Unable to abort the system shutdown because no shutdown was in progress. }
  {$EXTERNALSYM ERROR_NO_SHUTDOWN_IN_PROGRESS}
  ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116;

  { The request could not be performed because of an I/O device error. }
  {$EXTERNALSYM ERROR_IO_DEVICE}
  ERROR_IO_DEVICE = 1117;

  { No serial device was successfully initialized.  The serial driver will unload. }
  {$EXTERNALSYM ERROR_SERIAL_NO_DEVICE}
  ERROR_SERIAL_NO_DEVICE = 1118;

  { Unable to open a device that was sharing an interrupt request (IRQ) }
  { with other devices. At least one other device that uses that IRQ }
  { was already opened. }
  {$EXTERNALSYM ERROR_IRQ_BUSY}
  ERROR_IRQ_BUSY = 1119;

  { A serial I/O operation was completed by another write to the serial port. }
  { (The IOCTL_SERIAL_XOFF_COUNTER reached zero.) }
  {$EXTERNALSYM ERROR_MORE_WRITES}
  ERROR_MORE_WRITES = 1120;

  { A serial I/O operation completed because the time-out period expired. }
  { (The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.) }
  {$EXTERNALSYM ERROR_COUNTER_TIMEOUT}
  ERROR_COUNTER_TIMEOUT = 1121;

  { No ID address mark was found on the floppy disk. }
  {$EXTERNALSYM ERROR_FLOPPY_ID_MARK_NOT_FOUND}
  ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122;

  { Mismatch between the floppy disk sector ID field and the floppy disk }
  { controller track address. }
  {$EXTERNALSYM ERROR_FLOPPY_WRONG_CYLINDER}
  ERROR_FLOPPY_WRONG_CYLINDER = 1123;

  { The floppy disk controller reported an error that is not recognized }
  { by the floppy disk driver. }
  {$EXTERNALSYM ERROR_FLOPPY_UNKNOWN_ERROR}
  ERROR_FLOPPY_UNKNOWN_ERROR = 1124;

  { The floppy disk controller returned inconsistent results in its registers. }
  {$EXTERNALSYM ERROR_FLOPPY_BAD_REGISTERS}
  ERROR_FLOPPY_BAD_REGISTERS = 1125;

  { While accessing the hard disk, a recalibrate operation failed, even after retries. }
  {$EXTERNALSYM ERROR_DISK_RECALIBRATE_FAILED}
  ERROR_DISK_RECALIBRATE_FAILED = 1126;

  { While accessing the hard disk, a disk operation failed even after retries. }
  {$EXTERNALSYM ERROR_DISK_OPERATION_FAILED}
  ERROR_DISK_OPERATION_FAILED = 1127;

  { While accessing the hard disk, a disk controller reset was needed, but }
  { even that failed. }
  {$EXTERNALSYM ERROR_DISK_RESET_FAILED}
  ERROR_DISK_RESET_FAILED = 1128;

  { Physical end of tape encountered. }
  {$EXTERNALSYM ERROR_EOM_OVERFLOW}
  ERROR_EOM_OVERFLOW = 1129;

  { Not enough server storage is available to process this command. }
  {$EXTERNALSYM ERROR_NOT_ENOUGH_SERVER_MEMORY}
  ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130;

  { A potential deadlock condition has been detected. }
  {$EXTERNALSYM ERROR_POSSIBLE_DEADLOCK}
  ERROR_POSSIBLE_DEADLOCK = 1131;

  { The base address or the file offset specified does not have the proper }
  { alignment. }
  {$EXTERNALSYM ERROR_MAPPED_ALIGNMENT}
  ERROR_MAPPED_ALIGNMENT = 1132;

  { An attempt to change the system power state was vetoed by another }
  { application or driver. }
  {$EXTERNALSYM ERROR_SET_POWER_STATE_VETOED}
  ERROR_SET_POWER_STATE_VETOED = 1140;

  { The system BIOS failed an attempt to change the system power state. }
  {$EXTERNALSYM ERROR_SET_POWER_STATE_FAILED}
  ERROR_SET_POWER_STATE_FAILED = 1141;

  {  An attempt was made to create more links on a file than }
  {  the file system supports. }
  {$EXTERNALSYM ERROR_TOO_MANY_LINKS}
  ERROR_TOO_MANY_LINKS = 1142;

  { The specified program requires a newer version of Windows. }
  {$EXTERNALSYM ERROR_OLD_WIN_VERSION}
  ERROR_OLD_WIN_VERSION = 1150;

  { The specified program is not a Windows or MS-DOS program. }
  {$EXTERNALSYM ERROR_APP_WRONG_OS}
  ERROR_APP_WRONG_OS = 1151;

  { Cannot start more than one instance of the specified program. }
  {$EXTERNALSYM ERROR_SINGLE_INSTANCE_APP}
  ERROR_SINGLE_INSTANCE_APP = 1152;

  {  The specified program was written for an older version of Windows. }
  {$EXTERNALSYM ERROR_RMODE_APP}
  ERROR_RMODE_APP = 1153;

  { One of the library files needed to run this application is damaged. }
  {$EXTERNALSYM ERROR_INVALID_DLL}
  ERROR_INVALID_DLL = 1154;

  { No application is associated with the specified file for this operation. }
  {$EXTERNALSYM ERROR_NO_ASSOCIATION}
  ERROR_NO_ASSOCIATION = 1155;

  { An error occurred in sending the command to the application. }
  {$EXTERNALSYM ERROR_DDE_FAIL}
  ERROR_DDE_FAIL = 1156;

  { One of the library files needed to run this application cannot be found. }
  {$EXTERNALSYM ERROR_DLL_NOT_FOUND}
  ERROR_DLL_NOT_FOUND = 1157;


{ Winnet32 Status Codes }

  { The specified username is invalid. }
  {$EXTERNALSYM ERROR_BAD_USERNAME}
  ERROR_BAD_USERNAME = 2202;

  { This network connection does not exist. }
  {$EXTERNALSYM ERROR_NOT_CONNECTED}
  ERROR_NOT_CONNECTED = 2250;

  { This network connection has files open or requests pending. }
  {$EXTERNALSYM ERROR_OPEN_FILES}
  ERROR_OPEN_FILES = 2401;

  { Active connections still exist. }
  {$EXTERNALSYM ERROR_ACTIVE_CONNECTIONS}
  ERROR_ACTIVE_CONNECTIONS = 2402;

  { The device is in use by an active process and cannot be disconnected. }
  {$EXTERNALSYM ERROR_DEVICE_IN_USE}
  ERROR_DEVICE_IN_USE = 2404;

  { The specified device name is invalid. }
  {$EXTERNALSYM ERROR_BAD_DEVICE}
  ERROR_BAD_DEVICE = 1200;

  { The device is not currently connected but it is a remembered connection. }
  {$EXTERNALSYM ERROR_CONNECTION_UNAVAIL}
  ERROR_CONNECTION_UNAVAIL = 1201;

  { An attempt was made to remember a device that had previously been remembered. }
  {$EXTERNALSYM ERROR_DEVICE_ALREADY_REMEMBERED}
  ERROR_DEVICE_ALREADY_REMEMBERED = 1202;

  { No network provider accepted the given network path. }
  {$EXTERNALSYM ERROR_NO_NET_OR_BAD_PATH}
  ERROR_NO_NET_OR_BAD_PATH = 1203;

  { The specified network provider name is invalid. }
  {$EXTERNALSYM ERROR_BAD_PROVIDER}
  ERROR_BAD_PROVIDER = 1204;

  { Unable to open the network connection profile. }
  {$EXTERNALSYM ERROR_CANNOT_OPEN_PROFILE}
  ERROR_CANNOT_OPEN_PROFILE = 1205;

  { The network connection profile is corrupt. }
  {$EXTERNALSYM ERROR_BAD_PROFILE}
  ERROR_BAD_PROFILE = 1206;

  { Cannot enumerate a non-container. }
  {$EXTERNALSYM ERROR_NOT_CONTAINER}
  ERROR_NOT_CONTAINER = 1207;

  { An extended error has occurred. }
  {$EXTERNALSYM ERROR_EXTENDED_ERROR}
  ERROR_EXTENDED_ERROR = 1208;

  { The format of the specified group name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_GROUPNAME}
  ERROR_INVALID_GROUPNAME = 1209;

  { The format of the specified computer name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_COMPUTERNAME}
  ERROR_INVALID_COMPUTERNAME = 1210;

  { The format of the specified event name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_EVENTNAME}
  ERROR_INVALID_EVENTNAME = 1211;

  { The format of the specified domain name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_DOMAINNAME}
  ERROR_INVALID_DOMAINNAME = 1212;

  { The format of the specified service name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_SERVICENAME}
  ERROR_INVALID_SERVICENAME = 1213;

  { The format of the specified network name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_NETNAME}
  ERROR_INVALID_NETNAME = 1214;

  { The format of the specified share name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_SHARENAME}
  ERROR_INVALID_SHARENAME = 1215;

  { The format of the specified password is invalid. }
  {$EXTERNALSYM ERROR_INVALID_PASSWORDNAME}
  ERROR_INVALID_PASSWORDNAME = 1216;

  { The format of the specified message name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_MESSAGENAME}
  ERROR_INVALID_MESSAGENAME = 1217;

  { The format of the specified message destination is invalid. }
  {$EXTERNALSYM ERROR_INVALID_MESSAGEDEST}
  ERROR_INVALID_MESSAGEDEST = 1218;

  { The credentials supplied conflict with an existing set of credentials. }
  {$EXTERNALSYM ERROR_SESSION_CREDENTIAL_CONFLICT}
  ERROR_SESSION_CREDENTIAL_CONFLICT = 1219;

  { An attempt was made to establish a session to a network server, but there }
  { are already too many sessions established to that server. }
  {$EXTERNALSYM ERROR_REMOTE_SESSION_LIMIT_EXCEEDED}
  ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220;

  { The workgroup or domain name is already in use by another computer on the }
  { network. }
  {$EXTERNALSYM ERROR_DUP_DOMAINNAME}
  ERROR_DUP_DOMAINNAME = 1221;

  { The network is not present or not started. }
  {$EXTERNALSYM ERROR_NO_NETWORK}
  ERROR_NO_NETWORK = 1222;

  { The operation was cancelled by the user. }
  {$EXTERNALSYM ERROR_CANCELLED}
  ERROR_CANCELLED = 1223;

  { The requested operation cannot be performed on a file with a user mapped section open. }
  {$EXTERNALSYM ERROR_USER_MAPPED_FILE}
  ERROR_USER_MAPPED_FILE = 1224;

  { The remote system refused the network connection. }
  {$EXTERNALSYM ERROR_CONNECTION_REFUSED}
  ERROR_CONNECTION_REFUSED = 1225;

  { The network connection was gracefully closed. }
  {$EXTERNALSYM ERROR_GRACEFUL_DISCONNECT}
  ERROR_GRACEFUL_DISCONNECT = 1226;

  { The network transport endpoint already has an address associated with it. }
  {$EXTERNALSYM ERROR_ADDRESS_ALREADY_ASSOCIATED}
  ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227;

  { An address has not yet been associated with the network endpoint. }
  {$EXTERNALSYM ERROR_ADDRESS_NOT_ASSOCIATED}
  ERROR_ADDRESS_NOT_ASSOCIATED = 1228;

  { An operation was attempted on a non-existent network connection. }
  {$EXTERNALSYM ERROR_CONNECTION_INVALID}
  ERROR_CONNECTION_INVALID = 1229;

  { An invalid operation was attempted on an active network connection. }
  {$EXTERNALSYM ERROR_CONNECTION_ACTIVE}
  ERROR_CONNECTION_ACTIVE = 1230;

  { The remote network is not reachable by the transport. }
  {$EXTERNALSYM ERROR_NETWORK_UNREACHABLE}
  ERROR_NETWORK_UNREACHABLE = 1231;

  { The remote system is not reachable by the transport. }
  {$EXTERNALSYM ERROR_HOST_UNREACHABLE}
  ERROR_HOST_UNREACHABLE = 1232;

  { The remote system does not support the transport protocol. }
  {$EXTERNALSYM ERROR_PROTOCOL_UNREACHABLE}
  ERROR_PROTOCOL_UNREACHABLE = 1233;

  { No service is operating at the destination network endpoint }
  { on the remote system. }
  {$EXTERNALSYM ERROR_PORT_UNREACHABLE}
  ERROR_PORT_UNREACHABLE = 1234;

  { The request was aborted. }
  {$EXTERNALSYM ERROR_REQUEST_ABORTED}
  ERROR_REQUEST_ABORTED = 1235;

  { The network connection was aborted by the local system. }
  {$EXTERNALSYM ERROR_CONNECTION_ABORTED}
  ERROR_CONNECTION_ABORTED = 1236;

  { The operation could not be completed.  A retry should be performed. }
  {$EXTERNALSYM ERROR_RETRY}
  ERROR_RETRY = 1237;

  { A connection to the server could not be made because the limit on the number of }
  { concurrent connections for this account has been reached. }
  {$EXTERNALSYM ERROR_CONNECTION_COUNT_LIMIT}
  ERROR_CONNECTION_COUNT_LIMIT = 1238;

  { Attempting to login during an unauthorized time of day for this account. }
  {$EXTERNALSYM ERROR_LOGIN_TIME_RESTRICTION}
  ERROR_LOGIN_TIME_RESTRICTION = 1239;

  { The account is not authorized to login from this station. }
  {$EXTERNALSYM ERROR_LOGIN_WKSTA_RESTRICTION}
  ERROR_LOGIN_WKSTA_RESTRICTION = 1240;

  { The network address could not be used for the operation requested. }
  {$EXTERNALSYM ERROR_INCORRECT_ADDRESS}
  ERROR_INCORRECT_ADDRESS = 1241;

  { The service is already registered. }
  {$EXTERNALSYM ERROR_ALREADY_REGISTERED}
  ERROR_ALREADY_REGISTERED = 1242;

  { The specified service does not exist. }
  {$EXTERNALSYM ERROR_SERVICE_NOT_FOUND}
  ERROR_SERVICE_NOT_FOUND = 1243;

  { The operation being requested was not performed because the user }
  { has not been authenticated. }
  {$EXTERNALSYM ERROR_NOT_AUTHENTICATED}
  ERROR_NOT_AUTHENTICATED = 1244;

  { The operation being requested was not performed because the user }
  { has not logged on to the network. }
  { The specified service does not exist. }
  {$EXTERNALSYM ERROR_NOT_LOGGED_ON}
  ERROR_NOT_LOGGED_ON = 1245;

  { Return that wants caller to continue with work in progress. }
  {$EXTERNALSYM ERROR_CONTINUE}
  ERROR_CONTINUE = 1246;

  { An attempt was made to perform an initialization operation when }
  { initialization has already been completed. }
  {$EXTERNALSYM ERROR_ALREADY_INITIALIZED}
  ERROR_ALREADY_INITIALIZED = 1247;

  { No more local devices. }
  {$EXTERNALSYM ERROR_NO_MORE_DEVICES}
  ERROR_NO_MORE_DEVICES = 1248;


{ Security Status Codes }

  { Not all privileges referenced are assigned to the caller. }
  {$EXTERNALSYM ERROR_NOT_ALL_ASSIGNED}
  ERROR_NOT_ALL_ASSIGNED = 1300;

  { Some mapping between account names and security IDs was not done. }
  {$EXTERNALSYM ERROR_SOME_NOT_MAPPED}
  ERROR_SOME_NOT_MAPPED = 1301;

  { No system quota limits are specifically set for this account. }
  {$EXTERNALSYM ERROR_NO_QUOTAS_FOR_ACCOUNT}
  ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302;

  { No encryption key is available.  A well-known encryption key was returned. }
  {$EXTERNALSYM ERROR_LOCAL_USER_SESSION_KEY}
  ERROR_LOCAL_USER_SESSION_KEY = 1303;

  { The NT password is too complex to be converted to a LAN Manager }
  { password.  The LAN Manager password returned is a NULL string. }
  {$EXTERNALSYM ERROR_NULL_LM_PASSWORD}
  ERROR_NULL_LM_PASSWORD = 1304;

  { The revision level is unknown. }
  {$EXTERNALSYM ERROR_UNKNOWN_REVISION}
  ERROR_UNKNOWN_REVISION = 1305;

  { Indicates two revision levels are incompatible. }
  {$EXTERNALSYM ERROR_REVISION_MISMATCH}
  ERROR_REVISION_MISMATCH = 1306;

  { This security ID may not be assigned as the owner of this object. }
  {$EXTERNALSYM ERROR_INVALID_OWNER}
  ERROR_INVALID_OWNER = 1307;

  { This security ID may not be assigned as the primary group of an object. }
  {$EXTERNALSYM ERROR_INVALID_PRIMARY_GROUP}
  ERROR_INVALID_PRIMARY_GROUP = 1308;

  { An attempt has been made to operate on an impersonation token }

  { by a thread that is not currently impersonating a client. }
  {$EXTERNALSYM ERROR_NO_IMPERSONATION_TOKEN}
  ERROR_NO_IMPERSONATION_TOKEN = 1309;

  { The group may not be disabled. }
  {$EXTERNALSYM ERROR_CANT_DISABLE_MANDATORY}
  ERROR_CANT_DISABLE_MANDATORY = 1310;

  { There are currently no logon servers available to service the logon }
  { request. }
  {$EXTERNALSYM ERROR_NO_LOGON_SERVERS}
  ERROR_NO_LOGON_SERVERS = 1311;

  {  A specified logon session does not exist.  It may already have }
  {  been terminated. }
  {$EXTERNALSYM ERROR_NO_SUCH_LOGON_SESSION}
  ERROR_NO_SUCH_LOGON_SESSION = 1312;

  {  A specified privilege does not exist. }
  {$EXTERNALSYM ERROR_NO_SUCH_PRIVILEGE}
  ERROR_NO_SUCH_PRIVILEGE = 1313;

  {  A required privilege is not held by the client. }
  {$EXTERNALSYM ERROR_PRIVILEGE_NOT_HELD}
  ERROR_PRIVILEGE_NOT_HELD = 1314;

  { The name provided is not a properly formed account name. }
  {$EXTERNALSYM ERROR_INVALID_ACCOUNT_NAME}
  ERROR_INVALID_ACCOUNT_NAME = 1315;

  { The specified user already exists. }
  {$EXTERNALSYM ERROR_USER_EXISTS}
  ERROR_USER_EXISTS = 1316;

  { The specified user does not exist. }
  {$EXTERNALSYM ERROR_NO_SUCH_USER}
  ERROR_NO_SUCH_USER = 1317;

  { The specified group already exists. }
  {$EXTERNALSYM ERROR_GROUP_EXISTS}
  ERROR_GROUP_EXISTS = 1318;

  { The specified group does not exist. }
  {$EXTERNALSYM ERROR_NO_SUCH_GROUP}
  ERROR_NO_SUCH_GROUP = 1319;

  { Either the specified user account is already a member of the specified }
  { group, or the specified group cannot be deleted because it contains }
  { a member. }
  {$EXTERNALSYM ERROR_MEMBER_IN_GROUP}
  ERROR_MEMBER_IN_GROUP = 1320;

  { The specified user account is not a member of the specified group account. }
  {$EXTERNALSYM ERROR_MEMBER_NOT_IN_GROUP}
  ERROR_MEMBER_NOT_IN_GROUP = 1321;

  { The last remaining administration account cannot be disabled }
  { or deleted. }
  {$EXTERNALSYM ERROR_LAST_ADMIN}
  ERROR_LAST_ADMIN = 1322;

  { Unable to update the password.  The value provided as the current }
  { password is incorrect. }
  {$EXTERNALSYM ERROR_WRONG_PASSWORD}
  ERROR_WRONG_PASSWORD = 1323;

  { Unable to update the password.  The value provided for the new password }
  { contains values that are not allowed in passwords. }
  {$EXTERNALSYM ERROR_ILL_FORMED_PASSWORD}
  ERROR_ILL_FORMED_PASSWORD = 1324;

  { Unable to update the password because a password update rule has been }
  { violated. }
  {$EXTERNALSYM ERROR_PASSWORD_RESTRICTION}
  ERROR_PASSWORD_RESTRICTION = 1325;

  { Logon failure: unknown user name or bad password. }
  {$EXTERNALSYM ERROR_LOGON_FAILURE}
  ERROR_LOGON_FAILURE = 1326;

  { Logon failure: user account restriction. }
  {$EXTERNALSYM ERROR_ACCOUNT_RESTRICTION}
  ERROR_ACCOUNT_RESTRICTION = 1327;

  { Logon failure: account logon time restriction violation. }
  {$EXTERNALSYM ERROR_INVALID_LOGON_HOURS}
  ERROR_INVALID_LOGON_HOURS = 1328;

  { Logon failure: user not allowed to log on to this computer. }
  {$EXTERNALSYM ERROR_INVALID_WORKSTATION}
  ERROR_INVALID_WORKSTATION = 1329;

  { Logon failure: the specified account password has expired. }
  {$EXTERNALSYM ERROR_PASSWORD_EXPIRED}
  ERROR_PASSWORD_EXPIRED = 1330;

  { Logon failure: account currently disabled. }
  {$EXTERNALSYM ERROR_ACCOUNT_DISABLED}
  ERROR_ACCOUNT_DISABLED = 1331;

  { No mapping between account names and security IDs was done. }
  {$EXTERNALSYM ERROR_NONE_MAPPED}
  ERROR_NONE_MAPPED = 1332;

  { Too many local user identifiers (LUIDs) were requested at one time. }
  {$EXTERNALSYM ERROR_TOO_MANY_LUIDS_REQUESTED}
  ERROR_TOO_MANY_LUIDS_REQUESTED = 1333;

  { No more local user identifiers (LUIDs) are available. }
  {$EXTERNALSYM ERROR_LUIDS_EXHAUSTED}
  ERROR_LUIDS_EXHAUSTED = 1334;

  { The subauthority part of a security ID is invalid for this particular use. }
  {$EXTERNALSYM ERROR_INVALID_SUB_AUTHORITY}
  ERROR_INVALID_SUB_AUTHORITY = 1335;

  { The access control list (ACL) structure is invalid. }
  {$EXTERNALSYM ERROR_INVALID_ACL}
  ERROR_INVALID_ACL = 1336;

  { The security ID structure is invalid. }
  {$EXTERNALSYM ERROR_INVALID_SID}
  ERROR_INVALID_SID = 1337;

  { The security descriptor structure is invalid. }
  {$EXTERNALSYM ERROR_INVALID_SECURITY_DESCR}
  ERROR_INVALID_SECURITY_DESCR = 1338;

  { The inherited access control list (ACL) or access control entry (ACE) }
  { could not be built. }
  {$EXTERNALSYM ERROR_BAD_INHERITANCE_ACL}
  ERROR_BAD_INHERITANCE_ACL = 1340;

  { The server is currently disabled. }
  {$EXTERNALSYM ERROR_SERVER_DISABLED}
  ERROR_SERVER_DISABLED = 1341;

  { The server is currently enabled. }
  {$EXTERNALSYM ERROR_SERVER_NOT_DISABLED}
  ERROR_SERVER_NOT_DISABLED = 1342;

  { The value provided was an invalid value for an identifier authority. }
  {$EXTERNALSYM ERROR_INVALID_ID_AUTHORITY}
  ERROR_INVALID_ID_AUTHORITY = 1343;

  { No more memory is available for security information updates. }
  {$EXTERNALSYM ERROR_ALLOTTED_SPACE_EXCEEDED}
  ERROR_ALLOTTED_SPACE_EXCEEDED = 1344;

  { The specified attributes are invalid, or incompatible with the }

  { attributes for the group as a whole. }
  {$EXTERNALSYM ERROR_INVALID_GROUP_ATTRIBUTES}
  ERROR_INVALID_GROUP_ATTRIBUTES = 1345;

  { Either a required impersonation level was not provided, or the }
  { provided impersonation level is invalid. }
  {$EXTERNALSYM ERROR_BAD_IMPERSONATION_LEVEL}
  ERROR_BAD_IMPERSONATION_LEVEL = 1346;

  { Cannot open an anonymous level security token. }
  {$EXTERNALSYM ERROR_CANT_OPEN_ANONYMOUS}
  ERROR_CANT_OPEN_ANONYMOUS = 1347;

  { The validation information class requested was invalid. }
  {$EXTERNALSYM ERROR_BAD_VALIDATION_CLASS}
  ERROR_BAD_VALIDATION_CLASS = 1348;

  { The type of the token is inappropriate for its attempted use. }
  {$EXTERNALSYM ERROR_BAD_TOKEN_TYPE}
  ERROR_BAD_TOKEN_TYPE = 1349;

  { Unable to perform a security operation on an object }
  { which has no associated security. }
  {$EXTERNALSYM ERROR_NO_SECURITY_ON_OBJECT}
  ERROR_NO_SECURITY_ON_OBJECT = 1350;

  { Indicates a Windows NT Server could not be contacted or that }
  { objects within the domain are protected such that necessary }
  { information could not be retrieved. }
  {$EXTERNALSYM ERROR_CANT_ACCESS_DOMAIN_INFO}
  ERROR_CANT_ACCESS_DOMAIN_INFO = 1351;

  { The security account manager (SAM) or local security }
  { authority (LSA) server was in the wrong state to perform }
  { the security operation. }
  {$EXTERNALSYM ERROR_INVALID_SERVER_STATE}
  ERROR_INVALID_SERVER_STATE = 1352;

  { The domain was in the wrong state to perform the security operation. }
  {$EXTERNALSYM ERROR_INVALID_DOMAIN_STATE}
  ERROR_INVALID_DOMAIN_STATE = 1353;

  { This operation is only allowed for the Primary Domain Controller of the domain. }
  {$EXTERNALSYM ERROR_INVALID_DOMAIN_ROLE}
  ERROR_INVALID_DOMAIN_ROLE = 1354;

  { The specified domain did not exist. }
  {$EXTERNALSYM ERROR_NO_SUCH_DOMAIN}
  ERROR_NO_SUCH_DOMAIN = 1355;

  { The specified domain already exists. }
  {$EXTERNALSYM ERROR_DOMAIN_EXISTS}
  ERROR_DOMAIN_EXISTS = 1356;

  { An attempt was made to exceed the limit on the number of domains per server. }
  {$EXTERNALSYM ERROR_DOMAIN_LIMIT_EXCEEDED}
  ERROR_DOMAIN_LIMIT_EXCEEDED = 1357;

  { Unable to complete the requested operation because of either a }
  { catastrophic media failure or a data structure corruption on the disk. }
  {$EXTERNALSYM ERROR_INTERNAL_DB_CORRUPTION}
  ERROR_INTERNAL_DB_CORRUPTION = 1358;

  { The security account database contains an internal inconsistency. }
  {$EXTERNALSYM ERROR_INTERNAL_ERROR}
  ERROR_INTERNAL_ERROR = 1359;

  { Generic access types were contained in an access mask which should }
  { already be mapped to non-generic types. }
  {$EXTERNALSYM ERROR_GENERIC_NOT_MAPPED}
  ERROR_GENERIC_NOT_MAPPED = 1360;

  { A security descriptor is not in the right format (absolute or self-relative). }
  {$EXTERNALSYM ERROR_BAD_DESCRIPTOR_FORMAT}
  ERROR_BAD_DESCRIPTOR_FORMAT = 1361;

  { The requested action is restricted for use by logon processes }
  { only.  The calling process has not registered as a logon process. }
  {$EXTERNALSYM ERROR_NOT_LOGON_PROCESS}
  ERROR_NOT_LOGON_PROCESS = 1362;

  { Cannot start a new logon session with an ID that is already in use. }
  {$EXTERNALSYM ERROR_LOGON_SESSION_EXISTS}
  ERROR_LOGON_SESSION_EXISTS = 1363;

  { A specified authentication package is unknown. }
  {$EXTERNALSYM ERROR_NO_SUCH_PACKAGE}
  ERROR_NO_SUCH_PACKAGE = 1364;

  { The logon session is not in a state that is consistent with the }
  { requested operation. }
  {$EXTERNALSYM ERROR_BAD_LOGON_SESSION_STATE}
  ERROR_BAD_LOGON_SESSION_STATE = 1365;

  { The logon session ID is already in use. }
  {$EXTERNALSYM ERROR_LOGON_SESSION_COLLISION}
  ERROR_LOGON_SESSION_COLLISION = 1366;

  { A logon request contained an invalid logon type value. }
  {$EXTERNALSYM ERROR_INVALID_LOGON_TYPE}
  ERROR_INVALID_LOGON_TYPE = 1367;

  { Unable to impersonate via a named pipe until data has been read }
  { from that pipe. }
  {$EXTERNALSYM ERROR_CANNOT_IMPERSONATE}
  ERROR_CANNOT_IMPERSONATE = 1368;

  { The transaction state of a Registry subtree is incompatible with the }
  { requested operation. }
  {$EXTERNALSYM ERROR_RXACT_INVALID_STATE}
  ERROR_RXACT_INVALID_STATE = 1369;

  { An internal security database corruption has been encountered. }
  {$EXTERNALSYM ERROR_RXACT_COMMIT_FAILURE}
  ERROR_RXACT_COMMIT_FAILURE = 1370;

  { Cannot perform this operation on built-in accounts. }
  {$EXTERNALSYM ERROR_SPECIAL_ACCOUNT}
  ERROR_SPECIAL_ACCOUNT = 1371;

  { Cannot perform this operation on this built-in special group. }
  {$EXTERNALSYM ERROR_SPECIAL_GROUP}
  ERROR_SPECIAL_GROUP = 1372;

  { Cannot perform this operation on this built-in special user. }
  {$EXTERNALSYM ERROR_SPECIAL_USER}
  ERROR_SPECIAL_USER = 1373;

  { The user cannot be removed from a group because the group }
  { is currently the user's primary group. }
  {$EXTERNALSYM ERROR_MEMBERS_PRIMARY_GROUP}
  ERROR_MEMBERS_PRIMARY_GROUP = 1374;

  { The token is already in use as a primary token. }
  {$EXTERNALSYM ERROR_TOKEN_ALREADY_IN_USE}
  ERROR_TOKEN_ALREADY_IN_USE = 1375;

  { The specified local group does not exist. }
  {$EXTERNALSYM ERROR_NO_SUCH_ALIAS}
  ERROR_NO_SUCH_ALIAS = 1376;

  { The specified account name is not a member of the local group. }
  {$EXTERNALSYM ERROR_MEMBER_NOT_IN_ALIAS}
  ERROR_MEMBER_NOT_IN_ALIAS = 1377;

  { The specified account name is already a member of the local group. }
  {$EXTERNALSYM ERROR_MEMBER_IN_ALIAS}
  ERROR_MEMBER_IN_ALIAS = 1378;

  { The specified local group already exists. }
  {$EXTERNALSYM ERROR_ALIAS_EXISTS}
  ERROR_ALIAS_EXISTS = 1379;

  { Logon failure: the user has not been granted the requested }
  { logon type at this computer. }
  {$EXTERNALSYM ERROR_LOGON_NOT_GRANTED}
  ERROR_LOGON_NOT_GRANTED = 1380;

  { The maximum number of secrets that may be stored in a single system has been }
  { exceeded. }
  {$EXTERNALSYM ERROR_TOO_MANY_SECRETS}
  ERROR_TOO_MANY_SECRETS = 1381;

  { The length of a secret exceeds the maximum length allowed. }
  {$EXTERNALSYM ERROR_SECRET_TOO_LONG}
  ERROR_SECRET_TOO_LONG = 1382;

  { The local security authority database contains an internal inconsistency. }
  {$EXTERNALSYM ERROR_INTERNAL_DB_ERROR}
  ERROR_INTERNAL_DB_ERROR = 1383;

  { During a logon attempt, the user's security context accumulated too many }
  { security IDs. }
  {$EXTERNALSYM ERROR_TOO_MANY_CONTEXT_IDS}
  ERROR_TOO_MANY_CONTEXT_IDS = 1384;

  { Logon failure: the user has not been granted the requested logon type }
  { at this computer. }
  {$EXTERNALSYM ERROR_LOGON_TYPE_NOT_GRANTED}
  ERROR_LOGON_TYPE_NOT_GRANTED = 1385;

  { A cross-encrypted password is necessary to change a user password. }
  {$EXTERNALSYM ERROR_NT_CROSS_ENCRYPTION_REQUIRED}
  ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386;

  { A new member could not be added to a local group because the member does }
  { not exist. }
  {$EXTERNALSYM ERROR_NO_SUCH_MEMBER}
  ERROR_NO_SUCH_MEMBER = 1387;

  { A new member could not be added to a local group because the member has the }
  { wrong account type. }
  {$EXTERNALSYM ERROR_INVALID_MEMBER}
  ERROR_INVALID_MEMBER = 1388;

  { Too many security IDs have been specified. }
  {$EXTERNALSYM ERROR_TOO_MANY_SIDS}
  ERROR_TOO_MANY_SIDS = 1389;

  { A cross-encrypted password is necessary to change this user password. }
  {$EXTERNALSYM ERROR_LM_CROSS_ENCRYPTION_REQUIRED}
  ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390;

  { Indicates an TACL contains no inheritable components }
  {$EXTERNALSYM ERROR_NO_INHERITANCE}
  ERROR_NO_INHERITANCE = 1391;

  { The file or directory is corrupt and non-readable. }
  {$EXTERNALSYM ERROR_FILE_CORRUPT}
  ERROR_FILE_CORRUPT = 1392;

  { The disk structure is corrupt and non-readable. }
  {$EXTERNALSYM ERROR_DISK_CORRUPT}
  ERROR_DISK_CORRUPT = 1393;

  { There is no user session key for the specified logon session. }
  {$EXTERNALSYM ERROR_NO_USER_SESSION_KEY}
  ERROR_NO_USER_SESSION_KEY = 1394;

  { The service being accessed is licensed for a particular number of connections. }
  { No more connections can be made to the service at this time }
  { because there are already as many connections as the service can accept. }
  {$EXTERNALSYM ERROR_LICENSE_QUOTA_EXCEEDED}
  ERROR_LICENSE_QUOTA_EXCEEDED = 1395;


{ WinUser Error Codes }

  { Invalid window handle. }
  {$EXTERNALSYM ERROR_INVALID_WINDOW_HANDLE}
  ERROR_INVALID_WINDOW_HANDLE = 1400;

  { Invalid menu handle. }
  {$EXTERNALSYM ERROR_INVALID_MENU_HANDLE}
  ERROR_INVALID_MENU_HANDLE = 1401;

  { Invalid cursor handle. }
  {$EXTERNALSYM ERROR_INVALID_CURSOR_HANDLE}
  ERROR_INVALID_CURSOR_HANDLE = 1402;

  { Invalid accelerator table handle. }
  {$EXTERNALSYM ERROR_INVALID_ACCEL_HANDLE}
  ERROR_INVALID_ACCEL_HANDLE = 1403;

  { Invalid hook handle. }
  {$EXTERNALSYM ERROR_INVALID_HOOK_HANDLE}
  ERROR_INVALID_HOOK_HANDLE = 1404;

  { Invalid handle to a multiple-window position structure. }
  {$EXTERNALSYM ERROR_INVALID_DWP_HANDLE}
  ERROR_INVALID_DWP_HANDLE = 1405;

  { Cannot create a top-level child window. }
  {$EXTERNALSYM ERROR_TLW_WITH_WSCHILD}
  ERROR_TLW_WITH_WSCHILD = 1406;

  { Cannot find window class. }
  {$EXTERNALSYM ERROR_CANNOT_FIND_WND_CLASS}
  ERROR_CANNOT_FIND_WND_CLASS = 1407;

  { Invalid window, belongs to other thread. }
  {$EXTERNALSYM ERROR_WINDOW_OF_OTHER_THREAD}
  ERROR_WINDOW_OF_OTHER_THREAD = 1408;

  { Hot key is already registered. }
  {$EXTERNALSYM ERROR_HOTKEY_ALREADY_REGISTERED}
  ERROR_HOTKEY_ALREADY_REGISTERED = 1409;

  { Class already exists. }
  {$EXTERNALSYM ERROR_CLASS_ALREADY_EXISTS}
  ERROR_CLASS_ALREADY_EXISTS = 1410;

  { Class does not exist. }
  {$EXTERNALSYM ERROR_CLASS_DOES_NOT_EXIST}
  ERROR_CLASS_DOES_NOT_EXIST = 1411;

  { Class still has open windows. }
  {$EXTERNALSYM ERROR_CLASS_HAS_WINDOWS}
  ERROR_CLASS_HAS_WINDOWS = 1412;

  { Invalid index. }
  {$EXTERNALSYM ERROR_INVALID_INDEX}
  ERROR_INVALID_INDEX = 1413;

  { Invalid icon handle. }
  {$EXTERNALSYM ERROR_INVALID_ICON_HANDLE}
  ERROR_INVALID_ICON_HANDLE = 1414;

  { Using private DIALOG window words. }
  {$EXTERNALSYM ERROR_PRIVATE_DIALOG_INDEX}
  ERROR_PRIVATE_DIALOG_INDEX = 1415;

  { The listbox identifier was not found. }
  {$EXTERNALSYM ERROR_LISTBOX_ID_NOT_FOUND}
  ERROR_LISTBOX_ID_NOT_FOUND = 1416;

  { No wildcards were found. }
  {$EXTERNALSYM ERROR_NO_WILDCARD_CHARACTERS}
  ERROR_NO_WILDCARD_CHARACTERS = 1417;

  { Thread does not have a clipboard open. }
  {$EXTERNALSYM ERROR_CLIPBOARD_NOT_OPEN}
  ERROR_CLIPBOARD_NOT_OPEN = 1418;

  { Hot key is not registered. }
  {$EXTERNALSYM ERROR_HOTKEY_NOT_REGISTERED}
  ERROR_HOTKEY_NOT_REGISTERED = 1419;

  { The window is not a valid dialog window. }
  {$EXTERNALSYM ERROR_WINDOW_NOT_DIALOG}
  ERROR_WINDOW_NOT_DIALOG = 1420;

  { Control ID not found. }
  {$EXTERNALSYM ERROR_CONTROL_ID_NOT_FOUND}
  ERROR_CONTROL_ID_NOT_FOUND = 1421;

  { Invalid message for a combo box because it does not have an edit control. }
  {$EXTERNALSYM ERROR_INVALID_COMBOBOX_MESSAGE}
  ERROR_INVALID_COMBOBOX_MESSAGE = 1422;

  { The window is not a combo box. }
  {$EXTERNALSYM ERROR_WINDOW_NOT_COMBOBOX}
  ERROR_WINDOW_NOT_COMBOBOX = 1423;

  { Height must be less than 256. }
  {$EXTERNALSYM ERROR_INVALID_EDIT_HEIGHT}
  ERROR_INVALID_EDIT_HEIGHT = 1424;

  { Invalid device context (DC) handle. }
  {$EXTERNALSYM ERROR_DC_NOT_FOUND}
  ERROR_DC_NOT_FOUND = 1425;

  { Invalid hook procedure type. }
  {$EXTERNALSYM ERROR_INVALID_HOOK_FILTER}
  ERROR_INVALID_HOOK_FILTER = 1426;

  { Invalid hook procedure. }
  {$EXTERNALSYM ERROR_INVALID_FILTER_PROC}
  ERROR_INVALID_FILTER_PROC = 1427;

  { Cannot set non-local hook without a module handle. }
  {$EXTERNALSYM ERROR_HOOK_NEEDS_HMOD}
  ERROR_HOOK_NEEDS_HMOD = 1428;

  { This hook procedure can only be set globally. }
  {$EXTERNALSYM ERROR_GLOBAL_ONLY_HOOK}
  ERROR_GLOBAL_ONLY_HOOK = 1429;

  { The journal hook procedure is already installed. }
  {$EXTERNALSYM ERROR_JOURNAL_HOOK_SET}
  ERROR_JOURNAL_HOOK_SET = 1430;

  { The hook procedure is not installed. }
  {$EXTERNALSYM ERROR_HOOK_NOT_INSTALLED}
  ERROR_HOOK_NOT_INSTALLED = 1431;

  { Invalid message for single-selection listbox. }
  {$EXTERNALSYM ERROR_INVALID_LB_MESSAGE}
  ERROR_INVALID_LB_MESSAGE = 1432;

  { LB_SETCOUNT sent to non-lazy listbox. }
  {$EXTERNALSYM ERROR_SETCOUNT_ON_BAD_LB}
  ERROR_SETCOUNT_ON_BAD_LB = 1433;

  { This list box does not support tab stops. }
  {$EXTERNALSYM ERROR_LB_WITHOUT_TABSTOPS}
  ERROR_LB_WITHOUT_TABSTOPS = 1434;

  { Cannot destroy object created by another thread. }
  {$EXTERNALSYM ERROR_DESTROY_OBJECT_OF_OTHER_THREAD}
  ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435;

  { Child windows cannot have menus. }
  {$EXTERNALSYM ERROR_CHILD_WINDOW_MENU}
  ERROR_CHILD_WINDOW_MENU = 1436;

  { The window does not have a system menu. }
  {$EXTERNALSYM ERROR_NO_SYSTEM_MENU}
  ERROR_NO_SYSTEM_MENU = 1437;

  { Invalid message box style. }
  {$EXTERNALSYM ERROR_INVALID_MSGBOX_STYLE}
  ERROR_INVALID_MSGBOX_STYLE = 1438;

  { Invalid system-wide (SPI_*) parameter. }
  {$EXTERNALSYM ERROR_INVALID_SPI_VALUE}
  ERROR_INVALID_SPI_VALUE = 1439;

  { Screen already locked. }
  {$EXTERNALSYM ERROR_SCREEN_ALREADY_LOCKED}
  ERROR_SCREEN_ALREADY_LOCKED = 1440;

  { All handles to windows in a multiple-window position structure must }
  { have the same parent. }
  {$EXTERNALSYM ERROR_HWNDS_HAVE_DIFF_PARENT}
  ERROR_HWNDS_HAVE_DIFF_PARENT = 1441;

  { The window is not a child window. }
  {$EXTERNALSYM ERROR_NOT_CHILD_WINDOW}
  ERROR_NOT_CHILD_WINDOW = 1442;

  { Invalid GW_* command. }
  {$EXTERNALSYM ERROR_INVALID_GW_COMMAND}
  ERROR_INVALID_GW_COMMAND = 1443;

  { Invalid thread identifier. }
  {$EXTERNALSYM ERROR_INVALID_THREAD_ID}
  ERROR_INVALID_THREAD_ID = 1444;

  { Cannot process a message from a window that is not a multiple document }
  { interface (MDI) window. }
  {$EXTERNALSYM ERROR_NON_MDICHILD_WINDOW}
  ERROR_NON_MDICHILD_WINDOW = 1445;

  { Popup menu already active. }
  {$EXTERNALSYM ERROR_POPUP_ALREADY_ACTIVE}
  ERROR_POPUP_ALREADY_ACTIVE = 1446;

  { The window does not have scroll bars. }
  {$EXTERNALSYM ERROR_NO_SCROLLBARS}
  ERROR_NO_SCROLLBARS = 1447;

  { Scroll bar range cannot be greater than $7FFF. }
  {$EXTERNALSYM ERROR_INVALID_SCROLLBAR_RANGE}
  ERROR_INVALID_SCROLLBAR_RANGE = 1448;

  { Cannot show or remove the window in the way specified. }
  {$EXTERNALSYM ERROR_INVALID_SHOWWIN_COMMAND}
  ERROR_INVALID_SHOWWIN_COMMAND = 1449;

  { Insufficient system resources exist to complete the requested service. }
  {$EXTERNALSYM ERROR_NO_SYSTEM_RESOURCES}
  ERROR_NO_SYSTEM_RESOURCES = 1450;

  { Insufficient system resources exist to complete the requested service. }
  {$EXTERNALSYM ERROR_NONPAGED_SYSTEM_RESOURCES}
  ERROR_NONPAGED_SYSTEM_RESOURCES = 1451;

  { Insufficient system resources exist to complete the requested service. }
  {$EXTERNALSYM ERROR_PAGED_SYSTEM_RESOURCES}
  ERROR_PAGED_SYSTEM_RESOURCES = 1452;

  { Insufficient quota to complete the requested service. }
  {$EXTERNALSYM ERROR_WORKING_SET_QUOTA}
  ERROR_WORKING_SET_QUOTA = 1453;

  { Insufficient quota to complete the requested service. }
  {$EXTERNALSYM ERROR_PAGEFILE_QUOTA}
  ERROR_PAGEFILE_QUOTA = 1454;

  { The paging file is too small for this operation to complete. }
  {$EXTERNALSYM ERROR_COMMITMENT_LIMIT}
  ERROR_COMMITMENT_LIMIT = 1455;

  { A menu item was not found. }
  {$EXTERNALSYM ERROR_MENU_ITEM_NOT_FOUND}
  ERROR_MENU_ITEM_NOT_FOUND = 1456;

  { Invalid keyboard layout handle. }
  {$EXTERNALSYM ERROR_INVALID_KEYBOARD_HANDLE}
  ERROR_INVALID_KEYBOARD_HANDLE = 1457;

  { Hook type not allowed. }
  {$EXTERNALSYM ERROR_HOOK_TYPE_NOT_ALLOWED}
  ERROR_HOOK_TYPE_NOT_ALLOWED = 1458;

  { This operation requires an interactive windowstation. }
  {$EXTERNALSYM ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION}
  ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459;

  { This operation returned because the timeout period expired. }
  {$EXTERNALSYM ERROR_TIMEOUT}
  ERROR_TIMEOUT = 1460;


{ Eventlog Status Codes }

  { The event log file is corrupt. }
  {$EXTERNALSYM ERROR_EVENTLOG_FILE_CORRUPT}
  ERROR_EVENTLOG_FILE_CORRUPT = 1500;

  { No event log file could be opened, so the event logging service did not start. }
  {$EXTERNALSYM ERROR_EVENTLOG_CANT_START}
  ERROR_EVENTLOG_CANT_START = 1501;

  { The event log file is full. }
  {$EXTERNALSYM ERROR_LOG_FILE_FULL}
  ERROR_LOG_FILE_FULL = 1502;

  { The event log file has changed between reads. }
  {$EXTERNALSYM ERROR_EVENTLOG_FILE_CHANGED}
  ERROR_EVENTLOG_FILE_CHANGED = 1503;


{ RPC Status Codes }

  { The string binding is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_STRING_BINDING}
  RPC_S_INVALID_STRING_BINDING = 1700;

  { The binding handle is not the correct type. }
  {$EXTERNALSYM RPC_S_WRONG_KIND_OF_BINDING}
  RPC_S_WRONG_KIND_OF_BINDING = 1701;

  { The binding handle is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_BINDING}
  RPC_S_INVALID_BINDING = 1702;

  { The RPC protocol sequence is not supported. }
  {$EXTERNALSYM RPC_S_PROTSEQ_NOT_SUPPORTED}
  RPC_S_PROTSEQ_NOT_SUPPORTED = 1703;

  { The RPC protocol sequence is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_RPC_PROTSEQ}
  RPC_S_INVALID_RPC_PROTSEQ = 1704;

  { The string universal unique identifier (UUID) is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_STRING_UUID}
  RPC_S_INVALID_STRING_UUID = 1705;

  { The endpoint format is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_ENDPOINT_FORMAT}
  RPC_S_INVALID_ENDPOINT_FORMAT = 1706;

  { The network address is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_NET_ADDR}
  RPC_S_INVALID_NET_ADDR = 1707;

  { No endpoint was found. }
  {$EXTERNALSYM RPC_S_NO_ENDPOINT_FOUND}
  RPC_S_NO_ENDPOINT_FOUND = 1708;

  { The timeout value is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_TIMEOUT}
  RPC_S_INVALID_TIMEOUT = 1709;

  { The object universal unique identifier (UUID) was not found. }
  {$EXTERNALSYM RPC_S_OBJECT_NOT_FOUND}
  RPC_S_OBJECT_NOT_FOUND = 1710;

  { The object universal unique identifier (UUID) has already been registered. }
  {$EXTERNALSYM RPC_S_ALREADY_REGISTERED}
  RPC_S_ALREADY_REGISTERED = 1711;

  { The type universal unique identifier (UUID) has already been registered. }
  {$EXTERNALSYM RPC_S_TYPE_ALREADY_REGISTERED}
  RPC_S_TYPE_ALREADY_REGISTERED = 1712;

  { The RPC server is already listening. }
  {$EXTERNALSYM RPC_S_ALREADY_LISTENING}
  RPC_S_ALREADY_LISTENING = 1713;

  { No protocol sequences have been registered. }
  {$EXTERNALSYM RPC_S_NO_PROTSEQS_REGISTERED}
  RPC_S_NO_PROTSEQS_REGISTERED = 1714;

  { The RPC server is not listening. }
  {$EXTERNALSYM RPC_S_NOT_LISTENING}
  RPC_S_NOT_LISTENING = 1715;

  { The manager type is unknown. }
  {$EXTERNALSYM RPC_S_UNKNOWN_MGR_TYPE}
  RPC_S_UNKNOWN_MGR_TYPE = 1716;

  { The interface is unknown. }
  {$EXTERNALSYM RPC_S_UNKNOWN_IF}
  RPC_S_UNKNOWN_IF = 1717;

  { There are no bindings. }
  {$EXTERNALSYM RPC_S_NO_BINDINGS}
  RPC_S_NO_BINDINGS = 1718;

  { There are no protocol sequences. }
  {$EXTERNALSYM RPC_S_NO_PROTSEQS}
  RPC_S_NO_PROTSEQS = 1719;

  { The endpoint cannot be created. }
  {$EXTERNALSYM RPC_S_CANT_CREATE_ENDPOINT}
  RPC_S_CANT_CREATE_ENDPOINT = 1720;

  { Not enough resources are available to complete this operation. }
  {$EXTERNALSYM RPC_S_OUT_OF_RESOURCES}
  RPC_S_OUT_OF_RESOURCES = 1721;

  { The RPC server is unavailable. }
  {$EXTERNALSYM RPC_S_SERVER_UNAVAILABLE}
  RPC_S_SERVER_UNAVAILABLE = 1722;

  { The RPC server is too busy to complete this operation. }
  {$EXTERNALSYM RPC_S_SERVER_TOO_BUSY}
  RPC_S_SERVER_TOO_BUSY = 1723;

  { The network options are invalid. }
  {$EXTERNALSYM RPC_S_INVALID_NETWORK_OPTIONS}
  RPC_S_INVALID_NETWORK_OPTIONS = 1724;

  { There is not a remote procedure call active in this thread. }
  {$EXTERNALSYM RPC_S_NO_CALL_ACTIVE}
  RPC_S_NO_CALL_ACTIVE = 1725;

  { The remote procedure call failed. }
  {$EXTERNALSYM RPC_S_CALL_FAILED}
  RPC_S_CALL_FAILED = 1726;

  { The remote procedure call failed and did not execute. }
  {$EXTERNALSYM RPC_S_CALL_FAILED_DNE}
  RPC_S_CALL_FAILED_DNE = 1727;

  { A remote procedure call (RPC) protocol error occurred. }
  {$EXTERNALSYM RPC_S_PROTOCOL_ERROR}
  RPC_S_PROTOCOL_ERROR = 1728;

  { The transfer syntax is not supported by the RPC server. }
  {$EXTERNALSYM RPC_S_UNSUPPORTED_TRANS_SYN}
  RPC_S_UNSUPPORTED_TRANS_SYN = 1730;

  { The universal unique identifier (UUID) type is not supported. }
  {$EXTERNALSYM RPC_S_UNSUPPORTED_TYPE}
  RPC_S_UNSUPPORTED_TYPE = 1732;

  { The tag is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_TAG}
  RPC_S_INVALID_TAG = 1733;

  { The array bounds are invalid. }
  {$EXTERNALSYM RPC_S_INVALID_BOUND}
  RPC_S_INVALID_BOUND = 1734;

  { The binding does not contain an entry name. }
  {$EXTERNALSYM RPC_S_NO_ENTRY_NAME}
  RPC_S_NO_ENTRY_NAME = 1735;

  { The name syntax is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_NAME_SYNTAX}
  RPC_S_INVALID_NAME_SYNTAX = 1736;

  { The name syntax is not supported. }
  {$EXTERNALSYM RPC_S_UNSUPPORTED_NAME_SYNTAX}
  RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737;

  { No network address is available to use to construct a universal }

  { unique identifier (UUID). }
  {$EXTERNALSYM RPC_S_UUID_NO_ADDRESS}
  RPC_S_UUID_NO_ADDRESS = 1739;

  { The endpoint is a duplicate. }
  {$EXTERNALSYM RPC_S_DUPLICATE_ENDPOINT}
  RPC_S_DUPLICATE_ENDPOINT = 1740;

  { The authentication type is unknown. }
  {$EXTERNALSYM RPC_S_UNKNOWN_AUTHN_TYPE}
  RPC_S_UNKNOWN_AUTHN_TYPE = 1741;

  { The maximum number of calls is too small. }
  {$EXTERNALSYM RPC_S_MAX_CALLS_TOO_SMALL}
  RPC_S_MAX_CALLS_TOO_SMALL = 1742;

  { The string is too long. }
  {$EXTERNALSYM RPC_S_STRING_TOO_LONG}
  RPC_S_STRING_TOO_LONG = 1743;

  { The RPC protocol sequence was not found. }
  {$EXTERNALSYM RPC_S_PROTSEQ_NOT_FOUND}
  RPC_S_PROTSEQ_NOT_FOUND = 1744;

  { The procedure number is out of range. }
  {$EXTERNALSYM RPC_S_PROCNUM_OUT_OF_RANGE}
  RPC_S_PROCNUM_OUT_OF_RANGE = 1745;

  { The binding does not contain any authentication information. }
  {$EXTERNALSYM RPC_S_BINDING_HAS_NO_AUTH}
  RPC_S_BINDING_HAS_NO_AUTH = 1746;

  { The authentication service is unknown. }
  {$EXTERNALSYM RPC_S_UNKNOWN_AUTHN_SERVICE}
  RPC_S_UNKNOWN_AUTHN_SERVICE = 1747;

  { The authentication level is unknown. }
  {$EXTERNALSYM RPC_S_UNKNOWN_AUTHN_LEVEL}
  RPC_S_UNKNOWN_AUTHN_LEVEL = 1748;

  { The security context is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_AUTH_IDENTITY}
  RPC_S_INVALID_AUTH_IDENTITY = 1749;

  { The authorization service is unknown. }
  {$EXTERNALSYM RPC_S_UNKNOWN_AUTHZ_SERVICE}
  RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750;

  { The entry is invalid. }
  {$EXTERNALSYM EPT_S_INVALID_ENTRY}
  EPT_S_INVALID_ENTRY = 1751;

  { The server endpoint cannot perform the operation. }
  {$EXTERNALSYM EPT_S_CANT_PERFORM_OP}
  EPT_S_CANT_PERFORM_OP = 1752;

  { There are no more endpoints available from the endpoint mapper. }
  {$EXTERNALSYM EPT_S_NOT_REGISTERED}
  EPT_S_NOT_REGISTERED = 1753;

  { No interfaces have been exported. }
  {$EXTERNALSYM RPC_S_NOTHING_TO_EXPORT}
  RPC_S_NOTHING_TO_EXPORT = 1754;

  { The entry name is incomplete. }
  {$EXTERNALSYM RPC_S_INCOMPLETE_NAME}
  RPC_S_INCOMPLETE_NAME = 1755;

  { The version option is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_VERS_OPTION}
  RPC_S_INVALID_VERS_OPTION = 1756;

  { There are no more members. }
  {$EXTERNALSYM RPC_S_NO_MORE_MEMBERS}
  RPC_S_NO_MORE_MEMBERS = 1757;

  { There is nothing to unexport. }
  {$EXTERNALSYM RPC_S_NOT_ALL_OBJS_UNEXPORTED}
  RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758;

  { The interface was not found. }
  {$EXTERNALSYM RPC_S_INTERFACE_NOT_FOUND}
  RPC_S_INTERFACE_NOT_FOUND = 1759;

  { The entry already exists. }
  {$EXTERNALSYM RPC_S_ENTRY_ALREADY_EXISTS}
  RPC_S_ENTRY_ALREADY_EXISTS = 1760;

  { The entry is not found. }
  {$EXTERNALSYM RPC_S_ENTRY_NOT_FOUND}
  RPC_S_ENTRY_NOT_FOUND = 1761;

  { The name service is unavailable. }
  {$EXTERNALSYM RPC_S_NAME_SERVICE_UNAVAILABLE}
  RPC_S_NAME_SERVICE_UNAVAILABLE = 1762;

  { The network address family is invalid. }
  {$EXTERNALSYM RPC_S_INVALID_NAF_ID}
  RPC_S_INVALID_NAF_ID = 1763;

  { The requested operation is not supported. }
  {$EXTERNALSYM RPC_S_CANNOT_SUPPORT}
  RPC_S_CANNOT_SUPPORT = 1764;

  { No security context is available to allow impersonation. }
  {$EXTERNALSYM RPC_S_NO_CONTEXT_AVAILABLE}
  RPC_S_NO_CONTEXT_AVAILABLE = 1765;

  { An internal error occurred in a remote procedure call (RPC). }
  {$EXTERNALSYM RPC_S_INTERNAL_ERROR}
  RPC_S_INTERNAL_ERROR = 1766;

  { The RPC server attempted an integer division by zero. }
  {$EXTERNALSYM RPC_S_ZERO_DIVIDE}
  RPC_S_ZERO_DIVIDE = 1767;

  { An addressing error occurred in the RPC server. }
  {$EXTERNALSYM RPC_S_ADDRESS_ERROR}
  RPC_S_ADDRESS_ERROR = 1768;

  { A floating-point operation at the RPC server caused a division by zero. }
  {$EXTERNALSYM RPC_S_FP_DIV_ZERO}
  RPC_S_FP_DIV_ZERO = 1769;

  { A floating-point underflow occurred at the RPC server. }
  {$EXTERNALSYM RPC_S_FP_UNDERFLOW}
  RPC_S_FP_UNDERFLOW = 1770;

  { A floating-point overflow occurred at the RPC server. }
  {$EXTERNALSYM RPC_S_FP_OVERFLOW}
  RPC_S_FP_OVERFLOW = 1771;

  { The list of RPC servers available for the binding of auto handles }
  { has been exhausted. }
  {$EXTERNALSYM RPC_X_NO_MORE_ENTRIES}
  RPC_X_NO_MORE_ENTRIES = 1772;

  { Unable to open the character translation table file. }
  {$EXTERNALSYM RPC_X_SS_CHAR_TRANS_OPEN_FAIL}
  RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773;

  { The file containing the character translation table has fewer than }
  { 512 bytes. }
  {$EXTERNALSYM RPC_X_SS_CHAR_TRANS_SHORT_FILE}
  RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774;

  { A null context handle was passed from the client to the host during }
  { a remote procedure call. }
  {$EXTERNALSYM RPC_X_SS_IN_NULL_CONTEXT}
  RPC_X_SS_IN_NULL_CONTEXT = 1775;

  { The context handle changed during a remote procedure call. }
  {$EXTERNALSYM RPC_X_SS_CONTEXT_DAMAGED}
  RPC_X_SS_CONTEXT_DAMAGED = 1777;

  { The binding handles passed to a remote procedure call do not match. }
  {$EXTERNALSYM RPC_X_SS_HANDLES_MISMATCH}
  RPC_X_SS_HANDLES_MISMATCH = 1778;

  { The stub is unable to get the remote procedure call handle. }
  {$EXTERNALSYM RPC_X_SS_CANNOT_GET_CALL_HANDLE}
  RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779;

  { A null reference pointer was passed to the stub. }
  {$EXTERNALSYM RPC_X_NULL_REF_POINTER}
  RPC_X_NULL_REF_POINTER = 1780;

  { The enumeration value is out of range. }
  {$EXTERNALSYM RPC_X_ENUM_VALUE_OUT_OF_RANGE}
  RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781;

  { The byte count is too small. }
  {$EXTERNALSYM RPC_X_BYTE_COUNT_TOO_SMALL}
  RPC_X_BYTE_COUNT_TOO_SMALL = 1782;

  { The stub received bad data. }
  {$EXTERNALSYM RPC_X_BAD_STUB_DATA}
  RPC_X_BAD_STUB_DATA = 1783;

  { The supplied user buffer is not valid for the requested operation. }
  {$EXTERNALSYM ERROR_INVALID_USER_BUFFER}
  ERROR_INVALID_USER_BUFFER = 1784;

  { The disk media is not recognized.  It may not be formatted. }
  {$EXTERNALSYM ERROR_UNRECOGNIZED_MEDIA}
  ERROR_UNRECOGNIZED_MEDIA = 1785;

  { The workstation does not have a trust secret. }
  {$EXTERNALSYM ERROR_NO_TRUST_LSA_SECRET}
  ERROR_NO_TRUST_LSA_SECRET = 1786;

  { The SAM database on the Windows NT Server does not have a computer }
  { account for this workstation trust relationship. }
  {$EXTERNALSYM ERROR_NO_TRUST_SAM_ACCOUNT}
  ERROR_NO_TRUST_SAM_ACCOUNT = 1787;

  { The trust relationship between the primary domain and the trusted }
  { domain failed. }
  {$EXTERNALSYM ERROR_TRUSTED_DOMAIN_FAILURE}
  ERROR_TRUSTED_DOMAIN_FAILURE = 1788;

  { The trust relationship between this workstation and the primary }
  { domain failed. }
  {$EXTERNALSYM ERROR_TRUSTED_RELATIONSHIP_FAILURE}
  ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789;

  { The network logon failed. }
  {$EXTERNALSYM ERROR_TRUST_FAILURE}
  ERROR_TRUST_FAILURE = 1790;

  { A remote procedure call is already in progress for this thread. }
  {$EXTERNALSYM RPC_S_CALL_IN_PROGRESS}
  RPC_S_CALL_IN_PROGRESS = 1791;

  { An attempt was made to logon, but the network logon service was not started. }
  {$EXTERNALSYM ERROR_NETLOGON_NOT_STARTED}
  ERROR_NETLOGON_NOT_STARTED = 1792;

  { The user's account has expired. }
  {$EXTERNALSYM ERROR_ACCOUNT_EXPIRED}
  ERROR_ACCOUNT_EXPIRED = 1793;

  { The redirector is in use and cannot be unloaded. }
  {$EXTERNALSYM ERROR_REDIRECTOR_HAS_OPEN_HANDLES}
  ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794;

  { The specified printer driver is already installed. }
  {$EXTERNALSYM ERROR_PRINTER_DRIVER_ALREADY_INSTALLED}
  ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795;

  { The specified port is unknown. }
  {$EXTERNALSYM ERROR_UNKNOWN_PORT}
  ERROR_UNKNOWN_PORT = 1796;

  { The printer driver is unknown. }
  {$EXTERNALSYM ERROR_UNKNOWN_PRINTER_DRIVER}
  ERROR_UNKNOWN_PRINTER_DRIVER = 1797;

  { The print processor is unknown. }
  {$EXTERNALSYM ERROR_UNKNOWN_PRINTPROCESSOR}
  ERROR_UNKNOWN_PRINTPROCESSOR = 1798;

  { The specified separator file is invalid. }
  {$EXTERNALSYM ERROR_INVALID_SEPARATOR_FILE}
  ERROR_INVALID_SEPARATOR_FILE = 1799;

  { The specified priority is invalid. }
  {$EXTERNALSYM ERROR_INVALID_PRIORITY}
  ERROR_INVALID_PRIORITY = 1800;

  { The printer name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_PRINTER_NAME}
  ERROR_INVALID_PRINTER_NAME = 1801;

  { The printer already exists. }
  {$EXTERNALSYM ERROR_PRINTER_ALREADY_EXISTS}
  ERROR_PRINTER_ALREADY_EXISTS = 1802;

  { The printer command is invalid. }
  {$EXTERNALSYM ERROR_INVALID_PRINTER_COMMAND}
  ERROR_INVALID_PRINTER_COMMAND = 1803;

  { The specified datatype is invalid. }
  {$EXTERNALSYM ERROR_INVALID_DATATYPE}
  ERROR_INVALID_DATATYPE = 1804;

  { The Environment specified is invalid. }
  {$EXTERNALSYM ERROR_INVALID_ENVIRONMENT}
  ERROR_INVALID_ENVIRONMENT = 1805;

  { There are no more bindings. }
  {$EXTERNALSYM RPC_S_NO_MORE_BINDINGS}
  RPC_S_NO_MORE_BINDINGS = 1806;

  { The account used is an interdomain trust account.  Use your global user account or local user account to access this server. }
  {$EXTERNALSYM ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT}
  ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807;

  { The account used is a Computer Account.  Use your global user account or local user account to access this server. }
  {$EXTERNALSYM ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT}
  ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808;

  { The account used is an server trust account.  Use your global user account or local user account to access this server. }
  {$EXTERNALSYM ERROR_NOLOGON_SERVER_TRUST_ACCOUNT}
  ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809;

  { The name or security ID (SID) of the domain specified is inconsistent }
  { with the trust information for that domain. }
  {$EXTERNALSYM ERROR_DOMAIN_TRUST_INCONSISTENT}
  ERROR_DOMAIN_TRUST_INCONSISTENT = 1810;

  { The server is in use and cannot be unloaded. }
  {$EXTERNALSYM ERROR_SERVER_HAS_OPEN_HANDLES}
  ERROR_SERVER_HAS_OPEN_HANDLES = 1811;

  { The specified image file did not contain a resource section. }
  {$EXTERNALSYM ERROR_RESOURCE_DATA_NOT_FOUND}
  ERROR_RESOURCE_DATA_NOT_FOUND = 1812;

  { The specified resource type can not be found in the image file. }
  {$EXTERNALSYM ERROR_RESOURCE_TYPE_NOT_FOUND}
  ERROR_RESOURCE_TYPE_NOT_FOUND = 1813;

  { The specified resource name can not be found in the image file. }
  {$EXTERNALSYM ERROR_RESOURCE_NAME_NOT_FOUND}
  ERROR_RESOURCE_NAME_NOT_FOUND = 1814;

  { The specified resource language ID cannot be found in the image file. }
  {$EXTERNALSYM ERROR_RESOURCE_LANG_NOT_FOUND}
  ERROR_RESOURCE_LANG_NOT_FOUND = 1815;

  { Not enough quota is available to process this command. }
  {$EXTERNALSYM ERROR_NOT_ENOUGH_QUOTA}
  ERROR_NOT_ENOUGH_QUOTA = 1816;

  { No interfaces have been registered. }
  {$EXTERNALSYM RPC_S_NO_INTERFACES}
  RPC_S_NO_INTERFACES = 1817;

  { The server was altered while processing this call. }
  {$EXTERNALSYM RPC_S_CALL_CANCELLED}
  RPC_S_CALL_CANCELLED = 1818;

  { The binding handle does not contain all required information. }
  {$EXTERNALSYM RPC_S_BINDING_INCOMPLETE}
  RPC_S_BINDING_INCOMPLETE = 1819;

  { Communications failure. }
  {$EXTERNALSYM RPC_S_COMM_FAILURE}
  RPC_S_COMM_FAILURE = 1820;

  { The requested authentication level is not supported. }
  {$EXTERNALSYM RPC_S_UNSUPPORTED_AUTHN_LEVEL}
  RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821;

  { No principal name registered. }
  {$EXTERNALSYM RPC_S_NO_PRINC_NAME}
  RPC_S_NO_PRINC_NAME = 1822;

  { The error specified is not a valid Windows NT RPC error code. }
  {$EXTERNALSYM RPC_S_NOT_RPC_ERROR}
  RPC_S_NOT_RPC_ERROR = 1823;

  { A UUID that is valid only on this computer has been allocated. }
  {$EXTERNALSYM RPC_S_UUID_LOCAL_ONLY}
  RPC_S_UUID_LOCAL_ONLY = 1824;

  { A security package specific error occurred. }
  {$EXTERNALSYM RPC_S_SEC_PKG_ERROR}
  RPC_S_SEC_PKG_ERROR = 1825;

  { Thread is not cancelled. }
  {$EXTERNALSYM RPC_S_NOT_CANCELLED}
  RPC_S_NOT_CANCELLED = 1826;

  { Invalid operation on the encoding/decoding handle. }
  {$EXTERNALSYM RPC_X_INVALID_ES_ACTION}
  RPC_X_INVALID_ES_ACTION = 1827;

  { Incompatible version of the serializing package. }
  {$EXTERNALSYM RPC_X_WRONG_ES_VERSION}
  RPC_X_WRONG_ES_VERSION = 1828;

  { Incompatible version of the RPC stub. }
  {$EXTERNALSYM RPC_X_WRONG_STUB_VERSION}
  RPC_X_WRONG_STUB_VERSION = 1829;

  { The idl pipe object is invalid or corrupted. }
  {$EXTERNALSYM RPC_X_INVALID_PIPE_OBJECT}
  RPC_X_INVALID_PIPE_OBJECT = 1830;

  { The operation is invalid for a given idl pipe object. }
  {$EXTERNALSYM RPC_X_INVALID_PIPE_OPERATION}
  RPC_X_INVALID_PIPE_OPERATION = 1831;

  { The idl pipe version is not supported. }
  {$EXTERNALSYM RPC_X_WRONG_PIPE_VERSION}
  RPC_X_WRONG_PIPE_VERSION = 1832;

  { The group member was not found. }
  {$EXTERNALSYM RPC_S_GROUP_MEMBER_NOT_FOUND}
  RPC_S_GROUP_MEMBER_NOT_FOUND = 1898;

  { The endpoint mapper database could not be created. }
  {$EXTERNALSYM EPT_S_CANT_CREATE}
  EPT_S_CANT_CREATE = 1899;

  { The object universal unique identifier (UUID) is the nil UUID. }
  {$EXTERNALSYM RPC_S_INVALID_OBJECT}
  RPC_S_INVALID_OBJECT = 1900;

  { The specified time is invalid. }
  {$EXTERNALSYM ERROR_INVALID_TIME}
  ERROR_INVALID_TIME = 1901;

  { The specified Form name is invalid. }
  {$EXTERNALSYM ERROR_INVALID_FORM_NAME}
  ERROR_INVALID_FORM_NAME = 1902;

  { The specified Form size is invalid }
  {$EXTERNALSYM ERROR_INVALID_FORM_SIZE}
  ERROR_INVALID_FORM_SIZE = 1903;

  { The specified Printer handle is already being waited on }
  {$EXTERNALSYM ERROR_ALREADY_WAITING}
  ERROR_ALREADY_WAITING = 1904;

  { The specified Printer has been deleted }
  {$EXTERNALSYM ERROR_PRINTER_DELETED}
  ERROR_PRINTER_DELETED = 1905;

  { The state of the Printer is invalid }
  {$EXTERNALSYM ERROR_INVALID_PRINTER_STATE}
  ERROR_INVALID_PRINTER_STATE = 1906;

  { The user must change his password before he logs on the first time. }
  {$EXTERNALSYM ERROR_PASSWORD_MUST_CHANGE}
  ERROR_PASSWORD_MUST_CHANGE = 1907;

  { Could not find the domain controller for this domain. }
  {$EXTERNALSYM ERROR_DOMAIN_CONTROLLER_NOT_FOUND}
  ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908;

  { The referenced account is currently locked out and may not be logged on to. }
  {$EXTERNALSYM ERROR_ACCOUNT_LOCKED_OUT}
  ERROR_ACCOUNT_LOCKED_OUT = 1909;

  { The object exporter specified was not found. }
  {$EXTERNALSYM OR_INVALID_OXID}
  OR_INVALID_OXID = 1910;

  { The object specified was not found. }
  {$EXTERNALSYM OR_INVALID_OID}
  OR_INVALID_OID = 1911;

  { The object resolver set specified was not found. }
  {$EXTERNALSYM OR_INVALID_SET}
  OR_INVALID_SET = 1912;

  { Some data remains to be sent in the request buffer. }
  {$EXTERNALSYM RPC_S_SEND_INCOMPLETE}
  RPC_S_SEND_INCOMPLETE = 1913;

  { The list of servers for this workgroup is not currently available }
  {$EXTERNALSYM ERROR_NO_BROWSER_SERVERS_FOUND}
  ERROR_NO_BROWSER_SERVERS_FOUND = 6118;


{ OpenGL Error Code }

  { The pixel format is invalid. }
  {$EXTERNALSYM ERROR_INVALID_PIXEL_FORMAT}
  ERROR_INVALID_PIXEL_FORMAT = 2000;

  { The specified driver is invalid. }
  {$EXTERNALSYM ERROR_BAD_DRIVER}
  ERROR_BAD_DRIVER = 2001;

  { The window style or class attribute is invalid for this operation. }
  {$EXTERNALSYM ERROR_INVALID_WINDOW_STYLE}
  ERROR_INVALID_WINDOW_STYLE = 2002;

  { The requested metafile operation is not supported. }
  {$EXTERNALSYM ERROR_METAFILE_NOT_SUPPORTED}
  ERROR_METAFILE_NOT_SUPPORTED = 2003;

  { The requested transformation operation is not supported. }
  {$EXTERNALSYM ERROR_TRANSFORM_NOT_SUPPORTED}
  ERROR_TRANSFORM_NOT_SUPPORTED = 2004;

  { The requested clipping operation is not supported. }
  {$EXTERNALSYM ERROR_CLIPPING_NOT_SUPPORTED}
  ERROR_CLIPPING_NOT_SUPPORTED = 2005;


{ Win32 Spooler Error Codes }

  { The specified print monitor is unknown. }
  {$EXTERNALSYM ERROR_UNKNOWN_PRINT_MONITOR}
  ERROR_UNKNOWN_PRINT_MONITOR = 3000;

  { The specified printer driver is currently in use. }
  {$EXTERNALSYM ERROR_PRINTER_DRIVER_IN_USE}
  ERROR_PRINTER_DRIVER_IN_USE = 3001;

  { The spool file was not found. }
  {$EXTERNALSYM ERROR_SPOOL_FILE_NOT_FOUND}
  ERROR_SPOOL_FILE_NOT_FOUND = 3002;

  { A StartDocPrinter call was not issued. }
  {$EXTERNALSYM ERROR_SPL_NO_STARTDOC}
  ERROR_SPL_NO_STARTDOC = 3003;

  { An AddJob call was not issued. }
  {$EXTERNALSYM ERROR_SPL_NO_ADDJOB}
  ERROR_SPL_NO_ADDJOB = 3004;

  { The specified print processor has already been installed. }
  {$EXTERNALSYM ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED}
  ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005;

  { The specified print monitor has already been installed. }
  {$EXTERNALSYM ERROR_PRINT_MONITOR_ALREADY_INSTALLED}
  ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006;

  { The specified print monitor does not have the required functions. }
  {$EXTERNALSYM ERROR_INVALID_PRINT_MONITOR}
  ERROR_INVALID_PRINT_MONITOR = 3007;

  { The specified print monitor is currently in use. }
  {$EXTERNALSYM ERROR_PRINT_MONITOR_IN_USE}
  ERROR_PRINT_MONITOR_IN_USE = 3008;

  { The requested operation is not allowed when there are jobs queued to the printer. }
  {$EXTERNALSYM ERROR_PRINTER_HAS_JOBS_QUEUED}
  ERROR_PRINTER_HAS_JOBS_QUEUED = 3009;

  { The requested operation is successful.  Changes will not be effective until the system is rebooted. }
  {$EXTERNALSYM ERROR_SUCCESS_REBOOT_REQUIRED}
  ERROR_SUCCESS_REBOOT_REQUIRED = 3010;

  { The requested operation is successful.  Changes will not be effective until the service is restarted. }
  {$EXTERNALSYM ERROR_SUCCESS_RESTART_REQUIRED}
  ERROR_SUCCESS_RESTART_REQUIRED = 3011;


{ Wins Error Codes }

  { WINS encountered an error while processing the command. }
  {$EXTERNALSYM ERROR_WINS_INTERNAL}
  ERROR_WINS_INTERNAL = 4000;

  { The local WINS can not be deleted. }
  {$EXTERNALSYM ERROR_CAN_NOT_DEL_LOCAL_WINS}
  ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001;

  { The importation from the file failed. }
  {$EXTERNALSYM ERROR_STATIC_INIT}
  ERROR_STATIC_INIT = 4002;

  { The backup Failed.  Was a full backup done before ? }
  {$EXTERNALSYM ERROR_INC_BACKUP}
  ERROR_INC_BACKUP = 4003;

  { The backup Failed.  Check the directory that you are backing the database to. }
  {$EXTERNALSYM ERROR_FULL_BACKUP}
  ERROR_FULL_BACKUP = 4004;

  { The name does not exist in the WINS database. }
  {$EXTERNALSYM ERROR_REC_NON_EXISTENT}
  ERROR_REC_NON_EXISTENT = 4005;

  { Replication with a non-configured partner is not allowed. }
  {$EXTERNALSYM ERROR_RPL_NOT_ALLOWED}
  ERROR_RPL_NOT_ALLOWED = 4006;


{------------------------------}
{     OLE Error Codes          }
{------------------------------}

(*
  The return value of OLE APIs and methods is an HRESULT.
  This is not a handle to anything, but is merely a 32-bit value
  with several fields encoded in the value.  The parts of an
  HRESULT are shown below.

  HRESULTs are 32 bit values layed out as follows:

   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  +-+-+-+-+-+---------------------+-------------------------------+
  |S|R|C|N|r|    Facility         |               Code            |
  +-+-+-+-+-+---------------------+-------------------------------+

  where

      S - Severity - indicates success/fail
          0 - Success
          1 - Fail (COERROR)

      R - reserved portion of the facility code, corresponds to NT's
              second severity bit.

      C - reserved portion of the facility code, corresponds to NT's
              C field.

      N - reserved portion of the facility code. Used to indicate a
              mapped NT status value.

      r - reserved portion of the facility code. Reserved for internal
              use. Used to indicate HRESULT values that are not status
              values, but are instead message ids for display strings.

      Facility - is the facility code

      Code - is the facility's status code
*)

const
  { Severity values }
  {$EXTERNALSYM SEVERITY_SUCCESS}
  SEVERITY_SUCCESS = 0;
  {$EXTERNALSYM SEVERITY_ERROR}
  SEVERITY_ERROR = 1;

function Succeeded(Status: HRESULT): BOOL;

{ and the inverse }
function Failed(Status: HRESULT): BOOL;

{ Generic test for error on any status value. }
function IsError(Status: HRESULT): BOOL;

{ Return the code }
function HResultCode(hr: HRESULT): Integer;

{ Return the facility }
function HResultFacility(hr: HRESULT): Integer;

{ Return the severity }
function HResultSeverity(hr: HRESULT): Integer;

{ Create an HRESULT value from component pieces }
{$EXTERNALSYM MakeResult}
function MakeResult(sev, fac, code: Integer): HResult;

{ Map a WIN32 error value into a HRESULT }
{ Note: This assumes that WIN32 errors fall in the range -32k to 32k. }
const
  { Define bits here so macros are guaranteed to work }
  {$EXTERNALSYM FACILITY_NT_BIT}
  FACILITY_NT_BIT = $10000000;
function HResultFromWin32(x: Integer): HRESULT;

{ Map an NT status value into a HRESULT }
function HResultFromNT(x: Integer): HRESULT;

const
  { HRESULT value definitions }
  { Codes $4000-$40ff are reserved for OLE }

  { Success codes }
  {$EXTERNALSYM S_OK}
  S_OK    = $00000000;
  {$EXTERNALSYM S_FALSE}
  S_FALSE = $00000001;

  {$EXTERNALSYM NOERROR}
  NOERROR = 0;

  { Catastrophic failure }
  {$EXTERNALSYM E_UNEXPECTED}
  E_UNEXPECTED = DWORD($8000FFFF);

  { Not implemented }
  {$EXTERNALSYM E_NOTIMPL}
  E_NOTIMPL = DWORD($80004001);

  { Ran out of memory }
  {$EXTERNALSYM E_OUTOFMEMORY}
  E_OUTOFMEMORY = DWORD($8007000E);

  { One or more arguments are invalid }
  {$EXTERNALSYM E_INVALIDARG}
  E_INVALIDARG = DWORD($80070057);

  { No such interface supported }
  {$EXTERNALSYM E_NOINTERFACE}
  E_NOINTERFACE = DWORD($80004002);

  { Invalid pointer }
  {$EXTERNALSYM E_POINTER}
  E_POINTER = DWORD($80004003);

  { Invalid handle }
  {$EXTERNALSYM E_HANDLE}
  E_HANDLE = DWORD($80070006);

  { Operation aborted }
  {$EXTERNALSYM E_ABORT}
  E_ABORT = DWORD($80004004);

  { Unspecified error }
  {$EXTERNALSYM E_FAIL}
  E_FAIL = DWORD($80004005);

  { General access denied error }
  {$EXTERNALSYM E_ACCESSDENIED}
  E_ACCESSDENIED = DWORD($80070005);

  { The data necessary to complete this operation is not yet available. }
  {$EXTERNALSYM E_PENDING}
  E_PENDING = DWORD($8000000A);

  { Thread local storage failure }
  {$EXTERNALSYM CO_E_INIT_TLS}
  CO_E_INIT_TLS = DWORD($80004006);

  { Get shared memory allocator failure }
  {$EXTERNALSYM CO_E_INIT_SHARED_ALLOCATOR}
  CO_E_INIT_SHARED_ALLOCATOR = DWORD($80004007);

  { Get memory allocator failure }
  {$EXTERNALSYM CO_E_INIT_MEMORY_ALLOCATOR}
  CO_E_INIT_MEMORY_ALLOCATOR = DWORD($80004008);

  { Unable to initialize class cache }
  {$EXTERNALSYM CO_E_INIT_CLASS_CACHE}
  CO_E_INIT_CLASS_CACHE = DWORD($80004009);

  { Unable to initialize RPC services }
  {$EXTERNALSYM CO_E_INIT_RPC_CHANNEL}
  CO_E_INIT_RPC_CHANNEL = DWORD($8000400A);

  { Cannot set thread local storage channel control }
  {$EXTERNALSYM CO_E_INIT_TLS_SET_CHANNEL_CONTROL}
  CO_E_INIT_TLS_SET_CHANNEL_CONTROL = DWORD($8000400B);

  { Could not allocate thread local storage channel control }
  {$EXTERNALSYM CO_E_INIT_TLS_CHANNEL_CONTROL}
  CO_E_INIT_TLS_CHANNEL_CONTROL = DWORD($8000400C);

  { The user supplied memory allocator is unacceptable }
  {$EXTERNALSYM CO_E_INIT_UNACCEPTED_USER_ALLOCATOR}
  CO_E_INIT_UNACCEPTED_USER_ALLOCATOR = DWORD($8000400D);

  { The OLE service mutex already exists }
  {$EXTERNALSYM CO_E_INIT_SCM_MUTEX_EXISTS}
  CO_E_INIT_SCM_MUTEX_EXISTS = DWORD($8000400E);

  { The OLE service file mapping already exists }
  {$EXTERNALSYM CO_E_INIT_SCM_FILE_MAPPING_EXISTS}
  CO_E_INIT_SCM_FILE_MAPPING_EXISTS = DWORD($8000400F);

  { Unable to map view of file for OLE service }
  {$EXTERNALSYM CO_E_INIT_SCM_MAP_VIEW_OF_FILE}
  CO_E_INIT_SCM_MAP_VIEW_OF_FILE = DWORD($80004010);

  { Failure attempting to launch OLE service }
  {$EXTERNALSYM CO_E_INIT_SCM_EXEC_FAILURE}
  CO_E_INIT_SCM_EXEC_FAILURE = DWORD($80004011);

  { There was an attempt to call CoInitialize a second time while single threaded }
  {$EXTERNALSYM CO_E_INIT_ONLY_SINGLE_THREADED}
  CO_E_INIT_ONLY_SINGLE_THREADED = DWORD($80004012);

  { A Remote activation was necessary but was not allowed }
  {$EXTERNALSYM CO_E_CANT_REMOTE}
  CO_E_CANT_REMOTE = DWORD($80004013);

  { A Remote activation was necessary but the server name provided was invalid }
  {$EXTERNALSYM CO_E_BAD_SERVER_NAME}
  CO_E_BAD_SERVER_NAME = DWORD($80004014);

  { The class is configured to run as a security id different from the caller }
  {$EXTERNALSYM CO_E_WRONG_SERVER_IDENTITY}
  CO_E_WRONG_SERVER_IDENTITY = DWORD($80004015);

  { Use of Ole1 services requiring DDE windows is disabled }
  {$EXTERNALSYM CO_E_OLE1DDE_DISABLED}
  CO_E_OLE1DDE_DISABLED = DWORD($80004016);

  { A RunAs specification must be <domain name>\<user name> or simply <user name> }
  {$EXTERNALSYM CO_E_RUNAS_SYNTAX}
  CO_E_RUNAS_SYNTAX = DWORD($80004017);

  { The server process could not be started.  The pathname may be incorrect. }
  {$EXTERNALSYM CO_E_CREATEPROCESS_FAILURE}
  CO_E_CREATEPROCESS_FAILURE = DWORD($80004018);

  { The server process could not be started as the configured identity.  The pathname may be incorrect or unavailable. }
  {$EXTERNALSYM CO_E_RUNAS_CREATEPROCESS_FAILURE}
  CO_E_RUNAS_CREATEPROCESS_FAILURE = DWORD($80004019);

  { The server process could not be started because the configured identity is incorrect.  Check the username and password. }
  {$EXTERNALSYM CO_E_RUNAS_LOGON_FAILURE}
  CO_E_RUNAS_LOGON_FAILURE = DWORD($8000401A);

  { The client is not allowed to launch this server. }
  {$EXTERNALSYM CO_E_LAUNCH_PERMSSION_DENIED}
  CO_E_LAUNCH_PERMSSION_DENIED = DWORD($8000401B);

  { The service providing this server could not be started. }
  {$EXTERNALSYM CO_E_START_SERVICE_FAILURE}
  CO_E_START_SERVICE_FAILURE = DWORD($8000401C);

  { This computer was unable to communicate with the computer providing the server. }
  {$EXTERNALSYM CO_E_REMOTE_COMMUNICATION_FAILURE}
  CO_E_REMOTE_COMMUNICATION_FAILURE = DWORD($8000401D);

  { The server did not respond after being launched. }
  {$EXTERNALSYM CO_E_SERVER_START_TIMEOUT}
  CO_E_SERVER_START_TIMEOUT = DWORD($8000401E);

  { The registration information for this server is inconsistent or incomplete. }
  {$EXTERNALSYM CO_E_CLSREG_INCONSISTENT}
  CO_E_CLSREG_INCONSISTENT = DWORD($8000401F);

  { The registration information for this interface is inconsistent or incomplete. }
  {$EXTERNALSYM CO_E_IIDREG_INCONSISTENT}
  CO_E_IIDREG_INCONSISTENT = DWORD($80004020);

  { The operation attempted is not supported. }
  {$EXTERNALSYM CO_E_NOT_SUPPORTED}
  CO_E_NOT_SUPPORTED = DWORD($80004021);


  { FACILITY_ITF }
  { Codes $0-$01ff are reserved for the OLE group of }

  { Generic OLE errors that may be returned by many inerfaces}
  {$EXTERNALSYM OLE_E_FIRST}
  OLE_E_FIRST = DWORD($80040000);
  {$EXTERNALSYM OLE_E_LAST}
  OLE_E_LAST  = DWORD($800400FF);
  {$EXTERNALSYM OLE_S_FIRST}
  OLE_S_FIRST = $40000;
  {$EXTERNALSYM OLE_S_LAST}
  OLE_S_LAST  = $400FF;

  { Invalid OLEVERB structure }
  {$EXTERNALSYM OLE_E_OLEVERB}
  OLE_E_OLEVERB = DWORD($80040000);

  { Invalid advise flags }
  {$EXTERNALSYM OLE_E_ADVF}
  OLE_E_ADVF = DWORD($80040001);

  { Can't enumerate any more, because the associated data is missing }
  {$EXTERNALSYM OLE_E_ENUM_NOMORE}
  OLE_E_ENUM_NOMORE = DWORD($80040002);

  { This implementation doesn't take advises }
  {$EXTERNALSYM OLE_E_ADVISENOTSUPPORTED}
  OLE_E_ADVISENOTSUPPORTED = DWORD($80040003);

  { There is no connection for this connection ID }
  {$EXTERNALSYM OLE_E_NOCONNECTION}
  OLE_E_NOCONNECTION = DWORD($80040004);

  { Need to run the object to perform this operation }
  {$EXTERNALSYM OLE_E_NOTRUNNING}
  OLE_E_NOTRUNNING = DWORD($80040005);

  { There is no cache to operate on }
  {$EXTERNALSYM OLE_E_NOCACHE}
  OLE_E_NOCACHE = DWORD($80040006);

  { Uninitialized object }
  {$EXTERNALSYM OLE_E_BLANK}
  OLE_E_BLANK = DWORD($80040007);

  { Linked object's source class has changed }
  {$EXTERNALSYM OLE_E_CLASSDIFF}
  OLE_E_CLASSDIFF = DWORD($80040008);

  { Not able to get the moniker of the object }
  {$EXTERNALSYM OLE_E_CANT_GETMONIKER}
  OLE_E_CANT_GETMONIKER = DWORD($80040009);

  { Not able to bind to the source }
  {$EXTERNALSYM OLE_E_CANT_BINDTOSOURCE}
  OLE_E_CANT_BINDTOSOURCE = DWORD($8004000A);

  { Object is static; operation not allowed }
  {$EXTERNALSYM OLE_E_STATIC}
  OLE_E_STATIC = DWORD($8004000B);

  { User cancelled out of save dialog }
  {$EXTERNALSYM OLE_E_PROMPTSAVECANCELLED}
  OLE_E_PROMPTSAVECANCELLED = DWORD($8004000C);

  { Invalid rectangle }
  {$EXTERNALSYM OLE_E_INVALIDRECT}
  OLE_E_INVALIDRECT = DWORD($8004000D);

  { compobj.dll is too old for the ole2.dll initialized }
  {$EXTERNALSYM OLE_E_WRONGCOMPOBJ}
  OLE_E_WRONGCOMPOBJ = DWORD($8004000E);

  { Invalid window handle }
  {$EXTERNALSYM OLE_E_INVALIDHWND}
  OLE_E_INVALIDHWND = DWORD($8004000F);

  { Object is not in any of the inplace active states }
  {$EXTERNALSYM OLE_E_NOT_INPLACEACTIVE}
  OLE_E_NOT_INPLACEACTIVE = DWORD($80040010);

  { Not able to convert object }
  {$EXTERNALSYM OLE_E_CANTCONVERT}
  OLE_E_CANTCONVERT = DWORD($80040011);

  {$EXTERNALSYM OLE_E_NOSTORAGE}
  OLE_E_NOSTORAGE = DWORD($80040012);

  { Invalid FORMATETC structure }
  {$EXTERNALSYM DV_E_FORMATETC}
  DV_E_FORMATETC = DWORD($80040064);

  { Invalid DVTARGETDEVICE structure }
  {$EXTERNALSYM DV_E_DVTARGETDEVICE}
  DV_E_DVTARGETDEVICE = DWORD($80040065);

  { Invalid STDGMEDIUM structure }
  {$EXTERNALSYM DV_E_STGMEDIUM}
  DV_E_STGMEDIUM = DWORD($80040066);

  { Invalid STATDATA structure }
  {$EXTERNALSYM DV_E_STATDATA}
  DV_E_STATDATA = DWORD($80040067);

  { Invalid lindex }
  {$EXTERNALSYM DV_E_LINDEX}
  DV_E_LINDEX = DWORD($80040068);

  { Invalid tymed }
  {$EXTERNALSYM DV_E_TYMED}
  DV_E_TYMED = DWORD($80040069);

  { Invalid clipboard format }
  {$EXTERNALSYM DV_E_CLIPFORMAT}
  DV_E_CLIPFORMAT = DWORD($8004006A);

  { Invalid aspect(s) }
  {$EXTERNALSYM DV_E_DVASPECT}
  DV_E_DVASPECT = DWORD($8004006B);

  { tdSize parameter of the DVTARGETDEVICE structure is invalid }
  {$EXTERNALSYM DV_E_DVTARGETDEVICE_SIZE}
  DV_E_DVTARGETDEVICE_SIZE = DWORD($8004006C);

  { Object doesn't support IViewObject interface }
  {$EXTERNALSYM DV_E_NOIVIEWOBJECT}
  DV_E_NOIVIEWOBJECT = DWORD($8004006D);

  {$EXTERNALSYM DRAGDROP_E_FIRST}
  DRAGDROP_E_FIRST = DWORD($80040100);
  {$EXTERNALSYM DRAGDROP_E_LAST}
  DRAGDROP_E_LAST  = DWORD($8004010F);
  {$EXTERNALSYM DRAGDROP_S_FIRST}
  DRAGDROP_S_FIRST = $40100;

  { Trying to revoke a drop target that has not been registered }
  {$EXTERNALSYM DRAGDROP_E_NOTREGISTERED}
  DRAGDROP_E_NOTREGISTERED = DWORD($80040100);

  { This window has already been registered as a drop target }
  {$EXTERNALSYM DRAGDROP_E_ALREADYREGISTERED}
  DRAGDROP_E_ALREADYREGISTERED = DWORD($80040101);

  { Invalid window handle }
  {$EXTERNALSYM DRAGDROP_E_INVALIDHWND}
  DRAGDROP_E_INVALIDHWND = DWORD($80040102);

  {$EXTERNALSYM CLASSFACTORY_E_FIRST}
  CLASSFACTORY_E_FIRST = DWORD($80040110);
  {$EXTERNALSYM CLASSFACTORY_E_LAST}
  CLASSFACTORY_E_LAST  = DWORD($8004011F);
  {$EXTERNALSYM CLASSFACTORY_S_FIRST}
  CLASSFACTORY_S_FIRST = $40110;

  { Class does not support aggregation (or class object is remote) }
  {$EXTERNALSYM CLASS_E_NOAGGREGATION}
  CLASS_E_NOAGGREGATION = DWORD($80040110);

  { ClassFactory cannot supply requested class }
  {$EXTERNALSYM CLASS_E_CLASSNOTAVAILABLE}
  CLASS_E_CLASSNOTAVAILABLE = DWORD($80040111);

  {$EXTERNALSYM MARSHAL_E_FIRST}
  MARSHAL_E_FIRST = DWORD($80040120);
  {$EXTERNALSYM MARSHAL_E_LAST}
  MARSHAL_E_LAST  = DWORD($8004012F);
  {$EXTERNALSYM MARSHAL_S_FIRST}
  MARSHAL_S_FIRST = $40120;
  {$EXTERNALSYM MARSHAL_S_LAST}
  MARSHAL_S_LAST  = $4012F;
  {$EXTERNALSYM DATA_E_FIRST}
  DATA_E_FIRST    = DWORD($80040130);
  {$EXTERNALSYM DATA_E_LAST}
  DATA_E_LAST     = DWORD($8004013F);
  {$EXTERNALSYM DATA_S_FIRST}
  DATA_S_FIRST    = $40130;
  {$EXTERNALSYM DATA_S_LAST}
  DATA_S_LAST     = $4013F;
  {$EXTERNALSYM VIEW_E_FIRST}
  VIEW_E_FIRST    = DWORD($80040140);
  {$EXTERNALSYM VIEW_E_LAST}
  VIEW_E_LAST     = DWORD($8004014F);
  {$EXTERNALSYM VIEW_S_FIRST}
  VIEW_S_FIRST    = $40140;

  { Error drawing view }
  {$EXTERNALSYM VIEW_E_DRAW}
  VIEW_E_DRAW = DWORD($80040140);

  {$EXTERNALSYM REGDB_E_FIRST}
  REGDB_E_FIRST = DWORD($80040150);
  {$EXTERNALSYM REGDB_E_LAST}
  REGDB_E_LAST  = DWORD($8004015F);
  {$EXTERNALSYM REGDB_S_FIRST}
  REGDB_S_FIRST = $40150;

  { Could not read key from registry }
  {$EXTERNALSYM REGDB_E_READREGDB}
  REGDB_E_READREGDB = DWORD($80040150);

  { Could not write key to registry }
  {$EXTERNALSYM REGDB_E_WRITEREGDB}
  REGDB_E_WRITEREGDB = DWORD($80040151);

  { Could not find the key in the registry }
  {$EXTERNALSYM REGDB_E_KEYMISSING}
  REGDB_E_KEYMISSING = DWORD($80040152);

  { Invalid value for registry }
  {$EXTERNALSYM REGDB_E_INVALIDVALUE}
  REGDB_E_INVALIDVALUE = DWORD($80040153);

  { Class not registered }
  {$EXTERNALSYM REGDB_E_CLASSNOTREG}
  REGDB_E_CLASSNOTREG = DWORD($80040154);

  { Interface not registered }
  {$EXTERNALSYM REGDB_E_IIDNOTREG}
  REGDB_E_IIDNOTREG = DWORD($80040155);

  {$EXTERNALSYM CACHE_E_FIRST}
  CACHE_E_FIRST = DWORD($80040170);
  {$EXTERNALSYM CACHE_E_LAST}
  CACHE_E_LAST  = DWORD($8004017F);
  {$EXTERNALSYM CACHE_S_FIRST}
  CACHE_S_FIRST = $40170;

  { Cache not updated }
  {$EXTERNALSYM CACHE_E_NOCACHE_UPDATED}
  CACHE_E_NOCACHE_UPDATED = DWORD($80040170);

  {$EXTERNALSYM OLEOBJ_E_FIRST}
  OLEOBJ_E_FIRST = DWORD($80040180);
  {$EXTERNALSYM OLEOBJ_E_LAST}
  OLEOBJ_E_LAST  = DWORD($8004018F);
  {$EXTERNALSYM OLEOBJ_S_FIRST}
  OLEOBJ_S_FIRST = $40180;

  { No verbs for OLE object }
  {$EXTERNALSYM OLEOBJ_E_NOVERBS}
  OLEOBJ_E_NOVERBS = DWORD($80040180);

  { Invalid verb for OLE object }
  {$EXTERNALSYM OLEOBJ_E_INVALIDVERB}
  OLEOBJ_E_INVALIDVERB = DWORD($80040181);

  {$EXTERNALSYM CLIENTSITE_E_FIRST}
  CLIENTSITE_E_FIRST = DWORD($80040190);
  {$EXTERNALSYM CLIENTSITE_E_LAST}
  CLIENTSITE_E_LAST = DWORD($8004019F);
  {$EXTERNALSYM CLIENTSITE_S_FIRST}
  CLIENTSITE_S_FIRST = $40190;

  { Undo is not available }
  {$EXTERNALSYM INPLACE_E_NOTUNDOABLE}
  INPLACE_E_NOTUNDOABLE = DWORD($800401A0);

  { Space for tools is not available }
  {$EXTERNALSYM INPLACE_E_NOTOOLSPACE}
  INPLACE_E_NOTOOLSPACE = DWORD($800401A1);

  {$EXTERNALSYM INPLACE_E_FIRST}
  INPLACE_E_FIRST = DWORD($800401A0);
  {$EXTERNALSYM INPLACE_E_LAST}
  INPLACE_E_LAST  = DWORD($800401AF);
  {$EXTERNALSYM INPLACE_S_FIRST}
  INPLACE_S_FIRST = $401A0;
  {$EXTERNALSYM INPLACE_S_LAST}
  INPLACE_S_LAST  = $401AF;
  {$EXTERNALSYM ENUM_E_FIRST}
  ENUM_E_FIRST = DWORD($800401B0);
  {$EXTERNALSYM ENUM_E_LAST}
  ENUM_E_LAST  = DWORD($800401BF);
  {$EXTERNALSYM ENUM_S_FIRST}
  ENUM_S_FIRST = $401B0;
  {$EXTERNALSYM ENUM_S_LAST}
  ENUM_S_LAST  = $401BF;
  {$EXTERNALSYM CONVERT10_E_FIRST}
  CONVERT10_E_FIRST = DWORD($800401C0);
  {$EXTERNALSYM CONVERT10_E_LAST}
  CONVERT10_E_LAST  = DWORD($800401CF);
  {$EXTERNALSYM CONVERT10_S_FIRST}
  CONVERT10_S_FIRST = $401C0;

  { OLESTREAM Get method failed }
  {$EXTERNALSYM CONVERT10_E_OLESTREAM_GET}
  CONVERT10_E_OLESTREAM_GET = DWORD($800401C0);

  { OLESTREAM Put method failed }
  {$EXTERNALSYM CONVERT10_E_OLESTREAM_PUT}
  CONVERT10_E_OLESTREAM_PUT = DWORD($800401C1);

  { Contents of the OLESTREAM not in correct format }
  {$EXTERNALSYM CONVERT10_E_OLESTREAM_FMT}
  CONVERT10_E_OLESTREAM_FMT = DWORD($800401C2);

  { There was an error in a Windows GDI call while converting the bitmap to a DIB }
  {$EXTERNALSYM CONVERT10_E_OLESTREAM_BITMAP_TO_DIB}
  CONVERT10_E_OLESTREAM_BITMAP_TO_DIB = DWORD($800401C3);

  { Contents of the IStorage not in correct format }
  {$EXTERNALSYM CONVERT10_E_STG_FMT}
  CONVERT10_E_STG_FMT = DWORD($800401C4);

  { Contents of IStorage is missing one of the standard streams }
  {$EXTERNALSYM CONVERT10_E_STG_NO_STD_STREAM}
  CONVERT10_E_STG_NO_STD_STREAM = DWORD($800401C5);

  {$EXTERNALSYM CONVERT10_E_STG_DIB_TO_BITMAP}
  CONVERT10_E_STG_DIB_TO_BITMAP = DWORD($800401C6);

  {$EXTERNALSYM CLIPBRD_E_FIRST}
  CLIPBRD_E_FIRST = DWORD($800401D0);
  {$EXTERNALSYM CLIPBRD_E_LAST}
  CLIPBRD_E_LAST  = DWORD($800401DF);
  {$EXTERNALSYM CLIPBRD_S_FIRST}
  CLIPBRD_S_FIRST = $401D0;

  { OpenClipboard Failed }
  {$EXTERNALSYM CLIPBRD_E_CANT_OPEN}
  CLIPBRD_E_CANT_OPEN = DWORD($800401D0);

  { EmptyClipboard Failed }
  {$EXTERNALSYM CLIPBRD_E_CANT_EMPTY}
  CLIPBRD_E_CANT_EMPTY = DWORD($800401D1);

  { SetClipboard Failed }
  {$EXTERNALSYM CLIPBRD_E_CANT_SET}
  CLIPBRD_E_CANT_SET = DWORD($800401D2);

  { Data on clipboard is invalid }
  {$EXTERNALSYM CLIPBRD_E_BAD_DATA}
  CLIPBRD_E_BAD_DATA = DWORD($800401D3);

  { CloseClipboard Failed }
  {$EXTERNALSYM CLIPBRD_E_CANT_CLOSE}
  CLIPBRD_E_CANT_CLOSE = DWORD($800401D4);

  {$EXTERNALSYM MK_E_FIRST}
  MK_E_FIRST = DWORD($800401E0);
  {$EXTERNALSYM MK_E_LAST}
  MK_E_LAST  = DWORD($800401EF);
  {$EXTERNALSYM MK_S_FIRST}
  MK_S_FIRST = $401E0;

  { Moniker needs to be connected manually }
  {$EXTERNALSYM MK_E_CONNECTMANUALLY}
  MK_E_CONNECTMANUALLY = DWORD($800401E0);

  { Operation exceeded deadline }
  {$EXTERNALSYM MK_E_EXCEEDEDDEADLINE}
  MK_E_EXCEEDEDDEADLINE = DWORD($800401E1);

  { Moniker needs to be generic }
  {$EXTERNALSYM MK_E_NEEDGENERIC}
  MK_E_NEEDGENERIC = DWORD($800401E2);

  { Operation unavailable }
  {$EXTERNALSYM MK_E_UNAVAILABLE}
  MK_E_UNAVAILABLE = DWORD($800401E3);

  { Invalid syntax }
  {$EXTERNALSYM MK_E_SYNTAX}
  MK_E_SYNTAX = DWORD($800401E4);

  { No object for moniker }
  {$EXTERNALSYM MK_E_NOOBJECT}
  MK_E_NOOBJECT = DWORD($800401E5);

  { Bad extension for file }
  {$EXTERNALSYM MK_E_INVALIDEXTENSION}
  MK_E_INVALIDEXTENSION = DWORD($800401E6);

  { Intermediate operation failed }
  {$EXTERNALSYM MK_E_INTERMEDIATEINTERFACENOTSUPPORTED}
  MK_E_INTERMEDIATEINTERFACENOTSUPPORTED = DWORD($800401E7);

  { Moniker is not bindable }
  {$EXTERNALSYM MK_E_NOTBINDABLE}
  MK_E_NOTBINDABLE = DWORD($800401E8);

  { Moniker is not bound }
  {$EXTERNALSYM MK_E_NOTBOUND}
  MK_E_NOTBOUND = DWORD($800401E9);

  { Moniker cannot open file }
  {$EXTERNALSYM MK_E_CANTOPENFILE}
  MK_E_CANTOPENFILE = DWORD($800401EA);

  { User input required for operation to succeed }
  {$EXTERNALSYM MK_E_MUSTBOTHERUSER}
  MK_E_MUSTBOTHERUSER = DWORD($800401EB);

  { Moniker class has no inverse }
  {$EXTERNALSYM MK_E_NOINVERSE}
  MK_E_NOINVERSE = DWORD($800401EC);

  { Moniker does not refer to storage }
  {$EXTERNALSYM MK_E_NOSTORAGE}
  MK_E_NOSTORAGE = DWORD($800401ED);

  { No common prefix }
  {$EXTERNALSYM MK_E_NOPREFIX}
  MK_E_NOPREFIX = DWORD($800401EE);

  { Moniker could not be enumerated }
  {$EXTERNALSYM MK_E_ENUMERATION_FAILED}
  MK_E_ENUMERATION_FAILED = DWORD($800401EF);

  {$EXTERNALSYM CO_E_FIRST}
  CO_E_FIRST = DWORD($800401F0);
  {$EXTERNALSYM CO_E_LAST}
  CO_E_LAST  = DWORD($800401FF);
  {$EXTERNALSYM CO_S_FIRST}
  CO_S_FIRST = $401F0;

  { CoInitialize has not been called. }
  {$EXTERNALSYM CO_E_NOTINITIALIZED}
  CO_E_NOTINITIALIZED = DWORD($800401F0);

  { CoInitialize has already been called. }
  {$EXTERNALSYM CO_E_ALREADYINITIALIZED}
  CO_E_ALREADYINITIALIZED = DWORD($800401F1);

  { Class of object cannot be determined }
  {$EXTERNALSYM CO_E_CANTDETERMINECLASS}
  CO_E_CANTDETERMINECLASS = DWORD($800401F2);

  { Invalid class string }
  {$EXTERNALSYM CO_E_CLASSSTRING}
  CO_E_CLASSSTRING = DWORD($800401F3);

  { Invalid interface string }
  {$EXTERNALSYM CO_E_IIDSTRING}
  CO_E_IIDSTRING = DWORD($800401F4);

  { Application not found }
  {$EXTERNALSYM CO_E_APPNOTFOUND}
  CO_E_APPNOTFOUND = DWORD($800401F5);

  { Application cannot be run more than once }
  {$EXTERNALSYM CO_E_APPSINGLEUSE}
  CO_E_APPSINGLEUSE = DWORD($800401F6);

  { Some error in application program }
  {$EXTERNALSYM CO_E_ERRORINAPP}
  CO_E_ERRORINAPP = DWORD($800401F7);

  { DLL for class not found }
  {$EXTERNALSYM CO_E_DLLNOTFOUND}
  CO_E_DLLNOTFOUND = DWORD($800401F8);

  { Error in the DLL }
  {$EXTERNALSYM CO_E_ERRORINDLL}
  CO_E_ERRORINDLL = DWORD($800401F9);

  { Wrong OS or OS version for application }
  {$EXTERNALSYM CO_E_WRONGOSFORAPP}
  CO_E_WRONGOSFORAPP = DWORD($800401FA);

  { Object is not registered }
  {$EXTERNALSYM CO_E_OBJNOTREG}
  CO_E_OBJNOTREG = DWORD($800401FB);

  { Object is already registered }
  {$EXTERNALSYM CO_E_OBJISREG}
  CO_E_OBJISREG = DWORD($800401FC);

  { Object is not connected to server }
  {$EXTERNALSYM CO_E_OBJNOTCONNECTED}
  CO_E_OBJNOTCONNECTED = DWORD($800401FD);

  { Application was launched but it didn't register a class factory }
  {$EXTERNALSYM CO_E_APPDIDNTREG}
  CO_E_APPDIDNTREG = DWORD($800401FE);

  { Object has been released }
  {$EXTERNALSYM CO_E_RELEASED}
  CO_E_RELEASED = DWORD($800401FF);

  { Use the registry database to provide the requested information }
  {$EXTERNALSYM OLE_S_USEREG}
  OLE_S_USEREG = $40000;

  { Success, but static }
  {$EXTERNALSYM OLE_S_STATIC}
  OLE_S_STATIC = $40001;

  { Macintosh clipboard format }
  {$EXTERNALSYM OLE_S_MAC_CLIPFORMAT}
  OLE_S_MAC_CLIPFORMAT = $40002;

  { Successful drop took place }
  {$EXTERNALSYM DRAGDROP_S_DROP}
  DRAGDROP_S_DROP = $40100;

  { Drag-drop operation canceled }
  {$EXTERNALSYM DRAGDROP_S_CANCEL}
  DRAGDROP_S_CANCEL = $40101;

  { Use the default cursor }
  {$EXTERNALSYM DRAGDROP_S_USEDEFAULTCURSORS}
  DRAGDROP_S_USEDEFAULTCURSORS = $40102;

  { Data has same FORMATETC }
  {$EXTERNALSYM DATA_S_SAMEFORMATETC}
  DATA_S_SAMEFORMATETC = $40130;

  { View is already frozen }
  {$EXTERNALSYM VIEW_S_ALREADY_FROZEN}
  VIEW_S_ALREADY_FROZEN = $40140;

  { FORMATETC not supported }
  {$EXTERNALSYM CACHE_S_FORMATETC_NOTSUPPORTED}
  CACHE_S_FORMATETC_NOTSUPPORTED = $40170;

  { Same cache }
  {$EXTERNALSYM CACHE_S_SAMECACHE}
  CACHE_S_SAMECACHE = $40171;

  { Some cache(s) not updated }
  {$EXTERNALSYM CACHE_S_SOMECACHES_NOTUPDATED}
  CACHE_S_SOMECACHES_NOTUPDATED = $40172;

  { Invalid verb for OLE object }
  {$EXTERNALSYM OLEOBJ_S_INVALIDVERB}
  OLEOBJ_S_INVALIDVERB = $40180;

  { Verb number is valid but verb cannot be done now }
  {$EXTERNALSYM OLEOBJ_S_CANNOT_DOVERB_NOW}
  OLEOBJ_S_CANNOT_DOVERB_NOW = $40181;

  { Invalid window handle passed }
  {$EXTERNALSYM OLEOBJ_S_INVALIDHWND}
  OLEOBJ_S_INVALIDHWND = $40182;

  { Message is too long; some of it had to be truncated before displaying }
  {$EXTERNALSYM INPLACE_S_TRUNCATED}
  INPLACE_S_TRUNCATED = $401A0;

  { Unable to convert OLESTREAM to IStorage }
  {$EXTERNALSYM CONVERT10_S_NO_PRESENTATION}
  CONVERT10_S_NO_PRESENTATION = $401C0;

  { Moniker reduced to itself }
  {$EXTERNALSYM MK_S_REDUCED_TO_SELF}
  MK_S_REDUCED_TO_SELF = $401E2;

  { Common prefix is this moniker }
  {$EXTERNALSYM MK_S_ME}
  MK_S_ME = $401E4;

  { Common prefix is input moniker }
  {$EXTERNALSYM MK_S_HIM}
  MK_S_HIM = $401E5;

  { Common prefix is both monikers }
  {$EXTERNALSYM MK_S_US}
  MK_S_US = $401E6;

  { Moniker is already registered in running object table }
  {$EXTERNALSYM MK_S_MONIKERALREADYREGISTERED}
  MK_S_MONIKERALREADYREGISTERED = $401E7;


  { FACILITY_WINDOWS }
  { Codes $0-$01ff are reserved for the OLE group of}

  { Attempt to create a class object failed }
  {$EXTERNALSYM CO_E_CLASS_CREATE_FAILED}
  CO_E_CLASS_CREATE_FAILED = DWORD($80080001);

  { OLE service could not bind object }
  {$EXTERNALSYM CO_E_SCM_ERROR}
  CO_E_SCM_ERROR = DWORD($80080002);

  { RPC communication failed with OLE service }
  {$EXTERNALSYM CO_E_SCM_RPC_FAILURE}
  CO_E_SCM_RPC_FAILURE = DWORD($80080003);

  { Bad path to object }
  {$EXTERNALSYM CO_E_BAD_PATH}
  CO_E_BAD_PATH = DWORD($80080004);

  { Server execution failed }
  {$EXTERNALSYM CO_E_SERVER_EXEC_FAILURE}
  CO_E_SERVER_EXEC_FAILURE = DWORD($80080005);

  { OLE service could not communicate with the object server }
  {$EXTERNALSYM CO_E_OBJSRV_RPC_FAILURE}
  CO_E_OBJSRV_RPC_FAILURE = DWORD($80080006);

  { Moniker path could not be normalized }
  {$EXTERNALSYM MK_E_NO_NORMALIZED}
  MK_E_NO_NORMALIZED = DWORD($80080007);

  { Object server is stopping when OLE service contacts it }
  {$EXTERNALSYM CO_E_SERVER_STOPPING}
  CO_E_SERVER_STOPPING = DWORD($80080008);

  { An invalid root block pointer was specified }
  {$EXTERNALSYM MEM_E_INVALID_ROOT}
  MEM_E_INVALID_ROOT = DWORD($80080009);

  { An allocation chain contained an invalid link pointer }
  {$EXTERNALSYM MEM_E_INVALID_LINK}
  MEM_E_INVALID_LINK = DWORD($80080010);

  { The requested allocation size was too large }
  {$EXTERNALSYM MEM_E_INVALID_SIZE}
  MEM_E_INVALID_SIZE = DWORD($80080011);

  { Not all the requested interfaces were available }
  {$EXTERNALSYM CO_S_NOTALLINTERFACES}
  CO_S_NOTALLINTERFACES = $00080012;


  { FACILITY_DISPATCH }

  { Unknown interface. }
  {$EXTERNALSYM DISP_E_UNKNOWNINTERFACE}
  DISP_E_UNKNOWNINTERFACE = DWORD($80020001);

  { Member not found. }
  {$EXTERNALSYM DISP_E_MEMBERNOTFOUND}
  DISP_E_MEMBERNOTFOUND = DWORD($80020003);

  { Parameter not found. }
  {$EXTERNALSYM DISP_E_PARAMNOTFOUND}
  DISP_E_PARAMNOTFOUND = DWORD($80020004);

  { Type mismatch. }
  {$EXTERNALSYM DISP_E_TYPEMISMATCH}
  DISP_E_TYPEMISMATCH = DWORD($80020005);

  { Unknown name. }
  {$EXTERNALSYM DISP_E_UNKNOWNNAME}
  DISP_E_UNKNOWNNAME = DWORD($80020006);

  { No named arguments. }
  {$EXTERNALSYM DISP_E_NONAMEDARGS}
  DISP_E_NONAMEDARGS = DWORD($80020007);

  { Bad variable type. }
  {$EXTERNALSYM DISP_E_BADVARTYPE}
  DISP_E_BADVARTYPE = DWORD($80020008);

  { Exception occurred. }
  {$EXTERNALSYM DISP_E_EXCEPTION}
  DISP_E_EXCEPTION = DWORD($80020009);

  { Out of present range. }
  {$EXTERNALSYM DISP_E_OVERFLOW}
  DISP_E_OVERFLOW = DWORD($8002000A);

  { Invalid index. }
  {$EXTERNALSYM DISP_E_BADINDEX}
  DISP_E_BADINDEX = DWORD($8002000B);

  { Unknown language. }
  {$EXTERNALSYM DISP_E_UNKNOWNLCID}
  DISP_E_UNKNOWNLCID = DWORD($8002000C);

  { Memory is locked. }
  {$EXTERNALSYM DISP_E_ARRAYISLOCKED}
  DISP_E_ARRAYISLOCKED = DWORD($8002000D);

  { Invalid number of parameters. }
  {$EXTERNALSYM DISP_E_BADPARAMCOUNT}
  DISP_E_BADPARAMCOUNT = DWORD($8002000E);

  { Parameter not optional. }
  {$EXTERNALSYM DISP_E_PARAMNOTOPTIONAL}
  DISP_E_PARAMNOTOPTIONAL = DWORD($8002000F);

  { Invalid callee. }
  {$EXTERNALSYM DISP_E_BADCALLEE}
  DISP_E_BADCALLEE = DWORD($80020010);

  { Does not support a collection. }
  {$EXTERNALSYM DISP_E_NOTACOLLECTION}
  DISP_E_NOTACOLLECTION = DWORD($80020011);

  { Buffer too small. }
  {$EXTERNALSYM TYPE_E_BUFFERTOOSMALL}
  TYPE_E_BUFFERTOOSMALL = DWORD($80028016);

  { Old format or invalid type library. }
  {$EXTERNALSYM TYPE_E_INVDATAREAD}
  TYPE_E_INVDATAREAD = DWORD($80028018);

  { Old format or invalid type library. }
  {$EXTERNALSYM TYPE_E_UNSUPFORMAT}
  TYPE_E_UNSUPFORMAT = DWORD($80028019);

  { Error accessing the OLE registry. }
  {$EXTERNALSYM TYPE_E_REGISTRYACCESS}
  TYPE_E_REGISTRYACCESS = DWORD($8002801C);

  { Library not registered. }
  {$EXTERNALSYM TYPE_E_LIBNOTREGISTERED}
  TYPE_E_LIBNOTREGISTERED = DWORD($8002801D);

  { Bound to unknown type. }
  {$EXTERNALSYM TYPE_E_UNDEFINEDTYPE}
  TYPE_E_UNDEFINEDTYPE = DWORD($80028027);

  { Qualified name disallowed. }
  {$EXTERNALSYM TYPE_E_QUALIFIEDNAMEDISALLOWED}
  TYPE_E_QUALIFIEDNAMEDISALLOWED = DWORD($80028028);

  { Invalid forward reference, or reference to uncompiled type. }
  {$EXTERNALSYM TYPE_E_INVALIDSTATE}
  TYPE_E_INVALIDSTATE = DWORD($80028029);

  { Type mismatch. }
  {$EXTERNALSYM TYPE_E_WRONGTYPEKIND}
  TYPE_E_WRONGTYPEKIND = DWORD($8002802A);

  { Element not found. }
  {$EXTERNALSYM TYPE_E_ELEMENTNOTFOUND}
  TYPE_E_ELEMENTNOTFOUND = DWORD($8002802B);

  { Ambiguous name. }
  {$EXTERNALSYM TYPE_E_AMBIGUOUSNAME}
  TYPE_E_AMBIGUOUSNAME = DWORD($8002802C);

  { Name already exists in the library. }
  {$EXTERNALSYM TYPE_E_NAMECONFLICT}
  TYPE_E_NAMECONFLICT = DWORD($8002802D);

  { Unknown LCID. }
  {$EXTERNALSYM TYPE_E_UNKNOWNLCID}
  TYPE_E_UNKNOWNLCID = DWORD($8002802E);

  { Function not defined in specified DLL. }
  {$EXTERNALSYM TYPE_E_DLLFUNCTIONNOTFOUND}
  TYPE_E_DLLFUNCTIONNOTFOUND = DWORD($8002802F);

  { Wrong module kind for the operation. }
  {$EXTERNALSYM TYPE_E_BADMODULEKIND}
  TYPE_E_BADMODULEKIND = DWORD($800288BD);

  { Size may not exceed 64K. }
  {$EXTERNALSYM TYPE_E_SIZETOOBIG}
  TYPE_E_SIZETOOBIG = DWORD($800288C5);

  { Duplicate ID in inheritance hierarchy. }
  {$EXTERNALSYM TYPE_E_DUPLICATEID}
  TYPE_E_DUPLICATEID = DWORD($800288C6);

  { Incorrect inheritance depth in standard OLE hmember. }
  {$EXTERNALSYM TYPE_E_INVALIDID}
  TYPE_E_INVALIDID = DWORD($800288CF);

  { Type mismatch. }
  {$EXTERNALSYM TYPE_E_TYPEMISMATCH}
  TYPE_E_TYPEMISMATCH = DWORD($80028CA0);

  { Invalid number of arguments. }
  {$EXTERNALSYM TYPE_E_OUTOFBOUNDS}
  TYPE_E_OUTOFBOUNDS = DWORD($80028CA1);

  { I/O Error. }
  {$EXTERNALSYM TYPE_E_IOERROR}
  TYPE_E_IOERROR = DWORD($80028CA2);

  { Error creating unique tmp file. }
  {$EXTERNALSYM TYPE_E_CANTCREATETMPFILE}
  TYPE_E_CANTCREATETMPFILE = DWORD($80028CA3);

  { Error loading type library/DLL. }
  {$EXTERNALSYM TYPE_E_CANTLOADLIBRARY}
  TYPE_E_CANTLOADLIBRARY = DWORD($80029C4A);

  { Inconsistent property functions. }
  {$EXTERNALSYM TYPE_E_INCONSISTENTPROPFUNCS}
  TYPE_E_INCONSISTENTPROPFUNCS = DWORD($80029C83);

  { Circular dependency between types/modules. }
  {$EXTERNALSYM TYPE_E_CIRCULARTYPE}
  TYPE_E_CIRCULARTYPE = DWORD($80029C84);


  { FACILITY_STORAGE }

  { Unable to perform requested operation. }
  {$EXTERNALSYM STG_E_INVALIDFUNCTION}
  STG_E_INVALIDFUNCTION = DWORD($80030001);

  { %l could not be found. }
  {$EXTERNALSYM STG_E_FILENOTFOUND}
  STG_E_FILENOTFOUND = DWORD($80030002);

  { The path %l could not be found. }
  {$EXTERNALSYM STG_E_PATHNOTFOUND}
  STG_E_PATHNOTFOUND = DWORD($80030003);

  { There are insufficient resources to open another file. }
  {$EXTERNALSYM STG_E_TOOMANYOPENFILES}
  STG_E_TOOMANYOPENFILES = DWORD($80030004);

  { Access Denied. }
  {$EXTERNALSYM STG_E_ACCESSDENIED}
  STG_E_ACCESSDENIED = DWORD($80030005);

  { Attempted an operation on an invalid object. }
  {$EXTERNALSYM STG_E_INVALIDHANDLE}
  STG_E_INVALIDHANDLE = DWORD($80030006);

  { There is insufficient memory available to complete operation. }
  {$EXTERNALSYM STG_E_INSUFFICIENTMEMORY}
  STG_E_INSUFFICIENTMEMORY = DWORD($80030008);

  { Invalid pointer error. }
  {$EXTERNALSYM STG_E_INVALIDPOINTER}
  STG_E_INVALIDPOINTER = DWORD($80030009);

  { There are no more entries to return. }
  {$EXTERNALSYM STG_E_NOMOREFILES}
  STG_E_NOMOREFILES = DWORD($80030012);

  { Disk is write-protected. }
  {$EXTERNALSYM STG_E_DISKISWRITEPROTECTED}
  STG_E_DISKISWRITEPROTECTED = DWORD($80030013);

  { An error occurred during a seek operation. }
  {$EXTERNALSYM STG_E_SEEKERROR}
  STG_E_SEEKERROR = DWORD($80030019);

  { A disk error occurred during a write operation. }
  {$EXTERNALSYM STG_E_WRITEFAULT}
  STG_E_WRITEFAULT = DWORD($8003001D);

  { A disk error occurred during a read operation. }
  {$EXTERNALSYM STG_E_READFAULT}
  STG_E_READFAULT = DWORD($8003001E);

  { A share violation has occurred. }
  {$EXTERNALSYM STG_E_SHAREVIOLATION}
  STG_E_SHAREVIOLATION = DWORD($80030020);

  { A lock violation has occurred. }
  {$EXTERNALSYM STG_E_LOCKVIOLATION}
  STG_E_LOCKVIOLATION = DWORD($80030021);

  { %l already exists. }
  {$EXTERNALSYM STG_E_FILEALREADYEXISTS}
  STG_E_FILEALREADYEXISTS = DWORD($80030050);

  { Invalid parameter error. }
  {$EXTERNALSYM STG_E_INVALIDPARAMETER}
  STG_E_INVALIDPARAMETER = DWORD($80030057);

  { There is insufficient disk space to complete operation. }
  {$EXTERNALSYM STG_E_MEDIUMFULL}
  STG_E_MEDIUMFULL = DWORD($80030070);

  { Illegal write of non-simple property to simple property set. }
  {$EXTERNALSYM STG_E_PROPSETMISMATCHED}
  STG_E_PROPSETMISMATCHED = DWORD($800300F0);

  { An API call exited abnormally. }
  {$EXTERNALSYM STG_E_ABNORMALAPIEXIT}
  STG_E_ABNORMALAPIEXIT = DWORD($800300FA);

  { The file %l is not a valid compound file. }
  {$EXTERNALSYM STG_E_INVALIDHEADER}
  STG_E_INVALIDHEADER = DWORD($800300FB);

  { The name %l is not valid. }
  {$EXTERNALSYM STG_E_INVALIDNAME}
  STG_E_INVALIDNAME = DWORD($800300FC);

  { An unexpected error occurred. }
  {$EXTERNALSYM STG_E_UNKNOWN}
  STG_E_UNKNOWN = DWORD($800300FD);

  { That function is not implemented. }
  {$EXTERNALSYM STG_E_UNIMPLEMENTEDFUNCTION}
  STG_E_UNIMPLEMENTEDFUNCTION = DWORD($800300FE);

  { Invalid flag error. }
  {$EXTERNALSYM STG_E_INVALIDFLAG}
  STG_E_INVALIDFLAG = DWORD($800300FF);

  { Attempted to use an object that is busy. }
  {$EXTERNALSYM STG_E_INUSE}
  STG_E_INUSE = DWORD($80030100);

  { The storage has been changed since the last commit. }
  {$EXTERNALSYM STG_E_NOTCURRENT}
  STG_E_NOTCURRENT = DWORD($80030101);

  { Attempted to use an object that has ceased to exist. }
  {$EXTERNALSYM STG_E_REVERTED}
  STG_E_REVERTED = DWORD($80030102);

  { Can't save. }
  {$EXTERNALSYM STG_E_CANTSAVE}
  STG_E_CANTSAVE = DWORD($80030103);

  { The compound file %l was produced with an incompatible version of storage. }
  {$EXTERNALSYM STG_E_OLDFORMAT}
  STG_E_OLDFORMAT = DWORD($80030104);

  { The compound file %l was produced with a newer version of storage. }
  {$EXTERNALSYM STG_E_OLDDLL}
  STG_E_OLDDLL = DWORD($80030105);

  { Share.exe or equivalent is required for operation. }
  {$EXTERNALSYM STG_E_SHAREREQUIRED}
  STG_E_SHAREREQUIRED = DWORD($80030106);

  { Illegal operation called on non-file based storage. }
  {$EXTERNALSYM STG_E_NOTFILEBASEDSTORAGE}
  STG_E_NOTFILEBASEDSTORAGE = DWORD($80030107);

  { Illegal operation called on object with extant marshallings. }
  {$EXTERNALSYM STG_E_EXTANTMARSHALLINGS}
  STG_E_EXTANTMARSHALLINGS = DWORD($80030108);

  { The docfile has been corrupted. }
  {$EXTERNALSYM STG_E_DOCFILECORRUPT}
  STG_E_DOCFILECORRUPT = DWORD($80030109);

  { OLE32.DLL has been loaded at the wrong address. }
  {$EXTERNALSYM STG_E_BADBASEADDRESS}
  STG_E_BADBASEADDRESS = DWORD($80030110);

  { The file download was aborted abnormally.  The file is incomplete. }
  {$EXTERNALSYM STG_E_INCOMPLETE}
  STG_E_INCOMPLETE = DWORD($80030201);

  { The file download has been terminated. }
  {$EXTERNALSYM STG_E_TERMINATED}
  STG_E_TERMINATED = DWORD($80030202);

  { The underlying file was converted to compound file format. }
  {$EXTERNALSYM STG_S_CONVERTED}
  STG_S_CONVERTED = $00030200;

  { The storage operation should block until more data is available. }
  {$EXTERNALSYM STG_S_BLOCK}
  STG_S_BLOCK = $00030201;

  { The storage operation should retry immediately. }
  {$EXTERNALSYM STG_S_RETRYNOW}
  STG_S_RETRYNOW = $00030202;

  { The notified event sink will not influence the storage operation. }
  {$EXTERNALSYM STG_S_MONITORING}
  STG_S_MONITORING = $00030203;


  { FACILITY_RPC }

  { Call was rejected by callee. }
  {$EXTERNALSYM RPC_E_CALL_REJECTED}
  RPC_E_CALL_REJECTED = DWORD($80010001);

  { Call was canceled by the message filter. }
  {$EXTERNALSYM RPC_E_CALL_CANCELED}
  RPC_E_CALL_CANCELED = DWORD($80010002);

  { The caller is dispatching an intertask SendMessage call and }
  { cannot call out via PostMessage. }
  {$EXTERNALSYM RPC_E_CANTPOST_INSENDCALL}
  RPC_E_CANTPOST_INSENDCALL = DWORD($80010003);

  { The caller is dispatching an asynchronous call and cannot }
  { make an outgoing call on behalf of this call. }
  {$EXTERNALSYM RPC_E_CANTCALLOUT_INASYNCCALL}
  RPC_E_CANTCALLOUT_INASYNCCALL = DWORD($80010004);

  { It is illegal to call out while inside message filter. }
  {$EXTERNALSYM RPC_E_CANTCALLOUT_INEXTERNALCALL}
  RPC_E_CANTCALLOUT_INEXTERNALCALL = DWORD($80010005);

  { The connection terminated or is in a bogus state }
  { and cannot be used any more. Other connections }
  { are still valid. }
  {$EXTERNALSYM RPC_E_CONNECTION_TERMINATED}
  RPC_E_CONNECTION_TERMINATED = DWORD($80010006);

  { The callee (server [not server application]) is not available }
  { and disappeared; all connections are invalid.  The call may }
  { have executed. }
  {$EXTERNALSYM RPC_E_SERVER_DIED}
  RPC_E_SERVER_DIED = DWORD($80010007);

  { The caller (client) disappeared while the callee (server) was }
  { processing a call. }
  {$EXTERNALSYM RPC_E_CLIENT_DIED}
  RPC_E_CLIENT_DIED = DWORD($80010008);

  { The data packet with the marshalled parameter data is incorrect. }
  {$EXTERNALSYM RPC_E_INVALID_DATAPACKET}
  RPC_E_INVALID_DATAPACKET = DWORD($80010009);

  { The call was not transmitted properly; the message queue }
  { was full and was not emptied after yielding. }
  {$EXTERNALSYM RPC_E_CANTTRANSMIT_CALL}
  RPC_E_CANTTRANSMIT_CALL = DWORD($8001000A);

  { The client (caller) cannot marshall the parameter data - low memory, etc. }
  {$EXTERNALSYM RPC_E_CLIENT_CANTMARSHAL_DATA}
  RPC_E_CLIENT_CANTMARSHAL_DATA = DWORD($8001000B);

  { The client (caller) cannot unmarshall the return data - low memory, etc. }
  {$EXTERNALSYM RPC_E_CLIENT_CANTUNMARSHAL_DATA}
  RPC_E_CLIENT_CANTUNMARSHAL_DATA = DWORD($8001000C);

  { The server (callee) cannot marshall the return data - low memory, etc. }
  {$EXTERNALSYM RPC_E_SERVER_CANTMARSHAL_DATA}
  RPC_E_SERVER_CANTMARSHAL_DATA = DWORD($8001000D);

  { The server (callee) cannot unmarshall the parameter data - low memory, etc. }
  {$EXTERNALSYM RPC_E_SERVER_CANTUNMARSHAL_DATA}
  RPC_E_SERVER_CANTUNMARSHAL_DATA = DWORD($8001000E);

  { Received data is invalid; could be server or client data. }
  {$EXTERNALSYM RPC_E_INVALID_DATA}
  RPC_E_INVALID_DATA = DWORD($8001000F);

  { A particular parameter is invalid and cannot be (un)marshalled. }
  {$EXTERNALSYM RPC_E_INVALID_PARAMETER}
  RPC_E_INVALID_PARAMETER = DWORD($80010010);

  { There is no second outgoing call on same channel in DDE conversation. }
  {$EXTERNALSYM RPC_E_CANTCALLOUT_AGAIN}
  RPC_E_CANTCALLOUT_AGAIN = DWORD($80010011);

  { The callee (server [not server application]) is not available }
  { and disappeared; all connections are invalid.  The call did not execute. }
  {$EXTERNALSYM RPC_E_SERVER_DIED_DNE}
  RPC_E_SERVER_DIED_DNE = DWORD($80010012);

  { System call failed. }
  {$EXTERNALSYM RPC_E_SYS_CALL_FAILED}
  RPC_E_SYS_CALL_FAILED = DWORD($80010100);

  { Could not allocate some required resource (memory, events, ...) }
  {$EXTERNALSYM RPC_E_OUT_OF_RESOURCES}
  RPC_E_OUT_OF_RESOURCES = DWORD($80010101);

  { Attempted to make calls on more than one thread in single threaded mode. }
  {$EXTERNALSYM RPC_E_ATTEMPTED_MULTITHREAD}
  RPC_E_ATTEMPTED_MULTITHREAD = DWORD($80010102);

  { The requested interface is not registered on the server object. }
  {$EXTERNALSYM RPC_E_NOT_REGISTERED}
  RPC_E_NOT_REGISTERED = DWORD($80010103);

  { RPC could not call the server or could not return the results of calling the server. }
  {$EXTERNALSYM RPC_E_FAULT}
  RPC_E_FAULT = DWORD($80010104);

  { The server threw an exception. }
  {$EXTERNALSYM RPC_E_SERVERFAULT}
  RPC_E_SERVERFAULT = DWORD($80010105);

  { Cannot change thread mode after it is set. }
  {$EXTERNALSYM RPC_E_CHANGED_MODE}
  RPC_E_CHANGED_MODE = DWORD($80010106);

  { The method called does not exist on the server. }
  {$EXTERNALSYM RPC_E_INVALIDMETHOD}
  RPC_E_INVALIDMETHOD = DWORD($80010107);

  { The object invoked has disconnected from its clients. }
  {$EXTERNALSYM RPC_E_DISCONNECTED}
  RPC_E_DISCONNECTED = DWORD($80010108);

  { The object invoked chose not to process the call now.  Try again later. }
  {$EXTERNALSYM RPC_E_RETRY}
  RPC_E_RETRY = DWORD($80010109);

  { The message filter indicated that the application is busy. }
  {$EXTERNALSYM RPC_E_SERVERCALL_RETRYLATER}
  RPC_E_SERVERCALL_RETRYLATER = DWORD($8001010A);

  { The message filter rejected the call. }
  {$EXTERNALSYM RPC_E_SERVERCALL_REJECTED}
  RPC_E_SERVERCALL_REJECTED = DWORD($8001010B);

  { A call control interfaces was called with invalid data. }
  {$EXTERNALSYM RPC_E_INVALID_CALLDATA}
  RPC_E_INVALID_CALLDATA = DWORD($8001010C);

  { An outgoing call cannot be made since the application is dispatching an input-synchronous call. }
  {$EXTERNALSYM RPC_E_CANTCALLOUT_ININPUTSYNCCALL}
  RPC_E_CANTCALLOUT_ININPUTSYNCCALL = DWORD($8001010D);

  { The application called an interface that was marshalled for a different thread. }
  {$EXTERNALSYM RPC_E_WRONG_THREAD}
  RPC_E_WRONG_THREAD = DWORD($8001010E);

  { CoInitialize has not been called on the current thread. }
  {$EXTERNALSYM RPC_E_THREAD_NOT_INIT}
  RPC_E_THREAD_NOT_INIT = DWORD($8001010F);

  { The version of OLE on the client and server machines does not match. }
  {$EXTERNALSYM RPC_E_VERSION_MISMATCH}
  RPC_E_VERSION_MISMATCH = DWORD($80010110);

  { OLE received a packet with an invalid header. }
  {$EXTERNALSYM RPC_E_INVALID_HEADER}
  RPC_E_INVALID_HEADER = DWORD($80010111);

  { OLE received a packet with an invalid extension. }
  {$EXTERNALSYM RPC_E_INVALID_EXTENSION}
  RPC_E_INVALID_EXTENSION = DWORD($80010112);

  { The requested object or interface does not exist. }
  {$EXTERNALSYM RPC_E_INVALID_IPID}
  RPC_E_INVALID_IPID = DWORD($80010113);

  { The requested object does not exist. }
  {$EXTERNALSYM RPC_E_INVALID_OBJECT}
  RPC_E_INVALID_OBJECT = DWORD($80010114);

  { OLE has sent a request and is waiting for a reply. }
  {$EXTERNALSYM RPC_S_CALLPENDING}
  RPC_S_CALLPENDING = DWORD($80010115);

  { OLE is waiting before retrying a request. }
  {$EXTERNALSYM RPC_S_WAITONTIMER}
  RPC_S_WAITONTIMER = DWORD($80010116);

  { Call context cannot be accessed after call completed. }
  {$EXTERNALSYM RPC_E_CALL_COMPLETE}
  RPC_E_CALL_COMPLETE = DWORD($80010117);

  { Impersonate on unsecure calls is not supported. }
  {$EXTERNALSYM RPC_E_UNSECURE_CALL}
  RPC_E_UNSECURE_CALL = DWORD($80010118);

  { Security must be initialized before any interfaces are marshalled or }
  {$EXTERNALSYM RPC_E_TOO_LATE}
  RPC_E_TOO_LATE = DWORD($80010119);

  { No security packages are installed on this machine or the user is not logged }
  {$EXTERNALSYM RPC_E_NO_GOOD_SECURITY_PACKAGES}
  RPC_E_NO_GOOD_SECURITY_PACKAGES = DWORD($8001011A);

  { Access is denied. }
  {$EXTERNALSYM RPC_E_ACCESS_DENIED}
  RPC_E_ACCESS_DENIED = DWORD($8001011B);

  { Remote calls are not allowed for this process. }
  {$EXTERNALSYM RPC_E_REMOTE_DISABLED}
  RPC_E_REMOTE_DISABLED = DWORD($8001011C);

  { The marshaled interface data packet (OBJREF) has an invalid or unknown format. }
  {$EXTERNALSYM RPC_E_INVALID_OBJREF}
  RPC_E_INVALID_OBJREF = DWORD($8001011D);

  { An internal error occurred. }
  {$EXTERNALSYM RPC_E_UNEXPECTED}
  RPC_E_UNEXPECTED = DWORD($8001FFFF);


{ FACILITY_SSPI }

  { Bad UID. }
  {$EXTERNALSYM NTE_BAD_UID}
  NTE_BAD_UID = DWORD($80090001);

  { Bad Hash. }
  {$EXTERNALSYM NTE_BAD_HASH}
  NTE_BAD_HASH = DWORD($80090002);

  { Bad Key. }
  {$EXTERNALSYM NTE_BAD_KEY}
  NTE_BAD_KEY = DWORD($80090003);

  { Bad Length. }
  {$EXTERNALSYM NTE_BAD_LEN}
  NTE_BAD_LEN = DWORD($80090004);

  { Bad Data. }
  {$EXTERNALSYM NTE_BAD_DATA}
  NTE_BAD_DATA = DWORD($80090005);

  { Invalid Signature. }
  {$EXTERNALSYM NTE_BAD_SIGNATURE}
  NTE_BAD_SIGNATURE = DWORD($80090006);

  { Bad Version of provider. }
  {$EXTERNALSYM NTE_BAD_VER}
  NTE_BAD_VER = DWORD($80090007);

  { Invalid algorithm specified. }
  {$EXTERNALSYM NTE_BAD_ALGID}
  NTE_BAD_ALGID = DWORD($80090008);

  { Invalid flags specified. }
  {$EXTERNALSYM NTE_BAD_FLAGS}
  NTE_BAD_FLAGS = DWORD($80090009);

  { Invalid type specified. }
  {$EXTERNALSYM NTE_BAD_TYPE}
  NTE_BAD_TYPE = DWORD($8009000A);

  { Key not valid for use in specified state. }
  {$EXTERNALSYM NTE_BAD_KEY_STATE}
  NTE_BAD_KEY_STATE = DWORD($8009000B);

  { Hash not valid for use in specified state. }
  {$EXTERNALSYM NTE_BAD_HASH_STATE}
  NTE_BAD_HASH_STATE = DWORD($8009000C);

  { Key does not exist. }
  {$EXTERNALSYM NTE_NO_KEY}
  NTE_NO_KEY = DWORD($8009000D);

  { Insufficient memory available for the operation. }
  {$EXTERNALSYM NTE_NO_MEMORY}
  NTE_NO_MEMORY = DWORD($8009000E);

  { Object already exists. }
  {$EXTERNALSYM NTE_EXISTS}
  NTE_EXISTS = DWORD($8009000F);

  { Access denied. }
  {$EXTERNALSYM NTE_PERM}
  NTE_PERM = DWORD($80090010);

  { Object was not found. }
  {$EXTERNALSYM NTE_NOT_FOUND}
  NTE_NOT_FOUND = DWORD($80090011);

  { Data already encrypted. }
  {$EXTERNALSYM NTE_DOUBLE_ENCRYPT}
  NTE_DOUBLE_ENCRYPT = DWORD($80090012);

  { Invalid provider specified. }
  {$EXTERNALSYM NTE_BAD_PROVIDER}
  NTE_BAD_PROVIDER = DWORD($80090013);

  { Invalid provider type specified. }
  {$EXTERNALSYM NTE_BAD_PROV_TYPE}
  NTE_BAD_PROV_TYPE = DWORD($80090014);

  { Provider's public key is invalid. }
  {$EXTERNALSYM NTE_BAD_PUBLIC_KEY}
  NTE_BAD_PUBLIC_KEY = DWORD($80090015);

  { Keyset does not exist }
  {$EXTERNALSYM NTE_BAD_KEYSET}
  NTE_BAD_KEYSET = DWORD($80090016);

  { Provider type not defined. }
  {$EXTERNALSYM NTE_PROV_TYPE_NOT_DEF}
  NTE_PROV_TYPE_NOT_DEF = DWORD($80090017);

  { Provider type as registered is invalid. }
  {$EXTERNALSYM NTE_PROV_TYPE_ENTRY_BAD}
  NTE_PROV_TYPE_ENTRY_BAD = DWORD($80090018);

  { The keyset is not defined. }
  {$EXTERNALSYM NTE_KEYSET_NOT_DEF}
  NTE_KEYSET_NOT_DEF = DWORD($80090019);

  { Keyset as registered is invalid. }
  {$EXTERNALSYM NTE_KEYSET_ENTRY_BAD}
  NTE_KEYSET_ENTRY_BAD = DWORD($8009001A);

  { Provider type does not match registered value. }
  {$EXTERNALSYM NTE_PROV_TYPE_NO_MATCH}
  NTE_PROV_TYPE_NO_MATCH = DWORD($8009001B);

  { The digital signature file is corrupt. }
  {$EXTERNALSYM NTE_SIGNATURE_FILE_BAD}
  NTE_SIGNATURE_FILE_BAD = DWORD($8009001C);

  { Provider DLL failed to initialize correctly. }
  {$EXTERNALSYM NTE_PROVIDER_DLL_FAIL}
  NTE_PROVIDER_DLL_FAIL = DWORD($8009001D);

  { Provider DLL could not be found. }
  {$EXTERNALSYM NTE_PROV_DLL_NOT_FOUND}
  NTE_PROV_DLL_NOT_FOUND = DWORD($8009001E);

  { The Keyset parameter is invalid. }
  {$EXTERNALSYM NTE_BAD_KEYSET_PARAM}
  NTE_BAD_KEYSET_PARAM = DWORD($8009001F);

  { An internal error occurred. }
  {$EXTERNALSYM NTE_FAIL}
  NTE_FAIL = DWORD($80090020);

  { A base error occurred. }
  {$EXTERNALSYM NTE_SYS_ERR}
  NTE_SYS_ERR = DWORD($80090021);

  {$EXTERNALSYM NTE_OP_OK}
  NTE_OP_OK = 0;

{ FACILITY_CERT }

  { The specified trust provider is not known on this system. }
  {$EXTERNALSYM TRUST_E_PROVIDER_UNKNOWN}
  TRUST_E_PROVIDER_UNKNOWN = DWORD($800B0001);

  { The trust verification action specified is not supported by the specified trust provider. }
  {$EXTERNALSYM TRUST_E_ACTION_UNKNOWN}
  TRUST_E_ACTION_UNKNOWN = DWORD($800B0002);

  { The form specified for the subject is not one supported or known by the specified trust provider. }
  {$EXTERNALSYM TRUST_E_SUBJECT_FORM_UNKNOWN}
  TRUST_E_SUBJECT_FORM_UNKNOWN = DWORD($800B0003);

  { The subject is not trusted for the specified action. }
  {$EXTERNALSYM TRUST_E_SUBJECT_NOT_TRUSTED}
  TRUST_E_SUBJECT_NOT_TRUSTED = DWORD($800B0004);

  { Error due to problem in ASN.1 encoding process. }
  {$EXTERNALSYM DIGSIG_E_ENCODE}
  DIGSIG_E_ENCODE = DWORD($800B0005);

  { Error due to problem in ASN.1 decoding process. }
  {$EXTERNALSYM DIGSIG_E_DECODE}
  DIGSIG_E_DECODE = DWORD($800B0006);

  { Reading / writing Extensions where Attributes are appropriate, and visa versa. }
  {$EXTERNALSYM DIGSIG_E_EXTENSIBILITY}
  DIGSIG_E_EXTENSIBILITY = DWORD($800B0007);

  { Unspecified cryptographic failure. }
  {$EXTERNALSYM DIGSIG_E_CRYPTO}
  DIGSIG_E_CRYPTO = DWORD($800B0008);

  { The size of the data could not be determined. }
  {$EXTERNALSYM PERSIST_E_SIZEDEFINITE}
  PERSIST_E_SIZEDEFINITE = DWORD($800B0009);

  { The size of the indefinite-sized data could not be determined. }
  {$EXTERNALSYM PERSIST_E_SIZEINDEFINITE}
  PERSIST_E_SIZEINDEFINITE = DWORD($800B000A);

  { This object does not read and write self-sizing data. }
  {$EXTERNALSYM PERSIST_E_NOTSELFSIZING}
  PERSIST_E_NOTSELFSIZING = DWORD($800B000B);

  { No signature was present in the subject. }
  {$EXTERNALSYM TRUST_E_NOSIGNATURE}
  TRUST_E_NOSIGNATURE = DWORD($800B0100);

  { A required certificate is not within its validity period. }
  {$EXTERNALSYM CERT_E_EXPIRED}
  CERT_E_EXPIRED = DWORD($800B0101);

  { The validity periods of the certification chain do not nest correctly. }
  {$EXTERNALSYM CERT_E_VALIDIYPERIODNESTING}
  CERT_E_VALIDIYPERIODNESTING = DWORD($800B0102);

  { A certificate that can only be used as an end-entity is being used as a CA or visa versa. }
  {$EXTERNALSYM CERT_E_ROLE}
  CERT_E_ROLE = DWORD($800B0103);

  { A path length constraint in the certification chain has been violated. }
  {$EXTERNALSYM CERT_E_PATHLENCONST}
  CERT_E_PATHLENCONST = DWORD($800B0104);

  { An extension of unknown type that is labeled 'critical' is present in a certificate. }
  {$EXTERNALSYM CERT_E_CRITICAL}
  CERT_E_CRITICAL = DWORD($800B0105);

  { A certificate is being used for a purpose other than that for which it is permitted. }
  {$EXTERNALSYM CERT_E_PURPOSE}
  CERT_E_PURPOSE = DWORD($800B0106);

  { A parent of a given certificate in fact did not issue that child certificate. }
  {$EXTERNALSYM CERT_E_ISSUERCHAINING}
  CERT_E_ISSUERCHAINING = DWORD($800B0107);

  { A certificate is missing or has an empty value for an important field, such as a subject or issuer name. }
  {$EXTERNALSYM CERT_E_MALFORMED}
  CERT_E_MALFORMED = DWORD($800B0108);

  { A certification chain processed correctly, but terminated in a root certificate which isn't trusted by the trust provider. }
  {$EXTERNALSYM CERT_E_UNTRUSTEDROOT}
  CERT_E_UNTRUSTEDROOT = DWORD($800B0109);

  { A chain of certs didn't chain as they should in a certain application of chaining. }
  {$EXTERNALSYM CERT_E_CHAINING}
  CERT_E_CHAINING = DWORD($800B010A);

{ End WINERROR.H }


  { Abnormal termination codes }

  {$EXTERNALSYM TC_NORMAL}
  TC_NORMAL = 0;
  {$EXTERNALSYM TC_HARDERR}
  TC_HARDERR = 1;
  {$EXTERNALSYM TC_GP_TRAP}
  TC_GP_TRAP = 2;
  {$EXTERNALSYM TC_SIGNAL}
  TC_SIGNAL = 3;

  { Power Management APIs }

  {$EXTERNALSYM AC_LINE_OFFLINE}
  AC_LINE_OFFLINE = 0;
  {$EXTERNALSYM AC_LINE_ONLINE}
  AC_LINE_ONLINE = 1;
  {$EXTERNALSYM AC_LINE_BACKUP_POWER}
  AC_LINE_BACKUP_POWER = 2;
  {$EXTERNALSYM AC_LINE_UNKNOWN}
  AC_LINE_UNKNOWN = 255;

  {$EXTERNALSYM BATTERY_FLAG_HIGH}
  BATTERY_FLAG_HIGH = 1;
  {$EXTERNALSYM BATTERY_FLAG_LOW}
  BATTERY_FLAG_LOW = 2;
  {$EXTERNALSYM BATTERY_FLAG_CRITICAL}
  BATTERY_FLAG_CRITICAL = 4;
  {$EXTERNALSYM BATTERY_FLAG_CHARGING}
  BATTERY_FLAG_CHARGING = 8;
  {$EXTERNALSYM BATTERY_FLAG_NO_BATTERY}
  BATTERY_FLAG_NO_BATTERY = $80;
  {$EXTERNALSYM BATTERY_FLAG_UNKNOWN}
  BATTERY_FLAG_UNKNOWN = 255;
  {$EXTERNALSYM BATTERY_PERCENTAGE_UNKNOWN}
  BATTERY_PERCENTAGE_UNKNOWN = 255;
  {$EXTERNALSYM BATTERY_LIFE_UNKNOWN}
  BATTERY_LIFE_UNKNOWN = DWORD($FFFFFFFF);

type
  PSystemPowerStatus = ^TSystemPowerStatus;
  {$EXTERNALSYM _SYSTEM_POWER_STATUS}
  _SYSTEM_POWER_STATUS = packed record
    ACLineStatus : Byte;
    BatteryFlag : Byte;
    BatteryLifePercent : Byte;
    Reserved1 : Byte;
    BatteryLifeTime : DWORD;
    BatteryFullLifeTime : DWORD;
  end;
  TSystemPowerStatus = _SYSTEM_POWER_STATUS;
  {$EXTERNALSYM SYSTEM_POWER_STATUS}
  SYSTEM_POWER_STATUS = _SYSTEM_POWER_STATUS;

{$EXTERNALSYM GetSystemPowerStatus}
function GetSystemPowerStatus(var lpSystemPowerStatus: TSystemPowerStatus): BOOL; stdcall;
{$EXTERNALSYM SetSystemPowerState}
function SetSystemPowerState(fSuspend, fForce: BOOL): BOOL; stdcall;


{ Win Certificate API and Structures }

{ Structures }
type
  PWinCertificate = ^TWinCertificate;
  {$EXTERNALSYM _WIN_CERTIFICATE}
  _WIN_CERTIFICATE = packed record
    dwLength: DWORD;
    wRevision: Word;
    wCertificateType: Word;         { WIN_CERT_TYPE_xxx }
    bCertificate: packed array[0..0] of Byte;
  end;
  TWinCertificate = _WIN_CERTIFICATE;
  {$EXTERNALSYM WIN_CERTIFICATE}
  WIN_CERTIFICATE = _WIN_CERTIFICATE;

{ Currently, the only defined certificate revision is WIN_CERT_REVISION_1_0 }

const
  {$EXTERNALSYM WIN_CERT_REVISION_1_0}
  WIN_CERT_REVISION_1_0 = $0100;

{ Possible certificate types are specified by the following values }

  {$EXTERNALSYM WIN_CERT_TYPE_X509}
  WIN_CERT_TYPE_X509 = $0001;                        { bCertificate contains an X.509 Certificate }
  {$EXTERNALSYM WIN_CERT_TYPE_PKCS_SIGNED_DATA}
  WIN_CERT_TYPE_PKCS_SIGNED_DATA = $0002;            { bCertificate contains a PKCS SignedData structure }
  {$EXTERNALSYM WIN_CERT_TYPE_RESERVED_1}
  WIN_CERT_TYPE_RESERVED_1 = $0003;                  { Reserved }

{ API }

{$EXTERNALSYM WinSubmitCertificate}
function WinSubmitCertificate(var lpCertificate: TWinCertificate): BOOL; stdcall;

{ Trust API and Structures }

{$EXTERNALSYM WinVerifyTrust}
function WinVerifyTrust(hwnd: HWND; const ActionID: TGUID; ActionData: Pointer): Longint; stdcall;
{$EXTERNALSYM WinLoadTrustProvider}
function WinLoadTrustProvider(ActionID: PGUID): BOOL; stdcall;

{ Common Trust API Data Structures }

{ Data type commonly used in ActionData structures }

type
  TWinTrustSubject = Pointer;

{ Two commonly used ActionData structures }

  PWinTrustActdataContextWithSubject = ^TWinTrustActdataContextWithSubject;
  {$EXTERNALSYM _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT}
  _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT = record
    hClientToken: THandle;
    SubjectType: PGUID;
    Subject: TWinTrustSubject;
  end;
  TWinTrustActdataContextWithSubject = _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT;
  {$EXTERNALSYM WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT}
  WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT = _WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT;


  PWinTrustActdataSubjectOnly = ^TWinTrustActdataSubjectOnly;
  {$EXTERNALSYM _WIN_TRUST_ACTDATA_SUBJECT_ONLY}
  _WIN_TRUST_ACTDATA_SUBJECT_ONLY = record
    SubjectType: PGUID;
    Subject: TWinTrustSubject;
  end;
  TWinTrustActdataSubjectOnly = _WIN_TRUST_ACTDATA_SUBJECT_ONLY;
  {$EXTERNALSYM WIN_TRUST_ACTDATA_SUBJECT_ONLY}
  WIN_TRUST_ACTDATA_SUBJECT_ONLY = _WIN_TRUST_ACTDATA_SUBJECT_ONLY;


{ SUBJECT FORM DEFINITIONS }

{ Currently defined Subject Type Identifiers.  All of the below
  use the WIN_TRUST_SUBJECT_FILE subject form, defined below. }

const
{ RawFile = 959dc450-8d9e-11cf-8736-00aa00a485eb }
  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_RAW_FILE}
  WIN_TRUST_SUBJTYPE_RAW_FILE: TGUID =
    '{959dc450-8d9e-11cf-8736-00aa00a485eb}';

{ PeImage = 43c9a1e0-8da0-11cf-8736-00aa00a485eb }
  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_PE_IMAGE}
  WIN_TRUST_SUBJTYPE_PE_IMAGE: TGUID =
    '{43c9a1e0-8da0-11cf-8736-00aa00a485eb}';

{ JavaClass = 08ad3990-8da1-11cf-8736-00aa00a485eb }
  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_JAVA_CLASS}
  WIN_TRUST_SUBJTYPE_JAVA_CLASS: TGUID =
    '{08ad3990-8da1-11cf-8736-00aa00a485eb}';

{ Cabinet = d17c5374-a392-11cf-9df5-00aa00c184e0 }
  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_CABINET}
  WIN_TRUST_SUBJTYPE_CABINET: TGUID =
    '{d17c5374-a392-11cf-9df5-00aa00c184e0}';

{ Associated Subject Data Structure: }


type
  PWinTrustSubjectFile = ^TWinTrustSubjectFile;
  {$EXTERNALSYM _WIN_TRUST_SUBJECT_FILE}
  _WIN_TRUST_SUBJECT_FILE = record
    hFile: THandle;
    lpPath: PWideChar;
  end;
  TWinTrustSubjectFile = _WIN_TRUST_SUBJECT_FILE;
  {$EXTERNALSYM WIN_TRUST_SUBJECT_FILE}
  WIN_TRUST_SUBJECT_FILE = _WIN_TRUST_SUBJECT_FILE;

{ The following subject types use the
  WIN_TRUST_SUBJECT_FILE_AND_DISPLAY subject type, defined
  below. }

const
  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_RAW_FILEEX}
  WIN_TRUST_SUBJTYPE_RAW_FILEEX: TGUID = (
          D1:$6f458110; D2:$c2f1; D3:$11cf; D4:($8a, $69, $0, $aa, $0, $6c, $37, $6 ));

  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_PE_IMAGEEX}
  WIN_TRUST_SUBJTYPE_PE_IMAGEEX: TGUID = (
          D1:$6f458111; D2:$c2f1; D3:$11cf; D4:($8a, $69, $0, $aa, $0, $6c, $37, $6 ));

  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_JAVA_CLASSEX}
  WIN_TRUST_SUBJTYPE_JAVA_CLASSEX: TGUID = (
          D1:$6f458113; D2:$c2f1; D3:$11cf; D4:($8a, $69, $0, $aa, $0, $6c, $37, $6 ));

  {$EXTERNALSYM WIN_TRUST_SUBJTYPE_CABINETEX}
  WIN_TRUST_SUBJTYPE_CABINETEX: TGUID = (
          D1:$6f458114; D2:$c2f1; D3:$11cf; D4:($8a, $69, $0, $aa, $0, $6c, $37, $6 ));


{ Associated Subject Data Structure: }

type
  PWinTrustSubjectFileAndDisplay = ^TWinTrustSubjectFileAndDisplay;
  {$EXTERNALSYM _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY}
  _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY = record
    hFile: THandle;              { handle to the open file if you got it }
    lpPath: PWideString;         { the path to open if you don't }
    lpDisplayName: PWideString;  { (optional) display name to show to user }
                                 {      in place of path }
  end;
  TWinTrustSubjectFileAndDisplay = _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY;
  {$EXTERNALSYM WIN_TRUST_SUBJECT_FILE_AND_DISPLAY}
  WIN_TRUST_SUBJECT_FILE_AND_DISPLAY = _WIN_TRUST_SUBJECT_FILE_AND_DISPLAY;

{ Other subject types: }

const
{ OleStorage == c257e740-8da0-11cf-8736-00aa00a485eb }
{$EXTERNALSYM WIN_TRUST_SUBJTYPE_OLE_STORAGE}
WIN_TRUST_SUBJTYPE_OLE_STORAGE: TGUID = (
          D1:$c257e740; D2:$8da0; D3:$11cf; D4:($87, $36, $00, $aa, $00, $a4, $85, $eb));


{ TRUST PROVIDER SPECIFIC DEFINITIONS

      Each trust provider will have the following
      sections defined:

      Actions - What actions are supported by the trust
          provider.
      SubjectForms - Subjects that may be evaluated by this
          trust provider.
                     and
      Data structures to support the subject forms. }


{ Software Publisher Trust Provider }

{ Actions: }

{ TrustedPublisher == 66426730-8da1-11cf-8736-00aa00a485eb }
  {$EXTERNALSYM WIN_SPUB_ACTION_TRUSTED_PUBLISHER}
  WIN_SPUB_ACTION_TRUSTED_PUBLISHER: TGUID = (
          D1:$66426730; D2:$8da1; D3:$11cf; D4:($87, $36, $00, $aa, $00, $a4, $85, $eb));

{ NtActivateImage == 8bc96b00-8da1-11cf-8736-00aa00a485eb }
  {$EXTERNALSYM WIN_SPUB_ACTION_NT_ACTIVATE_IMAGE}
  WIN_SPUB_ACTION_NT_ACTIVATE_IMAGE: TGUID = (
          D1:$8bc96b00; D2:$8da1; D3:$11cf; D4:($87, $36, $00, $aa, $00, $a4, $85, $eb));

{ PublishedSoftware == 64b9d180-8da2-11cf-8736-00aa00a485eb }
  {$EXTERNALSYM WIN_SPUB_ACTION_PUBLISHED_SOFTWARE}
  WIN_SPUB_ACTION_PUBLISHED_SOFTWARE: TGUID = (
          D1:$64b9d180; D2:$8da2; D3:$11cf; D4:($87, $36, $00, $aa, $00, $a4, $85, $eb));

{ Data Structures: }

{ WIN_SPUB_ACTION_TRUSTED_PUBLISHER:
      Uses WIN_SPUB_TRUSTED_PUBLISHER_DATA }

{ WIN_SPUB_ACTION_NT_ACTIVATE_IMAGE:
      Uses WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT }

{ WIN_SPUB_ACTION_PUBLISHED_SOFTWARE:
      Uses WIN_TRUST_ACTDATA_CONTEXT_WITH_SUBJECT }

type
  PWinSpubTrustedPublisherData = ^TWinSpubTrustedPublisherData;
  {$EXTERNALSYM _WIN_SPUB_TRUSTED_PUBLISHER_DATA}
  _WIN_SPUB_TRUSTED_PUBLISHER_DATA = record
    hClientToken: THandle;
    lpCertificate: PWinCertificate;
  end;
  TWinSpubTrustedPublisherData = _WIN_SPUB_TRUSTED_PUBLISHER_DATA;
  {$EXTERNALSYM WIN_SPUB_TRUSTED_PUBLISHER_DATA}
  WIN_SPUB_TRUSTED_PUBLISHER_DATA = _WIN_SPUB_TRUSTED_PUBLISHER_DATA;

{ Translated from WINGDI.H }

const
  { Binary raster ops }
  {$EXTERNALSYM R2_BLACK}
  R2_BLACK       = 1;     {  0   }
  {$EXTERNALSYM R2_NOTMERGEPEN}
  R2_NOTMERGEPEN = 2;     { DPon }
  {$EXTERNALSYM R2_MASKNOTPEN}
  R2_MASKNOTPEN  = 3;     { DPna }
  {$EXTERNALSYM R2_NOTCOPYPEN}
  R2_NOTCOPYPEN  = 4;     { PN   }
  {$EXTERNALSYM R2_MASKPENNOT}
  R2_MASKPENNOT  = 5;     { PDna }
  {$EXTERNALSYM R2_NOT}
  R2_NOT         = 6;     { Dn   }
  {$EXTERNALSYM R2_XORPEN}
  R2_XORPEN      = 7;     { DPx  }
  {$EXTERNALSYM R2_NOTMASKPEN}
  R2_NOTMASKPEN  = 8;     { DPan }
  {$EXTERNALSYM R2_MASKPEN}
  R2_MASKPEN     = 9;     { DPa  }
  {$EXTERNALSYM R2_NOTXORPEN}
  R2_NOTXORPEN   = 10;    { DPxn }
  {$EXTERNALSYM R2_NOP}
  R2_NOP         = 11;    { D    }
  {$EXTERNALSYM R2_MERGENOTPEN}
  R2_MERGENOTPEN = 12;    { DPno }
  {$EXTERNALSYM R2_COPYPEN}
  R2_COPYPEN     = 13;    { P    }
  {$EXTERNALSYM R2_MERGEPENNOT}
  R2_MERGEPENNOT = 14;    { PDno }
  {$EXTERNALSYM R2_MERGEPEN}
  R2_MERGEPEN    = 15;    { DPo  }
  {$EXTERNALSYM R2_WHITE}
  R2_WHITE       = $10;   {  1   }
  {$EXTERNALSYM R2_LAST}
  R2_LAST        = $10;


  { Ternary raster operations }
  {$EXTERNALSYM SRCCOPY}
  SRCCOPY     = $00CC0020;     { dest = source                    }
  {$EXTERNALSYM SRCPAINT}
  SRCPAINT    = $00EE0086;     { dest = source OR dest            }
  {$EXTERNALSYM SRCAND}
  SRCAND      = $008800C6;     { dest = source AND dest           }
  {$EXTERNALSYM SRCINVERT}
  SRCINVERT   = $00660046;     { dest = source XOR dest           }
  {$EXTERNALSYM SRCERASE}
  SRCERASE    = $00440328;     { dest = source AND (NOT dest )    }
  {$EXTERNALSYM NOTSRCCOPY}
  NOTSRCCOPY  = $00330008;     { dest = (NOT source)              }
  {$EXTERNALSYM NOTSRCERASE}
  NOTSRCERASE = $001100A6;     { dest = (NOT src) AND (NOT dest)  }
  {$EXTERNALSYM MERGECOPY}
  MERGECOPY   = $00C000CA;     { dest = (source AND pattern)      }
  {$EXTERNALSYM MERGEPAINT}
  MERGEPAINT  = $00BB0226;     { dest = (NOT source) OR dest      }
  {$EXTERNALSYM PATCOPY}
  PATCOPY     = $00F00021;     { dest = pattern                   }
  {$EXTERNALSYM PATPAINT}
  PATPAINT    = $00FB0A09;     { dest = DPSnoo                    }
  {$EXTERNALSYM PATINVERT}
  PATINVERT   = $005A0049;     { dest = pattern XOR dest          }
  {$EXTERNALSYM DSTINVERT}
  DSTINVERT   = $00550009;     { dest = (NOT dest)                }
  {$EXTERNALSYM BLACKNESS}
  BLACKNESS   = $00000042;     { dest = BLACK                     }
  {$EXTERNALSYM WHITENESS}
  WHITENESS   = $00FF0062;     { dest = WHITE                     }


{ Quaternary raster codes }

function MakeROP4(fore,back: DWORD): DWORD;

const
  {$EXTERNALSYM GDI_ERROR}
  GDI_ERROR = DWORD($FFFFFFFF);
  {$EXTERNALSYM HGDI_ERROR}
  HGDI_ERROR = DWORD($FFFFFFFF);


  { Region Flags }
  {$EXTERNALSYM ERROR}
  ERROR = 0;
  {$EXTERNALSYM NULLREGION}
  NULLREGION = 1;
  {$EXTERNALSYM SIMPLEREGION}
  SIMPLEREGION = 2;
  {$EXTERNALSYM COMPLEXREGION}
  COMPLEXREGION = 3;
  {$EXTERNALSYM RGN_ERROR}
  RGN_ERROR = ERROR;


  { CombineRgn() Styles }
  {$EXTERNALSYM RGN_AND}
  RGN_AND = 1;
  {$EXTERNALSYM RGN_OR}
  RGN_OR = 2;
  {$EXTERNALSYM RGN_XOR}
  RGN_XOR = 3;
  {$EXTERNALSYM RGN_DIFF}
  RGN_DIFF = 4;
  {$EXTERNALSYM RGN_COPY}
  RGN_COPY = 5;
  {$EXTERNALSYM RGN_MIN}
  RGN_MIN = RGN_AND;
  {$EXTERNALSYM RGN_MAX}
  RGN_MAX = RGN_COPY;

  { StretchBlt() Modes }
  {$EXTERNALSYM BLACKONWHITE}
  BLACKONWHITE = 1;
  {$EXTERNALSYM WHITEONBLACK}
  WHITEONBLACK = 2;
  {$EXTERNALSYM COLORONCOLOR}
  COLORONCOLOR = 3;
  {$EXTERNALSYM HALFTONE}
  HALFTONE = 4;
  {$EXTERNALSYM MAXSTRETCHBLTMODE}
  MAXSTRETCHBLTMODE = 4;


  { New StretchBlt() Modes }
  {$EXTERNALSYM STRETCH_ANDSCANS}
  STRETCH_ANDSCANS = BLACKONWHITE;
  {$EXTERNALSYM STRETCH_ORSCANS}
  STRETCH_ORSCANS = WHITEONBLACK;
  {$EXTERNALSYM STRETCH_DELETESCANS}
  STRETCH_DELETESCANS = COLORONCOLOR;
  {$EXTERNALSYM STRETCH_HALFTONE}
  STRETCH_HALFTONE = HALFTONE;


  { PolyFill() Modes }
  {$EXTERNALSYM ALTERNATE}
  ALTERNATE = 1;
  {$EXTERNALSYM WINDING}
  WINDING = 2;
  {$EXTERNALSYM POLYFILL_LAST}
  POLYFILL_LAST = 2;


  { Text Alignment Options }
  {$EXTERNALSYM TA_NOUPDATECP}
  TA_NOUPDATECP = 0;
  {$EXTERNALSYM TA_UPDATECP}
  TA_UPDATECP = 1;
  {$EXTERNALSYM TA_LEFT}
  TA_LEFT = 0;
  {$EXTERNALSYM TA_RIGHT}
  TA_RIGHT = 2;
  {$EXTERNALSYM TA_CENTER}
  TA_CENTER = 6;
  {$EXTERNALSYM TA_TOP}
  TA_TOP = 0;
  {$EXTERNALSYM TA_BOTTOM}
  TA_BOTTOM = 8;
  {$EXTERNALSYM TA_BASELINE}
  TA_BASELINE = 24;
  {$EXTERNALSYM TA_RTLREADING}
  TA_RTLREADING = $100;
  {$EXTERNALSYM TA_MASK}
  TA_MASK =  (TA_BASELINE+TA_CENTER+TA_UPDATECP+TA_RTLREADING);

  {$EXTERNALSYM VTA_BASELINE}
  VTA_BASELINE = TA_BASELINE;
  {$EXTERNALSYM VTA_LEFT}
  VTA_LEFT = TA_BOTTOM;
  {$EXTERNALSYM VTA_RIGHT}
  VTA_RIGHT = TA_TOP;
  {$EXTERNALSYM VTA_CENTER}
  VTA_CENTER = TA_CENTER;
  {$EXTERNALSYM VTA_BOTTOM}
  VTA_BOTTOM = TA_RIGHT;
  {$EXTERNALSYM VTA_TOP}
  VTA_TOP = TA_LEFT;

  {$EXTERNALSYM ETO_OPAQUE}
  ETO_OPAQUE = 2;
  {$EXTERNALSYM ETO_CLIPPED}
  ETO_CLIPPED = 4;
  {$EXTERNALSYM ETO_GLYPH_INDEX}
  ETO_GLYPH_INDEX = $10;
  {$EXTERNALSYM ETO_RTLREADING}
  ETO_RTLREADING = $80;
  {$EXTERNALSYM ETO_NUMERICSLOCAL}
  ETO_NUMERICSLOCAL = $400;
  {$EXTERNALSYM ETO_NUMERICSLATIN}
  ETO_NUMERICSLATIN = $800;
  {$EXTERNALSYM ETO_IGNORELANGUAGE}
  ETO_IGNORELANGUAGE = $1000;
  {$EXTERNALSYM ETO_PDY}
  ETO_PDY = $2000;

  {$EXTERNALSYM ASPECT_FILTERING}
  ASPECT_FILTERING = 1;


  { Bounds Accumulation APIs }
  {$EXTERNALSYM DCB_RESET}
  DCB_RESET = 1;
  {$EXTERNALSYM DCB_ACCUMULATE}
  DCB_ACCUMULATE = 2;
  {$EXTERNALSYM DCB_DIRTY}
  DCB_DIRTY = DCB_ACCUMULATE;
  {$EXTERNALSYM DCB_SET}
  DCB_SET = (DCB_RESET or DCB_ACCUMULATE);
  {$EXTERNALSYM DCB_ENABLE}
  DCB_ENABLE = 4;
  {$EXTERNALSYM DCB_DISABLE}
  DCB_DISABLE = 8;

  { Metafile Functions }
  {$EXTERNALSYM META_SETBKCOLOR}
  META_SETBKCOLOR = 513;
  {$EXTERNALSYM META_SETBKMODE}
  META_SETBKMODE = 258;
  {$EXTERNALSYM META_SETMAPMODE}
  META_SETMAPMODE = 259;
  {$EXTERNALSYM META_SETROP2}
  META_SETROP2 = 260;
  {$EXTERNALSYM META_SETRELABS}
  META_SETRELABS = 261;
  {$EXTERNALSYM META_SETPOLYFILLMODE}
  META_SETPOLYFILLMODE = 262;
  {$EXTERNALSYM META_SETSTRETCHBLTMODE}
  META_SETSTRETCHBLTMODE = 263;
  {$EXTERNALSYM META_SETTEXTCHAREXTRA}
  META_SETTEXTCHAREXTRA = 264;
  {$EXTERNALSYM META_SETTEXTCOLOR}
  META_SETTEXTCOLOR = 521;
  {$EXTERNALSYM META_SETTEXTJUSTIFICATION}
  META_SETTEXTJUSTIFICATION = 522;
  {$EXTERNALSYM META_SETWINDOWORG}
  META_SETWINDOWORG = 523;
  {$EXTERNALSYM META_SETWINDOWEXT}
  META_SETWINDOWEXT = 524;
  {$EXTERNALSYM META_SETVIEWPORTORG}
  META_SETVIEWPORTORG = 525;
  {$EXTERNALSYM META_SETVIEWPORTEXT}
  META_SETVIEWPORTEXT = 526;
  {$EXTERNALSYM META_OFFSETWINDOWORG}
  META_OFFSETWINDOWORG = 527;
  {$EXTERNALSYM META_SCALEWINDOWEXT}
  META_SCALEWINDOWEXT = 1040;
  {$EXTERNALSYM META_OFFSETVIEWPORTORG}
  META_OFFSETVIEWPORTORG = 529;
  {$EXTERNALSYM META_SCALEVIEWPORTEXT}
  META_SCALEVIEWPORTEXT = 1042;
  {$EXTERNALSYM META_LINETO}
  META_LINETO = 531;
  {$EXTERNALSYM META_MOVETO}
  META_MOVETO = 532;
  {$EXTERNALSYM META_EXCLUDECLIPRECT}
  META_EXCLUDECLIPRECT = 1045;
  {$EXTERNALSYM META_INTERSECTCLIPRECT}
  META_INTERSECTCLIPRECT = 1046;
  {$EXTERNALSYM META_ARC}
  META_ARC = 2071;
  {$EXTERNALSYM META_ELLIPSE}
  META_ELLIPSE = 1048;
  {$EXTERNALSYM META_FLOODFILL}
  META_FLOODFILL = 1049;
  {$EXTERNALSYM META_PIE}
  META_PIE = 2074;
  {$EXTERNALSYM META_RECTANGLE}
  META_RECTANGLE = 1051;
  {$EXTERNALSYM META_ROUNDRECT}
  META_ROUNDRECT = 1564;
  {$EXTERNALSYM META_PATBLT}
  META_PATBLT = 1565;
  {$EXTERNALSYM META_SAVEDC}
  META_SAVEDC = 30;
  {$EXTERNALSYM META_SETPIXEL}
  META_SETPIXEL = 1055;
  {$EXTERNALSYM META_OFFSETCLIPRGN}
  META_OFFSETCLIPRGN = 544;
  {$EXTERNALSYM META_TEXTOUT}
  META_TEXTOUT = 1313;
  {$EXTERNALSYM META_BITBLT}
  META_BITBLT = 2338;
  {$EXTERNALSYM META_STRETCHBLT}
  META_STRETCHBLT = 2851;
  {$EXTERNALSYM META_POLYGON}
  META_POLYGON = 804;
  {$EXTERNALSYM META_POLYLINE}
  META_POLYLINE = 805;
  {$EXTERNALSYM META_ESCAPE}
  META_ESCAPE = 1574;
  {$EXTERNALSYM META_RESTOREDC}
  META_RESTOREDC = 295;
  {$EXTERNALSYM META_FILLREGION}
  META_FILLREGION = 552;
  {$EXTERNALSYM META_FRAMEREGION}
  META_FRAMEREGION = 1065;
  {$EXTERNALSYM META_INVERTREGION}
  META_INVERTREGION = 298;
  {$EXTERNALSYM META_PAINTREGION}
  META_PAINTREGION = 299;
  {$EXTERNALSYM META_SELECTCLIPREGION}
  META_SELECTCLIPREGION = 300;
  {$EXTERNALSYM META_SELECTOBJECT}
  META_SELECTOBJECT = 301;
  {$EXTERNALSYM META_SETTEXTALIGN}
  META_SETTEXTALIGN = 302;
  {$EXTERNALSYM META_CHORD}
  META_CHORD = 2096;
  {$EXTERNALSYM META_SETMAPPERFLAGS}
  META_SETMAPPERFLAGS = 561;
  {$EXTERNALSYM META_EXTTEXTOUT}
  META_EXTTEXTOUT = 2610;
  {$EXTERNALSYM META_SETDIBTODEV}
  META_SETDIBTODEV = 3379;
  {$EXTERNALSYM META_SELECTPALETTE}
  META_SELECTPALETTE = 564;
  {$EXTERNALSYM META_REALIZEPALETTE}
  META_REALIZEPALETTE = 53;
  {$EXTERNALSYM META_ANIMATEPALETTE}
  META_ANIMATEPALETTE = 1078;
  {$EXTERNALSYM META_SETPALENTRIES}
  META_SETPALENTRIES = 55;
  {$EXTERNALSYM META_POLYPOLYGON}
  META_POLYPOLYGON = 1336;
  {$EXTERNALSYM META_RESIZEPALETTE}
  META_RESIZEPALETTE = 313;
  {$EXTERNALSYM META_DIBBITBLT}
  META_DIBBITBLT = 2368;
  {$EXTERNALSYM META_DIBSTRETCHBLT}
  META_DIBSTRETCHBLT = 2881;
  {$EXTERNALSYM META_DIBCREATEPATTERNBRUSH}
  META_DIBCREATEPATTERNBRUSH = 322;
  {$EXTERNALSYM META_STRETCHDIB}
  META_STRETCHDIB = 3907;
  {$EXTERNALSYM META_EXTFLOODFILL}
  META_EXTFLOODFILL = 1352;
  {$EXTERNALSYM META_DELETEOBJECT}
  META_DELETEOBJECT = 496;
  {$EXTERNALSYM META_CREATEPALETTE}
  META_CREATEPALETTE = 247;
  {$EXTERNALSYM META_CREATEPATTERNBRUSH}
  META_CREATEPATTERNBRUSH = 505;
  {$EXTERNALSYM META_CREATEPENINDIRECT}
  META_CREATEPENINDIRECT = 762;
  {$EXTERNALSYM META_CREATEFONTINDIRECT}
  META_CREATEFONTINDIRECT = 763;
  {$EXTERNALSYM META_CREATEBRUSHINDIRECT}
  META_CREATEBRUSHINDIRECT = 764;
  {$EXTERNALSYM META_CREATEREGION}
  META_CREATEREGION = 1791;


  { GDI Escapes }
  {$EXTERNALSYM NEWFRAME}
  NEWFRAME = 1;
  _ABORTDOC = 2; { Renamed }
  {$EXTERNALSYM NEXTBAND}
  NEXTBAND = 3;
  {$EXTERNALSYM SETCOLORTABLE}
  SETCOLORTABLE = 4;
  {$EXTERNALSYM GETCOLORTABLE}
  GETCOLORTABLE = 5;
  {$EXTERNALSYM FLUSHOUTPUT}
  FLUSHOUTPUT = 6;
  {$EXTERNALSYM DRAFTMODE}
  DRAFTMODE = 7;
  {$EXTERNALSYM QUERYESCSUPPORT}
  QUERYESCSUPPORT = 8;
  _SETABORTPROC = 9; { Renamed }
  _STARTDOC = 10; { Renamed }
  _ENDDOC = 11; { Renamed }
  {$EXTERNALSYM GETPHYSPAGESIZE}
  GETPHYSPAGESIZE = 12;
  {$EXTERNALSYM GETPRINTINGOFFSET}
  GETPRINTINGOFFSET = 13;
  {$EXTERNALSYM GETSCALINGFACTOR}
  GETSCALINGFACTOR = 14;
  {$EXTERNALSYM MFCOMMENT}
  MFCOMMENT = 15;
  {$EXTERNALSYM GETPENWIDTH}
  GETPENWIDTH = $10;
  {$EXTERNALSYM SETCOPYCOUNT}
  SETCOPYCOUNT = 17;
  {$EXTERNALSYM SELECTPAPERSOURCE}
  SELECTPAPERSOURCE = 18;
  {$EXTERNALSYM DEVICEDATA}
  DEVICEDATA = 19;
  {$EXTERNALSYM PASSTHROUGH}
  PASSTHROUGH = 19;
  {$EXTERNALSYM GETTECHNOLGY}
  GETTECHNOLGY = 20;
  {$EXTERNALSYM GETTECHNOLOGY}
  GETTECHNOLOGY = 20;
  {$EXTERNALSYM SETLINECAP}
  SETLINECAP = 21;
  {$EXTERNALSYM SETLINEJOIN}
  SETLINEJOIN = 22;
  _SETMITERLIMIT = 23; { Renamed }
  {$EXTERNALSYM BANDINFO}
  BANDINFO = 24;
  {$EXTERNALSYM DRAWPATTERNRECT}
  DRAWPATTERNRECT = 25;
  {$EXTERNALSYM GETVECTORPENSIZE}
  GETVECTORPENSIZE = 26;
  {$EXTERNALSYM GETVECTORBRUSHSIZE}
  GETVECTORBRUSHSIZE = 27;
  {$EXTERNALSYM ENABLEDUPLEX}
  ENABLEDUPLEX = 28;
  {$EXTERNALSYM GETSETPAPERBINS}
  GETSETPAPERBINS = 29;
  {$EXTERNALSYM GETSETPRINTORIENT}
  GETSETPRINTORIENT = 30;
  {$EXTERNALSYM ENUMPAPERBINS}
  ENUMPAPERBINS = 31;
  {$EXTERNALSYM SETDIBSCALING}
  SETDIBSCALING = $20;
  {$EXTERNALSYM EPSPRINTING}
  EPSPRINTING = 33;
  {$EXTERNALSYM ENUMPAPERMETRICS}
  ENUMPAPERMETRICS = 34;
  {$EXTERNALSYM GETSETPAPERMETRICS}
  GETSETPAPERMETRICS = 35;
  {$EXTERNALSYM POSTSCRIPT_DATA}
  POSTSCRIPT_DATA = 37;
  {$EXTERNALSYM POSTSCRIPT_IGNORE}
  POSTSCRIPT_IGNORE = 38;
  {$EXTERNALSYM MOUSETRAILS}
  MOUSETRAILS = 39;
  {$EXTERNALSYM GETDEVICEUNITS}
  GETDEVICEUNITS = 42;

  {$EXTERNALSYM GETEXTENDEDTEXTMETRICS}
  GETEXTENDEDTEXTMETRICS = 256;
  {$EXTERNALSYM GETEXTENTTABLE}
  GETEXTENTTABLE = 257;
  {$EXTERNALSYM GETPAIRKERNTABLE}
  GETPAIRKERNTABLE = 258;
  {$EXTERNALSYM GETTRACKKERNTABLE}
  GETTRACKKERNTABLE = 259;
  _EXTTEXTOUT = $200; { Renamed }
  {$EXTERNALSYM GETFACENAME}
  GETFACENAME = 513;
  {$EXTERNALSYM DOWNLOADFACE}
  DOWNLOADFACE = 514;
  {$EXTERNALSYM ENABLERELATIVEWIDTHS}
  ENABLERELATIVEWIDTHS = 768;
  {$EXTERNALSYM ENABLEPAIRKERNING}
  ENABLEPAIRKERNING = 769;
  {$EXTERNALSYM SETKERNTRACK}
  SETKERNTRACK = 770;
  {$EXTERNALSYM SETALLJUSTVALUES}
  SETALLJUSTVALUES = 771;
  {$EXTERNALSYM SETCHARSET}
  SETCHARSET = 772;

  _STRETCHBLT = $800; { Renamed }
  {$EXTERNALSYM GETSETSCREENPARAMS}
  GETSETSCREENPARAMS = 3072;
  {$EXTERNALSYM QUERYDIBSUPPORT}
  QUERYDIBSUPPORT = 3073;
  {$EXTERNALSYM BEGIN_PATH}
  BEGIN_PATH = $1000;
  {$EXTERNALSYM CLIP_TO_PATH}
  CLIP_TO_PATH = 4097;
  {$EXTERNALSYM END_PATH}
  END_PATH = 4098;
  {$EXTERNALSYM EXT_DEVICE_CAPS}
  EXT_DEVICE_CAPS = 4099;
  {$EXTERNALSYM RESTORE_CTM}
  RESTORE_CTM = 4100;
  {$EXTERNALSYM SAVE_CTM}
  SAVE_CTM = 4101;
  {$EXTERNALSYM SET_ARC_DIRECTION}
  SET_ARC_DIRECTION = 4102;
  {$EXTERNALSYM SET_BACKGROUND_COLOR}
  SET_BACKGROUND_COLOR = 4103;
  {$EXTERNALSYM SET_POLY_MODE}
  SET_POLY_MODE = 4104;
  {$EXTERNALSYM SET_SCREEN_ANGLE}
  SET_SCREEN_ANGLE = 4105;
  {$EXTERNALSYM SET_SPREAD}
  SET_SPREAD = 4106;
  {$EXTERNALSYM TRANSFORM_CTM}
  TRANSFORM_CTM = 4107;
  {$EXTERNALSYM SET_CLIP_BOX}
  SET_CLIP_BOX = 4108;
  {$EXTERNALSYM SET_BOUNDS}
  SET_BOUNDS = 4109;
  {$EXTERNALSYM SET_MIRROR_MODE}
  SET_MIRROR_MODE = 4110;
  {$EXTERNALSYM OPENCHANNEL}
  OPENCHANNEL = 4110;
  {$EXTERNALSYM DOWNLOADHEADER}
  DOWNLOADHEADER = 4111;
  {$EXTERNALSYM CLOSECHANNEL}
  CLOSECHANNEL = 4112;
  {$EXTERNALSYM POSTSCRIPT_PASSTHROUGH}
  POSTSCRIPT_PASSTHROUGH = 4115;
  {$EXTERNALSYM ENCAPSULATED_POSTSCRIPT}
  ENCAPSULATED_POSTSCRIPT = 4116;

  { Flag returned from QUERYDIBSUPPORT }
  {$EXTERNALSYM QDI_SETDIBITS}
  QDI_SETDIBITS = 1;
  {$EXTERNALSYM QDI_GETDIBITS}
  QDI_GETDIBITS = 2;
  {$EXTERNALSYM QDI_DIBTOSCREEN}
  QDI_DIBTOSCREEN = 4;
  {$EXTERNALSYM QDI_STRETCHDIB}
  QDI_STRETCHDIB = 8;


  { Spooler Error Codes }
  {$EXTERNALSYM SP_NOTREPORTED}
  SP_NOTREPORTED = $4000;
  {$EXTERNALSYM SP_ERROR}
  SP_ERROR = LongWord(-1);
  {$EXTERNALSYM SP_APPABORT}
  SP_APPABORT = LongWord(-2);
  {$EXTERNALSYM SP_USERABORT}
  SP_USERABORT = LongWord(-3);
  {$EXTERNALSYM SP_OUTOFDISK}
  SP_OUTOFDISK = LongWord(-4);
  {$EXTERNALSYM SP_OUTOFMEMORY}
  SP_OUTOFMEMORY = LongWord(-5);

  {$EXTERNALSYM PR_JOBSTATUS}
  PR_JOBSTATUS = 0;


  { Object Definitions for EnumObjects() }
  {$EXTERNALSYM OBJ_PEN}
  OBJ_PEN = 1;
  {$EXTERNALSYM OBJ_BRUSH}
  OBJ_BRUSH = 2;
  {$EXTERNALSYM OBJ_DC}
  OBJ_DC = 3;
  {$EXTERNALSYM OBJ_METADC}
  OBJ_METADC = 4;
  {$EXTERNALSYM OBJ_PAL}
  OBJ_PAL = 5;
  {$EXTERNALSYM OBJ_FONT}
  OBJ_FONT = 6;
  {$EXTERNALSYM OBJ_BITMAP}
  OBJ_BITMAP = 7;
  {$EXTERNALSYM OBJ_REGION}
  OBJ_REGION = 8;
  {$EXTERNALSYM OBJ_METAFILE}
  OBJ_METAFILE = 9;
  {$EXTERNALSYM OBJ_MEMDC}
  OBJ_MEMDC = 10;
  {$EXTERNALSYM OBJ_EXTPEN}
  OBJ_EXTPEN = 11;
  {$EXTERNALSYM OBJ_ENHMETADC}
  OBJ_ENHMETADC = 12;
  {$EXTERNALSYM OBJ_ENHMETAFILE}
  OBJ_ENHMETAFILE = 13;


  { xform stuff }
  {$EXTERNALSYM MWT_IDENTITY}
  MWT_IDENTITY = 1;
  {$EXTERNALSYM MWT_LEFTMULTIPLY}
  MWT_LEFTMULTIPLY = 2;
  {$EXTERNALSYM MWT_RIGHTMULTIPLY}
  MWT_RIGHTMULTIPLY = 3;

  {$EXTERNALSYM MWT_MIN}
  MWT_MIN = MWT_IDENTITY;
  {$EXTERNALSYM MWT_MAX}
  MWT_MAX = MWT_RIGHTMULTIPLY;


type
  PXForm = ^TXForm;
  {$EXTERNALSYM tagXFORM}
  tagXFORM = packed record
    eM11: Single;
    eM12: Single;
    eM21: Single;
    eM22: Single;
    eDx: Single;
    eDy: Single;
  end;
  TXForm = tagXFORM;
  {$EXTERNALSYM XFORM}
  XFORM = tagXFORM;

{ Bitmap Header Definition }
  PBitmap = ^TBitmap;
  {$EXTERNALSYM tagBITMAP}
  tagBITMAP = packed record
    bmType: Longint;
    bmWidth: Longint;
    bmHeight: Longint;
    bmWidthBytes: Longint;
    bmPlanes: Word;
    bmBitsPixel: Word;
    bmBits: Pointer;
  end;
  TBitmap = tagBITMAP;
  {$EXTERNALSYM BITMAP}
  BITMAP = tagBITMAP;

  PRGBTriple = ^TRGBTriple;
  {$EXTERNALSYM tagRGBTRIPLE}
  tagRGBTRIPLE = packed record
    rgbtBlue: Byte;
    rgbtGreen: Byte;
    rgbtRed: Byte;
  end;
  TRGBTriple = tagRGBTRIPLE;
  {$EXTERNALSYM RGBTRIPLE}
  RGBTRIPLE = tagRGBTRIPLE;

  PRGBQuad = ^TRGBQuad;
  {$EXTERNALSYM tagRGBQUAD}
  tagRGBQUAD = packed record
    rgbBlue: Byte;
    rgbGreen: Byte;
    rgbRed: Byte;
    rgbReserved: Byte;
  end;
  TRGBQuad = tagRGBQUAD;
  {$EXTERNALSYM RGBQUAD}
  RGBQUAD = tagRGBQUAD;


  { Image Color Matching color definitions }
  {$EXTERNALSYM LCSCSTYPE}
  LCSCSTYPE = Longint;
const
  {$EXTERNALSYM LCS_CALIBRATED_RGB}
  LCS_CALIBRATED_RGB = 0;
  {$EXTERNALSYM LCS_DEVICE_RGB}
  LCS_DEVICE_RGB = 1;
  {$EXTERNALSYM LCS_DEVICE_CMYK}
  LCS_DEVICE_CMYK = 2;

type
  {$EXTERNALSYM LCSGAMUTMATCH}
  LCSGAMUTMATCH = Longint;
const
  {$EXTERNALSYM LCS_GM_BUSINESS}
  LCS_GM_BUSINESS = 1;
  {$EXTERNALSYM LCS_GM_GRAPHICS}
  LCS_GM_GRAPHICS = 2;
  {$EXTERNALSYM LCS_GM_IMAGES}
  LCS_GM_IMAGES = 4;


  { ICM Defines for results from CheckColorInGamut() }
  {$EXTERNALSYM CM_OUT_OF_GAMUT}
  CM_OUT_OF_GAMUT = 255;
  {$EXTERNALSYM CM_IN_GAMUT}
  CM_IN_GAMUT = 0;


{ functions to retrieve CMYK values from a COLORREF }

{$EXTERNALSYM GetCValue}
function GetCValue(cmyk: COLORREF): Byte;
{$EXTERNALSYM GetMValue}
function GetMValue(cmyk: COLORREF): Byte;
{$EXTERNALSYM GetYValue}
function GetYValue(cmyk: COLORREF): Byte;
{$EXTERNALSYM GetKValue}
function GetKValue(cmyk: COLORREF): Byte;
{$EXTERNALSYM CMYK}
function CMYK(c, m, y, k: Byte): COLORREF;

type
  {$EXTERNALSYM FXPT16DOT16}
  FXPT16DOT16 = Longint;
  {$EXTERNALSYM LPFXPT16DOT16}
  LPFXPT16DOT16 = ^Longint;
  {$EXTERNALSYM FXPT2DOT30}
  FXPT2DOT30 = Longint;
  {$EXTERNALSYM LPFXPT2DOT30}
  LPFXPT2DOT30 = ^Longint;


  { ICM Color Definitions }
  { The following two structures are used for defining RGB's in terms of
    CIEXYZ. The values are fixed point 16.16. }

  PCIEXYZ = ^TCIEXYZ;
  {$EXTERNALSYM tagCIEXYZ}
  tagCIEXYZ = packed record
    ciexyzX: FXPT2DOT30;
    ciexyzY: FXPT2DOT30;
    ciexyzZ: FXPT2DOT30;
  end;
  TCIEXYZ = tagCIEXYZ;
  {$EXTERNALSYM CIEXYZ}
  CIEXYZ = tagCIEXYZ;

  PCIEXYZTriple = ^TCIEXYZTriple;
  {$EXTERNALSYM tagICEXYZTRIPLE}
  tagICEXYZTRIPLE = packed record
    ciexyzRed: TCIEXYZ;
    ciexyzGreen: TCIEXYZ;
    ciexyzBlue: TCIEXYZ;
  end;
  TCIEXYZTriple = tagICEXYZTRIPLE;
  {$EXTERNALSYM CIEXYZTRIPLE}
  CIEXYZTRIPLE = tagICEXYZTRIPLE;

  { The next structures the logical color space. Unlike pens and brushes,
    but like palettes, there is only one way to create a LogColorSpace.
    A pointer to it must be passed, its elements can't be pushed as
    arguments. }

type
  PLogColorSpaceA = ^TLogColorSpaceA;
  PLogColorSpaceW = ^TLogColorSpaceW;
  PLogColorSpace = PLogColorSpaceA;
  {$EXTERNALSYM tagLOGCOLORSPACEA}
  tagLOGCOLORSPACEA = packed record
    lcsSignature: DWORD;
    lcsVersion: DWORD;
    lcsSize: DWORD;
    lcsCSType: LCSCSTYPE;
    lcsIntent: LCSGAMUTMATCH;
    lcsEndpoints: TCIEXYZTriple;
    lcsGammaRed: DWORD;
    lcsGammaGreen: DWORD;
    lcsGammaBlue: DWORD;
    lcsFilename: array[0..259] of AnsiChar;
  end;
  {$EXTERNALSYM tagLOGCOLORSPACEW}
  tagLOGCOLORSPACEW = packed record
    lcsSignature: DWORD;
    lcsVersion: DWORD;
    lcsSize: DWORD;
    lcsCSType: LCSCSTYPE;
    lcsIntent: LCSGAMUTMATCH;
    lcsEndpoints: TCIEXYZTriple;
    lcsGammaRed: DWORD;
    lcsGammaGreen: DWORD;
    lcsGammaBlue: DWORD;
    lcsFilename: array[0..259] of WideChar;
  end;
  {$EXTERNALSYM tagLOGCOLORSPACE}
  tagLOGCOLORSPACE = tagLOGCOLORSPACEA;
  TLogColorSpaceA = tagLOGCOLORSPACEA;
  TLogColorSpaceW = tagLOGCOLORSPACEW;
  TLogColorSpace = TLogColorSpaceA;
  {$EXTERNALSYM LOGCOLORSPACEA}
  LOGCOLORSPACEA = tagLOGCOLORSPACEA;
  {$EXTERNALSYM LOGCOLORSPACEW}
  LOGCOLORSPACEW = tagLOGCOLORSPACEW;
  {$EXTERNALSYM LOGCOLORSPACE}
  LOGCOLORSPACE = LOGCOLORSPACEA;

  { structures for defining DIBs - used to get to color table }
  PBitmapCoreHeader = ^TBitmapCoreHeader;
  {$EXTERNALSYM tagBITMAPCOREHEADER}
  tagBITMAPCOREHEADER = packed record
    bcSize: DWORD;
    bcWidth: Word;
    bcHeight: Word;
    bcPlanes: Word;
    bcBitCount: Word;
  end;
  TBitmapCoreHeader = tagBITMAPCOREHEADER;
  {$EXTERNALSYM BITMAPCOREHEADER}
  BITMAPCOREHEADER = tagBITMAPCOREHEADER;

  PBitmapInfoHeader = ^TBitmapInfoHeader;
  {$EXTERNALSYM tagBITMAPINFOHEADER}
  tagBITMAPINFOHEADER = packed record
    biSize: DWORD;
    biWidth: Longint;
    biHeight: Longint;
    biPlanes: Word;
    biBitCount: Word;
    biCompression: DWORD;
    biSizeImage: DWORD;
    biXPelsPerMeter: Longint;
    biYPelsPerMeter: Longint;
    biClrUsed: DWORD;
    biClrImportant: DWORD;
  end;
  TBitmapInfoHeader = tagBITMAPINFOHEADER;
  {$EXTERNALSYM BITMAPINFOHEADER}
  BITMAPINFOHEADER = tagBITMAPINFOHEADER;

  PBitmapV4Header = ^TBitmapV4Header;
  {$EXTERNALSYM BITMAPV4HEADER}
  BITMAPV4HEADER = packed record
    bV4Size: DWORD;
    bV4Width: Longint;
    bV4Height: Longint;
    bV4Planes: Word;
    bV4BitCount: Word;
    bV4V4Compression: DWORD;
    bV4SizeImage: DWORD;
    bV4XPelsPerMeter: Longint;
    bV4YPelsPerMeter: Longint;
    bV4ClrUsed: DWORD;
    bV4ClrImportant: DWORD;
    bV4RedMask: DWORD;
    bV4GreenMask: DWORD;
    bV4BlueMask: DWORD;
    bV4AlphaMask: DWORD;
    bV4CSType: DWORD;
    bV4Endpoints: TCIEXYZTriple;
    bV4GammaRed: DWORD;
    bV4GammaGreen: DWORD;
    bV4GammaBlue: DWORD;
  end;
  TBitmapV4Header = BITMAPV4HEADER;

  PBitmapV5Header = ^TBitmapV5Header;
  {$EXTERNALSYM BITMAPV5HEADER}
  BITMAPV5HEADER = packed record
    bV5Size: DWORD;
    bV5Width: Longint;
    bV5Height: Longint;
    bV5Planes: Word;
    bV5BitCount: Word;
    bV5Compression: DWORD;
    bV5SizeImage: DWORD;
    bV5XPelsPerMeter: Longint;
    bV5YPelsPerMeter: Longint;
    bV5ClrUsed: DWORD;
    bV5ClrImportant: DWORD;
    bV5RedMask: DWORD;
    bV5GreenMask: DWORD;
    bV5BlueMask: DWORD;
    bV5AlphaMask: DWORD;
    bV5CSType: DWORD;
    bV5Endpoints: TCIEXYZTriple;
    bV5GammaRed: DWORD;
    bV5GammaGreen: DWORD;
    bV5GammaBlue: DWORD;
    bV5Intent: DWORD;
    bV5ProfileData: DWORD;
    bV5ProfileSize: DWORD;
    bV5Reserved: DWORD;
  end;
  TBitmapV5Header = BITMAPV5HEADER;

const
  { constants for the biCompression field }
  {$EXTERNALSYM BI_RGB}
  BI_RGB = 0;
  {$EXTERNALSYM BI_RLE8}
  BI_RLE8 = 1;
  {$EXTERNALSYM BI_RLE4}
  BI_RLE4 = 2;
  {$EXTERNALSYM BI_BITFIELDS}
  BI_BITFIELDS = 3;

type
  PBitmapInfo = ^TBitmapInfo;
  {$EXTERNALSYM tagBITMAPINFO}
  tagBITMAPINFO = packed record
    bmiHeader: TBitmapInfoHeader;
    bmiColors: array[0..0] of TRGBQuad;
  end;
  TBitmapInfo = tagBITMAPINFO;
  {$EXTERNALSYM BITMAPINFO}
  BITMAPINFO = tagBITMAPINFO;

  PBitmapCoreInfo = ^TBitmapCoreInfo;
  {$EXTERNALSYM tagBITMAPCOREINFO}
  tagBITMAPCOREINFO = record
    bmciHeader: TBitmapCoreHeader;
    bmciColors: array[0..0] of TRGBTriple;
    Reserved: array[0..0] of Char;
  end;
  TBitmapCoreInfo = tagBITMAPCOREINFO;
  {$EXTERNALSYM BITMAPCOREINFO}
  BITMAPCOREINFO = tagBITMAPCOREINFO;

  PBitmapFileHeader = ^TBitmapFileHeader;
  {$EXTERNALSYM tagBITMAPFILEHEADER}
  tagBITMAPFILEHEADER = packed record
    bfType: Word;
    bfSize: DWORD;
    bfReserved1: Word;
    bfReserved2: Word;
    bfOffBits: DWORD;
  end;
  TBitmapFileHeader = tagBITMAPFILEHEADER;
  {$EXTERNALSYM BITMAPFILEHEADER}
  BITMAPFILEHEADER = tagBITMAPFILEHEADER;

  PFontSignature = ^TFontSignature;
  {$EXTERNALSYM tagFONTSIGNATURE}
  tagFONTSIGNATURE = packed record
    fsUsb: array[0..3] of DWORD;
    fsCsb: array[0..1] of DWORD;
  end;
  TFontSignature = tagFONTSIGNATURE;
  {$EXTERNALSYM FONTSIGNATURE}
  FONTSIGNATURE = tagFONTSIGNATURE;

  PCharsetInfo = ^TCharsetInfo;
  {$EXTERNALSYM tagCHARSETINFO}
  tagCHARSETINFO = packed record
    ciCharset: UINT;
    ciACP: UINT;
    fs: TFontSignature;
  end;
  TCharsetInfo = tagCHARSETINFO;
  {$EXTERNALSYM CHARSETINFO}
  CHARSETINFO = tagCHARSETINFO;

const
  {$EXTERNALSYM TCI_SRCCHARSET}
  TCI_SRCCHARSET = 1;
  {$EXTERNALSYM TCI_SRCCODEPAGE}
  TCI_SRCCODEPAGE = 2;
  {$EXTERNALSYM TCI_SRCFONTSIG}
  TCI_SRCFONTSIG = 3;

type
  PLocaleSignature = ^TLocaleSignature;
  {$EXTERNALSYM tagLOCALESIGNATURE}
  tagLOCALESIGNATURE = packed record
    lsUsb: array[0..3] of DWORD;
    lsCsbDefault: array[0..1] of DWORD;
    lsCsbSupported: array[0..1] of DWORD;
  end;
  TLocaleSignature = tagLOCALESIGNATURE;
  {$EXTERNALSYM LOCALESIGNATURE}
  LOCALESIGNATURE = tagLOCALESIGNATURE;

  { Clipboard Metafile Picture Structure }
  PHandleTable = ^THandleTable;
  {$EXTERNALSYM tagHANDLETABLE}
  tagHANDLETABLE = packed record
    objectHandle: array[0..0] of HGDIOBJ;
  end;
  THandleTable = tagHANDLETABLE;
  {$EXTERNALSYM HANDLETABLE}
  HANDLETABLE = tagHANDLETABLE;

  PMetaRecord = ^TMetaRecord;
  {$EXTERNALSYM tagMETARECORD}
  tagMETARECORD = packed record
    rdSize: DWORD;
    rdFunction: Word;
    rdParm: array[0..0] of Word;
  end;
  TMetaRecord = tagMETARECORD;
  {$EXTERNALSYM METARECORD}
  METARECORD = tagMETARECORD;

  PMetafilePict = ^TMetafilePict;
  {$EXTERNALSYM tagMETAFILEPICT}
  tagMETAFILEPICT = packed record
    mm: Longint;
    xExt: Longint;
    yExt: Longint;
    hMF: HMETAFILE;
  end;
  TMetafilePict = tagMETAFILEPICT;
  {$EXTERNALSYM METAFILEPICT}
  METAFILEPICT = tagMETAFILEPICT;

  PMetaHeader = ^TMetaHeader;
  {$EXTERNALSYM tagMETAHEADER}
  tagMETAHEADER = packed record
    mtType: Word;
    mtHeaderSize: Word;
    mtVersion: Word;
    mtSize: DWORD;
    mtNoObjects: Word;
    mtMaxRecord: DWORD;
    mtNoParameters: Word;
  end;
  TMetaHeader = tagMETAHEADER;
  {$EXTERNALSYM METAHEADER}
  METAHEADER = tagMETAHEADER;

  { Enhanced Metafile structures }

  PEnhMetaRecord = ^TEnhMetaRecord;
  {$EXTERNALSYM tagENHMETARECORD}
  tagENHMETARECORD = packed record
    iType: DWORD; { Record type EMR_XXX}
    nSize: DWORD; { Record size in bytes}
    dParm: array[0..0] of DWORD; { Parameters}
  end;
  TEnhMetaRecord = tagENHMETARECORD;
  {$EXTERNALSYM ENHMETARECORD}
  ENHMETARECORD = tagENHMETARECORD;

  PEnhMetaHeader = ^TEnhMetaHeader;
  {$EXTERNALSYM tagENHMETAHEADER}
  tagENHMETAHEADER = packed record
    iType: DWORD;          { Record type EMR_HEADER}
    nSize: DWORD;          { Record size in bytes.  This may be greater
                             than the sizeof(TEnhMetaHeader). }
    rclBounds: TRect;     { Inclusive-inclusive bounds in device units}
    rclFrame: TRect;      { Inclusive-inclusive Picture Frame of metafile in .01 mm units}
    dSignature: DWORD;     { Signature.  Must be ENHMETA_SIGNATURE.}
    nVersion: DWORD;       { Version number}
    nBytes: DWORD;         { Size of the metafile in bytes}
    nRecords: DWORD;       { Number of records in the metafile}
    nHandles: Word;        { Number of handles in the handle table
                             Handle index zero is reserved. }
    sReserved: Word;       { Reserved.  Must be zero.}
    nDescription: DWORD;   { Number of chars in the unicode description string
                             This is 0 if there is no description string }
    offDescription: DWORD; { Offset to the metafile description record. }
                           { This is 0 if there is no description string }
    nPalEntries: DWORD;    { Number of entries in the metafile palette.}
    szlDevice: TSize;      { Size of the reference device in pels}
    szlMillimeters: TSize; { Size of the reference device in millimeters}
    cbPixelFormat: DWORD;  { Size of TPixelFormatDescriptor information }
                           { This is 0 if no pixel format is set }
    offPixelFormat: DWORD; { Offset to TPixelFormatDescriptor }
                           { This is 0 if no pixel format is set }
    bOpenGL: DWORD;        { True if OpenGL commands are present in }
                           { the metafile, otherwise FALSE }
  end;
  TEnhMetaHeader = tagENHMETAHEADER;
  {$EXTERNALSYM ENHMETAHEADER}
  ENHMETAHEADER = tagENHMETAHEADER;

const
  { tmPitchAndFamily flags }
  {$EXTERNALSYM TMPF_FIXED_PITCH}
  TMPF_FIXED_PITCH = 1;
  {$EXTERNALSYM TMPF_VECTOR}
  TMPF_VECTOR = 2;
  {$EXTERNALSYM TMPF_DEVICE}
  TMPF_DEVICE = 8;
  {$EXTERNALSYM TMPF_TRUETYPE}
  TMPF_TRUETYPE = 4;

type
  PTextMetricA = ^TTextMetricA;
  PTextMetricW = ^TTextMetricW;
  PTextMetric = PTextMetricA;
  {$EXTERNALSYM tagTEXTMETRICA}
  tagTEXTMETRICA = record
    tmHeight: Longint;
    tmAscent: Longint;
    tmDescent: Longint;
    tmInternalLeading: Longint;
    tmExternalLeading: Longint;
    tmAveCharWidth: Longint;
    tmMaxCharWidth: Longint;
    tmWeight: Longint;
    tmOverhang: Longint;
    tmDigitizedAspectX: Longint;
    tmDigitizedAspectY: Longint;
    tmFirstChar: AnsiChar;
    tmLastChar: AnsiChar;
    tmDefaultChar: AnsiChar;
    tmBreakChar: AnsiChar;
    tmItalic: Byte;
    tmUnderlined: Byte;
    tmStruckOut: Byte;
    tmPitchAndFamily: Byte;
    tmCharSet: Byte;
  end;
  {$EXTERNALSYM tagTEXTMETRICW}
  tagTEXTMETRICW = record
    tmHeight: Longint;
    tmAscent: Longint;
    tmDescent: Longint;
    tmInternalLeading: Longint;
    tmExternalLeading: Longint;
    tmAveCharWidth: Longint;
    tmMaxCharWidth: Longint;
    tmWeight: Longint;
    tmOverhang: Longint;
    tmDigitizedAspectX: Longint;
    tmDigitizedAspectY: Longint;
    tmFirstChar: WideChar;
    tmLastChar: WideChar;
    tmDefaultChar: WideChar;
    tmBreakChar: WideChar;
    tmItalic: Byte;
    tmUnderlined: Byte;
    tmStruckOut: Byte;
    tmPitchAndFamily: Byte;
    tmCharSet: Byte;
  end;
  {$EXTERNALSYM tagTEXTMETRIC}
  tagTEXTMETRIC = tagTEXTMETRICA;
  TTextMetricA = tagTEXTMETRICA;
  TTextMetricW = tagTEXTMETRICW;
  TTextMetric = TTextMetricA;
  {$EXTERNALSYM TEXTMETRICA}
  TEXTMETRICA = tagTEXTMETRICA;
  {$EXTERNALSYM TEXTMETRICW}
  TEXTMETRICW = tagTEXTMETRICW;
  {$EXTERNALSYM TEXTMETRIC}
  TEXTMETRIC = TEXTMETRICA;

const
  { ntmFlags field flags }
  {$EXTERNALSYM NTM_REGULAR}
  NTM_REGULAR = $40;
  {$EXTERNALSYM NTM_BOLD}
  NTM_BOLD = $20;
  {$EXTERNALSYM NTM_ITALIC}
  NTM_ITALIC = 1;

type
  PNewTextMetricA = ^TNewTextMetricA;
  PNewTextMetricW = ^TNewTextMetricW;
  PNewTextMetric = PNewTextMetricA;
  {$EXTERNALSYM tagNEWTEXTMETRICA}
  tagNEWTEXTMETRICA = record
    tmHeight: Longint;
    tmAscent: Longint;
    tmDescent: Longint;
    tmInternalLeading: Longint;
    tmExternalLeading: Longint;
    tmAveCharWidth: Longint;
    tmMaxCharWidth: Longint;
    tmWeight: Longint;
    tmOverhang: Longint;
    tmDigitizedAspectX: Longint;
    tmDigitizedAspectY: Longint;
    tmFirstChar: AnsiChar;
    tmLastChar: AnsiChar;
    tmDefaultChar: AnsiChar;
    tmBreakChar: AnsiChar;
    tmItalic: Byte;
    tmUnderlined: Byte;
    tmStruckOut: Byte;
    tmPitchAndFamily: Byte;
    tmCharSet: Byte;
    ntmFlags: DWORD;
    ntmSizeEM: UINT;
    ntmCellHeight: UINT;
    ntmAvgWidth: UINT;
  end;
  {$EXTERNALSYM tagNEWTEXTMETRICW}
  tagNEWTEXTMETRICW = record
    tmHeight: Longint;
    tmAscent: Longint;
    tmDescent: Longint;
    tmInternalLeading: Longint;
    tmExternalLeading: Longint;
    tmAveCharWidth: Longint;
    tmMaxCharWidth: Longint;
    tmWeight: Longint;
    tmOverhang: Longint;
    tmDigitizedAspectX: Longint;
    tmDigitizedAspectY: Longint;
    tmFirstChar: WideChar;
    tmLastChar: WideChar;
    tmDefaultChar: WideChar;
    tmBreakChar: WideChar;
    tmItalic: Byte;
    tmUnderlined: Byte;
    tmStruckOut: Byte;
    tmPitchAndFamily: Byte;
    tmCharSet: Byte;
    ntmFlags: DWORD;
    ntmSizeEM: UINT;
    ntmCellHeight: UINT;
    ntmAvgWidth: UINT;
  end;
  {$EXTERNALSYM tagNEWTEXTMETRIC}
  tagNEWTEXTMETRIC = tagNEWTEXTMETRICA;
  TNewTextMetricA = tagNEWTEXTMETRICA;
  TNewTextMetricW = tagNEWTEXTMETRICW;
  TNewTextMetric = TNewTextMetricA;
  {$EXTERNALSYM NEWTEXTMETRICA}
  NEWTEXTMETRICA = tagNEWTEXTMETRICA;
  {$EXTERNALSYM NEWTEXTMETRICW}
  NEWTEXTMETRICW = tagNEWTEXTMETRICW;
  {$EXTERNALSYM NEWTEXTMETRIC}
  NEWTEXTMETRIC = NEWTEXTMETRICA;

  PNewTextMetricExA = ^TNewTextMetricExA;
  {$EXTERNALSYM tagNEWTEXTMETRICEXA}
  tagNEWTEXTMETRICEXA = packed record
    ntmTm: TNewTextMetricA;
    ntmFontSig: TFontSignature;
  end;
  TNewTextMetricExA = tagNEWTEXTMETRICEXA;
  {$EXTERNALSYM NEWTEXTMETRICEXA}
  NEWTEXTMETRICEXA = tagNEWTEXTMETRICEXA;
  PNewTextMetricExW = ^TNewTextMetricExW;
  {$EXTERNALSYM tagNEWTEXTMETRICEXW}
  tagNEWTEXTMETRICEXW = packed record
    ntmTm: TNewTextMetricW;
    ntmFontSig: TFontSignature;
  end;
  TNewTextMetricExW = tagNEWTEXTMETRICEXW;
  {$EXTERNALSYM NEWTEXTMETRICEXW}
  NEWTEXTMETRICEXW = tagNEWTEXTMETRICEXW;
  PNewTextMetricEx = PNewTextMetricExA;

{ GDI Logical Objects: }

  { Pel Array }
  PPelArray = ^TPelArray;
  {$EXTERNALSYM tagPELARRAY}
  tagPELARRAY = record
    paXCount: Longint;
    paYCount: Longint;
    paXExt: Longint;
    paYExt: Longint;
    paRGBs: Byte;
  end;
  TPelArray = tagPELARRAY;
  {$EXTERNALSYM PELARRAY}
  PELARRAY = tagPELARRAY;

  { Logical Brush (or Pattern) }
  PLogBrush = ^TLogBrush;
  {$EXTERNALSYM tagLOGBRUSH}
  tagLOGBRUSH = packed record
    lbStyle: UINT;
    lbColor: COLORREF;
    lbHatch: Longint;
  end;
  TLogBrush = tagLOGBRUSH;
  {$EXTERNALSYM LOGBRUSH}
  LOGBRUSH = tagLOGBRUSH;

  PPattern = ^TPattern;
  TPattern = TLogBrush;

  { Logical Pen }
  PLogPen = ^TLogPen;
  {$EXTERNALSYM tagLOGPEN}
  tagLOGPEN = packed record
    lopnStyle: UINT;
    lopnWidth: TPoint;
    lopnColor: COLORREF;
  end;
  TLogPen = tagLOGPEN;
  {$EXTERNALSYM LOGPEN}
  LOGPEN = tagLOGPEN;

  PExtLogPen = ^TLogPen;
  {$EXTERNALSYM tagEXTLOGPEN}
  tagEXTLOGPEN = packed record
    elpPenStyle: DWORD;
    elpWidth: DWORD;
    elpBrushStyle: UINT;
    elpColor: COLORREF;
    elpHatch: Longint;
    elpNumEntries: DWORD;
    elpStyleEntry: array[0..0] of DWORD;
  end;
  TExtLogPen = tagEXTLOGPEN;
  {$EXTERNALSYM EXTLOGPEN}
  EXTLOGPEN = tagEXTLOGPEN;

  PPaletteEntry = ^TPaletteEntry;
  {$EXTERNALSYM tagPALETTEENTRY}
  tagPALETTEENTRY = packed record
    peRed: Byte;
    peGreen: Byte;
    peBlue: Byte;
    peFlags: Byte;
  end;
  TPaletteEntry = tagPALETTEENTRY;
  {$EXTERNALSYM PALETTEENTRY}
  PALETTEENTRY = tagPALETTEENTRY;


  { Logical Palette }
  PLogPalette = ^TLogPalette;
  {$EXTERNALSYM tagLOGPALETTE}
  tagLOGPALETTE = packed record
    palVersion: Word;
    palNumEntries: Word;
    palPalEntry: array[0..0] of TPaletteEntry;
  end;
  TLogPalette = tagLOGPALETTE;
  {$EXTERNALSYM LOGPALETTE}
  LOGPALETTE = tagLOGPALETTE;

  PMaxLogPalette = ^TMaxLogPalette; // not in Windows Headers
  TMaxLogPalette = packed record
    palVersion: Word;
    palNumEntries: Word;
    palPalEntry: array [Byte] of TPaletteEntry;
  end;

const
  { Logical Font }
  {$EXTERNALSYM LF_FACESIZE}
  LF_FACESIZE = 32;

type
  PLogFontA = ^TLogFontA;
  PLogFontW = ^TLogFontW;
  PLogFont = PLogFontA;
  {$EXTERNALSYM tagLOGFONTA}
  tagLOGFONTA = packed record
    lfHeight: Longint;
    lfWidth: Longint;
    lfEscapement: Longint;
    lfOrientation: Longint;
    lfWeight: Longint;
    lfItalic: Byte;
    lfUnderline: Byte;
    lfStrikeOut: Byte;
    lfCharSet: Byte;
    lfOutPrecision: Byte;
    lfClipPrecision: Byte;
    lfQuality: Byte;
    lfPitchAndFamily: Byte;
    lfFaceName: array[0..LF_FACESIZE - 1] of AnsiChar;
  end;
  {$EXTERNALSYM tagLOGFONTW}
  tagLOGFONTW = packed record
    lfHeight: Longint;
    lfWidth: Longint;
    lfEscapement: Longint;
    lfOrientation: Longint;
    lfWeight: Longint;
    lfItalic: Byte;
    lfUnderline: Byte;
    lfStrikeOut: Byte;
    lfCharSet: Byte;
    lfOutPrecision: Byte;
    lfClipPrecision: Byte;
    lfQuality: Byte;
    lfPitchAndFamily: Byte;
    lfFaceName: array[0..LF_FACESIZE - 1] of WideChar;
  end;
  {$EXTERNALSYM tagLOGFONT}
  tagLOGFONT = tagLOGFONTA;
  TLogFontA = tagLOGFONTA;
  TLogFontW = tagLOGFONTW;
  TLogFont = TLogFontA;
  {$EXTERNALSYM LOGFONTA}
  LOGFONTA = tagLOGFONTA;
  {$EXTERNALSYM LOGFONTW}
  LOGFONTW = tagLOGFONTW;
  {$EXTERNALSYM LOGFONT}
  LOGFONT = LOGFONTA;

const
  {$EXTERNALSYM LF_FULLFACESIZE}
  LF_FULLFACESIZE = 64;

type
  { Structure passed to FONTENUMPROC }
  PEnumLogFontA = ^TEnumLogFontA;
  PEnumLogFontW = ^TEnumLogFontW;
  PEnumLogFont = PEnumLogFontA;
  {$EXTERNALSYM tagENUMLOGFONTA}
  tagENUMLOGFONTA = packed record
    elfLogFont: TLogFontA;
    elfFullName: array[0..LF_FULLFACESIZE - 1] of AnsiChar;
    elfStyle: array[0..LF_FACESIZE - 1] of AnsiChar;
  end;
  {$EXTERNALSYM tagENUMLOGFONTW}
  tagENUMLOGFONTW = packed record
    elfLogFont: TLogFontW;
    elfFullName: array[0..LF_FULLFACESIZE - 1] of WideChar;
    elfStyle: array[0..LF_FACESIZE - 1] of WideChar;
  end;
  {$EXTERNALSYM tagENUMLOGFONT}
  tagENUMLOGFONT = tagENUMLOGFONTA;
  TEnumLogFontA = tagENUMLOGFONTA;
  TEnumLogFontW = tagENUMLOGFONTW;
  TEnumLogFont = TEnumLogFontA;
  {$EXTERNALSYM ENUMLOGFONTA}
  ENUMLOGFONTA = tagENUMLOGFONTA;
  {$EXTERNALSYM ENUMLOGFONTW}
  ENUMLOGFONTW = tagENUMLOGFONTW;
  {$EXTERNALSYM ENUMLOGFONT}
  ENUMLOGFONT = ENUMLOGFONTA;

  PEnumLogFontExA = ^TEnumLogFontExA;
  PEnumLogFontExW = ^TEnumLogFontExW;
  PEnumLogFontEx = PEnumLogFontExA;
  {$EXTERNALSYM tagENUMLOGFONTEXA}
  tagENUMLOGFONTEXA = packed record
    elfLogFont: TLogFont;
    elfFullName: array[0..LF_FULLFACESIZE - 1] of Char;
    elfStyle: array[0..LF_FACESIZE - 1] of Char;
    elfScript: array[0..LF_FACESIZE - 1] of Char;
  end;
  {$EXTERNALSYM tagENUMLOGFONTEXW}
  tagENUMLOGFONTEXW = packed record
    elfLogFont: TLogFont;
    elfFullName: array[0..LF_FULLFACESIZE - 1] of Char;
    elfStyle: array[0..LF_FACESIZE - 1] of Char;
    elfScript: array[0..LF_FACESIZE - 1] of Char;
  end;
  {$EXTERNALSYM tagENUMLOGFONTEX}
  tagENUMLOGFONTEX = tagENUMLOGFONTEXA;
  TEnumLogFontExA = tagENUMLOGFONTEXA;
  TEnumLogFontExW = tagENUMLOGFONTEXW;
  TEnumLogFontEx = TEnumLogFontExA;
  {$EXTERNALSYM ENUMLOGFONTEXA}
  ENUMLOGFONTEXA = tagENUMLOGFONTEXA;
  {$EXTERNALSYM ENUMLOGFONTEXW}
  ENUMLOGFONTEXW = tagENUMLOGFONTEXW;
  {$EXTERNALSYM ENUMLOGFONTEX}
  ENUMLOGFONTEX = ENUMLOGFONTEXA;

const
  {$EXTERNALSYM OUT_DEFAULT_PRECIS}
  OUT_DEFAULT_PRECIS = 0;
  {$EXTERNALSYM OUT_STRING_PRECIS}
  OUT_STRING_PRECIS = 1;
  {$EXTERNALSYM OUT_CHARACTER_PRECIS}
  OUT_CHARACTER_PRECIS = 2;
  {$EXTERNALSYM OUT_STROKE_PRECIS}
  OUT_STROKE_PRECIS = 3;
  {$EXTERNALSYM OUT_TT_PRECIS}
  OUT_TT_PRECIS = 4;
  {$EXTERNALSYM OUT_DEVICE_PRECIS}
  OUT_DEVICE_PRECIS = 5;
  {$EXTERNALSYM OUT_RASTER_PRECIS}
  OUT_RASTER_PRECIS = 6;
  {$EXTERNALSYM OUT_TT_ONLY_PRECIS}
  OUT_TT_ONLY_PRECIS = 7;
  {$EXTERNALSYM OUT_OUTLINE_PRECIS}
  OUT_OUTLINE_PRECIS = 8;
  {$EXTERNALSYM OUT_SCREEN_OUTLINE_PRECIS}
  OUT_SCREEN_OUTLINE_PRECIS = 9;

  {$EXTERNALSYM CLIP_DEFAULT_PRECIS}
  CLIP_DEFAULT_PRECIS = 0;
  {$EXTERNALSYM CLIP_CHARACTER_PRECIS}
  CLIP_CHARACTER_PRECIS = 1;
  {$EXTERNALSYM CLIP_STROKE_PRECIS}
  CLIP_STROKE_PRECIS = 2;
  {$EXTERNALSYM CLIP_MASK}
  CLIP_MASK = 15;
  {$EXTERNALSYM CLIP_LH_ANGLES}
  CLIP_LH_ANGLES = (1 shl 4);
  {$EXTERNALSYM CLIP_TT_ALWAYS}
  CLIP_TT_ALWAYS = (2 shl 4);
  {$EXTERNALSYM CLIP_EMBEDDED}
  CLIP_EMBEDDED  = (8 shl 4);

  {$EXTERNALSYM DEFAULT_QUALITY}
  DEFAULT_QUALITY = 0;
  {$EXTERNALSYM DRAFT_QUALITY}
  DRAFT_QUALITY = 1;
  {$EXTERNALSYM PROOF_QUALITY}
  PROOF_QUALITY = 2;
  {$EXTERNALSYM NONANTIALIASED_QUALITY}
  NONANTIALIASED_QUALITY = 3;
  {$EXTERNALSYM ANTIALIASED_QUALITY}
  ANTIALIASED_QUALITY = 4;

  {$EXTERNALSYM DEFAULT_PITCH}
  DEFAULT_PITCH = 0;
  {$EXTERNALSYM FIXED_PITCH}
  FIXED_PITCH = 1;
  {$EXTERNALSYM VARIABLE_PITCH}
  VARIABLE_PITCH = 2;
  {$EXTERNALSYM MONO_FONT}
  MONO_FONT = 8;

  {$EXTERNALSYM ANSI_CHARSET}
  ANSI_CHARSET = 0;
  {$EXTERNALSYM DEFAULT_CHARSET}
  DEFAULT_CHARSET = 1;
  {$EXTERNALSYM SYMBOL_CHARSET}
  SYMBOL_CHARSET = 2;
  {$EXTERNALSYM SHIFTJIS_CHARSET}
  SHIFTJIS_CHARSET = $80;
  {$EXTERNALSYM HANGEUL_CHARSET}
  HANGEUL_CHARSET = 129;
  {$EXTERNALSYM GB2312_CHARSET}
  GB2312_CHARSET = 134;
  {$EXTERNALSYM CHINESEBIG5_CHARSET}
  CHINESEBIG5_CHARSET = 136;
  {$EXTERNALSYM OEM_CHARSET}
  OEM_CHARSET = 255;
  {$EXTERNALSYM JOHAB_CHARSET}
  JOHAB_CHARSET = 130;
  {$EXTERNALSYM HEBREW_CHARSET}
  HEBREW_CHARSET = 177;
  {$EXTERNALSYM ARABIC_CHARSET}
  ARABIC_CHARSET = 178;
  {$EXTERNALSYM GREEK_CHARSET}
  GREEK_CHARSET = 161;
  {$EXTERNALSYM TURKISH_CHARSET}
  TURKISH_CHARSET = 162;
  {$EXTERNALSYM VIETNAMESE_CHARSET}
  VIETNAMESE_CHARSET = 163;
  {$EXTERNALSYM THAI_CHARSET}
  THAI_CHARSET = 222;
  {$EXTERNALSYM EASTEUROPE_CHARSET}
  EASTEUROPE_CHARSET = 238;
  {$EXTERNALSYM RUSSIAN_CHARSET}
  RUSSIAN_CHARSET = 204;

  {$EXTERNALSYM MAC_CHARSET}
  MAC_CHARSET = 77;
  {$EXTERNALSYM BALTIC_CHARSET}
  BALTIC_CHARSET = 186;

  {$EXTERNALSYM FS_LATIN1}
  FS_LATIN1 = 1;
  {$EXTERNALSYM FS_LATIN2}
  FS_LATIN2 = 2;
  {$EXTERNALSYM FS_CYRILLIC}
  FS_CYRILLIC = 4;
  {$EXTERNALSYM FS_GREEK}
  FS_GREEK = 8;
  {$EXTERNALSYM FS_TURKISH}
  FS_TURKISH = $10;
  {$EXTERNALSYM FS_HEBREW}
  FS_HEBREW = $20;
  {$EXTERNALSYM FS_ARABIC}
  FS_ARABIC = $40;
  {$EXTERNALSYM FS_BALTIC}
  FS_BALTIC = $80;
  {$EXTERNALSYM FS_VIETNAMESE}
  FS_VIETNAMESE = $00000100;
  {$EXTERNALSYM FS_THAI}
  FS_THAI = $10000;
  {$EXTERNALSYM FS_JISJAPAN}
  FS_JISJAPAN = $20000;
  {$EXTERNALSYM FS_CHINESESIMP}
  FS_CHINESESIMP = $40000;
  {$EXTERNALSYM FS_WANSUNG}
  FS_WANSUNG = $80000;
  {$EXTERNALSYM FS_CHINESETRAD}
  FS_CHINESETRAD = $100000;
  {$EXTERNALSYM FS_JOHAB}
  FS_JOHAB = $200000;
  {$EXTERNALSYM FS_SYMBOL}
  FS_SYMBOL = DWORD($80000000);

  { Font Families }
  {$EXTERNALSYM FF_DONTCARE}
  FF_DONTCARE   = (0 shl 4);     { Don't care or don't know. }
  {$EXTERNALSYM FF_ROMAN}
  FF_ROMAN      = (1 shl 4);     { Variable stroke width, serifed. }
                                 { Times Roman, Century Schoolbook, etc. }
  {$EXTERNALSYM FF_SWISS}
  FF_SWISS      = (2 shl 4);     { Variable stroke width, sans-serifed. }
                                 { Helvetica, Swiss, etc. }
  {$EXTERNALSYM FF_MODERN}
  FF_MODERN     = (3 shl 4);     { Constant stroke width, serifed or sans-serifed. }
                                 { Pica, Elite, Courier, etc. }
  {$EXTERNALSYM FF_SCRIPT}
  FF_SCRIPT     = (4 shl 4);     { Cursive, etc. }
  {$EXTERNALSYM FF_DECORATIVE}
  FF_DECORATIVE = (5 shl 4);     { Old English, etc. }

  { Font Weights }
  {$EXTERNALSYM FW_DONTCARE}
  FW_DONTCARE = 0;
  {$EXTERNALSYM FW_THIN}
  FW_THIN = 100;
  {$EXTERNALSYM FW_EXTRALIGHT}
  FW_EXTRALIGHT = 200;
  {$EXTERNALSYM FW_LIGHT}
  FW_LIGHT = 300;
  {$EXTERNALSYM FW_NORMAL}
  FW_NORMAL = 400;
  {$EXTERNALSYM FW_MEDIUM}
  FW_MEDIUM = 500;
  {$EXTERNALSYM FW_SEMIBOLD}
  FW_SEMIBOLD = 600;
  {$EXTERNALSYM FW_BOLD}
  FW_BOLD = 700;
  {$EXTERNALSYM FW_EXTRABOLD}
  FW_EXTRABOLD = 800;
  {$EXTERNALSYM FW_HEAVY}
  FW_HEAVY = 900;
  {$EXTERNALSYM FW_ULTRALIGHT}
  FW_ULTRALIGHT = FW_EXTRALIGHT;
  {$EXTERNALSYM FW_REGULAR}
  FW_REGULAR = FW_NORMAL;
  {$EXTERNALSYM FW_DEMIBOLD}
  FW_DEMIBOLD = FW_SEMIBOLD;
  {$EXTERNALSYM FW_ULTRABOLD}
  FW_ULTRABOLD = FW_EXTRABOLD;
  {$EXTERNALSYM FW_BLACK}
  FW_BLACK = FW_HEAVY;

  {$EXTERNALSYM PANOSE_COUNT}
  PANOSE_COUNT = 10;
  {$EXTERNALSYM PAN_FAMILYTYPE_INDEX}
  PAN_FAMILYTYPE_INDEX = 0;
  {$EXTERNALSYM PAN_SERIFSTYLE_INDEX}
  PAN_SERIFSTYLE_INDEX = 1;
  {$EXTERNALSYM PAN_WEIGHT_INDEX}
  PAN_WEIGHT_INDEX = 2;
  {$EXTERNALSYM PAN_PROPORTION_INDEX}
  PAN_PROPORTION_INDEX = 3;
  {$EXTERNALSYM PAN_CONTRAST_INDEX}
  PAN_CONTRAST_INDEX = 4;
  {$EXTERNALSYM PAN_STROKEVARIATION_INDEX}
  PAN_STROKEVARIATION_INDEX = 5;
  {$EXTERNALSYM PAN_ARMSTYLE_INDEX}
  PAN_ARMSTYLE_INDEX = 6;
  {$EXTERNALSYM PAN_LETTERFORM_INDEX}
  PAN_LETTERFORM_INDEX = 7;
  {$EXTERNALSYM PAN_MIDLINE_INDEX}
  PAN_MIDLINE_INDEX = 8;
  {$EXTERNALSYM PAN_XHEIGHT_INDEX}
  PAN_XHEIGHT_INDEX = 9;

  {$EXTERNALSYM PAN_CULTURE_LATIN}
  PAN_CULTURE_LATIN = 0;

type
  PPanose = ^TPanose;
  {$EXTERNALSYM tagPANOSE}
  tagPANOSE = packed record
    bFamilyType: Byte;
    bSerifStyle: Byte;
    bWeight: Byte;
    bProportion: Byte;
    bContrast: Byte;
    bStrokeVariation: Byte;
    bArmStyle: Byte;
    bLetterform: Byte;
    bMidline: Byte;
    bXHeight: Byte;
  end;
  TPanose = tagPANOSE;
  {$EXTERNALSYM PANOSE}
  PANOSE = tagPANOSE;

const
  {$EXTERNALSYM PAN_ANY}
  PAN_ANY = 0;
  {$EXTERNALSYM PAN_NO_FIT}
  PAN_NO_FIT = 1;

  {$EXTERNALSYM PAN_FAMILY_TEXT_DISPLAY}
  PAN_FAMILY_TEXT_DISPLAY = 2;
  {$EXTERNALSYM PAN_FAMILY_SCRIPT}
  PAN_FAMILY_SCRIPT = 3;
  {$EXTERNALSYM PAN_FAMILY_DECORATIVE}
  PAN_FAMILY_DECORATIVE = 4;
  {$EXTERNALSYM PAN_FAMILY_PICTORIAL}
  PAN_FAMILY_PICTORIAL = 5;

  {$EXTERNALSYM PAN_SERIF_COVE}
  PAN_SERIF_COVE = 2;
  {$EXTERNALSYM PAN_SERIF_OBTUSE_COVE}
  PAN_SERIF_OBTUSE_COVE = 3;
  {$EXTERNALSYM PAN_SERIF_SQUARE_COVE}
  PAN_SERIF_SQUARE_COVE = 4;
  {$EXTERNALSYM PAN_SERIF_OBTUSE_SQUARE_COVE}
  PAN_SERIF_OBTUSE_SQUARE_COVE = 5;
  {$EXTERNALSYM PAN_SERIF_SQUARE}
  PAN_SERIF_SQUARE = 6;
  {$EXTERNALSYM PAN_SERIF_THIN}
  PAN_SERIF_THIN = 7;
  {$EXTERNALSYM PAN_SERIF_BONE}
  PAN_SERIF_BONE = 8;
  {$EXTERNALSYM PAN_SERIF_EXAGGERATED}
  PAN_SERIF_EXAGGERATED = 9;
  {$EXTERNALSYM PAN_SERIF_TRIANGLE}
  PAN_SERIF_TRIANGLE = 10;
  {$EXTERNALSYM PAN_SERIF_NORMAL_SANS}
  PAN_SERIF_NORMAL_SANS = 11;
  {$EXTERNALSYM PAN_SERIF_OBTUSE_SANS}
  PAN_SERIF_OBTUSE_SANS = 12;
  {$EXTERNALSYM PAN_SERIF_PERP_SANS}
  PAN_SERIF_PERP_SANS = 13;
  {$EXTERNALSYM PAN_SERIF_FLARED}
  PAN_SERIF_FLARED = 14;
  {$EXTERNALSYM PAN_SERIF_ROUNDED}
  PAN_SERIF_ROUNDED = 15;

  {$EXTERNALSYM PAN_WEIGHT_VERY_LIGHT}
  PAN_WEIGHT_VERY_LIGHT = 2;
  {$EXTERNALSYM PAN_WEIGHT_LIGHT}
  PAN_WEIGHT_LIGHT = 3;
  {$EXTERNALSYM PAN_WEIGHT_THIN}
  PAN_WEIGHT_THIN = 4;
  {$EXTERNALSYM PAN_WEIGHT_BOOK}
  PAN_WEIGHT_BOOK = 5;
  {$EXTERNALSYM PAN_WEIGHT_MEDIUM}
  PAN_WEIGHT_MEDIUM = 6;
  {$EXTERNALSYM PAN_WEIGHT_DEMI}
  PAN_WEIGHT_DEMI = 7;
  {$EXTERNALSYM PAN_WEIGHT_BOLD}
  PAN_WEIGHT_BOLD = 8;
  {$EXTERNALSYM PAN_WEIGHT_HEAVY}
  PAN_WEIGHT_HEAVY = 9;
  {$EXTERNALSYM PAN_WEIGHT_BLACK}
  PAN_WEIGHT_BLACK = 10;
  {$EXTERNALSYM PAN_WEIGHT_NORD}
  PAN_WEIGHT_NORD = 11;

  {$EXTERNALSYM PAN_PROP_OLD_STYLE}
  PAN_PROP_OLD_STYLE = 2;
  {$EXTERNALSYM PAN_PROP_MODERN}
  PAN_PROP_MODERN = 3;
  {$EXTERNALSYM PAN_PROP_EVEN_WIDTH}
  PAN_PROP_EVEN_WIDTH = 4;
  {$EXTERNALSYM PAN_PROP_EXPANDED}
  PAN_PROP_EXPANDED = 5;
  {$EXTERNALSYM PAN_PROP_CONDENSED}
  PAN_PROP_CONDENSED = 6;
  {$EXTERNALSYM PAN_PROP_VERY_EXPANDED}
  PAN_PROP_VERY_EXPANDED = 7;
  {$EXTERNALSYM PAN_PROP_VERY_CONDENSED}
  PAN_PROP_VERY_CONDENSED = 8;
  {$EXTERNALSYM PAN_PROP_MONOSPACED}
  PAN_PROP_MONOSPACED = 9;

  {$EXTERNALSYM PAN_CONTRAST_NONE}
  PAN_CONTRAST_NONE = 2;
  {$EXTERNALSYM PAN_CONTRAST_VERY_LOW}
  PAN_CONTRAST_VERY_LOW = 3;
  {$EXTERNALSYM PAN_CONTRAST_LOW}
  PAN_CONTRAST_LOW = 4;
  {$EXTERNALSYM PAN_CONTRAST_MEDIUM_LOW}
  PAN_CONTRAST_MEDIUM_LOW = 5;
  {$EXTERNALSYM PAN_CONTRAST_MEDIUM}
  PAN_CONTRAST_MEDIUM = 6;
  {$EXTERNALSYM PAN_CONTRAST_MEDIUM_HIGH}
  PAN_CONTRAST_MEDIUM_HIGH = 7;
  {$EXTERNALSYM PAN_CONTRAST_HIGH}
  PAN_CONTRAST_HIGH = 8;
  {$EXTERNALSYM PAN_CONTRAST_VERY_HIGH}
  PAN_CONTRAST_VERY_HIGH = 9;

  {$EXTERNALSYM PAN_STROKE_GRADUAL_DIAG}
  PAN_STROKE_GRADUAL_DIAG = 2;
  {$EXTERNALSYM PAN_STROKE_GRADUAL_TRAN}
  PAN_STROKE_GRADUAL_TRAN = 3;
  {$EXTERNALSYM PAN_STROKE_GRADUAL_VERT}
  PAN_STROKE_GRADUAL_VERT = 4;
  {$EXTERNALSYM PAN_STROKE_GRADUAL_HORZ}
  PAN_STROKE_GRADUAL_HORZ = 5;
  {$EXTERNALSYM PAN_STROKE_RAPID_VERT}
  PAN_STROKE_RAPID_VERT = 6;
  {$EXTERNALSYM PAN_STROKE_RAPID_HORZ}
  PAN_STROKE_RAPID_HORZ = 7;
  {$EXTERNALSYM PAN_STROKE_INSTANT_VERT}
  PAN_STROKE_INSTANT_VERT = 8;

  {$EXTERNALSYM PAN_STRAIGHT_ARMS_HORZ}
  PAN_STRAIGHT_ARMS_HORZ = 2;
  {$EXTERNALSYM PAN_STRAIGHT_ARMS_WEDGE}
  PAN_STRAIGHT_ARMS_WEDGE = 3;
  {$EXTERNALSYM PAN_STRAIGHT_ARMS_VERT}
  PAN_STRAIGHT_ARMS_VERT = 4;
  {$EXTERNALSYM PAN_STRAIGHT_ARMS_SINGLE_SERIF}
  PAN_STRAIGHT_ARMS_SINGLE_SERIF = 5;
  {$EXTERNALSYM PAN_STRAIGHT_ARMS_DOUBLE_SERIF}
  PAN_STRAIGHT_ARMS_DOUBLE_SERIF = 6;
  {$EXTERNALSYM PAN_BENT_ARMS_HORZ}
  PAN_BENT_ARMS_HORZ = 7;
  {$EXTERNALSYM PAN_BENT_ARMS_WEDGE}
  PAN_BENT_ARMS_WEDGE = 8;
  {$EXTERNALSYM PAN_BENT_ARMS_VERT}
  PAN_BENT_ARMS_VERT = 9;
  {$EXTERNALSYM PAN_BENT_ARMS_SINGLE_SERIF}
  PAN_BENT_ARMS_SINGLE_SERIF = 10;
  {$EXTERNALSYM PAN_BENT_ARMS_DOUBLE_SERIF}
  PAN_BENT_ARMS_DOUBLE_SERIF = 11;

  {$EXTERNALSYM PAN_LETT_NORMAL_CONTACT}
  PAN_LETT_NORMAL_CONTACT = 2;
  {$EXTERNALSYM PAN_LETT_NORMAL_WEIGHTED}
  PAN_LETT_NORMAL_WEIGHTED = 3;
  {$EXTERNALSYM PAN_LETT_NORMAL_BOXED}
  PAN_LETT_NORMAL_BOXED = 4;
  {$EXTERNALSYM PAN_LETT_NORMAL_FLATTENED}
  PAN_LETT_NORMAL_FLATTENED = 5;
  {$EXTERNALSYM PAN_LETT_NORMAL_ROUNDED}
  PAN_LETT_NORMAL_ROUNDED = 6;
  {$EXTERNALSYM PAN_LETT_NORMAL_OFF_CENTER}
  PAN_LETT_NORMAL_OFF_CENTER = 7;
  {$EXTERNALSYM PAN_LETT_NORMAL_SQUARE}
  PAN_LETT_NORMAL_SQUARE = 8;
  {$EXTERNALSYM PAN_LETT_OBLIQUE_CONTACT}
  PAN_LETT_OBLIQUE_CONTACT = 9;
  {$EXTERNALSYM PAN_LETT_OBLIQUE_WEIGHTED}
  PAN_LETT_OBLIQUE_WEIGHTED = 10;
  {$EXTERNALSYM PAN_LETT_OBLIQUE_BOXED}
  PAN_LETT_OBLIQUE_BOXED = 11;
  {$EXTERNALSYM PAN_LETT_OBLIQUE_FLATTENED}
  PAN_LETT_OBLIQUE_FLATTENED = 12;
  {$EXTERNALSYM PAN_LETT_OBLIQUE_ROUNDED}
  PAN_LETT_OBLIQUE_ROUNDED = 13;
  {$EXTERNALSYM PAN_LETT_OBLIQUE_OFF_CENTER}
  PAN_LETT_OBLIQUE_OFF_CENTER = 14;
  {$EXTERNALSYM PAN_LETT_OBLIQUE_SQUARE}
  PAN_LETT_OBLIQUE_SQUARE = 15;

  {$EXTERNALSYM PAN_MIDLINE_STANDARD_TRIMMED}
  PAN_MIDLINE_STANDARD_TRIMMED = 2;
  {$EXTERNALSYM PAN_MIDLINE_STANDARD_POINTED}
  PAN_MIDLINE_STANDARD_POINTED = 3;
  {$EXTERNALSYM PAN_MIDLINE_STANDARD_SERIFED}
  PAN_MIDLINE_STANDARD_SERIFED = 4;
  {$EXTERNALSYM PAN_MIDLINE_HIGH_TRIMMED}
  PAN_MIDLINE_HIGH_TRIMMED = 5;
  {$EXTERNALSYM PAN_MIDLINE_HIGH_POINTED}
  PAN_MIDLINE_HIGH_POINTED = 6;
  {$EXTERNALSYM PAN_MIDLINE_HIGH_SERIFED}
  PAN_MIDLINE_HIGH_SERIFED = 7;
  {$EXTERNALSYM PAN_MIDLINE_CONSTANT_TRIMMED}
  PAN_MIDLINE_CONSTANT_TRIMMED = 8;
  {$EXTERNALSYM PAN_MIDLINE_CONSTANT_POINTED}
  PAN_MIDLINE_CONSTANT_POINTED = 9;
  {$EXTERNALSYM PAN_MIDLINE_CONSTANT_SERIFED}
  PAN_MIDLINE_CONSTANT_SERIFED = 10;
  {$EXTERNALSYM PAN_MIDLINE_LOW_TRIMMED}
  PAN_MIDLINE_LOW_TRIMMED = 11;
  {$EXTERNALSYM PAN_MIDLINE_LOW_POINTED}
  PAN_MIDLINE_LOW_POINTED = 12;
  {$EXTERNALSYM PAN_MIDLINE_LOW_SERIFED}
  PAN_MIDLINE_LOW_SERIFED = 13;

  {$EXTERNALSYM PAN_XHEIGHT_CONSTANT_SMALL}
  PAN_XHEIGHT_CONSTANT_SMALL = 2;
  {$EXTERNALSYM PAN_XHEIGHT_CONSTANT_STD}
  PAN_XHEIGHT_CONSTANT_STD = 3;
  {$EXTERNALSYM PAN_XHEIGHT_CONSTANT_LARGE}
  PAN_XHEIGHT_CONSTANT_LARGE = 4;
  {$EXTERNALSYM PAN_XHEIGHT_DUCKING_SMALL}
  PAN_XHEIGHT_DUCKING_SMALL = 5;
  {$EXTERNALSYM PAN_XHEIGHT_DUCKING_STD}
  PAN_XHEIGHT_DUCKING_STD = 6;
  {$EXTERNALSYM PAN_XHEIGHT_DUCKING_LARGE}
  PAN_XHEIGHT_DUCKING_LARGE = 7;

  {$EXTERNALSYM ELF_VENDOR_SIZE}
  ELF_VENDOR_SIZE = 4;

{ The extended logical font       }
{ An extension of the ENUMLOGFONT }

type
  PExtLogFontA = ^TExtLogFontA;
  PExtLogFontW = ^TExtLogFontW;
  PExtLogFont = PExtLogFontA;
  {$EXTERNALSYM tagEXTLOGFONTA}
  tagEXTLOGFONTA = record
    elfLogFont: TLogFontA;
    elfFullName: array[0..LF_FULLFACESIZE - 1] of AnsiChar;
    elfStyle: array[0..LF_FACESIZE - 1] of AnsiChar;
    elfVersion: DWORD;     { 0 for the first release of NT }
    elfStyleSize: DWORD;
    elfMatch: DWORD;
    elfReserved: DWORD;
    elfVendorId: array[0..ELF_VENDOR_SIZE - 1] of Byte;
    elfCulture: DWORD;     { 0 for Latin }
    elfPanose: TPanose;
  end;
  {$EXTERNALSYM tagEXTLOGFONTW}
  tagEXTLOGFONTW = record
    elfLogFont: TLogFontW;
    elfFullName: array[0..LF_FULLFACESIZE - 1] of WideChar;
    elfStyle: array[0..LF_FACESIZE - 1] of WideChar;
    elfVersion: DWORD;     { 0 for the first release of NT }
    elfStyleSize: DWORD;
    elfMatch: DWORD;
    elfReserved: DWORD;
    elfVendorId: array[0..ELF_VENDOR_SIZE - 1] of Byte;
    elfCulture: DWORD;     { 0 for Latin }
    elfPanose: TPanose;
  end;
  {$EXTERNALSYM tagEXTLOGFONT}
  tagEXTLOGFONT = tagEXTLOGFONTA;
  TExtLogFontA = tagEXTLOGFONTA;
  TExtLogFontW = tagEXTLOGFONTW;
  TExtLogFont = TExtLogFontA;
  {$EXTERNALSYM EXTLOGFONTA}
  EXTLOGFONTA = tagEXTLOGFONTA;
  {$EXTERNALSYM EXTLOGFONTW}
  EXTLOGFONTW = tagEXTLOGFONTW;
  {$EXTERNALSYM EXTLOGFONT}
  EXTLOGFONT = EXTLOGFONTA;

const
  {$EXTERNALSYM ELF_VERSION}
  ELF_VERSION = 0;
  {$EXTERNALSYM ELF_CULTURE_LATIN}
  ELF_CULTURE_LATIN = 0;


  { EnumFonts Masks }
  {$EXTERNALSYM RASTER_FONTTYPE}
  RASTER_FONTTYPE = 1;
  {$EXTERNALSYM DEVICE_FONTTYPE}
  DEVICE_FONTTYPE = 2;
  {$EXTERNALSYM TRUETYPE_FONTTYPE}
  TRUETYPE_FONTTYPE = 4;

{$EXTERNALSYM RGB}
function RGB(r, g, b: Byte): COLORREF;
function PaletteRGB(r, g, b: Byte): COLORREF;
function PaletteIndex(i: Word): COLORREF;

const
  { palette entry flags }
  {$EXTERNALSYM PC_RESERVED}
  PC_RESERVED = 1;     { palette index used for animation }
  {$EXTERNALSYM PC_EXPLICIT}
  PC_EXPLICIT = 2;     { palette index is explicit to device }
  {$EXTERNALSYM PC_NOCOLLAPSE}
  PC_NOCOLLAPSE = 4;   { do not match color to system palette }

{$EXTERNALSYM GetRValue}
function GetRValue(rgb: DWORD): Byte;
{$EXTERNALSYM GetGValue}
function GetGValue(rgb: DWORD): Byte;
{$EXTERNALSYM GetBValue}
function GetBValue(rgb: DWORD): Byte;

const
  { Background Modes }
  {$EXTERNALSYM TRANSPARENT}
  TRANSPARENT = 1;
  {$EXTERNALSYM OPAQUE}
  OPAQUE = 2;
  {$EXTERNALSYM BKMODE_LAST}
  BKMODE_LAST = 2;

  { Graphics Modes }
  {$EXTERNALSYM GM_COMPATIBLE}
  GM_COMPATIBLE = 1;
  {$EXTERNALSYM GM_ADVANCED}
  GM_ADVANCED = 2;
  {$EXTERNALSYM GM_LAST}
  GM_LAST = 2;

  { PolyDraw and GetPath point types }
  {$EXTERNALSYM PT_CLOSEFIGURE}
  PT_CLOSEFIGURE = 1;
  {$EXTERNALSYM PT_LINETO}
  PT_LINETO = 2;
  {$EXTERNALSYM PT_BEZIERTO}
  PT_BEZIERTO = 4;
  {$EXTERNALSYM PT_MOVETO}
  PT_MOVETO = 6;

  { Mapping Modes }
  {$EXTERNALSYM MM_TEXT}
  MM_TEXT = 1;
  {$EXTERNALSYM MM_LOMETRIC}
  MM_LOMETRIC = 2;
  {$EXTERNALSYM MM_HIMETRIC}
  MM_HIMETRIC = 3;
  {$EXTERNALSYM MM_LOENGLISH}
  MM_LOENGLISH = 4;
  {$EXTERNALSYM MM_HIENGLISH}
  MM_HIENGLISH = 5;
  {$EXTERNALSYM MM_TWIPS}
  MM_TWIPS = 6;
  {$EXTERNALSYM MM_ISOTROPIC}
  MM_ISOTROPIC = 7;
  {$EXTERNALSYM MM_ANISOTROPIC}
  MM_ANISOTROPIC = 8;

  { Min and Max Mapping Mode values }
  {$EXTERNALSYM MM_MIN}
  MM_MIN = MM_TEXT;
  {$EXTERNALSYM MM_MAX}
  MM_MAX = MM_ANISOTROPIC;
  {$EXTERNALSYM MM_MAX_FIXEDSCALE}
  MM_MAX_FIXEDSCALE = MM_TWIPS;

  { Coordinate Modes }
  {$EXTERNALSYM ABSOLUTE}
  ABSOLUTE = 1;
  {$EXTERNALSYM RELATIVE}
  RELATIVE = 2;

  { Stock Logical Objects }
  {$EXTERNALSYM WHITE_BRUSH}
  WHITE_BRUSH = 0;
  {$EXTERNALSYM LTGRAY_BRUSH}
  LTGRAY_BRUSH = 1;
  {$EXTERNALSYM GRAY_BRUSH}
  GRAY_BRUSH = 2;
  {$EXTERNALSYM DKGRAY_BRUSH}
  DKGRAY_BRUSH = 3;
  {$EXTERNALSYM BLACK_BRUSH}
  BLACK_BRUSH = 4;
  {$EXTERNALSYM NULL_BRUSH}
  NULL_BRUSH = 5;
  {$EXTERNALSYM HOLLOW_BRUSH}
  HOLLOW_BRUSH = NULL_BRUSH;
  {$EXTERNALSYM WHITE_PEN}
  WHITE_PEN = 6;
  {$EXTERNALSYM BLACK_PEN}
  BLACK_PEN = 7;
  {$EXTERNALSYM NULL_PEN}
  NULL_PEN = 8;
  {$EXTERNALSYM OEM_FIXED_FONT}
  OEM_FIXED_FONT = 10;
  {$EXTERNALSYM ANSI_FIXED_FONT}
  ANSI_FIXED_FONT = 11;
  {$EXTERNALSYM ANSI_VAR_FONT}
  ANSI_VAR_FONT = 12;
  {$EXTERNALSYM SYSTEM_FONT}
  SYSTEM_FONT = 13;
  {$EXTERNALSYM DEVICE_DEFAULT_FONT}
  DEVICE_DEFAULT_FONT = 14;
  {$EXTERNALSYM DEFAULT_PALETTE}
  DEFAULT_PALETTE = 15;
  {$EXTERNALSYM SYSTEM_FIXED_FONT}
  SYSTEM_FIXED_FONT = $10;
  {$EXTERNALSYM DEFAULT_GUI_FONT}
  DEFAULT_GUI_FONT = 17;
  {$EXTERNALSYM DC_BRUSH}
  DC_BRUSH = 18;
  {$EXTERNALSYM DC_PEN}
  DC_PEN = 19;
  {$EXTERNALSYM STOCK_LAST}
  STOCK_LAST = 19;

  {$EXTERNALSYM CLR_INVALID}
  CLR_INVALID = DWORD($FFFFFFFF);

  { Brush Styles }
  {$EXTERNALSYM BS_SOLID}
  BS_SOLID                = 0;
  {$EXTERNALSYM BS_NULL}
  BS_NULL                 = 1;
  {$EXTERNALSYM BS_HOLLOW}
  BS_HOLLOW               = BS_NULL;
  {$EXTERNALSYM BS_HATCHED}
  BS_HATCHED              = 2;
  {$EXTERNALSYM BS_PATTERN}
  BS_PATTERN              = 3;
  {$EXTERNALSYM BS_INDEXED}
  BS_INDEXED              = 4;
  {$EXTERNALSYM BS_DIBPATTERN}
  BS_DIBPATTERN           = 5;
  {$EXTERNALSYM BS_DIBPATTERNPT}
  BS_DIBPATTERNPT         = 6;
  {$EXTERNALSYM BS_PATTERN8X8}
  BS_PATTERN8X8           = 7;
  {$EXTERNALSYM BS_DIBPATTERN8X8}
  BS_DIBPATTERN8X8        = 8;
  {$EXTERNALSYM BS_MONOPATTERN}
  BS_MONOPATTERN          = 9;

  { Hatch Styles }
  {$EXTERNALSYM HS_HORIZONTAL}
  HS_HORIZONTAL = 0;       { ----- }
  {$EXTERNALSYM HS_VERTICAL}
  HS_VERTICAL   = 1;       { ||||| }
  {$EXTERNALSYM HS_FDIAGONAL}
  HS_FDIAGONAL  = 2;       { ///// }
  {$EXTERNALSYM HS_BDIAGONAL}
  HS_BDIAGONAL  = 3;       { \\\\\ }
  {$EXTERNALSYM HS_CROSS}
  HS_CROSS      = 4;       { +++++ }
  {$EXTERNALSYM HS_DIAGCROSS}
  HS_DIAGCROSS  = 5;       { xxxxx }


  { Pen Styles }
  {$EXTERNALSYM PS_SOLID}
  PS_SOLID       = 0;
  {$EXTERNALSYM PS_DASH}
  PS_DASH        = 1;      { ------- }
  {$EXTERNALSYM PS_DOT}
  PS_DOT         = 2;      { ....... }
  {$EXTERNALSYM PS_DASHDOT}
  PS_DASHDOT     = 3;      { _._._._ }
  {$EXTERNALSYM PS_DASHDOTDOT}
  PS_DASHDOTDOT  = 4;      { _.._.._ }
  {$EXTERNALSYM PS_NULL}
  PS_NULL = 5;
  {$EXTERNALSYM PS_INSIDEFRAME}
  PS_INSIDEFRAME = 6;
  {$EXTERNALSYM PS_USERSTYLE}
  PS_USERSTYLE = 7;
  {$EXTERNALSYM PS_ALTERNATE}
  PS_ALTERNATE = 8;
  {$EXTERNALSYM PS_STYLE_MASK}
  PS_STYLE_MASK = 15;

  {$EXTERNALSYM PS_ENDCAP_ROUND}
  PS_ENDCAP_ROUND = 0;
  {$EXTERNALSYM PS_ENDCAP_SQUARE}
  PS_ENDCAP_SQUARE = $100;
  {$EXTERNALSYM PS_ENDCAP_FLAT}
  PS_ENDCAP_FLAT = $200;
  {$EXTERNALSYM PS_ENDCAP_MASK}
  PS_ENDCAP_MASK = 3840;

  {$EXTERNALSYM PS_JOIN_ROUND}
  PS_JOIN_ROUND = 0;
  {$EXTERNALSYM PS_JOIN_BEVEL}
  PS_JOIN_BEVEL = $1000;
  {$EXTERNALSYM PS_JOIN_MITER}
  PS_JOIN_MITER = $2000;
  {$EXTERNALSYM PS_JOIN_MASK}
  PS_JOIN_MASK = 61440;

  {$EXTERNALSYM PS_COSMETIC}
  PS_COSMETIC = 0;
  {$EXTERNALSYM PS_GEOMETRIC}
  PS_GEOMETRIC = $10000;
  {$EXTERNALSYM PS_TYPE_MASK}
  PS_TYPE_MASK = $F0000;

  {$EXTERNALSYM AD_COUNTERCLOCKWISE}
  AD_COUNTERCLOCKWISE = 1;
  {$EXTERNALSYM AD_CLOCKWISE}
  AD_CLOCKWISE = 2;

  { Device Parameters for GetDeviceCaps() }
  {$EXTERNALSYM DRIVERVERSION}
  DRIVERVERSION = 0;     { Device driver version                     }
  {$EXTERNALSYM TECHNOLOGY}
  TECHNOLOGY    = 2;     { Device classification                     }
  {$EXTERNALSYM HORZSIZE}
  HORZSIZE      = 4;     { Horizontal size in millimeters            }
  {$EXTERNALSYM VERTSIZE}
  VERTSIZE      = 6;     { Vertical size in millimeters              }
  {$EXTERNALSYM HORZRES}
  HORZRES       = 8;     { Horizontal width in pixels                }
  {$EXTERNALSYM VERTRES}
  VERTRES       = 10;    { Vertical height in pixels                 }
  {$EXTERNALSYM BITSPIXEL}
  BITSPIXEL     = 12;    { Number of bits per pixel                  }
  {$EXTERNALSYM PLANES}
  PLANES        = 14;    { Number of planes                          }
  {$EXTERNALSYM NUMBRUSHES}
  NUMBRUSHES    = $10;   { Number of brushes the device has          }
  {$EXTERNALSYM NUMPENS}
  NUMPENS       = 18;    { Number of pens the device has             }
  {$EXTERNALSYM NUMMARKERS}
  NUMMARKERS    = 20;    { Number of markers the device has          }
  {$EXTERNALSYM NUMFONTS}
  NUMFONTS      = 22;    { Number of fonts the device has            }
  {$EXTERNALSYM NUMCOLORS}
  NUMCOLORS     = 24;    { Number of colors the device supports      }
  {$EXTERNALSYM PDEVICESIZE}
  PDEVICESIZE   = 26;    { Size required for device descriptor       }
  {$EXTERNALSYM CURVECAPS}
  CURVECAPS     = 28;    { Curve capabilities                        }
  {$EXTERNALSYM LINECAPS}
  LINECAPS      = 30;    { Line capabilities                         }
  {$EXTERNALSYM POLYGONALCAPS}
  POLYGONALCAPS = $20;   { Polygonal capabilities                    }
  {$EXTERNALSYM TEXTCAPS}
  TEXTCAPS      = 34;    { Text capabilities                         }
  {$EXTERNALSYM CLIPCAPS}
  CLIPCAPS      = 36;    { Clipping capabilities                     }
  {$EXTERNALSYM RASTERCAPS}
  RASTERCAPS    = 38;    { Bitblt capabilities                       }
  {$EXTERNALSYM ASPECTX}
  ASPECTX       = 40;    { Length of the X leg                       }
  {$EXTERNALSYM ASPECTY}
  ASPECTY       = 42;    { Length of the Y leg                       }
  {$EXTERNALSYM ASPECTXY}
  ASPECTXY      = 44;    { Length of the hypotenuse                  }
  {$EXTERNALSYM SHADEBLENDCAPS}
  SHADEBLENDCAPS = 45;   { Shading and Blending caps                 }

  {$EXTERNALSYM LOGPIXELSX}
  LOGPIXELSX    = 88;    { Logical pixelsinch in X                  }
  {$EXTERNALSYM LOGPIXELSY}
  LOGPIXELSY    = 90;    { Logical pixelsinch in Y                  }

  {$EXTERNALSYM SIZEPALETTE}
  SIZEPALETTE   = 104;   { Number of entries in physical palette     }
  {$EXTERNALSYM NUMRESERVED}
  NUMRESERVED   = 106;   { Number of reserved entries in palette     }
  {$EXTERNALSYM COLORRES}
  COLORRES      = 108;   { Actual color resolution                   }

  { Printing related DeviceCaps. These replace the appropriate Escapes }
  {$EXTERNALSYM PHYSICALWIDTH}
  PHYSICALWIDTH   = 110;     { Physical Width in device units            }
  {$EXTERNALSYM PHYSICALHEIGHT}
  PHYSICALHEIGHT  = 111;     { Physical Height in device units           }
  {$EXTERNALSYM PHYSICALOFFSETX}
  PHYSICALOFFSETX = 112;     { Physical Printable Area x margin          }
  {$EXTERNALSYM PHYSICALOFFSETY}
  PHYSICALOFFSETY = 113;     { Physical Printable Area y margin          }
  {$EXTERNALSYM SCALINGFACTORX}
  SCALINGFACTORX  = 114;     { Scaling factor x                          }
  {$EXTERNALSYM SCALINGFACTORY}
  SCALINGFACTORY  = 115;     { Scaling factor y                          }


  { Display driver specific}
  {$EXTERNALSYM VREFRESH}
  VREFRESH       = 116;     { Current vertical refresh rate of the     }
                            { display device (for displays only) in Hz}
  {$EXTERNALSYM DESKTOPVERTRES}
  DESKTOPVERTRES = 117;     { Horizontal width of entire desktop in    }
                            { pixels                                  }
  {$EXTERNALSYM DESKTOPHORZRES}
  DESKTOPHORZRES = 118;     { Vertical height of entire desktop in     }
                            { pixels                                  }
  {$EXTERNALSYM BLTALIGNMENT}
  BLTALIGNMENT   = 119;     { Preferred blt alignment                  }


{ Device Capability Masks: }

{ Device Technologies }

  {$EXTERNALSYM DT_PLOTTER}
  DT_PLOTTER    = 0;     { Vector plotter                    }
  {$EXTERNALSYM DT_RASDISPLAY}
  DT_RASDISPLAY = 1;     { Raster display                    }
  {$EXTERNALSYM DT_RASPRINTER}
  DT_RASPRINTER = 2;     { Raster printer                    }
  {$EXTERNALSYM DT_RASCAMERA}
  DT_RASCAMERA  = 3;     { Raster camera                     }
  {$EXTERNALSYM DT_CHARSTREAM}
  DT_CHARSTREAM = 4;     { Character-stream, PLP             }
  {$EXTERNALSYM DT_METAFILE}
  DT_METAFILE   = 5;     { Metafile, VDM                     }
  {$EXTERNALSYM DT_DISPFILE}
  DT_DISPFILE   = 6;     { Display-file                      }

{ Curve Capabilities }

  {$EXTERNALSYM CC_NONE}
  CC_NONE       = 0;     { Curves not supported              }
  {$EXTERNALSYM CC_CIRCLES}
  CC_CIRCLES    = 1;     { Can do circles                    }
  {$EXTERNALSYM CC_PIE}
  CC_PIE        = 2;     { Can do pie wedges                 }
  {$EXTERNALSYM CC_CHORD}
  CC_CHORD      = 4;     { Can do chord arcs                 }
  {$EXTERNALSYM CC_ELLIPSES}
  CC_ELLIPSES   = 8;     { Can do ellipese                   }
  {$EXTERNALSYM CC_WIDE}
  CC_WIDE       = $10;   { Can do wide lines                 }
  {$EXTERNALSYM CC_STYLED}
  CC_STYLED     = $20;   { Can do styled lines               }
  {$EXTERNALSYM CC_WIDESTYLED}
  CC_WIDESTYLED = $40;   { Can do wide styled lines          }
  {$EXTERNALSYM CC_INTERIORS}
  CC_INTERIORS  = $80;   { Can do interiors                  }
  {$EXTERNALSYM CC_ROUNDRECT}
  CC_ROUNDRECT  = $100;

{ Line Capabilities }

  {$EXTERNALSYM LC_NONE}
  LC_NONE       = 0;     { Lines not supported               }
  {$EXTERNALSYM LC_POLYLINE}
  LC_POLYLINE   = 2;     { Can do polylines                  }
  {$EXTERNALSYM LC_MARKER}
  LC_MARKER     = 4;     { Can do markers                    }
  {$EXTERNALSYM LC_POLYMARKER}
  LC_POLYMARKER = 8;     { Can do polymarkers                }
  {$EXTERNALSYM LC_WIDE}
  LC_WIDE       = $10;   { Can do wide lines                 }
  {$EXTERNALSYM LC_STYLED}
  LC_STYLED     = $20;   { Can do styled lines               }
  {$EXTERNALSYM LC_WIDESTYLED}
  LC_WIDESTYLED = $40;   { Can do wide styled lines          }
  {$EXTERNALSYM LC_INTERIORS}
  LC_INTERIORS  = $80;   { Can do interiors                  }

{ Polygonal Capabilities }

  {$EXTERNALSYM PC_NONE}
  PC_NONE        = 0;     { Polygonals not supported          }
  {$EXTERNALSYM PC_POLYGON}
  PC_POLYGON     = 1;     { Can do polygons                   }
  {$EXTERNALSYM PC_RECTANGLE}
  PC_RECTANGLE   = 2;     { Can do rectangles                 }
  {$EXTERNALSYM PC_WINDPOLYGON}
  PC_WINDPOLYGON = 4;     { Can do winding polygons           }
  {$EXTERNALSYM PC_TRAPEZOID}
  PC_TRAPEZOID   = 4;     { Can do trapezoids                 }
  {$EXTERNALSYM PC_SCANLINE}
  PC_SCANLINE    = 8;     { Can do scanlines                  }
  {$EXTERNALSYM PC_WIDE}
  PC_WIDE        = $10;   { Can do wide borders               }
  {$EXTERNALSYM PC_STYLED}
  PC_STYLED      = $20;   { Can do styled borders             }
  {$EXTERNALSYM PC_WIDESTYLED}
  PC_WIDESTYLED  = $40;   { Can do wide styled borders        }
  {$EXTERNALSYM PC_INTERIORS}
  PC_INTERIORS   = $80;   { Can do interiors                  }
  {$EXTERNALSYM PC_POLYPOLYGON}
  PC_POLYPOLYGON = $100;  { Can do polypolygons               }
  {$EXTERNALSYM PC_PATHS}
  PC_PATHS       = $200;  { Can do paths                      }

{ Clipping Capabilities }

  {$EXTERNALSYM CP_NONE}
  CP_NONE      = 0;     { No clipping of output             }
  {$EXTERNALSYM CP_RECTANGLE}
  CP_RECTANGLE = 1;     { Output clipped to rects           }
  {$EXTERNALSYM CP_REGION}
  CP_REGION    = 2;     { obsolete                          }

{ Text Capabilities }

  {$EXTERNALSYM TC_OP_CHARACTER}
  TC_OP_CHARACTER = 1;      { Can do OutputPrecision   CHARACTER       }
  {$EXTERNALSYM TC_OP_STROKE}
  TC_OP_STROKE    = 2;      { Can do OutputPrecision   STROKE          }
  {$EXTERNALSYM TC_CP_STROKE}
  TC_CP_STROKE    = 4;      { Can do ClipPrecision     STROKE          }
  {$EXTERNALSYM TC_CR_90}
  TC_CR_90        = 8;      { Can do CharRotAbility    90              }
  {$EXTERNALSYM TC_CR_ANY}
  TC_CR_ANY       = $10;    { Can do CharRotAbility    ANY             }
  {$EXTERNALSYM TC_SF_X_YINDEP}
  TC_SF_X_YINDEP  = $20;    { Can do ScaleFreedom      X_YINDEPENDENT  }
  {$EXTERNALSYM TC_SA_DOUBLE}
  TC_SA_DOUBLE    = $40;    { Can do ScaleAbility      DOUBLE          }
  {$EXTERNALSYM TC_SA_INTEGER}
  TC_SA_INTEGER   = $80;    { Can do ScaleAbility      INTEGER         }
  {$EXTERNALSYM TC_SA_CONTIN}
  TC_SA_CONTIN    = $100;   { Can do ScaleAbility      CONTINUOUS      }
  {$EXTERNALSYM TC_EA_DOUBLE}
  TC_EA_DOUBLE    = $200;   { Can do EmboldenAbility   DOUBLE          }
  {$EXTERNALSYM TC_IA_ABLE}
  TC_IA_ABLE      = $400;   { Can do ItalisizeAbility  ABLE            }
  {$EXTERNALSYM TC_UA_ABLE}
  TC_UA_ABLE      = $800;   { Can do UnderlineAbility  ABLE            }
  {$EXTERNALSYM TC_SO_ABLE}
  TC_SO_ABLE      = $1000;  { Can do StrikeOutAbility  ABLE            }
  {$EXTERNALSYM TC_RA_ABLE}
  TC_RA_ABLE      = $2000;  { Can do RasterFontAble    ABLE            }
  {$EXTERNALSYM TC_VA_ABLE}
  TC_VA_ABLE      = $4000;  { Can do VectorFontAble    ABLE            }
  {$EXTERNALSYM TC_RESERVED}
  TC_RESERVED     = $8000;
  {$EXTERNALSYM TC_SCROLLBLT}
  TC_SCROLLBLT    = $10000; { Don't do text scroll with blt            }

{ Raster Capabilities }

  {$EXTERNALSYM RC_BITBLT}
  RC_BITBLT       = 1;     { Can do standard BLT.              }
  {$EXTERNALSYM RC_BANDING}
  RC_BANDING      = 2;     { Device requires banding support   }
  {$EXTERNALSYM RC_SCALING}
  RC_SCALING      = 4;     { Device requires scaling support   }
  {$EXTERNALSYM RC_BITMAP64}
  RC_BITMAP64     = 8;     { Device can support >64K bitmap    }
  {$EXTERNALSYM RC_GDI20_OUTPUT}
  RC_GDI20_OUTPUT = $10;   { has 2.0 output calls          }
  {$EXTERNALSYM RC_GDI20_STATE}
  RC_GDI20_STATE  = $20;
  {$EXTERNALSYM RC_SAVEBITMAP}
  RC_SAVEBITMAP   = $40;
  {$EXTERNALSYM RC_DI_BITMAP}
  RC_DI_BITMAP    = $80;   { supports DIB to memory        }
  {$EXTERNALSYM RC_PALETTE}
  RC_PALETTE      = $100;  { supports a palette            }
  {$EXTERNALSYM RC_DIBTODEV}
  RC_DIBTODEV     = $200;  { supports DIBitsToDevice       }
  {$EXTERNALSYM RC_BIGFONT}
  RC_BIGFONT      = $400;  { supports >64K fonts           }
  {$EXTERNALSYM RC_STRETCHBLT}
  RC_STRETCHBLT   = $800;  { supports StretchBlt           }
  {$EXTERNALSYM RC_FLOODFILL}
  RC_FLOODFILL    = $1000; { supports FloodFill            }
  {$EXTERNALSYM RC_STRETCHDIB}
  RC_STRETCHDIB   = $2000; { supports StretchDIBits        }
  {$EXTERNALSYM RC_OP_DX_OUTPUT}
  RC_OP_DX_OUTPUT = $4000;
  {$EXTERNALSYM RC_DEVBITS}
  RC_DEVBITS      = $8000;

{ Shading and blending caps }
  {$EXTERNALSYM SB_NONE}
  SB_NONE = 0;
  {$EXTERNALSYM SB_CONST_ALPHA}
  SB_CONST_ALPHA = 1;
  {$EXTERNALSYM SB_PIXEL_ALPHA}
  SB_PIXEL_ALPHA = 2;
  {$EXTERNALSYM SB_PREMULT_ALPHA}
  SB_PREMULT_ALPHA = 4;
  {$EXTERNALSYM SB_GRAD_RECT}
  SB_GRAD_RECT = $10;
  {$EXTERNALSYM SB_GRAD_TRI}
  SB_GRAD_TRI = $20;

{ DIB color table identifiers }

  {$EXTERNALSYM DIB_RGB_COLORS}
  DIB_RGB_COLORS = 0;     { color table in RGBs  }
  {$EXTERNALSYM DIB_PAL_COLORS}
  DIB_PAL_COLORS = 1;     { color table in palette indices  }

{ constants for GetSetSystemPaletteUse() }

  {$EXTERNALSYM SYSPAL_ERROR}
  SYSPAL_ERROR = 0;
  {$EXTERNALSYM SYSPAL_STATIC}
  SYSPAL_STATIC = 1;
  {$EXTERNALSYM SYSPAL_NOSTATIC}
  SYSPAL_NOSTATIC = 2;

{ constants for CreateDIBitmap }

  {$EXTERNALSYM CBM_INIT}
  CBM_INIT = 4;     { initialize bitmap  }

{ ExtFloodFill style flags }

  {$EXTERNALSYM FLOODFILLBORDER}
  FLOODFILLBORDER = 0;
  {$EXTERNALSYM FLOODFILLSURFACE}
  FLOODFILLSURFACE = 1;

  {$EXTERNALSYM CCHDEVICENAME}
  CCHDEVICENAME = 32;     { size of a device name string  }
  {$EXTERNALSYM CCHFORMNAME}
  CCHFORMNAME   = 32;     { size of a form name string  }

type
  PDeviceModeA = ^TDeviceModeA;
  PDeviceModeW = ^TDeviceModeW;
  PDeviceMode = PDeviceModeA;
  {$EXTERNALSYM _devicemodeA}
  _devicemodeA = packed record
    dmDeviceName: array[0..CCHDEVICENAME - 1] of AnsiChar;
    dmSpecVersion: Word;
    dmDriverVersion: Word;
    dmSize: Word;
    dmDriverExtra: Word;
    dmFields: DWORD;
    dmOrientation: SHORT;
    dmPaperSize: SHORT;
    dmPaperLength: SHORT;
    dmPaperWidth: SHORT;
    dmScale: SHORT;
    dmCopies: SHORT;
    dmDefaultSource: SHORT;
    dmPrintQuality: SHORT;
    dmColor: SHORT;
    dmDuplex: SHORT;
    dmYResolution: SHORT;
    dmTTOption: SHORT;
    dmCollate: SHORT;
    dmFormName: array[0..CCHFORMNAME - 1] of AnsiChar;
    dmLogPixels: Word;
    dmBitsPerPel: DWORD;
    dmPelsWidth: DWORD;
    dmPelsHeight: DWORD;
    dmDisplayFlags: DWORD;
    dmDisplayFrequency: DWORD;
    dmICMMethod: DWORD;
    dmICMIntent: DWORD;
    dmMediaType: DWORD;
    dmDitherType: DWORD;
    dmICCManufacturer: DWORD;
    dmICCModel: DWORD;
    dmPanningWidth: DWORD;
    dmPanningHeight: DWORD;
  end;
  {$EXTERNALSYM _devicemodeW}
  _devicemodeW = packed record
    dmDeviceName: array[0..CCHDEVICENAME - 1] of WideChar;
    dmSpecVersion: Word;
    dmDriverVersion: Word;
    dmSize: Word;
    dmDriverExtra: Word;
    dmFields: DWORD;
    dmOrientation: SHORT;
    dmPaperSize: SHORT;
    dmPaperLength: SHORT;
    dmPaperWidth: SHORT;
    dmScale: SHORT;
    dmCopies: SHORT;
    dmDefaultSource: SHORT;
    dmPrintQuality: SHORT;
    dmColor: SHORT;
    dmDuplex: SHORT;
    dmYResolution: SHORT;
    dmTTOption: SHORT;
    dmCollate: SHORT;
    dmFormName: array[0..CCHFORMNAME - 1] of WideChar;
    dmLogPixels: Word;
    dmBitsPerPel: DWORD;
    dmPelsWidth: DWORD;
    dmPelsHeight: DWORD;
    dmDisplayFlags: DWORD;
    dmDisplayFrequency: DWORD;
    dmICMMethod: DWORD;
    dmICMIntent: DWORD;
    dmMediaType: DWORD;
    dmDitherType: DWORD;
    dmICCManufacturer: DWORD;
    dmICCModel: DWORD;
    dmPanningWidth: DWORD;
    dmPanningHeight: DWORD;
  end;
  {$EXTERNALSYM _devicemode}
  _devicemode = _devicemodeA;
  TDeviceModeA = _devicemodeA;
  TDeviceModeW = _devicemodeW;
  TDeviceMode = TDeviceModeA;
  {$EXTERNALSYM DEVMODEA}
  DEVMODEA = _devicemodeA;
  {$EXTERNALSYM DEVMODEW}
  DEVMODEW = _devicemodeW;
  {$EXTERNALSYM DEVMODE}
  DEVMODE = DEVMODEA;

  PDevMode = PDeviceMode;  {compatibility with Delphi 1.0}
  TDevMode = TDeviceMode;  {compatibility with Delphi 1.0}

const
  {$EXTERNALSYM DM_SPECVERSION}
  DM_SPECVERSION = $401;  { current version of specification }

{ field selection bits }

  {$EXTERNALSYM DM_ORIENTATION}
  DM_ORIENTATION = 1;
  {$EXTERNALSYM DM_PAPERSIZE}
  DM_PAPERSIZE = 2;
  {$EXTERNALSYM DM_PAPERLENGTH}
  DM_PAPERLENGTH = 4;
  {$EXTERNALSYM DM_PAPERWIDTH}
  DM_PAPERWIDTH = 8;
  {$EXTERNALSYM DM_SCALE}
  DM_SCALE = $10;
  {$EXTERNALSYM DM_POSITION}
  DM_POSITION = $20;
  {$EXTERNALSYM DM_COPIES}
  DM_COPIES = $100;
  {$EXTERNALSYM DM_DEFAULTSOURCE}
  DM_DEFAULTSOURCE = $200;
  {$EXTERNALSYM DM_PRINTQUALITY}
  DM_PRINTQUALITY = $400;
  {$EXTERNALSYM DM_COLOR}
  DM_COLOR = $800;
  {$EXTERNALSYM DM_DUPLEX}
  DM_DUPLEX = $1000;
  {$EXTERNALSYM DM_YRESOLUTION}
  DM_YRESOLUTION = $2000;
  {$EXTERNALSYM DM_TTOPTION}
  DM_TTOPTION = $4000;
  {$EXTERNALSYM DM_COLLATE}
  DM_COLLATE = $8000;
  {$EXTERNALSYM DM_FORMNAME}
  DM_FORMNAME = $10000;
  {$EXTERNALSYM DM_LOGPIXELS}
  DM_LOGPIXELS = $20000;
  {$EXTERNALSYM DM_BITSPERPEL}
  DM_BITSPERPEL = $40000;
  {$EXTERNALSYM DM_PELSWIDTH}
  DM_PELSWIDTH = $80000;
  {$EXTERNALSYM DM_PELSHEIGHT}
  DM_PELSHEIGHT = $100000;
  {$EXTERNALSYM DM_DISPLAYFLAGS}
  DM_DISPLAYFLAGS = $200000;
  {$EXTERNALSYM DM_DISPLAYFREQUENCY}
  DM_DISPLAYFREQUENCY = $400000;
  {$EXTERNALSYM DM_PANNINGWIDTH}
  DM_PANNINGWIDTH = $00800000;
  {$EXTERNALSYM DM_PANNINGHEIGHT}
  DM_PANNINGHEIGHT = $01000000;
  {$EXTERNALSYM DM_ICMMETHOD}
  DM_ICMMETHOD = $2000000;
  {$EXTERNALSYM DM_ICMINTENT}
  DM_ICMINTENT = $4000000;
  {$EXTERNALSYM DM_MEDIATYPE}
  DM_MEDIATYPE = $8000000;
  {$EXTERNALSYM DM_DITHERTYPE}
  DM_DITHERTYPE = $10000000;
  {$EXTERNALSYM DM_ICCMANUFACTURER}
  DM_ICCMANUFACTURER = $20000000;
  {$EXTERNALSYM DM_ICCMODEL}
  DM_ICCMODEL = $40000000;

{ orientation selections }

  {$EXTERNALSYM DMORIENT_PORTRAIT}
  DMORIENT_PORTRAIT = 1;
  {$EXTERNALSYM DMORIENT_LANDSCAPE}
  DMORIENT_LANDSCAPE = 2;

{ paper selections }

  {$EXTERNALSYM DMPAPER_LETTER}
  DMPAPER_LETTER      = 1;  { Letter 8 12 x 11 in               }
  {$EXTERNALSYM DMPAPER_FIRST}
  DMPAPER_FIRST       = DMPAPER_LETTER;
  {$EXTERNALSYM DMPAPER_LETTERSMALL}
  DMPAPER_LETTERSMALL = 2;  { Letter Small 8 12 x 11 in         }
  {$EXTERNALSYM DMPAPER_TABLOID}
  DMPAPER_TABLOID     = 3;  { Tabloid 11 x 17 in                }
  {$EXTERNALSYM DMPAPER_LEDGER}
  DMPAPER_LEDGER      = 4;  { Ledger 17 x 11 in                 }
  {$EXTERNALSYM DMPAPER_LEGAL}
  DMPAPER_LEGAL       = 5;  { Legal 8 12 x 14 in                }
  {$EXTERNALSYM DMPAPER_STATEMENT}
  DMPAPER_STATEMENT   = 6;  { Statement 5 12 x 8 12 in          }
  {$EXTERNALSYM DMPAPER_EXECUTIVE}
  DMPAPER_EXECUTIVE   = 7;  { Executive 7 14 x 10 12 in         }
  {$EXTERNALSYM DMPAPER_A3}
  DMPAPER_A3      = 8;      { A3 297 x 420 mm                     }
  {$EXTERNALSYM DMPAPER_A4}
  DMPAPER_A4      = 9;      { A4 210 x 297 mm                     }
  {$EXTERNALSYM DMPAPER_A4SMALL}
  DMPAPER_A4SMALL = 10;     { A4 Small 210 x 297 mm               }
  {$EXTERNALSYM DMPAPER_A5}
  DMPAPER_A5      = 11;     { A5 148 x 210 mm                     }
  {$EXTERNALSYM DMPAPER_B4}
  DMPAPER_B4      = 12;     { B4 (JIS) 250 x 354                  }
  {$EXTERNALSYM DMPAPER_B5}
  DMPAPER_B5      = 13;     { B5 (JIS) 182 x 257 mm               }
  {$EXTERNALSYM DMPAPER_FOLIO}
  DMPAPER_FOLIO   = 14;     { Folio 8 12 x 13 in                  }
  {$EXTERNALSYM DMPAPER_QUARTO}
  DMPAPER_QUARTO  = 15;     { Quarto 215 x 275 mm                 }
  {$EXTERNALSYM DMPAPER_10X14}
  DMPAPER_10X14   = 16;     { 10x14 in                            }
  {$EXTERNALSYM DMPAPER_11X17}
  DMPAPER_11X17   = 17;     { 11x17 in                            }
  {$EXTERNALSYM DMPAPER_NOTE}
  DMPAPER_NOTE    = 18;     { Note 8 12 x 11 in                   }
  {$EXTERNALSYM DMPAPER_ENV_9}
  DMPAPER_ENV_9   = 19;     { Envelope #9 3 78 x 8 78             }
  {$EXTERNALSYM DMPAPER_ENV_10}
  DMPAPER_ENV_10  = 20;     { Envelope #10 4 18 x 9 12            }
  {$EXTERNALSYM DMPAPER_ENV_11}
  DMPAPER_ENV_11  = 21;     { Envelope #11 4 12 x 10 38           }
  {$EXTERNALSYM DMPAPER_ENV_12}
  DMPAPER_ENV_12  = 22;     { Envelope #12 4 \276 x 11            }
  {$EXTERNALSYM DMPAPER_ENV_14}
  DMPAPER_ENV_14  = 23;     { Envelope #14 5 x 11 12              }
  {$EXTERNALSYM DMPAPER_CSHEET}
  DMPAPER_CSHEET  = 24;     { C size sheet                        }
  {$EXTERNALSYM DMPAPER_DSHEET}
  DMPAPER_DSHEET  = 25;     { D size sheet                        }
  {$EXTERNALSYM DMPAPER_ESHEET}
  DMPAPER_ESHEET  = 26;     { E size sheet                        }
  {$EXTERNALSYM DMPAPER_ENV_DL}
  DMPAPER_ENV_DL  = 27;     { Envelope DL 110 x 220mm             }
  {$EXTERNALSYM DMPAPER_ENV_C5}
  DMPAPER_ENV_C5  = 28;     { Envelope C5 162 x 229 mm            }
  {$EXTERNALSYM DMPAPER_ENV_C3}
  DMPAPER_ENV_C3  = 29;     { Envelope C3  324 x 458 mm           }
  {$EXTERNALSYM DMPAPER_ENV_C4}
  DMPAPER_ENV_C4  = 30;     { Envelope C4  229 x 324 mm           }
  {$EXTERNALSYM DMPAPER_ENV_C6}
  DMPAPER_ENV_C6  = 31;     { Envelope C6  114 x 162 mm           }
  {$EXTERNALSYM DMPAPER_ENV_C65}
  DMPAPER_ENV_C65  = 32;    { Envelope C65 114 x 229 mm           }
  {$EXTERNALSYM DMPAPER_ENV_B4}
  DMPAPER_ENV_B4   = 33;    { Envelope B4  250 x 353 mm           }
  {$EXTERNALSYM DMPAPER_ENV_B5}
  DMPAPER_ENV_B5   = 34;    { Envelope B5  176 x 250 mm           }
  {$EXTERNALSYM DMPAPER_ENV_B6}
  DMPAPER_ENV_B6   = 35;    { Envelope B6  176 x 125 mm           }
  {$EXTERNALSYM DMPAPER_ENV_ITALY}
  DMPAPER_ENV_ITALY          = 36;  { Envelope 110 x 230 mm               }
  {$EXTERNALSYM DMPAPER_ENV_MONARCH}
  DMPAPER_ENV_MONARCH        = 37;  { Envelope Monarch 3.875 x 7.5 in     }
  {$EXTERNALSYM DMPAPER_ENV_PERSONAL}
  DMPAPER_ENV_PERSONAL       = 38;  { 6 34 Envelope 3 58 x 6 12 in        }
  {$EXTERNALSYM DMPAPER_FANFOLD_US}
  DMPAPER_FANFOLD_US         = 39;  { US Std Fanfold 14 78 x 11 in        }
  {$EXTERNALSYM DMPAPER_FANFOLD_STD_GERMAN}
  DMPAPER_FANFOLD_STD_GERMAN = 40;  { German Std Fanfold 8 12 x 12 in    }
  {$EXTERNALSYM DMPAPER_FANFOLD_LGL_GERMAN}
  DMPAPER_FANFOLD_LGL_GERMAN = 41;  { German Legal Fanfold 8 12 x 13 in  }
  {$EXTERNALSYM DMPAPER_ISO_B4}
  DMPAPER_ISO_B4             = 42;  { B4 (ISO) 250 x 353 mm               }
  {$EXTERNALSYM DMPAPER_JAPANESE_POSTCARD}
  DMPAPER_JAPANESE_POSTCARD  = 43;  { Japanese Postcard 100 x 148 mm      }
  {$EXTERNALSYM DMPAPER_9X11}
  DMPAPER_9X11               = 44;  { 9 x 11 in                           }
  {$EXTERNALSYM DMPAPER_10X11}
  DMPAPER_10X11              = 45;  { 10 x 11 in                          }
  {$EXTERNALSYM DMPAPER_15X11}
  DMPAPER_15X11              = 46;  { 15 x 11 in                          }
  {$EXTERNALSYM DMPAPER_ENV_INVITE}
  DMPAPER_ENV_INVITE         = 47;  { Envelope Invite 220 x 220 mm        }
  {$EXTERNALSYM DMPAPER_RESERVED_48}
  DMPAPER_RESERVED_48        = 48;  { RESERVED--DO NOT USE                }
  {$EXTERNALSYM DMPAPER_RESERVED_49}
  DMPAPER_RESERVED_49        = 49;  { RESERVED--DO NOT USE                }
  {$EXTERNALSYM DMPAPER_LETTER_EXTRA}
  DMPAPER_LETTER_EXTRA       = 50;  { Letter Extra 9 \275 x 12 in         }
  {$EXTERNALSYM DMPAPER_LEGAL_EXTRA}
  DMPAPER_LEGAL_EXTRA        = 51;  { Legal Extra 9 \275 x 15 in          }
  {$EXTERNALSYM DMPAPER_TABLOID_EXTRA}
  DMPAPER_TABLOID_EXTRA      = 52;  { Tabloid Extra 11.69 x 18 in         }
  {$EXTERNALSYM DMPAPER_A4_EXTRA}
  DMPAPER_A4_EXTRA           = 53;  { A4 Extra 9.27 x 12.69 in            }
  {$EXTERNALSYM DMPAPER_LETTER_TRANSVERSE}
  DMPAPER_LETTER_TRANSVERSE  = 54;  { Letter Transverse 8 \275 x 11 in    }
  {$EXTERNALSYM DMPAPER_A4_TRANSVERSE}
  DMPAPER_A4_TRANSVERSE      = 55;  { A4 Transverse 210 x 297 mm          }
  {$EXTERNALSYM DMPAPER_LETTER_EXTRA_TRANSVERSE}
  DMPAPER_LETTER_EXTRA_TRANSVERSE = 56;     { Letter Extra Transverse 9\275 x 12 in  }
  {$EXTERNALSYM DMPAPER_A_PLUS}
  DMPAPER_A_PLUS        = 57;     { SuperASuperAA4 227 x 356 mm       }
  {$EXTERNALSYM DMPAPER_B_PLUS}
  DMPAPER_B_PLUS        = 58;     { SuperBSuperBA3 305 x 487 mm       }
  {$EXTERNALSYM DMPAPER_LETTER_PLUS}
  DMPAPER_LETTER_PLUS   = 59;     { Letter Plus 8.5 x 12.69 in          }
  {$EXTERNALSYM DMPAPER_A4_PLUS}
  DMPAPER_A4_PLUS       = 60;     { A4 Plus 210 x 330 mm                }
  {$EXTERNALSYM DMPAPER_A5_TRANSVERSE}
  DMPAPER_A5_TRANSVERSE = 61;     { A5 Transverse 148 x 210 mm          }
  {$EXTERNALSYM DMPAPER_B5_TRANSVERSE}
  DMPAPER_B5_TRANSVERSE = 62;     { B5 (JIS) Transverse 182 x 257 mm    }
  {$EXTERNALSYM DMPAPER_A3_EXTRA}
  DMPAPER_A3_EXTRA      = 63;     { A3 Extra 322 x 445 mm               }
  {$EXTERNALSYM DMPAPER_A5_EXTRA}
  DMPAPER_A5_EXTRA      = $40;    { A5 Extra 174 x 235 mm               }
  {$EXTERNALSYM DMPAPER_B5_EXTRA}
  DMPAPER_B5_EXTRA      = 65;     { B5 (ISO) Extra 201 x 276 mm         }
  {$EXTERNALSYM DMPAPER_A2}
  DMPAPER_A2            = 66;     { A2 420 x 594 mm                     }
  {$EXTERNALSYM DMPAPER_A3_TRANSVERSE}
  DMPAPER_A3_TRANSVERSE = 67;     { A3 Transverse 297 x 420 mm          }
  {$EXTERNALSYM DMPAPER_A3_EXTRA_TRANSVERSE}
  DMPAPER_A3_EXTRA_TRANSVERSE = 68;     { A3 Extra Transverse 322 x 445 mm    }
{
 ** the following sizes are reserved for the Far East version of Win95.
 ** Rotated papers rotate the physical page but not the logical page.
}
  {$EXTERNALSYM DMPAPER_DBL_JAPANESE_POSTCARD}
  DMPAPER_DBL_JAPANESE_POSTCARD = 69; { Japanese Double Postcard 200 x 148 mm }

  {$EXTERNALSYM DMPAPER_A6}
  DMPAPER_A6                  = 70;  { A6 105 x 148 mm                 }

  {$EXTERNALSYM DMPAPER_JENV_KAKU2          }
  DMPAPER_JENV_KAKU2          = 71;  { Japanese Envelope Kaku #2       }
  {$EXTERNALSYM DMPAPER_JENV_KAKU3          }
  DMPAPER_JENV_KAKU3          = 72;  { Japanese Envelope Kaku #3       }
  {$EXTERNALSYM DMPAPER_JENV_CHOU3          }
  DMPAPER_JENV_CHOU3          = 73;  { Japanese Envelope Chou #3       }
  {$EXTERNALSYM DMPAPER_JENV_CHOU4          }
  DMPAPER_JENV_CHOU4          = 74;  { Japanese Envelope Chou #4       }
  {$EXTERNALSYM DMPAPER_LETTER_ROTATED      }
  DMPAPER_LETTER_ROTATED      = 75;  { Letter Rotated 11 x 8 1/2 11 in }
  {$EXTERNALSYM DMPAPER_A3_ROTATED          }
  DMPAPER_A3_ROTATED          = 76;  { A3 Rotated 420 x 297 mm         }
  {$EXTERNALSYM DMPAPER_A4_ROTATED          }
  DMPAPER_A4_ROTATED          = 77;  { A4 Rotated 297 x 210 mm         }
  {$EXTERNALSYM DMPAPER_A5_ROTATED          }
  DMPAPER_A5_ROTATED          = 78;  { A5 Rotated 210 x 148 mm         }
  {$EXTERNALSYM DMPAPER_B4_JIS_ROTATED      }
  DMPAPER_B4_JIS_ROTATED      = 79;  { B4 (JIS) Rotated 364 x 257 mm   }
  {$EXTERNALSYM DMPAPER_B5_JIS_ROTATED      }
  DMPAPER_B5_JIS_ROTATED      = 80;  { B5 (JIS) Rotated 257 x 182 mm   }
  {$EXTERNALSYM DMPAPER_JAPANESE_POSTCARD_ROTATED }
  DMPAPER_JAPANESE_POSTCARD_ROTATED = 81; { Japanese Postcard Rotated 148 x 100 mm }
  {$EXTERNALSYM DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED }
  DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82; { Double Japanese Postcard Rotated 148 x 200 mm }
  {$EXTERNALSYM DMPAPER_A6_ROTATED          }
  DMPAPER_A6_ROTATED          = 83;  { A6 Rotated 148 x 105 mm         }
  {$EXTERNALSYM DMPAPER_JENV_KAKU2_ROTATED  }
  DMPAPER_JENV_KAKU2_ROTATED  = 84;  { Japanese Envelope Kaku #2 Rotated}
  {$EXTERNALSYM DMPAPER_JENV_KAKU3_ROTATED  }
  DMPAPER_JENV_KAKU3_ROTATED  = 85;  { Japanese Envelope Kaku #3 Rotated}
  {$EXTERNALSYM DMPAPER_JENV_CHOU3_ROTATED  }
  DMPAPER_JENV_CHOU3_ROTATED  = 86;  { Japanese Envelope Chou #3 Rotated}
  {$EXTERNALSYM DMPAPER_JENV_CHOU4_ROTATED  }
  DMPAPER_JENV_CHOU4_ROTATED  = 87;  { Japanese Envelope Chou #4 Rotated}
  {$EXTERNALSYM DMPAPER_B6_JIS              }
  DMPAPER_B6_JIS              = 88;  { B6 (JIS) 128 x 182 mm           }
  {$EXTERNALSYM DMPAPER_B6_JIS_ROTATED      }
  DMPAPER_B6_JIS_ROTATED      = 89;  { B6 (JIS) Rotated 182 x 128 mm   }
  {$EXTERNALSYM DMPAPER_12X11               }
  DMPAPER_12X11               = 90;  { 12 x 11 in                      }
  {$EXTERNALSYM DMPAPER_JENV_YOU4           }
  DMPAPER_JENV_YOU4           = 91;  { Japanese Envelope You #4        }
  {$EXTERNALSYM DMPAPER_JENV_YOU4_ROTATED   }
  DMPAPER_JENV_YOU4_ROTATED   = 92;  { Japanese Envelope You #4 Rotated}
  {$EXTERNALSYM DMPAPER_P16K                }
  DMPAPER_P16K                = 93;  { PRC 16K 146 x 215 mm            }
  {$EXTERNALSYM DMPAPER_P32K                }
  DMPAPER_P32K                = 94;  { PRC 32K 97 x 151 mm             }
  {$EXTERNALSYM DMPAPER_P32KBIG             }
  DMPAPER_P32KBIG             = 95;  { PRC 32K(Big) 97 x 151 mm        }
  {$EXTERNALSYM DMPAPER_PENV_1              }
  DMPAPER_PENV_1              = 96;  { PRC Envelope #1 102 x 165 mm    }
  {$EXTERNALSYM DMPAPER_PENV_2              }
  DMPAPER_PENV_2              = 97;  { PRC Envelope #2 102 x 176 mm    }
  {$EXTERNALSYM DMPAPER_PENV_3              }
  DMPAPER_PENV_3              = 98;  { PRC Envelope #3 125 x 176 mm    }
  {$EXTERNALSYM DMPAPER_PENV_4              }
  DMPAPER_PENV_4              = 99;  { PRC Envelope #4 110 x 208 mm    }
  {$EXTERNALSYM DMPAPER_PENV_5              }
  DMPAPER_PENV_5              = 100; { PRC Envelope #5 110 x 220 mm    }
  {$EXTERNALSYM DMPAPER_PENV_6              }
  DMPAPER_PENV_6              = 101; { PRC Envelope #6 120 x 230 mm    }
  {$EXTERNALSYM DMPAPER_PENV_7              }
  DMPAPER_PENV_7              = 102; { PRC Envelope #7 160 x 230 mm    }
  {$EXTERNALSYM DMPAPER_PENV_8              }
  DMPAPER_PENV_8              = 103; { PRC Envelope #8 120 x 309 mm    }
  {$EXTERNALSYM DMPAPER_PENV_9              }
  DMPAPER_PENV_9              = 104; { PRC Envelope #9 229 x 324 mm    }
  {$EXTERNALSYM DMPAPER_PENV_10             }
  DMPAPER_PENV_10             = 105; { PRC Envelope #10 324 x 458 mm   }
  {$EXTERNALSYM DMPAPER_P16K_ROTATED        }
  DMPAPER_P16K_ROTATED        = 106; { PRC 16K Rotated                 }
  {$EXTERNALSYM DMPAPER_P32K_ROTATED        }
  DMPAPER_P32K_ROTATED        = 107; { PRC 32K Rotated                 }
  {$EXTERNALSYM DMPAPER_P32KBIG_ROTATED     }
  DMPAPER_P32KBIG_ROTATED     = 108; { PRC 32K(Big) Rotated            }
  {$EXTERNALSYM DMPAPER_PENV_1_ROTATED      }
  DMPAPER_PENV_1_ROTATED      = 109; { PRC Envelope #1 Rotated 165 x 102 mm}
  {$EXTERNALSYM DMPAPER_PENV_2_ROTATED      }
  DMPAPER_PENV_2_ROTATED      = 110; { PRC Envelope #2 Rotated 176 x 102 mm}
  {$EXTERNALSYM DMPAPER_PENV_3_ROTATED      }
  DMPAPER_PENV_3_ROTATED      = 111; { PRC Envelope #3 Rotated 176 x 125 mm}
  {$EXTERNALSYM DMPAPER_PENV_4_ROTATED      }
  DMPAPER_PENV_4_ROTATED      = 112; { PRC Envelope #4 Rotated 208 x 110 mm}
  {$EXTERNALSYM DMPAPER_PENV_5_ROTATED      }
  DMPAPER_PENV_5_ROTATED      = 113; { PRC Envelope #5 Rotated 220 x 110 mm}
  {$EXTERNALSYM DMPAPER_PENV_6_ROTATED      }
  DMPAPER_PENV_6_ROTATED      = 114; { PRC Envelope #6 Rotated 230 x 120 mm}
  {$EXTERNALSYM DMPAPER_PENV_7_ROTATED      }
  DMPAPER_PENV_7_ROTATED      = 115; { PRC Envelope #7 Rotated 230 x 160 mm}
  {$EXTERNALSYM DMPAPER_PENV_8_ROTATED      }
  DMPAPER_PENV_8_ROTATED      = 116; { PRC Envelope #8 Rotated 309 x 120 mm}
  {$EXTERNALSYM DMPAPER_PENV_9_ROTATED      }
  DMPAPER_PENV_9_ROTATED      = 117; { PRC Envelope #9 Rotated 324 x 229 mm}
  {$EXTERNALSYM DMPAPER_PENV_10_ROTATED     }
  DMPAPER_PENV_10_ROTATED     = 118; { PRC Envelope #10 Rotated 458 x 324 mm }
  {$EXTERNALSYM DMPAPER_LAST}
  DMPAPER_LAST                = DMPAPER_PENV_10_ROTATED;
  {$EXTERNALSYM DMPAPER_USER}
  DMPAPER_USER                = $100;

{ bin selections }

  {$EXTERNALSYM DMBIN_UPPER}
  DMBIN_UPPER = 1;
  {$EXTERNALSYM DMBIN_FIRST}
  DMBIN_FIRST = DMBIN_UPPER;
  {$EXTERNALSYM DMBIN_ONLYONE}
  DMBIN_ONLYONE = 1;
  {$EXTERNALSYM DMBIN_LOWER}
  DMBIN_LOWER = 2;
  {$EXTERNALSYM DMBIN_MIDDLE}
  DMBIN_MIDDLE = 3;
  {$EXTERNALSYM DMBIN_MANUAL}
  DMBIN_MANUAL = 4;
  {$EXTERNALSYM DMBIN_ENVELOPE}
  DMBIN_ENVELOPE = 5;
  {$EXTERNALSYM DMBIN_ENVMANUAL}
  DMBIN_ENVMANUAL = 6;
  {$EXTERNALSYM DMBIN_AUTO}
  DMBIN_AUTO = 7;
  {$EXTERNALSYM DMBIN_TRACTOR}
  DMBIN_TRACTOR = 8;
  {$EXTERNALSYM DMBIN_SMALLFMT}
  DMBIN_SMALLFMT = 9;
  {$EXTERNALSYM DMBIN_LARGEFMT}
  DMBIN_LARGEFMT = 10;
  {$EXTERNALSYM DMBIN_LARGECAPACITY}
  DMBIN_LARGECAPACITY = 11;
  {$EXTERNALSYM DMBIN_CASSETTE}
  DMBIN_CASSETTE = 14;
  {$EXTERNALSYM DMBIN_FORMSOURCE}
  DMBIN_FORMSOURCE = 15;
  {$EXTERNALSYM DMBIN_LAST}
  DMBIN_LAST = DMBIN_FORMSOURCE;
  {$EXTERNALSYM DMBIN_USER}
  DMBIN_USER = $100;   { device specific bins start here }

  { print qualities }
  {$EXTERNALSYM DMRES_DRAFT}
  DMRES_DRAFT = LongWord(-1);
  {$EXTERNALSYM DMRES_LOW}
  DMRES_LOW = LongWord(-2);
  {$EXTERNALSYM DMRES_MEDIUM}
  DMRES_MEDIUM = LongWord(-3);
  {$EXTERNALSYM DMRES_HIGH}
  DMRES_HIGH = LongWord(-4);

  { color enabledisable for color printers }
  {$EXTERNALSYM DMCOLOR_MONOCHROME}
  DMCOLOR_MONOCHROME = 1;
  {$EXTERNALSYM DMCOLOR_COLOR}
  DMCOLOR_COLOR = 2;

  { duplex enable }
  {$EXTERNALSYM DMDUP_SIMPLEX}
  DMDUP_SIMPLEX = 1;
  {$EXTERNALSYM DMDUP_VERTICAL}
  DMDUP_VERTICAL = 2;
  {$EXTERNALSYM DMDUP_HORIZONTAL}
  DMDUP_HORIZONTAL = 3;

  { TrueType options }
  {$EXTERNALSYM DMTT_BITMAP}
  DMTT_BITMAP           = 1;     { print TT fonts as graphics  }
  {$EXTERNALSYM DMTT_DOWNLOAD}
  DMTT_DOWNLOAD         = 2;     { download TT fonts as soft fonts  }
  {$EXTERNALSYM DMTT_SUBDEV}
  DMTT_SUBDEV           = 3;     { substitute device fonts for TT fonts  }
  {$EXTERNALSYM DMTT_DOWNLOAD_OUTLINE}
  DMTT_DOWNLOAD_OUTLINE = 4;     { download TT fonts as outline soft fonts  }

  { Collation selections }
  {$EXTERNALSYM DMCOLLATE_FALSE}
  DMCOLLATE_FALSE = 0;
  {$EXTERNALSYM DMCOLLATE_TRUE}
  DMCOLLATE_TRUE = 1;

  { DEVMODE dmDisplayFlags flags }
  {$EXTERNALSYM DM_GRAYSCALE}
  DM_GRAYSCALE = $00000001;  { removed in 4.0 SDK }
  {$EXTERNALSYM DM_INTERLACED}
  DM_INTERLACED = $00000002; { removed in 4.0 SDK }
  {$EXTERNALSYM DM_TEXTMODE}
  DM_TEXTMODE = $00000004;   { removed in 4.0 SDK }
  {$EXTERNALSYM DMDISPLAYFLAGS_TEXTMODE}
  DMDISPLAYFLAGS_TEXTMODE     = $00000004;

  { ICM methods }
  {$EXTERNALSYM DMICMMETHOD_NONE}
  DMICMMETHOD_NONE   = 1;     { ICM disabled  }
  {$EXTERNALSYM DMICMMETHOD_SYSTEM}
  DMICMMETHOD_SYSTEM = 2;     { ICM handled by system  }
  {$EXTERNALSYM DMICMMETHOD_DRIVER}
  DMICMMETHOD_DRIVER = 3;     { ICM handled by driver  }
  {$EXTERNALSYM DMICMMETHOD_DEVICE}
  DMICMMETHOD_DEVICE = 4;     { ICM handled by device  }

  {$EXTERNALSYM DMICMMETHOD_USER}
  DMICMMETHOD_USER = $100;    { Device-specific methods start here  }

  { ICM Intents }
  {$EXTERNALSYM DMICM_SATURATE}
  DMICM_SATURATE    = 1;     { Maximize color saturation  }
  {$EXTERNALSYM DMICM_CONTRAST}
  DMICM_CONTRAST    = 2;     { Maximize color contrast  }
  {$EXTERNALSYM DMICM_COLORMETRIC}
  DMICM_COLORMETRIC = 3;     { Use specific color metric  }

  {$EXTERNALSYM DMICM_USER}
  DMICM_USER = $100;     { Device-specific intents start here  }


  { Media types }
  {$EXTERNALSYM DMMEDIA_STANDARD}
  DMMEDIA_STANDARD     = 1;     { Standard paper  }
  {$EXTERNALSYM DMMEDIA_TRANSPARENCY}
  DMMEDIA_TRANSPARENCY = 2;     { Transparency  }
  {$EXTERNALSYM DMMEDIA_GLOSSY}
  DMMEDIA_GLOSSY       = 3;     { Glossy paper  }

  {$EXTERNALSYM DMMEDIA_USER}
  DMMEDIA_USER = $100;     { Device-specific media start here  }


  { Dither types }
  {$EXTERNALSYM DMDITHER_NONE}
  DMDITHER_NONE      = 1;     { No dithering  }
  {$EXTERNALSYM DMDITHER_COARSE}
  DMDITHER_COARSE    = 2;     { Dither with a coarse brush  }
  {$EXTERNALSYM DMDITHER_FINE}
  DMDITHER_FINE      = 3;     { Dither with a fine brush  }
  {$EXTERNALSYM DMDITHER_LINEART}
  DMDITHER_LINEART   = 4;     { LineArt dithering  }
  {$EXTERNALSYM DMDITHER_ERRORDIFFUSION}
  DMDITHER_ERRORDIFFUSION = 5; { LineArt dithering }
  {$EXTERNALSYM DMDITHER_RESERVED6}
  DMDITHER_RESERVED6 = 6;      { LineArt dithering }
  {$EXTERNALSYM DMDITHER_RESERVED7}
  DMDITHER_RESERVED7 = 7;      { LineArt dithering }
  {$EXTERNALSYM DMDITHER_RESERVED8}
  DMDITHER_RESERVED8 = 8;      { LineArt dithering }
  {$EXTERNALSYM DMDITHER_RESERVED9}
  DMDITHER_RESERVED9 = 9;      { LineArt dithering }
  {$EXTERNALSYM DMDITHER_GRAYSCALE}
  DMDITHER_GRAYSCALE = 10;     { Device does grayscaling  }

  {$EXTERNALSYM DMDITHER_USER}
  DMDITHER_USER = 256;        { Device-specific dithers start here  }

type
  PDisplayDeviceA = ^TDisplayDeviceA;
  PDisplayDeviceW = ^TDisplayDeviceW;
  PDisplayDevice = PDisplayDeviceA;
  {$EXTERNALSYM _DISPLAY_DEVICEA}
  _DISPLAY_DEVICEA = packed record
    cb: DWORD;
    DeviceName: array[0..31] of AnsiChar;
    DeviceString: array[0..127] of AnsiChar;
    StateFlags: DWORD;
  end;
  {$EXTERNALSYM _DISPLAY_DEVICEW}
  _DISPLAY_DEVICEW = packed record
    cb: DWORD;
    DeviceName: array[0..31] of WideChar;
    DeviceString: array[0..127] of WideChar;
    StateFlags: DWORD;
  end;
  {$EXTERNALSYM _DISPLAY_DEVICE}
  _DISPLAY_DEVICE = _DISPLAY_DEVICEA;
  TDisplayDeviceA = _DISPLAY_DEVICEA;
  TDisplayDeviceW = _DISPLAY_DEVICEW;
  TDisplayDevice = TDisplayDeviceA;

const
  {$EXTERNALSYM DISPLAY_DEVICE_ATTACHED_TO_DESKTOP}
  DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = $00000001;
  {$EXTERNALSYM DISPLAY_DEVICE_MULTI_DRIVER}
  DISPLAY_DEVICE_MULTI_DRIVER = $00000002;
  {$EXTERNALSYM DISPLAY_DEVICE_PRIMARY_DEVICE}
  DISPLAY_DEVICE_PRIMARY_DEVICE = $00000004;
  {$EXTERNALSYM DISPLAY_DEVICE_MIRRORING_DRIVER}
  DISPLAY_DEVICE_MIRRORING_DRIVER = $00000008;
  {$EXTERNALSYM DISPLAY_DEVICE_VGA_COMPATIBLE}
  DISPLAY_DEVICE_VGA_COMPATIBLE = $00000010;

{ GetRegionData / ExtCreateRegion }

  {$EXTERNALSYM RDH_RECTANGLES}
  RDH_RECTANGLES = 1;

type
  PRgnDataHeader = ^TRgnDataHeader;
  {$EXTERNALSYM _RGNDATAHEADER}
  _RGNDATAHEADER = packed record
    dwSize: DWORD;
    iType: DWORD;
    nCount: DWORD;
    nRgnSize: DWORD;
    rcBound: TRect;
  end;
  TRgnDataHeader = _RGNDATAHEADER;
  {$EXTERNALSYM RGNDATAHEADER}
  RGNDATAHEADER = _RGNDATAHEADER;

  PRgnData = ^TRgnData;
  {$EXTERNALSYM _RGNDATA}
  _RGNDATA = record
    rdh: TRgnDataHeader;
    Buffer: array[0..0] of CHAR;
    Reserved: array[0..2] of CHAR;
  end;
  TRgnData = _RGNDATA;
  {$EXTERNALSYM RGNDATA}
  RGNDATA = _RGNDATA;

  {$EXTERNALSYM PABC}
  PABC = ^TABC;
  {$EXTERNALSYM _ABC}
  _ABC = packed record
    abcA: Integer;
    abcB: UINT;
    abcC: Integer;
  end;
  TABC = _ABC;
  {$EXTERNALSYM ABC}
  ABC = _ABC;

  PABCFloat = ^TABCFloat;
  {$EXTERNALSYM _ABCFLOAT}
  _ABCFLOAT = packed record
    abcfA: Single;
    abcfB: Single;
    abcfC: Single;
  end;
  TABCFloat = _ABCFLOAT;
  {$EXTERNALSYM ABCFLOAT}
  ABCFLOAT = _ABCFLOAT;

  POutlineTextmetricA = ^TOutlineTextmetricA;
  POutlineTextmetricW = ^TOutlineTextmetricW;
  POutlineTextmetric = POutlineTextmetricA;
  {$EXTERNALSYM _OUTLINETEXTMETRICA}
  _OUTLINETEXTMETRICA = record
    otmSize: UINT;
    otmTextMetrics: TTextMetricA;
    otmFiller: Byte;
    otmPanoseNumber: TPanose;
    otmfsSelection: UINT;
    otmfsType: UINT;
    otmsCharSlopeRise: Integer;
    otmsCharSlopeRun: Integer;
    otmItalicAngle: Integer;
    otmEMSquare: UINT;
    otmAscent: Integer;
    otmDescent: Integer;
    otmLineGap: UINT;
    otmsCapEmHeight: UINT;
    otmsXHeight: UINT;
    otmrcFontBox: TRect;
    otmMacAscent: Integer;
    otmMacDescent: Integer;
    otmMacLineGap: UINT;
    otmusMinimumPPEM: UINT;
    otmptSubscriptSize: TPoint;
    otmptSubscriptOffset: TPoint;
    otmptSuperscriptSize: TPoint;
    otmptSuperscriptOffset: TPoint;
    otmsStrikeoutSize: UINT;
    otmsStrikeoutPosition: Integer;
    otmsUnderscoreSize: Integer;
    otmsUnderscorePosition: Integer;
    otmpFamilyName: PAnsiChar;
    otmpFaceName: PAnsiChar;
    otmpStyleName: PAnsiChar;
    otmpFullName: PAnsiChar;
  end;
  {$EXTERNALSYM _OUTLINETEXTMETRICW}
  _OUTLINETEXTMETRICW = record
    otmSize: UINT;
    otmTextMetrics: TTextMetricW;
    otmFiller: Byte;
    otmPanoseNumber: TPanose;
    otmfsSelection: UINT;
    otmfsType: UINT;
    otmsCharSlopeRise: Integer;
    otmsCharSlopeRun: Integer;
    otmItalicAngle: Integer;
    otmEMSquare: UINT;
    otmAscent: Integer;
    otmDescent: Integer;
    otmLineGap: UINT;
    otmsCapEmHeight: UINT;
    otmsXHeight: UINT;
    otmrcFontBox: TRect;
    otmMacAscent: Integer;
    otmMacDescent: Integer;
    otmMacLineGap: UINT;
    otmusMinimumPPEM: UINT;
    otmptSubscriptSize: TPoint;
    otmptSubscriptOffset: TPoint;
    otmptSuperscriptSize: TPoint;
    otmptSuperscriptOffset: TPoint;
    otmsStrikeoutSize: UINT;
    otmsStrikeoutPosition: Integer;
    otmsUnderscoreSize: Integer;
    otmsUnderscorePosition: Integer;
    otmpFamilyName: PWideChar;
    otmpFaceName: PWideChar;
    otmpStyleName: PWideChar;
    otmpFullName: PWideChar;
  end;
  {$EXTERNALSYM _OUTLINETEXTMETRIC}
  _OUTLINETEXTMETRIC = _OUTLINETEXTMETRICA;
  TOutlineTextmetricA = _OUTLINETEXTMETRICA;
  TOutlineTextmetricW = _OUTLINETEXTMETRICW;
  TOutlineTextmetric = TOutlineTextmetricA;
  {$EXTERNALSYM OUTLINETEXTMETRICA}
  OUTLINETEXTMETRICA = _OUTLINETEXTMETRICA;
  {$EXTERNALSYM OUTLINETEXTMETRICW}
  OUTLINETEXTMETRICW = _OUTLINETEXTMETRICW;
  {$EXTERNALSYM OUTLINETEXTMETRIC}
  OUTLINETEXTMETRIC = OUTLINETEXTMETRICA;

type
  PPolyTextA = ^TPolyTextA;
  PPolyTextW = ^TPolyTextW;
  PPolyText = PPolyTextA;
  {$EXTERNALSYM tagPOLYTEXTA}
  tagPOLYTEXTA = packed record
    x: Integer;
    y: Integer;
    n: UINT;
    PAnsiChar: PAnsiChar;
    uiFlags: UINT;
    rcl: TRect;
    pdx: PINT;
  end;
  {$EXTERNALSYM tagPOLYTEXTW}
  tagPOLYTEXTW = packed record
    x: Integer;
    y: Integer;
    n: UINT;
    PAnsiChar: PWideChar;
    uiFlags: UINT;
    rcl: TRect;
    pdx: PINT;
  end;
  {$EXTERNALSYM tagPOLYTEXT}
  tagPOLYTEXT = tagPOLYTEXTA;
  TPolyTextA = tagPOLYTEXTA;
  TPolyTextW = tagPOLYTEXTW;
  TPolyText = TPolyTextA;
  {$EXTERNALSYM POLYTEXTA}
  POLYTEXTA = tagPOLYTEXTA;
  {$EXTERNALSYM POLYTEXTW}
  POLYTEXTW = tagPOLYTEXTW;
  {$EXTERNALSYM POLYTEXT}
  POLYTEXT = POLYTEXTA;

  {$EXTERNALSYM _FIXED}
  _FIXED = packed record
    fract: Word;
    value: SHORT;
  end;
  TFixed = _FIXED;
  {$EXTERNALSYM FIXED}
  FIXED = _FIXED;

  PMat2 = ^TMat2;
  {$EXTERNALSYM _MAT2}
  _MAT2 = packed record
    eM11: TFixed;
    eM12: TFixed;
    eM21: TFixed;
    eM22: TFixed;
  end;
  TMat2 = _MAT2;
  {$EXTERNALSYM MAT2}
  MAT2 = _MAT2;

  PGlyphMetrics = ^TGlyphMetrics;
  {$EXTERNALSYM _GLYPHMETRICS}
  _GLYPHMETRICS = packed record
    gmBlackBoxX: UINT;
    gmBlackBoxY: UINT;
    gmptGlyphOrigin: TPoint;
    gmCellIncX: SHORT;
    gmCellIncY: SHORT;
  end;
  TGlyphMetrics = _GLYPHMETRICS;
  {$EXTERNALSYM GLYPHMETRICS}
  GLYPHMETRICS = _GLYPHMETRICS;

const
  { GetGlyphOutline constants }
  {$EXTERNALSYM GGO_METRICS}
  GGO_METRICS = 0;
  {$EXTERNALSYM GGO_BITMAP}
  GGO_BITMAP = 1;
  {$EXTERNALSYM GGO_NATIVE}
  GGO_NATIVE = 2;

  {$EXTERNALSYM GGO_GRAY2_BITMAP}
  GGO_GRAY2_BITMAP = 4;
  {$EXTERNALSYM GGO_GRAY4_BITMAP}
  GGO_GRAY4_BITMAP = 5;
  {$EXTERNALSYM GGO_GRAY8_BITMAP}
  GGO_GRAY8_BITMAP = 6;
  {$EXTERNALSYM GGO_GLYPH_INDEX}
  GGO_GLYPH_INDEX = $80;

  {$EXTERNALSYM TT_POLYGON_TYPE}
  TT_POLYGON_TYPE = 24;
  {$EXTERNALSYM TT_PRIM_LINE}
  TT_PRIM_LINE = 1;
  {$EXTERNALSYM TT_PRIM_QSPLINE}
  TT_PRIM_QSPLINE = 2;

type
  PPointfx = ^TPointfx;
  {$EXTERNALSYM tagPOINTFX}
  tagPOINTFX = packed record
    x: TFixed;
    y: TFixed;
  end;
  TPointfx = tagPOINTFX;
  {$EXTERNALSYM POINTFX}
  POINTFX = tagPOINTFX;

  PTTPolyCurve = ^TTTPolyCurve;
  {$EXTERNALSYM tagTTPOLYCURVE}
  tagTTPOLYCURVE = packed record
    wType: Word;
    cpfx: Word;
    apfx: array[0..0] of TPointFX;
  end;
  TTTPolyCurve = tagTTPOLYCURVE;
  {$EXTERNALSYM TTPOLYCURVE}
  TTPOLYCURVE = tagTTPOLYCURVE;

  PTTPolygonHeader = ^TTTPolygonHeader;
  {$EXTERNALSYM tagTTPOLYGONHEADER}
  tagTTPOLYGONHEADER = packed record
    cb: DWORD;
    dwType: DWORD;
    pfxStart: TPointFX;
  end;
  TTTPolygonHeader = tagTTPOLYGONHEADER;
  {$EXTERNALSYM TTPOLYGONHEADER}
  TTPOLYGONHEADER = tagTTPOLYGONHEADER;

const
  {$EXTERNALSYM GCP_DBCS}
  GCP_DBCS = 1;
  {$EXTERNALSYM GCP_REORDER}
  GCP_REORDER = 2;
  {$EXTERNALSYM GCP_USEKERNING}
  GCP_USEKERNING = 8;
  {$EXTERNALSYM GCP_GLYPHSHAPE}
  GCP_GLYPHSHAPE = $10;
  {$EXTERNALSYM GCP_LIGATE}
  GCP_LIGATE = 32;
  GCP_GLYPHINDEXING = $0080; // commented out in Windows Headers

  {$EXTERNALSYM GCP_DIACRITIC}
  GCP_DIACRITIC = $100;
  {$EXTERNALSYM GCP_KASHIDA}
  GCP_KASHIDA = $400;
  {$EXTERNALSYM GCP_ERROR}
  GCP_ERROR = $8000;
  {$EXTERNALSYM FLI_MASK}
  FLI_MASK = 4155;

  {$EXTERNALSYM GCP_JUSTIFY}
  GCP_JUSTIFY = $10000;
  GCP_NODIACRITICS = $00020000; // commented out in Windows Headers

  {$EXTERNALSYM FLI_GLYPHS}
  FLI_GLYPHS = $40000;
  {$EXTERNALSYM GCP_CLASSIN}
  GCP_CLASSIN = $80000;
  {$EXTERNALSYM GCP_MAXEXTENT}
  GCP_MAXEXTENT = $100000;
  {$EXTERNALSYM GCP_JUSTIFYIN}
  GCP_JUSTIFYIN = $200000;
  {$EXTERNALSYM GCP_DISPLAYZWG}
  GCP_DISPLAYZWG = $400000;
  {$EXTERNALSYM GCP_SYMSWAPOFF}
  GCP_SYMSWAPOFF = $800000;
  {$EXTERNALSYM GCP_NUMERICOVERRIDE}
  GCP_NUMERICOVERRIDE = $1000000;
  {$EXTERNALSYM GCP_NEUTRALOVERRIDE}
  GCP_NEUTRALOVERRIDE = $2000000;
  {$EXTERNALSYM GCP_NUMERICSLATIN}
  GCP_NUMERICSLATIN = $4000000;
  {$EXTERNALSYM GCP_NUMERICSLOCAL}
  GCP_NUMERICSLOCAL = $8000000;

  {$EXTERNALSYM GCPCLASS_LATIN}
  GCPCLASS_LATIN = 1;
  {$EXTERNALSYM GCPCLASS_HEBREW}
  GCPCLASS_HEBREW = 2;
  {$EXTERNALSYM GCPCLASS_ARABIC}
  GCPCLASS_ARABIC = 2;
  {$EXTERNALSYM GCPCLASS_NEUTRAL}
  GCPCLASS_NEUTRAL = 3;
  {$EXTERNALSYM GCPCLASS_LOCALNUMBER}
  GCPCLASS_LOCALNUMBER = 4;
  {$EXTERNALSYM GCPCLASS_LATINNUMBER}
  GCPCLASS_LATINNUMBER = 5;
  {$EXTERNALSYM GCPCLASS_LATINNUMERICTERMINATOR}
  GCPCLASS_LATINNUMERICTERMINATOR = 6;
  {$EXTERNALSYM GCPCLASS_LATINNUMERICSEPARATOR}
  GCPCLASS_LATINNUMERICSEPARATOR = 7;
  {$EXTERNALSYM GCPCLASS_NUMERICSEPARATOR}
  GCPCLASS_NUMERICSEPARATOR = 8;
  {$EXTERNALSYM GCPCLASS_PREBOUNDRTL}
  GCPCLASS_PREBOUNDRTL = $80;
  {$EXTERNALSYM GCPCLASS_PREBOUNDLTR}
  GCPCLASS_PREBOUNDLTR = $40;
  {$EXTERNALSYM GCPCLASS_POSTBOUNDLTR}
  GCPCLASS_POSTBOUNDLTR        = $20;
  {$EXTERNALSYM GCPCLASS_POSTBOUNDRTL}
  GCPCLASS_POSTBOUNDRTL        = $10;

  {$EXTERNALSYM GCPGLYPH_LINKBEFORE}
  GCPGLYPH_LINKBEFORE          = $8000;
  {$EXTERNALSYM GCPGLYPH_LINKAFTER}
  GCPGLYPH_LINKAFTER           = $4000;


type
  PGCPResultsA = ^TGCPResultsA;
  PGCPResultsW = ^TGCPResultsW;
  PGCPResults = PGCPResultsA;
  {$EXTERNALSYM tagGCP_RESULTSA}
  tagGCP_RESULTSA = packed record
    lStructSize: DWORD;
    lpOutString: PAnsiChar;
    lpOrder: PUINT;
    lpDx: PINT;
    lpCaretPos: PINT;
    lpClass: PAnsiChar;
    lpGlyphs: PUINT;
    nGlyphs: UINT;
    nMaxFit: Integer;
  end;
  {$EXTERNALSYM tagGCP_RESULTSW}
  tagGCP_RESULTSW = packed record
    lStructSize: DWORD;
    lpOutString: PWideChar;
    lpOrder: PUINT;
    lpDx: PINT;
    lpCaretPos: PINT;
    lpClass: PWideChar;
    lpGlyphs: PUINT;
    nGlyphs: UINT;
    nMaxFit: Integer;
  end;
  {$EXTERNALSYM tagGCP_RESULTS}
  tagGCP_RESULTS = tagGCP_RESULTSA;
  TGCPResultsA = tagGCP_RESULTSA;
  TGCPResultsW = tagGCP_RESULTSW;
  TGCPResults = TGCPResultsA;
  {$EXTERNALSYM GCP_RESULTSA}
  GCP_RESULTSA = tagGCP_RESULTSA;
  {$EXTERNALSYM GCP_RESULTSW}
  GCP_RESULTSW = tagGCP_RESULTSW;
  {$EXTERNALSYM GCP_RESULTS}
  GCP_RESULTS = GCP_RESULTSA;

  PRasterizerStatus = ^TRasterizerStatus;
  {$EXTERNALSYM _RASTERIZER_STATUS}
  _RASTERIZER_STATUS = packed record
    nSize: SHORT;
    wFlags: SHORT;
    nLanguageID: SHORT;
  end;
  TRasterizerStatus = _RASTERIZER_STATUS;
  {$EXTERNALSYM RASTERIZER_STATUS}
  RASTERIZER_STATUS = _RASTERIZER_STATUS;

const
  { bits defined in wFlags of RASTERIZER_STATUS }
  {$EXTERNALSYM TT_AVAILABLE}
  TT_AVAILABLE = 1;
  {$EXTERNALSYM TT_ENABLED}
  TT_ENABLED = 2;

type
  { Pixel format descriptor }
  PPixelFormatDescriptor = ^TPixelFormatDescriptor;
  {$EXTERNALSYM tagPIXELFORMATDESCRIPTOR}
  tagPIXELFORMATDESCRIPTOR = packed record
    nSize: Word;
    nVersion: Word;
    dwFlags: DWORD;
    iPixelType: Byte;
    cColorBits: Byte;
    cRedBits: Byte;
    cRedShift: Byte;
    cGreenBits: Byte;
    cGreenShift: Byte;
    cBlueBits: Byte;
    cBlueShift: Byte;
    cAlphaBits: Byte;
    cAlphaShift: Byte;
    cAccumBits: Byte;
    cAccumRedBits: Byte;
    cAccumGreenBits: Byte;
    cAccumBlueBits: Byte;
    cAccumAlphaBits: Byte;
    cDepthBits: Byte;
    cStencilBits: Byte;
    cAuxBuffers: Byte;
    iLayerType: Byte;
    bReserved: Byte;
    dwLayerMask: DWORD;
    dwVisibleMask: DWORD;
    dwDamageMask: DWORD;
  end;
  TPixelFormatDescriptor = tagPIXELFORMATDESCRIPTOR;
  {$EXTERNALSYM PIXELFORMATDESCRIPTOR}
  PIXELFORMATDESCRIPTOR = tagPIXELFORMATDESCRIPTOR;

const
  { pixel types }
  {$EXTERNALSYM PFD_TYPE_RGBA}
  PFD_TYPE_RGBA = 0;
  {$EXTERNALSYM PFD_TYPE_COLORINDEX}
  PFD_TYPE_COLORINDEX = 1;

  { layer types }
  {$EXTERNALSYM PFD_MAIN_PLANE}
  PFD_MAIN_PLANE = 0;
  {$EXTERNALSYM PFD_OVERLAY_PLANE}
  PFD_OVERLAY_PLANE = 1;
  {$EXTERNALSYM PFD_UNDERLAY_PLANE}
  PFD_UNDERLAY_PLANE = LongWord(-1);

  { TPixelFormatDescriptor flags }
  {$EXTERNALSYM PFD_DOUBLEBUFFER}
  PFD_DOUBLEBUFFER                = $00000001;
  {$EXTERNALSYM PFD_STEREO}
  PFD_STEREO                      = $00000002;
  {$EXTERNALSYM PFD_DRAW_TO_WINDOW}
  PFD_DRAW_TO_WINDOW              = $00000004;
  {$EXTERNALSYM PFD_DRAW_TO_BITMAP}
  PFD_DRAW_TO_BITMAP              = $00000008;
  {$EXTERNALSYM PFD_SUPPORT_GDI}
  PFD_SUPPORT_GDI                 = $00000010;
  {$EXTERNALSYM PFD_SUPPORT_OPENGL}
  PFD_SUPPORT_OPENGL              = $00000020;
  {$EXTERNALSYM PFD_GENERIC_FORMAT}
  PFD_GENERIC_FORMAT              = $00000040;
  {$EXTERNALSYM PFD_NEED_PALETTE}
  PFD_NEED_PALETTE                = $00000080;
  {$EXTERNALSYM PFD_NEED_SYSTEM_PALETTE}
  PFD_NEED_SYSTEM_PALETTE         = $00000100;
  {$EXTERNALSYM PFD_SWAP_EXCHANGE}
  PFD_SWAP_EXCHANGE               = $00000200;
  {$EXTERNALSYM PFD_SWAP_COPY}
  PFD_SWAP_COPY                   = $00000400;
  {$EXTERNALSYM PFD_SWAP_LAYER_BUFFERS}
  PFD_SWAP_LAYER_BUFFERS          = $00000800;
  {$EXTERNALSYM PFD_GENERIC_ACCELERATED}
  PFD_GENERIC_ACCELERATED         = $00001000;

  { TPixelFormatDescriptor flags for use in ChoosePixelFormat only }
  {$EXTERNALSYM PFD_DEPTH_DONTCARE}
  PFD_DEPTH_DONTCARE              = $20000000;
  {$EXTERNALSYM PFD_DOUBLEBUFFER_DONTCARE}
  PFD_DOUBLEBUFFER_DONTCARE       = $40000000;
  {$EXTERNALSYM PFD_STEREO_DONTCARE}
  PFD_STEREO_DONTCARE             = DWORD($80000000);

type
  TFNOldFontEnumProcA = TFarProc;
  TFNOldFontEnumProcW = TFarProc;
  TFNOldFontEnumProc = TFNOldFontEnumProcA;
  TFNGObjEnumProc = TFarProc;
  TFNLineDDAProc = TFarProc;
  TFNFontEnumProcA = TFarProc;
  TFNFontEnumProcW = TFarProc;
  TFNFontEnumProc = TFNFontEnumProcA;



{$EXTERNALSYM AddFontResourceA}
function AddFontResourceA(p1: PAnsiChar): Integer; stdcall;
{$EXTERNALSYM AddFontResourceW}
function AddFontResourceW(p1: PWideChar): Integer; stdcall;
{$EXTERNALSYM AddFontResource}
function AddFontResource(p1: PChar): Integer; stdcall;
{$EXTERNALSYM AnimatePalette}
function AnimatePalette(p1: HPALETTE; p2, p3: UINT; p4: PPaletteEntry): BOOL; stdcall;
{$EXTERNALSYM Arc}
function Arc(hDC: HDC; left, top, right, bottom, startX, startY, endX, endY: Integer): BOOL; stdcall;
{$EXTERNALSYM BitBlt}
function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC;
  XSrc, YSrc: Integer; Rop: DWORD): BOOL; stdcall;
{$EXTERNALSYM CancelDC}
function CancelDC(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM Chord}
function Chord(DC: HDC; X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer): BOOL; stdcall;
{$EXTERNALSYM ChoosePixelFormat}
function ChoosePixelFormat(DC: HDC; p2: PPixelFormatDescriptor): Integer; stdcall;
{$EXTERNALSYM CloseMetaFile}
function CloseMetaFile(DC: HDC): HMETAFILE; stdcall;
{$EXTERNALSYM CombineRgn}
function CombineRgn(p1, p2, p3: HRGN; p4: Integer): Integer; stdcall;
{$EXTERNALSYM CopyMetaFileA}
function CopyMetaFileA(p1: HMETAFILE; p2: PAnsiChar): HMETAFILE; stdcall;
{$EXTERNALSYM CopyMetaFileW}
function CopyMetaFileW(p1: HMETAFILE; p2: PWideChar): HMETAFILE; stdcall;
{$EXTERNALSYM CopyMetaFile}
function CopyMetaFile(p1: HMETAFILE; p2: PChar): HMETAFILE; stdcall;
{$EXTERNALSYM CreateBitmap}
function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint;
  Bits: Pointer): HBITMAP; stdcall;
{$EXTERNALSYM CreateBitmapIndirect}
function CreateBitmapIndirect(const p1: TBitmap): HBITMAP; stdcall;
{$EXTERNALSYM CreateBrushIndirect}
function CreateBrushIndirect(const p1: TLogBrush): HBRUSH; stdcall;
{$EXTERNALSYM CreateCompatibleBitmap}
function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP; stdcall;
{$EXTERNALSYM CreateDiscardableBitmap}
function CreateDiscardableBitmap(DC: HDC; p2, p3: Integer): HBITMAP; stdcall;
{$EXTERNALSYM CreateCompatibleDC}
function CreateCompatibleDC(DC: HDC): HDC; stdcall;
{$EXTERNALSYM CreateDCA}
function CreateDCA(lpszDriver, lpszDevice, lpszOutput: PAnsiChar;
  lpdvmInit: PDeviceModeA): HDC; stdcall;
{$EXTERNALSYM CreateDCW}
function CreateDCW(lpszDriver, lpszDevice, lpszOutput: PWideChar;
  lpdvmInit: PDeviceModeW): HDC; stdcall;
{$EXTERNALSYM CreateDC}
function CreateDC(lpszDriver, lpszDevice, lpszOutput: PChar;
  lpdvmInit: PDeviceMode): HDC; stdcall;
{$EXTERNALSYM CreateDIBitmap}
function CreateDIBitmap(DC: HDC; var InfoHeader: TBitmapInfoHeader;
  dwUsage: DWORD; InitBits: PChar; var InitInfo: TBitmapInfo;
  wUsage: UINT): HBITMAP; stdcall;
{$EXTERNALSYM CreateDIBPatternBrush}
function CreateDIBPatternBrush(p1: HGLOBAL; p2: UINT): HBRUSH; stdcall;
{$EXTERNALSYM CreateDIBPatternBrushPt}
function CreateDIBPatternBrushPt(const p1: Pointer; p2: UINT): HBRUSH; stdcall;
{$EXTERNALSYM CreateEllipticRgn}
function CreateEllipticRgn(p1, p2, p3, p4: Integer): HRGN; stdcall;
{$EXTERNALSYM CreateEllipticRgnIndirect}
function CreateEllipticRgnIndirect(const p1: TRect): HRGN; stdcall;
{$EXTERNALSYM CreateFontIndirectA}
function CreateFontIndirectA(const p1: TLogFontA): HFONT; stdcall;
{$EXTERNALSYM CreateFontIndirectW}
function CreateFontIndirectW(const p1: TLogFontW): HFONT; stdcall;
{$EXTERNALSYM CreateFontIndirect}
function CreateFontIndirect(const p1: TLogFont): HFONT; stdcall;
{$EXTERNALSYM CreateFontA}
function CreateFontA(nHeight, nWidth, nEscapement, nOrientaion, fnWeight: Integer;
  fdwItalic, fdwUnderline, fdwStrikeOut, fdwCharSet, fdwOutputPrecision,
  fdwClipPrecision, fdwQuality, fdwPitchAndFamily: DWORD; lpszFace: PAnsiChar): HFONT; stdcall;
{$EXTERNALSYM CreateFontW}
function CreateFontW(nHeight, nWidth, nEscapement, nOrientaion, fnWeight: Integer;
  fdwItalic, fdwUnderline, fdwStrikeOut, fdwCharSet, fdwOutputPrecision,
  fdwClipPrecision, fdwQuality, fdwPitchAndFamily: DWORD; lpszFace: PWideChar): HFONT; stdcall;
{$EXTERNALSYM CreateFont}
function CreateFont(nHeight, nWidth, nEscapement, nOrientaion, fnWeight: Integer;
  fdwItalic, fdwUnderline, fdwStrikeOut, fdwCharSet, fdwOutputPrecision,
  fdwClipPrecision, fdwQuality, fdwPitchAndFamily: DWORD; lpszFace: PChar): HFONT; stdcall;
{$EXTERNALSYM CreateHatchBrush}
function CreateHatchBrush(p1: Integer; p2: COLORREF): HBRUSH; stdcall;
{$EXTERNALSYM CreateICA}
function CreateICA(lpszDriver, lpszDevice, lpszOutput: PAnsiChar; lpdvmInit: PDeviceModeA): HDC; stdcall;
{$EXTERNALSYM CreateICW}
function CreateICW(lpszDriver, lpszDevice, lpszOutput: PWideChar; lpdvmInit: PDeviceModeW): HDC; stdcall;
{$EXTERNALSYM CreateIC}
function CreateIC(lpszDriver, lpszDevice, lpszOutput: PChar; lpdvmInit: PDeviceMode): HDC; stdcall;
{$EXTERNALSYM CreateMetaFileA}
function CreateMetaFileA(p1: PAnsiChar): HDC; stdcall;
{$EXTERNALSYM CreateMetaFileW}
function CreateMetaFileW(p1: PWideChar): HDC; stdcall;
{$EXTERNALSYM CreateMetaFile}
function CreateMetaFile(p1: PChar): HDC; stdcall;
{$EXTERNALSYM CreatePalette}
function CreatePalette(const LogPalette: TLogPalette): HPalette; stdcall;
{$EXTERNALSYM CreatePen}
function CreatePen(Style, Width: Integer; Color: COLORREF): HPEN; stdcall;
{$EXTERNALSYM CreatePenIndirect}
function CreatePenIndirect(const LogPen: TLogPen): HPEN; stdcall;
{$EXTERNALSYM CreatePolyPolygonRgn}
function CreatePolyPolygonRgn(const pPtStructs; const pIntArray; p3, p4: Integer): HRGN; stdcall;
{$EXTERNALSYM CreatePatternBrush}
function CreatePatternBrush(Bitmap: HBITMAP): HBRUSH; stdcall;
{$EXTERNALSYM CreateRectRgn}
function CreateRectRgn(p1, p2, p3, p4: Integer): HRGN; stdcall;
{$EXTERNALSYM CreateRectRgnIndirect}
function CreateRectRgnIndirect(const p1: TRect): HRGN; stdcall;
{$EXTERNALSYM CreateRoundRectRgn}
function CreateRoundRectRgn(p1, p2, p3, p4, p5, p6: Integer): HRGN; stdcall;
{$EXTERNALSYM CreateScalableFontResourceA}
function CreateScalableFontResourceA(p1: DWORD; p2, p3, p4: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM CreateScalableFontResourceW}
function CreateScalableFontResourceW(p1: DWORD; p2, p3, p4: PWideChar): BOOL; stdcall;
{$EXTERNALSYM CreateScalableFontResource}
function CreateScalableFontResource(p1: DWORD; p2, p3, p4: PChar): BOOL; stdcall;
{$EXTERNALSYM CreateSolidBrush}
function CreateSolidBrush(p1: COLORREF): HBRUSH; stdcall;
{$EXTERNALSYM DeleteDC}
function DeleteDC(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM DeleteMetaFile}
function DeleteMetaFile(p1: HMETAFILE): BOOL; stdcall;
{$EXTERNALSYM DeleteObject}
function DeleteObject(p1: HGDIOBJ): BOOL; stdcall;
{$EXTERNALSYM DescribePixelFormat}
function DescribePixelFormat(DC: HDC; p2: Integer; p3: UINT; var p4: TPixelFormatDescriptor): BOOL; stdcall;

{ define types of pointers to ExtDeviceMode() and DeviceCapabilities()
  functions for Win 3.1 compatibility }

type
  TFNDevMode = TFarProc;

  TFNDevCaps = TFarProc;

const
  { mode selections for the device mode function }
  {$EXTERNALSYM DM_UPDATE}
  DM_UPDATE = 1;
  {$EXTERNALSYM DM_COPY}
  DM_COPY = 2;
  {$EXTERNALSYM DM_PROMPT}
  DM_PROMPT = 4;
  {$EXTERNALSYM DM_MODIFY}
  DM_MODIFY = 8;

  {$EXTERNALSYM DM_IN_BUFFER}
  DM_IN_BUFFER = DM_MODIFY;
  {$EXTERNALSYM DM_IN_PROMPT}
  DM_IN_PROMPT = DM_PROMPT;
  {$EXTERNALSYM DM_OUT_BUFFER}
  DM_OUT_BUFFER = DM_COPY;
  {$EXTERNALSYM DM_OUT_DEFAULT}
  DM_OUT_DEFAULT = DM_UPDATE;

  { device capabilities indices }
  {$EXTERNALSYM DC_FIELDS}
  DC_FIELDS = 1;
  {$EXTERNALSYM DC_PAPERS}
  DC_PAPERS = 2;
  {$EXTERNALSYM DC_PAPERSIZE}
  DC_PAPERSIZE = 3;
  {$EXTERNALSYM DC_MINEXTENT}
  DC_MINEXTENT = 4;
  {$EXTERNALSYM DC_MAXEXTENT}
  DC_MAXEXTENT = 5;
  {$EXTERNALSYM DC_BINS}
  DC_BINS = 6;
  {$EXTERNALSYM DC_DUPLEX}
  DC_DUPLEX = 7;
  {$EXTERNALSYM DC_SIZE}
  DC_SIZE = 8;
  {$EXTERNALSYM DC_EXTRA}
  DC_EXTRA = 9;
  {$EXTERNALSYM DC_VERSION}
  DC_VERSION = 10;
  {$EXTERNALSYM DC_DRIVER}
  DC_DRIVER = 11;
  {$EXTERNALSYM DC_BINNAMES}
  DC_BINNAMES = 12;
  {$EXTERNALSYM DC_ENUMRESOLUTIONS}
  DC_ENUMRESOLUTIONS = 13;
  {$EXTERNALSYM DC_FILEDEPENDENCIES}
  DC_FILEDEPENDENCIES = 14;
  {$EXTERNALSYM DC_TRUETYPE}
  DC_TRUETYPE = 15;
  {$EXTERNALSYM DC_PAPERNAMES}
  DC_PAPERNAMES = 16;
  {$EXTERNALSYM DC_ORIENTATION}
  DC_ORIENTATION = 17;
  {$EXTERNALSYM DC_COPIES}
  DC_COPIES = 18;
  {$EXTERNALSYM DC_BINADJUST}
  DC_BINADJUST = 19;
  {$EXTERNALSYM DC_EMF_COMPLIANT}
  DC_EMF_COMPLIANT = 20;
  {$EXTERNALSYM DC_DATATYPE_PRODUCED}
  DC_DATATYPE_PRODUCED = 21;
  {$EXTERNALSYM DC_COLLATE}
  DC_COLLATE = 22;
  {$EXTERNALSYM DC_MANUFACTURER}
  DC_MANUFACTURER = 23;
  {$EXTERNALSYM DC_MODEL}
  DC_MODEL = 24;
  {$EXTERNALSYM DC_COLORDEVICE}
  DC_COLORDEVICE = 23;
  {$EXTERNALSYM DC_NUP}
  DC_NUP = 24;
  {$EXTERNALSYM DC_PERSONALITY}
  DC_PERSONALITY = 25;
  {$EXTERNALSYM DC_PRINTRATE}
  DC_PRINTRATE = 26;
  {$EXTERNALSYM DC_PRINTRATEUNIT}
  DC_PRINTRATEUNIT = 27;
  {$EXTERNALSYM PRINTRATEUNIT_PPM}
  PRINTRATEUNIT_PPM = 1;
  {$EXTERNALSYM PRINTRATEUNIT_CPS}
  PRINTRATEUNIT_CPS = 2;
  {$EXTERNALSYM PRINTRATEUNIT_LPM}
  PRINTRATEUNIT_LPM = 3;
  {$EXTERNALSYM PRINTRATEUNIT_IPM}
  PRINTRATEUNIT_IPM = 4;
  {$EXTERNALSYM DC_PRINTERMEM}
  DC_PRINTERMEM = 28;
  {$EXTERNALSYM DC_MEDIAREADY}
  DC_MEDIAREADY = 29;


  { bit fields of the return value (DWORD) for DC_TRUETYPE }
  {$EXTERNALSYM DCTT_BITMAP}
  DCTT_BITMAP = 1;
  {$EXTERNALSYM DCTT_DOWNLOAD}
  DCTT_DOWNLOAD = 2;
  {$EXTERNALSYM DCTT_SUBDEV}
  DCTT_SUBDEV = 4;
  {$EXTERNALSYM DCTT_DOWNLOAD_OUTLINE}
  DCTT_DOWNLOAD_OUTLINE = 8;


  { return values for DC_BINADJUST }
  {$EXTERNALSYM DCBA_FACEUPNONE}
  DCBA_FACEUPNONE = 0;
  {$EXTERNALSYM DCBA_FACEUPCENTER}
  DCBA_FACEUPCENTER = 1;
  {$EXTERNALSYM DCBA_FACEUPLEFT}
  DCBA_FACEUPLEFT = 2;
  {$EXTERNALSYM DCBA_FACEUPRIGHT}
  DCBA_FACEUPRIGHT = 3;
  {$EXTERNALSYM DCBA_FACEDOWNNONE}
  DCBA_FACEDOWNNONE = $100;
  {$EXTERNALSYM DCBA_FACEDOWNCENTER}
  DCBA_FACEDOWNCENTER = 257;
  {$EXTERNALSYM DCBA_FACEDOWNLEFT}
  DCBA_FACEDOWNLEFT = 258;
  {$EXTERNALSYM DCBA_FACEDOWNRIGHT}
  DCBA_FACEDOWNRIGHT = 259;


{$EXTERNALSYM DeviceCapabilitiesA}
function DeviceCapabilitiesA(pDriverName, pDeviceName, pPort: PAnsiChar;
  iIndex: Integer; pOutput: PAnsiChar; DevMode: PDeviceModeA): Integer; stdcall;
{$EXTERNALSYM DeviceCapabilitiesW}
function DeviceCapabilitiesW(pDriverName, pDeviceName, pPort: PWideChar;
  iIndex: Integer; pOutput: PWideChar; DevMode: PDeviceModeW): Integer; stdcall;
{$EXTERNALSYM DeviceCapabilities}
function DeviceCapabilities(pDriverName, pDeviceName, pPort: PChar;
  iIndex: Integer; pOutput: PChar; DevMode: PDeviceMode): Integer; stdcall;

{$EXTERNALSYM DrawEscape}
function DrawEscape(DC: HDC; p2, p3: Integer; p4: LPCSTR): BOOL; stdcall;
{$EXTERNALSYM Ellipse}
function Ellipse(DC: HDC; X1, Y1, X2, Y2: Integer): BOOL; stdcall;
{$EXTERNALSYM EnumFontFamiliesExA}
function EnumFontFamiliesExA(DC: HDC; var p2: TLogFontA;
  p3: TFNFontEnumProcA; p4: LPARAM; p5: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumFontFamiliesExW}
function EnumFontFamiliesExW(DC: HDC; var p2: TLogFontW;
  p3: TFNFontEnumProcW; p4: LPARAM; p5: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumFontFamiliesEx}
function EnumFontFamiliesEx(DC: HDC; var p2: TLogFont;
  p3: TFNFontEnumProc; p4: LPARAM; p5: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumFontFamiliesA}
function EnumFontFamiliesA(DC: HDC; p2: PAnsiChar; p3: TFNFontEnumProcA; p4: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumFontFamiliesW}
function EnumFontFamiliesW(DC: HDC; p2: PWideChar; p3: TFNFontEnumProcW; p4: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumFontFamilies}
function EnumFontFamilies(DC: HDC; p2: PChar; p3: TFNFontEnumProc; p4: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumFontsA}
function EnumFontsA(DC: HDC; lpszFace: PAnsiChar; fntenmprc: TFNFontEnumProcA;
  lpszData: PChar): Integer; stdcall;
{$EXTERNALSYM EnumFontsW}
function EnumFontsW(DC: HDC; lpszFace: PWideChar; fntenmprc: TFNFontEnumProcW;
  lpszData: PChar): Integer; stdcall;
{$EXTERNALSYM EnumFonts}
function EnumFonts(DC: HDC; lpszFace: PChar; fntenmprc: TFNFontEnumProc;
  lpszData: PChar): Integer; stdcall;
{$EXTERNALSYM EnumObjects}
function EnumObjects(DC: HDC; p2: Integer; p3: TFNGObjEnumProc; p4: LPARAM): Integer; stdcall;
{$EXTERNALSYM EqualRgn}
function EqualRgn(p1, p2: HRGN): BOOL; stdcall;
{$EXTERNALSYM Escape}
function Escape(DC: HDC; p2, p3: Integer; p4: LPCSTR; p5: Pointer): Integer; stdcall;
{$EXTERNALSYM ExtEscape}
function ExtEscape(DC: HDC; p2, p3: Integer;
  const p4: LPCSTR; p5: Integer; p6: LPSTR): Integer; stdcall;
{$EXTERNALSYM ExcludeClipRect}
function ExcludeClipRect(DC: HDC; p2, p3, p4, p5: Integer): Integer; stdcall;
{$EXTERNALSYM ExtCreateRegion}
function ExtCreateRegion(p1: PXForm; p2: DWORD; const p3: TRgnData): HRGN; stdcall;
{$EXTERNALSYM ExtFloodFill}
function ExtFloodFill(DC: HDC; X, Y: Integer; Color: COLORREF; FillType: UINT): BOOL; stdcall;
{$EXTERNALSYM FillRgn}
function FillRgn(DC: HDC; p2: HRGN; p3: HBRUSH): BOOL; stdcall;
{$EXTERNALSYM FloodFill}
function FloodFill(DC: HDC; nXStart, nYStart: Integer; crFill: COLORREF): BOOL; stdcall;
{$EXTERNALSYM FrameRgn}
function FrameRgn(DC: HDC; p2: HRGN; p3: HBRUSH; p4, p5: Integer): BOOL; stdcall;
{$EXTERNALSYM GetROP2}
function GetROP2(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetAspectRatioFilterEx}
function GetAspectRatioFilterEx(DC: HDC; var p2: TSize): BOOL; stdcall;
{$EXTERNALSYM GetBkColor}
function GetBkColor(hDC: HDC): COLORREF; stdcall;
{$EXTERNALSYM GetDCBrushColor}
function GetDCBrushColor(DC: HDC): COLORREF; stdcall;
{$EXTERNALSYM GetDCPenColor}
function GetDCPenColor(DC: HDC): COLORREF; stdcall;
{$EXTERNALSYM GetBkMode}
function GetBkMode(hDC: HDC): Integer; stdcall;
{$EXTERNALSYM GetBitmapBits}
function GetBitmapBits(Bitmap: HBITMAP; Count: Longint;
  Bits: Pointer): Longint; stdcall;
{$EXTERNALSYM GetBitmapDimensionEx}
function GetBitmapDimensionEx(p1: HBITMAP; var p2: TSize): BOOL; stdcall;
{$EXTERNALSYM GetBoundsRect}
function GetBoundsRect(DC: HDC; var p2: TRect; p3: UINT): UINT; stdcall;
{$EXTERNALSYM GetBrushOrgEx}
function GetBrushOrgEx(DC: HDC; var p2: TPoint): BOOL; stdcall;
{$EXTERNALSYM GetCharWidthA}
function GetCharWidthA(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidthW}
function GetCharWidthW(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidth}
function GetCharWidth(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidth32A}
function GetCharWidth32A(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidth32W}
function GetCharWidth32W(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidth32}
function GetCharWidth32(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidthFloatA}
function GetCharWidthFloatA(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidthFloatW}
function GetCharWidthFloatW(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharWidthFloat}
function GetCharWidthFloat(DC: HDC; p2, p3: UINT; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharABCWidthsA}
function GetCharABCWidthsA(DC: HDC; p2, p3: UINT; const ABCStructs): BOOL; stdcall;
{$EXTERNALSYM GetCharABCWidthsW}
function GetCharABCWidthsW(DC: HDC; p2, p3: UINT; const ABCStructs): BOOL; stdcall;
{$EXTERNALSYM GetCharABCWidths}
function GetCharABCWidths(DC: HDC; p2, p3: UINT; const ABCStructs): BOOL; stdcall;
{$EXTERNALSYM GetCharABCWidthsFloatA}
function GetCharABCWidthsFloatA(DC: HDC; p2, p3: UINT; const ABCFloatSturcts): BOOL; stdcall;
{$EXTERNALSYM GetCharABCWidthsFloatW}
function GetCharABCWidthsFloatW(DC: HDC; p2, p3: UINT; const ABCFloatSturcts): BOOL; stdcall;
{$EXTERNALSYM GetCharABCWidthsFloat}
function GetCharABCWidthsFloat(DC: HDC; p2, p3: UINT; const ABCFloatSturcts): BOOL; stdcall;
{$EXTERNALSYM GetClipBox}
function GetClipBox(DC: HDC; var Rect: TRect): Integer; stdcall;
{$EXTERNALSYM GetClipRgn}
function GetClipRgn(DC: HDC; rgn: HRGN): Integer; stdcall;
{$EXTERNALSYM GetMetaRgn}
function GetMetaRgn(DC: HDC; rgn: HRGN): Integer; stdcall;
{$EXTERNALSYM GetCurrentObject}
function GetCurrentObject(DC: HDC; p2: UINT): HGDIOBJ; stdcall;
{$EXTERNALSYM GetCurrentPositionEx}
function GetCurrentPositionEx(DC: HDC; Point: PPoint): BOOL; stdcall;
{$EXTERNALSYM GetDeviceCaps}
function GetDeviceCaps(DC: HDC; Index: Integer): Integer; stdcall;
{$EXTERNALSYM GetDIBits}
function GetDIBits(DC: HDC; Bitmap: HBitmap; StartScan, NumScans: UINT;
  Bits: Pointer; var BitInfo: TBitmapInfo; Usage: UINT): Integer; stdcall;
{$EXTERNALSYM GetFontData}
function GetFontData(DC: HDC; p2, p3: DWORD; p4: Pointer; p5: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetGlyphOutlineA}
function GetGlyphOutlineA(DC: HDC; p2, p3: UINT;
  const p4: TGlyphMetrics; p5: DWORD; p6: Pointer; const p7: TMat2): DWORD; stdcall;
{$EXTERNALSYM GetGlyphOutlineW}
function GetGlyphOutlineW(DC: HDC; p2, p3: UINT;
  const p4: TGlyphMetrics; p5: DWORD; p6: Pointer; const p7: TMat2): DWORD; stdcall;
{$EXTERNALSYM GetGlyphOutline}
function GetGlyphOutline(DC: HDC; p2, p3: UINT;
  const p4: TGlyphMetrics; p5: DWORD; p6: Pointer; const p7: TMat2): DWORD; stdcall;
{$EXTERNALSYM GetGraphicsMode}
function GetGraphicsMode(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetMapMode}
function GetMapMode(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetMetaFileBitsEx}
function GetMetaFileBitsEx(p1: HMETAFILE; p2: UINT; p3: Pointer): UINT; stdcall;
{$EXTERNALSYM GetMetaFileA}
function GetMetaFileA(p1: PAnsiChar): HMETAFILE; stdcall;
{$EXTERNALSYM GetMetaFileW}
function GetMetaFileW(p1: PWideChar): HMETAFILE; stdcall;
{$EXTERNALSYM GetMetaFile}
function GetMetaFile(p1: PChar): HMETAFILE; stdcall;
{$EXTERNALSYM GetNearestColor}
function GetNearestColor(DC: HDC; p2: COLORREF): COLORREF; stdcall;
{$EXTERNALSYM GetNearestPaletteIndex}
function GetNearestPaletteIndex(p1: HPALETTE; p2: COLORREF): UINT; stdcall;
{$EXTERNALSYM GetObjectType}
function GetObjectType(h: HGDIOBJ): DWORD; stdcall;
{$EXTERNALSYM GetOutlineTextMetricsA}
function GetOutlineTextMetricsA(DC: HDC; p2: UINT; OTMetricStructs: Pointer): UINT; stdcall;
{$EXTERNALSYM GetOutlineTextMetricsW}
function GetOutlineTextMetricsW(DC: HDC; p2: UINT; OTMetricStructs: Pointer): UINT; stdcall;
{$EXTERNALSYM GetOutlineTextMetrics}
function GetOutlineTextMetrics(DC: HDC; p2: UINT; OTMetricStructs: Pointer): UINT; stdcall;
{$EXTERNALSYM GetPaletteEntries}
function GetPaletteEntries(Palette: HPALETTE; StartIndex, NumEntries: UINT;
  var PaletteEntries): UINT; stdcall;
{$EXTERNALSYM GetPixel}
function GetPixel(DC: HDC; X, Y: Integer): COLORREF; stdcall;
{$EXTERNALSYM GetPixelFormat}
function GetPixelFormat(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetPolyFillMode}
function GetPolyFillMode(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetRasterizerCaps}
function GetRasterizerCaps(var p1: TRasterizerStatus; p2: UINT): BOOL; stdcall;
{$EXTERNALSYM GetRegionData}
function GetRegionData(RGN: HRGN; p2: DWORD; p3: PRgnData): DWORD; stdcall;
{$EXTERNALSYM GetRgnBox}
function GetRgnBox(RGN: HRGN; var p2: TRect): Integer; stdcall;
{$EXTERNALSYM GetStockObject}
function GetStockObject(Index: Integer): HGDIOBJ; stdcall;
{$EXTERNALSYM GetStretchBltMode}
function GetStretchBltMode(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetSystemPaletteEntries}
function GetSystemPaletteEntries(DC: HDC; StartIndex, NumEntries: UINT;
  var PaletteEntries): UINT; stdcall;
{$EXTERNALSYM GetSystemPaletteUse}
function GetSystemPaletteUse(DC: HDC): UINT; stdcall;
{$EXTERNALSYM GetTextCharacterExtra}
function GetTextCharacterExtra(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetTextAlign}
function GetTextAlign(DC: HDC): UINT; stdcall;
{$EXTERNALSYM GetTextColor}
function GetTextColor(DC: HDC): COLORREF; stdcall;
{$EXTERNALSYM GetTextExtentPointA}
function GetTextExtentPointA(DC: HDC; Str: PAnsiChar; Count: Integer;
  var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentPointW}
function GetTextExtentPointW(DC: HDC; Str: PWideChar; Count: Integer;
  var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentPoint}
function GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer;
  var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentPoint32A}
function GetTextExtentPoint32A(DC: HDC; Str: PAnsiChar; Count: Integer;
  var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentPoint32W}
function GetTextExtentPoint32W(DC: HDC; Str: PWideChar; Count: Integer;
  var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentPoint32}
function GetTextExtentPoint32(DC: HDC; Str: PChar; Count: Integer;
  var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentExPointA}
function GetTextExtentExPointA(DC: HDC; p2: PAnsiChar;
  p3, p4: Integer; p5, p6: PInteger; var p7: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentExPointW}
function GetTextExtentExPointW(DC: HDC; p2: PWideChar;
  p3, p4: Integer; p5, p6: PInteger; var p7: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentExPoint}
function GetTextExtentExPoint(DC: HDC; p2: PChar;
  p3, p4: Integer; p5, p6: PInteger; var p7: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextCharset}
function GetTextCharset(hdc: HDC): Integer; stdcall;
{$EXTERNALSYM GetTextCharsetInfo}
function GetTextCharsetInfo(hdc: HDC; lpSig: PFontSignature; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM TranslateCharsetInfo}
function TranslateCharsetInfo(var lpSrc: DWORD; var lpCs: TCharsetInfo; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetFontLanguageInfo}
function GetFontLanguageInfo(DC: HDC): DWORD; stdcall;
{$EXTERNALSYM GetCharacterPlacementA}
function GetCharacterPlacementA(DC: HDC; p2: PAnsiChar; p3, p4: BOOL;
  var p5: TGCPResults; p6: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetCharacterPlacementW}
function GetCharacterPlacementW(DC: HDC; p2: PWideChar; p3, p4: BOOL;
  var p5: TGCPResults; p6: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetCharacterPlacement}
function GetCharacterPlacement(DC: HDC; p2: PChar; p3, p4: BOOL;
  var p5: TGCPResults; p6: DWORD): DWORD; stdcall;

type
  PWCRange = ^TWCRange;
  {$EXTERNALSYM tagWCRANGE}
  tagWCRANGE = packed record
    wcLow: WCHAR;
    cGlyphs: SHORT;
  end;
  TWCRange = tagWCRANGE;

  PGlyphSet = ^TGlyphSet;
  {$EXTERNALSYM tagGLYPHSET}
  tagGLYPHSET = packed record
    cbThis: DWORD;
    flAccel: DWORD;
    cGlyphsSupported: DWORD;
    cRanges: DWORD;
    ranges: array[0..0] of TWCRange;
  end;
  TGlyphSet = tagGLYPHSET;

const
  { flAccel flags for the TGlyphSet structure above }
  {$EXTERNALSYM GS_8BIT_INDICES}
  GS_8BIT_INDICES = 1;
  { flags for GetGlyphIndices }
  {$EXTERNALSYM GGI_MARK_NONEXISTING_GLYPHS}
  GGI_MARK_NONEXISTING_GLYPHS = 1;

{$EXTERNALSYM GetFontUnicodeRanges}
function GetFontUnicodeRanges(DC: HDC; lpgs: PGlyphSet): DWORD; stdcall;
{$EXTERNALSYM GetGlyphIndicesA}
function GetGlyphIndicesA(DC: HDC; p2: PAnsiChar; p3: Integer; p4: PWORD; p5: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetGlyphIndicesW}
function GetGlyphIndicesW(DC: HDC; p2: PAnsiChar; p3: Integer; p4: PWORD; p5: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetGlyphIndices}
function GetGlyphIndices(DC: HDC; p2: PAnsiChar; p3: Integer; p4: PWORD; p5: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetTextExtentPointI}
function GetTextExtentPointI(DC: HDC; p2: PWORD; p3: Integer; var p4: TSize): BOOL; stdcall;
{$EXTERNALSYM GetTextExtentExPointI}
function GetTextExtentExPointI(DC: HDC; p2: PWORD; p3, p4: Integer; p5, p6: PINT; var p7: TSize): BOOL; stdcall;
{$EXTERNALSYM GetCharWidthI}
function GetCharWidthI(DC: HDC; p2, p3: UINT; p4: PWORD; const Widths): BOOL; stdcall;
{$EXTERNALSYM GetCharABCWidthsI}
function GetCharABCWidthsI(DC: HDC; p2, p3: UINT; p4: PWORD; const Widths): BOOL; stdcall;

const
  {$EXTERNALSYM STAMP_DESIGNVECTOR}
  STAMP_DESIGNVECTOR = $80000000 + Ord('d') + (Ord('v') shl 8);
  {$EXTERNALSYM STAMP_AXESLIST}
  STAMP_AXESLIST = $80000000 + Ord('a') + (Ord('l') shl 8);
  {$EXTERNALSYM MM_MAX_NUMAXES}
  MM_MAX_NUMAXES = 16;

type
  PDesignVector = ^TDesignVector;
  {$EXTERNALSYM tagDESIGNVECTOR}
  tagDESIGNVECTOR = packed record
    dvReserved: DWORD;
    dvNumAxes: DWORD;
    dvValues: array[0..MM_MAX_NUMAXES-1] of Longint;
  end;
  TDesignVector = tagDESIGNVECTOR;

{$EXTERNALSYM AddFontResourceExA}
function AddFontResourceExA(p1: PAnsiChar; p2: DWORD; p3: PDesignVector): Integer; stdcall;
{$EXTERNALSYM AddFontResourceExW}
function AddFontResourceExW(p1: PAnsiChar; p2: DWORD; p3: PDesignVector): Integer; stdcall;
{$EXTERNALSYM AddFontResourceEx}
function AddFontResourceEx(p1: PAnsiChar; p2: DWORD; p3: PDesignVector): Integer; stdcall;
{$EXTERNALSYM RemoveFontResourceExA}
function RemoveFontResourceExA(p1: PAnsiChar; p2: DWORD; p3: PDesignVector): BOOL; stdcall;
{$EXTERNALSYM RemoveFontResourceExW}
function RemoveFontResourceExW(p1: PAnsiChar; p2: DWORD; p3: PDesignVector): BOOL; stdcall;
{$EXTERNALSYM RemoveFontResourceEx}
function RemoveFontResourceEx(p1: PAnsiChar; p2: DWORD; p3: PDesignVector): BOOL; stdcall;

{$EXTERNALSYM AddFontMemResourceEx}
function AddFontMemResourceEx(p1: Pointer; p2: DWORD; p3: PDesignVector; p4: LPDWORD): THandle; stdcall;
{$EXTERNALSYM RemoveFontMemResourceEx}
function RemoveFontMemResourceEx(p1: THandle): BOOL; stdcall;

const
  {$EXTERNALSYM FR_PRIVATE}
  FR_PRIVATE = $10;
  {$EXTERNALSYM FR_NOT_ENUM}
  FR_NOT_ENUM = $20;
  {$EXTERNALSYM MM_MAX_AXES_NAMELEN}
  MM_MAX_AXES_NAMELEN = 16;

type
  PAxisInfoA = ^TAxisInfoA;
  {$EXTERNALSYM tagAXISINFOA}
  tagAXISINFOA = packed record
    axMinValue: Longint;
    axMaxValue: Longint;
    axAxisName: array[0..MM_MAX_AXES_NAMELEN-1] of AnsiChar;
  end;
  TAxisInfoA = tagAXISINFOA;
  PAxisInfoW = ^TAxisInfoW;
  {$EXTERNALSYM tagAXISINFOW}
  tagAXISINFOW = packed record
    axMinValue: Longint;
    axMaxValue: Longint;
    axAxisName: array[0..MM_MAX_AXES_NAMELEN-1] of WideChar;
  end;
  TAxisInfoW = tagAXISINFOW;
  PAxisInfo = PAxisInfoA;

  PAxesListA = ^TAxesListA;
  {$EXTERNALSYM tagAXESLISTA}
  tagAXESLISTA = packed record
    axlReserved: DWORD;
    axlNumAxes: DWORD;
    axlAxisInfo: array[0..MM_MAX_NUMAXES-1] of TAxisInfoA;
  end;
  TAxesListA = tagAXESLISTA;
  PAxesListW = ^TAxesListW;
  {$EXTERNALSYM tagAXESLISTW}
  tagAXESLISTW = packed record
    axlReserved: DWORD;
    axlNumAxes: DWORD;
    axlAxisInfo: array[0..MM_MAX_NUMAXES-1] of TAxisInfoW;
  end;
  TAxesListW = tagAXESLISTW;
  PAxesList = PAxesListA;

  PEnumLogFontExDVA = ^TEnumLogFontExDVA;
  {$EXTERNALSYM tagENUMLOGFONTEXDVA}
  tagENUMLOGFONTEXDVA = packed record
    elfEnumLogfontEx: TEnumLogFontExA;
    elfDesignVector: TDesignVector;
  end;
  TEnumLogFontExDVA = tagENUMLOGFONTEXDVA;
  PEnumLogFontExDVW = ^TEnumLogFontExDVW;
  {$EXTERNALSYM tagENUMLOGFONTEXDVW}
  tagENUMLOGFONTEXDVW = packed record
    elfEnumLogfontEx: TEnumLogFontExW;
    elfDesignVector: TDesignVector;
  end;
  TEnumLogFontExDVW = tagENUMLOGFONTEXDVW;
  PEnumLogFontExDV = PEnumLogFontExDVA;

function CreateFontIndirectExA(const p1: PEnumLogFontExDVA): HFONT; stdcall;
function CreateFontIndirectExW(const p1: PEnumLogFontExDVW): HFONT; stdcall;
function CreateFontIndirectEx(const p1: PEnumLogFontExDV): HFONT; stdcall;

type
  PEnumTextMetricA = ^TEnumTextMetricA;
  {$EXTERNALSYM tagENUMTEXTMETRICA}
  tagENUMTEXTMETRICA = packed record
    etmNewTextMetricEx: TNewTextMetricExA;
    etmAxesList: TAxesListA;
  end;
  TEnumTextMetricA = tagENUMTEXTMETRICA;
  PEnumTextMetricW = ^TEnumTextMetricW;
  {$EXTERNALSYM tagENUMTEXTMETRICW}
  tagENUMTEXTMETRICW = packed record
    etmNewTextMetricEx: TNewTextMetricExW;
    etmAxesList: TAxesListW;
  end;
  TEnumTextMetricW = tagENUMTEXTMETRICW;
  PEnumTextMetric = PEnumTextMetricA;

{$EXTERNALSYM GetViewportExtEx}
function GetViewportExtEx(DC: HDC; var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetViewportOrgEx}
function GetViewportOrgEx(DC: HDC; var Point: TPoint): BOOL; stdcall;
{$EXTERNALSYM GetWindowExtEx}
function GetWindowExtEx(DC: HDC; var Size: TSize): BOOL; stdcall;
{$EXTERNALSYM GetWindowOrgEx}
function GetWindowOrgEx(DC: HDC; var Point: TPoint): BOOL; stdcall;
{$EXTERNALSYM IntersectClipRect}
function IntersectClipRect(DC: HDC; X1, Y1, X2, Y2: Integer): Integer; stdcall;
{$EXTERNALSYM InvertRgn}
function InvertRgn(DC: HDC; p2: HRGN): BOOL; stdcall;
{$EXTERNALSYM LineDDA}
function LineDDA(p1, p2, p3, p4: Integer; p5: TFNLineDDAProc; p6: LPARAM): BOOL; stdcall;
{$EXTERNALSYM LineTo}
function LineTo(DC: HDC; X, Y: Integer): BOOL; stdcall;
{$EXTERNALSYM MaskBlt}
function MaskBlt(DC: HDC; p2, p3, p4, p5: Integer; p6: HDC;
  p7, p8: Integer; p9: HBITMAP; p10, p11: Integer; p12: DWORD): BOOL; stdcall;
{$EXTERNALSYM PlgBlt}
function PlgBlt(DC: HDC; const PointsArray; p3: HDC;
  p4, p5, p6, p7: Integer; p8: HBITMAP; p9, p10: Integer): BOOL; stdcall;
{$EXTERNALSYM OffsetClipRgn}
function OffsetClipRgn(DC: HDC; p2, p3: Integer): Integer; stdcall;
{$EXTERNALSYM OffsetRgn}
function OffsetRgn(RGN: HRGN; p2, p3: Integer): Integer; stdcall;
{$EXTERNALSYM PatBlt}
function PatBlt(DC: HDC; X, Y, Width, Height: Integer; Rop: DWORD): BOOL; stdcall;
{$EXTERNALSYM Pie}
function Pie(DC: HDC; X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer): BOOL; stdcall;
{$EXTERNALSYM PlayMetaFile}
function PlayMetaFile(DC: HDC; MF: HMETAFILE): BOOL; stdcall;
{$EXTERNALSYM PaintRgn}
function PaintRgn(DC: HDC; RGN: HRGN): BOOL; stdcall;
{$EXTERNALSYM PolyPolygon}
function PolyPolygon(DC: HDC; var Points; var nPoints; p4: Integer): BOOL; stdcall;
{$EXTERNALSYM PtInRegion}
function PtInRegion(RGN: HRGN; p2, p3: Integer): BOOL; stdcall;
{$EXTERNALSYM PtVisible}
function PtVisible(DC: HDC; p2, p3: Integer): BOOL; stdcall;
{$EXTERNALSYM RectInRegion}
function RectInRegion(RGN: HRGN; const p2: TRect): BOOL; stdcall;
{$EXTERNALSYM RectVisible}
function RectVisible(DC: HDC; const Rect: TRect): BOOL; stdcall;
{$EXTERNALSYM Rectangle}
function Rectangle(DC: HDC; X1, Y1, X2, Y2: Integer): BOOL; stdcall;
{$EXTERNALSYM RestoreDC}
function RestoreDC(DC: HDC; SavedDC: Integer): BOOL; stdcall;
{$EXTERNALSYM ResetDCA}
function ResetDCA(DC: HDC; const p2: TDeviceModeA): HDC; stdcall;
{$EXTERNALSYM ResetDCW}
function ResetDCW(DC: HDC; const p2: TDeviceModeW): HDC; stdcall;
{$EXTERNALSYM ResetDC}
function ResetDC(DC: HDC; const p2: TDeviceMode): HDC; stdcall;
{$EXTERNALSYM RealizePalette}
function RealizePalette(DC: HDC): UINT; stdcall;
{$EXTERNALSYM RemoveFontResourceA}
function RemoveFontResourceA(p1: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM RemoveFontResourceW}
function RemoveFontResourceW(p1: PWideChar): BOOL; stdcall;
{$EXTERNALSYM RemoveFontResource}
function RemoveFontResource(p1: PChar): BOOL; stdcall;
{$EXTERNALSYM RoundRect}
function RoundRect(DC: HDC; X1, Y1, X2, Y2, X3, Y3: Integer): BOOL; stdcall;
{$EXTERNALSYM ResizePalette}
function ResizePalette(p1: HPALETTE; p2: UINT): BOOL; stdcall;
{$EXTERNALSYM SaveDC}
function SaveDC(DC: HDC): Integer; stdcall;
{$EXTERNALSYM SelectClipRgn}
function SelectClipRgn(DC: HDC; p2: HRGN): Integer; stdcall;
{$EXTERNALSYM ExtSelectClipRgn}
function ExtSelectClipRgn(DC: HDC; p2: HRGN; p3: Integer): Integer; stdcall;
{$EXTERNALSYM SetMetaRgn}
function SetMetaRgn(DC: HDC): Integer; stdcall;
{$EXTERNALSYM SelectObject}
function SelectObject(DC: HDC; p2: HGDIOBJ): HGDIOBJ; stdcall;
{$EXTERNALSYM SelectPalette}
function SelectPalette(DC: HDC; Palette: HPALETTE;
  ForceBackground: Bool): HPALETTE; stdcall;
{$EXTERNALSYM SetBkColor}
function SetBkColor(DC: HDC; Color: COLORREF): COLORREF; stdcall;
{$EXTERNALSYM SetDCBrushColor}
function SetDCBrushColor(DC: HDC; Color: COLORREF): COLORREF; stdcall;
{$EXTERNALSYM SetDCPenColor}
function SetDCPenColor(DC: HDC; Color: COLORREF): COLORREF; stdcall;
{$EXTERNALSYM SetBkMode}
function SetBkMode(DC: HDC; BkMode: Integer): Integer; stdcall;
{$EXTERNALSYM SetBitmapBits}
function SetBitmapBits(p1: HBITMAP; p2: DWORD; bits: Pointer): Longint; stdcall;
{$EXTERNALSYM SetBoundsRect}
function SetBoundsRect(DC: HDC; p2: PRect; p3: UINT): UINT; stdcall;
{$EXTERNALSYM SetDIBits}
function SetDIBits(DC: HDC; Bitmap: HBITMAP; StartScan, NumScans: UINT;
  Bits: Pointer; var BitsInfo: TBitmapInfo; Usage: UINT): Integer; stdcall;
{$EXTERNALSYM SetDIBitsToDevice}
function SetDIBitsToDevice(DC: HDC; DestX, DestY: Integer; Width, Height: DWORD;
  SrcX, SrcY: Integer; nStartScan, NumScans: UINT; Bits: Pointer;
  var BitsInfo: TBitmapInfo; Usage: UINT): Integer; stdcall;
{$EXTERNALSYM SetMapperFlags}
function SetMapperFlags(DC: HDC; Flag: DWORD): DWORD; stdcall;
{$EXTERNALSYM SetGraphicsMode}
function SetGraphicsMode(hdc: HDC; iMode: Integer): Integer; stdcall;
{$EXTERNALSYM SetMapMode}
function SetMapMode(DC: HDC; p2: Integer): Integer; stdcall;
{$EXTERNALSYM SetMetaFileBitsEx}
function SetMetaFileBitsEx(p1: UINT; const p2: PChar): HMETAFILE; stdcall;
{$EXTERNALSYM SetPaletteEntries}
function SetPaletteEntries(Palette: HPALETTE; StartIndex, NumEntries: UINT;
  var PaletteEntries): UINT; stdcall;
{$EXTERNALSYM SetPixel}
function SetPixel(DC: HDC; X, Y: Integer; Color: COLORREF): COLORREF; stdcall;
{$EXTERNALSYM SetPixelV}
function SetPixelV(DC: HDC; X, Y: Integer; Color: COLORREF): BOOL; stdcall;
{$EXTERNALSYM SetPixelFormat}
function SetPixelFormat(DC: HDC; p2: Integer; p3: PPixelFormatDescriptor): BOOL; stdcall;
{$EXTERNALSYM SetPolyFillMode}
function SetPolyFillMode(DC: HDC; PolyFillMode: Integer): Integer; stdcall;
{$EXTERNALSYM StretchBlt}
function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC;
  XSrc, YSrc, SrcWidth, SrcHeight: Integer; Rop: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetRectRgn}
function SetRectRgn(Rgn: HRgn; X1, Y1, X2, Y2: Integer): BOOL; stdcall;
{$EXTERNALSYM StretchDIBits}
function StretchDIBits(DC: HDC; DestX, DestY, DestWidth, DestHegiht, SrcX,
  SrcY, SrcWidth, SrcHeight: Integer; Bits: Pointer; var BitsInfo: TBitmapInfo;
  Usage: UINT; Rop: DWORD): Integer; stdcall;
{$EXTERNALSYM SetROP2}
function SetROP2(DC: HDC; p2: Integer): Integer; stdcall;
{$EXTERNALSYM SetStretchBltMode}
function SetStretchBltMode(DC: HDC; p2: Integer): Integer; stdcall;
{$EXTERNALSYM SetSystemPaletteUse}
function SetSystemPaletteUse(DC: HDC; p2: UINT): UINT; stdcall;
{$EXTERNALSYM SetTextCharacterExtra}
function SetTextCharacterExtra(DC: HDC; CharExtra: Integer): Integer; stdcall;
{$EXTERNALSYM SetTextColor}
function SetTextColor(DC: HDC; Color: COLORREF): COLORREF; stdcall;
{$EXTERNALSYM SetTextAlign}
function SetTextAlign(DC: HDC; Flags: UINT): UINT; stdcall;
{$EXTERNALSYM SetTextJustification}
function SetTextJustification(DC: HDC; BreakExtra, BreakCount: Integer): Integer; stdcall;
{$EXTERNALSYM UpdateColors}
function UpdateColors(DC: HDC): BOOL; stdcall;

type
  {$EXTERNALSYM COLOR16}
  COLOR16 = Shortint;

  PTriVertex = ^TTriVertex;
  {$EXTERNALSYM _TRIVERTEX}
  _TRIVERTEX = packed record
    x: Longint;
    y: Longint;
    Red: COLOR16;
    Green: COLOR16;
    Blue: COLOR16;
    Alpha: COLOR16;
  end;
  TTriVertex = _TRIVERTEX;
  {$EXTERNALSYM TRIVERTEX}
  TRIVERTEX = _TRIVERTEX;

  PGradientTriangle = ^TGradientTriangle;
  {$EXTERNALSYM _GRADIENT_TRIANGLE}
  _GRADIENT_TRIANGLE = packed record
    Vertex1: ULONG;
    Vertex2: ULONG;
    Vertex3: ULONG;
  end;
  TGradientTriangle = _GRADIENT_TRIANGLE;
  {$EXTERNALSYM GRADIENT_TRIANGLE}
  GRADIENT_TRIANGLE = _GRADIENT_TRIANGLE;

  PGradientRect = ^TGradientRect;
  {$EXTERNALSYM _GRADIENT_RECT}
  _GRADIENT_RECT = packed record
    UpperLeft: ULONG;
    LowerRight: ULONG;
  end;
  TGradientRect = _GRADIENT_RECT;
  {$EXTERNALSYM GRADIENT_RECT}
  GRADIENT_RECT = _GRADIENT_RECT;

  PBlendFunction = ^TBlendFunction;
  {$EXTERNALSYM _BLENDFUNCTION}
  _BLENDFUNCTION = packed record
    BlendOp: BYTE;
    BlendFlags: BYTE;
    SourceConstantAlpha: BYTE;
    AlphaFormat: BYTE;
  end;
  TBlendFunction = _BLENDFUNCTION;
  {$EXTERNALSYM BLENDFUNCTION}
  BLENDFUNCTION = _BLENDFUNCTION;

const
  { currentlly defined blend function }
  {$EXTERNALSYM AC_SRC_OVER}
  AC_SRC_OVER = $00;

  { alpha format flags }
  {$EXTERNALSYM AC_SRC_NO_PREMULT_ALPHA}
  AC_SRC_NO_PREMULT_ALPHA = $01;
  {$EXTERNALSYM AC_SRC_NO_ALPHA}
  AC_SRC_NO_ALPHA = $02;
  {$EXTERNALSYM AC_DST_NO_PREMULT_ALPHA} 
  AC_DST_NO_PREMULT_ALPHA = $10;
  {$EXTERNALSYM AC_DST_NO_ALPHA}
  AC_DST_NO_ALPHA = $20;

{$EXTERNALSYM AlphaBlend}
function AlphaBlend(DC: HDC; p2, p3, p4, p5: Integer; DC6: HDC; p7, p8, p9, p10: Integer; p11: TBlendFunction): BOOL; stdcall;
{$EXTERNALSYM AlphaDIBBlend}
function AlphaDIBBlend(DC: HDC; p2, p3, p4, p5: Integer; const p6: Pointer;
        const p7: PBitmapInfo; p8: UINT; p9, p10, p11, p12: Integer; p13: TBlendFunction): BOOL; stdcall;
{$EXTERNALSYM TransparentBlt}
function TransparentBlt(DC: HDC; p2, p3, p4, p5: Integer; DC6: HDC; p7, p8, p9, p10: Integer; p11: UINT): BOOL; stdcall;
{$EXTERNALSYM TransparentDIBits}
function TransparentDIBits(DC: HDC; p2, p3, p4, p5: Integer; const p6: Pointer;
        const p7: PBitmapInfo; p8: UINT; p9, p10, p11, p12: Integer; p13: UINT): BOOL; stdcall;

const
  { gradient drawing modes }
  {$EXTERNALSYM GRADIENT_FILL_RECT_H}
  GRADIENT_FILL_RECT_H = $00000000;
  {$EXTERNALSYM GRADIENT_FILL_RECT_V}
  GRADIENT_FILL_RECT_V = $00000001;
  {$EXTERNALSYM GRADIENT_FILL_TRIANGLE}
   GRADIENT_FILL_TRIANGLE = $00000002;
  {$EXTERNALSYM GRADIENT_FILL_OP_FLAG}
  GRADIENT_FILL_OP_FLAG = $000000ff;

{$EXTERNALSYM GradientFill}
function GradientFill(DC: HDC; var p2: TTriVertex; p3: ULONG; p4: Pointer; p5, p6: ULONG): BOOL; stdcall;

{$EXTERNALSYM PlayMetaFileRecord}
function PlayMetaFileRecord(DC: HDC; const p2: THandleTable; const p3: TMetaRecord; p4: UINT): BOOL; stdcall;

type
  TFNMFEnumProc = TFarProc;
  TFNEnhMFEnumProc = TFarProc;

{$EXTERNALSYM EnumMetaFile}
function EnumMetaFile(DC: HDC; p2: HMETAFILE; p3: TFNMFEnumProc; p4: LPARAM): BOOL; stdcall;

{ Enhanced Metafile Function Declarations }

{$EXTERNALSYM CloseEnhMetaFile}
function CloseEnhMetaFile(DC: HDC): HENHMETAFILE; stdcall;
{$EXTERNALSYM CopyEnhMetaFileA}
function CopyEnhMetaFileA(p1: HENHMETAFILE; p2: PAnsiChar): HENHMETAFILE; stdcall;
{$EXTERNALSYM CopyEnhMetaFileW}
function CopyEnhMetaFileW(p1: HENHMETAFILE; p2: PWideChar): HENHMETAFILE; stdcall;
{$EXTERNALSYM CopyEnhMetaFile}
function CopyEnhMetaFile(p1: HENHMETAFILE; p2: PChar): HENHMETAFILE; stdcall;
{$EXTERNALSYM CreateEnhMetaFileA}
function CreateEnhMetaFileA(DC: HDC; p2: PAnsiChar; p3: PRect; p4: PAnsiChar): HDC; stdcall;
{$EXTERNALSYM CreateEnhMetaFileW}
function CreateEnhMetaFileW(DC: HDC; p2: PWideChar; p3: PRect; p4: PWideChar): HDC; stdcall;
{$EXTERNALSYM CreateEnhMetaFile}
function CreateEnhMetaFile(DC: HDC; p2: PChar; p3: PRect; p4: PChar): HDC; stdcall;
{$EXTERNALSYM DeleteEnhMetaFile}
function DeleteEnhMetaFile(p1: HENHMETAFILE): BOOL; stdcall;
{$EXTERNALSYM EnumEnhMetaFile}
function EnumEnhMetaFile(DC: HDC; p2: HENHMETAFILE; p3: TFNEnhMFEnumProc; p4: Pointer; const p5: TRect): BOOL; stdcall;
{$EXTERNALSYM GetEnhMetaFileA}
function GetEnhMetaFileA(p1: PAnsiChar): HENHMETAFILE; stdcall;
{$EXTERNALSYM GetEnhMetaFileW}
function GetEnhMetaFileW(p1: PWideChar): HENHMETAFILE; stdcall;
{$EXTERNALSYM GetEnhMetaFile}
function GetEnhMetaFile(p1: PChar): HENHMETAFILE; stdcall;
{$EXTERNALSYM GetEnhMetaFileBits}
function GetEnhMetaFileBits(p1: HENHMETAFILE; p2: UINT; p3: PByte): UINT; stdcall;
{$EXTERNALSYM GetEnhMetaFileDescriptionA}
function GetEnhMetaFileDescriptionA(p1: HENHMETAFILE; p2: UINT; p3: PAnsiChar): UINT; stdcall;
{$EXTERNALSYM GetEnhMetaFileDescriptionW}
function GetEnhMetaFileDescriptionW(p1: HENHMETAFILE; p2: UINT; p3: PWideChar): UINT; stdcall;
{$EXTERNALSYM GetEnhMetaFileDescription}
function GetEnhMetaFileDescription(p1: HENHMETAFILE; p2: UINT; p3: PChar): UINT; stdcall;
{$EXTERNALSYM GetEnhMetaFileHeader}
function GetEnhMetaFileHeader(p1: HENHMETAFILE; p2: UINT; p3: PEnhMetaHeader): UINT; stdcall;
{$EXTERNALSYM GetEnhMetaFilePaletteEntries}
function GetEnhMetaFilePaletteEntries(p1: HENHMETAFILE; p2: UINT; p3: Pointer): UINT; stdcall;
{$EXTERNALSYM GetEnhMetaFilePixelFormat}
function GetEnhMetaFilePixelFormat(p1: HENHMETAFILE; p2: Cardinal;
  var p3: TPixelFormatDescriptor): UINT; stdcall;
{$EXTERNALSYM GetWinMetaFileBits}
function GetWinMetaFileBits(p1: HENHMETAFILE; p2: UINT; p3: PByte;
  p4: Integer; p5: HDC): UINT; stdcall;
{$EXTERNALSYM PlayEnhMetaFile}
function PlayEnhMetaFile(DC: HDC; p2: HENHMETAFILE; const p3: TRect): BOOL; stdcall;
{$EXTERNALSYM PlayEnhMetaFileRecord}
function PlayEnhMetaFileRecord(DC: HDC; var p2: THandleTable;
  const p3: TEnhMetaRecord; p4: UINT): BOOL; stdcall;
{$EXTERNALSYM SetEnhMetaFileBits}
function SetEnhMetaFileBits(p1: UINT; p2: PChar): HENHMETAFILE; stdcall;
{$EXTERNALSYM SetWinMetaFileBits}
function SetWinMetaFileBits(p1: UINT; p2: PChar; p3: HDC;
  const p4: TMetaFilePict): HENHMETAFILE; stdcall;
{$EXTERNALSYM GdiComment}
function GdiComment(DC: HDC; p2: UINT; p3: PChar): BOOL; stdcall;
{$EXTERNALSYM GetTextMetricsA}
function GetTextMetricsA(DC: HDC; var TM: TTextMetricA): BOOL; stdcall;
{$EXTERNALSYM GetTextMetricsW}
function GetTextMetricsW(DC: HDC; var TM: TTextMetricW): BOOL; stdcall;
{$EXTERNALSYM GetTextMetrics}
function GetTextMetrics(DC: HDC; var TM: TTextMetric): BOOL; stdcall;

{ new GDI }

type
  PDIBSection = ^TDIBSection;
  {$EXTERNALSYM tagDIBSECTION}
  tagDIBSECTION = packed record
    dsBm: TBitmap;
    dsBmih: TBitmapInfoHeader;
    dsBitfields: array[0..2] of DWORD;
    dshSection: THandle;
    dsOffset: DWORD;
  end;
  TDIBSection = tagDIBSECTION;
  {$EXTERNALSYM DIBSECTION}
  DIBSECTION = tagDIBSECTION;

{$EXTERNALSYM AngleArc}
function AngleArc(DC: HDC; p2, p3: Integer; p4: DWORD; p5, p6: Single): BOOL; stdcall;
{$EXTERNALSYM PolyPolyline}
function PolyPolyline(DC: HDC; const PointStructs; const Points; p4: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetWorldTransform}
function GetWorldTransform(DC: HDC; var p2: TXForm): BOOL; stdcall;
{$EXTERNALSYM SetWorldTransform}
function SetWorldTransform(DC: HDC; const p2: TXForm): BOOL; stdcall;
{$EXTERNALSYM ModifyWorldTransform}
function ModifyWorldTransform(DC: HDC; const p2: TXForm; p3: DWORD): BOOL; stdcall;
{$EXTERNALSYM CombineTransform}
function CombineTransform(var p1: TXForm; const p2, p3: TXForm): BOOL; stdcall;
{$EXTERNALSYM CreateDIBSection}
function CreateDIBSection(DC: HDC; const p2: TBitmapInfo; p3: UINT;
  var p4: Pointer; p5: THandle; p6: DWORD): HBITMAP; stdcall;
{$EXTERNALSYM GetDIBColorTable}
function GetDIBColorTable(DC: HDC; p2, p3: UINT; var RGBQuadStructs): UINT; stdcall;
{$EXTERNALSYM SetDIBColorTable}
function SetDIBColorTable(DC: HDC; p2, p3: UINT; var RGBQuadSTructs): UINT; stdcall;

const
  { Flags value for COLORADJUSTMENT }
  {$EXTERNALSYM CA_NEGATIVE}
  CA_NEGATIVE = 1;
  {$EXTERNALSYM CA_LOG_FILTER}
  CA_LOG_FILTER = 2;

  { IlluminantIndex values }
  {$EXTERNALSYM ILLUMINANT_DEVICE_DEFAULT}
  ILLUMINANT_DEVICE_DEFAULT = 0;
  {$EXTERNALSYM ILLUMINANT_A}
  ILLUMINANT_A = 1;
  {$EXTERNALSYM ILLUMINANT_B}
  ILLUMINANT_B = 2;
  {$EXTERNALSYM ILLUMINANT_C}
  ILLUMINANT_C = 3;
  {$EXTERNALSYM ILLUMINANT_D50}
  ILLUMINANT_D50 = 4;
  {$EXTERNALSYM ILLUMINANT_D55}
  ILLUMINANT_D55 = 5;
  {$EXTERNALSYM ILLUMINANT_D65}
  ILLUMINANT_D65 = 6;
  {$EXTERNALSYM ILLUMINANT_D75}
  ILLUMINANT_D75 = 7;
  {$EXTERNALSYM ILLUMINANT_F2}
  ILLUMINANT_F2 = 8;

  {$EXTERNALSYM ILLUMINANT_MAX_INDEX}
  ILLUMINANT_MAX_INDEX = ILLUMINANT_F2;
  {$EXTERNALSYM ILLUMINANT_TUNGSTEN}
  ILLUMINANT_TUNGSTEN = ILLUMINANT_A;
  {$EXTERNALSYM ILLUMINANT_DAYLIGHT}
  ILLUMINANT_DAYLIGHT = ILLUMINANT_C;
  {$EXTERNALSYM ILLUMINANT_FLUORESCENT}
  ILLUMINANT_FLUORESCENT = ILLUMINANT_F2;
  {$EXTERNALSYM ILLUMINANT_NTSC}
  ILLUMINANT_NTSC = ILLUMINANT_C;

  { Min and max for RedGamma, GreenGamma, BlueGamma }
  {$EXTERNALSYM RGB_GAMMA_MIN}
  RGB_GAMMA_MIN = 02500;
  {$EXTERNALSYM RGB_GAMMA_MAX}
  RGB_GAMMA_MAX = 65000;

  { Min and max for ReferenceBlack and ReferenceWhite }
  {$EXTERNALSYM REFERENCE_WHITE_MIN}
  REFERENCE_WHITE_MIN = 6000;
  {$EXTERNALSYM REFERENCE_WHITE_MAX}
  REFERENCE_WHITE_MAX = 10000;
  {$EXTERNALSYM REFERENCE_BLACK_MIN}
  REFERENCE_BLACK_MIN = 0;
  {$EXTERNALSYM REFERENCE_BLACK_MAX}
  REFERENCE_BLACK_MAX = 4000;

  { Min and max for Contrast, Brightness, Colorfulness, RedGreenTint }
  {$EXTERNALSYM COLOR_ADJ_MIN}
  COLOR_ADJ_MIN = -100;
  {$EXTERNALSYM COLOR_ADJ_MAX}
  COLOR_ADJ_MAX = 100;

type
  PColorAdjustment = ^TColorAdjustment;
  {$EXTERNALSYM tagCOLORADJUSTMENT}
  tagCOLORADJUSTMENT = packed record
    caSize: Word;
    caFlags: Word;
    caIlluminantIndex: Word;
    caRedGamma: Word;
    caGreenGamma: Word;
    caBlueGamma: Word;
    caReferenceBlack: Word;
    caReferenceWhite: Word;
    caContrast: SHORT;
    caBrightness: SHORT;
    caColorfulness: SHORT;
    caRedGreenTint: SHORT;
  end;
  TColorAdjustment = tagCOLORADJUSTMENT;
  {$EXTERNALSYM COLORADJUSTMENT}
  COLORADJUSTMENT = tagCOLORADJUSTMENT;

{$EXTERNALSYM SetColorAdjustment}
function SetColorAdjustment(DC: HDC; const p2: TColorAdjustment): BOOL; stdcall;
{$EXTERNALSYM GetColorAdjustment}
function GetColorAdjustment(DC: HDC; var p2: TColorAdjustment): BOOL; stdcall;
{$EXTERNALSYM CreateHalftonePalette}
function CreateHalftonePalette(DC: HDC): HPALETTE; stdcall;

type
  TFNAbortProc = function (DC: HDC; p2: Integer): BOOL stdcall stdcall;

  PDocInfoA = ^TDocInfoA;
  PDocInfoW = ^TDocInfoW;
  PDocInfo = PDocInfoA;
  {$EXTERNALSYM _DOCINFOA}
  _DOCINFOA = packed record
    cbSize: Integer;
    lpszDocName: PAnsiChar;
    lpszOutput: PAnsiChar;
    lpszDatatype: PAnsiChar;
    fwType: DWORD;
  end;
  {$EXTERNALSYM _DOCINFOW}
  _DOCINFOW = packed record
    cbSize: Integer;
    lpszDocName: PWideChar;
    lpszOutput: PWideChar;
    lpszDatatype: PWideChar;
    fwType: DWORD;
  end;
  {$EXTERNALSYM _DOCINFO}
  _DOCINFO = _DOCINFOA;
  TDocInfoA = _DOCINFOA;
  TDocInfoW = _DOCINFOW;
  TDocInfo = TDocInfoA;
  {$EXTERNALSYM DOCINFOA}
  DOCINFOA = _DOCINFOA;
  {$EXTERNALSYM DOCINFOW}
  DOCINFOW = _DOCINFOW;
  {$EXTERNALSYM DOCINFO}
  DOCINFO = DOCINFOA;

const
  {$EXTERNALSYM DI_APPBANDING}
  DI_APPBANDING = 1;

{$EXTERNALSYM StartDocA}
function StartDocA(DC: HDC; const p2: TDocInfoA): Integer; stdcall;
{$EXTERNALSYM StartDocW}
function StartDocW(DC: HDC; const p2: TDocInfoW): Integer; stdcall;
{$EXTERNALSYM StartDoc}
function StartDoc(DC: HDC; const p2: TDocInfo): Integer; stdcall;
{$EXTERNALSYM EndDoc}
function EndDoc(DC: HDC): Integer; stdcall;
{$EXTERNALSYM StartPage}
function StartPage(DC: HDC): Integer; stdcall;
{$EXTERNALSYM EndPage}
function EndPage(DC: HDC): Integer; stdcall;
{$EXTERNALSYM AbortDoc}
function AbortDoc(DC: HDC): Integer; stdcall;
{$EXTERNALSYM SetAbortProc}
function SetAbortProc(DC: HDC; lpAbortProc: TFNAbortProc): Integer; stdcall;
{$EXTERNALSYM AbortPath}
function AbortPath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM ArcTo}
function ArcTo(DC: HDC; RLeft, RTop, RRight, RBottom: Integer;
  X1, Y1, X2, Y2: Integer): BOOL; stdcall;
{$EXTERNALSYM BeginPath}
function BeginPath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM CloseFigure}
function CloseFigure(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM EndPath}
function EndPath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM FillPath}
function FillPath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM FlattenPath}
function FlattenPath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM GetPath}
function GetPath(DC: HDC; var Points, Types; nSize: Integer): Integer; stdcall;
{$EXTERNALSYM PathToRegion}
function PathToRegion(DC: HDC): HRGN; stdcall;
{$EXTERNALSYM PolyDraw}
function PolyDraw(DC: HDC; const Points, Types; cCount: Integer): BOOL; stdcall;
{$EXTERNALSYM SelectClipPath}
function SelectClipPath(DC: HDC; Mode: Integer): BOOL; stdcall;
{$EXTERNALSYM SetArcDirection}
function SetArcDirection(DC: HDC; Direction: Integer): Integer; stdcall;
{$EXTERNALSYM SetMiterLimit}
function SetMiterLimit(DC: HDC; NewLimit: Single; OldLimit: PSingle): BOOL; stdcall;
{$EXTERNALSYM StrokeAndFillPath}
function StrokeAndFillPath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM StrokePath}
function StrokePath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM WidenPath}
function WidenPath(DC: HDC): BOOL; stdcall;
{$EXTERNALSYM ExtCreatePen}
function ExtCreatePen(PenStyle, Width: DWORD; const Brush: TLogBrush;
  StyleCount: DWORD; Style: Pointer): HPEN; stdcall;
{$EXTERNALSYM GetMiterLimit}
function GetMiterLimit(DC: HDC; var Limit: Single): BOOL; stdcall;
{$EXTERNALSYM GetArcDirection}
function GetArcDirection(DC: HDC): Integer; stdcall;
{$EXTERNALSYM GetObjectA}
function GetObjectA(p1: HGDIOBJ; p2: Integer; p3: Pointer): Integer; stdcall;
{$EXTERNALSYM GetObjectW}
function GetObjectW(p1: HGDIOBJ; p2: Integer; p3: Pointer): Integer; stdcall;
{$EXTERNALSYM GetObject}
function GetObject(p1: HGDIOBJ; p2: Integer; p3: Pointer): Integer; stdcall;
{$EXTERNALSYM MoveToEx}
function MoveToEx(DC: HDC; p2, p3: Integer; p4: PPoint): BOOL; stdcall;
{$EXTERNALSYM TextOutA}
function TextOutA(DC: HDC; X, Y: Integer; Str: PAnsiChar; Count: Integer): BOOL; stdcall;
{$EXTERNALSYM TextOutW}
function TextOutW(DC: HDC; X, Y: Integer; Str: PWideChar; Count: Integer): BOOL; stdcall;
{$EXTERNALSYM TextOut}
function TextOut(DC: HDC; X, Y: Integer; Str: PChar; Count: Integer): BOOL; stdcall;
{$EXTERNALSYM ExtTextOutA}
function ExtTextOutA(DC: HDC; X, Y: Integer; Options: Longint;
  Rect: PRect; Str: PAnsiChar; Count: Longint; Dx: PInteger): BOOL; stdcall;
{$EXTERNALSYM ExtTextOutW}
function ExtTextOutW(DC: HDC; X, Y: Integer; Options: Longint;
  Rect: PRect; Str: PWideChar; Count: Longint; Dx: PInteger): BOOL; stdcall;
{$EXTERNALSYM ExtTextOut}
function ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
  Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): BOOL; stdcall;
{$EXTERNALSYM PolyTextOutA}
function PolyTextOutA(DC: HDC; const PolyTextArray; Strings: Integer): BOOL; stdcall;
{$EXTERNALSYM PolyTextOutW}
function PolyTextOutW(DC: HDC; const PolyTextArray; Strings: Integer): BOOL; stdcall;
{$EXTERNALSYM PolyTextOut}
function PolyTextOut(DC: HDC; const PolyTextArray; Strings: Integer): BOOL; stdcall;
{$EXTERNALSYM CreatePolygonRgn}
function CreatePolygonRgn(const Points; Count, FillMode: Integer): HRGN; stdcall;
{$EXTERNALSYM DPtoLP}
function DPtoLP(DC: HDC; var Points; Count: Integer): BOOL; stdcall;
{$EXTERNALSYM LPtoDP}
function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; stdcall;
{$EXTERNALSYM Polygon}
function Polygon(DC: HDC; var Points; Count: Integer): BOOL; stdcall;
{$EXTERNALSYM Polyline}
function Polyline(DC: HDC; var Points; Count: Integer): BOOL; stdcall;
{$EXTERNALSYM PolyBezier}
function PolyBezier(DC: HDC; const Points; Count: DWORD): BOOL; stdcall;
{$EXTERNALSYM PolyBezierTo}
function PolyBezierTo(DC: HDC; const Points; Count: DWORD): BOOL; stdcall;
{$EXTERNALSYM PolyLineTo}
function PolyLineTo(DC: HDC; const Points; Count: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetViewportExtEx}
function SetViewportExtEx(DC: HDC; XExt, YExt: Integer; Size: PSize): BOOL; stdcall;
{$EXTERNALSYM SetViewportOrgEx}
function SetViewportOrgEx(DC: HDC; X, Y: Integer; Point: PPoint): BOOL; stdcall;
{$EXTERNALSYM SetWindowExtEx}
function SetWindowExtEx(DC: HDC; XExt, YExt: Integer; Size: PSize): BOOL; stdcall;
{$EXTERNALSYM SetWindowOrgEx}
function SetWindowOrgEx(DC: HDC; X, Y: Integer; Point: PPoint): BOOL; stdcall;
{$EXTERNALSYM OffsetViewportOrgEx}
function OffsetViewportOrgEx(DC: HDC; X, Y: Integer; var Points): BOOL; stdcall;
{$EXTERNALSYM OffsetWindowOrgEx}
function OffsetWindowOrgEx(DC: HDC; X, Y: Integer; var Points): BOOL; stdcall;
{$EXTERNALSYM ScaleViewportExtEx}
function ScaleViewportExtEx(DC: HDC; XM, XD, YM, YD: Integer; Size: PSize): BOOL; stdcall;
{$EXTERNALSYM ScaleWindowExtEx}
function ScaleWindowExtEx(DC: HDC; XM, XD, YM, YD: Integer; Size: PSize): BOOL; stdcall;
{$EXTERNALSYM SetBitmapDimensionEx}
function SetBitmapDimensionEx(hBitmap: HBITMAP; Width, Height: Integer; Size: PSize): BOOL; stdcall;
{$EXTERNALSYM SetBrushOrgEx}
function SetBrushOrgEx(DC: HDC; X, Y: Integer; PrevPt: PPoint): BOOL; stdcall;
{$EXTERNALSYM GetTextFaceA}
function GetTextFaceA(DC: HDC; Count: Integer; Buffer: PAnsiChar): Integer; stdcall;
{$EXTERNALSYM GetTextFaceW}
function GetTextFaceW(DC: HDC; Count: Integer; Buffer: PWideChar): Integer; stdcall;
{$EXTERNALSYM GetTextFace}
function GetTextFace(DC: HDC; Count: Integer; Buffer: PChar): Integer; stdcall;

const
  {$EXTERNALSYM FONTMAPPER_MAX}
  FONTMAPPER_MAX = 10;

type
  PKerningPair = ^TKerningPair;
  {$EXTERNALSYM tagKERNINGPAIR}
  tagKERNINGPAIR = packed record
    wFirst: Word;
    wSecond: Word;
    iKernAmount: Integer;
  end;
  TKerningPair = tagKERNINGPAIR;
  {$EXTERNALSYM KERNINGPAIR}
  KERNINGPAIR = tagKERNINGPAIR;

{$EXTERNALSYM GetKerningPairs}
function GetKerningPairs(DC: HDC; Count: DWORD; var KerningPairs): DWORD; stdcall;
{$EXTERNALSYM GetDCOrgEx}
function GetDCOrgEx(DC: HDC; var Origin: TPoint): BOOL; stdcall;
{$EXTERNALSYM UnrealizeObject}
function UnrealizeObject(hGDIObj: HGDIOBJ): BOOL; stdcall;
{$EXTERNALSYM GdiFlush}
function GdiFlush: BOOL; stdcall;
{$EXTERNALSYM GdiSetBatchLimit}
function GdiSetBatchLimit(Limit: DWORD): DWORD; stdcall;
{$EXTERNALSYM GdiGetBatchLimit}
function GdiGetBatchLimit: DWORD; stdcall;

const
  {$EXTERNALSYM ICM_OFF}
  ICM_OFF = 1;
  {$EXTERNALSYM ICM_ON}
  ICM_ON = 2;
  {$EXTERNALSYM ICM_QUERY}
  ICM_QUERY = 3;

  ICM_ADDPROFILE = 1; { removed in 4.0 SDK }
  ICM_DELETEPROFILE = 2; { removed in 4.0 SDK }
  ICM_QUERYPROFILE = 3; { removed in 4.0 SDK }
  ICM_SETDEFAULTPROFILE = 4; { removed in 4.0 SDK }
  ICM_REGISTERICMATCHER = 5; { removed in 4.0 SDK }
  ICM_UNREGISTERICMATCHER = 6; { removed in 4.0 SDK }
  ICM_QUERYMATCH = 7; { removed in 4.0 SDK }

{$EXTERNALSYM SetICMMode}
function SetICMMode(DC: HDC; Mode: Integer): Integer; stdcall;
{$EXTERNALSYM CheckColorsInGamut}
function CheckColorsInGamut(DC: HDC; var RGBQuads, Results; Count: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetColorSpace}
function GetColorSpace(DC: HDC): THandle; stdcall;
{$EXTERNALSYM GetLogColorSpaceA}
function GetLogColorSpaceA(p1: HCOLORSPACE; var ColorSpace: TLogColorSpaceA; Size: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetLogColorSpaceW}
function GetLogColorSpaceW(p1: HCOLORSPACE; var ColorSpace: TLogColorSpaceW; Size: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetLogColorSpace}
function GetLogColorSpace(p1: HCOLORSPACE; var ColorSpace: TLogColorSpace; Size: DWORD): BOOL; stdcall;
{$EXTERNALSYM CreateColorSpaceA}
function CreateColorSpaceA(var ColorSpace: TLogColorSpaceA): HCOLORSPACE; stdcall;
{$EXTERNALSYM CreateColorSpaceW}
function CreateColorSpaceW(var ColorSpace: TLogColorSpaceW): HCOLORSPACE; stdcall;
{$EXTERNALSYM CreateColorSpace}
function CreateColorSpace(var ColorSpace: TLogColorSpace): HCOLORSPACE; stdcall;
{$EXTERNALSYM SetColorSpace}
function SetColorSpace(DC: HDC; ColorSpace: HCOLORSPACE): BOOL; stdcall;
{$EXTERNALSYM DeleteColorSpace}
function DeleteColorSpace(ColorSpace: HCOLORSPACE): BOOL; stdcall;
{$EXTERNALSYM GetICMProfileA}
function GetICMProfileA(DC: HDC; var Size: DWORD; Name: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM GetICMProfileW}
function GetICMProfileW(DC: HDC; var Size: DWORD; Name: PWideChar): BOOL; stdcall;
{$EXTERNALSYM GetICMProfile}
function GetICMProfile(DC: HDC; var Size: DWORD; Name: PChar): BOOL; stdcall;
{$EXTERNALSYM SetICMProfileA}
function SetICMProfileA(DC: HDC; Name: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetICMProfileW}
function SetICMProfileW(DC: HDC; Name: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetICMProfile}
function SetICMProfile(DC: HDC; Name: PChar): BOOL; stdcall;
{$EXTERNALSYM GetDeviceGammaRamp}
function GetDeviceGammaRamp(DC: HDC; var Ramp): BOOL; stdcall;
{$EXTERNALSYM SetDeviceGammaRamp}
function SetDeviceGammaRamp(DC: HDC; var Ramp): BOOL; stdcall;
{$EXTERNALSYM ColorMatchToTarget}
function ColorMatchToTarget(DC: HDC; Target: HDC; Action: DWORD): BOOL; stdcall;

type
  TFNICMEnumProc = TFarProc;

{$EXTERNALSYM EnumICMProfilesA}
function EnumICMProfilesA(DC: HDC; ICMProc: TFNICMEnumProc; p3: LPARAM): Integer; stdcall;
{$EXTERNALSYM EnumICMProfilesW}
function EnumICMProfilesW(DC: HDC; ICMProc: TFNICMEnumProc; p3: LPARAM): Integer; stdcall;
{$EXTERNALSYM EnumICMProfiles}
function EnumICMProfiles(DC: HDC; ICMProc: TFNICMEnumProc; p3: LPARAM): Integer; stdcall;

{$EXTERNALSYM UpdateICMRegKeyA}
function UpdateICMRegKeyA(p1: DWORD; p2, p3: PAnsiChar; p4: UINT): BOOL; stdcall;
{$EXTERNALSYM UpdateICMRegKeyW}
function UpdateICMRegKeyW(p1: DWORD; p2, p3: PWideChar; p4: UINT): BOOL; stdcall;
{$EXTERNALSYM UpdateICMRegKey}
function UpdateICMRegKey(p1: DWORD; p2, p3: PChar; p4: UINT): BOOL; stdcall;

{$EXTERNALSYM ColorCorrectPalette}
function ColorCorrectPalette(DC: HDC; p2: HPALETTE; p3, p4: DWORD): BOOL; stdcall;

const
  {$EXTERNALSYM ENHMETA_SIGNATURE}
  ENHMETA_SIGNATURE = $464D4520;  { Enhanced metafile constants. }

{ Stock object flag used in the object handle index in the enhanced
  metafile records.
  E.g. The object handle index (META_STOCK_OBJECT or BLACK_BRUSH)
  represents the stock object BLACK_BRUSH. }

  {$EXTERNALSYM ENHMETA_STOCK_OBJECT}
  ENHMETA_STOCK_OBJECT = DWORD($80000000);

{ Enhanced metafile record types.}

  {$EXTERNALSYM EMR_HEADER}
  EMR_HEADER = 1;
  {$EXTERNALSYM EMR_POLYBEZIER}
  EMR_POLYBEZIER = 2;
  {$EXTERNALSYM EMR_POLYGON}
  EMR_POLYGON = 3;
  {$EXTERNALSYM EMR_POLYLINE}
  EMR_POLYLINE = 4;
  {$EXTERNALSYM EMR_POLYBEZIERTO}
  EMR_POLYBEZIERTO = 5;
  {$EXTERNALSYM EMR_POLYLINETO}
  EMR_POLYLINETO = 6;
  {$EXTERNALSYM EMR_POLYPOLYLINE}
  EMR_POLYPOLYLINE = 7;
  {$EXTERNALSYM EMR_POLYPOLYGON}
  EMR_POLYPOLYGON = 8;
  {$EXTERNALSYM EMR_SETWINDOWEXTEX}
  EMR_SETWINDOWEXTEX = 9;
  {$EXTERNALSYM EMR_SETWINDOWORGEX}
  EMR_SETWINDOWORGEX = 10;
  {$EXTERNALSYM EMR_SETVIEWPORTEXTEX}
  EMR_SETVIEWPORTEXTEX = 11;
  {$EXTERNALSYM EMR_SETVIEWPORTORGEX}
  EMR_SETVIEWPORTORGEX = 12;
  {$EXTERNALSYM EMR_SETBRUSHORGEX}
  EMR_SETBRUSHORGEX = 13;
  {$EXTERNALSYM EMR_EOF}
  EMR_EOF = 14;
  {$EXTERNALSYM EMR_SETPIXELV}
  EMR_SETPIXELV = 15;
  {$EXTERNALSYM EMR_SETMAPPERFLAGS}
  EMR_SETMAPPERFLAGS = $10;
  {$EXTERNALSYM EMR_SETMAPMODE}
  EMR_SETMAPMODE = 17;
  {$EXTERNALSYM EMR_SETBKMODE}
  EMR_SETBKMODE = 18;
  {$EXTERNALSYM EMR_SETPOLYFILLMODE}
  EMR_SETPOLYFILLMODE = 19;
  {$EXTERNALSYM EMR_SETROP2}
  EMR_SETROP2 = 20;
  {$EXTERNALSYM EMR_SETSTRETCHBLTMODE}
  EMR_SETSTRETCHBLTMODE = 21;
  {$EXTERNALSYM EMR_SETTEXTALIGN}
  EMR_SETTEXTALIGN = 22;
  {$EXTERNALSYM EMR_SETCOLORADJUSTMENT}
  EMR_SETCOLORADJUSTMENT = 23;
  {$EXTERNALSYM EMR_SETTEXTCOLOR}
  EMR_SETTEXTCOLOR = 24;
  {$EXTERNALSYM EMR_SETBKCOLOR}
  EMR_SETBKCOLOR = 25;
  {$EXTERNALSYM EMR_OFFSETCLIPRGN}
  EMR_OFFSETCLIPRGN = 26;
  {$EXTERNALSYM EMR_MOVETOEX}
  EMR_MOVETOEX = 27;
  {$EXTERNALSYM EMR_SETMETARGN}
  EMR_SETMETARGN = 28;
  {$EXTERNALSYM EMR_EXCLUDECLIPRECT}
  EMR_EXCLUDECLIPRECT = 29;
  {$EXTERNALSYM EMR_INTERSECTCLIPRECT}
  EMR_INTERSECTCLIPRECT = 30;
  {$EXTERNALSYM EMR_SCALEVIEWPORTEXTEX}
  EMR_SCALEVIEWPORTEXTEX = 31;
  {$EXTERNALSYM EMR_SCALEWINDOWEXTEX}
  EMR_SCALEWINDOWEXTEX = 32;
  {$EXTERNALSYM EMR_SAVEDC}
  EMR_SAVEDC = 33;
  {$EXTERNALSYM EMR_RESTOREDC}
  EMR_RESTOREDC = 34;
  {$EXTERNALSYM EMR_SETWORLDTRANSFORM}
  EMR_SETWORLDTRANSFORM = 35;
  {$EXTERNALSYM EMR_MODIFYWORLDTRANSFORM}
  EMR_MODIFYWORLDTRANSFORM = 36;
  {$EXTERNALSYM EMR_SELECTOBJECT}
  EMR_SELECTOBJECT = 37;
  {$EXTERNALSYM EMR_CREATEPEN}
  EMR_CREATEPEN = 38;
  {$EXTERNALSYM EMR_CREATEBRUSHINDIRECT}
  EMR_CREATEBRUSHINDIRECT = 39;
  {$EXTERNALSYM EMR_DELETEOBJECT}
  EMR_DELETEOBJECT = 40;
  {$EXTERNALSYM EMR_ANGLEARC}
  EMR_ANGLEARC = 41;
  {$EXTERNALSYM EMR_ELLIPSE}
  EMR_ELLIPSE = 42;
  {$EXTERNALSYM EMR_RECTANGLE}
  EMR_RECTANGLE = 43;
  {$EXTERNALSYM EMR_ROUNDRECT}
  EMR_ROUNDRECT = 44;
  {$EXTERNALSYM EMR_ARC}
  EMR_ARC = 45;
  {$EXTERNALSYM EMR_CHORD}
  EMR_CHORD = 46;
  {$EXTERNALSYM EMR_PIE}
  EMR_PIE = 47;
  {$EXTERNALSYM EMR_SELECTPALETTE}
  EMR_SELECTPALETTE = 48;
  {$EXTERNALSYM EMR_CREATEPALETTE}
  EMR_CREATEPALETTE = 49;
  {$EXTERNALSYM EMR_SETPALETTEENTRIES}
  EMR_SETPALETTEENTRIES = 50;
  {$EXTERNALSYM EMR_RESIZEPALETTE}
  EMR_RESIZEPALETTE = 51;
  {$EXTERNALSYM EMR_REALIZEPALETTE}
  EMR_REALIZEPALETTE = 52;
  {$EXTERNALSYM EMR_EXTFLOODFILL}
  EMR_EXTFLOODFILL = 53;
  {$EXTERNALSYM EMR_LINETO}
  EMR_LINETO = 54;
  {$EXTERNALSYM EMR_ARCTO}
  EMR_ARCTO = 55;
  {$EXTERNALSYM EMR_POLYDRAW}
  EMR_POLYDRAW = 56;
  {$EXTERNALSYM EMR_SETARCDIRECTION}
  EMR_SETARCDIRECTION = 57;
  {$EXTERNALSYM EMR_SETMITERLIMIT}
  EMR_SETMITERLIMIT = 58;
  {$EXTERNALSYM EMR_BEGINPATH}
  EMR_BEGINPATH = 59;
  {$EXTERNALSYM EMR_ENDPATH}
  EMR_ENDPATH = 60;
  {$EXTERNALSYM EMR_CLOSEFIGURE}
  EMR_CLOSEFIGURE = 61;
  {$EXTERNALSYM EMR_FILLPATH}
  EMR_FILLPATH = 62;
  {$EXTERNALSYM EMR_STROKEANDFILLPATH}
  EMR_STROKEANDFILLPATH = 63;
  {$EXTERNALSYM EMR_STROKEPATH}
  EMR_STROKEPATH = $40;
  {$EXTERNALSYM EMR_FLATTENPATH}
  EMR_FLATTENPATH = 65;
  {$EXTERNALSYM EMR_WIDENPATH}
  EMR_WIDENPATH = 66;
  {$EXTERNALSYM EMR_SELECTCLIPPATH}
  EMR_SELECTCLIPPATH = 67;
  {$EXTERNALSYM EMR_ABORTPATH}
  EMR_ABORTPATH = 68;

  {$EXTERNALSYM EMR_GDICOMMENT}
  EMR_GDICOMMENT = 70;
  {$EXTERNALSYM EMR_FILLRGN}
  EMR_FILLRGN = 71;
  {$EXTERNALSYM EMR_FRAMERGN}
  EMR_FRAMERGN = 72;
  {$EXTERNALSYM EMR_INVERTRGN}
  EMR_INVERTRGN = 73;
  {$EXTERNALSYM EMR_PAINTRGN}
  EMR_PAINTRGN = 74;
  {$EXTERNALSYM EMR_EXTSELECTCLIPRGN}
  EMR_EXTSELECTCLIPRGN = 75;
  {$EXTERNALSYM EMR_BITBLT}
  EMR_BITBLT = 76;
  {$EXTERNALSYM EMR_STRETCHBLT}
  EMR_STRETCHBLT = 77;
  {$EXTERNALSYM EMR_MASKBLT}
  EMR_MASKBLT = 78;
  {$EXTERNALSYM EMR_PLGBLT}
  EMR_PLGBLT = 79;
  {$EXTERNALSYM EMR_SETDIBITSTODEVICE}
  EMR_SETDIBITSTODEVICE = 80;
  {$EXTERNALSYM EMR_STRETCHDIBITS}
  EMR_STRETCHDIBITS = 81;
  {$EXTERNALSYM EMR_EXTCREATEFONTINDIRECTW}
  EMR_EXTCREATEFONTINDIRECTW = 82;
  {$EXTERNALSYM EMR_EXTTEXTOUTA}
  EMR_EXTTEXTOUTA = 83;
  {$EXTERNALSYM EMR_EXTTEXTOUTW}
  EMR_EXTTEXTOUTW = 84;
  {$EXTERNALSYM EMR_POLYBEZIER16}
  EMR_POLYBEZIER16 = 85;
  {$EXTERNALSYM EMR_POLYGON16}
  EMR_POLYGON16 = 86;
  {$EXTERNALSYM EMR_POLYLINE16}
  EMR_POLYLINE16 = 87;
  {$EXTERNALSYM EMR_POLYBEZIERTO16}
  EMR_POLYBEZIERTO16 = 88;
  {$EXTERNALSYM EMR_POLYLINETO16}
  EMR_POLYLINETO16 = 89;
  {$EXTERNALSYM EMR_POLYPOLYLINE16}
  EMR_POLYPOLYLINE16 = 90;
  {$EXTERNALSYM EMR_POLYPOLYGON16}
  EMR_POLYPOLYGON16 = 91;
  {$EXTERNALSYM EMR_POLYDRAW16}
  EMR_POLYDRAW16 = 92;
  {$EXTERNALSYM EMR_CREATEMONOBRUSH}
  EMR_CREATEMONOBRUSH = 93;
  {$EXTERNALSYM EMR_CREATEDIBPATTERNBRUSHPT}
  EMR_CREATEDIBPATTERNBRUSHPT = 94;
  {$EXTERNALSYM EMR_EXTCREATEPEN}
  EMR_EXTCREATEPEN = 95;
  {$EXTERNALSYM EMR_POLYTEXTOUTA}
  EMR_POLYTEXTOUTA = 96;
  {$EXTERNALSYM EMR_POLYTEXTOUTW}
  EMR_POLYTEXTOUTW = 97;
  {$EXTERNALSYM EMR_SETICMMODE}
  EMR_SETICMMODE = 98;
  {$EXTERNALSYM EMR_CREATECOLORSPACE}
  EMR_CREATECOLORSPACE = 99;
  {$EXTERNALSYM EMR_SETCOLORSPACE}
  EMR_SETCOLORSPACE = 100;
  {$EXTERNALSYM EMR_DELETECOLORSPACE}
  EMR_DELETECOLORSPACE = 101;
  {$EXTERNALSYM EMR_GLSRECORD}
  EMR_GLSRECORD = 102;
  {$EXTERNALSYM EMR_GLSBOUNDEDRECORD}
  EMR_GLSBOUNDEDRECORD = 103;
  {$EXTERNALSYM EMR_PIXELFORMAT}
  EMR_PIXELFORMAT = 104;
  {$EXTERNALSYM EMR_DRAWESCAPE}
  EMR_DRAWESCAPE = 105;
  {$EXTERNALSYM EMR_EXTESCAPE}
  EMR_EXTESCAPE = 106;
  {$EXTERNALSYM EMR_STARTDOC}
  EMR_STARTDOC = 107;
  {$EXTERNALSYM EMR_SMALLTEXTOUT}
  EMR_SMALLTEXTOUT = 108;
  {$EXTERNALSYM EMR_FORCEUFIMAPPING}
  EMR_FORCEUFIMAPPING = 109;
  {$EXTERNALSYM EMR_NAMEDESCAPE}
  EMR_NAMEDESCAPE = 110;
  {$EXTERNALSYM EMR_COLORCORRECTPALETTE}
  EMR_COLORCORRECTPALETTE = 111;
  {$EXTERNALSYM EMR_SETICMPROFILEA}
  EMR_SETICMPROFILEA = 112;
  {$EXTERNALSYM EMR_SETICMPROFILEW}
  EMR_SETICMPROFILEW = 113;
  {$EXTERNALSYM EMR_ALPHABLEND}
  EMR_ALPHABLEND = 114;
  {$EXTERNALSYM EMR_ALPHADIBBLEND}
  EMR_ALPHADIBBLEND = 115;
  {$EXTERNALSYM EMR_TRANSPARENTBLT}
  EMR_TRANSPARENTBLT = 116;
  {$EXTERNALSYM EMR_TRANSPARENTDIB}
  EMR_TRANSPARENTDIB = 117;
  {$EXTERNALSYM EMR_GRADIENTFILL}
  EMR_GRADIENTFILL = 118;
  {$EXTERNALSYM EMR_SETLINKEDUFIS}
  EMR_SETLINKEDUFIS = 119;
  {$EXTERNALSYM EMR_SETTEXTJUSTIFICATION}
  EMR_SETTEXTJUSTIFICATION = 120;
  {$EXTERNALSYM EMR_MAX}
  EMR_MAX = 120;
  {$EXTERNALSYM EMR_MIN}
  EMR_MIN = 1;


type
  { Base record type for the enhanced metafile.}
  {$EXTERNALSYM PEMR}
  PEMR = ^TEMR;
  {$EXTERNALSYM tagEMR}
  tagEMR = packed record
    iType: DWORD; { Enhanced metafile record type}
    nSize: DWORD; { Length of the record in bytes.}
                  { This must be a multiple of 4.}
  end;
  TEMR = tagEMR;
  {$EXTERNALSYM EMR}
  EMR = tagEMR;

  { Base text record type for the enhanced metafile.}
  PEMRText = ^TEMRText;
  {$EXTERNALSYM tagEMRTEXT}
  tagEMRTEXT = packed record
    ptlReference: TPoint;
    nChars: DWORD;
    offString: DWORD; { Offset to the string}
    fOptions: DWORD;
    rcl: TRect;
    offDx: DWORD;     { Offset to the inter-character spacing array.}
                      { This is always given.}
  end;
  TEMRText = tagEMRTEXT;
  {$EXTERNALSYM EMRTEXT}
  EMRTEXT = tagEMRTEXT;


  { Record structures for the enhanced metafile.}
  PAbortPath = ^TAbortPath;
  {$EXTERNALSYM tagABORTPATH}
  tagABORTPATH = packed record
    emr: TEMR;
  end;
  TAbortPath = tagABORTPATH;
  {$EXTERNALSYM EMRABORTPATH}
  EMRABORTPATH = tagABORTPATH;
  TEMRAbortPath = TAbortPath;
  PEMRAbortPath = PAbortPath;
  TEMRBeginPath = TAbortPath;
  PEMRBeginPath = PAbortPath;
  TEMREndPath = TAbortPath;
  PEMREndPath = PAbortPath;
  TEMRCloseFigure = TAbortPath;
  PEMRCloseFigure = PAbortPath;
  TEMRFlattenPath = TAbortPath;
  PEMRFlattenPath = PAbortPath;
  TEMRWidenPath = TAbortPath;
  PEMRWidenPath = PAbortPath;
  TEMRSetMetaRgn = TAbortPath;
  PEMRSetMetaRgn = PAbortPath;
  TEMRSaveDC = TAbortPath;
  PEMRSaveDC = PAbortPath;
  TEMRRealizePalette = TAbortPath;
  PEMRRealizePalette = PAbortPath;

  PEMRSelectclippath = ^TEMRSelectClipPath;
  {$EXTERNALSYM tagEMRSELECTCLIPPATH}
  tagEMRSELECTCLIPPATH = packed record
    emr: TEMR;
    iMode: DWORD;
  end;
  TEMRSelectClipPath = tagEMRSELECTCLIPPATH;
  {$EXTERNALSYM EMRSELECTCLIPPATH}
  EMRSELECTCLIPPATH = tagEMRSELECTCLIPPATH;
  TEMRSetBkMode = TEMRSelectClipPath;
  PEMRSetBkMode = PEMRSelectClipPath;
  TEMRSetMapMode = TEMRSelectClipPath;
  PEMRSetMapMode = PEMRSelectClipPath;
  TEMRSetPolyFillMode = TEMRSelectClipPath;
  PEMRSetPolyFillMode = PEMRSelectClipPath;
  TEMRSetRop2 = TEMRSelectClipPath;
  PEMRSetRop2 = PEMRSelectClipPath;
  TEMRSetStretchBltMode = TEMRSelectClipPath;
  PEMRSetStretchBltMode = PEMRSelectClipPath;
  TEMRSetICMMode = TEMRSelectClipPath;
  PEMRSetICMMode = PEMRSelectClipPath;
  TEMRSetTextAlign = TEMRSelectClipPath;
  PEMRSetTextAlign = PEMRSelectClipPath;

  PEMRSetMiterLimit = ^TEMRSetMiterLimit;
  {$EXTERNALSYM tagEMRSETMITERLIMIT}
  tagEMRSETMITERLIMIT = packed record
    emr: TEMR;
    eMiterLimit: Single;
  end;
  TEMRSetMiterLimit = tagEMRSETMITERLIMIT;
  {$EXTERNALSYM EMRSETMITERLIMIT}
  EMRSETMITERLIMIT = tagEMRSETMITERLIMIT;

  PEMRRestoreDC = ^TEMRRestoreDC;
  {$EXTERNALSYM tagEMRRESTOREDC}
  tagEMRRESTOREDC = packed record
    emr: TEMR;
    iRelative: Longint;   { Specifies a relative instance}
  end;
  TEMRRestoreDC = tagEMRRESTOREDC;
  {$EXTERNALSYM EMRRESTOREDC}
  EMRRESTOREDC = tagEMRRESTOREDC;

  PEMRSetArcDirection = ^TEMRSetArcDirection;
  {$EXTERNALSYM tagEMRSETARCDIRECTION}
  tagEMRSETARCDIRECTION = packed record
    emr: TEMR;
    iArcDirection: DWORD; { Specifies the arc direction in the advanced graphics mode.}
  end;
  TEMRSetArcDirection = tagEMRSETARCDIRECTION;
  {$EXTERNALSYM EMRSETARCDIRECTION}
  EMRSETARCDIRECTION = tagEMRSETARCDIRECTION;

  PEMRSetMapperFlags = ^TEMRSetMapperFlags;
  {$EXTERNALSYM tagEMRSETMAPPERFLAGS}
  tagEMRSETMAPPERFLAGS = packed record
    emr: TEMR;
    dwFlags: DWORD;
  end;
  TEMRSetMapperFlags = tagEMRSETMAPPERFLAGS;
  {$EXTERNALSYM EMRSETMAPPERFLAGS}
  EMRSETMAPPERFLAGS = tagEMRSETMAPPERFLAGS;

  PEMRSetTextColor = ^TEMRSetTextColor;
  {$EXTERNALSYM tagEMRSETTEXTCOLOR}
  tagEMRSETTEXTCOLOR = packed record
    emr: TEMR;
    crColor: COLORREF;
  end;
  TEMRSetTextColor = tagEMRSETTEXTCOLOR;
  {$EXTERNALSYM EMRSETTEXTCOLOR}
  EMRSETTEXTCOLOR = tagEMRSETTEXTCOLOR;
  TEMRSetBkColor = TEMRSetTextColor;
  PEMRSetBkColor = PEMRSetTextColor;

  PEMRSelectObject = ^TEMRSelectObject;
  {$EXTERNALSYM tagEMRSELECTOBJECT}
  tagEMRSELECTOBJECT = packed record
    emr: TEMR;
    ihObject: DWORD;   { Object handle index }
  end;
  TEMRSelectObject = tagEMRSELECTOBJECT;
  {$EXTERNALSYM EMRSELECTOBJECT}
  EMRSELECTOBJECT = tagEMRSELECTOBJECT;
  EMRDeleteObject = TEMRSelectObject;
  PEMRDeleteObject = PEMRSelectObject;

  PEMRSelectColorSpace = ^TEMRSelectColorSpace;
  {$EXTERNALSYM tagEMRSELECTCOLORSPACE}
  tagEMRSELECTCOLORSPACE = packed record
    emr: TEMR;
    ihCS: DWORD;  { ColorSpace handle index }
  end;
  TEMRSelectColorSpace = tagEMRSELECTCOLORSPACE;
  {$EXTERNALSYM EMRSELECTCOLORSPACE}
  EMRSELECTCOLORSPACE = tagEMRSELECTCOLORSPACE;
  EMRDeleteColorSpace = TEMRSelectColorSpace;
  PEMRDeleteColorSpace = PEMRSelectColorSpace;

  PEMRSelectPalette = ^TEMRSelectPalette;
  {$EXTERNALSYM tagEMRSELECTPALETTE}
  tagEMRSELECTPALETTE = packed record
    emr: TEMR;
    ihPal: DWORD;   { Palette handle index, background mode only }
  end;
  TEMRSelectPalette = tagEMRSELECTPALETTE;
  {$EXTERNALSYM EMRSELECTPALETTE}
  EMRSELECTPALETTE = tagEMRSELECTPALETTE;

  PEMRResizePalette = ^TEMRResizePalette;
  {$EXTERNALSYM tagEMRRESIZEPALETTE}
  tagEMRRESIZEPALETTE = packed record
    emr: TEMR;
    ihPal: DWORD;   { Palette handle index }
    cEntries: DWORD;
  end;
  TEMRResizePalette = tagEMRRESIZEPALETTE;
  {$EXTERNALSYM EMRRESIZEPALETTE}
  EMRRESIZEPALETTE = tagEMRRESIZEPALETTE;

  PEMRSetPaletteEntries = ^TEMRSetPaletteEntries;
  {$EXTERNALSYM tagEMRSETPALETTEENTRIES}
  tagEMRSETPALETTEENTRIES = packed record
    emr: TEMR;
    ihPal: DWORD;      { Palette handle index }
    iStart: DWORD;
    cEntries: DWORD;
    aPalEntries: array[0..0] of TPaletteEntry; { The peFlags fields do not contain any flags }
  end;
  TEMRSetPaletteEntries = tagEMRSETPALETTEENTRIES;
  {$EXTERNALSYM EMRSETPALETTEENTRIES}
  EMRSETPALETTEENTRIES = tagEMRSETPALETTEENTRIES;

  PEMRSetColorAdjustment = ^TEMRSetColorAdjustment;
  {$EXTERNALSYM tagEMRSETCOLORADJUSTMENT}
  tagEMRSETCOLORADJUSTMENT = packed record
    emr: TEMR;
    ColorAdjustment: TColorAdjustment;
  end;
  TEMRSetColorAdjustment = tagEMRSETCOLORADJUSTMENT;
  {$EXTERNALSYM EMRSETCOLORADJUSTMENT}
  EMRSETCOLORADJUSTMENT = tagEMRSETCOLORADJUSTMENT;

  PEMRGDIComment = ^TEMRGDIComment;
  {$EXTERNALSYM tagEMRGDICOMMENT}
  tagEMRGDICOMMENT = record
    emr: TEMR;
    cbData: DWORD;   { Size of data in bytes}
    Data: array[0..0] of Byte;
  end;
  TEMRGDIComment = tagEMRGDICOMMENT;
  {$EXTERNALSYM EMRGDICOMMENT}
  EMRGDICOMMENT = tagEMRGDICOMMENT;

  {$EXTERNALSYM PEMREOF}
  PEMREOF = ^TEMREOF;
  {$EXTERNALSYM tagEMREOF}
  tagEMREOF = packed record
    emr: TEMR;
    nPalEntries: DWORD;   { Number of palette entries }
    offPalEntries: DWORD; { Offset to the palette entries }
    nSizeLast: DWORD;     { Same as nSize and must be the last DWORD }
                          { of the record.  The palette entries, }
                          { if exist, precede this field. }
  end;
  TEMREOF = tagEMREOF;
  {$EXTERNALSYM EMREOF}
  EMREOF = tagEMREOF;

  PEMRLineTo = ^TEMRLineTo;
  {$EXTERNALSYM tagEMRLINETO}
  tagEMRLINETO = packed record
    emr: TEMR;
    ptl: TPoint;
  end;
  TEMRLineTo = tagEMRLINETO;
  {$EXTERNALSYM EMRLINETO}
  EMRLINETO = tagEMRLINETO;
  EMRMoveToEx = TEMRLineTo;
  PEMRMoveToEx = PEMRLineTo;

  PEMROffsetClipRgn = ^TEMROffsetClipRgn;
  {$EXTERNALSYM tagEMROFFSETCLIPRGN}
  tagEMROFFSETCLIPRGN = packed record
    emr: TEMR;
    ptlOffset: TPoint;
  end;
  TEMROffsetClipRgn = tagEMROFFSETCLIPRGN;
  {$EXTERNALSYM EMROFFSETCLIPRGN}
  EMROFFSETCLIPRGN = tagEMROFFSETCLIPRGN;

  PEMRFillPath = ^TEMRFillPath;
  {$EXTERNALSYM tagEMRFILLPATH}
  tagEMRFILLPATH = packed record
    emr: TEMR;
    rclBounds: TRect; { Inclusive-inclusive bounds in device units}
  end;
  TEMRFillPath = tagEMRFILLPATH;
  {$EXTERNALSYM EMRFILLPATH}
  EMRFILLPATH = tagEMRFILLPATH;
  EMRStrokeAndFillPath = TEMRFillPath;
  PEMRStrokeAndFillPath = PEMRFillPath;
  EMRStrokePath = TEMRFillPath;
  PEMRStrokePath = PEMRFillPath;

  PEMRExcludeClipRect = ^TEMRExcludeClipRect;
  {$EXTERNALSYM tagEMREXCLUDECLIPRECT}
  tagEMREXCLUDECLIPRECT = packed record
    emr: TEMR;
    rclClip: TRect;
  end;
  TEMRExcludeClipRect = tagEMREXCLUDECLIPRECT;
  {$EXTERNALSYM EMREXCLUDECLIPRECT}
  EMREXCLUDECLIPRECT = tagEMREXCLUDECLIPRECT;
  EMRIntersectClipRect = TEMRExcludeClipRect;
  PEMRIntersectClipRect = PEMRExcludeClipRect;

  PEMRSetViewportOrgEx = ^TEMRSetViewportOrgEx;
  {$EXTERNALSYM tagEMRSETVIEWPORTORGEX}
  tagEMRSETVIEWPORTORGEX = packed record
    emr: TEMR;
    ptlOrigin: TPoint;
  end;
  TEMRSetViewportOrgEx = tagEMRSETVIEWPORTORGEX;
  {$EXTERNALSYM EMRSETVIEWPORTORGEX}
  EMRSETVIEWPORTORGEX = tagEMRSETVIEWPORTORGEX;
  EMRSetWindowOrgEx = TEMRSetViewportOrgEx;
  PEMRSetWindowOrgEx = PEMRSetViewportOrgEx;
  EMRSetBrushOrgEx = TEMRSetViewportOrgEx;
  PEMRSetBrushOrgEx = PEMRSetViewportOrgEx;

  PEMRSetViewportExtEx = ^TEMRSetViewportExtEx;
  {$EXTERNALSYM tagEMRSETVIEWPORTEXTEX}
  tagEMRSETVIEWPORTEXTEX = packed record
    emr: TEMR;
    szlExtent: TSize;
  end;
  TEMRSetViewportExtEx = tagEMRSETVIEWPORTEXTEX;
  {$EXTERNALSYM EMRSETVIEWPORTEXTEX}
  EMRSETVIEWPORTEXTEX = tagEMRSETVIEWPORTEXTEX;
  EMRSetWindowExtEx = TEMRSetViewportExtEx;
  PEMRSetWindowExtEx = PEMRSetViewportExtEx;

  PEMRScaleViewportExtEx = ^TEMRScaleViewportExtEx;
  {$EXTERNALSYM tagEMRSCALEVIEWPORTEXTEX}
  tagEMRSCALEVIEWPORTEXTEX = packed record
    emr: TEMR;
    xNum: Longint;
    xDenom: Longint;
    yNum: Longint;
    yDenom: Longint;
  end;
  TEMRScaleViewportExtEx = tagEMRSCALEVIEWPORTEXTEX;
  {$EXTERNALSYM EMRSCALEVIEWPORTEXTEX}
  EMRSCALEVIEWPORTEXTEX = tagEMRSCALEVIEWPORTEXTEX;
  EMRScaleWindowExtEx = TEMRScaleViewportExtEx;
  PEMRScaleWindowExtEx = PEMRScaleViewportExtEx;

  PEMRSetWorldTransform = ^TEMRSetWorldTransform;
  {$EXTERNALSYM tagEMRSETWORLDTRANSFORM}
  tagEMRSETWORLDTRANSFORM = packed record
    emr: TEMR;
    xform: TXForm;
  end;
  TEMRSetWorldTransform = tagEMRSETWORLDTRANSFORM;
  {$EXTERNALSYM EMRSETWORLDTRANSFORM}
  EMRSETWORLDTRANSFORM = tagEMRSETWORLDTRANSFORM;

  PEMRModifyWorldTransform = ^TEMRModifyWorldTransform;
  {$EXTERNALSYM tagEMRMODIFYWORLDTRANSFORM}
  tagEMRMODIFYWORLDTRANSFORM = packed record
    emr: TEMR;
    xform: TXForm;
    iMode: DWORD;
  end;
  TEMRModifyWorldTransform = tagEMRMODIFYWORLDTRANSFORM;
  {$EXTERNALSYM EMRMODIFYWORLDTRANSFORM}
  EMRMODIFYWORLDTRANSFORM = tagEMRMODIFYWORLDTRANSFORM;

  PEMRSetPixelV = ^TEMRSetPixelV;
  {$EXTERNALSYM tagEMRSETPIXELV}
  tagEMRSETPIXELV = packed record
    emr: TEMR;
    ptlPixel: TPoint;
    crColor: COLORREF;
  end;
  TEMRSetPixelV = tagEMRSETPIXELV;
  {$EXTERNALSYM EMRSETPIXELV}
  EMRSETPIXELV = tagEMRSETPIXELV;

  PEMRExtFloodFill = ^TEMRExtFloodFill;
  {$EXTERNALSYM tagEMREXTFLOODFILL}
  tagEMREXTFLOODFILL = packed record
    emr: TEMR;
    ptlStart: TPoint;
    crColor: COLORREF;
    iMode: DWORD;
  end;
  TEMRExtFloodFill = tagEMREXTFLOODFILL;
  {$EXTERNALSYM EMREXTFLOODFILL}
  EMREXTFLOODFILL = tagEMREXTFLOODFILL;

  PEMREllipse = ^TEMREllipse;
  {$EXTERNALSYM tagEMRELLIPSE}
  tagEMRELLIPSE = packed record
    emr: TEMR;
    rclBox: TRect; { Inclusive-inclusive bounding rectangle}
  end;
  TEMREllipse = tagEMRELLIPSE;
  {$EXTERNALSYM EMRELLIPSE}
  EMRELLIPSE = tagEMRELLIPSE;
  EMRRectangle = TEMREllipse;
  PEMRRectangle = PEMREllipse;

  PEMRRoundRect = ^TEMRRoundRect;
  {$EXTERNALSYM tagEMRROUNDRECT}
  tagEMRROUNDRECT = packed record
    emr: TEMR;
    rclBox: TRect;     { Inclusive-inclusive bounding rectangle }
    szlCorner: TSize;
  end;
  TEMRRoundRect = tagEMRROUNDRECT;
  {$EXTERNALSYM EMRROUNDRECT}
  EMRROUNDRECT = tagEMRROUNDRECT;

  PEMRArc = ^TEMRArc;
  {$EXTERNALSYM tagEMRARC}
  tagEMRARC = packed record
    emr: TEMR;
    rclBox: TRect;     { Inclusive-inclusive bounding rectangle }
    ptlStart: TPoint;
    ptlEnd: TPoint;
  end;
  TEMRArc = tagEMRARC;
  {$EXTERNALSYM EMRARC}
  EMRARC = tagEMRARC;
  EMRArcTo = TEMRArc;
  PEMRArcTo = PEMRArc;
  EMRChord = TEMRArc;
  PEMRChord = PEMRArc;
  EMRPie = TEMRArc;
  PEMRPie = PEMRArc;

  PEMRAngleArc = ^TEMRAngleArc;
  {$EXTERNALSYM tagEMRANGLEARC}
  tagEMRANGLEARC = packed record
    emr: TEMR;
    ptlCenter: TPoint;
    nRadius: DWORD;
    eStartAngle: Single;
    eSweepAngle: Single;
  end;
  TEMRAngleArc = tagEMRANGLEARC;
  {$EXTERNALSYM EMRANGLEARC}
  EMRANGLEARC = tagEMRANGLEARC;

  PEMRPolyline = ^TEMRPolyline;
  {$EXTERNALSYM tagEMRPOLYLINE}
  tagEMRPOLYLINE = packed record
    emr: TEMR;
    rclBounds: TRect;    { Inclusive-inclusive bounds in device units }
    cptl: DWORD;
    aptl: array[0..0] of TPoint;
  end;
  TEMRPolyline = tagEMRPOLYLINE;
  {$EXTERNALSYM EMRPOLYLINE}
  EMRPOLYLINE = tagEMRPOLYLINE;
  EMRPolyBezier = TEMRPolyLine;
  PEMRPolyBezier = PEMRPolyLine;
  EMRPolyGON = TEMRPolyLine;
  PEMRPolyGON = PEMRPolyLine;
  EMRPolyBezierTo = TEMRPolyLine;
  PEMRPolyBezierTo = PEMRPolyLine;
  EMRPolyLineTo = TEMRPolyLine;
  PEMRPolyLineTo = PEMRPolyLine;

  PEMRPolyline16 = ^TEMRPolyline16;
  {$EXTERNALSYM tagEMRPOLYLINE16}
  tagEMRPOLYLINE16 = packed record
    emr: TEMR;
    rclBounds: TRect; { Inclusive-inclusive bounds in device units}
    cpts: DWORD;
    apts: array[0..0] of TSmallPoint;
  end;
  TEMRPolyline16 = tagEMRPOLYLINE16;
  {$EXTERNALSYM EMRPOLYLINE16}
  EMRPOLYLINE16 = tagEMRPOLYLINE16;
  EMRPolyBezier16 = TEMRPolyLine16;
  PEMRPolyBezier16 = PEMRPolyLine16;
  EMRPolygon16 = TEMRPolyLine16;
  PEMRPolygon16 = PEMRPolyLine16;
  EMRPolyBezierTo16 = TEMRPolyLine16;
  PEMRPolyBezierTo16 = PEMRPolyLine16;
  EMRPolyLineTo16 = TEMRPolyLine16;
  PEMRPolyLineTo16 = PEMRPolyLine16;

  PEMRPolyDraw = ^TEMRPolyDraw;
  {$EXTERNALSYM tagEMRPOLYDRAW}
  tagEMRPOLYDRAW = record
    emr: TEMR;
    rclBounds: TRect;    { Inclusive-inclusive bounds in device units}
    cptl: DWORD;         { Number of points}
    aptl: array[0..0] of TPoint;  { Array of points}
    abTypes: array[0..0] of Byte; { Array of point types}
  end;
  TEMRPolyDraw = tagEMRPOLYDRAW;
  {$EXTERNALSYM EMRPOLYDRAW}
  EMRPOLYDRAW = tagEMRPOLYDRAW;

  PEMRPolyDraw16 = ^TEMRPolyDraw16;
  {$EXTERNALSYM tagEMRPOLYDRAW16}
  tagEMRPOLYDRAW16 = record
    emr: TEMR;
    rclBounds: TRect;
    cpts: DWORD;
    apts: array[0..0] of TSmallPoint;
    abTypes: array[0..0] of Byte;
  end;
  TEMRPolyDraw16 = tagEMRPOLYDRAW16;
  {$EXTERNALSYM EMRPOLYDRAW16}
  EMRPOLYDRAW16 = tagEMRPOLYDRAW16;

  PEMRPolyPolyline = ^TEMRPolyPolyline;
  {$EXTERNALSYM tagEMRPOLYPOLYLINE}
  tagEMRPOLYPOLYLINE = packed record
    emr: TEMR;
    rclBounds: TRect; { Inclusive-inclusive bounds in device units}
    nPolys: DWORD;    { Number of polys}
    cptl: DWORD;      { Total number of points in all polys}
    aPolyCounts: array[0..0] of DWORD; { Array of point counts for each poly}
    aptl: array[0..0] of TPoint;       { Array of points}
  end;
  TEMRPolyPolyline = tagEMRPOLYPOLYLINE;
  {$EXTERNALSYM EMRPOLYPOLYLINE}
  EMRPOLYPOLYLINE = tagEMRPOLYPOLYLINE;
  EMRPolyPolygon = TEMRPolyPolyline;
  PEMRPolyPolygon = PEMRPolyPolyline;

  PEMRPolyPolyline16 = ^TEMRPolyPolyline16;
  {$EXTERNALSYM tagEMRPOLYPOLYLINE16}
  tagEMRPOLYPOLYLINE16 = packed record
    emr: TEMR;
    rclBounds: TRect;
    nPolys: DWORD;
    cpts: DWORD;
    aPolyCounts: array[0..0] of DWORD;
    apts: array[0..0] of TSmallPoint;
  end;
  TEMRPolyPolyline16 = tagEMRPOLYPOLYLINE16;
  {$EXTERNALSYM EMRPOLYPOLYLINE16}
  EMRPOLYPOLYLINE16 = tagEMRPOLYPOLYLINE16;
  EMRPolyPolygon16 = TEMRPolyPolyline16;
  PEMRPolyPolygon16 = PEMRPolyPolyline16;

  PEMRInvertRgn = ^TEMRInvertRgn;
  {$EXTERNALSYM tagEMRINVERTRGN}
  tagEMRINVERTRGN = record
    emr: TEMR;
    rclBounds: TRect; { Inclusive-inclusive bounds in device units }
    cbRgnData: DWORD; { Size of region data in bytes}
    RgnData: array[0..0] of Byte;
  end;
  TEMRInvertRgn = tagEMRINVERTRGN;
  {$EXTERNALSYM EMRINVERTRGN}
  EMRINVERTRGN = tagEMRINVERTRGN;
  EMRPaintRgn = TEMRInvertRgn;
  PEMRPaintRgn = PEMRInvertRgn;

  PEMRFillRgn = ^TEMRFillRgn;
  {$EXTERNALSYM tagEMRFILLRGN}
  tagEMRFILLRGN = record
    emr: TEMR;
    rclBounds: TRect;  { Inclusive-inclusive bounds in device units}
    cbRgnData: DWORD;  { Size of region data in bytes}
    ihBrush: DWORD;    { Brush handle index }
    RgnData: array[0..0] of Byte;
  end;
  TEMRFillRgn = tagEMRFILLRGN;
  {$EXTERNALSYM EMRFILLRGN}
  EMRFILLRGN = tagEMRFILLRGN;

  PEMRFrameRgn = ^TEMRFrameRgn;
  {$EXTERNALSYM tagEMRFRAMERGN}
  tagEMRFRAMERGN = record
    emr: TEMR;
    rclBounds: TRect;   { Inclusive-inclusive bounds in device units}
    cbRgnData: DWORD;   { Size of region data in bytes}
    ihBrush: DWORD;     { Brush handle index}
    szlStroke: TSize;
    RgnData: array[0..0] of Byte;
  end;
  TEMRFrameRgn = tagEMRFRAMERGN;
  {$EXTERNALSYM EMRFRAMERGN}
  EMRFRAMERGN = tagEMRFRAMERGN;

  PEMGradientFill = ^TEMGradientFill;
  {$EXTERNALSYM tagEMRGRADIENTFILL}
  tagEMRGRADIENTFILL = record
    emr: TEMR;
    rclBounds: TRect;   { Inclusive-inclusive bounds in device units}
    nVer: DWORD;
    nTri: DWORD;
    ulMode: ULONG;
    Ver: array[0..0] of TTriVertex;
  end;
  TEMGradientFill = tagEMRGRADIENTFILL;
  {$EXTERNALSYM EMRFRAMERGN}
  EMRGRADIENTFILL = tagEMRGRADIENTFILL;

  PEMRExtSelectClipRgn = ^TEMRExtSelectClipRgn;
  {$EXTERNALSYM tagEMREXTSELECTCLIPRGN}
  tagEMREXTSELECTCLIPRGN = record
    emr: TEMR;
    cbRgnData: DWORD; { Size of region data in bytes}
    iMode: DWORD;
    RgnData: array[0..0] of Byte;
  end;
  TEMRExtSelectClipRgn = tagEMREXTSELECTCLIPRGN;
  {$EXTERNALSYM EMREXTSELECTCLIPRGN}
  EMREXTSELECTCLIPRGN = tagEMREXTSELECTCLIPRGN;

  PEMRExtTextOut = ^TEMRExtTextOut;
  {$EXTERNALSYM tagEMREXTTEXTOUTA}
  tagEMREXTTEXTOUTA = packed record
    emr: TEMR;
    rclBounds: TRect;     { Inclusive-inclusive bounds in device units}
    iGraphicsMode: DWORD; { Current graphics mode}
    exScale: Single;       { X and Y scales from Page units to .01mm units}
    eyScale: Single;       {   if graphics mode is GM_COMPATIBLE.}
    emrtext: TEMRText;    { This is followed by the string and spacing array}
  end;
  TEMRExtTextOut = tagEMREXTTEXTOUTA;
  {$EXTERNALSYM EMREXTTEXTOUTA}
  EMREXTTEXTOUTA = tagEMREXTTEXTOUTA;

  PEMRPolyTextOut = ^TEMRPolyTextOut;
  {$EXTERNALSYM tagEMRPOLYTEXTOUTA}
  tagEMRPOLYTEXTOUTA = packed record
    emr: TEMR;
    rclBounds: TRect;     { Inclusive-inclusive bounds in device units}
    iGraphicsMode: DWORD; { Current graphics mode}
    exScale: Single;       { X and Y scales from Page units to .01mm units}
    eyScale: Single;       {   if graphics mode is GM_COMPATIBLE.}
    cStrings: Longint;
    aemrtext: array[0..0] of TEMRText; { array of TEMRText structures.  This is}
                                       { followed by the strings and spacing arrays.}
  end;
  TEMRPolyTextOut = tagEMRPOLYTEXTOUTA;
  {$EXTERNALSYM EMRPOLYTEXTOUTA}
  EMRPOLYTEXTOUTA = tagEMRPOLYTEXTOUTA;

  PEMRBitBlt = ^TEMRBitBlt;
  {$EXTERNALSYM tagEMRBITBLT}
  tagEMRBITBLT = packed record
    emr: TEMR;
    rclBounds: TRect;        { Inclusive-inclusive bounds in device units}
    xDest: Longint;
    yDest: Longint;
    cxDest: Longint;
    cyDest: Longint;
    dwRop: DWORD;
    xSrc: Longint;
    ySrc: Longint;
    xformSrc: TXForm;        { Source DC transform}
    crBkColorSrc: COLORREF; { Source DC BkColor in RGB}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
                             { (DIB_RGB_COLORS)}
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
  end;
  TEMRBitBlt = tagEMRBITBLT;
  {$EXTERNALSYM EMRBITBLT}
  EMRBITBLT = tagEMRBITBLT;

  PEMRStretchBlt = ^TEMRStretchBlt;
  {$EXTERNALSYM tagEMRSTRETCHBLT}
  tagEMRSTRETCHBLT = packed record
    emr: TEMR;
    rclBounds: TRect; { Inclusive-inclusive bounds in device units}
    xDest: Longint;
    yDest: Longint;
    cxDest: Longint;
    cyDest: Longint;
    dwRop: DWORD;
    xSrc: Longint;
    ySrc: Longint;
    xformSrc: TXForm;        { Source DC transform}
    crBkColorSrc: COLORREF; { Source DC BkColor in RGB}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
                             { (DIB_RGB_COLORS)}
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
    cxSrc: Longint;
    cySrc: Longint;
  end;
  TEMRStretchBlt = tagEMRSTRETCHBLT;
  {$EXTERNALSYM EMRSTRETCHBLT}
  EMRSTRETCHBLT = tagEMRSTRETCHBLT;

  PEMRMaskBlt = ^TEMRMaskBlt;
  {$EXTERNALSYM tagEMRMASKBLT}
  tagEMRMASKBLT = packed record
    emr: TEMR;
    rclBounds: TRect;        { Inclusive-inclusive bounds in device units}
    xDest: Longint;
    yDest: Longint;
    cxDest: Longint;
    cyDest: Longint;
    dwRop: DWORD;
    xSrc: Longint;
    ySrc: Longint;
    xformSrc: TXForm;        { Source DC transform}
    crBkColorSrc: COLORREF; { Source DC BkColor in RGB}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
                             { (DIB_RGB_COLORS)}
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
    xMask: Longint;
    yMask: Longint;
    iUsageMask: DWORD;       { Mask bitmap info color table usage}
    offBmiMask: DWORD;       { Offset to the mask TBitmapInfo structure if any}
    cbBmiMask: DWORD;        { Size of the mask TBitmapInfo structure if any}
    offBitsMask: DWORD;      { Offset to the mask bitmap bits if any}
    cbBitsMask: DWORD;       { Size of the mask bitmap bits if any}
  end;
  TEMRMaskBlt = tagEMRMASKBLT;
  {$EXTERNALSYM EMRMASKBLT}
  EMRMASKBLT = tagEMRMASKBLT;

  PEMRPLGBlt = ^TEMRPLGBlt;
  {$EXTERNALSYM tagEMRPLGBLT}
  tagEMRPLGBLT = packed record
    emr: TEMR;
    rclBounds: TRect;
    aptlDest: array[0..2] of TPoint;
    xSrc: Longint;
    ySrc: Longint;
    cxSrc: Longint;
    cySrc: Longint;
    xformSrc: TXForm;        { Source DC transform}
    crBkColorSrc: COLORREF; { Source DC BkColor in RGB}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
                             { (DIB_RGB_COLORS)}
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
    xMask: Longint;
    yMask: Longint;
    iUsageMask: DWORD;       { Mask bitmap info color table usage}
    offBmiMask: DWORD;       { Offset to the mask TBitmapInfo structure if any}
    cbBmiMask: DWORD;        { Size of the mask TBitmapInfo structure if any}
    offBitsMask: DWORD;      { Offset to the mask bitmap bits if any}
    cbBitsMask: DWORD;       { Size of the mask bitmap bits if any}
  end;
  TEMRPLGBlt = tagEMRPLGBLT;
  {$EXTERNALSYM EMRPLGBLT}
  EMRPLGBLT = tagEMRPLGBLT;

  PEMRSetDIBitsToDevice = ^TEMRSetDIBitsToDevice;
  {$EXTERNALSYM tagEMRSETDIBITSTODEVICE}
  tagEMRSETDIBITSTODEVICE = packed record
    emr: TEMR;
    rclBounds: TRect;
    xDest: Longint;
    yDest: Longint;
    xSrc: Longint;
    ySrc: Longint;
    cxSrc: Longint;
    cySrc: Longint;
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
    iStartScan: DWORD;
    cScans: DWORD;
  end;
  TEMRSetDIBitsToDevice = tagEMRSETDIBITSTODEVICE;
  {$EXTERNALSYM EMRSETDIBITSTODEVICE}
  EMRSETDIBITSTODEVICE = tagEMRSETDIBITSTODEVICE;

  PEMRStretchDIBits = ^TEMRStretchDIBits;
  {$EXTERNALSYM tagEMRSTRETCHDIBITS}
  tagEMRSTRETCHDIBITS = packed record
    emr: TEMR;
    rclBounds: TRect;
    xDest: Longint;
    yDest: Longint;
    xSrc: Longint;
    ySrc: Longint;
    cxSrc: Longint;
    cySrc: Longint;
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
    dwRop: DWORD;
    cxDest: Longint;
    cyDest: Longint;
  end;
  TEMRStretchDIBits = tagEMRSTRETCHDIBITS;
  {$EXTERNALSYM EMRSTRETCHDIBITS}
  EMRSTRETCHDIBITS = tagEMRSTRETCHDIBITS;

  PEMRAlphaBlend = ^TEMRAlphaBlend;
  {$EXTERNALSYM tagEMRALPHABLEND}
  tagEMRALPHABLEND = packed record
    emr: TEMR;
    rclBounds: TRect;
    xDest: Longint;
    yDest: Longint;
    cxDest: Longint;
    cyDest: Longint;
    dwRop: DWORD;
    xSrc: Longint;
    ySrc: Longint;
    xformSrc: XFORM;         { Source DC transform}
    crBkColorSrc: COLORREF;  { Source DC BkColor in RGB}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
    cxSrc: Longint;
    cySrc: Longint;
  end;
  TEMRAlphaBlend = tagEMRALPHABLEND;
  {$EXTERNALSYM EMRALPHABLEND}
  EMRALPHABLEND = tagEMRALPHABLEND;

  PEMRTransparentBLT = ^TEMRTransparentBLT;
  {$EXTERNALSYM tagEMRTRANSPARENTBLT}
  tagEMRTRANSPARENTBLT = packed record
    emr: TEMR;
    rclBounds: TRect;
    xDest: Longint;
    yDest: Longint;
    cxDest: Longint;
    cyDest: Longint;
    dwRop: DWORD;
    xSrc: Longint;
    ySrc: Longint;
    xformSrc: XFORM;         { Source DC transform}
    crBkColorSrc: COLORREF;  { Source DC BkColor in RGB}
    iUsageSrc: DWORD;        { Source bitmap info color table usage}
    offBmiSrc: DWORD;        { Offset to the source TBitmapInfo structure}
    cbBmiSrc: DWORD;         { Size of the source TBitmapInfo structure}
    offBitsSrc: DWORD;       { Offset to the source bitmap bits}
    cbBitsSrc: DWORD;        { Size of the source bitmap bits}
    cxSrc: Longint;
    cySrc: Longint;
  end;
  TEMRTransparentBLT = tagEMRTRANSPARENTBLT;
  {$EXTERNALSYM EMRTRANSPARENTBLT}
  EMRTRANSPARENTBLT = tagEMRTRANSPARENTBLT;

  PEMRExtCreateFontIndirect = ^TEMRExtCreateFontIndirect;
  {$EXTERNALSYM tagEMREXTCREATEFONTINDIRECTW}
  tagEMREXTCREATEFONTINDIRECTW = record
    emr: TEMR;
    ihFont: DWORD;     { Font handle index}
    elfw: TExtLogFontW;
  end;
  TEMRExtCreateFontIndirect = tagEMREXTCREATEFONTINDIRECTW;
  {$EXTERNALSYM EMREXTCREATEFONTINDIRECTW}
  EMREXTCREATEFONTINDIRECTW = tagEMREXTCREATEFONTINDIRECTW;

  PEMRCreatePalette = ^TEMRCreatePalette;
  {$EXTERNALSYM tagEMRCREATEPALETTE}
  tagEMRCREATEPALETTE = packed record
    emr: TEMR;
    ihPal: DWORD;        { Palette handle index}
    lgpl: TLogPalette;   { The peFlags fields in the palette entries}
                         { do not contain any flags}
  end;
  TEMRCreatePalette = tagEMRCREATEPALETTE;
  {$EXTERNALSYM EMRCREATEPALETTE}
  EMRCREATEPALETTE = tagEMRCREATEPALETTE;

  PEMRCreateColorSpace = ^TEMRCreateColorSpace;
  {$EXTERNALSYM tagEMRCREATECOLORSPACE}
  tagEMRCREATECOLORSPACE = packed record
    emr: TEMR;
    ihCS: DWORD;          { ColorSpace handle index}
    lcs: TLogColorSpaceW;
  end;
  TEMRCreateColorSpace = tagEMRCREATECOLORSPACE;
  {$EXTERNALSYM EMRCREATECOLORSPACE}
  EMRCREATECOLORSPACE = tagEMRCREATECOLORSPACE;

  PEMRCreatePen = ^TEMRCreatePen;
  {$EXTERNALSYM tagEMRCREATEPEN}
  tagEMRCREATEPEN = packed record
    emr: TEMR;
    ihPen: DWORD;   { Pen handle index}
    lopn: TLogPen;
  end;
  TEMRCreatePen = tagEMRCREATEPEN;
  {$EXTERNALSYM EMRCREATEPEN}
  EMRCREATEPEN = tagEMRCREATEPEN;

  PEMRExtCreatePen = ^TEMRExtCreatePen;
  {$EXTERNALSYM tagEMREXTCREATEPEN}
  tagEMREXTCREATEPEN = packed record
    emr: TEMR;
    ihPen: DWORD;      { Pen handle index}
    offBmi: DWORD;     { Offset to the TBitmapInfo structure if any}
    cbBmi: DWORD;      { Size of the TBitmapInfo structure if any}
                       { The bitmap info is followed by the bitmap}
                       { bits to form a packed DIB.}
    offBits: DWORD;    { Offset to the brush bitmap bits if any}
    cbBits: DWORD;     { Size of the brush bitmap bits if any}
    elp: TExtLogPen;   { The extended pen with the style array.}
  end;
  TEMRExtCreatePen = tagEMREXTCREATEPEN;
  {$EXTERNALSYM EMREXTCREATEPEN}
  EMREXTCREATEPEN = tagEMREXTCREATEPEN;

  PEMRCreateBrushIndirect = ^TEMRCreateBrushIndirect;
  {$EXTERNALSYM tagEMRCREATEBRUSHINDIRECT}
  tagEMRCREATEBRUSHINDIRECT = packed record
    emr: TEMR;
    ihBrush: DWORD; { Brush handle index}
    lb: TLogBrush;  { The style must be BS_SOLID, BS_HOLLOW,}
                    { BS_NULL or BS_HATCHED.}
  end;
  TEMRCreateBrushIndirect = tagEMRCREATEBRUSHINDIRECT;
  {$EXTERNALSYM EMRCREATEBRUSHINDIRECT}
  EMRCREATEBRUSHINDIRECT = tagEMRCREATEBRUSHINDIRECT;

  PEMRCreateMonoBrush = ^TEMRCreateMonoBrush;
  {$EXTERNALSYM tagEMRCREATEMONOBRUSH}
  tagEMRCREATEMONOBRUSH = packed record
    emr: TEMR;
    ihBrush: DWORD; { Brush handle index}
    iUsage: DWORD;  { Bitmap info color table usage}
    offBmi: DWORD;  { Offset to the TBitmapInfo structure}
    cbBmi: DWORD;   { Size of the TBitmapInfo structure if any}
                    { The bitmap info is followed by the bitmap}
                    { bits to form a packed DIB.}
    offBits: DWORD; { Offset to the bitmap bits}
    cbBits: DWORD;  { Size of the bitmap bits}
  end;
  TEMRCreateMonoBrush = tagEMRCREATEMONOBRUSH;
  {$EXTERNALSYM EMRCREATEMONOBRUSH}
  EMRCREATEMONOBRUSH = tagEMRCREATEMONOBRUSH;

  PEMRCreateDIBPatternBrushPt = ^TEMRCreateDIBPatternBrushPt;
  {$EXTERNALSYM tagEMRCREATEDIBPATTERNBRUSHPT}
  tagEMRCREATEDIBPATTERNBRUSHPT = packed record
    emr: TEMR;
    ihBrush: DWORD; { Brush handle index}
    iUsage: DWORD;  { Bitmap info color table usage}
    offBmi: DWORD;  { Offset to the TBitmapInfo structure}
    cbBmi: DWORD;   { Size of the TBitmapInfo structure if any}
                    { The bitmap info is followed by the bitmap}
                    { bits to form a packed DIB.}
    offBits: DWORD; { Offset to the bitmap bits}
    cbBits: DWORD;  { Size of the bitmap bits}
  end;
  TEMRCreateDIBPatternBrushPt = tagEMRCREATEDIBPATTERNBRUSHPT;
  {$EXTERNALSYM EMRCREATEDIBPATTERNBRUSHPT}
  EMRCREATEDIBPATTERNBRUSHPT = tagEMRCREATEDIBPATTERNBRUSHPT;

  PEMRFormat = ^TEMRFormat;
  {$EXTERNALSYM tagEMRFORMAT}
  tagEMRFORMAT = packed record
    dSignature: DWORD; { Format signature, e.g. ENHMETA_SIGNATURE.}
    nVersion: DWORD;   { Format version number.}
    cbData: DWORD;     { Size of data in bytes.}
    offData: DWORD;    { Offset to data from GDICOMMENT_IDENTIFIER.}
                       { It must begin at a DWORD offset.}
  end;
  TEMRFormat = tagEMRFORMAT;
  {$EXTERNALSYM EMRFORMAT}
  EMRFORMAT = tagEMRFORMAT;

  PEMRGLSRecord = ^TEMRGLSRecord;
  {$EXTERNALSYM tagEMRGLSRECORD}
  tagEMRGLSRECORD = packed record
    emr: TEMR;
    cbData: DWORD;              { Size of data in bytes }
    Data: packed array[0..0] of Byte;
  end;
  TEMRGLSRecord = tagEMRGLSRECORD;
  {$EXTERNALSYM EMRGLSRECORD}
  EMRGLSRECORD = tagEMRGLSRECORD;


  PEMRGLSBoundedRecord = ^TEMRGLSBoundedRecord;
  {$EXTERNALSYM tagEMRGLSBOUNDEDRECORD}
  tagEMRGLSBOUNDEDRECORD = packed record
    emr: TEMR;
    rclBounds: TRect;           { Bounds in recording coordinates }
    cbData: DWORD;              { Size of data in bytes }
    Data: packed array[0..0] of Byte;
  end;
  TEMRGLSBoundedRecord = tagEMRGLSBOUNDEDRECORD;
  {$EXTERNALSYM EMRGLSBOUNDEDRECORD}
  EMRGLSBOUNDEDRECORD = tagEMRGLSBOUNDEDRECORD;

  PEMRPixelFormat = ^TEMRPixelFormat;
  {$EXTERNALSYM tagEMRPIXELFORMAT}
  tagEMRPIXELFORMAT = packed record
    emr: TEMR;
    pfd: TPixelFormatDescriptor;
  end;
  TEMRPixelFormat = tagEMRPIXELFORMAT;
  {$EXTERNALSYM EMRPIXELFORMAT}
  EMRPIXELFORMAT = tagEMRPIXELFORMAT;

const
  {$EXTERNALSYM GDICOMMENT_IDENTIFIER}
  GDICOMMENT_IDENTIFIER = $43494447;
  {$EXTERNALSYM GDICOMMENT_WINDOWS_METAFILE}
  GDICOMMENT_WINDOWS_METAFILE = DWORD($80000001);
  {$EXTERNALSYM GDICOMMENT_BEGINGROUP}
  GDICOMMENT_BEGINGROUP = 2;
  {$EXTERNALSYM GDICOMMENT_ENDGROUP}
  GDICOMMENT_ENDGROUP = 3;
  {$EXTERNALSYM GDICOMMENT_MULTIFORMATS}
  GDICOMMENT_MULTIFORMATS = $40000004;
  {$EXTERNALSYM EPS_SIGNATURE}
  EPS_SIGNATURE = $46535045;

{ OpenGL wgl prototypes}

{$EXTERNALSYM wglCopyContext}
function wglCopyContext(p1: HGLRC; p2: HGLRC; p3: Cardinal): BOOL; stdcall;
{$EXTERNALSYM wglCreateContext}
function wglCreateContext(DC: HDC): HGLRC; stdcall;
{$EXTERNALSYM wglCreateLayerContext}
function wglCreateLayerContext(p1: HDC; p2: Integer): HGLRC; stdcall;
{$EXTERNALSYM wglDeleteContext}
function wglDeleteContext(p1: HGLRC): BOOL; stdcall;
{$EXTERNALSYM wglGetCurrentContext:}
function wglGetCurrentContext: HGLRC; stdcall;
{$EXTERNALSYM wglGetCurrentDC:}
function wglGetCurrentDC: HDC; stdcall;
{$EXTERNALSYM wglMakeCurrent}
function wglMakeCurrent(DC: HDC; p2: HGLRC): BOOL; stdcall;
{$EXTERNALSYM wglShareLists}
function wglShareLists(p1, p2: HGLRC): BOOL; stdcall;
{$EXTERNALSYM wglUseFontBitmapsA}
function wglUseFontBitmapsA(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall;
{$EXTERNALSYM wglUseFontBitmapsW}
function wglUseFontBitmapsW(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall;
{$EXTERNALSYM wglUseFontBitmaps}
function wglUseFontBitmaps(DC: HDC; p2, p3, p4: DWORD): BOOL; stdcall;
{$EXTERNALSYM SwapBuffers}
function SwapBuffers(DC: HDC): BOOL; stdcall;

type
  PPointFloat = ^TPointFloat;
  {$EXTERNALSYM _POINTFLOAT}
  _POINTFLOAT = packed record
    x: Single;
    y: Single;
  end;
  TPointFloat = _POINTFLOAT;
  {$EXTERNALSYM POINTFLOAT}
  POINTFLOAT = _POINTFLOAT;

  PGlyphMetricsFloat = ^TGlyphMetricsFloat;
  {$EXTERNALSYM _GLYPHMETRICSFLOAT}
  _GLYPHMETRICSFLOAT = packed record
    gmfBlackBoxX: Single;
    gmfBlackBoxY: Single;
    gmfptGlyphOrigin: TPointFloat;
    gmfCellIncX: Single;
    gmfCellIncY: Single;
  end;
  TGlyphMetricsFloat = _GLYPHMETRICSFLOAT;
  {$EXTERNALSYM GLYPHMETRICSFLOAT}
  GLYPHMETRICSFLOAT = _GLYPHMETRICSFLOAT;

const
  {$EXTERNALSYM WGL_FONT_LINES}
  WGL_FONT_LINES = 0;
  {$EXTERNALSYM WGL_FONT_POLYGONS}
  WGL_FONT_POLYGONS = 1;

{$EXTERNALSYM wglUseFontOutlinesA}
function wglUseFontOutlinesA(p1: HDC; p2, p3, p4: DWORD;
  p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall;
{$EXTERNALSYM wglUseFontOutlinesW}
function wglUseFontOutlinesW(p1: HDC; p2, p3, p4: DWORD;
  p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall;
{$EXTERNALSYM wglUseFontOutlines}
function wglUseFontOutlines(p1: HDC; p2, p3, p4: DWORD;
  p5, p6: Single; p7: Integer; p8: PGlyphMetricsFloat): BOOL; stdcall;

{ Layer plane descriptor }
type
  PLayerPlaneDescriptor = ^TLayerPlaneDescriptor;
  {$EXTERNALSYM tagLAYERPLANEDESCRIPTOR}
  tagLAYERPLANEDESCRIPTOR = packed record   { lpd }
    nSize: Word;
    nVersion: Word;
    dwFlags: DWORD;
    iPixelType: Byte;
    cColorBits: Byte;
    cRedBits: Byte;
    cRedShift: Byte;
    cGreenBits: Byte;
    cGreenShift: Byte;
    cBlueBits: Byte;
    cBlueShift: Byte;
    cAlphaBits: Byte;
    cAlphaShift: Byte;
    cAccumBits: Byte;
    cAccumRedBits: Byte;
    cAccumGreenBits: Byte;
    cAccumBlueBits: Byte;
    cAccumAlphaBits: Byte;
    cDepthBits: Byte;
    cStencilBits: Byte;
    cAuxBuffers: Byte;
    iLayerPlane: Byte;
    bReserved: Byte;
    crTransparent: COLORREF;
  end;
  TLayerPlaneDescriptor = tagLAYERPLANEDESCRIPTOR;
  {$EXTERNALSYM LAYERPLANEDESCRIPTOR}
  LAYERPLANEDESCRIPTOR = tagLAYERPLANEDESCRIPTOR;


{ TLayerPlaneDescriptor flags }
const
  {$EXTERNALSYM LPD_DOUBLEBUFFER}
  LPD_DOUBLEBUFFER = $00000001;
  {$EXTERNALSYM LPD_STEREO}
  LPD_STEREO = $00000002;
  {$EXTERNALSYM LPD_SUPPORT_GDI}
  LPD_SUPPORT_GDI = $00000010;
  {$EXTERNALSYM LPD_SUPPORT_OPENGL}
  LPD_SUPPORT_OPENGL = $00000020;
  {$EXTERNALSYM LPD_SHARE_DEPTH}
  LPD_SHARE_DEPTH = $00000040;
  {$EXTERNALSYM LPD_SHARE_STENCIL}
  LPD_SHARE_STENCIL = $00000080;
  {$EXTERNALSYM LPD_SHARE_ACCUM}
  LPD_SHARE_ACCUM = $00000100;
  {$EXTERNALSYM LPD_SWAP_EXCHANGE}
  LPD_SWAP_EXCHANGE = $00000200;
  {$EXTERNALSYM LPD_SWAP_COPY}
  LPD_SWAP_COPY = $00000400;
  {$EXTERNALSYM LPD_TRANSPARENT}
  LPD_TRANSPARENT = $00001000;

  {$EXTERNALSYM LPD_TYPE_RGBA}
  LPD_TYPE_RGBA = 0;
  {$EXTERNALSYM LPD_TYPE_COLORINDEX}
  LPD_TYPE_COLORINDEX = 1;

{ wglSwapLayerBuffers flags }
  {$EXTERNALSYM WGL_SWAP_MAIN_PLANE}
  WGL_SWAP_MAIN_PLANE = $00000001;
  {$EXTERNALSYM WGL_SWAP_OVERLAY1}
  WGL_SWAP_OVERLAY1 = $00000002;
  {$EXTERNALSYM WGL_SWAP_OVERLAY2}
  WGL_SWAP_OVERLAY2 = $00000004;
  {$EXTERNALSYM WGL_SWAP_OVERLAY3}
  WGL_SWAP_OVERLAY3 = $00000008;
  {$EXTERNALSYM WGL_SWAP_OVERLAY4}
  WGL_SWAP_OVERLAY4 = $00000010;
  {$EXTERNALSYM WGL_SWAP_OVERLAY5}
  WGL_SWAP_OVERLAY5 = $00000020;
  {$EXTERNALSYM WGL_SWAP_OVERLAY6}
  WGL_SWAP_OVERLAY6 = $00000040;
  {$EXTERNALSYM WGL_SWAP_OVERLAY7}
  WGL_SWAP_OVERLAY7 = $00000080;
  {$EXTERNALSYM WGL_SWAP_OVERLAY8}
  WGL_SWAP_OVERLAY8 = $00000100;
  {$EXTERNALSYM WGL_SWAP_OVERLAY9}
  WGL_SWAP_OVERLAY9 = $00000200;
  {$EXTERNALSYM WGL_SWAP_OVERLAY10}
  WGL_SWAP_OVERLAY10 = $00000400;
  {$EXTERNALSYM WGL_SWAP_OVERLAY11}
  WGL_SWAP_OVERLAY11 = $00000800;
  {$EXTERNALSYM WGL_SWAP_OVERLAY12}
  WGL_SWAP_OVERLAY12 = $00001000;
  {$EXTERNALSYM WGL_SWAP_OVERLAY13}
  WGL_SWAP_OVERLAY13 = $00002000;
  {$EXTERNALSYM WGL_SWAP_OVERLAY14}
  WGL_SWAP_OVERLAY14 = $00004000;
  {$EXTERNALSYM WGL_SWAP_OVERLAY15}
  WGL_SWAP_OVERLAY15 = $00008000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY1}
  WGL_SWAP_UNDERLAY1 = $00010000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY2}
  WGL_SWAP_UNDERLAY2 = $00020000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY3}
  WGL_SWAP_UNDERLAY3 = $00040000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY4}
  WGL_SWAP_UNDERLAY4 = $00080000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY5}
  WGL_SWAP_UNDERLAY5 = $00100000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY6}
  WGL_SWAP_UNDERLAY6 = $00200000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY7}
  WGL_SWAP_UNDERLAY7 = $00400000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY8}
  WGL_SWAP_UNDERLAY8 = $00800000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY9}
  WGL_SWAP_UNDERLAY9 = $01000000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY10}
  WGL_SWAP_UNDERLAY10 = $02000000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY11}
  WGL_SWAP_UNDERLAY11 = $04000000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY12}
  WGL_SWAP_UNDERLAY12 = $08000000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY13}
  WGL_SWAP_UNDERLAY13 = $10000000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY14}
  WGL_SWAP_UNDERLAY14 = $20000000;
  {$EXTERNALSYM WGL_SWAP_UNDERLAY15}
  WGL_SWAP_UNDERLAY15 = $40000000;

{$EXTERNALSYM wglDescribeLayerPlane}
function wglDescribeLayerPlane(p1: HDC; p2, p3: Integer; p4: Cardinal;
  var p5: TLayerPlaneDescriptor): BOOL; stdcall;
{$EXTERNALSYM wglSetLayerPaletteEntries}
function wglSetLayerPaletteEntries(p1: HDC; p2, p3, p4: Integer;
  var pcr): Integer; stdcall;
{$EXTERNALSYM wglGetLayerPaletteEntries}
function wglGetLayerPaletteEntries(p1: HDC; p2, p3, p4: Integer;
  var pcr): Integer; stdcall;
{$EXTERNALSYM wglRealizeLayerPalette}
function wglRealizeLayerPalette(p1: HDC; p2: Integer; p3: BOOL): BOOL; stdcall;
{$EXTERNALSYM wglSwapLayerBuffers}
function wglSwapLayerBuffers(p1: HDC; p2: Cardinal): BOOL; stdcall;

type
  PWGLSwap = ^TWGLSwap;
  {$EXTERNALSYM _WGLSWAP}
  _WGLSWAP = packed record
    hdc: HDC;
    uiFlags: UINT;
  end;
  TWGLSwap = _WGLSWAP;
  {$EXTERNALSYM WGLSWAP}
  WGLSWAP = _WGLSWAP;

const
  {$EXTERNALSYM WGL_SWAPMULTIPLE_MAX}
  WGL_SWAPMULTIPLE_MAX = 16;

{$EXTERNALSYM wglSwapMultipleBuffers}
function wglSwapMultipleBuffers(p1: UINT; const p2: PWGLSwap): DWORD; stdcall;

{ Translated from WINUSER.H }

type
  {$EXTERNALSYM HDWP}
  HDWP = THandle;
  PMENUTEMPLATE = Pointer;
  {$EXTERNALSYM va_list}
  va_list = PChar;

  TFNWndProc = TFarProc;
  TFNDlgProc = TFarProc;
  TFNTimerProc = TFarProc;
  TFNGrayStringProc = TFarProc;
  TFNWndEnumProc = TFarProc;
  TFNSendAsyncProc = TFarProc;
  TFNDrawStateProc = TFarProc;

  TFNHookProc = function (code: Integer; wparam: WPARAM; lparam: LPARAM): LRESULT stdcall;

type
  TFNPropEnumProc = TFarProc;
  TFNPropEnumProcEx = TFarProc;
  TFNEditWordBreakProc = TFarProc;
  TFNNameEnumProc = TFarProc;
  TFNWinStaEnumProc = TFNNameEnumProc;
  TFNDeskTopEnumProc = TFNNameEnumProc;

  MakeIntResourceA = PAnsiChar;
  MakeIntResourceW = PWideChar;
  MakeIntResource = MakeIntResourceA;

const
  { Predefined Resource Types }
  {$EXTERNALSYM RT_CURSOR}
  RT_CURSOR       = MakeIntResource(1);
  {$EXTERNALSYM RT_BITMAP}
  RT_BITMAP       = MakeIntResource(2);
  {$EXTERNALSYM RT_ICON}
  RT_ICON         = MakeIntResource(3);
  {$EXTERNALSYM RT_MENU}
  RT_MENU         = MakeIntResource(4);
  {$EXTERNALSYM RT_DIALOG}
  RT_DIALOG       = MakeIntResource(5);
  {$EXTERNALSYM RT_STRING}
  RT_STRING       = MakeIntResource(6);
  {$EXTERNALSYM RT_FONTDIR}
  RT_FONTDIR      = MakeIntResource(7);
  {$EXTERNALSYM RT_FONT}
  RT_FONT         = MakeIntResource(8);
  {$EXTERNALSYM RT_ACCELERATOR}
  RT_ACCELERATOR  = MakeIntResource(9);
  {$EXTERNALSYM RT_RCDATA}
  RT_RCDATA       = MakeIntResource(10);
  {$EXTERNALSYM RT_MESSAGETABLE}
  RT_MESSAGETABLE = MakeIntResource(11);

  {$EXTERNALSYM DIFFERENCE}
  DIFFERENCE = 11;

  {$EXTERNALSYM RT_GROUP_CURSOR}
  RT_GROUP_CURSOR = MakeIntResource(DWORD(RT_CURSOR + DIFFERENCE));
  {$EXTERNALSYM RT_GROUP_ICON}
  RT_GROUP_ICON   = MakeIntResource(DWORD(RT_ICON + DIFFERENCE));
  {$EXTERNALSYM RT_VERSION}
  RT_VERSION      = MakeIntResource(16);
  {$EXTERNALSYM RT_DLGINCLUDE}
  RT_DLGINCLUDE   = MakeIntResource(17);
  {$EXTERNALSYM RT_PLUGPLAY}
  RT_PLUGPLAY     = MakeIntResource(19);
  {$EXTERNALSYM RT_VXD}
  RT_VXD          = MakeIntResource(20);
  {$EXTERNALSYM RT_ANICURSOR}
  RT_ANICURSOR    = MakeIntResource(21);
  {$EXTERNALSYM RT_ANIICON}
  RT_ANIICON      = MakeIntResource(22);

{$EXTERNALSYM wvsprintfA}
function wvsprintfA(Output: PAnsiChar; Format: PAnsiChar; arglist: va_list): Integer; stdcall;
{$EXTERNALSYM wvsprintfW}
function wvsprintfW(Output: PWideChar; Format: PWideChar; arglist: va_list): Integer; stdcall;
{$EXTERNALSYM wvsprintf}
function wvsprintf(Output: PChar; Format: PChar; arglist: va_list): Integer; stdcall;
{$EXTERNALSYM wsprintfA}
function wsprintfA(Output: PAnsiChar; Format: PAnsiChar): Integer; stdcall;
{$EXTERNALSYM wsprintfW}
function wsprintfW(Output: PWideChar; Format: PWideChar): Integer; stdcall;
{$EXTERNALSYM wsprintf}
function wsprintf(Output: PChar; Format: PChar): Integer; stdcall;

const
  { Scroll Bar Constants }
  {$EXTERNALSYM SB_HORZ}
  SB_HORZ = 0;
  {$EXTERNALSYM SB_VERT}
  SB_VERT = 1;
  {$EXTERNALSYM SB_CTL}
  SB_CTL = 2;
  {$EXTERNALSYM SB_BOTH}
  SB_BOTH = 3;

  { Scroll Bar Commands }
  {$EXTERNALSYM SB_LINEUP}
  SB_LINEUP = 0;
  {$EXTERNALSYM SB_LINELEFT}
  SB_LINELEFT = 0;
  {$EXTERNALSYM SB_LINEDOWN}
  SB_LINEDOWN = 1;
  {$EXTERNALSYM SB_LINERIGHT}
  SB_LINERIGHT = 1;
  {$EXTERNALSYM SB_PAGEUP}
  SB_PAGEUP = 2;
  {$EXTERNALSYM SB_PAGELEFT}
  SB_PAGELEFT = 2;
  {$EXTERNALSYM SB_PAGEDOWN}
  SB_PAGEDOWN = 3;
  {$EXTERNALSYM SB_PAGERIGHT}
  SB_PAGERIGHT = 3;
  {$EXTERNALSYM SB_THUMBPOSITION}
  SB_THUMBPOSITION = 4;
  {$EXTERNALSYM SB_THUMBTRACK}
  SB_THUMBTRACK = 5;
  {$EXTERNALSYM SB_TOP}
  SB_TOP = 6;
  {$EXTERNALSYM SB_LEFT}
  SB_LEFT = 6;
  {$EXTERNALSYM SB_BOTTOM}
  SB_BOTTOM = 7;
  {$EXTERNALSYM SB_RIGHT}
  SB_RIGHT = 7;
  {$EXTERNALSYM SB_ENDSCROLL}
  SB_ENDSCROLL = 8;

  { ShowWindow() Commands }
  {$EXTERNALSYM SW_HIDE}
  SW_HIDE = 0;
  {$EXTERNALSYM SW_SHOWNORMAL}
  SW_SHOWNORMAL = 1;
  {$EXTERNALSYM SW_NORMAL}
  SW_NORMAL = 1;
  {$EXTERNALSYM SW_SHOWMINIMIZED}
  SW_SHOWMINIMIZED = 2;
  {$EXTERNALSYM SW_SHOWMAXIMIZED}
  SW_SHOWMAXIMIZED = 3;
  {$EXTERNALSYM SW_MAXIMIZE}
  SW_MAXIMIZE = 3;
  {$EXTERNALSYM SW_SHOWNOACTIVATE}
  SW_SHOWNOACTIVATE = 4;
  {$EXTERNALSYM SW_SHOW}
  SW_SHOW = 5;
  {$EXTERNALSYM SW_MINIMIZE}
  SW_MINIMIZE = 6;
  {$EXTERNALSYM SW_SHOWMINNOACTIVE}
  SW_SHOWMINNOACTIVE = 7;
  {$EXTERNALSYM SW_SHOWNA}
  SW_SHOWNA = 8;
  {$EXTERNALSYM SW_RESTORE}
  SW_RESTORE = 9;
  {$EXTERNALSYM SW_SHOWDEFAULT}
  SW_SHOWDEFAULT = 10;
  {$EXTERNALSYM SW_MAX}
  SW_MAX = 10;

  { Old ShowWindow() Commands }
  {$EXTERNALSYM HIDE_WINDOW}
  HIDE_WINDOW = 0;
  {$EXTERNALSYM SHOW_OPENWINDOW}
  SHOW_OPENWINDOW = 1;
  {$EXTERNALSYM SHOW_ICONWINDOW}
  SHOW_ICONWINDOW = 2;
  {$EXTERNALSYM SHOW_FULLSCREEN}
  SHOW_FULLSCREEN = 3;
  {$EXTERNALSYM SHOW_OPENNOACTIVATE}
  SHOW_OPENNOACTIVATE = 4;

  { Identifiers for the WM_SHOWWINDOW message }
  {$EXTERNALSYM SW_PARENTCLOSING}
  SW_PARENTCLOSING = 1;
  {$EXTERNALSYM SW_OTHERZOOM}
  SW_OTHERZOOM = 2;
  {$EXTERNALSYM SW_PARENTOPENING}
  SW_PARENTOPENING = 3;
  {$EXTERNALSYM SW_OTHERUNZOOM}
  SW_OTHERUNZOOM = 4;

  {$EXTERNALSYM AW_HOR_POSITIVE}
  AW_HOR_POSITIVE = $00000001;
  {$EXTERNALSYM AW_HOR_NEGATIVE}
  AW_HOR_NEGATIVE = $00000002;
  {$EXTERNALSYM AW_VER_POSITIVE}
  AW_VER_POSITIVE = $00000004;
  {$EXTERNALSYM AW_VER_NEGATIVE}
  AW_VER_NEGATIVE = $00000008;
  {$EXTERNALSYM AW_CENTER}
  AW_CENTER = $00000010;
  {$EXTERNALSYM AW_HIDE}
  AW_HIDE = $00010000;
  {$EXTERNALSYM AW_ACTIVATE}
  AW_ACTIVATE = $00020000;
  {$EXTERNALSYM AW_SLIDE}
  AW_SLIDE = $00040000;
  {$EXTERNALSYM AW_BLEND}
  AW_BLEND = $00040000;

  { WM_KEYUPDOWNCHAR HiWord(lParam) flags }
  {$EXTERNALSYM KF_EXTENDED}
  KF_EXTENDED = $100;
  {$EXTERNALSYM KF_DLGMODE}
  KF_DLGMODE = $800;
  {$EXTERNALSYM KF_MENUMODE}
  KF_MENUMODE = $1000;
  {$EXTERNALSYM KF_ALTDOWN}
  KF_ALTDOWN = $2000;
  {$EXTERNALSYM KF_REPEAT}
  KF_REPEAT = $4000;
  {$EXTERNALSYM KF_UP}
  KF_UP = $8000;

  { Virtual Keys, Standard Set }
  {$EXTERNALSYM VK_LBUTTON}
  VK_LBUTTON = 1;
  {$EXTERNALSYM VK_RBUTTON}
  VK_RBUTTON = 2;
  {$EXTERNALSYM VK_CANCEL}
  VK_CANCEL = 3;
  {$EXTERNALSYM VK_MBUTTON}
  VK_MBUTTON = 4;  { NOT contiguous with L & RBUTTON }
  {$EXTERNALSYM VK_BACK}
  VK_BACK = 8;
  {$EXTERNALSYM VK_TAB}
  VK_TAB = 9;
  {$EXTERNALSYM VK_CLEAR}
  VK_CLEAR = 12;
  {$EXTERNALSYM VK_RETURN}
  VK_RETURN = 13;
  {$EXTERNALSYM VK_SHIFT}
  VK_SHIFT = $10;
  {$EXTERNALSYM VK_CONTROL}
  VK_CONTROL = 17;
  {$EXTERNALSYM VK_MENU}
  VK_MENU = 18;
  {$EXTERNALSYM VK_PAUSE}
  VK_PAUSE = 19;
  {$EXTERNALSYM VK_CAPITAL}
  VK_CAPITAL = 20;
  {$EXTERNALSYM VK_KANA }
  VK_KANA = 21;
  {$EXTERNALSYM VK_HANGUL }
  VK_HANGUL = 21;
  {$EXTERNALSYM VK_JUNJA }
  VK_JUNJA = 23;
  {$EXTERNALSYM VK_FINAL }
  VK_FINAL = 24;
  {$EXTERNALSYM VK_HANJA }
  VK_HANJA = 25;
  {$EXTERNALSYM VK_KANJI }
  VK_KANJI = 25;
  {$EXTERNALSYM VK_CONVERT }
  VK_CONVERT = 28;
  {$EXTERNALSYM VK_NONCONVERT }
  VK_NONCONVERT = 29;
  {$EXTERNALSYM VK_ACCEPT }
  VK_ACCEPT = 30;
  {$EXTERNALSYM VK_MODECHANGE }
  VK_MODECHANGE = 31;
  {$EXTERNALSYM VK_ESCAPE}
  VK_ESCAPE = 27;
  {$EXTERNALSYM VK_SPACE}
  VK_SPACE = $20;
  {$EXTERNALSYM VK_PRIOR}
  VK_PRIOR = 33;
  {$EXTERNALSYM VK_NEXT}
  VK_NEXT = 34;
  {$EXTERNALSYM VK_END}
  VK_END = 35;
  {$EXTERNALSYM VK_HOME}
  VK_HOME = 36;
  {$EXTERNALSYM VK_LEFT}
  VK_LEFT = 37;
  {$EXTERNALSYM VK_UP}
  VK_UP = 38;
  {$EXTERNALSYM VK_RIGHT}
  VK_RIGHT = 39;
  {$EXTERNALSYM VK_DOWN}
  VK_DOWN = 40;
  {$EXTERNALSYM VK_SELECT}
  VK_SELECT = 41;
  {$EXTERNALSYM VK_PRINT}
  VK_PRINT = 42;
  {$EXTERNALSYM VK_EXECUTE}
  VK_EXECUTE = 43;
  {$EXTERNALSYM VK_SNAPSHOT}
  VK_SNAPSHOT = 44;
  {$EXTERNALSYM VK_INSERT}
  VK_INSERT = 45;
  {$EXTERNALSYM VK_DELETE}
  VK_DELETE = 46;
  {$EXTERNALSYM VK_HELP}
  VK_HELP = 47;
{ VK_0 thru VK_9 are the same as ASCII '0' thru '9' ($30 - $39) }
{ VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' ($41 - $5A) }
  {$EXTERNALSYM VK_LWIN}
  VK_LWIN = 91;
  {$EXTERNALSYM VK_RWIN}
  VK_RWIN = 92;
  {$EXTERNALSYM VK_APPS}
  VK_APPS = 93;
  {$EXTERNALSYM VK_NUMPAD0}
  VK_NUMPAD0 = 96;
  {$EXTERNALSYM VK_NUMPAD1}
  VK_NUMPAD1 = 97;
  {$EXTERNALSYM VK_NUMPAD2}
  VK_NUMPAD2 = 98;
  {$EXTERNALSYM VK_NUMPAD3}
  VK_NUMPAD3 = 99;
  {$EXTERNALSYM VK_NUMPAD4}
  VK_NUMPAD4 = 100;
  {$EXTERNALSYM VK_NUMPAD5}
  VK_NUMPAD5 = 101;
  {$EXTERNALSYM VK_NUMPAD6}
  VK_NUMPAD6 = 102;
  {$EXTERNALSYM VK_NUMPAD7}
  VK_NUMPAD7 = 103;
  {$EXTERNALSYM VK_NUMPAD8}
  VK_NUMPAD8 = 104;
  {$EXTERNALSYM VK_NUMPAD9}
  VK_NUMPAD9 = 105;
  {$EXTERNALSYM VK_MULTIPLY}
  VK_MULTIPLY = 106;
  {$EXTERNALSYM VK_ADD}
  VK_ADD = 107;
  {$EXTERNALSYM VK_SEPARATOR}
  VK_SEPARATOR = 108;
  {$EXTERNALSYM VK_SUBTRACT}
  VK_SUBTRACT = 109;
  {$EXTERNALSYM VK_DECIMAL}
  VK_DECIMAL = 110;
  {$EXTERNALSYM VK_DIVIDE}
  VK_DIVIDE = 111;
  {$EXTERNALSYM VK_F1}
  VK_F1 = 112;
  {$EXTERNALSYM VK_F2}
  VK_F2 = 113;
  {$EXTERNALSYM VK_F3}
  VK_F3 = 114;
  {$EXTERNALSYM VK_F4}
  VK_F4 = 115;
  {$EXTERNALSYM VK_F5}
  VK_F5 = 116;
  {$EXTERNALSYM VK_F6}
  VK_F6 = 117;
  {$EXTERNALSYM VK_F7}
  VK_F7 = 118;
  {$EXTERNALSYM VK_F8}
  VK_F8 = 119;
  {$EXTERNALSYM VK_F9}
  VK_F9 = 120;
  {$EXTERNALSYM VK_F10}
  VK_F10 = 121;
  {$EXTERNALSYM VK_F11}
  VK_F11 = 122;
  {$EXTERNALSYM VK_F12}
  VK_F12 = 123;
  {$EXTERNALSYM VK_F13}
  VK_F13 = 124;
  {$EXTERNALSYM VK_F14}
  VK_F14 = 125;
  {$EXTERNALSYM VK_F15}
  VK_F15 = 126;
  {$EXTERNALSYM VK_F16}
  VK_F16 = 127;
  {$EXTERNALSYM VK_F17}
  VK_F17 = 128;
  {$EXTERNALSYM VK_F18}
  VK_F18 = 129;
  {$EXTERNALSYM VK_F19}
  VK_F19 = 130;
  {$EXTERNALSYM VK_F20}
  VK_F20 = 131;
  {$EXTERNALSYM VK_F21}
  VK_F21 = 132;
  {$EXTERNALSYM VK_F22}
  VK_F22 = 133;
  {$EXTERNALSYM VK_F23}
  VK_F23 = 134;
  {$EXTERNALSYM VK_F24}
  VK_F24 = 135;
  {$EXTERNALSYM VK_NUMLOCK}
  VK_NUMLOCK = 144;
  {$EXTERNALSYM VK_SCROLL}
  VK_SCROLL = 145;
{ VK_L & VK_R - left and right Alt, Ctrl and Shift virtual keys.
  Used only as parameters to GetAsyncKeyState() and GetKeyState().
  No other API or message will distinguish left and right keys in this way. }
  {$EXTERNALSYM VK_LSHIFT}
  VK_LSHIFT = 160;
  {$EXTERNALSYM VK_RSHIFT}
  VK_RSHIFT = 161;
  {$EXTERNALSYM VK_LCONTROL}
  VK_LCONTROL = 162;
  {$EXTERNALSYM VK_RCONTROL}
  VK_RCONTROL = 163;
  {$EXTERNALSYM VK_LMENU}
  VK_LMENU = 164;
  {$EXTERNALSYM VK_RMENU}
  VK_RMENU = 165;
  {$EXTERNALSYM VK_PROCESSKEY}
  VK_PROCESSKEY = 229;
  {$EXTERNALSYM VK_ATTN}
  VK_ATTN = 246;
  {$EXTERNALSYM VK_CRSEL}
  VK_CRSEL = 247;
  {$EXTERNALSYM VK_EXSEL}
  VK_EXSEL = 248;
  {$EXTERNALSYM VK_EREOF}
  VK_EREOF = 249;
  {$EXTERNALSYM VK_PLAY}
  VK_PLAY = 250;
  {$EXTERNALSYM VK_ZOOM}
  VK_ZOOM = 251;
  {$EXTERNALSYM VK_NONAME}
  VK_NONAME = 252;
  {$EXTERNALSYM VK_PA1}
  VK_PA1 = 253;
  {$EXTERNALSYM VK_OEM_CLEAR}
  VK_OEM_CLEAR = 254;


  { SetWindowsHook() codes }
  {$EXTERNALSYM WH_MIN}
  WH_MIN = -1;
  {$EXTERNALSYM WH_MSGFILTER}
  WH_MSGFILTER = -1;
  {$EXTERNALSYM WH_JOURNALRECORD}
  WH_JOURNALRECORD = 0;
  {$EXTERNALSYM WH_JOURNALPLAYBACK}
  WH_JOURNALPLAYBACK = 1;
  {$EXTERNALSYM WH_KEYBOARD}
  WH_KEYBOARD = 2;
  {$EXTERNALSYM WH_GETMESSAGE}
  WH_GETMESSAGE = 3;
  {$EXTERNALSYM WH_CALLWNDPROC}
  WH_CALLWNDPROC = 4;
  {$EXTERNALSYM WH_CBT}
  WH_CBT = 5;
  {$EXTERNALSYM WH_SYSMSGFILTER}
  WH_SYSMSGFILTER = 6;
  {$EXTERNALSYM WH_MOUSE}
  WH_MOUSE = 7;
  {$EXTERNALSYM WH_HARDWARE}
  WH_HARDWARE = 8;
  {$EXTERNALSYM WH_DEBUG}
  WH_DEBUG = 9;
  {$EXTERNALSYM WH_SHELL}
  WH_SHELL = 10;
  {$EXTERNALSYM WH_FOREGROUNDIDLE}
  WH_FOREGROUNDIDLE = 11;
  {$EXTERNALSYM WH_CALLWNDPROCRET}
  WH_CALLWNDPROCRET = 12;
  {$EXTERNALSYM WH_MAX}
  WH_MAX = 12;
  {$EXTERNALSYM WH_MINHOOK}
  WH_MINHOOK = WH_MIN;
  {$EXTERNALSYM WH_MAXHOOK}
  WH_MAXHOOK = WH_MAX;

  { Hook Codes }
  {$EXTERNALSYM HC_ACTION}
  HC_ACTION = 0;
  {$EXTERNALSYM HC_GETNEXT}
  HC_GETNEXT = 1;
  {$EXTERNALSYM HC_SKIP}
  HC_SKIP = 2;
  {$EXTERNALSYM HC_NOREMOVE}
  HC_NOREMOVE = 3;
  {$EXTERNALSYM HC_NOREM}
  HC_NOREM = HC_NOREMOVE;
  {$EXTERNALSYM HC_SYSMODALON}
  HC_SYSMODALON = 4;
  {$EXTERNALSYM HC_SYSMODALOFF}
  HC_SYSMODALOFF = 5;

  { CBT Hook Codes }
  {$EXTERNALSYM HCBT_MOVESIZE}
  HCBT_MOVESIZE = 0;
  {$EXTERNALSYM HCBT_MINMAX}
  HCBT_MINMAX = 1;
  {$EXTERNALSYM HCBT_QS}
  HCBT_QS = 2;
  {$EXTERNALSYM HCBT_CREATEWND}
  HCBT_CREATEWND = 3;
  {$EXTERNALSYM HCBT_DESTROYWND}
  HCBT_DESTROYWND = 4;
  {$EXTERNALSYM HCBT_ACTIVATE}
  HCBT_ACTIVATE = 5;
  {$EXTERNALSYM HCBT_CLICKSKIPPED}
  HCBT_CLICKSKIPPED = 6;
  {$EXTERNALSYM HCBT_KEYSKIPPED}
  HCBT_KEYSKIPPED = 7;
  {$EXTERNALSYM HCBT_SYSCOMMAND}
  HCBT_SYSCOMMAND = 8;
  {$EXTERNALSYM HCBT_SETFOCUS}
  HCBT_SETFOCUS = 9;


type
  PCreateStructA = ^TCreateStructA;
  PCreateStructW = ^TCreateStructW;
  PCreateStruct = PCreateStructA;
  {$EXTERNALSYM tagCREATESTRUCTA}
  tagCREATESTRUCTA = packed record
    lpCreateParams: Pointer;
    hInstance: HINST;
    hMenu: HMENU;
    hwndParent: HWND;
    cy: Integer;
    cx: Integer;
    y: Integer;
    x: Integer;
    style: Longint;
    lpszName: PAnsiChar;
    lpszClass: PAnsiChar;
    dwExStyle: DWORD;
  end;
  {$EXTERNALSYM tagCREATESTRUCTW}
  tagCREATESTRUCTW = packed record
    lpCreateParams: Pointer;
    hInstance: HINST;
    hMenu: HMENU;
    hwndParent: HWND;
    cy: Integer;
    cx: Integer;
    y: Integer;
    x: Integer;
    style: Longint;
    lpszName: PWideChar;
    lpszClass: PWideChar;
    dwExStyle: DWORD;
  end;
  {$EXTERNALSYM tagCREATESTRUCT}
  tagCREATESTRUCT = tagCREATESTRUCTA;
  TCreateStructA = tagCREATESTRUCTA;
  TCreateStructW = tagCREATESTRUCTW;
  TCreateStruct = TCreateStructA;
  {$EXTERNALSYM CREATESTRUCTA}
  CREATESTRUCTA = tagCREATESTRUCTA;
  {$EXTERNALSYM CREATESTRUCTW}
  CREATESTRUCTW = tagCREATESTRUCTW;
  {$EXTERNALSYM CREATESTRUCT}
  CREATESTRUCT = CREATESTRUCTA;

  { HCBT_CREATEWND parameters pointed to by lParam }
  PCBTCreateWnd = ^TCBTCreateWnd;
  {$EXTERNALSYM tagCBT_CREATEWNDA}
  tagCBT_CREATEWNDA = packed record
    lpcs: PCreateStruct;
    hwndInsertAfter: HWND;
  end;
  TCBTCreateWnd = tagCBT_CREATEWNDA;
  {$EXTERNALSYM CBT_CREATEWND}
  CBT_CREATEWND = tagCBT_CREATEWNDA;

  { HCBT_ACTIVATE structure pointed to by lParam }
  PCBTActivateStruct = ^TCBTActivateStruct;
  {$EXTERNALSYM tagCBTACTIVATESTRUCT}
  tagCBTACTIVATESTRUCT = packed record
    fMouse: BOOL;
    hWndActive: HWND;
  end;
  TCBTActivateStruct = tagCBTACTIVATESTRUCT;
  {$EXTERNALSYM CBTACTIVATESTRUCT}
  CBTACTIVATESTRUCT = tagCBTACTIVATESTRUCT;

const
  { WH_MSGFILTER Filter Proc Codes }
  {$EXTERNALSYM MSGF_DIALOGBOX}
  MSGF_DIALOGBOX = 0;
  {$EXTERNALSYM MSGF_MESSAGEBOX}
  MSGF_MESSAGEBOX = 1;
  {$EXTERNALSYM MSGF_MENU}
  MSGF_MENU = 2;
  {$EXTERNALSYM MSGF_MOVE}
  MSGF_MOVE = 3;
  {$EXTERNALSYM MSGF_SIZE}
  MSGF_SIZE = 4;
  {$EXTERNALSYM MSGF_SCROLLBAR}
  MSGF_SCROLLBAR = 5;
  {$EXTERNALSYM MSGF_NEXTWINDOW}
  MSGF_NEXTWINDOW = 6;
  {$EXTERNALSYM MSGF_MAINLOOP}
  MSGF_MAINLOOP = 8;
  {$EXTERNALSYM MSGF_MAX}
  MSGF_MAX = 8;
  {$EXTERNALSYM MSGF_USER}
  MSGF_USER = $1000;

  { Shell support }
  {$EXTERNALSYM HSHELL_WINDOWCREATED}
  HSHELL_WINDOWCREATED = 1;
  {$EXTERNALSYM HSHELL_WINDOWDESTROYED}
  HSHELL_WINDOWDESTROYED = 2;
  {$EXTERNALSYM HSHELL_ACTIVATESHELLWINDOW}
  HSHELL_ACTIVATESHELLWINDOW = 3;
  {$EXTERNALSYM HSHELL_WINDOWACTIVATED}
  HSHELL_WINDOWACTIVATED = 4;
  {$EXTERNALSYM HSHELL_GETMINRECT}
  HSHELL_GETMINRECT = 5;
  {$EXTERNALSYM HSHELL_REDRAW}
  HSHELL_REDRAW = 6;
  {$EXTERNALSYM HSHELL_TASKMAN}
  HSHELL_TASKMAN = 7;
  {$EXTERNALSYM HSHELL_LANGUAGE}
  HSHELL_LANGUAGE = 8;
  {$EXTERNALSYM HSHELL_ACCESSIBILITYSTATE}
  HSHELL_ACCESSIBILITYSTATE = 11;
  {$EXTERNALSYM ACCESS_STICKYKEYS}
  ACCESS_STICKYKEYS = $0001;
  {$EXTERNALSYM ACCESS_FILTERKEYS}
  ACCESS_FILTERKEYS = $0002;
  {$EXTERNALSYM ACCESS_MOUSEKEYS}
  ACCESS_MOUSEKEYS = $0003;


type
  { Message Structure used in Journaling }
  PEventMsg = ^TEventMsg;
  {$EXTERNALSYM tagEVENTMSG}
  tagEVENTMSG = packed record
    message: UINT;
    paramL: UINT;
    paramH: UINT;
    time: DWORD;
    hwnd: HWND;
  end;
  TEventMsg = tagEVENTMSG;
  {$EXTERNALSYM EVENTMSG}
  EVENTMSG = tagEVENTMSG;

  { Message structure used by WH_CALLWNDPROC }
  PCWPStruct = ^TCWPStruct;
  {$EXTERNALSYM tagCWPSTRUCT}
  tagCWPSTRUCT = packed record
    lParam: LPARAM;
    wParam: WPARAM;
    message: UINT;
    hwnd: HWND;
  end;
  TCWPStruct = tagCWPSTRUCT;
  {$EXTERNALSYM CWPSTRUCT}
  CWPSTRUCT = tagCWPSTRUCT;

  { Message structure used by WH_CALLWNDPROCRET }
  PCWPRetStruct = ^TCWPRetStruct;
  {$EXTERNALSYM tagCWPRETSTRUCT}
  tagCWPRETSTRUCT = packed record
    lResult: LRESULT;
    lParam: LPARAM;
    wParam: WPARAM;
    message: UINT;
    hwnd: HWND;
  end;
  TCWPRetStruct = tagCWPRETSTRUCT;
  {$EXTERNALSYM CWPRETSTRUCT}
  CWPRETSTRUCT = tagCWPRETSTRUCT;

  { Structure used by WH_DEBUG }
  PDebugHookInfo = ^TDebugHookInfo;
  {$EXTERNALSYM tagDEBUGHOOKINFO}
  tagDEBUGHOOKINFO = packed record
    idThread: DWORD;
    idThreadInstaller: DWORD;
    lParam: LPARAM;
    wParam: WPARAM;
    code: Integer;
  end;
  TDebugHookInfo = tagDEBUGHOOKINFO;
  {$EXTERNALSYM DEBUGHOOKINFO}
  DEBUGHOOKINFO = tagDEBUGHOOKINFO;

  { Structure used by WH_MOUSE }
  PMouseHookStruct = ^TMouseHookStruct;
  {$EXTERNALSYM tagMOUSEHOOKSTRUCT}
  tagMOUSEHOOKSTRUCT = packed record
    pt: TPoint;
    hwnd: HWND;
    wHitTestCode: UINT;
    dwExtraInfo: DWORD;
  end;
  TMouseHookStruct = tagMOUSEHOOKSTRUCT;
  {$EXTERNALSYM MOUSEHOOKSTRUCT}
  MOUSEHOOKSTRUCT = tagMOUSEHOOKSTRUCT;

  { Structure used by WH_HARDWARE }
  PHardwareHookStruct = ^THardwareHookStruct;
  {$EXTERNALSYM tagHARDWAREHOOKSTRUCT}
  tagHARDWAREHOOKSTRUCT = packed record
    hwnd: HWND;
    message: UINT;
    wParam: WPARAM;
    lParam: LPARAM;
  end;
  THardwareHookStruct = tagHARDWAREHOOKSTRUCT;
  {$EXTERNALSYM HARDWAREHOOKSTRUCT}
  HARDWAREHOOKSTRUCT = tagHARDWAREHOOKSTRUCT;

const
  { Keyboard Layout API }
  {$EXTERNALSYM HKL_PREV}
  HKL_PREV = 0;
  {$EXTERNALSYM HKL_NEXT}
  HKL_NEXT = 1;

  {$EXTERNALSYM KLF_ACTIVATE}
  KLF_ACTIVATE = 1;
  {$EXTERNALSYM KLF_SUBSTITUTE_OK}
  KLF_SUBSTITUTE_OK = 2;
  {$EXTERNALSYM KLF_UNLOADPREVIOUS}
  KLF_UNLOADPREVIOUS = 4;
  {$EXTERNALSYM KLF_REORDER}
  KLF_REORDER = 8;
  {$EXTERNALSYM KLF_REPLACELANG}
  KLF_REPLACELANG = $10;
  {$EXTERNALSYM KLF_NOTELLSHELL}
  KLF_NOTELLSHELL = 128;

  { Size of KeyboardLayoutName (number of characters), including nul terminator }
  {$EXTERNALSYM KL_NAMELENGTH}
  KL_NAMELENGTH = 9;


{$EXTERNALSYM LoadKeyboardLayoutA}
function LoadKeyboardLayoutA(pwszKLID: PAnsiChar; Flags: UINT): HKL; stdcall;
{$EXTERNALSYM LoadKeyboardLayoutW}
function LoadKeyboardLayoutW(pwszKLID: PWideChar; Flags: UINT): HKL; stdcall;
{$EXTERNALSYM LoadKeyboardLayout}
function LoadKeyboardLayout(pwszKLID: PChar; Flags: UINT): HKL; stdcall;
{$EXTERNALSYM ActivateKeyboardLayout}
function ActivateKeyboardLayout(hkl: HKL; Flags: UINT): HKL; stdcall;
{$EXTERNALSYM UnloadKeyboardLayout}
function UnloadKeyboardLayout(hkl: HKL): BOOL; stdcall;
{$EXTERNALSYM ToUnicodeEx}
function ToUnicodeEx(wVirtKey, wScanCode: UINT; lpKeyState: PByte;
  pwszBuff: PWideChar; cchBuff: Integer; wFlags: UINT; dwhkl: HKL): Integer; stdcall;
{$EXTERNALSYM GetKeyboardLayoutNameA}
function GetKeyboardLayoutNameA(pwszKLID: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM GetKeyboardLayoutNameW}
function GetKeyboardLayoutNameW(pwszKLID: PWideChar): BOOL; stdcall;
{$EXTERNALSYM GetKeyboardLayoutName}
function GetKeyboardLayoutName(pwszKLID: PChar): BOOL; stdcall;
{$EXTERNALSYM GetKeyboardLayoutList}
function GetKeyboardLayoutList(nBuff: Integer; var List): UINT; stdcall;
{$EXTERNALSYM GetKeyboardLayout}
function GetKeyboardLayout(dwLayout: DWORD): HKL; stdcall;

type
  PMouseMovePoint = ^TMouseMovePoint;
  {$EXTERNALSYM tagMOUSEMOVEPOINT}
  tagMOUSEMOVEPOINT = packed record
    x: Integer;
    y: Integer;
    time: DWORD;
    dwExtraInfo: DWORD;
  end;
  TMouseMovePoint = tagMOUSEMOVEPOINT;
  {$EXTERNALSYM MOUSEMOVEPOINT}
  MOUSEMOVEPOINT = tagMOUSEMOVEPOINT;

const
  { Values for resolution parameter of GetMouseMovePoints }
  {$EXTERNALSYM GMMP_USE_DISPLAY_POINTS}
  GMMP_USE_DISPLAY_POINTS = 1;
  {$EXTERNALSYM GMMP_USE_DRIVER_POINTS}
  GMMP_USE_DRIVER_POINTS = 2;

{$EXTERNALSYM GetMouseMovePoints}
function GetMouseMovePoints(cbSize: UINT; var lppt, lpptBuf: TMouseMovePoint; nBufPoints: Integer;
  resolution: DWORD): Integer; stdcall;


const
  { Desktop-specific access flags }
  {$EXTERNALSYM DESKTOP_READOBJECTS}
  DESKTOP_READOBJECTS = 1;
  {$EXTERNALSYM DESKTOP_CREATEWINDOW}
  DESKTOP_CREATEWINDOW = 2;
  {$EXTERNALSYM DESKTOP_CREATEMENU}
  DESKTOP_CREATEMENU = 4;
  {$EXTERNALSYM DESKTOP_HOOKCONTROL}
  DESKTOP_HOOKCONTROL = 8;
  {$EXTERNALSYM DESKTOP_JOURNALRECORD}
  DESKTOP_JOURNALRECORD = $10;
  {$EXTERNALSYM DESKTOP_JOURNALPLAYBACK}
  DESKTOP_JOURNALPLAYBACK = $20;
  {$EXTERNALSYM DESKTOP_ENUMERATE}
  DESKTOP_ENUMERATE = $40;
  {$EXTERNALSYM DESKTOP_WRITEOBJECTS}
  DESKTOP_WRITEOBJECTS = 128;
  {$EXTERNALSYM DESKTOP_SWITCHDESKTOP}
  DESKTOP_SWITCHDESKTOP = $100;

  { Desktop-specific control flags }
  {$EXTERNALSYM DF_ALLOWOTHERACCOUNTHOOK}
  DF_ALLOWOTHERACCOUNTHOOK = 1;


{$EXTERNALSYM CreateDesktopA}
function CreateDesktopA(lpszDesktop, lpszDevice: PAnsiChar;
  pDevmode: PDeviceModeA; dwFlags: DWORD; dwDesiredAccess:
  DWORD; lpsa: PSecurityAttributes): HDESK; stdcall;
{$EXTERNALSYM CreateDesktopW}
function CreateDesktopW(lpszDesktop, lpszDevice: PWideChar;
  pDevmode: PDeviceModeW; dwFlags: DWORD; dwDesiredAccess:
  DWORD; lpsa: PSecurityAttributes): HDESK; stdcall;
{$EXTERNALSYM CreateDesktop}
function CreateDesktop(lpszDesktop, lpszDevice: PChar;
  pDevmode: PDeviceMode; dwFlags: DWORD; dwDesiredAccess:
  DWORD; lpsa: PSecurityAttributes): HDESK; stdcall;
{$EXTERNALSYM OpenDesktopA}
function OpenDesktopA(lpszDesktop: PAnsiChar; dwFlags: DWORD; fInherit: BOOL;
  dwDesiredAccess: DWORD): HDESK; stdcall;
{$EXTERNALSYM OpenDesktopW}
function OpenDesktopW(lpszDesktop: PWideChar; dwFlags: DWORD; fInherit: BOOL;
  dwDesiredAccess: DWORD): HDESK; stdcall;
{$EXTERNALSYM OpenDesktop}
function OpenDesktop(lpszDesktop: PChar; dwFlags: DWORD; fInherit: BOOL;
  dwDesiredAccess: DWORD): HDESK; stdcall;
{$EXTERNALSYM EnumDesktopsA}
function EnumDesktopsA(hwinsta: HWINSTA; lpEnumFunc: TFNDeskTopEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumDesktopsW}
function EnumDesktopsW(hwinsta: HWINSTA; lpEnumFunc: TFNDeskTopEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumDesktops}
function EnumDesktops(hwinsta: HWINSTA; lpEnumFunc: TFNDeskTopEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM OpenInputDesktop}
function OpenInputDesktop(dwFlags: DWORD; fInherit: BOOL; dwDesiredAccess: DWORD): HDESK; stdcall;
{$EXTERNALSYM EnumDesktopWindows}
function EnumDesktopWindows(hDesktop: HDESK; lpfn: TFNWndEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM SwitchDesktop}
function SwitchDesktop(hDesktop: HDESK): BOOL; stdcall;
{$EXTERNALSYM SetThreadDesktop}
function SetThreadDesktop(hDesktop: HDESK): BOOL; stdcall;
{$EXTERNALSYM CloseDesktop}
function CloseDesktop(hDesktop: HDESK): BOOL; stdcall;
{$EXTERNALSYM GetThreadDesktop}
function GetThreadDesktop(dwThreadId: DWORD): HDESK; stdcall;

const
  { Windowstation-specific access flags }
  {$EXTERNALSYM WINSTA_ENUMDESKTOPS}
  WINSTA_ENUMDESKTOPS = 1;
  {$EXTERNALSYM WINSTA_READATTRIBUTES}
  WINSTA_READATTRIBUTES = 2;
  {$EXTERNALSYM WINSTA_ACCESSCLIPBOARD}
  WINSTA_ACCESSCLIPBOARD = 4;
  {$EXTERNALSYM WINSTA_CREATEDESKTOP}
  WINSTA_CREATEDESKTOP = 8;
  {$EXTERNALSYM WINSTA_WRITEATTRIBUTES}
  WINSTA_WRITEATTRIBUTES = $10;
  {$EXTERNALSYM WINSTA_ACCESSGLOBALATOMS}
  WINSTA_ACCESSGLOBALATOMS = $20;
  {$EXTERNALSYM WINSTA_EXITWINDOWS}
  WINSTA_EXITWINDOWS = $40;
  {$EXTERNALSYM WINSTA_ENUMERATE}
  WINSTA_ENUMERATE = $100;
  {$EXTERNALSYM WINSTA_READSCREEN}
  WINSTA_READSCREEN = $200;

  { Windowstation-specific attribute flags }
  {$EXTERNALSYM WSF_VISIBLE}
  WSF_VISIBLE = 1;

{$EXTERNALSYM CreateWindowStationA}
function CreateWindowStationA(lpwinsta: PAnsiChar; dwReserved, dwDesiredAccess: DWORD;
  lpsa: PSecurityAttributes): HWINSTA; stdcall;
{$EXTERNALSYM CreateWindowStationW}
function CreateWindowStationW(lpwinsta: PWideChar; dwReserved, dwDesiredAccess: DWORD;
  lpsa: PSecurityAttributes): HWINSTA; stdcall;
{$EXTERNALSYM CreateWindowStation}
function CreateWindowStation(lpwinsta: PChar; dwReserved, dwDesiredAccess: DWORD;
  lpsa: PSecurityAttributes): HWINSTA; stdcall;
{$EXTERNALSYM OpenWindowStationA}
function OpenWindowStationA(lpszWinSta: PAnsiChar; fInherit: BOOL;
  dwDesiredAccess: DWORD): HWINSTA; stdcall;
{$EXTERNALSYM OpenWindowStationW}
function OpenWindowStationW(lpszWinSta: PWideChar; fInherit: BOOL;
  dwDesiredAccess: DWORD): HWINSTA; stdcall;
{$EXTERNALSYM OpenWindowStation}
function OpenWindowStation(lpszWinSta: PChar; fInherit: BOOL;
  dwDesiredAccess: DWORD): HWINSTA; stdcall;
{$EXTERNALSYM EnumWindowStationsA}
function EnumWindowStationsA(lpEnumFunc: TFNWinStaEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumWindowStationsW}
function EnumWindowStationsW(lpEnumFunc: TFNWinStaEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumWindowStations}
function EnumWindowStations(lpEnumFunc: TFNWinStaEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM CloseWindowStation}
function CloseWindowStation(hWinSta: HWINSTA): BOOL; stdcall;
{$EXTERNALSYM SetProcessWindowStation}
function SetProcessWindowStation(hWinSta: HWINSTA): BOOL; stdcall;
{$EXTERNALSYM GetProcessWindowStation}
function GetProcessWindowStation: HWINSTA; stdcall;
{$EXTERNALSYM SetUserObjectSecurity}
function SetUserObjectSecurity(hObj: THandle; var pSIRequested: DWORD;
  pSID: PSecurityDescriptor): BOOL; stdcall;
{$EXTERNALSYM GetUserObjectSecurity}
function GetUserObjectSecurity(hObj: THandle; var pSIRequested: DWORD;
  pSID: PSecurityDescriptor; nLength: DWORD; var lpnLengthNeeded: DWORD): BOOL; stdcall;

const
  {$EXTERNALSYM UOI_FLAGS}
  UOI_FLAGS = 1;
  {$EXTERNALSYM UOI_NAME}
  UOI_NAME = 2;
  {$EXTERNALSYM UOI_TYPE}
  UOI_TYPE = 3;
  {$EXTERNALSYM UOI_USER_SID}
  UOI_USER_SID = 4;

type
  PUserObjectFlags = ^TUserObjectFlags;
  {$EXTERNALSYM tagUSEROBJECTFLAGS}
  tagUSEROBJECTFLAGS = packed record
    fInherit: BOOL;
    fReserved: BOOL;
    dwFlags: DWORD;
  end;
  TUserObjectFlags = tagUSEROBJECTFLAGS;
  {$EXTERNALSYM USEROBJECTFLAGS}
  USEROBJECTFLAGS = tagUSEROBJECTFLAGS;

{$EXTERNALSYM GetUserObjectInformationA}
function GetUserObjectInformationA(hObj: THandle; nIndex: Integer; pvInfo: Pointer;
  nLength: DWORD; var lpnLengthNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetUserObjectInformationW}
function GetUserObjectInformationW(hObj: THandle; nIndex: Integer; pvInfo: Pointer;
  nLength: DWORD; var lpnLengthNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetUserObjectInformation}
function GetUserObjectInformation(hObj: THandle; nIndex: Integer; pvInfo: Pointer;
  nLength: DWORD; var lpnLengthNeeded: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetUserObjectInformationA}
function SetUserObjectInformationA(hObj: THandle; nIndex: Integer;
  pvInfo: Pointer; nLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetUserObjectInformationW}
function SetUserObjectInformationW(hObj: THandle; nIndex: Integer;
  pvInfo: Pointer; nLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetUserObjectInformation}
function SetUserObjectInformation(hObj: THandle; nIndex: Integer;
  pvInfo: Pointer; nLength: DWORD): BOOL; stdcall;

type
  PWndClassExA = ^TWndClassExA;
  PWndClassExW = ^TWndClassExW;
  PWndClassEx = PWndClassExA;
  {$EXTERNALSYM tagWNDCLASSEXA}
  tagWNDCLASSEXA = packed record
    cbSize: UINT;
    style: UINT;
    lpfnWndProc: TFNWndProc;
    cbClsExtra: Integer;
    cbWndExtra: Integer;
    hInstance: HINST;
    hIcon: HICON;
    hCursor: HCURSOR;
    hbrBackground: HBRUSH;
    lpszMenuName: PAnsiChar;
    lpszClassName: PAnsiChar;
    hIconSm: HICON;
  end;
  {$EXTERNALSYM tagWNDCLASSEXW}
  tagWNDCLASSEXW = packed record
    cbSize: UINT;
    style: UINT;
    lpfnWndProc: TFNWndProc;
    cbClsExtra: Integer;
    cbWndExtra: Integer;
    hInstance: HINST;
    hIcon: HICON;
    hCursor: HCURSOR;
    hbrBackground: HBRUSH;
    lpszMenuName: PWideChar;
    lpszClassName: PWideChar;
    hIconSm: HICON;
  end;
  {$EXTERNALSYM tagWNDCLASSEX}
  tagWNDCLASSEX = tagWNDCLASSEXA;
  TWndClassExA = tagWNDCLASSEXA;
  TWndClassExW = tagWNDCLASSEXW;
  TWndClassEx = TWndClassExA;
  {$EXTERNALSYM WNDCLASSEXA}
  WNDCLASSEXA = tagWNDCLASSEXA;
  {$EXTERNALSYM WNDCLASSEXW}
  WNDCLASSEXW = tagWNDCLASSEXW;
  {$EXTERNALSYM WNDCLASSEX}
  WNDCLASSEX = WNDCLASSEXA;

  PWndClassA = ^TWndClassA;
  PWndClassW = ^TWndClassW;
  PWndClass = PWndClassA;
  {$EXTERNALSYM tagWNDCLASSA}
  tagWNDCLASSA = packed record
    style: UINT;
    lpfnWndProc: TFNWndProc;
    cbClsExtra: Integer;
    cbWndExtra: Integer;
    hInstance: HINST;
    hIcon: HICON;
    hCursor: HCURSOR;
    hbrBackground: HBRUSH;
    lpszMenuName: PAnsiChar;
    lpszClassName: PAnsiChar;
  end;
  {$EXTERNALSYM tagWNDCLASSW}
  tagWNDCLASSW = packed record
    style: UINT;
    lpfnWndProc: TFNWndProc;
    cbClsExtra: Integer;
    cbWndExtra: Integer;
    hInstance: HINST;
    hIcon: HICON;
    hCursor: HCURSOR;
    hbrBackground: HBRUSH;
    lpszMenuName: PWideChar;
    lpszClassName: PWideChar;
  end;
  {$EXTERNALSYM tagWNDCLASS}
  tagWNDCLASS = tagWNDCLASSA;
  TWndClassA = tagWNDCLASSA;
  TWndClassW = tagWNDCLASSW;
  TWndClass = TWndClassA;
  {$EXTERNALSYM WNDCLASSA}
  WNDCLASSA = tagWNDCLASSA;
  {$EXTERNALSYM WNDCLASSW}
  WNDCLASSW = tagWNDCLASSW;
  {$EXTERNALSYM WNDCLASS}
  WNDCLASS = WNDCLASSA;

{ Message structure }
  PMsg = ^TMsg;
  {$EXTERNALSYM tagMSG}
  tagMSG = packed record
    hwnd: HWND;
    message: UINT;
    wParam: WPARAM;
    lParam: LPARAM;
    time: DWORD;
    pt: TPoint;
  end;
  TMsg = tagMSG;
  {$EXTERNALSYM MSG}
  MSG = tagMSG;

function SmallPointToPoint(const P: TSmallPoint): TPoint;
function PointToSmallPoint(const P: TPoint): TSmallPoint;
function MakeWParam(l, h: Word): WPARAM;
function MakeLParam(l, h: Word): LPARAM;
function MakeLResult(l, h: Word): LRESULT;


const
{ Window field offsets for GetWindowLong() }

  {$EXTERNALSYM GWL_WNDPROC}
  GWL_WNDPROC = -4;
  {$EXTERNALSYM GWL_HINSTANCE}
  GWL_HINSTANCE = -6;
  {$EXTERNALSYM GWL_HWNDPARENT}
  GWL_HWNDPARENT = -8;
  {$EXTERNALSYM GWL_STYLE}
  GWL_STYLE = -16;
  {$EXTERNALSYM GWL_EXSTYLE}
  GWL_EXSTYLE = -20;
  {$EXTERNALSYM GWL_USERDATA}
  GWL_USERDATA = -21;
  {$EXTERNALSYM GWL_ID}
  GWL_ID = -12;

  { Class field offsets for GetClassLong() }
  {$EXTERNALSYM GCL_MENUNAME}
  GCL_MENUNAME = -8;
  {$EXTERNALSYM GCL_HBRBACKGROUND}
  GCL_HBRBACKGROUND = -10;
  {$EXTERNALSYM GCL_HCURSOR}
  GCL_HCURSOR = -12;
  {$EXTERNALSYM GCL_HICON}
  GCL_HICON = -14;
  {$EXTERNALSYM GCL_HMODULE}
  GCL_HMODULE = -16;
  {$EXTERNALSYM GCL_CBWNDEXTRA}
  GCL_CBWNDEXTRA = -18;
  {$EXTERNALSYM GCL_CBCLSEXTRA}
  GCL_CBCLSEXTRA = -20;
  {$EXTERNALSYM GCL_WNDPROC}
  GCL_WNDPROC = -24;
  {$EXTERNALSYM GCL_STYLE}
  GCL_STYLE = -26;
  {$EXTERNALSYM GCW_ATOM}
  GCW_ATOM = -32;
  {$EXTERNALSYM GCL_HICONSM}
  GCL_HICONSM = -34;

const
  { WM_ACTIVATE state values }
  {$EXTERNALSYM WA_INACTIVE}
  WA_INACTIVE = 0;
  {$EXTERNALSYM WA_ACTIVE}
  WA_ACTIVE = 1;
  {$EXTERNALSYM WA_CLICKACTIVE}
  WA_CLICKACTIVE = 2;

type
  { Struct pointed to by WM_GETMINMAXINFO lParam }
  PMinMaxInfo = ^TMinMaxInfo;
  {$EXTERNALSYM tagMINMAXINFO}
  tagMINMAXINFO = packed record
    ptReserved: TPoint;
    ptMaxSize: TPoint;
    ptMaxPosition: TPoint;
    ptMinTrackSize: TPoint;
    ptMaxTrackSize: TPoint;
  end;
  TMinMaxInfo = tagMINMAXINFO;
  {$EXTERNALSYM MINMAXINFO}
  MINMAXINFO = tagMINMAXINFO;

const
  { wParam for WM_POWER window message and DRV_POWER driver notification }
  {$EXTERNALSYM PWR_OK}
  PWR_OK = 1;
  {$EXTERNALSYM PWR_FAIL}
  PWR_FAIL = -1;
  {$EXTERNALSYM PWR_SUSPENDREQUEST}
  PWR_SUSPENDREQUEST = 1;
  {$EXTERNALSYM PWR_SUSPENDRESUME}
  PWR_SUSPENDRESUME = 2;
  {$EXTERNALSYM PWR_CRITICALRESUME}
  PWR_CRITICALRESUME = 3;

type
  { lParam of WM_COPYDATA message points to... }
  PCopyDataStruct = ^TCopyDataStruct;
  {$EXTERNALSYM tagCOPYDATASTRUCT}
  tagCOPYDATASTRUCT = packed record
    dwData: DWORD;
    cbData: DWORD;
    lpData: Pointer;
  end;
  TCopyDataStruct = tagCOPYDATASTRUCT;
  {$EXTERNALSYM COPYDATASTRUCT}
  COPYDATASTRUCT = tagCOPYDATASTRUCT;

const
  {$EXTERNALSYM NFR_ANSI}
  NFR_ANSI = 1;
  {$EXTERNALSYM NFR_UNICODE}
  NFR_UNICODE = 2;
  {$EXTERNALSYM NF_QUERY}
  NF_QUERY = 3;
  {$EXTERNALSYM NF_REQUERY}
  NF_REQUERY = 4;

  {$EXTERNALSYM WHEEL_DELTA}
  WHEEL_DELTA = 120;            { Value for rolling one detent }
  {$EXTERNALSYM WHEEL_PAGESCROLL}
  WHEEL_PAGESCROLL = MAXDWORD;  { Scroll one page }

  {$EXTERNALSYM MENULOOP_WINDOW}
  MENULOOP_WINDOW = 0;
  {$EXTERNALSYM MENULOOP_POPUP}
  MENULOOP_POPUP = 1;

type
  PMDINextMenu = ^TMDINextMenu;
  {$EXTERNALSYM tagMDINEXTMENU}
  tagMDINEXTMENU = packed record
    hmenuIn: HMENU;
    hmenuNext: HMENU;
    hwndNext: HWND;
  end;
  TMDINextMenu = tagMDINEXTMENU;
  {$EXTERNALSYM MDINEXTMENU}
  MDINEXTMENU = tagMDINEXTMENU;

const
  { wParam for WM_NOTIFYWOW message  }

  { wParam for WM_SIZING message  }
  {$EXTERNALSYM WMSZ_LEFT}
  WMSZ_LEFT = 1;
  {$EXTERNALSYM WMSZ_RIGHT}
  WMSZ_RIGHT = 2;
  {$EXTERNALSYM WMSZ_TOP}
  WMSZ_TOP = 3;
  {$EXTERNALSYM WMSZ_TOPLEFT}
  WMSZ_TOPLEFT = 4;
  {$EXTERNALSYM WMSZ_TOPRIGHT}
  WMSZ_TOPRIGHT = 5;
  {$EXTERNALSYM WMSZ_BOTTOM}
  WMSZ_BOTTOM = 6;
  {$EXTERNALSYM WMSZ_BOTTOMLEFT}
  WMSZ_BOTTOMLEFT = 7;
  {$EXTERNALSYM WMSZ_BOTTOMRIGHT}
  WMSZ_BOTTOMRIGHT = 8;

  { WM_SYNCTASK Commands }
  {$EXTERNALSYM ST_BEGINSWP}
  ST_BEGINSWP = 0;
  {$EXTERNALSYM ST_ENDSWP}
  ST_ENDSWP = 1;

  { WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes }
  {$EXTERNALSYM HTERROR}
  HTERROR = -2;
  {$EXTERNALSYM HTTRANSPARENT}
  HTTRANSPARENT = -1;
  {$EXTERNALSYM HTNOWHERE}
  HTNOWHERE = 0;
  {$EXTERNALSYM HTCLIENT}
  HTCLIENT = 1;
  {$EXTERNALSYM HTCAPTION}
  HTCAPTION = 2;
  {$EXTERNALSYM HTSYSMENU}
  HTSYSMENU = 3;
  {$EXTERNALSYM HTGROWBOX}
  HTGROWBOX = 4;
  {$EXTERNALSYM HTSIZE}
  HTSIZE = HTGROWBOX;
  {$EXTERNALSYM HTMENU}
  HTMENU = 5;
  {$EXTERNALSYM HTHSCROLL}
  HTHSCROLL = 6;
  {$EXTERNALSYM HTVSCROLL}
  HTVSCROLL = 7;
  {$EXTERNALSYM HTMINBUTTON}
  HTMINBUTTON = 8;
  {$EXTERNALSYM HTMAXBUTTON}
  HTMAXBUTTON = 9;
  {$EXTERNALSYM HTLEFT}
  HTLEFT = 10;
  {$EXTERNALSYM HTRIGHT}
  HTRIGHT = 11;
  {$EXTERNALSYM HTTOP}
  HTTOP = 12;
  {$EXTERNALSYM HTTOPLEFT}
  HTTOPLEFT = 13;
  {$EXTERNALSYM HTTOPRIGHT}
  HTTOPRIGHT = 14;
  {$EXTERNALSYM HTBOTTOM}
  HTBOTTOM = 15;
  {$EXTERNALSYM HTBOTTOMLEFT}
  HTBOTTOMLEFT = $10;
  {$EXTERNALSYM HTBOTTOMRIGHT}
  HTBOTTOMRIGHT = 17;
  {$EXTERNALSYM HTBORDER}
  HTBORDER = 18;
  {$EXTERNALSYM HTREDUCE}
  HTREDUCE = HTMINBUTTON;
  {$EXTERNALSYM HTZOOM}
  HTZOOM = HTMAXBUTTON;
  {$EXTERNALSYM HTSIZEFIRST}
  HTSIZEFIRST = HTLEFT;
  {$EXTERNALSYM HTSIZELAST}
  HTSIZELAST = HTBOTTOMRIGHT;
  {$EXTERNALSYM HTOBJECT}
  HTOBJECT = 19;
  {$EXTERNALSYM HTCLOSE}
  HTCLOSE = 20;
  {$EXTERNALSYM HTHELP}
  HTHELP = 21;

  { SendMessageTimeout values }
  {$EXTERNALSYM SMTO_NORMAL}
  SMTO_NORMAL = 0;
  {$EXTERNALSYM SMTO_BLOCK}
  SMTO_BLOCK = 1;
  {$EXTERNALSYM SMTO_ABORTIFHUNG}
  SMTO_ABORTIFHUNG = 2;
  {$EXTERNALSYM SMTO_NOTIMEOUTIFNOTHUNG}
  SMTO_NOTIMEOUTIFNOTHUNG = 8;

  { WM_MOUSEACTIVATE Return Codes }
  {$EXTERNALSYM MA_ACTIVATE}
  MA_ACTIVATE = 1;
  {$EXTERNALSYM MA_ACTIVATEANDEAT}
  MA_ACTIVATEANDEAT = 2;
  {$EXTERNALSYM MA_NOACTIVATE}
  MA_NOACTIVATE = 3;
  {$EXTERNALSYM MA_NOACTIVATEANDEAT}
  MA_NOACTIVATEANDEAT = 4;

  { WM_SETICON / WM_GETICON Type Codes }
  {$EXTERNALSYM ICON_SMALL}
  ICON_SMALL = 0;
  {$EXTERNALSYM ICON_BIG}
  ICON_BIG = 1;

{$EXTERNALSYM RegisterWindowMessageA}
function RegisterWindowMessageA(lpString: PAnsiChar): UINT; stdcall;
{$EXTERNALSYM RegisterWindowMessageW}
function RegisterWindowMessageW(lpString: PWideChar): UINT; stdcall;
{$EXTERNALSYM RegisterWindowMessage}
function RegisterWindowMessage(lpString: PChar): UINT; stdcall;

const
  { WM_SIZE message wParam values }
  {$EXTERNALSYM SIZE_RESTORED}
  SIZE_RESTORED = 0;
  {$EXTERNALSYM SIZE_MINIMIZED}
  SIZE_MINIMIZED = 1;
  {$EXTERNALSYM SIZE_MAXIMIZED}
  SIZE_MAXIMIZED = 2;
  {$EXTERNALSYM SIZE_MAXSHOW}
  SIZE_MAXSHOW = 3;
  {$EXTERNALSYM SIZE_MAXHIDE}
  SIZE_MAXHIDE = 4;

  { Obsolete constant names }
  {$EXTERNALSYM SIZENORMAL}
  SIZENORMAL = SIZE_RESTORED;
  {$EXTERNALSYM SIZEICONIC}
  SIZEICONIC = SIZE_MINIMIZED;
  {$EXTERNALSYM SIZEFULLSCREEN}
  SIZEFULLSCREEN = SIZE_MAXIMIZED;
  {$EXTERNALSYM SIZEZOOMSHOW}
  SIZEZOOMSHOW = SIZE_MAXSHOW;
  {$EXTERNALSYM SIZEZOOMHIDE}
  SIZEZOOMHIDE = SIZE_MAXHIDE;


type
  { WM_WINDOWPOSCHANGINGCHANGED struct pointed to by lParam }
  PWindowPos = ^TWindowPos;
  {$EXTERNALSYM tagWINDOWPOS}
  tagWINDOWPOS = packed record
    hwnd: HWND;
    hwndInsertAfter: HWND;
    x: Integer;
    y: Integer;
    cx: Integer;
    cy: Integer;
    flags: UINT;
  end;
  TWindowPos = tagWINDOWPOS;
  {$EXTERNALSYM WINDOWPOS}
  WINDOWPOS = tagWINDOWPOS;

  { WM_NCCALCSIZE parameter structure }
  PNCCalcSizeParams = ^TNCCalcSizeParams;
  {$EXTERNALSYM tagNCCALCSIZE_PARAMS}
  tagNCCALCSIZE_PARAMS = packed record
    rgrc: array[0..2] of TRect;
    lppos: PWindowPos;
  end;
  TNCCalcSizeParams = tagNCCALCSIZE_PARAMS;
  {$EXTERNALSYM NCCALCSIZE_PARAMS}
  NCCALCSIZE_PARAMS = tagNCCALCSIZE_PARAMS;


const
  { WM_NCCALCSIZE "window valid rect" return values }
  {$EXTERNALSYM WVR_ALIGNTOP}
  WVR_ALIGNTOP = $10;
  {$EXTERNALSYM WVR_ALIGNLEFT}
  WVR_ALIGNLEFT = $20;
  {$EXTERNALSYM WVR_ALIGNBOTTOM}
  WVR_ALIGNBOTTOM = $40;
  {$EXTERNALSYM WVR_ALIGNRIGHT}
  WVR_ALIGNRIGHT = $80;
  {$EXTERNALSYM WVR_HREDRAW}
  WVR_HREDRAW = $100;
  {$EXTERNALSYM WVR_VREDRAW}
  WVR_VREDRAW = $200;
  {$EXTERNALSYM WVR_REDRAW}
  WVR_REDRAW = (WVR_HREDRAW or WVR_VREDRAW);
  {$EXTERNALSYM WVR_VALIDRECTS}
  WVR_VALIDRECTS = $400;

  { Key State Masks for Mouse Messages }
  {$EXTERNALSYM MK_LBUTTON}
  MK_LBUTTON = 1;
  {$EXTERNALSYM MK_RBUTTON}
  MK_RBUTTON = 2;
  {$EXTERNALSYM MK_SHIFT}
  MK_SHIFT = 4;
  {$EXTERNALSYM MK_CONTROL}
  MK_CONTROL = 8;
  {$EXTERNALSYM MK_MBUTTON}
  MK_MBUTTON = $10;

  {$EXTERNALSYM TME_HOVER}
  TME_HOVER           = $00000001;
  {$EXTERNALSYM TME_LEAVE}
  TME_LEAVE           = $00000002;
  {$EXTERNALSYM TME_QUERY}
  TME_QUERY           = $40000000;
  {$EXTERNALSYM TME_CANCEL}
  TME_CANCEL          = DWORD($80000000);

  {$EXTERNALSYM HOVER_DEFAULT}
  HOVER_DEFAULT       = DWORD($FFFFFFFF);

type
  {$EXTERNALSYM PTrackMouseEvent}
  PTrackMouseEvent = ^TTrackMouseEvent;
  {$EXTERNALSYM tagTRACKMOUSEEVENT}
  tagTRACKMOUSEEVENT = record
    cbSize: DWORD;
    dwFlags: DWORD;
    hwndTrack: HWND;
    dwHoverTime: DWORD;
  end;
  TTrackMouseEvent = tagTRACKMOUSEEVENT;
  {$EXTERNALSYM TTrackMouseEvent}

{$EXTERNALSYM TrackMouseEvent}
function TrackMouseEvent(var EventTrack: TTrackMouseEvent): BOOL; stdcall;

const
  { Window Styles }
  {$EXTERNALSYM WS_OVERLAPPED}
  WS_OVERLAPPED = 0;
  {$EXTERNALSYM WS_POPUP}
  WS_POPUP = DWORD($80000000);
  {$EXTERNALSYM WS_CHILD}
  WS_CHILD = $40000000;
  {$EXTERNALSYM WS_MINIMIZE}
  WS_MINIMIZE = $20000000;
  {$EXTERNALSYM WS_VISIBLE}
  WS_VISIBLE = $10000000;
  {$EXTERNALSYM WS_DISABLED}
  WS_DISABLED = $8000000;
  {$EXTERNALSYM WS_CLIPSIBLINGS}
  WS_CLIPSIBLINGS = $4000000;
  {$EXTERNALSYM WS_CLIPCHILDREN}
  WS_CLIPCHILDREN = $2000000;
  {$EXTERNALSYM WS_MAXIMIZE}
  WS_MAXIMIZE = $1000000;
  {$EXTERNALSYM WS_CAPTION}
  WS_CAPTION = $C00000;      { WS_BORDER or WS_DLGFRAME  }
  {$EXTERNALSYM WS_BORDER}
  WS_BORDER = $800000;
  {$EXTERNALSYM WS_DLGFRAME}
  WS_DLGFRAME = $400000;
  {$EXTERNALSYM WS_VSCROLL}
  WS_VSCROLL = $200000;
  {$EXTERNALSYM WS_HSCROLL}
  WS_HSCROLL = $100000;
  {$EXTERNALSYM WS_SYSMENU}
  WS_SYSMENU = $80000;
  {$EXTERNALSYM WS_THICKFRAME}
  WS_THICKFRAME = $40000;
  {$EXTERNALSYM WS_GROUP}
  WS_GROUP = $20000;
  {$EXTERNALSYM WS_TABSTOP}
  WS_TABSTOP = $10000;

  {$EXTERNALSYM WS_MINIMIZEBOX}
  WS_MINIMIZEBOX = $20000;
  {$EXTERNALSYM WS_MAXIMIZEBOX}
  WS_MAXIMIZEBOX = $10000;

  {$EXTERNALSYM WS_TILED}
  WS_TILED = WS_OVERLAPPED;
  {$EXTERNALSYM WS_ICONIC}
  WS_ICONIC = WS_MINIMIZE;
  {$EXTERNALSYM WS_SIZEBOX}
  WS_SIZEBOX = WS_THICKFRAME;

  { Common Window Styles }
  {$EXTERNALSYM WS_OVERLAPPEDWINDOW}
  WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or
    WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX);
  {$EXTERNALSYM WS_TILEDWINDOW}
  WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW;
  {$EXTERNALSYM WS_POPUPWINDOW}
  WS_POPUPWINDOW = (WS_POPUP or WS_BORDER or WS_SYSMENU);
  {$EXTERNALSYM WS_CHILDWINDOW}
  WS_CHILDWINDOW = (WS_CHILD);

  { Extended Window Styles }
  {$EXTERNALSYM WS_EX_DLGMODALFRAME}
  WS_EX_DLGMODALFRAME = 1;
  {$EXTERNALSYM WS_EX_NOPARENTNOTIFY}
  WS_EX_NOPARENTNOTIFY = 4;
  {$EXTERNALSYM WS_EX_TOPMOST}
  WS_EX_TOPMOST = 8;
  {$EXTERNALSYM WS_EX_ACCEPTFILES}
  WS_EX_ACCEPTFILES = $10;
  {$EXTERNALSYM WS_EX_TRANSPARENT}
  WS_EX_TRANSPARENT = $20;
  {$EXTERNALSYM WS_EX_MDICHILD}
  WS_EX_MDICHILD = $40;
  {$EXTERNALSYM WS_EX_TOOLWINDOW}
  WS_EX_TOOLWINDOW = $80;
  {$EXTERNALSYM WS_EX_WINDOWEDGE}
  WS_EX_WINDOWEDGE = $100;
  {$EXTERNALSYM WS_EX_CLIENTEDGE}
  WS_EX_CLIENTEDGE = $200;
  {$EXTERNALSYM WS_EX_CONTEXTHELP}
  WS_EX_CONTEXTHELP = $400;

  {$EXTERNALSYM WS_EX_RIGHT}
  WS_EX_RIGHT = $1000;
  {$EXTERNALSYM WS_EX_LEFT}
  WS_EX_LEFT = 0;
  {$EXTERNALSYM WS_EX_RTLREADING}
  WS_EX_RTLREADING = $2000;
  {$EXTERNALSYM WS_EX_LTRREADING}
  WS_EX_LTRREADING = 0;
  {$EXTERNALSYM WS_EX_LEFTSCROLLBAR}
  WS_EX_LEFTSCROLLBAR = $4000;
  {$EXTERNALSYM WS_EX_RIGHTSCROLLBAR}
  WS_EX_RIGHTSCROLLBAR = 0;

  {$EXTERNALSYM WS_EX_CONTROLPARENT}
  WS_EX_CONTROLPARENT = $10000;
  {$EXTERNALSYM WS_EX_STATICEDGE}
  WS_EX_STATICEDGE = $20000;
  {$EXTERNALSYM WS_EX_APPWINDOW}
  WS_EX_APPWINDOW = $40000;
  {$EXTERNALSYM WS_EX_OVERLAPPEDWINDOW}
  WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE);
  {$EXTERNALSYM WS_EX_PALETTEWINDOW}
  WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST);

  { Class styles }
  {$EXTERNALSYM CS_VREDRAW}
  CS_VREDRAW = DWORD(1);
  {$EXTERNALSYM CS_HREDRAW}
  CS_HREDRAW = DWORD(2);
  {$EXTERNALSYM CS_KEYCVTWINDOW}
  CS_KEYCVTWINDOW = 4;
  {$EXTERNALSYM CS_DBLCLKS}
  CS_DBLCLKS = 8;
  {$EXTERNALSYM CS_OWNDC}
  CS_OWNDC = $20;
  {$EXTERNALSYM CS_CLASSDC}
  CS_CLASSDC = $40;
  {$EXTERNALSYM CS_PARENTDC}
  CS_PARENTDC = $80;
  {$EXTERNALSYM CS_NOKEYCVT}
  CS_NOKEYCVT = $100;
  {$EXTERNALSYM CS_NOCLOSE}
  CS_NOCLOSE = $200;
  {$EXTERNALSYM CS_SAVEBITS}
  CS_SAVEBITS = $800;
  {$EXTERNALSYM CS_BYTEALIGNCLIENT}
  CS_BYTEALIGNCLIENT = $1000;
  {$EXTERNALSYM CS_BYTEALIGNWINDOW}
  CS_BYTEALIGNWINDOW = $2000;
  {$EXTERNALSYM CS_GLOBALCLASS}
  CS_GLOBALCLASS = $4000;

  {$EXTERNALSYM CS_IME}
  CS_IME = $10000;

  { WM_PRINT flags }
  {$EXTERNALSYM PRF_CHECKVISIBLE}
  PRF_CHECKVISIBLE = 1;
  {$EXTERNALSYM PRF_NONCLIENT}
  PRF_NONCLIENT = 2;
  {$EXTERNALSYM PRF_CLIENT}
  PRF_CLIENT = 4;
  {$EXTERNALSYM PRF_ERASEBKGND}
  PRF_ERASEBKGND = 8;
  {$EXTERNALSYM PRF_CHILDREN}
  PRF_CHILDREN = $10;
  {$EXTERNALSYM PRF_OWNED}
  PRF_OWNED = $20;

  { 3D border styles }
  {$EXTERNALSYM BDR_RAISEDOUTER}
  BDR_RAISEDOUTER = 1;
  {$EXTERNALSYM BDR_SUNKENOUTER}
  BDR_SUNKENOUTER = 2;
  {$EXTERNALSYM BDR_RAISEDINNER}
  BDR_RAISEDINNER = 4;
  {$EXTERNALSYM BDR_SUNKENINNER}
  BDR_SUNKENINNER = 8;

  {$EXTERNALSYM BDR_OUTER}
  BDR_OUTER = 3;
  {$EXTERNALSYM BDR_INNER}
  BDR_INNER = 12;
  {$EXTERNALSYM BDR_RAISED}
  BDR_RAISED = 5;
  {$EXTERNALSYM BDR_SUNKEN}
  BDR_SUNKEN = 10;

  {$EXTERNALSYM EDGE_RAISED}
  EDGE_RAISED = (BDR_RAISEDOUTER or BDR_RAISEDINNER);
  {$EXTERNALSYM EDGE_SUNKEN}
  EDGE_SUNKEN = (BDR_SUNKENOUTER or BDR_SUNKENINNER);
  {$EXTERNALSYM EDGE_ETCHED}
  EDGE_ETCHED = (BDR_SUNKENOUTER or BDR_RAISEDINNER);
  {$EXTERNALSYM EDGE_BUMP}
  EDGE_BUMP = (BDR_RAISEDOUTER or BDR_SUNKENINNER);

  { Border flags }
  {$EXTERNALSYM BF_LEFT}
  BF_LEFT = 1;
  {$EXTERNALSYM BF_TOP}
  BF_TOP = 2;
  {$EXTERNALSYM BF_RIGHT}
  BF_RIGHT = 4;
  {$EXTERNALSYM BF_BOTTOM}
  BF_BOTTOM = 8;

  {$EXTERNALSYM BF_TOPLEFT}
  BF_TOPLEFT = (BF_TOP or BF_LEFT);
  {$EXTERNALSYM BF_TOPRIGHT}
  BF_TOPRIGHT = (BF_TOP or BF_RIGHT);
  {$EXTERNALSYM BF_BOTTOMLEFT}
  BF_BOTTOMLEFT = (BF_BOTTOM or BF_LEFT);
  {$EXTERNALSYM BF_BOTTOMRIGHT}
  BF_BOTTOMRIGHT = (BF_BOTTOM or BF_RIGHT);
  {$EXTERNALSYM BF_RECT}
  BF_RECT = (BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM);

  {$EXTERNALSYM BF_DIAGONAL}
  BF_DIAGONAL = $10;

  { For diagonal lines, the BF_RECT flags specify the end point of the}
  { vector bounded by the rectangle parameter.}
  {$EXTERNALSYM BF_DIAGONAL_ENDTOPRIGHT}
  BF_DIAGONAL_ENDTOPRIGHT = (BF_DIAGONAL or BF_TOP or BF_RIGHT);
  {$EXTERNALSYM BF_DIAGONAL_ENDTOPLEFT}
  BF_DIAGONAL_ENDTOPLEFT = (BF_DIAGONAL or BF_TOP or BF_LEFT);
  {$EXTERNALSYM BF_DIAGONAL_ENDBOTTOMLEFT}
  BF_DIAGONAL_ENDBOTTOMLEFT = (BF_DIAGONAL or BF_BOTTOM or BF_LEFT);
  {$EXTERNALSYM BF_DIAGONAL_ENDBOTTOMRIGHT}
  BF_DIAGONAL_ENDBOTTOMRIGHT = (BF_DIAGONAL or BF_BOTTOM or BF_RIGHT);

  {$EXTERNALSYM BF_MIDDLE}
  BF_MIDDLE = $800;   { Fill in the middle }
  {$EXTERNALSYM BF_SOFT}
  BF_SOFT = $1000;    { For softer buttons }
  {$EXTERNALSYM BF_ADJUST}
  BF_ADJUST = $2000;  { Calculate the space left over }
  {$EXTERNALSYM BF_FLAT}
  BF_FLAT = $4000;    { For flat rather than 3D borders }
  {$EXTERNALSYM BF_MONO}
  BF_MONO = $8000;    { For monochrome borders }

{$EXTERNALSYM DrawEdge}
function DrawEdge(hdc: HDC; var qrc: TRect; edge: UINT; grfFlags: UINT): BOOL; stdcall;

const
  { flags for DrawFrameControl }
  {$EXTERNALSYM DFC_CAPTION}
  DFC_CAPTION = 1;
  {$EXTERNALSYM DFC_MENU}
  DFC_MENU = 2;
  {$EXTERNALSYM DFC_SCROLL}
  DFC_SCROLL = 3;
  {$EXTERNALSYM DFC_BUTTON}
  DFC_BUTTON = 4;
  {$EXTERNALSYM DFC_POPUPMENU}
  DFC_POPUPMENU = 5;

  {$EXTERNALSYM DFCS_CAPTIONCLOSE}
  DFCS_CAPTIONCLOSE = 0;
  {$EXTERNALSYM DFCS_CAPTIONMIN}
  DFCS_CAPTIONMIN = 1;
  {$EXTERNALSYM DFCS_CAPTIONMAX}
  DFCS_CAPTIONMAX = 2;
  {$EXTERNALSYM DFCS_CAPTIONRESTORE}
  DFCS_CAPTIONRESTORE = 3;
  {$EXTERNALSYM DFCS_CAPTIONHELP}
  DFCS_CAPTIONHELP = 4;

  {$EXTERNALSYM DFCS_MENUARROW}
  DFCS_MENUARROW = 0;
  {$EXTERNALSYM DFCS_MENUCHECK}
  DFCS_MENUCHECK = 1;
  {$EXTERNALSYM DFCS_MENUBULLET}
  DFCS_MENUBULLET = 2;
  {$EXTERNALSYM DFCS_MENUARROWRIGHT}
  DFCS_MENUARROWRIGHT = 4;

  {$EXTERNALSYM DFCS_SCROLLUP}
  DFCS_SCROLLUP = 0;
  {$EXTERNALSYM DFCS_SCROLLDOWN}
  DFCS_SCROLLDOWN = 1;
  {$EXTERNALSYM DFCS_SCROLLLEFT}
  DFCS_SCROLLLEFT = 2;
  {$EXTERNALSYM DFCS_SCROLLRIGHT}
  DFCS_SCROLLRIGHT = 3;
  {$EXTERNALSYM DFCS_SCROLLCOMBOBOX}
  DFCS_SCROLLCOMBOBOX = 5;
  {$EXTERNALSYM DFCS_SCROLLSIZEGRIP}
  DFCS_SCROLLSIZEGRIP = 8;
  {$EXTERNALSYM DFCS_SCROLLSIZEGRIPRIGHT}
  DFCS_SCROLLSIZEGRIPRIGHT = $10;

  {$EXTERNALSYM DFCS_BUTTONCHECK}
  DFCS_BUTTONCHECK = 0;
  {$EXTERNALSYM DFCS_BUTTONRADIOIMAGE}
  DFCS_BUTTONRADIOIMAGE = 1;
  {$EXTERNALSYM DFCS_BUTTONRADIOMASK}
  DFCS_BUTTONRADIOMASK = 2;
  {$EXTERNALSYM DFCS_BUTTONRADIO}
  DFCS_BUTTONRADIO = 4;
  {$EXTERNALSYM DFCS_BUTTON3STATE}
  DFCS_BUTTON3STATE = 8;
  {$EXTERNALSYM DFCS_BUTTONPUSH}
  DFCS_BUTTONPUSH = $10;

  {$EXTERNALSYM DFCS_INACTIVE}
  DFCS_INACTIVE = $100;
  {$EXTERNALSYM DFCS_PUSHED}
  DFCS_PUSHED = $200;
  {$EXTERNALSYM DFCS_CHECKED}
  DFCS_CHECKED = $400;
  {$EXTERNALSYM DFCS_TRANSPARENT}
  DFCS_TRANSPARENT = $800;
  {$EXTERNALSYM DFCS_HOT}
  DFCS_HOT = $1000;
  {$EXTERNALSYM DFCS_ADJUSTRECT}
  DFCS_ADJUSTRECT = $2000;
  {$EXTERNALSYM DFCS_FLAT}
  DFCS_FLAT = $4000;
  {$EXTERNALSYM DFCS_MONO}
  DFCS_MONO = $8000;

{$EXTERNALSYM DrawFrameControl}
function DrawFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL; stdcall;

const
  { flags for DrawCaption }
  {$EXTERNALSYM DC_ACTIVE}
  DC_ACTIVE = 1;
  {$EXTERNALSYM DC_SMALLCAP}
  DC_SMALLCAP = 2;
  {$EXTERNALSYM DC_ICON}
  DC_ICON = 4;
  {$EXTERNALSYM DC_TEXT}
  DC_TEXT = 8;
  {$EXTERNALSYM DC_INBUTTON}
  DC_INBUTTON = $10;
  {$EXTERNALSYM DC_GRADIENT}
  DC_GRADIENT = $20;

{!!! doesn't match help !!!}
{$EXTERNALSYM DrawCaption}
function DrawCaption(p1: HWND; p2: HDC; const p3: TRect; p4: UINT): BOOL; stdcall;

const
  {$EXTERNALSYM IDANI_OPEN}
  IDANI_OPEN = 1;
  {$EXTERNALSYM IDANI_CLOSE}
  IDANI_CLOSE = 2;
  {$EXTERNALSYM IDANI_CAPTION}
  IDANI_CAPTION = 3;

{$EXTERNALSYM DrawAnimatedRects}
function DrawAnimatedRects(hwnd: HWND; idAni: Integer; const lprcFrom, lprcTo: TRect): BOOL; stdcall;

const
  { Predefined Clipboard Formats }
  {$EXTERNALSYM CF_TEXT}
  CF_TEXT = 1;
  {$EXTERNALSYM CF_BITMAP}
  CF_BITMAP = 2;
  {$EXTERNALSYM CF_METAFILEPICT}
  CF_METAFILEPICT = 3;
  {$EXTERNALSYM CF_SYLK}
  CF_SYLK = 4;
  {$EXTERNALSYM CF_DIF}
  CF_DIF = 5;
  {$EXTERNALSYM CF_TIFF}
  CF_TIFF = 6;
  {$EXTERNALSYM CF_OEMTEXT}
  CF_OEMTEXT = 7;
  {$EXTERNALSYM CF_DIB}
  CF_DIB = 8;
  {$EXTERNALSYM CF_PALETTE}
  CF_PALETTE = 9;
  {$EXTERNALSYM CF_PENDATA}
  CF_PENDATA = 10;
  {$EXTERNALSYM CF_RIFF}
  CF_RIFF = 11;
  {$EXTERNALSYM CF_WAVE}
  CF_WAVE = 12;
  {$EXTERNALSYM CF_UNICODETEXT}
  CF_UNICODETEXT = 13;
  {$EXTERNALSYM CF_ENHMETAFILE}
  CF_ENHMETAFILE = 14;
  {$EXTERNALSYM CF_HDROP}
  CF_HDROP = 15;
  {$EXTERNALSYM CF_LOCALE}
  CF_LOCALE = $10;
  {$EXTERNALSYM CF_MAX}
  CF_MAX = 17;

  {$EXTERNALSYM CF_OWNERDISPLAY}
  CF_OWNERDISPLAY = 128;
  {$EXTERNALSYM CF_DSPTEXT}
  CF_DSPTEXT = 129;
  {$EXTERNALSYM CF_DSPBITMAP}
  CF_DSPBITMAP = 130;
  {$EXTERNALSYM CF_DSPMETAFILEPICT}
  CF_DSPMETAFILEPICT = 131;
  {$EXTERNALSYM CF_DSPENHMETAFILE}
  CF_DSPENHMETAFILE = 142;

  { "Private" formats don't get GlobalFree()'d }
  {$EXTERNALSYM CF_PRIVATEFIRST}
  CF_PRIVATEFIRST = $200;
  {$EXTERNALSYM CF_PRIVATELAST}
  CF_PRIVATELAST = 767;

  { "GDIOBJ" formats do get DeleteObject()'d }
  {$EXTERNALSYM CF_GDIOBJFIRST}
  CF_GDIOBJFIRST = 768;
  {$EXTERNALSYM CF_GDIOBJLAST}
  CF_GDIOBJLAST = 1023;


  { Defines for the fVirt field of the Accelerator table structure. }
  {$EXTERNALSYM FVIRTKEY}
  FVIRTKEY = 1;
  {$EXTERNALSYM FNOINVERT}
  FNOINVERT = 2;
  {$EXTERNALSYM FSHIFT}
  FSHIFT = 4;
  {$EXTERNALSYM FCONTROL}
  FCONTROL = 8;
  {$EXTERNALSYM FALT}
  FALT = $10;

type
  PAccel = ^TAccel;
  {$EXTERNALSYM tagACCEL}
  tagACCEL = packed record
    fVirt: Word;     { Also called the flags field }
    key: Word;
    cmd: Word;
  end;
  TAccel = tagACCEL;
  {$EXTERNALSYM ACCEL}
  ACCEL = tagACCEL;

  PPaintStruct = ^TPaintStruct;
  {$EXTERNALSYM tagPAINTSTRUCT}
  tagPAINTSTRUCT = packed record
    hdc: HDC;
    fErase: BOOL;
    rcPaint: TRect;
    fRestore: BOOL;
    fIncUpdate: BOOL;
    rgbReserved: array[0..31] of Byte;
  end;
  TPaintStruct = tagPAINTSTRUCT;
  {$EXTERNALSYM PAINTSTRUCT}
  PAINTSTRUCT = tagPAINTSTRUCT;

  PWindowPlacement = ^TWindowPlacement;
  {$EXTERNALSYM tagWINDOWPLACEMENT}
  tagWINDOWPLACEMENT = packed record
    length: UINT;
    flags: UINT;
    showCmd: UINT;
    ptMinPosition: TPoint;
    ptMaxPosition: TPoint;
    rcNormalPosition: TRect;
  end;
  TWindowPlacement = tagWINDOWPLACEMENT;
  {$EXTERNALSYM WINDOWPLACEMENT}
  WINDOWPLACEMENT = tagWINDOWPLACEMENT;

const
  {$EXTERNALSYM WPF_SETMINPOSITION}
  WPF_SETMINPOSITION = 1;
  {$EXTERNALSYM WPF_RESTORETOMAXIMIZED}
  WPF_RESTORETOMAXIMIZED = 2;

type
  PNMHdr = ^TNMHdr;
  {$EXTERNALSYM tagNMHDR}
  tagNMHDR = packed record
    hwndFrom: HWND;
    idFrom: UINT;
    code: Integer;     { NM_ code }
  end;
  TNMHdr = tagNMHDR;
  {$EXTERNALSYM NMHDR}
  NMHDR = tagNMHDR;

  PStyleStruct = ^TStyleStruct;
  {$EXTERNALSYM tagSTYLESTRUCT}
  tagSTYLESTRUCT = packed record
    styleOld: DWORD;
    styleNew: DWORD;
  end;
  TStyleStruct = tagSTYLESTRUCT;
  {$EXTERNALSYM STYLESTRUCT}
  STYLESTRUCT = tagSTYLESTRUCT;

const
  { Owner draw control types }
  {$EXTERNALSYM ODT_MENU}
  ODT_MENU = 1;
  {$EXTERNALSYM ODT_LISTBOX}
  ODT_LISTBOX = 2;
  {$EXTERNALSYM ODT_COMBOBOX}
  ODT_COMBOBOX = 3;
  {$EXTERNALSYM ODT_BUTTON}
  ODT_BUTTON = 4;
  {$EXTERNALSYM ODT_STATIC}
  ODT_STATIC = 5;

  { Owner draw actions }
  {$EXTERNALSYM ODA_DRAWENTIRE}
  ODA_DRAWENTIRE = 1;
  {$EXTERNALSYM ODA_SELECT}
  ODA_SELECT = 2;
  {$EXTERNALSYM ODA_FOCUS}
  ODA_FOCUS = 4;

  { Owner draw state }
  {$EXTERNALSYM ODS_SELECTED}
  ODS_SELECTED = 1;
  {$EXTERNALSYM ODS_GRAYED}
  ODS_GRAYED = 2;
  {$EXTERNALSYM ODS_DISABLED}
  ODS_DISABLED = 4;
  {$EXTERNALSYM ODS_CHECKED}
  ODS_CHECKED = 8;
  {$EXTERNALSYM ODS_FOCUS}
  ODS_FOCUS = $10;
  {$EXTERNALSYM ODS_DEFAULT}
  ODS_DEFAULT = $20;
  {$EXTERNALSYM ODS_COMBOBOXEDIT}
  ODS_COMBOBOXEDIT = $1000;
  {$EXTERNALSYM ODS_HOTLIGHT}
  ODS_HOTLIGHT = $40;
  {$EXTERNALSYM ODS_INACTIVE}
  ODS_INACTIVE = $80;

type
  { for ownerdraw }
  PMeasureItemStruct = ^TMeasureItemStruct;
  {$EXTERNALSYM tagMEASUREITEMSTRUCT}
  tagMEASUREITEMSTRUCT = packed record
    CtlType: UINT;
    CtlID: UINT;
    itemID: UINT;
    itemWidth: UINT;
    itemHeight: UINT;
    itemData: DWORD;
  end;
  TMeasureItemStruct = tagMEASUREITEMSTRUCT;
  {$EXTERNALSYM MEASUREITEMSTRUCT}
  MEASUREITEMSTRUCT = tagMEASUREITEMSTRUCT;

  { for ownerdraw }
  PDrawItemStruct = ^TDrawItemStruct;
  {$EXTERNALSYM tagDRAWITEMSTRUCT}
  tagDRAWITEMSTRUCT = packed record
    CtlType: UINT;
    CtlID: UINT;
    itemID: UINT;
    itemAction: UINT;
    itemState: UINT;
    hwndItem: HWND;
    hDC: HDC;
    rcItem: TRect;
    itemData: DWORD;
  end;
  TDrawItemStruct = tagDRAWITEMSTRUCT;
  {$EXTERNALSYM DRAWITEMSTRUCT}
  DRAWITEMSTRUCT = tagDRAWITEMSTRUCT;

  { for ownerdraw }
  PDeleteItemStruct = ^TDeleteItemStruct;
  {$EXTERNALSYM tagDELETEITEMSTRUCT}
  tagDELETEITEMSTRUCT = packed record
    CtlType: UINT;
    CtlID: UINT;
    itemID: UINT;
    hwndItem: HWND;
    itemData: UINT;
  end;
  TDeleteItemStruct = tagDELETEITEMSTRUCT;
  {$EXTERNALSYM DELETEITEMSTRUCT}
  DELETEITEMSTRUCT = tagDELETEITEMSTRUCT;

  { for ownerdraw sorting }
  PCompareItemStruct = ^TCompareItemStruct;
  {$EXTERNALSYM tagCOMPAREITEMSTRUCT}
  tagCOMPAREITEMSTRUCT = packed record
    CtlType: UINT;
    CtlID: UINT;
    hwndItem: HWND;
    itemID1: UINT;
    itemData1: DWORD;
    itemID2: UINT;
    itemData2: DWORD;
    dwLocaleId: DWORD;
  end;
  TCompareItemStruct = tagCOMPAREITEMSTRUCT;
  {$EXTERNALSYM COMPAREITEMSTRUCT}
  COMPAREITEMSTRUCT = tagCOMPAREITEMSTRUCT;

{ Message Function Templates }

{$EXTERNALSYM GetMessageA}
function GetMessageA(var lpMsg: TMsg; hWnd: HWND;
  wMsgFilterMin, wMsgFilterMax: UINT): BOOL; stdcall;
{$EXTERNALSYM GetMessageW}
function GetMessageW(var lpMsg: TMsg; hWnd: HWND;
  wMsgFilterMin, wMsgFilterMax: UINT): BOOL; stdcall;
{$EXTERNALSYM GetMessage}
function GetMessage(var lpMsg: TMsg; hWnd: HWND;
  wMsgFilterMin, wMsgFilterMax: UINT): BOOL; stdcall;
{$EXTERNALSYM DispatchMessageA}
function DispatchMessageA(const lpMsg: TMsg): Longint; stdcall;
{$EXTERNALSYM DispatchMessageW}
function DispatchMessageW(const lpMsg: TMsg): Longint; stdcall;
{$EXTERNALSYM DispatchMessage}
function DispatchMessage(const lpMsg: TMsg): Longint; stdcall;
{$EXTERNALSYM TranslateMessage}
function TranslateMessage(const lpMsg: TMsg): BOOL; stdcall;
{$EXTERNALSYM SetMessageQueue}
function SetMessageQueue(cMessagesMax: Integer): BOOL; stdcall;
{$EXTERNALSYM PeekMessageA}
function PeekMessageA(var lpMsg: TMsg; hWnd: HWND;
  wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; stdcall;
{$EXTERNALSYM PeekMessageW}
function PeekMessageW(var lpMsg: TMsg; hWnd: HWND;
  wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; stdcall;
{$EXTERNALSYM PeekMessage}
function PeekMessage(var lpMsg: TMsg; hWnd: HWND;
  wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; stdcall;

const
  { PeekMessage() Options }
  {$EXTERNALSYM PM_NOREMOVE}
  PM_NOREMOVE = 0;
  {$EXTERNALSYM PM_REMOVE}
  PM_REMOVE = 1;
  {$EXTERNALSYM PM_NOYIELD}
  PM_NOYIELD = 2;

{$EXTERNALSYM RegisterHotKey}
function RegisterHotKey(hWnd: HWND; id: Integer; fsModifiers, vk: UINT): BOOL; stdcall;
{$EXTERNALSYM UnregisterHotKey}
function UnregisterHotKey(hWnd: HWND; id: Integer): BOOL; stdcall;

const
  {$EXTERNALSYM MOD_ALT}
  MOD_ALT = 1;
  {$EXTERNALSYM MOD_CONTROL}
  MOD_CONTROL = 2;
  {$EXTERNALSYM MOD_SHIFT}
  MOD_SHIFT = 4;
  {$EXTERNALSYM MOD_WIN}
  MOD_WIN = 8;

  {$EXTERNALSYM IDHOT_SNAPWINDOW}
  IDHOT_SNAPWINDOW = -1;    { SHIFT-PRINTSCRN  }
  {$EXTERNALSYM IDHOT_SNAPDESKTOP}
  IDHOT_SNAPDESKTOP = -2;   { PRINTSCRN        }

  {$EXTERNALSYM EW_RESTARTWINDOWS}
  EW_RESTARTWINDOWS        = $0042;
  {$EXTERNALSYM EW_REBOOTSYSTEM}
  EW_REBOOTSYSTEM          = $0043;
  {$EXTERNALSYM EW_EXITANDEXECAPP}
  EW_EXITANDEXECAPP        = $0044;

  {$EXTERNALSYM ENDSESSION_LOGOFF}
  ENDSESSION_LOGOFF        = DWORD($80000000);

  {$EXTERNALSYM EWX_LOGOFF}
  EWX_LOGOFF = 0;
  {$EXTERNALSYM EWX_SHUTDOWN}
  EWX_SHUTDOWN = 1;
  {$EXTERNALSYM EWX_REBOOT}
  EWX_REBOOT = 2;
  {$EXTERNALSYM EWX_FORCE}
  EWX_FORCE = 4;
  {$EXTERNALSYM EWX_POWEROFF}
  EWX_POWEROFF = 8;
  {$EXTERNALSYM EWX_FORCEIFHUNG}
  EWX_FORCEIFHUNG = $10;


{$EXTERNALSYM ExitWindows}
function ExitWindows(dwReserved: DWORD; Code: Word): BOOL;

{$EXTERNALSYM ExitWindowsEx}
function ExitWindowsEx(uFlags: UINT; dwReserved: DWORD): BOOL; stdcall;
{$EXTERNALSYM SwapMouseButton}
function SwapMouseButton(fSwap: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetMessagePos}
function GetMessagePos: DWORD; stdcall;
{$EXTERNALSYM GetMessageTime}
function GetMessageTime: Longint; stdcall;
{$EXTERNALSYM GetMessageExtraInfo}
function GetMessageExtraInfo: Longint; stdcall;
{$EXTERNALSYM SetMessageExtraInfo}
function SetMessageExtraInfo(lParam: LPARAM): LPARAM; stdcall;

{$EXTERNALSYM SendMessageA}
function SendMessageA(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM SendMessageW}
function SendMessageW(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM SendMessage}
function SendMessage(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM SendMessageTimeoutA}
function SendMessageTimeoutA(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM; fuFlags, uTimeout: UINT; var lpdwResult: DWORD): LRESULT; stdcall;
{$EXTERNALSYM SendMessageTimeoutW}
function SendMessageTimeoutW(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM; fuFlags, uTimeout: UINT; var lpdwResult: DWORD): LRESULT; stdcall;
{$EXTERNALSYM SendMessageTimeout}
function SendMessageTimeout(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM; fuFlags, uTimeout: UINT; var lpdwResult: DWORD): LRESULT; stdcall;
{$EXTERNALSYM SendNotifyMessageA}
function SendNotifyMessageA(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM SendNotifyMessageW}
function SendNotifyMessageW(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM SendNotifyMessage}
function SendNotifyMessage(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM SendMessageCallbackA}
function SendMessageCallbackA(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM; lpResultCallBack: TFNSendAsyncProc; dwData: DWORD): BOOL; stdcall;
{$EXTERNALSYM SendMessageCallbackW}
function SendMessageCallbackW(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM; lpResultCallBack: TFNSendAsyncProc; dwData: DWORD): BOOL; stdcall;
{$EXTERNALSYM SendMessageCallback}
function SendMessageCallback(hWnd: HWND; Msg: UINT; wParam: WPARAM;
  lParam: LPARAM; lpResultCallBack: TFNSendAsyncProc; dwData: DWORD): BOOL; stdcall;
{$EXTERNALSYM BroadcastSystemMessageA}
function BroadcastSystemMessageA(Flags: DWORD; Recipients: PDWORD;
  uiMessage: UINT; wParam: WPARAM; lParam: LPARAM): Longint; stdcall;
{$EXTERNALSYM BroadcastSystemMessageW}
function BroadcastSystemMessageW(Flags: DWORD; Recipients: PDWORD;
  uiMessage: UINT; wParam: WPARAM; lParam: LPARAM): Longint; stdcall;
{$EXTERNALSYM BroadcastSystemMessage}
function BroadcastSystemMessage(Flags: DWORD; Recipients: PDWORD;
  uiMessage: UINT; wParam: WPARAM; lParam: LPARAM): Longint; stdcall;

const
  { Broadcast Special Message Recipient list }
  {$EXTERNALSYM BSM_ALLCOMPONENTS}
  BSM_ALLCOMPONENTS = $00000000;
  {$EXTERNALSYM BSM_VXDS}
  BSM_VXDS = $00000001;
  {$EXTERNALSYM BSM_NETDRIVER}
  BSM_NETDRIVER = $00000002;
  {$EXTERNALSYM BSM_INSTALLABLEDRIVERS}
  BSM_INSTALLABLEDRIVERS = $00000004;
  {$EXTERNALSYM BSM_APPLICATIONS}
  BSM_APPLICATIONS = $00000008;
  {$EXTERNALSYM BSM_ALLDESKTOPS}
  BSM_ALLDESKTOPS = $00000010;

  { Broadcast Special Message Flags }
  {$EXTERNALSYM BSF_QUERY}
  BSF_QUERY = $00000001;
  {$EXTERNALSYM BSF_IGNORECURRENTTASK}
  BSF_IGNORECURRENTTASK = $00000002;
  {$EXTERNALSYM BSF_FLUSHDISK}
  BSF_FLUSHDISK = $00000004;
  {$EXTERNALSYM BSF_NOHANG}
  BSF_NOHANG = $00000008;
  {$EXTERNALSYM BSF_POSTMESSAGE}
  BSF_POSTMESSAGE = $00000010;
  {$EXTERNALSYM BSF_FORCEIFHUNG}
  BSF_FORCEIFHUNG = $00000020;
  {$EXTERNALSYM BSF_NOTIMEOUTIFNOTHUNG}
  BSF_NOTIMEOUTIFNOTHUNG = $00000040;

type
  PBroadcastSysMsg = ^TBroadcastSysMsg;
  {$EXTERNALSYM tagBROADCASTSYSMSG}
  tagBROADCASTSYSMSG = packed record
    uiMessage: UINT;
    wParam: WPARAM;
    lParam: LPARAM;
  end;
  TBroadcastSysMsg = tagBROADCASTSYSMSG;
  {$EXTERNALSYM BROADCASTSYSMSG}
  BROADCASTSYSMSG = tagBROADCASTSYSMSG;

const
  {$EXTERNALSYM DBWF_LPARAMPOINTER}
  DBWF_LPARAMPOINTER = $8000;

  {$EXTERNALSYM BROADCAST_QUERY_DENY}
  BROADCAST_QUERY_DENY = $424D5144;  { Return this value to deny a query. }

type
  {$EXTERNALSYM HDEVNOTIFY}
  HDEVNOTIFY = Pointer;
  {$EXTERNALSYM PHDEVNOTIFY}
  PHDEVNOTIFY = ^HDEVNOTIFY;

const
  {$EXTERNALSYM DEVICE_NOTIFY_WINDOW_HANDLE}
  DEVICE_NOTIFY_WINDOW_HANDLE = 0;

{$EXTERNALSYM RegisterDeviceNotificationA}
function RegisterDeviceNotificationA(hRecipient: THandle; NotificationFilter: Pointer; Flags: DWORD): HDEVNOTIFY; stdcall;
{$EXTERNALSYM RegisterDeviceNotificationW}
function RegisterDeviceNotificationW(hRecipient: THandle; NotificationFilter: Pointer; Flags: DWORD): HDEVNOTIFY; stdcall;
{$EXTERNALSYM RegisterDeviceNotification}
function RegisterDeviceNotification(hRecipient: THandle; NotificationFilter: Pointer; Flags: DWORD): HDEVNOTIFY; stdcall;
{$EXTERNALSYM UnregisterDeviceNotification}
function UnregisterDeviceNotification(Handle: HDEVNOTIFY): BOOL; stdcall;

{$EXTERNALSYM PostMessageA}
function PostMessageA(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM PostMessageW}
function PostMessageW(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM PostMessage}
function PostMessage(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM PostThreadMessageA}
function PostThreadMessageA(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM PostThreadMessageW}
function PostThreadMessageW(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM PostThreadMessage}
function PostThreadMessage(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM PostAppMessageA}
function PostAppMessageA(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL;
{$EXTERNALSYM PostAppMessageW}
function PostAppMessageW(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL;
{$EXTERNALSYM PostAppMessage}
function PostAppMessage(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL;

const
  { Special HWND value for use with PostMessage() and SendMessage() }
  {$EXTERNALSYM HWND_BROADCAST}
  HWND_BROADCAST = $FFFF;
  wnd_Broadcast = HWND_BROADCAST;

  {$EXTERNALSYM HWND_MESSAGE}
  HWND_MESSAGE = -3;
  wnd_Message = HWND_MESSAGE;

{$EXTERNALSYM AttachThreadInput}
function AttachThreadInput(idAttach, idAttachTo: DWORD; fAttach: BOOL): BOOL; stdcall;
{$EXTERNALSYM ReplyMessage}
function ReplyMessage(lResult: LRESULT): BOOL; stdcall;
{$EXTERNALSYM WaitMessage}
function WaitMessage: BOOL; stdcall;
{$EXTERNALSYM WaitForInputIdle}
function WaitForInputIdle(hProcess: THandle; dwMilliseconds: DWORD): DWORD; stdcall;
{$EXTERNALSYM DefWindowProcA}
function DefWindowProcA(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefWindowProcW}
function DefWindowProcW(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefWindowProc}
function DefWindowProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM CallWindowProcA}
function CallWindowProcA(lpPrevWndFunc: TFNWndProc; hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM CallWindowProcW}
function CallWindowProcW(lpPrevWndFunc: TFNWndProc; hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM CallWindowProc}
function CallWindowProc(lpPrevWndFunc: TFNWndProc; hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM PostQuitMessage}
procedure PostQuitMessage(nExitCode: Integer); stdcall;
{$EXTERNALSYM InSendMessage}
function InSendMessage: BOOL; stdcall;
{$EXTERNALSYM InSendMessageEx}
function InSendMessageEx(lpReserved: Pointer): DWORD; stdcall;

const
  { InSendMessageEx return value }
  {$EXTERNALSYM ISMEX_NOSEND}
  ISMEX_NOSEND = 0;
  {$EXTERNALSYM ISMEX_SEND}
  ISMEX_SEND = 1;
  {$EXTERNALSYM ISMEX_NOTIFY}
  ISMEX_NOTIFY = 2;
  {$EXTERNALSYM ISMEX_CALLBACK}
  ISMEX_CALLBACK = 4;
  {$EXTERNALSYM ISMEX_REPLIED}
  ISMEX_REPLIED = 8;

{$EXTERNALSYM GetDoubleClickTime}
function GetDoubleClickTime: UINT; stdcall;
{$EXTERNALSYM SetDoubleClickTime}
function SetDoubleClickTime(Interval: UINT): BOOL; stdcall;
{$EXTERNALSYM RegisterClassA}
function RegisterClassA(const lpWndClass: TWndClassA): ATOM; stdcall;
{$EXTERNALSYM RegisterClassW}
function RegisterClassW(const lpWndClass: TWndClassW): ATOM; stdcall;
{$EXTERNALSYM RegisterClass}
function RegisterClass(const lpWndClass: TWndClass): ATOM; stdcall;
{$EXTERNALSYM UnregisterClassA}
function UnregisterClassA(lpClassName: PAnsiChar; hInstance: HINST): BOOL; stdcall;
{$EXTERNALSYM UnregisterClassW}
function UnregisterClassW(lpClassName: PWideChar; hInstance: HINST): BOOL; stdcall;
{$EXTERNALSYM UnregisterClass}
function UnregisterClass(lpClassName: PChar; hInstance: HINST): BOOL; stdcall;
{$EXTERNALSYM GetClassInfoA}
function GetClassInfoA(hInstance: HINST; lpClassName: PAnsiChar;
  var lpWndClass: TWndClassA): BOOL; stdcall;
{$EXTERNALSYM GetClassInfoW}
function GetClassInfoW(hInstance: HINST; lpClassName: PWideChar;
  var lpWndClass: TWndClassW): BOOL; stdcall;
{$EXTERNALSYM GetClassInfo}
function GetClassInfo(hInstance: HINST; lpClassName: PChar;
  var lpWndClass: TWndClass): BOOL; stdcall;
{$EXTERNALSYM RegisterClassExA}
function RegisterClassExA(const WndClass: TWndClassExA): ATOM; stdcall;
{$EXTERNALSYM RegisterClassExW}
function RegisterClassExW(const WndClass: TWndClassExW): ATOM; stdcall;
{$EXTERNALSYM RegisterClassEx}
function RegisterClassEx(const WndClass: TWndClassEx): ATOM; stdcall;
{$EXTERNALSYM GetClassInfoExA}
function GetClassInfoExA(Instance: HINST; Classname: PAnsiChar; var WndClass: TWndClassExA): BOOL; stdcall;
{$EXTERNALSYM GetClassInfoExW}
function GetClassInfoExW(Instance: HINST; Classname: PWideChar; var WndClass: TWndClassExW): BOOL; stdcall;
{$EXTERNALSYM GetClassInfoEx}
function GetClassInfoEx(Instance: HINST; Classname: PChar; var WndClass: TWndClassEx): BOOL; stdcall;

const
  {$EXTERNALSYM CW_USEDEFAULT}
  CW_USEDEFAULT = DWORD($80000000);

  { Special value for CreateWindow, et al. }
  {$EXTERNALSYM HWND_DESKTOP}
  HWND_DESKTOP = 0;

{$EXTERNALSYM CreateWindowExA}
function CreateWindowExA(dwExStyle: DWORD; lpClassName: PAnsiChar;
  lpWindowName: PAnsiChar; dwStyle: DWORD; X, Y, nWidth, nHeight: Integer;
  hWndParent: HWND; hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND; stdcall;
{$EXTERNALSYM CreateWindowExW}
function CreateWindowExW(dwExStyle: DWORD; lpClassName: PWideChar;
  lpWindowName: PWideChar; dwStyle: DWORD; X, Y, nWidth, nHeight: Integer;
  hWndParent: HWND; hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND; stdcall;
{$EXTERNALSYM CreateWindowEx}
function CreateWindowEx(dwExStyle: DWORD; lpClassName: PChar;
  lpWindowName: PChar; dwStyle: DWORD; X, Y, nWidth, nHeight: Integer;
  hWndParent: HWND; hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND; stdcall;
{$EXTERNALSYM CreateWindowA}
function CreateWindowA(lpClassName: PAnsiChar; lpWindowName: PAnsiChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND;
  hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND;
{$EXTERNALSYM CreateWindowW}
function CreateWindowW(lpClassName: PWideChar; lpWindowName: PWideChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND;
  hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND;
{$EXTERNALSYM CreateWindow}
function CreateWindow(lpClassName: PChar; lpWindowName: PChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND;
  hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND;

{$EXTERNALSYM IsWindow}
function IsWindow(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM IsMenu}
function IsMenu(hMenu: HMENU): BOOL; stdcall;
{$EXTERNALSYM IsChild}
function IsChild(hWndParent, hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM DestroyWindow}
function DestroyWindow(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM ShowWindow}
function ShowWindow(hWnd: HWND; nCmdShow: Integer): BOOL; stdcall;
{$EXTERNALSYM AnimateWindow}
function AnimateWindow(hWnd: HWND; dwTime: DWORD; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM ShowWindowAsync}
function ShowWindowAsync(hWnd: HWND; nCmdShow: Integer): BOOL; stdcall;
{$EXTERNALSYM FlashWindow}
function FlashWindow(hWnd: HWND; dwFlags: BOOL): BOOL; stdcall;

const
  {$EXTERNALSYM FLASHW_STOP}
  FLASHW_STOP = $0;
  {$EXTERNALSYM FLASHW_CAPTION}
  FLASHW_CAPTION = $1;
  {$EXTERNALSYM FLASHW_TRAY}
  FLASHW_TRAY = $2;
  {$EXTERNALSYM FLASHW_ALL}
  FLASHW_ALL = FLASHW_CAPTION or FLASHW_TRAY;
  {$EXTERNALSYM FLASHW_TIMER}
  FLASHW_TIMER = $4;
  {$EXTERNALSYM FLASHW_TIMERNOFG}
  FLASHW_TIMERNOFG = $C;

{$EXTERNALSYM ShowOwnedPopups}
function ShowOwnedPopups(hWnd: HWND; fShow: BOOL): BOOL; stdcall;
{$EXTERNALSYM OpenIcon}
function OpenIcon(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM CloseWindow}
function CloseWindow(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM MoveWindow}
function MoveWindow(hWnd: HWND; X, Y, nWidth, nHeight: Integer; bRepaint: BOOL): BOOL; stdcall;
{$EXTERNALSYM SetWindowPos}
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
  X, Y, cx, cy: Integer; uFlags: UINT): BOOL; stdcall;
{$EXTERNALSYM GetWindowPlacement}
function GetWindowPlacement(hWnd: HWND; WindowPlacement: PWindowPlacement): BOOL; stdcall;
{$EXTERNALSYM SetWindowPlacement}
function SetWindowPlacement(hWnd: HWND; WindowPlacement: PWindowPlacement): BOOL; stdcall;
{$EXTERNALSYM BeginDeferWindowPos}
function BeginDeferWindowPos(nNumWindows: Integer): HDWP; stdcall;
{$EXTERNALSYM DeferWindowPos}
function DeferWindowPos(hWinPosInfo: HDWP; hWnd: HWND;
  hWndInsertAfter: HWND; x, y, cx, cy: Integer; uFlags: UINT): HDWP; stdcall;
{$EXTERNALSYM EndDeferWindowPos}
function EndDeferWindowPos(hWinPosInfo: HDWP): BOOL; stdcall;
{$EXTERNALSYM IsWindowVisible}
function IsWindowVisible(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM IsIconic}
function IsIconic(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM AnyPopup}
function AnyPopup: BOOL; stdcall;
{$EXTERNALSYM BringWindowToTop}
function BringWindowToTop(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM IsZoomed}
function IsZoomed(hWnd: HWND): BOOL; stdcall;


const
  { SetWindowPos Flags }
  {$EXTERNALSYM SWP_NOSIZE}
  SWP_NOSIZE = 1;
  {$EXTERNALSYM SWP_NOMOVE}
  SWP_NOMOVE = 2;
  {$EXTERNALSYM SWP_NOZORDER}
  SWP_NOZORDER = 4;
  {$EXTERNALSYM SWP_NOREDRAW}
  SWP_NOREDRAW = 8;
  {$EXTERNALSYM SWP_NOACTIVATE}
  SWP_NOACTIVATE = $10;
  {$EXTERNALSYM SWP_FRAMECHANGED}
  SWP_FRAMECHANGED = $20;    { The frame changed: send WM_NCCALCSIZE }
  {$EXTERNALSYM SWP_SHOWWINDOW}
  SWP_SHOWWINDOW = $40;
  {$EXTERNALSYM SWP_HIDEWINDOW}
  SWP_HIDEWINDOW = $80;
  {$EXTERNALSYM SWP_NOCOPYBITS}
  SWP_NOCOPYBITS = $100;
  {$EXTERNALSYM SWP_NOOWNERZORDER}
  SWP_NOOWNERZORDER = $200;  { Don't do owner Z ordering }
  {$EXTERNALSYM SWP_NOSENDCHANGING}
  SWP_NOSENDCHANGING = $400;  { Don't send WM_WINDOWPOSCHANGING }
  {$EXTERNALSYM SWP_DRAWFRAME}
  SWP_DRAWFRAME = SWP_FRAMECHANGED;
  {$EXTERNALSYM SWP_NOREPOSITION}
  SWP_NOREPOSITION = SWP_NOOWNERZORDER;
  {$EXTERNALSYM SWP_DEFERERASE}
  SWP_DEFERERASE = $2000;
  {$EXTERNALSYM SWP_ASYNCWINDOWPOS}
  SWP_ASYNCWINDOWPOS = $4000;

  {$EXTERNALSYM HWND_TOP}
  HWND_TOP = 0;
  {$EXTERNALSYM HWND_BOTTOM}
  HWND_BOTTOM = 1;
  {$EXTERNALSYM HWND_TOPMOST}
  HWND_TOPMOST = HWND(-1);
  {$EXTERNALSYM HWND_NOTOPMOST}
  HWND_NOTOPMOST = HWND(-2);


type
  PDlgTemplate = ^TDlgTemplate;
  {$EXTERNALSYM DLGTEMPLATE}
  DLGTEMPLATE = packed record
    style: DWORD;
    dwExtendedStyle: DWORD;
    cdit: Word;
    x: SHORT;
    y: SHORT;
    cx: SHORT;
    cy: SHORT;
  end;
  TDlgTemplate = DLGTEMPLATE;

  { 32 bit Dialog item template. }
  PDlgItemTemplate = ^TDlgItemTemplate;
  {$EXTERNALSYM DLGITEMTEMPLATE}
  DLGITEMTEMPLATE = packed record
    style: DWORD;
    dwExtendedStyle: DWORD;
    x: SHORT;
    y: SHORT;
    cx: SHORT;
    cy: SHORT;
    id: Word;
  end;
  TDlgItemTemplate = DLGITEMTEMPLATE;

{$EXTERNALSYM CreateDialogParamA}
function CreateDialogParamA(hInstance: HINST; lpTemplateName: PAnsiChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateDialogParamW}
function CreateDialogParamW(hInstance: HINST; lpTemplateName: PWideChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateDialogParam}
function CreateDialogParam(hInstance: HINST; lpTemplateName: PChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateDialogIndirectParamA}
function CreateDialogIndirectParamA(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateDialogIndirectParamW}
function CreateDialogIndirectParamW(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateDialogIndirectParam}
function CreateDialogIndirectParam(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateDialogA}
function CreateDialogA(hInstance: HINST; lpTemplateName: PAnsiChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
{$EXTERNALSYM CreateDialogW}
function CreateDialogW(hInstance: HINST; lpTemplateName: PWideChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
{$EXTERNALSYM CreateDialog}
function CreateDialog(hInstance: HINST; lpTemplateName: PChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
{$EXTERNALSYM CreateDialogIndirectA}
function CreateDialogIndirectA(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
{$EXTERNALSYM CreateDialogIndirectW}
function CreateDialogIndirectW(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
{$EXTERNALSYM CreateDialogIndirect}
function CreateDialogIndirect(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
{$EXTERNALSYM DialogBoxParamA}
function DialogBoxParamA(hInstance: HINST; lpTemplateName: PAnsiChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM DialogBoxParamW}
function DialogBoxParamW(hInstance: HINST; lpTemplateName: PWideChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM DialogBoxParam}
function DialogBoxParam(hInstance: HINST; lpTemplateName: PChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM DialogBoxIndirectParamA}
function DialogBoxIndirectParamA(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM DialogBoxIndirectParamW}
function DialogBoxIndirectParamW(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM DialogBoxIndirectParam}
function DialogBoxIndirectParam(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc; dwInitParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM DialogBoxA}
function DialogBoxA(hInstance: HINST; lpTemplate: PAnsiChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
{$EXTERNALSYM DialogBoxW}
function DialogBoxW(hInstance: HINST; lpTemplate: PWideChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
{$EXTERNALSYM DialogBox}
function DialogBox(hInstance: HINST; lpTemplate: PChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
{$EXTERNALSYM DialogBoxIndirectA}
function DialogBoxIndirectA(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
{$EXTERNALSYM DialogBoxIndirectW}
function DialogBoxIndirectW(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
{$EXTERNALSYM DialogBoxIndirect}
function DialogBoxIndirect(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
{$EXTERNALSYM EndDialog}
function EndDialog(hDlg: HWND; nResult: Integer): BOOL; stdcall;
{$EXTERNALSYM GetDlgItem}
function GetDlgItem(hDlg: HWND; nIDDlgItem: Integer): HWND; stdcall;
{$EXTERNALSYM SetDlgItemInt}
function SetDlgItemInt(hDlg: HWND; nIDDlgItem: Integer; uValue: UINT; bSigned: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetDlgItemInt}
function GetDlgItemInt(hDlg: HWND; nIDDlgItem: Integer;
  var lpTranslated: BOOL; bSigned: BOOL): UINT; stdcall;
{$EXTERNALSYM SetDlgItemTextA}
function SetDlgItemTextA(hDlg: HWND; nIDDlgItem: Integer; lpString: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetDlgItemTextW}
function SetDlgItemTextW(hDlg: HWND; nIDDlgItem: Integer; lpString: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetDlgItemText}
function SetDlgItemText(hDlg: HWND; nIDDlgItem: Integer; lpString: PChar): BOOL; stdcall;
{$EXTERNALSYM GetDlgItemTextA}
function GetDlgItemTextA(hDlg: HWND; nIDDlgItem: Integer;
  lpString: PAnsiChar; nMaxCount: Integer): UINT; stdcall;
{$EXTERNALSYM GetDlgItemTextW}
function GetDlgItemTextW(hDlg: HWND; nIDDlgItem: Integer;
  lpString: PWideChar; nMaxCount: Integer): UINT; stdcall;
{$EXTERNALSYM GetDlgItemText}
function GetDlgItemText(hDlg: HWND; nIDDlgItem: Integer;
  lpString: PChar; nMaxCount: Integer): UINT; stdcall;
{$EXTERNALSYM CheckDlgButton}
function CheckDlgButton(hDlg: HWND; nIDButton: Integer; uCheck: UINT): BOOL; stdcall;
{$EXTERNALSYM CheckRadioButton}
function CheckRadioButton(hDlg: HWND; nIDFirstButton, nIDLastButton, nIDCheckButton: Integer): BOOL; stdcall;
{$EXTERNALSYM IsDlgButtonChecked}
function IsDlgButtonChecked(hDlg: HWND; nIDButton: Integer): UINT; stdcall;
{$EXTERNALSYM SendDlgItemMessageA}
function SendDlgItemMessageA(hDlg: HWND; nIDDlgItem: Integer;
  Msg: UINT; wParam: WPARAM; lParam: LPARAM): Longint; stdcall;
{$EXTERNALSYM SendDlgItemMessageW}
function SendDlgItemMessageW(hDlg: HWND; nIDDlgItem: Integer;
  Msg: UINT; wParam: WPARAM; lParam: LPARAM): Longint; stdcall;
{$EXTERNALSYM SendDlgItemMessage}
function SendDlgItemMessage(hDlg: HWND; nIDDlgItem: Integer;
  Msg: UINT; wParam: WPARAM; lParam: LPARAM): Longint; stdcall;
{$EXTERNALSYM GetNextDlgGroupItem}
function GetNextDlgGroupItem(hDlg: HWND; hCtl: HWND; bPrevious: BOOL): HWND; stdcall;
{$EXTERNALSYM GetNextDlgTabItem}
function GetNextDlgTabItem(hDlg: HWND; hCtl: HWND; bPrevious: BOOL): HWND; stdcall;
{$EXTERNALSYM GetDlgCtrlID}
function GetDlgCtrlID(hWnd: HWND): Integer; stdcall;
{$EXTERNALSYM GetDialogBaseUnits}
function GetDialogBaseUnits: Longint; stdcall;
{$EXTERNALSYM DefDlgProcA}
function DefDlgProcA(hDlg: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefDlgProcW}
function DefDlgProcW(hDlg: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefDlgProc}
function DefDlgProc(hDlg: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;

const
  { Window extra byted needed for private dialog classes. }
  {$EXTERNALSYM DLGWINDOWEXTRA}
  DLGWINDOWEXTRA = 30;

{$EXTERNALSYM CallMsgFilterA}
function CallMsgFilterA(var lpMsg: TMsg; nCode: Integer): BOOL; stdcall;
{$EXTERNALSYM CallMsgFilterW}
function CallMsgFilterW(var lpMsg: TMsg; nCode: Integer): BOOL; stdcall;
{$EXTERNALSYM CallMsgFilter}
function CallMsgFilter(var lpMsg: TMsg; nCode: Integer): BOOL; stdcall;

{ Clipboard Manager Functions }

{$EXTERNALSYM OpenClipboard}
function OpenClipboard(hWndNewOwner: HWND): BOOL; stdcall;
{$EXTERNALSYM CloseClipboard}
function CloseClipboard: BOOL; stdcall;
{$EXTERNALSYM GetClipboardSequenceNumber}
function GetClipboardSequenceNumber: DWORD; stdcall;
{$EXTERNALSYM GetClipboardOwner}
function GetClipboardOwner: HWND; stdcall;
{$EXTERNALSYM SetClipboardViewer}
function SetClipboardViewer(hWndNewViewer: HWND): HWND; stdcall;
{$EXTERNALSYM GetClipboardViewer}
function GetClipboardViewer: HWND; stdcall;
{$EXTERNALSYM ChangeClipboardChain}
function ChangeClipboardChain(hWndRemove, hWndNewNext: HWND): BOOL; stdcall;
{$EXTERNALSYM SetClipboardData}
function SetClipboardData(uFormat: UINT; hMem: THandle): THandle; stdcall;
{$EXTERNALSYM GetClipboardData}
function GetClipboardData(uFormat: UINT): THandle; stdcall;
{$EXTERNALSYM RegisterClipboardFormatA}
function RegisterClipboardFormatA(lpszFormat: PAnsiChar): UINT; stdcall;
{$EXTERNALSYM RegisterClipboardFormatW}
function RegisterClipboardFormatW(lpszFormat: PWideChar): UINT; stdcall;
{$EXTERNALSYM RegisterClipboardFormat}
function RegisterClipboardFormat(lpszFormat: PChar): UINT; stdcall;
{$EXTERNALSYM CountClipboardFormats}
function CountClipboardFormats: Integer; stdcall;
{$EXTERNALSYM EnumClipboardFormats}
function EnumClipboardFormats(format: UINT): UINT; stdcall;
{$EXTERNALSYM GetClipboardFormatNameA}
function GetClipboardFormatNameA(format: UINT; lpszFormatName: PAnsiChar;
  cchMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetClipboardFormatNameW}
function GetClipboardFormatNameW(format: UINT; lpszFormatName: PWideChar;
  cchMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetClipboardFormatName}
function GetClipboardFormatName(format: UINT; lpszFormatName: PChar;
  cchMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM EmptyClipboard}
function EmptyClipboard: BOOL; stdcall;
{$EXTERNALSYM IsClipboardFormatAvailable}
function IsClipboardFormatAvailable(format: UINT): BOOL; stdcall;
{$EXTERNALSYM GetPriorityClipboardFormat}
function GetPriorityClipboardFormat(var paFormatPriorityList; cFormats: Integer): Integer; stdcall;
{$EXTERNALSYM GetOpenClipboardWindow}
function GetOpenClipboardWindow: HWND; stdcall;

{ Character Translation Routines }

{$EXTERNALSYM CharToOemA}
function CharToOemA(lpszSrc: PAnsiChar; lpszDst: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM CharToOemW}
function CharToOemW(lpszSrc: PWideChar; lpszDst: PWideChar): BOOL; stdcall;
{$EXTERNALSYM CharToOem}
function CharToOem(lpszSrc: PChar; lpszDst: PChar): BOOL; stdcall;
{$EXTERNALSYM OemToCharA}
function OemToCharA(lpszSrc: PAnsiChar; lpszDst: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM OemToCharW}
function OemToCharW(lpszSrc: PWideChar; lpszDst: PWideChar): BOOL; stdcall;
{$EXTERNALSYM OemToChar}
function OemToChar(lpszSrc: PChar; lpszDst: PChar): BOOL; stdcall;
{$EXTERNALSYM CharToOemBuffA}
function CharToOemBuffA(lpszSrc: PAnsiChar; lpszDst: PAnsiChar; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM CharToOemBuffW}
function CharToOemBuffW(lpszSrc: PWideChar; lpszDst: PWideChar; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM CharToOemBuff}
function CharToOemBuff(lpszSrc: PChar; lpszDst: PChar; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM OemToCharBuffA}
function OemToCharBuffA(lpszSrc: PAnsiChar; lpszDst: PAnsiChar; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM OemToCharBuffW}
function OemToCharBuffW(lpszSrc: PWideChar; lpszDst: PWideChar; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM OemToCharBuff}
function OemToCharBuff(lpszSrc: PChar; lpszDst: PChar; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM CharUpperA}
function CharUpperA(lpsz: PAnsiChar): PAnsiChar; stdcall;
{$EXTERNALSYM CharUpperW}
function CharUpperW(lpsz: PWideChar): PWideChar; stdcall;
{$EXTERNALSYM CharUpper}
function CharUpper(lpsz: PChar): PChar; stdcall;
{$EXTERNALSYM CharUpperBuffA}
function CharUpperBuffA(lpsz: PAnsiChar; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM CharUpperBuffW}
function CharUpperBuffW(lpsz: PWideChar; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM CharUpperBuff}
function CharUpperBuff(lpsz: PChar; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM CharLowerA}
function CharLowerA(lpsz: PAnsiChar): PAnsiChar; stdcall;
{$EXTERNALSYM CharLowerW}
function CharLowerW(lpsz: PWideChar): PWideChar; stdcall;
{$EXTERNALSYM CharLower}
function CharLower(lpsz: PChar): PChar; stdcall;
{$EXTERNALSYM CharLowerBuffA}
function CharLowerBuffA(lpsz: PAnsiChar; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM CharLowerBuffW}
function CharLowerBuffW(lpsz: PWideChar; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM CharLowerBuff}
function CharLowerBuff(lpsz: PChar; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM CharNextA}
function CharNextA(lpsz: PAnsiChar): PAnsiChar; stdcall;
{$EXTERNALSYM CharNextW}
function CharNextW(lpsz: PWideChar): PWideChar; stdcall;
{$EXTERNALSYM CharNext}
function CharNext(lpsz: PChar): PChar; stdcall;
{$EXTERNALSYM CharPrevA}
function CharPrevA(lpszStart: PAnsiChar; lpszCurrent: PAnsiChar): PAnsiChar; stdcall;
{$EXTERNALSYM CharPrevW}
function CharPrevW(lpszStart: PWideChar; lpszCurrent: PWideChar): PWideChar; stdcall;
{$EXTERNALSYM CharPrev}
function CharPrev(lpszStart: PChar; lpszCurrent: PChar): PChar; stdcall;

{$EXTERNALSYM CharNextExA}
function CharNextExA(CodePage: Word; lpCurrentChar: LPCSTR; dwFlags: DWORD): LPSTR; stdcall;
{$EXTERNALSYM CharNextEx}
function CharNextEx(CodePage: Word; lpCurrentChar: LPCSTR; dwFlags: DWORD): LPSTR; stdcall;
{$EXTERNALSYM CharPrevEx}
function CharPrevEx(CodePage: Word; lpStart, lpCurrentChar: LPCSTR; dwFlags: DWORD): LPSTR; stdcall;
{$EXTERNALSYM CharPrevExA}
function CharPrevExA(CodePage: Word; lpStart, lpCurrentChar: LPCSTR; dwFlags: DWORD): LPSTR; stdcall;

{ Compatibility defines for character translation routines }

{$EXTERNALSYM AnsiToOem}
function AnsiToOem(const lpszSrc: LPCSTR; lpszDst: LPSTR): BOOL; stdcall;
{$EXTERNALSYM OemToAnsi}
function OemToAnsi(const lpszSrc: LPCSTR; lpszDst: LPSTR): BOOL; stdcall;
{$EXTERNALSYM AnsiToOemBuff}
function AnsiToOemBuff(lpszSrc: LPCSTR; lpszDst: LPSTR; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM OemToAnsiBuff}
function OemToAnsiBuff(lpszSrc: LPCSTR; lpszDst: LPSTR; cchDstLength: DWORD): BOOL; stdcall;
{$EXTERNALSYM AnsiUpper}
function AnsiUpper(lpsz: LPSTR): LPSTR; stdcall;
{$EXTERNALSYM AnsiUpperBuff}
function AnsiUpperBuff(lpsz: LPSTR; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM AnsiLower}
function AnsiLower(lpsz: LPSTR): LPSTR; stdcall;
{$EXTERNALSYM AnsiLowerBuff}
function AnsiLowerBuff(lpsz: LPSTR; cchLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM AnsiNext}
function AnsiNext(const lpsz: LPCSTR): LPSTR; stdcall;
{$EXTERNALSYM AnsiPrev}
function AnsiPrev(const lpszStart: LPCSTR; const lpszCurrent: LPCSTR): LPSTR; stdcall;

{ Language dependent Routines }

{$EXTERNALSYM IsCharAlphaA}
function IsCharAlphaA(ch: AnsiChar): BOOL; stdcall;
{$EXTERNALSYM IsCharAlphaW}
function IsCharAlphaW(ch: WideChar): BOOL; stdcall;
{$EXTERNALSYM IsCharAlpha}
function IsCharAlpha(ch: Char): BOOL; stdcall;
{$EXTERNALSYM IsCharAlphaNumericA}
function IsCharAlphaNumericA(ch: AnsiChar): BOOL; stdcall;
{$EXTERNALSYM IsCharAlphaNumericW}
function IsCharAlphaNumericW(ch: WideChar): BOOL; stdcall;
{$EXTERNALSYM IsCharAlphaNumeric}
function IsCharAlphaNumeric(ch: Char): BOOL; stdcall;
{$EXTERNALSYM IsCharUpperA}
function IsCharUpperA(ch: AnsiChar): BOOL; stdcall;
{$EXTERNALSYM IsCharUpperW}
function IsCharUpperW(ch: WideChar): BOOL; stdcall;
{$EXTERNALSYM IsCharUpper}
function IsCharUpper(ch: Char): BOOL; stdcall;
{$EXTERNALSYM IsCharLowerA}
function IsCharLowerA(ch: AnsiChar): BOOL; stdcall;
{$EXTERNALSYM IsCharLowerW}
function IsCharLowerW(ch: WideChar): BOOL; stdcall;
{$EXTERNALSYM IsCharLower}
function IsCharLower(ch: Char): BOOL; stdcall;

{$EXTERNALSYM SetFocus}
function SetFocus(hWnd: HWND): HWND; stdcall;
{$EXTERNALSYM GetActiveWindow}
function GetActiveWindow: HWND; stdcall;
{$EXTERNALSYM GetFocus}
function GetFocus: HWND; stdcall;
{$EXTERNALSYM GetKBCodePage}
function GetKBCodePage: UINT; stdcall;
{$EXTERNALSYM GetKeyState}
function GetKeyState(nVirtKey: Integer): SHORT; stdcall;
{$EXTERNALSYM GetAsyncKeyState}
function GetAsyncKeyState(vKey: Integer): SHORT; stdcall;

type
  PKeyboardState = ^TKeyboardState;
  TKeyboardState = array[0..255] of Byte;

{$EXTERNALSYM GetKeyboardState}
function GetKeyboardState(var KeyState: TKeyboardState): BOOL; stdcall;
{$EXTERNALSYM SetKeyboardState}
function SetKeyboardState(var KeyState: TKeyboardState): BOOL; stdcall;
{$EXTERNALSYM GetKeyNameTextA}
function GetKeyNameTextA(lParam: Longint; lpString: PAnsiChar; nSize: Integer): Integer; stdcall;
{$EXTERNALSYM GetKeyNameTextW}
function GetKeyNameTextW(lParam: Longint; lpString: PWideChar; nSize: Integer): Integer; stdcall;
{$EXTERNALSYM GetKeyNameText}
function GetKeyNameText(lParam: Longint; lpString: PChar; nSize: Integer): Integer; stdcall;
{$EXTERNALSYM GetKeyboardType}
function GetKeyboardType(nTypeFlag: Integer): Integer; stdcall;
{$EXTERNALSYM ToAscii}
function ToAscii(uVirtKey, uScanCode: UINT; const KeyState: TKeyboardState;
  lpChar: PChar; uFlags: UINT): Integer; stdcall;
{$EXTERNALSYM ToAsciiEx}
function ToAsciiEx(uVirtKey: UINT; uScanCode: UINT; const KeyState: TKeyboardState;
  lpChar: PChar; uFlags: UINT; dwhkl: HKL): Integer; stdcall;
{$EXTERNALSYM ToUnicode}
function ToUnicode(wVirtKey, wScanCode: UINT; const KeyState: TKeyboardState;
  var pwszBuff; cchBuff: Integer; wFlags: UINT): Integer; stdcall;
{$EXTERNALSYM OemKeyScan}
function OemKeyScan(wOemChar: Word): DWORD; stdcall;

{$EXTERNALSYM VkKeyScanA}
function VkKeyScanA(ch: AnsiChar): SHORT; stdcall;
{$EXTERNALSYM VkKeyScanW}
function VkKeyScanW(ch: WideChar): SHORT; stdcall;
{$EXTERNALSYM VkKeyScan}
function VkKeyScan(ch: Char): SHORT; stdcall;
{$EXTERNALSYM VkKeyScanExA}
function VkKeyScanExA(ch: AnsiChar; dwhkl: HKL): SHORT; stdcall;
{$EXTERNALSYM VkKeyScanExW}
function VkKeyScanExW(ch: WideChar; dwhkl: HKL): SHORT; stdcall;
{$EXTERNALSYM VkKeyScanEx}
function VkKeyScanEx(ch: Char; dwhkl: HKL): SHORT; stdcall;

const
  {$EXTERNALSYM KEYEVENTF_EXTENDEDKEY}
  KEYEVENTF_EXTENDEDKEY = 1;
  {$EXTERNALSYM KEYEVENTF_KEYUP}
  KEYEVENTF_KEYUP = 2;

{$EXTERNALSYM keybd_event}
procedure keybd_event(bVk: Byte; bScan: Byte; dwFlags, dwExtraInfo: DWORD); stdcall;

const
  {$EXTERNALSYM MOUSEEVENTF_MOVE}
  MOUSEEVENTF_MOVE            = $0001; { mouse move }
  {$EXTERNALSYM MOUSEEVENTF_LEFTDOWN}
  MOUSEEVENTF_LEFTDOWN        = $0002; { left button down }
  {$EXTERNALSYM MOUSEEVENTF_LEFTUP}
  MOUSEEVENTF_LEFTUP          = $0004; { left button up }
  {$EXTERNALSYM MOUSEEVENTF_RIGHTDOWN}
  MOUSEEVENTF_RIGHTDOWN       = $0008; { right button down }
  {$EXTERNALSYM MOUSEEVENTF_RIGHTUP}
  MOUSEEVENTF_RIGHTUP         = $0010; { right button up }
  {$EXTERNALSYM MOUSEEVENTF_MIDDLEDOWN}
  MOUSEEVENTF_MIDDLEDOWN      = $0020; { middle button down }
  {$EXTERNALSYM MOUSEEVENTF_MIDDLEUP}
  MOUSEEVENTF_MIDDLEUP        = $0040; { middle button up }
  {$EXTERNALSYM MOUSEEVENTF_WHEEL}
  MOUSEEVENTF_WHEEL           = $0800; { wheel button rolled }
  {$EXTERNALSYM MOUSEEVENTF_ABSOLUTE}
  MOUSEEVENTF_ABSOLUTE        = $8000; { absolute move }

{$EXTERNALSYM mouse_event}
procedure mouse_event(dwFlags, dx, dy, dwData, dwExtraInfo: DWORD); stdcall;

type
  PMouseInput = ^TMouseInput;
  {$EXTERNALSYM tagMOUSEINPUT}
  tagMOUSEINPUT = packed record
    dx: Longint;
    dy: Longint;
    mouseData: DWORD;
    dwFlags: DWORD;
    time: DWORD;
    dwExtractInfo: DWORD;
  end;
  TMouseInput = tagMOUSEINPUT;

  PKeybdInput = ^TKeybdInput;
  {$EXTERNALSYM tagKEYBDINPUT}
  tagKEYBDINPUT = packed record
    wVk: WORD;
    wScan: WORD;
    dwFlags: DWORD;
    time: DWORD;
    dwExtractInfo: DWORD;
  end;
  TKeybdInput = tagKEYBDINPUT;

  PHardwareInput = ^THardwareInput;
  {$EXTERNALSYM tagHARDWAREINPUT}
  tagHARDWAREINPUT = packed record
    uMsg: DWORD;
    wParamL: WORD;
    wParamH: WORD;
  end;
  THardwareInput = tagHARDWAREINPUT;

const
  {$EXTERNALSYM INPUT_MOUSE}
  INPUT_MOUSE = 0;
  {$EXTERNALSYM INPUT_KEYBOARD}
  INPUT_KEYBOARD = 0;
  {$EXTERNALSYM INPUT_HARDWARE}
  INPUT_HARDWARE = 0;

type
  PInput = ^TInput;
  {$EXTERNALSYM tagINPUT}
  tagINPUT = packed record
    Itype: DWORD;
    case Integer of
      0: (mi: TMouseInput);
      1: (ki: TKeybdInput);
      2: (hi: THardwareInput);
  end;
  TInput = tagINPUT;

{$EXTERNALSYM SendInput}
function SendInput(cInputs: UINT; var pInputs: TInput; cbSize: Integer): UINT; stdcall;

type
  PLastInputInfo = ^TLastInputInfo;
  {$EXTERNALSYM tagLASTINPUTINFO}
  tagLASTINPUTINFO = packed record
    cbSize: UINT;
    dwTime: DWORD;
  end;
  TLastInputInfo = tagLASTINPUTINFO;

{$EXTERNALSYM GetLastInputInfo}
function GetLastInputInfo(var plii: TLastInputInfo): BOOL; stdcall;

{$EXTERNALSYM MapVirtualKeyA}
function MapVirtualKeyA(uCode, uMapType: UINT): UINT; stdcall;
{$EXTERNALSYM MapVirtualKeyW}
function MapVirtualKeyW(uCode, uMapType: UINT): UINT; stdcall;
{$EXTERNALSYM MapVirtualKey}
function MapVirtualKey(uCode, uMapType: UINT): UINT; stdcall;
{$EXTERNALSYM MapVirtualKeyExA}
function MapVirtualKeyExA(uCode, uMapType: UINT; dwhkl: HKL): UINT; stdcall;
{$EXTERNALSYM MapVirtualKeyExW}
function MapVirtualKeyExW(uCode, uMapType: UINT; dwhkl: HKL): UINT; stdcall;
{$EXTERNALSYM MapVirtualKeyEx}
function MapVirtualKeyEx(uCode, uMapType: UINT; dwhkl: HKL): UINT; stdcall;
{$EXTERNALSYM GetInputState}
function GetInputState: BOOL; stdcall;
{$EXTERNALSYM GetQueueStatus}
function GetQueueStatus(flags: UINT): DWORD; stdcall;
{$EXTERNALSYM GetCapture}
function GetCapture: HWND; stdcall;
{$EXTERNALSYM SetCapture}
function SetCapture(hWnd: HWND): HWND; stdcall;
{$EXTERNALSYM ReleaseCapture}
function ReleaseCapture: BOOL; stdcall;
{$EXTERNALSYM MsgWaitForMultipleObjects}
function MsgWaitForMultipleObjects(nCount: DWORD; var pHandles;
  fWaitAll: BOOL; dwMilliseconds, dwWakeMask: DWORD): DWORD; stdcall;
{$EXTERNALSYM MsgWaitForMultipleObjectsEx}
function MsgWaitForMultipleObjectsEx(nCount: DWORD; var pHandles;
  dwMilliseconds, dwWakeMask, dwFlags: DWORD): DWORD; stdcall;

const
  {$EXTERNALSYM MWMO_WAITALL}
  MWMO_WAITALL = $0001;
  {$EXTERNALSYM MWMO_ALERTABLE}
  MWMO_ALERTABLE = $0002;

  { Queue status flags for GetQueueStatus() and MsgWaitForMultipleObjects() }
  {$EXTERNALSYM QS_KEY}
  QS_KEY                  = $0001;
  {$EXTERNALSYM QS_MOUSEMOVE}
  QS_MOUSEMOVE            = $0002;
  {$EXTERNALSYM QS_MOUSEBUTTON}
  QS_MOUSEBUTTON          = $0004;
  {$EXTERNALSYM QS_POSTMESSAGE}
  QS_POSTMESSAGE          = $0008;
  {$EXTERNALSYM QS_TIMER}
  QS_TIMER                = $0010;
  {$EXTERNALSYM QS_PAINT}
  QS_PAINT                = $0020;
  {$EXTERNALSYM QS_SENDMESSAGE}
  QS_SENDMESSAGE          = $0040;
  {$EXTERNALSYM QS_HOTKEY}
  QS_HOTKEY               = $0080;
  {$EXTERNALSYM QS_ALLPOSTMESSAGE}
  QS_ALLPOSTMESSAGE       = $0100;

  {$EXTERNALSYM QS_MOUSE}
  QS_MOUSE = (QS_MOUSEMOVE or QS_MOUSEBUTTON);
  {$EXTERNALSYM QS_INPUT}
  QS_INPUT = (QS_MOUSE or QS_KEY);
  {$EXTERNALSYM QS_ALLEVENTS}
  QS_ALLEVENTS = (QS_INPUT or QS_POSTMESSAGE or QS_TIMER or QS_PAINT
    or QS_HOTKEY);
  {$EXTERNALSYM QS_ALLINPUT}
  QS_ALLINPUT = (QS_INPUT or QS_POSTMESSAGE or QS_TIMER or QS_PAINT
    or QS_HOTKEY or QS_SENDMESSAGE);


{ Windows Functions }

{$EXTERNALSYM SetTimer}
function SetTimer(hWnd: HWND; nIDEvent, uElapse: UINT;
  lpTimerFunc: TFNTimerProc): UINT; stdcall;
{$EXTERNALSYM KillTimer}
function KillTimer(hWnd: HWND; uIDEvent: UINT): BOOL; stdcall;
{$EXTERNALSYM IsWindowUnicode}
function IsWindowUnicode(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM EnableWindow}
function EnableWindow(hWnd: HWND; bEnable: BOOL): BOOL; stdcall;
{$EXTERNALSYM IsWindowEnabled}
function IsWindowEnabled(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM LoadAcceleratorsA}
function LoadAcceleratorsA(hInstance: HINST; lpTableName: PAnsiChar): HACCEL; stdcall;
{$EXTERNALSYM LoadAcceleratorsW}
function LoadAcceleratorsW(hInstance: HINST; lpTableName: PWideChar): HACCEL; stdcall;
{$EXTERNALSYM LoadAccelerators}
function LoadAccelerators(hInstance: HINST; lpTableName: PChar): HACCEL; stdcall;
{$EXTERNALSYM CreateAcceleratorTableA}
function CreateAcceleratorTableA(var Accel; Count: Integer): HACCEL; stdcall;
{$EXTERNALSYM CreateAcceleratorTableW}
function CreateAcceleratorTableW(var Accel; Count: Integer): HACCEL; stdcall;
{$EXTERNALSYM CreateAcceleratorTable}
function CreateAcceleratorTable(var Accel; Count: Integer): HACCEL; stdcall;
{$EXTERNALSYM CopyAcceleratorTableA}
function CopyAcceleratorTableA(hAccelSrc: HACCEL; var lpAccelDst; cAccelEntries: Integer): Integer; stdcall;
{$EXTERNALSYM CopyAcceleratorTableW}
function CopyAcceleratorTableW(hAccelSrc: HACCEL; var lpAccelDst; cAccelEntries: Integer): Integer; stdcall;
{$EXTERNALSYM CopyAcceleratorTable}
function CopyAcceleratorTable(hAccelSrc: HACCEL; var lpAccelDst; cAccelEntries: Integer): Integer; stdcall;
{$EXTERNALSYM TranslateAcceleratorA}
function TranslateAcceleratorA(hWnd: HWND; hAccTable: HACCEL; var lpMsg: TMsg): Integer; stdcall;
{$EXTERNALSYM TranslateAcceleratorW}
function TranslateAcceleratorW(hWnd: HWND; hAccTable: HACCEL; var lpMsg: TMsg): Integer; stdcall;
{$EXTERNALSYM TranslateAccelerator}
function TranslateAccelerator(hWnd: HWND; hAccTable: HACCEL; var lpMsg: TMsg): Integer; stdcall;
{$EXTERNALSYM DestroyAcceleratorTable}
function DestroyAcceleratorTable(hAccel: HACCEL): BOOL; stdcall;

const
  { GetSystemMetrics() codes }
  {$EXTERNALSYM SM_CXSCREEN}
  SM_CXSCREEN = 0;
  {$EXTERNALSYM SM_CYSCREEN}
  SM_CYSCREEN = 1;
  {$EXTERNALSYM SM_CXVSCROLL}
  SM_CXVSCROLL = 2;
  {$EXTERNALSYM SM_CYHSCROLL}
  SM_CYHSCROLL = 3;
  {$EXTERNALSYM SM_CYCAPTION}
  SM_CYCAPTION = 4;
  {$EXTERNALSYM SM_CXBORDER}
  SM_CXBORDER = 5;
  {$EXTERNALSYM SM_CYBORDER}
  SM_CYBORDER = 6;
  {$EXTERNALSYM SM_CXDLGFRAME}
  SM_CXDLGFRAME = 7;
  {$EXTERNALSYM SM_CYDLGFRAME}
  SM_CYDLGFRAME = 8;
  {$EXTERNALSYM SM_CYVTHUMB}
  SM_CYVTHUMB = 9;
  {$EXTERNALSYM SM_CXHTHUMB}
  SM_CXHTHUMB = 10;
  {$EXTERNALSYM SM_CXICON}
  SM_CXICON = 11;
  {$EXTERNALSYM SM_CYICON}
  SM_CYICON = 12;
  {$EXTERNALSYM SM_CXCURSOR}
  SM_CXCURSOR = 13;
  {$EXTERNALSYM SM_CYCURSOR}
  SM_CYCURSOR = 14;
  {$EXTERNALSYM SM_CYMENU}
  SM_CYMENU = 15;
  {$EXTERNALSYM SM_CXFULLSCREEN}
  SM_CXFULLSCREEN = $10;
  {$EXTERNALSYM SM_CYFULLSCREEN}
  SM_CYFULLSCREEN = 17;
  {$EXTERNALSYM SM_CYKANJIWINDOW}
  SM_CYKANJIWINDOW = 18;
  {$EXTERNALSYM SM_MOUSEPRESENT}
  SM_MOUSEPRESENT = 19;
  {$EXTERNALSYM SM_CYVSCROLL}
  SM_CYVSCROLL = 20;
  {$EXTERNALSYM SM_CXHSCROLL}
  SM_CXHSCROLL = 21;
  {$EXTERNALSYM SM_DEBUG}
  SM_DEBUG = 22;
  {$EXTERNALSYM SM_SWAPBUTTON}
  SM_SWAPBUTTON = 23;
  {$EXTERNALSYM SM_RESERVED1}
  SM_RESERVED1 = 24;
  {$EXTERNALSYM SM_RESERVED2}
  SM_RESERVED2 = 25;
  {$EXTERNALSYM SM_RESERVED3}
  SM_RESERVED3 = 26;
  {$EXTERNALSYM SM_RESERVED4}
  SM_RESERVED4 = 27;
  {$EXTERNALSYM SM_CXMIN}
  SM_CXMIN = 28;
  {$EXTERNALSYM SM_CYMIN}
  SM_CYMIN = 29;
  {$EXTERNALSYM SM_CXSIZE}
  SM_CXSIZE = 30;
  {$EXTERNALSYM SM_CYSIZE}
  SM_CYSIZE = 31;
  {$EXTERNALSYM SM_CXFRAME}
  SM_CXFRAME = $20;
  {$EXTERNALSYM SM_CYFRAME}
  SM_CYFRAME = 33;
  {$EXTERNALSYM SM_CXMINTRACK}
  SM_CXMINTRACK = 34;
  {$EXTERNALSYM SM_CYMINTRACK}
  SM_CYMINTRACK = 35;
  {$EXTERNALSYM SM_CXDOUBLECLK}
  SM_CXDOUBLECLK = 36;
  {$EXTERNALSYM SM_CYDOUBLECLK}
  SM_CYDOUBLECLK = 37;
  {$EXTERNALSYM SM_CXICONSPACING}
  SM_CXICONSPACING = 38;
  {$EXTERNALSYM SM_CYICONSPACING}
  SM_CYICONSPACING = 39;
  {$EXTERNALSYM SM_MENUDROPALIGNMENT}
  SM_MENUDROPALIGNMENT = 40;
  {$EXTERNALSYM SM_PENWINDOWS}
  SM_PENWINDOWS = 41;
  {$EXTERNALSYM SM_DBCSENABLED}
  SM_DBCSENABLED = 42;
  {$EXTERNALSYM SM_CMOUSEBUTTONS}
  SM_CMOUSEBUTTONS = 43;

  {$EXTERNALSYM SM_CXFIXEDFRAME}
  SM_CXFIXEDFRAME = SM_CXDLGFRAME; { win40 name change }
  {$EXTERNALSYM SM_CYFIXEDFRAME}
  SM_CYFIXEDFRAME = SM_CYDLGFRAME; { win40 name change }
  {$EXTERNALSYM SM_CXSIZEFRAME}
  SM_CXSIZEFRAME = SM_CXFRAME;     { win40 name change }
  {$EXTERNALSYM SM_CYSIZEFRAME}
  SM_CYSIZEFRAME = SM_CYFRAME;     { win40 name change }

  {$EXTERNALSYM SM_SECURE}
  SM_SECURE = 44;
  {$EXTERNALSYM SM_CXEDGE}
  SM_CXEDGE = 45;
  {$EXTERNALSYM SM_CYEDGE}
  SM_CYEDGE = 46;
  {$EXTERNALSYM SM_CXMINSPACING}
  SM_CXMINSPACING = 47;
  {$EXTERNALSYM SM_CYMINSPACING}
  SM_CYMINSPACING = 48;
  {$EXTERNALSYM SM_CXSMICON}
  SM_CXSMICON = 49;
  {$EXTERNALSYM SM_CYSMICON}
  SM_CYSMICON = 50;
  {$EXTERNALSYM SM_CYSMCAPTION}
  SM_CYSMCAPTION = 51;
  {$EXTERNALSYM SM_CXSMSIZE}
  SM_CXSMSIZE = 52;
  {$EXTERNALSYM SM_CYSMSIZE}
  SM_CYSMSIZE = 53;
  {$EXTERNALSYM SM_CXMENUSIZE}
  SM_CXMENUSIZE = 54;
  {$EXTERNALSYM SM_CYMENUSIZE}
  SM_CYMENUSIZE = 55;
  {$EXTERNALSYM SM_ARRANGE}
  SM_ARRANGE = 56;
  {$EXTERNALSYM SM_CXMINIMIZED}
  SM_CXMINIMIZED = 57;
  {$EXTERNALSYM SM_CYMINIMIZED}
  SM_CYMINIMIZED = 58;
  {$EXTERNALSYM SM_CXMAXTRACK}
  SM_CXMAXTRACK = 59;
  {$EXTERNALSYM SM_CYMAXTRACK}
  SM_CYMAXTRACK = 60;
  {$EXTERNALSYM SM_CXMAXIMIZED}
  SM_CXMAXIMIZED = 61;
  {$EXTERNALSYM SM_CYMAXIMIZED}
  SM_CYMAXIMIZED = 62;
  {$EXTERNALSYM SM_NETWORK}
  SM_NETWORK = 63;
  {$EXTERNALSYM SM_CLEANBOOT}
  SM_CLEANBOOT = 67;
  {$EXTERNALSYM SM_CXDRAG}
  SM_CXDRAG = 68;
  {$EXTERNALSYM SM_CYDRAG}
  SM_CYDRAG = 69;
  {$EXTERNALSYM SM_SHOWSOUNDS}
  SM_SHOWSOUNDS = 70;
  {$EXTERNALSYM SM_CXMENUCHECK}
  SM_CXMENUCHECK = 71;     { Use instead of GetMenuCheckMarkDimensions()! }
  {$EXTERNALSYM SM_CYMENUCHECK}
  SM_CYMENUCHECK = 72;
  {$EXTERNALSYM SM_SLOWMACHINE}
  SM_SLOWMACHINE = 73;
  {$EXTERNALSYM SM_MIDEASTENABLED}
  SM_MIDEASTENABLED = 74;
  {$EXTERNALSYM SM_MOUSEWHEELPRESENT}
  SM_MOUSEWHEELPRESENT = 75;
  {$EXTERNALSYM SM_CMETRICS}
  SM_CMETRICS = 76;

{$EXTERNALSYM GetSystemMetrics}
function GetSystemMetrics(nIndex: Integer): Integer; stdcall;
{$EXTERNALSYM LoadMenuA}
function LoadMenuA(hInstance: HINST; lpMenuName: PAnsiChar): HMENU; stdcall;
{$EXTERNALSYM LoadMenuW}
function LoadMenuW(hInstance: HINST; lpMenuName: PAnsiChar): HMENU; stdcall;
{$EXTERNALSYM LoadMenu}
function LoadMenu(hInstance: HINST; lpMenuName: PAnsiChar): HMENU; stdcall;
{$EXTERNALSYM LoadMenuIndirectA}
function LoadMenuIndirectA(lpMenuTemplate: Pointer): HMENU; stdcall;
{$EXTERNALSYM LoadMenuIndirectW}
function LoadMenuIndirectW(lpMenuTemplate: Pointer): HMENU; stdcall;
{$EXTERNALSYM LoadMenuIndirect}
function LoadMenuIndirect(lpMenuTemplate: Pointer): HMENU; stdcall;
{$EXTERNALSYM GetMenu}
function GetMenu(hWnd: HWND): HMENU; stdcall;
{$EXTERNALSYM SetMenu}
function SetMenu(hWnd: HWND; hMenu: HMENU): BOOL; stdcall;
{$EXTERNALSYM ChangeMenuA}
function ChangeMenuA(hMenu: HMENU; cmd: UINT; lpszNewItem: PAnsiChar;
  cmdInsert: UINT; flags: UINT): BOOL; stdcall;
{$EXTERNALSYM ChangeMenuW}
function ChangeMenuW(hMenu: HMENU; cmd: UINT; lpszNewItem: PWideChar;
  cmdInsert: UINT; flags: UINT): BOOL; stdcall;
{$EXTERNALSYM ChangeMenu}
function ChangeMenu(hMenu: HMENU; cmd: UINT; lpszNewItem: PChar;
  cmdInsert: UINT; flags: UINT): BOOL; stdcall;
{$EXTERNALSYM HiliteMenuItem}
function HiliteMenuItem(hWnd: HWND; hMenu: HMENU; uIDHiliteItem: UINT;
  uHilite: UINT): BOOL; stdcall;
{$EXTERNALSYM GetMenuStringA}
function GetMenuStringA(hMenu: HMENU; uIDItem: UINT; lpString: PAnsiChar;
  nMaxCount: Integer; uFlag: UINT): Integer; stdcall;
{$EXTERNALSYM GetMenuStringW}
function GetMenuStringW(hMenu: HMENU; uIDItem: UINT; lpString: PWideChar;
  nMaxCount: Integer; uFlag: UINT): Integer; stdcall;
{$EXTERNALSYM GetMenuString}
function GetMenuString(hMenu: HMENU; uIDItem: UINT; lpString: PChar;
  nMaxCount: Integer; uFlag: UINT): Integer; stdcall;
{$EXTERNALSYM GetMenuState}
function GetMenuState(hMenu: HMENU; uId, uFlags: UINT): UINT; stdcall;
{$EXTERNALSYM DrawMenuBar}
function DrawMenuBar(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM GetSystemMenu}
function GetSystemMenu(hWnd: HWND; bRevert: BOOL): HMENU; stdcall;
{$EXTERNALSYM CreateMenu}
function CreateMenu: HMENU; stdcall;
{$EXTERNALSYM CreatePopupMenu}
function CreatePopupMenu: HMENU; stdcall;
{$EXTERNALSYM DestroyMenu}
function DestroyMenu(hMenu: HMENU): BOOL; stdcall;
{$EXTERNALSYM CheckMenuItem}
function CheckMenuItem(hMenu: HMENU; uIDCheckItem, uCheck: UINT): DWORD; stdcall;
{$EXTERNALSYM EnableMenuItem}
function EnableMenuItem(hMenu: HMENU; uIDEnableItem, uEnable: UINT): BOOL; stdcall;
{$EXTERNALSYM GetSubMenu}
function GetSubMenu(hMenu: HMENU; nPos: Integer): HMENU; stdcall;
{$EXTERNALSYM GetMenuItemID}
function GetMenuItemID(hMenu: HMENU; nPos: Integer): UINT; stdcall;
{$EXTERNALSYM GetMenuItemCount}
function GetMenuItemCount(hMenu: HMENU): Integer; stdcall;
{$EXTERNALSYM InsertMenuA}
function InsertMenuA(hMenu: HMENU; uPosition, uFlags, uIDNewItem: UINT;
  lpNewItem: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM InsertMenuW}
function InsertMenuW(hMenu: HMENU; uPosition, uFlags, uIDNewItem: UINT;
  lpNewItem: PWideChar): BOOL; stdcall;
{$EXTERNALSYM InsertMenu}
function InsertMenu(hMenu: HMENU; uPosition, uFlags, uIDNewItem: UINT;
  lpNewItem: PChar): BOOL; stdcall;
{$EXTERNALSYM AppendMenuA}
function AppendMenuA(hMenu: HMENU; uFlags, uIDNewItem: UINT;
  lpNewItem: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM AppendMenuW}
function AppendMenuW(hMenu: HMENU; uFlags, uIDNewItem: UINT;
  lpNewItem: PWideChar): BOOL; stdcall;
{$EXTERNALSYM AppendMenu}
function AppendMenu(hMenu: HMENU; uFlags, uIDNewItem: UINT;
  lpNewItem: PChar): BOOL; stdcall;
{$EXTERNALSYM ModifyMenuA}
function ModifyMenuA(hMnu: HMENU; uPosition, uFlags, uIDNewItem: UINT;
  lpNewItem: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM ModifyMenuW}
function ModifyMenuW(hMnu: HMENU; uPosition, uFlags, uIDNewItem: UINT;
  lpNewItem: PWideChar): BOOL; stdcall;
{$EXTERNALSYM ModifyMenu}
function ModifyMenu(hMnu: HMENU; uPosition, uFlags, uIDNewItem: UINT;
  lpNewItem: PChar): BOOL; stdcall;
{$EXTERNALSYM RemoveMenu}
function RemoveMenu(hMenu: HMENU; uPosition, uFlags: UINT): BOOL; stdcall;
{$EXTERNALSYM DeleteMenu}
function DeleteMenu(hMenu: HMENU; uPosition, uFlags: UINT): BOOL; stdcall;
{$EXTERNALSYM SetMenuItemBitmaps}
function SetMenuItemBitmaps(hMenu: HMENU; uPosition, uFlags: UINT;
  hBitmapUnchecked: HBITMAP; hBitmapChecked: HBITMAP): BOOL; stdcall;
{$EXTERNALSYM GetMenuCheckMarkDimensions}
function GetMenuCheckMarkDimensions: Longint; stdcall;
{$EXTERNALSYM TrackPopupMenu}
function TrackPopupMenu(hMenu: HMENU; uFlags: UINT; x, y, nReserved: Integer;
  hWnd: HWND; prcRect: PRect): BOOL; stdcall;


const
  { return codes for WM_MENUCHAR }
  {$EXTERNALSYM MNC_IGNORE}
  MNC_IGNORE = 0;
  {$EXTERNALSYM MNC_CLOSE}
  MNC_CLOSE = 1;
  {$EXTERNALSYM MNC_EXECUTE}
  MNC_EXECUTE = 2;
  {$EXTERNALSYM MNC_SELECT}
  MNC_SELECT = 3;

type
  PTPMParams = ^TTPMParams;
  {$EXTERNALSYM tagTPMPARAMS}
  tagTPMPARAMS = packed record
    cbSize: UINT;     { Size of structure }
    rcExclude: TRect; { Screen coordinates of rectangle to exclude when positioning }
  end;
  TTPMParams = tagTPMPARAMS;
  {$EXTERNALSYM TPMPARAMS}
  TPMPARAMS = tagTPMPARAMS;

{$EXTERNALSYM TrackPopupMenuEx}
function TrackPopupMenuEx(hMenu: HMENU; Flags: UINT; x, y: Integer;
  Wnd: HWND; TPMParams: PTPMParams): BOOL; stdcall;

const
  {$EXTERNALSYM MNS_NOCHECK}
  MNS_NOCHECK = $80000000;
  {$EXTERNALSYM MNS_MODELESS}
  MNS_MODELESS = $40000000;
  {$EXTERNALSYM MNS_DRAGDROP}
  MNS_DRAGDROP = $20000000;
  {$EXTERNALSYM MNS_AUTODISMISS}
  MNS_AUTODISMISS = $10000000;
  {$EXTERNALSYM MNS_NOTIFYBYPOS}
  MNS_NOTIFYBYPOS = $8000000;
  {$EXTERNALSYM MNS_CHECKORBMP}
  MNS_CHECKORBMP = $4000000;

  {$EXTERNALSYM MIM_MAXHEIGHT}
  MIM_MAXHEIGHT = 1;
  {$EXTERNALSYM MIM_BACKGROUND}
  MIM_BACKGROUND = 2;
  {$EXTERNALSYM MIM_HELPID}
  MIM_HELPID = 4;
  {$EXTERNALSYM MIM_MENUDATA}
  MIM_MENUDATA = 8;
  {$EXTERNALSYM MIM_STYLE}
  MIM_STYLE = $10;
  {$EXTERNALSYM MIM_APPLYTOSUBMENUS}
  MIM_APPLYTOSUBMENUS = $80000000;

type
  PMenuInfo = ^TMenuInfo;
  {$EXTERNALSYM tagMENUINFO}
  tagMENUINFO = packed record
    cbSize: DWORD;
    fMask: DWORD;
    dwStyle: DWORD;
    cyMax: UINT;
    hbrBack: HBRUSH;
    dwContextHelpID: DWORD;
    dwMenuData: DWORD;
  end;
  TMenuInfo = tagMENUINFO;

{$EXTERNALSYM GetMenuInfo}
function GetMenuInfo(hMenu: HMENU; var lpmi: TMenuInfo): BOOL; stdcall;
{$EXTERNALSYM SetMenuInfo}
function SetMenuInfo(hMenu: HMENU; const lpcmi: TMenuInfo): BOOL; stdcall;
{$EXTERNALSYM EndMenu}
function EndMenu: BOOL; stdcall;

const
  { WM_MENUDRAG return values }
  {$EXTERNALSYM MND_CONTINUE}
  MND_CONTINUE = 0;
  {$EXTERNALSYM MND_ENDMENU}
  MND_ENDMENU = 1;

type
  PMenuGetObjectInfo = ^TMenuGetObjectInfo;
  {$EXTERNALSYM tagMENUGETOBJECTINFO}
  tagMENUGETOBJECTINFO = packed record
    dwFlags: DWORD;
    uPos: UINT;
    hmenu: HMENU;
    riid: Pointer;
    pvObj: Pointer;
  end;
  TMenuGetObjectInfo = tagMENUGETOBJECTINFO;


const
  { MENUGETOBJECTINFO dwFlags values }
  {$EXTERNALSYM MNGOF_GAP}
  MNGOF_GAP = 3;

  { MENUGETOBJECT returns values }
  {$EXTERNALSYM MNGO_NOINTERFACE}
  MNGO_NOINTERFACE = 0;
  {$EXTERNALSYM MNGO_NOERROR}
  MNGO_NOERROR = 1;
  
  {$EXTERNALSYM MIIM_STATE}
  MIIM_STATE = 1;
  {$EXTERNALSYM MIIM_ID}
  MIIM_ID = 2;
  {$EXTERNALSYM MIIM_SUBMENU}
  MIIM_SUBMENU = 4;
  {$EXTERNALSYM MIIM_CHECKMARKS}
  MIIM_CHECKMARKS = 8;
  {$EXTERNALSYM MIIM_TYPE}
  MIIM_TYPE = $10;
  {$EXTERNALSYM MIIM_DATA}
  MIIM_DATA = $20;
  {$EXTERNALSYM MIIM_STRING}
  MIIM_STRING = $40;
  {$EXTERNALSYM MIIM_BITMAP}
  MIIM_BITMAP = $80;
  {$EXTERNALSYM MIIM_FTYPE}
  MIIM_FTYPE = $100;

  {$EXTERNALSYM HBMMENU_CALLBACK}
  HBMMENU_CALLBACK = -1;
  {$EXTERNALSYM HBMMENU_SYSTEM}
  HBMMENU_SYSTEM = 1;
  {$EXTERNALSYM HBMMENU_MBAR_RESTORE}
  HBMMENU_MBAR_RESTORE = 2;
  {$EXTERNALSYM HBMMENU_MBAR_MINIMIZE}
  HBMMENU_MBAR_MINIMIZE = 3;
  {$EXTERNALSYM HBMMENU_MBAR_CLOSE}
  HBMMENU_MBAR_CLOSE = 5;
  {$EXTERNALSYM HBMMENU_MBAR_CLOSE_D}
  HBMMENU_MBAR_CLOSE_D = 6;
  {$EXTERNALSYM HBMMENU_MBAR_MINIMIZE_D}
  HBMMENU_MBAR_MINIMIZE_D = 7;
  {$EXTERNALSYM HBMMENU_POPUP_CLOSE}
  HBMMENU_POPUP_CLOSE = 8;
  {$EXTERNALSYM HBMMENU_POPUP_RESTORE}
  HBMMENU_POPUP_RESTORE = 9;
  {$EXTERNALSYM HBMMENU_POPUP_MAXIMIZE}
  HBMMENU_POPUP_MAXIMIZE = 10;
  {$EXTERNALSYM HBMMENU_POPUP_MINIMIZE}
  HBMMENU_POPUP_MINIMIZE = 11;


type
  PMenuItemInfoA = ^TMenuItemInfoA;
  PMenuItemInfoW = ^TMenuItemInfoW;
  PMenuItemInfo = PMenuItemInfoA;
  {$EXTERNALSYM tagMENUITEMINFOA}
  tagMENUITEMINFOA = packed record
    cbSize: UINT;
    fMask: UINT;
    fType: UINT;             { used if MIIM_TYPE}
    fState: UINT;            { used if MIIM_STATE}
    wID: UINT;               { used if MIIM_ID}
    hSubMenu: HMENU;         { used if MIIM_SUBMENU}
    hbmpChecked: HBITMAP;    { used if MIIM_CHECKMARKS}
    hbmpUnchecked: HBITMAP;  { used if MIIM_CHECKMARKS}
    dwItemData: DWORD;       { used if MIIM_DATA}
    dwTypeData: PAnsiChar;      { used if MIIM_TYPE}
    cch: UINT;               { used if MIIM_TYPE}
    hbmpItem: HBITMAP;       { used if MIIM_BITMAP}
  end;
  {$EXTERNALSYM tagMENUITEMINFOW}
  tagMENUITEMINFOW = packed record
    cbSize: UINT;
    fMask: UINT;
    fType: UINT;             { used if MIIM_TYPE}
    fState: UINT;            { used if MIIM_STATE}
    wID: UINT;               { used if MIIM_ID}
    hSubMenu: HMENU;         { used if MIIM_SUBMENU}
    hbmpChecked: HBITMAP;    { used if MIIM_CHECKMARKS}
    hbmpUnchecked: HBITMAP;  { used if MIIM_CHECKMARKS}
    dwItemData: DWORD;       { used if MIIM_DATA}
    dwTypeData: PWideChar;      { used if MIIM_TYPE}
    cch: UINT;               { used if MIIM_TYPE}
    hbmpItem: HBITMAP;       { used if MIIM_BITMAP}
  end;
  {$EXTERNALSYM tagMENUITEMINFO}
  tagMENUITEMINFO = tagMENUITEMINFOA;
  TMenuItemInfoA = tagMENUITEMINFOA;
  TMenuItemInfoW = tagMENUITEMINFOW;
  TMenuItemInfo = TMenuItemInfoA;
  {$EXTERNALSYM MENUITEMINFOA}
  MENUITEMINFOA = tagMENUITEMINFOA;
  {$EXTERNALSYM MENUITEMINFOW}
  MENUITEMINFOW = tagMENUITEMINFOW;
  {$EXTERNALSYM MENUITEMINFO}
  MENUITEMINFO = MENUITEMINFOA;

{$EXTERNALSYM InsertMenuItemA}
function InsertMenuItemA(p1: HMENU; p2: UINT; p3: BOOL; const p4: TMenuItemInfoA): BOOL; stdcall;
{$EXTERNALSYM InsertMenuItemW}
function InsertMenuItemW(p1: HMENU; p2: UINT; p3: BOOL; const p4: TMenuItemInfoW): BOOL; stdcall;
{$EXTERNALSYM InsertMenuItem}
function InsertMenuItem(p1: HMENU; p2: UINT; p3: BOOL; const p4: TMenuItemInfo): BOOL; stdcall;
{$EXTERNALSYM GetMenuItemInfoA}
function GetMenuItemInfoA(p1: HMENU; p2: UINT; p3: BOOL; var p4: TMenuItemInfoA): BOOL; stdcall;
{$EXTERNALSYM GetMenuItemInfoW}
function GetMenuItemInfoW(p1: HMENU; p2: UINT; p3: BOOL; var p4: TMenuItemInfoW): BOOL; stdcall;
{$EXTERNALSYM GetMenuItemInfo}
function GetMenuItemInfo(p1: HMENU; p2: UINT; p3: BOOL; var p4: TMenuItemInfo): BOOL; stdcall;
{$EXTERNALSYM SetMenuItemInfoA}
function SetMenuItemInfoA(p1: HMENU; p2: UINT; p3: BOOL; const p4: TMenuItemInfoA): BOOL; stdcall;
{$EXTERNALSYM SetMenuItemInfoW}
function SetMenuItemInfoW(p1: HMENU; p2: UINT; p3: BOOL; const p4: TMenuItemInfoW): BOOL; stdcall;
{$EXTERNALSYM SetMenuItemInfo}
function SetMenuItemInfo(p1: HMENU; p2: UINT; p3: BOOL; const p4: TMenuItemInfo): BOOL; stdcall;

const
  {$EXTERNALSYM GMDI_USEDISABLED}
  GMDI_USEDISABLED = 1;
  {$EXTERNALSYM GMDI_GOINTOPOPUPS}
  GMDI_GOINTOPOPUPS = 2;

{$EXTERNALSYM GetMenuDefaultItem}
function GetMenuDefaultItem(hMenu: HMENU; fByPos, gmdiFlags: UINT): UINT; stdcall;
{$EXTERNALSYM SetMenuDefaultItem}
function SetMenuDefaultItem(hMenu: HMENU; uItem, fByPos: UINT): BOOL; stdcall;
{$EXTERNALSYM GetMenuItemRect}
function GetMenuItemRect(hWnd: HWND; hMenu: HMENU; uItem: UINT;
  var lprcItem: TRect): BOOL; stdcall;
{$EXTERNALSYM MenuItemFromPoint}
function MenuItemFromPoint(hWnd: HWND; hMenu: HMENU; ptScreen: TPoint): BOOL; stdcall;

const
  { Flags for TrackPopupMenu }
  {$EXTERNALSYM TPM_LEFTBUTTON}
  TPM_LEFTBUTTON = 0;
  {$EXTERNALSYM TPM_RIGHTBUTTON}
  TPM_RIGHTBUTTON = 2;
  {$EXTERNALSYM TPM_LEFTALIGN}
  TPM_LEFTALIGN = 0;
  {$EXTERNALSYM TPM_CENTERALIGN}
  TPM_CENTERALIGN = 4;
  {$EXTERNALSYM TPM_RIGHTALIGN}
  TPM_RIGHTALIGN = 8;
  {$EXTERNALSYM TPM_TOPALIGN}
  TPM_TOPALIGN = 0;
  {$EXTERNALSYM TPM_VCENTERALIGN}
  TPM_VCENTERALIGN = $10;
  {$EXTERNALSYM TPM_BOTTOMALIGN}
  TPM_BOTTOMALIGN = $20;

  {$EXTERNALSYM TPM_HORIZONTAL}
  TPM_HORIZONTAL = 0;   { Horz alignment matters more }
  {$EXTERNALSYM TPM_VERTICAL}
  TPM_VERTICAL = $40;   { Vert alignment matters more }
  {$EXTERNALSYM TPM_NONOTIFY}
  TPM_NONOTIFY = $80;   { Don't send any notification msgs }
  {$EXTERNALSYM TPM_RETURNCMD}
  TPM_RETURNCMD = $100;
  {$EXTERNALSYM TPM_RECURSE}
  TPM_RECURSE = $1;


{ Drag-and-drop support }

type
  PDropStruct = ^TDropStruct;
  {$EXTERNALSYM tagDROPSTRUCT}
  tagDROPSTRUCT = packed record
    hwndSource: HWND;
    hwndSink: HWND;
    wFmt: DWORD;
    dwData: DWORD;
    ptDrop: TPoint;
    dwControlData: DWORD;
  end;
  TDropStruct = tagDROPSTRUCT;
  {$EXTERNALSYM DROPSTRUCT}
  DROPSTRUCT = tagDROPSTRUCT;

const
  {$EXTERNALSYM DOF_EXECUTABLE}
  DOF_EXECUTABLE = 32769;
  {$EXTERNALSYM DOF_DOCUMENT}
  DOF_DOCUMENT = 32770;
  {$EXTERNALSYM DOF_DIRECTORY}
  DOF_DIRECTORY = 32771;
  {$EXTERNALSYM DOF_MULTIPLE}
  DOF_MULTIPLE = 32772;
  {$EXTERNALSYM DOF_PROGMAN}
  DOF_PROGMAN = 1;
  {$EXTERNALSYM DOF_SHELLDATA}
  DOF_SHELLDATA = 2;

  {$EXTERNALSYM DO_DROPFILE}
  DO_DROPFILE = $454C4946;
  {$EXTERNALSYM DO_PRINTFILE}
  DO_PRINTFILE = $544E5250;

{$EXTERNALSYM DragObject}
function DragObject(p1, p2: HWND; p3: UINT; p4: DWORD;
  p5: HICON): DWORD; stdcall;
{$EXTERNALSYM DragDetect}
function DragDetect(p1: HWND; p2: TPoint): BOOL; stdcall;
{$EXTERNALSYM DrawIcon}
function DrawIcon(hDC: HDC; X, Y: Integer; hIcon: HICON): BOOL; stdcall;

const
  { DrawText() Format Flags }
  {$EXTERNALSYM DT_TOP}
  DT_TOP = 0;
  {$EXTERNALSYM DT_LEFT}
  DT_LEFT = 0;
  {$EXTERNALSYM DT_CENTER}
  DT_CENTER = 1;
  {$EXTERNALSYM DT_RIGHT}
  DT_RIGHT = 2;
  {$EXTERNALSYM DT_VCENTER}
  DT_VCENTER = 4;
  {$EXTERNALSYM DT_BOTTOM}
  DT_BOTTOM = 8;
  {$EXTERNALSYM DT_WORDBREAK}
  DT_WORDBREAK = $10;
  {$EXTERNALSYM DT_SINGLELINE}
  DT_SINGLELINE = $20;
  {$EXTERNALSYM DT_EXPANDTABS}
  DT_EXPANDTABS = $40;
  {$EXTERNALSYM DT_TABSTOP}
  DT_TABSTOP = $80;
  {$EXTERNALSYM DT_NOCLIP}
  DT_NOCLIP = $100;
  {$EXTERNALSYM DT_EXTERNALLEADING}
  DT_EXTERNALLEADING = $200;
  {$EXTERNALSYM DT_CALCRECT}
  DT_CALCRECT = $400;
  {$EXTERNALSYM DT_NOPREFIX}
  DT_NOPREFIX = $800;
  {$EXTERNALSYM DT_INTERNAL}
  DT_INTERNAL = $1000;

  {$EXTERNALSYM DT_EDITCONTROL}
  DT_EDITCONTROL = $2000;
  {$EXTERNALSYM DT_PATH_ELLIPSIS}
  DT_PATH_ELLIPSIS = $4000;
  {$EXTERNALSYM DT_END_ELLIPSIS}
  DT_END_ELLIPSIS = $8000;
  {$EXTERNALSYM DT_MODIFYSTRING}
  DT_MODIFYSTRING = $10000;
  {$EXTERNALSYM DT_RTLREADING}
  DT_RTLREADING = $20000;
  {$EXTERNALSYM DT_WORD_ELLIPSIS}
  DT_WORD_ELLIPSIS = $40000;

type
  PDrawTextParams = ^TDrawTextParams;
  {$EXTERNALSYM tagDRAWTEXTPARAMS}
  tagDRAWTEXTPARAMS = packed record
    cbSize: UINT;
    iTabLength: Integer;
    iLeftMargin: Integer;
    iRightMargin: Integer;
    uiLengthDrawn: UINT;
  end;
  TDrawTextParams = tagDRAWTEXTPARAMS;
  {$EXTERNALSYM DRAWTEXTPARAMS}
  DRAWTEXTPARAMS = tagDRAWTEXTPARAMS;

{$EXTERNALSYM DrawTextA}
function DrawTextA(hDC: HDC; lpString: PAnsiChar; nCount: Integer;
  var lpRect: TRect; uFormat: UINT): Integer; stdcall;
{$EXTERNALSYM DrawTextW}
function DrawTextW(hDC: HDC; lpString: PWideChar; nCount: Integer;
  var lpRect: TRect; uFormat: UINT): Integer; stdcall;
{$EXTERNALSYM DrawText}
function DrawText(hDC: HDC; lpString: PChar; nCount: Integer;
  var lpRect: TRect; uFormat: UINT): Integer; stdcall;
{$EXTERNALSYM DrawTextExA}
function DrawTextExA(DC: HDC; lpchText: PAnsiChar; cchText: Integer; var p4: TRect;
  dwDTFormat: UINT; DTParams: PDrawTextParams): Integer; stdcall;
{$EXTERNALSYM DrawTextExW}
function DrawTextExW(DC: HDC; lpchText: PWideChar; cchText: Integer; var p4: TRect;
  dwDTFormat: UINT; DTParams: PDrawTextParams): Integer; stdcall;
{$EXTERNALSYM DrawTextEx}
function DrawTextEx(DC: HDC; lpchText: PChar; cchText: Integer; var p4: TRect;
  dwDTFormat: UINT; DTParams: PDrawTextParams): Integer; stdcall;
{$EXTERNALSYM GrayStringA}
function GrayStringA(hDC: HDC; hBrush: HBRUSH; lpOutputFunc: TFNGrayStringProc;
  lpData: LPARAM; nCount, X, Y, nWidth, nHeight: Integer): BOOL; stdcall;
{$EXTERNALSYM GrayStringW}
function GrayStringW(hDC: HDC; hBrush: HBRUSH; lpOutputFunc: TFNGrayStringProc;
  lpData: LPARAM; nCount, X, Y, nWidth, nHeight: Integer): BOOL; stdcall;
{$EXTERNALSYM GrayString}
function GrayString(hDC: HDC; hBrush: HBRUSH; lpOutputFunc: TFNGrayStringProc;
  lpData: LPARAM; nCount, X, Y, nWidth, nHeight: Integer): BOOL; stdcall;


{ Monolithic state-drawing routine }

const
  { Image type }
  {$EXTERNALSYM DST_COMPLEX}
  DST_COMPLEX = 0;
  {$EXTERNALSYM DST_TEXT}
  DST_TEXT = 1;
  {$EXTERNALSYM DST_PREFIXTEXT}
  DST_PREFIXTEXT = 2;
  {$EXTERNALSYM DST_ICON}
  DST_ICON = 3;
  {$EXTERNALSYM DST_BITMAP}
  DST_BITMAP = 4;

  { State type }
  {$EXTERNALSYM DSS_NORMAL}
  DSS_NORMAL = 0;
  {$EXTERNALSYM DSS_UNION}
  DSS_UNION = $10;     { Gray string appearance }
  {$EXTERNALSYM DSS_DISABLED}
  DSS_DISABLED = $20;
  {$EXTERNALSYM DSS_MONO}
  DSS_MONO = $80;
  {$EXTERNALSYM DSS_RIGHT}
  DSS_RIGHT = $8000;

{$EXTERNALSYM DrawStateA}
function DrawStateA(DC: HDC; p2: HBRUSH; p3: TFNDrawStateProc;
  p4: LPARAM; p5: WPARAM; p6, p7, p8, p9: Integer; p10: UINT): BOOL; stdcall;
{$EXTERNALSYM DrawStateW}
function DrawStateW(DC: HDC; p2: HBRUSH; p3: TFNDrawStateProc;
  p4: LPARAM; p5: WPARAM; p6, p7, p8, p9: Integer; p10: UINT): BOOL; stdcall;
{$EXTERNALSYM DrawState}
function DrawState(DC: HDC; p2: HBRUSH; p3: TFNDrawStateProc;
  p4: LPARAM; p5: WPARAM; p6, p7, p8, p9: Integer; p10: UINT): BOOL; stdcall;
{$EXTERNALSYM TabbedTextOutA}
function TabbedTextOutA(hDC: HDC; X, Y: Integer; lpString: PAnsiChar; nCount, nTabPositions: Integer;
  var lpnTabStopPositions; nTabOrigin: Integer): Longint; stdcall;
{$EXTERNALSYM TabbedTextOutW}
function TabbedTextOutW(hDC: HDC; X, Y: Integer; lpString: PWideChar; nCount, nTabPositions: Integer;
  var lpnTabStopPositions; nTabOrigin: Integer): Longint; stdcall;
{$EXTERNALSYM TabbedTextOut}
function TabbedTextOut(hDC: HDC; X, Y: Integer; lpString: PChar; nCount, nTabPositions: Integer;
  var lpnTabStopPositions; nTabOrigin: Integer): Longint; stdcall;
{$EXTERNALSYM GetTabbedTextExtentA}
function GetTabbedTextExtentA(hDC: HDC; lpString: PAnsiChar;
  nCount, nTabPositions: Integer; var lpnTabStopPositions): DWORD; stdcall;
{$EXTERNALSYM GetTabbedTextExtentW}
function GetTabbedTextExtentW(hDC: HDC; lpString: PWideChar;
  nCount, nTabPositions: Integer; var lpnTabStopPositions): DWORD; stdcall;
{$EXTERNALSYM GetTabbedTextExtent}
function GetTabbedTextExtent(hDC: HDC; lpString: PChar;
  nCount, nTabPositions: Integer; var lpnTabStopPositions): DWORD; stdcall;
{$EXTERNALSYM UpdateWindow}
function UpdateWindow(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM SetActiveWindow}
function SetActiveWindow(hWnd: HWND): HWND; stdcall;
{$EXTERNALSYM GetForegroundWindow}
function GetForegroundWindow: HWND; stdcall;
{$EXTERNALSYM PaintDesktop}
function PaintDesktop(hdc: HDC): BOOL; stdcall;
{$EXTERNALSYM SetForegroundWindow}
function SetForegroundWindow(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM WindowFromDC}
function WindowFromDC(hDC: HDC): HWND; stdcall;
{$EXTERNALSYM GetDC}
function GetDC(hWnd: HWND): HDC; stdcall;
{$EXTERNALSYM GetDCEx}
function GetDCEx(hWnd: HWND; hrgnClip: HRGN; flags: DWORD): HDC; stdcall;

const
  { GetDCEx() flags }
  {$EXTERNALSYM DCX_WINDOW}
  DCX_WINDOW = 1;
  {$EXTERNALSYM DCX_CACHE}
  DCX_CACHE = 2;
  {$EXTERNALSYM DCX_NORESETATTRS}
  DCX_NORESETATTRS = 4;
  {$EXTERNALSYM DCX_CLIPCHILDREN}
  DCX_CLIPCHILDREN = 8;
  {$EXTERNALSYM DCX_CLIPSIBLINGS}
  DCX_CLIPSIBLINGS = $10;
  {$EXTERNALSYM DCX_PARENTCLIP}
  DCX_PARENTCLIP = $20;
  {$EXTERNALSYM DCX_EXCLUDERGN}
  DCX_EXCLUDERGN = $40;
  {$EXTERNALSYM DCX_INTERSECTRGN}
  DCX_INTERSECTRGN = $80;
  {$EXTERNALSYM DCX_EXCLUDEUPDATE}
  DCX_EXCLUDEUPDATE = $100;
  {$EXTERNALSYM DCX_INTERSECTUPDATE}
  DCX_INTERSECTUPDATE = $200;
  {$EXTERNALSYM DCX_LOCKWINDOWUPDATE}
  DCX_LOCKWINDOWUPDATE = $400;
  {$EXTERNALSYM DCX_VALIDATE}
  DCX_VALIDATE = $200000;

{$EXTERNALSYM GetWindowDC}
function GetWindowDC(hWnd: HWND): HDC; stdcall;
{$EXTERNALSYM ReleaseDC}
function ReleaseDC(hWnd: HWND; hDC: HDC): Integer; stdcall;
{$EXTERNALSYM BeginPaint}
function BeginPaint(hWnd: HWND; var lpPaint: TPaintStruct): HDC; stdcall;
{$EXTERNALSYM EndPaint}
function EndPaint(hWnd: HWND; const lpPaint: TPaintStruct): BOOL; stdcall;
{$EXTERNALSYM GetUpdateRect}
function GetUpdateRect(hWnd: HWND; var lpRect: TRect; bErase: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetUpdateRgn}
function GetUpdateRgn(hWnd: HWND; hRgn: HRGN; bErase: BOOL): Integer; stdcall;
{$EXTERNALSYM SetWindowRgn}
function SetWindowRgn(hWnd: HWND; hRgn: HRGN; bRedraw: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetWindowRgn}
function GetWindowRgn(hWnd: HWND; hRgn: HRGN): BOOL; stdcall;
{$EXTERNALSYM ExcludeUpdateRgn}
function ExcludeUpdateRgn(hDC: HDC; hWnd: HWND): Integer; stdcall;
{$EXTERNALSYM InvalidateRect}
function InvalidateRect(hWnd: HWND; lpRect: PRect; bErase: BOOL): BOOL; stdcall;
{$EXTERNALSYM ValidateRect}
function ValidateRect(hWnd: HWND; lpRect: PRect): BOOL; stdcall;
{$EXTERNALSYM InvalidateRgn}
function InvalidateRgn(hWnd: HWND; hRgn: HRGN; bErase: BOOL): BOOL; stdcall;
{$EXTERNALSYM ValidateRgn}
function ValidateRgn(hWnd: HWND; hRgn: HRGN): BOOL; stdcall;
{$EXTERNALSYM RedrawWindow}
function RedrawWindow(hWnd: HWND; lprcUpdate: PRect; hrgnUpdate: HRGN; flags: UINT): BOOL; stdcall;

const
  { RedrawWindow() flags }
  {$EXTERNALSYM RDW_INVALIDATE}
  RDW_INVALIDATE = 1;
  {$EXTERNALSYM RDW_INTERNALPAINT}
  RDW_INTERNALPAINT = 2;
  {$EXTERNALSYM RDW_ERASE}
  RDW_ERASE = 4;
  {$EXTERNALSYM RDW_VALIDATE}
  RDW_VALIDATE = 8;
  {$EXTERNALSYM RDW_NOINTERNALPAINT}
  RDW_NOINTERNALPAINT = $10;
  {$EXTERNALSYM RDW_NOERASE}
  RDW_NOERASE = $20;
  {$EXTERNALSYM RDW_NOCHILDREN}
  RDW_NOCHILDREN = $40;
  {$EXTERNALSYM RDW_ALLCHILDREN}
  RDW_ALLCHILDREN = $80;
  {$EXTERNALSYM RDW_UPDATENOW}
  RDW_UPDATENOW = $100;
  {$EXTERNALSYM RDW_ERASENOW}
  RDW_ERASENOW = $200;
  {$EXTERNALSYM RDW_FRAME}
  RDW_FRAME = $400;
  {$EXTERNALSYM RDW_NOFRAME}
  RDW_NOFRAME = $800;


{ LockWindowUpdate API }

{$EXTERNALSYM LockWindowUpdate}
function LockWindowUpdate(hWndLock: HWND): BOOL; stdcall;
{$EXTERNALSYM ScrollWindow}
function ScrollWindow(hWnd: HWND; XAmount, YAmount: Integer;
  Rect, ClipRect: PRect): BOOL; stdcall;
{$EXTERNALSYM ScrollDC}
function ScrollDC(DC: HDC; DX, DY: Integer; var Scroll, Clip: TRect; Rgn: HRGN;
  Update: PRect): BOOL; stdcall;
{$EXTERNALSYM ScrollWindowEx}
function ScrollWindowEx(hWnd: HWND; dx, dy: Integer;
  prcScroll, prcClip: PRect;
  hrgnUpdate: HRGN; prcUpdate: PRect; flags: UINT): BOOL; stdcall;

const
  {$EXTERNALSYM SW_SCROLLCHILDREN}
  SW_SCROLLCHILDREN = 1;  { Scroll children within lprcScroll. }
  {$EXTERNALSYM SW_INVALIDATE}
  SW_INVALIDATE = 2;      { Invalidate after scrolling }
  {$EXTERNALSYM SW_ERASE}
  SW_ERASE = 4;           { If SW_INVALIDATE, don't send WM_ERASEBACKGROUND }
  {$EXTERNALSYM SW_SMOOTHSCROLL}
  SW_SMOOTHSCROLL = $10;   { Use smooth scrolling }

{$EXTERNALSYM SetScrollPos}
function SetScrollPos(hWnd: HWND; nBar, nPos: Integer; bRedraw: BOOL): Integer; stdcall;
{$EXTERNALSYM GetScrollPos}
function GetScrollPos(hWnd: HWND; nBar: Integer): Integer; stdcall;
{$EXTERNALSYM SetScrollRange}
function SetScrollRange(hWnd: HWND; nBar, nMinPos, nMaxPos: Integer; bRedraw: BOOL): BOOL; stdcall;
{$EXTERNALSYM GetScrollRange}
function GetScrollRange(hWnd: HWND; nBar: Integer; var lpMinPos, lpMaxPos: Integer): BOOL; stdcall;
{$EXTERNALSYM ShowScrollBar}
function ShowScrollBar(hWnd: HWND; wBar: Integer; bShow: BOOL): BOOL; stdcall;
{$EXTERNALSYM EnableScrollBar}
function EnableScrollBar(hWnd: HWND; wSBflags, wArrows: UINT): BOOL; stdcall;


const
  { EnableScrollBar() flags }
  {$EXTERNALSYM ESB_ENABLE_BOTH}
  ESB_ENABLE_BOTH = 0;
  {$EXTERNALSYM ESB_DISABLE_BOTH}
  ESB_DISABLE_BOTH = 3;
  {$EXTERNALSYM ESB_DISABLE_LEFT}
  ESB_DISABLE_LEFT = 1;
  {$EXTERNALSYM ESB_DISABLE_RIGHT}
  ESB_DISABLE_RIGHT = 2;
  {$EXTERNALSYM ESB_DISABLE_UP}
  ESB_DISABLE_UP = 1;
  {$EXTERNALSYM ESB_DISABLE_DOWN}
  ESB_DISABLE_DOWN = 2;
  {$EXTERNALSYM ESB_DISABLE_LTUP}
  ESB_DISABLE_LTUP = ESB_DISABLE_LEFT;
  {$EXTERNALSYM ESB_DISABLE_RTDN}
  ESB_DISABLE_RTDN = ESB_DISABLE_RIGHT;

{$EXTERNALSYM SetPropA}
function SetPropA(hWnd: HWND; lpString: PAnsiChar; hData: THandle): BOOL; stdcall;
{$EXTERNALSYM SetPropW}
function SetPropW(hWnd: HWND; lpString: PWideChar; hData: THandle): BOOL; stdcall;
{$EXTERNALSYM SetProp}
function SetProp(hWnd: HWND; lpString: PChar; hData: THandle): BOOL; stdcall;
{$EXTERNALSYM GetPropA}
function GetPropA(hWnd: HWND; lpString: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM GetPropW}
function GetPropW(hWnd: HWND; lpString: PWideChar): THandle; stdcall;
{$EXTERNALSYM GetProp}
function GetProp(hWnd: HWND; lpString: PChar): THandle; stdcall;
{$EXTERNALSYM RemovePropA}
function RemovePropA(hWnd: HWND; lpString: PAnsiChar): THandle; stdcall;
{$EXTERNALSYM RemovePropW}
function RemovePropW(hWnd: HWND; lpString: PWideChar): THandle; stdcall;
{$EXTERNALSYM RemoveProp}
function RemoveProp(hWnd: HWND; lpString: PChar): THandle; stdcall;
{$EXTERNALSYM EnumPropsExA}
function EnumPropsExA(hWnd: HWND; lpEnumFunc: TFNPropEnumProcEx; lParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM EnumPropsExW}
function EnumPropsExW(hWnd: HWND; lpEnumFunc: TFNPropEnumProcEx; lParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM EnumPropsEx}
function EnumPropsEx(hWnd: HWND; lpEnumFunc: TFNPropEnumProcEx; lParam: LPARAM): Integer; stdcall;
{$EXTERNALSYM EnumPropsA}
function EnumPropsA(hWnd: HWND; lpEnumFunc: TFNPropEnumProc): Integer; stdcall;
{$EXTERNALSYM EnumPropsW}
function EnumPropsW(hWnd: HWND; lpEnumFunc: TFNPropEnumProc): Integer; stdcall;
{$EXTERNALSYM EnumProps}
function EnumProps(hWnd: HWND; lpEnumFunc: TFNPropEnumProc): Integer; stdcall;
{$EXTERNALSYM SetWindowTextA}
function SetWindowTextA(hWnd: HWND; lpString: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetWindowTextW}
function SetWindowTextW(hWnd: HWND; lpString: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetWindowText}
function SetWindowText(hWnd: HWND; lpString: PChar): BOOL; stdcall;
{$EXTERNALSYM GetWindowTextA}
function GetWindowTextA(hWnd: HWND; lpString: PAnsiChar; nMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetWindowTextW}
function GetWindowTextW(hWnd: HWND; lpString: PWideChar; nMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetWindowText}
function GetWindowText(hWnd: HWND; lpString: PChar; nMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetWindowTextLengthA}
function GetWindowTextLengthA(hWnd: HWND): Integer; stdcall;
{$EXTERNALSYM GetWindowTextLengthW}
function GetWindowTextLengthW(hWnd: HWND): Integer; stdcall;
{$EXTERNALSYM GetWindowTextLength}
function GetWindowTextLength(hWnd: HWND): Integer; stdcall;

{$EXTERNALSYM GetClientRect}
function GetClientRect(hWnd: HWND; var lpRect: TRect): BOOL; stdcall;
{$EXTERNALSYM GetWindowRect}
function GetWindowRect(hWnd: HWND; var lpRect: TRect): BOOL; stdcall;
{$EXTERNALSYM AdjustWindowRect}
function AdjustWindowRect(var lpRect: TRect; dwStyle: DWORD; bMenu: BOOL): BOOL; stdcall;
{$EXTERNALSYM AdjustWindowRectEx}
function AdjustWindowRectEx(var lpRect: TRect; dwStyle: DWORD; bMenu: BOOL;
  dwExStyle: DWORD): BOOL; stdcall;

const
  {$EXTERNALSYM HELPINFO_WINDOW}
  HELPINFO_WINDOW = 1;
  {$EXTERNALSYM HELPINFO_MENUITEM}
  HELPINFO_MENUITEM = 2;
type
  PHelpInfo = ^THelpInfo;
  {$EXTERNALSYM tagHELPINFO}
  tagHELPINFO = packed record       { Structure pointed to by lParam of WM_HELP }
    cbSize: UINT;          { Size in bytes of this struct  }
    iContextType: Integer; { Either HELPINFO_WINDOW or HELPINFO_MENUITEM }
    iCtrlId: Integer;      { Control Id or a Menu item Id. }
    hItemHandle: THandle;  { hWnd of control or hMenu.     }
    dwContextId: DWORD;    { Context Id associated with this item }
    MousePos: TPoint;      { Mouse Position in screen co-ordinates }
  end;
  THelpInfo = tagHELPINFO;
  {$EXTERNALSYM HELPINFO}
  HELPINFO = tagHELPINFO;

{$EXTERNALSYM SetWindowContextHelpId}
function SetWindowContextHelpId(hWnd: HWND; HelpID: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetWindowContextHelpId}
function GetWindowContextHelpId(hWnd: HWND): DWORD; stdcall;
{$EXTERNALSYM SetMenuContextHelpId}
function SetMenuContextHelpId(hMenu: HMENU; HelpID: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetMenuContextHelpId}
function GetMenuContextHelpId(hMenu: HMENU): DWORD; stdcall;

const
  { MessageBox() Flags }
  {$EXTERNALSYM MB_OK}
  MB_OK = $00000000;
  {$EXTERNALSYM MB_OKCANCEL}
  MB_OKCANCEL = $00000001;
  {$EXTERNALSYM MB_ABORTRETRYIGNORE}
  MB_ABORTRETRYIGNORE = $00000002;
  {$EXTERNALSYM MB_YESNOCANCEL}
  MB_YESNOCANCEL = $00000003;
  {$EXTERNALSYM MB_YESNO}
  MB_YESNO = $00000004;
  {$EXTERNALSYM MB_RETRYCANCEL}
  MB_RETRYCANCEL = $00000005;

  {$EXTERNALSYM MB_ICONHAND}
  MB_ICONHAND = $00000010;
  {$EXTERNALSYM MB_ICONQUESTION}
  MB_ICONQUESTION = $00000020;
  {$EXTERNALSYM MB_ICONEXCLAMATION}
  MB_ICONEXCLAMATION = $00000030;
  {$EXTERNALSYM MB_ICONASTERISK}
  MB_ICONASTERISK = $00000040;
  {$EXTERNALSYM MB_USERICON}
  MB_USERICON = $00000080;
  {$EXTERNALSYM MB_ICONWARNING}
  MB_ICONWARNING                 = MB_ICONEXCLAMATION;
  {$EXTERNALSYM MB_ICONERROR}
  MB_ICONERROR                   = MB_ICONHAND;
  {$EXTERNALSYM MB_ICONINFORMATION}
  MB_ICONINFORMATION             = MB_ICONASTERISK;
  {$EXTERNALSYM MB_ICONSTOP}
  MB_ICONSTOP                    = MB_ICONHAND;

  {$EXTERNALSYM MB_DEFBUTTON1}
  MB_DEFBUTTON1 = $00000000;
  {$EXTERNALSYM MB_DEFBUTTON2}
  MB_DEFBUTTON2 = $00000100;
  {$EXTERNALSYM MB_DEFBUTTON3}
  MB_DEFBUTTON3 = $00000200;
  {$EXTERNALSYM MB_DEFBUTTON4}
  MB_DEFBUTTON4 = $00000300;

  {$EXTERNALSYM MB_APPLMODAL}
  MB_APPLMODAL = $00000000;
  {$EXTERNALSYM MB_SYSTEMMODAL}
  MB_SYSTEMMODAL = $00001000;
  {$EXTERNALSYM MB_TASKMODAL}
  MB_TASKMODAL = $00002000;
  {$EXTERNALSYM MB_HELP}
  MB_HELP = $00004000;                          { Help Button }

  {$EXTERNALSYM MB_NOFOCUS}
  MB_NOFOCUS = $00008000;
  {$EXTERNALSYM MB_SETFOREGROUND}
  MB_SETFOREGROUND = $00010000;
  {$EXTERNALSYM MB_DEFAULT_DESKTOP_ONLY}
  MB_DEFAULT_DESKTOP_ONLY = $00020000;

  {$EXTERNALSYM MB_TOPMOST}
  MB_TOPMOST = $00040000;
  {$EXTERNALSYM MB_RIGHT}
  MB_RIGHT = $00080000;
  {$EXTERNALSYM MB_RTLREADING}
  MB_RTLREADING = $00100000;

  {$EXTERNALSYM MB_SERVICE_NOTIFICATION}
  MB_SERVICE_NOTIFICATION = $00200000;
  {$EXTERNALSYM MB_SERVICE_NOTIFICATION_NT3X}
  MB_SERVICE_NOTIFICATION_NT3X = $00040000;

  {$EXTERNALSYM MB_TYPEMASK}
  MB_TYPEMASK = $0000000F;
  {$EXTERNALSYM MB_ICONMASK}
  MB_ICONMASK = $000000F0;
  {$EXTERNALSYM MB_DEFMASK}
  MB_DEFMASK = $00000F00;
  {$EXTERNALSYM MB_MODEMASK}
  MB_MODEMASK = $00003000;
  {$EXTERNALSYM MB_MISCMASK}
  MB_MISCMASK = $0000C000;


{$EXTERNALSYM MessageBoxA}
function MessageBoxA(hWnd: HWND; lpText, lpCaption: PAnsiChar; uType: UINT): Integer; stdcall;
{$EXTERNALSYM MessageBoxW}
function MessageBoxW(hWnd: HWND; lpText, lpCaption: PWideChar; uType: UINT): Integer; stdcall;
{$EXTERNALSYM MessageBox}
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: UINT): Integer; stdcall;
{$EXTERNALSYM MessageBoxExA}
function MessageBoxExA(hWnd: HWND; lpText, lpCaption: PAnsiChar;
  uType: UINT; wLanguageId: Word): Integer; stdcall;
{$EXTERNALSYM MessageBoxExW}
function MessageBoxExW(hWnd: HWND; lpText, lpCaption: PWideChar;
  uType: UINT; wLanguageId: Word): Integer; stdcall;
{$EXTERNALSYM MessageBoxEx}
function MessageBoxEx(hWnd: HWND; lpText, lpCaption: PChar;
  uType: UINT; wLanguageId: Word): Integer; stdcall;

type
  TPRMsgBoxCallback = procedure(var lpHelpInfo: THelpInfo);

  PMsgBoxParamsA = ^TMsgBoxParamsA;
  PMsgBoxParamsW = ^TMsgBoxParamsW;
  PMsgBoxParams = PMsgBoxParamsA;
  {$EXTERNALSYM tagMSGBOXPARAMSA}
  tagMSGBOXPARAMSA = packed record
    cbSize: UINT;
    hwndOwner: HWND;
    hInstance: HINST;
    lpszText: PAnsiChar;
    lpszCaption: PAnsiChar;
    dwStyle: DWORD;
    lpszIcon: PAnsiChar;
    dwContextHelpId: DWORD;
    lpfnMsgBoxCallback: TPRMsgBoxCallback;
    dwLanguageId: DWORD;
  end;
  {$EXTERNALSYM tagMSGBOXPARAMSW}
  tagMSGBOXPARAMSW = packed record
    cbSize: UINT;
    hwndOwner: HWND;
    hInstance: HINST;
    lpszText: PWideChar;
    lpszCaption: PWideChar;
    dwStyle: DWORD;
    lpszIcon: PWideChar;
    dwContextHelpId: DWORD;
    lpfnMsgBoxCallback: TPRMsgBoxCallback;
    dwLanguageId: DWORD;
  end;
  {$EXTERNALSYM tagMSGBOXPARAMS}
  tagMSGBOXPARAMS = tagMSGBOXPARAMSA;
  TMsgBoxParamsA = tagMSGBOXPARAMSA;
  TMsgBoxParamsW = tagMSGBOXPARAMSW;
  TMsgBoxParams = TMsgBoxParamsA;
  {$EXTERNALSYM MSGBOXPARAMSA}
  MSGBOXPARAMSA = tagMSGBOXPARAMSA;
  {$EXTERNALSYM MSGBOXPARAMSW}
  MSGBOXPARAMSW = tagMSGBOXPARAMSW;
  {$EXTERNALSYM MSGBOXPARAMS}
  MSGBOXPARAMS = MSGBOXPARAMSA;

{$EXTERNALSYM MessageBoxIndirectA}
function MessageBoxIndirectA(const MsgBoxParams: TMsgBoxParamsA): BOOL; stdcall;
{$EXTERNALSYM MessageBoxIndirectW}
function MessageBoxIndirectW(const MsgBoxParams: TMsgBoxParamsW): BOOL; stdcall;
{$EXTERNALSYM MessageBoxIndirect}
function MessageBoxIndirect(const MsgBoxParams: TMsgBoxParams): BOOL; stdcall;

{$EXTERNALSYM MessageBeep}
function MessageBeep(uType: UINT): BOOL; stdcall;
{$EXTERNALSYM ShowCursor}
function ShowCursor(bShow: BOOL): Integer; stdcall;
{$EXTERNALSYM SetCursorPos}
function SetCursorPos(X, Y: Integer): BOOL; stdcall;
{$EXTERNALSYM SetCursor}
function SetCursor(hCursor: HICON): HCURSOR; stdcall;
{$EXTERNALSYM GetCursorPos}
function GetCursorPos(var lpPoint: TPoint): BOOL; stdcall;
{$EXTERNALSYM ClipCursor}
function ClipCursor(lpRect: PRect): BOOL; stdcall;
{$EXTERNALSYM GetClipCursor}
function GetClipCursor(var lpRect: TRect): BOOL; stdcall;
{$EXTERNALSYM GetCursor}
function GetCursor: HCURSOR; stdcall;
{$EXTERNALSYM CreateCaret}
function CreateCaret(hWnd: HWND; hBitmap: HBITMAP; nWidth, nHeight: Integer): BOOL; stdcall;
{$EXTERNALSYM GetCaretBlinkTime}
function GetCaretBlinkTime: UINT; stdcall;
{$EXTERNALSYM SetCaretBlinkTime}
function SetCaretBlinkTime(uMSeconds: UINT): BOOL; stdcall;
{$EXTERNALSYM DestroyCaret}
function DestroyCaret: BOOL; stdcall;
{$EXTERNALSYM HideCaret}
function HideCaret(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM ShowCaret}
function ShowCaret(hWnd: HWND): BOOL; stdcall;
{$EXTERNALSYM SetCaretPos}
function SetCaretPos(X, Y: Integer): BOOL; stdcall;
{$EXTERNALSYM GetCaretPos}
function GetCaretPos(var lpPoint: TPoint): BOOL; stdcall;
{$EXTERNALSYM ClientToScreen}
function ClientToScreen(hWnd: HWND; var lpPoint: TPoint): BOOL; stdcall;
{$EXTERNALSYM ScreenToClient}
function ScreenToClient(hWnd: HWND; var lpPoint: TPoint): BOOL; stdcall;
{$EXTERNALSYM MapWindowPoints}
function MapWindowPoints(hWndFrom, hWndTo: HWND; var lpPoints; cPoints: UINT): Integer; stdcall;
{$EXTERNALSYM WindowFromPoint}
function WindowFromPoint(Point: TPoint): HWND; stdcall;
{$EXTERNALSYM ChildWindowFromPoint}
function ChildWindowFromPoint(hWndParent: HWND; Point: TPoint): HWND; stdcall;

const
  {$EXTERNALSYM CWP_ALL}
  CWP_ALL = 0;
  {$EXTERNALSYM CWP_SKIPINVISIBLE}
  CWP_SKIPINVISIBLE = 1;
  {$EXTERNALSYM CWP_SKIPDISABLED}
  CWP_SKIPDISABLED = 2;
  {$EXTERNALSYM CWP_SKIPTRANSPARENT}
  CWP_SKIPTRANSPARENT = 4;

{$EXTERNALSYM ChildWindowFromPointEx}
function ChildWindowFromPointEx(hWnd: HWND; Point: TPoint; Flags: UINT): HWND; stdcall;

const
  { Color Types }
  {$EXTERNALSYM CTLCOLOR_MSGBOX}
  CTLCOLOR_MSGBOX = 0;
  {$EXTERNALSYM CTLCOLOR_EDIT}
  CTLCOLOR_EDIT = 1;
  {$EXTERNALSYM CTLCOLOR_LISTBOX}
  CTLCOLOR_LISTBOX = 2;
  {$EXTERNALSYM CTLCOLOR_BTN}
  CTLCOLOR_BTN = 3;
  {$EXTERNALSYM CTLCOLOR_DLG}
  CTLCOLOR_DLG = 4;
  {$EXTERNALSYM CTLCOLOR_SCROLLBAR}
  CTLCOLOR_SCROLLBAR = 5;
  {$EXTERNALSYM CTLCOLOR_STATIC}
  CTLCOLOR_STATIC = 6;
  {$EXTERNALSYM CTLCOLOR_MAX}
  CTLCOLOR_MAX = 7;

  {$EXTERNALSYM COLOR_SCROLLBAR}
  COLOR_SCROLLBAR = 0;
  {$EXTERNALSYM COLOR_BACKGROUND}
  COLOR_BACKGROUND = 1;
  {$EXTERNALSYM COLOR_ACTIVECAPTION}
  COLOR_ACTIVECAPTION = 2;
  {$EXTERNALSYM COLOR_INACTIVECAPTION}
  COLOR_INACTIVECAPTION = 3;
  {$EXTERNALSYM COLOR_MENU}
  COLOR_MENU = 4;
  {$EXTERNALSYM COLOR_WINDOW}
  COLOR_WINDOW = 5;
  {$EXTERNALSYM COLOR_WINDOWFRAME}
  COLOR_WINDOWFRAME = 6;
  {$EXTERNALSYM COLOR_MENUTEXT}
  COLOR_MENUTEXT = 7;
  {$EXTERNALSYM COLOR_WINDOWTEXT}
  COLOR_WINDOWTEXT = 8;
  {$EXTERNALSYM COLOR_CAPTIONTEXT}
  COLOR_CAPTIONTEXT = 9;
  {$EXTERNALSYM COLOR_ACTIVEBORDER}
  COLOR_ACTIVEBORDER = 10;
  {$EXTERNALSYM COLOR_INACTIVEBORDER}
  COLOR_INACTIVEBORDER = 11;
  {$EXTERNALSYM COLOR_APPWORKSPACE}
  COLOR_APPWORKSPACE = 12;
  {$EXTERNALSYM COLOR_HIGHLIGHT}
  COLOR_HIGHLIGHT = 13;
  {$EXTERNALSYM COLOR_HIGHLIGHTTEXT}
  COLOR_HIGHLIGHTTEXT = 14;
  {$EXTERNALSYM COLOR_BTNFACE}
  COLOR_BTNFACE = 15;
  {$EXTERNALSYM COLOR_BTNSHADOW}
  COLOR_BTNSHADOW = $10;
  {$EXTERNALSYM COLOR_GRAYTEXT}
  COLOR_GRAYTEXT = 17;
  {$EXTERNALSYM COLOR_BTNTEXT}
  COLOR_BTNTEXT = 18;
  {$EXTERNALSYM COLOR_INACTIVECAPTIONTEXT}
  COLOR_INACTIVECAPTIONTEXT = 19;
  {$EXTERNALSYM COLOR_BTNHIGHLIGHT}
  COLOR_BTNHIGHLIGHT = 20;

  {$EXTERNALSYM COLOR_3DDKSHADOW}
  COLOR_3DDKSHADOW = 21;
  {$EXTERNALSYM COLOR_3DLIGHT}
  COLOR_3DLIGHT = 22;
  {$EXTERNALSYM COLOR_INFOTEXT}
  COLOR_INFOTEXT = 23;
  {$EXTERNALSYM COLOR_INFOBK}
  COLOR_INFOBK = 24;
  {$EXTERNALSYM COLOR_HOTLIGHT}
  COLOR_HOTLIGHT = 26;
  {$EXTERNALSYM COLOR_GRADIENTACTIVECAPTION}
  COLOR_GRADIENTACTIVECAPTION = 27;
  {$EXTERNALSYM COLOR_GRADIENTINACTIVECAPTION}
  COLOR_GRADIENTINACTIVECAPTION = 28;
  COLOR_ENDCOLORS = COLOR_GRADIENTINACTIVECAPTION;
  {$EXTERNALSYM COLOR_DESKTOP}
  COLOR_DESKTOP = COLOR_BACKGROUND;
  {$EXTERNALSYM COLOR_3DFACE}
  COLOR_3DFACE = COLOR_BTNFACE;
  {$EXTERNALSYM COLOR_3DSHADOW}
  COLOR_3DSHADOW = COLOR_BTNSHADOW;
  {$EXTERNALSYM COLOR_3DHIGHLIGHT}
  COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT;
  {$EXTERNALSYM COLOR_3DHILIGHT}
  COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT;
  {$EXTERNALSYM COLOR_BTNHILIGHT}
  COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT;

{$EXTERNALSYM GetSysColor}
function GetSysColor(nIndex: Integer): DWORD; stdcall;
{$EXTERNALSYM GetSysColorBrush}
function GetSysColorBrush(nIndex: Integer): HBRUSH; stdcall;
{$EXTERNALSYM SetSysColors}
function SetSysColors(cElements: Integer; const lpaElements;
  const lpaRgbValues): BOOL; stdcall;
{$EXTERNALSYM DrawFocusRect}
function DrawFocusRect(hDC: HDC; const lprc: TRect): BOOL; stdcall;
{$EXTERNALSYM FillRect}
function FillRect(hDC: HDC; const lprc: TRect; hbr: HBRUSH): Integer; stdcall;
{$EXTERNALSYM FrameRect}
function FrameRect(hDC: HDC; const lprc: TRect; hbr: HBRUSH): Integer; stdcall;
{$EXTERNALSYM InvertRect}
function InvertRect(hDC: HDC; const lprc: TRect): BOOL; stdcall;
{$EXTERNALSYM SetRect}
function SetRect(var lprc: TRect; xLeft, yTop, xRight, yBottom: Integer): BOOL; stdcall;
{$EXTERNALSYM SetRectEmpty}
function SetRectEmpty(var lprc: TRect): BOOL; stdcall;
{$EXTERNALSYM CopyRect}
function CopyRect(var lprcDst: TRect; const lprcSrc: TRect): BOOL; stdcall;
{$EXTERNALSYM InflateRect}
function InflateRect(var lprc: TRect; dx, dy: Integer): BOOL; stdcall;
{$EXTERNALSYM IntersectRect}
function IntersectRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): BOOL; stdcall;
{$EXTERNALSYM UnionRect}
function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): BOOL; stdcall;
{$EXTERNALSYM SubtractRect}
function SubtractRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): BOOL; stdcall;
{$EXTERNALSYM OffsetRect}
function OffsetRect(var lprc: TRect; dx, dy: Integer): BOOL; stdcall;
{$EXTERNALSYM IsRectEmpty}
function IsRectEmpty(const lprc: TRect): BOOL; stdcall;
{$EXTERNALSYM EqualRect}
function EqualRect(const lprc1, lprc2: TRect): BOOL; stdcall;
{$EXTERNALSYM PtInRect}
function PtInRect(const lprc: TRect; pt: TPoint): BOOL; stdcall;
{$EXTERNALSYM GetWindowWord}
function GetWindowWord(hWnd: HWND; nIndex: Integer): Word; stdcall;
{$EXTERNALSYM SetWindowWord}
function SetWindowWord(hWnd: HWND; nIndex: Integer; wNewWord: Word): Word; stdcall;
{$EXTERNALSYM GetWindowLongA}
function GetWindowLongA(hWnd: HWND; nIndex: Integer): Longint; stdcall;
{$EXTERNALSYM GetWindowLongW}
function GetWindowLongW(hWnd: HWND; nIndex: Integer): Longint; stdcall;
{$EXTERNALSYM GetWindowLong}
function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; stdcall;
{$EXTERNALSYM SetWindowLongA}
function SetWindowLongA(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; stdcall;
{$EXTERNALSYM SetWindowLongW}
function SetWindowLongW(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; stdcall;
{$EXTERNALSYM SetWindowLong}
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; stdcall;
{$EXTERNALSYM GetClassWord}
function GetClassWord(hWnd: HWND; nIndex: Integer): Word; stdcall;
{$EXTERNALSYM SetClassWord}
function SetClassWord(hWnd: HWND; nIndex: Integer; wNewWord: Word): Word; stdcall;
{$EXTERNALSYM GetClassLongA}
function GetClassLongA(hWnd: HWND; nIndex: Integer): DWORD; stdcall;
{$EXTERNALSYM GetClassLongW}
function GetClassLongW(hWnd: HWND; nIndex: Integer): DWORD; stdcall;
{$EXTERNALSYM GetClassLong}
function GetClassLong(hWnd: HWND; nIndex: Integer): DWORD; stdcall;
{$EXTERNALSYM SetClassLongA}
function SetClassLongA(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): DWORD; stdcall;
{$EXTERNALSYM SetClassLongW}
function SetClassLongW(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): DWORD; stdcall;
{$EXTERNALSYM SetClassLong}
function SetClassLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): DWORD; stdcall;
{$EXTERNALSYM GetDesktopWindow}
function GetDesktopWindow: HWND; stdcall;
{$EXTERNALSYM GetParent}
function GetParent(hWnd: HWND): HWND; stdcall;
{$EXTERNALSYM SetParent}
function SetParent(hWndChild, hWndNewParent: HWND): HWND; stdcall;
{$EXTERNALSYM EnumChildWindows}
function EnumChildWindows(hWndParent: HWND; lpEnumFunc: TFNWndEnumProc;
  lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM FindWindowA}
function FindWindowA(lpClassName, lpWindowName: PAnsiChar): HWND; stdcall;
{$EXTERNALSYM FindWindowW}
function FindWindowW(lpClassName, lpWindowName: PWideChar): HWND; stdcall;
{$EXTERNALSYM FindWindow}
function FindWindow(lpClassName, lpWindowName: PChar): HWND; stdcall;
{$EXTERNALSYM FindWindowExA}
function FindWindowExA(Parent, Child: HWND; ClassName, WindowName: PAnsiChar): HWND; stdcall;
{$EXTERNALSYM FindWindowExW}
function FindWindowExW(Parent, Child: HWND; ClassName, WindowName: PWideChar): HWND; stdcall;
{$EXTERNALSYM FindWindowEx}
function FindWindowEx(Parent, Child: HWND; ClassName, WindowName: PChar): HWND; stdcall;
{$EXTERNALSYM EnumWindows}
function EnumWindows(lpEnumFunc: TFNWndEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumThreadWindows}
function EnumThreadWindows(dwThreadId: DWORD; lpfn: TFNWndEnumProc; lParam: LPARAM): BOOL; stdcall;
{$EXTERNALSYM EnumTaskWindows}
function EnumTaskWindows(hTask: THandle; lpfn: FARPROC; lParam: LPARAM): BOOL;
{$EXTERNALSYM GetClassNameA}
function GetClassNameA(hWnd: HWND; lpClassName: PAnsiChar; nMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetClassNameW}
function GetClassNameW(hWnd: HWND; lpClassName: PWideChar; nMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetClassName}
function GetClassName(hWnd: HWND; lpClassName: PChar; nMaxCount: Integer): Integer; stdcall;
{$EXTERNALSYM GetTopWindow}
function GetTopWindow(hWnd: HWND): HWND; stdcall;
{$EXTERNALSYM GetNextWindow}
function GetNextWindow(hWnd: HWND; uCmd: UINT): HWND; stdcall;
{$EXTERNALSYM GetWindowThreadProcessId}
function GetWindowThreadProcessId(hWnd: HWND; lpdwProcessId: Pointer): DWORD; stdcall;
{$EXTERNALSYM GetWindowTask}
function GetWindowTask(hWnd: HWND): THandle;
{$EXTERNALSYM GetLastActivePopup}
function GetLastActivePopup(hWnd: HWND): HWND; stdcall;

const
  { GetWindow() Constants }
  {$EXTERNALSYM GW_HWNDFIRST}
  GW_HWNDFIRST = 0;
  {$EXTERNALSYM GW_HWNDLAST}
  GW_HWNDLAST = 1;
  {$EXTERNALSYM GW_HWNDNEXT}
  GW_HWNDNEXT = 2;
  {$EXTERNALSYM GW_HWNDPREV}
  GW_HWNDPREV = 3;
  {$EXTERNALSYM GW_OWNER}
  GW_OWNER = 4;
  {$EXTERNALSYM GW_CHILD}
  GW_CHILD = 5;
  {$EXTERNALSYM GW_MAX}
  GW_MAX = 5;

{$EXTERNALSYM GetWindow}
function GetWindow(hWnd: HWND; uCmd: UINT): HWND; stdcall;
{$EXTERNALSYM SetWindowsHookA}
function SetWindowsHookA(nFilterType: Integer; pfnFilterProc: TFNHookProc): HHOOK; stdcall;
{$EXTERNALSYM SetWindowsHookW}
function SetWindowsHookW(nFilterType: Integer; pfnFilterProc: TFNHookProc): HHOOK; stdcall;
{$EXTERNALSYM SetWindowsHook}
function SetWindowsHook(nFilterType: Integer; pfnFilterProc: TFNHookProc): HHOOK; stdcall;
{$EXTERNALSYM SetWindowsHookExA}
function SetWindowsHookExA(idHook: Integer; lpfn: TFNHookProc; hmod: HINST; dwThreadId: DWORD): HHOOK; stdcall;
{$EXTERNALSYM SetWindowsHookExW}
function SetWindowsHookExW(idHook: Integer; lpfn: TFNHookProc; hmod: HINST; dwThreadId: DWORD): HHOOK; stdcall;
{$EXTERNALSYM SetWindowsHookEx}
function SetWindowsHookEx(idHook: Integer; lpfn: TFNHookProc; hmod: HINST; dwThreadId: DWORD): HHOOK; stdcall;
{$EXTERNALSYM UnhookWindowsHook}
function UnhookWindowsHook(nCode: Integer; pfnFilterProc: TFNHookProc): BOOL; stdcall;
{$EXTERNALSYM UnhookWindowsHookEx}
function UnhookWindowsHookEx(hhk: HHOOK): BOOL; stdcall;
{$EXTERNALSYM CallNextHookEx}
function CallNextHookEx(hhk: HHOOK; nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;

{ Macros for source-level compatibility with old functions. }

{$EXTERNALSYM DefHookProc}
function DefHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM; phhk: FARPROC): LRESULT;

const
{ Menu flags for AddCheckEnableMenuItem() }

  {$EXTERNALSYM MF_INSERT}
  MF_INSERT = 0;
  {$EXTERNALSYM MF_CHANGE}
  MF_CHANGE = $80;
  {$EXTERNALSYM MF_APPEND}
  MF_APPEND = $100;
  {$EXTERNALSYM MF_DELETE}
  MF_DELETE = $200;
  {$EXTERNALSYM MF_REMOVE}
  MF_REMOVE = $1000;

  {$EXTERNALSYM MF_BYCOMMAND}
  MF_BYCOMMAND = 0;
  {$EXTERNALSYM MF_BYPOSITION}
  MF_BYPOSITION = $400;

  {$EXTERNALSYM MF_SEPARATOR}
  MF_SEPARATOR = $800;

  {$EXTERNALSYM MF_ENABLED}
  MF_ENABLED = 0;
  {$EXTERNALSYM MF_GRAYED}
  MF_GRAYED = 1;
  {$EXTERNALSYM MF_DISABLED}
  MF_DISABLED = 2;

  {$EXTERNALSYM MF_UNCHECKED}
  MF_UNCHECKED = 0;
  {$EXTERNALSYM MF_CHECKED}
  MF_CHECKED = 8;
  {$EXTERNALSYM MF_USECHECKBITMAPS}
  MF_USECHECKBITMAPS = $200;

  {$EXTERNALSYM MF_STRING}
  MF_STRING = 0;
  {$EXTERNALSYM MF_BITMAP}
  MF_BITMAP = 4;
  {$EXTERNALSYM MF_OWNERDRAW}
  MF_OWNERDRAW = $100;

  {$EXTERNALSYM MF_POPUP}
  MF_POPUP = $10;
  {$EXTERNALSYM MF_MENUBARBREAK}
  MF_MENUBARBREAK = $20;
  {$EXTERNALSYM MF_MENUBREAK}
  MF_MENUBREAK = $40;

  {$EXTERNALSYM MF_UNHILITE}
  MF_UNHILITE = 0;
  {$EXTERNALSYM MF_HILITE}
  MF_HILITE = $80;

  {$EXTERNALSYM MF_DEFAULT}
  MF_DEFAULT = $1000;
  {$EXTERNALSYM MF_SYSMENU}
  MF_SYSMENU = $2000;
  {$EXTERNALSYM MF_HELP}
  MF_HELP = $4000;
  {$EXTERNALSYM MF_RIGHTJUSTIFY}
  MF_RIGHTJUSTIFY = $4000;

  {$EXTERNALSYM MF_MOUSESELECT}
  MF_MOUSESELECT = $8000;
  {$EXTERNALSYM MF_END}
  MF_END = $80;            { Obsolete -- only used by old RES files }

  {$EXTERNALSYM MFT_STRING}
  MFT_STRING = MF_STRING;
  {$EXTERNALSYM MFT_BITMAP}
  MFT_BITMAP = MF_BITMAP;
  {$EXTERNALSYM MFT_MENUBARBREAK}
  MFT_MENUBARBREAK = MF_MENUBARBREAK;
  {$EXTERNALSYM MFT_MENUBREAK}
  MFT_MENUBREAK = MF_MENUBREAK;
  {$EXTERNALSYM MFT_OWNERDRAW}
  MFT_OWNERDRAW = MF_OWNERDRAW;
  {$EXTERNALSYM MFT_RADIOCHECK}
  MFT_RADIOCHECK = $200;
  {$EXTERNALSYM MFT_SEPARATOR}
  MFT_SEPARATOR = MF_SEPARATOR;
  {$EXTERNALSYM MFT_RIGHTORDER}
  MFT_RIGHTORDER = $2000;
  {$EXTERNALSYM MFT_RIGHTJUSTIFY}
  MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY;

  { Menu flags for AddCheckEnableMenuItem() }
  {$EXTERNALSYM MFS_GRAYED}
  MFS_GRAYED = 3;
  {$EXTERNALSYM MFS_DISABLED}
  MFS_DISABLED = MFS_GRAYED;
  {$EXTERNALSYM MFS_CHECKED}
  MFS_CHECKED = MF_CHECKED;
  {$EXTERNALSYM MFS_HILITE}
  MFS_HILITE = MF_HILITE;
  {$EXTERNALSYM MFS_ENABLED}
  MFS_ENABLED = MF_ENABLED;
  {$EXTERNALSYM MFS_UNCHECKED}
  MFS_UNCHECKED = MF_UNCHECKED;
  {$EXTERNALSYM MFS_UNHILITE}
  MFS_UNHILITE = MF_UNHILITE;
  {$EXTERNALSYM MFS_DEFAULT}
  MFS_DEFAULT = MF_DEFAULT;

  {$EXTERNALSYM MFS_MASK}
  MFS_MASK = $108B;
  {$EXTERNALSYM MFS_HOTTRACKDRAWN}
  MFS_HOTTRACKDRAWN = $10000000;
  {$EXTERNALSYM MFS_CACHEDBMP}
  MFS_CACHEDBMP = $20000000;
  {$EXTERNALSYM MFS_BOTTOMGAPDROP}
  MFS_BOTTOMGAPDROP = $40000000;
  {$EXTERNALSYM MFS_TOPGAPDROP}
  MFS_TOPGAPDROP = $80000000;
  {$EXTERNALSYM MFS_GAPDROP}
  MFS_GAPDROP = $C0000000;

{$EXTERNALSYM CheckMenuRadioItem}
function CheckMenuRadioItem(hMenu: HMENU; First, Last, Check, Flags: UINT): BOOL; stdcall;

type
  { Menu item resource format }
  PMenuItemTemplateHeader = ^TMenuItemTemplateHeader;
  {$EXTERNALSYM MENUITEMTEMPLATEHEADER}
  MENUITEMTEMPLATEHEADER = packed record
    versionNumber: Word;
    offset: Word;
  end;
  TMenuItemTemplateHeader = MENUITEMTEMPLATEHEADER;

  PMenuItemTemplate = ^TMenuItemTemplate;
  {$EXTERNALSYM MENUITEMTEMPLATE}
  MENUITEMTEMPLATE = packed record {Version 0}
    mtOption: Word;
    mtID: Word;
    mtString: array[0..0] of WCHAR;
  end;
  TMenuItemTemplate = MENUITEMTEMPLATE;


const
  { System Menu Command Values }
  {$EXTERNALSYM SC_SIZE}
  SC_SIZE = 61440;
  {$EXTERNALSYM SC_MOVE}
  SC_MOVE = 61456;
  {$EXTERNALSYM SC_MINIMIZE}
  SC_MINIMIZE = 61472;
  {$EXTERNALSYM SC_MAXIMIZE}
  SC_MAXIMIZE = 61488;
  {$EXTERNALSYM SC_NEXTWINDOW}
  SC_NEXTWINDOW = 61504;
  {$EXTERNALSYM SC_PREVWINDOW}
  SC_PREVWINDOW = 61520;
  {$EXTERNALSYM SC_CLOSE}
  SC_CLOSE = 61536;
  {$EXTERNALSYM SC_VSCROLL}
  SC_VSCROLL = 61552;
  {$EXTERNALSYM SC_HSCROLL}
  SC_HSCROLL = 61568;
  {$EXTERNALSYM SC_MOUSEMENU}
  SC_MOUSEMENU = 61584;
  {$EXTERNALSYM SC_KEYMENU}
  SC_KEYMENU = 61696;
  {$EXTERNALSYM SC_ARRANGE}
  SC_ARRANGE = 61712;
  {$EXTERNALSYM SC_RESTORE}
  SC_RESTORE = 61728;
  {$EXTERNALSYM SC_TASKLIST}
  SC_TASKLIST = 61744;
  {$EXTERNALSYM SC_SCREENSAVE}
  SC_SCREENSAVE = 61760;
  {$EXTERNALSYM SC_HOTKEY}
  SC_HOTKEY = 61776;
  {$EXTERNALSYM SC_DEFAULT}
  SC_DEFAULT = 61792;
  {$EXTERNALSYM SC_MONITORPOWER}
  SC_MONITORPOWER = 61808;
  {$EXTERNALSYM SC_CONTEXTHELP}
  SC_CONTEXTHELP = 61824;
  {$EXTERNALSYM SC_SEPARATOR}
  SC_SEPARATOR = 61455;

  { Obsolete names }
  {$EXTERNALSYM SC_ICON}
  SC_ICON = SC_MINIMIZE;
  {$EXTERNALSYM SC_ZOOM}
  SC_ZOOM = SC_MAXIMIZE;

{ Resource Loading Routines }

{$EXTERNALSYM LoadBitmapA}
function LoadBitmapA(hInstance: HINST; lpBitmapName: PAnsiChar): HBITMAP; stdcall;
{$EXTERNALSYM LoadBitmapW}
function LoadBitmapW(hInstance: HINST; lpBitmapName: PAnsiChar): HBITMAP; stdcall;
{$EXTERNALSYM LoadBitmap}
function LoadBitmap(hInstance: HINST; lpBitmapName: PAnsiChar): HBITMAP; stdcall;
{$EXTERNALSYM LoadCursorA}
function LoadCursorA(hInstance: HINST; lpCursorName: PAnsiChar): HCURSOR; stdcall;
{$EXTERNALSYM LoadCursorW}
function LoadCursorW(hInstance: HINST; lpCursorName: PAnsiChar): HCURSOR; stdcall;
{$EXTERNALSYM LoadCursor}
function LoadCursor(hInstance: HINST; lpCursorName: PAnsiChar): HCURSOR; stdcall;
{$EXTERNALSYM LoadCursorFromFileA}
function LoadCursorFromFileA(lpFileName: PAnsiChar): HCURSOR; stdcall;
{$EXTERNALSYM LoadCursorFromFileW}
function LoadCursorFromFileW(lpFileName: PAnsiChar): HCURSOR; stdcall;
{$EXTERNALSYM LoadCursorFromFile}
function LoadCursorFromFile(lpFileName: PAnsiChar): HCURSOR; stdcall;
{$EXTERNALSYM CreateCursor}
function CreateCursor(hInst: HINST; xHotSpot, yHotSpot, nWidth, nHeight: Integer;
  pvANDPlaneter, pvXORPlane: Pointer): HCURSOR; stdcall;
{$EXTERNALSYM DestroyCursor}
function DestroyCursor(hCursor: HICON): BOOL; stdcall;

const
  { Standard Cursor IDs }
  {$EXTERNALSYM IDC_ARROW}
  IDC_ARROW = MakeIntResource(32512);
  {$EXTERNALSYM IDC_IBEAM}
  IDC_IBEAM = MakeIntResource(32513);
  {$EXTERNALSYM IDC_WAIT}
  IDC_WAIT = MakeIntResource(32514);
  {$EXTERNALSYM IDC_CROSS}
  IDC_CROSS = MakeIntResource(32515);
  {$EXTERNALSYM IDC_UPARROW}
  IDC_UPARROW = MakeIntResource(32516);
  {$EXTERNALSYM IDC_SIZE}
  IDC_SIZE = MakeIntResource(32640);
  {$EXTERNALSYM IDC_ICON}
  IDC_ICON = MakeIntResource(32641);
  {$EXTERNALSYM IDC_SIZENWSE}
  IDC_SIZENWSE = MakeIntResource(32642);
  {$EXTERNALSYM IDC_SIZENESW}
  IDC_SIZENESW = MakeIntResource(32643);
  {$EXTERNALSYM IDC_SIZEWE}
  IDC_SIZEWE = MakeIntResource(32644);
  {$EXTERNALSYM IDC_SIZENS}
  IDC_SIZENS = MakeIntResource(32645);
  {$EXTERNALSYM IDC_SIZEALL}
  IDC_SIZEALL = MakeIntResource(32646);
  {$EXTERNALSYM IDC_NO}
  IDC_NO = MakeIntResource(32648);
  {$EXTERNALSYM IDC_HAND}
  IDC_HAND = MakeIntResource(32649);
  {$EXTERNALSYM IDC_APPSTARTING}
  IDC_APPSTARTING = MakeIntResource(32650);
  {$EXTERNALSYM IDC_HELP}
  IDC_HELP = MakeIntResource(32651);

{$EXTERNALSYM SetSystemCursor}
function SetSystemCursor(hcur: HICON; id: DWORD): BOOL; stdcall;

type
  PIconInfo = ^TIconInfo;
  {$EXTERNALSYM _ICONINFO}
  _ICONINFO = packed record
    fIcon: BOOL;
    xHotspot: DWORD;
    yHotspot: DWORD;
    hbmMask: HBITMAP;
    hbmColor: HBITMAP;
  end;
  TIconInfo = _ICONINFO;
  {$EXTERNALSYM ICONINFO}
  ICONINFO = _ICONINFO;

{$EXTERNALSYM LoadIconA}
function LoadIconA(hInstance: HINST; lpIconName: PAnsiChar): HICON; stdcall;
{$EXTERNALSYM LoadIconW}
function LoadIconW(hInstance: HINST; lpIconName: PWideChar): HICON; stdcall;
{$EXTERNALSYM LoadIcon}
function LoadIcon(hInstance: HINST; lpIconName: PChar): HICON; stdcall;
{$EXTERNALSYM CreateIcon}
function CreateIcon(hInstance: HINST; nWidth, nHeight: Integer;
  cPlanes, cBitsPixel: Byte; lpbANDbits, lpbXORbits: Pointer): HICON; stdcall;
{$EXTERNALSYM DestroyIcon}
function DestroyIcon(hIcon: HICON): BOOL; stdcall;
{$EXTERNALSYM LookupIconIdFromDirectory}
function LookupIconIdFromDirectory(presbits: PByte; fIcon: BOOL): Integer; stdcall;
{$EXTERNALSYM LookupIconIdFromDirectoryEx}
function LookupIconIdFromDirectoryEx(presbits: PByte; fIcon: BOOL;
  cxDesired, cyDesired: Integer; Flags: UINT): Integer; stdcall;
{$EXTERNALSYM CreateIconFromResource}
function CreateIconFromResource(presbits: PByte; dwResSize: DWORD;
  fIcon: BOOL; dwVer: DWORD): HICON; stdcall;
{$EXTERNALSYM CreateIconFromResourceEx}
function CreateIconFromResourceEx(presbits: PByte; dwResSize: DWORD;
  fIcon: BOOL; dwVer: DWORD; cxDesired, cyDesired: Integer; Flags: UINT): HICON; stdcall;


type
  { IconCursor header }
  PCursorShape = ^TCursorShape;
  {$EXTERNALSYM tagCURSORSHAPE}
  tagCURSORSHAPE = record
    xHotSpot: Integer;
    yHotSpot: Integer;
    cx: Integer;
    cy: Integer;
    cbWidth: Integer;
    Planes: Byte;
    BitsPixel: Byte;
  end;
  TCursorShape = tagCURSORSHAPE;
  {$EXTERNALSYM CURSORSHAPE}
  CURSORSHAPE = tagCURSORSHAPE;

const
  {$EXTERNALSYM IMAGE_BITMAP}
  IMAGE_BITMAP = 0;
  {$EXTERNALSYM IMAGE_ICON}
  IMAGE_ICON = 1;
  {$EXTERNALSYM IMAGE_CURSOR}
  IMAGE_CURSOR = 2;
  {$EXTERNALSYM IMAGE_ENHMETAFILE}
  IMAGE_ENHMETAFILE = 3;

  {$EXTERNALSYM LR_DEFAULTCOLOR}
  LR_DEFAULTCOLOR = $0000;
  {$EXTERNALSYM LR_MONOCHROME}
  LR_MONOCHROME = $0001;
  {$EXTERNALSYM LR_COLOR}
  LR_COLOR = $0002;
  {$EXTERNALSYM LR_COPYRETURNORG}
  LR_COPYRETURNORG = $0004;
  {$EXTERNALSYM LR_COPYDELETEORG}
  LR_COPYDELETEORG = $0008;
  {$EXTERNALSYM LR_LOADFROMFILE}
  LR_LOADFROMFILE = $0010;
  {$EXTERNALSYM LR_LOADTRANSPARENT}
  LR_LOADTRANSPARENT = $0020;
  {$EXTERNALSYM LR_DEFAULTSIZE}
  LR_DEFAULTSIZE = $0040;
  {$EXTERNALSYM LR_VGACOLOR}
  LR_VGACOLOR = $0080;
  {$EXTERNALSYM LR_LOADMAP3DCOLORS}
  LR_LOADMAP3DCOLORS = $1000;
  {$EXTERNALSYM LR_CREATEDIBSECTION}
  LR_CREATEDIBSECTION = $2000;
  {$EXTERNALSYM LR_COPYFROMRESOURCE}
  LR_COPYFROMRESOURCE = $4000;
  {$EXTERNALSYM LR_SHARED}
  LR_SHARED = $8000;

{$EXTERNALSYM LoadImageA}
function LoadImageA(hInst: HINST; ImageName: PAnsiChar; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; stdcall;
{$EXTERNALSYM LoadImageW}
function LoadImageW(hInst: HINST; ImageName: PWideChar; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; stdcall;
{$EXTERNALSYM LoadImage}
function LoadImage(hInst: HINST; ImageName: PChar; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; stdcall;
{$EXTERNALSYM CopyImage}
function CopyImage(hImage: THandle; ImageType: UINT; X, Y: Integer; Flags: UINT): THandle; stdcall;

const
  {$EXTERNALSYM DI_MASK}
  DI_MASK = 1;
  {$EXTERNALSYM DI_IMAGE}
  DI_IMAGE = 2;
  {$EXTERNALSYM DI_NORMAL}
  DI_NORMAL = 3;
  {$EXTERNALSYM DI_COMPAT}
  DI_COMPAT = 4;
  {$EXTERNALSYM DI_DEFAULTSIZE}
  DI_DEFAULTSIZE = 8;

{$EXTERNALSYM DrawIconEx}
function DrawIconEx(hdc: HDC; xLeft, yTop: Integer; hIcon: HICON;
  cxWidth, cyWidth: Integer; istepIfAniCur: UINT;
  hbrFlickerFreeDraw: HBRUSH; diFlags: UINT): BOOL; stdcall;
{$EXTERNALSYM CreateIconIndirect}
function CreateIconIndirect(var piconinfo: TIconInfo): HICON; stdcall;
{$EXTERNALSYM CopyIcon}
function CopyIcon(hIcon: HICON): HICON; stdcall;
{$EXTERNALSYM GetIconInfo}
function GetIconInfo(hIcon: HICON; var piconinfo: TIconInfo): BOOL; stdcall;

const
  {$EXTERNALSYM OBM_CLOSE}
  OBM_CLOSE               = 32754;
  {$EXTERNALSYM OBM_UPARROW}
  OBM_UPARROW             = 32753;
  {$EXTERNALSYM OBM_DNARROW}
  OBM_DNARROW             = 32752;
  {$EXTERNALSYM OBM_RGARROW}
  OBM_RGARROW             = 32751;
  {$EXTERNALSYM OBM_LFARROW}
  OBM_LFARROW             = 32750;
  {$EXTERNALSYM OBM_REDUCE}
  OBM_REDUCE              = 32749;
  {$EXTERNALSYM OBM_ZOOM}
  OBM_ZOOM                = 32748;
  {$EXTERNALSYM OBM_RESTORE}
  OBM_RESTORE             = 32747;
  {$EXTERNALSYM OBM_REDUCED}
  OBM_REDUCED             = 32746;
  {$EXTERNALSYM OBM_ZOOMD}
  OBM_ZOOMD               = 32745;
  {$EXTERNALSYM OBM_RESTORED}
  OBM_RESTORED            = 32744;
  {$EXTERNALSYM OBM_UPARROWD}
  OBM_UPARROWD            = 32743;
  {$EXTERNALSYM OBM_DNARROWD}
  OBM_DNARROWD            = 32742;
  {$EXTERNALSYM OBM_RGARROWD}
  OBM_RGARROWD            = 32741;
  {$EXTERNALSYM OBM_LFARROWD}
  OBM_LFARROWD            = 32740;
  {$EXTERNALSYM OBM_MNARROW}
  OBM_MNARROW             = 32739;
  {$EXTERNALSYM OBM_COMBO}
  OBM_COMBO               = 32738;
  {$EXTERNALSYM OBM_UPARROWI}
  OBM_UPARROWI            = 32737;
  {$EXTERNALSYM OBM_DNARROWI}
  OBM_DNARROWI            = 32736;
  {$EXTERNALSYM OBM_RGARROWI}
  OBM_RGARROWI            = 32735;
  {$EXTERNALSYM OBM_LFARROWI}
  OBM_LFARROWI            = 32734;

  {$EXTERNALSYM OBM_OLD_CLOSE}
  OBM_OLD_CLOSE           = 32767;
  {$EXTERNALSYM OBM_SIZE}
  OBM_SIZE                = 32766;
  {$EXTERNALSYM OBM_OLD_UPARROW}
  OBM_OLD_UPARROW         = 32765;
  {$EXTERNALSYM OBM_OLD_DNARROW}
  OBM_OLD_DNARROW         = 32764;
  {$EXTERNALSYM OBM_OLD_RGARROW}
  OBM_OLD_RGARROW         = 32763;
  {$EXTERNALSYM OBM_OLD_LFARROW}
  OBM_OLD_LFARROW         = 32762;
  {$EXTERNALSYM OBM_BTSIZE}
  OBM_BTSIZE              = 32761;
  {$EXTERNALSYM OBM_CHECK}
  OBM_CHECK               = 32760;
  {$EXTERNALSYM OBM_CHECKBOXES}
  OBM_CHECKBOXES          = 32759;
  {$EXTERNALSYM OBM_BTNCORNERS}
  OBM_BTNCORNERS          = 32758;
  {$EXTERNALSYM OBM_OLD_REDUCE}
  OBM_OLD_REDUCE          = 32757;
  {$EXTERNALSYM OBM_OLD_ZOOM}
  OBM_OLD_ZOOM            = 32756;
  {$EXTERNALSYM OBM_OLD_RESTORE}
  OBM_OLD_RESTORE         = 32755;

  {$EXTERNALSYM OCR_NORMAL}
  OCR_NORMAL              = 32512;
  {$EXTERNALSYM OCR_IBEAM}
  OCR_IBEAM               = 32513;
  {$EXTERNALSYM OCR_WAIT}
  OCR_WAIT                = 32514;
  {$EXTERNALSYM OCR_CROSS}
  OCR_CROSS               = 32515;
  {$EXTERNALSYM OCR_UP}
  OCR_UP                  = 32516;
  {$EXTERNALSYM OCR_SIZE}
  OCR_SIZE                = 32640;  { OBSOLETE: use OCR_SIZEALL }
  {$EXTERNALSYM OCR_ICON}
  OCR_ICON                = 32641;  { OBSOLETE: use OCR_NORMAL }
  {$EXTERNALSYM OCR_SIZENWSE}
  OCR_SIZENWSE            = 32642;
  {$EXTERNALSYM OCR_SIZENESW}
  OCR_SIZENESW            = 32643;
  {$EXTERNALSYM OCR_SIZEWE}
  OCR_SIZEWE              = 32644;
  {$EXTERNALSYM OCR_SIZENS}
  OCR_SIZENS              = 32645;
  {$EXTERNALSYM OCR_SIZEALL}
  OCR_SIZEALL             = 32646;
  {$EXTERNALSYM OCR_ICOCUR}
  OCR_ICOCUR              = 32647;  { OBSOLETE: use OIC_WINLOGO }
  {$EXTERNALSYM OCR_NO}
  OCR_NO                  = 32648;
  {$EXTERNALSYM OCR_HAND}
  OCR_HAND                  = 32649;
  {$EXTERNALSYM OCR_APPSTARTING}
  OCR_APPSTARTING         = 32650;

  {$EXTERNALSYM OIC_SAMPLE}
  OIC_SAMPLE              = 32512;
  {$EXTERNALSYM OIC_HAND}
  OIC_HAND                = 32513;
  {$EXTERNALSYM OIC_QUES}
  OIC_QUES                = 32514;
  {$EXTERNALSYM OIC_BANG}
  OIC_BANG                = 32515;
  {$EXTERNALSYM OIC_NOTE}
  OIC_NOTE                = 32516;
  {$EXTERNALSYM OIC_WINLOGO}
  OIC_WINLOGO             = 32517;
  {$EXTERNALSYM OIC_WARNING}
  OIC_WARNING             = OIC_BANG;
  {$EXTERNALSYM OIC_ERROR}
  OIC_ERROR               = OIC_HAND;
  {$EXTERNALSYM OIC_INFORMATION}
  OIC_INFORMATION         = OIC_NOTE;

  {$EXTERNALSYM RES_ICON}
  RES_ICON = 1;
  {$EXTERNALSYM RES_CURSOR}
  RES_CURSOR = 2;

  { The ordinal number for the entry point of language drivers. }
  {$EXTERNALSYM ORD_LANGDRIVER}
  ORD_LANGDRIVER = 1;

  { Standard Icon IDs }
  {$EXTERNALSYM IDI_APPLICATION}
  IDI_APPLICATION = MakeIntResource(32512);
  {$EXTERNALSYM IDI_HAND}
  IDI_HAND = MakeIntResource(32513);
  {$EXTERNALSYM IDI_QUESTION}
  IDI_QUESTION = MakeIntResource(32514);
  {$EXTERNALSYM IDI_EXCLAMATION}
  IDI_EXCLAMATION = MakeIntResource(32515);
  {$EXTERNALSYM IDI_ASTERISK}
  IDI_ASTERISK = MakeIntResource(32516);
  {$EXTERNALSYM IDI_WINLOGO}
  IDI_WINLOGO = MakeIntResource(32517);
  {$EXTERNALSYM IDI_WARNING}
  IDI_WARNING = IDI_EXCLAMATION;
  {$EXTERNALSYM IDI_ERROR}
  IDI_ERROR = IDI_HAND;
  {$EXTERNALSYM IDI_INFORMATION}
  IDI_INFORMATION = IDI_ASTERISK;

{$EXTERNALSYM LoadStringA}
function LoadStringA(hInstance: HINST; uID: UINT; lpBuffer: PAnsiChar; nBufferMax: Integer): Integer; stdcall;
{$EXTERNALSYM LoadStringW}
function LoadStringW(hInstance: HINST; uID: UINT; lpBuffer: PWideChar; nBufferMax: Integer): Integer; stdcall;
{$EXTERNALSYM LoadString}
function LoadString(hInstance: HINST; uID: UINT; lpBuffer: PChar; nBufferMax: Integer): Integer; stdcall;

const
  { Dialog Box Command IDs }
  {$EXTERNALSYM IDOK}
  IDOK = 1;          ID_OK = IDOK;
  {$EXTERNALSYM IDCANCEL}
  IDCANCEL = 2;      ID_CANCEL = IDCANCEL;
  {$EXTERNALSYM IDABORT}
  IDABORT = 3;       ID_ABORT = IDABORT;
  {$EXTERNALSYM IDRETRY}
  IDRETRY = 4;       ID_RETRY = IDRETRY;
  {$EXTERNALSYM IDIGNORE}
  IDIGNORE = 5;      ID_IGNORE = IDIGNORE;
  {$EXTERNALSYM IDYES}
  IDYES = 6;         ID_YES = IDYES;
  {$EXTERNALSYM IDNO}
  IDNO = 7;          ID_NO = IDNO;
  {$EXTERNALSYM IDCLOSE}
  IDCLOSE = 8;       ID_CLOSE = IDCLOSE;
  {$EXTERNALSYM IDHELP}
  IDHELP = 9;        ID_HELP = IDHELP;


{ Control Manager Structures and Definitions }

  { Edit Control Styles }
  {$EXTERNALSYM ES_LEFT}
  ES_LEFT = 0;
  {$EXTERNALSYM ES_CENTER}
  ES_CENTER = 1;
  {$EXTERNALSYM ES_RIGHT}
  ES_RIGHT = 2;
  {$EXTERNALSYM ES_MULTILINE}
  ES_MULTILINE = 4;
  {$EXTERNALSYM ES_UPPERCASE}
  ES_UPPERCASE = 8;
  {$EXTERNALSYM ES_LOWERCASE}
  ES_LOWERCASE = $10;
  {$EXTERNALSYM ES_PASSWORD}
  ES_PASSWORD = $20;
  {$EXTERNALSYM ES_AUTOVSCROLL}
  ES_AUTOVSCROLL = $40;
  {$EXTERNALSYM ES_AUTOHSCROLL}
  ES_AUTOHSCROLL = $80;
  {$EXTERNALSYM ES_NOHIDESEL}
  ES_NOHIDESEL = $100;
  {$EXTERNALSYM ES_OEMCONVERT}
  ES_OEMCONVERT = $400;
  {$EXTERNALSYM ES_READONLY}
  ES_READONLY = $800;
  {$EXTERNALSYM ES_WANTRETURN}
  ES_WANTRETURN = $1000;
  {$EXTERNALSYM ES_NUMBER}
  ES_NUMBER = $2000;

  { Edit control EM_SETMARGIN parameters }
  {$EXTERNALSYM EC_LEFTMARGIN}
  EC_LEFTMARGIN = 1;
  {$EXTERNALSYM EC_RIGHTMARGIN}
  EC_RIGHTMARGIN = 2;
  {$EXTERNALSYM EC_USEFONTINFO}
  EC_USEFONTINFO = 65535;

  { wParam of EM_GET/SETIMESTATUS }
  {$EXTERNALSYM EMSIS_COMPOSITIONSTRING}
  EMSIS_COMPOSITIONSTRING = 1;

  { lParam for EMSIS_COMPOSITIONSTRING }
  {$EXTERNALSYM EIMES_GETCOMPSTRATONCE}
  EIMES_GETCOMPSTRATONCE = 1;
  {$EXTERNALSYM EIMES_CANCELCOMPSTRINGFOCUS}
  EIMES_CANCELCOMPSTRINGFOCUS = 2;
  {$EXTERNALSYM EIMES_COMPLETECOMPSTRKILLFOCUS}
  EIMES_COMPLETECOMPSTRKILLFOCUS = 4;
 
  { TFNEditWordBreakProc code values }
  {$EXTERNALSYM WB_LEFT}
  WB_LEFT = 0;
  {$EXTERNALSYM WB_RIGHT}
  WB_RIGHT = 1;
  {$EXTERNALSYM WB_ISDELIMITER}
  WB_ISDELIMITER = 2;

  { Button Control Styles }
  {$EXTERNALSYM BS_PUSHBUTTON}
  BS_PUSHBUTTON = 0;
  {$EXTERNALSYM BS_DEFPUSHBUTTON}
  BS_DEFPUSHBUTTON = 1;
  {$EXTERNALSYM BS_CHECKBOX}
  BS_CHECKBOX = 2;
  {$EXTERNALSYM BS_AUTOCHECKBOX}
  BS_AUTOCHECKBOX = 3;
  {$EXTERNALSYM BS_RADIOBUTTON}
  BS_RADIOBUTTON = 4;
  {$EXTERNALSYM BS_3STATE}
  BS_3STATE = 5;
  {$EXTERNALSYM BS_AUTO3STATE}
  BS_AUTO3STATE = 6;
  {$EXTERNALSYM BS_GROUPBOX}
  BS_GROUPBOX = 7;
  {$EXTERNALSYM BS_USERBUTTON}
  BS_USERBUTTON = 8;
  {$EXTERNALSYM BS_AUTORADIOBUTTON}
  BS_AUTORADIOBUTTON = 9;
  {$EXTERNALSYM BS_OWNERDRAW}
  BS_OWNERDRAW = 11;
  {$EXTERNALSYM BS_LEFTTEXT}
  BS_LEFTTEXT = $20;
  {$EXTERNALSYM BS_TEXT}
  BS_TEXT = 0;
  {$EXTERNALSYM BS_ICON}
  BS_ICON = $40;
  {$EXTERNALSYM BS_BITMAP}
  BS_BITMAP = $80;
  {$EXTERNALSYM BS_LEFT}
  BS_LEFT = $100;
  {$EXTERNALSYM BS_RIGHT}
  BS_RIGHT = $200;
  {$EXTERNALSYM BS_CENTER}
  BS_CENTER = 768;
  {$EXTERNALSYM BS_TOP}
  BS_TOP = $400;
  {$EXTERNALSYM BS_BOTTOM}
  BS_BOTTOM = $800;
  {$EXTERNALSYM BS_VCENTER}
  BS_VCENTER = 3072;
  {$EXTERNALSYM BS_PUSHLIKE}
  BS_PUSHLIKE = $1000;
  {$EXTERNALSYM BS_MULTILINE}
  BS_MULTILINE = $2000;
  {$EXTERNALSYM BS_NOTIFY}
  BS_NOTIFY = $4000;
  {$EXTERNALSYM BS_FLAT}
  BS_FLAT = $8000;
  {$EXTERNALSYM BS_RIGHTBUTTON}
  BS_RIGHTBUTTON = BS_LEFTTEXT;

  {$EXTERNALSYM BST_UNCHECKED}
  BST_UNCHECKED = 0;
  {$EXTERNALSYM BST_CHECKED}
  BST_CHECKED = 1;
  {$EXTERNALSYM BST_INDETERMINATE}
  BST_INDETERMINATE = 2;
  {$EXTERNALSYM BST_PUSHED}
  BST_PUSHED = 4;
  {$EXTERNALSYM BST_FOCUS}
  BST_FOCUS = 8;

  { Static Control Constants }
  {$EXTERNALSYM SS_LEFT}
  SS_LEFT = 0;
  {$EXTERNALSYM SS_CENTER}
  SS_CENTER = 1;
  {$EXTERNALSYM SS_RIGHT}
  SS_RIGHT = 2;
  {$EXTERNALSYM SS_ICON}
  SS_ICON = 3;
  {$EXTERNALSYM SS_BLACKRECT}
  SS_BLACKRECT = 4;
  {$EXTERNALSYM SS_GRAYRECT}
  SS_GRAYRECT = 5;
  {$EXTERNALSYM SS_WHITERECT}
  SS_WHITERECT = 6;
  {$EXTERNALSYM SS_BLACKFRAME}
  SS_BLACKFRAME = 7;
  {$EXTERNALSYM SS_GRAYFRAME}
  SS_GRAYFRAME = 8;
  {$EXTERNALSYM SS_WHITEFRAME}
  SS_WHITEFRAME = 9;
  {$EXTERNALSYM SS_USERITEM}
  SS_USERITEM = 10;
  {$EXTERNALSYM SS_SIMPLE}
  SS_SIMPLE = 11;
  {$EXTERNALSYM SS_LEFTNOWORDWRAP}
  SS_LEFTNOWORDWRAP = 12;
  {$EXTERNALSYM SS_BITMAP}
  SS_BITMAP = 14;
  {$EXTERNALSYM SS_OWNERDRAW}
  SS_OWNERDRAW = 13;
  {$EXTERNALSYM SS_ENHMETAFILE}
  SS_ENHMETAFILE = 15;
  {$EXTERNALSYM SS_ETCHEDHORZ}
  SS_ETCHEDHORZ = $10;
  {$EXTERNALSYM SS_ETCHEDVERT}
  SS_ETCHEDVERT = 17;
  {$EXTERNALSYM SS_ETCHEDFRAME}
  SS_ETCHEDFRAME = 18;
  {$EXTERNALSYM SS_TYPEMASK}
  SS_TYPEMASK = 31;
  {$EXTERNALSYM SS_NOPREFIX}
  SS_NOPREFIX = $80;      { Don't do "&" character translation }
  {$EXTERNALSYM SS_NOTIFY}
  SS_NOTIFY = $100;
  {$EXTERNALSYM SS_CENTERIMAGE}
  SS_CENTERIMAGE = $200;
  {$EXTERNALSYM SS_RIGHTJUST}
  SS_RIGHTJUST = $400;
  {$EXTERNALSYM SS_REALSIZEIMAGE}
  SS_REALSIZEIMAGE = $800;
  {$EXTERNALSYM SS_SUNKEN}
  SS_SUNKEN = $1000;
  {$EXTERNALSYM SS_ENDELLIPSIS}
  SS_ENDELLIPSIS =  $4000;
  {$EXTERNALSYM SS_PATHELLIPSIS}
  SS_PATHELLIPSIS = $8000;
  {$EXTERNALSYM SS_WORDELLIPSIS}
  SS_WORDELLIPSIS = $C000;
  {$EXTERNALSYM SS_ELLIPSISMASK}
  SS_ELLIPSISMASK = $C000;

  { Static Control Mesages }
  {$EXTERNALSYM STM_SETICON}
  STM_SETICON = 368;
  {$EXTERNALSYM STM_GETICON}
  STM_GETICON = 369;
  {$EXTERNALSYM STM_SETIMAGE}
  STM_SETIMAGE = 370;
  {$EXTERNALSYM STM_GETIMAGE}
  STM_GETIMAGE = 371;
  {$EXTERNALSYM STN_CLICKED}
  STN_CLICKED = 0;
  {$EXTERNALSYM STN_DBLCLK}
  STN_DBLCLK = 1;
  {$EXTERNALSYM STN_ENABLE}
  STN_ENABLE = 2;
  {$EXTERNALSYM STN_DISABLE}
  STN_DISABLE = 3;
  {$EXTERNALSYM STM_MSGMAX}
  STM_MSGMAX = 372;

  { Dialog window class }
  {$EXTERNALSYM WC_DIALOG}
  WC_DIALOG = MakeIntAtom($8002);

  { GetSetWindowWordLong offsets for use with WC_DIALOG windows }
  {$EXTERNALSYM DWL_MSGRESULT}
  DWL_MSGRESULT = 0;
  {$EXTERNALSYM DWL_DLGPROC}
  DWL_DLGPROC = 4;
  {$EXTERNALSYM DWL_USER}
  DWL_USER = 8;

{ Dialog Manager Routines }

{$EXTERNALSYM IsDialogMessageA}
function IsDialogMessageA(hDlg: HWND; var lpMsg: TMsg): BOOL; stdcall;
{$EXTERNALSYM IsDialogMessageW}
function IsDialogMessageW(hDlg: HWND; var lpMsg: TMsg): BOOL; stdcall;
{$EXTERNALSYM IsDialogMessage}
function IsDialogMessage(hDlg: HWND; var lpMsg: TMsg): BOOL; stdcall;
{$EXTERNALSYM MapDialogRect}
function MapDialogRect(hDlg: HWND; var lpRect: TRect): BOOL; stdcall;
{$EXTERNALSYM DlgDirListA}
function DlgDirListA(hDlg: HWND; lpPathSpec: PAnsiChar;
  nIDListBox, nIDStaticPath: Integer; uFileType: UINT): Integer; stdcall;
{$EXTERNALSYM DlgDirListW}
function DlgDirListW(hDlg: HWND; lpPathSpec: PWideChar;
  nIDListBox, nIDStaticPath: Integer; uFileType: UINT): Integer; stdcall;
{$EXTERNALSYM DlgDirList}
function DlgDirList(hDlg: HWND; lpPathSpec: PChar;
  nIDListBox, nIDStaticPath: Integer; uFileType: UINT): Integer; stdcall;

const
  { DlgDirList, DlgDirListComboBox flags values }
  {$EXTERNALSYM DDL_READWRITE}
  DDL_READWRITE = 0;
  {$EXTERNALSYM DDL_READONLY}
  DDL_READONLY = 1;
  {$EXTERNALSYM DDL_HIDDEN}
  DDL_HIDDEN = 2;
  {$EXTERNALSYM DDL_SYSTEM}
  DDL_SYSTEM = 4;
  {$EXTERNALSYM DDL_DIRECTORY}
  DDL_DIRECTORY = $10;
  {$EXTERNALSYM DDL_ARCHIVE}
  DDL_ARCHIVE = $20;

  {$EXTERNALSYM DDL_POSTMSGS}
  DDL_POSTMSGS = $2000;
  {$EXTERNALSYM DDL_DRIVES}
  DDL_DRIVES = $4000;
  {$EXTERNALSYM DDL_EXCLUSIVE}
  DDL_EXCLUSIVE = $8000;

{$EXTERNALSYM DlgDirSelectExA}
function DlgDirSelectExA(hDlg: HWND; lpString: PAnsiChar; nCount, nIDListBox: Integer): BOOL; stdcall;
{$EXTERNALSYM DlgDirSelectExW}
function DlgDirSelectExW(hDlg: HWND; lpString: PWideChar; nCount, nIDListBox: Integer): BOOL; stdcall;
{$EXTERNALSYM DlgDirSelectEx}
function DlgDirSelectEx(hDlg: HWND; lpString: PChar; nCount, nIDListBox: Integer): BOOL; stdcall;
{$EXTERNALSYM DlgDirListComboBoxA}
function DlgDirListComboBoxA(hDlg: HWND; lpPathSpec: PAnsiChar;
  nIDComboBox, nIDStaticPath: Integer; uFiletype: UINT): Integer; stdcall;
{$EXTERNALSYM DlgDirListComboBoxW}
function DlgDirListComboBoxW(hDlg: HWND; lpPathSpec: PWideChar;
  nIDComboBox, nIDStaticPath: Integer; uFiletype: UINT): Integer; stdcall;
{$EXTERNALSYM DlgDirListComboBox}
function DlgDirListComboBox(hDlg: HWND; lpPathSpec: PChar;
  nIDComboBox, nIDStaticPath: Integer; uFiletype: UINT): Integer; stdcall;
{$EXTERNALSYM DlgDirSelectComboBoxExA}
function DlgDirSelectComboBoxExA(hDlg: HWND; lpString: PAnsiChar;
  nCount, nIDComboBox: Integer): BOOL; stdcall;
{$EXTERNALSYM DlgDirSelectComboBoxExW}
function DlgDirSelectComboBoxExW(hDlg: HWND; lpString: PWideChar;
  nCount, nIDComboBox: Integer): BOOL; stdcall;
{$EXTERNALSYM DlgDirSelectComboBoxEx}
function DlgDirSelectComboBoxEx(hDlg: HWND; lpString: PChar;
  nCount, nIDComboBox: Integer): BOOL; stdcall;

const
  { Dialog Styles }
  {$EXTERNALSYM DS_ABSALIGN}
  DS_ABSALIGN = 1;
  {$EXTERNALSYM DS_SYSMODAL}
  DS_SYSMODAL = 2;
  {$EXTERNALSYM DS_LOCALEDIT}
  DS_LOCALEDIT = $20;         { Edit items get Local storage. }
  {$EXTERNALSYM DS_SETFONT}
  DS_SETFONT = $40;           { User specified font for Dlg controls }
  {$EXTERNALSYM DS_MODALFRAME}
  DS_MODALFRAME = $80;        { Can be combined with WS_CAPTION  }
  {$EXTERNALSYM DS_NOIDLEMSG}
  DS_NOIDLEMSG = $100;        { WM_ENTERIDLE message will not be sent }
  {$EXTERNALSYM DS_SETFOREGROUND}
  DS_SETFOREGROUND = $200;    { not in win3.1 }

  {$EXTERNALSYM DS_3DLOOK}
  DS_3DLOOK = 4;
  {$EXTERNALSYM DS_FIXEDSYS}
  DS_FIXEDSYS = 8;
  {$EXTERNALSYM DS_NOFAILCREATE}
  DS_NOFAILCREATE = $10;
  {$EXTERNALSYM DS_CONTROL}
  DS_CONTROL = $400;
  {$EXTERNALSYM DS_CENTER}
  DS_CENTER = $800;
  {$EXTERNALSYM DS_CENTERMOUSE}
  DS_CENTERMOUSE = $1000;
  {$EXTERNALSYM DS_CONTEXTHELP}
  DS_CONTEXTHELP = $2000;

  {$EXTERNALSYM PSI_SETACTIVE}
  PSI_SETACTIVE = 1;
  {$EXTERNALSYM PSI_KILLACTIVE}
  PSI_KILLACTIVE = 2;
  {$EXTERNALSYM PSI_APPLY}
  PSI_APPLY = 3;
  {$EXTERNALSYM PSI_RESET}
  PSI_RESET = 4;
  {$EXTERNALSYM PSI_HASHELP}
  PSI_HASHELP = 5;
  {$EXTERNALSYM PSI_HELP}
  PSI_HELP = 6;

  {$EXTERNALSYM PSI_CHANGED}
  PSI_CHANGED = 1;
  {$EXTERNALSYM PSI_GUISTART}
  PSI_GUISTART = 2;
  {$EXTERNALSYM PSI_REBOOT}
  PSI_REBOOT = 3;
  {$EXTERNALSYM PSI_GETSIBLINGS}
  PSI_GETSIBLINGS = 4;

  { Returned in HiWord() of DM_GETDEFID result if msg is supported }
  {$EXTERNALSYM DC_HASDEFID}
  DC_HASDEFID = 21323;

  { Dialog Codes }
  {$EXTERNALSYM DLGC_WANTARROWS}
  DLGC_WANTARROWS = 1;         { Control wants arrow keys         }
  {$EXTERNALSYM DLGC_WANTTAB}
  DLGC_WANTTAB = 2;            { Control wants tab keys           }
  {$EXTERNALSYM DLGC_WANTALLKEYS}
  DLGC_WANTALLKEYS = 4;        { Control wants all keys           }
  {$EXTERNALSYM DLGC_WANTMESSAGE}
  DLGC_WANTMESSAGE = 4;        { Pass message to control          }
  {$EXTERNALSYM DLGC_HASSETSEL}
  DLGC_HASSETSEL = 8;          { Understands EM_SETSEL message    }
  {$EXTERNALSYM DLGC_DEFPUSHBUTTON}
  DLGC_DEFPUSHBUTTON = $10;    { Default pushbutton               }
  {$EXTERNALSYM DLGC_UNDEFPUSHBUTTON}
  DLGC_UNDEFPUSHBUTTON = $20;  { Non-default pushbutton           }
  {$EXTERNALSYM DLGC_RADIOBUTTON}
  DLGC_RADIOBUTTON = $40;      { Radio button                     }
  {$EXTERNALSYM DLGC_WANTCHARS}
  DLGC_WANTCHARS = $80;        { Want WM_CHAR messages            }
  {$EXTERNALSYM DLGC_STATIC}
  DLGC_STATIC = $100;          { Static item: don't include       }
  {$EXTERNALSYM DLGC_BUTTON}
  DLGC_BUTTON = $2000;         { Button item: can be checked      }
  {$EXTERNALSYM LB_CTLCODE}
  LB_CTLCODE = 0;

  { Listbox Return Values }
  {$EXTERNALSYM LB_OKAY}
  LB_OKAY = 0;
  {$EXTERNALSYM LB_ERR}
  LB_ERR = -1;
  {$EXTERNALSYM LB_ERRSPACE}
  LB_ERRSPACE = -2;

  { Listbox Styles }
  {$EXTERNALSYM LBS_NOTIFY}
  LBS_NOTIFY = 1;
  {$EXTERNALSYM LBS_SORT}
  LBS_SORT = 2;
  {$EXTERNALSYM LBS_NOREDRAW}
  LBS_NOREDRAW = 4;
  {$EXTERNALSYM LBS_MULTIPLESEL}
  LBS_MULTIPLESEL = 8;
  {$EXTERNALSYM LBS_OWNERDRAWFIXED}
  LBS_OWNERDRAWFIXED = $10;
  {$EXTERNALSYM LBS_OWNERDRAWVARIABLE}
  LBS_OWNERDRAWVARIABLE = $20;
  {$EXTERNALSYM LBS_HASSTRINGS}
  LBS_HASSTRINGS = $40;
  {$EXTERNALSYM LBS_USETABSTOPS}
  LBS_USETABSTOPS = $80;
  {$EXTERNALSYM LBS_NOINTEGRALHEIGHT}
  LBS_NOINTEGRALHEIGHT = $100;
  {$EXTERNALSYM LBS_MULTICOLUMN}
  LBS_MULTICOLUMN = $200;
  {$EXTERNALSYM LBS_WANTKEYBOARDINPUT}
  LBS_WANTKEYBOARDINPUT = $400;
  {$EXTERNALSYM LBS_EXTENDEDSEL}
  LBS_EXTENDEDSEL = $800;
  {$EXTERNALSYM LBS_DISABLENOSCROLL}
  LBS_DISABLENOSCROLL = $1000;
  {$EXTERNALSYM LBS_NODATA}
  LBS_NODATA = $2000;
  {$EXTERNALSYM LBS_NOSEL}
  LBS_NOSEL = $4000;
  {$EXTERNALSYM LBS_STANDARD}
  LBS_STANDARD = (LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER);

  { Combo Box return Values }
  {$EXTERNALSYM CB_OKAY}
  CB_OKAY = 0;
  {$EXTERNALSYM CB_ERR}
  CB_ERR = -1;
  {$EXTERNALSYM CB_ERRSPACE}
  CB_ERRSPACE = -2;

  { Combo Box styles }
  {$EXTERNALSYM CBS_SIMPLE}
  CBS_SIMPLE = 1;
  {$EXTERNALSYM CBS_DROPDOWN}
  CBS_DROPDOWN = 2;
  {$EXTERNALSYM CBS_DROPDOWNLIST}
  CBS_DROPDOWNLIST = 3;
  {$EXTERNALSYM CBS_OWNERDRAWFIXED}
  CBS_OWNERDRAWFIXED = $10;
  {$EXTERNALSYM CBS_OWNERDRAWVARIABLE}
  CBS_OWNERDRAWVARIABLE = $20;
  {$EXTERNALSYM CBS_AUTOHSCROLL}
  CBS_AUTOHSCROLL = $40;
  {$EXTERNALSYM CBS_OEMCONVERT}
  CBS_OEMCONVERT = $80;
  {$EXTERNALSYM CBS_SORT}
  CBS_SORT = $100;
  {$EXTERNALSYM CBS_HASSTRINGS}
  CBS_HASSTRINGS = $200;
  {$EXTERNALSYM CBS_NOINTEGRALHEIGHT}
  CBS_NOINTEGRALHEIGHT = $400;
  {$EXTERNALSYM CBS_DISABLENOSCROLL}
  CBS_DISABLENOSCROLL = $800;
  {$EXTERNALSYM CBS_UPPERCASE}
  CBS_UPPERCASE = $2000;
  {$EXTERNALSYM CBS_LOWERCASE}
  CBS_LOWERCASE = $4000;

  { Scroll Bar Styles }
  {$EXTERNALSYM SBS_HORZ}
  SBS_HORZ = 0;
  {$EXTERNALSYM SBS_VERT}
  SBS_VERT = 1;
  {$EXTERNALSYM SBS_TOPALIGN}
  SBS_TOPALIGN = 2;
  {$EXTERNALSYM SBS_LEFTALIGN}
  SBS_LEFTALIGN = 2;
  {$EXTERNALSYM SBS_BOTTOMALIGN}
  SBS_BOTTOMALIGN = 4;
  {$EXTERNALSYM SBS_RIGHTALIGN}
  SBS_RIGHTALIGN = 4;
  {$EXTERNALSYM SBS_SIZEBOXTOPLEFTALIGN}
  SBS_SIZEBOXTOPLEFTALIGN = 2;
  {$EXTERNALSYM SBS_SIZEBOXBOTTOMRIGHTALIGN}
  SBS_SIZEBOXBOTTOMRIGHTALIGN = 4;
  {$EXTERNALSYM SBS_SIZEBOX}
  SBS_SIZEBOX = 8;
  {$EXTERNALSYM SBS_SIZEGRIP}
  SBS_SIZEGRIP = $10;

  {$EXTERNALSYM SIF_RANGE}
  SIF_RANGE = 1;
  {$EXTERNALSYM SIF_PAGE}
  SIF_PAGE = 2;
  {$EXTERNALSYM SIF_POS}
  SIF_POS = 4;
  {$EXTERNALSYM SIF_DISABLENOSCROLL}
  SIF_DISABLENOSCROLL = 8;
  {$EXTERNALSYM SIF_TRACKPOS}
  SIF_TRACKPOS = $10;
  {$EXTERNALSYM SIF_ALL}
  SIF_ALL = (SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS);

type
  {$EXTERNALSYM tagSCROLLINFO}
  tagSCROLLINFO = packed record
    cbSize: UINT;
    fMask: UINT;
    nMin: Integer;
    nMax: Integer;
    nPage: UINT;
    nPos: Integer;
    nTrackPos: Integer;
  end;
  PScrollInfo = ^TScrollInfo;
  TScrollInfo = tagSCROLLINFO;
  {$EXTERNALSYM SCROLLINFO}
  SCROLLINFO = tagSCROLLINFO;

{$EXTERNALSYM SetScrollInfo}
function SetScrollInfo(hWnd: HWND; BarFlag: Integer; const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall;
{$EXTERNALSYM GetScrollInfo}
function GetScrollInfo(hWnd: HWND; BarFlag: Integer; var ScrollInfo: TScrollInfo): BOOL; stdcall;


const
  { MDI client style bits }
  {$EXTERNALSYM MDIS_ALLCHILDSTYLES}
  MDIS_ALLCHILDSTYLES = 1;

  { wParam Flags for WM_MDITILE and WM_MDICASCADE messages. }
  {$EXTERNALSYM MDITILE_VERTICAL}
  MDITILE_VERTICAL = 0;       { not in win3.1  }
  {$EXTERNALSYM MDITILE_HORIZONTAL}
  MDITILE_HORIZONTAL = 1;     { not in win3.1  }
  {$EXTERNALSYM MDITILE_SKIPDISABLED}
  MDITILE_SKIPDISABLED = 2;   { not in win3.1  }

type
  PMDICreateStructA = ^TMDICreateStructA;
  PMDICreateStructW = ^TMDICreateStructW;
  PMDICreateStruct = PMDICreateStructA;
  {$EXTERNALSYM tagMDICREATESTRUCTA}
  tagMDICREATESTRUCTA = packed record
    szClass: PAnsiChar;
    szTitle: PAnsiChar;
    hOwner: THandle;
    x: Integer;
    y: Integer;
    cx: Integer;
    cy: Integer;
    style: DWORD;
    lParam: LPARAM;  { app-defined stuff }
  end;
  {$EXTERNALSYM tagMDICREATESTRUCTW}
  tagMDICREATESTRUCTW = packed record
    szClass: PWideChar;
    szTitle: PWideChar;
    hOwner: THandle;
    x: Integer;
    y: Integer;
    cx: Integer;
    cy: Integer;
    style: DWORD;
    lParam: LPARAM;  { app-defined stuff }
  end;
  {$EXTERNALSYM tagMDICREATESTRUCT}
  tagMDICREATESTRUCT = tagMDICREATESTRUCTA;
  TMDICreateStructA = tagMDICREATESTRUCTA;
  TMDICreateStructW = tagMDICREATESTRUCTW;
  TMDICreateStruct = TMDICreateStructA;
  {$EXTERNALSYM MDICREATESTRUCTA}
  MDICREATESTRUCTA = tagMDICREATESTRUCTA;
  {$EXTERNALSYM MDICREATESTRUCTW}
  MDICREATESTRUCTW = tagMDICREATESTRUCTW;
  {$EXTERNALSYM MDICREATESTRUCT}
  MDICREATESTRUCT = MDICREATESTRUCTA;

  PClientCreateStruct = ^TClientCreateStruct;
  {$EXTERNALSYM tagCLIENTCREATESTRUCT}
  tagCLIENTCREATESTRUCT = packed record
    hWindowMenu: THandle;
    idFirstChild: UINT;
  end;
  TClientCreateStruct = tagCLIENTCREATESTRUCT;
  {$EXTERNALSYM CLIENTCREATESTRUCT}
  CLIENTCREATESTRUCT = tagCLIENTCREATESTRUCT;

{$EXTERNALSYM DefFrameProcA}
function DefFrameProcA(hWnd, hWndMDIClient: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefFrameProcW}
function DefFrameProcW(hWnd, hWndMDIClient: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefFrameProc}
function DefFrameProc(hWnd, hWndMDIClient: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefMDIChildProcA}
function DefMDIChildProcA(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefMDIChildProcW}
function DefMDIChildProcW(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM DefMDIChildProc}
function DefMDIChildProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
{$EXTERNALSYM TranslateMDISysAccel}
function TranslateMDISysAccel(hWndClient: HWND; const lpMsg: TMsg): BOOL; stdcall;
{$EXTERNALSYM ArrangeIconicWindows}
function ArrangeIconicWindows(hWnd: HWND): UINT; stdcall;
{$EXTERNALSYM CreateMDIWindowA}
function CreateMDIWindowA(lpClassName, lpWindowName: PAnsiChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer;
  hWndParent: HWND; hInstance: HINST; lParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateMDIWindowW}
function CreateMDIWindowW(lpClassName, lpWindowName: PWideChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer;
  hWndParent: HWND; hInstance: HINST; lParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM CreateMDIWindow}
function CreateMDIWindow(lpClassName, lpWindowName: PChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer;
  hWndParent: HWND; hInstance: HINST; lParam: LPARAM): HWND; stdcall;
{$EXTERNALSYM TileWindows}
function TileWindows(hwndParent: HWND; wHow: UINT; lpRect: PRect; cKids: UINT; lpKids: Pointer): Word; stdcall;
{$EXTERNALSYM CascadeWindows}
function CascadeWindows(hwndParent: HWND; wHow: UINT; lpRect: PRect; cKids: UINT; lpKids: Pointer): Word; stdcall;


{ IME class support }

const
  { wParam for WM_IME_CONTROL (removed from 4.0 SDK) }
  {$EXTERNALSYM IMC_GETCANDIDATEPOS}
  IMC_GETCANDIDATEPOS = 7;
  {$EXTERNALSYM IMC_SETCANDIDATEPOS}
  IMC_SETCANDIDATEPOS = 8;
  {$EXTERNALSYM IMC_GETCOMPOSITIONFONT}
  IMC_GETCOMPOSITIONFONT = 9;
  {$EXTERNALSYM IMC_SETCOMPOSITIONFONT}
  IMC_SETCOMPOSITIONFONT = $0A;
  {$EXTERNALSYM IMC_GETCOMPOSITIONWINDOW}
  IMC_GETCOMPOSITIONWINDOW = $0B;
  {$EXTERNALSYM IMC_SETCOMPOSITIONWINDOW}
  IMC_SETCOMPOSITIONWINDOW = $0C;
  {$EXTERNALSYM IMC_GETSTATUSWINDOWPOS}
  IMC_GETSTATUSWINDOWPOS = $0F;
  {$EXTERNALSYM IMC_SETSTATUSWINDOWPOS}
  IMC_SETSTATUSWINDOWPOS = $10;
  {$EXTERNALSYM IMC_CLOSESTATUSWINDOW}
  IMC_CLOSESTATUSWINDOW = $21;
  {$EXTERNALSYM IMC_OPENSTATUSWINDOW}
  IMC_OPENSTATUSWINDOW = $22;

  { wParam of report message WM_IME_NOTIFY (removed from 4.0 SDK) }
  {$EXTERNALSYM IMN_CLOSESTATUSWINDOW}
  IMN_CLOSESTATUSWINDOW = 1;
  {$EXTERNALSYM IMN_OPENSTATUSWINDOW}
  IMN_OPENSTATUSWINDOW = 2;
  {$EXTERNALSYM IMN_CHANGECANDIDATE}
  IMN_CHANGECANDIDATE = 3;
  {$EXTERNALSYM IMN_CLOSECANDIDATE}
  IMN_CLOSECANDIDATE = 4;
  {$EXTERNALSYM IMN_OPENCANDIDATE}
  IMN_OPENCANDIDATE = 5;
  {$EXTERNALSYM IMN_SETCONVERSIONMODE}
  IMN_SETCONVERSIONMODE = 6;
  {$EXTERNALSYM IMN_SETSENTENCEMODE}
  IMN_SETSENTENCEMODE = 7;
  {$EXTERNALSYM IMN_SETOPENSTATUS}
  IMN_SETOPENSTATUS = 8;
  {$EXTERNALSYM IMN_SETCANDIDATEPOS}
  IMN_SETCANDIDATEPOS = 9;
  {$EXTERNALSYM IMN_SETCOMPOSITIONFONT}
  IMN_SETCOMPOSITIONFONT = 10;
  {$EXTERNALSYM IMN_SETCOMPOSITIONWINDOW}
  IMN_SETCOMPOSITIONWINDOW = 11;
  {$EXTERNALSYM IMN_SETSTATUSWINDOWPOS}
  IMN_SETSTATUSWINDOWPOS = 12;
  {$EXTERNALSYM IMN_GUIDELINE}
  IMN_GUIDELINE = 13;
  {$EXTERNALSYM IMN_PRIVATE}
  IMN_PRIVATE = 14;

{ Help support }

type
  {$EXTERNALSYM HELPPOLY}
  HELPPOLY = DWORD;
  PMultiKeyHelpA = ^TMultiKeyHelpA;
  PMultiKeyHelpW = ^TMultiKeyHelpW;
  PMultiKeyHelp = PMultiKeyHelpA;
  {$EXTERNALSYM tagMULTIKEYHELPA}
  tagMULTIKEYHELPA = record
    mkSize: DWORD;
    mkKeylist: AnsiChar;
    szKeyphrase: array[0..0] of AnsiChar;
  end;
  {$EXTERNALSYM tagMULTIKEYHELPW}
  tagMULTIKEYHELPW = record
    mkSize: DWORD;
    mkKeylist: WideChar;
    szKeyphrase: array[0..0] of WideChar;
  end;
  {$EXTERNALSYM tagMULTIKEYHELP}
  tagMULTIKEYHELP = tagMULTIKEYHELPA;
  TMultiKeyHelpA = tagMULTIKEYHELPA;
  TMultiKeyHelpW = tagMULTIKEYHELPW;
  TMultiKeyHelp = TMultiKeyHelpA;
  {$EXTERNALSYM MULTIKEYHELPA}
  MULTIKEYHELPA = tagMULTIKEYHELPA;
  {$EXTERNALSYM MULTIKEYHELPW}
  MULTIKEYHELPW = tagMULTIKEYHELPW;
  {$EXTERNALSYM MULTIKEYHELP}
  MULTIKEYHELP = MULTIKEYHELPA;

  PHelpWinInfoA = ^THelpWinInfoA;
  PHelpWinInfoW = ^THelpWinInfoW;
  PHelpWinInfo = PHelpWinInfoA;
  {$EXTERNALSYM tagHELPWININFOA}
  tagHELPWININFOA = record
    wStructSize: Integer;
    x: Integer;
    y: Integer;
    dx: Integer;
    dy: Integer;
    wMax: Integer;
    rgchMember: array[0..1] of AnsiChar;
  end;
  {$EXTERNALSYM tagHELPWININFOW}
  tagHELPWININFOW = record
    wStructSize: Integer;
    x: Integer;
    y: Integer;
    dx: Integer;
    dy: Integer;
    wMax: Integer;
    rgchMember: array[0..1] of WideChar;
  end;
  {$EXTERNALSYM tagHELPWININFO}
  tagHELPWININFO = tagHELPWININFOA;
  THelpWinInfoA = tagHELPWININFOA;
  THelpWinInfoW = tagHELPWININFOW;
  THelpWinInfo = THelpWinInfoA;
  {$EXTERNALSYM HELPWININFOA}
  HELPWININFOA = tagHELPWININFOA;
  {$EXTERNALSYM HELPWININFOW}
  HELPWININFOW = tagHELPWININFOW;
  {$EXTERNALSYM HELPWININFO}
  HELPWININFO = HELPWININFOA;

const
  { Commands to pass to WinHelp() }
  {$EXTERNALSYM HELP_CONTEXT}
  HELP_CONTEXT = 1;       { Display topic in ulTopic  }
  {$EXTERNALSYM HELP_QUIT}
  HELP_QUIT = 2;          { Terminate help  }
  {$EXTERNALSYM HELP_INDEX}
  HELP_INDEX = 3;         { Display index  }
  {$EXTERNALSYM HELP_CONTENTS}
  HELP_CONTENTS = 3;
  {$EXTERNALSYM HELP_HELPONHELP}
  HELP_HELPONHELP = 4;    { Display help on using help  }
  {$EXTERNALSYM HELP_SETINDEX}
  HELP_SETINDEX = 5;      { Set current Index for multi index help  }
  {$EXTERNALSYM HELP_SETCONTENTS}
  HELP_SETCONTENTS = 5;
  {$EXTERNALSYM HELP_CONTEXTPOPUP}
  HELP_CONTEXTPOPUP = 8;
  {$EXTERNALSYM HELP_FORCEFILE}
  HELP_FORCEFILE = 9;
  {$EXTERNALSYM HELP_KEY}
  HELP_KEY = 257;         { Display topic for keyword in offabData  }
  {$EXTERNALSYM HELP_COMMAND}
  HELP_COMMAND = 258;
  {$EXTERNALSYM HELP_PARTIALKEY}
  HELP_PARTIALKEY = 261;
  {$EXTERNALSYM HELP_MULTIKEY}
  HELP_MULTIKEY = 513;
  {$EXTERNALSYM HELP_SETWINPOS}
  HELP_SETWINPOS = 515;
  {$EXTERNALSYM HELP_CONTEXTMENU}
  HELP_CONTEXTMENU = 10;
  {$EXTERNALSYM HELP_FINDER}
  HELP_FINDER = 11;
  {$EXTERNALSYM HELP_WM_HELP}
  HELP_WM_HELP = 12;
  {$EXTERNALSYM HELP_SETPOPUP_POS}
  HELP_SETPOPUP_POS = 13;

  {$EXTERNALSYM HELP_TCARD}
  HELP_TCARD = $8000;
  {$EXTERNALSYM HELP_TCARD_DATA}
  HELP_TCARD_DATA = $10;
  {$EXTERNALSYM HELP_TCARD_OTHER_CALLER}
  HELP_TCARD_OTHER_CALLER = 17;

  { These are in winhelp.h in Win95. }
  {$EXTERNALSYM IDH_NO_HELP}
  IDH_NO_HELP = 28440;
  {$EXTERNALSYM IDH_MISSING_CONTEXT}
  IDH_MISSING_CONTEXT = 28441;      { Control doesn't have matching help context }
  {$EXTERNALSYM IDH_GENERIC_HELP_BUTTON}
  IDH_GENERIC_HELP_BUTTON = 28442;  { Property sheet help button }
  {$EXTERNALSYM IDH_OK}
  IDH_OK = 28443;
  {$EXTERNALSYM IDH_CANCEL}
  IDH_CANCEL = 28444;
  {$EXTERNALSYM IDH_HELP}
  IDH_HELP = 28445;

{$EXTERNALSYM WinHelpA}
function WinHelpA(hWndMain: HWND; lpszHelp: PAnsiChar; uCommand: UINT; dwData: DWORD): BOOL; stdcall;
{$EXTERNALSYM WinHelpW}
function WinHelpW(hWndMain: HWND; lpszHelp: PWideChar; uCommand: UINT; dwData: DWORD): BOOL; stdcall;
{$EXTERNALSYM WinHelp}
function WinHelp(hWndMain: HWND; lpszHelp: PChar; uCommand: UINT; dwData: DWORD): BOOL; stdcall;

const
  {$EXTERNALSYM GR_GDIOBJECTS}
  GR_GDIOBJECTS = 0;    { Count of GDI objects }
  {$EXTERNALSYM GR_USEROBJECTS}
  GR_USEROBJECTS = 1;    { Count of USER objects }

{$EXTERNALSYM GetGuiResources}
function GetGuiResources(hProcess: THandle; uiFlags: DWORD): DWORD; stdcall;

const
  { Parameter for SystemParametersInfo() }
  {$EXTERNALSYM SPI_GETBEEP}
  SPI_GETBEEP = 1;
  {$EXTERNALSYM SPI_SETBEEP}
  SPI_SETBEEP = 2;
  {$EXTERNALSYM SPI_GETMOUSE}
  SPI_GETMOUSE = 3;
  {$EXTERNALSYM SPI_SETMOUSE}
  SPI_SETMOUSE = 4;
  {$EXTERNALSYM SPI_GETBORDER}
  SPI_GETBORDER = 5;
  {$EXTERNALSYM SPI_SETBORDER}
  SPI_SETBORDER = 6;
  {$EXTERNALSYM SPI_GETKEYBOARDSPEED}
  SPI_GETKEYBOARDSPEED = 10;
  {$EXTERNALSYM SPI_SETKEYBOARDSPEED}
  SPI_SETKEYBOARDSPEED = 11;
  {$EXTERNALSYM SPI_LANGDRIVER}
  SPI_LANGDRIVER = 12;
  {$EXTERNALSYM SPI_ICONHORIZONTALSPACING}
  SPI_ICONHORIZONTALSPACING = 13;
  {$EXTERNALSYM SPI_GETSCREENSAVETIMEOUT}
  SPI_GETSCREENSAVETIMEOUT = 14;
  {$EXTERNALSYM SPI_SETSCREENSAVETIMEOUT}
  SPI_SETSCREENSAVETIMEOUT = 15;
  {$EXTERNALSYM SPI_GETSCREENSAVEACTIVE}
  SPI_GETSCREENSAVEACTIVE = $10;
  {$EXTERNALSYM SPI_SETSCREENSAVEACTIVE}
  SPI_SETSCREENSAVEACTIVE = 17;
  {$EXTERNALSYM SPI_GETGRIDGRANULARITY}
  SPI_GETGRIDGRANULARITY = 18;
  {$EXTERNALSYM SPI_SETGRIDGRANULARITY}
  SPI_SETGRIDGRANULARITY = 19;
  {$EXTERNALSYM SPI_SETDESKWALLPAPER}
  SPI_SETDESKWALLPAPER = 20;
  {$EXTERNALSYM SPI_SETDESKPATTERN}
  SPI_SETDESKPATTERN = 21;
  {$EXTERNALSYM SPI_GETKEYBOARDDELAY}
  SPI_GETKEYBOARDDELAY = 22;
  {$EXTERNALSYM SPI_SETKEYBOARDDELAY}
  SPI_SETKEYBOARDDELAY = 23;
  {$EXTERNALSYM SPI_ICONVERTICALSPACING}
  SPI_ICONVERTICALSPACING = 24;
  {$EXTERNALSYM SPI_GETICONTITLEWRAP}
  SPI_GETICONTITLEWRAP = 25;
  {$EXTERNALSYM SPI_SETICONTITLEWRAP}
  SPI_SETICONTITLEWRAP = 26;
  {$EXTERNALSYM SPI_GETMENUDROPALIGNMENT}
  SPI_GETMENUDROPALIGNMENT = 27;
  {$EXTERNALSYM SPI_SETMENUDROPALIGNMENT}
  SPI_SETMENUDROPALIGNMENT = 28;
  {$EXTERNALSYM SPI_SETDOUBLECLKWIDTH}
  SPI_SETDOUBLECLKWIDTH = 29;
  {$EXTERNALSYM SPI_SETDOUBLECLKHEIGHT}
  SPI_SETDOUBLECLKHEIGHT = 30;
  {$EXTERNALSYM SPI_GETICONTITLELOGFONT}
  SPI_GETICONTITLELOGFONT = 31;
  {$EXTERNALSYM SPI_SETDOUBLECLICKTIME}
  SPI_SETDOUBLECLICKTIME = $20;
  {$EXTERNALSYM SPI_SETMOUSEBUTTONSWAP}
  SPI_SETMOUSEBUTTONSWAP = 33;
  {$EXTERNALSYM SPI_SETICONTITLELOGFONT}
  SPI_SETICONTITLELOGFONT = 34;
  {$EXTERNALSYM SPI_GETFASTTASKSWITCH}
  SPI_GETFASTTASKSWITCH = 35;
  {$EXTERNALSYM SPI_SETFASTTASKSWITCH}
  SPI_SETFASTTASKSWITCH = 36;
  {$EXTERNALSYM SPI_SETDRAGFULLWINDOWS}
  SPI_SETDRAGFULLWINDOWS = 37;
  {$EXTERNALSYM SPI_GETDRAGFULLWINDOWS}
  SPI_GETDRAGFULLWINDOWS = 38;
  {$EXTERNALSYM SPI_GETNONCLIENTMETRICS}
  SPI_GETNONCLIENTMETRICS = 41;
  {$EXTERNALSYM SPI_SETNONCLIENTMETRICS}
  SPI_SETNONCLIENTMETRICS = 42;
  {$EXTERNALSYM SPI_GETMINIMIZEDMETRICS}
  SPI_GETMINIMIZEDMETRICS = 43;
  {$EXTERNALSYM SPI_SETMINIMIZEDMETRICS}
  SPI_SETMINIMIZEDMETRICS = 44;
  {$EXTERNALSYM SPI_GETICONMETRICS}
  SPI_GETICONMETRICS = 45;
  {$EXTERNALSYM SPI_SETICONMETRICS}
  SPI_SETICONMETRICS = 46;
  {$EXTERNALSYM SPI_SETWORKAREA}
  SPI_SETWORKAREA = 47;
  {$EXTERNALSYM SPI_GETWORKAREA}
  SPI_GETWORKAREA = 48;
  {$EXTERNALSYM SPI_SETPENWINDOWS}
  SPI_SETPENWINDOWS = 49;

  {$EXTERNALSYM SPI_GETHIGHCONTRAST}
  SPI_GETHIGHCONTRAST = 66;
  {$EXTERNALSYM SPI_SETHIGHCONTRAST}
  SPI_SETHIGHCONTRAST = 67;
  {$EXTERNALSYM SPI_GETKEYBOARDPREF}
  SPI_GETKEYBOARDPREF = 68;
  {$EXTERNALSYM SPI_SETKEYBOARDPREF}
  SPI_SETKEYBOARDPREF = 69;
  {$EXTERNALSYM SPI_GETSCREENREADER}
  SPI_GETSCREENREADER = 70;
  {$EXTERNALSYM SPI_SETSCREENREADER}
  SPI_SETSCREENREADER = 71;
  {$EXTERNALSYM SPI_GETANIMATION}
  SPI_GETANIMATION = 72;
  {$EXTERNALSYM SPI_SETANIMATION}
  SPI_SETANIMATION = 73;
  {$EXTERNALSYM SPI_GETFONTSMOOTHING}
  SPI_GETFONTSMOOTHING = 74;
  {$EXTERNALSYM SPI_SETFONTSMOOTHING}
  SPI_SETFONTSMOOTHING = 75;
  {$EXTERNALSYM SPI_SETDRAGWIDTH}
  SPI_SETDRAGWIDTH = 76;
  {$EXTERNALSYM SPI_SETDRAGHEIGHT}
  SPI_SETDRAGHEIGHT = 77;
  {$EXTERNALSYM SPI_SETHANDHELD}
  SPI_SETHANDHELD = 78;
  {$EXTERNALSYM SPI_GETLOWPOWERTIMEOUT}
  SPI_GETLOWPOWERTIMEOUT = 79;
  {$EXTERNALSYM SPI_GETPOWEROFFTIMEOUT}
  SPI_GETPOWEROFFTIMEOUT = 80;
  {$EXTERNALSYM SPI_SETLOWPOWERTIMEOUT}
  SPI_SETLOWPOWERTIMEOUT = 81;
  {$EXTERNALSYM SPI_SETPOWEROFFTIMEOUT}
  SPI_SETPOWEROFFTIMEOUT = 82;
  {$EXTERNALSYM SPI_GETLOWPOWERACTIVE}
  SPI_GETLOWPOWERACTIVE = 83;
  {$EXTERNALSYM SPI_GETPOWEROFFACTIVE}
  SPI_GETPOWEROFFACTIVE = 84;
  {$EXTERNALSYM SPI_SETLOWPOWERACTIVE}
  SPI_SETLOWPOWERACTIVE = 85;
  {$EXTERNALSYM SPI_SETPOWEROFFACTIVE}
  SPI_SETPOWEROFFACTIVE = 86;
  {$EXTERNALSYM SPI_SETCURSORS}
  SPI_SETCURSORS = 87;
  {$EXTERNALSYM SPI_SETICONS}
  SPI_SETICONS = 88;
  {$EXTERNALSYM SPI_GETDEFAULTINPUTLANG}
  SPI_GETDEFAULTINPUTLANG = 89;
  {$EXTERNALSYM SPI_SETDEFAULTINPUTLANG}
  SPI_SETDEFAULTINPUTLANG = 90;
  {$EXTERNALSYM SPI_SETLANGTOGGLE}
  SPI_SETLANGTOGGLE = 91;
  {$EXTERNALSYM SPI_GETWINDOWSEXTENSION}
  SPI_GETWINDOWSEXTENSION = 92;
  {$EXTERNALSYM SPI_SETMOUSETRAILS}
  SPI_SETMOUSETRAILS = 93;
  {$EXTERNALSYM SPI_GETMOUSETRAILS}
  SPI_GETMOUSETRAILS = 94;
  {$EXTERNALSYM SPI_SCREENSAVERRUNNING}
  SPI_SCREENSAVERRUNNING = 97;
  {$EXTERNALSYM SPI_GETFILTERKEYS}
  SPI_GETFILTERKEYS = 50;
  {$EXTERNALSYM SPI_SETFILTERKEYS}
  SPI_SETFILTERKEYS = 51;
  {$EXTERNALSYM SPI_GETTOGGLEKEYS}
  SPI_GETTOGGLEKEYS = 52;
  {$EXTERNALSYM SPI_SETTOGGLEKEYS}
  SPI_SETTOGGLEKEYS = 53;
  {$EXTERNALSYM SPI_GETMOUSEKEYS}
  SPI_GETMOUSEKEYS = 54;
  {$EXTERNALSYM SPI_SETMOUSEKEYS}
  SPI_SETMOUSEKEYS = 55;
  {$EXTERNALSYM SPI_GETSHOWSOUNDS}
  SPI_GETSHOWSOUNDS = 56;
  {$EXTERNALSYM SPI_SETSHOWSOUNDS}
  SPI_SETSHOWSOUNDS = 57;
  {$EXTERNALSYM SPI_GETSTICKYKEYS}
  SPI_GETSTICKYKEYS = 58;
  {$EXTERNALSYM SPI_SETSTICKYKEYS}
  SPI_SETSTICKYKEYS = 59;
  {$EXTERNALSYM SPI_GETACCESSTIMEOUT}
  SPI_GETACCESSTIMEOUT = 60;
  {$EXTERNALSYM SPI_SETACCESSTIMEOUT}
  SPI_SETACCESSTIMEOUT = 61;
  {$EXTERNALSYM SPI_GETSERIALKEYS}
  SPI_GETSERIALKEYS = 62;
  {$EXTERNALSYM SPI_SETSERIALKEYS}
  SPI_SETSERIALKEYS = 63;
  {$EXTERNALSYM SPI_GETSOUNDSENTRY}
  SPI_GETSOUNDSENTRY = 64;
  {$EXTERNALSYM SPI_SETSOUNDSENTRY}
  SPI_SETSOUNDSENTRY = 65;

  {$EXTERNALSYM SPI_GETSNAPTODEFBUTTON}
  SPI_GETSNAPTODEFBUTTON = 95;
  {$EXTERNALSYM SPI_SETSNAPTODEFBUTTON}
  SPI_SETSNAPTODEFBUTTON = 96;
  {$EXTERNALSYM SPI_GETMOUSEHOVERWIDTH}
  SPI_GETMOUSEHOVERWIDTH = 98;
  {$EXTERNALSYM SPI_SETMOUSEHOVERWIDTH}
  SPI_SETMOUSEHOVERWIDTH = 99;
  {$EXTERNALSYM SPI_GETMOUSEHOVERHEIGHT}
  SPI_GETMOUSEHOVERHEIGHT = 100;
  {$EXTERNALSYM SPI_SETMOUSEHOVERHEIGHT}
  SPI_SETMOUSEHOVERHEIGHT = 101;
  {$EXTERNALSYM SPI_GETMOUSEHOVERTIME}
  SPI_GETMOUSEHOVERTIME = 102;
  {$EXTERNALSYM SPI_SETMOUSEHOVERTIME}
  SPI_SETMOUSEHOVERTIME = 103;
  {$EXTERNALSYM SPI_GETWHEELSCROLLLINES}
  SPI_GETWHEELSCROLLLINES = 104;
  {$EXTERNALSYM SPI_SETWHEELSCROLLLINES}
  SPI_SETWHEELSCROLLLINES = 105;         // For Win95 and WinNT3.51,
                                         // Mswheel broadcasts the message
                                         // WM_SETTINGCHANGE (equivalent to
                                         // WM_WININICHANGE) when the scroll
                                         // lines has changed.  Applications
                                         // will recieve the WM_SETTINGCHANGE
                                         // message with the wParam set to
                                         // SPI_SETWHEELSCROLLLINES.  When
                                         // this message is recieved the
                                         // application should query Mswheel for
                                         // the new setting.
  {$EXTERNALSYM SPI_GETSHOWIMEUI}
  SPI_GETSHOWIMEUI = 110;
  {$EXTERNALSYM SPI_SETSHOWIMEUI}
  SPI_SETSHOWIMEUI = 111;
  {$EXTERNALSYM SPI_GETMOUSESPEED}
  SPI_GETMOUSESPEED = 112;
  {$EXTERNALSYM SPI_SETMOUSESPEED}
  SPI_SETMOUSESPEED = 113;
  {$EXTERNALSYM SPI_GETSCREENSAVERRUNNING}
  SPI_GETSCREENSAVERRUNNING = 114;

  {$EXTERNALSYM SPI_GETACTIVEWINDOWTRACKING}
  SPI_GETACTIVEWINDOWTRACKING = $1000;
  {$EXTERNALSYM SPI_SETACTIVEWINDOWTRACKING}
  SPI_SETACTIVEWINDOWTRACKING = $1001;
  {$EXTERNALSYM SPI_GETMENUANIMATION}
  SPI_GETMENUANIMATION = $1002;
  {$EXTERNALSYM SPI_SETMENUANIMATION}
  SPI_SETMENUANIMATION = $1003;
  {$EXTERNALSYM SPI_GETCOMBOBOXANIMATION}
  SPI_GETCOMBOBOXANIMATION = $1004;
  {$EXTERNALSYM SPI_SETCOMBOBOXANIMATION}
  SPI_SETCOMBOBOXANIMATION = $1005;
  {$EXTERNALSYM SPI_GETLISTBOXSMOOTHSCROLLING}
  SPI_GETLISTBOXSMOOTHSCROLLING = $1006;
  {$EXTERNALSYM SPI_SETLISTBOXSMOOTHSCROLLING}
  SPI_SETLISTBOXSMOOTHSCROLLING = $1007;
  {$EXTERNALSYM SPI_GETGRADIENTCAPTIONS}
  SPI_GETGRADIENTCAPTIONS = $1008;
  {$EXTERNALSYM SPI_SETGRADIENTCAPTIONS}
  SPI_SETGRADIENTCAPTIONS = $1009;
  {$EXTERNALSYM SPI_GETMENUUNDERLINES}
  SPI_GETMENUUNDERLINES = $100A;
  {$EXTERNALSYM SPI_SETMENUUNDERLINES}
  SPI_SETMENUUNDERLINES = $100B;
  {$EXTERNALSYM SPI_GETACTIVEWNDTRKZORDER}
  SPI_GETACTIVEWNDTRKZORDER = $100C;
  {$EXTERNALSYM SPI_SETACTIVEWNDTRKZORDER}
  SPI_SETACTIVEWNDTRKZORDER = $100D;
  {$EXTERNALSYM SPI_GETHOTTRACKING}
  SPI_GETHOTTRACKING = $100E;
  {$EXTERNALSYM SPI_SETHOTTRACKING}
  SPI_SETHOTTRACKING = $100F;
  {$EXTERNALSYM SPI_GETFOREGROUNDLOCKTIMEOUT}
  SPI_GETFOREGROUNDLOCKTIMEOUT = $2000;
  {$EXTERNALSYM SPI_SETFOREGROUNDLOCKTIMEOUT}
  SPI_SETFOREGROUNDLOCKTIMEOUT = $2001;
  {$EXTERNALSYM SPI_GETACTIVEWNDTRKTIMEOUT}
  SPI_GETACTIVEWNDTRKTIMEOUT = $2002;
  {$EXTERNALSYM SPI_SETACTIVEWNDTRKTIMEOUT}
  SPI_SETACTIVEWNDTRKTIMEOUT = $2003;
  {$EXTERNALSYM SPI_GETFOREGROUNDFLASHCOUNT}
  SPI_GETFOREGROUNDFLASHCOUNT = $2004;
  {$EXTERNALSYM SPI_SETFOREGROUNDFLASHCOUNT}
  SPI_SETFOREGROUNDFLASHCOUNT = $2005;
                                       
  { Flags }
  {$EXTERNALSYM SPIF_UPDATEINIFILE}
  SPIF_UPDATEINIFILE = 1;
  {$EXTERNALSYM SPIF_SENDWININICHANGE}
  SPIF_SENDWININICHANGE = 2;
  {$EXTERNALSYM SPIF_SENDCHANGE}
  SPIF_SENDCHANGE = SPIF_SENDWININICHANGE;

  {$EXTERNALSYM METRICS_USEDEFAULT}
  METRICS_USEDEFAULT = LongWord(-1);

type
  PNonClientMetricsA = ^TNonClientMetricsA;
  PNonClientMetricsW = ^TNonClientMetricsW;
  PNonClientMetrics = PNonClientMetricsA;
  {$EXTERNALSYM tagNONCLIENTMETRICSA}
  tagNONCLIENTMETRICSA = packed record
    cbSize: UINT;
    iBorderWidth: Integer;
    iScrollWidth: Integer;
    iScrollHeight: Integer;
    iCaptionWidth: Integer;
    iCaptionHeight: Integer;
    lfCaptionFont: TLogFontA;
    iSmCaptionWidth: Integer;
    iSmCaptionHeight: Integer;
    lfSmCaptionFont: TLogFontA;
    iMenuWidth: Integer;
    iMenuHeight: Integer;
    lfMenuFont: TLogFontA;
    lfStatusFont: TLogFontA;
    lfMessageFont: TLogFontA;
  end;
  {$EXTERNALSYM tagNONCLIENTMETRICSW}
  tagNONCLIENTMETRICSW = packed record
    cbSize: UINT;
    iBorderWidth: Integer;
    iScrollWidth: Integer;
    iScrollHeight: Integer;
    iCaptionWidth: Integer;
    iCaptionHeight: Integer;
    lfCaptionFont: TLogFontW;
    iSmCaptionWidth: Integer;
    iSmCaptionHeight: Integer;
    lfSmCaptionFont: TLogFontW;
    iMenuWidth: Integer;
    iMenuHeight: Integer;
    lfMenuFont: TLogFontW;
    lfStatusFont: TLogFontW;
    lfMessageFont: TLogFontW;
  end;
  {$EXTERNALSYM tagNONCLIENTMETRICS}
  tagNONCLIENTMETRICS = tagNONCLIENTMETRICSA;
  TNonClientMetricsA = tagNONCLIENTMETRICSA;
  TNonClientMetricsW = tagNONCLIENTMETRICSW;
  TNonClientMetrics = TNonClientMetricsA;
  {$EXTERNALSYM NONCLIENTMETRICSA}
  NONCLIENTMETRICSA = tagNONCLIENTMETRICSA;
  {$EXTERNALSYM NONCLIENTMETRICSW}
  NONCLIENTMETRICSW = tagNONCLIENTMETRICSW;
  {$EXTERNALSYM NONCLIENTMETRICS}
  NONCLIENTMETRICS = NONCLIENTMETRICSA;

const
  {$EXTERNALSYM ARW_BOTTOMLEFT}
  ARW_BOTTOMLEFT = 0;
  {$EXTERNALSYM ARW_BOTTOMRIGHT}
  ARW_BOTTOMRIGHT = 1;
  {$EXTERNALSYM ARW_TOPLEFT}
  ARW_TOPLEFT = 2;
  {$EXTERNALSYM ARW_TOPRIGHT}
  ARW_TOPRIGHT = 3;
  {$EXTERNALSYM ARW_STARTMASK}
  ARW_STARTMASK = 3;
  {$EXTERNALSYM ARW_STARTRIGHT}
  ARW_STARTRIGHT = 1;
  {$EXTERNALSYM ARW_STARTTOP}
  ARW_STARTTOP = 2;

  {$EXTERNALSYM ARW_LEFT}
  ARW_LEFT = 0;
  {$EXTERNALSYM ARW_RIGHT}
  ARW_RIGHT = 0;
  {$EXTERNALSYM ARW_UP}
  ARW_UP = 4;
  {$EXTERNALSYM ARW_DOWN}
  ARW_DOWN = 4;
  {$EXTERNALSYM ARW_HIDE}
  ARW_HIDE = 8;
  {$EXTERNALSYM ARW_VALID}
  ARW_VALID = 15;

type
  PMinimizedMetrics = ^TMinimizedMetrics;
  {$EXTERNALSYM tagMINIMIZEDMETRICS}
  tagMINIMIZEDMETRICS = packed record
    cbSize: UINT;
    iWidth: Integer;
    iHorzGap: Integer;
    iVertGap: Integer;
    iArrange: Integer;
  end;
  TMinimizedMetrics = tagMINIMIZEDMETRICS;
  {$EXTERNALSYM MINIMIZEDMETRICS}
  MINIMIZEDMETRICS = tagMINIMIZEDMETRICS;

  PIconMetricsA = ^TIconMetricsA;
  PIconMetricsW = ^TIconMetricsW;
  PIconMetrics = PIconMetricsA;
  {$EXTERNALSYM tagICONMETRICSA}
  tagICONMETRICSA = packed record
    cbSize: UINT;
    iHorzSpacing: Integer;
    iVertSpacing: Integer;
    iTitleWrap: Integer;
    lfFont: TLogFontA;
  end;
  {$EXTERNALSYM tagICONMETRICSW}
  tagICONMETRICSW = packed record
    cbSize: UINT;
    iHorzSpacing: Integer;
    iVertSpacing: Integer;
    iTitleWrap: Integer;
    lfFont: TLogFontW;
  end;
  {$EXTERNALSYM tagICONMETRICS}
  tagICONMETRICS = tagICONMETRICSA;
  TIconMetricsA = tagICONMETRICSA;
  TIconMetricsW = tagICONMETRICSW;
  TIconMetrics = TIconMetricsA;
  {$EXTERNALSYM ICONMETRICSA}
  ICONMETRICSA = tagICONMETRICSA;
  {$EXTERNALSYM ICONMETRICSW}
  ICONMETRICSW = tagICONMETRICSW;
  {$EXTERNALSYM ICONMETRICS}
  ICONMETRICS = ICONMETRICSA;

  PAnimationInfo = ^TAnimationInfo;
  {$EXTERNALSYM tagANIMATIONINFO}
  tagANIMATIONINFO = packed record
    cbSize: UINT;
    iMinAnimate: Integer;
  end;
  TAnimationInfo = tagANIMATIONINFO;
  {$EXTERNALSYM ANIMATIONINFO}
  ANIMATIONINFO = tagANIMATIONINFO;


type
  PSerialKeysA = ^TSerialKeysA;
  PSerialKeysW = ^TSerialKeysW;
  PSerialKeys = PSerialKeysA;
  {$EXTERNALSYM tagSERIALKEYSA}
  tagSERIALKEYSA = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    lpszActivePort: PAnsiChar;
    lpszPort: PAnsiChar;
    iBaudRate: UINT;
    iPortState: UINT;
    iActive: UINT;
  end;
  {$EXTERNALSYM tagSERIALKEYSW}
  tagSERIALKEYSW = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    lpszActivePort: PWideChar;
    lpszPort: PWideChar;
    iBaudRate: UINT;
    iPortState: UINT;
    iActive: UINT;
  end;
  {$EXTERNALSYM tagSERIALKEYS}
  tagSERIALKEYS = tagSERIALKEYSA;
  TSerialKeysA = tagSERIALKEYSA;
  TSerialKeysW = tagSERIALKEYSW;
  TSerialKeys = TSerialKeysA;
  {$EXTERNALSYM SERIALKEYSA}
  SERIALKEYSA = tagSERIALKEYSA;
  {$EXTERNALSYM SERIALKEYSW}
  SERIALKEYSW = tagSERIALKEYSW;
  {$EXTERNALSYM SERIALKEYS}
  SERIALKEYS = SERIALKEYSA;

const
  { flags for SERIALKEYS dwFlags field }
  {$EXTERNALSYM SERKF_SERIALKEYSON}
  SERKF_SERIALKEYSON = 1;
  {$EXTERNALSYM SERKF_AVAILABLE}
  SERKF_AVAILABLE = 2;
  {$EXTERNALSYM SERKF_INDICATOR}
  SERKF_INDICATOR = 4;

type
  PHighContrastA = ^THighContrastA;
  PHighContrastW = ^THighContrastW;
  PHighContrast = PHighContrastA;
  {$EXTERNALSYM tagHIGHCONTRASTA}
  tagHIGHCONTRASTA = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    lpszDefaultScheme: PAnsiChar;
  end;
  {$EXTERNALSYM tagHIGHCONTRASTW}
  tagHIGHCONTRASTW = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    lpszDefaultScheme: PWideChar;
  end;
  {$EXTERNALSYM tagHIGHCONTRAST}
  tagHIGHCONTRAST = tagHIGHCONTRASTA;
  THighContrastA = tagHIGHCONTRASTA;
  THighContrastW = tagHIGHCONTRASTW;
  THighContrast = THighContrastA;
  {$EXTERNALSYM HIGHCONTRASTA}
  HIGHCONTRASTA = tagHIGHCONTRASTA;
  {$EXTERNALSYM HIGHCONTRASTW}
  HIGHCONTRASTW = tagHIGHCONTRASTW;
  {$EXTERNALSYM HIGHCONTRAST}
  HIGHCONTRAST = HIGHCONTRASTA;


const
  { flags for HIGHCONTRAST dwFlags field }
  {$EXTERNALSYM HCF_HIGHCONTRASTON}
  HCF_HIGHCONTRASTON      = $00000001;
  {$EXTERNALSYM HCF_AVAILABLE}
  HCF_AVAILABLE           = $00000002;
  {$EXTERNALSYM HCF_HOTKEYACTIVE}
  HCF_HOTKEYACTIVE        = $00000004;
  {$EXTERNALSYM HCF_CONFIRMHOTKEY}
  HCF_CONFIRMHOTKEY       = $00000008;
  {$EXTERNALSYM HCF_HOTKEYSOUND}
  HCF_HOTKEYSOUND         = $00000010;
  {$EXTERNALSYM HCF_INDICATOR}
  HCF_INDICATOR           = $00000020;
  {$EXTERNALSYM HCF_HOTKEYAVAILABLE}
  HCF_HOTKEYAVAILABLE     = $00000040;

  { Flags for ChangeDisplaySettings }
  {$EXTERNALSYM CDS_UPDATEREGISTRY}
  CDS_UPDATEREGISTRY      = $00000001;
  {$EXTERNALSYM CDS_TEST}
  CDS_TEST                = $00000002;
  {$EXTERNALSYM CDS_FULLSCREEN}
  CDS_FULLSCREEN          = $00000004;
  {$EXTERNALSYM CDS_GLOBAL}
  CDS_GLOBAL              = $00000008;
  {$EXTERNALSYM CDS_SET_PRIMARY}
  CDS_SET_PRIMARY         = $00000010;
  {$EXTERNALSYM CDS_RESET}
  CDS_RESET               = $40000000;
  {$EXTERNALSYM CDS_SETRECT}
  CDS_SETRECT             = $20000000;
  {$EXTERNALSYM CDS_NORESET}
  CDS_NORESET             = $10000000;

  { Return values for ChangeDisplaySettings }
  {$EXTERNALSYM DISP_CHANGE_SUCCESSFUL}
  DISP_CHANGE_SUCCESSFUL           = 0;
  {$EXTERNALSYM DISP_CHANGE_RESTART}
  DISP_CHANGE_RESTART              = 1;
  {$EXTERNALSYM DISP_CHANGE_FAILED}
  DISP_CHANGE_FAILED              = -1;
  {$EXTERNALSYM DISP_CHANGE_BADMODE}
  DISP_CHANGE_BADMODE             = -2;
  {$EXTERNALSYM DISP_CHANGE_NOTUPDATED}
  DISP_CHANGE_NOTUPDATED          = -3;
  {$EXTERNALSYM DISP_CHANGE_BADFLAGS}
  DISP_CHANGE_BADFLAGS            = -4;
  {$EXTERNALSYM DISP_CHANGE_BADPARAM}
  DISP_CHANGE_BADPARAM            = -5;


{$EXTERNALSYM ChangeDisplaySettingsA}
function ChangeDisplaySettingsA(var lpDevMode: TDeviceModeA; dwFlags: DWORD): Longint; stdcall;
{$EXTERNALSYM ChangeDisplaySettingsW}
function ChangeDisplaySettingsW(var lpDevMode: TDeviceModeW; dwFlags: DWORD): Longint; stdcall;
{$EXTERNALSYM ChangeDisplaySettings}
function ChangeDisplaySettings(var lpDevMode: TDeviceMode; dwFlags: DWORD): Longint; stdcall;
{$EXTERNALSYM ChangeDisplaySettingsExA}
function ChangeDisplaySettingsExA(lpszDeviceName: PAnsiChar; var lpDevMode: TDeviceModeA;
        wnd: HWND; dwFlags: DWORD; lParam: Pointer): Longint; stdcall;
{$EXTERNALSYM ChangeDisplaySettingsExW}
function ChangeDisplaySettingsExW(lpszDeviceName: PWideChar; var lpDevMode: TDeviceModeW;
        wnd: HWND; dwFlags: DWORD; lParam: Pointer): Longint; stdcall;
{$EXTERNALSYM ChangeDisplaySettingsEx}
function ChangeDisplaySettingsEx(lpszDeviceName: PChar; var lpDevMode: TDeviceMode;
        wnd: HWND; dwFlags: DWORD; lParam: Pointer): Longint; stdcall;
{$EXTERNALSYM EnumDisplaySettingsA}
function EnumDisplaySettingsA(lpszDeviceName: PAnsiChar; iModeNum: DWORD;
  var lpDevMode: TDeviceModeA): BOOL; stdcall;
{$EXTERNALSYM EnumDisplaySettingsW}
function EnumDisplaySettingsW(lpszDeviceName: PWideChar; iModeNum: DWORD;
  var lpDevMode: TDeviceModeW): BOOL; stdcall;
{$EXTERNALSYM EnumDisplaySettings}
function EnumDisplaySettings(lpszDeviceName: PChar; iModeNum: DWORD;
  var lpDevMode: TDeviceMode): BOOL; stdcall;
{#END}
{$EXTERNALSYM EnumDisplayDevicesA}
function EnumDisplayDevicesA(Unused: Pointer; iDevNum: DWORD;
  var lpDisplayDevice: TDisplayDeviceA; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumDisplayDevicesW}
function EnumDisplayDevicesW(Unused: Pointer; iDevNum: DWORD;
  var lpDisplayDevice: TDisplayDeviceW; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumDisplayDevices}
function EnumDisplayDevices(Unused: Pointer; iDevNum: DWORD;
  var lpDisplayDevice: TDisplayDevice; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM SystemParametersInfoA}
function SystemParametersInfoA(uiAction, uiParam: UINT;
  pvParam: Pointer; fWinIni: UINT): BOOL; stdcall;
{$EXTERNALSYM SystemParametersInfoW}
function SystemParametersInfoW(uiAction, uiParam: UINT;
  pvParam: Pointer; fWinIni: UINT): BOOL; stdcall;
{$EXTERNALSYM SystemParametersInfo}
function SystemParametersInfo(uiAction, uiParam: UINT;
  pvParam: Pointer; fWinIni: UINT): BOOL; stdcall;

type
  { Accessibility support }
  PFilterKeys = ^TFilterKeys;
  {$EXTERNALSYM tagFILTERKEYS}
  tagFILTERKEYS = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    iWaitMSec: DWORD;       { Acceptance Delay}
    iDelayMSec: DWORD;      { Delay Until Repeat}
    iRepeatMSec: DWORD;     { Repeat Rate}
    iBounceMSec: DWORD;     { Debounce Time}
  end;
  TFilterKeys = tagFILTERKEYS;
  {$EXTERNALSYM FILTERKEYS}
  FILTERKEYS = tagFILTERKEYS;


const
  { TFilterKeys dwFlags field }
  {$EXTERNALSYM FKF_FILTERKEYSON}
  FKF_FILTERKEYSON = 1;
  {$EXTERNALSYM FKF_AVAILABLE}
  FKF_AVAILABLE = 2;
  {$EXTERNALSYM FKF_HOTKEYACTIVE}
  FKF_HOTKEYACTIVE = 4;
  {$EXTERNALSYM FKF_CONFIRMHOTKEY}
  FKF_CONFIRMHOTKEY = 8;
  {$EXTERNALSYM FKF_HOTKEYSOUND}
  FKF_HOTKEYSOUND = $10;
  {$EXTERNALSYM FKF_INDICATOR}
  FKF_INDICATOR = $20;
  {$EXTERNALSYM FKF_CLICKON}
  FKF_CLICKON = $40;

type
  PStickyKeys = ^TStickyKeys;
  {$EXTERNALSYM tagSTICKYKEYS}
  tagSTICKYKEYS = packed record
    cbSize: UINT;
    dwFlags: DWORD;
  end;
  TStickyKeys = tagSTICKYKEYS;
  {$EXTERNALSYM STICKYKEYS}
  STICKYKEYS = tagSTICKYKEYS;

const
  { TStickyKeys dwFlags field }
  {$EXTERNALSYM SKF_STICKYKEYSON}
  SKF_STICKYKEYSON = 1;
  {$EXTERNALSYM SKF_AVAILABLE}
  SKF_AVAILABLE = 2;
  {$EXTERNALSYM SKF_HOTKEYACTIVE}
  SKF_HOTKEYACTIVE = 4;
  {$EXTERNALSYM SKF_CONFIRMHOTKEY}
  SKF_CONFIRMHOTKEY = 8;
  {$EXTERNALSYM SKF_HOTKEYSOUND}
  SKF_HOTKEYSOUND = $10;
  {$EXTERNALSYM SKF_INDICATOR}
  SKF_INDICATOR = $20;
  {$EXTERNALSYM SKF_AUDIBLEFEEDBACK}
  SKF_AUDIBLEFEEDBACK = $40;
  {$EXTERNALSYM SKF_TRISTATE}
  SKF_TRISTATE = $80;
  {$EXTERNALSYM SKF_TWOKEYSOFF}
  SKF_TWOKEYSOFF = $100;
  {$EXTERNALSYM SKF_LALTLATCHED}
  SKF_LALTLATCHED = $10000000;
  {$EXTERNALSYM SKF_LCTLLATCHED}
  SKF_LCTLLATCHED = $04000000;
  {$EXTERNALSYM SKF_LSHIFTLATCHED}
  SKF_LSHIFTLATCHED = $01000000;
  {$EXTERNALSYM SKF_RALTLATCHED }
  SKF_RALTLATCHED = $20000000;
  {$EXTERNALSYM SKF_RCTLLATCHED}
  SKF_RCTLLATCHED = $08000000;
  {$EXTERNALSYM SKF_RSHIFTLATCHED}
  SKF_RSHIFTLATCHED = $02000000;
  {$EXTERNALSYM SKF_LWINLATCHED}
  SKF_LWINLATCHED = $40000000;
  {$EXTERNALSYM SKF_RWINLATCHED}
  SKF_RWINLATCHED = $80000000;
  {$EXTERNALSYM SKF_LALTLOCKED}
  SKF_LALTLOCKED = $00100000;
  {$EXTERNALSYM SKF_LCTLLOCKED}
  SKF_LCTLLOCKED = $00040000;
  {$EXTERNALSYM SKF_LSHIFTLOCKED}
  SKF_LSHIFTLOCKED = $00010000;
  {$EXTERNALSYM SKF_RALTLOCKED}
  SKF_RALTLOCKED = $00200000;
  {$EXTERNALSYM SKF_RCTLLOCKED}
  SKF_RCTLLOCKED = $00080000;
  {$EXTERNALSYM SKF_RSHIFTLOCKED}
  SKF_RSHIFTLOCKED = $00020000;
  {$EXTERNALSYM SKF_LWINLOCKED}
  SKF_LWINLOCKED = $00400000;
  {$EXTERNALSYM SKF_RWINLOCKED}
  SKF_RWINLOCKED = $00800000;

type
  PMouseKeys = ^TMouseKeys;
  {$EXTERNALSYM tagMOUSEKEYS}
  tagMOUSEKEYS = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    iMaxSpeed: DWORD;
    iTimeToMaxSpeed: DWORD;
    iCtrlSpeed: DWORD;
    dwReserved1: DWORD;
    dwReserved2: DWORD;
  end;
  TMouseKeys = tagMOUSEKEYS;
  {$EXTERNALSYM MOUSEKEYS}
  MOUSEKEYS = tagMOUSEKEYS;

const
  { TMouseKeys dwFlags field }
  {$EXTERNALSYM MKF_MOUSEKEYSON}
  MKF_MOUSEKEYSON = 1;
  {$EXTERNALSYM MKF_AVAILABLE}
  MKF_AVAILABLE = 2;
  {$EXTERNALSYM MKF_HOTKEYACTIVE}
  MKF_HOTKEYACTIVE = 4;
  {$EXTERNALSYM MKF_CONFIRMHOTKEY}
  MKF_CONFIRMHOTKEY = 8;
  {$EXTERNALSYM MKF_HOTKEYSOUND}
  MKF_HOTKEYSOUND = $10;
  {$EXTERNALSYM MKF_INDICATOR}
  MKF_INDICATOR = $20;
  {$EXTERNALSYM MKF_MODIFIERS}
  MKF_MODIFIERS = $40;
  {$EXTERNALSYM MKF_REPLACENUMBERS}
  MKF_REPLACENUMBERS = $80;
  {$EXTERNALSYM MKF_LEFTBUTTONSEL}
  MKF_LEFTBUTTONSEL = $10000000;
  {$EXTERNALSYM MKF_RIGHTBUTTONSEL}
  MKF_RIGHTBUTTONSEL = $20000000;
  {$EXTERNALSYM MKF_LEFTBUTTONDOWN}
  MKF_LEFTBUTTONDOWN = $01000000;
  {$EXTERNALSYM MKF_RIGHTBUTTONDOWN}
  MKF_RIGHTBUTTONDOWN = $02000000;
  {$EXTERNALSYM MKF_MOUSEMODE}
  MKF_MOUSEMODE = $80000000;

type
  PAccessTimeout = ^TAccessTimeout;
  {$EXTERNALSYM tagACCESSTIMEOUT}
  tagACCESSTIMEOUT = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    iTimeOutMSec: DWORD;
  end;
  TAccessTimeout = tagACCESSTIMEOUT;
  {$EXTERNALSYM ACCESSTIMEOUT}
  ACCESSTIMEOUT = tagACCESSTIMEOUT;

const
  { TAccessTimeout dwFlags field }
  {$EXTERNALSYM ATF_TIMEOUTON}
  ATF_TIMEOUTON = 1;
  {$EXTERNALSYM ATF_ONOFFFEEDBACK}
  ATF_ONOFFFEEDBACK = 2;

  { values for TSoundsEntry iFSGrafEffect field }
  {$EXTERNALSYM SSGF_NONE}
  SSGF_NONE = 0;
  {$EXTERNALSYM SSGF_DISPLAY}
  SSGF_DISPLAY = 3;

  { values for TSoundsEntry iFSTextEffect field }
  {$EXTERNALSYM SSTF_NONE}
  SSTF_NONE = 0;
  {$EXTERNALSYM SSTF_CHARS}
  SSTF_CHARS = 1;
  {$EXTERNALSYM SSTF_BORDER}
  SSTF_BORDER = 2;
  {$EXTERNALSYM SSTF_DISPLAY}
  SSTF_DISPLAY = 3;

  { values for TSoundsEntry iWindowsEffect field }
  {$EXTERNALSYM SSWF_NONE}
  SSWF_NONE = 0;
  {$EXTERNALSYM SSWF_TITLE}
  SSWF_TITLE = 1;
  {$EXTERNALSYM SSWF_WINDOW}
  SSWF_WINDOW = 2;
  {$EXTERNALSYM SSWF_DISPLAY}
  SSWF_DISPLAY = 3;
  {$EXTERNALSYM SSWF_CUSTOM}
  SSWF_CUSTOM = 4;

type
  PSoundsEntryA = ^TSoundsEntryA;
  PSoundsEntryW = ^TSoundsEntryW;
  PSoundsEntry = PSoundsEntryA;
  {$EXTERNALSYM tagSOUNDSENTRYA}
  tagSOUNDSENTRYA = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    iFSTextEffect: DWORD;
    iFSTextEffectMSec: DWORD;
    iFSTextEffectColorBits: DWORD;
    iFSGrafEffect: DWORD;
    iFSGrafEffectMSec: DWORD;
    iFSGrafEffectColor: DWORD;
    iWindowsEffect: DWORD;
    iWindowsEffectMSec: DWORD;
    lpszWindowsEffectDLL: PAnsiChar;
    iWindowsEffectOrdinal: DWORD;
  end;
  {$EXTERNALSYM tagSOUNDSENTRYW}
  tagSOUNDSENTRYW = packed record
    cbSize: UINT;
    dwFlags: DWORD;
    iFSTextEffect: DWORD;
    iFSTextEffectMSec: DWORD;
    iFSTextEffectColorBits: DWORD;
    iFSGrafEffect: DWORD;
    iFSGrafEffectMSec: DWORD;
    iFSGrafEffectColor: DWORD;
    iWindowsEffect: DWORD;
    iWindowsEffectMSec: DWORD;
    lpszWindowsEffectDLL: PWideChar;
    iWindowsEffectOrdinal: DWORD;
  end;
  {$EXTERNALSYM tagSOUNDSENTRY}
  tagSOUNDSENTRY = tagSOUNDSENTRYA;
  TSoundsEntryA = tagSOUNDSENTRYA;
  TSoundsEntryW = tagSOUNDSENTRYW;
  TSoundsEntry = TSoundsEntryA;
  {$EXTERNALSYM SOUNDSENTRYA}
  SOUNDSENTRYA = tagSOUNDSENTRYA;
  {$EXTERNALSYM SOUNDSENTRYW}
  SOUNDSENTRYW = tagSOUNDSENTRYW;
  {$EXTERNALSYM SOUNDSENTRY}
  SOUNDSENTRY = SOUNDSENTRYA;

const
  { SOUNDSENTRY dwFlags field }
  {$EXTERNALSYM SSF_SOUNDSENTRYON}
  SSF_SOUNDSENTRYON = 1;
  {$EXTERNALSYM SSF_AVAILABLE}
  SSF_AVAILABLE = 2;
  {$EXTERNALSYM SSF_INDICATOR}
  SSF_INDICATOR = 4;


type
  PToggleKeys = ^TToggleKeys;
  {$EXTERNALSYM tagTOGGLEKEYS}
  tagTOGGLEKEYS = packed record
    cbSize: UINT;
    dwFlags: DWORD;
  end;
  TToggleKeys = tagTOGGLEKEYS;
  {$EXTERNALSYM TOGGLEKEYS}
  TOGGLEKEYS = tagTOGGLEKEYS;

const
  { TToggleKeys dwFlags field }
  {$EXTERNALSYM TKF_TOGGLEKEYSON}
  TKF_TOGGLEKEYSON = 1;
  {$EXTERNALSYM TKF_AVAILABLE}
  TKF_AVAILABLE = 2;
  {$EXTERNALSYM TKF_HOTKEYACTIVE}
  TKF_HOTKEYACTIVE = 4;
  {$EXTERNALSYM TKF_CONFIRMHOTKEY}
  TKF_CONFIRMHOTKEY = 8;
  {$EXTERNALSYM TKF_HOTKEYSOUND}
  TKF_HOTKEYSOUND = $10;
  {$EXTERNALSYM TKF_INDICATOR}
  TKF_INDICATOR = $20;

{$EXTERNALSYM SetDebugErrorLevel}
procedure SetDebugErrorLevel(dwLevel: DWORD); stdcall;

const
  { SetLastErrorEx() types. }
  {$EXTERNALSYM SLE_ERROR}
  SLE_ERROR = 1;
  {$EXTERNALSYM SLE_MINORERROR}
  SLE_MINORERROR = 2;
  {$EXTERNALSYM SLE_WARNING}
  SLE_WARNING = 3;

{$EXTERNALSYM SetLastErrorEx}
procedure SetLastErrorEx(dwErrCode, dwType: DWORD); stdcall;


{ WinEvents - Active Accessibility hooks }
{$EXTERNALSYM NotifyWinEvent}
procedure NotifyWinEvent(event: DWORD; hwnd: HWND; idObject, idChild: Longint);

type
  {$EXTERNALSYM TFNWinEventProc}
    TFNWinEventProc = procedure (hWinEventHook: THandle; event: DWORD;
    hwnd: HWND; idObject, idChild: Longint; idEventThread, dwmsEventTime: DWORD); stdcall;

const
  {$EXTERNALSYM CHILDID_SELF}
  CHILDID_SELF = 0;
  {$EXTERNALSYM INDEXID_OBJECT}
  INDEXID_OBJECT = 0;
  {$EXTERNALSYM INDEXID_CONTAINER}
  INDEXID_CONTAINER = 0;

  { Reserved IDs for system objects}
  {$EXTERNALSYM OBJID_WINDOW}
  OBJID_WINDOW = $00000000;
  {$EXTERNALSYM OBJID_SYSMENU}
  OBJID_SYSMENU = $FFFFFFFF;
  {$EXTERNALSYM OBJID_TITLEBAR}
  OBJID_TITLEBAR = $FFFFFFFE;
  {$EXTERNALSYM OBJID_MENU}
  OBJID_MENU = $FFFFFFFD;
  {$EXTERNALSYM OBJID_CLIENT}
  OBJID_CLIENT = $FFFFFFFC;
  {$EXTERNALSYM OBJID_VSCROLL}
  OBJID_VSCROLL = $FFFFFFFB;
  {$EXTERNALSYM OBJID_HSCROLL}
  OBJID_HSCROLL = $FFFFFFFA;
  {$EXTERNALSYM OBJID_SIZEGRIP}
  OBJID_SIZEGRIP = $FFFFFFF9;
  {$EXTERNALSYM OBJID_CARET}
  OBJID_CARET = $FFFFFFF8;
  {$EXTERNALSYM OBJID_CURSOR}
  OBJID_CURSOR = $FFFFFFF7;
  {$EXTERNALSYM OBJID_ALERT}
  OBJID_ALERT = $FFFFFFF6;
  {$EXTERNALSYM OBJID_SOUND}
  OBJID_SOUND = $FFFFFFF5;

  { EVENT DEFINITION }
  {$EXTERNALSYM EVENT_MIN}
  EVENT_MIN = $00000001;
  {$EXTERNALSYM EVENT_MAX}
  EVENT_MAX = $7FFFFFFF;

  {$EXTERNALSYM EVENT_SYSTEM_SOUND}
  EVENT_SYSTEM_SOUND = $0001;
  {$EXTERNALSYM EVENT_SYSTEM_ALERT}
  EVENT_SYSTEM_ALERT = $0002;
  {$EXTERNALSYM EVENT_SYSTEM_FOREGROUND}
  EVENT_SYSTEM_FOREGROUND = $0003;
  {$EXTERNALSYM EVENT_SYSTEM_MENUSTART}
  EVENT_SYSTEM_MENUSTART = $0004;
  {$EXTERNALSYM EVENT_SYSTEM_MENUEND}
  EVENT_SYSTEM_MENUEND = $0005;
  {$EXTERNALSYM EVENT_SYSTEM_MENUPOPUPSTART}
  EVENT_SYSTEM_MENUPOPUPSTART  = $0006;
  {$EXTERNALSYM EVENT_SYSTEM_MENUPOPUPEND}
  EVENT_SYSTEM_MENUPOPUPEND    = $0007;
  {$EXTERNALSYM EVENT_SYSTEM_CAPTURESTART}
  EVENT_SYSTEM_CAPTURESTART    = $0008;
  {$EXTERNALSYM EVENT_SYSTEM_CAPTUREEND}
  EVENT_SYSTEM_CAPTUREEND      = $0009;
  {$EXTERNALSYM EVENT_SYSTEM_MOVESIZESTART}
  EVENT_SYSTEM_MOVESIZESTART   = $000A;
  {$EXTERNALSYM EVENT_SYSTEM_MOVESIZEEND}
  EVENT_SYSTEM_MOVESIZEEND     = $000B;
  {$EXTERNALSYM EVENT_SYSTEM_CONTEXTHELPSTART}
  EVENT_SYSTEM_CONTEXTHELPSTART= $000C;
  {$EXTERNALSYM EVENT_SYSTEM_CONTEXTHELPEND}
  EVENT_SYSTEM_CONTEXTHELPEND  = $000D;
  {$EXTERNALSYM EVENT_SYSTEM_DRAGDROPSTART}
  EVENT_SYSTEM_DRAGDROPSTART   = $000E;
  {$EXTERNALSYM EVENT_SYSTEM_DRAGDROPEND}
  EVENT_SYSTEM_DRAGDROPEND     = $000F;
  {$EXTERNALSYM EVENT_SYSTEM_DIALOGSTART}
  EVENT_SYSTEM_DIALOGSTART     = $0010;
  {$EXTERNALSYM EVENT_SYSTEM_DIALOGEND}
  EVENT_SYSTEM_DIALOGEND       = $0011;
  {$EXTERNALSYM EVENT_SYSTEM_SCROLLINGSTART}
  EVENT_SYSTEM_SCROLLINGSTART  = $0012;
  {$EXTERNALSYM EVENT_SYSTEM_SCROLLINGEND}
  EVENT_SYSTEM_SCROLLINGEND    = $0013;
  {$EXTERNALSYM EVENT_SYSTEM_SWITCHSTART}
  EVENT_SYSTEM_SWITCHSTART     = $0014;
  {$EXTERNALSYM EVENT_SYSTEM_SWITCHEND}
  EVENT_SYSTEM_SWITCHEND       = $0015;
  {$EXTERNALSYM EVENT_SYSTEM_MINIMIZESTART}
  EVENT_SYSTEM_MINIMIZESTART   = $0016;
  {$EXTERNALSYM EVENT_SYSTEM_MINIMIZEEND}
  EVENT_SYSTEM_MINIMIZEEND     = $0017;
  {$EXTERNALSYM EVENT_OBJECT_CREATE}
  EVENT_OBJECT_CREATE              = $8000;  { hwnd + ID + idChild is created item }
  {$EXTERNALSYM EVENT_OBJECT_DESTROY}
  EVENT_OBJECT_DESTROY             = $8001;  { hwnd + ID + idChild is destroyed item
  {$EXTERNALSYM EVENT_OBJECT_SHOW}
  EVENT_OBJECT_SHOW                = $8002;  { hwnd + ID + idChild is shown item
  {$EXTERNALSYM EVENT_OBJECT_HIDE}
  EVENT_OBJECT_HIDE                = $8003;  { hwnd + ID + idChild is hidden item
  {$EXTERNALSYM EVENT_OBJECT_REORDER}
  EVENT_OBJECT_REORDER             = $8004;  { hwnd + ID + idChild is parent of zordering children
  {$EXTERNALSYM EVENT_OBJECT_FOCUS}
  EVENT_OBJECT_FOCUS               = $8005;  { hwnd + ID + idChild is focused item
  {$EXTERNALSYM EVENT_OBJECT_SELECTION}
  EVENT_OBJECT_SELECTION           = $8006;  { hwnd + ID + idChild is selected item (if only one), or idChild is OBJID_WINDOW if complex
  {$EXTERNALSYM EVENT_OBJECT_SELECTIONADD}
  EVENT_OBJECT_SELECTIONADD        = $8007;  { hwnd + ID + idChild is item added
  {$EXTERNALSYM EVENT_OBJECT_SELECTIONREMOVE}
  EVENT_OBJECT_SELECTIONREMOVE     = $8008;  { hwnd + ID + idChild is item removed
  {$EXTERNALSYM EVENT_OBJECT_SELECTIONWITHIN}
  EVENT_OBJECT_SELECTIONWITHIN     = $8009;  { hwnd + ID + idChild is parent of changed selected items
  {$EXTERNALSYM EVENT_OBJECT_STATECHANGE}
  EVENT_OBJECT_STATECHANGE         = $800A;  { hwnd + ID + idChild is item w/ state change
  {$EXTERNALSYM EVENT_OBJECT_LOCATIONCHANGE}
  EVENT_OBJECT_LOCATIONCHANGE      = $800B;  { hwnd + ID + idChild is moved/sized item
  {$EXTERNALSYM EVENT_OBJECT_NAMECHANGE}
  EVENT_OBJECT_NAMECHANGE          = $800C;  { hwnd + ID + idChild is item w/ name change
  {$EXTERNALSYM EVENT_OBJECT_DESCRIPTIONCHANGE}
  EVENT_OBJECT_DESCRIPTIONCHANGE   = $800D;  { hwnd + ID + idChild is item w/ desc change
  {$EXTERNALSYM EVENT_OBJECT_VALUECHANGE}
  EVENT_OBJECT_VALUECHANGE         = $800E;  { hwnd + ID + idChild is item w/ value change
  {$EXTERNALSYM EVENT_OBJECT_PARENTCHANGE}
  EVENT_OBJECT_PARENTCHANGE        = $800F;  { hwnd + ID + idChild is item w/ new parent
  {$EXTERNALSYM EVENT_OBJECT_HELPCHANGE}
  EVENT_OBJECT_HELPCHANGE          = $8010;  { hwnd + ID + idChild is item w/ help change
  {$EXTERNALSYM EVENT_OBJECT_DEFACTIONCHANGE}
  EVENT_OBJECT_DEFACTIONCHANGE     = $8011;  { hwnd + ID + idChild is item w/ def action change
  {$EXTERNALSYM EVENT_OBJECT_ACCELERATORCHANGE}
  EVENT_OBJECT_ACCELERATORCHANGE   = $8012;  { hwnd + ID + idChild is item w/ keybd accel change
  {$EXTERNALSYM SOUND_SYSTEM_STARTUP}
  SOUND_SYSTEM_STARTUP           = 1;
  {$EXTERNALSYM SOUND_SYSTEM_SHUTDOWN}
  SOUND_SYSTEM_SHUTDOWN          = 2;
  {$EXTERNALSYM SOUND_SYSTEM_BEEP}
  SOUND_SYSTEM_BEEP              = 3;
  {$EXTERNALSYM SOUND_SYSTEM_ERROR}
  SOUND_SYSTEM_ERROR             = 4;
  {$EXTERNALSYM SOUND_SYSTEM_QUESTION}
  SOUND_SYSTEM_QUESTION          = 5;
  {$EXTERNALSYM SOUND_SYSTEM_WARNING}
  SOUND_SYSTEM_WARNING           = 6;
  {$EXTERNALSYM SOUND_SYSTEM_INFORMATION}
  SOUND_SYSTEM_INFORMATION       = 7;
  {$EXTERNALSYM SOUND_SYSTEM_MAXIMIZE}
  SOUND_SYSTEM_MAXIMIZE          = 8;
  {$EXTERNALSYM SOUND_SYSTEM_MINIMIZE}
  SOUND_SYSTEM_MINIMIZE          = 9;
  {$EXTERNALSYM SOUND_SYSTEM_RESTOREUP}
  SOUND_SYSTEM_RESTOREUP         = 10;
  {$EXTERNALSYM SOUND_SYSTEM_RESTOREDOWN}
  SOUND_SYSTEM_RESTOREDOWN       = 11;
  {$EXTERNALSYM SOUND_SYSTEM_APPSTART}
  SOUND_SYSTEM_APPSTART          = 12;
  {$EXTERNALSYM SOUND_SYSTEM_FAULT}
  SOUND_SYSTEM_FAULT             = 13;
  {$EXTERNALSYM SOUND_SYSTEM_APPEND}
  SOUND_SYSTEM_APPEND            = 14;
  {$EXTERNALSYM SOUND_SYSTEM_MENUCOMMAND}
  SOUND_SYSTEM_MENUCOMMAND       = 15;
  {$EXTERNALSYM SOUND_SYSTEM_MENUPOPUP}
  SOUND_SYSTEM_MENUPOPUP         = 16;
  {$EXTERNALSYM CSOUND_SYSTEM}
  CSOUND_SYSTEM                  = 16;
  {$EXTERNALSYM ALERT_SYSTEM_INFORMATIONAL}
  ALERT_SYSTEM_INFORMATIONAL     = 1;       { MB_INFORMATION }
  {$EXTERNALSYM ALERT_SYSTEM_WARNING}
  ALERT_SYSTEM_WARNING           = 2;       { MB_WARNING }
  {$EXTERNALSYM ALERT_SYSTEM_ERROR}
  ALERT_SYSTEM_ERROR             = 3;       { MB_ERROR }
  {$EXTERNALSYM ALERT_SYSTEM_QUERY}
  ALERT_SYSTEM_QUERY             = 4;       { MB_QUESTION }
  {$EXTERNALSYM ALERT_SYSTEM_CRITICAL}
  ALERT_SYSTEM_CRITICAL          = 5;       { HardSysErrBox }
  {$EXTERNALSYM CALERT_SYSTEM}
  CALERT_SYSTEM                  = 6;

{$EXTERNALSYM SetWinEventHook}
function SetWinEventHook (eventMin, eventMax: DWORD; hmodWinEventProc: HMODULE;
  pfnWinEventProc: TFNWinEventProc; idProcess, idThread, dwFlags: DWORD): THandle; stdcall;

{$EXTERNALSYM UnhookWinEvent}
function UnhookWinEvent(hWinEventHook: THandle): BOOL; stdcall;

const
  { dwFlags for SetWinEventHook }
  {$EXTERNALSYM WINEVENT_OUTOFCONTEXT}
  WINEVENT_OUTOFCONTEXT  = $0000;  { Events are ASYNC }
  {$EXTERNALSYM WINEVENT_SKIPOWNTHREAD}
  WINEVENT_SKIPOWNTHREAD = $0001;  { Don't call back for events on installer's thread }
  {$EXTERNALSYM WINEVENT_SKIPOWNPROCESS}
  WINEVENT_SKIPOWNPROCESS = $0002;  { Don't call back for events on installer's process }
  {$EXTERNALSYM WINEVENT_INCONTEXT}
  WINEVENT_INCONTEXT = $0004;  { Events are SYNC, this causes your dll to be injected into every process }

type
  PGUIThreadInfo = ^TGUIThreadInfo;
  {$EXTERNALSYM tagGUITHREADINFO}
  tagGUITHREADINFO = packed record
    cbSize: DWORD;
    flags: DWORD;
    hwndActive: HWND;
    hwndFocus: HWND;
    hwndCapture: HWND;
    hwndMenuOwner: HWND;
    hwndMoveSize: HWND;
    hwndCaret: HWND;
    rcCaret: TRect;
  end;
  TGUIThreadInfo = tagGUITHREADINFO;

const
  {$EXTERNALSYM GUI_CARETBLINKING}
  GUI_CARETBLINKING  = $00000001;
  {$EXTERNALSYM GUI_INMOVESIZE}
  GUI_INMOVESIZE     = $00000002;
  {$EXTERNALSYM GUI_INMENUMODE}
  GUI_INMENUMODE     = $00000004;
  {$EXTERNALSYM GUI_SYSTEMMENUMODE}
  GUI_SYSTEMMENUMODE = $00000008;
  {$EXTERNALSYM GUI_POPUPMENUMODE}
  GUI_POPUPMENUMODE  = $00000010;

{$EXTERNALSYM GetGUIThreadInfo}
function GetGUIThreadInfo (idThread: DWORD; var pgui: TGUIThreadinfo): BOOL; stdcall;

{$EXTERNALSYM GetWindowModuleFileNameA}
function GetWindowModuleFileNameA(hwnd: HWND; pszFileName: PAnsiChar; cchFileNameMax: UINT): UINT; stdcall;
{$EXTERNALSYM GetWindowModuleFileNameW}
function GetWindowModuleFileNameW(hwnd: HWND; pszFileName: PAnsiChar; cchFileNameMax: UINT): UINT; stdcall;
{$EXTERNALSYM GetWindowModuleFileName}
function GetWindowModuleFileName(hwnd: HWND; pszFileName: PAnsiChar; cchFileNameMax: UINT): UINT; stdcall;

const
  {$EXTERNALSYM STATE_SYSTEM_UNAVAILABLE}
  STATE_SYSTEM_UNAVAILABLE     = $00000001;  { Disabled }
  {$EXTERNALSYM STATE_SYSTEM_SELECTED}
  STATE_SYSTEM_SELECTED        = $00000002;
  {$EXTERNALSYM STATE_SYSTEM_FOCUSED}
  STATE_SYSTEM_FOCUSED         = $00000004;
  {$EXTERNALSYM STATE_SYSTEM_PRESSED}
  STATE_SYSTEM_PRESSED         = $00000008;
  {$EXTERNALSYM STATE_SYSTEM_CHECKED}
  STATE_SYSTEM_CHECKED         = $00000010;
  {$EXTERNALSYM STATE_SYSTEM_MIXED}
  STATE_SYSTEM_MIXED           = $00000020;  { 3-state checkbox or toolbar button }
  {$EXTERNALSYM STATE_SYSTEM_READONLY}
  STATE_SYSTEM_READONLY        = $00000040;
  {$EXTERNALSYM STATE_SYSTEM_HOTTRACKED}
  STATE_SYSTEM_HOTTRACKED      = $00000080;
  {$EXTERNALSYM STATE_SYSTEM_DEFAULT}
  STATE_SYSTEM_DEFAULT         = $00000100;
  {$EXTERNALSYM STATE_SYSTEM_EXPANDED}
  STATE_SYSTEM_EXPANDED        = $00000200;
  {$EXTERNALSYM STATE_SYSTEM_COLLAPSED}
  STATE_SYSTEM_COLLAPSED       = $00000400;
  {$EXTERNALSYM STATE_SYSTEM_BUSY}
  STATE_SYSTEM_BUSY            = $00000800;
  {$EXTERNALSYM STATE_SYSTEM_FLOATING}
  STATE_SYSTEM_FLOATING        = $00001000;  { Children "owned" not "contained" by parent }
  {$EXTERNALSYM STATE_SYSTEM_MARQUEED}
  STATE_SYSTEM_MARQUEED        = $00002000;
  {$EXTERNALSYM STATE_SYSTEM_ANIMATED}
  STATE_SYSTEM_ANIMATED        = $00004000;
  {$EXTERNALSYM STATE_SYSTEM_INVISIBLE}
  STATE_SYSTEM_INVISIBLE       = $00008000;
  {$EXTERNALSYM STATE_SYSTEM_OFFSCREEN}
  STATE_SYSTEM_OFFSCREEN       = $00010000;
  {$EXTERNALSYM STATE_SYSTEM_SIZEABLE}
  STATE_SYSTEM_SIZEABLE        = $00020000;
  {$EXTERNALSYM STATE_SYSTEM_MOVEABLE}
  STATE_SYSTEM_MOVEABLE        = $00040000;
  {$EXTERNALSYM STATE_SYSTEM_SELFVOICING}
  STATE_SYSTEM_SELFVOICING     = $00080000;
  {$EXTERNALSYM STATE_SYSTEM_FOCUSABLE}
  STATE_SYSTEM_FOCUSABLE       = $00100000;
  {$EXTERNALSYM STATE_SYSTEM_SELECTABLE}
  STATE_SYSTEM_SELECTABLE      = $00200000;
  {$EXTERNALSYM STATE_SYSTEM_LINKED}
  STATE_SYSTEM_LINKED          = $00400000;
  {$EXTERNALSYM STATE_SYSTEM_TRAVERSED}
  STATE_SYSTEM_TRAVERSED       = $00800000;
  {$EXTERNALSYM STATE_SYSTEM_MULTISELECTABLE}
  STATE_SYSTEM_MULTISELECTABLE = $01000000;  { Supports multiple selection }
  {$EXTERNALSYM STATE_SYSTEM_EXTSELECTABLE}
  STATE_SYSTEM_EXTSELECTABLE   = $02000000;  { Supports extended selection }
  {$EXTERNALSYM STATE_SYSTEM_ALERT_LOW}
  STATE_SYSTEM_ALERT_LOW       = $04000000;  { This information is of low priority }
  {$EXTERNALSYM STATE_SYSTEM_ALERT_MEDIUM}
  STATE_SYSTEM_ALERT_MEDIUM    = $08000000;  { This information is of medium priority }
  {$EXTERNALSYM STATE_SYSTEM_ALERT_HIGH}
  STATE_SYSTEM_ALERT_HIGH      = $10000000;  { This information is of high priority }
  {$EXTERNALSYM STATE_SYSTEM_VALID}
  STATE_SYSTEM_VALID           = $1FFFFFFF;

  {$EXTERNALSYM CCHILDREN_TITLEBAR}
  CCHILDREN_TITLEBAR           =   5;
  {$EXTERNALSYM CCHILDREN_SCROLLBAR}
  CCHILDREN_SCROLLBAR          =   5;

type
  { Information about the global cursor. }
  PCursorInfo = ^TCursorInfo;
  {$EXTERNALSYM tagCURSORINFO}
  tagCURSORINFO = packed record
    cbSize: DWORD;
    flags: DWORD;
    hCursor: HCURSOR;
    ptScreenPos: TPoint;
  end;
  TCursorInfo = tagCURSORINFO;

const
  {$EXTERNALSYM CURSOR_SHOWING}
  CURSOR_SHOWING = $00000001;

{$EXTERNALSYM GetCursorInfo}
function GetCursorInfo(var pci: TCursorInfo): BOOL; stdcall;

type
  { Window information snapshot }
  PWindowInfo = ^TWindowInfo;
  {$EXTERNALSYM tagWINDOWINFO}
  tagWINDOWINFO = packed record
    cbSize: DWORD;
    rcWindow: TRect;
    rcClient: TRect;
    dwStyle: DWORD;
    dwExStyle: DWORD;
    dwOtherStuff: DWORD;
    cxWindowBorders: UINT;
    cyWindowBorders: UINT;
    atomWindowType: TAtom;
    wCreatorVersion: WORD;
  end;
  TWindowInfo = tagWINDOWINFO;

const
  {$EXTERNALSYM WS_ACTIVECAPTION}
  WS_ACTIVECAPTION = $0001;

{$EXTERNALSYM GetWindowInfo}
function GetWindowInfo(hwnd: HWND; var pwi: TWindowInfo): BOOL; stdcall;

type
  { Titlebar information. }
  PTitleBarInfo = ^TTitleBarInfo;
  {$EXTERNALSYM tagTITLEBARINFO}
  tagTITLEBARINFO = packed record
    cbSize: DWORD;
    rcTitleBar: TRect;
    rgstate: array [0..CCHILDREN_TITLEBAR] of DWORD;
  end;
  TTitleBarInfo = tagTITLEBARINFO;

{$EXTERNALSYM GetTitleBarInfo}
function GetTitleBarInfo(hwnd: HWND; var pti: TTitleBarInfo): BOOL; stdcall;

type
  { Menubar information }
  PMenuBarInfo = ^TMenuBarInfo;
  {$EXTERNALSYM tagMENUBARINFO}
  tagMENUBARINFO = packed record
    cbSize: DWORD;
    rcBar: TRect;        { rect of bar, popup, item }
    hMenu: HMENU;        { real menu handle of bar, popup }
    hwndMenu: HWND;      { hwnd of item submenu if one }
{    fBarFocused:1: BOOL;} { bar, popup has the focus }
{    fFocused:1: BOOL; }  { item has the focus }
    FocusedBits: BYTE;
  end;
  TMenuBarInfo = tagMENUBARINFO;

{$EXTERNALSYM GetMenuBarInfo}
function GetMenuBarInfo(hend: HWND; idObject, idItem: Longint;
  var pmbi: TMenuBarInfo): BOOL; stdcall;

type
  { Scrollbar information }
  PScrollBarInfo = ^TScrollBarInfo;
  {$EXTERNALSYM tagSCROLLBARINFO}
  tagSCROLLBARINFO = packed record
    cbSize: DWORD;
    rcScrollBar: TRect;
    dxyLineButton: Integer;
    xyThumbTop: Integer;
    xyThumbBottom: Integer;
    bogus: Integer;
    rgstate: array[0..CCHILDREN_SCROLLBAR] of DWORD;
  end;
  TScrollBarInfo = tagSCROLLBARINFO;

{$EXTERNALSYM GetScrollBarInfo}
Function GetScrollBarInfo(hwnd: HWND; idObject: Longint;
  var psbi: TScrollBarInfo): BOOL; stdcall;

type
  { Combobox information }
  PComboBoxInfo = ^TComboBoxInfo;
  {$EXTERNALSYM tagCOMBOBOXINFO}
  tagCOMBOBOXINFO = packed record
    cbSize: DWORD;
    rcItem: TRect;
    rcButton: TRect;
    stateButton: DWORD;
    hwndCombo: HWND;
    hwndItem: HWND;
    hwndList: HWND;
  end;
  TComboBoxInfo = tagCOMBOBOXINFO;

{$EXTERNALSYM GetComboBoxInfo}
Function GetComboBoxInfo(hwndCombo: HWND; var pcbi: TComboBoxInfo): BOOL; stdcall;

const
  { The "real" ancestor window }
  {$EXTERNALSYM GA_MIC}
  GA_MIC       =   1;
  {$EXTERNALSYM GA_PARENT}
  GA_PARENT    =   1;
  {$EXTERNALSYM GA_ROOT}
  GA_ROOT      =   2;
  {$EXTERNALSYM GA_ROOTOWNER}
  GA_ROOTOWNER =   3;
  {$EXTERNALSYM GA_MAC}
  GA_MAC       =   4;

{$EXTERNALSYM GetAncestor}
FUNCTION GetAncestor(hwnd: HWND; gaFlags: UINT): HWND; stdcall;

{$EXTERNALSYM RealChildWindowFromPoint}
FUNCTION RealChildWindowFromPoint(hwndParent: HWND; ptParentClientCoords: TPoint): HWND; stdcall;

{$EXTERNALSYM RealGetWindowClassA}
function RealGetWindowClassA(hwnd: HWND; pszType: PAnsiChar; cchType: UINT): UINT; stdcall;
{$EXTERNALSYM RealGetWindowClassW}
function RealGetWindowClassW(hwnd: HWND; pszType: PWideChar; cchType: UINT): UINT; stdcall;
{$EXTERNALSYM RealGetWindowClass}
function RealGetWindowClass(hwnd: HWND; pszType: PChar; cchType: UINT): UINT; stdcall;

type
  { Alt-Tab Switch window information. }
  PAltTabInfo = ^TAltTabInfo;
  {$EXTERNALSYM tagALTTABINFO}
  tagALTTABINFO = packed record
    cbSize: DWORD;
    cItems: Integer;
    cColumns: Integer;
    cRows: Integer;
    iColFocus: Integer;
    iRowFocus: Integer;
    cxItem: Integer;
    cyItem: Integer;
    ptStart: TPoint;
  end;
  TAltTabInfo = tagALTTABINFO;

{$EXTERNALSYM GetAltTabInfoA}
function GetAltTabInfoA(hwnd: HWND; iItem: Integer; var pati: TAltTabInfo;
  pszItemText: PAnsiChar; cchItemText: UINT): BOOL; stdcall;
{$EXTERNALSYM GetAltTabInfoW}
function GetAltTabInfoW(hwnd: HWND; iItem: Integer; var pati: TAltTabInfo;
  pszItemText: PWideChar; cchItemText: UINT): BOOL; stdcall;
{$EXTERNALSYM GetAltTabInfo}
function GetAltTabInfo(hwnd: HWND; iItem: Integer; var pati: TAltTabInfo;
  pszItemText: PChar; cchItemText: UINT): BOOL; stdcall;

{ Listbox information. Returns the number of items per row. }
{$EXTERNALSYM GetListBoxInfo}
function GetListBoxInfo(hwnd: HWND): DWORD; stdcall;
{$EXTERNALSYM LockWorkStation}
function LockWorkStation: BOOL; stdcall;
{$EXTERNALSYM UserHandleGrantAccess}
function UserHandleGrantAccess(hUserHandle, hJob: THandle): BOOL; stdcall;

{ Translated from WINNLS.H }

const

{ String Length Maximums. }

  {$EXTERNALSYM MAX_LEADBYTES}
  MAX_LEADBYTES = 12; { 5 ranges, 2 bytes ea., 0 term. }
  {$EXTERNALSYM MAX_DEFAULTCHAR}
  MAX_DEFAULTCHAR = 2; { single or double byte }

{ MBCS and Unicode Translation Flags. }

  {$EXTERNALSYM MB_PRECOMPOSED}
  MB_PRECOMPOSED = 1; { use precomposed chars }
  {$EXTERNALSYM MB_COMPOSITE}
  MB_COMPOSITE = 2; { use composite chars }
  {$EXTERNALSYM MB_USEGLYPHCHARS}
  MB_USEGLYPHCHARS = 4; { use glyph chars, not ctrl chars }

  {$EXTERNALSYM WC_DEFAULTCHECK}
  WC_DEFAULTCHECK = $100; { check for default char }
  {$EXTERNALSYM WC_COMPOSITECHECK}
  WC_COMPOSITECHECK = $200; { convert composite to precomposed }
  {$EXTERNALSYM WC_DISCARDNS}
  WC_DISCARDNS = $10; { discard non-spacing chars }
  {$EXTERNALSYM WC_SEPCHARS}
  WC_SEPCHARS = $20; { generate separate chars }
  {$EXTERNALSYM WC_DEFAULTCHAR}
  WC_DEFAULTCHAR = $40; { replace w default char }

{ Character Type Flags. }

  {$EXTERNALSYM CT_CTYPE1}
  CT_CTYPE1 = 1; { ctype 1 information }
  {$EXTERNALSYM CT_CTYPE2}
  CT_CTYPE2 = 2; { ctype 2 information }
  {$EXTERNALSYM CT_CTYPE3}
  CT_CTYPE3 = 4; { ctype 3 information }

{ CType 1 Flag Bits. }

  {$EXTERNALSYM C1_UPPER}
  C1_UPPER = 1; { upper case }
  {$EXTERNALSYM C1_LOWER}
  C1_LOWER = 2; { lower case }
  {$EXTERNALSYM C1_DIGIT}
  C1_DIGIT = 4; { decimal digits }
  {$EXTERNALSYM C1_SPACE}
  C1_SPACE = 8; { spacing characters }
  {$EXTERNALSYM C1_PUNCT}
  C1_PUNCT = $10; { punctuation characters }
  {$EXTERNALSYM C1_CNTRL}
  C1_CNTRL = $20; { control characters }
  {$EXTERNALSYM C1_BLANK}
  C1_BLANK = $40; { blank characters }
  {$EXTERNALSYM C1_XDIGIT}
  C1_XDIGIT = $80; { other digits }
  {$EXTERNALSYM C1_ALPHA}
  C1_ALPHA = $100; { any letter }

{ CType 2 Flag Bits. }

  {$EXTERNALSYM C2_LEFTTORIGHT}
  C2_LEFTTORIGHT = 1; { left to right }
  {$EXTERNALSYM C2_RIGHTTOLEFT}
  C2_RIGHTTOLEFT = 2; { right to left }
  {$EXTERNALSYM C2_EUROPENUMBER}
  C2_EUROPENUMBER = 3; { European number, digit }
  {$EXTERNALSYM C2_EUROPESEPARATOR}
  C2_EUROPESEPARATOR = 4; { European numeric separator }
  {$EXTERNALSYM C2_EUROPETERMINATOR}
  C2_EUROPETERMINATOR = 5; { European numeric terminator }
  {$EXTERNALSYM C2_ARABICNUMBER}
  C2_ARABICNUMBER = 6; { Arabic number }
  {$EXTERNALSYM C2_COMMONSEPARATOR}
  C2_COMMONSEPARATOR = 7; { common numeric separator }
  {$EXTERNALSYM C2_BLOCKSEPARATOR}
  C2_BLOCKSEPARATOR = 8; { block separator }
  {$EXTERNALSYM C2_SEGMENTSEPARATOR}
  C2_SEGMENTSEPARATOR = 9; { segment separator }
  {$EXTERNALSYM C2_WHITESPACE}
  C2_WHITESPACE = 10; { white space }
  {$EXTERNALSYM C2_OTHERNEUTRAL}
  C2_OTHERNEUTRAL = 11; { other neutrals }
  {$EXTERNALSYM C2_NOTAPPLICABLE}
  C2_NOTAPPLICABLE = 0; { no implicit directionality }

{ CType 3 Flag Bits. }

  {$EXTERNALSYM C3_NONSPACING}
  C3_NONSPACING = 1; { nonspacing character }
  {$EXTERNALSYM C3_DIACRITIC}
  C3_DIACRITIC = 2; { diacritic mark }
  {$EXTERNALSYM C3_VOWELMARK}
  C3_VOWELMARK = 4; { vowel mark }
  {$EXTERNALSYM C3_SYMBOL}
  C3_SYMBOL = 8; { symbols }
  {$EXTERNALSYM C3_KATAKANA}
  C3_KATAKANA = $0010; { katakana character }
  {$EXTERNALSYM C3_HIRAGANA}
  C3_HIRAGANA = $0020; { hiragana character }
  {$EXTERNALSYM C3_HALFWIDTH}
  C3_HALFWIDTH = $0040; { half width character }
  {$EXTERNALSYM C3_FULLWIDTH}
  C3_FULLWIDTH = $0080; { full width character }
  {$EXTERNALSYM C3_IDEOGRAPH}
  C3_IDEOGRAPH = $0100; { ideographic character }
  {$EXTERNALSYM C3_KASHIDA}
  C3_KASHIDA = $0200; { Arabic kashida character }
  {$EXTERNALSYM C3_LEXICAL}
  C3_LEXICAL = $0400; { lexical character }
  {$EXTERNALSYM C3_ALPHA}
  C3_ALPHA = $8000; { any linguistic char (C1_ALPHA) }
  {$EXTERNALSYM C3_NOTAPPLICABLE}
  C3_NOTAPPLICABLE = 0; { ctype 3 is not applicable }

{ String Flags. }

  {$EXTERNALSYM NORM_IGNORECASE}
  NORM_IGNORECASE = 1; { ignore case }
  {$EXTERNALSYM NORM_IGNORENONSPACE}
  NORM_IGNORENONSPACE = 2; { ignore nonspacing chars }
  {$EXTERNALSYM NORM_IGNORESYMBOLS}
  NORM_IGNORESYMBOLS = 4; { ignore symbols }
  {$EXTERNALSYM NORM_IGNOREKANATYPE}
  NORM_IGNOREKANATYPE = $10000;
  {$EXTERNALSYM NORM_IGNOREWIDTH}
  NORM_IGNOREWIDTH = $20000;

{ Locale Independent Mapping Flags. }

  {$EXTERNALSYM MAP_FOLDCZONE}
  MAP_FOLDCZONE = $10; { fold compatibility zone chars }
  {$EXTERNALSYM MAP_PRECOMPOSED}
  MAP_PRECOMPOSED = $20; { convert to precomposed chars }
  {$EXTERNALSYM MAP_COMPOSITE}
  MAP_COMPOSITE = $40; { convert to composite chars }
  {$EXTERNALSYM MAP_FOLDDIGITS}
  MAP_FOLDDIGITS = $80; { all digits to ASCII 0-9 }

{ Locale Dependent Mapping Flags. }

  {$EXTERNALSYM LCMAP_LOWERCASE}
  LCMAP_LOWERCASE = $00000100;              { lower case letters }
  {$EXTERNALSYM LCMAP_UPPERCASE}
  LCMAP_UPPERCASE = $00000200;              { upper case letters }
  {$EXTERNALSYM LCMAP_SORTKEY}
  LCMAP_SORTKEY = $00000400;                { WC sort key (normalize) }
  {$EXTERNALSYM LCMAP_BYTEREV}
  LCMAP_BYTEREV = $00000800;                { byte reversal }

  {$EXTERNALSYM LCMAP_HIRAGANA}
  LCMAP_HIRAGANA = $00100000;               { map katakana to hiragana }
  {$EXTERNALSYM LCMAP_KATAKANA}
  LCMAP_KATAKANA = $00200000;               { map hiragana to katakana }
  {$EXTERNALSYM LCMAP_HALFWIDTH}
  LCMAP_HALFWIDTH = $00400000;              { map double byte to single byte }
  {$EXTERNALSYM LCMAP_FULLWIDTH}
  LCMAP_FULLWIDTH = $00800000;              { map single byte to double byte }

  {$EXTERNALSYM LCMAP_LINGUISTIC_CASING}
  LCMAP_LINGUISTIC_CASING = $01000000;      { use linguistic rules for casing }

  {$EXTERNALSYM LCMAP_SIMPLIFIED_CHINESE}
  LCMAP_SIMPLIFIED_CHINESE      = $02000000;  { map traditional chinese to simplified chinese }
  {$EXTERNALSYM LCMAP_TRADITIONAL_CHINESE}
  LCMAP_TRADITIONAL_CHINESE     = $04000000;  { map simplified chinese to traditional chinese }

{ Locale Enumeration Flags. }

  {$EXTERNALSYM LCID_INSTALLED}
  LCID_INSTALLED          = $00000001;  { installed locale ids }
  {$EXTERNALSYM LCID_SUPPORTED}
  LCID_SUPPORTED          = $00000002;  { supported locale ids }

{ Code Page Enumeration Flags. }

  {$EXTERNALSYM CP_INSTALLED}
  CP_INSTALLED            = $00000001;  { installed code page ids }
  {$EXTERNALSYM CP_SUPPORTED}
  CP_SUPPORTED            = $00000002;  { supported code page ids }


{ Sorting Flags.

     WORD Sort:    culturally correct sort
                   hyphen and apostrophe are special cased
                   example: "coop" and "co-op" will sort together in a list

                         co_op     <-------  underscore (symbol)
                         coat
                         comb
                         coop
                         co-op     <-------  hyphen (punctuation)
                         cork
                         went
                         were
                         we're     <-------  apostrophe (punctuation)


     STRING Sort:  hyphen and apostrophe will sort with all other symbols

                         co-op     <-------  hyphen (punctuation)
                         co_op     <-------  underscore (symbol)
                         coat
                         comb
                         coop
                         cork
                         we're     <-------  apostrophe (punctuation)
                         went
                         were
 }

  {$EXTERNALSYM SORT_STRINGSORT}
  SORT_STRINGSORT = $1000; { use string sort method }

{ Code Page Default Values. }

  {$EXTERNALSYM CP_ACP}
  CP_ACP                   = 0;             { default to ANSI code page }
  {$EXTERNALSYM CP_OEMCP}
  CP_OEMCP                 = 1;             { default to OEM  code page }
  {$EXTERNALSYM CP_MACCP}
  CP_MACCP                 = 2;             { default to MAC  code page }

  {$EXTERNALSYM CP_UTF7}
  CP_UTF7                  = 65000;         { UTF-7 translation }
  {$EXTERNALSYM CP_UTF8}
  CP_UTF8                  = 65001;         { UTF-8 translation }

{ Country Codes. }

  {$EXTERNALSYM CTRY_DEFAULT}
  CTRY_DEFAULT = 0;
  {$EXTERNALSYM CTRY_AUSTRALIA}
  CTRY_AUSTRALIA = 61; { Australia }
  {$EXTERNALSYM CTRY_AUSTRIA}
  CTRY_AUSTRIA = 43; { Austria }
  {$EXTERNALSYM CTRY_BELGIUM}
  CTRY_BELGIUM = $20; { Belgium }
  {$EXTERNALSYM CTRY_BRAZIL}
  CTRY_BRAZIL = 55; { Brazil }
  {$EXTERNALSYM CTRY_CANADA}
  CTRY_CANADA = 2; { Canada }
  {$EXTERNALSYM CTRY_DENMARK}
  CTRY_DENMARK = 45; { Denmark }
  {$EXTERNALSYM CTRY_FINLAND}
  CTRY_FINLAND = 358; { Finland }
  {$EXTERNALSYM CTRY_FRANCE}
  CTRY_FRANCE = 33; { France }
  {$EXTERNALSYM CTRY_GERMANY}
  CTRY_GERMANY = 49; { Germany }
  {$EXTERNALSYM CTRY_ICELAND}
  CTRY_ICELAND = 354; { Iceland }
  {$EXTERNALSYM CTRY_IRELAND}
  CTRY_IRELAND = 353; { Ireland }
  {$EXTERNALSYM CTRY_ITALY}
  CTRY_ITALY = 39; { Italy }
  {$EXTERNALSYM CTRY_JAPAN}
  CTRY_JAPAN = 81; { Japan }
  {$EXTERNALSYM CTRY_MEXICO}
  CTRY_MEXICO = 52; { Mexico }
  {$EXTERNALSYM CTRY_NETHERLANDS}
  CTRY_NETHERLANDS = 31; { Netherlands }
  {$EXTERNALSYM CTRY_NEW_ZEALAND}
  CTRY_NEW_ZEALAND = $40; { New Zealand }
  {$EXTERNALSYM CTRY_NORWAY}
  CTRY_NORWAY = 47; { Norway }
  {$EXTERNALSYM CTRY_PORTUGAL}
  CTRY_PORTUGAL = 351; { Portugal }
  {$EXTERNALSYM CTRY_PRCHINA}
  CTRY_PRCHINA = 86; { PR China }
  {$EXTERNALSYM CTRY_SOUTH_KOREA}
  CTRY_SOUTH_KOREA = 82; { South Korea }
  {$EXTERNALSYM CTRY_SPAIN}
  CTRY_SPAIN = 34; { Spain }
  {$EXTERNALSYM CTRY_SWEDEN}
  CTRY_SWEDEN = 46; { Sweden }
  {$EXTERNALSYM CTRY_SWITZERLAND}
  CTRY_SWITZERLAND = 41; { Switzerland }
  {$EXTERNALSYM CTRY_TAIWAN}
  CTRY_TAIWAN = 886; { Taiwan }
  {$EXTERNALSYM CTRY_UNITED_KINGDOM}
  CTRY_UNITED_KINGDOM = 44; { United Kingdom }
  {$EXTERNALSYM CTRY_UNITED_STATES}
  CTRY_UNITED_STATES = 1; { United States }

{ Locale Types.
  These types are used for the GetLocaleInfoW NLS API routine. }

{ LOCALE_NOUSEROVERRIDE is also used in GetTimeFormatW and GetDateFormatW. }

  {$EXTERNALSYM LOCALE_NOUSEROVERRIDE}
  LOCALE_NOUSEROVERRIDE           = DWORD($80000000);   { do not use user overrides }
  {$EXTERNALSYM LOCALE_USE_CP_ACP}
  LOCALE_USE_CP_ACP               = $40000000;   { use the system ACP }

  {$EXTERNALSYM LOCALE_ILANGUAGE}
  LOCALE_ILANGUAGE                = $00000001;   { language id }
  {$EXTERNALSYM LOCALE_SLANGUAGE}
  LOCALE_SLANGUAGE                = $00000002;   { localized name of language }
  {$EXTERNALSYM LOCALE_SENGLANGUAGE}
  LOCALE_SENGLANGUAGE             = $00001001;   { English name of language }
  {$EXTERNALSYM LOCALE_SABBREVLANGNAME}
  LOCALE_SABBREVLANGNAME          = $00000003;   { abbreviated language name }
  {$EXTERNALSYM LOCALE_SNATIVELANGNAME}
  LOCALE_SNATIVELANGNAME          = $00000004;   { native name of language }

  {$EXTERNALSYM LOCALE_ICOUNTRY}
  LOCALE_ICOUNTRY                 = $00000005;   { country code }
  {$EXTERNALSYM LOCALE_SCOUNTRY}
  LOCALE_SCOUNTRY                 = $00000006;   { localized name of country }
  {$EXTERNALSYM LOCALE_SENGCOUNTRY}
  LOCALE_SENGCOUNTRY              = $00001002;   { English name of country }
  {$EXTERNALSYM LOCALE_SABBREVCTRYNAME}
  LOCALE_SABBREVCTRYNAME          = $00000007;   { abbreviated country name }
  {$EXTERNALSYM LOCALE_SNATIVECTRYNAME}
  LOCALE_SNATIVECTRYNAME          = $00000008;   { native name of country }

  {$EXTERNALSYM LOCALE_IDEFAULTLANGUAGE}
  LOCALE_IDEFAULTLANGUAGE         = $00000009;   { default language id }
  {$EXTERNALSYM LOCALE_IDEFAULTCOUNTRY}
  LOCALE_IDEFAULTCOUNTRY          = $0000000A;   { default country code }
  {$EXTERNALSYM LOCALE_IDEFAULTCODEPAGE}
  LOCALE_IDEFAULTCODEPAGE         = $0000000B;   { default oem code page }
  {$EXTERNALSYM LOCALE_IDEFAULTANSICODEPAGE}
  LOCALE_IDEFAULTANSICODEPAGE     = $00001004;   { default ansi code page }
  {$EXTERNALSYM LOCALE_IDEFAULTMACCODEPAGE}
  LOCALE_IDEFAULTMACCODEPAGE      = $00001011;   { default mac code page }

  {$EXTERNALSYM LOCALE_SLIST}
  LOCALE_SLIST                    = $0000000C;   { list item separator }
  {$EXTERNALSYM LOCALE_IMEASURE}
  LOCALE_IMEASURE                 = $0000000D;   { 0 = metric, 1 = US }

  {$EXTERNALSYM LOCALE_SDECIMAL}
  LOCALE_SDECIMAL                 = $0000000E;   { decimal separator }
  {$EXTERNALSYM LOCALE_STHOUSAND}
  LOCALE_STHOUSAND                = $0000000F;   { thousand separator }
  {$EXTERNALSYM LOCALE_SGROUPING}
  LOCALE_SGROUPING                = $00000010;   { digit grouping }
  {$EXTERNALSYM LOCALE_IDIGITS}
  LOCALE_IDIGITS                  = $00000011;   { number of fractional digits }
  {$EXTERNALSYM LOCALE_ILZERO}
  LOCALE_ILZERO                   = $00000012;   { leading zeros for decimal }
  {$EXTERNALSYM LOCALE_INEGNUMBER}
  LOCALE_INEGNUMBER               = $00001010;   { negative number mode }
  {$EXTERNALSYM LOCALE_SNATIVEDIGITS}
  LOCALE_SNATIVEDIGITS            = $00000013;   { native ascii 0-9 }

  {$EXTERNALSYM LOCALE_SCURRENCY}
  LOCALE_SCURRENCY                = $00000014;   { local monetary symbol }
  {$EXTERNALSYM LOCALE_SINTLSYMBOL}
  LOCALE_SINTLSYMBOL              = $00000015;   { intl monetary symbol }
  {$EXTERNALSYM LOCALE_SMONDECIMALSEP}
  LOCALE_SMONDECIMALSEP           = $00000016;   { monetary decimal separator }
  {$EXTERNALSYM LOCALE_SMONTHOUSANDSEP}
  LOCALE_SMONTHOUSANDSEP          = $00000017;   { monetary thousand separator }
  {$EXTERNALSYM LOCALE_SMONGROUPING}
  LOCALE_SMONGROUPING             = $00000018;   { monetary grouping }
  {$EXTERNALSYM LOCALE_ICURRDIGITS}
  LOCALE_ICURRDIGITS              = $00000019;   { # local monetary digits }
  {$EXTERNALSYM LOCALE_IINTLCURRDIGITS}
  LOCALE_IINTLCURRDIGITS          = $0000001A;   { # intl monetary digits }
  {$EXTERNALSYM LOCALE_ICURRENCY}
  LOCALE_ICURRENCY                = $0000001B;   { positive currency mode }
  {$EXTERNALSYM LOCALE_INEGCURR}
  LOCALE_INEGCURR                 = $0000001C;   { negative currency mode }

  {$EXTERNALSYM LOCALE_SDATE}
  LOCALE_SDATE                    = $0000001D;   { date separator }
  {$EXTERNALSYM LOCALE_STIME}
  LOCALE_STIME                    = $0000001E;   { time separator }
  {$EXTERNALSYM LOCALE_SSHORTDATE}
  LOCALE_SSHORTDATE               = $0000001F;   { short date format string }
  {$EXTERNALSYM LOCALE_SLONGDATE}
  LOCALE_SLONGDATE                = $00000020;   { long date format string }
  {$EXTERNALSYM LOCALE_STIMEFORMAT}
  LOCALE_STIMEFORMAT              = $00001003;   { time format string }
  {$EXTERNALSYM LOCALE_IDATE}
  LOCALE_IDATE                    = $00000021;   { short date format ordering }
  {$EXTERNALSYM LOCALE_ILDATE}
  LOCALE_ILDATE                   = $00000022;   { long date format ordering }
  {$EXTERNALSYM LOCALE_ITIME}
  LOCALE_ITIME                    = $00000023;   { time format specifier }
  {$EXTERNALSYM LOCALE_ITIMEMARKPOSN}
  LOCALE_ITIMEMARKPOSN            = $00001005;   { time marker position }
  {$EXTERNALSYM LOCALE_ICENTURY}
  LOCALE_ICENTURY                 = $00000024;   { century format specifier (short date) }
  {$EXTERNALSYM LOCALE_ITLZERO}
  LOCALE_ITLZERO                  = $00000025;   { leading zeros in time field }
  {$EXTERNALSYM LOCALE_IDAYLZERO}
  LOCALE_IDAYLZERO                = $00000026;   { leading zeros in day field (short date) }
  {$EXTERNALSYM LOCALE_IMONLZERO}
  LOCALE_IMONLZERO                = $00000027;   { leading zeros in month field (short date) }
  {$EXTERNALSYM LOCALE_S1159}
  LOCALE_S1159                    = $00000028;   { AM designator }
  {$EXTERNALSYM LOCALE_S2359}
  LOCALE_S2359                    = $00000029;   { PM designator }

  {$EXTERNALSYM LOCALE_ICALENDARTYPE}
  LOCALE_ICALENDARTYPE            = $00001009;   { type of calendar specifier }
  {$EXTERNALSYM LOCALE_IOPTIONALCALENDAR}
  LOCALE_IOPTIONALCALENDAR        = $0000100B;   { additional calendar types specifier }
  {$EXTERNALSYM LOCALE_IFIRSTDAYOFWEEK}
  LOCALE_IFIRSTDAYOFWEEK          = $0000100C;   { first day of week specifier }
  {$EXTERNALSYM LOCALE_IFIRSTWEEKOFYEAR}
  LOCALE_IFIRSTWEEKOFYEAR         = $0000100D;   { first week of year specifier }

  {$EXTERNALSYM LOCALE_SDAYNAME1}
  LOCALE_SDAYNAME1                = $0000002A;   { long name for Monday }
  {$EXTERNALSYM LOCALE_SDAYNAME2}
  LOCALE_SDAYNAME2                = $0000002B;   { long name for Tuesday }
  {$EXTERNALSYM LOCALE_SDAYNAME3}
  LOCALE_SDAYNAME3                = $0000002C;   { long name for Wednesday }
  {$EXTERNALSYM LOCALE_SDAYNAME4}
  LOCALE_SDAYNAME4                = $0000002D;   { long name for Thursday }
  {$EXTERNALSYM LOCALE_SDAYNAME5}
  LOCALE_SDAYNAME5                = $0000002E;   { long name for Friday }
  {$EXTERNALSYM LOCALE_SDAYNAME6}
  LOCALE_SDAYNAME6                = $0000002F;   { long name for Saturday }
  {$EXTERNALSYM LOCALE_SDAYNAME7}
  LOCALE_SDAYNAME7                = $00000030;   { long name for Sunday }
  {$EXTERNALSYM LOCALE_SABBREVDAYNAME1}
  LOCALE_SABBREVDAYNAME1          = $00000031;   { abbreviated name for Monday }
  {$EXTERNALSYM LOCALE_SABBREVDAYNAME2}
  LOCALE_SABBREVDAYNAME2          = $00000032;   { abbreviated name for Tuesday }
  {$EXTERNALSYM LOCALE_SABBREVDAYNAME3}
  LOCALE_SABBREVDAYNAME3          = $00000033;   { abbreviated name for Wednesday }
  {$EXTERNALSYM LOCALE_SABBREVDAYNAME4}
  LOCALE_SABBREVDAYNAME4          = $00000034;   { abbreviated name for Thursday }
  {$EXTERNALSYM LOCALE_SABBREVDAYNAME5}
  LOCALE_SABBREVDAYNAME5          = $00000035;   { abbreviated name for Friday }
  {$EXTERNALSYM LOCALE_SABBREVDAYNAME6}
  LOCALE_SABBREVDAYNAME6          = $00000036;   { abbreviated name for Saturday }
  {$EXTERNALSYM LOCALE_SABBREVDAYNAME7}
  LOCALE_SABBREVDAYNAME7          = $00000037;   { abbreviated name for Sunday }
  {$EXTERNALSYM LOCALE_SMONTHNAME1}
  LOCALE_SMONTHNAME1              = $00000038;   { long name for January }
  {$EXTERNALSYM LOCALE_SMONTHNAME2}
  LOCALE_SMONTHNAME2              = $00000039;   { long name for February }
  {$EXTERNALSYM LOCALE_SMONTHNAME3}
  LOCALE_SMONTHNAME3              = $0000003A;   { long name for March }
  {$EXTERNALSYM LOCALE_SMONTHNAME4}
  LOCALE_SMONTHNAME4              = $0000003B;   { long name for April }
  {$EXTERNALSYM LOCALE_SMONTHNAME5}
  LOCALE_SMONTHNAME5              = $0000003C;   { long name for May }
  {$EXTERNALSYM LOCALE_SMONTHNAME6}
  LOCALE_SMONTHNAME6              = $0000003D;   { long name for June }
  {$EXTERNALSYM LOCALE_SMONTHNAME7}
  LOCALE_SMONTHNAME7              = $0000003E;   { long name for July }
  {$EXTERNALSYM LOCALE_SMONTHNAME8}
  LOCALE_SMONTHNAME8              = $0000003F;   { long name for August }
  {$EXTERNALSYM LOCALE_SMONTHNAME9}
  LOCALE_SMONTHNAME9              = $00000040;   { long name for September }
  {$EXTERNALSYM LOCALE_SMONTHNAME10}
  LOCALE_SMONTHNAME10             = $00000041;   { long name for October }
  {$EXTERNALSYM LOCALE_SMONTHNAME11}
  LOCALE_SMONTHNAME11             = $00000042;   { long name for November }
  {$EXTERNALSYM LOCALE_SMONTHNAME12}
  LOCALE_SMONTHNAME12             = $00000043;   { long name for December }
  {$EXTERNALSYM LOCALE_SMONTHNAME13}
  LOCALE_SMONTHNAME13             = $0000100E;   { long name for 13th month (if exists) }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME1}
  LOCALE_SABBREVMONTHNAME1        = $00000044;   { abbreviated name for January }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME2}
  LOCALE_SABBREVMONTHNAME2        = $00000045;   { abbreviated name for February }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME3}
  LOCALE_SABBREVMONTHNAME3        = $00000046;   { abbreviated name for March }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME4}
  LOCALE_SABBREVMONTHNAME4        = $00000047;   { abbreviated name for April }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME5}
  LOCALE_SABBREVMONTHNAME5        = $00000048;   { abbreviated name for May }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME6}
  LOCALE_SABBREVMONTHNAME6        = $00000049;   { abbreviated name for June }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME7}
  LOCALE_SABBREVMONTHNAME7        = $0000004A;   { abbreviated name for July }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME8}
  LOCALE_SABBREVMONTHNAME8        = $0000004B;   { abbreviated name for August }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME9}
  LOCALE_SABBREVMONTHNAME9        = $0000004C;   { abbreviated name for September }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME10}
  LOCALE_SABBREVMONTHNAME10       = $0000004D;   { abbreviated name for October }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME11}
  LOCALE_SABBREVMONTHNAME11       = $0000004E;   { abbreviated name for November }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME12}
  LOCALE_SABBREVMONTHNAME12       = $0000004F;   { abbreviated name for December }
  {$EXTERNALSYM LOCALE_SABBREVMONTHNAME13}
  LOCALE_SABBREVMONTHNAME13       = $0000100F;   { abbreviated name for 13th month (if exists) }

  {$EXTERNALSYM LOCALE_SPOSITIVESIGN}
  LOCALE_SPOSITIVESIGN            = $00000050;   { positive sign }
  {$EXTERNALSYM LOCALE_SNEGATIVESIGN}
  LOCALE_SNEGATIVESIGN            = $00000051;   { negative sign }
  {$EXTERNALSYM LOCALE_IPOSSIGNPOSN}
  LOCALE_IPOSSIGNPOSN             = $00000052;   { positive sign position }
  {$EXTERNALSYM LOCALE_INEGSIGNPOSN}
  LOCALE_INEGSIGNPOSN             = $00000053;   { negative sign position }
  {$EXTERNALSYM LOCALE_IPOSSYMPRECEDES}
  LOCALE_IPOSSYMPRECEDES          = $00000054;   { mon sym precedes pos amt }
  {$EXTERNALSYM LOCALE_IPOSSEPBYSPACE}
  LOCALE_IPOSSEPBYSPACE           = $00000055;   { mon sym sep by space from pos amt }
  {$EXTERNALSYM LOCALE_INEGSYMPRECEDES}
  LOCALE_INEGSYMPRECEDES          = $00000056;   { mon sym precedes neg amt }
  {$EXTERNALSYM LOCALE_INEGSEPBYSPACE}
  LOCALE_INEGSEPBYSPACE           = $00000057;   { mon sym sep by space from neg amt }

  {$EXTERNALSYM LOCALE_FONTSIGNATURE}
  LOCALE_FONTSIGNATURE            = $00000058;   { font signature }
  {$EXTERNALSYM LOCALE_SISO639LANGNAME}
  LOCALE_SISO639LANGNAME          = $00000059;   { ISO abbreviated language name }
  {$EXTERNALSYM LOCALE_SISO3166CTRYNAME}
  LOCALE_SISO3166CTRYNAME         = $0000005A;   { ISO abbreviated country name }

{ Time Flags for GetTimeFormatW. }

  {$EXTERNALSYM TIME_NOMINUTESORSECONDS}
  TIME_NOMINUTESORSECONDS = 1; { do not use minutes or seconds }
  {$EXTERNALSYM TIME_NOSECONDS}
  TIME_NOSECONDS = 2; { do not use seconds }
  {$EXTERNALSYM TIME_NOTIMEMARKER}
  TIME_NOTIMEMARKER = 4; { do not use time marker }
  {$EXTERNALSYM TIME_FORCE24HOURFORMAT}
  TIME_FORCE24HOURFORMAT = 8; { always use 24 hour format }

{ Date Flags for GetDateFormatW. }

  {$EXTERNALSYM DATE_SHORTDATE}
  DATE_SHORTDATE = 1; { use short date picture }
  {$EXTERNALSYM DATE_LONGDATE}
  DATE_LONGDATE = 2; { use long date picture }
  {$EXTERNALSYM DATE_USE_ALT_CALENDAR}
  DATE_USE_ALT_CALENDAR = 4;   { use alternate calendar (if any) }

{ Calendar Types.
  These types are used for the GetALTCalendarInfoW NLS API routine. }

  {$EXTERNALSYM CAL_ICALINTVALUE}
  CAL_ICALINTVALUE = 1;   { calendar type }
  {$EXTERNALSYM CAL_SCALNAME}
  CAL_SCALNAME = 2;   { native name of calendar }
  {$EXTERNALSYM CAL_IYEAROFFSETRANGE}
  CAL_IYEAROFFSETRANGE = 3;   { starting years of eras }
  {$EXTERNALSYM CAL_SERASTRING}
  CAL_SERASTRING = 4;   { era name for IYearOffsetRanges }
  {$EXTERNALSYM CAL_SSHORTDATE}
  CAL_SSHORTDATE = 5;   { short date format string }
  {$EXTERNALSYM CAL_SLONGDATE}
  CAL_SLONGDATE = 6;   { long date format string }
  {$EXTERNALSYM CAL_SDAYNAME1}
  CAL_SDAYNAME1 = 7;   { native name for Monday }
  {$EXTERNALSYM CAL_SDAYNAME2}
  CAL_SDAYNAME2 = 8;   { native name for Tuesday }
  {$EXTERNALSYM CAL_SDAYNAME3}
  CAL_SDAYNAME3 = 9;   { native name for Wednesday }
  {$EXTERNALSYM CAL_SDAYNAME4}
  CAL_SDAYNAME4 = 10;   { native name for Thursday }
  {$EXTERNALSYM CAL_SDAYNAME5}
  CAL_SDAYNAME5 = 11;   { native name for Friday }
  {$EXTERNALSYM CAL_SDAYNAME6}
  CAL_SDAYNAME6 = 12;   { native name for Saturday }
  {$EXTERNALSYM CAL_SDAYNAME7}
  CAL_SDAYNAME7 = 13;   { native name for Sunday }
  {$EXTERNALSYM CAL_SABBREVDAYNAME1}
  CAL_SABBREVDAYNAME1 = 14;   { abbreviated name for Monday }
  {$EXTERNALSYM CAL_SABBREVDAYNAME2}
  CAL_SABBREVDAYNAME2 = 15;   { abbreviated name for Tuesday }
  {$EXTERNALSYM CAL_SABBREVDAYNAME3}
  CAL_SABBREVDAYNAME3 = $10;   { abbreviated name for Wednesday }
  {$EXTERNALSYM CAL_SABBREVDAYNAME4}
  CAL_SABBREVDAYNAME4 = 17;   { abbreviated name for Thursday }
  {$EXTERNALSYM CAL_SABBREVDAYNAME5}
  CAL_SABBREVDAYNAME5 = 18;   { abbreviated name for Friday }
  {$EXTERNALSYM CAL_SABBREVDAYNAME6}
  CAL_SABBREVDAYNAME6 = 19;   { abbreviated name for Saturday }
  {$EXTERNALSYM CAL_SABBREVDAYNAME7}
  CAL_SABBREVDAYNAME7 = 20;   { abbreviated name for Sunday }
  {$EXTERNALSYM CAL_SMONTHNAME1}
  CAL_SMONTHNAME1 = 21;   { native name for January }
  {$EXTERNALSYM CAL_SMONTHNAME2}
  CAL_SMONTHNAME2 = 22;   { native name for February }
  {$EXTERNALSYM CAL_SMONTHNAME3}
  CAL_SMONTHNAME3 = 23;   { native name for March }
  {$EXTERNALSYM CAL_SMONTHNAME4}
  CAL_SMONTHNAME4 = 24;   { native name for April }
  {$EXTERNALSYM CAL_SMONTHNAME5}
  CAL_SMONTHNAME5 = 25;   { native name for May }
  {$EXTERNALSYM CAL_SMONTHNAME6}
  CAL_SMONTHNAME6 = 26;   { native name for June }
  {$EXTERNALSYM CAL_SMONTHNAME7}
  CAL_SMONTHNAME7 = 27;   { native name for July }
  {$EXTERNALSYM CAL_SMONTHNAME8}
  CAL_SMONTHNAME8 = 28;   { native name for August }
  {$EXTERNALSYM CAL_SMONTHNAME9}
  CAL_SMONTHNAME9 = 29;   { native name for September }
  {$EXTERNALSYM CAL_SMONTHNAME10}
  CAL_SMONTHNAME10 = 30;   { native name for October }
  {$EXTERNALSYM CAL_SMONTHNAME11}
  CAL_SMONTHNAME11 = 31;   { native name for November }
  {$EXTERNALSYM CAL_SMONTHNAME12}
  CAL_SMONTHNAME12 = $20;   { native name for December }
  {$EXTERNALSYM CAL_SMONTHNAME13}
  CAL_SMONTHNAME13 = 33;   { native name for 13th month (if any) }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME1}
  CAL_SABBREVMONTHNAME1 = 34;   { abbreviated name for January }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME2}
  CAL_SABBREVMONTHNAME2 = 35;   { abbreviated name for February }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME3}
  CAL_SABBREVMONTHNAME3 = 36;   { abbreviated name for March }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME4}
  CAL_SABBREVMONTHNAME4 = 37;   { abbreviated name for April }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME5}
  CAL_SABBREVMONTHNAME5 = 38;   { abbreviated name for May }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME6}
  CAL_SABBREVMONTHNAME6 = 39;   { abbreviated name for June }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME7}
  CAL_SABBREVMONTHNAME7 = 40;   { abbreviated name for July }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME8}
  CAL_SABBREVMONTHNAME8 = 41;   { abbreviated name for August }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME9}
  CAL_SABBREVMONTHNAME9 = 42;   { abbreviated name for September }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME10}
  CAL_SABBREVMONTHNAME10 = 43;   { abbreviated name for October }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME11}
  CAL_SABBREVMONTHNAME11 = 44;   { abbreviated name for November }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME12}
  CAL_SABBREVMONTHNAME12 = 45;   { abbreviated name for December }
  {$EXTERNALSYM CAL_SABBREVMONTHNAME13}
  CAL_SABBREVMONTHNAME13 = 46;   { abbreviated name for 13th month (if any) }

{ Calendar Enumeration Value. }

  {$EXTERNALSYM ENUM_ALL_CALENDARS}
  ENUM_ALL_CALENDARS = DWORD($FFFFFFFF);   { enumerate all calendars }

{ Calendar ID Values. }

  {$EXTERNALSYM CAL_GREGORIAN}
  CAL_GREGORIAN = 1;           { Gregorian (localized) calendar }
  {$EXTERNALSYM CAL_GREGORIAN_US}
  CAL_GREGORIAN_US = 2;        { Gregorian (U.S.) calendar }
  {$EXTERNALSYM CAL_JAPAN}
  CAL_JAPAN = 3;               { Japanese Emperor Era calendar }
  {$EXTERNALSYM CAL_TAIWAN}
  CAL_TAIWAN = 4;              { Republic of China Era calendar }
  {$EXTERNALSYM CAL_KOREA}
  CAL_KOREA = 5;               { Korean Tangun Era calendar }
  {$EXTERNALSYM CAL_HIJRI}
  CAL_HIJRI = 6;               { Hijri (Arabic Lunar) calendar }
  {$EXTERNALSYM CAL_THAI}
  CAL_THAI = 7;                { Thai calendar }
  {$EXTERNALSYM CAL_HEBREW}
  CAL_HEBREW = 8;              { Hebrew calendar }


type
  {$EXTERNALSYM LCTYPE}
  LCTYPE = DWORD;   { Locale type constant. }
  {$EXTERNALSYM CALTYPE}
  CALTYPE = DWORD;  { Calendar type constant. }
  {$EXTERNALSYM CALID}
  CALID = DWORD;    { Calendar ID. }

  PCPInfo = ^TCPInfo;
  {$EXTERNALSYM _cpinfo}
  _cpinfo = record
    MaxCharSize: UINT;                       { max length (bytes) of a char }
    DefaultChar: array[0..MAX_DEFAULTCHAR - 1] of Byte; { default character }
    LeadByte: array[0..MAX_LEADBYTES - 1] of Byte;      { lead byte ranges }
  end;
  TCPInfo = _cpinfo;
  {$EXTERNALSYM CPINFO}
  CPINFO = _cpinfo;

type
  PNumberFmtA = ^TNumberFmtA;
  PNumberFmtW = ^TNumberFmtW;
  PNumberFmt = PNumberFmtA;
  {$EXTERNALSYM _numberfmtA}
  _numberfmtA = packed record
    NumDigits: UINT;        { number of decimal digits }
    LeadingZero: UINT;      { if leading zero in decimal fields }
    Grouping: UINT;         { group size left of decimal }
    lpDecimalSep: PAnsiChar;   { ptr to decimal separator string }
    lpThousandSep: PAnsiChar;  { ptr to thousand separator string }
    NegativeOrder: UINT;    { negative number ordering }
  end;
  {$EXTERNALSYM _numberfmtW}
  _numberfmtW = packed record
    NumDigits: UINT;        { number of decimal digits }
    LeadingZero: UINT;      { if leading zero in decimal fields }
    Grouping: UINT;         { group size left of decimal }
    lpDecimalSep: PWideChar;   { ptr to decimal separator string }
    lpThousandSep: PWideChar;  { ptr to thousand separator string }
    NegativeOrder: UINT;    { negative number ordering }
  end;
  {$EXTERNALSYM _numberfmt}
  _numberfmt = _numberfmtA;
  TNumberFmtA = _numberfmtA;
  TNumberFmtW = _numberfmtW;
  TNumberFmt = TNumberFmtA;
  {$EXTERNALSYM NUMBERFMTA}
  NUMBERFMTA = _numberfmtA;
  {$EXTERNALSYM NUMBERFMTW}
  NUMBERFMTW = _numberfmtW;
  {$EXTERNALSYM NUMBERFMT}
  NUMBERFMT = NUMBERFMTA;

  PCurrencyFmtA = ^TCurrencyFmtA;
  PCurrencyFmtW = ^TCurrencyFmtW;
  PCurrencyFmt = PCurrencyFmtA;
  {$EXTERNALSYM _currencyfmtA}
  _currencyfmtA = packed record
    NumDigits: UINT;           { number of decimal digits }
    LeadingZero: UINT;         { if leading zero in decimal fields }
    Grouping: UINT;            { group size left of decimal }
    lpDecimalSep: PAnsiChar;      { ptr to decimal separator string }
    lpThousandSep: PAnsiChar;     { ptr to thousand separator string }
    NegativeOrder: UINT;       { negative currency ordering }
    PositiveOrder: UINT;       { positive currency ordering }
    lpCurrencySymbol: PAnsiChar;  { ptr to currency symbol string }
  end;
  {$EXTERNALSYM _currencyfmtW}
  _currencyfmtW = packed record
    NumDigits: UINT;           { number of decimal digits }
    LeadingZero: UINT;         { if leading zero in decimal fields }
    Grouping: UINT;            { group size left of decimal }
    lpDecimalSep: PWideChar;      { ptr to decimal separator string }
    lpThousandSep: PWideChar;     { ptr to thousand separator string }
    NegativeOrder: UINT;       { negative currency ordering }
    PositiveOrder: UINT;       { positive currency ordering }
    lpCurrencySymbol: PWideChar;  { ptr to currency symbol string }
  end;
  {$EXTERNALSYM _currencyfmt}
  _currencyfmt = _currencyfmtA;
  TCurrencyFmtA = _currencyfmtA;
  TCurrencyFmtW = _currencyfmtW;
  TCurrencyFmt = TCurrencyFmtA;
  {$EXTERNALSYM CURRENCYFMTA}
  CURRENCYFMTA = _currencyfmtA;
  {$EXTERNALSYM CURRENCYFMTW}
  CURRENCYFMTW = _currencyfmtW;
  {$EXTERNALSYM CURRENCYFMT}
  CURRENCYFMT = CURRENCYFMTA;

{ Enumeration function constants. }

  TFNLocaleEnumProc = TFarProc;
  TFNCodepageEnumProc = TFarProc;
  TFNDateFmtEnumProc = TFarProc;
  TFNTimeFmtEnumProc = TFarProc;
  TFNCalInfoEnumProc = TFarProc;


{ Code Page Dependent APIs. }

{$EXTERNALSYM IsValidCodePage}
function IsValidCodePage(CodePage: UINT): BOOL; stdcall;
{$EXTERNALSYM GetACP}
function GetACP: UINT; stdcall;
{$EXTERNALSYM GetOEMCP}
function GetOEMCP: UINT; stdcall;
{$EXTERNALSYM GetCPInfo}
function GetCPInfo(CodePage: UINT; var lpCPInfo: TCPInfo): BOOL; stdcall;
{$EXTERNALSYM IsDBCSLeadByte}
function IsDBCSLeadByte(TestChar: Byte): BOOL; stdcall;
{$EXTERNALSYM IsDBCSLeadByteEx}
function IsDBCSLeadByteEx(CodePage: UINT; TestChar: Byte): BOOL; stdcall;
{$EXTERNALSYM MultiByteToWideChar}
function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD;
  const lpMultiByteStr: LPCSTR; cchMultiByte: Integer;
  lpWideCharStr: LPWSTR; cchWideChar: Integer): Integer; stdcall;
{$EXTERNALSYM WideCharToMultiByte}
function WideCharToMultiByte(CodePage: UINT; dwFlags: DWORD;
  lpWideCharStr: LPWSTR; cchWideChar: Integer; lpMultiByteStr: LPSTR;
  cchMultiByte: Integer; lpDefaultChar: LPCSTR; lpUsedDefaultChar: PBOOL): Integer; stdcall;

{ Locale Dependent APIs. }

{$EXTERNALSYM CompareStringA}
function CompareStringA(Locale: LCID; dwCmpFlags: DWORD; lpString1: PAnsiChar;
  cchCount1: Integer; lpString2: PAnsiChar; cchCount2: Integer): Integer; stdcall;
{$EXTERNALSYM CompareStringW}
function CompareStringW(Locale: LCID; dwCmpFlags: DWORD; lpString1: PWideChar;
  cchCount1: Integer; lpString2: PWideChar; cchCount2: Integer): Integer; stdcall;
{$EXTERNALSYM CompareString}
function CompareString(Locale: LCID; dwCmpFlags: DWORD; lpString1: PChar;
  cchCount1: Integer; lpString2: PChar; cchCount2: Integer): Integer; stdcall;
{$EXTERNALSYM LCMapStringA}
function LCMapStringA(Locale: LCID; dwMapFlags: DWORD; lpSrcStr: PAnsiChar;
  cchSrc: Integer; lpDestStr: PAnsiChar; cchDest: Integer): Integer; stdcall;
{$EXTERNALSYM LCMapStringW}
function LCMapStringW(Locale: LCID; dwMapFlags: DWORD; lpSrcStr: PWideChar;
  cchSrc: Integer; lpDestStr: PWideChar; cchDest: Integer): Integer; stdcall;
{$EXTERNALSYM LCMapString}
function LCMapString(Locale: LCID; dwMapFlags: DWORD; lpSrcStr: PChar;
  cchSrc: Integer; lpDestStr: PChar; cchDest: Integer): Integer; stdcall;
{$EXTERNALSYM GetLocaleInfoA}
function GetLocaleInfoA(Locale: LCID; LCType: LCTYPE; lpLCData: PAnsiChar; cchData: Integer): Integer; stdcall;
{$EXTERNALSYM GetLocaleInfoW}
function GetLocaleInfoW(Locale: LCID; LCType: LCTYPE; lpLCData: PWideChar; cchData: Integer): Integer; stdcall;
{$EXTERNALSYM GetLocaleInfo}
function GetLocaleInfo(Locale: LCID; LCType: LCTYPE; lpLCData: PChar; cchData: Integer): Integer; stdcall;
{$EXTERNALSYM SetLocaleInfoA}
function SetLocaleInfoA(Locale: LCID; LCType: LCTYPE; lpLCData: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetLocaleInfoW}
function SetLocaleInfoW(Locale: LCID; LCType: LCTYPE; lpLCData: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetLocaleInfo}
function SetLocaleInfo(Locale: LCID; LCType: LCTYPE; lpLCData: PChar): BOOL; stdcall;
{$EXTERNALSYM GetTimeFormatA}
function GetTimeFormatA(Locale: LCID; dwFlags: DWORD; lpTime: PSystemTime;
  lpFormat: PAnsiChar; lpTimeStr: PAnsiChar; cchTime: Integer): Integer; stdcall;
{$EXTERNALSYM GetTimeFormatW}
function GetTimeFormatW(Locale: LCID; dwFlags: DWORD; lpTime: PSystemTime;
  lpFormat: PWideChar; lpTimeStr: PWideChar; cchTime: Integer): Integer; stdcall;
{$EXTERNALSYM GetTimeFormat}
function GetTimeFormat(Locale: LCID; dwFlags: DWORD; lpTime: PSystemTime;
  lpFormat: PChar; lpTimeStr: PChar; cchTime: Integer): Integer; stdcall;
{$EXTERNALSYM GetDateFormatA}
function GetDateFormatA(Locale: LCID; dwFlags: DWORD; lpDate: PSystemTime;
  lpFormat: PAnsiChar; lpDateStr: PAnsiChar; cchDate: Integer): Integer; stdcall;
{$EXTERNALSYM GetDateFormatW}
function GetDateFormatW(Locale: LCID; dwFlags: DWORD; lpDate: PSystemTime;
  lpFormat: PWideChar; lpDateStr: PWideChar; cchDate: Integer): Integer; stdcall;
{$EXTERNALSYM GetDateFormat}
function GetDateFormat(Locale: LCID; dwFlags: DWORD; lpDate: PSystemTime;
  lpFormat: PChar; lpDateStr: PChar; cchDate: Integer): Integer; stdcall;
{$EXTERNALSYM GetNumberFormatA}
function GetNumberFormatA(Locale: LCID; dwFlags: DWORD; lpValue: PAnsiChar;
  lpFormat: PNumberFmtA; lpNumberStr: PAnsiChar; cchNumber: Integer): Integer; stdcall;
{$EXTERNALSYM GetNumberFormatW}
function GetNumberFormatW(Locale: LCID; dwFlags: DWORD; lpValue: PWideChar;
  lpFormat: PNumberFmtW; lpNumberStr: PWideChar; cchNumber: Integer): Integer; stdcall;
{$EXTERNALSYM GetNumberFormat}
function GetNumberFormat(Locale: LCID; dwFlags: DWORD; lpValue: PChar;
  lpFormat: PNumberFmt; lpNumberStr: PChar; cchNumber: Integer): Integer; stdcall;
{$EXTERNALSYM GetCurrencyFormatA}
function GetCurrencyFormatA(Locale: LCID; dwFlags: DWORD; lpValue: PAnsiChar;
  lpFormat: PCurrencyFmtA; lpCurrencyStr: PAnsiChar; cchCurrency: Integer): Integer; stdcall;
{$EXTERNALSYM GetCurrencyFormatW}
function GetCurrencyFormatW(Locale: LCID; dwFlags: DWORD; lpValue: PWideChar;
  lpFormat: PCurrencyFmtW; lpCurrencyStr: PWideChar; cchCurrency: Integer): Integer; stdcall;
{$EXTERNALSYM GetCurrencyFormat}
function GetCurrencyFormat(Locale: LCID; dwFlags: DWORD; lpValue: PChar;
  lpFormat: PCurrencyFmt; lpCurrencyStr: PChar; cchCurrency: Integer): Integer; stdcall;
{$EXTERNALSYM EnumCalendarInfoA}
function EnumCalendarInfoA(lpCalInfoEnumProc: TFNCalInfoEnumProc; Locale: LCID;
  Calendar: CALID; CalType: CALTYPE): BOOL; stdcall;
{$EXTERNALSYM EnumCalendarInfoW}
function EnumCalendarInfoW(lpCalInfoEnumProc: TFNCalInfoEnumProc; Locale: LCID;
  Calendar: CALID; CalType: CALTYPE): BOOL; stdcall;
{$EXTERNALSYM EnumCalendarInfo}
function EnumCalendarInfo(lpCalInfoEnumProc: TFNCalInfoEnumProc; Locale: LCID;
  Calendar: CALID; CalType: CALTYPE): BOOL; stdcall;
{$EXTERNALSYM EnumTimeFormatsA}
function EnumTimeFormatsA(lpTimeFmtEnumProc: TFNTimeFmtEnumProc;
  Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumTimeFormatsW}
function EnumTimeFormatsW(lpTimeFmtEnumProc: TFNTimeFmtEnumProc;
  Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumTimeFormats}
function EnumTimeFormats(lpTimeFmtEnumProc: TFNTimeFmtEnumProc;
  Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumDateFormatsA}
function EnumDateFormatsA(lpDateFmtEnumProc: TFNDateFmtEnumProc;
  Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumDateFormatsW}
function EnumDateFormatsW(lpDateFmtEnumProc: TFNDateFmtEnumProc;
  Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumDateFormats}
function EnumDateFormats(lpDateFmtEnumProc: TFNDateFmtEnumProc;
  Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM IsValidLocale}
function IsValidLocale(Locale: LCID; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM ConvertDefaultLocale}
function ConvertDefaultLocale(Locale: LCID): LCID; stdcall;
{$EXTERNALSYM GetThreadLocale}
function GetThreadLocale: LCID; stdcall;
{$EXTERNALSYM SetThreadLocale}
function SetThreadLocale(Locale: LCID): BOOL; stdcall;
{$EXTERNALSYM GetSystemDefaultLangID}
function GetSystemDefaultLangID: LANGID; stdcall;
{$EXTERNALSYM GetUserDefaultLangID}
function GetUserDefaultLangID: LANGID; stdcall;
{$EXTERNALSYM GetSystemDefaultLCID}
function GetSystemDefaultLCID: LCID; stdcall;
{$EXTERNALSYM GetUserDefaultLCID}
function GetUserDefaultLCID: LCID; stdcall;

{ Locale Independent APIs. }

{$EXTERNALSYM GetStringTypeExA}
function GetStringTypeExA(Locale: LCID; dwInfoType: DWORD;
  lpSrcStr: PAnsiChar; cchSrc: Integer; var lpCharType): BOOL; stdcall;
{$EXTERNALSYM GetStringTypeExW}
function GetStringTypeExW(Locale: LCID; dwInfoType: DWORD;
  lpSrcStr: PWideChar; cchSrc: Integer; var lpCharType): BOOL; stdcall;
{$EXTERNALSYM GetStringTypeEx}
function GetStringTypeEx(Locale: LCID; dwInfoType: DWORD;
  lpSrcStr: PChar; cchSrc: Integer; var lpCharType): BOOL; stdcall;

{  NOTE: The parameters for GetStringTypeA and GetStringTypeW are
         NOT the same.  The W version was shipped in NT 3.1.  The
         A version was then shipped in 16-bit OLE with the wrong
         parameters (ported from Win95).  To be compatible, we
         must break the relationship between the A and W versions
         of GetStringType.  There will be NO function call for the
         generic GetStringType.

         GetStringTypeEx (above) should be used instead. }

{$EXTERNALSYM GetStringTypeA}
function GetStringTypeA(Locale: LCID; dwInfoType: DWORD; const lpSrcStr: LPCSTR; cchSrc: BOOL; var lpCharType: Word): BOOL;
{$EXTERNALSYM GetStringTypeW}
function GetStringTypeW(dwInfoType: DWORD; const lpSrcStr: WCHAR; cchSrc: BOOL; var lpCharType: Word): BOOL;

{$EXTERNALSYM FoldStringA}
function FoldStringA(dwMapFlags: DWORD; lpSrcStr: PAnsiChar; cchSrc: Integer;
  lpDestStr: PAnsiChar; cchDest: Integer): Integer; stdcall;
{$EXTERNALSYM FoldStringW}
function FoldStringW(dwMapFlags: DWORD; lpSrcStr: PWideChar; cchSrc: Integer;
  lpDestStr: PWideChar; cchDest: Integer): Integer; stdcall;
{$EXTERNALSYM FoldString}
function FoldString(dwMapFlags: DWORD; lpSrcStr: PChar; cchSrc: Integer;
  lpDestStr: PChar; cchDest: Integer): Integer; stdcall;
{$EXTERNALSYM EnumSystemLocalesA}
function EnumSystemLocalesA(lpLocaleEnumProc: TFNLocaleEnumProc; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumSystemLocalesW}
function EnumSystemLocalesW(lpLocaleEnumProc: TFNLocaleEnumProc; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumSystemLocales}
function EnumSystemLocales(lpLocaleEnumProc: TFNLocaleEnumProc; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumSystemCodePagesA}
function EnumSystemCodePagesA(lpCodePageEnumProc: TFNCodepageEnumProc; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumSystemCodePagesW}
function EnumSystemCodePagesW(lpCodePageEnumProc: TFNCodepageEnumProc; dwFlags: DWORD): BOOL; stdcall;
{$EXTERNALSYM EnumSystemCodePages}
function EnumSystemCodePages(lpCodePageEnumProc: TFNCodepageEnumProc; dwFlags: DWORD): BOOL; stdcall;


{ Translated from WINCON.H }

{ This module contains the public data structures, data types,
    and procedures exported by the NT console subsystem. }

type
  PCoord = ^TCoord;
  {$EXTERNALSYM _COORD}
  _COORD = packed record
    X: SHORT;
    Y: SHORT;
  end;
  TCoord = _COORD;
  {$EXTERNALSYM COORD}
  COORD = _COORD;

  PSmallRect = ^TSmallRect;
  {$EXTERNALSYM _SMALL_RECT}
  _SMALL_RECT = packed record
    Left: SHORT;
    Top: SHORT;
    Right: SHORT;
    Bottom: SHORT;
  end;
  TSmallRect = _SMALL_RECT;
  {$EXTERNALSYM SMALL_RECT}
  SMALL_RECT = _SMALL_RECT;

  PKeyEventRecord = ^TKeyEventRecord;
  {$EXTERNALSYM _KEY_EVENT_RECORD}
  _KEY_EVENT_RECORD = packed record
    bKeyDown: BOOL;
    wRepeatCount: Word;
    wVirtualKeyCode: Word;
    wVirtualScanCode: Word;
    case Integer of
      0: (
        UnicodeChar: WCHAR;
        dwControlKeyState: DWORD);
      1: (
        AsciiChar: CHAR);
  end;
  TKeyEventRecord = _KEY_EVENT_RECORD;
  {$EXTERNALSYM KEY_EVENT_RECORD}
  KEY_EVENT_RECORD = _KEY_EVENT_RECORD;

const
{ ControlKeyState flags }

  {$EXTERNALSYM RIGHT_ALT_PRESSED}
  RIGHT_ALT_PRESSED = 1;     { the right alt key is pressed. }
  {$EXTERNALSYM LEFT_ALT_PRESSED}
  LEFT_ALT_PRESSED = 2;     { the left alt key is pressed. }
  {$EXTERNALSYM RIGHT_CTRL_PRESSED}
  RIGHT_CTRL_PRESSED = 4;     { the right ctrl key is pressed. }
  {$EXTERNALSYM LEFT_CTRL_PRESSED}
  LEFT_CTRL_PRESSED = 8;     { the left ctrl key is pressed. }
  {$EXTERNALSYM SHIFT_PRESSED}
  SHIFT_PRESSED = $10;     { the shift key is pressed. }
  {$EXTERNALSYM NUMLOCK_ON}
  NUMLOCK_ON = $20;     { the numlock light is on. }
  {$EXTERNALSYM SCROLLLOCK_ON}
  SCROLLLOCK_ON = $40;     { the scrolllock light is on. }
  {$EXTERNALSYM CAPSLOCK_ON}
  CAPSLOCK_ON = $80;     { the capslock light is on. }
  {$EXTERNALSYM ENHANCED_KEY}
  ENHANCED_KEY = $100;     { the key is enhanced. }

type
  PMouseEventRecord = ^TMouseEventRecord;
  {$EXTERNALSYM _MOUSE_EVENT_RECORD}
  _MOUSE_EVENT_RECORD = packed record
    dwMousePosition: TCoord;
    dwButtonState: DWORD;
    dwControlKeyState: DWORD;
    dwEventFlags: DWORD;
  end;
  TMouseEventRecord = _MOUSE_EVENT_RECORD;
  {$EXTERNALSYM MOUSE_EVENT_RECORD}
  MOUSE_EVENT_RECORD = _MOUSE_EVENT_RECORD;

const
{ ButtonState flags }

  {$EXTERNALSYM FROM_LEFT_1ST_BUTTON_PRESSED}
  FROM_LEFT_1ST_BUTTON_PRESSED = 1;
  {$EXTERNALSYM RIGHTMOST_BUTTON_PRESSED}
  RIGHTMOST_BUTTON_PRESSED = 2;
  {$EXTERNALSYM FROM_LEFT_2ND_BUTTON_PRESSED}
  FROM_LEFT_2ND_BUTTON_PRESSED = 4;
  {$EXTERNALSYM FROM_LEFT_3RD_BUTTON_PRESSED}
  FROM_LEFT_3RD_BUTTON_PRESSED = 8;
  {$EXTERNALSYM FROM_LEFT_4TH_BUTTON_PRESSED}
  FROM_LEFT_4TH_BUTTON_PRESSED = $10;

{ EventFlags }

  {$EXTERNALSYM MOUSE_MOVED}
  MOUSE_MOVED = 1;
  {$EXTERNALSYM DOUBLE_CLICK}
  DOUBLE_CLICK = 2;

type
  PWindowBufferSizeRecord = ^TWindowBufferSizeRecord;
  {$EXTERNALSYM _WINDOW_BUFFER_SIZE_RECORD}
  _WINDOW_BUFFER_SIZE_RECORD = packed record
    dwSize: TCoord;
  end;
  TWindowBufferSizeRecord = _WINDOW_BUFFER_SIZE_RECORD;
  {$EXTERNALSYM WINDOW_BUFFER_SIZE_RECORD}
  WINDOW_BUFFER_SIZE_RECORD = _WINDOW_BUFFER_SIZE_RECORD;

  PMenuEventRecord = ^TMenuEventRecord;
  {$EXTERNALSYM _MENU_EVENT_RECORD}
  _MENU_EVENT_RECORD = packed record
    dwCommandId: UINT;
  end;
  TMenuEventRecord = _MENU_EVENT_RECORD;
  {$EXTERNALSYM MENU_EVENT_RECORD}
  MENU_EVENT_RECORD = _MENU_EVENT_RECORD;

  PFocusEventRecord = ^TFocusEventRecord;
  {$EXTERNALSYM _FOCUS_EVENT_RECORD}
  _FOCUS_EVENT_RECORD = packed record
    bSetFocus: BOOL;
  end;
  TFocusEventRecord = _FOCUS_EVENT_RECORD;
  {$EXTERNALSYM FOCUS_EVENT_RECORD}
  FOCUS_EVENT_RECORD = _FOCUS_EVENT_RECORD;

  PInputRecord = ^TInputRecord;
  {$EXTERNALSYM _INPUT_RECORD}
  _INPUT_RECORD = record
    EventType: Word;
    Event: Record case Integer of
      0: (KeyEvent: TKeyEventRecord);
      1: (MouseEvent: TMouseEventRecord);
      2: (WindowBufferSizeEvent: TWindowBufferSizeRecord);
      3: (MenuEvent: TMenuEventRecord);
      4: (FocusEvent: TFocusEventRecord);
    end;
  end;
  TInputRecord = _INPUT_RECORD;
  {$EXTERNALSYM INPUT_RECORD}
  INPUT_RECORD = _INPUT_RECORD;


const
{  EventType flags: }

  {$EXTERNALSYM KEY_EVENT}
  KEY_EVENT = 1;       { Event contains key event record}
  _MOUSE_EVENT = 2;  { Renamed }   { Event contains mouse event record }
  {$EXTERNALSYM WINDOW_BUFFER_SIZE_EVENT}
  WINDOW_BUFFER_SIZE_EVENT = 4;  { Event contains window change event record }
  {$EXTERNALSYM MENU_EVENT}
  MENU_EVENT = 8;     { Event contains menu event record }
  {$EXTERNALSYM FOCUS_EVENT}
  FOCUS_EVENT = $10;  { event contains focus change }

type
  PCharInfo = ^TCharInfo;
  {$EXTERNALSYM _CHAR_INFO}
  _CHAR_INFO = record
    case Integer of
      0: (
        UnicodeChar: WCHAR;
        Attributes: Word);
      1: (
        AsciiChar: CHAR);
  end;
  TCharInfo = _CHAR_INFO;
  {$EXTERNALSYM CHAR_INFO}
  CHAR_INFO = _CHAR_INFO;

const
{ Attributes flags:}

  {$EXTERNALSYM FOREGROUND_BLUE}
  FOREGROUND_BLUE = 1;    { text color contains blue.}
  {$EXTERNALSYM FOREGROUND_GREEN}
  FOREGROUND_GREEN = 2;     { text color contains green. }
  {$EXTERNALSYM FOREGROUND_RED}
  FOREGROUND_RED = 4;     { text color contains red. }
  {$EXTERNALSYM FOREGROUND_INTENSITY}
  FOREGROUND_INTENSITY = 8;     { text color is intensified. }
  {$EXTERNALSYM BACKGROUND_BLUE}
  BACKGROUND_BLUE = $10;     { background color contains blue. }
  {$EXTERNALSYM BACKGROUND_GREEN}
  BACKGROUND_GREEN = $20;     { background color contains green. }
  {$EXTERNALSYM BACKGROUND_RED}
  BACKGROUND_RED = $40;     { background color contains red. }
  {$EXTERNALSYM BACKGROUND_INTENSITY}
  BACKGROUND_INTENSITY = $80;     { background color is intensified. }

type
  PConsoleScreenBufferInfo = ^TConsoleScreenBufferInfo;
  {$EXTERNALSYM _CONSOLE_SCREEN_BUFFER_INFO}
  _CONSOLE_SCREEN_BUFFER_INFO = packed record
    dwSize: TCoord;
    dwCursorPosition: TCoord;
    wAttributes: Word;
    srWindow: TSmallRect;
    dwMaximumWindowSize: TCoord;
  end;
  TConsoleScreenBufferInfo = _CONSOLE_SCREEN_BUFFER_INFO;
  {$EXTERNALSYM CONSOLE_SCREEN_BUFFER_INFO}
  CONSOLE_SCREEN_BUFFER_INFO = _CONSOLE_SCREEN_BUFFER_INFO;

  PConsoleCursorInfo = ^TConsoleCursorInfo;
  {$EXTERNALSYM _CONSOLE_CURSOR_INFO}
  _CONSOLE_CURSOR_INFO = packed record
    dwSize: DWORD;
    bVisible: BOOL;
  end;
  TConsoleCursorInfo = _CONSOLE_CURSOR_INFO;
  {$EXTERNALSYM CONSOLE_CURSOR_INFO}
  CONSOLE_CURSOR_INFO = _CONSOLE_CURSOR_INFO;

  TFNHandlerRoutine = TFarProc;

const
  {$EXTERNALSYM CTRL_C_EVENT}
  CTRL_C_EVENT = 0;
  {$EXTERNALSYM CTRL_BREAK_EVENT}
  CTRL_BREAK_EVENT = 1;
  {$EXTERNALSYM CTRL_CLOSE_EVENT}
  CTRL_CLOSE_EVENT = 2;
  { 3 is reserved! }
  { 4 is reserved! }

  {$EXTERNALSYM CTRL_LOGOFF_EVENT}
  CTRL_LOGOFF_EVENT = 5;
  {$EXTERNALSYM CTRL_SHUTDOWN_EVENT}
  CTRL_SHUTDOWN_EVENT = 6;
  {$EXTERNALSYM ENABLE_PROCESSED_INPUT}
  ENABLE_PROCESSED_INPUT = 1;     {  Input Mode flags: }
  {$EXTERNALSYM ENABLE_LINE_INPUT}
  ENABLE_LINE_INPUT = 2;
  {$EXTERNALSYM ENABLE_ECHO_INPUT}
  ENABLE_ECHO_INPUT = 4;
  {$EXTERNALSYM ENABLE_WINDOW_INPUT}
  ENABLE_WINDOW_INPUT = 8;
  {$EXTERNALSYM ENABLE_MOUSE_INPUT}
  ENABLE_MOUSE_INPUT = $10;
  {$EXTERNALSYM ENABLE_PROCESSED_OUTPUT}
  ENABLE_PROCESSED_OUTPUT = 1;     { Output Mode flags: }
  {$EXTERNALSYM ENABLE_WRAP_AT_EOL_OUTPUT}
  ENABLE_WRAP_AT_EOL_OUTPUT = 2;

{ direct API definitions. }
{$EXTERNALSYM PeekConsoleInputA}
function PeekConsoleInputA(hConsoleInput: THandle; var lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM PeekConsoleInputW}
function PeekConsoleInputW(hConsoleInput: THandle; var lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM PeekConsoleInput}
function PeekConsoleInput(hConsoleInput: THandle; var lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleInputA}
function ReadConsoleInputA(hConsoleInput: THandle; var lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleInputW}
function ReadConsoleInputW(hConsoleInput: THandle; var lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleInput}
function ReadConsoleInput(hConsoleInput: THandle; var lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleInputA}
function WriteConsoleInputA(hConsoleInput: THandle; const lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleInputW}
function WriteConsoleInputW(hConsoleInput: THandle; const lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleInput}
function WriteConsoleInput(hConsoleInput: THandle; const lpBuffer: TInputRecord;
  nLength: DWORD; var lpNumberOfEventsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleOutputA}
function ReadConsoleOutputA(hConsoleOutput: THandle; lpBuffer: Pointer;
  dwBufferSize, dwBufferCoord: TCoord; var lpReadRegion: TSmallRect): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleOutputW}
function ReadConsoleOutputW(hConsoleOutput: THandle; lpBuffer: Pointer;
  dwBufferSize, dwBufferCoord: TCoord; var lpReadRegion: TSmallRect): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleOutput}
function ReadConsoleOutput(hConsoleOutput: THandle; lpBuffer: Pointer;
  dwBufferSize, dwBufferCoord: TCoord; var lpReadRegion: TSmallRect): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleOutputA}
function WriteConsoleOutputA(hConsoleOutput: THandle; lpBuffer: Pointer;
  dwBufferSize, dwBufferCoord: TCoord; var lpWriteRegion: TSmallRect): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleOutputW}
function WriteConsoleOutputW(hConsoleOutput: THandle; lpBuffer: Pointer;
  dwBufferSize, dwBufferCoord: TCoord; var lpWriteRegion: TSmallRect): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleOutput}
function WriteConsoleOutput(hConsoleOutput: THandle; lpBuffer: Pointer;
  dwBufferSize, dwBufferCoord: TCoord; var lpWriteRegion: TSmallRect): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleOutputCharacterA}
function ReadConsoleOutputCharacterA(hConsoleOutput: THandle; lpCharacter: PAnsiChar;
  nLength: DWORD; dwReadCoord: TCoord; var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleOutputCharacterW}
function ReadConsoleOutputCharacterW(hConsoleOutput: THandle; lpCharacter: PAnsiChar;
  nLength: DWORD; dwReadCoord: TCoord; var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleOutputCharacter}
function ReadConsoleOutputCharacter(hConsoleOutput: THandle; lpCharacter: PAnsiChar;
  nLength: DWORD; dwReadCoord: TCoord; var lpNumberOfCharsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleOutputAttribute}
function ReadConsoleOutputAttribute(hConsoleOutput: THandle; lpAttribute: Pointer;
  nLength: DWORD; dwReadCoord: TCoord; var lpNumberOfAttrsRead: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleOutputCharacterA}
function WriteConsoleOutputCharacterA(hConsoleOutput: THandle;lpCharacter: PAnsiChar;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleOutputCharacterW}
function WriteConsoleOutputCharacterW(hConsoleOutput: THandle;lpCharacter: PWideChar;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleOutputCharacter}
function WriteConsoleOutputCharacter(hConsoleOutput: THandle;lpCharacter: PChar;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleOutputAttribute}
function WriteConsoleOutputAttribute(hConsoleOutput: THandle; lpAttribute: Pointer;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfAttrsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM FillConsoleOutputCharacterA}
function FillConsoleOutputCharacterA(hConsoleOutput: THandle; cCharacter: AnsiChar;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM FillConsoleOutputCharacterW}
function FillConsoleOutputCharacterW(hConsoleOutput: THandle; cCharacter: WideChar;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM FillConsoleOutputCharacter}
function FillConsoleOutputCharacter(hConsoleOutput: THandle; cCharacter: Char;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfCharsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM FillConsoleOutputAttribute}
function FillConsoleOutputAttribute(hConsoleOutput: THandle; wAttribute: Word;
  nLength: DWORD; dwWriteCoord: TCoord; var lpNumberOfAttrsWritten: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetConsoleMode}
function GetConsoleMode(hConsoleHandle: THandle; var lpMode: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetNumberOfConsoleInputEvents}
function GetNumberOfConsoleInputEvents(hConsoleInput: THandle;
  var lpNumberOfEvents: DWORD): BOOL; stdcall;
{$EXTERNALSYM GetConsoleScreenBufferInfo}
function GetConsoleScreenBufferInfo(hConsoleOutput: THandle;
  var lpConsoleScreenBufferInfo: TConsoleScreenBufferInfo): BOOL; stdcall;
{$EXTERNALSYM GetLargestConsoleWindowSize}
function GetLargestConsoleWindowSize(hConsoleOutput: THandle): TCoord; stdcall;
{$EXTERNALSYM GetConsoleCursorInfo}
function GetConsoleCursorInfo(hConsoleOutput: THandle;
  var lpConsoleCursorInfo: TConsoleCursorInfo): BOOL; stdcall;
{$EXTERNALSYM GetNumberOfConsoleMouseButtons}
function GetNumberOfConsoleMouseButtons(var lpNumberOfMouseButtons: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetConsoleMode}
function SetConsoleMode(hConsoleHandle: THandle; dwMode: DWORD): BOOL; stdcall;
{$EXTERNALSYM SetConsoleActiveScreenBuffer}
function SetConsoleActiveScreenBuffer(hConsoleOutput: THandle): BOOL; stdcall;
{$EXTERNALSYM FlushConsoleInputBuffer}
function FlushConsoleInputBuffer(hConsoleInput: THandle): BOOL; stdcall;
{$EXTERNALSYM SetConsoleScreenBufferSize}
function SetConsoleScreenBufferSize(hConsoleOutput: THandle; dwSize: TCoord): BOOL; stdcall;
{$EXTERNALSYM SetConsoleCursorPosition}
function SetConsoleCursorPosition(hConsoleOutput: THandle; dwCursorPosition: TCoord): BOOL; stdcall;
{$EXTERNALSYM SetConsoleCursorInfo}
function SetConsoleCursorInfo(hConsoleOutput: THandle;
  const lpConsoleCursorInfo: TConsoleCursorInfo): BOOL; stdcall;
{$EXTERNALSYM ScrollConsoleScreenBufferA}
function ScrollConsoleScreenBufferA(hConsoleOutput: THandle;
  const lpScrollRectangle: TSmallRect; lpClipRectangle: PSmallRect;
  dwDestinationOrigin: TCoord; var lpFill: TCharInfo): BOOL; stdcall;
{$EXTERNALSYM ScrollConsoleScreenBufferW}
function ScrollConsoleScreenBufferW(hConsoleOutput: THandle;
  const lpScrollRectangle: TSmallRect; lpClipRectangle: PSmallRect;
  dwDestinationOrigin: TCoord; var lpFill: TCharInfo): BOOL; stdcall;
{$EXTERNALSYM ScrollConsoleScreenBuffer}
function ScrollConsoleScreenBuffer(hConsoleOutput: THandle;
  const lpScrollRectangle: TSmallRect; lpClipRectangle: PSmallRect;
  dwDestinationOrigin: TCoord; var lpFill: TCharInfo): BOOL; stdcall;
{$EXTERNALSYM SetConsoleWindowInfo}
function SetConsoleWindowInfo(hConsoleOutput: THandle; bAbsolute: BOOL;
  const lpConsoleWindow: TSmallRect): BOOL; stdcall;
{$EXTERNALSYM SetConsoleTextAttribute}
function SetConsoleTextAttribute(hConsoleOutput: THandle; wAttributes: Word): BOOL; stdcall;
{$EXTERNALSYM SetConsoleCtrlHandler}
function SetConsoleCtrlHandler(HandlerRoutine: TFNHandlerRoutine; Add: BOOL): BOOL; stdcall;
{$EXTERNALSYM GenerateConsoleCtrlEvent}
function GenerateConsoleCtrlEvent(dwCtrlEvent: DWORD; dwProcessGroupId: DWORD): BOOL; stdcall;
{$EXTERNALSYM AllocConsole}
function AllocConsole: BOOL; stdcall;
{$EXTERNALSYM FreeConsole}
function FreeConsole: BOOL; stdcall;
{$EXTERNALSYM GetConsoleTitleA}
function GetConsoleTitleA(lpConsoleTitle: PAnsiChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetConsoleTitleW}
function GetConsoleTitleW(lpConsoleTitle: PWideChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetConsoleTitle}
function GetConsoleTitle(lpConsoleTitle: PChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM SetConsoleTitleA}
function SetConsoleTitleA(lpConsoleTitle: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM SetConsoleTitleW}
function SetConsoleTitleW(lpConsoleTitle: PWideChar): BOOL; stdcall;
{$EXTERNALSYM SetConsoleTitle}
function SetConsoleTitle(lpConsoleTitle: PChar): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleA}
function ReadConsoleA(hConsoleInput: THandle; lpBuffer: Pointer;
  nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD; lpReserved: Pointer): BOOL; stdcall;
{$EXTERNALSYM ReadConsoleW}
function ReadConsoleW(hConsoleInput: THandle; lpBuffer: Pointer;
  nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD; lpReserved: Pointer): BOOL; stdcall;
{$EXTERNALSYM ReadConsole}
function ReadConsole(hConsoleInput: THandle; lpBuffer: Pointer;
  nNumberOfCharsToRead: DWORD; var lpNumberOfCharsRead: DWORD; lpReserved: Pointer): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleA}
function WriteConsoleA(hConsoleOutput: THandle; const lpBuffer: Pointer;
  nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD; lpReserved: Pointer): BOOL; stdcall;
{$EXTERNALSYM WriteConsoleW}
function WriteConsoleW(hConsoleOutput: THandle; const lpBuffer: Pointer;
  nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD; lpReserved: Pointer): BOOL; stdcall;
{$EXTERNALSYM WriteConsole}
function WriteConsole(hConsoleOutput: THandle; const lpBuffer: Pointer;
  nNumberOfCharsToWrite: DWORD; var lpNumberOfCharsWritten: DWORD; lpReserved: Pointer): BOOL; stdcall;

const
  {$EXTERNALSYM CONSOLE_TEXTMODE_BUFFER}
  CONSOLE_TEXTMODE_BUFFER = 1;

{$EXTERNALSYM CreateConsoleScreenBuffer}
function CreateConsoleScreenBuffer(dwDesiredAccess, dwShareMode: DWORD;
  lpSecurityAttributes: PSecurityAttributes; dwFlags: DWORD; lpScreenBufferData: Pointer): THandle; stdcall;
{$EXTERNALSYM GetConsoleCP}
function GetConsoleCP: UINT; stdcall;
{$EXTERNALSYM SetConsoleCP}
function SetConsoleCP(wCodePageID: UINT): BOOL; stdcall;
{$EXTERNALSYM GetConsoleOutputCP}
function GetConsoleOutputCP: UINT; stdcall;
{$EXTERNALSYM SetConsoleOutputCP}
function SetConsoleOutputCP(wCodePageID: UINT): BOOL; stdcall;


{ Translated from WINVER.H }

{ Version management functions, types, and definitions
  Include file for VER.DLL.  This library is designed to allow version
  stamping of Windows executable files and of special .VER files for
  DOS executable files. }

const
{ Symbols }

  {$EXTERNALSYM VS_FILE_INFO}
  VS_FILE_INFO = RT_VERSION;
  {$EXTERNALSYM VS_VERSION_INFO}
  VS_VERSION_INFO = 1;
  {$EXTERNALSYM VS_USER_DEFINED}
  VS_USER_DEFINED = 100;

{ VS_VERSION.dwFileFlags }

  {$EXTERNALSYM VS_FFI_SIGNATURE}
  VS_FFI_SIGNATURE = DWORD($FEEF04BD);
  {$EXTERNALSYM VS_FFI_STRUCVERSION}
  VS_FFI_STRUCVERSION = $10000;
  {$EXTERNALSYM VS_FFI_FILEFLAGSMASK}
  VS_FFI_FILEFLAGSMASK = 63;

{ VS_VERSION.dwFileFlags }

  {$EXTERNALSYM VS_FF_DEBUG}
  VS_FF_DEBUG = 1;
  {$EXTERNALSYM VS_FF_PRERELEASE}
  VS_FF_PRERELEASE = 2;
  {$EXTERNALSYM VS_FF_PATCHED}
  VS_FF_PATCHED = 4;
  {$EXTERNALSYM VS_FF_PRIVATEBUILD}
  VS_FF_PRIVATEBUILD = 8;
  {$EXTERNALSYM VS_FF_INFOINFERRED}
  VS_FF_INFOINFERRED = $10;
  {$EXTERNALSYM VS_FF_SPECIALBUILD}
  VS_FF_SPECIALBUILD = $20;

{ VS_VERSION.dwFileOS }

  {$EXTERNALSYM VOS_UNKNOWN}
  VOS_UNKNOWN = 0;
  {$EXTERNALSYM VOS_DOS}
  VOS_DOS = $10000;
  {$EXTERNALSYM VOS_OS216}
  VOS_OS216 = $20000;
  {$EXTERNALSYM VOS_OS232}
  VOS_OS232 = $30000;
  {$EXTERNALSYM VOS_NT}
  VOS_NT = $40000;

  {$EXTERNALSYM VOS__BASE}
  VOS__BASE = 0;
  {$EXTERNALSYM VOS__WINDOWS16}
  VOS__WINDOWS16 = 1;
  {$EXTERNALSYM VOS__PM16}
  VOS__PM16 = 2;
  {$EXTERNALSYM VOS__PM32}
  VOS__PM32 = 3;
  {$EXTERNALSYM VOS__WINDOWS32}
  VOS__WINDOWS32 = 4;

  {$EXTERNALSYM VOS_DOS_WINDOWS16}
  VOS_DOS_WINDOWS16 = $10001;
  {$EXTERNALSYM VOS_DOS_WINDOWS32}
  VOS_DOS_WINDOWS32 = $10004;
  {$EXTERNALSYM VOS_OS216_PM16}
  VOS_OS216_PM16 = $20002;
  {$EXTERNALSYM VOS_OS232_PM32}
  VOS_OS232_PM32 = $30003;
  {$EXTERNALSYM VOS_NT_WINDOWS32}
  VOS_NT_WINDOWS32 = $40004;

{ VS_VERSION.dwFileType }

  {$EXTERNALSYM VFT_UNKNOWN}
  VFT_UNKNOWN = 0;
  {$EXTERNALSYM VFT_APP}
  VFT_APP = 1;
  {$EXTERNALSYM VFT_DLL}
  VFT_DLL = 2;
  {$EXTERNALSYM VFT_DRV}
  VFT_DRV = 3;
  {$EXTERNALSYM VFT_FONT}
  VFT_FONT = 4;
  {$EXTERNALSYM VFT_VXD}
  VFT_VXD = 5;
  {$EXTERNALSYM VFT_STATIC_LIB}
  VFT_STATIC_LIB = 7;

{ VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV }

  {$EXTERNALSYM VFT2_UNKNOWN}
  VFT2_UNKNOWN = 0;
  {$EXTERNALSYM VFT2_DRV_PRINTER}
  VFT2_DRV_PRINTER = 1;
  {$EXTERNALSYM VFT2_DRV_KEYBOARD}
  VFT2_DRV_KEYBOARD = 2;
  {$EXTERNALSYM VFT2_DRV_LANGUAGE}
  VFT2_DRV_LANGUAGE = 3;
  {$EXTERNALSYM VFT2_DRV_DISPLAY}
  VFT2_DRV_DISPLAY = 4;
  {$EXTERNALSYM VFT2_DRV_MOUSE}
  VFT2_DRV_MOUSE = 5;
  {$EXTERNALSYM VFT2_DRV_NETWORK}
  VFT2_DRV_NETWORK = 6;
  {$EXTERNALSYM VFT2_DRV_SYSTEM}
  VFT2_DRV_SYSTEM = 7;
  {$EXTERNALSYM VFT2_DRV_INSTALLABLE}
  VFT2_DRV_INSTALLABLE = 8;
  {$EXTERNALSYM VFT2_DRV_SOUND}
  VFT2_DRV_SOUND = 9;
  {$EXTERNALSYM VFT2_DRV_COMM}
  VFT2_DRV_COMM = 10;

{ VS_VERSION.dwFileSubtype for VFT_WINDOWS_FONT }

  {$EXTERNALSYM VFT2_FONT_RASTER}
  VFT2_FONT_RASTER = 1;
  {$EXTERNALSYM VFT2_FONT_VECTOR}
  VFT2_FONT_VECTOR = 2;
  {$EXTERNALSYM VFT2_FONT_TRUETYPE}
  VFT2_FONT_TRUETYPE = 3;

{ VerFindFile() flags }

  {$EXTERNALSYM VFFF_ISSHAREDFILE}
  VFFF_ISSHAREDFILE = 1;

  {$EXTERNALSYM VFF_CURNEDEST}
  VFF_CURNEDEST = 1;
  {$EXTERNALSYM VFF_FILEINUSE}
  VFF_FILEINUSE = 2;
  {$EXTERNALSYM VFF_BUFFTOOSMALL}
  VFF_BUFFTOOSMALL = 4;

{ VerInstallFile() flags }

  {$EXTERNALSYM VIFF_FORCEINSTALL}
  VIFF_FORCEINSTALL = 1;
  {$EXTERNALSYM VIFF_DONTDELETEOLD}
  VIFF_DONTDELETEOLD = 2;

  {$EXTERNALSYM VIF_TEMPFILE}
  VIF_TEMPFILE = 1;
  {$EXTERNALSYM VIF_MISMATCH}
  VIF_MISMATCH = 2;
  {$EXTERNALSYM VIF_SRCOLD}
  VIF_SRCOLD = 4;

  {$EXTERNALSYM VIF_DIFFLANG}
  VIF_DIFFLANG = 8;
  {$EXTERNALSYM VIF_DIFFCODEPG}
  VIF_DIFFCODEPG = $10;
  {$EXTERNALSYM VIF_DIFFTYPE}
  VIF_DIFFTYPE = $20;

  {$EXTERNALSYM VIF_WRITEPROT}
  VIF_WRITEPROT = $40;
  {$EXTERNALSYM VIF_FILEINUSE}
  VIF_FILEINUSE = $80;
  {$EXTERNALSYM VIF_OUTOFSPACE}
  VIF_OUTOFSPACE = $100;
  {$EXTERNALSYM VIF_ACCESSVIOLATION}
  VIF_ACCESSVIOLATION = $200;
  {$EXTERNALSYM VIF_SHARINGVIOLATION}
  VIF_SHARINGVIOLATION = $400;
  {$EXTERNALSYM VIF_CANNOTCREATE}
  VIF_CANNOTCREATE = $800;
  {$EXTERNALSYM VIF_CANNOTDELETE}
  VIF_CANNOTDELETE = $1000;
  {$EXTERNALSYM VIF_CANNOTRENAME}
  VIF_CANNOTRENAME = $2000;
  {$EXTERNALSYM VIF_CANNOTDELETECUR}
  VIF_CANNOTDELETECUR = $4000;
  {$EXTERNALSYM VIF_OUTOFMEMORY}
  VIF_OUTOFMEMORY = $8000;

  {$EXTERNALSYM VIF_CANNOTREADSRC}
  VIF_CANNOTREADSRC = $10000;
  {$EXTERNALSYM VIF_CANNOTREADDST}
  VIF_CANNOTREADDST = $20000;

  {$EXTERNALSYM VIF_BUFFTOOSMALL}
  VIF_BUFFTOOSMALL = $40000;

type
  PVSFixedFileInfo = ^TVSFixedFileInfo;
  {$EXTERNALSYM tagVS_FIXEDFILEINFO}
  tagVS_FIXEDFILEINFO = packed record
    dwSignature: DWORD;        { e.g. $feef04bd }
    dwStrucVersion: DWORD;     { e.g. $00000042 = "0.42" }
    dwFileVersionMS: DWORD;    { e.g. $00030075 = "3.75" }
    dwFileVersionLS: DWORD;    { e.g. $00000031 = "0.31" }
    dwProductVersionMS: DWORD; { e.g. $00030010 = "3.10" }
    dwProductVersionLS: DWORD; { e.g. $00000031 = "0.31" }
    dwFileFlagsMask: DWORD;    { = $3F for version "0.42" }
    dwFileFlags: DWORD;        { e.g. VFF_DEBUG | VFF_PRERELEASE }
    dwFileOS: DWORD;           { e.g. VOS_DOS_WINDOWS16 }
    dwFileType: DWORD;         { e.g. VFT_DRIVER }
    dwFileSubtype: DWORD;      { e.g. VFT2_DRV_KEYBOARD }
    dwFileDateMS: DWORD;       { e.g. 0 }
    dwFileDateLS: DWORD;       { e.g. 0 }
  end;
  TVSFixedFileInfo = tagVS_FIXEDFILEINFO;
  {$EXTERNALSYM VS_FIXEDFILEINFO}
  VS_FIXEDFILEINFO = tagVS_FIXEDFILEINFO;

{$EXTERNALSYM VerFindFileA}
function VerFindFileA(uFlags: DWORD; szFileName, szWinDir, szAppDir, szCurDir: PAnsiChar;
  var lpuCurDirLen: UINT; szDestDir: PAnsiChar; var lpuDestDirLen: UINT): DWORD; stdcall;
{$EXTERNALSYM VerFindFileW}
function VerFindFileW(uFlags: DWORD; szFileName, szWinDir, szAppDir, szCurDir: PWideChar;
  var lpuCurDirLen: UINT; szDestDir: PWideChar; var lpuDestDirLen: UINT): DWORD; stdcall;
{$EXTERNALSYM VerFindFile}
function VerFindFile(uFlags: DWORD; szFileName, szWinDir, szAppDir, szCurDir: PChar;
  var lpuCurDirLen: UINT; szDestDir: PChar; var lpuDestDirLen: UINT): DWORD; stdcall;
{$EXTERNALSYM VerInstallFileA}
function VerInstallFileA(uFlags: DWORD;
  szSrcFileName, szDestFileName, szSrcDir, szDestDir, szCurDir, szTmpFile: PAnsiChar;
  var lpuTmpFileLen: UINT): DWORD; stdcall;
{$EXTERNALSYM VerInstallFileW}
function VerInstallFileW(uFlags: DWORD;
  szSrcFileName, szDestFileName, szSrcDir, szDestDir, szCurDir, szTmpFile: PWideChar;
  var lpuTmpFileLen: UINT): DWORD; stdcall;
{$EXTERNALSYM VerInstallFile}
function VerInstallFile(uFlags: DWORD;
  szSrcFileName, szDestFileName, szSrcDir, szDestDir, szCurDir, szTmpFile: PChar;
  var lpuTmpFileLen: UINT): DWORD; stdcall;

{$EXTERNALSYM GetFileVersionInfoSizeA}
function GetFileVersionInfoSizeA(lptstrFilename: PAnsiChar; var lpdwHandle: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetFileVersionInfoSizeW}
function GetFileVersionInfoSizeW(lptstrFilename: PWideChar; var lpdwHandle: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetFileVersionInfoSize}
function GetFileVersionInfoSize(lptstrFilename: PChar; var lpdwHandle: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetFileVersionInfoA}
function GetFileVersionInfoA(lptstrFilename: PAnsiChar; dwHandle, dwLen: DWORD;
  lpData: Pointer): BOOL; stdcall;
{$EXTERNALSYM GetFileVersionInfoW}
function GetFileVersionInfoW(lptstrFilename: PWideChar; dwHandle, dwLen: DWORD;
  lpData: Pointer): BOOL; stdcall;
{$EXTERNALSYM GetFileVersionInfo}
function GetFileVersionInfo(lptstrFilename: PChar; dwHandle, dwLen: DWORD;
  lpData: Pointer): BOOL; stdcall;
{$EXTERNALSYM VerLanguageNameA}
function VerLanguageNameA(wLang: DWORD; szLang: PAnsiChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM VerLanguageNameW}
function VerLanguageNameW(wLang: DWORD; szLang: PWideChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM VerLanguageName}
function VerLanguageName(wLang: DWORD; szLang: PChar; nSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM VerQueryValueA}
function VerQueryValueA(pBlock: Pointer; lpSubBlock: PAnsiChar;
  var lplpBuffer: Pointer; var puLen: UINT): BOOL; stdcall;
{$EXTERNALSYM VerQueryValueW}
function VerQueryValueW(pBlock: Pointer; lpSubBlock: PWideChar;
  var lplpBuffer: Pointer; var puLen: UINT): BOOL; stdcall;
{$EXTERNALSYM VerQueryValue}
function VerQueryValue(pBlock: Pointer; lpSubBlock: PChar;
  var lplpBuffer: Pointer; var puLen: UINT): BOOL; stdcall;


{ Translated from WINREG.H }

{ This module contains the function prototypes and constant, type and
   structure definitions for the Windows 32-Bit Registry API. }

type
  {$EXTERNALSYM REGSAM}
  REGSAM = ACCESS_MASK;  { Requested Key access mask type. }

  {$EXTERNALSYM HKEY}
  HKEY = type LongWord;
  PHKEY = ^HKEY;

const
{ Reserved Key Handles. }

  {$EXTERNALSYM HKEY_CLASSES_ROOT}
  HKEY_CLASSES_ROOT     = DWORD($80000000);
  {$EXTERNALSYM HKEY_CURRENT_USER}
  HKEY_CURRENT_USER     = DWORD($80000001);
  {$EXTERNALSYM HKEY_LOCAL_MACHINE}
  HKEY_LOCAL_MACHINE    = DWORD($80000002);
  {$EXTERNALSYM HKEY_USERS}
  HKEY_USERS            = DWORD($80000003);
  {$EXTERNALSYM HKEY_PERFORMANCE_DATA}
  HKEY_PERFORMANCE_DATA = DWORD($80000004);
  {$EXTERNALSYM HKEY_CURRENT_CONFIG}
  HKEY_CURRENT_CONFIG   = DWORD($80000005);
  {$EXTERNALSYM HKEY_DYN_DATA}
  HKEY_DYN_DATA         = DWORD($80000006);


  {$EXTERNALSYM PROVIDER_KEEPS_VALUE_LENGTH}
  PROVIDER_KEEPS_VALUE_LENGTH = 1;

type
  PValContext = ^TValContext;
  {$EXTERNALSYM val_context}
  val_context = packed record
    valuelen: Integer;       { the total length of this value }
    value_context: Pointer;  { provider's context }
    val_buff_ptr: Pointer;   { where in the ouput buffer the value is }
  end;
  TValContext = val_context;


type
{ Provider supplied value/context.}
  PPValueA = ^TPValueA;
  PPValueW = ^TPValueW;
  PPValue = PPValueA;
  {$EXTERNALSYM pvalueA}
  pvalueA = packed record
    pv_valuename: PAnsiChar;           { The value name pointer }
    pv_valuelen: BOOL;
    pv_value_context: Pointer;
    pv_type: DWORD;
  end;
  {$EXTERNALSYM pvalueW}
  pvalueW = packed record
    pv_valuename: PWideChar;           { The value name pointer }
    pv_valuelen: BOOL;
    pv_value_context: Pointer;
    pv_type: DWORD;
  end;
  {$EXTERNALSYM pvalue}
  pvalue = pvalueA;
  TPValueA = pvalueA;
  TPValueW = pvalueW;
  TPValue = TPValueA;

  TFNQueryHandler = TFarProc;
  PFNQueryHandler = ^TFNQueryHandler;

  PProviderInfo = ^TProviderInfo;
  {$EXTERNALSYM provider_info}
  provider_info = packed record
    pi_R0_1val: PFNQueryHandler;
    pi_R0_allvals: PFNQueryHandler;
    pi_R3_1val: PFNQueryHandler;
    pi_R3_allvals: PFNQueryHandler;
    pi_flags: DWORD;              { capability flags (none defined yet). }
    pi_key_context: Pointer;
  end;
  TProviderInfo = provider_info;
  {$EXTERNALSYM REG_PROVIDER}
  REG_PROVIDER = provider_info;
  TRegProvider = TProviderInfo;
  PProvider = PProviderInfo;

  PValueEntA = ^TValueEntA;
  PValueEntW = ^TValueEntW;
  PValueEnt = PValueEntA;
  {$EXTERNALSYM value_entA}
  value_entA = packed record
    ve_valuename: PAnsiChar;
    ve_valuelen: DWORD;
    ve_valueptr: DWORD;
    ve_type: DWORD;
  end;
  {$EXTERNALSYM value_entW}
  value_entW = packed record
    ve_valuename: PWideChar;
    ve_valuelen: DWORD;
    ve_valueptr: DWORD;
    ve_type: DWORD;
  end;
  {$EXTERNALSYM value_ent}
  value_ent = value_entA;
  TValueEntA = value_entA;
  TValueEntW = value_entW;
  TValueEnt = TValueEntA;
  {$EXTERNALSYM VALENTA}
  VALENTA = value_entA;
  {$EXTERNALSYM VALENTW}
  VALENTW = value_entW;
  {$EXTERNALSYM VALENT}
  VALENT = VALENTA;
  TValEnt = TValueEnt;
  PValEnt = PValueEnt;


{ Default values for parameters that do not exist in the Win 3.1
  compatible APIs. }

{$EXTERNALSYM RegCloseKey}
function RegCloseKey(hKey: HKEY): Longint; stdcall;

{$EXTERNALSYM RegConnectRegistryA}
function RegConnectRegistryA(lpMachineName: PAnsiChar; hKey: HKEY;
  var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegConnectRegistryW}
function RegConnectRegistryW(lpMachineName: PWideChar; hKey: HKEY;
  var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegConnectRegistry}
function RegConnectRegistry(lpMachineName: PChar; hKey: HKEY;
  var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegCreateKeyA}
function RegCreateKeyA(hKey: HKEY; lpSubKey: PAnsiChar;
  var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegCreateKeyW}
function RegCreateKeyW(hKey: HKEY; lpSubKey: PWideChar;
  var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegCreateKey}
function RegCreateKey(hKey: HKEY; lpSubKey: PChar;
  var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegCreateKeyExA}
function RegCreateKeyExA(hKey: HKEY; lpSubKey: PAnsiChar;
  Reserved: DWORD; lpClass: PAnsiChar; dwOptions: DWORD; samDesired: REGSAM;
  lpSecurityAttributes: PSecurityAttributes; var phkResult: HKEY;
  lpdwDisposition: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegCreateKeyExW}
function RegCreateKeyExW(hKey: HKEY; lpSubKey: PWideChar;
  Reserved: DWORD; lpClass: PWideChar; dwOptions: DWORD; samDesired: REGSAM;
  lpSecurityAttributes: PSecurityAttributes; var phkResult: HKEY;
  lpdwDisposition: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegCreateKeyEx}
function RegCreateKeyEx(hKey: HKEY; lpSubKey: PChar;
  Reserved: DWORD; lpClass: PChar; dwOptions: DWORD; samDesired: REGSAM;
  lpSecurityAttributes: PSecurityAttributes; var phkResult: HKEY;
  lpdwDisposition: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegDeleteKeyA}
function RegDeleteKeyA(hKey: HKEY; lpSubKey: PAnsiChar): Longint; stdcall;
{$EXTERNALSYM RegDeleteKeyW}
function RegDeleteKeyW(hKey: HKEY; lpSubKey: PWideChar): Longint; stdcall;
{$EXTERNALSYM RegDeleteKey}
function RegDeleteKey(hKey: HKEY; lpSubKey: PChar): Longint; stdcall;
{$EXTERNALSYM RegDeleteValueA}
function RegDeleteValueA(hKey: HKEY; lpValueName: PAnsiChar): Longint; stdcall;
{$EXTERNALSYM RegDeleteValueW}
function RegDeleteValueW(hKey: HKEY; lpValueName: PWideChar): Longint; stdcall;
{$EXTERNALSYM RegDeleteValue}
function RegDeleteValue(hKey: HKEY; lpValueName: PChar): Longint; stdcall;
{$EXTERNALSYM RegEnumKeyA}
function RegEnumKeyA(hKey: HKEY; dwIndex: DWORD; lpName: PAnsiChar; cbName: DWORD): Longint; stdcall;
{$EXTERNALSYM RegEnumKeyW}
function RegEnumKeyW(hKey: HKEY; dwIndex: DWORD; lpName: PWideChar; cbName: DWORD): Longint; stdcall;
{$EXTERNALSYM RegEnumKey}
function RegEnumKey(hKey: HKEY; dwIndex: DWORD; lpName: PChar; cbName: DWORD): Longint; stdcall;
{$EXTERNALSYM RegEnumKeyExA}
function RegEnumKeyExA(hKey: HKEY; dwIndex: DWORD; lpName: PAnsiChar;
  var lpcbName: DWORD; lpReserved: Pointer; lpClass: PAnsiChar;
  lpcbClass: PDWORD; lpftLastWriteTime: PFileTime): Longint; stdcall;
{$EXTERNALSYM RegEnumKeyExW}
function RegEnumKeyExW(hKey: HKEY; dwIndex: DWORD; lpName: PWideChar;
  var lpcbName: DWORD; lpReserved: Pointer; lpClass: PWideChar;
  lpcbClass: PDWORD; lpftLastWriteTime: PFileTime): Longint; stdcall;
{$EXTERNALSYM RegEnumKeyEx}
function RegEnumKeyEx(hKey: HKEY; dwIndex: DWORD; lpName: PChar;
  var lpcbName: DWORD; lpReserved: Pointer; lpClass: PChar;
  lpcbClass: PDWORD; lpftLastWriteTime: PFileTime): Longint; stdcall;
{$EXTERNALSYM RegEnumValueA}
function RegEnumValueA(hKey: HKEY; dwIndex: DWORD; lpValueName: PChar;
  var lpcbValueName: DWORD; lpReserved: Pointer; lpType: PDWORD;
  lpData: PByte; lpcbData: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegEnumValueW}
function RegEnumValueW(hKey: HKEY; dwIndex: DWORD; lpValueName: PChar;
  var lpcbValueName: DWORD; lpReserved: Pointer; lpType: PDWORD;
  lpData: PByte; lpcbData: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegEnumValue}
function RegEnumValue(hKey: HKEY; dwIndex: DWORD; lpValueName: PChar;
  var lpcbValueName: DWORD; lpReserved: Pointer; lpType: PDWORD;
  lpData: PByte; lpcbData: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegFlushKey}
function RegFlushKey(hKey: HKEY): Longint; stdcall;
{$EXTERNALSYM RegGetKeySecurity}
function RegGetKeySecurity(hKey: HKEY; SecurityInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSecurityDescriptor; var lpcbSecurityDescriptor: DWORD): Longint; stdcall;
{$EXTERNALSYM RegLoadKeyA}
function RegLoadKeyA(hKey: HKEY; lpSubKey, lpFile: PAnsiChar): Longint; stdcall;
{$EXTERNALSYM RegLoadKeyW}
function RegLoadKeyW(hKey: HKEY; lpSubKey, lpFile: PWideChar): Longint; stdcall;
{$EXTERNALSYM RegLoadKey}
function RegLoadKey(hKey: HKEY; lpSubKey, lpFile: PChar): Longint; stdcall;
{$EXTERNALSYM RegNotifyChangeKeyValue}
function RegNotifyChangeKeyValue(hKey: HKEY; bWatchSubtree: BOOL;
  dwNotifyFilter: DWORD; hEvent: THandle; fAsynchronus: BOOL): Longint; stdcall;
{$EXTERNALSYM RegOpenKeyA}
function RegOpenKeyA(hKey: HKEY; lpSubKey: PAnsiChar; var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegOpenKeyW}
function RegOpenKeyW(hKey: HKEY; lpSubKey: PWideChar; var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegOpenKey}
function RegOpenKey(hKey: HKEY; lpSubKey: PChar; var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegOpenKeyExA}
function RegOpenKeyExA(hKey: HKEY; lpSubKey: PAnsiChar;
  ulOptions: DWORD; samDesired: REGSAM; var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegOpenKeyExW}
function RegOpenKeyExW(hKey: HKEY; lpSubKey: PWideChar;
  ulOptions: DWORD; samDesired: REGSAM; var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegOpenKeyEx}
function RegOpenKeyEx(hKey: HKEY; lpSubKey: PChar;
  ulOptions: DWORD; samDesired: REGSAM; var phkResult: HKEY): Longint; stdcall;
{$EXTERNALSYM RegQueryInfoKeyA}
function RegQueryInfoKeyA(hKey: HKEY; lpClass: PChar;
  lpcbClass: PDWORD; lpReserved: Pointer;
  lpcSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues,
  lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor: PDWORD;
  lpftLastWriteTime: PFileTime): Longint; stdcall;
{$EXTERNALSYM RegQueryInfoKeyW}
function RegQueryInfoKeyW(hKey: HKEY; lpClass: PChar;
  lpcbClass: PDWORD; lpReserved: Pointer;
  lpcSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues,
  lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor: PDWORD;
  lpftLastWriteTime: PFileTime): Longint; stdcall;
{$EXTERNALSYM RegQueryInfoKey}
function RegQueryInfoKey(hKey: HKEY; lpClass: PChar;
  lpcbClass: PDWORD; lpReserved: Pointer;
  lpcSubKeys, lpcbMaxSubKeyLen, lpcbMaxClassLen, lpcValues,
  lpcbMaxValueNameLen, lpcbMaxValueLen, lpcbSecurityDescriptor: PDWORD;
  lpftLastWriteTime: PFileTime): Longint; stdcall;
{$EXTERNALSYM RegQueryValueA}
function RegQueryValueA(hKey: HKEY; lpSubKey: PAnsiChar;
  lpValue: PAnsiChar; var lpcbValue: Longint): Longint; stdcall;
{$EXTERNALSYM RegQueryValueW}
function RegQueryValueW(hKey: HKEY; lpSubKey: PWideChar;
  lpValue: PWideChar; var lpcbValue: Longint): Longint; stdcall;
{$EXTERNALSYM RegQueryValue}
function RegQueryValue(hKey: HKEY; lpSubKey: PChar;
  lpValue: PChar; var lpcbValue: Longint): Longint; stdcall;
{$EXTERNALSYM RegQueryMultipleValuesA}
function RegQueryMultipleValuesA(hKey: HKEY; var ValList;
  NumVals: DWORD; lpValueBuf: PAnsiChar; var ldwTotsize: DWORD): Longint; stdcall;
{$EXTERNALSYM RegQueryMultipleValuesW}
function RegQueryMultipleValuesW(hKey: HKEY; var ValList;
  NumVals: DWORD; lpValueBuf: PWideChar; var ldwTotsize: DWORD): Longint; stdcall;
{$EXTERNALSYM RegQueryMultipleValues}
function RegQueryMultipleValues(hKey: HKEY; var ValList;
  NumVals: DWORD; lpValueBuf: PChar; var ldwTotsize: DWORD): Longint; stdcall;
{$EXTERNALSYM RegQueryValueExA}
function RegQueryValueExA(hKey: HKEY; lpValueName: PAnsiChar;
  lpReserved: Pointer; lpType: PDWORD; lpData: PByte; lpcbData: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegQueryValueExW}
function RegQueryValueExW(hKey: HKEY; lpValueName: PWideChar;
  lpReserved: Pointer; lpType: PDWORD; lpData: PByte; lpcbData: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegQueryValueEx}
function RegQueryValueEx(hKey: HKEY; lpValueName: PChar;
  lpReserved: Pointer; lpType: PDWORD; lpData: PByte; lpcbData: PDWORD): Longint; stdcall;
{$EXTERNALSYM RegReplaceKeyA}
function RegReplaceKeyA(hKey: HKEY; lpSubKey: PAnsiChar;
   lpNewFile: PAnsiChar; lpOldFile: PAnsiChar): Longint; stdcall;
{$EXTERNALSYM RegReplaceKeyW}
function RegReplaceKeyW(hKey: HKEY; lpSubKey: PWideChar;
   lpNewFile: PWideChar; lpOldFile: PWideChar): Longint; stdcall;
{$EXTERNALSYM RegReplaceKey}
function RegReplaceKey(hKey: HKEY; lpSubKey: PChar;
   lpNewFile: PChar; lpOldFile: PChar): Longint; stdcall;
{$EXTERNALSYM RegRestoreKeyA}
function RegRestoreKeyA(hKey: HKEY; lpFile: PAnsiChar; dwFlags: DWORD): Longint; stdcall;
{$EXTERNALSYM RegRestoreKeyW}
function RegRestoreKeyW(hKey: HKEY; lpFile: PWideChar; dwFlags: DWORD): Longint; stdcall;
{$EXTERNALSYM RegRestoreKey}
function RegRestoreKey(hKey: HKEY; lpFile: PChar; dwFlags: DWORD): Longint; stdcall;
{$EXTERNALSYM RegSaveKeyA}
function RegSaveKeyA(hKey: HKEY; lpFile: PAnsiChar;
  lpSecurityAttributes: PSecurityAttributes): Longint; stdcall;
{$EXTERNALSYM RegSaveKeyW}
function RegSaveKeyW(hKey: HKEY; lpFile: PWideChar;
  lpSecurityAttributes: PSecurityAttributes): Longint; stdcall;
{$EXTERNALSYM RegSaveKey}
function RegSaveKey(hKey: HKEY; lpFile: PChar;
  lpSecurityAttributes: PSecurityAttributes): Longint; stdcall;
{$EXTERNALSYM RegSetKeySecurity}
function RegSetKeySecurity(hKey: HKEY; SecurityInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSECURITY_DESCRIPTOR): Longint; stdcall;
{$EXTERNALSYM RegSetValueA}
function RegSetValueA(hKey: HKEY; lpSubKey: PAnsiChar;
  dwType: DWORD; lpData: PAnsiChar; cbData: DWORD): Longint; stdcall;
{$EXTERNALSYM RegSetValueW}
function RegSetValueW(hKey: HKEY; lpSubKey: PWideChar;
  dwType: DWORD; lpData: PWideChar; cbData: DWORD): Longint; stdcall;
{$EXTERNALSYM RegSetValue}
function RegSetValue(hKey: HKEY; lpSubKey: PChar;
  dwType: DWORD; lpData: PChar; cbData: DWORD): Longint; stdcall;
{$EXTERNALSYM RegSetValueExA}
function RegSetValueExA(hKey: HKEY; lpValueName: PAnsiChar;
  Reserved: DWORD; dwType: DWORD; lpData: Pointer; cbData: DWORD): Longint; stdcall;
{$EXTERNALSYM RegSetValueExW}
function RegSetValueExW(hKey: HKEY; lpValueName: PWideChar;
  Reserved: DWORD; dwType: DWORD; lpData: Pointer; cbData: DWORD): Longint; stdcall;
{$EXTERNALSYM RegSetValueEx}
function RegSetValueEx(hKey: HKEY; lpValueName: PChar;
  Reserved: DWORD; dwType: DWORD; lpData: Pointer; cbData: DWORD): Longint; stdcall;
{$EXTERNALSYM RegUnLoadKeyA}
function RegUnLoadKeyA(hKey: HKEY; lpSubKey: PAnsiChar): Longint; stdcall;
{$EXTERNALSYM RegUnLoadKeyW}
function RegUnLoadKeyW(hKey: HKEY; lpSubKey: PWideChar): Longint; stdcall;
{$EXTERNALSYM RegUnLoadKey}
function RegUnLoadKey(hKey: HKEY; lpSubKey: PChar): Longint; stdcall;

{ Remoteable System Shutdown APIs }

{$EXTERNALSYM InitiateSystemShutdownA}
function InitiateSystemShutdownA(lpMachineName, lpMessage: PAnsiChar;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdownW}
function InitiateSystemShutdownW(lpMachineName, lpMessage: PWideChar;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdown}
function InitiateSystemShutdown(lpMachineName, lpMessage: PChar;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL): BOOL; stdcall;
{$EXTERNALSYM AbortSystemShutdownA}
function AbortSystemShutdownA(lpMachineName: PAnsiChar): BOOL; stdcall;
{$EXTERNALSYM AbortSystemShutdownW}
function AbortSystemShutdownW(lpMachineName: PWideChar): BOOL; stdcall;
{$EXTERNALSYM AbortSystemShutdown}
function AbortSystemShutdown(lpMachineName: PChar): BOOL; stdcall;


{ Translated from WINNETWK.H }

const
{ Network types }

  {$EXTERNALSYM WNNC_NET_MSNET}
  WNNC_NET_MSNET              = $00010000;
  {$EXTERNALSYM WNNC_NET_LANMAN}
  WNNC_NET_LANMAN             = $00020000;
  {$EXTERNALSYM WNNC_NET_NETWARE}
  WNNC_NET_NETWARE            = $00030000;
  {$EXTERNALSYM WNNC_NET_VINES}
  WNNC_NET_VINES              = $00040000;
  {$EXTERNALSYM WNNC_NET_10NET}
  WNNC_NET_10NET              = $00050000;
  {$EXTERNALSYM WNNC_NET_LOCUS}
  WNNC_NET_LOCUS              = $00060000;
  {$EXTERNALSYM WNNC_NET_SUN_PC_NFS}
  WNNC_NET_SUN_PC_NFS         = $00070000;
  {$EXTERNALSYM WNNC_NET_LANSTEP}
  WNNC_NET_LANSTEP            = $00080000;
  {$EXTERNALSYM WNNC_NET_9TILES}
  WNNC_NET_9TILES             = $00090000;
  {$EXTERNALSYM WNNC_NET_LANTASTIC}
  WNNC_NET_LANTASTIC          = $000A0000;
  {$EXTERNALSYM WNNC_NET_AS400}
  WNNC_NET_AS400              = $000B0000;
  {$EXTERNALSYM WNNC_NET_FTP_NFS}
  WNNC_NET_FTP_NFS            = $000C0000;
  {$EXTERNALSYM WNNC_NET_PATHWORKS}
  WNNC_NET_PATHWORKS          = $000D0000;
  {$EXTERNALSYM WNNC_NET_LIFENET}
  WNNC_NET_LIFENET            = $000E0000;
  {$EXTERNALSYM WNNC_NET_POWERLAN}
  WNNC_NET_POWERLAN           = $000F0000;
  {$EXTERNALSYM WNNC_NET_BWNFS}
  WNNC_NET_BWNFS              = $00100000;
  {$EXTERNALSYM WNNC_NET_COGENT}
  WNNC_NET_COGENT             = $00110000;
  {$EXTERNALSYM WNNC_NET_FARALLON}
  WNNC_NET_FARALLON           = $00120000;
  {$EXTERNALSYM WNNC_NET_APPLETALK}
  WNNC_NET_APPLETALK          = $00130000;
  {$EXTERNALSYM WNNC_NET_INTERGRAPH}
  WNNC_NET_INTERGRAPH         = $00140000;
  {$EXTERNALSYM WNNC_NET_SYMFONET}
  WNNC_NET_SYMFONET           = $00150000;
  {$EXTERNALSYM WNNC_NET_CLEARCASE}
  WNNC_NET_CLEARCASE          = $00160000;

{ Network Resources. }

  {$EXTERNALSYM RESOURCE_CONNECTED}
  RESOURCE_CONNECTED = 1;
  {$EXTERNALSYM RESOURCE_GLOBALNET}
  RESOURCE_GLOBALNET = 2;
  {$EXTERNALSYM RESOURCE_REMEMBERED}
  RESOURCE_REMEMBERED = 3;
  {$EXTERNALSYM RESOURCE_RECENT}
  RESOURCE_RECENT = 4;
  {$EXTERNALSYM RESOURCE_CONTEXT}
  RESOURCE_CONTEXT = 5;

  {$EXTERNALSYM RESOURCETYPE_ANY}
  RESOURCETYPE_ANY = 0;
  {$EXTERNALSYM RESOURCETYPE_DISK}
  RESOURCETYPE_DISK = 1;
  {$EXTERNALSYM RESOURCETYPE_PRINT}
  RESOURCETYPE_PRINT = 2;
  {$EXTERNALSYM RESOURCETYPE_RESERVED}
  RESOURCETYPE_RESERVED = 8;
  {$EXTERNALSYM RESOURCETYPE_UNKNOWN}
  RESOURCETYPE_UNKNOWN = DWORD($FFFFFFFF);

  {$EXTERNALSYM RESOURCEUSAGE_CONNECTABLE}
  RESOURCEUSAGE_CONNECTABLE = 1;
  {$EXTERNALSYM RESOURCEUSAGE_CONTAINER}
  RESOURCEUSAGE_CONTAINER = 2;
  {$EXTERNALSYM RESOURCEUSAGE_NOLOCALDEVICE}
  RESOURCEUSAGE_NOLOCALDEVICE = 4;
  {$EXTERNALSYM RESOURCEUSAGE_SIBLING}
  RESOURCEUSAGE_SIBLING = 8;

  {$EXTERNALSYM RESOURCEUSAGE_ATTACHED}
  RESOURCEUSAGE_ATTACHED = $00000010;
  {$EXTERNALSYM RESOURCEUSAGE_ALL}
  RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE or RESOURCEUSAGE_CONTAINER or RESOURCEUSAGE_ATTACHED);
  {$EXTERNALSYM RESOURCEUSAGE_RESERVED}
  RESOURCEUSAGE_RESERVED = DWORD($80000000);

  {$EXTERNALSYM RESOURCEDISPLAYTYPE_GENERIC}
  RESOURCEDISPLAYTYPE_GENERIC            = $00000000;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_DOMAIN}
  RESOURCEDISPLAYTYPE_DOMAIN             = $00000001;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_SERVER}
  RESOURCEDISPLAYTYPE_SERVER             = $00000002;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_SHARE}
  RESOURCEDISPLAYTYPE_SHARE              = $00000003;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_FILE}
  RESOURCEDISPLAYTYPE_FILE               = $00000004;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_GROUP}
  RESOURCEDISPLAYTYPE_GROUP              = $00000005;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_NETWORK}
  RESOURCEDISPLAYTYPE_NETWORK            = $00000006;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_ROOT}
  RESOURCEDISPLAYTYPE_ROOT               = $00000007;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_SHAREADMIN}
  RESOURCEDISPLAYTYPE_SHAREADMIN         = $00000008;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_DIRECTORY}
  RESOURCEDISPLAYTYPE_DIRECTORY          = $00000009;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_TREE}
  RESOURCEDISPLAYTYPE_TREE               = $0000000A;
  {$EXTERNALSYM RESOURCEDISPLAYTYPE_NDSCONTAINER}
  RESOURCEDISPLAYTYPE_NDSCONTAINER       = $0000000B;

type
  PNetResourceA = ^TNetResourceA;
  PNetResourceW = ^TNetResourceW;
  PNetResource = PNetResourceA;
  {$EXTERNALSYM _NETRESOURCEA}
  _NETRESOURCEA = packed record
    dwScope: DWORD;
    dwType: DWORD;
    dwDisplayType: DWORD;
    dwUsage: DWORD;
    lpLocalName: PAnsiChar;
    lpRemoteName: PAnsiChar;
    lpComment: PAnsiChar;
    lpProvider: PAnsiChar;
  end;
  {$EXTERNALSYM _NETRESOURCEW}
  _NETRESOURCEW = packed record
    dwScope: DWORD;
    dwType: DWORD;
    dwDisplayType: DWORD;
    dwUsage: DWORD;
    lpLocalName: PWideChar;
    lpRemoteName: PWideChar;
    lpComment: PWideChar;
    lpProvider: PWideChar;
  end;
  {$EXTERNALSYM _NETRESOURCE}
  _NETRESOURCE = _NETRESOURCEA;
  TNetResourceA = _NETRESOURCEA;
  TNetResourceW = _NETRESOURCEW;
  TNetResource = TNetResourceA;
  {$EXTERNALSYM NETRESOURCEA}
  NETRESOURCEA = _NETRESOURCEA;
  {$EXTERNALSYM NETRESOURCEW}
  NETRESOURCEW = _NETRESOURCEW;
  {$EXTERNALSYM NETRESOURCE}
  NETRESOURCE = NETRESOURCEA;

const
{ Network Connections. }

  {$EXTERNALSYM NETPROPERTY_PERSISTENT}
  NETPROPERTY_PERSISTENT = 1;

  {$EXTERNALSYM CONNECT_UPDATE_PROFILE}
  CONNECT_UPDATE_PROFILE          = $00000001;
  {$EXTERNALSYM CONNECT_UPDATE_RECENT}
  CONNECT_UPDATE_RECENT           = $00000002;
  {$EXTERNALSYM CONNECT_TEMPORARY}
  CONNECT_TEMPORARY               = $00000004;
  {$EXTERNALSYM CONNECT_INTERACTIVE}
  CONNECT_INTERACTIVE             = $00000008;
  {$EXTERNALSYM CONNECT_PROMPT}
  CONNECT_PROMPT                  = $00000010;
  {$EXTERNALSYM CONNECT_NEED_DRIVE}
  CONNECT_NEED_DRIVE              = $00000020;
  {$EXTERNALSYM CONNECT_REFCOUNT}
  CONNECT_REFCOUNT                = $00000040;
  {$EXTERNALSYM CONNECT_REDIRECT}
  CONNECT_REDIRECT                = $00000080;
  {$EXTERNALSYM CONNECT_LOCALDRIVE}
  CONNECT_LOCALDRIVE              = $00000100;
  {$EXTERNALSYM CONNECT_CURRENT_MEDIA}
  CONNECT_CURRENT_MEDIA           = $00000200;
  {$EXTERNALSYM CONNECT_DEFERRED}
  CONNECT_DEFERRED                = $00000400;
  {$EXTERNALSYM CONNECT_RESERVED}
  CONNECT_RESERVED                = DWORD($FF000000);

{$EXTERNALSYM WNetAddConnectionA}
function WNetAddConnectionA(lpRemoteName, lpPassword, lpLocalName: PAnsiChar): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnectionW}
function WNetAddConnectionW(lpRemoteName, lpPassword, lpLocalName: PWideChar): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnection}
function WNetAddConnection(lpRemoteName, lpPassword, lpLocalName: PChar): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnection2A}
function WNetAddConnection2A(var lpNetResource: TNetResourceA;
  lpPassword, lpUserName: PAnsiChar; dwFlags: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnection2W}
function WNetAddConnection2W(var lpNetResource: TNetResourceW;
  lpPassword, lpUserName: PWideChar; dwFlags: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnection2}
function WNetAddConnection2(var lpNetResource: TNetResource;
  lpPassword, lpUserName: PChar; dwFlags: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnection3A}
function WNetAddConnection3A(hwndOwner: HWND; var lpNetResource: TNetResourceA;
  lpPassword, lpUserName: PAnsiChar; dwFlags: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnection3W}
function WNetAddConnection3W(hwndOwner: HWND; var lpNetResource: TNetResourceW;
  lpPassword, lpUserName: PWideChar; dwFlags: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetAddConnection3}
function WNetAddConnection3(hwndOwner: HWND; var lpNetResource: TNetResource;
  lpPassword, lpUserName: PChar; dwFlags: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetCancelConnectionA}
function WNetCancelConnectionA(lpName: PAnsiChar; fForce: BOOL): DWORD; stdcall;
{$EXTERNALSYM WNetCancelConnectionW}
function WNetCancelConnectionW(lpName: PWideChar; fForce: BOOL): DWORD; stdcall;
{$EXTERNALSYM WNetCancelConnection}
function WNetCancelConnection(lpName: PChar; fForce: BOOL): DWORD; stdcall;
{$EXTERNALSYM WNetCancelConnection2A}
function WNetCancelConnection2A(lpName: PAnsiChar; dwFlags: DWORD; fForce: BOOL): DWORD; stdcall;
{$EXTERNALSYM WNetCancelConnection2W}
function WNetCancelConnection2W(lpName: PWideChar; dwFlags: DWORD; fForce: BOOL): DWORD; stdcall;
{$EXTERNALSYM WNetCancelConnection2}
function WNetCancelConnection2(lpName: PChar; dwFlags: DWORD; fForce: BOOL): DWORD; stdcall;
{$EXTERNALSYM WNetGetConnectionA}
function WNetGetConnectionA(lpLocalName: PAnsiChar;
  lpRemoteName: PAnsiChar; var lpnLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetConnectionW}
function WNetGetConnectionW(lpLocalName: PWideChar;
  lpRemoteName: PWideChar; var lpnLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetConnection}
function WNetGetConnection(lpLocalName: PChar;
  lpRemoteName: PChar; var lpnLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetUseConnectionA}
function WNetUseConnectionA(hwndOwner: HWND;
  var lpNetResource: TNetResourceA; lpUserID: PAnsiChar;
  lpPassword: PAnsiChar; dwFlags: DWORD; lpAccessName: PAnsiChar;
  var lpBufferSize: DWORD; var lpResult: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetUseConnectionW}
function WNetUseConnectionW(hwndOwner: HWND;
  var lpNetResource: TNetResourceW; lpUserID: PWideChar;
  lpPassword: PWideChar; dwFlags: DWORD; lpAccessName: PWideChar;
  var lpBufferSize: DWORD; var lpResult: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetUseConnection}
function WNetUseConnection(hwndOwner: HWND;
  var lpNetResource: TNetResource; lpUserID: PChar;
  lpPassword: PChar; dwFlags: DWORD; lpAccessName: PChar;
  var lpBufferSize: DWORD; var lpResult: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetSetConnectionA}
function WNetSetConnectionA(lpName: PAnsiChar; dwProperties: DWORD; pvValues: Pointer): DWORD; stdcall;
{$EXTERNALSYM WNetSetConnectionW}
function WNetSetConnectionW(lpName: PWideChar; dwProperties: DWORD; pvValues: Pointer): DWORD; stdcall;
{$EXTERNALSYM WNetSetConnection}
function WNetSetConnection(lpName: PChar; dwProperties: DWORD; pvValues: Pointer): DWORD; stdcall;

{ Network Connection Dialogs. }

{$EXTERNALSYM WNetConnectionDialog}
function WNetConnectionDialog(hwnd: HWND; dwType: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetDisconnectDialog}
function WNetDisconnectDialog(hwnd: HWND; dwType: DWORD): DWORD; stdcall;

type
  PConnectDlgStruct = ^TConnectDlgStruct;
  {$EXTERNALSYM _CONNECTDLGSTRUCTA}
  _CONNECTDLGSTRUCTA = packed record
    cbStructure: DWORD;          { size of this structure in bytes }
    hwndOwner: HWND;             { owner window for the dialog }
    lpConnRes: PNetResource;     { Requested Resource info    }
    dwFlags: DWORD;              { flags (see below) }
    dwDevNum: DWORD;             { number of devices connected to }
  end;
  TConnectDlgStruct = _CONNECTDLGSTRUCTA;
  {$EXTERNALSYM CONNECTDLGSTRUCT}
  CONNECTDLGSTRUCT = _CONNECTDLGSTRUCTA;

const
  {$EXTERNALSYM CONNDLG_RO_PATH}
  CONNDLG_RO_PATH = 1;    { Resource path should be read-only     }
  {$EXTERNALSYM CONNDLG_CONN_POINT}
  CONNDLG_CONN_POINT = 2; { Netware -style movable connection point enabled  }
  {$EXTERNALSYM CONNDLG_USE_MRU}
  CONNDLG_USE_MRU = 4;    { Use MRU combobox   }
  {$EXTERNALSYM CONNDLG_HIDE_BOX}
  CONNDLG_HIDE_BOX = 8;   { Hide persistent connect checkbox   }

  { NOTE:  Set at most ONE of the below flags.  If neither flag is set,
           then the persistence is set to whatever the user chose during
           a previous connection }

  {$EXTERNALSYM CONNDLG_PERSIST}
  CONNDLG_PERSIST = $10;       { Force persistent connection  }
  {$EXTERNALSYM CONNDLG_NOT_PERSIST}
  CONNDLG_NOT_PERSIST = $20;   { Force connection NOT persistent  }

{$EXTERNALSYM WNetConnectionDialog1A}
function WNetConnectionDialog1A(var lpConnDlgStruct: TConnectDlgStruct): DWORD; stdcall;
{$EXTERNALSYM WNetConnectionDialog1W}
function WNetConnectionDialog1W(var lpConnDlgStruct: TConnectDlgStruct): DWORD; stdcall;
{$EXTERNALSYM WNetConnectionDialog1}
function WNetConnectionDialog1(var lpConnDlgStruct: TConnectDlgStruct): DWORD; stdcall;

type
  PDiscDlgStructA = ^TDiscDlgStructA;
  PDiscDlgStructW = ^TDiscDlgStructW;
  PDiscDlgStruct = PDiscDlgStructA;
  {$EXTERNALSYM _DISCDLGSTRUCTA}
  _DISCDLGSTRUCTA = packed record
    cbStructure: DWORD;       { size of this structure in bytes }
    hwndOwner: HWND;          { owner window for the dialog }
    lpLocalName: PAnsiChar;       { local device name }
    lpRemoteName: PAnsiChar;      { network resource name }
    dwFlags: DWORD;
  end;
  {$EXTERNALSYM _DISCDLGSTRUCTW}
  _DISCDLGSTRUCTW = packed record
    cbStructure: DWORD;       { size of this structure in bytes }
    hwndOwner: HWND;          { owner window for the dialog }
    lpLocalName: PWideChar;       { local device name }
    lpRemoteName: PWideChar;      { network resource name }
    dwFlags: DWORD;
  end;
  {$EXTERNALSYM _DISCDLGSTRUCT}
  _DISCDLGSTRUCT = _DISCDLGSTRUCTA;
  TDiscDlgStructA = _DISCDLGSTRUCTA;
  TDiscDlgStructW = _DISCDLGSTRUCTW;
  TDiscDlgStruct = TDiscDlgStructA;
  {$EXTERNALSYM DISCDLGSTRUCTA}
  DISCDLGSTRUCTA = _DISCDLGSTRUCTA;
  {$EXTERNALSYM DISCDLGSTRUCTW}
  DISCDLGSTRUCTW = _DISCDLGSTRUCTW;
  {$EXTERNALSYM DISCDLGSTRUCT}
  DISCDLGSTRUCT = DISCDLGSTRUCTA;

const
  {$EXTERNALSYM DISC_UPDATE_PROFILE}
  DISC_UPDATE_PROFILE = 1;
  {$EXTERNALSYM DISC_NO_FORCE}
  DISC_NO_FORCE = $40;

{$EXTERNALSYM WNetDisconnectDialog1A}
function WNetDisconnectDialog1A(var lpConnDlgStruct: TDiscDlgStructA): DWORD; stdcall;
{$EXTERNALSYM WNetDisconnectDialog1W}
function WNetDisconnectDialog1W(var lpConnDlgStruct: TDiscDlgStructW): DWORD; stdcall;
{$EXTERNALSYM WNetDisconnectDialog1}
function WNetDisconnectDialog1(var lpConnDlgStruct: TDiscDlgStruct): DWORD; stdcall;

{ Network Browsing. }

{$EXTERNALSYM WNetOpenEnumA}
function WNetOpenEnumA(dwScope, dwType, dwUsage: DWORD;
  lpNetResource: PNetResourceA; var lphEnum: THandle): DWORD; stdcall;
{$EXTERNALSYM WNetOpenEnumW}
function WNetOpenEnumW(dwScope, dwType, dwUsage: DWORD;
  lpNetResource: PNetResourceW; var lphEnum: THandle): DWORD; stdcall;
{$EXTERNALSYM WNetOpenEnum}
function WNetOpenEnum(dwScope, dwType, dwUsage: DWORD;
  lpNetResource: PNetResource; var lphEnum: THandle): DWORD; stdcall;
{$EXTERNALSYM WNetEnumResourceA}
function WNetEnumResourceA(hEnum: THandle; var lpcCount: DWORD;
  lpBuffer: Pointer; var lpBufferSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetEnumResourceW}
function WNetEnumResourceW(hEnum: THandle; var lpcCount: DWORD;
  lpBuffer: Pointer; var lpBufferSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetEnumResource}
function WNetEnumResource(hEnum: THandle; var lpcCount: DWORD;
  lpBuffer: Pointer; var lpBufferSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetCloseEnum}
function WNetCloseEnum(hEnum: THandle): DWORD; stdcall;
{$EXTERNALSYM WNetGetResourceParentA}
function WNetGetResourceParentA(lpNetResource: PNetResourceA;
  lpBuffer: Pointer; var cbBuffer: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetResourceParentW}
function WNetGetResourceParentW(lpNetResource: PNetResourceW;
  lpBuffer: Pointer; var cbBuffer: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetResourceParent}
function WNetGetResourceParent(lpNetResource: PNetResource;
  lpBuffer: Pointer; var cbBuffer: DWORD): DWORD; stdcall;

const
{ Universal Naming. }

  {$EXTERNALSYM UNIVERSAL_NAME_INFO_LEVEL}
  UNIVERSAL_NAME_INFO_LEVEL = 1;
  {$EXTERNALSYM REMOTE_NAME_INFO_LEVEL}
  REMOTE_NAME_INFO_LEVEL = 2;

type
  PUniversalNameInfoA = ^TUniversalNameInfoA;
  PUniversalNameInfoW = ^TUniversalNameInfoW;
  PUniversalNameInfo = PUniversalNameInfoA;
  {$EXTERNALSYM _UNIVERSAL_NAME_INFOA}
  _UNIVERSAL_NAME_INFOA = packed record
    lpUniversalName: PAnsiChar;
  end;
  {$EXTERNALSYM _UNIVERSAL_NAME_INFOW}
  _UNIVERSAL_NAME_INFOW = packed record
    lpUniversalName: PWideChar;
  end;
  {$EXTERNALSYM _UNIVERSAL_NAME_INFO}
  _UNIVERSAL_NAME_INFO = _UNIVERSAL_NAME_INFOA;
  TUniversalNameInfoA = _UNIVERSAL_NAME_INFOA;
  TUniversalNameInfoW = _UNIVERSAL_NAME_INFOW;
  TUniversalNameInfo = TUniversalNameInfoA;
  {$EXTERNALSYM UNIVERSAL_NAME_INFOA}
  UNIVERSAL_NAME_INFOA = _UNIVERSAL_NAME_INFOA;
  {$EXTERNALSYM UNIVERSAL_NAME_INFOW}
  UNIVERSAL_NAME_INFOW = _UNIVERSAL_NAME_INFOW;
  {$EXTERNALSYM UNIVERSAL_NAME_INFO}
  UNIVERSAL_NAME_INFO = UNIVERSAL_NAME_INFOA;

  PRemoteNameInfoA = ^TRemoteNameInfoA;
  PRemoteNameInfoW = ^TRemoteNameInfoW;
  PRemoteNameInfo = PRemoteNameInfoA;
  {$EXTERNALSYM _REMOTE_NAME_INFOA}
  _REMOTE_NAME_INFOA = packed record
    lpUniversalName: PAnsiChar;
    lpConnectionName: PAnsiChar;
    lpRemainingPath: PAnsiChar;
  end;
  {$EXTERNALSYM _REMOTE_NAME_INFOW}
  _REMOTE_NAME_INFOW = packed record
    lpUniversalName: PWideChar;
    lpConnectionName: PWideChar;
    lpRemainingPath: PWideChar;
  end;
  {$EXTERNALSYM _REMOTE_NAME_INFO}
  _REMOTE_NAME_INFO = _REMOTE_NAME_INFOA;
  TRemoteNameInfoA = _REMOTE_NAME_INFOA;
  TRemoteNameInfoW = _REMOTE_NAME_INFOW;
  TRemoteNameInfo = TRemoteNameInfoA;
  {$EXTERNALSYM REMOTE_NAME_INFOA}
  REMOTE_NAME_INFOA = _REMOTE_NAME_INFOA;
  {$EXTERNALSYM REMOTE_NAME_INFOW}
  REMOTE_NAME_INFOW = _REMOTE_NAME_INFOW;
  {$EXTERNALSYM REMOTE_NAME_INFO}
  REMOTE_NAME_INFO = REMOTE_NAME_INFOA;

{$EXTERNALSYM WNetGetUniversalNameA}
function WNetGetUniversalNameA(lpLocalPath: PAnsiChar; dwInfoLevel: DWORD;
  lpBuffer: Pointer; var lpBufferSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetUniversalNameW}
function WNetGetUniversalNameW(lpLocalPath: PWideChar; dwInfoLevel: DWORD;
  lpBuffer: Pointer; var lpBufferSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetUniversalName}
function WNetGetUniversalName(lpLocalPath: PChar; dwInfoLevel: DWORD;
  lpBuffer: Pointer; var lpBufferSize: DWORD): DWORD; stdcall;

{ Authentication and Logon/Logoff }

{$EXTERNALSYM WNetGetUserA}
function WNetGetUserA(lpName: PAnsiChar; lpUserName: PAnsiChar; var lpnLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetUserW}
function WNetGetUserW(lpName: PWideChar; lpUserName: PWideChar; var lpnLength: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetUser}
function WNetGetUser(lpName: PChar; lpUserName: PChar; var lpnLength: DWORD): DWORD; stdcall;

const
  {$EXTERNALSYM WNFMT_MULTILINE}
  WNFMT_MULTILINE = 1;
  {$EXTERNALSYM WNFMT_ABBREVIATED}
  WNFMT_ABBREVIATED = 2;
  {$EXTERNALSYM WNFMT_INENUM}
  WNFMT_INENUM = $10;
  {$EXTERNALSYM WNFMT_CONNECTION}
  WNFMT_CONNECTION = $20;

{$EXTERNALSYM WNetGetProviderNameA}
function WNetGetProviderNameA(dwNetType: DWORD; lpProviderName: PAnsiChar;
  var lpBufferSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetProviderNameW}
function WNetGetProviderNameW(dwNetType: DWORD; lpProviderName: PWideChar;
  var lpBufferSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetProviderName}
function WNetGetProviderName(dwNetType: DWORD; lpProviderName: PChar;
  var lpBufferSize: DWORD): DWORD; stdcall;

type
  PNetInfoStruct = ^TNetInfoStruct;
  {$EXTERNALSYM _NETINFOSTRUCT}
  _NETINFOSTRUCT = packed record
    cbStructure: DWORD;
    dwProviderVersion: DWORD;
    dwStatus: DWORD;
    dwCharacteristics: DWORD;
    dwHandle: DWORD;
    wNetType: Word;
    dwPrinters: DWORD;
    dwDrives: DWORD;
  end;
  TNetInfoStruct = _NETINFOSTRUCT;
  {$EXTERNALSYM NETINFOSTRUCT}
  NETINFOSTRUCT = _NETINFOSTRUCT;

const
  {$EXTERNALSYM NETINFO_DLL16}
  NETINFO_DLL16 = 1;      { Provider running as 16 bit Winnet Driver  }
  {$EXTERNALSYM NETINFO_DISKRED}
  NETINFO_DISKRED = 4;    { Provider requires disk redirections to connect  }
  {$EXTERNALSYM NETINFO_PRINTERRED}
  NETINFO_PRINTERRED = 8; { Provider requires printer redirections to connect  }

{$EXTERNALSYM WNetGetNetworkInformationA}
function WNetGetNetworkInformationA(lpProvider: PAnsiChar;
  var lpNetInfoStruct: TNetInfoStruct): DWORD; stdcall;
{$EXTERNALSYM WNetGetNetworkInformationW}
function WNetGetNetworkInformationW(lpProvider: PWideChar;
  var lpNetInfoStruct: TNetInfoStruct): DWORD; stdcall;
{$EXTERNALSYM WNetGetNetworkInformation}
function WNetGetNetworkInformation(lpProvider: PChar;
  var lpNetInfoStruct: TNetInfoStruct): DWORD; stdcall;

type
{ User Profiles }
  TFNGetProfilePath = TFarProc;
  TFNReconcileProfile = TFarProc;


const
  {$EXTERNALSYM RP_LOGON}
  RP_LOGON = 1;    { if set, do for logon, else for logoff }
  {$EXTERNALSYM RP_INIFILE}
  RP_INIFILE = 2;  { if set, reconcile .INI file, else reg. hive }

type
{ Policies }

  TFNProcessPolicies = TFarProc;

const
  {$EXTERNALSYM PP_DISPLAYERRORS}
  PP_DISPLAYERRORS = 1;  { if set, display error messages, else fail silently if error }

{ Error handling }

{$EXTERNALSYM WNetGetLastErrorA}
function WNetGetLastErrorA(var lpError: DWORD; lpErrorBuf: PAnsiChar;
  nErrorBufSize: DWORD; lpNameBuf: PAnsiChar; nNameBufSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetLastErrorW}
function WNetGetLastErrorW(var lpError: DWORD; lpErrorBuf: PWideChar;
  nErrorBufSize: DWORD; lpNameBuf: PWideChar; nNameBufSize: DWORD): DWORD; stdcall;
{$EXTERNALSYM WNetGetLastError}
function WNetGetLastError(var lpError: DWORD; lpErrorBuf: PChar;
  nErrorBufSize: DWORD; lpNameBuf: PChar; nNameBufSize: DWORD): DWORD; stdcall;


const
{ STATUS CODES }
{ General }

  {$EXTERNALSYM WN_SUCCESS}
  WN_SUCCESS = NO_ERROR;
  {$EXTERNALSYM WN_NO_ERROR}
  WN_NO_ERROR = NO_ERROR;
  {$EXTERNALSYM WN_NOT_SUPPORTED}
  WN_NOT_SUPPORTED = ERROR_NOT_SUPPORTED;
  {$EXTERNALSYM WN_CANCEL}
  WN_CANCEL = ERROR_CANCELLED;
  {$EXTERNALSYM WN_RETRY}
  WN_RETRY = ERROR_RETRY;
  {$EXTERNALSYM WN_NET_ERROR}
  WN_NET_ERROR = ERROR_UNEXP_NET_ERR;
  {$EXTERNALSYM WN_MORE_DATA}
  WN_MORE_DATA = ERROR_MORE_DATA;
  {$EXTERNALSYM WN_BAD_POINTER}
  WN_BAD_POINTER = ERROR_INVALID_ADDRESS;
  {$EXTERNALSYM WN_BAD_VALUE}
  WN_BAD_VALUE = ERROR_INVALID_PARAMETER;
  {$EXTERNALSYM WN_BAD_USER}
  WN_BAD_USER = ERROR_BAD_USERNAME;
  {$EXTERNALSYM WN_BAD_PASSWORD}
  WN_BAD_PASSWORD = ERROR_INVALID_PASSWORD;
  {$EXTERNALSYM WN_ACCESS_DENIED}
  WN_ACCESS_DENIED = ERROR_ACCESS_DENIED;
  {$EXTERNALSYM WN_FUNCTION_BUSY}
  WN_FUNCTION_BUSY = ERROR_BUSY;
  {$EXTERNALSYM WN_WINDOWS_ERROR}
  WN_WINDOWS_ERROR = ERROR_UNEXP_NET_ERR;
  {$EXTERNALSYM WN_OUT_OF_MEMORY}
  WN_OUT_OF_MEMORY = ERROR_NOT_ENOUGH_MEMORY;
  {$EXTERNALSYM WN_NO_NETWORK}
  WN_NO_NETWORK = ERROR_NO_NETWORK;
  {$EXTERNALSYM WN_EXTENDED_ERROR}
  WN_EXTENDED_ERROR = ERROR_EXTENDED_ERROR;
  {$EXTERNALSYM WN_BAD_LEVEL}
  WN_BAD_LEVEL = ERROR_INVALID_LEVEL;
  {$EXTERNALSYM WN_BAD_HANDLE}
  WN_BAD_HANDLE = ERROR_INVALID_HANDLE;
  {$EXTERNALSYM WN_NOT_INITIALIZING}
  WN_NOT_INITIALIZING = ERROR_ALREADY_INITIALIZED;
  {$EXTERNALSYM WN_NO_MORE_DEVICES}
  WN_NO_MORE_DEVICES = ERROR_NO_MORE_DEVICES;

{ Connection }

  {$EXTERNALSYM WN_NOT_CONNECTED}
  WN_NOT_CONNECTED = ERROR_NOT_CONNECTED;
  {$EXTERNALSYM WN_OPEN_FILES}
  WN_OPEN_FILES = ERROR_OPEN_FILES;
  {$EXTERNALSYM WN_DEVICE_IN_USE}
  WN_DEVICE_IN_USE = ERROR_DEVICE_IN_USE;
  {$EXTERNALSYM WN_BAD_NETNAME}
  WN_BAD_NETNAME = ERROR_BAD_NET_NAME;
  {$EXTERNALSYM WN_BAD_LOCALNAME}
  WN_BAD_LOCALNAME = ERROR_BAD_DEVICE;
  {$EXTERNALSYM WN_ALREADY_CONNECTED}
  WN_ALREADY_CONNECTED = ERROR_ALREADY_ASSIGNED;
  {$EXTERNALSYM WN_DEVICE_ERROR}
  WN_DEVICE_ERROR = ERROR_GEN_FAILURE;
  {$EXTERNALSYM WN_CONNECTION_CLOSED}
  WN_CONNECTION_CLOSED = ERROR_CONNECTION_UNAVAIL;
  {$EXTERNALSYM WN_NO_NET_OR_BAD_PATH}
  WN_NO_NET_OR_BAD_PATH = ERROR_NO_NET_OR_BAD_PATH;
  {$EXTERNALSYM WN_BAD_PROVIDER}
  WN_BAD_PROVIDER = ERROR_BAD_PROVIDER;
  {$EXTERNALSYM WN_CANNOT_OPEN_PROFILE}
  WN_CANNOT_OPEN_PROFILE = ERROR_CANNOT_OPEN_PROFILE;
  {$EXTERNALSYM WN_BAD_PROFILE}
  WN_BAD_PROFILE = ERROR_BAD_PROFILE;
  {$EXTERNALSYM WN_BAD_DEV_TYPE}
  WN_BAD_DEV_TYPE = ERROR_BAD_DEV_TYPE;
  {$EXTERNALSYM WN_DEVICE_ALREADY_REMEMBERED}
  WN_DEVICE_ALREADY_REMEMBERED = ERROR_DEVICE_ALREADY_REMEMBERED;

{ Enumeration }

  {$EXTERNALSYM WN_NO_MORE_ENTRIES}
  WN_NO_MORE_ENTRIES = ERROR_NO_MORE_ITEMS;
  {$EXTERNALSYM WN_NOT_CONTAINER}
  WN_NOT_CONTAINER = ERROR_NOT_CONTAINER;

{ Authentication }

  {$EXTERNALSYM WN_NOT_AUTHENTICATED}
  WN_NOT_AUTHENTICATED = ERROR_NOT_AUTHENTICATED;
  {$EXTERNALSYM WN_NOT_LOGGED_ON}
  WN_NOT_LOGGED_ON = ERROR_NOT_LOGGED_ON;
  {$EXTERNALSYM WN_NOT_VALIDATED}
  WN_NOT_VALIDATED = ERROR_NO_LOGON_SERVERS;

type
{ For Shell }
  PNetConnectInfoStruct = ^TNetConnectInfoStruct;
  {$EXTERNALSYM _NETCONNECTINFOSTRUCT}
  _NETCONNECTINFOSTRUCT = packed record
    cbStructure: DWORD;
    dwFlags: DWORD;
    dwSpeed: DWORD;
    dwDelay: DWORD;
    dwOptDataSize: DWORD;
  end;
  TNetConnectInfoStruct = _NETCONNECTINFOSTRUCT;
  {$EXTERNALSYM NETCONNECTINFOSTRUCT}
  NETCONNECTINFOSTRUCT = _NETCONNECTINFOSTRUCT;

const
  {$EXTERNALSYM WNCON_FORNETCARD}
  WNCON_FORNETCARD = 1;
  {$EXTERNALSYM WNCON_NOTROUTED}
  WNCON_NOTROUTED = 2;
  {$EXTERNALSYM WNCON_SLOWLINK}
  WNCON_SLOWLINK = 4;
  {$EXTERNALSYM WNCON_DYNAMIC}
  WNCON_DYNAMIC = 8;

{$EXTERNALSYM MultinetGetConnectionPerformanceA}
function MultinetGetConnectionPerformanceA(lpNetResource: PNetResourceA;
  lpNetConnectInfoStruc: PNetConnectInfoStruct): DWORD; stdcall;
{$EXTERNALSYM MultinetGetConnectionPerformanceW}
function MultinetGetConnectionPerformanceW(lpNetResource: PNetResourceW;
  lpNetConnectInfoStruc: PNetConnectInfoStruct): DWORD; stdcall;
{$EXTERNALSYM MultinetGetConnectionPerformance}
function MultinetGetConnectionPerformance(lpNetResource: PNetResource;
  lpNetConnectInfoStruc: PNetConnectInfoStruct): DWORD; stdcall;

{ Translated from DDE.H }

const
  {$EXTERNALSYM WM_DDE_FIRST}
  WM_DDE_FIRST      = $03E0;
  {$EXTERNALSYM WM_DDE_INITIATE}
  WM_DDE_INITIATE   = WM_DDE_FIRST;
  {$EXTERNALSYM WM_DDE_TERMINATE}
  WM_DDE_TERMINATE  = WM_DDE_FIRST+1;
  {$EXTERNALSYM WM_DDE_ADVISE}
  WM_DDE_ADVISE     = WM_DDE_FIRST+2;
  {$EXTERNALSYM WM_DDE_UNADVISE}
  WM_DDE_UNADVISE   = WM_DDE_FIRST+3;
  {$EXTERNALSYM WM_DDE_ACK}
  WM_DDE_ACK        = WM_DDE_FIRST+4;
  {$EXTERNALSYM WM_DDE_DATA}
  WM_DDE_DATA       = WM_DDE_FIRST+5;
  {$EXTERNALSYM WM_DDE_REQUEST}
  WM_DDE_REQUEST    = WM_DDE_FIRST+6;
  {$EXTERNALSYM WM_DDE_POKE}
  WM_DDE_POKE       = WM_DDE_FIRST+7;
  {$EXTERNALSYM WM_DDE_EXECUTE}
  WM_DDE_EXECUTE    = WM_DDE_FIRST+8;
  {$EXTERNALSYM WM_DDE_LAST}
  WM_DDE_LAST       = WM_DDE_FIRST+8;

{ Constants used for a WM_DDE_ACK message sent in responce to a WM_DDE_DATA
  WM_DDE_REQUEST, WM_DDE_POKE, WM_DDE_ADVISE, or WM_DDE_UNADVISE message.
  For example
    if lParam and dde_Ack <> 0 then ...
}

type
  PDDEAck = ^TDDEAck;
  {$EXTERNALSYM DDEACK}
  DDEACK = packed record
(*
    unsigned bAppReturnCode:8,
             reserved:6,
             fBusy:1,
             fAck:1;
*)
    Flags: Word;
  end;
  TDDEAck = DDEACK;

const
  dde_AppReturnCode = $00FF;
  dde_Busy          = $4000;
  dde_Ack           = $8000;

{ Record for the  WM_DDE_ADVISE Options parameter (LoWord(lParam)) }

type
  PDDEAdvise = ^TDDEAdvise;
  {$EXTERNALSYM DDEADVISE}
  DDEADVISE = packed record
(*
    unsigned reserved:14,
             fDeferUpd:1,
             fAckReq:1;
*)
    Flags: Word;
    cfFormat: SmallInt;
  end;
  TDDEAdvise = DDEADVISE;

const
  dde_DeferUpd     = $4000;
  dde_AckReq       = $8000;

{ Record for the hData parameter of a WM_DDE_DATA message (LoWord(lParam)).
  The actual size of this record depends on the size of the Value
  array. }

type
  PDDEData = ^TDDEData;
  {$EXTERNALSYM DDEDATA}
  DDEDATA = packed record
(*  unsigned unused:12,
             fResponse:1,
             fRelease:1,
             reserved:1,
             fAckReq:1;
*)
    Flags: Word;
    cfFormat: SmallInt;
    Value: array[0..0] of Byte;
    Reserved: array[0..0] of Byte;
  end;
  TDDEData = DDEDATA;

const
  dde_Response = $1000;
  dde_Release  = $2000;

{ Record for the hData parameter of the WM_DDE_POKE record (LoWord(lParam)).
  The actual size of this record depends on the size of the Value array. }

type
  PDDEPoke = ^TDDEPoke;
  {$EXTERNALSYM DDEPOKE}
  DDEPOKE = packed record
(*  unsigned unused:13,
             fRelease:1,
             fReserved:2;
*)
    Flags: Word;
    cfFormat: SmallInt;
    Value: array[0..0] of Byte;
    Reserved: array[0..0] of Byte;
  end;
  TDDEPoke = DDEPOKE;

{ DDE Security }

{$EXTERNALSYM DdeSetQualityOfService}
function DdeSetQualityOfService(hWndClient: HWnd; const pqosNew: TSecurityQualityOfService;
  pqosPrev: PSecurityQualityOfService): BOOL; stdcall;
{$EXTERNALSYM ImpersonateDdeClientWindow}
function ImpersonateDdeClientWindow(hWndClient: HWnd; hWndServer: HWnd): BOOL; stdcall;

{ DDE message packing APIs }
{$EXTERNALSYM PackDDElParam}
function PackDDElParam(msg: UINT; uiLo: UINT; uiHi: UINT): Longint; stdcall;
{$EXTERNALSYM UnpackDDElParam}
function UnpackDDElParam(msg: UINT; lParam: Longint; puiLo: PUINT; puiHi: PUINT): BOOL; stdcall;
{$EXTERNALSYM FreeDDElParam}
function FreeDDElParam(msg: UINT; lParam: Longint): BOOL; stdcall;
{$EXTERNALSYM ReuseDDElParam}
function ReuseDDElParam(lParam: Longint; msgIn: UINT; msgOut: UINT; uiLo: UINT; uiHi: UINT): Longint; stdcall;

{ From zmouse.h }

{ Client Appplication (API) Defines for Wheel rolling }

const
  // Apps need to call RegisterWindowMessage using the constant below to
  // get the message number that is sent to the foreground window
  // when a wheel roll occurs
  {$EXTERNALSYM MSH_MOUSEWHEEL}
  MSH_MOUSEWHEEL   = 'MSWHEEL_ROLLMSG';
   // wParam = wheel rotation expressed in multiples of WHEEL_DELTA
   // lParam is the mouse coordinates

{ Client Appplication (API) Defines for
   *  determining if wheel support active
   *  determining # of Scroll Lines }

  // Class name for MSWHEEL.EXE's invisible window
  // use FindWindow to get hwnd to MSWHEEL
  {$EXTERNALSYM MOUSEZ_CLASSNAME}
  MOUSEZ_CLASSNAME = 'MouseZ';            // wheel window class
  {$EXTERNALSYM MOUSEZ_TITLE}
  MOUSEZ_TITLE     = 'Magellan MSWHEEL';  // wheel window title

  {$EXTERNALSYM MSH_WHEELMODULE_CLASS}
  MSH_WHEELMODULE_CLASS = MOUSEZ_CLASSNAME;
  {$EXTERNALSYM MSH_WHEELMODULE_TITLE}
  MSH_WHEELMODULE_TITLE = MOUSEZ_TITLE;

// Apps need to call RegisterWindowMessage using the constants
// below to get the message numbers for:
// 1) the message that can be sent to the MSWHEEL window to
//    query if wheel support is active (MSH_WHEELSUPPORT)>
// 2) the message to query for the number of scroll lines
//    (MSH_SCROLL_LINES)
//
// To send a message to MSWheel window, use FindWindow with the #defines
// for CLASS and TITLE above.  If FindWindow fails to find the MSWHEEL
// window or the return from SendMessage is false, then Wheel support
// is not currently available.

  // MSH_WHEELSUPPORT
  //    wParam - not used
  //    lParam - not used
  //    returns BOOL - TRUE if wheel support is active, FALSE otherwise
  {$EXTERNALSYM MSH_WHEELSUPPORT}
  MSH_WHEELSUPPORT = 'MSH_WHEELSUPPORT_MSG';  // name of msg to send
                                              // to query for wheel support
  // MSH_SCROLL_LINES
  //    wParam - not used
  //    lParam - not used
  //    returns int  - number of lines to scroll on a wheel roll
  {$EXTERNALSYM MSH_SCROLL_LINES}
  MSH_SCROLL_LINES = 'MSH_SCROLL_LINES_MSG';

(*********************************************************************
* FUNCTION: HwndMsWheel
* Purpose : Get a reference to MSWheel Window, the registered messages,
*           wheel support active setting, and number of scrollLines
* Params  : puiMsh_MsgMouseWheel - UINT to contain returned registered wheel message
*           puiMsh_Msg3DSupport - UINT to contain wheel support registered message
*           puiMsh_MsgScrollLines - UINT to contain Scroll lines registered message
*           pf3DSupport - BOOL to contain returned flag for wheel support active
*           piScrollLines - Integer to contain returned scroll lines
* Returns : HWND handle to the MsWheel window
* Note    : The return value for pf3DSupport and piScrollLines is dependant
*           on the POINT32 module.  If POINT32 module is not running then
*           the values returned for these parameters will be
*           FALSE and 3, respectively.
*********************************************************************)
{$EXTERNALSYM HwndMSWheel}
function HwndMSWheel(var puiMsh_MsgMouseWheel, puiMsh_Msg3DSupport,
  puiMsh_MsgScrollLines: UINT; var pf3DSupport: BOOL;
  var piScrollLines: Integer): HWND;

const
  advapi32  = 'advapi32.dll';
  kernel32  = 'kernel32.dll';
  mpr       = 'mpr.dll';
  {$EXTERNALSYM version}
  version   = 'version.dll';
  comctl32  = 'comctl32.dll';
  gdi32     = 'gdi32.dll';
  opengl32  = 'opengl32.dll';
  user32    = 'user32.dll';
  wintrust  = 'wintrust.dll';

implementation

{ Externals from advapi32.dll }

{$EXTERNALSYM AbortSystemShutdownA}
function AbortSystemShutdownA; external advapi32 name 'AbortSystemShutdownA';
{$EXTERNALSYM AbortSystemShutdownW}
function AbortSystemShutdownW; external advapi32 name 'AbortSystemShutdownW';
{$EXTERNALSYM AbortSystemShutdown}
function AbortSystemShutdown; external advapi32 name 'AbortSystemShutdownA';
{$EXTERNALSYM AccessCheck}
function AccessCheck; external advapi32 name 'AccessCheck';
{$EXTERNALSYM AccessCheckAndAuditAlarmA}
function AccessCheckAndAuditAlarmA; external advapi32 name 'AccessCheckAndAuditAlarmA';
{$EXTERNALSYM AccessCheckAndAuditAlarmW}
function AccessCheckAndAuditAlarmW; external advapi32 name 'AccessCheckAndAuditAlarmW';
{$EXTERNALSYM AccessCheckAndAuditAlarm}
function AccessCheckAndAuditAlarm; external advapi32 name 'AccessCheckAndAuditAlarmA';
{$EXTERNALSYM AccessCheckByType}
function AccessCheckByType; external advapi32 name 'AccessCheckByType';
{$EXTERNALSYM AccessCheckByTypeAndAuditAlarmA}
function AccessCheckByTypeAndAuditAlarmA; external advapi32 name 'AccessCheckByTypeAndAuditAlarmA';
{$EXTERNALSYM AccessCheckByTypeAndAuditAlarmW}
function AccessCheckByTypeAndAuditAlarmW; external advapi32 name 'AccessCheckByTypeAndAuditAlarmW';
{$EXTERNALSYM AccessCheckByTypeAndAuditAlarm}
function AccessCheckByTypeAndAuditAlarm; external advapi32 name 'AccessCheckByTypeAndAuditAlarmA';
{$EXTERNALSYM AccessCheckByTypeResultList}
function AccessCheckByTypeResultList; external advapi32 name 'AccessCheckByTypeResultList';
{$EXTERNALSYM AccessCheckByTypeResultListAndAuditAlarmA}
function AccessCheckByTypeResultListAndAuditAlarmA; external advapi32 name 'AccessCheckByTypeResultListAndAuditAlarmA';
{$EXTERNALSYM AccessCheckByTypeResultListAndAuditAlarmW}
function AccessCheckByTypeResultListAndAuditAlarmW; external advapi32 name 'AccessCheckByTypeResultListAndAuditAlarmW';
{$EXTERNALSYM AccessCheckByTypeResultListAndAuditAlarm}
function AccessCheckByTypeResultListAndAuditAlarm; external advapi32 name 'AccessCheckByTypeResultListAndAuditAlarmA';
{$EXTERNALSYM AddAccessAllowedAce}
function AddAccessAllowedAce; external advapi32 name 'AddAccessAllowedAce';
{$EXTERNALSYM AddAccessAllowedAceEx}
function AddAccessAllowedAceEx; external advapi32 name 'AddAccessAllowedAceEx';
{$EXTERNALSYM AddAccessAllowedObjectAce}
function AddAccessAllowedObjectAce; external advapi32 name 'AddAccessAllowedObjectAce';
{$EXTERNALSYM AddAccessDeniedAce}
function AddAccessDeniedAce; external advapi32 name 'AddAccessDeniedAce';
{$EXTERNALSYM AddAccessDeniedObjectAce}
function AddAccessDeniedObjectAce; external advapi32 name 'AddAccessDeniedObjectAce';
{$EXTERNALSYM AddAccessDeniedAceEx}
function AddAccessDeniedAceEx; external advapi32 name 'AddAccessDeniedAceEx';
{$EXTERNALSYM AddAce}
function AddAce; external advapi32 name 'AddAce';
{$EXTERNALSYM AddAuditAccessAce}
function AddAuditAccessAce; external advapi32 name 'AddAuditAccessAce';
{$EXTERNALSYM AddAuditAccessAceEx}
function AddAuditAccessAceEx; external advapi32 name 'AddAuditAccessAceEx';
{$EXTERNALSYM AddAuditAccessObjectAce}
function AddAuditAccessObjectAce; external advapi32 name 'AddAuditAccessObjectAce';
{$EXTERNALSYM AdjustTokenGroups}
function AdjustTokenGroups; external advapi32 name 'AdjustTokenGroups';
{$EXTERNALSYM AdjustTokenPrivileges}
function AdjustTokenPrivileges; external advapi32 name 'AdjustTokenPrivileges';
{$EXTERNALSYM AllocateAndInitializeSid}
function AllocateAndInitializeSid; external advapi32 name 'AllocateAndInitializeSid';
{$EXTERNALSYM AllocateLocallyUniqueId}
function AllocateLocallyUniqueId; external advapi32 name 'AllocateLocallyUniqueId';
{$EXTERNALSYM AreAllAccessesGranted}
function AreAllAccessesGranted; external advapi32 name 'AreAllAccessesGranted';
{$EXTERNALSYM AreAnyAccessesGranted}
function AreAnyAccessesGranted; external advapi32 name 'AreAnyAccessesGranted';
{$EXTERNALSYM BackupEventLogA}
function BackupEventLogA; external advapi32 name 'BackupEventLogA';
{$EXTERNALSYM BackupEventLogW}
function BackupEventLogW; external advapi32 name 'BackupEventLogW';
{$EXTERNALSYM BackupEventLog}
function BackupEventLog; external advapi32 name 'BackupEventLogA';
{$EXTERNALSYM ClearEventLogA}
function ClearEventLogA; external advapi32 name 'ClearEventLogA';
{$EXTERNALSYM ClearEventLogW}
function ClearEventLogW; external advapi32 name 'ClearEventLogW';
{$EXTERNALSYM ClearEventLog}
function ClearEventLog; external advapi32 name 'ClearEventLogA';
{$EXTERNALSYM CloseEventLog}
function CloseEventLog; external advapi32 name 'CloseEventLog';
{$EXTERNALSYM ConvertToAutoInheritPrivateObjectSecurity}
function ConvertToAutoInheritPrivateObjectSecurity; external advapi32 name 'ConvertToAutoInheritPrivateObjectSecurity';
{$EXTERNALSYM CopySid}
function CopySid; external advapi32 name 'CopySid';
{$EXTERNALSYM CreatePrivateObjectSecurity}
function CreatePrivateObjectSecurity; external advapi32 name 'CreatePrivateObjectSecurity';
{$EXTERNALSYM CreatePrivateObjectSecurityEx}
function CreatePrivateObjectSecurityEx; external advapi32 name 'CreatePrivateObjectSecurityEx';
{$EXTERNALSYM CreateProcessAsUserA}
function CreateProcessAsUserA; external advapi32 name 'CreateProcessAsUserA';
{$EXTERNALSYM CreateProcessAsUserW}
function CreateProcessAsUserW; external advapi32 name 'CreateProcessAsUserW';
{$EXTERNALSYM CreateProcessAsUser}
function CreateProcessAsUser; external advapi32 name 'CreateProcessAsUserA';
{$EXTERNALSYM DeleteAce}
function DeleteAce; external advapi32 name 'DeleteAce';
{$EXTERNALSYM DeregisterEventSource}
function DeregisterEventSource; external advapi32 name 'DeregisterEventSource';
{$EXTERNALSYM DestroyPrivateObjectSecurity}
function DestroyPrivateObjectSecurity; external advapi32 name 'DestroyPrivateObjectSecurity';
{$EXTERNALSYM DuplicateToken}
function DuplicateToken; external advapi32 name 'DuplicateToken';
{$EXTERNALSYM DuplicateTokenEx}
function DuplicateTokenEx; external advapi32 name 'DuplicateTokenEx';
{$EXTERNALSYM EqualPrefixSid}
function EqualPrefixSid; external advapi32 name 'EqualPrefixSid';
{$EXTERNALSYM EqualSid}
function EqualSid; external advapi32 name 'EqualSid';
{$EXTERNALSYM FindFirstFreeAce}
function FindFirstFreeAce; external advapi32 name 'FindFirstFreeAce';
{$EXTERNALSYM FreeSid}
function FreeSid; external advapi32 name 'FreeSid';
{$EXTERNALSYM GetAce}
function GetAce; external advapi32 name 'GetAce';
{$EXTERNALSYM GetAclInformation}
function GetAclInformation; external advapi32 name 'GetAclInformation';
{$EXTERNALSYM GetCurrentHwProfileA}
function GetCurrentHwProfileA; external advapi32 name 'GetCurrentHwProfileA';
{$EXTERNALSYM GetCurrentHwProfileW}
function GetCurrentHwProfileW; external advapi32 name 'GetCurrentHwProfileW';
{$EXTERNALSYM GetCurrentHwProfile}
function GetCurrentHwProfile; external advapi32 name 'GetCurrentHwProfileA';
{$EXTERNALSYM GetFileSecurityA}
function GetFileSecurityA; external advapi32 name 'GetFileSecurityA';
{$EXTERNALSYM GetFileSecurityW}
function GetFileSecurityW; external advapi32 name 'GetFileSecurityW';
{$EXTERNALSYM GetFileSecurity}
function GetFileSecurity; external advapi32 name 'GetFileSecurityA';
{$EXTERNALSYM GetKernelObjectSecurity}
function GetKernelObjectSecurity; external advapi32 name 'GetKernelObjectSecurity';
{$EXTERNALSYM GetLengthSid}
function GetLengthSid; external advapi32 name 'GetLengthSid';
{$EXTERNALSYM GetNumberOfEventLogRecords}
function GetNumberOfEventLogRecords; external advapi32 name 'GetNumberOfEventLogRecords';
{$EXTERNALSYM GetOldestEventLogRecord}
function GetOldestEventLogRecord; external advapi32 name 'GetOldestEventLogRecord';
{$EXTERNALSYM GetPrivateObjectSecurity}
function GetPrivateObjectSecurity; external advapi32 name 'GetPrivateObjectSecurity';
{$EXTERNALSYM GetSecurityDescriptorControl}
function GetSecurityDescriptorControl; external advapi32 name 'GetSecurityDescriptorControl';
{$EXTERNALSYM GetSecurityDescriptorDacl}
function GetSecurityDescriptorDacl; external advapi32 name 'GetSecurityDescriptorDacl';
{$EXTERNALSYM GetSecurityDescriptorGroup}
function GetSecurityDescriptorGroup; external advapi32 name 'GetSecurityDescriptorGroup';
{$EXTERNALSYM GetSecurityDescriptorLength}
function GetSecurityDescriptorLength; external advapi32 name 'GetSecurityDescriptorLength';
{$EXTERNALSYM GetSecurityDescriptorOwner}
function GetSecurityDescriptorOwner; external advapi32 name 'GetSecurityDescriptorOwner';
{$EXTERNALSYM GetSecurityDescriptorSacl}
function GetSecurityDescriptorSacl; external advapi32 name 'GetSecurityDescriptorSacl';
{$EXTERNALSYM GetSidIdentifierAuthority}
function GetSidIdentifierAuthority; external advapi32 name 'GetSidIdentifierAuthority';
{$EXTERNALSYM GetSidLengthRequired}
function GetSidLengthRequired; external advapi32 name 'GetSidLengthRequired';
{$EXTERNALSYM GetSidSubAuthority}
function GetSidSubAuthority; external advapi32 name 'GetSidSubAuthority';
{$EXTERNALSYM GetSidSubAuthorityCount}
function GetSidSubAuthorityCount; external advapi32 name 'GetSidSubAuthorityCount';
{$EXTERNALSYM GetTokenInformation}
function GetTokenInformation; external advapi32 name 'GetTokenInformation';
{$EXTERNALSYM GetUserNameA}
function GetUserNameA; external advapi32 name 'GetUserNameA';
{$EXTERNALSYM GetUserNameW}
function GetUserNameW; external advapi32 name 'GetUserNameW';
{$EXTERNALSYM GetUserName}
function GetUserName; external advapi32 name 'GetUserNameA';
{$EXTERNALSYM ImpersonateLoggedOnUser}
function ImpersonateLoggedOnUser; external advapi32 name 'ImpersonateLoggedOnUser';
{$EXTERNALSYM ImpersonateNamedPipeClient}
function ImpersonateNamedPipeClient; external advapi32 name 'ImpersonateNamedPipeClient';
{$EXTERNALSYM ImpersonateSelf}
function ImpersonateSelf; external advapi32 name 'ImpersonateSelf';
{$EXTERNALSYM InitializeAcl}
function InitializeAcl; external advapi32 name 'InitializeAcl';
{$EXTERNALSYM InitializeSecurityDescriptor}
function InitializeSecurityDescriptor; external advapi32 name 'InitializeSecurityDescriptor';
{$EXTERNALSYM InitializeSid}
function InitializeSid; external advapi32 name 'InitializeSid';
{$EXTERNALSYM InitiateSystemShutdownA}
function InitiateSystemShutdownA; external advapi32 name 'InitiateSystemShutdownA';
{$EXTERNALSYM InitiateSystemShutdownW}
function InitiateSystemShutdownW; external advapi32 name 'InitiateSystemShutdownW';
{$EXTERNALSYM InitiateSystemShutdown}
function InitiateSystemShutdown; external advapi32 name 'InitiateSystemShutdownA';
function IsTextUnicode; external advapi32 name 'IsTextUnicode';
{$EXTERNALSYM IsValidAcl}
function IsValidAcl; external advapi32 name 'IsValidAcl';
{$EXTERNALSYM IsValidSecurityDescriptor}
function IsValidSecurityDescriptor; external advapi32 name 'IsValidSecurityDescriptor';
{$EXTERNALSYM IsValidSid}
function IsValidSid; external advapi32 name 'IsValidSid';
{$EXTERNALSYM LogonUserA}
function LogonUserA; external advapi32 name 'LogonUserA';
{$EXTERNALSYM LogonUserW}
function LogonUserW; external advapi32 name 'LogonUserW';
{$EXTERNALSYM LogonUser}
function LogonUser; external advapi32 name 'LogonUserA';
{$EXTERNALSYM LookupAccountNameA}
function LookupAccountNameA; external advapi32 name 'LookupAccountNameA';
{$EXTERNALSYM LookupAccountNameW}
function LookupAccountNameW; external advapi32 name 'LookupAccountNameW';
{$EXTERNALSYM LookupAccountName}
function LookupAccountName; external advapi32 name 'LookupAccountNameA';
{$EXTERNALSYM LookupAccountSidA}
function LookupAccountSidA; external advapi32 name 'LookupAccountSidA';
{$EXTERNALSYM LookupAccountSidW}
function LookupAccountSidW; external advapi32 name 'LookupAccountSidW';
{$EXTERNALSYM LookupAccountSid}
function LookupAccountSid; external advapi32 name 'LookupAccountSidA';
{$EXTERNALSYM LookupPrivilegeDisplayNameA}
function LookupPrivilegeDisplayNameA; external advapi32 name 'LookupPrivilegeDisplayNameA';
{$EXTERNALSYM LookupPrivilegeDisplayNameW}
function LookupPrivilegeDisplayNameW; external advapi32 name 'LookupPrivilegeDisplayNameW';
{$EXTERNALSYM LookupPrivilegeDisplayName}
function LookupPrivilegeDisplayName; external advapi32 name 'LookupPrivilegeDisplayNameA';
{$EXTERNALSYM LookupPrivilegeNameA}
function LookupPrivilegeNameA; external advapi32 name 'LookupPrivilegeNameA';
{$EXTERNALSYM LookupPrivilegeNameW}
function LookupPrivilegeNameW; external advapi32 name 'LookupPrivilegeNameW';
{$EXTERNALSYM LookupPrivilegeName}
function LookupPrivilegeName; external advapi32 name 'LookupPrivilegeNameA';
{$EXTERNALSYM LookupPrivilegeValueA}
function LookupPrivilegeValueA; external advapi32 name 'LookupPrivilegeValueA';
{$EXTERNALSYM LookupPrivilegeValueW}
function LookupPrivilegeValueW; external advapi32 name 'LookupPrivilegeValueW';
{$EXTERNALSYM LookupPrivilegeValue}
function LookupPrivilegeValue; external advapi32 name 'LookupPrivilegeValueA';
{$EXTERNALSYM MakeAbsoluteSD}
function MakeAbsoluteSD; external advapi32 name 'MakeAbsoluteSD';
{$EXTERNALSYM MakeSelfRelativeSD}
function MakeSelfRelativeSD; external advapi32 name 'MakeSelfRelativeSD';
{$EXTERNALSYM MapGenericMask}
procedure MapGenericMask; external advapi32 name 'MapGenericMask';
{$EXTERNALSYM NotifyChangeEventLog}
function NotifyChangeEventLog; external advapi32 name 'NotifyChangeEventLog';
{$EXTERNALSYM ObjectCloseAuditAlarmA}
function ObjectCloseAuditAlarmA; external advapi32 name 'ObjectCloseAuditAlarmA';
{$EXTERNALSYM ObjectCloseAuditAlarmW}
function ObjectCloseAuditAlarmW; external advapi32 name 'ObjectCloseAuditAlarmW';
{$EXTERNALSYM ObjectCloseAuditAlarm}
function ObjectCloseAuditAlarm; external advapi32 name 'ObjectCloseAuditAlarmA';
{$EXTERNALSYM ObjectDeleteAuditAlarmA}
function ObjectDeleteAuditAlarmA; external advapi32 name 'ObjectDeleteAuditAlarmA';
{$EXTERNALSYM ObjectDeleteAuditAlarmW}
function ObjectDeleteAuditAlarmW; external advapi32 name 'ObjectDeleteAuditAlarmW';
{$EXTERNALSYM ObjectDeleteAuditAlarm}
function ObjectDeleteAuditAlarm; external advapi32 name 'ObjectDeleteAuditAlarmA';
{$EXTERNALSYM ObjectOpenAuditAlarmA}
function ObjectOpenAuditAlarmA; external advapi32 name 'ObjectOpenAuditAlarmA';
{$EXTERNALSYM ObjectOpenAuditAlarmW}
function ObjectOpenAuditAlarmW; external advapi32 name 'ObjectOpenAuditAlarmW';
{$EXTERNALSYM ObjectOpenAuditAlarm}
function ObjectOpenAuditAlarm; external advapi32 name 'ObjectOpenAuditAlarmA';
{$EXTERNALSYM ObjectPrivilegeAuditAlarmA}
function ObjectPrivilegeAuditAlarmA; external advapi32 name 'ObjectPrivilegeAuditAlarmA';
{$EXTERNALSYM ObjectPrivilegeAuditAlarmW}
function ObjectPrivilegeAuditAlarmW; external advapi32 name 'ObjectPrivilegeAuditAlarmW';
{$EXTERNALSYM ObjectPrivilegeAuditAlarm}
function ObjectPrivilegeAuditAlarm; external advapi32 name 'ObjectPrivilegeAuditAlarmA';
{$EXTERNALSYM OpenBackupEventLogA}
function OpenBackupEventLogA; external advapi32 name 'OpenBackupEventLogA';
{$EXTERNALSYM OpenBackupEventLogW}
function OpenBackupEventLogW; external advapi32 name 'OpenBackupEventLogW';
{$EXTERNALSYM OpenBackupEventLog}
function OpenBackupEventLog; external advapi32 name 'OpenBackupEventLogA';
{$EXTERNALSYM OpenEventLogA}
function OpenEventLogA; external advapi32 name 'OpenEventLogA';
{$EXTERNALSYM OpenEventLogW}
function OpenEventLogW; external advapi32 name 'OpenEventLogW';
{$EXTERNALSYM OpenEventLog}
function OpenEventLog; external advapi32 name 'OpenEventLogA';
{$EXTERNALSYM OpenProcessToken}
function OpenProcessToken; external advapi32 name 'OpenProcessToken';
{$EXTERNALSYM OpenThreadToken}
function OpenThreadToken; external advapi32 name 'OpenThreadToken';
{$EXTERNALSYM PrivilegeCheck}
function PrivilegeCheck; external advapi32 name 'PrivilegeCheck';
{$EXTERNALSYM PrivilegedServiceAuditAlarmA}
function PrivilegedServiceAuditAlarmA; external advapi32 name 'PrivilegedServiceAuditAlarmA';
{$EXTERNALSYM PrivilegedServiceAuditAlarmW}
function PrivilegedServiceAuditAlarmW; external advapi32 name 'PrivilegedServiceAuditAlarmW';
{$EXTERNALSYM PrivilegedServiceAuditAlarm}
function PrivilegedServiceAuditAlarm; external advapi32 name 'PrivilegedServiceAuditAlarmA';
{$EXTERNALSYM ReadEventLogA}
function ReadEventLogA; external advapi32 name 'ReadEventLogA';
{$EXTERNALSYM ReadEventLogW}
function ReadEventLogW; external advapi32 name 'ReadEventLogW';
{$EXTERNALSYM ReadEventLog}
function ReadEventLog; external advapi32 name 'ReadEventLogA';
{$EXTERNALSYM RegCloseKey}
function RegCloseKey; external advapi32 name 'RegCloseKey';
{$EXTERNALSYM RegConnectRegistryA}
function RegConnectRegistryA; external advapi32 name 'RegConnectRegistryA';
{$EXTERNALSYM RegConnectRegistryW}
function RegConnectRegistryW; external advapi32 name 'RegConnectRegistryW';
{$EXTERNALSYM RegConnectRegistry}
function RegConnectRegistry; external advapi32 name 'RegConnectRegistryA';
{$EXTERNALSYM RegCreateKeyA}
function RegCreateKeyA; external advapi32 name 'RegCreateKeyA';
{$EXTERNALSYM RegCreateKeyW}
function RegCreateKeyW; external advapi32 name 'RegCreateKeyW';
{$EXTERNALSYM RegCreateKey}
function RegCreateKey; external advapi32 name 'RegCreateKeyA';
{$EXTERNALSYM RegCreateKeyExA}
function RegCreateKeyExA; external advapi32 name 'RegCreateKeyExA';
{$EXTERNALSYM RegCreateKeyExW}
function RegCreateKeyExW; external advapi32 name 'RegCreateKeyExW';
{$EXTERNALSYM RegCreateKeyEx}
function RegCreateKeyEx; external advapi32 name 'RegCreateKeyExA';
{$EXTERNALSYM RegDeleteKeyA}
function RegDeleteKeyA; external advapi32 name 'RegDeleteKeyA';
{$EXTERNALSYM RegDeleteKeyW}
function RegDeleteKeyW; external advapi32 name 'RegDeleteKeyW';
{$EXTERNALSYM RegDeleteKey}
function RegDeleteKey; external advapi32 name 'RegDeleteKeyA';
{$EXTERNALSYM RegDeleteValueA}
function RegDeleteValueA; external advapi32 name 'RegDeleteValueA';
{$EXTERNALSYM RegDeleteValueW}
function RegDeleteValueW; external advapi32 name 'RegDeleteValueW';
{$EXTERNALSYM RegDeleteValue}
function RegDeleteValue; external advapi32 name 'RegDeleteValueA';
{$EXTERNALSYM RegEnumKeyExA}
function RegEnumKeyExA; external advapi32 name 'RegEnumKeyExA';
{$EXTERNALSYM RegEnumKeyExW}
function RegEnumKeyExW; external advapi32 name 'RegEnumKeyExW';
{$EXTERNALSYM RegEnumKeyEx}
function RegEnumKeyEx; external advapi32 name 'RegEnumKeyExA';
{$EXTERNALSYM RegEnumKeyA}
function RegEnumKeyA; external advapi32 name 'RegEnumKeyA';
{$EXTERNALSYM RegEnumKeyW}
function RegEnumKeyW; external advapi32 name 'RegEnumKeyW';
{$EXTERNALSYM RegEnumKey}
function RegEnumKey; external advapi32 name 'RegEnumKeyA';
{$EXTERNALSYM RegEnumValueA}
function RegEnumValueA; external advapi32 name 'RegEnumValueA';
{$EXTERNALSYM RegEnumValueW}
function RegEnumValueW; external advapi32 name 'RegEnumValueW';
{$EXTERNALSYM RegEnumValue}
function RegEnumValue; external advapi32 name 'RegEnumValueA';
{$EXTERNALSYM RegFlushKey}
function RegFlushKey; external advapi32 name 'RegFlushKey';
{$EXTERNALSYM RegGetKeySecurity}
function RegGetKeySecurity; external advapi32 name 'RegGetKeySecurity';
{$EXTERNALSYM RegLoadKeyA}
function RegLoadKeyA; external advapi32 name 'RegLoadKeyA';
{$EXTERNALSYM RegLoadKeyW}
function RegLoadKeyW; external advapi32 name 'RegLoadKeyW';
{$EXTERNALSYM RegLoadKey}
function RegLoadKey; external advapi32 name 'RegLoadKeyA';
{$EXTERNALSYM RegNotifyChangeKeyValue}
function RegNotifyChangeKeyValue; external advapi32 name 'RegNotifyChangeKeyValue';
{$EXTERNALSYM RegOpenKeyA}
function RegOpenKeyA; external advapi32 name 'RegOpenKeyA';
{$EXTERNALSYM RegOpenKeyW}
function RegOpenKeyW; external advapi32 name 'RegOpenKeyW';
{$EXTERNALSYM RegOpenKey}
function RegOpenKey; external advapi32 name 'RegOpenKeyA';
{$EXTERNALSYM RegOpenKeyExA}
function RegOpenKeyExA; external advapi32 name 'RegOpenKeyExA';
{$EXTERNALSYM RegOpenKeyExW}
function RegOpenKeyExW; external advapi32 name 'RegOpenKeyExW';
{$EXTERNALSYM RegOpenKeyEx}
function RegOpenKeyEx; external advapi32 name 'RegOpenKeyExA';
{$EXTERNALSYM RegQueryInfoKeyA}
function RegQueryInfoKeyA; external advapi32 name 'RegQueryInfoKeyA';
{$EXTERNALSYM RegQueryInfoKeyW}
function RegQueryInfoKeyW; external advapi32 name 'RegQueryInfoKeyW';
{$EXTERNALSYM RegQueryInfoKey}
function RegQueryInfoKey; external advapi32 name 'RegQueryInfoKeyA';
{$EXTERNALSYM RegQueryMultipleValuesA}
function RegQueryMultipleValuesA; external advapi32 name 'RegQueryMultipleValuesA';
{$EXTERNALSYM RegQueryMultipleValuesW}
function RegQueryMultipleValuesW; external advapi32 name 'RegQueryMultipleValuesW';
{$EXTERNALSYM RegQueryMultipleValues}
function RegQueryMultipleValues; external advapi32 name 'RegQueryMultipleValuesA';
{$EXTERNALSYM RegQueryValueA}
function RegQueryValueA; external advapi32 name 'RegQueryValueA';
{$EXTERNALSYM RegQueryValueW}
function RegQueryValueW; external advapi32 name 'RegQueryValueW';
{$EXTERNALSYM RegQueryValue}
function RegQueryValue; external advapi32 name 'RegQueryValueA';
{$EXTERNALSYM RegQueryValueExA}
function RegQueryValueExA; external advapi32 name 'RegQueryValueExA';
{$EXTERNALSYM RegQueryValueExW}
function RegQueryValueExW; external advapi32 name 'RegQueryValueExW';
{$EXTERNALSYM RegQueryValueEx}
function RegQueryValueEx; external advapi32 name 'RegQueryValueExA';
{$EXTERNALSYM RegReplaceKeyA}
function RegReplaceKeyA; external advapi32 name 'RegReplaceKeyA';
{$EXTERNALSYM RegReplaceKeyW}
function RegReplaceKeyW; external advapi32 name 'RegReplaceKeyW';
{$EXTERNALSYM RegReplaceKey}
function RegReplaceKey; external advapi32 name 'RegReplaceKeyA';
{$EXTERNALSYM RegRestoreKeyA}
function RegRestoreKeyA; external advapi32 name 'RegRestoreKeyA';
{$EXTERNALSYM RegRestoreKeyW}
function RegRestoreKeyW; external advapi32 name 'RegRestoreKeyW';
{$EXTERNALSYM RegRestoreKey}
function RegRestoreKey; external advapi32 name 'RegRestoreKeyA';
{$EXTERNALSYM RegSaveKeyA}
function RegSaveKeyA; external advapi32 name 'RegSaveKeyA';
{$EXTERNALSYM RegSaveKeyW}
function RegSaveKeyW; external advapi32 name 'RegSaveKeyW';
{$EXTERNALSYM RegSaveKey}
function RegSaveKey; external advapi32 name 'RegSaveKeyA';
{$EXTERNALSYM RegSetKeySecurity}
function RegSetKeySecurity; external advapi32 name 'RegSetKeySecurity';
{$EXTERNALSYM RegSetValueA}
function RegSetValueA; external advapi32 name 'RegSetValueA';
{$EXTERNALSYM RegSetValueW}
function RegSetValueW; external advapi32 name 'RegSetValueW';
{$EXTERNALSYM RegSetValue}
function RegSetValue; external advapi32 name 'RegSetValueA';
{$EXTERNALSYM RegSetValueExA}
function RegSetValueExA; external advapi32 name 'RegSetValueExA';
{$EXTERNALSYM RegSetValueExW}
function RegSetValueExW; external advapi32 name 'RegSetValueExW';
{$EXTERNALSYM RegSetValueEx}
function RegSetValueEx; external advapi32 name 'RegSetValueExA';
{$EXTERNALSYM RegUnLoadKeyA}
function RegUnLoadKeyA; external advapi32 name 'RegUnLoadKeyA';
{$EXTERNALSYM RegUnLoadKeyW}
function RegUnLoadKeyW; external advapi32 name 'RegUnLoadKeyW';
{$EXTERNALSYM RegUnLoadKey}
function RegUnLoadKey; external advapi32 name 'RegUnLoadKeyA';
{$EXTERNALSYM RegisterEventSourceA}
function RegisterEventSourceA; external advapi32 name 'RegisterEventSourceA';
{$EXTERNALSYM RegisterEventSourceW}
function RegisterEventSourceW; external advapi32 name 'RegisterEventSourceW';
{$EXTERNALSYM RegisterEventSource}
function RegisterEventSource; external advapi32 name 'RegisterEventSourceA';
{$EXTERNALSYM ReportEventA}
function ReportEventA; external advapi32 name 'ReportEventA';
{$EXTERNALSYM ReportEventW}
function ReportEventW; external advapi32 name 'ReportEventW';
{$EXTERNALSYM ReportEvent}
function ReportEvent; external advapi32 name 'ReportEventA';
{$EXTERNALSYM RevertToSelf}
function RevertToSelf; external advapi32 name 'RevertToSelf';
{$EXTERNALSYM SetAclInformation}
function SetAclInformation; external advapi32 name 'SetAclInformation';
{$EXTERNALSYM SetFileSecurityA}
function SetFileSecurityA; external advapi32 name 'SetFileSecurityA';
{$EXTERNALSYM SetFileSecurityW}
function SetFileSecurityW; external advapi32 name 'SetFileSecurityW';
{$EXTERNALSYM SetFileSecurity}
function SetFileSecurity; external advapi32 name 'SetFileSecurityA';
{$EXTERNALSYM SetKernelObjectSecurity}
function SetKernelObjectSecurity; external advapi32 name 'SetKernelObjectSecurity';
{$EXTERNALSYM SetPrivateObjectSecurity}
function SetPrivateObjectSecurity; external advapi32 name 'SetPrivateObjectSecurity';
{$EXTERNALSYM SetPrivateObjectSecurityEx}
function SetPrivateObjectSecurityEx; external advapi32 name 'SetPrivateObjectSecurityEx';
{$EXTERNALSYM SetSecurityDescriptorControl}
function SetSecurityDescriptorControl; external advapi32 name 'SetSecurityDescriptorControl';
{$EXTERNALSYM SetSecurityDescriptorDacl}
function SetSecurityDescriptorDacl; external advapi32 name 'SetSecurityDescriptorDacl';
{$EXTERNALSYM SetSecurityDescriptorGroup}
function SetSecurityDescriptorGroup; external advapi32 name 'SetSecurityDescriptorGroup';
{$EXTERNALSYM SetSecurityDescriptorOwner}
function SetSecurityDescriptorOwner; external advapi32 name 'SetSecurityDescriptorOwner';
{$EXTERNALSYM SetSecurityDescriptorSacl}
function SetSecurityDescriptorSacl; external advapi32 name 'SetSecurityDescriptorSacl';
{$EXTERNALSYM SetThreadToken}
function SetThreadToken; external advapi32 name 'SetThreadToken';
{$EXTERNALSYM SetTokenInformation}
function SetTokenInformation; external advapi32 name 'SetTokenInformation';

{ Externals from imaghlp.dll }

{ !!! these fuctions are not yet available in this dll
function WinSubmitCertificate; external imaghlp name 'WinSubmitCertificate';
function WinVerifyTrust; external imaghlp name 'WinVerifyTrust'; }

{ Externals from kernel32.dll }

{$EXTERNALSYM AddAtomA}
function AddAtomA; external kernel32 name 'AddAtomA';
{$EXTERNALSYM AddAtomW}
function AddAtomW; external kernel32 name 'AddAtomW';
{$EXTERNALSYM AddAtom}
function AddAtom; external kernel32 name 'AddAtomA';
{$EXTERNALSYM AllocConsole}
function AllocConsole; external kernel32 name 'AllocConsole';
{$EXTERNALSYM AreFileApisANSI}
function AreFileApisANSI; external kernel32 name 'AreFileApisANSI';
{$EXTERNALSYM BackupRead}
function BackupRead; external kernel32 name 'BackupRead';
{$EXTERNALSYM BackupSeek}
function BackupSeek; external kernel32 name 'BackupSeek';
{$EXTERNALSYM BackupWrite}
function BackupWrite; external kernel32 name 'BackupWrite';
{$EXTERNALSYM Beep}
function Beep; external kernel32 name 'Beep';
{$EXTERNALSYM BeginUpdateResourceA}
function BeginUpdateResourceA; external kernel32 name 'BeginUpdateResourceA';
{$EXTERNALSYM BeginUpdateResourceW}
function BeginUpdateResourceW; external kernel32 name 'BeginUpdateResourceW';
{$EXTERNALSYM BeginUpdateResource}
function BeginUpdateResource; external kernel32 name 'BeginUpdateResourceA';
{$EXTERNALSYM BuildCommDCBA}
function BuildCommDCBA; external kernel32 name 'BuildCommDCBA';
{$EXTERNALSYM BuildCommDCBW}
function BuildCommDCBW; external kernel32 name 'BuildCommDCBW';
{$EXTERNALSYM BuildCommDCB}
function BuildCommDCB; external kernel32 name 'BuildCommDCBA';
{$EXTERNALSYM BuildCommDCBAndTimeoutsA}
function BuildCommDCBAndTimeoutsA; external kernel32 name 'BuildCommDCBAndTimeoutsA';
{$EXTERNALSYM BuildCommDCBAndTimeoutsW}
function BuildCommDCBAndTimeoutsW; external kernel32 name 'BuildCommDCBAndTimeoutsW';
{$EXTERNALSYM BuildCommDCBAndTimeouts}
function BuildCommDCBAndTimeouts; external kernel32 name 'BuildCommDCBAndTimeoutsA';
{$EXTERNALSYM CallNamedPipeA}
function CallNamedPipeA; external kernel32 name 'CallNamedPipeA';
{$EXTERNALSYM CallNamedPipeW}
function CallNamedPipeW; external kernel32 name 'CallNamedPipeW';
{$EXTERNALSYM CallNamedPipe}
function CallNamedPipe; external kernel32 name 'CallNamedPipeA';
{$EXTERNALSYM CancelIo}
function CancelIo; external kernel32 name 'CancelIo';
{$EXTERNALSYM CancelWaitableTimer}
function CancelWaitableTimer; external kernel32 name 'CancelWaitableTimer';
{$EXTERNALSYM ClearCommBreak}
function ClearCommBreak; external kernel32 name 'ClearCommBreak';
{$EXTERNALSYM ClearCommError}
function ClearCommError; external kernel32 name 'ClearCommError';
{$EXTERNALSYM CloseHandle}
function CloseHandle; external kernel32 name 'CloseHandle';
{$EXTERNALSYM CloseRaw}
function CloseRaw; external kernel32 name 'CloseRaw';
{$EXTERNALSYM CommConfigDialogA}
function CommConfigDialogA; external kernel32 name 'CommConfigDialogA';
{$EXTERNALSYM CommConfigDialogW}
function CommConfigDialogW; external kernel32 name 'CommConfigDialogW';
{$EXTERNALSYM CommConfigDialog}
function CommConfigDialog; external kernel32 name 'CommConfigDialogA';
{$EXTERNALSYM CompareFileTime}
function CompareFileTime; external kernel32 name 'CompareFileTime';
{$EXTERNALSYM CompareStringA}
function CompareStringA; external kernel32 name 'CompareStringA';
{$EXTERNALSYM CompareStringW}
function CompareStringW; external kernel32 name 'CompareStringW';
{$EXTERNALSYM CompareString}
function CompareString; external kernel32 name 'CompareStringA';
{$EXTERNALSYM ConnectNamedPipe}
function ConnectNamedPipe; external kernel32 name 'ConnectNamedPipe';
{$EXTERNALSYM ContinueDebugEvent}
function ContinueDebugEvent; external kernel32 name 'ContinueDebugEvent';
function ConvertThreadToFiber; external kernel32 name 'ConvertThreadToFiber';
{$EXTERNALSYM ConvertDefaultLocale}
function ConvertDefaultLocale; external kernel32 name 'ConvertDefaultLocale';
{$EXTERNALSYM CopyFileA}
function CopyFileA; external kernel32 name 'CopyFileA';
{$EXTERNALSYM CopyFileExA}
function CopyFileExA; external kernel32 name 'CopyFileExA';
{$EXTERNALSYM CopyFileW}
function CopyFileW; external kernel32 name 'CopyFileW';
{$EXTERNALSYM CopyFileExW}
function CopyFileExW; external kernel32 name 'CopyFileExW';
{$EXTERNALSYM CopyFile}
function CopyFile; external kernel32 name 'CopyFileA';
{$EXTERNALSYM CopyFileEx}
function CopyFileEx; external kernel32 name 'CopyFileExA';
{$EXTERNALSYM CreateConsoleScreenBuffer}
function CreateConsoleScreenBuffer; external kernel32 name 'CreateConsoleScreenBuffer';
{$EXTERNALSYM CreateDirectoryA}
function CreateDirectoryA; external kernel32 name 'CreateDirectoryA';
{$EXTERNALSYM CreateDirectoryW}
function CreateDirectoryW; external kernel32 name 'CreateDirectoryW';
{$EXTERNALSYM CreateDirectory}
function CreateDirectory; external kernel32 name 'CreateDirectoryA';
{$EXTERNALSYM CreateDirectoryExA}
function CreateDirectoryExA; external kernel32 name 'CreateDirectoryExA';
{$EXTERNALSYM CreateDirectoryExW}
function CreateDirectoryExW; external kernel32 name 'CreateDirectoryExW';
{$EXTERNALSYM CreateDirectoryEx}
function CreateDirectoryEx; external kernel32 name 'CreateDirectoryExA';
{$EXTERNALSYM CreateEventA}
function CreateEventA; external kernel32 name 'CreateEventA';
{$EXTERNALSYM CreateEventW}
function CreateEventW; external kernel32 name 'CreateEventW';
{$EXTERNALSYM CreateEvent}
function CreateEvent; external kernel32 name 'CreateEventA';
function CreateFiber; external kernel32 name 'CreateFiber';
{$EXTERNALSYM CreateFileA}
function CreateFileA; external kernel32 name 'CreateFileA';
{$EXTERNALSYM CreateFileW}
function CreateFileW; external kernel32 name 'CreateFileW';
{$EXTERNALSYM CreateFile}
function CreateFile; external kernel32 name 'CreateFileA';
{$EXTERNALSYM CreateFileMappingA}
function CreateFileMappingA; external kernel32 name 'CreateFileMappingA';
{$EXTERNALSYM CreateFileMappingW}
function CreateFileMappingW; external kernel32 name 'CreateFileMappingW';
{$EXTERNALSYM CreateFileMapping}
function CreateFileMapping; external kernel32 name 'CreateFileMappingA';
{$EXTERNALSYM CreateHardLinkA}
function CreateHardLinkA; external kernel32 name 'CreateHardLinkA';
{$EXTERNALSYM CreateHardLinkW}
function CreateHardLinkW; external kernel32 name 'CreateHardLinkW';
{$EXTERNALSYM CreateHardLink}
function CreateHardLink; external kernel32 name 'CreateHardLinkA';
{$EXTERNALSYM CreateIoCompletionPort}
function CreateIoCompletionPort; external kernel32 name 'CreateIoCompletionPort';
{$EXTERNALSYM CreateMailslotA}
function CreateMailslotA; external kernel32 name 'CreateMailslotA';
{$EXTERNALSYM CreateMailslotW}
function CreateMailslotW; external kernel32 name 'CreateMailslotW';
{$EXTERNALSYM CreateMailslot}
function CreateMailslot; external kernel32 name 'CreateMailslotA';
{$EXTERNALSYM CreateMutexA}
function CreateMutexA; external kernel32 name 'CreateMutexA';
{$EXTERNALSYM CreateMutexW}
function CreateMutexW; external kernel32 name 'CreateMutexW';
{$EXTERNALSYM CreateMutex}
function CreateMutex; external kernel32 name 'CreateMutexA';
{$EXTERNALSYM CreateNamedPipeA}
function CreateNamedPipeA; external kernel32 name 'CreateNamedPipeA';
{$EXTERNALSYM CreateNamedPipeW}
function CreateNamedPipeW; external kernel32 name 'CreateNamedPipeW';
{$EXTERNALSYM CreateNamedPipe}
function CreateNamedPipe; external kernel32 name 'CreateNamedPipeA';
{$EXTERNALSYM CreatePipe}
function CreatePipe; external kernel32 name 'CreatePipe';
{$EXTERNALSYM CreateProcessA}
function CreateProcessA; external kernel32 name 'CreateProcessA';
{$EXTERNALSYM CreateProcessW}
function CreateProcessW; external kernel32 name 'CreateProcessW';
{$EXTERNALSYM CreateProcess}
function CreateProcess; external kernel32 name 'CreateProcessA';
{$EXTERNALSYM CreateRemoteThread}
function CreateRemoteThread; external kernel32 name 'CreateRemoteThread';
{$EXTERNALSYM CreateSemaphoreA}
function CreateSemaphoreA; external kernel32 name 'CreateSemaphoreA';
{$EXTERNALSYM CreateSemaphoreW}
function CreateSemaphoreW; external kernel32 name 'CreateSemaphoreW';
{$EXTERNALSYM CreateSemaphore}
function CreateSemaphore; external kernel32 name 'CreateSemaphoreA';
{$EXTERNALSYM CreateTapePartition}
function CreateTapePartition; external kernel32 name 'CreateTapePartition';
{$EXTERNALSYM CreateThread}
function CreateThread; external kernel32 name 'CreateThread';
{$EXTERNALSYM CreateWaitableTimerA}
function CreateWaitableTimerA; external kernel32 name 'CreateWaitableTimerA';
{$EXTERNALSYM CreateWaitableTimerW}
function CreateWaitableTimerW; external kernel32 name 'CreateWaitableTimerW';
{$EXTERNALSYM CreateWaitableTimer}
function CreateWaitableTimer; external kernel32 name 'CreateWaitableTimerA';
{$EXTERNALSYM DecryptFileA}
function DecryptFileA; external kernel32 name 'DecryptFileA';
{$EXTERNALSYM DecryptFileW}
function DecryptFileW; external kernel32 name 'DecryptFileW';
{$EXTERNALSYM DecryptFile}
function DecryptFile; external kernel32 name 'DecryptFile';
{$EXTERNALSYM DebugActiveProcess}
function DebugActiveProcess; external kernel32 name 'DebugActiveProcess';
{$EXTERNALSYM DebugBreak}
procedure DebugBreak; external kernel32 name 'DebugBreak';
{$EXTERNALSYM DefineDosDeviceA}
function DefineDosDeviceA; external kernel32 name 'DefineDosDeviceA';
{$EXTERNALSYM DefineDosDeviceW}
function DefineDosDeviceW; external kernel32 name 'DefineDosDeviceW';
{$EXTERNALSYM DefineDosDevice}
function DefineDosDevice; external kernel32 name 'DefineDosDeviceA';
{$EXTERNALSYM DeleteAtom}
function DeleteAtom; external kernel32 name 'DeleteAtom';
{$EXTERNALSYM DeleteCriticalSection}
procedure DeleteCriticalSection; external kernel32 name 'DeleteCriticalSection';
function DeleteFiber; external kernel32 name 'DeleteFiber';
{$EXTERNALSYM DeleteFileA}
function DeleteFileA; external kernel32 name 'DeleteFileA';
{$EXTERNALSYM DeleteFileW}
function DeleteFileW; external kernel32 name 'DeleteFileW';
{$EXTERNALSYM DeleteFile}
function DeleteFile; external kernel32 name 'DeleteFileA';
{$EXTERNALSYM DeviceIoControl}
function DeviceIoControl; external kernel32 name 'DeviceIoControl';
{$EXTERNALSYM DisableThreadLibraryCalls}
function DisableThreadLibraryCalls; external kernel32 name 'DisableThreadLibraryCalls';
{$EXTERNALSYM DisconnectNamedPipe}
function DisconnectNamedPipe; external kernel32 name 'DisconnectNamedPipe';
{$EXTERNALSYM DosDateTimeToFileTime}
function DosDateTimeToFileTime; external kernel32 name 'DosDateTimeToFileTime';
{$EXTERNALSYM DuplicateHandle}
function DuplicateHandle; external kernel32 name 'DuplicateHandle';
{$EXTERNALSYM EncryptFileA}
function EncryptFileA; external kernel32 name 'EncryptFileA';
{$EXTERNALSYM EncryptFileW}
function EncryptFileW; external kernel32 name 'EncryptFileW';
{$EXTERNALSYM EncryptFile}
function EncryptFile; external kernel32 name 'EncryptFile';
{$EXTERNALSYM EndUpdateResourceA}
function EndUpdateResourceA; external kernel32 name 'EndUpdateResourceA';
{$EXTERNALSYM EndUpdateResourceW}
function EndUpdateResourceW; external kernel32 name 'EndUpdateResourceW';
{$EXTERNALSYM EndUpdateResource}
function EndUpdateResource; external kernel32 name 'EndUpdateResourceA';
{$EXTERNALSYM EnterCriticalSection}
procedure EnterCriticalSection; external kernel32 name 'EnterCriticalSection';
{$EXTERNALSYM EnumCalendarInfoA}
function EnumCalendarInfoA; external kernel32 name 'EnumCalendarInfoA';
{$EXTERNALSYM EnumCalendarInfoW}
function EnumCalendarInfoW; external kernel32 name 'EnumCalendarInfoW';
{$EXTERNALSYM EnumCalendarInfo}
function EnumCalendarInfo; external kernel32 name 'EnumCalendarInfoA';
{$EXTERNALSYM EnumDateFormatsA}
function EnumDateFormatsA; external kernel32 name 'EnumDateFormatsA';
{$EXTERNALSYM EnumDateFormatsW}
function EnumDateFormatsW; external kernel32 name 'EnumDateFormatsW';
{$EXTERNALSYM EnumDateFormats}
function EnumDateFormats; external kernel32 name 'EnumDateFormatsA';
{$EXTERNALSYM EnumResourceLanguagesA}
function EnumResourceLanguagesA; external kernel32 name 'EnumResourceLanguagesA';
{$EXTERNALSYM EnumResourceLanguagesW}
function EnumResourceLanguagesW; external kernel32 name 'EnumResourceLanguagesW';
{$EXTERNALSYM EnumResourceLanguages}
function EnumResourceLanguages; external kernel32 name 'EnumResourceLanguagesA';
{$EXTERNALSYM EnumResourceNamesA}
function EnumResourceNamesA; external kernel32 name 'EnumResourceNamesA';
{$EXTERNALSYM EnumResourceNamesW}
function EnumResourceNamesW; external kernel32 name 'EnumResourceNamesW';
{$EXTERNALSYM EnumResourceNames}
function EnumResourceNames; external kernel32 name 'EnumResourceNamesA';
{$EXTERNALSYM EnumResourceTypesA}
function EnumResourceTypesA; external kernel32 name 'EnumResourceTypesA';
{$EXTERNALSYM EnumResourceTypesW}
function EnumResourceTypesW; external kernel32 name 'EnumResourceTypesW';
{$EXTERNALSYM EnumResourceTypes}
function EnumResourceTypes; external kernel32 name 'EnumResourceTypesA';
{$EXTERNALSYM EnumSystemCodePagesA}
function EnumSystemCodePagesA; external kernel32 name 'EnumSystemCodePagesA';
{$EXTERNALSYM EnumSystemCodePagesW}
function EnumSystemCodePagesW; external kernel32 name 'EnumSystemCodePagesW';
{$EXTERNALSYM EnumSystemCodePages}
function EnumSystemCodePages; external kernel32 name 'EnumSystemCodePagesA';
{$EXTERNALSYM EnumSystemLocalesA}
function EnumSystemLocalesA; external kernel32 name 'EnumSystemLocalesA';
{$EXTERNALSYM EnumSystemLocalesW}
function EnumSystemLocalesW; external kernel32 name 'EnumSystemLocalesW';
{$EXTERNALSYM EnumSystemLocales}
function EnumSystemLocales; external kernel32 name 'EnumSystemLocalesA';
{$EXTERNALSYM EnumTimeFormatsA}
function EnumTimeFormatsA; external kernel32 name 'EnumTimeFormatsA';
{$EXTERNALSYM EnumTimeFormatsW}
function EnumTimeFormatsW; external kernel32 name 'EnumTimeFormatsW';
{$EXTERNALSYM EnumTimeFormats}
function EnumTimeFormats; external kernel32 name 'EnumTimeFormatsA';
{$EXTERNALSYM EraseTape}
function EraseTape; external kernel32 name 'EraseTape';
{$EXTERNALSYM EscapeCommFunction}
function EscapeCommFunction; external kernel32 name 'EscapeCommFunction';
{$EXTERNALSYM ExitProcess}
procedure ExitProcess; external kernel32 name 'ExitProcess';
{$EXTERNALSYM ExitThread}
procedure ExitThread; external kernel32 name 'ExitThread';
{$EXTERNALSYM ExpandEnvironmentStringsA}
function ExpandEnvironmentStringsA; external kernel32 name 'ExpandEnvironmentStringsA';
{$EXTERNALSYM ExpandEnvironmentStringsW}
function ExpandEnvironmentStringsW; external kernel32 name 'ExpandEnvironmentStringsW';
{$EXTERNALSYM ExpandEnvironmentStrings}
function ExpandEnvironmentStrings; external kernel32 name 'ExpandEnvironmentStringsA';
{$EXTERNALSYM FatalAppExitA}
procedure FatalAppExitA; external kernel32 name 'FatalAppExitA';
{$EXTERNALSYM FatalAppExitW}
procedure FatalAppExitW; external kernel32 name 'FatalAppExitW';
{$EXTERNALSYM FatalAppExit}
procedure FatalAppExit; external kernel32 name 'FatalAppExitA';
{$EXTERNALSYM FatalExit}
procedure FatalExit; external kernel32 name 'FatalExit';
{$EXTERNALSYM FileTimeToDosDateTime}
function FileTimeToDosDateTime; external kernel32 name 'FileTimeToDosDateTime';
{$EXTERNALSYM FileTimeToLocalFileTime}
function FileTimeToLocalFileTime; external kernel32 name 'FileTimeToLocalFileTime';
{$EXTERNALSYM FileTimeToSystemTime}
function FileTimeToSystemTime; external kernel32 name 'FileTimeToSystemTime';
{$EXTERNALSYM FillConsoleOutputAttribute}
function FillConsoleOutputAttribute; external kernel32 name 'FillConsoleOutputAttribute';
{$EXTERNALSYM FillConsoleOutputCharacterA}
function FillConsoleOutputCharacterA; external kernel32 name 'FillConsoleOutputCharacterA';
{$EXTERNALSYM FillConsoleOutputCharacterW}
function FillConsoleOutputCharacterW; external kernel32 name 'FillConsoleOutputCharacterW';
{$EXTERNALSYM FillConsoleOutputCharacter}
function FillConsoleOutputCharacter; external kernel32 name 'FillConsoleOutputCharacterA';
{$EXTERNALSYM FindAtomA}
function FindAtomA; external kernel32 name 'FindAtomA';
{$EXTERNALSYM FindAtomW}
function FindAtomW; external kernel32 name 'FindAtomW';
{$EXTERNALSYM FindAtom}
function FindAtom; external kernel32 name 'FindAtomA';
{$EXTERNALSYM FindClose}
function FindClose; external kernel32 name 'FindClose';
{$EXTERNALSYM FindCloseChangeNotification}
function FindCloseChangeNotification; external kernel32 name 'FindCloseChangeNotification';
{$EXTERNALSYM FindFirstChangeNotificationA}
function FindFirstChangeNotificationA; external kernel32 name 'FindFirstChangeNotificationA';
{$EXTERNALSYM FindFirstChangeNotificationW}
function FindFirstChangeNotificationW; external kernel32 name 'FindFirstChangeNotificationW';
{$EXTERNALSYM FindFirstChangeNotification}
function FindFirstChangeNotification; external kernel32 name 'FindFirstChangeNotificationA';
{$EXTERNALSYM FindFirstFileA}
function FindFirstFileA; external kernel32 name 'FindFirstFileA';
function FindFirstFileExA; external kernel32 name 'FindFirstFileExA';
{$EXTERNALSYM FindFirstFileW}
function FindFirstFileW; external kernel32 name 'FindFirstFileW';
function FindFirstFileExW; external kernel32 name 'FindFirstFileExW';
{$EXTERNALSYM FindFirstFile}
function FindFirstFile; external kernel32 name 'FindFirstFileA';
function FindFirstFileEx; external kernel32 name 'FindFirstFileExA';
{$EXTERNALSYM FindNextChangeNotification}
function FindNextChangeNotification; external kernel32 name 'FindNextChangeNotification';
{$EXTERNALSYM FindNextFileA}
function FindNextFileA; external kernel32 name 'FindNextFileA';
{$EXTERNALSYM FindNextFileW}
function FindNextFileW; external kernel32 name 'FindNextFileW';
{$EXTERNALSYM FindNextFile}
function FindNextFile; external kernel32 name 'FindNextFileA';
{$EXTERNALSYM FindResourceA}
function FindResourceA; external kernel32 name 'FindResourceA';
{$EXTERNALSYM FindResourceW}
function FindResourceW; external kernel32 name 'FindResourceW';
{$EXTERNALSYM FindResource}
function FindResource; external kernel32 name 'FindResourceA';
{$EXTERNALSYM FindResourceExA}
function FindResourceExA; external kernel32 name 'FindResourceExA';
{$EXTERNALSYM FindResourceExW}
function FindResourceExW; external kernel32 name 'FindResourceExW';
{$EXTERNALSYM FindResourceEx}
function FindResourceEx; external kernel32 name 'FindResourceExA';
{$EXTERNALSYM FlushConsoleInputBuffer}
function FlushConsoleInputBuffer; external kernel32 name 'FlushConsoleInputBuffer';
{$EXTERNALSYM FlushFileBuffers}
function FlushFileBuffers; external kernel32 name 'FlushFileBuffers';
{$EXTERNALSYM FlushInstructionCache}
function FlushInstructionCache; external kernel32 name 'FlushInstructionCache';
{$EXTERNALSYM FlushViewOfFile}
function FlushViewOfFile; external kernel32 name 'FlushViewOfFile';
{$EXTERNALSYM FoldStringA}
function FoldStringA; external kernel32 name 'FoldStringA';
{$EXTERNALSYM FoldStringW}
function FoldStringW; external kernel32 name 'FoldStringW';
{$EXTERNALSYM FoldString}
function FoldString; external kernel32 name 'FoldStringA';
{$EXTERNALSYM FormatMessageA}
function FormatMessageA; external kernel32 name 'FormatMessageA';
{$EXTERNALSYM FormatMessageW}
function FormatMessageW; external kernel32 name 'FormatMessageW';
{$EXTERNALSYM FormatMessage}
function FormatMessage; external kernel32 name 'FormatMessageA';
{$EXTERNALSYM FreeConsole}
function FreeConsole; external kernel32 name 'FreeConsole';
{$EXTERNALSYM FreeEnvironmentStringsA}
function FreeEnvironmentStringsA; external kernel32 name 'FreeEnvironmentStringsA';
{$EXTERNALSYM FreeEnvironmentStringsW}
function FreeEnvironmentStringsW; external kernel32 name 'FreeEnvironmentStringsW';
{$EXTERNALSYM FreeEnvironmentStrings}
function FreeEnvironmentStrings; external kernel32 name 'FreeEnvironmentStringsA';
{$EXTERNALSYM FreeLibrary}
function FreeLibrary; external kernel32 name 'FreeLibrary';
{$EXTERNALSYM FreeLibraryAndExitThread}
procedure FreeLibraryAndExitThread; external kernel32 name 'FreeLibraryAndExitThread';
{$EXTERNALSYM InterlockedCompareExchange}
function InterlockedCompareExchange; external kernel32 name 'InterlockedCompareExchange';
{$EXTERNALSYM InterlockedDecrement}
function InterlockedDecrement; external kernel32 name 'InterlockedDecrement';
{$EXTERNALSYM InterlockedExchange}
function InterlockedExchange; external kernel32 name 'InterlockedExchange';
{$EXTERNALSYM InterlockedExchangeAdd}
function InterlockedExchangeAdd; external kernel32 name 'InterlockedExchangeAdd';
{$EXTERNALSYM InterlockedIncrement}
function InterlockedIncrement; external kernel32 name 'InterlockedIncrement';
{$EXTERNALSYM FreeResource}
function FreeResource; external kernel32 name 'FreeResource';
{$EXTERNALSYM GenerateConsoleCtrlEvent}
function GenerateConsoleCtrlEvent; external kernel32 name 'GenerateConsoleCtrlEvent';
{$EXTERNALSYM GetACP}
function GetACP; external kernel32 name 'GetACP';
{$EXTERNALSYM GetAtomNameA}
function GetAtomNameA; external kernel32 name 'GetAtomNameA';
{$EXTERNALSYM GetAtomNameW}
function GetAtomNameW; external kernel32 name 'GetAtomNameW';
{$EXTERNALSYM GetAtomName}
function GetAtomName; external kernel32 name 'GetAtomNameA';
{$EXTERNALSYM GetBinaryTypeA}
function GetBinaryTypeA; external kernel32 name 'GetBinaryTypeA';
{$EXTERNALSYM GetBinaryTypeW}
function GetBinaryTypeW; external kernel32 name 'GetBinaryTypeW';
{$EXTERNALSYM GetBinaryType}
function GetBinaryType; external kernel32 name 'GetBinaryTypeA';
{$EXTERNALSYM GetCPInfo}
function GetCPInfo; external kernel32 name 'GetCPInfo';
{$EXTERNALSYM GetCommandLineA}
function GetCommandLineA; external kernel32 name 'GetCommandLineA';
{$EXTERNALSYM GetCommandLineW}
function GetCommandLineW; external kernel32 name 'GetCommandLineW';
{$EXTERNALSYM GetCommandLine}
function GetCommandLine; external kernel32 name 'GetCommandLineA';
{$EXTERNALSYM GetCommConfig}
function GetCommConfig; external kernel32 name 'GetCommConfig';
{$EXTERNALSYM GetCommMask}
function GetCommMask; external kernel32 name 'GetCommMask';
{$EXTERNALSYM GetCommModemStatus}
function GetCommModemStatus; external kernel32 name 'GetCommModemStatus';
{$EXTERNALSYM GetCommProperties}
function GetCommProperties; external kernel32 name 'GetCommProperties';
{$EXTERNALSYM GetCommState}
function GetCommState; external kernel32 name 'GetCommState';
{$EXTERNALSYM GetCommTimeouts}
function GetCommTimeouts; external kernel32 name 'GetCommTimeouts';
{$EXTERNALSYM GetCompressedFileSizeA}
function GetCompressedFileSizeA; external kernel32 name 'GetCompressedFileSizeA';
{$EXTERNALSYM GetCompressedFileSizeW}
function GetCompressedFileSizeW; external kernel32 name 'GetCompressedFileSizeW';
{$EXTERNALSYM GetCompressedFileSize}
function GetCompressedFileSize; external kernel32 name 'GetCompressedFileSizeA';
{$EXTERNALSYM GetComputerNameA}
function GetComputerNameA; external kernel32 name 'GetComputerNameA';
{$EXTERNALSYM GetComputerNameW}
function GetComputerNameW; external kernel32 name 'GetComputerNameW';
{$EXTERNALSYM GetComputerName}
function GetComputerName; external kernel32 name 'GetComputerNameA';
{$EXTERNALSYM GetConsoleCP}
function GetConsoleCP; external kernel32 name 'GetConsoleCP';
{$EXTERNALSYM GetConsoleCursorInfo}
function GetConsoleCursorInfo; external kernel32 name 'GetConsoleCursorInfo';
{$EXTERNALSYM GetConsoleMode}
function GetConsoleMode; external kernel32 name 'GetConsoleMode';
{$EXTERNALSYM GetConsoleOutputCP}
function GetConsoleOutputCP; external kernel32 name 'GetConsoleOutputCP';
{$EXTERNALSYM GetConsoleScreenBufferInfo}
function GetConsoleScreenBufferInfo; external kernel32 name 'GetConsoleScreenBufferInfo';
{$EXTERNALSYM GetConsoleTitleA}
function GetConsoleTitleA; external kernel32 name 'GetConsoleTitleA';
{$EXTERNALSYM GetConsoleTitleW}
function GetConsoleTitleW; external kernel32 name 'GetConsoleTitleW';
{$EXTERNALSYM GetConsoleTitle}
function GetConsoleTitle; external kernel32 name 'GetConsoleTitleA';
{$EXTERNALSYM GetCurrencyFormatA}
function GetCurrencyFormatA; external kernel32 name 'GetCurrencyFormatA';
{$EXTERNALSYM GetCurrencyFormatW}
function GetCurrencyFormatW; external kernel32 name 'GetCurrencyFormatW';
{$EXTERNALSYM GetCurrencyFormat}
function GetCurrencyFormat; external kernel32 name 'GetCurrencyFormatA';
{$EXTERNALSYM GetCurrentDirectoryA}
function GetCurrentDirectoryA; external kernel32 name 'GetCurrentDirectoryA';
{$EXTERNALSYM GetCurrentDirectoryW}
function GetCurrentDirectoryW; external kernel32 name 'GetCurrentDirectoryW';
{$EXTERNALSYM GetCurrentDirectory}
function GetCurrentDirectory; external kernel32 name 'GetCurrentDirectoryA';
{$EXTERNALSYM GetCurrentProcess}
function GetCurrentProcess; external kernel32 name 'GetCurrentProcess';
{$EXTERNALSYM GetCurrentProcessId}
function GetCurrentProcessId; external kernel32 name 'GetCurrentProcessId';
{$EXTERNALSYM GetCurrentThread}
function GetCurrentThread; external kernel32 name 'GetCurrentThread';
{$EXTERNALSYM GetCurrentThreadId}
function GetCurrentThreadId; external kernel32 name 'GetCurrentThreadId';
{$EXTERNALSYM GetDateFormatA}
function GetDateFormatA; external kernel32 name 'GetDateFormatA';
{$EXTERNALSYM GetDateFormatW}
function GetDateFormatW; external kernel32 name 'GetDateFormatW';
{$EXTERNALSYM GetDateFormat}
function GetDateFormat; external kernel32 name 'GetDateFormatA';
{$EXTERNALSYM GetDefaultCommConfigA}
function GetDefaultCommConfigA; external kernel32 name 'GetDefaultCommConfigA';
{$EXTERNALSYM GetDefaultCommConfigW}
function GetDefaultCommConfigW; external kernel32 name 'GetDefaultCommConfigW';
{$EXTERNALSYM GetDefaultCommConfig}
function GetDefaultCommConfig; external kernel32 name 'GetDefaultCommConfigA';
{$EXTERNALSYM GetDiskFreeSpaceA}
function GetDiskFreeSpaceA; external kernel32 name 'GetDiskFreeSpaceA';
{$EXTERNALSYM GetDiskFreeSpaceW}
function GetDiskFreeSpaceW; external kernel32 name 'GetDiskFreeSpaceW';
{$EXTERNALSYM GetDiskFreeSpace}
function GetDiskFreeSpace; external kernel32 name 'GetDiskFreeSpaceA';
function GetDiskFreeSpaceExA; external kernel32 name 'GetDiskFreeSpaceExA';
function GetDiskFreeSpaceExW; external kernel32 name 'GetDiskFreeSpaceExW';
function GetDiskFreeSpaceEx; external kernel32 name 'GetDiskFreeSpaceExA';
{$EXTERNALSYM GetDriveTypeA}
function GetDriveTypeA; external kernel32 name 'GetDriveTypeA';
{$EXTERNALSYM GetDriveTypeW}
function GetDriveTypeW; external kernel32 name 'GetDriveTypeW';
{$EXTERNALSYM GetDriveType}
function GetDriveType; external kernel32 name 'GetDriveTypeA';
{$EXTERNALSYM GetEnvironmentStringsA}
function GetEnvironmentStringsA; external kernel32 name 'GetEnvironmentStringsA';
{$EXTERNALSYM GetEnvironmentStringsW}
function GetEnvironmentStringsW; external kernel32 name 'GetEnvironmentStringsW';
{$EXTERNALSYM GetEnvironmentStrings}
function GetEnvironmentStrings; external kernel32 name 'GetEnvironmentStringsA';
{$EXTERNALSYM GetEnvironmentVariableA}
function GetEnvironmentVariableA; external kernel32 name 'GetEnvironmentVariableA';
{$EXTERNALSYM GetEnvironmentVariableW}
function GetEnvironmentVariableW; external kernel32 name 'GetEnvironmentVariableW';
{$EXTERNALSYM GetEnvironmentVariable}
function GetEnvironmentVariable; external kernel32 name 'GetEnvironmentVariableA';
{$EXTERNALSYM GetExitCodeProcess}
function GetExitCodeProcess; external kernel32 name 'GetExitCodeProcess';
{$EXTERNALSYM GetExitCodeThread}
function GetExitCodeThread; external kernel32 name 'GetExitCodeThread';
{$EXTERNALSYM GetFileAttributesA}
function GetFileAttributesA; external kernel32 name 'GetFileAttributesA';
{$EXTERNALSYM GetFileAttributesW}
function GetFileAttributesW; external kernel32 name 'GetFileAttributesW';
{$EXTERNALSYM GetFileAttributes}
function GetFileAttributes; external kernel32 name 'GetFileAttributesA';
{$EXTERNALSYM GetFileAttributesExA}
function GetFileAttributesExA; external kernel32 name 'GetFileAttributesExA';
{$EXTERNALSYM GetFileAttributesExW}
function GetFileAttributesExW; external kernel32 name 'GetFileAttributesExW';
{$EXTERNALSYM GetFileAttributesEx}
function GetFileAttributesEx; external kernel32 name 'GetFileAttributesExA';
{$EXTERNALSYM GetFileInformationByHandle}
function GetFileInformationByHandle; external kernel32 name 'GetFileInformationByHandle';
{$EXTERNALSYM GetFileSize}
function GetFileSize; external kernel32 name 'GetFileSize';
{$EXTERNALSYM GetFileTime}
function GetFileTime; external kernel32 name 'GetFileTime';
{$EXTERNALSYM GetFileType}
function GetFileType; external kernel32 name 'GetFileType';
{$EXTERNALSYM GetFullPathNameA}
function GetFullPathNameA; external kernel32 name 'GetFullPathNameA';
{$EXTERNALSYM GetFullPathNameW}
function GetFullPathNameW; external kernel32 name 'GetFullPathNameW';
{$EXTERNALSYM GetFullPathName}
function GetFullPathName; external kernel32 name 'GetFullPathNameA';
{$EXTERNALSYM GetHandleInformation}
function GetHandleInformation; external kernel32 name 'GetHandleInformation';
{$EXTERNALSYM GetLargestConsoleWindowSize}
function GetLargestConsoleWindowSize; external kernel32 name 'GetLargestConsoleWindowSize';
{$EXTERNALSYM GetLastError}
function GetLastError; external kernel32 name 'GetLastError';
{$EXTERNALSYM GetLocalTime}
procedure GetLocalTime; external kernel32 name 'GetLocalTime';
{$EXTERNALSYM GetLocaleInfoA}
function GetLocaleInfoA; external kernel32 name 'GetLocaleInfoA';
{$EXTERNALSYM GetLocaleInfoW}
function GetLocaleInfoW; external kernel32 name 'GetLocaleInfoW';
{$EXTERNALSYM GetLocaleInfo}
function GetLocaleInfo; external kernel32 name 'GetLocaleInfoA';
{$EXTERNALSYM GetLogicalDriveStringsA}
function GetLogicalDriveStringsA; external kernel32 name 'GetLogicalDriveStringsA';
{$EXTERNALSYM GetLogicalDriveStringsW}
function GetLogicalDriveStringsW; external kernel32 name 'GetLogicalDriveStringsW';
{$EXTERNALSYM GetLogicalDriveStrings}
function GetLogicalDriveStrings; external kernel32 name 'GetLogicalDriveStringsA';
{$EXTERNALSYM GetLogicalDrives}
function GetLogicalDrives; external kernel32 name 'GetLogicalDrives';
{$EXTERNALSYM GetMailslotInfo}
function GetMailslotInfo; external kernel32 name 'GetMailslotInfo';
{$EXTERNALSYM GetModuleFileNameA}
function GetModuleFileNameA; external kernel32 name 'GetModuleFileNameA';
{$EXTERNALSYM GetModuleFileNameW}
function GetModuleFileNameW; external kernel32 name 'GetModuleFileNameW';
{$EXTERNALSYM GetModuleFileName}
function GetModuleFileName; external kernel32 name 'GetModuleFileNameA';
{$EXTERNALSYM GetModuleHandleA}
function GetModuleHandleA; external kernel32 name 'GetModuleHandleA';
{$EXTERNALSYM GetModuleHandleW}
function GetModuleHandleW; external kernel32 name 'GetModuleHandleW';
{$EXTERNALSYM GetModuleHandle}
function GetModuleHandle; external kernel32 name 'GetModuleHandleA';
{$EXTERNALSYM GetNamedPipeHandleStateA}
function GetNamedPipeHandleStateA; external kernel32 name 'GetNamedPipeHandleStateA';
{$EXTERNALSYM GetNamedPipeHandleStateW}
function GetNamedPipeHandleStateW; external kernel32 name 'GetNamedPipeHandleStateW';
{$EXTERNALSYM GetNamedPipeHandleState}
function GetNamedPipeHandleState; external kernel32 name 'GetNamedPipeHandleStateA';
{$EXTERNALSYM GetNamedPipeInfo}
function GetNamedPipeInfo; external kernel32 name 'GetNamedPipeInfo';
{$EXTERNALSYM GetNumberFormatA}
function GetNumberFormatA; external kernel32 name 'GetNumberFormatA';
{$EXTERNALSYM GetNumberFormatW}
function GetNumberFormatW; external kernel32 name 'GetNumberFormatW';
{$EXTERNALSYM GetNumberFormat}
function GetNumberFormat; external kernel32 name 'GetNumberFormatA';
{$EXTERNALSYM GetNumberOfConsoleInputEvents}
function GetNumberOfConsoleInputEvents; external kernel32 name 'GetNumberOfConsoleInputEvents';
{$EXTERNALSYM GetNumberOfConsoleMouseButtons}
function GetNumberOfConsoleMouseButtons; external kernel32 name 'GetNumberOfConsoleMouseButtons';
{$EXTERNALSYM GetOEMCP}
function GetOEMCP; external kernel32 name 'GetOEMCP';
{$EXTERNALSYM GetOverlappedResult}
function GetOverlappedResult; external kernel32 name 'GetOverlappedResult';
{$EXTERNALSYM GetPriorityClass}
function GetPriorityClass; external kernel32 name 'GetPriorityClass';
{$EXTERNALSYM GetPrivateProfileIntA}
function GetPrivateProfileIntA; external kernel32 name 'GetPrivateProfileIntA';
{$EXTERNALSYM GetPrivateProfileIntW}
function GetPrivateProfileIntW; external kernel32 name 'GetPrivateProfileIntW';
{$EXTERNALSYM GetPrivateProfileInt}
function GetPrivateProfileInt; external kernel32 name 'GetPrivateProfileIntA';
{$EXTERNALSYM GetPrivateProfileSectionA}
function GetPrivateProfileSectionA; external kernel32 name 'GetPrivateProfileSectionA';
{$EXTERNALSYM GetPrivateProfileSectionW}
function GetPrivateProfileSectionW; external kernel32 name 'GetPrivateProfileSectionW';
{$EXTERNALSYM GetPrivateProfileSection}
function GetPrivateProfileSection; external kernel32 name 'GetPrivateProfileSectionA';
{$EXTERNALSYM GetPrivateProfileSectionNamesA}
function GetPrivateProfileSectionNamesA; external kernel32 name 'GetPrivateProfileSectionNamesA';
{$EXTERNALSYM GetPrivateProfileSectionNamesW}
function GetPrivateProfileSectionNamesW; external kernel32 name 'GetPrivateProfileSectionNamesW';
{$EXTERNALSYM GetPrivateProfileSectionNames}
function GetPrivateProfileSectionNames; external kernel32 name 'GetPrivateProfileSectionNamesA';
{$EXTERNALSYM GetPrivateProfileStringA}
function GetPrivateProfileStringA; external kernel32 name 'GetPrivateProfileStringA';
{$EXTERNALSYM GetPrivateProfileStringW}
function GetPrivateProfileStringW; external kernel32 name 'GetPrivateProfileStringW';
{$EXTERNALSYM GetPrivateProfileString}
function GetPrivateProfileString; external kernel32 name 'GetPrivateProfileStringA';
{$EXTERNALSYM GetProcAddress}
function GetProcAddress; external kernel32 name 'GetProcAddress';
{$EXTERNALSYM GetProcessAffinityMask}
function GetProcessAffinityMask; external kernel32 name 'GetProcessAffinityMask';
{$EXTERNALSYM GetProcessHeap}
function GetProcessHeap; external kernel32 name 'GetProcessHeap';
{$EXTERNALSYM GetProcessHeaps}
function GetProcessHeaps; external kernel32 name 'GetProcessHeaps';
function GetProcessPriorityBoost; external kernel32 name 'GetProcessPriorityBoost';
{$EXTERNALSYM GetProcessShutdownParameters}
function GetProcessShutdownParameters; external kernel32 name 'GetProcessShutdownParameters';
{$EXTERNALSYM GetProcessTimes}
function GetProcessTimes; external kernel32 name 'GetProcessTimes';
{$EXTERNALSYM GetProcessVersion}
function GetProcessVersion; external kernel32 name 'GetProcessVersion';
{$EXTERNALSYM GetProcessWorkingSetSize}
function GetProcessWorkingSetSize; external kernel32 name 'GetProcessWorkingSetSize';
{$EXTERNALSYM GetProfileIntA}
function GetProfileIntA; external kernel32 name 'GetProfileIntA';
{$EXTERNALSYM GetProfileIntW}
function GetProfileIntW; external kernel32 name 'GetProfileIntW';
{$EXTERNALSYM GetProfileInt}
function GetProfileInt; external kernel32 name 'GetProfileIntA';
{$EXTERNALSYM GetProfileSectionA}
function GetProfileSectionA; external kernel32 name 'GetProfileSectionA';
{$EXTERNALSYM GetProfileSectionW}
function GetProfileSectionW; external kernel32 name 'GetProfileSectionW';
{$EXTERNALSYM GetProfileSection}
function GetProfileSection; external kernel32 name 'GetProfileSectionA';
{$EXTERNALSYM GetProfileStringA}
function GetProfileStringA; external kernel32 name 'GetProfileStringA';
{$EXTERNALSYM GetProfileStringW}
function GetProfileStringW; external kernel32 name 'GetProfileStringW';
{$EXTERNALSYM GetProfileString}
function GetProfileString; external kernel32 name 'GetProfileStringA';
{$EXTERNALSYM GetQueuedCompletionStatus}
function GetQueuedCompletionStatus; external kernel32 name 'GetQueuedCompletionStatus';
{$EXTERNALSYM GetShortPathNameA}
function GetShortPathNameA; external kernel32 name 'GetShortPathNameA';
{$EXTERNALSYM GetShortPathNameW}
function GetShortPathNameW; external kernel32 name 'GetShortPathNameW';
{$EXTERNALSYM GetShortPathName}
function GetShortPathName; external kernel32 name 'GetShortPathNameA';
{$EXTERNALSYM GetStartupInfoA}
procedure GetStartupInfoA; external kernel32 name 'GetStartupInfoA';
{$EXTERNALSYM GetStartupInfoW}
procedure GetStartupInfoW; external kernel32 name 'GetStartupInfoW';
{$EXTERNALSYM GetStartupInfo}
procedure GetStartupInfo; external kernel32 name 'GetStartupInfoA';
{$EXTERNALSYM GetStdHandle}
function GetStdHandle; external kernel32 name 'GetStdHandle';
{$EXTERNALSYM GetStringTypeExA}
function GetStringTypeExA; external kernel32 name 'GetStringTypeExA';
{$EXTERNALSYM GetStringTypeExW}
function GetStringTypeExW; external kernel32 name 'GetStringTypeExW';
{$EXTERNALSYM GetStringTypeEx}
function GetStringTypeEx; external kernel32 name 'GetStringTypeExA';
{$EXTERNALSYM GetStringTypeA}
function GetStringTypeA; external kernel32 name 'GetStringTypeA';
{$EXTERNALSYM GetStringTypeW}
function GetStringTypeW; external kernel32 name 'GetStringTypeW';
{$EXTERNALSYM GetSystemDefaultLCID}
function GetSystemDefaultLCID; external kernel32 name 'GetSystemDefaultLCID';
{$EXTERNALSYM GetSystemDefaultLangID}
function GetSystemDefaultLangID; external kernel32 name 'GetSystemDefaultLangID';
{$EXTERNALSYM GetSystemDirectoryA}
function GetSystemDirectoryA; external kernel32 name 'GetSystemDirectoryA';
{$EXTERNALSYM GetSystemDirectoryW}
function GetSystemDirectoryW; external kernel32 name 'GetSystemDirectoryW';
{$EXTERNALSYM GetSystemDirectory}
function GetSystemDirectory; external kernel32 name 'GetSystemDirectoryA';
{$EXTERNALSYM GetSystemInfo}
procedure GetSystemInfo; external kernel32 name 'GetSystemInfo';
{$EXTERNALSYM GetSystemPowerStatus}
function GetSystemPowerStatus; external kernel32 name 'GetSystemPowerStatus';
{$EXTERNALSYM GetSystemTime}
procedure GetSystemTime; external kernel32 name 'GetSystemTime';
{$EXTERNALSYM GetSystemTimeAsFileTime}
procedure GetSystemTimeAsFileTime; external kernel32 name 'GetSystemTimeAsFileTime';
{$EXTERNALSYM GetSystemTimeAdjustment}
function GetSystemTimeAdjustment; external kernel32 name 'GetSystemTimeAdjustment';
{$EXTERNALSYM GetTapeParameters}
function GetTapeParameters; external kernel32 name 'GetTapeParameters';
{$EXTERNALSYM GetTapePosition}
function GetTapePosition; external kernel32 name 'GetTapePosition';
{$EXTERNALSYM GetTapeStatus}
function GetTapeStatus; external kernel32 name 'GetTapeStatus';
{$EXTERNALSYM GetTempFileNameA}
function GetTempFileNameA; external kernel32 name 'GetTempFileNameA';
{$EXTERNALSYM GetTempFileNameW}
function GetTempFileNameW; external kernel32 name 'GetTempFileNameW';
{$EXTERNALSYM GetTempFileName}
function GetTempFileName; external kernel32 name 'GetTempFileNameA';
{$EXTERNALSYM GetTempPathA}
function GetTempPathA; external kernel32 name 'GetTempPathA';
{$EXTERNALSYM GetTempPathW}
function GetTempPathW; external kernel32 name 'GetTempPathW';
{$EXTERNALSYM GetTempPath}
function GetTempPath; external kernel32 name 'GetTempPathA';
{$EXTERNALSYM GetThreadContext}
function GetThreadContext; external kernel32 name 'GetThreadContext';
{$EXTERNALSYM GetThreadLocale}
function GetThreadLocale; external kernel32 name 'GetThreadLocale';
{$EXTERNALSYM GetThreadPriority}
function GetThreadPriority; external kernel32 name 'GetThreadPriority';
function GetThreadPriorityBoost; external kernel32 name 'GetThreadPriorityBoost';
{$EXTERNALSYM GetThreadSelectorEntry}
function GetThreadSelectorEntry; external kernel32 name 'GetThreadSelectorEntry';
{$EXTERNALSYM GetThreadTimes}
function GetThreadTimes; external kernel32 name 'GetThreadTimes';
{$EXTERNALSYM GetTickCount}
function GetTickCount; external kernel32 name 'GetTickCount';
{$EXTERNALSYM GetTimeFormatA}
function GetTimeFormatA; external kernel32 name 'GetTimeFormatA';
{$EXTERNALSYM GetTimeFormatW}
function GetTimeFormatW; external kernel32 name 'GetTimeFormatW';
{$EXTERNALSYM GetTimeFormat}
function GetTimeFormat; external kernel32 name 'GetTimeFormatA';
{$EXTERNALSYM GetTimeZoneInformation}
function GetTimeZoneInformation; external kernel32 name 'GetTimeZoneInformation';
{$EXTERNALSYM GetUserDefaultLCID}
function GetUserDefaultLCID; external kernel32 name 'GetUserDefaultLCID';
{$EXTERNALSYM GetUserDefaultLangID}
function GetUserDefaultLangID; external kernel32 name 'GetUserDefaultLangID';
{$EXTERNALSYM GetVersion}
function GetVersion; external kernel32 name 'GetVersion';
{$EXTERNALSYM GetVersionExA}
function GetVersionExA; external kernel32 name 'GetVersionExA';
{$EXTERNALSYM GetVersionExW}
function GetVersionExW; external kernel32 name 'GetVersionExW';
{$EXTERNALSYM GetVersionEx}
function GetVersionEx; external kernel32 name 'GetVersionExA';
{$EXTERNALSYM GetVolumeInformationA}
function GetVolumeInformationA; external kernel32 name 'GetVolumeInformationA';
{$EXTERNALSYM GetVolumeInformationW}
function GetVolumeInformationW; external kernel32 name 'GetVolumeInformationW';
{$EXTERNALSYM GetVolumeInformation}
function GetVolumeInformation; external kernel32 name 'GetVolumeInformationA';
{$EXTERNALSYM GetWindowsDirectoryA}
function GetWindowsDirectoryA; external kernel32 name 'GetWindowsDirectoryA';
{$EXTERNALSYM GetWindowsDirectoryW}
function GetWindowsDirectoryW; external kernel32 name 'GetWindowsDirectoryW';
{$EXTERNALSYM GetWindowsDirectory}
function GetWindowsDirectory; external kernel32 name 'GetWindowsDirectoryA';
{$EXTERNALSYM GlobalAddAtomA}
function GlobalAddAtomA; external kernel32 name 'GlobalAddAtomA';
{$EXTERNALSYM GlobalAddAtomW}
function GlobalAddAtomW; external kernel32 name 'GlobalAddAtomW';
{$EXTERNALSYM GlobalAddAtom}
function GlobalAddAtom; external kernel32 name 'GlobalAddAtomA';
{$EXTERNALSYM GlobalAlloc}
function GlobalAlloc; external kernel32 name 'GlobalAlloc';
{$EXTERNALSYM GlobalCompact}
function GlobalCompact; external kernel32 name 'GlobalCompact';
{$EXTERNALSYM GlobalDeleteAtom}
function GlobalDeleteAtom; external kernel32 name 'GlobalDeleteAtom';
{$EXTERNALSYM GlobalFindAtomA}
function GlobalFindAtomA; external kernel32 name 'GlobalFindAtomA';
{$EXTERNALSYM GlobalFindAtomW}
function GlobalFindAtomW; external kernel32 name 'GlobalFindAtomW';
{$EXTERNALSYM GlobalFindAtom}
function GlobalFindAtom; external kernel32 name 'GlobalFindAtomA';
{$EXTERNALSYM GlobalFix}
procedure GlobalFix; external kernel32 name 'GlobalFix';
{$EXTERNALSYM GlobalFlags}
function GlobalFlags; external kernel32 name 'GlobalFlags';
{$EXTERNALSYM GlobalFree}
function GlobalFree; external kernel32 name 'GlobalFree';
{$EXTERNALSYM GlobalGetAtomNameA}
function GlobalGetAtomNameA; external kernel32 name 'GlobalGetAtomNameA';
{$EXTERNALSYM GlobalGetAtomNameW}
function GlobalGetAtomNameW; external kernel32 name 'GlobalGetAtomNameW';
{$EXTERNALSYM GlobalGetAtomName}
function GlobalGetAtomName; external kernel32 name 'GlobalGetAtomNameA';
{$EXTERNALSYM GlobalLock}
function GlobalLock; external kernel32 name 'GlobalLock';
{$EXTERNALSYM GlobalHandle}
function GlobalHandle; external kernel32 name 'GlobalHandle';
{$EXTERNALSYM GlobalMemoryStatus}
procedure GlobalMemoryStatus; external kernel32 name 'GlobalMemoryStatus';
{$EXTERNALSYM GlobalReAlloc}
function GlobalReAlloc; external kernel32 name 'GlobalReAlloc';
{$EXTERNALSYM GlobalSize}
function GlobalSize; external kernel32 name 'GlobalSize';
{$EXTERNALSYM GlobalUnWire}
function GlobalUnWire; external kernel32 name 'GlobalUnWire';
{$EXTERNALSYM GlobalUnfix}
procedure GlobalUnfix; external kernel32 name 'GlobalUnfix';
{$EXTERNALSYM GlobalUnlock}
function GlobalUnlock; external kernel32 name 'GlobalUnlock';
{$EXTERNALSYM GlobalWire}
function GlobalWire; external kernel32 name 'GlobalWire';
{$EXTERNALSYM HeapAlloc}
function HeapAlloc; external kernel32 name 'HeapAlloc';
{$EXTERNALSYM HeapCompact}
function HeapCompact; external kernel32 name 'HeapCompact';
{$EXTERNALSYM HeapCreate}
function HeapCreate; external kernel32 name 'HeapCreate';
{$EXTERNALSYM HeapDestroy}
function HeapDestroy; external kernel32 name 'HeapDestroy';
{$EXTERNALSYM HeapFree}
function HeapFree; external kernel32 name 'HeapFree';
{$EXTERNALSYM HeapLock}
function HeapLock; external kernel32 name 'HeapLock';
{$EXTERNALSYM HeapReAlloc}
function HeapReAlloc; external kernel32 name 'HeapReAlloc';
{$EXTERNALSYM HeapSize}
function HeapSize; external kernel32 name 'HeapSize';
{$EXTERNALSYM HeapUnlock}
function HeapUnlock; external kernel32 name 'HeapUnlock';
{$EXTERNALSYM HeapValidate}
function HeapValidate; external kernel32 name 'HeapValidate';
{$EXTERNALSYM HeapWalk}
function HeapWalk; external kernel32 name 'HeapWalk';
{$EXTERNALSYM InitAtomTable}
function InitAtomTable; external kernel32 name 'InitAtomTable';
{$EXTERNALSYM InitializeCriticalSection}
procedure InitializeCriticalSection; external kernel32 name 'InitializeCriticalSection';
{$EXTERNALSYM InitializeCriticalSectionAndSpinCount}
procedure InitializeCriticalSectionAndSpinCount; external kernel32 name 'InitializeCriticalSectionAndSpinCount';
{$EXTERNALSYM IsBadCodePtr}
function IsBadCodePtr; external kernel32 name 'IsBadCodePtr';
{$EXTERNALSYM IsBadHugeReadPtr}
function IsBadHugeReadPtr; external kernel32 name 'IsBadHugeReadPtr';
{$EXTERNALSYM IsBadHugeWritePtr}
function IsBadHugeWritePtr; external kernel32 name 'IsBadHugeWritePtr';
{$EXTERNALSYM IsBadReadPtr}
function IsBadReadPtr; external kernel32 name 'IsBadReadPtr';
{$EXTERNALSYM IsBadStringPtrA}
function IsBadStringPtrA; external kernel32 name 'IsBadStringPtrA';
{$EXTERNALSYM IsBadStringPtrW}
function IsBadStringPtrW; external kernel32 name 'IsBadStringPtrW';
{$EXTERNALSYM IsBadStringPtr}
function IsBadStringPtr; external kernel32 name 'IsBadStringPtrA';
{$EXTERNALSYM IsBadWritePtr}
function IsBadWritePtr; external kernel32 name 'IsBadWritePtr';
{$EXTERNALSYM IsDBCSLeadByte}
function IsDBCSLeadByte; external kernel32 name 'IsDBCSLeadByte';
{$EXTERNALSYM IsDBCSLeadByteEx}
function IsDBCSLeadByteEx; external kernel32 name 'IsDBCSLeadByteEx';
{$EXTERNALSYM IsProcessorFeaturePresent}
function IsProcessorFeaturePresent; external kernel32 name 'IsProcessorFeaturePresent';
{$EXTERNALSYM IsValidCodePage}
function IsValidCodePage; external kernel32 name 'IsValidCodePage';
{$EXTERNALSYM IsValidLocale}
function IsValidLocale; external kernel32 name 'IsValidLocale';
{$EXTERNALSYM LCMapStringA}
function LCMapStringA; external kernel32 name 'LCMapStringA';
{$EXTERNALSYM LCMapStringW}
function LCMapStringW; external kernel32 name 'LCMapStringW';
{$EXTERNALSYM LCMapString}
function LCMapString; external kernel32 name 'LCMapStringA';
{$EXTERNALSYM LeaveCriticalSection}
procedure LeaveCriticalSection; external kernel32 name 'LeaveCriticalSection';
{$EXTERNALSYM LoadLibraryA}
function LoadLibraryA; external kernel32 name 'LoadLibraryA';
{$EXTERNALSYM LoadLibraryW}
function LoadLibraryW; external kernel32 name 'LoadLibraryW';
{$EXTERNALSYM LoadLibrary}
function LoadLibrary; external kernel32 name 'LoadLibraryA';
{$EXTERNALSYM LoadLibraryExA}
function LoadLibraryExA; external kernel32 name 'LoadLibraryExA';
{$EXTERNALSYM LoadLibraryExW}
function LoadLibraryExW; external kernel32 name 'LoadLibraryExW';
{$EXTERNALSYM LoadLibraryEx}
function LoadLibraryEx; external kernel32 name 'LoadLibraryExA';
{$EXTERNALSYM LoadModule}
function LoadModule; external kernel32 name 'LoadModule';
{$EXTERNALSYM LoadResource}
function LoadResource; external kernel32 name 'LoadResource';
{$EXTERNALSYM LocalAlloc}
function LocalAlloc; external kernel32 name 'LocalAlloc';
{$EXTERNALSYM LocalCompact}
function LocalCompact; external kernel32 name 'LocalCompact';
{$EXTERNALSYM LocalFileTimeToFileTime}
function LocalFileTimeToFileTime; external kernel32 name 'LocalFileTimeToFileTime';
{$EXTERNALSYM LocalFlags}
function LocalFlags; external kernel32 name 'LocalFlags';
{$EXTERNALSYM LocalFree}
function LocalFree; external kernel32 name 'LocalFree';
{$EXTERNALSYM LocalLock}
function LocalLock; external kernel32 name 'LocalLock';
{$EXTERNALSYM LocalReAlloc}
function LocalReAlloc; external kernel32 name 'LocalReAlloc';
{$EXTERNALSYM LocalShrink}
function LocalShrink; external kernel32 name 'LocalShrink';
{$EXTERNALSYM LocalSize}
function LocalSize; external kernel32 name 'LocalSize';
{$EXTERNALSYM LocalUnlock}
function LocalUnlock; external kernel32 name 'LocalUnlock';
{$EXTERNALSYM LockFile}
function LockFile; external kernel32 name 'LockFile';
{$EXTERNALSYM LockFileEx}
function LockFileEx; external kernel32 name 'LockFileEx';
{$EXTERNALSYM LockResource}
function LockResource; external kernel32 name 'LockResource';
{$EXTERNALSYM MapViewOfFile}
function MapViewOfFile; external kernel32 name 'MapViewOfFile';
{$EXTERNALSYM MapViewOfFileEx}
function MapViewOfFileEx; external kernel32 name 'MapViewOfFileEx';
{$EXTERNALSYM MoveFileA}
function MoveFileA; external kernel32 name 'MoveFileA';
{$EXTERNALSYM MoveFileW}
function MoveFileW; external kernel32 name 'MoveFileW';
{$EXTERNALSYM MoveFile}
function MoveFile; external kernel32 name 'MoveFileA';
{$EXTERNALSYM MoveFileExA}
function MoveFileExA; external kernel32 name 'MoveFileExA';
{$EXTERNALSYM MoveFileExW}
function MoveFileExW; external kernel32 name 'MoveFileExW';
{$EXTERNALSYM MoveFileEx}
function MoveFileEx; external kernel32 name 'MoveFileExA';
{$EXTERNALSYM MoveFileWithProgressA}
function MoveFileWithProgressA; external kernel32 name 'MoveFileWithProgressA';
{$EXTERNALSYM MoveFileWithProgressW}
function MoveFileWithProgressW; external kernel32 name 'MoveFileWithProgressW';
{$EXTERNALSYM MoveFileWithProgress}
function MoveFileWithProgress; external kernel32 name 'MoveFileWithProgressA';
{$EXTERNALSYM MulDiv}
function MulDiv; external kernel32 name 'MulDiv';
{$EXTERNALSYM MultiByteToWideChar}
function MultiByteToWideChar; external kernel32 name 'MultiByteToWideChar';
{$EXTERNALSYM OpenEventA}
function OpenEventA; external kernel32 name 'OpenEventA';
{$EXTERNALSYM OpenEventW}
function OpenEventW; external kernel32 name 'OpenEventW';
{$EXTERNALSYM OpenEvent}
function OpenEvent; external kernel32 name 'OpenEventA';
{$EXTERNALSYM OpenFile}
function OpenFile; external kernel32 name 'OpenFile';
{$EXTERNALSYM OpenFileMappingA}
function OpenFileMappingA; external kernel32 name 'OpenFileMappingA';
{$EXTERNALSYM OpenFileMappingW}
function OpenFileMappingW; external kernel32 name 'OpenFileMappingW';
{$EXTERNALSYM OpenFileMapping}
function OpenFileMapping; external kernel32 name 'OpenFileMappingA';
{$EXTERNALSYM OpenMutexA}
function OpenMutexA; external kernel32 name 'OpenMutexA';
{$EXTERNALSYM OpenMutexW}
function OpenMutexW; external kernel32 name 'OpenMutexW';
{$EXTERNALSYM OpenMutex}
function OpenMutex; external kernel32 name 'OpenMutexA';
{$EXTERNALSYM OpenProcess}
function OpenProcess; external kernel32 name 'OpenProcess';
{$EXTERNALSYM OpenRawA}
function OpenRawA; external kernel32 name 'OpenRawA';
{$EXTERNALSYM OpenRawW}
function OpenRawW; external kernel32 name 'OpenRawW';
{$EXTERNALSYM OpenRaw}
function OpenRaw; external kernel32 name 'OpenRaw';
{$EXTERNALSYM OpenSemaphoreA}
function OpenSemaphoreA; external kernel32 name 'OpenSemaphoreA';
{$EXTERNALSYM OpenWaitableTimerA}
function OpenWaitableTimerA; external kernel32 name 'OpenWaitableTimerA';
{$EXTERNALSYM OpenSemaphoreW}
function OpenSemaphoreW; external kernel32 name 'OpenSemaphoreW';
{$EXTERNALSYM OpenWaitableTimerW}
function OpenWaitableTimerW; external kernel32 name 'OpenWaitableTimerW';
{$EXTERNALSYM OpenSemaphore}
function OpenSemaphore; external kernel32 name 'OpenSemaphoreA';
{$EXTERNALSYM OpenWaitableTimer}
function OpenWaitableTimer; external kernel32 name 'OpenWaitableTimerA';
{$EXTERNALSYM OutputDebugStringA}
procedure OutputDebugStringA; external kernel32 name 'OutputDebugStringA';
{$EXTERNALSYM OutputDebugStringW}
procedure OutputDebugStringW; external kernel32 name 'OutputDebugStringW';
{$EXTERNALSYM OutputDebugString}
procedure OutputDebugString; external kernel32 name 'OutputDebugStringA';
{$EXTERNALSYM PeekConsoleInputA}
function PeekConsoleInputA; external kernel32 name 'PeekConsoleInputA';
{$EXTERNALSYM PeekConsoleInputW}
function PeekConsoleInputW; external kernel32 name 'PeekConsoleInputW';
{$EXTERNALSYM PeekConsoleInput}
function PeekConsoleInput; external kernel32 name 'PeekConsoleInputA';
{$EXTERNALSYM PeekNamedPipe}
function PeekNamedPipe; external kernel32 name 'PeekNamedPipe';
{$EXTERNALSYM PostQueuedCompletionStatus}
function PostQueuedCompletionStatus; external kernel32 name 'PostQueuedCompletionStatus';
{$EXTERNALSYM PrepareTape}
function PrepareTape; external kernel32 name 'PrepareTape';
{$EXTERNALSYM PulseEvent}
function PulseEvent; external kernel32 name 'PulseEvent';
{$EXTERNALSYM PurgeComm}
function PurgeComm; external kernel32 name 'PurgeComm';
{$EXTERNALSYM QueryDosDeviceA}
function QueryDosDeviceA; external kernel32 name 'QueryDosDeviceA';
{$EXTERNALSYM QueryDosDeviceW}
function QueryDosDeviceW; external kernel32 name 'QueryDosDeviceW';
{$EXTERNALSYM QueryDosDevice}
function QueryDosDevice; external kernel32 name 'QueryDosDeviceA';
{$EXTERNALSYM QueryPerformanceCounter}
function QueryPerformanceCounter; external kernel32 name 'QueryPerformanceCounter';
{$EXTERNALSYM QueryPerformanceFrequency}
function QueryPerformanceFrequency; external kernel32 name 'QueryPerformanceFrequency';
{$EXTERNALSYM QueryRecoveryAgentsA}
function QueryRecoveryAgentsA; external kernel32 name 'QueryRecoveryAgentsA';
{$EXTERNALSYM QueryRecoveryAgentsW}
function QueryRecoveryAgentsW; external kernel32 name 'QueryRecoveryAgentsW';
{$EXTERNALSYM QueryRecoveryAgents}
function QueryRecoveryAgents; external kernel32 name 'QueryRecoveryAgentsA';
{$EXTERNALSYM QueueUserAPC}
function QueueUserAPC; external kernel32 name 'QueueUserAPC';
{$EXTERNALSYM RaiseException}
procedure RaiseException; external kernel32 name 'RaiseException';
{$EXTERNALSYM ReadConsoleA}
function ReadConsoleA; external kernel32 name 'ReadConsoleA';
{$EXTERNALSYM ReadConsoleW}
function ReadConsoleW; external kernel32 name 'ReadConsoleW';
{$EXTERNALSYM ReadConsole}
function ReadConsole; external kernel32 name 'ReadConsoleA';
{$EXTERNALSYM ReadConsoleInputA}
function ReadConsoleInputA; external kernel32 name 'ReadConsoleInputA';
{$EXTERNALSYM ReadConsoleInputW}
function ReadConsoleInputW; external kernel32 name 'ReadConsoleInputW';
{$EXTERNALSYM ReadConsoleInput}
function ReadConsoleInput; external kernel32 name 'ReadConsoleInputA';
{$EXTERNALSYM ReadConsoleOutputA}
function ReadConsoleOutputA; external kernel32 name 'ReadConsoleOutputA';
{$EXTERNALSYM ReadConsoleOutputW}
function ReadConsoleOutputW; external kernel32 name 'ReadConsoleOutputW';
{$EXTERNALSYM ReadConsoleOutput}
function ReadConsoleOutput; external kernel32 name 'ReadConsoleOutputA';
{$EXTERNALSYM ReadConsoleOutputAttribute}
function ReadConsoleOutputAttribute; external kernel32 name 'ReadConsoleOutputAttribute';
{$EXTERNALSYM ReadConsoleOutputCharacterA}
function ReadConsoleOutputCharacterA; external kernel32 name 'ReadConsoleOutputCharacterA';
{$EXTERNALSYM ReadConsoleOutputCharacterW}
function ReadConsoleOutputCharacterW; external kernel32 name 'ReadConsoleOutputCharacterW';
{$EXTERNALSYM ReadConsoleOutputCharacter}
function ReadConsoleOutputCharacter; external kernel32 name 'ReadConsoleOutputCharacterA';
function ReadDirectoryChanges; external kernel32 name 'ReadDirectoryChangesW';
function ReadDirectoryChangesW; external kernel32 name 'ReadDirectoryChangesW';
{$EXTERNALSYM ReadFile}
function ReadFile; external kernel32 name 'ReadFile';
{$EXTERNALSYM ReadFileEx}
function ReadFileEx; external kernel32 name 'ReadFileEx';
{$EXTERNALSYM ReadProcessMemory}
function ReadProcessMemory; external kernel32 name 'ReadProcessMemory';
{$EXTERNALSYM ReadRaw}
function ReadRaw; external kernel32 name 'ReadRaw';
{$EXTERNALSYM ReleaseMutex}
function ReleaseMutex; external kernel32 name 'ReleaseMutex';
{$EXTERNALSYM ReleaseSemaphore}
function ReleaseSemaphore; external kernel32 name 'ReleaseSemaphore';
{$EXTERNALSYM RemoveDirectoryA}
function RemoveDirectoryA; external kernel32 name 'RemoveDirectoryA';
{$EXTERNALSYM RemoveDirectoryW}
function RemoveDirectoryW; external kernel32 name 'RemoveDirectoryW';
{$EXTERNALSYM RemoveDirectory}
function RemoveDirectory; external kernel32 name 'RemoveDirectoryA';
{$EXTERNALSYM ResetEvent}
function ResetEvent; external kernel32 name 'ResetEvent';
{$EXTERNALSYM ResumeThread}
function ResumeThread; external kernel32 name 'ResumeThread';
{$EXTERNALSYM ScrollConsoleScreenBufferA}
function ScrollConsoleScreenBufferA; external kernel32 name 'ScrollConsoleScreenBufferA';
{$EXTERNALSYM ScrollConsoleScreenBufferW}
function ScrollConsoleScreenBufferW; external kernel32 name 'ScrollConsoleScreenBufferW';
{$EXTERNALSYM ScrollConsoleScreenBuffer}
function ScrollConsoleScreenBuffer; external kernel32 name 'ScrollConsoleScreenBufferA';
{$EXTERNALSYM SearchPathA}
function SearchPathA; external kernel32 name 'SearchPathA';
{$EXTERNALSYM SearchPathW}
function SearchPathW; external kernel32 name 'SearchPathW';
{$EXTERNALSYM SearchPath}
function SearchPath; external kernel32 name 'SearchPathA';
{$EXTERNALSYM SetCommBreak}
function SetCommBreak; external kernel32 name 'SetCommBreak';
{$EXTERNALSYM SetCommConfig}
function SetCommConfig; external kernel32 name 'SetCommConfig';
{$EXTERNALSYM SetCommMask}
function SetCommMask; external kernel32 name 'SetCommMask';
{$EXTERNALSYM SetCommState}
function SetCommState; external kernel32 name 'SetCommState';
{$EXTERNALSYM SetCommTimeouts}
function SetCommTimeouts; external kernel32 name 'SetCommTimeouts';
{$EXTERNALSYM SetComputerNameA}
function SetComputerNameA; external kernel32 name 'SetComputerNameA';
{$EXTERNALSYM SetComputerNameW}
function SetComputerNameW; external kernel32 name 'SetComputerNameW';
{$EXTERNALSYM SetComputerName}
function SetComputerName; external kernel32 name 'SetComputerNameA';
{$EXTERNALSYM SetConsoleActiveScreenBuffer}
function SetConsoleActiveScreenBuffer; external kernel32 name 'SetConsoleActiveScreenBuffer';
{$EXTERNALSYM SetConsoleCP}
function SetConsoleCP; external kernel32 name 'SetConsoleCP';
{$EXTERNALSYM SetConsoleCtrlHandler}
function SetConsoleCtrlHandler; external kernel32 name 'SetConsoleCtrlHandler';
{$EXTERNALSYM SetConsoleCursorInfo}
function SetConsoleCursorInfo; external kernel32 name 'SetConsoleCursorInfo';
{$EXTERNALSYM SetConsoleCursorPosition}
function SetConsoleCursorPosition; external kernel32 name 'SetConsoleCursorPosition';
{$EXTERNALSYM SetConsoleMode}
function SetConsoleMode; external kernel32 name 'SetConsoleMode';
{$EXTERNALSYM SetConsoleOutputCP}
function SetConsoleOutputCP; external kernel32 name 'SetConsoleOutputCP';
{$EXTERNALSYM SetConsoleScreenBufferSize}
function SetConsoleScreenBufferSize; external kernel32 name 'SetConsoleScreenBufferSize';
{$EXTERNALSYM SetConsoleTextAttribute}
function SetConsoleTextAttribute; external kernel32 name 'SetConsoleTextAttribute';
{$EXTERNALSYM SetConsoleTitleA}
function SetConsoleTitleA; external kernel32 name 'SetConsoleTitleA';
{$EXTERNALSYM SetConsoleTitleW}
function SetConsoleTitleW; external kernel32 name 'SetConsoleTitleW';
{$EXTERNALSYM SetConsoleTitle}
function SetConsoleTitle; external kernel32 name 'SetConsoleTitleA';
{$EXTERNALSYM SetConsoleWindowInfo}
function SetConsoleWindowInfo; external kernel32 name 'SetConsoleWindowInfo';
{$EXTERNALSYM SetCriticalSectionSpinCount}
function SetCriticalSectionSpinCount; external kernel32 name 'SetCriticalSectionSpinCount';
{$EXTERNALSYM SetCurrentDirectoryA}
function SetCurrentDirectoryA; external kernel32 name 'SetCurrentDirectoryA';
{$EXTERNALSYM SetCurrentDirectoryW}
function SetCurrentDirectoryW; external kernel32 name 'SetCurrentDirectoryW';
{$EXTERNALSYM SetCurrentDirectory}
function SetCurrentDirectory; external kernel32 name 'SetCurrentDirectoryA';
{$EXTERNALSYM SetDefaultCommConfigA}
function SetDefaultCommConfigA; external kernel32 name 'SetDefaultCommConfigA';
{$EXTERNALSYM SetDefaultCommConfigW}
function SetDefaultCommConfigW; external kernel32 name 'SetDefaultCommConfigW';
{$EXTERNALSYM SetDefaultCommConfig}
function SetDefaultCommConfig; external kernel32 name 'SetDefaultCommConfigA';
{$EXTERNALSYM SetEndOfFile}
function SetEndOfFile; external kernel32 name 'SetEndOfFile';
{$EXTERNALSYM SetEnvironmentVariableA}
function SetEnvironmentVariableA; external kernel32 name 'SetEnvironmentVariableA';
{$EXTERNALSYM SetEnvironmentVariableW}
function SetEnvironmentVariableW; external kernel32 name 'SetEnvironmentVariableW';
{$EXTERNALSYM SetEnvironmentVariable}
function SetEnvironmentVariable; external kernel32 name 'SetEnvironmentVariableA';
{$EXTERNALSYM SetErrorMode}
function SetErrorMode; external kernel32 name 'SetErrorMode';
{$EXTERNALSYM SetEvent}
function SetEvent; external kernel32 name 'SetEvent';
{$EXTERNALSYM SetFileApisToANSI}
procedure SetFileApisToANSI; external kernel32 name 'SetFileApisToANSI';
{$EXTERNALSYM SetFileApisToOEM}
procedure SetFileApisToOEM; external kernel32 name 'SetFileApisToOEM';
{$EXTERNALSYM SetFileAttributesA}
function SetFileAttributesA; external kernel32 name 'SetFileAttributesA';
{$EXTERNALSYM SetFileAttributesW}
function SetFileAttributesW; external kernel32 name 'SetFileAttributesW';
{$EXTERNALSYM SetFileAttributes}
function SetFileAttributes; external kernel32 name 'SetFileAttributesA';
{$EXTERNALSYM SetFilePointer}
function SetFilePointer; external kernel32 name 'SetFilePointer';
{$EXTERNALSYM SetFileTime}
function SetFileTime; external kernel32 name 'SetFileTime';
{$EXTERNALSYM SetHandleCount}
function SetHandleCount; external kernel32 name 'SetHandleCount';
{$EXTERNALSYM SetHandleInformation}
function SetHandleInformation; external kernel32 name 'SetHandleInformation';
{$EXTERNALSYM SetLastError}
procedure SetLastError; external kernel32 name 'SetLastError';
{$EXTERNALSYM SetLocalTime}
function SetLocalTime; external kernel32 name 'SetLocalTime';
{$EXTERNALSYM SetLocaleInfoA}
function SetLocaleInfoA; external kernel32 name 'SetLocaleInfoA';
{$EXTERNALSYM SetLocaleInfoW}
function SetLocaleInfoW; external kernel32 name 'SetLocaleInfoW';
{$EXTERNALSYM SetLocaleInfo}
function SetLocaleInfo; external kernel32 name 'SetLocaleInfoA';
{$EXTERNALSYM SetMailslotInfo}
function SetMailslotInfo; external kernel32 name 'SetMailslotInfo';
{$EXTERNALSYM SetNamedPipeHandleState}
function SetNamedPipeHandleState; external kernel32 name 'SetNamedPipeHandleState';
{$EXTERNALSYM SetPriorityClass}
function SetPriorityClass; external kernel32 name 'SetPriorityClass';
function SetProcessAffinityMask; external kernel32 name 'SetProcessAffinityMask';
function SetProcessPriorityBoost; external kernel32 name 'SetProcessPriorityBoost';
{$EXTERNALSYM SetProcessShutdownParameters}
function SetProcessShutdownParameters; external kernel32 name 'SetProcessShutdownParameters';
{$EXTERNALSYM SetProcessWorkingSetSize}
function SetProcessWorkingSetSize; external kernel32 name 'SetProcessWorkingSetSize';
{$EXTERNALSYM SetStdHandle}
function SetStdHandle; external kernel32 name 'SetStdHandle';
{$EXTERNALSYM SetSystemPowerState}
function SetSystemPowerState; external kernel32 name 'SetSystemPowerState';
{$EXTERNALSYM SetSystemTime}
function SetSystemTime; external kernel32 name 'SetSystemTime';
{$EXTERNALSYM SetSystemTimeAdjustment}
function SetSystemTimeAdjustment; external kernel32 name 'SetSystemTimeAdjustment';
{$EXTERNALSYM SetTapeParameters}
function SetTapeParameters; external kernel32 name 'SetTapeParameters';
{$EXTERNALSYM SetTapePosition}
function SetTapePosition; external kernel32 name 'SetTapePosition';
{$EXTERNALSYM SetThreadAffinityMask}
function SetThreadAffinityMask; external kernel32 name 'SetThreadAffinityMask';
{$EXTERNALSYM SetThreadContext}
function SetThreadContext; external kernel32 name 'SetThreadContext';
function SetThreadIdealProcessor; external kernel32 name 'SetThreadIdealProcessor';
{$EXTERNALSYM SetThreadLocale}
function SetThreadLocale; external kernel32 name 'SetThreadLocale';
{$EXTERNALSYM SetThreadPriority}
function SetThreadPriority; external kernel32 name 'SetThreadPriority';
function SetThreadPriorityBoost; external kernel32 name 'SetThreadPriorityBoost';
{$EXTERNALSYM SetTimeZoneInformation}
function SetTimeZoneInformation; external kernel32 name 'SetTimeZoneInformation';
{$EXTERNALSYM SetUnhandledExceptionFilter}
function SetUnhandledExceptionFilter; external kernel32 name 'SetUnhandledExceptionFilter';
{$EXTERNALSYM SetVolumeLabelA}
function SetVolumeLabelA; external kernel32 name 'SetVolumeLabelA';
{$EXTERNALSYM SetVolumeLabelW}
function SetVolumeLabelW; external kernel32 name 'SetVolumeLabelW';
{$EXTERNALSYM SetVolumeLabel}
function SetVolumeLabel; external kernel32 name 'SetVolumeLabelA';
{$EXTERNALSYM SetWaitableTimer}
function SetWaitableTimer; external kernel32 name 'SetWaitableTimer';
{$EXTERNALSYM SetupComm}
function SetupComm; external kernel32 name 'SetupComm';
{$EXTERNALSYM SignalObjectAndWait}
function SignalObjectAndWait; external kernel32 name 'SignalObjectAndWait';
{$EXTERNALSYM SizeofResource}
function SizeofResource; external kernel32 name 'SizeofResource';
{$EXTERNALSYM Sleep}
procedure Sleep; external kernel32 name 'Sleep';
{$EXTERNALSYM SleepEx}
function SleepEx; external kernel32 name 'SleepEx';
{$EXTERNALSYM SuspendThread}
function SuspendThread; external kernel32 name 'SuspendThread';
function SwitchToFiber; external kernel32 name 'SwitchToFiber';
function SwitchToThread; external kernel32 name 'SwitchToThread';
{$EXTERNALSYM SystemTimeToFileTime}
function SystemTimeToFileTime; external kernel32 name 'SystemTimeToFileTime';
{$EXTERNALSYM SystemTimeToTzSpecificLocalTime}
function SystemTimeToTzSpecificLocalTime; external kernel32 name 'SystemTimeToTzSpecificLocalTime';
{$EXTERNALSYM TerminateProcess}
function TerminateProcess; external kernel32 name 'TerminateProcess';
{$EXTERNALSYM TerminateThread}
function TerminateThread; external kernel32 name 'TerminateThread';
{$EXTERNALSYM TlsAlloc}
function TlsAlloc; external kernel32 name 'TlsAlloc';
{$EXTERNALSYM TlsFree}
function TlsFree; external kernel32 name 'TlsFree';
{$EXTERNALSYM TlsGetValue}
function TlsGetValue; external kernel32 name 'TlsGetValue';
{$EXTERNALSYM TlsSetValue}
function TlsSetValue; external kernel32 name 'TlsSetValue';
{$EXTERNALSYM TransactNamedPipe}
function TransactNamedPipe; external kernel32 name 'TransactNamedPipe';
{$EXTERNALSYM TransmitCommChar}
function TransmitCommChar; external kernel32 name 'TransmitCommChar';
{$EXTERNALSYM TryEnterCriticalSection}
function TryEnterCriticalSection; external kernel32 name 'TryEnterCriticalSection';
{$EXTERNALSYM UnhandledExceptionFilter}
function UnhandledExceptionFilter; external kernel32 name 'UnhandledExceptionFilter';
{$EXTERNALSYM UnlockFile}
function UnlockFile; external kernel32 name 'UnlockFile';
{$EXTERNALSYM UnlockFileEx}
function UnlockFileEx; external kernel32 name 'UnlockFileEx';
{$EXTERNALSYM UnmapViewOfFile}
function UnmapViewOfFile; external kernel32 name 'UnmapViewOfFile';
{$EXTERNALSYM UpdateResourceA}
function UpdateResourceA; external kernel32 name 'UpdateResourceA';
{$EXTERNALSYM UpdateResourceW}
function UpdateResourceW; external kernel32 name 'UpdateResourceW';
{$EXTERNALSYM UpdateResource}
function UpdateResource; external kernel32 name 'UpdateResourceA';
{$EXTERNALSYM VerLanguageNameA}
function VerLanguageNameA; external kernel32 name 'VerLanguageNameA';
{$EXTERNALSYM VerLanguageNameW}
function VerLanguageNameW; external kernel32 name 'VerLanguageNameW';
{$EXTERNALSYM VerLanguageName}
function VerLanguageName; external kernel32 name 'VerLanguageNameA';
{$EXTERNALSYM VirtualAlloc}
function VirtualAlloc; external kernel32 name 'VirtualAlloc';
{$EXTERNALSYM VirtualAllocEx}
function VirtualAllocEx; external kernel32 name 'VirtualAllocEx';
{$EXTERNALSYM VirtualFree}
function VirtualFree; external kernel32 name 'VirtualFree';
{$EXTERNALSYM VirtualFreeEx}
function VirtualFreeEx; external kernel32 name 'VirtualFreeEx';
{$EXTERNALSYM VirtualLock}
function VirtualLock; external kernel32 name 'VirtualLock';
{$EXTERNALSYM VirtualProtect}
function VirtualProtect; external kernel32 name 'VirtualProtect';
{$EXTERNALSYM VirtualProtectEx}
function VirtualProtectEx; external kernel32 name 'VirtualProtectEx';
{$EXTERNALSYM VirtualQuery}
function VirtualQuery; external kernel32 name 'VirtualQuery';
{$EXTERNALSYM VirtualQueryEx}
function VirtualQueryEx; external kernel32 name 'VirtualQueryEx';
{$EXTERNALSYM VirtualUnlock}
function VirtualUnlock; external kernel32 name 'VirtualUnlock';
{$EXTERNALSYM WaitCommEvent}
function WaitCommEvent; external kernel32 name 'WaitCommEvent';
{$EXTERNALSYM WaitForDebugEvent}
function WaitForDebugEvent; external kernel32 name 'WaitForDebugEvent';
{$EXTERNALSYM WaitForMultipleObjects}
function WaitForMultipleObjects; external kernel32 name 'WaitForMultipleObjects';
{$EXTERNALSYM WaitForMultipleObjectsEx}
function WaitForMultipleObjectsEx; external kernel32 name 'WaitForMultipleObjectsEx';
{$EXTERNALSYM WaitForSingleObject}
function WaitForSingleObject; external kernel32 name 'WaitForSingleObject';
{$EXTERNALSYM WaitForSingleObjectEx}
function WaitForSingleObjectEx; external kernel32 name 'WaitForSingleObjectEx';
{$EXTERNALSYM WaitNamedPipeA}
function WaitNamedPipeA; external kernel32 name 'WaitNamedPipeA';
{$EXTERNALSYM WaitNamedPipeW}
function WaitNamedPipeW; external kernel32 name 'WaitNamedPipeW';
{$EXTERNALSYM WaitNamedPipe}
function WaitNamedPipe; external kernel32 name 'WaitNamedPipeA';
{$EXTERNALSYM WideCharToMultiByte}
function WideCharToMultiByte; external kernel32 name 'WideCharToMultiByte';
{$EXTERNALSYM WinExec}
function WinExec; external kernel32 name 'WinExec';
{$EXTERNALSYM WriteConsoleA}
function WriteConsoleA; external kernel32 name 'WriteConsoleA';
{$EXTERNALSYM WriteConsoleW}
function WriteConsoleW; external kernel32 name 'WriteConsoleW';
{$EXTERNALSYM WriteConsole}
function WriteConsole; external kernel32 name 'WriteConsoleA';
{$EXTERNALSYM WriteConsoleInputA}
function WriteConsoleInputA; external kernel32 name 'WriteConsoleInputA';
{$EXTERNALSYM WriteConsoleInputW}
function WriteConsoleInputW; external kernel32 name 'WriteConsoleInputW';
{$EXTERNALSYM WriteConsoleInput}
function WriteConsoleInput; external kernel32 name 'WriteConsoleInputA';
{$EXTERNALSYM WriteConsoleOutputA}
function WriteConsoleOutputA; external kernel32 name 'WriteConsoleOutputA';
{$EXTERNALSYM WriteConsoleOutputW}
function WriteConsoleOutputW; external kernel32 name 'WriteConsoleOutputW';
{$EXTERNALSYM WriteConsoleOutput}
function WriteConsoleOutput; external kernel32 name 'WriteConsoleOutputA';
{$EXTERNALSYM WriteConsoleOutputAttribute}
function WriteConsoleOutputAttribute; external kernel32 name 'WriteConsoleOutputAttribute';
{$EXTERNALSYM WriteConsoleOutputCharacterA}
function WriteConsoleOutputCharacterA; external kernel32 name 'WriteConsoleOutputCharacterA';
{$EXTERNALSYM WriteConsoleOutputCharacterW}
function WriteConsoleOutputCharacterW; external kernel32 name 'WriteConsoleOutputCharacterW';
{$EXTERNALSYM WriteConsoleOutputCharacter}
function WriteConsoleOutputCharacter; external kernel32 name 'WriteConsoleOutputCharacterA';
{$EXTERNALSYM WriteFile}
function WriteFile; external kernel32 name 'WriteFile';
{$EXTERNALSYM WriteFileEx}
function WriteFileEx; external kernel32 name 'WriteFileEx';
{$EXTERNALSYM WritePrivateProfileSectionA}
function WritePrivateProfileSectionA; external kernel32 name 'WritePrivateProfileSectionA';
{$EXTERNALSYM WritePrivateProfileSectionW}
function WritePrivateProfileSectionW; external kernel32 name 'WritePrivateProfileSectionW';
{$EXTERNALSYM WritePrivateProfileSection}
function WritePrivateProfileSection; external kernel32 name 'WritePrivateProfileSectionA';
{$EXTERNALSYM WritePrivateProfileStringA}
function WritePrivateProfileStringA; external kernel32 name 'WritePrivateProfileStringA';
{$EXTERNALSYM WritePrivateProfileStringW}
function WritePrivateProfileStringW; external kernel32 name 'WritePrivateProfileStringW';
{$EXTERNALSYM WritePrivateProfileString}
function WritePrivateProfileString; external kernel32 name 'WritePrivateProfileStringA';
{$EXTERNALSYM WriteProcessMemory}
function WriteProcessMemory; external kernel32 name 'WriteProcessMemory';
{$EXTERNALSYM WriteProfileSectionA}
function WriteProfileSectionA; external kernel32 name 'WriteProfileSectionA';
{$EXTERNALSYM WriteProfileSectionW}
function WriteProfileSectionW; external kernel32 name 'WriteProfileSectionW';
{$EXTERNALSYM WriteProfileSection}
function WriteProfileSection; external kernel32 name 'WriteProfileSectionA';
{$EXTERNALSYM WriteProfileStringA}
function WriteProfileStringA; external kernel32 name 'WriteProfileStringA';
{$EXTERNALSYM WriteProfileStringW}
function WriteProfileStringW; external kernel32 name 'WriteProfileStringW';
{$EXTERNALSYM WriteProfileString}
function WriteProfileString; external kernel32 name 'WriteProfileStringA';
{$EXTERNALSYM WriteRaw}
function WriteRaw; external kernel32 name 'WriteRaw';
{$EXTERNALSYM WriteTapemark}
function WriteTapemark; external kernel32 name 'WriteTapemark';
{$EXTERNALSYM _hread}
function _hread; external kernel32 name '_hread';
{$EXTERNALSYM _hwrite}
function _hwrite; external kernel32 name '_hwrite';
{$EXTERNALSYM _lclose}
function _lclose; external kernel32 name '_lclose';
{$EXTERNALSYM _lcreat}
function _lcreat; external kernel32 name '_lcreat';
{$EXTERNALSYM _llseek}
function _llseek; external kernel32 name '_llseek';
{$EXTERNALSYM _lopen}
function _lopen; external kernel32 name '_lopen';
{$EXTERNALSYM _lread}
function _lread; external kernel32 name '_lread';
{$EXTERNALSYM _lwrite}
function _lwrite; external kernel32 name '_lwrite';
{$EXTERNALSYM lstrcatA}
function lstrcatA; external kernel32 name 'lstrcatA';
{$EXTERNALSYM lstrcatW}
function lstrcatW; external kernel32 name 'lstrcatW';
{$EXTERNALSYM lstrcat}
function lstrcat; external kernel32 name 'lstrcatA';
{$EXTERNALSYM lstrcmpA}
function lstrcmpA; external kernel32 name 'lstrcmpA';
{$EXTERNALSYM lstrcmpW}
function lstrcmpW; external kernel32 name 'lstrcmpW';
{$EXTERNALSYM lstrcmp}
function lstrcmp; external kernel32 name 'lstrcmpA';
{$EXTERNALSYM lstrcmpiA}
function lstrcmpiA; external kernel32 name 'lstrcmpiA';
{$EXTERNALSYM lstrcmpiW}
function lstrcmpiW; external kernel32 name 'lstrcmpiW';
{$EXTERNALSYM lstrcmpi}
function lstrcmpi; external kernel32 name 'lstrcmpiA';
{$EXTERNALSYM lstrcpyA}
function lstrcpyA; external kernel32 name 'lstrcpyA';
{$EXTERNALSYM lstrcpyW}
function lstrcpyW; external kernel32 name 'lstrcpyW';
{$EXTERNALSYM lstrcpy}
function lstrcpy; external kernel32 name 'lstrcpyA';
{$EXTERNALSYM lstrcpynA}
function lstrcpynA; external kernel32 name 'lstrcpynA';
{$EXTERNALSYM lstrcpynW}
function lstrcpynW; external kernel32 name 'lstrcpynW';
{$EXTERNALSYM lstrcpyn}
function lstrcpyn; external kernel32 name 'lstrcpynA';
{$EXTERNALSYM lstrlenA}
function lstrlenA; external kernel32 name 'lstrlenA';
{$EXTERNALSYM lstrlenW}
function lstrlenW; external kernel32 name 'lstrlenW';
{$EXTERNALSYM lstrlen}
function lstrlen; external kernel32 name 'lstrlenA';


{ Externals from mpr.dll }

{$EXTERNALSYM MultinetGetConnectionPerformanceA}
function MultinetGetConnectionPerformanceA; external mpr name 'MultinetGetConnectionPerformanceA';
{$EXTERNALSYM MultinetGetConnectionPerformanceW}
function MultinetGetConnectionPerformanceW; external mpr name 'MultinetGetConnectionPerformanceW';
{$EXTERNALSYM MultinetGetConnectionPerformance}
function MultinetGetConnectionPerformance; external mpr name 'MultinetGetConnectionPerformanceA';
{$EXTERNALSYM WNetAddConnection2A}
function WNetAddConnection2A; external mpr name 'WNetAddConnection2A';
{$EXTERNALSYM WNetAddConnection2W}
function WNetAddConnection2W; external mpr name 'WNetAddConnection2W';
{$EXTERNALSYM WNetAddConnection2}
function WNetAddConnection2; external mpr name 'WNetAddConnection2A';
{$EXTERNALSYM WNetAddConnection3A}
function WNetAddConnection3A; external mpr name 'WNetAddConnection3A';
{$EXTERNALSYM WNetAddConnection3W}
function WNetAddConnection3W; external mpr name 'WNetAddConnection3W';
{$EXTERNALSYM WNetAddConnection3}
function WNetAddConnection3; external mpr name 'WNetAddConnection3A';
{$EXTERNALSYM WNetAddConnectionA}
function WNetAddConnectionA; external mpr name 'WNetAddConnectionA';
{$EXTERNALSYM WNetAddConnectionW}
function WNetAddConnectionW; external mpr name 'WNetAddConnectionW';
{$EXTERNALSYM WNetAddConnection}
function WNetAddConnection; external mpr name 'WNetAddConnectionA';
{$EXTERNALSYM WNetCancelConnection2A}
function WNetCancelConnection2A; external mpr name 'WNetCancelConnection2A';
{$EXTERNALSYM WNetCancelConnection2W}
function WNetCancelConnection2W; external mpr name 'WNetCancelConnection2W';
{$EXTERNALSYM WNetCancelConnection2}
function WNetCancelConnection2; external mpr name 'WNetCancelConnection2A';
{$EXTERNALSYM WNetCancelConnectionA}
function WNetCancelConnectionA; external mpr name 'WNetCancelConnectionA';
{$EXTERNALSYM WNetCancelConnectionW}
function WNetCancelConnectionW; external mpr name 'WNetCancelConnectionW';
{$EXTERNALSYM WNetCancelConnection}
function WNetCancelConnection; external mpr name 'WNetCancelConnectionA';
{$EXTERNALSYM WNetCloseEnum}
function WNetCloseEnum; external mpr name 'WNetCloseEnum';
{$EXTERNALSYM WNetConnectionDialog1A}
function WNetConnectionDialog1A; external mpr name 'WNetConnectionDialog1A';
{$EXTERNALSYM WNetConnectionDialog1W}
function WNetConnectionDialog1W; external mpr name 'WNetConnectionDialog1W';
{$EXTERNALSYM WNetConnectionDialog1}
function WNetConnectionDialog1; external mpr name 'WNetConnectionDialog1A';
{$EXTERNALSYM WNetConnectionDialog}
function WNetConnectionDialog; external mpr name 'WNetConnectionDialog';
{$EXTERNALSYM WNetDisconnectDialog1A}
function WNetDisconnectDialog1A; external mpr name 'WNetDisconnectDialog1A';
{$EXTERNALSYM WNetDisconnectDialog1W}
function WNetDisconnectDialog1W; external mpr name 'WNetDisconnectDialog1W';
{$EXTERNALSYM WNetDisconnectDialog1}
function WNetDisconnectDialog1; external mpr name 'WNetDisconnectDialog1A';
{$EXTERNALSYM WNetDisconnectDialog}
function WNetDisconnectDialog; external mpr name 'WNetDisconnectDialog';
{$EXTERNALSYM WNetEnumResourceA}
function WNetEnumResourceA; external mpr name 'WNetEnumResourceA';
{$EXTERNALSYM WNetEnumResourceW}
function WNetEnumResourceW; external mpr name 'WNetEnumResourceW';
{$EXTERNALSYM WNetEnumResource}
function WNetEnumResource; external mpr name 'WNetEnumResourceA';
{$EXTERNALSYM WNetGetConnectionA}
function WNetGetConnectionA; external mpr name 'WNetGetConnectionA';
{$EXTERNALSYM WNetGetConnectionW}
function WNetGetConnectionW; external mpr name 'WNetGetConnectionW';
{$EXTERNALSYM WNetGetConnection}
function WNetGetConnection; external mpr name 'WNetGetConnectionA';
{$EXTERNALSYM WNetGetLastErrorA}
function WNetGetLastErrorA; external mpr name 'WNetGetLastErrorA';
{$EXTERNALSYM WNetGetLastErrorW}
function WNetGetLastErrorW; external mpr name 'WNetGetLastErrorW';
{$EXTERNALSYM WNetGetLastError}
function WNetGetLastError; external mpr name 'WNetGetLastErrorA';
{$EXTERNALSYM WNetGetNetworkInformationA}
function WNetGetNetworkInformationA; external mpr name 'WNetGetNetworkInformationA';
{$EXTERNALSYM WNetGetNetworkInformationW}
function WNetGetNetworkInformationW; external mpr name 'WNetGetNetworkInformationW';
{$EXTERNALSYM WNetGetNetworkInformation}
function WNetGetNetworkInformation; external mpr name 'WNetGetNetworkInformationA';
{$EXTERNALSYM WNetGetProviderNameA}
function WNetGetProviderNameA; external mpr name 'WNetGetProviderNameA';
{$EXTERNALSYM WNetGetProviderNameW}
function WNetGetProviderNameW; external mpr name 'WNetGetProviderNameW';
{$EXTERNALSYM WNetGetProviderName}
function WNetGetProviderName; external mpr name 'WNetGetProviderNameA';
{$EXTERNALSYM WNetGetResourceParentA}
function WNetGetResourceParentA; external mpr name 'WNetGetResourceParentA';
{$EXTERNALSYM WNetGetResourceParentW}
function WNetGetResourceParentW; external mpr name 'WNetGetResourceParentW';
{$EXTERNALSYM WNetGetResourceParent}
function WNetGetResourceParent; external mpr name 'WNetGetResourceParentA';
{$EXTERNALSYM WNetGetUniversalNameA}
function WNetGetUniversalNameA; external mpr name 'WNetGetUniversalNameA';
{$EXTERNALSYM WNetGetUniversalNameW}
function WNetGetUniversalNameW; external mpr name 'WNetGetUniversalNameW';
{$EXTERNALSYM WNetGetUniversalName}
function WNetGetUniversalName; external mpr name 'WNetGetUniversalNameA';
{$EXTERNALSYM WNetGetUserA}
function WNetGetUserA; external mpr name 'WNetGetUserA';
{$EXTERNALSYM WNetGetUserW}
function WNetGetUserW; external mpr name 'WNetGetUserW';
{$EXTERNALSYM WNetGetUser}
function WNetGetUser; external mpr name 'WNetGetUserA';
{$EXTERNALSYM WNetOpenEnumA}
function WNetOpenEnumA; external mpr name 'WNetOpenEnumA';
{$EXTERNALSYM WNetOpenEnumW}
function WNetOpenEnumW; external mpr name 'WNetOpenEnumW';
{$EXTERNALSYM WNetOpenEnum}
function WNetOpenEnum; external mpr name 'WNetOpenEnumA';
{$EXTERNALSYM WNetSetConnectionA}
function WNetSetConnectionA; external mpr name 'WNetSetConnectionA';
{$EXTERNALSYM WNetSetConnectionW}
function WNetSetConnectionW; external mpr name 'WNetSetConnectionW';
{$EXTERNALSYM WNetSetConnection}
function WNetSetConnection; external mpr name 'WNetSetConnectionA';
{$EXTERNALSYM WNetUseConnectionA}
function WNetUseConnectionA; external mpr name 'WNetUseConnectionA';
{$EXTERNALSYM WNetUseConnectionW}
function WNetUseConnectionW; external mpr name 'WNetUseConnectionW';
{$EXTERNALSYM WNetUseConnection}
function WNetUseConnection; external mpr name 'WNetUseConnectionA';


{ Externals from version.dll }

{$EXTERNALSYM GetFileVersionInfoA}
function GetFileVersionInfoA; external version name 'GetFileVersionInfoA';
{$EXTERNALSYM GetFileVersionInfoW}
function GetFileVersionInfoW; external version name 'GetFileVersionInfoW';
{$EXTERNALSYM GetFileVersionInfo}
function GetFileVersionInfo; external version name 'GetFileVersionInfoA';
{$EXTERNALSYM GetFileVersionInfoSizeA}
function GetFileVersionInfoSizeA; external version name 'GetFileVersionInfoSizeA';
{$EXTERNALSYM GetFileVersionInfoSizeW}
function GetFileVersionInfoSizeW; external version name 'GetFileVersionInfoSizeW';
{$EXTERNALSYM GetFileVersionInfoSize}
function GetFileVersionInfoSize; external version name 'GetFileVersionInfoSizeA';
{$EXTERNALSYM VerFindFileA}
function VerFindFileA; external version name 'VerFindFileA';
{$EXTERNALSYM VerFindFileW}
function VerFindFileW; external version name 'VerFindFileW';
{$EXTERNALSYM VerFindFile}
function VerFindFile; external version name 'VerFindFileA';
{$EXTERNALSYM VerInstallFileA}
function VerInstallFileA; external version name 'VerInstallFileA';
{$EXTERNALSYM VerInstallFileW}
function VerInstallFileW; external version name 'VerInstallFileW';
{$EXTERNALSYM VerInstallFile}
function VerInstallFile; external version name 'VerInstallFileA';
{$EXTERNALSYM VerQueryValueA}
function VerQueryValueA; external version name 'VerQueryValueA';
{$EXTERNALSYM VerQueryValueW}
function VerQueryValueW; external version name 'VerQueryValueW';
{$EXTERNALSYM VerQueryValue}
function VerQueryValue; external version name 'VerQueryValueA';

{ Externals from comctl32.dll }

{$EXTERNALSYM GetPrivateProfileStructA}
function GetPrivateProfileStructA; external comctl32 name 'GetPrivateProfileStructA';
{$EXTERNALSYM GetPrivateProfileStructW}
function GetPrivateProfileStructW; external comctl32 name 'GetPrivateProfileStructW';
{$EXTERNALSYM GetPrivateProfileStruct}
function GetPrivateProfileStruct; external comctl32 name 'GetPrivateProfileStructA';
{$EXTERNALSYM WritePrivateProfileStructA}
function WritePrivateProfileStructA; external comctl32 name 'WritePrivateProfileStructA';
{$EXTERNALSYM WritePrivateProfileStructW}
function WritePrivateProfileStructW; external comctl32 name 'WritePrivateProfileStructW';
{$EXTERNALSYM WritePrivateProfileStruct}
function WritePrivateProfileStruct; external comctl32 name 'WritePrivateProfileStructA';


{ Externals from gdi32.dll }

{$EXTERNALSYM AbortDoc}
function AbortDoc; external gdi32 name 'AbortDoc';
{$EXTERNALSYM AbortPath}
function AbortPath; external gdi32 name 'AbortPath';
{$EXTERNALSYM AddFontMemResourceEx}
function AddFontMemResourceEx; external gdi32 name 'AddFontMemResourceEx';
{$EXTERNALSYM AddFontResourceA}
function AddFontResourceA; external gdi32 name 'AddFontResourceA';
{$EXTERNALSYM AddFontResourceW}
function AddFontResourceW; external gdi32 name 'AddFontResourceW';
{$EXTERNALSYM AddFontResource}
function AddFontResource; external gdi32 name 'AddFontResourceA';
{$EXTERNALSYM AddFontResourceExA}
function AddFontResourceExA; external gdi32 name 'AddFontResourceExA';
{$EXTERNALSYM AddFontResourceExW}
function AddFontResourceExW; external gdi32 name 'AddFontResourceExW';
{$EXTERNALSYM AddFontResourceEx}
function AddFontResourceEx; external gdi32 name 'AddFontResourceExA';
{$EXTERNALSYM AlphaBlend}
function AlphaBlend; external gdi32 name 'AlphaBlend';
{$EXTERNALSYM AlphaDIBBlend}
function AlphaDIBBlend; external gdi32 name 'AlphaDIBBlend';
{$EXTERNALSYM AngleArc}
function AngleArc; external gdi32 name 'AngleArc';
{$EXTERNALSYM AnimatePalette}
function AnimatePalette; external gdi32 name 'AnimatePalette';
{$EXTERNALSYM Arc}
function Arc; external gdi32 name 'Arc';
{$EXTERNALSYM ArcTo}
function ArcTo; external gdi32 name 'ArcTo';
{$EXTERNALSYM BeginPath}
function BeginPath; external gdi32 name 'BeginPath';
{$EXTERNALSYM BitBlt}
function BitBlt; external gdi32 name 'BitBlt';
{$EXTERNALSYM CancelDC}
function CancelDC; external gdi32 name 'CancelDC';
{$EXTERNALSYM CheckColorsInGamut}
function CheckColorsInGamut; external gdi32 name 'CheckColorsInGamut';
{$EXTERNALSYM ChoosePixelFormat}
function ChoosePixelFormat; external gdi32 name 'ChoosePixelFormat';
{$EXTERNALSYM Chord}
function Chord; external gdi32 name 'Chord';
{$EXTERNALSYM CloseEnhMetaFile}
function CloseEnhMetaFile; external gdi32 name 'CloseEnhMetaFile';
{$EXTERNALSYM CloseFigure}
function CloseFigure; external gdi32 name 'CloseFigure';
{$EXTERNALSYM CloseMetaFile}
function CloseMetaFile; external gdi32 name 'CloseMetaFile';
{$EXTERNALSYM ColorCorrectPalette}
function ColorCorrectPalette; external gdi32 name 'ColorCorrectPalette';
{$EXTERNALSYM ColorMatchToTarget}
function ColorMatchToTarget; external gdi32 name 'ColorMatchToTarget';
{$EXTERNALSYM CombineRgn}
function CombineRgn; external gdi32 name 'CombineRgn';
{$EXTERNALSYM CombineTransform}
function CombineTransform; external gdi32 name 'CombineTransform';
{$EXTERNALSYM CopyEnhMetaFileA}
function CopyEnhMetaFileA; external gdi32 name 'CopyEnhMetaFileA';
{$EXTERNALSYM CopyEnhMetaFileW}
function CopyEnhMetaFileW; external gdi32 name 'CopyEnhMetaFileW';
{$EXTERNALSYM CopyEnhMetaFile}
function CopyEnhMetaFile; external gdi32 name 'CopyEnhMetaFileA';
{$EXTERNALSYM CopyMetaFileA}
function CopyMetaFileA; external gdi32 name 'CopyMetaFileA';
{$EXTERNALSYM CopyMetaFileW}
function CopyMetaFileW; external gdi32 name 'CopyMetaFileW';
{$EXTERNALSYM CopyMetaFile}
function CopyMetaFile; external gdi32 name 'CopyMetaFileA';
{$EXTERNALSYM CreateBitmap}
function CreateBitmap; external gdi32 name 'CreateBitmap';
{$EXTERNALSYM CreateBitmapIndirect}
function CreateBitmapIndirect; external gdi32 name 'CreateBitmapIndirect';
{$EXTERNALSYM CreateBrushIndirect}
function CreateBrushIndirect; external gdi32 name 'CreateBrushIndirect';
{$EXTERNALSYM CreateColorSpaceA}
function CreateColorSpaceA; external gdi32 name 'CreateColorSpaceA';
{$EXTERNALSYM CreateColorSpaceW}
function CreateColorSpaceW; external gdi32 name 'CreateColorSpaceW';
{$EXTERNALSYM CreateColorSpace}
function CreateColorSpace; external gdi32 name 'CreateColorSpaceA';
{$EXTERNALSYM CreateCompatibleBitmap}
function CreateCompatibleBitmap; external gdi32 name 'CreateCompatibleBitmap';
{$EXTERNALSYM CreateCompatibleDC}
function CreateCompatibleDC; external gdi32 name 'CreateCompatibleDC';
{$EXTERNALSYM CreateDCA}
function CreateDCA; external gdi32 name 'CreateDCA';
{$EXTERNALSYM CreateDCW}
function CreateDCW; external gdi32 name 'CreateDCW';
{$EXTERNALSYM CreateDC}
function CreateDC; external gdi32 name 'CreateDCA';
{$EXTERNALSYM CreateDIBPatternBrush}
function CreateDIBPatternBrush; external gdi32 name 'CreateDIBPatternBrush';
{$EXTERNALSYM CreateDIBPatternBrushPt}
function CreateDIBPatternBrushPt; external gdi32 name 'CreateDIBPatternBrushPt';
{$EXTERNALSYM CreateDIBSection}
function CreateDIBSection; external gdi32 name 'CreateDIBSection';
{$EXTERNALSYM CreateDIBitmap}
function CreateDIBitmap; external gdi32 name 'CreateDIBitmap';
{$EXTERNALSYM CreateDiscardableBitmap}
function CreateDiscardableBitmap; external gdi32 name 'CreateDiscardableBitmap';
{$EXTERNALSYM CreateEllipticRgn}
function CreateEllipticRgn; external gdi32 name 'CreateEllipticRgn';
{$EXTERNALSYM CreateEllipticRgnIndirect}
function CreateEllipticRgnIndirect; external gdi32 name 'CreateEllipticRgnIndirect';
{$EXTERNALSYM CreateEnhMetaFileA}
function CreateEnhMetaFileA; external gdi32 name 'CreateEnhMetaFileA';
{$EXTERNALSYM CreateEnhMetaFileW}
function CreateEnhMetaFileW; external gdi32 name 'CreateEnhMetaFileW';
{$EXTERNALSYM CreateEnhMetaFile}
function CreateEnhMetaFile; external gdi32 name 'CreateEnhMetaFileA';
{$EXTERNALSYM CreateFontA}
function CreateFontA; external gdi32 name 'CreateFontA';
{$EXTERNALSYM CreateFontW}
function CreateFontW; external gdi32 name 'CreateFontW';
{$EXTERNALSYM CreateFont}
function CreateFont; external gdi32 name 'CreateFontA';
{$EXTERNALSYM CreateFontIndirectA}
function CreateFontIndirectA; external gdi32 name 'CreateFontIndirectA';
{$EXTERNALSYM CreateFontIndirectW}
function CreateFontIndirectW; external gdi32 name 'CreateFontIndirectW';
{$EXTERNALSYM CreateFontIndirect}
function CreateFontIndirect; external gdi32 name 'CreateFontIndirectA';
{$EXTERNALSYM CreateFontIndirectExA}
function CreateFontIndirectExA; external gdi32 name 'CreateFontIndirectExA';
{$EXTERNALSYM CreateFontIndirectExW}
function CreateFontIndirectExW; external gdi32 name 'CreateFontIndirectExW';
{$EXTERNALSYM CreateFontIndirectEx}
function CreateFontIndirectEx; external gdi32 name 'CreateFontIndirectExA';
{$EXTERNALSYM CreateHalftonePalette}
function CreateHalftonePalette; external gdi32 name 'CreateHalftonePalette';
{$EXTERNALSYM CreateHatchBrush}
function CreateHatchBrush; external gdi32 name 'CreateHatchBrush';
{$EXTERNALSYM CreateICA}
function CreateICA; external gdi32 name 'CreateICA';
{$EXTERNALSYM CreateICW}
function CreateICW; external gdi32 name 'CreateICW';
{$EXTERNALSYM CreateIC}
function CreateIC; external gdi32 name 'CreateICA';
{$EXTERNALSYM CreateMetaFileA}
function CreateMetaFileA; external gdi32 name 'CreateMetaFileA';
{$EXTERNALSYM CreateMetaFileW}
function CreateMetaFileW; external gdi32 name 'CreateMetaFileW';
{$EXTERNALSYM CreateMetaFile}
function CreateMetaFile; external gdi32 name 'CreateMetaFileA';
{$EXTERNALSYM CreatePalette}
function CreatePalette; external gdi32 name 'CreatePalette';
{$EXTERNALSYM CreatePatternBrush}
function CreatePatternBrush; external gdi32 name 'CreatePatternBrush';
{$EXTERNALSYM CreatePen}
function CreatePen; external gdi32 name 'CreatePen';
{$EXTERNALSYM CreatePenIndirect}
function CreatePenIndirect; external gdi32 name 'CreatePenIndirect';
{$EXTERNALSYM CreatePolyPolygonRgn}
function CreatePolyPolygonRgn; external gdi32 name 'CreatePolyPolygonRgn';
{$EXTERNALSYM CreatePolygonRgn}
function CreatePolygonRgn; external gdi32 name 'CreatePolygonRgn';
{$EXTERNALSYM CreateRectRgn}
function CreateRectRgn; external gdi32 name 'CreateRectRgn';
{$EXTERNALSYM CreateRectRgnIndirect}
function CreateRectRgnIndirect; external gdi32 name 'CreateRectRgnIndirect';
{$EXTERNALSYM CreateRoundRectRgn}
function CreateRoundRectRgn; external gdi32 name 'CreateRoundRectRgn';
{$EXTERNALSYM CreateScalableFontResourceA}
function CreateScalableFontResourceA; external gdi32 name 'CreateScalableFontResourceA';
{$EXTERNALSYM CreateScalableFontResourceW}
function CreateScalableFontResourceW; external gdi32 name 'CreateScalableFontResourceW';
{$EXTERNALSYM CreateScalableFontResource}
function CreateScalableFontResource; external gdi32 name 'CreateScalableFontResourceA';
{$EXTERNALSYM CreateSolidBrush}
function CreateSolidBrush; external gdi32 name 'CreateSolidBrush';
{$EXTERNALSYM DPtoLP}
function DPtoLP; external gdi32 name 'DPtoLP';
{$EXTERNALSYM DeleteColorSpace}
function DeleteColorSpace; external gdi32 name 'DeleteColorSpace';
{$EXTERNALSYM DeleteDC}
function DeleteDC; external gdi32 name 'DeleteDC';
{$EXTERNALSYM DeleteEnhMetaFile}
function DeleteEnhMetaFile; external gdi32 name 'DeleteEnhMetaFile';
{$EXTERNALSYM DeleteMetaFile}
function DeleteMetaFile; external gdi32 name 'DeleteMetaFile';
{$EXTERNALSYM DeleteObject}
function DeleteObject; external gdi32 name 'DeleteObject';
{$EXTERNALSYM DescribePixelFormat}
function DescribePixelFormat; external gdi32 name 'DescribePixelFormat';
{$EXTERNALSYM DeviceCapabilitiesA}
function DeviceCapabilitiesA; external gdi32 name 'DeviceCapabilitiesA';
{$EXTERNALSYM DeviceCapabilitiesW}
function DeviceCapabilitiesW; external gdi32 name 'DeviceCapabilitiesW';
{$EXTERNALSYM DeviceCapabilities}
function DeviceCapabilities; external gdi32 name 'DeviceCapabilitiesA';
{function DeviceCapabilitiesEx; external gdi32 name 'DeviceCapabilities';}
{$EXTERNALSYM DrawEscape}
function DrawEscape; external gdi32 name 'DrawEscape';
{$EXTERNALSYM Ellipse}
function Ellipse; external gdi32 name 'Ellipse';
{$EXTERNALSYM EndDoc}
function EndDoc; external gdi32 name 'EndDoc';
{$EXTERNALSYM EndPage}
function EndPage; external gdi32 name 'EndPage';
{$EXTERNALSYM EndPath}
function EndPath; external gdi32 name 'EndPath';
{$EXTERNALSYM EnumEnhMetaFile}
function EnumEnhMetaFile; external gdi32 name 'EnumEnhMetaFile';
{$EXTERNALSYM EnumFontFamiliesA}
function EnumFontFamiliesA; external gdi32 name 'EnumFontFamiliesA';
{$EXTERNALSYM EnumFontFamiliesW}
function EnumFontFamiliesW; external gdi32 name 'EnumFontFamiliesW';
{$EXTERNALSYM EnumFontFamilies}
function EnumFontFamilies; external gdi32 name 'EnumFontFamiliesA';
{$EXTERNALSYM EnumFontFamiliesExA}
function EnumFontFamiliesExA; external gdi32 name 'EnumFontFamiliesExA';
{$EXTERNALSYM EnumFontFamiliesExW}
function EnumFontFamiliesExW; external gdi32 name 'EnumFontFamiliesExW';
{$EXTERNALSYM EnumFontFamiliesEx}
function EnumFontFamiliesEx; external gdi32 name 'EnumFontFamiliesExA';
{$EXTERNALSYM EnumFontsA}
function EnumFontsA; external gdi32 name 'EnumFontsA';
{$EXTERNALSYM EnumFontsW}
function EnumFontsW; external gdi32 name 'EnumFontsW';
{$EXTERNALSYM EnumFonts}
function EnumFonts; external gdi32 name 'EnumFontsA';
{$EXTERNALSYM EnumICMProfilesA}
function EnumICMProfilesA; external gdi32 name 'EnumICMProfilesA';
{$EXTERNALSYM EnumICMProfilesW}
function EnumICMProfilesW; external gdi32 name 'EnumICMProfilesW';
{$EXTERNALSYM EnumICMProfiles}
function EnumICMProfiles; external gdi32 name 'EnumICMProfilesA';
{$EXTERNALSYM EnumMetaFile}
function EnumMetaFile; external gdi32 name 'EnumMetaFile';
{$EXTERNALSYM EnumObjects}
function EnumObjects; external gdi32 name 'EnumObjects';
{$EXTERNALSYM EqualRgn}
function EqualRgn; external gdi32 name 'EqualRgn';
{$EXTERNALSYM Escape}
function Escape; external gdi32 name 'Escape';
{$EXTERNALSYM ExcludeClipRect}
function ExcludeClipRect; external gdi32 name 'ExcludeClipRect';
{$EXTERNALSYM ExtCreatePen}
function ExtCreatePen; external gdi32 name 'ExtCreatePen';
{$EXTERNALSYM ExtCreateRegion}
function ExtCreateRegion; external gdi32 name 'ExtCreateRegion';
{$EXTERNALSYM ExtEscape}
function ExtEscape; external gdi32 name 'ExtEscape';
{$EXTERNALSYM ExtFloodFill}
function ExtFloodFill; external gdi32 name 'ExtFloodFill';
{$EXTERNALSYM ExtSelectClipRgn}
function ExtSelectClipRgn; external gdi32 name 'ExtSelectClipRgn';
{$EXTERNALSYM ExtTextOutA}
function ExtTextOutA; external gdi32 name 'ExtTextOutA';
{$EXTERNALSYM ExtTextOutW}
function ExtTextOutW; external gdi32 name 'ExtTextOutW';
{$EXTERNALSYM ExtTextOut}
function ExtTextOut; external gdi32 name 'ExtTextOutA';
{$EXTERNALSYM FillPath}
function FillPath; external gdi32 name 'FillPath';
{$EXTERNALSYM FillRgn}
function FillRgn; external gdi32 name 'FillRgn';
{$EXTERNALSYM FlattenPath}
function FlattenPath; external gdi32 name 'FlattenPath';
{$EXTERNALSYM FloodFill}
function FloodFill; external gdi32 name 'FloodFill';
{$EXTERNALSYM FrameRgn}
function FrameRgn; external gdi32 name 'FrameRgn';
{$EXTERNALSYM GdiComment}
function GdiComment; external gdi32 name 'GdiComment';
{$EXTERNALSYM GdiFlush}
function GdiFlush; external gdi32 name 'GdiFlush';
{$EXTERNALSYM GdiGetBatchLimit}
function GdiGetBatchLimit; external gdi32 name 'GdiGetBatchLimit';
{$EXTERNALSYM GdiSetBatchLimit}
function GdiSetBatchLimit; external gdi32 name 'GdiSetBatchLimit';
{$EXTERNALSYM GetArcDirection}
function GetArcDirection; external gdi32 name 'GetArcDirection';
{$EXTERNALSYM GetAspectRatioFilterEx}
function GetAspectRatioFilterEx; external gdi32 name 'GetAspectRatioFilterEx';
{$EXTERNALSYM GetBitmapBits}
function GetBitmapBits; external gdi32 name 'GetBitmapBits';
{$EXTERNALSYM GetBitmapDimensionEx}
function GetBitmapDimensionEx; external gdi32 name 'GetBitmapDimensionEx';
{$EXTERNALSYM GetBkColor}
function GetBkColor; external gdi32 name 'GetBkColor';
{$EXTERNALSYM GetBkMode}
function GetBkMode; external gdi32 name 'GetBkMode';
{$EXTERNALSYM GetBoundsRect}
function GetBoundsRect; external gdi32 name 'GetBoundsRect';
{$EXTERNALSYM GetBrushOrgEx}
function GetBrushOrgEx; external gdi32 name 'GetBrushOrgEx';
{$EXTERNALSYM GetCharABCWidthsA}
function GetCharABCWidthsA; external gdi32 name 'GetCharABCWidthsA';
{$EXTERNALSYM GetCharABCWidthsW}
function GetCharABCWidthsW; external gdi32 name 'GetCharABCWidthsW';
{$EXTERNALSYM GetCharABCWidths}
function GetCharABCWidths; external gdi32 name 'GetCharABCWidthsA';
{$EXTERNALSYM GetCharABCWidthsI}
function GetCharABCWidthsI; external gdi32 name 'GetCharABCWidthsI';
{$EXTERNALSYM GetCharABCWidthsFloatA}
function GetCharABCWidthsFloatA; external gdi32 name 'GetCharABCWidthsFloatA';
{$EXTERNALSYM GetCharABCWidthsFloatW}
function GetCharABCWidthsFloatW; external gdi32 name 'GetCharABCWidthsFloatW';
{$EXTERNALSYM GetCharABCWidthsFloat}
function GetCharABCWidthsFloat; external gdi32 name 'GetCharABCWidthsFloatA';
{$EXTERNALSYM GetCharWidth32A}
function GetCharWidth32A; external gdi32 name 'GetCharWidth32A';
{$EXTERNALSYM GetCharWidth32W}
function GetCharWidth32W; external gdi32 name 'GetCharWidth32W';
{$EXTERNALSYM GetCharWidth32}
function GetCharWidth32; external gdi32 name 'GetCharWidth32A';
{$EXTERNALSYM GetCharWidthA}
function GetCharWidthA; external gdi32 name 'GetCharWidthA';
{$EXTERNALSYM GetCharWidthW}
function GetCharWidthW; external gdi32 name 'GetCharWidthW';
{$EXTERNALSYM GetCharWidth}
function GetCharWidth; external gdi32 name 'GetCharWidthA';
{$EXTERNALSYM GetCharWidthFloatA}
function GetCharWidthFloatA; external gdi32 name 'GetCharWidthFloatA';
{$EXTERNALSYM GetCharWidthFloatW}
function GetCharWidthFloatW; external gdi32 name 'GetCharWidthFloatW';
{$EXTERNALSYM GetCharWidthFloat}
function GetCharWidthFloat; external gdi32 name 'GetCharWidthFloatA';
{$EXTERNALSYM GetCharWidthI}
function GetCharWidthI; external gdi32 name 'GetCharWidthI';
{$EXTERNALSYM GetCharacterPlacementA}
function GetCharacterPlacementA; external gdi32 name 'GetCharacterPlacementA';
{$EXTERNALSYM GetCharacterPlacementW}
function GetCharacterPlacementW; external gdi32 name 'GetCharacterPlacementW';
{$EXTERNALSYM GetCharacterPlacement}
function GetCharacterPlacement; external gdi32 name 'GetCharacterPlacementA';
{$EXTERNALSYM GetClipBox}
function GetClipBox; external gdi32 name 'GetClipBox';
{$EXTERNALSYM GetClipRgn}
function GetClipRgn; external gdi32 name 'GetClipRgn';
{$EXTERNALSYM GetColorAdjustment}
function GetColorAdjustment; external gdi32 name 'GetColorAdjustment';
{$EXTERNALSYM GetColorSpace}
function GetColorSpace; external gdi32 name 'GetColorSpace';
{$EXTERNALSYM GetCurrentObject}
function GetCurrentObject; external gdi32 name 'GetCurrentObject';
{$EXTERNALSYM GetCurrentPositionEx}
function GetCurrentPositionEx; external gdi32 name 'GetCurrentPositionEx';
{$EXTERNALSYM GetDCBrushColor}
function GetDCBrushColor; external gdi32 name 'GetDCBrushColor';
{$EXTERNALSYM GetDCPenColor}
function GetDCPenColor; external gdi32 name 'GetDCPenColor';
{$EXTERNALSYM GetDCOrgEx}
function GetDCOrgEx; external gdi32 name 'GetDCOrgEx';
{$EXTERNALSYM GetDIBColorTable}
function GetDIBColorTable; external gdi32 name 'GetDIBColorTable';
{$EXTERNALSYM GetDIBits}
function GetDIBits; external gdi32 name 'GetDIBits';
{$EXTERNALSYM GetDeviceCaps}
function GetDeviceCaps; external gdi32 name 'GetDeviceCaps';
{$EXTERNALSYM GetDeviceGammaRamp}
function GetDeviceGammaRamp; external gdi32 name 'GetDeviceGammaRamp';
{$EXTERNALSYM GetEnhMetaFileA}
function GetEnhMetaFileA; external gdi32 name 'GetEnhMetaFileA';
{$EXTERNALSYM GetEnhMetaFileW}
function GetEnhMetaFileW; external gdi32 name 'GetEnhMetaFileW';
{$EXTERNALSYM GetEnhMetaFile}
function GetEnhMetaFile; external gdi32 name 'GetEnhMetaFileA';
{$EXTERNALSYM GetEnhMetaFileBits}
function GetEnhMetaFileBits; external gdi32 name 'GetEnhMetaFileBits';
{$EXTERNALSYM GetEnhMetaFileDescriptionA}
function GetEnhMetaFileDescriptionA; external gdi32 name 'GetEnhMetaFileDescriptionA';
{$EXTERNALSYM GetEnhMetaFileDescriptionW}
function GetEnhMetaFileDescriptionW; external gdi32 name 'GetEnhMetaFileDescriptionW';
{$EXTERNALSYM GetEnhMetaFileDescription}
function GetEnhMetaFileDescription; external gdi32 name 'GetEnhMetaFileDescriptionA';
{$EXTERNALSYM GetEnhMetaFileHeader}
function GetEnhMetaFileHeader; external gdi32 name 'GetEnhMetaFileHeader';
{$EXTERNALSYM GetEnhMetaFilePaletteEntries}
function GetEnhMetaFilePaletteEntries; external gdi32 name 'GetEnhMetaFilePaletteEntries';
function GetEnhMetaFilePixelFormat; external gdi32 name 'GetEnhMetaFilePixelFormat';
{$EXTERNALSYM GetFontData}
function GetFontData; external gdi32 name 'GetFontData';
{$EXTERNALSYM GetFontLanguageInfo}
function GetFontLanguageInfo; external gdi32 name 'GetFontLanguageInfo';
{$EXTERNALSYM GetFontUnicodeRanges}
function GetFontUnicodeRanges; external gdi32 name 'GetFontUnicodeRanges';
{$EXTERNALSYM GetGlyphIndicesA}
function GetGlyphIndicesA; external gdi32 name 'GetGlyphIndicesA';
{$EXTERNALSYM GetGlyphIndicesW}
function GetGlyphIndicesW; external gdi32 name 'GetGlyphIndicesW';
{$EXTERNALSYM GetGlyphIndices}
function GetGlyphIndices; external gdi32 name 'GetGlyphIndicesA';
{$EXTERNALSYM GetGlyphOutlineA}
function GetGlyphOutlineA; external gdi32 name 'GetGlyphOutlineA';
{$EXTERNALSYM GetGlyphOutlineW}
function GetGlyphOutlineW; external gdi32 name 'GetGlyphOutlineW';
{$EXTERNALSYM GetGlyphOutline}
function GetGlyphOutline; external gdi32 name 'GetGlyphOutlineA';
{$EXTERNALSYM GetGraphicsMode}
function GetGraphicsMode; external gdi32 name 'GetGraphicsMode';
{$EXTERNALSYM GetICMProfileA}
function GetICMProfileA; external gdi32 name 'GetICMProfileA';
{$EXTERNALSYM GetICMProfileW}
function GetICMProfileW; external gdi32 name 'GetICMProfileW';
{$EXTERNALSYM GetICMProfile}
function GetICMProfile; external gdi32 name 'GetICMProfileA';
{$EXTERNALSYM GetKerningPairs}
function GetKerningPairs; external gdi32 name 'GetKerningPairs';
{$EXTERNALSYM GetLogColorSpaceA}
function GetLogColorSpaceA; external gdi32 name 'GetLogColorSpaceA';
{$EXTERNALSYM GetLogColorSpaceW}
function GetLogColorSpaceW; external gdi32 name 'GetLogColorSpaceW';
{$EXTERNALSYM GetLogColorSpace}
function GetLogColorSpace; external gdi32 name 'GetLogColorSpaceA';
{$EXTERNALSYM GetMapMode}
function GetMapMode; external gdi32 name 'GetMapMode';
{$EXTERNALSYM GetMetaFileA}
function GetMetaFileA; external gdi32 name 'GetMetaFileA';
{$EXTERNALSYM GetMetaFileW}
function GetMetaFileW; external gdi32 name 'GetMetaFileW';
{$EXTERNALSYM GetMetaFile}
function GetMetaFile; external gdi32 name 'GetMetaFileA';
{$EXTERNALSYM GetMetaFileBitsEx}
function GetMetaFileBitsEx; external gdi32 name 'GetMetaFileBitsEx';
{$EXTERNALSYM GetMetaRgn}
function GetMetaRgn; external gdi32 name 'GetMetaRgn';
{$EXTERNALSYM GetMiterLimit}
function GetMiterLimit; external gdi32 name 'GetMiterLimit';
{$EXTERNALSYM GetNearestColor}
function GetNearestColor; external gdi32 name 'GetNearestColor';
{$EXTERNALSYM GetNearestPaletteIndex}
function GetNearestPaletteIndex; external gdi32 name 'GetNearestPaletteIndex';
{$EXTERNALSYM GetObjectA}
function GetObjectA; external gdi32 name 'GetObjectA';
{$EXTERNALSYM GetObjectW}
function GetObjectW; external gdi32 name 'GetObjectW';
{$EXTERNALSYM GetObject}
function GetObject; external gdi32 name 'GetObjectA';
{$EXTERNALSYM GetObjectType}
function GetObjectType; external gdi32 name 'GetObjectType';
{$EXTERNALSYM GetOutlineTextMetricsA}
function GetOutlineTextMetricsA; external gdi32 name 'GetOutlineTextMetricsA';
{$EXTERNALSYM GetOutlineTextMetricsW}
function GetOutlineTextMetricsW; external gdi32 name 'GetOutlineTextMetricsW';
{$EXTERNALSYM GetOutlineTextMetrics}
function GetOutlineTextMetrics; external gdi32 name 'GetOutlineTextMetricsA';
{$EXTERNALSYM GetPaletteEntries}
function GetPaletteEntries; external gdi32 name 'GetPaletteEntries';
{$EXTERNALSYM GetPath}
function GetPath; external gdi32 name 'GetPath';
{$EXTERNALSYM GetPixel}
function GetPixel; external gdi32 name 'GetPixel';
{$EXTERNALSYM GetPixelFormat}
function GetPixelFormat; external gdi32 name 'GetPixelFormat';
{$EXTERNALSYM GetPolyFillMode}
function GetPolyFillMode; external gdi32 name 'GetPolyFillMode';
{$EXTERNALSYM GetROP2}
function GetROP2; external gdi32 name 'GetROP2';
{$EXTERNALSYM GetRasterizerCaps}
function GetRasterizerCaps; external gdi32 name 'GetRasterizerCaps';
{$EXTERNALSYM GetRegionData}
function GetRegionData; external gdi32 name 'GetRegionData';
{$EXTERNALSYM GetRgnBox}
function GetRgnBox; external gdi32 name 'GetRgnBox';
{$EXTERNALSYM GetStockObject}
function GetStockObject; external gdi32 name 'GetStockObject';
{$EXTERNALSYM GetStretchBltMode}
function GetStretchBltMode; external gdi32 name 'GetStretchBltMode';
{$EXTERNALSYM GetSystemPaletteEntries}
function GetSystemPaletteEntries; external gdi32 name 'GetSystemPaletteEntries';
{$EXTERNALSYM GetSystemPaletteUse}
function GetSystemPaletteUse; external gdi32 name 'GetSystemPaletteUse';
{$EXTERNALSYM GetTextAlign}
function GetTextAlign; external gdi32 name 'GetTextAlign';
{$EXTERNALSYM GetTextCharacterExtra}
function GetTextCharacterExtra; external gdi32 name 'GetTextCharacterExtra';
{$EXTERNALSYM GetTextCharset}
function GetTextCharset; external gdi32 name 'GetTextCharset';
{$EXTERNALSYM GetTextCharsetInfo}
function GetTextCharsetInfo; external gdi32 name 'GetTextCharsetInfo';
{$EXTERNALSYM GetTextColor}
function GetTextColor; external gdi32 name 'GetTextColor';
{$EXTERNALSYM GetTextExtentExPointA}
function GetTextExtentExPointA; external gdi32 name 'GetTextExtentExPointA';
{$EXTERNALSYM GetTextExtentExPointW}
function GetTextExtentExPointW; external gdi32 name 'GetTextExtentExPointW';
{$EXTERNALSYM GetTextExtentExPoint}
function GetTextExtentExPoint; external gdi32 name 'GetTextExtentExPointA';
{$EXTERNALSYM GetTextExtentExPointI}
function GetTextExtentExPointI; external gdi32 name 'GetTextExtentExPointI';
{$EXTERNALSYM GetTextExtentPoint32A}
function GetTextExtentPoint32A; external gdi32 name 'GetTextExtentPoint32A';
{$EXTERNALSYM GetTextExtentPoint32W}
function GetTextExtentPoint32W; external gdi32 name 'GetTextExtentPoint32W';
{$EXTERNALSYM GetTextExtentPoint32}
function GetTextExtentPoint32; external gdi32 name 'GetTextExtentPoint32A';
{$EXTERNALSYM GetTextExtentPointA}
function GetTextExtentPointA; external gdi32 name 'GetTextExtentPointA';
{$EXTERNALSYM GetTextExtentPointW}
function GetTextExtentPointW; external gdi32 name 'GetTextExtentPointW';
{$EXTERNALSYM GetTextExtentPoint}
function GetTextExtentPoint; external gdi32 name 'GetTextExtentPointA';
{$EXTERNALSYM GetTextExtentPointI}
function GetTextExtentPointI; external gdi32 name 'GetTextExtentPointI';
{$EXTERNALSYM GetTextFaceA}
function GetTextFaceA; external gdi32 name 'GetTextFaceA';
{$EXTERNALSYM GetTextFaceW}
function GetTextFaceW; external gdi32 name 'GetTextFaceW';
{$EXTERNALSYM GetTextFace}
function GetTextFace; external gdi32 name 'GetTextFaceA';
{$EXTERNALSYM GetTextMetricsA}
function GetTextMetricsA; external gdi32 name 'GetTextMetricsA';
{$EXTERNALSYM GetTextMetricsW}
function GetTextMetricsW; external gdi32 name 'GetTextMetricsW';
{$EXTERNALSYM GetTextMetrics}
function GetTextMetrics; external gdi32 name 'GetTextMetricsA';
{$EXTERNALSYM GetViewportExtEx}
function GetViewportExtEx; external gdi32 name 'GetViewportExtEx';
{$EXTERNALSYM GetViewportOrgEx}
function GetViewportOrgEx; external gdi32 name 'GetViewportOrgEx';
{$EXTERNALSYM GetWinMetaFileBits}
function GetWinMetaFileBits; external gdi32 name 'GetWinMetaFileBits';
{$EXTERNALSYM GetWindowExtEx}
function GetWindowExtEx; external gdi32 name 'GetWindowExtEx';
{$EXTERNALSYM GetWindowOrgEx}
function GetWindowOrgEx; external gdi32 name 'GetWindowOrgEx';
{$EXTERNALSYM GetWorldTransform}
function GetWorldTransform; external gdi32 name 'GetWorldTransform';
{$EXTERNALSYM GradientFill}
function GradientFill; external gdi32 name 'GradientFill';
{$EXTERNALSYM IntersectClipRect}
function IntersectClipRect; external gdi32 name 'IntersectClipRect';
{$EXTERNALSYM InvertRgn}
function InvertRgn; external gdi32 name 'InvertRgn';
{$EXTERNALSYM LPtoDP}
function LPtoDP; external gdi32 name 'LPtoDP';
{$EXTERNALSYM LineDDA}
function LineDDA; external gdi32 name 'LineDDA';
{$EXTERNALSYM LineTo}
function LineTo; external gdi32 name 'LineTo';
{$EXTERNALSYM MaskBlt}
function MaskBlt; external gdi32 name 'MaskBlt';
{$EXTERNALSYM ModifyWorldTransform}
function ModifyWorldTransform; external gdi32 name 'ModifyWorldTransform';
{$EXTERNALSYM MoveToEx}
function MoveToEx; external gdi32 name 'MoveToEx';
{$EXTERNALSYM OffsetClipRgn}
function OffsetClipRgn; external gdi32 name 'OffsetClipRgn';
{$EXTERNALSYM OffsetRgn}
function OffsetRgn; external gdi32 name 'OffsetRgn';
{$EXTERNALSYM OffsetViewportOrgEx}
function OffsetViewportOrgEx; external gdi32 name 'OffsetViewportOrgEx';
{$EXTERNALSYM OffsetWindowOrgEx}
function OffsetWindowOrgEx; external gdi32 name 'OffsetWindowOrgEx';
{$EXTERNALSYM PaintRgn}
function PaintRgn; external gdi32 name 'PaintRgn';
{$EXTERNALSYM PatBlt}
function PatBlt; external gdi32 name 'PatBlt';
{$EXTERNALSYM PathToRegion}
function PathToRegion; external gdi32 name 'PathToRegion';
{$EXTERNALSYM Pie}
function Pie; external gdi32 name 'Pie';
{$EXTERNALSYM PlayEnhMetaFile}
function PlayEnhMetaFile; external gdi32 name 'PlayEnhMetaFile';
{$EXTERNALSYM PlayEnhMetaFileRecord}
function PlayEnhMetaFileRecord; external gdi32 name 'PlayEnhMetaFileRecord';
{$EXTERNALSYM PlayMetaFile}
function PlayMetaFile; external gdi32 name 'PlayMetaFile';
{$EXTERNALSYM PlayMetaFileRecord}
function PlayMetaFileRecord; external gdi32 name 'PlayMetaFileRecord';
{$EXTERNALSYM PlgBlt}
function PlgBlt; external gdi32 name 'PlgBlt';
{$EXTERNALSYM PolyBezier}
function PolyBezier; external gdi32 name 'PolyBezier';
{$EXTERNALSYM PolyBezierTo}
function PolyBezierTo; external gdi32 name 'PolyBezierTo';
{$EXTERNALSYM PolyDraw}
function PolyDraw; external gdi32 name 'PolyDraw';
{$EXTERNALSYM PolyPolygon}
function PolyPolygon; external gdi32 name 'PolyPolygon';
{$EXTERNALSYM PolyPolyline}
function PolyPolyline; external gdi32 name 'PolyPolyline';
{$EXTERNALSYM PolyTextOutA}
function PolyTextOutA; external gdi32 name 'PolyTextOutA';
{$EXTERNALSYM PolyTextOutW}
function PolyTextOutW; external gdi32 name 'PolyTextOutW';
{$EXTERNALSYM PolyTextOut}
function PolyTextOut; external gdi32 name 'PolyTextOutA';
{$EXTERNALSYM Polygon}
function Polygon; external gdi32 name 'Polygon';
{$EXTERNALSYM Polyline}
function Polyline; external gdi32 name 'Polyline';
function PolylineTo; external gdi32 name 'PolylineTo';
{$EXTERNALSYM PtInRegion}
function PtInRegion; external gdi32 name 'PtInRegion';
{$EXTERNALSYM PtVisible}
function PtVisible; external gdi32 name 'PtVisible';
{$EXTERNALSYM RealizePalette}
function RealizePalette; external gdi32 name 'RealizePalette';
{$EXTERNALSYM RectInRegion}
function RectInRegion; external gdi32 name 'RectInRegion';
{$EXTERNALSYM RectVisible}
function RectVisible; external gdi32 name 'RectVisible';
{$EXTERNALSYM Rectangle}
function Rectangle; external gdi32 name 'Rectangle';
{$EXTERNALSYM RemoveFontMemResourceEx}
function RemoveFontMemResourceEx; external gdi32 name 'RemoveFontMemResourceEx';
{$EXTERNALSYM RemoveFontResourceA}
function RemoveFontResourceA; external gdi32 name 'RemoveFontResourceA';
{$EXTERNALSYM RemoveFontResourceW}
function RemoveFontResourceW; external gdi32 name 'RemoveFontResourceW';
{$EXTERNALSYM RemoveFontResource}
function RemoveFontResource; external gdi32 name 'RemoveFontResourceA';
{$EXTERNALSYM RemoveFontResourceExA}
function RemoveFontResourceExA; external gdi32 name 'RemoveFontResourceExA';
{$EXTERNALSYM RemoveFontResourceExW}
function RemoveFontResourceExW; external gdi32 name 'RemoveFontResourceExW';
{$EXTERNALSYM RemoveFontResourceEx}
function RemoveFontResourceEx; external gdi32 name 'RemoveFontResourceExA';
{$EXTERNALSYM ResetDCA}
function ResetDCA; external gdi32 name 'ResetDCA';
{$EXTERNALSYM ResetDCW}
function ResetDCW; external gdi32 name 'ResetDCW';
{$EXTERNALSYM ResetDC}
function ResetDC; external gdi32 name 'ResetDCA';
{$EXTERNALSYM ResizePalette}
function ResizePalette; external gdi32 name 'ResizePalette';
{$EXTERNALSYM RestoreDC}
function RestoreDC; external gdi32 name 'RestoreDC';
{$EXTERNALSYM RoundRect}
function RoundRect; external gdi32 name 'RoundRect';
{$EXTERNALSYM SaveDC}
function SaveDC; external gdi32 name 'SaveDC';
{$EXTERNALSYM ScaleViewportExtEx}
function ScaleViewportExtEx; external gdi32 name 'ScaleViewportExtEx';
{$EXTERNALSYM ScaleWindowExtEx}
function ScaleWindowExtEx; external gdi32 name 'ScaleWindowExtEx';
{$EXTERNALSYM SelectClipPath}
function SelectClipPath; external gdi32 name 'SelectClipPath';
{$EXTERNALSYM SelectClipRgn}
function SelectClipRgn; external gdi32 name 'SelectClipRgn';
{$EXTERNALSYM SelectObject}
function SelectObject; external gdi32 name 'SelectObject';
{$EXTERNALSYM SelectPalette}
function SelectPalette; external gdi32 name 'SelectPalette';
{$EXTERNALSYM SetAbortProc}
function SetAbortProc; external gdi32 name 'SetAbortProc';
{$EXTERNALSYM SetArcDirection}
function SetArcDirection; external gdi32 name 'SetArcDirection';
{$EXTERNALSYM SetBitmapBits}
function SetBitmapBits; external gdi32 name 'SetBitmapBits';
{$EXTERNALSYM SetBitmapDimensionEx}
function SetBitmapDimensionEx; external gdi32 name 'SetBitmapDimensionEx';
{$EXTERNALSYM SetBkColor}
function SetBkColor; external gdi32 name 'SetBkColor';
{$EXTERNALSYM SetBkMode}
function SetBkMode; external gdi32 name 'SetBkMode';
{$EXTERNALSYM SetBoundsRect}
function SetBoundsRect; external gdi32 name 'SetBoundsRect';
{$EXTERNALSYM SetBrushOrgEx}
function SetBrushOrgEx; external gdi32 name 'SetBrushOrgEx';
{$EXTERNALSYM SetColorAdjustment}
function SetColorAdjustment; external gdi32 name 'SetColorAdjustment';
{$EXTERNALSYM SetColorSpace}
function SetColorSpace; external gdi32 name 'SetColorSpace';
{$EXTERNALSYM SetDCBrushColor}
function SetDCBrushColor; external gdi32 name 'SetDCBrushColor';
{$EXTERNALSYM SetDCPenColor}
function SetDCPenColor; external gdi32 name 'SetDCPenColor';
{$EXTERNALSYM SetDIBColorTable}
function SetDIBColorTable; external gdi32 name 'SetDIBColorTable';
{$EXTERNALSYM SetDIBits}
function SetDIBits; external gdi32 name 'SetDIBits';
{$EXTERNALSYM SetDIBitsToDevice}
function SetDIBitsToDevice; external gdi32 name 'SetDIBitsToDevice';
{$EXTERNALSYM SetDeviceGammaRamp}
function SetDeviceGammaRamp; external gdi32 name 'SetDeviceGammaRamp';
{$EXTERNALSYM SetEnhMetaFileBits}
function SetEnhMetaFileBits; external gdi32 name 'SetEnhMetaFileBits';
{$EXTERNALSYM SetGraphicsMode}
function SetGraphicsMode; external gdi32 name 'SetGraphicsMode';
{$EXTERNALSYM SetICMMode}
function SetICMMode; external gdi32 name 'SetICMMode';
{$EXTERNALSYM SetICMProfileA}
function SetICMProfileA; external gdi32 name 'SetICMProfileA';
{$EXTERNALSYM SetICMProfileW}
function SetICMProfileW; external gdi32 name 'SetICMProfileW';
{$EXTERNALSYM SetICMProfile}
function SetICMProfile; external gdi32 name 'SetICMProfileA';
{$EXTERNALSYM SetMapMode}
function SetMapMode; external gdi32 name 'SetMapMode';
{$EXTERNALSYM SetMapperFlags}
function SetMapperFlags; external gdi32 name 'SetMapperFlags';
{$EXTERNALSYM SetMetaFileBitsEx}
function SetMetaFileBitsEx; external gdi32 name 'SetMetaFileBitsEx';
{$EXTERNALSYM SetMetaRgn}
function SetMetaRgn; external gdi32 name 'SetMetaRgn';
{$EXTERNALSYM SetMiterLimit}
function SetMiterLimit; external gdi32 name 'SetMiterLimit';
{$EXTERNALSYM SetPaletteEntries}
function SetPaletteEntries; external gdi32 name 'SetPaletteEntries';
{$EXTERNALSYM SetPixel}
function SetPixel; external gdi32 name 'SetPixel';
{$EXTERNALSYM SetPixelFormat}
function SetPixelFormat; external gdi32 name 'SetPixelFormat';
{$EXTERNALSYM SetPixelV}
function SetPixelV; external gdi32 name 'SetPixelV';
{$EXTERNALSYM SetPolyFillMode}
function SetPolyFillMode; external gdi32 name 'SetPolyFillMode';
{$EXTERNALSYM SetROP2}
function SetROP2; external gdi32 name 'SetROP2';
{$EXTERNALSYM SetRectRgn}
function SetRectRgn; external gdi32 name 'SetRectRgn';
{$EXTERNALSYM SetStretchBltMode}
function SetStretchBltMode; external gdi32 name 'SetStretchBltMode';
{$EXTERNALSYM SetSystemPaletteUse}
function SetSystemPaletteUse; external gdi32 name 'SetSystemPaletteUse';
{$EXTERNALSYM SetTextAlign}
function SetTextAlign; external gdi32 name 'SetTextAlign';
{$EXTERNALSYM SetTextColor}
function SetTextColor; external gdi32 name 'SetTextColor';
{$EXTERNALSYM SetTextCharacterExtra}
function SetTextCharacterExtra; external gdi32 name 'SetTextCharacterExtra';
{$EXTERNALSYM SetTextJustification}
function SetTextJustification; external gdi32 name 'SetTextJustification';
{$EXTERNALSYM SetViewportExtEx}
function SetViewportExtEx; external gdi32 name 'SetViewportExtEx';
{$EXTERNALSYM SetViewportOrgEx}
function SetViewportOrgEx; external gdi32 name 'SetViewportOrgEx';
{$EXTERNALSYM SetWinMetaFileBits}
function SetWinMetaFileBits; external gdi32 name 'SetWinMetaFileBits';
{$EXTERNALSYM SetWindowExtEx}
function SetWindowExtEx; external gdi32 name 'SetWindowExtEx';
{$EXTERNALSYM SetWindowOrgEx}
function SetWindowOrgEx; external gdi32 name 'SetWindowOrgEx';
{$EXTERNALSYM SetWorldTransform}
function SetWorldTransform; external gdi32 name 'SetWorldTransform';
{$EXTERNALSYM StartDocA}
function StartDocA; external gdi32 name 'StartDocA';
{$EXTERNALSYM StartDocW}
function StartDocW; external gdi32 name 'StartDocW';
{$EXTERNALSYM StartDoc}
function StartDoc; external gdi32 name 'StartDocA';
{$EXTERNALSYM StartPage}
function StartPage; external gdi32 name 'StartPage';
{$EXTERNALSYM StretchBlt}
function StretchBlt; external gdi32 name 'StretchBlt';
{$EXTERNALSYM StretchDIBits}
function StretchDIBits; external gdi32 name 'StretchDIBits';
{$EXTERNALSYM StrokeAndFillPath}
function StrokeAndFillPath; external gdi32 name 'StrokeAndFillPath';
{$EXTERNALSYM StrokePath}
function StrokePath; external gdi32 name 'StrokePath';
{$EXTERNALSYM SwapBuffers}
function SwapBuffers; external gdi32 name 'SwapBuffers';
{$EXTERNALSYM TextOutA}
function TextOutA; external gdi32 name 'TextOutA';
{$EXTERNALSYM TextOutW}
function TextOutW; external gdi32 name 'TextOutW';
{$EXTERNALSYM TextOut}
function TextOut; external gdi32 name 'TextOutA';
{$EXTERNALSYM TranslateCharsetInfo}
function TranslateCharsetInfo; external gdi32 name 'TranslateCharsetInfo';
{$EXTERNALSYM TransparentBlt}
function TransparentBlt; external gdi32 name 'TransparentBlt';
{$EXTERNALSYM TransparentDIBits}
function TransparentDIBits; external gdi32 name 'TransparentDIBits';
{$EXTERNALSYM UnrealizeObject}
function UnrealizeObject; external gdi32 name 'UnrealizeObject';
{$EXTERNALSYM UpdateColors}
function UpdateColors; external gdi32 name 'UpdateColors';
{$EXTERNALSYM UpdateICMRegKeyA}
function UpdateICMRegKeyA; external gdi32 name 'UpdateICMRegKeyA';
{$EXTERNALSYM UpdateICMRegKeyW}
function UpdateICMRegKeyW; external gdi32 name 'UpdateICMRegKeyW';
{$EXTERNALSYM UpdateICMRegKey}
function UpdateICMRegKey; external gdi32 name 'UpdateICMRegKeyA';
{$EXTERNALSYM WidenPath}
function WidenPath; external gdi32 name 'WidenPath';

{ Externals from opengl32.dll }

{$EXTERNALSYM wglCopyContext}
function wglCopyContext; external opengl32 name 'wglCopyContext';
{$EXTERNALSYM wglCreateContext}
function wglCreateContext; external opengl32 name 'wglCreateContext';
{$EXTERNALSYM wglCreateLayerContext}
function wglCreateLayerContext; external opengl32 name 'wglCreateLayerContext';
{$EXTERNALSYM wglDeleteContext}
function wglDeleteContext; external opengl32 name 'wglDeleteContext';
{$EXTERNALSYM wglDescribeLayerPlane}
function wglDescribeLayerPlane; external opengl32 name 'wglDescribeLayerPlane';
{$EXTERNALSYM wglGetCurrentContext}
function wglGetCurrentContext; external opengl32 name 'wglGetCurrentContext';
{$EXTERNALSYM wglGetCurrentDC}
function wglGetCurrentDC; external opengl32 name 'wglGetCurrentDC';
{$EXTERNALSYM wglGetLayerPaletteEntries}
function wglGetLayerPaletteEntries; external opengl32 name 'wglGetLayerPaletteEntries';
{$EXTERNALSYM wglMakeCurrent}
function wglMakeCurrent; external opengl32 name 'wglMakeCurrent';
{$EXTERNALSYM wglRealizeLayerPalette}
function wglRealizeLayerPalette; external opengl32 name 'wglRealizeLayerPalette';
{$EXTERNALSYM wglSetLayerPaletteEntries}
function wglSetLayerPaletteEntries; external opengl32 name 'wglSetLayerPaletteEntries';
{$EXTERNALSYM wglShareLists}
function wglShareLists; external opengl32 name 'wglShareLists';
{$EXTERNALSYM wglSwapLayerBuffers}
function wglSwapLayerBuffers; external opengl32 name 'wglSwapLayerBuffers';
{$EXTERNALSYM wglSwapMultipleBuffers}
function wglSwapMultipleBuffers; external opengl32 name 'wglSwapMultipleBuffers';
{$EXTERNALSYM wglUseFontBitmaps}
function wglUseFontBitmapsA; external opengl32 name 'wglUseFontBitmapsA';
{$EXTERNALSYM wglUseFontOutlines}
function wglUseFontOutlinesA; external opengl32 name 'wglUseFontOutlinesA';
{$EXTERNALSYM wglUseFontBitmaps}
function wglUseFontBitmapsW; external opengl32 name 'wglUseFontBitmapsW';
{$EXTERNALSYM wglUseFontOutlines}
function wglUseFontOutlinesW; external opengl32 name 'wglUseFontOutlinesW';
{$EXTERNALSYM wglUseFontBitmaps}
function wglUseFontBitmaps; external opengl32 name 'wglUseFontBitmapsA';
{$EXTERNALSYM wglUseFontOutlines}
function wglUseFontOutlines; external opengl32 name 'wglUseFontOutlinesA';


{ Externals from user32.dll }

{$EXTERNALSYM ActivateKeyboardLayout}
function ActivateKeyboardLayout; external user32 name 'ActivateKeyboardLayout';
{$EXTERNALSYM AdjustWindowRect}
function AdjustWindowRect; external user32 name 'AdjustWindowRect';
{$EXTERNALSYM AdjustWindowRectEx}
function AdjustWindowRectEx; external user32 name 'AdjustWindowRectEx';
{$EXTERNALSYM AnsiToOem}
function AnsiToOem; external user32 name 'CharToOemA';
{$EXTERNALSYM AnsiToOemBuff}
function AnsiToOemBuff; external user32 name 'CharToOemBuffA';
{$EXTERNALSYM AnsiUpper}
function AnsiUpper; external user32 name 'CharUpperA';
{$EXTERNALSYM AnsiUpperBuff}
function AnsiUpperBuff; external user32 name 'CharUpperBuffA';
{$EXTERNALSYM AnsiLower}
function AnsiLower; external user32 name 'CharLowerA';
{$EXTERNALSYM AnsiLowerBuff}
function AnsiLowerBuff; external user32 name 'CharLowerBuffA';
{$EXTERNALSYM AnsiNext}
function AnsiNext; external user32 name 'CharNextA';
{$EXTERNALSYM AnsiPrev}
function AnsiPrev; external user32 name 'CharPrevA';
{$EXTERNALSYM AnyPopup}
function AnyPopup; external user32 name 'AnyPopup';
{$EXTERNALSYM AppendMenuA}
function AppendMenuA; external user32 name 'AppendMenuA';
{$EXTERNALSYM AppendMenuW}
function AppendMenuW; external user32 name 'AppendMenuW';
{$EXTERNALSYM AppendMenu}
function AppendMenu; external user32 name 'AppendMenuA';
{$EXTERNALSYM ArrangeIconicWindows}
function ArrangeIconicWindows; external user32 name 'ArrangeIconicWindows';
{$EXTERNALSYM AttachThreadInput}
function AttachThreadInput; external user32 name 'AttachThreadInput';
{$EXTERNALSYM BeginDeferWindowPos}
function BeginDeferWindowPos; external user32 name 'BeginDeferWindowPos';
{$EXTERNALSYM BeginPaint}
function BeginPaint; external user32 name 'BeginPaint';
{$EXTERNALSYM BringWindowToTop}
function BringWindowToTop; external user32 name 'BringWindowToTop';
{$EXTERNALSYM BroadcastSystemMessageA}
function BroadcastSystemMessageA; external user32 name 'BroadcastSystemMessageA';
{$EXTERNALSYM BroadcastSystemMessageW}
function BroadcastSystemMessageW; external user32 name 'BroadcastSystemMessageA';
{$EXTERNALSYM BroadcastSystemMessage}
function BroadcastSystemMessage; external user32 name 'BroadcastSystemMessageA';
{$EXTERNALSYM CallMsgFilterA}
function CallMsgFilterA; external user32 name 'CallMsgFilterA';
{$EXTERNALSYM CallMsgFilterW}
function CallMsgFilterW; external user32 name 'CallMsgFilterW';
{$EXTERNALSYM CallMsgFilter}
function CallMsgFilter; external user32 name 'CallMsgFilterA';
{$EXTERNALSYM CallNextHookEx}
function CallNextHookEx; external user32 name 'CallNextHookEx';
{$EXTERNALSYM CallWindowProcA}
function CallWindowProcA; external user32 name 'CallWindowProcA';
{$EXTERNALSYM CallWindowProcW}
function CallWindowProcW; external user32 name 'CallWindowProcW';
{$EXTERNALSYM CallWindowProc}
function CallWindowProc; external user32 name 'CallWindowProcA';
{$EXTERNALSYM CascadeWindows}
function CascadeWindows; external user32 name 'CascadeWindows';
{$EXTERNALSYM ChangeClipboardChain}
function ChangeClipboardChain; external user32 name 'ChangeClipboardChain';
{$EXTERNALSYM ChangeDisplaySettingsA}
function ChangeDisplaySettingsA; external user32 name 'ChangeDisplaySettingsA';
{$EXTERNALSYM ChangeDisplaySettingsW}
function ChangeDisplaySettingsW; external user32 name 'ChangeDisplaySettingsW';
{$EXTERNALSYM ChangeDisplaySettings}
function ChangeDisplaySettings; external user32 name 'ChangeDisplaySettingsA';
{$EXTERNALSYM ChangeDisplaySettingsExA}
function ChangeDisplaySettingsExA; external user32 name 'ChangeDisplaySettingsExA';
{$EXTERNALSYM ChangeDisplaySettingsExW}
function ChangeDisplaySettingsExW; external user32 name 'ChangeDisplaySettingsExW';
{$EXTERNALSYM ChangeDisplaySettingsEx}
function ChangeDisplaySettingsEx; external user32 name 'ChangeDisplaySettingsExA';
{$EXTERNALSYM ChangeMenuA}
function ChangeMenuA; external user32 name 'ChangeMenuA';
{$EXTERNALSYM ChangeMenuW}
function ChangeMenuW; external user32 name 'ChangeMenuW';
{$EXTERNALSYM ChangeMenu}
function ChangeMenu; external user32 name 'ChangeMenuA';
{$EXTERNALSYM CharLowerA}
function CharLowerA; external user32 name 'CharLowerA';
{$EXTERNALSYM CharLowerW}
function CharLowerW; external user32 name 'CharLowerW';
{$EXTERNALSYM CharLower}
function CharLower; external user32 name 'CharLowerA';
{$EXTERNALSYM CharLowerBuffA}
function CharLowerBuffA; external user32 name 'CharLowerBuffA';
{$EXTERNALSYM CharLowerBuffW}
function CharLowerBuffW; external user32 name 'CharLowerBuffW';
{$EXTERNALSYM CharLowerBuff}
function CharLowerBuff; external user32 name 'CharLowerBuffA';
{$EXTERNALSYM CharNextA}
function CharNextA; external user32 name 'CharNextA';
{$EXTERNALSYM CharNextW}
function CharNextW; external user32 name 'CharNextW';
{$EXTERNALSYM CharNext}
function CharNext; external user32 name 'CharNextA';
{$EXTERNALSYM CharNextEx}
function CharNextEx; external user32 name 'CharNextExA';
{$EXTERNALSYM CharNextExA}
function CharNextExA; external user32 name 'CharNextExA';
{$EXTERNALSYM CharPrevA}
function CharPrevA; external user32 name 'CharPrevA';
{$EXTERNALSYM CharPrevW}
function CharPrevW; external user32 name 'CharPrevW';
{$EXTERNALSYM CharPrev}
function CharPrev; external user32 name 'CharPrevA';
{$EXTERNALSYM CharPrevEx}
function CharPrevEx; external user32 name 'CharPrevExA';
{$EXTERNALSYM CharPrevExA}
function CharPrevExA; external user32 name 'CharPrevExA';
{$EXTERNALSYM CharToOemA}
function CharToOemA; external user32 name 'CharToOemA';
{$EXTERNALSYM CharToOemW}
function CharToOemW; external user32 name 'CharToOemW';
{$EXTERNALSYM CharToOem}
function CharToOem; external user32 name 'CharToOemA';
{$EXTERNALSYM CharToOemBuffA}
function CharToOemBuffA; external user32 name 'CharToOemBuffA';
{$EXTERNALSYM CharToOemBuffW}
function CharToOemBuffW; external user32 name 'CharToOemBuffW';
{$EXTERNALSYM CharToOemBuff}
function CharToOemBuff; external user32 name 'CharToOemBuffA';
{$EXTERNALSYM CharUpperA}
function CharUpperA; external user32 name 'CharUpperA';
{$EXTERNALSYM CharUpperW}
function CharUpperW; external user32 name 'CharUpperW';
{$EXTERNALSYM CharUpper}
function CharUpper; external user32 name 'CharUpperA';
{$EXTERNALSYM CharUpperBuffA}
function CharUpperBuffA; external user32 name 'CharUpperBuffA';
{$EXTERNALSYM CharUpperBuffW}
function CharUpperBuffW; external user32 name 'CharUpperBuffW';
{$EXTERNALSYM CharUpperBuff}
function CharUpperBuff; external user32 name 'CharUpperBuffA';
{$EXTERNALSYM CheckDlgButton}
function CheckDlgButton; external user32 name 'CheckDlgButton';
{$EXTERNALSYM CheckMenuItem}
function CheckMenuItem; external user32 name 'CheckMenuItem';
{$EXTERNALSYM CheckMenuRadioItem}
function CheckMenuRadioItem; external user32 name 'CheckMenuRadioItem';
{$EXTERNALSYM CheckRadioButton}
function CheckRadioButton; external user32 name 'CheckRadioButton';
{$EXTERNALSYM ChildWindowFromPoint}
function ChildWindowFromPoint; external user32 name 'ChildWindowFromPoint';
{$EXTERNALSYM ChildWindowFromPointEx}
function ChildWindowFromPointEx; external user32 name 'ChildWindowFromPointEx';
{$EXTERNALSYM ClientToScreen}
function ClientToScreen; external user32 name 'ClientToScreen';
{$EXTERNALSYM ClipCursor}
function ClipCursor; external user32 name 'ClipCursor';
{$EXTERNALSYM CloseClipboard}
function CloseClipboard; external user32 name 'CloseClipboard';
{$EXTERNALSYM CloseDesktop}
function CloseDesktop; external user32 name 'CloseDesktop';
{$EXTERNALSYM CloseWindow}
function CloseWindow; external user32 name 'CloseWindow';
{$EXTERNALSYM CloseWindowStation}
function CloseWindowStation; external user32 name 'CloseWindowStation';
{$EXTERNALSYM CopyAcceleratorTableA}
function CopyAcceleratorTableA; external user32 name 'CopyAcceleratorTableA';
{$EXTERNALSYM CopyAcceleratorTableW}
function CopyAcceleratorTableW; external user32 name 'CopyAcceleratorTableW';
{$EXTERNALSYM CopyAcceleratorTable}
function CopyAcceleratorTable; external user32 name 'CopyAcceleratorTableA';
{$EXTERNALSYM CopyIcon}
function CopyIcon; external user32 name 'CopyIcon';
{$EXTERNALSYM CopyImage}
function CopyImage; external user32 name 'CopyImage';
{$EXTERNALSYM CopyRect}
function CopyRect; external user32 name 'CopyRect';
{$EXTERNALSYM CountClipboardFormats}
function CountClipboardFormats; external user32 name 'CountClipboardFormats';
{$EXTERNALSYM CreateAcceleratorTableA}
function CreateAcceleratorTableA; external user32 name 'CreateAcceleratorTableA';
{$EXTERNALSYM CreateAcceleratorTableW}
function CreateAcceleratorTableW; external user32 name 'CreateAcceleratorTableW';
{$EXTERNALSYM CreateAcceleratorTable}
function CreateAcceleratorTable; external user32 name 'CreateAcceleratorTableA';
{$EXTERNALSYM CreateCaret}
function CreateCaret; external user32 name 'CreateCaret';
{$EXTERNALSYM CreateCursor}
function CreateCursor; external user32 name 'CreateCursor';
{$EXTERNALSYM CreateDesktopA}
function CreateDesktopA; external user32 name 'CreateDesktopA';
{$EXTERNALSYM CreateDesktopW}
function CreateDesktopW; external user32 name 'CreateDesktopW';
{$EXTERNALSYM CreateDesktop}
function CreateDesktop; external user32 name 'CreateDesktopA';
{$EXTERNALSYM CreateDialogIndirectParamA}
function CreateDialogIndirectParamA; external user32 name 'CreateDialogIndirectParamA';
{$EXTERNALSYM CreateDialogIndirectParamW}
function CreateDialogIndirectParamW; external user32 name 'CreateDialogIndirectParamW';
{$EXTERNALSYM CreateDialogIndirectParam}
function CreateDialogIndirectParam; external user32 name 'CreateDialogIndirectParamA';
{$EXTERNALSYM CreateDialogParamA}
function CreateDialogParamA; external user32 name 'CreateDialogParamA';
{$EXTERNALSYM CreateDialogParamW}
function CreateDialogParamW; external user32 name 'CreateDialogParamW';
{$EXTERNALSYM CreateDialogParam}
function CreateDialogParam; external user32 name 'CreateDialogParamA';
{$EXTERNALSYM CreateIcon}
function CreateIcon; external user32 name 'CreateIcon';
{$EXTERNALSYM CreateIconFromResource}
function CreateIconFromResource; external user32 name 'CreateIconFromResource';
{$EXTERNALSYM CreateIconFromResourceEx}
function CreateIconFromResourceEx; external user32 name 'CreateIconFromResourceEx';
{$EXTERNALSYM CreateIconIndirect}
function CreateIconIndirect; external user32 name 'CreateIconIndirect';
{$EXTERNALSYM CreateMDIWindowA}
function CreateMDIWindowA; external user32 name 'CreateMDIWindowA';
{$EXTERNALSYM CreateMDIWindowW}
function CreateMDIWindowW; external user32 name 'CreateMDIWindowW';
{$EXTERNALSYM CreateMDIWindow}
function CreateMDIWindow; external user32 name 'CreateMDIWindowA';
{$EXTERNALSYM CreateMenu}
function CreateMenu; external user32 name 'CreateMenu';
{$EXTERNALSYM CreatePopupMenu}
function CreatePopupMenu; external user32 name 'CreatePopupMenu';
{$EXTERNALSYM CreateWindowExA}
function CreateWindowExA; external user32 name 'CreateWindowExA';
{$EXTERNALSYM CreateWindowExW}
function CreateWindowExW; external user32 name 'CreateWindowExW';
{$EXTERNALSYM CreateWindowEx}
function CreateWindowEx; external user32 name 'CreateWindowExA';
{$EXTERNALSYM CreateWindowStationA}
function CreateWindowStationA; external user32 name 'CreateWindowStationA';
{$EXTERNALSYM CreateWindowStationW}
function CreateWindowStationW; external user32 name 'CreateWindowStationW';
{$EXTERNALSYM CreateWindowStation}
function CreateWindowStation; external user32 name 'CreateWindowStationA';
{$EXTERNALSYM DdeSetQualityOfService}
function DdeSetQualityOfService; external user32 name 'DdeSetQualityOfService';
{$EXTERNALSYM DefDlgProcA}
function DefDlgProcA; external user32 name 'DefDlgProcA';
{$EXTERNALSYM DefDlgProcW}
function DefDlgProcW; external user32 name 'DefDlgProcW';
{$EXTERNALSYM DefDlgProc}
function DefDlgProc; external user32 name 'DefDlgProcA';
{$EXTERNALSYM DefFrameProcA}
function DefFrameProcA; external user32 name 'DefFrameProcA';
{$EXTERNALSYM DefFrameProcW}
function DefFrameProcW; external user32 name 'DefFrameProcW';
{$EXTERNALSYM DefFrameProc}
function DefFrameProc; external user32 name 'DefFrameProcA';
{$EXTERNALSYM DefMDIChildProcA}
function DefMDIChildProcA; external user32 name 'DefMDIChildProcA';
{$EXTERNALSYM DefMDIChildProcW}
function DefMDIChildProcW; external user32 name 'DefMDIChildProcW';
{$EXTERNALSYM DefMDIChildProc}
function DefMDIChildProc; external user32 name 'DefMDIChildProcA';
{$EXTERNALSYM DefWindowProcA}
function DefWindowProcA; external user32 name 'DefWindowProcA';
{$EXTERNALSYM DefWindowProcW}
function DefWindowProcW; external user32 name 'DefWindowProcW';
{$EXTERNALSYM DefWindowProc}
function DefWindowProc; external user32 name 'DefWindowProcA';
{$EXTERNALSYM DeferWindowPos}
function DeferWindowPos; external user32 name 'DeferWindowPos';
{$EXTERNALSYM DeleteMenu}
function DeleteMenu; external user32 name 'DeleteMenu';
{$EXTERNALSYM DestroyAcceleratorTable}
function DestroyAcceleratorTable; external user32 name 'DestroyAcceleratorTable';
{$EXTERNALSYM DestroyCaret}
function DestroyCaret; external user32 name 'DestroyCaret';
{$EXTERNALSYM DestroyCursor}
function DestroyCursor; external user32 name 'DestroyCursor';
{$EXTERNALSYM DestroyIcon}
function DestroyIcon; external user32 name 'DestroyIcon';
{$EXTERNALSYM DestroyMenu}
function DestroyMenu; external user32 name 'DestroyMenu';
{$EXTERNALSYM DestroyWindow}
function DestroyWindow; external user32 name 'DestroyWindow';
{$EXTERNALSYM DialogBoxIndirectParamA}
function DialogBoxIndirectParamA; external user32 name 'DialogBoxIndirectParamA';
{$EXTERNALSYM DialogBoxIndirectParamW}
function DialogBoxIndirectParamW; external user32 name 'DialogBoxIndirectParamW';
{$EXTERNALSYM DialogBoxIndirectParam}
function DialogBoxIndirectParam; external user32 name 'DialogBoxIndirectParamA';
{$EXTERNALSYM DialogBoxParamA}
function DialogBoxParamA; external user32 name 'DialogBoxParamA';
{$EXTERNALSYM DialogBoxParamW}
function DialogBoxParamW; external user32 name 'DialogBoxParamW';
{$EXTERNALSYM DialogBoxParam}
function DialogBoxParam; external user32 name 'DialogBoxParamA';
{$EXTERNALSYM DispatchMessageA}
function DispatchMessageA; external user32 name 'DispatchMessageA';
{$EXTERNALSYM DispatchMessageW}
function DispatchMessageW; external user32 name 'DispatchMessageW';
{$EXTERNALSYM DispatchMessage}
function DispatchMessage; external user32 name 'DispatchMessageA';
{$EXTERNALSYM DlgDirListA}
function DlgDirListA; external user32 name 'DlgDirListA';
{$EXTERNALSYM DlgDirListW}
function DlgDirListW; external user32 name 'DlgDirListW';
{$EXTERNALSYM DlgDirList}
function DlgDirList; external user32 name 'DlgDirListA';
{$EXTERNALSYM DlgDirListComboBoxA}
function DlgDirListComboBoxA; external user32 name 'DlgDirListComboBoxA';
{$EXTERNALSYM DlgDirListComboBoxW}
function DlgDirListComboBoxW; external user32 name 'DlgDirListComboBoxW';
{$EXTERNALSYM DlgDirListComboBox}
function DlgDirListComboBox; external user32 name 'DlgDirListComboBoxA';
{$EXTERNALSYM DlgDirSelectComboBoxExA}
function DlgDirSelectComboBoxExA; external user32 name 'DlgDirSelectComboBoxExA';
{$EXTERNALSYM DlgDirSelectComboBoxExW}
function DlgDirSelectComboBoxExW; external user32 name 'DlgDirSelectComboBoxExW';
{$EXTERNALSYM DlgDirSelectComboBoxEx}
function DlgDirSelectComboBoxEx; external user32 name 'DlgDirSelectComboBoxExA';
{$EXTERNALSYM DlgDirSelectExA}
function DlgDirSelectExA; external user32 name 'DlgDirSelectExA';
{$EXTERNALSYM DlgDirSelectExW}
function DlgDirSelectExW; external user32 name 'DlgDirSelectExW';
{$EXTERNALSYM DlgDirSelectEx}
function DlgDirSelectEx; external user32 name 'DlgDirSelectExA';
{$EXTERNALSYM DragDetect}
function DragDetect; external user32 name 'DragDetect';
{$EXTERNALSYM DragObject}
function DragObject; external user32 name 'DragObject';
{$EXTERNALSYM DrawAnimatedRects}
function DrawAnimatedRects; external user32 name 'DrawAnimatedRects';
{$EXTERNALSYM DrawCaption}
function DrawCaption; external user32 name 'DrawCaption';
{$EXTERNALSYM DrawEdge}
function DrawEdge; external user32 name 'DrawEdge';
{$EXTERNALSYM DrawFocusRect}
function DrawFocusRect; external user32 name 'DrawFocusRect';
{$EXTERNALSYM DrawFrameControl}
function DrawFrameControl; external user32 name 'DrawFrameControl';
{$EXTERNALSYM DrawIcon}
function DrawIcon; external user32 name 'DrawIcon';
{$EXTERNALSYM DrawIconEx}
function DrawIconEx; external user32 name 'DrawIconEx';
{$EXTERNALSYM DrawMenuBar}
function DrawMenuBar; external user32 name 'DrawMenuBar';
{$EXTERNALSYM DrawStateA}
function DrawStateA; external user32 name 'DrawStateA';
{$EXTERNALSYM DrawStateW}
function DrawStateW; external user32 name 'DrawStateW';
{$EXTERNALSYM DrawState}
function DrawState; external user32 name 'DrawStateA';
{$EXTERNALSYM DrawTextA}
function DrawTextA; external user32 name 'DrawTextA';
{$EXTERNALSYM DrawTextW}
function DrawTextW; external user32 name 'DrawTextW';
{$EXTERNALSYM DrawText}
function DrawText; external user32 name 'DrawTextA';
{$EXTERNALSYM DrawTextExA}
function DrawTextExA; external user32 name 'DrawTextExA';
{$EXTERNALSYM DrawTextExW}
function DrawTextExW; external user32 name 'DrawTextExW';
{$EXTERNALSYM DrawTextEx}
function DrawTextEx; external user32 name 'DrawTextExA';
{$EXTERNALSYM EmptyClipboard}
function EmptyClipboard; external user32 name 'EmptyClipboard';
{$EXTERNALSYM EnableMenuItem}
function EnableMenuItem; external user32 name 'EnableMenuItem';
{$EXTERNALSYM EnableScrollBar}
function EnableScrollBar; external user32 name 'EnableScrollBar';
{$EXTERNALSYM EnableWindow}
function EnableWindow; external user32 name 'EnableWindow';
{$EXTERNALSYM EndDeferWindowPos}
function EndDeferWindowPos; external user32 name 'EndDeferWindowPos';
{$EXTERNALSYM EndDialog}
function EndDialog; external user32 name 'EndDialog';
{$EXTERNALSYM EndMenu}
function EndMenu; external user32 name 'EndMenu';
{$EXTERNALSYM EndPaint}
function EndPaint; external user32 name 'EndPaint';
{$EXTERNALSYM EnumChildWindows}
function EnumChildWindows; external user32 name 'EnumChildWindows';
{$EXTERNALSYM EnumClipboardFormats}
function EnumClipboardFormats; external user32 name 'EnumClipboardFormats';
{$EXTERNALSYM EnumDesktopsA}
function EnumDesktopsA; external user32 name 'EnumDesktopsA';
{$EXTERNALSYM EnumDesktopsW}
function EnumDesktopsW; external user32 name 'EnumDesktopsW';
{$EXTERNALSYM EnumDesktops}
function EnumDesktops; external user32 name 'EnumDesktopsA';
{$EXTERNALSYM EnumDesktopWindows}
function EnumDesktopWindows; external user32 name 'EnumDesktopWindows';
{$EXTERNALSYM EnumDisplaySettingsA}
function EnumDisplaySettingsA; external user32 name 'EnumDisplaySettingsA';
{$EXTERNALSYM EnumDisplaySettingsW}
function EnumDisplaySettingsW; external user32 name 'EnumDisplaySettingsW';
{$EXTERNALSYM EnumDisplaySettings}
function EnumDisplaySettings; external user32 name 'EnumDisplaySettingsA';
{$EXTERNALSYM EnumDisplayDevicesA}
function EnumDisplayDevicesA; external user32 name 'EnumDisplayDevicesA';
{$EXTERNALSYM EnumDisplayDevicesW}
function EnumDisplayDevicesW; external user32 name 'EnumDisplayDevicesW';
{$EXTERNALSYM EnumDisplayDevices}
function EnumDisplayDevices; external user32 name 'EnumDisplayDevicesA';
{$EXTERNALSYM EnumPropsA}
function EnumPropsA; external user32 name 'EnumPropsA';
{$EXTERNALSYM EnumPropsW}
function EnumPropsW; external user32 name 'EnumPropsW';
{$EXTERNALSYM EnumProps}
function EnumProps; external user32 name 'EnumPropsA';
{$EXTERNALSYM EnumPropsExA}
function EnumPropsExA; external user32 name 'EnumPropsExA';
{$EXTERNALSYM EnumPropsExW}
function EnumPropsExW; external user32 name 'EnumPropsExW';
{$EXTERNALSYM EnumPropsEx}
function EnumPropsEx; external user32 name 'EnumPropsExA';
{$EXTERNALSYM EnumThreadWindows}
function EnumThreadWindows; external user32 name 'EnumThreadWindows';
{$EXTERNALSYM EnumWindowStationsA}
function EnumWindowStationsA; external user32 name 'EnumWindowStationsA';
{$EXTERNALSYM EnumWindowStationsW}
function EnumWindowStationsW; external user32 name 'EnumWindowStationsW';
{$EXTERNALSYM EnumWindowStations}
function EnumWindowStations; external user32 name 'EnumWindowStationsA';
{$EXTERNALSYM EnumWindows}
function EnumWindows; external user32 name 'EnumWindows';
{$EXTERNALSYM EqualRect}
function EqualRect; external user32 name 'EqualRect';
{$EXTERNALSYM ExcludeUpdateRgn}
function ExcludeUpdateRgn; external user32 name 'ExcludeUpdateRgn';
{$EXTERNALSYM ExitWindowsEx}
function ExitWindowsEx; external user32 name 'ExitWindowsEx';
{$EXTERNALSYM FillRect}
function FillRect; external user32 name 'FillRect';
{$EXTERNALSYM FindWindowA}
function FindWindowA; external user32 name 'FindWindowA';
{$EXTERNALSYM FindWindowW}
function FindWindowW; external user32 name 'FindWindowW';
{$EXTERNALSYM FindWindow}
function FindWindow; external user32 name 'FindWindowA';
{$EXTERNALSYM FindWindowExA}
function FindWindowExA; external user32 name 'FindWindowExA';
{$EXTERNALSYM FindWindowExW}
function FindWindowExW; external user32 name 'FindWindowExW';
{$EXTERNALSYM FindWindowEx}
function FindWindowEx; external user32 name 'FindWindowExA';
{$EXTERNALSYM FlashWindow}
function FlashWindow; external user32 name 'FlashWindow';
{$EXTERNALSYM FrameRect}
function FrameRect; external user32 name 'FrameRect';
{$EXTERNALSYM FreeDDElParam}
function FreeDDElParam; external user32 name 'FreeDDElParam';
{$EXTERNALSYM GetActiveWindow}
function GetActiveWindow; external user32 name 'GetActiveWindow';
{$EXTERNALSYM GetAltTabInfoA}
function GetAltTabInfoA; external user32 name 'GetAltTabInfoA';
{$EXTERNALSYM GetAltTabInfoW}
function GetAltTabInfoW; external user32 name 'GetAltTabInfoW';
{$EXTERNALSYM GetAltTabInfo}
function GetAltTabInfo; external user32 name 'GetAltTabInfoA';
{$EXTERNALSYM GetAncestor}
function GetAncestor; external user32 name 'GetAncestor';
{$EXTERNALSYM GetAsyncKeyState}
function GetAsyncKeyState; external user32 name 'GetAsyncKeyState';
{$EXTERNALSYM GetCapture}
function GetCapture; external user32 name 'GetCapture';
{$EXTERNALSYM GetCaretBlinkTime}
function GetCaretBlinkTime; external user32 name 'GetCaretBlinkTime';
{$EXTERNALSYM GetCaretPos}
function GetCaretPos; external user32 name 'GetCaretPos';
{$EXTERNALSYM GetClassInfoA}
function GetClassInfoA; external user32 name 'GetClassInfoA';
{$EXTERNALSYM GetClassInfoW}
function GetClassInfoW; external user32 name 'GetClassInfoW';
{$EXTERNALSYM GetClassInfo}
function GetClassInfo; external user32 name 'GetClassInfoA';
{$EXTERNALSYM GetClassInfoExA}
function GetClassInfoExA; external user32 name 'GetClassInfoExA';
{$EXTERNALSYM GetClassInfoExW}
function GetClassInfoExW; external user32 name 'GetClassInfoExW';
{$EXTERNALSYM GetClassInfoEx}
function GetClassInfoEx; external user32 name 'GetClassInfoExA';
{$EXTERNALSYM GetClassLongA}
function GetClassLongA; external user32 name 'GetClassLongA';
{$EXTERNALSYM GetClassLongW}
function GetClassLongW; external user32 name 'GetClassLongW';
{$EXTERNALSYM GetClassLong}
function GetClassLong; external user32 name 'GetClassLongA';
{$EXTERNALSYM GetClassNameA}
function GetClassNameA; external user32 name 'GetClassNameA';
{$EXTERNALSYM GetClassNameW}
function GetClassNameW; external user32 name 'GetClassNameW';
{$EXTERNALSYM GetClassName}
function GetClassName; external user32 name 'GetClassNameA';
{$EXTERNALSYM GetClassWord}
function GetClassWord; external user32 name 'GetClassWord';
{$EXTERNALSYM GetClientRect}
function GetClientRect; external user32 name 'GetClientRect';
{$EXTERNALSYM GetClipCursor}
function GetClipCursor; external user32 name 'GetClipCursor';
{$EXTERNALSYM GetClipboardData}
function GetClipboardData; external user32 name 'GetClipboardData';
{$EXTERNALSYM GetClipboardFormatNameA}
function GetClipboardFormatNameA; external user32 name 'GetClipboardFormatNameA';
{$EXTERNALSYM GetClipboardFormatNameW}
function GetClipboardFormatNameW; external user32 name 'GetClipboardFormatNameW';
{$EXTERNALSYM GetClipboardFormatName}
function GetClipboardFormatName; external user32 name 'GetClipboardFormatNameA';
{$EXTERNALSYM GetClipboardSequenceNumber}
function GetClipboardSequenceNumber; external user32 name 'GetClipboardSequenceNumber';
{$EXTERNALSYM GetClipboardOwner}
function GetClipboardOwner; external user32 name 'GetClipboardOwner';
{$EXTERNALSYM GetClipboardViewer}
function GetClipboardViewer; external user32 name 'GetClipboardViewer';
{$EXTERNALSYM GetComboBoxInfo}
function GetComboBoxInfo; external user32 name 'GetComboBoxInfo';
{$EXTERNALSYM GetCursor}
function GetCursor; external user32 name 'GetCursor';
{$EXTERNALSYM GetCursorInfo}
function GetCursorInfo; external user32 name 'GetCursorInfo';
{$EXTERNALSYM GetCursorPos}
function GetCursorPos; external user32 name 'GetCursorPos';
{$EXTERNALSYM GetDC}
function GetDC; external user32 name 'GetDC';
{$EXTERNALSYM GetDCEx}
function GetDCEx; external user32 name 'GetDCEx';
{$EXTERNALSYM GetDesktopWindow}
function GetDesktopWindow; external user32 name 'GetDesktopWindow';
{$EXTERNALSYM GetDialogBaseUnits}
function GetDialogBaseUnits; external user32 name 'GetDialogBaseUnits';
{$EXTERNALSYM GetDlgCtrlID}
function GetDlgCtrlID; external user32 name 'GetDlgCtrlID';
{$EXTERNALSYM GetDlgItem}
function GetDlgItem; external user32 name 'GetDlgItem';
{$EXTERNALSYM GetDlgItemInt}
function GetDlgItemInt; external user32 name 'GetDlgItemInt';
{$EXTERNALSYM GetDlgItemTextA}
function GetDlgItemTextA; external user32 name 'GetDlgItemTextA';
{$EXTERNALSYM GetDlgItemTextW}
function GetDlgItemTextW; external user32 name 'GetDlgItemTextW';
{$EXTERNALSYM GetDlgItemText}
function GetDlgItemText; external user32 name 'GetDlgItemTextA';
{$EXTERNALSYM GetDoubleClickTime}
function GetDoubleClickTime; external user32 name 'GetDoubleClickTime';
{$EXTERNALSYM GetFocus}
function GetFocus; external user32 name 'GetFocus';
{$EXTERNALSYM GetForegroundWindow}
function GetForegroundWindow; external user32 name 'GetForegroundWindow';
{$EXTERNALSYM GetGuiResources}
function GetGuiResources; external user32 name 'GetGuiResources';
{$EXTERNALSYM GetGUIThreadInfo}
function GetGUIThreadInfo; external user32 name 'GetGUIThreadInfo';
{$EXTERNALSYM GetIconInfo}
function GetIconInfo; external user32 name 'GetIconInfo';
{$EXTERNALSYM GetInputState}
function GetInputState; external user32 name 'GetInputState';
{$EXTERNALSYM GetKBCodePage}
function GetKBCodePage; external user32 name 'GetKBCodePage';
{$EXTERNALSYM GetKeyNameTextA}
function GetKeyNameTextA; external user32 name 'GetKeyNameTextA';
{$EXTERNALSYM GetKeyNameTextW}
function GetKeyNameTextW; external user32 name 'GetKeyNameTextW';
{$EXTERNALSYM GetKeyNameText}
function GetKeyNameText; external user32 name 'GetKeyNameTextA';
{$EXTERNALSYM GetKeyState}
function GetKeyState; external user32 name 'GetKeyState';
{$EXTERNALSYM GetKeyboardLayout}
function GetKeyboardLayout; external user32 name 'GetKeyboardLayout';
{$EXTERNALSYM GetKeyboardLayoutList}
function GetKeyboardLayoutList; external user32 name 'GetKeyboardLayoutList';
{$EXTERNALSYM GetKeyboardLayoutNameA}
function GetKeyboardLayoutNameA; external user32 name 'GetKeyboardLayoutNameA';
{$EXTERNALSYM GetKeyboardLayoutNameW}
function GetKeyboardLayoutNameW; external user32 name 'GetKeyboardLayoutNameW';
{$EXTERNALSYM GetKeyboardLayoutName}
function GetKeyboardLayoutName; external user32 name 'GetKeyboardLayoutNameA';
{$EXTERNALSYM GetMouseMovePoints}
function GetMouseMovePoints; external user32 name 'GetMouseMovePoints';
{$EXTERNALSYM GetKeyboardState}
function GetKeyboardState; external user32 name 'GetKeyboardState';
{$EXTERNALSYM GetKeyboardType}
function GetKeyboardType; external user32 name 'GetKeyboardType';
{$EXTERNALSYM GetLastActivePopup}
function GetLastActivePopup; external user32 name 'GetLastActivePopup';
{$EXTERNALSYM GetLastInputInfo}
function GetLastInputInfo; external user32 name 'GetLastInputInfo';
{$EXTERNALSYM GetListBoxInfo}
function GetListBoxInfo; external user32 name 'GetListBoxInfo';
{$EXTERNALSYM GetMenu}
function GetMenu; external user32 name 'GetMenu';
{$EXTERNALSYM GetMenuBarInfo}
function GetMenuBarInfo; external user32 name 'GetMenuBarInfo';
{$EXTERNALSYM GetMenuCheckMarkDimensions}
function GetMenuCheckMarkDimensions; external user32 name 'GetMenuCheckMarkDimensions';
{$EXTERNALSYM GetMenuContextHelpId}
function GetMenuContextHelpId; external user32 name 'GetMenuContextHelpId';
{$EXTERNALSYM GetMenuDefaultItem}
function GetMenuDefaultItem; external user32 name 'GetMenuDefaultItem';
{$EXTERNALSYM GetMenuInfo}
function GetMenuInfo; external user32 name 'GetMenuInfo';
{$EXTERNALSYM GetMenuItemCount}
function GetMenuItemCount; external user32 name 'GetMenuItemCount';
{$EXTERNALSYM GetMenuItemID}
function GetMenuItemID; external user32 name 'GetMenuItemID';
{$EXTERNALSYM GetMenuItemInfoA}
function GetMenuItemInfoA; external user32 name 'GetMenuItemInfoA';
{$EXTERNALSYM GetMenuItemInfoW}
function GetMenuItemInfoW; external user32 name 'GetMenuItemInfoW';
{$EXTERNALSYM GetMenuItemInfo}
function GetMenuItemInfo; external user32 name 'GetMenuItemInfoA';
{$EXTERNALSYM GetMenuItemRect}
function GetMenuItemRect; external user32 name 'GetMenuItemRect';
{$EXTERNALSYM GetMenuState}
function GetMenuState; external user32 name 'GetMenuState';
{$EXTERNALSYM GetMenuStringA}
function GetMenuStringA; external user32 name 'GetMenuStringA';
{$EXTERNALSYM GetMenuStringW}
function GetMenuStringW; external user32 name 'GetMenuStringW';
{$EXTERNALSYM GetMenuString}
function GetMenuString; external user32 name 'GetMenuStringA';
{$EXTERNALSYM GetMessageA}
function GetMessageA; external user32 name 'GetMessageA';
{$EXTERNALSYM GetMessageW}
function GetMessageW; external user32 name 'GetMessageW';
{$EXTERNALSYM GetMessage}
function GetMessage; external user32 name 'GetMessageA';
{$EXTERNALSYM GetMessageExtraInfo}
function GetMessageExtraInfo; external user32 name 'GetMessageExtraInfo';
{$EXTERNALSYM GetMessagePos}
function GetMessagePos; external user32 name 'GetMessagePos';
{$EXTERNALSYM GetMessageTime}
function GetMessageTime; external user32 name 'GetMessageTime';
{$EXTERNALSYM GetNextDlgGroupItem}
function GetNextDlgGroupItem; external user32 name 'GetNextDlgGroupItem';
{$EXTERNALSYM GetNextDlgTabItem}
function GetNextDlgTabItem; external user32 name 'GetNextDlgTabItem';
{$EXTERNALSYM GetNextWindow}
function GetNextWindow; external user32 name 'GetWindow';
{$EXTERNALSYM GetOpenClipboardWindow}
function GetOpenClipboardWindow; external user32 name 'GetOpenClipboardWindow';
{$EXTERNALSYM GetParent}
function GetParent; external user32 name 'GetParent';
{$EXTERNALSYM GetPriorityClipboardFormat}
function GetPriorityClipboardFormat; external user32 name 'GetPriorityClipboardFormat';
{$EXTERNALSYM GetProcessWindowStation}
function GetProcessWindowStation; external user32 name 'GetProcessWindowStation';
{$EXTERNALSYM GetPropA}
function GetPropA; external user32 name 'GetPropA';
{$EXTERNALSYM GetPropW}
function GetPropW; external user32 name 'GetPropW';
{$EXTERNALSYM GetProp}
function GetProp; external user32 name 'GetPropA';
{$EXTERNALSYM GetQueueStatus}
function GetQueueStatus; external user32 name 'GetQueueStatus';
{$EXTERNALSYM GetScrollBarInfo}
function GetScrollBarInfo; external user32 name 'GetScrollBarInfo';
{$EXTERNALSYM GetScrollInfo}
function GetScrollInfo; external user32 name 'GetScrollInfo';
{$EXTERNALSYM GetScrollPos}
function GetScrollPos; external user32 name 'GetScrollPos';
{$EXTERNALSYM GetScrollRange}
function GetScrollRange; external user32 name 'GetScrollRange';
{$EXTERNALSYM GetSubMenu}
function GetSubMenu; external user32 name 'GetSubMenu';
{$EXTERNALSYM GetSysColor}
function GetSysColor; external user32 name 'GetSysColor';
{$EXTERNALSYM GetSysColorBrush}
function GetSysColorBrush; external user32 name 'GetSysColorBrush';
{$EXTERNALSYM GetSystemMenu}
function GetSystemMenu; external user32 name 'GetSystemMenu';
{$EXTERNALSYM GetSystemMetrics}
function GetSystemMetrics; external user32 name 'GetSystemMetrics';
{$EXTERNALSYM GetTabbedTextExtentA}
function GetTabbedTextExtentA; external user32 name 'GetTabbedTextExtentA';
{$EXTERNALSYM GetTabbedTextExtentW}
function GetTabbedTextExtentW; external user32 name 'GetTabbedTextExtentW';
{$EXTERNALSYM GetTabbedTextExtent}
function GetTabbedTextExtent; external user32 name 'GetTabbedTextExtentA';
{$EXTERNALSYM GetThreadDesktop}
function GetThreadDesktop; external user32 name 'GetThreadDesktop';
{$EXTERNALSYM GetTitleBarInfo}
function GetTitleBarInfo; external user32 name 'GetTitleInfo';
{$EXTERNALSYM GetTopWindow}
function GetTopWindow; external user32 name 'GetTopWindow';
{$EXTERNALSYM GetUpdateRect}
function GetUpdateRect; external user32 name 'GetUpdateRect';
{$EXTERNALSYM GetUpdateRgn}
function GetUpdateRgn; external user32 name 'GetUpdateRgn';
{$EXTERNALSYM GetUserObjectInformationA}
function GetUserObjectInformationA; external user32 name 'GetUserObjectInformationA';
{$EXTERNALSYM GetUserObjectInformationW}
function GetUserObjectInformationW; external user32 name 'GetUserObjectInformationW';
{$EXTERNALSYM GetUserObjectInformation}
function GetUserObjectInformation; external user32 name 'GetUserObjectInformationA';
{$EXTERNALSYM GetUserObjectSecurity}
function GetUserObjectSecurity; external user32 name 'GetUserObjectSecurity';
{$EXTERNALSYM GetWindow}
function GetWindow; external user32 name 'GetWindow';
{$EXTERNALSYM GetWindowContextHelpId}
function GetWindowContextHelpId; external user32 name 'GetWindowContextHelpId';
{$EXTERNALSYM GetWindowDC}
function GetWindowDC; external user32 name 'GetWindowDC';
{$EXTERNALSYM GetWindowInfo}
function GetWindowInfo; external user32 name 'GetWindowInfo';
{$EXTERNALSYM GetWindowLongA}
function GetWindowLongA; external user32 name 'GetWindowLongA';
{$EXTERNALSYM GetWindowLongW}
function GetWindowLongW; external user32 name 'GetWindowLongW';
{$EXTERNALSYM GetWindowLong}
function GetWindowLong; external user32 name 'GetWindowLongA';
{$EXTERNALSYM GetWindowModuleFileNameA}
function GetWindowModuleFileNameA; external user32 name 'GetWindowModuleFileNameA';
{$EXTERNALSYM GetWindowModuleFileNameW}
function GetWindowModuleFileNameW; external user32 name 'GetWindowModuleFileNameW';
{$EXTERNALSYM GetWindowModuleFileName}
function GetWindowModuleFileName; external user32 name 'GetWindowModuleFileNameA';
{$EXTERNALSYM GetWindowPlacement}
function GetWindowPlacement; external user32 name 'GetWindowPlacement';
{$EXTERNALSYM GetWindowRect}
function GetWindowRect; external user32 name 'GetWindowRect';
{$EXTERNALSYM GetWindowRgn}
function GetWindowRgn; external user32 name 'GetWindowRgn';
{$EXTERNALSYM GetWindowTextA}
function GetWindowTextA; external user32 name 'GetWindowTextA';
{$EXTERNALSYM GetWindowTextW}
function GetWindowTextW; external user32 name 'GetWindowTextW';
{$EXTERNALSYM GetWindowText}
function GetWindowText; external user32 name 'GetWindowTextA';
{$EXTERNALSYM GetWindowTextLengthA}
function GetWindowTextLengthA; external user32 name 'GetWindowTextLengthA';
{$EXTERNALSYM GetWindowTextLengthW}
function GetWindowTextLengthW; external user32 name 'GetWindowTextLengthW';
{$EXTERNALSYM GetWindowTextLength}
function GetWindowTextLength; external user32 name 'GetWindowTextLengthA';
{$EXTERNALSYM GetWindowThreadProcessId}
function GetWindowThreadProcessId; external user32 name 'GetWindowThreadProcessId';
{$EXTERNALSYM GetWindowWord}
function GetWindowWord; external user32 name 'GetWindowWord';
{$EXTERNALSYM GrayStringA}
function GrayStringA; external user32 name 'GrayStringA';
{$EXTERNALSYM GrayStringW}
function GrayStringW; external user32 name 'GrayStringW';
{$EXTERNALSYM GrayString}
function GrayString; external user32 name 'GrayStringA';
{$EXTERNALSYM HideCaret}
function HideCaret; external user32 name 'HideCaret';
{$EXTERNALSYM HiliteMenuItem}
function HiliteMenuItem; external user32 name 'HiliteMenuItem';
{$EXTERNALSYM ImpersonateDdeClientWindow}
function ImpersonateDdeClientWindow; external user32 name 'ImpersonateDdeClientWindow';
{$EXTERNALSYM InSendMessage}
function InSendMessage; external user32 name 'InSendMessage';
{$EXTERNALSYM InSendMessageeX}
function InSendMessageeX; external user32 name 'InSendMessageeX';
{$EXTERNALSYM InflateRect}
function InflateRect; external user32 name 'InflateRect';
{$EXTERNALSYM InsertMenuA}
function InsertMenuA; external user32 name 'InsertMenuA';
{$EXTERNALSYM InsertMenuW}
function InsertMenuW; external user32 name 'InsertMenuW';
{$EXTERNALSYM InsertMenu}
function InsertMenu; external user32 name 'InsertMenuA';
{$EXTERNALSYM InsertMenuItemA}
function InsertMenuItemA; external user32 name 'InsertMenuItemA';
{$EXTERNALSYM InsertMenuItemW}
function InsertMenuItemW; external user32 name 'InsertMenuItemW';
{$EXTERNALSYM InsertMenuItem}
function InsertMenuItem; external user32 name 'InsertMenuItemA';
{$EXTERNALSYM IntersectRect}
function IntersectRect; external user32 name 'IntersectRect';
{$EXTERNALSYM InvalidateRect}
function InvalidateRect; external user32 name 'InvalidateRect';
{$EXTERNALSYM InvalidateRgn}
function InvalidateRgn; external user32 name 'InvalidateRgn';
{$EXTERNALSYM InvertRect}
function InvertRect; external user32 name 'InvertRect';
{$EXTERNALSYM IsCharAlphaA}
function IsCharAlphaA; external user32 name 'IsCharAlphaA';
{$EXTERNALSYM IsCharAlphaW}
function IsCharAlphaW; external user32 name 'IsCharAlphaW';
{$EXTERNALSYM IsCharAlpha}
function IsCharAlpha; external user32 name 'IsCharAlphaA';
{$EXTERNALSYM IsCharAlphaNumericA}
function IsCharAlphaNumericA; external user32 name 'IsCharAlphaNumericA';
{$EXTERNALSYM IsCharAlphaNumericW}
function IsCharAlphaNumericW; external user32 name 'IsCharAlphaNumericW';
{$EXTERNALSYM IsCharAlphaNumeric}
function IsCharAlphaNumeric; external user32 name 'IsCharAlphaNumericA';
{$EXTERNALSYM IsCharLowerA}
function IsCharLowerA; external user32 name 'IsCharLowerA';
{$EXTERNALSYM IsCharLowerW}
function IsCharLowerW; external user32 name 'IsCharLowerW';
{$EXTERNALSYM IsCharLower}
function IsCharLower; external user32 name 'IsCharLowerA';
{$EXTERNALSYM IsCharUpperA}
function IsCharUpperA; external user32 name 'IsCharUpperA';
{$EXTERNALSYM IsCharUpperW}
function IsCharUpperW; external user32 name 'IsCharUpperW';
{$EXTERNALSYM IsCharUpper}
function IsCharUpper; external user32 name 'IsCharUpperA';
{$EXTERNALSYM IsChild}
function IsChild; external user32 name 'IsChild';
{$EXTERNALSYM IsClipboardFormatAvailable}
function IsClipboardFormatAvailable; external user32 name 'IsClipboardFormatAvailable';
{$EXTERNALSYM IsDialogMessageA}
function IsDialogMessageA; external user32 name 'IsDialogMessageA';
{$EXTERNALSYM IsDialogMessageW}
function IsDialogMessageW; external user32 name 'IsDialogMessageW';
{$EXTERNALSYM IsDialogMessage}
function IsDialogMessage; external user32 name 'IsDialogMessageA';
{$EXTERNALSYM IsDlgButtonChecked}
function IsDlgButtonChecked; external user32 name 'IsDlgButtonChecked';
{$EXTERNALSYM IsIconic}
function IsIconic; external user32 name 'IsIconic';
{$EXTERNALSYM IsMenu}
function IsMenu; external user32 name 'IsMenu';
{$EXTERNALSYM IsRectEmpty}
function IsRectEmpty; external user32 name 'IsRectEmpty';
{$EXTERNALSYM IsWindow}
function IsWindow; external user32 name 'IsWindow';
{$EXTERNALSYM IsWindowEnabled}
function IsWindowEnabled; external user32 name 'IsWindowEnabled';
function IsWindowUnicode; external user32 name 'IsWindowUnicode';
{$EXTERNALSYM IsWindowVisible}
function IsWindowVisible; external user32 name 'IsWindowVisible';
{$EXTERNALSYM IsZoomed}
function IsZoomed; external user32 name 'IsZoomed';
{$EXTERNALSYM KillTimer}
function KillTimer; external user32 name 'KillTimer';
{$EXTERNALSYM LoadAcceleratorsA}
function LoadAcceleratorsA; external user32 name 'LoadAcceleratorsA';
{$EXTERNALSYM LoadAcceleratorsW}
function LoadAcceleratorsW; external user32 name 'LoadAcceleratorsW';
{$EXTERNALSYM LoadAccelerators}
function LoadAccelerators; external user32 name 'LoadAcceleratorsA';
{$EXTERNALSYM LoadBitmapA}
function LoadBitmapA; external user32 name 'LoadBitmapA';
{$EXTERNALSYM LoadBitmapW}
function LoadBitmapW; external user32 name 'LoadBitmapW';
{$EXTERNALSYM LoadBitmap}
function LoadBitmap; external user32 name 'LoadBitmapA';
{$EXTERNALSYM LoadCursorA}
function LoadCursorA; external user32 name 'LoadCursorA';
{$EXTERNALSYM LoadCursorW}
function LoadCursorW; external user32 name 'LoadCursorW';
{$EXTERNALSYM LoadCursor}
function LoadCursor; external user32 name 'LoadCursorA';
{$EXTERNALSYM LoadCursorFromFileA}
function LoadCursorFromFileA; external user32 name 'LoadCursorFromFileA';
{$EXTERNALSYM LoadCursorFromFileW}
function LoadCursorFromFileW; external user32 name 'LoadCursorFromFileW';
{$EXTERNALSYM LoadCursorFromFile}
function LoadCursorFromFile; external user32 name 'LoadCursorFromFileA';
{$EXTERNALSYM LoadIconA}
function LoadIconA; external user32 name 'LoadIconA';
{$EXTERNALSYM LoadIconW}
function LoadIconW; external user32 name 'LoadIconW';
{$EXTERNALSYM LoadIcon}
function LoadIcon; external user32 name 'LoadIconA';
{$EXTERNALSYM LoadImageA}
function LoadImageA; external user32 name 'LoadImageA';
{$EXTERNALSYM LoadImageW}
function LoadImageW; external user32 name 'LoadImageW';
{$EXTERNALSYM LoadImage}
function LoadImage; external user32 name 'LoadImageA';
{$EXTERNALSYM LoadKeyboardLayoutA}
function LoadKeyboardLayoutA; external user32 name 'LoadKeyboardLayoutA';
{$EXTERNALSYM LoadKeyboardLayoutW}
function LoadKeyboardLayoutW; external user32 name 'LoadKeyboardLayoutW';
{$EXTERNALSYM LoadKeyboardLayout}
function LoadKeyboardLayout; external user32 name 'LoadKeyboardLayoutA';
{$EXTERNALSYM LoadMenuA}
function LoadMenuA; external user32 name 'LoadMenuA';
{$EXTERNALSYM LoadMenuW}
function LoadMenuW; external user32 name 'LoadMenuW';
{$EXTERNALSYM LoadMenu}
function LoadMenu; external user32 name 'LoadMenuA';
{$EXTERNALSYM LoadMenuIndirectA}
function LoadMenuIndirectA; external user32 name 'LoadMenuIndirectA';
{$EXTERNALSYM LoadMenuIndirectW}
function LoadMenuIndirectW; external user32 name 'LoadMenuIndirectW';
{$EXTERNALSYM LoadMenuIndirect}
function LoadMenuIndirect; external user32 name 'LoadMenuIndirectA';
{$EXTERNALSYM LoadStringA}
function LoadStringA; external user32 name 'LoadStringA';
{$EXTERNALSYM LoadStringW}
function LoadStringW; external user32 name 'LoadStringW';
{$EXTERNALSYM LoadString}
function LoadString; external user32 name 'LoadStringA';
{$EXTERNALSYM LockWindowUpdate}
function LockWindowUpdate; external user32 name 'LockWindowUpdate';
{$EXTERNALSYM LockWorkStation}
function LockWorkStation; external user32 name 'LockWorkStation';
{$EXTERNALSYM LookupIconIdFromDirectory}
function LookupIconIdFromDirectory; external user32 name 'LookupIconIdFromDirectory';
{$EXTERNALSYM LookupIconIdFromDirectoryEx}
function LookupIconIdFromDirectoryEx; external user32 name 'LookupIconIdFromDirectoryEx';
{$EXTERNALSYM MapDialogRect}
function MapDialogRect; external user32 name 'MapDialogRect';
{$EXTERNALSYM MapVirtualKeyA}
function MapVirtualKeyA; external user32 name 'MapVirtualKeyA';
{$EXTERNALSYM MapVirtualKeyW}
function MapVirtualKeyW; external user32 name 'MapVirtualKeyW';
{$EXTERNALSYM MapVirtualKey}
function MapVirtualKey; external user32 name 'MapVirtualKeyA';
{$EXTERNALSYM MapVirtualKeyExA}
function MapVirtualKeyExA; external user32 name 'MapVirtualKeyExA';
{$EXTERNALSYM MapVirtualKeyExW}
function MapVirtualKeyExW; external user32 name 'MapVirtualKeyExW';
{$EXTERNALSYM MapVirtualKeyEx}
function MapVirtualKeyEx; external user32 name 'MapVirtualKeyExA';
{$EXTERNALSYM MapWindowPoints}
function MapWindowPoints; external user32 name 'MapWindowPoints';
{$EXTERNALSYM MenuItemFromPoint}
function MenuItemFromPoint; external user32 name 'MenuItemFromPoint';
{$EXTERNALSYM MessageBeep}
function MessageBeep; external user32 name 'MessageBeep';
{$EXTERNALSYM MessageBoxA}
function MessageBoxA; external user32 name 'MessageBoxA';
{$EXTERNALSYM MessageBoxW}
function MessageBoxW; external user32 name 'MessageBoxW';
{$EXTERNALSYM MessageBox}
function MessageBox; external user32 name 'MessageBoxA';
{$EXTERNALSYM MessageBoxExA}
function MessageBoxExA; external user32 name 'MessageBoxExA';
{$EXTERNALSYM MessageBoxExW}
function MessageBoxExW; external user32 name 'MessageBoxExW';
{$EXTERNALSYM MessageBoxEx}
function MessageBoxEx; external user32 name 'MessageBoxExA';
{$EXTERNALSYM MessageBoxIndirectA}
function MessageBoxIndirectA; external user32 name 'MessageBoxIndirectA';
{$EXTERNALSYM MessageBoxIndirectW}
function MessageBoxIndirectW; external user32 name 'MessageBoxIndirectW';
{$EXTERNALSYM MessageBoxIndirect}
function MessageBoxIndirect; external user32 name 'MessageBoxIndirectA';
{$EXTERNALSYM ModifyMenuA}
function ModifyMenuA; external user32 name 'ModifyMenuA';
{$EXTERNALSYM ModifyMenuW}
function ModifyMenuW; external user32 name 'ModifyMenuW';
{$EXTERNALSYM ModifyMenu}
function ModifyMenu; external user32 name 'ModifyMenuA';
{$EXTERNALSYM MoveWindow}
function MoveWindow; external user32 name 'MoveWindow';
{$EXTERNALSYM MsgWaitForMultipleObjects}
function MsgWaitForMultipleObjects; external user32 name 'MsgWaitForMultipleObjects';
{$EXTERNALSYM MsgWaitForMultipleObjectsEx}
function MsgWaitForMultipleObjectsEx; external user32 name 'MsgWaitForMultipleObjectsEx';
{$EXTERNALSYM NotifyWinEvent}
procedure NotifyWinEvent; external user32 name 'NotifyWinEvent';
{$EXTERNALSYM OemKeyScan}
function OemKeyScan; external user32 name 'OemKeyScan';
{$EXTERNALSYM OemToAnsi}
function OemToAnsi; external user32 name 'OemToCharA';
{$EXTERNALSYM OemToAnsiBuff}
function OemToAnsiBuff; external user32 name 'OemToCharBuffA';
{$EXTERNALSYM OemToCharA}
function OemToCharA; external user32 name 'OemToCharA';
{$EXTERNALSYM OemToCharW}
function OemToCharW; external user32 name 'OemToCharW';
{$EXTERNALSYM OemToChar}
function OemToChar; external user32 name 'OemToCharA';
{$EXTERNALSYM OemToCharBuffA}
function OemToCharBuffA; external user32 name 'OemToCharBuffA';
{$EXTERNALSYM OemToCharBuffW}
function OemToCharBuffW; external user32 name 'OemToCharBuffW';
{$EXTERNALSYM OemToCharBuff}
function OemToCharBuff; external user32 name 'OemToCharBuffA';
{$EXTERNALSYM OffsetRect}
function OffsetRect; external user32 name 'OffsetRect';
{$EXTERNALSYM OpenClipboard}
function OpenClipboard; external user32 name 'OpenClipboard';
{$EXTERNALSYM OpenDesktopA}
function OpenDesktopA; external user32 name 'OpenDesktopA';
{$EXTERNALSYM OpenDesktopW}
function OpenDesktopW; external user32 name 'OpenDesktopW';
{$EXTERNALSYM OpenDesktop}
function OpenDesktop; external user32 name 'OpenDesktopA';
{$EXTERNALSYM OpenIcon}
function OpenIcon; external user32 name 'OpenIcon';
{$EXTERNALSYM OpenInputDesktop}
function OpenInputDesktop; external user32 name 'OpenInputDesktop';
{$EXTERNALSYM OpenWindowStationA}
function OpenWindowStationA; external user32 name 'OpenWindowStationA';
{$EXTERNALSYM OpenWindowStationW}
function OpenWindowStationW; external user32 name 'OpenWindowStationW';
{$EXTERNALSYM OpenWindowStation}
function OpenWindowStation; external user32 name 'OpenWindowStationA';
{$EXTERNALSYM PackDDElParam}
function PackDDElParam; external user32 name 'PackDDElParam';
{$EXTERNALSYM PaintDesktop}
function PaintDesktop; external user32 name 'PaintDesktop';
{$EXTERNALSYM PeekMessageA}
function PeekMessageA; external user32 name 'PeekMessageA';
{$EXTERNALSYM PeekMessageW}
function PeekMessageW; external user32 name 'PeekMessageW';
{$EXTERNALSYM PeekMessage}
function PeekMessage; external user32 name 'PeekMessageA';
{$EXTERNALSYM PostMessageA}
function PostMessageA; external user32 name 'PostMessageA';
{$EXTERNALSYM PostMessageW}
function PostMessageW; external user32 name 'PostMessageW';
{$EXTERNALSYM PostMessage}
function PostMessage; external user32 name 'PostMessageA';
{$EXTERNALSYM PostQuitMessage}
procedure PostQuitMessage; external user32 name 'PostQuitMessage';
{$EXTERNALSYM PostThreadMessageA}
function PostThreadMessageA; external user32 name 'PostThreadMessageA';
{$EXTERNALSYM PostThreadMessageW}
function PostThreadMessageW; external user32 name 'PostThreadMessageW';
{$EXTERNALSYM PostThreadMessage}
function PostThreadMessage; external user32 name 'PostThreadMessageA';
{$EXTERNALSYM PtInRect}
function PtInRect; external user32 name 'PtInRect';
{$EXTERNALSYM RealChildWindowFromPoint}
function RealChildWindowFromPoint; external user32 name 'RealChildWindowFromPoint';
{$EXTERNALSYM RealGetWindowClassA}
function RealGetWindowClassA; external user32 name 'RealGetWindowClassA';
{$EXTERNALSYM RealGetWindowClassW}
function RealGetWindowClassW; external user32 name 'RealGetWindowClassW';
{$EXTERNALSYM RealGetWindowClass}
function RealGetWindowClass; external user32 name 'RealGetWindowClassA';
{$EXTERNALSYM RedrawWindow}
function RedrawWindow; external user32 name 'RedrawWindow';
{$EXTERNALSYM RegisterClassA}
function RegisterClassA; external user32 name 'RegisterClassA';
{$EXTERNALSYM RegisterClassW}
function RegisterClassW; external user32 name 'RegisterClassW';
{$EXTERNALSYM RegisterClass}
function RegisterClass; external user32 name 'RegisterClassA';
{$EXTERNALSYM RegisterClassExA}
function RegisterClassExA; external user32 name 'RegisterClassExA';
{$EXTERNALSYM RegisterClassExW}
function RegisterClassExW; external user32 name 'RegisterClassExW';
{$EXTERNALSYM RegisterClassEx}
function RegisterClassEx; external user32 name 'RegisterClassExA';
{$EXTERNALSYM RegisterClipboardFormatA}
function RegisterClipboardFormatA; external user32 name 'RegisterClipboardFormatA';
{$EXTERNALSYM RegisterClipboardFormatW}
function RegisterClipboardFormatW; external user32 name 'RegisterClipboardFormatW';
{$EXTERNALSYM RegisterClipboardFormat}
function RegisterClipboardFormat; external user32 name 'RegisterClipboardFormatA';
{$EXTERNALSYM RegisterDeviceNotificationA}
function RegisterDeviceNotificationA; external user32 name 'RegisterDeviceNotificationA';
{$EXTERNALSYM RegisterDeviceNotificationW}
function RegisterDeviceNotificationW; external user32 name 'RegisterDeviceNotificationW';
{$EXTERNALSYM RegisterDeviceNotification}
function RegisterDeviceNotification; external user32 name 'RegisterDeviceNotificationA';
{$EXTERNALSYM RegisterHotKey}
function RegisterHotKey; external user32 name 'RegisterHotKey';
{$EXTERNALSYM RegisterWindowMessageA}
function RegisterWindowMessageA; external user32 name 'RegisterWindowMessageA';
{$EXTERNALSYM RegisterWindowMessageW}
function RegisterWindowMessageW; external user32 name 'RegisterWindowMessageW';
{$EXTERNALSYM RegisterWindowMessage}
function RegisterWindowMessage; external user32 name 'RegisterWindowMessageA';
{$EXTERNALSYM ReleaseCapture}
function ReleaseCapture; external user32 name 'ReleaseCapture';
{$EXTERNALSYM ReleaseDC}
function ReleaseDC; external user32 name 'ReleaseDC';
{$EXTERNALSYM RemoveMenu}
function RemoveMenu; external user32 name 'RemoveMenu';
{$EXTERNALSYM RemovePropA}
function RemovePropA; external user32 name 'RemovePropA';
{$EXTERNALSYM RemovePropW}
function RemovePropW; external user32 name 'RemovePropW';
{$EXTERNALSYM RemoveProp}
function RemoveProp; external user32 name 'RemovePropA';
{$EXTERNALSYM ReplyMessage}
function ReplyMessage; external user32 name 'ReplyMessage';
{$EXTERNALSYM ReuseDDElParam}
function ReuseDDElParam; external user32 name 'ReuseDDElParam';
{$EXTERNALSYM ScreenToClient}
function ScreenToClient; external user32 name 'ScreenToClient';
{$EXTERNALSYM ScrollDC}
function ScrollDC; external user32 name 'ScrollDC';
{$EXTERNALSYM ScrollWindow}
function ScrollWindow; external user32 name 'ScrollWindow';
{$EXTERNALSYM ScrollWindowEx}
function ScrollWindowEx; external user32 name 'ScrollWindowEx';
{$EXTERNALSYM SendDlgItemMessageA}
function SendDlgItemMessageA; external user32 name 'SendDlgItemMessageA';
{$EXTERNALSYM SendDlgItemMessageW}
function SendDlgItemMessageW; external user32 name 'SendDlgItemMessageW';
{$EXTERNALSYM SendDlgItemMessage}
function SendDlgItemMessage; external user32 name 'SendDlgItemMessageA';
{$EXTERNALSYM SendInput}
function SendInput; external user32 name 'SendInput';
{$EXTERNALSYM SendMessageA}
function SendMessageA; external user32 name 'SendMessageA';
{$EXTERNALSYM SendMessageW}
function SendMessageW; external user32 name 'SendMessageW';
{$EXTERNALSYM SendMessage}
function SendMessage; external user32 name 'SendMessageA';
{$EXTERNALSYM SendMessageCallbackA}
function SendMessageCallbackA; external user32 name 'SendMessageCallbackA';
{$EXTERNALSYM SendMessageCallbackW}
function SendMessageCallbackW; external user32 name 'SendMessageCallbackW';
{$EXTERNALSYM SendMessageCallback}
function SendMessageCallback; external user32 name 'SendMessageCallbackA';
{$EXTERNALSYM SendMessageTimeoutA}
function SendMessageTimeoutA; external user32 name 'SendMessageTimeoutA';
{$EXTERNALSYM SendMessageTimeoutW}
function SendMessageTimeoutW; external user32 name 'SendMessageTimeoutW';
{$EXTERNALSYM SendMessageTimeout}
function SendMessageTimeout; external user32 name 'SendMessageTimeoutA';
{$EXTERNALSYM SendNotifyMessageA}
function SendNotifyMessageA; external user32 name 'SendNotifyMessageA';
{$EXTERNALSYM SendNotifyMessageW}
function SendNotifyMessageW; external user32 name 'SendNotifyMessageW';
{$EXTERNALSYM SendNotifyMessage}
function SendNotifyMessage; external user32 name 'SendNotifyMessageA';
{$EXTERNALSYM SetActiveWindow}
function SetActiveWindow; external user32 name 'SetActiveWindow';
{$EXTERNALSYM SetCapture}
function SetCapture; external user32 name 'SetCapture';
{$EXTERNALSYM SetCaretBlinkTime}
function SetCaretBlinkTime; external user32 name 'SetCaretBlinkTime';
{$EXTERNALSYM SetCaretPos}
function SetCaretPos; external user32 name 'SetCaretPos';
{$EXTERNALSYM SetClassLongA}
function SetClassLongA; external user32 name 'SetClassLongA';
{$EXTERNALSYM SetClassLongW}
function SetClassLongW; external user32 name 'SetClassLongW';
{$EXTERNALSYM SetClassLong}
function SetClassLong; external user32 name 'SetClassLongA';
{$EXTERNALSYM SetClassWord}
function SetClassWord; external user32 name 'SetClassWord';
{$EXTERNALSYM SetClipboardData}
function SetClipboardData; external user32 name 'SetClipboardData';
{$EXTERNALSYM SetClipboardViewer}
function SetClipboardViewer; external user32 name 'SetClipboardViewer';
{$EXTERNALSYM SetCursor}
function SetCursor; external user32 name 'SetCursor';
{$EXTERNALSYM SetCursorPos}
function SetCursorPos; external user32 name 'SetCursorPos';
{$EXTERNALSYM SetDebugErrorLevel}
procedure SetDebugErrorLevel; external user32 name 'SetDebugErrorLevel';
{$EXTERNALSYM SetDlgItemInt}
function SetDlgItemInt; external user32 name 'SetDlgItemInt';
{$EXTERNALSYM SetDlgItemTextA}
function SetDlgItemTextA; external user32 name 'SetDlgItemTextA';
{$EXTERNALSYM SetDlgItemTextW}
function SetDlgItemTextW; external user32 name 'SetDlgItemTextW';
{$EXTERNALSYM SetDlgItemText}
function SetDlgItemText; external user32 name 'SetDlgItemTextA';
{$EXTERNALSYM SetDoubleClickTime}
function SetDoubleClickTime; external user32 name 'SetDoubleClickTime';
{$EXTERNALSYM SetFocus}
function SetFocus; external user32 name 'SetFocus';
{$EXTERNALSYM SetForegroundWindow}
function SetForegroundWindow; external user32 name 'SetForegroundWindow';
{$EXTERNALSYM SetKeyboardState}
function SetKeyboardState; external user32 name 'SetKeyboardState';
{$EXTERNALSYM SetLastErrorEx}
procedure SetLastErrorEx; external user32 name 'SetLastErrorEx';
{$EXTERNALSYM SetMenu}
function SetMenu; external user32 name 'SetMenu';
{$EXTERNALSYM SetMenuContextHelpId}
function SetMenuContextHelpId; external user32 name 'SetMenuContextHelpId';
{$EXTERNALSYM SetMenuDefaultItem}
function SetMenuDefaultItem; external user32 name 'SetMenuDefaultItem';
{$EXTERNALSYM SetMenuInfo}
function SetMenuInfo; external user32 name 'SetMenuInfo';
{$EXTERNALSYM SetMenuItemBitmaps}
function SetMenuItemBitmaps; external user32 name 'SetMenuItemBitmaps';
{$EXTERNALSYM SetMenuItemInfoA}
function SetMenuItemInfoA; external user32 name 'SetMenuItemInfoA';
{$EXTERNALSYM SetMenuItemInfoW}
function SetMenuItemInfoW; external user32 name 'SetMenuItemInfoW';
{$EXTERNALSYM SetMenuItemInfo}
function SetMenuItemInfo; external user32 name 'SetMenuItemInfoA';
{$EXTERNALSYM SetMessageExtraInfo}
function SetMessageExtraInfo; external user32 name 'SetMessageExtraInfo';
{$EXTERNALSYM SetMessageQueue}
function SetMessageQueue; external user32 name 'SetMessageQueue';
{$EXTERNALSYM SetParent}
function SetParent; external user32 name 'SetParent';
{$EXTERNALSYM SetProcessWindowStation}
function SetProcessWindowStation; external user32 name 'SetProcessWindowStation';
{$EXTERNALSYM SetPropA}
function SetPropA; external user32 name 'SetPropA';
{$EXTERNALSYM SetPropW}
function SetPropW; external user32 name 'SetPropW';
{$EXTERNALSYM SetProp}
function SetProp; external user32 name 'SetPropA';
{$EXTERNALSYM SetRect}
function SetRect; external user32 name 'SetRect';
{$EXTERNALSYM SetRectEmpty}
function SetRectEmpty; external user32 name 'SetRectEmpty';
{$EXTERNALSYM SetScrollInfo}
function SetScrollInfo; external user32 name 'SetScrollInfo';
{$EXTERNALSYM SetScrollPos}
function SetScrollPos; external user32 name 'SetScrollPos';
{$EXTERNALSYM SetScrollRange}
function SetScrollRange; external user32 name 'SetScrollRange';
{$EXTERNALSYM SetSysColors}
function SetSysColors; external user32 name 'SetSysColors';
{$EXTERNALSYM SetSystemCursor}
function SetSystemCursor; external user32 name 'SetSystemCursor';
{$EXTERNALSYM SetThreadDesktop}
function SetThreadDesktop; external user32 name 'SetThreadDesktop';
{$EXTERNALSYM SetTimer}
function SetTimer; external user32 name 'SetTimer';
{$EXTERNALSYM SetUserObjectInformationA}
function SetUserObjectInformationA; external user32 name 'SetUserObjectInformationA';
{$EXTERNALSYM SetUserObjectInformationW}
function SetUserObjectInformationW; external user32 name 'SetUserObjectInformationW';
{$EXTERNALSYM SetUserObjectInformation}
function SetUserObjectInformation; external user32 name 'SetUserObjectInformationA';
{$EXTERNALSYM SetUserObjectSecurity}
function SetUserObjectSecurity; external user32 name 'SetUserObjectSecurity';
{$EXTERNALSYM SetWindowContextHelpId}
function SetWindowContextHelpId; external user32 name 'SetWindowContextHelpId';
{$EXTERNALSYM SetWindowLongA}
function SetWindowLongA; external user32 name 'SetWindowLongA';
{$EXTERNALSYM SetWindowLongW}
function SetWindowLongW; external user32 name 'SetWindowLongW';
{$EXTERNALSYM SetWindowLong}
function SetWindowLong; external user32 name 'SetWindowLongA';
{$EXTERNALSYM SetWindowPlacement}
function SetWindowPlacement; external user32 name 'SetWindowPlacement';
{$EXTERNALSYM SetWindowPos}
function SetWindowPos; external user32 name 'SetWindowPos';
{$EXTERNALSYM SetWindowTextA}
function SetWindowTextA; external user32 name 'SetWindowTextA';
{$EXTERNALSYM SetWindowTextW}
function SetWindowTextW; external user32 name 'SetWindowTextW';
{$EXTERNALSYM SetWindowText}
function SetWindowText; external user32 name 'SetWindowTextA';
{$EXTERNALSYM SetWindowWord}
function SetWindowWord; external user32 name 'SetWindowWord';
{$EXTERNALSYM SetWindowsHookA}
function SetWindowsHookA; external user32 name 'SetWindowsHookA';
{$EXTERNALSYM SetWindowsHookW}
function SetWindowsHookW; external user32 name 'SetWindowsHookW';
{$EXTERNALSYM SetWindowsHook}
function SetWindowsHook; external user32 name 'SetWindowsHookA';
{$EXTERNALSYM SetWindowsHookExA}
function SetWindowsHookExA; external user32 name 'SetWindowsHookExA';
{$EXTERNALSYM SetWindowsHookExW}
function SetWindowsHookExW; external user32 name 'SetWindowsHookExW';
{$EXTERNALSYM SetWindowsHookEx}
function SetWindowsHookEx; external user32 name 'SetWindowsHookExA';
{$EXTERNALSYM SetWindowRgn}
function SetWindowRgn; external user32 name 'SetWindowRgn';
{$EXTERNALSYM SetWinEventHook}
procedure SetWinEventHook; external user32 name 'SetWinEventHook';
{$EXTERNALSYM ShowCaret}
function ShowCaret; external user32 name 'ShowCaret';
{$EXTERNALSYM ShowCursor}
function ShowCursor; external user32 name 'ShowCursor';
{$EXTERNALSYM ShowOwnedPopups}
function ShowOwnedPopups; external user32 name 'ShowOwnedPopups';
{$EXTERNALSYM ShowScrollBar}
function ShowScrollBar; external user32 name 'ShowScrollBar';
{$EXTERNALSYM ShowWindow}
function ShowWindow; external user32 name 'ShowWindow';
{$EXTERNALSYM AnimateWindow}
function AnimateWindow; external user32 name 'AnimateWindow';
{$EXTERNALSYM ShowWindowAsync}
function ShowWindowAsync; external user32 name 'ShowWindowAsync';
{$EXTERNALSYM SubtractRect}
function SubtractRect; external user32 name 'SubtractRect';
{$EXTERNALSYM SwapMouseButton}
function SwapMouseButton; external user32 name 'SwapMouseButton';
{$EXTERNALSYM SwitchDesktop}
function SwitchDesktop; external user32 name 'SwitchDesktop';
{$EXTERNALSYM SystemParametersInfoA}
function SystemParametersInfoA; external user32 name 'SystemParametersInfoA';
{$EXTERNALSYM SystemParametersInfoW}
function SystemParametersInfoW; external user32 name 'SystemParametersInfoW';
{$EXTERNALSYM SystemParametersInfo}
function SystemParametersInfo; external user32 name 'SystemParametersInfoA';
{$EXTERNALSYM TabbedTextOutA}
function TabbedTextOutA; external user32 name 'TabbedTextOutA';
{$EXTERNALSYM TabbedTextOutW}
function TabbedTextOutW; external user32 name 'TabbedTextOutW';
{$EXTERNALSYM TabbedTextOut}
function TabbedTextOut; external user32 name 'TabbedTextOutA';
{$EXTERNALSYM TileWindows}
function TileWindows; external user32 name 'TileWindows';
{$EXTERNALSYM ToAscii}
function ToAscii; external user32 name 'ToAscii';
{$EXTERNALSYM ToAsciiEx}
function ToAsciiEx; external user32 name 'ToAsciiEx';
function ToUnicode; external user32 name 'ToUnicode';
function ToUnicodeEx; external user32 name 'ToUnicodeEx';
function TrackMouseEvent; external user32 name 'TrackMouseEvent';
{$EXTERNALSYM TrackPopupMenu}
function TrackPopupMenu; external user32 name 'TrackPopupMenu';
{$EXTERNALSYM TrackPopupMenuEx}
function TrackPopupMenuEx; external user32 name 'TrackPopupMenuEx';
{$EXTERNALSYM TranslateAcceleratorA}
function TranslateAcceleratorA; external user32 name 'TranslateAcceleratorA';
{$EXTERNALSYM TranslateAcceleratorW}
function TranslateAcceleratorW; external user32 name 'TranslateAcceleratorW';
{$EXTERNALSYM TranslateAccelerator}
function TranslateAccelerator; external user32 name 'TranslateAcceleratorA';
{$EXTERNALSYM TranslateMDISysAccel}
function TranslateMDISysAccel; external user32 name 'TranslateMDISysAccel';
{$EXTERNALSYM TranslateMessage}
function TranslateMessage; external user32 name 'TranslateMessage';
{$EXTERNALSYM UnhookWindowsHook}
function UnhookWindowsHook; external user32 name 'UnhookWindowsHook';
{$EXTERNALSYM UnhookWindowsHookEx}
function UnhookWindowsHookEx; external user32 name 'UnhookWindowsHookEx';
{$EXTERNALSYM UnhookWinEvent}
procedure UnhookWinEvent; external user32 name 'UnhookWinEvent';
{$EXTERNALSYM UnionRect}
function UnionRect; external user32 name 'UnionRect';
{$EXTERNALSYM UnloadKeyboardLayout}
function UnloadKeyboardLayout; external user32 name 'UnloadKeyboardLayout';
{$EXTERNALSYM UnpackDDElParam}
function UnpackDDElParam; external user32 name 'UnpackDDElParam';
{$EXTERNALSYM UnregisterClassA}
function UnregisterClassA; external user32 name 'UnregisterClassA';
{$EXTERNALSYM UnregisterClassW}
function UnregisterClassW; external user32 name 'UnregisterClassW';
{$EXTERNALSYM UnregisterClass}
function UnregisterClass; external user32 name 'UnregisterClassA';
{$EXTERNALSYM UnregisterDeviceNotification}
function UnregisterDeviceNotification; external user32 name 'UnregisterDeviceNotification';
{$EXTERNALSYM UnregisterHotKey}
function UnregisterHotKey; external user32 name 'UnregisterHotKey';
{$EXTERNALSYM UpdateWindow}
function UpdateWindow; external user32 name 'UpdateWindow';
{$EXTERNALSYM UserHandleGrantAccess}
function UserHandleGrantAccess; external user32 name 'UserHandleGrantAccess';
{$EXTERNALSYM ValidateRect}
function ValidateRect; external user32 name 'ValidateRect';
{$EXTERNALSYM ValidateRgn}
function ValidateRgn; external user32 name 'ValidateRgn';
{$EXTERNALSYM VkKeyScanA}
function VkKeyScanA; external user32 name 'VkKeyScanA';
{$EXTERNALSYM VkKeyScanW}
function VkKeyScanW; external user32 name 'VkKeyScanW';
{$EXTERNALSYM VkKeyScan}
function VkKeyScan; external user32 name 'VkKeyScanA';
{$EXTERNALSYM VkKeyScanExA}
function VkKeyScanExA; external user32 name 'VkKeyScanExA';
{$EXTERNALSYM VkKeyScanExW}
function VkKeyScanExW; external user32 name 'VkKeyScanExW';
{$EXTERNALSYM VkKeyScanEx}
function VkKeyScanEx; external user32 name 'VkKeyScanExA';
{$EXTERNALSYM WaitForInputIdle}
function WaitForInputIdle; external user32 name 'WaitForInputIdle';
{$EXTERNALSYM WaitMessage}
function WaitMessage; external user32 name 'WaitMessage';
{$EXTERNALSYM WinHelpA}
function WinHelpA; external user32 name 'WinHelpA';
{$EXTERNALSYM WinHelpW}
function WinHelpW; external user32 name 'WinHelpW';
{$EXTERNALSYM WinHelp}
function WinHelp; external user32 name 'WinHelpA';
{$EXTERNALSYM WindowFromDC}
function WindowFromDC; external user32 name 'WindowFromDC';
{$EXTERNALSYM WindowFromPoint}
function WindowFromPoint; external user32 name 'WindowFromPoint';
{$EXTERNALSYM keybd_event}
procedure keybd_event; external user32 name 'keybd_event';
{$EXTERNALSYM mouse_event}
procedure mouse_event; external user32 name 'mouse_event';
{$EXTERNALSYM wsprintfA}
function wsprintfA; external user32 name 'wsprintfA';
{$EXTERNALSYM wsprintfW}
function wsprintfW; external user32 name 'wsprintfW';
{$EXTERNALSYM wsprintf}
function wsprintf; external user32 name 'wsprintfA';
{$EXTERNALSYM wvsprintfA}
function wvsprintfA; external user32 name 'wvsprintfA';
{$EXTERNALSYM wvsprintfW}
function wvsprintfW; external user32 name 'wvsprintfW';
{$EXTERNALSYM wvsprintf}
function wvsprintf; external user32 name 'wvsprintfA';

{ Externals from wintrust.dll }

function WinLoadTrustProvider; external wintrust name 'WinLoadTrustProvider';
function WinSubmitCertificate; external wintrust name 'WinSubmitCertificate';
function WinVerifyTrust; external wintrust name 'WinVerifyTrust';


{ Translated from WINDEF.H }

function MakeWord(A, B: Byte): Word;
begin
  Result := A or B shl 8;
end;

function MakeLong(A, B: Word): Longint;
begin
  Result := A or B shl 16;
end;

function HiWord(L: DWORD): Word;
begin
  Result := L shr 16;
end;

function HiByte(W: Word): Byte;
begin
  Result := W shr 8;
end;

{ Translated from WINBASE.H }

{$EXTERNALSYM DefineHandleTable}
function DefineHandleTable(Offset: Word): Bool;
begin
  Result := True;
end;

{$EXTERNALSYM LimitEmsPages}
procedure LimitEmsPages(Kbytes: Longint);
begin
end;

{$EXTERNALSYM SetSwapAreaSize}
function SetSwapAreaSize(Size: Word): Longint;
begin
  Result := Size;
end;

{$EXTERNALSYM LockSegment}
procedure LockSegment(Segment: THandle);
begin
  GlobalFix(Segment);
end;

{$EXTERNALSYM UnlockSegment}
procedure UnlockSegment(Segment: THandle);
begin
  GlobalUnfix(Segment);
end;

{$EXTERNALSYM GetCurrentTime}
function GetCurrentTime: Longint;
begin
  Result := GetTickCount;
end;

{$EXTERNALSYM Yield}
function Yield: Bool;
begin
  Result := True;
end;

{$EXTERNALSYM MoveMemory}
procedure MoveMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
begin
  Move(Source^, Destination^, Length);
end;

{$EXTERNALSYM CopyMemory}
procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: DWORD);
begin
  Move(Source^, Destination^, Length);
end;

{$EXTERNALSYM FillMemory}
procedure FillMemory(Destination: Pointer; Length: DWORD; Fill: Byte);
begin
  FillChar(Destination^, Length, Fill);
end;

{$EXTERNALSYM ZeroMemory}
procedure ZeroMemory(Destination: Pointer; Length: DWORD);
begin
  FillChar(Destination^, Length, 0);
end;

{$EXTERNALSYM FreeModule}
function FreeModule(var hLibModule: HINST): BOOL;
begin
  Result := FreeLibrary(hLibModule);
end;

{$EXTERNALSYM FreeProcInstance}
procedure FreeProcInstance(Proc: FARPROC);
begin
end;

{$EXTERNALSYM MakeProcInstance}
function MakeProcInstance(Proc: FARPROC; Instance: THandle): FARPROC;
begin
  Result := Proc;
end;

{$EXTERNALSYM GlobalLRUNewest}
function GlobalLRUNewest(h: THandle): THandle;
begin
  Result := h;
end;

{$EXTERNALSYM GlobalLRUOldest}
function GlobalLRUOldest(h: THandle): THandle;
begin
  Result := h;
end;

{$EXTERNALSYM GlobalDiscard}
function GlobalDiscard(h: THandle): THandle;
begin
 Result := GlobalReAlloc(h, 0, GMEM_MOVEABLE);
end;

{$EXTERNALSYM LocalDiscard}
function LocalDiscard(h: THandle): THandle;
begin
 Result := LocalReAlloc(h, 0, LMEM_MOVEABLE);
end;

{$EXTERNALSYM GetFreeSpace}
function GetFreeSpace(w: Word): DWORD;
begin
  Result := $100000;
end;

{$EXTERNALSYM UnlockResource}
function UnlockResource(hResData: THandle): BOOL;
begin
  Result := False;
end;

{$EXTERNALSYM GlobalAllocPtr}
function GlobalAllocPtr(Flags: Integer; Bytes: Longint): Pointer; assembler;
asm
        PUSH    EDX
        PUSH    EAX
        CALL    GlobalAlloc
        PUSH    EAX
        CALL    GlobalLock
end;

{$EXTERNALSYM GlobalReAllocPtr}
function GlobalReAllocPtr(P: Pointer; Bytes: Longint;
  Flags: Integer): Pointer; assembler;
asm
        PUSH    ECX
        PUSH    EDX
        PUSH    EAX
        CALL    GlobalHandle
        PUSH    EAX
        PUSH    EAX
        CALL    GlobalUnlock
        CALL    GlobalReAlloc
        PUSH    EAX
        CALL    GlobalLock
end;

{$EXTERNALSYM GlobalFreePtr}
function GlobalFreePtr(P: Pointer): THandle; assembler;
asm
        PUSH    EAX
        CALL    GlobalHandle
        PUSH    EAX
        PUSH    EAX
        CALL    GlobalUnlock
        CALL    GlobalFree
end;


{ Translated from WINERROR.H }

function Succeeded(Status: HRESULT): BOOL;
begin
  Result := Status and $80000000 = 0;
end;

function Failed(Status: HRESULT): BOOL;
begin
  Result := Status and $80000000 <> 0;
end;

function IsError(Status: HRESULT): BOOL;
begin
  Result := (Status shr 31) = SEVERITY_ERROR;
end;

function HResultCode(hr: HRESULT): Integer;
begin
  Result := hr and $0000FFFF;
end;

function HResultFacility(hr: HRESULT): Integer;
begin
  Result := (hr shr 16) and $00001FFF;
end;

function HResultSeverity(hr: HRESULT): Integer;
begin
  Result := (hr shr 31) and $00000001;
end;

{$EXTERNALSYM MakeResult}
function MakeResult(sev, fac, code: Integer): HResult;
begin
  Result := (sev shl 31) or (fac shl 16) or code;
end;

function HResultFromWin32(x: Integer): HRESULT;
begin
  Result := x;
  if Result <> 0 then
    Result := ((Result and $0000FFFF) or (FACILITY_WIN32 shl 16) or $80000000);
end;

function HResultFromNT(x: Integer): HRESULT;
begin
  Result := x or FACILITY_NT_BIT;
end;


{ Translated from WINGDI.H }

function MakeROP4(fore, back: DWORD): DWORD;
begin
  Result := ((back shl 8) and $FF000000) or fore;
end;

{$EXTERNALSYM GetKValue}
function GetKValue(cmyk: COLORREF): Byte;
begin
  Result := Byte(cmyk);
end;

{$EXTERNALSYM GetYValue}
function GetYValue(cmyk: COLORREF): Byte;
begin
  Result := Byte(cmyk shr 8);
end;

{$EXTERNALSYM GetMValue}
function GetMValue(cmyk: COLORREF): Byte;
begin
  Result := Byte(cmyk shr 16);
end;

{$EXTERNALSYM GetCValue}
function GetCValue(cmyk: COLORREF): Byte;
begin
  Result := Byte(cmyk shr 24);
end;

{$EXTERNALSYM CMYK}
function CMYK(c, m, y, k: Byte): COLORREF;
begin
  Result := (k or (y shl 8) or (m shl 16) or (c shl 24));
end;

{$EXTERNALSYM RGB}
function RGB(r, g, b: Byte): COLORREF;
begin
  Result := (r or (g shl 8) or (b shl 16));
end;

function PaletteRGB(r, g, b: Byte): COLORREF;
begin
  Result := $02000000 or RGB(r,g,b);
end;

function PaletteIndex(i: Word): COLORREF;
begin
  Result := $01000000 or i;
end;

{$EXTERNALSYM GetRValue}
function GetRValue(rgb: DWORD): Byte;
begin
  Result := Byte(rgb);
end;

{$EXTERNALSYM GetGValue}
function GetGValue(rgb: DWORD): Byte;
begin
  Result := Byte(rgb shr 8);
end;

{$EXTERNALSYM GetBValue}
function GetBValue(rgb: DWORD): Byte;
begin
  Result := Byte(rgb shr 16);
end;


{ Translated from WINUSER.H }

function SmallPointToPoint(const P: TSmallPoint): TPoint;
begin
  Result.X := P.X;
  Result.Y := P.Y;
end;

function PointToSmallPoint(const P: TPoint): TSmallPoint;
begin
  Result.X := P.X;
  Result.Y := P.Y;
end;

function MakeWParam(l, h: Word): WPARAM;
begin
  Result := MakeLong(l, h);
end;

function MakeLParam(l, h: Word): LPARAM;
begin
  Result := MakeLong(l, h);
end;

function MakeLResult(l, h: Word): LRESULT;
begin
  Result := MakeLong(l, h);
end;

{$EXTERNALSYM ExitWindows}
function ExitWindows(dwReserved: DWORD; Code: Word): BOOL;
begin
  Result := ExitWindowsEx(EWX_LOGOFF, 0);
end;

{$EXTERNALSYM PostAppMessageA}
function PostAppMessageA(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL;
begin
  Result := PostThreadMessageA(idThread, Msg, wParam, lParam)
end;
{$EXTERNALSYM PostAppMessageW}
function PostAppMessageW(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL;
begin
  Result := PostThreadMessageW(idThread, Msg, wParam, lParam)
end;
{$EXTERNALSYM PostAppMessage}
function PostAppMessage(idThread: DWORD; Msg: UINT; wParam: WPARAM; lParam: LPARAM): BOOL;
begin
  Result := PostThreadMessage(idThread, Msg, wParam, lParam)
end;

{$EXTERNALSYM CreateWindowA}
function CreateWindowA(lpClassName: PAnsiChar; lpWindowName: PAnsiChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND;
  hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND;
begin
  Result := CreateWindowExA(0, lpClassName, lpWindowName, dwStyle, X, Y,
    nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
end;
{$EXTERNALSYM CreateWindowW}
function CreateWindowW(lpClassName: PWideChar; lpWindowName: PWideChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND;
  hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND;
begin
  Result := CreateWindowExW(0, lpClassName, lpWindowName, dwStyle, X, Y,
    nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
end;
{$EXTERNALSYM CreateWindow}
function CreateWindow(lpClassName: PChar; lpWindowName: PChar;
  dwStyle: DWORD; X, Y, nWidth, nHeight: Integer; hWndParent: HWND;
  hMenu: HMENU; hInstance: HINST; lpParam: Pointer): HWND;
begin
  Result := CreateWindowEx(0, lpClassName, lpWindowName, dwStyle, X, Y,
    nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
end;

{$EXTERNALSYM CreateDialogA}
function CreateDialogA(hInstance: HINST; lpTemplateName: PAnsiChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
begin
  Result := CreateDialogParamA(hInstance, lpTemplateName, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM CreateDialogW}
function CreateDialogW(hInstance: HINST; lpTemplateName: PWideChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
begin
  Result := CreateDialogParamW(hInstance, lpTemplateName, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM CreateDialog}
function CreateDialog(hInstance: HINST; lpTemplateName: PChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
begin
  Result := CreateDialogParam(hInstance, lpTemplateName, hWndParent,
    lpDialogFunc, 0);
end;

{$EXTERNALSYM CreateDialogIndirectA}
function CreateDialogIndirectA(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
begin
  Result := CreateDialogIndirectParamA(hInstance, lpTemplate, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM CreateDialogIndirectW}
function CreateDialogIndirectW(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
begin
  Result := CreateDialogIndirectParamW(hInstance, lpTemplate, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM CreateDialogIndirect}
function CreateDialogIndirect(hInstance: HINST; const lpTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): HWND;
begin
  Result := CreateDialogIndirectParam(hInstance, lpTemplate, hWndParent,
    lpDialogFunc, 0);
end;

{$EXTERNALSYM DialogBoxA}
function DialogBoxA(hInstance: HINST; lpTemplate: PAnsiChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
begin
  Result := DialogBoxParamA(hInstance, lpTemplate, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM DialogBoxW}
function DialogBoxW(hInstance: HINST; lpTemplate: PWideChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
begin
  Result := DialogBoxParamW(hInstance, lpTemplate, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM DialogBox}
function DialogBox(hInstance: HINST; lpTemplate: PChar;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
begin
  Result := DialogBoxParam(hInstance, lpTemplate, hWndParent,
    lpDialogFunc, 0);
end;

{$EXTERNALSYM DialogBoxIndirectA}
function DialogBoxIndirectA(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
begin
  Result := DialogBoxIndirectParamA(hInstance, lpDialogTemplate, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM DialogBoxIndirectW}
function DialogBoxIndirectW(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
begin
  Result := DialogBoxIndirectParamW(hInstance, lpDialogTemplate, hWndParent,
    lpDialogFunc, 0);
end;
{$EXTERNALSYM DialogBoxIndirect}
function DialogBoxIndirect(hInstance: HINST; const lpDialogTemplate: TDlgTemplate;
  hWndParent: HWND; lpDialogFunc: TFNDlgProc): Integer;
begin
  Result := DialogBoxIndirectParam(hInstance, lpDialogTemplate, hWndParent,
    lpDialogFunc, 0);
end;

{$EXTERNALSYM EnumTaskWindows}
function EnumTaskWindows(hTask: THandle; lpfn: FARPROC; lParam: LPARAM): BOOL;
begin
  Result := EnumThreadWindows(DWORD(hTask), lpfn, lParam);
end;

{$EXTERNALSYM GetWindowTask}
function GetWindowTask(hWnd: HWND): THandle;
begin
  Result := THandle(GetWindowThreadProcessId(hWnd, nil));
end;

{$EXTERNALSYM DefHookProc}
function DefHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM; phhk: FARPROC): LRESULT;
begin
  Result := CallNextHookEx(HHOOK(phhk), nCode, wParam, lParam);
end;

{$EXTERNALSYM HwndMSWheel}
function HwndMSWheel(var puiMsh_MsgMouseWheel, puiMsh_Msg3DSupport,
  puiMsh_MsgScrollLines: UINT; var pf3DSupport: BOOL;
  var piScrollLines: Integer): HWND;
begin
  Result := FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE);
  puiMsh_MsgMouseWheel := RegisterWindowMessage(MSH_MOUSEWHEEL);
  puiMsh_Msg3DSupport := RegisterWindowMessage(MSH_WHEELSUPPORT);
  puiMsh_MsgScrollLines := RegisterWindowMessage(MSH_SCROLL_LINES);
  if (puiMsh_Msg3DSupport <> 0) and (Result <> 0) then
    pf3DSupport := BOOL(SendMessage(Result, puiMsh_Msg3DSupport, 0, 0))
  else
    pf3DSupport := False;  // default to FALSE
  if (puiMsh_MsgScrollLines <> 0)  and (Result <> 0) then
    piScrollLines := SendMessage(Result, puiMsh_MsgScrollLines, 0, 0)
  else
    piScrollLines := 3;  // default
end;

end.


