2007-01-12 12:31:54 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "urlmon_main.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
#define NO_SHLWAPI_REG
|
|
|
|
#include "shlwapi.h"
|
|
|
|
|
2007-01-12 12:31:54 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
|
|
|
|
|
|
|
|
typedef struct {
|
2019-06-03 21:50:16 +02:00
|
|
|
IUnknown IUnknown_inner;
|
2011-01-11 20:03:38 +01:00
|
|
|
IInternetProtocolEx IInternetProtocolEx_iface;
|
2007-01-13 12:46:06 +01:00
|
|
|
|
2007-01-12 12:31:54 +01:00
|
|
|
LONG ref;
|
2018-05-08 18:18:41 +02:00
|
|
|
IUnknown *outer;
|
2007-01-13 12:46:06 +01:00
|
|
|
|
|
|
|
IStream *stream;
|
2007-01-12 12:31:54 +01:00
|
|
|
} MkProtocol;
|
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
static inline MkProtocol *impl_from_IUnknown(IUnknown *iface)
|
|
|
|
{
|
2019-06-03 21:50:16 +02:00
|
|
|
return CONTAINING_RECORD(iface, MkProtocol, IUnknown_inner);
|
2018-05-08 18:18:41 +02:00
|
|
|
}
|
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
static inline MkProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface)
|
2011-01-09 20:45:20 +01:00
|
|
|
{
|
2011-01-11 20:03:38 +01:00
|
|
|
return CONTAINING_RECORD(iface, MkProtocol, IInternetProtocolEx_iface);
|
2011-01-09 20:45:20 +01:00
|
|
|
}
|
2007-01-12 12:31:54 +01:00
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
static HRESULT WINAPI MkProtocolUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
2007-01-12 12:31:54 +01:00
|
|
|
{
|
2018-05-08 18:18:41 +02:00
|
|
|
MkProtocol *This = impl_from_IUnknown(iface);
|
2007-01-12 12:31:54 +01:00
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2019-06-03 21:50:16 +02:00
|
|
|
*ppv = &This->IUnknown_inner;
|
2007-01-12 12:31:54 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv);
|
2011-01-11 20:03:38 +01:00
|
|
|
*ppv = &This->IInternetProtocolEx_iface;
|
2007-01-12 12:31:54 +01:00
|
|
|
}else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv);
|
2011-01-11 20:03:38 +01:00
|
|
|
*ppv = &This->IInternetProtocolEx_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IInternetProtocolEx_iface;
|
2018-05-08 18:18:41 +02:00
|
|
|
}else {
|
|
|
|
*ppv = NULL;
|
|
|
|
WARN("not supported interface %s\n", debugstr_guid(riid));
|
|
|
|
return E_NOINTERFACE;
|
2007-01-12 12:31:54 +01:00
|
|
|
}
|
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2007-01-12 12:31:54 +01:00
|
|
|
}
|
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
static ULONG WINAPI MkProtocolUnk_AddRef(IUnknown *iface)
|
2007-01-12 12:31:54 +01:00
|
|
|
{
|
2018-05-08 18:18:41 +02:00
|
|
|
MkProtocol *This = impl_from_IUnknown(iface);
|
2007-01-12 12:31:54 +01:00
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
static ULONG WINAPI MkProtocolUnk_Release(IUnknown *iface)
|
2007-01-12 12:31:54 +01:00
|
|
|
{
|
2018-05-08 18:18:41 +02:00
|
|
|
MkProtocol *This = impl_from_IUnknown(iface);
|
2007-01-12 12:31:54 +01:00
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref) {
|
2007-01-13 12:46:06 +01:00
|
|
|
if(This->stream)
|
|
|
|
IStream_Release(This->stream);
|
|
|
|
|
2007-11-29 22:12:34 +01:00
|
|
|
heap_free(This);
|
2007-01-12 12:31:54 +01:00
|
|
|
|
|
|
|
URLMON_UnlockModule();
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
static const IUnknownVtbl MkProtocolUnkVtbl = {
|
|
|
|
MkProtocolUnk_QueryInterface,
|
|
|
|
MkProtocolUnk_AddRef,
|
|
|
|
MkProtocolUnk_Release
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return IUnknown_QueryInterface(This->outer, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MkProtocol_AddRef(IInternetProtocolEx *iface)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
return IUnknown_AddRef(This->outer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MkProtocol_Release(IInternetProtocolEx *iface)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
return IUnknown_Release(This->outer);
|
|
|
|
}
|
|
|
|
|
2007-01-13 12:46:06 +01:00
|
|
|
static HRESULT report_result(IInternetProtocolSink *sink, HRESULT hres, DWORD dwError)
|
|
|
|
{
|
|
|
|
IInternetProtocolSink_ReportResult(sink, hres, dwError, NULL);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
static HRESULT WINAPI MkProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szUrl,
|
2007-01-12 12:31:54 +01:00
|
|
|
IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
|
2009-04-01 03:42:37 +02:00
|
|
|
DWORD grfPI, HANDLE_PTR dwReserved)
|
2007-01-12 12:31:54 +01:00
|
|
|
{
|
2011-01-11 20:03:38 +01:00
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
HRESULT hres;
|
|
|
|
IUri *uri;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink,
|
|
|
|
pOIBindInfo, grfPI, dwReserved);
|
|
|
|
|
|
|
|
hres = CreateUri(szUrl, 0, 0, &uri);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IInternetProtocolEx_StartEx(&This->IInternetProtocolEx_iface, uri, pOIProtSink,
|
|
|
|
pOIBindInfo, grfPI, (HANDLE*)dwReserved);
|
|
|
|
|
|
|
|
IUri_Release(uri);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, pProtocolData);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason,
|
|
|
|
DWORD dwOptions)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%08x)\n", This, dwOptions);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_Suspend(IInternetProtocolEx *iface)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_Resume(IInternetProtocolEx *iface)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_Read(IInternetProtocolEx *iface, void *pv,
|
|
|
|
ULONG cb, ULONG *pcbRead)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead);
|
|
|
|
|
|
|
|
if(!This->stream)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return IStream_Read(This->stream, pv, cb, pcbRead);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove,
|
|
|
|
DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%08x)\n", This, dwOptions);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_UnlockRequest(IInternetProtocolEx *iface)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
|
|
|
|
IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
|
|
|
|
DWORD grfPI, HANDLE *dwReserved)
|
|
|
|
{
|
|
|
|
MkProtocol *This = impl_from_IInternetProtocolEx(iface);
|
|
|
|
LPWSTR mime, progid, display_name, colon_ptr;
|
|
|
|
DWORD bindf=0, eaten=0, scheme=0, len;
|
2016-05-18 18:29:26 +02:00
|
|
|
BSTR url, path = NULL;
|
2007-01-13 12:46:06 +01:00
|
|
|
IParseDisplayName *pdn;
|
|
|
|
BINDINFO bindinfo;
|
|
|
|
STATSTG statstg;
|
2011-01-11 20:03:38 +01:00
|
|
|
IMoniker *mon;
|
2007-01-13 12:46:06 +01:00
|
|
|
HRESULT hres;
|
2011-01-11 20:03:38 +01:00
|
|
|
CLSID clsid;
|
2007-01-13 12:46:06 +01:00
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink,
|
2007-01-12 12:31:54 +01:00
|
|
|
pOIBindInfo, grfPI, dwReserved);
|
2007-01-13 12:46:06 +01:00
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
hres = IUri_GetScheme(pUri, &scheme);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
if(scheme != URL_SCHEME_MK)
|
2007-10-25 22:26:32 +02:00
|
|
|
return INET_E_INVALID_URL;
|
|
|
|
|
2007-01-13 12:46:06 +01:00
|
|
|
memset(&bindinfo, 0, sizeof(bindinfo));
|
|
|
|
bindinfo.cbSize = sizeof(BINDINFO);
|
|
|
|
hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("GetBindInfo failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReleaseBindInfo(&bindinfo);
|
|
|
|
|
|
|
|
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, NULL);
|
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
hres = IUri_GetDisplayUri(pUri, &url);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
hres = FindMimeFromData(NULL, url, NULL, 0, NULL, 0, &mime, 0);
|
|
|
|
SysFreeString(url);
|
2007-01-13 12:46:06 +01:00
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, mime);
|
|
|
|
CoTaskMemFree(mime);
|
|
|
|
}
|
|
|
|
|
2016-05-18 18:29:26 +02:00
|
|
|
hres = IUri_GetPath(pUri, &path);
|
2011-01-11 20:03:38 +01:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2016-05-18 18:29:26 +02:00
|
|
|
len = SysStringLen(path)+1;
|
|
|
|
hres = UrlUnescapeW(path, NULL, &len, URL_UNESCAPE_INPLACE);
|
|
|
|
if (FAILED(hres)) {
|
|
|
|
SysFreeString(path);
|
2011-01-11 20:04:25 +01:00
|
|
|
return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
|
|
|
|
}
|
2016-05-18 18:29:26 +02:00
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
progid = path+1; /* skip '@' symbol */
|
|
|
|
colon_ptr = strchrW(path, ':');
|
2016-05-18 18:29:26 +02:00
|
|
|
if(!colon_ptr) {
|
|
|
|
SysFreeString(path);
|
2007-01-13 12:46:06 +01:00
|
|
|
return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
|
2011-01-11 20:03:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
len = strlenW(path);
|
|
|
|
display_name = heap_alloc((len+1)*sizeof(WCHAR));
|
|
|
|
memcpy(display_name, path, (len+1)*sizeof(WCHAR));
|
2007-01-13 12:46:06 +01:00
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
progid[colon_ptr-progid] = 0; /* overwrite ':' with NULL terminator */
|
2007-01-13 12:46:06 +01:00
|
|
|
hres = CLSIDFromProgID(progid, &clsid);
|
2016-05-18 18:29:26 +02:00
|
|
|
SysFreeString(path);
|
2007-01-13 12:46:06 +01:00
|
|
|
if(FAILED(hres))
|
2011-01-11 20:03:38 +01:00
|
|
|
{
|
|
|
|
heap_free(display_name);
|
2007-01-13 12:46:06 +01:00
|
|
|
return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
|
2011-01-11 20:03:38 +01:00
|
|
|
}
|
2007-01-13 12:46:06 +01:00
|
|
|
|
|
|
|
hres = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
|
|
&IID_IParseDisplayName, (void**)&pdn);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("Could not create object %s\n", debugstr_guid(&clsid));
|
2011-01-11 20:03:38 +01:00
|
|
|
heap_free(display_name);
|
2007-01-13 12:46:06 +01:00
|
|
|
return report_result(pOIProtSink, hres, ERROR_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IParseDisplayName_ParseDisplayName(pdn, NULL /* FIXME */, display_name, &eaten, &mon);
|
2007-11-29 22:12:34 +01:00
|
|
|
heap_free(display_name);
|
2007-01-13 12:46:06 +01:00
|
|
|
IParseDisplayName_Release(pdn);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("ParseDisplayName failed: %08x\n", hres);
|
|
|
|
return report_result(pOIProtSink, hres, ERROR_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->stream) {
|
|
|
|
IStream_Release(This->stream);
|
|
|
|
This->stream = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IMoniker_BindToStorage(mon, NULL /* FIXME */, NULL, &IID_IStream, (void**)&This->stream);
|
|
|
|
IMoniker_Release(mon);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("BindToStorage failed: %08x\n", hres);
|
|
|
|
return report_result(pOIProtSink, hres, ERROR_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IStream_Stat(This->stream, &statstg, STATFLAG_NONAME);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("Stat failed: %08x\n", hres);
|
|
|
|
return report_result(pOIProtSink, hres, ERROR_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
IInternetProtocolSink_ReportData(pOIProtSink,
|
|
|
|
BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION,
|
|
|
|
statstg.cbSize.u.LowPart, statstg.cbSize.u.LowPart);
|
|
|
|
return report_result(pOIProtSink, S_OK, ERROR_SUCCESS);
|
2007-01-12 12:31:54 +01:00
|
|
|
}
|
|
|
|
|
2011-01-11 20:03:38 +01:00
|
|
|
static const IInternetProtocolExVtbl MkProtocolVtbl = {
|
2007-01-12 12:31:54 +01:00
|
|
|
MkProtocol_QueryInterface,
|
|
|
|
MkProtocol_AddRef,
|
|
|
|
MkProtocol_Release,
|
|
|
|
MkProtocol_Start,
|
|
|
|
MkProtocol_Continue,
|
|
|
|
MkProtocol_Abort,
|
|
|
|
MkProtocol_Terminate,
|
|
|
|
MkProtocol_Suspend,
|
|
|
|
MkProtocol_Resume,
|
|
|
|
MkProtocol_Read,
|
|
|
|
MkProtocol_Seek,
|
|
|
|
MkProtocol_LockRequest,
|
2011-01-11 20:03:38 +01:00
|
|
|
MkProtocol_UnlockRequest,
|
|
|
|
MkProtocol_StartEx
|
2007-01-12 12:31:54 +01:00
|
|
|
};
|
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
HRESULT MkProtocol_Construct(IUnknown *outer, void **ppv)
|
2007-01-12 12:31:54 +01:00
|
|
|
{
|
|
|
|
MkProtocol *ret;
|
|
|
|
|
2018-05-08 18:18:41 +02:00
|
|
|
TRACE("(%p %p)\n", outer, ppv);
|
2007-01-12 12:31:54 +01:00
|
|
|
|
|
|
|
URLMON_LockModule();
|
|
|
|
|
2007-11-29 22:12:34 +01:00
|
|
|
ret = heap_alloc(sizeof(MkProtocol));
|
2007-01-12 12:31:54 +01:00
|
|
|
|
2019-06-03 21:50:16 +02:00
|
|
|
ret->IUnknown_inner.lpVtbl = &MkProtocolUnkVtbl;
|
2011-01-11 20:03:38 +01:00
|
|
|
ret->IInternetProtocolEx_iface.lpVtbl = &MkProtocolVtbl;
|
2007-01-12 12:31:54 +01:00
|
|
|
ret->ref = 1;
|
2019-06-03 21:50:16 +02:00
|
|
|
ret->outer = outer ? outer : &ret->IUnknown_inner;
|
2007-01-13 12:46:06 +01:00
|
|
|
ret->stream = NULL;
|
2007-01-12 12:31:54 +01:00
|
|
|
|
|
|
|
/* NOTE:
|
2018-05-08 18:18:41 +02:00
|
|
|
* Native returns NULL ppobj and S_OK in CreateInstance if called with IID_IUnknown riid and no outer.
|
2007-01-12 12:31:54 +01:00
|
|
|
*/
|
2019-06-03 21:50:16 +02:00
|
|
|
*ppv = &ret->IUnknown_inner;
|
2007-01-12 12:31:54 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|