| 1 |
//! Shell Protocol |
| 2 |
//! |
| 3 |
//! Provides shell services to UEFI applications. |
| 4 |
|
| 5 |
pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields( |
| 6 |
0x6302d008, |
| 7 |
0x7f9b, |
| 8 |
0x4f30, |
| 9 |
0x87, |
| 10 |
0xac, |
| 11 |
&[0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e], |
| 12 |
); |
| 13 |
|
| 14 |
pub const MAJOR_VERSION: u32 = 0x00000002; |
| 15 |
pub const MINOR_VERSION: u32 = 0x00000002; |
| 16 |
|
| 17 |
pub type FileHandle = *mut core::ffi::c_void; |
| 18 |
|
| 19 |
pub type DeviceNameFlags = u32; |
| 20 |
pub const DEVICE_NAME_USE_COMPONENT_NAME: DeviceNameFlags = 0x00000001; |
| 21 |
pub const DEVICE_NAME_USE_DEVICE_PATH: DeviceNameFlags = 0x00000002; |
| 22 |
|
| 23 |
#[repr(C)] |
| 24 |
pub struct ListEntry { |
| 25 |
pub flink: *mut ListEntry, |
| 26 |
pub blink: *mut ListEntry, |
| 27 |
} |
| 28 |
|
| 29 |
#[repr(C)] |
| 30 |
pub struct FileInfo { |
| 31 |
pub link: ListEntry, |
| 32 |
pub status: crate::base::Status, |
| 33 |
pub full_name: *mut crate::base::Char16, |
| 34 |
pub file_name: *mut crate::base::Char16, |
| 35 |
pub handle: FileHandle, |
| 36 |
pub info: *mut crate::protocols::file::Info, |
| 37 |
} |
| 38 |
|
| 39 |
pub type Execute = eficall! {fn( |
| 40 |
*mut crate::base::Handle, |
| 41 |
*mut crate::base::Char16, |
| 42 |
*mut *mut crate::base::Char16, |
| 43 |
*mut crate::base::Status, |
| 44 |
) -> crate::base::Status}; |
| 45 |
|
| 46 |
pub type GetEnv = eficall! {fn( |
| 47 |
*mut crate::base::Char16, |
| 48 |
) -> *mut crate::base::Char16}; |
| 49 |
|
| 50 |
pub type SetEnv = eficall! {fn( |
| 51 |
*mut crate::base::Char16, |
| 52 |
*mut crate::base::Char16, |
| 53 |
crate::base::Boolean, |
| 54 |
) -> crate::base::Status}; |
| 55 |
|
| 56 |
pub type GetAlias = eficall! {fn( |
| 57 |
*mut crate::base::Char16, |
| 58 |
*mut crate::base::Boolean, |
| 59 |
) -> *mut crate::base::Char16}; |
| 60 |
|
| 61 |
pub type SetAlias = eficall! {fn( |
| 62 |
*mut crate::base::Char16, |
| 63 |
*mut crate::base::Char16, |
| 64 |
crate::base::Boolean, |
| 65 |
crate::base::Boolean, |
| 66 |
) -> crate::base::Status}; |
| 67 |
|
| 68 |
pub type GetHelpText = eficall! {fn( |
| 69 |
*mut crate::base::Char16, |
| 70 |
*mut crate::base::Char16, |
| 71 |
*mut *mut crate::base::Char16, |
| 72 |
) -> crate::base::Status}; |
| 73 |
|
| 74 |
pub type GetDevicePathFromMap = eficall! {fn( |
| 75 |
*mut crate::base::Char16, |
| 76 |
) -> *mut crate::protocols::device_path::Protocol}; |
| 77 |
|
| 78 |
pub type GetMapFromDevicePath = eficall! {fn( |
| 79 |
*mut *mut crate::protocols::device_path::Protocol, |
| 80 |
) -> *mut crate::base::Char16}; |
| 81 |
|
| 82 |
pub type GetDevicePathFromFilePath = eficall! {fn( |
| 83 |
*mut crate::base::Char16, |
| 84 |
) -> *mut crate::protocols::device_path::Protocol}; |
| 85 |
|
| 86 |
pub type GetFilePathFromDevicePath = eficall! {fn( |
| 87 |
*mut crate::protocols::device_path::Protocol, |
| 88 |
) -> *mut crate::base::Char16}; |
| 89 |
|
| 90 |
pub type SetMap = eficall! {fn( |
| 91 |
*mut crate::protocols::device_path::Protocol, |
| 92 |
*mut crate::base::Char16, |
| 93 |
) -> crate::base::Status}; |
| 94 |
|
| 95 |
pub type GetCurDir = eficall! {fn( |
| 96 |
*mut crate::base::Char16, |
| 97 |
) -> *mut crate::base::Char16}; |
| 98 |
|
| 99 |
pub type SetCurDir = eficall! {fn( |
| 100 |
*mut crate::base::Char16, |
| 101 |
*mut crate::base::Char16, |
| 102 |
) -> crate::base::Status}; |
| 103 |
|
| 104 |
pub type OpenFileList = eficall! {fn( |
| 105 |
*mut crate::base::Char16, |
| 106 |
u64, |
| 107 |
*mut *mut FileInfo, |
| 108 |
) -> crate::base::Status}; |
| 109 |
|
| 110 |
pub type FreeFileList = eficall! {fn( |
| 111 |
*mut *mut FileInfo, |
| 112 |
) -> crate::base::Status}; |
| 113 |
|
| 114 |
pub type RemoveDupInFileList = eficall! {fn( |
| 115 |
*mut *mut FileInfo, |
| 116 |
) -> crate::base::Status}; |
| 117 |
|
| 118 |
pub type BatchIsActive = eficall! {fn() -> crate::base::Boolean}; |
| 119 |
|
| 120 |
pub type IsRootShell = eficall! {fn() -> crate::base::Boolean}; |
| 121 |
|
| 122 |
pub type EnablePageBreak = eficall! {fn()}; |
| 123 |
|
| 124 |
pub type DisablePageBreak = eficall! {fn()}; |
| 125 |
|
| 126 |
pub type GetPageBreak = eficall! {fn() -> crate::base::Boolean}; |
| 127 |
|
| 128 |
pub type GetDeviceName = eficall! {fn( |
| 129 |
crate::base::Handle, |
| 130 |
DeviceNameFlags, |
| 131 |
*mut crate::base::Char8, |
| 132 |
*mut *mut crate::base::Char16, |
| 133 |
) -> crate::base::Status}; |
| 134 |
|
| 135 |
pub type GetFileInfo = eficall! {fn( |
| 136 |
FileHandle, |
| 137 |
) -> *mut crate::protocols::file::Info}; |
| 138 |
|
| 139 |
pub type SetFileInfo = eficall! {fn( |
| 140 |
FileHandle, |
| 141 |
*mut crate::protocols::file::Info |
| 142 |
) -> crate::base::Status}; |
| 143 |
|
| 144 |
pub type OpenFileByName = eficall! {fn( |
| 145 |
*mut crate::base::Char16, |
| 146 |
*mut FileHandle, |
| 147 |
u64, |
| 148 |
) -> crate::base::Status}; |
| 149 |
|
| 150 |
pub type CloseFile = eficall! {fn( |
| 151 |
FileHandle, |
| 152 |
) -> crate::base::Status}; |
| 153 |
|
| 154 |
pub type CreateFile = eficall! {fn( |
| 155 |
*mut crate::base::Char16, |
| 156 |
u64, |
| 157 |
*mut FileHandle, |
| 158 |
) -> crate::base::Status}; |
| 159 |
|
| 160 |
pub type ReadFile = eficall! {fn( |
| 161 |
FileHandle, |
| 162 |
*mut usize, |
| 163 |
*mut core::ffi::c_void, |
| 164 |
) -> crate::base::Status}; |
| 165 |
|
| 166 |
pub type WriteFile = eficall! {fn( |
| 167 |
FileHandle, |
| 168 |
*mut usize, |
| 169 |
*mut core::ffi::c_void, |
| 170 |
) -> crate::base::Status}; |
| 171 |
|
| 172 |
pub type DeleteFile = eficall! {fn( |
| 173 |
FileHandle, |
| 174 |
) -> crate::base::Status}; |
| 175 |
|
| 176 |
pub type DeleteFileByName = eficall! {fn( |
| 177 |
*mut crate::base::Char16, |
| 178 |
) -> crate::base::Status}; |
| 179 |
|
| 180 |
pub type GetFilePosition = eficall! {fn( |
| 181 |
FileHandle, |
| 182 |
*mut u64, |
| 183 |
) -> crate::base::Status}; |
| 184 |
|
| 185 |
pub type SetFilePosition = eficall! {fn( |
| 186 |
FileHandle, |
| 187 |
u64, |
| 188 |
) -> crate::base::Status}; |
| 189 |
|
| 190 |
pub type FlushFile = eficall! {fn( |
| 191 |
FileHandle, |
| 192 |
) -> crate::base::Status}; |
| 193 |
|
| 194 |
pub type FindFiles = eficall! {fn( |
| 195 |
*mut crate::base::Char16, |
| 196 |
*mut *mut FileInfo, |
| 197 |
) -> crate::base::Status}; |
| 198 |
|
| 199 |
pub type FindFilesInDir = eficall! {fn( |
| 200 |
FileHandle, |
| 201 |
*mut *mut FileInfo, |
| 202 |
) -> crate::base::Status}; |
| 203 |
|
| 204 |
pub type GetFileSize = eficall! {fn( |
| 205 |
FileHandle, |
| 206 |
*mut u64, |
| 207 |
) -> crate::base::Status}; |
| 208 |
|
| 209 |
pub type OpenRoot = eficall! {fn( |
| 210 |
*mut crate::protocols::device_path::Protocol, |
| 211 |
*mut FileHandle, |
| 212 |
) -> crate::base::Status}; |
| 213 |
|
| 214 |
pub type OpenRootByHandle = eficall! {fn( |
| 215 |
crate::base::Handle, |
| 216 |
*mut FileHandle, |
| 217 |
) -> crate::base::Status}; |
| 218 |
|
| 219 |
pub type RegisterGuidName = eficall! {fn( |
| 220 |
*mut crate::base::Guid, |
| 221 |
*mut crate::base::Char16, |
| 222 |
) -> crate::base::Status}; |
| 223 |
|
| 224 |
pub type GetGuidName = eficall! {fn( |
| 225 |
*mut crate::base::Guid, |
| 226 |
*mut *mut crate::base::Char16, |
| 227 |
) -> crate::base::Status}; |
| 228 |
|
| 229 |
pub type GetGuidFromName = eficall! {fn( |
| 230 |
*mut crate::base::Char16, |
| 231 |
*mut crate::base::Guid, |
| 232 |
) -> crate::base::Status}; |
| 233 |
|
| 234 |
pub type GetEnvEx = eficall! {fn( |
| 235 |
*mut crate::base::Char16, |
| 236 |
*mut u32, |
| 237 |
) -> *mut crate::base::Char16}; |
| 238 |
|
| 239 |
#[repr(C)] |
| 240 |
pub struct Protocol { |
| 241 |
pub execute: Execute, |
| 242 |
pub get_env: GetEnv, |
| 243 |
pub set_env: SetEnv, |
| 244 |
pub get_alias: GetAlias, |
| 245 |
pub set_alias: SetAlias, |
| 246 |
pub get_help_text: GetHelpText, |
| 247 |
pub get_device_path_from_map: GetDevicePathFromMap, |
| 248 |
pub get_map_from_device_path: GetMapFromDevicePath, |
| 249 |
pub get_device_path_from_file_path: GetDevicePathFromFilePath, |
| 250 |
pub get_file_path_from_device_path: GetFilePathFromDevicePath, |
| 251 |
pub set_map: SetMap, |
| 252 |
|
| 253 |
pub get_cur_dir: GetCurDir, |
| 254 |
pub set_cur_dir: SetCurDir, |
| 255 |
pub open_file_list: OpenFileList, |
| 256 |
pub free_file_list: FreeFileList, |
| 257 |
pub remove_dup_in_file_list: RemoveDupInFileList, |
| 258 |
|
| 259 |
pub batch_is_active: BatchIsActive, |
| 260 |
pub is_root_shell: IsRootShell, |
| 261 |
pub enable_page_break: EnablePageBreak, |
| 262 |
pub disable_page_break: DisablePageBreak, |
| 263 |
pub get_page_break: GetPageBreak, |
| 264 |
pub get_device_name: GetDeviceName, |
| 265 |
|
| 266 |
pub get_file_info: GetFileInfo, |
| 267 |
pub set_file_info: SetFileInfo, |
| 268 |
pub open_file_by_name: OpenFileByName, |
| 269 |
pub close_file: CloseFile, |
| 270 |
pub create_file: CreateFile, |
| 271 |
pub read_file: ReadFile, |
| 272 |
pub write_file: WriteFile, |
| 273 |
pub delete_file: DeleteFile, |
| 274 |
pub delete_file_by_name: DeleteFileByName, |
| 275 |
pub get_file_position: GetFilePosition, |
| 276 |
pub set_file_position: SetFilePosition, |
| 277 |
pub flush_file: FlushFile, |
| 278 |
pub find_files: FindFiles, |
| 279 |
pub find_files_in_dir: FindFilesInDir, |
| 280 |
pub get_file_size: GetFileSize, |
| 281 |
|
| 282 |
pub open_root: OpenRoot, |
| 283 |
pub open_root_by_handle: OpenRootByHandle, |
| 284 |
|
| 285 |
pub execution_break: crate::base::Event, |
| 286 |
|
| 287 |
pub major_version: u32, |
| 288 |
pub minor_version: u32, |
| 289 |
pub register_guid_name: RegisterGuidName, |
| 290 |
pub get_guid_name: GetGuidName, |
| 291 |
pub get_guid_from_name: GetGuidFromName, |
| 292 |
|
| 293 |
// Shell 2.1 |
| 294 |
pub get_env_ex: GetEnvEx, |
| 295 |
} |