⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jwawintype.txt

📁 netapi中 jawwinsock2.pas文件源码
💻 TXT
📖 第 1 页 / 共 4 页
字号:

 {******************************************************************************}
{                                                       	               }
{ Windows Base Types API interface Unit for Object Pascal                      }
{                                                       	               }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
{ Corporation. All Rights Reserved.                                            }
{ 								               }
{ The original file is: basetsd.h, released August 2001. The original Pascal   }
{ code is: WinType.pas, released December 2000. The initial developer of the   }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
{                                                                              }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
{ Marcel van Brakel. All Rights Reserved.                                      }
{ 								               }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{								               }
{ You may retrieve the latest version of this file at the Project JEDI home    }
{ page, located at http://delphi-jedi.org or my personal homepage located at   }
{ http://members.chello.nl/m.vanbrakel2                                        }
{								               }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{ 								               }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ 								               }
{******************************************************************************}

unit JwaWinType;

{$WEAKPACKAGEUNIT}

{$HPPEMIT ''}
{$HPPEMIT '#include "BaseTsd.h"'}
{$HPPEMIT '#include "BaseTyps.h"'}
{$HPPEMIT '#include "NtDef.h"'}
{$HPPEMIT '#include "WinDef.h"'}
{$HPPEMIT ''}
{$HPPEMIT 'typedef LPVOID *LPLPVOID'}
{$HPPEMIT 'typedef GUID TGUID'}
{$HPPEMIT 'typedef GUID *LPGUID'}
{$HPPEMIT 'typedef GUID CLSID'}
{$HPPEMIT 'typedef HMODULE *PHMODULE'}
{$HPPEMIT ''}

{$I WINDEFINES.INC}

interface

uses
  Windows, SysUtils; // TODO

type
  EJwaError = class (Exception)
  end;

  EJwaLoadLibraryError = class (EJwaError)
  end;

  EJwaGetProcAddressError = class (EJwaError)
  end;

procedure GetProcedureAddress(var P: Pointer; const ModuleName, ProcName: string);

type
  LPLPSTR = ^LPSTR;
  {$NODEFINE LPLPSTR}
  LPLPCSTR = ^LPCSTR;
  {$NODEFINE LPLPCSTR}
  LPLPCWSTR = ^LPCWSTR;
  {$NODEFINE LPLPCWSTR}
  LPLPWSTR = ^LPWSTR;
  {$NODEFINE LPLPWSTR}

  PPChar = ^PChar;
  PPWideChar = ^PWideChar;
  PPointer = ^Pointer;

  GUID = TGUID;
  {$NODEFINE GUID}
  LPGUID = ^GUID;
  {$NODEFINE LPGUID}
  CLSID = TGUID;
  {$NODEFINE CLSID}

// ntdef.h

type

//typedef double DOUBLE;

  PQuad = ^TQuad;
  _QUAD = record                // QUAD is for those times we want
    DoNotUseThisField: Double;  // an 8 byte aligned 8 byte long structure
  end;                          // which is NOT really a floating point
  {$EXTERNALSYM _QUAD}          // number.  Use DOUBLE if you want an FP number.
  QUAD = _QUAD;
  {$EXTERNALSYM QUAD}
  TQuad = _QUAD;

//
// Unsigned Basics
//

  UCHAR = {$IFDEF USE_DELPHI_TYPES}Windows.UCHAR{$ELSE}Char{$ENDIF};
  {$EXTERNALSYM UCHAR}
  USHORT = Word;
  {$EXTERNALSYM USHORT}
  ULONG = {$IFDEF USE_DELPHI_TYPES}Windows.ULONG{$ELSE}Longword{$ENDIF};
  {$EXTERNALSYM ULONG}
  UQUAD = QUAD;
  {$EXTERNALSYM UQUAD}

//
// __int64 is only supported by 2.0 and later midl.
// __midl is set by the 2.0 midl and not by 1.0 midl.
//

type
  LONGLONG = {$IFDEF USE_DELPHI_TYPES}Windows.LONGLONG{$ELSE}Int64{$ENDIF};
  {$EXTERNALSYM LONGLONG}
  ULONGLONG = Int64;
  {$EXTERNALSYM ULONGLONG}

const
  MAXLONGLONG = $7fffffffffffffff;
  {$EXTERNALSYM MAXLONGLONG}

type
  PLONGLONG = ^LONGLONG;
  {$EXTERNALSYM PLONGLONG}
  PULONGLONG = ^ULONGLONG;
  {$EXTERNALSYM PULONGLONG}

  BOOL = {$IFDEF USE_DELPHI_TYPES}Windows.BOOL{$ELSE}LongBool{$ENDIF};
  {$EXTERNALSYM BOOL}

  DWORD = {$IFDEF USE_DELPHI_TYPES}Windows.DWORD{$ELSE}Longword{$ENDIF};
  {$EXTERNALSYM DWORD}

const
  ANYSIZE_ARRAY = 1;
  {$EXTERNALSYM ANYSIZE_ARRAY}

  MAX_NATURAL_ALIGNMENT = SizeOf(ULONG);
  {$EXTERNALSYM MAX_NATURAL_ALIGNMENT}

//
// Void
//

type
  PVOID = Pointer;
  {$EXTERNALSYM PVOID}
  PPVOID = ^PVOID;
  {$EXTERNALSYM PPVOID}
  PVOID64 = Pointer;
  {$EXTERNALSYM PVOID64}

//
// Basics
//

  SHORT = {$IFDEF USE_DELPHI_TYPES}Windows.SHORT{$ELSE}Smallint{$ENDIF};
  {$EXTERNALSYM SHORT}
  LONG = Longint;
  {$EXTERNALSYM LONG}

//
// UNICODE (Wide Character) types
//

  WCHAR = {$IFDEF USE_DELPHI_TYPES}Windows.WCHAR{$ELSE}WideChar{$ENDIF};
  {$EXTERNALSYM WCHAR}

  PWCHAR = {$IFDEF USE_DELPHI_TYPES}Windows.PWChar{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM PWCHAR}
  LPWCH = ^WCHAR;
  {$EXTERNALSYM LPWCH}
  PWCH = ^WCHAR;
  {$EXTERNALSYM PWCH}
  LPCWCH = ^WCHAR;
  {$EXTERNALSYM LPCWCH}
  PCWCH = ^WCHAR;
  {$EXTERNALSYM PCWCH}
  NWPSTR = ^WCHAR;
  {$EXTERNALSYM NWPSTR}
  LPWSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPWSTR{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM LPWSTR}
  LPCWSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCWSTR{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM LPCWSTR}
  PWSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPWSTR{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM PWSTR}
  LPUWSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPWSTR{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM LPUWSTR}
  PUWSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPWSTR{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM PUWSTR}
  LCPUWSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPWSTR{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM LCPUWSTR}
  PCUWSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPWSTR{$ELSE}^WCHAR{$ENDIF};
  {$EXTERNALSYM PCUWSTR}

//
// ANSI (Multi-byte Character) types
//

  LPCH = ^CHAR;
  {$EXTERNALSYM LPCH}
  PCH = ^CHAR;
  {$EXTERNALSYM PCH}

  LPCCH = ^CHAR;
  {$EXTERNALSYM LPCCH}
  PCCH = ^CHAR;
  {$EXTERNALSYM PCCH}
  NPSTR = ^CHAR;
  {$EXTERNALSYM NPSTR}
  LPSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPSTR{$ELSE}^CHAR{$ENDIF};
  {$EXTERNALSYM LPSTR}
  PSTR = {$IFDEF USE_DELPHI_TYPES}PChar{$ELSE}^CHAR{$ENDIF};
  {$EXTERNALSYM PSTR}
  LPCSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCSTR{$ELSE}^CHAR{$ENDIF};
  {$EXTERNALSYM LPCSTR}
  PCSTR = {$IFDEF USE_DELPHI_TYPES}PChar{$ELSE}^CHAR{$ENDIF};
  {$EXTERNALSYM PCSTR}

//
// Neutral ANSI/UNICODE types and macros
//

{$IFDEF UNICODE}

  TCHAR = WCHAR;
  {$EXTERNALSYM TCHAR}
  PTCHAR = ^TCHAR;
  {$EXTERNALSYM PTCHAR}
  TUCHAR = WCHAR;
  {$EXTERNALSYM TUCHAR}
  PTUCHAR = ^TUCHAR;
  {$EXTERNALSYM PTUCHAR}

  LPTCH = LPWSTR;
  {$EXTERNALSYM LPTCH}
  PTCH = LPWSTR;
  {$EXTERNALSYM PTCH}
  PTSTR = LPWSTR;
  {$EXTERNALSYM PTSTR}
  LPTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPTSTR{$ELSE}LPWSTR{$ENDIF};
  {$EXTERNALSYM LPTSTR}
  PCTSTR = LPCWSTR;
  {$EXTERNALSYM PCTSTR}
  LPCTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCTSTR{$ELSE}LPCWSTR{$ENDIF};
  {$EXTERNALSYM LPCTSTR}

  PCUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCTSTR{$ELSE}LPCWSTR{$ENDIF};
  {$EXTERNALSYM PCUTSTR}
  LPCUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCTSTR{$ELSE}LPCWSTR{$ENDIF};
  {$EXTERNALSYM LPCUTSTR}
  PUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCSTR{$ELSE}LPCWSTR{$ENDIF};
  {$EXTERNALSYM PUTSTR}
  LPUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCSTR{$ELSE}LPCWSTR{$ENDIF};
  {$EXTERNALSYM LPUTSTR}

  __TEXT = WideString;
  {$EXTERNALSYM __TEXT}

{$ELSE}

  TCHAR = CHAR;
  {$EXTERNALSYM TCHAR}
  PTCHAR = ^TCHAR;
  {$EXTERNALSYM PTCHAR}
  TUCHAR = CHAR;
  {$EXTERNALSYM TUCHAR}
  PTUCHAR = ^TUCHAR;
  {$EXTERNALSYM PTUCHAR}

  LPTCH = LPSTR;
  {$EXTERNALSYM LPTCH}
  PTCH = LPSTR;
  {$EXTERNALSYM PTCH}
  PTSTR = LPSTR;
  {$EXTERNALSYM PTSTR}
  LPTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPTSTR{$ELSE}LPSTR{$ENDIF};
  {$EXTERNALSYM LPTSTR}
  PCTSTR = LPCSTR;
  {$EXTERNALSYM PCTSTR}
  LPCTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCTSTR{$ELSE}LPCSTR{$ENDIF};
  {$EXTERNALSYM LPCTSTR}

  PCUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCSTR{$ELSE}LPCSTR{$ENDIF};
  {$EXTERNALSYM PCUTSTR}
  LPCUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCSTR{$ELSE}LPCSTR{$ENDIF};
  {$EXTERNALSYM LPCUTSTR}
  PUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCSTR{$ELSE}LPCSTR{$ENDIF};
  {$EXTERNALSYM PUTSTR}
  LPUTSTR = {$IFDEF USE_DELPHI_TYPES}Windows.LPCSTR{$ELSE}LPCSTR{$ENDIF};
  {$EXTERNALSYM LPUTSTR}

  __TEXT = AnsiString;
  {$EXTERNALSYM __TEXT}

{$ENDIF}

  TEXT = __TEXT;
  {$EXTERNALSYM TEXT}

//
// Pointer to Basics
//

  PSHORT = ^SHORT;
  {$EXTERNALSYM PSHORT}
  PLONG = ^LONG;
  {$EXTERNALSYM PLONG}

//
// Pointer to Unsigned Basics
//

  PUCHAR = {$IFDEF USE_DELPHI_TYPES}Windows.PUCHAR{$ELSE}^UCHAR{$ENDIF};
  {$EXTERNALSYM PUCHAR}
  PUSHORT = ^USHORT;
  {$EXTERNALSYM PUSHORT}
  PULONG = {$IFDEF USE_DELPHI_TYPES}Windows.PULONG{$ELSE}^ULONG{$ENDIF};
  {$EXTERNALSYM PULONG}
  PUQUAD = ^UQUAD;
  {$EXTERNALSYM PUQUAD}

//
// Signed characters
//

  SCHAR = Shortint;
  {$EXTERNALSYM SCHAR}
  PSCHAR = ^SCHAR;
  {$EXTERNALSYM PSCHAR}

//
// Handle to an Object
//

  HANDLE = {$IFDEF USE_DELPHI_TYPES}Windows.THandle{$ELSE}Longword{$ENDIF};
  {$EXTERNALSYM HANDLE}
  PHANDLE = {$IFDEF USE_DELPHI_TYPES}Windows.PHandle{$ELSE}^HANDLE{$ENDIF};
  {$EXTERNALSYM PHANDLE}
  THandle = {$IFDEF USE_DELPHI_TYPES}Windows.THandle{$ELSE}HANDLE{$ENDIF};

//
// Flag (bit) fields
//

  FCHAR = UCHAR;
  {$EXTERNALSYM FCHAR}
  FSHORT = USHORT;
  {$EXTERNALSYM FSHORT}
  FLONG = ULONG;
  {$EXTERNALSYM FLONG}

// Component Object Model defines, and macros

  HRESULT = System.HRESULT; // LONG;
  {$EXTERNALSYM HRESULT}

//
// Low order two bits of a handle are ignored by the system and available
// for use by application code as tag bits.  The remaining bits are opaque
// and used to store a serial number and table index.
//

const
  OBJ_HANDLE_TAGBITS = $00000003;
  {$EXTERNALSYM OBJ_HANDLE_TAGBITS}

//
// Cardinal Data Types [0 - 2**N-2)
//

type
  CCHAR = Char;
  {$EXTERNALSYM CCHAR}
  CSHORT = Shortint;
  {$EXTERNALSYM CSHORT}
  CLONG = ULONG;
  {$EXTERNALSYM CLONG}

  PCCHAR = ^CCHAR;
  {$EXTERNALSYM PCCHAR}
  PCSHORT = ^CSHORT;
  {$EXTERNALSYM PCSHORT}
  PCLONG = ^CLONG;
  {$EXTERNALSYM PCLONG}

//
// NLS basics (Locale and Language Ids)
//

  LCID = {$IFDEF USE_DELPHI_TYPES}Windows.LCID{$ELSE}ULONG{$ENDIF};
  {$EXTERNALSYM LCID}
  PLCID = {$IFDEF USE_DELPHI_TYPES}^LCID{$ELSE}PULONG{$ENDIF};
  {$EXTERNALSYM PLCID}
  LANGID = {$IFDEF USE_DELPHI_TYPES}Windows.LANGID{$ELSE}USHORT{$ENDIF};
  {$EXTERNALSYM LANGID}
  PLANGID = ^LANGID; // TODO Not in original header (used in MSI)

//
// Logical Data Type - These are 32-bit logical values.
//

  LOGICAL = ULONG;
  {$EXTERNALSYM LOGICAL}
  PLOGICAL = ^ULONG;
  {$EXTERNALSYM PLOGICAL}

//
// NTSTATUS
//

  NTSTATUS = LONG;
  {$EXTERNALSYM NTSTATUS}
  PNTSTATUS = ^NTSTATUS;
  {$EXTERNALSYM PNTSTATUS}
  TNTStatus = NTSTATUS;

//
//  Status 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|       Facility          |               Code            |
//  +---+-+-------------------------+-------------------------------+

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -