1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * Authors: Stewart Gordon
7  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source: $(DRUNTIMESRC core/sys/windows/_ole.d)
9  */
10 /// Automatically imported and edited from the druntime module
11 /// core.sys.windows.ole for the auto-generated win32 package.
12 module win32.ole;
13 //version (Windows):
14 @system:
15 version (Win32_UseLib) pragma(lib, "ole32");
16 
17 import win32.windef, win32.wingdi, win32.uuid;
18 
19 alias LPCSTR OLE_LPCSTR;
20 
21 /+#define LRESULT LONG
22 #define HGLOBAL HANDLE+/
23 
24 enum {
25     OT_LINK = 1,
26     OT_EMBEDDED,
27     OT_STATIC
28 }
29 
30 enum OLEVERB_PRIMARY = 0;
31 enum OF_SET          = 1;
32 enum OF_GET          = 2;
33 enum OF_HANDLER      = 4;
34 
35 struct OLETARGETDEVICE {
36     USHORT otdDeviceNameOffset;
37     USHORT otdDriverNameOffset;
38     USHORT otdPortNameOffset;
39     USHORT otdExtDevmodeOffset;
40     USHORT otdExtDevmodeSize;
41     USHORT otdEnvironmentOffset;
42     USHORT otdEnvironmentSize;
43     BYTE   _otdData;
44     BYTE*  otdData() return { return &_otdData; }
45 }
46 alias OLETARGETDEVICE* LPOLETARGETDEVICE;
47 
48 enum OLESTATUS {
49     OLE_OK,
50     OLE_WAIT_FOR_RELEASE,
51     OLE_BUSY,
52     OLE_ERROR_PROTECT_ONLY,
53     OLE_ERROR_MEMORY,
54     OLE_ERROR_STREAM,
55     OLE_ERROR_STATIC,
56     OLE_ERROR_BLANK,
57     OLE_ERROR_DRAW,
58     OLE_ERROR_METAFILE,
59     OLE_ERROR_ABORT,
60     OLE_ERROR_CLIPBOARD,
61     OLE_ERROR_FORMAT,
62     OLE_ERROR_OBJECT,
63     OLE_ERROR_OPTION,
64     OLE_ERROR_PROTOCOL,
65     OLE_ERROR_ADDRESS,
66     OLE_ERROR_NOT_EQUAL,
67     OLE_ERROR_HANDLE,
68     OLE_ERROR_GENERIC,
69     OLE_ERROR_CLASS,
70     OLE_ERROR_SYNTAX,
71     OLE_ERROR_DATATYPE,
72     OLE_ERROR_PALETTE,
73     OLE_ERROR_NOT_LINK,
74     OLE_ERROR_NOT_EMPTY,
75     OLE_ERROR_SIZE,
76     OLE_ERROR_DRIVE,
77     OLE_ERROR_NETWORK,
78     OLE_ERROR_NAME,
79     OLE_ERROR_TEMPLATE,
80     OLE_ERROR_NEW,
81     OLE_ERROR_EDIT,
82     OLE_ERROR_OPEN,
83     OLE_ERROR_NOT_OPEN,
84     OLE_ERROR_LAUNCH,
85     OLE_ERROR_COMM,
86     OLE_ERROR_TERMINATE,
87     OLE_ERROR_COMMAND,
88     OLE_ERROR_SHOW,
89     OLE_ERROR_DOVERB,
90     OLE_ERROR_ADVISE_NATIVE,
91     OLE_ERROR_ADVISE_PICT,
92     OLE_ERROR_ADVISE_RENAME,
93     OLE_ERROR_POKE_NATIVE,
94     OLE_ERROR_REQUEST_NATIVE,
95     OLE_ERROR_REQUEST_PICT,
96     OLE_ERROR_SERVER_BLOCKED,
97     OLE_ERROR_REGISTRATION,
98     OLE_ERROR_ALREADY_REGISTERED,
99     OLE_ERROR_TASK,
100     OLE_ERROR_OUTOFDATE,
101     OLE_ERROR_CANT_UPDATE_CLIENT,
102     OLE_ERROR_UPDATE,
103     OLE_ERROR_SETDATA_FORMAT,
104     OLE_ERROR_STATIC_FROM_OTHER_OS,
105     OLE_ERROR_FILE_VER,
106     OLE_WARN_DELETE_DATA = 1000
107 }
108 
109 enum OLE_NOTIFICATION {
110     OLE_CHANGED,
111     OLE_SAVED,
112     OLE_CLOSED,
113     OLE_RENAMED,
114     OLE_QUERY_PAINT,
115     OLE_RELEASE,
116     OLE_QUERY_RETRY
117 }
118 
119 enum OLE_RELEASE_METHOD {
120     OLE_NONE,
121     OLE_DELETE,
122     OLE_LNKPASTE,
123     OLE_EMBPASTE,
124     OLE_SHOW,
125     OLE_RUN,
126     OLE_ACTIVATE,
127     OLE_UPDATE,
128     OLE_CLOSE,
129     OLE_RECONNECT,
130     OLE_SETUPDATEOPTIONS,
131     OLE_SERVERUNLAUNCH,
132     OLE_LOADFROMSTREAM,
133     OLE_SETDATA,
134     OLE_REQUESTDATA,
135     OLE_OTHER,
136     OLE_CREATE,
137     OLE_CREATEFROMTEMPLATE,
138     OLE_CREATELINKFROMFILE,
139     OLE_COPYFROMLNK,
140     OLE_CREATEFROMFILE,
141     OLE_CREATEINVISIBLE
142 }
143 
144 enum OLEOPT_RENDER {
145     olerender_none,
146     olerender_draw,
147     olerender_format
148 }
149 
150 alias WORD OLECLIPFORMAT;
151 
152 enum OLEOPT_UPDATE {
153     oleupdate_always,
154     oleupdate_onsave,
155     oleupdate_oncall,
156 // #ifdef OLE_INTERNAL
157     oleupdate_onclose
158 // #endif
159 }
160 
161 mixin DECLARE_HANDLE!("HOBJECT");
162 alias LONG_PTR LHSERVER, LHCLIENTDOC, LHSERVERDOC;
163 
164 struct OLEOBJECTVTBL {
165     extern (Windows) {
166         void* function(LPOLEOBJECT, OLE_LPCSTR) QueryProtocol;
167         OLESTATUS function(LPOLEOBJECT) Release;
168         OLESTATUS function(LPOLEOBJECT, BOOL) Show;
169         OLESTATUS function(LPOLEOBJECT, UINT, BOOL, BOOL) DoVerb;
170         OLESTATUS function(LPOLEOBJECT, OLECLIPFORMAT, HANDLE*) GetData;
171         OLESTATUS function(LPOLEOBJECT, OLECLIPFORMAT, HANDLE) SetData;
172         OLESTATUS function(LPOLEOBJECT, HGLOBAL) SetTargetDevice;
173         OLESTATUS function(LPOLEOBJECT, RECT*) SetBounds;
174         OLECLIPFORMAT function(LPOLEOBJECT, OLECLIPFORMAT) EnumFormats;
175         OLESTATUS function(LPOLEOBJECT, LOGPALETTE*) SetColorScheme;
176 //#ifndef SERVERONLY
177         OLESTATUS function(LPOLEOBJECT) Delete;
178         OLESTATUS function(LPOLEOBJECT, OLE_LPCSTR, OLE_LPCSTR) SetHostNames;
179         OLESTATUS function(LPOLEOBJECT, LPOLESTREAM) SaveToStream;
180         OLESTATUS function(LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, OLE_LPCSTR,
181           LPOLEOBJECT*) Clone;
182         OLESTATUS function(LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, OLE_LPCSTR,
183           LPOLEOBJECT*) CopyFromLink;
184         OLESTATUS function(LPOLEOBJECT, LPOLEOBJECT) Equal;
185         OLESTATUS function(LPOLEOBJECT) CopyToClipboard;
186         OLESTATUS function(LPOLEOBJECT, HDC, RECT*, RECT*, HDC) Draw;
187         OLESTATUS function(LPOLEOBJECT, UINT, BOOL, BOOL, HWND, RECT*)
188           Activate;
189         OLESTATUS function(LPOLEOBJECT, HGLOBAL, UINT) Execute;
190         OLESTATUS function(LPOLEOBJECT) Close;
191         OLESTATUS function(LPOLEOBJECT) Update;
192         OLESTATUS function(LPOLEOBJECT) Reconnect;
193         OLESTATUS function(LPOLEOBJECT, OLE_LPCSTR, LPOLECLIENT, LHCLIENTDOC,
194           OLE_LPCSTR, LPOLEOBJECT*) ObjectConvert;
195         OLESTATUS function(LPOLEOBJECT, OLEOPT_UPDATE*) GetLinkUpdateOptions;
196         OLESTATUS function(LPOLEOBJECT, OLEOPT_UPDATE) SetLinkUpdateOptions;
197         OLESTATUS function(LPOLEOBJECT, OLE_LPCSTR) Rename;
198         OLESTATUS function(LPOLEOBJECT, LPSTR, UINT*) QueryName;
199         OLESTATUS function(LPOLEOBJECT, LONG*) QueryType;
200         OLESTATUS function(LPOLEOBJECT, RECT*) QueryBounds;
201         OLESTATUS function(LPOLEOBJECT, DWORD*) QuerySize;
202         OLESTATUS function(LPOLEOBJECT) QueryOpen;
203         OLESTATUS function(LPOLEOBJECT) QueryOutOfDate;
204         OLESTATUS function(LPOLEOBJECT) QueryReleaseStatus;
205         OLESTATUS function(LPOLEOBJECT) QueryReleaseError;
206         OLE_RELEASE_METHOD function(LPOLEOBJECT) QueryReleaseMethod;
207         OLESTATUS function(LPOLEOBJECT, OLECLIPFORMAT) RequestData;
208         OLESTATUS function(LPOLEOBJECT, UINT, LONG*) ObjectLong;
209         OLESTATUS function(LPOLEOBJECT, HANDLE, LPOLECLIENT, BOOL) ChangeData;
210 //#endif
211     }
212 }
213 alias OLEOBJECTVTBL* LPOLEOBJECTVTBL;
214 
215 //#ifndef OLE_INTERNAL
216 struct OLEOBJECT {
217     LPOLEOBJECTVTBL lpvtbl;
218 }
219 alias OLEOBJECT* LPOLEOBJECT;
220 //#endif
221 
222 struct OLECLIENTVTBL {
223     extern (Windows) int function(LPOLECLIENT, OLE_NOTIFICATION, LPOLEOBJECT) CallBack;
224 }
225 alias OLECLIENTVTBL* LPOLECLIENTVTBL;
226 
227 struct OLECLIENT {
228     LPOLECLIENTVTBL lpvtbl;
229 }
230 alias OLECLIENT* LPOLECLIENT;
231 
232 struct OLESTREAMVTBL {
233     extern (Windows):
234     DWORD function(LPOLESTREAM, void*, DWORD) Get;
235     DWORD function(LPOLESTREAM, void*, DWORD) Put;
236 }
237 alias OLESTREAMVTBL* LPOLESTREAMVTBL;
238 
239 struct OLESTREAM {
240     LPOLESTREAMVTBL lpstbl;
241 }
242 alias OLESTREAM* LPOLESTREAM;
243 
244 enum OLE_SERVER_USE {
245     OLE_SERVER_MULTI,
246     OLE_SERVER_SINGLE
247 }
248 
249 struct OLESERVERVTBL {
250     extern (Windows):
251     OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, LPOLESERVERDOC*)
252       Open;
253     OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, OLE_LPCSTR,
254       LPOLESERVERDOC*) Create;
255     OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, OLE_LPCSTR,
256       OLE_LPCSTR, LPOLESERVERDOC*) CreateFromTemplate;
257     OLESTATUS function(LPOLESERVER, LHSERVERDOC, OLE_LPCSTR, OLE_LPCSTR,
258       LPOLESERVERDOC*) Edit;
259     OLESTATUS function(LPOLESERVER) Exit;
260     OLESTATUS function(LPOLESERVER) Release;
261     OLESTATUS function(LPOLESERVER, HGLOBAL) Execute;
262 }
263 alias TypeDef!(OLESERVERVTBL*) LPOLESERVERVTBL;
264 
265 struct OLESERVER {
266     LPOLESERVERVTBL lpvtbl;
267 }
268 alias OLESERVER* LPOLESERVER;
269 
270 struct OLESERVERDOCVTBL {
271 extern (Windows):
272     OLESTATUS function(LPOLESERVERDOC) Save;
273     OLESTATUS function(LPOLESERVERDOC) Close;
274     OLESTATUS function(LPOLESERVERDOC, OLE_LPCSTR, OLE_LPCSTR) SetHostNames;
275     OLESTATUS function(LPOLESERVERDOC, RECT*) SetDocDimensions;
276     OLESTATUS function(LPOLESERVERDOC, OLE_LPCSTR, LPOLEOBJECT*, LPOLECLIENT)
277       GetObject;
278     OLESTATUS function(LPOLESERVERDOC) Release;
279     OLESTATUS function(LPOLESERVERDOC, LOGPALETTE*) SetColorScheme;
280     OLESTATUS function(LPOLESERVERDOC, HGLOBAL) Execute;
281 }
282 alias OLESERVERDOCVTBL* LPOLESERVERDOCVTBL;
283 
284 struct OLESERVERDOC {
285     LPOLESERVERDOCVTBL lpvtbl;
286 }
287 alias OLESERVERDOC* LPOLESERVERDOC;
288 
289 extern (Windows) {
290     OLESTATUS OleDelete(LPOLEOBJECT);
291     OLESTATUS OleRelease(LPOLEOBJECT);
292     OLESTATUS OleSaveToStream(LPOLEOBJECT, LPOLESTREAM);
293     OLESTATUS OleEqual(LPOLEOBJECT, LPOLEOBJECT);
294     OLESTATUS OleCopyToClipboard(LPOLEOBJECT);
295     OLESTATUS OleSetHostNames(LPOLEOBJECT, LPCSTR, LPCSTR);
296     OLESTATUS OleSetTargetDevice(LPOLEOBJECT, HGLOBAL);
297     OLESTATUS OleSetBounds(LPOLEOBJECT, LPCRECT);
298     OLESTATUS OleSetColorScheme(LPOLEOBJECT, const(LOGPALETTE)*);
299     OLESTATUS OleQueryBounds(LPOLEOBJECT, RECT*);
300     OLESTATUS OleQuerySize(LPOLEOBJECT, DWORD*);
301     OLESTATUS OleDraw(LPOLEOBJECT, HDC, LPCRECT, LPCRECT, HDC);
302     OLESTATUS OleQueryOpen(LPOLEOBJECT);
303     OLESTATUS OleActivate(LPOLEOBJECT, UINT, BOOL, BOOL, HWND, LPCRECT);
304     OLESTATUS OleExecute(LPOLEOBJECT, HGLOBAL, UINT);
305     OLESTATUS OleClose(LPOLEOBJECT);
306     OLESTATUS OleUpdate(LPOLEOBJECT);
307     OLESTATUS OleReconnect(LPOLEOBJECT);
308     OLESTATUS OleGetLinkUpdateOptions(LPOLEOBJECT, OLEOPT_UPDATE*);
309     OLESTATUS OleSetLinkUpdateOptions(LPOLEOBJECT, OLEOPT_UPDATE);
310     void* OleQueryProtocol(LPOLEOBJECT, LPCSTR);
311     OLESTATUS OleQueryReleaseStatus(LPOLEOBJECT);
312     OLESTATUS OleQueryReleaseError(LPOLEOBJECT);
313     OLE_RELEASE_METHOD OleQueryReleaseMethod(LPOLEOBJECT);
314     OLESTATUS OleQueryType(LPOLEOBJECT, LONG*);
315     DWORD OleQueryClientVersion();
316     DWORD OleQueryServerVersion();
317     OLECLIPFORMAT OleEnumFormats(LPOLEOBJECT, OLECLIPFORMAT);
318     OLESTATUS OleGetData(LPOLEOBJECT, OLECLIPFORMAT, HANDLE*);
319     OLESTATUS OleSetData(LPOLEOBJECT, OLECLIPFORMAT, HANDLE);
320     OLESTATUS OleQueryOutOfDate(LPOLEOBJECT);
321     OLESTATUS OleRequestData(LPOLEOBJECT, OLECLIPFORMAT);
322     OLESTATUS OleQueryLinkFromClip(LPCSTR, OLEOPT_RENDER, OLECLIPFORMAT);
323     OLESTATUS OleQueryCreateFromClip(LPCSTR, OLEOPT_RENDER, OLECLIPFORMAT);
324     OLESTATUS OleCreateFromClip(LPCSTR, LPOLECLIENT, LHCLIENTDOC, LPCSTR,
325       LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT);
326     OLESTATUS OleCreateLinkFromClip(LPCSTR, LPOLECLIENT, LHCLIENTDOC, LPCSTR,
327       LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT);
328     OLESTATUS OleCreateFromFile(LPCSTR, LPOLECLIENT, LPCSTR, LPCSTR,
329       LHCLIENTDOC, LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT);
330     OLESTATUS OleCreateLinkFromFile(LPCSTR, LPOLECLIENT, LPCSTR, LPCSTR,
331       LPCSTR, LHCLIENTDOC, LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT);
332     OLESTATUS OleLoadFromStream(LPOLESTREAM, LPCSTR, LPOLECLIENT, LHCLIENTDOC,
333       LPCSTR, LPOLEOBJECT*);
334     OLESTATUS OleCreate(LPCSTR, LPOLECLIENT, LPCSTR, LHCLIENTDOC, LPCSTR,
335       LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT);
336     OLESTATUS OleCreateInvisible(LPCSTR, LPOLECLIENT, LPCSTR, LHCLIENTDOC,
337       LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT, BOOL);
338     OLESTATUS OleCreateFromTemplate(LPCSTR, LPOLECLIENT, LPCSTR, LHCLIENTDOC,
339       LPCSTR, LPOLEOBJECT*, OLEOPT_RENDER, OLECLIPFORMAT);
340     OLESTATUS OleClone(LPOLEOBJECT, LPOLECLIENT, LHCLIENTDOC, LPCSTR,
341       LPOLEOBJECT*);
342     OLESTATUS OleCopyFromLink(LPOLEOBJECT, LPCSTR, LPOLECLIENT, LHCLIENTDOC,
343       LPCSTR, LPOLEOBJECT*);
344     OLESTATUS OleObjectConvert(LPOLEOBJECT, LPCSTR, LPOLECLIENT, LHCLIENTDOC,
345       LPCSTR, LPOLEOBJECT*);
346     OLESTATUS OleRename(LPOLEOBJECT, LPCSTR);
347     OLESTATUS OleQueryName(LPOLEOBJECT, LPSTR, UINT*);
348     OLESTATUS OleRevokeObject(LPOLECLIENT);
349     BOOL OleIsDcMeta(HDC);
350     OLESTATUS OleRegisterClientDoc(LPCSTR, LPCSTR, LONG, LHCLIENTDOC*);
351     OLESTATUS OleRevokeClientDoc(LHCLIENTDOC);
352     OLESTATUS OleRenameClientDoc(LHCLIENTDOC, LPCSTR);
353     OLESTATUS OleRevertClientDoc(LHCLIENTDOC);
354     OLESTATUS OleSavedClientDoc(LHCLIENTDOC);
355     OLESTATUS OleEnumObjects(LHCLIENTDOC, LPOLEOBJECT*);
356     OLESTATUS OleRegisterServer(LPCSTR, LPOLESERVER, LHSERVER*, HINSTANCE,
357       OLE_SERVER_USE);
358     OLESTATUS OleRevokeServer(LHSERVER);
359     OLESTATUS OleBlockServer(LHSERVER);
360     OLESTATUS OleUnblockServer(LHSERVER, BOOL*);
361     OLESTATUS OleLockServer(LPOLEOBJECT, LHSERVER*);
362     OLESTATUS OleUnlockServer(LHSERVER);
363     OLESTATUS OleRegisterServerDoc(LHSERVER, LPCSTR, LPOLESERVERDOC,
364       LHSERVERDOC*);
365     OLESTATUS OleRevokeServerDoc(LHSERVERDOC);
366     OLESTATUS OleRenameServerDoc(LHSERVERDOC, LPCSTR);
367     OLESTATUS OleRevertServerDoc(LHSERVERDOC);
368     OLESTATUS OleSavedServerDoc(LHSERVERDOC);
369 }