Ejemplo n.º 1
0
        /* get vid and pid */
        private static void GetVidPid(IntPtr handle, out short Vid, out short Pid)
        {
            /* attributes structure */
            var attr = new Native.HiddAttributtes();

            /* set size */
            attr.Size = Marshal.SizeOf(attr);
            try
            {
                /* get attributes */
                if (Native.HidD_GetAttributes(handle, ref attr) == false)
                {
                    /* fail! */
                    throw new Win32Exception();
                }

                /* update vid and pid */
                Vid = attr.VendorID; Pid = attr.ProductID;
            }
            catch (Exception ex)
            {
                Vid = 0;
                Pid = 0;
            }
        }
Ejemplo n.º 2
0
        /* get vid and pid */
        private static void GetVidPid(IntPtr handle, out short Vid, out short Pid)
        {
            /* attributes structure */
            var attr = new Native.HiddAttributtes();
            /* set size */
            attr.Size = Marshal.SizeOf(attr);

            /* get attributes */
            if (Native.HidD_GetAttributes(handle, ref attr) == false) {
                /* fail! */
                throw new Win32Exception();
            }

            /* update vid and pid */
            Vid = attr.VendorID; Pid = attr.ProductID;
        }