Skip to content

Commit 8928859

Browse files
committed
Switch to windows-sys crate
1 parent 8e441bb commit 8928859

File tree

4 files changed

+55
-54
lines changed

4 files changed

+55
-54
lines changed

Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,16 @@ tracing = { version = "0.1.40", features = ["log"] }
7777
yaxpeax-arm = "0.3.0"
7878
chrono = "0.4.38"
7979
vergilius = "0.1.2"
80-
windows = { version = "0.57.0", features = [
81-
"Win32_Foundation",
80+
windows-sys = { features = [
81+
"Win32",
8282
"Win32_System",
8383
"Win32_System_SystemServices",
8484
"Win32_System_Diagnostics_Debug",
8585
"Win32_System_Diagnostics",
8686
"Win32_System_SystemInformation",
8787
"Win32_System_Kernel",
88-
] }
88+
"Win32_Foundation",
89+
], version = "0.59.0" }
8990
reqwest = { version = "0.12.5", features = [
9091
"blocking",
9192
# NOTE: rustls is used because native-tls does not build with the

src/os/windows/debug_info.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{
1212

1313
use lending_iterator::{windows_mut, LendingIterator};
1414
use simics::{debug, get_object, info, warn, ConfObject};
15-
use windows::Win32::System::{
15+
use windows_sys::Win32::System::{
1616
Diagnostics::Debug::{
1717
IMAGE_DEBUG_DIRECTORY, IMAGE_DEBUG_TYPE_CODEVIEW, IMAGE_DIRECTORY_ENTRY_DEBUG,
1818
IMAGE_NT_HEADERS64,
@@ -78,10 +78,10 @@ impl<'a> DebugInfo<'a> {
7878
let nt_header =
7979
read_virtual::<IMAGE_NT_HEADERS64>(processor, base + dos_header.e_lfanew as u64)?;
8080
let debug_data_directory_offset = nt_header.OptionalHeader.DataDirectory
81-
[IMAGE_DIRECTORY_ENTRY_DEBUG.0 as usize]
81+
[IMAGE_DIRECTORY_ENTRY_DEBUG as usize]
8282
.VirtualAddress;
8383
let debug_data_directory_size =
84-
nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG.0 as usize].Size;
84+
nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG as usize].Size;
8585
let debug_directory = (base + debug_data_directory_offset as u64
8686
..base + debug_data_directory_offset as u64 + debug_data_directory_size as u64)
8787
.step_by(std::mem::size_of::<IMAGE_DEBUG_DIRECTORY>())
@@ -223,10 +223,10 @@ impl<'a> DebugInfo<'a> {
223223
base + dos_header.e_lfanew as u64,
224224
)?;
225225
let debug_data_directory_offset = nt_header.OptionalHeader.DataDirectory
226-
[IMAGE_DIRECTORY_ENTRY_DEBUG.0 as usize]
226+
[IMAGE_DIRECTORY_ENTRY_DEBUG as usize]
227227
.VirtualAddress;
228228
let debug_data_directory_size =
229-
nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG.0 as usize].Size;
229+
nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG as usize].Size;
230230
let debug_directory = (base + debug_data_directory_offset as u64
231231
..base + debug_data_directory_offset as u64 + debug_data_directory_size as u64)
232232
.step_by(std::mem::size_of::<IMAGE_DEBUG_DIRECTORY>())

src/os/windows/kernel.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use anyhow::{anyhow, bail, Result};
77
use pdb::{FallibleIterator, SymbolData};
88
use simics::{debug, get_attribute, get_object, info, ConfObject};
99
use vergilius::bindings::*;
10-
use windows::Win32::System::{
10+
use windows_sys::Win32::System::{
1111
Diagnostics::Debug::{IMAGE_DIRECTORY_ENTRY_EXPORT, IMAGE_NT_HEADERS64},
1212
Kernel::LIST_ENTRY,
1313
SystemServices::{
@@ -67,11 +67,11 @@ pub fn page_is_kernel(processor: *mut ConfObject, address: u64) -> Result<bool>
6767
OPTIONAL_HEADER_SIGNATURE_PE32,
6868
OPTIONAL_HEADER_SIGNATURE_PE32_PLUS,
6969
]
70-
.contains(&nt_header.OptionalHeader.Magic.0)
70+
.contains(&nt_header.OptionalHeader.Magic)
7171
{
7272
debug!(
7373
"Optional header magic {:#x} unrecognized",
74-
nt_header.OptionalHeader.Magic.0
74+
nt_header.OptionalHeader.Magic
7575
);
7676
return Ok(false);
7777
}
@@ -81,10 +81,10 @@ pub fn page_is_kernel(processor: *mut ConfObject, address: u64) -> Result<bool>
8181
debug!(get_object("tsffs")?, "Image size is {:#x}", image_size);
8282

8383
let export_header_offset = nt_header.OptionalHeader.DataDirectory
84-
[IMAGE_DIRECTORY_ENTRY_EXPORT.0 as usize]
84+
[IMAGE_DIRECTORY_ENTRY_EXPORT as usize]
8585
.VirtualAddress as u64;
8686
let export_header_size =
87-
nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT.0 as usize].Size as u64;
87+
nt_header.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT as usize].Size as u64;
8888

8989
if export_header_offset == 0 || export_header_offset >= image_size {
9090
debug!(

0 commit comments

Comments
 (0)