Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Asynchronous Pluggable Protocol handler - Read problem

22 views
Skip to first unread message

Falko Niemz

unread,
Mar 26, 2003, 5:56:56 AM3/26/03
to
Hi all,

I wrote an APP handler for handling all 'file' protocol stuf in the current
process. Basicaly it works but in some caseswebbrowser doesn't read complete
content. (sorry for the long text)

sample: smal html file with embedded mini gif.

first the html file is requested and read completly, than the gif-file is
requested but only the first 200 bytes are read. (The gif is shown in the
webbrowser control but only the top part of it)
a small log of all Interface calls follows:

##
IClassFactory::CreateInstance
IInternetProtocol::Start (file://D:\..\HLP_PSC_DLG_FRM.html) Bind Info
0x00100C21
IInternetProtocol::Read (HLP_PSC_DLG_FRM.html) bytes: 350/4096
IInternetProtocol::Read (HLP_PSC_DLG_FRM.html) bytes: 0/7842
IInternetProtocol::LockRequest (HLP_PSC_DLG_FRM.html)
IInternetProtocol::Read (HLP_PSC_DLG_FRM.html) bytes: 0/7842
IInternetProtocol::Read (HLP_PSC_DLG_FRM.html) bytes: 0/7842
IInternetProtocol::Terminate (HLP_PSC_DLG_FRM.html)
IInternetProtocol::UnlockRequest (HLP_PSC_DLG_FRM.html)
IClassFactory::CreateInstance
IInternetProtocol::Start (file:///D:/../buch10%5B1%5D.gif) Bind Info
0x00121883
IInternetProtocol::Read (buch10[1].gif) bytes: 200/200
IInternetProtocol::Terminate (buch10[1].gif)
##

May be the ReportResult, ReportData and ReportProgress calls has something
to do with this. It's not really clear when should I call what.

Another mysterious thing is the html read cycles. The First read gets all
data. What does the other?


Igor Tandetnik

unread,
Mar 26, 2003, 10:24:59 AM3/26/03
to
There are two important things an APP has to do. First, you need to
report the MIME type of the data with
ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) as soon as you know it.
Second, in IInternetProtocol::Start you need to call
IInternetBindInfo::GetBindInfo. If the client specifies BINDF_NEEDFILE
flag, you need to store the response into a file and report the file
name using ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE). The file
does not have to be in the cache. If you already have the file on disk,
you can just report its name. Otherwise, you can allocate yourself a
cache entry using CreateUrlCacheEntry (essentially, it's just a
convenient way of having the system manage temporary files for you).
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Falko Niemz" <ni...@pisa.de> wrote in message
news:eW#4sZ48C...@TK2MSFTNGP10.phx.gbl...

Falko Niemz

unread,
Mar 26, 2003, 12:14:39 PM3/26/03
to
... New problems

I called first ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) with the exact
mime type
and than ReportResult (S_OK, 0, NULL).
The BINDF_NEEDFILE isn't requestet in my scenario.

The Webrowser Control showns an error message (break).

Ok I did a debug session.

On the ReportResult call comes immediately a Terminate and thats all.
Than I inserted a ReportData (BSCF_LASTDATANOTIFICATION |
BSCF_DATAFULLYAVAILABLE) call before the ReportResult.
Now the HTML content is read but on the gif file comes millions of reads
with no end.
What's this?

What is about the ReportData call. When should I call this method?

Bye Falko

"Igor Tandetnik" <itand...@whenu.com> wrote in message
news:#DO1hv68...@TK2MSFTNGP12.phx.gbl...

Igor Tandetnik

unread,
Mar 26, 2003, 12:37:45 PM3/26/03
to
This is what I do in an APP that generates a bitmap on the fly:

STDMETHODIMP CBitmapAPP::Start(LPCWSTR szUrl, IInternetProtocolSink
*pOIProtSink,
IInternetBindInfo *pOIBindInfo, DWORD grfPI, DWORD dwReserved)
{
if ((grfPI & PI_PARSE_URL) != 0)
return S_OK;
if (!pOIProtSink)
return E_POINTER;

pOIProtSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE,
L"image/bmp");

pOIProtSink->ReportData(
BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION |
BSCF_DATAFULLYAVAILABLE,
m_dwSize, m_dwSize);

pOIProtSink->ReportResult(S_OK, 200, 0);
return S_OK;
}

Works just fine. IInternetProtocol::Read gets called several times
before ReportData returns - be prepared for reentrancy.


--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken

"Falko Niemz" <ni...@pisa.de> wrote in message

news:O7AFxs78...@TK2MSFTNGP10.phx.gbl...

0 new messages