-
Notifications
You must be signed in to change notification settings - Fork 316
/
richole.go
213 lines (188 loc) · 5.78 KB
/
richole.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
// 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 REOBJECT struct {
cbStruct uint32 // Size of structure
cp int32 // Character position of object
clsid CLSID // Class ID of object
poleobj *IOleObject // OLE object interface
pstg *IStorage // Associated storage interface
polesite *IOleClientSite // Associated client site interface
sizel SIZE // Size of object (may be 0,0)
dvaspect uint32 // Display aspect to use
dwFlags uint32 // Object status flags
dwUser uint32 // Dword for user's use
}
type IRichEditOleVtbl struct {
IUnknownVtbl
GetClientSite uintptr
GetObjectCount uintptr
GetLinkCount uintptr
GetObject uintptr
InsertObject uintptr
ConvertObject uintptr
ActivateAs uintptr
SetHostNames uintptr
SetLinkAvailable uintptr
SetDvaspect uintptr
HandsOffStorage uintptr
SaveCompleted uintptr
InPlaceDeactivate uintptr
ContextSensitiveHelp uintptr
GetClipboardData uintptr
ImportDataObject uintptr
}
type IRichEditOle struct {
LpVtbl *IRichEditOleVtbl
}
func (obj *IRichEditOle) 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 *IRichEditOle) AddRef() uint32 {
ret, _, _ := syscall.Syscall(obj.LpVtbl.AddRef, 1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return uint32(ret)
}
func (obj *IRichEditOle) Release() uint32 {
ret, _, _ := syscall.Syscall(obj.LpVtbl.Release, 1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return uint32(ret)
}
func (obj *IRichEditOle) GetClientSite(lplpolesite **IOleClientSite) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.GetClientSite, 2,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(lplpolesite)),
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) GetObjectCount() int32 {
ret, _, _ := syscall.Syscall(obj.LpVtbl.GetObjectCount, 1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return int32(ret)
}
func (obj *IRichEditOle) GetLinkCount() int32 {
ret, _, _ := syscall.Syscall(obj.LpVtbl.GetLinkCount, 1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return int32(ret)
}
func (obj *IRichEditOle) GetObject(iob int32, lpreobject *REOBJECT, dwFlags uint32) HRESULT {
ret, _, _ := syscall.Syscall6(obj.LpVtbl.GetObject, 4,
uintptr(unsafe.Pointer(obj)),
uintptr(iob),
uintptr(unsafe.Pointer(lpreobject)),
uintptr(dwFlags),
0,
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) InsertObject(lpreobject *REOBJECT) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.InsertObject, 2,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(lpreobject)),
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) ConvertObject(iob int32, rclsidNew REFCLSID, lpstrUserTypeNew *byte) HRESULT {
ret, _, _ := syscall.Syscall6(obj.LpVtbl.ConvertObject, 4,
uintptr(unsafe.Pointer(obj)),
uintptr(iob),
uintptr(unsafe.Pointer(rclsidNew)),
uintptr(unsafe.Pointer(lpstrUserTypeNew)),
0,
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) ActivateAs(rclsid REFCLSID, rclsidAs REFCLSID) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.ActivateAs, 3,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(rclsid)),
uintptr(unsafe.Pointer(rclsidAs)))
return HRESULT(ret)
}
func (obj *IRichEditOle) SetHostNames(lpstrContainerApp *byte, lpstrContainerObj *byte) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.SetHostNames, 3,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(lpstrContainerApp)),
uintptr(unsafe.Pointer(lpstrContainerObj)))
return HRESULT(ret)
}
func (obj *IRichEditOle) SetLinkAvailable(iob int32, fAvailable BOOL) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.SetLinkAvailable, 3,
uintptr(unsafe.Pointer(obj)),
uintptr(iob),
uintptr(fAvailable))
return HRESULT(ret)
}
func (obj *IRichEditOle) SetDvaspect(iob int32, dvaspect uint32) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.SetDvaspect, 3,
uintptr(unsafe.Pointer(obj)),
uintptr(iob),
uintptr(dvaspect))
return HRESULT(ret)
}
func (obj *IRichEditOle) HandsOffStorage(iob int32) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.HandsOffStorage, 2,
uintptr(unsafe.Pointer(obj)),
uintptr(iob),
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) SaveCompleted(iob int32, lpstg *IStorage) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.SaveCompleted, 3,
uintptr(unsafe.Pointer(obj)),
uintptr(iob),
uintptr(unsafe.Pointer(lpstg)))
return HRESULT(ret)
}
func (obj *IRichEditOle) InPlaceDeactivate() HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.InPlaceDeactivate, 1,
uintptr(unsafe.Pointer(obj)),
0,
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) ContextSensitiveHelp(fEnterMode BOOL) HRESULT {
ret, _, _ := syscall.Syscall(obj.LpVtbl.ContextSensitiveHelp, 2,
uintptr(unsafe.Pointer(obj)),
uintptr(fEnterMode),
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) GetClipboardData(lpchrg *CHARRANGE, reco uint32, lplpdataobj **IDataObject) HRESULT {
ret, _, _ := syscall.Syscall6(obj.LpVtbl.GetClipboardData, 4,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(lpchrg)),
uintptr(reco),
uintptr(unsafe.Pointer(lplpdataobj)),
0,
0)
return HRESULT(ret)
}
func (obj *IRichEditOle) ImportDataObject(lpdataobj *IDataObject, cf CLIPFORMAT, hMetaPict HGLOBAL) HRESULT {
ret, _, _ := syscall.Syscall6(obj.LpVtbl.ImportDataObject, 4,
uintptr(unsafe.Pointer(obj)),
uintptr(unsafe.Pointer(lpdataobj)),
uintptr(cf),
uintptr(hMetaPict),
0,
0)
return HRESULT(ret)
}