locum 0.1.4

Captures everything a Direct3D 11 game draws in a frame, to look at, query, change and replay: d3d11.dll and dxgi.dll beside the game that watch every call on its way to the real runtime.
Documentation
//! Generated by `cargo xtask gen` from the `windows` crate's `ID3D12ProtectedResourceSession1_Vtbl`; do not edit.

#![allow(
    non_snake_case,
    clippy::too_many_arguments,
    clippy::missing_safety_doc,
    dead_code
)]

use core::ffi::c_void;

/// Every method of `ID3D12ProtectedResourceSession1` in vtable order. The defaults forward to the wrapped object [`Protected12Methods::inner`].
///
/// # Safety
/// The implementing type must be `#[repr(C)]` with a pointer to [`vtable`]'s table as its first field,
/// and `inner` must return a live `ID3D12ProtectedResourceSession1`.
pub unsafe trait Protected12Methods: Sized {
    /// The wrapped object, an `ID3D12ProtectedResourceSession1`.
    fn inner(&self) -> *mut c_void;
    unsafe fn QueryInterface(
        &self,
        iid: *const windows::core::GUID,
        out: *mut *mut c_void,
    ) -> windows::core::HRESULT;
    unsafe fn AddRef(&self) -> u32;
    unsafe fn Release(&self) -> u32;
    unsafe fn GetPrivateData(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut u32,
        a2: *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::GetPrivateData(self.inner(), a0, a1, a2) }
    }
    unsafe fn SetPrivateData(
        &self,
        a0: *const windows::core::GUID,
        a1: u32,
        a2: *const core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::SetPrivateData(self.inner(), a0, a1, a2) }
    }
    unsafe fn SetPrivateDataInterface(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::SetPrivateDataInterface(self.inner(), a0, a1) }
    }
    unsafe fn SetName(&self, a0: windows::core::PCWSTR) -> windows::core::HRESULT {
        unsafe { real::SetName(self.inner(), a0) }
    }
    unsafe fn GetDevice(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::GetDevice(self.inner(), a0, a1) }
    }
    unsafe fn GetStatusFence(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe { real::GetStatusFence(self.inner(), a0, a1) }
    }
    unsafe fn GetSessionStatus(
        &self,
    ) -> windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_SESSION_STATUS {
        unsafe { real::GetSessionStatus(self.inner()) }
    }
    unsafe fn GetDesc(
        &self,
        a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC,
    ) {
        unsafe { real::GetDesc(self.inner(), a0) }
    }
    unsafe fn GetDesc1(
        &self,
        a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC1,
    ) {
        unsafe { real::GetDesc1(self.inner(), a0) }
    }
}

/// Each method called on the real (wrapped) object: the trait's defaults, and overrides that still want the
/// real behaviour.
pub mod real {
    use core::ffi::c_void;

    /// `GetPrivateData` on the real object.
    pub unsafe fn GetPrivateData(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: *mut u32,
        a2: *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.base__.base__.base__.GetPrivateData)(inner, a0, a1, a2)
        }
    }
    /// `SetPrivateData` on the real object.
    pub unsafe fn SetPrivateData(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: u32,
        a2: *const core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.base__.base__.base__.SetPrivateData)(inner, a0, a1, a2)
        }
    }
    /// `SetPrivateDataInterface` on the real object.
    pub unsafe fn SetPrivateDataInterface(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.base__.base__.base__.SetPrivateDataInterface)(inner, a0, a1)
        }
    }
    /// `SetName` on the real object.
    pub unsafe fn SetName(inner: *mut c_void, a0: windows::core::PCWSTR) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.base__.base__.base__.SetName)(inner, a0)
        }
    }
    /// `GetDevice` on the real object.
    pub unsafe fn GetDevice(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.base__.base__.GetDevice)(inner, a0, a1)
        }
    }
    /// `GetStatusFence` on the real object.
    pub unsafe fn GetStatusFence(
        inner: *mut c_void,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.base__.GetStatusFence)(inner, a0, a1)
        }
    }
    /// `GetSessionStatus` on the real object.
    pub unsafe fn GetSessionStatus(
        inner: *mut c_void,
    ) -> windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_SESSION_STATUS {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.base__.GetSessionStatus)(inner)
        }
    }
    /// `GetDesc` on the real object.
    pub unsafe fn GetDesc(
        inner: *mut c_void,
        a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC,
    ) {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).base__.GetDesc)(inner, a0)
        }
    }
    /// `GetDesc1` on the real object.
    pub unsafe fn GetDesc1(
        inner: *mut c_void,
        a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC1,
    ) {
        unsafe {
            ((*(*(inner as *const *const windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl))).GetDesc1)(inner, a0)
        }
    }
}

