2014年1月12日 星期日

從 PID/VID 換算出 GUID 值

public string GetGUID(string VendorID, string ProductID)
        {
            string m_GUID = "";
            ManagementObjectCollection USBControllerDeviceCollection = new ManagementObjectSearcher("SELECT * FROM Win32_USBControllerDevice").Get();
            if (USBControllerDeviceCollection != null)
            {
                foreach (ManagementObject USBControllerDevice in USBControllerDeviceCollection)
                {
                  String Dependent = (USBControllerDevice["Dependent"] as String).Split(new Char[] { '=' })[1];
                    if (Dependent.IndexOf(VendorID) >= 0 && Dependent.IndexOf(ProductID) >= 0)
                    {
                        ManagementObjectCollection PnPEntityCollection = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE DeviceID=" + Dependent).Get();
                        if (PnPEntityCollection != null)
                        {
                            foreach (ManagementObject Entity in PnPEntityCollection)
                            {
                                Guid theClassGuid = new Guid(Entity["ClassGuid"] as String);    // ????GUID 
                                m_GUID = theClassGuid.ToString();
                                return m_GUID;
                            }
                          }
                    }
                }
            }

            return m_GUID;
}

沒有留言:

Iperf3.1.3 使用方法

20190417: 使用 Iperf3.1.3 • Server : Iperf 3 - s - w 1024k • Client: Iperf 3 - c 192.168.1.10 -R -w 1024k  -i 1 -t 10  -P 6 //-c: TCP client /...