WLAN_RADIO_STATE (wlanapi)
Last changed: Richard von Mallesch-124.171.28.244

.
Summary
TODO - a short description

C# Signature:

private struct WLAN_RADIO_STATE

{

    public UInt32 dwNumberOfPhys;

    public WLAN_PHY_RADIO_STATE[] PhyRadioState;
    public WLAN_RADIO_STATE(IntPtr ppData)
    {
        // The first 4 bytes are the number of WLAN_PHY_RADIO_STATE structures.
        dwNumberOfPhys = Marshal.ReadInt32(ppData, 0);

        // Construct the array of WLAN_PHY_RADIO_STATE structures.
        PhyRadioState = new WLAN_PHY_RADIO_STATE[dwNumberOfPhys];

        for (int i = 0; i <= dwNumberOfPhys - 1; i++) {
            // The offset of the array of structures is 4 bytes past the beginning.
            // Then, take the index and multiply it by the number of bytes in the
            // structure. The length of the WLAN_PHY_RADIO_STATE structure is 12 bytes
            IntPtr pPhyList = new IntPtr(ppData.ToInt64() + (i * 12) + 4);

            // Construct the WLAN_PHY_RADIO_STATE structure, marshal the unmanaged
            // structure into it, then copy it to the array of structures.
            PhyRadioState[i] = (WLAN_PHY_RADIO_STATE)Marshal.PtrToStructure(pPhyList, typeof(WLAN_PHY_RADIO_STATE));
        }
    }

}

VB Signature:

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _

    Private Structure WLAN_RADIO_STATE
    Public dwNumberOfPhys As UInt32
    Public PhyRadioState As WLAN_PHY_RADIO_STATE()

    Public Sub New(ppData As IntPtr)
        ' The first 4 bytes are the number of WLAN_PHY_RADIO_STATE structures.
        dwNumberOfPhys = Marshal.ReadInt32(ppData, 0)

        ' Construct the array of WLAN_PHY_RADIO_STATE structures.
        PhyRadioState = New WLAN_PHY_RADIO_STATE(dwNumberOfPhys - 1) {}

        For i As Integer = 0 To dwNumberOfPhys - 1
        ' The offset of the array of structures is 4 bytes past the beginning.
        ' Then, take the index and multiply it by the number of bytes in the
        ' structure. The length of the WLAN_PHY_RADIO_STATE structure is 12 bytes
        Dim pPhyList As New IntPtr(ppData.ToInt64() + (i * 12) + 4)

        ' Construct the WLAN_PHY_RADIO_STATE structure, marshal the unmanaged
        ' structure into it, then copy it to the array of structures.
        PhyRadioState(i) = DirectCast(Marshal.PtrToStructure(pPhyList, GetType(WLAN_PHY_RADIO_STATE)), WLAN_PHY_RADIO_STATE)
        Next
    End Sub
    End Structure

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation