File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed
lib/bencher_context/src/client/platform/target_os Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change 1+ use core:: ffi:: c_void;
12use std:: cmp;
23
34use uuid:: Uuid ;
@@ -33,17 +34,23 @@ fn digital_product_id() -> Option<Uuid> {
3334
3435 let mut data = vec ! [ 0u8 ; 256 ] ;
3536 let mut data_size = data. len ( ) as u32 ;
36- RegGetValueW (
37- HKEY_LOCAL_MACHINE ,
38- sub_key,
39- value,
40- RRF_RT_ANY ,
41- None ,
42- Some ( & mut data) ,
43- Some ( & mut data_size) ,
44- )
45- . ok ( )
46- . ok ( ) ?;
37+ // Safety: The accuracy of the data returned by `RegGetValueW` is not of any importance,
38+ // rather the consistency of the data is what is important.
39+ // https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-reggetvaluew
40+ #[ allow( unsafe_code) ]
41+ unsafe {
42+ RegGetValueW (
43+ HKEY_LOCAL_MACHINE ,
44+ sub_key,
45+ value,
46+ RRF_RT_ANY ,
47+ None ,
48+ Some ( data. as_mut_ptr ( ) as * mut c_void ) ,
49+ Some ( & mut data_size) ,
50+ )
51+ . ok ( )
52+ . ok ( ) ?;
53+ }
4754
4855 let digital_product_id = data
4956 . into_iter ( )
You can’t perform that action at this time.
0 commit comments