Skip to main content
gamedev.net
🔒 Locked

IM Worms

Started by trevaaar 0 replies 1.3k views
Original Post
trevaaar
trevaaar
I'm really getting tired of getting into conversations with friends who've installed those nice, friendly MSN worms that like to tell everybody on their list how cool MSN Block Checker is or where to get a bunch of super-cool smileys. I actually made a small EXE that would clean Block Checker off a computer in one click, but half the people I see with it don't trust me sending it to them over MSN because they think it will be a virus. Is there a good site I can point people to who have these problems but don't know how to manually screw with the registry and such? Source for the block-checker removal tool:

#define WIN32_LEAN_AND_MEAN
#define _CRT_SECURE_NO_DEPRECATE

#include <windows.h>
#include <shlobj.h>
#include <shlwapi.h>
#include <psapi.h>

#pragma comment(lib, "shlwapi.lib")
#pragma comment(lib, "psapi.lib")

char blockCheckerDir[MAX_PATH];

bool findProcess()
{
	DWORD needed, needed2;
	DWORD processIds[1024]; // should be big enough
	HMODULE hModule;
	EnumProcesses(processIds, sizeof(processIds), &needed);
	char processFilename[MAX_PATH];
	bool found = false;
	for(DWORD i = 0; i < needed / sizeof(DWORD); ++i)
	{
		HANDLE hProcess = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE | PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, FALSE, processIds);
		if(hProcess == NULL)
			continue;

		EnumProcessModules(hProcess, &hModule, sizeof(hModule), &needed2);
		GetModuleFileNameEx(hProcess, hModule, processFilename, MAX_PATH);

		// see if the process matches criteria...
		if(!_strnicmp(processFilename, blockCheckerDir, strlen(blockCheckerDir)))
		{
			TerminateProcess(hProcess, 0);
			WaitForSingleObject(hProcess, INFINITE);
			found = true;
		}

		CloseHandle(hProcess);
	}

	return found;
}

void delFolder(const char* path)
{
	WIN32_FIND_DATA wfd;
	strcpy(wfd.cFileName, path);
	PathAppend(wfd.cFileName, "\\*.*");
	HANDLE hFind;
	if(hFind = FindFirstFile(wfd.cFileName, &wfd))
	{
		do
		{
			if(!strcmp(wfd.cFileName, ".") || !strcmp(wfd.cFileName, ".."))
			{
				continue;
			}
			else
			{
				char temp[MAX_PATH];
				strcpy(temp, path);
				PathAppend(temp, wfd.cFileName);
				if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
					delFolder(temp);
				else
					DeleteFile(temp);
			}
		} while(FindNextFile(hFind, &wfd));
		FindClose(hFind);
	}

	RemoveDirectory(path);
}

INT WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	SHGetSpecialFolderPath(NULL, blockCheckerDir, CSIDL_PROGRAM_FILES, FALSE);
	PathAppend(blockCheckerDir, "Block Checker");

	findProcess();

	HKEY hKey = 0;
	if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_ALL_ACCESS, &hKey))
	{
		MessageBox(NULL, "Could not open registry key. You must be logged in as an administrator.", "BlockCheckerDeath", MB_ICONERROR);
		return 2;
	}

	if(RegDeleteValue(hKey, "BlockChecker"))
	{
		MessageBox(NULL, "Could not delete Block Checker key.", "BlockCheckerDeath", MB_ICONERROR);
		RegCloseKey(hKey);
		return 3;
	}

	RegCloseKey(hKey);

	delFolder(blockCheckerDir);

	MessageBox(NULL, "Operation complete.", "BlockCheckerDeath", MB_ICONINFORMATION);

	return 0;
}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.