Skip to content

Commit f7532e9

Browse files
unlimitedsolasirhcel
authored andcommitted
MSRV compatibility
1 parent 971fb4a commit f7532e9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ io-kit-sys = "0.4.0"
2929
mach2 = "0.4.1"
3030

3131
[target."cfg(windows)".dependencies.windows-sys]
32-
version = "0.60.2"
32+
version = "0.52.0"
3333
features = [
3434
"Win32_Devices_Communication",
3535
"Win32_Foundation",

src/windows/enumerate.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use windows_sys::Win32::Devices::DeviceAndDriverInstallation::{
1111
};
1212
use windows_sys::Win32::Foundation::{FALSE, FILETIME, INVALID_HANDLE_VALUE, MAX_PATH};
1313
use windows_sys::Win32::System::Registry::{
14-
RegCloseKey, RegEnumValueW, RegOpenKeyExW, RegQueryInfoKeyW, RegQueryValueExW,
14+
RegCloseKey, RegEnumValueW, RegOpenKeyExW, RegQueryInfoKeyW, RegQueryValueExW, HKEY,
1515
HKEY_LOCAL_MACHINE, KEY_READ, REG_SZ,
1616
};
1717

@@ -51,7 +51,7 @@ fn get_ports_guids() -> Result<Vec<GUID>> {
5151

5252
// first attempt with size == 1, second with the size returned from the first try
5353
for _ in 0..2 {
54-
guids.resize(class_start_idx + num_guids as usize, GUID::default());
54+
guids.resize(class_start_idx + num_guids as usize, GUID::from_u128(0));
5555
let guid_buffer = &mut guids[class_start_idx..];
5656
// Find out how many GUIDs are associated with this class name. num_guids will tell us how many there actually are.
5757
let res = unsafe {
@@ -203,7 +203,7 @@ impl PortDevices {
203203
// Ports class (given by `guid`).
204204
pub fn new(guid: &GUID) -> Self {
205205
PortDevices {
206-
hdi: unsafe { SetupDiGetClassDevsW(guid, ptr::null(), ptr::null_mut(), DIGCF_PRESENT) },
206+
hdi: unsafe { SetupDiGetClassDevsW(guid, ptr::null(), 0, DIGCF_PRESENT) },
207207
dev_idx: 0,
208208
}
209209
}
@@ -218,8 +218,8 @@ impl Iterator for PortDevices {
218218
let mut port_dev = PortDevice {
219219
hdi: self.hdi,
220220
devinfo_data: SP_DEVINFO_DATA {
221-
cbSize: size_of::<SP_DEVINFO_DATA>() as u32,
222-
ClassGuid: GUID::default(),
221+
cbSize: std::mem::size_of::<SP_DEVINFO_DATA>() as u32,
222+
ClassGuid: GUID::from_u128(0),
223223
DevInst: 0,
224224
Reserved: 0,
225225
},
@@ -441,7 +441,7 @@ fn get_registry_com_ports() -> HashSet<String> {
441441

442442
let reg_key = as_utf16("HARDWARE\\DEVICEMAP\\SERIALCOMM");
443443
let key_ptr = reg_key.as_ptr();
444-
let mut ports_key = ptr::null_mut();
444+
let mut ports_key: HKEY = 0;
445445

446446
// SAFETY: ffi, all inputs are correct
447447
let open_res =

0 commit comments

Comments
 (0)