GetAdaptersInfo
(Engine-Level Function)
Info |
Optional. A variable that will be assigned a dictionary describing the current networking configuration of the local computer. |
Comments: |
The dictionary maintained in variable Info, has 3 members. Each of the members holds an array of equal size, with one element per network interface. "InterfaceID" Holds the interface ID number that Windows has assigned to the network interface. "Name" Holds the textual name of the interface. "UniqueID" Holds a UUID assigned to the interface by Windows. "Addresses" Holds an array of IP address structures, one element for each IP address configured on the interface. Each structure has the following members: "Address" - a buffer holding the configured binary address. Note that IPv4 addresses are held in IPv4-mapped IPv6 address format. "Mask" - a buffer holding the configured binary mask for "Address" (IPv4 only). The binary address buffers can be used as input to IP Mask statements, such as IPMaskToText. |
Example:
If GetAdaptersInfo(AdaptersInfo); [ InterfaceInfo = ""; { All the members of AdaptersInfo contain parallel arrays } I = 0; WhileLoop(I < ArraySize(AdaptersInfo["UniqueID"]), InterfaceInfo = Concat(InterfaceInfo, "ID: ", AdaptersInfo["InterfaceID"][I], " Name: ", AdaptersInfo["Name"][I], " UniqueID: ", AdaptersInfo["UniqueID"][I]); { The Addresses member's array elements contain an array of IP address structures. Remember you can have multiple addresses per adapter. } IPAddresses = AdaptersInfo["Addresses"][I]; IfThen(ArraySize(IPAddresses) > 0, InterfaceInfo = Concat(InterfaceInfo, "Addresses:"); J = 0; WhileLoop(J < ArraySize(IPAddresses), InterfaceInfo = Concat(InterfaceInfo, " ", IPMaskToText(Concat(IPAddresses[J]\Address, MakeBuff(16, 0xFF))), " : ", IPMaskToText(Concat(IPAddresses[J]\Mask, MakeBuff(16, 0xFF)))); J++; ); ); I++; ); ]
This will set InterfaceInfo to a string describing each network interface in turn.