//! One-shot probe: run `marshal_activated_iunknown_objref` standalone //! to isolate which step in the NMX activation pipeline is failing //! with RPC_S_SERVER_UNAVAILABLE (1722) when called from cargo test. //! //! Run with: //! ```text //! cargo run -p mxaccess-rpc --example com-marshal-probe --features windows-com //! ``` #[cfg(all(windows, feature = "windows-com"))] fn main() { use mxaccess_rpc::com_objref_provider::{ marshal_activated_iunknown_objref, MarshalContext, }; eprintln!("step 1: marshal_activated_iunknown_objref(NmxSvc.NmxService, DifferentMachine)"); match marshal_activated_iunknown_objref("NmxSvc.NmxService", MarshalContext::DifferentMachine) { Ok(blob) => { eprintln!("OK: {} bytes", blob.len()); eprintln!("first 64 bytes (hex):"); for chunk in blob.iter().take(64).enumerate() { if chunk.0 % 16 == 0 { eprint!("\n "); } eprint!("{:02x} ", chunk.1); } eprintln!(); } Err(e) => { eprintln!("FAIL: {e}"); std::process::exit(1); } } } #[cfg(not(all(windows, feature = "windows-com")))] fn main() { eprintln!( "com-marshal-probe requires Windows + the windows-com feature: \ cargo run -p mxaccess-rpc --example com-marshal-probe --features windows-com" ); }