ReactOS  0.4.14-dev-583-g2a1ba2c
mimefilter.c File Reference
#include "urlmon_main.h"
#include "wine/debug.h"
Include dependency graph for mimefilter.c:

Go to the source code of this file.

Classes

struct  MimeFilter
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (urlmon)
 
static MimeFilterimpl_from_IInternetProtocol (IInternetProtocol *iface)
 
static HRESULT WINAPI MimeFilterProtocol_QueryInterface (IInternetProtocol *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI MimeFilterProtocol_AddRef (IInternetProtocol *iface)
 
static ULONG WINAPI MimeFilterProtocol_Release (IInternetProtocol *iface)
 
static HRESULT WINAPI MimeFilterProtocol_Start (IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
 
static HRESULT WINAPI MimeFilterProtocol_Continue (IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
 
static HRESULT WINAPI MimeFilterProtocol_Abort (IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
 
static HRESULT WINAPI MimeFilterProtocol_Terminate (IInternetProtocol *iface, DWORD dwOptions)
 
static HRESULT WINAPI MimeFilterProtocol_Suspend (IInternetProtocol *iface)
 
static HRESULT WINAPI MimeFilterProtocol_Resume (IInternetProtocol *iface)
 
static HRESULT WINAPI MimeFilterProtocol_Read (IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static HRESULT WINAPI MimeFilterProtocol_Seek (IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
 
static HRESULT WINAPI MimeFilterProtocol_LockRequest (IInternetProtocol *iface, DWORD dwOptions)
 
static HRESULT WINAPI MimeFilterProtocol_UnlockRequest (IInternetProtocol *iface)
 
static MimeFilterimpl_from_IInternetProtocolSink (IInternetProtocolSink *iface)
 
static HRESULT WINAPI MimeFilterSink_QueryInterface (IInternetProtocolSink *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI MimeFilterSink_AddRef (IInternetProtocolSink *iface)
 
static ULONG WINAPI MimeFilterSink_Release (IInternetProtocolSink *iface)
 
static HRESULT WINAPI MimeFilterSink_Switch (IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
 
static HRESULT WINAPI MimeFilterSink_ReportProgress (IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
 
static HRESULT WINAPI MimeFilterSink_ReportData (IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
 
static HRESULT WINAPI MimeFilterSink_ReportResult (IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
 
HRESULT MimeFilter_Construct (IUnknown *pUnkOuter, LPVOID *ppobj)
 
static BOOL text_richtext_filter (const BYTE *b, DWORD size)
 
static BOOL text_html_filter (const BYTE *b, DWORD size)
 
static BOOL text_xml_filter (const BYTE *b, DWORD size)
 
static BOOL audio_basic_filter (const BYTE *b, DWORD size)
 
static BOOL audio_wav_filter (const BYTE *b, DWORD size)
 
static BOOL image_gif_filter (const BYTE *b, DWORD size)
 
static BOOL image_pjpeg_filter (const BYTE *b, DWORD size)
 
static BOOL image_tiff_filter (const BYTE *b, DWORD size)
 
static BOOL image_xpng_filter (const BYTE *b, DWORD size)
 
static BOOL image_bmp_filter (const BYTE *b, DWORD size)
 
static BOOL video_avi_filter (const BYTE *b, DWORD size)
 
static BOOL video_mpeg_filter (const BYTE *b, DWORD size)
 
static BOOL application_postscript_filter (const BYTE *b, DWORD size)
 
static BOOL application_pdf_filter (const BYTE *b, DWORD size)
 
static BOOL application_xzip_filter (const BYTE *b, DWORD size)
 
static BOOL application_xgzip_filter (const BYTE *b, DWORD size)
 
static BOOL application_java_filter (const BYTE *b, DWORD size)
 
static BOOL application_xmsdownload (const BYTE *b, DWORD size)
 
static BOOL is_text_plain_char (BYTE b)
 
static BOOL text_plain_filter (const BYTE *b, DWORD size)
 
static BOOL application_octet_stream_filter (const BYTE *b, DWORD size)
 
HRESULT find_mime_from_ext (const WCHAR *ext, WCHAR **ret)
 
static HRESULT find_mime_from_url (const WCHAR *url, WCHAR **ret)
 
static BOOL is_known_mime_type (const WCHAR *mime)
 
static HRESULT find_mime_from_buffer (const BYTE *buf, DWORD size, const WCHAR *proposed_mime, const WCHAR *url, WCHAR **ret_mime)
 
HRESULT WINAPI FindMimeFromData (LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags, LPWSTR *ppwzMimeOut, DWORD dwReserved)
 

Variables

static const IInternetProtocolVtbl MimeFilterProtocolVtbl
 
static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl
 
static const WCHAR text_htmlW [] = {'t','e','x','t','/','h','t','m','l',0}
 
static const WCHAR text_richtextW [] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0}
 
static const WCHAR text_xmlW [] = {'t','e','x','t','/','x','m','l',0}
 
static const WCHAR audio_basicW [] = {'a','u','d','i','o','/','b','a','s','i','c',0}
 
static const WCHAR audio_wavW [] = {'a','u','d','i','o','/','w','a','v',0}
 
static const WCHAR image_gifW [] = {'i','m','a','g','e','/','g','i','f',0}
 
static const WCHAR image_pjpegW [] = {'i','m','a','g','e','/','p','j','p','e','g',0}
 
static const WCHAR image_tiffW [] = {'i','m','a','g','e','/','t','i','f','f',0}
 
static const WCHAR image_xpngW [] = {'i','m','a','g','e','/','x','-','p','n','g',0}
 
static const WCHAR image_bmpW [] = {'i','m','a','g','e','/','b','m','p',0}
 
static const WCHAR video_aviW [] = {'v','i','d','e','o','/','a','v','i',0}
 
static const WCHAR video_mpegW [] = {'v','i','d','e','o','/','m','p','e','g',0}
 
static const WCHAR app_postscriptW []
 
static const WCHAR app_pdfW [] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0}
 
static const WCHAR app_xzipW []
 
static const WCHAR app_xgzipW []
 
static const WCHAR app_javaW [] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0}
 
static const WCHAR app_xmsdownloadW []
 
static const WCHAR text_plainW [] = {'t','e','x','t','/','p','l','a','i','n','\0'}
 
static const WCHAR app_octetstreamW []
 
struct {
   const WCHAR *   mime
 
   BOOL(*   filter )(const BYTE *, DWORD)
 
mime_filters_any_pos []
 
struct {
   const WCHAR *   mime
 
   BOOL(*   filter )(const BYTE *, DWORD)
 
mime_filters []
 

Function Documentation

◆ application_java_filter()

static BOOL application_java_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 391 of file mimefilter.c.

392 {
393  return size > 4 && b[0] == 0xca && b[1] == 0xfe && b[2] == 0xba && b[3] == 0xbe;
394 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ application_octet_stream_filter()

static BOOL application_octet_stream_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 420 of file mimefilter.c.

421 {
422  return TRUE;
423 }
#define TRUE
Definition: types.h:120

◆ application_pdf_filter()

static BOOL application_pdf_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 376 of file mimefilter.c.

377 {
378  return size > 4 && b[0] == 0x25 && b[1] == 0x50 && b[2] == 0x44 && b[3] == 0x46;
379 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ application_postscript_filter()

static BOOL application_postscript_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 371 of file mimefilter.c.

372 {
373  return size > 2 && b[0] == '%' && b[1] == '!';
374 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ application_xgzip_filter()

static BOOL application_xgzip_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 386 of file mimefilter.c.

387 {
388  return size > 2 && b[0] == 0x1f && b[1] == 0x8b;
389 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ application_xmsdownload()

static BOOL application_xmsdownload ( const BYTE b,
DWORD  size 
)
static

Definition at line 396 of file mimefilter.c.

397 {
398  return size > 2 && b[0] == 'M' && b[1] == 'Z';
399 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ application_xzip_filter()

static BOOL application_xzip_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 381 of file mimefilter.c.

382 {
383  return size > 2 && b[0] == 0x50 && b[1] == 0x4b;
384 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ audio_basic_filter()

static BOOL audio_basic_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 307 of file mimefilter.c.

308 {
309  return size > 4
310  && b[0] == '.' && b[1] == 's' && b[2] == 'n' && b[3] == 'd';
311 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ audio_wav_filter()

static BOOL audio_wav_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 313 of file mimefilter.c.

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 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ find_mime_from_buffer()

static HRESULT find_mime_from_buffer ( const BYTE buf,
DWORD  size,
const WCHAR proposed_mime,
const WCHAR url,
WCHAR **  ret_mime 
)
static

Definition at line 563 of file mimefilter.c.

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) {
586  ret = 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++) {
604  if(!mime_filters[i].filter(buf, size))
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) {
627  if(mime_filters[i].filter(buf, size))
628  ret = mime_filters[i].mime;
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++) {
640  ret = text_plainW;
641  break;
642  }
643  }
644  }
645 
646  if(ret == app_octetstreamW)
647  ret = proposed_mime;
648  }
649 
650  if(url && (ret == app_octetstreamW || ret == text_plainW)) {
651  WCHAR *url_mime;
652  HRESULT hres;
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 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
BOOL(* filter)(const BYTE *, DWORD)
Definition: mimefilter.c:513
const WCHAR * mime
Definition: mimefilter.c:512
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static BOOL is_text_plain_char(BYTE b)
Definition: mimefilter.c:401
static const struct @544 mime_filters[]
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
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
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#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 char * proposed_mime
Definition: misc.c:610
int ret
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:47
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR app_octetstreamW[]
Definition: mimefilter.c:508
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define min(a, b)
Definition: monoChain.cc:55
static const struct @544 mime_filters_any_pos[]
static HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret)
Definition: mimefilter.c:450
static BOOL is_known_mime_type(const WCHAR *mime)
Definition: mimefilter.c:546
static const WCHAR text_plainW[]
Definition: mimefilter.c:507
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by FindMimeFromData().

◆ find_mime_from_ext()

HRESULT find_mime_from_ext ( const WCHAR ext,
WCHAR **  ret 
)

Definition at line 425 of file mimefilter.c.

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 
445  *ret = CoTaskMemAlloc(size);
446  memcpy(*ret, mime, size);
447  return S_OK;
448 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * mime
Definition: mimefilter.c:512
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by FileProtocol_StartEx(), and find_mime_from_url().

◆ find_mime_from_url()

static HRESULT find_mime_from_url ( const WCHAR url,
WCHAR **  ret 
)
static

Definition at line 450 of file mimefilter.c.

451 {
452  const WCHAR *ptr, *end_ptr;
453  WCHAR *ext = NULL;
454  HRESULT hres;
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 }
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
char ext[3]
Definition: mkdosfs.c:358
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
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
HRESULT find_mime_from_ext(const WCHAR *ext, WCHAR **ret)
Definition: mimefilter.c:425
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by find_mime_from_buffer(), and FindMimeFromData().

◆ FindMimeFromData()

HRESULT WINAPI FindMimeFromData ( LPBC  pBC,
LPCWSTR  pwzUrl,
LPVOID  pBuffer,
DWORD  cbSize,
LPCWSTR  pwzMimeProposed,
DWORD  dwMimeFlags,
LPWSTR ppwzMimeOut,
DWORD  dwReserved 
)

Definition at line 680 of file mimefilter.c.

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 }
#define WARN(fmt,...)
Definition: debug.h:111
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
PVOID pBuffer
#define TRACE(s)
Definition: solgame.cpp:4
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 HRESULT find_mime_from_url(const WCHAR *url, WCHAR **ret)
Definition: mimefilter.c:450

Referenced by ITSProtocol_Start(), MkProtocol_StartEx(), ProtocolSinkHandler_ReportData(), read_stream_data(), and ResProtocol_Start().

◆ image_bmp_filter()

static BOOL image_bmp_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 350 of file mimefilter.c.

351 {
352  return size >= 14
353  && b[0] == 0x42 && b[1] == 0x4d
354  && *(const DWORD *)(b+6) == 0;
355 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95

◆ image_gif_filter()

static BOOL image_gif_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 320 of file mimefilter.c.

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 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ image_pjpeg_filter()

static BOOL image_pjpeg_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 331 of file mimefilter.c.

332 {
333  return size > 2 && b[0] == 0xff && b[1] == 0xd8;
334 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ image_tiff_filter()

static BOOL image_tiff_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 336 of file mimefilter.c.

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 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919
unsigned char BYTE
Definition: mem.h:68

◆ image_xpng_filter()

static BOOL image_xpng_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 344 of file mimefilter.c.

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 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919
unsigned char BYTE
Definition: mem.h:68

◆ impl_from_IInternetProtocol()

static MimeFilter* impl_from_IInternetProtocol ( IInternetProtocol iface)
inlinestatic

Definition at line 31 of file mimefilter.c.

32 {
33  return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocol_iface);
34 }
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

Referenced by MimeFilterProtocol_Abort(), MimeFilterProtocol_AddRef(), MimeFilterProtocol_Continue(), MimeFilterProtocol_LockRequest(), MimeFilterProtocol_QueryInterface(), MimeFilterProtocol_Read(), MimeFilterProtocol_Release(), MimeFilterProtocol_Resume(), MimeFilterProtocol_Seek(), MimeFilterProtocol_Start(), MimeFilterProtocol_Suspend(), MimeFilterProtocol_Terminate(), and MimeFilterProtocol_UnlockRequest().

◆ impl_from_IInternetProtocolSink()

static MimeFilter* impl_from_IInternetProtocolSink ( IInternetProtocolSink iface)
inlinestatic

Definition at line 180 of file mimefilter.c.

181 {
182  return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocolSink_iface);
183 }
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

Referenced by MimeFilterSink_AddRef(), MimeFilterSink_QueryInterface(), MimeFilterSink_Release(), MimeFilterSink_ReportData(), MimeFilterSink_ReportProgress(), MimeFilterSink_ReportResult(), and MimeFilterSink_Switch().

◆ is_known_mime_type()

static BOOL is_known_mime_type ( const WCHAR mime)
static

Definition at line 546 of file mimefilter.c.

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++) {
556  if(!wcscmp(mime, mime_filters[i].mime))
557  return TRUE;
558  }
559 
560  return FALSE;
561 }
#define TRUE
Definition: types.h:120
const WCHAR * mime
Definition: mimefilter.c:512
static const struct @544 mime_filters[]
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
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define ARRAY_SIZE(a)
Definition: main.h:24
static const struct @544 mime_filters_any_pos[]

Referenced by find_mime_from_buffer().

◆ is_text_plain_char()

static BOOL is_text_plain_char ( BYTE  b)
inlinestatic

Definition at line 401 of file mimefilter.c.

402 {
403  if(b < 0x20 && b != '\n' && b != '\r' && b != '\t')
404  return FALSE;
405  return TRUE;
406 }
#define TRUE
Definition: types.h:120
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

Referenced by find_mime_from_buffer(), and text_plain_filter().

◆ MimeFilter_Construct()

HRESULT MimeFilter_Construct ( IUnknown pUnkOuter,
LPVOID ppobj 
)

Definition at line 246 of file mimefilter.c.

247 {
248  MimeFilter *ret;
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 }
static const IInternetProtocolVtbl MimeFilterProtocolVtbl
Definition: mimefilter.c:164
static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl
Definition: mimefilter.c:236
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define S_OK
Definition: intsafe.h:59
static void URLMON_LockModule(void)
Definition: urlmon_main.h:68

◆ MimeFilterProtocol_Abort()

static HRESULT WINAPI MimeFilterProtocol_Abort ( IInternetProtocol iface,
HRESULT  hrReason,
DWORD  dwOptions 
)
static

Definition at line 105 of file mimefilter.c.

107 {
109  FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
110  return E_NOTIMPL;
111 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_AddRef()

static ULONG WINAPI MimeFilterProtocol_AddRef ( IInternetProtocol iface)
static

Definition at line 64 of file mimefilter.c.

65 {
68  TRACE("(%p) ref=%d\n", This, ref);
69  return ref;
70 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define InterlockedIncrement
Definition: armddk.h:53

◆ MimeFilterProtocol_Continue()

static HRESULT WINAPI MimeFilterProtocol_Continue ( IInternetProtocol iface,
PROTOCOLDATA *  pProtocolData 
)
static

Definition at line 98 of file mimefilter.c.

99 {
101  FIXME("(%p)->(%p)\n", This, pProtocolData);
102  return E_NOTIMPL;
103 }
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_LockRequest()

static HRESULT WINAPI MimeFilterProtocol_LockRequest ( IInternetProtocol iface,
DWORD  dwOptions 
)
static

Definition at line 150 of file mimefilter.c.

151 {
153  FIXME("(%p)->(%08x)\n", This, dwOptions);
154  return E_NOTIMPL;
155 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_QueryInterface()

static HRESULT WINAPI MimeFilterProtocol_QueryInterface ( IInternetProtocol iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 36 of file mimefilter.c.

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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ MimeFilterProtocol_Read()

static HRESULT WINAPI MimeFilterProtocol_Read ( IInternetProtocol iface,
void pv,
ULONG  cb,
ULONG pcbRead 
)
static

Definition at line 134 of file mimefilter.c.

136 {
138  FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
139  return E_NOTIMPL;
140 }
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

◆ MimeFilterProtocol_Release()

static ULONG WINAPI MimeFilterProtocol_Release ( IInternetProtocol iface)
static

Definition at line 72 of file mimefilter.c.

73 {
76 
77  TRACE("(%p) ref=%d\n", This, ref);
78 
79  if(!ref) {
80  heap_free(This);
81 
83  }
84 
85  return ref;
86 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
static void URLMON_UnlockModule(void)
Definition: urlmon_main.h:69
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ MimeFilterProtocol_Resume()

static HRESULT WINAPI MimeFilterProtocol_Resume ( IInternetProtocol iface)
static

Definition at line 127 of file mimefilter.c.

128 {
130  FIXME("(%p)\n", This);
131  return E_NOTIMPL;
132 }
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_Seek()

static HRESULT WINAPI MimeFilterProtocol_Seek ( IInternetProtocol iface,
LARGE_INTEGER  dlibMove,
DWORD  dwOrigin,
ULARGE_INTEGER plibNewPosition 
)
static

Definition at line 142 of file mimefilter.c.

144 {
146  FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
147  return E_NOTIMPL;
148 }
struct _LARGE_INTEGER::@2220 u
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_Start()

static HRESULT WINAPI MimeFilterProtocol_Start ( IInternetProtocol iface,
LPCWSTR  szUrl,
IInternetProtocolSink pOIProtSink,
IInternetBindInfo pOIBindInfo,
DWORD  grfPI,
HANDLE_PTR  dwReserved 
)
static

Definition at line 88 of file mimefilter.c.

91 {
93  FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
94  pOIBindInfo, grfPI, dwReserved);
95  return E_NOTIMPL;
96 }
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_Suspend()

static HRESULT WINAPI MimeFilterProtocol_Suspend ( IInternetProtocol iface)
static

Definition at line 120 of file mimefilter.c.

121 {
123  FIXME("(%p)\n", This);
124  return E_NOTIMPL;
125 }
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_Terminate()

static HRESULT WINAPI MimeFilterProtocol_Terminate ( IInternetProtocol iface,
DWORD  dwOptions 
)
static

Definition at line 113 of file mimefilter.c.

114 {
116  FIXME("(%p)->(%08x)\n", This, dwOptions);
117  return E_NOTIMPL;
118 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterProtocol_UnlockRequest()

static HRESULT WINAPI MimeFilterProtocol_UnlockRequest ( IInternetProtocol iface)
static

Definition at line 157 of file mimefilter.c.

158 {
160  FIXME("(%p)\n", This);
161  return E_NOTIMPL;
162 }
#define FIXME(fmt,...)
Definition: debug.h:110
static MimeFilter * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: mimefilter.c:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterSink_AddRef()

static ULONG WINAPI MimeFilterSink_AddRef ( IInternetProtocolSink iface)
static

Definition at line 192 of file mimefilter.c.

193 {
195  return IInternetProtocol_AddRef(&This->IInternetProtocol_iface);
196 }
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180

◆ MimeFilterSink_QueryInterface()

static HRESULT WINAPI MimeFilterSink_QueryInterface ( IInternetProtocolSink iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 185 of file mimefilter.c.

187 {
189  return IInternetProtocol_QueryInterface(&This->IInternetProtocol_iface, riid, ppv);
190 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180

◆ MimeFilterSink_Release()

static ULONG WINAPI MimeFilterSink_Release ( IInternetProtocolSink iface)
static

Definition at line 198 of file mimefilter.c.

199 {
201  return IInternetProtocol_Release(&This->IInternetProtocol_iface);
202 }
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180

◆ MimeFilterSink_ReportData()

static HRESULT WINAPI MimeFilterSink_ReportData ( IInternetProtocolSink iface,
DWORD  grfBSCF,
ULONG  ulProgress,
ULONG  ulProgressMax 
)
static

Definition at line 220 of file mimefilter.c.

222 {
224  FIXME("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax);
225  return E_NOTIMPL;
226 }
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterSink_ReportProgress()

static HRESULT WINAPI MimeFilterSink_ReportProgress ( IInternetProtocolSink iface,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
static

Definition at line 212 of file mimefilter.c.

214 {
216  FIXME("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText));
217  return E_NOTIMPL;
218 }
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterSink_ReportResult()

static HRESULT WINAPI MimeFilterSink_ReportResult ( IInternetProtocolSink iface,
HRESULT  hrResult,
DWORD  dwError,
LPCWSTR  szResult 
)
static

Definition at line 228 of file mimefilter.c.

230 {
232  FIXME("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult));
233  return E_NOTIMPL;
234 }
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MimeFilterSink_Switch()

static HRESULT WINAPI MimeFilterSink_Switch ( IInternetProtocolSink iface,
PROTOCOLDATA *  pProtocolData 
)
static

Definition at line 204 of file mimefilter.c.

206 {
208  FIXME("(%p)->(%p)\n", This, pProtocolData);
209  return E_NOTIMPL;
210 }
static MimeFilter * impl_from_IInternetProtocolSink(IInternetProtocolSink *iface)
Definition: mimefilter.c:180
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ text_html_filter()

static BOOL text_html_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 269 of file mimefilter.c.

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 }
#define TRUE
Definition: types.h:120
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ text_plain_filter()

static BOOL text_plain_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 408 of file mimefilter.c.

409 {
410  const BYTE *ptr;
411 
412  for(ptr = b; ptr < b+size-1; ptr++) {
413  if(!is_text_plain_char(*ptr))
414  return FALSE;
415  }
416 
417  return TRUE;
418 }
#define TRUE
Definition: types.h:120
static BOOL is_text_plain_char(BYTE b)
Definition: mimefilter.c:401
static PVOID ptr
Definition: dispmode.c:27
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919
unsigned char BYTE
Definition: mem.h:68

◆ text_richtext_filter()

static BOOL text_richtext_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 264 of file mimefilter.c.

265 {
266  return size > 5 && !memcmp(b, "{\\rtf", 5);
267 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ text_xml_filter()

static BOOL text_xml_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 293 of file mimefilter.c.

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 }
#define TRUE
Definition: types.h:120
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ video_avi_filter()

static BOOL video_avi_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 357 of file mimefilter.c.

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 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ video_mpeg_filter()

static BOOL video_mpeg_filter ( const BYTE b,
DWORD  size 
)
static

Definition at line 364 of file mimefilter.c.

365 {
366  return size > 4
367  && !b[0] && !b[1] && b[2] == 0x01
368  && (b[3] == 0xb3 || b[3] == 0xba);
369 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( urlmon  )

Variable Documentation

◆ app_javaW

const WCHAR app_javaW[] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0}
static

Definition at line 504 of file mimefilter.c.

◆ app_octetstreamW

const WCHAR app_octetstreamW[]
static
Initial value:
= {'a','p','p','l','i','c','a','t','i','o','n','/',
'o','c','t','e','t','-','s','t','r','e','a','m','\0'}

Definition at line 508 of file mimefilter.c.

Referenced by find_mime_from_buffer().

◆ app_pdfW

const WCHAR app_pdfW[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0}
static

Definition at line 499 of file mimefilter.c.

◆ app_postscriptW

const WCHAR app_postscriptW[]
static
Initial value:
=
{'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0}

Definition at line 497 of file mimefilter.c.

◆ app_xgzipW

const WCHAR app_xgzipW[]
static
Initial value:
= {'a','p','p','l','i','c','a','t','i','o','n','/',
'x','-','g','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0}

Definition at line 502 of file mimefilter.c.

◆ app_xmsdownloadW

const WCHAR app_xmsdownloadW[]
static
Initial value:
= {'a','p','p','l','i','c','a','t','i','o','n','/',
'x','-','m','s','d','o','w','n','l','o','a','d',0}

Definition at line 505 of file mimefilter.c.

◆ app_xzipW

const WCHAR app_xzipW[]
static
Initial value:
= {'a','p','p','l','i','c','a','t','i','o','n','/',
'x','-','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0}

Definition at line 500 of file mimefilter.c.

◆ audio_basicW

const WCHAR audio_basicW[] = {'a','u','d','i','o','/','b','a','s','i','c',0}
static

Definition at line 488 of file mimefilter.c.

◆ audio_wavW

const WCHAR audio_wavW[] = {'a','u','d','i','o','/','w','a','v',0}
static

Definition at line 489 of file mimefilter.c.

◆ filter

Definition at line 513 of file mimefilter.c.

Referenced by find_mime_from_buffer().

◆ image_bmpW

const WCHAR image_bmpW[] = {'i','m','a','g','e','/','b','m','p',0}
static

Definition at line 494 of file mimefilter.c.

◆ image_gifW

const WCHAR image_gifW[] = {'i','m','a','g','e','/','g','i','f',0}
static

Definition at line 490 of file mimefilter.c.

◆ image_pjpegW

const WCHAR image_pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0}
static

Definition at line 491 of file mimefilter.c.

Referenced by test_FindMimeFromData().

◆ image_tiffW

const WCHAR image_tiffW[] = {'i','m','a','g','e','/','t','i','f','f',0}
static

Definition at line 492 of file mimefilter.c.

◆ image_xpngW

const WCHAR image_xpngW[] = {'i','m','a','g','e','/','x','-','p','n','g',0}
static

Definition at line 493 of file mimefilter.c.

◆ InternetProtocolSinkVtbl

const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl
static
Initial value:
= {
}
static ULONG WINAPI MimeFilterSink_Release(IInternetProtocolSink *iface)
Definition: mimefilter.c:198
static HRESULT WINAPI MimeFilterSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax)
Definition: mimefilter.c:220
static HRESULT WINAPI MimeFilterSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: mimefilter.c:212
static HRESULT WINAPI MimeFilterSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
Definition: mimefilter.c:185
static HRESULT WINAPI MimeFilterSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
Definition: mimefilter.c:204
static ULONG WINAPI MimeFilterSink_AddRef(IInternetProtocolSink *iface)
Definition: mimefilter.c:192
static HRESULT WINAPI MimeFilterSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult)
Definition: mimefilter.c:228

Definition at line 236 of file mimefilter.c.

Referenced by MimeFilter_Construct().

◆ mime

◆ mime_filters

const { ... } mime_filters[]
Initial value:
= {
}
static const WCHAR image_pjpegW[]
Definition: mimefilter.c:491
static BOOL application_postscript_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:371
static BOOL video_avi_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:357
static const WCHAR app_xgzipW[]
Definition: mimefilter.c:502
static const WCHAR image_bmpW[]
Definition: mimefilter.c:494
static const WCHAR image_gifW[]
Definition: mimefilter.c:490
static BOOL image_pjpeg_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:331
static const WCHAR video_mpegW[]
Definition: mimefilter.c:496
static const WCHAR text_richtextW[]
Definition: mimefilter.c:486
static const WCHAR video_aviW[]
Definition: mimefilter.c:495
static const WCHAR audio_basicW[]
Definition: mimefilter.c:488
static const WCHAR image_tiffW[]
Definition: mimefilter.c:492
static BOOL application_xzip_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:381
static const WCHAR app_javaW[]
Definition: mimefilter.c:504
static BOOL image_gif_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:320
static BOOL image_bmp_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:350
static BOOL video_mpeg_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:364
static BOOL application_xgzip_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:386
static const WCHAR app_xmsdownloadW[]
Definition: mimefilter.c:505
static const WCHAR image_xpngW[]
Definition: mimefilter.c:493
static BOOL audio_wav_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:313
static BOOL text_richtext_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:264
static BOOL application_xmsdownload(const BYTE *b, DWORD size)
Definition: mimefilter.c:396
static const WCHAR app_xzipW[]
Definition: mimefilter.c:500
static const WCHAR app_octetstreamW[]
Definition: mimefilter.c:508
static BOOL text_plain_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:408
static BOOL application_java_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:391
static const WCHAR audio_wavW[]
Definition: mimefilter.c:489
static BOOL application_octet_stream_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:420
static BOOL application_pdf_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:376
static BOOL image_tiff_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:336
static const WCHAR app_pdfW[]
Definition: mimefilter.c:499
static const WCHAR app_postscriptW[]
Definition: mimefilter.c:497
static BOOL audio_basic_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:307
static const WCHAR text_plainW[]
Definition: mimefilter.c:507
static BOOL image_xpng_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:344

Referenced by find_mime_from_buffer(), and is_known_mime_type().

◆ mime_filters_any_pos

const { ... } mime_filters_any_pos[]
Initial value:
= {
}
static const WCHAR text_htmlW[]
Definition: mimefilter.c:485
static const WCHAR text_xmlW[]
Definition: mimefilter.c:487
static BOOL text_xml_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:293
static BOOL text_html_filter(const BYTE *b, DWORD size)
Definition: mimefilter.c:269

Referenced by find_mime_from_buffer(), and is_known_mime_type().

◆ MimeFilterProtocolVtbl

const IInternetProtocolVtbl MimeFilterProtocolVtbl
static
Initial value:
= {
}
static HRESULT WINAPI MimeFilterProtocol_Suspend(IInternetProtocol *iface)
Definition: mimefilter.c:120
static HRESULT WINAPI MimeFilterProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
Definition: mimefilter.c:150
static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface)
Definition: mimefilter.c:127
static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
Definition: mimefilter.c:36
static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
Definition: mimefilter.c:98
static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: mimefilter.c:134
static HRESULT WINAPI MimeFilterProtocol_UnlockRequest(IInternetProtocol *iface)
Definition: mimefilter.c:157
static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: mimefilter.c:88
static HRESULT WINAPI MimeFilterProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: mimefilter.c:142
static HRESULT WINAPI MimeFilterProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
Definition: mimefilter.c:113
static HRESULT WINAPI MimeFilterProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
Definition: mimefilter.c:105
static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface)
Definition: mimefilter.c:64
static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface)
Definition: mimefilter.c:72

Definition at line 164 of file mimefilter.c.

Referenced by MimeFilter_Construct().

◆ text_htmlW

const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}
static

Definition at line 485 of file mimefilter.c.

◆ text_plainW

const WCHAR text_plainW[] = {'t','e','x','t','/','p','l','a','i','n','\0'}
static

◆ text_richtextW

const WCHAR text_richtextW[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0}
static

Definition at line 486 of file mimefilter.c.

◆ text_xmlW

const WCHAR text_xmlW[] = {'t','e','x','t','/','x','m','l',0}
static

Definition at line 487 of file mimefilter.c.

◆ video_aviW

const WCHAR video_aviW[] = {'v','i','d','e','o','/','a','v','i',0}
static

Definition at line 495 of file mimefilter.c.

◆ video_mpegW

const WCHAR video_mpegW[] = {'v','i','d','e','o','/','m','p','e','g',0}
static

Definition at line 496 of file mimefilter.c.