{"id":3934,"date":"2016-11-23T01:00:27","date_gmt":"2016-11-23T01:00:27","guid":{"rendered":"http:\/\/www.hexacorn.com\/blog\/?p=3934"},"modified":"2016-11-23T01:23:15","modified_gmt":"2016-11-23T01:23:15","slug":"the-archaeologologogology-1-vbd6-dll-and-vbe7-dll-midi-file","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2016\/11\/23\/the-archaeologologogology-1-vbd6-dll-and-vbe7-dll-midi-file\/","title":{"rendered":"The Archaeologologogology #1 &#8211; vbd6.dll and vbe7.dll MIDI file"},"content":{"rendered":"<p>With this post I start a new series that will talk about ancient code scrolls that are nothing, but a trivia related to some old software. Basically, a stuff of the past, re-visited without any other purpose, but the amusement&#8230;<\/p>\n<p>I will kick it off by inviting you to explore the content of vbe6.dll or vbe7.dll inside your Microsoft Office installation. Using Resource Hacker you can quickly discover that it has a mysterious resource 5432:<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_midi.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-3935 size-full\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_midi.png\" alt=\"vbe_midi\" width=\"379\" height=\"226\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_midi.png 379w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_midi-300x179.png 300w\" sizes=\"(max-width: 379px) 100vw, 379px\" \/><\/a>Using the very same Resource Hacker you can immediately play the music file that it recognizes. The md5 of the MIDI resource is 9b90e2e51483460501f711aa80508f7e.<\/p>\n<p>I am not the first one to discover it, there are <a href=\"https:\/\/www.google.com\/search?q=vbe6.dll+midi\">a number of posts online<\/a> that discuss it, for example this German post <a href=\"https:\/\/www.pcwelt-forum.de\/threads\/midi-sound-aus-vbe6-dll.82551\/\">says<\/a> that:<\/p>\n<p style=\"padding-left: 30px;\">In the PC Welt (German magazine PC World) 10\/02, it is reported on page 252 that there is a musical Easter egg in the Office 97 or 2000 file vbe6.dll.<\/p>\n<p>but I was curious what code I can find that is related to this resource &#8211; pretty sure that programmers didn&#8217;t leave it there as a result of an accident. After checking the usual suspects (vbe6.dll\/vbe7.dll) and not being able to find any quick reference to the resource ID 5432, I assumed that it could be some legacy stuff and no longer present in the code. I then started looking at the older versions of the vbeX.dll .<\/p>\n<p>That was a good idea and I soon discovered the sequence of code that actually loads and plays the MIDI file:<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-3937 size-full\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code.png\" alt=\"vbe_code\" width=\"527\" height=\"419\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code.png 527w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code-300x239.png 300w\" sizes=\"(max-width: 527px) 100vw, 527px\" \/><\/a>The <em>playMidi<\/em> function uses <em>mciSendCommandA<\/em> API to play the extracted MIDI file.<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-3938 size-full\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code2.png\" alt=\"vbe_code2\" width=\"583\" height=\"425\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code2.png 583w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code2-300x219.png 300w\" sizes=\"(max-width: 583px) 100vw, 583px\" \/><\/a>The file created by the code is saved inside %TEMP%\\VB16B.tmp (GetTempFileNameA used to create a temp file path receives the &#8216;VB&#8217; prefix).<\/p>\n<p>I also noticed that the code playing the MIDI creates a window (class &#8216;OfVbEg&#8217;, which I guess stands for Office Visual Basic Egg):<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-3941\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code3-300x289.png\" alt=\"vbe_code3\" width=\"500\" height=\"481\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code3-300x289.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_code3.png 718w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<p>So yeah&#8230; it has the Easter egg written all over it.<\/p>\n<p>I forced the routine to execute and surely enough, it launched the <a href=\"https:\/\/www.youtube.com\/watch?v=z3xO964UIpM\">VB credits<\/a> &#8211; a known Easter Egg that can be watched after adding a menu item &#8216;Show VB Credits&#8217; to Visual Basic IDE. You can follow the steps presented in the video in Office 97 VBA IDE as well and you will see the very same demo:<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3939\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg1-225x300.png\" alt=\"vbe_easteregg1\" width=\"225\" height=\"300\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg1-225x300.png 225w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg1.png 300w\" sizes=\"(max-width: 225px) 100vw, 225px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3940\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg2-225x300.png\" alt=\"vbe_easteregg2\" width=\"225\" height=\"300\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg2-225x300.png 225w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2016\/11\/vbe_easteregg2.png 300w\" sizes=\"(max-width: 225px) 100vw, 225px\" \/><\/a>I guess it just confirms how close VBA and VBE really are&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With this post I start a new series that will talk about ancient code scrolls that are nothing, but a trivia related to some old software. Basically, a stuff of the past, re-visited without any other purpose, but the amusement&#8230; &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2016\/11\/23\/the-archaeologologogology-1-vbd6-dll-and-vbe7-dll-midi-file\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[53,44],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/3934"}],"collection":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/comments?post=3934"}],"version-history":[{"count":2,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/3934\/revisions"}],"predecessor-version":[{"id":3943,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/3934\/revisions\/3943"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=3934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=3934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=3934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}