ReactOS  0.4.14-dev-49-gfb4591c
protocol.c
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Jacek Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #define COBJMACROS
20 #define NONAMELESSUNION
21 
22 #include <assert.h>
23 
24 #include "mimeole.h"
25 #include "inetcomm_private.h"
26 
27 #include "wine/debug.h"
28 #include "wine/heap.h"
29 #include "wine/unicode.h"
30 
32 
33 typedef struct {
37 
40 
45 
46 typedef struct {
47  const WCHAR *mhtml;
48  size_t mhtml_len;
49  const WCHAR *location;
50 } mhtml_url_t;
51 
52 typedef struct {
54 
56 
60  WCHAR url[1];
62 
63 static const WCHAR mhtml_prefixW[] = {'m','h','t','m','l',':'};
64 static const WCHAR mhtml_separatorW[] = {'!','x','-','u','s','c',':'};
65 
67 {
68  LPWSTR ret = NULL;
69 
70  if(str) {
71  DWORD size;
72 
73  size = (strlenW(str)+1)*sizeof(WCHAR);
74  ret = heap_alloc(size);
75  if(ret)
76  memcpy(ret, str, size);
77  }
78 
79  return ret;
80 }
81 
83 {
84  const WCHAR *p;
85 
87  return E_FAIL;
88 
89  r->mhtml = url + ARRAY_SIZE(mhtml_prefixW);
90  p = strchrW(r->mhtml, '!');
91  if(p) {
92  r->mhtml_len = p - r->mhtml;
93  /* FIXME: We handle '!' and '!x-usc:' in URLs as the same thing. Those should not be the same. */
96  else
97  p++;
98  }else {
99  r->mhtml_len = strlenW(r->mhtml);
100  }
101 
102  r->location = p;
103  return S_OK;
104 }
105 
107 {
108  if(protocol->sink) {
109  IInternetProtocolSink_ReportResult(protocol->sink, result, ERROR_SUCCESS, NULL);
110  IInternetProtocolSink_Release(protocol->sink);
111  protocol->sink = NULL;
112  }
113 
114  return result;
115 }
116 
118 {
119  FINDBODY find = {NULL};
120  IMimeBody *mime_body;
121  PROPVARIANT value;
122  HBODY body;
123  HRESULT hres;
124 
125  hres = IMimeMessage_FindFirst(mime_message, &find, &body);
126  if(FAILED(hres))
127  return report_result(protocol, hres);
128 
129  if(protocol->location) {
130  BOOL found = FALSE;
131  do {
132  hres = IMimeMessage_FindNext(mime_message, &find, &body);
133  if(FAILED(hres)) {
134  WARN("location %s not found\n", debugstr_w(protocol->location));
135  return report_result(protocol, hres);
136  }
137 
138  value.vt = VT_LPWSTR;
139  hres = IMimeMessage_GetBodyProp(mime_message, body, "content-location", 0, &value);
140  if(hres == MIME_E_NOT_FOUND)
141  continue;
142  if(FAILED(hres))
143  return report_result(protocol, hres);
144 
145  found = !strcmpW(protocol->location, value.u.pwszVal);
147  }while(!found);
148  }else {
149  hres = IMimeMessage_FindNext(mime_message, &find, &body);
150  if(FAILED(hres)) {
151  WARN("location %s not found\n", debugstr_w(protocol->location));
152  return report_result(protocol, hres);
153  }
154  }
155 
156  hres = IMimeMessage_BindToObject(mime_message, body, &IID_IMimeBody, (void**)&mime_body);
157  if(FAILED(hres))
158  return report_result(protocol, hres);
159 
160  value.vt = VT_LPWSTR;
161  hres = IMimeBody_GetProp(mime_body, "content-type", 0, &value);
162  if(SUCCEEDED(hres)) {
163  hres = IInternetProtocolSink_ReportProgress(protocol->sink, BINDSTATUS_MIMETYPEAVAILABLE, value.u.pwszVal);
165  }
166 
167  /* FIXME: Create and report cache file. */
168 
169  hres = IMimeBody_GetData(mime_body, IET_DECODED, &protocol->stream);
170  if(FAILED(hres))
171  return report_result(protocol, hres);
172 
173  IInternetProtocolSink_ReportData(protocol->sink, BSCF_FIRSTDATANOTIFICATION
174  | BSCF_INTERMEDIATEDATANOTIFICATION
175  | BSCF_LASTDATANOTIFICATION
176  | BSCF_DATAFULLYAVAILABLE
177  | BSCF_AVAILABLEDATASIZEUNKNOWN, 0, 0);
178 
179  return report_result(protocol, S_OK);
180 }
181 
183 {
184  IMimeMessage *mime_message;
185  HRESULT hres;
186 
187  hres = MimeMessage_create(NULL, (void**)&mime_message);
188  if(FAILED(hres))
189  return hres;
190 
191  IMimeMessage_InitNew(mime_message);
192 
193  hres = IMimeMessage_Load(mime_message, stream);
194  if(FAILED(hres)) {
195  IMimeMessage_Release(mime_message);
196  return hres;
197  }
198 
199  *ret = mime_message;
200  return S_OK;
201 }
202 
204 {
205  return CONTAINING_RECORD(iface, MimeHtmlBinding, IBindStatusCallback_iface);
206 }
207 
209  REFIID riid, void **ppv)
210 {
212 
213  if(IsEqualGUID(&IID_IUnknown, riid)) {
214  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
215  *ppv = &This->IBindStatusCallback_iface;
216  }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
217  TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
218  *ppv = &This->IBindStatusCallback_iface;
219  }else {
220  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
221  *ppv = NULL;
222  return E_NOINTERFACE;
223  }
224 
225  IUnknown_AddRef((IUnknown*)*ppv);
226  return S_OK;
227 }
228 
230 {
233 
234  TRACE("(%p) ref=%d\n", This, ref);
235 
236  return ref;
237 }
238 
240 {
243 
244  TRACE("(%p) ref=%d\n", This, ref);
245 
246  if(!ref) {
247  if(This->protocol)
248  IInternetProtocol_Release(&This->protocol->IInternetProtocol_iface);
249  if(This->stream)
250  IStream_Release(This->stream);
251  heap_free(This);
252  }
253 
254  return ref;
255 }
256 
258  DWORD dwReserved, IBinding *pib)
259 {
261 
262  TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
263 
264  assert(!This->stream);
265  return CreateStreamOnHGlobal(NULL, TRUE, &This->stream);
266 }
267 
269 {
270  return E_NOTIMPL;
271 }
272 
274 {
275  return E_NOTIMPL;
276 }
277 
279  ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
280 {
282  TRACE("(%p)->(%u/%u %u %s)\n", This, ulProgress, ulProgressMax, ulStatusCode, debugstr_w(szStatusText));
283  return S_OK;
284 }
285 
287 {
289  IMimeMessage *mime_message = NULL;
290 
291  TRACE("(%p)->(%x %s)\n", This, hresult, debugstr_w(szError));
292 
293  if(SUCCEEDED(hresult)) {
294  hresult = load_mime_message(This->stream, &mime_message);
295  IStream_Release(This->stream);
296  This->stream = NULL;
297  }
298 
299  This->status = hresult;
300 
301  if(mime_message)
302  on_mime_message_available(This->protocol, mime_message);
303  else
304  report_result(This->protocol, hresult);
305 
306  if(mime_message)
307  IMimeMessage_Release(mime_message);
308  IInternetProtocol_Release(&This->protocol->IInternetProtocol_iface);
309  This->protocol = NULL;
310  return S_OK;
311 }
312 
314  DWORD* grfBINDF, BINDINFO* pbindinfo)
315 {
317 
318  TRACE("(%p)\n", This);
319 
320  *grfBINDF = BINDF_ASYNCHRONOUS;
321  return S_OK;
322 }
323 
325  DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
326 {
328  BYTE buf[4*1024];
329  DWORD read;
330  HRESULT hres;
331 
332  TRACE("(%p)\n", This);
333 
334  assert(pstgmed->tymed == TYMED_ISTREAM);
335 
336  while(1) {
337  hres = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &read);
338  if(FAILED(hres))
339  return hres;
340  if(!read)
341  break;
342  hres = IStream_Write(This->stream, buf, read, NULL);
343  if(FAILED(hres))
344  return hres;
345  }
346  return S_OK;
347 }
348 
350  REFIID riid, IUnknown* punk)
351 {
352  ERR("\n");
353  return E_NOTIMPL;
354 }
355 
356 static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
368 };
369 
371 {
372  return CONTAINING_RECORD(iface, MimeHtmlProtocol, IUnknown_inner);
373 }
374 
376 {
378 
379  if(IsEqualGUID(&IID_IUnknown, riid)) {
380  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
381  *ppv = &This->IInternetProtocol_iface;
382  }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
383  TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
384  *ppv = &This->IInternetProtocol_iface;
385  }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
386  TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
387  *ppv = &This->IInternetProtocol_iface;
388  }else if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
389  TRACE("(%p)->(IID_IInternetProtocolInfo %p)\n", This, ppv);
390  *ppv = &This->IInternetProtocolInfo_iface;
391  }else {
392  FIXME("unknown interface %s\n", debugstr_guid(riid));
393  *ppv = NULL;
394  return E_NOINTERFACE;
395  }
396 
397  IUnknown_AddRef((IUnknown*)*ppv);
398  return S_OK;
399 }
400 
402 {
405 
406  TRACE("(%p) ref=%d\n", This, ref);
407 
408  return ref;
409 }
410 
412 {
415 
416  TRACE("(%p) ref=%x\n", This, ref);
417 
418  if(!ref) {
419  if(This->sink)
420  IInternetProtocolSink_Release(This->sink);
421  if(This->stream)
422  IStream_Release(This->stream);
423  heap_free(This->location);
424  heap_free(This);
425  }
426 
427  return ref;
428 }
429 
430 static const IUnknownVtbl MimeHtmlProtocolInnerVtbl = {
434 };
435 
437 {
438  return CONTAINING_RECORD(iface, MimeHtmlProtocol, IInternetProtocol_iface);
439 }
440 
442 {
444  return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
445 }
446 
448 {
450  return IUnknown_AddRef(This->outer_unk);
451 }
452 
454 {
456  return IUnknown_Release(This->outer_unk);
457 }
458 
460  IInternetProtocolSink* pOIProtSink, IInternetBindInfo* pOIBindInfo,
461  DWORD grfPI, HANDLE_PTR dwReserved)
462 {
464  BINDINFO bindinfo = { sizeof(bindinfo) };
465  MimeHtmlBinding *binding;
466  IBindCtx *bind_ctx;
467  IStream *stream;
469  DWORD bindf = 0;
470  IMoniker *mon;
471  HRESULT hres;
472 
473  TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved);
474 
475  hres = parse_mhtml_url(szUrl, &url);
476  if(FAILED(hres))
477  return hres;
478 
479  if(url.location && !(This->location = heap_strdupW(url.location)))
480  return E_OUTOFMEMORY;
481 
482  hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
483  if(FAILED(hres)) {
484  WARN("GetBindInfo failed: %08x\n", hres);
485  return hres;
486  }
487  if((bindf & (BINDF_ASYNCHRONOUS|BINDF_FROMURLMON|BINDF_NEEDFILE)) != (BINDF_ASYNCHRONOUS|BINDF_FROMURLMON|BINDF_NEEDFILE))
488  FIXME("unsupported bindf %x\n", bindf);
489 
490  IInternetProtocolSink_AddRef(This->sink = pOIProtSink);
491 
492  binding = heap_alloc(FIELD_OFFSET(MimeHtmlBinding, url[url.mhtml_len+1]));
493  if(!binding)
494  return E_OUTOFMEMORY;
495  memcpy(binding->url, url.mhtml, url.mhtml_len*sizeof(WCHAR));
496  binding->url[url.mhtml_len] = 0;
497 
498  hres = CreateURLMoniker(NULL, binding->url, &mon);
499  if(FAILED(hres)) {
500  heap_free(binding);
501  return hres;
502  }
503 
505  binding->ref = 1;
506  binding->status = E_PENDING;
507  binding->stream = NULL;
508  binding->protocol = NULL;
509 
510  hres = CreateAsyncBindCtx(0, &binding->IBindStatusCallback_iface, NULL, &bind_ctx);
511  if(FAILED(hres)) {
512  IMoniker_Release(mon);
513  IBindStatusCallback_Release(&binding->IBindStatusCallback_iface);
514  return hres;
515  }
516 
517  IInternetProtocol_AddRef(&This->IInternetProtocol_iface);
518  binding->protocol = This;
519 
520  hres = IMoniker_BindToStorage(mon, bind_ctx, NULL, &IID_IStream, (void**)&stream);
521  IBindCtx_Release(bind_ctx);
522  IMoniker_Release(mon);
523  if(stream)
524  IStream_Release(stream);
525  hres = binding->status;
526  IBindStatusCallback_Release(&binding->IBindStatusCallback_iface);
527  if(FAILED(hres) && hres != E_PENDING)
529  return hres;
530 }
531 
532 static HRESULT WINAPI MimeHtmlProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
533 {
535  FIXME("(%p)->(%p)\n", This, pProtocolData);
536  return E_NOTIMPL;
537 }
538 
540 {
542  FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
543  return E_NOTIMPL;
544 }
545 
547 {
549  TRACE("(%p)->(%08x)\n", This, dwOptions);
550  return S_OK;
551 }
552 
554 {
556  FIXME("(%p)\n", This);
557  return E_NOTIMPL;
558 }
559 
561 {
563  FIXME("(%p)\n", This);
564  return E_NOTIMPL;
565 }
566 
568 {
570  ULONG read = 0;
571  HRESULT hres;
572 
573  TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
574 
575  hres = IStream_Read(This->stream, pv, cb, &read);
576  if(pcbRead)
577  *pcbRead = read;
578  if(hres != S_OK)
579  return hres;
580 
581  return read ? S_OK : S_FALSE;
582 }
583 
585  DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)
586 {
588  FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
589  return E_NOTIMPL;
590 }
591 
593 {
595  FIXME("(%p)->(%d)\n", This, dwOptions);
596  return S_OK;
597 }
598 
600 {
602  FIXME("(%p)\n", This);
603  return S_OK;
604 }
605 
606 static const IInternetProtocolVtbl MimeHtmlProtocolVtbl = {
620 };
621 
623 {
624  return CONTAINING_RECORD(iface, MimeHtmlProtocol, IInternetProtocolInfo_iface);
625 }
626 
628 {
630  return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
631 }
632 
634 {
636  return IUnknown_AddRef(This->outer_unk);
637 }
638 
640 {
642  return IUnknown_Release(This->outer_unk);
643 }
644 
646  PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
647  DWORD* pcchResult, DWORD dwReserved)
648 {
650  FIXME("(%p)->(%s %d %x %p %d %p %d)\n", This, debugstr_w(pwzUrl), ParseAction,
651  dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
652  return INET_E_DEFAULT_ACTION;
653 }
654 
656  LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult,
657  DWORD cchResult, DWORD* pcchResult, DWORD dwReserved)
658 {
660  size_t len = ARRAY_SIZE(mhtml_prefixW);
662  WCHAR *p;
663  HRESULT hres;
664 
665  TRACE("(%p)->(%s %s %08x %p %d %p %d)\n", This, debugstr_w(pwzBaseUrl),
666  debugstr_w(pwzRelativeUrl), dwCombineFlags, pwzResult, cchResult,
667  pcchResult, dwReserved);
668 
669  hres = parse_mhtml_url(pwzBaseUrl, &url);
670  if(FAILED(hres))
671  return hres;
672 
673  if(!strncmpiW(pwzRelativeUrl, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW))) {
674  FIXME("Relative URL is mhtml protocol\n");
675  return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
676  }
677 
678  len += url.mhtml_len;
679  if(*pwzRelativeUrl)
680  len += strlenW(pwzRelativeUrl) + ARRAY_SIZE(mhtml_separatorW);
681  if(len >= cchResult) {
682  *pcchResult = 0;
683  return E_FAIL;
684  }
685 
686  memcpy(pwzResult, mhtml_prefixW, sizeof(mhtml_prefixW));
687  p = pwzResult + ARRAY_SIZE(mhtml_prefixW);
688  memcpy(p, url.mhtml, url.mhtml_len*sizeof(WCHAR));
689  p += url.mhtml_len;
690  if(*pwzRelativeUrl) {
693  strcpyW(p, pwzRelativeUrl);
694  }else {
695  *p = 0;
696  }
697 
698  *pcchResult = len;
699  return S_OK;
700 }
701 
703  LPCWSTR pwzUrl2, DWORD dwCompareFlags)
704 {
706  FIXME("(%p)->(%s %s %08x)\n", This, debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
707  return E_NOTIMPL;
708 }
709 
711  QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
713 {
715  FIXME("(%p)->(%s %08x %08x %p %d %p %d)\n", This, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
716  cbBuffer, pcbBuf, dwReserved);
717  return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
718 }
719 
720 static const IInternetProtocolInfoVtbl MimeHtmlProtocolInfoVtbl = {
728 };
729 
731 {
733 
734  protocol = heap_alloc(sizeof(*protocol));
735  if(!protocol)
736  return E_OUTOFMEMORY;
737 
738  protocol->IUnknown_inner.lpVtbl = &MimeHtmlProtocolInnerVtbl;
739  protocol->IInternetProtocol_iface.lpVtbl = &MimeHtmlProtocolVtbl;
740  protocol->IInternetProtocolInfo_iface.lpVtbl = &MimeHtmlProtocolInfoVtbl;
741  protocol->ref = 1;
742  protocol->outer_unk = outer ? outer : &protocol->IUnknown_inner;
743  protocol->location = NULL;
744  protocol->stream = NULL;
745  protocol->sink = NULL;
746 
747  *obj = &protocol->IUnknown_inner;
748  return S_OK;
749 }
static PARSEACTION
Definition: misc.c:71
static HRESULT WINAPI MimeHtmlProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:532
static const IUnknownVtbl MimeHtmlProtocolInnerVtbl
Definition: protocol.c:430
DWORD dwOptions
Definition: solitaire.cpp:23
static ULONG WINAPI MimeHtmlProtocol_AddRef(IUnknown *iface)
Definition: protocol.c:401
IStream * stream
Definition: protocol.c:59
size_t mhtml_len
Definition: protocol.c:48
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
Definition: protocol.c:349
MimeHtmlProtocol * protocol
Definition: protocol.c:57
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
IInternetProtocolSink * sink
Definition: protocol.c:43
#define E_NOINTERFACE
Definition: winerror.h:2364
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
HRESULT status
Definition: protocol.c:58
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
const WCHAR * mhtml
Definition: protocol.c:47
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:203
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2952
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
WCHAR url[1]
Definition: protocol.c:60
static HRESULT WINAPI MimeHtmlProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
Definition: protocol.c:702
static const IInternetProtocolVtbl MimeHtmlProtocolVtbl
Definition: protocol.c:606
#define WARN(fmt,...)
Definition: debug.h:111
static HRESULT WINAPI MimeHtmlProtocol_UnlockRequest(IInternetProtocol *iface)
Definition: protocol.c:599
static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:655
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
Definition: protocol.c:356
#define assert(x)
Definition: debug.h:53
static HRESULT load_mime_message(IStream *stream, IMimeMessage **ret)
Definition: protocol.c:182
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static HRESULT WINAPI InternetProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
Definition: protocol.c:441
static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
Definition: protocol.c:313
IUnknown IUnknown_inner
Definition: protocol.c:34
static ULONG WINAPI MimeHtmlProtocolInfo_Release(IInternetProtocolInfo *iface)
Definition: protocol.c:639
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
IInternetProtocolInfo IInternetProtocolInfo_iface
Definition: protocol.c:36
#define E_FAIL
Definition: ddrawi.h:102
static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
Definition: protocol.c:239
static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD dwReserved)
Definition: protocol.c:273
Definition: send.c:47
IInternetProtocol IInternetProtocol_iface
Definition: protocol.c:35
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
WINE_UNICODE_INLINE int strncmpW(const WCHAR *str1, const WCHAR *str2, int n)
Definition: unicode.h:235
static ULONG WINAPI InternetProtocol_Release(IInternetProtocol *iface)
Definition: protocol.c:453
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
Definition: protocol.c:257
static HRESULT WINAPI MimeHtmlProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:645
static HRESULT on_mime_message_available(MimeHtmlProtocol *protocol, IMimeMessage *mime_message)
Definition: protocol.c:117
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
static const WCHAR mhtml_separatorW[]
Definition: protocol.c:64
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
struct _LARGE_INTEGER::@2201 u
#define debugstr_w
Definition: kernel32.h:32
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
const WCHAR * str
static HRESULT WINAPI MimeHtmlProtocol_Resume(IInternetProtocol *iface)
Definition: protocol.c:560
smooth NULL
Definition: ftsmooth.c:416
PVOID pBuffer
static QUERYOPTION
Definition: misc.c:72
static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
Definition: protocol.c:268
WCHAR * location
Definition: protocol.c:41
#define debugstr_guid
Definition: kernel32.h:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
const GUID IID_IUnknown
static HRESULT report_result(MimeHtmlProtocol *protocol, HRESULT result)
Definition: protocol.c:106
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD cb
Definition: integrity.c:41
static HRESULT WINAPI MimeHtmlProtocol_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: protocol.c:375
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
Definition: protocol.c:208
static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: protocol.c:278
int ret
static LPWSTR heap_strdupW(LPCWSTR str)
Definition: protocol.c:66
static HRESULT WINAPI MimeHtmlProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:567
static const WCHAR mhtml_prefixW[]
Definition: protocol.c:63
#define InterlockedDecrement
Definition: armddk.h:52
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
IBindStatusCallback IBindStatusCallback_iface
Definition: protocol.c:53
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
HRESULT MimeHtmlProtocol_create(IUnknown *outer, void **obj)
Definition: protocol.c:730
GLsizei const GLfloat * value
Definition: glext.h:6069
static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
Definition: protocol.c:286
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI MimeHtmlProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
Definition: protocol.c:546
HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx **pbind)
Definition: bindctx.c:899
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
#define InterlockedIncrement
Definition: armddk.h:53
unsigned long HANDLE_PTR
Definition: basetsd.h:78
#define ARRAY_SIZE(a)
Definition: main.h:24
static HRESULT WINAPI MimeHtmlProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:584
static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
Definition: protocol.c:627
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI MimeHtmlProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
Definition: protocol.c:539
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
Definition: protocol.c:710
static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
Definition: protocol.c:324
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:622
IStream * stream
Definition: protocol.c:42
static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCHAR *szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: protocol.c:459
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static ULONG WINAPI InternetProtocol_AddRef(IInternetProtocol *iface)
Definition: protocol.c:447
static ULONG WINAPI MimeHtmlProtocolInfo_AddRef(IInternetProtocolInfo *iface)
Definition: protocol.c:633
IUnknown * outer_unk
Definition: protocol.c:39
static HRESULT WINAPI MimeHtmlProtocol_Suspend(IInternetProtocol *iface)
Definition: protocol.c:553
static TAGID TAGID find
Definition: db.cpp:153
static const IInternetProtocolInfoVtbl MimeHtmlProtocolInfoVtbl
Definition: protocol.c:720
static ULONG WINAPI MimeHtmlProtocol_Release(IUnknown *iface)
Definition: protocol.c:411
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
unsigned int ULONG
Definition: retypes.h:1
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
const SHORT IET_DECODED
Definition: mimeole.idl:248
const WCHAR * location
Definition: protocol.c:49
static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r)
Definition: protocol.c:82
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define E_PENDING
Definition: dinput.h:172
union value::@477 u
GLuint64EXT * result
Definition: glext.h:11304
static MimeHtmlProtocol * impl_from_IUnknown(IUnknown *iface)
Definition: protocol.c:370
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT WINAPI MimeHtmlProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
Definition: protocol.c:592
WINE_DEFAULT_DEBUG_CHANNEL(inetcomm)
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:436
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
Definition: protocol.c:229
static DWORD bindf
Definition: protocol.c:70
HRESULT MimeMessage_create(IUnknown *outer, void **obj) DECLSPEC_HIDDEN
Definition: mimeole.c:3085