windevice

package module
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: 22 Imported by: 0

README

windevice GoDoc

The windevice package provides access to windows device management APIs.

Documentation

Overview

Package windevice provides access to windows device management APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(id deviceid.Hardware, path, description string, flags installflag.Value) (instance deviceid.DeviceInstance, needReboot bool, err error)

Install attempts to install a device with the provided hardware identifier, setup information file and description.

func Update

func Update(id deviceid.Hardware, path string, flags installflag.Value) (needReboot bool, err error)

Update attempts to update devices matching the given hardware identifier. The provided path must point to a valid INF file.

Types

type Device

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

Device provides access to Windows device information while executing a query. It can be copied by value.

Device stores a system handle internally and shouldn't be used outside of a query callback.

func (Device) Characteristics

func (device Device) Characteristics() (uint32, error)

Characteristics returns the characteristics of the device.

func (Device) Class

func (device Device) Class() (string, error)

Class returns the class name of the device.

func (Device) ClassGUID

func (device Device) ClassGUID() (string, error)

ClassGUID returns a string representation of the globally unique identifier of the device's class.

func (Device) CompatibleID

func (device Device) CompatibleID() ([]deviceid.Compatible, error)

CompatibleID returns the set of compatible IDs associated with the device.

func (Device) ConfigFlags

func (device Device) ConfigFlags() (uint32, error)

ConfigFlags returns the configuration flags for the device.

func (Device) Description

func (device Device) Description() (string, error)

Description returns the description of the device.

func (Device) DevType

func (device Device) DevType() (uint32, error)

DevType returns the type of the device.

func (Device) DeviceInstanceID

func (device Device) DeviceInstanceID() (deviceid.DeviceInstance, error)

DeviceInstanceID returns the device instance ID of the device.

func (Device) DriverRegName

func (device Device) DriverRegName() (string, error)

DriverRegName returns the registry name of the device's driver.

func (Device) Drivers

func (device Device) Drivers(q DriverQuery) DriverSet

Drivers returns a driver set that contains drivers affiliated with the device.

func (Device) EnumeratorName

func (device Device) EnumeratorName() (string, error)

EnumeratorName returns the name of the device's enumerator.

func (Device) FriendlyName

func (device Device) FriendlyName() (string, error)

FriendlyName returns the friendly name of the device.

func (Device) HardwareID

func (device Device) HardwareID() ([]deviceid.Hardware, error)

HardwareID returns the set of hardware IDs associated with the device.

func (Device) InstallState

func (device Device) InstallState() (installstate.State, error)

InstallState returns the installation state of the device.

func (Device) InstalledDriver

func (device Device) InstalledDriver() DriverSet

InstalledDriver returns a driver set that contains the device's currently installed driver.

func (Device) LocationInformation

func (device Device) LocationInformation() (string, error)

LocationInformation returns the location information for the device.

func (Device) Manufacturer

func (device Device) Manufacturer() (string, error)

Manufacturer returns the manufacturer of the device.

func (Device) NetCfgInstance

func (device Device) NetCfgInstance() (id string, err error)

NetCfgInstance returns the NetCfgInstance of the device.

func (Device) PhysicalDeviceObjectName

func (device Device) PhysicalDeviceObjectName() (string, error)

PhysicalDeviceObjectName returns the physical object name of the device.

func (Device) Properties

func (device Device) Properties() ([]deviceproperty.Property, error)

Properties returns all of the properties of the device instance.

func (Device) Remove

func (device Device) Remove(scope hwprofile.Scope, profile hwprofile.ID) (needReboot bool, err error)

Remove removes the device.

When called with a global scope, all hardware profiles will be affected.

When called with a config-specific scope, only the given hardware profile will be affected.

A hardware profile of zero indicates the current hardware profile.

func (Device) Service

func (device Device) Service() (string, error)

Service returns the service for the device.

func (Device) Sys

func (device Device) Sys() (devices syscall.Handle, data setupapi.DevInfoData)

Sys returns low-level information about the device.

type DeviceActor

type DeviceActor func(Device)

DeviceActor is a function that can take action on a device.

type DeviceQuery

type DeviceQuery struct {
	Class      windows.GUID
	Enumerator string
	Flags      uint32
	Machine    string // TODO: Consider removing this if it's not well supported
	Selector   DeviceSelector
}

DeviceQuery holds device query information. Its zero value is a valid query for all devices.

func (DeviceQuery) Count

func (q DeviceQuery) Count() (int, error)

Count returns the number of devices matching the query.

func (DeviceQuery) Each

func (q DeviceQuery) Each(action DeviceActor) error

Each performs an action on each device that matches the query.

type DeviceSelector

type DeviceSelector interface {
	Select(Device) (bool, error)
}

DeviceSelector is an interface capable of selecting devices in a device list.

type Driver

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

Driver provides access to Windows driver information while executing a query. It can be copied by value.

Driver stores a system handle internally and shouldn't be used outside of a query callback.

func (Driver) Date

func (driver Driver) Date() time.Time

Date returns the release date of the driver.

func (Driver) Description

func (driver Driver) Description() string

Description returns the description of the driver.

func (Driver) ManufacturerName

func (driver Driver) ManufacturerName() string

ManufacturerName returns the name of the driver's manufacturer.

func (Driver) ProviderName

func (driver Driver) ProviderName() string

ProviderName returns the name of the driver provider.

func (Driver) Sys

func (driver Driver) Sys() (devices syscall.Handle, device setupapi.DevInfoData, data setupapi.DrvInfoData)

Sys returns low-level information about the driver.

func (Driver) Version

func (driver Driver) Version() driverversion.Value

Version returns the version of the driver.

type DriverActor

type DriverActor func(Driver)

DriverActor is a function that can take action on a driver.

type DriverQuery

type DriverQuery struct {
	Type    drivertype.Value
	FlagsEx diflagex.Value
}

DriverQuery holds driver query information. Its zero value is not a valid query.

For the query to be valid, its type must specify either drivertype.ClassDriver or drivertype.CompatDriver.

type DriverSet

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

DriverSet accesses driver information while executing a device query. It can be copied by value.

DriverSet stores a system handle internally and shouldn't be used outside of a device query callback.

func (DriverSet) Count

func (ds DriverSet) Count() (int, error)

Count returns the number of devices in the set.

func (DriverSet) Each

func (ds DriverSet) Each(action DriverActor) error

Each performs an action on each driver in the driver set.

type NamedClass

type NamedClass struct {
	Name    string
	Members []windows.GUID
}

NamedClass is a named device class.

func NewNamedClass

func NewNamedClass(name string) (NamedClass, error)

NewNamedClass returns a NamedClass entry for the given class name.

type StringMatcher

type StringMatcher interface {
	Match(string) bool
}

StringMatcher is an interface capable of matching strings.

Directories

Path Synopsis
cmd
Package deviceid defines various kinds of device identification strings used by the windows device and driver system.
Package deviceid defines various kinds of device identification strings used by the windows device and driver system.
Package strmatch performs string matching.
Package strmatch performs string matching.

Jump to

Keyboard shortcuts

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