Created
June 25, 2013 02:21
-
-
Save Earlz/5855420 to your computer and use it in GitHub Desktop.
The source code to the "cd_open" program that plagued computers at my library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <windows.h> | |
#include <winioctl.h> | |
DWORD WINAPI bah(unsigned int t){ | |
//MessageBox(NULL,"hi3","bah",0); | |
for(;;){ | |
MessageBox(NULL,"So you having fun trying to keep this cd closed?","bah!",MB_YESNO); | |
MessageBox(NULL,"I'm not even going to look at your result\n because I don't care!","bah!",0); | |
MessageBox(NULL,"If you were smart you'd just end this process but\n hey that's what I'm here for!","bah!",0); | |
MessageBox(NULL,"You get that cd drive closed yet?","bah!",0); | |
MessageBox(NULL,"I asked you a yes or no question!\n why would you answer me with \"Ok\"!","bah!",0); | |
MessageBox(NULL,"So.....","bah!",0); | |
MessageBox(NULL,"Watcha doooin?","bah!",0); | |
MessageBox(NULL,"Why do you only say Ok to me!?","bah!",0); | |
MessageBox(NULL,"I bet your a bot\nwho else would talk to themselve?","bah!",0); | |
MessageBox(NULL,"Well anyway g2g..\nhave fun trying to close the cd drive","bah!",0); | |
sleep(10000); | |
MessageBox(NULL,"HA! I fooled you\ndon't worry I'm still here","bah!",0); | |
MessageBox(NULL,"yup I got you good! like uber g00d","bah!",0); | |
MessageBox(NULL,"Well why are you doing this to me?","bah!",0); | |
MessageBox(NULL,"yup I bet you wonder when/if I'm going to end this","bah!",0); | |
MessageBox(NULL,"hmmm I'm getting bored\n","bah!",0); | |
MessageBox(NULL,"what to do..what to do...\nOh! I know let's talk to you some more!","bah!",0); | |
MessageBox(NULL,"Press OK if your gay","bah!",0); | |
MessageBox(NULL,"Ha!! you could've just pushed the big X so you are gay!! lol","bah!",0); | |
MessageBox(NULL,"you know what!\nI think I tell you a story!","bah!",0); | |
MessageBox(NULL,"Ok, Once upon a pie, I was eating some pie\n","bah!",0); | |
MessageBox(NULL,"When suddenly!\nI realized that I was at McDonalds\n","bah!",0); | |
MessageBox(NULL,"And there was moose there looking through the window\nso I left","bah!",0); | |
MessageBox(NULL,"then I walked to my lair..err I mean mysterious cave that no one knows about","bah!",0); | |
MessageBox(NULL,"And upon making it there, I went to sleep\n","bah!",0); | |
MessageBox(NULL,"...","bah!",0); | |
MessageBox(NULL,"...","bah!",0); | |
MessageBox(NULL,"...","bah!",0); | |
MessageBox(NULL,"...","bah!",0); | |
MessageBox(NULL,"...","bah!",0); | |
MessageBox(NULL,"Then I was awaken'd, or at least I think\nAfter whatching the matrix I don't know anything","bah!",0); | |
MessageBox(NULL,"And I discovered it was storming outside..","bah!",0); | |
MessageBox(NULL,"then my Cd drive came open!","bah!",0); | |
MessageBox(NULL,"And then a message box came up","bah!",0); | |
MessageBox(NULL,"and you know what it said?","bah!",0); | |
#ifdef ENDING | |
MessageBox(NULL,"I'm not mean enough to put it in an infinite loop\n\nlucky you!","bah!",0); | |
exit(0); | |
#endif | |
} | |
exit(0); | |
} | |
int main(){ | |
HANDLE bleh; | |
bleh=CreateThread(0,512,&bah,0,0,0); | |
// MessageBox(NULL,"hi","bah",0); | |
HANDLE hDevice; // handle to the drive to be examined | |
BOOL bResult; // results flag | |
DWORD junk; // discard results | |
unsigned int *pdg=malloc(256); | |
hDevice = CreateFile("\\\\.\\D:", // drive to open | |
GENERIC_READ, // no access to the drive | |
FILE_SHARE_READ, // share mode, | |
NULL, // default security attributes | |
OPEN_EXISTING, // disposition | |
0, // file attributes | |
NULL); // do not copy file attributes | |
if (hDevice == INVALID_HANDLE_VALUE) // cannot open the drive | |
{ | |
return (FALSE); | |
} | |
for(;;){ | |
bResult = DeviceIoControl(hDevice, // device to be queried | |
IOCTL_STORAGE_EJECT_MEDIA, // operation to perform | |
NULL, 0, // no input buffer | |
pdg, 256, // output buffer | |
&junk, // # bytes returned | |
(LPOVERLAPPED) NULL); // synchronous I/O | |
} | |
CloseHandle(hDevice); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment