This repository was archived by the owner on Nov 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwuapi.go
358 lines (296 loc) · 10.4 KB
/
wuapi.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
// Copyright 2010 The win Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build windows
// +build windows
package win
import (
"syscall"
"unsafe"
)
var IID_IUpdateIdentity = IID{0x46297823, 0x9940, 0x4c09, [8]byte{0xae, 0xd9, 0xcd, 0x3e, 0xa6, 0xd0, 0x59, 0x68}}
type IUpdateIdentityVtbl struct {
IDispatchVtbl
GetRevisionNumber uintptr
GetUpdateID uintptr
}
type IUpdateIdentity struct {
LpVtbl *IUpdateIdentityVtbl
}
func (obj *IUpdateIdentity) QueryInterface(riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
return (*IUnknown)(unsafe.Pointer(obj)).QueryInterface(riid, ppvObject)
}
func (obj *IUpdateIdentity) AddRef() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).AddRef()
}
func (obj *IUpdateIdentity) Release() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).Release()
}
func (obj *IUpdateIdentity) RevisionNumber() (int32, HRESULT) {
var retval int32
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetRevisionNumber,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateIdentity) UpdateID() (*uint16 /*BSTR*/, HRESULT) {
var retval *uint16 /*BSTR*/
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetUpdateID,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
var IID_IUpdateHistoryEntry = IID{0xbe56a644, 0xaf0e, 0x4e0e, [8]byte{0xa3, 0x11, 0xc1, 0xd8, 0xe6, 0x95, 0xcb, 0xff}}
type IUpdateHistoryEntryVtbl struct {
IDispatchVtbl
GetOperation uintptr
GetResultCode uintptr
GetHResult uintptr
GetDate uintptr
GetUpdateIdentity uintptr
GetTitle uintptr
GetDescription uintptr
GetUnmappedResultCode uintptr
GetClientApplicationID uintptr
GetServerSelection uintptr
GetServiceID uintptr
GetUninstallationSteps uintptr
GetUninstallationNotes uintptr
GetSupportUrl uintptr
}
type IUpdateHistoryEntry struct {
LpVtbl *IUpdateHistoryEntryVtbl
}
func (obj *IUpdateHistoryEntry) QueryInterface(riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
return (*IUnknown)(unsafe.Pointer(obj)).QueryInterface(riid, ppvObject)
}
func (obj *IUpdateHistoryEntry) AddRef() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).AddRef()
}
func (obj *IUpdateHistoryEntry) Release() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).Release()
}
type UpdateOperation int32
const (
UOInstallation UpdateOperation = 1
UOUninstallation UpdateOperation = 2
)
func (obj *IUpdateHistoryEntry) Operation() (UpdateOperation, HRESULT) {
var retval UpdateOperation
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetOperation,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
type OperationResultCode int32
const (
ORCNotStarted OperationResultCode = 0
ORCInProgress OperationResultCode = 1
ORCSucceeded OperationResultCode = 2
ORCSucceededWithErrors OperationResultCode = 3
ORCFailed OperationResultCode = 4
ORCAborted OperationResultCode = 5
)
func (obj *IUpdateHistoryEntry) ResultCode() (OperationResultCode, HRESULT) {
var retval OperationResultCode
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetResultCode,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateHistoryEntry) HResult() (HRESULT, HRESULT) {
var retval HRESULT
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetHResult,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateHistoryEntry) Date() (float64 /*DATE*/, HRESULT) {
var retval float64 /*DATE*/
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetDate,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateHistoryEntry) UpdateIdentity() (*IUpdateIdentity, HRESULT) {
var retval *IUpdateIdentity
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetUpdateIdentity,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateHistoryEntry) Title() (*uint16 /*BSTR*/, HRESULT) {
var retval *uint16 /*BSTR*/
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetTitle,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateHistoryEntry) Description() (*uint16 /*BSTR*/, HRESULT) {
var retval *uint16 /*BSTR*/
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetDescription,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
var IID_IUpdateHistoryEntryCollection = IID{0xa7f04f3c, 0xa290, 0x435b, [8]byte{0xaa, 0xdf, 0xa1, 0x16, 0xc3, 0x35, 0x7a, 0x5c}}
type IUpdateHistoryEntryCollectionVtbl struct {
IDispatchVtbl
GetItem uintptr
Get_NewEnum uintptr
GetCount uintptr
}
type IUpdateHistoryEntryCollection struct {
LpVtbl *IUpdateHistoryEntryCollectionVtbl
}
func (obj *IUpdateHistoryEntryCollection) QueryInterface(riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
return (*IUnknown)(unsafe.Pointer(obj)).QueryInterface(riid, ppvObject)
}
func (obj *IUpdateHistoryEntryCollection) AddRef() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).AddRef()
}
func (obj *IUpdateHistoryEntryCollection) Release() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).Release()
}
func (obj *IUpdateHistoryEntryCollection) Item(index int32) (*IUpdateHistoryEntry, HRESULT) {
var retval *IUpdateHistoryEntry
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetItem,
uintptr(unsafe.Pointer(obj)),
uintptr(index),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateHistoryEntryCollection) NewEnum() (*IUnknown, HRESULT) {
var retval *IUnknown
ret, _, _ := syscall.SyscallN(obj.LpVtbl.Get_NewEnum,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateHistoryEntryCollection) Count() (int32, HRESULT) {
var retval int32
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetCount,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
var IID_IUpdateServiceManager = IID{0x23857e3c, 0x02ba, 0x44a3, [8]byte{0x94, 0x23, 0xb1, 0xc9, 0x00, 0x80, 0x5f, 0x37}}
type IUpdateServiceManagerVtbl struct {
IDispatch
GetServices uintptr
AddService uintptr
RegisterServiceWithAU uintptr
RemoveService uintptr
UnregisterServiceWithAU uintptr
AddScanPackageService uintptr
SetOption uintptr
}
type IUpdateServiceManager struct {
LpVtbl *IUpdateServiceManagerVtbl
}
var IID_IUpdateServiceManager2 = IID{0x0bb8531d, 0x7e8d, 0x424f, [8]byte{0x98, 0x6c, 0xa0, 0xb8, 0xf6, 0x0a, 0x3e, 0x7b}}
type IUpdateServiceManager2Vtbl struct {
IUpdateServiceManagerVtbl
GetClientApplicationID uintptr
PutClientApplicationID uintptr
QueryServiceRegistration uintptr
AddService2 uintptr
}
type IUpdateServiceManager2 struct {
LpVtbl *IUpdateServiceManager2Vtbl
}
var (
IID_IUpdateSession = IID{0x816858a4, 0x260d, 0x4260, [8]byte{0x93, 0x3a, 0x25, 0x85, 0xf1, 0xab, 0xc7, 0x6b}}
CLSID_UpdateSession = CLSID{0x4CB43D7F, 0x7EEE, 0x4906, [8]byte{0x86, 0x98, 0x60, 0xDA, 0x1C, 0x38, 0xF2, 0xFE}}
)
type IUpdateSessionVtbl struct {
IDispatchVtbl
GetClientApplicationID uintptr
PutClientApplicationID uintptr
GetReadOnly uintptr
GetWebProxy uintptr
PutWebProxy uintptr
CreateUpdateSearcher uintptr
CreateUpdateDownloader uintptr
CreateUpdateInstaller uintptr
}
type IUpdateSession struct {
LpVtbl *IUpdateSessionVtbl
}
func (obj *IUpdateSession) ClientApplicationID() (*uint16 /*BSTR*/, HRESULT) {
var retval *uint16 /*BSTR*/
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetClientApplicationID,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateSession) SetClientApplicationID(value *uint16 /*BSTR*/) HRESULT {
ret, _, _ := syscall.SyscallN(obj.LpVtbl.PutClientApplicationID,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(value)))
return HRESULT(ret)
}
func (obj *IUpdateSession) ReadOnly() (VARIANT_BOOL, HRESULT) {
var retval VARIANT_BOOL
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetReadOnly,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
var IID_IUpdateSession2 = IID{0x918EFD1E, 0xB5D8, 0x4c90, [8]byte{0x85, 0x40, 0xAE, 0xB9, 0xBD, 0xC5, 0x6F, 0x9D}}
type IUpdateSession2Vtbl struct {
IUpdateSessionVtbl
GetUserLocale uintptr
PutUserLocale uintptr
}
type IUpdateSession2 struct {
LpVtbl *IUpdateSession2Vtbl
}
func (obj *IUpdateSession2) UserLocale() (LCID, HRESULT) {
var retval LCID
ret, _, _ := syscall.SyscallN(obj.LpVtbl.GetUserLocale,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateSession2) PutUserLocale(lcid LCID) HRESULT {
ret, _, _ := syscall.SyscallN(obj.LpVtbl.PutUserLocale,
uintptr(unsafe.Pointer(obj)),
uintptr(lcid))
return HRESULT(ret)
}
var IID_IUpdateSession3 = IID{0x918EFD1E, 0xB5D8, 0x4c90, [8]byte{0x85, 0x40, 0xAE, 0xB9, 0xBD, 0xC5, 0x6F, 0x9D}}
type IUpdateSession3Vtbl struct {
IUpdateSession2Vtbl
CreateUpdateServiceManager uintptr
QueryHistory uintptr
}
type IUpdateSession3 struct {
LpVtbl *IUpdateSession3Vtbl
}
func (obj *IUpdateSession3) QueryInterface(riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
return (*IUnknown)(unsafe.Pointer(obj)).QueryInterface(riid, ppvObject)
}
func (obj *IUpdateSession3) AddRef() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).AddRef()
}
func (obj *IUpdateSession3) Release() uint32 {
return (*IUnknown)(unsafe.Pointer(obj)).Release()
}
func (obj *IUpdateSession3) CreateUpdateServiceManager() (*IUpdateServiceManager2, HRESULT) {
var retval *IUpdateServiceManager2
ret, _, _ := syscall.SyscallN(obj.LpVtbl.CreateUpdateServiceManager,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}
func (obj *IUpdateSession3) QueryHistory(criteria *uint16 /*BSTR*/, startIndex int32, count int32) (*IUpdateHistoryEntryCollection, HRESULT) {
var retval *IUpdateHistoryEntryCollection
ret, _, _ := syscall.SyscallN(obj.LpVtbl.QueryHistory,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(criteria)),
uintptr(startIndex),
uintptr(count),
uintptr(unsafe.Pointer(&retval)))
return retval, HRESULT(ret)
}