예제 #1
0
        //Custom Jerker Dahlblom..
        private static string GetDeviceInstanceId(IntPtr deviceInfoSet)
        {
            //var descriptionBuffer = new byte[1024];
            const int bufferSize = 1024;
            //var requiredSize = 0;
            //var type = 0;

            var ptrInstanceBuf = Marshal.AllocHGlobal(bufferSize);

            NativeMethods.CM_Get_Device_ID(deviceInfoSet, ptrInstanceBuf, bufferSize, 0);
            var instanceId = Marshal.PtrToStringAuto(ptrInstanceBuf);


            return(instanceId);
        }