inetcomm: Implement IMimeBody:[G|S]etCurrentEncoding.
[wine/wine64.git] / dlls / inetcomm / mimeole.c
blob685356cfe889cc15393ab57010f8ee11b2c9c4e9
1 /*
2 * MIME OLE Interfaces
4 * Copyright 2006 Robert Shearman for CodeWeavers
5 * Copyright 2007 Huw Davies for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define COBJMACROS
24 #include <stdarg.h>
25 #include <stdio.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "objbase.h"
31 #include "ole2.h"
32 #include "mimeole.h"
34 #include "wine/list.h"
35 #include "wine/debug.h"
37 #include "inetcomm_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(inetcomm);
41 typedef struct
43 LPCSTR name;
44 DWORD id;
45 DWORD flags; /* MIMEPROPFLAGS */
46 VARTYPE default_vt;
47 } property_t;
49 typedef struct
51 struct list entry;
52 property_t prop;
53 } property_list_entry_t;
55 static const property_t default_props[] =
57 {"References", PID_HDR_REFS, 0, VT_LPSTR},
58 {"Subject", PID_HDR_SUBJECT, 0, VT_LPSTR},
59 {"From", PID_HDR_FROM, MPF_ADDRESS, VT_LPSTR},
60 {"Message-ID", PID_HDR_MESSAGEID, 0, VT_LPSTR},
61 {"Return-Path", PID_HDR_RETURNPATH, MPF_ADDRESS, VT_LPSTR},
62 {"Date", PID_HDR_DATE, 0, VT_LPSTR},
63 {"Received", PID_HDR_RECEIVED, 0, VT_LPSTR},
64 {"Reply-To", PID_HDR_REPLYTO, MPF_ADDRESS, VT_LPSTR},
65 {"X-Mailer", PID_HDR_XMAILER, 0, VT_LPSTR},
66 {"Bcc", PID_HDR_BCC, MPF_ADDRESS, VT_LPSTR},
67 {"MIME-Version", PID_HDR_MIMEVER, MPF_MIME, VT_LPSTR},
68 {"Content-Type", PID_HDR_CNTTYPE, MPF_MIME | MPF_HASPARAMS, VT_LPSTR},
69 {"Content-Transfer-Encoding", PID_HDR_CNTXFER, MPF_MIME, VT_LPSTR},
70 {"Content-ID", PID_HDR_CNTID, MPF_MIME, VT_LPSTR},
71 {"Content-Disposition", PID_HDR_CNTDISP, MPF_MIME, VT_LPSTR},
72 {"To", PID_HDR_TO, MPF_ADDRESS, VT_LPSTR},
73 {"Cc", PID_HDR_CC, MPF_ADDRESS, VT_LPSTR},
74 {"Sender", PID_HDR_SENDER, MPF_ADDRESS, VT_LPSTR},
75 {"In-Reply-To", PID_HDR_INREPLYTO, 0, VT_LPSTR},
76 {NULL, 0, 0, 0}
79 typedef struct
81 struct list entry;
82 char *name;
83 char *value;
84 } param_t;
86 typedef struct
88 struct list entry;
89 const property_t *prop;
90 PROPVARIANT value;
91 struct list params;
92 } header_t;
94 typedef struct MimeBody
96 const IMimeBodyVtbl *lpVtbl;
97 LONG refs;
99 HBODY handle;
101 struct list headers;
102 struct list new_props; /* FIXME: This should be in a PropertySchema */
103 DWORD next_prop_id;
104 char *content_pri_type;
105 char *content_sub_type;
106 ENCODINGTYPE encoding;
107 } MimeBody;
109 static inline MimeBody *impl_from_IMimeBody( IMimeBody *iface )
111 return (MimeBody *)((char*)iface - FIELD_OFFSET(MimeBody, lpVtbl));
114 static LPSTR strdupA(LPCSTR str)
116 char *ret;
117 int len = strlen(str);
118 ret = HeapAlloc(GetProcessHeap(), 0, len + 1);
119 memcpy(ret, str, len + 1);
120 return ret;
123 #define PARSER_BUF_SIZE 1024
125 /*****************************************************
126 * copy_headers_to_buf [internal]
128 * Copies the headers into a '\0' terminated memory block and leave
129 * the stream's current position set to after the blank line.
131 static HRESULT copy_headers_to_buf(IStream *stm, char **ptr)
133 char *buf = NULL;
134 DWORD size = PARSER_BUF_SIZE, offset = 0, last_end = 0;
135 HRESULT hr;
136 int done = 0;
138 *ptr = NULL;
142 char *end;
143 DWORD read;
145 if(!buf)
146 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
147 else
149 size *= 2;
150 buf = HeapReAlloc(GetProcessHeap(), 0, buf, size + 1);
152 if(!buf)
154 hr = E_OUTOFMEMORY;
155 goto fail;
158 hr = IStream_Read(stm, buf + offset, size - offset, &read);
159 if(FAILED(hr)) goto fail;
161 offset += read;
162 buf[offset] = '\0';
164 if(read == 0) done = 1;
166 while(!done && (end = strstr(buf + last_end, "\r\n")))
168 DWORD new_end = end - buf + 2;
169 if(new_end - last_end == 2)
171 LARGE_INTEGER off;
172 off.QuadPart = new_end;
173 IStream_Seek(stm, off, STREAM_SEEK_SET, NULL);
174 buf[new_end] = '\0';
175 done = 1;
177 else
178 last_end = new_end;
180 } while(!done);
182 *ptr = buf;
183 return S_OK;
185 fail:
186 HeapFree(GetProcessHeap(), 0, buf);
187 return hr;
190 static header_t *read_prop(MimeBody *body, char **ptr)
192 char *colon = strchr(*ptr, ':');
193 const property_t *prop;
194 header_t *ret;
196 if(!colon) return NULL;
198 *colon = '\0';
200 for(prop = default_props; prop->name; prop++)
202 if(!strcasecmp(*ptr, prop->name))
204 TRACE("%s: found match with default property id %d\n", *ptr, prop->id);
205 break;
209 if(!prop->name)
211 property_list_entry_t *prop_entry;
212 LIST_FOR_EACH_ENTRY(prop_entry, &body->new_props, property_list_entry_t, entry)
214 if(!strcasecmp(*ptr, prop_entry->prop.name))
216 TRACE("%s: found match with already added new property id %d\n", *ptr, prop_entry->prop.id);
217 prop = &prop_entry->prop;
218 break;
221 if(!prop->name)
223 prop_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*prop_entry));
224 prop_entry->prop.name = strdupA(*ptr);
225 prop_entry->prop.id = body->next_prop_id++;
226 prop_entry->prop.flags = 0;
227 prop_entry->prop.default_vt = VT_LPSTR;
228 list_add_tail(&body->new_props, &prop_entry->entry);
229 prop = &prop_entry->prop;
230 TRACE("%s: allocating new prop id %d\n", *ptr, prop_entry->prop.id);
234 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret));
235 ret->prop = prop;
236 PropVariantInit(&ret->value);
237 list_init(&ret->params);
238 *ptr = colon + 1;
240 return ret;
243 static void unfold_header(char *header, int len)
245 char *start = header, *cp = header;
247 do {
248 while(*cp == ' ' || *cp == '\t')
250 cp++;
251 len--;
253 if(cp != start)
254 memmove(start, cp, len + 1);
256 cp = strstr(start, "\r\n");
257 len -= (cp - start);
258 start = cp;
259 *start = ' ';
260 start++;
261 len--;
262 cp += 2;
263 } while(*cp == ' ' || *cp == '\t');
265 *(start - 1) = '\0';
268 static void add_param(header_t *header, const char *p)
270 const char *key = p, *value, *cp = p;
271 param_t *param;
272 char *name;
274 TRACE("got param %s\n", p);
276 while (*key == ' ' || *key == '\t' ) key++;
278 cp = strchr(key, '=');
279 if(!cp)
281 WARN("malformed parameter - skipping\n");
282 return;
285 name = HeapAlloc(GetProcessHeap(), 0, cp - key + 1);
286 memcpy(name, key, cp - key);
287 name[cp - key] = '\0';
289 value = cp + 1;
291 param = HeapAlloc(GetProcessHeap(), 0, sizeof(*param));
292 param->name = name;
293 param->value = strdupA(value);
294 list_add_tail(&header->params, &param->entry);
297 static void split_params(header_t *header, char *value)
299 char *cp = value, *start = value;
300 int in_quote = 0;
301 int done_value = 0;
303 while(*cp)
305 if(!in_quote && *cp == ';')
307 *cp = '\0';
308 if(done_value) add_param(header, start);
309 done_value = 1;
310 start = cp + 1;
312 else if(*cp == '"')
313 in_quote = !in_quote;
314 cp++;
316 if(done_value) add_param(header, start);
319 static void read_value(header_t *header, char **cur)
321 char *end = *cur, *value;
322 DWORD len;
324 do {
325 end = strstr(end, "\r\n");
326 end += 2;
327 } while(*end == ' ' || *end == '\t');
329 len = end - *cur;
330 value = HeapAlloc(GetProcessHeap(), 0, len + 1);
331 memcpy(value, *cur, len);
332 value[len] = '\0';
334 unfold_header(value, len);
335 TRACE("value %s\n", debugstr_a(value));
337 if(header->prop->flags & MPF_HASPARAMS)
339 split_params(header, value);
340 TRACE("value w/o params %s\n", debugstr_a(value));
343 header->value.vt = VT_LPSTR;
344 header->value.pszVal = value;
346 *cur = end;
349 static void init_content_type(MimeBody *body, header_t *header)
351 char *slash;
352 DWORD len;
354 if(header->prop->id != PID_HDR_CNTTYPE)
356 ERR("called with header %s\n", header->prop->name);
357 return;
360 slash = strchr(header->value.pszVal, '/');
361 if(!slash)
363 WARN("malformed context type value\n");
364 return;
366 len = slash - header->value.pszVal;
367 body->content_pri_type = HeapAlloc(GetProcessHeap(), 0, len + 1);
368 memcpy(body->content_pri_type, header->value.pszVal, len);
369 body->content_pri_type[len] = '\0';
370 body->content_sub_type = strdupA(slash + 1);
373 static HRESULT parse_headers(MimeBody *body, IStream *stm)
375 char *header_buf, *cur_header_ptr;
376 HRESULT hr;
377 header_t *header;
379 hr = copy_headers_to_buf(stm, &header_buf);
380 if(FAILED(hr)) return hr;
382 cur_header_ptr = header_buf;
383 while((header = read_prop(body, &cur_header_ptr)))
385 read_value(header, &cur_header_ptr);
386 list_add_tail(&body->headers, &header->entry);
388 if(header->prop->id == PID_HDR_CNTTYPE)
389 init_content_type(body, header);
392 HeapFree(GetProcessHeap(), 0, header_buf);
393 return hr;
396 static void emptry_param_list(struct list *list)
398 param_t *param, *cursor2;
400 LIST_FOR_EACH_ENTRY_SAFE(param, cursor2, list, param_t, entry)
402 list_remove(&param->entry);
403 HeapFree(GetProcessHeap(), 0, param->name);
404 HeapFree(GetProcessHeap(), 0, param->value);
405 HeapFree(GetProcessHeap(), 0, param);
409 static void empty_header_list(struct list *list)
411 header_t *header, *cursor2;
413 LIST_FOR_EACH_ENTRY_SAFE(header, cursor2, list, header_t, entry)
415 list_remove(&header->entry);
416 PropVariantClear(&header->value);
417 emptry_param_list(&header->params);
418 HeapFree(GetProcessHeap(), 0, header);
422 static void empty_new_prop_list(struct list *list)
424 property_list_entry_t *prop, *cursor2;
426 LIST_FOR_EACH_ENTRY_SAFE(prop, cursor2, list, property_list_entry_t, entry)
428 list_remove(&prop->entry);
429 HeapFree(GetProcessHeap(), 0, (char *)prop->prop.name);
430 HeapFree(GetProcessHeap(), 0, prop);
434 static HRESULT WINAPI MimeBody_QueryInterface(IMimeBody* iface,
435 REFIID riid,
436 void** ppvObject)
438 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppvObject);
440 *ppvObject = NULL;
442 if (IsEqualIID(riid, &IID_IUnknown) ||
443 IsEqualIID(riid, &IID_IPersist) ||
444 IsEqualIID(riid, &IID_IPersistStreamInit) ||
445 IsEqualIID(riid, &IID_IMimePropertySet) ||
446 IsEqualIID(riid, &IID_IMimeBody))
448 *ppvObject = iface;
451 if(*ppvObject)
453 IUnknown_AddRef((IUnknown*)*ppvObject);
454 return S_OK;
457 FIXME("no interface for %s\n", debugstr_guid(riid));
458 return E_NOINTERFACE;
461 static ULONG WINAPI MimeBody_AddRef(IMimeBody* iface)
463 MimeBody *This = impl_from_IMimeBody(iface);
464 TRACE("(%p)->()\n", iface);
465 return InterlockedIncrement(&This->refs);
468 static ULONG WINAPI MimeBody_Release(IMimeBody* iface)
470 MimeBody *This = impl_from_IMimeBody(iface);
471 ULONG refs;
473 TRACE("(%p)->()\n", iface);
475 refs = InterlockedDecrement(&This->refs);
476 if (!refs)
478 empty_header_list(&This->headers);
479 empty_new_prop_list(&This->new_props);
481 HeapFree(GetProcessHeap(), 0, This->content_pri_type);
482 HeapFree(GetProcessHeap(), 0, This->content_sub_type);
483 HeapFree(GetProcessHeap(), 0, This);
486 return refs;
489 static HRESULT WINAPI MimeBody_GetClassID(
490 IMimeBody* iface,
491 CLSID* pClassID)
493 FIXME("stub\n");
494 return E_NOTIMPL;
498 static HRESULT WINAPI MimeBody_IsDirty(
499 IMimeBody* iface)
501 FIXME("stub\n");
502 return E_NOTIMPL;
505 static HRESULT WINAPI MimeBody_Load(
506 IMimeBody* iface,
507 LPSTREAM pStm)
509 MimeBody *This = impl_from_IMimeBody(iface);
510 TRACE("(%p)->(%p)\n", iface, pStm);
511 return parse_headers(This, pStm);
514 static HRESULT WINAPI MimeBody_Save(
515 IMimeBody* iface,
516 LPSTREAM pStm,
517 BOOL fClearDirty)
519 FIXME("stub\n");
520 return E_NOTIMPL;
523 static HRESULT WINAPI MimeBody_GetSizeMax(
524 IMimeBody* iface,
525 ULARGE_INTEGER* pcbSize)
527 FIXME("stub\n");
528 return E_NOTIMPL;
531 static HRESULT WINAPI MimeBody_InitNew(
532 IMimeBody* iface)
534 TRACE("%p->()\n", iface);
535 return S_OK;
538 static HRESULT WINAPI MimeBody_GetPropInfo(
539 IMimeBody* iface,
540 LPCSTR pszName,
541 LPMIMEPROPINFO pInfo)
543 FIXME("stub\n");
544 return E_NOTIMPL;
547 static HRESULT WINAPI MimeBody_SetPropInfo(
548 IMimeBody* iface,
549 LPCSTR pszName,
550 LPCMIMEPROPINFO pInfo)
552 FIXME("stub\n");
553 return E_NOTIMPL;
556 static HRESULT WINAPI MimeBody_GetProp(
557 IMimeBody* iface,
558 LPCSTR pszName,
559 DWORD dwFlags,
560 LPPROPVARIANT pValue)
562 FIXME("stub\n");
563 return E_NOTIMPL;
566 static HRESULT WINAPI MimeBody_SetProp(
567 IMimeBody* iface,
568 LPCSTR pszName,
569 DWORD dwFlags,
570 LPCPROPVARIANT pValue)
572 FIXME("stub\n");
573 return E_NOTIMPL;
576 static HRESULT WINAPI MimeBody_AppendProp(
577 IMimeBody* iface,
578 LPCSTR pszName,
579 DWORD dwFlags,
580 LPPROPVARIANT pValue)
582 FIXME("stub\n");
583 return E_NOTIMPL;
586 static HRESULT WINAPI MimeBody_DeleteProp(
587 IMimeBody* iface,
588 LPCSTR pszName)
590 FIXME("stub\n");
591 return E_NOTIMPL;
594 static HRESULT WINAPI MimeBody_CopyProps(
595 IMimeBody* iface,
596 ULONG cNames,
597 LPCSTR* prgszName,
598 IMimePropertySet* pPropertySet)
600 FIXME("stub\n");
601 return E_NOTIMPL;
604 static HRESULT WINAPI MimeBody_MoveProps(
605 IMimeBody* iface,
606 ULONG cNames,
607 LPCSTR* prgszName,
608 IMimePropertySet* pPropertySet)
610 FIXME("stub\n");
611 return E_NOTIMPL;
614 static HRESULT WINAPI MimeBody_DeleteExcept(
615 IMimeBody* iface,
616 ULONG cNames,
617 LPCSTR* prgszName)
619 FIXME("stub\n");
620 return E_NOTIMPL;
623 static HRESULT WINAPI MimeBody_QueryProp(
624 IMimeBody* iface,
625 LPCSTR pszName,
626 LPCSTR pszCriteria,
627 boolean fSubString,
628 boolean fCaseSensitive)
630 FIXME("stub\n");
631 return E_NOTIMPL;
634 static HRESULT WINAPI MimeBody_GetCharset(
635 IMimeBody* iface,
636 LPHCHARSET phCharset)
638 FIXME("stub\n");
639 return E_NOTIMPL;
642 static HRESULT WINAPI MimeBody_SetCharset(
643 IMimeBody* iface,
644 HCHARSET hCharset,
645 CSETAPPLYTYPE applytype)
647 FIXME("stub\n");
648 return E_NOTIMPL;
651 static HRESULT WINAPI MimeBody_GetParameters(
652 IMimeBody* iface,
653 LPCSTR pszName,
654 ULONG* pcParams,
655 LPMIMEPARAMINFO* pprgParam)
657 FIXME("stub\n");
658 return E_NOTIMPL;
661 static HRESULT WINAPI MimeBody_IsContentType(
662 IMimeBody* iface,
663 LPCSTR pszPriType,
664 LPCSTR pszSubType)
666 MimeBody *This = impl_from_IMimeBody(iface);
668 TRACE("(%p)->(%s, %s)\n", This, debugstr_a(pszPriType), debugstr_a(pszSubType));
669 if(pszPriType)
671 const char *pri = This->content_pri_type;
672 if(!pri) pri = "text";
673 if(strcasecmp(pri, pszPriType)) return S_FALSE;
676 if(pszSubType)
678 const char *sub = This->content_sub_type;
679 if(!sub) sub = "plain";
680 if(strcasecmp(sub, pszSubType)) return S_FALSE;
683 return S_OK;
686 static HRESULT WINAPI MimeBody_BindToObject(
687 IMimeBody* iface,
688 REFIID riid,
689 void** ppvObject)
691 FIXME("stub\n");
692 return E_NOTIMPL;
695 static HRESULT WINAPI MimeBody_Clone(
696 IMimeBody* iface,
697 IMimePropertySet** ppPropertySet)
699 FIXME("stub\n");
700 return E_NOTIMPL;
703 static HRESULT WINAPI MimeBody_SetOption(
704 IMimeBody* iface,
705 const TYPEDID oid,
706 LPCPROPVARIANT pValue)
708 FIXME("stub\n");
709 return E_NOTIMPL;
712 static HRESULT WINAPI MimeBody_GetOption(
713 IMimeBody* iface,
714 const TYPEDID oid,
715 LPPROPVARIANT pValue)
717 FIXME("stub\n");
718 return E_NOTIMPL;
721 static HRESULT WINAPI MimeBody_EnumProps(
722 IMimeBody* iface,
723 DWORD dwFlags,
724 IMimeEnumProperties** ppEnum)
726 FIXME("stub\n");
727 return E_NOTIMPL;
730 static HRESULT WINAPI MimeBody_IsType(
731 IMimeBody* iface,
732 IMSGBODYTYPE bodytype)
734 FIXME("stub\n");
735 return E_NOTIMPL;
738 static HRESULT WINAPI MimeBody_SetDisplayName(
739 IMimeBody* iface,
740 LPCSTR pszDisplay)
742 FIXME("stub\n");
743 return E_NOTIMPL;
746 static HRESULT WINAPI MimeBody_GetDisplayName(
747 IMimeBody* iface,
748 LPSTR* ppszDisplay)
750 FIXME("stub\n");
751 return E_NOTIMPL;
754 static HRESULT WINAPI MimeBody_GetOffsets(
755 IMimeBody* iface,
756 LPBODYOFFSETS pOffsets)
758 FIXME("stub\n");
759 return E_NOTIMPL;
762 static HRESULT WINAPI MimeBody_GetCurrentEncoding(
763 IMimeBody* iface,
764 ENCODINGTYPE* pietEncoding)
766 MimeBody *This = impl_from_IMimeBody(iface);
768 TRACE("(%p)->(%p)\n", This, pietEncoding);
770 *pietEncoding = This->encoding;
771 return S_OK;
774 static HRESULT WINAPI MimeBody_SetCurrentEncoding(
775 IMimeBody* iface,
776 ENCODINGTYPE ietEncoding)
778 MimeBody *This = impl_from_IMimeBody(iface);
780 TRACE("(%p)->(%d)\n", This, ietEncoding);
782 This->encoding = ietEncoding;
783 return S_OK;
786 static HRESULT WINAPI MimeBody_GetEstimatedSize(
787 IMimeBody* iface,
788 ENCODINGTYPE ietEncoding,
789 ULONG* pcbSize)
791 FIXME("stub\n");
792 return E_NOTIMPL;
795 static HRESULT WINAPI MimeBody_GetDataHere(
796 IMimeBody* iface,
797 ENCODINGTYPE ietEncoding,
798 IStream* pStream)
800 FIXME("stub\n");
801 return E_NOTIMPL;
804 static HRESULT WINAPI MimeBody_GetData(
805 IMimeBody* iface,
806 ENCODINGTYPE ietEncoding,
807 IStream** ppStream)
809 FIXME("stub\n");
810 return E_NOTIMPL;
813 static HRESULT WINAPI MimeBody_SetData(
814 IMimeBody* iface,
815 ENCODINGTYPE ietEncoding,
816 LPCSTR pszPriType,
817 LPCSTR pszSubType,
818 REFIID riid,
819 LPVOID pvObject)
821 FIXME("stub\n");
822 return E_NOTIMPL;
825 static HRESULT WINAPI MimeBody_EmptyData(
826 IMimeBody* iface)
828 FIXME("stub\n");
829 return E_NOTIMPL;
832 static HRESULT WINAPI MimeBody_CopyTo(
833 IMimeBody* iface,
834 IMimeBody* pBody)
836 FIXME("stub\n");
837 return E_NOTIMPL;
840 static HRESULT WINAPI MimeBody_GetTransmitInfo(
841 IMimeBody* iface,
842 LPTRANSMITINFO pTransmitInfo)
844 FIXME("stub\n");
845 return E_NOTIMPL;
848 static HRESULT WINAPI MimeBody_SaveToFile(
849 IMimeBody* iface,
850 ENCODINGTYPE ietEncoding,
851 LPCSTR pszFilePath)
853 FIXME("stub\n");
854 return E_NOTIMPL;
857 static HRESULT WINAPI MimeBody_GetHandle(
858 IMimeBody* iface,
859 LPHBODY phBody)
861 MimeBody *This = impl_from_IMimeBody(iface);
862 TRACE("(%p)->(%p)\n", iface, phBody);
864 *phBody = This->handle;
865 return This->handle ? S_OK : MIME_E_NO_DATA;
868 static IMimeBodyVtbl body_vtbl =
870 MimeBody_QueryInterface,
871 MimeBody_AddRef,
872 MimeBody_Release,
873 MimeBody_GetClassID,
874 MimeBody_IsDirty,
875 MimeBody_Load,
876 MimeBody_Save,
877 MimeBody_GetSizeMax,
878 MimeBody_InitNew,
879 MimeBody_GetPropInfo,
880 MimeBody_SetPropInfo,
881 MimeBody_GetProp,
882 MimeBody_SetProp,
883 MimeBody_AppendProp,
884 MimeBody_DeleteProp,
885 MimeBody_CopyProps,
886 MimeBody_MoveProps,
887 MimeBody_DeleteExcept,
888 MimeBody_QueryProp,
889 MimeBody_GetCharset,
890 MimeBody_SetCharset,
891 MimeBody_GetParameters,
892 MimeBody_IsContentType,
893 MimeBody_BindToObject,
894 MimeBody_Clone,
895 MimeBody_SetOption,
896 MimeBody_GetOption,
897 MimeBody_EnumProps,
898 MimeBody_IsType,
899 MimeBody_SetDisplayName,
900 MimeBody_GetDisplayName,
901 MimeBody_GetOffsets,
902 MimeBody_GetCurrentEncoding,
903 MimeBody_SetCurrentEncoding,
904 MimeBody_GetEstimatedSize,
905 MimeBody_GetDataHere,
906 MimeBody_GetData,
907 MimeBody_SetData,
908 MimeBody_EmptyData,
909 MimeBody_CopyTo,
910 MimeBody_GetTransmitInfo,
911 MimeBody_SaveToFile,
912 MimeBody_GetHandle
915 #define FIRST_CUSTOM_PROP_ID 0x100
917 HRESULT MimeBody_create(IUnknown *outer, void **obj)
919 MimeBody *This;
921 *obj = NULL;
923 if(outer) return CLASS_E_NOAGGREGATION;
925 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
926 if (!This) return E_OUTOFMEMORY;
928 This->lpVtbl = &body_vtbl;
929 This->refs = 1;
930 This->handle = NULL;
931 list_init(&This->headers);
932 list_init(&This->new_props);
933 This->next_prop_id = FIRST_CUSTOM_PROP_ID;
934 This->content_pri_type = NULL;
935 This->content_sub_type = NULL;
936 This->encoding = IET_7BIT;
938 *obj = (IMimeBody *)&This->lpVtbl;
939 return S_OK;
942 typedef struct MimeMessage
944 const IMimeMessageVtbl *lpVtbl;
946 LONG refs;
947 } MimeMessage;
949 static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID riid, void **ppv)
951 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
953 if (IsEqualIID(riid, &IID_IUnknown) ||
954 IsEqualIID(riid, &IID_IPersist) ||
955 IsEqualIID(riid, &IID_IPersistStreamInit) ||
956 IsEqualIID(riid, &IID_IMimeMessageTree) ||
957 IsEqualIID(riid, &IID_IMimeMessage))
959 *ppv = iface;
960 IUnknown_AddRef(iface);
961 return S_OK;
964 FIXME("no interface for %s\n", debugstr_guid(riid));
965 *ppv = NULL;
966 return E_NOINTERFACE;
969 static ULONG WINAPI MimeMessage_AddRef(IMimeMessage *iface)
971 MimeMessage *This = (MimeMessage *)iface;
972 TRACE("(%p)->()\n", iface);
973 return InterlockedIncrement(&This->refs);
976 static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface)
978 MimeMessage *This = (MimeMessage *)iface;
979 ULONG refs;
981 TRACE("(%p)->()\n", iface);
983 refs = InterlockedDecrement(&This->refs);
984 if (!refs)
986 HeapFree(GetProcessHeap(), 0, This);
989 return refs;
992 /*** IPersist methods ***/
993 static HRESULT WINAPI MimeMessage_GetClassID(
994 IMimeMessage *iface,
995 CLSID *pClassID)
997 FIXME("(%p)->(%p)\n", iface, pClassID);
998 return E_NOTIMPL;
1001 /*** IPersistStreamInit methods ***/
1002 static HRESULT WINAPI MimeMessage_IsDirty(
1003 IMimeMessage *iface)
1005 FIXME("(%p)->()\n", iface);
1006 return E_NOTIMPL;
1009 static HRESULT WINAPI MimeMessage_Load(
1010 IMimeMessage *iface,
1011 LPSTREAM pStm){
1012 FIXME("(%p)->(%p)\n", iface, pStm);
1013 return E_NOTIMPL;
1016 static HRESULT WINAPI MimeMessage_Save(
1017 IMimeMessage *iface,
1018 LPSTREAM pStm,
1019 BOOL fClearDirty)
1021 FIXME("(%p)->(%p, %s)\n", iface, pStm, fClearDirty ? "TRUE" : "FALSE");
1022 return E_NOTIMPL;
1025 static HRESULT WINAPI MimeMessage_GetSizeMax(
1026 IMimeMessage *iface,
1027 ULARGE_INTEGER *pcbSize)
1029 FIXME("(%p)->(%p)\n", iface, pcbSize);
1030 return E_NOTIMPL;
1033 static HRESULT WINAPI MimeMessage_InitNew(
1034 IMimeMessage *iface)
1036 FIXME("(%p)->()\n", iface);
1037 return E_NOTIMPL;
1040 /*** IMimeMessageTree methods ***/
1041 static HRESULT WINAPI MimeMessage_GetMessageSource(
1042 IMimeMessage *iface,
1043 IStream **ppStream,
1044 DWORD dwFlags)
1046 FIXME("(%p)->(%p, 0x%x)\n", iface, ppStream, dwFlags);
1047 return E_NOTIMPL;
1050 static HRESULT WINAPI MimeMessage_GetMessageSize(
1051 IMimeMessage *iface,
1052 ULONG *pcbSize,
1053 DWORD dwFlags)
1055 FIXME("(%p)->(%p, 0x%x)\n", iface, pcbSize, dwFlags);
1056 return E_NOTIMPL;
1059 static HRESULT WINAPI MimeMessage_LoadOffsetTable(
1060 IMimeMessage *iface,
1061 IStream *pStream)
1063 FIXME("(%p)->(%p)\n", iface, pStream);
1064 return E_NOTIMPL;
1067 static HRESULT WINAPI MimeMessage_SaveOffsetTable(
1068 IMimeMessage *iface,
1069 IStream *pStream,
1070 DWORD dwFlags)
1072 FIXME("(%p)->(%p, 0x%x)\n", iface, pStream, dwFlags);
1073 return E_NOTIMPL;
1077 static HRESULT WINAPI MimeMessage_GetFlags(
1078 IMimeMessage *iface,
1079 DWORD *pdwFlags)
1081 FIXME("(%p)->(%p)\n", iface, pdwFlags);
1082 return E_NOTIMPL;
1085 static HRESULT WINAPI MimeMessage_Commit(
1086 IMimeMessage *iface,
1087 DWORD dwFlags)
1089 FIXME("(%p)->(0x%x)\n", iface, dwFlags);
1090 return E_NOTIMPL;
1094 static HRESULT WINAPI MimeMessage_HandsOffStorage(
1095 IMimeMessage *iface)
1097 FIXME("(%p)->()\n", iface);
1098 return E_NOTIMPL;
1101 static HRESULT WINAPI MimeMessage_BindToObject(
1102 IMimeMessage *iface,
1103 const HBODY hBody,
1104 REFIID riid,
1105 void **ppvObject)
1107 FIXME("(%p)->(%p, %s, %p)\n", iface, hBody, debugstr_guid(riid), ppvObject);
1108 return E_NOTIMPL;
1111 static HRESULT WINAPI MimeMessage_SaveBody(
1112 IMimeMessage *iface,
1113 HBODY hBody,
1114 DWORD dwFlags,
1115 IStream *pStream)
1117 FIXME("(%p)->(%p, 0x%x, %p)\n", iface, hBody, dwFlags, pStream);
1118 return E_NOTIMPL;
1121 static HRESULT WINAPI MimeMessage_InsertBody(
1122 IMimeMessage *iface,
1123 BODYLOCATION location,
1124 HBODY hPivot,
1125 LPHBODY phBody)
1127 FIXME("(%p)->(%d, %p, %p)\n", iface, location, hPivot, phBody);
1128 return E_NOTIMPL;
1131 static HRESULT WINAPI MimeMessage_GetBody(
1132 IMimeMessage *iface,
1133 BODYLOCATION location,
1134 HBODY hPivot,
1135 LPHBODY phBody)
1137 FIXME("(%p)->(%d, %p, %p)\n", iface, location, hPivot, phBody);
1138 return E_NOTIMPL;
1141 static HRESULT WINAPI MimeMessage_DeleteBody(
1142 IMimeMessage *iface,
1143 HBODY hBody,
1144 DWORD dwFlags)
1146 FIXME("(%p)->(%p, %08x)\n", iface, hBody, dwFlags);
1147 return E_NOTIMPL;
1150 static HRESULT WINAPI MimeMessage_MoveBody(
1151 IMimeMessage *iface,
1152 HBODY hBody,
1153 BODYLOCATION location)
1155 FIXME("(%p)->(%d)\n", iface, location);
1156 return E_NOTIMPL;
1159 static HRESULT WINAPI MimeMessage_CountBodies(
1160 IMimeMessage *iface,
1161 HBODY hParent,
1162 boolean fRecurse,
1163 ULONG *pcBodies)
1165 FIXME("(%p)->(%p, %s, %p)\n", iface, hParent, fRecurse ? "TRUE" : "FALSE", pcBodies);
1166 return E_NOTIMPL;
1169 static HRESULT WINAPI MimeMessage_FindFirst(
1170 IMimeMessage *iface,
1171 LPFINDBODY pFindBody,
1172 LPHBODY phBody)
1174 FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
1175 return E_NOTIMPL;
1178 static HRESULT WINAPI MimeMessage_FindNext(
1179 IMimeMessage *iface,
1180 LPFINDBODY pFindBody,
1181 LPHBODY phBody)
1183 FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
1184 return E_NOTIMPL;
1187 static HRESULT WINAPI MimeMessage_ResolveURL(
1188 IMimeMessage *iface,
1189 HBODY hRelated,
1190 LPCSTR pszBase,
1191 LPCSTR pszURL,
1192 DWORD dwFlags,
1193 LPHBODY phBody)
1195 FIXME("(%p)->(%p, %s, %s, 0x%x, %p)\n", iface, hRelated, pszBase, pszURL, dwFlags, phBody);
1196 return E_NOTIMPL;
1199 static HRESULT WINAPI MimeMessage_ToMultipart(
1200 IMimeMessage *iface,
1201 HBODY hBody,
1202 LPCSTR pszSubType,
1203 LPHBODY phMultipart)
1205 FIXME("(%p)->(%p, %s, %p)\n", iface, hBody, pszSubType, phMultipart);
1206 return E_NOTIMPL;
1209 static HRESULT WINAPI MimeMessage_GetBodyOffsets(
1210 IMimeMessage *iface,
1211 HBODY hBody,
1212 LPBODYOFFSETS pOffsets)
1214 FIXME("(%p)->(%p, %p)\n", iface, hBody, pOffsets);
1215 return E_NOTIMPL;
1218 static HRESULT WINAPI MimeMessage_GetCharset(
1219 IMimeMessage *iface,
1220 LPHCHARSET phCharset)
1222 FIXME("(%p)->(%p)\n", iface, phCharset);
1223 return E_NOTIMPL;
1226 static HRESULT WINAPI MimeMessage_SetCharset(
1227 IMimeMessage *iface,
1228 HCHARSET hCharset,
1229 CSETAPPLYTYPE applytype)
1231 FIXME("(%p)->(%p, %d)\n", iface, hCharset, applytype);
1232 return E_NOTIMPL;
1235 static HRESULT WINAPI MimeMessage_IsBodyType(
1236 IMimeMessage *iface,
1237 HBODY hBody,
1238 IMSGBODYTYPE bodytype)
1240 FIXME("(%p)->(%p, %d)\n", iface, hBody, bodytype);
1241 return E_NOTIMPL;
1244 static HRESULT WINAPI MimeMessage_IsContentType(
1245 IMimeMessage *iface,
1246 HBODY hBody,
1247 LPCSTR pszPriType,
1248 LPCSTR pszSubType)
1250 FIXME("(%p)->(%p, %s, %s)\n", iface, hBody, pszPriType, pszSubType);
1251 return E_NOTIMPL;
1254 static HRESULT WINAPI MimeMessage_QueryBodyProp(
1255 IMimeMessage *iface,
1256 HBODY hBody,
1257 LPCSTR pszName,
1258 LPCSTR pszCriteria,
1259 boolean fSubString,
1260 boolean fCaseSensitive)
1262 FIXME("(%p)->(%p, %s, %s, %s, %s)\n", iface, hBody, pszName, pszCriteria, fSubString ? "TRUE" : "FALSE", fCaseSensitive ? "TRUE" : "FALSE");
1263 return E_NOTIMPL;
1266 static HRESULT WINAPI MimeMessage_GetBodyProp(
1267 IMimeMessage *iface,
1268 HBODY hBody,
1269 LPCSTR pszName,
1270 DWORD dwFlags,
1271 LPPROPVARIANT pValue)
1273 FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface, hBody, pszName, dwFlags, pValue);
1274 return E_NOTIMPL;
1277 static HRESULT WINAPI MimeMessage_SetBodyProp(
1278 IMimeMessage *iface,
1279 HBODY hBody,
1280 LPCSTR pszName,
1281 DWORD dwFlags,
1282 LPCPROPVARIANT pValue)
1284 FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface, hBody, pszName, dwFlags, pValue);
1285 return E_NOTIMPL;
1288 static HRESULT WINAPI MimeMessage_DeleteBodyProp(
1289 IMimeMessage *iface,
1290 HBODY hBody,
1291 LPCSTR pszName)
1293 FIXME("(%p)->(%p, %s)\n", iface, hBody, pszName);
1294 return E_NOTIMPL;
1297 static HRESULT WINAPI MimeMessage_SetOption(
1298 IMimeMessage *iface,
1299 const TYPEDID oid,
1300 LPCPROPVARIANT pValue)
1302 FIXME("(%p)->(%d, %p)\n", iface, oid, pValue);
1303 return E_NOTIMPL;
1306 static HRESULT WINAPI MimeMessage_GetOption(
1307 IMimeMessage *iface,
1308 const TYPEDID oid,
1309 LPPROPVARIANT pValue)
1311 FIXME("(%p)->(%d, %p)\n", iface, oid, pValue);
1312 return E_NOTIMPL;
1315 /*** IMimeMessage methods ***/
1316 static HRESULT WINAPI MimeMessage_CreateWebPage(
1317 IMimeMessage *iface,
1318 IStream *pRootStm,
1319 LPWEBPAGEOPTIONS pOptions,
1320 IMimeMessageCallback *pCallback,
1321 IMoniker **ppMoniker)
1323 FIXME("(%p)->(%p, %p, %p, %p)\n", iface, pRootStm, pOptions, pCallback, ppMoniker);
1324 *ppMoniker = NULL;
1325 return E_NOTIMPL;
1328 static HRESULT WINAPI MimeMessage_GetProp(
1329 IMimeMessage *iface,
1330 LPCSTR pszName,
1331 DWORD dwFlags,
1332 LPPROPVARIANT pValue)
1334 FIXME("(%p)->(%s, 0x%x, %p)\n", iface, pszName, dwFlags, pValue);
1335 return E_NOTIMPL;
1338 static HRESULT WINAPI MimeMessage_SetProp(
1339 IMimeMessage *iface,
1340 LPCSTR pszName,
1341 DWORD dwFlags,
1342 LPCPROPVARIANT pValue)
1344 FIXME("(%p)->(%s, 0x%x, %p)\n", iface, pszName, dwFlags, pValue);
1345 return E_NOTIMPL;
1348 static HRESULT WINAPI MimeMessage_DeleteProp(
1349 IMimeMessage *iface,
1350 LPCSTR pszName)
1352 FIXME("(%p)->(%s)\n", iface, pszName);
1353 return E_NOTIMPL;
1356 static HRESULT WINAPI MimeMessage_QueryProp(
1357 IMimeMessage *iface,
1358 LPCSTR pszName,
1359 LPCSTR pszCriteria,
1360 boolean fSubString,
1361 boolean fCaseSensitive)
1363 FIXME("(%p)->(%s, %s, %s, %s)\n", iface, pszName, pszCriteria, fSubString ? "TRUE" : "FALSE", fCaseSensitive ? "TRUE" : "FALSE");
1364 return E_NOTIMPL;
1367 static HRESULT WINAPI MimeMessage_GetTextBody(
1368 IMimeMessage *iface,
1369 DWORD dwTxtType,
1370 ENCODINGTYPE ietEncoding,
1371 IStream **pStream,
1372 LPHBODY phBody)
1374 FIXME("(%p)->(%d, %d, %p, %p)\n", iface, dwTxtType, ietEncoding, pStream, phBody);
1375 return E_NOTIMPL;
1378 static HRESULT WINAPI MimeMessage_SetTextBody(
1379 IMimeMessage *iface,
1380 DWORD dwTxtType,
1381 ENCODINGTYPE ietEncoding,
1382 HBODY hAlternative,
1383 IStream *pStream,
1384 LPHBODY phBody)
1386 FIXME("(%p)->(%d, %d, %p, %p, %p)\n", iface, dwTxtType, ietEncoding, hAlternative, pStream, phBody);
1387 return E_NOTIMPL;
1390 static HRESULT WINAPI MimeMessage_AttachObject(
1391 IMimeMessage *iface,
1392 REFIID riid,
1393 void *pvObject,
1394 LPHBODY phBody)
1396 FIXME("(%p)->(%s, %p, %p)\n", iface, debugstr_guid(riid), pvObject, phBody);
1397 return E_NOTIMPL;
1400 static HRESULT WINAPI MimeMessage_AttachFile(
1401 IMimeMessage *iface,
1402 LPCSTR pszFilePath,
1403 IStream *pstmFile,
1404 LPHBODY phBody)
1406 FIXME("(%p)->(%s, %p, %p)\n", iface, pszFilePath, pstmFile, phBody);
1407 return E_NOTIMPL;
1410 static HRESULT WINAPI MimeMessage_AttachURL(
1411 IMimeMessage *iface,
1412 LPCSTR pszBase,
1413 LPCSTR pszURL,
1414 DWORD dwFlags,
1415 IStream *pstmURL,
1416 LPSTR *ppszCIDURL,
1417 LPHBODY phBody)
1419 FIXME("(%p)->(%s, %s, 0x%x, %p, %p, %p)\n", iface, pszBase, pszURL, dwFlags, pstmURL, ppszCIDURL, phBody);
1420 return E_NOTIMPL;
1423 static HRESULT WINAPI MimeMessage_GetAttachments(
1424 IMimeMessage *iface,
1425 ULONG *pcAttach,
1426 LPHBODY *pprghAttach)
1428 FIXME("(%p)->(%p, %p)\n", iface, pcAttach, pprghAttach);
1429 return E_NOTIMPL;
1432 static HRESULT WINAPI MimeMessage_GetAddressTable(
1433 IMimeMessage *iface,
1434 IMimeAddressTable **ppTable)
1436 FIXME("(%p)->(%p)\n", iface, ppTable);
1437 return E_NOTIMPL;
1440 static HRESULT WINAPI MimeMessage_GetSender(
1441 IMimeMessage *iface,
1442 LPADDRESSPROPS pAddress)
1444 FIXME("(%p)->(%p)\n", iface, pAddress);
1445 return E_NOTIMPL;
1448 static HRESULT WINAPI MimeMessage_GetAddressTypes(
1449 IMimeMessage *iface,
1450 DWORD dwAdrTypes,
1451 DWORD dwProps,
1452 LPADDRESSLIST pList)
1454 FIXME("(%p)->(%d, %d, %p)\n", iface, dwAdrTypes, dwProps, pList);
1455 return E_NOTIMPL;
1458 static HRESULT WINAPI MimeMessage_GetAddressFormat(
1459 IMimeMessage *iface,
1460 DWORD dwAdrTypes,
1461 ADDRESSFORMAT format,
1462 LPSTR *ppszFormat)
1464 FIXME("(%p)->(%d, %d, %p)\n", iface, dwAdrTypes, format, ppszFormat);
1465 return E_NOTIMPL;
1468 static HRESULT WINAPI MimeMessage_EnumAddressTypes(
1469 IMimeMessage *iface,
1470 DWORD dwAdrTypes,
1471 DWORD dwProps,
1472 IMimeEnumAddressTypes **ppEnum)
1474 FIXME("(%p)->(%d, %d, %p)\n", iface, dwAdrTypes, dwProps, ppEnum);
1475 return E_NOTIMPL;
1478 static HRESULT WINAPI MimeMessage_SplitMessage(
1479 IMimeMessage *iface,
1480 ULONG cbMaxPart,
1481 IMimeMessageParts **ppParts)
1483 FIXME("(%p)->(%d, %p)\n", iface, cbMaxPart, ppParts);
1484 return E_NOTIMPL;
1487 static HRESULT WINAPI MimeMessage_GetRootMoniker(
1488 IMimeMessage *iface,
1489 IMoniker **ppMoniker)
1491 FIXME("(%p)->(%p)\n", iface, ppMoniker);
1492 return E_NOTIMPL;
1495 static const IMimeMessageVtbl MimeMessageVtbl =
1497 MimeMessage_QueryInterface,
1498 MimeMessage_AddRef,
1499 MimeMessage_Release,
1500 MimeMessage_GetClassID,
1501 MimeMessage_IsDirty,
1502 MimeMessage_Load,
1503 MimeMessage_Save,
1504 MimeMessage_GetSizeMax,
1505 MimeMessage_InitNew,
1506 MimeMessage_GetMessageSource,
1507 MimeMessage_GetMessageSize,
1508 MimeMessage_LoadOffsetTable,
1509 MimeMessage_SaveOffsetTable,
1510 MimeMessage_GetFlags,
1511 MimeMessage_Commit,
1512 MimeMessage_HandsOffStorage,
1513 MimeMessage_BindToObject,
1514 MimeMessage_SaveBody,
1515 MimeMessage_InsertBody,
1516 MimeMessage_GetBody,
1517 MimeMessage_DeleteBody,
1518 MimeMessage_MoveBody,
1519 MimeMessage_CountBodies,
1520 MimeMessage_FindFirst,
1521 MimeMessage_FindNext,
1522 MimeMessage_ResolveURL,
1523 MimeMessage_ToMultipart,
1524 MimeMessage_GetBodyOffsets,
1525 MimeMessage_GetCharset,
1526 MimeMessage_SetCharset,
1527 MimeMessage_IsBodyType,
1528 MimeMessage_IsContentType,
1529 MimeMessage_QueryBodyProp,
1530 MimeMessage_GetBodyProp,
1531 MimeMessage_SetBodyProp,
1532 MimeMessage_DeleteBodyProp,
1533 MimeMessage_SetOption,
1534 MimeMessage_GetOption,
1535 MimeMessage_CreateWebPage,
1536 MimeMessage_GetProp,
1537 MimeMessage_SetProp,
1538 MimeMessage_DeleteProp,
1539 MimeMessage_QueryProp,
1540 MimeMessage_GetTextBody,
1541 MimeMessage_SetTextBody,
1542 MimeMessage_AttachObject,
1543 MimeMessage_AttachFile,
1544 MimeMessage_AttachURL,
1545 MimeMessage_GetAttachments,
1546 MimeMessage_GetAddressTable,
1547 MimeMessage_GetSender,
1548 MimeMessage_GetAddressTypes,
1549 MimeMessage_GetAddressFormat,
1550 MimeMessage_EnumAddressTypes,
1551 MimeMessage_SplitMessage,
1552 MimeMessage_GetRootMoniker,
1555 /***********************************************************************
1556 * MimeOleCreateMessage (INETCOMM.@)
1558 HRESULT WINAPI MimeOleCreateMessage(IUnknown *pUnkOuter, IMimeMessage **ppMessage)
1560 MimeMessage *This;
1562 TRACE("(%p, %p)\n", pUnkOuter, ppMessage);
1564 if (pUnkOuter)
1566 FIXME("outer unknown not supported yet\n");
1567 return E_NOTIMPL;
1570 *ppMessage = NULL;
1572 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1573 if (!This) return E_OUTOFMEMORY;
1575 This->lpVtbl = &MimeMessageVtbl;
1576 This->refs = 1;
1578 *ppMessage = (IMimeMessage *)&This->lpVtbl;
1579 return S_OK;
1582 /***********************************************************************
1583 * MimeOleSetCompatMode (INETCOMM.@)
1585 HRESULT WINAPI MimeOleSetCompatMode(DWORD dwMode)
1587 FIXME("(0x%x)\n", dwMode);
1588 return S_OK;
1591 /***********************************************************************
1592 * MimeOleCreateVirtualStream (INETCOMM.@)
1594 HRESULT WINAPI MimeOleCreateVirtualStream(IStream **ppStream)
1596 HRESULT hr;
1597 FIXME("(%p)\n", ppStream);
1599 hr = CreateStreamOnHGlobal(NULL, TRUE, ppStream);
1600 return hr;
1603 typedef struct MimeSecurity
1605 const IMimeSecurityVtbl *lpVtbl;
1607 LONG refs;
1608 } MimeSecurity;
1610 static HRESULT WINAPI MimeSecurity_QueryInterface(
1611 IMimeSecurity* iface,
1612 REFIID riid,
1613 void** obj)
1615 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), obj);
1617 if (IsEqualIID(riid, &IID_IUnknown) ||
1618 IsEqualIID(riid, &IID_IMimeSecurity))
1620 *obj = iface;
1621 IUnknown_AddRef(iface);
1622 return S_OK;
1625 FIXME("no interface for %s\n", debugstr_guid(riid));
1626 *obj = NULL;
1627 return E_NOINTERFACE;
1630 static ULONG WINAPI MimeSecurity_AddRef(
1631 IMimeSecurity* iface)
1633 MimeSecurity *This = (MimeSecurity *)iface;
1634 TRACE("(%p)->()\n", iface);
1635 return InterlockedIncrement(&This->refs);
1638 static ULONG WINAPI MimeSecurity_Release(
1639 IMimeSecurity* iface)
1641 MimeSecurity *This = (MimeSecurity *)iface;
1642 ULONG refs;
1644 TRACE("(%p)->()\n", iface);
1646 refs = InterlockedDecrement(&This->refs);
1647 if (!refs)
1649 HeapFree(GetProcessHeap(), 0, This);
1652 return refs;
1655 static HRESULT WINAPI MimeSecurity_InitNew(
1656 IMimeSecurity* iface)
1658 FIXME("(%p)->(): stub\n", iface);
1659 return S_OK;
1662 static HRESULT WINAPI MimeSecurity_CheckInit(
1663 IMimeSecurity* iface)
1665 FIXME("(%p)->(): stub\n", iface);
1666 return E_NOTIMPL;
1669 static HRESULT WINAPI MimeSecurity_EncodeMessage(
1670 IMimeSecurity* iface,
1671 IMimeMessageTree* pTree,
1672 DWORD dwFlags)
1674 FIXME("(%p)->(%p, %08x): stub\n", iface, pTree, dwFlags);
1675 return E_NOTIMPL;
1678 static HRESULT WINAPI MimeSecurity_EncodeBody(
1679 IMimeSecurity* iface,
1680 IMimeMessageTree* pTree,
1681 HBODY hEncodeRoot,
1682 DWORD dwFlags)
1684 FIXME("(%p)->(%p, %p, %08x): stub\n", iface, pTree, hEncodeRoot, dwFlags);
1685 return E_NOTIMPL;
1688 static HRESULT WINAPI MimeSecurity_DecodeMessage(
1689 IMimeSecurity* iface,
1690 IMimeMessageTree* pTree,
1691 DWORD dwFlags)
1693 FIXME("(%p)->(%p, %08x): stub\n", iface, pTree, dwFlags);
1694 return E_NOTIMPL;
1697 static HRESULT WINAPI MimeSecurity_DecodeBody(
1698 IMimeSecurity* iface,
1699 IMimeMessageTree* pTree,
1700 HBODY hDecodeRoot,
1701 DWORD dwFlags)
1703 FIXME("(%p)->(%p, %p, %08x): stub\n", iface, pTree, hDecodeRoot, dwFlags);
1704 return E_NOTIMPL;
1707 static HRESULT WINAPI MimeSecurity_EnumCertificates(
1708 IMimeSecurity* iface,
1709 HCAPICERTSTORE hc,
1710 DWORD dwUsage,
1711 PCX509CERT pPrev,
1712 PCX509CERT* ppCert)
1714 FIXME("(%p)->(%p, %08x, %p, %p): stub\n", iface, hc, dwUsage, pPrev, ppCert);
1715 return E_NOTIMPL;
1718 static HRESULT WINAPI MimeSecurity_GetCertificateName(
1719 IMimeSecurity* iface,
1720 const PCX509CERT pX509Cert,
1721 const CERTNAMETYPE cn,
1722 LPSTR* ppszName)
1724 FIXME("(%p)->(%p, %08x, %p): stub\n", iface, pX509Cert, cn, ppszName);
1725 return E_NOTIMPL;
1728 static HRESULT WINAPI MimeSecurity_GetMessageType(
1729 IMimeSecurity* iface,
1730 const HWND hwndParent,
1731 IMimeBody* pBody,
1732 DWORD* pdwSecType)
1734 FIXME("(%p)->(%p, %p, %p): stub\n", iface, hwndParent, pBody, pdwSecType);
1735 return E_NOTIMPL;
1738 static HRESULT WINAPI MimeSecurity_GetCertData(
1739 IMimeSecurity* iface,
1740 const PCX509CERT pX509Cert,
1741 const CERTDATAID dataid,
1742 LPPROPVARIANT pValue)
1744 FIXME("(%p)->(%p, %x, %p): stub\n", iface, pX509Cert, dataid, pValue);
1745 return E_NOTIMPL;
1749 static const IMimeSecurityVtbl MimeSecurityVtbl =
1751 MimeSecurity_QueryInterface,
1752 MimeSecurity_AddRef,
1753 MimeSecurity_Release,
1754 MimeSecurity_InitNew,
1755 MimeSecurity_CheckInit,
1756 MimeSecurity_EncodeMessage,
1757 MimeSecurity_EncodeBody,
1758 MimeSecurity_DecodeMessage,
1759 MimeSecurity_DecodeBody,
1760 MimeSecurity_EnumCertificates,
1761 MimeSecurity_GetCertificateName,
1762 MimeSecurity_GetMessageType,
1763 MimeSecurity_GetCertData
1766 /***********************************************************************
1767 * MimeOleCreateSecurity (INETCOMM.@)
1769 HRESULT WINAPI MimeOleCreateSecurity(IMimeSecurity **ppSecurity)
1771 MimeSecurity *This;
1773 TRACE("(%p)\n", ppSecurity);
1775 *ppSecurity = NULL;
1777 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1778 if (!This) return E_OUTOFMEMORY;
1780 This->lpVtbl = &MimeSecurityVtbl;
1781 This->refs = 1;
1783 *ppSecurity = (IMimeSecurity *)&This->lpVtbl;
1784 return S_OK;