static extern bool SetupApi_ReadProperty( ref SetupApiDeviceEnumerator enumerator, DeviceRegistryCode property, out RegistryDataType propertyRegDataType, byte[] propertyBuffer, int propertyBufferSize, out uint requiredSize);
static object ParseRegistryValue(byte[] buffer, RegistryDataType type) { switch (type) { case RegistryDataType.REG_BINARY: return(buffer); case RegistryDataType.REG_DWORD: return(BitConverter.ToUInt32(buffer, 0)); case RegistryDataType.REG_MULTI_SZ: var str = Encoding.UTF8.GetString(buffer); return(str.Split(new[] { '\0' }, StringSplitOptions.RemoveEmptyEntries)); case RegistryDataType.REG_NONE: case RegistryDataType.REG_SZ: default: return(Encoding.Unicode.GetString(buffer).TrimEnd('\0')); } }
private static extern bool SetupDiGetDeviceRegistryProperty( IntPtr deviceInfoSet, ref Hardware.SP_DEVINFO_DATA deviceInfoData, Device.RegistryProperty property, out RegistryDataType propertyRegDataType, IntPtr propertyBuffer, uint propertyBufferSize, out UInt32 requiredSize );
/// <see cref="RegistryEntry.ValueType"/> public Builder ValueType(RegistryDataType valueType) { _entry.ValueType = valueType; return(this); }