Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: 21 Jun 2005 02:27:48 -0700,    group: microsoft.public.inetsdk.programming.urlmonikers        back       


pdf download fails in pluggable protocol environment   
Hello,

i'm trying to open an url of pdf file(prot://somethig/test.pdf) in the
pluggable environment. whenever i do that i'm getting a file download
dialog to open the pdf. if i choose adobe reader and click open then it
opens. however i want to open the pdf with in the pluggable environment
and with in the browser. This is happpening even though i'm reporting
mimetype to the ProtocolSink interface. do any one have a problem
earlier like this?

my start and read function would look like as follows:

HRESULT STDMETHODCALLTYPE CPOPPLpluggable::Start(
    /* [in] */ LPCWSTR pwzUrl,
    /* [in] */ IInternetProtocolSink __RPC_FAR  *pOIProtSink,
    /* [in] */ IInternetBindInfo __RPC_FAR *pOIBindInfo,
    /* [in] */ DWORD grfPI,
    /* [in] */ DWORD dwReserved)
{
    USES_CONVERSION;

    HRESULT hr   = E_FAIL;
    m_grfPI      = grfPI;

    m_pProtocolSink = pOIProtSink;
    m_pBindInfo     = pOIBindInfo;
    m_pRequest      = CreateRequest();

    m_bindinfo.cbSize = sizeof(BINDINFO);
    if (pOIBindInfo)
        hr = pOIBindInfo->GetBindInfo(&m_bindf, &m_bindinfo);

    // Parse URL and store results inside
    hr = m_pRequest->ParseUrl((wchar_t *)pwzUrl);

    if (FAILED(hr))
        return hr;

    if (m_grfPI & PI_PARSE_URL)
    {
        if (FAILED(hr))
            return S_FALSE;
        else
            return S_OK;
    }

        CString strMimeType = m_pRequest->m_ContentType;

        if (m_pRequest && BINDF_NEEDFILE && m_bindf &&
m_pRequest->m_Flag && strMimeType.Length() > 0)
        {
            LPWSTR realMime;

            HRESULT hr = FindMimeFromData(0, 0,
m_pRequest->Buffer().GetBuffer(), m_pRequest->GetBufferLength(), NULL,
0, &realMime, 0);
            if(FAILED(hr))
            realMime = LPWSTR(strMimeType.GetBuffer());

            CString strTempDir;
            strTempDir = getenv("TEMP");
            if (strTempDir.Length() == 0)
                strTempDir = getenv("TMP");
            else if (strTempDir.Length() == 0)
                strTempDir = "C:\\Temp";

            char strPath[100];
            sprintf(strPath, "%s\\%s", strTempDir,
m_pRequest->m_FileName.Substr(1));
            m_pRequest->WriteToFile(strPath);

m_pProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE,
realMime);

m_pProtocolSink->ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE,
LPCWSTR(strPath));
            m_pProtocolSink->ReportData(BSCF_DATAFULLYAVAILABLE,
m_pRequest->GetBufferLength(), m_pRequest->GetBufferLength());
        }

    if(SUCCEEDED(hr))
    {
        m_pWorkerThread = new CWorkerThread(this);
        m_pWorkerThread->Start();
        hr = E_PENDING;
    }

    return hr;
}


HRESULT STDMETHODCALLTYPE CPOPPLpluggable::Read(
    /* [length_is][size_is][out][in] */ void __RPC_FAR *pv,
    /* [in] */ ULONG cb,
    /* [out] */ ULONG __RPC_FAR *pcbRead)
{
    HRESULT hr;

    *pcbRead = m_pRequest->Read(pv, cb);
    hr =  (m_pRequest->Eof()) ? S_FALSE : S_OK;
    return hr;
}
date: 21 Jun 2005 02:27:48 -0700   author:   Raghavulu

Re: pdf download fails in pluggable protocol environment   
"Raghavulu"  wrote in message 
news:1119346068.310053.252230@g49g2000cwa.googlegroups.com...
>
>        if (m_pRequest && BINDF_NEEDFILE && m_bindf &&
> m_pRequest->m_Flag && strMimeType.Length() > 0)
>        {

Sorry for being dense, but - what exactly is this condition supposed to 
check? It does not make any sense to me.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Tue, 21 Jun 2005 08:49:12 -0400   author:   Igor Tandetnik

Re: pdf download fails in pluggable protocol environment   
Hello Igor,

i'm writing a file to local disk only when i have a
mimetype(strMimeType.Length() > 0) and bindf flags are required
(BINDF_NEEDFILE && m_bindf ) and an internal flag which has a value
true(m_pRequest->flag).

regards
raghav
date: 21 Jun 2005 10:17:29 -0700   author:   Raghavulu

Re: pdf download fails in pluggable protocol environment   
"Raghavulu"  wrote in message 
news:1119374249.005135.148680@g49g2000cwa.googlegroups.com...
> i'm writing a file to local disk only when i have a
> mimetype(strMimeType.Length() > 0) and bindf flags are required
> (BINDF_NEEDFILE && m_bindf )

Surely you meant a bitwise AND (&), not a logical AND (&&). Do you 
understand the difference between the two?

> and an internal flag which has a value
> true(m_pRequest->flag).

What is the significance of this check? When and how does 
m_pRequest->flag acquire its value?
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925
date: Tue, 21 Jun 2005 14:28:09 -0400   author:   Igor Tandetnik

Re: pdf download fails in pluggable protocol environment   
yes it should be a bitwise AND (&) and not a logical (&&). its an error
and i will modify my code. the flag will become true depends on the url
we got from the client. internally the url has a specific format and if
the url contains an extension which ends with .oms(url example:
prot://hostname/bin.oms/test.pdf) then it becomes true. its just a
sanitary check

whenever i click a pdf link, the whole if condition becomes true and
writes the file to the disk and opens with a download dialog box
date: 22 Jun 2005 00:23:22 -0700   author:   Raghavulu

Re: pdf download fails in pluggable protocol environment   
igor,

do you need any further information from me?

Thanks
Raghav
date: 23 Jun 2005 04:45:26 -0700   author:   Raghavulu

Re: pdf download fails in pluggable protocol environment   
Hi Raghavalu!

Some other things which could help:
- CAn you view normal PDF files within your browser in a HTML file? If
not, it could be that you must check the "View PDF in browser" flag in
the acrobat viewer.
- Does your APP write the PDF file into the IE's file cache?
- Which Acrobat version do you use? I have an APP which works with acro
4.0 to 6.0, but not with 7.0. Has anyone the same problem?

Best regards,
 Stefan

Raghavulu schrieb:
> igor,
> 
> do you need any further information from me?
> 
> Thanks
> Raghav
date: 27 Jun 2005 05:39:02 -0700   author:   nikolausi

Re: pdf download fails in pluggable protocol environment   
hi Stefan,

The problem i have is i'm not able to open the pdf in the APP
environment, which itself loads inside a custom built IEBrowser plugin.
however if i uncheck the checkbox display pdf in browser under edit >
preferences > internet, then the pdf opens in an external browser.

yes my i'm writing pdf file into temp directory but not into IE's cache

i'm using acrobat version 6.0

any ideas on my issue?

Regards
Raghavulu
date: 30 Jun 2005 01:02:31 -0700   author:   Raghavulu

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us