Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "pelite"
version = "0.10.0"
version = "0.10.1"
authors = ["Casper <[email protected]>"]
edition = "2018"
edition = "2021"
license = "MIT"

description = "Lightweight, memory-safe, zero-allocation library for reading and navigating PE binaries."
Expand All @@ -25,11 +25,6 @@ derive_pod = ["dataview/derive_pod"]
std = ["no-std-compat/std"]
resources_nostd = ["hashbrown"]

[badges]
appveyor = { repository = "CasualX/pelite", branch = "master", service = "github" }
travis-ci = { repository = "CasualX/pelite", branch = "master", service = "github" }
maintenance = { status = "actively-developed" }

[profile.release]
lto = true
opt-level = 2
Expand All @@ -43,8 +38,8 @@ pelite-macros = { path = "src/proc-macros", version = "0.1.1" }
dataview = { version = "1.0", default-features = false }
serde = { version = "1.0", optional = true, features = ["derive"] }
data-encoding = { version = "2.3", optional = true }
no-std-compat = { version = "0.4.0", features = ["alloc"] }
hashbrown = { version = "0.8.0", optional = true }
no-std-compat = { version = "0.4", features = ["alloc"] }
hashbrown = { version = "0.13", optional = true }

[target.'cfg(unix)'.dependencies]
libc = { version = "0.2", optional = true }
Expand All @@ -53,6 +48,6 @@ libc = { version = "0.2", optional = true }
winapi = { version = "0.3", optional = true, features = ["fileapi", "memoryapi", "handleapi"] }

[dev-dependencies]
rand = "0.5"
rand = "0.8"
lde = "0.3"
format_xml = "0.2"
format_xml = "0.3"
2 changes: 1 addition & 1 deletion examples/csgo/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use pelite::pattern as pat;
pub fn print(client: PeFile, dll_name: &str) {
let classes = classes(client);

tprint! {
format_xml::print! {
"### ClientClasses\n\n"
for cls in (&classes) {
"<details>\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/csgo/cvars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn print(bin: PeFile, dll_name: &str) {
let cvars = convars(bin);
let cmds = concommands(bin);

tprint! {
format_xml::print! {
"### ConVars\n\n"
for cvar in (&cvars) {
"<details>\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/csgo/datamaps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use pelite::pe32::*;
pub fn print(client: PeFile) {
let datamaps = datamaps(client).unwrap();

tprint! {
format_xml::print! {
"### Datamaps\n\n"
for class in (&datamaps) {
"<details>\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/csgo/interfaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use pelite::pe32::*;
pub fn print(file: PeFile, dll_name: &str) {
let ifaces = interfaces(file);

tprint! {
format_xml::print! {
"### Interfaces\n\n"
"```\n"
for iface in (&ifaces) {
Expand Down
2 changes: 1 addition & 1 deletion examples/csgo/kbutton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use pelite::pe32::*;
pub fn print(bin: PeFile<'_>, dll_name: &str) {
let btns = buttons(bin);

tprint! {
format_xml::print! {
"### Buttons\n\n```\n"
for btn in (&btns) {
{dll_name}"!"{btn.kbutton;#010x}" kbutton_t "{btn.name}"\n"
Expand Down
6 changes: 0 additions & 6 deletions examples/csgo/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ Counter-Strike: Global Offensive
================================
*/

macro_rules! tprint {
($($tt:tt)*) => {
print!("{}", format_xml::template!{$($tt)*});
};
}

mod interfaces;
mod classes;
mod datamaps;
Expand Down
2 changes: 1 addition & 1 deletion examples/csgo/recvtables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use lde;
pub fn print(client: PeFile) {
let classes = recvtables(client).unwrap();

tprint! {
format_xml::print! {
"### Recvtables\n\n"
for cls in (&classes) {
"<details>\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/csgo/weapondata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use lde;
pub fn print(client: PeFile) {
let list = weapondata(client).unwrap();

tprint! {
format_xml::print! {
"### WeaponData\n\n"
"```\n"
"class WeaponInfo {{\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/markovbin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn generate(buckets: &[[u32; 256]; 256], count: usize) {

// Pick the next byte based on the weight for this byte
// FIXME! Use weighted reservoir sampling instead but this is more simple...
let mut pick = rng.gen_range(0, total);
let mut pick = rng.gen_range(0..total);
for i in 0..256 {
if pick < bucket[i] {
byte = i as u8;
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Due to small but incompatible differences the two formats are not unified.
*/

#![recursion_limit = "128"]
#![allow(ellipsis_inclusive_range_patterns)]
#![cfg_attr(not(feature = "std"), no_std)]
extern crate no_std_compat as std;

Expand Down
4 changes: 2 additions & 2 deletions src/pe64/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ pub(crate) fn test<'a, P: Pe<'a>>(pe: P) -> Result<()> {
for desc in imports {
let _ = format!("{:?}", desc);
let _dll_name = desc.dll_name();
for _ in desc.iat() {}
for _ in desc.int() {}
for _ in desc.iat()? {}
for _ in desc.int()? {}
}

let iat = pe.iat()?;
Expand Down
6 changes: 3 additions & 3 deletions src/proc-macros/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ fn parse_helper(pat: &mut &str, result: &mut Vec<Atom>) -> Result<(), PatError>
chr = iter.next().cloned().ok_or(PatError::ManyInvalid)?;
match chr {
b'-' | b']' => break,
chr @ b'0'...b'9' => {
chr @ b'0'..=b'9' => {
at_least_one_char = true;
lower_bound = lower_bound * 10 + (chr - b'0') as u32;
if lower_bound >= 16384 {
Expand Down Expand Up @@ -432,7 +432,7 @@ fn parse_helper(pat: &mut &str, result: &mut Vec<Atom>) -> Result<(), PatError>
chr = iter.next().cloned().ok_or(PatError::ManyInvalid)?;
match chr {
b']' => break,
chr @ b'0'...b'9' => {
chr @ b'0'..=b'9' => {
upper_bound = upper_bound * 10 + (chr - b'0') as u32;
if upper_bound >= 16384 {
return Err(PatError::ManyOverflow);
Expand All @@ -454,7 +454,7 @@ fn parse_helper(pat: &mut &str, result: &mut Vec<Atom>) -> Result<(), PatError>
}
},
// Match a byte
b'0'...b'9' | b'A'...b'F' | b'a'...b'f' => {
b'0'..=b'9' | b'A'..=b'F' | b'a'..=b'f' => {
// High nibble of the byte
let hi = if chr >= b'a' { chr - b'a' + 10 }
else if chr >= b'A' { chr - b'A' + 10 }
Expand Down
2 changes: 1 addition & 1 deletion src/util/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl fmt::Debug for CStr {
bytes = &bytes[1..];
f.write_str("\\\\")?;
},
0x20...0x7E => {
0x20..=0x7E => {
let (s, tail) = split_f(bytes, |&byte| byte < 0x20 || byte >= 0x80 || byte == b'"' || byte == b'\\');
bytes = tail;
let s = unsafe { str::from_utf8_unchecked(s) };
Expand Down