Mail Archives: djgpp/2001/05/27/15:30:12
Because, I think Faq22_26 ought to be updated, here's my humble contribution.
This thread tries to resume all mail archives (if someone's idea was left
behind, please include it, by posting a reply), concerning subjects:
- "How to reboot a PC."
- "How to make cold / warm reset."
- "How to close the windows DOS box"
under a windows DOS box (under plain DOS I think the subject has been clearly
covered), and have been tested by me under windows 98 and windows 98SE.
The several ways to accomplish this, were someone else's ideas, not mine (give
them credit for that, not to me).
This is divided in 3 sections:
1- "Fake solutions."
2- "Successfully closing the windows Dos box"
3- "The working solution(s)"
1.1 /*Sending FFh command to the port 60h*/
outportb (0x60, 0xFF);
1.2 /*Sending this commands to this ports*/
outportb(0xCF9, 4);
outportb(0xCF9, 2);
2.1 /* INT 19h handler via __dpmi_int instruction*/
__dpmi_int(0x19, ®s);
2.2 /*Literal INT 19h
__asm__("int $0x19");
2.3 /*Sending FEh command to the port 64h*/
outportb (0x64, 0xFE);
2.4 /*preceded 2.3 by a test whether the keyboard buffer is full*/
__asm__ ("kbdfull:
inb $0x64, %al
testb $2, %al
jnz kbdfull
movb $0xFE, %al
outb %al, $0x64
");
2.4 /*preceding 2.3 by sending 00h to port 64h*/
outportb(0x3F2,0x00);
outportb (0x64, 0xFE);
2.5 /*Jumping to F000:FFF0, warm boot=0x1234*/
_farpokew(_dos_ds, 0x00472, 0x1234);
regs.x.cs = 0xf000;
regs.x.ip = 0xfff0;
regs.x.ss = regs.x.sp = regs.x.flags = 0;
__dpmi_simulate_real_mode_procedure_retf(®s);
2.6 /*Jumping to F000:FFF0, cold boot=0x0000*/
_farpokew(_dos_ds, 0x00472, 0x0000);
regs.x.cs = 0xf000;
regs.x.ip = 0xfff0;
regs.x.ss = regs.x.sp = regs.x.flags = 0;
__dpmi_simulate_real_mode_procedure_retf(®s);
3.1 /*Ugly solution*/
/*calling a windows DLL function, ...but you need user help*/
system("RUNDLL32.EXE User,ExitWindows");
3.2 /*Less ugly solution (not windows DLL dependent)*/
/*Force the user to make a hardware reset*/
/*disable all interrupts, loop forever*/
__asm__("
cli
sucks:
jmp sucks
");
Thanks to all,
Jorge Almeida
- Raw text -