JwaIpTypes: fix record size for x64
JwaIpTypes: fix record sizes for x64
Add {$PACKRECORDS C} and change time_t from Longint to PtrInt.
Demo:
program networks;
uses JwaWindows, SysUtils;
procedure main;
var
info: array of IP_ADAPTER_INFO;
u: ULONG;
mac, ipaddr, descr, name, typ: string;
i: integer;
numinterfaces: dword;
begin
GetNumberOfInterfaces(numinterfaces);
setlength(info, numinterfaces);
u := sizeof(IP_ADAPTER_INFO)*numinterfaces;
GetAdaptersInfo(@info[0], u);
for i := 0 to numinterfaces-1 do begin
if info[i].Type_ = 0 then continue;
mac := Format('%.2x:%.2x:%.2x:%.2x:%.2x:%.2x', [
info[i].Address[0], info[i].Address[1],
info[i].Address[2], info[i].Address[3],
info[i].Address[4], info[i].Address[5]
]);
ipaddr := pchar(info[i].IpAddressList.IpAddress.S);
descr := pchar(info[i].Description);
name := pchar(info[i].AdapterName);
case info[i].Type_ of
MIB_IF_TYPE_OTHER: typ := 'OTHER';
MIB_IF_TYPE_ETHERNET: typ := 'ETHERNET';
MIB_IF_TYPE_PPP: typ := 'PPP';
MIB_IF_TYPE_LOOPBACK: typ := 'LOOPBACK';
IF_TYPE_IEEE80211: typ := 'WiFi';
IF_TYPE_PROP_VIRTUAL: typ := 'VIRTUAL';
else typ := '<'+inttostr(info[i].Type_)+'>'; end;
writeln(ipaddr, ' | ', mac, ' | ', name, ' | ', descr, ' | ', typ);
end;
readln;
end;
begin
main;
end.