2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
34 #include "mshtml_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 /********************************************************************
39 * common ProtocolFactory implementation
42 #define PROTOCOLINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl)
43 #define CLASSFACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl)
44 #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl)
47 const IInternetProtocolInfoVtbl *lpInternetProtocolInfoVtbl;
48 const IClassFactoryVtbl *lpClassFactoryVtbl;
51 #define PROTOCOLINFO_THIS(iface) DEFINE_THIS(ProtocolFactory, InternetProtocolInfo, iface)
53 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface, REFIID riid, void **ppv)
55 ProtocolFactory *This = PROTOCOLINFO_THIS(iface);
58 if(IsEqualGUID(&IID_IUnknown, riid)) {
59 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
60 *ppv = PROTOCOLINFO(This);
61 }else if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
62 TRACE("(%p)->(IID_IInternetProtocolInfo %p)\n", This, ppv);
63 *ppv = PROTOCOLINFO(This);
64 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
65 TRACE("(%p)->(IID_IClassFactory %p)\n", This, ppv);
66 *ppv = CLASSFACTORY(This);
70 WARN("unknown interface %s\n", debugstr_guid(riid));
74 IInternetProtocolInfo_AddRef(iface);
78 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
80 ProtocolFactory *This = PROTOCOLINFO_THIS(iface);
81 TRACE("(%p)\n", This);
86 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
88 ProtocolFactory *This = PROTOCOLINFO_THIS(iface);
89 TRACE("(%p)\n", This);
94 #undef PROTOCOLINFO_THIS
96 #define CLASSFACTORY_THIS(iface) DEFINE_THIS(ProtocolFactory, ClassFactory, iface)
98 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
100 ProtocolFactory *This = CLASSFACTORY_THIS(iface);
101 return IInternetProtocolInfo_QueryInterface(PROTOCOLINFO(This), riid, ppv);
104 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
106 ProtocolFactory *This = CLASSFACTORY_THIS(iface);
107 return IInternetProtocolInfo_AddRef(PROTOCOLINFO(This));
110 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
112 ProtocolFactory *This = CLASSFACTORY_THIS(iface);
113 return IInternetProtocolInfo_Release(PROTOCOLINFO(This));
116 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
118 ProtocolFactory *This = CLASSFACTORY_THIS(iface);
120 TRACE("(%p)->(%x)\n", This, dolock);
130 #undef CLASSFACTORY_THIS
132 /********************************************************************
133 * AboutProtocol implementation
137 const IInternetProtocolVtbl *lpInternetProtocolVtbl;
148 static HRESULT WINAPI AboutProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
150 AboutProtocol *This = (AboutProtocol*)iface;
154 if(IsEqualGUID(&IID_IUnknown, riid)) {
155 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
157 return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
158 *ppv = PROTOCOL(This);
159 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
160 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface, ppv);
161 *ppv = PROTOCOL(This);
162 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
163 TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface, ppv);
164 *ppv = PROTOCOL(This);
165 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
166 FIXME("IServiceProvider is not implemented\n");
167 return E_NOINTERFACE;
171 TRACE("unknown interface %s\n", debugstr_guid(riid));
172 return E_NOINTERFACE;
175 IInternetProtocol_AddRef(iface);
179 static ULONG WINAPI AboutProtocol_AddRef(IInternetProtocol *iface)
181 AboutProtocol *This = (AboutProtocol*)iface;
182 ULONG ref = InterlockedIncrement(&This->ref);
183 TRACE("(%p) ref=%ld\n", iface, ref);
184 return This->pUnkOuter ? IUnknown_AddRef(This->pUnkOuter) : ref;
187 static ULONG WINAPI AboutProtocol_Release(IInternetProtocol *iface)
189 AboutProtocol *This = (AboutProtocol*)iface;
190 ULONG ref = InterlockedDecrement(&This->ref);
192 TRACE("(%p) ref=%lx\n", iface, ref);
195 HeapFree(GetProcessHeap(), 0, This->data);
196 HeapFree(GetProcessHeap(), 0, This);
200 return This->pUnkOuter ? IUnknown_Release(This->pUnkOuter) : ref;
203 static HRESULT WINAPI AboutProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
204 IInternetProtocolSink* pOIProtSink, IInternetBindInfo* pOIBindInfo,
205 DWORD grfPI, DWORD dwReserved)
207 AboutProtocol *This = (AboutProtocol*)iface;
212 static const WCHAR html_begin[] = {0xfeff,'<','H','T','M','L','>',0};
213 static const WCHAR html_end[] = {'<','/','H','T','M','L','>',0};
214 static const WCHAR wszBlank[] = {'b','l','a','n','k',0};
215 static const WCHAR wszAbout[] = {'a','b','o','u','t',':'};
216 static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
219 * the about protocol seems not to work as I would expect. It creates html document
220 * for a given url, eg. about:some_text -> <HTML>some_text</HTML> except for the case when
221 * some_text = "blank", when document is blank (<HTML></HMTL>). The same happens
222 * when the url does not have "about:" in the beginning.
225 TRACE("(%p)->(%s %p %p %08lx %ld)\n", This, debugstr_w(szUrl), pOIProtSink,
226 pOIBindInfo, grfPI, dwReserved);
228 memset(&bindinfo, 0, sizeof(bindinfo));
229 bindinfo.cbSize = sizeof(BINDINFO);
230 IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo);
232 if(strlenW(szUrl)>=sizeof(wszAbout)/sizeof(WCHAR) && !memcmp(wszAbout, szUrl, sizeof(wszAbout))) {
233 text = szUrl + sizeof(wszAbout)/sizeof(WCHAR);
234 if(!strcmpW(wszBlank, text))
238 This->data_len = sizeof(html_begin)+sizeof(html_end)-sizeof(WCHAR)
239 + (text ? strlenW(text)*sizeof(WCHAR) : 0);
240 This->data = HeapAlloc(GetProcessHeap(), 0, This->data_len);
242 memcpy(This->data, html_begin, sizeof(html_begin));
244 strcatW((LPWSTR)This->data, text);
245 strcatW((LPWSTR)This->data, html_end);
249 IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml);
251 IInternetProtocolSink_ReportData(pOIProtSink,
252 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE,
253 This->data_len, This->data_len);
255 IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
260 static HRESULT WINAPI AboutProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA* pProtocolData)
262 AboutProtocol *This = (AboutProtocol*)iface;
263 FIXME("(%p)->(%p)\n", This, pProtocolData);
267 static HRESULT WINAPI AboutProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
270 AboutProtocol *This = (AboutProtocol*)iface;
271 FIXME("(%p)->(%08lx %08lx)\n", This, hrReason, dwOptions);
275 static HRESULT WINAPI AboutProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
277 AboutProtocol *This = (AboutProtocol*)iface;
278 TRACE("(%p)->(%08lx)\n", This, dwOptions);
282 static HRESULT WINAPI AboutProtocol_Suspend(IInternetProtocol *iface)
284 AboutProtocol *This = (AboutProtocol*)iface;
285 FIXME("(%p)\n", This);
289 static HRESULT WINAPI AboutProtocol_Resume(IInternetProtocol *iface)
291 AboutProtocol *This = (AboutProtocol*)iface;
292 FIXME("(%p)\n", This);
296 static HRESULT WINAPI AboutProtocol_Read(IInternetProtocol *iface, void* pv, ULONG cb, ULONG* pcbRead)
298 AboutProtocol *This = (AboutProtocol*)iface;
300 TRACE("(%p)->(%p %lu %p)\n", This, pv, cb, pcbRead);
305 *pcbRead = (cb > This->data_len-This->cur ? This->data_len-This->cur : cb);
310 memcpy(pv, This->data, *pcbRead);
311 This->cur += *pcbRead;
316 static HRESULT WINAPI AboutProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
317 DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)
319 AboutProtocol *This = (AboutProtocol*)iface;
320 FIXME("(%p)->(%ld %ld %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
324 static HRESULT WINAPI AboutProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
326 AboutProtocol *This = (AboutProtocol*)iface;
328 TRACE("(%p)->(%ld)\n", This, dwOptions);
333 static HRESULT WINAPI AboutProtocol_UnlockRequest(IInternetProtocol *iface)
335 AboutProtocol *This = (AboutProtocol*)iface;
337 TRACE("(%p)\n", This);
342 static const IInternetProtocolVtbl AboutProtocolVtbl = {
343 AboutProtocol_QueryInterface,
344 AboutProtocol_AddRef,
345 AboutProtocol_Release,
347 AboutProtocol_Continue,
349 AboutProtocol_Terminate,
350 AboutProtocol_Suspend,
351 AboutProtocol_Resume,
354 AboutProtocol_LockRequest,
355 AboutProtocol_UnlockRequest
358 static HRESULT WINAPI AboutProtocolFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
359 REFIID riid, void **ppv)
364 TRACE("(%p)->(%p %s %p)\n", iface, pUnkOuter, debugstr_guid(riid), ppv);
366 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(AboutProtocol));
367 ret->lpInternetProtocolVtbl = &AboutProtocolVtbl;
373 ret->pUnkOuter = pUnkOuter;
377 if(IsEqualGUID(&IID_IUnknown, riid))
378 *ppv = PROTOCOL(ret);
382 hres = IInternetProtocol_QueryInterface(PROTOCOL(ret), riid, ppv);
388 HeapFree(GetProcessHeap(), 0, ret);
393 static HRESULT WINAPI AboutProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
394 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
395 DWORD* pcchResult, DWORD dwReserved)
397 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), ParseAction,
398 dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
402 static HRESULT WINAPI AboutProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl,
403 LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult,
404 DWORD* pcchResult, DWORD dwReserved)
406 FIXME("%p)->(%s %s %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzBaseUrl), debugstr_w(pwzRelativeUrl),
407 dwCombineFlags, pwzResult, cchResult, pcchResult, dwReserved);
411 static HRESULT WINAPI AboutProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1,
412 LPCWSTR pwzUrl2, DWORD dwCompareFlags)
414 FIXME("%p)->(%s %s %08lx)\n", iface, debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
418 static HRESULT WINAPI AboutProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
419 QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
422 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
423 cbBuffer, pcbBuf, dwReserved);
427 static const IInternetProtocolInfoVtbl AboutProtocolInfoVtbl = {
428 InternetProtocolInfo_QueryInterface,
429 InternetProtocolInfo_AddRef,
430 InternetProtocolInfo_Release,
431 AboutProtocolInfo_ParseUrl,
432 AboutProtocolInfo_CombineUrl,
433 AboutProtocolInfo_CompareUrl,
434 AboutProtocolInfo_QueryInfo
437 static const IClassFactoryVtbl AboutProtocolFactoryVtbl = {
438 ClassFactory_QueryInterface,
440 ClassFactory_Release,
441 AboutProtocolFactory_CreateInstance,
442 ClassFactory_LockServer
445 static ProtocolFactory AboutProtocolFactory = {
446 &AboutProtocolInfoVtbl,
447 &AboutProtocolFactoryVtbl
450 /********************************************************************
451 * ResProtocol implementation
455 const IInternetProtocolVtbl *lpInternetProtocolVtbl;
463 static HRESULT WINAPI ResProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
467 if(IsEqualGUID(&IID_IUnknown, riid)) {
468 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
470 }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) {
471 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface, ppv);
473 }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
474 TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface, ppv);
476 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
477 FIXME("IServiceProvider is not implemented\n");
478 return E_NOINTERFACE;
482 TRACE("unknown interface %s\n", debugstr_guid(riid));
483 return E_NOINTERFACE;
486 IInternetProtocol_AddRef(iface);
490 static ULONG WINAPI ResProtocol_AddRef(IInternetProtocol *iface)
492 ResProtocol *This = (ResProtocol*)iface;
493 ULONG ref = InterlockedIncrement(&This->ref);
494 TRACE("(%p) ref=%ld\n", iface, ref);
498 static ULONG WINAPI ResProtocol_Release(IInternetProtocol *iface)
500 ResProtocol *This = (ResProtocol*)iface;
501 ULONG ref = InterlockedDecrement(&This->ref);
503 TRACE("(%p) ref=%lx\n", iface, ref);
506 HeapFree(GetProcessHeap(), 0, This->data);
507 HeapFree(GetProcessHeap(), 0, This);
514 static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
515 IInternetProtocolSink* pOIProtSink, IInternetBindInfo* pOIBindInfo,
516 DWORD grfPI, DWORD dwReserved)
518 ResProtocol *This = (ResProtocol*)iface;
523 LPCWSTR url_dll, url_file;
527 static const WCHAR wszRes[] = {'r','e','s',':','/','/'};
529 TRACE("(%p)->(%s %p %p %08lx %ld)\n", This, debugstr_w(szUrl), pOIProtSink,
530 pOIBindInfo, grfPI, dwReserved);
532 memset(&bindinfo, 0, sizeof(bindinfo));
533 bindinfo.cbSize = sizeof(BINDINFO);
534 IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo);
537 * Implement MIME type checking
538 * Use CoInternetParseUrl (not implemented yet)
541 len = strlenW(szUrl);
542 if(len < sizeof(wszRes)/sizeof(wszRes[0]) || memcmp(szUrl, wszRes, sizeof(wszRes))) {
543 WARN("Wrong protocol of url: %s\n", debugstr_w(szUrl));
544 IInternetProtocolSink_ReportResult(pOIProtSink, MK_E_SYNTAX, 0, NULL);
548 url_dll = szUrl + sizeof(wszRes)/sizeof(wszRes[0]);
549 if(!(url_file = strchrW(url_dll, '/'))) {
550 WARN("wrong url: %s\n", debugstr_w(szUrl));
551 IInternetProtocolSink_ReportResult(pOIProtSink, MK_E_SYNTAX, 0, NULL);
555 memcpy(dll, url_dll, (url_file-url_dll)*sizeof(WCHAR));
556 dll[url_file-url_dll] = 0;
558 hdll = LoadLibraryExW(dll, NULL, LOAD_LIBRARY_AS_DATAFILE);
560 WARN("Could not open dll: %s\n", debugstr_w(dll));
561 IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);
562 return HRESULT_FROM_WIN32(GetLastError());
565 src = FindResourceW(hdll, ++url_file, (LPCWSTR)RT_HTML);
567 WARN("Could not find resource: %s\n", debugstr_w(url_file));
568 IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);
569 return HRESULT_FROM_WIN32(GetLastError());
573 WARN("data already loaded\n");
574 HeapFree(GetProcessHeap(), 0, This->data);
577 This->data_len = SizeofResource(hdll, src);
578 This->data = HeapAlloc(GetProcessHeap(), 0, This->data_len);
579 memcpy(This->data, LoadResource(hdll, src), This->data_len);
584 IInternetProtocolSink_ReportData(pOIProtSink,
585 BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE,
586 This->data_len, This->data_len);
588 IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
593 static HRESULT WINAPI ResProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA* pProtocolData)
595 ResProtocol *This = (ResProtocol*)iface;
596 FIXME("(%p)->(%p)\n", This, pProtocolData);
600 static HRESULT WINAPI ResProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
603 ResProtocol *This = (ResProtocol*)iface;
604 FIXME("(%p)->(%08lx %08lx)\n", This, hrReason, dwOptions);
608 static HRESULT WINAPI ResProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
610 ResProtocol *This = (ResProtocol*)iface;
612 TRACE("(%p)->(%08lx)\n", This, dwOptions);
614 /* test show that we don't have to do anything here */
618 static HRESULT WINAPI ResProtocol_Suspend(IInternetProtocol *iface)
620 ResProtocol *This = (ResProtocol*)iface;
621 FIXME("(%p)\n", This);
625 static HRESULT WINAPI ResProtocol_Resume(IInternetProtocol *iface)
627 ResProtocol *This = (ResProtocol*)iface;
628 FIXME("(%p)\n", This);
632 static HRESULT WINAPI ResProtocol_Read(IInternetProtocol *iface, void* pv, ULONG cb, ULONG* pcbRead)
634 ResProtocol *This = (ResProtocol*)iface;
636 TRACE("(%p)->(%p %lu %p)\n", This, pv, cb, pcbRead);
641 *pcbRead = (cb > This->data_len-This->cur ? This->data_len-This->cur : cb);
646 memcpy(pv, This->data, *pcbRead);
647 This->cur += *pcbRead;
652 static HRESULT WINAPI ResProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove,
653 DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition)
655 ResProtocol *This = (ResProtocol*)iface;
656 FIXME("(%p)->(%ld %ld %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition);
660 static HRESULT WINAPI ResProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
662 ResProtocol *This = (ResProtocol*)iface;
664 TRACE("(%p)->(%ld)\n", This, dwOptions);
666 /* test show that we don't have to do anything here */
670 static HRESULT WINAPI ResProtocol_UnlockRequest(IInternetProtocol *iface)
672 ResProtocol *This = (ResProtocol*)iface;
674 TRACE("(%p)\n", This);
676 /* test show that we don't have to do anything here */
680 static const IInternetProtocolVtbl ResProtocolVtbl = {
681 ResProtocol_QueryInterface,
685 ResProtocol_Continue,
687 ResProtocol_Terminate,
692 ResProtocol_LockRequest,
693 ResProtocol_UnlockRequest
696 static HRESULT WINAPI ResProtocolFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
697 REFIID riid, void **ppv)
702 TRACE("(%p)->(%p %s %p)\n", iface, pUnkOuter, debugstr_guid(riid), ppv);
704 ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ResProtocol));
705 ret->lpInternetProtocolVtbl = &ResProtocolVtbl;
711 hres = IUnknown_QueryInterface((IUnknown*)ret, riid, ppv);
716 HeapFree(GetProcessHeap(), 0, ret);
721 static HRESULT WINAPI ResProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
722 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
723 DWORD* pcchResult, DWORD dwReserved)
725 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), ParseAction,
726 dwParseFlags, pwzResult, cchResult, pcchResult, dwReserved);
730 static HRESULT WINAPI ResProtocolInfo_CombineUrl(IInternetProtocolInfo *iface, LPCWSTR pwzBaseUrl,
731 LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult,
732 DWORD* pcchResult, DWORD dwReserved)
734 FIXME("%p)->(%s %s %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzBaseUrl), debugstr_w(pwzRelativeUrl),
735 dwCombineFlags, pwzResult, cchResult, pcchResult, dwReserved);
739 static HRESULT WINAPI ResProtocolInfo_CompareUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl1,
740 LPCWSTR pwzUrl2, DWORD dwCompareFlags)
742 FIXME("%p)->(%s %s %08lx)\n", iface, debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
746 static HRESULT WINAPI ResProtocolInfo_QueryInfo(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
747 QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD* pcbBuf,
750 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface, debugstr_w(pwzUrl), QueryOption, dwQueryFlags, pBuffer,
751 cbBuffer, pcbBuf, dwReserved);
755 static const IInternetProtocolInfoVtbl ResProtocolInfoVtbl = {
756 InternetProtocolInfo_QueryInterface,
757 InternetProtocolInfo_AddRef,
758 InternetProtocolInfo_Release,
759 ResProtocolInfo_ParseUrl,
760 ResProtocolInfo_CombineUrl,
761 ResProtocolInfo_CompareUrl,
762 ResProtocolInfo_QueryInfo
765 static const IClassFactoryVtbl ResProtocolFactoryVtbl = {
766 ClassFactory_QueryInterface,
768 ClassFactory_Release,
769 ResProtocolFactory_CreateInstance,
770 ClassFactory_LockServer
773 static ProtocolFactory ResProtocolFactory = {
774 &ResProtocolInfoVtbl,
775 &ResProtocolFactoryVtbl
778 HRESULT ProtocolFactory_Create(REFCLSID rclsid, REFIID riid, void **ppv)
780 ProtocolFactory *cf = NULL;
782 if(IsEqualGUID(&CLSID_AboutProtocol, rclsid))
783 cf = &AboutProtocolFactory;
784 else if(IsEqualGUID(&CLSID_ResProtocol, rclsid))
785 cf = &ResProtocolFactory;
788 FIXME("not implemented protocol %s\n", debugstr_guid(rclsid));
789 return CLASS_E_CLASSNOTAVAILABLE;
792 return IUnknown_QueryInterface((IUnknown*)cf, riid, ppv);