|
|
|
@ -124,13 +124,21 @@ impl PciLeech {
|
|
|
|
|
) -> Result<Self> {
|
|
|
|
|
// open device
|
|
|
|
|
let mut conf = build_lc_config(device, remote, mem_map.is_some());
|
|
|
|
|
let err = std::ptr::null_mut::<PLC_CONFIG_ERRORINFO>();
|
|
|
|
|
let handle = unsafe { LcCreateEx(&mut conf, err) };
|
|
|
|
|
let p_lc_config_error_info = std::ptr::null_mut::<LC_CONFIG_ERRORINFO>();
|
|
|
|
|
let pp_lc_config_error_info = &raw const p_lc_config_error_info as *mut PLC_CONFIG_ERRORINFO;
|
|
|
|
|
let handle = unsafe { LcCreateEx(&mut conf, pp_lc_config_error_info) };
|
|
|
|
|
if handle.is_null() {
|
|
|
|
|
// TODO: handle version error
|
|
|
|
|
// TODO: handle special case of fUserInputRequest
|
|
|
|
|
let err = if p_lc_config_error_info.is_null() {
|
|
|
|
|
None
|
|
|
|
|
} else {
|
|
|
|
|
// read the data at the error
|
|
|
|
|
Some(unsafe { p_lc_config_error_info.read() })
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return Err(Error(ErrorOrigin::Connector, ErrorKind::Configuration)
|
|
|
|
|
.log_error(format!("unable to create leechcore context: {err:?}")));
|
|
|
|
|
.log_error(format!("unable to create leechcore context: {err:?}", )));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: allow handling these errors properly
|
|
|
|
|