首页 > 编程语言 >C#获得WIFI的相关信息

C#获得WIFI的相关信息

时间:2023-01-22 21:55:39浏览次数:54  
标签:IntPtr WLAN DOT11 C# WIFI 信息 uint INTERFACE public

public class wifi
        {
            /// <summary>
            /// 打开一个wifi句柄
            /// </summary>
            /// <param name="dwClientVersion">版本号</param>
            /// <param name="pReserved">保留</param>
            /// <param name="pdwNegotiatedVersion">支持的最高版本(输出)</param>
            /// <param name="ClientHandle">句柄(要得到的)以后的句柄一般都是这个</param>
            /// <returns></returns>
            [DllImport("Wlanapi", EntryPoint = "WlanOpenHandle")]
            public static extern uint WlanOpenHandle(uint dwClientVersion, IntPtr pReserved, [Out] out uint pdwNegotiatedVersion, ref IntPtr ClientHandle);
            /// <summary>
            /// 关闭打开的句柄
            /// </summary>
            /// <param name="hClientHandle">句柄</param>
            /// <param name="pReserved">保留</param>
            /// <returns></returns>
            [DllImport("Wlanapi", EntryPoint = "WlanCloseHandle")]
            public static extern uint WlanCloseHandle([In] IntPtr hClientHandle, IntPtr pReserved);
            /// <summary>
            /// 列举无线网络适配器
            /// </summary>
            /// <param name="hClientHandle">句柄</param>
            /// <param name="pReserved">保留</param>
            /// <param name="ppInterfaceList">数据指针(非托管)</param>
            /// <returns></returns>
            [DllImport("Wlanapi", EntryPoint = "WlanEnumInterfaces")]
            public static extern uint WlanEnumInterfaces([In] IntPtr hClientHandle, IntPtr pReserved, ref IntPtr ppInterfaceList);
            /// <summary>
            /// 释放内存
            /// </summary>
            /// <param name="pMemory">要释放的内存起始地址</param>
            [DllImport("Wlanapi", EntryPoint = "WlanFreeMemory")]
            public static extern void WlanFreeMemory([In] IntPtr pMemory);
            /// <summary>
            /// 获得可见的无线网络
            /// </summary>
            /// <param name="hClientHandle">句柄</param>
            /// <param name="pInterfaceGuid">适配器的guid号</param>
            /// <param name="dwFlags">标志位</param>
            /// <param name="pReserved">保留</param>
            /// <param name="ppAvailableNetworkList">无线网络的内存起始地址(非托管)</param>
            /// <returns></returns>
            [DllImport("Wlanapi", EntryPoint = "WlanGetAvailableNetworkList")]
            public static extern uint WlanGetAvailableNetworkList(IntPtr hClientHandle, ref Guid pInterfaceGuid, uint dwFlags, IntPtr pReserved, ref IntPtr ppAvailableNetworkList);
            /// <summary>
            /// 网络适配器的状态
            /// </summary>
            public enum WLAN_INTERFACE_STATE
            {
                WLAN_INTERFACE_STATE_NOT_READY = 0,
                WLAN_INTERFACE_STATE_CONNECTED = 1,
                WLAN_INTERFACE_STATE_AD_HOC_NETWORK_FORMED = 2,
                WLAN_INTERFACE_STATE_DISCONNECTING = 3,
                WLAN_INTERFACE_STATE_DISCONNECTED = 4,
                WLAN_INTERFACE_STATE_ASSOCIATING = 5,
                WLAN_INTERFACE_STATE_DISCOVERING = 6,
                WLAN_INTERFACE_STATE_AUTHENTICATING = 7
            }
            /// <summary>
            /// 一个适配器的信息
            /// </summary>
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
            public struct WLAN_INTERFACE_INFO
            {
                ///GUID->_GUID
                public Guid InterfaceGuid;//Guid自动生成代码
                ///WCHAR[256]
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
                public string strInterfaceDescription;
                ///WLAN_INTERFACE_STATE
                public WLAN_INTERFACE_STATE isState;
            }
            /// <summary>
            /// 包含所有适配器
            /// </summary>
            [StructLayout(LayoutKind.Sequential)]
            public struct WLAN_INTERFACE_INFO_LIST //struct结构
            {
                public Int32 dwNumberOfItems;
                public Int32 dwIndex;
                public WLAN_INTERFACE_INFO[] InterfaceInfo;
                public WLAN_INTERFACE_INFO_LIST(IntPtr pList)
                {
                    dwNumberOfItems = Marshal.ReadInt32(pList, 0);
                    dwIndex = Marshal.ReadInt32(pList, 4);
                    InterfaceInfo = new WLAN_INTERFACE_INFO[dwNumberOfItems];
                    for (int i = 0; i < dwNumberOfItems; i++)
                    {
                        IntPtr pItemList = new IntPtr(pList.ToInt32() + (i * 532) + 8);
                        WLAN_INTERFACE_INFO wii = new WLAN_INTERFACE_INFO();
                        wii = (WLAN_INTERFACE_INFO)Marshal.PtrToStructure(pItemList, typeof(WLAN_INTERFACE_INFO));
                        InterfaceInfo[i] = wii;
                    }
                }
            }
            /// <summary>
            /// 服务器标志(子网络标志号)
            /// </summary>
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
            public struct DOT11_SSID
            {
                public uint uSSIDLength;
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
                public string ucSSID;
            }
            /// <summary>
            /// BSS类型
            /// </summary>
            public enum DOT11_BSS_TYPE
            {
                DOT11_BSS_TYPE_INFRASTRUCTURE = 1,
                DOT11_BSS_TYPE_INDEPENDENT = 2,
                DOT11_BSS_TYPE_ANY = 3
            }
            public enum DOT11_PHY_TYPE
            {
                DOT11_PHY_TYPE_UNKNOWN = 1,
                DOT11_PHY_TYPE_ANY,
                DOT11_PHY_TYPE_FHSS,
                DOT11_PHY_TYPE_DSSS,
                DOT11_PHY_TYPE_IRBASEHAND,
                DOT11_PHY_TYPE_OFDM,
                DOT11_PHY_TYPE_HRDSSS,
                DOT11_PHY_TYPE_ERP,
                DOT11_PHY_TYPE_HT,
                DOT11_PHY_TYPE_IHV_START,
                DOT11_PHY_TYPE_IHV_END
            }
            public enum DOT11_AUTH_ALGORITHM
            {
                DOT11_AUTH_ALGO_80211_OPEN = 1,
                DOT11_AUTH_ALGO_80211_SHARED_KEY = 2,
                DOT11_AUTH_ALGO_WPA = 3,
                DOT11_AUTH_ALGO_WPA_PSK = 4,
                DOT11_AUTH_ALGO_WPA_NONE = 5,
                DOT11_AUTH_ALOG_RSNA = 6,
                DOT11_AUTH_ALOG_RSNA_PSK = 7,
                DOT11_AUTH_ALOG_IHV_START = -2147483648,
                DOT11_AUTH_ALOG_IHV_END = -1
            }
            public enum DOT11_CIPER_ALGORITHM
            {
                DOT11_CIPER_ALGO_NONE = 0,
                DOT11_CIPER_ALGO_WEP40 = 1,
                DOT11_CIPER_ALGO_TKIP = 2,
                DOT11_CIPER_ALGO_CCMP = 4,
                DOT11_CIPER_ALGO_WEP104 = 5,
                DOT11_CIPER_ALGO_WPA_USE_GROUP = 256,
                DOT11_CIPER_ALGO_RSN_USE_GROUP = 256,
                DOT11_CIPER_ALGO_WEP = 257,
                DOT11_CIPER_ALGO_IHV_START = -2147483648,
                DOT11_CIPER_ALGO_IHV_END = -1
            }
            /// <summary>
            /// 
            /// </summary>
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
            public struct WLAN_AVAILABLE_NETWORK
            {
                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
                public string strProfileName;
                public DOT11_SSID dot11Ssid;
                public DOT11_BSS_TYPE dot11BssType;
                public uint uNumberOfBssids;
                public bool bNetworkConnectable;
                public uint wlanNotConnectableReason;
                public uint uNumberOfPhyTypes;
                [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
                public DOT11_PHY_TYPE[] dot11PhyTypes;
                public bool bMorePhyTypes;
                public uint wlanSignalQuality;
                public bool bSecurityEnabled;
                public DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm;
                public DOT11_CIPER_ALGORITHM dot11DefaultCipherAlgorithm;
                public uint dwFlags;
                public uint dwReserved;
            }
            /// <summary>
            /// 
            /// </summary>
            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
            struct WLAN_AVALABLE_NETWORK_LIST
            {
                internal uint dwNumberOfItems;
                internal uint dwIndex;
                internal WLAN_AVAILABLE_NETWORK[] wlanAvailableNetwork;
                internal WLAN_AVALABLE_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));
                    }
                }
            }
            public static void EnumerateAvailableNetwork()
            {
                uint serviceVersion = 0;
                IntPtr handle = IntPtr.Zero;
                int result;
                result = (int)WlanOpenHandle(2, IntPtr.Zero, out serviceVersion, ref handle);
                Console.WriteLine(result);
                IntPtr ppInterfaceList = IntPtr.Zero;
                WLAN_INTERFACE_INFO_LIST interfaceList;
                if (WlanEnumInterfaces(handle, IntPtr.Zero, ref ppInterfaceList) == 0)
                {
                    interfaceList = new WLAN_INTERFACE_INFO_LIST(ppInterfaceList);
                    Console.WriteLine("有{0}个无线网络适配器", interfaceList.dwNumberOfItems);
                    Console.WriteLine("Enumerating Wireless Network Adapters...");
                    for (int i = 0; i < interfaceList.dwNumberOfItems; i++)
                    {
                        Console.WriteLine("{0}", interfaceList.InterfaceInfo[i].strInterfaceDescription);
                        IntPtr ppAvailableNetworkList = new IntPtr();
                        Guid pInterfaceGuid = interfaceList.InterfaceInfo[i].InterfaceGuid;
                        WlanGetAvailableNetworkList(handle, ref pInterfaceGuid, 0x00000002, new IntPtr(), ref ppAvailableNetworkList);
                        WLAN_AVALABLE_NETWORK_LIST wlanAvailableNetworkList = new WLAN_AVALABLE_NETWORK_LIST(ppAvailableNetworkList);
                        WlanFreeMemory(ppAvailableNetworkList);
                        WlanCloseHandle(handle, IntPtr.Zero);
                        for (int j = 0; j < wlanAvailableNetworkList.dwNumberOfItems; j++)
                        {
                            WLAN_AVAILABLE_NETWORK network = wlanAvailableNetworkList.wlanAvailableNetwork[j];
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.WriteLine("Available Network:");
                            Console.WriteLine("SSID:" + network.dot11Ssid.ucSSID);
                            Console.WriteLine("StrProfile:" + network.strProfileName);
                            Console.WriteLine("Encrypted:" + network.bSecurityEnabled);
                            Console.WriteLine("Signal Strength:" + network.wlanSignalQuality);
                            Console.WriteLine("Default Authentication:" + network.dot11DefaultAuthAlgorithm.ToString());
                            Console.WriteLine("Default Cipher:" + network.dot11DefaultCipherAlgorithm.ToString());
                            Console.WriteLine("InterfaceGuid:" + pInterfaceGuid.ToString("B"));
                            Console.WriteLine();
                        }
                    }
                }
                else
                {
                    Console.WriteLine("本机没有发现有无线网络适配器");
                }
            }
        }

 

