devcon

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 7 Imported by: 0

README

go-devcon

Go Reference

Go wrapper around the Windows Device Console (devcon.exe).

go install github.com/mikerourke/go-devcon

Introduction

Here's a brief overview of DevCon taken from the Windows Hardware Developer documentation site:

DevCon (Devcon.exe), the Device Console, is a command-line tool that displays detailed information about devices on computers running Windows. You can use DevCon to enable, disable, install, configure, and remove devices.

DevCon runs on Microsoft Windows 2000 and later versions of Windows.

This package provides a handy mechanism for querying devices and performing various operations on said devices. It provides methods that map directly to the devcon.exe commands.

Prerequisites

You'll need the devcon.exe executable. It's not included in the package because Redistribution of Microsoft software without consent is usually a violation of Microsoft's End User License Agreements.

For information regarding how to get your hands on devcon.exe, check out the Microsoft documentation page.

There are other ways to get it, but you didn't hear it from me.

Usage

There is extensive documentation and examples available on the docs site, but here's a quick example of how to log all the devices on the computer:

package main

import (
	"fmt"
	
	"github.com/mikerourke/go-devcon"
)

func main() {
	dc := devcon.New(`\path\to\devcon.exe`)
	
	devs, err := dc.FindAll("=net")
	if err != nil {
		panic(err)
    }
	
	for _, dev := range devs {
		fmt.Printf("ID: %s, Name: %s\n", dev.ID, dev.Name)
    }
}

FAQ

Aren't you supposed to use the PnPUtil now?

Yes, but PnPUtil is only supported on Windows Vista and later. You can't use it on older operating systems.

Isn't this a little niche?

Yes, but one of my other projects requires me to check for the existence of a device and install a driver on Windows XP. I wrote a bunch of parsing code to get the output, so I figured why not open source it?

Will this work on Windows XP?

Yes, I'm using only using Go APIs available in version 1.10.7 (or earlier?), since executables built with that version of Go still run on Windows XP. It's possible that earlier versions may work, but I used 1.10.7 during development, so I'd advise sticking with that version. To target Windows XP 32-bit, build your project like so:

GOOS=windows GOARCH=386 go1.10.7 build -o myproject.exe myproject.go  

Documentation

Overview

Package devcon wraps the Windows Device Console (devcon.exe) utility.

The Windows Device Console is a command-line tool that displays detailed information about devices on computers running Windows. You can use DevCon to enable, disable, install, configure, and remove devices.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon for more information.

Example (Install)
dc := devcon.New(`C:\windows\devcon.exe`)

devs, err := dc.Find("*VEN_8086*")
if err != nil {
	fmt.Println(err)

	return
}

var matchingDev devcon.Device

for _, dev := range devs {
	if strings.Contains(dev.Name, "PRO") {
		matchingDev = dev
		break
	}
}

