11using System ;
2- using System . Collections . Generic ;
3- using System . Linq ;
42using System . Text ;
5- using System . Threading . Tasks ;
63
74namespace UnifiedFlashingPlatform
85{
@@ -27,13 +24,23 @@ public void SetUEFIVariable(Guid Guid, string Name, UefiVariableAttributes Attri
2724 byte [ ] ParamBuffer = new byte [ 540 + Data . Length ] ;
2825
2926 /* 15..30 */ Buffer . BlockCopy ( Guid . ToByteArray ( ) , 0 , ParamBuffer , 0 , 16 ) ;
30- /* 31..34 */ Buffer . BlockCopy ( BigEndian . GetBytes ( Name . Length * 2 , 4 ) , 0 , ParamBuffer , 16 , 4 ) ;
27+ /* 31..34 */ Buffer . BlockCopy ( BigEndian . GetBytes ( Math . Min ( 512 , Name . Length * 2 ) , 4 ) , 0 , ParamBuffer , 16 , 4 ) ;
3128 /* 35.. */ Buffer . BlockCopy ( Encoding . Unicode . GetBytes ( Name ) , 0 , ParamBuffer , 20 , Math . Min ( 512 , Name . Length * 2 ) ) ; // 256 Max Size for name (unicode)
3229 /* 547..550 */ Buffer . BlockCopy ( BigEndian . GetBytes ( Attributes , 4 ) , 0 , ParamBuffer , 532 , 4 ) ;
3330 /* 551..554 */ Buffer . BlockCopy ( BigEndian . GetBytes ( Data . Length , 4 ) , 0 , ParamBuffer , 536 , 4 ) ;
3431 /* 555.. */ Buffer . BlockCopy ( Data , 0 , ParamBuffer , 540 , Data . Length ) ;
3532
3633 WriteParam ( SettingUEFIVariableWriteParamSignature , ParamBuffer ) ;
3734 }
35+
36+ public void SetOneTimeBootSequence ( uint BootEntryID )
37+ {
38+ WriteParam ( OneTimeBootSequenceWriteParamSignature , BigEndian . GetBytes ( BootEntryID , 4 ) ) ;
39+ }
40+
41+ public void SetProgressBar ( uint Percentage )
42+ {
43+ WriteParam ( "PBI\0 " , BigEndian . GetBytes ( Percentage , 4 ) ) ;
44+ }
3845 }
3946}
0 commit comments