Skip to content

Commit

Permalink
windows/system: use read_unaligned as there is no guarantee entries a…
Browse files Browse the repository at this point in the history
…re aligned
  • Loading branch information
LunNova committed Jul 16, 2023
1 parent 35c11f8 commit d58c5ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/windows/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl SystemExt for System {
.as_ptr()
.offset(process_information_offset)
as *const SYSTEM_PROCESS_INFORMATION;
let pi = &*p;
let pi = &ptr::read_unaligned(p);

Check failure on line 268 in src/windows/system.rs

View workflow job for this annotation

GitHub Actions / Check 1.59.0 / x86_64-pc-windows-msvc

failed to resolve: use of undeclared crate or module `ptr`

Check failure on line 268 in src/windows/system.rs

View workflow job for this annotation

GitHub Actions / Check nightly / x86_64-pc-windows-msvc

failed to resolve: use of undeclared crate or module `ptr`

process_ids.push(Wrap(p));

Expand All @@ -291,7 +291,7 @@ impl SystemExt for System {
// able to run it over `process_information` directly!
let processes = into_iter(process_ids)
.filter_map(|pi| {
let pi = *pi.0;
let pi = ptr::read_unaligned(pi.0);

Check failure on line 294 in src/windows/system.rs

View workflow job for this annotation

GitHub Actions / Check 1.59.0 / x86_64-pc-windows-msvc

failed to resolve: use of undeclared crate or module `ptr`

Check failure on line 294 in src/windows/system.rs

View workflow job for this annotation

GitHub Actions / Check nightly / x86_64-pc-windows-msvc

failed to resolve: use of undeclared crate or module `ptr`
let pid = Pid(pi.UniqueProcessId as _);
if let Some(proc_) = (*process_list.0.get()).get_mut(&pid) {
if proc_
Expand Down

0 comments on commit d58c5ca

Please sign in to comment.