if matchingDev.ID != "" {
	err = dc.Install(`C:\drivers\PRO1000\WIN32\E1000325.INF`, matchingDev.ID)
	if err != nil {
		fmt.Printf("error installing: %s", err)
	} else {
		fmt.Println("Successfully installed")

	}
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClassFilterChangeResult

type ClassFilterChangeResult struct {
	// Filters is a slice of the filters that were either changed or queried.
	Filters []string

	// RequiresReboot indicates that a reboot is required as a result of the
	// change.
	RequiresReboot bool

	// WasChanged indicates if the filter were changed or just queried.
	WasChanged bool
}

ClassFilterChangeResult is returned from the ClassFilter method and contains details regarding the result of the operation.

type ClassFilterType

type ClassFilterType string

ClassFilterType is used to indicate the filter option for setup classes.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/device-filter-driver-ordering for more information.

const (
	// ClassFilterUpper represent the upper-level filter drivers.
	ClassFilterUpper ClassFilterType = "upper"

	// ClassFilterLower represent the lower-level filter drivers.
	ClassFilterLower ClassFilterType = "lower"
)

type DevCon

type DevCon struct {
	// ExeFilePath is the path to `devcon.exe` on the computer.
	ExeFilePath string

	// IsRebooted indicates that the computer will be conditionally rebooted
	// after running a command.
	IsRebooted bool

	// RemotePath is the path to a remote computer.
	RemotePath string
}

DevCon is the main entry point for the utility. It is created with New().

func New

func New(exeFilePath string) *DevCon

New returns a new instance of DevCon that can be used to run commands and queries.

The path to `devcon.exe` must be specified because this package does not ship with a copy of the executable and versions may vary by Windows version.

func (*DevCon) ClassFilter

func (dc *DevCon) ClassFilter(
	class string,
	filter ClassFilterType,
	drivers ...string,
) (*ClassFilterChangeResult, error)

ClassFilter adds, deletes, displays, and changes the order of filter drivers for a device setup class. Omitting the drivers parameter performs a query operation that doesn't make any changes.

The class specifies the device setup class. The filter can be ClassFilterUpper to indicate that the specified drivers are upper-class filter drivers, or ClassFilterLower to indicate that the specified drivers are lower-class filter drivers.

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-classfilter for more information.

func (*DevCon) Classes

func (dc *DevCon) Classes() ([]DeviceSetupClass, error)

Classes returns all device setup classes, including classes that devices on the system do not use.

The results are returned in the order that they appear in the registry (alphanumeric order by GUID).

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-classes for more information.

func (*DevCon) DPAdd

func (dc *DevCon) DPAdd(infFilePath string) error

DPAdd adds a third-party (OEM) driver package to the driver store on the local computer. The infFilePath parameter is the fully qualified path and name of the INF file for the driver package.

DPAdd copies the specified INF file to the %windir%/Inf directory and renames it OEM*.inf. This file name is unique on the computer, and you cannot specify it.

If this INF file already exists in %windir%/Inf (as determined by comparing the binary files, not by matching the file names) and the catalog (.cat) file for the INF is identical to a catalog file in the directory, the INF file is not recopied to the %windir%/Inf directory.

Cannot be run with the WithRemoteComputer() option.

This function may not be available on older versions of Device Console.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-dp-add for more information.

func (*DevCon) DPDelete

func (dc *DevCon) DPDelete(infFileName string, force bool) error

DPDelete deletes a third-party (OEM) driver package from the driver store on the local computer. This command deletes the INF file, the PNF file, and the associated catalog file (.cat).

The infFileName represents the OEM*.inf file name of the INF file. Windows assigns a file name with this format to the INF file when you add the driver package to the driver store, such as by using DPAdd().

Specifying true for force deletes the driver package even if a device is using it at the time.

Cannot be run with the WithRemoteComputer() option.

This function may not be available on older versions of Device Console.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-dp-delete for more information.

func (*DevCon) DPEnum

func (dc *DevCon) DPEnum() ([]OEMPackage, error)

DPEnum returns the third-party (OEM) driver packages in the driver store on the local computer.

DPEnum returns the OEM*.inf files in the %windir%/Inf on the local computer. For each file, this command displays the provider, class, date, and version number from the INF file.

Cannot be run with the WithRemoteComputer() option.

This function may not be available on older versions of Device Console.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-dp-enum for more information.

func (*DevCon) Disable

func (dc *DevCon) Disable(idOrClass string, idsOrClasses ...string) error

Disable disables devices on the computer.

To disable a device means that the device remains physically connected to the computer, but its driver is unloaded from memory and its resources are freed so that the device cannot be used.

This will disable the device even if the device is already disabled. Before and after disabling a device, use Status() to verify the device status.

Before using an ID pattern to disable a device, determine which devices will be affected. To do so, pass the pattern to the Status() function:

dc.Status("USB\*")

Or with the HwIDs() function:

dc.HwIDs("USB\*")

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().Disable()

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-disable for more information.

func (*DevCon) DriverFiles

func (dc *DevCon) DriverFiles(idOrClass string, idsOrClasses ...string) ([]DriverFileGroup, error)

DriverFiles returns the full path and file name of installed INF files and device driver files for the specified devices.

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-driverfiles for more information.

func (*DevCon) DriverNodes

func (dc *DevCon) DriverNodes(idOrClass string, idsOrClasses ...string) ([]DriverNodeGroup, error)

DriverNodes returns all driver packages that are compatible with the device, along with their version and ranking.

The DriverNodes method is particularly useful for troubleshooting setup problems. For example, you can use it to determine whether a Windows INF file or a customized third-party INF file was used for a device.

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-drivernodes for more information.

func (*DevCon) Enable

func (dc *DevCon) Enable(idOrClass string, idsOrClasses ...string) error

Enable enables devices on the computer.

To enable a device means that the device driver is loaded into memory and the device is ready for use.

This will enable the device even if it is already enabled. Before and after enabling a device, use Status() to verify the device status.

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().Enable()

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-enable for more information.

func (*DevCon) Find

func (dc *DevCon) Find(idOrClass string, idsOrClasses ...string) ([]Device, error)

Find returns a slice of Device instances that are currently attached to the computer.

You can use Find to find devices that are not currently attached to the computer by specifying the full device instance ID of the device instead of a hardware ID or ID pattern. Specifying the full device instance ID overrides the restriction on the Find operation that limits it to attached devices.

Calling Find with a single class argument returns the same results as the ListClass() method.

To find all devices, including those that are not currently attached to the computer, use the FindAll() function.

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-find for more information.

func (*DevCon) FindAll

func (dc *DevCon) FindAll(idOrClass string, idsOrClasses ...string) ([]Device, error)

FindAll returns all devices on the computer, including devices that were once attached to the computer but have been detached or moved. (These are known as non-present devices or phantom devices.).

It also returns devices that are enumerated differently as a result of a BIOS change.

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-findall for more information.

func (*DevCon) HwIDs

func (dc *DevCon) HwIDs(idsOrClasses ...string) ([]HwID, error)

HwIDs returns HwID records containing the hardware IDs, compatible IDs, and device instance IDs of the specified devices. Valid on local and remote computers.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-hwids for more information.

func (*DevCon) Install

func (dc *DevCon) Install(infFilePath string, hardwareID string) error

Install creates a new, root-enumerated devnode for a non-Plug and Play device and installs its supporting software.

The infFilePath parameter is the fully qualified path and name of the INF file for the driver package.

The hardwareID specifies a hardware ID for the device. It must exactly match the hardware ID of the device. Patterns are not valid. Do not use a single quote character (') to indicate a literal value. For more information, see https://docs.microsoft.com/en-us/windows-hardware/drivers/install/hardware-ids and https://docs.microsoft.com/en-us/windows-hardware/drivers/install/device-identification-strings.

You cannot use this function for Plug and Play devices. This operation creates a new non-Plug and Play device node. Then, it uses Update to install drivers for the newly added device. If any step of the installation operation fails, returns an error and does not proceed with the driver installation.

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().Install()

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-install for more information.

func (*DevCon) ListClass

func (dc *DevCon) ListClass(classes ...string) (map[string][]Device, error)

ListClass returns all devices in the specified device setup classes in a map with the key equal to the class name and value equal to a slice of the corresponding devices.

Each entry in a setup class display represents one device. The entry consists of the unique instance name and a description of the device.

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-listclass for more information.

func (*DevCon) Reboot

func (dc *DevCon) Reboot() error

Reboot stops and then starts the operating system.

If the user has open files on the computer or a program will not close, the system does not reboot until the user has responded to system prompts to close the files or end the process.

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-reboot for more information.

func (*DevCon) Remove

func (dc *DevCon) Remove(idsOrClasses ...string) error

Remove removes the device from the device tree and deletes the device stack for the device. As a result of these actions, child devices are removed from the device tree and the drivers that support the device are unloaded.

This operation does not delete the device driver or any files installed for the device. After removing the device from the device tree, the files remain and the device is still represented internally as a non-present device that can be re-enumerated.

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().Remove()

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-remove for more information.

func (*DevCon) Rescan

func (dc *DevCon) Rescan() error

Rescan uses Windows Plug and Play features to update the device list for the computer.

Rescanning can cause the Plug and Play manager to detect new devices and to install device drivers without warning.

Rescanning can detect some non-Plug and Play devices, particularly those that cannot notify the system when they are installed, such as parallel-port devices and serial-port devices. As a result, you must have Administrator privileges to call this function.

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().Rescan()

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-rescan for more information.

func (*DevCon) Resources

func (dc *DevCon) Resources() ([]DeviceResourceUsage, error)

Resources returns the resources allocated to the specified devices. Resources are assignable and addressable bus paths, such as DMA channels, I/O ports, IRQ, and memory addresses.

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-resources for more information.

func (*DevCon) Restart

func (dc *DevCon) Restart(idOrClass string, idsOrClasses ...string) ([]DeviceRestartStatus, error)

Restart stops and restarts the specified devices.

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().Restart()

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-restart for more information.

func (*DevCon) SetHwID

func (dc *DevCon) SetHwID(idsOrClasses []string, hardwareIds []string) error

SetHwID adds, deletes, and changes the order of hardware IDs of root-enumerated devices.

A root-enumerated device is a device that appears in the ROOT registry subkey (HKEY_LOCAL_MACHINE\System\ControlSet\Enum\ROOT).

You can specify multiple hardware IDs in each command. The ! (delete) parameter applies only to the hardware ID that it prefixes. The other symbol parameters apply to all hardware IDs that follow until the next symbol parameter in the command.

SetHwID moves, rather than adds, a hardware ID if the specified hardware ID already exists in the list of hardware IDs for the device.

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-sethwid for more information.

func (*DevCon) Stack

func (dc *DevCon) Stack() ([]DriverStack, error)

Stack returns the expected driver stack for the specified devices, and the GUID and the name of the device setup class for each device. Although the actual driver stack typically matches the expected stack, variations are possible.

To investigate a device problem, compare the expected driver stack from the stack operation with the actual drivers that the device uses, as returned from DriverFiles().

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-stack for more information.

func (*DevCon) Status

func (dc *DevCon) Status() ([]DriverStatus, error)

Status returns the status (running, stopped, or disabled) of the driver for devices on the computer.

If the status of the device cannot be determined, such as when the device is no longer attached to the computer, the status from the status display.

Running with the WithRemoteComputer() option is allowed.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-status for more information.

func (*DevCon) Update

func (dc *DevCon) Update(infFile string, hardwareID string) error

Update forcibly replaces the current device drivers for a specified device with drivers listed in the specified INF file.

Update forces an update to the most appropriate drivers in the specified INF file, even if those drivers are older or less appropriate than the current drivers or the drivers in a different INF file.

You cannot use Update to update drivers for non-present devices.

Before updating the driver for any device, determine which devices will be affected. To do so, pass the name to the HwIDs() function:

dc.HwIDs("ISAPNP\CSC4324\0")

Or with the DriverFiles() function:

dc.DriverFiles("ISAPNP\CSC4324\0")

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().Update()

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-update for more information.

func (*DevCon) UpdateNI

func (dc *DevCon) UpdateNI(infFile string, hardwareID string) error

UpdateNI forcibly replaces the current device drivers with drivers listed in the specified INF file without prompting the user for information or confirmation.

This method suppresses all user prompts that require a response and assumes the default response. As a result, you cannot use this operation to install unsigned drivers. To display user prompts during an update, use Update().

This method forces an update, even if the drivers in the specified INF file are older or less appropriate than the current drivers.

Before updating the driver for any device, determine which devices will be affected. To do so, pass the name to the HwIDs() function:

dc.HwIDs("ISAPNP\CSC4324\0")

Or with the DriverFiles() function:

dc.DriverFiles("ISAPNP\CSC4324\0")

The system might need to be rebooted to make this change effective. To reboot the system if required, use:

dc.WithConditionalReboot().UpdateNI()

Cannot be run with the WithRemoteComputer() option.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-updateni for more information.

func (*DevCon) WithConditionalReboot

func (dc *DevCon) WithConditionalReboot() *DevCon

WithConditionalReboot should be set on the DevCon instance if the computer should be rebooted after running the command. If specified for a command that doesn't allow a conditional reboot, the command will not be run.

Note that the computer will only be rebooted if a reboot is required. See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-general-commands for more information.

Usage

Add to the DevCon instance before the command.

dc.WithConditionalReboot().Enable("*")

func (*DevCon) WithRemoteComputer

func (dc *DevCon) WithRemoteComputer(remotePath string) *DevCon

WithRemoteComputer should be set on the DevCon instance if the command should be run on a remote computer. If specified for a command that cannot be run on a remote computer, the command will not be run.

To call a method for a remote computer, the Group Policy setting must allow the Plug and Play service to run on the remote computer. On computers that run Windows Vista and Windows 7, the Group Policy disables remote access to the service by default. On computers that run WDK 8.1 and WDK 8, the remote access is unavailable.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon-general-commands for more information.

Usage

Add to the DevCon instance before the command.

dc.WithRemoteComputer(`\\server01`).Enable("USB\VID_0403&PID_6001\AB0K0SRH")

type Device

type Device struct {
	// ID is a string reported by a device’s enumerator. A device has only one
	// device ID. A device ID has the same format as a hardware ID.
	ID string `json:"id"`

	// Name is the name of the device.
	Name string `json:"name"`
}

Device represents a device attached to the computer.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/device-ids for more information about Device IDs.

type DeviceResourceUsage

type DeviceResourceUsage struct {
	// Device is the device associated with the resource usages.
	Device Device `json:"device"`

	// Resources are the resources currently being used by the device.
	Resources []Resource `json:"resources"`
}

DeviceResourceUsage describes the resources that a device is currently using.

type DeviceRestartStatus

type DeviceRestartStatus struct {
	// ID is the ID of the device being restarted.
	ID string `json:"id"`

	// WasRestarted indicates if the restart operation was successful.
	WasRestarted bool
}

DeviceRestartStatus indicates the restart status of a device when Restart() is called.

type DeviceSetupClass

type DeviceSetupClass struct {
	// Name is the name of the class.
	Name string `json:"name"`

	// Description is a brief description of the class.
	Description string `json:"description"`
}

DeviceSetupClass contains the name and description of a device setup class, which represent devices that are set up and configured in the same manner.

For example, SCSI media changer devices are grouped into the MediumChanger device setup class. The device setup class defines the class installer and class co-installers that are involved in installing the device.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/overview-of-device-setup-classes for more information.

type DriverFileGroup

type DriverFileGroup struct {
	// Device is the device with which the files are associated.
	Device Device `json:"device"`

	// INFFile is the driver file which is used by the device.
	INFFile string `json:"infFile"`

	// INFSection is the corresponding section of the INF file.
	// TODO: This is a bad description.
	INFSection string `json:"infSection"`

	// Files are the driver files associated with the device driver.
	Files []string `json:"files"`
}

DriverFileGroup describes the INF file and section, as well as associated files for a device.

type DriverNode

type DriverNode struct {
	// NodeNumber represents the node order for the device driver.
	NodeNumber int `json:"nodeNumber"`

	// INFFile is the fully qualified path to the INF file.
	INFFile string `json:"infFile"`

	// INFSection is the section of the INF file to which this device
	// corresponds.
	INFSection string `json:"infSection"`

	// Description is the description of the device.
	Description string `json:"description"`

	// Manufacturer is the name of the device manufacturer.
	Manufacturer string `json:"manufacturer"`

	// Provider is the name of the driver provider (e.g. Microsoft).
	Provider string `json:"provider"`

	// Date is the date associated with the current driver version.
	Date string `json:"date"`

	// Version is the current version of the driver.
	Version string `json:"version"`

	// NodeRank indicates how well the driver matches the device. A driver rank
	// is represented by an integer that is equal to or greater than zero. The
	// lower the rank, the better a match the driver is for the device.
	NodeRank int `json:"nodeRank"`

	// NodeFlags describe the status of a device.
	NodeFlags int `json:"nodeFlags"`

	// IsDigitallySigned indicates that the driver has been digitally signed.
	IsDigitallySigned bool `json:"isDigitallySigned"`
}

DriverNode describes the components of a driver package. See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/components-of-a-driver-package for more information about driver packages.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/how-setup-ranks-drivers--windows-vista-and-later- for more information about node rank.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/device-node-status-flags for more information about node flags.

type DriverNodeGroup

type DriverNodeGroup struct {
	// Device is the device with which the nodes are associated.
	Device Device `json:"device"`

	// Nodes are DriverNode records that describe the nodes associated with the
	// device driver.
	Nodes []DriverNode `json:"nodes"`
}

DriverNodeGroup contains device details as well as details for the corresponding driver nodes.

type DriverStack

type DriverStack struct {
	// Device is the device that the stack is associated with.
	Device Device `json:"device"`

	// SetupClassGUID is the GUID of the setup class.
	SetupClassGUID string `json:"setupClassGuid"`

	// SetupClassName is the name of the setup class.
	SetupClassName string `json:"setupClassName"`

	// ControllingService is the Windows Service that controls the driver.
	ControllingService string `json:"controllingService"`

	// UpperFilters represent a configuration that monitors all IRP traffic
	// into or out of the device driver within the device's driver stack,
	// regardless of whether the driver processed the IRP or passed it through
	// to lower device drivers.
	UpperFilters string `json:"upperFilters"`

	// LowerFilters represent a configuration that monitors all IRP traffic into
	// or out of the device driver from lower drivers within the device's driver stack.
	LowerFilters string `json:"lowerFilters"`
}

DriverStack contains driver stack details for a device.

type DriverStatus

type DriverStatus struct {
	// Device is the device that corresponds to the driver.
	Device Device `json:"device"`

	// Status is the current status of the device driver.
	Status Status `json:"status"`
}

DriverStatus contains details of the status of a device driver.

type HwID

type HwID struct {
	Device Device `json:"device"`

	// HardwareIDs is a vendor-defined identification string that Windows uses
	// to match a device to an INF file. In most cases, a device has more than
	// one hardware ID associated with it. Typically, a list of hardware IDs is
	// sorted from most to least suitable for a device.
	HardwareIDs []string `json:"hardwareIds"`

	// CompatibleIDs are the vendor-defined identification strings that Windows
	// uses to match a device to an INF file.
	CompatibleIDs []string `json:"compatibleIds"`
}

HwID contains the hardware IDs and compatible IDs for a device.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/hardware-ids for more information about Hardware IDs.

See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/compatible-ids for more information about Compatible IDs.

type OEMPackage

type OEMPackage struct {
	// Name is the name of the INF file associated with the package.
	Name string

	// Provider is the provider of the package (e.g. Microsoft).
	Provider string

	// Class is the name of the corresponding class (if any).
	Class string
}

OEMPackage describes 3rd party packages installed on the computer.

type Resource

type Resource struct {
	// Name is the name of the resource (e.g. IO or IRQ).
	Name string `json:"name"`

	// Value is the value of the resource (e.g. "ffa0-ffaf" or 14).
	Value string `json:"value"`
}

Resource represents an assignable and addressable bus paths, such as DMA channels, I/O ports, IRQ, and memory addresses.

type Status

type Status string

Status indicates the current status of a device driver.

const (
	// StatusRunning indicates that the device driver is running.
	StatusRunning Status = "running"

	// StatusStopped indicates that the device driver is stopped.
	StatusStopped Status = "stopped"

	// StatusDisabled indicates that the device driver is disabled.
	StatusDisabled Status = "disabled"

	// StatusUnknown indicates that the status could not be queried or is
	// unknown.
	StatusUnknown Status = "unknown"
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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