Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all
Me using the " Turbo C++ 3."
i want the program to restart and shut down the computer
so tell me now how can i restart the computer while using this compiler
Thanx for cooperation !!

I can help if you're in DOS, I know how to reboot the computer. I could guess on shutting down from windoze.
You can even do a cold boot or a warm boot.
No need for C++ here, just C.
int
main(void)
{
*(int far*)0x472L = 0;
(*(void (far *)(void))0xffff0000L)();
return (0);
}will do a cold boot when run from DOS.
Change
*(int far*)0x472L = 0;
to
*(int far*)0x472L = 0x1234;
to make it do a warm boot.Making an icon using
c:\windows\rundll.exe c:\windows\system\user.exe,exitwindowsshuts the computer down so I'm thinkng that you might get a C program do do this from dos using system();
char *off = "c:\\windows\\rundll.exe c:\\windows\\system\\user.exe,exitwindows";
system(off);
or maybe
char *off = "start c:\\windows...Don't you just love getting way down into the system?
Mr. A

88888888888888888888888888888888888888888888888888
What da man is doin' with far pointers is this:
For a warm boot in Dos:
place 0x1234 in memory at 0040h:0072h
proceed to FFFFh:0 and execute code from thereyou can put a boot sequence for both Dos and Windwows in your program
void main()
{
// for windows(98/ME)
system("rundll32 shell32.dll,SHExitWindowsEx 2");
// for a shut down replace the 2 with a 1
// program terminates here for Windows// boot Dos otherwise
_asm {
mov ax, 40
mov ds, ax
mov word ptr [ds:0x72], 0x1234
mov ax, 0xFFFF
push ax
mov ax, 0
push ax
retf // proceed to 0xFFFF:0000
}
}for windows 95/98
boot:
system("rundll.exe user.exe,exitwindowsexec");
shut down:
system("rundll32.exe user,exitwindows");for windows XP
boot:
system("SHUTDOWN -r -t 01);
shut down:
systen("SHUTDOWN -s -t 01);In Visual C++ you can still use system() or _wsystem()
you would need stdlib.h or process.h

Also you can Use this Source Code.,
This is Assembely over Cmain()
{
asm { //reboot
mov ax,0xffff
push ax
mov ax,0
push ax
retf
}
}

88888888888888888888888888888888888888888888888888888888888888888888
No that didn't work with me. That only calls
FFFF:0Coutesy of Ralph Brown...
----------------
INT 19 - SYSTEM - BOOTSTRAP LOADER
Desc: This interrupt reboots the system without clearing memory or restoring
interrupt vectors. Because interrupt vectors are preserved, this
interrupt usually causes a system hang if any TSRs have hooked
vectors from 00h through 1Ch, particularly INT 08.
Notes: Usually, the BIOS will try to read sector 1, head 0, track 0 from drive
A: to 0000h:7C00h. If this fails, and a hard disk is installed, the
BIOS will read sector 1, head 0, track 0 of the first hard disk.
This sector should contain a master bootstrap loader and a partition
table (see #00650). After loading the master boot sector at
0000h:7C00h, the master bootstrap loader is given control
(see #00653). It will scan the partition table for an active
partition, and will then load the operating system's bootstrap
loader (contained in the first sector of the active partition) and
give it control.
true IBM PCs and most clones issue an INT 18 if neither floppy nor hard
disk have a valid boot sector
to accomplish a warm boot equivalent to Ctrl-Alt-Del, store 1234h in
0040h:0072h and jump to FFFFh:0000h. For a cold boot equivalent to
a reset, store 0000h at 0040h:0072h before jumping.
VDISK.SYS hooks this interrupt to allow applications to find out how
much extended memory has been used by VDISKs (see #00649). DOS 3.3+
PRINT hooks INT 19 but does not set up a correct VDISK header block
at the beginning of its INT 19 handler segment, thus causing some
programs to overwrite extended memory which is already in use.
the default handler is at F000h:E6F2h for 100% compatible BIOSes
MS-DOS 3.2+ hangs on booting (even from floppy) if the hard disk
contains extended partitions which point at each other in a loop,
since it will never find the end of the linked list of extended
partitions
under Windows Real and Enhanced modes, calling INT 19 will hang the
system in the same was as under bare DOS; under Windows Standard
mode, INT 19 will successfully perform a cold reboot as it appears
to have been redirected to a MOV AL,0FEh/OUT 64h,AL sequence
BUG: when loading the remainder of the DOS system files fails, various
versions of IBMBIO.COM/IO.SYS incorrectly restore INT 1E before
calling INT 19, assuming that the boot sector had stored the
contents of INT 1E at DS:SI instead of on the stack as it actually
does
SeeAlso: INT 14/AH=17h,INT 18"BOOT HOOK",INT 49"Tandy 2000",INT 5B"PC Cluster"
SeeAlso: MEM 0040h:0067h,MEM F000h:FFF0h,CMOS 0Fh

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |