[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5077
  • Last Modified:

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

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
Wierdy1024
Asked:
Wierdy1024
  • 9
  • 4
  • 3
  • +4
4 Solutions
 
☠ MASQ ☠Commented:
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
 
Wierdy1024Author Commented:
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
 
Wierdy1024Author Commented:
If I change any of this how do I get the correct CRC/Checksum again or will it be reset automaticly?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Wierdy1024Author Commented:
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
 
☠ MASQ ☠Commented:
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
 
Wierdy1024Author Commented:
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
 
Wierdy1024Author Commented:
This question is now worth 110 points as I have posted two other linked questions in programming and Hardware.
0
 
☠ MASQ ☠Commented:
Arghh! - cut & past ;)
Good luck!
0
 
sirbountyCommented:
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
 
buckeyes33Commented:
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
 
Wierdy1024Author Commented:
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
 
Wierdy1024Author Commented:
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
 
Wierdy1024Author Commented:
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
 
LaurencePataCommented:
Your CMOS is read only and so your winBIOS can not write it.
0
 
CallandorCommented:
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
 
LaurencePataCommented:
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
 
LaurencePataCommented:
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
 
shanekcCommented:
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
 
Wierdy1024Author Commented:
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 9
  • 4
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now