windows 0.58.0

Rust for Windows
Documentation
pub trait IAmsiStream_Impl: Sized {
    fn GetAttribute(&self, attribute: AMSI_ATTRIBUTE, datasize: u32, data: *mut u8, retdata: *mut u32) -> windows_core::Result<()>;
    fn Read(&self, position: u64, size: u32, buffer: *mut u8, readsize: *mut u32) -> windows_core::Result<()>;
}
impl windows_core::RuntimeName for IAmsiStream {}
impl IAmsiStream_Vtbl {
    pub const fn new<Identity: windows_core::IUnknownImpl, const OFFSET: isize>() -> IAmsiStream_Vtbl
    where
        Identity: IAmsiStream_Impl,
    {
        unsafe extern "system" fn GetAttribute<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, attribute: AMSI_ATTRIBUTE, datasize: u32, data: *mut u8, retdata: *mut u32) -> windows_core::HRESULT
        where
            Identity: IAmsiStream_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            IAmsiStream_Impl::GetAttribute(this, core::mem::transmute_copy(&attribute), core::mem::transmute_copy(&datasize), core::mem::transmute_copy(&data), core::mem::transmute_copy(&retdata)).into()
        }
        unsafe extern "system" fn Read<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, position: u64, size: u32, buffer: *mut u8, readsize: *mut u32) -> windows_core::HRESULT
        where
            Identity: IAmsiStream_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            IAmsiStream_Impl::Read(this, core::mem::transmute_copy(&position), core::mem::transmute_copy(&size), core::mem::transmute_copy(&buffer), core::mem::transmute_copy(&readsize)).into()
        }
        Self { base__: windows_core::IUnknown_Vtbl::new::<Identity, OFFSET>(), GetAttribute: GetAttribute::<Identity, OFFSET>, Read: Read::<Identity, OFFSET> }
    }
    pub fn matches(iid: &windows_core::GUID) -> bool {
        iid == &<IAmsiStream as windows_core::Interface>::IID
    }
}
pub trait IAntimalware_Impl: Sized {
    fn Scan(&self, stream: Option<&IAmsiStream>, result: *mut AMSI_RESULT, provider: *mut Option<IAntimalwareProvider>) -> windows_core::Result<()>;
    fn CloseSession(&self, session: u64);
}
impl windows_core::RuntimeName for IAntimalware {}
impl IAntimalware_Vtbl {
    pub const fn new<Identity: windows_core::IUnknownImpl, const OFFSET: isize>() -> IAntimalware_Vtbl
    where
        Identity: IAntimalware_Impl,
    {
        unsafe extern "system" fn Scan<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, stream: *mut core::ffi::c_void, result: *mut AMSI_RESULT, provider: *mut *mut core::ffi::c_void) -> windows_core::HRESULT
        where
            Identity: IAntimalware_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            IAntimalware_Impl::Scan(this, windows_core::from_raw_borrowed(&stream), core::mem::transmute_copy(&result), core::mem::transmute_copy(&provider)).into()
        }
        unsafe extern "system" fn CloseSession<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, session: u64)
        where
            Identity: IAntimalware_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            IAntimalware_Impl::CloseSession(this, core::mem::transmute_copy(&session))
        }
        Self { base__: windows_core::IUnknown_Vtbl::new::<Identity, OFFSET>(), Scan: Scan::<Identity, OFFSET>, CloseSession: CloseSession::<Identity, OFFSET> }
    }
    pub fn matches(iid: &windows_core::GUID) -> bool {
        iid == &<IAntimalware as windows_core::Interface>::IID
    }
}
pub trait IAntimalware2_Impl: Sized + IAntimalware_Impl {
    fn Notify(&self, buffer: *const core::ffi::c_void, length: u32, contentname: &windows_core::PCWSTR, appname: &windows_core::PCWSTR) -> windows_core::Result<AMSI_RESULT>;
}
impl windows_core::RuntimeName for IAntimalware2 {}
impl IAntimalware2_Vtbl {
    pub const fn new<Identity: windows_core::IUnknownImpl, const OFFSET: isize>() -> IAntimalware2_Vtbl
    where
        Identity: IAntimalware2_Impl,
    {
        unsafe extern "system" fn Notify<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, buffer: *const core::ffi::c_void, length: u32, contentname: windows_core::PCWSTR, appname: windows_core::PCWSTR, presult: *mut AMSI_RESULT) -> windows_core::HRESULT
        where
            Identity: IAntimalware2_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            match IAntimalware2_Impl::Notify(this, core::mem::transmute_copy(&buffer), core::mem::transmute_copy(&length), core::mem::transmute(&contentname), core::mem::transmute(&appname)) {
                Ok(ok__) => {
                    presult.write(core::mem::transmute(ok__));
                    windows_core::HRESULT(0)
                }
                Err(err) => err.into(),
            }
        }
        Self { base__: IAntimalware_Vtbl::new::<Identity, OFFSET>(), Notify: Notify::<Identity, OFFSET> }
    }
    pub fn matches(iid: &windows_core::GUID) -> bool {
        iid == &<IAntimalware2 as windows_core::Interface>::IID || iid == &<IAntimalware as windows_core::Interface>::IID
    }
}
pub trait IAntimalwareProvider_Impl: Sized {
    fn Scan(&self, stream: Option<&IAmsiStream>) -> windows_core::Result<AMSI_RESULT>;
    fn CloseSession(&self, session: u64);
    fn DisplayName(&self) -> windows_core::Result<windows_core::PWSTR>;
}
impl windows_core::RuntimeName for IAntimalwareProvider {}
impl IAntimalwareProvider_Vtbl {
    pub const fn new<Identity: windows_core::IUnknownImpl, const OFFSET: isize>() -> IAntimalwareProvider_Vtbl
    where
        Identity: IAntimalwareProvider_Impl,
    {
        unsafe extern "system" fn Scan<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, stream: *mut core::ffi::c_void, result: *mut AMSI_RESULT) -> windows_core::HRESULT
        where
            Identity: IAntimalwareProvider_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            match IAntimalwareProvider_Impl::Scan(this, windows_core::from_raw_borrowed(&stream)) {
                Ok(ok__) => {
                    result.write(core::mem::transmute(ok__));
                    windows_core::HRESULT(0)
                }
                Err(err) => err.into(),
            }
        }
        unsafe extern "system" fn CloseSession<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, session: u64)
        where
            Identity: IAntimalwareProvider_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            IAntimalwareProvider_Impl::CloseSession(this, core::mem::transmute_copy(&session))
        }
        unsafe extern "system" fn DisplayName<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, displayname: *mut windows_core::PWSTR) -> windows_core::HRESULT
        where
            Identity: IAntimalwareProvider_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            match IAntimalwareProvider_Impl::DisplayName(this) {
                Ok(ok__) => {
                    displayname.write(core::mem::transmute(ok__));
                    windows_core::HRESULT(0)
                }
                Err(err) => err.into(),
            }
        }
        Self {
            base__: windows_core::IUnknown_Vtbl::new::<Identity, OFFSET>(),
            Scan: Scan::<Identity, OFFSET>,
            CloseSession: CloseSession::<Identity, OFFSET>,
            DisplayName: DisplayName::<Identity, OFFSET>,
        }
    }
    pub fn matches(iid: &windows_core::GUID) -> bool {
        iid == &<IAntimalwareProvider as windows_core::Interface>::IID
    }
}
pub trait IAntimalwareProvider2_Impl: Sized + IAntimalwareProvider_Impl {
    fn Notify(&self, buffer: *const core::ffi::c_void, length: u32, contentname: &windows_core::PCWSTR, appname: &windows_core::PCWSTR) -> windows_core::Result<AMSI_RESULT>;
}
impl windows_core::RuntimeName for IAntimalwareProvider2 {}
impl IAntimalwareProvider2_Vtbl {
    pub const fn new<Identity: windows_core::IUnknownImpl, const OFFSET: isize>() -> IAntimalwareProvider2_Vtbl
    where
        Identity: IAntimalwareProvider2_Impl,
    {
        unsafe extern "system" fn Notify<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, buffer: *const core::ffi::c_void, length: u32, contentname: windows_core::PCWSTR, appname: windows_core::PCWSTR, presult: *mut AMSI_RESULT) -> windows_core::HRESULT
        where
            Identity: IAntimalwareProvider2_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            match IAntimalwareProvider2_Impl::Notify(this, core::mem::transmute_copy(&buffer), core::mem::transmute_copy(&length), core::mem::transmute(&contentname), core::mem::transmute(&appname)) {
                Ok(ok__) => {
                    presult.write(core::mem::transmute(ok__));
                    windows_core::HRESULT(0)
                }
                Err(err) => err.into(),
            }
        }
        Self { base__: IAntimalwareProvider_Vtbl::new::<Identity, OFFSET>(), Notify: Notify::<Identity, OFFSET> }
    }
    pub fn matches(iid: &windows_core::GUID) -> bool {
        iid == &<IAntimalwareProvider2 as windows_core::Interface>::IID || iid == &<IAntimalwareProvider as windows_core::Interface>::IID
    }
}
pub trait IAntimalwareUacProvider_Impl: Sized {
    fn UacScan(&self, context: *const AMSI_UAC_REQUEST_CONTEXT) -> windows_core::Result<AMSI_RESULT>;
    fn DisplayName(&self) -> windows_core::Result<windows_core::PWSTR>;
}
impl windows_core::RuntimeName for IAntimalwareUacProvider {}
impl IAntimalwareUacProvider_Vtbl {
    pub const fn new<Identity: windows_core::IUnknownImpl, const OFFSET: isize>() -> IAntimalwareUacProvider_Vtbl
    where
        Identity: IAntimalwareUacProvider_Impl,
    {
        unsafe extern "system" fn UacScan<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, context: *const AMSI_UAC_REQUEST_CONTEXT, result: *mut AMSI_RESULT) -> windows_core::HRESULT
        where
            Identity: IAntimalwareUacProvider_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            match IAntimalwareUacProvider_Impl::UacScan(this, core::mem::transmute_copy(&context)) {
                Ok(ok__) => {
                    result.write(core::mem::transmute(ok__));
                    windows_core::HRESULT(0)
                }
                Err(err) => err.into(),
            }
        }
        unsafe extern "system" fn DisplayName<Identity: windows_core::IUnknownImpl, const OFFSET: isize>(this: *mut core::ffi::c_void, displayname: *mut windows_core::PWSTR) -> windows_core::HRESULT
        where
            Identity: IAntimalwareUacProvider_Impl,
        {
            let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity);
            match IAntimalwareUacProvider_Impl::DisplayName(this) {
                Ok(ok__) => {
                    displayname.write(core::mem::transmute(ok__));
                    windows_core::HRESULT(0)
                }
                Err(err) => err.into(),
            }
        }
        Self {
            base__: windows_core::IUnknown_Vtbl::new::<Identity, OFFSET>(),
            UacScan: UacScan::<Identity, OFFSET>,
            DisplayName: DisplayName::<Identity, OFFSET>,
        }
    }
    pub fn matches(iid: &windows_core::GUID) -> bool {
        iid == &<IAntimalwareUacProvider as windows_core::Interface>::IID
    }
}