View Single Post
  #5  
Old 11-08-2016, 02:55 AM
Rantor777 Rantor777 is offline
Junior Member
 
Join Date: Nov 2016
Location: 127.0.0.1
Posts: 10
Default Method #003

PHP Code:
interface  

uses .. JwaIpHlpApiJwaIpTypes .. ;  

function 
get_adapters_infoTStrings;  
implementation  ..  
function 
get_adapters_infoTStrings
const   
WIRELESS_ADAPTER 71;   
ETHERNET_ADAPTER 6;  
var   
NumInterfacesCardinal;   
AdapterInfo: array of TIpAdapterInfo;   
OutBufLenULONG;   
iinteger;   
macTipo string;   
AdaptersInfo TStrings
begin   
GetNumberOfInterfaces
(NumInterfaces);   
SetLength(AdapterInfoNumInterfaces);   
OutBufLen := NumInterfaces SizeOf(TIpAdapterInfo);   
GetAdaptersInfo(@AdapterInfo[0], OutBufLen);    
AdaptersInfo := TStringList.Create;    
for 
:= 0 to NumInterfaces do 
begin      
mac 
:= Format('%.2x:%.2x:%.2x:%.2x:%.2x:%.2x',           
[
AdapterInfo[i].Address[0], AdapterInfo[i].Address[1],            
AdapterInfo[i].Address[2], AdapterInfo[i].Address[3],            
AdapterInfo[i].Address[4], AdapterInfo[i].Address[5]]);      
case 
AdapterInfo[i].Type_ of       
WIRELESS_ADAPTER 
Tipo := 'WIF';       
ETHERNET_ADAPTER Tipo := 'ETH';    
 
end;      
if 
AdapterInfo[i].Description <> EmptyStr then       
AdaptersInfo
.Add(IntToStr(i)                
' - ' Tipo                
' - ' AdapterInfo[i].Description                
' - ' mac);   
end;   
Result := AdaptersInfo
end
Reply With Quote