forked from LongSoft/Universal-IFR-Extractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EFI.cpp
1668 lines (1295 loc) · 83.6 KB
/
EFI.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Header files
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include "EFI.h"
// Supporting function implementation
void getEFIStringPackages(vector<EFI_IFR_STRING_PACK> &stringPackages, const string &buffer) {
// Initialize variables
EFI_IFR_STRING_PACK tempStringPackage;
// Go through buffer
for (unsigned int i = 0; i < buffer.size() - 9; i++)
// Check if string package was found
if ((buffer[i] != '\x00' || buffer[i + 1] != '\x00' || buffer[i + 2] != '\x00' || buffer[i + 3] != '\x00') && buffer[i + 4] == '\x02' && buffer[i + 5] == '\x00' && (buffer[i + 6] != '\x00' || buffer[i + 7] != '\x00' || buffer[i + 8] != '\x00' || buffer[i + 9] != '\x00') && i + static_cast<unsigned char>(buffer[i + 6]) + (static_cast<unsigned char>(buffer[i + 7]) << 8) + (static_cast<unsigned char>(buffer[i + 8]) << 16) + (static_cast<unsigned char>(buffer[i + 9]) << 24) < buffer.size() && buffer[i + static_cast<unsigned char>(buffer[i + 6]) + (static_cast<unsigned char>(buffer[i + 7]) << 8) + (static_cast<unsigned char>(buffer[i + 8]) << 16) + (static_cast<unsigned char>(buffer[i + 9]) << 24) + 4] >= 'a' && buffer[i + static_cast<unsigned char>(buffer[i + 6]) + (static_cast<unsigned char>(buffer[i + 7]) << 8) + (static_cast<unsigned char>(buffer[i + 8]) << 16) + (static_cast<unsigned char>(buffer[i + 9]) << 24) + 4] <= 'z' && i + static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24) < buffer.size() && buffer[i + static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24) + 4] == '\x02' && buffer[i + static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24) + 5] == '\x00') {
// Set temp string package
tempStringPackage.header.offset = i;
tempStringPackage.header.length = static_cast<uint32_t>(static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24));
tempStringPackage.header.type = static_cast<uint16_t>(static_cast<unsigned char>(buffer[i + 4]) + (static_cast<unsigned char>(buffer[i + 5]) << 8));
for (uint32_t j = i + static_cast<uint32_t>(static_cast<unsigned char>(buffer[i + 6]) + (static_cast<unsigned char>(buffer[i + 7]) << 8) + (static_cast<unsigned char>(buffer[i + 8]) << 16) + (static_cast<unsigned char>(buffer[i + 9]) << 24)); buffer[j] != '\x00'; j += 2)
tempStringPackage.language.push_back(buffer[j]);
tempStringPackage.numberOfStrings = static_cast<uint32_t>(static_cast<unsigned char>(buffer[i + 14]) + (static_cast<unsigned char>(buffer[i + 15]) << 8) + (static_cast<unsigned char>(buffer[i + 16]) << 16) + (static_cast<unsigned char>(buffer[i + 17]) << 24));
tempStringPackage.attributes = static_cast<uint32_t>(static_cast<unsigned char>(buffer[i + 18]) + (static_cast<unsigned char>(buffer[i + 19]) << 8) + (static_cast<unsigned char>(buffer[i + 20]) << 16) + (static_cast<unsigned char>(buffer[i + 21]) << 24));
// Add string package to list
stringPackages.push_back(tempStringPackage);
// Clear temp string package
tempStringPackage.language.clear();
}
}
void displayEFIStringPackages(const vector<EFI_IFR_STRING_PACK> &stringPackages) {
// Display string packages info
cout << "String Packages Information:" << endl;
// Go through string packages
for (unsigned int i = 0; i < stringPackages.size(); i++) {
// Display string package info
cout << "\tString Package " << i << " Information:" << endl;
cout << "\t\tOffset: " << dec << stringPackages[i].header.offset << hex << uppercase << " (0x" << stringPackages[i].header.offset << ')' << endl;
cout << "\t\tLength: " << dec << stringPackages[i].header.length << hex << uppercase << " (0x" << stringPackages[i].header.length << ')' << endl;
cout << "\t\tLanguage: " << stringPackages[i].language << endl;
cout << "\t\tNumber of strings: " << dec << stringPackages[i].numberOfStrings << hex << uppercase << " (0x" << stringPackages[i].numberOfStrings << ')' << endl;
cout << "\t\tAttributes: " << dec << stringPackages[i].attributes << hex << uppercase << " (0x" << stringPackages[i].attributes << ')' << endl;
}
cout << endl;
}
void getEFIStrings(vector<EFI_IFR_STRING_PACK> &stringPackages, vector<string> &strings, const string &buffer) {
// Initialize variables
int index;
string temp;
// Go through string packages
for (unsigned int i = 0; i < stringPackages.size(); i++) {
// Check if language isn't english
if (stringPackages[i].language != "eng")
// Continue
continue;
// Set structure offset
stringPackages[i].structureOffset = strings.size();
// Set index
index = stringPackages[i].header.offset + 22;
// Go through strings
for (uint32_t j = 0; j < stringPackages[i].numberOfStrings; j++) {
// Fill string
for (uint32_t k = stringPackages[i].header.offset + static_cast<uint32_t>(static_cast<unsigned char>(buffer[index]) + (static_cast<unsigned char>(buffer[index + 1]) << 8) + (static_cast<unsigned char>(buffer[index + 2]) << 16) + (static_cast<unsigned char>(buffer[index + 3]) << 24)); buffer[k] != '\x00'; k += 2)
temp.push_back(buffer[k]);
// Add string to list
strings.push_back(temp);
// Clear temp
temp.clear();
// Increment index
index += 4;
}
}
// Go through strings
for (unsigned int i = 0; i < strings.size(); i++) {
// Change carriage return characters to spaces
for (unsigned int j = 0; j < strings[i].size(); j++)
if (strings[i][j] == '\r')
strings[i][j] = ' ';
// Remove leading spaces
while (strings[i].size() > 1 && strings[i][0] == ' ')
strings[i].erase(0, 1);
// Change double spaces
for (unsigned int j = 0; strings[i].size() && j < strings[i].size() - 1; j++)
if (strings[i][j] == ' ' && strings[i][j + 1] == ' ')
strings[i].erase(j, 1);
}
}
void displayEFIStrings(const vector<string> &strings) {
// Print strings
cout << "Strings:" << endl;
// Go through strings
for (uint32_t i = 0; i < strings.size(); i++)
// Print string
cout << '\t' << dec << i << " (0x" << hex << uppercase << i << ") " << strings[i] << endl;
cout << endl;
}
void getEFIFormSets(vector<EFI_IFR_FORM_SET_PACK> &formSets, const string &buffer, const vector<EFI_IFR_STRING_PACK> &stringPackages, const vector<string> &strings) {
// Initialize variables
EFI_IFR_FORM_SET_PACK tempFormSet;
vector<uint32_t> stringCandidates;
uint32_t chosenCandidate;
// Go through string packages
for (unsigned int i = 0; i < stringPackages.size(); i++) {
// Check if language isn't english
if (stringPackages[i].language != "eng")
// Continue
continue;
// Get string candidate
stringCandidates.push_back(i);
}
// Go through buffer
for (uint32_t i = 0; i < buffer.size() - 5; i++)
// Check if form set was found
if ((buffer[i] != '\x00' || buffer[i + 1] != '\x00' || buffer[i + 2] != '\x00' || buffer[i + 3] != '\x00') && buffer[i + 4] == '\x03' && buffer[i + 5] == '\x00' && i + static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24) < buffer.size() && buffer[i + static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24) - 1] == '\x02' && buffer[i + static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24) - 2] == '\x0D') {
// Get chosen candidate for form set's string package
chosenCandidate = stringCandidates[0];
for (unsigned int j = 1; j < stringCandidates.size(); j++)
if (abs(static_cast<signed>(stringPackages[j].header.offset - i)) < abs(static_cast<signed>(stringPackages[chosenCandidate].header.offset - i)))
chosenCandidate = j;
// Set temp form set
tempFormSet.header.offset = i;
tempFormSet.header.length = static_cast<uint32_t>(static_cast<unsigned char>(buffer[i]) + (static_cast<unsigned char>(buffer[i + 1]) << 8) + (static_cast<unsigned char>(buffer[i + 2]) << 16) + (static_cast<unsigned char>(buffer[i + 3]) << 24));
tempFormSet.header.type = static_cast<uint16_t>(static_cast<unsigned char>(buffer[i + 4]) + (static_cast<unsigned char>(buffer[i + 5]) << 8));
tempFormSet.titleString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[i + 24]) + (static_cast<unsigned char>(buffer[i + 25]) << 8));
tempFormSet.usingStringPackage = stringCandidates[chosenCandidate];
tempFormSet.title = strings[tempFormSet.titleString + stringPackages[tempFormSet.usingStringPackage].structureOffset];
// Add temp form set to list
formSets.push_back(tempFormSet);
}
}
void displayEFIFormSets(const vector<EFI_IFR_FORM_SET_PACK> &formSets) {
// Print form sets information
cout << "Form Sets Information:" << endl;
// Go through form sets
for (uint32_t i = 0; i < formSets.size(); i++) {
// Print form set information
cout << "\tForm Set " << i << " Information:" << endl;
cout << "\t\tOffset: " << dec << formSets[i].header.offset << hex << uppercase << " (0x" << formSets[i].header.offset << ')' << endl;
cout << "\t\tLength: " << dec << formSets[i].header.length << hex << uppercase << " (0x" << formSets[i].header.length << ')' << endl;
cout << "\t\tTitle ID: " << dec << formSets[i].titleString << hex << uppercase << " (0x" << formSets[i].titleString << ')' << endl;
cout << "\t\tTitle: " << formSets[i].title << endl;
}
cout << endl;
}
void generateEFIIFRDump(const string &outputFile, const vector<EFI_IFR_STRING_PACK> &stringPackages, const vector<EFI_IFR_FORM_SET_PACK> &formSets, const string &buffer, const vector<string> &strings) {
// Initialize variables
uint8_t numberOfTabs = 0;
uint8_t numberOfIfs = 0;
unsigned char highNibble, lowNibble;
ofstream fout(outputFile.c_str());
// Display protocol
for (uint8_t i = 0; i < 32; i++)
fout << ' ';
fout << "EFI Protocol Detected" << endl;
for (uint8_t i = 0; i < 80; i++)
fout << '-';
fout << endl << endl << endl;
// Display string packages info
for (uint8_t i = 0; i < 32; i++)
fout << ' ';
fout << "String Packages" << endl;
for (uint8_t i = 0; i < 80; i++)
fout << '-';
fout << endl;
fout << "Offset:\t\tLanguage:" << endl;
for (uint8_t i = 0; i < 80; i++)
fout << '-';
fout << endl;
for (uint8_t i = 0; i < stringPackages.size(); i++) {
fout << "0x" << hex << uppercase << stringPackages[i].header.offset;
fout << "\t\t" << stringPackages[i].language << " (0x" << hex << uppercase << static_cast<unsigned int>(i) << ')' << endl;
}
fout << endl << endl;
// Display form sets info
for (uint8_t i = 0; i < 35; i++)
fout << ' ';
fout << "Form Sets" << endl;
for (uint8_t i = 0; i < 80; i++)
fout << '-';
fout << endl;
fout << "Offset:\t\tTitle:" << endl;
for (uint8_t i = 0; i < 80; i++)
fout << '-';
fout << endl;
for (uint8_t i = 0; i < formSets.size(); i++) {
fout << "0x" << hex << uppercase << formSets[i].header.offset;
fout << "\t\t" << formSets[i].title << " (0x" << hex << uppercase << formSets[i].titleString << " from string package 0x" << formSets[i].usingStringPackage << ')' << endl;
}
fout << endl << endl;
// Display internal forms representation
for (uint8_t i = 0; i < 25; i++)
fout << ' ';
fout << "Internal Forms Representation" << endl;
for (uint8_t i = 0; i < 80; i++)
fout << '-';
fout << endl;
fout << "Offset:\t\tInstruction:" << endl;
for (uint8_t i = 0; i < 80; i++)
fout << '-';
fout << endl;
// Go through form sets
for (uint32_t i = 0; i < formSets.size(); i++)
// Go through all the form set's operations
for (uint32_t j = formSets[i].header.offset + 6; j < formSets[i].header.offset + formSets[i].header.length; j += static_cast<unsigned char>(buffer[j + 1])) {
// Check if opcode is EFI_IFR_FORM_OP 0x01
if (buffer[j] == EFI_IFR_FORM_OP) {
// Create temp
EFI_IFR_FORM temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.formId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.titleString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 4]) + (static_cast<unsigned char>(buffer[j + 5]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Form: " << strings[temp.titleString + stringPackages[formSets[i].usingStringPackage].structureOffset] << ", Form ID: 0x" << hex << uppercase << temp.formId;
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_SUBTITLE_OP 0x02
else if (buffer[j] == EFI_IFR_SUBTITLE_OP) {
// Create temp
EFI_IFR_SUBTITLE temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.subtitleString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Subtitle: " << strings[temp.subtitleString + stringPackages[formSets[i].usingStringPackage].structureOffset];
}
// Otherwise check if opcode is EFI_IFR_TEXT_OP 0x03
else if (buffer[j] == EFI_IFR_TEXT_OP) {
// Create temp
EFI_IFR_TEXT temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.helpString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.primaryTextString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 4]) + (static_cast<unsigned char>(buffer[j + 5]) << 8));
temp.secondaryTextString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 6]) + (static_cast<unsigned char>(buffer[j + 7]) << 8));
temp.flags = static_cast<unsigned char>(buffer[j + 8]);
temp.key = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 9]) + (static_cast<unsigned char>(buffer[j + 10]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Text: " << strings[temp.primaryTextString + stringPackages[formSets[i].usingStringPackage].structureOffset];
}
// Otherwise chec if opcode is EFI_IFR_GRAPHIC_OP 0x04
else if (buffer[j] == EFI_IFR_GRAPHIC_OP) {
// Display offset
fout << "0x" << hex << uppercase << j << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Graphic:";
}
// Otherwise check if opcode is EFI_IFR_ONE_OF_OP 0x05
else if (buffer[j] == EFI_IFR_ONE_OF_OP) {
// Create temp
EFI_IFR_ONE_OF temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.questionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.width = static_cast<unsigned char>(buffer[j + 4]);
temp.promptString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 5]) + (static_cast<unsigned char>(buffer[j + 6]) << 8));
temp.helpString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 7]) + (static_cast<unsigned char>(buffer[j + 8]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Setting: " << strings[temp.promptString + stringPackages[formSets[i].usingStringPackage].structureOffset] << ", Variable: 0x" << hex << uppercase << temp.questionId << '[' << dec << static_cast<unsigned int>(temp.width) << ']';
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_CHECKBOX_OP 0x06
else if (buffer[j] == EFI_IFR_CHECKBOX_OP) {
// Create temp
EFI_IFR_CHECKBOX temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.questionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.width = static_cast<unsigned char>(buffer[j + 4]);
temp.promptString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 5]) + (static_cast<unsigned char>(buffer[j + 6]) << 8));
temp.helpString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 7]) + (static_cast<unsigned char>(buffer[j + 8]) << 8));
temp.flags = static_cast<unsigned char>(buffer[j + 9]);
temp.key = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 10]) + (static_cast<unsigned char>(buffer[j + 11]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Checkbox: " << strings[temp.promptString + stringPackages[formSets[i].usingStringPackage].structureOffset] << ", Variable: 0x" << hex << uppercase << temp.questionId << '[' << dec << static_cast<unsigned int>(temp.width) << ']';
}
// Otherwise check if opcode is EFI_IFR_NUMERIC_OP 0x07
else if (buffer[j] == EFI_IFR_NUMERIC_OP) {
// Create temp
EFI_IFR_NUMERIC temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.questionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.width = static_cast<unsigned char>(buffer[j + 4]);
temp.promptString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 5]) + (static_cast<unsigned char>(buffer[j + 6]) << 8));
temp.helpString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 7]) + (static_cast<unsigned char>(buffer[j + 8]) << 8));
temp.flags = static_cast<unsigned char>(buffer[j + 9]);
temp.key = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 10]) + (static_cast<unsigned char>(buffer[j + 11]) << 8));
temp.maximum = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 12]) + (static_cast<unsigned char>(buffer[j + 13]) << 8));
temp.minimum = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 14]) + (static_cast<unsigned char>(buffer[j + 15]) << 8));
temp.step = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 16]) + (static_cast<unsigned char>(buffer[j + 17]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Numeric: " << strings[temp.promptString + stringPackages[formSets[i].usingStringPackage].structureOffset] << " (" << dec << temp.minimum << '-' << temp.maximum << "), Variable: 0x" << hex << uppercase << temp.questionId << '[' << dec << static_cast<unsigned int>(temp.width) << ']';
}
// Otherwise check if opcode is EFI_IFR_PASSWORD_OP 0x08
else if (buffer[j] == EFI_IFR_PASSWORD_OP) {
// Create temp
EFI_IFR_PASSWORD temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.questionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.width = static_cast<unsigned char>(buffer[j + 4]);
temp.promptString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 5]) + (static_cast<unsigned char>(buffer[j + 6]) << 8));
temp.helpString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 7]) + (static_cast<unsigned char>(buffer[j + 8]) << 8));
temp.flags = static_cast<unsigned char>(buffer[j + 9]);
temp.key = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 10]) + (static_cast<unsigned char>(buffer[j + 11]) << 8));
temp.minimumSize = static_cast<unsigned char>(buffer[j + 12]);
temp.maximumSize = static_cast<unsigned char>(buffer[j + 13]);
temp.encoding = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 14]) + (static_cast<unsigned char>(buffer[j + 15]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Password: " << strings[temp.promptString + stringPackages[formSets[i].usingStringPackage].structureOffset] << ", Variable: 0x" << hex << uppercase << temp.questionId << '[' << dec << static_cast<unsigned int>(temp.width) << ']';
}
// Otherwise check if opcode is EFI_IFR_ONE_OF_OPTION_OP 0x09
else if (buffer[j] == EFI_IFR_ONE_OF_OPTION_OP) {
// Create temp
EFI_IFR_ONE_OF_OPTION temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.optionString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.value = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 4]) + (static_cast<unsigned char>(buffer[j + 5]) << 8));
temp.flags = static_cast<unsigned char>(buffer[j + 6]);
temp.key = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 7]) + (static_cast<unsigned char>(buffer[j + 8]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Option: " << strings[temp.optionString + stringPackages[formSets[i].usingStringPackage].structureOffset] << ", Value: 0x" << hex << uppercase << temp.value;
}
// Otherwise check if opcode is EFI_IFR_SUPPRESS_IF_OP 0x0A
else if (buffer[j] == EFI_IFR_SUPPRESS_IF_OP) {
// Create temp
EFI_IFR_SUPPRESS temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.flags = static_cast<unsigned char>(buffer[j + 2]);
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Suppress If:";
// Increment number of ifs
numberOfIfs++;
}
// Otherwise check if opcode is EFI_IFR_END_FORM_OP 0x0B
else if (buffer[j] == EFI_IFR_END_FORM_OP) {
// Create temp
EFI_IFR_END_FORM temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
// Decrement number of tabs
numberOfTabs--;
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "End Form";
}
// Otherwise check if opcode is EFI_IFR_HIDDEN_OP 0x0C
else if (buffer[j] == EFI_IFR_HIDDEN_OP) {
// Create temp
EFI_IFR_HIDDEN temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.value = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.key = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 4]) + (static_cast<unsigned char>(buffer[j + 5]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Hidden:";
}
// Otherwise check if opcode is EFI_IFR_END_FORM_SET_OP 0x0D
else if (buffer[j] == EFI_IFR_END_FORM_SET_OP) {
// Create temp
EFI_IFR_END_FORM_SET temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
// Decrement number of tabs
numberOfTabs--;
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "End Form Set";
}
// Otherwise check if opcode is EFI_IFR_FORM_SET_OP 0x0E
else if (buffer[j] == EFI_IFR_FORM_SET_OP) {
// Create temp
EFI_IFR_FORM_SET temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
for (uint32_t k = j + 2; k < j + 6; k++) {
highNibble = ((buffer[k] >> 4) & 0x0F) + '0';
lowNibble = (buffer[k] & 0x0F) + '0';
if (highNibble > 0x39 && highNibble < 0x41)
highNibble += 0x07;
if (lowNibble > 0x39 && lowNibble < 0x41)
lowNibble += 0x07;
temp.guid.insert(0, 1, lowNibble);
temp.guid.insert(0, 1, highNibble);
}
temp.guid.push_back('-');
for (uint32_t k = j + 6; k < j + 8; k++) {
highNibble = ((buffer[k] >> 4) & 0x0F) + '0';
lowNibble = (buffer[k] & 0x0F) + '0';
if (highNibble > 0x39 && highNibble < 0x41)
highNibble += 0x07;
if (lowNibble > 0x39 && lowNibble < 0x41)
lowNibble += 0x07;
temp.guid.insert(9, 1, lowNibble);
temp.guid.insert(9, 1, highNibble);
}
temp.guid.push_back('-');
for (uint32_t k = j + 8; k < j + 10; k++) {
highNibble = ((buffer[k] >> 4) & 0x0F) + '0';
lowNibble = (buffer[k] & 0x0F) + '0';
if (highNibble > 0x39 && highNibble < 0x41)
highNibble += 0x07;
if (lowNibble > 0x39 && lowNibble < 0x41)
lowNibble += 0x07;
temp.guid.insert(14, 1, lowNibble);
temp.guid.insert(14, 1, highNibble);
}
temp.guid.push_back('-');
for (uint32_t k = j + 10; k < j + 12; k++) {
highNibble = ((buffer[k] >> 4) & 0x0F) + '0';
lowNibble = (buffer[k] & 0x0F) + '0';
if (highNibble > 0x39 && highNibble < 0x41)
highNibble += 0x07;
if (lowNibble > 0x39 && lowNibble < 0x41)
lowNibble += 0x07;
temp.guid.push_back(highNibble);
temp.guid.push_back(lowNibble);
}
temp.guid.push_back('-');
for (uint32_t k = j + 12; k < j + 18; k++) {
highNibble = ((buffer[k] >> 4) & 0x0F) + '0';
lowNibble = (buffer[k] & 0x0F) + '0';
if (highNibble > 0x39 && highNibble < 0x41)
highNibble += 0x07;
if (lowNibble > 0x39 && lowNibble < 0x41)
lowNibble += 0x07;
temp.guid.push_back(highNibble);
temp.guid.push_back(lowNibble);
}
temp.titleString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 18]) + (static_cast<unsigned char>(buffer[j + 19]) << 8));
temp.helpString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 20]) + (static_cast<unsigned char>(buffer[j + 21]) << 8));
temp.callbackHandle = static_cast<uint64_t>(static_cast<unsigned char>(buffer[j + 22]) + (static_cast<unsigned char>(buffer[j + 23]) << 8) + (static_cast<unsigned char>(buffer[j + 24]) << 16) + (static_cast<unsigned char>(buffer[j + 25]) << 24) + (static_cast<uint64_t>(static_cast<unsigned char>(buffer[j + 26])) << 32) + (static_cast<uint64_t>(static_cast<unsigned char>(buffer[j + 27])) << 40) + (static_cast<uint64_t>(static_cast<unsigned char>(buffer[j + 28])) << 48) + (static_cast<uint64_t>(static_cast<unsigned char>(buffer[j + 29])) << 56));
temp.mainClass = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 30]) + (static_cast<unsigned char>(buffer[j + 31]) << 8));
temp.subClass = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 32]) + (static_cast<unsigned char>(buffer[j + 33]) << 8));
temp.nvDataSize = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 34]) + (static_cast<unsigned char>(buffer[j + 25]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Form Set: " << strings[temp.titleString + stringPackages[formSets[i].usingStringPackage].structureOffset];
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_REF_OP 0x0F
else if (buffer[j] == EFI_IFR_REF_OP) {
// Create temp
EFI_IFR_REF temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.formId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.promptString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 4]) + (static_cast<unsigned char>(buffer[j + 5]) << 8));
temp.helpString = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 6]) + (static_cast<unsigned char>(buffer[j + 7]) << 8));
temp.flags = static_cast<uint8_t>(static_cast<unsigned char>(buffer[j + 8]));
temp.key = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 9]) + (static_cast<unsigned char>(buffer[j + 10]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Selectable: " << strings[temp.promptString + stringPackages[formSets[i].usingStringPackage].structureOffset] << ", Form ID: 0x" << hex << uppercase << temp.formId;
}
// Otherwise check if opcode is EFI_IFR_END_OP 0x10
else if (buffer[j] == EFI_IFR_END_ONE_OF_OP) {
// Create temp
EFI_IFR_END_ONE_OF temp;
// Fill end one of
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
// Decrement number of tabs
numberOfTabs--;
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "End of Options";
}
// Otherwise check if opcode is EFI_IFR_INCONSISTENT_IF_OP 0x11
else if (buffer[j] == EFI_IFR_INCONSISTENT_IF_OP) {
// Create temp
EFI_IFR_INCONSISTENT temp;
// Fill inconsistent
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.popup = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.flags = static_cast<uint8_t>(buffer[j + 4]);
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display inconsistent
fout << "Inconsistent If:";
// Increment number of ifs
numberOfIfs++;
}
// Otherwise check if opcode is EFI_IFR_EQ_ID_VAL_OP 0x12
else if (buffer[j] == EFI_IFR_EQ_ID_VAL_OP) {
// Create temp
EFI_IFR_EQ_ID_VAL temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.questionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.width = static_cast<unsigned char>(buffer[j + 4]);
temp.value = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 5]) + (static_cast<unsigned char>(buffer[j + 6]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Variable 0x" << hex << uppercase << temp.questionId << '[' << dec << static_cast<unsigned int>(temp.width) << ']' << " equals 0x" << hex << uppercase << temp.value;
// Check if there isn't a following conditional statement
if (endEFICondition(buffer, j))
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_EQ_ID_ID_OP 0x13
else if (buffer[j] == EFI_IFR_EQ_ID_ID_OP) {
// Create temp
EFI_IFR_EQ_ID_ID temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.primaryQuestionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.width = static_cast<unsigned char>(buffer[j + 4]);
temp.secondaryQuestionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 5]) + (static_cast<unsigned char>(buffer[j + 6]) << 8));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Variable 0x" << hex << uppercase << temp.primaryQuestionId << '[' << dec << static_cast<unsigned int>(temp.width) << ']' << " equals variable 0x" << hex << uppercase << temp.secondaryQuestionId;
// Check if there isn't a following conditional statement
if (endEFICondition(buffer, j))
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_EQ_ID_LIST_OP 0x14
else if (buffer[j] == EFI_IFR_EQ_ID_LIST_OP) {
// Create temp
EFI_IFR_EQ_ID_LIST temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.questionId = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 2]) + (static_cast<unsigned char>(buffer[j + 3]) << 8));
temp.width = static_cast<unsigned char>(buffer[j + 4]);
temp.listLength = static_cast<uint16_t>(static_cast<unsigned char>(buffer[j + 5]) + (static_cast<unsigned char>(buffer[j + 6]) << 8));
// Create list
uint32_t index = j + 7;
for (uint8_t k = 0; k < temp.listLength; k++, index += 2)
temp.valueList.push_back(static_cast<uint16_t>(static_cast<unsigned char>(buffer[index]) + (static_cast<unsigned char>(buffer[index + 1]) << 8)));
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Variable 0x" << hex << uppercase << temp.questionId << '[' << dec << static_cast<unsigned int>(temp.width) << ']' << " equals value in list (";
for (uint8_t k = 0; k < temp.listLength; k++) {
fout << "0x" << hex << uppercase << temp.valueList[k];
if (k != temp.listLength - 1)
fout << ", ";
else
fout << ')';
}
// Check if there isn't a following conditional statement
if (endEFICondition(buffer, j))
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_AND_OP 0x15
else if (buffer[j] == EFI_IFR_AND_OP) {
// Create temp
EFI_IFR_AND temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "And";
// Check if there isn't a following conditional statement
if (endEFICondition(buffer, j))
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_OR_OP 0x16
else if (buffer[j] == EFI_IFR_OR_OP) {
// Create temp
EFI_IFR_OR temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Or";
// Check if there isn't a following conditional statement
if (endEFICondition(buffer, j))
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_NOT_OP 0x17
else if (buffer[j] == EFI_IFR_NOT_OP) {
// Create temp
EFI_IFR_NOT temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t k = 0; k < numberOfTabs; k++)
fout << '\t';
// Display temp
fout << "Not";
// Check if there isn't a following conditional statement
if (endEFICondition(buffer, j))
// Increment number of tabs
numberOfTabs++;
}
// Otherwise check if opcode is EFI_IFR_END_IF_OP 0x18
else if (buffer[j] == EFI_IFR_END_IF_OP) {
// Create temp
EFI_IFR_END_IF temp;
// Fill temp
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
// Go through ifs
for (uint8_t k = 0; k < numberOfIfs; k++) {
// Decrement number of tabs
numberOfTabs--;
// Display offset
fout << "0x" << hex << uppercase << temp.header.offset << ' ';
// Display tabs
for (uint8_t l = 0; l < numberOfTabs; l++)
fout << '\t';
// Display temp
fout << "End If";
}
// Clear number of ifs
numberOfIfs = 0;
}
// Otherwise check if opcode is EFI_IFR_GRAYOUT_IF_OP 0x19
else if (buffer[j] == EFI_IFR_GRAYOUT_IF_OP) {
// Create temp
EFI_IFR_GRAYOUT temp;
// Fill grayout
temp.header.offset = j;
temp.header.opcode = buffer[j];
temp.header.length = static_cast<unsigned char>(buffer[j + 1]);
temp.flags = static_cast<unsigned char>(buffer[j + 2]);