home *** CD-ROM | disk | FTP | other *** search
- @echo off
- REM ***************************************************************
- REM *** ReBoot.cmd - Reboot computer. To provide protection ***
- REM *** from accidentaly rebooting, you must enter ***
- REM *** PLEASE as the first parameter. ***
- REM ***************************************************************
-
-
- REM **************************************************************
- REM *** Check that "PLEASE" is the first parameter. CEnvi ***
- REM *** return errorlevel if it is not please. ***
- REM **************************************************************
- CEnvi return( strcmpi("%1","Please") ? 1 : 0 )
- if errorlevel 1 GOTO PLEASE
-
- REM ****************************************
- REM *** CALL DEVIOCTL FUNCTION TO REBOOT ***
- REM ****************************************
- CEnvi %0.cmd
- GOTO CENVI_EXIT
-
- #define ORD_DOS32OPEN 273
- #define FILE_NORMAL 0x0000
- #define FILE_OPEN 0x0001
- #define OPEN_SHARE_DENYNONE 0x0040
- #define OPEN_ACCESS_READWRITE 0x0002
- if ( !DynamicLink("doscalls",ORD_DOS32OPEN,BIT32,CDECL,
- "\\DEV\\DOS$",FileHandle,ActionTaken,0,
- FILE_NORMAL,FILE_OPEN,
- OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,0) ) {
-
- #define ORD_DOS32DEVIOCTL 284
- #define CATEGORY_DOSSYS 0xD5
- #define FUNCTION_REBOOT 0xAB
- DynamicLink("doscalls",ORD_DOS32DEVIOCTL,BIT32,CDECL,
- FileHandle,CATEGORY_DOSSYS,FUNCTION_REBOOT,
- NULL,0,NULL,NULL,0,NULL);
-
- #define ORD_DOS32CLOSE 257
- DynamicLink("doscalls",ORD_DOS32CLOSE,BIT32,CDECL,FileHandle);
- }
-
- :CENVI_EXIT
-
- :PLEASE
- ECHO ReBoot.cmd will reboot your computer. To execute ReBoot.cmd you
- ECHO must enter: REBOOT PLEASE