Browse Source

Applied SuppressUnmanagedCodeSecurity to P/Invokes with WinApi calling conventions.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/592/merge
Dimitar Dobrev 10 years ago
parent
commit
36c55fc656
  1. 4
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

4
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -2845,7 +2845,9 @@ namespace CppSharp.Generators.CSharp
: ((FunctionType) attributedType.Equivalent.Type).CallingConvention; : ((FunctionType) attributedType.Equivalent.Type).CallingConvention;
TypePrinter.PushContext(CSharpTypePrinterContextKind.Native); TypePrinter.PushContext(CSharpTypePrinterContextKind.Native);
var interopCallConv = callingConvention.ToInteropCallConv(); var interopCallConv = callingConvention.ToInteropCallConv();
if (interopCallConv != System.Runtime.InteropServices.CallingConvention.Winapi) if (interopCallConv == System.Runtime.InteropServices.CallingConvention.Winapi)
WriteLine("[SuppressUnmanagedCodeSecurity]");
else
WriteLine( WriteLine(
"[SuppressUnmanagedCodeSecurity, " + "[SuppressUnmanagedCodeSecurity, " +
"UnmanagedFunctionPointerAttribute(global::System.Runtime.InteropServices.CallingConvention.{0})]", "UnmanagedFunctionPointerAttribute(global::System.Runtime.InteropServices.CallingConvention.{0})]",

Loading…
Cancel
Save