-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinfo.d
More file actions
29 lines (23 loc) · 746 Bytes
/
info.d
File metadata and controls
29 lines (23 loc) · 746 Bytes
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
import Console : Console;
import EFI : EFI, File, UserInterfaceSection, RawSection;
import EFIUtils : printEFI, printFileMapping;
import std.exception : enforce;
import std.file : read;
import std.string : format;
int main(string[] args) {
Console.Init(args, format("USAGE: %s <INPUT WPH>", args[0]));
string file = Console.GetInput!string("Please enter a filename");
auto containers = EFI.parse(file);
foreach(container; containers) {
debug printEFI(container);
printFileMapping(container);
}
//Sanity check
debug {
ubyte[] newEFI = EFI.getBinary(containers);
ubyte[] oldEFI = cast(ubyte[])read(file);
enforce(newEFI.length == oldEFI.length);
enforce(newEFI == oldEFI);
}
return 0;
}