WLAN_INTERFACE_INFO_LIST (Structures)
Last changed: -82.69.30.236

.
Summary
Contains an array of NIC information

C# Definition:

        [StructLayout(LayoutKind.Sequential)]
        public struct WLAN_INTERFACE_INFO_LIST
        {
        public Int32 dwNumberOfItems;
        public Int32 dwIndex;
        public WLAN_INTERFACE_INFO[] InterfaceInfo;

        /// <summary>
        /// Constructor for WLAN_INTERFACE_INFO_LIST.
        /// Constructor is needed because the InterfaceInfo member varies based on how many adapters are in the system.
        /// </summary>
        /// <param name="pList">the unmanaged pointer containing the list.</param>
        public WLAN_INTERFACE_INFO_LIST(IntPtr pList)
        {
            // The first 4 bytes are the number of WLAN_INTERFACE_INFO structures.
            dwNumberOfItems = Marshal.ReadInt32(pList, 0);

            // The next 4 bytes are the index of the current item in the unmanaged API.
            dwIndex = Marshal.ReadInt32(pList, 4);

            // Construct the array of WLAN_INTERFACE_INFO structures.
            InterfaceInfo = new WLAN_INTERFACE_INFO[dwNumberOfItems];

            for (int i = 0; i < dwNumberOfItems; i++)
            {
            // The offset of the array of structures is 8 bytes past the beginning. Then, take the index and multiply it by the number of bytes in the structure.
            // the length of the WLAN_INTERFACE_INFO structure is 532 bytes - this was determined by doing a sizeof(WLAN_INTERFACE_INFO) in an unmanaged C++ app.
            IntPtr pItemList = new IntPtr(pList.ToInt32() + (i * 532) + 8);

            // Construct the WLAN_INTERFACE_INFO structure, marshal the unmanaged structure into it, then copy it to the array of structures.
            WLAN_INTERFACE_INFO wii = new WLAN_INTERFACE_INFO();
            wii = (WLAN_INTERFACE_INFO)Marshal.PtrToStructure(pItemList, typeof(WLAN_INTERFACE_INFO));
            InterfaceInfo[i] = wii;
            }
        }
        }

VB Definition:

     <StructLayout(LayoutKind.Sequential)> _
     Public Structure WLAN_INTERFACE_INFO_LIST
     Public dwNumberOfItems As Int32
     Public dwIndex As Int32
     Public InterfaceInfo As WLAN_INTERFACE_INFO()

     ''' <summary>
     ''' Constructor for WLAN_INTERFACE_INFO_LIST.
     ''' Constructor is needed because the InterfaceInfo member varies based on how many adapters are in the system.
     ''' </summary>
     ''' <param name="pList">the unmanaged pointer containing the list.</param>
     Public Sub New(ByVal pList As IntPtr)
         ' The first 4 bytes are the number of WLAN_INTERFACE_INFO structures.
         dwNumberOfItems = Marshal.ReadInt32(pList, 0)

         ' The next 4 bytes are the index of the current item in the unmanaged API.
         dwIndex = Marshal.ReadInt32(pList, 4)

         ' Construct the array of WLAN_INTERFACE_INFO structures.
         InterfaceInfo = New WLAN_INTERFACE_INFO(dwNumberOfItems - 1) {}

         For i As Integer = 0 To dwNumberOfItems - 1
         ' The offset of the array of structures is 8 bytes past the beginning. Then, take the index and multiply it by the number of bytes in the structure.
         ' the length of the WLAN_INTERFACE_INFO structure is 532 bytes - this was determined by doing a sizeof(WLAN_INTERFACE_INFO) in an unmanaged C++ app.
         Dim pItemList As New IntPtr(pList.ToInt32() + (i * 532) + 8)

         ' Construct the WLAN_INTERFACE_INFO structure, marshal the unmanaged structure into it, then copy it to the array of structures.
         Dim wii As New WLAN_INTERFACE_INFO()
         wii = DirectCast(Marshal.PtrToStructure(pItemList, GetType(WLAN_INTERFACE_INFO)), WLAN_INTERFACE_INFO)
         InterfaceInfo(i) = wii
         Next
     End Sub
     End Structure

User-Defined Field Types:

WLAN_INTERFACE_INFO

Notes:

None.

Documentation