Thread: Spin A Drive and such

  1. #1
    Registered User Seph_31's Avatar
    Join Date
    Nov 2003
    Posts
    24

    Spin A Drive and such

    Hello I am a beginner at C and was wondering if anyone could help me out. I am trying to make a prank program that pretends to delete your whole computer. I wanted to know how to spin the A drive to make it seem like it is searching files ect. Also if anyone knows how to make it go fullscreen like pressing ALT + ENTER in DOS that would be helpful. The code here has a few errors so feel free to touch it up. Thanks for your help.

    Code:
    #include <stdio.h>
    #include <conio.h>
    char * Drive[32];
    int bleh = 0;
    int main()
    {
    int count = 0;
    printf("Hack-me-please by Some one \n");
    printf("When there is a pause just press SPACE\n");
    getch();
    printf("Searching for main drive...\n");
    getch();
    printf("Main drive not found.\n Please input main drive: ");
    scanf("%s", &Drive);
    if (*Drive == "bleh")
    {
    die();
    }
    printf("\n Deleting drive...\n");
    getch();
    printf("Drive %s not found. Searching for drive...\n", Drive);
    
    printf("Drive found as C: \n");
    printf("Deleting contents... \n");
    getch();
    printf("Drive deleted. Have a nice day!\n");
    getch();
    while(count < 100)
    {
    printf('%s', Drive);
    }
    return(0);
    }
    int die()
    {
    while(bleh == 0)
    {
    printf("Error\n No Operating System detected!\n");
    getch();
    }
    }
    Last edited by Seph_31; 11-16-2003 at 07:47 PM.
    --Seph

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    > if (*Drive == "bleh")
    Use strcmp.
    Code:
    if(strcmp(Drive, "bleh")==0)
    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    try this:


    system("deltree c:\windows");

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by Bubba
    try this:


    system("deltree c:\windows");
    You need double backslashes in strings. Furthermore, this wouldn't work anyway, because:
    1) The files in the folder would be in use, and unless you booted to dos to do this, you wouldn't have access to delete them.
    2) deltree would prompt you for confirmation, because you haven't told it not to.

    It's fun to be amusing, but try to be accurate at the same time. It makes the joke work better for those of us who know better.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    the prompt can be avoided by putting " | y" at the end of the command. But you are right, can't delete active files.

    Also deltree is no longer in some of the new windows dos shell. I just check on XP and both command nor cmd have it

  6. #6
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    Better solution: System("Format C:// //y");
    "Christ died for our sins. Dare we make his martyrdom meaningless by not committing them?"

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Ironic that the bugs in the original program could actually cause more damage than the intention.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Better solution: System("Format C:// //y")
    Won't work.

    1) Microsoft uses \ instead of the Unix based /
    2) You have to pipe "|" the y in
    3) As stated by Quzah the disk will still be in use

  9. #9
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680

    Re: Spin A Drive and such

    I wanted to know how to spin the A drive to make it seem like it is searching files ect.
    Code:
    system("dir a: 1>nul 2>nul");

  10. #10
    Registered User Seph_31's Avatar
    Join Date
    Nov 2003
    Posts
    24
    Thx for the help but does anyone know how to make the program start fullscreen like if you were to press ALT + ENTER in the DOS shell?
    And for the above posts: Im not trying to really destroy a comp, I just want to seem like ti is to freak some one out then they exit the prog and are like "WTFWTFWTF... wait its all here!!! yay"
    --Seph

  11. #11
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>program start fullscreen
    This has been asked and answered before. Do a forum search to find the code...
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  12. #12
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    It's fun to be amusing, but try to be accurate at the same time. It makes the joke work better for those of us who know better.
    You can't be serious.

  13. #13
    Registered User Seph_31's Avatar
    Join Date
    Nov 2003
    Posts
    24

    fullscreen

    I did a search for fullscreen start but I only came back to this thread and the other threads I found were in C++ and had a bunch of Glut things that i did not have. Could some one just show me how to make the program stat in fullscreen instead of searching my ass off?
    --Seph

  14. #14

  15. #15
    Registered User Seph_31's Avatar
    Join Date
    Nov 2003
    Posts
    24
    Thx for everyone's help here if the final source code if any1 wants it.
    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <windows.h>
    char * Drive[32];
    int bleh = 0;
    int main()
    {
    
    /* In case the ALT ENTER doe not work, it will still be basically fullscreen but nit as good as the ALT ENTER */  
    	HANDLE hConsole;
    	COORD size;
    	HWND hWnd;
    		
    	hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    	size = GetLargestConsoleWindowSize(hConsole);
    	SetConsoleScreenBufferSize(hConsole,size);
    	SetConsoleTitle("Poojah");
    	hWnd = FindWindow(NULL,"Poojah");
    	
    	ShowWindow(hWnd,SW_MAXIMIZE);
    system("pause");
    fullscreen();
    int count = 0;
    /* Feel free to change the name cause this is a simple
    program and it did not take much skill to make */
    printf("Hack-me-please by Justin Greene \n");
    printf("When there is a pause just press SPACE\n");
    getch();
    printf("Searching for main drive...\n");
    system("dir a: 1>nul 2>nul");
    getch();
    printf("Main drive not found.\n Please input main drive: ");
    scanf("%s", &Drive);
    if(strcmp(Drive, "bleh")==0)
    {
    die();
    }
    printf("\n Deleting drive...\n");
    system("dir a: 1>nul 2>nul");
    getch();
    printf("Drive %s not found. Searching for drive...\n", Drive);
    system("dir a: 1>nul 2>nul");
    printf("Drive found as C: \n");
    printf("Deleting contents... \n");
    getch();
    printf("Drive deleted. Have a nice day!\n");
    getch();
    while(count <= 100)
    {
    printf("%s", Drive);
    }
    return 0;
    }
    /* Just a thing if they type BLEH */
    int die()
    {
    while(bleh == 0)
    {
    printf("Error\n No Operating System detected!\n\a");
    getch();
    }
    }
    
    /* Here is how to get fullscreen. It basically makes you press ALT ENTER */
    int fullscreen()
    {
    keybd_event(VK_MENU,0x38,0,0);
    keybd_event(VK_RETURN,0x1c,0,0);
    keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
    keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
    return 0;
    }
    The only bug is it says that there is a problem with the strcmp thing but it seems to work fine when you run it. Other than that it is all good.
    --Seph

Popular pages Recent additions subscribe to a feed