pub fn store_error< E >( error : E ) -> ComError
    where E : Into< ComError >
{
    // Convet the error.
    let com_error = error.into();

    match com_error.error_info {

        Some( ref error_info ) => {

            // ComError contains ErrorInfo. We need to set this in the OS error
            // store.

            // Construct the COM class used for IErrorInfo. The class contains the
            // description in memory.
            let mut info = ComStruct::< ErrorInfo >::new( error_info.clone() );

            // Get the IErrorInfo interface and set it in thread memory.
            let mut error_ptr : RawComPtr = std::ptr::null_mut();
            unsafe {

                // We are intentionally ignoring the HRESULT codes here. We don't
                // want to override the original error HRESULT with these codes.
                ComBox::query_interface(
                        info.as_mut(),
                        &IID_IErrorInfo,
                        &mut error_ptr );
                error_store::SetErrorInfo( 0, ::raw::InterfacePtr::new( error_ptr ) );
            }
        },
        None => {
            // No error info in the ComError.
            unsafe { error_store::SetErrorInfo( 0, ::raw::InterfacePtr::null() ); }
        }
    }

    // Return the HRESULT of the original error.
    com_error
}
/// Extracts the HRESULT from the error result and stores the extended error
/// information in thread memory so it can be fetched by the COM client.
Extracts the HRESULT from the error result and stores the extended error
information in thread memory so it can be fetched by the COM client.
Extracts the HRESULT from the error result and stores the extended error information in thread memory so it can be fetched by the COM client .
pub fn store_error< E >( error : E ) -> ComError
    where E : Into< ComError >
{
    // Convet the error.
    let com_error = error.into();
    match com_error.error_info {
        Some( ref error_info ) => {
            // ComError contains ErrorInfo. We need to set this in the OS error
            // store.
            // Construct the COM class used for IErrorInfo. The class contains the
            // description in memory.
            let mut info = ComStruct::< ErrorInfo >::new( error_info.clone() );
            // Get the IErrorInfo interface and set it in thread memory.
            let mut error_ptr : RawComPtr = std::ptr::null_mut();
            unsafe {
                // We are intentionally ignoring the HRESULT codes here. We don't
                // want to override the original error HRESULT with these codes.
                ComBox::query_interface(
                        info.as_mut(),
                        &IID_IErrorInfo,
                        &mut error_ptr );
                error_store::SetErrorInfo( 0, ::raw::InterfacePtr::new( error_ptr ) );
            }
        },
        None => {
            // No error info in the ComError.
            unsafe { error_store::SetErrorInfo( 0, ::raw::InterfacePtr::null() ); }
        }
    }
    // Return the HRESULT of the original error.
    com_error
}
pub fn store_error < E > ( error : E ) -> ComError where E : Into < ComError > { // Convet the error. let com_error = error . into ( ) ; match com_error . error_info { Some ( ref error_info ) => { // ComError contains ErrorInfo. We need to set this in the OS error // store. // Construct the COM class used for IErrorInfo. The class contains the // description in memory. let mut info = ComStruct :: < ErrorInfo > :: new ( error_info . clone ( ) ) ; // Get the IErrorInfo interface and set it in thread memory. let mut error_ptr : RawComPtr = std :: ptr :: null_mut ( ) ; unsafe { // We are intentionally ignoring the HRESULT codes here. We don't // want to override the original error HRESULT with these codes. ComBox :: query_interface ( info . as_mut ( ) , & IID_IErrorInfo , & mut error_ptr ) ; error_store :: SetErrorInfo ( 0 , :: raw :: InterfacePtr :: new ( error_ptr ) ) ; } } , None => { // No error info in the ComError. unsafe { error_store :: SetErrorInfo ( 0 , :: raw :: InterfacePtr :: null ( ) ) ; } } } // Return the HRESULT of the original error. com_error }
Extracts the HRESULT from the error result and stores the extended error
information in thread memory so it can be fetched by the COM client.
Extracts the HRESULT from the error result and stores the extended error information in thread memory so it can be fetched by the COM client .
error
E