wmi 0.3.0

WMI crate for rust.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use failure::Fail;
use winapi::shared::ntdef::HRESULT;

#[derive(Debug, Fail)]
pub enum WMIError {
    #[fail(display = "HRESULT Call failed with: {:#X}", hres)]
    HResultError { hres: HRESULT },
}

pub fn check_hres(hres: HRESULT) -> Result<(), WMIError> {
    if hres < 0 {
        dbg!(hres);
        return Err(WMIError::HResultError { hres });
    }

    Ok(())
}