ReactOS  0.4.15-dev-1392-g3014417
protocol.c File Reference
#include <assert.h>
#include "mimeole.h"
#include "inetcomm_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for protocol.c:

Go to the source code of this file.

Classes

struct  MimeHtmlProtocol
 
struct  mhtml_url_t
 
struct  MimeHtmlBinding
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (inetcomm)
 
static LPWSTR heap_strdupW (LPCWSTR str)
 
static HRESULT parse_mhtml_url (const WCHAR *url, mhtml_url_t *r)
 
static HRESULT report_result (MimeHtmlProtocol *protocol, HRESULT result)
 
static HRESULT on_mime_message_available (MimeHtmlProtocol *protocol, IMimeMessage *mime_message)
 
static HRESULT load_mime_message (IStream *stream, IMimeMessage **ret)
 
static MimeHtmlBindingimpl_from_IBindStatusCallback (IBindStatusCallback *iface)
 
static HRESULT WINAPI BindStatusCallback_QueryInterface (IBindStatusCallback *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI BindStatusCallback_AddRef (IBindStatusCallback *iface)
 
static ULONG WINAPI BindStatusCallback_Release (IBindStatusCallback *iface)
 
static HRESULT WINAPI BindStatusCallback_OnStartBinding (IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
 
static HRESULT WINAPI BindStatusCallback_GetPriority (IBindStatusCallback *iface, LONG *pnPriority)
 
static HRESULT WINAPI BindStatusCallback_OnLowResource (IBindStatusCallback *iface, DWORD dwReserved)
 
static HRESULT WINAPI BindStatusCallback_OnProgress (IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
 
static HRESULT WINAPI BindStatusCallback_OnStopBinding (IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
 
static HRESULT WINAPI BindStatusCallback_GetBindInfo (IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
 
static HRESULT WINAPI BindStatusCallback_OnDataAvailable (IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
 
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable (IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
 
static MimeHtmlProtocolimpl_from_IUnknown (IUnknown *iface)
 
static HRESULT WINAPI MimeHtmlProtocol_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI MimeHtmlProtocol_AddRef (IUnknown *iface)
 
static ULONG WINAPI MimeHtmlProtocol_Release (IUnknown *iface)
 
static MimeHtmlProtocolimpl_from_IInternetProtocol (IInternetProtocol *iface)
 
static HRESULT WINAPI InternetProtocol_QueryInterface (IInternetProtocol *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InternetProtocol_AddRef (IInternetProtocol *iface)
 
static ULONG WINAPI InternetProtocol_Release (IInternetProtocol *iface)
 
static HRESULT WINAPI MimeHtmlProtocol_Start (IInternetProtocol *iface, const WCHAR *szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
 
static HRESULT WINAPI MimeHtmlProtocol_Continue (IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
 
static HRESULT WINAPI MimeHtmlProtocol_Abort (IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
 
static HRESULT WINAPI MimeHtmlProtocol_Terminate (IInternetProtocol *iface, DWORD dwOptions)
 
static HRESULT WINAPI MimeHtmlProtocol_Suspend (IInternetProtocol *iface)
 
static HRESULT WINAPI MimeHtmlProtocol_Resume (IInternetProtocol *iface)
 
static HRESULT WINAPI MimeHtmlProtocol_Read (IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead)
 
static HRESULT WINAPI MimeHtmlProtocol_Seek (IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
 
static HRESULT WINAPI MimeHtmlProtocol_LockRequest (IInternetProtocol *iface, DWORD dwOptions)
 
static HRESULT WINAPI MimeHtmlProtocol_UnlockRequest (IInternetProtocol *iface)
 
static MimeHtmlProtocolimpl_from_IInternetProtocolInfo (IInternetProtocolInfo *iface)
 
static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInterface (IInternetProtocolInfo *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI MimeHtmlProtocolInfo_AddRef (IInternetProtocolInfo *iface)
 
static ULONG WINAPI MimeHtmlProtocolInfo_Release (IInternetProtocolInfo *iface)
 
static HRESULT WINAPI MimeHtmlProtocolInfo_ParseUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl (IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
 
static HRESULT WINAPI MimeHtmlProtocolInfo_CompareUrl (IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
 
static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInfo (IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
 
HRESULT MimeHtmlProtocol_create (IUnknown *outer, void **obj)
 

Variables

static const WCHAR mhtml_prefixW [] = {'m','h','t','m','l',':'}
 
static const WCHAR mhtml_separatorW [] = {'!','x','-','u','s','c',':'}
 
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
 
static const IUnknownVtbl MimeHtmlProtocolInnerVtbl
 
static const IInternetProtocolVtbl MimeHtmlProtocolVtbl
 
static const IInternetProtocolInfoVtbl MimeHtmlProtocolInfoVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file protocol.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 20 of file protocol.c.

Function Documentation

◆ BindStatusCallback_AddRef()

static ULONG WINAPI BindStatusCallback_AddRef ( IBindStatusCallback iface)
static

Definition at line 228 of file protocol.c.

229 {
232 
233  TRACE("(%p) ref=%d\n", This, ref);
234 
235  return ref;
236 }
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ BindStatusCallback_GetBindInfo()

static HRESULT WINAPI BindStatusCallback_GetBindInfo ( IBindStatusCallback iface,
DWORD grfBINDF,
BINDINFO *  pbindinfo 
)
static

Definition at line 312 of file protocol.c.

314 {
316 
317  TRACE("(%p)\n", This);
318 
319  *grfBINDF = BINDF_ASYNCHRONOUS;
320  return S_OK;
321 }
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ BindStatusCallback_GetPriority()

static HRESULT WINAPI BindStatusCallback_GetPriority ( IBindStatusCallback iface,
LONG pnPriority 
)
static

Definition at line 267 of file protocol.c.

268 {
269  return E_NOTIMPL;
270 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ BindStatusCallback_OnDataAvailable()

static HRESULT WINAPI BindStatusCallback_OnDataAvailable ( IBindStatusCallback iface,
DWORD  grfBSCF,
DWORD  dwSize,
FORMATETC *  pformatetc,
STGMEDIUM *  pstgmed 
)
static

Definition at line 323 of file protocol.c.

325 {
327  BYTE buf[4*1024];
328  DWORD read;
329  HRESULT hres;
330 
331  TRACE("(%p)\n", This);
332 
333  assert(pstgmed->tymed == TYMED_ISTREAM);
334 
335  while(1) {
336  hres = IStream_Read(pstgmed->u.pstm, buf, sizeof(buf), &read);
337  if(FAILED(hres))
338  return hres;
339  if(!read)
340  break;
341  hres = IStream_Write(This->stream, buf, read, NULL);
342  if(FAILED(hres))
343  return hres;
344  }
345  return S_OK;
346 }
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
#define assert(x)
Definition: debug.h:53
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)

◆ BindStatusCallback_OnLowResource()

static HRESULT WINAPI BindStatusCallback_OnLowResource ( IBindStatusCallback iface,
DWORD  dwReserved 
)
static

Definition at line 272 of file protocol.c.

273 {
274  return E_NOTIMPL;
275 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ BindStatusCallback_OnObjectAvailable()

static HRESULT WINAPI BindStatusCallback_OnObjectAvailable ( IBindStatusCallback iface,
REFIID  riid,
IUnknown punk 
)
static

Definition at line 348 of file protocol.c.

350 {
351  ERR("\n");
352  return E_NOTIMPL;
353 }
#define ERR(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ BindStatusCallback_OnProgress()

static HRESULT WINAPI BindStatusCallback_OnProgress ( IBindStatusCallback iface,
ULONG  ulProgress,
ULONG  ulProgressMax,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
static

Definition at line 277 of file protocol.c.

279 {
281  TRACE("(%p)->(%u/%u %u %s)\n", This, ulProgress, ulProgressMax, ulStatusCode, debugstr_w(szStatusText));
282  return S_OK;
283 }
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ BindStatusCallback_OnStartBinding()

static HRESULT WINAPI BindStatusCallback_OnStartBinding ( IBindStatusCallback iface,
DWORD  dwReserved,
IBinding pib 
)
static

Definition at line 256 of file protocol.c.

258 {
260 
261  TRACE("(%p)->(%x %p)\n", This, dwReserved, pib);
262 
263  assert(!This->stream);
264  return CreateStreamOnHGlobal(NULL, TRUE, &This->stream);
265 }
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
#define TRUE
Definition: types.h:120
#define assert(x)
Definition: debug.h:53
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define TRACE(s)
Definition: solgame.cpp:4
#define NULL
Definition: types.h:112

◆ BindStatusCallback_OnStopBinding()

static HRESULT WINAPI BindStatusCallback_OnStopBinding ( IBindStatusCallback iface,
HRESULT  hresult,
LPCWSTR  szError 
)
static

Definition at line 285 of file protocol.c.

286 {
288  IMimeMessage *mime_message = NULL;
289 
290  TRACE("(%p)->(%x %s)\n", This, hresult, debugstr_w(szError));
291 
292  if(SUCCEEDED(hresult)) {
293  hresult = load_mime_message(This->stream, &mime_message);
294  IStream_Release(This->stream);
295  This->stream = NULL;
296  }
297 
298  This->status = hresult;
299 
300  if(mime_message)
301  on_mime_message_available(This->protocol, mime_message);
302  else
303  report_result(This->protocol, hresult);
304 
305  if(mime_message)
306  IMimeMessage_Release(mime_message);
307  IInternetProtocol_Release(&This->protocol->IInternetProtocol_iface);
308  This->protocol = NULL;
309  return S_OK;
310 }
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
static HRESULT load_mime_message(IStream *stream, IMimeMessage **ret)
Definition: protocol.c:181
static HRESULT on_mime_message_available(MimeHtmlProtocol *protocol, IMimeMessage *mime_message)
Definition: protocol.c:116
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT report_result(MimeHtmlProtocol *protocol, HRESULT result)
Definition: protocol.c:105
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112

◆ BindStatusCallback_QueryInterface()

static HRESULT WINAPI BindStatusCallback_QueryInterface ( IBindStatusCallback iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 207 of file protocol.c.

209 {
211 
212  if(IsEqualGUID(&IID_IUnknown, riid)) {
213  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
214  *ppv = &This->IBindStatusCallback_iface;
215  }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
216  TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
217  *ppv = &This->IBindStatusCallback_iface;
218  }else {
219  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
220  *ppv = NULL;
221  return E_NOINTERFACE;
222  }
223 
224  IUnknown_AddRef((IUnknown*)*ppv);
225  return S_OK;
226 }
#define E_NOINTERFACE
Definition: winerror.h:2364
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ BindStatusCallback_Release()

static ULONG WINAPI BindStatusCallback_Release ( IBindStatusCallback iface)
static

Definition at line 238 of file protocol.c.

239 {
242 
243  TRACE("(%p) ref=%d\n", This, ref);
244 
245  if(!ref) {
246  if(This->protocol)
247  IInternetProtocol_Release(&This->protocol->IInternetProtocol_iface);
248  if(This->stream)
249  IStream_Release(This->stream);
250  heap_free(This);
251  }
252 
253  return ref;
254 }
static MimeHtmlBinding * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: protocol.c:202
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ heap_strdupW()

static LPWSTR heap_strdupW ( LPCWSTR  str)
inlinestatic

Definition at line 65 of file protocol.c.

66 {
67  LPWSTR ret = NULL;
68 
69  if(str) {
70  DWORD size;
71 
72  size = (lstrlenW(str)+1)*sizeof(WCHAR);
73  ret = heap_alloc(size);
74  if(ret)
75  memcpy(ret, str, size);
76  }
77 
78  return ret;
79 }
#define lstrlenW
Definition: compat.h:609
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
GLsizeiptr size
Definition: glext.h:5919
__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 NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by MimeHtmlProtocol_Start().

◆ impl_from_IBindStatusCallback()

static MimeHtmlBinding* impl_from_IBindStatusCallback ( IBindStatusCallback iface)
inlinestatic

Definition at line 202 of file protocol.c.

203 {
204  return CONTAINING_RECORD(iface, MimeHtmlBinding, IBindStatusCallback_iface);
205 }
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 BindStatusCallback_AddRef(), BindStatusCallback_GetBindInfo(), BindStatusCallback_OnDataAvailable(), BindStatusCallback_OnProgress(), BindStatusCallback_OnStartBinding(), BindStatusCallback_OnStopBinding(), BindStatusCallback_QueryInterface(), and BindStatusCallback_Release().

◆ impl_from_IInternetProtocol()

static MimeHtmlProtocol* impl_from_IInternetProtocol ( IInternetProtocol iface)
inlinestatic

Definition at line 435 of file protocol.c.

436 {
437  return CONTAINING_RECORD(iface, MimeHtmlProtocol, IInternetProtocol_iface);
438 }
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 InternetProtocol_AddRef(), InternetProtocol_QueryInterface(), InternetProtocol_Release(), MimeHtmlProtocol_Abort(), MimeHtmlProtocol_Continue(), MimeHtmlProtocol_LockRequest(), MimeHtmlProtocol_Read(), MimeHtmlProtocol_Resume(), MimeHtmlProtocol_Seek(), MimeHtmlProtocol_Start(), MimeHtmlProtocol_Suspend(), MimeHtmlProtocol_Terminate(), and MimeHtmlProtocol_UnlockRequest().

◆ impl_from_IInternetProtocolInfo()

static MimeHtmlProtocol* impl_from_IInternetProtocolInfo ( IInternetProtocolInfo iface)
inlinestatic

Definition at line 621 of file protocol.c.

622 {
623  return CONTAINING_RECORD(iface, MimeHtmlProtocol, IInternetProtocolInfo_iface);
624 }
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 MimeHtmlProtocolInfo_AddRef(), MimeHtmlProtocolInfo_CombineUrl(), MimeHtmlProtocolInfo_CompareUrl(), MimeHtmlProtocolInfo_ParseUrl(), MimeHtmlProtocolInfo_QueryInfo(), MimeHtmlProtocolInfo_QueryInterface(), and MimeHtmlProtocolInfo_Release().

◆ impl_from_IUnknown()

static MimeHtmlProtocol* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 369 of file protocol.c.

370 {
371  return CONTAINING_RECORD(iface, MimeHtmlProtocol, IUnknown_inner);
372 }
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 MimeHtmlProtocol_AddRef(), MimeHtmlProtocol_QueryInterface(), and MimeHtmlProtocol_Release().

◆ InternetProtocol_AddRef()

static ULONG WINAPI InternetProtocol_AddRef ( IInternetProtocol iface)
static

Definition at line 446 of file protocol.c.

447 {
449  return IUnknown_AddRef(This->outer_unk);
450 }
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ InternetProtocol_QueryInterface()

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

Definition at line 440 of file protocol.c.

441 {
443  return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
444 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ InternetProtocol_Release()

static ULONG WINAPI InternetProtocol_Release ( IInternetProtocol iface)
static

Definition at line 452 of file protocol.c.

453 {
455  return IUnknown_Release(This->outer_unk);
456 }
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ load_mime_message()

static HRESULT load_mime_message ( IStream stream,
IMimeMessage **  ret 
)
static

Definition at line 181 of file protocol.c.

182 {
183  IMimeMessage *mime_message;
184  HRESULT hres;
185 
186  hres = MimeMessage_create(NULL, (void**)&mime_message);
187  if(FAILED(hres))
188  return hres;
189 
190  IMimeMessage_InitNew(mime_message);
191 
192  hres = IMimeMessage_Load(mime_message, stream);
193  if(FAILED(hres)) {
194  IMimeMessage_Release(mime_message);
195  return hres;
196  }
197 
198  *ret = mime_message;
199  return S_OK;
200 }
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
int ret
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
HRESULT MimeMessage_create(IUnknown *outer, void **obj) DECLSPEC_HIDDEN
Definition: mimeole.c:3085

Referenced by BindStatusCallback_OnStopBinding().

◆ MimeHtmlProtocol_Abort()

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

Definition at line 538 of file protocol.c.

539 {
541  FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
542  return E_NOTIMPL;
543 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_AddRef()

static ULONG WINAPI MimeHtmlProtocol_AddRef ( IUnknown iface)
static

Definition at line 400 of file protocol.c.

401 {
404 
405  TRACE("(%p) ref=%d\n", This, ref);
406 
407  return ref;
408 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1
static MimeHtmlProtocol * impl_from_IUnknown(IUnknown *iface)
Definition: protocol.c:369

◆ MimeHtmlProtocol_Continue()

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

Definition at line 531 of file protocol.c.

532 {
534  FIXME("(%p)->(%p)\n", This, pProtocolData);
535  return E_NOTIMPL;
536 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_create()

HRESULT MimeHtmlProtocol_create ( IUnknown outer,
void **  obj 
)

Definition at line 729 of file protocol.c.

730 {
732 
733  protocol = heap_alloc(sizeof(*protocol));
734  if(!protocol)
735  return E_OUTOFMEMORY;
736 
737  protocol->IUnknown_inner.lpVtbl = &MimeHtmlProtocolInnerVtbl;
738  protocol->IInternetProtocol_iface.lpVtbl = &MimeHtmlProtocolVtbl;
739  protocol->IInternetProtocolInfo_iface.lpVtbl = &MimeHtmlProtocolInfoVtbl;
740  protocol->ref = 1;
741  protocol->outer_unk = outer ? outer : &protocol->IUnknown_inner;
742  protocol->location = NULL;
743  protocol->stream = NULL;
744  protocol->sink = NULL;
745 
746  *obj = &protocol->IUnknown_inner;
747  return S_OK;
748 }
static const IUnknownVtbl MimeHtmlProtocolInnerVtbl
Definition: protocol.c:429
static const IInternetProtocolVtbl MimeHtmlProtocolVtbl
Definition: protocol.c:605
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
static const IInternetProtocolInfoVtbl MimeHtmlProtocolInfoVtbl
Definition: protocol.c:719

◆ MimeHtmlProtocol_LockRequest()

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

Definition at line 591 of file protocol.c.

592 {
594  FIXME("(%p)->(%d)\n", This, dwOptions);
595  return S_OK;
596 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:51
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_QueryInterface()

static HRESULT WINAPI MimeHtmlProtocol_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 374 of file protocol.c.

375 {
377 
378  if(IsEqualGUID(&IID_IUnknown, riid)) {
379  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
380  *ppv = &This->IInternetProtocol_iface;
381  }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
382  TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
383  *ppv = &This->IInternetProtocol_iface;
384  }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
385  TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
386  *ppv = &This->IInternetProtocol_iface;
387  }else if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
388  TRACE("(%p)->(IID_IInternetProtocolInfo %p)\n", This, ppv);
389  *ppv = &This->IInternetProtocolInfo_iface;
390  }else {
391  FIXME("unknown interface %s\n", debugstr_guid(riid));
392  *ppv = NULL;
393  return E_NOINTERFACE;
394  }
395 
396  IUnknown_AddRef((IUnknown*)*ppv);
397  return S_OK;
398 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static MimeHtmlProtocol * impl_from_IUnknown(IUnknown *iface)
Definition: protocol.c:369

◆ MimeHtmlProtocol_Read()

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

Definition at line 566 of file protocol.c.

567 {
569  ULONG read = 0;
570  HRESULT hres;
571 
572  TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
573 
574  hres = IStream_Read(This->stream, pv, cb, &read);
575  if(pcbRead)
576  *pcbRead = read;
577  if(hres != S_OK)
578  return hres;
579 
580  return read ? S_OK : S_FALSE;
581 }
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
unsigned int ULONG
Definition: retypes.h:1
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_Release()

static ULONG WINAPI MimeHtmlProtocol_Release ( IUnknown iface)
static

Definition at line 410 of file protocol.c.

411 {
414 
415  TRACE("(%p) ref=%x\n", This, ref);
416 
417  if(!ref) {
418  if(This->sink)
419  IInternetProtocolSink_Release(This->sink);
420  if(This->stream)
421  IStream_Release(This->stream);
422  heap_free(This->location);
423  heap_free(This);
424  }
425 
426  return ref;
427 }
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static MimeHtmlProtocol * impl_from_IUnknown(IUnknown *iface)
Definition: protocol.c:369
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ MimeHtmlProtocol_Resume()

static HRESULT WINAPI MimeHtmlProtocol_Resume ( IInternetProtocol iface)
static

Definition at line 559 of file protocol.c.

560 {
562  FIXME("(%p)\n", This);
563  return E_NOTIMPL;
564 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_Seek()

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

Definition at line 583 of file protocol.c.

585 {
587  FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
588  return E_NOTIMPL;
589 }
#define FIXME(fmt,...)
Definition: debug.h:111
struct _LARGE_INTEGER::@2277 u
#define E_NOTIMPL
Definition: ddrawi.h:99
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_Start()

static HRESULT WINAPI MimeHtmlProtocol_Start ( IInternetProtocol iface,
const WCHAR szUrl,
IInternetProtocolSink pOIProtSink,
IInternetBindInfo pOIBindInfo,
DWORD  grfPI,
HANDLE_PTR  dwReserved 
)
static

Definition at line 458 of file protocol.c.

461 {
463  BINDINFO bindinfo = { sizeof(bindinfo) };
464  MimeHtmlBinding *binding;
465  IBindCtx *bind_ctx;
466  IStream *stream;
468  DWORD bindf = 0;
469  IMoniker *mon;
470  HRESULT hres;
471 
472  TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved);
473 
474  hres = parse_mhtml_url(szUrl, &url);
475  if(FAILED(hres))
476  return hres;
477 
478  if(url.location && !(This->location = heap_strdupW(url.location)))
479  return E_OUTOFMEMORY;
480 
481  hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
482  if(FAILED(hres)) {
483  WARN("GetBindInfo failed: %08x\n", hres);
484  return hres;
485  }
486  if((bindf & (BINDF_ASYNCHRONOUS|BINDF_FROMURLMON|BINDF_NEEDFILE)) != (BINDF_ASYNCHRONOUS|BINDF_FROMURLMON|BINDF_NEEDFILE))
487  FIXME("unsupported bindf %x\n", bindf);
488 
489  IInternetProtocolSink_AddRef(This->sink = pOIProtSink);
490 
491  binding = heap_alloc(FIELD_OFFSET(MimeHtmlBinding, url[url.mhtml_len+1]));
492  if(!binding)
493  return E_OUTOFMEMORY;
494  memcpy(binding->url, url.mhtml, url.mhtml_len*sizeof(WCHAR));
495  binding->url[url.mhtml_len] = 0;
496 
497  hres = CreateURLMoniker(NULL, binding->url, &mon);
498  if(FAILED(hres)) {
499  heap_free(binding);
500  return hres;
501  }
502 
504  binding->ref = 1;
505  binding->status = E_PENDING;
506  binding->stream = NULL;
507  binding->protocol = NULL;
508 
509  hres = CreateAsyncBindCtx(0, &binding->IBindStatusCallback_iface, NULL, &bind_ctx);
510  if(FAILED(hres)) {
511  IMoniker_Release(mon);
512  IBindStatusCallback_Release(&binding->IBindStatusCallback_iface);
513  return hres;
514  }
515 
516  IInternetProtocol_AddRef(&This->IInternetProtocol_iface);
517  binding->protocol = This;
518 
519  hres = IMoniker_BindToStorage(mon, bind_ctx, NULL, &IID_IStream, (void**)&stream);
520  IBindCtx_Release(bind_ctx);
521  IMoniker_Release(mon);
522  if(stream)
523  IStream_Release(stream);
524  hres = binding->status;
525  IBindStatusCallback_Release(&binding->IBindStatusCallback_iface);
526  if(FAILED(hres) && hres != E_PENDING)
528  return hres;
529 }
IStream * stream
Definition: protocol.c:58
MimeHtmlProtocol * protocol
Definition: protocol.c:56
HRESULT status
Definition: protocol.c:57
WCHAR url[1]
Definition: protocol.c:59
#define WARN(fmt,...)
Definition: debug.h:112
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
Definition: protocol.c:355
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
_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:111
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR url[]
Definition: encode.c:1432
static HRESULT report_result(MimeHtmlProtocol *protocol, HRESULT result)
Definition: protocol.c:105
unsigned long DWORD
Definition: ntddk_ex.h:95
static LPWSTR heap_strdupW(LPCWSTR str)
Definition: protocol.c:65
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
IBindStatusCallback IBindStatusCallback_iface
Definition: protocol.c:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx **pbind)
Definition: bindctx.c:899
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NULL
Definition: types.h:112
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r)
Definition: protocol.c:81
#define E_PENDING
Definition: dinput.h:172
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static DWORD bindf
Definition: protocol.c:70

◆ MimeHtmlProtocol_Suspend()

static HRESULT WINAPI MimeHtmlProtocol_Suspend ( IInternetProtocol iface)
static

Definition at line 552 of file protocol.c.

553 {
555  FIXME("(%p)\n", This);
556  return E_NOTIMPL;
557 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_Terminate()

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

Definition at line 545 of file protocol.c.

546 {
548  TRACE("(%p)->(%08x)\n", This, dwOptions);
549  return S_OK;
550 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocol_UnlockRequest()

static HRESULT WINAPI MimeHtmlProtocol_UnlockRequest ( IInternetProtocol iface)
static

Definition at line 598 of file protocol.c.

599 {
601  FIXME("(%p)\n", This);
602  return S_OK;
603 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:51
static MimeHtmlProtocol * impl_from_IInternetProtocol(IInternetProtocol *iface)
Definition: protocol.c:435

◆ MimeHtmlProtocolInfo_AddRef()

static ULONG WINAPI MimeHtmlProtocolInfo_AddRef ( IInternetProtocolInfo iface)
static

Definition at line 632 of file protocol.c.

633 {
635  return IUnknown_AddRef(This->outer_unk);
636 }
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:621

◆ MimeHtmlProtocolInfo_CombineUrl()

static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzBaseUrl,
LPCWSTR  pwzRelativeUrl,
DWORD  dwCombineFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 654 of file protocol.c.

657 {
659  size_t len = ARRAY_SIZE(mhtml_prefixW);
661  WCHAR *p;
662  HRESULT hres;
663 
664  TRACE("(%p)->(%s %s %08x %p %d %p %d)\n", This, debugstr_w(pwzBaseUrl),
665  debugstr_w(pwzRelativeUrl), dwCombineFlags, pwzResult, cchResult,
666  pcchResult, dwReserved);
667 
668  hres = parse_mhtml_url(pwzBaseUrl, &url);
669  if(FAILED(hres))
670  return hres;
671 
672  if(!_wcsnicmp(pwzRelativeUrl, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW))) {
673  FIXME("Relative URL is mhtml protocol\n");
674  return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
675  }
676 
677  len += url.mhtml_len;
678  if(*pwzRelativeUrl)
679  len += lstrlenW(pwzRelativeUrl) + ARRAY_SIZE(mhtml_separatorW);
680  if(len >= cchResult) {
681  *pcchResult = 0;
682  return E_FAIL;
683  }
684 
685  memcpy(pwzResult, mhtml_prefixW, sizeof(mhtml_prefixW));
686  p = pwzResult + ARRAY_SIZE(mhtml_prefixW);
687  memcpy(p, url.mhtml, url.mhtml_len*sizeof(WCHAR));
688  p += url.mhtml_len;
689  if(*pwzRelativeUrl) {
692  lstrcpyW(p, pwzRelativeUrl);
693  }else {
694  *p = 0;
695  }
696 
697  *pcchResult = len;
698  return S_OK;
699 }
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define lstrlenW
Definition: compat.h:609
#define E_FAIL
Definition: ddrawi.h:102
_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:63
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR url[]
Definition: encode.c:1432
static const WCHAR mhtml_prefixW[]
Definition: protocol.c:62
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:51
#define lstrcpyW
Definition: compat.h:608
#define ARRAY_SIZE(a)
Definition: main.h:24
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:621
static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r)
Definition: protocol.c:81
GLfloat GLfloat p
Definition: glext.h:8902

◆ MimeHtmlProtocolInfo_CompareUrl()

static HRESULT WINAPI MimeHtmlProtocolInfo_CompareUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl1,
LPCWSTR  pwzUrl2,
DWORD  dwCompareFlags 
)
static

Definition at line 701 of file protocol.c.

703 {
705  FIXME("(%p)->(%s %s %08x)\n", This, debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
706  return E_NOTIMPL;
707 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:621

◆ MimeHtmlProtocolInfo_ParseUrl()

static HRESULT WINAPI MimeHtmlProtocolInfo_ParseUrl ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
PARSEACTION  ParseAction,
DWORD  dwParseFlags,
LPWSTR  pwzResult,
DWORD  cchResult,
DWORD pcchResult,
DWORD  dwReserved 
)
static

Definition at line 644 of file protocol.c.

647 {
649  FIXME("(%p)->(%s %d %x %p %d %p %d)\n", This, debugstr_w(pwzUrl), ParseAction,
650  dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
651  return INET_E_DEFAULT_ACTION;
652 }
_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:111
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:621

◆ MimeHtmlProtocolInfo_QueryInfo()

static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInfo ( IInternetProtocolInfo iface,
LPCWSTR  pwzUrl,
QUERYOPTION  QueryOption,
DWORD  dwQueryFlags,
LPVOID  pBuffer,
DWORD  cbBuffer,
DWORD pcbBuf,
DWORD  dwReserved 
)
static

Definition at line 709 of file protocol.c.

712 {
714  FIXME("(%p)->(%s %08x %08x %p %d %p %d)\n", This, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
715  cbBuffer, pcbBuf, dwReserved);
716  return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
717 }
_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:111
PVOID pBuffer
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:621

◆ MimeHtmlProtocolInfo_QueryInterface()

static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInterface ( IInternetProtocolInfo iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 626 of file protocol.c.

627 {
629  return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
630 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:621

◆ MimeHtmlProtocolInfo_Release()

static ULONG WINAPI MimeHtmlProtocolInfo_Release ( IInternetProtocolInfo iface)
static

Definition at line 638 of file protocol.c.

639 {
641  return IUnknown_Release(This->outer_unk);
642 }
static MimeHtmlProtocol * impl_from_IInternetProtocolInfo(IInternetProtocolInfo *iface)
Definition: protocol.c:621

◆ on_mime_message_available()

static HRESULT on_mime_message_available ( MimeHtmlProtocol protocol,
IMimeMessage mime_message 
)
static

Definition at line 116 of file protocol.c.

117 {
118  FINDBODY find = {NULL};
119  IMimeBody *mime_body;
120  PROPVARIANT value;
121  HBODY body;
122  HRESULT hres;
123 
124  hres = IMimeMessage_FindFirst(mime_message, &find, &body);
125  if(FAILED(hres))
126  return report_result(protocol, hres);
127 
128  if(protocol->location) {
129  BOOL found = FALSE;
130  do {
131  hres = IMimeMessage_FindNext(mime_message, &find, &body);
132  if(FAILED(hres)) {
133  WARN("location %s not found\n", debugstr_w(protocol->location));
134  return report_result(protocol, hres);
135  }
136 
137  value.vt = VT_LPWSTR;
138  hres = IMimeMessage_GetBodyProp(mime_message, body, "content-location", 0, &value);
139  if(hres == MIME_E_NOT_FOUND)
140  continue;
141  if(FAILED(hres))
142  return report_result(protocol, hres);
143 
144  found = !lstrcmpW(protocol->location, value.u.pwszVal);
146  }while(!found);
147  }else {
148  hres = IMimeMessage_FindNext(mime_message, &find, &body);
149  if(FAILED(hres)) {
150  WARN("location %s not found\n", debugstr_w(protocol->location));
151  return report_result(protocol, hres);
152  }
153  }
154 
155  hres = IMimeMessage_BindToObject(mime_message, body, &IID_IMimeBody, (void**)&mime_body);
156  if(FAILED(hres))
157  return report_result(protocol, hres);
158 
159  value.vt = VT_LPWSTR;
160  hres = IMimeBody_GetProp(mime_body, "content-type", 0, &value);
161  if(SUCCEEDED(hres)) {
162  hres = IInternetProtocolSink_ReportProgress(protocol->sink, BINDSTATUS_MIMETYPEAVAILABLE, value.u.pwszVal);
164  }
165 
166  /* FIXME: Create and report cache file. */
167 
168  hres = IMimeBody_GetData(mime_body, IET_DECODED, &protocol->stream);
169  if(FAILED(hres))
170  return report_result(protocol, hres);
171 
172  IInternetProtocolSink_ReportData(protocol->sink, BSCF_FIRSTDATANOTIFICATION
173  | BSCF_INTERMEDIATEDATANOTIFICATION
174  | BSCF_LASTDATANOTIFICATION
175  | BSCF_DATAFULLYAVAILABLE
176  | BSCF_AVAILABLEDATASIZEUNKNOWN, 0, 0);
177 
178  return report_result(protocol, S_OK);
179 }
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WARN(fmt,...)
Definition: debug.h:112
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
union value::@491 u
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
static HRESULT report_result(MimeHtmlProtocol *protocol, HRESULT result)
Definition: protocol.c:105
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:51
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100
#define NULL
Definition: types.h:112
static TAGID TAGID find
Definition: db.cpp:153
const SHORT IET_DECODED
Definition: mimeole.idl:248

Referenced by BindStatusCallback_OnStopBinding().

◆ parse_mhtml_url()

static HRESULT parse_mhtml_url ( const WCHAR url,
mhtml_url_t r 
)
static

Definition at line 81 of file protocol.c.

82 {
83  const WCHAR *p;
84 
86  return E_FAIL;
87 
88  r->mhtml = url + ARRAY_SIZE(mhtml_prefixW);
89  p = wcschr(r->mhtml, '!');
90  if(p) {
91  r->mhtml_len = p - r->mhtml;
92  /* FIXME: We handle '!' and '!x-usc:' in URLs as the same thing. Those should not be the same. */
95  else
96  p++;
97  }else {
98  r->mhtml_len = lstrlenW(r->mhtml);
99  }
100 
101  r->location = p;
102  return S_OK;
103 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define lstrlenW
Definition: compat.h:609
#define E_FAIL
Definition: ddrawi.h:102
static const WCHAR mhtml_separatorW[]
Definition: protocol.c:63
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR url[]
Definition: encode.c:1432
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
static const WCHAR mhtml_prefixW[]
Definition: protocol.c:62
#define S_OK
Definition: intsafe.h:51
#define ARRAY_SIZE(a)
Definition: main.h:24
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by MimeHtmlProtocol_Start(), and MimeHtmlProtocolInfo_CombineUrl().

◆ report_result()

static HRESULT report_result ( MimeHtmlProtocol protocol,
HRESULT  result 
)
static

Definition at line 105 of file protocol.c.

106 {
107  if(protocol->sink) {
108  IInternetProtocolSink_ReportResult(protocol->sink, result, ERROR_SUCCESS, NULL);
109  IInternetProtocolSink_Release(protocol->sink);
110  protocol->sink = NULL;
111  }
112 
113  return result;
114 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint64EXT * result
Definition: glext.h:11304
#define NULL
Definition: types.h:112

Referenced by BindStatusCallback_OnStopBinding(), MimeHtmlProtocol_Start(), and on_mime_message_available().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( inetcomm  )

Variable Documentation

◆ BindStatusCallbackVtbl

const IBindStatusCallbackVtbl BindStatusCallbackVtbl
static
Initial value:
= {
}
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
Definition: protocol.c:348
static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
Definition: protocol.c:312
static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
Definition: protocol.c:238
static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD dwReserved)
Definition: protocol.c:272
static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
Definition: protocol.c:256
static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
Definition: protocol.c:267
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
Definition: protocol.c:207
static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: protocol.c:277
static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
Definition: protocol.c:285
static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
Definition: protocol.c:323
static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
Definition: protocol.c:228

Definition at line 355 of file protocol.c.

Referenced by MimeHtmlProtocol_Start().

◆ mhtml_prefixW

const WCHAR mhtml_prefixW[] = {'m','h','t','m','l',':'}
static

◆ mhtml_separatorW

const WCHAR mhtml_separatorW[] = {'!','x','-','u','s','c',':'}
static

Definition at line 63 of file protocol.c.

Referenced by MimeHtmlProtocolInfo_CombineUrl(), and parse_mhtml_url().

◆ MimeHtmlProtocolInfoVtbl

const IInternetProtocolInfoVtbl MimeHtmlProtocolInfoVtbl
static
Initial value:
= {
}
static HRESULT WINAPI MimeHtmlProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
Definition: protocol.c:701
static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:654
static ULONG WINAPI MimeHtmlProtocolInfo_Release(IInternetProtocolInfo *iface)
Definition: protocol.c:638
static HRESULT WINAPI MimeHtmlProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: protocol.c:644
static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
Definition: protocol.c:626
static HRESULT WINAPI MimeHtmlProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl, QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
Definition: protocol.c:709
static ULONG WINAPI MimeHtmlProtocolInfo_AddRef(IInternetProtocolInfo *iface)
Definition: protocol.c:632

Definition at line 719 of file protocol.c.

Referenced by MimeHtmlProtocol_create().

◆ MimeHtmlProtocolInnerVtbl

const IUnknownVtbl MimeHtmlProtocolInnerVtbl
static
Initial value:
= {
}
static ULONG WINAPI MimeHtmlProtocol_AddRef(IUnknown *iface)
Definition: protocol.c:400
static HRESULT WINAPI MimeHtmlProtocol_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: protocol.c:374
static ULONG WINAPI MimeHtmlProtocol_Release(IUnknown *iface)
Definition: protocol.c:410

Definition at line 429 of file protocol.c.

Referenced by MimeHtmlProtocol_create().

◆ MimeHtmlProtocolVtbl

const IInternetProtocolVtbl MimeHtmlProtocolVtbl
static
Initial value:
= {
}
static HRESULT WINAPI MimeHtmlProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData)
Definition: protocol.c:531
static HRESULT WINAPI MimeHtmlProtocol_UnlockRequest(IInternetProtocol *iface)
Definition: protocol.c:598
static HRESULT WINAPI InternetProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
Definition: protocol.c:440
static ULONG WINAPI InternetProtocol_Release(IInternetProtocol *iface)
Definition: protocol.c:452
static HRESULT WINAPI MimeHtmlProtocol_Resume(IInternetProtocol *iface)
Definition: protocol.c:559
static HRESULT WINAPI MimeHtmlProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead)
Definition: protocol.c:566
static HRESULT WINAPI MimeHtmlProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
Definition: protocol.c:545
static HRESULT WINAPI MimeHtmlProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
Definition: protocol.c:583
static HRESULT WINAPI MimeHtmlProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions)
Definition: protocol.c:538
static HRESULT WINAPI MimeHtmlProtocol_Start(IInternetProtocol *iface, const WCHAR *szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved)
Definition: protocol.c:458
static ULONG WINAPI InternetProtocol_AddRef(IInternetProtocol *iface)
Definition: protocol.c:446
static HRESULT WINAPI MimeHtmlProtocol_Suspend(IInternetProtocol *iface)
Definition: protocol.c:552
static HRESULT WINAPI MimeHtmlProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
Definition: protocol.c:591

Definition at line 605 of file protocol.c.

Referenced by MimeHtmlProtocol_create().