Skip to content

Instantly share code, notes, and snippets.

@TjeuKayim
Created October 17, 2019 20:18
Show Gist options
  • Save TjeuKayim/0b4b766c1df7f9e660316084d607229c to your computer and use it in GitHub Desktop.
Save TjeuKayim/0b4b766c1df7f9e660316084d607229c to your computer and use it in GitHub Desktop.
pub fn info(&mut self) -> String {
let mut name = ptr::null_mut();
let hr = unsafe { (*self.checker).Get_Id(&mut name) };
assert!(SUCCEEDED(hr));
//&String::from_utf16_lossy(name.as_slice())
unsafe { widestring::U16CString::from_ptr_str(name).to_string_lossy() }
}
pub fn options(&mut self) {
// read options
let mut option_ids = ptr::null_mut();
let hr = unsafe { self.checker.Get_OptionIds(&mut option_ids) };
assert!(SUCCEEDED(hr));
dbg!(hr, option_ids);
for i in 0 {
let mut option_id = ptr::null_mut();
let pcelt_fetched = ptr::null_mut();
let hr = unsafe { (*option_ids).Next(2, &mut option_id, pcelt_fetched) };
dbg!(hr, option_id, pcelt_fetched);
if hr != S_OK {
break;
}
assert!(SUCCEEDED(hr));
let option_id_str = unsafe { widestring::U16CString::from_ptr_str(option_id).to_string_lossy() };
println!("option_id[{}] {}", i, option_id_str);
unsafe { CoTaskMemFree(option_id as LPVOID) };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment