/// <summary>
 ///
 /// </summary>
 /// <param name="deviceInfo"></param>
 /// <param name="propertyType"></param>
 /// <param name="buffer"></param>
 /// <returns></returns>
 protected abstract bool LoadValue(DeviceInfo deviceInfo, out TPropertyType propertyType, out Api.Buffer buffer);
Пример #2
0
        protected override bool LoadValue(DeviceInfo deviceInfo, out DeviceRegistryPropertyType propertyType, out Api.Buffer buffer)
        {
            if (!SetupDi.GetDeviceRegistryProperty(deviceInfo, Key, out propertyType, out buffer))
            {
                // Only "not found" errors are valid failures.
                var lastError = ErrorHelpers.GetLastError();
                if (lastError == ErrorCode.NotFound)
                {
                    return(false);
                }

                // Everything else is an unexpected failure.
                throw new DeviceManagerWindowsException("Unable to query device registry property.");
            }

            return(true);
        }