-
Notifications
You must be signed in to change notification settings - Fork 12
/
iasyncoperation.go
76 lines (58 loc) · 1.59 KB
/
iasyncoperation.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
// Code generated by winrt-go-gen. DO NOT EDIT.
//go:build windows
//nolint:all
package foundation
import (
"syscall"
"unsafe"
"github.com/go-ole/go-ole"
)
const GUIDIAsyncOperation string = "9fc2b0bb-e446-44e2-aa61-9cab8f636af2"
const SignatureIAsyncOperation string = "{9fc2b0bb-e446-44e2-aa61-9cab8f636af2}"
type IAsyncOperation struct {
ole.IInspectable
}
type IAsyncOperationVtbl struct {
ole.IInspectableVtbl
SetCompleted uintptr
GetCompleted uintptr
GetResults uintptr
}
func (v *IAsyncOperation) VTable() *IAsyncOperationVtbl {
return (*IAsyncOperationVtbl)(unsafe.Pointer(v.RawVTable))
}
func (v *IAsyncOperation) SetCompleted(handler *AsyncOperationCompletedHandler) error {
hr, _, _ := syscall.SyscallN(
v.VTable().SetCompleted,
uintptr(unsafe.Pointer(v)), // this
uintptr(unsafe.Pointer(handler)), // in AsyncOperationCompletedHandler
)
if hr != 0 {
return ole.NewError(hr)
}
return nil
}
func (v *IAsyncOperation) GetCompleted() (*AsyncOperationCompletedHandler, error) {
var out *AsyncOperationCompletedHandler
hr, _, _ := syscall.SyscallN(
v.VTable().GetCompleted,
uintptr(unsafe.Pointer(v)), // this
uintptr(unsafe.Pointer(&out)), // out AsyncOperationCompletedHandler
)
if hr != 0 {
return nil, ole.NewError(hr)
}
return out, nil
}
func (v *IAsyncOperation) GetResults() (unsafe.Pointer, error) {
var out unsafe.Pointer
hr, _, _ := syscall.SyscallN(
v.VTable().GetResults,
uintptr(unsafe.Pointer(v)), // this
uintptr(unsafe.Pointer(&out)), // out unsafe.Pointer
)
if hr != 0 {
return nil, ole.NewError(hr)
}
return out, nil
}