TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Paul Edwards
from: Patrick Haller
date: 1996-11-07 02:25:16
subject: reboot

Hi Paul!

[..]
 PE> Can someone please send me code that will do a reboot(). Thanks + bye. 
 PE> Paul.

These are your possibilities:

Do NOT run this code without performing a DosShutdown first !

[..]
.286p
.model medium
.stack 1
.data
.code

main proc
call far ptr reboot
main endp

_TEXT2 segment byte public 'CODE'
assume cs:_TEXT2

reboot proc
mov al,0feh
out 64h,al
reboot endp

_TEXT2 ends

end main


[..]
NAME rboot
PROTMODE
SEGMENTS
   _TEXT2 CLASS 'CODE' IOPL


[..]
/* Shutdown.c

 (c) 1992 Patrick Haller Systemtechnik

 DosShutdown locks out changes to all
 file systems and flushes system buffers */

#define INCL_DOSERRORS
#define INCL_DOSFILEMGR
#define INCO_DOSPROCESS
#define INCL_DOS
#define INCL_NOPM
#include 

void DosReboot (void)
{
    HFILE  hf;
    ULONG dummy;
    ULONG rc;

    rc = DosOpen("DOS$", &hf, &dummy, 0L, FILE_NORMAL, FILE_OPEN,
 OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE |
 OPEN_FLAGS_FAIL_ON_ERROR, NULL);
    if(!rc)
    {
       printf ("\nShutdown...");
       rc = DosShutdown(0L);
       if (rc) ErrorProc(rc);

       /* 32-Bit reboot */
       DosDevIOCtl( hf, 0xd5, 0xab, NULL, 0, NULL, NULL, 0, NULL );

       /* old 16-bit reboot
       DosDevIOCtl(NULL, NULL, 0xab, 0xd5, hf);
       */
       DosClose(hf);
    }
    else
      printf ("\nDOS.SYS not installed. Can't Reboot.");
}


     __
     |_)
cu/2 |atrick
[Team  OS/2]

--- FleetStreet 1.18+
* Origin: OS/2 Bodensee ! (2:246/2315.18)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 246/2315 2300 2340 10 240/5202 5010 2433/225 270/101 712/515 711/808
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.