forked from Mengdch/win
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oaidl.go
81 lines (70 loc) · 1.86 KB
/
oaidl.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
// 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.
// +build windows
package win
import (
"syscall"
"unsafe"
)
type SCODE int32
type EXCEPINFO struct {
wCode uint16
wReserved uint16
bstrSource *uint16 /*BSTR*/
bstrDescription *uint16 /*BSTR*/
bstrHelpFile *uint16 /*BSTR*/
dwHelpContext uint32
pvReserved uintptr
pfnDeferredFillIn uintptr
scode SCODE
}
var (
IID_ITypeInfo = IID{0x00020401, 0x0000, 0x0000, [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}}
)
type ITypeInfoVtbl struct {
IUnknownVtbl
GetTypeAttr uintptr
GetTypeComp uintptr
GetFuncDesc uintptr
GetVarDesc uintptr
GetNames uintptr
GetRefTypeOfImplType uintptr
GetImplTypeFlags uintptr
GetIDsOfNames uintptr
Invoke uintptr
GetDocumentation uintptr
GetDllEntry uintptr
GetRefTypeInfo uintptr
AddressOfMember uintptr
CreateInstance uintptr
GetMops uintptr
GetContainingTypeLib uintptr
ReleaseTypeAttr uintptr
ReleaseFuncDesc uintptr
ReleaseVarDesc uintptr
}
type ITypeInfo struct {
LpVtbl *ITypeInfoVtbl
}
func (obj *ITypeInfo) QueryInterface(riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.QueryInterface, 3,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(riid)),
uintptr(unsafe.Pointer(ppvObject)))
return HRESULT(ret)
}
func (obj *ITypeInfo) AddRef() uint32 {
ret, _, _ := syscall.Syscall(obj.LpVtbl.AddRef, 1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return uint32(ret)
}
func (obj *ITypeInfo) Release() uint32 {
ret, _, _ := syscall.Syscall(obj.LpVtbl.Release, 1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return uint32(ret)
}