[comp.sys.ibm.pc] How could I force a CTRL-ALT-DEL from a program?

rha@bunker.UUCP (Robert H. Averack) (01/21/89)

     I am investigating how one can remotely cause a PC to reboot.  Getting
the stimulus to the PC is clearly not the problem.  The problem is getting
the software which recognizes the stimulus to issue a CTRL-ALT-DEL to MSDOS,
resulting in the reset and reboot.

     Do any of you out there have any ideas?  Thanks for your help.

                    {oliveb,yale,decvax,philabs}!bunker!rha
                                  Bob Averack                           
                        Bunker Ramo, an Olivetti Company                      
               Two Enterprise Drive - Shelton, Connecticut 06484             

jborza%burgundy@Sun.COM (Jim_Borza) (01/21/89)

In article <4567@bunker.UUCP>, rha@bunker.UUCP (Robert H. Averack) writes:
> 
>      I am investigating how one can remotely cause a PC to reboot.  Getting
> the stimulus to the PC is clearly not the problem.  The problem is getting
> the software which recognizes the stimulus to issue a CTRL-ALT-DEL to MSDOS,
> resulting in the reset and reboot.
> 

You can reboot a PC with the following code.
Assemble with MASM and convert to .COM via EXE2BIN.
(It's a bit of overkill - but clean and reliable).

----------------- cut here ---------------------------
PAGE  ,132
TITLE REBOOT.COM Program reset the computer.
COMMENT {
	This program will make a LONG call to location 
	FFFF0(hex) which is the reset location for the 8088
	CPU chip.  Prior to doing that, the program also
	forces the word at location 00472(hex) to 1234(hex)
	which simulates a Ctrl-Alt-Del type of reboot and
	bypasses memory diagnostics in POST.
{
;********************************************************************
ROM_BIOS_DATA   segment at 40h          ;location for RESET flag
                org     72h             ;as setup by BIOS.
RESET_FLAG      label  word             ;word is 1234h during soft
ROM_BIOS_DATA   ends			;reboot.
;********************************************************************
REBOOT	segment
	assume	cs:REBOOT, ds:REBOOT, es:ROM_BIOS_DATA
	org	100h

START:	mov     ax, 40h         ;set up segment reg es:
        mov     es, ax          ;for ROM BIOS DATA
	mov     ax, 01234h      ;write 1234h to location 40:72
        mov     es:RESET_FLAG,ax
	xor	ax,ax		;zero registers
	xor	bx,bx
	xor	cx,cx
	xor	dx,dx
	xor	si,si
	xor	di,di
	push	ax
	push	ax
	push	ax
	pop	ds
	pop	es
	popf			;clear flags
	call	cs:BOOTER		;long call to reset location.
	mov	ah,0		;DOS exit (just for form - pro-
	int	21h		;gram should never get here!).
;--------------------------------------------------------------------
BOOTER	dd	0FFFF0000h	;Reset location is FFFF0h.
;--------------------------------------------------------------------
REBOOT	ends
;********************************************************************
	end	START
------------------------------ cut here -----------------------

Jim Borza - Sun Microsystems

figlik@ihlpl.ATT.COM (Jim Figlik) (01/23/89)

In article <4567@bunker.UUCP> rha@bunker.UUCP (Robert H. Averack) writes:
>
>     I am investigating how one can remotely cause a PC to reboot.  Getting
>the stimulus to the PC is clearly not the problem.  The problem is getting
>the software which recognizes the stimulus to issue a CTRL-ALT-DEL to MSDOS,
>resulting in the reset and reboot.
>
>     Do any of you out there have any ideas?  Thanks for your help.
>
>                    {oliveb,yale,decvax,philabs}!bunker!rha
>                                  Bob Averack                           
>                        Bunker Ramo, an Olivetti Company                      
>               Two Enterprise Drive - Shelton, Connecticut 06484             


Below is an assembler program that compiles to about 6 bytes, if
I remember correctly, that will cause a boot on most machines. Have fun...

Jim




------------- cut here --------------
       name	boot
       page	80,132
       title	'Program to reboot a system'

cseg   segment	para public 'CODE'
       assume	cs:cseg,ds:cseg,es:cseg,ss:cseg

       org	100h                 ; COM file format
entry: mp	boot

boot   proc	near

       int	19h

boot   endp								;end of the "procedure"
cseg   ends
       end	entry

------------- cut here --------------

gbs@stratus.UUCP (George B. Smith) (01/24/89)

In article <86397@sun.uucp> jborza%burgundy@Sun.COM (Jim_Borza) writes:
>In article <4567@bunker.UUCP>, rha@bunker.UUCP (Robert H. Averack) writes:
>>      I am investigating how one can remotely cause a PC to reboot.  Getting
>> the stimulus to the PC is clearly not the problem.  The problem is getting
>> the software which recognizes the stimulus to issue a CTRL-ALT-DEL to MSDOS,
>> resulting in the reset and reboot.
>> 
>
>You can reboot a PC with the following code.
>Assemble with MASM and convert to .COM via EXE2BIN.

... assembly lanuage program deleted

>Jim Borza - Sun Microsystems

Here is a Turbo C program to do the same thing:

/*
** boot.c
**
** This small program will reboot an IBM PC or clone.  If there are no
** command line arguments or there is a single argument of "warm", then
** a warm boot is performed.  If there is a single argument of "cold",
** then a cold boot is performed.
**
** The mechanics of this feat result from the following convention
** supported by virtually every BIOS:
**
**	If you jump into the BIOS with location 0040:0072H set to the
**	magic quatity of 1234H, and jump to the entry point of the BIOS
**	at location FFFF:0000h, the system will perform a warm boot
**	(i.e., no power-on self-test, etc.).  Putting anything else in
**	that memory location will force a cold boot.
*/

#include <stdio.h>

main(argc, argv)
int argc;
char *argv[];
{
	void (far *bye) ();
	int far *pt;

	pt = (int far *) 0x00000472L;		/* location in memory for */
						/* boot magic number */
	if (argc < 2)
		*pt = 0x1234;			/* warm boot magic number */
	else if (argc == 2 && !strcmp("warm", argv[1]))
		*pt = 0x1234;			/* warm boot magic number */
	else if (argc == 2 && !strcmp("cold", argv[1]))
		*pt = 0x0000;			/* cold boot magic number */
	else {
		fprintf(stderr, "Usage: boot [warm | cold]\n");
		exit(1);
	}
	bye = (void far *) 0x0ffff0000L;	/* boot code in ROM BIOS */
	(*bye)();
}