Click here to Skip to main content
Licence 
First Posted 7 Jan 2002
Views 58,433
Bookmarked 18 times

Soft Reboot under MS-DOS

By | 7 Jan 2002 | Article
Get a program to avoid hardware reboot under DOS

Why this article?

Most of us have to work under MS-DOS for various reasons like troubleshooting windows, installing other operating systems, altering windows default settings and many more. But didn't you miss something there? Yes, you are right - restart. We always have to use hardware reset while working under MS-DOS. This article will solve your problem.

Details

So, here we will write a program in C/C++ to make our system reboot when executed. Before the code I would like to explain some topics which we have to consider before writing. These are:

  • Pointers to Functions
  • ROM BIOS Routine Addresses

So, Here we go:

Pointers to functions

For many of us this can be a strange topic as we all have dedicated some part of our programming career in understanding pointers but never or very few came across pointers to functions. So, before going further note that functions do occupy memory and therefore we can assign pointers to those memory locations from which functions get start.

Declaring a pointer to a function

int (*function_ptr)() is a pointer to a function whose return type is integer. Mind you, we always have to look for memory usage while dealing with pointers.

ROM BIOS routine addresses

Now we all know, ROM Chips constitutes Read Only Memory which contains programs which cannot be altered. But have you ever thought that the ROM Chips contains those programs which loads into memory before anything else and these gets loaded into memory RAM) unless we turn off our computer. Therefore to write a program which reboot our computer we just need the memory address of first ROM BIOS Routine which get executed the moment we boot our computer. This address is 0xFFFF0000. I think, now we are in the position of writing code.

void main()
{
    void far(*p)(); //we need 32 bit pointer
    p=0xFFFF0000; //this is the location we are pointing to
    (*p)(); //calling
}

I don't know, why Microsoft didn't put DOS reboot by themselves. But you can do so by the .exe file of above code.

Why this code is not working under windows?

This code cannot work under windows as window work above DOS's 1MB memory. If you run this code under Windows, the window you are working under will get closed. Why didn't I provide just the source code? I thought a little description will make above code more easy to understand.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

mohit_aggarwal

Web Developer

India India

Member

Mail me at:mohitaggarwal@bitbis.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 PinmemberAlexandre GRANVAUD5:24 11 Mar '10  
Questionhow about to reboot under windows2000 PinmemberAnonymous17:09 30 May '02  
GeneralFlush hard disk first PinmemberHenk Devos2:53 14 Jan '02  
Generalthis is same as ... PinmemberNish [BusterBoy]21:23 8 Jan '02  
GeneralAnd if... Pinmemberbrandonl_webguy8:43 8 Jan '02  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 8 Jan 2002
Article Copyright 2002 by mohit_aggarwal
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid