Solved

Change CMOS settings from in Windows? - Is it possible?

Posted on 2004-04-06
20
5,029 Views
Last Modified: 2007-12-19
Are there any programs that can change the CMOS settings from windows from a batch file.

I wan't to be able set the RTC Alarm each time the computer turns off so it can turn on again at the right time.

It has to work on most BIOSes and preferably in win XP

Thanks
0
Comment
Question by:Wierdy1024
  • 9
  • 4
  • 3
  • +4
20 Comments
 
LVL 62

Accepted Solution

by:
☠ MASQ ☠ earned 60 total points
ID: 10765887
This is pretty much the IT equivalent of pulling the rug from underneath your feet!  Remeber that the CMOS settings tell the PC how to behave on boot, what you will be doing is changing the rules halfway through the game!

You might find this useful to begin with but be real careful writing to CMOS in session.

http://www.programmersheaven.com/2/Art_C_1
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10767022
MASQUERAID - I only wan't to change the RTC ALARM time so this shouldn't be a problem. The code looks good even with my rusty programming. My problem is that this can't be done in an XP program because NT/2K/XP don't allow direct hardware access do they?

Windows uses the same method for changing the clock doesn't(I thought) it so it mus be possible somehow!
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10767055
If I change any of this how do I get the correct CRC/Checksum again or will it be reset automaticly?
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10767260
Changing the time uses the NTSetSystemTime API - I can't trace it from there.

I found the "Sytstem CMOS/Real Time Clock" in system in device manager but it has no driver.

Any ideas people?
0
 
LVL 62

Assisted Solution

by:☠ MASQ ☠
☠ MASQ ☠ earned 60 total points
ID: 10767426
You're right - sorry, the lack of direct hardware access in NT escaped me completely!

Possibly if you had a DOS boot ...
http://www.experts-exchange.com/Programming/Q_11678198.htm

I'm hunting how resetting time in XP writes to CMOS.  I'm sure there's someway of using ACPI and IRQ8.  Resetting time in XP/NT certainly seems to write to CMOS directly.

As long as you change discreet areas of CMOS the CRC is recalculated.  The problem is with indiscriminately writing and putting in impossible values.

I'm not the person to find you an answer here, maybe post a pointer to this both in Hardware & Programming.  Certainly if you get a solution I'd be interested in seeing it.

Good luck!
M :o)
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10767600
Correction to your URL:
http://www.experts-exchange.com/Programming/Q_11678198.html

I don't wan't to use DOS so I will investigate XP device drivers!

Thanks anyway!
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10767705
This question is now worth 110 points as I have posted two other linked questions in programming and Hardware.
0
 
LVL 62

Expert Comment

by:☠ MASQ ☠
ID: 10767733
Arghh! - cut & past ;)
Good luck!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 10767790
FYI - Wierdy1024...
Pointer questions are typically worth nothing as they are deleted after the original question is resolved - thus, if you really want to assign this one 110 points, you should increase them here...

Sorry - I know of no way in XP to do what you're asking - but we do have some great hardware folks here that can confirm one way or another...
0
 
LVL 9

Expert Comment

by:buckeyes33
ID: 10768255
I have to say it is a no or I just don't know how to do it if the answer is yes.   Truthfully I don't know a lot.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 1

Author Comment

by:Wierdy1024
ID: 10768435
Windows updates the clock somehow - Just modify some code and it should be easy. Updating the clock writes to the CMOS as well.

Don't suppose anyone has that leaked win2K source code lying around - That could help.
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10768739
Found Software by AOpen called Winbios. It only works for AOpen motherboards but it might be possible to modify it?

I havn't downloaded it yet - I can't find a working download link.

It works on XP as well
0
 
LVL 62

Expert Comment

by:☠ MASQ ☠
ID: 10768866
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10769005
MASQUERAID - Not the same WinBIOS I was looking at. I downloaded that and the AOpen one. The AOpen one looked promising but then presented me with an error stating that I didn't have an AOpen motherboard.(it was worth a try)

Your winBIOS didn't appear to be able to Write to the CMOS just read.
0
 

Expert Comment

by:LaurencePata
ID: 10769766
Your CMOS is read only and so your winBIOS can not write it.
0
 
LVL 69

Expert Comment

