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

source

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());
source

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());

Trait Implementations§

source§

impl Debug for ShellItem

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Name for ShellItem

source§

fn name(&self) -> String

source§

impl Serialize for ShellItem

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.