📄 iphlpapi.pas
字号:
{******************************************************************************}
{ }
{ Internet Protocol Helper API interface Unit for Object Pascal }
{ }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
{ Corporation. All Rights Reserved. }
{ }
{ The original file is: iphlpapi.h, released July 2000. The original Pascal }
{ code is: IpHlpApi.pas, released September 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. }
{ }
{ Contributor(s): John C. Penman (jcp@craiglockhart.com) }
{ Vladimir Vassiliev (voldemarv@hotpop.com) }
{ }
{ 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 IpHlpApi;
{$WEAKPACKAGEUNIT}
{$HPPEMIT ''}
{$HPPEMIT '#include "iphlpapi.h"'}
{$HPPEMIT ''}
//{$I WINDEFINES.INC}
{.$DEFINE IPHLPAPI_LINKONREQUEST}
{$IFDEF IPHLPAPI_LINKONREQUEST}
{$DEFINE IPHLPAPI_DYNLINK}
{$ENDIF}
{.$DEFINE IPHLPAPI_DYNLINK}
interface
uses
Windows, IpExport, IpRtrMib, IpTypes;
//////////////////////////////////////////////////////////////////////////////
// //
// IPRTRMIB.H has the definitions of the strcutures used to set and get //
// information //
// //
//////////////////////////////////////////////////////////////////////////////
// #include <iprtrmib.h>
// #include <ipexport.h>
// #include <iptypes.h>
//////////////////////////////////////////////////////////////////////////////
// //
// The GetXXXTable APIs take a buffer and a size of buffer. If the buffer //
// is not large enough, they APIs return ERROR_INSUFFICIENT_BUFFER and //
// *pdwSize is the required buffer size //
// The bOrder is a BOOLEAN, which if TRUE sorts the table according to //
// MIB-II (RFC XXXX) //
// //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// //
// Retrieves the number of interfaces in the system. These include LAN and //
// WAN interfaces //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetNumberOfInterfaces(var pdwNumIf: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetNumberOfInterfaces}
{$ELSE}
var
GetNumberOfInterfaces: function (var pdwNumIf: DWORD): DWORD; stdcall;
{$EXTERNALSYM GetNumberOfInterfaces}
{$ENDIF}
//////////////////////////////////////////////////////////////////////////////
// //
// Gets the MIB-II ifEntry //
// The dwIndex field of the MIB_IFROW should be set to the index of the //
// interface being queried //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetIfEntry(pIfRow: PMIB_IFROW): DWORD; stdcall;
{$EXTERNALSYM GetIfEntry}
{$ELSE}
var
GetIfEntry: function (pIfRow: PMIB_IFROW): DWORD; stdcall;
{$EXTERNALSYM GetIfEntry}
{$ENDIF}
//////////////////////////////////////////////////////////////////////////////
// //
// Gets the MIB-II IfTable //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetIfTable(pIfTable: PMIB_IFTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIfTable}
{$ELSE}
var
GetIfTable: function (pIfTable: PMIB_IFTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIfTable}
{$ENDIF}
//////////////////////////////////////////////////////////////////////////////
// //
// Gets the Interface to IP Address mapping //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetIpAddrTable(pIpAddrTable: PMIB_IPADDRTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIpAddrTable}
{$ELSE}
var
GetIpAddrTable: function (pIpAddrTable: PMIB_IPADDRTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIpAddrTable}
{$ENDIF}
//////////////////////////////////////////////////////////////////////////////
// //
// Gets the current IP Address to Physical Address (ARP) mapping //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetIpNetTable(pIpNetTable: PMIB_IPNETTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIpNetTable}
{$ELSE}
var
GetIpNetTable: function (pIpNetTable: PMIB_IPNETTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIpNetTable}
{$ENDIF}
//////////////////////////////////////////////////////////////////////////////
// //
// Gets the IP Routing Table (RFX XXXX) //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetIpForwardTable(pIpForwardTable: PMIB_IPFORWARDTABLE; var pdwSize: ULONG;
bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIpForwardTable}
{$ELSE}
var
GetIpForwardTable: function (pIpForwardTable: PMIB_IPFORWARDTABLE;
var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetIpForwardTable}
{$ENDIF}
//////////////////////////////////////////////////////////////////////////////
// //
// Gets TCP Connection/UDP Listener Table //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetTcpTable(pTcpTable: PMIB_TCPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetTcpTable}
function GetUdpTable(pUdpTable: PMIB_UDPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetUdpTable}
{$ELSE}
var
GetTcpTable: function (pTcpTable: PMIB_TCPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetTcpTable}
GetUdpTable: function (pUdpTable: PMIB_UDPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
{$EXTERNALSYM GetUdpTable}
{$ENDIF}
//////////////////////////////////////////////////////////////////////////////
// //
// Gets IP/ICMP/TCP/UDP Statistics //
// //
//////////////////////////////////////////////////////////////////////////////
{$IFNDEF IPHLPAPI_DYNLINK}
function GetIpStatistics(var pStats: MIB_IPSTATS): DWORD; stdcall;
{$EXTERNALSYM GetIpStatistics}
function GetIcmpStatistics(var pStats: MIB_ICMP): DWORD; stdcall;
{$EXTERNALSYM GetIcmpStatistics}
function GetTcpStatistics(var pStats: MIB_TCPSTATS): DWORD; stdcall;
{$EXTERNALSYM GetTcpStatistics}
function GetUdpStatistics(var pStats: MIB_UDPSTATS): DWORD; stdcall;
{$EXTERNALSYM GetUdpStatistics}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -