Menu

#44 Clear flag for unsuccessful boot

closed
nobody
5
2012-09-12
2010-08-13
No

If using SHUTDOWN or REBOOT in the boot time script, the next boot will complain about an unsuccessful last boot.

Since CHKDSK does reboot when checking the boot drive at boot too and the system is not complaining, there must be a way to clear this flag by UD too.


Stefan

Discussion

  • Stefan Pendl

    Stefan Pendl - 2010-08-13

    It seems that this is called the "Simple Boot Flag" support.

     
  • Dmitri Arkhangelski

    Well. I'll check the specification to define whether we should apply its rules to our shutdown/reboot code or not.

    That's really funny (and sad) to see how many artificial limitations and complexities MS invented during their history. As you remember, DOS and other systems of past time can be easily rebooted without any further warnings. It seems that a great time of simplicity goes away from the field of desktop OS'es. To return back later ;-) I hope. a renaissance of simplicity will ever become.

    Weather becomes a little bit cooler, so days of active development are coming soon ;-)

     
  • Dmitri Arkhangelski

    After the first superficial look at the specification I have the following question: does we have a test machine with EFI firmware? Seems that the boot flag location differs on usual and EFI systems (we should test both cases).

    Another problem - I cannot understand how to read/write the flag - specs provides misty description of that. And it provides no example at all, unbelievable!

     
  • Stefan Pendl

    Stefan Pendl - 2010-08-13

    The BIOS register is accessed via ports 70 and 71, which is mentioned in the first paragraph in a small brace.

    I do not have an EFI system at hand.

    I have already searched the web for example code, but failed :-(

    I really hat it, if information must be hunted for >:-(

     
  • Dmitri Arkhangelski

    Stefan,

    CMOS access through ports is available only in kernel mode drivers, so it is unavailable for us. I think, it should be some IOCTL code for that or something similar, though I'm not sure.

    Secondly, to define where the boot flag locates in CMOS, we should examine ACPI for the RSDT table which follows by other tables including desired BOOT table which contains an offset of the flag in CMOS. Sounds complex, right ;-)

    So, we need to understand, how to access ACPI tables (docs are at http://www.acpi.info/spec40.htm - about 700 pages) and how to read/write CMOS under Windows through ntdll calls.

    Due to the complexity of the procedure (at least it looks complex enough) we may expect two new calls in Win7 NTDLL: QuerySimpleBootFlag and SetSimpleBootFlag. Are they exist?

    Oh, I forgot to mention EFI features - it holds desired variable in other place and I have no idea how to access it. Maybe EFI specs have an answer inside...

     
  • Dmitri Arkhangelski

    PS.: It is good to understand specs completely if you're a hardware engineer, but in our case it is not so pleasant to encounter the need to read a huge technical docs just to resolve a little problem.

     
  • Stefan Pendl

    Stefan Pendl - 2010-08-13

    It would be nice to have the autocheck source code at hand.

     
  • Stefan Pendl

    Stefan Pendl - 2010-08-13

    http://technet.microsoft.com/en-us/sysinternals/bb897447.aspx mentions that only 25 out of 250 ntdll functions are documented, so there might be a chance, that there is something already there.

     
  • Stefan Pendl

    Stefan Pendl - 2010-08-13

    http://undocumented.ntinternals.net/

    NtQuerySystemInformation + SystemFlagsInformation might be something to check.

     
  • Dmitri Arkhangelski

    I've checked a system flags set at http://www.koders.com/c/fid3B23CA9C726E812DBCE88B94E4C6DD8D0099FF3C.aspx?s=ntddk.h and noticed that a simple boot flag is likely missing there (or stays at unknown offset).

    On EFI the access is very simple - through GetFirmwareEnvironmentVariable and SetFirmwareEnvironmentVariable functions exported by kernel32.dll http://msdn.microsoft.com/en-us/library/ms724325 We should just find a native equivalents of them.

    On usual (non-EFI) system the flag is accessed in more tricky way, now I continue to research all the aspects of that complex process.

     
  • Stefan Pendl

    Stefan Pendl - 2010-10-21

    Implemented in release 4.4.0

     

Log in to post a comment.