Skip to content

Commit b3fd981

Browse files
committed
Updating uefi-raw to include the shell protocol
1 parent e84b640 commit b3fd981

File tree

4 files changed

+79
-416
lines changed

4 files changed

+79
-416
lines changed

uefi-raw/src/protocol/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub mod nvme;
2424
pub mod pci;
2525
pub mod rng;
2626
pub mod scsi;
27+
pub mod shell;
2728
pub mod shell_params;
2829
pub mod string;
2930
pub mod tcg;

uefi-raw/src/protocol/shell.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// SPDX-License-Identifier: MIT OR Apache-2.0
2+
3+
//! EFI Shell Protocol v2.2
4+
5+
use crate::{guid, Event, Guid};
6+
7+
/// Shell Protocol
8+
#[derive(Debug)]
9+
#[repr(C)]
10+
pub struct ShellProtocol {
11+
pub execute: usize,
12+
pub get_env: usize,
13+
pub set_env: usize,
14+
pub get_alias: usize,
15+
pub set_alias: usize,
16+
pub get_help_text: usize,
17+
pub get_device_path_from_map: usize,
18+
pub get_map_from_device_path: usize,
19+
pub get_device_path_from_file_path: usize,
20+
pub get_file_path_from_device_path: usize,
21+
pub set_map: usize,
22+
23+
pub get_cur_dir: usize,
24+
pub set_cur_dir: usize,
25+
pub open_file_list: usize,
26+
pub free_file_list: usize,
27+
pub remove_dup_in_file_list: usize,
28+
29+
pub batch_is_active: usize,
30+
pub is_root_shell: usize,
31+
pub enable_page_break: usize,
32+
pub disable_page_break: usize,
33+
pub get_page_break: usize,
34+
pub get_device_name: usize,
35+
36+
pub get_file_info: usize,
37+
pub set_file_info: usize,
38+
pub open_file_by_name: usize,
39+
pub close_file: usize,
40+
pub create_file: usize,
41+
pub read_file: usize,
42+
pub write_file: usize,
43+
pub delete_file: usize,
44+
pub delete_file_by_name: usize,
45+
pub get_file_position: usize,
46+
pub set_file_position: usize,
47+
pub flush_file: usize,
48+
pub find_files: usize,
49+
pub find_files_in_dir: usize,
50+
pub get_file_size: usize,
51+
52+
pub open_root: usize,
53+
pub open_root_by_handle: usize,
54+
55+
pub execution_break: Event,
56+
57+
pub major_version: u32,
58+
pub minor_version: u32,
59+
pub register_guid_name: usize,
60+
pub get_guid_name: usize,
61+
pub get_guid_from_name: usize,
62+
pub get_env_ex: usize,
63+
}
64+
65+
impl ShellProtocol {
66+
pub const GUID: Guid = guid!("6302d008-7f9b-4f30-87ac-60c9fef5da4e");
67+
}

uefi-test-runner/src/proto/shell.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1+
// SPDX-License-Identifier: MIT OR Apache-2.0
2+
13
use uefi::boot;
24
use uefi::proto::shell::Shell;
3-
use uefi::CStr16;
45

56
pub fn test() {
67
info!("Running shell protocol tests");
78

89
let handle = boot::get_handle_for_protocol::<Shell>().expect("No Shell handles");
910

10-
let mut shell =
11+
let mut _shell =
1112
boot::open_protocol_exclusive::<Shell>(handle).expect("Failed to open Shell protocol");
1213

13-
// create some files
14-
let mut test_buf = [0u16; 12];
15-
let test_str = CStr16::from_str_with_buf("test", &mut test_buf).unwrap();
16-
shell.create_file(test_str, 0);
17-
18-
// get file tree
19-
// let mut str_buf = [0u16; 12];
20-
// let str_str = CStr16::from_str_with_buf(r"fs0:\*", &mut str_buf).unwrap();
21-
// let res = shell.find_files(str_str);
22-
// let list = res.unwrap();
23-
// let list = list.unwrap();
24-
// let first = list.first();
25-
2614
info!("filetree test successful")
2715
}

0 commit comments

Comments
 (0)