inetcomm: Add a stub implementation of the MimeSecurity object.
[wine] / dlls / inetcomm / mimeole.c
1 /*
2  * MIME OLE Interfaces
3  *
4  * Copyright 2006 Robert Shearman for CodeWeavers
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 COBJMACROS
22
23 #include <stdarg.h>
24 #include <stdio.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "objbase.h"
30 #include "ole2.h"
31 #include "mimeole.h"
32
33 #include "wine/debug.h"
34
35 #include "inetcomm_private.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(inetcomm);
38
39 typedef struct MimeMessage
40 {
41     const IMimeMessageVtbl *lpVtbl;
42
43     LONG refs;
44 } MimeMessage;
45
46 static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID riid, void **ppv)
47 {
48     TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
49
50     if (IsEqualIID(riid, &IID_IUnknown) ||
51         IsEqualIID(riid, &IID_IPersist) ||
52         IsEqualIID(riid, &IID_IPersistStreamInit) ||
53         IsEqualIID(riid, &IID_IMimeMessageTree) ||
54         IsEqualIID(riid, &IID_IMimeMessage))
55     {
56         *ppv = iface;
57         IUnknown_AddRef(iface);
58         return S_OK;
59     }
60
61     FIXME("no interface for %s\n", debugstr_guid(riid));
62     *ppv = NULL;
63     return E_NOINTERFACE;
64 }
65
66 static ULONG WINAPI MimeMessage_AddRef(IMimeMessage *iface)
67 {
68     MimeMessage *This = (MimeMessage *)iface;
69     TRACE("(%p)->()\n", iface);
70     return InterlockedIncrement(&This->refs);
71 }
72
73 static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface)
74 {
75     MimeMessage *This = (MimeMessage *)iface;
76     ULONG refs;
77
78     TRACE("(%p)->()\n", iface);
79
80     refs = InterlockedDecrement(&This->refs);
81     if (!refs)
82     {
83         HeapFree(GetProcessHeap(), 0, This);
84     }
85
86     return refs;
87 }
88
89 /*** IPersist methods ***/
90 static HRESULT WINAPI MimeMessage_GetClassID(
91     IMimeMessage *iface,
92     CLSID *pClassID)
93 {
94     FIXME("(%p)->(%p)\n", iface, pClassID);
95     return E_NOTIMPL;
96 }
97
98 /*** IPersistStreamInit methods ***/
99 static HRESULT WINAPI MimeMessage_IsDirty(
100     IMimeMessage *iface)
101 {
102     FIXME("(%p)->()\n", iface);
103     return E_NOTIMPL;
104 }
105
106 static HRESULT WINAPI MimeMessage_Load(
107     IMimeMessage *iface,
108     LPSTREAM pStm){
109     FIXME("(%p)->(%p)\n", iface, pStm);
110     return E_NOTIMPL;
111 }
112
113 static HRESULT WINAPI MimeMessage_Save(
114     IMimeMessage *iface,
115     LPSTREAM pStm,
116     BOOL fClearDirty)
117 {
118     FIXME("(%p)->(%p, %s)\n", iface, pStm, fClearDirty ? "TRUE" : "FALSE");
119     return E_NOTIMPL;
120 }
121
122 static HRESULT WINAPI MimeMessage_GetSizeMax(
123     IMimeMessage *iface,
124     ULARGE_INTEGER *pcbSize)
125 {
126     FIXME("(%p)->(%p)\n", iface, pcbSize);
127     return E_NOTIMPL;
128 }
129
130 static HRESULT WINAPI MimeMessage_InitNew(
131     IMimeMessage *iface)
132 {
133     FIXME("(%p)->()\n", iface);
134     return E_NOTIMPL;
135 }
136
137 /*** IMimeMessageTree methods ***/
138 static HRESULT WINAPI MimeMessage_GetMessageSource(
139     IMimeMessage *iface,
140     IStream **ppStream,
141     DWORD dwFlags)
142 {
143     FIXME("(%p)->(%p, 0x%x)\n", iface, ppStream, dwFlags);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI MimeMessage_GetMessageSize(
148     IMimeMessage *iface,
149     ULONG *pcbSize,
150     DWORD dwFlags)
151 {
152     FIXME("(%p)->(%p, 0x%x)\n", iface, pcbSize, dwFlags);
153     return E_NOTIMPL;
154 }
155
156 static HRESULT WINAPI MimeMessage_LoadOffsetTable(
157     IMimeMessage *iface,
158     IStream *pStream)
159 {
160     FIXME("(%p)->(%p)\n", iface, pStream);
161     return E_NOTIMPL;
162 }
163
164 static HRESULT WINAPI MimeMessage_SaveOffsetTable(
165     IMimeMessage *iface,
166     IStream *pStream,
167     DWORD dwFlags)
168 {
169     FIXME("(%p)->(%p, 0x%x)\n", iface, pStream, dwFlags);
170     return E_NOTIMPL;
171 }
172
173
174 static HRESULT WINAPI MimeMessage_GetFlags(
175     IMimeMessage *iface,
176     DWORD *pdwFlags)
177 {
178     FIXME("(%p)->(%p)\n", iface, pdwFlags);
179     return E_NOTIMPL;
180 }
181
182 static HRESULT WINAPI MimeMessage_Commit(
183     IMimeMessage *iface,
184     DWORD dwFlags)
185 {
186     FIXME("(%p)->(0x%x)\n", iface, dwFlags);
187     return E_NOTIMPL;
188 }
189
190
191 static HRESULT WINAPI MimeMessage_HandsOffStorage(
192     IMimeMessage *iface)
193 {
194     FIXME("(%p)->()\n", iface);
195     return E_NOTIMPL;
196 }
197
198 static HRESULT WINAPI MimeMessage_BindToObject(
199     IMimeMessage *iface,
200     const HBODY hBody,
201     REFIID riid,
202     void **ppvObject)
203 {
204     FIXME("(%p)->(%p, %s, %p)\n", iface, hBody, debugstr_guid(riid), ppvObject);
205     return E_NOTIMPL;
206 }
207
208 static HRESULT WINAPI MimeMessage_SaveBody(
209     IMimeMessage *iface,
210     HBODY hBody,
211     DWORD dwFlags,
212     IStream *pStream)
213 {
214     FIXME("(%p)->(%p, 0x%x, %p)\n", iface, hBody, dwFlags, pStream);
215     return E_NOTIMPL;
216 }
217
218 static HRESULT WINAPI MimeMessage_InsertBody(
219     IMimeMessage *iface,
220     BODYLOCATION location,
221     HBODY hPivot,
222     LPHBODY phBody)
223 {
224     FIXME("(%p)->(%d, %p, %p)\n", iface, location, hPivot, phBody);
225     return E_NOTIMPL;
226 }
227
228 static HRESULT WINAPI MimeMessage_GetBody(
229     IMimeMessage *iface,
230     BODYLOCATION location,
231     HBODY hPivot,
232     LPHBODY phBody)
233 {
234     FIXME("(%p)->(%d, %p, %p)\n", iface, location, hPivot, phBody);
235     return E_NOTIMPL;
236 }
237
238 static HRESULT WINAPI MimeMessage_DeleteBody(
239     IMimeMessage *iface,
240     HBODY hBody,
241     DWORD dwFlags)
242 {
243     FIXME("(%p)->(%p, %08x)\n", iface, hBody, dwFlags);
244     return E_NOTIMPL;
245 }
246
247 static HRESULT WINAPI MimeMessage_MoveBody(
248     IMimeMessage *iface,
249     HBODY hBody,
250     BODYLOCATION location)
251 {
252     FIXME("(%p)->(%d)\n", iface, location);
253     return E_NOTIMPL;
254 }
255
256 static HRESULT WINAPI MimeMessage_CountBodies(
257     IMimeMessage *iface,
258     HBODY hParent,
259     boolean fRecurse,
260     ULONG *pcBodies)
261 {
262     FIXME("(%p)->(%p, %s, %p)\n", iface, hParent, fRecurse ? "TRUE" : "FALSE", pcBodies);
263     return E_NOTIMPL;
264 }
265
266 static HRESULT WINAPI MimeMessage_FindFirst(
267     IMimeMessage *iface,
268     LPFINDBODY pFindBody,
269     LPHBODY phBody)
270 {
271     FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
272     return E_NOTIMPL;
273 }
274
275 static HRESULT WINAPI MimeMessage_FindNext(
276     IMimeMessage *iface,
277     LPFINDBODY pFindBody,
278     LPHBODY phBody)
279 {
280     FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
281     return E_NOTIMPL;
282 }
283
284 static HRESULT WINAPI MimeMessage_ResolveURL(
285     IMimeMessage *iface,
286     HBODY hRelated,
287     LPCSTR pszBase,
288     LPCSTR pszURL,
289     DWORD dwFlags,
290     LPHBODY phBody)
291 {
292     FIXME("(%p)->(%p, %s, %s, 0x%x, %p)\n", iface, hRelated, pszBase, pszURL, dwFlags, phBody);
293     return E_NOTIMPL;
294 }
295
296 static HRESULT WINAPI MimeMessage_ToMultipart(
297     IMimeMessage *iface,
298     HBODY hBody,
299     LPCSTR pszSubType,
300     LPHBODY phMultipart)
301 {
302     FIXME("(%p)->(%p, %s, %p)\n", iface, hBody, pszSubType, phMultipart);
303     return E_NOTIMPL;
304 }
305
306 static HRESULT WINAPI MimeMessage_GetBodyOffsets(
307     IMimeMessage *iface,
308     HBODY hBody,
309     LPBODYOFFSETS pOffsets)
310 {
311     FIXME("(%p)->(%p, %p)\n", iface, hBody, pOffsets);
312     return E_NOTIMPL;
313 }
314
315 static HRESULT WINAPI MimeMessage_GetCharset(
316     IMimeMessage *iface,
317     LPHCHARSET phCharset)
318 {
319     FIXME("(%p)->(%p)\n", iface, phCharset);
320     return E_NOTIMPL;
321 }
322
323 static HRESULT WINAPI MimeMessage_SetCharset(
324     IMimeMessage *iface,
325     HCHARSET hCharset,
326     CSETAPPLYTYPE applytype)
327 {
328     FIXME("(%p)->(%p, %d)\n", iface, hCharset, applytype);
329     return E_NOTIMPL;
330 }
331
332 static HRESULT WINAPI MimeMessage_IsBodyType(
333     IMimeMessage *iface,
334     HBODY hBody,
335     IMSGBODYTYPE bodytype)
336 {
337     FIXME("(%p)->(%p, %d)\n", iface, hBody, bodytype);
338     return E_NOTIMPL;
339 }
340
341 static HRESULT WINAPI MimeMessage_IsContentType(
342     IMimeMessage *iface,
343     HBODY hBody,
344     LPCSTR pszPriType,
345     LPCSTR pszSubType)
346 {
347     FIXME("(%p)->(%p, %s, %s)\n", iface, hBody, pszPriType, pszSubType);
348     return E_NOTIMPL;
349 }
350
351 static HRESULT WINAPI MimeMessage_QueryBodyProp(
352     IMimeMessage *iface,
353     HBODY hBody,
354     LPCSTR pszName,
355     LPCSTR pszCriteria,
356     boolean fSubString,
357     boolean fCaseSensitive)
358 {
359     FIXME("(%p)->(%p, %s, %s, %s, %s)\n", iface, hBody, pszName, pszCriteria, fSubString ? "TRUE" : "FALSE", fCaseSensitive ? "TRUE" : "FALSE");
360     return E_NOTIMPL;
361 }
362
363 static HRESULT WINAPI MimeMessage_GetBodyProp(
364     IMimeMessage *iface,
365     HBODY hBody,
366     LPCSTR pszName,
367     DWORD dwFlags,
368     LPPROPVARIANT pValue)
369 {
370     FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface, hBody, pszName, dwFlags, pValue);
371     return E_NOTIMPL;
372 }
373
374 static HRESULT WINAPI MimeMessage_SetBodyProp(
375     IMimeMessage *iface,
376     HBODY hBody,
377     LPCSTR pszName,
378     DWORD dwFlags,
379     LPCPROPVARIANT pValue)
380 {
381     FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface, hBody, pszName, dwFlags, pValue);
382     return E_NOTIMPL;
383 }
384
385 static HRESULT WINAPI MimeMessage_DeleteBodyProp(
386     IMimeMessage *iface,
387     HBODY hBody,
388     LPCSTR pszName)
389 {
390     FIXME("(%p)->(%p, %s)\n", iface, hBody, pszName);
391     return E_NOTIMPL;
392 }
393
394 static HRESULT WINAPI MimeMessage_SetOption(
395     IMimeMessage *iface,
396     const TYPEDID oid,
397     LPCPROPVARIANT pValue)
398 {
399     FIXME("(%p)->(%d, %p)\n", iface, oid, pValue);
400     return E_NOTIMPL;
401 }
402
403 static HRESULT WINAPI MimeMessage_GetOption(
404     IMimeMessage *iface,
405     const TYPEDID oid,
406     LPPROPVARIANT pValue)
407 {
408     FIXME("(%p)->(%d, %p)\n", iface, oid, pValue);
409     return E_NOTIMPL;
410 }
411
412 /*** IMimeMessage methods ***/
413 static HRESULT WINAPI MimeMessage_CreateWebPage(
414     IMimeMessage *iface,
415     IStream *pRootStm,
416     LPWEBPAGEOPTIONS pOptions,
417     IMimeMessageCallback *pCallback,
418     IMoniker **ppMoniker)
419 {
420     FIXME("(%p)->(%p, %p, %p, %p)\n", iface, pRootStm, pOptions, pCallback, ppMoniker);
421     *ppMoniker = NULL;
422     return E_NOTIMPL;
423 }
424
425 static HRESULT WINAPI MimeMessage_GetProp(
426     IMimeMessage *iface,
427     LPCSTR pszName,
428     DWORD dwFlags,
429     LPPROPVARIANT pValue)
430 {
431     FIXME("(%p)->(%s, 0x%x, %p)\n", iface, pszName, dwFlags, pValue);
432     return E_NOTIMPL;
433 }
434
435 static HRESULT WINAPI MimeMessage_SetProp(
436     IMimeMessage *iface,
437     LPCSTR pszName,
438     DWORD dwFlags,
439     LPCPROPVARIANT pValue)
440 {
441     FIXME("(%p)->(%s, 0x%x, %p)\n", iface, pszName, dwFlags, pValue);
442     return E_NOTIMPL;
443 }
444
445 static HRESULT WINAPI MimeMessage_DeleteProp(
446     IMimeMessage *iface,
447     LPCSTR pszName)
448 {
449     FIXME("(%p)->(%s)\n", iface, pszName);
450     return E_NOTIMPL;
451 }
452
453 static HRESULT WINAPI MimeMessage_QueryProp(
454     IMimeMessage *iface,
455     LPCSTR pszName,
456     LPCSTR pszCriteria,
457     boolean fSubString,
458     boolean fCaseSensitive)
459 {
460     FIXME("(%p)->(%s, %s, %s, %s)\n", iface, pszName, pszCriteria, fSubString ? "TRUE" : "FALSE", fCaseSensitive ? "TRUE" : "FALSE");
461     return E_NOTIMPL;
462 }
463
464 static HRESULT WINAPI MimeMessage_GetTextBody(
465     IMimeMessage *iface,
466     DWORD dwTxtType,
467     ENCODINGTYPE ietEncoding,
468     IStream **pStream,
469     LPHBODY phBody)
470 {
471     FIXME("(%p)->(%d, %d, %p, %p)\n", iface, dwTxtType, ietEncoding, pStream, phBody);
472     return E_NOTIMPL;
473 }
474
475 static HRESULT WINAPI MimeMessage_SetTextBody(
476     IMimeMessage *iface,
477     DWORD dwTxtType,
478     ENCODINGTYPE ietEncoding,
479     HBODY hAlternative,
480     IStream *pStream,
481     LPHBODY phBody)
482 {
483     FIXME("(%p)->(%d, %d, %p, %p, %p)\n", iface, dwTxtType, ietEncoding, hAlternative, pStream, phBody);
484     return E_NOTIMPL;
485 }
486
487 static HRESULT WINAPI MimeMessage_AttachObject(
488     IMimeMessage *iface,
489     REFIID riid,
490     void *pvObject,
491     LPHBODY phBody)
492 {
493     FIXME("(%p)->(%s, %p, %p)\n", iface, debugstr_guid(riid), pvObject, phBody);
494     return E_NOTIMPL;
495 }
496
497 static HRESULT WINAPI MimeMessage_AttachFile(
498     IMimeMessage *iface,
499     LPCSTR pszFilePath,
500     IStream *pstmFile,
501     LPHBODY phBody)
502 {
503     FIXME("(%p)->(%s, %p, %p)\n", iface, pszFilePath, pstmFile, phBody);
504     return E_NOTIMPL;
505 }
506
507 static HRESULT WINAPI MimeMessage_AttachURL(
508     IMimeMessage *iface,
509     LPCSTR pszBase,
510     LPCSTR pszURL,
511     DWORD dwFlags,
512     IStream *pstmURL,
513     LPSTR *ppszCIDURL,
514     LPHBODY phBody)
515 {
516     FIXME("(%p)->(%s, %s, 0x%x, %p, %p, %p)\n", iface, pszBase, pszURL, dwFlags, pstmURL, ppszCIDURL, phBody);
517     return E_NOTIMPL;
518 }
519
520 static HRESULT WINAPI MimeMessage_GetAttachments(
521     IMimeMessage *iface,
522     ULONG *pcAttach,
523     LPHBODY *pprghAttach)
524 {
525     FIXME("(%p)->(%p, %p)\n", iface, pcAttach, pprghAttach);
526     return E_NOTIMPL;
527 }
528
529 static HRESULT WINAPI MimeMessage_GetAddressTable(
530     IMimeMessage *iface,
531     IMimeAddressTable **ppTable)
532 {
533     FIXME("(%p)->(%p)\n", iface, ppTable);
534     return E_NOTIMPL;
535 }
536
537 static HRESULT WINAPI MimeMessage_GetSender(
538     IMimeMessage *iface,
539     LPADDRESSPROPS pAddress)
540 {
541     FIXME("(%p)->(%p)\n", iface, pAddress);
542     return E_NOTIMPL;
543 }
544
545 static HRESULT WINAPI MimeMessage_GetAddressTypes(
546     IMimeMessage *iface,
547     DWORD dwAdrTypes,
548     DWORD dwProps,
549     LPADDRESSLIST pList)
550 {
551     FIXME("(%p)->(%d, %d, %p)\n", iface, dwAdrTypes, dwProps, pList);
552     return E_NOTIMPL;
553 }
554
555 static HRESULT WINAPI MimeMessage_GetAddressFormat(
556     IMimeMessage *iface,
557     DWORD dwAdrTypes,
558     ADDRESSFORMAT format,
559     LPSTR *ppszFormat)
560 {
561     FIXME("(%p)->(%d, %d, %p)\n", iface, dwAdrTypes, format, ppszFormat);
562     return E_NOTIMPL;
563 }
564
565 static HRESULT WINAPI MimeMessage_EnumAddressTypes(
566     IMimeMessage *iface,
567     DWORD dwAdrTypes,
568     DWORD dwProps,
569     IMimeEnumAddressTypes **ppEnum)
570 {
571     FIXME("(%p)->(%d, %d, %p)\n", iface, dwAdrTypes, dwProps, ppEnum);
572     return E_NOTIMPL;
573 }
574
575 static HRESULT WINAPI MimeMessage_SplitMessage(
576     IMimeMessage *iface,
577     ULONG cbMaxPart,
578     IMimeMessageParts **ppParts)
579 {
580     FIXME("(%p)->(%d, %p)\n", iface, cbMaxPart, ppParts);
581     return E_NOTIMPL;
582 }
583
584 static HRESULT WINAPI MimeMessage_GetRootMoniker(
585     IMimeMessage *iface,
586     IMoniker **ppMoniker)
587 {
588     FIXME("(%p)->(%p)\n", iface, ppMoniker);
589     return E_NOTIMPL;
590 }
591
592 static const IMimeMessageVtbl MimeMessageVtbl =
593 {
594     MimeMessage_QueryInterface,
595     MimeMessage_AddRef,
596     MimeMessage_Release,
597     MimeMessage_GetClassID,
598     MimeMessage_IsDirty,
599     MimeMessage_Load,
600     MimeMessage_Save,
601     MimeMessage_GetSizeMax,
602     MimeMessage_InitNew,
603     MimeMessage_GetMessageSource,
604     MimeMessage_GetMessageSize,
605     MimeMessage_LoadOffsetTable,
606     MimeMessage_SaveOffsetTable,
607     MimeMessage_GetFlags,
608     MimeMessage_Commit,
609     MimeMessage_HandsOffStorage,
610     MimeMessage_BindToObject,
611     MimeMessage_SaveBody,
612     MimeMessage_InsertBody,
613     MimeMessage_GetBody,
614     MimeMessage_DeleteBody,
615     MimeMessage_MoveBody,
616     MimeMessage_CountBodies,
617     MimeMessage_FindFirst,
618     MimeMessage_FindNext,
619     MimeMessage_ResolveURL,
620     MimeMessage_ToMultipart,
621     MimeMessage_GetBodyOffsets,
622     MimeMessage_GetCharset,
623     MimeMessage_SetCharset,
624     MimeMessage_IsBodyType,
625     MimeMessage_IsContentType,
626     MimeMessage_QueryBodyProp,
627     MimeMessage_GetBodyProp,
628     MimeMessage_SetBodyProp,
629     MimeMessage_DeleteBodyProp,
630     MimeMessage_SetOption,
631     MimeMessage_GetOption,
632     MimeMessage_CreateWebPage,
633     MimeMessage_GetProp,
634     MimeMessage_SetProp,
635     MimeMessage_DeleteProp,
636     MimeMessage_QueryProp,
637     MimeMessage_GetTextBody,
638     MimeMessage_SetTextBody,
639     MimeMessage_AttachObject,
640     MimeMessage_AttachFile,
641     MimeMessage_AttachURL,
642     MimeMessage_GetAttachments,
643     MimeMessage_GetAddressTable,
644     MimeMessage_GetSender,
645     MimeMessage_GetAddressTypes,
646     MimeMessage_GetAddressFormat,
647     MimeMessage_EnumAddressTypes,
648     MimeMessage_SplitMessage,
649     MimeMessage_GetRootMoniker,
650 };
651
652 /***********************************************************************
653  *              MimeOleCreateMessage (INETCOMM.@)
654  */
655 HRESULT WINAPI MimeOleCreateMessage(IUnknown *pUnkOuter, IMimeMessage **ppMessage)
656 {
657     MimeMessage *This;
658
659     TRACE("(%p, %p)\n", pUnkOuter, ppMessage);
660
661     if (pUnkOuter)
662     {
663         FIXME("outer unknown not supported yet\n");
664         return E_NOTIMPL;
665     }
666
667     *ppMessage = NULL;
668
669     This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
670     if (!This) return E_OUTOFMEMORY;
671
672     This->lpVtbl = &MimeMessageVtbl;
673     This->refs = 1;
674
675     *ppMessage = (IMimeMessage *)&This->lpVtbl;
676     return S_OK;
677 }
678
679 /***********************************************************************
680  *              MimeOleSetCompatMode (INETCOMM.@)
681  */
682 HRESULT WINAPI MimeOleSetCompatMode(DWORD dwMode)
683 {
684     FIXME("(0x%x)\n", dwMode);
685     return S_OK;
686 }
687
688 /***********************************************************************
689  *              MimeOleCreateVirtualStream (INETCOMM.@)
690  */
691 HRESULT WINAPI MimeOleCreateVirtualStream(IStream **ppStream)
692 {
693     HRESULT hr;
694     FIXME("(%p)\n", ppStream);
695
696     hr = CreateStreamOnHGlobal(NULL, TRUE, ppStream);
697     return hr;
698 }
699
700 typedef struct MimeSecurity
701 {
702     const IMimeSecurityVtbl *lpVtbl;
703
704     LONG refs;
705 } MimeSecurity;
706
707 static HRESULT WINAPI MimeSecurity_QueryInterface(
708         IMimeSecurity* iface,
709         REFIID riid,
710         void** obj)
711 {
712     TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), obj);
713
714     if (IsEqualIID(riid, &IID_IUnknown) ||
715         IsEqualIID(riid, &IID_IMimeSecurity))
716     {
717         *obj = iface;
718         IUnknown_AddRef(iface);
719         return S_OK;
720     }
721
722     FIXME("no interface for %s\n", debugstr_guid(riid));
723     *obj = NULL;
724     return E_NOINTERFACE;
725 }
726
727 static ULONG WINAPI MimeSecurity_AddRef(
728         IMimeSecurity* iface)
729 {
730     MimeSecurity *This = (MimeSecurity *)iface;
731     TRACE("(%p)->()\n", iface);
732     return InterlockedIncrement(&This->refs);
733 }
734
735 static ULONG WINAPI MimeSecurity_Release(
736         IMimeSecurity* iface)
737 {
738     MimeSecurity *This = (MimeSecurity *)iface;
739     ULONG refs;
740
741     TRACE("(%p)->()\n", iface);
742
743     refs = InterlockedDecrement(&This->refs);
744     if (!refs)
745     {
746         HeapFree(GetProcessHeap(), 0, This);
747     }
748
749     return refs;
750 }
751
752 static HRESULT WINAPI MimeSecurity_InitNew(
753         IMimeSecurity* iface)
754 {
755     FIXME("(%p)->(): stub\n", iface);
756     return S_OK;
757 }
758
759 static HRESULT WINAPI MimeSecurity_CheckInit(
760         IMimeSecurity* iface)
761 {
762     FIXME("(%p)->(): stub\n", iface);
763     return E_NOTIMPL;
764 }
765
766 static HRESULT WINAPI MimeSecurity_EncodeMessage(
767         IMimeSecurity* iface,
768         IMimeMessageTree* pTree,
769         DWORD dwFlags)
770 {
771     FIXME("(%p)->(%p, %08x): stub\n", iface, pTree, dwFlags);
772     return E_NOTIMPL;
773 }
774
775 static HRESULT WINAPI MimeSecurity_EncodeBody(
776         IMimeSecurity* iface,
777         IMimeMessageTree* pTree,
778         HBODY hEncodeRoot,
779         DWORD dwFlags)
780 {
781     FIXME("(%p)->(%p, %p, %08x): stub\n", iface, pTree, hEncodeRoot, dwFlags);
782     return E_NOTIMPL;
783 }
784
785 static HRESULT WINAPI MimeSecurity_DecodeMessage(
786         IMimeSecurity* iface,
787         IMimeMessageTree* pTree,
788         DWORD dwFlags)
789 {
790     FIXME("(%p)->(%p, %08x): stub\n", iface, pTree, dwFlags);
791     return E_NOTIMPL;
792 }
793
794 static HRESULT WINAPI MimeSecurity_DecodeBody(
795         IMimeSecurity* iface,
796         IMimeMessageTree* pTree,
797         HBODY hDecodeRoot,
798         DWORD dwFlags)
799 {
800     FIXME("(%p)->(%p, %p, %08x): stub\n", iface, pTree, hDecodeRoot, dwFlags);
801     return E_NOTIMPL;
802 }
803
804 static HRESULT WINAPI MimeSecurity_EnumCertificates(
805         IMimeSecurity* iface,
806         HCAPICERTSTORE hc,
807         DWORD dwUsage,
808         PCX509CERT pPrev,
809         PCX509CERT* ppCert)
810 {
811     FIXME("(%p)->(%p, %08x, %p, %p): stub\n", iface, hc, dwUsage, pPrev, ppCert);
812     return E_NOTIMPL;
813 }
814
815 static HRESULT WINAPI MimeSecurity_GetCertificateName(
816         IMimeSecurity* iface,
817         const PCX509CERT pX509Cert,
818         const CERTNAMETYPE cn,
819         LPSTR* ppszName)
820 {
821     FIXME("(%p)->(%p, %08x, %p): stub\n", iface, pX509Cert, cn, ppszName);
822     return E_NOTIMPL;
823 }
824
825 static HRESULT WINAPI MimeSecurity_GetMessageType(
826         IMimeSecurity* iface,
827         const HWND hwndParent,
828         IMimeBody* pBody,
829         DWORD* pdwSecType)
830 {
831     FIXME("(%p)->(%p, %p, %p): stub\n", iface, hwndParent, pBody, pdwSecType);
832     return E_NOTIMPL;
833 }
834
835 static HRESULT WINAPI MimeSecurity_GetCertData(
836         IMimeSecurity* iface,
837         const PCX509CERT pX509Cert,
838         const CERTDATAID dataid,
839         LPPROPVARIANT pValue)
840 {
841     FIXME("(%p)->(%p, %x, %p): stub\n", iface, pX509Cert, dataid, pValue);
842     return E_NOTIMPL;
843 }
844
845
846 static const IMimeSecurityVtbl MimeSecurityVtbl =
847 {
848     MimeSecurity_QueryInterface,
849     MimeSecurity_AddRef,
850     MimeSecurity_Release,
851     MimeSecurity_InitNew,
852     MimeSecurity_CheckInit,
853     MimeSecurity_EncodeMessage,
854     MimeSecurity_EncodeBody,
855     MimeSecurity_DecodeMessage,
856     MimeSecurity_DecodeBody,
857     MimeSecurity_EnumCertificates,
858     MimeSecurity_GetCertificateName,
859     MimeSecurity_GetMessageType,
860     MimeSecurity_GetCertData
861 };
862
863 /***********************************************************************
864  *              MimeOleCreateSecurity (INETCOMM.@)
865  */
866 HRESULT WINAPI MimeOleCreateSecurity(IMimeSecurity **ppSecurity)
867 {
868     MimeSecurity *This;
869
870     TRACE("(%p)\n", ppSecurity);
871
872     *ppSecurity = NULL;
873
874     This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
875     if (!This) return E_OUTOFMEMORY;
876
877     This->lpVtbl = &MimeSecurityVtbl;
878     This->refs = 1;
879
880     *ppSecurity = (IMimeSecurity *)&This->lpVtbl;
881     return S_OK;
882 }