Merge my current work done on the kd++ branch:
[reactos.git] / reactos / dll / win32 / oledlg / oledlg_main.c
1 /*
2 * OLEDLG library
3 *
4 * Copyright 1998 Patrik Stridvall
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 #define WIN32_NO_STATUS
22 #define _INC_WINDOWS
23 #define COM_NO_WINDOWS_H
24
25 #include <stdarg.h>
26
27 #include <windef.h>
28 #include <winbase.h>
29 //#include "winerror.h"
30 #include <wingdi.h>
31 #include <winuser.h>
32 #include <oledlg.h>
33 //#include "ole2.h"
34 //#include "oledlg_private.h"
35
36 #include <wine/debug.h>
37
38 WINE_DEFAULT_DEBUG_CHANNEL(ole);
39
40 HINSTANCE OLEDLG_hInstance = 0;
41
42 UINT cf_embed_source;
43 UINT cf_embedded_object;
44 UINT cf_link_source;
45 UINT cf_object_descriptor;
46 UINT cf_link_src_descriptor;
47 UINT cf_ownerlink;
48 UINT cf_filename;
49 UINT cf_filenamew;
50
51 UINT oleui_msg_help;
52 UINT oleui_msg_enddialog;
53
54 static void register_clipboard_formats(void)
55 {
56 /* These used to be declared in olestd.h, but that seems to have been removed from the api */
57 static const WCHAR CF_EMBEDSOURCEW[] = { 'E','m','b','e','d',' ','S','o','u','r','c','e',0 };
58 static const WCHAR CF_EMBEDDEDOBJECTW[] = { 'E','m','b','e','d','d','e','d',' ','O','b','j','e','c','t',0 };
59 static const WCHAR CF_LINKSOURCEW[] = { 'L','i','n','k',' ','S','o','u','r','c','e',0 };
60 static const WCHAR CF_OBJECTDESCRIPTORW[] = { 'O','b','j','e','c','t',' ','D','e','s','c','r','i','p','t','o','r',0 };
61 static const WCHAR CF_LINKSRCDESCRIPTORW[] = { 'L','i','n','k',' ','S','o','u','r','c','e',' ','D','e','s','c','r','i','p','t','o','r',0 };
62 static const WCHAR CF_OWNERLINKW[] = { 'O','w','n','e','r','L','i','n','k',0 };
63 static const WCHAR CF_FILENAMEW[] = { 'F','i','l','e','N','a','m','e',0 };
64 static const WCHAR CF_FILENAMEWW[] = { 'F','i','l','e','N','a','m','e','W',0 };
65
66 /* Load in the same order as native to make debugging easier */
67 cf_object_descriptor = RegisterClipboardFormatW(CF_OBJECTDESCRIPTORW);
68 cf_link_src_descriptor = RegisterClipboardFormatW(CF_LINKSRCDESCRIPTORW);
69 cf_embed_source = RegisterClipboardFormatW(CF_EMBEDSOURCEW);
70 cf_embedded_object = RegisterClipboardFormatW(CF_EMBEDDEDOBJECTW);
71 cf_link_source = RegisterClipboardFormatW(CF_LINKSOURCEW);
72 cf_ownerlink = RegisterClipboardFormatW(CF_OWNERLINKW);
73 cf_filename = RegisterClipboardFormatW(CF_FILENAMEW);
74 cf_filenamew = RegisterClipboardFormatW(CF_FILENAMEWW);
75 }
76
77 static void register_messages(void)
78 {
79 oleui_msg_help = RegisterWindowMessageW(SZOLEUI_MSG_HELPW);
80 oleui_msg_enddialog = RegisterWindowMessageW(SZOLEUI_MSG_ENDDIALOGW);
81 }
82
83 /***********************************************************************
84 * DllMain
85 */
86 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
87 {
88 TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, fImpLoad);
89
90 switch(fdwReason) {
91 case DLL_PROCESS_ATTACH:
92 DisableThreadLibraryCalls(hinstDLL);
93 OLEDLG_hInstance = hinstDLL;
94 register_clipboard_formats();
95 register_messages();
96 break;
97
98 case DLL_PROCESS_DETACH:
99 OLEDLG_hInstance = 0;
100 break;
101 }
102 return TRUE;
103 }
104
105
106 /***********************************************************************
107 * OleUIAddVerbMenuA (OLEDLG.1)
108 */
109 BOOL WINAPI OleUIAddVerbMenuA(
110 LPOLEOBJECT lpOleObj, LPCSTR lpszShortType,
111 HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax,
112 BOOL bAddConvert, UINT idConvert, HMENU *lphMenu)
113 {
114 FIXME("(%p, %s, %p, %d, %d, %d, %d, %d, %p): stub\n",
115 lpOleObj, debugstr_a(lpszShortType),
116 hMenu, uPos, uIDVerbMin, uIDVerbMax,
117 bAddConvert, idConvert, lphMenu
118 );
119 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
120 return FALSE;
121 }
122
123 /***********************************************************************
124 * OleUIAddVerbMenuW (OLEDLG.14)
125 */
126 BOOL WINAPI OleUIAddVerbMenuW(
127 LPOLEOBJECT lpOleObj, LPCWSTR lpszShortType,
128 HMENU hMenu, UINT uPos, UINT uIDVerbMin, UINT uIDVerbMax,
129 BOOL bAddConvert, UINT idConvert, HMENU *lphMenu)
130 {
131 FIXME("(%p, %s, %p, %d, %d, %d, %d, %d, %p): stub\n",
132 lpOleObj, debugstr_w(lpszShortType),
133 hMenu, uPos, uIDVerbMin, uIDVerbMax,
134 bAddConvert, idConvert, lphMenu
135 );
136 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
137 return FALSE;
138 }
139
140 /***********************************************************************
141 * OleUICanConvertOrActivateAs (OLEDLG.2)
142 */
143 BOOL WINAPI OleUICanConvertOrActivateAs(
144 REFCLSID rClsid, BOOL fIsLinkedObject, WORD wFormat)
145 {
146 FIXME("(%p, %d, %hd): stub\n",
147 rClsid, fIsLinkedObject, wFormat
148 );
149 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
150 return FALSE;
151 }
152
153 /***********************************************************************
154 * OleUIInsertObjectW (OLEDLG.20)
155 */
156 UINT WINAPI OleUIInsertObjectW(LPOLEUIINSERTOBJECTW lpOleUIInsertObject)
157 {
158 FIXME("(%p): stub\n", lpOleUIInsertObject);
159 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
160 return OLEUI_FALSE;
161 }
162
163 /***********************************************************************
164 * OleUIEditLinksA (OLEDLG.5)
165 */
166 UINT WINAPI OleUIEditLinksA(LPOLEUIEDITLINKSA lpOleUIEditLinks)
167 {
168 FIXME("(%p): stub\n", lpOleUIEditLinks);
169 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
170 return OLEUI_FALSE;
171 }
172
173 /***********************************************************************
174 * OleUIEditLinksW (OLEDLG.19)
175 */
176 UINT WINAPI OleUIEditLinksW(LPOLEUIEDITLINKSW lpOleUIEditLinks)
177 {
178 FIXME("(%p): stub\n", lpOleUIEditLinks);
179 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
180 return OLEUI_FALSE;
181 }
182
183 /***********************************************************************
184 * OleUIChangeIconA (OLEDLG.6)
185 */
186 UINT WINAPI OleUIChangeIconA(
187 LPOLEUICHANGEICONA lpOleUIChangeIcon)
188 {
189 FIXME("(%p): stub\n", lpOleUIChangeIcon);
190 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
191 return OLEUI_FALSE;
192 }
193
194 /***********************************************************************
195 * OleUIChangeIconW (OLEDLG.16)
196 */
197 UINT WINAPI OleUIChangeIconW(
198 LPOLEUICHANGEICONW lpOleUIChangeIcon)
199 {
200 FIXME("(%p): stub\n", lpOleUIChangeIcon);
201 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
202 return OLEUI_FALSE;
203 }
204
205 /***********************************************************************
206 * OleUIConvertA (OLEDLG.7)
207 */
208 UINT WINAPI OleUIConvertA(LPOLEUICONVERTA lpOleUIConvert)
209 {
210 FIXME("(%p): stub\n", lpOleUIConvert);
211 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
212 return OLEUI_FALSE;
213 }
214
215 /***********************************************************************
216 * OleUIConvertW (OLEDLG.18)
217 */
218 UINT WINAPI OleUIConvertW(LPOLEUICONVERTW lpOleUIConvert)
219 {
220 FIXME("(%p): stub\n", lpOleUIConvert);
221 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
222 return OLEUI_FALSE;
223 }
224
225 /***********************************************************************
226 * OleUIBusyA (OLEDLG.8)
227 */
228 UINT WINAPI OleUIBusyA(LPOLEUIBUSYA lpOleUIBusy)
229 {
230 FIXME("(%p): stub\n", lpOleUIBusy);
231 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
232 return OLEUI_FALSE;
233 }
234
235 /***********************************************************************
236 * OleUIBusyW (OLEDLG.15)
237 */
238 UINT WINAPI OleUIBusyW(LPOLEUIBUSYW lpOleUIBusy)
239 {
240 FIXME("(%p): stub\n", lpOleUIBusy);
241 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
242 return OLEUI_FALSE;
243 }
244
245 /***********************************************************************
246 * OleUIUpdateLinksA (OLEDLG.9)
247 */
248 BOOL WINAPI OleUIUpdateLinksA(
249 LPOLEUILINKCONTAINERA lpOleUILinkCntr,
250 HWND hwndParent, LPSTR lpszTitle, INT cLinks)
251 {
252 FIXME("(%p, %p, %s, %d): stub\n",
253 lpOleUILinkCntr, hwndParent, debugstr_a(lpszTitle), cLinks
254 );
255 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
256 return FALSE;
257 }
258
259 /***********************************************************************
260 * OleUIUpdateLinksW (OLEDLG.23)
261 */
262 BOOL WINAPI OleUIUpdateLinksW(
263 LPOLEUILINKCONTAINERW lpOleUILinkCntr,
264 HWND hwndParent, LPWSTR lpszTitle, INT cLinks)
265 {
266 FIXME("(%p, %p, %s, %d): stub\n",
267 lpOleUILinkCntr, hwndParent, debugstr_w(lpszTitle), cLinks
268 );
269 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
270 return FALSE;
271 }
272
273 /***********************************************************************
274 * OleUIPromptUserA (OLEDLG.10)
275 */
276 INT WINAPIV OleUIPromptUserA(
277 INT nTemplate, HWND hwndParent, ...)
278 {
279 FIXME("(%d, %p, ...): stub\n", nTemplate, hwndParent);
280 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
281 return OLEUI_FALSE;
282 }
283
284 /***********************************************************************
285 * OleUIPromptUserW (OLEDLG.13)
286 */
287 INT WINAPIV OleUIPromptUserW(
288 INT nTemplate, HWND hwndParent, ...)
289 {
290 FIXME("(%d, %p, ...): stub\n", nTemplate, hwndParent);
291 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
292 return OLEUI_FALSE;
293 }
294
295 /***********************************************************************
296 * OleUIObjectPropertiesA (OLEDLG.11)
297 */
298 UINT WINAPI OleUIObjectPropertiesA(
299 LPOLEUIOBJECTPROPSA lpOleUIObjectProps)
300 {
301 FIXME("(%p): stub\n", lpOleUIObjectProps);
302 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
303 return OLEUI_FALSE;
304 }
305
306 /***********************************************************************
307 * OleUIObjectPropertiesW (OLEDLG.21)
308 */
309 UINT WINAPI OleUIObjectPropertiesW(
310 LPOLEUIOBJECTPROPSW lpOleUIObjectProps)
311 {
312 FIXME("(%p): stub\n", lpOleUIObjectProps);
313 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
314 return OLEUI_FALSE;
315 }
316
317 /***********************************************************************
318 * OleUIChangeSourceA (OLEDLG.12)
319 */
320 UINT WINAPI OleUIChangeSourceA(
321 LPOLEUICHANGESOURCEA lpOleUIChangeSource)
322 {
323 FIXME("(%p): stub\n", lpOleUIChangeSource);
324 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
325 return OLEUI_FALSE;
326 }
327
328 /***********************************************************************
329 * OleUIChangeSourceW (OLEDLG.17)
330 */
331 UINT WINAPI OleUIChangeSourceW(
332 LPOLEUICHANGESOURCEW lpOleUIChangeSource)
333 {
334 FIXME("(%p): stub\n", lpOleUIChangeSource);
335 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
336 return OLEUI_FALSE;
337 }