Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Options for writing to CMOS/RTC battery backed RAM?

Shane_CorbinShane_Corbin Member Posts: 219

I have a need to read/write to the battery-backed CMOS RAM from Windows with Secure Boot enabled.
Do I have any options to do so from user-space? If not, what's the most lightweight solution you can recommend?

Comments

  • Peter_Viscarola_(OSR)Peter_Viscarola_(OSR) Administrator Posts: 6,836

    Do I have any options to do so from user-space?

    Dude... I didn't know one had the option to do this at all ... I had always assumed this was the exclusive province of the BIOS, and that he was the only one who understood what was stored and its format. So, I'll be curious to hear replies.

    Peter

    Peter Viscarola
    OSR
    @OSRDrivers

  • Shane_CorbinShane_Corbin Member Posts: 219
    via Email
    In this case I am the BIOS writer and need to update a checksum that wasn't
    updated properly. I can't update the BIOS while the checksum is incorrect.
  • Shane_CorbinShane_Corbin Member Posts: 219
    edited October 5 via Email
    It's not anything magical. Just some basic IO on ports 70/71 & 72/73.
    Post edited by Shane_Corbin on
  • Shane_CorbinShane_Corbin Member Posts: 219

    Can I create a lightweight driver that simply gives me access to read/write to the I/O Space addresses of interest? Then have my application load the driver when it starts, do my work, then unload it when it exits?

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 12,715
    via Email
    Shane_Corbin wrote:
    > Can I create a lightweight driver that simply gives me access to read/write to the I/O Space addresses of interest? Then have my application load the driver when it starts, do my work, then unload it when it exits?

    The older WDKs had a sample called PortIO that was designed for exactly
    this purpose.  It was in at Windows 7, but I see it has been removed now.

    It doesn't actually give you user-mode permission to write the I/O
    ports.  That involves changing the CPU's I/O permission mask, which is
    possible but dangerous.  The sample just provides ioctls to read and
    write the ports.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • John_McNameeJohn_McNamee Member Posts: 42

    @Shane_Corbin said:
    I have a need to read/write to the battery-backed CMOS RAM from Windows with Secure Boot enabled.
    Do I have any options to do so from user-space? If not, what's the most lightweight solution you can recommend?

    AFAIK, there's no way to do this from user mode.

    In the distant past, you could do it from kernel mode with HalSetBusDataByOffset(), using the Cmos bus type. Not sure if this still works in recent versions of Windows. The function still exists, but I don't know if the Cmos bus type is still implemented.

    Given a choice, using the Hal function is preferable to banging on the RTC I/O ports directly because it lets Hal serialize the access. Devices with an index/data register pair, like the RTC, can't be used safely by multiple threads.

  • Taed_WynnellTaed_Wynnell Member Posts: 102

    I did almost the same thing about 10 years back on Win2003. As I recall, I just used the trusty "DOS" DEBUG program and piped in a sequence of commands to INP and OUTP the appropriate sequence. I recall being surprised that it actually worked!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!