diff --git a/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs b/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs index 158688dd..18223e37 100644 --- a/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs +++ b/ffi/dotnet/Devolutions.IronRdp/Generated/DiplomatRuntime.cs @@ -46,11 +46,11 @@ public struct DiplomatWriteable : IDisposable IntPtr flushFuncPtr = Marshal.GetFunctionPointerForDelegate(flushFunc); IntPtr growFuncPtr = Marshal.GetFunctionPointerForDelegate(growFunc); - + // flushFunc and growFunc are managed objects and might be disposed of by the garbage collector. // To prevent this, we make the context hold the references and protect the context itself // for automatic disposal by moving it behind a GCHandle. - DiplomatWriteableContext ctx = new DiplomatWriteableContext(); + DiplomatWriteableContext ctx = new DiplomatWriteableContext(); ctx.flushFunc = flushFunc; ctx.growFunc = growFunc; GCHandle ctxHandle = GCHandle.Alloc(ctx); @@ -81,7 +81,7 @@ public struct DiplomatWriteable : IDisposable { throw new IndexOutOfRangeException("DiplomatWriteable buffer is too big"); } - return Marshal.PtrToStringUTF8(buf, (int)len); + return Marshal.PtrToStringUTF8(buf, (int) len); #else byte[] utf8 = ToUtf8Bytes(); return DiplomatUtils.Utf8ToString(utf8); diff --git a/ffi/dotnet/Devolutions.IronRdp/Generated/InclusiveRectangle.cs b/ffi/dotnet/Devolutions.IronRdp/Generated/InclusiveRectangle.cs index 3ffb403c..219cf4c0 100644 --- a/ffi/dotnet/Devolutions.IronRdp/Generated/InclusiveRectangle.cs +++ b/ffi/dotnet/Devolutions.IronRdp/Generated/InclusiveRectangle.cs @@ -15,6 +15,54 @@ public partial class InclusiveRectangle: IDisposable { private unsafe Raw.InclusiveRectangle* _inner; + public ushort Bottom + { + get + { + return GetBottom(); + } + } + + public ushort Height + { + get + { + return GetHeight(); + } + } + + public ushort Left + { + get + { + return GetLeft(); + } + } + + public ushort Right + { + get + { + return GetRight(); + } + } + + public ushort Top + { + get + { + return GetTop(); + } + } + + public ushort Width + { + get + { + return GetWidth(); + } + } + /// /// Creates a managed InclusiveRectangle from a raw handle. /// @@ -29,6 +77,84 @@ public partial class InclusiveRectangle: IDisposable _inner = handle; } + public ushort GetLeft() + { + unsafe + { + if (_inner == null) + { + throw new ObjectDisposedException("InclusiveRectangle"); + } + ushort retVal = Raw.InclusiveRectangle.GetLeft(_inner); + return retVal; + } + } + + public ushort GetTop() + { + unsafe + { + if (_inner == null) + { + throw new ObjectDisposedException("InclusiveRectangle"); + } + ushort retVal = Raw.InclusiveRectangle.GetTop(_inner); + return retVal; + } + } + + public ushort GetRight() + { + unsafe + { + if (_inner == null) + { + throw new ObjectDisposedException("InclusiveRectangle"); + } + ushort retVal = Raw.InclusiveRectangle.GetRight(_inner); + return retVal; + } + } + + public ushort GetBottom() + { + unsafe + { + if (_inner == null) + { + throw new ObjectDisposedException("InclusiveRectangle"); + } + ushort retVal = Raw.InclusiveRectangle.GetBottom(_inner); + return retVal; + } + } + + public ushort GetWidth() + { + unsafe + { + if (_inner == null) + { + throw new ObjectDisposedException("InclusiveRectangle"); + } + ushort retVal = Raw.InclusiveRectangle.GetWidth(_inner); + return retVal; + } + } + + public ushort GetHeight() + { + unsafe + { + if (_inner == null) + { + throw new ObjectDisposedException("InclusiveRectangle"); + } + ushort retVal = Raw.InclusiveRectangle.GetHeight(_inner); + return retVal; + } + } + /// /// Returns the underlying raw handle. /// diff --git a/ffi/dotnet/Devolutions.IronRdp/Generated/RawInclusiveRectangle.cs b/ffi/dotnet/Devolutions.IronRdp/Generated/RawInclusiveRectangle.cs index 6215e592..206b6e14 100644 --- a/ffi/dotnet/Devolutions.IronRdp/Generated/RawInclusiveRectangle.cs +++ b/ffi/dotnet/Devolutions.IronRdp/Generated/RawInclusiveRectangle.cs @@ -16,6 +16,24 @@ public partial struct InclusiveRectangle { private const string NativeLib = "DevolutionsIronRdp"; + [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "InclusiveRectangle_get_left", ExactSpelling = true)] + public static unsafe extern ushort GetLeft(InclusiveRectangle* self); + + [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "InclusiveRectangle_get_top", ExactSpelling = true)] + public static unsafe extern ushort GetTop(InclusiveRectangle* self); + + [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "InclusiveRectangle_get_right", ExactSpelling = true)] + public static unsafe extern ushort GetRight(InclusiveRectangle* self); + + [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "InclusiveRectangle_get_bottom", ExactSpelling = true)] + public static unsafe extern ushort GetBottom(InclusiveRectangle* self); + + [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "InclusiveRectangle_get_width", ExactSpelling = true)] + public static unsafe extern ushort GetWidth(InclusiveRectangle* self); + + [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "InclusiveRectangle_get_height", ExactSpelling = true)] + public static unsafe extern ushort GetHeight(InclusiveRectangle* self); + [DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "InclusiveRectangle_destroy", ExactSpelling = true)] public static unsafe extern void Destroy(InclusiveRectangle* self); } diff --git a/ffi/src/pdu.rs b/ffi/src/pdu.rs index d3680f64..73f6774a 100644 --- a/ffi/src/pdu.rs +++ b/ffi/src/pdu.rs @@ -1,6 +1,8 @@ #[diplomat::bridge] pub mod ffi { + use ironrdp::pdu::geometry::Rectangle; + use crate::{error::ffi::IronRdpError, utils::ffi::VecU8}; #[diplomat::opaque] @@ -34,6 +36,32 @@ pub mod ffi { #[diplomat::opaque] pub struct InclusiveRectangle(pub ironrdp::pdu::geometry::InclusiveRectangle); + impl InclusiveRectangle { + pub fn get_left(&self) -> u16 { + self.0.left + } + + pub fn get_top(&self) -> u16 { + self.0.top + } + + pub fn get_right(&self) -> u16 { + self.0.right + } + + pub fn get_bottom(&self) -> u16 { + self.0.bottom + } + + pub fn get_width(&self) -> u16 { + self.0.width() + } + + pub fn get_height(&self) -> u16 { + self.0.height() + } + } + #[diplomat::opaque] pub struct IronRdpPdu; // A struct representing the ironrdp_pdu crate