urldownloadtofile only prefetch

119 Views Asked by At

I am making a program that downloads files to a windows. To do so i used urlmon and the urldownload to file function. Whenever i download a file with the function in question in my windows i only get a prefetch file, but i can't find the file on my hard drive. Please tell me what i am doing wrong?

#include <windows.h>
#include <stdio.h>

typedef HRESULT (WINAPI *UDTF)(LPVOID, LPCTSTR, LPCTSTR, DWORD, LPVOID);

int dl_url(char *url, char *path)
{
    int q = 1;
    HMODULE hDll;
    UDTF URLDownloadToFile;

    if((hDll = LoadLibrary("urlmon")))
    {
        if((URLDownloadToFile = (UDTF)GetProcAddress(hDll, "URLDownloadToFileA")))
        {
            if(URLDownloadToFile(0, url, path, 0, 0) == 0)
            q = 0;
        }
        FreeLibrary(hDll);
    }

    return q;
}

Note: I use a 32 bit windows xp to test this program.

0

There are 0 best solutions below