{"id":107,"date":"2007-11-11T15:16:02","date_gmt":"2007-11-11T19:16:02","guid":{"rendered":"http:\/\/www.virtualroadside.com\/blog\/index.php\/2007\/11\/11\/inspired-by-xkcd-mbr-love-note\/"},"modified":"2008-12-31T11:14:40","modified_gmt":"2008-12-31T16:14:40","slug":"inspired-by-xkcd-mbr-love-note","status":"publish","type":"post","link":"http:\/\/www.virtualroadside.com\/blog\/index.php\/2007\/11\/11\/inspired-by-xkcd-mbr-love-note\/","title":{"rendered":"Inspired by XKCD: MBR Love Note"},"content":{"rendered":"<p>I am a huge fan of the webcomic, <a href=\"http:\/\/www.xkcd.com\">XKCD<\/a>, which is a very geeky and amusing comic for those of you who haven&#8217;t read it. On Friday, the following comic was posted:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/imgs.xkcd.com\/comics\/fight.png\" alt=\"\" width=\"550\" \/><\/p>\n<p>And this of course reminded me of when I first started programming &#8212; I started with assembly language in 2000 with an 80286 I got out of the trash. I quickly became interested in low-level system programming, and created a number of MBR-based programs and other random programs in assembly. I haven&#8217;t programmed in assembly in a couple years, but this was pretty simple once I started going. \ud83d\ude42<\/p>\n<p>In any case, the comic has inspired me to write a Windows-based program that can write a &#8220;love note&#8221; to the MBR and display it when the computer starts. And of course, just for fun it shows the &#8220;Missing operating system&#8221; message as well. Shown is a screenshot:<\/p>\n<p><a title=\"Roses are red\u2026 missing operating system.\" href=\"http:\/\/www.virtualroadside.com\/blog\/wp-content\/uploads\/2007\/11\/lovenote_ss.jpg\"><img decoding=\"async\" src=\"http:\/\/www.virtualroadside.com\/blog\/wp-content\/uploads\/2007\/11\/lovenote_ss.jpg\" alt=\"Roses are red\u2026 missing operating system.\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<p>OBVIOUSLY this can be a very dangerous program, and could very well destroy your computer. In fact, I would assume any antivirus program worth its salt would detect this as a virus (I haven&#8217;t formally tested this assumption). So, don&#8217;t use it unless you really know what you&#8217;re doing. The number of people that would fit that description is around 0.001% of the population of computer programmers.<\/p>\n<p><strong>DONT&#8217;S:<\/strong><\/p>\n<ul>\n<li>Don&#8217;t use this program if you do not know how to uninstall this program<br \/>\nmanually. For that reason, there is no uninstaller.<\/li>\n<li>Don&#8217;t use this on 64-bit machines or ones with EFI &#8212; I really have no idea if it will work on those machines, but I seriously doubt it would. If you don&#8217;t know what EFI is, don&#8217;t use this program.<\/li>\n<li>Don&#8217;t use this on machines with GRUB, it will kill your system.<\/li>\n<li>Don&#8217;t use this on any system that is important to you or one that you do not own\/control, it may kill that system, and you will get in trouble.<\/li>\n<li>Don&#8217;t use this program if you cannot pass the following quiz without any<br \/>\nreferences. Especially don&#8217;t use this program if you have no idea how to<br \/>\ndecode the answers to the quiz.<\/li>\n<\/ul>\n<p><strong>Quiz:<\/strong><\/p>\n<ol>\n<li>What is the difference between an MBR and a boot sector?<\/li>\n<li>What does interrupt 0x19 do?<\/li>\n<li>What offset does the partition table start at in an MBR, and how many bytes is each entry?<\/li>\n<li>What offset is the &#8220;signature&#8221; of the MBR located at, and what is it?<\/li>\n<\/ol>\n<p><strong>Quiz Answers (encoded in ROT13)<\/strong><\/p>\n<ol>\n<li>Obbg frpgbef ner qrsvarq cre cnegvgvba, gurer vf bayl bar (hfrq) ZOE.<\/li>\n<li>Vg vf gur vagreehcg pnyyrq gb obbg sebz n qvfx.<\/li>\n<li>0k1OR, fvkgrra olgrf<\/li>\n<li>Vg vf ybpngrq ng 0k1sr, naq vf 0k55 sbyybjrq ol 0kNN<\/li>\n<\/ol>\n<p><strong>How it works<\/strong><br \/>\nYou run love.exe in Windows, and it asks you for a message to put on the MBR. After clicking &#8220;destroy&#8221;, it does it. It will work in XP as administrator. It actually writes the love note to sector 3, the original MBR to sector 2, and a custom MBR to the MBR that displays the note, waits for a key to be pressed, and then loads the original MBR &#8212; at which point the computer will continue booting.<\/p>\n<p>I used <a href=\"http:\/\/nasm.sourceforge.net\">NASM <\/a>to compile the MBR code, and Visual Studio 2005 to compile the Windows<br \/>\ninstallation program. I&#8217;ve never coded with MFC before, and this experience has not<br \/>\nmotivated me to do it again anytime in the near future.<\/p>\n<p>If you have any questions\/comments\/bug reports for this, feel free to contact me.<\/p>\n<p>Download link: <a href=\"http:\/\/www.virtualroadside.com\/software\/\">http:\/\/www.virtualroadside.com\/software\/<\/a><\/p>\n<p><span style=\"text-decoration: underline;\">Note:<\/span> In response to the comment by Criveti Mihai, the binary for the MBR sector actually is in the zip file at src\/love\/love\/mbr.bin .. except if you were to install it via DD, you would need to install a message on sector 3 as well.<\/p>\n<p><span style=\"text-decoration: underline;\">Note II:<\/span> apparently the 4th answer to the quiz was incorrect for the last year or so&#8230; heh. Told you it was hard! Anyways, thanks to <a href=\"http:\/\/www.bttr-software.de\/\">cm<\/a> for pointing this out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am a huge fan of the webcomic, XKCD, which is a very geeky and amusing comic for those of you who haven&#8217;t read it. On Friday, the following comic was posted: And this of course reminded me of when I first started programming &#8212; I started with assembly language in 2000 with an 80286 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,31,23],"tags":[],"_links":{"self":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/107"}],"collection":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":2,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":208,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/107\/revisions\/208"}],"wp:attachment":[{"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.virtualroadside.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}