@@ -11,7 +11,7 @@ use windows_sys::Win32::Devices::DeviceAndDriverInstallation::{
11
11
} ;
12
12
use windows_sys:: Win32 :: Foundation :: { FALSE , FILETIME , INVALID_HANDLE_VALUE , MAX_PATH } ;
13
13
use windows_sys:: Win32 :: System :: Registry :: {
14
- RegCloseKey , RegEnumValueW , RegOpenKeyExW , RegQueryInfoKeyW , RegQueryValueExW ,
14
+ RegCloseKey , RegEnumValueW , RegOpenKeyExW , RegQueryInfoKeyW , RegQueryValueExW , HKEY ,
15
15
HKEY_LOCAL_MACHINE , KEY_READ , REG_SZ ,
16
16
} ;
17
17
@@ -51,7 +51,7 @@ fn get_ports_guids() -> Result<Vec<GUID>> {
51
51
52
52
// first attempt with size == 1, second with the size returned from the first try
53
53
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 ) ) ;
55
55
let guid_buffer = & mut guids[ class_start_idx..] ;
56
56
// Find out how many GUIDs are associated with this class name. num_guids will tell us how many there actually are.
57
57
let res = unsafe {
@@ -203,7 +203,7 @@ impl PortDevices {
203
203
// Ports class (given by `guid`).
204
204
pub fn new ( guid : & GUID ) -> Self {
205
205
PortDevices {
206
- hdi : unsafe { SetupDiGetClassDevsW ( guid, ptr:: null ( ) , ptr :: null_mut ( ) , DIGCF_PRESENT ) } ,
206
+ hdi : unsafe { SetupDiGetClassDevsW ( guid, ptr:: null ( ) , 0 , DIGCF_PRESENT ) } ,
207
207
dev_idx : 0 ,
208
208
}
209
209
}
@@ -218,8 +218,8 @@ impl Iterator for PortDevices {
218
218
let mut port_dev = PortDevice {
219
219
hdi : self . hdi ,
220
220
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 ) ,
223
223
DevInst : 0 ,
224
224
Reserved : 0 ,
225
225
} ,
@@ -441,7 +441,7 @@ fn get_registry_com_ports() -> HashSet<String> {
441
441
442
442
let reg_key = as_utf16 ( "HARDWARE\\ DEVICEMAP\\ SERIALCOMM" ) ;
443
443
let key_ptr = reg_key. as_ptr ( ) ;
444
- let mut ports_key = ptr :: null_mut ( ) ;
444
+ let mut ports_key: HKEY = 0 ;
445
445
446
446
// SAFETY: ffi, all inputs are correct
447
447
let open_res =
0 commit comments