setupapi

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Some utility functions from SetupAPI. (see "Public Device Installation Functions",

http://msdn.microsoft.com/en-us/library/ff549791.aspx)

Index

Constants

View Source
const (
	DICD_GENERATE_ID = 0x1

	DICD_INHERIT_CLASSDRVS = 0x2

	DIOD_INHERIT_CLASSDRVS = 0x2

	DIGCF_PRESENT = 0x2

	DICS_FLAG_GLOBAL         = 0x1
	DICS_FLAG_CONFIGSPECIFIC = 0x2

	DIREG_DEV = 0x1
	DIREG_DRV = 0x2

	SPDRP_HARDWAREID                  = 0x1
	SPDRP_DEVICEDESC                  = 0x0
	SPDRP_FRIENDLYNAME                = 0xc
	SPDRP_ENUMERATOR_NAME             = 0x16
	SPDRP_PHYSICAL_DEVICE_OBJECT_NAME = 0xe
	SPDRP_BUSTYPEGUID                 = 0x13
	SPDRP_BUSNUMBER                   = 0x15
	SPDRP_CLASS                       = 0x7
	SPDRP_CLASSGUID                   = 0x8
	SPDRP_MFG                         = 0xb

	DIF_REGISTERDEVICE = 0x19

	DEVPROP_TYPEMOD_ARRAY = 0x1000
	DEVPROP_TYPEMOD_LIST  = 0x2000

	DEVPROP_TYPE_EMPTY                      = 0x0
	DEVPROP_TYPE_NULL                       = 0x1
	DEVPROP_TYPE_SBYTE                      = 0x2
	DEVPROP_TYPE_BYTE                       = 0x3
	DEVPROP_TYPE_INT16                      = 0x4
	DEVPROP_TYPE_UINT16                     = 0x5
	DEVPROP_TYPE_INT32                      = 0x6
	DEVPROP_TYPE_UINT32                     = 0x7
	DEVPROP_TYPE_INT64                      = 0x8
	DEVPROP_TYPE_UINT64                     = 0x9
	DEVPROP_TYPE_FLOAT                      = 0xa
	DEVPROP_TYPE_DOUBLE                     = 0xb
	DEVPROP_TYPE_DECIMAL                    = 0xc
	DEVPROP_TYPE_GUID                       = 0xd
	DEVPROP_TYPE_CURRENCY                   = 0xe
	DEVPROP_TYPE_DATE                       = 0xf
	DEVPROP_TYPE_FILETIME                   = 0x10
	DEVPROP_TYPE_BOOLEAN                    = 0x11
	DEVPROP_TYPE_STRING                     = 0x12
	DEVPROP_TYPE_STRING_LIST                = 0x2012
	DEVPROP_TYPE_SECURITY_DESCRIPTOR        = 0x13
	DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING = 0x14
	DEVPROP_TYPE_DEVPROPKEY                 = 0x15
	DEVPROP_TYPE_DEVPROPTYPE                = 0x16
	DEVPROP_TYPE_BINARY                     = 0x1003
	DEVPROP_TYPE_ERROR                      = 0x17
	DEVPROP_TYPE_NTSTATUS                   = 0x18
	DEVPROP_TYPE_STRING_INDIRECT            = 0x19
)
View Source
const (
	SpDevinfoDataSz = 0x20
)

Variables

View Source
var GuidSerialPorts = &Guid{
	Data1: 0x4D36E978,
	Data2: 0xE325,
	Data3: 0x11CE,
	Data4: [8]uint8{
		0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18,
	},
}

Functions

func SetupDiCallClassInstaller

func SetupDiCallClassInstaller(installFn uintptr, devInfoSet syscall.Handle, data *SpDevinfoData) (err error)

func SetupDiCreateDeviceInfo

func SetupDiCreateDeviceInfo(devInfoSet syscall.Handle, devName *uint16, g *Guid, devDesc *uint16, hwnd uintptr, cflags uint32, dataOut *SpDevinfoData) (err error)

func SetupDiCreateDeviceInfoList

func SetupDiCreateDeviceInfoList(g *Guid, hwnd uintptr) (devInfoSet syscall.Handle, err error)

func SetupDiDestroyDeviceInfoList

func SetupDiDestroyDeviceInfoList(devInfoSet syscall.Handle) (err error)

func SetupDiEnumDeviceInfo

func SetupDiEnumDeviceInfo(devInfoSet syscall.Handle, index uint32, diData *SpDevinfoData) (err error)

func SetupDiGetClassDevs

func SetupDiGetClassDevs(class *Guid, enum *uint16, parent syscall.Handle, flags uint32) (devInfoSet syscall.Handle, err error)

func SetupDiGetDeviceInstanceId

func SetupDiGetDeviceInstanceId(devInfoSet syscall.Handle, diData *SpDevinfoData, id []uint16, reqSz *uint32) (err error)

func SetupDiGetDeviceProperty added in v0.5.0

func SetupDiGetDeviceProperty(devInfoSet syscall.Handle, diData *SpDevinfoData, pKey *DevPropKey, pType *DevPropType, buf []byte, size *uint32, flags uint32) (err error)

func SetupDiGetDeviceRegistryProperty

func SetupDiGetDeviceRegistryProperty(devInfoSet syscall.Handle, diData *SpDevinfoData, prop uint32, regDataType *uint32, buf []byte, size *uint32) (err error)

func SetupDiGetINFClass

func SetupDiGetINFClass(infPath *uint16, guid *Guid, className []uint16, reqSz *uint32) (err error)

func SetupDiOpenDevRegKey

func SetupDiOpenDevRegKey(devInfoSet syscall.Handle, diData *SpDevinfoData, scope uint32, hwProfile uint32, keyType uint32, desiredAccess uint32) (h syscall.Handle, err error)

func SetupDiOpenDeviceInfo added in v0.5.0

func SetupDiOpenDeviceInfo(devInfoSet syscall.Handle, deviceInstanceId *uint16, hwndParent syscall.Handle, openFlags uint32, diData *SpDevinfoData) (err error)

func SetupDiSetDeviceRegistryProperty

func SetupDiSetDeviceRegistryProperty(devInfoSet syscall.Handle, data *SpDevinfoData, prop uint32, buf *byte, sz uint32) (err error)

Types

type DevPropKey added in v0.5.0

type DevPropKey struct {
	Fmtid Guid
	Pid   uint32
}

func NewDevPropKey added in v0.5.0

func NewDevPropKey(guid *Guid, pid uint32) *DevPropKey

type DevPropType added in v0.5.0

type DevPropType uint32

type DevinfoSet

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

func NewDevinfoSet

func NewDevinfoSet(h syscall.Handle) *DevinfoSet

func (*DevinfoSet) DeviceInstanceID

func (di *DevinfoSet) DeviceInstanceID() (id string, err error)

func (*DevinfoSet) DeviceRegistryProperty

func (di *DevinfoSet) DeviceRegistryProperty(prop uint32) Property

func (*DevinfoSet) Enum

func (di *DevinfoSet) Enum(i int) bool

func (*DevinfoSet) OpenDevRegKey

func (di *DevinfoSet) OpenDevRegKey() (k *registry.Key, err error)

type Guid

type Guid struct {
	Data1 uint32
	Data2 uint16
	Data3 uint16
	Data4 [8]uint8
}

func NewGuidFromBytes added in v0.5.0

func NewGuidFromBytes(b []byte) (*Guid, error)

func NewGuidFromString added in v0.5.0

func NewGuidFromString(s string) (*Guid, error)

type Property

type Property []byte

func (Property) String

func (p Property) String() string

func (Property) Strings

func (p Property) Strings() (list []string)

type SpDevinfoData

type SpDevinfoData struct {
	CbSize    uint32
	ClassGuid Guid
	DevInst   uint32
	Reserved  uint64
}

func NewDevinfoData

func NewDevinfoData() *SpDevinfoData

Jump to

Keyboard shortcuts

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