by:Callandor
ID: 10770343
Programs like awdflash.exe obviously write to the CMOS, so that is one avenue, if you can figure out how they do it (in addition to that, they only run in DOS, but I think that's because it would be a disaster if you changed the BIOS setting for your hard drive in the middle of Windows).
0
 

Expert Comment

by:LaurencePata
ID: 10770456
if awdflash.exe is used then the possibility of a system reset, restoring the computer to its just brought state and even deleting more things(including windows), is likely as the BIOS setting on the hard drive re-writes itself. this is only true with certain computer brands though.

0
 

Assisted Solution

by:LaurencePata
LaurencePata earned 20 total points
ID: 10770649
I managed to find a code for a timer that runs on a similar system to the clock you are looking for, using windows API.
This class uses a high-resolution multi-media timer to track elapsed time. This class is useful for timing user operations, or for bench-marking your applications. Because it uses the Windows multi-media timer it uses much higher resolution than the built-in VB Timer function.


' Class : CMMTimer
' Description : Track elapsed time
' Source : Total Visual SourceBook
'

' Declarations for Windows API calls
Private Declare Function timeGetTime _
  Lib "winmm.dll" () _
  As Long
 
  ' Local variables to hold Public Property values
  Private m_lngScaleFactor As Long

  ' Private class-specific variables
  Private mlngElapsedTime As Long
  Private mlngStarted As Long
  Private mfStopped As Boolean

Private Sub Class_Initialize()
  ' Set initial values to defaults which may be overridden
  ' with property settings
  ' Source: Total Visual SourceBook


  ' scales value from milliseconds to seconds
  m_lngScaleFactor = 1000

End Sub

Public Property Get ElapsedTime() As Double
  ' Returns: the current Elapsed Time value, scaled by the
  '          value of the ScaleFactor property
  ' Source : Total Visual SourceBook
  '
  On Error GoTo PROC_ERR

  ElapsedTime = _
    cDbl((mlngElapsedTime + GetCurrentElapsedTime()) / _
    m_lngScaleFactor)

PROC_EXIT:
  Exit Property

PROC_ERR:
  MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
  "ElapsedTime"

  Resume PROC_EXIT

End Property
Public Property Get ScaleFactor() As Long
  ' Returns: the current value of ScaleFactor
  ' Source: Total Visual SourceBook
  '
  ScaleFactor = m_lngScaleFactor

End Property

Public Property Let ScaleFactor(ByVal lngValue As Long)
  ' lngValue: Set the scaling factor. A value of 1000 returns
  ' results in portions of seconds; a value of 60000
  ' returns results in portions of minutes
  ' Source: Total Visual SourceBook
  '
  If lngValue > 0 Then
    m_lngScaleFactor = lngValue
  End If

End Property

Public Sub ResumeTimer()
  ' Comments : Resumes a timing operation which was paused
  ' with the StopTimer method. If the timer was not
  ' started already, it is started automatically.
  ' Parameters: None
  ' Returns : Nothing
  ' Source : Total Visual SourceBook
  '
  On Error GoTo PROC_ERR

  mlngStarted = timeGetTime
  mfStopped = False

PROC_EXIT:
  Exit Sub

PROC_ERR:
  MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
  "ResumeTimer"
  Resume PROC_EXIT

End Sub
Public Sub StartTimer()
  ' Comments  : Starts a timing operation. The value of ElapsedTime
  '             is reset before beginning
  ' Parameters: None
  ' Returns   : Nothing
  ' Source    : Total Visual SourceBook
  '
  On Error GoTo PROC_ERR

  mlngStarted = timeGetTime
  mfStopped = False
  mlngElapsedTime = 0

PROC_EXIT:
  Exit Sub

PROC_ERR:
  MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
    "StartTimer"
  Resume PROC_EXIT

End Sub

Public Sub StopTimer()
  ' Comments  : Stops the timer. Current elapsed time value is
  '             not reset.
  ' Parameters: None
  ' Returns   : Nothing
  ' Source    : Total Visual SourceBook
  '
  On Error GoTo PROC_ERR

  ' Set Elapsed Time value to the previous elapsed time
  ' value, plus any increment since the timer was last started
  mlngElapsedTime = mlngElapsedTime + GetCurrentElapsedTime()

  mlngStarted = 0
  mfStopped = True

PROC_EXIT:
  Exit Sub

PROC_ERR:
  MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
  "StopTimer"
  Resume PROC_EXIT

End Sub

Private Function GetCurrentElapsedTime() As Long
  ' Comments  : Returns the elapsed time since the timer
  '             was last started
  ' Parameters: None
  ' Returns   : Current Elapsed Time
  ' Source    : Total Visual SourceBook
  '
  On Error GoTo PROC_ERR
 
  If mlngStarted <> 0 And mfStopped = False Then
    GetCurrentElapsedTime = (timeGetTime - mlngStarted)
  End If

PROC_EXIT:
  Exit Function

PROC_ERR:
  MsgBox "Error: " & Err.Number & ". " & Err.Description, , _
    "GetCurrentElapsedTime"
  Resume PROC_EXIT

End Function

0
 
LVL 3

Assisted Solution

by:shanekc
shanekc earned 20 total points
ID: 10772079
Wierdy,

It sounds like what you're trying to do would be much simpler if you configured the computers to use either S1 or S3 standby states, and used a task scheduler to wake the computer up at a specified time.  You could even write a batch file or simple API application to request the user to specify a time during the suspend process.
0
 
LVL 1

Author Comment

by:Wierdy1024
ID: 10773368
I've just had a brain wave!

Why don't I use blue-tack to hold down the power button and use an old fashoned timer on the plug on the wall - I wouldn't be able to use batch files but this seems out of my depth though.

I would be very interrested if anyone does find a solution - If they do then post here.

Since you have all put lots of effort in I will split the points.

Thanks


Comments to the above posts:

LaurencePata:  CMOS can't be read only - I can change BIOS settings from the BIOS setup utility!

Callandor: I'm not sure they write to the CMOS - They flash the BIOS ROM but they leave CMOS settings intact (Most do I think) - Anyway I need a way from windows. I know how to do it from DOS - see http://www.programmersheaven.com/2/Art_C_1

LaurancePata: I don't care if they wipe the wrong bit of CMOS by mistake. I have test machines that I can reset the BIOS on. I just wan't to be able to get something working.

LaurancePata: Thanks for the code. All we need now is source code for winmm.dll to find out how it works. That is copyright though and not easy to get. (Although it is possible through P2P networks)

shanekc:  I can't use standby - I need them to be able to withstand power faliures!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
A PDF to HTML file converter 2 90
Graph function 4 54
Vertex form of the function 8 48
My smart TV isn't so smart 14 70
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Surprisingly, there is a lot to Gym battles, and I thought it would be helpful to share knowledge about all the ins and outs of this feature!
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…
Saved searches can save you time by quickly referencing commonly searched terms on any topic. Whether you are looking for questions you can answer or hoping to learn about a specific issue, a saved search can help you get the most out of your time o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now