-
Notifications
You must be signed in to change notification settings - Fork 4
/
driver.go
50 lines (41 loc) · 1.36 KB
/
driver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package windevice
import (
"syscall"
"time"
"github.com/gentlemanautomaton/windevice/driverversion"
"github.com/gentlemanautomaton/windevice/setupapi"
)
// 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.
type Driver struct {
devices syscall.Handle
device setupapi.DevInfoData
data setupapi.DrvInfoData
}
// Sys returns low-level information about the driver.
func (driver Driver) Sys() (devices syscall.Handle, device setupapi.DevInfoData, data setupapi.DrvInfoData) {
return driver.devices, driver.device, driver.data
}
// Description returns the description of the driver.
func (driver Driver) Description() string {
return driver.data.Description.String()
}
// ManufacturerName returns the name of the driver's manufacturer.
func (driver Driver) ManufacturerName() string {
return driver.data.MfgName.String()
}
// ProviderName returns the name of the driver provider.
func (driver Driver) ProviderName() string {
return driver.data.ProviderName.String()
}
// Date returns the release date of the driver.
func (driver Driver) Date() time.Time {
return driver.data.Date.Value()
}
// Version returns the version of the driver.
func (driver Driver) Version() driverversion.Value {
return driver.data.Version
}