Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Booting Windows VHD with custom boot flags
#1
Question 
I have a driver I need on my Windows to Go on VHD instance that is not signed. In order for me to use it, I need to enable testsigning, which is an option in the BCD. ventoy_vhdboot.img inlcudes a BCD file that I assume I need to modify in order to add the testsigning option. However, when I use bcdedit to change the BCD, it tells me it can't find the file (This is from an administrator prompt). It can read the BCD but not edit it.

Code:
C:\WINDOWS\system32>bcdedit /store G:\ventoy\BCD

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  unknown
description             Windows Boot Manager
locale                  en-us
inherit                 {globalsettings}
default                 {default}
resumeobject            {5f7bf00c-9ab2-11eb-9a06-001a7dda7113}
displayorder            {default}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
-------------------
identifier              {default}
device                  locate=\Windows\system32\winload.exe
path                    \Windows\system32\winload.exe
description             Boot from VHD
locale                  zh-CN
inherit                 {bootloadersettings}
allowedinmemorysettings 0x15000075
osdevice                locate=\Windows\system32\winload.exe
systemroot              \Windows
resumeobject            {5f7bf00c-9ab2-11eb-9a06-001a7dda7113}
nx                      OptIn
custom:26000027         Yes

C:\WINDOWS\system32>bcdedit /store G:\ventoy\BCD /set TESTSIGNING ON
An error occurred while attempting to reference the specified entry.
The system cannot find the file specified.


I managed to use Visual BCD Editor to modify the BCD to add AllowPrereleaseSignatures to the BCD "Boot from VHD" option. However, I now cannot insert the BCD in the ventoy_vhdboot.img file.

I have tried 7-zip and WinImage to add the BCD back to the image, but the errors say either the operation is not supported or the file is full. What program do I need to be using to modify the img?
Reply
#2
I've used PowerISO for several years and it has the ability to edit img files.

http://www.poweriso.com

Might try that? I think you get a 30 day trial.
Reply
#3
(08-25-2021, 11:25 AM)asheroto Wrote: I've used PowerISO for several years and it has the ability to edit img files.

http://www.poweriso.com

Might try that?  I think you get a 30 day trial.
Nope. Didn't work. The BCD file shows in ventoy_vhdboot.img as both BCD and bcd. PowerISO doesn't know how to handle this and will only replace one of the files -- whichever is first in its listing. I did replace the file, and now I can't boot the VHD because the system can't find the BCD. Fortunately I have a backup of the original ventoy_vhdboot.img.
Reply
#4
Did you try using ImDisk to mount the img file? It should give you access to the partitions but I'm not sure if it's read/write or just read.

Otherwise you may have to use Linux (even via WSL) to access it.
Reply
#5
ImDisk does not find a filesystem in the img file. This was the same message on another img file editing application. The file does not have a windows-recognized file system like FAT32. Honestly I have no clue when it comes to WSL or linux. I had previously installed WSL so it's available to me, but I wouldn't begin to know what commands to perform. Any idea?
Reply
#6
If it is a VHD, why can't you use Windows Disk Manager to attach it - then change the BCD file and dismount it?
Reply
#7
Here you go.  You need to specify {boomgr} and {default} in the bcdedit commands when specifying the store:

Code:
bcdedit /store BCD /set {default} testsigning on
bcdedit /store BCD /set {bootmgr} testsigning on
bcdedit /store BCD

Afterwards, I was able to to use PowerISO to replace the BCD files.

If PowerISO won't recognize the file, download it again as it may have become corrupt.

[Image: I2ePFH0.png]
Reply
#8
Newest version of PowerISO. Fresh ventoy_vhdboot.img. Followed your instructions to the letter. As I said before, The BCD file shows in ventoy_vhdboot.img as both BCD and bcd (notice the upper and lowercase files). PowerISO can't replace BCD. It can only replace bcd (lower case). The BCD (upper case) file in the img never gets touched when replacing the files. If I delete both of the BCD files before replacing them with the one I modified (BCD) then I get this error.
   

(08-30-2021, 10:04 PM)asheroto Wrote: Here you go.  You need to specify {boomgr} and {default} in the bcdedit commands when specifying the store:

Code:
bcdedit /store BCD /set {default} testsigning on
bcdedit /store BCD /set {bootmgr} testsigning on
bcdedit /store BCD

Afterwards, I was able to to use PowerISO to replace the BCD files.

If PowerISO won't recognize the file, download it again as it may have become corrupt.

[Image: I2ePFH0.png]
You say you have this working. Did you boot it? If it boots, send me a copy of your modified venoy_vhdboot img.
Reply
#9
Tried both PowerISO and UltraISO both cannot replace both bcd files.. I could replace the "bcd" then rename it to "bcd_" then added the "BCD" and it replaced it correctly but then I cannot rename the "bcd_" back to "bcd" cause he cannot handle two files with the same name..

What's the difference between the two bcd files and are they both needed?
Reply
#10
I totally agree with you. Sometimes it's better not to complicate things Smile
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)