-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstaller.go
More file actions
30 lines (25 loc) · 811 Bytes
/
installer.go
File metadata and controls
30 lines (25 loc) · 811 Bytes
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
package wu
import (
"github.com/mattn/go-ole"
"github.com/mattn/go-ole/oleutil"
)
type Installer struct {
updateInstaller *ole.IDispatch
}
func (ses *Session) NewInstaller(up *Updates) *Installer {
ins := new(Installer)
ins.updateInstaller = oleutil.MustCallMethod(ses.updateSession, "CreateUpdateInstaller").ToIDispatch()
if up != nil {
oleutil.MustPutProperty(ins.updateInstaller, "Updates", up.updates)
}
oleutil.MustPutProperty(ins.updateInstaller, "ForceQuiet", true) // FIXME: probably not always true...
return ins
}
func (ins *Installer) IsBusy() bool {
return oleutil.MustGetProperty(ins.updateInstaller, "IsBusy").Val == 1
}
func (ins *Installer) Install() (WUError, error) {
ret, err := oleutil.CallMethod(ins.updateInstaller, "Install")
val := WUError(ret.Val)
return val, err
}