unsafe extern "system" fn QueryInterface<T: Protected12Methods>(
    this: *mut c_void,
    iid: *const windows::core::GUID,
    out: *mut *mut c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).QueryInterface(iid, out) }
}
unsafe extern "system" fn AddRef<T: Protected12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).AddRef() }
}
unsafe extern "system" fn Release<T: Protected12Methods>(this: *mut c_void) -> u32 {
    unsafe { (*(this as *const T)).Release() }
}
unsafe extern "system" fn GetPrivateData<T: Protected12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: *mut u32,
    a2: *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).GetPrivateData(a0, a1, a2) }
}
unsafe extern "system" fn SetPrivateData<T: Protected12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: u32,
    a2: *const core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).SetPrivateData(a0, a1, a2) }
}
unsafe extern "system" fn SetPrivateDataInterface<T: Protected12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).SetPrivateDataInterface(a0, a1) }
}
unsafe extern "system" fn SetName<T: Protected12Methods>(
    this: *mut c_void,
    a0: windows::core::PCWSTR,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).SetName(a0) }
}
unsafe extern "system" fn GetDevice<T: Protected12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: *mut *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).GetDevice(a0, a1) }
}
unsafe extern "system" fn GetStatusFence<T: Protected12Methods>(
    this: *mut c_void,
    a0: *const windows::core::GUID,
    a1: *mut *mut core::ffi::c_void,
) -> windows::core::HRESULT {
    unsafe { (*(this as *const T)).GetStatusFence(a0, a1) }
}
unsafe extern "system" fn GetSessionStatus<T: Protected12Methods>(
    this: *mut c_void,
) -> windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_SESSION_STATUS {
    unsafe { (*(this as *const T)).GetSessionStatus() }
}
unsafe extern "system" fn GetDesc<T: Protected12Methods>(
    this: *mut c_void,
    a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC,
) {
    unsafe { (*(this as *const T)).GetDesc(a0) }
}
unsafe extern "system" fn GetDesc1<T: Protected12Methods>(
    this: *mut c_void,
    a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC1,
) {
    unsafe { (*(this as *const T)).GetDesc1(a0) }
}

#[allow(clippy::let_and_return)] // Uniform post-call interception in generated methods.
unsafe impl Protected12Methods for crate::d3d12::Object {
    fn inner(&self) -> *mut c_void {
        self.real()
    }
    unsafe fn QueryInterface(
        &self,
        iid: *const windows::core::GUID,
        out: *mut *mut c_void,
    ) -> windows::core::HRESULT {
        unsafe { self.query(iid, out) }
    }
    unsafe fn AddRef(&self) -> u32 {
        self.add_ref()
    }
    unsafe fn Release(&self) -> u32 {
        unsafe { self.release() }
    }
    unsafe fn GetPrivateData(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut u32,
        a2: *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::GetPrivateData(self.real(), a0, a1, a2);
            self.private_output(result, a0, a1, a2);
            result
        }
    }
    unsafe fn SetPrivateData(
        &self,
        a0: *const windows::core::GUID,
        a1: u32,
        a2: *const core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::SetPrivateData(self.real(), a0, a1, a2);
            if result.is_ok() {
                self.private_interface(a0, false);
            }
            result
        }
    }
    unsafe fn SetPrivateDataInterface(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::SetPrivateDataInterface(self.real(), a0, crate::d3d12::unwrap(a1));
            if result.is_ok() {
                self.private_interface(a0, !a1.is_null());
            }
            result
        }
    }
    unsafe fn SetName(&self, a0: windows::core::PCWSTR) -> windows::core::HRESULT {
        unsafe {
            let result = real::SetName(self.real(), a0);
            result
        }
    }
    unsafe fn GetDevice(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::GetDevice(self.real(), a0, a1);
            crate::d3d12::wrap_output(result, a0, a1);
            result
        }
    }
    unsafe fn GetStatusFence(
        &self,
        a0: *const windows::core::GUID,
        a1: *mut *mut core::ffi::c_void,
    ) -> windows::core::HRESULT {
        unsafe {
            let result = real::GetStatusFence(self.real(), a0, a1);
            crate::d3d12::wrap_output(result, a0, a1);
            result
        }
    }
    unsafe fn GetSessionStatus(
        &self,
    ) -> windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_SESSION_STATUS {
        unsafe {
            let result = real::GetSessionStatus(self.real());
            result
        }
    }
    unsafe fn GetDesc(
        &self,
        a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC,
    ) {
        unsafe {
            real::GetDesc(self.real(), a0);
        }
    }
    unsafe fn GetDesc1(
        &self,
        a0: *mut windows::Win32::Graphics::Direct3D12::D3D12_PROTECTED_RESOURCE_SESSION_DESC1,
    ) {
        unsafe {
            real::GetDesc1(self.real(), a0);
        }
    }
}

/// The `ID3D12ProtectedResourceSession1` vtable whose entries call `T`'s methods.
pub const fn vtable<T: Protected12Methods>()
-> windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl {
    windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession1_Vtbl {
        base__: windows::Win32::Graphics::Direct3D12::ID3D12ProtectedResourceSession_Vtbl {
            base__: windows::Win32::Graphics::Direct3D12::ID3D12ProtectedSession_Vtbl {
                base__: windows::Win32::Graphics::Direct3D12::ID3D12DeviceChild_Vtbl {
                    base__: windows::Win32::Graphics::Direct3D12::ID3D12Object_Vtbl {
                        base__: windows::core::IUnknown_Vtbl {
                            QueryInterface: QueryInterface::<T>,
                            AddRef: AddRef::<T>,
                            Release: Release::<T>,
                        },
                        GetPrivateData: GetPrivateData::<T>,
                        SetPrivateData: SetPrivateData::<T>,
                        SetPrivateDataInterface: SetPrivateDataInterface::<T>,
                        SetName: SetName::<T>,
                    },
                    GetDevice: GetDevice::<T>,
                },
                GetStatusFence: GetStatusFence::<T>,
                GetSessionStatus: GetSessionStatus::<T>,
            },
            GetDesc: GetDesc::<T>,
        },
        GetDesc1: GetDesc1::<T>,
    }
}