home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / PROG / C_PLUS / CNVLIB2 / REBOOT.CMD < prev    next >
Encoding:
Text File  |  1993-10-02  |  1.8 KB  |  48 lines

  1. @echo off
  2. REM ***************************************************************
  3. REM *** ReBoot.cmd - Reboot computer.  To provide protection    ***
  4. REM ***              from accidentaly rebooting, you must enter ***
  5. REM ***              PLEASE as the first parameter.             ***
  6. REM ***************************************************************
  7.  
  8.  
  9. REM **************************************************************
  10. REM *** Check that "PLEASE" is the first parameter.  CEnvi     ***
  11. REM *** return errorlevel if it is not please.                 ***
  12. REM **************************************************************
  13. CEnvi return( strcmpi("%1","Please") ? 1 : 0 )
  14. if errorlevel 1 GOTO PLEASE
  15.  
  16. REM ****************************************
  17. REM *** CALL DEVIOCTL FUNCTION TO REBOOT ***
  18. REM ****************************************
  19. CEnvi %0.cmd
  20. GOTO CENVI_EXIT
  21.  
  22.    #define ORD_DOS32OPEN   273
  23.    #define FILE_NORMAL     0x0000
  24.    #define FILE_OPEN       0x0001
  25.    #define OPEN_SHARE_DENYNONE      0x0040
  26.    #define OPEN_ACCESS_READWRITE    0x0002
  27.    if ( !DynamicLink("doscalls",ORD_DOS32OPEN,BIT32,CDECL,
  28.                      "\\DEV\\DOS$",FileHandle,ActionTaken,0,
  29.                      FILE_NORMAL,FILE_OPEN,
  30.                      OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,0) ) {
  31.  
  32.       #define ORD_DOS32DEVIOCTL     284
  33.       #define CATEGORY_DOSSYS       0xD5
  34.       #define FUNCTION_REBOOT       0xAB
  35.       DynamicLink("doscalls",ORD_DOS32DEVIOCTL,BIT32,CDECL,
  36.                   FileHandle,CATEGORY_DOSSYS,FUNCTION_REBOOT,
  37.                   NULL,0,NULL,NULL,0,NULL);
  38.  
  39.       #define ORD_DOS32CLOSE  257
  40.       DynamicLink("doscalls",ORD_DOS32CLOSE,BIT32,CDECL,FileHandle);
  41.    }
  42.  
  43. :CENVI_EXIT
  44.  
  45. :PLEASE
  46. ECHO ReBoot.cmd will reboot your computer.  To execute ReBoot.cmd you
  47. ECHO must enter: REBOOT PLEASE
  48.