Windows > Software Development for Windows Client Forums > General Windows Development Issues > URLDownloadToCacheFile() and UrlDownloadFile hang on Vista 64
Ask a questionAsk a question
 

QuestionURLDownloadToCacheFile() and UrlDownloadFile hang on Vista 64

  • Wednesday, November 04, 2009 3:54 PMBjoseph Wombat Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    On Vista 64 bit systems (two tested), this simple program doesn't return from
    a URLDownloadToCacheFile() call when its run twice on a Vista 64 Home Premiun
    system(s).

    Since there is no call back function for status, there is no output for a
    minute or two as the download happens. The failure is never on the first
    run. Sometimes to cause the failure we launch IE8, minimize it and then
    launch the second run of the test app. Have never gotten this to fail on XP
    or 32 bit Vista systems.

    Tried the orignal app with URLDownloadToFile(), same failure. In the
    orignal app, that has support for a BindStatus function, the last msg that we
    see is BINDSTATUS_REDIRECT and the BINDSTATUS_CLASSIDAVAILABLE msg never
    arrives.

    Is there a work around to this problem?



    The source below is built as a win console app on vs2005. A binary will be
    posted if there is a way to upload one.

    #include "stdafx.h"
    #include <urlmon.h>
    //#include <iostream>

    //using namespace std;


    int _tmain(int argc, _TCHAR* argv[])
    {
    WCHAR p[MAX_PATH];
    LPTSTR strFileName=p;
    //LPCSTR
    strUrl="http://vivox.s3.amazonaws.com/activex-trunk-1.0.13.2136-Release.msi";
    LPCTSTR
    strUrl=_T("http://code.vivox.com/downloads/activex-1.0.12-1.12.1.2100-Release.msi");
    const HRESULT hr = ::URLDownloadToCacheFile(NULL,
    strUrl,
    strFileName,
    MAX_PATH,
    0,
    NULL);

    if ( hr == S_OK) {
    printf ("Return status is S_OK, file location is %ls\n", strFileName);
    } else {
    printf ("Return status is %x, \n", hr);
    }
    printf ("\n\n Press Enter to exit......");
    char input_line[512];
    gets(input_line);


    return 0;
    }