public class wifi        {            /// <summary>            /// 打开一个wifi句柄            /// </summary>            /// <param name="dwClientVersion">版本号</param>            /// <param name="pReserved">保留</param>            /// <param name="pdwNegotiatedVersion">支持的最高版本(输出)</param>            /// <param name="ClientHandle">句柄(要得到的)以后的句柄一般都是这个</param>            /// <returns></returns>            [DllImport("Wlanapi", EntryPoint = "WlanOpenHandle")]            public static extern uint WlanOpenHandle(uint dwClientVersion, IntPtr pReserved, [Out] out uint pdwNegotiatedVersion, ref IntPtr ClientHandle);            /// <summary>            /// 关闭打开的句柄            /// </summary>            /// <param name="hClientHandle">句柄</param>            /// <param name="pReserved">保留</param>            /// <returns></returns>            [DllImport("Wlanapi", EntryPoint = "WlanCloseHandle")]            public static extern uint WlanCloseHandle([In] IntPtr hClientHandle, IntPtr pReserved);            /// <summary>            /// 列举无线网络适配器            /// </summary>            /// <param name="hClientHandle">句柄</param>            /// <param name="pReserved">保留</param>            /// <param name="ppInterfaceList">数据指针(非托管)</param>            /// <returns></returns>            [DllImport("Wlanapi", EntryPoint = "WlanEnumInterfaces")]            public static extern uint WlanEnumInterfaces([In] IntPtr hClientHandle, IntPtr pReserved, ref IntPtr ppInterfaceList);            /// <summary>            /// 释放内存            /// </summary>            /// <param name="pMemory">要释放的内存起始地址</param>            [DllImport("Wlanapi", EntryPoint = "WlanFreeMemory")]            public static extern void WlanFreeMemory([In] IntPtr pMemory);            /// <summary>            /// 获得可见的无线网络            /// </summary>            /// <param name="hClientHandle">句柄</param>            /// <param name="pInterfaceGuid">适配器的guid号</param>            /// <param name="dwFlags">标志位</param>            /// <param name="pReserved">保留</param>            /// <param name="ppAvailableNetworkList">无线网络的内存起始地址(非托管)</param>            /// <returns></returns>            [DllImport("Wlanapi", EntryPoint = "WlanGetAvailableNetworkList")]            public static extern uint WlanGetAvailableNetworkList(IntPtr hClientHandle, ref Guid pInterfaceGuid, uint dwFlags, IntPtr pReserved, ref IntPtr ppAvailableNetworkList);            /// <summary>            /// 网络适配器的状态            /// </summary>            public enum WLAN_INTERFACE_STATE            {                WLAN_INTERFACE_STATE_NOT_READY = 0,                WLAN_INTERFACE_STATE_CONNECTED = 1,                WLAN_INTERFACE_STATE_AD_HOC_NETWORK_FORMED = 2,                WLAN_INTERFACE_STATE_DISCONNECTING = 3,                WLAN_INTERFACE_STATE_DISCONNECTED = 4,                WLAN_INTERFACE_STATE_ASSOCIATING = 5,                WLAN_INTERFACE_STATE_DISCOVERING = 6,                WLAN_INTERFACE_STATE_AUTHENTICATING = 7            }            /// <summary>            /// 一个适配器的信息            /// </summary>            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]            public struct WLAN_INTERFACE_INFO            {                ///GUID->_GUID                public Guid InterfaceGuid;//Guid自动生成代码                ///WCHAR[256]                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]                public string strInterfaceDescription;                ///WLAN_INTERFACE_STATE                public WLAN_INTERFACE_STATE isState;            }            /// <summary>            /// 包含所有适配器            /// </summary>            [StructLayout(LayoutKind.Sequential)]            public struct WLAN_INTERFACE_INFO_LIST //struct结构            {                public Int32 dwNumberOfItems;                public Int32 dwIndex;                public WLAN_INTERFACE_INFO[] InterfaceInfo;                public WLAN_INTERFACE_INFO_LIST(IntPtr pList)                {                    dwNumberOfItems = Marshal.ReadInt32(pList, 0);                    dwIndex = Marshal.ReadInt32(pList, 4);                    InterfaceInfo = new WLAN_INTERFACE_INFO[dwNumberOfItems];                    for (int i = 0; i < dwNumberOfItems; i++)                    {                        IntPtr pItemList = new IntPtr(pList.ToInt32() + (i * 532) + 8);                        WLAN_INTERFACE_INFO wii = new WLAN_INTERFACE_INFO();                        wii = (WLAN_INTERFACE_INFO)Marshal.PtrToStructure(pItemList, typeof(WLAN_INTERFACE_INFO));                        InterfaceInfo[i] = wii;                    }                }            }            /// <summary>            /// 服务器标志(子网络标志号)            /// </summary>            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]            public struct DOT11_SSID            {                public uint uSSIDLength;                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]                public string ucSSID;            }            /// <summary>            /// BSS类型            /// </summary>            public enum DOT11_BSS_TYPE            {                DOT11_BSS_TYPE_INFRASTRUCTURE = 1,                DOT11_BSS_TYPE_INDEPENDENT = 2,                DOT11_BSS_TYPE_ANY = 3            }            public enum DOT11_PHY_TYPE            {                DOT11_PHY_TYPE_UNKNOWN = 1,                DOT11_PHY_TYPE_ANY,                DOT11_PHY_TYPE_FHSS,                DOT11_PHY_TYPE_DSSS,                DOT11_PHY_TYPE_IRBASEHAND,                DOT11_PHY_TYPE_OFDM,                DOT11_PHY_TYPE_HRDSSS,                DOT11_PHY_TYPE_ERP,                DOT11_PHY_TYPE_HT,                DOT11_PHY_TYPE_IHV_START,                DOT11_PHY_TYPE_IHV_END            }            public enum DOT11_AUTH_ALGORITHM            {                DOT11_AUTH_ALGO_80211_OPEN = 1,                DOT11_AUTH_ALGO_80211_SHARED_KEY = 2,                DOT11_AUTH_ALGO_WPA = 3,                DOT11_AUTH_ALGO_WPA_PSK = 4,                DOT11_AUTH_ALGO_WPA_NONE = 5,                DOT11_AUTH_ALOG_RSNA = 6,                DOT11_AUTH_ALOG_RSNA_PSK = 7,                DOT11_AUTH_ALOG_IHV_START = -2147483648,                DOT11_AUTH_ALOG_IHV_END = -1            }            public enum DOT11_CIPER_ALGORITHM            {                DOT11_CIPER_ALGO_NONE = 0,                DOT11_CIPER_ALGO_WEP40 = 1,                DOT11_CIPER_ALGO_TKIP = 2,                DOT11_CIPER_ALGO_CCMP = 4,                DOT11_CIPER_ALGO_WEP104 = 5,                DOT11_CIPER_ALGO_WPA_USE_GROUP = 256,                DOT11_CIPER_ALGO_RSN_USE_GROUP = 256,                DOT11_CIPER_ALGO_WEP = 257,                DOT11_CIPER_ALGO_IHV_START = -2147483648,                DOT11_CIPER_ALGO_IHV_END = -1            }            /// <summary>            ///             /// </summary>            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]            public struct WLAN_AVAILABLE_NETWORK            {                [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]                public string strProfileName;                public DOT11_SSID dot11Ssid;                public DOT11_BSS_TYPE dot11BssType;                public uint uNumberOfBssids;                public bool bNetworkConnectable;                public uint wlanNotConnectableReason;                public uint uNumberOfPhyTypes;                [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]                public DOT11_PHY_TYPE[] dot11PhyTypes;                public bool bMorePhyTypes;                public uint wlanSignalQuality;                public bool bSecurityEnabled;                public DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm;                public DOT11_CIPER_ALGORITHM dot11DefaultCipherAlgorithm;                public uint dwFlags;                public uint dwReserved;            }            /// <summary>            ///             /// </summary>            [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]            struct WLAN_AVALABLE_NETWORK_LIST            {                internal uint dwNumberOfItems;                internal uint dwIndex;                internal WLAN_AVAILABLE_NETWORK[] wlanAvailableNetwork;                internal WLAN_AVALABLE_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));                    }                }            }            public static void EnumerateAvailableNetwork()            {                uint serviceVersion = 0;                IntPtr handle = IntPtr.Zero;                int result;                result = (int)WlanOpenHandle(2, IntPtr.Zero, out serviceVersion, ref handle);                Console.WriteLine(result);                IntPtr ppInterfaceList = IntPtr.Zero;                WLAN_INTERFACE_INFO_LIST interfaceList;                if (WlanEnumInterfaces(handle, IntPtr.Zero, ref ppInterfaceList) == 0)                {                    interfaceList = new WLAN_INTERFACE_INFO_LIST(ppInterfaceList);                    Console.WriteLine("有{0}个无线网络适配器", interfaceList.dwNumberOfItems);                    Console.WriteLine("Enumerating Wireless Network Adapters...");                    for (int i = 0; i < interfaceList.dwNumberOfItems; i++)                    {                        Console.WriteLine("{0}", interfaceList.InterfaceInfo[i].strInterfaceDescription);                        IntPtr ppAvailableNetworkList = new IntPtr();                        Guid pInterfaceGuid = interfaceList.InterfaceInfo[i].InterfaceGuid;                        WlanGetAvailableNetworkList(handle, ref pInterfaceGuid, 0x00000002, new IntPtr(), ref ppAvailableNetworkList);                        WLAN_AVALABLE_NETWORK_LIST wlanAvailableNetworkList = new WLAN_AVALABLE_NETWORK_LIST(ppAvailableNetworkList);                        WlanFreeMemory(ppAvailableNetworkList);                        WlanCloseHandle(handle, IntPtr.Zero);                        for (int j = 0; j < wlanAvailableNetworkList.dwNumberOfItems; j++)                        {                            WLAN_AVAILABLE_NETWORK network = wlanAvailableNetworkList.wlanAvailableNetwork[j];                            Console.ForegroundColor = ConsoleColor.Red;                            Console.WriteLine("Available Network:");                            Console.WriteLine("SSID:" + network.dot11Ssid.ucSSID);                            Console.WriteLine("StrProfile:" + network.strProfileName);                            Console.WriteLine("Encrypted:" + network.bSecurityEnabled);                            Console.WriteLine("Signal Strength:" + network.wlanSignalQuality);                            Console.WriteLine("Default Authentication:" + network.dot11DefaultAuthAlgorithm.ToString());                            Console.WriteLine("Default Cipher:" + network.dot11DefaultCipherAlgorithm.ToString());                            Console.WriteLine("InterfaceGuid:" + pInterfaceGuid.ToString("B"));                            Console.WriteLine();                        }                    }                }                else                {                    Console.WriteLine("本机没有发现有无线网络适配器");                }            }        }

标签:IntPtr,WLAN,DOT11,C#,WIFI,信息,uint,INTERFACE,public
From: https://www.cnblogs.com/adamgq/p/17064701.html

相关文章

