[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
struct WLAN_AVAILABLE_NETWORK_LIST
{
internal uint dwNumberOfItems;
internal uint dwIndex;
internal WLAN_AVAILABLE_NETWORK[] wlanAvailableNetwork;
internal WLAN_AVAILABLE_NETWORK_LIST(IntPtr ppAvailableNetworkList)
{
dwNumberOfItems = (uint)Marshal.ReadInt32(ppAvailableNetworkList);
dwIndex = (uint)Marshal.ReadInt32(ppAvailableNetworkList, 4);
wlanAvailableNetwork = new WLAN_AVAILABLE_NETWORK[dwNumberOfItems];
for (int i = 0; i < dwNumberOfItems; i++)
{
IntPtr pWlanAvailableNetwork = new IntPtr(ppAvailableNetworkList.ToInt32() + i * Marshal.SizeOf(typeof(WLAN_AVAILABLE_NETWORK)) + 8);
wlanAvailableNetwork[i] = (WLAN_AVAILABLE_NETWORK)Marshal.PtrToStructure(pWlanAvailableNetwork, typeof(WLAN_AVAILABLE_NETWORK));
}
}
}
<StructLayout(LayoutKind.Sequential, CharSet := CharSet.Unicode)> _
Friend Structure WLAN_AVAILABLE_NETWORK_LIST
Friend dwNumberOfItems As UInteger
Friend dwIndex As UInteger
Friend wlanAvailableNetwork() As WLAN_AVAILABLE_NETWORK
Friend Sub New(ByVal ppAvailableNetworkList As IntPtr)
dwNumberOfItems = CUInt(Marshal.ReadInt32(ppAvailableNetworkList))
dwIndex = CUInt(Marshal.ReadInt32(ppAvailableNetworkList, 4))
wlanAvailableNetwork = New WLAN_AVAILABLE_NETWORK(dwNumberOfItems - 1){}
For i As Integer = 0 To dwNumberOfItems - 1
Dim pWlanAvailableNetwork As New IntPtr(ppAvailableNetworkList.ToInt32() + i * Marshal.SizeOf(GetType(WLAN_AVAILABLE_NETWORK)) + 8)
wlanAvailableNetwork(i) = CType(Marshal.PtrToStructure(pWlanAvailableNetwork, GetType(WLAN_AVAILABLE_NETWORK)), WLAN_AVAILABLE_NETWORK)
Next i
End Sub
End Structure
None.