JwaIpHlpApi.pas
上传用户:davidchvip
上传日期:2009-07-28
资源大小:1749k
文件大小:38k
源码类别:

Windows编程

开发平台:

Delphi

  1. {******************************************************************************}
  2. {                                                                       }
  3. { Internet Protocol Helper API interface Unit for Object Pascal                }
  4. {                                                                       }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
  6. { Corporation. All Rights Reserved.                                            }
  7. {                 }
  8. { The original file is: iphlpapi.h, released August 2000. The original Pascal  }
  9. { code is: IpHlpApi.pas, released September 2000. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
  11. {                                                                              }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
  13. { Marcel van Brakel. All Rights Reserved.                                      }
  14. {                 }
  15. { Contributor(s): John C. Penman (jcp@craiglockhart.com)                       }
  16. {                 Vladimir Vassiliev (voldemarv@hotpop.com)                    }
  17. {                 }
  18. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  19. {                }
  20. { You may retrieve the latest version of this file at the Project JEDI home    }
  21. { page, located at http://delphi-jedi.org or my personal homepage located at   }
  22. { http://members.chello.nl/m.vanbrakel2                                        }
  23. {                }
  24. { The contents of this file are used with permission, subject to the Mozilla   }
  25. { Public License Version 1.1 (the "License"); you may not use this file except }
  26. { in compliance with the License. You may obtain a copy of the License at      }
  27. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  28. {                                                                              }
  29. { Software distributed under the License is distributed on an "AS IS" basis,   }
  30. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  31. { the specific language governing rights and limitations under the License.    }
  32. {                                                                              }
  33. { Alternatively, the contents of this file may be used under the terms of the  }
  34. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  35. { provisions of the LGPL License are applicable instead of those above.        }
  36. { If you wish to allow use of your version of this file only under the terms   }
  37. { of the LGPL License and not to allow others to use your version of this file }
  38. { under the MPL, indicate your decision by deleting  the provisions above and  }
  39. { replace  them with the notice and other provisions required by the LGPL      }
  40. { License.  If you do not delete the provisions above, a recipient may use     }
  41. { your version of this file under either the MPL or the LGPL License.          }
  42. {                 }
  43. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  44. {                 }
  45. {******************************************************************************}
  46. unit JwaIpHlpApi;
  47. {$WEAKPACKAGEUNIT}
  48. {$HPPEMIT ''}
  49. {$HPPEMIT '#include "iphlpapi.h"'}
  50. {$HPPEMIT ''}
  51. {$I WINDEFINES.INC}
  52. interface
  53. uses
  54.   JwaIpExport, JwaIpRtrMib, JwaIpTypes, JwaWinType, JwaWinBase, JwaWinSock;
  55. //////////////////////////////////////////////////////////////////////////////
  56. //                                                                          //
  57. // IPRTRMIB.H has the definitions of the strcutures used to set and get     //
  58. // information                                                              //
  59. //                                                                          //
  60. //////////////////////////////////////////////////////////////////////////////
  61. // #include <iprtrmib.h>
  62. // #include <ipexport.h>
  63. // #include <iptypes.h>
  64. //////////////////////////////////////////////////////////////////////////////
  65. //                                                                          //
  66. // The GetXXXTable APIs take a buffer and a size of buffer.  If the buffer  //
  67. // is not large enough, the APIs return ERROR_INSUFFICIENT_BUFFER  and      //
  68. // *pdwSize is the required buffer size                                     //
  69. // The bOrder is a BOOLEAN, which if TRUE sorts the table according to      //
  70. // MIB-II (RFC XXXX)                                                        //
  71. //                                                                          //
  72. //////////////////////////////////////////////////////////////////////////////
  73. //////////////////////////////////////////////////////////////////////////////
  74. //                                                                          //
  75. // Retrieves the number of interfaces in the system. These include LAN and  //
  76. // WAN interfaces                                                           //
  77. //                                                                          //
  78. //////////////////////////////////////////////////////////////////////////////
  79. function GetNumberOfInterfaces(var pdwNumIf: DWORD): DWORD; stdcall;
  80. {$EXTERNALSYM GetNumberOfInterfaces}
  81. //////////////////////////////////////////////////////////////////////////////
  82. //                                                                          //
  83. // Gets the MIB-II ifEntry                                                  //
  84. // The dwIndex field of the MIB_IFROW should be set to the index of the     //
  85. // interface being queried                                                  //
  86. //                                                                          //
  87. //////////////////////////////////////////////////////////////////////////////
  88. function GetIfEntry(pIfRow: PMIB_IFROW): DWORD; stdcall;
  89. {$EXTERNALSYM GetIfEntry}
  90. //////////////////////////////////////////////////////////////////////////////
  91. //                                                                          //
  92. // Gets the MIB-II IfTable                                                  //
  93. //                                                                          //
  94. //////////////////////////////////////////////////////////////////////////////
  95. function GetIfTable(pIfTable: PMIB_IFTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
  96. {$EXTERNALSYM GetIfTable}
  97. //////////////////////////////////////////////////////////////////////////////
  98. //                                                                          //
  99. // Gets the Interface to IP Address mapping                                 //
  100. //                                                                          //
  101. //////////////////////////////////////////////////////////////////////////////
  102. function GetIpAddrTable(pIpAddrTable: PMIB_IPADDRTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
  103. {$EXTERNALSYM GetIpAddrTable}
  104. //////////////////////////////////////////////////////////////////////////////
  105. //                                                                          //
  106. // Gets the current IP Address to Physical Address (ARP) mapping            //
  107. //                                                                          //
  108. //////////////////////////////////////////////////////////////////////////////
  109. function GetIpNetTable(pIpNetTable: PMIB_IPNETTABLE; var pdwSize: ULONG; bOrder: BOOL): DWORD; stdcall;
  110. {$EXTERNALSYM GetIpNetTable}
  111. //////////////////////////////////////////////////////////////////////////////
  112. //                                                                          //
  113. // Gets the IP Routing Table  (RFX XXXX)                                    //
  114. //                                                                          //
  115. //////////////////////////////////////////////////////////////////////////////
  116. function GetIpForwardTable(pIpForwardTable: PMIB_IPFORWARDTABLE; var pdwSize: ULONG;
  117.   bOrder: BOOL): DWORD; stdcall;
  118. {$EXTERNALSYM GetIpForwardTable}
  119. //////////////////////////////////////////////////////////////////////////////
  120. //                                                                          //
  121. // Gets TCP Connection/UDP Listener Table                                   //
  122. //                                                                          //
  123. //////////////////////////////////////////////////////////////////////////////
  124. function GetTcpTable(pTcpTable: PMIB_TCPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
  125. {$EXTERNALSYM GetTcpTable}
  126. function GetUdpTable(pUdpTable: PMIB_UDPTABLE; var pdwSize: DWORD; bOrder: BOOL): DWORD; stdcall;
  127. {$EXTERNALSYM GetUdpTable}
  128. //////////////////////////////////////////////////////////////////////////////
  129. //                                                                          //
  130. // Gets IP/ICMP/TCP/UDP Statistics                                          //
  131. //                                                                          //
  132. //////////////////////////////////////////////////////////////////////////////
  133. function GetIpStatistics(var pStats: MIB_IPSTATS): DWORD; stdcall;
  134. {$EXTERNALSYM GetIpStatistics}
  135. function GetIpStatisticsEx(pStats: PMIB_IPSTATS; dwFamily: DWORD): DWORD; stdcall;
  136. {$EXTERNALSYM GetIpStatisticsEx}
  137. function GetIcmpStatistics(var pStats: MIB_ICMP): DWORD; stdcall;
  138. {$EXTERNALSYM GetIcmpStatistics}
  139. function GetIcmpStatisticsEx(pStats: PMIB_ICMP_EX; dwFamily: DWORD): DWORD; stdcall;
  140. {$EXTERNALSYM GetIcmpStatisticsEx}
  141. function GetTcpStatistics(var pStats: MIB_TCPSTATS): DWORD; stdcall;
  142. {$EXTERNALSYM GetTcpStatistics}
  143. function GetTcpStatisticsEx(pStats: PMIB_TCPSTATS; dwFamily: DWORD): DWORD; stdcall;
  144. {$EXTERNALSYM GetTcpStatisticsEx}
  145. function GetUdpStatistics(var pStats: MIB_UDPSTATS): DWORD; stdcall;
  146. {$EXTERNALSYM GetUdpStatistics}
  147. function GetUdpStatisticsEx(pStats: PMIB_UDPSTATS; dwFamily: DWORD): DWORD; stdcall;
  148. {$EXTERNALSYM GetUdpStatisticsEx}
  149. //////////////////////////////////////////////////////////////////////////////
  150. //                                                                          //
  151. // Used to set the ifAdminStatus on an interface.  The only fields of the   //
  152. // MIB_IFROW that are relevant are the dwIndex (index of the interface      //
  153. // whose status needs to be set) and the dwAdminStatus which can be either  //
  154. // MIB_IF_ADMIN_STATUS_UP or MIB_IF_ADMIN_STATUS_DOWN                       //
  155. //                                                                          //
  156. //////////////////////////////////////////////////////////////////////////////
  157. function SetIfEntry(const pIfRow: MIB_IFROW): DWORD; stdcall;
  158. {$EXTERNALSYM SetIfEntry}
  159. //////////////////////////////////////////////////////////////////////////////
  160. //                                                                          //
  161. // Used to create, modify or delete a route.  In all cases the              //
  162. // dwForwardIfIndex, dwForwardDest, dwForwardMask, dwForwardNextHop and     //
  163. // dwForwardPolicy MUST BE SPECIFIED. Currently dwForwardPolicy is unused   //
  164. // and MUST BE 0.                                                           //
  165. // For a set, the complete MIB_IPFORWARDROW structure must be specified     //
  166. //                                                                          //
  167. //////////////////////////////////////////////////////////////////////////////
  168. function CreateIpForwardEntry(const pRoute: MIB_IPFORWARDROW): DWORD; stdcall;
  169. {$EXTERNALSYM CreateIpForwardEntry}
  170. function SetIpForwardEntry(const pRoute: MIB_IPFORWARDROW): DWORD; stdcall;
  171. {$EXTERNALSYM SetIpForwardEntry}
  172. function DeleteIpForwardEntry(const pRoute: MIB_IPFORWARDROW): DWORD; stdcall;
  173. {$EXTERNALSYM DeleteIpForwardEntry}
  174. //////////////////////////////////////////////////////////////////////////////
  175. //                                                                          //
  176. // Used to set the ipForwarding to ON or OFF (currently only ON->OFF is     //
  177. // allowed) and to set the defaultTTL.  If only one of the fields needs to  //
  178. // be modified and the other needs to be the same as before the other field //
  179. // needs to be set to MIB_USE_CURRENT_TTL or MIB_USE_CURRENT_FORWARDING as  //
  180. // the case may be                                                          //
  181. //                                                                          //
  182. //////////////////////////////////////////////////////////////////////////////
  183. function SetIpStatistics(const pIpStats: MIB_IPSTATS): DWORD; stdcall;
  184. {$EXTERNALSYM SetIpStatistics}
  185. //////////////////////////////////////////////////////////////////////////////
  186. //                                                                          //
  187. // Used to set the defaultTTL.                                              //
  188. //                                                                          //
  189. //////////////////////////////////////////////////////////////////////////////
  190. function SetIpTTL(nTTL: UINT): DWORD; stdcall;
  191. {$EXTERNALSYM SetIpTTL}
  192. //////////////////////////////////////////////////////////////////////////////
  193. //                                                                          //
  194. // Used to create, modify or delete an ARP entry.  In all cases the dwIndex //
  195. // dwAddr field MUST BE SPECIFIED.                                          //
  196. // For a set, the complete MIB_IPNETROW structure must be specified         //
  197. //                                                                          //
  198. //////////////////////////////////////////////////////////////////////////////
  199. function CreateIpNetEntry(const pArpEntry: MIB_IPNETROW): DWORD; stdcall;
  200. {$EXTERNALSYM CreateIpNetEntry}
  201. function SetIpNetEntry(const pArpEntry: MIB_IPNETROW): DWORD; stdcall;
  202. {$EXTERNALSYM SetIpNetEntry}
  203. function DeleteIpNetEntry(const pArpEntry: MIB_IPNETROW): DWORD; stdcall;
  204. {$EXTERNALSYM DeleteIpNetEntry}
  205. function FlushIpNetTable(dwIfIndex: DWORD): DWORD; stdcall;
  206. {$EXTERNALSYM FlushIpNetTable}
  207. //////////////////////////////////////////////////////////////////////////////
  208. //                                                                          //
  209. // Used to create or delete a Proxy ARP entry. The dwIndex is the index of  //
  210. // the interface on which to PARP for the dwAddress.  If the interface is   //
  211. // of a type that doesnt support ARP, e.g. PPP, then the call will fail     //
  212. //                                                                          //
  213. //////////////////////////////////////////////////////////////////////////////
  214. function CreateProxyArpEntry(dwAddress, dwMask, dwIfIndex: DWORD): DWORD; stdcall;
  215. {$EXTERNALSYM CreateProxyArpEntry}
  216. function DeleteProxyArpEntry(dwAddress, dwMask, dwIfIndex: DWORD): DWORD; stdcall;
  217. {$EXTERNALSYM DeleteProxyArpEntry}
  218. //////////////////////////////////////////////////////////////////////////////
  219. //                                                                          //
  220. // Used to set the state of a TCP Connection. The only state that it can be //
  221. // set to is MIB_TCP_STATE_DELETE_TCB.  The complete MIB_TCPROW structure   //
  222. // MUST BE SPECIFIED                                                        //
  223. //                                                                          //
  224. //////////////////////////////////////////////////////////////////////////////
  225. function SetTcpEntry(const pTcpRow: MIB_TCPROW): DWORD; stdcall;
  226. {$EXTERNALSYM SetTcpEntry}
  227. function GetInterfaceInfo(pIfTable: PIP_INTERFACE_INFO; var dwOutBufLen: ULONG): DWORD; stdcall;
  228. {$EXTERNALSYM GetInterfaceInfo}
  229. function GetUniDirectionalAdapterInfo(pIPIfInfo: PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS;
  230.   var dwOutBufLen: ULONG): DWORD; stdcall;
  231. {$EXTERNALSYM GetUniDirectionalAdapterInfo(OUT PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo}
  232. //////////////////////////////////////////////////////////////////////////////
  233. //                                                                          //
  234. // Gets the "best" outgoing interface for the specified destination address //
  235. //                                                                          //
  236. //////////////////////////////////////////////////////////////////////////////
  237. function GetBestInterface(dwDestAddr: IPAddr; var pdwBestIfIndex: DWORD): DWORD; stdcall;
  238. {$EXTERNALSYM GetBestInterface}
  239. function GetBestInterfaceEx(pDestAddr: PSockAddr; var pdwBestIfIndex: DWORD): DWORD; stdcall;
  240. {$EXTERNALSYM GetBestInterfaceEx}
  241. //////////////////////////////////////////////////////////////////////////////
  242. //                                                                          //
  243. // Gets the best (longest matching prefix) route for the given destination  //
  244. // If the source address is also specified (i.e. is not 0x00000000), and    //
  245. // there are multiple "best" routes to the given destination, the returned  //
  246. // route will be one that goes out over the interface which has an address  //
  247. // that matches the source address                                          //
  248. //                                                                          //
  249. //////////////////////////////////////////////////////////////////////////////
  250. function GetBestRoute(dwDestAddr, dwSourceAddr: DWORD; pBestRoute: PMIB_IPFORWARDROW): DWORD; stdcall;
  251. {$EXTERNALSYM GetBestRoute}
  252. function NotifyAddrChange(var Handle: THandle; overlapped: POVERLAPPED): DWORD; stdcall;
  253. {$EXTERNALSYM NotifyAddrChange}
  254. function NotifyRouteChange(var Handle: THandle; overlapped: POVERLAPPED): DWORD; stdcall;
  255. {$EXTERNALSYM NotifyRouteChange}
  256. function GetAdapterIndex(AdapterName: LPWSTR; var IfIndex: ULONG): DWORD; stdcall;
  257. {$EXTERNALSYM GetAdapterIndex}
  258. function AddIPAddress(Address: IPAddr; IpMask: IPMask; IfIndex: DWORD;
  259.   var NTEContext, NTEInstance: ULONG): DWORD; stdcall;
  260. {$EXTERNALSYM AddIPAddress}
  261. function DeleteIPAddress(NTEContext: ULONG): DWORD; stdcall;
  262. {$EXTERNALSYM DeleteIPAddress}
  263. function GetNetworkParams(pFixedInfo: PFIXED_INFO; var pOutBufLen: ULONG): DWORD; stdcall;
  264. {$EXTERNALSYM GetNetworkParams}
  265. function GetAdaptersInfo(pAdapterInfo: PIP_ADAPTER_INFO; var pOutBufLen: ULONG): DWORD; stdcall;
  266. {$EXTERNALSYM GetAdaptersInfo}
  267. //
  268. // The following functions require Winsock2.
  269. //
  270. function GetAdaptersAddresses(Family: ULONG; Flags: DWORD; Reserved: PVOID;
  271.   pAdapterAddresses: PIP_ADAPTER_ADDRESSES; pOutBufLen: PULONG): DWORD; stdcall;
  272. {$EXTERNALSYM GetAdaptersAddresses}
  273. function GetPerAdapterInfo(IfIndex: ULONG; pPerAdapterInfo: PIP_PER_ADAPTER_INFO;
  274.   var pOutBufLen: ULONG): DWORD; stdcall;
  275. {$EXTERNALSYM GetPerAdapterInfo}
  276. function IpReleaseAddress(const AdapterInfo: IP_ADAPTER_INDEX_MAP): DWORD; stdcall;
  277. {$EXTERNALSYM IpReleaseAddress}
  278. function IpRenewAddress(const AdapterInfo: IP_ADAPTER_INDEX_MAP): DWORD; stdcall;
  279. {$EXTERNALSYM IpRenewAddress}
  280. function SendARP(const DestIP, SrcIP: IPAddr; pMacAddr: PULONG; var PhyAddrLen: ULONG): DWORD; stdcall;
  281. {$EXTERNALSYM SendARP}
  282. function GetRTTAndHopCount(DestIpAddress: IPAddr; var HopCount: ULONG;
  283.   MaxHops: ULONG; var RTT: ULONG): BOOL; stdcall;
  284. {$EXTERNALSYM GetRTTAndHopCount}
  285. function GetFriendlyIfIndex(IfIndex: DWORD): DWORD; stdcall;
  286. {$EXTERNALSYM GetFriendlyIfIndex}
  287. function EnableRouter(var pHandle: THandle; pOverlapped: POVERLAPPED): DWORD; stdcall;
  288. {$EXTERNALSYM EnableRouter}
  289. function UnenableRouter(pOverlapped: POVERLAPPED; lpdwEnableCount: LPDWORD): DWORD; stdcall;
  290. {$EXTERNALSYM UnenableRouter}
  291. function DisableMediaSense(var pHandle: HANDLE; pOverLapped: POVERLAPPED): DWORD; stdcall;
  292. {$EXTERNALSYM DisableMediaSense}
  293. function RestoreMediaSense(pOverlapped: POVERLAPPED; lpdwEnableCount: LPDWORD): DWORD; stdcall;
  294. {$EXTERNALSYM RestoreMediaSense}
  295. function GetIpErrorString(ErrorCode: IP_STATUS; Buffer: PWCHAR; var Size: DWORD): DWORD; stdcall;
  296. {$EXTERNALSYM GetIpErrorString}
  297. implementation
  298. const
  299.   iphlpapilib = 'iphlpapi.dll';
  300. {$IFDEF DYNAMIC_LINK}
  301. var
  302.   _GetNumberOfInterfaces: Pointer;
  303. function GetNumberOfInterfaces;
  304. begin
  305.   GetProcedureAddress(_GetNumberOfInterfaces, iphlpapilib, 'GetNumberOfInterfaces');
  306.   asm
  307.     mov esp, ebp
  308.     pop ebp
  309.     jmp [_GetNumberOfInterfaces]
  310.   end;
  311. end;
  312. {$ELSE}
  313. function GetNumberOfInterfaces; external iphlpapilib name 'GetNumberOfInterfaces';
  314. {$ENDIF DYNAMIC_LINK}
  315. {$IFDEF DYNAMIC_LINK}
  316. var
  317.   _GetIfEntry: Pointer;
  318. function GetIfEntry;
  319. begin
  320.   GetProcedureAddress(_GetIfEntry, iphlpapilib, 'GetIfEntry');
  321.   asm
  322.     mov esp, ebp
  323.     pop ebp
  324.     jmp [_GetIfEntry]
  325.   end;
  326. end;
  327. {$ELSE}
  328. function GetIfEntry; external iphlpapilib name 'GetIfEntry';
  329. {$ENDIF DYNAMIC_LINK}
  330. {$IFDEF DYNAMIC_LINK}
  331. var
  332.   _GetIfTable: Pointer;
  333. function GetIfTable;
  334. begin
  335.   GetProcedureAddress(_GetIfTable, iphlpapilib, 'GetIfTable');
  336.   asm
  337.     mov esp, ebp
  338.     pop ebp
  339.     jmp [_GetIfTable]
  340.   end;
  341. end;
  342. {$ELSE}
  343. function GetIfTable; external iphlpapilib name 'GetIfTable';
  344. {$ENDIF DYNAMIC_LINK}
  345. {$IFDEF DYNAMIC_LINK}
  346. var
  347.   _GetIpAddrTable: Pointer;
  348. function GetIpAddrTable;
  349. begin
  350.   GetProcedureAddress(_GetIpAddrTable, iphlpapilib, 'GetIpAddrTable');
  351.   asm
  352.     mov esp, ebp
  353.     pop ebp
  354.     jmp [_GetIpAddrTable]
  355.   end;
  356. end;
  357. {$ELSE}
  358. function GetIpAddrTable; external iphlpapilib name 'GetIpAddrTable';
  359. {$ENDIF DYNAMIC_LINK}
  360. {$IFDEF DYNAMIC_LINK}
  361. var
  362.   _GetIpNetTable: Pointer;
  363. function GetIpNetTable;
  364. begin
  365.   GetProcedureAddress(_GetIpNetTable, iphlpapilib, 'GetIpNetTable');
  366.   asm
  367.     mov esp, ebp
  368.     pop ebp
  369.     jmp [_GetIpNetTable]
  370.   end;
  371. end;
  372. {$ELSE}
  373. function GetIpNetTable; external iphlpapilib name 'GetIpNetTable';
  374. {$ENDIF DYNAMIC_LINK}
  375. {$IFDEF DYNAMIC_LINK}
  376. var
  377.   _GetIpForwardTable: Pointer;
  378. function GetIpForwardTable;
  379. begin
  380.   GetProcedureAddress(_GetIpForwardTable, iphlpapilib, 'GetIpForwardTable');
  381.   asm
  382.     mov esp, ebp
  383.     pop ebp
  384.     jmp [_GetIpForwardTable]
  385.   end;
  386. end;
  387. {$ELSE}
  388. function GetIpForwardTable; external iphlpapilib name 'GetIpForwardTable';
  389. {$ENDIF DYNAMIC_LINK}
  390. {$IFDEF DYNAMIC_LINK}
  391. var
  392.   _GetTcpTable: Pointer;
  393. function GetTcpTable;
  394. begin
  395.   GetProcedureAddress(_GetTcpTable, iphlpapilib, 'GetTcpTable');
  396.   asm
  397.     mov esp, ebp
  398.     pop ebp
  399.     jmp [_GetTcpTable]
  400.   end;
  401. end;
  402. {$ELSE}
  403. function GetTcpTable; external iphlpapilib name 'GetTcpTable';
  404. {$ENDIF DYNAMIC_LINK}
  405. {$IFDEF DYNAMIC_LINK}
  406. var
  407.   _GetUdpTable: Pointer;
  408. function GetUdpTable;
  409. begin
  410.   GetProcedureAddress(_GetUdpTable, iphlpapilib, 'GetUdpTable');
  411.   asm
  412.     mov esp, ebp
  413.     pop ebp
  414.     jmp [_GetUdpTable]
  415.   end;
  416. end;
  417. {$ELSE}
  418. function GetUdpTable; external iphlpapilib name 'GetUdpTable';
  419. {$ENDIF DYNAMIC_LINK}
  420. {$IFDEF DYNAMIC_LINK}
  421. var
  422.   _GetIpStatistics: Pointer;
  423. function GetIpStatistics;
  424. begin
  425.   GetProcedureAddress(_GetIpStatistics, iphlpapilib, 'GetIpStatistics');
  426.   asm
  427.     mov esp, ebp
  428.     pop ebp
  429.     jmp [_GetIpStatistics]
  430.   end;
  431. end;
  432. {$ELSE}
  433. function GetIpStatistics; external iphlpapilib name 'GetIpStatistics';
  434. {$ENDIF DYNAMIC_LINK}
  435. {$IFDEF DYNAMIC_LINK}
  436. var
  437.   _GetIpStatisticsEx: Pointer;
  438. function GetIpStatisticsEx;
  439. begin
  440.   GetProcedureAddress(_GetIpStatisticsEx, iphlpapilib, 'GetIpStatisticsEx');
  441.   asm
  442.     mov esp, ebp
  443.     pop ebp
  444.     jmp [_GetIpStatisticsEx]
  445.   end;
  446. end;
  447. {$ELSE}
  448. function GetIpStatisticsEx; external iphlpapilib name 'GetIpStatisticsEx';
  449. {$ENDIF DYNAMIC_LINK}
  450. {$IFDEF DYNAMIC_LINK}
  451. var
  452.   _GetIcmpStatistics: Pointer;
  453. function GetIcmpStatistics;
  454. begin
  455.   GetProcedureAddress(_GetIcmpStatistics, iphlpapilib, 'GetIcmpStatistics');
  456.   asm
  457.     mov esp, ebp
  458.     pop ebp
  459.     jmp [_GetIcmpStatistics]
  460.   end;
  461. end;
  462. {$ELSE}
  463. function GetIcmpStatistics; external iphlpapilib name 'GetIcmpStatistics';
  464. {$ENDIF DYNAMIC_LINK}
  465. {$IFDEF DYNAMIC_LINK}
  466. var
  467.   _GetIcmpStatisticsEx: Pointer;
  468. function GetIcmpStatisticsEx;
  469. begin
  470.   GetProcedureAddress(_GetIcmpStatisticsEx, iphlpapilib, 'GetIcmpStatisticsEx');
  471.   asm
  472.     mov esp, ebp
  473.     pop ebp
  474.     jmp [_GetIcmpStatisticsEx]
  475.   end;
  476. end;
  477. {$ELSE}
  478. function GetIcmpStatisticsEx; external iphlpapilib name 'GetIcmpStatisticsEx';
  479. {$ENDIF DYNAMIC_LINK}
  480. {$IFDEF DYNAMIC_LINK}
  481. var
  482.   _GetTcpStatistics: Pointer;
  483. function GetTcpStatistics;
  484. begin
  485.   GetProcedureAddress(_GetTcpStatistics, iphlpapilib, 'GetTcpStatistics');
  486.   asm
  487.     mov esp, ebp
  488.     pop ebp
  489.     jmp [_GetTcpStatistics]
  490.   end;
  491. end;
  492. {$ELSE}
  493. function GetTcpStatistics; external iphlpapilib name 'GetTcpStatistics';
  494. {$ENDIF DYNAMIC_LINK}
  495. {$IFDEF DYNAMIC_LINK}
  496. var
  497.   _GetTcpStatisticsEx: Pointer;
  498. function GetTcpStatisticsEx;
  499. begin
  500.   GetProcedureAddress(_GetTcpStatisticsEx, iphlpapilib, 'GetTcpStatisticsEx');
  501.   asm
  502.     mov esp, ebp
  503.     pop ebp
  504.     jmp [_GetTcpStatisticsEx]
  505.   end;
  506. end;
  507. {$ELSE}
  508. function GetTcpStatisticsEx; external iphlpapilib name 'GetTcpStatisticsEx';
  509. {$ENDIF DYNAMIC_LINK}
  510. {$IFDEF DYNAMIC_LINK}
  511. var
  512.   _GetUdpStatistics: Pointer;
  513. function GetUdpStatistics;
  514. begin
  515.   GetProcedureAddress(_GetUdpStatistics, iphlpapilib, 'GetUdpStatistics');
  516.   asm
  517.     mov esp, ebp
  518.     pop ebp
  519.     jmp [_GetUdpStatistics]
  520.   end;
  521. end;
  522. {$ELSE}
  523. function GetUdpStatistics; external iphlpapilib name 'GetUdpStatistics';
  524. {$ENDIF DYNAMIC_LINK}
  525. {$IFDEF DYNAMIC_LINK}
  526. var
  527.   _GetUdpStatisticsEx: Pointer;
  528. function GetUdpStatisticsEx;
  529. begin
  530.   GetProcedureAddress(_GetUdpStatisticsEx, iphlpapilib, 'GetUdpStatisticsEx');
  531.   asm
  532.     mov esp, ebp
  533.     pop ebp
  534.     jmp [_GetUdpStatisticsEx]
  535.   end;
  536. end;
  537. {$ELSE}
  538. function GetUdpStatisticsEx; external iphlpapilib name 'GetUdpStatisticsEx';
  539. {$ENDIF DYNAMIC_LINK}
  540. {$IFDEF DYNAMIC_LINK}
  541. var
  542.   _SetIfEntry: Pointer;
  543. function SetIfEntry;
  544. begin
  545.   GetProcedureAddress(_SetIfEntry, iphlpapilib, 'SetIfEntry');
  546.   asm
  547.     mov esp, ebp
  548.     pop ebp
  549.     jmp [_SetIfEntry]
  550.   end;
  551. end;
  552. {$ELSE}
  553. function SetIfEntry; external iphlpapilib name 'SetIfEntry';
  554. {$ENDIF DYNAMIC_LINK}
  555. {$IFDEF DYNAMIC_LINK}
  556. var
  557.   _CreateIpForwardEntry: Pointer;
  558. function CreateIpForwardEntry;
  559. begin
  560.   GetProcedureAddress(_CreateIpForwardEntry, iphlpapilib, 'CreateIpForwardEntry');
  561.   asm
  562.     mov esp, ebp
  563.     pop ebp
  564.     jmp [_CreateIpForwardEntry]
  565.   end;
  566. end;
  567. {$ELSE}
  568. function CreateIpForwardEntry; external iphlpapilib name 'CreateIpForwardEntry';
  569. {$ENDIF DYNAMIC_LINK}
  570. {$IFDEF DYNAMIC_LINK}
  571. var
  572.   _SetIpForwardEntry: Pointer;
  573. function SetIpForwardEntry;
  574. begin
  575.   GetProcedureAddress(_SetIpForwardEntry, iphlpapilib, 'SetIpForwardEntry');
  576.   asm
  577.     mov esp, ebp
  578.     pop ebp
  579.     jmp [_SetIpForwardEntry]
  580.   end;
  581. end;
  582. {$ELSE}
  583. function SetIpForwardEntry; external iphlpapilib name 'SetIpForwardEntry';
  584. {$ENDIF DYNAMIC_LINK}
  585. {$IFDEF DYNAMIC_LINK}
  586. var
  587.   _DeleteIpForwardEntry: Pointer;
  588. function DeleteIpForwardEntry;
  589. begin
  590.   GetProcedureAddress(_DeleteIpForwardEntry, iphlpapilib, 'DeleteIpForwardEntry');
  591.   asm
  592.     mov esp, ebp
  593.     pop ebp
  594.     jmp [_DeleteIpForwardEntry]
  595.   end;
  596. end;
  597. {$ELSE}
  598. function DeleteIpForwardEntry; external iphlpapilib name 'DeleteIpForwardEntry';
  599. {$ENDIF DYNAMIC_LINK}
  600. {$IFDEF DYNAMIC_LINK}
  601. var
  602.   _SetIpStatistics: Pointer;
  603. function SetIpStatistics;
  604. begin
  605.   GetProcedureAddress(_SetIpStatistics, iphlpapilib, 'SetIpStatistics');
  606.   asm
  607.     mov esp, ebp
  608.     pop ebp
  609.     jmp [_SetIpStatistics]
  610.   end;
  611. end;
  612. {$ELSE}
  613. function SetIpStatistics; external iphlpapilib name 'SetIpStatistics';
  614. {$ENDIF DYNAMIC_LINK}
  615. {$IFDEF DYNAMIC_LINK}
  616. var
  617.   _SetIpTTL: Pointer;
  618. function SetIpTTL;
  619. begin
  620.   GetProcedureAddress(_SetIpTTL, iphlpapilib, 'SetIpTTL');
  621.   asm
  622.     mov esp, ebp
  623.     pop ebp
  624.     jmp [_SetIpTTL]
  625.   end;
  626. end;
  627. {$ELSE}
  628. function SetIpTTL; external iphlpapilib name 'SetIpTTL';
  629. {$ENDIF DYNAMIC_LINK}
  630. {$IFDEF DYNAMIC_LINK}
  631. var
  632.   _CreateIpNetEntry: Pointer;
  633. function CreateIpNetEntry;
  634. begin
  635.   GetProcedureAddress(_CreateIpNetEntry, iphlpapilib, 'CreateIpNetEntry');
  636.   asm
  637.     mov esp, ebp
  638.     pop ebp
  639.     jmp [_CreateIpNetEntry]
  640.   end;
  641. end;
  642. {$ELSE}
  643. function CreateIpNetEntry; external iphlpapilib name 'CreateIpNetEntry';
  644. {$ENDIF DYNAMIC_LINK}
  645. {$IFDEF DYNAMIC_LINK}
  646. var
  647.   _SetIpNetEntry: Pointer;
  648. function SetIpNetEntry;
  649. begin
  650.   GetProcedureAddress(_SetIpNetEntry, iphlpapilib, 'SetIpNetEntry');
  651.   asm
  652.     mov esp, ebp
  653.     pop ebp
  654.     jmp [_SetIpNetEntry]
  655.   end;
  656. end;
  657. {$ELSE}
  658. function SetIpNetEntry; external iphlpapilib name 'SetIpNetEntry';
  659. {$ENDIF DYNAMIC_LINK}
  660. {$IFDEF DYNAMIC_LINK}
  661. var
  662.   _DeleteIpNetEntry: Pointer;
  663. function DeleteIpNetEntry;
  664. begin
  665.   GetProcedureAddress(_DeleteIpNetEntry, iphlpapilib, 'DeleteIpNetEntry');
  666.   asm
  667.     mov esp, ebp
  668.     pop ebp
  669.     jmp [_DeleteIpNetEntry]
  670.   end;
  671. end;
  672. {$ELSE}
  673. function DeleteIpNetEntry; external iphlpapilib name 'DeleteIpNetEntry';
  674. {$ENDIF DYNAMIC_LINK}
  675. {$IFDEF DYNAMIC_LINK}
  676. var
  677.   _FlushIpNetTable: Pointer;
  678. function FlushIpNetTable;
  679. begin
  680.   GetProcedureAddress(_FlushIpNetTable, iphlpapilib, 'FlushIpNetTable');
  681.   asm
  682.     mov esp, ebp
  683.     pop ebp
  684.     jmp [_FlushIpNetTable]
  685.   end;
  686. end;
  687. {$ELSE}
  688. function FlushIpNetTable; external iphlpapilib name 'FlushIpNetTable';
  689. {$ENDIF DYNAMIC_LINK}
  690. {$IFDEF DYNAMIC_LINK}
  691. var
  692.   _CreateProxyArpEntry: Pointer;
  693. function CreateProxyArpEntry;
  694. begin
  695.   GetProcedureAddress(_CreateProxyArpEntry, iphlpapilib, 'CreateProxyArpEntry');
  696.   asm
  697.     mov esp, ebp
  698.     pop ebp
  699.     jmp [_CreateProxyArpEntry]
  700.   end;
  701. end;
  702. {$ELSE}
  703. function CreateProxyArpEntry; external iphlpapilib name 'CreateProxyArpEntry';
  704. {$ENDIF DYNAMIC_LINK}
  705. {$IFDEF DYNAMIC_LINK}
  706. var
  707.   _DeleteProxyArpEntry: Pointer;
  708. function DeleteProxyArpEntry;
  709. begin
  710.   GetProcedureAddress(_DeleteProxyArpEntry, iphlpapilib, 'DeleteProxyArpEntry');
  711.   asm
  712.     mov esp, ebp
  713.     pop ebp
  714.     jmp [_DeleteProxyArpEntry]
  715.   end;
  716. end;
  717. {$ELSE}
  718. function DeleteProxyArpEntry; external iphlpapilib name 'DeleteProxyArpEntry';
  719. {$ENDIF DYNAMIC_LINK}
  720. {$IFDEF DYNAMIC_LINK}
  721. var
  722.   _SetTcpEntry: Pointer;
  723. function SetTcpEntry;
  724. begin
  725.   GetProcedureAddress(_SetTcpEntry, iphlpapilib, 'SetTcpEntry');
  726.   asm
  727.     mov esp, ebp
  728.     pop ebp
  729.     jmp [_SetTcpEntry]
  730.   end;
  731. end;
  732. {$ELSE}
  733. function SetTcpEntry; external iphlpapilib name 'SetTcpEntry';
  734. {$ENDIF DYNAMIC_LINK}
  735. {$IFDEF DYNAMIC_LINK}
  736. var
  737.   _GetInterfaceInfo: Pointer;
  738. function GetInterfaceInfo;
  739. begin
  740.   GetProcedureAddress(_GetInterfaceInfo, iphlpapilib, 'GetInterfaceInfo');
  741.   asm
  742.     mov esp, ebp
  743.     pop ebp
  744.     jmp [_GetInterfaceInfo]
  745.   end;
  746. end;
  747. {$ELSE}
  748. function GetInterfaceInfo; external iphlpapilib name 'GetInterfaceInfo';
  749. {$ENDIF DYNAMIC_LINK}
  750. {$IFDEF DYNAMIC_LINK}
  751. var
  752.   _GetUniDirectionalAdapterInfo: Pointer;
  753. function GetUniDirectionalAdapterInfo;
  754. begin
  755.   GetProcedureAddress(_GetUniDirectionalAdapterInfo, iphlpapilib, 'GetUniDirectionalAdapterInfo');
  756.   asm
  757.     mov esp, ebp
  758.     pop ebp
  759.     jmp [_GetUniDirectionalAdapterInfo]
  760.   end;
  761. end;
  762. {$ELSE}
  763. function GetUniDirectionalAdapterInfo; external iphlpapilib name 'GetUniDirectionalAdapterInfo';
  764. {$ENDIF DYNAMIC_LINK}
  765. {$IFDEF DYNAMIC_LINK}
  766. var
  767.   _GetBestInterface: Pointer;
  768. function GetBestInterface;
  769. begin
  770.   GetProcedureAddress(_GetBestInterface, iphlpapilib, 'GetBestInterface');
  771.   asm
  772.     mov esp, ebp
  773.     pop ebp
  774.     jmp [_GetBestInterface]
  775.   end;
  776. end;
  777. {$ELSE}
  778. function GetBestInterface; external iphlpapilib name 'GetBestInterface';
  779. {$ENDIF DYNAMIC_LINK}
  780. {$IFDEF DYNAMIC_LINK}
  781. var
  782.   _GetBestInterfaceEx: Pointer;
  783. function GetBestInterfaceEx;
  784. begin
  785.   GetProcedureAddress(_GetBestInterfaceEx, iphlpapilib, 'GetBestInterfaceEx');
  786.   asm
  787.     mov esp, ebp
  788.     pop ebp
  789.     jmp [_GetBestInterfaceEx]
  790.   end;
  791. end;
  792. {$ELSE}
  793. function GetBestInterfaceEx; external iphlpapilib name 'GetBestInterfaceEx';
  794. {$ENDIF DYNAMIC_LINK}
  795. {$IFDEF DYNAMIC_LINK}
  796. var
  797.   _GetBestRoute: Pointer;
  798. function GetBestRoute;
  799. begin
  800.   GetProcedureAddress(_GetBestRoute, iphlpapilib, 'GetBestRoute');
  801.   asm
  802.     mov esp, ebp
  803.     pop ebp
  804.     jmp [_GetBestRoute]
  805.   end;
  806. end;
  807. {$ELSE}
  808. function GetBestRoute; external iphlpapilib name 'GetBestRoute';
  809. {$ENDIF DYNAMIC_LINK}
  810. {$IFDEF DYNAMIC_LINK}
  811. var
  812.   _NotifyAddrChange: Pointer;
  813. function NotifyAddrChange;
  814. begin
  815.   GetProcedureAddress(_NotifyAddrChange, iphlpapilib, 'NotifyAddrChange');
  816.   asm
  817.     mov esp, ebp
  818.     pop ebp
  819.     jmp [_NotifyAddrChange]
  820.   end;
  821. end;
  822. {$ELSE}
  823. function NotifyAddrChange; external iphlpapilib name 'NotifyAddrChange';
  824. {$ENDIF DYNAMIC_LINK}
  825. {$IFDEF DYNAMIC_LINK}
  826. var
  827.   _NotifyRouteChange: Pointer;
  828. function NotifyRouteChange;
  829. begin
  830.   GetProcedureAddress(_NotifyRouteChange, iphlpapilib, 'NotifyRouteChange');
  831.   asm
  832.     mov esp, ebp
  833.     pop ebp
  834.     jmp [_NotifyRouteChange]
  835.   end;
  836. end;
  837. {$ELSE}
  838. function NotifyRouteChange; external iphlpapilib name 'NotifyRouteChange';
  839. {$ENDIF DYNAMIC_LINK}
  840. {$IFDEF DYNAMIC_LINK}
  841. var
  842.   _GetAdapterIndex: Pointer;
  843. function GetAdapterIndex;
  844. begin
  845.   GetProcedureAddress(_GetAdapterIndex, iphlpapilib, 'GetAdapterIndex');
  846.   asm
  847.     mov esp, ebp
  848.     pop ebp
  849.     jmp [_GetAdapterIndex]
  850.   end;
  851. end;
  852. {$ELSE}
  853. function GetAdapterIndex; external iphlpapilib name 'GetAdapterIndex';
  854. {$ENDIF DYNAMIC_LINK}
  855. {$IFDEF DYNAMIC_LINK}
  856. var
  857.   _AddIPAddress: Pointer;
  858. function AddIPAddress;
  859. begin
  860.   GetProcedureAddress(_AddIPAddress, iphlpapilib, 'AddIPAddress');
  861.   asm
  862.     mov esp, ebp
  863.     pop ebp
  864.     jmp [_AddIPAddress]
  865.   end;
  866. end;
  867. {$ELSE}
  868. function AddIPAddress; external iphlpapilib name 'AddIPAddress';
  869. {$ENDIF DYNAMIC_LINK}
  870. {$IFDEF DYNAMIC_LINK}
  871. var
  872.   _DeleteIPAddress: Pointer;
  873. function DeleteIPAddress;
  874. begin
  875.   GetProcedureAddress(_DeleteIPAddress, iphlpapilib, 'DeleteIPAddress');
  876.   asm
  877.     mov esp, ebp
  878.     pop ebp
  879.     jmp [_DeleteIPAddress]
  880.   end;
  881. end;
  882. {$ELSE}
  883. function DeleteIPAddress; external iphlpapilib name 'DeleteIPAddress';
  884. {$ENDIF DYNAMIC_LINK}
  885. {$IFDEF DYNAMIC_LINK}
  886. var
  887.   _GetNetworkParams: Pointer;
  888. function GetNetworkParams;
  889. begin
  890.   GetProcedureAddress(_GetNetworkParams, iphlpapilib, 'GetNetworkParams');
  891.   asm
  892.     mov esp, ebp
  893.     pop ebp
  894.     jmp [_GetNetworkParams]
  895.   end;
  896. end;
  897. {$ELSE}
  898. function GetNetworkParams; external iphlpapilib name 'GetNetworkParams';
  899. {$ENDIF DYNAMIC_LINK}
  900. {$IFDEF DYNAMIC_LINK}
  901. var
  902.   _GetAdaptersInfo: Pointer;
  903. function GetAdaptersInfo;
  904. begin
  905.   GetProcedureAddress(_GetAdaptersInfo, iphlpapilib, 'GetAdaptersInfo');
  906.   asm
  907.     mov esp, ebp
  908.     pop ebp
  909.     jmp [_GetAdaptersInfo]
  910.   end;
  911. end;
  912. {$ELSE}
  913. function GetAdaptersInfo; external iphlpapilib name 'GetAdaptersInfo';
  914. {$ENDIF DYNAMIC_LINK}
  915. {$IFDEF DYNAMIC_LINK}
  916. var
  917.   _GetAdaptersAddresses: Pointer;
  918. function GetAdaptersAddresses;
  919. begin
  920.   GetProcedureAddress(_GetAdaptersAddresses, iphlpapilib, 'GetAdaptersAddresses');
  921.   asm
  922.     mov esp, ebp
  923.     pop ebp
  924.     jmp [_GetAdaptersAddresses]
  925.   end;
  926. end;
  927. {$ELSE}
  928. function GetAdaptersAddresses; external iphlpapilib name 'GetAdaptersAddresses';
  929. {$ENDIF DYNAMIC_LINK}
  930. {$IFDEF DYNAMIC_LINK}
  931. var
  932.   _GetPerAdapterInfo: Pointer;
  933. function GetPerAdapterInfo;
  934. begin
  935.   GetProcedureAddress(_GetPerAdapterInfo, iphlpapilib, 'GetPerAdapterInfo');
  936.   asm
  937.     mov esp, ebp
  938.     pop ebp
  939.     jmp [_GetPerAdapterInfo]
  940.   end;
  941. end;
  942. {$ELSE}
  943. function GetPerAdapterInfo; external iphlpapilib name 'GetPerAdapterInfo';
  944. {$ENDIF DYNAMIC_LINK}
  945. {$IFDEF DYNAMIC_LINK}
  946. var
  947.   _IpReleaseAddress: Pointer;
  948. function IpReleaseAddress;
  949. begin
  950.   GetProcedureAddress(_IpReleaseAddress, iphlpapilib, 'IpReleaseAddress');
  951.   asm
  952.     mov esp, ebp
  953.     pop ebp
  954.     jmp [_IpReleaseAddress]
  955.   end;
  956. end;
  957. {$ELSE}
  958. function IpReleaseAddress; external iphlpapilib name 'IpReleaseAddress';
  959. {$ENDIF DYNAMIC_LINK}
  960. {$IFDEF DYNAMIC_LINK}
  961. var
  962.   _IpRenewAddress: Pointer;
  963. function IpRenewAddress;
  964. begin
  965.   GetProcedureAddress(_IpRenewAddress, iphlpapilib, 'IpRenewAddress');
  966.   asm
  967.     mov esp, ebp
  968.     pop ebp
  969.     jmp [_IpRenewAddress]
  970.   end;
  971. end;
  972. {$ELSE}
  973. function IpRenewAddress; external iphlpapilib name 'IpRenewAddress';
  974. {$ENDIF DYNAMIC_LINK}
  975. {$IFDEF DYNAMIC_LINK}
  976. var
  977.   _SendARP: Pointer;
  978. function SendARP;
  979. begin
  980.   GetProcedureAddress(_SendARP, iphlpapilib, 'SendARP');
  981.   asm
  982.     mov esp, ebp
  983.     pop ebp
  984.     jmp [_SendARP]
  985.   end;
  986. end;
  987. {$ELSE}
  988. function SendARP; external iphlpapilib name 'SendARP';
  989. {$ENDIF DYNAMIC_LINK}
  990. {$IFDEF DYNAMIC_LINK}
  991. var
  992.   _GetRTTAndHopCount: Pointer;
  993. function GetRTTAndHopCount;
  994. begin
  995.   GetProcedureAddress(_GetRTTAndHopCount, iphlpapilib, 'GetRTTAndHopCount');
  996.   asm
  997.     mov esp, ebp
  998.     pop ebp
  999.     jmp [_GetRTTAndHopCount]
  1000.   end;
  1001. end;
  1002. {$ELSE}
  1003. function GetRTTAndHopCount; external iphlpapilib name 'GetRTTAndHopCount';
  1004. {$ENDIF DYNAMIC_LINK}
  1005. {$IFDEF DYNAMIC_LINK}
  1006. var
  1007.   _GetFriendlyIfIndex: Pointer;
  1008. function GetFriendlyIfIndex;
  1009. begin
  1010.   GetProcedureAddress(_GetFriendlyIfIndex, iphlpapilib, 'GetFriendlyIfIndex');
  1011.   asm
  1012.     mov esp, ebp
  1013.     pop ebp
  1014.     jmp [_GetFriendlyIfIndex]
  1015.   end;
  1016. end;
  1017. {$ELSE}
  1018. function GetFriendlyIfIndex; external iphlpapilib name 'GetFriendlyIfIndex';
  1019. {$ENDIF DYNAMIC_LINK}
  1020. {$IFDEF DYNAMIC_LINK}
  1021. var
  1022.   _EnableRouter: Pointer;
  1023. function EnableRouter;
  1024. begin
  1025.   GetProcedureAddress(_EnableRouter, iphlpapilib, 'EnableRouter');
  1026.   asm
  1027.     mov esp, ebp
  1028.     pop ebp
  1029.     jmp [_EnableRouter]
  1030.   end;
  1031. end;
  1032. {$ELSE}
  1033. function EnableRouter; external iphlpapilib name 'EnableRouter';
  1034. {$ENDIF DYNAMIC_LINK}
  1035. {$IFDEF DYNAMIC_LINK}
  1036. var
  1037.   _UnenableRouter: Pointer;
  1038. function UnenableRouter;
  1039. begin
  1040.   GetProcedureAddress(_UnenableRouter, iphlpapilib, 'UnenableRouter');
  1041.   asm
  1042.     mov esp, ebp
  1043.     pop ebp
  1044.     jmp [_UnenableRouter]
  1045.   end;
  1046. end;
  1047. {$ELSE}
  1048. function UnenableRouter; external iphlpapilib name 'UnenableRouter';
  1049. {$ENDIF DYNAMIC_LINK}
  1050. {$IFDEF DYNAMIC_LINK}
  1051. var
  1052.   _DisableMediaSense: Pointer;
  1053. function DisableMediaSense;
  1054. begin
  1055.   GetProcedureAddress(_DisableMediaSense, iphlpapilib, 'DisableMediaSense');
  1056.   asm
  1057.     mov esp, ebp
  1058.     pop ebp
  1059.     jmp [_DisableMediaSense]
  1060.   end;
  1061. end;
  1062. {$ELSE}
  1063. function DisableMediaSense; external iphlpapilib name 'DisableMediaSense';
  1064. {$ENDIF DYNAMIC_LINK}
  1065. {$IFDEF DYNAMIC_LINK}
  1066. var
  1067.   _RestoreMediaSense: Pointer;
  1068. function RestoreMediaSense;
  1069. begin
  1070.   GetProcedureAddress(_RestoreMediaSense, iphlpapilib, 'RestoreMediaSense');
  1071.   asm
  1072.     mov esp, ebp
  1073.     pop ebp
  1074.     jmp [_RestoreMediaSense]
  1075.   end;
  1076. end;
  1077. {$ELSE}
  1078. function RestoreMediaSense; external iphlpapilib name 'RestoreMediaSense';
  1079. {$ENDIF DYNAMIC_LINK}
  1080. {$IFDEF DYNAMIC_LINK}
  1081. var
  1082.   _GetIpErrorString: Pointer;
  1083. function GetIpErrorString;
  1084. begin
  1085.   GetProcedureAddress(_GetIpErrorString, iphlpapilib, 'GetIpErrorString');
  1086.   asm
  1087.     mov esp, ebp
  1088.     pop ebp
  1089.     jmp [_GetIpErrorString]
  1090.   end;
  1091. end;
  1092. {$ELSE}
  1093. function GetIpErrorString; external iphlpapilib name 'GetIpErrorString';
  1094. {$ENDIF DYNAMIC_LINK}
  1095. end.