  • CF471D MUH and Cube Walls
    简要题意题目传送门平面上有两堵墙\(a,b\)。长度分别为\(n,w\)。求\(a\)墙顶端有多少个区间与\(b\)墙顶端一样。\(1\len,w\le2\times10^5,1\leqa_i,b_i\l......
  • 《RPC实战与核心原理》学习笔记Day5
    06|RPC实战:剖析gRPC源码,动手实现一个完整的RPC我们通过动态代理技术,屏蔽RPC调用的细节,从而让使用者能够面向接口编程。什么是gRPC?gRPC是由Google开发并且开源的一款......
  • C语言:求大于指定整数的最接近的五个素数
      #include<stdio.h>intsx(intn){inta;for(a=2;a<n;a++)if(n%a==0)return0;return1;}voidsxa(intb){intc=1,a=b;whil......
  • typescript联合类型的类型缩减使用
    never是所有类型的子类型当我们想要一个这样一个类型时困难1因为采用索引签名要满足所有成员都必须符合字符串的索引签名所有不能采用{[index:string]:string|ag......
  • 第10章 带有依赖注入的服务配置(ASP.NET Core in Action, 2nd Edition)
    第2部分构建完整的应用程序我们在第一部分中讨论了很多内容。您看到了ASP.NETCore应用程序是如何由中间件组成的,我们主要关注RazorPages框架。您了解了如何使用Razor语......
  • C语言:统计1-10 11-20 21-30 。。。90-99的数量
      #include<stdio.h>main(){intn,a[10]={0};scanf("%d",&n);while(n>0&&n<=99){if(n>0&&n<=10)a[(n-1)/10]++;elsea......
  • 【题解】CF193D Two Segments
    题意给定一个\(1\simN\)的排列,在这个排列中选出两段互不重叠的区间,求使选出的元素排序后构成公差为1的等差数列的方案数。选出的两段区间中元素构成的集合相同时视为同一......
  • C++左值右值
    lvalue:locatorvalue翻译为左值?可定位的值rvalue:readvalue翻译为右值?可读的值似乎放在等号左边的叫左值,右边的叫右值?lvaue是指存储在内存中、有明确存储地址(可寻址......
  • UVA11022 String Factoring
    简要题意给出一个字符串\(S\),你可以进行任意次(压缩)操作,每次操作可以把字符串中连续几个相同的部分压缩成相同的一个。操作可以嵌套进行。你需要求出操作后字符串的最小长......
  • Ucore_lab4相关
    实验指导书:https://learningos.github.io/ucore_os_webdocs/lab4/lab4_3_1_lab_steps.html优秀的博客:https://kiprey.github.io/2020/08/uCore-4/内核线程管理关键结......