browseui: Fix several memory leaks in the tests.
[wine] / dlls / olecli32 / olecli_main.c
1 /*
2  *      OLECLI library
3  *
4  *      Copyright 1995  Martin von Loewis
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 /*      At the moment, these are only empty stubs.
22  */
23
24 #include "config.h"
25
26 #include <stdarg.h>
27
28 #include "windef.h"
29 #include "wine/windef16.h"
30 #include "winbase.h"
31 #include "wingdi.h"
32 #include "wownt32.h"
33 #include "objbase.h"
34 #include "olecli.h"
35 #include "wine/debug.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(ole);
38
39 typedef struct _OLEOBJECTVTBL {
40     void *         (CALLBACK *QueryProtocol)(_LPOLEOBJECT,LPCOLESTR16);
41     OLESTATUS      (CALLBACK *Release)(_LPOLEOBJECT);
42     OLESTATUS      (CALLBACK *Show)(_LPOLEOBJECT,BOOL16);
43     OLESTATUS      (CALLBACK *DoVerb)(_LPOLEOBJECT,UINT16,BOOL16,BOOL16);
44     OLESTATUS      (CALLBACK *GetData)(_LPOLEOBJECT,OLECLIPFORMAT,HANDLE16 *);
45     OLESTATUS      (CALLBACK *SetData)(_LPOLEOBJECT,OLECLIPFORMAT,HANDLE16);
46     OLESTATUS      (CALLBACK *SetTargetDevice)(_LPOLEOBJECT,HGLOBAL16);
47     OLESTATUS      (CALLBACK *SetBounds)(_LPOLEOBJECT,LPRECT16);
48     OLESTATUS      (CALLBACK *EnumFormats)(_LPOLEOBJECT,OLECLIPFORMAT);
49     OLESTATUS      (CALLBACK *SetColorScheme)(_LPOLEOBJECT,struct tagLOGPALETTE*);
50     OLESTATUS      (CALLBACK *Delete)(_LPOLEOBJECT);
51     OLESTATUS      (CALLBACK *SetHostNames)(_LPOLEOBJECT,LPCOLESTR16,LPCOLESTR16);
52     OLESTATUS      (CALLBACK *SaveToStream)(_LPOLEOBJECT,struct _OLESTREAM*);
53     OLESTATUS      (CALLBACK *Clone)(_LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,_LPOLEOBJECT *);
54     OLESTATUS      (CALLBACK *CopyFromLink)(_LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,_LPOLEOBJECT *);
55     OLESTATUS      (CALLBACK *Equal)(_LPOLEOBJECT,_LPOLEOBJECT);
56     OLESTATUS      (CALLBACK *CopyToClipBoard)(_LPOLEOBJECT);
57     OLESTATUS      (CALLBACK *Draw)(_LPOLEOBJECT,HDC16,LPRECT16,LPRECT16,HDC16);
58     OLESTATUS      (CALLBACK *Activate)(_LPOLEOBJECT,UINT16,BOOL16,BOOL16,HWND16,LPRECT16);
59     OLESTATUS      (CALLBACK *Execute)(_LPOLEOBJECT,HGLOBAL16,UINT16);
60     OLESTATUS      (CALLBACK *Close)(_LPOLEOBJECT);
61     OLESTATUS      (CALLBACK *Update)(_LPOLEOBJECT);
62     OLESTATUS      (CALLBACK *Reconnect)(_LPOLEOBJECT);
63     OLESTATUS      (CALLBACK *ObjectConvert)(_LPOLEOBJECT,LPCOLESTR16,LPOLECLIENT,LHCLIENTDOC,LPCOLESTR16,_LPOLEOBJECT*);
64     OLESTATUS      (CALLBACK *GetLinkUpdateOptions)(_LPOLEOBJECT,LPOLEOPT_UPDATE);
65     OLESTATUS      (CALLBACK *SetLinkUpdateOptions)(_LPOLEOBJECT,OLEOPT_UPDATE);
66     OLESTATUS      (CALLBACK *Rename)(_LPOLEOBJECT,LPCOLESTR16);
67     OLESTATUS      (CALLBACK *QueryName)(_LPOLEOBJECT,LPSTR,LPUINT16);
68     OLESTATUS      (CALLBACK *QueryType)(_LPOLEOBJECT,LPLONG);
69     OLESTATUS      (CALLBACK *QueryBounds)(_LPOLEOBJECT,LPRECT16);
70     OLESTATUS      (CALLBACK *QuerySize)(_LPOLEOBJECT,LPDWORD);
71     OLESTATUS      (CALLBACK *QueryOpen)(_LPOLEOBJECT);
72     OLESTATUS      (CALLBACK *QueryOutOfDate)(_LPOLEOBJECT);
73     OLESTATUS      (CALLBACK *QueryReleaseStatus)(_LPOLEOBJECT);
74     OLESTATUS      (CALLBACK *QueryReleaseError)(_LPOLEOBJECT);
75     OLE_RELEASE_METHOD (CALLBACK *QueryReleaseMethod)(_LPOLEOBJECT);
76     OLESTATUS      (CALLBACK *RequestData)(_LPOLEOBJECT,OLECLIPFORMAT);
77     OLESTATUS      (CALLBACK *ObjectLong)(_LPOLEOBJECT,UINT16,LPLONG);
78 } OLEOBJECTVTBL;
79 typedef OLEOBJECTVTBL *LPOLEOBJECTVTBL;
80
81 typedef struct _OLEOBJECT
82 {
83     const OLEOBJECTVTBL *lpvtbl;
84 } OLEOBJECT;
85
86 static LONG OLE_current_handle;
87
88 /******************************************************************************
89  *              OleSavedClientDoc       [OLECLI32.45]
90  */
91 OLESTATUS WINAPI OleSavedClientDoc(LHCLIENTDOC hDoc)
92 {
93     FIXME("(%d: stub\n", hDoc);
94     return OLE_OK;
95 }
96
97 /******************************************************************************
98  *              OleRegisterClientDoc    [OLECLI32.41]
99  */
100 OLESTATUS WINAPI OleRegisterClientDoc(LPCSTR classname, LPCSTR docname,
101                                         LONG reserved, LHCLIENTDOC *hRet )
102 {
103     FIXME("(%s,%s,...): stub\n",classname,docname);
104     *hRet=++OLE_current_handle;
105     return OLE_OK;
106 }
107
108 /******************************************************************************
109  *              OleRenameClientDoc      [OLECLI32.43]
110  */
111 OLESTATUS WINAPI OleRenameClientDoc(LHCLIENTDOC hDoc, LPCSTR newName)
112 {
113     FIXME("(%d,%s,...): stub\n",hDoc, newName);
114     return OLE_OK;
115 }
116
117 /******************************************************************************
118  *              OleRevokeClientDoc      [OLECLI32.42]
119  */
120 OLESTATUS WINAPI OleRevokeClientDoc(LHCLIENTDOC hServerDoc)
121 {
122     FIXME("(%d): stub\n",hServerDoc);
123     return OLE_OK;
124 }
125
126 /******************************************************************************
127  *           OleCreateLinkFromClip      [OLECLI32.11]
128  */
129 OLESTATUS WINAPI OleCreateLinkFromClip(
130         LPCSTR name,LPOLECLIENT olecli,LHCLIENTDOC hclientdoc,LPCSTR xname,
131         _LPOLEOBJECT *lpoleob,OLEOPT_RENDER render,OLECLIPFORMAT clipformat
132 ) {
133         FIXME("(%s,%p,%08x,%s,%p,%d,%d): stub!\n",
134               name,olecli,hclientdoc,xname,lpoleob,render,clipformat);
135         return OLE_OK;
136 }
137
138 /******************************************************************************
139  *           OleQueryLinkFromClip       [OLECLI32.9]
140  */
141 OLESTATUS WINAPI OleQueryLinkFromClip(LPCSTR name,OLEOPT_RENDER render,OLECLIPFORMAT clipformat) {
142         FIXME("(%s,%d,%d): stub!\n",name,render,clipformat);
143         return OLE_OK;
144 }
145
146 /******************************************************************************
147  *           OleQueryCreateFromClip     [OLECLI32.10]
148  */
149 OLESTATUS WINAPI OleQueryCreateFromClip(LPCSTR name,OLEOPT_RENDER render,OLECLIPFORMAT clipformat) {
150         FIXME("(%s,%d,%d): stub!\n",name,render,clipformat);
151         return OLE_OK;
152 }
153
154 /******************************************************************************
155  *              OleIsDcMeta     [OLECLI32.60]
156  */
157 BOOL WINAPI OleIsDcMeta(HDC hdc)
158 {
159     TRACE("(%p)\n",hdc);
160     return GetObjectType( hdc ) == OBJ_METADC;
161 }
162
163 /******************************************************************************
164  *              OleSetHostNames [OLECLI32.15]
165  */
166 OLESTATUS WINAPI OleSetHostNames(_LPOLEOBJECT oleob,LPCSTR name1,LPCSTR name2) {
167         FIXME("(%p,%s,%s): stub\n",oleob,name1,name2);
168         return OLE_OK;
169 }
170
171 /******************************************************************************
172  *              OleQueryType    [OLECLI32.14]
173  */
174 OLESTATUS WINAPI OleQueryType(_LPOLEOBJECT oleob,LONG*xlong) {
175         FIXME("(%p,%p): stub!\n",oleob,xlong);
176         if (!oleob)
177                 return 0x10;
178         TRACE("Calling OLEOBJECT.QueryType (%p) (%p,%p)\n",
179               oleob->lpvtbl->QueryType,oleob,xlong);
180         return oleob->lpvtbl->QueryType(oleob,xlong);
181 }
182
183 /******************************************************************************
184  *              OleCreateFromClip       [OLECLI32.12]
185  */
186 OLESTATUS WINAPI OleCreateFromClip(
187         LPCSTR name,LPOLECLIENT olecli,LHCLIENTDOC hclientdoc,LPCSTR xname,
188         _LPOLEOBJECT *lpoleob,OLEOPT_RENDER render, OLECLIPFORMAT clipformat
189 ) {
190         FIXME("(%s,%p,%08x,%s,%p,%d,%d): stub!\n",
191               name,olecli,hclientdoc,xname,lpoleob,render,clipformat);
192         /* clipb type, object kreieren entsprechend etc. */
193         return OLE_OK;
194 }