From 41a3986384af6b010de102169315a977a1c7f5d4 Mon Sep 17 00:00:00 2001 From: tinysec Date: Thu, 9 Jul 2026 00:12:24 +0800 Subject: [PATCH] feat: add Architecture.RegisterCallingConvention (Python parity) The C# binding declared BNRegisterCallingConvention but exposed no managed wrapper, so plugin authors defining custom architectures could not register a calling convention. Mirror Python Architecture.register_calling_convention (architecture.py:2593) with a direct pass-through on Architecture. --- Handle/BNArchitecture.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Handle/BNArchitecture.cs b/Handle/BNArchitecture.cs index a2edd16..cd3dcbd 100644 --- a/Handle/BNArchitecture.cs +++ b/Handle/BNArchitecture.cs @@ -1080,6 +1080,22 @@ LowLevelILFunction il ); } + /// + /// Registers a new calling convention with this architecture, mirroring Python + /// Architecture.register_calling_convention (architecture.py:2593). A calling + /// convention must be registered here before it can be assigned as the + /// default/cdecl/stdcall/fastcall convention. Intended for custom-architecture plugin + /// authors. + /// + /// The CallingConvention to register. + public void RegisterCallingConvention(CallingConvention callingConvention) + { + NativeMethods.BNRegisterCallingConvention( + this.handle , + callingConvention.DangerousGetHandle() + ); + } + /// /// Gets the cdecl calling convention for this architecture. ///