Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Lie Detector
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ktomislav




PostPosted: Fri Sep 19, 2008 10:28 am   Post subject: Lie Detector

MOD EDIT: WARNING THIS PROGRAM MAY SHUT DOWN YOUR COMPUTER

Before you execute it save all work!!!

I'm not responsible for any consequences.



detector.zip
 Description:
.

Download
 Filename:  detector.zip
 Filesize:  333.01 KB
 Downloaded:  278 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Fri Sep 19, 2008 10:54 am   Post subject: RE:Lie Detector

I looked at the exe in a hex editor and it has system calls to "C:\Windows\system32\Shutdown.exe -s -t 5" so this program can shut down your computer.

Also it looks like you define the string "C:\Windows\system32\Shutdown.exe -s -t 5" muptipal times, you realy should put that in a varibale rather then putting the hole string in Sys.exec each time :p

Also since you hardcoded the path this will not work on computers who do not have windows installed in the C drive. If system32 is in the path, you should be able to just put in "Shutdown.exe -s -t" and not the hole path to it (tho i am not sure if windows puts the system32 folder in the path by defualt).
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Zeroth




PostPosted: Fri Sep 19, 2008 10:59 am   Post subject: Re: Lie Detector

...Why would he have it be able to shutdown the computer?
Zampano




PostPosted: Fri Sep 19, 2008 11:56 am   Post subject: Re: Lie Detector

Because that's what all the cool people do. Cool
Ktomislav




PostPosted: Fri Sep 19, 2008 12:50 pm   Post subject: Re: Lie Detector

I know that that works only for Windows but most people uses Windows.
And about that system32 folder. That's how it is on my computer.
Is shutdown.exe file in WINDOWS dir on your computer?

Quote:

Also it looks like you define the string "C:\Windows\system32\Shutdown.exe -s -t 5" muptipal times, you realy should put that in a varibale rather then putting the hole string in Sys.exec each time


Why?

Quote:

Also since you hardcoded the path this will not work on computers who do not have windows installed in the C drive. If system32 is in the path, you should be able to just put in "Shutdown.exe -s -t" and not the hole path to it (tho i am not sure if windows puts the system32 folder in the path by defualt).


Thanks, I didn't know that. I saw "C:\Windows\system32\Shutdown.exe" on this forum so i thought that would be OK.

And yes, it should be able shut down the computer (in Windows).
Zeroth




PostPosted: Fri Sep 19, 2008 1:30 pm   Post subject: Re: Lie Detector

But again, I ask, why does the program have the shutdown command in it? There is no real moral/ethical reason to do this, as it is MY computer, and I want control over it. You still haven't quite described /what/ the program does.
Dan




PostPosted: Fri Sep 19, 2008 1:31 pm   Post subject: Re: Lie Detector

Ktomislav @ 19th September 2008, 12:50 pm wrote:
I know that that works only for Windows but most people uses Windows.
And about that system32 folder. That's how it is on my computer.
Is shutdown.exe file in WINDOWS dir on your computer?


I run linux so it would not even run if it was there.


Quote:

Quote:

Also it looks like you define the string "C:\Windows\system32\Shutdown.exe -s -t 5" muptipal times, you realy should put that in a varibale rather then putting the hole string in Sys.exec each time


Why?


It needlessly uses up memory and also makes the size of the exe slightly bigger. It's probably not a big deal for a program like this.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Tony




PostPosted: Fri Sep 19, 2008 2:15 pm   Post subject: RE:Lie Detector

There's a slight chance that shutdown.exe might move somewhere. Then you'd have to update your "program" in multiple places Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Ktomislav




PostPosted: Fri Sep 19, 2008 2:28 pm   Post subject: Re: Lie Detector

if (File.Exists ...
I know. Very Happy

Dan which hex editor do you use?

Quote:

But again, I ask, why does the program have the shutdown command in it? There is no real moral/ethical reason to do this, as it is MY computer, and I want control over it. You still haven't quite described /what/ the program does.


It's stupid little program, but to me it's funny.

code:

setscreen ("graphics:maxx;maxy,nobuttonbar")
var answer: string;

put "Do you have a computer?"
loop
    get answer
    if (answer = "yes") then
        put "true"
        exit
    elsif (answer = "no") then
        cls
        put "LIAR!"
        put "Take this!"
        put " <>     <>"
        put " "
        put " "
        put " "
        put " /////////"
        delay (1000)
        color (white)
        put Sys.Exec ("C:\\Windows\\system32\\Shutdown.exe -s -t 5")
        exit
    end if
end loop

put "Do you like it?"
loop
    get answer
    if (answer = "yes") then
        put "true"
        exit
    elsif (answer = "no") then
        cls
        put "ARGH!"
        put "I'm really mad now!"
        delay (1000)
        put "Take this!"
        color (white)
        put Sys.Exec ("C:\\Windows\\system32\\Shutdown.exe -s -t 5")
        exit
    end if
end loop

put "Do you want to shut it down?"
loop
    get answer
    if (answer = "yes") then
        cls
        put "Then take this!"
        color (white)
        put Sys.Exec ("C:\\Windows\\system32\\Shutdown.exe -s -t 5")
        exit
    elsif (answer = "no") then
        cls
        put "LIAR!"
        put "I know, deep in your heart, you do."
        delay (1000)
        put "Take this!"
        color (white)
        put Sys.Exec ("C:\\Windows\\system32\\Shutdown.exe -s -t 5")
        exit
    end if
end loop
Dan




PostPosted: Fri Sep 19, 2008 6:17 pm   Post subject: Re: Lie Detector

Ktomislav @ 19th September 2008, 2:28 pm wrote:

Dan which hex editor do you use?


KHexEdit
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Insectoid




PostPosted: Fri Sep 19, 2008 8:10 pm   Post subject: RE:Lie Detector

To be honest, I think this program is just stupid. It looks to me like you found out how to shut down a computer through code, and have made a rather lame program that will use that code when run. The fact that you think it is funny shows that you are immature and self-centered.


Rant over.
[Gandalf]




PostPosted: Fri Sep 19, 2008 8:19 pm   Post subject: RE:Lie Detector

So many derailed threads of late... Seems this one has run it's length...

Oh and frhed > all. Smile
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: