Click here to Skip to main content
15,890,741 members
Articles / Desktop Programming / MFC

How to Clear CMOS

Rate me:
Please Sign up or sign in to vote.
2.30/5 (33 votes)
27 Nov 2003CPOL 122.6K   16   21
The two line code to clear cmos password or to clear whole cmos

Introduction

Add the following code in an MFC application or make Win32 Dynamic link library and then add the code. It works fine on Win9x only, it was not tested on XP/NT and hope it won't work on NT based tech.

The intension of this code is only for educational purposes. This code is for those who are too lazy to open their cabinet and remove the batter. No remote CMOS clearing routine is specified, so no questions should be posted for the same.  

How To Use It

Come on, you know how to... 

C++
int __stdcall Clear_Cmos( )
{
_outp(0x70,0x2E);   //password will get cleared
_outp(0x71,0xFF); 

/* if you want to clear whole CMOS
use following code
for(int i=0;i<256;i++)  // whole cmos will get cleared
{
   _outp(0x70,i);
   _outp(0x71,i); 
}
*/
return 0;
}

History

  • 27th November, 2003: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
Computer Engineer. Pune univ.

Comments and Discussions

 
Questioncan u help me to write the same for XP Pin
KSMH14-May-07 5:17
KSMH14-May-07 5:17 
AnswerRe: can u help me to write the same for XP Pin
jauming20-Sep-07 16:51
jauming20-Sep-07 16:51 
Generalget with programatically [modified] Pin
pvn g10-Jan-07 17:51
pvn g10-Jan-07 17:51 
Generalstupid question Pin
toxcct6-Oct-04 7:00
toxcct6-Oct-04 7:00 
GeneralRe: stupid question Pin
doublej2-Dec-04 3:21
doublej2-Dec-04 3:21 
GeneralRe: stupid question Pin
toxcct2-Dec-04 20:23
toxcct2-Dec-04 20:23 
Generalworks great Pin
Anonymous27-May-04 7:42
Anonymous27-May-04 7:42 
Generallong time ago! Pin
Anonymous12-Dec-03 10:43
Anonymous12-Dec-03 10:43 
Generalthat wouldn't run on Windows Pin
Elias Bachaalany2-Dec-03 21:26
Elias Bachaalany2-Dec-03 21:26 
GeneralRe: that wouldn't run on Windows Pin
Sreekanth Muralidharan12-Oct-04 23:47
Sreekanth Muralidharan12-Oct-04 23:47 
Hello,
You are wrong there. _inp and _outp instructions are privileged instructions which should be coded in a device driver type module. But there are libraries available which could make them work in unprivileged mode. There are plenty of drivers there which would give you a Ring0 privilege with access to ports. If you just need to install those drivers these would work fine.


Regards,
Sreekanth Muralidharan
QuestionHow to know ??? Pin
Georgi Petrov2-Dec-03 3:46
Georgi Petrov2-Dec-03 3:46 
AnswerRe: How to know ??? Pin
Balkrishna Talele2-Dec-03 18:39
Balkrishna Talele2-Dec-03 18:39 
AnswerRe: How to know ??? Pin
Anonymous13-Apr-05 19:26
Anonymous13-Apr-05 19:26 
QuestionCan I write a New password? Pin
ArielR2-Dec-03 0:17
ArielR2-Dec-03 0:17 
QuestionHow about system temperature... Pin
Member 9405930-Nov-03 2:07
Member 9405930-Nov-03 2:07 
AnswerRe: How about system temperature... Pin
John M. Drescher30-Nov-03 4:01
John M. Drescher30-Nov-03 4:01 
GeneralRe: How about system temperature... Pin
sb142319-Feb-04 5:32
sb142319-Feb-04 5:32 
GeneralRe: How about system temperature... Pin
John M. Drescher19-Feb-04 5:38
John M. Drescher19-Feb-04 5:38 
AnswerRe: How about system temperature... Pin
Anonymous13-Apr-05 19:28
Anonymous13-Apr-05 19:28 
GeneralRoom for improvment... Pin
Joel Holdsworth28-Nov-03 2:46
Joel Holdsworth28-Nov-03 2:46 
GeneralRe: Room for improvment... Pin
John M. Drescher28-Nov-03 3:17
John M. Drescher28-Nov-03 3:17 

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

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