Improved method for getting the name of a windows past Vista

Bug #577071 reported by Thorsten
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-prober (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: os-prober

The current method for finding out about a vindows version past vista depends upon a certain string being present in a BCD file for each version. This is unreliable because a) the string may be present even if the related version may not be the default (e.g. on a machine with more than one version of windows) yet it is taken as such and b) for every new version of windows a new test has to be added.

It would be far more reliable to parse the BCD file and take the name of the default entry therein.

Attached is a small tool that is capable of reading single values from NT-registry hives (which the BCD files are). After installing it the default entry can be found with shell code such as the following:

---CUT HERE---
#!/bin/sh

BCD=/windows/Boot/BCD

# {9dea862c-5cdd-4e70-acc1-f32b344d4795} is the windows boot manager
# 23000003 is the default boot option inside the boot manager
# 12000004 is the title of a boot option
BOOT_MGR=$(readhive $BCD \\Objects\\\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\\\Elements\\23000003\\Element)
WIN_NAME=$(readhive $BCD \\Objects\\$BOOT_MGR\\Elements\\12000004\\Element)
echo "Boots $WIN_NAME by default"

---CUT HERE---

I tested this on my machine with windows server 2008 r2 installed. It should still be tested with other versions of windows and in particular on machines with multiple versions of windows.

I am sorry if this should not be the right place for suggesting a new feature like this. I couldn't find any better.
Best,
Thorsten

Revision history for this message
Thorsten (ungesaeuertesbrot) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.