… | |
… | |
19 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
19 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
20 | # |
20 | # |
21 | |
21 | |
22 | use 5.016; # numerous features need 5.14, __SUB__ needs 5.16 |
22 | use 5.016; # numerous features need 5.14, __SUB__ needs 5.16 |
23 | |
23 | |
24 | our $VERSION = '1.0'; |
24 | our $VERSION = '1.1'; |
25 | our $JSON_VERSION = 1; # the versiobn of the json objects generated by this program |
25 | our $JSON_VERSION = 1; # the versiobn of the json objects generated by this program |
26 | |
26 | |
27 | =head1 NAME |
27 | =head1 NAME |
28 | |
28 | |
29 | pbcdedit - portable boot configuration data (BCD) store editor |
29 | pbcdedit - portable boot configuration data (BCD) store editor |
… | |
… | |
222 | successfully boot any post-XP version of Windows (suitable C<device> and |
222 | successfully boot any post-XP version of Windows (suitable C<device> and |
223 | C<osdevice> values, of course): |
223 | C<osdevice> values, of course): |
224 | |
224 | |
225 | { |
225 | { |
226 | "{bootmgr}" : { |
226 | "{bootmgr}" : { |
227 | "resumeobject" : "{45b547a7-8ca6-4417-9eb0-a257b61f35b4}" |
227 | "default" : "{45b547a7-8ca6-4417-9eb0-a257b61f35b4}" |
228 | }, |
228 | }, |
229 | |
229 | |
230 | "{45b547a7-8ca6-4417-9eb0-a257b61f35b1}" : { |
230 | "{45b547a7-8ca6-4417-9eb0-a257b61f35b1}" : { |
231 | "type" : "application::osloader", |
231 | "type" : "application::osloader", |
232 | "description" : "Windows Boot", |
232 | "description" : "Windows Boot", |
… | |
… | |
359 | |
359 | |
360 | This represents a single GUID value wrapped in curly braces. It is used a |
360 | This represents a single GUID value wrapped in curly braces. It is used a |
361 | lot to refer from one BCD object to other one. |
361 | lot to refer from one BCD object to other one. |
362 | |
362 | |
363 | For example, The C<{bootmgr}> object might refer to a resume boot option |
363 | For example, The C<{bootmgr}> object might refer to a resume boot option |
364 | using C<resumeobject>: |
364 | using C<default>: |
365 | |
365 | |
366 | "resumeobject" : "{7ae02178-821d-11e7-8813-1c872c5f5ab0}", |
366 | "default" : "{7ae02178-821d-11e7-8813-1c872c5f5ab0}", |
367 | |
367 | |
368 | Human readable aliases are used and allowed. |
368 | Human readable aliases are used and allowed. |
369 | |
369 | |
370 | =item guid list |
370 | =item guid list |
371 | |
371 | |
… | |
… | |
736 | Similar to C<get>, but sets the element to the given I<value> instead. |
736 | Similar to C<get>, but sets the element to the given I<value> instead. |
737 | |
737 | |
738 | Example: change the bootmgr default too |
738 | Example: change the bootmgr default too |
739 | C<{b097d2ad-bc00-11e9-8a9a-525400123456}>: |
739 | C<{b097d2ad-bc00-11e9-8a9a-525400123456}>: |
740 | |
740 | |
741 | pbcdedit edit BCD set "{bootmgr}" resumeobject "{b097d2ad-bc00-11e9-8a9a-525400123456}" |
741 | pbcdedit edit BCD set "{bootmgr}" default "{b097d2ad-bc00-11e9-8a9a-525400123456}" |
742 | |
742 | |
743 | =item C<eval> I<perlcode> |
743 | =item C<eval> I<perlcode> |
744 | |
744 | |
745 | This takes the next argument, interprets it as Perl code and |
745 | This takes the next argument, interprets it as Perl code and |
746 | evaluates it. This allows you to do more complicated modifications or |
746 | evaluates it. This allows you to do more complicated modifications or |
… | |
… | |
769 | |
769 | |
770 | pbcdedit edit BCD eval 'say $BCD->{$DEFAULT}{description}' |
770 | pbcdedit edit BCD eval 'say $BCD->{$DEFAULT}{description}' |
771 | |
771 | |
772 | The example given for C<set> could be expressed like this: |
772 | The example given for C<set> could be expressed like this: |
773 | |
773 | |
774 | pbcdedit edit BCD eval '$BCD->{$DEFAULT}{resumeobject} = "{b097d2ad-bc00-11e9-8a9a-525400123456}"' |
774 | pbcdedit edit BCD eval '$BCD->{"{bootmgr}"{default} = "{b097d2ad-bc00-11e9-8a9a-525400123456}"' |
775 | |
775 | |
776 | =item C<do> I<path> |
776 | =item C<do> I<path> |
777 | |
777 | |
778 | Similar to C<eval>, above, but instead of using the argument as perl code, |
778 | Similar to C<eval>, above, but instead of using the argument as perl code, |
779 | it loads the perl code from the given file and executes it. This makes it |
779 | it loads the perl code from the given file and executes it. This makes it |
… | |
… | |
1492 | 0x25000002 => 'testmix', |
1492 | 0x25000002 => 'testmix', |
1493 | 0x26000003 => 'cacheenable', |
1493 | 0x26000003 => 'cacheenable', |
1494 | 0x26000003 => 'customsettings', |
1494 | 0x26000003 => 'customsettings', |
1495 | 0x23000003 => 'default', |
1495 | 0x23000003 => 'default', |
1496 | 0x25000003 => 'failurecount', |
1496 | 0x25000003 => 'failurecount', |
1497 | 0x23000003 => 'resumeobject', |
|
|
1498 | 0x26000004 => 'failuresenabled', |
1497 | 0x26000004 => 'failuresenabled', |
1499 | 0x26000004 => 'pae', |
1498 | 0x26000004 => 'pae', |
1500 | 0x26000004 => 'stampdisks', |
1499 | 0x26000004 => 'stampdisks', |
1501 | 0x25000004 => 'testtofail', |
1500 | 0x25000004 => 'testtofail', |
1502 | 0x25000004 => 'timeout', |
1501 | 0x25000004 => 'timeout', |
… | |
… | |
2263 | } |
2262 | } |
2264 | |
2263 | |
2265 | sub bcd_edit { |
2264 | sub bcd_edit { |
2266 | my ($path, $bcd, @insns) = @_; |
2265 | my ($path, $bcd, @insns) = @_; |
2267 | |
2266 | |
2268 | my $default = $bcd->{"{bootmgr}"}{resumeobject}; |
2267 | my $default = $bcd->{"{bootmgr}"}{default}; |
2269 | |
2268 | |
2270 | # prepare "officially visible" variables |
2269 | # prepare "officially visible" variables |
2271 | local $pbcdedit::PATH = $path; |
2270 | local $pbcdedit::PATH = $path; |
2272 | local $pbcdedit::BCD = $bcd; |
2271 | local $pbcdedit::BCD = $bcd; |
2273 | local $pbcdedit::DEFAULT = $default; |
2272 | local $pbcdedit::DEFAULT = $default; |