fn parse_pe_header(path: &Path) -> io::Result<u16> {
    let mut file = File::open(path)?;

    // Extract the header offset.
    let mut buffer = [0; 4];
    let start = SeekFrom::Start(0x3C);
    file.seek(start)?;
    file.read_exact(&mut buffer)?;
    let offset = i32::from_le_bytes(buffer);

    // Check the validity of the header.
    file.seek(SeekFrom::Start(offset as u64))?;
    file.read_exact(&mut buffer)?;
    if buffer != [80, 69, 0, 0] {
        return Err(Error::new(ErrorKind::InvalidData, "invalid PE header"));
    }

    // Extract the magic number.
    let mut buffer = [0; 2];
    file.seek(SeekFrom::Current(20))?;
    file.read_exact(&mut buffer)?;
    Ok(u16::from_le_bytes(buffer))
}
/// Extracts the magic number from the PE header in a shared library.

Extracts the magic number from the PE header in a shared library.
Extracts the magic number from the PE header in a shared library .
fn parse_pe_header(path: &Path) -> io::Result<u16> {
    let mut file = File::open(path)?;
    // Extract the header offset.
    let mut buffer = [0; 4];
    let start = SeekFrom::Start(0x3C);
    file.seek(start)?;
    file.read_exact(&mut buffer)?;
    let offset = i32::from_le_bytes(buffer);
    // Check the validity of the header.
    file.seek(SeekFrom::Start(offset as u64))?;
    file.read_exact(&mut buffer)?;
    if buffer != [80, 69, 0, 0] {
        return Err(Error::new(ErrorKind::InvalidData, "invalid PE header"));
    }
    // Extract the magic number.
    let mut buffer = [0; 2];
    file.seek(SeekFrom::Current(20))?;
    file.read_exact(&mut buffer)?;
    Ok(u16::from_le_bytes(buffer))
}
fn parse_pe_header ( path : & Path ) -> io :: Result < u16 > { let mut file = File :: open ( path ) ? ; // Extract the header offset.
 let mut buffer = [ 0 ; 4 ] ; let start = SeekFrom :: Start ( 0x3C ) ; file . seek ( start ) ? ; file . read_exact ( & mut buffer ) ? ; let offset = i32 :: from_le_bytes ( buffer ) ; // Check the validity of the header.
 file . seek ( SeekFrom :: Start ( offset as u64 ) ) ? ; file . read_exact ( & mut buffer ) ? ; if buffer != [ 80 , 69 , 0 , 0 ] { return Err ( Error :: new ( ErrorKind :: InvalidData , " " ) ) ; } // Extract the magic number.
 let mut buffer = [ 0 ; 2 ] ; file . seek ( SeekFrom :: Current ( 20 ) ) ? ; file . read_exact ( & mut buffer ) ? ; Ok ( u16 :: from_le_bytes ( buffer ) ) }
Extracts the magic number from the PE header in a shared library.
Extracts the magic number from the PE header in a shared library .
path
&Path