wincom 0.3.0

A lightweight Rust wrapper for Windows COM IDispatch automation, providing RAII VARIANT management and simplified property/method invocation.
Documentation
//! Shared test helpers.
//!
//! This module lives under `tests/common/` so Cargo does not treat it as
//! a separate integration-test binary.

#![allow(dead_code)]

use windows::Win32::System::Com;

/// RAII wrapper for `CoInitialize` / `CoUninitialize`.
///
/// In `windows` 0.62, `CoInitialize` returns `HRESULT` directly (not
/// `Result<()>`), so we call `.ok()?` to convert to `windows::core::Result`.
pub struct ComGuard;

impl ComGuard {
    pub fn init() -> windows::core::Result<Self> {
        unsafe {
            Com::CoInitialize(None).ok()?;
        }
        Ok(Self)
    }
}

impl Drop for ComGuard {
    fn drop(&mut self) {
        unsafe { Com::CoUninitialize() };
    }
}