Struct winparsingtools::structs::shell_items::ShellItem
source · pub struct ShellItem {
pub size: u16,
pub class_type: u8,
pub shell_item_data: Option<ShellItemTypes>,
}
Expand description
ShellItem is struct that reads the struct bytes and decide which shellitem struct to use (FileEntryShellItem, VolumeShellItem, etc).
Fields§
§size: u16
Shell item size in bytes.
class_type: u8
Shell item type (FileEntry, Volume, Root, etc)
shell_item_data: Option<ShellItemTypes>
The parsed shell item data
Implementations§
source§impl ShellItem
impl ShellItem
sourcepub fn from_buffer(buf: &[u8]) -> Result<Self, ReaderError>
pub fn from_buffer(buf: &[u8]) -> Result<Self, ReaderError>
Returns a ShellItem
from a slice.
Examples
use winparsingtools::structs::shell_items::ShellItem;
// a buffer that contains the shell item data
let shell_item_data: &[u8] = &[
0x5A, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x51, 0x79, 0x62, 0x20, 0x00, 0x74, 0x65,
0x73, 0x74, 0x2E, 0x74, 0x78, 0x74, 0x00, 0x00, 0x42, 0x00, 0x09, 0x00, 0x04, 0x00, 0xEF, 0xBE,
0x85, 0x51, 0x79, 0x62, 0x85, 0x51, 0x79, 0x62, 0x2E, 0x00, 0x00, 0x00, 0x26, 0x74, 0x02, 0x00,
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x39, 0xD2, 0x1B, 0x01, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x2E, 0x00,
0x74, 0x00, 0x78, 0x00, 0x74, 0x00, 0x00, 0x00, 0x18, 0x00
];
println!("{:?}\n",ShellItem::from_buffer(&shell_item_data).unwrap());
sourcepub fn from_reader<R: Read + Seek>(r: &mut R) -> Result<Self, ReaderError>
pub fn from_reader<R: Read + Seek>(r: &mut R) -> Result<Self, ReaderError>
Returns a ShellItem
from an instance that implements Read
and Seek
.
Examples
use winparsingtools::structs::shell_items::ShellItem;
use winparsingtools::ReaderError;
use std::fs::File;
// Open a file (std::fs::File implements `Read` and `Seek` traits) then pass it to the function
// to parse the shell item data
let mut shell_item_data = File::open("shell_item_data.bin")?;
println!("{:?}\n",ShellItem::from_reader(&mut shell_item_data).unwrap());