| | |
Restarting the Computer
![]() |
•
•
Join Date: Mar 2006
Posts: 5
Reputation:
Solved Threads: 0
I'm new here, as you can most likely tell by my low post count... but my question is simple. What procedure/commands/whatever would I need to make the computer restart or shutdown? I have google'd for a looooong time to find this, but found absolutely nothing. Does anyone have some help for me? Its confusing
Thanks for all help!
EDIT:
Using borland pascal 7... if that makes any difference.
Thanks for all help!
EDIT:
Using borland pascal 7... if that makes any difference.
You'll need to use the windows API with Pascal...I found this site: http://www.irietools.com/iriepascal/progref305.html, but it's about Irie pascal and not turbo pascal.... I'm not sure the difference. Basically, you need to figure out how to call functions of the windows library's (the windows dll's) with pascal. Then you can use the exitwindows or exitwindowsex API call.
•
•
Join Date: Mar 2006
Posts: 3
Reputation:
Solved Threads: 0
As mentioned in prev post you need to call the InitiateSystemShutdown funtion.
Its a windows function, its declared in the Windows unit.
Before you can call it succesfully though you need to get the right priviliges.
Look at:
http://msdn.microsoft.com/library/de...emshutdown.asp
http://msdn.microsoft.com/library/de...dialog_box.asp
HTH
Its a windows function, its declared in the Windows unit.
Before you can call it succesfully though you need to get the right priviliges.
Look at:
http://msdn.microsoft.com/library/de...emshutdown.asp
http://msdn.microsoft.com/library/de...dialog_box.asp
HTH
•
•
Join Date: Mar 2006
Posts: 5
Reputation:
Solved Threads: 0
The below program is meant to be used as a login script that you must use, it is for another program I made... it all works fine, but I did edit this program to remove passwords and etc... so anything that cannot be done logged off, won't work.
Thanks for any and all help, including the help I was given earlier.
One error occurs with this, and that is if I use both Uses dos; and uses Reboot; then it won't compile- it tells me that its supposed to have a begin between the uses dos; and the uses Reboot;... Any reason why?
other than that, this program compiles fine, and seems to work fine, aswell. However, if I enter the wrong login details, it simply freezes. I have the required files for my shutdown procedure, and I believe it works, but... It just doesn't want to work for me.. Like I said above, it simply freezes.
Thanks for any and all help, including the help I was given earlier.
Pascal and Delphi Syntax (Toggle Plain Text)
Program StartUpAuth; uses dos; uses Reboot; const pwrd = 'd347h3464'; usrname = 'DarknessX'; var cmd: String; s: String; username: String; password: String; Procedure Shut_Down_Windows; begin writeln('DarknessX Authentication Server'); writeln('Please type your username.'); readln(username); if usrname = username then begin writeln('Please type your password now.'); readln(password); if pwrd = password then writeln(' Verifying...'); end; begin if username <> 'DarknessX' then writeln('Sorry. No cheating the system...'); RebootMach; if password <> 'd347h3464' then writeln('Sorry. No cheating the system...'); RebootMach; end; writeln('Welcome to the WinXP Command Line Interface.'); writeln('Please type "help" for a list of commands.'); writeln('If you wish to skip this, please type "exit"'); writeln('CMD..'); read(cmd); write(cmd); if cmd <> 'exit' then writeln('Sorry, this command line interface has no extra commands available'); if cmd = 'help' then writeln('The WinXP CLI, made by DarknessX, currently has no features.'); writeln('The only feature it has is Authentication.'); if cmd = 'exit' then end; end.
other than that, this program compiles fine, and seems to work fine, aswell. However, if I enter the wrong login details, it simply freezes. I have the required files for my shutdown procedure, and I believe it works, but... It just doesn't want to work for me.. Like I said above, it simply freezes.
Hi,
This one works on Delphi :
Loren Soth
This one works on Delphi :
Pascal and Delphi Syntax (Toggle Plain Text)
program Project2; {$APPTYPE CONSOLE} uses SysUtils; //Use upper case constants as a convention const PWRD = 'd347h3464'; USRNAME = 'DarknessX'; VER = '1.0'; var cmd: String; username: String; password: String; begin writeln('DarknessX Authentication Server'); write('username : '); readln(username); write('password : '); readln(password); writeln(' Verifying...'); if username <> USRNAME then begin While true do write('Sorry. No cheating the system...'); //RebootMach; end; if password <> PWRD then begin While true do write('Sorry. No cheating the system...'); //RebootMach; end; writeln('Welcome to the WinXP Command Line Interface.'); writeln('Please type "help" for a list of commands.'); writeln('If you wish to skip this, please type "exit"'); writeln('CMD..'); While true do Begin Write('>'); readln(cmd); if cmd = 'help' then begin writeln('The WinXP CLI V'+VER+' - by DarknessX.'); writeln('Supported commands :'); writeln(' help'); writeln(' ver'); writeln(' exit'); end else if cmd = 'ver' then Begin writeln('WinXP CLI V'+VER+' - by DarknessX'); end else if cmd = 'exit' then Begin exit; end else writeln('Unrecognized command. Try help.'); end; end.
Loren Soth
![]() |
Similar Threads
- No Redirection to my Apache Server (Linux Servers and Apache)
- KERNAL_STACK_INPAGE_ERROR and PXE-E61: Media test failure, check cable (Windows NT / 2000 / XP)
- Belkin F5D7000 Wireless Network Card Help!! (Networking Hardware Configuration)
- Windows..Keeps Restarting (Windows NT / 2000 / XP)
- HELP! Drive A does not refresh when new floppy disk is inserted! (Storage)
- Cannot format hard drive due to virus (Windows NT / 2000 / XP)
- weird IE6 long program open (Web Browsers)
- Computer shutsdown when encoding (Troubleshooting Dead Machines)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: FindFirst / FindNext problem
- Next Thread: reverse the strings
| Thread Tools | Search this Thread |







Oops. But is there any other reason why it might just freeze up instead of restarting me?