deviceproperty

package
v0.0.0-...-9f4f02d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseTypeMask     = 0x00000FFF // DEVPROP_MASK_TYPE
	TypeModifierMask = 0x0000F000 // DEVPROP_MASK_TYPEMOD
)

Device property type masks.

Variables

View Source
var KnownKeys = map[Key]string{
	Key{Category: winguid.New("80D81EA6-7473-4B0C-8216-EFC11A2C4C8B"), PropertyID: 2}:     "System.Devices.ModelId",
	Key{Category: winguid.New("656A3BB3-ECC0-43FD-8477-4AE0404A96CD"), PropertyID: 8194}:  "System.Devices.ModelName",
	Key{Category: winguid.New("656A3BB3-ECC0-43FD-8477-4AE0404A96CD"), PropertyID: 8195}:  "System.Devices.ModelNumber",
	Key{Category: winguid.New("656A3BB3-ECC0-43FD-8477-4AE0404A96CD"), PropertyID: 12288}: "System.Devices.FriendlyName",
	Key{Category: winguid.New("B725F130-47EF-101A-A5F1-02608C9EEBAC"), PropertyID: 10}:    "System.ItemNameDisplay",

	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 2}: "System.Devices.DevNodeStatus",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 3}: "System.Devices.ProblemCode",

	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 4}:  "System.Devices.EjectionRelations",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 5}:  "System.Devices.RemovalRelations",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 6}:  "System.Devices.PowerRelations",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 7}:  "System.Devices.BusRelations",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 8}:  "System.Devices.Parent",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 9}:  "System.Devices.Children",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 10}: "System.Devices.Siblings",
	Key{Category: winguid.New("4340A6C5-93FA-4706-972C-7B648008A5A7"), PropertyID: 11}: "System.Devices.TransportRelations",

	Key{Category: winguid.New("49CD1F76-5626-4B17-A4E8-18B4AA1A2213"), PropertyID: 7}: "System.Devices.NetworkName",
	Key{Category: winguid.New("49CD1F76-5626-4B17-A4E8-18B4AA1A2213"), PropertyID: 8}: "System.Devices.NetworkType",

	Key{Category: winguid.New("78C34FC8-104A-4ACA-9EA4-524D52996E57"), PropertyID: 39}: "System.Devices.Model",

	Key{Category: winguid.New("78C34FC8-104A-4ACA-9EA4-524D52996E57"), PropertyID: 256}: "System.Devices.InstanceId",

	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 2}:  "System.Devices.Description",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 3}:  "System.Devices.HardwareIds",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 4}:  "System.Devices.CompatibleIds",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 6}:  "System.Devices.Service",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 9}:  "System.Devices.Class",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 10}: "System.Devices.ClassGuid",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 11}: "System.Devices.Driver",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 12}: "System.Devices.ConfigFlags",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 13}: "System.Devices.Manufacturer",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 14}: "System.Devices.FriendlyName",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 15}: "System.Devices.LocationInfo",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 16}: "System.Devices.PDOName",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 17}: "System.Devices.Capabilities",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 18}: "System.Devices.UINumber",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 19}: "System.Devices.UpperFilters",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 20}: "System.Devices.LowerFilters",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 21}: "System.Devices.BusTypeGuid",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 22}: "System.Devices.LegacyBusType",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 23}: "System.Devices.BusNumber",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 24}: "System.Devices.EnumeratorName",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 25}: "System.Devices.Security",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 26}: "System.Devices.SecuritySDS",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 27}: "System.Devices.DevType",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 28}: "System.Devices.Exclusive",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 29}: "System.Devices.Characteristics",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 30}: "System.Devices.Address",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 31}: "System.Devices.UINumberDescFormat",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 32}: "System.Devices.PowerData",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 33}: "System.Devices.RemovalPolicy",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 34}: "System.Devices.RemovalPolicyDefault",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 35}: "System.Devices.RemovalPolicyOverride",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 36}: "System.Devices.InstallState",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 37}: "System.Devices.LocationPaths",
	Key{Category: winguid.New("A45C254E-DF1C-4EFD-8020-67D146A850E0"), PropertyID: 38}: "System.Devices.BaseContainerId",

	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 2}:  "System.Drivers.AssemblyDate",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 3}:  "System.Drivers.Version",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 4}:  "System.Drivers.Description",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 5}:  "System.Drivers.InfPath",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 6}:  "System.Drivers.InfSection",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 7}:  "System.Drivers.InfSectionExt",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 8}:  "System.Drivers.MatchingDeviceId",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 9}:  "System.Drivers.Provider",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 10}: "System.Drivers.PropPageProvider",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 11}: "System.Drivers.CoInstallers",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 12}: "System.Drivers.ResourcePickerTags",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 13}: "System.Drivers.ResourcePickerExceptions",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 14}: "System.Drivers.Rank",
	Key{Category: winguid.New("A8B865DD-2E3D-4094-AD97-E593A70C75D6"), PropertyID: 15}: "System.Drivers.LogoLevel",

	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 2}:  "System.Devices.NumaProximityDomain",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 3}:  "System.Devices.DHPRebalancePolicy",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 4}:  "System.Devices.NumaNode",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 5}:  "System.Devices.BusReportedDeviceDesc",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 5}:  "System.Devices.IsPresent",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 6}:  "System.Devices.HasProblem",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 7}:  "System.Devices.ConfigurationId",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 8}:  "System.Devices.ReportedDeviceIdsHash",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 9}:  "System.Devices.PhysicalDeviceLocation",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 10}: "System.Devices.BiosDeviceName",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 11}: "System.Devices.DriverProblemDesc",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 12}: "System.Devices.DebuggerSafe",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 13}: "System.Devices.PostInstallInProgress",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 14}: "System.Devices.Stack",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 15}: "System.Devices.ExtendedConfigurationIds",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 16}: "System.Devices.IsRebootRequired",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 17}: "System.Devices.FirmwareDate",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 18}: "System.Devices.FirmwareVersion",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 19}: "System.Devices.FirmwareRevision",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 20}: "System.Devices.DependencyProviders",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 21}: "System.Devices.DependencyDependents",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 22}: "System.Devices.SoftRestartSupported",
	Key{Category: winguid.New("540B947E-8B40-45BC-A8A2-6A0B894CBDA2"), PropertyID: 23}: "System.Devices.ExtendedAddress",
	Key{Category: winguid.New("83DA6326-97A6-4088-9453-A1923F573B29"), PropertyID: 6}:  "System.Devices.SessionId",

	Key{Category: winguid.New("83DA6326-97A6-4088-9453-A1923F573B29"), PropertyID: 100}: "System.Devices.InstallDate",
	Key{Category: winguid.New("83DA6326-97A6-4088-9453-A1923F573B29"), PropertyID: 101}: "System.Devices.FirstInstallDate",
	Key{Category: winguid.New("83DA6326-97A6-4088-9453-A1923F573B29"), PropertyID: 102}: "System.Devices.LastArrivalDate",
	Key{Category: winguid.New("83DA6326-97A6-4088-9453-A1923F573B29"), PropertyID: 103}: "System.Devices.LastRemovalDate",
}

KnownKeys maps well known keys to names.

Functions

This section is empty.

Types

type Key

type Key struct {
	Category   windows.GUID
	PropertyID uint32
}

Key is a device property key that identifies a particular device property.

func (Key) Name

func (k Key) Name() string

Name returns the name of the device property if it's known.

func (Key) String

func (k Key) String() string

String returns a string representation of the key.

type Property

type Property struct {
	Key
	Value
}

Property is a device property. It can safely be copied by value.

type Type

type Type uint32

Type is a device property type.

const (
	Array Type = 0x00001000 // DEVPROP_TYPEMOD_ARRAY
	List  Type = 0x00002000 // DEVPROP_TYPEMOD_LIST
)

Property type modifiers.

const (
	Empty                    Type = 0x00000000 // DEVPROP_TYPE_EMPTY
	Null                     Type = 0x00000001 // DEVPROP_TYPE_NULL
	Int8                     Type = 0x00000002 // DEVPROP_TYPE_SBYTE
	Byte                     Type = 0x00000003 // DEVPROP_TYPE_BYTE
	Int16                    Type = 0x00000004 // DEVPROP_TYPE_INT16
	Uint16                   Type = 0x00000005 // DEVPROP_TYPE_UINT16
	Int32                    Type = 0x00000006 // DEVPROP_TYPE_INT32
	Uint32                   Type = 0x00000007 // DEVPROP_TYPE_UINT32
	Int64                    Type = 0x00000008 // DEVPROP_TYPE_INT64
	Uint64                   Type = 0x00000009 // DEVPROP_TYPE_UINT64
	Float                    Type = 0x0000000A // DEVPROP_TYPE_FLOAT
	Double                   Type = 0x0000000B // DEVPROP_TYPE_DOUBLE
	Decimal                  Type = 0x0000000C // DEVPROP_TYPE_DECIMAL
	GUID                     Type = 0x0000000D // DEVPROP_TYPE_GUID
	Currency                 Type = 0x0000000E // DEVPROP_TYPE_CURRENCY
	Date                     Type = 0x0000000F // DEVPROP_TYPE_DATE
	FileTime                 Type = 0x00000010 // DEVPROP_TYPE_FILETIME
	Bool                     Type = 0x00000011 // DEVPROP_TYPE_BOOLEAN
	String                   Type = 0x00000012 // DEVPROP_TYPE_STRING
	SecurityDescriptor       Type = 0x00000013 // DEVPROP_TYPE_SECURITY_DESCRIPTOR
	SecurityDescriptorString Type = 0x00000014 // DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING
	DevicePropertyKey        Type = 0x00000015 // DEVPROP_TYPE_DEVPROPKEY
	DevicePropertyType       Type = 0x00000016 // DEVPROP_TYPE_DEVPROPTYPE
	Error                    Type = 0x00000017 // DEVPROP_TYPE_ERROR
	Status                   Type = 0x00000018 // DEVPROP_TYPE_NTSTATUS
	StringIndirect           Type = 0x00000019 // DEVPROP_TYPE_STRING_INDIRECT
)

