Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Randomly Opening CD Tray

  A simple prank that opens the CD-ROM drive at random intervals.
InRule -> The Leading Innovator in Business Rule Engine Technology for .NET

Difficulty: Easy
Time Required: Less than 1 hour
Cost: Free
Software: Visual Basic or Visual C# Express Editions
Hardware:
Download: Download

 

The best April Fools' Day pranks are those that can be enjoyed by both the fooler and the foolee. This short article covers one of the simpler pranks in the "Why is my computer doing that?" category: the malfunctioning CD-ROM drive that opens at random intervals. This prank is best used in a cube farm where multiple instances can be easily deployed and monitored.

The Prank

The prank itself is very simple: a little program that, once launched, waits n minutes, then opens the CD-ROM drive door. It then continually opens the door at random intervals until the user closes the application. (Both n and the random interval constraint can be modified by the fooler via the application's config file.)

The most difficult part of the prank is getting the application onto the foolee's computer.

The Inspiration

I've recently begun using the Google Web Accelerator, which speeds up your Web browsing. Or so they say. The only indication that it is doing anything is a report of how much time it has saved me:

If you're reading this article, you probably have an idea how the Accelerator works. However, 99 percent of its users don't. They take its word that it's working, and this trust is a primary component of our evil deed.

"Web Speedster"

Our prank appears to be similar to the Web Accelerator. Once launched, it sits in the notification area until the user closes it. Unbeknownst to the user, the Web Speedster is the source of the randomly opening CD-ROM drive door. The initial CD-ROM door opening is delayed so the foolee doesn't make the connection with the Speedster.

The application itself is tiny — less than a dozen lines of code. The most interesting part is how the door is opened, since the .NET Framework doesn't natively provide this functionality.

The .NET Framework has almost everything most people need to create great applications, but sometimes developers need to access unmanaged functionality provided by other libraries, including Windows itself. Platform Invoke, or P/Invoke, is the gateway to these libraries. Methods in other libraries are defined with external method declarations like the following, which lets us call the mciSendString method in Windows WinMM DLL:

Visual C#

[DllImport("winmm.dll")]
static extern Int32 mciSendString(String command, StringBuilder buffer, Int32 bufferSize, IntPtr hwndCallback);

Visual Basic

Declare Function mciSendStringA Lib "winmm.dll" (command As String, _
buffer As StringBuilder, bufferSize As Int32, hwndCallback As IntPtr) As Int32

(PInvoke.NET is a great resource for finding these declarations.)

Calls to these methods are done just like calls to "normal" methods:

mciSendString("set CDAudio door open", null, 0, IntPtr.Zero);

And that is all that's required to make a function call into Windows. Easy!

Summary

While the .NET Framework is huge, it doesn't do everything. However, if Windows can do what you need, chances are very good that you can get to that functionality with P/Invoke.

The next step is to compile the program, send it out to unsuspecting foolees (ideally within earshot), and let the fun begin!

Follow the Discussion

  • Barbara KallasBarbara Kallas

    I am a victim of someone's cruel sense of humor.  Can someone describe in layman's terms how to get rid of this?      

  • Your mammaYour mamma

    Does anyone know this code in c++?

  • Shane LafortuneShane Lafortune

    well being a lazy teenager;barbara according to the full prank it says you close the application which would easily stop it from processing unless of course you have a virus which is different you have a virus eating your core system files and or corrupting your motherboard making it think its recieving the signal to open it,if it is just a prank then simply use the CTRL+ALT+DEL task managers process tab look under the processes tab for afile running on a user account(anything not system,local service,network service) that is unfamilar, if you dont know what some of htem are use the search thingy in windows and find it viaits file name then right click and open containing folder which should help you find out what is out of placew,once you do so end the process,and delete the file. =) if you would like ot thank me you can contact me at fr0g-legz@hotmail.com

  • WandaWanda

    My mother is also a victim of this.  In 2005 her cd-rom just started opening & closing on Halloween.  It stopped the next day.  However on Halloween in 2006 it started again and wouldn't stop.  I disabled it for her.  Barbara if you find out would you please let me know.  My email address is wandam868@sbcglobal.net.

    thanks

  • chrischris

    Brilliant piece of work. And to the person who created the halloween "virus" or to Wanda if you could please send me a copy for educational purposes at the_dark_spectre_lives@hotmail.com.

    Thanks

    Smiley

  • XuserXuser

    Can this be done using command line also ?

    for example:rundll32.exe winmm.dll, mciSendString  ???set_CDAudio_door_open???

  • JohnJohn

    Ha this joke was funny for 1 minute until everyone wanted to get back at everyone else.  So myself and my company have wasted a week disabling this crap.  Let's just say the netsend/CD tray people have been notified by email that the unemployment line has an opening.  People don't get that a joke can go too far.  The CD tray joke really needs to stop.

  • johnjohn

    dude are you guys flippin retarded the link to download the msi is right there on top of the page

  • CD Tray opens By Itself! - ABXZone Computer  ForumsCD Tray opens By Itself! - ABXZone Computer Forums

    PingBack from http://www.abxzone.com/forums/f24/cd-tray-opens-itself-112376.html#post1403361

  • AmandaAmanda

    Um ok so where do i type all that stuff in??

  • TanisTanis

    I have this problem on my pc now and it's driving me crazy. I can't find the file to delete it.

  •  Mici intrebari care nu merita un thread separat. - Page 156 - Computer Games Forum Mici intrebari care nu merita un thread separat. - Page 156 - Computer Games Forum

    PingBack from http://forum.computergames.ro/2-hardware/274601-mici-intrebari-care-nu-merita-un-thread-separat/page-156.html#post39196856

Remove this comment

Remove this thread

close

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.