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
35 #include "wine/debug.h"
36 #include "wine/unicode.h"
38 #include "mshtml_private.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
42 /********************************************************************
43 * common ProtocolFactory implementation
46 #define PROTOCOLINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl)
47 #define CLASSFACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl)
50 const IInternetProtocolInfoVtbl
*lpInternetProtocolInfoVtbl
;
51 const IClassFactoryVtbl
*lpClassFactoryVtbl
;
54 #define PROTOCOLINFO_THIS(iface) DEFINE_THIS(ProtocolFactory, InternetProtocolInfo, iface)
56 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
, REFIID riid
, void **ppv
)
58 ProtocolFactory
*This
= PROTOCOLINFO_THIS(iface
);
61 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
62 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
63 *ppv
= PROTOCOLINFO(This
);
64 }else if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
65 TRACE("(%p)->(IID_IInternetProtocolInfo %p)\n", This
, ppv
);
66 *ppv
= PROTOCOLINFO(This
);
67 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
68 TRACE("(%p)->(IID_IClassFactory %p)\n", This
, ppv
);
69 *ppv
= CLASSFACTORY(This
);
73 WARN("unknown interface %s\n", debugstr_guid(riid
));
77 IInternetProtocolInfo_AddRef(iface
);
81 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
83 ProtocolFactory
*This
= PROTOCOLINFO_THIS(iface
);
84 TRACE("(%p)\n", This
);
89 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
91 ProtocolFactory
*This
= PROTOCOLINFO_THIS(iface
);
92 TRACE("(%p)\n", This
);
97 #undef PROTOCOLINFO_THIS
99 #define CLASSFACTORY_THIS(iface) DEFINE_THIS(ProtocolFactory, ClassFactory, iface)
101 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
103 ProtocolFactory
*This
= CLASSFACTORY_THIS(iface
);
104 return IInternetProtocolInfo_QueryInterface(PROTOCOLINFO(This
), riid
, ppv
);
107 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
109 ProtocolFactory
*This
= CLASSFACTORY_THIS(iface
);
110 return IInternetProtocolInfo_AddRef(PROTOCOLINFO(This
));
113 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
115 ProtocolFactory
*This
= CLASSFACTORY_THIS(iface
);
116 return IInternetProtocolInfo_Release(PROTOCOLINFO(This
));
119 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
121 ProtocolFactory
*This
= CLASSFACTORY_THIS(iface
);
123 TRACE("(%p)->(%x)\n", This
, dolock
);
133 #undef CLASSFACTORY_THIS
135 /********************************************************************
136 * AboutProtocol implementation
140 const IInternetProtocolVtbl
*lpInternetProtocolVtbl
;
149 static HRESULT WINAPI
AboutProtocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
153 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
154 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
156 }else if(IsEqualGUID(&IID_IInternetProtocolRoot
, riid
)) {
157 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface
, ppv
);
159 }else if(IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
160 TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface
, ppv
);
162 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
163 FIXME("IServiceProvider is not implemented\n");
164 return E_NOINTERFACE
;
168 TRACE("unknown interface %s\n", debugstr_guid(riid
));
169 return E_NOINTERFACE
;
172 IInternetProtocol_AddRef(iface
);
176 static ULONG WINAPI
AboutProtocol_AddRef(IInternetProtocol
*iface
)
178 AboutProtocol
*This
= (AboutProtocol
*)iface
;
179 ULONG ref
= InterlockedIncrement(&This
->ref
);
180 TRACE("(%p) ref=%ld\n", iface
, ref
);
184 static ULONG WINAPI
AboutProtocol_Release(IInternetProtocol
*iface
)
186 AboutProtocol
*This
= (AboutProtocol
*)iface
;
187 ULONG ref
= InterlockedDecrement(&This
->ref
);
189 TRACE("(%p) ref=%lx\n", iface
, ref
);
192 HeapFree(GetProcessHeap(), 0, This
->data
);
193 HeapFree(GetProcessHeap(), 0, This
);
200 static HRESULT WINAPI
AboutProtocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
201 IInternetProtocolSink
* pOIProtSink
, IInternetBindInfo
* pOIBindInfo
,
202 DWORD grfPI
, DWORD dwReserved
)
204 AboutProtocol
*This
= (AboutProtocol
*)iface
;
209 static const WCHAR html_begin
[] = {0xfeff,'<','H','T','M','L','>',0};
210 static const WCHAR html_end
[] = {'<','/','H','T','M','L','>',0};
211 static const WCHAR wszBlank
[] = {'b','l','a','n','k',0};
212 static const WCHAR wszAbout
[] = {'a','b','o','u','t',':'};
213 static const WCHAR wszTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
216 * the about protocol seems not to work as I would expect. It creates html document
217 * for a given url, eg. about:some_text -> <HTML>some_text</HTML> except for the case when
218 * some_text = "blank", when document is blank (<HTML></HMTL>). The same happens
219 * when the url does not have "about:" in the beginning.
222 TRACE("(%p)->(%s %p %p %08lx %ld)\n", This
, debugstr_w(szUrl
), pOIProtSink
,
223 pOIBindInfo
, grfPI
, dwReserved
);
225 memset(&bindinfo
, 0, sizeof(bindinfo
));
226 bindinfo
.cbSize
= sizeof(BINDINFO
);
227 IInternetBindInfo_GetBindInfo(pOIBindInfo
, &grfBINDF
, &bindinfo
);
229 if(strlenW(szUrl
)>=sizeof(wszAbout
)/sizeof(WCHAR
) && !memcmp(wszAbout
, szUrl
, sizeof(wszAbout
))) {
230 text
= szUrl
+ sizeof(wszAbout
)/sizeof(WCHAR
);
231 if(!strcmpW(wszBlank
, text
))
235 This
->data_len
= sizeof(html_begin
)+sizeof(html_end
)-sizeof(WCHAR
)
236 + (text
? strlenW(text
)*sizeof(WCHAR
) : 0);
237 This
->data
= HeapAlloc(GetProcessHeap(), 0, This
->data_len
);
239 memcpy(This
->data
, html_begin
, sizeof(html_begin
));
241 strcatW((LPWSTR
)This
->data
, text
);
242 strcatW((LPWSTR
)This
->data
, html_end
);
246 IInternetProtocolSink_ReportProgress(pOIProtSink
, BINDSTATUS_MIMETYPEAVAILABLE
, wszTextHtml
);
248 IInternetProtocolSink_ReportData(pOIProtSink
,
249 BSCF_FIRSTDATANOTIFICATION
| BSCF_LASTDATANOTIFICATION
| BSCF_DATAFULLYAVAILABLE
,
250 This
->data_len
, This
->data_len
);
252 IInternetProtocolSink_ReportResult(pOIProtSink
, S_OK
, 0, NULL
);
257 static HRESULT WINAPI
AboutProtocol_Continue(IInternetProtocol
*iface
, PROTOCOLDATA
* pProtocolData
)
259 AboutProtocol
*This
= (AboutProtocol
*)iface
;
260 FIXME("(%p)->(%p)\n", This
, pProtocolData
);
264 static HRESULT WINAPI
AboutProtocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
267 AboutProtocol
*This
= (AboutProtocol
*)iface
;
268 FIXME("(%p)->(%08lx %08lx)\n", This
, hrReason
, dwOptions
);
272 static HRESULT WINAPI
AboutProtocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
274 AboutProtocol
*This
= (AboutProtocol
*)iface
;
275 TRACE("(%p)->(%08lx)\n", This
, dwOptions
);
279 static HRESULT WINAPI
AboutProtocol_Suspend(IInternetProtocol
*iface
)
281 AboutProtocol
*This
= (AboutProtocol
*)iface
;
282 FIXME("(%p)\n", This
);
286 static HRESULT WINAPI
AboutProtocol_Resume(IInternetProtocol
*iface
)
288 AboutProtocol
*This
= (AboutProtocol
*)iface
;
289 FIXME("(%p)\n", This
);
293 static HRESULT WINAPI
AboutProtocol_Read(IInternetProtocol
*iface
, void* pv
, ULONG cb
, ULONG
* pcbRead
)
295 AboutProtocol
*This
= (AboutProtocol
*)iface
;
297 TRACE("(%p)->(%p %lu %p)\n", This
, pv
, cb
, pcbRead
);
302 *pcbRead
= (cb
> This
->data_len
-This
->cur
? This
->data_len
-This
->cur
: cb
);
307 memcpy(pv
, This
->data
, *pcbRead
);
308 This
->cur
+= *pcbRead
;
313 static HRESULT WINAPI
AboutProtocol_Seek(IInternetProtocol
*iface
, LARGE_INTEGER dlibMove
,
314 DWORD dwOrigin
, ULARGE_INTEGER
* plibNewPosition
)
316 AboutProtocol
*This
= (AboutProtocol
*)iface
;
317 FIXME("(%p)->(%ld %ld %p)\n", This
, dlibMove
.u
.LowPart
, dwOrigin
, plibNewPosition
);
321 static HRESULT WINAPI
AboutProtocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
323 AboutProtocol
*This
= (AboutProtocol
*)iface
;
325 TRACE("(%p)->(%ld)\n", This
, dwOptions
);
330 static HRESULT WINAPI
AboutProtocol_UnlockRequest(IInternetProtocol
*iface
)
332 AboutProtocol
*This
= (AboutProtocol
*)iface
;
334 TRACE("(%p)\n", This
);
339 static const IInternetProtocolVtbl AboutProtocolVtbl
= {
340 AboutProtocol_QueryInterface
,
341 AboutProtocol_AddRef
,
342 AboutProtocol_Release
,
344 AboutProtocol_Continue
,
346 AboutProtocol_Terminate
,
347 AboutProtocol_Suspend
,
348 AboutProtocol_Resume
,
351 AboutProtocol_LockRequest
,
352 AboutProtocol_UnlockRequest
355 static HRESULT WINAPI
AboutProtocolFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pUnkOuter
,
356 REFIID riid
, void **ppv
)
361 TRACE("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
363 ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(AboutProtocol
));
364 ret
->lpInternetProtocolVtbl
= &AboutProtocolVtbl
;
371 hres
= IUnknown_QueryInterface((IUnknown
*)ret
, riid
, ppv
);
376 HeapFree(GetProcessHeap(), 0, ret
);
381 static HRESULT WINAPI
AboutProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
382 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
383 DWORD
* pcchResult
, DWORD dwReserved
)
385 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface
, debugstr_w(pwzUrl
), ParseAction
,
386 dwParseFlags
, pwzResult
, cchResult
, pcchResult
, dwReserved
);
390 static HRESULT WINAPI
AboutProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzBaseUrl
,
391 LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
, LPWSTR pwzResult
, DWORD cchResult
,
392 DWORD
* pcchResult
, DWORD dwReserved
)
394 FIXME("%p)->(%s %s %08lx %p %ld %p %ld)\n", iface
, debugstr_w(pwzBaseUrl
), debugstr_w(pwzRelativeUrl
),
395 dwCombineFlags
, pwzResult
, cchResult
, pcchResult
, dwReserved
);
399 static HRESULT WINAPI
AboutProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl1
,
400 LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
402 FIXME("%p)->(%s %s %08lx)\n", iface
, debugstr_w(pwzUrl1
), debugstr_w(pwzUrl2
), dwCompareFlags
);
406 static HRESULT WINAPI
AboutProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
407 QUERYOPTION QueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
, DWORD cbBuffer
, DWORD
* pcbBuf
,
410 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface
, debugstr_w(pwzUrl
), QueryOption
, dwQueryFlags
, pBuffer
,
411 cbBuffer
, pcbBuf
, dwReserved
);
415 static const IInternetProtocolInfoVtbl AboutProtocolInfoVtbl
= {
416 InternetProtocolInfo_QueryInterface
,
417 InternetProtocolInfo_AddRef
,
418 InternetProtocolInfo_Release
,
419 AboutProtocolInfo_ParseUrl
,
420 AboutProtocolInfo_CombineUrl
,
421 AboutProtocolInfo_CompareUrl
,
422 AboutProtocolInfo_QueryInfo
425 static const IClassFactoryVtbl AboutProtocolFactoryVtbl
= {
426 ClassFactory_QueryInterface
,
428 ClassFactory_Release
,
429 AboutProtocolFactory_CreateInstance
,
430 ClassFactory_LockServer
433 static ProtocolFactory AboutProtocolFactory
= {
434 &AboutProtocolInfoVtbl
,
435 &AboutProtocolFactoryVtbl
438 /********************************************************************
439 * ResProtocol implementation
443 const IInternetProtocolVtbl
*lpInternetProtocolVtbl
;
451 static HRESULT WINAPI
ResProtocol_QueryInterface(IInternetProtocol
*iface
, REFIID riid
, void **ppv
)
455 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
456 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
458 }else if(IsEqualGUID(&IID_IInternetProtocolRoot
, riid
)) {
459 TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", iface
, ppv
);
461 }else if(IsEqualGUID(&IID_IInternetProtocol
, riid
)) {
462 TRACE("(%p)->(IID_IInternetProtocol %p)\n", iface
, ppv
);
464 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
465 FIXME("IServiceProvider is not implemented\n");
466 return E_NOINTERFACE
;
470 TRACE("unknown interface %s\n", debugstr_guid(riid
));
471 return E_NOINTERFACE
;
474 IInternetProtocol_AddRef(iface
);
478 static ULONG WINAPI
ResProtocol_AddRef(IInternetProtocol
*iface
)
480 ResProtocol
*This
= (ResProtocol
*)iface
;
481 ULONG ref
= InterlockedIncrement(&This
->ref
);
482 TRACE("(%p) ref=%ld\n", iface
, ref
);
486 static ULONG WINAPI
ResProtocol_Release(IInternetProtocol
*iface
)
488 ResProtocol
*This
= (ResProtocol
*)iface
;
489 ULONG ref
= InterlockedDecrement(&This
->ref
);
491 TRACE("(%p) ref=%lx\n", iface
, ref
);
494 HeapFree(GetProcessHeap(), 0, This
->data
);
495 HeapFree(GetProcessHeap(), 0, This
);
502 static HRESULT WINAPI
ResProtocol_Start(IInternetProtocol
*iface
, LPCWSTR szUrl
,
503 IInternetProtocolSink
* pOIProtSink
, IInternetBindInfo
* pOIBindInfo
,
504 DWORD grfPI
, DWORD dwReserved
)
506 ResProtocol
*This
= (ResProtocol
*)iface
;
511 LPCWSTR url_dll
, url_file
;
515 static const WCHAR wszRes
[] = {'r','e','s',':','/','/'};
517 TRACE("(%p)->(%s %p %p %08lx %ld)\n", This
, debugstr_w(szUrl
), pOIProtSink
,
518 pOIBindInfo
, grfPI
, dwReserved
);
520 memset(&bindinfo
, 0, sizeof(bindinfo
));
521 bindinfo
.cbSize
= sizeof(BINDINFO
);
522 IInternetBindInfo_GetBindInfo(pOIBindInfo
, &grfBINDF
, &bindinfo
);
525 * Implement MIME type checking
526 * Use CoInternetParseUrl (not implemented yet)
529 len
= strlenW(szUrl
);
530 if(len
< sizeof(wszRes
)/sizeof(wszRes
[0]) || memcmp(szUrl
, wszRes
, sizeof(wszRes
))) {
531 WARN("Wrong protocol of url: %s\n", debugstr_w(szUrl
));
532 IInternetProtocolSink_ReportResult(pOIProtSink
, MK_E_SYNTAX
, 0, NULL
);
536 url_dll
= szUrl
+ sizeof(wszRes
)/sizeof(wszRes
[0]);
537 if(!(url_file
= strchrW(url_dll
, '/'))) {
538 WARN("wrong url: %s\n", debugstr_w(szUrl
));
539 IInternetProtocolSink_ReportResult(pOIProtSink
, MK_E_SYNTAX
, 0, NULL
);
543 memcpy(dll
, url_dll
, (url_file
-url_dll
)*sizeof(WCHAR
));
544 dll
[url_file
-url_dll
] = 0;
546 hdll
= LoadLibraryExW(dll
, NULL
, LOAD_LIBRARY_AS_DATAFILE
);
548 WARN("Could not open dll: %s\n", debugstr_w(dll
));
549 IInternetProtocolSink_ReportResult(pOIProtSink
, HRESULT_FROM_WIN32(GetLastError()), 0, NULL
);
550 return HRESULT_FROM_WIN32(GetLastError());
553 src
= FindResourceW(hdll
, ++url_file
, (LPCWSTR
)RT_HTML
);
555 WARN("Could not find resource: %s\n", debugstr_w(url_file
));
556 IInternetProtocolSink_ReportResult(pOIProtSink
, HRESULT_FROM_WIN32(GetLastError()), 0, NULL
);
557 return HRESULT_FROM_WIN32(GetLastError());
561 WARN("data already loaded\n");
562 HeapFree(GetProcessHeap(), 0, This
->data
);
565 This
->data_len
= SizeofResource(hdll
, src
);
566 This
->data
= HeapAlloc(GetProcessHeap(), 0, This
->data_len
);
567 memcpy(This
->data
, LoadResource(hdll
, src
), This
->data_len
);
572 IInternetProtocolSink_ReportData(pOIProtSink
,
573 BSCF_FIRSTDATANOTIFICATION
| BSCF_LASTDATANOTIFICATION
| BSCF_DATAFULLYAVAILABLE
,
574 This
->data_len
, This
->data_len
);
576 IInternetProtocolSink_ReportResult(pOIProtSink
, S_OK
, 0, NULL
);
581 static HRESULT WINAPI
ResProtocol_Continue(IInternetProtocol
*iface
, PROTOCOLDATA
* pProtocolData
)
583 ResProtocol
*This
= (ResProtocol
*)iface
;
584 FIXME("(%p)->(%p)\n", This
, pProtocolData
);
588 static HRESULT WINAPI
ResProtocol_Abort(IInternetProtocol
*iface
, HRESULT hrReason
,
591 ResProtocol
*This
= (ResProtocol
*)iface
;
592 FIXME("(%p)->(%08lx %08lx)\n", This
, hrReason
, dwOptions
);
596 static HRESULT WINAPI
ResProtocol_Terminate(IInternetProtocol
*iface
, DWORD dwOptions
)
598 ResProtocol
*This
= (ResProtocol
*)iface
;
600 TRACE("(%p)->(%08lx)\n", This
, dwOptions
);
602 /* test show that we don't have to do anything here */
606 static HRESULT WINAPI
ResProtocol_Suspend(IInternetProtocol
*iface
)
608 ResProtocol
*This
= (ResProtocol
*)iface
;
609 FIXME("(%p)\n", This
);
613 static HRESULT WINAPI
ResProtocol_Resume(IInternetProtocol
*iface
)
615 ResProtocol
*This
= (ResProtocol
*)iface
;
616 FIXME("(%p)\n", This
);
620 static HRESULT WINAPI
ResProtocol_Read(IInternetProtocol
*iface
, void* pv
, ULONG cb
, ULONG
* pcbRead
)
622 ResProtocol
*This
= (ResProtocol
*)iface
;
624 TRACE("(%p)->(%p %lu %p)\n", This
, pv
, cb
, pcbRead
);
629 *pcbRead
= (cb
> This
->data_len
-This
->cur
? This
->data_len
-This
->cur
: cb
);
634 memcpy(pv
, This
->data
, *pcbRead
);
635 This
->cur
+= *pcbRead
;
640 static HRESULT WINAPI
ResProtocol_Seek(IInternetProtocol
*iface
, LARGE_INTEGER dlibMove
,
641 DWORD dwOrigin
, ULARGE_INTEGER
* plibNewPosition
)
643 ResProtocol
*This
= (ResProtocol
*)iface
;
644 FIXME("(%p)->(%ld %ld %p)\n", This
, dlibMove
.u
.LowPart
, dwOrigin
, plibNewPosition
);
648 static HRESULT WINAPI
ResProtocol_LockRequest(IInternetProtocol
*iface
, DWORD dwOptions
)
650 ResProtocol
*This
= (ResProtocol
*)iface
;
652 TRACE("(%p)->(%ld)\n", This
, dwOptions
);
654 /* test show that we don't have to do anything here */
658 static HRESULT WINAPI
ResProtocol_UnlockRequest(IInternetProtocol
*iface
)
660 ResProtocol
*This
= (ResProtocol
*)iface
;
662 TRACE("(%p)\n", This
);
664 /* test show that we don't have to do anything here */
668 static const IInternetProtocolVtbl ResProtocolVtbl
= {
669 ResProtocol_QueryInterface
,
673 ResProtocol_Continue
,
675 ResProtocol_Terminate
,
680 ResProtocol_LockRequest
,
681 ResProtocol_UnlockRequest
684 static HRESULT WINAPI
ResProtocolFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pUnkOuter
,
685 REFIID riid
, void **ppv
)
690 TRACE("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
692 ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(ResProtocol
));
693 ret
->lpInternetProtocolVtbl
= &ResProtocolVtbl
;
699 hres
= IUnknown_QueryInterface((IUnknown
*)ret
, riid
, ppv
);
704 HeapFree(GetProcessHeap(), 0, ret
);
709 static HRESULT WINAPI
ResProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
710 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
711 DWORD
* pcchResult
, DWORD dwReserved
)
713 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface
, debugstr_w(pwzUrl
), ParseAction
,
714 dwParseFlags
, pwzResult
, cchResult
, pcchResult
, dwReserved
);
718 static HRESULT WINAPI
ResProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzBaseUrl
,
719 LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
, LPWSTR pwzResult
, DWORD cchResult
,
720 DWORD
* pcchResult
, DWORD dwReserved
)
722 FIXME("%p)->(%s %s %08lx %p %ld %p %ld)\n", iface
, debugstr_w(pwzBaseUrl
), debugstr_w(pwzRelativeUrl
),
723 dwCombineFlags
, pwzResult
, cchResult
, pcchResult
, dwReserved
);
727 static HRESULT WINAPI
ResProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl1
,
728 LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
730 FIXME("%p)->(%s %s %08lx)\n", iface
, debugstr_w(pwzUrl1
), debugstr_w(pwzUrl2
), dwCompareFlags
);
734 static HRESULT WINAPI
ResProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
735 QUERYOPTION QueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
, DWORD cbBuffer
, DWORD
* pcbBuf
,
738 FIXME("%p)->(%s %08x %08lx %p %ld %p %ld)\n", iface
, debugstr_w(pwzUrl
), QueryOption
, dwQueryFlags
, pBuffer
,
739 cbBuffer
, pcbBuf
, dwReserved
);
743 static const IInternetProtocolInfoVtbl ResProtocolInfoVtbl
= {
744 InternetProtocolInfo_QueryInterface
,
745 InternetProtocolInfo_AddRef
,
746 InternetProtocolInfo_Release
,
747 ResProtocolInfo_ParseUrl
,
748 ResProtocolInfo_CombineUrl
,
749 ResProtocolInfo_CompareUrl
,
750 ResProtocolInfo_QueryInfo
753 static const IClassFactoryVtbl ResProtocolFactoryVtbl
= {
754 ClassFactory_QueryInterface
,
756 ClassFactory_Release
,
757 ResProtocolFactory_CreateInstance
,
758 ClassFactory_LockServer
761 static ProtocolFactory ResProtocolFactory
= {
762 &ResProtocolInfoVtbl
,
763 &ResProtocolFactoryVtbl
766 HRESULT
ProtocolFactory_Create(REFCLSID rclsid
, REFIID riid
, void **ppv
)
768 ProtocolFactory
*cf
= NULL
;
770 if(IsEqualGUID(&CLSID_AboutProtocol
, rclsid
))
771 cf
= &AboutProtocolFactory
;
772 else if(IsEqualGUID(&CLSID_ResProtocol
, rclsid
))
773 cf
= &ResProtocolFactory
;
776 FIXME("not implemented protocol %s\n", debugstr_guid(rclsid
));
777 return CLASS_E_CLASSNOTAVAILABLE
;
780 return IUnknown_QueryInterface((IUnknown
*)cf
, riid
, ppv
);