Device property base types.

const (
	Binary     Type = Byte | Array  // DEVPROP_TYPE_BINARY
	StringList Type = String | List // DEVPROP_TYPE_STRING_LIST
)

Common property types.

func (Type) Base

func (t Type) Base() Type

Base returns the base type of t.

func (Type) DataLength

func (t Type) DataLength() int

DataLength returns the length of data required to store a value of type t.

func (Type) Modifier

func (t Type) Modifier() Type

Modifier returns the type modifier of t.

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value is a device property value. It can safely be copied by value.

func NewValue

func NewValue(t Type, data []byte) Value

NewValue returns a device property value for the given data.

func (Value) Bool

func (v Value) Bool() bool

Bool interprets v as bool.

func (Value) BoolList

func (v Value) BoolList() []bool

BoolList interprets v as []bool.

func (Value) Byte

func (v Value) Byte() byte

Byte interprets v as byte.

func (Value) Bytes

func (v Value) Bytes() []byte

Bytes returns the bytes of the value.

func (Value) Float32

func (v Value) Float32() float32

Float32 interprets v as float32.

func (Value) Float32List

func (v Value) Float32List() []float32

Float32List interprets v as float32.

func (Value) Float64

func (v Value) Float64() float64

Float64 interprets v as float64.

func (Value) Float64List

func (v Value) Float64List() []float64

Float64List interprets v as []float64.

func (Value) GUID

func (v Value) GUID() windows.GUID

GUID interprets v as windows.GUID.

func (Value) GUIDList

func (v Value) GUIDList() []windows.GUID

GUIDList interprets v as []windows.GUID.

func (Value) Int16

func (v Value) Int16() int16

Int16 interprets v as int16.

func (Value) Int16List

func (v Value) Int16List() []int16

Int16List interprets v as []int16.

func (Value) Int32

func (v Value) Int32() int32

Int32 interprets v as int32.

func (Value) Int32List

func (v Value) Int32List() []int32

Int32List interprets v as []int32.

func (Value) Int64

func (v Value) Int64() int64

Int64 interprets v as int64.

func (Value) Int64List

func (v Value) Int64List() []int64

Int64List interprets v as []int64.

func (Value) Int8

func (v Value) Int8() int8

Int8 returns v as an int8.

func (Value) Int8List

func (v Value) Int8List() []int8

Int8List interprets v as []int8.

func (Value) String

func (v Value) String() string

String returns a string representation of the value.

func (Value) Time

func (v Value) Time() time.Time

Time interprets v as time.Time.

func (Value) TimeList

func (v Value) TimeList() []time.Time

TimeList interprets v as []time.Time.

func (Value) Type

func (v Value) Type() Type

Type returns the type of the value.

func (Value) Uint16

func (v Value) Uint16() uint16

Uint16 interprets v as uint16.

func (Value) Uint16List

func (v Value) Uint16List() []uint16

Uint16List interprets v as []uint16.

func (Value) Uint32

func (v Value) Uint32() uint32

Uint32 interprets v as uint32.

func (Value) Uint32List

func (v Value) Uint32List() []uint32

Uint32List interprets v as []uint32.

func (Value) Uint64

func (v Value) Uint64() uint64

Uint64 interprets v as uint64.

func (Value) Uint64List

func (v Value) Uint64List() []uint64

Uint64List interprets v as []uint64.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL