Skip to content

Commit 4385e6b

Browse files
committed
Update dependencies and adjust formatting
1 parent 0c2d77d commit 4385e6b

12 files changed

+93
-94
lines changed

Cargo.toml

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
[package]
22

3+
name = "wrappe"
4+
description = "Packer for creating self-contained single-binary applications from executables and directories"
5+
version = "1.0.3"
6+
license = "BSD-2-Clause"
37
authors = ["Christian Sdunek <[email protected]>"]
4-
build = "build.rs"
58
categories = ["compression", "filesystem", "command-line-utilities"]
69
keywords = ["compression", "binary", "executable", "packer", "filesystem"]
7-
description = "Packer for creating self-contained single-binary applications from executables and directories"
810
edition = "2021"
11+
rust-version = "1.77.2"
912
include = [
1013
"Cargo.toml",
1114
"src/**/*",
1215
"startpe.tar",
1316
"build.rs",
1417
"LICENSE",
1518
]
16-
license = "BSD-2-Clause"
17-
name = "wrappe"
19+
build = "build.rs"
1820
readme = "README.md"
1921
repository = "https://github.com/Systemcluster/wrappe"
20-
version = "1.0.3"
2122

2223
[[bin]]
2324

@@ -49,25 +50,25 @@ opt-level = 0
4950

5051
[dependencies]
5152

52-
staticfilemap = { version = "0.7.0", default-features = false, features = ["zstd", "multithread"] }
53-
editpe = { version = "0.1.0", default-features = false }
53+
staticfilemap = { version = "0.8.0", default-features = false, features = ["zstd", "multithread"] }
54+
editpe = { version = "0.2.1", default-features = false, features = ["std"] }
5455

55-
clap = { version = "4.5.13", features = ["std", "color", "suggestions", "derive", "unicode", "wrap_help"] }
56+
clap = { version = "4.5.21", features = ["std", "color", "suggestions", "derive", "unicode", "wrap_help"] }
5657
color-backtrace = "0.6.1"
5758
console = "0.15.8"
58-
indicatif = "0.17.8"
59+
indicatif = "0.17.9"
5960
jwalk = "0.8.1"
6061
num_cpus = "1.16.0"
6162
path-slash = "0.2.1"
6263
rand = "0.8.5"
6364
rayon = "1.10.0"
64-
sysinfo = "0.31.2"
65+
sysinfo = "0.32.0"
6566
twox-hash = { version = "1.6.3", default-features = false }
66-
zerocopy = "0.7.35"
67+
zerocopy = "0.8.10"
6768
zstd = { version = "0.13.2", default-features = false, features = ["zstdmt", "zdict_builder"] }
6869

6970
[build-dependencies]
7071

7172
jwalk = "0.8.1"
72-
which = "6.0.2"
73-
tar = "0.4.41"
73+
which = "7.0.0"
74+
tar = "0.4.43"

build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
env::{var, vars},
3-
fs::{create_dir_all, File},
3+
fs::{File, create_dir_all},
44
ops::Deref,
55
path::{Path, PathBuf},
66
process::Command,

src/compress.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use std::{
22
env::temp_dir,
3-
fs::{read_link, remove_file, symlink_metadata, File},
3+
fs::{File, read_link, remove_file, symlink_metadata},
44
hash::Hasher,
5-
io::{copy, BufReader, Cursor, Read, Result, Seek, Write},
5+
io::{BufReader, Cursor, Read, Result, Seek, Write, copy},
66
path::Path,
77
sync::{
8-
atomic::{AtomicU64, Ordering},
98
Arc, Mutex,
9+
atomic::{AtomicU64, Ordering},
1010
},
1111
time::SystemTime,
1212
};
@@ -20,7 +20,7 @@ use rand::{
2020
use rayon::prelude::*;
2121
use sysinfo::System;
2222
use twox_hash::XxHash64;
23-
use zstd::{dict::EncoderDictionary, Encoder};
23+
use zstd::{Encoder, dict::EncoderDictionary};
2424

2525
use crate::types::*;
2626

src/main.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ fn main() {
137137
style(&args.versioning).yellow().bold(),
138138
style("without option").yellow().dim(),
139139
style("once").yellow().bold(),
140-
style("can cause unpacking to fail while the application is already running")
141-
.yellow()
142-
.dim(),
140+
style("can cause unpacking to fail while the application is already running").dim(),
143141
);
144142
}
145143
if versioning == 2 && verification != 0 {
@@ -152,14 +150,15 @@ fn main() {
152150
style("versioning").yellow().dim(),
153151
);
154152
}
155-
if once == 1 && (!runner_name.contains("windows") || !runner_name.contains("linux")) {
153+
if once == 1 && !(runner_name.contains("windows") || runner_name.contains("linux")) {
156154
println!(
157-
"{} {} {}",
155+
"{} {} {} {}",
158156
style("note: option").yellow().dim(),
159157
style("once").yellow().bold(),
160158
style("is only supported for Windows and Linux runners")
161159
.yellow()
162160
.dim(),
161+
style(format!("(target: {})", runner_name)).yellow().dim(),
163162
);
164163
}
165164
if show_console != 2 && !runner_name.contains("windows") {

src/types.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
pub use zerocopy::AsBytes;
1+
pub use zerocopy::{Immutable, IntoBytes, KnownLayout};
22

33
pub const WRAPPE_FORMAT: u8 = 204;
44
pub const WRAPPE_SIGNATURE: [u8; 8] = [0x50, 0x45, 0x33, 0x44, 0x41, 0x54, 0x41, 0x00];
55
pub const NAME_SIZE: usize = 128;
66
pub const ARGS_SIZE: usize = 512;
77

88
#[repr(C, packed)]
9-
#[derive(AsBytes)]
9+
#[derive(IntoBytes, Immutable, KnownLayout)]
1010
pub struct StarterInfo {
1111
pub signature: [u8; 8],
1212
pub show_console: u8,
@@ -25,7 +25,7 @@ pub struct StarterInfo {
2525
}
2626

2727
#[repr(C, packed)]
28-
#[derive(AsBytes)]
28+
#[derive(IntoBytes, Immutable, KnownLayout)]
2929
pub struct PayloadHeader {
3030
pub directory_sections: u64,
3131
pub file_sections: u64,
@@ -42,13 +42,13 @@ impl PayloadHeader {
4242
}
4343
}
4444
#[repr(C, packed)]
45-
#[derive(AsBytes)]
45+
#[derive(IntoBytes, Immutable, KnownLayout)]
4646
pub struct DirectorySection {
4747
pub name: [u8; NAME_SIZE],
4848
pub parent: u32,
4949
}
5050
#[repr(C, packed)]
51-
#[derive(AsBytes)]
51+
#[derive(IntoBytes, Immutable, KnownLayout)]
5252
pub struct FileSectionHeader {
5353
pub position: u64,
5454
pub size: u64,
@@ -64,7 +64,7 @@ pub struct FileSectionHeader {
6464
pub readonly: u8,
6565
}
6666
#[repr(C, packed)]
67-
#[derive(AsBytes)]
67+
#[derive(IntoBytes, Immutable, KnownLayout)]
6868
pub struct SymlinkSection {
6969
pub name: [u8; NAME_SIZE],
7070
pub parent: u32,

startpe/Cargo.toml

+11-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[package]
22

3-
authors = ["Christian Sdunek <[email protected]>"]
3+
name = "startpe"
44
description = "Runner for Packed Executables"
5-
edition = "2021"
5+
version = "1.0.3"
66
license = "BSD-2-Clause"
7-
name = "startpe"
7+
authors = ["Christian Sdunek <[email protected]>"]
8+
edition = "2021"
9+
rust-version = "1.77.2"
810
publish = false
911
repository = "https://github.com/Systemcluster/wrappe"
10-
version = "1.0.3"
1112

1213
[[bin]]
1314

@@ -34,28 +35,19 @@ strip = "symbols"
3435
[dependencies]
3536

3637
dirs = "5.0.1"
37-
filetime = "0.2.23"
38-
fslock-guard = "0.1.4"
38+
filetime = "0.2.25"
39+
fslock-guard = "0.2.0"
3940
memchr = "2.7.4"
40-
memmap2 = "0.9.4"
41+
memmap2 = "0.9.5"
4142
rayon = "1.10.0"
4243
twox-hash = { version = "1.6.3", default-features = false }
43-
zerocopy = { version = "0.7.35", features = ["derive"] }
44+
zerocopy = { version = "0.8.10", features = ["derive"] }
4445
zstd = { version = "0.13.2", default-features = false, features = [] }
4546

4647
[target.'cfg(windows)'.dependencies]
4748

48-
windows-sys = { version = "0.52.0", features = [
49-
"Win32_Foundation",
50-
"Win32_System_Console",
51-
"Win32_System_LibraryLoader",
52-
"Win32_System_Threading",
53-
"Win32_System_Diagnostics",
54-
"Win32_System_Diagnostics_ToolHelp",
55-
"Win32_System_ProcessStatus",
56-
"Win32_UI_WindowsAndMessaging",
57-
] }
49+
windows-sys = { version = "0.59.0", features = ["Win32_Foundation", "Win32_System_Console", "Win32_System_LibraryLoader", "Win32_System_Threading", "Win32_System_Diagnostics", "Win32_System_Diagnostics_ToolHelp", "Win32_System_ProcessStatus", "Win32_UI_WindowsAndMessaging"] }
5850

5951
[target.'cfg(target_os = "linux")'.dependencies]
6052

61-
procfs = { version = "0.16.0", default-features = false, optional = true }
53+
procfs = { version = "0.17.0", default-features = false, optional = true }

startpe/src/decompress.rs

+28-25
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{
2-
fs::{create_dir_all, read_link, remove_dir, remove_file, File},
2+
fs::{File, create_dir_all, read_link, remove_dir, remove_file},
33
hash::Hasher,
4-
io::{copy, sink, BufReader, BufWriter, Read, Result},
4+
io::{BufReader, BufWriter, Read, Result, copy, sink},
55
mem::size_of,
66
path::{Path, PathBuf},
77
thread::sleep,
@@ -11,11 +11,11 @@ use std::{
1111
#[cfg(windows)]
1212
use std::os::windows::fs::OpenOptionsExt;
1313

14-
use filetime::{set_file_times, set_symlink_file_times, FileTime};
15-
use rayon::prelude::*;
14+
use filetime::{FileTime, set_file_times, set_symlink_file_times};
15+
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
1616
use twox_hash::XxHash64;
1717
use zerocopy::Ref;
18-
use zstd::{dict::DecoderDictionary, zstd_safe::DCtx, Decoder};
18+
use zstd::{Decoder, dict::DecoderDictionary, zstd_safe::DCtx};
1919

2020
use crate::{types::*, versioning::*};
2121

@@ -56,9 +56,10 @@ pub fn decompress(
5656
) -> bool {
5757
// read payload header sections
5858
let payload_header_start = mmap.len() - size_of::<PayloadHeader>();
59-
let payload_header = Ref::<_, PayloadHeader>::new(&mmap[payload_header_start..])
60-
.expect("couldn't read payload header")
61-
.into_ref();
59+
let payload_header = Ref::into_ref(
60+
Ref::<_, PayloadHeader>::from_bytes(&mmap[payload_header_start..])
61+
.expect("couldn't read payload header"),
62+
);
6263

6364
let directory_sections = payload_header.directory_sections as usize;
6465
let file_sections = payload_header.file_sections as usize;
@@ -117,12 +118,12 @@ pub fn decompress(
117118
|mut directories, (i, section)| {
118119
let section_start = directory_sections_start + i * size_of::<DirectorySection>();
119120
section_hasher.write(section);
120-
let section = Ref::<_, DirectorySection>::new(
121-
&sections[section_start..section_start + size_of::<DirectorySection>()],
122-
)
123-
.expect("couldn't read payload header")
124-
.into_ref();
125-
121+
let section = Ref::into_ref(
122+
Ref::<_, DirectorySection>::from_bytes(
123+
&sections[section_start..section_start + size_of::<DirectorySection>()],
124+
)
125+
.expect("couldn't read payload header"),
126+
);
126127
directories.push(
127128
directories[section.parent as usize].join(
128129
std::str::from_utf8(
@@ -144,11 +145,12 @@ pub fn decompress(
144145
.map(|(i, section)| {
145146
let section_start = file_sections_start + i * size_of::<FileSectionHeader>();
146147
section_hasher.write(section);
147-
let section = Ref::<_, FileSectionHeader>::new(
148-
&sections[section_start..section_start + size_of::<FileSectionHeader>()],
149-
)
150-
.expect("couldn't read payload header")
151-
.into_ref();
148+
let section = Ref::into_ref(
149+
Ref::<_, FileSectionHeader>::from_bytes(
150+
&sections[section_start..section_start + size_of::<FileSectionHeader>()],
151+
)
152+
.expect("couldn't read payload header"),
153+
);
152154
(
153155
section,
154156
std::str::from_utf8(
@@ -168,11 +170,12 @@ pub fn decompress(
168170
.map(|(i, section)| {
169171
let section_start = symlink_sections_start + i * size_of::<SymlinkSection>();
170172
section_hasher.write(section);
171-
let section = Ref::<_, SymlinkSection>::new(
172-
&sections[section_start..section_start + size_of::<SymlinkSection>()],
173-
)
174-
.expect("couldn't read payload header")
175-
.into_ref();
173+
let section = Ref::into_ref(
174+
Ref::<_, SymlinkSection>::from_bytes(
175+
&sections[section_start..section_start + size_of::<SymlinkSection>()],
176+
)
177+
.expect("couldn't read payload header"),
178+
);
176179
(
177180
section,
178181
std::str::from_utf8(
@@ -389,7 +392,7 @@ pub fn decompress(
389392
#[cfg(any(unix, target_os = "redox"))]
390393
{
391394
use ::std::{
392-
fs::{set_permissions, Permissions},
395+
fs::{Permissions, set_permissions},
393396
os::unix::prelude::*,
394397
};
395398
let mode = file.mode;

startpe/src/main.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ fn main() {
120120
size_of::<StarterInfo>()
121121
)
122122
}
123-
let info = Ref::<_, StarterInfo>::new(&mmap[info_start..info_start + size_of::<StarterInfo>()])
124-
.expect("couldn't read starter info")
125-
.into_ref();
123+
let info = Ref::into_ref(
124+
Ref::<_, StarterInfo>::from_bytes(&mmap[info_start..info_start + size_of::<StarterInfo>()])
125+
.expect("couldn't read starter info"),
126+
);
126127
if info.signature != signature[..] {
127128
panic!("file signature is invalid")
128129
}

startpe/src/once.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@ use std::path::Path;
22

33
#[cfg(windows)]
44
pub fn check_instance(run_path: &Path) -> Result<bool, std::io::Error> {
5+
use core::ffi::c_void;
56
use std::{ffi::OsString, os::windows::ffi::OsStringExt};
67
use windows_sys::Win32::{
78
System::{
89
Diagnostics::ToolHelp::{
9-
CreateToolhelp32Snapshot, Process32FirstW, Process32NextW, PROCESSENTRY32W,
10+
CreateToolhelp32Snapshot, PROCESSENTRY32W, Process32FirstW, Process32NextW,
1011
TH32CS_SNAPPROCESS,
1112
},
1213
Threading::{
13-
OpenProcess, QueryFullProcessImageNameW, PROCESS_QUERY_LIMITED_INFORMATION,
14+
OpenProcess, PROCESS_QUERY_LIMITED_INFORMATION, QueryFullProcessImageNameW,
1415
},
1516
},
1617
UI::WindowsAndMessaging::EnumWindows,
1718
};
1819

19-
unsafe extern "system" fn enum_windows_proc(hwnd: isize, lparam: isize) -> i32 {
20+
unsafe extern "system" fn enum_windows_proc(hwnd: *mut c_void, lparam: isize) -> i32 {
2021
use windows_sys::Win32::UI::WindowsAndMessaging::{
21-
GetWindowThreadProcessId, SetForegroundWindow, ShowWindow, SW_SHOW,
22+
GetWindowThreadProcessId, SW_SHOW, SetForegroundWindow, ShowWindow,
2223
};
2324
let mut process_id = 0;
2425
unsafe {
@@ -37,7 +38,7 @@ pub fn check_instance(run_path: &Path) -> Result<bool, std::io::Error> {
3738
}
3839

3940
let snapshot = unsafe { CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) };
40-
if snapshot == 0 {
41+
if snapshot.is_null() {
4142
return Err(std::io::Error::last_os_error());
4243
}
4344
let mut entry = unsafe { std::mem::zeroed::<PROCESSENTRY32W>() };

startpe/src/permissions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::path::Path;
33
#[cfg(any(unix, target_os = "redox"))]
44
pub fn set_executable_permissions(path: &Path) {
55
use ::std::{
6-
fs::{metadata, set_permissions, Permissions},
6+
fs::{Permissions, metadata, set_permissions},
77
os::unix::prelude::*,
88
};
99
let meta = metadata(path);

0 commit comments

Comments
 (0)