ReactOS 0.4.16-dev-401-g45b008d
mimefilter.c
Go to the documentation of this file.
1/*
2 * Copyright 2009 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#include "urlmon_main.h"
20#include "wine/debug.h"
21
23
24typedef struct {
27
30
32{
33 return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocol_iface);
34}
35
37{
39
40 *ppv = NULL;
42 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
43 *ppv = &This->IInternetProtocol_iface;
44 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
45 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
46 *ppv = &This->IInternetProtocol_iface;
47 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
48 TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
49 *ppv = &This->IInternetProtocol_iface;
50 }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
51 TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv);
52 *ppv = &This->IInternetProtocolSink_iface;
53 }
54
55 if(*ppv) {
56 IInternetProtocol_AddRef(iface);
57 return S_OK;
58 }
59
60 WARN("not supported interface %s\n", debugstr_guid(riid));
61 return E_NOINTERFACE;
62}
63
65{
68 TRACE("(%p) ref=%d\n", This, ref);
69 return ref;
70}
71
73{
76
77 TRACE("(%p) ref=%d\n", This, ref);
78
79 if(!ref) {
81
83 }
84
85 return ref;
86}
87
89 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
91{
93 FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
94 pOIBindInfo, grfPI, dwReserved);
95 return E_NOTIMPL;
96}
97
98static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
99{
101 FIXME("(%p)->(%p)\n", This, pProtocolData);
102 return E_NOTIMPL;
103}
104
107{
109 FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
110 return E_NOTIMPL;
111}
112
114{
116 FIXME("(%p)->(%08x)\n", This, dwOptions);
117 return E_NOTIMPL;
118}
119
121{
123 FIXME("(%p)\n", This);
124 return E_NOTIMPL;
125}
126
128{
130 FIXME("(%p)\n", This);
131 return E_NOTIMPL;
132}
133
135 ULONG cb, ULONG *pcbRead)
136{
138 FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
139 return E_NOTIMPL;
140}
141
143 DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
144{
146 FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
147 return E_NOTIMPL;
148}
149
151{
153 FIXME("(%p)->(%08x)\n", This, dwOptions);
154 return E_NOTIMPL;
155}
156
158{
160 FIXME("(%p)\n", This);
161 return E_NOTIMPL;
162}
163
164static const IInternetProtocolVtbl MimeFilterProtocolVtbl = {
178};
179
181{
182 return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocolSink_iface);
183}
184
186 REFIID riid, void **ppv)
187{
189 return IInternetProtocol_QueryInterface(&This->IInternetProtocol_iface, riid, ppv);
190}
191
193{
195 return IInternetProtocol_AddRef(&This->IInternetProtocol_iface);
196}
197
199{
201 return IInternetProtocol_Release(&This->IInternetProtocol_iface);
202}
203
205 PROTOCOLDATA *pProtocolData)
206{
208 FIXME("(%p)->(%p)\n", This, pProtocolData);
209 return E_NOTIMPL;
210}
211
213 ULONG ulStatusCode, LPCWSTR szStatusText)
214{
216 FIXME("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText));
217 return E_NOTIMPL;
218}
219
221 DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
222{
224 FIXME("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax);
225 return E_NOTIMPL;
226}
227
229 HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
230{
232 FIXME("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
233 return E_NOTIMPL;
234}
235
236static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = {
244};
245
247{
249
250 TRACE("(%p %p)\n", pUnkOuter, ppobj);
251
253
254 ret = heap_alloc_zero(sizeof(MimeFilter));
255
256 ret->IInternetProtocol_iface.lpVtbl = &MimeFilterProtocolVtbl;
257 ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl;
258 ret->ref = 1;
259
260 *ppobj = &ret->IInternetProtocol_iface;
261 return S_OK;
262}
263
265{
266 return size > 5 && !memcmp(b, "{\\rtf", 5);
267}
268
270{
271 if(size < 6)
272 return FALSE;
273
274 if((b[0] == '<'
275 && (b[1] == 'h' || b[1] == 'H')
276 && (b[2] == 't' || b[2] == 'T')
277 && (b[3] == 'm' || b[3] == 'M')
278 && (b[4] == 'l' || b[4] == 'L'))
279 || (b[0] == '<'
280 && (b[1] == 'h' || b[1] == 'H')
281 && (b[2] == 'e' || b[2] == 'E')
282 && (b[3] == 'a' || b[3] == 'A')
283 && (b[4] == 'd' || b[4] == 'D'))
284 || (b[0] == '<'
285 && (b[1] == 'b' || b[1] == 'B')
286 && (b[2] == 'o' || b[2] == 'O')
287 && (b[3] == 'd' || b[3] == 'D')
288 && (b[4] == 'y' || b[4] == 'Y'))) return TRUE;
289
290 return FALSE;
291}
292
294{
295 if(size < 7)
296 return FALSE;
297
298 if(b[0] == '<' && b[1] == '?'
299 && (b[2] == 'x' || b[2] == 'X')
300 && (b[3] == 'm' || b[3] == 'M')
301 && (b[4] == 'l' || b[4] == 'L')
302 && b[5] == ' ') return TRUE;
303
304 return FALSE;
305}
306
308{
309 return size > 4
310 && b[0] == '.' && b[1] == 's' && b[2] == 'n' && b[3] == 'd';
311}
312
314{
315 return size > 12
316 && b[0] == 'R' && b[1] == 'I' && b[2] == 'F' && b[3] == 'F'
317 && b[8] == 'W' && b[9] == 'A' && b[10] == 'V' && b[11] == 'E';
318}
319
321{
322 return size >= 6
323 && (b[0] == 'G' || b[0] == 'g')
324 && (b[1] == 'I' || b[1] == 'i')
325 && (b[2] == 'F' || b[2] == 'f')
326 && b[3] == '8'
327 && (b[4] == '7' || b[4] == '9')
328 && (b[5] == 'A' || b[5] == 'a');
329}
330
332{
333 return size > 2 && b[0] == 0xff && b[1] == 0xd8;
334}
335
337{
338 static const BYTE magic1[] = {0x4d,0x4d,0x00,0x2a};
339 static const BYTE magic2[] = {0x49,0x49,0x2a,0xff};
340
341 return size >= 4 && (!memcmp(b, magic1, 4) || !memcmp(b, magic2, 4));
342}
343
345{
346 static const BYTE xpng_header[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a};
347 return size > sizeof(xpng_header) && !memcmp(b, xpng_header, sizeof(xpng_header));
348}
349
351{
352 return size >= 14
353 && b[0] == 0x42 && b[1] == 0x4d
354 && *(const DWORD *)(b+6) == 0;
355}
356
358{
359 return size > 12
360 && b[0] == 'R' && b[1] == 'I' && b[2] == 'F' && b[3] == 'F'
361 && b[8] == 'A' && b[9] == 'V' && b[10] == 'I' && b[11] == 0x20;
362}
363
365{
366 return size > 4
367 && !b[0] && !b[1] && b[2] == 0x01
368 && (b[3] == 0xb3 || b[3] == 0xba);
369}
370
372{
373 return size > 2 && b[0] == '%' && b[1] == '!';
374}
375
377{
378 return size > 4 && b[0] == 0x25 && b[1] == 0x50 && b[2] == 0x44 && b[3] == 0x46;
379}
380
382{
383 return size > 2 && b[0] == 0x50 && b[1] == 0x4b;
384}
385
387{
388 return size > 2 && b[0] == 0x1f && b[1] == 0x8b;
389}
390
392{
393 return size > 4 && b[0] == 0xca && b[1] == 0xfe && b[2] == 0xba && b[3] == 0xbe;
394}
395
397{
398 return size > 2 && b[0] == 'M' && b[1] == 'Z';
399}
400
402{
403 if(b < 0x20 && b != '\n' && b != '\r' && b != '\t')
404 return FALSE;
405 return TRUE;
406}
407
409{
410 const BYTE *ptr;
411
412 for(ptr = b; ptr < b+size-1; ptr++) {
414 return FALSE;
415 }
416
417 return TRUE;
418}
419
421{
422 return TRUE;
423}
424
426{
427 DWORD res, size;
428 WCHAR mime[64];
429 HKEY hkey;
430
431 static const WCHAR content_typeW[] = {'C','o','n','t','e','n','t',' ','T','y','p','e','\0'};
432
434 if(res != ERROR_SUCCESS)
435 return HRESULT_FROM_WIN32(res);
436
437 size = sizeof(mime);
438 res = RegQueryValueExW(hkey, content_typeW, NULL, NULL, (LPBYTE)mime, &size);
439 RegCloseKey(hkey);
440 if(res != ERROR_SUCCESS)
441 return HRESULT_FROM_WIN32(res);
442
443 TRACE("found MIME %s\n", debugstr_w(mime));
444
446 memcpy(*ret, mime, size);
447 return S_OK;
448}
449
451{
452 const WCHAR *ptr, *end_ptr;
453 WCHAR *ext = NULL;
455
456 for(end_ptr = url; *end_ptr; end_ptr++) {
457 if(*end_ptr == '?' || *end_ptr == '#')
458 break;
459 }
460
461 for(ptr = end_ptr; ptr >= url; ptr--) {
462 if(*ptr == '.')
463 break;
464 }
465
466 if(ptr < url)
467 return E_FAIL;
468
469 if(*end_ptr) {
470 unsigned len = end_ptr-ptr;
471
472 ext = heap_alloc((len+1)*sizeof(WCHAR));
473 if(!ext)
474 return E_OUTOFMEMORY;
475
476 memcpy(ext, ptr, len*sizeof(WCHAR));
477 ext[len] = 0;
478 }
479
481 heap_free(ext);
482 return hres;
483}
484
485static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
486static const WCHAR text_richtextW[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0};
487static const WCHAR text_xmlW[] = {'t','e','x','t','/','x','m','l',0};
488static const WCHAR audio_basicW[] = {'a','u','d','i','o','/','b','a','s','i','c',0};
489static const WCHAR audio_wavW[] = {'a','u','d','i','o','/','w','a','v',0};
490static const WCHAR image_gifW[] = {'i','m','a','g','e','/','g','i','f',0};
491static const WCHAR image_pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
492static const WCHAR image_tiffW[] = {'i','m','a','g','e','/','t','i','f','f',0};
493static const WCHAR image_xpngW[] = {'i','m','a','g','e','/','x','-','p','n','g',0};
494static const WCHAR image_bmpW[] = {'i','m','a','g','e','/','b','m','p',0};
495static const WCHAR video_aviW[] = {'v','i','d','e','o','/','a','v','i',0};
496static const WCHAR video_mpegW[] = {'v','i','d','e','o','/','m','p','e','g',0};
497static const WCHAR app_postscriptW[] =
498 {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0};
499static const WCHAR app_pdfW[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0};
500static const WCHAR app_xzipW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
501 'x','-','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
502static const WCHAR app_xgzipW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
503 'x','-','g','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
504static const WCHAR app_javaW[] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0};
505static const WCHAR app_xmsdownloadW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
506 'x','-','m','s','d','o','w','n','l','o','a','d',0};
507static const WCHAR text_plainW[] = {'t','e','x','t','/','p','l','a','i','n','\0'};
508static const WCHAR app_octetstreamW[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
509 'o','c','t','e','t','-','s','t','r','e','a','m','\0'};
510
511static const struct {
512 const WCHAR *mime;
513 BOOL (*filter)(const BYTE *,DWORD);
519 /* {audio_xaiffW, audio_xaiff_filter}, */
526 /* {image_xbitmapW, image_xbitmap_filter}, */
528 /* {image_xjgW, image_xjg_filter}, */
529 /* {image_xemfW, image_xemf_filter}, */
530 /* {image_xwmfW, image_xwmf_filter}, */
534 /* {app_base64W, application_base64_filter}, */
535 /* {app_macbinhex40W, application_macbinhex40_filter}, */
537 /* {app_zcompressedW, application_xcompressed_filter}, */
545
547{
548 unsigned i;
549
550 for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
552 return TRUE;
553 }
554
555 for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
557 return TRUE;
558 }
559
560 return FALSE;
561}
562
563static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *proposed_mime, const WCHAR *url, WCHAR **ret_mime)
564{
565 int len, i, any_pos_mime = -1;
566 const WCHAR *ret = NULL;
567
568 if(!buf || !size) {
569 if(!proposed_mime)
570 return E_FAIL;
571
573 *ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
574 if(!*ret_mime)
575 return E_OUTOFMEMORY;
576
577 memcpy(*ret_mime, proposed_mime, len*sizeof(WCHAR));
578 return S_OK;
579 }
580
584
585 if(proposed_mime) {
587
588 for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
590 any_pos_mime = i;
591 for(len=size; len>0; len--) {
593 break;
594 }
595 if(!len)
596 ret = NULL;
597 break;
598 }
599 }
600
602 for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
605 ret = NULL;
606 break;
607 }
608 }
609 }
610 }
611
612 /* Looks like a bug in native implementation, html and xml mimes
613 * are not looked for if none of them was proposed */
614 if(!proposed_mime || any_pos_mime!=-1) {
615 for(len=size; !ret && len>0; len--) {
616 for(i=0; i<ARRAY_SIZE(mime_filters_any_pos); i++) {
618 ret = mime_filters_any_pos[i].mime;
619 break;
620 }
621 }
622 }
623 }
624
625 i=0;
626 while(!ret) {
629 i++;
630 }
631
632 if(any_pos_mime!=-1 && ret==text_plainW)
633 ret = mime_filters_any_pos[any_pos_mime].mime;
634 else if(proposed_mime && ret==app_octetstreamW) {
635 for(len=size; ret==app_octetstreamW && len>0; len--) {
637 break;
638 for(i=0; i<ARRAY_SIZE(mime_filters_any_pos); i++) {
641 break;
642 }
643 }
644 }
645
646 if(ret == app_octetstreamW)
648 }
649
650 if(url && (ret == app_octetstreamW || ret == text_plainW)) {
651 WCHAR *url_mime;
653
654 hres = find_mime_from_url(url, &url_mime);
655 if(SUCCEEDED(hres)) {
656 if(!is_known_mime_type(url_mime)) {
657 *ret_mime = url_mime;
658 return hres;
659 }
660 CoTaskMemFree(url_mime);
661 }
662 }
663
664 TRACE("found %s for %s\n", debugstr_w(ret), debugstr_an((const char*)buf, min(32, size)));
665
666 len = lstrlenW(ret)+1;
667 *ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
668 if(!*ret_mime)
669 return E_OUTOFMEMORY;
670
671 memcpy(*ret_mime, ret, len*sizeof(WCHAR));
672 return S_OK;
673}
674
675/***********************************************************************
676 * FindMimeFromData (URLMON.@)
677 *
678 * Determines the Multipurpose Internet Mail Extensions (MIME) type from the data provided.
679 */
681 DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags,
682 LPWSTR* ppwzMimeOut, DWORD dwReserved)
683{
684 TRACE("(%p,%s,%p,%d,%s,0x%x,%p,0x%x)\n", pBC, debugstr_w(pwzUrl), pBuffer, cbSize,
685 debugstr_w(pwzMimeProposed), dwMimeFlags, ppwzMimeOut, dwReserved);
686
687 if(dwMimeFlags)
688 WARN("dwMimeFlags=%08x\n", dwMimeFlags);
689 if(dwReserved)
690 WARN("dwReserved=%d\n", dwReserved);
691
692 /* pBC seems to not be used */
693
694 if(!ppwzMimeOut || (!pwzUrl && !pBuffer))
695 return E_INVALIDARG;
696
697 if(pwzMimeProposed || pBuffer)
698 return find_mime_from_buffer(pBuffer, cbSize, pwzMimeProposed, pwzUrl, ppwzMimeOut);
699
700 return find_mime_from_url(pwzUrl, ppwzMimeOut);
701}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
unsigned long HANDLE_PTR
Definition: basetsd.h:78
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define lstrlenW
Definition: compat.h:750
static const WCHAR *const ext[]
Definition: module.c:53
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLuint res
Definition: glext.h:9613
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: mimefilter.c:134
static BOOL video_mpeg_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:364
static BOOL audio_basic_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:307
static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
Definition: mimefilter.c:36
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180
HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags, LPWSTR *ppwzMimeOut, DWORD dwReserved)
Definition: mimefilter.c:680
static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: mimefilter.c:88
static const WCHAR image_bmpW[]
Definition: mimefilter.c:494
static HRESULT WINAPI MimeFilterProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
Definition: mimefilter.c:105
static BOOL is_known_mime_type(const WCHAR *mime)
Definition: mimefilter.c:546
static BOOL video_avi_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:357
static BOOL image_pjpeg_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:331
static const struct @568 mime_filters[]
static HRESULT WINAPI MimeFilterSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
Definition: mimefilter.c:220
static const WCHAR app_xgzipW[]
Definition: mimefilter.c:502
static HRESULT WINAPI MimeFilterSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: mimefilter.c:185
static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *proposed_mime, const WCHAR *url, WCHAR **ret_mime)
Definition: mimefilter.c:563
static BOOL application_pdf_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:376
static BOOL text_html_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:269
static HRESULT WINAPI MimeFilterProtocol_UnlockRequest(IInternetProtocol *iface)
Definition: mimefilter.c:157
static BOOL image_tiff_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:336
static BOOL text_richtext_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:264
static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret)
Definition: mimefilter.c:450
static HRESULT WINAPI MimeFilterProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
Definition: mimefilter.c:150
static const WCHAR text_htmlW[]
Definition: mimefilter.c:485
static BOOL is_text_plain_char(BYTE b)
Definition: mimefilter.c:401
static BOOL application_xgzip_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:386
BOOL(* filter)(const BYTE *, DWORD)
Definition: mimefilter.c:513
static const IInternetProtocolVtbl MimeFilterProtocolVtbl
Definition: mimefilter.c:164
static const WCHAR text_xmlW[]
Definition: mimefilter.c:487
HRESULT find_mime_from_ext(const WCHAR *ext, WCHAR **ret)
Definition: mimefilter.c:425
static BOOL application_octet_stream_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:420
static HRESULT WINAPI MimeFilterProtocol_Suspend(IInternetProtocol *iface)
Definition: mimefilter.c:120
static BOOL application_xmsdownload(const BYTE *b, DWORD size)
Definition: mimefilter.c:396
static const WCHAR text_plainW[]
Definition: mimefilter.c:507
static const WCHAR image_xpngW[]
Definition: mimefilter.c:493
static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
Definition: mimefilter.c:98
static BOOL text_plain_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:408
static const WCHAR app_pdfW[]
Definition: mimefilter.c:499
static BOOL application_xzip_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:381
static HRESULT WINAPI MimeFilterProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: mimefilter.c:142
static HRESULT WINAPI MimeFilterSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: mimefilter.c:204
static HRESULT WINAPI MimeFilterProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
Definition: mimefilter.c:113
static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl
Definition: mimefilter.c:236
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
static const WCHAR audio_wavW[]
Definition: mimefilter.c:489
static const WCHAR app_postscriptW[]
Definition: mimefilter.c:497
static const WCHAR app_xzipW[]
Definition: mimefilter.c:500
static BOOL text_xml_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:293
static BOOL application_java_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:391
static BOOL image_bmp_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:350
static const WCHAR text_richtextW[]
Definition: mimefilter.c:486
static const WCHAR image_pjpegW[]
Definition: mimefilter.c:491
static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface)
Definition: mimefilter.c:127
static const WCHAR image_tiffW[]
Definition: mimefilter.c:492
static BOOL audio_wav_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:313
static const WCHAR audio_basicW[]
Definition: mimefilter.c:488
static BOOL image_gif_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:320
static ULONG WINAPI MimeFilterSink_Release(IInternetProtocolSink *iface)
Definition: mimefilter.c:198
static const WCHAR video_mpegW[]
Definition: mimefilter.c:496
static BOOL image_xpng_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:344
static const WCHAR app_octetstreamW[]
Definition: mimefilter.c:508
static HRESULT WINAPI MimeFilterSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: mimefilter.c:228
static ULONG WINAPI MimeFilterSink_AddRef(IInternetProtocolSink *iface)
Definition: mimefilter.c:192
static const struct @568 mime_filters_any_pos[]
const WCHAR * mime
Definition: mimefilter.c:512
static HRESULT WINAPI MimeFilterSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: mimefilter.c:212
static const WCHAR image_gifW[]
Definition: mimefilter.c:490
HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
Definition: mimefilter.c:246
static BOOL application_postscript_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:371
static const WCHAR app_javaW[]
Definition: mimefilter.c:504
static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface)
Definition: mimefilter.c:64
static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface)
Definition: mimefilter.c:72
static const WCHAR video_aviW[]
Definition: mimefilter.c:495
static const WCHAR app_xmsdownloadW[]
Definition: mimefilter.c:505
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
static const WCHAR url[]
Definition: encode.c:1432
HRESULT hres
Definition: protocol.c:465
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
const char * proposed_mime
Definition: misc.c:610
#define min(a, b)
Definition: monoChain.cc:55
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
interface IBindCtx * LPBC
Definition: objfwd.h:18
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
PVOID pBuffer
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwOptions
Definition: solitaire.cpp:25
IInternetProtocol IInternetProtocol_iface
Definition: mimefilter.c:25
IInternetProtocolSink IInternetProtocolSink_iface
Definition: mimefilter.c:26
LONG ref
Definition: mimefilter.c:28
Definition: send.c:48
unsigned char * LPBYTE
Definition: typedefs.h:53
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
struct _LARGE_INTEGER::@2307 u
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68
static void URLMON_UnlockModule(void)
Definition: urlmon_main.h:69
int ret
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193