private Wlan.WlanBssEntryN[] ConvertBssListPtr(IntPtr bssListPtr) { Wlan.WlanBssListHeader header = (Wlan.WlanBssListHeader)Marshal.PtrToStructure(bssListPtr, typeof(Wlan.WlanBssListHeader)); long num = bssListPtr.ToInt64() + Marshal.SizeOf(typeof(Wlan.WlanBssListHeader)); Wlan.WlanBssEntryN[] entryArray = new Wlan.WlanBssEntryN[header.numberOfItems]; for (int i = 0; i < header.numberOfItems; i++) { entryArray[i] = new Wlan.WlanBssEntryN((Wlan.WlanBssEntry)Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanBssEntry))); int size = (int)entryArray[i].BaseEntry.ieSize; entryArray[i].IEs = new byte[size]; Marshal.Copy(new IntPtr(num + entryArray[i].BaseEntry.ieOffset), entryArray[i].IEs, 0, size); num += Marshal.SizeOf(typeof(Wlan.WlanBssEntry)); } return(entryArray); }
private Wlan.WlanBssEntryN[] ConvertBssListPtr(IntPtr bssListPtr) { Wlan.WlanBssListHeader header = (Wlan.WlanBssListHeader) Marshal.PtrToStructure(bssListPtr, typeof(Wlan.WlanBssListHeader)); long num = bssListPtr.ToInt64() + Marshal.SizeOf(typeof(Wlan.WlanBssListHeader)); Wlan.WlanBssEntryN[] entryArray = new Wlan.WlanBssEntryN[header.numberOfItems]; for (int i = 0; i < header.numberOfItems; i++) { entryArray[i] = new Wlan.WlanBssEntryN((Wlan.WlanBssEntry)Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanBssEntry))); int size = (int)entryArray[i].BaseEntry.ieSize; byte[] IEs = new byte[size]; Marshal.Copy(new IntPtr(num + entryArray[i].BaseEntry.ieOffset), IEs, 0, size); //Parse 802.11n IEs if avalible entryArray[i].NSettings = IeParser.Parse(IEs); //===DEBUGGING=== //string ssid = Encoding.ASCII.GetString(entryArray[i].entry.dot11Ssid.SSID); //System.IO.File.WriteAllBytes("data" + ssid.Trim("\0".ToCharArray()) + ".dat", IEs); //Console.WriteLine(IEs.Length); //Test t = (Test)Marshal.PtrToStructure(new IntPtr(num), typeof(Test)); //===END DEBUGGING=== num += Marshal.SizeOf(typeof(Wlan.WlanBssEntry)); } return entryArray; }
private Wlan.WlanBssEntryN[] ConvertBssListPtr(IntPtr bssListPtr) { Wlan.WlanBssListHeader header = (Wlan.WlanBssListHeader)Marshal.PtrToStructure(bssListPtr, typeof(Wlan.WlanBssListHeader)); long num = bssListPtr.ToInt64() + Marshal.SizeOf(typeof(Wlan.WlanBssListHeader)); Wlan.WlanBssEntryN[] entryArray = new Wlan.WlanBssEntryN[header.numberOfItems]; for (int i = 0; i < header.numberOfItems; i++) { entryArray[i] = new Wlan.WlanBssEntryN((Wlan.WlanBssEntry)Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanBssEntry))); int size = (int)entryArray[i].BaseEntry.ieSize; byte[] IEs = new byte[size]; Marshal.Copy(new IntPtr(num + entryArray[i].BaseEntry.ieOffset), IEs, 0, size); //IEs = System.IO.File.ReadAllBytes("ies.dat"); // Add IEs to entry entryArray[i].IEs = IEs; //Parse 802.11n IEs if avalible entryArray[i].NSettings = IeParser.Parse(IEs); //System.Diagnostics.Debug.WriteLine( // string.Format("Privacy: {1} {0}", // GetPrivacyString(IEs), // System.Text.Encoding.ASCII.GetString(entryArray[i].BaseEntry.dot11Ssid.SSID,0, // (int)entryArray[i].BaseEntry.dot11Ssid.SSIDLength))); //===DEBUGGING=== //BitConverter.ToString(entryArray[i].BaseEntry.dot11Bssid); //string ssid = Encoding.ASCII.GetString(entryArray[i].BaseEntry.dot11Ssid.SSID); //string mac = BitConverter.ToString(entryArray[i].BaseEntry.dot11Bssid); //System.IO.File.WriteAllBytes("data" + mac.Trim("\0".ToCharArray()) + ".dat", IEs); //Console.WriteLine(IEs.Length); //Test t = (Test)Marshal.PtrToStructure(new IntPtr(num), typeof(Test)); //===END DEBUGGING=== num += Marshal.SizeOf(typeof(Wlan.WlanBssEntry)); } return entryArray; }
private Wlan.WlanBssEntryN[] ConvertBssListPtr(IntPtr bssListPtr) { Wlan.WlanBssListHeader header = (Wlan.WlanBssListHeader)Marshal.PtrToStructure(bssListPtr, typeof(Wlan.WlanBssListHeader)); long num = bssListPtr.ToInt64() + Marshal.SizeOf(typeof(Wlan.WlanBssListHeader)); Wlan.WlanBssEntryN[] entryArray = new Wlan.WlanBssEntryN[header.numberOfItems]; for (int i = 0; i < header.numberOfItems; i++) { entryArray[i] = new Wlan.WlanBssEntryN((Wlan.WlanBssEntry)Marshal.PtrToStructure(new IntPtr(num), typeof(Wlan.WlanBssEntry))); int size = (int)entryArray[i].BaseEntry.ieSize; entryArray[i].IEs = new byte[size]; Marshal.Copy(new IntPtr(num + entryArray[i].BaseEntry.ieOffset), entryArray[i].IEs, 0, size); num += Marshal.SizeOf(typeof(Wlan.WlanBssEntry)); } return entryArray; }