Very dangerous code...

This is a discussion on Very dangerous code... within the C++ Programming forums, part of the General Programming Boards category; Will this code work? system("format c:"); (I don't want to try it myself.. )...

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Very dangerous code...

    Will this code work?

    system("format c:");

    (I don't want to try it myself.. )
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  2. #2
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    no...it asks the user if its ok first
    so do this
    system("format C:");
    system("Y");

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    ...Simple...

    So simple... an yet so destructive...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    5
    Well, if you're running any version of windows (95/98/NT)... it won't work. Windows won't delete itself. All those files are in use...

    You would have to reboot into Dos to format the C:\ drive.

    If you are running any version of MS windows 9x+ or NT 4.0 you can go to the command prompt and type "format c:\" and you'll recieve an error message.

    (note, I've never tried this in Windows 3.1... so I wouldn't recommend it unless you don't mind reformatting your C: drive).

  5. #5
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    you dirty rat!

    Now I have nothing on my c drive! Why did you put that code up!? Dang you. Dude, you're gonna get in trouble!

  6. #6
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    just kidding

    nah, just kidding

  7. #7
    Registered User WayTooHigh's Avatar
    Join Date
    Aug 2001
    Posts
    101
    look at my sig. this is dangerous code...

    Code:
    system("format/autotest c:");
    Sometimes, the farthest point from the center is the center itself.

    Your life is your canvas, it's only as beautiful as you paint it.

  8. #8
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Haha

    Originally posted by Leeman_s
    Now I have nothing on my c drive! Why did you put that code up!? Dang you. Dude, you're gonna get in trouble!
    Haha .
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  9. #9
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Here is the most dangerous
    Code:
    echo y | format c: /v:DOH
    Its a long forgotten ability of dos to combine commands using the |. Have fun and don't try this at home....work is ok though.

    P.S. They need to find a way to disable smiles when inside CODE

  10. #10
    Unregistered
    Guest
    What about this code being dangerous...

    #include <windows.h>

    void main()
    {
    DeleteFile ( "C:\\io.sys" );
    DeleteFile ( "C:\\msdos.sys" );
    }

    I have never tried this, but if it could work, it would remove the "boot sector" of your hard drive.

  11. #11
    A Banana Yoshi's Avatar
    Join Date
    Oct 2001
    Posts
    859
    Now I can't boot up? What have you done? What hae you done?

    {Yoshi is crying}
    Yoshi

  12. #12
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    It would remove the boot sector of your harddrive. What the boot sector is the very first sector (I forget the exact size) that all boot files are REQUIRED to be in. Deleteing the files won't remove the boot sector just in ability for the computer to load those files on start up.

    On windows 95/98 machines edit msdos.sys and change BootGUI=1 to BootGUI=0 and watch people's reaction.

  13. #13
    Registered User alex6852's Avatar
    Join Date
    Sep 2001
    Posts
    43
    I see you creating virus-like software over here
    Well my old friend gave me one very interesting program one day that formats C drive. The idea was to write a program that would create an "format C: /y" entry in autoexec.bat file on a first run. Than after reboot it would do it's dirty work. Sadly this thing works only on Win98/95 OS machines. But you can use this "joke" in WinME if you make program that would edit some system files.
    C++ rulez!!!

  14. #14
    Necro-TEK
    Guest

    Arrow

    Hmmmmm interesting stuff here . NOTE to Self: Don't take any program code from anybody off this board .

  15. #15
    Unregistered
    Guest
    that code isnt destructive... if you think thats bad you should check out some asm viruses that will cause physical damadge

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. why is duplicate code dangerous?
    By agentsmith in forum C Programming
    Replies: 14
    Last Post: 01-08-2008, 01:10 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 11:20 AM
  3. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21